mozdev.org

Developer Notes

Tell us Dim, tell us about this "new way"

A note from Dave Hyatt.

Sample Hello World Package

To get a package going these days do this:

  1. cd to your chrome directory
  2. create a directory called my_package
  3. create sub directories called content, skin, locale inside of my_package
  4. cd to content and create a file called my_package.xul and put this code inside:
  5. <?xml version="1.0"?> <?xml-stylesheet href="chrome://my_package/skin/" type="text/css"?>
    <!DOCTYPE window [
    <!ENTITY % my_packageDTD SYSTEM "chrome://my_package/locale/my_package.dtd" >
    %my_packageDTD;
    ]>
    
    <window id = "main-window" xmlns:html = "http://www.w3.org/1999/xhtml" xmlns:rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" width = "100" height = "100" > <box id="fuBar" flex="1"> <text value="&fu.bar;" /> </box> </window>
  6. then create a file called contents.rdf and put this code inside:
  7. <?xml version="1.0"?> <RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:chrome="http://www.mozilla.org/rdf/chrome#"> <RDF:Seq about="urn:mozilla:package:root"> <RDF:li resource="urn:mozilla:my_package"/> </RDF:Seq> <RDF:Description about="urn:mozilla:package:my_package" chrome:displayName="My Package" chrome:author="My Name" chrome:name="my_package"> </RDF:Description> </RDF:RDF>
  8. then cd to skin and create a file called my_package.css and put this code inside:
  9. @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); @namespace html url("http://www.w3.org/TR/REC-html40"); #fuBar { background-color : blue; }
  10. then create a file called contents.rdf and put this code inside:
  11. <?xml version="1.0"?> <RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:chrome="http://www.mozilla.org/rdf/chrome#"> <RDF:Seq about="urn:mozilla:skin:root"> <RDF:li resource="urn:mozilla:skin:my_package/1.0" /> </RDF:Seq> <RDF:Description about="urn:mozilla:skin:my_package/1.0" chrome:displayName="My Package" chrome:author="My Name" chrome:name="my_package/1.0"> <chrome:packages> <RDF:Seq about="urn:mozilla:skin:my_package/1.0:packages"> <RDF:li resource="urn:mozilla:skin:my_package/1.0:my_package"/> </RDF:Seq> </chrome:packages> </RDF:Description> </RDF:RDF>
  12. then cd to locale and create a directory called en-US
  13. then cd to locale->en-US and create a file called my_package.dtd
  14. then put this code inside of my_package.dtd:
  15. <!ENTITY fu.bar              "Hello World">
    
  16. then create a file called contents.rdf and put this code inside:
  17. <?xml version="1.0"?> <RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:chrome="http://www.mozilla.org/rdf/chrome#"> <RDF:Seq about="urn:mozilla:locale:root"> <RDF:li resource="urn:mozilla:locale:en-US"/> </RDF:Seq> <RDF:Description about="urn:mozilla:locale:en-US" chrome:displayName="English(US)" chrome:author="My Name" chrome:name="en-US" chrome:previewURL="http://www.mozilla.org/locales/en-US.gif"> <chrome:packages> <RDF:Seq about="urn:mozilla:locale:en-US:packages"> <RDF:li resource="urn:mozilla:locale:en-US:my_package"/> </RDF:Seq> </chrome:packages> </RDF:Description> </RDF:RDF>
  18. then cd back to your chrome dir (no you're not finished yet)
  19. add these three lines to installed-chrome.txt:
  20. content,install,url,resource:/chrome/my_package/content/ skin,install,url,resource:/chrome/my_package/skin/ locale,install,url,resource:/chrome/my_package/locale/en-US/
  21. now the tricky part. go to your mozilla home directory on unix it would be
    ~/.mozilla/default/chrome (not sure about windows or mac).
    edit the file called 'chrome.rdf'
    and add this code right before the closing RDF tag at the end of the file:
  22. <RDF:Description about="urn:mozilla:package:my_package"> <c:selectedSkin resource="urn:mozilla:skin:my_package/1.0:my_package"/> </RDF:Description>
  23. launch mozilla from the command line ./mozilla -chrome chrome://my_package/content/

Thats all! Just remember these goals

See how *cough* easy it all is . . .

zip of my_package code

--pete

User Notes: [?]

If you do not get a response to a question posted in this forum, please try sending a message to the project's mailing list or to the project owner directly.

[1] Submitted by: Pete Collins on Thursday January 11th 2001

First post!

--pete

[2] Submitted by: Andrew Wooldridge on Thursday January 11th 2001

This is my comment - just testing thanks...

Perhaps mozdev should move it's server to a WikkiWikki server.

[3] Submitted by: Bagus Mahawan on Thursday January 18th 2001

I tried the sample above, but I ended up with an error as follows: ----------- JavaScrJavaScript error: chrome://communicator/content/directory/directory.js line 65: window._content has no properties ----------- Could please anyone tell me what's wrong ? Thank you in advance

regards, Bagus

[4] Submitted by: Pete Collins on Thursday January 18th 2001

Are you sure you put the above rdf code into `user-skins.rdf ' This is very important. If you didn't do this, or missed a line you will get the above error.

--pete

[5] Submitted by: Bagus Mahawan on Thursday January 18th 2001

Comment on no14. When I tried adding the code shown in 14 to user-skins.rdf located at 'chrome directory' (instead of ~/.mozilla/default/chrome), I found that it worked well. So I came to the conclusion that 'user-skins.rdf' which we have to edit is in chrome directory, not in mozilla home directory. Is this the right solution ? Thank you.

Bagus

[6] Submitted by: John McCoy on Friday January 19th 2001

In WNT the user-skin.rdf file you modify appears to be in your profile. However, I seem to have a problem with the locale part. All I get is the window with a blue background. If I replace the parameterized external dtd reference with an internal ENTITY declaration, then the text appears in the box.

[7] Submitted by: pete collins on Friday January 19th 2001

Check the all-locales.rdf in your chrome dir. Look for the `my-package' entries inside this file. If there isn't any, then there myght be a syntax error in your contents.rdf file.

--pete

[8] Submitted by: John McCoy on Saturday January 20th 2001

There is no my_package entry in the all-locales file. I've checked the locale contents file - even cut and pasted it from the sample code - and it appears to match the sample code. On the Windows install there is a user-locales.rdf in the profiles chrome folder with the user-skins.rdf but I don't see any entries for it in the sample code. Did I miss something? --john

[9] Submitted by: John McCoy on Sunday January 21st 2001

Re: previous comment about DTD.

I finally wiped everything clean including the user50 profiles and re-installed. Everything now appears to work.

Thanks, --john

[10] Submitted by: Bagus Mahawan on Monday January 22nd 2001

I deteled everything and start from the beginning (just cut and paste), and now everything works. In linux, the file 'user-skin.rdf' is right in ~/.mozilla/default/chrome (as is shown in no14), not in the chrome directory. So please ignore my previous comment submitted on Jan 18.

regards, -- Bagus

[11] Submitted by: John McCoy on Monday January 22nd 2001

RE: WNT Currently if you add the example package files and only change the installed-chrome.txt the example works correctly one time without adding the user-skin entry. Subsequently, however, it wont find the skin. The package installation itself appears correct but the resource entry it creates in the user-skin.rdf in the user50 profile is missing "/1.0". If you add this, or, make the entire entry like the example says, then it works.

[12] Submitted by: Aaron Andersen on Thursday January 25th 2001

I ran into that while writting a tutorial for xulplanet. There is an error in the skin/contents.rdf file in this example. It should be chrome:name="my_package/1.0" not chrome:name="my_package". The missig "/1.0" causes the missing "/1.0" in the user-skin.rdf file mentioned in the pervious post.

If you add the "/1.0" to the contents.rdf file, the package installs correctly when you just change installed-chrome.txt

Aaron

[13] Submitted by: John McCoy on Friday January 26th 2001

It works. Great!

Thanks, Aaron.

--john

[14] Submitted by: pete collins on Saturday January 27th 2001

Ok, i fixed the example above.

--pete

[15] Submitted by: sipman on Friday February 23rd 2001

For completness you might want to add the option to set the xul cache off (test whthout restarting mozilla)at debug time. This can be done by going to /bin/defaults/pref/all.js and adding : pref(nglayout.debug.disable_xul_cache', true); or with js : setPref('nglayout.debug.disable_xul_cache', true);

[16] Submitted by: Ryan Champlin on Tuesday August 14th 2001

Ok. I'm getting the same problems as John was getting above where all I get is a window with a blue background and no text. I have the corrected example from above, what do I do to fix this.

Thanks, Ryan

[17] Submitted by: pete collins on Tuesday August 14th 2001

Ok, i fixed the type. i don't understand why it was not displaying properly. The code was correct and was inside a <xmp> tag. Oh well . . .

--pete

[18] Submitted by: pete collins on Wednesday August 15th 2001

Ok, i fixed a couple of minor problems i found here. Again code inside an <xmp> tag was not being displayed.

I also posted a zip of the my_package dirs and code

--pete

[19] Submitted by: Ryan Champlin on Thursday August 16th 2001

Found my problem finally. I was ending up with bad characters in my installed-chrome.txt when I copied the text from the web page into my text file. If I strictly type it in it seemed to work fine. Ahhh!

Ryan

[20] Submitted by: sdf on Thursday November 1st 2001

sdf

[21] Submitted by: sdf on Thursday November 1st 2001

sdf

[22] Submitted by: Mike on Monday November 5th 2001

I'm hoping someone can help me out here: I have the main netscape directory located at /usr/local/netscape, and my local directory is ~/.mozilla, and it's chrome directory is at ~/.mozilla/mike/vxvubshb.slt/chrome (this is a Debian linux box). Where should the my_package code be placed, and what other steps are required to allow me to use a local .html file as a sidebar?

[23] Submitted by: pete collins on Monday November 5th 2001

in the chrome directory, in your case it would be /usr/local/netscape

You should be able to use your ~/.mozilla/mike/vxvubshb.slt/chrome dir soon if it's not turned on already. I just haven't tried it yet.

--pete

[24] Submitted by: Mike on Tuesday November 13th 2001

I have the my_package directory linked so that it appears in both places. How do I use it to add my own .html page as a sidebar?

[25] Submitted by: Nilesh Sonawane on Friday May 31st 2002

I would like to add my_package in Mozilla folder under Mac 9, but I am not getting how to run it.I Linux and Windows we can use command prompt for typing ./mozilla -chrome chrome://my_package/content/my_package.xul , but what to do in Mac 9.0?

[26] Submitted by: bindu on Thursday October 17th 2002

Can someone help me here? There is no user-skins.rdf in the windows platform version -- I am using windows 2000. After restarting Mozilla with the command suggested in the above example, I got the following registry problems:
WARNING: chrome: failed to get base url for chrome://my_package/content/my_package.xul -- using wacky default, file nsChromeRegistry.cpp, line 552 Error reading file C:cygwinhomebindumozilladistbinchromepackagescoremy_package.xul warning: property switchskins already exists warning: property switchskinstitle already exists Note: verifyreflow is disabled Note: styleverifytree is disabled Note: frameverifytree is disabled

[27] Submitted by: Pete Collins on Friday October 18th 2002

Ok, made a correction. The file is now called 'chrome.rdf' and replaces the now deprecated 'user-skins.rdf'.
--pete

[28] Submitted by: dirk on Friday January 3rd 2003

great work! - dl /

[29] Submitted by: Ted on Saturday January 18th 2003

Greetings...

[30] Submitted by: Alta on Monday March 17th 2003

Great work!

[31] Submitted by: buscadores on Thursday March 20th 2003

great work

[32] Submitted by: jonh on Friday April 11th 2003

testing 1...2...3...testing

[33] Submitted by: Paul on Friday April 18th 2003

Thanks you for the web, it is what I needed to complete my work.
You do a very good work and you must feel proud of it.

[35] Submitted by: complejo on Tuesday May 13th 2003

good site

[36] Submitted by: motilla on Tuesday May 13th 2003

hi from spain

[37] Submitted by: adwod on Tuesday May 13th 2003

corious

[38] Submitted by: complejo on Friday May 16th 2003

good site

[39] Submitted by: motilla on Friday May 16th 2003

hi from spain

[40] Submitted by: adwod on Friday May 16th 2003

corious

[41] Submitted by: shilmar on Monday June 30th 2003

corious

[42] Submitted by: Diseño web on Friday August 1st 2003

Congratulations for your site

Hector gomis diseño web

[43] Submitted by: directorio on Sunday August 3rd 2003

ok

[44] Submitted by: Diseño web español on Thursday August 21st 2003

Congratulations for your great job.

Héctor Gomis diseño web estudio

[45] Submitted by: Alta Buscadores on Sunday August 24th 2003

Thanks for the good information. Keep up this great resource. Best greetings..

[46] Submitted by: Busca Inmobiliarias on Sunday August 24th 2003

This is an important and rich site.

[47] Submitted by: Domnios y Hosting on Sunday August 24th 2003

Hi to you and your guests!

[48] Submitted by: Alex on Sunday August 31st 2003

Nice project!

[49] Submitted by: Gloryhole on Tuesday September 2nd 2003

Wow, awesome tutorial.

[50] Submitted by: diseño web on Thursday September 4th 2003

Great work!


/
/

[51] Submitted by: Joe on Thursday September 4th 2003

Great Site

-----

[52] Submitted by: Thalea on Friday September 5th 2003

Hi, I like the contents of your site,
enjoying to surf within your site.
til then

[53] Submitted by: Sammy jones on Friday September 5th 2003

Hi, thanks a lot for this site...
Go on like this and enjoy !

[54] Submitted by: Mike on Sunday September 7th 2003

Very helpful comments here, thanks for posting this info.

[55] Submitted by: diseño web on Monday September 8th 2003

Great site!

/

[56] Submitted by: Jose on Thursday September 11th 2003

Very useful site

[57] Submitted by: Urbe on Sunday September 14th 2003

Hello, I just wanted to say you have a very informative site which really made me think, Thanks !

[58] Submitted by: JB on Monday September 15th 2003

Very interesting information.
/

[59] Submitted by: Abel on Wednesday September 17th 2003

Congratulations for your site!

[60] Submitted by: q on Friday September 19th 2003

Nice software, keep u the good work!

[62] Submitted by: jims on Tuesday September 23rd 2003

Your work is very interesting.

Questions or comments not answered in the FAQ can be submitted from our feedback page.
Copyright © 2000-2017. All rights reserved. Terms of Use & Privacy Policy.