Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kbntk opened this issue Jun 4, 2012 · 16 comments
Closed

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

kbntk opened this issue Jun 4, 2012 · 16 comments
Milestone

Comments

@kbntk
Copy link

kbntk commented Jun 4, 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.

@arantius
Copy link
Collaborator

arantius commented Jun 4, 2012

@kbntk
Copy link
Author

kbntk commented Jun 4, 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
Copy link
Collaborator

arantius commented Jun 5, 2012

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
Copy link
Author

kbntk commented Jun 5, 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
Copy link

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
Copy link
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
Copy link

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
Copy link
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
Copy link
Contributor

Ventero commented Jun 12, 2012

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
Copy link
Collaborator

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

@kbntk
Copy link
Author

kbntk commented Jun 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
Copy link

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
Copy link
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
Copy link
Author

kbntk commented Jun 12, 2012

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

@arantius
Copy link
Collaborator

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

@sergioabreu
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants