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

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

Issue 2469943002: DevTools: bring hosted mode up-to-date with the new --custom-devtools-frontend (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/scripts/chrome_debug_launcher/launch_chrome.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 var fs = require("fs"); 4 var fs = require("fs");
5 var http = require("http"); 5 var http = require("http");
6 var path = require("path"); 6 var path = require("path");
7 var parseURL = require("url").parse; 7 var parseURL = require("url").parse;
8 8
9 var utils = require("../utils"); 9 var utils = require("../utils");
10 10
11 var remoteDebuggingPort = parseInt(process.env.REMOTE_DEBUGGING_PORT, 10) || 922 2; 11 var remoteDebuggingPort = parseInt(process.env.REMOTE_DEBUGGING_PORT, 10) || 922 2;
12 var serverPort = parseInt(process.env.PORT, 10) || 8090; 12 var serverPort = parseInt(process.env.PORT, 10) || 8090;
13 var devtoolsFolder = path.resolve(path.join(__dirname, "../..")); 13 var devtoolsFolder = path.resolve(path.join(__dirname, "../.."));
14 14
15 http.createServer(requestHandler).listen(serverPort); 15 http.createServer(requestHandler).listen(serverPort);
16 console.log(`Started hosted mode server at http://localhost:${serverPort}\n`); 16 console.log(`Started hosted mode server at http://localhost:${serverPort}\n`);
17 console.log("For info on using the hosted mode server, see our contributing docs :"); 17 console.log("For info on using the hosted mode server, see our contributing docs :");
18 console.log("https://bit.ly/devtools-contribution-guide"); 18 console.log("https://bit.ly/devtools-contribution-guide");
19 console.log("Tip: Look for the 'Hosted Mode Server Options' section\n"); 19 console.log("Tip: Look for the 'Hosted Mode Server Options' section\n");
20 20
21 function requestHandler(request, response) 21 function requestHandler(request, response)
22 { 22 {
23 var filePath = parseURL(request.url).pathname; 23 var filePath = parseURL(request.url).pathname;
24 if (filePath === "/") { 24 if (filePath === "/") {
25 var landingURL = `http://localhost:${remoteDebuggingPort}#http://localho st:${serverPort}/front_end/inspector.html?experiments=true`; 25 var landingURL = `http://localhost:${remoteDebuggingPort}#custom=true&ex periments=true`;
26 sendResponse(200, `<html>Please go to <a href="${landingURL}">${landingU RL}</a></html>`); 26 sendResponse(200, `<html>Please go to <a href="${landingURL}">${landingU RL}</a></html>`);
27 return; 27 return;
28 } 28 }
29 29
30 var proxiedFile = proxy(filePath, sendResponse); 30 var proxiedFile = proxy(filePath, sendResponse);
31 if (proxiedFile) { 31 if (proxiedFile) {
32 proxiedFile 32 proxiedFile
33 .then(data => sendResponse(200, data)) 33 .then(data => sendResponse(200, data))
34 .catch(handleProxyError); 34 .catch(handleProxyError);
35 return; 35 return;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return utils.fetch(proxyFileURL) 118 return utils.fetch(proxyFileURL)
119 .then(cacheProxyFile.bind(null, proxyFileURL)); 119 .then(cacheProxyFile.bind(null, proxyFileURL));
120 } 120 }
121 121
122 function cacheProxyFile(proxyFileURL, data) 122 function cacheProxyFile(proxyFileURL, data)
123 { 123 {
124 proxyFileCache.set(proxyFileURL, data); 124 proxyFileCache.set(proxyFileURL, data);
125 return data; 125 return data;
126 } 126 }
127 } 127 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/scripts/chrome_debug_launcher/launch_chrome.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698