Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1074)

Unified Diff: content/renderer/java/java_bridge_dispatcher.cc

Issue 286823002: [Android Java Bridge] Recycle old V8 wrapper objects on navigations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeBasicsTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/java/java_bridge_dispatcher.cc
diff --git a/content/renderer/java/java_bridge_dispatcher.cc b/content/renderer/java/java_bridge_dispatcher.cc
index f66bac3d9a290b4a358073edaf21c6f60d18f674..262ea94fbd5f128a624e480fef49c7e6062cb72d 100644
--- a/content/renderer/java/java_bridge_dispatcher.cc
+++ b/content/renderer/java/java_bridge_dispatcher.cc
@@ -57,11 +57,15 @@ void JavaBridgeDispatcher::DidClearWindowObject() {
for (ObjectMap::const_iterator iter = objects_.begin();
iter != objects_.end();
++iter) {
+ NPObject* object = NPVARIANT_TO_OBJECT(iter->second);
+ // De-associate from the existing V8 wrapper, so we don't pull any
+ // of the wrapper's custom properties into the context of the page we
+ // have navigated to.
+ blink::WebBindings::dropV8WrapperForObject(object);
// This refs the NPObject. This reference is dropped when either the window
// object is later cleared, or the object is GC'ed. So the object may be
// deleted at any time after OnRemoveNamedObject() is called.
- render_frame()->GetWebFrame()->bindToWindowObject(
- iter->first, NPVARIANT_TO_OBJECT(iter->second));
+ render_frame()->GetWebFrame()->bindToWindowObject(iter->first, object);
}
}
« no previous file with comments | « content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeBasicsTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698