Convert Firefox extension to XULRunner

Changes that take place in the XULRunner Applicaiton.

    * The id of menupopup should be same in the MainWindow.xul and browserOverlay.xul

    In MainWindow.xul

        *  Place the following statements in the 
            <vbox id=”appcontent” flex=”1″/>
            <statusbar id=”status-bar” hidden=”true”>
                <statusbarpanel id=”statusbar-display” flex=”1″/>

    In application.ini

        * Place the following statement at the end

    In  MainWindow.js

        * Add the following function
            function getBrowser() { return document.getElementById(presentUser); }

        * Place the FirebugChrome.initialize();  statement at the end of the function userChanged(userName)

How to change a Firefox extension to XULRunner extension

* Firebug uses DOM Inspector, without it won’t show style elements in CSS panel.
* Firebug expects TabBrowser because Firefox uses tabbed browser, so if your application has single browser then replaces TabBrowser with your browser element.

* See whether the logs are working properly

* Make an application recognize the extension by adding the following content to the install.rdf file in the root folder.

            <em:id></em:id> // App ID that you specified in the application.ini file

2 >     Check the chrome.manifest in the root folder. In that see which file is overlaid on browser.xul file.  Replace the chrome://browser/content/browser.xul with the URI that points to your main file and updated the overlaid file.

Adaptation of Firebug to XULRunner

    In tabWatcher.js
        The content id in the following code should be changed to presentUser.
                const tabBrowser = $(“content”);
                const tabBrowser = $(presentUser);

        In the destroy function, getBrowserByWindow and deactivate function remove the loop and replace browser with tabBrowser, cos tabBrowser is the browser object.

        Replace all occurrences of  tabBrowser.selectedBrowser with tabBrowser

    In Firebug.xul

        * Remove all menu items except close menu item of File menu

    In firebug.js

        * Comment out the nsIPermissionManager affected code.

        * The content id in the following code should be changed to presentUser.
                const tabBrowser = $(“content”);
                const tabBrowser = $(presentUser);

        * Replace all occurrences of  tabBrowser.selectedBrowser with tabBrowser

        * In the disableAlways function, disableSite and deactivate function remove the loop and replace browser with tabBrowser, cos tabBrowser is the browser object.

        * Return true in the isURIAllowed function

        * Return false in the isURIDenied function
In browserOverlay.xul
    * Remove the menupopups with ids menu_viewPopup and menu_ToolsPopup and add the following menupopup.   

    <menupopup id=”menu-popup”>
                <menuitem id=”menu_detachFirebug” insertbefore=”sanitizeSeparator”
                    label=”&firebug.Firebug;” type=”checkbox”
                    key=”key_toggleFirebug” command=”cmd_toggleDetachFirebug”/>

In chrome.js

•    In initialize method add the following as first line

        if (waitingPanelBarCount != 0)

In /Preferences/firebug.js

    pref(“extensions.firebug.disabledAlways”, false);

    pref(“extensions.firebug.openInWindow”, true);

Adaptation of DOM Inspector to XULRunner

      Just follow the instructions specified in the “How to change a Firefox extension to XULRunner extension”.

      For XULRunner framework version 1.8.0.* need Inspector component i.e.. inspector.dll for windows and inspector.dylib for mac. To get the inspector component you need to build the xulrunner source code because the inspector component source code is available in the source code.

Adaptation of Selenium to XULRunner

        In selenium-runner.js

            * Remove selectedBrowser reference because getBrowser return browser only not Tab Browser.

        In selenium-ide-overlay.xul
            * Remove unnecessary menu items
            * Replace menupopup id “menu_ToolsPopup” with “menu-popup”
        In selenuin-ide-loader.js
            * Add the following function

                function toOpenWindowByType(inType, uri) {
                      var winopts = “chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar”;
            , “_blank”, winopts);

        In selenuin-ide-overlay.js

            * In SeleniumIDE.Overlay.init function, the statement
                    var appcontent = window.document.getElementById(“appcontent”);
                 should be replaced with
                    var appcontent = window.document.getElementById(“MainBox”); here MainBox is a vbox which holds the browser.

            * In SeleniumIDE.Overlay.onContentLoaded function, remove the loop because we have single browser.
                window.getBrowser() return the browser.
        In recorder.js

            * In Recorder.forEachTab function, remove the for loop and replace the browsers array with your browser.

        In editor.js       
            * In Editor.prototype.showInBrowser function just keep the statement in the if condition part and remove everything else, because we need to open it in a new window always.

