Bug 1170803 - Only check for all filetype associations in Windows versions preceding 8.0 to match the startup behavior. r=Gijs, a=sledru
authorJared Wein <jwein@mozilla.com>
Wed, 03 Jun 2015 11:41:19 -0400
changeset 275100 057ae6427e2252527d88eacccb9522cdc2ff055f
parent 275099 3eda1fec0688a21d5d6262d65875a3bf5adc5585
child 275101 09c91f99b007c06aef80cb2e1638b9db031c953a
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, sledru
bugs1170803
milestone40.0a2
Bug 1170803 - Only check for all filetype associations in Windows versions preceding 8.0 to match the startup behavior. r=Gijs, a=sledru
browser/components/preferences/in-content/main.js
--- a/browser/components/preferences/in-content/main.js
+++ b/browser/components/preferences/in-content/main.js
@@ -679,51 +679,66 @@ var gMainPane = {
   /*
    * Preferences:
    *
    * browser.shell.checkDefault
    * - true if a default-browser check (and prompt to make it so if necessary)
    *   occurs at startup, false otherwise
    */
 
+   /**
+    * Firefox can attempt to set itself as the default application
+    * for all related filetypes or just for HTML. Some platforms
+    * such as Windows have terrible UIs for all filetypes. In those
+    * platforms, Firefox only attempts to associate itself with HTML.
+    */
+   shouldClaimAllTypes: function()
+   {
+    let claimAllTypes = true;
+    try {
+      if (AppConstants.platform == "win") {
+        // In Windows 8+, the UI for selecting default protocol is much
+        // nicer than the UI for setting file type associations. So we
+        // only show the protocol association screen on Windows 8+.
+        // Windows 8 is version 6.2.
+        let version = Services.sysinfo.getProperty("version");
+        claimAllTypes = (parseFloat(version) < 6.2);
+      }
+    } catch (ex) {}
+    return claimAllTypes;
+   },
+
   /**
    * Show button for setting browser as default browser or information that
    * browser is already the default browser.
    */
   updateSetDefaultBrowser: function()
   {
     let shellSvc = getShellService();
     let defaultBrowserBox = document.getElementById("defaultBrowserBox");
     if (!shellSvc) {
       defaultBrowserBox.hidden = true;
       return;
     }
     let setDefaultPane = document.getElementById("setDefaultPane");
-    let selectedIndex = shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
+    let claimAllTypes = gMainPane.shouldClaimAllTypes();
+    let selectedIndex = shellSvc.isDefaultBrowser(false, claimAllTypes) ? 1 : 0;
     setDefaultPane.selectedIndex = selectedIndex;
   },
 
   /**
    * Set browser as the operating system default browser.
    */
   setDefaultBrowser: function()
   {
     let shellSvc = getShellService();
     if (!shellSvc)
       return;
     try {
-      let claimAllTypes = true;
-      if (AppConstants.platform == "win") {
-        // In Windows 8+, the UI for selecting default protocol is much
-        // nicer than the UI for setting file type associations. So we
-        // only show the protocol association screen on Windows 8+.
-        // Windows 8 is version 6.2.
-        let version = Services.sysinfo.getProperty("version");
-        claimAllTypes = (parseFloat(version) < 6.2);
-      }
+      let claimAllTypes = gMainPane.shouldClaimAllTypes();
       shellSvc.setDefaultBrowser(claimAllTypes, false);
     } catch (ex) {
       Cu.reportError(ex);
       return;
     }
     let selectedIndex =
       shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
     document.getElementById("setDefaultPane").selectedIndex = selectedIndex;