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

"Show Script Source" button doesn't work for first time #1609

Closed
Infocatcher opened this issue Aug 24, 2012 · 8 comments
Closed

"Show Script Source" button doesn't work for first time #1609

Infocatcher opened this issue Aug 24, 2012 · 8 comments
Milestone

Comments

@Infocatcher
Copy link

  1. Restart Firefox
  2. Click or middle-click on any *.user.js link
  3. Click on "Show Script Source" button – nothing happens

Then click on "Cancel", click on user.js link second time, click on "Show Script Source" – works fine.
And no related errors or warnings in error console.

@arantius
Copy link
Collaborator

This sounds like the intentional effects of #1586 ? It just happens to download faster the second time when it's already in the cache.

@Infocatcher
Copy link
Author

Yes, looks very similar.
(I forgot about disabled disk cache on my test profile, so step 1 do "clear cache" for me.)
And I can't reproduce bug with small file.

@Infocatcher
Copy link
Author

I'm see issue with Greasemonkey 1.0 + latest Nightly and Firefox 14.0.1.

@Infocatcher
Copy link
Author

I think, something wrong with this._progress[0] from

  if (this._progress[0] < 1) {
    throw new Error('Script is not loaded!');
  }

If I leave dialog opened (so script should become loaded), this._progress[0] are always 0.

@Infocatcher
Copy link
Author

Very strange.

DownloadListener.prototype = {
  // ...
  // nsIProgressEventSink
  onProgress: function(aRequest, aContext, aProgress, aProgressMax) {
    var progress;
    Components.classes["@mozilla.org/consoleservice;1"]
        .getService(Components.interfaces.nsIConsoleService)
        .logStringMessage(aProgressMax);
    if (-1 == aProgressMax || 0 == aProgressMax
        || 0xFFFFFFFFFFFFFFFF == aProgressMax) {
      progress = 0
      Components.classes["@mozilla.org/consoleservice;1"]
        .getService(Components.interfaces.nsIConsoleService)
        .logStringMessage("-> 0");
    } else {
      progress = aProgress / aProgressMax;
    }
    this._progressCallback(aRequest, progress);

Console output:
18446744073709552000
-> 0

=>

RemoteScript.prototype._downloadFileProgress = function(
    aChannel, aFileProgress) {
  this._progress[this._progressIndex] = aFileProgress; // => 0

May be just temporarily disable *.user.js interaction and open original link?

@arantius
Copy link
Collaborator

I'm having a very difficult time following what you're saying. This happens to you for every script, or just some? Can you give me a link to at least one script where you observe this behavior?

@Infocatcher
Copy link
Author

And I can't reproduce bug with small file.

Small script, works: dirty.ru_title.user.js
Big script, always (if cache is empty) doesn't work: forum_code_highlighter.user.js

@arantius
Copy link
Collaborator

Not sure why yet, but I agree that the show script source button doesn't work as intended at that second URL you gave.

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

2 participants