Bug 1407026 - Fix CPOW class mistake in the console.
MozReview-Commit-ID: 3Mk2kclTReX
--- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_console.js
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser_console.js
@@ -192,9 +192,21 @@ function* testCPOWInspection(hud) {
// Before the fix for Bug 1382833, this wouldn't resolve due to a CPOW error
// in the ObjectActor.
let prototypeAndProperties = yield objectClient.getPrototypeAndProperties();
// Just a sanity check to make sure a valid packet came back
is(prototypeAndProperties.prototype.class, "XBL prototype JSClass",
"Looks like a valid response");
+
+ // The CPOW is in the _contentWindow property.
+ let cpow = prototypeAndProperties.ownProperties._contentWindow.value;
+
+ // But it's only a CPOW in e10s.
+ let e10sCheck = yield hud.jsterm.requestEvaluation(
+ "Cu.isCrossProcessWrapper(gBrowser.selectedBrowser._contentWindow)");
+ if (e10sCheck.result) {
+ is(cpow.class, "CPOW: Window", "The CPOW grip has the right class.");
+ } else {
+ is(cpow.class, "Window", "The object is not a CPOW.");
+ }
}
--- a/devtools/client/webconsole/test/browser_console.js
+++ b/devtools/client/webconsole/test/browser_console.js
@@ -192,9 +192,21 @@ function* testCPOWInspection(hud) {
// Before the fix for Bug 1382833, this wouldn't resolve due to a CPOW error
// in the ObjectActor.
let prototypeAndProperties = yield objectClient.getPrototypeAndProperties();
// Just a sanity check to make sure a valid packet came back
is(prototypeAndProperties.prototype.class, "XBL prototype JSClass",
"Looks like a valid response");
+
+ // The CPOW is in the _contentWindow property.
+ let cpow = prototypeAndProperties.ownProperties._contentWindow.value;
+
+ // But it's only a CPOW in e10s.
+ let e10sCheck = yield hud.jsterm.requestEvaluation(
+ "Cu.isCrossProcessWrapper(gBrowser.selectedBrowser._contentWindow)");
+ if (e10sCheck.result) {
+ is(cpow.class, "CPOW: Window", "The CPOW grip has the right class.");
+ } else {
+ is(cpow.class, "Window", "The object is not a CPOW.");
+ }
}
--- a/devtools/server/actors/object.js
+++ b/devtools/server/actors/object.js
@@ -78,17 +78,17 @@ ObjectActor.prototype = {
"actor": this.actorID
};
// Check if the object has a wrapper which denies access. It may be a CPOW or a
// security wrapper. Change the class so that this will be visible in the UI.
let unwrapped = DevToolsUtils.unwrap(this.obj);
if (!unwrapped) {
if (DevToolsUtils.isCPOW(this.obj)) {
- g.class = "CPOW: " + g.class;
+ g.class = "CPOW: " + this.obj.class;
} else {
g.class = "Inaccessible";
}
return g;
}
// Dead objects also deny access.
if (this.obj.class == "DeadObject") {