Changeset 117733 in webkit


Ignore:
Timestamp:
May 20, 2012 11:28:54 PM (12 years ago)
Author:
haraken@chromium.org
Message:

[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):

Location:
trunk/Source/WebCore
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r117732 r117733  
     12012-05-20  Kentaro Hara  <haraken@chromium.org>
     2
     3        [V8] Pass Isolate to throwError()s in V8 custom bindings (Part 1)
     4        https://bugs.webkit.org/show_bug.cgi?id=86980
     5
     6        Reviewed by Adam Barth.
     7
     8        The objective is to pass Isolate around in V8 bindings.
     9        This patch passes Isolate to throwError()s in V8 custom bindings.
     10
     11        No tests. No change in behavior.
     12
     13        * bindings/v8/custom/V8ArrayBufferCustom.cpp:
     14        (WebCore::V8ArrayBuffer::constructorCallback):
     15        * bindings/v8/custom/V8ArrayBufferViewCustom.h:
     16        (WebCore::constructWebGLArrayWithArrayBufferArgument):
     17        (WebCore::constructWebGLArray):
     18        * bindings/v8/custom/V8AudioContextCustom.cpp:
     19        (WebCore::V8AudioContext::constructorCallback):
     20        * bindings/v8/custom/V8BlobCustom.cpp:
     21        (WebCore::V8Blob::constructorCallback):
     22        * bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp:
     23        (WebCore::V8CSSStyleDeclaration::namedPropertySetter):
     24        * bindings/v8/custom/V8ClipboardCustom.cpp:
     25        (WebCore::V8Clipboard::clearDataCallback):
     26        (WebCore::V8Clipboard::setDragImageCallback):
     27        * bindings/v8/custom/V8DOMFormDataCustom.cpp:
     28        (WebCore::V8DOMFormData::appendCallback):
     29        * bindings/v8/custom/V8DOMStringMapCustom.cpp:
     30        (WebCore::V8DOMStringMap::namedPropertySetter):
     31        * bindings/v8/custom/V8DOMWindowCustom.cpp:
     32        (WebCore::handlePostMessageCallback):
     33        * bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp:
     34        (WebCore::handlePostMessageCallback):
     35        * bindings/v8/custom/V8DirectoryEntryCustom.cpp:
     36        (WebCore::V8DirectoryEntry::getDirectoryCallback):
     37        (WebCore::V8DirectoryEntry::getFileCallback):
     38        * bindings/v8/custom/V8DocumentCustom.cpp:
     39        (WebCore::V8Document::evaluateCallback):
     40
    1412012-05-20  Kentaro Hara  <haraken@chromium.org>
    242
  • trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp

    r117579 r117733  
    7171        buffer = ArrayBuffer::create(static_cast<unsigned>(length), 1);
    7272    if (!buffer.get())
    73         return V8Proxy::throwError(V8Proxy::RangeError, "ArrayBuffer size is not a small enough positive integer.");
     73        return V8Proxy::throwError(V8Proxy::RangeError, "ArrayBuffer size is not a small enough positive integer.", args.GetIsolate());
    7474    // Transform the holder into a wrapper object for the array.
    7575    V8DOMWrapper::setDOMWrapper(args.Holder(), &info, buffer.get());
  • trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h

    r117579 r117733  
    7777    } else {
    7878        if ((buf->byteLength() - offset) % sizeof(ElementType))
    79             return V8Proxy::throwError(V8Proxy::RangeError, "ArrayBuffer length minus the byteOffset is not a multiple of the element size.");
     79            return V8Proxy::throwError(V8Proxy::RangeError, "ArrayBuffer length minus the byteOffset is not a multiple of the element size.", args.GetIsolate());
    8080        length = (buf->byteLength() - offset) / sizeof(ElementType);
    8181    }
     
    170170        array = ArrayClass::create(len);
    171171    if (!array.get())
    172         return V8Proxy::throwError(V8Proxy::RangeError, "ArrayBufferView size is not a small enough positive integer.");
     172        return V8Proxy::throwError(V8Proxy::RangeError, "ArrayBufferView size is not a small enough positive integer.", args.GetIsolate());
    173173
    174174
  • trunk/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp

    r117448 r117733  
    5252    Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
    5353    if (!frame)
    54         return V8Proxy::throwError(V8Proxy::ReferenceError, "AudioContext constructor associated frame is unavailable");
     54        return V8Proxy::throwError(V8Proxy::ReferenceError, "AudioContext constructor associated frame is unavailable", args.GetIsolate());
    5555
    5656    Document* document = frame->document();
    5757    if (!document)
    58         return V8Proxy::throwError(V8Proxy::ReferenceError, "AudioContext constructor associated document is unavailable");
     58        return V8Proxy::throwError(V8Proxy::ReferenceError, "AudioContext constructor associated document is unavailable", args.GetIsolate());
    5959
    6060    RefPtr<AudioContext> audioContext;
     
    6565        audioContext = AudioContext::create(document, ec);
    6666        if (ec)
    67             return throwError(ec);
     67            return throwError(ec, args.GetIsolate());
    6868        if (!audioContext.get())
    69             return V8Proxy::throwError(V8Proxy::SyntaxError, "audio resources unavailable for AudioContext construction");
     69            return V8Proxy::throwError(V8Proxy::SyntaxError, "audio resources unavailable for AudioContext construction", args.GetIsolate());
    7070    } else {
    7171        // Constructor for offline (render-target) AudioContext which renders into an AudioBuffer.
     
    7878        int32_t numberOfChannels = toInt32(args[0], ok);
    7979        if (!ok || numberOfChannels <= 0 || numberOfChannels > 10)
    80             return V8Proxy::throwError(V8Proxy::SyntaxError, "Invalid number of channels");
     80            return V8Proxy::throwError(V8Proxy::SyntaxError, "Invalid number of channels", args.GetIsolate());
    8181
    8282        int32_t numberOfFrames = toInt32(args[1], ok);
    8383        if (!ok || numberOfFrames <= 0)
    84             return V8Proxy::throwError(V8Proxy::SyntaxError, "Invalid number of frames");
     84            return V8Proxy::throwError(V8Proxy::SyntaxError, "Invalid number of frames", args.GetIsolate());
    8585
    8686        float sampleRate = toFloat(args[2]);
    8787        if (sampleRate <= 0)
    88             return V8Proxy::throwError(V8Proxy::SyntaxError, "Invalid sample rate");
     88            return V8Proxy::throwError(V8Proxy::SyntaxError, "Invalid sample rate", args.GetIsolate());
    8989
    9090        ExceptionCode ec = 0;
    9191        audioContext = AudioContext::createOfflineContext(document, numberOfChannels, numberOfFrames, sampleRate, ec);
    9292        if (ec)
    93             return throwError(ec);
     93            return throwError(ec, args.GetIsolate());
    9494    }
    9595
    9696    if (!audioContext.get())
    97         return V8Proxy::throwError(V8Proxy::SyntaxError, "Error creating AudioContext");
     97        return V8Proxy::throwError(V8Proxy::SyntaxError, "Error creating AudioContext", args.GetIsolate());
    9898   
    9999    // Transform the holder into a wrapper object for the audio context.
  • trunk/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp

    r117448 r117733  
    6969    ScriptExecutionContext* context = getScriptExecutionContext();
    7070    if (!context)
    71         return V8Proxy::throwError(V8Proxy::ReferenceError, "Blob constructor associated document is unavailable");
     71        return V8Proxy::throwError(V8Proxy::ReferenceError, "Blob constructor associated document is unavailable", args.GetIsolate());
    7272
    7373    if (!args.Length()) {
     
    9292        bool containsEndings = dictionary.get("endings", endings);
    9393        if (tryCatchEndings.HasCaught())
    94             return throwError(tryCatchEndings.Exception());
     94            return throwError(tryCatchEndings.Exception(), args.GetIsolate());
    9595
    9696        if (containsEndings) {
     
    102102        dictionary.get("type", type);
    103103        if (tryCatchType.HasCaught())
    104             return throwError(tryCatchType.Exception());
     104            return throwError(tryCatchType.Exception(), args.GetIsolate());
    105105    }
    106106
  • trunk/Source/WebCore/bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp

    r113795 r117733  
    239239
    240240    if (ec)
    241         throwError(ec);
     241        throwError(ec, info.GetIsolate());
    242242
    243243    return value;
  • trunk/Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp

    r117536 r117733  
    7474
    7575    if (args.Length() != 1)
    76         return V8Proxy::throwError(V8Proxy::SyntaxError, "clearData: Invalid number of arguments");
     76        return V8Proxy::throwError(V8Proxy::SyntaxError, "clearData: Invalid number of arguments", args.GetIsolate());
    7777
    7878    String type = toWebCoreString(args[0]);
     
    9090
    9191    if (args.Length() != 3)
    92         return V8Proxy::throwError(V8Proxy::SyntaxError, "setDragImage: Invalid number of arguments");
     92        return V8Proxy::throwError(V8Proxy::SyntaxError, "setDragImage: Invalid number of arguments", args.GetIsolate());
    9393
    9494    int x = toInt32(args[1]);
  • trunk/Source/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp

    r117448 r117733  
    6666   
    6767    if (args.Length() < 2)
    68         return V8Proxy::throwError(V8Proxy::SyntaxError, "Not enough arguments");
     68        return V8Proxy::throwError(V8Proxy::SyntaxError, "Not enough arguments", args.GetIsolate());
    6969
    7070    DOMFormData* domFormData = V8DOMFormData::toNative(args.Holder());
  • trunk/Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp

    r115366 r117733  
    8181    V8DOMStringMap::toNative(info.Holder())->setItem(toWebCoreString(name), toWebCoreString(value), ec);
    8282    if (ec)
    83         return throwError(ec);
     83        return throwError(ec, info.GetIsolate());
    8484    return value;
    8585}
  • trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp

    r115233 r117733  
    344344    ExceptionCode ec = 0;
    345345    window->postMessage(message.release(), &portArray, targetOrigin, source, ec);
    346     return throwError(ec);
     346    return throwError(ec, args.GetIsolate());
    347347}
    348348
  • trunk/Source/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp

    r115233 r117733  
    6464    ExceptionCode ec = 0;
    6565    workerContext->postMessage(message.release(), &ports, ec);
    66     return throwError(ec);
     66    return throwError(ec, args.GetIsolate());
    6767}
    6868
  • trunk/Source/WebCore/bindings/v8/custom/V8DirectoryEntryCustom.cpp

    r115522 r117733  
    7777    if (args.Length() > 2 && !args[2]->IsNull() && !args[2]->IsUndefined()) {
    7878        if (!args[2]->IsObject())
    79             return throwError(TYPE_MISMATCH_ERR);
     79            return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
    8080        successCallback = V8EntryCallback::create(args[2], getScriptExecutionContext());
    8181    }
     
    8383    if (args.Length() > 3 && !args[3]->IsNull() && !args[3]->IsUndefined()) {
    8484        if (!args[3]->IsObject())
    85             return throwError(TYPE_MISMATCH_ERR);
     85            return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
    8686        errorCallback = V8ErrorCallback::create(args[3], getScriptExecutionContext());
    8787    }
     
    121121    if (args.Length() > 2 && !args[2]->IsNull() && !args[2]->IsUndefined()) {
    122122        if (!args[2]->IsObject())
    123             return throwError(TYPE_MISMATCH_ERR);
     123            return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
    124124        successCallback = V8EntryCallback::create(args[2], getScriptExecutionContext());
    125125    }
     
    127127    if (args.Length() > 3 && !args[3]->IsNull() && !args[3]->IsUndefined()) {
    128128        if (!args[3]->IsObject())
    129             return throwError(TYPE_MISMATCH_ERR);
     129            return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
    130130        errorCallback = V8ErrorCallback::create(args[3], getScriptExecutionContext());
    131131    }
  • trunk/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp

    r114925 r117733  
    7777    RefPtr<XPathNSResolver> resolver = V8DOMWrapper::getXPathNSResolver(args[2]);
    7878    if (!resolver && !args[2]->IsNull() && !args[2]->IsUndefined())
    79         return throwError(TYPE_MISMATCH_ERR);
     79        return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
    8080
    8181    int type = toInt32(args[3]);
     
    8787    RefPtr<XPathResult> result = document->evaluate(expression, contextNode.get(), resolver.get(), type, inResult.get(), ec);
    8888    if (exceptionCatcher.HasCaught())
    89         return throwError(exceptionCatcher.Exception());
     89        return throwError(exceptionCatcher.Exception(), args.GetIsolate());
    9090
    9191    if (ec)
    92         return throwError(ec);
     92        return throwError(ec, args.GetIsolate());
    9393
    9494    return toV8(result.release(), args.GetIsolate());
Note: See TracChangeset for help on using the changeset viewer.