[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
andersca at apple.com
andersca at apple.com
Wed Dec 22 11:30:31 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 861e84a505f64e73e30debcb4919f60bb0f23416
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Jul 27 19:29:45 2010 +0000
Move NPJSObject out into separate files
https://bugs.webkit.org/show_bug.cgi?id=43068
Reviewed by Adam Roben.
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/Plugins/NPJSObject.cpp: Added.
(WebKit::NPJSObject::create):
(WebKit::NPJSObject::NPJSObject):
(WebKit::NPJSObject::~NPJSObject):
(WebKit::NPJSObject::isNPJSObject):
(WebKit::NPJSObject::initialize):
(WebKit::identifierFromIdentifierRep):
(WebKit::NPJSObject::hasProperty):
(WebKit::NPJSObject::getProperty):
(WebKit::NPJSObject::npClass):
(WebKit::NPJSObject::NP_Allocate):
(WebKit::NPJSObject::NP_Deallocate):
(WebKit::NPJSObject::NP_HasProperty):
(WebKit::NPJSObject::NP_GetProperty):
* WebProcess/Plugins/NPJSObject.h: Added.
(WebKit::NPJSObject::jsObject):
(WebKit::NPJSObject::toNPJSObject):
* WebProcess/Plugins/NPRuntimeObjectMap.cpp:
(WebKit::NPRuntimeObjectMap::npJSObjectDestroyed):
(WebKit::NPRuntimeObjectMap::globalExec):
* WebProcess/Plugins/NPRuntimeObjectMap.h:
* win/WebKit2.vcproj:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64147 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 7a0ff79..50438fb 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -2,6 +2,37 @@
Reviewed by Adam Roben.
+ Move NPJSObject out into separate files
+ https://bugs.webkit.org/show_bug.cgi?id=43068
+
+ * WebKit2.xcodeproj/project.pbxproj:
+ * WebProcess/Plugins/NPJSObject.cpp: Added.
+ (WebKit::NPJSObject::create):
+ (WebKit::NPJSObject::NPJSObject):
+ (WebKit::NPJSObject::~NPJSObject):
+ (WebKit::NPJSObject::isNPJSObject):
+ (WebKit::NPJSObject::initialize):
+ (WebKit::identifierFromIdentifierRep):
+ (WebKit::NPJSObject::hasProperty):
+ (WebKit::NPJSObject::getProperty):
+ (WebKit::NPJSObject::npClass):
+ (WebKit::NPJSObject::NP_Allocate):
+ (WebKit::NPJSObject::NP_Deallocate):
+ (WebKit::NPJSObject::NP_HasProperty):
+ (WebKit::NPJSObject::NP_GetProperty):
+ * WebProcess/Plugins/NPJSObject.h: Added.
+ (WebKit::NPJSObject::jsObject):
+ (WebKit::NPJSObject::toNPJSObject):
+ * WebProcess/Plugins/NPRuntimeObjectMap.cpp:
+ (WebKit::NPRuntimeObjectMap::npJSObjectDestroyed):
+ (WebKit::NPRuntimeObjectMap::globalExec):
+ * WebProcess/Plugins/NPRuntimeObjectMap.h:
+ * win/WebKit2.vcproj:
+
+2010-07-27 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Adam Roben.
+
Rename NPJSObjectMap to NPRuntimeObjectMap
https://bugs.webkit.org/show_bug.cgi?id=43066
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 0ded45a..7a8cbbf 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -71,6 +71,8 @@
1AA5889311EE70400061B882 /* NetscapePluginStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AA5889111EE70400061B882 /* NetscapePluginStream.cpp */; };
1AADE6FF10D855FC00D3D63D /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AADE6FE10D855FC00D3D63D /* ApplicationServices.framework */; };
1AE117F611DBB30900981615 /* ProcessLauncher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE117F511DBB30900981615 /* ProcessLauncher.cpp */; };
+ 1AE4976811FF658E0048B464 /* NPJSObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE4976611FF658E0048B464 /* NPJSObject.h */; };
+ 1AE4976911FF658E0048B464 /* NPJSObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE4976711FF658E0048B464 /* NPJSObject.cpp */; };
1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.mm */; };
1AEFCC1211D01F96008219D3 /* PluginInfoStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AEFCC1011D01F96008219D3 /* PluginInfoStore.h */; };
1AEFCC1311D01F96008219D3 /* PluginInfoStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AEFCC1111D01F96008219D3 /* PluginInfoStore.cpp */; };
@@ -356,6 +358,8 @@
1AA5889111EE70400061B882 /* NetscapePluginStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapePluginStream.cpp; sourceTree = "<group>"; };
1AADE6FE10D855FC00D3D63D /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = System/Library/Frameworks/ApplicationServices.framework; sourceTree = SDKROOT; };
1AE117F511DBB30900981615 /* ProcessLauncher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProcessLauncher.cpp; sourceTree = "<group>"; };
+ 1AE4976611FF658E0048B464 /* NPJSObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPJSObject.h; sourceTree = "<group>"; };
+ 1AE4976711FF658E0048B464 /* NPJSObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPJSObject.cpp; sourceTree = "<group>"; };
1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetscapePluginMac.mm; sourceTree = "<group>"; };
1AEFCC1011D01F96008219D3 /* PluginInfoStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginInfoStore.h; sourceTree = "<group>"; };
1AEFCC1111D01F96008219D3 /* PluginInfoStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginInfoStore.cpp; sourceTree = "<group>"; };
@@ -673,6 +677,8 @@
isa = PBXGroup;
children = (
1A6FB90811E66FB100DB1371 /* Netscape */,
+ 1AE4976711FF658E0048B464 /* NPJSObject.cpp */,
+ 1AE4976611FF658E0048B464 /* NPJSObject.h */,
1A2161AF11F37664008AD0F5 /* NPRuntimeObjectMap.cpp */,
1A2161AE11F37664008AD0F5 /* NPRuntimeObjectMap.h */,
1A2162AE11F38971008AD0F5 /* NPRuntimeUtilities.cpp */,
@@ -1281,6 +1287,7 @@
E1EE563011F8F6AA00CCBEE4 /* WKBundleNode.h in Headers */,
BCF049E611FE20F600F86A58 /* WKBundleFramePrivate.h in Headers */,
BCF049E711FE20F600F86A58 /* WKBundlePrivate.h in Headers */,
+ 1AE4976811FF658E0048B464 /* NPJSObject.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1478,6 +1485,7 @@
E1EE53E711F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp in Sources */,
E1EE55F811F8F1BC00CCBEE4 /* WKBundleRange.cpp in Sources */,
E1EE565611F8F71700CCBEE4 /* WKBundleNode.cpp in Sources */,
+ 1AE4976911FF658E0048B464 /* NPJSObject.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebKit2/WebProcess/Plugins/NPJSObject.cpp b/WebKit2/WebProcess/Plugins/NPJSObject.cpp
new file mode 100644
index 0000000..afe6da3
--- /dev/null
+++ b/WebKit2/WebProcess/Plugins/NPJSObject.cpp
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 "NPJSObject.h"
+
+#include "NPRuntimeObjectMap.h"
+#include "NPRuntimeUtilities.h"
+#include "PluginView.h"
+#include <JavaScriptCore/JSObject.h>
+#include <WebCore/Frame.h>
+#include <WebCore/IdentifierRep.h>
+#include <WebCore/PlatformString.h>
+
+using namespace JSC;
+using namespace WebCore;
+
+namespace WebKit {
+
+NPJSObject* NPJSObject::create(NPRuntimeObjectMap* objectMap, JSObject* jsObject)
+{
+ NPJSObject* npJSObject = toNPJSObject(createNPObject(0, npClass()));
+ npJSObject->initialize(objectMap, jsObject);
+
+ return npJSObject;
+}
+
+NPJSObject::NPJSObject()
+ : m_objectMap(0)
+{
+}
+
+NPJSObject::~NPJSObject()
+{
+ m_objectMap->npJSObjectDestroyed(this);
+}
+
+bool NPJSObject::isNPJSObject(NPObject* npObject)
+{
+ return npObject->_class == npClass();
+}
+
+void NPJSObject::initialize(NPRuntimeObjectMap* objectMap, JSObject* jsObject)
+{
+ ASSERT(!m_objectMap);
+ ASSERT(!m_jsObject);
+
+ m_objectMap = objectMap;
+ m_jsObject = jsObject;
+}
+
+static Identifier identifierFromIdentifierRep(ExecState* exec, IdentifierRep* identifierRep)
+{
+ ASSERT(identifierRep->isString());
+
+ const char* string = identifierRep->string();
+ int length = strlen(string);
+
+ return Identifier(exec, String::fromUTF8WithLatin1Fallback(string, length).impl());
+}
+
+bool NPJSObject::hasProperty(NPIdentifier identifier)
+{
+ IdentifierRep* identifierRep = static_cast<IdentifierRep*>(identifier);
+
+ ExecState* exec = m_objectMap->globalExec();
+ if (!exec)
+ return false;
+
+ bool result;
+ if (identifierRep->isString())
+ result = m_jsObject->hasProperty(exec, identifierFromIdentifierRep(exec, identifierRep));
+ else
+ result = m_jsObject->hasProperty(exec, identifierRep->number());
+
+ exec->clearException();
+
+ return result;
+}
+
+bool NPJSObject::getProperty(NPIdentifier identifier, NPVariant* result)
+{
+ // FIXME: Implement.
+ return false;
+}
+
+NPClass* NPJSObject::npClass()
+{
+ static NPClass npClass = {
+ NP_CLASS_STRUCT_VERSION,
+ NP_Allocate,
+ NP_Deallocate,
+ 0,
+ 0,
+ 0,
+ 0,
+ NP_HasProperty,
+ NP_GetProperty,
+ 0,
+ 0,
+ 0,
+ 0
+ };
+
+ return &npClass;
+}
+
+NPObject* NPJSObject::NP_Allocate(NPP npp, NPClass* npClass)
+{
+ ASSERT_UNUSED(npp, !npp);
+
+ return new NPJSObject;
+}
+
+void NPJSObject::NP_Deallocate(NPObject* npObject)
+{
+ NPJSObject* npJSObject = toNPJSObject(npObject);
+ delete npJSObject;
+}
+
+bool NPJSObject::NP_HasProperty(NPObject* npObject, NPIdentifier propertyName)
+{
+ return toNPJSObject(npObject)->hasProperty(propertyName);
+}
+
+bool NPJSObject::NP_GetProperty(NPObject* npObject, NPIdentifier propertyName, NPVariant* result)
+{
+ return toNPJSObject(npObject)->getProperty(propertyName, result);
+}
+
+} // namespace WebKit
diff --git a/WebKit2/WebProcess/Plugins/NPJSObject.h b/WebKit2/WebProcess/Plugins/NPJSObject.h
new file mode 100644
index 0000000..dfc6f08
--- /dev/null
+++ b/WebKit2/WebProcess/Plugins/NPJSObject.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2010 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 NPJSObject_h
+#define NPJSObject_h
+
+#include <JavaScriptCore/Protect.h>
+#include <WebCore/npruntime.h>
+#include <wtf/Noncopyable.h>
+
+namespace JSC {
+ class JSObject;
+}
+
+namespace WebKit {
+
+class NPRuntimeObjectMap;
+
+// NPJSObject is an NPObject that wrappes a JavaScript object.
+class NPJSObject : public NPObject, Noncopyable {
+public:
+ static NPJSObject* create(NPRuntimeObjectMap* objectMap, JSC::JSObject* jsObject);
+
+ JSC::JSObject* jsObject() const { return m_jsObject.get(); }
+
+private:
+ NPJSObject();
+ ~NPJSObject();
+
+ static bool isNPJSObject(NPObject*);
+
+ static NPJSObject* toNPJSObject(NPObject* npObject)
+ {
+ ASSERT(isNPJSObject(npObject));
+ return static_cast<NPJSObject*>(npObject);
+ }
+
+ void initialize(NPRuntimeObjectMap*, JSC::JSObject* jsObject);
+
+ bool hasProperty(NPIdentifier);
+ bool getProperty(NPIdentifier, NPVariant* result);
+
+ static NPClass* npClass();
+ static NPObject* NP_Allocate(NPP, NPClass*);
+ static void NP_Deallocate(NPObject*);
+ static bool NP_HasProperty(NPObject* npobj, NPIdentifier name);
+ static bool NP_GetProperty(NPObject* npobj, NPIdentifier name, NPVariant* result);
+
+ NPRuntimeObjectMap* m_objectMap;
+ JSC::ProtectedPtr<JSC::JSObject> m_jsObject;
+};
+
+} // namespace WebKit
+
+#endif // NPJSObject_h
diff --git a/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.cpp b/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.cpp
index 90da8b1..e280bc7 100644
--- a/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.cpp
+++ b/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.cpp
@@ -25,161 +25,16 @@
#include "NPRuntimeObjectMap.h"
+#include "NPJSObject.h"
#include "NPRuntimeUtilities.h"
#include "PluginView.h"
#include <WebCore/Frame.h>
-#include <WebCore/IdentifierRep.h>
-#include <JavaScriptCore/JSObject.h>
-#include <JavaScriptCore/Protect.h>
-#include <WebKit/npruntime.h>
-#include <wtf/Noncopyable.h>
using namespace JSC;
using namespace WebCore;
namespace WebKit {
-class NPJSObject : public NPObject, Noncopyable {
-public:
- static NPJSObject* create(NPRuntimeObjectMap* objectMap, JSObject* jsObject);
-
-private:
- NPJSObject()
- : m_objectMap(0)
- {
- }
-
- ~NPJSObject()
- {
- // Remove ourselves from the map.
- ASSERT(m_objectMap->m_objects.contains(m_jsObject.get()));
- m_objectMap->m_objects.remove(m_jsObject.get());
- }
-
- static bool isNPJSObject(NPObject*);
-
- static NPJSObject* toNPJSObject(NPObject* npObject)
- {
- ASSERT(isNPJSObject(npObject));
- return static_cast<NPJSObject*>(npObject);
- }
-
- void initialize(NPRuntimeObjectMap*, JSObject* jsObject);
-
- bool hasProperty(NPIdentifier);
- bool getProperty(NPIdentifier, NPVariant* result);
-
- static NPClass* npClass();
- static NPObject* NP_Allocate(NPP, NPClass*);
- static void NP_Deallocate(NPObject*);
- static bool NP_HasProperty(NPObject* npobj, NPIdentifier name);
- static bool NP_GetProperty(NPObject* npobj, NPIdentifier name, NPVariant* result);
-
- NPRuntimeObjectMap* m_objectMap;
- ProtectedPtr<JSObject> m_jsObject;
-};
-
-NPJSObject* NPJSObject::create(NPRuntimeObjectMap* objectMap, JSObject* jsObject)
-{
- NPJSObject* npJSObject = toNPJSObject(createNPObject(0, npClass()));
- npJSObject->initialize(objectMap, jsObject);
-
- return npJSObject;
-}
-
-bool NPJSObject::isNPJSObject(NPObject* npObject)
-{
- return npObject->_class == npClass();
-}
-
-void NPJSObject::initialize(NPRuntimeObjectMap* objectMap, JSObject* jsObject)
-{
- ASSERT(!m_objectMap);
- ASSERT(!m_jsObject);
-
- m_objectMap = objectMap;
- m_jsObject = jsObject;
-}
-
-static Identifier identifierFromIdentifierRep(ExecState* exec, IdentifierRep* identifierRep)
-{
- ASSERT(identifierRep->isString());
-
- const char* string = identifierRep->string();
- int length = strlen(string);
-
- return Identifier(exec, String::fromUTF8WithLatin1Fallback(string, length).impl());
-}
-
-bool NPJSObject::hasProperty(NPIdentifier identifier)
-{
- IdentifierRep* identifierRep = static_cast<IdentifierRep*>(identifier);
-
- Frame* frame = m_objectMap->m_pluginView->frame();
- if (!frame)
- return false;
-
- bool result;
- ExecState* exec = frame->script()->globalObject(pluginWorld())->globalExec();
- if (identifierRep->isString())
- result = m_jsObject->hasProperty(exec, identifierFromIdentifierRep(exec, identifierRep));
- else
- result = m_jsObject->hasProperty(exec, identifierRep->number());
-
- exec->clearException();
-
- return result;
-}
-
-bool NPJSObject::getProperty(NPIdentifier identifier, NPVariant* result)
-{
- // FIXME: Implement.
- return false;
-}
-
-NPClass* NPJSObject::npClass()
-{
- static NPClass npClass = {
- NP_CLASS_STRUCT_VERSION,
- NP_Allocate,
- NP_Deallocate,
- 0,
- 0,
- 0,
- 0,
- NP_HasProperty,
- NP_GetProperty,
- 0,
- 0,
- 0,
- 0
- };
-
- return &npClass;
-}
-
-NPObject* NPJSObject::NP_Allocate(NPP npp, NPClass* npClass)
-{
- ASSERT_UNUSED(npp, !npp);
-
- return new NPJSObject;
-}
-
-void NPJSObject::NP_Deallocate(NPObject* npObject)
-{
- NPJSObject* npJSObject = toNPJSObject(npObject);
- delete npJSObject;
-}
-
-bool NPJSObject::NP_HasProperty(NPObject* npObject, NPIdentifier propertyName)
-{
- return toNPJSObject(npObject)->hasProperty(propertyName);
-}
-
-bool NPJSObject::NP_GetProperty(NPObject* npObject, NPIdentifier propertyName, NPVariant* result)
-{
- return toNPJSObject(npObject)->getProperty(propertyName, result);
-}
NPRuntimeObjectMap::NPRuntimeObjectMap(PluginView* pluginView)
: m_pluginView(pluginView)
@@ -200,6 +55,13 @@ NPObject* NPRuntimeObjectMap::getOrCreateNPObject(JSObject* jsObject)
return npJSObject;
}
+void NPRuntimeObjectMap::npJSObjectDestroyed(NPJSObject* npJSObject)
+{
+ // Remove the object from the map.
+ ASSERT(m_objects.contains(npJSObject->jsObject()));
+ m_objects.remove(npJSObject->jsObject());
+}
+
void NPRuntimeObjectMap::invalidate()
{
Vector<NPJSObject*> npJSObjects;
@@ -213,4 +75,14 @@ void NPRuntimeObjectMap::invalidate()
ASSERT(m_objects.isEmpty());
}
+ExecState* NPRuntimeObjectMap::globalExec() const
+{
+ Frame* frame = m_pluginView->frame();
+ if (!frame)
+ return 0;
+
+ return frame->script()->globalObject(pluginWorld())->globalExec();
+}
+
+
} // namespace WebKit
diff --git a/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.h b/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.h
index 43d5b78..615221d 100644
--- a/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.h
+++ b/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.h
@@ -31,6 +31,7 @@
struct NPObject;
namespace JSC {
+ class ExecState;
class JSObject;
}
@@ -40,7 +41,6 @@ class NPJSObject;
class PluginView;
// A per plug-in map of NPObjects that wrap JavaScript objects.
-
class NPRuntimeObjectMap {
public:
explicit NPRuntimeObjectMap(PluginView*);
@@ -49,10 +49,14 @@ public:
// retain it and return it.
NPObject* getOrCreateNPObject(JSC::JSObject*);
+ void npJSObjectDestroyed(NPJSObject*);
+
+ // Called when the plug-in is destroyed. Will invalidate all the NPObjects.
void invalidate();
+ JSC::ExecState* globalExec() const;
+
private:
- friend class NPJSObject;
PluginView* m_pluginView;
HashMap<JSC::JSObject*, NPJSObject*> m_objects;
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index 7a547d8..df7fc5a 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -752,6 +752,14 @@
Name="Plugins"
>
<File
+ RelativePath="..\WebProcess\Plugins\NPJSObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebProcess\Plugins\NPJSObject.h"
+ >
+ </File>
+ <File
RelativePath="..\WebProcess\Plugins\NPRuntimeObjectMap.cpp"
>
</File>
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list