Diff
Modified: trunk/Source/WebCore/ChangeLog (117733 => 117734)
--- trunk/Source/WebCore/ChangeLog 2012-05-21 06:28:54 UTC (rev 117733)
+++ trunk/Source/WebCore/ChangeLog 2012-05-21 06:30:51 UTC (rev 117734)
@@ -1,5 +1,56 @@
2012-05-20 Kentaro Hara <[email protected]>
+ [V8] Pass Isolate to throwError()s in V8 custom bindings (Part 2)
+ https://bugs.webkit.org/show_bug.cgi?id=86981
+
+ Reviewed by Adam Barth.
+
+ The objective is to pass Isolate around in V8 bindings.
+ This patch passes Isolate to throwError()s in V8 custom bindings.
+
+ No tests. No change in behavior.
+
+ * bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
+ (WebCore::v8HTMLImageElementConstructorCallback):
+ * bindings/v8/custom/V8HistoryCustom.cpp:
+ (WebCore::V8History::pushStateCallback):
+ (WebCore::V8History::replaceStateCallback):
+ * bindings/v8/custom/V8IntentConstructor.cpp:
+ (WebCore::V8Intent::constructorCallback):
+ * bindings/v8/custom/V8MessagePortCustom.cpp:
+ (WebCore::handlePostMessageCallback):
+ * bindings/v8/custom/V8NotificationCenterCustom.cpp:
+ (WebCore::V8NotificationCenter::createHTMLNotificationCallback):
+ (WebCore::V8NotificationCenter::createNotificationCallback):
+ (WebCore::V8NotificationCenter::requestPermissionCallback):
+ * bindings/v8/custom/V8SQLResultSetRowListCustom.cpp:
+ (WebCore::V8SQLResultSetRowList::itemCallback):
+ * bindings/v8/custom/V8SQLTransactionCustom.cpp:
+ (WebCore::V8SQLTransaction::executeSqlCallback):
+ * bindings/v8/custom/V8SQLTransactionSyncCustom.cpp:
+ (WebCore::V8SQLTransactionSync::executeSqlCallback):
+ * bindings/v8/custom/V8StorageCustom.cpp:
+ (WebCore::storageSetter):
+ * bindings/v8/custom/V8WebKitMutationObserverCustom.cpp:
+ (WebCore::V8WebKitMutationObserver::constructorCallback):
+ (WebCore::V8WebKitMutationObserver::observeCallback):
+ * bindings/v8/custom/V8WebSocketCustom.cpp:
+ (WebCore::V8WebSocket::constructorCallback):
+ (WebCore::V8WebSocket::sendCallback):
+ (WebCore::V8WebSocket::closeCallback):
+ * bindings/v8/custom/V8WorkerContextCustom.cpp:
+ (WebCore::V8WorkerContext::importScriptsCallback):
+ * bindings/v8/custom/V8WorkerCustom.cpp:
+ (WebCore::handlePostMessageCallback):
+ * bindings/v8/custom/V8XMLHttpRequestConstructor.cpp:
+ (WebCore::V8XMLHttpRequest::constructorCallback):
+ * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
+ (WebCore::V8XMLHttpRequest::responseTextAccessorGetter):
+ (WebCore::V8XMLHttpRequest::openCallback):
+ (WebCore::V8XMLHttpRequest::sendCallback):
+
+2012-05-20 Kentaro Hara <[email protected]>
+
[V8] Pass Isolate to throwError()s in V8 custom bindings (Part 1)
https://bugs.webkit.org/show_bug.cgi?id=86980
Modified: trunk/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp (117733 => 117734)
--- trunk/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp 2012-05-21 06:28:54 UTC (rev 117733)
+++ trunk/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp 2012-05-21 06:30:51 UTC (rev 117734)
@@ -58,11 +58,11 @@
Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
if (!frame)
- return V8Proxy::throwError(V8Proxy::ReferenceError, "Image constructor associated frame is unavailable");
+ return V8Proxy::throwError(V8Proxy::ReferenceError, "Image constructor associated frame is unavailable", args.GetIsolate());
Document* document = frame->document();
if (!document)
- return V8Proxy::throwError(V8Proxy::ReferenceError, "Image constructor associated document is unavailable");
+ return V8Proxy::throwError(V8Proxy::ReferenceError, "Image constructor associated document is unavailable", args.GetIsolate());
// Make sure the document is added to the DOM Node map. Otherwise, the HTMLImageElement instance
// may end up being the only node in the map and get garbage-ccollected prematurely.
Modified: trunk/Source/WebCore/bindings/v8/custom/V8HistoryCustom.cpp (117733 => 117734)
--- trunk/Source/WebCore/bindings/v8/custom/V8HistoryCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
+++ trunk/Source/WebCore/bindings/v8/custom/V8HistoryCustom.cpp 2012-05-21 06:30:51 UTC (rev 117734)
@@ -81,7 +81,7 @@
History* history = V8History::toNative(args.Holder());
history->stateObjectAdded(historyState.release(), title, url, History::StateObjectPush, ec);
args.Holder()->DeleteHiddenValue(V8HiddenPropertyName::state());
- return throwError(ec);
+ return throwError(ec, args.GetIsolate());
}
v8::Handle<v8::Value> V8History::replaceStateCallback(const v8::Arguments& args)
@@ -106,7 +106,7 @@
History* history = V8History::toNative(args.Holder());
history->stateObjectAdded(historyState.release(), title, url, History::StateObjectReplace, ec);
args.Holder()->DeleteHiddenValue(V8HiddenPropertyName::state());
- return throwError(ec);
+ return throwError(ec, args.GetIsolate());
}
bool V8History::indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::AccessType type, v8::Local<v8::Value>)
Modified: trunk/Source/WebCore/bindings/v8/custom/V8IntentConstructor.cpp (117733 => 117734)
--- trunk/Source/WebCore/bindings/v8/custom/V8IntentConstructor.cpp 2012-05-21 06:28:54 UTC (rev 117733)
+++ trunk/Source/WebCore/bindings/v8/custom/V8IntentConstructor.cpp 2012-05-21 06:30:51 UTC (rev 117734)
@@ -61,7 +61,7 @@
ExceptionCode ec = 0;
RefPtr<Intent> impl = Intent::create(ScriptState::current(), options, ec);
if (ec)
- return throwError(ec);
+ return throwError(ec, args.GetIsolate());
v8::Handle<v8::Object> wrapper = args.Holder();
V8DOMWrapper::setDOMWrapper(wrapper, &info, impl.get());
@@ -81,11 +81,11 @@
bool dataDidThrow = false;
RefPtr<SerializedScriptValue> data = "" &messagePortArrayTransferList, &arrayBufferArrayTransferList, dataDidThrow);
if (dataDidThrow)
- return throwError(DATA_CLONE_ERR);
+ return throwError(DATA_CLONE_ERR, args.GetIsolate());
RefPtr<Intent> impl = Intent::create(action, type, data, messagePortArrayTransferList, ec);
if (ec)
- return throwError(ec);
+ return throwError(ec, args.GetIsolate());
v8::Handle<v8::Object> wrapper = args.Holder();
V8DOMWrapper::setDOMWrapper(wrapper, &info, impl.get());
Modified: trunk/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp (117733 => 117734)
--- trunk/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
+++ trunk/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp 2012-05-21 06:30:51 UTC (rev 117734)
@@ -62,7 +62,7 @@
return v8::Undefined();
ExceptionCode ec = 0;
messagePort->postMessage(message.release(), &portArray, ec);
- return throwError(ec);
+ return throwError(ec, args.GetIsolate());
}
v8::Handle<v8::Value> V8MessagePort::postMessageCallback(const v8::Arguments& args)
Modified: trunk/Source/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp (117733 => 117734)
--- trunk/Source/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
+++ trunk/Source/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp 2012-05-21 06:30:51 UTC (rev 117734)
@@ -57,7 +57,7 @@
RefPtr<Notification> notification = notificationCenter->createHTMLNotification(url, ec);
if (ec)
- return throwError(ec);
+ return throwError(ec, args.GetIsolate());
notification->ref();
return toV8(notification.get(), args.GetIsolate());
@@ -72,7 +72,7 @@
RefPtr<Notification> notification = notificationCenter->createNotification(toWebCoreString(args[0]), toWebCoreString(args[1]), toWebCoreString(args[2]), ec);
if (ec)
- return throwError(ec);
+ return throwError(ec, args.GetIsolate());
notification->ref();
return toV8(notification.get(), args.GetIsolate());
@@ -86,11 +86,11 @@
// Make sure that script execution context is valid.
if (!context)
- return throwError(INVALID_STATE_ERR);
+ return throwError(INVALID_STATE_ERR, args.GetIsolate());
// Requesting permission is only valid from a page context.
if (context->isWorkerContext())
- return throwError(NOT_SUPPORTED_ERR);
+ return throwError(NOT_SUPPORTED_ERR, args.GetIsolate());
RefPtr<V8CustomVoidCallback> callback;
if (args.Length() > 0) {
Modified: trunk/Source/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp (117733 => 117734)
--- trunk/Source/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
+++ trunk/Source/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp 2012-05-21 06:30:51 UTC (rev 117734)
@@ -44,7 +44,7 @@
INC_STATS("DOM.SQLResultSetRowList.item()");
if (args.Length() == 0) {
- V8Proxy::throwError(V8Proxy::SyntaxError, "Item index is required.");
+ V8Proxy::throwError(V8Proxy::SyntaxError, "Item index is required.", args.GetIsolate());
return v8::Undefined();
}
@@ -57,7 +57,7 @@
unsigned long index = args[0]->IntegerValue();
if (index >= rowList->length()) {
- V8Proxy::throwError(V8Proxy::RangeError, "Item index is out of range.");
+ V8Proxy::throwError(V8Proxy::RangeError, "Item index is out of range.", args.GetIsolate());
return v8::Undefined();
}
Modified: trunk/Source/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp (117733 => 117734)
--- trunk/Source/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
+++ trunk/Source/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp 2012-05-21 06:30:51 UTC (rev 117734)
@@ -53,7 +53,7 @@
INC_STATS("DOM.SQLTransaction.executeSql()");
if (args.Length() == 0)
- return throwError(SYNTAX_ERR);
+ return throwError(SYNTAX_ERR, args.GetIsolate());
STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, statement, args[0]);
@@ -61,7 +61,7 @@
if (args.Length() > 1 && !isUndefinedOrNull(args[1])) {
if (!args[1]->IsObject())
- return throwError(TYPE_MISMATCH_ERR);
+ return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
uint32_t sqlArgsLength = 0;
v8::Local<v8::Object> sqlArgsObject = args[1]->ToObject();
@@ -97,14 +97,14 @@
RefPtr<SQLStatementCallback> callback;
if (args.Length() > 2 && !isUndefinedOrNull(args[2])) {
if (!args[2]->IsObject())
- return throwError(TYPE_MISMATCH_ERR);
+ return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
callback = V8SQLStatementCallback::create(args[2], scriptExecutionContext);
}
RefPtr<SQLStatementErrorCallback> errorCallback;
if (args.Length() > 3 && !isUndefinedOrNull(args[3])) {
if (!args[3]->IsObject())
- return throwError(TYPE_MISMATCH_ERR);
+ return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
errorCallback = V8SQLStatementErrorCallback::create(args[3], scriptExecutionContext);
}
Modified: trunk/Source/WebCore/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp (117733 => 117734)
--- trunk/Source/WebCore/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
+++ trunk/Source/WebCore/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp 2012-05-21 06:30:51 UTC (rev 117734)
@@ -53,7 +53,7 @@
INC_STATS("DOM.SQLTransactionSync.executeSql()");
if (!args.Length())
- return throwError(SYNTAX_ERR);
+ return throwError(SYNTAX_ERR, args.GetIsolate());
STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, statement, args[0]);
@@ -61,7 +61,7 @@
if (args.Length() > 1 && !isUndefinedOrNull(args[1])) {
if (!args[1]->IsObject())
- return throwError(TYPE_MISMATCH_ERR);
+ return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
uint32_t sqlArgsLength = 0;
v8::Local<v8::Object> sqlArgsObject = args[1]->ToObject();
Modified: trunk/Source/WebCore/bindings/v8/custom/V8StorageCustom.cpp (117733 => 117734)
--- trunk/Source/WebCore/bindings/v8/custom/V8StorageCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
+++ trunk/Source/WebCore/bindings/v8/custom/V8StorageCustom.cpp 2012-05-21 06:30:51 UTC (rev 117734)
@@ -108,7 +108,7 @@
ExceptionCode ec = 0;
storage->setItem(name, value, ec);
if (ec)
- return throwError(ec);
+ return throwError(ec, info.GetIsolate());
return v8Value;
}
Modified: trunk/Source/WebCore/bindings/v8/custom/V8WebKitMutationObserverCustom.cpp (117733 => 117734)
--- trunk/Source/WebCore/bindings/v8/custom/V8WebKitMutationObserverCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
+++ trunk/Source/WebCore/bindings/v8/custom/V8WebKitMutationObserverCustom.cpp 2012-05-21 06:30:51 UTC (rev 117734)
@@ -65,11 +65,11 @@
v8::Local<v8::Value> arg = args[0];
if (!arg->IsObject())
- return throwError(TYPE_MISMATCH_ERR);
+ return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
ScriptExecutionContext* context = getScriptExecutionContext();
if (!context)
- return V8Proxy::throwError(V8Proxy::ReferenceError, "WebKitMutationObserver constructor's associated frame unavailable");
+ return V8Proxy::throwError(V8Proxy::ReferenceError, "WebKitMutationObserver constructor's associated frame unavailable", args.GetIsolate());
RefPtr<MutationCallback> callback = V8MutationCallback::create(arg, context);
RefPtr<WebKitMutationObserver> observer = WebKitMutationObserver::create(callback.release());
@@ -88,7 +88,7 @@
EXCEPTION_BLOCK(Node*, target, V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0);
if (!args[1]->IsObject())
- return throwError(TYPE_MISMATCH_ERR);
+ return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
Dictionary optionsObject(args[1]);
unsigned options = 0;
Modified: trunk/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp (117733 => 117734)
--- trunk/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
+++ trunk/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp 2012-05-21 06:30:51 UTC (rev 117734)
@@ -67,14 +67,14 @@
v8::TryCatch tryCatch;
v8::Handle<v8::String> urlstring = args[0]->ToString();
if (tryCatch.HasCaught())
- return throwError(tryCatch.Exception());
+ return throwError(tryCatch.Exception(), args.GetIsolate());
if (urlstring.IsEmpty())
- return V8Proxy::throwError(V8Proxy::SyntaxError, "Empty URL");
+ return V8Proxy::throwError(V8Proxy::SyntaxError, "Empty URL", args.GetIsolate());
// Get the script execution context.
ScriptExecutionContext* context = getScriptExecutionContext();
if (!context)
- return V8Proxy::throwError(V8Proxy::ReferenceError, "WebSocket constructor's associated frame is not available");
+ return V8Proxy::throwError(V8Proxy::ReferenceError, "WebSocket constructor's associated frame is not available", args.GetIsolate());
const KURL& url = ""
@@ -92,7 +92,7 @@
v8::TryCatch tryCatchProtocol;
v8::Handle<v8::String> protocol = protocolsArray->Get(v8::Int32::New(i))->ToString();
if (tryCatchProtocol.HasCaught())
- return throwError(tryCatchProtocol.Exception());
+ return throwError(tryCatchProtocol.Exception(), args.GetIsolate());
protocols.append(toWebCoreString(protocol));
}
webSocket->connect(url, protocols, ec);
@@ -100,12 +100,12 @@
v8::TryCatch tryCatchProtocol;
v8::Handle<v8::String> protocol = protocolsValue->ToString();
if (tryCatchProtocol.HasCaught())
- return throwError(tryCatchProtocol.Exception());
+ return throwError(tryCatchProtocol.Exception(), args.GetIsolate());
webSocket->connect(url, toWebCoreString(protocol), ec);
}
}
if (ec)
- return throwError(ec);
+ return throwError(ec, args.GetIsolate());
V8DOMWrapper::setDOMWrapper(args.Holder(), &info, webSocket.get());
V8DOMWrapper::setJSWrapperForActiveDOMObject(webSocket.release(), v8::Persistent<v8::Object>::New(args.Holder()));
@@ -135,11 +135,11 @@
v8::TryCatch tryCatch;
v8::Handle<v8::String> stringMessage = message->ToString();
if (tryCatch.HasCaught())
- return throwError(tryCatch.Exception());
+ return throwError(tryCatch.Exception(), args.GetIsolate());
result = webSocket->send(toWebCoreString(stringMessage), ec);
}
if (ec)
- return throwError(ec);
+ return throwError(ec, args.GetIsolate());
return v8Boolean(result);
}
@@ -165,14 +165,14 @@
v8::TryCatch tryCatch;
v8::Handle<v8::String> reasonValue = args[1]->ToString();
if (tryCatch.HasCaught())
- return throwError(tryCatch.Exception());
+ return throwError(tryCatch.Exception(), args.GetIsolate());
reason = toWebCoreString(reasonValue);
}
}
ExceptionCode ec = 0;
webSocket->close(code, reason, ec);
if (ec)
- return throwError(ec);
+ return throwError(ec, args.GetIsolate());
return v8::Undefined();
}
Modified: trunk/Source/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp (117733 => 117734)
--- trunk/Source/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
+++ trunk/Source/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp 2012-05-21 06:30:51 UTC (rev 117734)
@@ -107,7 +107,7 @@
workerContext->importScripts(urls, ec);
if (ec)
- return throwError(ec);
+ return throwError(ec, args.GetIsolate());
return v8::Undefined();
}
Modified: trunk/Source/WebCore/bindings/v8/custom/V8WorkerCustom.cpp (117733 => 117734)
--- trunk/Source/WebCore/bindings/v8/custom/V8WorkerCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
+++ trunk/Source/WebCore/bindings/v8/custom/V8WorkerCustom.cpp 2012-05-21 06:30:51 UTC (rev 117734)
@@ -68,7 +68,7 @@
return v8::Undefined();
ExceptionCode ec = 0;
worker->postMessage(message.release(), &ports, ec);
- return throwError(ec);
+ return throwError(ec, args.GetIsolate());
}
v8::Handle<v8::Value> V8Worker::postMessageCallback(const v8::Arguments& args)
Modified: trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp (117733 => 117734)
--- trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp 2012-05-21 06:28:54 UTC (rev 117733)
+++ trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp 2012-05-21 06:30:51 UTC (rev 117734)
@@ -57,7 +57,7 @@
// Allocate a XMLHttpRequest object as its internal field.
ScriptExecutionContext* context = getScriptExecutionContext();
if (!context)
- return V8Proxy::throwError(V8Proxy::ReferenceError, "XMLHttpRequest constructor's associated context is not available");
+ return V8Proxy::throwError(V8Proxy::ReferenceError, "XMLHttpRequest constructor's associated context is not available", args.GetIsolate());
RefPtr<SecurityOrigin> securityOrigin;
if (V8IsolatedContext* isolatedContext = V8IsolatedContext::getEntered())
Modified: trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp (117733 => 117734)
--- trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
+++ trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp 2012-05-21 06:30:51 UTC (rev 117734)
@@ -56,7 +56,7 @@
ExceptionCode ec = 0;
const String& text = xmlHttpRequest->responseText(ec);
if (ec)
- return throwError(ec);
+ return throwError(ec, info.GetIsolate());
return v8String(text);
}
@@ -152,7 +152,7 @@
xmlHttpRequest->open(method, url, ec);
if (ec)
- return throwError(ec);
+ return throwError(ec, args.GetIsolate());
return v8::Undefined();
}
@@ -204,7 +204,7 @@
}
if (ec)
- return throwError(ec);
+ return throwError(ec, args.GetIsolate());
return v8::Undefined();
}