diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /js/xpconnect/loader/nsImportModule.cpp | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/xpconnect/loader/nsImportModule.cpp')
-rw-r--r-- | js/xpconnect/loader/nsImportModule.cpp | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/js/xpconnect/loader/nsImportModule.cpp b/js/xpconnect/loader/nsImportModule.cpp index a313c44388..3720a444a6 100644 --- a/js/xpconnect/loader/nsImportModule.cpp +++ b/js/xpconnect/loader/nsImportModule.cpp @@ -39,44 +39,11 @@ static void AnnotateCrashReportWithJSException(JSContext* aCx, aURI, file.get(), line, column, NS_ConvertUTF16toUTF8(msg).get()); - CrashReporter::AnnotateCrashReport( + CrashReporter::RecordAnnotationNSCString( CrashReporter::Annotation::JSModuleLoadError, errorString); } } -nsresult ImportModule(const char* aURI, const char* aExportName, - const nsIID& aIID, void** aResult, bool aInfallible) { - AutoJSAPI jsapi; - MOZ_ALWAYS_TRUE(jsapi.Init(xpc::PrivilegedJunkScope())); - JSContext* cx = jsapi.cx(); - - JS::RootedObject global(cx); - JS::RootedObject exports(cx); - nsresult rv = mozJSModuleLoader::Get()->Import(cx, nsDependentCString(aURI), - &global, &exports); - if (NS_WARN_IF(NS_FAILED(rv))) { - if (aInfallible) { - AnnotateCrashReportWithJSException(cx, aURI); - - MOZ_CRASH_UNSAFE_PRINTF("Failed to load critical module \"%s\"", aURI); - } - return rv; - } - - if (aExportName) { - JS::RootedValue namedExport(cx); - if (!JS_GetProperty(cx, exports, aExportName, &namedExport)) { - return NS_ERROR_FAILURE; - } - if (!namedExport.isObject()) { - return NS_ERROR_XPC_BAD_CONVERT_JS; - } - exports.set(&namedExport.toObject()); - } - - return nsXPConnect::XPConnect()->WrapJS(cx, exports, aIID, aResult); -} - nsresult ImportESModule(const char* aURI, const char* aExportName, const nsIID& aIID, void** aResult, bool aInfallible) { AutoJSAPI jsapi; |