mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-03 14:28:39 +09:00
Issue #1691 - Part 7b: Make load request element optional. https://bugzilla.mozilla.org/show_bug.cgi?id=1342012
(cherry picked from commit 169bb5d2ada59026fb6407716a7b3862810c9b97)
This commit is contained in:
parent
62be542166
commit
ba01d99e31
2 changed files with 38 additions and 16 deletions
|
|
@ -70,6 +70,7 @@ public:
|
|||
|
||||
const mozilla::CORSMode mCORSMode;
|
||||
const mozilla::net::ReferrerPolicy mReferrerPolicy;
|
||||
bool mIsPreload;
|
||||
nsCOMPtr<nsIScriptElement> mElement;
|
||||
nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;
|
||||
};
|
||||
|
|
@ -113,9 +114,9 @@ public:
|
|||
Element()->ScriptEvaluated(aResult, Element(), mIsInline);
|
||||
}
|
||||
|
||||
bool IsPreload()
|
||||
{
|
||||
return Element() == nullptr;
|
||||
bool IsPreload() const {
|
||||
MOZ_ASSERT_IF(mFetchOptions->mIsPreload, !Element());
|
||||
return mFetchOptions->mIsPreload;
|
||||
}
|
||||
|
||||
virtual void Cancel();
|
||||
|
|
@ -195,13 +196,32 @@ public:
|
|||
return mFetchOptions->mTriggeringPrincipal;
|
||||
}
|
||||
|
||||
void SetElement(nsIScriptElement* aElement)
|
||||
// Make this request a preload (speculative) request.
|
||||
void SetIsPreloadRequest()
|
||||
{
|
||||
MOZ_ASSERT(!Element());
|
||||
MOZ_ASSERT(!IsPreload());
|
||||
mFetchOptions->mIsPreload = true;
|
||||
}
|
||||
|
||||
// Make a preload request into an actual load request for the given element.
|
||||
void SetIsLoadRequest(nsIScriptElement* aElement)
|
||||
{
|
||||
// Called when a preload request is later used for an actual request.
|
||||
MOZ_ASSERT(aElement);
|
||||
MOZ_ASSERT(!Element());
|
||||
MOZ_ASSERT(IsPreload());
|
||||
mFetchOptions->mElement = aElement;
|
||||
}
|
||||
mFetchOptions->mIsPreload = false;
|
||||
}
|
||||
|
||||
FromParser GetParserCreated() const
|
||||
{
|
||||
nsIScriptElement* element = Element();
|
||||
if (!element) {
|
||||
return NOT_FROM_PARSER;
|
||||
}
|
||||
return element->GetParserCreated();
|
||||
}
|
||||
|
||||
void SetScript(JSScript* aScript);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue