Bug 1515605 - Enable ESLint for dom/localstorage (manual changes). r=janv
authorMark Banner <standard8@mozilla.com>
Fri, 21 Dec 2018 10:13:00 +0000
changeset 508759 4389ed44ce098d81136244e70a941d812ea73221
parent 508758 a535962417c0d37bd82387093238f6457109e279
child 508760 997e573df3677442ab25da9f7f6508bcae8b070e
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjanv
bugs1515605
milestone66.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 1515605 - Enable ESLint for dom/localstorage (manual changes). r=janv Differential Revision: https://phabricator.services.mozilla.com/D15073
.eslintignore
dom/localstorage/test/unit/.eslintrc.js
dom/localstorage/test/unit/databaseShadowing-shared.js
dom/localstorage/test/unit/head.js
dom/localstorage/test/unit/test_databaseShadowing1.js
dom/localstorage/test/unit/test_databaseShadowing2.js
dom/localstorage/test/unit/test_databaseShadowing_clearOrigin1.js
dom/localstorage/test/unit/test_databaseShadowing_clearOrigin2.js
dom/localstorage/test/unit/test_databaseShadowing_clearOriginsByPattern1.js
dom/localstorage/test/unit/test_databaseShadowing_clearOriginsByPattern2.js
dom/localstorage/test/unit/test_databaseShadowing_clearOriginsByPrefix1.js
dom/localstorage/test/unit/test_databaseShadowing_clearOriginsByPrefix2.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -180,17 +180,16 @@ dom/canvas/**
 dom/encoding/**
 dom/events/**
 dom/fetch/**
 dom/file/**
 dom/flex/**
 dom/grid/**
 dom/html/**
 dom/jsurl/**
-dom/localstorage/**
 dom/media/test/**
 dom/media/tests/**
 dom/media/webaudio/**
 dom/media/webspeech/**
 dom/messagechannel/**
 dom/midi/**
 dom/network/**
 dom/notification/Notification*.*
new file mode 100644
--- /dev/null
+++ b/dom/localstorage/test/unit/.eslintrc.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = {
+  "extends": [
+    "plugin:mozilla/xpcshell-test",
+  ]
+};
--- a/dom/localstorage/test/unit/databaseShadowing-shared.js
+++ b/dom/localstorage/test/unit/databaseShadowing-shared.js
@@ -1,8 +1,10 @@
+/* import-globals-from head.js */
+
 const principalInfos = [
   { url: "http://example.com", attrs: {} },
 
   { url: "http://origin.test", attrs: {} },
 
   { url: "http://prefix.test", attrs: {} },
   { url: "http://prefix.test", attrs: { userContextId: 10 } },
 
--- a/dom/localstorage/test/unit/head.js
+++ b/dom/localstorage/test/unit/head.js
@@ -1,13 +1,16 @@
 /**
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
+// Tests are expected to define testSteps.
+/* globals testSteps */
+
 const NS_ERROR_DOM_QUOTA_EXCEEDED_ERR = 22;
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 function is(a, b, msg) {
   Assert.equal(a, b, msg);
 }
 
@@ -125,20 +128,17 @@ function reset() {
 function resetOrigin(principal) {
   let request =
     Services.qms.resetStoragesForPrincipal(principal, "default", "ls");
 
   return request;
 }
 
 function installPackage(packageName) {
-  let directoryService = Cc["@mozilla.org/file/directory_service;1"]
-                         .getService(Ci.nsIProperties);
-
-  let currentDir = directoryService.get("CurWorkD", Ci.nsIFile);
+  let currentDir = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
 
   let packageFile = currentDir.clone();
   packageFile.append(packageName + ".zip");
 
   let zipReader = Cc["@mozilla.org/libjar/zip-reader;1"]
                   .createInstance(Ci.nsIZipReader);
   zipReader.open(packageFile);
 
@@ -174,20 +174,17 @@ function installPackage(packageName) {
       bostream.close();
     }
   }
 
   zipReader.close();
 }
 
 function getProfileDir() {
-  let directoryService =
-    Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
-
-  return directoryService.get("ProfD", Ci.nsIFile);
+  return Services.dirsvc.get("ProfD", Ci.nsIFile);
 }
 
 // Given a "/"-delimited path relative to the profile directory,
 // return an nsIFile representing the path.  This does not test
 // for the existence of the file or parent directories.
 // It is safe even on Windows where the directory separator is not "/",
 // but make sure you're not passing in a "\"-delimited path.
 function getRelativeFile(relativePath) {
@@ -235,21 +232,21 @@ function getLocalStorage(principal) {
     principal = getCurrentPrincipal();
   }
 
   return Services.domStorageManager.createStorage(null, principal, "");
 }
 
 function requestFinished(request) {
   return new Promise(function(resolve, reject) {
-    request.callback = function(request) {
-      if (request.resultCode == Cr.NS_OK) {
-        resolve(request.result);
+    request.callback = function(requestInner) {
+      if (requestInner.resultCode == Cr.NS_OK) {
+        resolve(requestInner.result);
       } else {
-        reject(request.resultCode);
+        reject(requestInner.resultCode);
       }
     };
   });
 }
 
 function loadSubscript(path) {
   let file = do_get_file(path, false);
   let uri = Services.io.newFileURI(file);
--- a/dom/localstorage/test/unit/test_databaseShadowing1.js
+++ b/dom/localstorage/test/unit/test_databaseShadowing1.js
@@ -1,13 +1,14 @@
 /**
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
+/* import-globals-from databaseShadowing-shared.js */
 loadSubscript("databaseShadowing-shared.js");
 
 async function testSteps() {
   enableNextGenLocalStorage();
 
   storeData();
 
   verifyData([]);
--- a/dom/localstorage/test/unit/test_databaseShadowing2.js
+++ b/dom/localstorage/test/unit/test_databaseShadowing2.js
@@ -1,13 +1,14 @@
 /**
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
+/* import-globals-from databaseShadowing-shared.js */
 loadSubscript("databaseShadowing-shared.js");
 
 async function testSteps() {
   // The shadow database was prepared in test_databaseShadowing1.js
 
   disableNextGenLocalStorage();
 
   if (!importShadowDatabase("shadowdb.sqlite")) {
--- a/dom/localstorage/test/unit/test_databaseShadowing_clearOrigin1.js
+++ b/dom/localstorage/test/unit/test_databaseShadowing_clearOrigin1.js
@@ -1,13 +1,14 @@
 /**
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
+/* import-globals-from databaseShadowing-shared.js */
 loadSubscript("databaseShadowing-shared.js");
 
 async function testSteps() {
   enableNextGenLocalStorage();
 
   storeData();
 
   verifyData([]);
--- a/dom/localstorage/test/unit/test_databaseShadowing_clearOrigin2.js
+++ b/dom/localstorage/test/unit/test_databaseShadowing_clearOrigin2.js
@@ -1,13 +1,14 @@
 /**
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
+/* import-globals-from databaseShadowing-shared.js */
 loadSubscript("databaseShadowing-shared.js");
 
 async function testSteps() {
   // The shadow database was prepared in test_databaseShadowing_clearOrigin1.js
 
   disableNextGenLocalStorage();
 
   if (!importShadowDatabase("shadowdb-clearedOrigin.sqlite")) {
--- a/dom/localstorage/test/unit/test_databaseShadowing_clearOriginsByPattern1.js
+++ b/dom/localstorage/test/unit/test_databaseShadowing_clearOriginsByPattern1.js
@@ -1,13 +1,14 @@
 /**
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
+/* import-globals-from databaseShadowing-shared.js */
 loadSubscript("databaseShadowing-shared.js");
 
 async function testSteps() {
   enableNextGenLocalStorage();
 
   storeData();
 
   verifyData([]);
--- a/dom/localstorage/test/unit/test_databaseShadowing_clearOriginsByPattern2.js
+++ b/dom/localstorage/test/unit/test_databaseShadowing_clearOriginsByPattern2.js
@@ -1,13 +1,14 @@
 /**
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
+/* import-globals-from databaseShadowing-shared.js */
 loadSubscript("databaseShadowing-shared.js");
 
 async function testSteps() {
   // The shadow database was prepared in
   // test_databaseShadowing_clearOriginsByPattern1.js
 
   disableNextGenLocalStorage();
 
--- a/dom/localstorage/test/unit/test_databaseShadowing_clearOriginsByPrefix1.js
+++ b/dom/localstorage/test/unit/test_databaseShadowing_clearOriginsByPrefix1.js
@@ -1,13 +1,14 @@
 /**
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
+/* import-globals-from databaseShadowing-shared.js */
 loadSubscript("databaseShadowing-shared.js");
 
 async function testSteps() {
   enableNextGenLocalStorage();
 
   storeData();
 
   verifyData([]);
--- a/dom/localstorage/test/unit/test_databaseShadowing_clearOriginsByPrefix2.js
+++ b/dom/localstorage/test/unit/test_databaseShadowing_clearOriginsByPrefix2.js
@@ -1,13 +1,14 @@
 /**
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
+/* import-globals-from databaseShadowing-shared.js */
 loadSubscript("databaseShadowing-shared.js");
 
 async function testSteps() {
   // The shadow database was prepared in
   // test_databaseShadowing_clearOriginsByPrefix1.js
 
   disableNextGenLocalStorage();