4 // This is a 10x10 24-bits RGB BMP image in white.
6 "Qk12AQAAAAAAADYAAAAoAAAACgAAAAoAAAABABgAAAAAAEABAAATCwAAEwsAAAAAAAAAAAAAAAAA" +
7 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +
8 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +
9 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +
10 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +
11 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +
12 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
15 var imageRaw
= window
.atob(imageString
).split("");
17 // 10x10x3 bytes are image data.
19 var beginByte
= imageRaw
.length
- pixelBytes
;
21 function generateNewImage()
23 // Add 1 to image data.
24 for (var i
= beginByte
; i
< imageRaw
.length
; ++i
) {
25 var c
= imageRaw
[i
].charCodeAt(0);
27 imageRaw
[i
] = String
.fromCharCode(0);
29 imageRaw
[i
] = String
.fromCharCode(c
+1);
34 var bmpImage
= new Image();
35 bmpImage
.src
= "data:image/bmp;base64," + window
.btoa(imageRaw
.join(""));
42 if (imageCount
>= 1000 * 1000)
44 document
.getElementById("imageCanvas").appendChild(generateNewImage());
45 window
.setTimeout("addImage()", 1);
50 document
.getElementById("dragFrame").contentWindow
.location
.href
=
55 <p>To run this test:
</p>
56 <p>1. Drag this text
10 times:
57 <iframe id=
"dragFrame" width=
"50" height=
"30">.
</iframe></p>
58 <p>2. Click this
<button onclick=
"runTest();">Start
</button> button.
</p>
59 <p>3. Let it run for
5 minutes and browser shouldn't crash.
</p>
60 <div id=
"imageCanvas"></div>
63 // Write this content to the iframe.
66 "<" + "script" + ">" +
67 "function dragStartHandler()" +
69 " var img = new Image();" +
70 " img.src = 'data:image/bmp;base64," + imageString
+ "';" +
71 " event.dataTransfer.setDragImage(img, 10, 10);" +
73 "</" + "script" + ">" +
74 "<span ondragstart='dragStartHandler()'" +
75 " style='-webkit-user-select:none;" +
76 " -webkit-user-drag: element;" +
77 " position: absolute; top: 0; left: 0;" +
78 " background-color: blue;'>HERE</span>" +
81 var doc
= document
.getElementById("dragFrame");
82 doc
.contentDocument
.open();
83 doc
.contentDocument
.write(content
);
84 doc
.contentDocument
.close();