Simple Firefox Customizations: Using the CCK XPI

Now that we know the basics of XUL Overlays, we’re going to look at using an existing CCK XPI to make our changes. The reason we’re using the CCK XPI is because we want to take advantage of code that has already been written for us. We’ll start by examining the contents of an XPI created by the CCK Wizard. Note that for this example, we’ve used the CCK Wizard to create an XPI that has no customization at all. We’re just going to add our new modifications.

After creating an XPI using the CCK Wizard, copy unzip that XPI into a directory. You’ll see the following files:


chrome/cck.jar
components/cckService.js
defaults/preferences/firefox-cck.js
chrome.manifest
install.rdf
install.js
cck.config

The two files that are important to us are chrome.manifest and cck.jar. Here’s that the manifest file looks like:


overlay chrome://browser/content/browser.xul  chrome://cck/content/cck-browser-overlay.xul
style   chrome://global/content/config.xul    chrome://cck/content/cck-config.css
content cck     jar:chrome/cck.jar!/content/cck/

This file defines the overlays we talked about earlier. We are overlaying a file called cck-browser-overlay.xul onto the regular browser XUL file and we are overlaying a new CSS file. We won’t modify the manifest right now since it has exactly what we need. Later we’ll need to make changes when we want to anything other than the main browser UI.

The next file that is important to us is cck.jar. This is a ZIP file that contains the XUL overlay files. After unzipping this file, you’ll see cck-browser-overlay.xul. This is the file where we are going to make our modifications. For now, lets do something similar. Edit the file cck-browser-overlay.xul and add this line before the <stringbundleset> section (we’ll get into the specifics of this change in the next installment).

 <menuitem id="menu_preferences" disabled="true"/>

Once you’ve made this change, zip the JAR first and then zip the XPI file. Next, install the XPI.

If everything worked correctly, when you look at the Tools menu, the Options… menuitem should be disabled.

What we’ve seen in this installment is that by modifying an existing CCK XPI, we can start customizing the Firefox UI. We didn’t have to write our own extension from scratch. In our next installment, we’ll look at the interesting things we can do in our browser overlay.

Please note: I reserve the right to delete comments that are offensive or off-topic.

Leave a Reply

Your email address will not be published. Required fields are marked *

11 thoughts on “Simple Firefox Customizations: Using the CCK XPI

  1. Hi,

    I’m using CCK for deplyement purposes and I’m in the process of adding one setting (network.automatic-ntlm-auth.trusted-uris) on top of existing installation of firefox (including CCK extension) without changing the other settings for existing user, but adding it to the new user which might logon on those workstation.

    1) For the existing profile I thought of adding a user.js to the profile path (AppData\Roaming\Mozilla\Firefox\Profiles\XXXXXXXX.default), or adding a line to the XXXXX.js ( \AppData\Roaming\Mozilla\Firefox\Profiles\XXXXXXXX.default\extensions\NameOfcckExtension\defaults\preferences) both works.

    2) for profile not created yet, I thought of changing XXXXX.js (C:\Program Files (x86)\Mozilla Firefox\extensions\firefox@orange-ftgroup.com\defaults\preferences) but it retains my settings for “browser.download.dir” for example, but not “network.automatic-ntlm-auth.trusted-uris”.

    Any idea of what I could do to fix this, and also understanding how and when does the the extension generates settings, once, once per FF session, once per user profile creation?

    Thanks in advance for your precious help 🙂

    • When you add a new preference to the CCK, it shouldn’t affect any users settings at all. It should just add the new preference.

      The preferences are not set programmatically, they are included in a JS file that is bundles with the addon (defaults/preferences/cck.js).

      So they should happen no matter what.

      If the user has customized the network.automatic-ntlm-auth.trusted-uris preference, the CCK will not override it.

      Are you trying to lock it or just set it?

      • Thanks for the answer!

        I’m trying to set it, tell me if I understood right :

        The about:confifg page being disabled by CCK extension, the user won’t have the network.automatic-ntlm-auth.trusted-uris preference set, so if I set it into C:\Program Files (x86)\Mozilla Firefox\extensions\ExtensionName\defaults\preferences\cck.js (in my case firefox-cck.js) all users existing and coming alike will have this preference set to what I decided?

  2. Is it just me or is someone else seeing the same thing? I’m reading this blog as an RSS feed in the SeaMonkey mailer. I see:

    […] add this line before the <stringbundleset> section (we’ll get into the specifics of this change in the next installment).

    then a large blank space, then

    Once you’ve made this change, […]

    Huh? Add an empty line before the stringbundleset section, is that it?

    (and since there’s no “preview” function on this blog, let’s hope that some “prettifier” won’t eat my less-than;stringbundleset;greater-than)

  3. ah, yes, now I see

    with a 1 and a green vertical bar at left, and a green square (which is a link) with a white question mark (which becomes black on mouseover) at the far right. Much less puzzling to say the least. 🙂

  4. oops, retry

    ah, yes, now I see

    <menuitem id=”menu_preferences” disabled=”true”/>

    with a 1 and a green vertical bar at left, and a green square (which is a link) with a white question mark (which becomes black on mouseover) at the far right. Much less puzzling to say the least. 🙂