Skip to content

Commit

Permalink
Add extra timeout for safari webview loading checks
Browse files Browse the repository at this point in the history
Fixes #143030

Not sure of a better way to fix this right now
  • Loading branch information
mjbvz committed Feb 15, 2022
1 parent 6e63b1e commit e491208
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/vs/workbench/contrib/webview/browser/pre/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ onDomReady(() => {
}

if (!options.allowScripts && isSafari) {
// On Safari for iframes with scripts disabled, the `DOMContentLoaded` never seems to be fired.
// On Safari for iframes with scripts disabled, the `DOMContentLoaded` never seems to be fired: https://bugs.webkit.org/show_bug.cgi?id=33604
// Use polling instead.
const interval = setInterval(() => {
// If the frame is no longer mounted, loading has stopped
Expand All @@ -881,7 +881,8 @@ onDomReady(() => {
const contentDocument = assertIsDefined(newFrame.contentDocument);
if (contentDocument.readyState !== 'loading') {
clearInterval(interval);
onFrameLoaded(contentDocument);
// Workaround for https://bugs.webkit.org/show_bug.cgi?id=236624
setTimeout(() => onFrameLoaded(contentDocument), 50);
}
}, 10);
} else {
Expand Down

0 comments on commit e491208

Please sign in to comment.