Merge pull request #1 from elliott-beach/patch-open2
block doubly-opening open
This commit is contained in:
commit
5a9b140ec8
1 changed files with 15 additions and 12 deletions
|
@ -199,11 +199,12 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const blockOpen = function(window){
|
||||||
const oldWindowOpen = window.open;
|
const oldWindowOpen = window.open;
|
||||||
const windowOpenProxy = new Proxy(window.open, {
|
const windowOpenProxy = new Proxy(window.open, {
|
||||||
apply: function (target, thisArg, argumentsList) {
|
apply: function (target, thisArg, argumentsList) {
|
||||||
console.log("window.open =", oldWindowOpen);
|
|
||||||
const wnd = oldWindowOpen.apply(thisArg, argumentsList);
|
const wnd = oldWindowOpen.apply(thisArg, argumentsList);
|
||||||
|
blockOpen(wnd);
|
||||||
featuresToBlock.forEach((v) => blockFeatureAtKeyPath(v, wnd));
|
featuresToBlock.forEach((v) => blockFeatureAtKeyPath(v, wnd));
|
||||||
return wnd;
|
return wnd;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +212,9 @@
|
||||||
Object.defineProperty(window, "open", {
|
Object.defineProperty(window, "open", {
|
||||||
get: () => windowOpenProxy
|
get: () => windowOpenProxy
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
blockOpen(window);
|
||||||
featuresToBlock.forEach((v) => blockFeatureAtKeyPath(v));
|
featuresToBlock.forEach((v) => blockFeatureAtKeyPath(v));
|
||||||
|
|
||||||
// Next, delete the WEB_API_MANAGER_PAGE global property. Technically
|
// Next, delete the WEB_API_MANAGER_PAGE global property. Technically
|
||||||
|
|
Loading…
Reference in a new issue