michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function runTests() { michael@0: let crashObserver = bgAddCrashObserver(); michael@0: michael@0: // make a good capture first - this ensures we have the michael@0: let goodUrl = bgTestPageURL(); michael@0: yield bgCapture(goodUrl); michael@0: ok(thumbnailExists(goodUrl), "Thumbnail should be cached after capture"); michael@0: removeThumbnail(goodUrl); michael@0: michael@0: // inject our content script. michael@0: let mm = bgInjectCrashContentScript(); michael@0: michael@0: // the observer for the crashing process is basically async, so it's hard michael@0: // to know when the has actually seen it. Easist is to just add michael@0: // our own observer. michael@0: Services.obs.addObserver(function onCrash() { michael@0: Services.obs.removeObserver(onCrash, "oop-frameloader-crashed"); michael@0: // spin the event loop to ensure the BPT observer was called. michael@0: executeSoon(function() { michael@0: // Now queue another capture and ensure it recovers. michael@0: bgCapture(goodUrl, { onDone: () => { michael@0: ok(thumbnailExists(goodUrl), "We should have recovered and handled new capture requests"); michael@0: removeThumbnail(goodUrl); michael@0: // Test done. michael@0: ok(crashObserver.crashed, "Saw a crash from this test"); michael@0: next(); michael@0: }}); michael@0: }); michael@0: } , "oop-frameloader-crashed", false); michael@0: michael@0: // Nothing is pending - crash the process. michael@0: info("Crashing the thumbnail content process."); michael@0: mm.sendAsyncMessage("thumbnails-test:crash"); michael@0: yield true; michael@0: }