fix #1398, prevent injecting xml without xml suffix

feature/default_network_editable
William Chong 7 years ago
parent c30b543a80
commit 03f86acd60
  1. 12
      app/scripts/contentscript.js

@ -96,7 +96,7 @@ function logStreamDisconnectWarning (remoteLabel, err) {
}
function shouldInjectWeb3 () {
return doctypeCheck() || suffixCheck()
return doctypeCheck() && suffixCheck() && documentElementCheck()
}
function doctypeCheck () {
@ -104,7 +104,7 @@ function doctypeCheck () {
if (doctype) {
return doctype.name === 'html'
} else {
return false
return true
}
}
@ -121,6 +121,14 @@ function suffixCheck () {
return true
}
function documentElementCheck () {
var documentElement = document.documentElement.nodeName
if (documentElement) {
return documentElement.toLowerCase() === 'html'
}
return true
}
function redirectToPhishingWarning () {
console.log('MetaMask - redirecting to phishing warning')
window.location.href = 'https://metamask.io/phishing.html'

Loading…
Cancel
Save