diff --git a/index.js b/index.js
index <HASH>..<HASH> 100755
--- a/index.js
+++ b/index.js
@@ -709,7 +709,7 @@ const _bindWindow = (window, newWindowCb) => {
       timestamps.last = now;
     }
 
-    if (vrPresentState.isPresenting) {
+    if (vrPresentState.isPresenting && vrPresentState.glContext.canvas.ownerDocument.defaultView === window) {
       // wait for frame
       vrPresentState.compositor.WaitGetPoses(
         vrPresentState.system,
@@ -866,7 +866,7 @@ const _bindWindow = (window, newWindowCb) => {
         timestamps.total += diff;
         timestamps.last = now;
       }
-    } else if (isMlPresenting) {
+    } else if (isMlPresenting && mlGlContext.canvas.ownerDocument === window) {
       mlContext.WaitGetPoses(framebufferArray, transformArray, projectionArray, viewportArray, planesArray, numPlanesArray, controllersArray, gesturesArray);
       if (args.performance) {
         const now = Date.now();
Bugfix presenting to VR/ML in with multiple windows