title: How to make GM_getValue existent in Greasemonkey on Firefox?
body: <p><em>The dupe candidate is for previous GM versions. The problem is likely somewhere around the different scopes where the userscripts can run, as described <a href="https://stackoverflow.com/questions/551028/greasemonkey-script-and-function-scope">here</a>. However, as described <a href="https://wiki.greasespot.net/Greasemonkey_Manual:Environment" rel="noreferrer">here</a>, this functionality is currently undocumented for Greasemonkey 4.0.</em></p>
  
  <p>I have this Greasemonkey demo script:</p>
  
  <pre><code>// ==UserScript==
  // @name         GM_getValue, GM_setValue don't work demo
  // @version      0.2
  // @author       You
  // @include      /^https:\/\/stackoverflow.com/$/
  // @grant        GM_getValue
  // @grant        GM_setValue
  // @run-at       document-end
  // ==/UserScript==
  
  console.log('script started');
  var id = GM_getValue('testName', 0);
  console.log('got ' + id);
  id++;
  GM_setValue('testName', id);
  </code></pre>
  
  <p>Calling this with the <a href="https://stackoverflow.com/">https://stackoverflow.com/</a>, it is well visible that it is called.</p>
  
  <p>However, I get this error on the console:</p>
  
  <pre><code>Script error:  
  ReferenceError: GM_getValue is not defined
  Stack trace:
  userScript@user-script:demosrv/GM_getValue%2C%20GM_setValue%20don%27t%20work%20demo:372:5
  scopeWrapper@user-script:demosrv/GM_getValue%2C%20GM_setValue%20don%27t%20work%20demo:381:9
  @user-script:demosrv/GM_getValue%2C%20GM_setValue%20don%27t%20work%20demo:361:17
  </code></pre>
  
  <p>I've digged docs a lot, but it seems <code>GM_{get,set}Value</code> simply don't want to exist.</p>
  
  <p>Why is it so? How to make it working?</p>
  
  <p>I am using Firefox.</p>