Skip to content
This repository

Installation shouldn't fail when there is no parsable metadata #1562

Closed
kbntk opened this Issue June 04, 2012 · 16 comments

4 participants

kbntk arantius sergioabreu Ventero
kbntk
kbntk commented June 04, 2012

I can't install greasemonkey user scripts from file on version 0.9.20.
The scripts could be installed in previous versions.

Do you have the same problem?

If more information is needed, I will put it here.

kbntk
kbntk commented June 04, 2012

This is what I got from the error console in my new fresh profile when I tried to load the greasemonkey script from File->Open File menu:

Timestamp: 06/04/2012 11:52:44 PM
Error: script is null
Source File: resource://greasemonkey/remoteScript.js
Line: 362

arantius
Collaborator

What OS? Which file? What is its full path? All the rest of the details requested at http://wiki.greasespot.net/Greasemonkey_Manual:Getting_Help#What_to_Say ?

kbntk
kbntk commented June 05, 2012

OS: Kubuntu Linux 12.04
KDE 4.8.3
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:12.0) Gecko/20100101 Firefox/12.0
Scripts:
All my published script can't be installed right now:
https://userscripts.org/users/405846/scripts
I could install these scripts before.

Hint: I discovered that I can install other scripts like e.g.
http://userscripts.org/scripts/show/70238

sergioabreu

It's because the script is not UTF-8 and has special chars in it.
I had this issue. Once the file is charset UTF-8 you will be able to install again.

arantius
Collaborator

I can't install https://userscripts.org/scripts/version/113690/378080.user.js either from a file or that URL, I get the 'script is null' error mentioned. Haven't diagnosed why yet.

sergioabreu

My comment is related to first question. It seems last GM versions was "more tolerant" when the charset of the script file or text was not UTF-8. Now the script file MUST be UTF-8, I faced this because my scripts have latin chars sometimes... For me it worked, just convert the charset of the file.

arantius
Collaborator

Yes, a bit of the character set handling WRT downloading scripts changed recently. I thought it already forced UTF-8 somewhere, that might not have been true. If you can give me confirmation of a particular script that won't install in 0.9.20 but does in an earlier version that will make improving things easier.

Ventero

Actually the reason the scripts on https://userscripts.org/users/405846/scripts all throw this error is because parse returns null because extractMeta can't find the metadata, which is simply because there's no lines starting with // ==UserScript== and // ==/UserScript== in the script, only // // ==UserScript==.

arantius
Collaborator

Good catch, that should probably be return script, not return null.

kbntk
kbntk commented June 12, 2012

@sergioabreu:
My files are UTF-8 encoded: these on my hard disk as well as those uploaded to userscripts.org.
I checked it with vim, :set fileencoding
and I got fileencoding=utf-8

sergioabreu

Kbntk other point you should check is if you use any setTimeout in your scripts.
Last versions supported strings as the first argument.
Now GM only works with functions, I mean: setTimeout("afunction()", time) must be converted to setTimeout(function(){ /code/} , time) for it to work. Some old scripts of mine has this issue as well.

arantius
Collaborator

Kbntk other point you should check is if you use any setTimeout in your scripts.
Last versions supported strings as the first argument.

That was broken in 0.9.19, but that breaking change was reverted, in .20 everything works as it always used to.

kbntk
kbntk commented June 12, 2012

The issue Ventero pointed was the reason the scripts didn't work.
Thank you guys for your help!

arantius
Collaborator

Changed the title to reflect the issue as it has now been described.

sergioabreu

shouldn't fail or would fail ? Did you meand "shouldn't HAPPEN" ?

arantius arantius closed this in d6d1c07 June 15, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.