Bug 1361369 - Rename some script load request flags to be more descriptive r=smaug

This commit is contained in:
Jon Coppeard 2018-01-08 15:17:33 +00:00
parent 47ff9e1a9b
commit a606770b91
3 changed files with 12 additions and 12 deletions

View File

@ -53,8 +53,8 @@ ScriptLoadRequest::ScriptLoadRequest(ScriptKind aKind,
, mDataType(DataType::Unknown)
, mIsInline(true)
, mHasSourceMapURL(false)
, mIsDefer(false)
, mIsAsync(false)
, mInDeferList(false)
, mInAsyncList(false)
, mPreloadAsAsync(false)
, mPreloadAsDefer(false)
, mIsNonAsyncScriptInserted(false)

View File

@ -163,8 +163,8 @@ public:
DataType mDataType; // Does this contain Source or Bytecode?
bool mIsInline; // Is the script inline or loaded?
bool mHasSourceMapURL; // Does the HTTP header have a source map url?
bool mIsDefer; // True if we live in mDeferRequests.
bool mIsAsync; // True if we live in mLoadingAsyncRequests or mLoadedAsyncRequests.
bool mInDeferList; // True if we live in mDeferRequests.
bool mInAsyncList; // True if we live in mLoadingAsyncRequests or mLoadedAsyncRequests.
bool mPreloadAsAsync; // True if this is a preload request and the script is async
bool mPreloadAsDefer; // True if this is a preload request and the script is defer
bool mIsNonAsyncScriptInserted; // True if we live in mNonAsyncExternalScriptInsertedRequests

View File

@ -1472,7 +1472,7 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
request->mValidJSVersion = validJSVersion;
if (aElement->GetScriptAsync()) {
request->mIsAsync = true;
request->mInAsyncList = true;
if (request->IsReadyToRun()) {
mLoadedAsyncRequests.AppendElement(request);
// The script is available already. Run it ASAP when the event
@ -1594,10 +1594,10 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
if (request->IsModuleRequest()) {
ModuleLoadRequest* modReq = request->AsModuleRequest();
modReq->mBaseURL = mDocument->GetDocBaseURI();
modReq->mIsAsync = aElement->GetScriptAsync();
modReq->mInAsyncList = aElement->GetScriptAsync();
if (aElement->GetParserCreated() != NOT_FROM_PARSER) {
if (modReq->mIsAsync) {
if (modReq->mInAsyncList) {
mLoadingAsyncRequests.AppendElement(modReq);
} else {
AddDeferRequest(modReq);
@ -2952,14 +2952,14 @@ ScriptLoader::HandleLoadError(ScriptLoadRequest *aRequest, nsresult aResult)
SetModuleFetchFinishedAndResumeWaitingRequests(request, aResult);
}
if (aRequest->mIsDefer) {
if (aRequest->mInDeferList) {
MOZ_ASSERT_IF(aRequest->IsModuleRequest(),
aRequest->AsModuleRequest()->IsTopLevel());
if (aRequest->isInList()) {
RefPtr<ScriptLoadRequest> req = mDeferRequests.Steal(aRequest);
FireScriptAvailable(aResult, req);
}
} else if (aRequest->mIsAsync) {
} else if (aRequest->mInAsyncList) {
MOZ_ASSERT_IF(aRequest->IsModuleRequest(),
aRequest->AsModuleRequest()->IsTopLevel());
if (aRequest->isInList()) {
@ -3031,10 +3031,10 @@ ScriptLoader::MaybeMoveToLoadedList(ScriptLoadRequest* aRequest)
{
MOZ_ASSERT(aRequest->IsReadyToRun());
// If it's async, move it to the loaded list. aRequest->mIsAsync really
// If it's async, move it to the loaded list. aRequest->mInAsyncList really
// _should_ be in a list, but the consequences if it's not are bad enough we
// want to avoid trying to move it if it's not.
if (aRequest->mIsAsync) {
if (aRequest->mInAsyncList) {
MOZ_ASSERT(aRequest->isInList());
if (aRequest->isInList()) {
RefPtr<ScriptLoadRequest> req = mLoadingAsyncRequests.Steal(aRequest);
@ -3257,7 +3257,7 @@ ScriptLoader::PreloadURI(nsIURI* aURI, const nsAString& aCharset,
void
ScriptLoader::AddDeferRequest(ScriptLoadRequest* aRequest)
{
aRequest->mIsDefer = true;
aRequest->mInDeferList = true;
mDeferRequests.AppendElement(aRequest);
if (mDeferEnabled && aRequest == mDeferRequests.getFirst() &&
mDocument && !mBlockingDOMContentLoaded) {