[V8] Pass Isolate to setDOMException() (Part2)
authorharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Apr 2012 16:14:54 +0000 (16:14 +0000)
committerharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Apr 2012 16:14:54 +0000 (16:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=84658

Reviewed by Nate Chapin.

The objective is to pass Isolate around in V8 bindings.
This patch passes Isolate to setDOMException() in custom
binding code.

No tests. No change in behavior.

* bindings/v8/V8Collection.cpp:
(WebCore::toOptionsCollectionSetter):
* bindings/v8/V8Collection.h:
(WebCore):
* bindings/v8/custom/V8ArrayBufferViewCustom.h:
(WebCore::constructWebGLArrayWithArrayBufferArgument):
(WebCore::setWebGLArrayHelper):
* bindings/v8/custom/V8DOMWindowCustom.cpp:
(WebCore::WindowSetTimeoutImpl):
* bindings/v8/custom/V8DataViewCustom.cpp:
(WebCore::V8DataView::getInt8Callback):
(WebCore::V8DataView::getUint8Callback):
(WebCore::V8DataView::setInt8Callback):
(WebCore::V8DataView::setUint8Callback):
* bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp:
(WebCore::V8DirectoryEntrySync::getDirectoryCallback):
(WebCore::V8DirectoryEntrySync::getFileCallback):
* bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
(WebCore::V8HTMLCanvasElement::toDataURLCallback):
* bindings/v8/custom/V8HTMLElementCustom.cpp:
(WebCore::V8HTMLElement::itemValueAccessorSetter):
* bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
(WebCore::V8HTMLOptionsCollection::addCallback):
(WebCore::V8HTMLOptionsCollection::lengthAccessorSetter):
(WebCore::V8HTMLOptionsCollection::indexedPropertySetter):
* bindings/v8/custom/V8HTMLSelectElementCustom.cpp:
(WebCore::V8HTMLSelectElement::indexedPropertySetter):
* bindings/v8/custom/V8NodeCustom.cpp:
(WebCore::V8Node::insertBeforeCallback):
(WebCore::V8Node::replaceChildCallback):
(WebCore::V8Node::removeChildCallback):
(WebCore::V8Node::appendChildCallback):
* bindings/v8/custom/V8SQLTransactionCustom.cpp:
(WebCore::V8SQLTransaction::executeSqlCallback):
* bindings/v8/custom/V8WebKitMutationObserverCustom.cpp:
(WebCore::V8WebKitMutationObserver::observeCallback):
* bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
(WebCore::V8XMLHttpRequest::responseAccessorGetter):

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

15 files changed:
Source/WebCore/ChangeLog
Source/WebCore/bindings/v8/V8Collection.cpp
Source/WebCore/bindings/v8/V8Collection.h
Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h
Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp
Source/WebCore/bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp
Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
Source/WebCore/bindings/v8/custom/V8HTMLElementCustom.cpp
Source/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
Source/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp
Source/WebCore/bindings/v8/custom/V8NodeCustom.cpp
Source/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
Source/WebCore/bindings/v8/custom/V8WebKitMutationObserverCustom.cpp
Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp

index 4807bf2..29112ff 100644 (file)
@@ -1,5 +1,57 @@
 2012-04-24  Kentaro Hara  <haraken@chromium.org>
 
+        [V8] Pass Isolate to setDOMException() (Part2)
+        https://bugs.webkit.org/show_bug.cgi?id=84658
+
+        Reviewed by Nate Chapin.
+
+        The objective is to pass Isolate around in V8 bindings.
+        This patch passes Isolate to setDOMException() in custom
+        binding code.
+
+        No tests. No change in behavior.
+
+        * bindings/v8/V8Collection.cpp:
+        (WebCore::toOptionsCollectionSetter):
+        * bindings/v8/V8Collection.h:
+        (WebCore):
+        * bindings/v8/custom/V8ArrayBufferViewCustom.h:
+        (WebCore::constructWebGLArrayWithArrayBufferArgument):
+        (WebCore::setWebGLArrayHelper):
+        * bindings/v8/custom/V8DOMWindowCustom.cpp:
+        (WebCore::WindowSetTimeoutImpl):
+        * bindings/v8/custom/V8DataViewCustom.cpp:
+        (WebCore::V8DataView::getInt8Callback):
+        (WebCore::V8DataView::getUint8Callback):
+        (WebCore::V8DataView::setInt8Callback):
+        (WebCore::V8DataView::setUint8Callback):
+        * bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp:
+        (WebCore::V8DirectoryEntrySync::getDirectoryCallback):
+        (WebCore::V8DirectoryEntrySync::getFileCallback):
+        * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
+        (WebCore::V8HTMLCanvasElement::toDataURLCallback):
+        * bindings/v8/custom/V8HTMLElementCustom.cpp:
+        (WebCore::V8HTMLElement::itemValueAccessorSetter):
+        * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
+        (WebCore::V8HTMLOptionsCollection::addCallback):
+        (WebCore::V8HTMLOptionsCollection::lengthAccessorSetter):
+        (WebCore::V8HTMLOptionsCollection::indexedPropertySetter):
+        * bindings/v8/custom/V8HTMLSelectElementCustom.cpp:
+        (WebCore::V8HTMLSelectElement::indexedPropertySetter):
+        * bindings/v8/custom/V8NodeCustom.cpp:
+        (WebCore::V8Node::insertBeforeCallback):
+        (WebCore::V8Node::replaceChildCallback):
+        (WebCore::V8Node::removeChildCallback):
+        (WebCore::V8Node::appendChildCallback):
+        * bindings/v8/custom/V8SQLTransactionCustom.cpp:
+        (WebCore::V8SQLTransaction::executeSqlCallback):
+        * bindings/v8/custom/V8WebKitMutationObserverCustom.cpp:
+        (WebCore::V8WebKitMutationObserver::observeCallback):
+        * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
+        (WebCore::V8XMLHttpRequest::responseAccessorGetter):
+
+2012-04-24  Kentaro Hara  <haraken@chromium.org>
+
         [V8] Pass Isolate to setDOMException() (Part1)
         https://bugs.webkit.org/show_bug.cgi?id=84656
 
index 2ff5c88..8dcbcc1 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace WebCore {
 
-v8::Handle<v8::Value> toOptionsCollectionSetter(uint32_t index, v8::Handle<v8::Value> value, HTMLSelectElement* base)
+v8::Handle<v8::Value> toOptionsCollectionSetter(uint32_t index, v8::Handle<v8::Value> value, HTMLSelectElement* base, v8::Isolate* isolate)
 {
     if (value->IsNull() || value->IsUndefined()) {
         base->remove(index);
@@ -48,14 +48,14 @@ v8::Handle<v8::Value> toOptionsCollectionSetter(uint32_t index, v8::Handle<v8::V
 
     // Check that the value is an HTMLOptionElement.  If not, throw a TYPE_MISMATCH_ERR DOMException.
     if (!V8HTMLOptionElement::HasInstance(value)) {
-        V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
+        V8Proxy::setDOMException(TYPE_MISMATCH_ERR, isolate);
         return value;
     }
 
     HTMLOptionElement* element = V8HTMLOptionElement::toNative(v8::Handle<v8::Object>::Cast(value));
     base->setOption(index, element, ec);
 
-    V8Proxy::setDOMException(ec);
+    V8Proxy::setDOMException(ec, isolate);
     return value;
 }
 
index 30de60e..136204d 100644 (file)
@@ -176,7 +176,7 @@ template<class Collection> static void setCollectionStringIndexedGetter(v8::Hand
     desc->InstanceTemplate()->SetIndexedPropertyHandler(collectionStringIndexedPropertyGetter<Collection>, 0, 0, 0, collectionIndexedPropertyEnumerator<Collection>);
 }
 
-v8::Handle<v8::Value> toOptionsCollectionSetter(uint32_t index, v8::Handle<v8::Value>, HTMLSelectElement*);
+v8::Handle<v8::Value> toOptionsCollectionSetter(uint32_t index, v8::Handle<v8::Value>, HTMLSelectElement*, v8::Isolate*);
 
 } // namespace WebCore
 
index efedd3b..a0fc5ae 100644 (file)
@@ -81,7 +81,7 @@ v8::Handle<v8::Value> constructWebGLArrayWithArrayBufferArgument(const v8::Argum
     }
     RefPtr<ArrayClass> array = ArrayClass::create(buf, offset, length);
     if (!array) {
-        V8Proxy::setDOMException(INDEX_SIZE_ERR);
+        V8Proxy::setDOMException(INDEX_SIZE_ERR, args.GetIsolate());
         return notHandledByInterceptor();
     }
     // Transform the holder into a wrapper object for the array.
@@ -189,7 +189,7 @@ template <class CPlusPlusArrayType, class JavaScriptWrapperArrayType>
 v8::Handle<v8::Value> setWebGLArrayHelper(const v8::Arguments& args)
 {
     if (args.Length() < 1) {
-        V8Proxy::setDOMException(SYNTAX_ERR);
+        V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
         return notHandledByInterceptor();
     }
 
@@ -202,7 +202,7 @@ v8::Handle<v8::Value> setWebGLArrayHelper(const v8::Arguments& args)
         if (args.Length() == 2)
             offset = toUInt32(args[1]);
         if (!impl->set(src, offset))
-            V8Proxy::setDOMException(INDEX_SIZE_ERR);
+            V8Proxy::setDOMException(INDEX_SIZE_ERR, args.GetIsolate());
         return v8::Undefined();
     }
 
@@ -217,7 +217,7 @@ v8::Handle<v8::Value> setWebGLArrayHelper(const v8::Arguments& args)
             || offset + length > impl->length()
             || offset + length < offset)
             // Out of range offset or overflow
-            V8Proxy::setDOMException(INDEX_SIZE_ERR);
+            V8Proxy::setDOMException(INDEX_SIZE_ERR, args.GetIsolate());
         else {
             if (!fastSetInstalled(args.Holder())) {
                 installFastSet(args.Holder());
@@ -230,7 +230,7 @@ v8::Handle<v8::Value> setWebGLArrayHelper(const v8::Arguments& args)
         return v8::Undefined();
     }
 
-    V8Proxy::setDOMException(SYNTAX_ERR);
+    V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
     return notHandledByInterceptor();
 }
 
index 32e589d..bf083b5 100644 (file)
@@ -78,7 +78,7 @@ v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments& args, bool singl
     ScriptExecutionContext* scriptContext = static_cast<ScriptExecutionContext*>(imp->document());
 
     if (!scriptContext) {
-        V8Proxy::setDOMException(INVALID_ACCESS_ERR);
+        V8Proxy::setDOMException(INVALID_ACCESS_ERR, args.GetIsolate());
         return v8::Undefined();
     }
 
index 026f924..417c49e 100755 (executable)
@@ -75,7 +75,7 @@ v8::Handle<v8::Value> V8DataView::getInt8Callback(const v8::Arguments& args)
     EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));
     int8_t result = imp->getInt8(byteOffset, ec);
     if (UNLIKELY(ec)) {
-        V8Proxy::setDOMException(ec);
+        V8Proxy::setDOMException(ec, args.GetIsolate());
         return v8::Handle<v8::Value>();
     }
     return v8::Integer::New(result);
@@ -92,7 +92,7 @@ v8::Handle<v8::Value> V8DataView::getUint8Callback(const v8::Arguments& args)
     EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));
     uint8_t result = imp->getUint8(byteOffset, ec);
     if (UNLIKELY(ec)) {
-        V8Proxy::setDOMException(ec);
+        V8Proxy::setDOMException(ec, args.GetIsolate());
         return v8::Handle<v8::Value>();
     }
     return v8::Integer::New(result);
@@ -110,7 +110,7 @@ v8::Handle<v8::Value> V8DataView::setInt8Callback(const v8::Arguments& args)
     EXCEPTION_BLOCK(int, value, toInt32(args[1]));
     imp->setInt8(byteOffset, static_cast<int8_t>(value), ec);
     if (UNLIKELY(ec))
-        V8Proxy::setDOMException(ec);
+        V8Proxy::setDOMException(ec, args.GetIsolate());
     return v8::Handle<v8::Value>();
 }
 
@@ -126,7 +126,7 @@ v8::Handle<v8::Value> V8DataView::setUint8Callback(const v8::Arguments& args)
     EXCEPTION_BLOCK(int, value, toInt32(args[1]));
     imp->setUint8(byteOffset, static_cast<uint8_t>(value), ec);
     if (UNLIKELY(ec))
