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

Unified Diff: webkit/port/bindings/v8/v8_proxy.cpp

Issue 53092: Fix window.history GC issue. Since the history object is not part of... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | « webkit/port/bindings/v8/v8_custom.h ('k') | webkit/tools/layout_tests/test_expectations.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/port/bindings/v8/v8_proxy.cpp
===================================================================
--- webkit/port/bindings/v8/v8_proxy.cpp (revision 12540)
+++ webkit/port/bindings/v8/v8_proxy.cpp (working copy)
@@ -1823,7 +1823,8 @@
desc->SetHiddenPrototype(true);
- // Reserve spaces for references to location and navigator objects.
+ // Reserve spaces for references to location, history and
+ // navigator objects.
v8::Local<v8::ObjectTemplate> instance_template =
desc->InstanceTemplate();
instance_template->SetInternalFieldCount(
@@ -2653,17 +2654,27 @@
else
SetJSWrapperForDOMObject(imp, result);
- // Special case for Location and Navigator. Both Safari and FF let
- // Location and Navigator JS wrappers survive GC. To mimic their
- // behaviors, V8 creates hidden references from the DOMWindow to
- // location and navigator objects. These references get cleared
- // when the DOMWindow is reused by a new page.
- if (type == V8ClassIndex::LOCATION) {
- SetHiddenWindowReference(static_cast<Location*>(imp)->frame(),
- V8Custom::kDOMWindowLocationIndex, result);
- } else if (type == V8ClassIndex::NAVIGATOR) {
- SetHiddenWindowReference(static_cast<Navigator*>(imp)->frame(),
- V8Custom::kDOMWindowNavigatorIndex, result);
+ // Special case for non-node objects History, Location and
+ // Navigator. Both Safari and FF let Location and Navigator JS
+ // wrappers survive GC. To mimic their behaviors, V8 creates
+ // hidden references from the DOMWindow to these wrapper
+ // objects. These references get cleared when the DOMWindow is
+ // reused by a new page.
+ switch (type) {
+ case V8ClassIndex::HISTORY:
+ SetHiddenWindowReference(static_cast<History*>(imp)->frame(),
+ V8Custom::kDOMWindowHistoryIndex, result);
+ break;
+ case V8ClassIndex::NAVIGATOR:
+ SetHiddenWindowReference(static_cast<Navigator*>(imp)->frame(),
+ V8Custom::kDOMWindowNavigatorIndex, result);
+ break;
+ case V8ClassIndex::LOCATION:
+ SetHiddenWindowReference(static_cast<Location*>(imp)->frame(),
+ V8Custom::kDOMWindowLocationIndex, result);
+ break;
+ default:
+ break;
}
}
}
« no previous file with comments | « webkit/port/bindings/v8/v8_custom.h ('k') | webkit/tools/layout_tests/test_expectations.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698