Changeset 224681 in webkit


Ignore:
Timestamp:
Nov 10, 2017 7:43:33 AM (6 years ago)
Author:
Ms2ger@igalia.com
Message:

Source/WebCore:
[GTK] Use fallible allocation in ImageBuffer::ImageBuffer().
https://bugs.webkit.org/show_bug.cgi?id=179051

Reviewed by Michael Catanzaro.

Test: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html

  • platform/graphics/cairo/ImageBufferCairo.cpp:

(WebCore::ImageBuffer::ImageBuffer):

Source/WTF:
Export tryFastZeroedMalloc.
https://bugs.webkit.org/show_bug.cgi?id=179051

Reviewed by Michael Catanzaro.

The other functions were exported in bug 72855. There does not seem to be a
reason not to export this one.

  • wtf/FastMalloc.h:

LayoutTests:
[GTK] Update test expectations for imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html.
https://bugs.webkit.org/show_bug.cgi?id=179051

Reviewed by Michael Catanzaro.

The expectations are platform-specific because the test times out on mac.
The difference with the mac expectations is only in the last part of the
test, after the timeout.

This follows our policy of creating -expected files with failures for
imported wpt tests, to allow using them as regression tests.

  • platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r224680 r224681  
     12017-11-10  Ms2ger  <Ms2ger@igalia.com>
     2
     3        [GTK] Update test expectations for imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html.
     4        https://bugs.webkit.org/show_bug.cgi?id=179051
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        The expectations are platform-specific because the test times out on mac.
     9        The difference with the mac expectations is only in the last part of the
     10        test, after the timeout.
     11
     12        This follows our policy of creating -expected files with failures for
     13        imported wpt tests, to allow using them as regression tests.
     14
     15        * platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt:
     16
    1172017-11-10  Chris Dumez  <cdumez@apple.com>
    218
  • trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt

    r223769 r224681  
     1CONSOLE MESSAGE: line 167: Canvas area exceeds the maximum limit (width * height > 268435456).
    12
    2 FAIL createImageBitmap with a HTMLImageElement source and sw set to 0 rejects with a RangeError. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
    3 FAIL createImageBitmap with a HTMLImageElement source and sh set to 0 rejects with a RangeError. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
    4 FAIL createImageBitmap with a HTMLImageElement source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
    5 FAIL createImageBitmap with a HTMLVideoElement source and sw set to 0 rejects with a RangeError. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
    6 FAIL createImageBitmap with a HTMLVideoElement source and sh set to 0 rejects with a RangeError. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
    7 FAIL createImageBitmap with a HTMLVideoElement source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
    8 FAIL createImageBitmap with a HTMLCanvasElement source and sw set to 0 rejects with a RangeError. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
    9 FAIL createImageBitmap with a HTMLCanvasElement source and sh set to 0 rejects with a RangeError. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
    10 FAIL createImageBitmap with a HTMLCanvasElement source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
     3PASS createImageBitmap with a HTMLImageElement source and sw set to 0 rejects with a RangeError.
     4PASS createImageBitmap with a HTMLImageElement source and sh set to 0 rejects with a RangeError.
     5FAIL createImageBitmap with a HTMLImageElement source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. assert_unreached: Should have rejected: undefined Reached unreachable code
     6PASS createImageBitmap with a HTMLVideoElement source and sw set to 0 rejects with a RangeError.
     7PASS createImageBitmap with a HTMLVideoElement source and sh set to 0 rejects with a RangeError.
     8FAIL createImageBitmap with a HTMLVideoElement source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. assert_throws: function "function () { throw e }" threw object "TypeError: createImageBitmap with HTMLVideoElement is not implemented" ("TypeError") expected object "InvalidStateError" ("InvalidStateError")
     9PASS createImageBitmap with a HTMLCanvasElement source and sw set to 0 rejects with a RangeError.
     10PASS createImageBitmap with a HTMLCanvasElement source and sh set to 0 rejects with a RangeError.
     11FAIL createImageBitmap with a HTMLCanvasElement source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. assert_unreached: Should have rejected: undefined Reached unreachable code
    1112FAIL createImageBitmap with a OffscreenCanvas source and sw set to 0 rejects with a RangeError. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: OffscreenCanvas"
    1213FAIL createImageBitmap with a OffscreenCanvas source and sh set to 0 rejects with a RangeError. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: OffscreenCanvas"
    1314FAIL createImageBitmap with a OffscreenCanvas source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: OffscreenCanvas"
    14 FAIL createImageBitmap with a ImageData source and sw set to 0 rejects with a RangeError. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
    15 FAIL createImageBitmap with a ImageData source and sh set to 0 rejects with a RangeError. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
    16 FAIL createImageBitmap with a ImageData source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
    17 FAIL createImageBitmap with a ImageBitmap source and sw set to 0 rejects with a RangeError. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
    18 FAIL createImageBitmap with a ImageBitmap source and sh set to 0 rejects with a RangeError. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
    19 FAIL createImageBitmap with a ImageBitmap source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
    20 FAIL createImageBitmap with a Blob source and sw set to 0 rejects with a RangeError. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
    21 FAIL createImageBitmap with a Blob source and sh set to 0 rejects with a RangeError. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
    22 FAIL createImageBitmap with a Blob source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
    23 FAIL createImageBitmap with undefined image source rejects with a TypeError. Can't find variable: createImageBitmap
    24 FAIL createImageBitmap with null image source rejects with a TypeError. Can't find variable: createImageBitmap
    25 FAIL createImageBitmap with empty image source rejects with a InvalidStateError. Can't find variable: createImageBitmap
    26 FAIL createImageBitmap with empty video source rejects with a InvalidStateError. Can't find variable: createImageBitmap
    27 FAIL createImageBitmap with an oversized canvas source rejects with a RangeError. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
     15PASS createImageBitmap with a ImageData source and sw set to 0 rejects with a RangeError.
     16PASS createImageBitmap with a ImageData source and sh set to 0 rejects with a RangeError.
     17FAIL createImageBitmap with a ImageData source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. assert_throws: function "function () { throw e }" threw object "TypeError: createImageBitmap with ImageData is not implemented" ("TypeError") expected object "InvalidStateError" ("InvalidStateError")
     18PASS createImageBitmap with a ImageBitmap source and sw set to 0 rejects with a RangeError.
     19PASS createImageBitmap with a ImageBitmap source and sh set to 0 rejects with a RangeError.
     20FAIL createImageBitmap with a ImageBitmap source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. assert_throws: function "function () { throw e }" threw object "TypeError: createImageBitmap with ImageBitmap is not implemented" ("TypeError") expected object "InvalidStateError" ("InvalidStateError")
     21PASS createImageBitmap with a Blob source and sw set to 0 rejects with a RangeError.
     22PASS createImageBitmap with a Blob source and sh set to 0 rejects with a RangeError.
     23FAIL createImageBitmap with a Blob source and oversized (unallocatable) crop region rejects with an InvalidStateError DOMException. assert_throws: function "function () { throw e }" threw object "TypeError: createImageBitmap with ArrayBuffer or Blob is not implemented" ("TypeError") expected object "InvalidStateError" ("InvalidStateError")
     24PASS createImageBitmap with undefined image source rejects with a TypeError.
     25PASS createImageBitmap with null image source rejects with a TypeError.
     26PASS createImageBitmap with empty image source rejects with a InvalidStateError.
     27FAIL createImageBitmap with empty video source rejects with a InvalidStateError. assert_throws: function "function () { throw e }" threw object "TypeError: createImageBitmap with HTMLVideoElement is not implemented" ("TypeError") expected object "InvalidStateError" ("InvalidStateError")
     28PASS createImageBitmap with an oversized canvas source rejects with a RangeError.
    2829FAIL createImageBitmap with an invalid OffscreenCanvas source rejects with a RangeError. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: OffscreenCanvas"
    29 FAIL createImageBitmap with an undecodable blob source rejects with an InvalidStateError. promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: createImageBitmap"
     30FAIL createImageBitmap with an undecodable blob source rejects with an InvalidStateError. assert_throws: function "function () { throw e }" threw object "TypeError: createImageBitmap with ArrayBuffer or Blob is not implemented" ("TypeError") expected object "InvalidStateError" ("InvalidStateError")
    3031
  • trunk/Source/WTF/ChangeLog

    r224665 r224681  
     12017-11-10  Ms2ger  <Ms2ger@igalia.com>
     2
     3        Export tryFastZeroedMalloc.
     4        https://bugs.webkit.org/show_bug.cgi?id=179051
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        The other functions were exported in bug 72855. There does not seem to be a
     9        reason not to export this one.
     10
     11        * wtf/FastMalloc.h:
     12
    1132017-11-09  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/Source/WTF/wtf/FastMalloc.h

    r221575 r224681  
    5353
    5454WTF_EXPORT_PRIVATE TryMallocReturnValue tryFastMalloc(size_t);
    55 TryMallocReturnValue tryFastZeroedMalloc(size_t);
     55WTF_EXPORT_PRIVATE TryMallocReturnValue tryFastZeroedMalloc(size_t);
    5656WTF_EXPORT_PRIVATE TryMallocReturnValue tryFastCalloc(size_t numElements, size_t elementSize);
    5757
  • trunk/Source/WebCore/ChangeLog

    r224671 r224681  
     12017-11-10  Ms2ger  <Ms2ger@igalia.com>
     2
     3        [GTK] Use fallible allocation in ImageBuffer::ImageBuffer().
     4        https://bugs.webkit.org/show_bug.cgi?id=179051
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Test: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html
     9
     10        * platform/graphics/cairo/ImageBufferCairo.cpp:
     11        (WebCore::ImageBuffer::ImageBuffer):
     12
    1132017-11-10  Miguel Gomez  <magomez@igalia.com>
    214
  • trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp

    r223728 r224681  
    232232
    233233        int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, m_size.width());
    234         auto* surfaceData = fastZeroedMalloc(m_size.height() * stride);
     234        void* surfaceData;
     235        if (!tryFastZeroedMalloc(m_size.height() * stride).getValue(surfaceData))
     236            return;
    235237
    236238        m_data.m_surface = adoptRef(cairo_image_surface_create_for_data(static_cast<unsigned char*>(surfaceData), CAIRO_FORMAT_ARGB32, m_size.width(), m_size.height(), stride));
Note: See TracChangeset for help on using the changeset viewer.