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 27 matching lines...) Expand all Loading... |
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 {!FileError} error |
266 * @this {WebInspector.IsolatedFileSystem} | 266 * @this {WebInspector.IsolatedFileSystem} |
| 267 * @suppress {checkTypes} |
| 268 * TODO(jsbell): Update externs replacing FileError with DOMException. h
ttps://crbug.com/496901 |
267 */ | 269 */ |
268 function errorHandler(error) | 270 function errorHandler(error) |
269 { | 271 { |
270 var errorMessage = WebInspector.IsolatedFileSystem.errorMessage(erro
r); | 272 var errorMessage = WebInspector.IsolatedFileSystem.errorMessage(erro
r); |
271 console.error(errorMessage + " when deleting file '" + (this._path +
"/" + path) + "'"); | 273 console.error(errorMessage + " when deleting file '" + (this._path +
"/" + path) + "'"); |
272 } | 274 } |
273 }, | 275 }, |
274 | 276 |
275 /** | 277 /** |
276 * @param {string} path | 278 * @param {string} path |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 console.error("Can't read file: " + path + ": " + e); | 317 console.error("Can't read file: " + path + ": " + e); |
316 } | 318 } |
317 callback(string); | 319 callback(string); |
318 } | 320 } |
319 | 321 |
320 /** | 322 /** |
321 * @this {WebInspector.IsolatedFileSystem} | 323 * @this {WebInspector.IsolatedFileSystem} |
322 */ | 324 */ |
323 function errorHandler(error) | 325 function errorHandler(error) |
324 { | 326 { |
325 if (error.code === FileError.NOT_FOUND_ERR) { | 327 if (error.name === 'NotFoundError') { |
326 callback(null); | 328 callback(null); |
327 return; | 329 return; |
328 } | 330 } |
329 | 331 |
330 var errorMessage = WebInspector.IsolatedFileSystem.errorMessage(erro
r); | 332 var errorMessage = WebInspector.IsolatedFileSystem.errorMessage(erro
r); |
331 console.error(errorMessage + " when getting content for file '" + (t
his._path + "/" + path) + "'"); | 333 console.error(errorMessage + " when getting content for file '" + (t
his._path + "/" + path) + "'"); |
332 callback(null); | 334 callback(null); |
333 } | 335 } |
334 }, | 336 }, |
335 | 337 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 function newFileEntryLoaded(entry) | 431 function newFileEntryLoaded(entry) |
430 { | 432 { |
431 callback(false); | 433 callback(false); |
432 } | 434 } |
433 | 435 |
434 /** | 436 /** |
435 * @this {WebInspector.IsolatedFileSystem} | 437 * @this {WebInspector.IsolatedFileSystem} |
436 */ | 438 */ |
437 function newFileEntryLoadErrorHandler(error) | 439 function newFileEntryLoadErrorHandler(error) |
438 { | 440 { |
439 if (error.code !== FileError.NOT_FOUND_ERR) { | 441 if (error.name !== 'NotFoundError') { |
440 callback(false); | 442 callback(false); |
441 return; | 443 return; |
442 } | 444 } |
443 fileEntry.moveTo(dirEntry, newName, fileRenamed, errorHandler.bind(t
his)); | 445 fileEntry.moveTo(dirEntry, newName, fileRenamed, errorHandler.bind(t
his)); |
444 } | 446 } |
445 | 447 |
446 /** | 448 /** |
447 * @param {!FileEntry} entry | 449 * @param {!FileEntry} entry |
448 */ | 450 */ |
449 function fileRenamed(entry) | 451 function fileRenamed(entry) |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 /** | 610 /** |
609 * @param {!WebInspector.Progress} progress | 611 * @param {!WebInspector.Progress} progress |
610 */ | 612 */ |
611 indexContent: function(progress) | 613 indexContent: function(progress) |
612 { | 614 { |
613 progress.setTotalWork(1); | 615 progress.setTotalWork(1); |
614 var requestId = this._manager.registerProgress(progress); | 616 var requestId = this._manager.registerProgress(progress); |
615 InspectorFrontendHost.indexPath(requestId, this._embedderPath); | 617 InspectorFrontendHost.indexPath(requestId, this._embedderPath); |
616 } | 618 } |
617 } | 619 } |
OLD | NEW |