mirror of
https://github.com/Microsoft/vscode
synced 2024-08-24 19:46:05 +00:00
webview - remove more traces (#128128)
* webview - remove more traces * more removal
This commit is contained in:
parent
e144d6e951
commit
d0df79be50
|
@ -29,7 +29,6 @@ app.once('ready', () => {
|
|||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
contextIsolation: false,
|
||||
webviewTag: true,
|
||||
enableWebSQL: false,
|
||||
nativeWindowOpen: true
|
||||
}
|
||||
|
|
|
@ -362,13 +362,7 @@ export class Sash extends Disposable {
|
|||
return;
|
||||
}
|
||||
|
||||
// Select both iframes and webviews; internally Electron nests an iframe
|
||||
// in its <webview> component, but this isn't queryable.
|
||||
const iframes = [
|
||||
...getElementsByTagName('iframe'),
|
||||
...getElementsByTagName('webview'),
|
||||
];
|
||||
|
||||
const iframes = getElementsByTagName('iframe');
|
||||
for (const iframe of iframes) {
|
||||
iframe.style.pointerEvents = 'none'; // disable mouse events on iframes as long as we drag the sash
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ import { ElectronURLListener } from 'vs/platform/url/electron-main/electronUrlLi
|
|||
import { serve as serveDriver } from 'vs/platform/driver/electron-main/driver';
|
||||
import { IMenubarMainService, MenubarMainService } from 'vs/platform/menubar/electron-main/menubarMainService';
|
||||
import { registerContextMenuListener } from 'vs/base/parts/contextmenu/electron-main/contextmenu';
|
||||
import { sep, posix, join, isAbsolute } from 'vs/base/common/path';
|
||||
import { posix, join, isAbsolute } from 'vs/base/common/path';
|
||||
import { joinPath } from 'vs/base/common/resources';
|
||||
import { localize } from 'vs/nls';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
|
@ -200,41 +200,6 @@ export class CodeApplication extends Disposable {
|
|||
// !!! DO NOT CHANGE without consulting the documentation !!!
|
||||
//
|
||||
app.on('web-contents-created', (event, contents) => {
|
||||
contents.on('will-attach-webview', (event, webPreferences, params) => {
|
||||
|
||||
const isValidWebviewSource = (source: string | undefined): boolean => {
|
||||
if (!source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const uri = URI.parse(source);
|
||||
if (uri.scheme === Schemas.vscodeWebview) {
|
||||
return uri.path === '/index.html' || uri.path === '/electron-browser-index.html';
|
||||
}
|
||||
|
||||
const srcUri = uri.fsPath.toLowerCase();
|
||||
const rootUri = URI.file(this.environmentMainService.appRoot).fsPath.toLowerCase();
|
||||
|
||||
return srcUri.startsWith(rootUri + sep);
|
||||
};
|
||||
|
||||
// Ensure defaults
|
||||
delete webPreferences.preload;
|
||||
webPreferences.nodeIntegration = false;
|
||||
|
||||
// Verify URLs being loaded
|
||||
// https://github.com/electron/electron/issues/21553
|
||||
if (isValidWebviewSource(params.src) && isValidWebviewSource((webPreferences as { preloadURL: string }).preloadURL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete (webPreferences as { preloadURL: string | undefined }).preloadURL; // https://github.com/electron/electron/issues/21553
|
||||
|
||||
// Otherwise prevent loading
|
||||
this.logService.error('webContents#web-contents-created: Prevented webview attach');
|
||||
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
contents.on('will-navigate', event => {
|
||||
this.logService.error('webContents#will-navigate: Prevented webcontent navigation');
|
||||
|
|
|
@ -193,7 +193,6 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||
enableWebSQL: false,
|
||||
spellcheck: false,
|
||||
nativeWindowOpen: true,
|
||||
webviewTag: true,
|
||||
zoomFactor: zoomLevelToZoomFactor(windowSettings?.zoomLevel),
|
||||
...this.environmentMainService.sandbox ?
|
||||
|
||||
|
|
|
@ -169,8 +169,7 @@ app.on('ready', () => {
|
|||
contextIsolation: false,
|
||||
enableWebSQL: false,
|
||||
spellcheck: false,
|
||||
nativeWindowOpen: true,
|
||||
webviewTag: true
|
||||
nativeWindowOpen: true
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue