Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

adding @require kills script after updating to 1.4 #1661

Closed
timecode opened this Issue · 6 comments

2 participants

@timecode

See similar issue previously corrected... #1502

How to reproduce in 1.4:
1. Add new script, and verify working with something like alert('Monkey sez... "Test!"');
3. Edit script by adding something like // @require http://jquery.com/src/jquery-latest.js
4. Save script, update page, note script no longer runs.
5. Remove additional @require line.. close browser... reload browser.
6. Note, script still does not work
7. Select, Tools menu > Greasemonkey, and hover over 'User Script Commands' (it changes from enabled to disabled)
8. Observe that, although the script and it's folder are still present, the entry in config.xml has disappeared.

Platform details: OS X 10.8.2, Firefox 16.0.1

@arantius
Collaborator

The URL you provided to require is not javascript, and does not successfully execute. If you use a valid URL (i.e. http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js) which returns javascript, everything works as expected.

@arantius arantius closed this
@arantius
Collaborator

Oh, and: I don't see any of the errors you mention in line 4, 6, 7, or 8.

@timecode

Aha, sorry about that. I should have checked the validity of that link having copied it from another example. However, if a non-valid file is linked to (I found this with a local, but equally invalid js file), should the script be removed from the config.xml file (never to be known about again), or disabled, or just not work? Thanks for looking at this though.

@arantius
Collaborator

should the script be removed from the config.xml file (never to be known about again), or disabled, or just not work?

The latter, which like I said is what I saw happen. If it's getting removed that's a bug, but I don't see that with the steps you provided. Do you, still?

@timecode

Yes, try the following:
1. Select Tools > Greasemonkey > Manage User Scripts, to reveal Add-ons Manager page.
2. Enable 'Webmonkey's Hello World' script.
3. Visit any web page to check script works.
4. From the Add-ons Manager page, select preferences for 'Webmonkey's Hello World', and then 'Edit this User Script'.
5. Edit the file webmonkeys_hello_world.user.js, add a known invalid require, say '// @require this_file_does_not_exist_yet.js' (after the // @include line), and save.
6. Note, script no longer works (as expected)
7. Quit Firefox
8. Open Firefox
9. Select Tools > Greasemonkey > Manage User Scripts, to reveal Add-ons Manager page, and note 'Webmonkey's Hello World' script is no longer visible. Observe also that, the script and it's folder are still present in gm_scripts, but the entry in config.xml has disappeared.

Sorry for the earlier confusion and mixin of Issue #1665: The "user script menu commands" menu does not enable/disable properly.

@arantius
Collaborator

Ah of course, "add a known invalid require" is the key detail.

@arantius arantius reopened this
@arantius arantius closed this issue from a commit
@arantius arantius Modified scripts: download dependencies carefully.
Rearrange the "dependencies modified" code to take the possibility of download failure into account.  Don't remove existing files until all new ones have been downloaded successfully, then rearrange everything in place.

Fixes #1661
f64be02
@arantius arantius closed this in f64be02
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.