Bug 1407026 - Fix CPOW class mistake in the console. draft
authorOriol Brufau <oriol-bugzilla@hotmail.com>
Tue, 10 Oct 2017 22:37:29 +0200
changeset 679232 2d7ede06fc4687a62c43fa1fe9a91d2bf24a6244
parent 677774 a0488ecc201c04f2617e7b02f039344e8fbf0d9a
child 735543 0f6c845055a8b52e3850d3b77eed167b1dda1446
push id84155
push userbmo:oriol-bugzilla@hotmail.com
push dateThu, 12 Oct 2017 11:59:26 +0000
bugs1407026
milestone58.0a1
Bug 1407026 - Fix CPOW class mistake in the console. MozReview-Commit-ID: 3Mk2kclTReX
devtools/client/webconsole/new-console-output/test/mochitest/browser_console.js
devtools/client/webconsole/test/browser_console.js
devtools/server/actors/object.js
--- 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") {