diff --git a/WindowScript.js b/WindowScript.js index a9e2e64..34965c7 100644 --- a/WindowScript.js +++ b/WindowScript.js @@ -70,8 +70,14 @@ }, }; } - - window.parent = new Proxy(window.parent, handle('parent')); - window.opener = new Proxy(window.opener, handle('opener')); + + if (window.parent !== window) { + window.parent = new Proxy(window.parent, handle('parent')); + } + + if (window.opener) { + window.opener = new Proxy(window.opener, handle('opener')); + } + window.postMessage = new Proxy(window.postMessage, handle('self')); })();