зеркало из https://github.com/mozilla/gecko-dev.git
Bug 814078 - Submit all the pending crash dumps. r=fabrice, r=bsmedberg, a=blocking-basecamp
This commit is contained in:
Родитель
3273699204
Коммит
9a8a457802
|
@ -134,6 +134,13 @@ var shell = {
|
|||
if (network.state == Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED
|
||||
&& network.type == Ci.nsINetworkInterface.NETWORK_TYPE_WIFI) {
|
||||
shell.CrashSubmit.submit(aCrashID);
|
||||
|
||||
// purge the queue.
|
||||
let pending = shell.CrashSubmit.pendingIDs();
|
||||
for (let crashid of pending) {
|
||||
shell.CrashSubmit.submit(crashid);
|
||||
}
|
||||
|
||||
Services.obs.removeObserver(observer, topic);
|
||||
}
|
||||
}, "network-interface-state-changed", false);
|
||||
|
|
|
@ -71,12 +71,17 @@ function getL10nStrings() {
|
|||
}
|
||||
}
|
||||
|
||||
function getPendingMinidump(id) {
|
||||
function getPendingDir() {
|
||||
let directoryService = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties);
|
||||
let pendingDir = directoryService.get("UAppData", Ci.nsIFile);
|
||||
pendingDir.append("Crash Reports");
|
||||
pendingDir.append("pending");
|
||||
return pendingDir;
|
||||
}
|
||||
|
||||
function getPendingMinidump(id) {
|
||||
let pendingDir = getPendingDir();
|
||||
let dump = pendingDir.clone();
|
||||
let extra = pendingDir.clone();
|
||||
dump.append(id + ".dmp");
|
||||
|
@ -84,6 +89,27 @@ function getPendingMinidump(id) {
|
|||
return [dump, extra];
|
||||
}
|
||||
|
||||
function getAllPendingMinidumpsIDs() {
|
||||
let minidumps = [];
|
||||
let pendingDir = getPendingDir();
|
||||
|
||||
if (!(pendingDir.exists() && pendingDir.isDirectory()))
|
||||
return [];
|
||||
let entries = pendingDir.directoryEntries;
|
||||
|
||||
while (entries.hasMoreElements()) {
|
||||
let entry = entries.getNext().QueryInterface(Ci.nsIFile);
|
||||
if (entry.isFile()) {
|
||||
entry.leafName
|
||||
let matches = entry.leafName.match(/(.+)\.extra$/);
|
||||
if (matches)
|
||||
minidumps.push(matches[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return minidumps;
|
||||
}
|
||||
|
||||
function addFormEntry(doc, form, name, value) {
|
||||
var input = doc.createElement("input");
|
||||
input.type = "hidden";
|
||||
|
@ -351,6 +377,16 @@ this.CrashSubmit = {
|
|||
return submitter.submit();
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the list of pending crash IDs.
|
||||
*
|
||||
* @return an array of string, each being an ID as
|
||||
* expected to be passed to submit()
|
||||
*/
|
||||
pendingIDs: function CrashSubmit_pendingIDs() {
|
||||
return getAllPendingMinidumpsIDs();
|
||||
},
|
||||
|
||||
// List of currently active submit objects
|
||||
_activeSubmissions: []
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче