Bug 1098350 Update history preferences for fallout from bug 530209 r=IanN a=Ratty
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Sun, 26 Apr 2015 22:39:57 +0100
changeset 22024 61279de5ae37d4988d90cda026139bc898ec5298
parent 22021 472eb039255019edaba4767e82a64a7d077a6081
child 22025 b8ca02cdc580ae3887fe7a17b7f69d07267dae93
push id1353
push userneil@parkwaycc.co.uk
push dateSun, 26 Apr 2015 21:40:07 +0000
treeherdercomm-beta@61279de5ae37 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN, Ratty
bugs1098350, 530209
Bug 1098350 Update history preferences for fallout from bug 530209 r=IanN a=Ratty a=IanN for checkin to a CLOSED TREE
mailnews/base/src/nsMsgContentPolicy.cpp
suite/browser/browser-prefs.js
suite/common/pref/pref-locationbar.js
suite/common/pref/pref-locationbar.xul
--- a/mailnews/base/src/nsMsgContentPolicy.cpp
+++ b/mailnews/base/src/nsMsgContentPolicy.cpp
@@ -694,27 +694,34 @@ nsresult nsMsgContentPolicy::SetDisableI
   rv = docshellTreeItem->GetItemType(&itemType);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // we're only worried about policy settings in content docshells
   if (itemType != nsIDocShellTreeItem::typeContent) {
     return NS_OK;
   }
 
+  nsCOMPtr<nsIDocShell_ESR38> docShellESR38(do_QueryInterface(docShell));
+  NS_ENSURE_SUCCESS(rv, rv);
+
   if (!isAllowedContent) {
     // Disable JavaScript on message URLs.
     rv = docShell->SetAllowJavascript(false);
     NS_ENSURE_SUCCESS(rv, rv);
+    rv = docShellESR38->SetAllowContentRetargetingOnChildren(false);
+    NS_ENSURE_SUCCESS(rv, rv);
     rv = docShell->SetAllowPlugins(mAllowPlugins);
     NS_ENSURE_SUCCESS(rv, rv);
   }
   else {
     // JavaScript and plugins are allowed on non-message URLs.
     rv = docShell->SetAllowJavascript(true);
     NS_ENSURE_SUCCESS(rv, rv);
+    rv = docShellESR38->SetAllowContentRetargetingOnChildren(true);
+    NS_ENSURE_SUCCESS(rv, rv);
     rv = docShell->SetAllowPlugins(true);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return NS_OK;
 }
 
 /**
--- a/suite/browser/browser-prefs.js
+++ b/suite/browser/browser-prefs.js
@@ -143,23 +143,23 @@ pref("browser.urlbar.autoFill", false);
 pref("browser.urlbar.showPopup", true);
 pref("browser.urlbar.showSearch", true);
 // 0: Match anywhere (e.g., middle of words)
 // 1: Match on word boundaries and then try matching anywhere
 // 2: Match only on word boundaries (e.g., after / or .)
 // 3: Match at the beginning of the url or title
 pref("browser.urlbar.matchBehavior", 1);
 
-// The default behavior for the urlbar can be configured to use any combination
-// of the restrict or match filters with each additional filter restricting
-// more (intersection). Add the following values to set the behavior as the
-// default: 1: history, 2: bookmark, 4: tag, 8: title, 16: url, 32: typed
-// E.g., 0 = show all results (no filtering), 1 = only visited pages in history,
-// 2 = only bookmarks, 3 = visited bookmarks, 1+16 = history matching in the url
-pref("browser.urlbar.default.behavior", 1);
+pref("browser.urlbar.suggest.history", true);
+pref("browser.urlbar.suggest.bookmark", false);
+// SeaMonkey doesn't support this.
+pref("browser.urlbar.suggest.openpage", false);
+
+pref("browser.urlbar.suggest.history.onlyTyped", false);
+
 pref("browser.urlbar.filter.javascript", true);
 
 // Size of "chunks" affects the number of places to process between each search
 // timeout (ms). Too big and the UI will be unresponsive; too small and we'll
 // be waiting on the timeout too often without many results.
 pref("browser.urlbar.search.chunkSize", 1000);
 pref("browser.urlbar.search.timeout", 100);
 
@@ -868,17 +868,19 @@ pref("services.sync.prefs.sync.browser.s
 pref("services.sync.prefs.sync.browser.tabs.autoHide", true);
 pref("services.sync.prefs.sync.browser.tabs.closeButtons", true);
 pref("services.sync.prefs.sync.browser.tabs.loadInBackground", true);
 pref("services.sync.prefs.sync.browser.tabs.warnOnClose", true);
 pref("services.sync.prefs.sync.browser.tabs.warnOnCloseOther", true);
 pref("services.sync.prefs.sync.browser.tabs.warnOnOpen", true);
 pref("services.sync.prefs.sync.browser.urlbar.autocomplete.enabled", true);
 pref("services.sync.prefs.sync.browser.urlbar.autoFill", true);
-pref("services.sync.prefs.sync.browser.urlbar.default.behavior", true);
+pref("services.sync.prefs.sync.browser.urlbar.suggest.history", true);
+pref("services.sync.prefs.sync.browser.urlbar.suggest.bookmark", true);
+pref("services.sync.prefs.sync.browser.urlbar.suggest.history.onlyTyped", true);
 pref("services.sync.prefs.sync.dom.disable_open_during_load", true);
 pref("services.sync.prefs.sync.dom.disable_window_flip", true);
 pref("services.sync.prefs.sync.dom.disable_window_move_resize", true);
 pref("services.sync.prefs.sync.dom.disable_window_open_feature.status", true);
 pref("services.sync.prefs.sync.dom.disable_window_status_change", true);
 pref("services.sync.prefs.sync.dom.event.contextmenu.enabled", true);
 pref("services.sync.prefs.sync.extensions.update.enabled", true);
 pref("services.sync.prefs.sync.general.smoothScroll", true);
--- a/suite/common/pref/pref-locationbar.js
+++ b/suite/common/pref/pref-locationbar.js
@@ -28,55 +28,27 @@ function updateDependent(aValue)
 {
   // The match pref checkboxes always depend on autocomplete.enabled.
   updateMatchPrefs();
 
   // If autoFill has a class attribute, we don't have the file view component.
   // We then need to update autoFill and showPopup.
   if (document.getElementById("autoFill").hasAttribute("class"))
   {
-    toggleCheckbox("autoFill", aValue);
-    toggleCheckbox("showPopup", aValue);
+    EnableElementById("autoFill", aValue);
+    EnableElementById("showPopup", aValue);
   }
 }
 
-function toggleCheckbox(aCheckbox, aPrefValue)
-{
-  if (!document.getElementById("browser.urlbar." + aCheckbox).locked)
-    document.getElementById(aCheckbox).disabled = !aPrefValue;
-}
-
 function updateMatchPrefs()
 {
   // The various match prefs don't make sense if both autoFill and showPopup
   // prefs are false or if autocomplete is turned off.
   var autoCompletePref = document.getElementById("browser.urlbar.autocomplete.enabled");
   var autoFillPref = document.getElementById("browser.urlbar.autoFill");
   var showPopupPref = document.getElementById("browser.urlbar.showPopup");
 
-  var matchDisabled = (!autoFillPref.value && !showPopupPref.value) ||
-                      !autoCompletePref.value;
-
-  if (!document.getElementById("browser.urlbar.default.behavior").locked) {
-    document.getElementById("matchOnlyTyped").disabled = matchDisabled;
-    document.getElementById("matchOnlyURLs").disabled = matchDisabled;
-  }
-
-  if (!document.getElementById("browser.urlbar.matchBehavior").locked)
-    document.getElementById("matchBehavior").disabled = matchDisabled;
-}
+  var matchEnabled = (autoFillPref.value || showPopupPref.value) &&
+                     autoCompletePref.value;
 
-function ReadDefaultBehavior(aField)
-{
-  var curval = document.getElementById("browser.urlbar.default.behavior").value;
-  // Return the right bit based on the id of "aField"
-  return (curval & kBehaviorBit[aField.id]) != 0;
+  EnableElementById("matchOnlyTyped", matchEnabled);
+  EnableElementById("matchBehavior", matchEnabled);
 }
-
-function WriteDefaultBehavior(aField)
-{
-  var curval = document.getElementById("browser.urlbar.default.behavior").value;
-  // Only care about the bit we have to change
-  if (aField.checked)
-    return curval | kBehaviorBit[aField.id];
-
-  return curval & ~kBehaviorBit[aField.id];
-}
--- a/suite/common/pref/pref-locationbar.xul
+++ b/suite/common/pref/pref-locationbar.xul
@@ -11,19 +11,19 @@
             label="&pref.locationBar.title;"
             script="chrome://communicator/content/pref/pref-locationbar.js">
 
     <preferences id="locationBar_preferences">
       <preference id="browser.urlbar.autocomplete.enabled"
                   name="browser.urlbar.autocomplete.enabled"
                   type="bool"
                   onchange="updateDependent(this.value);"/>
-      <preference id="browser.urlbar.default.behavior"
-                  name="browser.urlbar.default.behavior"
-                  type="int"/>
+      <preference id="browser.urlbar.suggest.history.onlyTyped"
+                  name="browser.urlbar.suggest.history.onlyTyped"
+                  type="bool"/>
       <preference id="browser.urlbar.matchBehavior"
                   name="browser.urlbar.matchBehavior"
                   type="int"/>
       <preference id="browser.urlbar.autoFill"
                   name="browser.urlbar.autoFill"
                   type="bool"
                   onchange="updateMatchPrefs();"/>
       <preference id="browser.urlbar.showPopup"
@@ -52,26 +52,17 @@
       <checkbox id="autoCompleteEnabled"
                 label="&enableAutoComplete.label;"
                 accesskey="&enableAutoComplete.accesskey;"
                 preference="browser.urlbar.autocomplete.enabled"/>
       <checkbox id="matchOnlyTyped"
                 class="indent"
                 label="&autoCompleteMatchOnlyTyped.label;"
                 accesskey="&autoCompleteMatchOnlyTyped.accesskey;"
-                preference="browser.urlbar.default.behavior"
-                onsyncfrompreference="return document.getElementById('locationBar_pane').ReadDefaultBehavior(this);"
-                onsynctopreference="return document.getElementById('locationBar_pane').WriteDefaultBehavior(this);"/>
-      <checkbox id="matchOnlyURLs"
-                class="indent"
-                label="&autoCompleteMatchOnlyURLs.label;"
-                accesskey="&autoCompleteMatchOnlyURLs.accesskey;"
-                preference="browser.urlbar.default.behavior"
-                onsyncfrompreference="return document.getElementById('locationBar_pane').ReadDefaultBehavior(this);"
-                onsynctopreference="return document.getElementById('locationBar_pane').WriteDefaultBehavior(this);"/>
+                preference="browser.urlbar.suggest.history.onlyTyped"/>
       <hbox align="center" class="indent">
         <label value="&autoCompleteMatch.label;" control="matchBehavior"
                accesskey="&autoCompleteMatch.accesskey;"/>
         <menulist id="matchBehavior"
                   preference="browser.urlbar.matchBehavior">
           <menupopup>
             <menuitem value="0" label="&autoCompleteMatchAnywhere;"/>
             <menuitem value="1" label="&autoCompleteMatchWordsFirst;"/>