Skip to content

Commit 1cb8672

Browse files
committed
fix raf support for cross domain stuff
1 parent 05e2442 commit 1cb8672

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

webgl/resources/webgl-utils.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -869,16 +869,20 @@
869869
* @return {boolean} true if window is on screen.
870870
*/
871871
function isFrameVisible(window) {
872-
var iframe = getIFrameForWindow(window);
873-
if (!iframe) {
874-
return true;
875-
}
872+
try {
873+
var iframe = getIFrameForWindow(window);
874+
if (!iframe) {
875+
return true;
876+
}
876877

877-
var bounds = iframe.getBoundingClientRect();
878-
var isVisible = bounds.top < window.parent.innerHeight && bounds.bottom >= 0 &&
879-
bounds.left < window.parent.innerWidth && bounds.right >= 0;
878+
var bounds = iframe.getBoundingClientRect();
879+
var isVisible = bounds.top < window.parent.innerHeight && bounds.bottom >= 0 &&
880+
bounds.left < window.parent.innerWidth && bounds.right >= 0;
880881

881-
return isVisible && isFrameVisible(window.parent);
882+
return isVisible && isFrameVisible(window.parent);
883+
} catch (e) {
884+
return true; // We got a security error?
885+
}
882886
};
883887

884888
/**

0 commit comments

Comments
 (0)