[Pkg-mozext-commits] [adblock-plus] 06/22: Issue 530 - patterns.ini isn't being written on Firefox 20 (Permission denied)

David Prévot taffit at moszumanska.debian.org
Thu Jun 5 14:01:08 UTC 2014


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

taffit pushed a commit to branch master
in repository adblock-plus.

commit 7583b79db3ec68ab3844689832717e92e46e3a0b
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Wed May 21 16:48:47 2014 +0200

    Issue 530 - patterns.ini isn't being written on Firefox 20 (Permission denied)
    
    --HG--
    extra : rebase_source : f57c7f55a316e46db3c20abc7940c84f19de103f
---
 lib/io.js | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/lib/io.js b/lib/io.js
index aa2effc..dfe8b8f 100644
--- a/lib/io.js
+++ b/lib/io.js
@@ -25,8 +25,10 @@ let {OS} = Cu.import("resource://gre/modules/osfile.jsm", null);
 let {Task} = Cu.import("resource://gre/modules/Task.jsm", null);
 
 let {TimeLine} = require("timeline");
+let {Prefs} = require("prefs");
 let {Utils} = require("utils");
 
+let firstRead = true;
 const BUFFER_SIZE = 0x8000;  // 32kB
 
 let IO = exports.IO =
@@ -179,6 +181,25 @@ let IO = exports.IO =
       let array = new Uint8Array(BUFFER_SIZE);
       Task.spawn(function()
       {
+        if (firstRead && Services.vc.compare(Utils.platformVersion, "23.0a1") <= 0)
+        {
+          // See https://issues.adblockplus.org/ticket/530 - the first file
+          // opened cannot be closed due to Gecko bug 858723. Make sure that
+          // our patterns.ini file doesn't stay locked by opening a dummy file
+          // first.
+          try
+          {
+            let dummyPath = IO.resolveFilePath(Prefs.data_directory + "/dummy").path;
+            let dummy = yield OS.File.open(dummyPath, {write: true, truncate: true});
+            yield dummy.close();
+          }
+          catch (e)
+          {
+            // Dummy might be locked already, we don't care
+          }
+        }
+        firstRead = false;
+
         let f = yield OS.File.open(file.path, {read: true});
         let numBytes;
         do

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



More information about the Pkg-mozext-commits mailing list