File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
web-client/iron-remote-desktop/src Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 7171 let lastSentClipboardData: ClipboardData | null = null ;
7272 let lastClipboardMonitorLoopError: Error | null = null ;
7373
74+ let componentDestroyed = false ;
75+
7476 /* Firefox-specific BEGIN */
7577
7678 // See `ffRemoteClipboardData` variable docs below
185187
186188 // Called periodically to monitor clipboard changes
187189 async function onMonitorClipboard() {
188- if (! document .hasFocus ()) {
189- setTimeout (onMonitorClipboard , CLIPBOARD_MONITORING_INTERVAL );
190- return ;
191- }
192-
193190 try {
191+ if (! document .hasFocus ()) {
192+ return ;
193+ }
194+
194195 var value = await navigator .clipboard .read ();
195196
196197 // Clipboard is empty
291292 lastClipboardMonitorLoopError = err ;
292293 }
293294 } finally {
294- setTimeout (onMonitorClipboard , CLIPBOARD_MONITORING_INTERVAL );
295+ if (! componentDestroyed ) {
296+ setTimeout (onMonitorClipboard , CLIPBOARD_MONITORING_INTERVAL );
297+ }
295298 }
296299 }
297300
723726
724727 onDestroy (() => {
725728 window .removeEventListener (' resize' , resizeHandler );
729+ componentDestroyed = true ;
726730 });
727731 </script >
728732
You can’t perform that action at this time.
0 commit comments