Bug 849604 - Metro Settings charm is not populated if opened to early [r=bbondy]
authorMatt Brubeck <mbrubeck@mozilla.com>
Wed, 13 Mar 2013 11:56:27 -0700
changeset 124737 e5603ef9f61ccbcad35340a96cf62d3964a5048c
parent 124736 89f02489c41198c7ef02fb14b6f88033886b2962
child 124738 d3d9a1552a4d62a7b80c53b5af8ef6fd610b3ae6
push id24573
push userryanvm@gmail.com
push dateWed, 13 Mar 2013 20:21:33 +0000
treeherdermozilla-inbound@459afca0e391 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbondy
bugs849604
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 849604 - Metro Settings charm is not populated if opened to early [r=bbondy]
browser/metro/base/content/browser-ui.js
--- a/browser/metro/base/content/browser-ui.js
+++ b/browser/metro/base/content/browser-ui.js
@@ -100,16 +100,17 @@ var BrowserUI = {
     ContextUI.init();
     StartUI.init();
     PanelUI.init();
     if (Browser.getHomePage() === "about:start") {
       StartUI.show();
     }
     FlyoutPanelsUI.init();
     PageThumbs.init();
+    SettingsCharm.init();
 
     // show the right toolbars, awesomescreen, etc for the os viewstate
     BrowserUI._adjustDOMforViewState();
 
     // We can delay some initialization until after startup.  We wait until
     // the first page is shown, then dispatch a UIReadyDelayed event.
     messageManager.addMessageListener("pageshow", function() {
       if (getBrowser().currentURI.spec == "about:blank")
@@ -151,21 +152,16 @@ var BrowserUI = {
 #ifdef MOZ_SERVICES_SYNC
         WeaveGlue.init();
 #endif
       } catch(ex) {
         Util.dumpLn("Exception in delay load module:", ex.message);
       }
 
       try {
-        SettingsCharm.init();
-      } catch (ex) {
-      }
-
-      try {
         // XXX This is currently failing
         CapturePickerUI.init();
       } catch(ex) {
         Util.dumpLn("Exception in CapturePickerUI:", ex.message);
       }
 
 #ifdef MOZ_UPDATER
       // Check for updates in progress
@@ -1729,18 +1725,23 @@ var SettingsCharm = {
   _nextId: 0,
 
   /**
    * Add a new item to the "Settings" menu in the Windows 8 charms.
    * @param aEntry Object with a "label" property (string that will appear in the UI)
    *    and an "onselected" property (function to be called when the user chooses this entry)
    */
   addEntry: function addEntry(aEntry) {
-    let id = MetroUtils.addSettingsPanelEntry(aEntry.label);
-    this._entries.set(id, aEntry);
+    try {
+      let id = MetroUtils.addSettingsPanelEntry(aEntry.label);
+      this._entries.set(id, aEntry);
+    } catch (e) {
+      // addSettingsPanelEntry does not work on non-Metro platforms
+      Cu.reportError(e);
+    }
   },
 
   init: function SettingsCharm_init() {
     Services.obs.addObserver(this, "metro-settings-entry-selected", false);
 
     // Options
     this.addEntry({
         label: Strings.browser.GetStringFromName("optionsCharm"),