Panel page blanks when opened from multiple windows



4 years ago
a year ago


(Reporter: noitidart, Unassigned)


Firefox Tracking Flags

(Not tracked)



(1 attachment)



4 years ago
User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Build ID: 20150611135623

Steps to reproduce:

From stackoverflow:

I've followed MDN's document to create a toggle button addon.

Everything works fine except one problem:

    Open a second browser window (cmd+n or ctrl+n) and click on the toggle button there
    Click on the toggle button on the original browser window without closing the toggle button on the second window

    the toggle button's panel becomes blank with the following error message:

    JavaScript error: resource:///modules/WindowsPreviewPerTab.jsm, line 406: NS_ERR OR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIT askbarTabPreview.invalidate]

Actual results:

Here is a gif screencast showing what would happen:

Comment 1

4 years ago
Created attachment 8621984 [details]
The user from stackovreflow seems to have created a nice addon test case, its in zip not xpi but attached
The test case can be probably reduced and simplified to:

    let { ActionButton } = require("sdk/ui/button/action");
    let { Panel } = require("sdk/panel");

    let button = ActionButton({
      id: "button",
      label: "my button",
      icon: "./icon-16.png",
      onClick: () =>

    let panel = Panel({ contentURL: "./menu.html" });

The issue seems caused by a combo of `swapFrameLoader`, window's focus, and panel's event.

In short, every time we open and close a panel, we swaps the frame inside, in order to keep the panel's state. We do that every showing/hidden. The issue here, is that the `hidden` event is never emitted when it disappeared automatically on the other window. Something goes wrong there, and then the order of the back frame and front frame are inverted.
I believe that this is caused due the racing condition between the showing event, and the window's focus event.

It seems in fact that delayed a bit the panel from showing, resolve the issue. It's not a proper fix of course, but it can be a temporary workaround. Something like:

    onClick: () => setTimeout(() =>, 100);
Ever confirmed: true

Comment 3

3 years ago
Just for info: The setTimeout workaround doesn't seem to work here, running Firefox 41.0.2 on Windows 7.

With or without the delay, first a 'show' event is sent, followed almost immediately by a 'hide' event (the panel even shows up for a split second but then gets closed). Clicking a second time on the button only opens the blank panel.
Last Resolved: a year ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.