Source code
Revision control
Copy as Markdown
Other Tools
/* 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
export let ImportHelper = {
/**
* Helper so the new tab extension can easily trainhop while we convert
* modules from resource:// to moz-src:// URIs.
*
* @param {string} module
* The full moz-src URI to import.
* The resource url prefix to use for fallback import if moz-src fails.
* The helper will suffix _only_ the module filename to this path.
*/
try {
return ChromeUtils.importESModule(module);
} catch {
let baseName = module.split("/").pop();
// Fallback to a resource URI if moz-src fails.
return ChromeUtils.importESModule(fallbackResourcePath + baseName);
}
},
};