Home Securitate Services Resources Security Links Feedback Search T Network
Modify Firefox By Programming

World of Mozilla | Semi-Hidden Things | About credits | About license | Modify Firefox - No Programming | Modify Firefox By Programming | Become a Programmer

EN RO

Home
Up

How to Modify Firefox if You Can Program – or Even Just Want to Learn How

Hex editing programs is fun enough, but the tricks you can play with
this are limited. If you can program, and if you can get the source
code to the program you want to alter, you can do just about anything
to it. The Mozilla Foundation website lets you download the source
code to all its programming projects, so this is a great place to start.

An easy way to begin if you have never written a program before is to
find cascading style sheets within Firefox. These control how certain
web pages look in Firefox. They all end with the extension ".css" and
they are easy to change even if you have never coded a single line of
a web page in your life. You can find the names of these files by
viewing Firefox.exe in a hex editor.

This works with finding any of the cool displays you get in Firefox
from putting unusual commands in the URI window. For example, put
about: mozilla into the URI window and then click View --> Page
Source. This tells you the source code for that web page on display is
hidden in C:/Program%20Files/Mozilla%20Firefox/chrome/toolkit.jar.

Any file ending in .jar is a Java archive file.
This tells us that Java is one of the languages used by Firefox, and
that you need to learn how to program Java if you want to alter these.

Here's another cool file, chrome://global/content/xul.css, which I
discovered with a hex editor and put into the URI window. This one
also turned out to be located inside the file
C:/Program%20Files/Mozilla%20Firefox/chrome/toolkit.jar.

Here's some of what I found in the file xul.css

/** this should only contain XUL dialog and document window widget
defaults. Defaults for widgets of a particular application should be
in that application's style sheet. For example style definitions for
navigator can be found in navigator.css

THIS FILE IS LOCKED DOWN. YOU ARE NOT ALLOWED TO MODIFY IT WITHOUT
FIRST HAVING YOUR CHANGES REVIEWED BY mconnor@steelgryphon.com
**/

@namespace
url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
/* set default namespace to XUL */
@namespace html url("http://www.w3.org/1999/xhtml"); /* namespace for
HTML elements */
@namespace xbl url("http://www.mozilla.org/xbl"); /* namespace for XBL
elements */

* {
-moz-user-focus: ignore;
-moz-user-select: -moz-none;
display: -moz-box;
}

/* hide the content and destroy the frame */
*[hidden="true"] {
display: none;
}

/* hide the content, but don't destroy the frames */
*[collapsed="true"],
*[moz-collapsed="true"] {
visibility: collapse;
}

/* ::::::::::
:: Rules for 'hiding' portions of the chrome for special
:: kinds of windows (not JUST browser windows) with toolbars
::::: */

(End of snippet of this file)

Here's a little bit about how to read this file. Anything that appears
between /* and */ is a comment. Comments are notes a programmer
writes to explain his or her source code to a human. The computer
ignores comments when it runs a program.

Does that stuff about "THIS FILE IS LOCKED DOWN" intimidate you? Heh,
heh, what if you were to change it yourself? I dare you! You would
have to stick it back into the Java .jar file. Would it then run, or
is there some way Firefox could detect that you changed it? Don't
email me asking what would happen – you're a hacker, right? Try it
yourself!

Well, what is stopping you from changing this Java program? It's
located on your own hard drive, and Firefox is free for anyone to
change, according to what it says about being a GNU licensed program
on the "about:" page.

The way you can most easily change the Java portions of Firefox is to
load a Java development system on your computer, and then you can
write your own Java programs. Then you also can change any images
inside a .jar file and then repackage everything. You can get a
development system for free, including tutorials on how to use it,
from the Sun website,
http://java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html .

OK, now we can finally discuss how to find those .png files and alter
them. The best one of them all is the Firefox brand image itself. You
see it at the top of the page when you type about: in the URI window.
However, finding where it is stored is not so simple. Normally you can
find the location of an image by right clicking on it and choosing
"view image." In the case of the Firefox brand image, this doesn't
work. However, by poking around the page source for the about: page, I
found that the page called up the image with the command
"chrome://branding/content/about.png". I placed this inside the URI
window and then did a view page source command. This revealed that it,
too, is stored inside /chrome/toolkit.jar.

Next, if you are really, really serious about hacking, you can
decompile Java programs to get the source code. There are a gazillion
free Java decompilers, for example Jad, at
http://www.kpdus.com/jad.html -- just be careful to get yours from
somewhere that won't insert something nasty into your computer!

OK, OK, in the case of Firefox, you can get the Java source code
directly from the Mozilla site. But if you decompile your own, you can
compare your source code with the Mozilla source and see how well your
decompiler works. Since there can be more than one way to write a
program that does the same thing, your decompiled code might not be
identical with the original source. So what, big deal, the real test
is to recompile your code and see if the decompiled/recompile program
still runs the same. If it does, and if you can understand the code
generated by the decompiler, it's good enough.

 

Google

 

Tip-Top-Hot Web Sites

 



Back Home Up Next

 

Privacy Policy | Terms of Service
© 1999 - 2008, MultiMedia SRL
Send articles and materials to be published on this website to: Publishing
If you see unauthorized or illegal materials on this website, please send an e-mail to: Abuse