Metamask-extension: MetaMask conflicts with AddThis Widget

Created on 19 Mar 2018  路  4Comments  路  Source: MetaMask/metamask-extension

Having MetaMask Chrome Extension installed results in broken Javascript on pages using the AddThis plugin.

I'm a little stumped on the cause of this since both codes are obfuscated (maybe unlucky name collision, and both MetaMask/AddThis aren't encapsulated properly?)

A Simple Example: https://jsfiddle.net/s6pnx5w3/1/

sh.d663e43787b663d5491cf753.html:1 Uncaught TypeError: (t.data || "").search is not a function
    at pmh (sh.d663e43787b663d5491cf753.html:1)
pmh @ sh.d663e43787b663d5491cf753.html:1
postMessage (async)
m._write @ contentscript.js:1
m._onMessage @ contentscript.js:1
postMessage (async)
o._write @ inpage.js:1
o @ inpage.js:1
(anonymous) @ inpage.js:1
1../lib/auto-reload.js @ inpage.js:1
i @ inpage.js:1
t @ inpage.js:1
(anonymous) @ inpage.js:1
(anonymous) @ contentscript.js:1
(anonymous) @ contentscript.js:1
1../lib/port-stream.js @ contentscript.js:1
i @ contentscript.js:1
l @ contentscript.js:1
(anonymous) @ contentscript.js:1

Most helpful comment

@Meekohi metamask communicates with the page via window.postMessage and message event listener APIs. It seems AddThis is not validating the received message correctly.

metamask's message:

t.data
//=> {target: "inpage", data: "ACK"}

AddThis's message handling

if ((t.data || "").search("atimg_ie") > -1) { /* ... */ }
//=> Uncaught TypeError: (t.data || "").search is not a function

Please file an issue on AddThis to properly validate messages

All 4 comments

@Meekohi metamask communicates with the page via window.postMessage and message event listener APIs. It seems AddThis is not validating the received message correctly.

metamask's message:

t.data
//=> {target: "inpage", data: "ACK"}

AddThis's message handling

if ((t.data || "").search("atimg_ie") > -1) { /* ... */ }
//=> Uncaught TypeError: (t.data || "").search is not a function

Please file an issue on AddThis to properly validate messages

Makes sense, thanks!

To people annoyed by these warning messages:

I reported this error to AddThis on March 21th 2018. So far I only received an acknowledge. Because Metamask is not a mainstream extension and the issue is minor, we can't really blame them for not fixing this immediately.

If you are still facing the bug and want to get rid of these nagging JS errors, you can report to AddThis again. Maybe popular request could change the deal.

To report, go to http://www.addthis.com/support and fill the form. An example of message:

Hi,

It seems that AddThis embedded JS code conflicts with Metamask, a popular Chrome and FF extension for Ethereum. Although Metamask is not widely adopted (we are talking about advanced blockchain software), a whole edgy community is using it. Conflicting with such module could harm AddThis reputation among a large group of prescribers.

The issue is described here: https:// github.com/MetaMask/metamask-extension/issues/3616

To reproduce it:

  • Open Chrome
  • Install and activate the Metamask extension
  • Open the Chrome Dev console
  • Visit https://www.addthis.com
  • Observe error messages in the Chrome Dev Console

Regards

Thanks, I got a similar vague acknowledgement when I explained it to them.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BMillman19 picture BMillman19  路  3Comments

1blockologist picture 1blockologist  路  3Comments

beether picture beether  路  4Comments

glitch003 picture glitch003  路  3Comments

kumavis picture kumavis  路  3Comments