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=448600 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 448600</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 | </head> |
michael@0 | 11 | <body> |
michael@0 | 12 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=448600">Mozilla Bug 448600</a> |
michael@0 | 13 | <p id="display"></p> |
michael@0 | 14 | |
michael@0 | 15 | |
michael@0 | 16 | <pre id="test"> |
michael@0 | 17 | <script type="application/javascript"> |
michael@0 | 18 | |
michael@0 | 19 | function filename(uri) { |
michael@0 | 20 | return uri.substr(uri.lastIndexOf("/")+1); |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | function e(id) { |
michael@0 | 24 | return document.getElementById(id); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | var gLoadError = new Object(); |
michael@0 | 28 | |
michael@0 | 29 | gLoadError['video1'] = 0; |
michael@0 | 30 | gLoadError['video2'] = 0; |
michael@0 | 31 | gLoadError['video3'] = 0; |
michael@0 | 32 | |
michael@0 | 33 | var gErrorCount = 0; |
michael@0 | 34 | |
michael@0 | 35 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 36 | |
michael@0 | 37 | function finishTest() { |
michael@0 | 38 | is(e('video1').currentSrc, |
michael@0 | 39 | "", |
michael@0 | 40 | 'video1 currentSrc should be empty when there\'s no playable typed source children'); |
michael@0 | 41 | is(filename(e('video2').currentSrc), |
michael@0 | 42 | filename(e('video2').src), |
michael@0 | 43 | 'video2 currentSrc should match src'); |
michael@0 | 44 | is(filename(e('video3').currentSrc), |
michael@0 | 45 | filename(e('video3').src), |
michael@0 | 46 | 'video3 currentSrc should match src'); |
michael@0 | 47 | |
michael@0 | 48 | is(gLoadError['video1'], 2, "Expect one error per invalid source child on video1"); |
michael@0 | 49 | is(gLoadError['video2'], 1, "Expect one error on video2"); |
michael@0 | 50 | is(gLoadError['video3'], 1, "Expect one error on video3"); |
michael@0 | 51 | |
michael@0 | 52 | SimpleTest.finish(); |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | function videoError(event, id) { |
michael@0 | 56 | gLoadError[id]++; |
michael@0 | 57 | gErrorCount++; |
michael@0 | 58 | if (gErrorCount >= 4) { |
michael@0 | 59 | finishTest(); |
michael@0 | 60 | } |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | </script> |
michael@0 | 64 | <!-- We make the resource URIs unique to ensure that they are (re)loaded with the new disable-decoder prefs. --> |
michael@0 | 65 | <div id="content"> |
michael@0 | 66 | </div> |
michael@0 | 67 | <script> |
michael@0 | 68 | function makeVideos() { |
michael@0 | 69 | document.getElementById('content').innerHTML = '<video id="video1" preload="metadata"><source type="video/ogg" src="320x240.ogv?decoder_disabled=1" onerror="videoError(event, \'video1\');"/><source type="audio/wave" src="r11025_u8_c1.wav?decoder_disabled=1" id=\'s2\' onerror="videoError(event, \'video1\');"/></video><video id="video2" preload="metadata" src="320x240.ogv?decoder_disabled=2" onerror="videoError(event, \'video2\');"></video><video id="video3" preload="metadata" src="r11025_u8_c1.wav?decoder_disabled=2" onerror="videoError(event, \'video3\');"></video>'; |
michael@0 | 70 | } |
michael@0 | 71 | |
michael@0 | 72 | SpecialPowers.pushPrefEnv({"set": [["media.ogg.enabled", false], ["media.wave.enabled", false]]}, makeVideos); |
michael@0 | 73 | </script> |
michael@0 | 74 | |
michael@0 | 75 | </pre> |
michael@0 | 76 | |
michael@0 | 77 | </body> |
michael@0 | 78 | </html> |