diff options
author | Ben Murdoch <benm@google.com> | 2011-05-24 11:24:40 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-02 09:53:15 +0100 |
commit | 81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch) | |
tree | 7a9e5ed86ff429fd347a25153107221543909b19 /Source/WebKit/mac/Plugins/Hosted | |
parent | 94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff) | |
download | external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2 |
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Source/WebKit/mac/Plugins/Hosted')
6 files changed, 42 insertions, 28 deletions
diff --git a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm index d8cd081..ce40f48 100644 --- a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm +++ b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm @@ -29,7 +29,7 @@ #import "NetscapePluginHostProxy.h" #import "NetscapePluginInstanceProxy.h" -#import "WebLocalizableStrings.h" +#import "WebLocalizableStringsInternal.h" #import "WebKitSystemInterface.h" #import "WebNetscapePluginPackage.h" #import <mach/mach_port.h> @@ -145,7 +145,7 @@ bool NetscapePluginHostManager::spawnPluginHost(const String& pluginPath, cpu_ty return false; } - NSString *visibleName = [NSString stringWithFormat:UI_STRING("%@ (%@ Internet plug-in)", + NSString *visibleName = [NSString stringWithFormat:UI_STRING_INTERNAL("%@ (%@ Internet plug-in)", "visible name of the plug-in host process. The first argument is the plug-in name " "and the second argument is the application name."), [[(NSString*)pluginPath lastPathComponent] stringByDeletingPathExtension], [[NSProcessInfo processInfo] processName]]; diff --git a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h index 4f2c566..7828460 100644 --- a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h +++ b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h @@ -28,7 +28,7 @@ #ifndef NetscapePluginInstanceProxy_h #define NetscapePluginInstanceProxy_h -#include <JavaScriptCore/Protect.h> +#include <JavaScriptCore/Global.h> #include <WebCore/Timer.h> #include <WebKit/npapi.h> #include <wtf/Deque.h> @@ -318,7 +318,7 @@ private: public: LocalObjectMap(); ~LocalObjectMap(); - uint32_t idForObject(JSC::JSObject*); + uint32_t idForObject(JSC::JSGlobalData&, JSC::JSObject*); void retain(JSC::JSObject*); void release(JSC::JSObject*); void clear(); @@ -327,7 +327,7 @@ private: JSC::JSObject* get(uint32_t) const; private: - HashMap<uint32_t, JSC::ProtectedPtr<JSC::JSObject> > m_idToJSObjectMap; + HashMap<uint32_t, JSC::Global<JSC::JSObject> > m_idToJSObjectMap; // The pair consists of object ID and a reference count. One reference belongs to remote plug-in, // and the proxy will add transient references for arguments that are being sent out. HashMap<JSC::JSObject*, pair<uint32_t, uint32_t> > m_jsObjectToIDMap; diff --git a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm index ecaa0d6..ed646d3 100644 --- a/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm +++ b/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm @@ -121,10 +121,10 @@ inline JSC::JSObject* NetscapePluginInstanceProxy::LocalObjectMap::get(uint32_t if (objectID == HashTraits<uint32_t>::emptyValue() || HashTraits<uint32_t>::isDeletedValue(objectID)) return 0; - return m_idToJSObjectMap.get(objectID); + return m_idToJSObjectMap.get(objectID).get(); } -uint32_t NetscapePluginInstanceProxy::LocalObjectMap::idForObject(JSObject* object) +uint32_t NetscapePluginInstanceProxy::LocalObjectMap::idForObject(JSGlobalData& globalData, JSObject* object) { // This method creates objects with refcount of 1, but doesn't increase refcount when returning // found objects. This extra count accounts for the main "reference" kept by plugin process. @@ -148,7 +148,7 @@ uint32_t NetscapePluginInstanceProxy::LocalObjectMap::idForObject(JSObject* obje objectID = ++m_objectIDCounter; } while (!m_objectIDCounter || m_objectIDCounter == static_cast<uint32_t>(-1) || m_idToJSObjectMap.contains(objectID)); - m_idToJSObjectMap.set(objectID, object); + m_idToJSObjectMap.set(objectID, Global<JSObject>(globalData, object)); m_jsObjectToIDMap.set(object, make_pair<uint32_t, uint32_t>(objectID, 1)); return objectID; @@ -188,7 +188,7 @@ bool NetscapePluginInstanceProxy::LocalObjectMap::forget(uint32_t objectID) return true; } - HashMap<uint32_t, JSC::ProtectedPtr<JSC::JSObject> >::iterator iter = m_idToJSObjectMap.find(objectID); + HashMap<uint32_t, JSC::Global<JSC::JSObject> >::iterator iter = m_idToJSObjectMap.find(objectID); if (iter == m_idToJSObjectMap.end()) { LOG_ERROR("NetscapePluginInstanceProxy::LocalObjectMap::forget: local object %u doesn't exist.", objectID); return true; @@ -823,7 +823,7 @@ bool NetscapePluginInstanceProxy::getWindowNPObject(uint32_t& objectID) if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript)) objectID = 0; else - objectID = m_localObjects.idForObject(frame->script()->windowShell(pluginWorld())->window()); + objectID = m_localObjects.idForObject(*pluginWorld()->globalData(), frame->script()->windowShell(pluginWorld())->window()); return true; } @@ -835,7 +835,7 @@ bool NetscapePluginInstanceProxy::getPluginElementNPObject(uint32_t& objectID) return false; if (JSObject* object = frame->script()->jsObjectForPluginElement([m_pluginView element])) - objectID = m_localObjects.idForObject(object); + objectID = m_localObjects.idForObject(*pluginWorld()->globalData(), object); else objectID = 0; @@ -866,7 +866,7 @@ bool NetscapePluginInstanceProxy::evaluate(uint32_t objectID, const String& scri JSLock lock(SilenceAssertionsOnly); - ProtectedPtr<JSGlobalObject> globalObject = frame->script()->globalObject(pluginWorld()); + Global<JSGlobalObject> globalObject(*pluginWorld()->globalData(), frame->script()->globalObject(pluginWorld())); ExecState* exec = globalObject->globalExec(); bool oldAllowPopups = frame->script()->allowPopupsFromPlugin(); @@ -920,10 +920,10 @@ bool NetscapePluginInstanceProxy::invoke(uint32_t objectID, const Identifier& me MarkedArgumentBuffer argList; demarshalValues(exec, argumentsData, argumentsLength, argList); - ProtectedPtr<JSGlobalObject> globalObject = frame->script()->globalObject(pluginWorld()); - globalObject->globalData().timeoutChecker.start(); + RefPtr<JSGlobalData> globalData = pluginWorld()->globalData(); + globalData->timeoutChecker.start(); JSValue value = call(exec, function, callType, callData, object, argList); - globalObject->globalData().timeoutChecker.stop(); + globalData->timeoutChecker.stop(); marshalValue(exec, value, resultData, resultLength); exec->clearException(); @@ -955,10 +955,10 @@ bool NetscapePluginInstanceProxy::invokeDefault(uint32_t objectID, data_t argume MarkedArgumentBuffer argList; demarshalValues(exec, argumentsData, argumentsLength, argList); - ProtectedPtr<JSGlobalObject> globalObject = frame->script()->globalObject(pluginWorld()); - globalObject->globalData().timeoutChecker.start(); + RefPtr<JSGlobalData> globalData = pluginWorld()->globalData(); + globalData->timeoutChecker.start(); JSValue value = call(exec, object, callType, callData, object, argList); - globalObject->globalData().timeoutChecker.stop(); + globalData->timeoutChecker.stop(); marshalValue(exec, value, resultData, resultLength); exec->clearException(); @@ -991,10 +991,10 @@ bool NetscapePluginInstanceProxy::construct(uint32_t objectID, data_t argumentsD MarkedArgumentBuffer argList; demarshalValues(exec, argumentsData, argumentsLength, argList); - ProtectedPtr<JSGlobalObject> globalObject = frame->script()->globalObject(pluginWorld()); - globalObject->globalData().timeoutChecker.start(); + RefPtr<JSGlobalData> globalData = pluginWorld()->globalData(); + globalData->timeoutChecker.start(); JSValue value = JSC::construct(exec, object, constructType, constructData, argList); - globalObject->globalData().timeoutChecker.stop(); + globalData->timeoutChecker.stop(); marshalValue(exec, value, resultData, resultLength); exec->clearException(); @@ -1283,7 +1283,7 @@ void NetscapePluginInstanceProxy::addValueToArray(NSMutableArray *array, ExecSta } } else { [array addObject:[NSNumber numberWithInt:JSObjectValueType]]; - [array addObject:[NSNumber numberWithInt:m_localObjects.idForObject(object)]]; + [array addObject:[NSNumber numberWithInt:m_localObjects.idForObject(exec->globalData(), object)]]; } } else [array addObject:[NSNumber numberWithInt:VoidValueType]]; diff --git a/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm b/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm index 927a008..8a413d4 100644 --- a/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm +++ b/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm @@ -34,6 +34,7 @@ #import <WebCore/npruntime_impl.h> #import <WebCore/runtime_method.h> #import <runtime/Error.h> +#import <runtime/FunctionPrototype.h> #import <runtime/PropertyNameArray.h> extern "C" { @@ -179,11 +180,17 @@ JSValue ProxyInstance::invoke(JSC::ExecState* exec, InvokeType type, uint64_t id class ProxyRuntimeMethod : public RuntimeMethod { public: ProxyRuntimeMethod(ExecState* exec, JSGlobalObject* globalObject, const Identifier& name, Bindings::MethodList& list) - : RuntimeMethod(exec, globalObject, name, list) + // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object + // exec-globalData() is also likely wrong. + : RuntimeMethod(exec, globalObject, deprecatedGetDOMStructure<ProxyRuntimeMethod>(exec), name, list) { + ASSERT(inherits(&s_info)); } - virtual const ClassInfo* classInfo() const { return &s_info; } + static PassRefPtr<Structure> createStructure(JSValue prototype) + { + return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); + } static const ClassInfo s_info; }; diff --git a/Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h b/Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h index 81d9b42..fc77890 100644 --- a/Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h +++ b/Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h @@ -41,10 +41,12 @@ public: ProxyInstance* getInternalProxyInstance() const; - static const JSC::ClassInfo s_info; + static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); + } -private: - virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + static const JSC::ClassInfo s_info; }; } diff --git a/Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.mm b/Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.mm index 96855b3..c12d5cf 100644 --- a/Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.mm +++ b/Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.mm @@ -25,6 +25,8 @@ #if USE(PLUGIN_HOST_PROCESS) +#include "runtime/ObjectPrototype.h" +#include <WebCore/JSDOMBinding.h> #include "ProxyInstance.h" #include "ProxyRuntimeObject.h" @@ -36,8 +38,11 @@ namespace WebKit { const ClassInfo ProxyRuntimeObject::s_info = { "ProxyRuntimeObject", &RuntimeObject::s_info, 0, 0 }; ProxyRuntimeObject::ProxyRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, PassRefPtr<ProxyInstance> instance) - : RuntimeObject(exec, globalObject, instance) + // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object + // exec-globalData() is also likely wrong. + : RuntimeObject(exec, globalObject, WebCore::deprecatedGetDOMStructure<ProxyRuntimeObject>(exec), instance) { + ASSERT(inherits(&s_info)); } ProxyRuntimeObject::~ProxyRuntimeObject() |