Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome/Firefox: access source of an extension

Do Chrome or Firefox make your extension's source code open to the host machine? And if yes where are the respective folder on Mac?

like image 624
parsa Avatar asked Oct 18 '10 10:10

parsa


2 Answers

view online

View a Chrome/Firefox/Opera extension/addon’s source in browser (without downloading):
https://robwu.nl/crxviewer/

bookmarklets

bookmarklets usage

Click the bookmarklet when on an extension’s page in the Chrome Web Store, Firefox addon gallery or Opera addon gallery.

bookmarklets source code

load in same tab

javascript:location.href='https://robwu.nl/crxviewer/?crx='+location.href; 

open in new tab

javascript:window.open('https://robwu.nl/crxviewer/?crx='+location.href,'_blank');

bookmarklets links

view extension source online (Chrome .crx) @ https://robwu.nl/crxviewer/?crx= ← You can drag this link to your bookmark bar to create the bookmarklet, but you have to edit its URL afterwards: Delete everything before javascript, including the single slash: http://delete_me/

view extension source online in new tab (Chrome .crx) @ https://robwu.nl/crxviewer/?crx=

like image 90
Aaron Thoma Avatar answered Oct 25 '22 19:10

Aaron Thoma


Yes, assuming some or all of your extension is written in an interpreted and un-obfuscated language. Plain Javascript is common for extensions in both browsers.

For any firefox extension, if you save the .xpi file instead of installing it, it is just a zip file and you can open it with any archive tool (e.g. 7zip or WinZip).

The same goes for the .crx files Chrome. As an test, I just downloaded and opened the .crx for Google Mail Checker Plus using 7zip, and it looks like this is entirely written in javascript and all the source can be read.

In either case, how much usable source code you can get from this depends on the language(s) that are used in the extension.

Google Chrome installs the extension into ~/Library/Application Support/Google/Chrome/Default/Extensions/<EXTENSION_ID>/ and registers it in its Preferences file (according to this).

As heb says, Firefox installs the extension to ~/Library/Application Support/Firefox/Profiles/PROFILE_ID/extensions/EXTENSION_ID/

like image 31
Colin Pickard Avatar answered Oct 25 '22 17:10

Colin Pickard