test_bug1161721.html (1450B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1161721 5 --> 6 <head> 7 <title>Test for Bug 1161721</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script src="/tests/SimpleTest/EventUtils.js"></script> 10 <script 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=1161721">Mozilla Bug 1161721</a> 15 <p id="display"></p> 16 17 <div id="content"> 18 </div> 19 20 <pre id="test"> 21 <script type="application/javascript"> 22 add_task(async function test() { 23 await SpecialPowers.pushPrefEnv({ 24 set: [["dom.execCommand.paste.enabled", false]], 25 }); 26 27 ok(!document.queryCommandSupported("paste"), "Paste isn't supported in non-privileged JavaScript"); 28 ok(document.queryCommandSupported("copy"), "Copy is supported in non-privileged JavaScript"); 29 ok(document.queryCommandSupported("cut"), "Cut is supported in non-privileged JavaScript"); 30 31 ok(SpecialPowers.wrap(document).queryCommandSupported("paste"), "Paste is supported in privileged JavaScript"); 32 ok(SpecialPowers.wrap(document).queryCommandSupported("copy"), "Copy is supported in privileged JavaScript"); 33 ok(SpecialPowers.wrap(document).queryCommandSupported("cut"), "Cut is supported in privileged JavaScript"); 34 }); 35 </script> 36 </pre> 37 </body> 38 </html>