Store foreign-origin approvals per frame origin (#36)

This commit is contained in:
Maxim Baz
2019-02-24 18:30:50 +01:00
committed by GitHub
parent bf457d622c
commit b1abed2f2b
2 changed files with 21 additions and 22 deletions

View File

@@ -93,7 +93,7 @@
// ensure the origin is the same, or ask the user for permissions to continue
if (window.location.origin !== request.origin) {
if (!request.allowForeign) {
if (!request.allowForeign || request.foreignFills[window.location.origin] === false) {
return result;
}
var message =
@@ -101,7 +101,8 @@
"different origin than the main document in this tab. Do you wish to proceed?\n\n" +
`Tab origin: ${request.origin}\n` +
`Embedded origin: ${window.location.origin}`;
if (!request.approvedForeign) {
if (request.foreignFills[window.location.origin] !== true) {
result.foreignOrigin = window.location.origin;
result.foreignFill = confirm(message);
if (!result.foreignFill) {
return result;