Bug 1425244 - Enable ESLint rule no-new-object for accessible/tests/mochitest/. r?surkov draft
authorMark Banner <standard8@mozilla.com>
Mon, 11 Dec 2017 13:45:41 +0000
changeset 711862 4f59fb2daf90838d6e0a8d2d2b02ce36b14f3f17
parent 711861 4282e5f1038f07390b0adff9e7451220512eaa39
child 711863 7fea85be45472076eb689e1d15b1bc745d0fa427
push id93179
push userbmo:standard8@mozilla.com
push dateThu, 14 Dec 2017 22:08:47 +0000
reviewerssurkov
bugs1425244
milestone59.0a1
Bug 1425244 - Enable ESLint rule no-new-object for accessible/tests/mochitest/. r?surkov MozReview-Commit-ID: AU5AlyOdgoy
accessible/tests/mochitest/.eslintrc.js
accessible/tests/mochitest/common.js
--- a/accessible/tests/mochitest/.eslintrc.js
+++ b/accessible/tests/mochitest/.eslintrc.js
@@ -7,15 +7,14 @@ module.exports = {
   "rules": {
     "mozilla/no-cpows-in-tests": "error",
     "mozilla/reject-importGlobalProperties": "error",
 
     // XXX These are rules that are enabled in the recommended configuration, but
     // disabled here due to failures when initially implemented. They should be
     // removed (and hence enabled) at some stage.
     "no-nested-ternary": "off",
-    "no-new-object": "off",
     "no-redeclare": "off",
     "no-shadow": "off",
     "no-undef": "off",
     "space-unary-ops": "off",
   }
 };
--- a/accessible/tests/mochitest/common.js
+++ b/accessible/tests/mochitest/common.js
@@ -719,18 +719,18 @@ function getTextFromClipboard() {
     createInstance(Components.interfaces.nsITransferable);
   trans.init(getLoadContext());
   if (!trans)
     return "";
 
   trans.addDataFlavor("text/unicode");
   clip.getData(trans, clip.kGlobalClipboard);
 
-  var str = new Object();
-  var strLength = new Object();
+  var str = {};
+  var strLength = {};
   trans.getTransferData("text/unicode", str, strLength);
 
   if (str)
     str = str.value.QueryInterface(Components.interfaces.nsISupportsString);
   if (str)
     return str.data.substring(0, strLength.value / 2);
 
   return "";