Bug 750583 - Empty out FUEL's gShutdown array in a less clownshoes manner. r=jlebar, a=lsblakk
authorPatrick Walton <pwalton@mozilla.com>
Wed, 09 May 2012 15:50:40 -0700
changeset 95686 fb8127fcaac4c2541101feff966b98a038baa619
parent 95685 1faea99701db8a1c322dda61eb50edb967fba48b
child 95687 22bc961260730dca599165fddc770613295a9f72
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlebar, lsblakk
bugs750583
milestone14.0a2
Bug 750583 - Empty out FUEL's gShutdown array in a less clownshoes manner. r=jlebar, a=lsblakk
toolkit/components/exthelper/extApplication.js
--- a/toolkit/components/exthelper/extApplication.js
+++ b/toolkit/components/exthelper/extApplication.js
@@ -585,19 +585,20 @@ extApplication.prototype = {
       if (this.events.dispatch("quit", "application") == false)
         aSubject.data = true;
     }
     else if (aTopic == "xpcom-shutdown") {
 
       this.events.dispatch("unload", "application");
 
       // call the cleanup functions and empty the array
-      while (gShutdown.length) {
-        gShutdown.shift()();
+      for (let i = 0; i < gShutdown.length; i++) {
+        gShutdown[i]();
       }
+      gShutdown.splice(0, gShutdown.length);
 
       // release our observers
       this._obs.removeObserver(this, "app-startup");
       this._obs.removeObserver(this, "final-ui-startup");
       this._obs.removeObserver(this, "quit-application-requested");
       this._obs.removeObserver(this, "xpcom-shutdown");
     }
   },