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

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

Issue 2300403003: DevTools: patch browser's Chrome version into Chrome user agents for emulation (Closed)
Patch Set: address comments Created 4 years, 3 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 unified diff | Download patch
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 https = require("https"); 6 var https = require("https");
7 var path = require("path"); 7 var path = require("path");
8 var parseURL = require("url").parse; 8 var parseURL = require("url").parse;
9 var Stream = require("stream").Transform; 9 var Stream = require("stream").Transform;
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 { 75 {
76 response.writeHead(statusCode); 76 response.writeHead(statusCode);
77 response.write(data, "binary"); 77 response.write(data, "binary");
78 response.end(); 78 response.end();
79 } 79 }
80 } 80 }
81 81
82 var proxyFilePathToURL = { 82 var proxyFilePathToURL = {
83 "/front_end/SupportedCSSProperties.js": cloudURL.bind(null, "SupportedCSSPro perties.js"), 83 "/front_end/SupportedCSSProperties.js": cloudURL.bind(null, "SupportedCSSPro perties.js"),
84 "/front_end/InspectorBackendCommands.js": cloudURL.bind(null, "InspectorBack endCommands.js"), 84 "/front_end/InspectorBackendCommands.js": cloudURL.bind(null, "InspectorBack endCommands.js"),
85 "/front_end/CurrentBrowserVersion.js": cloudURL.bind(null, "CurrentBrowserVe rsion.js"),
85 "/favicon.ico": () => "https://chrome-devtools-frontend.appspot.com/favicon. ico" 86 "/favicon.ico": () => "https://chrome-devtools-frontend.appspot.com/favicon. ico"
86 }; 87 };
87 88
88 function cloudURL(path, commitHash) 89 function cloudURL(path, commitHash)
89 { 90 {
90 return `https://chrome-devtools-frontend.appspot.com/serve_file/@${commitHas h}/${path}`; 91 return `https://chrome-devtools-frontend.appspot.com/serve_file/@${commitHas h}/${path}`;
91 } 92 }
92 93
93 var proxyFileCache = new Map(); 94 var proxyFileCache = new Map();
94 95
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 if (response.statusCode !== 200) { 152 if (response.statusCode !== 200) {
152 reject(new Error(`Request error: + ${response.statusCode}`)); 153 reject(new Error(`Request error: + ${response.statusCode}`));
153 return; 154 return;
154 } 155 }
155 var body = new Stream(); 156 var body = new Stream();
156 response.on("data", chunk => body.push(chunk)); 157 response.on("data", chunk => body.push(chunk));
157 response.on("end", () => resolve(body.read())); 158 response.on("end", () => resolve(body.read()));
158 } 159 }
159 } 160 }
160 161
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698