зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1618445
- pt 2. Move process switch logging to E10SUtils r=mattwoodrow
* Create new logger. * Use logger for process switch logging. * Remove "[process-switch]: " string from log messages, it is redundant. This may eventually move to a whole new module if/when process switching moves there. Differential Revision: https://phabricator.services.mozilla.com/D65440 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
4bce55271e
Коммит
7cb945b749
|
@ -2540,8 +2540,8 @@ var SessionStoreInternal = {
|
||||||
aSwitchId,
|
aSwitchId,
|
||||||
aReplaceBrowsingContext
|
aReplaceBrowsingContext
|
||||||
) {
|
) {
|
||||||
log().info(
|
E10SUtils.log().info(
|
||||||
`[process-switch]: performing switch from ${aBrowser.remoteType} to ${aRemoteType}`
|
`performing switch from ${aBrowser.remoteType} to ${aRemoteType}`
|
||||||
);
|
);
|
||||||
|
|
||||||
// Don't try to switch tabs before delayed startup is completed.
|
// Don't try to switch tabs before delayed startup is completed.
|
||||||
|
@ -2575,7 +2575,7 @@ var SessionStoreInternal = {
|
||||||
|
|
||||||
// Tell our caller to redirect the load into this newly created process.
|
// Tell our caller to redirect the load into this newly created process.
|
||||||
let remoteTab = aBrowser.frameLoader.remoteTab;
|
let remoteTab = aBrowser.frameLoader.remoteTab;
|
||||||
log().debug(`[process-switch]: new tabID: ${remoteTab.tabId}`);
|
E10SUtils.log().debug(`new tabID: ${remoteTab.tabId}`);
|
||||||
return remoteTab.contentProcessId;
|
return remoteTab.contentProcessId;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2621,9 +2621,7 @@ var SessionStoreInternal = {
|
||||||
try {
|
try {
|
||||||
switchRequestor = aRequestor.QueryInterface(Ci.nsIProcessSwitchRequestor);
|
switchRequestor = aRequestor.QueryInterface(Ci.nsIProcessSwitchRequestor);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log().warn(
|
E10SUtils.log().warn(`object not compatible with process switching `);
|
||||||
`[process-switch]: object not compatible with process switching `
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2639,21 +2637,21 @@ var SessionStoreInternal = {
|
||||||
Ci.nsIContentPolicy.TYPE_DOCUMENT;
|
Ci.nsIContentPolicy.TYPE_DOCUMENT;
|
||||||
|
|
||||||
if (!browsingContext) {
|
if (!browsingContext) {
|
||||||
log().debug(`[process-switch]: no BrowsingContext - ignoring`);
|
E10SUtils.log().debug(`no BrowsingContext - ignoring`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine if remote subframes should be used for this load.
|
// Determine if remote subframes should be used for this load.
|
||||||
let topBC = browsingContext.top;
|
let topBC = browsingContext.top;
|
||||||
if (!topBC.embedderElement) {
|
if (!topBC.embedderElement) {
|
||||||
log().debug(`[process-switch]: no embedder for top - ignoring`);
|
E10SUtils.log().debug(`no embedder for top - ignoring`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let topDocShell = topBC.embedderElement.ownerGlobal.docShell;
|
let topDocShell = topBC.embedderElement.ownerGlobal.docShell;
|
||||||
let { useRemoteSubframes } = topDocShell.QueryInterface(Ci.nsILoadContext);
|
let { useRemoteSubframes } = topDocShell.QueryInterface(Ci.nsILoadContext);
|
||||||
if (!useRemoteSubframes && isSubframe) {
|
if (!useRemoteSubframes && isSubframe) {
|
||||||
log().debug(`[process-switch]: remote subframes disabled - ignoring`);
|
E10SUtils.log().debug(`remote subframes disabled - ignoring`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2669,22 +2667,22 @@ var SessionStoreInternal = {
|
||||||
if (browsingContext.embedderElement) {
|
if (browsingContext.embedderElement) {
|
||||||
let tabbrowser = browsingContext.embedderElement.getTabBrowser();
|
let tabbrowser = browsingContext.embedderElement.getTabBrowser();
|
||||||
if (!tabbrowser) {
|
if (!tabbrowser) {
|
||||||
log().debug(
|
E10SUtils.log().debug(
|
||||||
`[process-switch]: cannot find tabbrowser for loading tab - ignoring`
|
`cannot find tabbrowser for loading tab - ignoring`
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let tab = tabbrowser.getTabForBrowser(browsingContext.embedderElement);
|
let tab = tabbrowser.getTabForBrowser(browsingContext.embedderElement);
|
||||||
if (!tab) {
|
if (!tab) {
|
||||||
log().debug(
|
E10SUtils.log().debug(
|
||||||
`[process-switch]: not a normal tab, so cannot swap processes - ignoring`
|
`not a normal tab, so cannot swap processes - ignoring`
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (!browsingContext.parent) {
|
} else if (!browsingContext.parent) {
|
||||||
log().debug(
|
E10SUtils.log().debug(
|
||||||
`[process-switch] no parent or in-process embedder element - ignoring`
|
`no parent or in-process embedder element - ignoring`
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2692,7 +2690,7 @@ var SessionStoreInternal = {
|
||||||
// Get the current remote type for the BrowsingContext.
|
// Get the current remote type for the BrowsingContext.
|
||||||
let currentRemoteType = browsingContext.currentRemoteType;
|
let currentRemoteType = browsingContext.currentRemoteType;
|
||||||
if (currentRemoteType == E10SUtils.NOT_REMOTE) {
|
if (currentRemoteType == E10SUtils.NOT_REMOTE) {
|
||||||
log().debug(`[process-switch]: currently not remote - ignoring`);
|
E10SUtils.log().debug(`currently not remote - ignoring`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2721,8 +2719,8 @@ var SessionStoreInternal = {
|
||||||
// to a default remoteType
|
// to a default remoteType
|
||||||
preferredRemoteType = E10SUtils.DEFAULT_REMOTE_TYPE;
|
preferredRemoteType = E10SUtils.DEFAULT_REMOTE_TYPE;
|
||||||
}
|
}
|
||||||
log().info(
|
E10SUtils.log().info(
|
||||||
`[process-switch]: currentRemoteType (${currentRemoteType}) preferredRemoteType: ${preferredRemoteType}`
|
`currentRemoteType (${currentRemoteType}) preferredRemoteType: ${preferredRemoteType}`
|
||||||
);
|
);
|
||||||
|
|
||||||
let remoteType = E10SUtils.getRemoteTypeForPrincipal(
|
let remoteType = E10SUtils.getRemoteTypeForPrincipal(
|
||||||
|
@ -2734,14 +2732,12 @@ var SessionStoreInternal = {
|
||||||
isSubframe
|
isSubframe
|
||||||
);
|
);
|
||||||
|
|
||||||
log().debug(
|
E10SUtils.log().debug(
|
||||||
`[process-switch]: ${currentRemoteType}, ${remoteType}, ${isCOOPSwitch}`
|
`${currentRemoteType}, ${remoteType}, ${isCOOPSwitch}`
|
||||||
);
|
);
|
||||||
|
|
||||||
if (currentRemoteType == remoteType && !isCOOPSwitch) {
|
if (currentRemoteType == remoteType && !isCOOPSwitch) {
|
||||||
log().debug(
|
E10SUtils.log().debug(`type (${remoteType}) is compatible - ignoring`);
|
||||||
`[process-switch]: type (${remoteType}) is compatible - ignoring`
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2749,7 +2745,7 @@ var SessionStoreInternal = {
|
||||||
remoteType == E10SUtils.NOT_REMOTE ||
|
remoteType == E10SUtils.NOT_REMOTE ||
|
||||||
currentRemoteType == E10SUtils.NOT_REMOTE
|
currentRemoteType == E10SUtils.NOT_REMOTE
|
||||||
) {
|
) {
|
||||||
log().debug(`[process-switch]: non-remote source/target - ignoring`);
|
E10SUtils.log().debug(`non-remote source/target - ignoring`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -299,6 +299,20 @@ var E10SUtils = {
|
||||||
return documentChannel;
|
return documentChannel;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_log: null,
|
||||||
|
log: function log() {
|
||||||
|
if (!this._log) {
|
||||||
|
this._log = console.createInstance({
|
||||||
|
prefix: "ProcessSwitch",
|
||||||
|
maxLogLevel: "Error", // Change to debug the process switching code
|
||||||
|
});
|
||||||
|
|
||||||
|
this._log.debug("Setup logger");
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._log;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serialize csp data.
|
* Serialize csp data.
|
||||||
*
|
*
|
||||||
|
|
Загрузка…
Ссылка в новой задаче