erestingCrashesAndMaybeNotify(data); } catch (ex) { if (!(ex instanceof lazy.RemoteSettingsClient.UnknownCollectionError)) { throw ex; } } }, async getPendingSha256(dateLimit) { // XXX: this will not report .ignore file; are we OK? let pendingIDs = await lazy.CrashSubmit.pendingIDs(dateLimit); if (pendingIDs.length === 0) { return []; } const uAppDataPath = Services.dirsvc.get("UAppData", Ci.nsIFile).path; const pendingDir = PathUtils.join(uAppDataPath, "Crash Reports", "pending"); let pendingSHA256 = await Promise.all( pendingIDs .map(id => { return { id, path: PathUtils.join(pendingDir, `${id}.dmp`) }; }) .filter(async e => { return await IOUtils.exists(e.path); }) .map(async e => { return { id: e.id, sha256: await lazy.CrashServiceUtils.computeMinidumpHash(e.path), }; }) ); return pendingSHA256; }, async checkForInterestingUnsubmittedCrash(records) { let dateLimit = new Date(); dateLimit.setDate(dateLimit.getDate() - PENDING_REMOTE_CRASH_REPORT_DAYS); const recordHashes = new Set(records.flatMap(entry => entry.hashes)); let pendingSHA256 = await this.getPendingSha256(dateLimit); let matches = pendingSHA256 .filter(pendingCrash => recordHashes.has(pendingCrash.sha256)) .map(pendingCrash => pendingCrash.id); return matches; }, async checkInterestingCrashesAndMaybeNotify(records) { const neverShowAgain = Services.prefs.getBoolPref( "browser.crashReports.requestedNeverShowAgain" ); if (neverShowAgain) { return; } let matches = await this.checkForInterestingUnsubmittedCrash(records); if (this._showCallback && matches.length) { await this._showCallback(matches, true); } }, }; PK