dom/plugins/test/mochitest/test_copyText.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <!DOCTYPE HTML>
     2 <html>
     3 <head>
     4   <title>Test copying text from browser to plugin</title>
     5   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     6   <script type="text/javascript" src="utils.js"></script>
     8   <script class="testbody" type="text/javascript">
     9 function runTests() {
    10   var text = " some text \n to copy 'n paste "
    11   var textElt = document.getElementById("input");
    12   var plugin = document.getElementById("plugin1");
    14   textElt.focus();
    15   textElt.value = text;
    16   textElt.select();
    17   SpecialPowers.wrap(textElt).editor.copy();
    19   is(plugin.getClipboardText(), text);
    21   SimpleTest.finish();
    22 }
    24 SimpleTest.waitForExplicitFinish();
    25 setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
    27   </script>
    28 </head>
    30 <body onload="runTests()">
    31   <embed id="plugin1" type="application/x-test" width="400" height="400"></embed>
    32   <textarea id="input"></textarea>
    34 </body>
    35 </html>

mercurial