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 | <html xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 2 | <!-- |
michael@0 | 3 | https://bugzilla.mozilla.org/show_bug.cgi?id=628888 |
michael@0 | 4 | --> |
michael@0 | 5 | <head> |
michael@0 | 6 | <title>Test for Bug 628888 - Animations in external document sometimes don't run</title> |
michael@0 | 7 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 8 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 9 | </head> |
michael@0 | 10 | <body style="margin:0px"> |
michael@0 | 11 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=628888">Mozilla Bug 628888</a> |
michael@0 | 12 | <p id="display"></p> |
michael@0 | 13 | <div id="content" style="background: red; width: 50px; height: 50px"/> |
michael@0 | 14 | |
michael@0 | 15 | <pre id="test"> |
michael@0 | 16 | <script type="application/javascript"> |
michael@0 | 17 | <![CDATA[ |
michael@0 | 18 | |
michael@0 | 19 | /* Test for Bug 628888 - Animations in external document sometimes don't run |
michael@0 | 20 | * |
michael@0 | 21 | * This bug concerns a condition where an external document is loaded after the |
michael@0 | 22 | * page show event is dispatched, leaving the external document paused. |
michael@0 | 23 | * |
michael@0 | 24 | * To reproduce the bug we attach an external document with animation after the |
michael@0 | 25 | * page show event has fired. |
michael@0 | 26 | * |
michael@0 | 27 | * However, it is difficult to test if the animation is playing or not since we |
michael@0 | 28 | * don't receive events from animations running in an external document. |
michael@0 | 29 | * |
michael@0 | 30 | * Our approach is to simply render the result to a canvas (which requires |
michael@0 | 31 | * elevated privileges and that is why we are using a MochiTest rather |
michael@0 | 32 | * than a reftest) and poll one of the pixels to see if it changes colour. |
michael@0 | 33 | * |
michael@0 | 34 | * This should mean the test succeeds quickly but fails slowly. |
michael@0 | 35 | */ |
michael@0 | 36 | |
michael@0 | 37 | const POLL_INTERVAL = 100; // ms |
michael@0 | 38 | const POLL_TIMEOUT = 10000; // ms |
michael@0 | 39 | var accumulatedWaitTime = 0; |
michael@0 | 40 | |
michael@0 | 41 | function pageShow() |
michael@0 | 42 | { |
michael@0 | 43 | var content = document.getElementById("content"); |
michael@0 | 44 | content.style.filter = "url(smilExtDoc_helper.svg#filter)"; |
michael@0 | 45 | window.setTimeout(checkResult, 0); |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | function checkResult() |
michael@0 | 49 | { |
michael@0 | 50 | var content = document.getElementById("content"); |
michael@0 | 51 | var bbox = content.getBoundingClientRect(); |
michael@0 | 52 | |
michael@0 | 53 | var canvas = SpecialPowers.snapshotRect(window, bbox); |
michael@0 | 54 | var ctx = canvas.getContext("2d"); |
michael@0 | 55 | |
michael@0 | 56 | var imgd = ctx.getImageData(bbox.width/2, bbox.height/2, 1, 1); |
michael@0 | 57 | var isGreen = (imgd.data[0] == 0) && |
michael@0 | 58 | (imgd.data[1] == 255) && |
michael@0 | 59 | (imgd.data[2] == 0); |
michael@0 | 60 | if (isGreen) { |
michael@0 | 61 | ok(true, "Filter is animated as expected"); |
michael@0 | 62 | } else if (accumulatedWaitTime >= POLL_TIMEOUT) { |
michael@0 | 63 | ok(false, "No animation detected after waiting " + POLL_TIMEOUT + "ms"); |
michael@0 | 64 | } else { |
michael@0 | 65 | accumulatedWaitTime += POLL_INTERVAL; |
michael@0 | 66 | window.setTimeout(checkResult, POLL_INTERVAL); |
michael@0 | 67 | return; |
michael@0 | 68 | } |
michael@0 | 69 | // Hide our content since mochitests normally try to be visually "quiet" |
michael@0 | 70 | content.style.display = 'none'; |
michael@0 | 71 | SimpleTest.finish(); |
michael@0 | 72 | } |
michael@0 | 73 | window.addEventListener('pageshow', pageShow, false); |
michael@0 | 74 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 75 | ]]> |
michael@0 | 76 | </script> |
michael@0 | 77 | </pre> |
michael@0 | 78 | </body> |
michael@0 | 79 | </html> |