Bug 178052 - Update Document.createEvent for recent DOM specification changes
Summary: Update Document.createEvent for recent DOM specification changes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Darin Adler
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-10-07 14:46 PDT by Darin Adler
Modified: 2017-10-07 16:45 PDT (History)
5 users (show)

See Also:


Attachments
Patch (24.33 KB, patch)
2017-10-07 14:58 PDT, Darin Adler
cdumez: review+
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews115 for mac-elcapitan (1.79 MB, application/zip)
2017-10-07 16:23 PDT, Build Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2017-10-07 14:46:45 PDT
Update Document.createEvent for recent DOM specification changes
Comment 1 Darin Adler 2017-10-07 14:58:41 PDT
Created attachment 323102 [details]
Patch
Comment 2 Build Bot 2017-10-07 16:23:05 PDT
Comment on attachment 323102 [details]
Patch

Attachment 323102 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/4790100

New failing tests:
imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-canceling.html
Comment 3 Build Bot 2017-10-07 16:23:07 PDT
Created attachment 323105 [details]
Archive of layout-test-results from ews115 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews115  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 4 Chris Dumez 2017-10-07 16:29:36 PDT
(In reply to Build Bot from comment #2)
> Comment on attachment 323102 [details]
> Patch
> 
> Attachment 323102 [details] did not pass mac-debug-ews (mac):
> Output: http://webkit-queues.webkit.org/results/4790100
> 
> New failing tests:
> imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-
> documents/beforeunload-canceling.html

This is actually a new PASS:
--- /Volumes/Data/EWS/WebKit/WebKitBuild/Debug/layout-test-results/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-canceling-expected.txt
+++ /Volumes/Data/EWS/WebKit/WebKitBuild/Debug/layout-test-results/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-canceling-actual.txt
@@ -2,7 +2,7 @@
 PASS Returning a string must not cancel the event: CustomEvent, non-cancelable 
 PASS Returning a string must not cancel the event: CustomEvent, cancelable 
 FAIL Returning false must not cancel the event, because it's coerced to the DOMString "false" which does not cancel CustomEvents: CustomEvent, cancelable assert_false: The event must not have been canceled expected false got true
-FAIL Returning a string must not cancel the event: BeforeUnloadEvent with type "click", cancelable The operation is not supported.
+PASS Returning a string must not cancel the event: BeforeUnloadEvent with type "click", cancelable 
 PASS Returning null with a real iframe unloading 
 PASS Returning undefined with a real iframe unloading 
 PASS Returning  with a real iframe unloading
Comment 5 Chris Dumez 2017-10-07 16:38:03 PDT
Comment on attachment 323102 [details]
Patch

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

I had not touched this area because last time I checked, browsers disagreed with the specification and behaved widely differently. Also, the spec did not make sense in some cases. However, the changes here make sense. r=me

> Source/WebCore/dom/Document.cpp:4273
> +    if (equalLettersIgnoringASCIICase(type, "beforeunloadevent"))

I have confirmed that beforeunloadevent is supported by both Firefox and Chrome.

> Source/WebCore/dom/Document.cpp:4279
> +    if (equalLettersIgnoringASCIICase(type, "event") || equalLettersIgnoringASCIICase(type, "events") || equalLettersIgnoringASCIICase(type, "htmlevents") || equalLettersIgnoringASCIICase(type, "svgevents"))

I have confirmed that svgevents is supported by both Firefox and Chrome.

> Source/WebCore/dom/Document.cpp:4281
> +    if (equalLettersIgnoringASCIICase(type, "focusevent"))

I have confirmed that focus event is supported by both Firefox and Chrome.

> Source/WebCore/dom/Document.cpp:4329
> +    if (equalLettersIgnoringASCIICase(type, "keyboardevents"))

Looks like Chrome dropped it already, Firefox did not.

> Source/WebCore/dom/Document.cpp:4335
> +    if (equalLettersIgnoringASCIICase(type, "popstateevent"))

Looks like Firefox dropped it already, Chrome did not.
Comment 6 Darin Adler 2017-10-07 16:40:36 PDT
Comment on attachment 323102 [details]
Patch

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

>> Source/WebCore/dom/Document.cpp:4329
>> +    if (equalLettersIgnoringASCIICase(type, "keyboardevents"))
> 
> Looks like Chrome dropped it already, Firefox did not.

I am guessing the Chrome team researched whether this was actually used on the web and that’s why Hixie moved it to unsupported but did not move "MouseEvents" to unsupported.
Comment 7 Darin Adler 2017-10-07 16:43:06 PDT
Comment on attachment 323102 [details]
Patch

Side note: Honestly if it was up to me I would not want us (all browser vendors) adding these new strings for createEvent. The function makes broken events with a type string that is the empty string and other peculiarities. I can’t see why adding new ones has value going forward.
Comment 8 Darin Adler 2017-10-07 16:44:50 PDT
Committed r223023: <http://trac.webkit.org/changeset/223023>
Comment 9 Radar WebKit Bug Importer 2017-10-07 16:45:39 PDT
<rdar://problem/34873817>