Closed Bug 1438985 Opened 7 years ago Closed 7 years ago

tabhide shutdown doesn't happen if api is unused

Categories

(WebExtensions :: Untriaged, defect, P1)

58 Branch
defect

Tracking

(firefox60 verified)

VERIFIED FIXED
mozilla60
Tracking Status
firefox60 --- verified

People

(Reporter: mixedpuppy, Assigned: mixedpuppy)

References

Details

Attachments

(2 files, 1 obsolete file)

shutdown only occurs if the api has been used. This can result in hidden tabs the user is unable to show. STR: - load a tab hide extension - hide some tabs - restart firefox - upon restart, do not use extension - open about:addons - uninstall tab hide extension expected: hidden tabs are shown actual: hidden tabs are not shown
Comment on attachment 8951758 [details] Bug 1438985 handle shutdown and uninstall outside of api This allows us to avoid any more general changes for now.
Attachment #8951758 - Flags: feedback?(lgreco)
Attachment #8951758 - Flags: feedback?(aswan)
Attachment #8951758 - Attachment is obsolete: true
Attachment #8951758 - Flags: feedback?(lgreco)
Attachment #8951758 - Flags: feedback?(aswan)
Attachment #8951788 - Flags: feedback?(lgreco)
Attachment #8951788 - Flags: feedback?(aswan)
Comment on attachment 8951788 [details] Bug 1438985 fix showing hidden tabs on extension shutdown, https://reviewboard.mozilla.org/r/221056/#review227012 ::: commit-message-9b69c:1 (Diff revision 1) > +Bug 1438985 handle shutdown and uninstall outside of api The "outside of api" bit here doesn't make any sense to me. In any case, the commit message should mention that this is about the webextensions tabs api, not require somebody to read the patch to know what it is about. ::: toolkit/components/extensions/ExtensionParent.jsm:111 (Diff revision 1) > })); > }); > + > + this.on("disable", (e, {id}) => { > + let modules = this.eventModules.get("disable"); > + return Promise.all(Array.from(modules).map(async apiName => { what actually looks at this promise?
Attachment #8951788 - Flags: feedback?(aswan)
Comment on attachment 8951788 [details] Bug 1438985 fix showing hidden tabs on extension shutdown, https://reviewboard.mozilla.org/r/221056/#review227560 ::: browser/components/extensions/ext-tabs.js:105 (Diff revision 1) > - nativeTab.ownerGlobal.gBrowser.showTab(nativeTab); > - } > - } > - } > + } > + > + static onUninstall(id) { Like I described in a bit more detail in Bug 1436720 Comment 43, this static onUninstall is going to be called when the addon has been removed and not when it is "shutting down with an ADDON_UNINSTALL reason". I think that the new behavior can be a bit more surprising for the user than the previous one (which was "to show the hidden tabs when the extension is shutting down with an "ADDON_DISABLE" or "ADDON_UNINSTALL" reason) e.g. the hidden tabs are not going to appear when the user click the disable button, which most of the times is a direct action of the user (well, besides an extension that is being disabled by Firefox, e.g. because of the signature checks), but when the "about:addons" tab is closed or reloaded. Given that we are defining a new static lifecycle method (currently named onDisabled), another option would be to provide a static lifecycle method that gets the reason for the extension shutdown as a parameter, this way we can just support the exact same behavior implemented by the previous non-static onShutdown lifecycle method.
Assignee: nobody → mixedpuppy
Priority: -- → P1
Comment on attachment 8951788 [details] Bug 1438985 fix showing hidden tabs on extension shutdown, Still only feedback due to lack of test for updates.
Attachment #8951788 - Flags: feedback?(aswan)
Comment on attachment 8951788 [details] Bug 1438985 fix showing hidden tabs on extension shutdown, https://reviewboard.mozilla.org/r/221056/#review229458 ::: toolkit/components/extensions/ExtensionParent.jsm:109 (Diff revision 2) > + this.on("disable", (e, {id, reason}) => { > + let modules = this.eventModules.get("disable"); > + Array.from(modules).map(async apiName => { > + let module = await this.asyncLoadModule(apiName); > + module.onDisable(id, reason); > + }); > + }); I don't think a new event is necessary here, you can just put this logic into `shutdownExtension()` Also, I would prefer that we don't pass `reason` here but only actually dispatch `onDisable()` if reason is ADDON_DISABLE. We already have the uninstall and update events for some of the other instances in which an extension can be shut down, and I don't think we have a need for this event at app shutdown, so we shouldn't be loading APIs then.
Comment on attachment 8951788 [details] Bug 1438985 fix showing hidden tabs on extension shutdown, https://reviewboard.mozilla.org/r/221056/#review229458 > I don't think a new event is necessary here, you can just put this logic into `shutdownExtension()` > > Also, I would prefer that we don't pass `reason` here but only actually dispatch `onDisable()` if reason is ADDON_DISABLE. We already have the uninstall and update events for some of the other instances in which an extension can be shut down, and I don't think we have a need for this event at app shutdown, so we shouldn't be loading APIs then. The reason for doing this for addon_uninstall as well is described in comment 5.
(In reply to Shane Caraveo (:mixedpuppy) from comment #9) > The reason for doing this for addon_uninstall as well is described in > comment 5. /me shakes fist at undo-able uninstalls
Comment on attachment 8951788 [details] Bug 1438985 fix showing hidden tabs on extension shutdown, https://reviewboard.mozilla.org/r/221056/#review230152 no test for the disable handling? a few little things but r=me with those addressed ::: browser/components/extensions/ext-tabs.js:108 (Diff revision 3) > - nativeTab.ownerGlobal.gBrowser.showTab(nativeTab); > - } > + } > - } > + } > + > + static onDisable(id, reason) { > + if (["ADDON_DISABLE", "ADDON_UNINSTALL"].includes(reason)) { Lets just define this event as happening for reasons ADDON_DISABLE and ADDON_UNINSTALL and move this check into the code in ExtensionParent.jsm that dispatches this call. ::: browser/components/extensions/test/browser/browser_ext_tabs_hide_update.js:3 (Diff revision 3) > +"use strict"; > + > +const {AddonTestUtils} = ChromeUtils.import("resource://testing-common/AddonTestUtils.jsm", {}); Is there a reason that this won't work by itself: `ChromeUtils.import("resource://testing-common/AddonTestUtils.jsm");` ::: browser/components/extensions/test/browser/browser_ext_tabs_hide_update.js:7 (Diff revision 3) > + > +const {AddonTestUtils} = ChromeUtils.import("resource://testing-common/AddonTestUtils.jsm", {}); > + > +AddonTestUtils.initMochitest(this); > + > +async function reloadWebExtension(ID, options) { nit: this function name is misleading...
Attachment #8951788 - Flags: review?(aswan) → review+
Comment on attachment 8951788 [details] Bug 1438985 fix showing hidden tabs on extension shutdown, https://reviewboard.mozilla.org/r/221056/#review230152 > Is there a reason that this won't work by itself: > `ChromeUtils.import("resource://testing-common/AddonTestUtils.jsm");` In some earlier iteration I got test failures due to MockAsyncShutdown remaining on the window, but that isn't happening now. It was probably something I was trying before I figured out the right way to do it.
Comment on attachment 8951788 [details] Bug 1438985 fix showing hidden tabs on extension shutdown, https://reviewboard.mozilla.org/r/221056/#review230152 > In some earlier iteration I got test failures due to MockAsyncShutdown remaining on the window, but that isn't happening now. It was probably something I was trying before I figured out the right way to do it. ahh, one must use "this" to avoid that problem.
(In reply to Andrew Swan [:aswan] from comment #12) > Comment on attachment 8951788 [details] > Bug 1438985 fix showing hidden tabs on extension shutdown, > > https://reviewboard.mozilla.org/r/221056/#review230152 > > no test for the disable handling? added
Pushed by mixedpuppy@gmail.com: https://hg.mozilla.org/integration/autoland/rev/d4ed9c1d6ba7 fix showing hidden tabs on extension shutdown, r=aswan
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
Attached image Bug1438985.gif
This issue is verified as fixed on Firefox 60.0a1 (20180304220118) under Windows 7 64-bit, Mac OS X 10.13.2. After I uninstall the extension, the hidden tabs are restored. Please see the attached video.
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: