Bug 1437486 - don't reset the forget button duration when the popup is visible, r?johannh draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Mon, 12 Feb 2018 11:33:17 +0000
changeset 753775 8bf90aa9636569b3f04ab4c46b53e92c2014fa0a
parent 753761 cb9b9f2707a33a1a85d5c2e74e2cd75a8afa337e
push id98677
push usergijskruitbosch@gmail.com
push dateMon, 12 Feb 2018 11:33:51 +0000
reviewersjohannh
bugs1437486
milestone60.0a1
Bug 1437486 - don't reset the forget button duration when the popup is visible, r?johannh MozReview-Commit-ID: 6TWGSSuZxsa
browser/components/customizableui/CustomizableWidgets.jsm
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -897,17 +897,16 @@ if (Services.prefs.getBoolPref("privacy.
     id: "panic-button",
     type: "view",
     viewId: "PanelUI-panicView",
 
     forgetButtonCalled(aEvent) {
       let doc = aEvent.target.ownerDocument;
       let group = doc.getElementById("PanelUI-panic-timeSpan");
       BrowserUITelemetry.countPanicEvent(group.selectedItem.id);
-      group.selectedItem = doc.getElementById("PanelUI-panic-5min");
       let itemsToClear = [
         "cookies", "history", "openWindows", "formdata", "sessions", "cache", "downloads"
       ];
       let newWindowPrivateState = PrivateBrowsingUtils.isWindowPrivate(doc.defaultView) ?
                                   "private" : "non-private";
       let promise = Sanitizer.sanitize(itemsToClear, {
         ignoreTimespan: false,
         range: Sanitizer.getClearRange(+group.value),
@@ -929,16 +928,19 @@ if (Services.prefs.getBoolPref("privacy.
       switch (aEvent.type) {
         case "command":
           this.forgetButtonCalled(aEvent);
           break;
       }
     },
     onViewShowing(aEvent) {
       let forgetButton = aEvent.target.querySelector("#PanelUI-panic-view-button");
+      let doc = aEvent.target.ownerDocument;
+      let group = doc.getElementById("PanelUI-panic-timeSpan");
+      group.selectedItem = doc.getElementById("PanelUI-panic-5min");
       forgetButton.addEventListener("command", this);
     },
     onViewHiding(aEvent) {
       let forgetButton = aEvent.target.querySelector("#PanelUI-panic-view-button");
       forgetButton.removeEventListener("command", this);
     },
   });
 }