Script overwriting JSON global
3

The following script, beginning with version 2.9.43, overwrites the JSON global and breaks our application.

https://connect.facebook.net/signals/config/223792368386481?v=2.9.43&r=stable

Ryan
Asked about 2 months ago
Ryan

I don't know where to report this bug. Surely overwriting a global object is bad practice.

September 23 at 8:43 AM
Chris

Same issue here, the window.JSON object is being changed on any site that loads this script.

September 23 at 10:22 AM
Selected Answer
1

Same problem here. I made a post about it on stackoverflow.

https://stackoverflow.com/questions/69305518/facebook-pixel-script-overriding-global-json

September 23 at 11:58 AM
Diogo
1

I was researching on this and found something interesting.

The code inside fbevents.js didn't mess with the global scope, but another script was loaded, and this script is changing the global JSON.

The script is on this URL: https://connect.facebook.net/signals/config/1718502398417441?v=2.9.42&r=stable

You can open this and search for j.JSON=n. If you prettify the file, add spaces. It also adds JSON3 to the global scope. You can test typing window.JSON3.

September 23 at 12:22 PM
Diogo
Ryan

Yes, that is the same source code as referenced in the question. It appears that the numbers in the url are account identifiers. You are correct that the issue surfaces in version 2.9.42 rather than 2.9.43.

September 23 at 12:35 PM
Diogo

You're right! I think I misread your link ;D sry

September 23 at 12:41 PM
Diogo

I posted all the details on the stack overflow link

September 23 at 12:50 PM
Ryan

Nice. I have another bug report in about this as well. Still waiting for a reply...

September 23 at 12:56 PM