Closed Bug 796857 Opened 14 years ago Closed 13 years ago

Add-on SDK: winUtils.WindowTracker doesn't work always

Categories

(Add-on SDK Graveyard :: General, defect, P1)

defect

Tracking

(firefox16-, firefox17-, firefox18-, firefox19-)

RESOLVED WONTFIX
Tracking Status
firefox16 - ---
firefox17 - ---
firefox18 - ---
firefox19 - ---

People

(Reporter: o918734, Unassigned)

Details

(Keywords: addon-compat, regression, Whiteboard: regressed by bug 774633)

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:15.0) Gecko/20100101 Firefox/15.0.1 Build ID: 20120907231835 Steps to reproduce: 1. Create a new Add-on with the Add-on SDK 2. Write the following into lib/main.js: var delegate = {onTrack: function (window) {console.log("Track");}, onUntrack: function (window) {console.log("Untrack");}}; new require("window-utils").WindowTracker(delegate); let { open } = require('api-utils/window/utils'); open('http://mozilla.org'); 3. Test the Add-on with Firefox 16 Beta Notes: - The problem only appears on Firefox startup. - It works if you go to about:addons disable the Add-on and enable it again. - Something like open('data:text/html,Test'); works. Actual results: The onTrack-Callback is not called, when the window opens. The Callback is only called once on startup, because of the Firefox main window. Expected results: The onTrack-Callback should have called.
Correction: The problem appears always, not only on Firefox startup.
Component: Untriaged → General
Product: Firefox → Add-on SDK
Version: 16 Branch → unspecified
o918734@rtrtr.com, can you please attach the add-on that proves this issue here?
The add-on registers an windowTracker that prints the URLs of "tracked" windows to the console and then opens "http://www.mozilla.org" in a new window. The output should be something like: info: onTrack: undefined <-- Firefox Main Window info: onTrack: http://www.mozilla.org/en-US/ <-- Opened window On my installation of Firefox 16 only the first line appears.
Reproducible with the attached add-on on the 10/01 Nightly. o918734@rtrtr.com, thanks for uploading the add-on.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Regression window(Aurora channel) Good http://hg.mozilla.org/releases/mozilla-aurora/rev/c2cc63c864e4 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Firefox/17.0 ID:20120906042009 Bad: http://hg.mozilla.org/releases/mozilla-aurora/rev/41eab5a0e537 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Firefox/17.0 ID:20120907042009 Pushlog: http://hg.mozilla.org/releases/mozilla-aurora/pushloghtml?fromchange=c2cc63c864e4&tochange=41eab5a0e537 Regression window(Beta channel) Good http://hg.mozilla.org/releases/mozilla-beta/rev/dd8f72317c3f Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20120906 Firefox/16.0 ID:20120906142234 Bad: http://hg.mozilla.org/releases/mozilla-beta/rev/6fbaf3aed7a0 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20120907 Firefox/16.0 ID:20120907112417 Pushlog: http://hg.mozilla.org/releases/mozilla-beta/pushloghtml?fromchange=dd8f72317c3f&tochange=6fbaf3aed7a0 Regression window(m-c) Good: http://hg.mozilla.org/mozilla-central/rev/3974efe8d584 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/18.0 Firefox/18.0 ID:20120905165101 Bad: http://hg.mozilla.org/mozilla-central/rev/501f4e46a88c Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/18.0 Firefox/18.0 ID:20120905192801 Pushlog: http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=e3e594837a30&tochange=75af94f85a98 Regression window(m-i) Good: http://hg.mozilla.org/integration/mozilla-inbound/rev/8d5589b88c8b Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/18.0 Firefox/18.0 ID:20120905103804 Bad: http://hg.mozilla.org/integration/mozilla-inbound/rev/cfc884e6e414 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/18.0 Firefox/18.0 ID:20120905113502 Pushlog: http://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=8d5589b88c8b&tochange=cfc884e6e414 In local build Last Good: 32ecf0cec2c3 First bad: b33228bc231a Regressed by: b33228bc231a Bobby Holley — Bug 774633 - Remove "is chrome window" condition for inner window reuse. r=jst WouldReuseInnerWindow also returns true if the new window is same-origin with the old one about:blank document. This condition exists in order to handle some sloppiness with respect to the principals on initial about:blank documents. Chrome callers sometimes parent chrome windows (with XUL document) to content windows. But this parenting causes us to push the cx of the content window during window creation, meaning that the subsequent load of chrome://foo.xul blows away the old inner window and any expandos on it. We can handle this case more precisely by skipping the cx push for type="chrome" windows. Furthermore, this was also necessary to prevent the inner window from being blown away in the call to SetOpenerScriptPrincipal once nsWindowWatcher gets the window back from the window creator (and after it's already told consumers about the window via "domwindowcreated"). But we fixed this nastiness in the previous patches. So we can remove this case. By doing so, we can prevent inner windows from ever changing origins, which is very important for compartment security invariants.
Keywords: regression
Whiteboard: regressed by bug 774633
Keywords: addon-compat
OS: Linux → All
Just to confirm - this wasn't fixed by bug 799348, right?
(In reply to Bobby Holley (:bholley) from comment #6) > Just to confirm - this wasn't fixed by bug 799348, right? I can reproduce the problem in Latest Nightly19.0a1. http://hg.mozilla.org/mozilla-central/rev/57304bbf9c0e Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/19.0 Firefox/19.0 ID:20121014030627
Are any known add-ons affected here?
Assignee: nobody → bobbyholley+bmo
Haven't heard of user fallout from support - not tracking for FF16. Also not clear if this needs to track for FF17, given that.
So, this is a combination of two jetpack issues. The main issue is that require('api-utils/window/utils').open() creates chrome windows by default, even if passed a content URI (it just forwards the parameters to the windowWatcher). This is pretty nuts, since I've heard that the AMO reviewers deny review for addons that load untrusted content in chrome iframes. It seems like we shouldn't be making that so easy. The second issue is that the implementation of WindowTracker gets confused by the fact that chrome windows are no longer guaranteed to perform inner window reuse. When we open a new chrome window, we get an about:blank document with System Principal. An domwindowopened notification fires, and WindowTracker adds the window to its _loadingWindows array, and adds a 'load' event listener on it. However, if the window subsequently loads a non-system URI (like mozilla.org), the existing inner window is ejected and the load event never fires. I don't really have a great idea of how to make WindowTracker handle chrome windows with content URIs, but we really just shouldn't be doing that anyway. Anyway, I don't think this bug is actionable for me. Unassigning myself to draw attention to it.
Assignee: bobbyholley+bmo → nobody
dtownsend - given no known related add-on regressions in FF16, please re-nominate for tracking if you feel strongly that this needs to be fixed for a specific release.
Flags: needinfo?(dtownsend+bugmail)
(In reply to Bobby Holley (:bholley) from comment #10) > So, this is a combination of two jetpack issues. > > The main issue is that require('api-utils/window/utils').open() creates > chrome windows by default, even if passed a content URI (it just forwards > the parameters to the windowWatcher). This is pretty nuts, since I've heard > that the AMO reviewers deny review for addons that load untrusted content in > chrome iframes. It seems like we shouldn't be making that so easy. > > The second issue is that the implementation of WindowTracker gets confused > by the fact that chrome windows are no longer guaranteed to perform inner > window reuse. When we open a new chrome window, we get an about:blank > document with System Principal. An domwindowopened notification fires, and > WindowTracker adds the window to its _loadingWindows array, and adds a > 'load' event listener on it. However, if the window subsequently loads a > non-system URI (like mozilla.org), the existing inner window is ejected and > the load event never fires. > > I don't really have a great idea of how to make WindowTracker handle chrome > windows with content URIs, but we really just shouldn't be doing that anyway. > > Anyway, I don't think this bug is actionable for me. Unassigning myself to > draw attention to it. I think both of Bobby's recommendations make sense. The use case won't work still though, but I don't see why the "tabs" module isn't being used instead, it seems to me that it should be.
Hardware: x86 → All
(In reply to Alex Keybl [:akeybl] from comment #11) > dtownsend - given no known related add-on regressions in FF16, please > re-nominate for tracking if you feel strongly that this needs to be fixed > for a specific release. Erik, what are your thoughts on add-on bustage from this?
Flags: needinfo?(dtownsend+bugmail) → needinfo?(evold)
(In reply to Dave Townsend (:Mossop) from comment #13) > (In reply to Alex Keybl [:akeybl] from comment #11) > > dtownsend - given no known related add-on regressions in FF16, please > > re-nominate for tracking if you feel strongly that this needs to be fixed > > for a specific release. > > Erik, what are your thoughts on add-on bustage from this? This is a low level module, and devs should have been using the top level 'windows' or 'tabs' modules for opening http urls imo. Anyhow I imagine the number of add-ons we break is low, and AMO reviewers should have warned devs against this already because this type of thing is against our policies as Bobby mentioned. I see this change as merely a way to help the AMO reviewers do their job, and not really breaking anything that we intended to support. If we break a few add-ons then that's a good step towards the right direction. Still it'd be good to try to figure out how many add-ons might break. I suspect it's few to none.
Flags: needinfo?(evold)
Can we close this?
Flags: needinfo?(dtownsend+bugmail)
(In reply to Erik Vold [:erikvold] [:ztatic] from comment #15) > Can we close this? WindowTracker is being replaced right? So I don't think we need this. I am concerned by Bobby's first point though and think we should look into that, filed bug 840314.
Status: NEW → RESOLVED
Closed: 13 years ago
Flags: needinfo?(dtownsend+bugmail)
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: