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 | <head> |
michael@0 | 4 | <title>Mouse capture on area elements tests</title> |
michael@0 | 5 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 6 | <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 7 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 8 | </head> |
michael@0 | 9 | <body> |
michael@0 | 10 | <p id="display"></p> |
michael@0 | 11 | |
michael@0 | 12 | <div id="content"> |
michael@0 | 13 | <!-- The border="0" on the images is needed so that when we use |
michael@0 | 14 | synthesizeMouse we don't accidentally target the border of the image and |
michael@0 | 15 | miss the area because synthesizeMouse gets the rect of the primary frame |
michael@0 | 16 | of the target (the area), which is the image due to bug 135040, which |
michael@0 | 17 | includes the border, but the events targetted at the border aren't |
michael@0 | 18 | targeted at the area. --> |
michael@0 | 19 | |
michael@0 | 20 | <!-- 20x20 of red --> |
michael@0 | 21 | <img id="image" border="0" |
michael@0 | 22 | src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAG0lEQVR42mP8z0A%2BYKJA76jmUc2jmkc1U0EzACKcASfOgGoMAAAAAElFTkSuQmCC" |
michael@0 | 23 | usemap="#Map"/> |
michael@0 | 24 | |
michael@0 | 25 | <map name="Map"> |
michael@0 | 26 | <!-- area over the whole image --> |
michael@0 | 27 | <area id="area" onmousedown="this.setCapture();" onmouseup="this.releaseCapture();" |
michael@0 | 28 | shape="poly" coords="0,0, 0,20, 20,20, 20,0" href="javascript:void(0);"/> |
michael@0 | 29 | </map> |
michael@0 | 30 | |
michael@0 | 31 | |
michael@0 | 32 | <!-- 20x20 of red --> |
michael@0 | 33 | <img id="img1" border="0" |
michael@0 | 34 | src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAG0lEQVR42mP8z0A%2BYKJA76jmUc2jmkc1U0EzACKcASfOgGoMAAAAAElFTkSuQmCC" |
michael@0 | 35 | usemap="#sharedMap"/> |
michael@0 | 36 | |
michael@0 | 37 | <!-- 20x20 of red --> |
michael@0 | 38 | <img id="img2" border="0" |
michael@0 | 39 | src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAG0lEQVR42mP8z0A%2BYKJA76jmUc2jmkc1U0EzACKcASfOgGoMAAAAAElFTkSuQmCC" |
michael@0 | 40 | usemap="#sharedMap"/> |
michael@0 | 41 | |
michael@0 | 42 | <map name="sharedMap"> |
michael@0 | 43 | <!-- area over the whole image --> |
michael@0 | 44 | <area id="sharedarea" onmousedown="this.setCapture();" onmouseup="this.releaseCapture();" |
michael@0 | 45 | shape="poly" coords="0,0, 0,20, 20,20, 20,0" href="javascript:void(0);"/> |
michael@0 | 46 | </map> |
michael@0 | 47 | |
michael@0 | 48 | |
michael@0 | 49 | <div id="otherelement" style="width: 100px; height: 100px;"></div> |
michael@0 | 50 | </div> |
michael@0 | 51 | |
michael@0 | 52 | <pre id="test"> |
michael@0 | 53 | <script class="testbody" type="text/javascript"> |
michael@0 | 54 | |
michael@0 | 55 | SimpleTest.expectAssertions(3); |
michael@0 | 56 | |
michael@0 | 57 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 58 | |
michael@0 | 59 | function runTests() |
michael@0 | 60 | { |
michael@0 | 61 | //XXX We send a useless click to each image to force it to setup its image |
michael@0 | 62 | // map, because flushing layout won't do it. Hopefully bug 135040 will make |
michael@0 | 63 | // this not suck. |
michael@0 | 64 | synthesizeMouse($("image"), 5, 5, { type: "mousedown" }); |
michael@0 | 65 | synthesizeMouse($("image"), 5, 5, { type: "mouseup" }); |
michael@0 | 66 | synthesizeMouse($("img1"), 5, 5, { type: "mousedown" }); |
michael@0 | 67 | synthesizeMouse($("img1"), 5, 5, { type: "mouseup" }); |
michael@0 | 68 | synthesizeMouse($("img2"), 5, 5, { type: "mousedown" }); |
michael@0 | 69 | synthesizeMouse($("img2"), 5, 5, { type: "mouseup" }); |
michael@0 | 70 | |
michael@0 | 71 | |
michael@0 | 72 | // test that setCapture works on an area element (bug 517737) |
michael@0 | 73 | var area = document.getElementById("area"); |
michael@0 | 74 | synthesizeMouse(area, 5, 5, { type: "mousedown" }); |
michael@0 | 75 | synthesizeMouseExpectEvent($("otherelement"), 5, 5, { type: "mousemove" }, |
michael@0 | 76 | area, "mousemove", "setCapture works on areas"); |
michael@0 | 77 | synthesizeMouse(area, 5, 5, { type: "mouseup" }); |
michael@0 | 78 | |
michael@0 | 79 | // test that setCapture works on an area element when it is part of an image |
michael@0 | 80 | // map that is used by two images |
michael@0 | 81 | |
michael@0 | 82 | var img1 = document.getElementById("img1"); |
michael@0 | 83 | var sharedarea = document.getElementById("sharedarea"); |
michael@0 | 84 | // synthesizeMouse just sends the event by coordinates, so this is really a click on the area |
michael@0 | 85 | synthesizeMouse(img1, 5, 5, { type: "mousedown" }); |
michael@0 | 86 | synthesizeMouseExpectEvent($("otherelement"), 5, 5, { type: "mousemove" }, |
michael@0 | 87 | sharedarea, "mousemove", "setCapture works on areas with multiple images"); |
michael@0 | 88 | synthesizeMouse(img1, 5, 5, { type: "mouseup" }); |
michael@0 | 89 | |
michael@0 | 90 | var img2 = document.getElementById("img2"); |
michael@0 | 91 | // synthesizeMouse just sends the event by coordinates, so this is really a click on the area |
michael@0 | 92 | synthesizeMouse(img2, 5, 5, { type: "mousedown" }); |
michael@0 | 93 | synthesizeMouseExpectEvent($("otherelement"), 5, 5, { type: "mousemove" }, |
michael@0 | 94 | sharedarea, "mousemove", "setCapture works on areas with multiple images"); |
michael@0 | 95 | synthesizeMouse(img2, 5, 5, { type: "mouseup" }); |
michael@0 | 96 | |
michael@0 | 97 | // Bug 862673 - nuke all content so assertions in this test are attributed to |
michael@0 | 98 | // this test rather than the one which happens to follow. |
michael@0 | 99 | var content = document.getElementById("content"); |
michael@0 | 100 | content.parentNode.removeChild(content); |
michael@0 | 101 | SimpleTest.finish(); |
michael@0 | 102 | } |
michael@0 | 103 | |
michael@0 | 104 | SimpleTest.waitForFocus(runTests); |
michael@0 | 105 | |
michael@0 | 106 | </script> |
michael@0 | 107 | </pre> |
michael@0 | 108 | </body> |
michael@0 | 109 | </html> |