mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-20 11:23:07 +09:00
moebius#230: Consider blocking top level window data: URIs (part 3/3 without tests)
https://github.com/MoonchildProductions/moebius/pull/230
This commit is contained in:
parent
73f89fe562
commit
18d312235d
20 changed files with 143 additions and 3 deletions
|
|
@ -1273,6 +1273,7 @@ nsDocShell::LoadURI(nsIURI* aURI,
|
|||
nsCOMPtr<nsISHEntry> shEntry;
|
||||
nsXPIDLString target;
|
||||
nsAutoString srcdoc;
|
||||
bool forceAllowDataURI = false;
|
||||
nsCOMPtr<nsIDocShell> sourceDocShell;
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
|
||||
|
|
@ -1308,6 +1309,7 @@ nsDocShell::LoadURI(nsIURI* aURI,
|
|||
aLoadInfo->GetSrcdocData(srcdoc);
|
||||
aLoadInfo->GetSourceDocShell(getter_AddRefs(sourceDocShell));
|
||||
aLoadInfo->GetBaseURI(getter_AddRefs(baseURI));
|
||||
aLoadInfo->GetForceAllowDataURI(&forceAllowDataURI);
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
|
@ -1561,6 +1563,10 @@ nsDocShell::LoadURI(nsIURI* aURI,
|
|||
flags |= INTERNAL_LOAD_FLAGS_IS_SRCDOC;
|
||||
}
|
||||
|
||||
if (forceAllowDataURI) {
|
||||
flags |= INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
|
||||
}
|
||||
|
||||
return InternalLoad(aURI,
|
||||
originalURI,
|
||||
loadReplace,
|
||||
|
|
@ -4822,6 +4828,9 @@ nsDocShell::LoadURIWithOptions(const char16_t* aURI,
|
|||
}
|
||||
nsAutoPopupStatePusher statePusher(popupState);
|
||||
|
||||
bool forceAllowDataURI =
|
||||
aLoadFlags & LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
|
||||
|
||||
// Don't pass certain flags that aren't needed and end up confusing
|
||||
// ConvertLoadTypeToDocShellLoadInfo. We do need to ensure that they are
|
||||
// passed to LoadURI though, since it uses them.
|
||||
|
|
@ -4851,6 +4860,7 @@ nsDocShell::LoadURIWithOptions(const char16_t* aURI,
|
|||
loadInfo->SetReferrerPolicy(aReferrerPolicy);
|
||||
loadInfo->SetHeadersStream(aHeaderStream);
|
||||
loadInfo->SetBaseURI(aBaseURI);
|
||||
loadInfo->SetForceAllowDataURI(forceAllowDataURI);
|
||||
|
||||
if (fixupInfo) {
|
||||
nsAutoString searchProvider, keyword;
|
||||
|
|
@ -10083,6 +10093,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
|||
// principal to inherit is: it should be aTriggeringPrincipal.
|
||||
loadInfo->SetPrincipalIsExplicit(true);
|
||||
loadInfo->SetLoadType(ConvertLoadTypeToDocShellLoadInfo(LOAD_LINK));
|
||||
loadInfo->SetForceAllowDataURI(aFlags & INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI);
|
||||
|
||||
rv = win->Open(NS_ConvertUTF8toUTF16(spec),
|
||||
aWindowTarget, // window name
|
||||
|
|
@ -10728,7 +10739,9 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
|||
nsINetworkPredictor::PREDICT_LOAD, this, nullptr);
|
||||
|
||||
nsCOMPtr<nsIRequest> req;
|
||||
rv = DoURILoad(aURI, aOriginalURI, aLoadReplace, loadFromExternal, aReferrer,
|
||||
rv = DoURILoad(aURI, aOriginalURI, aLoadReplace, loadFromExternal,
|
||||
(aFlags & INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI),
|
||||
aReferrer,
|
||||
!(aFlags & INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER),
|
||||
aReferrerPolicy,
|
||||
aTriggeringPrincipal, principalToInherit, aTypeHint,
|
||||
|
|
@ -10809,6 +10822,7 @@ nsDocShell::DoURILoad(nsIURI* aURI,
|
|||
nsIURI* aOriginalURI,
|
||||
bool aLoadReplace,
|
||||
bool aLoadFromExternal,
|
||||
bool aForceAllowDataURI,
|
||||
nsIURI* aReferrerURI,
|
||||
bool aSendReferrer,
|
||||
uint32_t aReferrerPolicy,
|
||||
|
|
@ -10954,6 +10968,7 @@ nsDocShell::DoURILoad(nsIURI* aURI,
|
|||
loadInfo->SetPrincipalToInherit(aPrincipalToInherit);
|
||||
}
|
||||
loadInfo->SetLoadTriggeredFromExternal(aLoadFromExternal);
|
||||
loadInfo->SetForceAllowDataURI(aForceAllowDataURI);
|
||||
|
||||
// We have to do this in case our OriginAttributes are different from the
|
||||
// OriginAttributes of the parent document. Or in case there isn't a
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue