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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Tolfsen 2019-08-02 16:28:42 +00:00
parent ebaff7b547
commit c0923e6186
13 changed files with 28 additions and 33 deletions

View File

@ -35,7 +35,7 @@ add_task(async function() {
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;

View File

@ -26,11 +26,11 @@
// 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;

View File

@ -4,7 +4,7 @@
"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;

View File

@ -5,13 +5,13 @@
// 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;
@ -24,7 +24,7 @@ add_task(async function() {
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,
@ -33,7 +33,7 @@ add_task(async function() {
);
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:
@ -42,7 +42,7 @@ add_task(async function() {
});
});
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");

View File

@ -7,7 +7,7 @@ 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");
@ -35,7 +35,7 @@ add_task(async function testBringToFrontUpdatesSelectedTab() {
});
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");

View File

@ -11,7 +11,7 @@ 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;

View File

@ -12,7 +12,7 @@ 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();

View File

@ -11,7 +11,7 @@
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 = [];

View File

@ -7,7 +7,7 @@
// 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;

View File

@ -8,7 +8,7 @@
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);

View File

@ -6,7 +6,7 @@
// 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;

View File

@ -6,7 +6,7 @@
// 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;

View File

@ -102,29 +102,24 @@ function getTargets(CDP) {
}
/**
* 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 };
}