<!DOCTYPE HTML><!-- This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. --><html><!--https://bugzilla.mozilla.org/show_bug.cgi?id=830600--><head><title>Test for Bug 830600</title><scriptsrc="/tests/SimpleTest/SimpleTest.js"></script><scriptsrc="/tests/SimpleTest/EventUtils.js"></script><linkrel="stylesheet"href="/tests/SimpleTest/test.css"></head><body><atarget="_blank"href="https://bugzilla.mozilla.org/show_bug.cgi?id=830600">Mozilla Bug 830600</a><pid="display"></p><divid="content"style="display: none"></div><inputtype="text"id="t1"/><preid="test"><scripttype="application/javascript">/** Test for Bug 830600 **/SimpleTest.waitForExplicitFinish();SimpleTest.waitForFocus(function(){constCi=SpecialPowers.Ci;functiontest(str,expected,callback){vart=document.getElementById("t1");t.focus();t.value="";vareditor=SpecialPowers.wrap(t).editor;editor.newlineHandling=Ci.nsIEditor.eNewlinesStripSurroundingWhitespace;SimpleTest.waitForClipboard(str,function(){SpecialPowers.Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper).copyString(str);},function(){synthesizeKey("V",{accelKey:true});is(t.value,expected,"New line handling works correctly");t.value="";callback();},function(){ok(false,"Failed to copy the string");SimpleTest.finish();});}functionrunNextTest(){if(tests.length){varcurrentTest=tests.shift();test(currentTest[0],currentTest[1],runNextTest);}else{SimpleTest.finish();}}vartests=[["abc","abc"],["\n",""],[" \n",""],["\n ",""],[" \n ",""],[" a"," a"],["a ","a "],[" a "," a "],[" \nabc","abc"],["\n abc","abc"],[" \n abc","abc"],[" \nabc ","abc "],["\n abc ","abc "],[" \n abc ","abc "],["abc\n ","abc"],["abc \n","abc"],["abc \n ","abc"],[" abc\n "," abc"],[" abc \n"," abc"],[" abc \n "," abc"],[" abc \n def \n "," abcdef"],["\n abc \n def \n ","abcdef"],[" \n abc \n def ","abcdef "],[" abc\n\ndef "," abcdef "],[" abc \n\n def "," abcdef "],];runNextTest();});</script></pre></body></html>