RESOLVED FIXED 148851
script.text shouldn't include text from non-direct children of the script element
https://bugs.webkit.org/show_bug.cgi?id=148851
Summary script.text shouldn't include text from non-direct children of the script ele...
Ryosuke Niwa
Reported 2015-09-04 16:49:20 PDT
See https://html.spec.whatwg.org/multipage/scripting.html#dom-script-text HTMLScriptElement.prototype.text must return the concatenation of the data of Text nodes that are its direct children, and must not include texts of other node types or non-direct child Text nodes. This bug was found by the newly added test: LayoutTests/http/tests/w3c/html/semantics/scripting-1/the-script-element/script-text.html
Attachments
Patch (4.21 KB, patch)
2015-10-07 11:35 PDT, Keith Rollin
no flags
Archive of layout-test-results from ews102 for mac-mavericks (633.96 KB, application/zip)
2015-10-07 12:08 PDT, Build Bot
no flags
Archive of layout-test-results from ews106 for mac-mavericks-wk2 (722.78 KB, application/zip)
2015-10-07 12:14 PDT, Build Bot
no flags
Patch (8.46 KB, patch)
2015-10-07 15:56 PDT, Keith Rollin
no flags
Patch (8.51 KB, patch)
2015-10-07 16:59 PDT, Keith Rollin
no flags
Patch (8.50 KB, patch)
2015-10-07 17:30 PDT, Keith Rollin
no flags
Radar WebKit Bug Importer
Comment 1 2015-09-04 16:49:36 PDT
Keith Rollin
Comment 2 2015-10-07 11:35:38 PDT
Chris Dumez
Comment 3 2015-10-07 11:46:29 PDT
Comment on attachment 262618 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=262618&action=review > Source/WebCore/ChangeLog:5 > + We usually put the radar link under the bugzilla one when there is one. > Source/WebCore/ChangeLog:8 > + Don't include text from non-direct children in script.text. Please provide a link to the spec that says that it is the right thing to do. Also please indicate the behavior of Chrome and Firefox to make sure this change is web-compatible. > Source/WebCore/dom/ScriptElement.cpp:386 > + for (Text* text = TextNodeTraversal::firstChild(m_element); text; text = TextNodeTraversal::nextSibling(*text)) auto* > LayoutTests/imported/w3c/ChangeLog:4 > + https://bugs.webkit.org/show_bug.cgi?id=148851 We usually put the radar link under the bugzilla one when there is one.
Build Bot
Comment 4 2015-10-07 12:08:22 PDT
Comment on attachment 262618 [details] Patch Attachment 262618 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/254840 New failing tests: fast/dom/script-getElementById-during-insertion.html
Build Bot
Comment 5 2015-10-07 12:08:26 PDT
Created attachment 262622 [details] Archive of layout-test-results from ews102 for mac-mavericks The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews102 Port: mac-mavericks Platform: Mac OS X 10.9.5
Build Bot
Comment 6 2015-10-07 12:14:04 PDT
Comment on attachment 262618 [details] Patch Attachment 262618 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/254854 New failing tests: fast/dom/script-getElementById-during-insertion.html
Build Bot
Comment 7 2015-10-07 12:14:08 PDT
Created attachment 262623 [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
Keith Rollin
Comment 8 2015-10-07 15:56:51 PDT
Chris Dumez
Comment 9 2015-10-07 16:24:00 PDT
Comment on attachment 262650 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=262650&action=review r=me with nit fix. > LayoutTests/fast/dom/script-subtext-in-script-elements.html:11 > + <div id="result">PASS</div> nit: I would mark this as FAIL initially... > LayoutTests/fast/dom/script-subtext-in-script-elements.html:17 > + script.appendChild(document.createTextNode("")); ... then set it to "PASS" here to make sure the script is executed.
Keith Rollin
Comment 10 2015-10-07 16:59:28 PDT
Chris Dumez
Comment 11 2015-10-07 17:01:26 PDT
Comment on attachment 262658 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=262658&action=review > LayoutTests/fast/dom/script-subtext-in-script-elements.html:16 > + document.getElementById('result').innerHTML = 'PASS'; Er, I meant in the script you're inserting. > LayoutTests/fast/dom/script-subtext-in-script-elements.html:19 > + script.appendChild(document.createTextNode("")); script.appendChild(document.createTextNode("document.getElementById('result').innerHTML = 'PASS'"));
Keith Rollin
Comment 12 2015-10-07 17:30:45 PDT
WebKit Commit Bot
Comment 13 2015-10-07 19:26:45 PDT
Comment on attachment 262660 [details] Patch Clearing flags on attachment: 262660 Committed r190703: <http://trac.webkit.org/changeset/190703>
WebKit Commit Bot
Comment 14 2015-10-07 19:26:52 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.