Closed Bug 85631 Opened 23 years ago Closed 20 years ago

nsStyleLinkElement::UpdateStylesheet should be aware of active previous loads

Categories

(Core :: DOM: CSS Object Model, defect, P3)

defect

Tracking

()

RESOLVED WONTFIX
mozilla1.5beta

People

(Reporter: peterv, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

(Keywords: testcase)

Attachments

(1 file)

Spin-off from bug 38761. Currently, UpdateStylesheet only removes a previous
stylesheet when it has fully loaded. It should cancel the load of a previous
stylesheet that hasn't. The hard part is knowing if the stylesheet is still
loading, using the StyleSheetLoaded callback doesn't work because the stylesheet
load might have failed. I have a somewhat working patch but it involves some
changes to the CSS loader that I'm not entirely happy about. I'll atach it when
I've cleaned it up.
If I had a document with two stylesheets, the first being a simple preferred 
stylesheet and the second being an alternate stylesheet that, being generated 
by a CGI script, took 30 seconds to load, and after loading this document I 
switched from the preferred stylesheet to the alternate stylesheet and then 
immediately back to the preferred stylesheet, so that the alternate stylesheet
didn't have time to download before needing to be cancelled, would that trigger
this bug?

If so, I'll go ahead and make a testcase at some point soon.
Keywords: qawanted
Hixie: no, this is for example when changing the link element's src attribute
(through the DOM) twice in a row. It'll start loading the stylesheet pointed to
by the first new value of src, and then start loading the stylesheet pointed to
by the second new value of src without stopping the first load. If the first
stylesheet has loaded, then it just replaces and all is good.

styleElement.src = "http://foo/A.css";
styleElement.src = "http://foo/B.css"; -> won't stop the loading of A.
Ah, ok. Thanks.
I've created an attachment with a testcase that reprocues the bug (for me at leat)
Build: 2001092803
Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:0.9.4+) Gecko/20010928The
javascript is encapsuled in a javafunction that is called as a onMouseover on
the body element. Any comments are very welcome, this is my very first bug testcase.
Keywords: testcase
Priority: -- → P3
Target Milestone: --- → mozilla1.1
Removing unneeded qawanted keyword; if you disagree please add it back and state
what you want from QA.
Keywords: qawanted
Target Milestone: mozilla1.1alpha → Future
Blocks: 107567
I'm sorta working on this stuff...
Assignee: peterv → bzbarsky
Priority: P3 → P2
Target Milestone: Future → mozilla1.3beta
Target Milestone: mozilla1.3beta → mozilla1.4beta
Priority: P2 → P3
Target Milestone: mozilla1.4beta → mozilla1.5beta
Blocks: 197942
Blocks: 224029
I've been thinking about this.  At this point, the bug does not really appear,
since the sheet is hooked up to the element at load start time, not load end
time.  So sheets can no longer race -- the last sheet to start loading is the
one hooked up to the element, period.

Now, I can certainly go and add some code to cancel the load of the previous
sheet.  But is that desirable?  Wouldn't we want to just keep loading it in the
background and have it cached for next time someone wants it?
Just let it load. Odds are you'll need it again soon anyway.
So in other words, I think the changes I made in bug 107567 fix this bug.
Marking wontfix, per discussion.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: