Bug 1407026 - Fix CPOW class mistake in the console. r=nchevobbe
authorOriol Brufau <oriol-bugzilla@hotmail.com>
Tue, 10 Oct 2017 22:37:29 +0200
changeset 385799 aad8340843094c30af196d9c2cbc4a1e803821e2
parent 385798 44d7a43c481ad4fae099feda776776b3185ab14b
child 385800 b526011049eed2b052cb5dc93f7fa14a4f970c0b
push id32668
push userarchaeopteryx@coole-files.de
push dateThu, 12 Oct 2017 21:56:02 +0000
treeherdermozilla-central@46a75c66bb51 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnchevobbe
bugs1407026
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1407026 - Fix CPOW class mistake in the console. r=nchevobbe 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") {