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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function () {
const URI = "data:text/html;charset=utf-8,<iframe id='test-iframe'></iframe>";
await BrowserTestUtils.withNewTab(
{ gBrowser, url: URI },
async function (browser) {
await SpecialPowers.spawn(browser, [], test_init);
browser.browsingContext.touchEventsOverride = "disabled";
await SpecialPowers.spawn(browser, [], test_body);
}
);
});
async function test_init() {
is(
content.browsingContext.touchEventsOverride,
"none",
"touchEventsOverride flag should be initially set to NONE"
);
}
async function test_body() {
let bc = content.browsingContext;
is(
bc.touchEventsOverride,
"disabled",
"touchEventsOverride flag should be changed to DISABLED"
);
let frameWin = content.document.querySelector("#test-iframe").contentWindow;
bc = frameWin.browsingContext;
is(
bc.touchEventsOverride,
"disabled",
"touchEventsOverride flag should be passed on to frames."
);
let newFrame = content.document.createElement("iframe");
content.document.body.appendChild(newFrame);
let newFrameWin = newFrame.contentWindow;
bc = newFrameWin.browsingContext;
is(
bc.touchEventsOverride,
"disabled",
"Newly created frames should use the new touchEventsOverride flag"
);
// Wait for the non-transient about:blank to load.
await ContentTaskUtils.waitForEvent(newFrame, "load");
newFrameWin = newFrame.contentWindow;
bc = newFrameWin.browsingContext;
is(
bc.touchEventsOverride,
"disabled",
"Newly created frames should use the new touchEventsOverride flag"
);
newFrameWin.location.reload();
await ContentTaskUtils.waitForEvent(newFrame, "load");
newFrameWin = newFrame.contentWindow;
bc = newFrameWin.browsingContext;
is(
bc.touchEventsOverride,
"disabled",
"New touchEventsOverride flag should persist across reloads"
);
}
|