Bug 266554 - Ensure document is non-null in nsDocShell::ForceRefreshURI. r=peterv,dom-core,smaug
This should be safe to do because Refreshes are applied only to documents and not to subresources. Differential Revision: https://phabricator.services.mozilla.com/D227448
This commit is contained in:
@@ -5028,29 +5028,26 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal,
|
||||
loadState->SetKeepResultPrincipalURIIfSet(true);
|
||||
loadState->SetIsMetaRefresh(true);
|
||||
|
||||
RefPtr<Document> doc = GetDocument();
|
||||
NS_ENSURE_STATE(doc);
|
||||
|
||||
// Set the triggering pricipal to aPrincipal if available, or current
|
||||
// document's principal otherwise.
|
||||
nsCOMPtr<nsIPrincipal> principal = aPrincipal;
|
||||
RefPtr<Document> doc = GetDocument();
|
||||
if (!principal) {
|
||||
if (!doc) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
principal = doc->NodePrincipal();
|
||||
}
|
||||
loadState->SetTriggeringPrincipal(principal);
|
||||
if (doc) {
|
||||
loadState->SetCsp(doc->GetCsp());
|
||||
loadState->SetHasValidUserGestureActivation(
|
||||
doc->HasValidTransientUserGestureActivation());
|
||||
loadState->SetCsp(doc->GetCsp());
|
||||
loadState->SetHasValidUserGestureActivation(
|
||||
doc->HasValidTransientUserGestureActivation());
|
||||
|
||||
loadState->SetTextDirectiveUserActivation(
|
||||
doc->ConsumeTextDirectiveUserActivation() ||
|
||||
loadState->HasValidUserGestureActivation());
|
||||
loadState->SetTriggeringSandboxFlags(doc->GetSandboxFlags());
|
||||
loadState->SetTriggeringWindowId(doc->InnerWindowID());
|
||||
loadState->SetTriggeringStorageAccess(doc->UsingStorageAccess());
|
||||
}
|
||||
loadState->SetTextDirectiveUserActivation(
|
||||
doc->ConsumeTextDirectiveUserActivation() ||
|
||||
loadState->HasValidUserGestureActivation());
|
||||
loadState->SetTriggeringSandboxFlags(doc->GetSandboxFlags());
|
||||
loadState->SetTriggeringWindowId(doc->InnerWindowID());
|
||||
loadState->SetTriggeringStorageAccess(doc->UsingStorageAccess());
|
||||
|
||||
loadState->SetPrincipalIsExplicit(true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user