Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 | // the observer for the crashing process is basically async, so it's hard |
michael@0 | 17 | // to know when the <browser> has actually seen it. Easist is to just add |
michael@0 | 18 | // our own observer. |
michael@0 | 19 | Services.obs.addObserver(function onCrash() { |
michael@0 | 20 | Services.obs.removeObserver(onCrash, "oop-frameloader-crashed"); |
michael@0 | 21 | // spin the event loop to ensure the BPT observer was called. |
michael@0 | 22 | executeSoon(function() { |
michael@0 | 23 | // Now queue another capture and ensure it recovers. |
michael@0 | 24 | bgCapture(goodUrl, { onDone: () => { |
michael@0 | 25 | ok(thumbnailExists(goodUrl), "We should have recovered and handled new capture requests"); |
michael@0 | 26 | removeThumbnail(goodUrl); |
michael@0 | 27 | // Test done. |
michael@0 | 28 | ok(crashObserver.crashed, "Saw a crash from this test"); |
michael@0 | 29 | next(); |
michael@0 | 30 | }}); |
michael@0 | 31 | }); |
michael@0 | 32 | } , "oop-frameloader-crashed", false); |
michael@0 | 33 | |
michael@0 | 34 | // Nothing is pending - crash the process. |
michael@0 | 35 | info("Crashing the thumbnail content process."); |
michael@0 | 36 | mm.sendAsyncMessage("thumbnails-test:crash"); |
michael@0 | 37 | yield true; |
michael@0 | 38 | } |