Closed Bug 75623 Opened 23 years ago Closed 23 years ago

OnStartDocumentLoad() can be called >1 time

Categories

(Core :: DOM: Navigation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: waterson, Assigned: adamlock)

Details

Attachments

(3 files)

nsDocLoader::OnStartRequest() has logic that seems to be incorrect.
Specifically, I'm seeing OnStartDocumentLoad() called on a document more than
one time. What appears to be happening is that...

1. The main document's load group has no more URLs, but for some reason still
   considers itself to be busy. (My test case has three IFRAMEs; maybe it
   has something to do with that.)

2. The scrollbars on one of the IFRAMEs gets painted. This kicks off an image
   load to get the scrollbar's background image.

3. The load group's active count goes from zero to one.

This screws up the layout regression tests, and maybe other stuff. I think the
fix is simple; specifically, be sure to check that the load flags are set such
that this is a nsIRequest::LOAD_DOCUMENT_URI.
Sorry the patch is messy. It also includes what I believe to be valid cleanup:
the docloader shouldn't assume that requests are channels. (See bug 75576, e.g.)
The stuff relevant to this bug is moving the code that retrieves the |loadFlags|
in OnStartRequest(), and the additional check to make sure we're doing an
nsIRequest::LOAD_DOCUMENT_URI before calling OnStartDocumentLoad().
these changes look good and safe to me chris. sr=mscott
Instead of:

+        *getter_Copies(aStr) = nsCRT::strdup(NS_ConvertUCS2toUTF8(name).get());

you should use:

*getter_Copies(aStr) = ToNewUTF8String(nsLocalString(name));

That saves you a copy (#include "nsReadableUtils.h").
Fix checked in.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Sorry for the bustage. I did a half-assed job of incorporating jag's 
recommendation.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: