Skip to content

Commit ee09c5b

Browse files
committed
Add IWorkbenchConstructionOptions._wrapWebWorkerExtHostInIframe
1 parent 54abb9a commit ee09c5b

3 files changed

Lines changed: 19 additions & 9 deletions

File tree

resources/serverless/code-web.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ const args = minimist(process.argv, {
2828
boolean: [
2929
'no-launch',
3030
'help',
31-
'verbose'
31+
'verbose',
32+
'wrap-iframe'
3233
],
3334
string: [
3435
'scheme',
@@ -43,6 +44,7 @@ if (args.help) {
4344
console.log(
4445
'yarn web [options]\n' +
4546
' --no-launch Do not open VSCode web in the browser\n' +
47+
' --wrap-iframe Wrap the Web Worker Extension Host in an iframe\n' +
4648
' --scheme Protocol (https or http)\n' +
4749
' --host Remote host\n' +
4850
' --port Remote/Local port\n' +
@@ -293,13 +295,16 @@ async function handleRoot(req, res) {
293295
fancyLog(`${ansiColors.magenta('Additional extensions')}: ${staticExtensions.map(e => path.basename(e.extensionLocation.path)).join(', ') || 'None'}`);
294296
}
295297

296-
const webConfigJSON = escapeAttribute(JSON.stringify({
298+
const webConfigJSON = {
297299
folderUri: folderUri,
298-
staticExtensions
299-
}));
300+
staticExtensions,
301+
};
302+
if (args['wrap-iframe']) {
303+
webConfigJSON._wrapWebWorkerExtHostInIframe = true;
304+
}
300305

301306
const data = (await readFile(WEB_MAIN)).toString()
302-
.replace('{{WORKBENCH_WEB_CONFIGURATION}}', () => webConfigJSON) // use a replace function to avoid that regexp replace patterns ($&, $0, ...) are applied
307+
.replace('{{WORKBENCH_WEB_CONFIGURATION}}', () => escapeAttribute(JSON.stringify(webConfigJSON))) // use a replace function to avoid that regexp replace patterns ($&, $0, ...) are applied
303308
.replace('{{WORKBENCH_BUILTIN_EXTENSIONS}}', () => escapeAttribute(JSON.stringify(builtInExtensions)))
304309
.replace('{{WEBVIEW_ENDPOINT}}', '')
305310
.replace('{{REMOTE_USER_DATA_URI}}', '');

src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ import { generateUuid } from 'vs/base/common/uuid';
2929
import { canceled, onUnexpectedError } from 'vs/base/common/errors';
3030
import { WEB_WORKER_IFRAME } from 'vs/workbench/services/extensions/common/webWorkerIframe';
3131

32-
const WRAP_IN_IFRAME = true;
33-
3432
export interface IWebWorkerExtensionHostInitData {
3533
readonly autoStart: boolean;
3634
readonly extensions: IExtensionDescription[];
@@ -74,7 +72,7 @@ export class WebWorkerExtensionHost extends Disposable implements IExtensionHost
7472

7573
public async start(): Promise<IMessagePassingProtocol> {
7674
if (!this._protocolPromise) {
77-
if (WRAP_IN_IFRAME && platform.isWeb) {
75+
if (platform.isWeb && this._environmentService.options && this._environmentService.options._wrapWebWorkerExtHostInIframe) {
7876
this._protocolPromise = this._startInsideIframe();
7977
} else {
8078
this._protocolPromise = this._startOutsideIframe();

src/vs/workbench/workbench.web.api.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,18 @@ interface IWorkbenchConstructionOptions {
275275

276276
/**
277277
* [TEMPORARY]: This will be removed soon.
278-
* Disable the inlined extensions.
278+
* Enable inlined extensions.
279279
* Defaults to false on serverful and true on serverless.
280280
*/
281281
readonly _enableBuiltinExtensions?: boolean;
282282

283+
/**
284+
* [TEMPORARY]: This will be removed soon.
285+
* Enable `<iframe>` wrapping.
286+
* Defaults to false.
287+
*/
288+
readonly _wrapWebWorkerExtHostInIframe?: boolean;
289+
283290
/**
284291
* Support for URL callbacks.
285292
*/

0 commit comments

Comments
 (0)