Bug 141755 - [Canvas] apply NOT_SUPPORTED_ERR to putImageData()
Summary: [Canvas] apply NOT_SUPPORTED_ERR to putImageData()
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other Linux
: P2 Normal
Assignee: Nobody
URL: https://html.spec.whatwg.org/multipag...
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-18 08:36 PST by KwangHyuk
Modified: 2015-05-11 03:52 PDT (History)
4 users (show)

See Also:


Attachments
Patch (3.75 KB, patch)
2015-02-18 08:50 PST, KwangHyuk
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews100 for mac-mavericks (531.76 KB, application/zip)
2015-02-18 09:35 PST, Build Bot
no flags Details
Archive of layout-test-results from ews106 for mac-mavericks-wk2 (703.76 KB, application/zip)
2015-02-18 09:43 PST, Build Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description KwangHyuk 2015-02-18 08:36:59 PST
putImageData() throws NOT_SUPPORTED_ERR if arguments are not finite

Actual output:
    Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: Argument 2 of CanvasRenderingContext2D.putImageData is not a finite floating-point value.

* References:
    2d.imageData.put.nonfinite

http://flashcanvas.net/examples/philip.html5.org/tests/canvas/suite/tests/2d.imageData.put.nonfinite.html
Comment 1 KwangHyuk 2015-02-18 08:50:01 PST
Created attachment 246817 [details]
Patch
Comment 2 Build Bot 2015-02-18 09:35:08 PST
Comment on attachment 246817 [details]
Patch

Attachment 246817 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/6211018736795648

New failing tests:
fast/canvas/canvas-putImageData.html
canvas/philip/tests/2d.imageData.put.nonfinite.html
Comment 3 Build Bot 2015-02-18 09:35:12 PST
Created attachment 246822 [details]
Archive of layout-test-results from ews100 for mac-mavericks

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-mavericks  Platform: Mac OS X 10.9.5
Comment 4 Build Bot 2015-02-18 09:43:40 PST
Comment on attachment 246817 [details]
Patch

Attachment 246817 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/5779819052662784

New failing tests:
fast/canvas/canvas-putImageData.html
canvas/philip/tests/2d.imageData.put.nonfinite.html
Comment 5 Build Bot 2015-02-18 09:43:43 PST
Created attachment 246824 [details]
Archive of layout-test-results from ews106 for mac-mavericks-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-mavericks-wk2  Platform: Mac OS X 10.9.5
Comment 6 Chris Dumez 2015-02-18 10:05:44 PST
Comment on attachment 246817 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=246817&action=review

The numeric arguments are not unrestricted as per the spec (both W3C and WhatWG). Therefore, infinite / NaN is already rejected at Web IDL level with a Type Error. The W3C specification really should not specify that a NOT_SUPPORTED_ERROR be thrown in this case because it cannot happen AFAIK. Note that the latest WhatWG spec does not indicate that a NOT_SUPPORTED_ERR should be thrown (https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-putimagedata), only the W3C one does.

Honestly, here, there isn't much benefit in adding more code just to throw a different exception. We already throw because of the Web IDL.

> Source/WebCore/html/canvas/CanvasRenderingContext2D.idl:163
> +    [RaisesException] void putImageData(ImageData? imagedata, unrestricted float dx, unrestricted float dy);

These are not unrestricted as per the spec.

> Source/WebCore/html/canvas/CanvasRenderingContext2D.idl:164
> +    [RaisesException] void putImageData(ImageData? imagedata, unrestricted float dx, unrestricted float dy, unrestricted float dirtyX, unrestricted float dirtyY, unrestricted float dirtyWidth, unrestricted float dirtyHeight);

ditto.
Comment 7 KwangHyuk 2015-02-23 06:19:43 PST
> Honestly, here, there isn't much benefit in adding more code just to throw a different exception.

agreed to your idea.