Open Bug 707154 Opened 13 years ago Updated 2 years ago

Dynamic script tags that are removed are still executed once script source is received

Categories

(Core :: DOM: Core & HTML, defect, P5)

x86
macOS
defect

Tracking

()

People

(Reporter: dynalon, Unassigned)

References

Details

Attachments

(2 files)

User Agent: Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; de) Presto/2.9.168 Version/11.52 Steps to reproduce: This is not an actual bug, but a request to re-open a bugreport that is 4 years old, see here: https://bugzilla.mozilla.org/show_bug.cgi?id=394908 I've commented on that bug more than a week ago with a request for re-open. I've specified all details and reason for reopen in the linked bug. However, it seems since this bug is so old, none of the devs which are on the CC list exist anymore - at least there was no response or reopening. Please reopen the linked bugreport. Actual results: . Expected results: .
Attached file Testcase
It's better to deal with this here, actually; less noise. On the attached testcase, I see the following behavior: we always execute the script, WebKit (Chrome dev) sometimes executes the script, Opera never executes the script, IE9 never executes the script. The relevant spec is starting at http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#script-processing-src-prepare which is where the load is kicked off (see the "resource must be fetched" bit). The script is not parser-inserted, so once the fetch is complete step 15 ends up at <http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#script-processing-src-sync>. This says to run the script, period. No provisions for it not being in the DOM. So as far as I can tell our implementation is following the spec correctly. But given what other implementations do, maybe the spec needs changing here. Jonas?
Status: UNCONFIRMED → NEW
Component: General → DOM
Ever confirmed: true
QA Contact: general → general
I suspect we should just bring this to the list to see what other vendors want to do. I personally weakly prefer our behavior since it's less racy. If you insert a <script> element in the document there's a risk that it will execute before you have a chance to remove it. Unless you remove it from the DOM before returning to the event loop.
And in Chrome at least there's a chance even then; see my comments above.
In any case, can you please handle the spec-wrangling here?
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.