Bug 1696158 - Move CanSavePresentation to the parent process. Keep track of various flags for deciding whether to put a page in BFCache. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D110231
This commit is contained in:
Peter Van der Beken
2021-04-19 14:50:54 +00:00
parent 4687b22fef
commit 2ed1ecb468
13 changed files with 224 additions and 20 deletions

View File

@@ -86,6 +86,7 @@
#include "mozilla/dom/VideoTrack.h"
#include "mozilla/dom/VideoTrackList.h"
#include "mozilla/dom/WakeLock.h"
#include "mozilla/dom/WindowGlobalChild.h"
#include "mozilla/dom/power/PowerManagerService.h"
#include "mozilla/net/UrlClassifierFeatureFactory.h"
#include "nsAttrValueInlines.h"
@@ -2239,6 +2240,10 @@ void HTMLMediaElement::AbortExistingLoads() {
EndSrcMediaStreamPlayback();
}
if (mMediaSource) {
OwnerDoc()->RemoveMediaElementWithMSE();
}
RemoveMediaElementFromURITable();
mLoadingSrcTriggeringPrincipal = nullptr;
DDLOG(DDLogCategory::Property, "loading_src", "");
@@ -2549,6 +2554,10 @@ void HTMLMediaElement::SelectResource() {
!mIsLoadingFromSourceChildren,
"Should think we're not loading from source children by default");
if (!mMediaSource) {
OwnerDoc()->AddMediaElementWithMSE();
}
RemoveMediaElementFromURITable();
if (!mSrcMediaSource) {
mLoadingSrc = uri;
@@ -2812,6 +2821,10 @@ void HTMLMediaElement::LoadFromSourceChildren() {
return;
}
if (!mMediaSource) {
OwnerDoc()->AddMediaElementWithMSE();
}
RemoveMediaElementFromURITable();
mLoadingSrc = uri;
mLoadingSrcTriggeringPrincipal = childSrc->GetSrcTriggeringPrincipal();
@@ -7652,6 +7665,15 @@ bool HTMLMediaElement::IsBeingUsedInPictureInPictureMode() const {
return static_cast<const HTMLVideoElement*>(this)->IsCloningElementVisually();
}
void HTMLMediaElement::NodeInfoChanged(Document* aOldDoc) {
if (mMediaSource) {
OwnerDoc()->AddMediaElementWithMSE();
aOldDoc->RemoveMediaElementWithMSE();
}
nsGenericHTMLElement::NodeInfoChanged(aOldDoc);
}
} // namespace mozilla::dom
#undef LOG