Bug 1824515 - Make js/xpconnect/loader/ buildable outside of a unified build environment r=andi

Differential Revision: https://phabricator.services.mozilla.com/D173615
This commit is contained in:
serge-sans-paille 2023-03-30 13:48:33 +00:00
parent dd9aff0466
commit c327880929
6 changed files with 9 additions and 7 deletions

View File

@ -65,7 +65,7 @@ already_AddRefed<ModuleLoadRequest> ComponentModuleLoader::CreateStaticImport(
nsIURI* aURI, ModuleLoadRequest* aParent) { nsIURI* aURI, ModuleLoadRequest* aParent) {
RefPtr<ComponentLoadContext> context = new ComponentLoadContext(); RefPtr<ComponentLoadContext> context = new ComponentLoadContext();
RefPtr<ModuleLoadRequest> request = new ModuleLoadRequest( RefPtr<ModuleLoadRequest> request = new ModuleLoadRequest(
aURI, aParent->mFetchOptions, SRIMetadata(), aParent->mURI, context, aURI, aParent->mFetchOptions, dom::SRIMetadata(), aParent->mURI, context,
false, /* is top level */ false, /* is top level */
false, /* is dynamic import */ false, /* is dynamic import */
this, aParent->mVisitedSet, aParent->GetRootModule()); this, aParent->mVisitedSet, aParent->GetRootModule());
@ -99,7 +99,7 @@ nsresult ComponentModuleLoader::StartFetch(ModuleLoadRequest* aRequest) {
} }
JSContext* cx = jsapi.cx(); JSContext* cx = jsapi.cx();
RootedScript script(cx); JS::RootedScript script(cx);
nsresult rv = nsresult rv =
mozJSModuleLoader::LoadSingleModuleScript(this, cx, aRequest, &script); mozJSModuleLoader::LoadSingleModuleScript(this, cx, aRequest, &script);
MOZ_ASSERT_IF(jsapi.HasException(), NS_FAILED(rv)); MOZ_ASSERT_IF(jsapi.HasException(), NS_FAILED(rv));

View File

@ -141,7 +141,7 @@ JSObject* ResolveModuleObjectProperty(JSContext* aCx,
JS::Handle<JSObject*> aModObj, JS::Handle<JSObject*> aModObj,
const char* aName) { const char* aName) {
if (JS_HasExtensibleLexicalEnvironment(aModObj)) { if (JS_HasExtensibleLexicalEnvironment(aModObj)) {
RootedObject lexical(aCx, JS_ExtensibleLexicalEnvironment(aModObj)); JS::RootedObject lexical(aCx, JS_ExtensibleLexicalEnvironment(aModObj));
bool found; bool found;
if (!JS_HasOwnProperty(aCx, lexical, aName, &found)) { if (!JS_HasOwnProperty(aCx, lexical, aName, &found)) {
return nullptr; return nullptr;

View File

@ -23,6 +23,8 @@
#include "js/TypeDecls.h" // JSContext, JSObject, JS::MutableHandleVector #include "js/TypeDecls.h" // JSContext, JSObject, JS::MutableHandleVector
#include "js/Value.h" // JS::Value #include "js/Value.h" // JS::Value
#include "js/friend/ErrorMessages.h" // JSMSG_* #include "js/friend/ErrorMessages.h" // JSMSG_*
#include "js/String.h"
#include "js/Modules.h"
namespace mozilla { namespace mozilla {
namespace loader { namespace loader {

View File

@ -18,6 +18,7 @@
#include "mozilla/Vector.h" #include "mozilla/Vector.h"
#include "mozilla/Result.h" #include "mozilla/Result.h"
#include "mozilla/loader/AutoMemMap.h" #include "mozilla/loader/AutoMemMap.h"
#include "MainThreadUtils.h"
#include "nsClassHashtable.h" #include "nsClassHashtable.h"
#include "nsIAsyncShutdown.h" #include "nsIAsyncShutdown.h"
#include "nsIFile.h" #include "nsIFile.h"

View File

@ -64,5 +64,3 @@ LOCAL_INCLUDES += [
] ]
include("/ipc/chromium/chromium-config.mozbuild") include("/ipc/chromium/chromium-config.mozbuild")
REQUIRES_UNIFIED_BUILD = True

View File

@ -13,6 +13,7 @@
#include "js/experimental/JSStencil.h" #include "js/experimental/JSStencil.h"
#include "mozilla/BasePrincipal.h" #include "mozilla/BasePrincipal.h"
#include "mozilla/Span.h"
using namespace JS; using namespace JS;
using namespace mozilla::scache; using namespace mozilla::scache;
@ -47,7 +48,7 @@ nsresult ReadCachedStencil(StartupCache* cache, nsACString& cachePath,
return rv; // don't warn since NOT_AVAILABLE is an ok error return rv; // don't warn since NOT_AVAILABLE is an ok error
} }
JS::TranscodeRange range(AsBytes(Span(buf, len))); JS::TranscodeRange range(AsBytes(mozilla::Span(buf, len)));
JS::TranscodeResult code = JS::DecodeStencil(cx, options, range, stencilOut); JS::TranscodeResult code = JS::DecodeStencil(cx, options, range, stencilOut);
return HandleTranscodeResult(cx, code); return HandleTranscodeResult(cx, code);
} }
@ -66,7 +67,7 @@ nsresult WriteCachedStencil(StartupCache* cache, nsACString& cachePath,
} }
// Move the vector buffer into a unique pointer buffer. // Move the vector buffer into a unique pointer buffer.
UniqueFreePtr<char[]> buf( mozilla::UniqueFreePtr<char[]> buf(
reinterpret_cast<char*>(buffer.extractOrCopyRawBuffer())); reinterpret_cast<char*>(buffer.extractOrCopyRawBuffer()));
nsresult rv = cache->PutBuffer(PromiseFlatCString(cachePath).get(), nsresult rv = cache->PutBuffer(PromiseFlatCString(cachePath).get(),
std::move(buf), size); std::move(buf), size);