-        V8Proxy::setDOMException(ec);
+        V8Proxy::setDOMException(ec, args.GetIsolate());
     return v8::Handle<v8::Value>();
 }
 
index a6dcd76..5135bce 100644 (file)
@@ -99,12 +99,12 @@ v8::Handle<v8::Value> V8DirectoryEntrySync::getDirectoryCallback(const v8::Argum
     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, path, args[0]);
     RefPtr<WebKitFlags> flags = getFlags(args[1], ec);
     if (UNLIKELY(ec)) {
-        V8Proxy::setDOMException(ec);
+        V8Proxy::setDOMException(ec, args.GetIsolate());
         return v8::Handle<v8::Value>();
     }
     RefPtr<DirectoryEntrySync> result = imp->getDirectory(path, flags, ec);
     if (UNLIKELY(ec)) {
-        V8Proxy::setDOMException(ec);
+        V8Proxy::setDOMException(ec, args.GetIsolate());
         return v8::Handle<v8::Value>();
     }
     return toV8(result.release(), args.GetIsolate());
@@ -118,12 +118,12 @@ v8::Handle<v8::Value> V8DirectoryEntrySync::getFileCallback(const v8::Arguments&
     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, path, args[0]);
     RefPtr<WebKitFlags> flags = getFlags(args[1], ec);
     if (UNLIKELY(ec)) {
-        V8Proxy::setDOMException(ec);
+        V8Proxy::setDOMException(ec, args.GetIsolate());
         return v8::Handle<v8::Value>();
     }
     RefPtr<FileEntrySync> result = imp->getFile(path, flags, ec);
     if (UNLIKELY(ec)) {
-        V8Proxy::setDOMException(ec);
+        V8Proxy::setDOMException(ec, args.GetIsolate());
         return v8::Handle<v8::Value>();
     }
     return toV8(result.release(), args.GetIsolate());
