Bug 747603 - Firefox:Inspector cannot start up with DOMi. r=dao a=lsblakk
authorPaul Rouget <paul@mozilla.com>
Tue, 01 May 2012 06:34:51 +0200
changeset 95605 a09e941412d1fa9c2f54ac1f2734fb1534d5e874
parent 95604 8a68244c078bc3eb71359ee42563f9943e4b2278
child 95606 e0dd3b0fbda29211d3264847659b94248129bb4d
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao, lsblakk
bugs747603
milestone14.0a2
Bug 747603 - Firefox:Inspector cannot start up with DOMi. r=dao a=lsblakk
browser/devtools/highlighter/inspector.jsm
--- a/browser/devtools/highlighter/inspector.jsm
+++ b/browser/devtools/highlighter/inspector.jsm
@@ -288,59 +288,61 @@ InspectorUI.prototype = {
 
   /**
    * Add a tooltip to the Inspect and Markup buttons.
    * The tooltips include the related keyboard shortcut.
    */
   buildButtonsTooltip: function IUI_buildButtonsTooltip()
   {
     let keysbundle = Services.strings.createBundle("chrome://global-platform/locale/platformKeys.properties");
+    let separator = keysbundle.GetStringFromName("MODIFIER_SEPARATOR");
 
     // Inspect Button - the shortcut string is built from the <key> element
 
+    let button, tooltip;
+
     let key = this.chromeDoc.getElementById("key_inspect");
 
-    let modifiersAttr = key.getAttribute("modifiers");
+    if (key) {
+      let modifiersAttr = key.getAttribute("modifiers");
 
-    let combo = [];
+      let combo = [];
 
-    if (modifiersAttr.match("accel"))
+      if (modifiersAttr.match("accel"))
 #ifdef XP_MACOSX
-      combo.push(keysbundle.GetStringFromName("VK_META"));
+        combo.push(keysbundle.GetStringFromName("VK_META"));
 #else
-      combo.push(keysbundle.GetStringFromName("VK_CONTROL"));
+        combo.push(keysbundle.GetStringFromName("VK_CONTROL"));
 #endif
-    if (modifiersAttr.match("shift"))
-      combo.push(keysbundle.GetStringFromName("VK_SHIFT"));
-    if (modifiersAttr.match("alt"))
-      combo.push(keysbundle.GetStringFromName("VK_ALT"));
-    if (modifiersAttr.match("ctrl"))
-      combo.push(keysbundle.GetStringFromName("VK_CONTROL"));
-    if (modifiersAttr.match("meta"))
-      combo.push(keysbundle.GetStringFromName("VK_META"));
+      if (modifiersAttr.match("shift"))
+        combo.push(keysbundle.GetStringFromName("VK_SHIFT"));
+      if (modifiersAttr.match("alt"))
+        combo.push(keysbundle.GetStringFromName("VK_ALT"));
+      if (modifiersAttr.match("ctrl"))
+        combo.push(keysbundle.GetStringFromName("VK_CONTROL"));
+      if (modifiersAttr.match("meta"))
+        combo.push(keysbundle.GetStringFromName("VK_META"));
 
-    combo.push(key.getAttribute("key"));
-
-    let separator = keysbundle.GetStringFromName("MODIFIER_SEPARATOR");
+      combo.push(key.getAttribute("key"));
 
-    let tooltip = this.strings.formatStringFromName("inspectButton.tooltiptext",
-      [combo.join(separator)], 1);
-    let button = this.chromeDoc.getElementById("inspector-inspect-toolbutton");
-    button.setAttribute("tooltiptext", tooltip);
+      tooltip = this.strings.formatStringFromName("inspectButton.tooltiptext",
+        [combo.join(separator)], 1);
+      button = this.chromeDoc.getElementById("inspector-inspect-toolbutton");
+      button.setAttribute("tooltiptext", tooltip);
+    }
 
     // Markup Button - the shortcut string is built from the accesskey attribute
 
     button = this.chromeDoc.getElementById("inspector-treepanel-toolbutton");
 #ifdef XP_MACOSX
     // On Mac, no accesskey
     tooltip = this.strings.GetStringFromName("markupButton.tooltip");
 #else
     let altString = keysbundle.GetStringFromName("VK_ALT");
     let accesskey = button.getAttribute("accesskey");
-    let separator = keysbundle.GetStringFromName("MODIFIER_SEPARATOR");
     let shortcut = altString + separator + accesskey;
     tooltip = this.strings.formatStringFromName("markupButton.tooltipWithAccesskey",
       [shortcut], 1);
 #endif
     button.setAttribute("tooltiptext", tooltip);
 
   },