mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Backed out 6 changesets (bug 1618445
) for leaks at mozilla::dom::Console::CreateInstance
Backed out changeset 0a996e80d92a (bug1618445
) Backed out changeset 4281c434f737 (bug1618445
) Backed out changeset 846b67024a9a (bug1618445
) Backed out changeset 439d0b9ba0fc (bug1618445
) Backed out changeset 79ae5f86d927 (bug1618445
) Backed out changeset c09a442d8ddf (bug1618445
)
This commit is contained in:
parent
e23b161122
commit
87ef7e0ec7
@ -216,6 +216,12 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
* Debug mode is controlled by preference browser.sessionstore.debug
|
||||
*/
|
||||
var gDebuggingEnabled = false;
|
||||
function debug(aMsg) {
|
||||
if (gDebuggingEnabled) {
|
||||
aMsg = ("SessionStore: " + aMsg).replace(/\S{80}/g, "$&\n");
|
||||
Services.console.logStringMessage(aMsg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A global value to tell that fingerprinting resistance is enabled or not.
|
||||
@ -564,8 +570,6 @@ var SessionStoreInternal = {
|
||||
// number of tabs currently restoring
|
||||
_tabsRestoringCount: 0,
|
||||
|
||||
_log: null,
|
||||
|
||||
// When starting Firefox with a single private window, this is the place
|
||||
// where we keep the session we actually wanted to restore in case the user
|
||||
// decides to later open a non-private window as well.
|
||||
@ -775,7 +779,7 @@ var SessionStoreInternal = {
|
||||
});
|
||||
}
|
||||
} catch (ex) {
|
||||
this._log.error("The session file is invalid: " + ex);
|
||||
debug("The session file is invalid: " + ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -801,11 +805,6 @@ var SessionStoreInternal = {
|
||||
gDebuggingEnabled = this._prefBranch.getBoolPref("sessionstore.debug");
|
||||
});
|
||||
|
||||
this._log = console.createInstance({
|
||||
prefix: "SessionStore",
|
||||
maxLogLevel: gDebuggingEnabled ? "Debug" : "Warn",
|
||||
});
|
||||
|
||||
this._max_tabs_undo = this._prefBranch.getIntPref(
|
||||
"sessionstore.max_tabs_undo"
|
||||
);
|
||||
@ -2534,8 +2533,8 @@ var SessionStoreInternal = {
|
||||
aSwitchId,
|
||||
aReplaceBrowsingContext
|
||||
) {
|
||||
E10SUtils.log().info(
|
||||
`performing switch from ${aBrowser.remoteType} to ${aRemoteType}`
|
||||
debug(
|
||||
`[process-switch]: performing switch from ${aBrowser.remoteType} to ${aRemoteType}`
|
||||
);
|
||||
|
||||
// Don't try to switch tabs before delayed startup is completed.
|
||||
@ -2569,7 +2568,7 @@ var SessionStoreInternal = {
|
||||
|
||||
// Tell our caller to redirect the load into this newly created process.
|
||||
let remoteTab = aBrowser.frameLoader.remoteTab;
|
||||
E10SUtils.log().debug(`new tabID: ${remoteTab.tabId}`);
|
||||
debug(`[process-switch]: new tabID: ${remoteTab.tabId}`);
|
||||
return remoteTab.contentProcessId;
|
||||
},
|
||||
|
||||
@ -2615,7 +2614,7 @@ var SessionStoreInternal = {
|
||||
try {
|
||||
switchRequestor = aRequestor.QueryInterface(Ci.nsIProcessSwitchRequestor);
|
||||
} catch (e) {
|
||||
E10SUtils.log().warn(`object not compatible with process switching `);
|
||||
debug(`[process-switch]: object not compatible with process switching `);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2631,21 +2630,21 @@ var SessionStoreInternal = {
|
||||
Ci.nsIContentPolicy.TYPE_DOCUMENT;
|
||||
|
||||
if (!browsingContext) {
|
||||
E10SUtils.log().debug(`no BrowsingContext - ignoring`);
|
||||
debug(`[process-switch]: no BrowsingContext - ignoring`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine if remote subframes should be used for this load.
|
||||
let topBC = browsingContext.top;
|
||||
if (!topBC.embedderElement) {
|
||||
E10SUtils.log().debug(`no embedder for top - ignoring`);
|
||||
debug(`[process-switch]: no embedder for top - ignoring`);
|
||||
return;
|
||||
}
|
||||
|
||||
let topDocShell = topBC.embedderElement.ownerGlobal.docShell;
|
||||
let { useRemoteSubframes } = topDocShell.QueryInterface(Ci.nsILoadContext);
|
||||
if (!useRemoteSubframes && isSubframe) {
|
||||
E10SUtils.log().debug(`remote subframes disabled - ignoring`);
|
||||
debug(`[process-switch]: remote subframes disabled - ignoring`);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2661,22 +2660,22 @@ var SessionStoreInternal = {
|
||||
if (browsingContext.embedderElement) {
|
||||
let tabbrowser = browsingContext.embedderElement.getTabBrowser();
|
||||
if (!tabbrowser) {
|
||||
E10SUtils.log().debug(
|
||||
`cannot find tabbrowser for loading tab - ignoring`
|
||||
debug(
|
||||
`[process-switch]: cannot find tabbrowser for loading tab - ignoring`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
let tab = tabbrowser.getTabForBrowser(browsingContext.embedderElement);
|
||||
if (!tab) {
|
||||
E10SUtils.log().debug(
|
||||
`not a normal tab, so cannot swap processes - ignoring`
|
||||
debug(
|
||||
`[process-switch]: not a normal tab, so cannot swap processes - ignoring`
|
||||
);
|
||||
return;
|
||||
}
|
||||
} else if (!browsingContext.parent) {
|
||||
E10SUtils.log().debug(
|
||||
`no parent or in-process embedder element - ignoring`
|
||||
debug(
|
||||
`[process-switch] no parent or in-process embedder element - ignoring`
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -2684,7 +2683,7 @@ var SessionStoreInternal = {
|
||||
// Get the current remote type for the BrowsingContext.
|
||||
let currentRemoteType = browsingContext.currentRemoteType;
|
||||
if (currentRemoteType == E10SUtils.NOT_REMOTE) {
|
||||
E10SUtils.log().debug(`currently not remote - ignoring`);
|
||||
debug(`[process-switch]: currently not remote - ignoring`);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2713,8 +2712,8 @@ var SessionStoreInternal = {
|
||||
// to a default remoteType
|
||||
preferredRemoteType = E10SUtils.DEFAULT_REMOTE_TYPE;
|
||||
}
|
||||
E10SUtils.log().info(
|
||||
`currentRemoteType (${currentRemoteType}) preferredRemoteType: ${preferredRemoteType}`
|
||||
debug(
|
||||
`[process-switch]: currentRemoteType (${currentRemoteType}) preferredRemoteType: ${preferredRemoteType}`
|
||||
);
|
||||
|
||||
let remoteType = E10SUtils.getRemoteTypeForPrincipal(
|
||||
@ -2726,12 +2725,12 @@ var SessionStoreInternal = {
|
||||
isSubframe
|
||||
);
|
||||
|
||||
E10SUtils.log().debug(
|
||||
`${currentRemoteType}, ${remoteType}, ${isCOOPSwitch}`
|
||||
debug(
|
||||
`[process-switch]: ${currentRemoteType}, ${remoteType}, ${isCOOPSwitch}`
|
||||
);
|
||||
|
||||
if (currentRemoteType == remoteType && !isCOOPSwitch) {
|
||||
E10SUtils.log().debug(`type (${remoteType}) is compatible - ignoring`);
|
||||
debug(`[process-switch]: type (${remoteType}) is compatible - ignoring`);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2739,7 +2738,7 @@ var SessionStoreInternal = {
|
||||
remoteType == E10SUtils.NOT_REMOTE ||
|
||||
currentRemoteType == E10SUtils.NOT_REMOTE
|
||||
) {
|
||||
E10SUtils.log().debug(`non-remote source/target - ignoring`);
|
||||
debug(`[process-switch]: non-remote source/target - ignoring`);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4359,7 +4358,7 @@ var SessionStoreInternal = {
|
||||
root = typeof aState == "string" ? JSON.parse(aState) : aState;
|
||||
} catch (ex) {
|
||||
// invalid state object - don't restore anything
|
||||
this._log.error(ex);
|
||||
debug(ex);
|
||||
this._sendRestoreCompletedNotifications();
|
||||
return;
|
||||
}
|
||||
|
@ -80,6 +80,10 @@ XPCOMUtils.defineLazyServiceGetter(
|
||||
"nsIExternalProtocolService"
|
||||
);
|
||||
|
||||
function debug(msg) {
|
||||
Cu.reportError(new Error("E10SUtils: " + msg));
|
||||
}
|
||||
|
||||
function getAboutModule(aURL) {
|
||||
// Needs to match NS_GetAboutModuleName
|
||||
let moduleName = aURL.pathQueryRef.replace(/[#?].*/, "").toLowerCase();
|
||||
@ -256,7 +260,6 @@ function validatedWebRemoteType(
|
||||
!documentChannel &&
|
||||
aPreferredRemoteType == FILE_REMOTE_TYPE
|
||||
) {
|
||||
E10SUtils.log().debug("checking allowLinkedWebInFileUriProcess");
|
||||
// If aCurrentUri is passed then we should only allow FILE_REMOTE_TYPE
|
||||
// when it is same origin as target or the current URI is already a
|
||||
// file:// URI.
|
||||
@ -266,15 +269,12 @@ function validatedWebRemoteType(
|
||||
// todo: if you intend to update CheckSameOriginURI to log the error to the
|
||||
// console you also need to update the 'aFromPrivateWindow' argument.
|
||||
sm.checkSameOriginURI(aCurrentUri, aTargetUri, false, false);
|
||||
E10SUtils.log().debug("Next URL is same origin");
|
||||
return FILE_REMOTE_TYPE;
|
||||
} catch (e) {
|
||||
E10SUtils.log().debug("Leaving same origin");
|
||||
return WEB_REMOTE_TYPE;
|
||||
}
|
||||
}
|
||||
|
||||
E10SUtils.log().debug("No aCurrentUri");
|
||||
return FILE_REMOTE_TYPE;
|
||||
}
|
||||
|
||||
@ -299,24 +299,6 @@ var E10SUtils = {
|
||||
return documentChannel;
|
||||
},
|
||||
|
||||
_log: null,
|
||||
_uriStr: function uriStr(aUri) {
|
||||
return aUri ? aUri.spec : "undefined";
|
||||
},
|
||||
|
||||
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.
|
||||
*
|
||||
@ -331,7 +313,7 @@ var E10SUtils = {
|
||||
serializedCSP = serializationHelper.serializeToString(csp);
|
||||
}
|
||||
} catch (e) {
|
||||
this.log().error(`Failed to serialize csp '${csp}' ${e}`);
|
||||
debug(`Failed to serialize csp '${csp}' ${e}`);
|
||||
}
|
||||
return serializedCSP;
|
||||
},
|
||||
@ -353,7 +335,7 @@ var E10SUtils = {
|
||||
csp.QueryInterface(Ci.nsIContentSecurityPolicy);
|
||||
return csp;
|
||||
} catch (e) {
|
||||
this.log().error(`Failed to deserialize csp_b64 '${csp_b64}' ${e}`);
|
||||
debug(`Failed to deserialize csp_b64 '${csp_b64}' ${e}`);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@ -541,20 +523,13 @@ var E10SUtils = {
|
||||
);
|
||||
}
|
||||
|
||||
var log = this.log();
|
||||
log.debug("validatedWebRemoteType()");
|
||||
log.debug(` aPreferredRemoteType: ${aPreferredRemoteType}`);
|
||||
log.debug(` aTargetUri: ${this._uriStr(aURI)}`);
|
||||
log.debug(` aCurrentUri: ${this._uriStr(aCurrentUri)}`);
|
||||
var remoteType = validatedWebRemoteType(
|
||||
return validatedWebRemoteType(
|
||||
aPreferredRemoteType,
|
||||
aURI,
|
||||
aCurrentUri,
|
||||
aResultPrincipal,
|
||||
aRemoteSubframes
|
||||
);
|
||||
log.debug(` validatedWebRemoteType() returning: ${remoteType}`);
|
||||
return remoteType;
|
||||
}
|
||||
},
|
||||
|
||||
@ -652,7 +627,7 @@ var E10SUtils = {
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
this.log().error(`Failed to serialize principal '${principal}' ${e}`);
|
||||
debug(`Failed to serialize principal '${principal}' ${e}`);
|
||||
}
|
||||
|
||||
return serializedPrincipal;
|
||||
@ -668,7 +643,7 @@ var E10SUtils = {
|
||||
deserializePrincipal(principal_b64, fallbackPrincipalCallback = null) {
|
||||
if (!principal_b64) {
|
||||
if (!fallbackPrincipalCallback) {
|
||||
this.log().warn(
|
||||
debug(
|
||||
"No principal passed to deserializePrincipal and no fallbackPrincipalCallback"
|
||||
);
|
||||
return null;
|
||||
@ -692,12 +667,10 @@ var E10SUtils = {
|
||||
principal.QueryInterface(Ci.nsIPrincipal);
|
||||
return principal;
|
||||
} catch (e) {
|
||||
this.log().error(
|
||||
`Failed to deserialize principal_b64 '${principal_b64}' ${e}`
|
||||
);
|
||||
debug(`Failed to deserialize principal_b64 '${principal_b64}' ${e}`);
|
||||
}
|
||||
if (!fallbackPrincipalCallback) {
|
||||
this.log().warn(
|
||||
debug(
|
||||
"No principal passed to deserializePrincipal and no fallbackPrincipalCallback"
|
||||
);
|
||||
return null;
|
||||
@ -776,21 +749,19 @@ var E10SUtils = {
|
||||
|
||||
shouldLoadURIInThisProcess(aURI, aRemoteSubframes) {
|
||||
let remoteType = Services.appinfo.remoteType;
|
||||
let wantRemoteType = this.getRemoteTypeForURIObject(
|
||||
return (
|
||||
remoteType ==
|
||||
this.getRemoteTypeForURIObject(
|
||||
aURI,
|
||||
/* remote */ true,
|
||||
aRemoteSubframes,
|
||||
remoteType
|
||||
)
|
||||
);
|
||||
this.log().info(
|
||||
`shouldLoadURIInThisProcess: have ${remoteType} want ${wantRemoteType}`
|
||||
);
|
||||
return remoteType == wantRemoteType;
|
||||
},
|
||||
|
||||
shouldLoadURI(aDocShell, aURI, aHasPostData) {
|
||||
let { useRemoteSubframes } = aDocShell;
|
||||
this.log().debug(`shouldLoadURI(${this._uriStr(aURI)})`);
|
||||
|
||||
// Inner frames should always load in the current process
|
||||
// XXX(nika): Handle shouldLoadURI-triggered process switches for remote
|
||||
@ -842,38 +813,32 @@ var E10SUtils = {
|
||||
!aDocShell.awaitingLargeAlloc &&
|
||||
isOnlyToplevelBrowsingContext
|
||||
) {
|
||||
this.log().info(
|
||||
"returning false to throw away large allocation process\n"
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Allow history load if loaded in this process before.
|
||||
let requestedIndex = sessionHistory.legacySHistory.requestedIndex;
|
||||
if (requestedIndex >= 0) {
|
||||
this.log().debug("Checking history case\n");
|
||||
if (
|
||||
sessionHistory.legacySHistory.getEntryAtIndex(requestedIndex)
|
||||
.loadedInThisProcess
|
||||
) {
|
||||
this.log().info("History entry loaded in this process");
|
||||
return true;
|
||||
}
|
||||
|
||||
// If not originally loaded in this process allow it if the URI would
|
||||
// normally be allowed to load in this process by default.
|
||||
let remoteType = Services.appinfo.remoteType;
|
||||
let wantRemoteType = this.getRemoteTypeForURIObject(
|
||||
return (
|
||||
remoteType ==
|
||||
this.getRemoteTypeForURIObject(
|
||||
aURI,
|
||||
true,
|
||||
useRemoteSubframes,
|
||||
remoteType,
|
||||
webNav.currentURI
|
||||
)
|
||||
);
|
||||
this.log().debug(
|
||||
`Checking remote type, got: ${remoteType} want: ${wantRemoteType}\n`
|
||||
);
|
||||
return remoteType == wantRemoteType;
|
||||
}
|
||||
|
||||
// If the URI can be loaded in the current process then continue
|
||||
@ -934,9 +899,7 @@ var E10SUtils = {
|
||||
try {
|
||||
serialized = serializationHelper.serializeToString(referrerInfo);
|
||||
} catch (e) {
|
||||
this.log().error(
|
||||
`Failed to serialize referrerInfo '${referrerInfo}' ${e}`
|
||||
);
|
||||
debug(`Failed to serialize referrerInfo '${referrerInfo}' ${e}`);
|
||||
}
|
||||
}
|
||||
return serialized;
|
||||
@ -954,7 +917,7 @@ var E10SUtils = {
|
||||
deserialized = serializationHelper.deserializeObject(referrerInfo_b64);
|
||||
deserialized.QueryInterface(Ci.nsIReferrerInfo);
|
||||
} catch (e) {
|
||||
this.log().error(
|
||||
debug(
|
||||
`Failed to deserialize referrerInfo_b64 '${referrerInfo_b64}' ${e}`
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user