Ticket #111 (closed defect: fixed)

Opened 7 months ago

Last modified 6 months ago

GM 0.8.20080505.0 issue in Firefox 3.0 RC1 when on Yahoo Mail page

Reported by: mjk49..@yahoo.com Assigned to: aranti..@gmail.com
Priority: major Milestone: 0.8
Version: Keywords:
Cc:

Description

I installed GM 0.8 in Firefox 3.0 RC1 and was on the (new) Yahoo Mail page and right clicked on the GM status bar icon and noticed that it added a menu separator element right below the top entry in the list of scripts. Each time I right clicked it would move that line to the top of the list and add another in its place

When I went to a different page, the top lines would still appear, but not the one in the middle. I'm not sure what's causing it since there are no errors in the error console.

Using the Dom Inspector I found that all the menuseperator elements had a nodeName of "value" with a nodeValue of "hack".

See attached images for what it looks like.

Attachments

gm1.jpg (15.4 kB) - added by mjk49..@yahoo.com on 05/21/08 08:38:43.
Grease Monkey context menu on Yahoo Mail page
gm2.jpg (15.0 kB) - added by mjk49..@yahoo.com on 05/21/08 08:40:14.
Grease Monkey context menu on other pages (after right clicking on Yahoo Mail page)
gm3.jpg (70.5 kB) - added by mjk49..@yahoo.com on 05/21/08 08:40:53.
DOM Inspector when selecting menuseperator (line above is a script entry)
dummy_bad.user.js (248 bytes) - added by mjk49..@yahoo.com on 05/21/08 11:12:53.
Script which excludes Yahoo Mail (causes problem) - script does nothing
dummy_good.user.js (203 bytes) - added by mjk49..@yahoo.com on 05/21/08 11:13:24.
same script as above, but with no exclusion - does not cause problem

Change History

05/21/08 08:38:43 changed by mjk49..@yahoo.com

  • attachment gm1.jpg added.

Grease Monkey context menu on Yahoo Mail page

05/21/08 08:40:14 changed by mjk49..@yahoo.com

  • attachment gm2.jpg added.

Grease Monkey context menu on other pages (after right clicking on Yahoo Mail page)

05/21/08 08:40:53 changed by mjk49..@yahoo.com

  • attachment gm3.jpg added.

DOM Inspector when selecting menuseperator (line above is a script entry)

05/21/08 08:42:59 changed by mjk49..@yahoo.com

This probably should be minor instead of major since GM does work, even though the context menu gets all messed up.

(follow-up: ↓ 3 ) 05/21/08 09:21:30 changed by aranti..@gmail.com

Could you clarify when you say "each time I right clicked" what you were right clicking on?

(in reply to: ↑ 2 ) 05/21/08 09:36:55 changed by mjk49..@yahoo.com

Replying to aranti..@gmail.com:

Could you clarify when you say "each time I right clicked" what you were right clicking on?

The Greasemonkey icon in the status bar. See the attached images.

I'll note that so far I've only seen this problem on the Yahoo Mail page (which does a lot of AJAX scripting).

05/21/08 10:06:51 changed by aranti..@gmail.com

Ok, I definitely don't see it on yahoo mail. Can you list all your installed extensions and user scripts?

Have you checked the error console? Does anything appear there while right-clicking the monkey?

05/21/08 11:12:17 changed by mjk49..@yahoo.com

No errors in the error console.

I managed to recreate the problem in a new profile with a single script. The problem appears to occur if the script excludes "http://*.mail.yahoo.com/*"

If I remove that exclusion GM works fine. Since the page was excluded the script should not have shown up in the list, which is probably causing the corruption issue.

I created 2 versions of a dummy script that does nothing. One excludes "http://*.mail.yahoo.com/*" and the other does not. The one that excludes Yahoo causes the problem so it has to do with the exclusion. Not sure why though. I can look into the source more.

To recreate:

