From ecc1fd4bc6c31618f51052d0362e69f396e79ae3 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 12 Jul 2017 13:54:32 -0700 Subject: [PATCH] Fix webiew sometimes blank on first load Fixes #30464 Moves and gates setting the parition of the webview. Setting it in the current location seems to cause a race condition. --- src/vs/workbench/parts/html/browser/webview.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/parts/html/browser/webview.ts b/src/vs/workbench/parts/html/browser/webview.ts index a0f45c37359..08ab5e391d6 100644 --- a/src/vs/workbench/parts/html/browser/webview.ts +++ b/src/vs/workbench/parts/html/browser/webview.ts @@ -98,6 +98,9 @@ export default class Webview { private _options: WebviewOptions = {}, ) { this._webview = document.createElement('webview'); + if (!this._options.allowSvgs) { + this._webview.setAttribute('partition', `webview${Webview.index++}`); + } this._webview.style.width = '100%'; this._webview.style.height = '100%'; @@ -110,7 +113,6 @@ export default class Webview { this._webview.setAttribute('disableguestresize', ''); this._webview.setAttribute('webpreferences', 'contextIsolation=yes'); - this._webview.setAttribute('partition', `webview${Webview.index++}`); this._webview.preload = require.toUrl('./webview-pre.js'); this._webview.src = require.toUrl('./webview.html'); -- GitLab