3 <title>Test the dragstart event on the anchor in side shadow DOM
</title>
4 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css">
5 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
6 <script src=
"/tests/SimpleTest/EventUtils.js"></script>
9 async
function runTests()
11 let dragService
= SpecialPowers
.Cc
["@mozilla.org/widget/dragservice;1"].
12 getService(SpecialPowers
.Ci
.nsIDragService
);
14 let iframe
= document
.querySelector("iframe");
15 let iframeDoc
= iframe
.contentDocument
;
16 let iframeWin
= iframe
.contentWindow
;
18 let shadow
= iframeDoc
.querySelector('#outer').attachShadow({mode
: 'open'});
20 let target
= iframeDoc
.createElement('a');
21 target
.textContent
= "Drag me if you can!";
22 const URL
= "http://www.mozilla.org/";
24 shadow
.appendChild(target
);
26 // Some of the drag data we don't actually care about for this test,
27 // so we'll use this comparator function to ignore them.
28 function ignoreFunc(actualData
, expectedData
) {
32 const EXPECTED_DRAG_DATA
= [[{
33 type
: "text/x-moz-url",
37 type
: "text/x-moz-url-data",
41 type
: "text/x-moz-url-desc",
45 type
: "text/uri-list",
48 type
: "text/_moz_htmlinfo",
60 let result
= await
synthesizePlainDragAndCancel(
64 finalY
: -10, // Avoid clicking the link
67 ok(result
=== true, "Should have gotten the expected drag data.");
72 SimpleTest
.waitForExplicitFinish();
73 window
.onload
= () => {
74 SimpleTest
.waitForFocus(runTests
);
80 <iframe srcdoc='
<div id=
"outer"/>'
></iframe>