Skip to content
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

fix(content-script): retrieve href through getAttribute #472

Closed
wants to merge 2 commits into from

Conversation

raducristianpopa
Copy link
Member

@raducristianpopa raducristianpopa commented Aug 5, 2024

Context

Closes #.

Changes proposed in this pull request

@github-actions github-actions bot added the area: content Improvements or additions to extension content script label Aug 5, 2024
@raducristianpopa
Copy link
Member Author

raducristianpopa commented Aug 5, 2024

Extension builds preview

Name Link
Latest commit 01946bb
Latest job logs Run #10243423769
BadgeDownload
BadgeDownload

Comment on lines +493 to +494
if (!href)
throw new Error('Monetization link is missing the "href" attribute.')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!href)
throw new Error('Monetization link is missing the "href" attribute.')
if (!href) {
throw new Error('Monetization link is missing the "href" attribute.')
}

throw new Error('Monetization link is missing the "href" attribute.')
checkWalletAddressUrlFormat(href)
const response = await checkWalletAddressUrlCall({
walletAddressUrl: href
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could have whitespace here. Why not do the .trim() part here only (when assigning href)?

@@ -220,7 +220,7 @@ export class MonetizationTagManager extends EventEmitter {
record.type === 'attributes' &&
record.attributeName === 'href' &&
target instanceof HTMLLinkElement &&
target.href !== record.oldValue
target.getAttribute('href') !== record.oldValue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is oldValue equivalent to getAttribute() or the property one?

Also, do we disallow protocol relative URls this way here or should only via the https:// check below?

@raducristianpopa
Copy link
Member Author

Closing this for now - context: #473 (comment).

@raducristianpopa raducristianpopa deleted the rp/href-getattr branch August 20, 2024 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: content Improvements or additions to extension content script
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants