Closed Bug 879068 Opened 11 years ago Closed 10 years ago

Panel is stuck open, I cannot hide it

Categories

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

x86
macOS
defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: evold, Assigned: irakli)

References

Details

(Keywords: regression)

Attachments

(1 file)

Steps to reproduce:

1. install https://addons.mozilla.org/en-US/firefox/addon/page-portal/
2. Go to github.com and portal to the login/logout page
3. submit the login/logout form
4. try to close the panel

Expected:

Clicking the browser window, a tab, or the 'esc' button would close the open panel

Actual:

The panel never closes, and because of bug 851318 it's on top of every window that I open..

Bug 859012 may resolve the issue, but I suspect that there is a bug somewhere in the SDK or platform caused this.
We could also add a 'Close Panel' default menuitem in bug 858399
Depends on: 859012, 851318
I suspect this is due to bug 888688, but we should at least get a test in before closing this bug.
Depends on: 888688
Ideally the esc hotkey listener would not be panel (or loader) dependent, if a `panel` module is loaded, then pressing `ESC`
(In reply to Erik Vold [:erikvold] [:ztatic] from comment #3)
> Ideally the esc hotkey listener would not be panel (or loader) dependent, if
> a `panel` module is loaded, then pressing `ESC`

Don't know why that posted..

Ideally the esc hotkey listener would not be panel (or loader) dependent, if a `panel` module is loaded, then pressing `ESC` would close any open sdk panel no matter what loader it came from.
This should be urgent imo.
Flags: needinfo?(rFobic)
Flags: needinfo?(dtownsend+bugmail)
Erik, the best way to get us to re-evaluate a bug's priority is to de-prioritise it
Flags: needinfo?(rFobic)
Flags: needinfo?(dtownsend+bugmail)
Priority: P2 → --
Comment on attachment 770375 [details]
Pointer to Github pull request: https://github.com/mozilla/addon-sdk/pull/1075

I've added tests for this issue, one test fails:

error: addon-sdk: fail: the panel is destroyed - undefined == "open"
info: addon-sdk: Traceback (most recent call last):
  File "resource://extensions.modules.106d3b09-41a3-479a-a298-6d8be8e340f9-at-jetpack.commonjs.path/sdk/window/helpers.js", line 45, in eventHandler
    deferred.resolve(target);
  File "resource://extensions.modules.106d3b09-41a3-479a-a298-6d8be8e340f9-at-jetpack.commonjs.path/sdk/core/promise.js", line 187, in resolve
    result.then(observer.resolve, observer.reject);
  File "resource://extensions.modules.106d3b09-41a3-479a-a298-6d8be8e340f9-at-jetpack.commonjs.path/sdk/core/promise.js", line 45, in then
    return { then: function then(fulfill) { fulfill(value); } };
  File "resource://extensions.modules.106d3b09-41a3-479a-a298-6d8be8e340f9-at-jetpack.commonjs.path/sdk/core/promise.js", line 120, in resolve
    deferred.resolve(onFulfill ? onFulfill(value) : value);
  File "resource://extensions.modules.106d3b09-41a3-479a-a298-6d8be8e340f9-at-jetpack.commonjs.path.tests/test-panel.js", line 121, in exports.testPanelHidesOnNewWindowWithDestroyOnHide/last/</</<
    assert.equal(panelEle.state, undefined, 'the panel is destroyed');
  File "resource://extensions.modules.106d3b09-41a3-479a-a298-6d8be8e340f9-at-jetpack.commonjs.path/sdk/test/assert.js", line 125, in equal
    operator: "=="
  File "resource://extensions.modules.106d3b09-41a3-479a-a298-6d8be8e340f9-at-jetpack.commonjs.path/sdk/test/assert.js", line 89, in fail
    this._log.fail(message);
  File "resource://extensions.modules.106d3b09-41a3-479a-a298-6d8be8e340f9-at-jetpack.commonjs.path/sdk/deprecated/unit-test.js", line 88, in fail
    this.console.trace();
  File "resource://extensions.modules.106d3b09-41a3-479a-a298-6d8be8e340f9-at-jetpack.commonjs.path/sdk/lang/functional.js", line 84, in partial/<
    return function() fn.apply(this, args.concat(Array.slice(arguments)));
info: addon-sdk: pass: destroying the panel
Attachment #770375 - Flags: feedback?(rFobic)
Comment on attachment 770375 [details]
Pointer to Github pull request: https://github.com/mozilla/addon-sdk/pull/1075

Erik, behavior of removed panel node is not a specified anywhere and I'm not sure that assumption that `xulPanel.state === undefined` is always true. I would rather prefer to test weather `!xulPanel.ownerDocument` is truthy since we just remove panel element from document on unload or destroy. It could be that removing panel from Document tree is not enough, but I'd then I'd consider that to be a platform bug.
Attachment #770375 - Flags: feedback?(rFobic) → feedback-
So this issue appears to be a regression from 1.13 to 1.14 so it was probably introduced in the detraitification of panel.

The test I wrote fails on 1.13 tho too even tho that appears to be working correctly when I test it visually/manually.

The test does illustrate the issue, I'm just not sure how to write the assertions to reflect that atm..

I'm going to assign this to Irakli.
Assignee: nobody → rFobic
(In reply to Erik Vold [:erikvold] [:ztatic] from comment #10)
> So this issue appears to be a regression from 1.13 to 1.14

* So this issue appears to be a regression from 1.13 to master
Here is an example snippet:


require("sdk/panel").Panel({
  width: 180,
  height: 180,
  contentURL: "https://en.wikipedia.org/w/index.php?title=Jetpack&useformat=mobile",
  onShow: function() {
  	let destroy = this.destroy.bind(this);
  	require('sdk/timers').setTimeout(function() {
  	  destroy();
  	}, 500)
  }
}).show();

The page-portal add-on example is obviously a more real world use case, but this is the most simple, automated, and reproducible example that I can provide at the moment.
Hmm this example is more interesting and real world (the message could be send at any time and in reaction to a user interaction):


require("sdk/panel").Panel({
  width: 180,
  height: 180,
  contentURL: "https://en.wikipedia.org/w/index.php?title=Jetpack&useformat=mobile",
  contentScriptWhen: 'end',
  contentScript: 'self.postMessage("loaded")',
  onMessage: function(msg) {
  	this.destroy();
  }
}).show();


you can see the content, but cannot interact with it too..
(In reply to Erik Vold [:erikvold] [:ztatic] from comment #13)
> Hmm this example is more interesting and real world (the message could be
> send at any time and in reaction to a user interaction):
> 
> 
> require("sdk/panel").Panel({
>   width: 180,
>   height: 180,
>   contentURL:
> "https://en.wikipedia.org/w/index.php?title=Jetpack&useformat=mobile",
>   contentScriptWhen: 'end',
>   contentScript: 'self.postMessage("loaded")',
>   onMessage: function(msg) {
>   	this.destroy();
>   }
> }).show();
> 
> 
> you can see the content, but cannot interact with it too..

Also, the document is not in memory, so that would explain the latter issue.
This seems to be working for me now, and I never managed to get a satisfactory test written when it was busted.  Seems like we should wontfix this.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
Actually wfm is better.
Resolution: WONTFIX → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: