Closed
Bug 1104732
Opened 10 years ago
Closed 9 years ago
DOMContentLoaded waits for slow async script when deferred script is in document
Categories
(Core :: DOM: HTML Parser, defect)
Tracking
()
RESOLVED
FIXED
mozilla41
Tracking | Status | |
---|---|---|
firefox41 | --- | fixed |
People
(Reporter: koch, Assigned: Gijs)
References
(Depends on 1 open bug)
Details
(Keywords: regression)
Attachments
(1 file)
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0 Build ID: 20141113143407 Steps to reproduce: I have an HTML file containing two script elements: one with async, one with defer. Response for the deferred script is quick, the response for the async script starts after some seconds. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>async</title> <script src="uick_defer.js" defer></script> <script src="lame_async" async></script> </head> <body> </body> </html> Actual results: DOMContentLoaded watis until the async script is available (or executed, I don't know). When I remove the script with defer, DOMContentLoaded does not wait for the async script. Expected results: DOMContentLoaded does not wait for the async script. This happened with older versions of Firefox (< 30?) and happens in e.g. Chrome.
Reporter | ||
Updated•10 years ago
|
Summary: DOMContentLoaded waits for async script → DOMContentLoaded waits for lame async script when deferred script is in document
Could you attach a simple self-contained testcase (or public URL) to show up the issue, please.
Flags: needinfo?(koch)
Keywords: testcase-wanted
Assignee | ||
Updated•10 years ago
|
Keywords: regression,
regressionwindow-wanted
Product: Firefox → Core
Summary: DOMContentLoaded waits for lame async script when deferred script is in document → DOMContentLoaded waits for slow async script when deferred script is in document
Reporter | ||
Comment 2•10 years ago
|
||
Testcases: <http://waldbaer.leute.server.de/DOMContentLoaded_defer_async/> The behaviour in the combined cases (both async and defer) is wrong. For comparision, I added single cases (only async or defer) as well.
Flags: needinfo?(koch)
Comment 3•10 years ago
|
||
Running "quick defer, lame async" of the Testcases before 9acc076ad18f Bug 688580: DOMContentLoaded -> "quick" -> "lame" after 9acc076ad18f Bug 688580: "quick" -> "lame" -> DOMContentLoaded Google Chrome: "quick" -> DOMContentLoaded -> "lame" Bug 688580 something wrong?
Blocks: 688580
Flags: needinfo?(bugs)
Updated•10 years ago
|
Component: Untriaged → HTML: Parser
Updated•9 years ago
|
Keywords: regressionwindow-wanted,
testcase-wanted
Came across this bug in FF Developer Channel. Why is it unconfirmed?
Comment 5•9 years ago
|
||
(In reply to iliakan from comment #4) > Came across this bug in FF Developer Channel. Why is it unconfirmed? In practice, we often don't bother marking bugs as confirmed, and being confirmed or not does not have a large impact on how people deal with the bug.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•9 years ago
|
Flags: needinfo?(bugs)
Assignee | ||
Comment 6•9 years ago
|
||
Bug 1104732 - having deferred scripts shouldn't cause async scripts to delay domcontentloaded, r?smaug
Assignee | ||
Comment 7•9 years ago
|
||
Comment on attachment 8612253 [details] MozReview Request: Bug 1104732 - having deferred scripts shouldn't cause async scripts to delay domcontentloaded, r?smaug By my "one random patch a day keeps the doctor away" maxim, here's today's. I *think* this is what we want. I added a test and that seems to work. I also checked the reporter's testcase which also seems fixed by this patch. Olli, does this look sane to you?
Attachment #8612253 -
Flags: review?(bugs)
Assignee | ||
Comment 8•9 years ago
|
||
Comment on attachment 8612253 [details] MozReview Request: Bug 1104732 - having deferred scripts shouldn't cause async scripts to delay domcontentloaded, r?smaug Bug 1104732 - having deferred scripts shouldn't cause async scripts to delay domcontentloaded, r?smaug
Updated•9 years ago
|
Attachment #8612253 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 11•9 years ago
|
||
I had to change this testcase because it oranged intermittently. async scripts aren't guaranteed to load after DOMContentLoaded - depending on timing, they could load before. This means we can't meaningfully assert much beyond that they should have loaded before onload. Test change: remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/bea6758824d9 I landed this because the tree got closed because of the intermittent, but I'd like to have feedback if there's something I'm missing, ie whether there *is* a way to test for this reliably...
Flags: needinfo?(bugs)
Comment 12•9 years ago
|
||
Hmm, indeed testing this reliably is hard since async may or may not be loaded before DOMContentLoaded, depending on what kind of network packages parser gets and what not. Don't have good ideas now how to improve the test. or perhaps, what if you had something like <script> document.write("<script async src='file_async_bug1104732.sjs"'></script>"); </script> right at the end of the html file. That might make the test reliable enough.
Flags: needinfo?(bugs)
Assignee | ||
Comment 13•9 years ago
|
||
Filed bug 1169660 for improving the test further.
Assignee: nobody → gijskruitbosch+bugs
Status: NEW → ASSIGNED
Comment 14•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/991331d28d8e https://hg.mozilla.org/mozilla-central/rev/bea6758824d9
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox41:
--- → fixed
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in
before you can comment on or make changes to this bug.
Description
•