Changeset 117536 in webkit


Ignore:
Timestamp:
May 17, 2012 8:39:09 PM (12 years ago)
Author:
haraken@chromium.org
Message:

[V8][Refactoring] Remove V8Proxy::throwError(const char*, v8::Isolate* = 0)
https://bugs.webkit.org/show_bug.cgi?id=86794

Reviewed by Adam Barth.

As commented here (https://bugs.webkit.org/show_bug.cgi?id=84074#c5),
I am refactoring a series of confusing throwError()s.
This patch removes V8Proxy::throwError(const char*, v8::Isolate* = 0).

No tests. No change in behavior.

  • bindings/v8/V8Utilities.cpp:

(WebCore::extractTransferables):
(WebCore::getMessagePortArray):

  • bindings/v8/custom/V8ArrayBufferViewCustom.h:

(WebCore::constructWebGLArrayWithArrayBufferArgument):
(WebCore::constructWebGLArray):

  • bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp:

(WebCore::V8AudioBufferSourceNode::bufferAccessorSetter):

  • bindings/v8/custom/V8ClipboardCustom.cpp:

(WebCore::V8Clipboard::setDragImageCallback):

  • bindings/v8/custom/V8HTMLDocumentCustom.cpp:

(WebCore::V8HTMLDocument::openCallback):

  • bindings/v8/custom/V8HTMLInputElementCustom.cpp:

(WebCore::V8HTMLInputElement::selectionStartAccessorGetter):
(WebCore::V8HTMLInputElement::selectionStartAccessorSetter):
(WebCore::V8HTMLInputElement::selectionEndAccessorGetter):
(WebCore::V8HTMLInputElement::selectionEndAccessorSetter):
(WebCore::V8HTMLInputElement::selectionDirectionAccessorGetter):
(WebCore::V8HTMLInputElement::selectionDirectionAccessorSetter):
(WebCore::V8HTMLInputElement::setSelectionRangeCallback):

  • bindings/v8/custom/V8HTMLMediaElementCustom.cpp:

(WebCore::V8HTMLMediaElement::controllerAccessorSetter):

  • bindings/v8/custom/V8InjectedScriptHostCustom.cpp:

(WebCore::V8InjectedScriptHost::inspectedObjectCallback):

Location:
trunk/Source/WebCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r117535 r117536  
     12012-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
    1392012-05-17  Dana Jansens  <danakj@chromium.org>
    240
  • trunk/Source/WebCore/bindings/v8/V8Proxy.h

    r117448 r117536  
    326326    }
    327327
    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 
    335328    inline v8::Handle<v8::Primitive> throwError(const char* message, V8Proxy::ErrorType type, v8::Isolate* isolate = 0)
    336329    {
  • trunk/Source/WebCore/bindings/v8/V8Utilities.cpp

    r112184 r117536  
    9595
    9696    if (!value->IsObject()) {
    97         throwError("TransferArray argument must be an object");
     97        V8Proxy::throwTypeError("TransferArray argument must be an object");
    9898        return false;
    9999    }
     
    108108        v8::Local<v8::Value> sequenceLength = transferrables->Get(v8::String::New("length"));
    109109        if (!sequenceLength->IsNumber()) {
    110             throwError("TransferArray argument has no length attribute");
     110            V8Proxy::throwTypeError("TransferArray argument has no length attribute");
    111111            return false;
    112112        }
     
    128128            arrayBuffers.append(V8ArrayBuffer::toNative(v8::Handle<v8::Object>::Cast(transferrable)));
    129129        else {
    130             throwError("TransferArray argument must contain only Transferables");
     130            V8Proxy::throwTypeError("TransferArray argument must contain only Transferables");
    131131            return false;
    132132        }
     
    142142        return false;
    143143    if (arrayBuffers.size() > 0) {
    144         throwError("MessagePortArray argument must contain only MessagePorts");
     144        V8Proxy::throwTypeError("MessagePortArray argument must contain only MessagePorts");
    145145        return false;
    146146    }
  • trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h

    r117448 r117536  
    6161    ArrayBuffer* buf = V8ArrayBuffer::toNative(args[0]->ToObject());
    6262    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");
    6464    bool ok;
    6565    uint32_t offset = 0;
     
    6868        offset = toUInt32(args[1], ok);
    6969        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");
    7171    }
    7272    uint32_t length = 0;
     
    7474        length = toUInt32(args[2], ok);
    7575        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");
    7777    } else {
    7878        if ((buf->byteLength() - offset) % sizeof(ElementType))
     
    154154        srcArray = args[0]->ToObject();
    155155        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");
    157157        len = toUInt32(srcArray->Get(v8::String::New("length")));
    158158        doInstantiation = true;
  • trunk/Source/WebCore/bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp

    r95901 r117536  
    4848        buffer = V8AudioBuffer::toNative(value->ToObject());
    4949        if (buffer && !imp->setBuffer(buffer)) {
    50             throwError("AudioBuffer unsupported number of channels");
     50            V8Proxy::throwTypeError("AudioBuffer unsupported number of channels");
    5151            return;
    5252        }
     
    5454   
    5555    if (!buffer) {
    56         throwError("Value is not of type AudioBuffer");
     56        V8Proxy::throwTypeError("Value is not of type AudioBuffer");
    5757        return;
    5858    }
  • trunk/Source/WebCore/bindings/v8/custom/V8ClipboardCustom.cpp

    r117383 r117536  
    100100
    101101    if (!node || !node->isElementNode())
    102         return throwError("setDragImageFromElement: Invalid first argument");
     102        return V8Proxy::throwTypeError("setDragImageFromElement: Invalid first argument");
    103103
    104104    if (static_cast<Element*>(node)->hasLocalName(HTMLNames::imgTag) && !node->inDocument())
  • trunk/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp

    r114996 r117536  
    150150            // If the open property is not a function throw a type error.
    151151            if (!function->IsFunction()) {
    152                 throwError("open is not a function");
     152                V8Proxy::throwTypeError("open is not a function");
    153153                return v8::Undefined();
    154154            }
  • trunk/Source/WebCore/bindings/v8/custom/V8HTMLInputElementCustom.cpp

    r95901 r117536  
    4646
    4747    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.");
    4949
    5050    int v = imp->selectionStart();
     
    5959
    6060    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.");
    6262        return;
    6363    }
     
    7272
    7373    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.");
    7575
    7676    int v = imp->selectionEnd();
     
    8585
    8686    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.");
    8888        return;
    8989    }
     
    9999
    100100    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.");
    102102
    103103    return v8String(imp->selectionDirection());
     
    111111
    112112    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.");
    114114        return;
    115115    }
     
    125125
    126126    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.");
    128128
    129129    int start = args[0]->Int32Value();
  • trunk/Source/WebCore/bindings/v8/custom/V8HTMLMediaElementCustom.cpp

    r100159 r117536  
    4444   
    4545    if (!controller) {
    46         throwError("Value is not of type MediaController");
     46        V8Proxy::throwTypeError("Value is not of type MediaController");
    4747        return;
    4848    }
  • trunk/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp

    r115248 r117536  
    8484
    8585    if (!args[0]->IsInt32()) {
    86         throwError("argument has to be an integer");
     86        V8Proxy::throwTypeError("argument has to be an integer");
    8787        return v8::Undefined();
    8888    }
Note: See TracChangeset for help on using the changeset viewer.