Bug 1509315 - Make the console test helper use getTab instead of listTabs. r=yulia
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 27 Nov 2018 21:48:12 +0000
changeset 507609 5e887c4ebd791fc491977bdc0ee8fc787f46b33a
parent 507608 30bc5b0c60ebfe0444530fa9af86c5c8d5498ecd
child 507610 d476f054342f039445afddff474f4c8b4d9edea2
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyulia
bugs1509315
milestone65.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 1509315 - Make the console test helper use getTab instead of listTabs. r=yulia Ideally, it would use TargetFactory. But as that's mochitest chrome, we don't have natural access to gBrowser/firefox tab. MozReview-Commit-ID: 4nrfFZu6jAU Depends on D12734 Differential Revision: https://phabricator.services.mozilla.com/D12735
devtools/shared/webconsole/test/common.js
--- a/devtools/shared/webconsole/test/common.js
+++ b/devtools/shared/webconsole/test/common.js
@@ -65,35 +65,34 @@ var _attachConsole = async function(
     // Fetch the console actor out of the expected target
     // ParentProcessTarget / WorkerTarget / FrameTarget
     let consoleActor, worker;
     if (!attachToTab) {
       const front = await client.mainRoot.getMainProcess();
       await front.attach();
       consoleActor = front.targetForm.consoleActor;
     } else {
-      const response = await client.listTabs();
-      const tab = response.tabs[response.selected];
-      const [, targetFront] = await client.attachTarget(tab.actor);
+      const form = await client.getTab();
+      const [, targetFront] = await client.attachTarget(form.tab);
       if (attachToWorker) {
         const workerName = "console-test-worker.js#" + new Date().getTime();
         worker = new Worker(workerName);
         await waitForMessage(worker);
 
         const { workers } = await targetFront.listWorkers();
         const workerTargetFront = workers.filter(w => w.url == workerName)[0];
         if (!workerTargetFront) {
           console.error("listWorkers failed. Unable to find the worker actor\n");
           return null;
         }
         await workerTargetFront.attach();
         await workerTargetFront.attachThread({});
         consoleActor = workerTargetFront.targetForm.consoleActor;
       } else {
-        consoleActor = tab.consoleActor;
+        consoleActor = targetFront.targetForm.consoleActor;
       }
     }
 
     // Instantiate the WebConsoleClient
     const [ response, webConsoleClient ] = await client.attachConsole(consoleActor,
       listeners);
     return {
       state: {
@@ -103,17 +102,18 @@ var _attachConsole = async function(
         // Keep a strong reference to the Worker to avoid it being
         // GCd during the test (bug 1237492).
         // eslint-disable-next-line camelcase
         _worker_ref: worker,
       },
       response,
     };
   } catch (error) {
-    console.error(`attachConsole failed: ${error.error} ${error.message}`);
+    console.error(`attachConsole failed: ${error.error} ${error.message} - ` +
+                  error.stack);
   }
   return null;
 };
 
 function closeDebugger(state, callback) {
   const onClose = state.dbgClient.close();
 
   state.dbgClient = null;