Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8 (#14883)

* Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8

* Bump distro

* Upgrade GCC to 4.9 due to yarn install errors

* Update build image

* Fix bootstrap base url

* Bump distro

* Fix build errors

* Update source map file

* Disable checkbox for blocking migration issues (#15131)

* disable checkbox for blocking issues

* wip

* disable checkbox fixes

* fix strings

* Remove duplicate tsec command

* Default to off for tab color if settings not present

* re-skip failing tests

* Fix mocha error

* Bump sqlite version & fix notebooks search view

* Turn off esbuild warnings

* Update esbuild log level

* Fix overflowactionbar tests

* Fix ts-ignore in dropdown tests

* cleanup/fixes

* Fix hygiene

* Bundle in entire zone.js module

* Remove extra constructor param

* bump distro for web compile break

* bump distro for web compile break v2

* Undo log level change

* New distro

* Fix integration test scripts

* remove the "no yarn.lock changes" workflow

* fix scripts v2

* Update unit test scripts

* Ensure ads-kerberos2 updates in .vscodeignore

* Try fix unit tests

* Upload crash reports

* remove nogpu

* always upload crashes

* Use bash script

* Consolidate data/ext dir names

* Create in tmp directory

Co-authored-by: chlafreniere <hichise@gmail.com>
Co-authored-by: Christopher Suh <chsuh@microsoft.com>
Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
Karl Burtram
2021-04-27 14:01:59 -07:00
committed by GitHub
parent 7e1c0076ba
commit 867a963882
1817 changed files with 81812 additions and 50843 deletions

View File

@@ -20,7 +20,7 @@ import { KeyCode } from 'vs/base/common/keyCodes';
export function clearNode(node: HTMLElement): void {
while (node.firstChild) {
node.removeChild(node.firstChild);
node.firstChild.remove();
}
}
@@ -41,13 +41,7 @@ export function trustedInnerHTML(node: Element, value: TrustedHTML): void {
}
export function isInDOM(node: Node | null): boolean {
while (node) {
if (node === document.body) {
return true;
}
node = node.parentNode || (node as ShadowRoot).host;
}
return false;
return node?.isConnected ?? false;
}
interface IDomClassList {
@@ -357,7 +351,7 @@ export function modify(callback: () => void): IDisposable {
}
/**
* Add a throttled listener. `handler` is fired at most every 16ms or with the next animation frame (if browser supports it).
* Add a throttled listener. `handler` is fired at most every 8.33333ms or with the next animation frame (if browser supports it).
*/
export interface IEventMerger<R, E> {
(lastEvent: R | null, currentEvent: E): R;
@@ -368,7 +362,7 @@ export interface DOMEvent {
stopPropagation(): void;
}
const MINIMUM_TIME_MS = 16;
const MINIMUM_TIME_MS = 8;
const DEFAULT_EVENT_MERGER: IEventMerger<DOMEvent, DOMEvent> = function (lastEvent: DOMEvent | null, currentEvent: DOMEvent) {
return currentEvent;
};
@@ -521,6 +515,8 @@ export interface IDimension {
export class Dimension implements IDimension {
static readonly None = new Dimension(0, 0);
constructor(
public readonly width: number,
public readonly height: number,
@@ -912,7 +908,7 @@ export const EventType = {
MOUSE_OUT: 'mouseout',
MOUSE_ENTER: 'mouseenter',
MOUSE_LEAVE: 'mouseleave',
MOUSE_WHEEL: browser.isEdge ? 'mousewheel' : 'wheel',
MOUSE_WHEEL: browser.isEdgeLegacy ? 'mousewheel' : 'wheel',
POINTER_UP: 'pointerup',
POINTER_DOWN: 'pointerdown',
POINTER_MOVE: 'pointermove',
@@ -1072,9 +1068,13 @@ export function after<T extends Node>(sibling: HTMLElement, child: T): T {
return child;
}
export function append<T extends Node>(parent: HTMLElement, ...children: T[]): T {
children.forEach(child => parent.appendChild(child));
return children[children.length - 1];
export function append<T extends Node>(parent: HTMLElement, child: T): T;
export function append<T extends Node>(parent: HTMLElement, ...children: (T | string)[]): void;
export function append<T extends Node>(parent: HTMLElement, ...children: (T | string)[]): T | void {
parent.append(...children);
if (children.length === 1 && typeof children[0] !== 'string') {
return <T>children[0];
}
}
export function prepend<T extends Node>(parent: HTMLElement, child: T): T {
@@ -1082,26 +1082,12 @@ export function prepend<T extends Node>(parent: HTMLElement, child: T): T {
return child;
}
/**
* Removes all children from `parent` and appends `children`
*/
export function reset(parent: HTMLElement, ...children: Array<Node | string>): void {
parent.innerText = '';
appendChildren(parent, ...children);
}
/**
* Appends `children` to `parent`
*/
export function appendChildren(parent: HTMLElement, ...children: Array<Node | string>): void {
for (const child of children) {
if (child instanceof Node) {
parent.appendChild(child);
} else if (typeof child === 'string') {
parent.appendChild(document.createTextNode(child));
}
}
append(parent, ...children);
}
const SELECTOR_REGEX = /([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;
@@ -1155,13 +1141,7 @@ function _$<T extends Element>(namespace: Namespace, description: string, attrs?
}
});
for (const child of children) {
if (child instanceof Node) {
result.appendChild(child);
} else if (typeof child === 'string') {
result.appendChild(document.createTextNode(child));
}
}
result.append(...children);
return result as T;
}
@@ -1281,9 +1261,10 @@ export function computeScreenAwareSize(cssPx: number): number {
* See https://mathiasbynens.github.io/rel-noopener/
*/
export function windowOpenNoOpener(url: string): void {
if (platform.isNative || browser.isEdgeWebView) {
if (browser.isElectron || browser.isEdgeLegacyWebView) {
// In VSCode, window.open() always returns null...
// The same is true for a WebView (see https://github.com/microsoft/monaco-editor/issues/628)
// Also call directly window.open in sandboxed Electron (see https://github.com/microsoft/monaco-editor/issues/2220)
window.open(url);
} else {
let newTab = window.open();
@@ -1316,10 +1297,14 @@ export function asCSSUrl(uri: URI): string {
return `url('${FileAccess.asBrowserUri(uri).toString(true).replace(/'/g, '%27')}')`;
}
export function asCSSPropertyValue(value: string) {
return `'${value.replace(/'/g, '%27')}'`;
}
export function triggerDownload(dataOrUri: Uint8Array | URI, name: string): void {
// If the data is provided as Buffer, we create a
// blog URL out of it to produce a valid link
// blob URL out of it to produce a valid link
let url: string;
if (URI.isUri(dataOrUri)) {
url = dataOrUri.toString(true);
@@ -1368,7 +1353,7 @@ export interface IDetectedFullscreen {
mode: DetectedFullscreenMode;
/**
* Wether we know for sure that we are in fullscreen mode or
* Whether we know for sure that we are in fullscreen mode or
* it is a guess.
*/
guess: boolean;
@@ -1456,7 +1441,7 @@ export function safeInnerHtml(node: HTMLElement, value: string): void {
}, ['class', 'id', 'role', 'tabindex']);
const html = _ttpSafeInnerHtml?.createHTML(value, options) ?? insane(value, options);
node.innerHTML = html as unknown as string;
node.innerHTML = html as string;
}
/**
@@ -1469,7 +1454,12 @@ function toBinary(str: string): string {
for (let i = 0; i < codeUnits.length; i++) {
codeUnits[i] = str.charCodeAt(i);
}
return String.fromCharCode(...new Uint8Array(codeUnits.buffer));
let binary = '';
const uint8array = new Uint8Array(codeUnits.buffer);
for (let i = 0; i < uint8array.length; i++) {
binary += String.fromCharCode(uint8array[i]);
}
return binary;
}
/**
@@ -1516,7 +1506,7 @@ export namespace WebFileSystemAccess {
}
export function supported(obj: any & Window): obj is FileSystemAccess {
const candidate = obj as FileSystemAccess;
const candidate = obj as FileSystemAccess | undefined;
if (typeof candidate?.showDirectoryPicker === 'function') {
return true;
}
@@ -1554,6 +1544,11 @@ export class ModifierKeyEmitter extends Emitter<IModifierKeyStatus> {
};
this._subscriptions.add(domEvent(document.body, 'keydown', true)(e => {
// if keydown event is repeated, ignore it #112347
if (e.repeat) {
return;
}
const event = new StandardKeyboardEvent(e);
if (e.altKey && !this._keyStatus.altKey) {
@@ -1666,3 +1661,9 @@ export class ModifierKeyEmitter extends Emitter<IModifierKeyStatus> {
this._subscriptions.dispose();
}
}
export function getCookieValue(name: string): string | undefined {
const match = document.cookie.match('(^|[^;]+)\\s*' + name + '\\s*=\\s*([^;]+)'); // See https://stackoverflow.com/a/25490531
return match ? match.pop() : undefined;
}