toolkit/components/thumbnails/test/browser_thumbnails_bg_crash_during_capture.js

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 /* Any copyright is dedicated to the Public Domain.
michael@0 2 * http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 function runTests() {
michael@0 5 let crashObserver = bgAddCrashObserver();
michael@0 6
michael@0 7 // make a good capture first - this ensures we have the <browser>
michael@0 8 let goodUrl = bgTestPageURL();
michael@0 9 yield bgCapture(goodUrl);
michael@0 10 ok(thumbnailExists(goodUrl), "Thumbnail should be cached after capture");
michael@0 11 removeThumbnail(goodUrl);
michael@0 12
michael@0 13 // inject our content script.
michael@0 14 let mm = bgInjectCrashContentScript();
michael@0 15
michael@0 16 // queue up 2 captures - the first has a wait, so this is the one that
michael@0 17 // will die. The second one should immediately capture after the crash.
michael@0 18 let waitUrl = bgTestPageURL({ wait: 30000 });
michael@0 19 let sawWaitUrlCapture = false;
michael@0 20 bgCapture(waitUrl, { onDone: () => {
michael@0 21 sawWaitUrlCapture = true;
michael@0 22 ok(!thumbnailExists(waitUrl), "Thumbnail should not have been saved due to the crash");
michael@0 23 }});
michael@0 24 bgCapture(goodUrl, { onDone: () => {
michael@0 25 ok(sawWaitUrlCapture, "waitUrl capture should have finished first");
michael@0 26 ok(thumbnailExists(goodUrl), "We should have recovered and completed the 2nd capture after the crash");
michael@0 27 removeThumbnail(goodUrl);
michael@0 28 // Test done.
michael@0 29 ok(crashObserver.crashed, "Saw a crash from this test");
michael@0 30 next();
michael@0 31 }});
michael@0 32
michael@0 33 info("Crashing the thumbnail content process.");
michael@0 34 mm.sendAsyncMessage("thumbnails-test:crash");
michael@0 35 yield true;
michael@0 36 }

mercurial