diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-08-18 21:49:55 -0400 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-09-02 19:33:28 -0400 |
commit | 3491affcf13ef10b78714d4955da6ee9aeb11457 (patch) | |
tree | c14b6cc396b4e1f7785323101502ad67ed204ff5 /ext/fg/js/popup-nested.js | |
parent | 53aad0bef68bf6930b684fda4a25e1a045cd800e (diff) |
Update nested initialization parameters passed via message rather than using the URL query string
Diffstat (limited to 'ext/fg/js/popup-nested.js')
-rw-r--r-- | ext/fg/js/popup-nested.js | 19 |
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(); |