Open Bug 314689 Opened 19 years ago Updated 2 years ago

nsCSSLoader::Stop should cancel the necko channels

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

People

(Reporter: bzbarsky, Unassigned)

Details

Right now it just sets a flag to drop the sheet on the floor whenever necko actually cought up the data...
So given that we're using a streamloader, is there a way to do this?
well, you could get the channel from the streamloader and cancel that.
OS: Linux → All
Hardware: PC → All
what biesi said.
That won't work. See http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/netwerk/base/public/nsIUnicharStreamLoader.idl&rev=1.10&mark=108-109#108 I suppose we could change that aspect of streamloader behavior...
I think you should hold a reference to the loadgroup that the channel is added to so you can just cancel the loadgroup instead of canceling the channel directly. That will handle redirects automatically for you. Since you are setting up the stream loader, you can arrange to hold a reference to the loadgroup from the start.
Canceling the loadgroup will cancel all loads for the document, not just the stylesheet loads... Granted, the common case of calling Stop() on the CSSLoader is when we're stopping loads for the document. But in that case this bug is already a non-issue.
Then use a separate LoadGroup for the CSS file and all of its dependencies? Stick that LoadGroup in the LoadGroup for the document?
That might work (have a separate loadgroup for the CSSLoader). The problem is knowing when to add it to the loadgroup for the document. Does calling AddRequest multiple times with the same request do the right thing?
No, you don't want to call AddRequest more than once.
I suppose I can ask my loadgroup whether it's in the document loadgroup... that might work.
Um... why do you need that? Why can't you just create a new loadgroup for each loader, and set the loadgroup's loadgroup to the document's loadgroup?
(the loadgroup takes care of adding itself to loadgroups, like all requests)
But a Stop() call would remove it.... I was planning on using a single loadgroup for the whole CSSLoader, basically. When starting a sheet load, add it to the document loadgroup if it's not already there, then add the sheet load to it.
Unless you mean a separate loadgroup for each _load_. In which case I have to keep track of them. And it seems like a waste...
Except that it seems that a document's loadgroup is possibly subject to change. :( So I do need to keep track of each load separately. :( Also, there's the issue of creating a strong ref from document to document loadgroup, which we avoid right now, I believe...
QA Contact: ian → style-system
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.