Bug 1734177 - [devtools] Ensure tests within devtools/client/framework are https-first compliant r=bomsy

Update all tests failing with https-first enabled

Differential Revision: https://phabricator.services.mozilla.com/D127560
This commit is contained in:
Julian Descottes 2021-10-07 08:25:20 +00:00
Родитель 3e826f7bd6
Коммит 59e4f57a1c
20 изменённых файлов: 70 добавлений и 57 удалений

Просмотреть файл

@ -18,9 +18,9 @@ PromiseTestUtils.allowMatchingRejectionsGlobally(/this\.worker is null/);
PromiseTestUtils.allowMatchingRejectionsGlobally(/Component not initialized/);
// Empty page
const PAGE_URL = `${URL_ROOT}doc_empty-tab-01.html`;
const JS_URL = `${URL_ROOT}code_binary_search.js`;
const COFFEE_URL = `${URL_ROOT}code_binary_search.coffee`;
const PAGE_URL = `${URL_ROOT_SSL}doc_empty-tab-01.html`;
const JS_URL = `${URL_ROOT_SSL}code_binary_search.js`;
const COFFEE_URL = `${URL_ROOT_SSL}code_binary_search.coffee`;
add_task(async function() {
const toolbox = await openNewTabAndToolbox(PAGE_URL, "jsdebugger");

Просмотреть файл

@ -13,9 +13,9 @@ const { PromiseTestUtils } = ChromeUtils.import(
PromiseTestUtils.allowMatchingRejectionsGlobally(/this\.worker is null/);
// Empty page
const PAGE_URL = `${URL_ROOT}doc_empty-tab-01.html`;
const JS_URL = `${URL_ROOT}code_binary_search_absolute.js`;
const ORIGINAL_URL = `${URL_ROOT}code_binary_search.coffee`;
const PAGE_URL = `${URL_ROOT_SSL}doc_empty-tab-01.html`;
const JS_URL = `${URL_ROOT_SSL}code_binary_search_absolute.js`;
const ORIGINAL_URL = `${URL_ROOT_SSL}code_binary_search.coffee`;
add_task(async function() {
const toolbox = await openNewTabAndToolbox(PAGE_URL, "jsdebugger");

Просмотреть файл

@ -13,7 +13,7 @@ const { PromiseTestUtils } = ChromeUtils.import(
PromiseTestUtils.allowMatchingRejectionsGlobally(/this\.worker is null/);
PromiseTestUtils.allowMatchingRejectionsGlobally(/Component not initialized/);
const TEST_ROOT = "http://example.com/browser/devtools/client/framework/test/";
const TEST_ROOT = "https://example.com/browser/devtools/client/framework/test/";
// Empty page
const PAGE_URL = `${TEST_ROOT}doc_empty-tab-01.html`;
const JS_URL = `${TEST_ROOT}code_inline_bundle.js`;

Просмотреть файл

@ -5,8 +5,8 @@
"use strict";
const PAGE_URL = `${URL_ROOT}doc_empty-tab-01.html`;
const JS_URL = URL_ROOT + "code_bundle_late_script.js";
const PAGE_URL = `${URL_ROOT_SSL}doc_empty-tab-01.html`;
const JS_URL = URL_ROOT_SSL + "code_bundle_late_script.js";
const ORIGINAL_URL = "webpack:///code_late_script.js";

Просмотреть файл

@ -5,9 +5,9 @@
"use strict";
const INITIAL_URL = URL_ROOT + "doc_empty-tab-01.html";
const PAGE_URL = URL_ROOT + "doc_reload.html";
const JS_URL = URL_ROOT + "sjs_code_reload.sjs";
const INITIAL_URL = URL_ROOT_SSL + "doc_empty-tab-01.html";
const PAGE_URL = URL_ROOT_SSL + "doc_reload.html";
const JS_URL = URL_ROOT_SSL + "sjs_code_reload.sjs";
const ORIGINAL_URL_1 = "webpack:///code_reload_1.js";
const ORIGINAL_URL_2 = "webpack:///code_reload_2.js";

Просмотреть файл

@ -9,9 +9,9 @@
*/
const EXAMPLE_COM_URI =
"http://example.com/document-builder.sjs?html=<div id=com>com";
const EXAMPLE_NET_URI =
"http://example.net/document-builder.sjs?html=<div id=net>net";
"https://example.com/document-builder.sjs?html=<div id=com>com";
const EXAMPLE_ORG_URI =
"https://example.org/document-builder.sjs?html=<div id=org>org";
add_task(async function() {
const tab = await addTab(EXAMPLE_COM_URI);
@ -34,14 +34,14 @@ add_task(async function() {
"The toolbox target is also the target associated with the tab descriptor"
);
await navigateTo(EXAMPLE_NET_URI);
await navigateTo(EXAMPLE_ORG_URI);
info("Call list tabs again to update the tab descriptor forms");
await client.mainRoot.listTabs();
is(
decodeURIComponent(tabDescriptor.url),
EXAMPLE_NET_URI,
EXAMPLE_ORG_URI,
"The existing descriptor now points to the new URI"
);
@ -58,7 +58,7 @@ add_task(async function() {
);
ok(
comTabTarget != newTarget,
"With Fission or server side target switching, a new target was created for example.net"
"With Fission or server side target switching, a new target was created for example.org"
);
} else {
is(

Просмотреть файл

@ -6,7 +6,7 @@
// The target front holds resources that happend before ResourceCommand addeed listeners.
// Test whether that feature works correctly or not.
const TEST_URI =
"http://example.com/browser/devtools/client/framework/test/doc_cached-resource.html";
"https://example.com/browser/devtools/client/framework/test/doc_cached-resource.html";
const PARENT_MESSAGE = "Hello from parent";
const CHILD_MESSAGE = "Hello from child";
@ -19,11 +19,11 @@ add_task(async function() {
info("Check the initial messages");
ok(
findMessage(hud, PARENT_MESSAGE),
"Message from parent doument is in console"
"Message from parent document is in console"
);
ok(
findMessage(hud, CHILD_MESSAGE),
"Message from child doument is in console"
"Message from child document is in console"
);
info("Clear the messages");

Просмотреть файл

@ -10,8 +10,8 @@
requestLongerTimeout(3);
const FILENAME = "doc_backward_forward_navigation.html";
const TEST_URI_ORG = `${URL_ROOT_ORG}${FILENAME}`;
const TEST_URI_COM = `${URL_ROOT_COM}${FILENAME}`;
const TEST_URI_ORG = `${URL_ROOT_ORG_SSL}${FILENAME}`;
const TEST_URI_COM = `${URL_ROOT_COM_SSL}${FILENAME}`;
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/debugger/test/mochitest/helpers.js",

Просмотреть файл

@ -4,7 +4,12 @@
"use strict";
// Test for error icon and the error count displayed at right of the
// toolbox toolbar
const TEST_URI = `http://example.org/document-builder.sjs?html=<meta charset=utf8></meta>
// TODO: We currently use mochi.test:8888 to avoid the automatic upgrade to HTTPS
// from https-first. This is because 404 requests in HTTPS from httpd.js are
// incorrectly treated as 200, filed as Bug 1733420. Once this bug is fixed we
// could use a more standard URL, such as https://example.com
const TEST_URI = `http://mochi.test:8888/document-builder.sjs?html=<meta charset=utf8></meta>
<script>
console.error("Cache Error1");
console.exception(false, "Cache Exception");

Просмотреть файл

@ -3,9 +3,9 @@
"use strict";
const EXAMPLE_COM_URI =
"http://example.com/document-builder.sjs?html=<div id=com>com";
const EXAMPLE_NET_URI =
"http://example.net/document-builder.sjs?html=<div id=net>net";
"https://example.com/document-builder.sjs?html=<div id=com>com";
const EXAMPLE_ORG_URI =
"https://example.org/document-builder.sjs?html=<div id=org>org";
add_task(async function() {
info("Test with server side target switching ENABLED");
@ -24,16 +24,16 @@ async function testCase() {
const comNode = await getNodeBySelector(toolbox, "#com");
ok(comNode, "Found node for the COM page");
info("Navigate to the NET page");
await navigateTo(EXAMPLE_NET_URI);
const netNode = await getNodeBySelector(toolbox, "#net");
ok(netNode, "Found node for the NET page");
info("Navigate to the ORG page");
await navigateTo(EXAMPLE_ORG_URI);
const orgNode = await getNodeBySelector(toolbox, "#org");
ok(orgNode, "Found node for the ORG page");
info("Reload the NET page");
await navigateTo(EXAMPLE_NET_URI);
const netNodeAfterReload = await getNodeBySelector(toolbox, "#net");
ok(netNodeAfterReload, "Found node for the NET page after reload");
isnot(netNode, netNodeAfterReload, "The new node is different");
info("Reload the ORG page");
await navigateTo(EXAMPLE_ORG_URI);
const orgNodeAfterReload = await getNodeBySelector(toolbox, "#org");
ok(orgNodeAfterReload, "Found node for the ORG page after reload");
isnot(orgNode, orgNodeAfterReload, "The new node is different");
info("Navigate back to the COM page");
await navigateTo(EXAMPLE_COM_URI);

Просмотреть файл

@ -4,8 +4,12 @@
// Test that enabling Service Workers testing option enables the
// mServiceWorkersTestingEnabled attribute added to nsPIDOMWindow.
// We explicitly want to test that service worker testing allows to use service
// workers on non-https, so we use mochi.test:8888 to avoid the automatic upgrade
// to https when dom.security.https_first is true.
const TEST_URI =
URL_ROOT + "browser_toolbox_options_enable_serviceworkers_testing.html";
URL_ROOT_MOCHI_8888 +
"browser_toolbox_options_enable_serviceworkers_testing.html";
const ELEMENT_ID = "devtools-enable-serviceWorkersTesting";
add_task(async function() {

Просмотреть файл

@ -1,10 +1,10 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const exampleNetDocument = `http://example.net/document-builder.sjs`;
const exampleComDocument = `http://example.com/document-builder.sjs`;
const exampleOrgDocument = `https://example.org/document-builder.sjs`;
const exampleComDocument = `https://example.com/document-builder.sjs`;
const TEST_URL = `${exampleNetDocument}?html=
const TEST_URL = `${exampleOrgDocument}?html=
<style>
body {
margin: 0;
@ -17,7 +17,7 @@ const TEST_URL = `${exampleNetDocument}?html=
}
</style>
<iframe
src="${exampleNetDocument}?html=<body style='margin:0;height:30px;background:rgb(255,0,0)'></body>"
src="${exampleOrgDocument}?html=<body style='margin:0;height:30px;background:rgb(255,0,0)'></body>"
id="same-origin"></iframe>
<iframe
src="${exampleComDocument}?html=<body style='margin:0;height:30px;background:rgb(0,255,0)'></body>"

Просмотреть файл

@ -6,8 +6,8 @@
* yet opened.
*/
var URL = `${URL_ROOT}doc_viewsource.html`;
var JS_URL = `${URL_ROOT}code_math.js`;
var URL = `${URL_ROOT_SSL}doc_viewsource.html`;
var JS_URL = `${URL_ROOT_SSL}code_math.js`;
async function viewSource() {
const toolbox = await openNewTabAndToolbox(URL);

Просмотреть файл

@ -5,8 +5,8 @@
* Tests that Toolbox#viewSourceInDebugger works when debugger is already loaded.
*/
var URL = `${URL_ROOT}doc_viewsource.html`;
var JS_URL = `${URL_ROOT}code_math.js`;
var URL = `${URL_ROOT_SSL}doc_viewsource.html`;
var JS_URL = `${URL_ROOT_SSL}code_math.js`;
async function viewSource() {
const toolbox = await openNewTabAndToolbox(URL);

Просмотреть файл

@ -6,8 +6,8 @@
* yet opened.
*/
var URL = `${URL_ROOT}doc_viewsource.html`;
var CSS_URL = `${URL_ROOT}doc_theme.css`;
var URL = `${URL_ROOT_SSL}doc_viewsource.html`;
var CSS_URL = `${URL_ROOT_SSL}doc_theme.css`;
async function viewSource() {
const toolbox = await openNewTabAndToolbox(URL);

Просмотреть файл

@ -6,15 +6,15 @@
/**
* Check that the "watchedByDevTools" flag is properly handled.
*/
const EXAMPLE_NET_URI =
"http://example.net/document-builder.sjs?html=<div id=net>net";
const EXAMPLE_HTTP_URI =
"http://mochi.test:8888/document-builder.sjs?html=<div id=http>http";
const EXAMPLE_COM_URI =
"https://example.com/document-builder.sjs?html=<div id=com>com";
const EXAMPLE_ORG_URI =
"https://example.org/document-builder.sjs?headers=Cross-Origin-Opener-Policy:same-origin&html=<div id=org>org</div>";
add_task(async function() {
const tab = await addTab(EXAMPLE_NET_URI);
const tab = await addTab(EXAMPLE_HTTP_URI);
is(
tab.linkedBrowser.browsingContext.watchedByDevTools,

Просмотреть файл

@ -11,9 +11,11 @@ const NAME_3 = NAME_2;
const NAME_4 = "Toolbox test for another title update";
const URL_1 = "data:text/plain;charset=UTF-8,abcde";
const URL_2 = URL_ROOT_ORG + "browser_toolbox_window_title_changes_page.html";
const URL_3 = URL_ROOT_COM + "browser_toolbox_window_title_changes_page.html";
const URL_4 = `http://example.com/document-builder.sjs?html=<head><title>${NAME_4}</title></head><h1>Hello`;
const URL_2 =
URL_ROOT_ORG_SSL + "browser_toolbox_window_title_changes_page.html";
const URL_3 =
URL_ROOT_COM_SSL + "browser_toolbox_window_title_changes_page.html";
const URL_4 = `https://example.com/document-builder.sjs?html=<head><title>${NAME_4}</title></head><h1>Hello`;
add_task(async function test() {
await addTab(URL_1);

Просмотреть файл

@ -10,8 +10,10 @@
*/
var { Toolbox } = require("devtools/client/framework/toolbox");
const URL = URL_ROOT + "browser_toolbox_window_title_frame_select_page.html";
const IFRAME_URL = URL_ROOT + "browser_toolbox_window_title_changes_page.html";
const URL =
URL_ROOT_SSL + "browser_toolbox_window_title_frame_select_page.html";
const IFRAME_URL =
URL_ROOT_SSL + "browser_toolbox_window_title_changes_page.html";
const { LocalizationHelper } = require("devtools/shared/l10n");
const L10N = new LocalizationHelper(
"devtools/client/locales/toolbox.properties"

Просмотреть файл

@ -1,7 +1,7 @@
{
"version": 3,
"file": "code_binary_search.js",
"sourceRoot": "http://example.com/browser/devtools/client/framework/test/",
"sourceRoot": "https://example.com/browser/devtools/client/framework/test/",
"sources": [
"code_binary_search.coffee"
],

Просмотреть файл

@ -7,7 +7,7 @@
<meta charset="utf-8">
</head>
<body>
<iframe src="http://example.org/browser/devtools/client/framework/test/doc_cached-resource_iframe.html"></iframe>
<iframe src="https://example.org/browser/devtools/client/framework/test/doc_cached-resource_iframe.html"></iframe>
<script>
console.log("Hello from parent");
</script>