Closed Bug 1279297 Opened 8 years ago Closed 8 years ago

need to restart fx for the container icon to appear under the hamburger menu

Categories

(Core :: DOM: Security, defect, P2)

49 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla50
Tracking Status
firefox50 --- fixed

People

(Reporter: kjozwiak, Assigned: baku)

References

(Blocks 1 open bug)

Details

(Whiteboard: [usercontextId],[domsecurity-active])

Attachments

(1 file, 2 obsolete files)

When enabling containers, users will have to restart the browser for the container icon to appear under the hamburger customization window. Is there anything we can do here or is this a limitation of fx?

STR:

* launch a brand new installation of m-c
* enable containers in about:config via the "privacy.userContext.enabled;true" pref
* click on the hamburger menu -> customize and you'll notice that the container icon isn't being displayed
* restart fx
* click on the hamburger menu -> customize and you'll notice that the container icon is being displayed correctly

Platforms Used:

* Ubuntu 14.04.4 LTS x64 - Reproduced the issue
** fx50.0a1 buildId: 20160609064045, changeset: f8e3b81a79f4

* OSX 10.11.5 x64 - Reproduced the issue
** fx50.0a1 buildId: 20160609064045, changeset: f8e3b81a79f4

* Win 10 x64 - Reproduced the issue
** fx50.0a1 buildId: 20160609064045, changeset: f8e3b81a79f4
Priority: -- → P3
Whiteboard: [usercontextId] → [usercontextId],[domsecurity-backlog]
Blocks: 1286357
Priority: P3 → P1
Priority: P1 → P2
Attached patch no_restart1.patch (obsolete) — Splinter Review
Assignee: nobody → amarchesini
Attachment #8771270 - Flags: review?(gijskruitbosch+bugs)
Comment on attachment 8771270 [details] [diff] [review]
no_restart1.patch

Review of attachment 8771270 [details] [diff] [review]:
-----------------------------------------------------------------

::: browser/components/customizableui/CustomizableWidgets.jsm
@@ +1133,5 @@
> +        aNode.hidden = !Services.prefs.getBoolPref("privacy.userContext.enabled");
> +      }
> +
> +      Services.prefs.addObserver("privacy.userContext.enabled", updateVisibility, false);
> +      updateVisibility();

You never remove this observer, so if you open a window with the button in it and then close it this code will leak the window (because the pref service has a strong ref to the observer which has a ref to the node and thereby to the window and everything in it).

Can you refactor this so there's only 1 observer for the pref instead of 1 per window, and it uses a weak reference? You can store the widget spec in an object, make it implement nsIObserver and nsISupportsWeakReference, and in its observe() method you can loop over CUI.getWidget(this.id).instances and access their 'node' property to make modifications to each of the nodes, inasmuch as they exist.
Attachment #8771270 - Flags: review?(gijskruitbosch+bugs) → review-
Attached patch no_restart1.patch (obsolete) — Splinter Review
Attachment #8771270 - Attachment is obsolete: true
Attachment #8772413 - Flags: review?(gijskruitbosch+bugs)
Attachment #8772413 - Attachment is obsolete: true
Attachment #8772413 - Flags: review?(gijskruitbosch+bugs)
Attachment #8772415 - Flags: review?(gijskruitbosch+bugs)
Whiteboard: [usercontextId],[domsecurity-backlog] → [usercontextId],[domsecurity-active]
Comment on attachment 8772415 [details] [diff] [review]
no_restart1.patch

Review of attachment 8772415 [details] [diff] [review]:
-----------------------------------------------------------------

w/ the below, r=me

::: browser/components/customizableui/CustomizableWidgets.jsm
@@ +1128,5 @@
>        if (PrivateBrowsingUtils.isWindowPrivate(win)) {
>          aNode.setAttribute("disabled", "true");
>        }
> +
> +      Services.prefs.addObserver("privacy.userContext.enabled", this, true);

Almost... now just need to make sure we only do this once. Simplest solution is probably to make the spec here a variable ("containerWidget") and push it onto the widget array afterwards, and also run this one line.
Attachment #8772415 - Flags: review?(gijskruitbosch+bugs) → review+
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/82ee6a3e31d6
No restarts needed for Containers when its pref is changed, r=gijs
https://hg.mozilla.org/mozilla-central/rev/82ee6a3e31d6
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
See Also: → 1337937
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: