I'm running this script on the Facebook homepage. It gets all the conversations in the dock in the bottom and gets their __FB_TOKENs.
// ==UserScript==
// @name MyScript
// @namespace MyNameSpance
// @include /https?://(www.)?facebook.com(/.*)?/
// @require http://code.jquery.com/jquery-2.1.0.min.js
// @version 0.0.0
// @grant none
// ==/UserScript==
(function () {
  // Don't run on frames or iframes
  if (window.top != window.self) {
    return ;
  }
  window.addEventListener('load', function () {
    var element = $('.fbNubGroup.clearfix.videoCallEnabled');
    console.log('SCRIPT ELEMENT: ', element); // is displayed on the console
    var children = element.children();
    console.log('SCRIPT CHILDREN: ', children); // is displayed on the console
    for (var i = 0; i < children.length; i++) {
      var child = $(children[i]);
      console.log('SCRIPT CHILD: ', child); // is displayed on the console
      /*
      child :
        Object [div.someClasses]
          + 0: div.someClasses
            + __FB_TOKEN: [ 267 ]
      */
      console.log('SCRIPT CHILD[0]: ', child[0]); // is displayed on the console
      console.log('SCRIPT CHILD[0].__FB_TOKEN:', child[0].__FB_TOKEN); // UNDEFINED
      var key = child[0].__FB_TOKEN[0];
      console.log('SCRIPT KEY: ', key); // not displayed
    }
  }, false);
}) ();
With @grant none, it works as expected and I get:
However, if I change @grant none to @grant GM_xmlhttpRequest, the script does not work anymore. It gives:
and throws an exception on the child[0].__FB_TOKEN line.
I don't understand why, because the CHILD[0] did not change:
Why is changing the @grant none breaking the script?


