Skip to content

Commit

Permalink
prevent other extensions from overriding the injected provider
Browse files Browse the repository at this point in the history
  • Loading branch information
jfschwarz committed Jun 4, 2024
1 parent aadb408 commit 1bac96f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion extension/src/injection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,18 @@ if (window.ethereum) {

// inject bridged ethereum provider
const injectedProvider = new InjectedProvider()
window.ethereum = injectedProvider
Object.defineProperties(window, {
ethereum: {
get() {
return injectedProvider
},
set() {
// do nothing
},
configurable: false,
},
})

console.log('injected into', document.title)

// establish message bridge for location requests
Expand Down

0 comments on commit 1bac96f

Please sign in to comment.