1. Install the dummy_bad.user.js script and go to mail.yahoo.com (the new version, NOT the classic version). 2. Right click on the greasemonkey icon in the status bar.

To "fix":

1. Either install the dummy_good.user.js script or remove the exclusion from the script installed above.

05/21/08 11:12:53 changed by mjk49..@yahoo.com

  • attachment dummy_bad.user.js added.

Script which excludes Yahoo Mail (causes problem) - script does nothing

05/21/08 11:13:24 changed by mjk49..@yahoo.com

  • attachment dummy_good.user.js added.

same script as above, but with no exclusion - does not cause problem

05/21/08 11:14:12 changed by aranti..@gmail.com

  • owner set to aranti..@gmail.com.
  • status changed from new to assigned.
  • milestone deleted.

Accepting this.

Devs: Request for votes on whether this holds up the initial 0.8 release? (Removing milestone, until a positive vote.)

05/21/08 11:30:40 changed by mjk49..@yahoo.com

I found the problem. The problem is the following code in the GM_showPopup(aEvent) function in browser.js:

  // build the new list of scripts
  if (runsFramed.length) {
    runsFramed.forEach(appendScriptToPopup);
    var separator = document.createElement("menuseparator");
    separator.setAttribute("value", "hack"); // to get removed in the loop above
    popup.insertBefore(separator, tail);
  }

This is designed to add a separator to seperate the scripts that are running in frames from the ones running in the main window. The problem is that the separator is never removed after it is added so each time the user right clicks another one is created and so on and so forth.

The easiest way to fix this is to change the following code in GM_showPopup(aEvent) from

  // remove all the scripts from the list
  for (var i = popup.childNodes.length - 1; i >= 0; i--) {
    if (popup.childNodes[i].script) {
      popup.removeChild(popup.childNodes[i]);
    }
  }

to:

  // remove all the scripts from the list
  for (var i = popup.childNodes.length - 1; i >= 0; i--) {
    if ((popup.childNodes[i].script) ||
        (popup.childNodes[i].getAttribute("value") == "hack")) {
      popup.removeChild(popup.childNodes[i]);
    }
  }

This will remove the "hack" seperators when the popup is opened. Also of note, that if there are no "runsOnTop" scripts, then there will end up being 2 seperators since there are no scripts between the "hack" seperator and the bottom one.

05/21/08 11:33:03 changed by mjk49..@yahoo.com

A fix for the 2 separators would be to check to see if the runsOnTop.length > 0 before inserting the "hack" seperator.

Example change:

  // build the new list of scripts
  if (runsFramed.length) {
    runsFramed.forEach(appendScriptToPopup);
    var separator = document.createElement("menuseparator");
    separator.setAttribute("value", "hack"); // to get removed in the loop above
    popup.insertBefore(separator, tail);
  }
  runsOnTop.forEach(appendScriptToPopup);

to:

  // build the new list of scripts
  if (runsFramed.length) {
    runsFramed.forEach(appendScriptToPopup);
    if (runsOnTop.length) {
      var separator = document.createElement("menuseparator");
      separator.setAttribute("value", "hack"); // to get removed in the loop above
      popup.insertBefore(separator, tail);
    }
  }
  runsOnTop.forEach(appendScriptToPopup);

06/09/08 08:50:20 changed by oyasu..@gmail.com

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [744]) Fixes #111 (small variation on a patch provided by ticket poster).

06/09/08 08:53:39 changed by ecmanaut

Cool -- we have the plugin that catches "fixes #number" in checkin messages and updates ticket status accordingly installed. Anyway -- the patch is good; thanks!

06/11/08 14:02:39 changed by aranti..@gmail.com

  • milestone set to 0.8.

06/13/08 06:55:51 changed by mjk49..@yahoo.com

This patch isn't in 0.8.20080609.0. Was it supposed to be?


Add/Change #111 (GM 0.8.20080505.0 issue in Firefox 3.0 RC1 when on Yahoo Mail page)




Action