mirror of
https://github.com/microsoft/vscode.git
synced 2026-03-02 23:09:59 +00:00
Add IWorkbenchConstructionOptions._wrapWebWorkerExtHostInIframe
This commit is contained in:
@@ -28,7 +28,8 @@ const args = minimist(process.argv, {
|
||||
boolean: [
|
||||
'no-launch',
|
||||
'help',
|
||||
'verbose'
|
||||
'verbose',
|
||||
'wrap-iframe'
|
||||
],
|
||||
string: [
|
||||
'scheme',
|
||||
@@ -43,6 +44,7 @@ if (args.help) {
|
||||
console.log(
|
||||
'yarn web [options]\n' +
|
||||
' --no-launch Do not open VSCode web in the browser\n' +
|
||||
' --wrap-iframe Wrap the Web Worker Extension Host in an iframe\n' +
|
||||
' --scheme Protocol (https or http)\n' +
|
||||
' --host Remote host\n' +
|
||||
' --port Remote/Local port\n' +
|
||||
@@ -293,13 +295,16 @@ async function handleRoot(req, res) {
|
||||
fancyLog(`${ansiColors.magenta('Additional extensions')}: ${staticExtensions.map(e => path.basename(e.extensionLocation.path)).join(', ') || 'None'}`);
|
||||
}
|
||||
|
||||
const webConfigJSON = escapeAttribute(JSON.stringify({
|
||||
const webConfigJSON = {
|
||||
folderUri: folderUri,
|
||||
staticExtensions
|
||||
}));
|
||||
staticExtensions,
|
||||
};
|
||||
if (args['wrap-iframe']) {
|
||||
webConfigJSON._wrapWebWorkerExtHostInIframe = true;
|
||||
}
|
||||
|
||||
const data = (await readFile(WEB_MAIN)).toString()
|
||||
.replace('{{WORKBENCH_WEB_CONFIGURATION}}', () => webConfigJSON) // use a replace function to avoid that regexp replace patterns ($&, $0, ...) are applied
|
||||
.replace('{{WORKBENCH_WEB_CONFIGURATION}}', () => escapeAttribute(JSON.stringify(webConfigJSON))) // use a replace function to avoid that regexp replace patterns ($&, $0, ...) are applied
|
||||
.replace('{{WORKBENCH_BUILTIN_EXTENSIONS}}', () => escapeAttribute(JSON.stringify(builtInExtensions)))
|
||||
.replace('{{WEBVIEW_ENDPOINT}}', '')
|
||||
.replace('{{REMOTE_USER_DATA_URI}}', '');
|
||||
|
||||
@@ -29,8 +29,6 @@ import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { canceled, onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { WEB_WORKER_IFRAME } from 'vs/workbench/services/extensions/common/webWorkerIframe';
|
||||
|
||||
const WRAP_IN_IFRAME = true;
|
||||
|
||||
export interface IWebWorkerExtensionHostInitData {
|
||||
readonly autoStart: boolean;
|
||||
readonly extensions: IExtensionDescription[];
|
||||
@@ -74,7 +72,7 @@ export class WebWorkerExtensionHost extends Disposable implements IExtensionHost
|
||||
|
||||
public async start(): Promise<IMessagePassingProtocol> {
|
||||
if (!this._protocolPromise) {
|
||||
if (WRAP_IN_IFRAME && platform.isWeb) {
|
||||
if (platform.isWeb && this._environmentService.options && this._environmentService.options._wrapWebWorkerExtHostInIframe) {
|
||||
this._protocolPromise = this._startInsideIframe();
|
||||
} else {
|
||||
this._protocolPromise = this._startOutsideIframe();
|
||||
|
||||
@@ -275,11 +275,18 @@ interface IWorkbenchConstructionOptions {
|
||||
|
||||
/**
|
||||
* [TEMPORARY]: This will be removed soon.
|
||||
* Disable the inlined extensions.
|
||||
* Enable inlined extensions.
|
||||
* Defaults to false on serverful and true on serverless.
|
||||
*/
|
||||
readonly _enableBuiltinExtensions?: boolean;
|
||||
|
||||
/**
|
||||
* [TEMPORARY]: This will be removed soon.
|
||||
* Enable `<iframe>` wrapping.
|
||||
* Defaults to false.
|
||||
*/
|
||||
readonly _wrapWebWorkerExtHostInIframe?: boolean;
|
||||
|
||||
/**
|
||||
* Support for URL callbacks.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user