Bug 164693 - document.currentScript should be null when running a script inside a shadow tree
Summary: document.currentScript should be null when running a script inside a shadow tree
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords: InRadar
Depends on:
Blocks: 148695
  Show dependency treegraph
 
Reported: 2016-11-12 16:51 PST by Ryosuke Niwa
Modified: 2016-11-13 00:58 PST (History)
8 users (show)

See Also:


Attachments
Fixes the bug (5.52 KB, patch)
2016-11-12 16:57 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2016-11-12 16:51:49 PST
document.currentScript should be null when running a script inside a shadow tree
instead of being set to the old script element waiting on that script to finish.

The following test is failing because of that:
imported/w3c/web-platform-tests/shadow-dom/Document-prototype-currentScript.html
Comment 1 Ryosuke Niwa 2016-11-12 16:57:56 PST
Created attachment 294642 [details]
Fixes the bug
Comment 2 Yusuke Suzuki 2016-11-12 18:11:37 PST
Comment on attachment 294642 [details]
Fixes the bug

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

r=me

> Source/WebCore/dom/CurrentScriptIncrementer.h:46
> +        m_document.pushCurrentScript(scriptElement.isInShadowTree() ? nullptr : &scriptElement);

Later, it will be extended to handle module script elements.
Comment 3 Yusuke Suzuki 2016-11-12 18:13:02 PST
Comment on attachment 294642 [details]
Fixes the bug

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

r=me

>> Source/WebCore/dom/CurrentScriptIncrementer.h:46
>> +        m_document.pushCurrentScript(scriptElement.isInShadowTree() ? nullptr : &scriptElement);
> 
> Later, it will be extended to handle module script elements.

Later, it will be extended to handle module script elements.
Comment 4 Ryosuke Niwa 2016-11-12 18:22:36 PST
Comment on attachment 294642 [details]
Fixes the bug

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

>>> Source/WebCore/dom/CurrentScriptIncrementer.h:46
>>> +        m_document.pushCurrentScript(scriptElement.isInShadowTree() ? nullptr : &scriptElement);
>> 
>> Later, it will be extended to handle module script elements.
> 
> Later, it will be extended to handle module script elements.

Yup. Thanks for the review!
Comment 5 WebKit Commit Bot 2016-11-12 18:46:44 PST
Comment on attachment 294642 [details]
Fixes the bug

Clearing flags on attachment: 294642

Committed r208660: <http://trac.webkit.org/changeset/208660>
Comment 6 WebKit Commit Bot 2016-11-12 18:46:50 PST
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2016-11-13 00:58:39 PST
<rdar://problem/29237296>