bug 1570378: remote: avoid URI terminology r=remote-protocol-reviewers,jdescottes
☠☠ backed out by 4f81a4f40f88 ☠ ☠
authorAndreas Tolfsen <ato@sny.no>
Fri, 02 Aug 2019 16:28:42 +0000
changeset 486162 adb3dec1090b16e0acd3792c5a4dc1e2a6401c3f
parent 486161 28f189acbe032952ecf7200004e56e1135da825a
child 486163 412894c27fa28f945f0f364bb5aeab28e673830b
push id36391
push usermalexandru@mozilla.com
push dateMon, 05 Aug 2019 15:55:27 +0000
treeherdermozilla-central@9c91b33629b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersremote-protocol-reviewers, jdescottes
bugs1570378
milestone70.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 1570378: remote: avoid URI terminology r=remote-protocol-reviewers,jdescottes Per the URL standard, we should avoid talking about URIs (and indeed URI, URN, et al.) since the term only serves to mislead. Differential Revision: https://phabricator.services.mozilla.com/D40215
remote/test/browser/browser_input_dispatchKeyEvent.js
remote/test/browser/browser_input_dispatchKeyEvent_race.js
remote/test/browser/browser_input_dispatchMouseEvent.js
remote/test/browser/browser_network_requestWillBeSent.js
remote/test/browser/browser_page_bringToFront.js
remote/test/browser/browser_page_frameNavigated.js
remote/test/browser/browser_page_frameNavigated_iframe.js
remote/test/browser/browser_page_runtime_events.js
remote/test/browser/browser_runtime_callFunctionOn.js
remote/test/browser/browser_runtime_executionContext.js
remote/test/browser/browser_runtime_get_properties.js
remote/test/browser/browser_runtime_remote_objects.js
remote/test/browser/head.js
--- a/remote/test/browser/browser_input_dispatchKeyEvent.js
+++ b/remote/test/browser/browser_input_dispatchKeyEvent.js
@@ -30,17 +30,17 @@ add_task(async function() {
   info("Enable selectionchange events on input elements");
   await new Promise(resolve => {
     const options = {
       set: [["dom.select_events.textcontrols.enabled", true]],
     };
     SpecialPowers.pushPrefEnv(options, resolve);
   });
 
-  const { client, tab } = await setupTestForUri(toDataURL("<input>"));
+  const { client, tab } = await setupForURL(toDataURL("<input>"));
   is(gBrowser.selectedTab, tab, "Selected tab is the target tab");
 
   const { Input } = client;
 
   info("Focus the input on the page");
   await ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
     const input = content.document.querySelector("input");
     input.focus();
--- a/remote/test/browser/browser_input_dispatchKeyEvent_race.js
+++ b/remote/test/browser/browser_input_dispatchKeyEvent_race.js
@@ -21,21 +21,21 @@
 //
 // In order for this to work, we need to be sure that `await Input.dispatchKeyEvent`
 // resolves only after the content page flushed the event handlers (and
 // `window.myVariable = "newValue"` was executed).
 //
 // This can be racy because Input.dispatchKeyEvent and window.myVariable = "newValue" run
 // in different processes.
 
-const PAGE_URI =
+const PAGE_URL =
   "http://example.com/browser/remote/test/browser/doc_input_dispatchKeyEvent_race.html";
 
 add_task(async function() {
-  const { client, tab } = await setupTestForUri(PAGE_URI);
+  const { client, tab } = await setupForURL(PAGE_URL);
   is(gBrowser.selectedTab, tab, "Selected tab is the target tab");
 
   const { Input, Runtime } = client;
 
   // Need an enabled Runtime domain to run evaluate.
   info("Enable the Runtime domain");
   await Runtime.enable();
   const { context } = await Runtime.executionContextCreated();
--- a/remote/test/browser/browser_input_dispatchMouseEvent.js
+++ b/remote/test/browser/browser_input_dispatchMouseEvent.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 add_task(async function testDispatchMouseEvent() {
-  const { client, tab } = await setupTestForUri(toDataURL("<div>foo</div>"));
+  const { client, tab } = await setupForURL(toDataURL("<div>foo</div>"));
 
   const { Input } = client;
 
   await ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
     const div = content.document.querySelector("div");
     this.mouseDownPromise = new Promise(resolve => {
       div.addEventListener("mousedown", resolve, { once: true });
     });
--- a/remote/test/browser/browser_network_requestWillBeSent.js
+++ b/remote/test/browser/browser_network_requestWillBeSent.js
@@ -1,53 +1,53 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test the Network.requestWillBeSent event
 
-const PAGE_URI =
+const PAGE_URL =
   "http://example.com/browser/remote/test/browser/doc_network_requestWillBeSent.html";
-const JS_URI =
+const JS_URL =
   "http://example.com/browser/remote/test/browser/file_network_requestWillBeSent.js";
 
 add_task(async function() {
-  const { client } = await setupTestForUri(toDataURL("default-test-page"));
+  const { client } = await setupForURL(toDataURL("default-test-page"));
 
   const { Page, Network } = client;
 
   await Network.enable();
   ok(true, "Network domain has been enabled");
 
   let requests = 0;
   const onRequests = new Promise(resolve => {
     Network.requestWillBeSent(event => {
       ok(true, "Received a request");
       switch (++requests) {
         case 1:
-          is(event.request.url, PAGE_URI, "Got the page request");
+          is(event.request.url, PAGE_URL, "Got the page request");
           is(event.type, "Document", "The page request has 'Document' type");
           is(
             event.requestId,
             event.loaderId,
             "The page request has requestId = loaderId (puppeteer assumes that to detect the page start request)"
           );
           break;
         case 2:
-          is(event.request.url, JS_URI, "Got the JS request");
+          is(event.request.url, JS_URL, "Got the JS request");
           resolve();
           break;
         case 3:
           ok(false, "Expect only two requests");
       }
     });
   });
 
-  const { frameId } = await Page.navigate({ url: PAGE_URI });
+  const { frameId } = await Page.navigate({ url: PAGE_URL });
   ok(frameId, "Page.navigate returned a frameId");
 
   info("Wait for Network.requestWillBeSent events");
   await onRequests;
 
   await client.close();
   ok(true, "The client is closed");
 
--- a/remote/test/browser/browser_page_bringToFront.js
+++ b/remote/test/browser/browser_page_bringToFront.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const FIRST_DOC = toDataURL("first");
 const SECOND_DOC = toDataURL("second");
 
 add_task(async function testBringToFrontUpdatesSelectedTab() {
-  const { client, tab } = await setupTestForUri(FIRST_DOC);
+  const { client, tab } = await setupForURL(FIRST_DOC);
   is(gBrowser.selectedTab, tab, "Selected tab is the target tab");
 
   info("Open another tab that should become the front tab");
   const otherTab = await BrowserTestUtils.openNewForegroundTab(
     gBrowser,
     SECOND_DOC
   );
   is(gBrowser.selectedTab, otherTab, "Selected tab is now the new tab");
@@ -30,17 +30,17 @@ add_task(async function testBringToFront
 
   BrowserTestUtils.removeTab(tab);
   BrowserTestUtils.removeTab(otherTab);
 
   await RemoteAgent.close();
 });
 
 add_task(async function testBringToFrontUpdatesFocusedWindow() {
-  const { client, tab } = await setupTestForUri(FIRST_DOC);
+  const { client, tab } = await setupForURL(FIRST_DOC);
   is(gBrowser.selectedTab, tab, "Selected tab is the target tab");
 
   is(tab.ownerGlobal, getFocusedNavigator(), "The initial window is focused");
 
   const otherWindow = await BrowserTestUtils.openNewBrowserWindow();
   is(otherWindow, getFocusedNavigator(), "The new window is focused");
 
   const { Page } = client;
--- a/remote/test/browser/browser_page_frameNavigated.js
+++ b/remote/test/browser/browser_page_frameNavigated.js
@@ -6,17 +6,17 @@
 // Test the Page navigation events
 
 const TEST_DOC = toDataURL("default-test-page");
 
 const promises = new Set();
 const resolutions = new Map();
 
 add_task(async function() {
-  const { client } = await setupTestForUri(TEST_DOC);
+  const { client } = await setupForURL(TEST_DOC);
 
   const { Page } = client;
 
   // turn on navigation related events, such as DOMContentLoaded et al.
   await Page.enable();
   ok(true, "Page domain has been enabled");
 
   const { frameTree } = await Page.getFrameTree();
--- a/remote/test/browser/browser_page_frameNavigated_iframe.js
+++ b/remote/test/browser/browser_page_frameNavigated_iframe.js
@@ -7,17 +7,17 @@
 
 const PAGE_URL =
   "http://example.com/browser/remote/test/browser/doc_page_frameNavigated_iframe.html";
 
 const promises = new Set();
 const resolutions = new Map();
 
 add_task(async function() {
-  const { client } = await setupTestForUri(toDataURL("default-test-page"));
+  const { client } = await setupForURL(toDataURL("default-test-page"));
 
   const { Page } = client;
   await Page.enable();
 
   // Store all frameNavigated events in an array
   const frameNavigatedEvents = [];
   Page.frameNavigated(e => frameNavigatedEvents.push(e));
 
--- a/remote/test/browser/browser_page_runtime_events.js
+++ b/remote/test/browser/browser_page_runtime_events.js
@@ -6,17 +6,17 @@
 /* global getCDP */
 
 // Assert the order of Runtime.executionContextDestroyed,
 // Page.frameNavigated, and Runtime.executionContextCreated
 
 const TEST_DOC = toDataURL("default-test-page");
 
 add_task(async function testCDP() {
-  const { client } = await setupTestForUri(TEST_DOC);
+  const { client } = await setupForURL(TEST_DOC);
   const { Page, Runtime } = client;
 
   const events = [];
   function assertReceivedEvents(expected, message) {
     Assert.deepEqual(events, expected, message);
     // Empty the list of received events
     events.splice(0);
   }
--- a/remote/test/browser/browser_runtime_callFunctionOn.js
+++ b/remote/test/browser/browser_runtime_callFunctionOn.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test the Runtime.callFunctionOn
 // See also browser_runtime_evaluate, which covers basic usages of this method.
 
 add_task(async function() {
-  const { client } = await setupTestForUri(toDataURL(""));
+  const { client } = await setupForURL(toDataURL(""));
 
   const firstContext = await testRuntimeEnable(client);
   const contextId = firstContext.id;
   await testObjectReferences(client, contextId);
   await testExceptions(client, contextId);
   await testReturnByValue(client, contextId);
   await testAwaitPromise(client, contextId);
   await testObjectId(client, contextId);
--- a/remote/test/browser/browser_runtime_executionContext.js
+++ b/remote/test/browser/browser_runtime_executionContext.js
@@ -3,17 +3,17 @@
 
 "use strict";
 
 // Test the Runtime execution context events
 
 const TEST_DOC = toDataURL("default-test-page");
 
 add_task(async function() {
-  const { client } = await setupTestForUri(TEST_DOC);
+  const { client } = await setupForURL(TEST_DOC);
 
   const firstContext = await testRuntimeEnable(client);
   await testEvaluate(client, firstContext);
   const secondContext = await testNavigate(client, firstContext);
   await testNavigateBack(client, firstContext, secondContext);
   const thirdContext = await testNavigateViaLocation(client, firstContext);
   await testReload(client, thirdContext);
 
--- a/remote/test/browser/browser_runtime_get_properties.js
+++ b/remote/test/browser/browser_runtime_get_properties.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test the Runtime remote object
 
 add_task(async function() {
-  const { client } = await setupTestForUri(toDataURL(""));
+  const { client } = await setupForURL(toDataURL(""));
 
   const firstContext = await testRuntimeEnable(client);
   const contextId = firstContext.id;
 
   await testGetOwnSimpleProperties(client, contextId);
   await testGetCustomProperty(client, contextId);
   await testGetPrototypeProperties(client, contextId);
   await testGetGetterSetterProperties(client, contextId);
--- a/remote/test/browser/browser_runtime_remote_objects.js
+++ b/remote/test/browser/browser_runtime_remote_objects.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test the Runtime remote object
 
 add_task(async function() {
-  const { client } = await setupTestForUri(toDataURL(""));
+  const { client } = await setupForURL(toDataURL(""));
 
   const firstContext = await testRuntimeEnable(client);
   const contextId = firstContext.id;
 
   await testObjectRelease(client, contextId);
 
   await client.close();
   ok(true, "The client is closed");
--- a/remote/test/browser/head.js
+++ b/remote/test/browser/head.js
@@ -97,39 +97,34 @@ function getTargets(CDP) {
         return;
       }
       resolve(targets);
     });
   });
 }
 
 /**
- * Create a new tab for the provided uri and start a CDP server debugging the
- * created tab.
+ * Set up test environment by starting the remote agent, connecting
+ * the CDP client over loopback, and creating a fresh tab to avoid
+ * state bleedover from previous test.
  */
-async function setupTestForUri(uri) {
-  // Open a test page, to prevent debugging the random default page
-  const tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, uri);
+async function setupForURL(url) {
+  const tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
 
-  // Start the CDP server
   await RemoteAgent.listen(Services.io.newURI("http://localhost:9222"));
-
-  // Retrieve the chrome-remote-interface library object
   const CDP = await getCDP();
 
-  // Connect to the server
   const client = await CDP({
     target(list) {
-      // Ensure debugging the right target, i.e. the one for our test tab.
-      return list.find(target => {
-        return target.url == uri;
-      });
+      // ensure we are debugging the right target, i.e. the requested URL
+      return list.find(target => target.url == url);
     },
   });
-  ok(true, "CDP client has been instantiated");
+  info("CDP client instantiated");
+
   return { client, tab };
 }
 
 /** Creates a data URL for the given source document. */
 function toDataURL(src, doctype = "html") {
   let doc, mime;
   switch (doctype) {
     case "html":