MozillaZine

view a file inside a zip/jar/xpi

Talk about add-ons and extension development.
bijugc
 
Posts: 399
Joined: March 18th, 2003, 9:52 pm

Post Posted February 21st, 2004, 9:55 am

This is new to me,

Using mozilla/firefox we can view a file inside a zip/jar/xpi

zip/jar/xpi may be at http://, file://, resource://
(i have not tried ftp:// but I belive that too)
Try
<a href="jar:http://mirror.meisterwerk.net/rmozdev/links/WebLinks.xpi!/install.js"> jar:http://mirror.meisterwerk.net/rmozdev/links/WebLinks.xpi!/install.js </a>


resource:// on Firefox:
jar:resource:///chrome/browser.jar!/content/browser/about.png
jar:resource:///chrome/browser.jar!/content/browser/browser.js

resource:// on Mozilla
jar:resource:///chrome/modern.jar!/skin/modern/communicator/button.css


we can even do
<a href="jar:jar:http://mirror.meisterwerk.net/rmozdev/links/WebLinks.xpi!/WebLinks.jar!/content/weblinks/macroeditor.js"> jar:jar:http://mirror.meisterwerk.net/rmozdev/links/WebLinks.xpi!/WebLinks.jar!/content/weblinks/macroeditor.js</a>

yeah, read from a zip file inside another zip file.


XMLHttpRequest can also handle this

Code: Select all
function readfileinjar(url,path)
{
 var p = new XMLHttpRequest();
 var path2 = path;
 if(path2.substr(0,1) != "/") path2="/" + path2;
 p.open("GET", "jar:" + url + "!" + path2, false);   
 p.send(null);   
 return p.responseText;
};

then call it by
Code: Select all
 alert(readfileinjar("http://mirror.meisterwerk.net/rmozdev/links/WebLinks.xpi", "/install.js") )
8) Biju
MacroEditor | http://QuickTools.MozDev.org | Edit files inside ZIP,JAR,XPI http://7-Zip.org
Cure Cancer http://www.grid.org/about | GNOME,*nix on MSWin32 http://CyGNOME.sf.net

Thumper's Evil Twin

User avatar
 
Posts: 6422
Joined: December 9th, 2003, 3:52 pm
Location: Glasgow, Scotland

Post Posted February 21st, 2004, 10:15 am

haha! awesome. I'd never thought of this. :)

- Chris

c∂n

User avatar
 
Posts: 700
Joined: June 28th, 2003, 8:31 am
Location: Longitude 0ish

Post Posted February 21st, 2004, 10:33 am

what about view-source:chrome://browser/content/browser.xul ?

bijugc
 
Posts: 399
Joined: March 18th, 2003, 9:52 pm

Post Posted February 21st, 2004, 10:39 am

So this also works
Code: Select all
view-source:jar:resource:///chrome/browser.jar!/content/browser/browser.xul

Now, how can we see the dir listing inside a zip?

.

Torisugari
 
Posts: 1634
Joined: November 4th, 2002, 8:34 pm
Location: Kyoto, Nippon (GMT +9)

Post Posted February 22nd, 2004, 9:01 am

Hmm, interesting. In such a complicated scheme, what's their script security level?

Return to Extension Development


Who is online

Users browsing this forum: No registered users and 1 guest