diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/services/content/ServiceWebview.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/components/services/content/ServiceWebview.js b/src/components/services/content/ServiceWebview.js index 6d6089793..66dc8af41 100644 --- a/src/components/services/content/ServiceWebview.js +++ b/src/components/services/content/ServiceWebview.js | |||
@@ -95,10 +95,18 @@ class ServiceWebview extends Component { | |||
95 | preload={preloadScript} | 95 | preload={preloadScript} |
96 | partition={service.partition} | 96 | partition={service.partition} |
97 | onDidAttach={() => { | 97 | onDidAttach={() => { |
98 | setWebviewReference({ | 98 | // Force the event handler to run in a new task. |
99 | serviceId: service.id, | 99 | // This resolves a race condition when the `did-attach` is called, |
100 | webview: this.webview.view, | 100 | // but the webview is not attached to the DOM yet: |
101 | }); | 101 | // https://github.com/electron/electron/issues/31918 |
102 | // This prevents us from immediately attaching listeners such as `did-stop-load`: | ||
103 | // https://github.com/ferdium/ferdium-app/issues/157 | ||
104 | setTimeout(() => { | ||
105 | setWebviewReference({ | ||
106 | serviceId: service.id, | ||
107 | webview: this.webview.view, | ||
108 | }); | ||
109 | }, 0); | ||
102 | }} | 110 | }} |
103 | onUpdateTargetUrl={this.updateTargetUrl} | 111 | onUpdateTargetUrl={this.updateTargetUrl} |
104 | useragent={service.userAgent} | 112 | useragent={service.userAgent} |