Backed out changeset 756948b3ac0f (bug 1269998) for unexpected file access of crashreporter.ini on startup. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Wed, 11 May 2016 10:44:57 +0200
changeset 337953 ad8395f134d7964187bc7491f41fbea18a133bd1
parent 337952 a6275b8c59d2272780bf0821f00d6cf26a2a4574
child 337954 3461f3cae78495f100a0f7d3d2e0b89292d3ec02
child 337978 398b93819760f0be5904bd9ab225f7cc8924d08e
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1269998
milestone49.0a1
backs out756948b3ac0f03a360d739ee5f54ad05d77d2386
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 756948b3ac0f (bug 1269998) for unexpected file access of crashreporter.ini on startup. r=backout
browser/components/nsBrowserGlue.js
browser/locales/en-US/chrome/browser/browser.properties
toolkit/crashreporter/CrashSubmit.jsm
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -119,21 +119,16 @@ if (AppConstants.E10S_TESTING_ONLY) {
                                     "resource://gre/modules/UpdateUtils.jsm");
 }
 
 XPCOMUtils.defineLazyModuleGetter(this, "TabCrashHandler",
                                   "resource:///modules/ContentCrashHandlers.jsm");
 if (AppConstants.MOZ_CRASHREPORTER) {
   XPCOMUtils.defineLazyModuleGetter(this, "PluginCrashReporter",
                                     "resource:///modules/ContentCrashHandlers.jsm");
-  XPCOMUtils.defineLazyModuleGetter(this, "CrashSubmit",
-                                    "resource://gre/modules/CrashSubmit.jsm");
-  XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
-                                    "resource://gre/modules/PluralForm.jsm");
-
 }
 
 XPCOMUtils.defineLazyGetter(this, "gBrandBundle", function() {
   return Services.strings.createBundle('chrome://branding/locale/brand.properties');
 });
 
 XPCOMUtils.defineLazyGetter(this, "gBrowserBundle", function() {
   return Services.strings.createBundle('chrome://browser/locale/browser.properties');
@@ -821,67 +816,16 @@ BrowserGlue.prototype = {
       let acceptableAge = Services.prefs.getIntPref("app.update.checkInstallTime.days") * millisecondsIn24Hours;
 
       if (buildDate + acceptableAge < today) {
         Cc["@mozilla.org/updates/update-service;1"].getService(Ci.nsIApplicationUpdateService).checkForBackgroundUpdates();
       }
     }
   },
 
-  checkForPendingCrashReports: function() {
-    // We don't process crash reports older than 28 days, so don't bother submitting them
-    let numDays = 28;
-    if (AppConstants.MOZ_CRASHREPORTER) {
-      let dateLimit = new Date();
-      dateLimit.setDate(dateLimit.getDate() - numDays);
-      CrashSubmit.pendingIDsAsync(dateLimit).then(
-        function onSuccess(ids) {
-          let count = ids.length;
-          if (count) {
-            let win = RecentWindow.getMostRecentBrowserWindow();
-            let nb =  win.document.getElementById("global-notificationbox");
-            let notification = nb.getNotificationWithValue("pending-crash-reports");
-            if (notification) {
-              return;
-            }
-            let buttons = [
-              {
-                label: win.gNavigatorBundle.getString("pendingCrashReports.submitAll"),
-                callback: function() {
-                  ids.forEach(function(id) {
-                    CrashSubmit.submit(id, {extraExtraKeyVals: {"SubmittedFromInfobar": true}});
-                  });
-                }
-              },
-              {
-                label: win.gNavigatorBundle.getString("pendingCrashReports.ignoreAll"),
-                callback: function() {
-                  ids.forEach(function(id) {
-                    CrashSubmit.ignore(id);
-                  });
-                }
-              },
-              {
-                label: win.gNavigatorBundle.getString("pendingCrashReports.viewAll"),
-                callback: function() {
-                  win.openUILinkIn("about:crashes", "tab");
-                }
-              }
-            ];
-            nb.appendNotification(PluralForm.get(count,
-                                                 win.gNavigatorBundle.getString("pendingCrashReports.label")).replace("#1", count),
-                                  "pending-crash-reports",
-                                  "chrome://browser/skin/tab-crashed.svg",
-                                  nb.PRIORITY_INFO_HIGH, buttons);
-          }
-        }
-      );
-    }
-  },
-
   _onSafeModeRestart: function BG_onSafeModeRestart() {
     // prompt the user to confirm
     let strings = gBrowserBundle;
     let promptTitle = strings.GetStringFromName("safeModeRestartPromptTitle");
     let promptMessage = strings.GetStringFromName("safeModeRestartPromptMessage");
     let restartText = strings.GetStringFromName("safeModeRestartButton");
     let buttonFlags = (Services.prompt.BUTTON_POS_0 *
                        Services.prompt.BUTTON_TITLE_IS_STRING) +
@@ -1122,20 +1066,16 @@ BrowserGlue.prototype = {
         if (removalSuccessful && uninstalledValue == "True") {
           this._resetProfileNotification("uninstall");
         }
       }
     }
 
     this._checkForOldBuildUpdates();
 
-    if ("release" != AppConstants.MOZ_UPDATE_CHANNEL) {
-      this.checkForPendingCrashReports();
-    }
-
     this._firstWindowTelemetry(aWindow);
     this._firstWindowLoaded();
   },
 
   /**
    * Application shutdown handler.
    */
   _onQuitApplicationGranted: function () {
--- a/browser/locales/en-US/chrome/browser/browser.properties
+++ b/browser/locales/en-US/chrome/browser/browser.properties
@@ -755,21 +755,16 @@ certErrorDetailsHSTS.label = HTTP Strict
 certErrorDetailsKeyPinning.label = HTTP Public Key Pinning: %S
 certErrorDetailsCertChain.label = Certificate chain:
 
 # LOCALIZATION NOTE (tabgroups.migration.anonGroup):
 # %S is the group number/ID
 tabgroups.migration.anonGroup = Group %S
 tabgroups.migration.tabGroupBookmarkFolderName = Bookmarked Tab Groups
 
-pendingCrashReports.label = You have an unsubmitted crash report;You have #1 unsubmitted crash reports
-pendingCrashReports.viewAll = View
-pendingCrashReports.submitAll = Submit
-pendingCrashReports.ignoreAll = Ignore
-
 decoder.noCodecs.button = Learn how
 decoder.noCodecs.accesskey = L
 decoder.noCodecs.message = To play video, you may need to install Microsoft’s Media Feature Pack.
 decoder.noCodecsVista.message = To play video, you may need to install Microsoft’s Platform Update Supplement for Windows Vista.
 decoder.noCodecsXP.message = To play video, you may need to enable Adobe’s Primetime Content Decryption Module.
 decoder.noCodecsLinux.message = To play video, you may need to install the required video codecs.
 decoder.noHWAcceleration.message = To improve video quality, you may need to install Microsoft’s Media Feature Pack.
 decoder.noHWAccelerationVista.message = To improve video quality, you may need to install Microsoft’s Platform Update Supplement for Windows Vista.
--- a/toolkit/crashreporter/CrashSubmit.jsm
+++ b/toolkit/crashreporter/CrashSubmit.jsm
@@ -6,32 +6,28 @@ const {classes: Cc, interfaces: Ci, util
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/KeyValueParser.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.importGlobalProperties(['File']);
 
 XPCOMUtils.defineLazyModuleGetter(this, "PromiseUtils",
                                   "resource://gre/modules/PromiseUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "OS",
-                                  "resource://gre/modules/osfile.jsm");
 
 this.EXPORTED_SYMBOLS = [
   "CrashSubmit"
 ];
 
 const STATE_START = Ci.nsIWebProgressListener.STATE_START;
 const STATE_STOP = Ci.nsIWebProgressListener.STATE_STOP;
 
 const SUCCESS = "success";
 const FAILED  = "failed";
 const SUBMITTING = "submitting";
 
-const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
-
 var reportURL = null;
 var strings = null;
 var myListener = null;
 
 function parseINIStrings(file) {
   var factory = Cc["@mozilla.org/xpcom/ini-parser-factory;1"].
                 getService(Ci.nsIINIParserFactory);
   var parser = factory.createINIParser(file);
@@ -475,107 +471,26 @@ this.CrashSubmit = {
     dump.remove(false);
     extra.remove(false);
     if (memory.exists()) {
       memory.remove(false);
     }
   },
 
   /**
-   * Add a .dmg.ignore file along side the .dmp file to indicate that the user
-   * shouldn't be prompted to submit this crash report again.
-   *
-   * @param id
-   *        Filename (minus .dmp extension) of the report to ignore
-   */
-
-  ignore: function CrashSubmit_ignore(id) {
-    let [dump, extra, mem] = getPendingMinidump(id);
-    return new Promise(
-      function (resolve, reject) {
-        let promise = OS.File.open(dump.path + ".ignore", {create: true}, {unixFlags:OS.Constants.libc.O_CREAT});
-        promise.then(
-          function createSuccess(file) {
-            file.close();
-            resolve();
-          }
-        );
-      }
-    )
-  },
-
-  /**
    * 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();
   },
 
   /**
-   * Get the list of pending crash IDs, exluding those marked to be ignored
-   * @param maxFileDate
-   *     A Date object. Any files last modified before that date will be ignored
-   *
-   * @return a Promise that is fulfilled with an array of string, each
-   * being an ID as expected to be passed to submit() or ignore()
-   */
-  pendingIDsAsync: function CrashSubmit_pendingIDsAsync(maxFileDate) {
-    let promise = new Promise(function(resolve, reject) {
-      OS.File.stat(getDir("pending").path).then(
-        function onSuccess(info) {
-          if (info.isDir) {
-            let iterator = new OS.File.DirectoryIterator(getDir("pending").path);
-            let ids = [];
-            iterator.forEach(
-              function onEntry(file) {
-                if (file.name.endsWith(".dmp")) {
-                  return OS.File.exists(file.path + ".ignore").then(
-                    function onSuccess(ignoreExists) {
-                      if (!ignoreExists) {
-                        let id = file.name.slice(0, -4);
-                        if (UUID_REGEX.test(id)) {
-                          return OS.File.stat(file.path).then(
-                            function onSuccess(info) {
-                              if (info.lastAccessDate.valueOf() > maxFileDate.valueOf()) {
-                                ids.push(id);
-                              }
-                            }
-                          );
-                        }
-                      }
-                    }
-                  );
-                }
-              }
-            ).then(
-              function onSuccess() {
-                iterator.close();
-                resolve(ids);
-              },
-              function onError(err) {
-                iterator.close();
-                reject(err);
-              }
-            );
-          } else {
-            reject();
-          }
-        },
-        function onError(err) {
-          reject(err);
-        }
-      )
-    });
-    return promise;
-  },
-
-  /**
    * Prune the saved dumps.
    */
   pruneSavedDumps: function CrashSubmit_pruneSavedDumps() {
     pruneSavedDumps();
   },
 
   // List of currently active submit objects
   _activeSubmissions: []