Don't convert pasted content to use blob URL in WebKit1
[WebKit-https.git] / Tools / TestWebKitAPI / Tests / WebKitCocoa / paste-rtfd.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <div id="editor" contenteditable></div>
5 <script>
6 const editor = document.getElementById('editor');
7 editor.focus();
8
9 var clipboardData = {};
10 editor.addEventListener('paste', (event) => {
11     clipboardData.types = Array.from(event.clipboardData.types);
12     clipboardData.items = Array.from(event.clipboardData.items).map((item) => ({kind: item.kind, type: item.type}));
13     clipboardData.values = clipboardData.types.map((type) => event.clipboardData.getData(type));
14     clipboardData.files = Array.from(event.clipboardData.files);
15
16     setTimeout(() => {
17        let img = document.querySelector('img');
18        if (img.complete)
19            notifyLoaded();
20        else
21            img.onload = notifyLoaded;
22     }, 0);
23 });
24
25 function notifyLoaded()
26 {
27     if (window.webkit)
28         webkit.messageHandlers.testHandler.postMessage('loaded');
29     else
30         alert('loaded');
31 }
32
33 </script>
34 </body>
35 </html>