|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=681229 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 681229</title> |
|
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
|
10 <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script> |
|
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
12 </head> |
|
13 <body> |
|
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=681229">Mozilla Bug 681229</a> |
|
15 <p id="display"></p> |
|
16 <div id="content"> |
|
17 <textarea spellcheck="false"></textarea> |
|
18 </div> |
|
19 <pre id="test"> |
|
20 <script type="application/javascript"> |
|
21 |
|
22 /** Test for Bug 681229 **/ |
|
23 |
|
24 SimpleTest.waitForExplicitFinish(); |
|
25 SimpleTest.waitForFocus(function() { |
|
26 var t = document.querySelector("textarea"); |
|
27 t.focus(); |
|
28 |
|
29 const kValue = "a\r\nb"; |
|
30 const kExpectedValue = (navigator.platform.indexOf("Win") == 0) ? |
|
31 "a\nb" : kValue; |
|
32 |
|
33 SimpleTest.waitForClipboard(kExpectedValue, |
|
34 function() { |
|
35 SpecialPowers.copyString(kValue, document); |
|
36 }, |
|
37 function() { |
|
38 synthesizeKey("V", {accelKey: true}); |
|
39 is(t.value, "a\nb", "The carriage return has been correctly sanitized"); |
|
40 SimpleTest.finish(); |
|
41 }, |
|
42 function() { |
|
43 SimpleTest.finish(); |
|
44 } |
|
45 ); |
|
46 }); |
|
47 |
|
48 </script> |
|
49 </pre> |
|
50 </body> |
|
51 </html> |