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: [lw-12251] do not inject cip30 api #972

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading