mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-15 10:58:31 -05:00
Merge from vscode e3b9b8eefc062d68ba8a4b6a817162d132f3b533 (#6932)
* Merge from vscode e3b9b8eefc062d68ba8a4b6a817162d132f3b533 * skip failing test * add comment
This commit is contained in:
@@ -79,7 +79,8 @@ export class RemoteExtensionHostClient extends Disposable implements IExtensionH
|
||||
return { host: authority.host, port: authority.port };
|
||||
}
|
||||
},
|
||||
signService: this._signService
|
||||
signService: this._signService,
|
||||
logService: this._logService
|
||||
};
|
||||
return this.remoteAuthorityResolverService.resolveAuthority(this._initDataProvider.remoteAuthority).then((resolverResult) => {
|
||||
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IExtensionDescription, IExtensionManifest, ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { UriComponents, URI } from 'vs/base/common/uri';
|
||||
import { IExtensionDescription, ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
|
||||
export const IStaticExtensionsService = createDecorator<IStaticExtensionsService>('IStaticExtensionsService');
|
||||
|
||||
@@ -20,7 +22,9 @@ export class StaticExtensionsService implements IStaticExtensionsService {
|
||||
|
||||
private readonly _descriptions: IExtensionDescription[] = [];
|
||||
|
||||
constructor(staticExtensions: { packageJSON: IExtensionManifest, extensionLocation: UriComponents }[]) {
|
||||
constructor(@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService) {
|
||||
const staticExtensions = environmentService.options && Array.isArray(environmentService.options.staticExtensions) ? environmentService.options.staticExtensions : [];
|
||||
|
||||
this._descriptions = staticExtensions.map(data => <IExtensionDescription>{
|
||||
identifier: new ExtensionIdentifier(`${data.packageJSON.publisher}.${data.packageJSON.name}`),
|
||||
extensionLocation: URI.revive(data.extensionLocation),
|
||||
@@ -32,3 +36,5 @@ export class StaticExtensionsService implements IStaticExtensionsService {
|
||||
return this._descriptions;
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(IStaticExtensionsService, StaticExtensionsService, true);
|
||||
|
||||
@@ -7,9 +7,9 @@ import * as nativeWatchdog from 'native-watchdog';
|
||||
import * as net from 'net';
|
||||
import * as minimist from 'vscode-minimist';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IMessagePassingProtocol } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { PersistentProtocol, ProtocolConstants, createBufferedEvent } from 'vs/base/parts/ipc/common/ipc.net';
|
||||
import { PersistentProtocol, ProtocolConstants, BufferedEmitter } from 'vs/base/parts/ipc/common/ipc.net';
|
||||
import { NodeSocket, WebSocketNodeSocket } from 'vs/base/parts/ipc/node/ipc.net';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import { IInitData } from 'vs/workbench/api/common/extHost.protocol';
|
||||
@@ -164,8 +164,8 @@ async function createExtHostProtocol(): Promise<IMessagePassingProtocol> {
|
||||
|
||||
return new class implements IMessagePassingProtocol {
|
||||
|
||||
private readonly _onMessage = new Emitter<VSBuffer>();
|
||||
readonly onMessage: Event<VSBuffer> = createBufferedEvent(this._onMessage.event);
|
||||
private readonly _onMessage = new BufferedEmitter<VSBuffer>();
|
||||
readonly onMessage: Event<VSBuffer> = this._onMessage.event;
|
||||
|
||||
private _terminating: boolean;
|
||||
|
||||
|
||||
@@ -12,15 +12,31 @@ import { ExtensionHostMain } from 'vs/workbench/services/extensions/common/exten
|
||||
import { IHostUtils } from 'vs/workbench/api/common/extHostExtensionService';
|
||||
import 'vs/workbench/services/extensions/worker/extHost.services';
|
||||
|
||||
// worker-self
|
||||
//#region --- Define, capture, and override some globals
|
||||
//todo@joh do not allow extensions to call postMessage and other globals...
|
||||
|
||||
declare namespace self {
|
||||
function close(): void;
|
||||
let close: any;
|
||||
let postMessage: any;
|
||||
let addEventLister: any;
|
||||
let indexedDB: any;
|
||||
let caches: any;
|
||||
}
|
||||
|
||||
// do not allow extensions to call terminate
|
||||
const nativeClose = self.close.bind(self);
|
||||
self.close = () => console.trace('An extension called terminate and this was prevented');
|
||||
let onTerminate = nativeClose;
|
||||
self.close = () => console.trace(`'close' has been blocked`);
|
||||
|
||||
const nativePostMessage = postMessage.bind(self);
|
||||
self.postMessage = () => console.trace(`'postMessage' has been blocked`);
|
||||
|
||||
const nativeAddEventLister = addEventListener.bind(self);
|
||||
self.addEventLister = () => console.trace(`'addEventListener' has been blocked`);
|
||||
|
||||
// readonly, cannot redefine...
|
||||
// self.indexedDB = undefined;
|
||||
// self.caches = undefined;
|
||||
|
||||
//#endregion ---
|
||||
|
||||
const hostUtil = new class implements IHostUtils {
|
||||
_serviceBrand: any;
|
||||
@@ -35,7 +51,6 @@ const hostUtil = new class implements IHostUtils {
|
||||
}
|
||||
};
|
||||
|
||||
//todo@joh do not allow extensions to call postMessage and other globals...
|
||||
|
||||
class ExtensionWorker {
|
||||
|
||||
@@ -47,7 +62,8 @@ class ExtensionWorker {
|
||||
let emitter = new Emitter<VSBuffer>();
|
||||
let terminating = false;
|
||||
|
||||
onmessage = event => {
|
||||
|
||||
nativeAddEventLister('message', event => {
|
||||
const { data } = event;
|
||||
if (!(data instanceof ArrayBuffer)) {
|
||||
console.warn('UNKNOWN data received', data);
|
||||
@@ -64,14 +80,14 @@ class ExtensionWorker {
|
||||
|
||||
// emit non-terminate messages to the outside
|
||||
emitter.fire(msg);
|
||||
};
|
||||
});
|
||||
|
||||
this.protocol = {
|
||||
onMessage: emitter.event,
|
||||
send: vsbuf => {
|
||||
if (!terminating) {
|
||||
const data = vsbuf.buffer.buffer.slice(vsbuf.buffer.byteOffset, vsbuf.buffer.byteOffset + vsbuf.buffer.byteLength);
|
||||
postMessage(data, [data]);
|
||||
nativePostMessage(data, [data]);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -94,6 +110,8 @@ function connectToRenderer(protocol: IMessagePassingProtocol): Promise<IRenderer
|
||||
});
|
||||
}
|
||||
|
||||
let onTerminate = nativeClose;
|
||||
|
||||
(function create(): void {
|
||||
const res = new ExtensionWorker();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user