Closed Bug 888746 Opened 11 years ago Closed 11 years ago

browser_bug422590.js shouldn't use chrome-privileged window.open with toolbar=no

Categories

(Firefox :: Address Bar, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: Gijs, Assigned: Gijs)

References

Details

Attachments

(1 file, 1 obsolete file)

STR:

1. Open the browser console.
2. Run: window.open("http://www.mozilla.org", "_blank", "toolbar=no");

ER:
A window opens with no toolbar showing mozilla.org, and no errors occur.

AR:
A window opens with no toolbar showing mozilla.org, and this error appears in the console:

[19:35:57.146] this.editor is null @ chrome://browser/content/urlbarBindings.xml:161

The relevant line is:

          let controller = this.editor.selectionController;

in formatValue.

Patch coming up.

(we ran into this on Australis, but it happens on mozilla-central, too)
Attached patch Trivial wallpaper (obsolete) — Splinter Review
Attachment #769504 - Flags: review?(mnoorenberghe+bmo)
Comment on attachment 769504 [details] [diff] [review]
Trivial wallpaper

Review of attachment 769504 [details] [diff] [review]:
-----------------------------------------------------------------

r=me assuming tests pass.
Attachment #769504 - Flags: review?(mnoorenberghe+bmo) → review+
(In reply to Matthew N. [:MattN] from comment #2)
> Comment on attachment 769504 [details] [diff] [review]
> Trivial wallpaper
> 
> Review of attachment 769504 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> r=me assuming tests pass.

https://tbpl.mozilla.org/?tree=Try&rev=a76c0a0af79f

Accidentally pushed w/ UX + Jared's patch to lazily load stuff (without the backout; tbpl is misleading). :-\

Do you want another m-c-based try run?
That's probably fine. I just wanted to make sure this didn't somehow regress other tests.
Status: NEW → ASSIGNED
OS: Mac OS X → All
Hardware: x86 → All
Yes, I came to the same conclusion today but didn't get it on to Bugzilla quick enough! This is a problem that has existed for a while, and I ran in to it with bug 793715 (https://hg.mozilla.org/mozilla-central/rev/bf0aa600323f).

The deeper explanation of the test failing now is because we removed the secondary TabSelect and ProgressListener. The exception is happening previously (it's still there even after the backout) but the other onLocationChange caused us to still enter customization mode in the chromeless window. Now that the CustomizeMode change got rid of the second progress listener, when it fails it doesn't have a second chance to pick itself back up.
https://hg.mozilla.org/mozilla-central/rev/7965d384123c
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
OS: All → Mac OS X
Hardware: All → x86
Resolution: --- → FIXED
Comment on attachment 769504 [details] [diff] [review]
Trivial wallpaper

You should fix the test. We don't allow hiding the navigation toolbar and this.editor should never be null here. When you enter window.open("http://www.mozilla.org", "_blank", "toolbar=no"); in the browser console, you're running it with chrome privileges.
Attachment #769504 - Flags: review-
(In reply to Dão Gottwald [:dao] from comment #7)
> Comment on attachment 769504 [details] [diff] [review]
> Trivial wallpaper
> 
> You should fix the test. We don't allow hiding the navigation toolbar and
> this.editor should never be null here. When you enter
> window.open("http://www.mozilla.org", "_blank", "toolbar=no"); in the
> browser console, you're running it with chrome privileges.

Right, and so is the test. I don't know of a way to make that call run in-content from the mochitest's test script.

Additionally, I expect window.open has other chrome consumers (in add-ons or our own code) for whom breaking the onlocationchange function is harmful.
(In reply to Dão Gottwald [:dao] from comment #8)
> backed out:
> 
> https://hg.mozilla.org/mozilla-central/rev/35f1ddf84221
> https://hg.mozilla.org/mozilla-central/rev/5e66712edb18

Next time you back out, please use hg backout so you don't need a separate merge changeset, and reopen the bug.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Summary: JavaScript Error: this.editor is null when opening a window with toolbar=no → browser_bug422590.js shouldn't use chrome-privileged window.open with toolbar=no
So regarding the test... this sort of works, assuming window.content is actually not privileged:

let sandbox = Cu.Sandbox(window.content);
sandbox.window = window.content;
Cu.evalInSandbox("window.open('about:blank', '_blank', 'chrome,toolbar=no')", sandbox);


... except then the popup blocker screws us over and we don't get a new window. Ideas?
Flags: needinfo?(dao)
You could either disable the popup blocker or keep the call privileged and add location=yes.
Flags: needinfo?(dao)
Attached patch Fix test insteadSplinter Review
Attachment #769504 - Attachment is obsolete: true
Attachment #769656 - Flags: review?(dao)
Attachment #769656 - Flags: review?(dao) → review+
https://hg.mozilla.org/mozilla-central/rev/ffbdd1090cb8
Status: REOPENED → RESOLVED
Closed: 11 years ago11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: