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

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

Issue 6442: Let's try this again. The regressions were caused by an incorrect use... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 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.cpp ('k') | no next file » | 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 2825)
+++ webkit/port/bindings/v8/v8_proxy.cpp (working copy)
@@ -2390,10 +2390,28 @@
type = V8ClassIndex::NODE;
}
+ // Find the context to which the node belongs and create the wrapper
+ // in that context. If the node is not in a document, the current
+ // context is used.
+ v8::Local<v8::Context> context;
+ Document* doc = node->document();
+ if (doc) {
+ context = V8Proxy::GetContext(doc->frame());
+ }
+ if (!context.IsEmpty()) {
+ context->Enter();
+ }
+
// Set the peer object for future access.
// InstantiateV8Object automatically casts node to Peerable*.
v8::Local<v8::Object> result =
InstantiateV8Object(type, V8ClassIndex::NODE, node);
+
+ // Exit the node's context if it was entered.
+ if (!context.IsEmpty()) {
+ context->Exit();
+ }
+
if (result.IsEmpty()) {
// If instantiation failed it's important not to add the result
// to the DOM node map. Instead we return an empty handle, which
« no previous file with comments | « webkit/port/bindings/v8/v8_custom.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698