mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 10:38:59 +01:00
Don't use data: as the src of the web worker extension host iframe (#108285)
This commit is contained in:
@@ -60,6 +60,7 @@ if (args.help) {
|
||||
' --host Remote host\n' +
|
||||
' --port Remote/Local port\n' +
|
||||
' --local_port Local port override\n' +
|
||||
' --secondary-port Secondary port\n' +
|
||||
' --extension Path of an extension to include\n' +
|
||||
' --github-auth Github authentication token\n' +
|
||||
' --verbose Print out more information\n' +
|
||||
@@ -72,6 +73,7 @@ if (args.help) {
|
||||
|
||||
const PORT = args.port || process.env.PORT || 8080;
|
||||
const LOCAL_PORT = args.local_port || process.env.LOCAL_PORT || PORT;
|
||||
const SECONDARY_PORT = args['secondary-port'] || (parseInt(PORT, 10) + 1);
|
||||
const SCHEME = args.scheme || process.env.VSCODE_SCHEME || 'http';
|
||||
const HOST = args.host || 'localhost';
|
||||
const AUTHORITY = process.env.VSCODE_AUTHORITY || `${HOST}:${PORT}`;
|
||||
@@ -207,7 +209,11 @@ const commandlineProvidedExtensionsPromise = getCommandlineProvidedExtensionInfo
|
||||
|
||||
const mapCallbackUriToRequestId = new Map();
|
||||
|
||||
const server = http.createServer((req, res) => {
|
||||
/**
|
||||
* @param req {http.IncomingMessage}
|
||||
* @param res {http.ServerResponse}
|
||||
*/
|
||||
const requestHandler = (req, res) => {
|
||||
const parsedUrl = url.parse(req.url, true);
|
||||
const pathname = parsedUrl.pathname;
|
||||
|
||||
@@ -252,16 +258,25 @@ const server = http.createServer((req, res) => {
|
||||
|
||||
return serveError(req, res, 500, 'Internal Server Error.');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const server = http.createServer(requestHandler);
|
||||
server.listen(LOCAL_PORT, () => {
|
||||
if (LOCAL_PORT !== PORT) {
|
||||
console.log(`Operating location at http://0.0.0.0:${LOCAL_PORT}`);
|
||||
console.log(`Operating location at http://0.0.0.0:${LOCAL_PORT}`);
|
||||
}
|
||||
console.log(`Web UI available at ${SCHEME}://${AUTHORITY}`);
|
||||
console.log(`Web UI available at ${SCHEME}://${AUTHORITY}`);
|
||||
});
|
||||
server.on('error', err => {
|
||||
console.error(`Error occurred in server:`);
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
server.on('error', err => {
|
||||
const secondaryServer = http.createServer(requestHandler);
|
||||
secondaryServer.listen(SECONDARY_PORT, () => {
|
||||
console.log(`Secondary server available at ${SCHEME}://${HOST}:${SECONDARY_PORT}`);
|
||||
});
|
||||
secondaryServer.on('error', err => {
|
||||
console.error(`Error occurred in server:`);
|
||||
console.error(err);
|
||||
});
|
||||
@@ -366,6 +381,7 @@ async function handleRoot(req, res) {
|
||||
folderUri: folderUri,
|
||||
staticExtensions,
|
||||
enableSyncByDefault: args['enable-sync'],
|
||||
webWorkerExtensionHostIframeSrc: `${SCHEME}://${HOST}:${SECONDARY_PORT}/static/out/vs/workbench/services/extensions/worker/httpWebWorkerExtensionHostIframe.html`
|
||||
};
|
||||
if (args['wrap-iframe']) {
|
||||
webConfigJSON._wrapWebWorkerExtHostInIframe = true;
|
||||
|
||||
Reference in New Issue
Block a user