Sat, 03 Jan 2015 20:18:00 +0100
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=332636 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 332636</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 10 | <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 11 | </head> |
michael@0 | 12 | <body> |
michael@0 | 13 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=332636">Mozilla Bug 332636</a> |
michael@0 | 14 | <p id="display"></p> |
michael@0 | 15 | <div id="content"> |
michael@0 | 16 | <div id="edit0" contenteditable="true">axb</div><!-- reference: plane 0 base character --> |
michael@0 | 17 | <div id="edit1" contenteditable="true">äb</div><!-- reference: plane 0 diacritic --> |
michael@0 | 18 | <div id="edit2" contenteditable="true">a𐐀b</div><!-- plane 1 base character --> |
michael@0 | 19 | <div id="edit3" contenteditable="true">a𐨏b</div><!-- plane 1 diacritic --> |
michael@0 | 20 | |
michael@0 | 21 | <div id="edit0b" contenteditable="true">axb</div><!-- reference: plane 0 base character --> |
michael@0 | 22 | <div id="edit1b" contenteditable="true">äb</div><!-- reference: plane 0 diacritic --> |
michael@0 | 23 | <div id="edit2b" contenteditable="true">a𐐀b</div><!-- plane 1 base character --> |
michael@0 | 24 | <div id="edit3b" contenteditable="true">a𐨏b</div><!-- plane 1 diacritic --> |
michael@0 | 25 | </div> |
michael@0 | 26 | <pre id="test"> |
michael@0 | 27 | <script type="application/javascript"> |
michael@0 | 28 | |
michael@0 | 29 | /** Test for Bug 332636 **/ |
michael@0 | 30 | |
michael@0 | 31 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 32 | addLoadEvent(runTest); |
michael@0 | 33 | |
michael@0 | 34 | function test(edit) { |
michael@0 | 35 | edit.focus(); |
michael@0 | 36 | var sel = window.getSelection(); |
michael@0 | 37 | sel.collapse(edit.childNodes[0], edit.textContent.length - 1); |
michael@0 | 38 | synthesizeKey("VK_BACK_SPACE", {}); |
michael@0 | 39 | is(edit.textContent, "ab", "The backspace key should delete the UTF-16 surrogate pair correctly"); |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | function testWithMove(edit, offset) { |
michael@0 | 43 | edit.focus(); |
michael@0 | 44 | var sel = window.getSelection(); |
michael@0 | 45 | sel.collapse(edit.childNodes[0], 0); |
michael@0 | 46 | var i; |
michael@0 | 47 | for (i = 0; i < offset; ++i) { |
michael@0 | 48 | synthesizeKey("VK_RIGHT", {}); |
michael@0 | 49 | synthesizeKey("VK_LEFT", {}); |
michael@0 | 50 | synthesizeKey("VK_RIGHT", {}); |
michael@0 | 51 | } |
michael@0 | 52 | synthesizeKey("VK_BACK_SPACE", {}); |
michael@0 | 53 | is(edit.textContent, "ab", "The backspace key should delete the UTF-16 surrogate pair correctly"); |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | function runTest() { |
michael@0 | 57 | /* test backspace-deletion of the middle character */ |
michael@0 | 58 | test(document.getElementById("edit0")); |
michael@0 | 59 | test(document.getElementById("edit1")); |
michael@0 | 60 | test(document.getElementById("edit2")); |
michael@0 | 61 | test(document.getElementById("edit3")); |
michael@0 | 62 | |
michael@0 | 63 | /* extra tests with the use of RIGHT and LEFT to get to the right place */ |
michael@0 | 64 | testWithMove(document.getElementById("edit0b"), 2); |
michael@0 | 65 | testWithMove(document.getElementById("edit1b"), 1); |
michael@0 | 66 | testWithMove(document.getElementById("edit2b"), 2); |
michael@0 | 67 | testWithMove(document.getElementById("edit3b"), 1); |
michael@0 | 68 | |
michael@0 | 69 | SimpleTest.finish(); |
michael@0 | 70 | } |
michael@0 | 71 | |
michael@0 | 72 | </script> |
michael@0 | 73 | </pre> |
michael@0 | 74 | </body> |
michael@0 | 75 | </html> |