--- a/devtools/shared/base-loader.js
+++ b/devtools/shared/base-loader.js
@@ -116,17 +116,17 @@ function join(base, ...paths) {
// wants X-ray vision with respect to objects inside the sandbox. Defaults
// to `true`.
// - `sandbox`: A sandbox to share JS compartment with. If omitted new
// compartment will be created.
// - `metadata`: A metadata object associated with the sandbox. It should
// be JSON-serializable.
// For more details see:
// https://developer.mozilla.org/en/Components.utils.Sandbox
-const Sandbox = function Sandbox(options) {
+function Sandbox(options) {
// Normalize options and rename to match `Cu.Sandbox` expectations.
options = {
// Do not expose `Components` if you really need them (bad idea!) you
// still can expose via prototype.
wantComponents: false,
sandboxName: options.name,
principal: 'principal' in options ? options.principal : systemPrincipal,
wantXrays: 'wantXrays' in options ? options.wantXrays : true,
@@ -151,17 +151,17 @@ const Sandbox = function Sandbox(options
delete sandbox.importFunction;
delete sandbox.debug;
return sandbox;
}
// 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) {
+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
// chain so that each module has access to them as well.
let descriptors = {
require: {
@@ -288,17 +288,17 @@ function normalizeExt(uri) {
isJSONURI(uri) ? uri :
isJSMURI(uri) ? uri :
uri + '.js';
}
// Utility function to join paths. In common case `base` is a
// `requirer.uri` but in some cases it may be `baseURI`. In order to
// avoid complexity we require `baseURI` with a trailing `/`.
-const resolve = function resolve(id, base) {
+function resolve(id, base) {
if (!isRelative(id))
return id;
let baseDir = dirname(base);
let resolved;
if (baseDir.includes(":"))
resolved = join(baseDir, id);
@@ -357,17 +357,17 @@ function compileMapping(paths) {
// This will replace the longest matching path mapping at the start of
// the ID string with its mapped value.
return id => {
return id.replace(pattern, (m0, m1) => paths[m1]);
};
}
-const resolveURI = function resolveURI(id, mapping) {
+function resolveURI(id, mapping) {
// Do not resolve if already a resource URI
if (isAbsoluteURI(id))
return normalizeExt(id);
return normalizeExt(mapping(id))
}
/**
@@ -419,17 +419,17 @@ function lazyRequireModule(obj, moduleId
defineLazyGetter(obj, prop, () => this.require(moduleId));
}
// Creates version of `require` that will be exposed to the given `module`
// in the context of the given `loader`. Each module gets own limited copy
// of `require` that is allowed to load only a modules that are associated
// with it during link time.
-const Require = function Require(loader, requirer) {
+function Require(loader, requirer) {
let {
modules, mapping, mappingCache,
manifest, rootURI, isNative, requireHook
} = loader;
function require(id) {
if (!id) // Throw if `id` is not passed.
throw Error('You must provide a module name when calling require() from '
@@ -552,28 +552,28 @@ const Require = function Require(loader,
};
};
return require;
}
// Makes module object that is made available to CommonJS modules when they
// are evaluated, along with `exports` and `require`.
-const Module = function Module(id, uri) {
+function Module(id, uri) {
return Object.create(null, {
id: { enumerable: true, value: id },
exports: { enumerable: true, writable: true, value: Object.create(null),
configurable: true },
uri: { value: uri }
});
}
// Takes `loader`, and unload `reason` string and notifies all observers that
// they should cleanup after them-self.
-const unload = function unload(loader, reason) {
+function unload(loader, reason) {
// subject is a unique object created per loader instance.
// This allows any code to cleanup on loader unload regardless of how
// it was loaded. To handle unload for specific loader subject may be
// asserted against loader.destructor or require('@loader/unload')
// Note: We don not destroy loader's module cache or sandboxes map as
// some modules may do cleanup in subsequent turns of event loop. Destroying
// cache may cause module identity problems in such cases.
let subject = { wrappedJSObject: loader.destructor };