Skip to content

Commit

Permalink
fix: [lw-12251] do not inject cip30 api
Browse files Browse the repository at this point in the history
  • Loading branch information
vetalcore committed Feb 6, 2025
1 parent 24ea330 commit 89a4d4f
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/pages/Content/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import { Messaging } from '../../api/messaging';
import { storage } from 'webextension-polyfill';
import {
MIGRATION_KEY,
MigrationState,
} from '../../api/migration-tool/migrator/migration-state.data';

const injectScript = () => {
const script = document.createElement('script');
Expand All @@ -16,20 +11,8 @@ const injectScript = () => {
};

async function shouldInject() {
const { laceMigration } = (await storage.local.get([MIGRATION_KEY])) || {
laceMigration: undefined,
};

// Prevent injection into window.cardano namespace if migration has been completed
// or if the user has dismissed because they are having issues migrating (setting migration state back to 'none')
if (laceMigration === MigrationState.Completed) return false;
const documentElement = document.documentElement.nodeName;
const docElemCheck = documentElement
? documentElement.toLowerCase() === 'html'
: true;
const { docType } = window.document;
const docTypeCheck = docType ? docType.name === 'html' : true;
return docElemCheck && docTypeCheck;
// do not inject since the migration is not dismissible anymore
return false
}

if (await shouldInject()) {
Expand Down

0 comments on commit 89a4d4f

Please sign in to comment.