Skip to content

Commit

Permalink
fix: do not inject in iframe
Browse files Browse the repository at this point in the history
  • Loading branch information
slient-coder committed Mar 17, 2023
1 parent 7856451 commit 0693694
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/content-script/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,22 @@ function blockedDomainCheck() {
return false;
}

function iframeCheck() {
const isInIframe = self != top;
if (isInIframe) {
return true;
} else {
return false;
}
}

/**
* Determines if the provider should be injected
*
* @returns {boolean} {@code true} Whether the provider should be injected
*/
function shouldInjectProvider() {
return doctypeCheck() && suffixCheck() && documentElementCheck() && !blockedDomainCheck();
return doctypeCheck() && suffixCheck() && documentElementCheck() && !blockedDomainCheck() && !iframeCheck();
}

if (shouldInjectProvider()) {
Expand Down

0 comments on commit 0693694

Please sign in to comment.