Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | function check_crash_list(tab, crashes) { |
michael@0 | 2 | let doc = gBrowser.getBrowserForTab(tab).contentDocument; |
michael@0 | 3 | let crashlinks = doc.getElementById("tbody").getElementsByTagName("a"); |
michael@0 | 4 | is(crashlinks.length, crashes.length, "about:crashes lists correct number of crash reports"); |
michael@0 | 5 | for(let i = 0; i < crashes.length; i++) { |
michael@0 | 6 | is(crashlinks[i].firstChild.textContent, crashes[i].id, i + ": crash ID is correct"); |
michael@0 | 7 | } |
michael@0 | 8 | cleanup_fake_appdir(); |
michael@0 | 9 | gBrowser.removeTab(tab); |
michael@0 | 10 | finish(); |
michael@0 | 11 | } |
michael@0 | 12 | |
michael@0 | 13 | function test() { |
michael@0 | 14 | waitForExplicitFinish(); |
michael@0 | 15 | let appD = make_fake_appdir(); |
michael@0 | 16 | let crD = appD.clone(); |
michael@0 | 17 | crD.append("Crash Reports"); |
michael@0 | 18 | let crashes = add_fake_crashes(crD, 5); |
michael@0 | 19 | // sanity check |
michael@0 | 20 | let dirSvc = Components.classes["@mozilla.org/file/directory_service;1"] |
michael@0 | 21 | .getService(Components.interfaces.nsIProperties); |
michael@0 | 22 | let appDtest = dirSvc.get("UAppData", Components.interfaces.nsILocalFile); |
michael@0 | 23 | ok(appD.equals(appDtest), "directory service provider registered ok"); |
michael@0 | 24 | let tab = gBrowser.selectedTab = gBrowser.addTab("about:blank"); |
michael@0 | 25 | let browser = gBrowser.getBrowserForTab(tab); |
michael@0 | 26 | browser.addEventListener("load", function() { |
michael@0 | 27 | browser.removeEventListener("load", arguments.callee, true); |
michael@0 | 28 | ok(true, "about:crashes loaded"); |
michael@0 | 29 | executeSoon(function() { check_crash_list(tab, crashes); }); |
michael@0 | 30 | }, true); |
michael@0 | 31 | browser.loadURI("about:crashes", null, null); |
michael@0 | 32 | } |