Closed Bug 1236944 Opened 8 years ago Closed 8 years ago

BrowserAction popup closes instantly with Browser Toolbox open

Categories

(WebExtensions :: Untriaged, defect, P4)

defect

Tracking

(firefox48 verified)

VERIFIED FIXED
Tracking Status
firefox48 --- verified

People

(Reporter: 4mr.minj, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [popup] triaged)

Attachments

(1 file)

STR:
1) Install https://github.com/mdn/webextensions-examples/blob/master/beastify as temporary addon
2) Activate browserAction -> works as expected
3) Open Browser Toolbox
4) Try to active browserAction -> closes instantly

This caught exception is probably related:

make-debugger.js:72 dbg.onNewGlobalObject()
-> webbrowser.js:1000 _shouldAddNewGlobalAsDebuggee()
  -> script.js:3835 unwrapDebuggerObjectGlobal()
    -> Object.getPrototypeOf(global) + "";
      -> "Illegal operation on WrappedNative prototype object"

[1] https://dxr.mozilla.org/mozilla-central/source/devtools/server/actors/utils/make-debugger.js#72
[2] https://dxr.mozilla.org/mozilla-central/source/devtools/server/actors/script.js#3835
Luca, any chance you can take a look at this?
(In reply to 4mr.minj from comment #0)
> STR:
> 1) Install
> https://github.com/mdn/webextensions-examples/blob/master/beastify as
> temporary addon
> 2) Activate browserAction -> works as expected
> 3) Open Browser Toolbox
> 4) Try to active browserAction -> closes instantly
> 
> This caught exception is probably related:
> 
> make-debugger.js:72 dbg.onNewGlobalObject()
> -> webbrowser.js:1000 _shouldAddNewGlobalAsDebuggee()
>   -> script.js:3835 unwrapDebuggerObjectGlobal()
>     -> Object.getPrototypeOf(global) + "";
>       -> "Illegal operation on WrappedNative prototype object"
> 
> [1]
> https://dxr.mozilla.org/mozilla-central/source/devtools/server/actors/utils/
> make-debugger.js#72
> [2]
> https://dxr.mozilla.org/mozilla-central/source/devtools/server/actors/script.
> js#3835

I'm unable to reproduce this on Nightly, I tried on my local build 46.0a1 (2016-01-07) the following steps:
1) Install as a temporary addon
   https://github.com/mdn/webextensions-examples/blob/master/beastify
2) Activate browserAction -> works as expected
3) Open Browser Toolbox and select the Debugger tool (this is important to be sure the debugger is
   actually enabled)
4) Try to active browserAction -> works as expected

Could you try to reproduce the issue on a recent Nightly build as well?
if you are still able to reproduce it, can you please add more info about the hardware/OS configuration on which you are able to reproduce it?
Flags: needinfo?(4mr.minj)
Yes I can still reproduce it with 46.0a1.20160106030225

To clarify, when I say 'closes instantly' it's more like 'never opens'.

You need to follow the steps precisely...
because if you skip step 2) the popup opens once on step 4), i. e. for the first time since installation BUT never again with Browser Toolbox _debugger_ open.

additional steps I tried:
5) close the Toolbox
6) press the add-on button -> works
7) open the Toolbox
8) press the add-on button -> fails
----
My nightly profile was fairly fresh AND I could reproduce it with a virgin profile as well BUT my initial steps are valid only if the Browser Toolbox (which I launch via CTRL+ALT+SHIFT+I) opens with the debugger tab focused.

So... from a virgin profile:
1) enable
> user_pref("devtools.chrome.enabled", true);
> user_pref("devtools.debugger.remote-enabled", true);
2) go to about:debugging
3) install https://github.com/mdn/webextensions-examples/blob/master/beastify as temporary
4) press CTRL+ALT+SHIFT+I to launch Browser Toolbox -> notice it loads with console tab focused
5) press add-on button once or more -> works
6) focus debugger tab and wait for sources to load
7) press add-on button once or more -> fails

alternatively...
5) focus debugger tab and wait for sources to load
6) press add-on button once -> works
7) press add-on button again -> fails
----
My system: manjaro linux x64.
Flags: needinfo?(4mr.minj)
(In reply to 4mr.minj from comment #3)
> Yes I can still reproduce it with 46.0a1.20160106030225
> 
> To clarify, when I say 'closes instantly' it's more like 'never opens'.
> 
> You need to follow the steps precisely...
> because if you skip step 2) the popup opens once on step 4), i. e. for the
> first time since installation BUT never again with Browser Toolbox
> _debugger_ open.
> 
> additional steps I tried:
> 5) close the Toolbox
> 6) press the add-on button -> works
> 7) open the Toolbox
> 8) press the add-on button -> fails

Thanks for the additional info!

