|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 * http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 function runTests() { |
|
5 let crashObserver = bgAddCrashObserver(); |
|
6 |
|
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); |
|
12 |
|
13 // inject our content script. |
|
14 let mm = bgInjectCrashContentScript(); |
|
15 |
|
16 // the observer for the crashing process is basically async, so it's hard |
|
17 // to know when the <browser> has actually seen it. Easist is to just add |
|
18 // our own observer. |
|
19 Services.obs.addObserver(function onCrash() { |
|
20 Services.obs.removeObserver(onCrash, "oop-frameloader-crashed"); |
|
21 // spin the event loop to ensure the BPT observer was called. |
|
22 executeSoon(function() { |
|
23 // Now queue another capture and ensure it recovers. |
|
24 bgCapture(goodUrl, { onDone: () => { |
|
25 ok(thumbnailExists(goodUrl), "We should have recovered and handled new capture requests"); |
|
26 removeThumbnail(goodUrl); |
|
27 // Test done. |
|
28 ok(crashObserver.crashed, "Saw a crash from this test"); |
|
29 next(); |
|
30 }}); |
|
31 }); |
|
32 } , "oop-frameloader-crashed", false); |
|
33 |
|
34 // Nothing is pending - crash the process. |
|
35 info("Crashing the thumbnail content process."); |
|
36 mm.sendAsyncMessage("thumbnails-test:crash"); |
|
37 yield true; |
|
38 } |