diff options
Diffstat (limited to 'src/content/embeddingDocument.js')
-rw-r--r-- | src/content/embeddingDocument.js | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/content/embeddingDocument.js b/src/content/embeddingDocument.js index 75b0db0..eed04b1 100644 --- a/src/content/embeddingDocument.js +++ b/src/content/embeddingDocument.js @@ -1,18 +1,25 @@ if (ns.embeddingDocument) { ns.on("capabilities", () => { for (let policyType of ["object", "media"]) { - if (!ns.allows(policyType)) { - let request = { - id: `noscript-${policyType}-doc`, - type: policyType, - url: document.URL, - documentUrl: document.URL, - embeddingDocument: true, - }; + let request = { + id: `noscript-${policyType}-doc`, + type: policyType, + url: document.URL, + documentUrl: document.URL, + embeddingDocument: true, + }; + + if (ns.allows(policyType)) { + let handler = PlaceHolder.handlerFor(policyType); + if (handler && handler.selectFor(request).length > 0) { + seen.record({policyType, request, allowed: true}); + } + } else { let ph = PlaceHolder.create(policyType, request); if (ph.replacements.size > 0) { debug(`Created placeholder for ${policyType} at ${document.URL}`); seen.record({policyType, request, allowed: false}); + break; } } } |