Set tab restrictions status across all frames.

This commit is contained in:
hackademix 2018-10-12 22:35:46 +02:00
parent 9228798daa
commit e44fce3ebd
2 changed files with 6 additions and 10 deletions

View File

@ -318,7 +318,7 @@ var RequestGuard = (() => {
}
capabilities = perms.capabilities;
} else {
if (!isMainFrame && type === "sub_frame") {
if (isMainFrame || type === "sub_frame") {
await Settings.enforceTabRestrictions(tabId);
}
}

View File

@ -52,15 +52,12 @@
// mess with it, though, so we wrap it around auto-hiding accessors
if (this.config.MARKER = MARKER) {
let splitter = `${MARKER},`;
this.getWindowName = () => window.name.split(splitter).pop();
let tabInfoRx = new RegExp(`^${MARKER}\\[([^]*?)\\]${MARKER},`);
let name = window.name;
try {
name = top.name;
} catch(e) {
// won't work cross-origin
}
let tabInfoMatch = name.match(tabInfoRx);
let tabInfoMatch = window.name.match(tabInfoRx);
if (tabInfoMatch) {
try {
this.config.tabInfo = JSON.parse(tabInfoMatch[1]);
@ -68,8 +65,7 @@
error(e);
}
}
let splitter = `${MARKER},`;
this.getWindowName = () => window.name.split(splitter).pop();
Reflect.defineProperty(window.wrappedJSObject, "name", {
get: exportFunction(() => this.getWindowName(), window.wrappedJSObject),
set: exportFunction(value => {