Bug 1392602 - Instanciate RegExp only once in loader. r=jdescottes draft
authorAlexandre Poirot <poirot.alex@gmail.com>
Mon, 28 Aug 2017 14:05:17 +0200
changeset 657249 8f687043e921618e87387664845edd77805fff65
parent 657248 1e2c90c2949323772087b06a4fd53f143a2e84fc
child 657250 f6e59033b522b9b04cd86f122e2eb7969c14993c
push id77496
push userbmo:poirot.alex@gmail.com
push dateFri, 01 Sep 2017 09:32:27 +0000
reviewersjdescottes
bugs1392602
milestone57.0a1
Bug 1392602 - Instanciate RegExp only once in loader. r=jdescottes MozReview-Commit-ID: GGYMPKZwBsS
devtools/shared/base-loader.js
--- a/devtools/shared/base-loader.js
+++ b/devtools/shared/base-loader.js
@@ -759,15 +759,17 @@ function Loader(options) {
     load: { enumerable: false, value: options.load || load },
     requireHook: { enumerable: false, value: options.requireHook },
     loadModuleHook: { enumerable: false, value: options.loadModuleHook },
   };
 
   return Object.create(null, returnObj);
 };
 
-var isSystemURI = uri => /^resource:\/\/(gre|devtools|testing-common)\//.test(uri);
+var SystemRegExp = /^resource:\/\/(gre|devtools|testing-common)\//;
+var isSystemURI = uri => SystemRegExp.test(uri);
 
 var isJSONURI = uri => uri.endsWith('.json');
 var isJSMURI = uri => uri.endsWith('.jsm');
 var isJSURI = uri => uri.endsWith('.js');
-var isAbsoluteURI = uri => /^(resource|chrome|file|jar):/.test(uri);
+var AbsoluteRegExp = /^(resource|chrome|file|jar):/;
+var isAbsoluteURI = uri => AbsoluteRegExp.test(uri);
 var isRelative = id => id.startsWith(".");