Bug 1392602 - Remove `evaluate` function from DevTools loader. r=jdescottes
authorAlexandre Poirot <poirot.alex@gmail.com>
Mon, 28 Aug 2017 14:01:34 +0200
changeset 428247 b550412100f2efc8a6e2442d197d727682f8272e
parent 428246 5aeb0b74d00ed08fe4236e1f26e139e1824c712d
child 428248 0b60e81f892e6eb7874a84876a6814d36dc86745
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1392602
milestone57.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 1392602 - Remove `evaluate` function from DevTools loader. r=jdescottes MozReview-Commit-ID: MGXxIWUxWF
devtools/shared/base-loader.js
--- a/devtools/shared/base-loader.js
+++ b/devtools/shared/base-loader.js
@@ -186,35 +186,16 @@ const Sandbox = function Sandbox(options
   delete sandbox.Iterator;
   delete sandbox.Components;
   delete sandbox.importFunction;
   delete sandbox.debug;
 
   return sandbox;
 }
 
-// Evaluates code from the given `uri` into given `sandbox`. If
-// `options.source` is passed, then that code is evaluated instead.
-// Optionally following options may be given:
-// - `options.encoding`: Source encoding, defaults to 'UTF-8'.
-// - `options.line`: Line number to start count from for stack traces.
-//    Defaults to 1.
-// - `options.version`: Version of JS used, defaults to '1.8'.
-const evaluate = function evaluate(sandbox, uri, options) {
-  let { source, line, version, encoding } = override({
-    encoding: 'UTF-8',
-    line: 1,
-    version: '1.8',
-    source: null
-  }, options);
-
-  return source ? Cu.evalInSandbox(source, sandbox, version, uri, line)
-                : loadSubScript(uri, sandbox, encoding);
-};
-
 // Populates `exports` of the given CommonJS `module` object, in the context
 // of the given `loader` by evaluating code associated with it.
 const load = function load(loader, module) {
   let { sandboxes, globals, loadModuleHook } = loader;
   let require = Require(loader, module);
 
   // We expose set of properties defined by `CommonJS` specification via
   // prototype of the sandbox. Also globals are deeper in the prototype
@@ -272,17 +253,17 @@ const load = function load(loader, modul
         URI: module.uri
       }
     });
   }
   sandboxes[module.uri] = sandbox;
 
   let originalExports = module.exports;
   try {
-    evaluate(sandbox, module.uri);
+    loadSubScript(module.uri, sandbox, 'UTF-8');
   }
   catch (error) {
     let { message, fileName, lineNumber } = error;
     let stack = error.stack || Error().stack;
     let frames = parseStack(stack).filter(isntLoaderFrame);
     let toString = String(error);
     let file = sourceURI(fileName);