Bug 1771112 - Temporarily remove ChromeUtils.importModule API r=smaug

This removes the API and skips the tests. The implementation in
mozJSComponentLoader is not removed.

This patch will be backed out after the next merge.

Differential Revision: https://phabricator.services.mozilla.com/D147278
This commit is contained in:
Jon Coppeard 2022-05-25 12:12:18 +00:00
Родитель 301e954586
Коммит a7fd419ccc
4 изменённых файлов: 2 добавлений и 51 удалений

Просмотреть файл

@ -566,38 +566,6 @@ void ChromeUtils::Import(const GlobalObject& aGlobal,
aRetval.set(exports);
}
/* static */
void ChromeUtils::ImportModule(const GlobalObject& aGlobal,
const nsAString& aResourceURI,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv) {
RefPtr<mozJSComponentLoader> moduleloader = mozJSComponentLoader::Get();
MOZ_ASSERT(moduleloader);
NS_ConvertUTF16toUTF8 registryLocation(aResourceURI);
AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING_NONSENSITIVE(
"ChromeUtils::ImportModule", OTHER, registryLocation);
JSContext* cx = aGlobal.Context();
JS::RootedObject moduleNamespace(cx);
nsresult rv =
moduleloader->ImportModule(cx, registryLocation, &moduleNamespace);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return;
}
MOZ_ASSERT(!JS_IsExceptionPending(cx));
if (!JS_WrapObject(cx, &moduleNamespace)) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
aRetval.set(moduleNamespace);
}
namespace module_getter {
static const size_t SLOT_ID = 0;
static const size_t SLOT_URI = 1;

Просмотреть файл

@ -196,11 +196,6 @@ class ChromeUtils {
const Optional<JS::Handle<JSObject*>>& aTargetObj,
JS::MutableHandle<JSObject*> aRetval, ErrorResult& aRv);
static void ImportModule(const GlobalObject& aGlobal,
const nsAString& aResourceURI,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv);
static void DefineModuleGetter(const GlobalObject& global,
JS::Handle<JSObject*> target,
const nsAString& id,

Просмотреть файл

@ -428,20 +428,6 @@ partial namespace ChromeUtils {
[Throws]
object import(UTF8String aResourceURI, optional object aTargetObj);
/**
* Synchronously loads and evaluates the JS module source located at
* 'aResourceURI'.
*
* @param aResourceURI A resource:// URI string to load the module from.
* @returns the module's namespace object.
*
* The implementation maintains a hash of aResourceURI->global obj.
* Subsequent invocations of import with 'aResourceURI' pointing to
* the same file will not cause the module to be re-evaluated.
*/
[Throws]
object importModule(DOMString aResourceURI);
/**
* Defines a property on the given target which lazily imports a JavaScript
* module when accessed.

Просмотреть файл

@ -179,4 +179,6 @@ head = head_watchdog.js
[test_uninitialized_lexical.js]
[test_print_stderr.js]
[test_import_es6_modules.js]
disabled=Skip tests for the temporarily removed ChromeUtils.importModule API (bug 1771112)
[test_import_shim.js]
disabled=Skip tests for the temporarily removed ChromeUtils.importModule API (bug 1771112)