Changeset 117448 in webkit
- Timestamp:
- May 17, 2012 8:17:20 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r117447 r117448 1 2012-05-17 Kentaro Hara <haraken@chromium.org> 2 3 [V8][Refactoring] Support an optional 'message' argument for throwTypeError() 4 https://bugs.webkit.org/show_bug.cgi?id=86576 5 6 Reviewed by Adam Barth. 7 8 As commented in https://bugs.webkit.org/show_bug.cgi?id=84074#c5, 9 I am planning to refactor a series of confusing throwError()s into 10 throwError() and throwTypeError(). 11 12 This patch supports an optional 'message' argument for V8Proxy::throwTypeError(). 13 Also this patch replaces throwError("message", V8Proxy::TypeError) in custom bindings 14 with V8Proxy::throwTypeError("message"). 15 16 No tests. No change in behavior. 17 18 * bindings/v8/V8Proxy.cpp: 19 (WebCore::V8Proxy::throwTypeError): 20 * bindings/v8/V8Proxy.h: 21 (V8Proxy): 22 * bindings/v8/custom/V8ArrayBufferViewCustom.h: 23 (WebCore::constructWebGLArray): 24 * bindings/v8/custom/V8AudioContextCustom.cpp: 25 (WebCore::V8AudioContext::constructorCallback): 26 * bindings/v8/custom/V8BlobCustom.cpp: 27 (WebCore::V8Blob::constructorCallback): 28 * bindings/v8/custom/V8DOMFormDataCustom.cpp: 29 (WebCore::V8DOMFormData::constructorCallback): 30 * bindings/v8/custom/V8DataViewCustom.cpp: 31 (WebCore::V8DataView::constructorCallback): 32 * bindings/v8/custom/V8HTMLImageElementConstructor.cpp: 33 (WebCore::v8HTMLImageElementConstructorCallback): 34 * bindings/v8/custom/V8IntentConstructor.cpp: 35 (WebCore::V8Intent::constructorCallback): 36 * bindings/v8/custom/V8MessageChannelConstructor.cpp: 37 (WebCore::V8MessageChannel::constructorCallback): 38 * bindings/v8/custom/V8NotificationCenterCustom.cpp: 39 (WebCore::V8NotificationCenter::requestPermissionCallback): 40 * bindings/v8/custom/V8WebKitMutationObserverCustom.cpp: 41 (WebCore::V8WebKitMutationObserver::constructorCallback): 42 * bindings/v8/custom/V8WebKitPointConstructor.cpp: 43 (WebCore::V8WebKitPoint::constructorCallback): 44 * bindings/v8/custom/V8WebSocketCustom.cpp: 45 (WebCore::V8WebSocket::constructorCallback): 46 * bindings/v8/custom/V8XMLHttpRequestConstructor.cpp: 47 (WebCore::V8XMLHttpRequest::constructorCallback): 48 1 49 2012-05-16 Andrey Kosyakov <caseq@chromium.org> 2 50 -
trunk/Source/WebCore/bindings/v8/V8Proxy.cpp
r117383 r117448 610 610 } 611 611 612 v8::Handle<v8::Value> V8Proxy::throwTypeError( )613 { 614 return throwError(TypeError, "Type error");612 v8::Handle<v8::Value> V8Proxy::throwTypeError(const char* message) 613 { 614 return throwError(TypeError, (message ? message : "Type error")); 615 615 } 616 616 -
trunk/Source/WebCore/bindings/v8/V8Proxy.h
r116744 r117448 240 240 241 241 // Helpers for throwing syntax and type errors with predefined messages. 242 static v8::Handle<v8::Value> throwTypeError( );242 static v8::Handle<v8::Value> throwTypeError(const char* = 0); 243 243 static v8::Handle<v8::Value> throwNotEnoughArgumentsError(); 244 244 -
trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h
r117383 r117448 100 100 { 101 101 if (!args.IsConstructCall()) 102 return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);102 return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function."); 103 103 104 104 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) -
trunk/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp
r117383 r117448 45 45 46 46 if (!args.IsConstructCall()) 47 return throwError("AudioContext constructor cannot be called as a function.", V8Proxy::TypeError);47 return V8Proxy::throwTypeError("AudioContext constructor cannot be called as a function."); 48 48 49 49 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) -
trunk/Source/WebCore/bindings/v8/custom/V8BlobCustom.cpp
r117383 r117448 61 61 62 62 if (!args.IsConstructCall()) 63 return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);63 return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function."); 64 64 65 65 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) … … 78 78 v8::Local<v8::Value> firstArg = args[0]; 79 79 if (!firstArg->IsArray()) 80 return throwError("First argument of the constructor is not of type Array", V8Proxy::TypeError);80 return V8Proxy::throwTypeError("First argument of the constructor is not of type Array"); 81 81 82 82 String type; … … 85 85 if (args.Length() > 1) { 86 86 if (!args[1]->IsObject()) 87 return throwError("Second argument of the constructor is not of type Object", V8Proxy::TypeError);87 return V8Proxy::throwTypeError("Second argument of the constructor is not of type Object"); 88 88 89 89 Dictionary dictionary(args[1]); … … 96 96 if (containsEndings) { 97 97 if (endings != "transparent" && endings != "native") 98 return throwError("The endings property must be either \"transparent\" or \"native\"", V8Proxy::TypeError);98 return V8Proxy::throwTypeError("The endings property must be either \"transparent\" or \"native\""); 99 99 } 100 100 -
trunk/Source/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp
r117383 r117448 46 46 47 47 if (!args.IsConstructCall()) 48 return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);48 return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function."); 49 49 50 50 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) -
trunk/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp
r115522 r117448 40 40 41 41 if (!args.IsConstructCall()) 42 return throwError("DOM object constructor cannot be called as a function", V8Proxy::TypeError);42 return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function"); 43 43 44 44 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) -
trunk/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
r117383 r117448 52 52 53 53 if (!args.IsConstructCall()) 54 return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);54 return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function."); 55 55 56 56 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) -
trunk/Source/WebCore/bindings/v8/custom/V8IntentConstructor.cpp
r115522 r117448 49 49 50 50 if (!args.IsConstructCall()) 51 return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);51 return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function."); 52 52 53 53 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) … … 77 77 if (args.Length() > 3) { 78 78 if (!extractTransferables(args[3], messagePortArrayTransferList, arrayBufferArrayTransferList)) 79 return throwError("Could not extract transferables", V8Proxy::TypeError);79 return V8Proxy::throwTypeError("Could not extract transferables"); 80 80 } 81 81 bool dataDidThrow = false; -
trunk/Source/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp
r114932 r117448 52 52 // Consider refactoring to reduce duplication. 53 53 if (!args.IsConstructCall()) 54 return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);54 return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function."); 55 55 56 56 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) -
trunk/Source/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp
r114932 r117448 96 96 if (args.Length() > 0) { 97 97 if (!args[0]->IsObject()) 98 return throwError("Callback must be of valid type.", V8Proxy::TypeError);98 return V8Proxy::throwTypeError("Callback must be of valid type."); 99 99 100 100 callback = V8CustomVoidCallback::create(args[0], context); -
trunk/Source/WebCore/bindings/v8/custom/V8WebKitMutationObserverCustom.cpp
r117383 r117448 56 56 57 57 if (!args.IsConstructCall()) 58 return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);58 return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function."); 59 59 60 60 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) -
trunk/Source/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp
r114922 r117448 46 46 47 47 if (!args.IsConstructCall()) 48 return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);48 return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function."); 49 49 50 50 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) -
trunk/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp
r117383 r117448 57 57 58 58 if (!args.IsConstructCall()) 59 return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);59 return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function."); 60 60 61 61 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) -
trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp
r117383 r117448 49 49 50 50 if (!args.IsConstructCall()) 51 return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);51 return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function."); 52 52 53 53 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
Note: See TracChangeset
for help on using the changeset viewer.