|
1 <?xml version="1.0"?> |
|
2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?> |
|
3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?> |
|
4 <!-- |
|
5 https://bugzilla.mozilla.org/show_bug.cgi?id=888839 |
|
6 --> |
|
7 <window title="Mozilla Bug 888839" |
|
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
|
9 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
|
10 |
|
11 <script type="application/javascript"><![CDATA[ |
|
12 |
|
13 let { classes: Cc, interfaces: Ci } = Components; |
|
14 |
|
15 SimpleTest.waitForExplicitFinish(); |
|
16 addLoadEvent(runTest); |
|
17 |
|
18 function runTest() { |
|
19 let desc = document.querySelector("description"); |
|
20 window.getSelection().selectAllChildren(desc); |
|
21 |
|
22 let webnav = window. |
|
23 QueryInterface(Ci.nsIInterfaceRequestor). |
|
24 getInterface(Ci.nsIWebNavigation); |
|
25 |
|
26 webnav. |
|
27 QueryInterface(Ci.nsIDocShell). |
|
28 contentViewer. |
|
29 QueryInterface(Ci.nsIContentViewerEdit). |
|
30 copySelection(); |
|
31 |
|
32 let mime = "text/unicode"; |
|
33 let whichClipboard = Ci.nsIClipboard.kGlobalClipboard; |
|
34 let clipboard = Cc["@mozilla.org/widget/clipboard;1"]. |
|
35 getService(Ci.nsIClipboard); |
|
36 ok(clipboard.hasDataMatchingFlavors([mime], 1, whichClipboard), |
|
37 "Clipboard should have text/unicode"); |
|
38 |
|
39 let transferable = Cc["@mozilla.org/widget/transferable;1"]. |
|
40 createInstance(Ci.nsITransferable); |
|
41 transferable.init(webnav.QueryInterface(Ci.nsILoadContext)); |
|
42 transferable.addDataFlavor(mime); |
|
43 clipboard.getData(transferable, whichClipboard); |
|
44 var data = {}; |
|
45 transferable.getTransferData(mime, data, {}); |
|
46 is(data.value.QueryInterface(Ci.nsISupportsString).data, |
|
47 "\n hello\n world\n ", |
|
48 "Paste is not HTML, so it should not be pretty printed"); |
|
49 |
|
50 SimpleTest.finish(); |
|
51 } |
|
52 |
|
53 ]]></script> |
|
54 |
|
55 <description style="-moz-user-focus: normal; -moz-user-select: text;"><![CDATA[ |
|
56 hello |
|
57 world |
|
58 ]]></description> |
|
59 |
|
60 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
61 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=888839" |
|
62 target="_blank">Mozilla Bug 888839</a> |
|
63 </body> |
|
64 </window> |