Changeset 117536 in webkit
- Timestamp:
- May 17, 2012 8:39:09 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r117535 r117536 1 2012-05-17 Kentaro Hara <haraken@chromium.org> 2 3 [V8][Refactoring] Remove V8Proxy::throwError(const char*, v8::Isolate* = 0) 4 https://bugs.webkit.org/show_bug.cgi?id=86794 5 6 Reviewed by Adam Barth. 7 8 As commented here (https://bugs.webkit.org/show_bug.cgi?id=84074#c5), 9 I am refactoring a series of confusing throwError()s. 10 This patch removes V8Proxy::throwError(const char*, v8::Isolate* = 0). 11 12 No tests. No change in behavior. 13 14 * bindings/v8/V8Utilities.cpp: 15 (WebCore::extractTransferables): 16 (WebCore::getMessagePortArray): 17 * bindings/v8/custom/V8ArrayBufferViewCustom.h: 18 (WebCore::constructWebGLArrayWithArrayBufferArgument): 19 (WebCore::constructWebGLArray): 20 * bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp: 21 (WebCore::V8AudioBufferSourceNode::bufferAccessorSetter): 22 * bindings/v8/custom/V8ClipboardCustom.cpp: 23 (WebCore::V8Clipboard::setDragImageCallback): 24 * bindings/v8/custom/V8HTMLDocumentCustom.cpp: 25 (WebCore::V8HTMLDocument::openCallback): 26 * bindings/v8/custom/V8HTMLInputElementCustom.cpp: 27 (WebCore::V8HTMLInputElement::selectionStartAccessorGetter): 28 (WebCore::V8HTMLInputElement::selectionStartAccessorSetter): 29 (WebCore::V8HTMLInputElement::selectionEndAccessorGetter): 30 (WebCore::V8HTMLInputElement::selectionEndAccessorSetter): 31 (WebCore::V8HTMLInputElement::selectionDirectionAccessorGetter): 32 (WebCore::V8HTMLInputElement::selectionDirectionAccessorSetter): 33 (WebCore::V8HTMLInputElement::setSelectionRangeCallback): 34 * bindings/v8/custom/V8HTMLMediaElementCustom.cpp: 35 (WebCore::V8HTMLMediaElement::controllerAccessorSetter): 36 * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: 37 (WebCore::V8InjectedScriptHost::inspectedObjectCallback): 38 1 39 2012-05-17 Dana Jansens <danakj@chromium.org> 2 40 -
trunk/Source/WebCore/bindings/v8/V8Proxy.h
r117448 r117536 326 326 } 327 327 328 inline v8::Handle<v8::Primitive> throwError(const char* message, v8::Isolate* isolate = 0)329 {330 if (!v8::V8::IsExecutionTerminating())331 V8Proxy::throwError(V8Proxy::TypeError, message, isolate);332 return v8::Undefined();333 }334 335 328 inline v8::Handle<v8::Primitive> throwError(const char* message, V8Proxy::ErrorType type, v8::Isolate* isolate = 0) 336 329 { -
trunk/Source/WebCore/bindings/v8/V8Utilities.cpp
r112184 r117536 95 95 96 96 if (!value->IsObject()) { 97 throwError("TransferArray argument must be an object");97 V8Proxy::throwTypeError("TransferArray argument must be an object"); 98 98 return false; 99 99 } … … 108 108 v8::Local<v8::Value> sequenceLength = transferrables->Get(v8::String::New("length")); 109 109 if (!sequenceLength->IsNumber()) { 110 throwError("TransferArray argument has no length attribute");110 V8Proxy::throwTypeError("TransferArray argument has no length attribute"); 111 111 return false; 112 112 } … … 128 128 arrayBuffers.append(V8ArrayBuffer::toNative(v8::Handle<v8::Object>::Cast(transferrable))); 129 129 else { 130 throwError("TransferArray argument must contain only Transferables");130 V8Proxy::throwTypeError("TransferArray argument must contain only Transferables"); 131 131 return false; 132 132 } … … 142 142 return false; 143 143 if (arrayBuffers.size() > 0) { 144 throwError("MessagePortArray argument must contain only MessagePorts");144 V8Proxy::throwTypeError("MessagePortArray argument must contain only MessagePorts"); 145 145 return false; 146 146 } -
trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h
r117448 r117536 61 61 ArrayBuffer* buf = V8ArrayBuffer::toNative(args[0]->ToObject()); 62 62 if (!buf) 63 return throwError("Could not convert argument 0 to a ArrayBuffer");63 return V8Proxy::throwTypeError("Could not convert argument 0 to a ArrayBuffer"); 64 64 bool ok; 65 65 uint32_t offset = 0; … … 68 68 offset = toUInt32(args[1], ok); 69 69 if (!ok) 70 return throwError("Could not convert argument 1 to a number");70 return V8Proxy::throwTypeError("Could not convert argument 1 to a number"); 71 71 } 72 72 uint32_t length = 0; … … 74 74 length = toUInt32(args[2], ok); 75 75 if (!ok) 76 return throwError("Could not convert argument 2 to a number");76 return V8Proxy::throwTypeError("Could not convert argument 2 to a number"); 77 77 } else { 78 78 if ((buf->byteLength() - offset) % sizeof(ElementType)) … … 154 154 srcArray = args[0]->ToObject(); 155 155 if (srcArray.IsEmpty()) 156 return throwError("Could not convert argument 0 to an array");156 return V8Proxy::throwTypeError("Could not convert argument 0 to an array"); 157 157 len = toUInt32(srcArray->Get(v8::String::New("length"))); 158 158 doInstantiation = true; -
trunk/Source/WebCore/bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp
r95901 r117536 48 48 buffer = V8AudioBuffer::toNative(value->ToObject()); 49 49 if (buffer && !imp->setBuffer(buffer)) { 50 throwError("AudioBuffer unsupported number of channels");50 V8Proxy::throwTypeError("AudioBuffer unsupported number of channels"); 51 51 return; 52 52 } … … 54 54 55 55 if (!buffer) { 56 throwError("Value is not of type AudioBuffer");56 V8Proxy::throwTypeError("Value is not of type AudioBuffer"); 57 57 return; 58 58 } -
trunk/Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp
r117383 r117536 100 100 101 101 if (!node || !node->isElementNode()) 102 return throwError("setDragImageFromElement: Invalid first argument");102 return V8Proxy::throwTypeError("setDragImageFromElement: Invalid first argument"); 103 103 104 104 if (static_cast<Element*>(node)->hasLocalName(HTMLNames::imgTag) && !node->inDocument()) -
trunk/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
r114996 r117536 150 150 // If the open property is not a function throw a type error. 151 151 if (!function->IsFunction()) { 152 throwError("open is not a function");152 V8Proxy::throwTypeError("open is not a function"); 153 153 return v8::Undefined(); 154 154 } -
trunk/Source/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp
r95901 r117536 46 46 47 47 if (!imp->canHaveSelection()) 48 return throwError("Accessing selectionStart on an input element that cannot have a selection.");48 return V8Proxy::throwTypeError("Accessing selectionStart on an input element that cannot have a selection."); 49 49 50 50 int v = imp->selectionStart(); … … 59 59 60 60 if (!imp->canHaveSelection()) { 61 throwError("Accessing selectionStart on an input element that cannot have a selection.");61 V8Proxy::throwTypeError("Accessing selectionStart on an input element that cannot have a selection."); 62 62 return; 63 63 } … … 72 72 73 73 if (!imp->canHaveSelection()) 74 return throwError("Accessing selectionEnd on an input element that cannot have a selection.");74 return V8Proxy::throwTypeError("Accessing selectionEnd on an input element that cannot have a selection."); 75 75 76 76 int v = imp->selectionEnd(); … … 85 85 86 86 if (!imp->canHaveSelection()) { 87 throwError("Accessing selectionEnd on an input element that cannot have a selection.");87 V8Proxy::throwTypeError("Accessing selectionEnd on an input element that cannot have a selection."); 88 88 return; 89 89 } … … 99 99 100 100 if (!imp->canHaveSelection()) 101 return throwError("Accessing selectionDirection on an input element that cannot have a selection.");101 return V8Proxy::throwTypeError("Accessing selectionDirection on an input element that cannot have a selection."); 102 102 103 103 return v8String(imp->selectionDirection()); … … 111 111 112 112 if (!imp->canHaveSelection()) { 113 throwError("Accessing selectionDirection on an input element that cannot have a selection.");113 V8Proxy::throwTypeError("Accessing selectionDirection on an input element that cannot have a selection."); 114 114 return; 115 115 } … … 125 125 126 126 if (!imp->canHaveSelection()) 127 return throwError("Calling setSelectionRange on an input element that cannot have a selection.");127 return V8Proxy::throwTypeError("Calling setSelectionRange on an input element that cannot have a selection."); 128 128 129 129 int start = args[0]->Int32Value(); -
trunk/Source/WebCore/bindings/v8/custom/V8HTMLMediaElementCustom.cpp
r100159 r117536 44 44 45 45 if (!controller) { 46 throwError("Value is not of type MediaController");46 V8Proxy::throwTypeError("Value is not of type MediaController"); 47 47 return; 48 48 } -
trunk/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
r115248 r117536 84 84 85 85 if (!args[0]->IsInt32()) { 86 throwError("argument has to be an integer");86 V8Proxy::throwTypeError("argument has to be an integer"); 87 87 return v8::Undefined(); 88 88 }
Note: See TracChangeset
for help on using the changeset viewer.