summaryrefslogtreecommitdiffstats
path: root/devtools/client/webconsole/test/browser/browser_webconsole_network_unicode.js
blob: 338cede3d1bbd1f49e0f1cc9aa99c24d8e560413 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

// Tests that Unicode characters within the domain are displayed
// encoded and not in Punycode or somehow garbled.

"use strict";

const TEST_URL =
  "http://example.com/browser/devtools/client/webconsole/test/browser/test-network-request.html";

add_task(async function () {
  await pushPref("devtools.webconsole.filter.netxhr", true);

  const toolbox = await openNewTabAndToolbox(TEST_URL, "webconsole");
  const hud = toolbox.getCurrentPanel().hud;

  const onMessage = waitForMessageByType(hud, "testxhr", ".network");

  const XHR_TEST_URL_WITHOUT_PARAMS = "http://flüge.example.com/testxhr";
  const XHR_TEST_URL = XHR_TEST_URL_WITHOUT_PARAMS + "?foo";
  SpecialPowers.spawn(gBrowser.selectedBrowser, [XHR_TEST_URL], url => {
    content.fetch(url);
  });

  info("Wait for expected messages to appear");
  const message = await onMessage;

  const urlNode = message.node.querySelector(".url");
  is(
    urlNode.textContent,
    XHR_TEST_URL,
    "The network call is displayed with the expected URL"
  );
});