Changeset 117734 in webkit
- Timestamp:
- May 20, 2012 11:30:51 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r117733 r117734 1 2012-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 1 52 2012-05-20 Kentaro Hara <haraken@chromium.org> 2 53 -
trunk/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
r117448 r117734 59 59 Frame* frame = V8Proxy::retrieveFrameForCurrentContext(); 60 60 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()); 62 62 63 63 Document* document = frame->document(); 64 64 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()); 66 66 67 67 // 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 82 82 history->stateObjectAdded(historyState.release(), title, url, History::StateObjectPush, ec); 83 83 args.Holder()->DeleteHiddenValue(V8HiddenPropertyName::state()); 84 return throwError(ec );84 return throwError(ec, args.GetIsolate()); 85 85 } 86 86 … … 107 107 history->stateObjectAdded(historyState.release(), title, url, History::StateObjectReplace, ec); 108 108 args.Holder()->DeleteHiddenValue(V8HiddenPropertyName::state()); 109 return throwError(ec );109 return throwError(ec, args.GetIsolate()); 110 110 } 111 111 -
trunk/Source/WebCore/bindings/v8/custom/V8IntentConstructor.cpp
r117448 r117734 62 62 RefPtr<Intent> impl = Intent::create(ScriptState::current(), options, ec); 63 63 if (ec) 64 return throwError(ec );64 return throwError(ec, args.GetIsolate()); 65 65 66 66 v8::Handle<v8::Object> wrapper = args.Holder(); … … 82 82 RefPtr<SerializedScriptValue> data = SerializedScriptValue::create(args[2], &messagePortArrayTransferList, &arrayBufferArrayTransferList, dataDidThrow); 83 83 if (dataDidThrow) 84 return throwError(DATA_CLONE_ERR );84 return throwError(DATA_CLONE_ERR, args.GetIsolate()); 85 85 86 86 RefPtr<Intent> impl = Intent::create(action, type, data, messagePortArrayTransferList, ec); 87 87 if (ec) 88 return throwError(ec );88 return throwError(ec, args.GetIsolate()); 89 89 90 90 v8::Handle<v8::Object> wrapper = args.Holder(); -
trunk/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp
r115233 r117734 63 63 ExceptionCode ec = 0; 64 64 messagePort->postMessage(message.release(), &portArray, ec); 65 return throwError(ec );65 return throwError(ec, args.GetIsolate()); 66 66 } 67 67 -
trunk/Source/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp
r117448 r117734 58 58 59 59 if (ec) 60 return throwError(ec );60 return throwError(ec, args.GetIsolate()); 61 61 62 62 notification->ref(); … … 73 73 74 74 if (ec) 75 return throwError(ec );75 return throwError(ec, args.GetIsolate()); 76 76 77 77 notification->ref(); … … 87 87 // Make sure that script execution context is valid. 88 88 if (!context) 89 return throwError(INVALID_STATE_ERR );89 return throwError(INVALID_STATE_ERR, args.GetIsolate()); 90 90 91 91 // Requesting permission is only valid from a page context. 92 92 if (context->isWorkerContext()) 93 return throwError(NOT_SUPPORTED_ERR );93 return throwError(NOT_SUPPORTED_ERR, args.GetIsolate()); 94 94 95 95 RefPtr<V8CustomVoidCallback> callback; -
trunk/Source/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
r117579 r117734 45 45 46 46 if (args.Length() == 0) { 47 V8Proxy::throwError(V8Proxy::SyntaxError, "Item index is required." );47 V8Proxy::throwError(V8Proxy::SyntaxError, "Item index is required.", args.GetIsolate()); 48 48 return v8::Undefined(); 49 49 } … … 58 58 unsigned long index = args[0]->IntegerValue(); 59 59 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()); 61 61 return v8::Undefined(); 62 62 } -
trunk/Source/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
r115068 r117734 54 54 55 55 if (args.Length() == 0) 56 return throwError(SYNTAX_ERR );56 return throwError(SYNTAX_ERR, args.GetIsolate()); 57 57 58 58 STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, statement, args[0]); … … 62 62 if (args.Length() > 1 && !isUndefinedOrNull(args[1])) { 63 63 if (!args[1]->IsObject()) 64 return throwError(TYPE_MISMATCH_ERR );64 return throwError(TYPE_MISMATCH_ERR, args.GetIsolate()); 65 65 66 66 uint32_t sqlArgsLength = 0; … … 98 98 if (args.Length() > 2 && !isUndefinedOrNull(args[2])) { 99 99 if (!args[2]->IsObject()) 100 return throwError(TYPE_MISMATCH_ERR );100 return throwError(TYPE_MISMATCH_ERR, args.GetIsolate()); 101 101 callback = V8SQLStatementCallback::create(args[2], scriptExecutionContext); 102 102 } … … 105 105 if (args.Length() > 3 && !isUndefinedOrNull(args[3])) { 106 106 if (!args[3]->IsObject()) 107 return throwError(TYPE_MISMATCH_ERR );107 return throwError(TYPE_MISMATCH_ERR, args.GetIsolate()); 108 108 errorCallback = V8SQLStatementErrorCallback::create(args[3], scriptExecutionContext); 109 109 } -
trunk/Source/WebCore/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp
r115067 r117734 54 54 55 55 if (!args.Length()) 56 return throwError(SYNTAX_ERR );56 return throwError(SYNTAX_ERR, args.GetIsolate()); 57 57 58 58 STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, statement, args[0]); … … 62 62 if (args.Length() > 1 && !isUndefinedOrNull(args[1])) { 63 63 if (!args[1]->IsObject()) 64 return throwError(TYPE_MISMATCH_ERR );64 return throwError(TYPE_MISMATCH_ERR, args.GetIsolate()); 65 65 66 66 uint32_t sqlArgsLength = 0; -
trunk/Source/WebCore/bindings/v8/custom/V8StorageCustom.cpp
r117546 r117734 109 109 storage->setItem(name, value, ec); 110 110 if (ec) 111 return throwError(ec );111 return throwError(ec, info.GetIsolate()); 112 112 113 113 return v8Value; -
trunk/Source/WebCore/bindings/v8/custom/V8WebKitMutationObserverCustom.cpp
r117448 r117734 66 66 v8::Local<v8::Value> arg = args[0]; 67 67 if (!arg->IsObject()) 68 return throwError(TYPE_MISMATCH_ERR );68 return throwError(TYPE_MISMATCH_ERR, args.GetIsolate()); 69 69 70 70 ScriptExecutionContext* context = getScriptExecutionContext(); 71 71 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()); 73 73 74 74 RefPtr<MutationCallback> callback = V8MutationCallback::create(arg, context); … … 89 89 90 90 if (!args[1]->IsObject()) 91 return throwError(TYPE_MISMATCH_ERR );91 return throwError(TYPE_MISMATCH_ERR, args.GetIsolate()); 92 92 93 93 Dictionary optionsObject(args[1]); -
trunk/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp
r117448 r117734 68 68 v8::Handle<v8::String> urlstring = args[0]->ToString(); 69 69 if (tryCatch.HasCaught()) 70 return throwError(tryCatch.Exception() );70 return throwError(tryCatch.Exception(), args.GetIsolate()); 71 71 if (urlstring.IsEmpty()) 72 return V8Proxy::throwError(V8Proxy::SyntaxError, "Empty URL" );72 return V8Proxy::throwError(V8Proxy::SyntaxError, "Empty URL", args.GetIsolate()); 73 73 74 74 // Get the script execution context. 75 75 ScriptExecutionContext* context = getScriptExecutionContext(); 76 76 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()); 78 78 79 79 const KURL& url = context->completeURL(toWebCoreString(urlstring)); … … 93 93 v8::Handle<v8::String> protocol = protocolsArray->Get(v8::Int32::New(i))->ToString(); 94 94 if (tryCatchProtocol.HasCaught()) 95 return throwError(tryCatchProtocol.Exception() );95 return throwError(tryCatchProtocol.Exception(), args.GetIsolate()); 96 96 protocols.append(toWebCoreString(protocol)); 97 97 } … … 101 101 v8::Handle<v8::String> protocol = protocolsValue->ToString(); 102 102 if (tryCatchProtocol.HasCaught()) 103 return throwError(tryCatchProtocol.Exception() );103 return throwError(tryCatchProtocol.Exception(), args.GetIsolate()); 104 104 webSocket->connect(url, toWebCoreString(protocol), ec); 105 105 } 106 106 } 107 107 if (ec) 108 return throwError(ec );108 return throwError(ec, args.GetIsolate()); 109 109 110 110 V8DOMWrapper::setDOMWrapper(args.Holder(), &info, webSocket.get()); … … 136 136 v8::Handle<v8::String> stringMessage = message->ToString(); 137 137 if (tryCatch.HasCaught()) 138 return throwError(tryCatch.Exception() );138 return throwError(tryCatch.Exception(), args.GetIsolate()); 139 139 result = webSocket->send(toWebCoreString(stringMessage), ec); 140 140 } 141 141 if (ec) 142 return throwError(ec );142 return throwError(ec, args.GetIsolate()); 143 143 144 144 return v8Boolean(result); … … 166 166 v8::Handle<v8::String> reasonValue = args[1]->ToString(); 167 167 if (tryCatch.HasCaught()) 168 return throwError(tryCatch.Exception() );168 return throwError(tryCatch.Exception(), args.GetIsolate()); 169 169 reason = toWebCoreString(reasonValue); 170 170 } … … 173 173 webSocket->close(code, reason, ec); 174 174 if (ec) 175 return throwError(ec );175 return throwError(ec, args.GetIsolate()); 176 176 return v8::Undefined(); 177 177 } -
trunk/Source/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
r114907 r117734 108 108 109 109 if (ec) 110 return throwError(ec );110 return throwError(ec, args.GetIsolate()); 111 111 112 112 return v8::Undefined(); -
trunk/Source/WebCore/bindings/v8/custom/V8WorkerCustom.cpp
r115233 r117734 69 69 ExceptionCode ec = 0; 70 70 worker->postMessage(message.release(), &ports, ec); 71 return throwError(ec );71 return throwError(ec, args.GetIsolate()); 72 72 } 73 73 -
trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp
r117448 r117734 58 58 ScriptExecutionContext* context = getScriptExecutionContext(); 59 59 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()); 61 61 62 62 RefPtr<SecurityOrigin> securityOrigin; -
trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
r115670 r117734 57 57 const String& text = xmlHttpRequest->responseText(ec); 58 58 if (ec) 59 return throwError(ec );59 return throwError(ec, info.GetIsolate()); 60 60 return v8String(text); 61 61 } … … 153 153 154 154 if (ec) 155 return throwError(ec );155 return throwError(ec, args.GetIsolate()); 156 156 157 157 return v8::Undefined(); … … 205 205 206 206 if (ec) 207 return throwError(ec );207 return throwError(ec, args.GetIsolate()); 208 208 209 209 return v8::Undefined();
Note: See TracChangeset
for help on using the changeset viewer.