Snippets code from my daily experience

June 5, 2009

gContextMenu’s imageURL property refactored on Firefox 3.5x

Filed under: extension,firefox,xul — dafi @ 5:04 pm
Tags: , , ,

Edited on 9 June 2009 Mozilla guys decided to add a getter for imageURL so no extension will be affected by new property mediaURL replacement, you can read the full story at bug 497098.

Another time Mozilla community demonstrates its strength, why nobody considered the impact before modification is another story😉

Today a ViewSourceWith user filed a bug about a regression on Firefox 3.5b4, causing VSW to no more open images😯

After dressing the debug uniform I started to investigate the problem.

I’ve realized the object gContextMenu doesn’t more contain the property imageURL used by VSW and maybe many other extensions.

The imageURL property has been renamed/refactored to mediaURL.

Honestly the new name fits better its new usage and maybe the imageURL property is not intended for usage from extensions.

The poor gContextMenu documentation doesn’t describe imageURL so maybe I abused its usage.

I think gContextMenu need a better documentation because its usage is so sexy inside extensions.

The workaround

A string find/replace inside code fixed the bug, to maintain compatibility with FF 3.0.x I’ve modified the code as shown below

var imageURL = gContextMenu.imageURL || gContextMenu.mediaURL;

8 Comments

  1. Yeah, I got two of my extensions affected. I first noticed when I updated Firefox 3.1b2.
    I used myFunction("mediaURL" in gContextMenu ? gContextMenu.mediaURL : gContextMenu.imageURL)

    Comment by LouCypher — June 5, 2009 @ 6:53 pm

  2. Why wouldn’t you just leave imageURL there and add mediaURL?

    It makes no sense to break extensions in this way. You are probably breaking more extensions than you realize…

    Comment by Michael Kaply — June 6, 2009 @ 1:46 am

    • @Michael I don’t want to change anything, only Mozilla guys can do it😛

      Comment by dafi — June 6, 2009 @ 1:52 pm

      • Sorry, I thought you were saying you made the change🙂

        Someone should open a bug against Mozilla for this.

        Comment by Michael Kaply — June 7, 2009 @ 12:00 am

    • Great news Paul, thanks

      Comment by dafi — June 9, 2009 @ 3:26 pm

  3. […] code has broken some extensions that built on the context menu. Davide Ficano found one of his extensions was broken when we replaced a property on the gContextMenu object, a helper object used to manage the context […]

    Pingback by Mark Finkle’s Weblog » Extension Developers - News For You — June 9, 2009 @ 8:22 pm

  4. “imageURL” in gContextMenu has returned on Firefox 3.5rc1, thanks to you and bug #497098

    Comment by LouCypher — June 18, 2009 @ 7:52 am


RSS feed for comments on this post.

Blog at WordPress.com.

%d bloggers like this: