RESOLVED FIXED 227016
Document's execCommand() / queryCommand*() should throw an exception on non-HTML/XHTML documents
https://bugs.webkit.org/show_bug.cgi?id=227016
Summary Document's execCommand() / queryCommand*() should throw an exception on non-H...
zyscoder@gmail.com
Reported 2021-06-14 23:10:17 PDT
Steps to reproduce: (1) Open a tab and navigate to any URL; (2) Open Devtools and run the following code in the Console: ``` new Document().queryCommandSupported('str'); ``` Actual results: This code would be evaluated successfully and return a value of false, without throwing any exceptions. Expected results: Both in Chrome and Firefox throw expcetions: Chrome: `DOMException: Failed to execute 'queryCommandSupported' on 'Document': queryCommandSupported is only supported on HTML documents.` Firefox: `queryCommandSupported is only supported on HTML documents.` It seems better to align with Chrome and Firefox.
Attachments
Patch (15.37 KB, patch)
2021-06-16 09:59 PDT, Chris Dumez
ews-feeder: commit-queue-
Patch (19.26 KB, patch)
2021-06-16 10:31 PDT, Chris Dumez
no flags
Patch (50.35 KB, patch)
2021-06-16 11:42 PDT, Chris Dumez
no flags
Patch (53.58 KB, patch)
2021-06-16 11:45 PDT, Chris Dumez
no flags
Patch (60.67 KB, patch)
2021-06-16 15:25 PDT, Chris Dumez
no flags
Patch (82.20 KB, patch)
2021-06-16 15:32 PDT, Chris Dumez
ews-feeder: commit-queue-
Chris Dumez
Comment 1 2021-06-16 09:59:47 PDT
Chris Dumez
Comment 2 2021-06-16 10:31:59 PDT
EWS Watchlist
Comment 3 2021-06-16 10:32:46 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See https://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Chris Dumez
Comment 4 2021-06-16 11:42:35 PDT
Chris Dumez
Comment 5 2021-06-16 11:45:50 PDT
Darin Adler
Comment 6 2021-06-16 14:51:44 PDT
Comment on attachment 431577 [details] Patch Why are we keeping all these pointless calls to execCommand in SVG tests?
Chris Dumez
Comment 7 2021-06-16 14:58:27 PDT
(In reply to Darin Adler from comment #6) > Comment on attachment 431577 [details] > Patch > > Why are we keeping all these pointless calls to execCommand in SVG tests? Fair point, I hesitated. I think I'll drop them then.
Chris Dumez
Comment 8 2021-06-16 15:25:25 PDT
Chris Dumez
Comment 9 2021-06-16 15:32:09 PDT
Chris Dumez
Comment 10 2021-06-16 22:40:00 PDT
Radar WebKit Bug Importer
Comment 11 2021-06-16 22:40:25 PDT
Nikolas Zimmermann
Comment 12 2021-07-07 06:15:41 PDT
This broke most SVG text selection tests in LayoutTests/svg/text -- but it was hard to notice, since the failures are only visible when running pixel tests. They need to be converted to ref tests in the future :-( Anyhow, the purpose of the tests e.g. text-align-01-b.svg is to select all text and verify that the selection rects are correct -- now no more text is selected. How to select all text in SVG documents w/o using execCommand?
Nikolas Zimmermann
Comment 13 2021-07-07 06:16:49 PDT
Here's a full list of affected tests: svg/text/foreignObject-text-clipping-bug.xml svg/text/text-align-01-b.svg svg/text/text-align-02-b.svg svg/text/text-align-03-b.svg svg/text/text-align-04-b.svg svg/text/text-align-05-b.svg svg/text/text-align-06-b.svg svg/text/text-deco-01-b.svg svg/text/text-fonts-01-t.svg svg/text/text-fonts-02-t.svg svg/text/text-intro-05-t.svg svg/text/text-path-01-b.svg svg/text/text-spacing-01-b.svg svg/text/text-text-01-b.svg svg/text/text-text-03-b.svg svg/text/text-text-04-t.svg svg/text/text-text-05-t.svg svg/text/text-text-07-t.svg svg/text/text-text-08-b.svg svg/text/text-tref-01-b.svg svg/text/text-tselect-01-b.svg svg/text/text-tspan-01-b.svg svg/text/text-ws-01-t.svg svg/text/text-ws-02-t.svg
Chris Dumez
Comment 14 2021-07-07 08:23:01 PDT
(In reply to Nikolas Zimmermann from comment #12) > This broke most SVG text selection tests in LayoutTests/svg/text -- but it > was hard to notice, since the failures are only visible when running pixel > tests. > > They need to be converted to ref tests in the future :-( > Anyhow, the purpose of the tests e.g. text-align-01-b.svg is to select all > text and verify that the selection rects are correct -- now no more text is > selected. How to select all text in SVG documents w/o using execCommand? I guess that's not something that's supported in other browsers (selecting all text in an SVG document). It looks like the tests in questions were dropped in Blink. Instead of dropping them, I intentionally dropped the selection logic from those tests.
Note You need to log in before you can comment on or make changes to this bug.