I run this script on the main page of Facebook. He gets all the talk in the dock below and gets them __FB_TOKENs.
(function () {
if (window.top != window.self) {
return ;
}
window.addEventListener('load', function () {
var element = $('.fbNubGroup.clearfix.videoCallEnabled');
console.log('SCRIPT ELEMENT: ', element);
var children = element.children();
console.log('SCRIPT CHILDREN: ', children);
for (var i = 0; i < children.length; i++) {
var child = $(children[i]);
console.log('SCRIPT CHILD: ', child);
console.log('SCRIPT CHILD[0]: ', child[0]);
console.log('SCRIPT CHILD[0].__FB_TOKEN:', child[0].__FB_TOKEN);
var key = child[0].__FB_TOKEN[0];
console.log('SCRIPT KEY: ', key);
}
}, false);
}) ();
With @grant noneit works as expected, and I get:

However, if I change @grant noneto @grant GM_xmlhttpRequest, the script no longer works. He gives:

and throws an exception in the string child[0].__FB_TOKEN.
I do not understand why, because I have CHILD[0]not changed:

Why is changing @grant noneto break script?
source
share