toolkit/components/thumbnails/test/browser_thumbnails_bg_crash_during_capture.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial