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 8d6dfd1e5751bad773a5ecf25263f179d303fce8..399b8db5b14e960daab230f8fa287c5e98f23aca 100644 |
| --- a/third_party/WebKit/Source/devtools/scripts/hosted_mode/server.js |
| +++ b/third_party/WebKit/Source/devtools/scripts/hosted_mode/server.js |
| @@ -8,16 +8,18 @@ var https = require("https"); |
| var path = require("path"); |
| var parseURL = require("url").parse; |
| -var port = parseInt(process.env.PORT, 10) || 8090; |
| +var remoteDebuggingPort = parseInt(process.env.REMOTE_DEBUGGING_PORT, 10) || 9222; |
| +var serverPort = parseInt(process.env.PORT, 10) || 8090; |
| +var entryLink = `http://localhost:${remoteDebuggingPort}#http://localhost:${serverPort}/front_end/inspector.html?experiments=true`; |
| -http.createServer(requestHandler).listen(port); |
| -console.log("Started hosted mode server at http://localhost:" + port); |
| +http.createServer(requestHandler).listen(serverPort); |
| +console.log("Started hosted mode server at http://localhost:" + serverPort); |
| function requestHandler(request, response) |
| { |
| var filePath = parseURL(request.url).pathname; |
| - if (filePath === "/front_end/InspectorBackendCommands.js") { |
| - sendResponse(200, " "); |
| + if (filePath === "/") { |
| + sendResponse(200, `<html>Please go to <a href="${entryLink}">${entryLink}</a></html>`); |
| return; |
| } |
| @@ -32,10 +34,13 @@ function requestHandler(request, response) |
| function handleProxyError(err) |
| { |
| console.log(`Error fetching over the internet file ${filePath}:`, err); |
| + console.log(`Make sure you opened Chrome with the flag "--remote-debugging-port=${remoteDebuggingPort}"`); |
| sendResponse(500, "500 - Internal Server Error"); |
| } |
| var absoluteFilePath = path.join(process.cwd(), filePath); |
| + if (filePath === "/favicon.ico") |
|
lushnikov
2016/08/02 17:17:15
isn't there a favicon in the cloud already? Let's
paulirish
2016/08/03 18:26:14
https://chrome-devtools-frontend.appspot.com/favic
chenwilliam
2016/08/03 22:30:39
Done. Discussed with Paul and we agreed the Chrome
|
| + absoluteFilePath = path.join(__dirname, filePath); |
| fs.exists(absoluteFilePath, fsExistsCallback); |
| function fsExistsCallback(fileExists) |
| @@ -69,7 +74,8 @@ function requestHandler(request, response) |
| var proxyFilePathToURL = { |
| "/front_end/sdk/protocol/js_protocol.json": getWebKitURL.bind(null, "platform/v8_inspector/js_protocol.json"), |
|
lushnikov
2016/08/02 17:17:15
let's come up with some descriptive name instead o
chenwilliam
2016/08/03 22:30:39
Done.
|
| "/front_end/sdk/protocol/browser_protocol.json": getWebKitURL.bind(null, "core/inspector/browser_protocol.json"), |
| - "/front_end/SupportedCSSProperties.js": getFrontendURL.bind(null, "SupportedCSSProperties.js") |
| + "/front_end/SupportedCSSProperties.js": getFrontendURL.bind(null, "SupportedCSSProperties.js"), |
| + "/front_end/InspectorBackendCommands.js": getFrontendURL.bind(null, "InspectorBackendCommands.js") |
|
lushnikov
2016/08/02 17:26:26
one more question: why do we need to serve protoco
chenwilliam
2016/08/03 22:30:39
After discussing with dgozman, we don't need to se
|
| }; |
| function getWebKitURL(path, commitHash) |
| @@ -94,7 +100,7 @@ function proxy(filePath) |
| { |
| if (!(filePath in proxyFilePathToURL)) |
| return null; |
| - return fetch("http://localhost:9222/json/version") |
| + return fetch(`http://localhost:${remoteDebuggingPort}/json/version`) |
| .then(onBrowserMetadata); |
| function onBrowserMetadata(metadata) |