RESOLVED FIXED 114444
ProgressEvent should not be cancelable
https://bugs.webkit.org/show_bug.cgi?id=114444
Summary ProgressEvent should not be cancelable
Praveen Jadhav
Reported 2013-04-11 08:11:05 PDT
Events in FileAPI http://dev.w3.org/2006/webapi/FileAPI/#events specify that the events are NOT cancelable and the value in ProgressEvent must be false. Currently these is no provision to set canBubble and cancelable while creating ProgressEvent.
Attachments
Patch (6.30 KB, patch)
2013-04-11 08:24 PDT, Praveen Jadhav
no flags
Patch (5.53 KB, patch)
2013-04-14 18:48 PDT, Praveen Jadhav
ap: review-
Patch (6.24 KB, patch)
2013-04-15 01:55 PDT, Praveen Jadhav
buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-04 for mac-mountainlion (507.05 KB, application/zip)
2013-04-15 03:05 PDT, Build Bot
no flags
Archive of layout-test-results from webkit-ews-13 for mac-mountainlion-wk2 (507.45 KB, application/zip)
2013-04-15 13:05 PDT, Build Bot
no flags
Patch (6.85 KB, text/plain)
2013-04-15 19:35 PDT, Praveen Jadhav
no flags
Patch (6.85 KB, patch)
2013-04-15 19:36 PDT, Praveen Jadhav
no flags
Patch (7.72 KB, patch)
2013-05-29 22:30 PDT, Praveen Jadhav
no flags
Praveen Jadhav
Comment 1 2013-04-11 08:24:35 PDT
Soo-Hyun Choi
Comment 2 2013-04-11 08:40:54 PDT
FYI - changed the assignee and status of this bug.
Alexey Proskuryakov
Comment 3 2013-04-13 19:44:39 PDT
Should progress events ever be cancelable? The progress events spec says something I can't easily decipher: "Throughout the web platform the error, abort, and load event types have their bubbles and cancelable attributes initialized to false, so it is suggested that for consistency all events using the ProgressEvent interface do the same."
Anne van Kesteren
Comment 4 2013-04-14 00:55:44 PDT
It is up to the specification dispatching the event to decide that, basically.
Chris Dumez
Comment 5 2013-04-14 07:08:43 PDT
Comment on attachment 197591 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=197591&action=review > Source/WebCore/ChangeLog:11 > + Reviewed by NOBODY (OOPS!). "Reviewed by" line usually comes after the bug URL. > LayoutTests/fast/files/file-reader-event-listener.html:31 > + if (event.bubbles) { You should probably use shouldBeFalse() instead. > LayoutTests/fast/files/file-reader-event-listener.html:35 > + if (event.cancelable) { Ditto.
Praveen Jadhav
Comment 6 2013-04-14 07:30:09 PDT
(In reply to comment #4) > It is up to the specification dispatching the event to decide that, basically. Going by ProgressEvent specifications, default value of "cancelable" for error, abort and load events should be false. So, is it fine if I set that to false in ProgressEvent.h?
Chris Dumez
Comment 7 2013-04-14 08:56:30 PDT
(In reply to comment #6) > (In reply to comment #4) > > It is up to the specification dispatching the event to decide that, basically. > > Going by ProgressEvent specifications, default value of "cancelable" for error, abort and load events should be false. So, is it fine if I set that to false in ProgressEvent.h? Based on the spec and what Anne said, I personally think it is a good idea to set cancelable argument's default value to false, instead of true for ProgressEvent.
Praveen Jadhav
Comment 8 2013-04-14 18:48:58 PDT
Alexey Proskuryakov
Comment 9 2013-04-14 22:16:09 PDT
Comment on attachment 198019 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=198019&action=review > Source/WebCore/ChangeLog:3 > + ProgressEvent should provide provision to receive canBubble and cancelable values. Please update ChangeLog to match current bug title. > Source/WebCore/dom/ProgressEvent.cpp:56 > +ProgressEvent::ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total, bool canBubble, bool cancelable) > + : Event(type, canBubble, cancelable) If we never need other values, why make the constructor slower by making this configurable? > LayoutTests/fast/files/file-reader-event-listener.html:6 > +<script src="../js/resources/js-test-pre.js"></script> Please use the rest of js-test functionality here (window.jsTestIsAsync, finishJSTest()). testRunner.dumpAsText() is the default when using js-test.
Praveen Jadhav
Comment 10 2013-04-14 22:50:27 PDT
(In reply to comment #9) > (From update of attachment 198019 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=198019&action=review > > > Source/WebCore/ChangeLog:3 > > + ProgressEvent should provide provision to receive canBubble and cancelable values. > > Please update ChangeLog to match current bug title. I will update this in the next patch. > > > Source/WebCore/dom/ProgressEvent.cpp:56 > > +ProgressEvent::ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total, bool canBubble, bool cancelable) > > + : Event(type, canBubble, cancelable) > > If we never need other values, why make the constructor slower by making this configurable? I checked other specifications which are using ProgressEvent and found that in XMLHTTPRequest, http://www.w3.org/TR/XMLHttpRequest/#garbage-collection, all events must be cancelable. Here, except for readystatechange, all are ProgressEvents. Maybe, we should retain the code as in first patch, along with setting default value while declaration, in order to support XMLHttpRequest. Let me know your suggestion. > > > LayoutTests/fast/files/file-reader-event-listener.html:6 > > +<script src="../js/resources/js-test-pre.js"></script> > > Please use the rest of js-test functionality here (window.jsTestIsAsync, finishJSTest()). testRunner.dumpAsText() is the default when using js-test. I will update this in the next patch.
Alexey Proskuryakov
Comment 11 2013-04-14 22:56:43 PDT
> in XMLHTTPRequest, http://www.w3.org/TR/XMLHttpRequest/#garbage-collection, all events must be cancelable. I could not easily find this in the spec. Could you please quote it? Does XHR 2 say the same? If this patch used to break XHR, we should add a test tat would have caught that.
Praveen Jadhav
Comment 12 2013-04-14 23:30:09 PDT
(In reply to comment #11) > > in XMLHTTPRequest, http://www.w3.org/TR/XMLHttpRequest/#garbage-collection, all events must be cancelable. > > I could not easily find this in the spec. Could you please quote it? Does XHR 2 say the same? > > If this patch used to break XHR, we should add a test tat would have caught that. There is a layout test http/tests/xmlhttprequest/infoOnProgressEvent.html which checks if event.cancelable is true. Strangely, it din't fail on efl port(not blocked by TestExpectations either). But Mac bot seems to have caught the error. Specifications doesn't mention anything specific to cancelable in XHR and maybe my interpretation was wrong about canceling fetch algorithm and making ProgressEvents of XHR cancelable.
Praveen Jadhav
Comment 13 2013-04-15 01:55:50 PDT
Created attachment 198036 [details] Patch All comments are included in the patch. infoOnProgressEvent-expected.txt is modified to receive corrected state of Cancelable.
Anne van Kesteren
Comment 14 2013-04-15 02:49:26 PDT
FYI, none of the events in http://xhr.spec.whatwg.org/ are cancelable. preventDefault() certainly never had an effect.
Build Bot
Comment 15 2013-04-15 03:05:07 PDT
Comment on attachment 198036 [details] Patch Attachment 198036 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/10265 New failing tests: fast/xmlhttprequest/xmlhttprequest-get.xhtml http/tests/ssl/ping-with-unsafe-redirect.html
Build Bot
Comment 16 2013-04-15 03:05:11 PDT
Created attachment 198045 [details] Archive of layout-test-results from webkit-ews-04 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-04 Port: mac-mountainlion Platform: Mac OS X 10.8.2
Build Bot
Comment 17 2013-04-15 13:05:22 PDT
Comment on attachment 198036 [details] Patch Attachment 198036 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/42423 New failing tests: fast/xmlhttprequest/xmlhttprequest-get.xhtml
Build Bot
Comment 18 2013-04-15 13:05:27 PDT
Created attachment 198171 [details] Archive of layout-test-results from webkit-ews-13 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-13 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.2
Praveen Jadhav
Comment 19 2013-04-15 19:35:22 PDT
Created attachment 198221 [details] Patch Failed test expectation files are updated. Bug title updated to be more generic.
Praveen Jadhav
Comment 20 2013-04-15 19:36:26 PDT
Ryosuke Niwa
Comment 21 2013-05-28 22:37:51 PDT
Comment on attachment 198222 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=198222&action=review > Source/WebCore/ChangeLog:10 > + Spec: https://dvcs.w3.org/hg/progress/raw-file/tip/Overview.html#suggested-names-for-events-using-the-progressevent-interface Please refer to a specific version of the spec. > Source/WebCore/ChangeLog:12 > + No new tests. file-reader-event-listener.html and infoOnProgressEvent-expected.txt are updated. It appears to me that we also need to add tests to ensure these events are indeed NOT cancelable (i.e. canceling event shouldn’t have any effect). > LayoutTests/ChangeLog:9 > + file-reader-event-listener.html, xmlhttprequest-get-expected.txt and infoOnProgressEvent-expected.txt are updated. > + Did we used to allow these events to be cancelled? If so, how important is it to maintain the backward compatibility?
Praveen Jadhav
Comment 22 2013-05-28 23:57:35 PDT
(In reply to comment #21) > (From update of attachment 198222 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=198222&action=review > > > Source/WebCore/ChangeLog:10 > > + Spec: https://dvcs.w3.org/hg/progress/raw-file/tip/Overview.html#suggested-names-for-events-using-the-progressevent-interface ok. I will update this in the next patch. > > Please refer to a specific version of the spec. > > > Source/WebCore/ChangeLog:12 > > + No new tests. file-reader-event-listener.html and infoOnProgressEvent-expected.txt are updated. > > It appears to me that we also need to add tests to ensure these events are indeed NOT cancelable (i.e. canceling event shouldn’t have any effect). The test cases are updated to check 'cancelable' value. I feel that covers all possible scenarios. > > > LayoutTests/ChangeLog:9 > > + file-reader-event-listener.html, xmlhttprequest-get-expected.txt and infoOnProgressEvent-expected.txt are updated. > > + > > Did we used to allow these events to be cancelled? If so, how important is it to maintain the backward compatibility? ProgressEvent spec released in April 2007(http://www.w3.org/TR/2007/WD-progress-events-20070419/) says "These events must not bubble, and must be cancelable.". Around the same time, these test cases too were added. After that, 5 more versions were released starting from October 2007(http://www.w3.org/TR/2007/WD-progress-events-20071023/) and all of them recommand to set 'cancelable' parameter to FALSE. However, the test cases were not updated following the spec changes. ProgressEvent specification hasn't changed 'cancelable' default value for a long time now and hence backward compatibility shouldn't be an issue, IMO.
Ryosuke Niwa
Comment 23 2013-05-29 00:23:14 PDT
(In reply to comment #22) > (In reply to comment #21) > > (From update of attachment 198222 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=198222&action=review > > > > > Source/WebCore/ChangeLog:10 > > > + Spec: https://dvcs.w3.org/hg/progress/raw-file/tip/Overview.html#suggested-names-for-events-using-the-progressevent-interface > > ok. I will update this in the next patch. > > > > > Please refer to a specific version of the spec. > > > > > Source/WebCore/ChangeLog:12 > > > + No new tests. file-reader-event-listener.html and infoOnProgressEvent-expected.txt are updated. > > > > It appears to me that we also need to add tests to ensure these events are indeed NOT cancelable (i.e. canceling event shouldn’t have any effect). > > The test cases are updated to check 'cancelable' value. I feel that covers all possible scenarios. It just tells us that the 'cancelable' returns the right value. It doesn't tell us that the event is not cancelable.
Praveen Jadhav
Comment 24 2013-05-29 22:30:27 PDT
Created attachment 203310 [details] Patch event.preventDefault() is called to update 'canceled flag' of the event after 'cancelable' is set to FALSE.
WebKit Commit Bot
Comment 25 2013-05-29 23:04:17 PDT
Comment on attachment 203310 [details] Patch Clearing flags on attachment: 203310 Committed r150949: <http://trac.webkit.org/changeset/150949>
WebKit Commit Bot
Comment 26 2013-05-29 23:04:23 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.