Commit 316d273d authored by Julian Descottes's avatar Julian Descottes
Browse files

Bug 1733464 - [devtools] Fix webconsole stubs and node tests for https-first r=nchevobbe

It is slightly more complicated than expected because we have an issue capturing 404 from httpd.js in DevTools when using HTTPS (see Bug 1733420).

Therefore the stub for network events, which generates 404 requests, is not using https://example.com but http://mochi.test:8888

Differential Revision: https://phabricator.services.mozilla.com/D127161
parent 8c4903ad
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ const {
} = require(`${CHROME_URL_ROOT}stub-generator-helpers`);

const TEST_URI =
  "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html";
  "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html";
const STUB_FILE = "consoleApi.js";

add_task(async function() {
@@ -261,8 +261,8 @@ function getCommands() {
      code: `
  console.log(
    "%cfoo%cbar",
    "color:blue; font-size:1.3em; background:url('http://example.com/test'); position:absolute; top:10px; ",
    "color:red; line-height: 1.5; background:\\165rl('http://example.com/test')"
    "color:blue; font-size:1.3em; background:url('https://example.com/test'); position:absolute; top:10px; ",
    "color:red; line-height: 1.5; background:\\165rl('https://example.com/test')"
  );
  `,
    },
@@ -282,8 +282,8 @@ function getCommands() {
      code: `
  console.group(
    "%cfoo%cbar",
    "color:blue;font-size:1.3em;background:url('http://example.com/test');position:absolute;top:10px",
    "color:red;background:\\165rl('http://example.com/test')");
    "color:blue;font-size:1.3em;background:url('https://example.com/test');position:absolute;top:10px",
    "color:red;background:\\165rl('https://example.com/test')");
  console.groupEnd();
  `,
    },
@@ -295,8 +295,8 @@ function getCommands() {
      code: `
  console.groupCollapsed(
    "%cfoo%cbaz",
    "color:blue;font-size:1.3em;background:url('http://example.com/test');position:absolute;top:10px",
    "color:red;background:\\165rl('http://example.com/test')");
    "color:blue;font-size:1.3em;background:url('https://example.com/test');position:absolute;top:10px",
    "color:red;background:\\165rl('https://example.com/test')");
  console.groupEnd();
  `,
    },
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ const {
} = require(`${CHROME_URL_ROOT}stub-generator-helpers`);

const TEST_URI =
  "http://example.com/browser/devtools/client/webconsole/test/browser/stub-generators/test-css-message.html";
  "https://example.com/browser/devtools/client/webconsole/test/browser/stub-generators/test-css-message.html";
const STUB_FILE = "cssMessage.js";

add_task(async function() {
+5 −1
Original line number Diff line number Diff line
@@ -12,8 +12,12 @@ const {
  writeStubsToFile,
} = require(`${CHROME_URL_ROOT}stub-generator-helpers`);

// Note: we use http://mochi.test:8888 because this will be accepted even when
// https-first mode is enabled. Other stubs are simply using https://example.com
// but we cannot use it here because there is a bug capturing 404 from httpd.js
// in DevTools when using HTTPS (see Bug 1733420).
const TEST_URI =
  "http://example.com/browser/devtools/client/webconsole/test/browser/stub-generators/test-network-event.html";
  "http://mochi.test:8888/browser/devtools/client/webconsole/test/browser/stub-generators/test-network-event.html";
const STUB_FILE = "networkEvent.js";

add_task(async function() {
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ const {
} = require(`${CHROME_URL_ROOT}stub-generator-helpers`);

const TEST_URI =
  "http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html";
  "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html";
const STUB_FILE = "pageError.js";

add_task(async function() {
+3 −3
Original line number Diff line number Diff line
@@ -375,7 +375,7 @@ describe("ConsoleAPICall component:", () => {
        ConsoleApiCall({ message, serviceContainer, open: true })
      );
      const filepath =
        "http://example.com/browser/devtools/client/webconsole/" +
        "https://example.com/browser/devtools/client/webconsole/" +
        "test/fixtures/stub-generators/" +
        "test-console-api.html";

@@ -440,7 +440,7 @@ describe("ConsoleAPICall component:", () => {
      );

      const filepath =
        "http://example.com/browser/devtools/client/webconsole/" +
        "https://example.com/browser/devtools/client/webconsole/" +
        "test/fixtures/stub-generators/test-console-api.html";

      expect(wrapper.find(".message-body").text()).toBe(
@@ -697,7 +697,7 @@ describe("ConsoleAPICall component:", () => {
      );

      expect(wrapper.find(".message-body").text()).toBe(
        "Window http://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html"
        "Window https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html"
      );
    });
  });
Loading