Bug 1918529 - fix some subpixel misalignment issues with gfx.webrender.svg-filter...
[gecko.git] / dom / midi / tests / browser_stable_midi_port_ids.js
blobe7d3056160deb1b7627dde5166afd6616ee20740
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
4 const EXAMPLE_COM_URL = "https://example.com/browser/dom/midi/tests/";
5 const EXAMPLE_ORG_URL = "https://example.org/browser/dom/midi/tests/";
6 const PAGE1 = "port_ids_page_1.html";
7 const PAGE2 = "port_ids_page_2.html";
9 // Return the MIDI port id of the first input port for the given URL and page
10 function id_for_tab(url, page) {
11 return BrowserTestUtils.withNewTab(
13 gBrowser,
14 url: url + page,
15 waitForLoad: true,
17 async function (browser) {
18 return SpecialPowers.spawn(browser, [""], function () {
19 return content.wrappedJSObject.get_first_input_id();
20 });
25 add_task(async function () {
26 let com_page1;
27 let com_page1_reload;
28 let org_page1;
29 let org_page2;
31 [com_page1, com_page1_reload, org_page1, org_page2] = await Promise.all([
32 id_for_tab(EXAMPLE_COM_URL, PAGE1),
33 id_for_tab(EXAMPLE_COM_URL, PAGE1),
34 id_for_tab(EXAMPLE_ORG_URL, PAGE1),
35 id_for_tab(EXAMPLE_ORG_URL, PAGE2),
36 ]);
37 Assert.equal(
38 com_page1,
39 com_page1_reload,
40 "MIDI port ids should be the same when reloading the same page"
42 Assert.notEqual(
43 com_page1,
44 org_page1,
45 "MIDI port ids should be different in different origins"
47 Assert.equal(
48 org_page1,
49 org_page2,
50 "MIDI port ids should be the same in the same origin"
52 });