Chromium Code Reviews| 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) |