зеркало из https://github.com/mozilla/gecko-dev.git
Bug 900784 part 0.4 - Move aScriptFromHead to the ScriptLoadRequest. r=bkelly
Moving aScriptFromHead to a field of the ScriptLoadRequest ensure that all the state to call StartLoad is either in the ScriptLoader or in the ScriptLoadRequest. Thus, we can later add new calls to StartLoad, if we have to restart a request because of some decoding issues.
This commit is contained in:
Родитель
56de00a22d
Коммит
e2298251e0
|
@ -1030,7 +1030,7 @@ nsScriptLoader::StartFetchingModuleAndDependencies(nsModuleLoadRequest* aRequest
|
|||
|
||||
RefPtr<GenericPromise> ready = childRequest->mReady.Ensure(__func__);
|
||||
|
||||
nsresult rv = StartLoad(childRequest, false);
|
||||
nsresult rv = StartLoad(childRequest);
|
||||
if (NS_FAILED(rv)) {
|
||||
childRequest->mReady.Reject(rv, __func__);
|
||||
return ready;
|
||||
|
@ -1178,7 +1178,7 @@ nsScriptLoader::InstantiateModuleTree(nsModuleLoadRequest* aRequest)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsScriptLoader::StartLoad(nsScriptLoadRequest *aRequest, bool aScriptFromHead)
|
||||
nsScriptLoader::StartLoad(nsScriptLoadRequest *aRequest)
|
||||
{
|
||||
MOZ_ASSERT(aRequest->IsLoading());
|
||||
NS_ENSURE_TRUE(mDocument, NS_ERROR_NULL_POINTER);
|
||||
|
@ -1251,7 +1251,7 @@ nsScriptLoader::StartLoad(nsScriptLoadRequest *aRequest, bool aScriptFromHead)
|
|||
nsCOMPtr<nsIClassOfService> cos(do_QueryInterface(channel));
|
||||
|
||||
if (cos) {
|
||||
if (aScriptFromHead &&
|
||||
if (aRequest->mScriptFromHead &&
|
||||
!(script && (script->GetScriptAsync() || script->GetScriptDeferred()))) {
|
||||
// synchronous head scripts block loading of most other non js/css
|
||||
// content such as images
|
||||
|
@ -1535,10 +1535,10 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
|
|||
request->mURI = scriptURI;
|
||||
request->mIsInline = false;
|
||||
request->mReferrerPolicy = ourRefPolicy;
|
||||
// keep request->mScriptFromHead to false so we don't treat non preloaded
|
||||
// scripts as blockers for full page load. See bug 792438.
|
||||
|
||||
// set aScriptFromHead to false so we don't treat non preloaded scripts as
|
||||
// blockers for full page load. See bug 792438.
|
||||
rv = StartLoad(request, false);
|
||||
rv = StartLoad(request);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Asynchronously report the load failure
|
||||
NS_DispatchToCurrentThread(
|
||||
|
@ -2805,8 +2805,9 @@ nsScriptLoader::PreloadURI(nsIURI *aURI, const nsAString &aCharset,
|
|||
request->mURI = aURI;
|
||||
request->mIsInline = false;
|
||||
request->mReferrerPolicy = aReferrerPolicy;
|
||||
request->mScriptFromHead = aScriptFromHead;
|
||||
|
||||
nsresult rv = StartLoad(request, aScriptFromHead);
|
||||
nsresult rv = StartLoad(request);
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@ public:
|
|||
const mozilla::dom::SRIMetadata &aIntegrity)
|
||||
: mKind(aKind),
|
||||
mElement(aElement),
|
||||
mScriptFromHead(false),
|
||||
mProgress(Progress::Loading),
|
||||
mIsInline(true),
|
||||
mHasSourceMapURL(false),
|
||||
|
@ -167,6 +168,7 @@ public:
|
|||
|
||||
const nsScriptKind mKind;
|
||||
nsCOMPtr<nsIScriptElement> mElement;
|
||||
bool mScriptFromHead; // Synchronous head script block loading of other non js/css content.
|
||||
Progress mProgress; // Are we still waiting for a load to complete?
|
||||
bool mIsInline; // Is the script inline or loaded?
|
||||
bool mHasSourceMapURL; // Does the HTTP header have a source map url?
|
||||
|
@ -519,7 +521,7 @@ private:
|
|||
/**
|
||||
* Start a load for aRequest's URI.
|
||||
*/
|
||||
nsresult StartLoad(nsScriptLoadRequest *aRequest, bool aScriptFromHead);
|
||||
nsresult StartLoad(nsScriptLoadRequest *aRequest);
|
||||
|
||||
/**
|
||||
* Process any pending requests asynchronously (i.e. off an event) if there
|
||||
|
|
Загрузка…
Ссылка в новой задаче