aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/popup-nested.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-04-10 02:15:24 +0300
committersiikamiika <siikamiika@users.noreply.github.com>2020-04-11 21:01:27 +0300
commit61a96e327a815bda7fea4c5d2096dead901fdf33 (patch)
tree0fb76f6b407ab5d4668b674a9e164243a2995042 /ext/fg/js/popup-nested.js
parent9adbc80a70ea263ae97a853c3d9bb0b6109503bd (diff)
prevent injecting frontend multiple times
Diffstat (limited to 'ext/fg/js/popup-nested.js')
-rw-r--r--ext/fg/js/popup-nested.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/fg/js/popup-nested.js b/ext/fg/js/popup-nested.js
index f193aa36..3ecdf50c 100644
--- a/ext/fg/js/popup-nested.js
+++ b/ext/fg/js/popup-nested.js
@@ -44,15 +44,24 @@ async function popupNestedInitialize(id, depth, parentFrameId, url) {
}
popupNestedInitialized = true;
+ let optionsApplied = false;
+
const applyOptions = async () => {
const optionsContext = {depth, url};
const options = await apiOptionsGet(optionsContext);
const popupNestingMaxDepth = options.scanning.popupNestingMaxDepth;
- if (!(typeof popupNestingMaxDepth === 'number' && typeof depth === 'number' && depth < popupNestingMaxDepth)) {
+ const maxPopupDepthExceeded = !(
+ typeof popupNestingMaxDepth === 'number' &&
+ typeof depth === 'number' &&
+ depth < popupNestingMaxDepth
+ );
+ if (maxPopupDepthExceeded || optionsApplied) {
return;
}
+ optionsApplied = true;
+
window.frontendInitializationData = {id, depth, parentFrameId, url, proxy: true};
injectPopupNested();