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

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

Issue 2236733002: DevTools: Override browser commit hash with process.env.CHROMIUM_COMMIT (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | 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 811bf70a5d8387a268cdafb9084cef935ec43d9f..b10bc5947ed3e6925593afe3a1694d1ef19be795 100644
--- a/third_party/WebKit/Source/devtools/scripts/hosted_mode/server.js
+++ b/third_party/WebKit/Source/devtools/scripts/hosted_mode/server.js
@@ -42,7 +42,7 @@ function requestHandler(request, response)
var absoluteFilePath = path.join(process.cwd(), filePath);
if (!path.resolve(absoluteFilePath).startsWith(devtoolsFolder)) {
console.log(`File requested is outside of devtools folder: ${devtoolsFolder}`);
- sendResponse(403, "`403 - Access denied. File requested is outside of devtools folder: ${devtoolsFolder}`");
chenwilliam 2016/08/10 22:04:55 The surrounding double quotes were causing the pla
+ sendResponse(403, `403 - Access denied. File requested is outside of devtools folder: ${devtoolsFolder}`);
return;
}
@@ -93,8 +93,11 @@ function proxy(filePath)
{
if (!(filePath in proxyFilePathToURL))
return null;
+ if (process.env.CHROMIUM_COMMIT)
+ return onProxyFileURL(proxyFilePathToURL[filePath](process.env.CHROMIUM_COMMIT));
return fetch(`http://localhost:${remoteDebuggingPort}/json/version`)
- .then(onBrowserMetadata);
+ .then(onBrowserMetadata)
+ .then(onProxyFileURL);
function onBrowserMetadata(metadata)
{
@@ -102,8 +105,13 @@ function proxy(filePath)
var match = metadataObject["WebKit-Version"].match(/\s\(@(\b[0-9a-f]{5,40}\b)/);
var commitHash = match[1];
var proxyFileURL = proxyFilePathToURL[filePath](commitHash);
+ return proxyFileURL;
+ }
+
+ function onProxyFileURL(proxyFileURL)
+ {
if (proxyFileCache.has(proxyFileURL))
- return proxyFileCache.get(proxyFileURL);
+ return Promise.resolve(proxyFileCache.get(proxyFileURL));
return fetch(proxyFileURL)
.then(cacheProxyFile.bind(null, proxyFileURL));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698