Add-on naming in the profiles extension folder

Discussion of general topics about Mozilla Firefox
User avatar
iamme99
Posts: 328
Joined: June 16th, 2005, 1:52 am
Location: California

Add-on naming in the profiles extension folder

Post by iamme99 »

Some add-on's in the extensions folder seem to use human recognizable names. But for many others, I see names like this:

{73a6fe31-595d-460b-a920-fcc0f8843232}
{1A2D0EC4-75F5-4c91-89C4-3656F6E44B68}
{3d7eb24f-2740-49df-8937-200b1cc08f8a}
{3e9bb2a7-62ca-4efa-a4e6-f6f6168a652d}
{3f0da09b-c1ab-40c5-8d7f-53f475ac3fe8}

I would like to find out how much storage each add-on is taking but I can't use Windows Explorer to do that because names like those above don't mean anything to me.

Why can't FF enforce a naming standard for add-on's in the extensions profile folder? This would be helpful.
User avatar
Bluefang
Posts: 7857
Joined: August 10th, 2005, 2:55 pm
Location: Vermont
Contact:

Re: Add-on naming in the profiles extension folder

Post by Bluefang »

The extensions are named with the extension's ID, which is often a UUID. UUIDs are used because, in theory, each extension ID will be unique.

Mozilla does enforce naming standards, there's just 2 of them:
* UUID
* extensionname@organization.tld

If you want to know which extension is in which folder, open up the install.rdf in each folder. It will list the extension's name.
There have always been ghosts in the machine... random segments of code that have grouped together to form unexpected protocols. Unanticipated, these free radicals engender questions of free will, creativity, and even the nature of what we might call the soul...
User avatar
iamme99
Posts: 328
Joined: June 16th, 2005, 1:52 am
Location: California

Re: Add-on naming in the profiles extension folder

Post by iamme99 »

With 70 extensions, opening each one is a bit of a chore.

I don't care of they use the UUID, but the developer should be required to append the actual extension name to the front of the UUID then.
User avatar
Bluefang
Posts: 7857
Joined: August 10th, 2005, 2:55 pm
Location: Vermont
Contact:

Re: Add-on naming in the profiles extension folder

Post by Bluefang »

If they did that, then it wouldn't be a valid UUID.

Extension ID schemes haven't changed since Firefox 1.5, and I don't think they're going to be changing any tie soon. And anyways, they are intended for use internal to Firefox only and not intended to be meaningful or useful to the end user.

The "correct" solution would be to write an extension that accesses the Extension Manager and prints out the name and size on disk for each extension.
There have always been ghosts in the machine... random segments of code that have grouped together to form unexpected protocols. Unanticipated, these free radicals engender questions of free will, creativity, and even the nature of what we might call the soul...
User avatar
T0morrow
Posts: 302
Joined: April 9th, 2010, 9:16 am

Re: Add-on naming in the profiles extension folder

Post by T0morrow »

Maybe something like about:extensions that lists all add-ons(disabled ones too), along with their UUID,real names and folders.Something like advanced version of about:plugins
User avatar
RobertJ
Moderator
Posts: 10880
Joined: October 15th, 2003, 7:40 pm
Location: Chicago IL/Oconomowoc WI

Re: Add-on naming in the profiles extension folder

Post by RobertJ »

I just wrote a script that (with FF not running) reads the size of each {UUID} directory content and reads the <em:name> in the install.rdf and then lists them. Unfortunately I wrote it in AppleScript, took about 5 minutes. I don't know if there is a similar scripting capability in WIN. Seems like there should be something.
FF 92.0 - TB 78.13 - Mac OSX 10.13.6
User avatar
a;skdjfajf;ak
Posts: 17002
Joined: July 10th, 2004, 8:44 am

Re: Add-on naming in the profiles extension folder

Post by a;skdjfajf;ak »

The easy way is to enter: about:support in the address/URL bar or -> Help->Troubleshooting Information

There you will find the name of the addon/extension and the UUID
User avatar
T0morrow
Posts: 302
Joined: April 9th, 2010, 9:16 am

Re: Add-on naming in the profiles extension folder

Post by T0morrow »

Littlemutt wrote:The easy way is to enter: about:support in the address/URL bar or -> Help->Troubleshooting Information

There you will find the name of the addon/extension and the UUID

Right.Totally forgot about this #-o
User avatar
RobertJ
Moderator
Posts: 10880
Joined: October 15th, 2003, 7:40 pm
Location: Chicago IL/Oconomowoc WI

Re: Add-on naming in the profiles extension folder

Post by RobertJ »

Littlemutt wrote:The easy way is to enter: about:support in the address/URL bar or -> Help->Troubleshooting Information

There you will find the name of the addon/extension and the UUID


The OP also wanted the size. This AppleScript gives a list of the UUID, size in bytes and the add-on name. Of course the OP would need to move to Mac :wink:

Code: Select all

tell application "Finder"
   set sourceFolder to (choose folder with prompt "Please select the source folder")
   set numFolders to (number of folders of folder sourceFolder)
   set ilist to {}
   set numitems to 1000
   repeat with i from 1 to numFolders
      set theidentity to name of folder i of sourceFolder
      set temp to folder i of sourceFolder as alias
      set psize to size of (info for temp)
      open file "install.rdf" of folder i of sourceFolder
      tell application "BBEdit"
         activate
         process lines containing text 1 of text document 1 matching string "\\<em\\:name\\>|\\<name\\>|em\\:name\\=" output options {copying to new document:true} with matching with grep
         open find window
         replace "[ ]*\\<em\\:name\\>|[ ]*\\<name\\>|[ ]*em\\:name\\=" using "" searching in text 1 of text document "install.rdf — Copied Lines" options {search mode:grep, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
         replace "\\<\\/em\\:name\\>|\\<\\/name\\>" using "" searching in text 1 of text document "install.rdf — Copied Lines" options {search mode:grep, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
         close find window
         select text 1 of text document "install.rdf — Copied Lines"
         copy selection
         close text window 1 saving no
      end tell
      set realname to (the clipboard as text)
      set ilist to ilist & {theidentity, "   ", psize, "   ", realname}
   end repeat
   set ilist to ilist as string
   set outfile to "<StartupDisk>:Users:<user_acct>:Desktop:output.txt" as alias
   write ilist to outfile
end tell
FF 92.0 - TB 78.13 - Mac OSX 10.13.6
User avatar
iamme99
Posts: 328
Joined: June 16th, 2005, 1:52 am
Location: California

Re: Add-on naming in the profiles extension folder

Post by iamme99 »

Don't know about Apple script. Can someone make something that can be run under Windows?
User avatar
Bluefang
Posts: 7857
Joined: August 10th, 2005, 2:55 pm
Location: Vermont
Contact:

Re: Add-on naming in the profiles extension folder

Post by Bluefang »

You can copy/paste these into the "Code" text box in the Error Console (Tools -> Error Console), and hit "Evaluate"

These print out the approximate size on disk used by the extensions installation. I say approximate because Firefox can't measure the size of a directory, just file actual files it contains. So the size is going to be a bit smaller than it should be.

Version for Firefox 4

Code: Select all

const CI = Components.interfaces;
const CC = Components.classes;

function computeSizeRecursive(file)
{
   file.QueryInterface(CI.nsIFile);
   if(file.isSymlink())
   {
      return 0;
   }

   var size = file.fileSize;
   if(file.isDirectory())
   {
      var files = file.directoryEntries;
      while(files.hasMoreElements())
      {
         size += computeSizeRecursive(files.getNext());
      }
   }
   return size;
}

Components.utils.import("resource://gre/modules/AddonManager.jsm");
AddonManager.getAllAddons(function(addons)
{
   var addonData = "data:text/html,"
   + "<!DOCTYPE html>"
   + "<html lang=\"en\">"
   + "   <head>"
   + "      <title>"
   + "         Additional Addon Information"
   + "      </title>"
   + "   </head>"
   + "   <body>"
   + "      <table>"
   + "         <tr>"
   + "            <td>"
   + "               ID"
   + "            </td>"
   + "            <td>"
   + "               Name"
   + "            </td>"
   + "            <td>"
   + "               Size"
   + "            </td>"
   + "         </tr>";

   addons.forEach(function(addon)   
   {
      addonData += ""
      + "<tr>"
      + "   <td>"
      + "      " + addon.id
      + "   </td>"
      + "   <td>"
      + "      " + addon.name
      + "   </td>"
      + "   <td>"
      + "      " + ((addon.getResourceURI)
               ? computeSizeRecursive(addon.getResourceURI()
                  .QueryInterface(CI.nsIFileURL).file)
               : "Unknown")
      + "   </td>"
      + "</tr>";
   });

   addonData += ""
   + "      </table>"
   + "   </body>"
   + "</html>";

   var windowManager = CC['@mozilla.org/appshell/window-mediator;1']
      .getService(CI.nsIWindowMediator);
   var win = windowManager.getMostRecentWindow("navigator:browser");
   win.open(addonData, "", "");

});


Version for Firefox 3.6

Code: Select all

const CI = Components.interfaces;
const CC = Components.classes;

function computeSizeRecursive(file)
{
   file.QueryInterface(CI.nsIFile);
   if(file.isSymlink())
   {
      return 0;
   }

   var size = file.fileSize;
   if(file.isDirectory())
   {
      var files = file.directoryEntries;
      while(files.hasMoreElements())
      {
         size += computeSizeRecursive(files.getNext());
      }
   }
   return size;
}

var Application = CC["@mozilla.org/fuel/application;1"].getService(CI.fuelIApplication);

var addons = Application.extensions.all;

var extDir = Components.classes["@mozilla.org/file/directory_service;1"]
   .getService(Components.interfaces.nsIProperties)
   .get("ProfD", Components.interfaces.nsIFile);
extDir.append("extensions");

var ios = Components.classes["@mozilla.org/network/io-service;1"]
   .getService(Components.interfaces.nsIIOService);

var addonData = "data:text/html,"
+ "<!DOCTYPE html>"
+ "<html lang=\"en\">"
+ "   <head>"
+ "      <title>"
+ "         Additional Addon Information"
+ "      </title>"
+ "   </head>"
+ "   <body>"
+ "      <table>"
+ "         <tr>"
+ "            <td>"
+ "               ID"
+ "            </td>"
+ "            <td>"
+ "               Name"
+ "            </td>"
+ "            <td>"
+ "               Size"
+ "            </td>"
+ "         </tr>";

addons.forEach(function(addon)   
{
   var ext = extDir.clone();
   ext.append(addon.id);

   addonData += ""
   + "<tr>"
   + "   <td>"
   + "      " + addon.id
   + "   </td>"
   + "   <td>"
   + "      " + addon.name
   + "   </td>"
   + "   <td>"
   + "      " + ((ext.exists())
            ? computeSizeRecursive(ext)
            : "Unknown")
   + "   </td>"
   + "</tr>";
});

addonData += ""
+ "      </table>"
+ "   </body>"
+ "</html>";

var windowManager = CC['@mozilla.org/appshell/window-mediator;1']
   .getService(CI.nsIWindowMediator);
var win = windowManager.getMostRecentWindow("navigator:browser");
win.open(addonData, "", "");
There have always been ghosts in the machine... random segments of code that have grouped together to form unexpected protocols. Unanticipated, these free radicals engender questions of free will, creativity, and even the nature of what we might call the soul...
User avatar
iamme99
Posts: 328
Joined: June 16th, 2005, 1:52 am
Location: California

Re: Add-on naming in the profiles extension folder

Post by iamme99 »

I don't see a "code text box" in the error console.

So I tried pasting the script into the evaluate box but couldn't figure out how to run it. The down arrow on the right doesn't run it.

Here is a link to shot of my error console:
http://www.fototime.com/BE077B0538A37BD/orig.jpg
User avatar
Bluefang
Posts: 7857
Joined: August 10th, 2005, 2:55 pm
Location: Vermont
Contact:

Re: Add-on naming in the profiles extension folder

Post by Bluefang »

You're using Console2 The code box is the unlabeled text-box on the left side. To evaluate it, click the "evaluate" button.

The text-box on the right is the search/filter (it should be labeled Search, but it looks like you're using a custom theme).
There have always been ghosts in the machine... random segments of code that have grouped together to form unexpected protocols. Unanticipated, these free radicals engender questions of free will, creativity, and even the nature of what we might call the soul...
User avatar
RobertJ
Moderator
Posts: 10880
Joined: October 15th, 2003, 7:40 pm
Location: Chicago IL/Oconomowoc WI

Re: Add-on naming in the profiles extension folder

Post by RobertJ »

Bluefang wrote: I say approximate because Firefox can't measure the size of a directory, just file actual files it contains. So the size is going to be a bit smaller than it should be.



Out of curiosity, if an extension has nested sub directories with a big jar file at the inner directory, will this miss it?

.
FF 92.0 - TB 78.13 - Mac OSX 10.13.6
User avatar
Bluefang
Posts: 7857
Joined: August 10th, 2005, 2:55 pm
Location: Vermont
Contact:

Re: Add-on naming in the profiles extension folder

Post by Bluefang »

No, this is does not look inside of archive files (zip/jar/xpi). Why would it need to? We're looking for the size of the extension on disk, which is the size of the archive, not the uncompressed size of the files inside the archive.
There have always been ghosts in the machine... random segments of code that have grouped together to form unexpected protocols. Unanticipated, these free radicals engender questions of free will, creativity, and even the nature of what we might call the soul...
Post Reply