"Show Script Source" should not throw when the script hasn't finished downloading yet #1586

Ventero opened this Issue Jul 8, 2012 · 4 comments

2 participants


Steps to reproduce:
1. Click the link to a (preferrably very large) script - I've used http://download-mirror.savannah.gnu.org/releases/linterna-magica/linternamagica-v0.0.12.user.js.html for testing. For repeated tests, the cache has be cleared before clicking the link again.
2. Immediately after the install dialog shows up, click "Show Script Source"

Expected result: Script source shows in new tab
Actual result: RemoteScript#showSource throws Script is not loaded!

When removing the check for _progress[0] < 1, everything seems to work as expected.


I don't think this is the right solution; if the progress is < 1 then the file isn't downloaded yet, so you'll only be viewing a part of the source. Better is to disable the button until the script is downloaded.


That's what I thought at first, too. But the source always was complete (though admittedly, this might've simply been because the script finished downloading in the time after clicking "Show Script Source" and before it actually showed the source).
But disabling the button is probably the best solution either way.


Test case: http://arantius.com/misc/slow-download/

Click the .php to see what loads, the .phps to see how it is generated, and the .user.js to test Greasemonkey's behavior. If you click the script and then show source before it's done downloading, you only see the first few "benign" lines, and not the "evil" line at the end.


Ah, indeed. Thanks for the test case. I think then it's indeed best to disable the "Show Script Source" button while the script is still downloading (which would make it consistent with the install button, too).

@arantius arantius closed this in ec1e933 Jul 16, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment