block doubly-opening open

This commit is contained in:
Elliott Beach 2017-12-02 13:27:18 -06:00
parent 90b2e60c71
commit c596c91edb
No known key found for this signature in database
GPG Key ID: 55ED1AE279F28D80
1 changed files with 15 additions and 12 deletions

View File

@ -199,19 +199,22 @@
}
};
const oldWindowOpen = window.open;
const windowOpenProxy = new Proxy(window.open, {
apply: function (target, thisArg, argumentsList) {
console.log("window.open =", oldWindowOpen);
const wnd = oldWindowOpen.apply(thisArg, argumentsList);
featuresToBlock.forEach((v) => blockFeatureAtKeyPath(v, wnd));
return wnd;
}
});
Object.defineProperty(window, "open", {
get: () => windowOpenProxy
});
const blockOpen = function(window){
const oldWindowOpen = window.open;
const windowOpenProxy = new Proxy(window.open, {
apply: function (target, thisArg, argumentsList) {
const wnd = oldWindowOpen.apply(thisArg, argumentsList);
blockOpen(wnd);
featuresToBlock.forEach((v) => blockFeatureAtKeyPath(v, wnd));
return wnd;
}
});
Object.defineProperty(window, "open", {
get: () => windowOpenProxy
});
}
blockOpen(window);
featuresToBlock.forEach((v) => blockFeatureAtKeyPath(v));
// Next, delete the WEB_API_MANAGER_PAGE global property. Technically