Merge from vscode ad407028575a77ea387eb7cc219b323dc017b686

This commit is contained in:
ADS Merger
2020-08-22 06:06:52 +00:00
committed by Anthony Dresser
parent 404260b8a0
commit 4ad73d381c
480 changed files with 14360 additions and 14122 deletions

View File

@@ -24,6 +24,8 @@ import { FetchFileSystemProvider } from 'vs/workbench/services/extensions/browse
import { Schemas } from 'vs/base/common/network';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver';
import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { IUserDataInitializationService } from 'vs/workbench/services/userData/browser/userDataInit';
export class ExtensionService extends AbstractExtensionService implements IExtensionService {
@@ -43,6 +45,8 @@ export class ExtensionService extends AbstractExtensionService implements IExten
@IRemoteAgentService private readonly _remoteAgentService: IRemoteAgentService,
@IConfigurationService private readonly _configService: IConfigurationService,
@IWebExtensionsScannerService private readonly _webExtensionsScannerService: IWebExtensionsScannerService,
@ILifecycleService private readonly _lifecycleService: ILifecycleService,
@IUserDataInitializationService private readonly _userDataInitializationService: IUserDataInitializationService,
) {
super(
instantiationService,
@@ -56,7 +60,12 @@ export class ExtensionService extends AbstractExtensionService implements IExten
this._runningLocation = new Map<string, ExtensionRunningLocation>();
this._initialize();
// Initialize extensions first and do it only after workbench is ready
this._lifecycleService.when(LifecyclePhase.Ready).then(async () => {
await this._userDataInitializationService.initializeExtensions(this._instantiationService);
this._initialize();
});
this._initFetchFileSystem();
}

View File

@@ -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();
@@ -98,10 +96,11 @@ export class WebWorkerExtensionHost extends Disposable implements IExtensionHost
const escapeAttribute = (value: string): string => {
return value.replace(/"/g, '&quot;');
};
const isBuilt = this._environmentService.isBuilt;
const html = `<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'unsafe-eval' '${WEB_WORKER_IFRAME.sha}' *; worker-src data:; connect-src *" />
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'unsafe-eval' '${WEB_WORKER_IFRAME.sha}' ${isBuilt ? 'https:' : 'http: https:'}; worker-src data:; connect-src ${isBuilt ? 'https:' : 'http: https:'}" />
<meta id="vscode-worker-src" data-value="${escapeAttribute(workerSrc)}" />
<meta id="vscode-web-worker-ext-host-id" data-value="${escapeAttribute(vscodeWebWorkerExtHostId)}" />
</head>

View File

@@ -44,6 +44,7 @@ import { joinPath } from 'vs/base/common/resources';
import { Registry } from 'vs/platform/registry/common/platform';
import { IOutputChannelRegistry, Extensions } from 'vs/workbench/services/output/common/output';
import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-browser/environmentService';
import { isUUID } from 'vs/base/common/uuid';
export interface ILocalProcessExtensionHostInitData {
readonly autoStart: boolean;
@@ -182,18 +183,23 @@ export class LocalProcessExtensionHost implements IExtensionHost {
opts.execArgv = ['--inspect-port=0'];
}
// Enable the crash reporter depending on environment for local reporting
const crashesDirectory = this._environmentService.crashReporterDirectory;
if (crashesDirectory) {
const crashReporterOptions: CrashReporterStartOptions = {
// On linux crash reporter needs to be started on child node processes explicitly
if (platform.isLinux) {
const crashReporterStartOptions: CrashReporterStartOptions = {
companyName: this._productService.crashReporter?.companyName || 'Microsoft',
productName: this._productService.crashReporter?.productName || this._productService.nameShort,
submitURL: '',
uploadToServer: false,
crashesDirectory
uploadToServer: false
};
opts.env.CRASH_REPORTER_START_OPTIONS = JSON.stringify(crashReporterOptions);
const crashReporterId = this._environmentService.crashReporterId; // crashReporterId is set by the main process only when crash reporting is enabled by the user.
const appcenter = this._productService.appCenter;
const uploadCrashesToServer = !this._environmentService.crashReporterDirectory; // only upload unless --crash-reporter-directory is provided
if (uploadCrashesToServer && appcenter && crashReporterId && isUUID(crashReporterId)) {
const submitURL = appcenter[`linux-x64`];
crashReporterStartOptions.submitURL = submitURL.concat('&uid=', crashReporterId, '&iid=', crashReporterId, '&sid=', crashReporterId);
crashReporterStartOptions.uploadToServer = true;
}
opts.env.CRASH_REPORTER_START_OPTIONS = JSON.stringify(crashReporterStartOptions);
}
// Run Extension Host as fork of current process

View File

@@ -139,11 +139,9 @@ suite('RPCProtocol', () => {
let p = bProxy.$m(4, tokenSource.token);
p.then((res: number) => {
assert.equal(res, 7);
done(null);
}, (err) => {
assert.fail('should not receive error');
done();
});
}).finally(done);
tokenSource.cancel();
});
@@ -153,11 +151,9 @@ suite('RPCProtocol', () => {
};
bProxy.$m(4, 1).then((res) => {
assert.fail('unexpected');
done(null);
}, (err) => {
assert.equal(err.message, 'nope');
done(null);
});
}).finally(done);
});
test('error promise', function (done) {
@@ -166,11 +162,9 @@ suite('RPCProtocol', () => {
};
bProxy.$m(4, 1).then((res) => {
assert.fail('unexpected');
done(null);
}, (err) => {
assert.equal(err, undefined);
done(null);
});
}).finally(done);
});
test('issue #60450: Converting circular structure to JSON', function (done) {
@@ -181,11 +175,9 @@ suite('RPCProtocol', () => {
};
bProxy.$m(4, 1).then((res) => {
assert.equal(res, null);
done(null);
}, (err) => {
assert.fail('unexpected');
done(null);
});
}).finally(done);
});
test('issue #72798: null errors are hard to digest', function (done) {
@@ -195,11 +187,9 @@ suite('RPCProtocol', () => {
};
bProxy.$m(4, 1).then((res) => {
assert.fail('unexpected');
done(null);
}, (err) => {
assert.equal(err.what, 'what');
done(null);
});
}).finally(done);
});
test('undefined arguments arrive as null', function () {