I'm now able to reproduce it but with slightly different behaviours (probably related to the changes introduced by Bug 1132501, landed recently): 

- Using a Browser Toolbox Debugger, it works until we add a breakpoint, then it fails to open the popup until we remove all the breakpoints (it does not matter if the breakpoint is set on extension code or not)

- Using an Addon Toolbox Debugger:
  1) it mostly works (debugger paused on the breakpoint and popup opened once we resume the debugger
    and it remains opened when we click in the popup, but sometimes it fails to open the popup)
    if we set a breakpoint during popup window loading: https://github.com/mdn/webextensions-examples/blob/master/beastify/popup/choose_beast.js#L13
  2) it fails (debugger paused on the breakpoint, but popup is already closed and an exception is
    raised because the popup window context is a dead wrapper (because the popup is closed) and
    the extension is unable to run the code on https://github.com/mdn/webextensions-examples/blob/master/beastify/popup/choose_beast.js#L25
  3) it mostly works (the extension works like expected but the popup is closed) if the breakpoint is set on https://github.com/mdn/webextensions-examples/blob/master/beastify/popup/choose_beast.js#L25

Unfortunately it fails silently, besides when it is trying to access the dead wrapper as described in the scenario 2:

Extension error: Error: Permission denied to access property 0 moz-extension://f42b7b9d-bcdd-4b73-b563-057dffb88dbb/popup/choose_beast.js 25
[[Exception stack
@moz-extension://f42b7b9d-bcdd-4b73-b563-057dffb88dbb/popup/choose_beast.js:25:5
Current stack
runSafeSyncWithoutClone@resource://gre/modules/ExtensionUtils.jsm:25:110
runSafeWithoutClone/<@resource://gre/modules/ExtensionUtils.jsm:38:32
]]
Status: UNCONFIRMED → NEW
Ever confirmed: true
Does this affect other toolbar button panels, especially any of the built-in ones?

Does it still happen if you try to open a popup that doesn't have any scripts?

My best guess is that this has something to do with the debugger spinning the event loop, as in bug 1219229, but I can't think of any obvious reason that would cause this, unless it causes something to change focus.
IRT: comment 4
It seems you are correct. I've just built FF from latest git commit (bb2736f5b3949a3d8f915899b6d8ec77d5174ef5) and I now observe the same behavior.

I cannot reproduce the problem with the original STR.
Priority: -- → P4
Whiteboard: [popup] triaged
Bug 950936 introduced a new "disable popup auto-hide" button in the Developer Toolbox which solves issues on debugging code running inside popups.

The attached animated gif shows the usage of the new "disable popup auto-hide" button applied to the scenario described in this issue.
(In reply to 4mr.minj from comment #6)
> IRT: comment 4
> It seems you are correct. I've just built FF from latest git commit
> (bb2736f5b3949a3d8f915899b6d8ec77d5174ef5) and I now observe the same
> behavior.
> 
> I cannot reproduce the problem with the original STR.

Fixed by Bug 950936.

Please feel free to reopen it if you are still experiencing this issue.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
I'm not sure this is fixed. That may be a solution for debugging, but the panels should still function normally if the toolbox is open.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(In reply to Kris Maglione [:kmag] from comment #9)
> I'm not sure this is fixed. That may be a solution for debugging, but the
> panels should still function normally if the toolbox is open.

By testing on Nightly, the code running inside the popup panel works correctly in the following scenarios (without activating the "disable popup auto-hide"):

- toolbox opened, debugger tab not active
- toolbox opened, debugger tab active with no breakpoints
- toolbox opened, debugger tab active, active breakpoint (if they don't pause the debugger)

The new "disable popup auto-hide" button covers the following scenario:

- toolbox opened, debugger tab active, active breakpoint which pause the debugger

Which are the remaining scenarios that are still not fixed?
Sorry, I guess I misunderstood your comment.

If the original issue is fixed event without disabling auto-hide, then I guess it's fixed. It would be nice to know if the original reporter can still reproduce, though.
Flags: needinfo?(4mr.minj)
Yes, I can use the browser action to load scripts in the debugger and then use breakpoints to step through the code on a second invocation. As I see it this is FIXED.

While inspecting the actual DOM is highly desirable it is out of the scope of the bug.
Flags: needinfo?(4mr.minj)
OK. Thanks
Status: REOPENED → RESOLVED
Closed: 8 years ago8 years ago
Resolution: --- → FIXED
I was able to reproduce this issue on Firefox 46.0a1 (0215-12-16) under Windows 10 64-bit.

Verified fixed on Firefox 48.0a1 (2016-04-03) under Windows 10 64-bit, Mac OS X 10.11 and Ubuntu 12.04 32-bit.
Status: RESOLVED → VERIFIED
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: