Changeset 207632 in webkit


Ignore:
Timestamp:
Oct 20, 2016 12:17:06 PM (8 years ago)
Author:
mmaxfield@apple.com
Message:

Improve error message when passing a null ArrayBuffer to bufferData()
https://bugs.webkit.org/show_bug.cgi?id=163745

Reviewed by Dean Jackson.

Source/WebCore:

Test: fast/canvas/webgl/bufferData-nullable-array-buffer-view.html

Update the idl file to accept a nullable ArrayBuffer, and throw
the relevant error with a more helpful error string.

  • html/canvas/WebGLRenderingContextBase.cpp:

(WebCore::WebGLRenderingContextBase::bufferData):

  • html/canvas/WebGLRenderingContextBase.h:
  • html/canvas/WebGLRenderingContextBase.idl:

LayoutTests:

  • fast/canvas/webgl/bufferData-nullable-array-buffer-view-expected.txt: Added.
  • fast/canvas/webgl/bufferData-nullable-array-buffer-view.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r207631 r207632  
     12016-10-20  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Improve error message when passing a null ArrayBuffer to bufferData()
     4        https://bugs.webkit.org/show_bug.cgi?id=163745
     5
     6        Reviewed by Dean Jackson.
     7
     8        * fast/canvas/webgl/bufferData-nullable-array-buffer-view-expected.txt: Added.
     9        * fast/canvas/webgl/bufferData-nullable-array-buffer-view.html: Added.
     10
    1112016-10-20  Zalan Bujtas  <zalan@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r207631 r207632  
     12016-10-20  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Improve error message when passing a null ArrayBuffer to bufferData()
     4        https://bugs.webkit.org/show_bug.cgi?id=163745
     5
     6        Reviewed by Dean Jackson.
     7
     8        Test: fast/canvas/webgl/bufferData-nullable-array-buffer-view.html
     9
     10        Update the idl file to accept a nullable ArrayBuffer, and throw
     11        the relevant error with a more helpful error string.
     12
     13        * html/canvas/WebGLRenderingContextBase.cpp:
     14        (WebCore::WebGLRenderingContextBase::bufferData):
     15        * html/canvas/WebGLRenderingContextBase.h:
     16        * html/canvas/WebGLRenderingContextBase.idl:
     17
    1182016-10-20  Zalan Bujtas  <zalan@apple.com>
    219
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp

    r207221 r207632  
    10761076}
    10771077
    1078 void WebGLRenderingContextBase::bufferData(GC3Denum target, ArrayBuffer& data, GC3Denum usage, ExceptionCode&)
    1079 {
    1080     if (isContextLostOrPending())
    1081         return;
     1078void WebGLRenderingContextBase::bufferData(GC3Denum target, ArrayBuffer* data, GC3Denum usage, ExceptionCode&)
     1079{
     1080    if (isContextLostOrPending())
     1081        return;
     1082    if (!data) {
     1083        synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "null data");
     1084        return;
     1085    }
    10821086    WebGLBuffer* buffer = validateBufferDataParameters("bufferData", target, usage);
    10831087    if (!buffer)
    10841088        return;
    10851089    if (!isErrorGeneratedOnOutOfBoundsAccesses()) {
    1086         if (!buffer->associateBufferData(&data)) {
     1090        if (!buffer->associateBufferData(data)) {
    10871091            synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "invalid buffer");
    10881092            return;
     
    10911095
    10921096    m_context->moveErrorsToSyntheticErrorList();
    1093     m_context->bufferData(target, data.byteLength(), data.data(), usage);
     1097    m_context->bufferData(target, data->byteLength(), data->data(), usage);
    10941098    if (m_context->moveErrorsToSyntheticErrorList()) {
    10951099        // The bufferData function failed. Tell the buffer it doesn't have the data it thinks it does.
     
    10981102}
    10991103
    1100 void WebGLRenderingContextBase::bufferData(GC3Denum target, ArrayBufferView& data, GC3Denum usage, ExceptionCode&)
    1101 {
    1102     if (isContextLostOrPending())
    1103         return;
     1104void WebGLRenderingContextBase::bufferData(GC3Denum target, RefPtr<ArrayBufferView>&& data, GC3Denum usage, ExceptionCode&)
     1105{
     1106    if (isContextLostOrPending())
     1107        return;
     1108    if (!data) {
     1109        synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "null data");
     1110        return;
     1111    }
    11041112    WebGLBuffer* buffer = validateBufferDataParameters("bufferData", target, usage);
    11051113    if (!buffer)
    11061114        return;
    11071115    if (!isErrorGeneratedOnOutOfBoundsAccesses()) {
    1108         if (!buffer->associateBufferData(&data)) {
     1116        if (!buffer->associateBufferData(data.get())) {
    11091117            synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "invalid buffer");
    11101118            return;
     
    11131121
    11141122    m_context->moveErrorsToSyntheticErrorList();
    1115     m_context->bufferData(target, data.byteLength(), data.baseAddress(), usage);
     1123    m_context->bufferData(target, data->byteLength(), data->baseAddress(), usage);
    11161124    if (m_context->moveErrorsToSyntheticErrorList()) {
    11171125        // The bufferData function failed. Tell the buffer it doesn't have the data it thinks it does.
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h

    r205360 r207632  
    140140
    141141    void bufferData(GC3Denum target, long long size, GC3Denum usage, ExceptionCode&);
    142     void bufferData(GC3Denum target, ArrayBuffer& data, GC3Denum usage, ExceptionCode&);
    143     void bufferData(GC3Denum target, ArrayBufferView& data, GC3Denum usage, ExceptionCode&);
     142    void bufferData(GC3Denum target, ArrayBuffer* data, GC3Denum usage, ExceptionCode&);
     143    void bufferData(GC3Denum target, RefPtr<ArrayBufferView>&& data, GC3Denum usage, ExceptionCode&);
    144144    void bufferSubData(GC3Denum target, long long offset, ArrayBuffer* data, ExceptionCode&);
    145145    void bufferSubData(GC3Denum target, long long offset, RefPtr<ArrayBufferView>&& data, ExceptionCode&);
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl

    r206723 r207632  
    485485    void blendFunc(GLenum sfactor, GLenum dfactor);
    486486    void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
    487     [MayThrowLegacyException] void bufferData(GLenum target, ArrayBuffer data, GLenum usage);
    488     [MayThrowLegacyException] void bufferData(GLenum target, ArrayBufferView data, GLenum usage);
     487    [MayThrowLegacyException] void bufferData(GLenum target, ArrayBuffer? data, GLenum usage);
     488    [MayThrowLegacyException] void bufferData(GLenum target, ArrayBufferView? data, GLenum usage);
    489489    [MayThrowLegacyException] void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
    490490    [MayThrowLegacyException] void bufferSubData(GLenum target, GLintptr offset, ArrayBuffer? data);
Note: See TracChangeset for help on using the changeset viewer.