Changeset 117933 in webkit


Ignore:
Timestamp:
May 22, 2012 1:38:34 AM (12 years ago)
Author:
haraken@chromium.org
Message:

[V8] Add an optional 'isolate' argument to throwTypeError()
https://bugs.webkit.org/show_bug.cgi?id=87070

Reviewed by Adam Barth.

The objective is to pass Isolate around in V8 bindings.
This patch adds an optional 'isolate' argument to throwTypeError(),
and passes Isolate to throwTypeError()s. In a following patch,
I'll pass Isolate to all throwTypeError("message")s.

No tests. No change in behavior.

  • bindings/scripts/CodeGeneratorV8.pm:

(GenerateNormalAttrSetter):
(GenerateOverloadedFunctionCallback):
(GenerateParametersCheck):

  • bindings/scripts/test/V8/V8TestObj.cpp:

(WebCore::TestObjV8Internal::overloadedMethodCallback):
(WebCore::TestObjV8Internal::overloadedMethod1Callback):

  • bindings/v8/V8Proxy.cpp:

(WebCore::V8Proxy::throwTypeError):

  • bindings/v8/V8Proxy.h:

(V8Proxy):

  • bindings/v8/custom/V8ArrayBufferViewCustom.h:

(WebCore::constructWebGLArray):

  • bindings/v8/custom/V8DataViewCustom.cpp:

(WebCore::V8DataView::constructorCallback):

  • bindings/v8/custom/V8SVGLengthCustom.cpp:

(WebCore::V8SVGLength::valueAccessorSetter):

  • bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:

(WebCore::V8WebGLRenderingContext::getAttachedShadersCallback):
(WebCore::V8WebGLRenderingContext::getProgramParameterCallback):
(WebCore::V8WebGLRenderingContext::getShaderParameterCallback):
(WebCore::V8WebGLRenderingContext::getUniformCallback):
(WebCore::vertexAttribAndUniformHelperf):
(WebCore::uniformHelperi):
(WebCore::uniformMatrixHelper):

