Bug 927680 - errorNotification should inherit from basicNotification in browser_popupNotification.js; r=MattN
authorTareq Khandaker <tareqakhandaker@gmail.com>
Fri, 18 Oct 2013 15:32:00 -0700
changeset 152603 ccd0c7234886b01408c3eaed46c15f0ee8c4241d
parent 152602 9c4262b8a391b2d37f2934f295ecd84e1174b777
child 152604 cd94525c17a419e540590d4e7f8e00467bd91ae7
push id25552
push usercbook@mozilla.com
push dateTue, 29 Oct 2013 12:21:45 +0000
treeherdermozilla-central@cd94525c17a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs927680
milestone28.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 927680 - errorNotification should inherit from basicNotification in browser_popupNotification.js; r=MattN
browser/base/content/test/general/browser_popupNotification.js
--- a/browser/base/content/test/general/browser_popupNotification.js
+++ b/browser/base/content/test/general/browser_popupNotification.js
@@ -144,70 +144,38 @@ function basicNotification() {
           self.shownCallbackTriggered = true;
           break;
         case "removed":
           self.removedCallbackTriggered = true;
           break;
       }
     }
   };
-  this.addOptions = function(options) {
-    for (let [name, value] in Iterator(options))
-      self.options[name] = value;
-  }
 }
 
+basicNotification.prototype.addOptions = function(options) {
+  for (let [name, value] in Iterator(options))
+    this.options[name] = value;
+};
+
 function errorNotification() {
   var self = this;
-  this.browser = gBrowser.selectedBrowser;
-  this.id = "test-notification-" + gTestIndex;
-  this.message = "This is popup notification " + this.id + " from test " + gTestIndex;
-  this.anchorID = null;
-  this.mainAction = {
-    label: "Main Action",
-    accessKey: "M",
-    callback: function () {
-      self.mainActionClicked = true;
-      throw new Error("Oops!");
-    }
+  this.mainAction.callback = function () {
+    self.mainActionClicked = true;
+    throw new Error("Oops!");
   };
-  this.secondaryActions = [
-    {
-      label: "Secondary Action",
-      accessKey: "S",
-      callback: function () {
-        self.secondaryActionClicked = true;
-        throw new Error("Oops!");
-      }
-    }
-  ];
-  this.options = {
-    eventCallback: function (eventName) {
-      switch (eventName) {
-        case "dismissed":
-          self.dismissalCallbackTriggered = true;
-          break;
-        case "showing":
-          self.showingCallbackTriggered = true;
-          break;
-        case "shown":
-          self.shownCallbackTriggered = true;
-          break;
-        case "removed":
-          self.removedCallbackTriggered = true;
-          break;
-      }
-    }
+  this.secondaryActions[0].callback = function () {
+    self.secondaryActionClicked = true;
+    throw new Error("Oops!");
   };
-  this.addOptions = function(options) {
-    for (let [name, value] in Iterator(options))
-      self.options[name] = value;
-  }
 }
 
+errorNotification.prototype = new basicNotification();
+errorNotification.prototype.constructor = errorNotification;
+
 var wrongBrowserNotificationObject = new basicNotification();
 var wrongBrowserNotification;
 
 var tests = [
   { // Test #0
     run: function () {
       this.notifyObj = new basicNotification();
       showNotification(this.notifyObj);