Skip to content

Commit 1c4f6ac

Browse files
author
Matt Bierner
committed
Gate webview polling usage to safari when scripts are disabled
1 parent 2579c03 commit 1c4f6ac

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • src/vs/workbench/contrib/webview/browser/pre

src/vs/workbench/contrib/webview/browser/pre/main.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
(function () {
2020
'use strict';
2121

22+
const isSafari = navigator.vendor && navigator.vendor.indexOf('Apple') > -1 &&
23+
navigator.userAgent &&
24+
navigator.userAgent.indexOf('CriOS') === -1 &&
25+
navigator.userAgent.indexOf('FxiOS') === -1;
26+
2227
/**
2328
* Use polling to track focus of main webview and iframes within the webview
2429
*
@@ -514,7 +519,7 @@
514519
}, 0);
515520
}
516521

517-
if (host.fakeLoad && false) {
522+
if (host.fakeLoad && !options.allowScripts && isSafari) {
518523
// On Safari for iframes with scripts disabled, the `DOMContentLoaded` never seems to be fired.
519524
// Use polling instead.
520525
const interval = setInterval(() => {
@@ -524,7 +529,7 @@
524529
return;
525530
}
526531

527-
if (newFrame.contentDocument.readyState === 'complete') {
532+
if (newFrame.contentDocument.readyState !== 'loading') {
528533
clearInterval(interval);
529534
onFrameLoaded(newFrame.contentDocument);
530535
}

0 commit comments

Comments
 (0)