Bug 141755

Summary: [Canvas] apply NOT_SUPPORTED_ERR to putImageData()
Product: WebKit Reporter: KwangHyuk <hyuki.kim>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: buildbot, cdumez, gyuyoung.kim, rniwa
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: Linux   
URL: https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-putimagedata
Attachments:
Description Flags
Patch
buildbot: commit-queue-
Archive of layout-test-results from ews100 for mac-mavericks
none
Archive of layout-test-results from ews106 for mac-mavericks-wk2 none

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.