Closed Bug 1371244 Opened 7 years ago Closed 7 years ago

Context menus appear not to be cleared when reloading in the debugger

Categories

(WebExtensions :: General, defect)

54 Branch
x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: jkt, Unassigned)

Details

(Whiteboard: [contextMenus], triaged)

Attachments

(2 files)

Attached image Selection_685.png
I was working on the following: https://github.com/jonathanKingston/extension-debugging/tree/master/window-merge

STR:

1. Load the extension in about:debugging
2. Load the debugger
3. Hit Ctrl+R in the debugger window
4. Right click in a window


Expected outcomes:

One context menu item for the extension

Actual:

For each reload I get a different context menu

I'm on Nightly on 16.04 Ubuntu
By looking into the context menu implementation it looks like the context menu items defined by an extension are removed only when the extension is disabled (or uninstalled):

- https://dxr.mozilla.org/mozilla-central/source/browser/components/extensions/ext-contextMenus.js#619-629

I suspect that by pressing Ctrl+R in the debugger window, while a WebExtension background page is selected in the addon debugger window, a `window.location.reload()` is triggered on the background page (instead of the addon reload triggered by the reload button from the about:debugging page).

Do you mind retrying the STR with "press the reload button in the about:debugging page" as its step 3?
 
This will confirm that the context menu items are correctly refreshed when the entire addon is reloaded.
Flags: needinfo?(jkt)
Attached image Selection_686.png
This does indeed clear it. No amount of Ctrl+R cleared it.
Pressing the reload button fast in about:debugging adds the items not in a sub menu (This is likely a race condition on the unloading then loading perhaps?)
Flags: needinfo?(jkt)
I tested this on chrome and it has the same behavior:

- if you manually reload the background page, a new context menu item is created for each reload (both by pressing Ctrl-R in the chrome addon debugging window or by doing a window.location.reload() in the console panel)
- if you reload the entire addon from chrome://extensions using the reload link, all the created context menu items are removed and there will be only one

So, it looks like the behavior is the expected one in both the implementations.

I've not been able to reproduce the issue from attachment 8875689 [details] described comment 2 (clicking fast the "about:debugging" reload link more times) on Firefox Nightly, though.
luca commenting
Flags: needinfo?(lgreco)
Whiteboard: [contextMenus], triaged
Hi :jkt,
I'm marking this issue as invalid because, as described in Comment 3, the current behavior is the expected one (and Chrome shares the same behavior):

reloading the background page doesn't remove the context menu items created from that context (while reloading the entire addon remove all the context menu items as expected).

I tried to reproduce the other issue described in comment 2 (multiple fast clicks on the about:debugging addon reload action) without any luck, but if you find an STR that consistently reproduces it, feel free to open a new bugzilla issue specifically for it.
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: needinfo?(lgreco)
Resolution: --- → INVALID
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: