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

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

Issue 17053: Ensure that constructor functions are created in the context of the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 12 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
Index: webkit/port/bindings/v8/v8_proxy.cpp
===================================================================
--- webkit/port/bindings/v8/v8_proxy.cpp (revision 7540)
+++ webkit/port/bindings/v8/v8_proxy.cpp (working copy)
@@ -1460,9 +1460,14 @@
// Not in cache.
{
+ // Enter the context of the proxy to make sure that the
+ // function is constructed in the context corresponding to
+ // this proxy.
+ v8::Context::Scope scope(m_context);
v8::Handle<v8::FunctionTemplate> templ = GetTemplate(t);
+ // Getting the function might fail if we're running out of
+ // stack or memory.
v8::TryCatch try_catch;
- // This might fail if we're running out of stack or memory.
v8::Local<v8::Function> value = templ->GetFunction();
if (value.IsEmpty())
return v8::Local<v8::Function>();
@@ -1776,12 +1781,12 @@
break;
case V8ClassIndex::XMLHTTPREQUEST: {
// Reserve one more internal field for keeping event listeners.
- v8::Local<v8::ObjectTemplate> instance_template =
- desc->InstanceTemplate();
- instance_template->SetInternalFieldCount(
- V8Custom::kXMLHttpRequestInternalFieldCount);
- desc->SetCallHandler(USE_CALLBACK(XMLHttpRequestConstructor));
- break;
+ v8::Local<v8::ObjectTemplate> instance_template =
+ desc->InstanceTemplate();
+ instance_template->SetInternalFieldCount(
+ V8Custom::kXMLHttpRequestInternalFieldCount);
+ desc->SetCallHandler(USE_CALLBACK(XMLHttpRequestConstructor));
+ break;
}
case V8ClassIndex::XMLHTTPREQUESTUPLOAD: {
// Reserve one more internal field for keeping event listeners.
« no previous file with comments | « webkit/port/bindings/scripts/CodeGeneratorV8.pm ('k') | webkit/tools/layout_tests/test_lists/tests_fixable.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698