Changeset 117734 in webkit


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

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

Location:
trunk/Source/WebCore
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r117733 r117734  
     12012-05-20  Kentaro Hara  <haraken@chromium.org>
     2
     3        [V8] Pass Isolate to throwError()s in V8 custom bindings (Part 2)
     4        https://bugs.webkit.org/show_bug.cgi?id=86981
     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/V8HTMLImageElementConstructor.cpp:
     14        (WebCore::v8HTMLImageElementConstructorCallback):
     15        * bindings/v8/custom/V8HistoryCustom.cpp:
     16        (WebCore::V8History::pushStateCallback):
     17        (WebCore::V8History::replaceStateCallback):
     18        * bindings/v8/custom/V8IntentConstructor.cpp:
     19        (WebCore::V8Intent::constructorCallback):
     20        * bindings/v8/custom/V8MessagePortCustom.cpp:
     21        (WebCore::handlePostMessageCallback):
     22        * bindings/v8/custom/V8NotificationCenterCustom.cpp:
     23        (WebCore::V8NotificationCenter::createHTMLNotificationCallback):
     24        (WebCore::V8NotificationCenter::createNotificationCallback):
     25        (WebCore::V8NotificationCenter::requestPermissionCallback):
     26        * bindings/v8/custom/V8SQLResultSetRowListCustom.cpp:
     27        (WebCore::V8SQLResultSetRowList::itemCallback):
     28        * bindings/v8/custom/V8SQLTransactionCustom.cpp:
     29        (WebCore::V8SQLTransaction::executeSqlCallback):
     30        * bindings/v8/custom/V8SQLTransactionSyncCustom.cpp:
     31        (WebCore::V8SQLTransactionSync::executeSqlCallback):
     32        * bindings/v8/custom/V8StorageCustom.cpp:
     33        (WebCore::storageSetter):
     34        * bindings/v8/custom/V8WebKitMutationObserverCustom.cpp:
     35        (WebCore::V8WebKitMutationObserver::constructorCallback):
     36        (WebCore::V8WebKitMutationObserver::observeCallback):
     37        * bindings/v8/custom/V8WebSocketCustom.cpp:
     38        (WebCore::V8WebSocket::constructorCallback):
     39        (WebCore::V8WebSocket::sendCallback):
     40        (WebCore::V8WebSocket::closeCallback):
     41        * bindings/v8/custom/V8WorkerContextCustom.cpp:
     42        (WebCore::V8WorkerContext::importScriptsCallback):
     43        * bindings/v8/custom/V8WorkerCustom.cpp:
     44        (WebCore::handlePostMessageCallback):
     45        * bindings/v8/custom/V8XMLHttpRequestConstructor.cpp:
     46        (WebCore::V8XMLHttpRequest::constructorCallback):
     47        * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
     48        (WebCore::V8XMLHttpRequest::responseTextAccessorGetter):
     49        (WebCore::V8XMLHttpRequest::openCallback):
     50        (WebCore::V8XMLHttpRequest::sendCallback):
     51
    1522012-05-20  Kentaro Hara  <haraken@chromium.org>
    253
  • trunk/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp

    r117448 r117734  
    5959    Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
    6060    if (!frame)
    61         return V8Proxy::throwError(V8Proxy::ReferenceError, "Image constructor associated frame is unavailable");
     61        return V8Proxy::throwError(V8Proxy::ReferenceError, "Image constructor associated frame is unavailable", args.GetIsolate());
    6262
    6363    Document* document = frame->document();
    6464    if (!document)
    65         return V8Proxy::throwError(V8Proxy::ReferenceError, "Image constructor associated document is unavailable");
     65        return V8Proxy::throwError(V8Proxy::ReferenceError, "Image constructor associated document is unavailable", args.GetIsolate());
    6666
    6767    // Make sure the document is added to the DOM Node map. Otherwise, the HTMLImageElement instance
  • trunk/Source/WebCore/bindings/v8/custom/V8HistoryCustom.cpp

    r115234 r117734  
    8282    history->stateObjectAdded(historyState.release(), title, url, History::StateObjectPush, ec);
    8383    args.Holder()->DeleteHiddenValue(V8HiddenPropertyName::state());
    84     return throwError(ec);
     84    return throwError(ec, args.GetIsolate());
    8585}
    8686
     
    107107    history->stateObjectAdded(historyState.release(), title, url, History::StateObjectReplace, ec);
    108108    args.Holder()->DeleteHiddenValue(V8HiddenPropertyName::state());
    109     return throwError(ec);
     109    return throwError(ec, args.GetIsolate());
    110110}
    111111
  • trunk/Source/WebCore/bindings/v8/custom/V8IntentConstructor.cpp

    r117448 r117734  
    6262        RefPtr<Intent> impl = Intent::create(ScriptState::current(), options, ec);
    6363        if (ec)
    64             return throwError(ec);
     64            return throwError(ec, args.GetIsolate());
    6565
    6666        v8::Handle<v8::Object> wrapper = args.Holder();
     
    8282    RefPtr<SerializedScriptValue> data = SerializedScriptValue::create(args[2], &messagePortArrayTransferList, &arrayBufferArrayTransferList, dataDidThrow);
    8383    if (dataDidThrow)
    84         return throwError(DATA_CLONE_ERR);
     84        return throwError(DATA_CLONE_ERR, args.GetIsolate());
    8585
    8686    RefPtr<Intent> impl = Intent::create(action, type, data, messagePortArrayTransferList, ec);
    8787    if (ec)
    88         return throwError(ec);
     88        return throwError(ec, args.GetIsolate());
    8989
    9090    v8::Handle<v8::Object> wrapper = args.Holder();
  • trunk/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp

    r115233 r117734  
    6363    ExceptionCode ec = 0;
    6464    messagePort->postMessage(message.release(), &portArray, ec);
    65     return throwError(ec);
     65    return throwError(ec, args.GetIsolate());
    6666}
    6767
  • trunk/Source/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp

    r117448 r117734  
    5858
    5959    if (ec)
    60         return throwError(ec);
     60        return throwError(ec, args.GetIsolate());
    6161
    6262    notification->ref();
     
    7373
    7474    if (ec)
    75         return throwError(ec);
     75        return throwError(ec, args.GetIsolate());
    7676
    7777    notification->ref();
     
    8787    // Make sure that script execution context is valid.
    8888    if (!context)
    89         return throwError(INVALID_STATE_ERR);
     89        return throwError(INVALID_STATE_ERR, args.GetIsolate());
    9090
    9191    // Requesting permission is only valid from a page context.
    9292    if (context->isWorkerContext())
    93         return throwError(NOT_SUPPORTED_ERR);
     93        return throwError(NOT_SUPPORTED_ERR, args.GetIsolate());
    9494
    9595    RefPtr<V8CustomVoidCallback> callback;
  • trunk/Source/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp

    r117579 r117734  
    4545
    4646    if (args.Length() == 0) {
    47         V8Proxy::throwError(V8Proxy::SyntaxError, "Item index is required.");
     47        V8Proxy::throwError(V8Proxy::SyntaxError, "Item index is required.", args.GetIsolate());
    4848        return v8::Undefined();
    4949    }
     
    5858    unsigned long index = args[0]->IntegerValue();
    5959    if (index >= rowList->length()) {
    60         V8Proxy::throwError(V8Proxy::RangeError, "Item index is out of range.");
     60        V8Proxy::throwError(V8Proxy::RangeError, "Item index is out of range.", args.GetIsolate());
    6161        return v8::Undefined();
    6262    }
  • trunk/Source/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp

    r115068 r117734  
    5454
    5555    if (args.Length() == 0)
    56         return throwError(SYNTAX_ERR);
     56        return throwError(SYNTAX_ERR, args.GetIsolate());
    5757
    5858    STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, statement, args[0]);
     
    6262    if (args.Length() > 1 && !isUndefinedOrNull(args[1])) {
    6363        if (!args[1]->IsObject())
    64             return throwError(TYPE_MISMATCH_ERR);
     64            return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
    6565
    6666        uint32_t sqlArgsLength = 0;
     
    9898    if (args.Length() > 2 && !isUndefinedOrNull(args[2])) {
    9999        if (!args[2]->IsObject())
    100             return throwError(TYPE_MISMATCH_ERR);
     100            return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
    101101        callback = V8SQLStatementCallback::create(args[2], scriptExecutionContext);
    102102    }
     
    105105    if (args.Length() > 3 && !isUndefinedOrNull(args[3])) {
    106106        if (!args[3]->IsObject())
    107             return throwError(TYPE_MISMATCH_ERR);
     107            return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
    108108        errorCallback = V8SQLStatementErrorCallback::create(args[3], scriptExecutionContext);
    109109    }
  • trunk/Source/WebCore/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp

    r115067 r117734  
    5454
    5555    if (!args.Length())
    56         return throwError(SYNTAX_ERR);
     56        return throwError(SYNTAX_ERR, args.GetIsolate());
    5757
    5858    STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, statement, args[0]);
     
    6262    if (args.Length() > 1 && !isUndefinedOrNull(args[1])) {
    6363        if (!args[1]->IsObject())
    64             return throwError(TYPE_MISMATCH_ERR);
     64            return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
    6565
    6666        uint32_t sqlArgsLength = 0;
  • trunk/Source/WebCore/bindings/v8/custom/V8StorageCustom.cpp

    r117546 r117734  
    109109    storage->setItem(name, value, ec);
    110110    if (ec)
    111         return throwError(ec);
     111        return throwError(ec, info.GetIsolate());
    112112
    113113    return v8Value;
  • trunk/Source/WebCore/bindings/v8/custom/V8WebKitMutationObserverCustom.cpp

    r117448 r117734  
    6666    v8::Local<v8::Value> arg = args[0];
    6767    if (!arg->IsObject())
    68         return throwError(TYPE_MISMATCH_ERR);
     68        return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
    6969
    7070    ScriptExecutionContext* context = getScriptExecutionContext();
    7171    if (!context)
    72         return V8Proxy::throwError(V8Proxy::ReferenceError, "WebKitMutationObserver constructor's associated frame unavailable");
     72        return V8Proxy::throwError(V8Proxy::ReferenceError, "WebKitMutationObserver constructor's associated frame unavailable", args.GetIsolate());
    7373
    7474    RefPtr<MutationCallback> callback = V8MutationCallback::create(arg, context);
     
    8989
    9090    if (!args[1]->IsObject())
    91         return throwError(TYPE_MISMATCH_ERR);
     91        return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
    9292
    9393    Dictionary optionsObject(args[1]);
  • trunk/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp

    r117448 r117734  
    6868    v8::Handle<v8::String> urlstring = args[0]->ToString();
    6969    if (tryCatch.HasCaught())
    70         return throwError(tryCatch.Exception());
     70        return throwError(tryCatch.Exception(), args.GetIsolate());
    7171    if (urlstring.IsEmpty())
    72         return V8Proxy::throwError(V8Proxy::SyntaxError, "Empty URL");
     72        return V8Proxy::throwError(V8Proxy::SyntaxError, "Empty URL", args.GetIsolate());
    7373
    7474    // Get the script execution context.
    7575    ScriptExecutionContext* context = getScriptExecutionContext();
    7676    if (!context)
    77         return V8Proxy::throwError(V8Proxy::ReferenceError, "WebSocket constructor's associated frame is not available");
     77        return V8Proxy::throwError(V8Proxy::ReferenceError, "WebSocket constructor's associated frame is not available", args.GetIsolate());
    7878
    7979    const KURL& url = context->completeURL(toWebCoreString(urlstring));
     
    9393                v8::Handle<v8::String> protocol = protocolsArray->Get(v8::Int32::New(i))->ToString();
    9494                if (tryCatchProtocol.HasCaught())
    95                     return throwError(tryCatchProtocol.Exception());
     95                    return throwError(tryCatchProtocol.Exception(), args.GetIsolate());
    9696                protocols.append(toWebCoreString(protocol));
    9797            }
     
    101101            v8::Handle<v8::String> protocol = protocolsValue->ToString();
    102102            if (tryCatchProtocol.HasCaught())
    103                 return throwError(tryCatchProtocol.Exception());
     103                return throwError(tryCatchProtocol.Exception(), args.GetIsolate());
    104104            webSocket->connect(url, toWebCoreString(protocol), ec);
    105105        }
    106106    }
    107107    if (ec)
    108         return throwError(ec);
     108        return throwError(ec, args.GetIsolate());
    109109
    110110    V8DOMWrapper::setDOMWrapper(args.Holder(), &info, webSocket.get());
     
    136136        v8::Handle<v8::String> stringMessage = message->ToString();
    137137        if (tryCatch.HasCaught())
    138             return throwError(tryCatch.Exception());
     138            return throwError(tryCatch.Exception(), args.GetIsolate());
    139139        result = webSocket->send(toWebCoreString(stringMessage), ec);
    140140    }
    141141    if (ec)
    142         return throwError(ec);
     142        return throwError(ec, args.GetIsolate());
    143143
    144144    return v8Boolean(result);
     
    166166            v8::Handle<v8::String> reasonValue = args[1]->ToString();
    167167            if (tryCatch.HasCaught())
    168                 return throwError(tryCatch.Exception());
     168                return throwError(tryCatch.Exception(), args.GetIsolate());
    169169            reason = toWebCoreString(reasonValue);
    170170        }
     
    173173    webSocket->close(code, reason, ec);
    174174    if (ec)
    175         return throwError(ec);
     175        return throwError(ec, args.GetIsolate());
    176176    return v8::Undefined();
    177177}
  • trunk/Source/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp

    r114907 r117734  
    108108
    109109    if (ec)
    110         return throwError(ec);
     110        return throwError(ec, args.GetIsolate());
    111111
    112112    return v8::Undefined();
  • trunk/Source/WebCore/bindings/v8/custom/V8WorkerCustom.cpp

    r115233 r117734  
    6969    ExceptionCode ec = 0;
    7070    worker->postMessage(message.release(), &ports, ec);
    71     return throwError(ec);
     71    return throwError(ec, args.GetIsolate());
    7272}
    7373
  • trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp

    r117448 r117734  
    5858    ScriptExecutionContext* context = getScriptExecutionContext();
    5959    if (!context)
    60         return V8Proxy::throwError(V8Proxy::ReferenceError, "XMLHttpRequest constructor's associated context is not available");
     60        return V8Proxy::throwError(V8Proxy::ReferenceError, "XMLHttpRequest constructor's associated context is not available", args.GetIsolate());
    6161
    6262    RefPtr<SecurityOrigin> securityOrigin;
  • trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp

    r115670 r117734  
    5757    const String& text = xmlHttpRequest->responseText(ec);
    5858    if (ec)
    59         return throwError(ec);
     59        return throwError(ec, info.GetIsolate());
    6060    return v8String(text);
    6161}
     
    153153
    154154    if (ec)
    155         return throwError(ec);
     155        return throwError(ec, args.GetIsolate());
    156156
    157157    return v8::Undefined();
     
    205205
    206206    if (ec)
    207         return throwError(ec);
     207        return throwError(ec, args.GetIsolate());
    208208
    209209    return v8::Undefined();
Note: See TracChangeset for help on using the changeset viewer.