Closed Bug 214081 Opened 21 years ago Closed 21 years ago

[FIX]Content sink can get confused about pending script loads

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla1.5beta

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

()

Details

Attachments

(3 files)

The basic problem is that the content sink has some logic to guess whether a
script will require the parser to be blocked.  Instead of guessing, it should
use something reliable like a return value or something....

In fact, the sane way to do this may be to move the parser blocking and
unblocking into the script element itself (sort of the way the stylesheet
linking stuff works).

I'll be attaching a minimal testcase reduced from that website
Summary: Content sink can get confused about pending sheet loads → Content sink can get confused about pending script loads
Blocks: 153600
Attached file JS for testcase
Attached file Testcase
This should actually finish loading and show some text or something.
Blocks: 213992
Attachment #128643 - Flags: superreview?(jst)
Attachment #128643 - Flags: review?(bugmail)
Severity: normal → major
Priority: -- → P1
Summary: Content sink can get confused about pending script loads → [FIX]Content sink can get confused about pending script loads
Target Milestone: --- → mozilla1.5beta
Attachment #128643 - Flags: superreview?(jst) → superreview?(peter)
Comment on attachment 128643 [details] [diff] [review]
Or we could take the hacks out and actually fire ScriptAvailable like we're supposed to

- In nsHTMLScriptElement::MaybeProcessScript():

-  if (mIsEvaluated || mEvaluating || !mDocument || !mParent ||
-      !mDocument->IsScriptEnabled()) {
+  if (mIsEvaluated || mEvaluating || !mDocument || !mParent) {
     return;
   }

Don't we still want the !mDocument->IsScriptEnabled() check here? W/o that
check, a script element that's added to a document where scripts are disabled
(from a window where scripts are enabled) could still cause the script to load
(though not execute), right?
No.  Notice that the ScriptLoader does this check with this patch and if scripts
are disabled just bails (but notifies ScriptAvailable with an error, unblocking
the parser, which is key -- otherwise disabling scripts means you can't load any
pages with a <script> tag in them).
Guys, any chance of reviews sometime today?  Like in the next 6-7 hours?
Comment on attachment 128643 [details] [diff] [review]
Or we could take the hacks out and actually fire ScriptAvailable like we're supposed to

r+sr=jst
Attachment #128643 - Flags: superreview?(peter)
Attachment #128643 - Flags: superreview+
Attachment #128643 - Flags: review?(bugmail)
Attachment #128643 - Flags: review+
Fixed.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
This caused regression bug 214874 -- scriptloader needs to check not only
whether scripts are enabled on the document, but also whether they are enabled
on the current scriptcontext.
Component: DOM: Core → DOM: Core & HTML
QA Contact: desale → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: