Skip to content

Commit

Permalink
Update WindowScript.js
Browse files Browse the repository at this point in the history
  • Loading branch information
NDevTK authored Nov 14, 2024
1 parent 2935116 commit faf0f7f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions WindowScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@

function useProxy(object, handler) {
if (!object) return object;
// We cant proxy the current window.
if (object === window) return object;
if (proxies.has(object)) {
return proxies.get(object);
}
Expand Down Expand Up @@ -146,8 +144,14 @@
};
}

window.parent = useProxy(window.parent, handle('parent'));
if (window !== window.parent) {
window.parent = useProxy(window.parent, handle('parent'));
}

window.opener = useProxy(window.opener, handle('opener'));
window.postMessage = useProxy(window.postMessage, handle('self'));
// We cant proxy the current window or window.top but creating the proxies anyway.
useProxy(window, handle('self'));
useProxy(window.top, handle('self'));
window.open = openHook;
})();

0 comments on commit faf0f7f

Please sign in to comment.