Diff
Modified: trunk/Source/WebCore/ChangeLog (117732 => 117733)
--- trunk/Source/WebCore/ChangeLog 2012-05-21 06:20:01 UTC (rev 117732)
+++ trunk/Source/WebCore/ChangeLog 2012-05-21 06:28:54 UTC (rev 117733)
@@ -1,5 +1,45 @@
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
+
+ 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/V8ArrayBufferCustom.cpp:
+ (WebCore::V8ArrayBuffer::constructorCallback):
+ * bindings/v8/custom/V8ArrayBufferViewCustom.h:
+ (WebCore::constructWebGLArrayWithArrayBufferArgument):
+ (WebCore::constructWebGLArray):
+ * bindings/v8/custom/V8AudioContextCustom.cpp:
+ (WebCore::V8AudioContext::constructorCallback):
+ * bindings/v8/custom/V8BlobCustom.cpp:
+ (WebCore::V8Blob::constructorCallback):
+ * bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp:
+ (WebCore::V8CSSStyleDeclaration::namedPropertySetter):
+ * bindings/v8/custom/V8ClipboardCustom.cpp:
+ (WebCore::V8Clipboard::clearDataCallback):
+ (WebCore::V8Clipboard::setDragImageCallback):
+ * bindings/v8/custom/V8DOMFormDataCustom.cpp:
+ (WebCore::V8DOMFormData::appendCallback):
+ * bindings/v8/custom/V8DOMStringMapCustom.cpp:
+ (WebCore::V8DOMStringMap::namedPropertySetter):
+ * bindings/v8/custom/V8DOMWindowCustom.cpp:
+ (WebCore::handlePostMessageCallback):
+ * bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp:
+ (WebCore::handlePostMessageCallback):
+ * bindings/v8/custom/V8DirectoryEntryCustom.cpp:
+ (WebCore::V8DirectoryEntry::getDirectoryCallback):
+ (WebCore::V8DirectoryEntry::getFileCallback):
+ * bindings/v8/custom/V8DocumentCustom.cpp:
+ (WebCore::V8Document::evaluateCallback):
+
+2012-05-20 Kentaro Hara <[email protected]>
+
[V8] Pass Isolate to V8NPObject::npObjectGetProperty() and V8NPObject::npObjectSetProperty()
https://bugs.webkit.org/show_bug.cgi?id=86979
Modified: trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp (117732 => 117733)
--- trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp 2012-05-21 06:20:01 UTC (rev 117732)
+++ trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
@@ -70,7 +70,7 @@
if (length >= 0)
buffer = ArrayBuffer::create(static_cast<unsigned>(length), 1);
if (!buffer.get())
- return V8Proxy::throwError(V8Proxy::RangeError, "ArrayBuffer size is not a small enough positive integer.");
+ return V8Proxy::throwError(V8Proxy::RangeError, "ArrayBuffer size is not a small enough positive integer.", args.GetIsolate());
// Transform the holder into a wrapper object for the array.
V8DOMWrapper::setDOMWrapper(args.Holder(), &info, buffer.get());
V8DOMWrapper::setJSWrapperForDOMObject(buffer.release(), v8::Persistent<v8::Object>::New(args.Holder()));
Modified: trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h (117732 => 117733)
--- trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h 2012-05-21 06:20:01 UTC (rev 117732)
+++ trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h 2012-05-21 06:28:54 UTC (rev 117733)
@@ -76,7 +76,7 @@
return V8Proxy::throwTypeError("Could not convert argument 2 to a number");
} else {
if ((buf->byteLength() - offset) % sizeof(ElementType))
- return V8Proxy::throwError(V8Proxy::RangeError, "ArrayBuffer length minus the byteOffset is not a multiple of the element size.");
+ return V8Proxy::throwError(V8Proxy::RangeError, "ArrayBuffer length minus the byteOffset is not a multiple of the element size.", args.GetIsolate());
length = (buf->byteLength() - offset) / sizeof(ElementType);
}
RefPtr<ArrayClass> array = ArrayClass::create(buf, offset, length);
@@ -169,7 +169,7 @@
if (doInstantiation)
array = ArrayClass::create(len);
if (!array.get())
- return V8Proxy::throwError(V8Proxy::RangeError, "ArrayBufferView size is not a small enough positive integer.");
+ return V8Proxy::throwError(V8Proxy::RangeError, "ArrayBufferView size is not a small enough positive integer.", args.GetIsolate());
// Transform the holder into a wrapper object for the array.
Modified: trunk/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp (117732 => 117733)
--- trunk/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp 2012-05-21 06:20:01 UTC (rev 117732)
+++ trunk/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
@@ -51,11 +51,11 @@
Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
if (!frame)
- return V8Proxy::throwError(V8Proxy::ReferenceError, "AudioContext constructor associated frame is unavailable");
+ return V8Proxy::throwError(V8Proxy::ReferenceError, "AudioContext constructor associated frame is unavailable", args.GetIsolate());
Document* document = frame->document();
if (!document)
- return V8Proxy::throwError(V8Proxy::ReferenceError, "AudioContext constructor associated document is unavailable");
+ return V8Proxy::throwError(V8Proxy::ReferenceError, "AudioContext constructor associated document is unavailable", args.GetIsolate());
RefPtr<AudioContext> audioContext;
@@ -64,9 +64,9 @@
ExceptionCode ec = 0;
audioContext = AudioContext::create(document, ec);
if (ec)
- return throwError(ec);
+ return throwError(ec, args.GetIsolate());
if (!audioContext.get())
- return V8Proxy::throwError(V8Proxy::SyntaxError, "audio resources unavailable for AudioContext construction");
+ return V8Proxy::throwError(V8Proxy::SyntaxError, "audio resources unavailable for AudioContext construction", args.GetIsolate());
} else {
// Constructor for offline (render-target) AudioContext which renders into an AudioBuffer.
// new AudioContext(in unsigned long numberOfChannels, in unsigned long numberOfFrames, in float sampleRate);
@@ -77,24 +77,24 @@
int32_t numberOfChannels = toInt32(args[0], ok);
if (!ok || numberOfChannels <= 0 || numberOfChannels > 10)
- return V8Proxy::throwError(V8Proxy::SyntaxError, "Invalid number of channels");
+ return V8Proxy::throwError(V8Proxy::SyntaxError, "Invalid number of channels", args.GetIsolate());
int32_t numberOfFrames = toInt32(args[1], ok);
if (!ok || numberOfFrames <= 0)
- return V8Proxy::throwError(V8Proxy::SyntaxError, "Invalid number of frames");
+ return V8Proxy::throwError(V8Proxy::SyntaxError, "Invalid number of frames", args.GetIsolate());
float sampleRate = toFloat(args[2]);
if (sampleRate <= 0)
- return V8Proxy::throwError(V8Proxy::SyntaxError, "Invalid sample rate");
+ return V8Proxy::throwError(V8Proxy::SyntaxError, "Invalid sample rate", args.GetIsolate());
ExceptionCode ec = 0;
audioContext = AudioContext::createOfflineContext(document, numberOfChannels, numberOfFrames, sampleRate, ec);
if (ec)
- return throwError(ec);
+ return throwError(ec, args.GetIsolate());
}
if (!audioContext.get())
- return V8Proxy::throwError(V8Proxy::SyntaxError, "Error creating AudioContext");
+ return V8Proxy::throwError(V8Proxy::SyntaxError, "Error creating AudioContext", args.GetIsolate());
// Transform the holder into a wrapper object for the audio context.
V8DOMWrapper::setDOMWrapper(args.Holder(), &info, audioContext.get());
Modified: trunk/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp (117732 => 117733)
--- trunk/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp 2012-05-21 06:20:01 UTC (rev 117732)
+++ trunk/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
@@ -68,7 +68,7 @@
// Get the script execution context.
ScriptExecutionContext* context = getScriptExecutionContext();
if (!context)
- return V8Proxy::throwError(V8Proxy::ReferenceError, "Blob constructor associated document is unavailable");
+ return V8Proxy::throwError(V8Proxy::ReferenceError, "Blob constructor associated document is unavailable", args.GetIsolate());
if (!args.Length()) {
RefPtr<Blob> blob = Blob::create();
@@ -91,7 +91,7 @@
v8::TryCatch tryCatchEndings;
bool containsEndings = dictionary.get("endings", endings);
if (tryCatchEndings.HasCaught())
- return throwError(tryCatchEndings.Exception());
+ return throwError(tryCatchEndings.Exception(), args.GetIsolate());
if (containsEndings) {
if (endings != "transparent" && endings != "native")
@@ -101,7 +101,7 @@
v8::TryCatch tryCatchType;
dictionary.get("type", type);
if (tryCatchType.HasCaught())
- return throwError(tryCatchType.Exception());
+ return throwError(tryCatchType.Exception(), args.GetIsolate());
}
ASSERT(endings == "transparent" || endings == "native");
Modified: trunk/Source/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp (117732 => 117733)
--- trunk/Source/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp 2012-05-21 06:20:01 UTC (rev 117732)
+++ trunk/Source/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
@@ -238,7 +238,7 @@
imp->setPropertyInternal(static_cast<CSSPropertyID>(propInfo->propID), propertyValue, false, ec);
if (ec)
- throwError(ec);
+ throwError(ec, info.GetIsolate());
return value;
}
Modified: trunk/Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp (117732 => 117733)
--- trunk/Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp 2012-05-21 06:20:01 UTC (rev 117732)
+++ trunk/Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
@@ -73,7 +73,7 @@
}
if (args.Length() != 1)
- return V8Proxy::throwError(V8Proxy::SyntaxError, "clearData: Invalid number of arguments");
+ return V8Proxy::throwError(V8Proxy::SyntaxError, "clearData: Invalid number of arguments", args.GetIsolate());
String type = toWebCoreString(args[0]);
clipboard->clearData(type);
@@ -89,7 +89,7 @@
return v8::Undefined();
if (args.Length() != 3)
- return V8Proxy::throwError(V8Proxy::SyntaxError, "setDragImage: Invalid number of arguments");
+ return V8Proxy::throwError(V8Proxy::SyntaxError, "setDragImage: Invalid number of arguments", args.GetIsolate());
int x = toInt32(args[1]);
int y = toInt32(args[2]);
Modified: trunk/Source/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp (117732 => 117733)
--- trunk/Source/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp 2012-05-21 06:20:01 UTC (rev 117732)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
@@ -65,7 +65,7 @@
INC_STATS("DOM.FormData.append()");
if (args.Length() < 2)
- return V8Proxy::throwError(V8Proxy::SyntaxError, "Not enough arguments");
+ return V8Proxy::throwError(V8Proxy::SyntaxError, "Not enough arguments", args.GetIsolate());
DOMFormData* domFormData = V8DOMFormData::toNative(args.Holder());
Modified: trunk/Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp (117732 => 117733)
--- trunk/Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp 2012-05-21 06:20:01 UTC (rev 117732)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
@@ -80,7 +80,7 @@
ExceptionCode ec = 0;
V8DOMStringMap::toNative(info.Holder())->setItem(toWebCoreString(name), toWebCoreString(value), ec);
if (ec)
- return throwError(ec);
+ return throwError(ec, info.GetIsolate());
return value;
}
Modified: trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp (117732 => 117733)
--- trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp 2012-05-21 06:20:01 UTC (rev 117732)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
@@ -343,7 +343,7 @@
ExceptionCode ec = 0;
window->postMessage(message.release(), &portArray, targetOrigin, source, ec);
- return throwError(ec);
+ return throwError(ec, args.GetIsolate());
}
v8::Handle<v8::Value> V8DOMWindow::postMessageCallback(const v8::Arguments& args)
Modified: trunk/Source/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp (117732 => 117733)
--- trunk/Source/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp 2012-05-21 06:20:01 UTC (rev 117732)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
@@ -63,7 +63,7 @@
return v8::Undefined();
ExceptionCode ec = 0;
workerContext->postMessage(message.release(), &ports, ec);
- return throwError(ec);
+ return throwError(ec, args.GetIsolate());
}
v8::Handle<v8::Value> V8DedicatedWorkerContext::postMessageCallback(const v8::Arguments& args)
Modified: trunk/Source/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp (117732 => 117733)
--- trunk/Source/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp 2012-05-21 06:20:01 UTC (rev 117732)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
@@ -76,13 +76,13 @@
RefPtr<EntryCallback> successCallback;
if (args.Length() > 2 && !args[2]->IsNull() && !args[2]->IsUndefined()) {
if (!args[2]->IsObject())
- return throwError(TYPE_MISMATCH_ERR);
+ return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
successCallback = V8EntryCallback::create(args[2], getScriptExecutionContext());
}
RefPtr<ErrorCallback> errorCallback;
if (args.Length() > 3 && !args[3]->IsNull() && !args[3]->IsUndefined()) {
if (!args[3]->IsObject())
- return throwError(TYPE_MISMATCH_ERR);
+ return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
errorCallback = V8ErrorCallback::create(args[3], getScriptExecutionContext());
}
imp->getDirectory(path, flags, successCallback, errorCallback);
@@ -120,13 +120,13 @@
RefPtr<EntryCallback> successCallback;
if (args.Length() > 2 && !args[2]->IsNull() && !args[2]->IsUndefined()) {
if (!args[2]->IsObject())
- return throwError(TYPE_MISMATCH_ERR);
+ return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
successCallback = V8EntryCallback::create(args[2], getScriptExecutionContext());
}
RefPtr<ErrorCallback> errorCallback;
if (args.Length() > 3 && !args[3]->IsNull() && !args[3]->IsUndefined()) {
if (!args[3]->IsObject())
- return throwError(TYPE_MISMATCH_ERR);
+ return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
errorCallback = V8ErrorCallback::create(args[3], getScriptExecutionContext());
}
imp->getFile(path, flags, successCallback, errorCallback);
Modified: trunk/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp (117732 => 117733)
--- trunk/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp 2012-05-21 06:20:01 UTC (rev 117732)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp 2012-05-21 06:28:54 UTC (rev 117733)
@@ -76,7 +76,7 @@
RefPtr<XPathNSResolver> resolver = V8DOMWrapper::getXPathNSResolver(args[2]);
if (!resolver && !args[2]->IsNull() && !args[2]->IsUndefined())
- return throwError(TYPE_MISMATCH_ERR);
+ return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
int type = toInt32(args[3]);
RefPtr<XPathResult> inResult;
@@ -86,10 +86,10 @@
v8::TryCatch exceptionCatcher;
RefPtr<XPathResult> result = document->evaluate(_expression_, contextNode.get(), resolver.get(), type, inResult.get(), ec);
if (exceptionCatcher.HasCaught())
- return throwError(exceptionCatcher.Exception());
+ return throwError(exceptionCatcher.Exception(), args.GetIsolate());
if (ec)
- return throwError(ec);
+ return throwError(ec, args.GetIsolate());
return toV8(result.release(), args.GetIsolate());
}