Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/storage/io.js

Issue 5713134241185792: Issue 337 - Race condition preventing initialization on first run (Closed)
Patch Set: Created April 16, 2014, 9:45 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/filesystem/io.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 { 109 {
110 var path = this._getFilePath(file); 110 var path = this._getFilePath(file);
111 delete ext.storage[path]; 111 delete ext.storage[path];
112 delete ext.storage[path + "/lastModified"]; 112 delete ext.storage[path + "/lastModified"];
113 callback(null); 113 callback(null);
114 }, 114 },
115 115
116 statFile: function(file, callback) 116 statFile: function(file, callback)
117 { 117 {
118 var path = this._getFilePath(file); 118 var path = this._getFilePath(file);
119 callback(null, { 119
120 // This needs to use Utils.runAsync(), otherwise FilterStorage might
121 // initialize too early - see #337.
122 require("utils").Utils.runAsync(callback.bind(null, null, {
120 exists: path in ext.storage, 123 exists: path in ext.storage,
121 isDirectory: false, 124 isDirectory: false,
122 isFile: true, 125 isFile: true,
123 lastModified: parseInt(ext.storage[path + "/lastModified"], 10) || 0 126 lastModified: parseInt(ext.storage[path + "/lastModified"], 10) || 0
124 }); 127 }));
125 } 128 }
126 }; 129 };
OLDNEW
« no previous file with comments | « lib/filesystem/io.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld