dom/ipc/tests/process_error.xul

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
michael@0 3
michael@0 4 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 5 orient="vertical">
michael@0 6
michael@0 7 <browser id="thebrowser" type="content" remote="true" />
michael@0 8 <script type="application/javascript"><![CDATA[
michael@0 9 Components.utils.import("resource://gre/modules/Services.jsm");
michael@0 10
michael@0 11 const ok = window.opener.wrappedJSObject.ok;
michael@0 12 const is = window.opener.wrappedJSObject.is;
michael@0 13 const done = window.opener.wrappedJSObject.done;
michael@0 14 const SimpleTest = window.opener.wrappedJSObject.SimpleTest;
michael@0 15
michael@0 16 function getMinidumpDirectory() {
michael@0 17 var dir = Services.dirsvc.get('ProfD', Components.interfaces.nsIFile);
michael@0 18 dir.append("minidumps");
michael@0 19 return dir;
michael@0 20 }
michael@0 21
michael@0 22 function removeFile(directory, filename) {
michael@0 23 var file = directory.clone();
michael@0 24 file.append(filename);
michael@0 25 if (file.exists()) {
michael@0 26 file.remove(false);
michael@0 27 }
michael@0 28 }
michael@0 29
michael@0 30 function crashObserver(subject, topic, data) {
michael@0 31 is(topic, 'ipc:content-shutdown', 'Received correct observer topic.');
michael@0 32 ok(subject instanceof Components.interfaces.nsIPropertyBag2,
michael@0 33 'Subject implements nsIPropertyBag2.');
michael@0 34
michael@0 35 var dumpID;
michael@0 36 if ('nsICrashReporter' in Components.interfaces) {
michael@0 37 dumpID = subject.getPropertyAsAString('dumpID');
michael@0 38 ok(dumpID, "dumpID is present and not an empty string");
michael@0 39 }
michael@0 40
michael@0 41 if (dumpID) {
michael@0 42 var minidumpDirectory = getMinidumpDirectory();
michael@0 43 removeFile(minidumpDirectory, dumpID + '.dmp');
michael@0 44 removeFile(minidumpDirectory, dumpID + '.extra');
michael@0 45 }
michael@0 46
michael@0 47 Services.obs.removeObserver(crashObserver, 'ipc:content-shutdown');
michael@0 48 done();
michael@0 49 }
michael@0 50 Services.obs.addObserver(crashObserver, 'ipc:content-shutdown', false);
michael@0 51
michael@0 52 document.getElementById('thebrowser')
michael@0 53 .QueryInterface(Components.interfaces.nsIFrameLoaderOwner)
michael@0 54 .frameLoader.messageManager
michael@0 55 .loadFrameScript('chrome://mochitests/content/chrome/dom/ipc/tests/process_error_contentscript.js', true);
michael@0 56 ]]></script>
michael@0 57
michael@0 58 </window>

mercurial