Closed Bug 357437 Opened 18 years ago Closed 18 years ago

[FIX]Middle clicking bookmark with javascript URL fails

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: ria.klaassen, Assigned: bzbarsky)

References

()

Details

(Keywords: regression)

Attachments

(1 file)

Steps to reproduce: 1. Make bookmark with something like javascript:location.href='http://forums.mozillazine.org/viewforum.php?f=19' 2. Middle click it in order to open it in a new tab Result: fails (opens empty tab instead) Expected result: should open bookmark in new tab like usually Errors like: Error: location is not defined Source File: location.href='http://forums.mozillazine.org/viewforum.php?f=19' Line: 1 or Error: window is not defined Source File: q=(window.getSelection)?window.getSelection():window.selection.createRange().text;if(!q)q=prompt('Search:','');if(q)location.href='http://www.google.nl/search?q='+escape(q); Line: 1 Regression between 1.9a1_2006101614 and 1.9a1_2006101623: http://bonsai.mozilla.org/cvsquery.cgi?module=PhoenixTinderbox&date=explicit&mindate=2006-10-16+13%3A00&maxdate=2006-10-17+00%3A00
To make it more complicated: it does not *always* fail, but mostly.
So the problem is that we start the about:blank load in the new tab from the frame loader, then start the javascript: load (which picks up the _current_ about:blank principal, the one from CreateAboutBlankContentViewer()). The javascript: load doesn't stop the about:blank load (due to the patch for bug 130265, which I still think is wrong... because it makes us incompatible with other browsers). Then the about:blank load completes, then the javascript: load completes. Now the principals don't match, so we evaluate the javascript: load in a sandbox and you get the described problem. Oh, the reason there's an in-progress about:blank load is that web content expects <iframe onload="foo()"> (without an src attr) to fire the onload handler. Solutions I see: 1) Make javascript: stop other loads like it does in IE (back out bug 130265). 2) Stop doing fake about:blank loads for chrome (or XUL, or "chrome XUL") iframes. 3) Change whatever code runs onclick here to stop() the load. Probably the tabbrowser's addTab() should do that, in fact... Thoughts?
Flags: blocking1.9?
1) sounds like the best approach here IMO. I don't remember the details about that bug, even after reading through a good bit of it, but compatibility with IE and other browser outweighs quite a lot, so I'd vote for this approach.
Well... As far as compat goes I'm not sure it gives compat with Opera, and I'm not sure about IE7. It does give compat with IE6, but I recall hearing rumors that the IE7 behavior is different. What that bug was about, fwiw, is that clicking a javascript: link (or a bookmarklet) stopped the current document load even if the link just ran a function that did nothing else...
I like the fact that bug 130265 is fixed -- it lets me click things like bookmarklets and "javascript:window.open()" links in web pages without stopping the page load. So I'd prefer (2) or (3), I guess.
(In reply to comment #2) > 3) Change whatever code runs onclick here to stop() the load. Probably the > tabbrowser's addTab() should do that, in fact... Doesn't seem to help. I also tried adding stop() to nsBrowserAccess too.
Attached patch FixSplinter Review
This does option #3. As Jesse pointed out, this is all a non-issue for trusted content, since about:blank inherits the parent principal there. So this is probably the way to go, unless people feel #2 is better.
Assignee: general → bzbarsky
Status: NEW → ASSIGNED
Comment on attachment 244018 [details] [diff] [review] Fix Gavin, wanna review the toolkit change? Neil, same for xpfe?
Attachment #244018 - Flags: superreview?(neil)
Attachment #244018 - Flags: review?(gavin.sharp)
OS: Windows XP → All
Priority: -- → P1
Hardware: PC → All
Summary: Middle clicking bookmark with javascript URL fails → [FIX]Middle clicking bookmark with javascript URL fails
Target Milestone: --- → mozilla1.9alpha
OS: All → Windows XP
Priority: P1 → --
Hardware: All → PC
Target Milestone: mozilla1.9alpha → ---
Attachment #244018 - Flags: review?(gavin.sharp) → review+
Ctho, whatever browser settings let you have that mid-air... please fix them.
OS: Windows XP → All
Priority: -- → P1
Hardware: PC → All
Target Milestone: --- → mozilla1.9alpha
Attachment #244018 - Flags: superreview?(neil) → superreview+
Fixed.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Flags: blocking1.9?
Resolution: --- → FIXED
Could you also check this in on the 1.8 branch? This problem is still present in the latest Firefox 2.0.0.2 RC. http://forums.mozillazine.org/viewtopic.php?t=502130
That's up to the module owners. I don't feel confident enough in this patch to land it on stable branches.
Actually, the original problem reported here was a trunk-only regression, so whatever you're seeing in that topic thread is a different bug. If it's a regression on the branch from 2.0.0.1 (which is what th thread says), please file the new bug and cc me. If you can figure out the regression range on branch, that would go a long way toward resolving the issue.
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: