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

Side by Side Diff: lib/filesystem/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 | « no previous file | lib/storage/io.js » ('j') | 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 var Utils = require("utils").Utils; 179 var Utils = require("utils").Utils;
180 Utils.runAsync(callback.bind(null, null, { 180 Utils.runAsync(callback.bind(null, null, {
181 exists: true, 181 exists: true,
182 isDirectory: false, 182 isDirectory: false,
183 isFile: true, 183 isFile: true,
184 lastModified: 0 184 lastModified: 0
185 })); 185 }));
186 return; 186 return;
187 } 187 }
188 188
189 this._getFileEntry(file, false, function(fs, fileEntry) 189 // This needs to use Utils.runAsync(), otherwise FilterStorage might
190 { 190 // initialize too early - see #337.
191 fileEntry.getMetadata(function(metadata) 191 require("utils").Utils.runAsync(function() {
192 this._getFileEntry(file, false, function(fs, fileEntry)
192 { 193 {
193 callback(null, { 194 fileEntry.getMetadata(function(metadata)
194 exists: true, 195 {
195 isDirectory: fileEntry.isDirectory, 196 callback(null, {
196 isFile: fileEntry.isFile, 197 exists: true,
197 lastModified: metadata.modificationTime.getTime() 198 isDirectory: fileEntry.isDirectory,
198 }); 199 isFile: fileEntry.isFile,
200 lastModified: metadata.modificationTime.getTime()
201 });
202 }, callback);
199 }, callback); 203 }, callback);
200 }, callback); 204 }.bind(this));
201 } 205 }
202 }; 206 };
OLDNEW
« no previous file with comments | « no previous file | lib/storage/io.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld