Bug 1570279 - Reenable accidentally disabled checks in test_objectgrips-17.js. r=ochameau, a=test-only
authorOriol Brufau <oriol-bugzilla@hotmail.com>
Wed, 31 Jul 2019 17:25:15 +0300
changeset 545086 445433a1de44c9608e93d3e9fc96bc65c2b91104
parent 545085 e03d6f4298dac674c86997ad1191f3e3321e8592
child 545087 784bd1c95abe7086fa5f5f22cde6ec566b4a22cb
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau, test-only
bugs1570279
milestone69.0
Bug 1570279 - Reenable accidentally disabled checks in test_objectgrips-17.js. r=ochameau, a=test-only Differential Revision: https://phabricator.services.mozilla.com//D40022
devtools/server/tests/unit/head_dbg.js
devtools/server/tests/unit/test_objectgrips-17.js
--- a/devtools/server/tests/unit/head_dbg.js
+++ b/devtools/server/tests/unit/head_dbg.js
@@ -920,34 +920,38 @@ async function setupTestFromUrl(url) {
  *           principals by default.
  *        - ThreadClient threadClient
  *          A reference to a ThreadClient instance that is attached to the debuggee.
  *        - DebuggerClient client
  *          A reference to the DebuggerClient used to communicated with the RDP server.
  * @param Object options
  *        Optional arguments to tweak test environment
  *        - JSPrincipal principal
- *          Principal to use for the debuggee.
+ *          Principal to use for the debuggee. Defaults to systemPrincipal.
  *        - boolean doNotRunWorker
- *          If true, do not run this tests in worker debugger context.
+ *          If true, do not run this tests in worker debugger context. Defaults to false.
+ *        - bool wantXrays
+ *          Whether the debuggee wants Xray vision with respect to same-origin objects
+ *          outside the sandbox. Defaults to true.
  */
 function threadClientTest(test, options = {}) {
-  let { principal, doNotRunWorker } = options;
-  if (!principal) {
-    principal = systemPrincipal;
-  }
+  const {
+    principal = systemPrincipal,
+    doNotRunWorker = false,
+    wantXrays = true,
+  } = options;
 
   async function runThreadClientTestWithServer(server, test) {
     // Setup a server and connect a client to it.
     initTestDebuggerServer(server);
 
     // Create a custom debuggee and register it to the server.
     // We are using a custom Sandbox as debuggee. Create a new zone because
     // debugger and debuggee must be in different compartments.
-    const debuggee = Cu.Sandbox(principal, { freshZone: true });
+    const debuggee = Cu.Sandbox(principal, { freshZone: true, wantXrays });
     const scriptName = "debuggee.js";
     debuggee.__name = scriptName;
     server.addTestGlobal(debuggee);
 
     const client = new DebuggerClient(server.connectPipe());
     await client.connect();
 
     // Attach to the fake tab target and retrieve the ThreadClient instance.
--- a/devtools/server/tests/unit/test_objectgrips-17.js
+++ b/devtools/server/tests/unit/test_objectgrips-17.js
@@ -294,17 +294,17 @@ async function run_tests_in_principal(
   await testPrincipal(options, undefined, debuggeeHasXrays);
 
   // Test objects created in a system principal new global.
   await testPrincipal(options, systemPrincipal, debuggeeHasXrays);
 
   // Test objects created in a cross-origin null principal new global.
   await testPrincipal(options, null, debuggeeHasXrays);
 
-  if (debuggeePrincipal === null) {
+  if (debuggeePrincipal.isNullPrincipal) {
     // Test objects created in a same-origin null principal new global.
     await testPrincipal(
       options,
       Cu.getObjectPrincipal(debuggee),
       debuggeeHasXrays
     );
   }
 }