Closed Bug 389151 Opened 17 years ago Closed 17 years ago

[FIX]Removing iframe with javascript: URL can cause the javascript: URL to open in a new window

Categories

(Core :: DOM: Core & HTML, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha8

People

(Reporter: jruderman, Assigned: bzbarsky)

References

Details

(Keywords: testcase, Whiteboard: [sg:low] post-1.8-branch)

Attachments

(2 files)

Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.9a7pre) Gecko/2007072101 Minefield/3.0a7pre

Security-sensitive because this could allow sites to get around popup blocking.
Flags: blocking1.9?
There's a slight difference in behavior between tabs and windows.  If you have Firefox set to open popups as windows, you'll get windows saying "x FAIL", but if you have it set to open them as tabs, you'll get blank tabs.
Hmm.  This is fun.  Basically, we can't handle the load in the docshell that we started it in, but still try to do the load (this sounds like a bug to me, one which I should look into).  So we try to look for another place to handle the load, and the Firefox UI helpfully opens up a new window or tab to do it in.  The js stack to the tab opening is:

0 [native frame]
1 addTab(aURI = "about:blank", aReferrerURI = null, aCharset = null, aPostData = null, aOwner = [object XULElement @ 0x92632d0 (native @ 0x92632a0)], aAllowThirdPartyFixup = false, attrChanged = [function]) ["chrome://global/content/bindings/tabbrowser.xml":1224]
2 loadOneTab(aURI = "about:blank", aReferrerURI = null, aCharset = null, aPostData = null, aLoadInBackground = false, aAllowThirdPartyFixup = false) ["chrome://global/content/bindings/tabbrowser.xml":1078]
3 anonymous(aURI = [xpconnect wrapped nsIURI @ 0xab882748 (native @ 0x8818df4)], aOpener = null, aWhere = 3, aContext = 1) ["chrome://browser/content/browser.js":3476]
4 [native frame]
5 handURIToExistingBrowser(uri = [xpconnect wrapped nsIURI @ 0x8d392d0 (native @ 0x8818df4)], location = 0, cmdLine = null) ["file:///home/bzbarsky/mozilla/vanilla/obj-firefox/dist/bin/components/nsBrowserContentHandler.js":588]
6 bch_handleContent(contentType = "text/html", context = [xpconnect wrapped nsIInterfaceRequestor @ 0x8ccc358 (native @ 0xab8eb0e4)], request = [xpconnect wrapped (nsISupports, nsIRequest, nsIChannel) @ 0x889e340 (native @ 0xaba22720)]) ["file:///home/bzbarsky/mozilla/vanilla/obj-firefox/dist/bin/components/nsBrowserContentHandler.js":531]
Attached patch Proposed patch (deleted) — Splinter Review
The loadgroup was getting canceled after we'd already started up the string channel... This makes sure we get canceled properly in that case.

Jesse, is this trunk-only?  I would assume it is...
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Attachment #273324 - Flags: superreview?(cbiesinger)
Attachment #273324 - Flags: review?(cbiesinger)
On branch you'd want to test without the 5ms timeout, probably, since javascript: is sync there.
Component: Embedding: Docshell → DOM
OS: Mac OS X → All
Priority: -- → P1
QA Contact: docshell → general
Hardware: PC → All
Summary: Removing iframe with javascript: URL can cause the javascript: URL to open in a new window → [FIX]Removing iframe with javascript: URL can cause the javascript: URL to open in a new window
Target Milestone: --- → mozilla1.9beta1
I can't reproduce in Firefox 2.0.0.5.  I tried a timeout of 5ms, a timeout of 0ms, and no timeout.
Whiteboard: [sg:low] post-1.8-branch
Comment on attachment 273324 [details] [diff] [review]
Proposed patch

I wouldn't bother with remembering listener->OnStopRequest()s return value in OnStopRequest, errors from here are ignored anyway
Attachment #273324 - Flags: superreview?(cbiesinger)
Attachment #273324 - Flags: superreview+
Attachment #273324 - Flags: review?(cbiesinger)
Attachment #273324 - Flags: review+
Fixed.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Flags: blocking1.9?
Flags: wanted1.8.1.x-
Flags: wanted1.8.0.x-
Group: security
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: