[V8] Pass an Isolate to toV8()
authorharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Jan 2013 08:32:01 +0000 (08:32 +0000)
committerharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Jan 2013 08:32:01 +0000 (08:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=107512

Reviewed by Adam Barth.

By using Context::GetIsolate(), this patch passes an Isolate to toV8().

No tests. No change in behavior.

* bindings/v8/IDBBindingUtilities.cpp:
(WebCore::injectIDBKeyIntoScriptValue):
(WebCore::idbKeyToScriptValue):
* bindings/v8/ScriptController.cpp:
(WebCore::createScriptObject):
(WebCore::ScriptController::createScriptObjectForPluginElement):
* bindings/v8/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::currentCallFrame):
* bindings/v8/ScriptObject.cpp:
(WebCore::ScriptGlobalObject::set):
* bindings/v8/V8AbstractEventListener.cpp:
(WebCore::V8AbstractEventListener::handleEvent):
* bindings/v8/V8DOMWindowShell.cpp:
(WebCore::V8DOMWindowShell::updateDocumentProperty):
* bindings/v8/V8MutationCallback.cpp:
(WebCore::V8MutationCallback::handleEvent):
* bindings/v8/V8NodeFilterCondition.cpp:
(WebCore::V8NodeFilterCondition::acceptNode):
* bindings/v8/V8WorkerContextEventListener.cpp:
(WebCore::V8WorkerContextEventListener::handleEvent):
* bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp:
(WebCore::V8SQLStatementErrorCallback::handleEvent):
* bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
(WebCore::InjectedScriptHost::nodeAsScriptValue):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@140392 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/bindings/v8/IDBBindingUtilities.cpp
Source/WebCore/bindings/v8/ScriptController.cpp
Source/WebCore/bindings/v8/ScriptDebugServer.cpp
Source/WebCore/bindings/v8/ScriptObject.cpp
Source/WebCore/bindings/v8/V8AbstractEventListener.cpp
Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
Source/WebCore/bindings/v8/V8MutationCallback.cpp
Source/WebCore/bindings/v8/V8NodeFilterCondition.cpp
Source/WebCore/bindings/v8/V8WorkerContextEventListener.cpp
Source/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp

index 265887a297fec17cda567213c1af0dffd6f853aa..3c3c3d196db888525185f975542adc274cb5faa0 100644 (file)
@@ -1,3 +1,39 @@
+2013-01-22  Kentaro Hara  <haraken@chromium.org>
+
+        [V8] Pass an Isolate to toV8()
+        https://bugs.webkit.org/show_bug.cgi?id=107512
+
+        Reviewed by Adam Barth.
+
+        By using Context::GetIsolate(), this patch passes an Isolate to toV8().
+
+        No tests. No change in behavior.
+
+        * bindings/v8/IDBBindingUtilities.cpp:
+        (WebCore::injectIDBKeyIntoScriptValue):
+        (WebCore::idbKeyToScriptValue):
+        * bindings/v8/ScriptController.cpp:
+        (WebCore::createScriptObject):
+        (WebCore::ScriptController::createScriptObjectForPluginElement):
+        * bindings/v8/ScriptDebugServer.cpp:
+        (WebCore::ScriptDebugServer::currentCallFrame):
+        * bindings/v8/ScriptObject.cpp:
+        (WebCore::ScriptGlobalObject::set):
+        * bindings/v8/V8AbstractEventListener.cpp:
+        (WebCore::V8AbstractEventListener::handleEvent):
+        * bindings/v8/V8DOMWindowShell.cpp:
+        (WebCore::V8DOMWindowShell::updateDocumentProperty):
+        * bindings/v8/V8MutationCallback.cpp:
+        (WebCore::V8MutationCallback::handleEvent):
+        * bindings/v8/V8NodeFilterCondition.cpp:
+        (WebCore::V8NodeFilterCondition::acceptNode):
+        * bindings/v8/V8WorkerContextEventListener.cpp:
+        (WebCore::V8WorkerContextEventListener::handleEvent):
+        * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp:
+        (WebCore::V8SQLStatementErrorCallback::handleEvent):
+        * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
+        (WebCore::InjectedScriptHost::nodeAsScriptValue):
+
 2013-01-22  Sergey Ryazanov  <serya@chromium.org>
 
         Web Inspector: Show requests in `curl` syntax in DevTools → Network → Headers
index 74747a2ea53883e817e78c502709d69ebe67937d..6137a8b05738c2a4f8fe3089de1ec9eaef477db8 100644 (file)
@@ -28,6 +28,7 @@
 
 #if ENABLE(INDEXED_DATABASE)
 
+#include "DOMRequestState.h"
 #include "IDBKey.h"
 #include "IDBKeyPath.h"
 #include "IDBTracing.h"
@@ -221,7 +222,7 @@ ScriptValue deserializeIDBValue(DOMRequestState* state, PassRefPtr<SerializedScr
     return ScriptValue(v8::Null());
 }
 
-bool injectIDBKeyIntoScriptValue(DOMRequestState*, PassRefPtr<IDBKey> key, ScriptValue& value, const IDBKeyPath& keyPath)
+bool injectIDBKeyIntoScriptValue(DOMRequestState* state, PassRefPtr<IDBKey> key, ScriptValue& value, const IDBKeyPath& keyPath)
 {
     IDB_TRACE("injectIDBKeyIntoScriptValue");
     ASSERT(v8::Context::InContext());
@@ -241,7 +242,7 @@ bool injectIDBKeyIntoScriptValue(DOMRequestState*, PassRefPtr<IDBKey> key, Scrip
     if (parent.IsEmpty())
         return false;
 
-    if (!set(parent, keyPathElements.last(), toV8(key.get(), v8::Handle<v8::Object>())))
+    if (!set(parent, keyPathElements.last(), toV8(key.get(), v8::Handle<v8::Object>(), state->context()->GetIsolate())))
         return false;
 
     return true;
@@ -267,7 +268,7 @@ ScriptValue idbKeyToScriptValue(DOMRequestState* state, PassRefPtr<IDBKey> key)
 {
     ASSERT(v8::Context::InContext());
     v8::HandleScope handleScope;
-    v8::Handle<v8::Value> v8Value(toV8(key.get(), v8::Handle<v8::Object>()));
+    v8::Handle<v8::Value> v8Value(toV8(key.get(), v8::Handle<v8::Object>(), state->context()->GetIsolate()));
     return ScriptValue(v8Value);
 }
 
index 6d06c3a0f69f520c2213e2ca04af64f050e05274..654f2a283bebe015e72ebf8eb060efef97372467 100644 (file)
@@ -616,7 +616,7 @@ static NPObject* createScriptObject(Frame* frame)
 
     v8::Context::Scope scope(v8Context);
     DOMWindow* window = frame->document()->domWindow();
-    v8::Handle<v8::Value> global = toV8(window, v8::Handle<v8::Object>());
+    v8::Handle<v8::Value> global = toV8(window, v8::Handle<v8::Object>(), v8Context->GetIsolate());
     ASSERT(global->IsObject());
     return npCreateV8ScriptObject(0, v8::Handle<v8::Object>::Cast(global), window);
 }
@@ -656,7 +656,7 @@ NPObject* ScriptController::createScriptObjectForPluginElement(HTMLPlugInElement
     v8::Context::Scope scope(v8Context);
 
     DOMWindow* window = m_frame->document()->domWindow();
-    v8::Handle<v8::Value> v8plugin = toV8(static_cast<HTMLEmbedElement*>(plugin), v8::Handle<v8::Object>());
+    v8::Handle<v8::Value> v8plugin = toV8(static_cast<HTMLEmbedElement*>(plugin), v8::Handle<v8::Object>(), v8Context->GetIsolate());
     if (!v8plugin->IsObject())
         return createNoScriptObject();
 
index 3c11689b409187d2634a8f3be2b4d0fece2201c3..7cfc25998c83bb765ced81323a1cc83def0142a1 100644 (file)
@@ -385,7 +385,7 @@ ScriptValue ScriptDebugServer::currentCallFrame()
 
     RefPtr<JavaScriptCallFrame> currentCallFrame = JavaScriptCallFrame::create(v8::Debug::GetDebugContext(), v8::Handle<v8::Object>::Cast(currentCallFrameV8));
     v8::Context::Scope contextScope(m_pausedContext);
-    return ScriptValue(toV8(currentCallFrame.release(), v8::Handle<v8::Object>()));
+    return ScriptValue(toV8(currentCallFrame.release(), v8::Handle<v8::Object>(), m_pausedContext->GetIsolate()));
 }
 
 void ScriptDebugServer::interruptAndRun(PassOwnPtr<Task> task, v8::Isolate* isolate)
index 18493d6743a91aedabc9a36a84909231845f9547..2e3392dbbab8a15f2aa1f4f72820cdaed71d6a8e 100644 (file)
@@ -73,14 +73,14 @@ bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, const S
 bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InspectorFrontendHost* value)
 {
     ScriptScope scope(scriptState);
-    scope.global()->Set(v8::String::NewSymbol(name), toV8(value, v8::Handle<v8::Object>()));
+    scope.global()->Set(v8::String::NewSymbol(name), toV8(value, v8::Handle<v8::Object>(), scriptState->isolate()));
     return scope.success();
 }
 
 bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InjectedScriptHost* value)
 {
     ScriptScope scope(scriptState);
-    scope.global()->Set(v8::String::NewSymbol(name), toV8(value, v8::Handle<v8::Object>()));
+    scope.global()->Set(v8::String::NewSymbol(name), toV8(value, v8::Handle<v8::Object>(), scriptState->isolate()));
     return scope.success();
 }
 #endif
index 818cff8df033abb05225835d8d3494df562ddfb3..56d0e4295eddc093288e17b60324489c20f2bed5 100644 (file)
@@ -96,7 +96,7 @@ void V8AbstractEventListener::handleEvent(ScriptExecutionContext* context, Event
     v8::Context::Scope scope(v8Context);
 
     // Get the V8 wrapper for the event object.
-    v8::Handle<v8::Value> jsEvent = toV8(event, v8::Handle<v8::Object>());
+    v8::Handle<v8::Value> jsEvent = toV8(event, v8::Handle<v8::Object>(), v8Context->GetIsolate());
     ASSERT(!jsEvent.IsEmpty());
 
     invokeEventHandler(context, event, jsEvent);
index 30451c12c0557adfb3ec45dca03126c4ca6040aa..6e14be2600c68996f606d45f0a9b45675e0cf74f 100644 (file)
@@ -354,7 +354,7 @@ void V8DOMWindowShell::updateDocumentProperty()
     // FIXME: Should we use a new Local handle here?
     v8::Context::Scope contextScope(m_context.get());
 
-    v8::Handle<v8::Value> documentWrapper = toV8(m_frame->document(), v8::Handle<v8::Object>());
+    v8::Handle<v8::Value> documentWrapper = toV8(m_frame->document(), v8::Handle<v8::Object>(), m_context.get()->GetIsolate());
     ASSERT(documentWrapper == m_document.get() || m_document.isEmpty());
     if (m_document.isEmpty())
         updateDocumentWrapper(v8::Handle<v8::Object>::Cast(documentWrapper));
index bf283409775c47f1f10869a4913f594fb965506f..9de21168eb029784228e6baac6355dbc42ec2756 100644 (file)
@@ -63,9 +63,9 @@ bool V8MutationCallback::handleEvent(MutationRecordArray* mutations, MutationObs
 
     v8::Local<v8::Array> mutationsArray = v8::Array::New(mutations->size());
     for (size_t i = 0; i < mutations->size(); ++i)
-        mutationsArray->Set(deprecatedV8Integer(i), toV8(mutations->at(i).get(), v8::Handle<v8::Object>()));
+        mutationsArray->Set(deprecatedV8Integer(i), toV8(mutations->at(i).get(), v8::Handle<v8::Object>(), v8Context->GetIsolate()));
 
-    v8::Handle<v8::Value> observerHandle = toV8(observer, v8::Handle<v8::Object>());
+    v8::Handle<v8::Value> observerHandle = toV8(observer, v8::Handle<v8::Object>(), v8Context->GetIsolate());
     if (observerHandle.IsEmpty()) {
         if (!isScriptControllerTerminating())
             CRASH();
index cdf7681bf5b5a903622f0ad749244538af184c10..24e14cddd6022e9bc2db707bb6e95cb2c5c1b5be 100644 (file)
@@ -70,10 +70,10 @@ short V8NodeFilterCondition::acceptNode(ScriptState* state, Node* node) const
         callback = v8::Handle<v8::Function>::Cast(value);
     }
 
-    v8::Handle<v8::Object> object = v8::Context::GetCurrent()->Global();
     OwnArrayPtr<v8::Handle<v8::Value> > args = adoptArrayPtr(new v8::Handle<v8::Value>[1]);
-    args[0] = toV8(node, v8::Handle<v8::Object>());
+    args[0] = toV8(node, v8::Handle<v8::Object>(), state->isolate());
 
+    v8::Handle<v8::Object> object = v8::Context::GetCurrent()->Global();
     v8::Handle<v8::Value> result = ScriptController::callFunctionWithInstrumentation(0, callback, object, 1, args.get());
 
     if (exceptionCatcher.HasCaught()) {
index b54e280e40e641ca1ce9a0ced14b003d0c64583e..29569986757c6c83982a102c7f6b8d60cfb1ab3a 100644 (file)
@@ -75,7 +75,7 @@ void V8WorkerContextEventListener::handleEvent(ScriptExecutionContext* context,
     v8::Context::Scope scope(v8Context);
 
     // Get the V8 wrapper for the event object.
-    v8::Handle<v8::Value> jsEvent = toV8(event, v8::Handle<v8::Object>());
+    v8::Handle<v8::Value> jsEvent = toV8(event, v8::Handle<v8::Object>(), v8Context->GetIsolate());
 
     invokeEventHandler(context, event, jsEvent);
 }
index 2b82522b387d000e2bf8a0433bd376c4e63679ad..aa8ed459b52248e760ac4062f0d62b64d92158eb 100644 (file)
@@ -55,8 +55,8 @@ bool V8SQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, SQLEr
 
     v8::Context::Scope scope(v8Context);
 
-    v8::Handle<v8::Value> transactionHandle = toV8(transaction, v8::Handle<v8::Object>());
-    v8::Handle<v8::Value> errorHandle = toV8(error, v8::Handle<v8::Object>());
+    v8::Handle<v8::Value> transactionHandle = toV8(transaction, v8::Handle<v8::Object>(), v8Context->GetIsolate());
+    v8::Handle<v8::Value> errorHandle = toV8(error, v8::Handle<v8::Object>(), v8Context->GetIsolate());
     if (transactionHandle.IsEmpty() || errorHandle.IsEmpty()) {
         if (!isScriptControllerTerminating())
             CRASH();
index c9e291fc69f455cf385535e0b81d3f8a133f6c4f..1b77f3f47a94d6db01a972344e29c309968a2660 100644 (file)
@@ -76,7 +76,7 @@ ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* state, Node* node
 
     if (!BindingSecurity::shouldAllowAccessToNode(BindingState::instance(), node))
         return ScriptValue(v8::Null());
-    return ScriptValue(toV8(node, v8::Handle<v8::Object>()));
+    return ScriptValue(toV8(node, v8::Handle<v8::Object>(), context->GetIsolate()));
 }
 
 v8::Handle<v8::Value> V8InjectedScriptHost::inspectedObjectCallback(const v8::Arguments& args)