Bug 1626573 - P1 - BrowsingContext transmits BlobURL before loading an URI if URI is a BlobURL r=baku

Differential Revision: https://phabricator.services.mozilla.com/D69717

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Subhamoy Sengupta 2020-04-15 08:57:44 +00:00
Родитель 77374f6a32
Коммит da366d3679
3 изменённых файлов: 27 добавлений и 0 удалений

Просмотреть файл

@ -1423,6 +1423,8 @@ nsresult BrowsingContext::LoadURI(nsDocShellLoadState* aLoadState,
}
if (ContentParent* cp = Canonical()->GetContentParent()) {
cp->TransmitBlobDataIfBlobURL(aLoadState->URI(),
aLoadState->TriggeringPrincipal());
Unused << cp->SendLoadURI(this, aLoadState, aSetNavigating);
}
}

Просмотреть файл

@ -5492,6 +5492,18 @@ void ContentParent::TransmitBlobURLsForPrincipal(nsIPrincipal* aPrincipal) {
}
}
void ContentParent::TransmitBlobDataIfBlobURL(nsIURI* aURI,
nsIPrincipal* aPrincipal) {
MOZ_ASSERT(aURI);
MOZ_ASSERT(aPrincipal);
if (!IsBlobURI(aURI)) {
return;
}
TransmitBlobURLsForPrincipal(aPrincipal);
}
void ContentParent::EnsurePermissionsByKey(const nsCString& aKey,
const nsCString& aOrigin) {
// NOTE: Make sure to initialize the permission manager before updating the

Просмотреть файл

@ -624,6 +624,19 @@ class ContentParent final
nsresult TransmitPermissionsForPrincipal(nsIPrincipal* aPrincipal);
// This function is called in BrowsingContext immediately before IPC call to
// load a URI. If aURI is a BlobURL, this method transmits all BlobURLs for
// aPrincipal that were previously not transmitted. This allows for opening a
// locally created BlobURL in a new tab.
//
// The reason all previously untransmitted Blobs are transmitted is that the
// current BlobURL could contain html code, referring to another untransmitted
// BlobURL.
//
// Should eventually be made obsolete by broader design changes that only
// store BlobURLs in the parent process.
void TransmitBlobDataIfBlobURL(nsIURI* aURI, nsIPrincipal* aPrincipal);
void OnCompositorDeviceReset() override;
static hal::ProcessPriority GetInitialProcessPriority(Element* aFrameElement);