diff options
author | Ben Murdoch <benm@google.com> | 2009-08-11 17:01:47 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2009-08-11 18:21:02 +0100 |
commit | 0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5 (patch) | |
tree | 2943df35f62d885c89d01063cc528dd73b480fea /WebCore/bridge | |
parent | 7e7a70bfa49a1122b2597a1e6367d89eb4035eca (diff) | |
download | external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.zip external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.gz external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.bz2 |
Merge in WebKit r47029.
Diffstat (limited to 'WebCore/bridge')
26 files changed, 110 insertions, 99 deletions
diff --git a/WebCore/bridge/NP_jsobject.cpp b/WebCore/bridge/NP_jsobject.cpp index b1000d0..3eea06e 100644 --- a/WebCore/bridge/NP_jsobject.cpp +++ b/WebCore/bridge/NP_jsobject.cpp @@ -113,7 +113,7 @@ bool _NPN_InvokeDefault(NPP, NPObject* o, const NPVariant* args, uint32_t argCou return false; ExecState* exec = rootObject->globalObject()->globalExec(); - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); // Call the function object. JSValue function = obj->imp; @@ -164,7 +164,7 @@ bool _NPN_Invoke(NPP npp, NPObject* o, NPIdentifier methodName, const NPVariant* if (!rootObject || !rootObject->isValid()) return false; ExecState* exec = rootObject->globalObject()->globalExec(); - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); JSValue function = obj->imp->get(exec, identifierFromNPIdentifier(i->string())); CallData callData; CallType callType = function.getCallData(callData); @@ -202,7 +202,7 @@ bool _NPN_Evaluate(NPP, NPObject* o, NPString* s, NPVariant* variant) return false; ExecState* exec = rootObject->globalObject()->globalExec(); - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); String scriptString = convertNPStringToUTF16(s); ProtectedPtr<JSGlobalObject> globalObject = rootObject->globalObject(); globalObject->globalData()->timeoutChecker.start(); @@ -239,7 +239,7 @@ bool _NPN_GetProperty(NPP, NPObject* o, NPIdentifier propertyName, NPVariant* va ExecState* exec = rootObject->globalObject()->globalExec(); IdentifierRep* i = static_cast<IdentifierRep*>(propertyName); - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); JSValue result; if (i->isString()) result = obj->imp->get(exec, identifierFromNPIdentifier(i->string())); @@ -271,7 +271,7 @@ bool _NPN_SetProperty(NPP, NPObject* o, NPIdentifier propertyName, const NPVaria return false; ExecState* exec = rootObject->globalObject()->globalExec(); - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); IdentifierRep* i = static_cast<IdentifierRep*>(propertyName); if (i->isString()) { @@ -312,7 +312,7 @@ bool _NPN_RemoveProperty(NPP, NPObject* o, NPIdentifier propertyName) } } - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); if (i->isString()) obj->imp->deleteProperty(exec, identifierFromNPIdentifier(i->string())); else @@ -335,7 +335,7 @@ bool _NPN_HasProperty(NPP, NPObject* o, NPIdentifier propertyName) ExecState* exec = rootObject->globalObject()->globalExec(); IdentifierRep* i = static_cast<IdentifierRep*>(propertyName); - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); if (i->isString()) { bool result = obj->imp->hasProperty(exec, identifierFromNPIdentifier(i->string())); exec->clearException(); @@ -367,7 +367,7 @@ bool _NPN_HasMethod(NPP, NPObject* o, NPIdentifier methodName) return false; ExecState* exec = rootObject->globalObject()->globalExec(); - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); JSValue func = obj->imp->get(exec, identifierFromNPIdentifier(i->string())); exec->clearException(); return !func.isUndefined(); @@ -402,7 +402,7 @@ bool _NPN_Enumerate(NPP, NPObject* o, NPIdentifier** identifier, uint32_t* count return false; ExecState* exec = rootObject->globalObject()->globalExec(); - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); PropertyNameArray propertyNames(exec); obj->imp->getPropertyNames(exec, propertyNames); @@ -439,7 +439,7 @@ bool _NPN_Construct(NPP, NPObject* o, const NPVariant* args, uint32_t argCount, return false; ExecState* exec = rootObject->globalObject()->globalExec(); - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); // Call the constructor object. JSValue constructor = obj->imp; diff --git a/WebCore/bridge/c/c_class.cpp b/WebCore/bridge/c/c_class.cpp index 7ce9927..e8499cb 100644 --- a/WebCore/bridge/c/c_class.cpp +++ b/WebCore/bridge/c/c_class.cpp @@ -44,7 +44,7 @@ CClass::CClass(NPClass* aClass) CClass::~CClass() { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); deleteAllValues(_methods); _methods.clear(); @@ -86,7 +86,7 @@ MethodList CClass::methodsNamed(const Identifier& identifier, Instance* instance if (_isa->hasMethod && _isa->hasMethod(obj, ident)){ Method* aMethod = new CMethod(ident); // deleted in the CClass destructor { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); _methods.set(identifier.ustring().rep(), aMethod); } methodList.append(aMethod); @@ -107,7 +107,7 @@ Field* CClass::fieldNamed(const Identifier& identifier, Instance* instance) cons if (_isa->hasProperty && _isa->hasProperty(obj, ident)){ aField = new CField(ident); // deleted in the CClass destructor { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); _fields.set(identifier.ustring().rep(), aField); } } diff --git a/WebCore/bridge/c/c_instance.cpp b/WebCore/bridge/c/c_instance.cpp index 97a89eb..6ce6572 100644 --- a/WebCore/bridge/c/c_instance.cpp +++ b/WebCore/bridge/c/c_instance.cpp @@ -70,7 +70,7 @@ void CInstance::moveGlobalExceptionToExecState(ExecState* exec) return; { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); throwError(exec, GeneralError, globalExceptionString()); } @@ -128,7 +128,7 @@ JSValue CInstance::invokeMethod(ExecState* exec, const MethodList& methodList, c VOID_TO_NPVARIANT(resultVariant); { - JSLock::DropAllLocks dropAllLocks(false); + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); ASSERT(globalExceptionString().isNull()); _object->_class->invoke(_object, ident, cArgs.data(), count, &resultVariant); moveGlobalExceptionToExecState(exec); @@ -165,7 +165,7 @@ JSValue CInstance::invokeDefaultMethod(ExecState* exec, const ArgList& args) NPVariant resultVariant; VOID_TO_NPVARIANT(resultVariant); { - JSLock::DropAllLocks dropAllLocks(false); + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); ASSERT(globalExceptionString().isNull()); _object->_class->invokeDefault(_object, cArgs.data(), count, &resultVariant); moveGlobalExceptionToExecState(exec); @@ -203,7 +203,7 @@ JSValue CInstance::invokeConstruct(ExecState* exec, const ArgList& args) NPVariant resultVariant; VOID_TO_NPVARIANT(resultVariant); { - JSLock::DropAllLocks dropAllLocks(false); + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); ASSERT(globalExceptionString().isNull()); _object->_class->construct(_object, cArgs.data(), count, &resultVariant); moveGlobalExceptionToExecState(exec); @@ -259,7 +259,7 @@ void CInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArray) NPIdentifier* identifiers; { - JSLock::DropAllLocks dropAllLocks(false); + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); ASSERT(globalExceptionString().isNull()); bool ok = _object->_class->enumerate(_object, &identifiers, &count); moveGlobalExceptionToExecState(exec); diff --git a/WebCore/bridge/c/c_runtime.cpp b/WebCore/bridge/c/c_runtime.cpp index 9338775..46d7c6f 100644 --- a/WebCore/bridge/c/c_runtime.cpp +++ b/WebCore/bridge/c/c_runtime.cpp @@ -86,7 +86,7 @@ JSValue CField::valueFromInstance(ExecState* exec, const Instance* inst) const #endif // ANDROID_NPN_SETEXCEPTION bool result; { - JSLock::DropAllLocks dropAllLocks(false); + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); result = obj->_class->getProperty(obj, _fieldIdentifier, &property); } #ifdef ANDROID_NPN_SETEXCEPTION @@ -113,7 +113,7 @@ void CField::setValueToInstance(ExecState *exec, const Instance *inst, JSValue a SetGlobalException(0); #endif // ANDROID_NPN_SETEXCEPTION { - JSLock::DropAllLocks dropAllLocks(false); + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); obj->_class->setProperty(obj, _fieldIdentifier, &variant); } diff --git a/WebCore/bridge/c/c_utility.cpp b/WebCore/bridge/c/c_utility.cpp index 77b5de2..7ff77e7 100644 --- a/WebCore/bridge/c/c_utility.cpp +++ b/WebCore/bridge/c/c_utility.cpp @@ -68,7 +68,7 @@ static String convertUTF8ToUTF16WithLatin1Fallback(const NPUTF8* UTF8Chars, int // Variant value must be released with NPReleaseVariantValue() void convertValueToNPVariant(ExecState* exec, JSValue value, NPVariant* result) { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); VOID_TO_NPVARIANT(*result); @@ -107,7 +107,7 @@ void convertValueToNPVariant(ExecState* exec, JSValue value, NPVariant* result) JSValue convertNPVariantToValue(ExecState* exec, const NPVariant* variant, RootObject* rootObject) { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); NPVariantType type = variant->type; diff --git a/WebCore/bridge/jni/jni_class.cpp b/WebCore/bridge/jni/jni_class.cpp index 4e3b5f9..0877e50 100644 --- a/WebCore/bridge/jni/jni_class.cpp +++ b/WebCore/bridge/jni/jni_class.cpp @@ -60,7 +60,7 @@ JavaClass::JavaClass(jobject anInstance) jobject aJField = env->GetObjectArrayElement((jobjectArray)fields, i); JavaField *aField = new JavaField(env, aJField); // deleted in the JavaClass destructor { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); _fields.set(aField->name(), aField); } env->DeleteLocalRef(aJField); @@ -74,7 +74,7 @@ JavaClass::JavaClass(jobject anInstance) JavaMethod *aMethod = new JavaMethod(env, aJMethod); // deleted in the JavaClass destructor MethodList* methodList; { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); methodList = _methods.get(aMethod->name()); if (!methodList) { @@ -95,7 +95,7 @@ JavaClass::JavaClass(jobject anInstance) JavaClass::~JavaClass() { free((void *)_name); - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); deleteAllValues(_fields); _fields.clear(); diff --git a/WebCore/bridge/jni/jni_instance.cpp b/WebCore/bridge/jni/jni_instance.cpp index c47bd8b..0022196 100644 --- a/WebCore/bridge/jni/jni_instance.cpp +++ b/WebCore/bridge/jni/jni_instance.cpp @@ -86,7 +86,7 @@ Class *JavaInstance::getClass() const JSValue JavaInstance::stringValue(ExecState* exec) const { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); jstring stringValue = (jstring)callJNIMethod<jobject>(_instance->_instance, "toString", "()Ljava/lang/String;"); JNIEnv *env = getJNIEnv(); diff --git a/WebCore/bridge/jni/jni_jsobject.mm b/WebCore/bridge/jni/jni_jsobject.mm index 32d7b0d..c9af8b0 100644 --- a/WebCore/bridge/jni/jni_jsobject.mm +++ b/WebCore/bridge/jni/jni_jsobject.mm @@ -290,7 +290,7 @@ jobject JavaJSObject::call(jstring methodName, jobjectArray args) const // Lookup the function object. ExecState* exec = rootObject->globalObject()->globalExec(); - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); Identifier identifier(exec, JavaString(methodName)); JSValue function = _imp->get(exec, identifier); @@ -315,7 +315,7 @@ jobject JavaJSObject::eval(jstring script) const JSValue result; - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); RootObject* rootObject = this->rootObject(); if (!rootObject) @@ -346,7 +346,7 @@ jobject JavaJSObject::getMember(jstring memberName) const ExecState* exec = rootObject->globalObject()->globalExec(); - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); JSValue result = _imp->get(exec, Identifier(exec, JavaString(memberName))); return convertValueToJObject(result); @@ -362,7 +362,7 @@ void JavaJSObject::setMember(jstring memberName, jobject value) const ExecState* exec = rootObject->globalObject()->globalExec(); - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); PutPropertySlot slot; _imp->put(exec, Identifier(exec, JavaString(memberName)), convertJObjectToValue(exec, value), slot); } @@ -377,7 +377,7 @@ void JavaJSObject::removeMember(jstring memberName) const return; ExecState* exec = rootObject->globalObject()->globalExec(); - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); _imp->deleteProperty(exec, Identifier(exec, JavaString(memberName))); } @@ -396,7 +396,7 @@ jobject JavaJSObject::getSlot(jint index) const ExecState* exec = rootObject->globalObject()->globalExec(); - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); JSValue result = _imp->get(exec, index); return convertValueToJObject(result); @@ -416,7 +416,7 @@ void JavaJSObject::setSlot(jint index, jobject value) const return; ExecState* exec = rootObject->globalObject()->globalExec(); - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); _imp->put(exec, (unsigned)index, convertJObjectToValue(exec, value)); } @@ -429,7 +429,7 @@ jstring JavaJSObject::toString() const if (!rootObject) return 0; - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); JSObject *thisObj = const_cast<JSObject*>(_imp); ExecState* exec = rootObject->globalObject()->globalExec(); @@ -487,7 +487,7 @@ jlong JavaJSObject::createNative(jlong nativeHandle) jobject JavaJSObject::convertValueToJObject(JSValue value) const { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); RootObject* rootObject = this->rootObject(); if (!rootObject) @@ -600,7 +600,7 @@ JSValue JavaJSObject::convertJObjectToValue(ExecState* exec, jobject theObject) return imp; } - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); return JavaInstance::create(theObject, _rootObject)->createRuntimeObject(exec); } diff --git a/WebCore/bridge/jni/jni_objc.mm b/WebCore/bridge/jni/jni_objc.mm index 7c19442..0306bfd 100644 --- a/WebCore/bridge/jni/jni_objc.mm +++ b/WebCore/bridge/jni/jni_objc.mm @@ -61,7 +61,7 @@ bool JSC::Bindings::dispatchJNICall(ExecState* exec, const void* targetAppletVie // implemented in WebCore will guarantee that only appropriate JavaScript // can reference the applet. { - JSLock::DropAllLocks dropAllLocks(false); + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); result = [view webPlugInCallJava:obj isStatic:isStatic returnType:returnType method:methodID arguments:args callingURL:nil exceptionDescription:&_exceptionDescription]; } @@ -71,7 +71,7 @@ bool JSC::Bindings::dispatchJNICall(ExecState* exec, const void* targetAppletVie return true; } else if ([view respondsToSelector:@selector(webPlugInCallJava:method:returnType:arguments:)]) { - JSLock::DropAllLocks dropAllLocks(false); + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); result = [view webPlugInCallJava:obj method:methodID returnType:returnType arguments:args]; return true; } diff --git a/WebCore/bridge/jni/jni_runtime.cpp b/WebCore/bridge/jni/jni_runtime.cpp index 9d06a8c..2bac17a 100644 --- a/WebCore/bridge/jni/jni_runtime.cpp +++ b/WebCore/bridge/jni/jni_runtime.cpp @@ -319,7 +319,7 @@ static void appendClassName(UString& aString, const char* className) const char *JavaMethod::signature() const { if (!_signature) { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); UString signatureBuilder("("); for (int i = 0; i < _numParameters; i++) { diff --git a/WebCore/bridge/jni/jni_runtime.h b/WebCore/bridge/jni/jni_runtime.h index f3cbf2b..81484ff 100644 --- a/WebCore/bridge/jni/jni_runtime.h +++ b/WebCore/bridge/jni/jni_runtime.h @@ -46,7 +46,7 @@ class JavaString public: JavaString() { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); _rep = UString().rep(); } @@ -55,7 +55,7 @@ public: int _size = e->GetStringLength (s); const jchar *uc = getUCharactersFromJStringInEnv (e, s); { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); _rep = UString(reinterpret_cast<const UChar*>(uc), _size).rep(); } releaseUCharactersForJStringInEnv (e, s, uc); @@ -71,13 +71,13 @@ public: ~JavaString() { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); _rep = 0; } const char *UTF8String() const { if (_utf8String.c_str() == 0) { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); _utf8String = UString(_rep).UTF8String(); } return _utf8String.c_str(); diff --git a/WebCore/bridge/jni/jni_utility.cpp b/WebCore/bridge/jni/jni_utility.cpp index 31cdfea..e57e475 100644 --- a/WebCore/bridge/jni/jni_utility.cpp +++ b/WebCore/bridge/jni/jni_utility.cpp @@ -474,7 +474,7 @@ static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray jvalue convertValueToJValue(ExecState* exec, JSValue value, JNIType _JNIType, const char* javaClassName) { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); jvalue result; diff --git a/WebCore/bridge/npapi.h b/WebCore/bridge/npapi.h index d436565..126d513 100644 --- a/WebCore/bridge/npapi.h +++ b/WebCore/bridge/npapi.h @@ -341,8 +341,6 @@ typedef enum { */ NPPVpluginWantsAllNetworkStreams = 18, - NPPVpluginPrivateModeBool = 19, - /* Checks to see if the plug-in would like the browser to load the "src" attribute. */ NPPVpluginCancelSrcStream = 20, diff --git a/WebCore/bridge/objc/objc_instance.mm b/WebCore/bridge/objc/objc_instance.mm index 094ed78..b84f7bb 100644 --- a/WebCore/bridge/objc/objc_instance.mm +++ b/WebCore/bridge/objc/objc_instance.mm @@ -64,7 +64,7 @@ void ObjcInstance::moveGlobalExceptionToExecState(ExecState* exec) } if (!s_exceptionEnvironment || s_exceptionEnvironment == exec->dynamicGlobalObject()) { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); throwError(exec, GeneralError, s_exception); } @@ -128,7 +128,7 @@ JSValue ObjcInstance::invokeMethod(ExecState* exec, const MethodList &methodList { JSValue result = jsUndefined(); - JSLock::DropAllLocks dropAllLocks(false); // Can't put this inside the @try scope because it unwinds incorrectly. + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); // Can't put this inside the @try scope because it unwinds incorrectly. setGlobalException(nil); @@ -249,7 +249,7 @@ JSValue ObjcInstance::invokeDefaultMethod(ExecState* exec, const ArgList &args) { JSValue result = jsUndefined(); - JSLock::DropAllLocks dropAllLocks(false); // Can't put this inside the @try scope because it unwinds incorrectly. + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); // Can't put this inside the @try scope because it unwinds incorrectly. setGlobalException(nil); @try { @@ -302,7 +302,7 @@ bool ObjcInstance::setValueOfUndefinedField(ExecState* exec, const Identifier& p if (![targetObject respondsToSelector:@selector(setValue:forUndefinedKey:)]) return false; - JSLock::DropAllLocks dropAllLocks(false); // Can't put this inside the @try scope because it unwinds incorrectly. + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); // Can't put this inside the @try scope because it unwinds incorrectly. // This check is not really necessary because NSObject implements // setValue:forUndefinedKey:, and unfortnately the default implementation @@ -330,7 +330,7 @@ JSValue ObjcInstance::getValueOfUndefinedField(ExecState* exec, const Identifier id targetObject = getObject(); - JSLock::DropAllLocks dropAllLocks(false); // Can't put this inside the @try scope because it unwinds incorrectly. + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); // Can't put this inside the @try scope because it unwinds incorrectly. // This check is not really necessary because NSObject implements // valueForUndefinedKey:, and unfortnately the default implementation diff --git a/WebCore/bridge/objc/objc_runtime.mm b/WebCore/bridge/objc/objc_runtime.mm index 4169517..2d69c1c 100644 --- a/WebCore/bridge/objc/objc_runtime.mm +++ b/WebCore/bridge/objc/objc_runtime.mm @@ -96,15 +96,15 @@ JSValue ObjcField::valueFromInstance(ExecState* exec, const Instance* instance) id targetObject = (static_cast<const ObjcInstance*>(instance))->getObject(); - JSLock::DropAllLocks dropAllLocks(false); // Can't put this inside the @try scope because it unwinds incorrectly. + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); // Can't put this inside the @try scope because it unwinds incorrectly. @try { if (id objcValue = [targetObject valueForKey:(NSString *)_name.get()]) result = convertObjcValueToValue(exec, &objcValue, ObjcObjectType, instance->rootObject()); } @catch(NSException* localException) { - JSLock::lock(false); + JSLock::lock(SilenceAssertionsOnly); throwError(exec, GeneralError, [localException reason]); - JSLock::unlock(false); + JSLock::unlock(SilenceAssertionsOnly); } // Work around problem in some versions of GCC where result gets marked volatile and @@ -125,14 +125,14 @@ void ObjcField::setValueToInstance(ExecState* exec, const Instance* instance, JS id targetObject = (static_cast<const ObjcInstance*>(instance))->getObject(); id value = convertValueToObjcObject(exec, aValue); - JSLock::DropAllLocks dropAllLocks(false); // Can't put this inside the @try scope because it unwinds incorrectly. + JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); // Can't put this inside the @try scope because it unwinds incorrectly. @try { [targetObject setValue:value forKey:(NSString *)_name.get()]; } @catch(NSException* localException) { - JSLock::lock(false); + JSLock::lock(SilenceAssertionsOnly); throwError(exec, GeneralError, [localException reason]); - JSLock::unlock(false); + JSLock::unlock(SilenceAssertionsOnly); } } @@ -189,7 +189,8 @@ unsigned int ObjcArray::getLength() const const ClassInfo ObjcFallbackObjectImp::s_info = { "ObjcFallbackObject", 0, 0, 0 }; ObjcFallbackObjectImp::ObjcFallbackObjectImp(ExecState* exec, ObjcInstance* i, const Identifier& propertyName) - : JSObject(getDOMStructure<ObjcFallbackObjectImp>(exec)) + // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object + : JSObject(deprecatedGetDOMStructure<ObjcFallbackObjectImp>(exec)) , _instance(i) , _item(propertyName) { diff --git a/WebCore/bridge/objc/objc_utility.mm b/WebCore/bridge/objc/objc_utility.mm index 501131d..bf59627 100644 --- a/WebCore/bridge/objc/objc_utility.mm +++ b/WebCore/bridge/objc/objc_utility.mm @@ -136,7 +136,7 @@ ObjcValue convertValueToObjcValue(ExecState* exec, JSValue value, ObjcValueType switch (type) { case ObjcObjectType: { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); JSGlobalObject *originGlobalObject = exec->dynamicGlobalObject(); RootObject* originRootObject = findRootObject(originGlobalObject); @@ -196,7 +196,7 @@ ObjcValue convertValueToObjcValue(ExecState* exec, JSValue value, ObjcValueType JSValue convertNSStringToString(ExecState* exec, NSString *nsstring) { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); unichar *chars; unsigned int length = [nsstring length]; @@ -228,7 +228,7 @@ JSValue convertNSStringToString(ExecState* exec, NSString *nsstring) */ JSValue convertObjcValueToValue(ExecState* exec, void* buffer, ObjcValueType type, RootObject* rootObject) { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); switch (type) { case ObjcObjectType: { diff --git a/WebCore/bridge/qt/qt_instance.cpp b/WebCore/bridge/qt/qt_instance.cpp index 60cf16f..506697a 100644 --- a/WebCore/bridge/qt/qt_instance.cpp +++ b/WebCore/bridge/qt/qt_instance.cpp @@ -74,7 +74,7 @@ private: const ClassInfo QtRuntimeObjectImp::s_info = { "QtRuntimeObject", &RuntimeObjectImp::s_info, 0, 0 }; QtRuntimeObjectImp::QtRuntimeObjectImp(ExecState* exec, PassRefPtr<Instance> instance) - : RuntimeObjectImp(exec, WebCore::getDOMStructure<QtRuntimeObjectImp>(exec), instance) + : RuntimeObjectImp(exec, WebCore::deprecatedGetDOMStructure<QtRuntimeObjectImp>(exec), instance) { } @@ -91,7 +91,7 @@ void QtRuntimeObjectImp::invalidate() void QtRuntimeObjectImp::removeFromCache() { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); QtInstance* key = cachedObjects.key(this); if (key) cachedObjects.remove(key); @@ -110,7 +110,7 @@ QtInstance::QtInstance(QObject* o, PassRefPtr<RootObject> rootObject, QScriptEng QtInstance::~QtInstance() { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); cachedObjects.remove(this); cachedInstances.remove(m_hashkey); @@ -118,9 +118,7 @@ QtInstance::~QtInstance() // clean up (unprotect from gc) the JSValues we've created m_methods.clear(); - foreach(QtField* f, m_fields.values()) { - delete f; - } + qDeleteAll(m_fields); m_fields.clear(); if (m_object) { @@ -140,7 +138,7 @@ QtInstance::~QtInstance() PassRefPtr<QtInstance> QtInstance::getQtInstance(QObject* o, PassRefPtr<RootObject> rootObject, QScriptEngine::ValueOwnership ownership) { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); foreach(QtInstance* instance, cachedInstances.values(o)) { if (instance->rootObject() == rootObject) @@ -163,6 +161,19 @@ void QtInstance::put(JSObject* object, ExecState* exec, const Identifier& proper object->JSObject::put(exec, propertyName, value, slot); } +void QtInstance::removeCachedMethod(JSObject* method) +{ + if (m_defaultMethod == method) + m_defaultMethod = 0; + + for(QHash<QByteArray, JSObject*>::Iterator it = m_methods.begin(), + end = m_methods.end(); it != end; ++it) + if (it.value() == method) { + m_methods.erase(it); + return; + } +} + QtInstance* QtInstance::getInstance(JSObject* object) { if (!object) @@ -181,7 +192,7 @@ Class* QtInstance::getClass() const RuntimeObjectImp* QtInstance::createRuntimeObject(ExecState* exec) { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); RuntimeObjectImp* ret = static_cast<RuntimeObjectImp*>(cachedObjects.value(this)); if (!ret) { ret = new (exec) QtRuntimeObjectImp(exec, this); @@ -193,16 +204,12 @@ RuntimeObjectImp* QtInstance::createRuntimeObject(ExecState* exec) void QtInstance::mark() { - if (m_defaultMethod) + if (m_defaultMethod && !m_defaultMethod->marked()) m_defaultMethod->mark(); foreach(JSObject* val, m_methods.values()) { if (val && !val->marked()) val->mark(); } - foreach(JSValue val, m_children.values()) { - if (val && !val.marked()) - val.mark(); - } } void QtInstance::begin() @@ -355,13 +362,7 @@ JSValue QtField::valueFromInstance(ExecState* exec, const Instance* inst) const else if (m_type == DynamicProperty) val = obj->property(m_dynamicProperty); - JSValue ret = convertQVariantToValue(exec, inst->rootObject(), val); - - // Need to save children so we can mark them - if (m_type == ChildObject) - instance->m_children.insert(ret); - - return ret; + return convertQVariantToValue(exec, inst->rootObject(), val); } else { QString msg = QString(QLatin1String("cannot access member `%1' of deleted QObject")).arg(QLatin1String(name())); return throwError(exec, GeneralError, msg.toLatin1().constData()); diff --git a/WebCore/bridge/qt/qt_instance.h b/WebCore/bridge/qt/qt_instance.h index 590fadf..23766b1 100644 --- a/WebCore/bridge/qt/qt_instance.h +++ b/WebCore/bridge/qt/qt_instance.h @@ -65,6 +65,8 @@ public: virtual bool getOwnPropertySlot(JSObject*, ExecState*, const Identifier&, PropertySlot&); virtual void put(JSObject*, ExecState*, const Identifier&, JSValue, PutPropertySlot&); + void removeCachedMethod(JSObject*); + static QtInstance* getInstance(JSObject*); private: @@ -81,7 +83,6 @@ private: QObject* m_hashkey; mutable QHash<QByteArray, JSObject*> m_methods; mutable QHash<QString, QtField*> m_fields; - mutable QSet<JSValue> m_children; mutable QtRuntimeMetaMethod* m_defaultMethod; QScriptEngine::ValueOwnership m_ownership; }; diff --git a/WebCore/bridge/qt/qt_runtime.cpp b/WebCore/bridge/qt/qt_runtime.cpp index 161e570..6be119c 100644 --- a/WebCore/bridge/qt/qt_runtime.cpp +++ b/WebCore/bridge/qt/qt_runtime.cpp @@ -167,7 +167,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type return QVariant(); } - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); JSRealType type = valueRealType(exec, value); if (hint == QMetaType::Void) { switch(type) { @@ -770,7 +770,7 @@ JSValue convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, con return jsNull(); } - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); if (type == QMetaType::Bool) return jsBoolean(variant.toBool()); @@ -907,7 +907,7 @@ JSValue convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, con const ClassInfo QtRuntimeMethod::s_info = { "QtRuntimeMethod", 0, 0, 0 }; QtRuntimeMethod::QtRuntimeMethod(QtRuntimeMethodData* dd, ExecState* exec, const Identifier& ident, PassRefPtr<QtInstance> inst) - : InternalFunction(&exec->globalData(), getDOMStructure<QtRuntimeMethod>(exec), ident) + : InternalFunction(&exec->globalData(), deprecatedGetDOMStructure<QtRuntimeMethod>(exec), ident) , d_ptr(dd) { QW_D(QtRuntimeMethod); @@ -916,6 +916,8 @@ QtRuntimeMethod::QtRuntimeMethod(QtRuntimeMethodData* dd, ExecState* exec, const QtRuntimeMethod::~QtRuntimeMethod() { + QW_D(QtRuntimeMethod); + d->m_instance->removeCachedMethod(this); delete d_ptr; } @@ -1345,7 +1347,7 @@ JSValue QtRuntimeMetaMethod::call(ExecState* exec, JSObject* functionObject, JSV return jsUndefined(); // We have to pick a method that matches.. - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); QObject *obj = d->m_instance->getObject(); if (obj) { @@ -1438,7 +1440,7 @@ JSValue QtRuntimeConnectionMethod::call(ExecState* exec, JSObject* functionObjec { QtRuntimeConnectionMethodData* d = static_cast<QtRuntimeConnectionMethod *>(functionObject)->d_func(); - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); QObject* sender = d->m_instance->getObject(); @@ -1668,7 +1670,7 @@ void QtConnectionObject::execute(void **argv) int argc = parameterTypes.count(); - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); // ### Should the Interpreter/ExecState come from somewhere else? RefPtr<RootObject> ro = m_instance->rootObject(); diff --git a/WebCore/bridge/runtime.cpp b/WebCore/bridge/runtime.cpp index d6b6962..6934406 100644 --- a/WebCore/bridge/runtime.cpp +++ b/WebCore/bridge/runtime.cpp @@ -80,7 +80,7 @@ void Instance::end() RuntimeObjectImp* Instance::createRuntimeObject(ExecState* exec) { - JSLock lock(false); + JSLock lock(SilenceAssertionsOnly); return new (exec) RuntimeObjectImp(exec, this); } diff --git a/WebCore/bridge/runtime.h b/WebCore/bridge/runtime.h index 72736d4..2f74a4e 100644 --- a/WebCore/bridge/runtime.h +++ b/WebCore/bridge/runtime.h @@ -55,14 +55,14 @@ public: virtual ~Field() { } }; -class Method : Noncopyable { +class Method : public Noncopyable { public: virtual int numParameters() const = 0; virtual ~Method() { } }; -class Class : Noncopyable { +class Class : public Noncopyable { public: virtual MethodList methodsNamed(const Identifier&, Instance*) const = 0; virtual Field* fieldNamed(const Identifier&, Instance*) const = 0; @@ -120,7 +120,7 @@ protected: RefPtr<RootObject> _rootObject; }; -class Array : Noncopyable { +class Array : public Noncopyable { public: Array(PassRefPtr<RootObject>); virtual ~Array(); diff --git a/WebCore/bridge/runtime_array.cpp b/WebCore/bridge/runtime_array.cpp index fead83a..2849822 100644 --- a/WebCore/bridge/runtime_array.cpp +++ b/WebCore/bridge/runtime_array.cpp @@ -36,9 +36,11 @@ namespace JSC { const ClassInfo RuntimeArray::s_info = { "RuntimeArray", &JSArray::info, 0, 0 }; -RuntimeArray::RuntimeArray(ExecState* exec, Bindings::Array* a) - : JSObject(getDOMStructure<RuntimeArray>(exec)) - , _array(a) +RuntimeArray::RuntimeArray(ExecState* exec, Bindings::Array* array) + // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object + // We need to pass in the right global object for "array". + : JSObject(deprecatedGetDOMStructure<RuntimeArray>(exec)) + , _array(array) { } diff --git a/WebCore/bridge/runtime_method.cpp b/WebCore/bridge/runtime_method.cpp index 30a3581..0af0af5 100644 --- a/WebCore/bridge/runtime_method.cpp +++ b/WebCore/bridge/runtime_method.cpp @@ -41,8 +41,11 @@ ASSERT_CLASS_FITS_IN_CELL(RuntimeMethod); const ClassInfo RuntimeMethod::s_info = { "RuntimeMethod", 0, 0, 0 }; -RuntimeMethod::RuntimeMethod(ExecState* exec, const Identifier& ident, Bindings::MethodList& m) - : InternalFunction(&exec->globalData(), getDOMStructure<RuntimeMethod>(exec), ident) +RuntimeMethod::RuntimeMethod(ExecState* exec, const Identifier& ident, Bindings::MethodList& m) + // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object + // exec-globalData() is also likely wrong. + // Callers will need to pass in the right global object corresponding to this native object "m". + : InternalFunction(&exec->globalData(), deprecatedGetDOMStructure<RuntimeMethod>(exec), ident) , _methodList(new MethodList(m)) { } diff --git a/WebCore/bridge/runtime_object.cpp b/WebCore/bridge/runtime_object.cpp index 79afd3f..385f914 100644 --- a/WebCore/bridge/runtime_object.cpp +++ b/WebCore/bridge/runtime_object.cpp @@ -41,7 +41,9 @@ using namespace Bindings; const ClassInfo RuntimeObjectImp::s_info = { "RuntimeObject", 0, 0, 0 }; RuntimeObjectImp::RuntimeObjectImp(ExecState* exec, PassRefPtr<Instance> i) - : JSObject(getDOMStructure<RuntimeObjectImp>(exec)) + // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object + // We need to pass in the right global object for "i". + : JSObject(deprecatedGetDOMStructure<RuntimeObjectImp>(exec)) , instance(i) { instance->rootObject()->addRuntimeObject(this); diff --git a/WebCore/bridge/runtime_root.cpp b/WebCore/bridge/runtime_root.cpp index 8e00fd5..0e9bf74 100644 --- a/WebCore/bridge/runtime_root.cpp +++ b/WebCore/bridge/runtime_root.cpp @@ -22,6 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + #include "config.h" #include "runtime_root.h" diff --git a/WebCore/bridge/runtime_root.h b/WebCore/bridge/runtime_root.h index 0d6fdbd..eacbb57 100644 --- a/WebCore/bridge/runtime_root.h +++ b/WebCore/bridge/runtime_root.h @@ -86,4 +86,4 @@ private: } // namespace JSC -#endif +#endif // RUNTIME_ROOT_H_ |