dom/events/test/test_bug855741.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=855741
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 855741</title>
michael@0 8 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
michael@0 9 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 11 </head>
michael@0 12 <body>
michael@0 13 <p id="display"></p>
michael@0 14 <div id="content" style="display: none">
michael@0 15 </div>
michael@0 16 <input type="text" id="testTarget" value="focus">
michael@0 17 <pre id="test">
michael@0 18 <script class="testbody" type="text/javascript">
michael@0 19
michael@0 20 /** Test for Bug 855741 **/
michael@0 21 function testFocusEvent(event) {
michael@0 22 ok(('relatedTarget' in event), 'FocusEvent.relatedTarget exists');
michael@0 23
michael@0 24 if (event.construct_test == true) {
michael@0 25 ok(event.relatedTarget == $("content"), 'FocusEvent.relatedTarget is ' + $("content").id);
michael@0 26 }
michael@0 27 }
michael@0 28
michael@0 29 function testUIEvent(event) {
michael@0 30 ok((event.detail == 0),
michael@0 31 'UIEvent.detail should be 0 in ' + event.target.value + ' event');
michael@0 32
michael@0 33 ok((event.defaultView == null),
michael@0 34 'UIEvent.defaultView should be null in ' + event.target.value + ' event');
michael@0 35 }
michael@0 36
michael@0 37 function testEventType(event, type) {
michael@0 38 ok((event.type == type), 'Event.type match: ' + type);
michael@0 39 }
michael@0 40
michael@0 41 function eventhandle(event) {
michael@0 42 testFocusEvent(event);
michael@0 43 testUIEvent(event);
michael@0 44 testEventType(event, event.target.value);
michael@0 45
michael@0 46 if (event.target.value == 'blur') {
michael@0 47 event.target.value = 'focus';
michael@0 48 } else {
michael@0 49 event.target.value = 'blur';
michael@0 50 }
michael@0 51 }
michael@0 52
michael@0 53 //
michael@0 54 // event handler:
michael@0 55 //
michael@0 56 $("testTarget").addEventListener("focus", eventhandle, true);
michael@0 57 $("testTarget").addEventListener("blur", eventhandle, true);
michael@0 58
michael@0 59 //
michael@0 60 // FocusEvent structure test
michael@0 61 //
michael@0 62 $("testTarget").focus();
michael@0 63 $("testTarget").blur();
michael@0 64
michael@0 65 //
michael@0 66 // Focus/Blur constructor test
michael@0 67 //
michael@0 68 var focus_event = new FocusEvent("focus",
michael@0 69 {bubbles: true,
michael@0 70 cancelable: true,
michael@0 71 relatedTarget: $("content")});
michael@0 72 focus_event.construct_test = true;
michael@0 73
michael@0 74 var blur_event = new FocusEvent("blur",
michael@0 75 {bubbles: true,
michael@0 76 cancelable: true,
michael@0 77 relatedTarget: $("content")});
michael@0 78 blur_event.construct_test = true;
michael@0 79
michael@0 80 // create cycle referece for leak test
michael@0 81 $("content").foo_focus = focus_event;
michael@0 82 $("content").foo_blur = blur_event;
michael@0 83
michael@0 84 $("testTarget").dispatchEvent(focus_event);
michael@0 85 $("testTarget").dispatchEvent(blur_event);
michael@0 86
michael@0 87 </script>
michael@0 88 </pre>
michael@0 89 </body>
michael@0 90 </html>

mercurial