Cherry-pick "Export WebCore::forgetV8ObjectForNPObject"
Bug: 14582835
Original CL description:
Export WebCore::forgetV8ObjectForNPObject
This is required for de-associating an NPObject from an existing V8 wrapper,
so we don't pull any of the wrapper's custom properties into the context of
a new page when navigating to it.
BUG=372914
Review URL: https://codereview.chromium.org/289473008
git-svn-id: svn://svn.chromium.org/blink/trunk@174083 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Change-Id: I7e3587dc166391679f17b233f98748bd6e9000a7
(cherry picked from commit 5423c896eb9c403f7bf0f728b9fbd64a2e6640e2)
diff --git a/Source/web/WebBindings.cpp b/Source/web/WebBindings.cpp
index eb369e5..78ed340 100644
--- a/Source/web/WebBindings.cpp
+++ b/Source/web/WebBindings.cpp
@@ -39,6 +39,7 @@
#include "bindings/v8/NPV8Object.h" // for PrivateIdentifier
#include "bindings/v8/ScriptController.h"
#include "bindings/v8/V8DOMWrapper.h"
+#include "bindings/v8/V8NPObject.h"
#include "bindings/v8/V8NPUtils.h"
#include "bindings/v8/custom/V8ArrayBufferCustom.h"
#include "bindings/v8/custom/V8ArrayBufferViewCustom.h"
@@ -182,6 +183,11 @@
_NPN_UnregisterObject(object);
}
+void WebBindings::dropV8WrapperForObject(NPObject* object)
+{
+ WebCore::forgetV8ObjectForNPObject(object);
+}
+
NPUTF8* WebBindings::utf8FromIdentifier(NPIdentifier identifier)
{
return _NPN_UTF8FromIdentifier(identifier);
diff --git a/public/web/WebBindings.h b/public/web/WebBindings.h
index a83120a..494e736 100644
--- a/public/web/WebBindings.h
+++ b/public/web/WebBindings.h
@@ -135,6 +135,11 @@
// _NPN_UnregisterObject
BLINK_EXPORT static void unregisterObject(NPObject*);
+ // Unlike unregisterObject, only drops the V8 wrapper object,
+ // not touching the NPObject itself, except for decrementing
+ // its references counter.
+ BLINK_EXPORT static void dropV8WrapperForObject(NPObject*);
+
// NPN_UTF8FromIdentifier
BLINK_EXPORT static NPUTF8* utf8FromIdentifier(NPIdentifier);