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

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

Projects

None yet

2 participants

@Infocatcher
  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
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

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

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

@Infocatcher

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

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
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
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
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.

@arantius arantius closed this in e7d86d4 Aug 30, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment