Bug 1473275 - Remove the details expander in the Clear Recent History dialog. r=johannh
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Wed, 04 Jul 2018 17:27:15 +0100
changeset 815594 4ff5720cadae8374a02409f63364b46984370865
parent 815593 7f6bdd8d1074ebefb3ffe377bd24285848484eae
child 815595 33dd027449633b0031acea1440a1f336cec9ae56
push id115563
push userbmo:ntim.bugs@gmail.com
push dateMon, 09 Jul 2018 12:45:57 +0000
reviewersjohannh
bugs1473275
milestone63.0a1
Bug 1473275 - Remove the details expander in the Clear Recent History dialog. r=johannh MozReview-Commit-ID: 99XDExBbRkp
browser/base/content/sanitize.xul
browser/base/content/sanitizeDialog.js
browser/base/content/test/sanitize/browser_sanitizeDialog.js
browser/locales/en-US/chrome/browser/sanitize.dtd
browser/themes/linux/sanitizeDialog.css
browser/themes/osx/sanitizeDialog.css
browser/themes/windows/sanitizeDialog.css
toolkit/themes/linux/global/arrow/arrow-dn-hov.gif
toolkit/themes/linux/global/arrow/arrow-up-hov.gif
toolkit/themes/linux/global/jar.mn
--- a/browser/base/content/sanitize.xul
+++ b/browser/base/content/sanitize.xul
@@ -78,29 +78,16 @@
           </vbox>
         </hbox>
         <spacer flex="1"/>
       </vbox>
 
 
     <separator class="thin"/>
 
-    <hbox id="detailsExpanderWrapper" align="center">
-      <button type="image"
-              id="detailsExpander"
-              class="expander-down"
-              persist="class"
-              oncommand="gSanitizePromptDialog.toggleItemList();"/>
-      <label id="detailsExpanderLabel"
-             value="&detailsProgressiveDisclosure.label;"
-             accesskey="&detailsProgressiveDisclosure.accesskey;"
-             control="detailsExpander"/>
-    </hbox>
-
-    <vbox id="itemList" collapsed="true" persist="collapsed">
     <groupbox orient="horizontal">
       <caption><label>&historySection.label;</label></caption>
       <grid flex="1">
         <columns>
           <column style="width: &sanitizePrefs2.column.width;"/>
           <column flex="1"/>
         </columns>
         <rows>
@@ -149,11 +136,10 @@
             <checkbox label="&itemOfflineApps.label;"
                       accesskey="&itemOfflineApps.accesskey;"
                       preference="privacy.cpd.offlineApps"
                       onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
           </row>
         </rows>
       </grid>
     </groupbox>
-    </vbox>
   </vbox>
 </dialog>
--- a/browser/base/content/sanitizeDialog.js
+++ b/browser/base/content/sanitizeDialog.js
@@ -111,31 +111,25 @@ var gSanitizePromptDialog = {
       Cu.reportError("Exception during sanitize: " + er);
       return true; // We *do* want to close immediately on error.
     }
   },
 
   /**
    * If the panel that displays a warning when the duration is "Everything" is
    * not set up, sets it up.  Otherwise does nothing.
-   *
-   * @param aDontShowItemList Whether only the warning message should be updated.
-   *                          True means the item list visibility status should not
-   *                          be changed.
    */
-  prepareWarning(aDontShowItemList) {
+  prepareWarning() {
     // If the date and time-aware locale warning string is ever used again,
     // initialize it here.  Currently we use the no-visits warning string,
     // which does not include date and time.  See bug 480169 comment 48.
 
     var warningStringID;
     if (this.hasNonSelectedItems()) {
       warningStringID = "sanitizeSelectedWarning";
-      if (!aDontShowItemList)
-        this.showItemList();
     } else {
       warningStringID = "sanitizeEverythingWarning2";
     }
 
     var warningDesc = document.getElementById("sanitizeEverythingWarning");
     warningDesc.textContent =
       this.bundleBrowser.getString(warningStringID);
   },
@@ -157,17 +151,17 @@ var gSanitizePromptDialog = {
     // privacy.sanitize.timeSpan, which doesn't affect the button's status).
     var found = this._getItemPrefs().some(pref => !!pref.value && !pref.disabled);
 
     try {
       document.documentElement.getButton("accept").disabled = !found;
     } catch (e) { }
 
     // Update the warning prompt if needed
-    this.prepareWarning(true);
+    this.prepareWarning();
 
     return undefined;
   },
 
   /**
    * Sanitizer.prototype.sanitize() requires the prefs to be up-to-date.
    * Because the type of this prefwindow is "child" -- and that's needed because
    * without it the dialog has no OK and Cancel buttons -- the prefs are not
@@ -197,52 +191,9 @@ var gSanitizePromptDialog = {
     let checkboxes = document.querySelectorAll("checkbox[preference]");
     for (let i = 0; i < checkboxes.length; ++i) {
       let pref = Preferences.get(checkboxes[i].getAttribute("preference"));
       if (!pref.value)
         return true;
     }
     return false;
   },
-
-  /**
-   * Show the history items list.
-   */
-  showItemList() {
-    var itemList = document.getElementById("itemList");
-    var expanderButton = document.getElementById("detailsExpander");
-
-    if (itemList.collapsed) {
-      expanderButton.className = "expander-up";
-      itemList.setAttribute("collapsed", "false");
-      if (document.documentElement.boxObject.height)
-        window.resizeBy(0, itemList.boxObject.height);
-    }
-  },
-
-  /**
-   * Hide the history items list.
-   */
-  hideItemList() {
-    var itemList = document.getElementById("itemList");
-    var expanderButton = document.getElementById("detailsExpander");
-
-    if (!itemList.collapsed) {
-      expanderButton.className = "expander-down";
-      window.resizeBy(0, -itemList.boxObject.height);
-      itemList.setAttribute("collapsed", "true");
-    }
-  },
-
-  /**
-   * Called by the item list expander button to toggle the list's visibility.
-   */
-  toggleItemList() {
-    var itemList = document.getElementById("itemList");
-
-    if (itemList.collapsed)
-      this.showItemList();
-    else
-      this.hideItemList();
-  }
-
-
 };
--- a/browser/base/content/test/sanitize/browser_sanitizeDialog.js
+++ b/browser/base/content/test/sanitize/browser_sanitizeDialog.js
@@ -54,19 +54,16 @@ add_task(async function init() {
 /**
  * Initializes the dialog to its default state.
  */
 add_task(async function default_state() {
   let wh = new WindowHelper();
   wh.onload = function() {
     // Select "Last Hour"
     this.selectDuration(Sanitizer.TIMESPAN_HOUR);
-    // Hide details
-    if (!this.getItemList().collapsed)
-      this.toggleDetails();
     this.acceptDialog();
   };
   wh.open();
   await wh.promiseClosed;
 });
 
 /**
  * Cancels the dialog, makes sure history not cleared.
@@ -82,25 +79,16 @@ add_task(async function test_cancel() {
     uris.push(pURI);
   }
   await PlacesTestUtils.addVisits(places);
 
   let wh = new WindowHelper();
   wh.onload = function() {
     this.selectDuration(Sanitizer.TIMESPAN_HOUR);
     this.checkPrefCheckbox("history", false);
-    this.checkDetails(false);
-
-    // Show details
-    this.toggleDetails();
-    this.checkDetails(true);
-
-    // Hide details
-    this.toggleDetails();
-    this.checkDetails(false);
     this.cancelDialog();
   };
   wh.onunload = async function() {
     await promiseHistoryClearedState(uris, false);
     await blankSlate();
     await promiseHistoryClearedState(uris, true);
   };
   wh.open();
@@ -271,26 +259,16 @@ add_task(async function test_everything(
   await PlacesTestUtils.addVisits(places);
   let wh = new WindowHelper();
   wh.onload = function() {
     is(this.isWarningPanelVisible(), false,
        "Warning panel should be hidden after previously accepting dialog " +
        "with a predefined timespan");
     this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
     this.checkPrefCheckbox("history", true);
-    this.checkDetails(true);
-
-    // Hide details
-    this.toggleDetails();
-    this.checkDetails(false);
-
-    // Show details
-    this.toggleDetails();
-    this.checkDetails(true);
-
     this.acceptDialog();
   };
   wh.onunload = async function() {
     await promiseSanitized;
     intPrefIs("sanitize.timeSpan", Sanitizer.TIMESPAN_EVERYTHING,
               "timeSpan pref should be everything after accepting dialog " +
               "with everything selected");
 
@@ -435,121 +413,16 @@ add_task(async function test_form_entrie
     await promiseSanitized;
     let exists = await formNameExists(formEntry);
     is(exists, false, "form entry " + formEntry + " should no longer exist");
   };
   wh.open();
   await wh.promiseClosed;
 });
 
-
-/**
- * Ensure that toggling details persists
- * across dialog openings.
- */
-add_task(async function test_toggling_details_persists() {
-  {
-    let wh = new WindowHelper();
-    wh.onload = function() {
-      // Check all items and select "Everything"
-      this.checkAllCheckboxes();
-      this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
-
-      // Hide details
-      this.toggleDetails();
-      this.checkDetails(false);
-      this.acceptDialog();
-    };
-    wh.open();
-    await wh.promiseClosed;
-  }
-  {
-    let wh = new WindowHelper();
-    wh.onload = function() {
-      // Details should remain closed because all items are checked.
-      this.checkDetails(false);
-
-      // Uncheck history.
-      this.checkPrefCheckbox("history", false);
-      this.acceptDialog();
-    };
-    wh.open();
-    await wh.promiseClosed;
-  }
-  {
-    let wh = new WindowHelper();
-    wh.onload = function() {
-      // Details should be open because not all items are checked.
-      this.checkDetails(true);
-
-      // Modify the Site Preferences item state (bug 527820)
-      this.checkAllCheckboxes();
-      this.checkPrefCheckbox("siteSettings", false);
-      this.acceptDialog();
-    };
-    wh.open();
-    await wh.promiseClosed;
-  }
-  {
-    let wh = new WindowHelper();
-    wh.onload = function() {
-      // Details should be open because not all items are checked.
-      this.checkDetails(true);
-
-      // Hide details
-      this.toggleDetails();
-      this.checkDetails(false);
-      this.cancelDialog();
-    };
-    wh.open();
-    await wh.promiseClosed;
-  }
-  {
-    let wh = new WindowHelper();
-    wh.onload = function() {
-      // Details should be open because not all items are checked.
-      this.checkDetails(true);
-
-      // Select another duration
-      this.selectDuration(Sanitizer.TIMESPAN_HOUR);
-      // Hide details
-      this.toggleDetails();
-      this.checkDetails(false);
-      this.acceptDialog();
-    };
-    wh.open();
-    await wh.promiseClosed;
-  }
-  {
-    let wh = new WindowHelper();
-    wh.onload = function() {
-      // Details should not be open because "Last Hour" is selected
-      this.checkDetails(false);
-
-      this.cancelDialog();
-    };
-    wh.open();
-    await wh.promiseClosed;
-  }
-  {
-    let wh = new WindowHelper();
-    wh.onload = function() {
-      // Details should have remained closed
-      this.checkDetails(false);
-
-      // Show details
-      this.toggleDetails();
-      this.checkDetails(true);
-      this.cancelDialog();
-    };
-    wh.open();
-    await wh.promiseClosed;
-  }
-});
-
 // Test for offline cache deletion
 add_task(async function test_offline_cache() {
   // Prepare stuff, we will work with www.example.com
   var URL = "http://www.example.com";
   var URI = makeURI(URL);
   var principal = Services.scriptSecurityManager.createCodebasePrincipal(URI, {});
 
   // Give www.example.com privileges to store offline data
@@ -562,18 +435,16 @@ add_task(async function test_offline_cac
   var appcachegroupid = appcacheserv.buildGroupIDForInfo(makeURI(URL + "/manifest"), Services.loadContextInfo.default);
   var appcache = appcacheserv.createApplicationCache(appcachegroupid);
   var storage = Services.cache2.appCacheStorage(Services.loadContextInfo.default, appcache);
 
   // Open the dialog
   let wh = new WindowHelper();
   wh.onload = function() {
     this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
-    // Show details
-    this.toggleDetails();
     // Clear only offlineApps
     this.uncheckAllCheckboxes();
     this.checkPrefCheckbox("offlineApps", true);
     this.acceptDialog();
   };
   wh.onunload = function() {
     // Check if the cache has been deleted
     var size = -1;
@@ -612,18 +483,16 @@ add_task(async function test_offline_app
   var principal = Services.scriptSecurityManager.createCodebasePrincipal(URI, {});
 
   let promiseSanitized = promiseSanitizationComplete();
 
   // Open the dialog
   let wh = new WindowHelper();
   wh.onload = function() {
     this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
-    // Show details
-    this.toggleDetails();
     // Clear only offlineApps
     this.uncheckAllCheckboxes();
     this.checkPrefCheckbox("siteSettings", true);
     this.acceptDialog();
   };
   wh.onunload = async function() {
     await promiseSanitized;
 
@@ -662,46 +531,16 @@ WindowHelper.prototype = {
   /**
    * "Presses" the dialog's Cancel button.
    */
   cancelDialog() {
     this.win.document.documentElement.cancelDialog();
   },
 
   /**
-   * Ensures that the details progressive disclosure button and the item list
-   * hidden by it match up.  Also makes sure the height of the dialog is
-   * sufficient for the item list and warning panel.
-   *
-   * @param aShouldBeShown
-   *        True if you expect the details to be shown and false if hidden
-   */
-  checkDetails(aShouldBeShown) {
-    let button = this.getDetailsButton();
-    let list = this.getItemList();
-    let hidden = list.hidden || list.collapsed;
-    is(hidden, !aShouldBeShown,
-       "Details should be " + (aShouldBeShown ? "shown" : "hidden") +
-       " but were actually " + (hidden ? "hidden" : "shown"));
-    let dir = hidden ? "down" : "up";
-    is(button.className, "expander-" + dir,
-       "Details button should be " + dir + " because item list is " +
-       (hidden ? "" : "not ") + "hidden");
-    let height = 0;
-    if (!hidden) {
-      ok(list.boxObject.height > 30, "listbox has sufficient size");
-      height += list.boxObject.height;
-    }
-    if (this.isWarningPanelVisible())
-      height += this.getWarningPanel().boxObject.height;
-    ok(height < this.win.innerHeight,
-       "Window should be tall enough to fit warning panel and item list");
-  },
-
-  /**
    * (Un)checks a history scope checkbox (browser & download history,
    * form history, etc.).
    *
    * @param aPrefName
    *        The final portion of the checkbox's privacy.cpd.* preference name
    * @param aCheckState
    *        True if the checkbox should be checked, false otherwise
    */
@@ -731,37 +570,23 @@ WindowHelper.prototype = {
     this._checkAllCheckboxesCustom(true);
   },
 
   uncheckAllCheckboxes() {
     this._checkAllCheckboxesCustom(false);
   },
 
   /**
-   * @return The details progressive disclosure button
-   */
-  getDetailsButton() {
-    return this.win.document.getElementById("detailsExpander");
-  },
-
-  /**
    * @return The dialog's duration dropdown
    */
   getDurationDropdown() {
     return this.win.document.getElementById("sanitizeDurationChoice");
   },
 
   /**
-   * @return The item list hidden by the details progressive disclosure button
-   */
-  getItemList() {
-    return this.win.document.getElementById("itemList");
-  },
-
-  /**
    * @return The clear-everything warning box
    */
   getWarningPanel() {
     return this.win.document.getElementById("sanitizeEverythingWarningBox");
   },
 
   /**
    * @return True if the "Everything" warning panel is visible (as opposed to
@@ -852,23 +677,16 @@ WindowHelper.prototype = {
     if (aDurVal === Sanitizer.TIMESPAN_EVERYTHING) {
       is(this.isWarningPanelVisible(), true,
          "Warning panel should be visible for TIMESPAN_EVERYTHING");
     } else {
       is(this.isWarningPanelVisible(), false,
          "Warning panel should not be visible for non-TIMESPAN_EVERYTHING");
     }
   },
-
-  /**
-   * Toggles the details progressive disclosure button.
-   */
-  toggleDetails() {
-    this.getDetailsButton().click();
-  }
 };
 
 function promiseSanitizationComplete() {
   return TestUtils.topicObserved("sanitizer-sanitization-complete");
 }
 
 /**
  * Adds a download to history.
--- a/browser/locales/en-US/chrome/browser/sanitize.dtd
+++ b/browser/locales/en-US/chrome/browser/sanitize.dtd
@@ -24,22 +24,16 @@
 <!ENTITY clearTimeDuration.last2Hours     "Last Two Hours">
 <!ENTITY clearTimeDuration.last4Hours     "Last Four Hours">
 <!ENTITY clearTimeDuration.today          "Today">
 <!ENTITY clearTimeDuration.everything     "Everything">
 <!-- Localization note (clearTimeDuration.suffix) - trailing entity for languages
 that require it.  -->
 <!ENTITY clearTimeDuration.suffix         "">
 
-<!-- LOCALIZATION NOTE (detailsProgressiveDisclosure.*): Labels and accesskeys
-     of the "Details" progressive disclosure button.  See UI mockup at bug
-     480169 -->
-<!ENTITY detailsProgressiveDisclosure.label     "Details">
-<!ENTITY detailsProgressiveDisclosure.accesskey "e">
-
 <!ENTITY historySection.label         "History">
 <!ENTITY dataSection.label            "Data">
 
 <!ENTITY itemHistoryAndDownloads.label     "Browsing &amp; Download History">
 <!ENTITY itemHistoryAndDownloads.accesskey "B">
 <!ENTITY itemFormSearchHistory.label       "Form &amp; Search History">
 <!ENTITY itemFormSearchHistory.accesskey   "F">
 <!ENTITY itemCookies.label                 "Cookies">
--- a/browser/themes/linux/sanitizeDialog.css
+++ b/browser/themes/linux/sanitizeDialog.css
@@ -35,62 +35,15 @@
 }
 
 #sanitizeEverythingWarningDescBox {
   padding: 0 16px;
   margin: 0;
 }
 
 
-/* Progressive disclosure button */
-#detailsExpanderWrapper {
-  padding: 0;
-  margin-top: 6px;
-  margin-bottom: 6px;
-  margin-inline-start: -4px;
-  margin-inline-end: 0;
-}
-
-.expander-up,
-.expander-down {
-  min-width: 0;
-  padding: 2px 0;
-  padding-inline-start: 2px;
-}
-
-.expander-up {
-  list-style-image: url("chrome://global/skin/arrow/arrow-up.gif");
-}
-
-.expander-down {
-  list-style-image: url("chrome://global/skin/arrow/arrow-dn.gif");
-}
-
-.expander-down:hover:active {
-  list-style-image: url("chrome://global/skin/arrow/arrow-dn-hov.gif");
-}
-
-.expander-up:hover:active {
-  list-style-image: url("chrome://global/skin/arrow/arrow-up-hov.gif");
-}
-
-
-/* Make the item list the same width as the warning box */
-#itemList {
-  margin-inline-start: 0;
-  margin-inline-end: 0;
-}
-
-/* Without this a useless scrollbar appears in the listbox when its rows
-   attribute is set to the total number of listitems, as it is currently.  See
-   bug 489958 comment 14 and bug 491788. */
-#itemList > listitem {
-  padding: 1px 0;
-}
-
-
 /* Align the last dialog button with the end of the warning box */
 .dialog-button-box {
   margin-inline-end: 0;
 }
 .dialog-button[dlgtype="accept"] {
   margin-inline-end: 0;
 }
--- a/browser/themes/osx/sanitizeDialog.css
+++ b/browser/themes/osx/sanitizeDialog.css
@@ -31,50 +31,15 @@
 }
 
 #sanitizeEverythingWarningDescBox {
   padding: 0 16px;
   margin: 0;
 }
 
 
-/* Progressive disclosure button */
-#detailsExpanderWrapper {
-  padding: 0;
-  margin-top: 6px;
-  margin-bottom: 6px;
-}
-
-.expander-up,
-.expander-down {
-  padding: 0;
-  margin: 0;
-}
-
-.expander-up {
-  -moz-appearance: -moz-mac-disclosure-button-open;
-}
-
-.expander-down {
-  -moz-appearance: -moz-mac-disclosure-button-closed;
-}
-
-/* Make the item list the same width as the warning box */
-#itemList {
-  margin-inline-start: 0;
-  margin-inline-end: 0;
-}
-
-/* Without this a useless scrollbar appears in the listbox when its rows
-   attribute is set to the total number of listitems, as it is currently.  See
-   bug 489958 comment 14 and bug 491788. */
-#itemList > listitem {
-  padding: 1px 0;
-}
-
-
 /* Align the last dialog button with the end of the warning box */
 .dialog-button-box {
   margin-inline-end: 0;
 }
 .dialog-button[dlgtype="accept"] {
   margin-inline-end: 0;
 }
--- a/browser/themes/windows/sanitizeDialog.css
+++ b/browser/themes/windows/sanitizeDialog.css
@@ -35,48 +35,15 @@
 }
 
 #sanitizeEverythingWarningDescBox {
   padding: 0 16px;
   margin: 0;
 }
 
 
-/* Progressive disclosure button */
-#detailsExpanderWrapper {
-  padding: 0;
-  margin: 6px 0;
-}
-
-.expander-up,
-.expander-down {
-  min-width: 0;
-  margin: 0;
-}
-
-.expander-up > .button-box,
-.expander-down > .button-box {
-  padding: 0;
-}
-
-.expander-up {
-  list-style-image: url("chrome://global/skin/icons/collapse.png");
-}
-
-.expander-down {
-  list-style-image: url("chrome://global/skin/icons/expand.png");
-}
-
-
-/* Make the item list the same width as the warning box */
-#itemList {
-  margin-inline-start: 0;
-  margin-inline-end: 0;
-}
-
-
 /* Align the last dialog button with the end of the warning box */
 .dialog-button-box {
   margin-inline-end: 0;
 }
 .dialog-button[dlgtype="cancel"] {
   margin-inline-end: 0;
 }
deleted file mode 100644
index b07a6d2a85bf9799d5c9924b7042963f4c624a02..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index b8bd0f519805de3a810bfb0f71a538a16eaf0107..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
--- a/toolkit/themes/linux/global/jar.mn
+++ b/toolkit/themes/linux/global/jar.mn
@@ -25,18 +25,16 @@ toolkit.jar:
    skin/classic/global/scrollbox.css
    skin/classic/global/splitter.css
    skin/classic/global/tabbox.css
    skin/classic/global/textbox.css
    skin/classic/global/toolbar.css
    skin/classic/global/toolbarbutton.css
    skin/classic/global/tree.css
 *  skin/classic/global/alerts/alert.css                        (alerts/alert.css)
-   skin/classic/global/arrow/arrow-dn-hov.gif                  (arrow/arrow-dn-hov.gif)
-   skin/classic/global/arrow/arrow-up-hov.gif                  (arrow/arrow-up-hov.gif)
 
    skin/classic/global/icons/Authentication.png                (icons/Authentication.png)
    skin/classic/global/icons/blacklist_favicon.png             (icons/blacklist_favicon.png)
    skin/classic/global/icons/blacklist_large.png               (icons/blacklist_large.png)
    skin/classic/global/icons/Close.gif                         (icons/Close.gif)
    skin/classic/global/icons/Minimize.gif                      (icons/Minimize.gif)
    skin/classic/global/icons/Restore.gif                       (icons/Restore.gif)
    skin/classic/global/icons/sslWarning.png                    (icons/sslWarning.png)