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

Unified Diff: third_party/WebKit/Source/devtools/scripts/hosted_mode/server.js

Issue 2489033003: DevTools: hosted mode fallback if generated files aren't uploaded yet (Closed)
Patch Set: fix the git grep so it works on full & front-end checkout Created 4 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/scripts/utils.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/scripts/hosted_mode/server.js
diff --git a/third_party/WebKit/Source/devtools/scripts/hosted_mode/server.js b/third_party/WebKit/Source/devtools/scripts/hosted_mode/server.js
index f821ba9a41a51dcbcc062d7fae9ea3e08680103f..c72e47ec6cb85335bb396731147111eb6c9f08df 100644
--- a/third_party/WebKit/Source/devtools/scripts/hosted_mode/server.js
+++ b/third_party/WebKit/Source/devtools/scripts/hosted_mode/server.js
@@ -116,7 +116,27 @@ function proxy(filePath)
if (proxyFileCache.has(proxyFileURL))
return Promise.resolve(proxyFileCache.get(proxyFileURL));
return utils.fetch(proxyFileURL)
- .then(cacheProxyFile.bind(null, proxyFileURL));
+ .then(cacheProxyFile.bind(null, proxyFileURL))
+ .catch(onMissingFile);
+ }
+
+ function onMissingFile() {
+ var isFullCheckout = utils.shellOutput("git config --get remote.origin.url") === "https://chromium.googlesource.com/chromium/src.git";
+ var earlierCommitHash;
+ var gitLogCommand = `git log --max-count=1 --grep="Commit-Position" --before="12 hours ago"`;
chenwilliam 2016/11/14 23:47:30 fixed the git grep so it works on full & front-end
+ if (isFullCheckout) {
+ earlierCommitHash = utils.shellOutput(`${gitLogCommand} --pretty=format:"%H"`);
+ } else {
+ var commitMessage = utils.shellOutput(`${gitLogCommand}`);
+ earlierCommitHash = commitMessage.match(/Cr-Mirrored-Commit: (.*)/)[1];
+ }
+ var fallbackURL = proxyFilePathToURL[filePath](earlierCommitHash);
+ console.log("WARNING: Unable to fetch generated file based on browser's revision");
+ console.log("Fetching earlier revision of same file as fallback");
+ console.log("There may be a mismatch between the front-end and back-end");
+ console.log(fallbackURL, "\n");
+ return utils.fetch(fallbackURL)
+ .then(cacheProxyFile.bind(null, fallbackURL));
}
function cacheProxyFile(proxyFileURL, data)
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/scripts/utils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698