Merge from vscode 70dc55955d586ebd427658b43cdb344f2047f9c2 (#6789)

This commit is contained in:
Anthony Dresser
2019-08-16 21:47:46 -07:00
committed by GitHub
parent fb26126bcb
commit 41d8663b09
79 changed files with 1815 additions and 572 deletions

View File

@@ -15,7 +15,7 @@ import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle'
import * as platform from 'vs/base/common/platform';
import { coalesce } from 'vs/base/common/arrays';
import { URI } from 'vs/base/common/uri';
import { Schemas } from 'vs/base/common/network';
import { Schemas, RemoteAuthorities } from 'vs/base/common/network';
export function clearNode(node: HTMLElement): void {
while (node.firstChild) {
@@ -1193,14 +1193,21 @@ export function asDomUri(uri: URI): URI {
if (!uri) {
return uri;
}
if (!platform.isWeb) {
//todo@joh remove this once we have sw in electron going
return uri;
}
if (Schemas.vscodeRemote === uri.scheme) {
// rewrite vscode-remote-uris to uris of the window location
// so that they can be intercepted by the service worker
return _location.with({ path: '/vscode-remote', query: JSON.stringify(uri) });
if (platform.isWeb) {
// rewrite vscode-remote-uris to uris of the window location
// so that they can be intercepted by the service worker
return _location.with({ path: '/vscode-remote', query: JSON.stringify(uri) });
} else {
return RemoteAuthorities.rewrite(uri.authority, uri.path);
}
}
return uri;
}
/**
* returns url('...')
*/
export function asCSSUrl(uri: URI): string {
return `url('${asDomUri(uri).toString(true).replace(/'/g, '%27')}')`;
}