index 9980af3..01c54db 100644 (file)
@@ -110,7 +110,7 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::toDataURLCallback(const v8::Arguments
     }
 
     String result = canvas->toDataURL(type, qualityPtr, ec);
-    V8Proxy::setDOMException(ec);
+    V8Proxy::setDOMException(ec, args.GetIsolate());
     return v8StringOrUndefined(result);
 }
 
index 93df30e..dea17ec 100644 (file)
@@ -73,7 +73,7 @@ void V8HTMLElement::itemValueAccessorSetter(v8::Local<v8::String> name, v8::Loca
     ExceptionCode ec = 0;
     impl->setItemValue(toWebCoreString(value), ec);
     if (ec)
-        V8Proxy::setDOMException(ec);
+        V8Proxy::setDOMException(ec, info.GetIsolate());
 }
 #endif
 
index 903a9f7..d595d0e 100644 (file)
@@ -56,7 +56,7 @@ v8::Handle<v8::Value> V8HTMLOptionsCollection::addCallback(const v8::Arguments&
 {
     INC_STATS("DOM.HTMLOptionsCollection.add()");
     if (!V8HTMLOptionElement::HasInstance(args[0])) {
-        V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
+        V8Proxy::setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
         return v8::Undefined();
     }
     HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(args.Holder());
@@ -80,7 +80,7 @@ v8::Handle<v8::Value> V8HTMLOptionsCollection::addCallback(const v8::Arguments&
     }
 
     if (ec != 0)
-        V8Proxy::setDOMException(ec);
+        V8Proxy::setDOMException(ec, args.GetIsolate());
 
     return v8::Undefined();
 }
@@ -111,7 +111,7 @@ void V8HTMLOptionsCollection::lengthAccessorSetter(v8::Local<v8::String> name, v
     if (!ec)
         imp->setLength(newLength, ec);
 
-    V8Proxy::setDOMException(ec);
+    V8Proxy::setDOMException(ec, info.GetIsolate());
 }
 
 v8::Handle<v8::Value> V8HTMLOptionsCollection::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
@@ -131,7 +131,7 @@ v8::Handle<v8::Value> V8HTMLOptionsCollection::indexedPropertySetter(uint32_t in
     INC_STATS("DOM.HTMLOptionsCollection.IndexedPropertySetter");
     HTMLOptionsCollection* collection = V8HTMLOptionsCollection::toNative(info.Holder());
     HTMLSelectElement* base = static_cast<HTMLSelectElement*>(collection->base());
-    return toOptionsCollectionSetter(index, value, base);
+    return toOptionsCollectionSetter(index, value, base, info.GetIsolate());
 }
 
 } // namespace WebCore
