aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/popup-nested.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg/js/popup-nested.js')
-rw-r--r--ext/fg/js/popup-nested.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/ext/fg/js/popup-nested.js b/ext/fg/js/popup-nested.js
index 7df4e4e2..ad235cc6 100644
--- a/ext/fg/js/popup-nested.js
+++ b/ext/fg/js/popup-nested.js
@@ -17,20 +17,23 @@
*/
-async function popupNestedSetup() {
- const options = await apiOptionsGet();
- const popupNestingMaxDepth = options.scanning.popupNestingMaxDepth;
+let popupNestedInitialized = false;
- let depth = null;
- const match = /[&?]depth=([^&]*?)(?:&|$)/.exec(location.href);
- if (match !== null) {
- depth = parseInt(match[1], 10);
+async function popupNestedInitialize(id, depth, parentFrameId) {
+ if (popupNestedInitialized) {
+ return;
}
+ popupNestedInitialized = true;
+
+ const options = await apiOptionsGet();
+ const popupNestingMaxDepth = options.scanning.popupNestingMaxDepth;
if (!(typeof popupNestingMaxDepth === 'number' && typeof depth === 'number' && depth < popupNestingMaxDepth)) {
return;
}
+ window.frontendInitializationData = {id, depth, parentFrameId};
+
const scriptSrcs = [
'/fg/js/frontend-api-sender.js',
'/fg/js/popup.js',
@@ -44,5 +47,3 @@ async function popupNestedSetup() {
document.body.appendChild(script);
}
}
-
-popupNestedSetup();