mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 1382833 - Don't throw when dealing with CPOWs in the Object Actor;r=jimb
MozReview-Commit-ID: CaIS2IpaQme --HG-- extra : rebase_source : 75b4fe1abd460978039d7f1085d56e64b9dd2765
This commit is contained in:
parent
23bebfb386
commit
46cc553a7c
@ -91,13 +91,25 @@ ObjectActor.prototype = {
|
||||
g.proxyTarget = this.hooks.createValueGrip(this.obj.proxyTarget);
|
||||
g.proxyHandler = this.hooks.createValueGrip(this.obj.proxyHandler);
|
||||
} else {
|
||||
g.class = this.obj.class;
|
||||
g.extensible = this.obj.isExtensible();
|
||||
g.frozen = this.obj.isFrozen();
|
||||
g.sealed = this.obj.isSealed();
|
||||
try {
|
||||
g.class = this.obj.class;
|
||||
g.extensible = this.obj.isExtensible();
|
||||
g.frozen = this.obj.isFrozen();
|
||||
g.sealed = this.obj.isSealed();
|
||||
} catch (e) {
|
||||
// Handle cases where the underlying object's calls to isExtensible, etc throw.
|
||||
// This is possible with ProxyObjects like CPOWs. Note these are different from
|
||||
// scripted Proxies created via `new Proxy`, which match this.obj.isProxy above.
|
||||
}
|
||||
}
|
||||
|
||||
if (g.class != "DeadObject") {
|
||||
// Changing the class so that CPOWs will be visible in the UI
|
||||
let isCPOW = DevToolsUtils.isCPOW(this.obj);
|
||||
if (isCPOW) {
|
||||
g.class = "CPOW: " + g.class;
|
||||
}
|
||||
|
||||
if (g.class != "DeadObject" && !isCPOW) {
|
||||
if (g.class == "Promise") {
|
||||
g.promiseState = this._createPromiseState();
|
||||
}
|
||||
|
@ -28,6 +28,21 @@ for (let key of Object.keys(ThreadSafeDevToolsUtils)) {
|
||||
exports[key] = ThreadSafeDevToolsUtils[key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for Cu.isCrossProcessWrapper that works with Debugger.Objects.
|
||||
* This will always return false in workers (see the implementation in
|
||||
* ThreadSafeDevToolsUtils.js).
|
||||
*
|
||||
* @param Debugger.Object debuggerObject
|
||||
* @return bool
|
||||
*/
|
||||
exports.isCPOW = function (debuggerObject) {
|
||||
try {
|
||||
return Cu.isCrossProcessWrapper(debuggerObject.unsafeDereference());
|
||||
} catch (e) { }
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Waits for the next tick in the event loop to execute a callback.
|
||||
*/
|
||||
|
@ -69,6 +69,14 @@ exports.values = function values(object) {
|
||||
return Object.keys(object).map(k => object[k]);
|
||||
};
|
||||
|
||||
/**
|
||||
* This is overridden in DevToolsUtils for the main thread, where we have the
|
||||
* Cu object available.
|
||||
*/
|
||||
exports.isCPOW = function () {
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Report that |who| threw an exception, |exception|.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user