index 5f8e135..e1d5914 100644 (file)
@@ -60,7 +60,7 @@ v8::Handle<v8::Value> V8HTMLSelectElement::indexedPropertySetter(uint32_t index,
 {
     INC_STATS("DOM.HTMLSelectElement.IndexedPropertySetter");
     HTMLSelectElement* select = V8HTMLSelectElement::toNative(info.Holder());
-    return toOptionsCollectionSetter(index, value, select);
+    return toOptionsCollectionSetter(index, value, select, info.GetIsolate());
 }
 
 v8::Handle<v8::Value> V8HTMLSelectElement::removeCallback(const v8::Arguments& args)
index f9232df..71e471a 100644 (file)
@@ -74,7 +74,7 @@ v8::Handle<v8::Value> V8Node::insertBeforeCallback(const v8::Arguments& args)
     Node* refChild = V8Node::HasInstance(args[1]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;
     bool success = imp->insertBefore(newChild, refChild, ec, true);
     if (ec) {
-        V8Proxy::setDOMException(ec);
+        V8Proxy::setDOMException(ec, args.GetIsolate());
         return v8::Handle<v8::Value>();
     }
     if (success)
@@ -93,7 +93,7 @@ v8::Handle<v8::Value> V8Node::replaceChildCallback(const v8::Arguments& args)
     Node* oldChild = V8Node::HasInstance(args[1]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;
     bool success = imp->replaceChild(newChild, oldChild, ec, true);
     if (ec) {
-        V8Proxy::setDOMException(ec);
+        V8Proxy::setDOMException(ec, args.GetIsolate());
         return v8::Handle<v8::Value>();
     }
     if (success)
@@ -110,7 +110,7 @@ v8::Handle<v8::Value> V8Node::removeChildCallback(const v8::Arguments& args)
     Node* oldChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     bool success = imp->removeChild(oldChild, ec);
     if (ec) {
-        V8Proxy::setDOMException(ec);
+        V8Proxy::setDOMException(ec, args.GetIsolate());
         return v8::Handle<v8::Value>();
     }
     if (success)
@@ -128,7 +128,7 @@ v8::Handle<v8::Value> V8Node::appendChildCallback(const v8::Arguments& args)
     Node* newChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     bool success = imp->appendChild(newChild, ec, true );
     if (ec) {
-        V8Proxy::setDOMException(ec);
+        V8Proxy::setDOMException(ec, args.GetIsolate());
         return v8::Handle<v8::Value>();
     }
     if (success)
index b07c68f..f8520f0 100644 (file)
@@ -110,7 +110,7 @@ v8::Handle<v8::Value> V8SQLTransaction::executeSqlCallback(const v8::Arguments&
 
     ExceptionCode ec = 0;
     transaction->executeSQL(statement, sqlValues, callback, errorCallback, ec);
-    V8Proxy::setDOMException(ec);
+    V8Proxy::setDOMException(ec, args.GetIsolate());
 
     return v8::Undefined();
 }
index 53f3442..5385007 100644 (file)
@@ -112,7 +112,7 @@ v8::Handle<v8::Value> V8WebKitMutationObserver::observeCallback(const v8::Argume
     ExceptionCode ec = 0;
     imp->observe(target, options, attributeFilter, ec);
     if (ec)
-        V8Proxy::setDOMException(ec);
+        V8Proxy::setDOMException(ec, args.GetIsolate());
     return v8::Handle<v8::Value>();
 }
 
index 82c74cd..2eb1b53 100644 (file)
@@ -75,7 +75,7 @@ v8::Handle<v8::Value> V8XMLHttpRequest::responseAccessorGetter(v8::Local<v8::Str
             ExceptionCode ec = 0;
             Document* document = xmlHttpRequest->responseXML(ec);
             if (ec) {
-                V8Proxy::setDOMException(ec);
+                V8Proxy::setDOMException(ec, info.GetIsolate());
                 return v8::Undefined();
             }
             return toV8(document, info.GetIsolate());
@@ -87,7 +87,7 @@ v8::Handle<v8::Value> V8XMLHttpRequest::responseAccessorGetter(v8::Local<v8::Str
             ExceptionCode ec = 0;
             Blob* blob = xmlHttpRequest->responseBlob(ec);
             if (ec) {
-                V8Proxy::setDOMException(ec);
+                V8Proxy::setDOMException(ec, info.GetIsolate());
                 return v8::Undefined();
             }
             return toV8(blob, info.GetIsolate());
@@ -101,7 +101,7 @@ v8::Handle<v8::Value> V8XMLHttpRequest::responseAccessorGetter(v8::Local<v8::Str
             ExceptionCode ec = 0;
             ArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer(ec);
             if (ec) {
-                V8Proxy::setDOMException(ec);
+                V8Proxy::setDOMException(ec, info.GetIsolate());
                 return v8::Undefined();
             }
             return toV8(arrayBuffer, info.GetIsolate());