Repository navigation
Expand file tree
/
Copy pathhead.js
More file actions
55 lines (51 loc) · 1.42 KB
/
Copy pathhead.js
File metadata and controls
55 lines (51 loc) · 1.42 KB
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
/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
'use strict';
function simulateClick(win = window) {
let target = win.gURLBar.inputField;
let promise = BrowserTestUtils.waitForEvent(target, 'click');
EventUtils.synthesizeMouseAtCenter(target, {});
return promise;
}
function selectWithMouseDrag(fromX, toX, win = window) {
let target = win.gURLBar.inputField;
let rect = target.getBoundingClientRect();
let promise = BrowserTestUtils.waitForEvent(target, 'mouseup');
EventUtils.synthesizeMouse(
target,
fromX,
rect.height / 2,
{ type: 'mousemove' },
target.ownerGlobal
);
EventUtils.synthesizeMouse(
target,
fromX,
rect.height / 2,
{ type: 'mousedown' },
target.ownerGlobal
);
EventUtils.synthesizeMouse(
target,
toX,
rect.height / 2,
{ type: 'mousemove' },
target.ownerGlobal
);
EventUtils.synthesizeMouse(target, toX, rect.height / 2, { type: 'mouseup' }, target.ownerGlobal);
return promise;
}
function goToMultipleLayouts(callback) {
return new Promise(async (resolve) => {
await SpecialPowers.pushPrefEnv({
set: [['zen.view.use-single-toolbar', false]],
});
setTimeout(async () => {
await callback();
await SpecialPowers.popPrefEnv();
setTimeout(() => {
resolve();
}, 1000); // Wait for new layout
}, 1000); // Wait for new layout
});
}