Closed Bug 450191 Opened 13 years ago Closed 13 years ago

"ASSERTION: too late to set quirks style sheet" with document.write

Categories

(Core :: CSS Parsing and Computation, defect, P3)

x86
All
defect

Tracking

()

VERIFIED FIXED
mozilla1.9.1b3

People

(Reporter: jruderman, Assigned: dbaron)

References

(Blocks 1 open bug, )

Details

(4 keywords)

Attachments

(2 files, 1 obsolete file)

Attached file testcase
###!!! ASSERTION: too late to set quirks style sheet: '!mRuleCascades', file /Users/jruderman/central/mozilla/layout/style/nsCSSRuleProcessor.h, line 101

One of the patches in bug 448281 added this assertion.  I'm hitting it at http://htmledit.squarefree.com/ and at https://mail.google.com/mail/.  The testcase is reduced from http://htmledit.squarefree.com/.
This looks like a real issue.  The compat mode of a document can go from quirks to standards or vice versa as a result of document.write.

We should probably clear rule cascades in OpenCommon or something along those lines...
Flags: blocking1.9.1?
OS: Mac OS X → All
Flags: blocking1.9.1? → blocking1.9.1+
Priority: -- → P3
Blocks: acid3
Assignee: nobody → dbaron
So I'm actually thinking maybe we should just make this work... although I'm wondering why it doesn't work already, given that mQuirkStyleSheet->SetEnabled(aEnable) ought to call ClearRuleCascades.
Attached patch work in progress (obsolete) — Splinter Review
Here's a patch that I was hoping would work... but it doesn't, I think because cloning sheets with children doesn't set up clones of the children, which means that ClearRuleCascades chaining up to the parent doesn't work.  That seems like a pretty major bug, although I'm not very good at remembering what situations we use cloning for.  Are there ever any sheets other than UA sheets that can be cloned such that the clones are in different documents or in different levels of the cascade?
We use cloning for chrome sheets and for sheets linked from a given document that have the same URI.

I don't think that clones can ever be in different levels of the cascade, and other than UA sheets (and possibly XBL resource sheets?  not sure) they can't be in different documents.
Blocks: 461955
Boris, what's the status here after bug 454578 landed?
I think that should make the "work in progress" patch do the right thing now, at first glance...
Attached patch patchSplinter Review
indeed
Attachment #341676 - Attachment is obsolete: true
Attachment #348677 - Flags: superreview?(bzbarsky)
Attachment #348677 - Flags: review?(bzbarsky)
Comment on attachment 348677 [details] [diff] [review]
patch

>+++ b/layout/style/nsCSSRuleProcessor.h
>+    NS_ASSERTION(!mRuleCascades, 
>+                 "can't quirks style sheet without clearing rule cascades");

"can't toggle" maybe?

r+sr=bzbarsky
Attachment #348677 - Flags: superreview?(bzbarsky)
Attachment #348677 - Flags: superreview+
Attachment #348677 - Flags: review?(bzbarsky)
Attachment #348677 - Flags: review+
Whiteboard: [needs landing]
Fixed in mozilla-central (and thus also on mozilla-1.9.1):
http://hg.mozilla.org/mozilla-central/rev/951de4bb933c
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [needs landing]
Target Milestone: --- → mozilla1.9.1
Target Milestone: mozilla1.9.1 → mozilla1.9.1b3
Flags: in-testsuite?
Oh, the patch included a test.
Flags: in-testsuite? → in-testsuite+
Duplicate of this bug: 387872
verified FIXED on builds: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2a1pre) Gecko/20090414 Minefield/3.6a1pre ID:20090414030735

and

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b4pre) Gecko/20090414 Shiretoko/3.5b4pre ID:20090414035212
Status: RESOLVED → VERIFIED
Blocks: 147691
You need to log in before you can comment on or make changes to this bug.