Changeset 51785 in webkit


Ignore:
Timestamp:
Dec 7, 2009 11:36:34 AM (14 years ago)
Author:
eric@webkit.org
Message:

2009-12-07 Kenneth Russell <kbr@google.com>

Reviewed by Dimitri Glazkov.

[v8] WebCore::WebGLArrayBufferInternal::byteLengthAttrGetter NULL pointer
https://bugs.webkit.org/show_bug.cgi?id=31889

Fixed bug in handling of zero-argument constructor call.

Test: fast/canvas/webgl/bug-31889.html

  • fast/canvas/webgl/bug-31889-expected.txt: Added.
  • fast/canvas/webgl/bug-31889.html: Added.

2009-12-07 Kenneth Russell <kbr@google.com>

Reviewed by Dimitri Glazkov.

[v8] WebCore::WebGLArrayBufferInternal::byteLengthAttrGetter NULL pointer
https://bugs.webkit.org/show_bug.cgi?id=31889

Fixed bug in handling of zero-argument constructor call.

Test: fast/canvas/webgl/bug-31889.html

  • bindings/v8/custom/V8WebGLArrayBufferCustom.cpp: (WebCore::CALLBACK_FUNC_DECL):
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r51784 r51785  
     12009-12-07  Kenneth Russell  <kbr@google.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        [v8] WebCore::WebGLArrayBufferInternal::byteLengthAttrGetter NULL pointer
     6        https://bugs.webkit.org/show_bug.cgi?id=31889
     7
     8        Fixed bug in handling of zero-argument constructor call.
     9
     10        Test: fast/canvas/webgl/bug-31889.html
     11
     12        * fast/canvas/webgl/bug-31889-expected.txt: Added.
     13        * fast/canvas/webgl/bug-31889.html: Added.
     14
    1152009-12-07  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
    216
  • trunk/WebCore/ChangeLog

    r51783 r51785  
     12009-12-07  Kenneth Russell  <kbr@google.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        [v8] WebCore::WebGLArrayBufferInternal::byteLengthAttrGetter NULL pointer
     6        https://bugs.webkit.org/show_bug.cgi?id=31889
     7
     8        Fixed bug in handling of zero-argument constructor call.
     9
     10        Test: fast/canvas/webgl/bug-31889.html
     11
     12        * bindings/v8/custom/V8WebGLArrayBufferCustom.cpp:
     13        (WebCore::CALLBACK_FUNC_DECL):
     14
    1152009-12-07  Gyuyoung Kim  <gyuyoung@gmail.com>
    216
  • trunk/WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp

    r51049 r51785  
    4949        return throwError("DOM object constructor cannot be called as a function.");
    5050
    51     int argLen = args.Length();
    52     if (argLen == 0) {
    53         // This happens when we return a previously constructed
    54         // WebGLArrayBuffer, e.g. from the call to WebGLArray.buffer.
    55         // The V8DOMWrapper will set the internal pointer in the
    56         // created object. Unfortunately it doesn't look like it's
    57         // possible to distinguish between this case and that where
    58         // the user calls "new WebGLArrayBuffer()" from JavaScript.
    59         return args.Holder();
    60     }
     51    // If we return a previously constructed WebGLArrayBuffer,
     52    // e.g. from the call to WebGLArray.buffer, this code is called
     53    // with a zero-length argument list. The V8DOMWrapper will then
     54    // set the internal pointer in the newly-created object.
     55    // Unfortunately it doesn't look like it's possible to distinguish
     56    // between this case and that where the user calls "new
     57    // WebGLArrayBuffer()" from JavaScript. To guard against problems,
     58    // we always create at least a zero-length WebGLArrayBuffer, even
     59    // if it is immediately overwritten by the V8DOMWrapper.
    6160
    6261    // Supported constructors:
     
    6463    //   -- create an empty buffer of n bytes
    6564
    66     if (argLen != 1)
     65    int argLen = args.Length();
     66    if (argLen > 1)
    6767        return throwError("Wrong number of arguments specified to constructor (requires 1)");
    6868
    6969    int len = 0;
    70     if (!args[0]->IsInt32())
    71         return throwError("Argument to WebGLArrayBuffer constructor was not an integer");
    72     len = toInt32(args[0]);
     70    if (argLen > 0) {
     71        if (!args[0]->IsInt32())
     72            return throwError("Argument to WebGLArrayBuffer constructor was not an integer");
     73        len = toInt32(args[0]);
     74    }
     75
    7376    RefPtr<WebGLArrayBuffer> buffer = WebGLArrayBuffer::create(len);
    7477    // Transform the holder into a wrapper object for the array.
Note: See TracChangeset for help on using the changeset viewer.