Bug 1699332 - Remove remaining presentation URL references r=annevk

Differential Revision: https://phabricator.services.mozilla.com/D109010
This commit is contained in:
Kagami Sascha Rosylight 2021-03-19 12:36:57 +00:00
parent f77a0684be
commit 9441435604
9 changed files with 4 additions and 110 deletions

View File

@ -9062,37 +9062,6 @@ void nsContentUtils::SetScrollbarsVisibility(nsIDocShell* aDocShell,
nsDocShell::Cast(aDocShell)->SetScrollbarPreference(pref);
}
/* static */
void nsContentUtils::GetPresentationURL(nsIDocShell* aDocShell,
nsAString& aPresentationUrl) {
MOZ_ASSERT(aDocShell);
if (XRE_IsContentProcess()) {
nsCOMPtr<nsIDocShellTreeItem> sameTypeRoot;
aDocShell->GetInProcessSameTypeRootTreeItem(getter_AddRefs(sameTypeRoot));
nsCOMPtr<nsIDocShellTreeItem> root;
aDocShell->GetInProcessRootTreeItem(getter_AddRefs(root));
if (sameTypeRoot.get() == root.get()) {
// presentation URL is stored in BrowserChild for the top most
// <iframe mozbrowser> in content process.
BrowserChild* browserChild = BrowserChild::GetFrom(aDocShell);
if (browserChild) {
aPresentationUrl = browserChild->PresentationURL();
}
return;
}
}
nsCOMPtr<nsILoadContext> loadContext(do_QueryInterface(aDocShell));
RefPtr<Element> topFrameElt;
loadContext->GetTopFrameElement(getter_AddRefs(topFrameElt));
if (!topFrameElt) {
return;
}
topFrameElt->GetAttr(nsGkAtoms::mozpresentation, aPresentationUrl);
}
/* static */
nsIDocShell* nsContentUtils::GetDocShellForEventTarget(EventTarget* aTarget) {
nsCOMPtr<nsPIDOMWindowInner> innerWindow;

View File

@ -2965,13 +2965,6 @@ class nsContentUtils {
static void SetScrollbarsVisibility(nsIDocShell* aDocShell, bool aVisible);
/*
* Return the associated presentation URL of the presented content.
* Will return empty string if the docshell is not in a presented content.
*/
static void GetPresentationURL(nsIDocShell* aDocShell,
nsAString& aPresentationUrl);
/*
* Try to find the docshell corresponding to the given event target.
*/

View File

@ -3016,18 +3016,6 @@ void nsFrameLoader::ApplySandboxFlags(uint32_t sandboxFlags) {
// The child can only add restrictions, never remove them.
sandboxFlags |= parentSandboxFlags;
// XXX this probably isn't fission compatible.
if (GetDocShell()) {
// If this frame is a receiving browsing context, we should add
// sandboxed auxiliary navigation flag to sandboxFlags. See
// https://w3c.github.io/presentation-api/#creating-a-receiving-browsing-context
nsAutoString presentationURL;
nsContentUtils::GetPresentationURL(GetDocShell(), presentationURL);
if (!presentationURL.IsEmpty()) {
sandboxFlags |= SANDBOXED_AUXILIARY_NAVIGATION;
}
}
MOZ_ALWAYS_SUCCEEDS(context->SetSandboxFlags(sandboxFlags));
}
@ -3550,10 +3538,6 @@ void nsFrameLoader::MaybeUpdatePrimaryBrowserParent(
nsresult nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
nsIURI* aURI) {
nsAutoString presentationURLStr;
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::mozpresentation,
presentationURLStr);
nsCOMPtr<nsIDocShell> docShell = mOwnerContent->OwnerDoc()->GetDocShell();
nsCOMPtr<nsILoadContext> parentContext = do_QueryInterface(docShell);
NS_ENSURE_STATE(parentContext);
@ -3580,7 +3564,7 @@ nsresult nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
uint32_t maxTouchPoints = BrowserParent::GetMaxTouchPoints(mOwnerContent);
bool tabContextUpdated = aTabContext->SetTabContext(
chromeOuterWindowID, showFocusRings, presentationURLStr, maxTouchPoints);
chromeOuterWindowID, showFocusRings, maxTouchPoints);
NS_ENSURE_STATE(tabContextUpdated);
return NS_OK;

View File

@ -469,9 +469,6 @@ nsresult BrowserChild::Init(mozIDOMWindowProxy* aParent,
mWebNav = do_QueryInterface(webBrowser);
NS_ASSERTION(mWebNav, "nsWebBrowser doesn't implement nsIWebNavigation?");
// Set the tab context attributes then pass to docShell
NotifyTabContextUpdated();
// IPC uses a WebBrowser object for which DNS prefetching is turned off
// by default. But here we really want it, so enable it explicitly
mWebBrowser->SetAllowDNSPrefetch(true);
@ -560,21 +557,6 @@ nsresult BrowserChild::Init(mozIDOMWindowProxy* aParent,
return NS_OK;
}
void BrowserChild::NotifyTabContextUpdated() {
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation());
MOZ_ASSERT(docShell);
if (!docShell) {
return;
}
// Set SANDBOXED_AUXILIARY_NAVIGATION flag if this is a receiver page.
if (!PresentationURL().IsEmpty()) {
// Return value of setting synced field should be checked. See bug 1656492.
Unused << mBrowsingContext->SetSandboxFlags(SANDBOXED_AUXILIARY_NAVIGATION);
}
}
NS_IMPL_CYCLE_COLLECTION_CLASS(BrowserChild)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(BrowserChild)

View File

@ -741,12 +741,6 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
void HandleDoubleTap(const CSSPoint& aPoint, const Modifiers& aModifiers,
const ScrollableLayerGuid& aGuid);
// Notify others that our TabContext has been updated.
//
// You should call this after calling TabContext::SetTabContext(). We also
// call this during Init().
void NotifyTabContextUpdated();
void ActorDestroy(ActorDestroyReason why) override;
bool InitBrowserChildMessageManager();

View File

@ -27,11 +27,6 @@ struct FrameIPCTabContext
{
uint64_t chromeOuterWindowID;
// The requested presentation URL.
// This value would be empty if the TabContext isn't created for
// presented content.
nsString presentationURL;
// Keyboard indicator state inherited from the parent.
UIStateChangeType showFocusRings;

View File

@ -51,21 +51,15 @@ bool TabContext::UpdateTabContextAfterSwap(const TabContext& aContext) {
return true;
}
const nsAString& TabContext::PresentationURL() const {
return mPresentationURL;
}
UIStateChangeType TabContext::ShowFocusRings() const { return mShowFocusRings; }
bool TabContext::SetTabContext(uint64_t aChromeOuterWindowID,
UIStateChangeType aShowFocusRings,
const nsAString& aPresentationURL,
uint32_t aMaxTouchPoints) {
NS_ENSURE_FALSE(mInitialized, false);
mInitialized = true;
mChromeOuterWindowID = aChromeOuterWindowID;
mPresentationURL = aPresentationURL;
mShowFocusRings = aShowFocusRings;
mMaxTouchPoints = aMaxTouchPoints;
return true;
@ -84,8 +78,7 @@ IPCTabContext TabContext::AsIPCTabContext() const {
return IPCTabContext(JSPluginFrameIPCTabContext(mJSPluginID));
}
return IPCTabContext(FrameIPCTabContext(mChromeOuterWindowID,
mPresentationURL, mShowFocusRings,
return IPCTabContext(FrameIPCTabContext(mChromeOuterWindowID, mShowFocusRings,
mMaxTouchPoints));
}
@ -93,7 +86,6 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
: mInvalidReason(nullptr) {
uint64_t chromeOuterWindowID = 0;
int32_t jsPluginId = -1;
nsAutoString presentationURL;
UIStateChangeType showFocusRings = UIStateChangeType_NoChange;
uint32_t maxTouchPoints = 0;
@ -115,7 +107,6 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
const FrameIPCTabContext& ipcContext = aParams.get_FrameIPCTabContext();
chromeOuterWindowID = ipcContext.chromeOuterWindowID();
presentationURL = ipcContext.presentationURL();
showFocusRings = ipcContext.showFocusRings();
maxTouchPoints = ipcContext.maxTouchPoints();
break;
@ -130,7 +121,7 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
rv = mTabContext.SetTabContextForJSPluginFrame(jsPluginId);
} else {
rv = mTabContext.SetTabContext(chromeOuterWindowID, showFocusRings,
presentationURL, maxTouchPoints);
maxTouchPoints);
}
if (!rv) {
mInvalidReason = "Couldn't initialize TabContext.";

View File

@ -44,12 +44,6 @@ class TabContext {
uint64_t ChromeOuterWindowID() const;
/**
* Returns the presentation URL associated with the tab if this tab is
* created for presented content
*/
const nsAString& PresentationURL() const;
UIStateChangeType ShowFocusRings() const;
uint32_t MaxTouchPoints() const { return mMaxTouchPoints; }
@ -73,7 +67,6 @@ class TabContext {
bool SetTabContext(uint64_t aChromeOuterWindowID,
UIStateChangeType aShowFocusRings,
const nsAString& aPresentationURL,
uint32_t aMaxTouchPoints);
/**
@ -114,11 +107,6 @@ class TabContext {
int32_t mJSPluginID;
/**
* The requested presentation URL.
*/
nsString mPresentationURL;
/**
* Keyboard indicator state (focus rings).
*/
@ -143,10 +131,9 @@ class MutableTabContext : public TabContext {
bool SetTabContext(uint64_t aChromeOuterWindowID,
UIStateChangeType aShowFocusRings,
const nsAString& aPresentationURL,
uint32_t aMaxTouchPoints) {
return TabContext::SetTabContext(aChromeOuterWindowID, aShowFocusRings,
aPresentationURL, aMaxTouchPoints);
aMaxTouchPoints);
}
bool SetTabContextForJSPluginFrame(uint32_t aJSPluginID) {

View File

@ -997,7 +997,6 @@ STATIC_ATOMS = [
Atom("prefersContrast", "prefers-contrast"),
Atom("prefix", "prefix"),
Atom("preload", "preload"),
Atom("mozpresentation", "mozpresentation"),
Atom("preserve", "preserve"),
Atom("preserveSpace", "preserve-space"),
Atom("preventdefault", "preventdefault"),