Bug 1761432 - Part 2: Split out script load request state for when we require loading from source r=smaug

This is used when we explicitly don't want to load cached bytecode. It is
better served by a separate flag in the request than a state.

Differential Revision: https://phabricator.services.mozilla.com/D142042
This commit is contained in:
Jon Coppeard
2022-03-25 10:54:16 +00:00
parent 0ba898655d
commit df9edbebe8
4 changed files with 11 additions and 17 deletions

View File

@@ -184,20 +184,11 @@ class ScriptLoadRequest
virtual void SetReady();
enum class State : uint8_t {
Fetching, // Request either source or bytecode
FetchingSource, // Explicitly request source stream
Compiling,
LoadingImports,
Ready
};
enum class State : uint8_t { Fetching, Compiling, LoadingImports, Ready };
bool IsReadyToRun() const { return mState == State::Ready; }
bool IsLoading() const {
return mState == State::Fetching || mState == State::FetchingSource;
}
bool IsLoadingSource() const { return mState == State::FetchingSource; }
bool IsLoading() const { return mState == State::Fetching; }
bool InCompilingStage() const { return mState == State::Compiling; }
@@ -297,6 +288,7 @@ class ScriptLoadRequest
bool mIsCanceled; // True if we have been explicitly canceled.
State mState; // Are we still waiting for a load to complete?
bool mFetchSourceOnly; // Request source, not cached bytecode.
DataType mDataType; // Does this contain Source or Bytecode?
RefPtr<ScriptFetchOptions> mFetchOptions;
const SRIMetadata mIntegrity;