Blogged with Flock

Tags: , , , , , ,

mac look and feel form controls


Blogged with Flock


Posted in MOzilla. 1 Comment »

Building XULRunner (developer preview release) Source Code on Windows

.mozconfig file

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../build
mk_add_options MOZ_CO_PROJECT=xulrunner
ac_add_options –enable-application=xulrunner
ac_add_options –enable-javaxpcom
ac_add_options –disable-static
ac_add_options –enable-shared
ac_add_options –enable-svg
ac_add_options –disable-tests
ac_add_options –enable-libxul

Configure the environment

Microsoft Visual C++ version 6 requires Service Pack 5 ( and the processor pack (

 Platform SDK

When using Visual C++ 6, you need to get either the october 2002 or the february 2003 version of the platform SDK (

Download the current MozillaBuild 1.1 package (

By default, the package installs to c:\mozilla-build. It is recommended to use the default path.

Getting a command prompt for building


    if %VC6DIR% is empty then hardcode the directory path.

Install jdk-1_5_0_03-windows-i586.exe in C:/ not in C:/Program Files/ , because we need to eradicate possibles white spaces in the paths. After install check the environment variable Java_Home.

Apply the patches if you get errors

Patchs for JavaXPCOM


    @$(INSTALL) -m 644 $(JAVA_SRCS) \
    @$(INSTALL) -m 644 $(GEN_JAVA_SRCS) _javagen/org/mozilla/xpcom
    @echo Generating Java interface files
 –    $(RUN) $(DIST)/bin/GenerateJavaInterfaces$(BIN_SUFFIX) -d $(OUTPUT_DIR)
+    $(RUN) $(DIST)/bin/GenerateJavaInterfaces$(BIN_SUFFIX) -d C:\mozilla\build\extensions\java\xpcom\interfaces\_javagen\org\mozilla\xpcom
    @touch $@

    # Using the temporary “java.files” avoids an “argument list too long”
    # error on Windows when using *.java
    org/mozilla/xpcom/.class_done: _javagen/org/mozilla/xpcom/.iface_done


    # Using the temporary “java.files” avoids an “argument list too long”
    # error on Windows when using *.java
    org/mozilla/xpcom/internal/.class_done: _javagen/org/mozilla/xpcom/internal/.iface_done
    @echo Compiling Java implementation classes
    find _javagen -name “*.java” > java.files
–    $(JAVAC) $(JAVAC_FLAGS) \
+    /c/Java/jdk1.5.0_03/bin/javac -source 1.4 \
      -classpath “.$(SEP)../interfaces/MozillaInterfaces.jar” \
      -d . -sourcepath _javagen @java.files
    @touch $@

    $(JARFILE): org/mozilla/xpcom/internal/.class_done Makefile
    $(JAR) cf $@ org

Blogged with Flock

Tags: , , , ,

Creating Universal Build of XULRunner

Create Windows Installer for XULRunner Application

Creating Objective-C++ XPCOM Component

If you want to change a C++ Component into Objective-C++ component then simply follow the instrucitons.

* The modifications are take place in the SRC directory not in the PUBLIC directory and Main directory.

* The file extension for Objective-C++ file is mm.

* if the C++ file contains Objective-C++ code then change the extension to mm.

* Place the Objective-C++ header files in the same directory wherethe source files are placed. Only mention .mm files in the Make file.

* Link the Objective-C++ source files in the Make file in the CMMSRCS like as follows.

        CMMSRCS = \
   \       // cos, It contains the calls to nsISample.idl and nsSample.h will be in the public folder.
   \      // objectiveC.h file will be in the SRC directory

        CPPSRCS = \

Blogged with Flock

Make XUL Elements of prefwindow bound to preferences

For some elements like Label with preference attribute won’t bound to preference element.

The following is the workaround for this.

// Won’t work

 <label id=”defaultLabel”   preference=”pref-defaultPrinter” />

// Will Work

<label id=”defaultLabel”  preference-editable=”true”  preference=”pref-defaultLabel” />

Mozilla 1.8
Type: boolean

If true, the element may be used as one that modifies a preference in a prefwindow. The preference attribute may be used to connect to a preference element. This is useful for custom elements implemented in XBL. The element should fire change or select events when the value is changed so that the preference will update accordingly.

XUL:Attribute:preference-editable – MDC

technorati tags:, , ,

Blogged with Flock

Posted in MOzilla. 1 Comment »