document.currentScript must be null when we're executing a script inside a shadow...
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 May 2016 18:19:44 +0000 (18:19 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 May 2016 18:19:44 +0000 (18:19 +0000)
commit2483b517a14e40094b160086fc56779436397ec1
tree670e56f0f8d585542931cfecf330d3e06ae85e35
parent6061458827b8fa72dd8790aea3834e8ddaef2978
document.currentScript must be null when we're executing a script inside a shadow tree
https://bugs.webkit.org/show_bug.cgi?id=157245

Reviewed by Darin Adler.

Source/WebCore:

Fix the bug by not setting currentScript as spec'ed in HTML5 specification:
https://html.spec.whatwg.org/multipage/dom.html#dom-document-currentscript
https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block
as of 3dc763829ca1598427b588cf08830c1e2af5a05c

New behavior matches that of Google Chrome Canary.

Test: fast/shadow-dom/Document-prototype-currentScript.html

* dom/CurrentScriptIncrementer.h:
(WebCore::CurrentScriptIncrementer::CurrentScriptIncrementer):
(WebCore::CurrentScriptIncrementer::~CurrentScriptIncrementer):
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::executeScript):

LayoutTests:

Add a W3C style testharness.js test.

* fast/shadow-dom/Document-prototype-currentScript-expected.txt: Added.
* fast/shadow-dom/Document-prototype-currentScript.html: Added.
* fast/shadow-dom/resources/Document-prototype-currentScript-helper.js: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@200327 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/shadow-dom/Document-prototype-currentScript-expected.txt [new file with mode: 0644]
LayoutTests/fast/shadow-dom/Document-prototype-currentScript.html [new file with mode: 0644]
LayoutTests/fast/shadow-dom/resources/Document-prototype-currentScript-helper.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/CurrentScriptIncrementer.h
Source/WebCore/dom/ScriptElement.cpp