Location:
trunk/Source/WebCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r117929 r117933  
     12012-05-22  Kentaro Hara  <haraken@chromium.org>
     2
     3        [V8] Add an optional 'isolate' argument to throwTypeError()
     4        https://bugs.webkit.org/show_bug.cgi?id=87070
     5
     6        Reviewed by Adam Barth.
     7
     8        The objective is to pass Isolate around in V8 bindings.
     9        This patch adds an optional 'isolate' argument to throwTypeError(),
     10        and passes Isolate to throwTypeError()s. In a following patch,
     11        I'll pass Isolate to all throwTypeError("message")s.
     12
     13        No tests. No change in behavior.
     14
     15        * bindings/scripts/CodeGeneratorV8.pm:
     16        (GenerateNormalAttrSetter):
     17        (GenerateOverloadedFunctionCallback):
     18        (GenerateParametersCheck):
     19        * bindings/scripts/test/V8/V8TestObj.cpp:
     20        (WebCore::TestObjV8Internal::overloadedMethodCallback):
     21        (WebCore::TestObjV8Internal::overloadedMethod1Callback):
     22        * bindings/v8/V8Proxy.cpp:
     23        (WebCore::V8Proxy::throwTypeError):
     24        * bindings/v8/V8Proxy.h:
     25        (V8Proxy):
     26        * bindings/v8/custom/V8ArrayBufferViewCustom.h:
     27        (WebCore::constructWebGLArray):
     28        * bindings/v8/custom/V8DataViewCustom.cpp:
     29        (WebCore::V8DataView::constructorCallback):
     30        * bindings/v8/custom/V8SVGLengthCustom.cpp:
     31        (WebCore::V8SVGLength::valueAccessorSetter):
     32        * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
     33        (WebCore::V8WebGLRenderingContext::getAttachedShadersCallback):
     34        (WebCore::V8WebGLRenderingContext::getProgramParameterCallback):
     35        (WebCore::V8WebGLRenderingContext::getShaderParameterCallback):
     36        (WebCore::V8WebGLRenderingContext::getUniformCallback):
     37        (WebCore::vertexAttribAndUniformHelperf):
     38        (WebCore::uniformHelperi):
     39        (WebCore::uniformMatrixHelper):
     40
    1412012-05-22  Yoshifumi Inoue  <yosin@chromium.org>
    242
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r117926 r117933  
    10551055        if (IsWrapperType($argType)) {
    10561056            push(@implContentDecls, "    if (!isUndefinedOrNull(value) && !V8${argType}::HasInstance(value)) {\n");
    1057             push(@implContentDecls, "        V8Proxy::throwTypeError();\n");
     1057            push(@implContentDecls, "        V8Proxy::throwTypeError(0, info.GetIsolate());\n");
    10581058            push(@implContentDecls, "        return;\n");
    10591059            push(@implContentDecls, "    }\n");
     
    13551355    }
    13561356    push(@implContentDecls, <<END);
    1357     V8Proxy::throwTypeError();
     1357    V8Proxy::throwTypeError(0, args.GetIsolate());
    13581358    return v8::Handle<v8::Value>();
    13591359END
     
    16641664                if (IsWrapperType($argType)) {
    16651665                    $parameterCheckString .= "    if (args.Length() > $paramIndex && !isUndefinedOrNull($argValue) && !V8${argType}::HasInstance($argValue)) {\n";
    1666                     $parameterCheckString .= "        V8Proxy::throwTypeError();\n";
     1666                    $parameterCheckString .= "        V8Proxy::throwTypeError(0, args.GetIsolate());\n";
    16671667                    $parameterCheckString .= "        return v8::Handle<v8::Value>();\n";
    16681668                    $parameterCheckString .= "    }\n";
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp

    r117926 r117933  
    18141814    if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsArray())))
    18151815        return overloadedMethod7Callback(args);
    1816     V8Proxy::throwTypeError();
     1816    V8Proxy::throwTypeError(0, args.GetIsolate());
    18171817    return v8::Handle<v8::Value>();
    18181818}
     
    18721872    if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsUndefined() || args[0]->IsString() || args[0]->IsObject())))
    18731873        return overloadedMethod12Callback(args);
    1874     V8Proxy::throwTypeError();
     1874    V8Proxy::throwTypeError(0, args.GetIsolate());
    18751875    return v8::Handle<v8::Value>();
    18761876}
  • trunk/Source/WebCore/bindings/v8/V8Proxy.cpp

    r117926 r117933  
    632632}
    633633
    634 v8::Handle<v8::Value> V8Proxy::throwTypeError(const char* message)
    635 {
    636     return throwError(TypeError, (message ? message : "Type error"));
     634v8::Handle<v8::Value> V8Proxy::throwTypeError(const char* message, v8::Isolate* isolate)
     635{
     636    return throwError(TypeError, (message ? message : "Type error"), isolate);
    637637}
    638638
  • trunk/Source/WebCore/bindings/v8/V8Proxy.h

    r117926 r117933  
    241241
    242242        // Helpers for throwing syntax and type errors with predefined messages.
    243         static v8::Handle<v8::Value> throwTypeError(const char* = 0);
     243        static v8::Handle<v8::Value> throwTypeError(const char* = 0, v8::Isolate* = 0);
    244244        static v8::Handle<v8::Value> throwNotEnoughArgumentsError(v8::Isolate*);
    245245
  • trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h

    r117873 r117933  
    139139    if (args[0]->IsNull()) {
    140140        // Invalid first argument
    141         // FIXME: use forthcoming V8Proxy::throwTypeError().
    142         return V8Proxy::throwTypeError();
     141        return V8Proxy::throwTypeError(0, args.GetIsolate());
    143142    }
    144143
  • trunk/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp

    r117736 r117933  
    5454    }
    5555    if (args[0]->IsNull() || !V8ArrayBuffer::HasInstance(args[0]))
    56         return V8Proxy::throwTypeError();
     56        return V8Proxy::throwTypeError(0, args.GetIsolate());
    5757    return constructWebGLArrayWithArrayBufferArgument<DataView, char>(args, &info, v8::kExternalByteArray, false);
    5858}
  • trunk/Source/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp

    r117736 r117933  
    6767
    6868    if (!isUndefinedOrNull(value) && !value->IsNumber() && !value->IsBoolean()) {
    69         V8Proxy::throwTypeError();
     69        V8Proxy::throwTypeError(0, info.GetIsolate());
    7070        return;
    7171    }
  • trunk/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp

    r117923 r117933  
    275275    WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
    276276    if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLProgram::HasInstance(args[0]))
    277         return V8Proxy::throwTypeError();
     277        return V8Proxy::throwTypeError(0, args.GetIsolate());
    278278    WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
    279279    Vector<RefPtr<WebGLShader> > shaders;
     
    356356    WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
    357357    if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLProgram::HasInstance(args[0]))
    358         return V8Proxy::throwTypeError();
     358        return V8Proxy::throwTypeError(0, args.GetIsolate());
    359359    WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
    360360    unsigned pname = toInt32(args[1]);
     
    383383    WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
    384384    if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLShader::HasInstance(args[0]))
    385         return V8Proxy::throwTypeError();
     385        return V8Proxy::throwTypeError(0, args.GetIsolate());
    386386    WebGLShader* shader = V8WebGLShader::HasInstance(args[0]) ? V8WebGLShader::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
    387387    unsigned pname = toInt32(args[1]);
     
    424424    WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
    425425    if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLProgram::HasInstance(args[0]))
    426         return V8Proxy::throwTypeError();
     426        return V8Proxy::throwTypeError(0, args.GetIsolate());
    427427    WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
    428428
    429429    if (args.Length() > 1 && !isUndefinedOrNull(args[1]) && !V8WebGLUniformLocation::HasInstance(args[1]))
    430         return V8Proxy::throwTypeError();
     430        return V8Proxy::throwTypeError(0, args.GetIsolate());
    431431    bool ok = false;
    432432    WebGLUniformLocation* location = toWebGLUniformLocation(args[1], ok);
     
    496496    else {
    497497        if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLUniformLocation::HasInstance(args[0]))
    498             return V8Proxy::throwTypeError();
     498            return V8Proxy::throwTypeError(0, args.GetIsolate());
    499499        location = toWebGLUniformLocation(args[0], ok);
    500500    }
     
    523523
    524524    if (args[1].IsEmpty() || !args[1]->IsArray())
    525         return V8Proxy::throwTypeError();
     525        return V8Proxy::throwTypeError(0, args.GetIsolate());
    526526    v8::Handle<v8::Array> array =
    527527      v8::Local<v8::Array>::Cast(args[1]);
     
    568568    WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
    569569    if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLUniformLocation::HasInstance(args[0]))
    570         return V8Proxy::throwTypeError();
     570        return V8Proxy::throwTypeError(0, args.GetIsolate());
    571571    bool ok = false;
    572572    WebGLUniformLocation* location = toWebGLUniformLocation(args[0], ok);
     
    589589
    590590    if (args[1].IsEmpty() || !args[1]->IsArray())
    591         return V8Proxy::throwTypeError();
     591        return V8Proxy::throwTypeError(0, args.GetIsolate());
    592592    v8::Handle<v8::Array> array =
    593593      v8::Local<v8::Array>::Cast(args[1]);
     
    679679
    680680    if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLUniformLocation::HasInstance(args[0]))
    681         return V8Proxy::throwTypeError();
     681        return V8Proxy::throwTypeError(0, args.GetIsolate());
    682682    bool ok = false;
    683683    WebGLUniformLocation* location = toWebGLUniformLocation(args[0], ok);
     
    700700
    701701    if (args[2].IsEmpty() || !args[2]->IsArray())
    702         return V8Proxy::throwTypeError();
     702        return V8Proxy::throwTypeError(0, args.GetIsolate());
    703703    v8::Handle<v8::Array> array =
    704704      v8::Local<v8::Array>::Cast(args[2]);
Note: See TracChangeset for help on using the changeset viewer.