Closed Bug 285188 Opened 20 years ago Closed 20 years ago

nsFrameLoader::GetDocShell should not throw if it can create the docshell

Categories

(Core :: Layout: Images, Video, and HTML Frames, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.8beta2

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(1 file)

Right now, part of our recursion protection is in nsFrameLoader::EnsureDocShell.
 This means that GetDocShell can throw for no really good reason (and if this
happens during frame construction, the document the frame is in will suddenly
have no presentation at best or crash at worst).

I'm going to move all the recursion checking into a single method that's called
from LoadFrame().  Throwing from that method is fine.
Attached patch Patch.Splinter Review
This consolidates the recursion checking into a one function.  Actual code
changes were kept to a minimum.  They are:

1)  Return up front if it's not a content docshell, and use GetSameTypeParent
    throughout instead of checking type on everything in the parent chain by
    hand.
2)  If parentURI is not an nsIURL, get the spec from parentURI, not aURI as the

    code did (this was clearly a bug in the existing code).
3)  Switch some raw pointers to nsCOMPtr + swap(); the existing code was
    violating ownership rules...
Attachment #176616 - Flags: superreview?(jst)
Attachment #176616 - Flags: review?(jst)
Comment on attachment 176616 [details] [diff] [review]
Patch.

r+sr=jst
Attachment #176616 - Flags: superreview?(jst)
Attachment #176616 - Flags: superreview+
Attachment #176616 - Flags: review?(jst)
Attachment #176616 - Flags: review+
Fixed
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.8beta2
Note: this caused bug 303163.
Depends on: 303163
Product: Core → Core Graveyard
Component: Layout: HTML Frames → Layout: Images
Product: Core Graveyard → Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: