Closed Bug 1459309 Opened 6 years ago Closed 6 years ago

currentScript should be null when evaluating scripts from shadow DOM

Categories

(Core :: DOM: Core & HTML, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: smaug, Assigned: smaug)

Details

Attachments

(1 file)

Fixing also the test.
Better to null check before accessing the variable and there are two tests with the same name and there is a warning about that in the console.

remote: 
remote: View your change here:
remote:   https://hg.mozilla.org/try/rev/258d3457761190cebc4f2dbf413961a750366a94
remote: 
remote: Follow the progress of your build on Treeherder:
remote:   https://treeherder.mozilla.org/#/jobs?repo=try&revision=258d3457761190cebc4f2dbf413961a750366a94
remote: recorded changegroup in replication log in 0.100s
Attachment #8973311 - Flags: review?(peterv)
Priority: -- → P2
Comment on attachment 8973311 [details] [diff] [review]
shadow_current_script.diff

Review of attachment 8973311 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/script/ScriptLoader.h
@@ +57,5 @@
>        , mScriptLoader(aScriptLoader)
>      {
> +      nsCOMPtr<nsINode> node = do_QueryInterface(aCurrentScript);
> +      mScriptLoader->mCurrentScript =
> +        node && !node->IsInShadowTree() ? aCurrentScript : nullptr;

Hmm, not sure how node can be null here?
Attachment #8973311 - Flags: review?(peterv) → review+
Because when dealing with JS modules, aCurrentScript is null.
oh, I never landed this
Pushed by opettay@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/29b727bc2caa
currentScript should be null when evaluating scripts from shadow DOM, r=peterv
Created web-platform-tests PR https://github.com/w3c/web-platform-tests/pull/11119 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
https://hg.mozilla.org/mozilla-central/rev/29b727bc2caa
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: