5 if (window
.testRunner
) {
6 testRunner
.dumpAsText();
7 testRunner
.waitUntilDone();
12 console
.log("FAIL: test image failed to load.");
13 if (window
.testRunner
)
14 testRunner
.notifyDone();
17 function imageLoaded()
19 console
.log("Test image loaded.");
20 if (!window
.testRunner
)
23 e
= document
.getElementById("source");
24 x
= e
.offsetLeft
+ e
.offsetWidth
/ 2;
25 y
= e
.offsetTop
+ e
.offsetHeight
/ 2;
27 eventSender
.mouseMoveTo(x
, y
);
28 eventSender
.mouseDown();
30 e
= document
.getElementById("target");
31 x
= e
.offsetLeft
+ e
.offsetWidth
/ 2;
32 y
= e
.offsetTop
+ e
.offsetHeight
/ 2;
34 eventSender
.leapForward(100);
35 eventSender
.mouseMoveTo(x
, y
);
36 eventSender
.mouseUp();
39 function dragEnterOrOver(event
)
41 event
.dataTransfer
.dropEffect
= "copy";
42 event
.preventDefault();
47 console
.log("Drop event fired.");
48 event
.preventDefault();
49 if (!window
.testRunner
)
51 eventSender
.dumpFilenameBeingDragged();
52 testRunner
.notifyDone();
56 #target { height:
100px; width:
100px; border:
2px solid green; }
61 <!-- This test requires Content Shell. This page tests dragging an image with a file extension that
62 does not match its mime type or actual file type. The dragged image filename extension should be
63 .gif (not .php, or .jpg, or .jpeg ...) -->
64 <div id=
"target" ondragenter=
"dragEnterOrOver(event)" ondragover=
"dragEnterOrOver(event)" ondrop=
"drop(event)"></div>
65 <img id=
"source" onerror=
"imageError(this)" onload=
"imageLoaded(this)" alt=
"Will it blend?"
66 src=
"http://127.0.0.1:8000/misc/resources/generatedimage.php">