зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1589517 - Part 4: Remove sameProcessAsFrameLoader, r=zombie,mconley,farre,smacleod
The functionality has been fully subsumed by the new initialBrowsingContextGroupId attribute, so it is no longer necessary. Differential Revision: https://phabricator.services.mozilla.com/D85653
This commit is contained in:
Родитель
2f84ab8f50
Коммит
c366c291b9
|
@ -3241,7 +3241,6 @@ async function BrowserViewSourceOfDocument(args) {
|
|||
skipAnimation: inNewWindow,
|
||||
preferredRemoteType,
|
||||
initialBrowsingContextGroupId,
|
||||
sameProcessAsFrameLoader: args.browser ? args.browser.frameLoader : null,
|
||||
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
});
|
||||
args.viewSourceBrowser = tabBrowser.getBrowserForTab(tab);
|
||||
|
@ -3630,7 +3629,6 @@ var PrintPreviewListener = {
|
|||
inBackground: true,
|
||||
preferredRemoteType,
|
||||
initialBrowsingContextGroupId,
|
||||
sameProcessAsFrameLoader: browser.frameLoader,
|
||||
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
});
|
||||
},
|
||||
|
@ -3660,7 +3658,6 @@ var PrintPreviewListener = {
|
|||
inBackground: true,
|
||||
preferredRemoteType,
|
||||
initialBrowsingContextGroupId,
|
||||
sameProcessAsFrameLoader: browser.frameLoader,
|
||||
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
});
|
||||
return this.getSimplifiedSourceBrowser();
|
||||
|
|
|
@ -317,20 +317,20 @@
|
|||
|
||||
let tabArgument = gBrowserInit.getTabToAdopt();
|
||||
|
||||
// We only need sameProcessAsFrameLoader in the case where we're passed a tab
|
||||
let initialBrowsingContextGroupId;
|
||||
let sameProcessAsFrameLoader;
|
||||
// If we have a tab argument with browser, we use its remoteType. Otherwise,
|
||||
// if e10s is disabled or there's a parent process opener (e.g. parent
|
||||
// process about: page) for the content tab, we use a parent
|
||||
// process remoteType. Otherwise, we check the URI to determine
|
||||
// what to do - if there isn't one, we default to the default remote type.
|
||||
//
|
||||
// When adopting a tab, we'll also use that tab's browsingContextGroupId,
|
||||
// if available, to ensure we don't spawn a new process.
|
||||
let remoteType;
|
||||
let initialBrowsingContextGroupId;
|
||||
if (tabArgument && tabArgument.linkedBrowser) {
|
||||
remoteType = tabArgument.linkedBrowser.remoteType;
|
||||
initialBrowsingContextGroupId =
|
||||
tabArgument.linkedBrowser.browsingContext?.group.id;
|
||||
sameProcessAsFrameLoader = tabArgument.linkedBrowser.frameLoader;
|
||||
} else if (openWindowInfo) {
|
||||
userContextId = openWindowInfo.originAttributes.userContextId;
|
||||
if (openWindowInfo.isRemote) {
|
||||
|
@ -366,7 +366,6 @@
|
|||
let createOptions = {
|
||||
uriIsAboutBlank: false,
|
||||
userContextId,
|
||||
sameProcessAsFrameLoader,
|
||||
initialBrowsingContextGroupId,
|
||||
remoteType,
|
||||
openWindowInfo,
|
||||
|
@ -1583,7 +1582,6 @@
|
|||
aForceNotRemote = params.forceNotRemote;
|
||||
aPreferredRemoteType = params.preferredRemoteType;
|
||||
aUserContextId = params.userContextId;
|
||||
aSameProcessAsFrameLoader = params.sameProcessAsFrameLoader;
|
||||
aInitialBrowsingContextGroupId = params.initialBrowsingContextGroupId;
|
||||
aOriginPrincipal = params.originPrincipal;
|
||||
aOriginStoragePrincipal = params.originStoragePrincipal;
|
||||
|
@ -1627,7 +1625,6 @@
|
|||
userContextId: aUserContextId,
|
||||
originPrincipal: aOriginPrincipal,
|
||||
originStoragePrincipal: aOriginStoragePrincipal,
|
||||
sameProcessAsFrameLoader: aSameProcessAsFrameLoader,
|
||||
initialBrowsingContextGroupId: aInitialBrowsingContextGroupId,
|
||||
openWindowInfo: aOpenWindowInfo,
|
||||
openerBrowser: aOpenerBrowser,
|
||||
|
@ -1821,7 +1818,6 @@
|
|||
listener.destroy();
|
||||
|
||||
let oldDroppedLinkHandler = aBrowser.droppedLinkHandler;
|
||||
let oldSameProcessAsFrameLoader = aBrowser.sameProcessAsFrameLoader;
|
||||
let oldUserTypedValue = aBrowser.userTypedValue;
|
||||
let hadStartedLoad = aBrowser.didStartLoadSinceLastUserTyping();
|
||||
|
||||
|
@ -1830,14 +1826,6 @@
|
|||
// Make sure the browser is destroyed so it unregisters from observer notifications
|
||||
aBrowser.destroy();
|
||||
|
||||
// NB: This works with the hack in the browser constructor that
|
||||
// turns this normal property into a field.
|
||||
if (!shouldBeRemote || oldRemoteType == remoteType) {
|
||||
// Only copy existing sameProcessAsFrameLoader when not switching
|
||||
// remote type otherwise it would stop the switch.
|
||||
aBrowser.sameProcessAsFrameLoader = oldSameProcessAsFrameLoader;
|
||||
}
|
||||
|
||||
if (shouldBeRemote) {
|
||||
aBrowser.setAttribute("remote", "true");
|
||||
aBrowser.setAttribute("remoteType", remoteType);
|
||||
|
@ -1971,7 +1959,6 @@
|
|||
name,
|
||||
openWindowInfo,
|
||||
remoteType,
|
||||
sameProcessAsFrameLoader,
|
||||
initialBrowsingContextGroupId,
|
||||
uriIsAboutBlank,
|
||||
userContextId,
|
||||
|
@ -2033,10 +2020,6 @@
|
|||
b.setAttribute("preloadedState", "preloaded");
|
||||
}
|
||||
|
||||
if (sameProcessAsFrameLoader) {
|
||||
b.sameProcessAsFrameLoader = sameProcessAsFrameLoader;
|
||||
}
|
||||
|
||||
// Ensure that the browser will be created in a specific initial
|
||||
// BrowsingContextGroup. This may change the process selection behaviour
|
||||
// of the newly created browser, and is often used in combination with
|
||||
|
@ -2458,7 +2441,6 @@
|
|||
preferredRemoteType,
|
||||
referrerInfo,
|
||||
relatedToCurrent,
|
||||
sameProcessAsFrameLoader,
|
||||
initialBrowsingContextGroupId,
|
||||
skipAnimation,
|
||||
skipBackgroundNotify,
|
||||
|
@ -2633,10 +2615,6 @@
|
|||
gFissionBrowser,
|
||||
preferredRemoteType
|
||||
);
|
||||
if (sameProcessAsFrameLoader) {
|
||||
remoteType =
|
||||
sameProcessAsFrameLoader.browsingContext.currentRemoteType;
|
||||
}
|
||||
|
||||
// If we open a new tab with the newtab URL in the default
|
||||
// userContext, check if there is a preloaded browser ready.
|
||||
|
@ -2653,7 +2631,6 @@
|
|||
remoteType,
|
||||
uriIsAboutBlank,
|
||||
userContextId,
|
||||
sameProcessAsFrameLoader,
|
||||
initialBrowsingContextGroupId,
|
||||
openWindowInfo,
|
||||
name,
|
||||
|
@ -4439,7 +4416,6 @@
|
|||
let params = {
|
||||
eventDetail: { adoptedTab: aTab },
|
||||
preferredRemoteType: linkedBrowser.remoteType,
|
||||
sameProcessAsFrameLoader: linkedBrowser.frameLoader,
|
||||
initialBrowsingContextGroupId: linkedBrowser.browsingContext?.group.id,
|
||||
skipAnimation: true,
|
||||
index: aIndex,
|
||||
|
|
|
@ -50,7 +50,6 @@ function getBrowser(panel) {
|
|||
"initialBrowsingContextGroupId",
|
||||
panel.extension.policy.browsingContextGroupId
|
||||
);
|
||||
browser.sameProcessAsFrameLoader = panel.extension.groupFrameLoader;
|
||||
|
||||
let readyPromise;
|
||||
if (panel.extension.remote) {
|
||||
|
|
|
@ -290,7 +290,6 @@ class BasePopup {
|
|||
"initialBrowsingContextGroupId",
|
||||
this.extension.policy.browsingContextGroupId
|
||||
);
|
||||
browser.sameProcessAsFrameLoader = this.extension.groupFrameLoader;
|
||||
|
||||
if (this.extension.remote) {
|
||||
browser.setAttribute("remote", "true");
|
||||
|
|
|
@ -235,7 +235,6 @@ add_task(async function test_revive_tab_from_session_store() {
|
|||
await promiseBrowserLoaded(browser);
|
||||
|
||||
let newTab2 = BrowserTestUtils.addTab(gBrowser, "about:blank", {
|
||||
sameProcessAsFrameLoader: browser.frameLoader,
|
||||
remoteType: browser.remoteType,
|
||||
initialBrowsingContextGroupId: browser.browsingContext.group.id,
|
||||
});
|
||||
|
@ -300,7 +299,6 @@ add_task(async function test_revive_all_tabs_from_session_store() {
|
|||
// about:tabcrashed.
|
||||
let win2 = await BrowserTestUtils.openNewBrowserWindow();
|
||||
let newTab2 = BrowserTestUtils.addTab(win2.gBrowser, PAGE_1, {
|
||||
sameProcessAsFrameLoader: browser.frameLoader,
|
||||
remoteType: browser.remoteType,
|
||||
initialBrowsingContextGroupId: browser.browsingContext.group.id,
|
||||
});
|
||||
|
@ -431,7 +429,6 @@ add_task(async function test_hide_restore_all_button() {
|
|||
// about:tabcrashed
|
||||
let win2 = await BrowserTestUtils.openNewBrowserWindow();
|
||||
let newTab3 = BrowserTestUtils.addTab(win2.gBrowser, PAGE_2, {
|
||||
sameProcessAsFrameLoader: browser.frameLoader,
|
||||
remoteType: browser.remoteType,
|
||||
initialBrowsingContextGroupId: browser.browsingContext.group.id,
|
||||
});
|
||||
|
|
|
@ -351,49 +351,6 @@ static bool InitialLoadIsRemote(Element* aOwner) {
|
|||
nsGkAtoms::_true, eCaseMatters);
|
||||
}
|
||||
|
||||
static void GetInitialRemoteTypeAndProcess(Element* aOwner,
|
||||
nsACString& aRemoteType,
|
||||
uint64_t* aChildID) {
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
*aChildID = 0;
|
||||
|
||||
// Check if there is an explicit `remoteType` attribute which we should use.
|
||||
nsAutoString remoteType;
|
||||
bool hasRemoteType =
|
||||
aOwner->GetAttr(kNameSpaceID_None, nsGkAtoms::RemoteType, remoteType);
|
||||
if (!hasRemoteType || remoteType.IsEmpty()) {
|
||||
hasRemoteType = false;
|
||||
aRemoteType = DEFAULT_REMOTE_TYPE;
|
||||
} else {
|
||||
aRemoteType = NS_ConvertUTF16toUTF8(remoteType);
|
||||
}
|
||||
|
||||
// Check if `sameProcessAsFrameLoader` was used to override the process.
|
||||
nsCOMPtr<nsIBrowser> browser = aOwner->AsBrowser();
|
||||
if (!browser) {
|
||||
return;
|
||||
}
|
||||
RefPtr<nsFrameLoader> otherLoader;
|
||||
browser->GetSameProcessAsFrameLoader(getter_AddRefs(otherLoader));
|
||||
if (!otherLoader) {
|
||||
return;
|
||||
}
|
||||
BrowserParent* browserParent = BrowserParent::GetFrom(otherLoader);
|
||||
if (!browserParent) {
|
||||
return;
|
||||
}
|
||||
RefPtr<ContentParent> contentParent = browserParent->Manager();
|
||||
|
||||
// NOTE: This assertion is known to fail in the wild. It is being kept around
|
||||
// only to ensure that we don't land and test new code which breaks this
|
||||
// desired invariant. (bug 1646328)
|
||||
MOZ_ASSERT(!hasRemoteType || contentParent->GetRemoteType() == aRemoteType,
|
||||
"If specified, remoteType attribute should match "
|
||||
"sameProcessAsFrameLoader");
|
||||
aRemoteType = contentParent->GetRemoteType();
|
||||
*aChildID = contentParent->ChildID();
|
||||
}
|
||||
|
||||
static already_AddRefed<BrowsingContextGroup> InitialBrowsingContextGroup(
|
||||
Element* aOwner) {
|
||||
nsAutoString attrString;
|
||||
|
@ -454,8 +411,20 @@ already_AddRefed<nsFrameLoader> nsFrameLoader::Create(
|
|||
RefPtr<nsFrameLoader> fl =
|
||||
new nsFrameLoader(aOwner, context, isRemoteFrame, aNetworkCreated);
|
||||
fl->mOpenWindowInfo = aOpenWindowInfo;
|
||||
|
||||
// If this is a toplevel initial remote frame, we're looking at a browser
|
||||
// loaded in the parent process. Pull the remote type attribute off of the
|
||||
// <browser> element to determine which remote type it should be loaded in, or
|
||||
// use `DEFAULT_REMOTE_TYPE` if we can't tell.
|
||||
if (isRemoteFrame) {
|
||||
GetInitialRemoteTypeAndProcess(aOwner, fl->mRemoteType, &fl->mChildID);
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
nsAutoString remoteType;
|
||||
if (aOwner->GetAttr(kNameSpaceID_None, nsGkAtoms::RemoteType, remoteType) &&
|
||||
!remoteType.IsEmpty()) {
|
||||
CopyUTF16toUTF8(remoteType, fl->mRemoteType);
|
||||
} else {
|
||||
fl->mRemoteType = DEFAULT_REMOTE_TYPE;
|
||||
}
|
||||
}
|
||||
return fl.forget();
|
||||
}
|
||||
|
|
|
@ -11,20 +11,9 @@ interface nsIWebProgress;
|
|||
interface nsIReferrerInfo;
|
||||
interface nsIOpenWindowInfo;
|
||||
|
||||
webidl FrameLoader;
|
||||
|
||||
[scriptable, uuid(14e5a0cb-e223-4202-95e8-fe53275193ea)]
|
||||
interface nsIBrowser : nsISupports
|
||||
{
|
||||
/**
|
||||
* Gets an optional frame loader that is "related" to this browser.
|
||||
* If this exists, then we should attempt to use the same content parent as
|
||||
* this frame loader for any new remote tabs. For example, view source
|
||||
* browsers set this to the frame loader for the original content to ensure
|
||||
* they are loaded in the same process as the content.
|
||||
*/
|
||||
readonly attribute FrameLoader sameProcessAsFrameLoader;
|
||||
|
||||
/*
|
||||
* Called by the child to inform the parent that links are dropped into
|
||||
* content area.
|
||||
|
|
|
@ -1158,14 +1158,11 @@ class HiddenXULWindow {
|
|||
* @param {Object} xulAttributes
|
||||
* An object that contains the xul attributes to set of the newly
|
||||
* created browser XUL element.
|
||||
* @param {FrameLoader} [groupFrameLoader]
|
||||
* The frame loader to load this browser into the same process
|
||||
* and tab group as.
|
||||
*
|
||||
* @returns {Promise<XULElement>}
|
||||
* A Promise which resolves to the newly created browser XUL element.
|
||||
*/
|
||||
async createBrowserElement(xulAttributes, groupFrameLoader = null) {
|
||||
async createBrowserElement(xulAttributes) {
|
||||
if (!xulAttributes || Object.keys(xulAttributes).length === 0) {
|
||||
throw new Error("missing mandatory xulAttributes parameter");
|
||||
}
|
||||
|
@ -1178,10 +1175,6 @@ class HiddenXULWindow {
|
|||
browser.setAttribute("type", "content");
|
||||
browser.setAttribute("disableglobalhistory", "true");
|
||||
|
||||
// NOTE: This can be removed once all callers pass
|
||||
// `initialBrowsingContextGroupId`.
|
||||
browser.sameProcessAsFrameLoader = groupFrameLoader;
|
||||
|
||||
for (const [name, value] of Object.entries(xulAttributes)) {
|
||||
if (value != null) {
|
||||
browser.setAttribute(name, value);
|
||||
|
@ -1299,15 +1292,12 @@ class HiddenExtensionPage {
|
|||
|
||||
let window = SharedWindow.acquire();
|
||||
try {
|
||||
this.browser = await window.createBrowserElement(
|
||||
{
|
||||
"webextension-view-type": this.viewType,
|
||||
remote: this.extension.remote ? "true" : null,
|
||||
remoteType: this.extension.remoteType,
|
||||
initialBrowsingContextGroupId: this.extension.browsingContextGroupId,
|
||||
},
|
||||
this.extension.groupFrameLoader
|
||||
);
|
||||
this.browser = await window.createBrowserElement({
|
||||
"webextension-view-type": this.viewType,
|
||||
remote: this.extension.remote ? "true" : null,
|
||||
remoteType: this.extension.remoteType,
|
||||
initialBrowsingContextGroupId: this.extension.browsingContextGroupId,
|
||||
});
|
||||
} catch (e) {
|
||||
SharedWindow.release();
|
||||
throw e;
|
||||
|
@ -1399,15 +1389,12 @@ const DebugUtils = {
|
|||
this.watchExtensionUpdated();
|
||||
}
|
||||
|
||||
return this.hiddenXULWindow.createBrowserElement(
|
||||
{
|
||||
"webextension-addon-debug-target": extensionId,
|
||||
remote: extension.remote ? "true" : null,
|
||||
remoteType: extension.remoteType,
|
||||
initialBrowsingContextGroupId: extension.browsingContextGroupId,
|
||||
},
|
||||
extension.groupFrameLoader
|
||||
);
|
||||
return this.hiddenXULWindow.createBrowserElement({
|
||||
"webextension-addon-debug-target": extensionId,
|
||||
remote: extension.remote ? "true" : null,
|
||||
remoteType: extension.remoteType,
|
||||
initialBrowsingContextGroupId: extension.browsingContextGroupId,
|
||||
});
|
||||
};
|
||||
|
||||
let browserPromise = this.debugBrowserPromises.get(extensionId);
|
||||
|
|
|
@ -258,7 +258,6 @@ class ContentPage {
|
|||
if (this.extension?.remote) {
|
||||
browser.setAttribute("remote", "true");
|
||||
browser.setAttribute("remoteType", "extension");
|
||||
browser.sameProcessAsFrameLoader = this.extension.groupFrameLoader;
|
||||
}
|
||||
|
||||
// Ensure that the extension is loaded into the correct
|
||||
|
|
|
@ -122,7 +122,6 @@ let Player = {
|
|||
"initialBrowsingContextGroupId",
|
||||
originatingBrowser.browsingContext.group.id
|
||||
);
|
||||
browser.sameProcessAsFrameLoader = originatingBrowser.frameLoader;
|
||||
holder.appendChild(browser);
|
||||
|
||||
this.actor = browser.browsingContext.currentWindowGlobal.getActor(
|
||||
|
|
|
@ -160,7 +160,6 @@ var PrintUtils = {
|
|||
let sourceBrowser = aBrowsingContext.embedderElement;
|
||||
let printPreviewBrowser = gBrowser.createBrowser({
|
||||
remoteType: sourceBrowser.remoteType,
|
||||
sameProcessAsFrameLoader: sourceBrowser.frameLoader,
|
||||
initialBrowsingContextGroupId: aBrowsingContext.group.id,
|
||||
skipLoad: false,
|
||||
});
|
||||
|
|
|
@ -118,15 +118,6 @@ var gViewSourceUtils = {
|
|||
}
|
||||
|
||||
if (browser) {
|
||||
// XXX(nika): I am pretty sure this does absolutely nothing. I don't think
|
||||
// that this will correctly ensure that the browser is loaded in the same
|
||||
// process as the URL it's viewing the source of.
|
||||
//
|
||||
// The callers of this function should probably be updated to make sure to
|
||||
// create the browser with the correct settings so it's already in the
|
||||
// correct process.
|
||||
viewSourceBrowser.sameProcessAsFrameLoader = browser.frameLoader;
|
||||
|
||||
// If we're dealing with a remote browser, then the browser
|
||||
// for view source needs to be remote as well.
|
||||
if (viewSourceBrowser.remoteType != browser.remoteType) {
|
||||
|
|
|
@ -207,19 +207,6 @@
|
|||
|
||||
this._documentContentType = null;
|
||||
|
||||
/**
|
||||
* Weak reference to an optional frame loader that can be used to influence
|
||||
* process selection for this browser.
|
||||
* See nsIBrowser.sameProcessAsFrameLoader.
|
||||
*
|
||||
* tabbrowser sets "sameProcessAsFrameLoader" on some browsers before
|
||||
* they are connected. This avoids clearing that out while we're doing
|
||||
* the initial construct(), which is what would read it.
|
||||
*/
|
||||
if (this.mInitialized) {
|
||||
this._sameProcessAsFrameLoader = null;
|
||||
}
|
||||
|
||||
this._loadContext = null;
|
||||
|
||||
this._webBrowserFind = null;
|
||||
|
@ -357,16 +344,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
set sameProcessAsFrameLoader(val) {
|
||||
this._sameProcessAsFrameLoader = Cu.getWeakReference(val);
|
||||
}
|
||||
|
||||
get sameProcessAsFrameLoader() {
|
||||
return (
|
||||
this._sameProcessAsFrameLoader && this._sameProcessAsFrameLoader.get()
|
||||
);
|
||||
}
|
||||
|
||||
get loadContext() {
|
||||
if (this._loadContext) {
|
||||
return this._loadContext;
|
||||
|
|
|
@ -2297,7 +2297,6 @@ class InlineOptionsBrowser extends HTMLElement {
|
|||
let { optionsURL, optionsBrowserStyle } = addon;
|
||||
if (addon.isWebExtension) {
|
||||
let policy = ExtensionParent.WebExtensionPolicy.getByID(addon.id);
|
||||
browser.sameProcessAsFrameLoader = policy.extension.groupFrameLoader;
|
||||
browser.setAttribute(
|
||||
"initialBrowsingContextGroupId",
|
||||
policy.browsingContextGroupId
|
||||
|
|
Загрузка…
Ссылка в новой задаче