OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } catch (e) { | 89 } catch (e) { |
90 WebInspector.console.error("Invalid project file: " + projec
tText); | 90 WebInspector.console.error("Invalid project file: " + projec
tText); |
91 } | 91 } |
92 } | 92 } |
93 resolve(fileSystem); | 93 resolve(fileSystem); |
94 } | 94 } |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 /** | 98 /** |
99 * @param {!FileError} error | 99 * @param {!DOMException} error |
100 * @return {string} | 100 * @return {string} |
101 */ | 101 */ |
102 WebInspector.IsolatedFileSystem.errorMessage = function(error) | 102 WebInspector.IsolatedFileSystem.errorMessage = function(error) |
103 { | 103 { |
104 return WebInspector.UIString("File system error: %s", error.message); | 104 return WebInspector.UIString("File system error: %s", error.message); |
105 } | 105 } |
106 | 106 |
107 WebInspector.IsolatedFileSystem.prototype = { | 107 WebInspector.IsolatedFileSystem.prototype = { |
108 /** | 108 /** |
109 * @return {string} | 109 * @return {string} |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 function fileCreated(entry) | 209 function fileCreated(entry) |
210 { | 210 { |
211 callback(entry.fullPath.substr(1)); | 211 callback(entry.fullPath.substr(1)); |
212 } | 212 } |
213 | 213 |
214 /** | 214 /** |
215 * @this {WebInspector.IsolatedFileSystem} | 215 * @this {WebInspector.IsolatedFileSystem} |
216 */ | 216 */ |
217 function fileCreationError(error) | 217 function fileCreationError(error) |
218 { | 218 { |
219 if (error.code === FileError.INVALID_MODIFICATION_ERR) { | 219 if (error.name === 'InvalidModificationError') { |
220 dirEntryLoaded.call(this, dirEntry); | 220 dirEntryLoaded.call(this, dirEntry); |
221 return; | 221 return; |
222 } | 222 } |
223 | 223 |
224 var errorMessage = WebInspector.IsolatedFileSystem.errorMessage(
error); | 224 var errorMessage = WebInspector.IsolatedFileSystem.errorMessage(
error); |
225 console.error(errorMessage + " when testing if file exists '" +
(this._path + "/" + path + "/" + nameCandidate) + "'"); | 225 console.error(errorMessage + " when testing if file exists '" +
(this._path + "/" + path + "/" + nameCandidate) + "'"); |
226 callback(null); | 226 callback(null); |
227 } | 227 } |
228 } | 228 } |
229 | 229 |
(...skipping 25 matching lines...) Expand all Loading... |
255 function fileEntryLoaded(fileEntry) | 255 function fileEntryLoaded(fileEntry) |
256 { | 256 { |
257 fileEntry.remove(fileEntryRemoved, errorHandler.bind(this)); | 257 fileEntry.remove(fileEntryRemoved, errorHandler.bind(this)); |
258 } | 258 } |
259 | 259 |
260 function fileEntryRemoved() | 260 function fileEntryRemoved() |
261 { | 261 { |
262 } | 262 } |
263 | 263 |
264 /** | 264 /** |
265 * @param {!FileError} error | 265 * @param {!DOMException} error |
266 * @this {WebInspector.IsolatedFileSystem} | 266 * @this {WebInspector.IsolatedFileSystem} |
267 */ | 267 */ |
268 function errorHandler(error) | 268 function errorHandler(error) |
269 { | 269 { |
270 var errorMessage = WebInspector.IsolatedFileSystem.errorMessage(erro
r); | 270 var errorMessage = WebInspector.IsolatedFileSystem.errorMessage(erro
r); |
271 console.error(errorMessage + " when deleting file '" + (this._path +
"/" + path) + "'"); | 271 console.error(errorMessage + " when deleting file '" + (this._path +
"/" + path) + "'"); |
272 } | 272 } |
273 }, | 273 }, |
274 | 274 |
275 /** | 275 /** |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 console.error("Can't read file: " + path + ": " + e); | 315 console.error("Can't read file: " + path + ": " + e); |
316 } | 316 } |
317 callback(string); | 317 callback(string); |
318 } | 318 } |
319 | 319 |
320 /** | 320 /** |
321 * @this {WebInspector.IsolatedFileSystem} | 321 * @this {WebInspector.IsolatedFileSystem} |
322 */ | 322 */ |
323 function errorHandler(error) | 323 function errorHandler(error) |
324 { | 324 { |
325 if (error.code === FileError.NOT_FOUND_ERR) { | 325 if (error.name === 'NotFoundError') { |
326 callback(null); | 326 callback(null); |
327 return; | 327 return; |
328 } | 328 } |
329 | 329 |
330 var errorMessage = WebInspector.IsolatedFileSystem.errorMessage(erro
r); | 330 var errorMessage = WebInspector.IsolatedFileSystem.errorMessage(erro
r); |
331 console.error(errorMessage + " when getting content for file '" + (t
his._path + "/" + path) + "'"); | 331 console.error(errorMessage + " when getting content for file '" + (t
his._path + "/" + path) + "'"); |
332 callback(null); | 332 callback(null); |
333 } | 333 } |
334 }, | 334 }, |
335 | 335 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 function newFileEntryLoaded(entry) | 429 function newFileEntryLoaded(entry) |
430 { | 430 { |
431 callback(false); | 431 callback(false); |
432 } | 432 } |
433 | 433 |
434 /** | 434 /** |
435 * @this {WebInspector.IsolatedFileSystem} | 435 * @this {WebInspector.IsolatedFileSystem} |
436 */ | 436 */ |
437 function newFileEntryLoadErrorHandler(error) | 437 function newFileEntryLoadErrorHandler(error) |
438 { | 438 { |
439 if (error.code !== FileError.NOT_FOUND_ERR) { | 439 if (error.name !== 'NotFoundError') { |
440 callback(false); | 440 callback(false); |
441 return; | 441 return; |
442 } | 442 } |
443 fileEntry.moveTo(dirEntry, newName, fileRenamed, errorHandler.bind(t
his)); | 443 fileEntry.moveTo(dirEntry, newName, fileRenamed, errorHandler.bind(t
his)); |
444 } | 444 } |
445 | 445 |
446 /** | 446 /** |
447 * @param {!FileEntry} entry | 447 * @param {!FileEntry} entry |
448 */ | 448 */ |
449 function fileRenamed(entry) | 449 function fileRenamed(entry) |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 /** | 608 /** |
609 * @param {!WebInspector.Progress} progress | 609 * @param {!WebInspector.Progress} progress |
610 */ | 610 */ |
611 indexContent: function(progress) | 611 indexContent: function(progress) |
612 { | 612 { |
613 progress.setTotalWork(1); | 613 progress.setTotalWork(1); |
614 var requestId = this._manager.registerProgress(progress); | 614 var requestId = this._manager.registerProgress(progress); |
615 InspectorFrontendHost.indexPath(requestId, this._embedderPath); | 615 InspectorFrontendHost.indexPath(requestId, this._embedderPath); |
616 } | 616 } |
617 } | 617 } |
OLD | NEW |