Bug 1380449 - Do not clone when not in a Web Extension r=kmag

MozReview-Commit-ID: D1Ry7INxnYo
This commit is contained in:
Julien Wajsberg
2017-07-20 16:06:15 +02:00
parent 761cd98c63
commit 43b7fd0903

View File

@@ -16,6 +16,8 @@ XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryController",
"resource://gre/modules/TelemetryController.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "E10SUtils",
"resource:///modules/E10SUtils.jsm");
/*
* The message manager has an upper limit on message sizes that it can
@@ -79,11 +81,18 @@ ContentProcessSingleton.prototype = {
for (let arg of consoleMsg.arguments) {
if ((typeof arg == "object" || typeof arg == "function") &&
arg !== null) {
try {
// If the argument is clonable, then send it as-is. If
// cloning fails, fall back to the unavailable string.
arg = Cu.cloneInto(arg, {});
} catch (e) {
if (Services.appinfo.remoteType === E10SUtils.EXTENSION_REMOTE_TYPE) {
// For OOP extensions: we want the developer to be able to see the
// logs in the Browser Console. When the Addon Toolbox will be more
// prominent we can revisit.
try {
// If the argument is clonable, then send it as-is. If
// cloning fails, fall back to the unavailable string.
arg = Cu.cloneInto(arg, {});
} catch (e) {
arg = unavailString;
}
} else {
arg = unavailString;
}
totalArgLength += unavailStringLength;