1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
5 <!ENTITY % globalDTD SYSTEM
"chrome://global/locale/global.dtd">
6 <!ENTITY % crashesDTD SYSTEM
"chrome://global/locale/crashes.dtd">
11 <html xmlns=
"http://www.w3.org/1999/xhtml">
13 <style type=
"text/css">
15 font-family: sans-serif;
26 -moz-padding-end:
2em;
30 -moz-padding-start:
1em;
31 -moz-padding-end:
.5em;
36 -moz-padding-start:
.5em;
46 .clear-reports[
chromedir=
"rtl"] {
50 <link rel=
"stylesheet" media=
"screen, projection" type=
"text/css"
51 href=
"chrome://global/skin/dirListing/dirListing.css"/>
52 <script type=
"application/javascript">
54 const Cc = Components.classes;
55 const Ci = Components.interfaces;
59 function findInsertionPoint(reports, date) {
60 if (reports.length ==
0)
64 var max = reports.length -
1;
66 var mid = parseInt((min + max) /
2);
67 if (reports[mid].date < date)
69 else if (reports[mid].date
> date)
74 if (reports[min].date <= date)
79 function populateReportList() {
80 var prefService = Cc[
"@mozilla.org/preferences-service;1"].
81 getService(Ci.nsIPrefBranch);
85 reportURL = prefService.getCharPref(
"breakpad.reportURL");
86 // Ignore any non http/https urls
87 if (!/^https?:/i.test(reportURL))
92 document.getElementById(
"reportList").style.display =
"none";
93 document.getElementById(
"noConfig").style.display =
"block";
96 var directoryService = Cc[
"@mozilla.org/file/directory_service;1"].
97 getService(Ci.nsIProperties);
99 reportsDir = directoryService.get(
"UAppData", Ci.nsIFile);
100 reportsDir.append(
"Crash Reports");
101 reportsDir.append(
"submitted");
104 if (reportsDir.exists() && reportsDir.isDirectory()) {
105 var entries = reportsDir.directoryEntries;
106 while (entries.hasMoreElements()) {
107 var file = entries.getNext().QueryInterface(Ci.nsIFile);
108 var leaf = file.leafName;
109 if (leaf.substring(
0,
3) ==
"bp-" &&
110 leaf.substring(leaf.length -
4) ==
".txt") {
112 id: leaf.substring(
3, leaf.length -
4),
113 date: file.lastModifiedTime
115 var pos = findInsertionPoint(reports, entry.date);
116 reports.splice(pos,
0, entry);
121 if (reports.length ==
0) {
122 document.getElementById(
"reportList").style.display =
"none";
123 document.getElementById(
"noReports").style.display =
"block";
127 var formatter = Cc[
"@mozilla.org/intl/scriptabledateformat;1"].
128 createInstance(Ci.nsIScriptableDateFormat);
129 var body = document.getElementById(
"tbody");
130 for (var i =
0; i < reports.length; i++) {
131 var row = document.createElement(
"tr");
132 var cell = document.createElement(
"td");
133 row.appendChild(cell);
134 var link = document.createElement(
"a");
135 link.setAttribute(
"href", reportURL + reports[i].id);
136 link.appendChild(document.createTextNode(reports[i].id));
137 cell.appendChild(link);
139 var date = new Date(reports[i].date);
140 cell = document.createElement(
"td");
141 var datestr = formatter.FormatDate(
"",
142 Ci.nsIScriptableDateFormat.dateFormatShort,
146 cell.appendChild(document.createTextNode(datestr));
147 row.appendChild(cell);
148 cell = document.createElement(
"td");
149 var timestr = formatter.FormatTime(
"",
150 Ci.nsIScriptableDateFormat.timeFormatNoSeconds,
154 cell.appendChild(document.createTextNode(timestr));
155 row.appendChild(cell);
156 body.appendChild(row);
160 function clearReports() {
161 var bundles = Cc[
"@mozilla.org/intl/stringbundle;1"].
162 getService(Ci.nsIStringBundleService);
163 var bundle = bundles.createBundle(
"chrome://global/locale/crashes.properties");
164 var prompts = Cc[
"@mozilla.org/embedcomp/prompt-service;1"].
165 getService(Ci.nsIPromptService);
166 if (!prompts.confirm(window,
167 bundle.GetStringFromName(
"deleteconfirm.title"),
168 bundle.GetStringFromName(
"deleteconfirm.description")))
171 var entries = reportsDir.directoryEntries;
172 while (entries.hasMoreElements()) {
173 var file = entries.getNext().QueryInterface(Ci.nsIFile);
174 var leaf = file.leafName;
175 if (leaf.substring(
0,
3) ==
"bp-" &&
176 leaf.substring(leaf.length -
4) ==
".txt") {
180 document.getElementById(
"reportList").style.display =
"none";
181 document.getElementById(
"noReports").style.display =
"block";
185 <title>&crashes.title;
</title>
186 </head><body onload=
"populateReportList()" dir=
"&locale.dir;">
187 <button chromedir=
"&locale.dir;" class=
"clear-reports"
188 onclick=
"clearReports()">&clearReports.label;
</button>
189 <h1>&crashes.title;
</h1>
190 <div id=
"reportList">
194 <th chromedir=
"&locale.dir;">&id.heading;
</th>
195 <th chromedir=
"&locale.dir;" colspan=
"2">&date.heading;
</th>
202 <p id=
"noReports" style=
"display: none">&noReports.label;
</p>
203 <p id=
"noConfig" style=
"display: none">&noConfig.label;
</p>