Hi, I saw an error coming up into my script few moments ago, and I
digged to find the issue.
I saw that when trying to access a value stored with GM_setValue in
the onreadystatechange of the XMLHttpRequest object, the value is
undefined.

I made a small example code that you can test on any webpage.
The stored value is the current timestamp.
(Last GM nightly build, Aug 23) ; Firefox 6.0



Here's the code :

GM_setValue('test', ''+(new Date().getTime())+'');

var XHR = function(_constructor) {
    var xhr = this;
    xhr.open = function() {

        xhr.XMLHttpRequest = null;
        if (window.XMLHttpRequest) xhr.XMLHttpRequest = new
XMLHttpRequest();
        else xhr.XMLHttpRequest = new
ActiveXObject('Microsoft.XMLHTTP');

        xhr.XMLHttpRequest.onreadystatechange = function() {
            alert(xhr.XMLHttpRequest.readyState+'
'+GM_getValue('test'));
        };

        xhr.XMLHttpRequest.open('GET', _constructor.url, true);
        xhr.XMLHttpRequest.send(null);
    };
    this.open();
};

new XHR({
    method: 'GET',
    url: location.href
});

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en.

Reply via email to