Bug 1485660 - Adapt TabClient API to protocol one. r=jdescottes
authorAlexandre Poirot <poirot.alex@gmail.com>
Mon, 15 Oct 2018 08:36:12 +0000
changeset 499699 09ff21b58c0bb6f9bf69c67823c45de790b40f9e
parent 499698 8cf41a5970be7b559c9df821bd5cba3fd3cfad9c
child 499700 4ac958d94290160ed534261ec799b8a86f302029
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1485660
milestone64.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 1485660 - Adapt TabClient API to protocol one. r=jdescottes MozReview-Commit-ID: 1dC5opkgLcQ Depends on D7459 Differential Revision: https://phabricator.services.mozilla.com/D8066
devtools/client/accessibility/test/browser/head.js
devtools/client/application/test/head.js
devtools/client/canvasdebugger/test/head.js
devtools/client/debugger/new/src/client/firefox/commands.js
devtools/client/debugger/new/test/mochitest/browser_dbg-inline-cache.js
devtools/client/debugger/test/mochitest/head.js
devtools/client/framework/target.js
devtools/client/framework/toolbox-options.js
devtools/client/framework/toolbox.js
devtools/client/inspector/test/browser_inspector_startup.js
devtools/client/inspector/test/head.js
devtools/client/netmonitor/src/connector/firefox-connector.js
devtools/client/netmonitor/test/head.js
devtools/client/shadereditor/test/head.js
devtools/client/webaudioeditor/test/head.js
--- a/devtools/client/accessibility/test/browser/head.js
+++ b/devtools/client/accessibility/test/browser/head.js
@@ -403,11 +403,11 @@ function reload(target, waitForTargetEve
 
 /**
  * Navigate to a new URL within the panel target.
  * @param  {Object} target             Panel target.
  * @param  {Srting} url                URL to navigate to.
  * @param  {String} waitForTargetEvent Event to wait for after reload.
  */
 function navigate(target, url, waitForTargetEvent = "navigate") {
-  executeSoon(() => target.activeTab.navigateTo(url));
+  executeSoon(() => target.activeTab.navigateTo({ url }));
   return once(target, waitForTargetEvent);
 }
--- a/devtools/client/application/test/head.js
+++ b/devtools/client/application/test/head.js
@@ -36,17 +36,17 @@ async function enableApplicationPanel() 
   await pushPref("devtools.application.enabled", true);
 }
 
 function getWorkerContainers(doc) {
   return doc.querySelectorAll(".js-sw-container");
 }
 
 function navigate(target, url, waitForTargetEvent = "navigate") {
-  executeSoon(() => target.activeTab.navigateTo(url));
+  executeSoon(() => target.activeTab.navigateTo({ url }));
   return once(target, waitForTargetEvent);
 }
 
 async function openNewTabAndApplicationPanel(url) {
   const tab = await addTab(url);
   const target = await TargetFactory.forTab(tab);
 
   const toolbox = await gDevTools.showToolbox(target, "application");
--- a/devtools/client/canvasdebugger/test/head.js
+++ b/devtools/client/canvasdebugger/test/head.js
@@ -102,17 +102,17 @@ function isTestingSupported() {
 }
 
 function navigateInHistory(aTarget, aDirection, aWaitForTargetEvent = "navigate") {
   executeSoon(() => content.history[aDirection]());
   return once(aTarget, aWaitForTargetEvent);
 }
 
 function navigate(aTarget, aUrl, aWaitForTargetEvent = "navigate") {
-  executeSoon(() => aTarget.activeTab.navigateTo(aUrl));
+  executeSoon(() => aTarget.activeTab.navigateTo({ url: aUrl }));
   return once(aTarget, aWaitForTargetEvent);
 }
 
 function reload(aTarget, aWaitForTargetEvent = "navigate") {
   executeSoon(() => aTarget.activeTab.reload());
   return once(aTarget, aWaitForTargetEvent);
 }
 
--- a/devtools/client/debugger/new/src/client/firefox/commands.js
+++ b/devtools/client/debugger/new/src/client/firefox/commands.js
@@ -242,17 +242,17 @@ function debuggeeCommand(script) {
   request.emit("json-reply", {});
 
   debuggerClient._activeRequests.delete(consoleActor);
 
   return Promise.resolve();
 }
 
 function navigate(url) {
-  return tabTarget.activeTab.navigateTo(url);
+  return tabTarget.activeTab.navigateTo({ url });
 }
 
 function reload() {
   return tabTarget.activeTab.reload();
 }
 
 function getProperties(grip) {
   const objClient = threadClient.pauseGrip(grip);
@@ -450,9 +450,9 @@ const clientCommands = {
   disablePrettyPrint,
   fetchSources,
   fetchWorkers,
   sendPacket,
   setPausePoints,
   setSkipPausing
 };
 exports.setupCommands = setupCommands;
-exports.clientCommands = clientCommands;
\ No newline at end of file
+exports.clientCommands = clientCommands;
--- a/devtools/client/debugger/new/test/mochitest/browser_dbg-inline-cache.js
+++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-inline-cache.js
@@ -71,17 +71,17 @@ add_task(async function() {
   let dbgValue = await findSource(dbg, "inline-cache.html");
   info(`Debugger text: ${dbgValue.text}`);
   ok(
     dbgValue.text.includes(pageValue),
     "Debugger loads from cache, gets value 1 like page"
   );
 
   info("Disable HTTP cache for page");
-  await toolbox.target.activeTab.reconfigure({ cacheDisabled: true });
+  await toolbox.target.activeTab.reconfigure({ options: { cacheDisabled: true } });
   makeChanges();
 
   info("Reload inside debugger with toolbox caching disabled (attempt 1)");
   await reloadTabAndDebugger(tab, dbg);
   pageValue = await getPageValue(tab);
   is(pageValue, "let x = 2;", "Content loads from network, has doc value 2");
   await waitForLoadedSource(dbg, "inline-cache.html");
   dbgValue = await findSource(dbg, "inline-cache.html");
@@ -101,17 +101,17 @@ add_task(async function() {
   dbgValue = await findSource(dbg, "inline-cache.html");
   info(`Debugger text: ${dbgValue.text}`);
   ok(
     dbgValue.text.includes(pageValue),
     "Debugger loads from network, gets value 3 like page"
   );
 
   info("Enable HTTP cache for page");
-  await toolbox.target.activeTab.reconfigure({ cacheDisabled: false });
+  await toolbox.target.activeTab.reconfigure({ options: { cacheDisabled: false } });
   makeChanges();
 
   // Even though the HTTP cache is now enabled, Gecko sets the VALIDATE_ALWAYS flag when
   // reloading the page.  So, it will always make a request to the server for the main
   // document contents.
 
   info("Reload inside debugger with toolbox caching enabled (attempt 1)");
   await reloadTabAndDebugger(tab, dbg);
--- a/devtools/client/debugger/test/mochitest/head.js
+++ b/devtools/client/debugger/test/mochitest/head.js
@@ -445,17 +445,17 @@ function ensureThreadClientState(aPanel,
     return promise.resolve(null);
   } else {
     return waitForThreadEvents(aPanel, aState);
   }
 }
 
 function reload(aPanel, aUrl) {
   let activeTab = aPanel.panelWin.DebuggerController._target.activeTab;
-  aUrl ? activeTab.navigateTo(aUrl) : activeTab.reload();
+  aUrl ? activeTab.navigateTo({ url: aUrl }) : activeTab.reload();
 }
 
 function navigateActiveTabTo(aPanel, aUrl, aWaitForEventName, aEventRepeat) {
   let finished = waitForDebuggerEvents(aPanel, aWaitForEventName, aEventRepeat);
   reload(aPanel, aUrl);
   return finished;
 }
 
--- a/devtools/client/framework/target.js
+++ b/devtools/client/framework/target.js
@@ -823,32 +823,32 @@ TabTarget.prototype = {
    * @param {String} text
    *                 The text to log.
    * @param {String} category
    *                 The category of the message.  @see nsIScriptError.
    */
   logErrorInPage: function(text, category) {
     if (this.activeTab && this.activeTab.traits.logInPage) {
       const errorFlag = 0;
-      this.activeTab.logInPage(text, category, errorFlag);
+      this.activeTab.logInPage({ text, category, flags: errorFlag });
     }
   },
 
   /**
    * Log a warning of some kind to the tab's console.
    *
    * @param {String} text
    *                 The text to log.
    * @param {String} category
    *                 The category of the message.  @see nsIScriptError.
    */
   logWarningInPage: function(text, category) {
     if (this.activeTab && this.activeTab.traits.logInPage) {
       const warningFlag = 1;
-      this.activeTab.logInPage(text, category, warningFlag);
+      this.activeTab.logInPage({ text, category, flags: warningFlag });
     }
   },
 };
 
 function WorkerTarget(workerClient) {
   EventEmitter.decorate(this);
   this._workerClient = workerClient;
 }
--- a/devtools/client/framework/toolbox-options.js
+++ b/devtools/client/framework/toolbox-options.js
@@ -507,17 +507,17 @@ OptionsPanel.prototype = {
    */
   _disableJSClicked: function(event) {
     const checked = event.target.checked;
 
     const options = {
       "javascriptEnabled": !checked
     };
 
-    this.target.activeTab.reconfigure(options);
+    this.target.activeTab.reconfigure({ options });
   },
 
   destroy: function() {
     if (this.destroyed) {
       return;
     }
     this.destroyed = true;
 
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -1339,32 +1339,38 @@ Toolbox.prototype = {
    * Apply the current cache setting from devtools.cache.disabled to this
    * toolbox's tab.
    */
   _applyCacheSettings: function() {
     const pref = "devtools.cache.disabled";
     const cacheDisabled = Services.prefs.getBoolPref(pref);
 
     if (this.target.activeTab) {
-      this.target.activeTab.reconfigure({"cacheDisabled": cacheDisabled});
+      this.target.activeTab.reconfigure({
+        options: {
+          "cacheDisabled": cacheDisabled
+        }
+      });
     }
   },
 
   /**
    * Apply the current service workers testing setting from
    * devtools.serviceWorkers.testing.enabled to this toolbox's tab.
    */
   _applyServiceWorkersTestingSettings: function() {
     const pref = "devtools.serviceWorkers.testing.enabled";
     const serviceWorkersTestingEnabled =
       Services.prefs.getBoolPref(pref) || false;
 
     if (this.target.activeTab) {
       this.target.activeTab.reconfigure({
-        "serviceWorkersTestingEnabled": serviceWorkersTestingEnabled
+        options: {
+          "serviceWorkersTestingEnabled": serviceWorkersTestingEnabled
+        }
       });
     }
   },
 
   /**
    * Update the visibility of the buttons.
    */
   updateToolboxButtonsVisibility() {
@@ -1400,17 +1406,21 @@ Toolbox.prototype = {
    */
   togglePaintFlashing: function() {
     if (this.isPaintFlashing) {
       this.telemetry.toolOpened("paintflashing", this.sessionId, this);
     } else {
       this.telemetry.toolClosed("paintflashing", this.sessionId, this);
     }
     this.isPaintFlashing = !this.isPaintFlashing;
-    return this.target.activeTab.reconfigure({"paintFlashing": this.isPaintFlashing});
+    return this.target.activeTab.reconfigure({
+      options: {
+        "paintFlashing": this.isPaintFlashing
+      }
+    });
   },
 
   /**
    * Visually update picker button.
    * This function is called on every "select" event. Newly selected panel can
    * update the visual state of the picker button such as disabled state,
    * additional CSS classes (className), and tooltip (description).
    */
--- a/devtools/client/inspector/test/browser_inspector_startup.js
+++ b/devtools/client/inspector/test/browser_inspector_startup.js
@@ -37,17 +37,17 @@ add_task(async function() {
   const domContentLoaded = waitForLinkedBrowserEvent(tab, "DOMContentLoaded");
   const pageLoaded = waitForLinkedBrowserEvent(tab, "load");
 
   const markupLoaded = inspector.once("markuploaded");
   const onRequest = onPageResourceRequest();
 
   info("Navigate to the slow loading page");
   const activeTab = inspector.toolbox.target.activeTab;
-  await activeTab.navigateTo(TEST_URL);
+  await activeTab.navigateTo({ url: TEST_URL });
 
   info("Wait for request made to the image");
   const response = await onRequest;
 
   // The request made to the image shouldn't block the DOMContentLoaded event
   info("Wait for DOMContentLoaded");
   await domContentLoaded;
 
--- a/devtools/client/inspector/test/head.js
+++ b/devtools/client/inspector/test/head.js
@@ -43,17 +43,17 @@ registerCleanupFunction(function() {
 
 var navigateTo = async function(inspector, url) {
   const markuploaded = inspector.once("markuploaded");
   const onNewRoot = inspector.once("new-root");
   const onUpdated = inspector.once("inspector-updated");
 
   info("Navigating to: " + url);
   const activeTab = inspector.toolbox.target.activeTab;
-  await activeTab.navigateTo(url);
+  await activeTab.navigateTo({ url });
 
   info("Waiting for markup view to load after navigation.");
   await markuploaded;
 
   info("Waiting for new root.");
   await onNewRoot;
 
   info("Waiting for inspector to update after new-root event.");
--- a/devtools/client/netmonitor/src/connector/firefox-connector.js
+++ b/devtools/client/netmonitor/src/connector/firefox-connector.js
@@ -311,17 +311,17 @@ class FirefoxConnector {
             resolve();
           });
         });
       });
     };
 
     // Reconfigures the tab, optionally triggering a reload.
     const reconfigureTab = options => {
-      return this.tabTarget.activeTab.reconfigure(options);
+      return this.tabTarget.activeTab.reconfigure({ options });
     };
 
     // Reconfigures the tab and waits for the target to finish navigating.
     const reconfigureTabAndWaitForNavigation = (options) => {
       options.performReload = true;
       const navigationFinished = waitForNavigation();
       return reconfigureTab(options).then(() => navigationFinished);
     };
--- a/devtools/client/netmonitor/test/head.js
+++ b/devtools/client/netmonitor/test/head.js
@@ -139,17 +139,17 @@ function waitForNavigation(target) {
 
 function toggleCache(target, disabled) {
   const options = { cacheDisabled: disabled, performReload: true };
   const navigationFinished = waitForNavigation(target);
 
   // Disable the cache for any toolbox that it is opened from this point on.
   Services.prefs.setBoolPref("devtools.cache.disabled", disabled);
 
-  return target.activeTab.reconfigure(options).then(() => navigationFinished);
+  return target.activeTab.reconfigure({ options }).then(() => navigationFinished);
 }
 
 /**
  * Wait for 2 markers during document load.
  */
 function waitForTimelineMarkers(monitor) {
   return new Promise(resolve => {
     const markers = [];
--- a/devtools/client/shadereditor/test/head.js
+++ b/devtools/client/shadereditor/test/head.js
@@ -126,17 +126,17 @@ function navigateInHistory(aTarget, aDir
     mm.sendAsyncMessage("devtools:test:history", { direction: aDirection });
   } else {
     executeSoon(() => content.history[aDirection]());
   }
   return once(aTarget, aWaitForTargetEvent);
 }
 
 function navigate(aTarget, aUrl, aWaitForTargetEvent = "navigate") {
-  executeSoon(() => aTarget.activeTab.navigateTo(aUrl));
+  executeSoon(() => aTarget.activeTab.navigateTo({ url: aUrl }));
   return once(aTarget, aWaitForTargetEvent);
 }
 
 function reload(aTarget, aWaitForTargetEvent = "navigate") {
   executeSoon(() => aTarget.activeTab.reload());
   return once(aTarget, aWaitForTargetEvent);
 }
 
--- a/devtools/client/webaudioeditor/test/head.js
+++ b/devtools/client/webaudioeditor/test/head.js
@@ -43,17 +43,17 @@ registerCleanupFunction(() => {
 });
 
 function reload(aTarget, aWaitForTargetEvent = "navigate") {
   aTarget.activeTab.reload();
   return once(aTarget, aWaitForTargetEvent);
 }
 
 function navigate(aTarget, aUrl, aWaitForTargetEvent = "navigate") {
-  executeSoon(() => aTarget.activeTab.navigateTo(aUrl));
+  executeSoon(() => aTarget.activeTab.navigateTo({ url: aUrl }));
   return once(aTarget, aWaitForTargetEvent);
 }
 
 /**
  * Adds a new tab, and instantiate a WebAudiFront object.
  * This requires calling removeTab before the test ends.
  */
 function initBackend(aUrl) {