Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Unified Diff: third_party/WebKit/Source/devtools/front_end/workspace/IsolatedFileSystem.js

Issue 2417083002: DevTools: introduce WI.UISourceCode.requestMetadata() (Closed)
Patch Set: normalize test + address nit Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/workspace/IsolatedFileSystem.js
diff --git a/third_party/WebKit/Source/devtools/front_end/workspace/IsolatedFileSystem.js b/third_party/WebKit/Source/devtools/front_end/workspace/IsolatedFileSystem.js
index 5b009f9d1687285c76e9e4027df53c9b8bd63631..52981971e2c2ebd5472d151d839c725cd8e436af 100644
--- a/third_party/WebKit/Source/devtools/front_end/workspace/IsolatedFileSystem.js
+++ b/third_party/WebKit/Source/devtools/front_end/workspace/IsolatedFileSystem.js
@@ -105,6 +105,36 @@ WebInspector.IsolatedFileSystem.errorMessage = function(error)
WebInspector.IsolatedFileSystem.prototype = {
/**
+ * @param {string} path
+ * @return {!Promise<?{modificationTime: !Date, size: number}>}
+ */
+ getMetadata: function(path)
+ {
+ var fulfill;
+ var promise = new Promise(f => fulfill = f);
+ this._domFileSystem.root.getFile(path, null, fileEntryLoaded, errorHandler);
+ return promise;
+
+ /**
+ * @param {!FileEntry} entry
+ */
+ function fileEntryLoaded(entry)
+ {
+ entry.getMetadata(fulfill, errorHandler);
+ }
+
+ /**
+ * @param {!FileError} error
+ */
+ function errorHandler(error)
+ {
+ var errorMessage = WebInspector.IsolatedFileSystem.errorMessage(error);
+ console.error(errorMessage + " when getting file metadata '" + path);
+ fulfill(null);
+ }
+ },
+
+ /**
* @return {!Array<string>}
*/
filePaths: function()

Powered by Google App Engine
This is Rietveld 408576698