diff --git a/.eslintignore b/.eslintignore index 597ce9ebe4ef..dd0755fe7b68 100644 --- a/.eslintignore +++ b/.eslintignore @@ -189,9 +189,6 @@ dom/media/webspeech/** dom/messagechannel/** dom/midi/** dom/network/** -dom/notification/Notification*.* -dom/notification/test/browser/** -dom/notification/test/mochitest/** dom/payments/** dom/performance/** dom/permission/** diff --git a/dom/notification/NotificationDB.jsm b/dom/notification/NotificationDB.jsm index ad950e4ffb8f..83651f0594e1 100644 --- a/dom/notification/NotificationDB.jsm +++ b/dom/notification/NotificationDB.jsm @@ -9,16 +9,11 @@ var EXPORTED_SYMBOLS = []; const DEBUG = false; function debug(s) { dump("-*- NotificationDB component: " + s + "\n"); } -const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {OS} = ChromeUtils.import("resource://gre/modules/osfile.jsm"); ChromeUtils.defineModuleGetter(this, "Services", "resource://gre/modules/Services.jsm"); -XPCOMUtils.defineLazyServiceGetter(this, "notificationStorage", - "@mozilla.org/notificationStorage;1", - "nsINotificationStorage"); - const NOTIFICATION_STORE_DIR = OS.Constants.Path.profileDir; const NOTIFICATION_STORE_PATH = OS.Path.join(NOTIFICATION_STORE_DIR, "notificationstore.json"); @@ -258,15 +253,16 @@ var NotificationDB = { switch (task.operation) { case "getall": return this.taskGetAll(task.data); - break; case "save": return this.taskSave(task.data); - break; case "delete": return this.taskDelete(task.data); - break; + + default: + return Promise.reject( + new Error(`Found a task with unknown operation ${task.operation}`)); } }) .then(payload => { @@ -279,7 +275,7 @@ var NotificationDB = { if (DEBUG) { debug("Error while running " + this.runningTask.operation + ": " + err); } - this.runningTask.defer.reject(new String(err)); + this.runningTask.defer.reject(err); }) .then(() => { this.runNextTask(); diff --git a/dom/notification/test/mochitest/MockServices.js b/dom/notification/test/mochitest/MockServices.js index a40192508a4f..9b06417807c4 100644 --- a/dom/notification/test/mochitest/MockServices.js +++ b/dom/notification/test/mochitest/MockServices.js @@ -1,3 +1,4 @@ +/* eslint-disable mozilla/use-chromeutils-generateqi */ var MockServices = (function() { "use strict"; @@ -76,7 +77,13 @@ var MockServices = (function() { } }, - QueryInterface: ChromeUtils.generateQI(["nsIAlertsService"]), + QueryInterface(aIID) { + if (SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsISupports) || + SpecialPowers.wrap(aIID).equals(SpecialPowers.Ci.nsIAlertsService)) { + return this; + } + throw SpecialPowers.Components.results.NS_ERROR_NO_INTERFACE; + }, createInstance(aOuter, aIID) { if (aOuter != null) { diff --git a/dom/notification/test/mochitest/NotificationTest.js b/dom/notification/test/mochitest/NotificationTest.js index 0ea77ad91186..1076afa65f34 100644 --- a/dom/notification/test/mochitest/NotificationTest.js +++ b/dom/notification/test/mochitest/NotificationTest.js @@ -22,7 +22,8 @@ var NotificationTest = (function() { (function executeRemainingTests(remainingTests) { if (!remainingTests.length) { - return callback(); + callback(); + return; } var nextTest = remainingTests.shift(); @@ -45,7 +46,7 @@ var NotificationTest = (function() { var fakeCustomData = (function() { var buffer = new ArrayBuffer(2); - var dv = new DataView(buffer).setInt16(0, 42, true); + new DataView(buffer).setInt16(0, 42, true); var canvas = document.createElement("canvas"); canvas.width = canvas.height = 100; var context = canvas.getContext("2d"); diff --git a/dom/notification/test/mochitest/test_notification_storage.html b/dom/notification/test/mochitest/test_notification_storage.html index c6ef3c54c641..c695b94c67c6 100644 --- a/dom/notification/test/mochitest/test_notification_storage.html +++ b/dom/notification/test/mochitest/test_notification_storage.html @@ -2,8 +2,8 @@