#575 ✓resolved
Iñigo Illán

GM_getValue does not work as expected in Fennec

Reported by Iñigo Illán | January 4th, 2012 @ 04:55 AM | in Bug Crushing

Executing this script

// ==UserScript==
// @name           Test
// @namespace      http://www.onekin.org/
// @description    Test
// @include        *
// ==/UserScript==


GM_setValue("Test", "test");

console.log(GM_getValue("Test");

console.log(GM_getValue("scriptvals.Test@httpwww.onekin.org.Test"));

First GM_getValue doesn't return any value, while the second one returns "test"

Comments and changes to this ticket

  • Erik Vold

    Erik Vold January 8th, 2012 @ 08:47 PM

    • Assigned user set to “Erik Vold”
    • Milestone set to Bug Crushing
    • Importance changed from “” to “Low”
  • Geggi

    Geggi March 12th, 2012 @ 08:03 AM

    This is a big problem as many available scripts use GM_getValue. I hope this ticket will be addressed soon...

  • Geggi

    Geggi March 13th, 2012 @ 08:35 AM

    I came up with a workaround to this problem.
    Add the following code at the top of your script and adapt the variable prefix to your script:

    var prefix = "scriptvals.Test@httpwww.onekin.org.";
    
    // Check for Scriptish bug in Fennec browser
    this.GM_setValue("browser", "browser");
    var test_browser = this.GM_getValue("browser");
    if (!test_browser) {
      console.log("Scriptish GM_getValue bug detected");
    
      var GM_getValue_Orig = this.GM_getValue;
      this.GM_getValue=function (key,def) {
        return GM_getValue_Orig(prefix+key,def);
      }
    }
    

    Then, following GM_getValue calls will work as expected.
    Given the above example, the following code

    GM_setValue("Test", "ABC");
    console.log(GM_getValue("Test");
    

    will return "ABC".

  • Erik Vold

    Erik Vold September 22nd, 2012 @ 11:38 AM

    • State changed from “new” to “resolved”

    This sucked. I"ve dropped Fennec support because I have to wipe out all of the old Fennec code for the new Native Fennec code..

  • milberalinas

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket

Referenced by