[Pkg-mozext-commits] [greasemonkey] 20/45: Delete corresponding temp files when a script source tab is closed.

David Prévot taffit at moszumanska.debian.org
Mon Nov 3 20:59:20 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository greasemonkey.

commit 6204f84f760ef51e7f52319b2ca3f3d132ce747f
Author: Ventero <ventero at ventero.de>
Date:   Mon Sep 8 00:30:14 2014 +0200

    Delete corresponding temp files when a script source tab is closed.
    
    Refs #2017
---
 modules/remoteScript.js | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/modules/remoteScript.js b/modules/remoteScript.js
index 31b4a0f..682d242 100644
--- a/modules/remoteScript.js
+++ b/modules/remoteScript.js
@@ -457,6 +457,14 @@ RemoteScript.prototype.showSource = function(aTabBrowser) {
   var tab = aTabBrowser.loadOneTab(
       ioService.newFileURI(this._scriptFile).spec,
       {'inBackground': false});
+
+  // Ensure any temporary files are deleted after the tab is closed.
+  var cleanup = GM_util.hitch(this, function() {
+    tab.removeEventListener("TabClose", cleanup, false);
+    this.cleanup();
+  });
+  tab.addEventListener("TabClose", cleanup, false);
+
   var notificationBox = aTabBrowser.getNotificationBox();
   notificationBox.appendNotification(
     stringBundleBrowser.GetStringFromName('greeting.msg'),
@@ -469,6 +477,9 @@ RemoteScript.prototype.showSource = function(aTabBrowser) {
       'popup': null,
       'callback': GM_util.hitch(this, function() {
         GM_util.showInstallDialog(this, aTabBrowser, GM_util.getService());
+        // Skip the cleanup handler, as the downloaded files are used in the
+        // installation process.
+        tab.removeEventListener("TabClose", cleanup, false);
         // Timeout puts this after the notification closes itself for the
         // button click, avoiding an error inside that (Firefox) code.
         GM_util.timeout(function() { aTabBrowser.removeTab(tab); }, 0);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/greasemonkey.git



More information about the Pkg-mozext-commits mailing list