Closed
Bug 47734
Opened 25 years ago
Closed 22 years ago
DOM StyleSheets collection inaccurate if retrieved during page load [AltSS]
Categories
(Core :: DOM: CSS Object Model, defect, P3)
Core
DOM: CSS Object Model
Tracking
()
RESOLVED
FIXED
Future
People
(Reporter: tim, Assigned: jst)
References
()
Details
(Keywords: dom2, Whiteboard: relnote-user)
(this requires the latest build with author stylesheet support, or the patch in
bug 6782)
1. Go to http://www.fas.harvard.edu/~dbaron/css/ssui/
2. While the page is loading, select the View > Use Stylesheet item to show a
list of alternate stylesheets for the page. Only some of the stylesheets will
be shown.
3. Then wait for the entire page to load. Go to View > Use Stylesheet again to
view the list.
Actual Results:
- Not all of the alternate stylesheets for the page are shown, even though the
page is now fully loaded. (If you wait for the page to completely load before
accessing the menu, all stylesheets ARE shown correctly)
Expected Results:
- All alternate stylesheets should be shown.
The "Use Stylesheet" menu generates the list of alternate stylesheets using the
document.styleSheets property each time the menu pops up. But once you access
the document.styleSheets collection for the first time (i.e. during page load),
it seems to keep the same list in memory until the page is reloaded.
Confirming bug because someone else had the same problem... and to test my
newfound Bugzilla permissions!
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Comment 2•25 years ago
|
||
This bug has been marked "future" because the original netscape engineer
working on this is over-burdened. If you feel this is an error, that you or
another known resource will be working on this bug,or if it blocks your work
in some way -- please attach your concern to the bug for reconsideration.
Status: NEW → ASSIGNED
Target Milestone: --- → Future
Updated•24 years ago
|
Keywords: relnoteRTM
Comment 3•24 years ago
|
||
Taking QA since this is a DOM2 Style bug and I'm supposed to be getting into
DOM2 Style...
Keywords: correctness
QA Contact: vidur → ian
Updated•24 years ago
|
Whiteboard: relnote-user
Comment 4•24 years ago
|
||
(marking alternate style sheet bugs for easy tracking...)
Summary: DOM StyleSheets collection inaccurate if retrieved during page load → DOM StyleSheets collection inaccurate if retrieved during page load [ASS]
Summary: DOM StyleSheets collection inaccurate if retrieved during page load [ASS] → DOM StyleSheets collection inaccurate if retrieved during page load [AltSS]
Updated•24 years ago
|
Keywords: mozilla0.9
Updated•24 years ago
|
Component: DOM Level 2 → DOM Style
Comment 5•24 years ago
|
||
Taking QA Contact on all open or unverified DOM Style bugs...
Comment 6•24 years ago
|
||
WORKSFORME on Linux build 2001052621
Please verify...
Assignee | ||
Comment 7•24 years ago
|
||
I still see this problem.
Comment 8•23 years ago
|
||
*** Bug 111765 has been marked as a duplicate of this bug. ***
Comment 9•23 years ago
|
||
http://bugzilla.mozilla.org/showattachment.cgi?attach_id=59069
is a testcase for this bug as well (from bug 111765)
Comment 10•23 years ago
|
||
*** Bug 107118 has been marked as a duplicate of this bug. ***
Comment 11•23 years ago
|
||
My comments from bug 111765:
The problem is the following:
1) We defer alternate sheet loads. So when we create the nsDOMStyleSheetList
and it calls GetNumberOfStyleSheets the first time it gets 0.
2) The stylesheet list caches the 0 and only updates it if the StyleSheetAdded
callback is called.
This callback is never called if all the pending sheets are alternate sheets.
Worse, yet, if the remaining sheets are not all alternates there will be only
_one_ call to StyleSheetAdded, since the CSS loader will only set notification
to true on the last pending sheet. See
http://lxr.mozilla.org/seamonkey/source/content/html/style/src/nsCSSLoader.cpp#798
There is no real explanation for why we do it that way and I'm not sure what the
performance (or correctness) impact would be of notifying on all sheets here.
ccing pierre.
The two solutions I see would be the following:
1) Have the CSS loader_always_ file a notification on pending sheets (even if
they are all alternates) and have the nsDOMStyleSheetList set mLength to -1
instead of incrementing it when StyleSheetAdded is called
2) Have the CSS loader notify on all stylesheet insertions
Pierre? Thoughts?
Comment 12•23 years ago
|
||
The problem is that we have two kinds of observers but only one kind of
notification. The HTMLContentSink needs to be notified when a doc sheet is
inserted in the document in order to rebuild everything. The nsDOMStyleSheetList
needs to be notified when a sheet is linked to the document (which does not mean
that it will later be inserted in the cascade) in order to update its count.
As Boris pointed out, the current notifications only cover the first case.
A solution could be for the document to be notified when a sheet is loaded (see
the StyleSheetLoaded notification in nsICSSLoaderObserver) and forward this
notification to its |nsIDocumentObserver|s. It would allow nsDOMStyleSheetList
to set mLength to -1. The other observers could just ignore the notification.
We don't want to send the StyleSheetAdded notification on all stylesheets. It is
incorrect for alternate sheets to do that and it would hurt the performance quite
a bit.
Comment 13•22 years ago
|
||
Fixed for 1.3a by checkin for bug 107567
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•