Backed out 5 changesets (bug 1639833) for failures on browser_blockingIndexedDbInWorkers.js. CLOSED TREE

Backed out changeset 6b4f76d65540 (bug 1639833)
Backed out changeset c77acba1aacb (bug 1639833)
Backed out changeset 30c97666919e (bug 1639833)
Backed out changeset d769b313441a (bug 1639833)
Backed out changeset ed41b41d1b03 (bug 1639833)
This commit is contained in:
Csoregi Natalia
2020-06-02 15:02:31 +03:00
parent cb10d1092c
commit ed3350ab9b
88 changed files with 725 additions and 793 deletions

View File

@@ -6254,7 +6254,7 @@ nsresult nsDocShell::EnsureContentViewer() {
nsCOMPtr<nsIContentSecurityPolicy> cspToInheritForAboutBlank;
nsCOMPtr<nsIURI> baseURI;
nsIPrincipal* principal = GetInheritedPrincipal(false);
nsIPrincipal* partitionedPrincipal = GetInheritedPrincipal(false, true);
nsIPrincipal* storagePrincipal = GetInheritedPrincipal(false, true);
nsCOMPtr<nsIDocShellTreeItem> parentItem;
GetInProcessSameTypeParent(getter_AddRefs(parentItem));
@@ -6269,7 +6269,7 @@ nsresult nsDocShell::EnsureContentViewer() {
}
nsresult rv = CreateAboutBlankContentViewer(
principal, partitionedPrincipal, cspToInheritForAboutBlank, baseURI);
principal, storagePrincipal, cspToInheritForAboutBlank, baseURI);
NS_ENSURE_STATE(mContentViewer);
@@ -6295,7 +6295,7 @@ nsresult nsDocShell::EnsureContentViewer() {
}
nsresult nsDocShell::CreateAboutBlankContentViewer(
nsIPrincipal* aPrincipal, nsIPrincipal* aPartitionedPrincipal,
nsIPrincipal* aPrincipal, nsIPrincipal* aStoragePrincipal,
nsIContentSecurityPolicy* aCSP, nsIURI* aBaseURI,
bool aTryToSaveOldPresentation, bool aCheckPermitUnload,
WindowGlobalChild* aActor) {
@@ -6389,7 +6389,7 @@ nsresult nsDocShell::CreateAboutBlankContentViewer(
NS_LITERAL_CSTRING("text/html"));
if (docFactory) {
nsCOMPtr<nsIPrincipal> principal, partitionedPrincipal;
nsCOMPtr<nsIPrincipal> principal, storagePrincipal;
uint32_t sandboxFlags = mBrowsingContext->GetSandboxFlags();
// If we're sandboxed, then create a new null principal. We skip
// this if we're being created from WindowGlobalChild, since in
@@ -6403,17 +6403,17 @@ nsresult nsDocShell::CreateAboutBlankContentViewer(
} else {
principal = NullPrincipal::CreateWithInheritedAttributes(this);
}
partitionedPrincipal = principal;
storagePrincipal = principal;
} else {
principal = aPrincipal;
partitionedPrincipal = aPartitionedPrincipal;
storagePrincipal = aStoragePrincipal;
}
MaybeCreateInitialClientSource(principal);
// generate (about:blank) document to load
blankDoc = nsContentDLF::CreateBlankDocument(mLoadGroup, principal,
partitionedPrincipal, this);
storagePrincipal, this);
if (blankDoc) {
// Hack: manually set the CSP for the new document
// Please create an actual copy of the CSP (do not share the same
@@ -6465,9 +6465,9 @@ nsresult nsDocShell::CreateAboutBlankContentViewer(
NS_IMETHODIMP
nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
nsIPrincipal* aPartitionedPrincipal,
nsIPrincipal* aStoragePrincipal,
nsIContentSecurityPolicy* aCSP) {
return CreateAboutBlankContentViewer(aPrincipal, aPartitionedPrincipal, aCSP,
return CreateAboutBlankContentViewer(aPrincipal, aStoragePrincipal, aCSP,
nullptr);
}
@@ -6475,7 +6475,7 @@ nsresult nsDocShell::CreateContentViewerForActor(
WindowGlobalChild* aWindowActor) {
MOZ_ASSERT(aWindowActor);
// FIXME: WindowGlobalChild should provide the PartitionedPrincipal.
// FIXME: WindowGlobalChild should provide the StoragePrincipal.
nsresult rv = CreateAboutBlankContentViewer(
aWindowActor->DocumentPrincipal(), aWindowActor->DocumentPrincipal(),
/* aCsp */ nullptr,
@@ -8365,18 +8365,17 @@ nsresult nsDocShell::HandleSameDocumentNavigation(
* recorded in session and global history.
*/
nsCOMPtr<nsIPrincipal> newURITriggeringPrincipal, newURIPrincipalToInherit,
newURIPartitionedPrincipalToInherit;
newURIStoragePrincipalToInherit;
nsCOMPtr<nsIContentSecurityPolicy> newCsp;
if (mOSHE) {
newURITriggeringPrincipal = mOSHE->GetTriggeringPrincipal();
newURIPrincipalToInherit = mOSHE->GetPrincipalToInherit();
newURIPartitionedPrincipalToInherit =
mOSHE->GetPartitionedPrincipalToInherit();
newURIStoragePrincipalToInherit = mOSHE->GetStoragePrincipalToInherit();
newCsp = mOSHE->GetCsp();
} else {
newURITriggeringPrincipal = aLoadState->TriggeringPrincipal();
newURIPrincipalToInherit = doc->NodePrincipal();
newURIPartitionedPrincipalToInherit = doc->PartitionedPrincipal();
newURIStoragePrincipalToInherit = doc->IntrinsicStoragePrincipal();
newCsp = doc->GetCsp();
}
// Pass true for aCloneSHChildren, since we're not
@@ -8388,8 +8387,8 @@ nsresult nsDocShell::HandleSameDocumentNavigation(
// Anyway, aCloneSHChildren param is simply reflecting
// doSameDocumentNavigation in this scope.
OnNewURI(aLoadState->URI(), nullptr, newURITriggeringPrincipal,
newURIPrincipalToInherit, newURIPartitionedPrincipalToInherit,
mLoadType, newCsp, true, true, true);
newURIPrincipalToInherit, newURIStoragePrincipalToInherit, mLoadType,
newCsp, true, true, true);
nsCOMPtr<nsIInputStream> postData;
uint32_t cacheKey = 0;
@@ -8968,7 +8967,7 @@ bool nsDocShell::CanLoadInParentProcess(nsIURI* aURI) {
}
nsIPrincipal* nsDocShell::GetInheritedPrincipal(
bool aConsiderCurrentDocument, bool aConsiderPartitionedPrincipal) {
bool aConsiderCurrentDocument, bool aConsiderStoragePrincipal) {
RefPtr<Document> document;
bool inheritedFromCurrent = false;
@@ -9001,8 +9000,8 @@ nsIPrincipal* nsDocShell::GetInheritedPrincipal(
//-- Get the document's principal
if (document) {
nsIPrincipal* docPrincipal = aConsiderPartitionedPrincipal
? document->PartitionedPrincipal()
nsIPrincipal* docPrincipal = aConsiderStoragePrincipal
? document->IntrinsicStoragePrincipal()
: document->NodePrincipal();
// Don't allow loads in typeContent docShells to inherit the system
@@ -10025,7 +10024,7 @@ void nsDocShell::SetupReferrerInfoFromChannel(nsIChannel* aChannel) {
bool nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel,
nsIPrincipal* aTriggeringPrincipal,
nsIPrincipal* aPrincipalToInherit,
nsIPrincipal* aPartitionedPrincipalToInherit,
nsIPrincipal* aStoragePrincipalToInherit,
uint32_t aLoadType, nsIContentSecurityPolicy* aCsp,
bool aFireOnLocationChange, bool aAddToGlobalHistory,
bool aCloneSHChildren) {
@@ -10190,9 +10189,8 @@ bool nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel,
* rootDocShell
*/
(void)AddToSessionHistory(aURI, aChannel, aTriggeringPrincipal,
aPrincipalToInherit,
aPartitionedPrincipalToInherit, aCsp,
aCloneSHChildren, getter_AddRefs(mLSHE));
aPrincipalToInherit, aStoragePrincipalToInherit,
aCsp, aCloneSHChildren, getter_AddRefs(mLSHE));
}
} else if (GetSessionHistory() && mLSHE && mURIResultedInDocument) {
// Even if we don't add anything to SHistory, ensure the current index
@@ -10661,8 +10659,7 @@ bool nsDocShell::ShouldAddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel) {
nsresult nsDocShell::AddToSessionHistory(
nsIURI* aURI, nsIChannel* aChannel, nsIPrincipal* aTriggeringPrincipal,
nsIPrincipal* aPrincipalToInherit,
nsIPrincipal* aPartitionedPrincipalToInherit,
nsIPrincipal* aPrincipalToInherit, nsIPrincipal* aStoragePrincipalToInherit,
nsIContentSecurityPolicy* aCsp, bool aCloneChildren,
nsISHEntry** aNewEntry) {
MOZ_ASSERT(aURI, "uri is null");
@@ -10721,8 +10718,7 @@ nsresult nsDocShell::AddToSessionHistory(
uint32_t cacheKey = 0;
nsCOMPtr<nsIPrincipal> triggeringPrincipal = aTriggeringPrincipal;
nsCOMPtr<nsIPrincipal> principalToInherit = aPrincipalToInherit;
nsCOMPtr<nsIPrincipal> partitionedPrincipalToInherit =
aPartitionedPrincipalToInherit;
nsCOMPtr<nsIPrincipal> storagePrincipalToInherit = aStoragePrincipalToInherit;
nsCOMPtr<nsIContentSecurityPolicy> csp = aCsp;
bool expired = false; // by default the page is not expired
bool discardLayoutState = false;
@@ -10784,12 +10780,12 @@ nsresult nsDocShell::AddToSessionHistory(
}
}
if (!partitionedPrincipalToInherit) {
if (!storagePrincipalToInherit) {
// XXXehsan is it correct to fall back to the principal to inherit in all
// cases? For example, what about the cases where we are using the load
// info's principal to inherit? Do we need to add a similar concept to
// load info for partitioned principal?
partitionedPrincipalToInherit = principalToInherit;
// load info for storage principal?
storagePrincipalToInherit = principalToInherit;
}
}
@@ -10832,10 +10828,10 @@ nsresult nsDocShell::AddToSessionHistory(
cacheKey, // CacheKey
mContentTypeHint, // Content-type
triggeringPrincipal, // Channel or provided principal
principalToInherit, partitionedPrincipalToInherit, csp,
HistoryID(), mDynamicallyCreated, originalURI,
resultPrincipalURI, loadReplace, referrerInfo, srcdoc,
srcdocEntry, baseURI, saveLayoutState, expired);
principalToInherit, storagePrincipalToInherit, csp, HistoryID(),
mDynamicallyCreated, originalURI, resultPrincipalURI,
loadReplace, referrerInfo, srcdoc, srcdocEntry, baseURI,
saveLayoutState, expired);
if (root == static_cast<nsIDocShellTreeItem*>(this) && GetSessionHistory()) {
bool shouldPersist = ShouldAddToSessionHistory(aURI, aChannel);
@@ -10898,10 +10894,9 @@ nsresult nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry, uint32_t aLoadType) {
// Don't cache the presentation if we're going to just reload the
// current entry. Caching would lead to trying to save the different
// content viewers in the same nsISHEntry object.
rv = CreateAboutBlankContentViewer(
loadState->PrincipalToInherit(),
loadState->PartitionedPrincipalToInherit(), nullptr, nullptr,
aEntry != mOSHE);
rv = CreateAboutBlankContentViewer(loadState->PrincipalToInherit(),
loadState->StoragePrincipalToInherit(),
nullptr, nullptr, aEntry != mOSHE);
if (NS_FAILED(rv)) {
// The creation of the intermittent about:blank content
@@ -12105,7 +12100,7 @@ nsDocShell::InitOrReusePrintPreviewViewer(nsIWebBrowserPrint** aPrintPreview) {
NullPrincipal::CreateWithInheritedAttributes(this);
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("about:printpreview"));
// Reuse the null principal for the partitioned principal.
// Reuse the null principal for the storage principal.
// XXXehsan is that the right principal to use here?
nsresult rv = CreateAboutBlankContentViewer(principal, principal,
/* aCsp = */ nullptr, uri);