Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=397571 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 397571</title> |
michael@0 | 8 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 10 | </head> |
michael@0 | 11 | <body> |
michael@0 | 12 | <a target="_blank" |
michael@0 | 13 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=397571"> |
michael@0 | 14 | Mozilla Bug 397571</a> |
michael@0 | 15 | <p id="display"></p> |
michael@0 | 16 | <div id="content" style="display: none"> |
michael@0 | 17 | |
michael@0 | 18 | </div> |
michael@0 | 19 | <pre id="test"> |
michael@0 | 20 | <script class="testbody" type="text/javascript"> |
michael@0 | 21 | |
michael@0 | 22 | /** Test for Bug 397571 **/ |
michael@0 | 23 | |
michael@0 | 24 | // Get the interface |
michael@0 | 25 | var utils = SpecialPowers.DOMWindowUtils.SpecialPowers_wrappedObject; |
michael@0 | 26 | |
michael@0 | 27 | // Try to call functions without privileges |
michael@0 | 28 | var success = false; |
michael@0 | 29 | try { |
michael@0 | 30 | isForced = utils.docCharsetIsForced; |
michael@0 | 31 | } |
michael@0 | 32 | catch(e) { |
michael@0 | 33 | success = true; |
michael@0 | 34 | } |
michael@0 | 35 | ok(success == true, "should throw"); |
michael@0 | 36 | |
michael@0 | 37 | success = false; |
michael@0 | 38 | try { |
michael@0 | 39 | contentDisposition = utils.getDocumentMetadata("content-disposition"); |
michael@0 | 40 | } |
michael@0 | 41 | catch(e) { |
michael@0 | 42 | success = true; |
michael@0 | 43 | } |
michael@0 | 44 | ok(success == true, "should throw"); |
michael@0 | 45 | |
michael@0 | 46 | var success = false; |
michael@0 | 47 | try { |
michael@0 | 48 | utils.sendMouseEvent("mousedown", 0, 0, 0, 1, 0); |
michael@0 | 49 | } |
michael@0 | 50 | catch(e) { |
michael@0 | 51 | success = true; |
michael@0 | 52 | } |
michael@0 | 53 | ok(success, "should throw"); |
michael@0 | 54 | |
michael@0 | 55 | var success = false; |
michael@0 | 56 | try { |
michael@0 | 57 | utils.sendKeyEvent("keydown", 0, 0, 0); |
michael@0 | 58 | } |
michael@0 | 59 | catch(e) { |
michael@0 | 60 | success = true; |
michael@0 | 61 | } |
michael@0 | 62 | ok(success, "should throw"); |
michael@0 | 63 | |
michael@0 | 64 | var success = false; |
michael@0 | 65 | try { |
michael@0 | 66 | utils.focus(null); |
michael@0 | 67 | } |
michael@0 | 68 | catch(e) { |
michael@0 | 69 | success = true; |
michael@0 | 70 | } |
michael@0 | 71 | ok(success, "should throw"); |
michael@0 | 72 | |
michael@0 | 73 | // Get privilege |
michael@0 | 74 | utils = SpecialPowers.wrap(utils); |
michael@0 | 75 | |
michael@0 | 76 | // Try again |
michael@0 | 77 | var success = true; |
michael@0 | 78 | try { |
michael@0 | 79 | isForced = utils.docCharsetIsForced; |
michael@0 | 80 | } |
michael@0 | 81 | catch(e) { |
michael@0 | 82 | success = false; |
michael@0 | 83 | } |
michael@0 | 84 | ok(success, "shouldn't throw"); |
michael@0 | 85 | |
michael@0 | 86 | var success = true; |
michael@0 | 87 | try { |
michael@0 | 88 | contentDisposition = utils.getDocumentMetadata("content-disposition"); |
michael@0 | 89 | } |
michael@0 | 90 | catch(e) { |
michael@0 | 91 | success = false; |
michael@0 | 92 | } |
michael@0 | 93 | ok(success, "shouldn't throw"); |
michael@0 | 94 | |
michael@0 | 95 | var success = true; |
michael@0 | 96 | try { |
michael@0 | 97 | utils.sendMouseEvent("mousedown", 0, 0, 0, 1, 0); |
michael@0 | 98 | } |
michael@0 | 99 | catch(e) { |
michael@0 | 100 | success = false; |
michael@0 | 101 | } |
michael@0 | 102 | ok(success, "shouldn't throw"); |
michael@0 | 103 | |
michael@0 | 104 | var success = true; |
michael@0 | 105 | try { |
michael@0 | 106 | utils.sendKeyEvent("keydown", 0, 0, 0); |
michael@0 | 107 | } |
michael@0 | 108 | catch(e) { |
michael@0 | 109 | success = false; |
michael@0 | 110 | } |
michael@0 | 111 | ok(success, "shouldn't throw"); |
michael@0 | 112 | |
michael@0 | 113 | var success = true; |
michael@0 | 114 | try { |
michael@0 | 115 | utils.focus(null); |
michael@0 | 116 | } |
michael@0 | 117 | catch(e) { |
michael@0 | 118 | success = false; |
michael@0 | 119 | } |
michael@0 | 120 | ok(success, "shouldn't throw"); |
michael@0 | 121 | |
michael@0 | 122 | // TEMPORARY workaround for leak bug 524037: send a mouseup event as |
michael@0 | 123 | // well so that we don't leak. |
michael@0 | 124 | var success = true; |
michael@0 | 125 | try { |
michael@0 | 126 | utils.sendMouseEvent("mouseup", 0, 0, 0, 1, 0); |
michael@0 | 127 | } |
michael@0 | 128 | catch(e) { |
michael@0 | 129 | success = false; |
michael@0 | 130 | } |
michael@0 | 131 | ok(success, "shouldn't throw"); |
michael@0 | 132 | |
michael@0 | 133 | </script> |
michael@0 | 134 | </pre> |
michael@0 | 135 | </body> |
michael@0 | 136 | </html> |