blob: 4303d9e67a8c70e7beab893e6586418e062ee503 [file] [log] [blame]
tony@chromium.orgc0461602010-06-15 08:03:14 +00001<p>This tests to make sure that copying/pasting HTML results in URLs being full paths so
2pasting between websites works. To test manually, copy the selection and paste it into
3the blue box. If this is a file:/// url, the links should be relative. If this is an
4http:// url, the links should be absolute.</p>
5<div id="test">
6<a href="../relative/path/foo.html">link</a><img src="resources/abe.png">
7</div>
8<div id="pastehere" contenteditable="true" style="border: 1px solid blue" onpaste="paste()">
9</div>
10<div id="results"></div>
11<script>
12function test()
13{
14 var s = window.getSelection();
15 var test = document.getElementById("test");
16 s.selectAllChildren(test);
17
rniwa@webkit.org14f6b5b2012-06-13 08:51:53 +000018 if (!window.testRunner)
tony@chromium.orgc0461602010-06-15 08:03:14 +000019 return;
rniwa@webkit.org14f6b5b2012-06-13 08:51:53 +000020 testRunner.dumpAsText();
21 testRunner.waitUntilDone();
tony@chromium.orgc0461602010-06-15 08:03:14 +000022
23 document.execCommand("Copy");
24 var pasteHere = document.getElementById("pastehere");
25 s.setPosition(pasteHere, 0);
26 document.execCommand("Paste");
27}
28
29function paste()
30{
31 setTimeout(afterPaste, 0);
32}
33
34function afterPaste()
35{
36 var pasteHere = document.getElementById("pastehere");
37 var results = document.getElementById("results");
38 results.appendChild(document.createTextNode(pasteHere.innerHTML));
rniwa@webkit.org14f6b5b2012-06-13 08:51:53 +000039 if (window.testRunner)
40 testRunner.notifyDone();
tony@chromium.orgc0461602010-06-15 08:03:14 +000041}
42
43test();
44</script>