зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1225828 - Avoid 'Object in compartment marked as invisible to Debugger' exceptions in the Browser Console / Browser Toolbox;r=fitzgen
--HG-- extra : commitid : FBCqMOHoPFs
This commit is contained in:
Родитель
02c20285e8
Коммит
1a487eae09
|
@ -423,16 +423,18 @@ WebConsoleActor.prototype =
|
|||
*/
|
||||
makeDebuggeeValue: function WCA_makeDebuggeeValue(aValue, aUseObjectGlobal)
|
||||
{
|
||||
let global = this.window;
|
||||
if (aUseObjectGlobal && typeof aValue == "object") {
|
||||
try {
|
||||
global = Cu.getGlobalForObject(aValue);
|
||||
let global = Cu.getGlobalForObject(aValue);
|
||||
let dbgGlobal = this.dbg.makeGlobalObjectReference(global);
|
||||
return dbgGlobal.makeDebuggeeValue(aValue);
|
||||
}
|
||||
catch (ex) {
|
||||
// The above can throw an exception if aValue is not an actual object.
|
||||
// The above can throw an exception if aValue is not an actual object
|
||||
// or 'Object in compartment marked as invisible to Debugger'
|
||||
}
|
||||
}
|
||||
let dbgGlobal = this.dbg.makeGlobalObjectReference(global);
|
||||
let dbgGlobal = this.dbg.makeGlobalObjectReference(this.window);
|
||||
return dbgGlobal.makeDebuggeeValue(aValue);
|
||||
},
|
||||
|
||||
|
|
|
@ -325,8 +325,13 @@ exports.getProperty = function getProperty(aObj, aKey) {
|
|||
exports.hasSafeGetter = function hasSafeGetter(aDesc) {
|
||||
// Scripted functions that are CCWs will not appear scripted until after
|
||||
// unwrapping.
|
||||
let fn = aDesc.get.unwrap();
|
||||
return fn && fn.callable && fn.class == "Function" && fn.script === undefined;
|
||||
try {
|
||||
let fn = aDesc.get.unwrap();
|
||||
return fn && fn.callable && fn.class == "Function" && fn.script === undefined;
|
||||
} catch(e) {
|
||||
// Avoid exception 'Object in compartment marked as invisible to Debugger'
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,6 +28,10 @@ function doConsoleCalls(aState)
|
|||
top.console.dir(top.document, top.location);
|
||||
top.console.log("foo", longString);
|
||||
|
||||
let sandbox = new Cu.Sandbox(null, { invisibleToDebugger: true });
|
||||
let sandboxObj = sandbox.eval("new Object");
|
||||
top.console.log(sandboxObj);
|
||||
|
||||
function fromAsmJS() {
|
||||
top.console.error("foobarBaz-asmjs-error", undefined);
|
||||
}
|
||||
|
@ -119,6 +123,19 @@ function doConsoleCalls(aState)
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
level: "log",
|
||||
filename: /test_consoleapi/,
|
||||
functionName: "doConsoleCalls",
|
||||
timeStamp: /^\d+$/,
|
||||
arguments: [
|
||||
{
|
||||
type: "object",
|
||||
actor: /[a-z]/,
|
||||
class: "Object",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
level: "error",
|
||||
filename: /test_consoleapi/,
|
||||
|
|
Загрузка…
Ссылка в новой задаче