blob: 7dbcec34e961d34125fc583e8213e79c9f01bfc4 (
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
36
37
38
39
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Test that pasting clipboard content into input with middle-click works.
"use strict";
const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html>Web Console test paste on middle-click`;
add_task(async function () {
await pushPref("devtools.selfxss.count", 5);
// Enable pasting with middle-click.
await pushPref("middlemouse.paste", true);
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
info("Set clipboard content");
const clipboardContent = "test clipboard content";
setClipboardText(clipboardContent);
info("Middle-click on the console input");
const node = jsterm.node;
EventUtils.synthesizeMouse(node, 30, 10, { button: 1 }, hud.iframeWindow);
is(
getInputValue(hud),
clipboardContent,
"clipboard content was pasted in the console input"
);
});
function setClipboardText(text) {
const helper = SpecialPowers.Cc[
"@mozilla.org/widget/clipboardhelper;1"
].getService(SpecialPowers.Ci.nsIClipboardHelper);
helper.copyString(text);
}
|