From 439b3e695ad3fca89d8eeff443cb21404d93e04d Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 1 Mar 2017 15:55:12 -0800 Subject: [PATCH] Move webview loaded event to fix extensions using previewHTML --- src/vs/workbench/parts/html/browser/webview-pre.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/parts/html/browser/webview-pre.js b/src/vs/workbench/parts/html/browser/webview-pre.js index 5d8bd1a61aff7..a59db8fc48f70 100644 --- a/src/vs/workbench/parts/html/browser/webview-pre.js +++ b/src/vs/workbench/parts/html/browser/webview-pre.js @@ -127,11 +127,6 @@ document.addEventListener("DOMContentLoaded", function (event) { // write new content onto iframe newFrame.contentDocument.open('text/html', 'replace'); - // set DOCTYPE for newDocument explicitly as DOMParser.parseFromString strips it off - // and DOCTYPE is needed in the iframe to ensure that the user agent stylesheet is correctly overridden - newFrame.contentDocument.write(''); - newFrame.contentDocument.write(newDocument.documentElement.innerHTML); - newFrame.contentDocument.close(); // workaround for https://github.com/Microsoft/vscode/issues/12865 // check new scrollTop and reset if neccessary @@ -143,6 +138,12 @@ document.addEventListener("DOMContentLoaded", function (event) { newFrame.style.display = 'block'; }); + // set DOCTYPE for newDocument explicitly as DOMParser.parseFromString strips it off + // and DOCTYPE is needed in the iframe to ensure that the user agent stylesheet is correctly overridden + newFrame.contentDocument.write(''); + newFrame.contentDocument.write(newDocument.documentElement.innerHTML); + newFrame.contentDocument.close(); + ipcRenderer.sendToHost('did-set-content', stats); });