Bug 1403928 - Remove unused config/string-format.js, and mark config as a no-js-files directory in .eslintignore. r=glandium
authorMark Banner <standard8@mozilla.com>
Thu, 28 Sep 2017 14:55:03 +0100
changeset 384151 ab3b47fde689d52670a25b5cdc3f4afb8d2c2839
parent 384150 e544746f88e02b15d3a1c6ffa33e48f9ddceb4ee
child 384152 8a9c620351c9fbb759f4bbf78f42c9b4c41a44ef
push id32623
push userkwierso@gmail.com
push dateTue, 03 Oct 2017 20:25:55 +0000
treeherdermozilla-central@65a5054a1f92 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1403928, 1227388
milestone58.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 1403928 - Remove unused config/string-format.js, and mark config as a no-js-files directory in .eslintignore. r=glandium config/string-format.js was made obsolete in the removals in bug 1227388. MozReview-Commit-ID: 1nQwlKhoC0e
.eslintignore
config/string-format.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -3,17 +3,16 @@
 
 # Exclude expected objdirs.
 obj*/**
 
 # We ignore all these directories by default, until we get them enabled.
 # If you are enabling a directory, please add directory specific exclusions
 # below.
 chrome/**
-config/**
 docshell/**
 editor/**
 embedding/**
 extensions/cookie/**
 extensions/spellcheck/**
 extensions/universalchardet/**
 gfx/**
 image/**
@@ -31,16 +30,17 @@ tools/update-packaging/**
 uriloader/**
 view/**
 widget/**
 xpcom/**
 
 # We currently have no js files in these directories, so we ignore them by
 # default to aid ESLint's performance.
 build/**
+config/**
 db/**
 gradle/**
 hal/**
 mfbt/**
 mozglue/**
 nsprpub/**
 other-licenses/**
 probes/**
deleted file mode 100644
--- a/config/string-format.js
+++ /dev/null
@@ -1,65 +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/. */
-
-String.prototype.format = function string_format() {
-  // there are two modes of operation... unnamed indices are read in order;
-  // named indices using %(name)s. The two styles cannot be mixed.
-  // Unnamed indices can be passed as either a single argument to this function,
-  // multiple arguments to this function, or as a single array argument
-  let curindex = 0;
-  let d;
-
-  if (arguments.length > 1) {
-    d = arguments;
-  }
-  else
-    d = arguments[0];
-
-  function r(s, key, type) {
-    if (type == '%')
-      return '%';
-    
-    let v;
-    if (key == "") {
-      if (curindex == -1)
-        throw Error("Cannot mix named and positional indices in string formatting.");
-
-      if (curindex == 0 && (!(d instanceof Object) || !(0 in d))) {
-        v = d;
-      }
-      else if (!(curindex in d))
-        throw Error("Insufficient number of items in format, requesting item %i".format(curindex));
-      else {
-        v = d[curindex];
-      }
-
-      ++curindex;
-    }
-    else {
-      key = key.slice(1, -1);
-      if (curindex > 0)
-        throw Error("Cannot mix named and positional indices in string formatting.");
-      curindex = -1;
-
-      if (!(key in d))
-        throw Error("Key '%s' not present during string substitution.".format(key));
-      v = d[key];
-    }
-    switch (type) {
-    case "s":
-      if (v === undefined)
-        return "<undefined>";
-      return v.toString();
-    case "r":
-      return uneval(v);
-    case "i":
-      return parseInt(v);
-    case "f":
-      return Number(v);
-    default:
-      throw Error("Unexpected format character '%s'.".format(type));
-    }
-  }
-  return this.replace(/%(\([^)]+\))?(.)/g, r);
-};