Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to find source code of Mozilla NoScript extension?

I read in wiki that NoScript is open source http://en.wikipedia.org/wiki/NoScript, but on official site http://noscript.net/, I can't find any sources. So my question is: where to find sources? Or, is there something I did not understand, and the source code is not available?

like image 331
Suhan Avatar asked Jul 15 '13 21:07

Suhan


2 Answers

The Firefox XPI format does not prevent you from simply extracting the contents of the plugin to examine the source code.

While I cannot find a canonical public repository, it looks like someone has systematically downloaded and extracted all the available XPIs and created a GitHub repository out of them.

https://github.com/avian2/noscript

If you'd like to do it yourself, XPI files are just standard ZIP files, so if you want to extract one yourself you can simply point an extraction program at it.

Here's an example of doing that from the command line:

mkdir noscript_source
cd noscript_source
curl -LO https://addons.mozilla.org/firefox/downloads/file/219550/noscript_security_suite-2.6.6.8-fx+fn+sm.xpi
unzip noscript_security_suite-2.6.6.8-fx+fn+sm.xpi

That yields a directory structure that looks like this:

.
├── GPL.txt
├── META-INF
│   ├── manifest.mf
│   ├── zigbert.rsa
│   └── zigbert.sf
├── NoScript_License.txt
├── chrome
│   └── noscript.jar
├── chrome.manifest
├── components
│   └── noscriptService.js
├── defaults
│   └── preferences
│       └── noscript.js
├── install.rdf
├── mozilla.cfg
└── noscript_security_suite-2.6.6.8-fx+fn+sm.xpi

Then the main code is located inside chrome/noscript.jar. You can extract that to get at the JavaScript that makes up the bulk of the plugin:

cd chrome/
unzip noscript.jar

Which will yield the main source tree:

.
├── content
│   └── noscript
│       ├── ABE.g
│       ├── ABE.js
│       ├── ABELexer.js
│       ├── ABEParser.js
│       ├── ASPIdiocy.js
│       ├── ChannelReplacement.js
│       ├── ClearClickHandler.js
│       ├── ClearClickHandlerLegacy.js
│       ├── Cookie.js
│       ├── DNS.js
│       ├── DOM.js
│       ├── ExternalFilters.js
│       ├── FlashIdiocy.js
│       ├── HTTPS.js
│       ├── Lang.js
│       ├── NoScript_License.txt
│       ├── PlacesPrefs.js
│       ├── Plugins.js
│       ├── Policy.js
│       ├── Profiler.js
│       ├── Removal.js
│       ├── RequestWatchdog.js
│       ├── STS.js
│       ├── ScriptSurrogate.js
│       ├── Strings.js
│       ├── URIValidator.js
│       ├── about.xul
│       ├── antlr.js
│       ├── clearClick.js
│       ├── clearClick.xul
│       ├── frameOptErr.xhtml
│       ├── iaUI.js
│       ├── noscript.js
│       ├── noscript.xbl
│       ├── noscriptBM.js
│       ├── noscriptBMOverlay.xul
│       ├── noscriptOptions.js
│       ├── noscriptOptions.xul
│       ├── noscriptOverlay.js
│       ├── noscriptOverlay.xul
│       ├── options-mobile.xul
│       └── overlay-mobile.xul
├── locale
└── skin
like image 155
phinze Avatar answered Nov 11 '22 14:11

phinze


The extension contains the source code - you just need to unzip it. See Giorgio's response here.

The whole source code is publicly available in every each XPI.

You've got it on your hard disk right now, if you're a NoScript user, otheriwise you can download it here.

You can examine and/or modify it by unzipping the XPI and the JAR inside, and "building" it back by rezipping both.

It's been like that for ever, since the very first version.

like image 39
RichieHindle Avatar answered Nov 11 '22 15:11

RichieHindle