Backout 757b3bbe3c63 (bug 877006) for suspected permaorange. r=bustage-fix.
authorMike Conley <mconley@mozilla.com>
Thu, 11 Jul 2013 15:23:26 -0400
changeset 138361 a8a320338f33a72c6b7f973fb8ab91c65309ae41
parent 138360 5a294331b6b558607fe92166c3ea4cdade5d8b0e
child 138362 e17f8d7d4ce205f10c01abf6541401e65ba6c067
push id230
push usermconley@mozilla.com
push dateThu, 11 Jul 2013 19:23:39 +0000
treeherderux@a8a320338f33 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage-fix
bugs877006
milestone25.0a1
backs out757b3bbe3c6313e674f155f884507fd6af041680
Backout 757b3bbe3c63 (bug 877006) for suspected permaorange. r=bustage-fix.
browser/components/customizableui/src/CustomizableUI.jsm
browser/components/customizableui/test/Makefile.in
browser/components/customizableui/test/browser_877006_missing_view.js
--- a/browser/components/customizableui/src/CustomizableUI.jsm
+++ b/browser/components/customizableui/src/CustomizableUI.jsm
@@ -816,33 +816,33 @@ let CustomizableUIInternal = {
 
       // If the widget has a view, and has view showing / hiding listeners,
       // hook those up to this widget.
       if (aWidget.type == "view" &&
           (aWidget.onViewShowing || aWidget.onViewHiding)) {
         LOG("Widget " + aWidget.id + " has a view with showing and hiding events. Auto-registering event handlers.");
         let viewNode = aDocument.getElementById(aWidget.viewId);
 
-        if (viewNode) {
-          // PanelUI relies on the .PanelUI-subView class to be able to show only
-          // one sub-view at a time.
-          viewNode.classList.add("PanelUI-subView");
+        if (!viewNode) {
+          ERROR("Could not find the view node with id: " + aWidget.viewId);
+          throw new Error("Could not find the view node with id: " + aWidget.viewId);
+        }
+
+        // PanelUI relies on the .PanelUI-subView class to be able to show only
+        // one sub-view at a time.
+        viewNode.classList.add("PanelUI-subView");
 
-          for (let eventName of kSubviewEvents) {
-            let handler = "on" + eventName;
-            if (typeof aWidget[handler] == "function") {
-              viewNode.addEventListener(eventName, aWidget[handler], false);
-            }
+        for (let eventName of kSubviewEvents) {
+          let handler = "on" + eventName;
+          if (typeof aWidget[handler] == "function") {
+            viewNode.addEventListener(eventName, aWidget[handler], false);
           }
+        }
 
-          LOG("Widget " + aWidget.id + " showing and hiding event handlers set.");
-        } else {
-          ERROR("Could not find the view node with id: " + aWidget.viewId +
-                ", for widget: " + aWidget.id + ".");
-        }
+        LOG("Widget " + aWidget.id + " showing and hiding event handlers set.");
       }
 
       if (aWidget.onCreated) {
         aWidget.onCreated(node);
       }
     }
 
     aWidget.instances.set(aDocument, node);
--- a/browser/components/customizableui/test/Makefile.in
+++ b/browser/components/customizableui/test/Makefile.in
@@ -7,17 +7,16 @@ topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_BROWSER_FILES = \
   browser_873501_handle_specials.js \
-  browser_877006_missing_view.js \
   browser_877178_unregisterArea.js \
   browser_877447_skip_missing_ids.js \
   browser_878452_drag_to_panel.js \
   browser_880382_drag_wide_widgets_in_panel.js \
   browser_885530_showInPrivateBrowsing.js \
   browser_887438_currentset_shim.js \
   browser_890262_destroyWidget_after_add_to_panel.js \
   head.js \
deleted file mode 100644
--- a/browser/components/customizableui/test/browser_877006_missing_view.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let gTests = [
-  {
-    desc: "Should be able to add broken view widget",
-    run: function() {
-      const kWidgetId = 'test-877006-broken-widget';
-      let widgetSpec = {
-        id: kWidgetId,
-        type: 'view',
-        viewId: 'idontexist',
-        defaultArea: CustomizableUI.AREA_NAVBAR,
-        /* Empty handler so we try to attach it maybe? */
-        onViewShowing: function() {
-        },
-      };
-
-      let noError = true;
-      try {
-        CustomizableUI.createWidget(widgetSpec);
-      } catch (ex) {
-        Cu.reportError(ex);
-        noError = false;
-      }
-      ok(noError, "Should not throw an exception trying to add a broken view widget.");
-
-      noError = true;
-      try {
-        CustomizableUI.destroyWidget(kWidgetId);
-      } catch (ex) {
-        Cu.reportError(ex);
-        noError = false;
-      }
-      ok(noError, "Should not throw an exception trying to remove the broken view widget.");
-    }
-  }
-];
-
-
-function asyncCleanup() {
-  yield resetCustomization();
-}
-
-function test() {
-  waitForExplicitFinish();
-  runTests(gTests, asyncCleanup);
-}
-