diff options
Diffstat (limited to 'src/3rdparty/webkit/WebCore/bridge')
39 files changed, 741 insertions, 617 deletions
diff --git a/src/3rdparty/webkit/WebCore/bridge/IdentifierRep.cpp b/src/3rdparty/webkit/WebCore/bridge/IdentifierRep.cpp new file mode 100644 index 0000000..11560e3 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/IdentifierRep.cpp @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 "IdentifierRep.h" + +#include "PlatformString.h" +#include <runtime/UString.h> +#include <wtf/HashMap.h> +#include <wtf/StdLibExtras.h> + +using namespace JSC; + +namespace WebCore { + +typedef HashSet<IdentifierRep*> IdentifierSet; + +static IdentifierSet& identifierSet() +{ + DEFINE_STATIC_LOCAL(IdentifierSet, identifierSet, ()); + return identifierSet; +} + +typedef HashMap<int, IdentifierRep*> IntIdentifierMap; + +static IntIdentifierMap& intIdentifierMap() +{ + DEFINE_STATIC_LOCAL(IntIdentifierMap, intIdentifierMap, ()); + return intIdentifierMap; +} + +IdentifierRep* IdentifierRep::get(int intID) +{ + if (intID == 0 || intID == -1) { + static IdentifierRep* negativeOneAndZeroIdentifiers[2]; + + IdentifierRep* identifier = negativeOneAndZeroIdentifiers[intID + 1]; + if (!identifier) { + identifier = new IdentifierRep(intID); + + negativeOneAndZeroIdentifiers[intID + 1] = identifier; + } + + return identifier; + } + + pair<IntIdentifierMap::iterator, bool> result = intIdentifierMap().add(intID, 0); + if (result.second) { + ASSERT(!result.first->second); + result.first->second = new IdentifierRep(intID); + + identifierSet().add(result.first->second); + } + + return result.first->second; +} + +typedef HashMap<RefPtr<JSC::UString::Rep>, IdentifierRep*> StringIdentifierMap; + +static StringIdentifierMap& stringIdentifierMap() +{ + DEFINE_STATIC_LOCAL(StringIdentifierMap, stringIdentifierMap, ()); + return stringIdentifierMap; +} + +IdentifierRep* IdentifierRep::get(const char* name) +{ + ASSERT(name); + if (!name) + return 0; + + UString string = String::fromUTF8WithLatin1Fallback(name, strlen(name)); + pair<StringIdentifierMap::iterator, bool> result = stringIdentifierMap().add(string.rep(), 0); + if (result.second) { + ASSERT(!result.first->second); + result.first->second = new IdentifierRep(name); + + identifierSet().add(result.first->second); + } + + return result.first->second; +} + +bool IdentifierRep::isValid(IdentifierRep* identifier) +{ + return identifierSet().contains(identifier); +} + +} // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bridge/IdentifierRep.h b/src/3rdparty/webkit/WebCore/bridge/IdentifierRep.h new file mode 100644 index 0000000..8e0e0d9 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/IdentifierRep.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef IdentifierRep_h +#define IdentifierRep_h + +#include <wtf/Assertions.h> +#include <string.h> + +namespace WebCore { + +class IdentifierRep { +public: + static IdentifierRep* get(int); + static IdentifierRep* get(const char*); + + static bool isValid(IdentifierRep*); + + bool isString() const { return m_isString; } + + int number() const { return m_isString ? 0 : m_value.m_number; } + const char* string() const { return m_isString ? m_value.m_string : 0; } + +private: + IdentifierRep(int number) + : m_isString(false) + { + m_value.m_number = number; + } + + IdentifierRep(const char* name) + : m_isString(true) + { + m_value.m_string = strdup(name); + } + + ~IdentifierRep() + { + // IdentifierReps should never be deleted. + ASSERT_NOT_REACHED(); + } + + union { + const char* m_string; + int m_number; + } m_value; + bool m_isString; +}; + +} // namespace WebCore + +#endif // IdentifierRep_h diff --git a/src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp b/src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp index 743414a..3258c54 100644 --- a/src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp @@ -32,6 +32,8 @@ #include "PlatformString.h" #include "StringSourceProvider.h" #include "c_utility.h" +#include "c_instance.h" +#include "IdentifierRep.h" #include "npruntime_impl.h" #include "npruntime_priv.h" #include "runtime_root.h" @@ -43,12 +45,11 @@ #include <runtime/Completion.h> #include <runtime/Completion.h> -using WebCore::String; -using WebCore::StringSourceProvider; using namespace JSC; using namespace JSC::Bindings; +using namespace WebCore; -static void getListFromVariantArgs(ExecState* exec, const NPVariant* args, unsigned argCount, RootObject* rootObject, ArgList& aList) +static void getListFromVariantArgs(ExecState* exec, const NPVariant* args, unsigned argCount, RootObject* rootObject, MarkedArgumentBuffer& aList) { for (unsigned i = 0; i < argCount; ++i) aList.append(convertNPVariantToValue(exec, &args[i], rootObject)); @@ -112,18 +113,18 @@ bool _NPN_InvokeDefault(NPP, NPObject* o, const NPVariant* args, uint32_t argCou JSLock lock(false); // Call the function object. - JSValuePtr function = obj->imp; + JSValue function = obj->imp; CallData callData; - CallType callType = function->getCallData(callData); + CallType callType = function.getCallData(callData); if (callType == CallTypeNone) return false; - ArgList argList; + MarkedArgumentBuffer argList; getListFromVariantArgs(exec, args, argCount, rootObject, argList); ProtectedPtr<JSGlobalObject> globalObject = rootObject->globalObject(); - globalObject->startTimeoutCheck(); - JSValuePtr resultV = call(exec, function, callType, callData, function, argList); - globalObject->stopTimeoutCheck(); + globalObject->globalData()->timeoutChecker.start(); + JSValue resultV = call(exec, function, callType, callData, function, argList); + globalObject->globalData()->timeoutChecker.stop(); // Convert and return the result of the function call. convertValueToNPVariant(exec, resultV, result); @@ -142,8 +143,8 @@ bool _NPN_Invoke(NPP npp, NPObject* o, NPIdentifier methodName, const NPVariant* if (o->_class == NPScriptObjectClass) { JavaScriptObject* obj = reinterpret_cast<JavaScriptObject*>(o); - PrivateIdentifier* i = static_cast<PrivateIdentifier*>(methodName); - if (!i->isString) + IdentifierRep* i = static_cast<IdentifierRep*>(methodName); + if (!i->isString()) return false; // Special case the "eval" method. @@ -161,19 +162,19 @@ bool _NPN_Invoke(NPP npp, NPObject* o, NPIdentifier methodName, const NPVariant* return false; ExecState* exec = rootObject->globalObject()->globalExec(); JSLock lock(false); - JSValuePtr function = obj->imp->get(exec, identifierFromNPIdentifier(i->value.string)); + JSValue function = obj->imp->get(exec, identifierFromNPIdentifier(i->string())); CallData callData; - CallType callType = function->getCallData(callData); + CallType callType = function.getCallData(callData); if (callType == CallTypeNone) return false; // Call the function object. - ArgList argList; + MarkedArgumentBuffer argList; getListFromVariantArgs(exec, args, argCount, rootObject, argList); ProtectedPtr<JSGlobalObject> globalObject = rootObject->globalObject(); - globalObject->startTimeoutCheck(); - JSValuePtr resultV = call(exec, function, callType, callData, obj->imp, argList); - globalObject->stopTimeoutCheck(); + globalObject->globalData()->timeoutChecker.start(); + JSValue resultV = call(exec, function, callType, callData, obj->imp, argList); + globalObject->globalData()->timeoutChecker.stop(); // Convert and return the result of the function call. convertValueToNPVariant(exec, resultV, result); @@ -201,12 +202,12 @@ bool _NPN_Evaluate(NPP, NPObject* o, NPString* s, NPVariant* variant) JSLock lock(false); String scriptString = convertNPStringToUTF16(s); ProtectedPtr<JSGlobalObject> globalObject = rootObject->globalObject(); - globalObject->startTimeoutCheck(); + globalObject->globalData()->timeoutChecker.start(); Completion completion = JSC::evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(scriptString)); - globalObject->stopTimeoutCheck(); + globalObject->globalData()->timeoutChecker.stop(); ComplType type = completion.complType(); - JSValuePtr result; + JSValue result; if (type == Normal) { result = completion.value(); if (!result) @@ -233,14 +234,14 @@ bool _NPN_GetProperty(NPP, NPObject* o, NPIdentifier propertyName, NPVariant* va return false; ExecState* exec = rootObject->globalObject()->globalExec(); - PrivateIdentifier* i = static_cast<PrivateIdentifier*>(propertyName); + IdentifierRep* i = static_cast<IdentifierRep*>(propertyName); JSLock lock(false); - JSValuePtr result; - if (i->isString) - result = obj->imp->get(exec, identifierFromNPIdentifier(i->value.string)); + JSValue result; + if (i->isString()) + result = obj->imp->get(exec, identifierFromNPIdentifier(i->string())); else - result = obj->imp->get(exec, i->value.number); + result = obj->imp->get(exec, i->number()); convertValueToNPVariant(exec, result, variant); exec->clearException(); @@ -268,13 +269,13 @@ bool _NPN_SetProperty(NPP, NPObject* o, NPIdentifier propertyName, const NPVaria ExecState* exec = rootObject->globalObject()->globalExec(); JSLock lock(false); - PrivateIdentifier* i = static_cast<PrivateIdentifier*>(propertyName); + IdentifierRep* i = static_cast<IdentifierRep*>(propertyName); - if (i->isString) { + if (i->isString()) { PutPropertySlot slot; - obj->imp->put(exec, identifierFromNPIdentifier(i->value.string), convertNPVariantToValue(exec, variant, rootObject), slot); + obj->imp->put(exec, identifierFromNPIdentifier(i->string()), convertNPVariantToValue(exec, variant, rootObject), slot); } else - obj->imp->put(exec, i->value.number, convertNPVariantToValue(exec, variant, rootObject)); + obj->imp->put(exec, i->number(), convertNPVariantToValue(exec, variant, rootObject)); exec->clearException(); return true; } @@ -295,24 +296,24 @@ bool _NPN_RemoveProperty(NPP, NPObject* o, NPIdentifier propertyName) return false; ExecState* exec = rootObject->globalObject()->globalExec(); - PrivateIdentifier* i = static_cast<PrivateIdentifier*>(propertyName); - if (i->isString) { - if (!obj->imp->hasProperty(exec, identifierFromNPIdentifier(i->value.string))) { + IdentifierRep* i = static_cast<IdentifierRep*>(propertyName); + if (i->isString()) { + if (!obj->imp->hasProperty(exec, identifierFromNPIdentifier(i->string()))) { exec->clearException(); return false; } } else { - if (!obj->imp->hasProperty(exec, i->value.number)) { + if (!obj->imp->hasProperty(exec, i->number())) { exec->clearException(); return false; } } JSLock lock(false); - if (i->isString) - obj->imp->deleteProperty(exec, identifierFromNPIdentifier(i->value.string)); + if (i->isString()) + obj->imp->deleteProperty(exec, identifierFromNPIdentifier(i->string())); else - obj->imp->deleteProperty(exec, i->value.number); + obj->imp->deleteProperty(exec, i->number()); exec->clearException(); return true; @@ -330,15 +331,15 @@ bool _NPN_HasProperty(NPP, NPObject* o, NPIdentifier propertyName) return false; ExecState* exec = rootObject->globalObject()->globalExec(); - PrivateIdentifier* i = static_cast<PrivateIdentifier*>(propertyName); + IdentifierRep* i = static_cast<IdentifierRep*>(propertyName); JSLock lock(false); - if (i->isString) { - bool result = obj->imp->hasProperty(exec, identifierFromNPIdentifier(i->value.string)); + if (i->isString()) { + bool result = obj->imp->hasProperty(exec, identifierFromNPIdentifier(i->string())); exec->clearException(); return result; } - bool result = obj->imp->hasProperty(exec, i->value.number); + bool result = obj->imp->hasProperty(exec, i->number()); exec->clearException(); return result; } @@ -354,8 +355,8 @@ bool _NPN_HasMethod(NPP, NPObject* o, NPIdentifier methodName) if (o->_class == NPScriptObjectClass) { JavaScriptObject* obj = reinterpret_cast<JavaScriptObject*>(o); - PrivateIdentifier* i = static_cast<PrivateIdentifier*>(methodName); - if (!i->isString) + IdentifierRep* i = static_cast<IdentifierRep*>(methodName); + if (!i->isString()) return false; RootObject* rootObject = obj->rootObject; @@ -364,9 +365,9 @@ bool _NPN_HasMethod(NPP, NPObject* o, NPIdentifier methodName) ExecState* exec = rootObject->globalObject()->globalExec(); JSLock lock(false); - JSValuePtr func = obj->imp->get(exec, identifierFromNPIdentifier(i->value.string)); + JSValue func = obj->imp->get(exec, identifierFromNPIdentifier(i->string())); exec->clearException(); - return !func->isUndefined(); + return !func.isUndefined(); } if (o->_class->hasMethod) @@ -375,11 +376,11 @@ bool _NPN_HasMethod(NPP, NPObject* o, NPIdentifier methodName) return false; } -void _NPN_SetException(NPObject*, const NPUTF8*) +void _NPN_SetException(NPObject*, const NPUTF8* message) { - // FIXME: - // Bug 19888: Implement _NPN_SetException() correctly - // <https://bugs.webkit.org/show_bug.cgi?id=19888> + // Ignorning the NPObject param is consistent with the Mozilla implementation. + UString exception(message); + CInstance::setGlobalException(exception); } bool _NPN_Enumerate(NPP, NPObject* o, NPIdentifier** identifier, uint32_t* count) @@ -432,18 +433,18 @@ bool _NPN_Construct(NPP, NPObject* o, const NPVariant* args, uint32_t argCount, JSLock lock(false); // Call the constructor object. - JSValuePtr constructor = obj->imp; + JSValue constructor = obj->imp; ConstructData constructData; - ConstructType constructType = constructor->getConstructData(constructData); + ConstructType constructType = constructor.getConstructData(constructData); if (constructType == ConstructTypeNone) return false; - ArgList argList; + MarkedArgumentBuffer argList; getListFromVariantArgs(exec, args, argCount, rootObject, argList); ProtectedPtr<JSGlobalObject> globalObject = rootObject->globalObject(); - globalObject->startTimeoutCheck(); - JSValuePtr resultV = construct(exec, constructor, constructType, constructData, argList); - globalObject->stopTimeoutCheck(); + globalObject->globalData()->timeoutChecker.start(); + JSValue resultV = construct(exec, constructor, constructType, constructData, argList); + globalObject->globalData()->timeoutChecker.stop(); // Convert and return the result. convertValueToNPVariant(exec, resultV, result); diff --git a/src/3rdparty/webkit/WebCore/bridge/c/c_class.cpp b/src/3rdparty/webkit/WebCore/bridge/c/c_class.cpp index f81feda..7ce9927 100644 --- a/src/3rdparty/webkit/WebCore/bridge/c/c_class.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/c/c_class.cpp @@ -70,11 +70,6 @@ CClass* CClass::classForIsA(NPClass* isa) return aClass; } -const char* CClass::name() const -{ - return ""; -} - MethodList CClass::methodsNamed(const Identifier& identifier, Instance* instance) const { MethodList methodList; diff --git a/src/3rdparty/webkit/WebCore/bridge/c/c_class.h b/src/3rdparty/webkit/WebCore/bridge/c/c_class.h index 9a08605..7f20af4 100644 --- a/src/3rdparty/webkit/WebCore/bridge/c/c_class.h +++ b/src/3rdparty/webkit/WebCore/bridge/c/c_class.h @@ -43,7 +43,6 @@ public: static CClass* classForIsA(NPClass*); virtual ~CClass(); - virtual const char* name() const; virtual MethodList methodsNamed(const Identifier&, Instance*) const; virtual Field* fieldNamed(const Identifier&, Instance*) const; diff --git a/src/3rdparty/webkit/WebCore/bridge/c/c_instance.cpp b/src/3rdparty/webkit/WebCore/bridge/c/c_instance.cpp index 37c3dd8..71f6c2f 100644 --- a/src/3rdparty/webkit/WebCore/bridge/c/c_instance.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/c/c_instance.cpp @@ -32,20 +32,51 @@ #include "c_class.h" #include "c_runtime.h" #include "c_utility.h" +#include "IdentifierRep.h" #include "npruntime_impl.h" #include "runtime_root.h" #include <runtime/ArgList.h> +#include <runtime/Error.h> #include <interpreter/CallFrame.h> #include <runtime/JSLock.h> #include <runtime/JSNumberCell.h> #include <runtime/PropertyNameArray.h> #include <wtf/Assertions.h> +#include <wtf/StdLibExtras.h> #include <wtf/StringExtras.h> #include <wtf/Vector.h> +using namespace WebCore; + namespace JSC { namespace Bindings { +using JSC::UString; + +static JSC::UString& globalExceptionString() +{ + DEFINE_STATIC_LOCAL(JSC::UString, exceptionStr, ()); + return exceptionStr; +} + +void CInstance::setGlobalException(UString exception) +{ + globalExceptionString() = exception; +} + +void CInstance::moveGlobalExceptionToExecState(ExecState* exec) +{ + if (globalExceptionString().isNull()) + return; + + { + JSLock lock(false); + throwError(exec, GeneralError, globalExceptionString()); + } + + globalExceptionString() = UString(); +} + CInstance::CInstance(NPObject* o, PassRefPtr<RootObject> rootObject) : Instance(rootObject) { @@ -70,7 +101,7 @@ bool CInstance::supportsInvokeDefaultMethod() const return _object->_class->invokeDefault; } -JSValuePtr CInstance::invokeMethod(ExecState* exec, const MethodList& methodList, const ArgList& args) +JSValue CInstance::invokeMethod(ExecState* exec, const MethodList& methodList, const ArgList& args) { // Overloading methods are not allowed by NPObjects. Should only be one // name match for a particular method. @@ -78,7 +109,7 @@ JSValuePtr CInstance::invokeMethod(ExecState* exec, const MethodList& methodList CMethod* method = static_cast<CMethod*>(methodList[0]); - NPIdentifier ident = _NPN_GetStringIdentifier(method->name()); + NPIdentifier ident = method->identifier(); if (!_object->_class->hasMethod(_object, ident)) return jsUndefined(); @@ -87,7 +118,7 @@ JSValuePtr CInstance::invokeMethod(ExecState* exec, const MethodList& methodList unsigned i; for (i = 0; i < count; i++) - convertValueToNPVariant(exec, args.at(exec, i), &cArgs[i]); + convertValueToNPVariant(exec, args.at(i), &cArgs[i]); // Invoke the 'C' method. NPVariant resultVariant; @@ -95,19 +126,21 @@ JSValuePtr CInstance::invokeMethod(ExecState* exec, const MethodList& methodList { JSLock::DropAllLocks dropAllLocks(false); + ASSERT(globalExceptionString().isNull()); _object->_class->invoke(_object, ident, cArgs.data(), count, &resultVariant); + moveGlobalExceptionToExecState(exec); } for (i = 0; i < count; i++) _NPN_ReleaseVariantValue(&cArgs[i]); - JSValuePtr resultValue = convertNPVariantToValue(exec, &resultVariant, _rootObject.get()); + JSValue resultValue = convertNPVariantToValue(exec, &resultVariant, _rootObject.get()); _NPN_ReleaseVariantValue(&resultVariant); return resultValue; } -JSValuePtr CInstance::invokeDefaultMethod(ExecState* exec, const ArgList& args) +JSValue CInstance::invokeDefaultMethod(ExecState* exec, const ArgList& args) { if (!_object->_class->invokeDefault) return jsUndefined(); @@ -117,20 +150,22 @@ JSValuePtr CInstance::invokeDefaultMethod(ExecState* exec, const ArgList& args) unsigned i; for (i = 0; i < count; i++) - convertValueToNPVariant(exec, args.at(exec, i), &cArgs[i]); + convertValueToNPVariant(exec, args.at(i), &cArgs[i]); // Invoke the 'C' method. NPVariant resultVariant; VOID_TO_NPVARIANT(resultVariant); { JSLock::DropAllLocks dropAllLocks(false); + ASSERT(globalExceptionString().isNull()); _object->_class->invokeDefault(_object, cArgs.data(), count, &resultVariant); + moveGlobalExceptionToExecState(exec); } - + for (i = 0; i < count; i++) _NPN_ReleaseVariantValue(&cArgs[i]); - JSValuePtr resultValue = convertNPVariantToValue(exec, &resultVariant, _rootObject.get()); + JSValue resultValue = convertNPVariantToValue(exec, &resultVariant, _rootObject.get()); _NPN_ReleaseVariantValue(&resultVariant); return resultValue; } @@ -140,7 +175,7 @@ bool CInstance::supportsConstruct() const return _object->_class->construct; } -JSValuePtr CInstance::invokeConstruct(ExecState* exec, const ArgList& args) +JSValue CInstance::invokeConstruct(ExecState* exec, const ArgList& args) { if (!_object->_class->construct) return jsUndefined(); @@ -150,25 +185,27 @@ JSValuePtr CInstance::invokeConstruct(ExecState* exec, const ArgList& args) unsigned i; for (i = 0; i < count; i++) - convertValueToNPVariant(exec, args.at(exec, i), &cArgs[i]); + convertValueToNPVariant(exec, args.at(i), &cArgs[i]); // Invoke the 'C' method. NPVariant resultVariant; VOID_TO_NPVARIANT(resultVariant); { JSLock::DropAllLocks dropAllLocks(false); + ASSERT(globalExceptionString().isNull()); _object->_class->construct(_object, cArgs.data(), count, &resultVariant); + moveGlobalExceptionToExecState(exec); } - + for (i = 0; i < count; i++) _NPN_ReleaseVariantValue(&cArgs[i]); - JSValuePtr resultValue = convertNPVariantToValue(exec, &resultVariant, _rootObject.get()); + JSValue resultValue = convertNPVariantToValue(exec, &resultVariant, _rootObject.get()); _NPN_ReleaseVariantValue(&resultVariant); return resultValue; } -JSValuePtr CInstance::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const +JSValue CInstance::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const { if (hint == PreferString) return stringValue(exec); @@ -177,26 +214,26 @@ JSValuePtr CInstance::defaultValue(ExecState* exec, PreferredPrimitiveType hint) return valueOf(exec); } -JSValuePtr CInstance::stringValue(ExecState* exec) const +JSValue CInstance::stringValue(ExecState* exec) const { char buf[1024]; snprintf(buf, sizeof(buf), "NPObject %p, NPClass %p", _object, _object->_class); return jsString(exec, buf); } -JSValuePtr CInstance::numberValue(ExecState* exec) const +JSValue CInstance::numberValue(ExecState* exec) const { // FIXME: Implement something sensible. return jsNumber(exec, 0); } -JSValuePtr CInstance::booleanValue() const +JSValue CInstance::booleanValue() const { // FIXME: Implement something sensible. return jsBoolean(false); } -JSValuePtr CInstance::valueOf(ExecState* exec) const +JSValue CInstance::valueOf(ExecState* exec) const { return stringValue(exec); } @@ -211,17 +248,20 @@ void CInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArray) { JSLock::DropAllLocks dropAllLocks(false); - if (!_object->_class->enumerate(_object, &identifiers, &count)) + ASSERT(globalExceptionString().isNull()); + bool ok = _object->_class->enumerate(_object, &identifiers, &count); + moveGlobalExceptionToExecState(exec); + if (!ok) return; } for (uint32_t i = 0; i < count; i++) { - PrivateIdentifier* identifier = static_cast<PrivateIdentifier*>(identifiers[i]); + IdentifierRep* identifier = static_cast<IdentifierRep*>(identifiers[i]); - if (identifier->isString) - nameArray.add(identifierFromNPIdentifier(identifier->value.string)); + if (identifier->isString()) + nameArray.add(identifierFromNPIdentifier(identifier->string())); else - nameArray.add(Identifier::from(exec, identifier->value.number)); + nameArray.add(Identifier::from(exec, identifier->number())); } // FIXME: This should really call NPN_MemFree but that's in WebKit diff --git a/src/3rdparty/webkit/WebCore/bridge/c/c_instance.h b/src/3rdparty/webkit/WebCore/bridge/c/c_instance.h index b16943a..f9e9de3 100644 --- a/src/3rdparty/webkit/WebCore/bridge/c/c_instance.h +++ b/src/3rdparty/webkit/WebCore/bridge/c/c_instance.h @@ -36,6 +36,8 @@ typedef struct NPObject NPObject; namespace JSC { +class UString; + namespace Bindings { class CClass; @@ -46,33 +48,35 @@ public: { return adoptRef(new CInstance(object, rootObject)); } + + static void setGlobalException(JSC::UString exception); + ~CInstance (); - + virtual Class *getClass() const; - virtual JSValuePtr valueOf(ExecState*) const; - virtual JSValuePtr defaultValue(ExecState*, PreferredPrimitiveType) const; - - virtual JSValuePtr invokeMethod(ExecState*, const MethodList&, const ArgList&); + virtual JSValue valueOf(ExecState*) const; + virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const; + + virtual JSValue invokeMethod(ExecState*, const MethodList&, const ArgList&); virtual bool supportsInvokeDefaultMethod() const; - virtual JSValuePtr invokeDefaultMethod(ExecState*, const ArgList&); - + virtual JSValue invokeDefaultMethod(ExecState*, const ArgList&); + virtual bool supportsConstruct() const; - virtual JSValuePtr invokeConstruct(ExecState*, const ArgList&); + virtual JSValue invokeConstruct(ExecState*, const ArgList&); virtual void getPropertyNames(ExecState*, PropertyNameArray&); - JSValuePtr stringValue(ExecState*) const; - JSValuePtr numberValue(ExecState*) const; - JSValuePtr booleanValue() const; - - NPObject *getObject() const { return _object; } + JSValue stringValue(ExecState*) const; + JSValue numberValue(ExecState*) const; + JSValue booleanValue() const; - virtual BindingLanguage getBindingLanguage() const { return CLanguage; } + NPObject *getObject() const { return _object; } private: + static void moveGlobalExceptionToExecState(ExecState* exec); CInstance(NPObject*, PassRefPtr<RootObject>); - + mutable CClass *_class; NPObject *_object; }; diff --git a/src/3rdparty/webkit/WebCore/bridge/c/c_runtime.cpp b/src/3rdparty/webkit/WebCore/bridge/c/c_runtime.cpp index 0b854f8..6beb86c 100644 --- a/src/3rdparty/webkit/WebCore/bridge/c/c_runtime.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/c/c_runtime.cpp @@ -37,23 +37,7 @@ namespace JSC { namespace Bindings { -// ---------------------- CMethod ---------------------- - -const char* CMethod::name() const -{ - PrivateIdentifier *i = (PrivateIdentifier *)_methodIdentifier; - return i->isString ? i->value.string : 0; -} - -// ---------------------- CField ---------------------- - -const char* CField::name() const -{ - PrivateIdentifier *i = (PrivateIdentifier *)_fieldIdentifier; - return i->isString ? i->value.string : 0; -} - -JSValuePtr CField::valueFromInstance(ExecState* exec, const Instance* inst) const +JSValue CField::valueFromInstance(ExecState* exec, const Instance* inst) const { const CInstance* instance = static_cast<const CInstance*>(inst); NPObject* obj = instance->getObject(); @@ -67,7 +51,7 @@ JSValuePtr CField::valueFromInstance(ExecState* exec, const Instance* inst) cons result = obj->_class->getProperty(obj, _fieldIdentifier, &property); } if (result) { - JSValuePtr result = convertNPVariantToValue(exec, &property, instance->rootObject()); + JSValue result = convertNPVariantToValue(exec, &property, instance->rootObject()); _NPN_ReleaseVariantValue(&property); return result; } @@ -75,7 +59,7 @@ JSValuePtr CField::valueFromInstance(ExecState* exec, const Instance* inst) cons return jsUndefined(); } -void CField::setValueToInstance(ExecState *exec, const Instance *inst, JSValuePtr aValue) const +void CField::setValueToInstance(ExecState *exec, const Instance *inst, JSValue aValue) const { const CInstance* instance = static_cast<const CInstance*>(inst); NPObject* obj = instance->getObject(); diff --git a/src/3rdparty/webkit/WebCore/bridge/c/c_runtime.h b/src/3rdparty/webkit/WebCore/bridge/c/c_runtime.h index eaac894..e797342 100644 --- a/src/3rdparty/webkit/WebCore/bridge/c/c_runtime.h +++ b/src/3rdparty/webkit/WebCore/bridge/c/c_runtime.h @@ -38,9 +38,10 @@ class CField : public Field { public: CField(NPIdentifier ident) : _fieldIdentifier(ident) { } - virtual JSValuePtr valueFromInstance(ExecState*, const Instance*) const; - virtual void setValueToInstance(ExecState*, const Instance*, JSValuePtr) const; - virtual const char* name() const; + virtual JSValue valueFromInstance(ExecState*, const Instance*) const; + virtual void setValueToInstance(ExecState*, const Instance*, JSValue) const; + + NPIdentifier identifier() const { return _fieldIdentifier; } private: NPIdentifier _fieldIdentifier; @@ -52,7 +53,7 @@ class CMethod : public Method public: CMethod(NPIdentifier ident) : _methodIdentifier(ident) { } - virtual const char* name() const; + NPIdentifier identifier() const { return _methodIdentifier; } virtual int numParameters() const { return 0; } private: diff --git a/src/3rdparty/webkit/WebCore/bridge/c/c_utility.cpp b/src/3rdparty/webkit/WebCore/bridge/c/c_utility.cpp index 227c1d9..77b5de2 100644 --- a/src/3rdparty/webkit/WebCore/bridge/c/c_utility.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/c/c_utility.cpp @@ -66,24 +66,24 @@ static String convertUTF8ToUTF16WithLatin1Fallback(const NPUTF8* UTF8Chars, int } // Variant value must be released with NPReleaseVariantValue() -void convertValueToNPVariant(ExecState* exec, JSValuePtr value, NPVariant* result) +void convertValueToNPVariant(ExecState* exec, JSValue value, NPVariant* result) { JSLock lock(false); VOID_TO_NPVARIANT(*result); - if (value->isString()) { - UString ustring = value->toString(exec); + if (value.isString()) { + UString ustring = value.toString(exec); CString cstring = ustring.UTF8String(); NPString string = { (const NPUTF8*)cstring.c_str(), static_cast<uint32_t>(cstring.size()) }; NPN_InitializeVariantWithStringCopy(result, &string); - } else if (value->isNumber()) { - DOUBLE_TO_NPVARIANT(value->toNumber(exec), *result); - } else if (value->isBoolean()) { - BOOLEAN_TO_NPVARIANT(value->toBoolean(exec), *result); - } else if (value->isNull()) { + } else if (value.isNumber()) { + DOUBLE_TO_NPVARIANT(value.toNumber(exec), *result); + } else if (value.isBoolean()) { + BOOLEAN_TO_NPVARIANT(value.toBoolean(exec), *result); + } else if (value.isNull()) { NULL_TO_NPVARIANT(*result); - } else if (value->isObject()) { + } else if (value.isObject()) { JSObject* object = asObject(value); if (object->classInfo() == &RuntimeObjectImp::s_info) { RuntimeObjectImp* imp = static_cast<RuntimeObjectImp*>(object); @@ -105,7 +105,7 @@ void convertValueToNPVariant(ExecState* exec, JSValuePtr value, NPVariant* resul } } -JSValuePtr convertNPVariantToValue(ExecState* exec, const NPVariant* variant, RootObject* rootObject) +JSValue convertNPVariantToValue(ExecState* exec, const NPVariant* variant, RootObject* rootObject) { JSLock lock(false); @@ -131,7 +131,7 @@ JSValuePtr convertNPVariantToValue(ExecState* exec, const NPVariant* variant, Ro return ((JavaScriptObject*)obj)->imp; // Wrap NPObject in a CInstance. - return Instance::createRuntimeObject(exec, CInstance::create(obj, rootObject)); + return CInstance::create(obj, rootObject)->createRuntimeObject(exec); } return jsUndefined(); @@ -139,7 +139,7 @@ JSValuePtr convertNPVariantToValue(ExecState* exec, const NPVariant* variant, Ro String convertNPStringToUTF16(const NPString* string) { - return convertUTF8ToUTF16WithLatin1Fallback(string->UTF8Characters, string->UTF8Length); + return String::fromUTF8WithLatin1Fallback(string->UTF8Characters, string->UTF8Length); } Identifier identifierFromNPIdentifier(const NPUTF8* name) diff --git a/src/3rdparty/webkit/WebCore/bridge/c/c_utility.h b/src/3rdparty/webkit/WebCore/bridge/c/c_utility.h index 2efc66c..f69bba6 100644 --- a/src/3rdparty/webkit/WebCore/bridge/c/c_utility.h +++ b/src/3rdparty/webkit/WebCore/bridge/c/c_utility.h @@ -46,29 +46,11 @@ class RootObject; typedef uint16_t NPUTF16; -enum NP_ValueType { - NP_NumberValueType, - NP_StringValueType, - NP_BooleanValueType, - NP_NullValueType, - NP_UndefinedValueType, - NP_ObjectValueType, - NP_InvalidValueType -}; - WebCore::String convertNPStringToUTF16(const NPString *string); -void convertValueToNPVariant(ExecState*, JSValuePtr, NPVariant* result); -JSValuePtr convertNPVariantToValue(ExecState*, const NPVariant*, RootObject*); +void convertValueToNPVariant(ExecState*, JSValue, NPVariant* result); +JSValue convertNPVariantToValue(ExecState*, const NPVariant*, RootObject*); Identifier identifierFromNPIdentifier(const NPUTF8* name); -struct PrivateIdentifier { - union { - const NPUTF8* string; - int32_t number; - } value; - bool isString; -}; - } } #endif // ENABLE(NETSCAPE_PLUGIN_API) diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_class.cpp b/src/3rdparty/webkit/WebCore/bridge/jni/jni_class.cpp index 069089c..87750aa 100644 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_class.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jni_class.cpp @@ -53,17 +53,15 @@ JavaClass::JavaClass(jobject anInstance) int i; JNIEnv *env = getJNIEnv(); - JSGlobalData* globalData = WebCore::JSDOMWindow::commonJSGlobalData(); - // Get the fields jarray fields = (jarray)callJNIMethod<jobject>(aClass, "getFields", "()[Ljava/lang/reflect/Field;"); int numFields = env->GetArrayLength(fields); for (i = 0; i < numFields; i++) { jobject aJField = env->GetObjectArrayElement((jobjectArray)fields, i); - Field *aField = new JavaField(env, aJField); // deleted in the JavaClass destructor + JavaField *aField = new JavaField(env, aJField); // deleted in the JavaClass destructor { JSLock lock(false); - _fields.set(Identifier(globalData, UString(aField->name())).ustring().rep(), aField); + _fields.set(aField->name(), aField); } env->DeleteLocalRef(aJField); } @@ -73,15 +71,15 @@ JavaClass::JavaClass(jobject anInstance) int numMethods = env->GetArrayLength(methods); for (i = 0; i < numMethods; i++) { jobject aJMethod = env->GetObjectArrayElement((jobjectArray)methods, i); - Method *aMethod = new JavaMethod(env, aJMethod); // deleted in the JavaClass destructor + JavaMethod *aMethod = new JavaMethod(env, aJMethod); // deleted in the JavaClass destructor MethodList* methodList; { JSLock lock(false); - methodList = _methods.get(Identifier(globalData, UString(aMethod->name())).ustring().rep()); + methodList = _methods.get(aMethod->name()); if (!methodList) { methodList = new MethodList(); - _methods.set(Identifier(globalData, UString(aMethod->name())).ustring().rep(), methodList); + _methods.set(aMethod->name(), methodList); } } methodList->append(aMethod); diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_class.h b/src/3rdparty/webkit/WebCore/bridge/jni/jni_class.h index 75cfd89..890b4d3 100644 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_class.h +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jni_class.h @@ -40,8 +40,6 @@ public: JavaClass (jobject anInstance); ~JavaClass (); - virtual const char *name() const { return _name; }; - virtual MethodList methodsNamed(const Identifier&, Instance* instance) const; virtual Field *fieldNamed(const Identifier&, Instance* instance) const; @@ -50,8 +48,6 @@ public: bool isStringClass() const; private: - JavaClass (); // prevent default construction - const char *_name; FieldMap _fields; MethodListMap _methods; diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_instance.cpp b/src/3rdparty/webkit/WebCore/bridge/jni/jni_instance.cpp index 6508cb3..88d79ef 100644 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_instance.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jni_instance.cpp @@ -80,7 +80,7 @@ Class *JavaInstance::getClass() const return _class; } -JSValuePtr JavaInstance::stringValue(ExecState* exec) const +JSValue JavaInstance::stringValue(ExecState* exec) const { JSLock lock(false); @@ -92,23 +92,23 @@ JSValuePtr JavaInstance::stringValue(ExecState* exec) const return jsString(exec, u); } -JSValuePtr JavaInstance::numberValue(ExecState* exec) const +JSValue JavaInstance::numberValue(ExecState* exec) const { jdouble doubleValue = callJNIMethod<jdouble>(_instance->_instance, "doubleValue", "()D"); return jsNumber(exec, doubleValue); } -JSValuePtr JavaInstance::booleanValue() const +JSValue JavaInstance::booleanValue() const { jboolean booleanValue = callJNIMethod<jboolean>(_instance->_instance, "booleanValue", "()Z"); return jsBoolean(booleanValue); } -JSValuePtr JavaInstance::invokeMethod (ExecState *exec, const MethodList &methodList, const ArgList &args) +JSValue JavaInstance::invokeMethod (ExecState *exec, const MethodList &methodList, const ArgList &args) { int i, count = args.size(); jvalue *jArgs; - JSValuePtr resultValue; + JSValue resultValue; Method *method = 0; size_t numMethods = methodList.size(); @@ -131,7 +131,7 @@ JSValuePtr JavaInstance::invokeMethod (ExecState *exec, const MethodList &method } const JavaMethod *jMethod = static_cast<const JavaMethod*>(method); - JS_LOG ("call %s %s on %p\n", method->name(), jMethod->signature(), _instance->_instance); + JS_LOG ("call %s %s on %p\n", UString(jMethod->name()).UTF8String().c_str(), jMethod->signature(), _instance->_instance); if (count > 0) { jArgs = (jvalue *)malloc (count * sizeof(jvalue)); @@ -141,8 +141,8 @@ JSValuePtr JavaInstance::invokeMethod (ExecState *exec, const MethodList &method for (i = 0; i < count; i++) { JavaParameter* aParameter = jMethod->parameterAt(i); - jArgs[i] = convertValueToJValue(exec, args.at(exec, i), aParameter->getJNIType(), aParameter->type()); - JS_LOG("arg[%d] = %s\n", i, args.at(exec, i)->toString(exec).ascii()); + jArgs[i] = convertValueToJValue(exec, args.at(i), aParameter->getJNIType(), aParameter->type()); + JS_LOG("arg[%d] = %s\n", i, args.at(i).toString(exec).ascii()); } jvalue result; @@ -157,11 +157,11 @@ JSValuePtr JavaInstance::invokeMethod (ExecState *exec, const MethodList &method bool handled = false; if (rootObject->nativeHandle()) { jobject obj = _instance->_instance; - JSValuePtr exceptionDescription = noValue(); + JSValue exceptionDescription; const char *callingURL = 0; // FIXME, need to propagate calling URL to Java handled = dispatchJNICall(exec, rootObject->nativeHandle(), obj, jMethod->isStatic(), jMethod->JNIReturnType(), jMethod->methodID(obj), jArgs, result, callingURL, exceptionDescription); if (exceptionDescription) { - throwError(exec, GeneralError, exceptionDescription->toString(exec)); + throwError(exec, GeneralError, exceptionDescription.toString(exec)); free (jArgs); return jsUndefined(); } @@ -222,7 +222,7 @@ JSValuePtr JavaInstance::invokeMethod (ExecState *exec, const MethodList &method resultValue = JavaArray::convertJObjectToArray(exec, result.l, arrayType, rootObject); } else { - resultValue = Instance::createRuntimeObject(exec, JavaInstance::create(result.l, rootObject)); + resultValue = JavaInstance::create(result.l, rootObject)->createRuntimeObject(exec); } } else { @@ -283,7 +283,7 @@ JSValuePtr JavaInstance::invokeMethod (ExecState *exec, const MethodList &method return resultValue; } -JSValuePtr JavaInstance::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const +JSValue JavaInstance::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const { if (hint == PreferString) return stringValue(exec); @@ -299,7 +299,7 @@ JSValuePtr JavaInstance::defaultValue(ExecState* exec, PreferredPrimitiveType hi return valueOf(exec); } -JSValuePtr JavaInstance::valueOf(ExecState* exec) const +JSValue JavaInstance::valueOf(ExecState* exec) const { return stringValue(exec); } diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_instance.h b/src/3rdparty/webkit/WebCore/bridge/jni/jni_instance.h index 4e166f7..0dcab3e 100644 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_instance.h +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jni_instance.h @@ -77,18 +77,16 @@ public: virtual Class *getClass() const; - virtual JSValuePtr valueOf(ExecState*) const; - virtual JSValuePtr defaultValue(ExecState*, PreferredPrimitiveType) const; + virtual JSValue valueOf(ExecState*) const; + virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const; - virtual JSValuePtr invokeMethod(ExecState* exec, const MethodList& method, const ArgList& args); + virtual JSValue invokeMethod(ExecState* exec, const MethodList& method, const ArgList& args); jobject javaInstance() const { return _instance->_instance; } - JSValuePtr stringValue(ExecState*) const; - JSValuePtr numberValue(ExecState*) const; - JSValuePtr booleanValue() const; - - virtual BindingLanguage getBindingLanguage() const { return JavaLanguage; } + JSValue stringValue(ExecState*) const; + JSValue numberValue(ExecState*) const; + JSValue booleanValue() const; protected: virtual void virtualBegin(); diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.h b/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.h index 4125565..b4f5719 100644 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.h +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.h @@ -42,6 +42,7 @@ namespace JSC { class ArgList; class ExecState; class JSObject; +class MarkedArgumentBuffer; namespace Bindings { @@ -90,9 +91,9 @@ public: static jvalue invoke(JSObjectCallContext*); - jobject convertValueToJObject(JSValuePtr) const; - JSValuePtr convertJObjectToValue(ExecState*, jobject) const; - void getListFromJArray(ExecState*, jobjectArray, ArgList&) const; + jobject convertValueToJObject(JSValue) const; + JSValue convertJObjectToValue(ExecState*, jobject) const; + void getListFromJArray(ExecState*, jobjectArray, MarkedArgumentBuffer&) const; RootObject* rootObject() const; diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.mm b/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.mm index 271acf1..32d7b0d 100644 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.mm +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.mm @@ -293,18 +293,18 @@ jobject JavaJSObject::call(jstring methodName, jobjectArray args) const JSLock lock(false); Identifier identifier(exec, JavaString(methodName)); - JSValuePtr function = _imp->get(exec, identifier); + JSValue function = _imp->get(exec, identifier); CallData callData; - CallType callType = function->getCallData(callData); + CallType callType = function.getCallData(callData); if (callType == CallTypeNone) return 0; // Call the function object. - ArgList argList; + MarkedArgumentBuffer argList; getListFromJArray(exec, args, argList); - rootObject->globalObject()->startTimeoutCheck(); - JSValuePtr result = JSC::call(exec, function, callType, callData, _imp, argList); - rootObject->globalObject()->stopTimeoutCheck(); + rootObject->globalObject()->globalData()->timeoutChecker.start(); + JSValue result = JSC::call(exec, function, callType, callData, _imp, argList); + rootObject->globalObject()->globalData()->timeoutChecker.stop(); return convertValueToJObject(result); } @@ -313,7 +313,7 @@ jobject JavaJSObject::eval(jstring script) const { JS_LOG ("script = %s\n", JavaString(script).UTF8String()); - JSValuePtr result; + JSValue result; JSLock lock(false); @@ -321,9 +321,9 @@ jobject JavaJSObject::eval(jstring script) const if (!rootObject) return 0; - rootObject->globalObject()->startTimeoutCheck(); + rootObject->globalObject()->globalData()->timeoutChecker.start(); Completion completion = JSC::evaluate(rootObject->globalObject()->globalExec(), rootObject->globalObject()->globalScopeChain(), makeSource(JavaString(script))); - rootObject->globalObject()->stopTimeoutCheck(); + rootObject->globalObject()->globalData()->timeoutChecker.stop(); ComplType type = completion.complType(); if (type == Normal) { @@ -347,7 +347,7 @@ jobject JavaJSObject::getMember(jstring memberName) const ExecState* exec = rootObject->globalObject()->globalExec(); JSLock lock(false); - JSValuePtr result = _imp->get(exec, Identifier(exec, JavaString(memberName))); + JSValue result = _imp->get(exec, Identifier(exec, JavaString(memberName))); return convertValueToJObject(result); } @@ -397,7 +397,7 @@ jobject JavaJSObject::getSlot(jint index) const ExecState* exec = rootObject->globalObject()->globalExec(); JSLock lock(false); - JSValuePtr result = _imp->get(exec, index); + JSValue result = _imp->get(exec, index); return convertValueToJObject(result); } @@ -485,7 +485,7 @@ jlong JavaJSObject::createNative(jlong nativeHandle) return nativeHandle; } -jobject JavaJSObject::convertValueToJObject(JSValuePtr value) const +jobject JavaJSObject::convertValueToJObject(JSValue value) const { JSLock lock(false); @@ -505,28 +505,28 @@ jobject JavaJSObject::convertValueToJObject(JSValuePtr value) const // Java instance -> Java instance // Everything else -> JavaJSObject - if (value->isNumber()) { + if (value.isNumber()) { jclass JSObjectClass = env->FindClass ("java/lang/Double"); jmethodID constructorID = env->GetMethodID (JSObjectClass, "<init>", "(D)V"); if (constructorID != NULL) { - result = env->NewObject (JSObjectClass, constructorID, (jdouble)value->toNumber(exec)); + result = env->NewObject (JSObjectClass, constructorID, (jdouble)value.toNumber(exec)); } - } else if (value->isString()) { - UString stringValue = value->toString(exec); + } else if (value.isString()) { + UString stringValue = value.toString(exec); JNIEnv *env = getJNIEnv(); result = env->NewString ((const jchar *)stringValue.data(), stringValue.size()); - } else if (value->isBoolean()) { + } else if (value.isBoolean()) { jclass JSObjectClass = env->FindClass ("java/lang/Boolean"); jmethodID constructorID = env->GetMethodID (JSObjectClass, "<init>", "(Z)V"); if (constructorID != NULL) { - result = env->NewObject (JSObjectClass, constructorID, (jboolean)value->toBoolean(exec)); + result = env->NewObject (JSObjectClass, constructorID, (jboolean)value.toBoolean(exec)); } } else { // Create a JavaJSObject. jlong nativeHandle; - if (value->isObject()) { + if (value.isObject()) { JSObject* imp = asObject(value); // We either have a wrapper around a Java instance or a JavaScript @@ -571,7 +571,7 @@ jobject JavaJSObject::convertValueToJObject(JSValuePtr value) const return result; } -JSValuePtr JavaJSObject::convertJObjectToValue(ExecState* exec, jobject theObject) const +JSValue JavaJSObject::convertJObjectToValue(ExecState* exec, jobject theObject) const { // Instances of netscape.javascript.JSObject get converted back to // JavaScript objects. All other objects are wrapped. It's not @@ -602,10 +602,10 @@ JSValuePtr JavaJSObject::convertJObjectToValue(ExecState* exec, jobject theObjec JSLock lock(false); - return JSC::Bindings::Instance::createRuntimeObject(exec, JavaInstance::create(theObject, _rootObject)); + return JavaInstance::create(theObject, _rootObject)->createRuntimeObject(exec); } -void JavaJSObject::getListFromJArray(ExecState* exec, jobjectArray jArray, ArgList& list) const +void JavaJSObject::getListFromJArray(ExecState* exec, jobjectArray jArray, MarkedArgumentBuffer& list) const { JNIEnv *env = getJNIEnv(); int numObjects = jArray ? env->GetArrayLength(jArray) : 0; diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_objc.mm b/src/3rdparty/webkit/WebCore/bridge/jni/jni_objc.mm index 232d9e9..7c19442 100644 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_objc.mm +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jni_objc.mm @@ -45,7 +45,7 @@ using namespace JSC::Bindings; exceptionDescription:(NSString **)exceptionString; @end -bool JSC::Bindings::dispatchJNICall(ExecState* exec, const void* targetAppletView, jobject obj, bool isStatic, JNIType returnType, jmethodID methodID, jvalue* args, jvalue &result, const char*, JSValuePtr& exceptionDescription) +bool JSC::Bindings::dispatchJNICall(ExecState* exec, const void* targetAppletView, jobject obj, bool isStatic, JNIType returnType, jmethodID methodID, jvalue* args, jvalue &result, const char*, JSValue& exceptionDescription) { id view = (id)targetAppletView; diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_runtime.cpp b/src/3rdparty/webkit/WebCore/bridge/jni/jni_runtime.cpp index a67d0ec..3cbe8cf 100644 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_runtime.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jni_runtime.cpp @@ -70,7 +70,7 @@ JavaField::JavaField (JNIEnv *env, jobject aField) _field = new JObjectWrapper(aField); } -JSValuePtr JavaArray::convertJObjectToArray(ExecState* exec, jobject anObject, const char* type, PassRefPtr<RootObject> rootObject) +JSValue JavaArray::convertJObjectToArray(ExecState* exec, jobject anObject, const char* type, PassRefPtr<RootObject> rootObject) { if (type[0] != '[') return jsUndefined(); @@ -93,24 +93,24 @@ jvalue JavaField::dispatchValueFromInstance(ExecState *exec, const JavaInstance { RootObject* rootObject = instance->rootObject(); if (rootObject && rootObject->nativeHandle()) { - JSValuePtr exceptionDescription = noValue(); + JSValue exceptionDescription; jvalue args[1]; args[0].l = jinstance; dispatchJNICall(exec, rootObject->nativeHandle(), fieldJInstance, false, returnType, mid, args, result, 0, exceptionDescription); if (exceptionDescription) - throwError(exec, GeneralError, exceptionDescription->toString(exec)); + throwError(exec, GeneralError, exceptionDescription.toString(exec)); } } } return result; } -JSValuePtr JavaField::valueFromInstance(ExecState* exec, const Instance* i) const +JSValue JavaField::valueFromInstance(ExecState* exec, const Instance* i) const { const JavaInstance *instance = static_cast<const JavaInstance *>(i); - JSValuePtr jsresult = jsUndefined(); + JSValue jsresult = jsUndefined(); switch (_JNIType) { case array_type: @@ -123,7 +123,7 @@ JSValuePtr JavaField::valueFromInstance(ExecState* exec, const Instance* i) cons jsresult = JavaArray::convertJObjectToArray(exec, anObject, arrayType, instance->rootObject()); } else if (anObject != 0){ - jsresult = Instance::createRuntimeObject(exec, JavaInstance::create(anObject, instance->rootObject())); + jsresult = JavaInstance::create(anObject, instance->rootObject())->createRuntimeObject(exec); } } break; @@ -157,7 +157,7 @@ JSValuePtr JavaField::valueFromInstance(ExecState* exec, const Instance* i) cons break; } - JS_LOG ("getting %s = %s\n", name(), jsresult->toString(exec).ascii()); + JS_LOG ("getting %s = %s\n", UString(name()).UTF8String().c_str(), jsresult.toString(exec).ascii()); return jsresult; } @@ -175,7 +175,7 @@ void JavaField::dispatchSetValueToInstance(ExecState *exec, const JavaInstance * { RootObject* rootObject = instance->rootObject(); if (rootObject && rootObject->nativeHandle()) { - JSValuePtr exceptionDescription = noValue(); + JSValue exceptionDescription; jvalue args[2]; jvalue result; @@ -183,18 +183,18 @@ void JavaField::dispatchSetValueToInstance(ExecState *exec, const JavaInstance * args[1] = javaValue; dispatchJNICall(exec, rootObject->nativeHandle(), fieldJInstance, false, void_type, mid, args, result, 0, exceptionDescription); if (exceptionDescription) - throwError(exec, GeneralError, exceptionDescription->toString(exec)); + throwError(exec, GeneralError, exceptionDescription.toString(exec)); } } } } -void JavaField::setValueToInstance(ExecState* exec, const Instance* i, JSValuePtr aValue) const +void JavaField::setValueToInstance(ExecState* exec, const Instance* i, JSValue aValue) const { const JavaInstance *instance = static_cast<const JavaInstance *>(i); jvalue javaValue = convertValueToJValue (exec, aValue, _JNIType, type()); - JS_LOG ("setting value %s to %s\n", name(), aValue->toString(exec).ascii()); + JS_LOG ("setting value %s to %s\n", UString(name()).UTF8String().c_str(), aValue.toString(exec).ascii()); switch (_JNIType) { case array_type: @@ -359,7 +359,7 @@ JNIType JavaMethod::JNIReturnType() const jmethodID JavaMethod::methodID (jobject obj) const { if (_methodID == 0) { - _methodID = getMethodID (obj, name(), signature()); + _methodID = getMethodID (obj, _name.UTF8String(), signature()); } return _methodID; } @@ -386,7 +386,7 @@ RootObject* JavaArray::rootObject() const return _rootObject && _rootObject->isValid() ? _rootObject.get() : 0; } -void JavaArray::setValueAt(ExecState* exec, unsigned index, JSValuePtr aValue) const +void JavaArray::setValueAt(ExecState* exec, unsigned index, JSValue aValue) const { JNIEnv *env = getJNIEnv(); char *javaClassName = 0; @@ -454,7 +454,7 @@ void JavaArray::setValueAt(ExecState* exec, unsigned index, JSValuePtr aValue) c } -JSValuePtr JavaArray::valueAt(ExecState* exec, unsigned index) const +JSValue JavaArray::valueAt(ExecState* exec, unsigned index) const { JNIEnv *env = getJNIEnv(); JNIType arrayType = JNITypeFromPrimitiveType(_type[1]); @@ -474,7 +474,7 @@ JSValuePtr JavaArray::valueAt(ExecState* exec, unsigned index) const return JavaArray::convertJObjectToArray(exec, anObject, _type+1, rootObject()); } // or array of other object type? - return Instance::createRuntimeObject(exec, JavaInstance::create(anObject, rootObject())); + return JavaInstance::create(anObject, rootObject())->createRuntimeObject(exec); } case boolean_type: { diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_runtime.h b/src/3rdparty/webkit/WebCore/bridge/jni/jni_runtime.h index ac771b4..f3cbf2b 100644 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_runtime.h +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jni_runtime.h @@ -56,7 +56,7 @@ public: const jchar *uc = getUCharactersFromJStringInEnv (e, s); { JSLock lock(false); - _rep = UString((UChar *)uc,_size).rep(); + _rep = UString(reinterpret_cast<const UChar*>(uc), _size).rep(); } releaseUCharactersForJStringInEnv (e, s, uc); } @@ -112,10 +112,10 @@ class JavaField : public Field public: JavaField (JNIEnv *env, jobject aField); - virtual JSValuePtr valueFromInstance(ExecState *exec, const Instance *instance) const; - virtual void setValueToInstance(ExecState *exec, const Instance *instance, JSValuePtr aValue) const; + virtual JSValue valueFromInstance(ExecState *exec, const Instance *instance) const; + virtual void setValueToInstance(ExecState *exec, const Instance *instance, JSValue aValue) const; - virtual const char *name() const { return _name.UTF8String(); } + UString::Rep* name() const { return ((UString)_name).rep(); } virtual RuntimeType type() const { return _type.UTF8String(); } JNIType getJNIType() const { return _JNIType; } @@ -137,7 +137,7 @@ public: JavaMethod(JNIEnv* env, jobject aMethod); ~JavaMethod(); - virtual const char *name() const { return _name.UTF8String(); }; + UString::Rep* name() const { return ((UString)_name).rep(); } RuntimeType returnType() const { return _returnType.UTF8String(); }; JavaParameter* parameterAt(int i) const { return &_parameters[i]; }; int numParameters() const { return _numParameters; }; @@ -168,13 +168,13 @@ public: RootObject* rootObject() const; - virtual void setValueAt(ExecState *exec, unsigned int index, JSValuePtr aValue) const; - virtual JSValuePtr valueAt(ExecState *exec, unsigned int index) const; + virtual void setValueAt(ExecState *exec, unsigned int index, JSValue aValue) const; + virtual JSValue valueAt(ExecState *exec, unsigned int index) const; virtual unsigned int getLength() const; jobject javaArray() const { return _array->_instance; } - static JSValuePtr convertJObjectToArray (ExecState* exec, jobject anObject, const char* type, PassRefPtr<RootObject>); + static JSValue convertJObjectToArray (ExecState* exec, jobject anObject, const char* type, PassRefPtr<RootObject>); private: RefPtr<JObjectWrapper> _array; diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_utility.cpp b/src/3rdparty/webkit/WebCore/bridge/jni/jni_utility.cpp index 14dd8ea..f8a2789 100644 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_utility.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jni_utility.cpp @@ -365,8 +365,8 @@ static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray env->FindClass("java/lang/String"), env->NewStringUTF("")); for(unsigned i = 0; i < length; i++) { - JSValuePtr item = jsArray->get(exec, i); - UString stringValue = item->toString(exec); + JSValue item = jsArray->get(exec, i); + UString stringValue = item.toString(exec); env->SetObjectArrayElement(jarray,i, env->functions->NewString(env, (const jchar *)stringValue.data(), stringValue.size())); } @@ -377,8 +377,8 @@ static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray case boolean_type: { jarray = (jobjectArray)env->NewBooleanArray(length); for(unsigned i = 0; i < length; i++) { - JSValuePtr item = jsArray->get(exec, i); - jboolean value = (jboolean)item->toNumber(exec); + JSValue item = jsArray->get(exec, i); + jboolean value = (jboolean)item.toNumber(exec); env->SetBooleanArrayRegion((jbooleanArray)jarray, (jsize)i, (jsize)1, &value); } break; @@ -387,8 +387,8 @@ static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray case byte_type: { jarray = (jobjectArray)env->NewByteArray(length); for(unsigned i = 0; i < length; i++) { - JSValuePtr item = jsArray->get(exec, i); - jbyte value = (jbyte)item->toNumber(exec); + JSValue item = jsArray->get(exec, i); + jbyte value = (jbyte)item.toNumber(exec); env->SetByteArrayRegion((jbyteArray)jarray, (jsize)i, (jsize)1, &value); } break; @@ -397,8 +397,8 @@ static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray case char_type: { jarray = (jobjectArray)env->NewCharArray(length); for(unsigned i = 0; i < length; i++) { - JSValuePtr item = jsArray->get(exec, i); - UString stringValue = item->toString(exec); + JSValue item = jsArray->get(exec, i); + UString stringValue = item.toString(exec); jchar value = 0; if (stringValue.size() > 0) value = ((const jchar*)stringValue.data())[0]; @@ -410,8 +410,8 @@ static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray case short_type: { jarray = (jobjectArray)env->NewShortArray(length); for(unsigned i = 0; i < length; i++) { - JSValuePtr item = jsArray->get(exec, i); - jshort value = (jshort)item->toNumber(exec); + JSValue item = jsArray->get(exec, i); + jshort value = (jshort)item.toNumber(exec); env->SetShortArrayRegion((jshortArray)jarray, (jsize)i, (jsize)1, &value); } break; @@ -420,8 +420,8 @@ static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray case int_type: { jarray = (jobjectArray)env->NewIntArray(length); for(unsigned i = 0; i < length; i++) { - JSValuePtr item = jsArray->get(exec, i); - jint value = (jint)item->toNumber(exec); + JSValue item = jsArray->get(exec, i); + jint value = (jint)item.toNumber(exec); env->SetIntArrayRegion((jintArray)jarray, (jsize)i, (jsize)1, &value); } break; @@ -430,8 +430,8 @@ static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray case long_type: { jarray = (jobjectArray)env->NewLongArray(length); for(unsigned i = 0; i < length; i++) { - JSValuePtr item = jsArray->get(exec, i); - jlong value = (jlong)item->toNumber(exec); + JSValue item = jsArray->get(exec, i); + jlong value = (jlong)item.toNumber(exec); env->SetLongArrayRegion((jlongArray)jarray, (jsize)i, (jsize)1, &value); } break; @@ -440,8 +440,8 @@ static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray case float_type: { jarray = (jobjectArray)env->NewFloatArray(length); for(unsigned i = 0; i < length; i++) { - JSValuePtr item = jsArray->get(exec, i); - jfloat value = (jfloat)item->toNumber(exec); + JSValue item = jsArray->get(exec, i); + jfloat value = (jfloat)item.toNumber(exec); env->SetFloatArrayRegion((jfloatArray)jarray, (jsize)i, (jsize)1, &value); } break; @@ -450,8 +450,8 @@ static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray case double_type: { jarray = (jobjectArray)env->NewDoubleArray(length); for(unsigned i = 0; i < length; i++) { - JSValuePtr item = jsArray->get(exec, i); - jdouble value = (jdouble)item->toNumber(exec); + JSValue item = jsArray->get(exec, i); + jdouble value = (jdouble)item.toNumber(exec); env->SetDoubleArrayRegion((jdoubleArray)jarray, (jsize)i, (jsize)1, &value); } break; @@ -468,7 +468,7 @@ static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray } -jvalue convertValueToJValue(ExecState* exec, JSValuePtr value, JNIType _JNIType, const char* javaClassName) +jvalue convertValueToJValue(ExecState* exec, JSValue value, JNIType _JNIType, const char* javaClassName) { JSLock lock(false); @@ -480,7 +480,7 @@ jvalue convertValueToJValue(ExecState* exec, JSValuePtr value, JNIType _JNIType, result.l = (jobject)0; // First see if we have a Java instance. - if (value->isObject()){ + if (value.isObject()){ JSObject* objectImp = asObject(value); if (objectImp->classInfo() == &RuntimeObjectImp::s_info) { RuntimeObjectImp* imp = static_cast<RuntimeObjectImp*>(objectImp); @@ -512,10 +512,10 @@ jvalue convertValueToJValue(ExecState* exec, JSValuePtr value, JNIType _JNIType, } else #else - if (!value->isNull()) + if (!value.isNull()) #endif { - UString stringValue = value->toString(exec); + UString stringValue = value.toString(exec); JNIEnv *env = getJNIEnv(); jobject javaString = env->functions->NewString (env, (const jchar *)stringValue.data(), stringValue.size()); result.l = javaString; @@ -526,42 +526,42 @@ jvalue convertValueToJValue(ExecState* exec, JSValuePtr value, JNIType _JNIType, break; case boolean_type: { - result.z = (jboolean)value->toNumber(exec); + result.z = (jboolean)value.toNumber(exec); } break; case byte_type: { - result.b = (jbyte)value->toNumber(exec); + result.b = (jbyte)value.toNumber(exec); } break; case char_type: { - result.c = (jchar)value->toNumber(exec); + result.c = (jchar)value.toNumber(exec); } break; case short_type: { - result.s = (jshort)value->toNumber(exec); + result.s = (jshort)value.toNumber(exec); } break; case int_type: { - result.i = (jint)value->toNumber(exec); + result.i = (jint)value.toNumber(exec); } break; case long_type: { - result.j = (jlong)value->toNumber(exec); + result.j = (jlong)value.toNumber(exec); } break; case float_type: { - result.f = (jfloat)value->toNumber(exec); + result.f = (jfloat)value.toNumber(exec); } break; case double_type: { - result.d = (jdouble)value->toNumber(exec); + result.d = (jdouble)value.toNumber(exec); } break; diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_utility.h b/src/3rdparty/webkit/WebCore/bridge/jni/jni_utility.h index a08cc5d..c315b1f 100644 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_utility.h +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jni_utility.h @@ -72,7 +72,7 @@ JNIType JNITypeFromClassName(const char *name); JNIType JNITypeFromPrimitiveType(char type); const char *signatureFromPrimitiveType(JNIType type); -jvalue convertValueToJValue(ExecState*, JSValuePtr, JNIType, const char* javaClassName); +jvalue convertValueToJValue(ExecState*, JSValue, JNIType, const char* javaClassName); jvalue getJNIField(jobject obj, JNIType type, const char *name, const char *signature); @@ -277,7 +277,7 @@ T callJNIStaticMethod(jclass cls, const char* methodName, const char* methodSign return result; } -bool dispatchJNICall(ExecState*, const void* targetAppletView, jobject obj, bool isStatic, JNIType returnType, jmethodID methodID, jvalue* args, jvalue& result, const char* callingURL, JSValuePtr& exceptionDescription); +bool dispatchJNICall(ExecState*, const void* targetAppletView, jobject obj, bool isStatic, JNIType returnType, jmethodID methodID, jvalue* args, jvalue& result, const char* callingURL, JSValue& exceptionDescription); } // namespace Bindings diff --git a/src/3rdparty/webkit/WebCore/bridge/npapi.h b/src/3rdparty/webkit/WebCore/bridge/npapi.h index 33535f7..1904a87 100644 --- a/src/3rdparty/webkit/WebCore/bridge/npapi.h +++ b/src/3rdparty/webkit/WebCore/bridge/npapi.h @@ -108,9 +108,7 @@ /*----------------------------------------------------------------------*/ #define NP_VERSION_MAJOR 0 -#define NP_VERSION_MINOR 20 - - +#define NP_VERSION_MINOR 24 /*----------------------------------------------------------------------*/ /* Definition of Basic Types */ @@ -343,13 +341,16 @@ typedef enum { */ NPPVpluginWantsAllNetworkStreams = 18, + NPPVpluginPrivateModeBool = 19, + + /* Checks to see if the plug-in would like the browser to load the "src" attribute. */ + NPPVpluginCancelSrcStream = 20, + #ifdef XP_MACOSX /* Used for negotiating drawing models */ NPPVpluginDrawingModel = 1000, /* Used for negotiating event models */ NPPVpluginEventModel = 1001, - /* The plug-in text input vtable */ - NPPVpluginTextInputFuncs = 1002, /* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */ NPPVpluginCoreAnimationLayer = 1003 #endif @@ -379,7 +380,9 @@ typedef enum { /* Get the NPObject wrapper for the plugins DOM element. */ NPNVPluginElementNPObject = 16, - NPNVSupportsWindowless = 17 + NPNVSupportsWindowless = 17, + + NPNVprivateModeBool = 18 #ifdef XP_MACOSX , NPNVpluginDrawingModel = 1000 /* The NPDrawingModel specified by the plugin */ @@ -396,10 +399,14 @@ typedef enum { #endif , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */ - , NPNVbrowserTextInputFuncs = 1002 /* The browser text input vtable */ #endif /* XP_MACOSX */ } NPNVariable; +typedef enum { + NPNURLVCookie = 501, + NPNURLVProxy +} NPNURLVariable; + /* * The type of a NPWindow - it specifies the type of the data structure * returned in the window field. @@ -449,6 +456,7 @@ typedef enum { NPCocoaEventFocusChanged, NPCocoaEventWindowFocusChanged, NPCocoaEventScrollWheel, + NPCocoaEventTextInput } NPCocoaEventType; typedef struct _NPNSString NPNSString; @@ -478,6 +486,8 @@ typedef struct _NPCocoaEvent { uint16 keyCode; } key; struct { + CGContextRef context; + double x; double y; double width; @@ -485,7 +495,10 @@ typedef struct _NPCocoaEvent { } draw; struct { NPBool hasFocus; - } focus; + } focus; + struct { + NPNSString *text; + } text; } data; } NPCocoaEvent; @@ -538,6 +551,14 @@ typedef NPNSMenu NPMenu; typedef void * NPMenu; #endif +typedef enum { + NPCoordinateSpacePlugin = 1, + NPCoordinateSpaceWindow, + NPCoordinateSpaceFlippedWindow, + NPCoordinateSpaceScreen, + NPCoordinateSpaceFlippedScreen +} NPCoordinateSpace; + #if defined(XP_MAC) || defined(XP_MACOSX) #ifndef NP_NO_CARBON @@ -726,7 +747,11 @@ typedef struct NP_Port #define NPVERS_HAS_RESPONSE_HEADERS 17 #define NPVERS_HAS_NPOBJECT_ENUM 18 #define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19 -#define NPVERS_MACOSX_HAS_EVENT_MODELS 20 +#define NPVERS_HAS_ALL_NETWORK_STREAMS 20 +#define NPVERS_HAS_URL_AND_AUTH_INFO 21 +#define NPVERS_HAS_PRIVATE_MODE 22 +#define NPVERS_MACOSX_HAS_EVENT_MODELS 23 +#define NPVERS_HAS_CANCEL_SRC_STREAM 24 /*----------------------------------------------------------------------*/ /* Function Prototypes */ @@ -819,10 +844,14 @@ void NPN_ForceRedraw(NPP instance); void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled); void NPN_PopPopupsEnabledState(NPP instance); void NPN_PluginThreadAsyncCall(NPP instance, void (*func) (void *), void *userData); +NPError NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char* url, char** value, uint32* len); +NPError NPN_SetValueForURL(NPP instance, NPNURLVariable variable, const char* url, const char* value, uint32 len); +NPError NPN_GetAuthenticationInfo(NPP instance, const char* protocol, const char* host, int32 port, const char* scheme, const char *realm, char** username, uint32* ulen, char** password, uint32* plen); uint32 NPN_ScheduleTimer(NPP instance, uint32 interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32 timerID)); void NPN_UnscheduleTimer(NPP instance, uint32 timerID); NPError NPN_PopUpContextMenu(NPP instance, NPMenu* menu); - +NPBool NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); + #ifdef __cplusplus } /* end extern "C" */ #endif diff --git a/src/3rdparty/webkit/WebCore/bridge/npruntime.cpp b/src/3rdparty/webkit/WebCore/bridge/npruntime.cpp index 789114e..ab67076 100644 --- a/src/3rdparty/webkit/WebCore/bridge/npruntime.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/npruntime.cpp @@ -27,6 +27,7 @@ #if ENABLE(NETSCAPE_PLUGIN_API) +#include "IdentifierRep.h" #include "npruntime_internal.h" #include "npruntime_impl.h" #include "npruntime_priv.h" @@ -38,50 +39,11 @@ #include <wtf/HashMap.h> using namespace JSC::Bindings; - -typedef HashMap<RefPtr<JSC::UString::Rep>, PrivateIdentifier*> StringIdentifierMap; - -static StringIdentifierMap* getStringIdentifierMap() -{ - static StringIdentifierMap* stringIdentifierMap = 0; - if (!stringIdentifierMap) - stringIdentifierMap = new StringIdentifierMap; - return stringIdentifierMap; -} - -typedef HashMap<int, PrivateIdentifier*> IntIdentifierMap; - -static IntIdentifierMap* getIntIdentifierMap() -{ - static IntIdentifierMap* intIdentifierMap = 0; - if (!intIdentifierMap) - intIdentifierMap = new IntIdentifierMap; - return intIdentifierMap; -} +using namespace WebCore; NPIdentifier _NPN_GetStringIdentifier(const NPUTF8* name) { - ASSERT(name); - - if (name) { - PrivateIdentifier* identifier = 0; - - JSC::JSLock lock(false); - - identifier = getStringIdentifierMap()->get(identifierFromNPIdentifier(name).ustring().rep()); - if (identifier == 0) { - identifier = (PrivateIdentifier*)malloc(sizeof(PrivateIdentifier)); - // We never release identifier names, so this dictionary will grow, as will - // the memory for the identifier name strings. - identifier->isString = true; - identifier->value.string = strdup(name); - - getStringIdentifierMap()->set(identifierFromNPIdentifier(name).ustring().rep(), identifier); - } - return (NPIdentifier)identifier; - } - - return 0; + return static_cast<NPIdentifier>(IdentifierRep::get(name)); } void _NPN_GetStringIdentifiers(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers) @@ -89,61 +51,34 @@ void _NPN_GetStringIdentifiers(const NPUTF8** names, int32_t nameCount, NPIdenti ASSERT(names); ASSERT(identifiers); - if (names && identifiers) + if (names && identifiers) { for (int i = 0; i < nameCount; i++) identifiers[i] = _NPN_GetStringIdentifier(names[i]); + } } NPIdentifier _NPN_GetIntIdentifier(int32_t intid) { - PrivateIdentifier* identifier; - - if (intid == 0 || intid == -1) { - static PrivateIdentifier* negativeOneAndZeroIdentifiers[2]; - - identifier = negativeOneAndZeroIdentifiers[intid + 1]; - if (!identifier) { - identifier = (PrivateIdentifier*)malloc(sizeof(PrivateIdentifier)); - identifier->isString = false; - identifier->value.number = intid; - - negativeOneAndZeroIdentifiers[intid + 1] = identifier; - } - } else { - identifier = getIntIdentifierMap()->get(intid); - if (!identifier) { - identifier = (PrivateIdentifier*)malloc(sizeof(PrivateIdentifier)); - // We never release identifier names, so this dictionary will grow. - identifier->isString = false; - identifier->value.number = intid; - - getIntIdentifierMap()->set(intid, identifier); - } - } - return (NPIdentifier)identifier; + return static_cast<NPIdentifier>(IdentifierRep::get(intid)); } bool _NPN_IdentifierIsString(NPIdentifier identifier) { - PrivateIdentifier* i = (PrivateIdentifier*)identifier; - return i->isString; + return static_cast<IdentifierRep*>(identifier)->isString(); } NPUTF8 *_NPN_UTF8FromIdentifier(NPIdentifier identifier) { - PrivateIdentifier* i = (PrivateIdentifier*)identifier; - if (!i->isString || !i->value.string) - return NULL; - - return (NPUTF8 *)strdup(i->value.string); + const char* string = static_cast<IdentifierRep*>(identifier)->string(); + if (!string) + return 0; + + return strdup(string); } int32_t _NPN_IntFromIdentifier(NPIdentifier identifier) { - PrivateIdentifier* i = (PrivateIdentifier*)identifier; - if (i->isString) - return 0; - return i->value.number; + return static_cast<IdentifierRep*>(identifier)->number(); } void NPN_InitializeVariantWithStringCopy(NPVariant* variant, const NPString* value) @@ -151,6 +86,8 @@ void NPN_InitializeVariantWithStringCopy(NPVariant* variant, const NPString* val variant->type = NPVariantType_String; variant->value.stringValue.UTF8Length = value->UTF8Length; variant->value.stringValue.UTF8Characters = (NPUTF8 *)malloc(sizeof(NPUTF8) * value->UTF8Length); + if (!variant->value.stringValue.UTF8Characters) + CRASH(); memcpy((void*)variant->value.stringValue.UTF8Characters, value->UTF8Characters, sizeof(NPUTF8) * value->UTF8Length); } @@ -180,7 +117,8 @@ NPObject *_NPN_CreateObject(NPP npp, NPClass* aClass) obj = aClass->allocate(npp, aClass); else obj = (NPObject*)malloc(sizeof(NPObject)); - + if (!obj) + CRASH(); obj->_class = aClass; obj->referenceCount = 1; diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_class.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_class.cpp index 3aa218c..c39b3af 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_class.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_class.cpp @@ -66,7 +66,7 @@ const char* QtClass::name() const // and not get wrapped in RuntimeMethod). Also, use this for methods, // so we can cache the object and return the same object for the same // identifier. -JSValuePtr QtClass::fallbackObject(ExecState* exec, Instance* inst, const Identifier& identifier) +JSValue QtClass::fallbackObject(ExecState* exec, Instance* inst, const Identifier& identifier) { QtInstance* qtinst = static_cast<QtInstance*>(inst); diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_class.h b/src/3rdparty/webkit/WebCore/bridge/qt/qt_class.h index c83bb0f..19d4207 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_class.h +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_class.h @@ -45,7 +45,7 @@ public: virtual MethodList methodsNamed(const Identifier&, Instance*) const; virtual Field* fieldNamed(const Identifier&, Instance*) const; - virtual JSValuePtr fallbackObject(ExecState*, Instance*, const Identifier&); + virtual JSValue fallbackObject(ExecState*, Instance*, const Identifier&); private: QtClass(const QtClass&); // prohibit copying diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp index 26323e8..60cf16f 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp @@ -49,22 +49,30 @@ static InstanceJSObjectMap cachedObjects; // Derived RuntimeObject class QtRuntimeObjectImp : public RuntimeObjectImp { - public: - QtRuntimeObjectImp(ExecState*, PassRefPtr<Instance>); - ~QtRuntimeObjectImp(); - virtual void invalidate(); - - virtual void mark() { - QtInstance* instance = static_cast<QtInstance*>(getInternalInstance()); - if (instance) - instance->mark(); - RuntimeObjectImp::mark(); - } +public: + QtRuntimeObjectImp(ExecState*, PassRefPtr<Instance>); + ~QtRuntimeObjectImp(); + virtual void invalidate(); + + static const ClassInfo s_info; + + virtual void mark() + { + QtInstance* instance = static_cast<QtInstance*>(getInternalInstance()); + if (instance) + instance->mark(); + RuntimeObjectImp::mark(); + } - protected: - void removeFromCache(); +protected: + void removeFromCache(); + +private: + virtual const ClassInfo* classInfo() const { return &s_info; } }; +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) { @@ -145,17 +153,23 @@ PassRefPtr<QtInstance> QtInstance::getQtInstance(QObject* o, PassRefPtr<RootObje return ret.release(); } -RuntimeObjectImp* QtInstance::getRuntimeObject(ExecState* exec, PassRefPtr<QtInstance> instance) +bool QtInstance::getOwnPropertySlot(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { - JSLock lock(false); - QtInstance* qtInstance = instance.get(); - RuntimeObjectImp* ret = static_cast<RuntimeObjectImp*>(cachedObjects.value(qtInstance)); - if (!ret) { - ret = new (exec) QtRuntimeObjectImp(exec, instance); - cachedObjects.insert(qtInstance, ret); - ret = static_cast<RuntimeObjectImp*>(cachedObjects.value(qtInstance)); - } - return ret; + return object->JSObject::getOwnPropertySlot(exec, propertyName, slot); +} + +void QtInstance::put(JSObject* object, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +{ + object->JSObject::put(exec, propertyName, value, slot); +} + +QtInstance* QtInstance::getInstance(JSObject* object) +{ + if (!object) + return 0; + if (!object->inherits(&QtRuntimeObjectImp::s_info)) + return 0; + return static_cast<QtInstance*>(static_cast<RuntimeObjectImp*>(object)->getInternalInstance()); } Class* QtInstance::getClass() const @@ -165,6 +179,18 @@ Class* QtInstance::getClass() const return m_class; } +RuntimeObjectImp* QtInstance::createRuntimeObject(ExecState* exec) +{ + JSLock lock(false); + RuntimeObjectImp* ret = static_cast<RuntimeObjectImp*>(cachedObjects.value(this)); + if (!ret) { + ret = new (exec) QtRuntimeObjectImp(exec, this); + cachedObjects.insert(this, ret); + ret = static_cast<RuntimeObjectImp*>(cachedObjects.value(this)); + } + return ret; +} + void QtInstance::mark() { if (m_defaultMethod) @@ -173,9 +199,9 @@ void QtInstance::mark() if (val && !val->marked()) val->mark(); } - foreach(JSValuePtr val, m_children.values()) { - if (val && !val->marked()) - val->mark(); + foreach(JSValue val, m_children.values()) { + if (val && !val.marked()) + val.mark(); } } @@ -221,14 +247,14 @@ void QtInstance::getPropertyNames(ExecState* exec, PropertyNameArray& array) } } -JSValuePtr QtInstance::invokeMethod(ExecState*, const MethodList&, const ArgList&) +JSValue QtInstance::invokeMethod(ExecState*, const MethodList&, const ArgList&) { // Implemented via fallbackMethod & QtRuntimeMetaMethod::callAsFunction return jsUndefined(); } -JSValuePtr QtInstance::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const +JSValue QtInstance::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const { if (hint == PreferString) return stringValue(exec); @@ -237,7 +263,7 @@ JSValuePtr QtInstance::defaultValue(ExecState* exec, PreferredPrimitiveType hint return valueOf(exec); } -JSValuePtr QtInstance::stringValue(ExecState* exec) const +JSValue QtInstance::stringValue(ExecState* exec) const { // Hmm.. see if there is a toString defined QByteArray buf; @@ -281,25 +307,25 @@ JSValuePtr QtInstance::stringValue(ExecState* exec) const return jsString(exec, buf.constData()); } -JSValuePtr QtInstance::numberValue(ExecState* exec) const +JSValue QtInstance::numberValue(ExecState* exec) const { return jsNumber(exec, 0); } -JSValuePtr QtInstance::booleanValue() const +JSValue QtInstance::booleanValue() const { // ECMA 9.2 return jsBoolean(true); } -JSValuePtr QtInstance::valueOf(ExecState* exec) const +JSValue QtInstance::valueOf(ExecState* exec) const { return stringValue(exec); } // In qt_runtime.cpp -JSValuePtr convertQVariantToValue(ExecState*, PassRefPtr<RootObject> root, const QVariant& variant); -QVariant convertValueToQVariant(ExecState*, JSValuePtr, QMetaType::Type hint, int *distance); +JSValue convertQVariantToValue(ExecState*, PassRefPtr<RootObject> root, const QVariant& variant); +QVariant convertValueToQVariant(ExecState*, JSValue, QMetaType::Type hint, int *distance); const char* QtField::name() const { @@ -312,7 +338,7 @@ const char* QtField::name() const return ""; // deleted child object } -JSValuePtr QtField::valueFromInstance(ExecState* exec, const Instance* inst) const +JSValue QtField::valueFromInstance(ExecState* exec, const Instance* inst) const { const QtInstance* instance = static_cast<const QtInstance*>(inst); QObject* obj = instance->getObject(); @@ -329,7 +355,7 @@ JSValuePtr QtField::valueFromInstance(ExecState* exec, const Instance* inst) con else if (m_type == DynamicProperty) val = obj->property(m_dynamicProperty); - JSValuePtr ret = convertQVariantToValue(exec, inst->rootObject(), val); + JSValue ret = convertQVariantToValue(exec, inst->rootObject(), val); // Need to save children so we can mark them if (m_type == ChildObject) @@ -337,12 +363,12 @@ JSValuePtr QtField::valueFromInstance(ExecState* exec, const Instance* inst) con return ret; } else { - QString msg = QString::fromLatin1("cannot access member `%1' of deleted QObject").arg(QLatin1String(name())); + QString msg = QString(QLatin1String("cannot access member `%1' of deleted QObject")).arg(QLatin1String(name())); return throwError(exec, GeneralError, msg.toLatin1().constData()); } } -void QtField::setValueToInstance(ExecState* exec, const Instance* inst, JSValuePtr aValue) const +void QtField::setValueToInstance(ExecState* exec, const Instance* inst, JSValue aValue) const { if (m_type == ChildObject) // QtScript doesn't allow setting to a named child return; @@ -362,7 +388,7 @@ void QtField::setValueToInstance(ExecState* exec, const Instance* inst, JSValueP } else if (m_type == DynamicProperty) obj->setProperty(m_dynamicProperty.constData(), val); } else { - QString msg = QString::fromLatin1("cannot access member `%1' of deleted QObject").arg(QLatin1String(name())); + QString msg = QString(QLatin1String("cannot access member `%1' of deleted QObject")).arg(QLatin1String(name())); throwError(exec, GeneralError, msg.toLatin1().constData()); } } diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h index 50d4cf1..590fadf 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h @@ -40,29 +40,32 @@ public: ~QtInstance(); virtual Class* getClass() const; + virtual RuntimeObjectImp* createRuntimeObject(ExecState*); virtual void begin(); virtual void end(); - virtual JSValuePtr valueOf(ExecState*) const; - virtual JSValuePtr defaultValue(ExecState*, PreferredPrimitiveType) const; + virtual JSValue valueOf(ExecState*) const; + virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const; virtual void mark(); // This isn't inherited - virtual JSValuePtr invokeMethod(ExecState*, const MethodList&, const ArgList&); + virtual JSValue invokeMethod(ExecState*, const MethodList&, const ArgList&); virtual void getPropertyNames(ExecState*, PropertyNameArray&); - virtual BindingLanguage getBindingLanguage() const { return QtLanguage; } - - JSValuePtr stringValue(ExecState* exec) const; - JSValuePtr numberValue(ExecState* exec) const; - JSValuePtr booleanValue() const; + JSValue stringValue(ExecState* exec) const; + JSValue numberValue(ExecState* exec) const; + JSValue booleanValue() const; QObject* getObject() const { return m_object; } static PassRefPtr<QtInstance> getQtInstance(QObject*, PassRefPtr<RootObject>, QScriptEngine::ValueOwnership ownership); - static RuntimeObjectImp* getRuntimeObject(ExecState* exec, PassRefPtr<QtInstance>); + + virtual bool getOwnPropertySlot(JSObject*, ExecState*, const Identifier&, PropertySlot&); + virtual void put(JSObject*, ExecState*, const Identifier&, JSValue, PutPropertySlot&); + + static QtInstance* getInstance(JSObject*); private: static PassRefPtr<QtInstance> create(QObject *instance, PassRefPtr<RootObject> rootObject, QScriptEngine::ValueOwnership ownership) @@ -78,7 +81,7 @@ private: QObject* m_hashkey; mutable QHash<QByteArray, JSObject*> m_methods; mutable QHash<QString, QtField*> m_fields; - mutable QSet<JSValuePtr> m_children; + mutable QSet<JSValue> m_children; mutable QtRuntimeMetaMethod* m_defaultMethod; QScriptEngine::ValueOwnership m_ownership; }; diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp index 5a73dc7..e50e120 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp @@ -113,20 +113,20 @@ QDebug operator<<(QDebug dbg, const JSRealType &c) } #endif -static JSRealType valueRealType(ExecState* exec, JSValuePtr val) +static JSRealType valueRealType(ExecState* exec, JSValue val) { - if (val->isNumber()) + if (val.isNumber()) return Number; - else if (val->isString()) + else if (val.isString()) return String; - else if (val->isBoolean()) + else if (val.isBoolean()) return Boolean; - else if (val->isNull()) + else if (val.isNull()) return Null; - else if (exec->interpreter()->isJSByteArray(val)) + else if (isJSByteArray(&exec->globalData(), val)) return JSByteArray; - else if (val->isObject()) { - JSObject *object = val->toObject(exec); + else if (val.isObject()) { + JSObject *object = val.toObject(exec); if (object->inherits(&RuntimeArray::s_info)) // RuntimeArray 'inherits' from Array, but not in C++ return RTArray; else if (object->inherits(&JSArray::info)) @@ -143,11 +143,14 @@ static JSRealType valueRealType(ExecState* exec, JSValuePtr val) return String; // I don't know. } -QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Type hint, int *distance, HashSet<JSObject*>* visitedObjects) +QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type hint, int *distance, HashSet<JSObject*>* visitedObjects) { + if (!value) + return QVariant(); + JSObject* object = 0; - if (value->isObject()) { - object = value->toObject(exec); + if (value.isObject()) { + object = value.toObject(exec); if (visitedObjects->contains(object)) return QVariant(); @@ -222,9 +225,9 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty switch (hint) { case QMetaType::Bool: if (type == Object && object->inherits(&BooleanObject::info)) - ret = QVariant(asBooleanObject(value)->internalValue()->toBoolean(exec)); + ret = QVariant(asBooleanObject(value)->internalValue().toBoolean(exec)); else - ret = QVariant(value->toBoolean(exec)); + ret = QVariant(value.toBoolean(exec)); if (type == Boolean) dist = 0; else @@ -241,7 +244,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty case QMetaType::UShort: case QMetaType::Float: case QMetaType::Double: - ret = QVariant(value->toNumber(exec)); + ret = QVariant(value.toNumber(exec)); ret.convert((QVariant::Type)hint); if (type == Number) { switch (hint) { @@ -279,13 +282,13 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty case QMetaType::QChar: if (type == Number || type == Boolean) { - ret = QVariant(QChar((ushort)value->toNumber(exec))); + ret = QVariant(QChar((ushort)value.toNumber(exec))); if (type == Boolean) dist = 3; else dist = 6; } else { - UString str = value->toString(exec); + UString str = value.toString(exec); ret = QVariant(QChar(str.size() ? *(const ushort*)str.rep()->data() : 0)); if (type == String) dist = 3; @@ -295,12 +298,12 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty break; case QMetaType::QString: { - if (value->isUndefinedOrNull()) { + if (value.isUndefinedOrNull()) { if (distance) *distance = 1; return QString(); } else { - UString ustring = value->toString(exec); + UString ustring = value.toString(exec); ret = QVariant(QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size())); if (type == String) dist = 0; @@ -321,7 +324,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty int objdist = 0; while(it != properties.end()) { if (object->propertyIsEnumerable(exec, *it)) { - JSValuePtr val = object->get(exec, *it); + JSValue val = object->get(exec, *it); QVariant v = convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects); if (objdist >= 0) { UString ustring = (*it).ustring(); @@ -345,7 +348,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty int objdist = 0; qConvDebug() << "converting a " << len << " length Array"; for (int i = 0; i < len; ++i) { - JSValuePtr val = rtarray->getConcreteArray()->valueAt(exec, i); + JSValue val = rtarray->getConcreteArray()->valueAt(exec, i); result.append(convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects)); if (objdist == -1) { qConvDebug() << "Failed converting element at index " << i; @@ -364,7 +367,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty int objdist = 0; qConvDebug() << "converting a " << len << " length Array"; for (int i = 0; i < len; ++i) { - JSValuePtr val = array->get(exec, i); + JSValue val = array->get(exec, i); result.append(convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects)); if (objdist == -1) { qConvDebug() << "Failed converting element at index " << i; @@ -398,8 +401,8 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty QStringList result; int len = rtarray->getLength(); for (int i = 0; i < len; ++i) { - JSValuePtr val = rtarray->getConcreteArray()->valueAt(exec, i); - UString ustring = val->toString(exec); + JSValue val = rtarray->getConcreteArray()->valueAt(exec, i); + UString ustring = val.toString(exec); QString qstring = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()); result.append(qstring); @@ -412,8 +415,8 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty QStringList result; int len = array->length(); for (int i = 0; i < len; ++i) { - JSValuePtr val = array->get(exec, i); - UString ustring = val->toString(exec); + JSValue val = array->get(exec, i); + UString ustring = val.toString(exec); QString qstring = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()); result.append(qstring); @@ -422,7 +425,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty ret = QVariant(result); } else { // Make a single length array - UString ustring = value->toString(exec); + UString ustring = value.toString(exec); QString qstring = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()); QStringList result; result.append(qstring); @@ -434,11 +437,11 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty case QMetaType::QByteArray: { if (type == JSByteArray) { - ByteArray* arr = asByteArray(value)->storage(); + WTF::ByteArray* arr = asByteArray(value)->storage(); ret = QVariant(QByteArray(reinterpret_cast<const char*>(arr->data()), arr->length())); dist = 0; } else { - UString ustring = value->toString(exec); + UString ustring = value.toString(exec); ret = QVariant(QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()).toLatin1()); if (type == String) dist = 5; @@ -466,7 +469,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty dist = 2; } } else if (type == Number) { - double b = value->toNumber(exec); + double b = value.toNumber(exec); GregorianDateTime gdt; msToGregorianDateTime(b, true, gdt); if (hint == QMetaType::QDateTime) { @@ -480,7 +483,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty dist = 10; } } else if (type == String) { - UString ustring = value->toString(exec); + UString ustring = value.toString(exec); QString qstring = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()); if (hint == QMetaType::QDateTime) { @@ -529,7 +532,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty RegExpObject *re = static_cast<RegExpObject*>(object); */ // Attempt to convert.. a bit risky - UString ustring = value->toString(exec); + UString ustring = value.toString(exec); QString qstring = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()); // this is of the form '/xxxxxx/i' @@ -549,7 +552,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty qConvDebug() << "couldn't parse a JS regexp"; } } else if (type == String) { - UString ustring = value->toString(exec); + UString ustring = value.toString(exec); QString qstring = QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size()); QRegExp re(qstring); @@ -562,7 +565,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty case QMetaType::QObjectStar: if (type == QObj) { - QtInstance* qtinst = static_cast<QtInstance*>(Instance::getInstance(object, Instance::QtLanguage)); + QtInstance* qtinst = QtInstance::getInstance(object); if (qtinst) { if (qtinst->getObject()) { qConvDebug() << "found instance, with object:" << (void*) qtinst->getObject(); @@ -586,7 +589,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty case QMetaType::VoidStar: if (type == QObj) { - QtInstance* qtinst = static_cast<QtInstance*>(Instance::getInstance(object, Instance::QtLanguage)); + QtInstance* qtinst = QtInstance::getInstance(object); if (qtinst) { if (qtinst->getObject()) { qConvDebug() << "found instance, with object:" << (void*) qtinst->getObject(); @@ -605,7 +608,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty } else if (type == Number) { // I don't think that converting a double to a pointer is a wise // move. Except maybe 0. - qConvDebug() << "got number for void * - not converting, seems unsafe:" << value->toNumber(exec); + qConvDebug() << "got number for void * - not converting, seems unsafe:" << value.toNumber(exec); } else { qConvDebug() << "void* - unhandled type" << type; } @@ -621,7 +624,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty QObjectList result; int len = rtarray->getLength(); for (int i = 0; i < len; ++i) { - JSValuePtr val = rtarray->getConcreteArray()->valueAt(exec, i); + JSValue val = rtarray->getConcreteArray()->valueAt(exec, i); int itemdist = -1; QVariant item = convertValueToQVariant(exec, val, QMetaType::QObjectStar, &itemdist, visitedObjects); if (itemdist >= 0) @@ -635,12 +638,12 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty ret = QVariant::fromValue(result); } } else if (type == Array) { - JSObject* object = value->toObject(exec); + JSObject* object = value.toObject(exec); JSArray* array = static_cast<JSArray *>(object); QObjectList result; int len = array->length(); for (int i = 0; i < len; ++i) { - JSValuePtr val = array->get(exec, i); + JSValue val = array->get(exec, i); int itemdist = -1; QVariant item = convertValueToQVariant(exec, val, QMetaType::QObjectStar, &itemdist, visitedObjects); if (itemdist >= 0) @@ -672,7 +675,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty QList<int> result; int len = rtarray->getLength(); for (int i = 0; i < len; ++i) { - JSValuePtr val = rtarray->getConcreteArray()->valueAt(exec, i); + JSValue val = rtarray->getConcreteArray()->valueAt(exec, i); int itemdist = -1; QVariant item = convertValueToQVariant(exec, val, QMetaType::Int, &itemdist, visitedObjects); if (itemdist >= 0) @@ -691,7 +694,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty QList<int> result; int len = array->length(); for (int i = 0; i < len; ++i) { - JSValuePtr val = array->get(exec, i); + JSValue val = array->get(exec, i); int itemdist = -1; QVariant item = convertValueToQVariant(exec, val, QMetaType::Int, &itemdist, visitedObjects); if (itemdist >= 0) @@ -717,7 +720,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty } break; } else if (hint == (QMetaType::Type) qMetaTypeId<QVariant>()) { - if (value->isUndefinedOrNull()) { + if (value.isUndefinedOrNull()) { if (distance) *distance = 1; return QVariant(); @@ -746,13 +749,13 @@ QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Ty return ret; } -QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Type hint, int *distance) +QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type hint, int *distance) { HashSet<JSObject*> visitedObjects; return convertValueToQVariant(exec, value, hint, distance, &visitedObjects); } -JSValuePtr convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, const QVariant& variant) +JSValue convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, const QVariant& variant) { // Variants with QObject * can be isNull but not a null pointer // An empty QString variant is also null @@ -837,14 +840,14 @@ JSValuePtr convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, if (type == QMetaType::QByteArray) { QByteArray qtByteArray = variant.value<QByteArray>(); - WTF::RefPtr<ByteArray> wtfByteArray = ByteArray::create(qtByteArray.length()); + WTF::RefPtr<WTF::ByteArray> wtfByteArray = WTF::ByteArray::create(qtByteArray.length()); qMemCopy(wtfByteArray->data(), qtByteArray.constData(), qtByteArray.length()); return new (exec) JSC::JSByteArray(exec, JSC::JSByteArray::createStructure(jsNull()), wtfByteArray.get()); } if (type == QMetaType::QObjectStar || type == QMetaType::QWidgetStar) { QObject* obj = variant.value<QObject*>(); - return Instance::createRuntimeObject(exec, QtInstance::getQtInstance(obj, root, QScriptEngine::QtOwnership)); + return QtInstance::getQtInstance(obj, root, QScriptEngine::QtOwnership)->createRuntimeObject(exec); } if (type == QMetaType::QVariantMap) { @@ -854,7 +857,7 @@ JSValuePtr convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, QVariantMap::const_iterator i = map.constBegin(); while (i != map.constEnd()) { QString s = i.key(); - JSValuePtr val = convertQVariantToValue(exec, root, i.value()); + JSValue val = convertQVariantToValue(exec, root, i.value()); if (val) { PutPropertySlot slot; ret->put(exec, Identifier(exec, (const UChar *)s.constData(), s.length()), val, slot); @@ -1181,7 +1184,7 @@ static int findMethodIndex(ExecState* exec, bool converted = true; int matchDistance = 0; for (int i = 0; converted && i < types.count() - 1; ++i) { - JSValuePtr arg = i < jsArgs.size() ? jsArgs.at(exec, i) : jsUndefined(); + JSValue arg = i < jsArgs.size() ? jsArgs.at(i) : jsUndefined(); int argdistance = -1; QVariant v = convertValueToQVariant(exec, arg, types.at(i+1).typeId(), &argdistance); @@ -1333,7 +1336,7 @@ void QtRuntimeMetaMethod::mark() d->m_disconnect->mark(); } -JSValuePtr QtRuntimeMetaMethod::call(ExecState* exec, JSObject* functionObject, JSValuePtr thisValue, const ArgList& args) +JSValue QtRuntimeMetaMethod::call(ExecState* exec, JSObject* functionObject, JSValue thisValue, const ArgList& args) { QtRuntimeMetaMethodData* d = static_cast<QtRuntimeMetaMethod *>(functionObject)->d_func(); @@ -1391,13 +1394,13 @@ bool QtRuntimeMetaMethod::getOwnPropertySlot(ExecState* exec, const Identifier& return QtRuntimeMethod::getOwnPropertySlot(exec, propertyName, slot); } -JSValuePtr QtRuntimeMetaMethod::lengthGetter(ExecState* exec, const Identifier&, const PropertySlot&) +JSValue QtRuntimeMetaMethod::lengthGetter(ExecState* exec, const Identifier&, const PropertySlot&) { // QtScript always returns 0 return jsNumber(exec, 0); } -JSValuePtr QtRuntimeMetaMethod::connectGetter(ExecState* exec, const Identifier& ident, const PropertySlot& slot) +JSValue QtRuntimeMetaMethod::connectGetter(ExecState* exec, const Identifier& ident, const PropertySlot& slot) { QtRuntimeMetaMethod* thisObj = static_cast<QtRuntimeMetaMethod*>(asObject(slot.slotBase())); QW_DS(QtRuntimeMetaMethod, thisObj); @@ -1407,7 +1410,7 @@ JSValuePtr QtRuntimeMetaMethod::connectGetter(ExecState* exec, const Identifier& return d->m_connect; } -JSValuePtr QtRuntimeMetaMethod::disconnectGetter(ExecState* exec, const Identifier& ident, const PropertySlot& slot) +JSValue QtRuntimeMetaMethod::disconnectGetter(ExecState* exec, const Identifier& ident, const PropertySlot& slot) { QtRuntimeMetaMethod* thisObj = static_cast<QtRuntimeMetaMethod*>(asObject(slot.slotBase())); QW_DS(QtRuntimeMetaMethod, thisObj); @@ -1431,7 +1434,7 @@ QtRuntimeConnectionMethod::QtRuntimeConnectionMethod(ExecState* exec, const Iden d->m_isConnect = isConnect; } -JSValuePtr QtRuntimeConnectionMethod::call(ExecState* exec, JSObject* functionObject, JSValuePtr thisValue, const ArgList& args) +JSValue QtRuntimeConnectionMethod::call(ExecState* exec, JSObject* functionObject, JSValue thisValue, const ArgList& args) { QtRuntimeConnectionMethodData* d = static_cast<QtRuntimeConnectionMethod *>(functionObject)->d_func(); @@ -1454,7 +1457,7 @@ JSValuePtr QtRuntimeConnectionMethod::call(ExecState* exec, JSObject* functionOb if (signalIndex != -1) { if (args.size() == 1) { - funcObject = args.at(exec, 0)->toObject(exec); + funcObject = args.at(0).toObject(exec); CallData callData; if (funcObject->getCallData(callData) == CallTypeNone) { if (d->m_isConnect) @@ -1463,24 +1466,24 @@ JSValuePtr QtRuntimeConnectionMethod::call(ExecState* exec, JSObject* functionOb return throwError(exec, TypeError, "QtMetaMethod.disconnect: target is not a function"); } } else if (args.size() >= 2) { - if (args.at(exec, 0)->isObject()) { - thisObject = args.at(exec, 0)->toObject(exec); + if (args.at(0).isObject()) { + thisObject = args.at(0).toObject(exec); // Get the actual function to call - JSObject *asObj = args.at(exec, 1)->toObject(exec); + JSObject *asObj = args.at(1).toObject(exec); CallData callData; if (asObj->getCallData(callData) != CallTypeNone) { // Function version funcObject = asObj; } else { // Convert it to a string - UString funcName = args.at(exec, 1)->toString(exec); + UString funcName = args.at(1).toString(exec); Identifier funcIdent(exec, funcName); // ### DropAllLocks // This is resolved at this point in QtScript - JSValuePtr val = thisObject->get(exec, funcIdent); - JSObject* asFuncObj = val->toObject(exec); + JSValue val = thisObject->get(exec, funcIdent); + JSObject* asFuncObj = val.toObject(exec); if (asFuncObj->getCallData(callData) != CallTypeNone) { funcObject = asFuncObj; @@ -1515,7 +1518,7 @@ JSValuePtr QtRuntimeConnectionMethod::call(ExecState* exec, JSObject* functionOb bool ok = QMetaObject::connect(sender, signalIndex, conn, conn->metaObject()->methodOffset()); if (!ok) { delete conn; - QString msg = QString::fromLatin1("QtMetaMethod.connect: failed to connect to %1::%2()") + QString msg = QString(QLatin1String("QtMetaMethod.connect: failed to connect to %1::%2()")) .arg(QLatin1String(sender->metaObject()->className())) .arg(QLatin1String(d->m_signature)); return throwError(exec, GeneralError, msg.toLatin1().constData()); @@ -1541,14 +1544,14 @@ JSValuePtr QtRuntimeConnectionMethod::call(ExecState* exec, JSObject* functionOb } if (!ret) { - QString msg = QString::fromLatin1("QtMetaMethod.disconnect: failed to disconnect from %1::%2()") + QString msg = QString(QLatin1String("QtMetaMethod.disconnect: failed to disconnect from %1::%2()")) .arg(QLatin1String(sender->metaObject()->className())) .arg(QLatin1String(d->m_signature)); return throwError(exec, GeneralError, msg.toLatin1().constData()); } } } else { - QString msg = QString::fromLatin1("QtMetaMethod.%1: %2::%3() is not a signal") + QString msg = QString(QLatin1String("QtMetaMethod.%1: %2::%3() is not a signal")) .arg(QLatin1String(d->m_isConnect ? "connect": "disconnect")) .arg(QLatin1String(sender->metaObject()->className())) .arg(QLatin1String(d->m_signature)); @@ -1577,7 +1580,7 @@ bool QtRuntimeConnectionMethod::getOwnPropertySlot(ExecState* exec, const Identi return QtRuntimeMethod::getOwnPropertySlot(exec, propertyName, slot); } -JSValuePtr QtRuntimeConnectionMethod::lengthGetter(ExecState* exec, const Identifier&, const PropertySlot&) +JSValue QtRuntimeConnectionMethod::lengthGetter(ExecState* exec, const Identifier&, const PropertySlot&) { // we have one formal argument, and one optional return jsNumber(exec, 1); @@ -1675,9 +1678,9 @@ void QtConnectionObject::execute(void **argv) ExecState* exec = globalobj->globalExec(); if (exec) { // Build the argument list (up to the formal argument length of the slot) - ArgList l; + MarkedArgumentBuffer l; // ### DropAllLocks? - int funcArgC = m_funcObject->get(exec, exec->propertyNames().length)->toInt32(exec); + int funcArgC = m_funcObject->get(exec, exec->propertyNames().length).toInt32(exec); int argTotal = qMax(funcArgC, argc); for(int i=0; i < argTotal; i++) { if (i < argc) { @@ -1693,7 +1696,7 @@ void QtConnectionObject::execute(void **argv) if (m_funcObject->inherits(&JSFunction::info)) { JSFunction* fimp = static_cast<JSFunction*>(m_funcObject.get()); - JSObject* qt_sender = Instance::createRuntimeObject(exec, QtInstance::getQtInstance(sender(), ro, QScriptEngine::QtOwnership)); + JSObject* qt_sender = QtInstance::getQtInstance(sender(), ro, QScriptEngine::QtOwnership)->createRuntimeObject(exec); JSObject* wrapper = new (exec) JSObject(JSObject::createStructure(jsNull())); PutPropertySlot slot; wrapper->put(exec, Identifier(exec, "__qt_sender__"), qt_sender, slot); @@ -1743,7 +1746,7 @@ template <typename T> RootObject* QtArray<T>::rootObject() const return _rootObject && _rootObject->isValid() ? _rootObject.get() : 0; } -template <typename T> void QtArray<T>::setValueAt(ExecState* exec, unsigned index, JSValuePtr aValue) const +template <typename T> void QtArray<T>::setValueAt(ExecState* exec, unsigned index, JSValue aValue) const { // QtScript sets the value, but doesn't forward it to the original source // (e.g. if you do 'object.intList[5] = 6', the object is not updated, but the @@ -1757,7 +1760,7 @@ template <typename T> void QtArray<T>::setValueAt(ExecState* exec, unsigned inde } -template <typename T> JSValuePtr QtArray<T>::valueAt(ExecState *exec, unsigned int index) const +template <typename T> JSValue QtArray<T>::valueAt(ExecState *exec, unsigned int index) const { if (index < m_length) { T val = m_list.at(index); diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.h b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.h index 7912a2b9..72d93eb 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.h +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.h @@ -56,8 +56,8 @@ public: : m_type(ChildObject), m_childObject(child) {} - virtual JSValuePtr valueFromInstance(ExecState*, const Instance*) const; - virtual void setValueToInstance(ExecState*, const Instance*, JSValuePtr) const; + virtual JSValue valueFromInstance(ExecState*, const Instance*) const; + virtual void setValueToInstance(ExecState*, const Instance*, JSValue) const; virtual const char* name() const; QtFieldType fieldType() const {return m_type;} private: @@ -98,8 +98,8 @@ public: RootObject* rootObject() const; - virtual void setValueAt(ExecState*, unsigned index, JSValuePtr) const; - virtual JSValuePtr valueAt(ExecState*, unsigned index) const; + virtual void setValueAt(ExecState*, unsigned index, JSValue) const; + virtual JSValue valueAt(ExecState*, unsigned index) const; virtual unsigned int getLength() const {return m_length;} private: @@ -144,12 +144,12 @@ public: static const ClassInfo s_info; - static FunctionPrototype* createPrototype(ExecState* exec) + static FunctionPrototype* createPrototype(ExecState*, JSGlobalObject* globalObject) { - return exec->lexicalGlobalObject()->functionPrototype(); + return globalObject->functionPrototype(); } - static PassRefPtr<Structure> createStructure(JSValuePtr prototype) + static PassRefPtr<Structure> createStructure(JSValue prototype) { return Structure::create(prototype, TypeInfo(ObjectType)); } @@ -174,10 +174,10 @@ protected: private: virtual CallType getCallData(CallData&); - static JSValuePtr call(ExecState* exec, JSObject* functionObject, JSValuePtr thisValue, const ArgList& args); - static JSValuePtr lengthGetter(ExecState*, const Identifier&, const PropertySlot&); - static JSValuePtr connectGetter(ExecState*, const Identifier&, const PropertySlot&); - static JSValuePtr disconnectGetter(ExecState*, const Identifier&, const PropertySlot&); + static JSValue JSC_HOST_CALL call(ExecState* exec, JSObject* functionObject, JSValue thisValue, const ArgList& args); + static JSValue lengthGetter(ExecState*, const Identifier&, const PropertySlot&); + static JSValue connectGetter(ExecState*, const Identifier&, const PropertySlot&); + static JSValue disconnectGetter(ExecState*, const Identifier&, const PropertySlot&); }; class QtConnectionObject; @@ -193,8 +193,8 @@ protected: private: virtual CallType getCallData(CallData&); - static JSValuePtr call(ExecState* exec, JSObject* functionObject, JSValuePtr thisValue, const ArgList& args); - static JSValuePtr lengthGetter(ExecState*, const Identifier&, const PropertySlot&); + static JSValue JSC_HOST_CALL call(ExecState* exec, JSObject* functionObject, JSValue thisValue, const ArgList& args); + static JSValue lengthGetter(ExecState*, const Identifier&, const PropertySlot&); static QMultiMap<QObject *, QtConnectionObject *> connections; friend class QtConnectionObject; }; @@ -223,7 +223,8 @@ private: ProtectedPtr<JSObject> m_funcObject; }; -QVariant convertValueToQVariant(ExecState* exec, JSValuePtr value, QMetaType::Type hint, int *distance); +QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type hint, int *distance); +JSValue convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, const QVariant& variant); } // namespace Bindings } // namespace JSC diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime.cpp b/src/3rdparty/webkit/WebCore/bridge/runtime.cpp index 3b40825..d6b6962 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/runtime.cpp @@ -78,39 +78,11 @@ void Instance::end() virtualEnd(); } -JSValuePtr Instance::getValueOfField(ExecState* exec, const Field* aField) const +RuntimeObjectImp* Instance::createRuntimeObject(ExecState* exec) { - return aField->valueFromInstance(exec, this); -} - -void Instance::setValueOfField(ExecState* exec, const Field* aField, JSValuePtr aValue) const -{ - aField->setValueToInstance(exec, this, aValue); -} - -RuntimeObjectImp* Instance::createRuntimeObject(ExecState* exec, PassRefPtr<Instance> instance) -{ -#if PLATFORM(QT) - if (instance->getBindingLanguage() == QtLanguage) - return QtInstance::getRuntimeObject(exec, static_cast<QtInstance*>(instance.get())); -#endif JSLock lock(false); - - return new (exec) RuntimeObjectImp(exec, instance); -} - -Instance* Instance::getInstance(JSObject* object, BindingLanguage language) -{ - if (!object) - return 0; - if (!object->inherits(&RuntimeObjectImp::s_info)) - return 0; - Instance* instance = static_cast<RuntimeObjectImp*>(object)->getInternalInstance(); - if (!instance) - return 0; - if (instance->getBindingLanguage() != language) - return 0; - return instance; + + return new (exec) RuntimeObjectImp(exec, this); } RootObject* Instance::rootObject() const diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime.h b/src/3rdparty/webkit/WebCore/bridge/runtime.h index 3346c74..72736d4 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime.h +++ b/src/3rdparty/webkit/WebCore/bridge/runtime.h @@ -49,16 +49,14 @@ typedef Vector<Method*> MethodList; class Field { public: - virtual const char* name() const = 0; - virtual JSValuePtr valueFromInstance(ExecState*, const Instance*) const = 0; - virtual void setValueToInstance(ExecState*, const Instance*, JSValuePtr) const = 0; + virtual JSValue valueFromInstance(ExecState*, const Instance*) const = 0; + virtual void setValueToInstance(ExecState*, const Instance*, JSValue) const = 0; virtual ~Field() { } }; class Method : Noncopyable { public: - virtual const char *name() const = 0; virtual int numParameters() const = 0; virtual ~Method() { } @@ -66,10 +64,9 @@ public: class Class : Noncopyable { public: - virtual const char* name() const = 0; virtual MethodList methodsNamed(const Identifier&, Instance*) const = 0; virtual Field* fieldNamed(const Identifier&, Instance*) const = 0; - virtual JSValuePtr fallbackObject(ExecState*, Instance*, const Identifier&) { return jsUndefined(); } + virtual JSValue fallbackObject(ExecState*, Instance*, const Identifier&) { return jsUndefined(); } virtual ~Class() { } }; @@ -78,27 +75,11 @@ typedef void (*KJSDidExecuteFunctionPtr)(ExecState*, JSObject* rootObject); class Instance : public RefCounted<Instance> { public: - typedef enum { -#if ENABLE(MAC_JAVA_BRIDGE) - JavaLanguage, -#endif -#if PLATFORM(MAC) - ObjectiveCLanguage, -#endif - CLanguage -#if PLATFORM(QT) - , QtLanguage -#endif - } BindingLanguage; - Instance(PassRefPtr<RootObject>); static void setDidExecuteFunction(KJSDidExecuteFunctionPtr func); static KJSDidExecuteFunctionPtr didExecuteFunction(); - static RuntimeObjectImp* createRuntimeObject(ExecState*, PassRefPtr<Instance>); - static Instance* getInstance(JSObject*, BindingLanguage); - // These functions are called before and after the main entry points into // the native implementations. They can be used to establish and cleanup // any needed state. @@ -106,32 +87,31 @@ public: void end(); virtual Class *getClass() const = 0; + virtual RuntimeObjectImp* createRuntimeObject(ExecState*); - virtual JSValuePtr getValueOfField(ExecState*, const Field*) const; - virtual JSValuePtr getValueOfUndefinedField(ExecState*, const Identifier&) const { return jsUndefined(); } - virtual void setValueOfField(ExecState*, const Field*, JSValuePtr) const; - virtual bool supportsSetValueOfUndefinedField() { return false; } - virtual void setValueOfUndefinedField(ExecState*, const Identifier&, JSValuePtr) {} + // Returns false if the value was not set successfully. + virtual bool setValueOfUndefinedField(ExecState*, const Identifier&, JSValue) { return false; } - virtual JSValuePtr invokeMethod(ExecState*, const MethodList&, const ArgList& args) = 0; + virtual JSValue invokeMethod(ExecState*, const MethodList&, const ArgList& args) = 0; virtual bool supportsInvokeDefaultMethod() const { return false; } - virtual JSValuePtr invokeDefaultMethod(ExecState*, const ArgList&) { return jsUndefined(); } + virtual JSValue invokeDefaultMethod(ExecState*, const ArgList&) { return jsUndefined(); } virtual bool supportsConstruct() const { return false; } - virtual JSValuePtr invokeConstruct(ExecState*, const ArgList&) { return noValue(); } + virtual JSValue invokeConstruct(ExecState*, const ArgList&) { return JSValue(); } virtual void getPropertyNames(ExecState*, PropertyNameArray&) { } - virtual JSValuePtr defaultValue(ExecState*, PreferredPrimitiveType) const = 0; + virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const = 0; - virtual JSValuePtr valueOf(ExecState* exec) const { return jsString(exec, getClass()->name()); } + virtual JSValue valueOf(ExecState* exec) const = 0; RootObject* rootObject() const; virtual ~Instance(); - virtual BindingLanguage getBindingLanguage() const = 0; + virtual bool getOwnPropertySlot(JSObject*, ExecState*, const Identifier&, PropertySlot&) { return false; } + virtual void put(JSObject*, ExecState*, const Identifier&, JSValue, PutPropertySlot&) { } protected: virtual void virtualBegin() { } @@ -145,8 +125,8 @@ public: Array(PassRefPtr<RootObject>); virtual ~Array(); - virtual void setValueAt(ExecState *, unsigned index, JSValuePtr) const = 0; - virtual JSValuePtr valueAt(ExecState *, unsigned index) const = 0; + virtual void setValueAt(ExecState *, unsigned index, JSValue) const = 0; + virtual JSValue valueAt(ExecState *, unsigned index) const = 0; virtual unsigned int getLength() const = 0; protected: diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_array.cpp b/src/3rdparty/webkit/WebCore/bridge/runtime_array.cpp index 1979432..fead83a 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime_array.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/runtime_array.cpp @@ -42,13 +42,13 @@ RuntimeArray::RuntimeArray(ExecState* exec, Bindings::Array* a) { } -JSValuePtr RuntimeArray::lengthGetter(ExecState* exec, const Identifier&, const PropertySlot& slot) +JSValue RuntimeArray::lengthGetter(ExecState* exec, const Identifier&, const PropertySlot& slot) { RuntimeArray* thisObj = static_cast<RuntimeArray*>(asObject(slot.slotBase())); return jsNumber(exec, thisObj->getLength()); } -JSValuePtr RuntimeArray::indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot) +JSValue RuntimeArray::indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot) { RuntimeArray* thisObj = static_cast<RuntimeArray*>(asObject(slot.slotBase())); return thisObj->getConcreteArray()->valueAt(exec, slot.index()); @@ -83,7 +83,7 @@ bool RuntimeArray::getOwnPropertySlot(ExecState *exec, unsigned index, PropertyS return JSObject::getOwnPropertySlot(exec, index, slot); } -void RuntimeArray::put(ExecState* exec, const Identifier& propertyName, JSValuePtr value, PutPropertySlot& slot) +void RuntimeArray::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) { if (propertyName == exec->propertyNames().length) { throwError(exec, RangeError); @@ -100,7 +100,7 @@ void RuntimeArray::put(ExecState* exec, const Identifier& propertyName, JSValueP JSObject::put(exec, propertyName, value, slot); } -void RuntimeArray::put(ExecState* exec, unsigned index, JSValuePtr value) +void RuntimeArray::put(ExecState* exec, unsigned index, JSValue value) { if (index >= getLength()) { throwError(exec, RangeError); diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_array.h b/src/3rdparty/webkit/WebCore/bridge/runtime_array.h index 1ea47a4..5a86e9d 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime_array.h +++ b/src/3rdparty/webkit/WebCore/bridge/runtime_array.h @@ -37,8 +37,8 @@ public: virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&); virtual bool getOwnPropertySlot(ExecState *, unsigned, PropertySlot&); - virtual void put(ExecState*, const Identifier& propertyName, JSValuePtr, PutPropertySlot&); - virtual void put(ExecState*, unsigned propertyName, JSValuePtr); + virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + virtual void put(ExecState*, unsigned propertyName, JSValue); virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName); virtual bool deleteProperty(ExecState *exec, unsigned propertyName); @@ -51,19 +51,19 @@ public: static const ClassInfo s_info; - static ArrayPrototype* createPrototype(ExecState* exec) + static ArrayPrototype* createPrototype(ExecState*, JSGlobalObject* globalObject) { - return exec->lexicalGlobalObject()->arrayPrototype(); + return globalObject->arrayPrototype(); } - static PassRefPtr<Structure> createStructure(JSValuePtr prototype) + static PassRefPtr<Structure> createStructure(JSValue prototype) { return Structure::create(prototype, TypeInfo(ObjectType)); } private: - static JSValuePtr lengthGetter(ExecState*, const Identifier&, const PropertySlot&); - static JSValuePtr indexGetter(ExecState*, const Identifier&, const PropertySlot&); + static JSValue lengthGetter(ExecState*, const Identifier&, const PropertySlot&); + static JSValue indexGetter(ExecState*, const Identifier&, const PropertySlot&); OwnPtr<Bindings::Array> _array; }; diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_method.cpp b/src/3rdparty/webkit/WebCore/bridge/runtime_method.cpp index 014541d..30a3581 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime_method.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/runtime_method.cpp @@ -47,7 +47,7 @@ RuntimeMethod::RuntimeMethod(ExecState* exec, const Identifier& ident, Bindings: { } -JSValuePtr RuntimeMethod::lengthGetter(ExecState* exec, const Identifier&, const PropertySlot& slot) +JSValue RuntimeMethod::lengthGetter(ExecState* exec, const Identifier&, const PropertySlot& slot) { RuntimeMethod* thisObj = static_cast<RuntimeMethod*>(asObject(slot.slotBase())); @@ -70,7 +70,7 @@ bool RuntimeMethod::getOwnPropertySlot(ExecState* exec, const Identifier& proper return InternalFunction::getOwnPropertySlot(exec, propertyName, slot); } -static JSValuePtr callRuntimeMethod(ExecState* exec, JSObject* function, JSValuePtr thisValue, const ArgList& args) +static JSValue JSC_HOST_CALL callRuntimeMethod(ExecState* exec, JSObject* function, JSValue thisValue, const ArgList& args) { RuntimeMethod* method = static_cast<RuntimeMethod*>(function); @@ -79,13 +79,13 @@ static JSValuePtr callRuntimeMethod(ExecState* exec, JSObject* function, JSValue RuntimeObjectImp* imp; - if (thisValue->isObject(&RuntimeObjectImp::s_info)) { + if (thisValue.isObject(&RuntimeObjectImp::s_info)) { imp = static_cast<RuntimeObjectImp*>(asObject(thisValue)); } else { // If thisObj is the DOM object for a plugin, get the corresponding // runtime object from the DOM object. - JSValuePtr value = thisValue->get(exec, Identifier(exec, "__apple_runtime_object")); - if (value->isObject(&RuntimeObjectImp::s_info)) + JSValue value = thisValue.get(exec, Identifier(exec, "__apple_runtime_object")); + if (value.isObject(&RuntimeObjectImp::s_info)) imp = static_cast<RuntimeObjectImp*>(asObject(value)); else return throwError(exec, TypeError); @@ -96,7 +96,7 @@ static JSValuePtr callRuntimeMethod(ExecState* exec, JSObject* function, JSValue return RuntimeObjectImp::throwInvalidAccessError(exec); instance->begin(); - JSValuePtr result = instance->invokeMethod(exec, *method->methods(), args); + JSValue result = instance->invokeMethod(exec, *method->methods(), args); instance->end(); return result; } diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_method.h b/src/3rdparty/webkit/WebCore/bridge/runtime_method.h index bb983f9..5333c14 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime_method.h +++ b/src/3rdparty/webkit/WebCore/bridge/runtime_method.h @@ -40,18 +40,18 @@ public: static const ClassInfo s_info; - static FunctionPrototype* createPrototype(ExecState* exec) + static FunctionPrototype* createPrototype(ExecState*, JSGlobalObject* globalObject) { - return exec->lexicalGlobalObject()->functionPrototype(); + return globalObject->functionPrototype(); } - static PassRefPtr<Structure> createStructure(JSValuePtr prototype) + static PassRefPtr<Structure> createStructure(JSValue prototype) { return Structure::create(prototype, TypeInfo(ObjectType, ImplementsHasInstance)); } private: - static JSValuePtr lengthGetter(ExecState*, const Identifier&, const PropertySlot&); + static JSValue lengthGetter(ExecState*, const Identifier&, const PropertySlot&); virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); virtual CallType getCallData(CallData&); diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp b/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp index 3a2a93a..79afd3f 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp @@ -66,7 +66,7 @@ void RuntimeObjectImp::invalidate() instance = 0; } -JSValuePtr RuntimeObjectImp::fallbackObjectGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) +JSValue RuntimeObjectImp::fallbackObjectGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) { RuntimeObjectImp* thisObj = static_cast<RuntimeObjectImp*>(asObject(slot.slotBase())); RefPtr<Instance> instance = thisObj->instance; @@ -77,14 +77,14 @@ JSValuePtr RuntimeObjectImp::fallbackObjectGetter(ExecState* exec, const Identif instance->begin(); Class *aClass = instance->getClass(); - JSValuePtr result = aClass->fallbackObject(exec, instance.get(), propertyName); + JSValue result = aClass->fallbackObject(exec, instance.get(), propertyName); instance->end(); return result; } -JSValuePtr RuntimeObjectImp::fieldGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) +JSValue RuntimeObjectImp::fieldGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) { RuntimeObjectImp* thisObj = static_cast<RuntimeObjectImp*>(asObject(slot.slotBase())); RefPtr<Instance> instance = thisObj->instance; @@ -96,14 +96,14 @@ JSValuePtr RuntimeObjectImp::fieldGetter(ExecState* exec, const Identifier& prop Class *aClass = instance->getClass(); Field* aField = aClass->fieldNamed(propertyName, instance.get()); - JSValuePtr result = instance->getValueOfField(exec, aField); + JSValue result = aField->valueFromInstance(exec, instance.get()); instance->end(); return result; } -JSValuePtr RuntimeObjectImp::methodGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) +JSValue RuntimeObjectImp::methodGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) { RuntimeObjectImp* thisObj = static_cast<RuntimeObjectImp*>(asObject(slot.slotBase())); RefPtr<Instance> instance = thisObj->instance; @@ -115,7 +115,7 @@ JSValuePtr RuntimeObjectImp::methodGetter(ExecState* exec, const Identifier& pro Class *aClass = instance->getClass(); MethodList methodList = aClass->methodsNamed(propertyName, instance.get()); - JSValuePtr result = new (exec) RuntimeMethod(exec, propertyName, methodList); + JSValue result = new (exec) RuntimeMethod(exec, propertyName, methodList); instance->end(); @@ -153,7 +153,7 @@ bool RuntimeObjectImp::getOwnPropertySlot(ExecState *exec, const Identifier& pro } // Try a fallback object. - if (!aClass->fallbackObject(exec, instance.get(), propertyName)->isUndefined()) { + if (!aClass->fallbackObject(exec, instance.get(), propertyName).isUndefined()) { slot.setCustom(this, fallbackObjectGetter); instance->end(); return true; @@ -161,18 +161,11 @@ bool RuntimeObjectImp::getOwnPropertySlot(ExecState *exec, const Identifier& pro } instance->end(); -#if PLATFORM(QT) - // For Qt instances we call the baseclass implementation to allow - // runtime objects to have custom properties or a prototype - if (instance->getBindingLanguage() == Instance::QtLanguage) - return JSObject::getOwnPropertySlot(exec, propertyName, slot); -#endif - // For other platforms and/or binding languages we don't allow - // runtime properties/prototypes - return false; + + return instance->getOwnPropertySlot(this, exec, propertyName, slot); } -void RuntimeObjectImp::put(ExecState* exec, const Identifier& propertyName, JSValuePtr value, PutPropertySlot& slot) +void RuntimeObjectImp::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) { if (!instance) { throwInvalidAccessError(exec); @@ -185,13 +178,9 @@ void RuntimeObjectImp::put(ExecState* exec, const Identifier& propertyName, JSVa // Set the value of the property. Field *aField = instance->getClass()->fieldNamed(propertyName, instance.get()); if (aField) - instance->setValueOfField(exec, aField, value); - else if (instance->supportsSetValueOfUndefinedField()) - instance->setValueOfUndefinedField(exec, propertyName, value); -#if PLATFORM(QT) - else if (instance->getBindingLanguage() == Instance::QtLanguage) - JSObject::put(exec, propertyName, value, slot); -#endif + aField->setValueToInstance(exec, instance.get(), value); + else if (!instance->setValueOfUndefinedField(exec, propertyName, value)) + instance->put(this, exec, propertyName, value, slot); instance->end(); } @@ -202,23 +191,23 @@ bool RuntimeObjectImp::deleteProperty(ExecState*, const Identifier&) return false; } -JSValuePtr RuntimeObjectImp::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const +JSValue RuntimeObjectImp::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const { if (!instance) return throwInvalidAccessError(exec); RefPtr<Instance> protector(instance); instance->begin(); - JSValuePtr result = instance->defaultValue(exec, hint); + JSValue result = instance->defaultValue(exec, hint); instance->end(); return result; } -static JSValuePtr callRuntimeObject(ExecState* exec, JSObject* function, JSValuePtr, const ArgList& args) +static JSValue JSC_HOST_CALL callRuntimeObject(ExecState* exec, JSObject* function, JSValue, const ArgList& args) { RefPtr<Instance> instance(static_cast<RuntimeObjectImp*>(function)->getInternalInstance()); instance->begin(); - JSValuePtr result = instance->invokeDefaultMethod(exec, args); + JSValue result = instance->invokeDefaultMethod(exec, args); instance->end(); return result; } @@ -231,15 +220,15 @@ CallType RuntimeObjectImp::getCallData(CallData& callData) return CallTypeHost; } -JSObject* callRuntimeConstructor(ExecState* exec, JSObject* constructor, const ArgList& args) +static JSObject* callRuntimeConstructor(ExecState* exec, JSObject* constructor, const ArgList& args) { RefPtr<Instance> instance(static_cast<RuntimeObjectImp*>(constructor)->getInternalInstance()); instance->begin(); - JSValuePtr result = instance->invokeConstruct(exec, args); + JSValue result = instance->invokeConstruct(exec, args); instance->end(); ASSERT(result); - return result->isObject() ? static_cast<JSObject*>(result->asCell()) : constructor; + return result.isObject() ? static_cast<JSObject*>(result.asCell()) : constructor; } ConstructType RuntimeObjectImp::getConstructData(ConstructData& constructData) diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_object.h b/src/3rdparty/webkit/WebCore/bridge/runtime_object.h index 0e8ea77..f01fe1e 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime_object.h +++ b/src/3rdparty/webkit/WebCore/bridge/runtime_object.h @@ -33,12 +33,14 @@ namespace JSC { class RuntimeObjectImp : public JSObject { public: + RuntimeObjectImp(ExecState*, PassRefPtr<Bindings::Instance>); + virtual ~RuntimeObjectImp(); virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); - virtual void put(ExecState*, const Identifier& propertyName, JSValuePtr, PutPropertySlot&); + virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); virtual bool deleteProperty(ExecState* , const Identifier& propertyName); - virtual JSValuePtr defaultValue(ExecState*, PreferredPrimitiveType) const; + virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const; virtual CallType getCallData(CallData&); virtual ConstructType getConstructData(ConstructData&); @@ -51,12 +53,12 @@ public: static const ClassInfo s_info; - static ObjectPrototype* createPrototype(ExecState* exec) + static ObjectPrototype* createPrototype(ExecState*, JSGlobalObject* globalObject) { - return exec->lexicalGlobalObject()->objectPrototype(); + return globalObject->objectPrototype(); } - static PassRefPtr<Structure> createStructure(JSValuePtr prototype) + static PassRefPtr<Structure> createStructure(JSValue prototype) { return Structure::create(prototype, TypeInfo(ObjectType)); } @@ -65,14 +67,11 @@ protected: RuntimeObjectImp(ExecState*, PassRefPtr<Structure>, PassRefPtr<Bindings::Instance>); private: - friend class Bindings::Instance; - RuntimeObjectImp(ExecState*, PassRefPtr<Bindings::Instance>); - virtual const ClassInfo* classInfo() const { return &s_info; } - static JSValuePtr fallbackObjectGetter(ExecState*, const Identifier&, const PropertySlot&); - static JSValuePtr fieldGetter(ExecState*, const Identifier&, const PropertySlot&); - static JSValuePtr methodGetter(ExecState*, const Identifier&, const PropertySlot&); + static JSValue fallbackObjectGetter(ExecState*, const Identifier&, const PropertySlot&); + static JSValue fieldGetter(ExecState*, const Identifier&, const PropertySlot&); + static JSValue methodGetter(ExecState*, const Identifier&, const PropertySlot&); RefPtr<Bindings::Instance> instance; }; diff --git a/src/3rdparty/webkit/WebCore/bridge/testbindings.mm b/src/3rdparty/webkit/WebCore/bridge/testbindings.mm index 9215c48..ca70e17 100644 --- a/src/3rdparty/webkit/WebCore/bridge/testbindings.mm +++ b/src/3rdparty/webkit/WebCore/bridge/testbindings.mm @@ -103,7 +103,7 @@ } /* -- (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args; +- (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args { NSLog (@"Call to undefined method %@", name); NSLog (@"%d args\n", [args count]); |