| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 * @param {!DOMError} error | 98 * @param {!DOMError} error |
| 99 * @return {string} | 99 * @return {string} |
| 100 */ | 100 */ |
| 101 WebInspector.IsolatedFileSystem.errorMessage = function(error) | 101 WebInspector.IsolatedFileSystem.errorMessage = function(error) |
| 102 { | 102 { |
| 103 return WebInspector.UIString("File system error: %s", error.message); | 103 return WebInspector.UIString("File system error: %s", error.message); |
| 104 } | 104 } |
| 105 | 105 |
| 106 WebInspector.IsolatedFileSystem.prototype = { | 106 WebInspector.IsolatedFileSystem.prototype = { |
| 107 /** | 107 /** |
| 108 * @param {string} path |
| 109 * @return {!Promise<?{modificationTime: !Date, size: number}>} |
| 110 */ |
| 111 getMetadata: function(path) |
| 112 { |
| 113 var fulfill; |
| 114 var promise = new Promise(f => fulfill = f); |
| 115 this._domFileSystem.root.getFile(path, null, fileEntryLoaded, errorHandl
er); |
| 116 return promise; |
| 117 |
| 118 /** |
| 119 * @param {!FileEntry} entry |
| 120 */ |
| 121 function fileEntryLoaded(entry) |
| 122 { |
| 123 entry.getMetadata(fulfill, errorHandler); |
| 124 } |
| 125 |
| 126 /** |
| 127 * @param {!FileError} error |
| 128 */ |
| 129 function errorHandler(error) |
| 130 { |
| 131 var errorMessage = WebInspector.IsolatedFileSystem.errorMessage(erro
r); |
| 132 console.error(errorMessage + " when getting file metadata '" + path)
; |
| 133 fulfill(null); |
| 134 } |
| 135 }, |
| 136 |
| 137 /** |
| 108 * @return {!Array<string>} | 138 * @return {!Array<string>} |
| 109 */ | 139 */ |
| 110 filePaths: function() | 140 filePaths: function() |
| 111 { | 141 { |
| 112 return this._filePaths.valuesArray(); | 142 return this._filePaths.valuesArray(); |
| 113 }, | 143 }, |
| 114 | 144 |
| 115 /** | 145 /** |
| 116 * @return {!Array<string>} | 146 * @return {!Array<string>} |
| 117 */ | 147 */ |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 /** | 673 /** |
| 644 * @param {!WebInspector.Progress} progress | 674 * @param {!WebInspector.Progress} progress |
| 645 */ | 675 */ |
| 646 indexContent: function(progress) | 676 indexContent: function(progress) |
| 647 { | 677 { |
| 648 progress.setTotalWork(1); | 678 progress.setTotalWork(1); |
| 649 var requestId = this._manager.registerProgress(progress); | 679 var requestId = this._manager.registerProgress(progress); |
| 650 InspectorFrontendHost.indexPath(requestId, this._embedderPath); | 680 InspectorFrontendHost.indexPath(requestId, this._embedderPath); |
| 651 } | 681 } |
| 652 } | 682 } |
| OLD | NEW |