Skip to content
This repository

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

Closed
Ventero opened this Issue July 07, 2012 · 4 comments

2 participants

Ventero arantius
Ventero

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.

Ventero Ventero referenced this issue from a commit July 07, 2012
Commit has since been removed from the repository and is no longer available.
arantius
Collaborator

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.

Ventero

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.

arantius
Collaborator

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.

Ventero

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 July 16, 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.