mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
replace mutation observer with dom#asDomUri, #75061
This commit is contained in:
@@ -14,6 +14,8 @@ import { Emitter, Event } from 'vs/base/common/event';
|
||||
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';
|
||||
|
||||
export function clearNode(node: HTMLElement): void {
|
||||
while (node.firstChild) {
|
||||
@@ -1181,3 +1183,23 @@ export function animate(fn: () => void): IDisposable {
|
||||
let stepDisposable = scheduleAtNextAnimationFrame(step);
|
||||
return toDisposable(() => stepDisposable.dispose());
|
||||
}
|
||||
|
||||
|
||||
|
||||
const _location = URI.parse(window.location.href);
|
||||
|
||||
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-resources/fetch', query: uri.toString() });
|
||||
}
|
||||
return uri;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user