Skip to content

fix: get ownerDocument before calling element.evaluate(...) #1826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

borgateo
Copy link

Context

in data-broker-protection debugger when using safeQuerySelectorXPath, a DOMException was thrown with the message:

"safeQuerySelectorXPath threw DOMException: Node cannot be used in a document other than the one in which it was created safeQuerySelectorXPath utils.js:113"

This occurred because nodes created in one document (e.g., from an iframe) cannot be used in another document context.

Solution

Added a check to ensure that the node’s ownerDocument matches the current document before proceeding with operations in safeQuerySelectorXPath. This prevents cross-document node usage and avoids the DOMException.

refactor: extract getOwnerDocument helper function to follow DRY principle
Copy link

netlify bot commented Jul 15, 2025

Deploy Preview for content-scope-scripts ready!

Name Link
🔨 Latest commit d0558b2
🔍 Latest deploy log https://app.netlify.com/projects/content-scope-scripts/deploys/68769f5d757b2b00081ffbf3
😎 Deploy Preview https://deploy-preview-1826--content-scope-scripts.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

Temporary Branch Update

The temporary branch has been updated with the latest changes. Below are the details:

Please use the above install command to update to the latest version.

Copy link

[Beta] Generated file diff

Time updated: Tue, 15 Jul 2025 18:36:02 GMT

Android
    - android/brokerProtection.js

File has changed

Integration
    - integration/contentScope.js

File has changed

Windows
    - windows/contentScope.js

File has changed

Apple
    - dist/contentScopeIsolated.js

File has changed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant