aboutsummaryrefslogtreecommitdiff
path: root/tools/addon-sdk-1.12/python-lib/cuddlefish/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tools/addon-sdk-1.12/python-lib/cuddlefish/tests')
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/__init__.py65
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/addons/simplest-test/main.js17
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/addons/simplest-test/package.json6
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/addons/simplest-test/tests/test-minimal.js7
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/explicit-icon.png0
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/explicit-icon64.png0
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/lib/main.js4
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/package.json5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/icon.png0
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/icon64.png0
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/lib/main.js4
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/package.json3
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/no-icon/lib/main.js4
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/no-icon/package.json3
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588661-files/packages/bar/lib/bar-loader.js4
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588661-files/packages/bar/package.json3
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588661-files/packages/foo/lib/foo-loader.js4
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588661-files/packages/foo/package.json4
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/docs/main.md5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/lib/main.js8
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/package.json5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/doc/foo.md5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/lib/foo-loader.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/package.json3
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/test/test-foo.js7
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/docs/foo.md5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/lib/foo-loader.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/package.json3
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/tests/test-foo.js7
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/doc/foo.md5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/lib/foo.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/lib/loader.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/package.json3
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/test/test-foo.js7
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-locale/locale/emptyFolder0
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-locale/package.json1
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/doc/foo.md5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/foo.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/loader.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/package.json3
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/test/test-foo.js7
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/alt-lib/foo.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/alt-lib/loader.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/doc/foo.md5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/package.json4
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/test/test-foo.js7
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/alt2-lib/foo.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/alt2-lib/loader.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/doc/foo.md5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/package.json4
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/test/test-foo.js7
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/docs/main.md5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/lib/main.js8
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/package.json6
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-715340-files/pkg-1-pack/package.json10
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-715340-files/pkg-2-unpack/package.json10
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-715340-files/pkg-3-pack/package.json9
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/bar-e10s-adapter.js11
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/bar.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/foo.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/package.json1
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/five/lib/main.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/five/package.json3
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/lib/misc.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/package.json4
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/topfiles/main.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four/lib/main.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four/package.json3
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/one/lib/main.js9
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/one/lib/subdir/three.js6
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/one/lib/two.js8
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/one/package.json4
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/seven/data/text.data1
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/seven/lib/main.js6
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/seven/lib/unused.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/seven/package.json4
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/six/lib/unused.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/six/package.json3
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/six/unreachable.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/main.js8
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/subdir/subfile.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/unused.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/locale/fr-FR.properties5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/package.json3
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/lib/main.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/locale/fr-FR.properties6
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/package.json3
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/lib/main.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/lib/sub/foo.js6
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/locale/fr-FR.properties9
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/package.json3
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/data/msg.txt1
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/data/subdir/submsg.txt1
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/lib/main.js8
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/package.json3
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/tests/nontest.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/tests/test-one.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/tests/test-two.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/preferences-files/packages/no-prefs/lib/main.js4
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/preferences-files/packages/no-prefs/package.json6
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/preferences-files/packages/simple-prefs/lib/main.js4
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/preferences-files/packages/simple-prefs/package.json50
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/dev-guide-source/index.md7
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/dev-guide-source/no_h1.md7
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/high-level-modules.md18
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/low-level-modules.md36
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/sdk/aardvark-feeder.md12
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/sdk/anteater/anteater.md10
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/sdk/main.md0
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/sdk/not_a_doc.js5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/third-party-modules.md11
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/static-files/another.html5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/static-files/base.html161
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/static-files/index.html27
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/docs/APIreference.html469
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/docs/APIsample.md162
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/doc/main.md0
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/ignore_me3
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/main.js8
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/surprise.js/ignore_me_too2
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/package.json7
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/anteater_files/lib/main.js8
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/anteater_files/package.json8
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/api-utils/lib/loader.js7
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/api-utils/package.json5
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/barbeque/lib/bar-module.js7
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/barbeque/package.json4
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/minimal/lib/main.js8
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/minimal/package.json4
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/xpi-template/components/harness.js8
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_apiparser.py538
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_apirenderer.py31
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_generate.py181
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_init.py197
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_licenses.py88
-rwxr-xr-xtools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_linker.py234
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_manifest.py257
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_packaging.py116
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_preflight.py147
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_property_parser.py93
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_rdf.py45
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_runner.py27
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_util.py22
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_version.py28
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_webdocs.py78
-rw-r--r--tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_xpi.py469
146 files changed, 4165 insertions, 0 deletions
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/__init__.py b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/__init__.py
new file mode 100644
index 0000000..c1a7fd2
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/__init__.py
@@ -0,0 +1,65 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import os
+import unittest
+import doctest
+import glob
+
+env_root = os.environ['CUDDLEFISH_ROOT']
+
+def get_tests():
+ import cuddlefish
+ import cuddlefish.tests
+
+ tests = []
+ packages = [cuddlefish, cuddlefish.tests]
+ for package in packages:
+ path = os.path.abspath(package.__path__[0])
+ pynames = glob.glob(os.path.join(path, '*.py'))
+ for filename in pynames:
+ basename = os.path.basename(filename)
+ module_name = os.path.splitext(basename)[0]
+ full_name = "%s.%s" % (package.__name__, module_name)
+ module = __import__(full_name, fromlist=[package.__name__])
+
+ loader = unittest.TestLoader()
+ suite = loader.loadTestsFromModule(module)
+ for test in suite:
+ tests.append(test)
+
+ finder = doctest.DocTestFinder()
+ doctests = finder.find(module)
+ for test in doctests:
+ if len(test.examples) > 0:
+ tests.append(doctest.DocTestCase(test))
+
+ md_dir = os.path.join(env_root, 'dev-guide')
+ doctest_opts = (doctest.NORMALIZE_WHITESPACE |
+ doctest.REPORT_UDIFF)
+ for dirpath, dirnames, filenames in os.walk(md_dir):
+ for filename in filenames:
+ if filename.endswith('.md'):
+ absname = os.path.join(dirpath, filename)
+ tests.append(doctest.DocFileTest(
+ absname,
+ module_relative=False,
+ optionflags=doctest_opts
+ ))
+
+ return tests
+
+def run(verbose=False):
+ if verbose:
+ verbosity = 2
+ else:
+ verbosity = 1
+
+ tests = get_tests()
+ suite = unittest.TestSuite(tests)
+ runner = unittest.TextTestRunner(verbosity=verbosity)
+ return runner.run(suite)
+
+if __name__ == '__main__':
+ run()
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/addons/simplest-test/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/addons/simplest-test/main.js
new file mode 100644
index 0000000..980ea88
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/addons/simplest-test/main.js
@@ -0,0 +1,17 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+const { Cc, Ci } = require("chrome");
+
+exports.main = function(options, callbacks) {
+ // Close Firefox window. Firefox should quit.
+ require("api-utils/window-utils").activeBrowserWindow.close();
+
+ // But not on Mac where it stay alive! We have to request application quit.
+ if (require("api-utils/runtime").OS == "Darwin") {
+ let appStartup = Cc['@mozilla.org/toolkit/app-startup;1'].
+ getService(Ci.nsIAppStartup);
+ appStartup.quit(appStartup.eAttemptQuit);
+ }
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/addons/simplest-test/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/addons/simplest-test/package.json
new file mode 100644
index 0000000..afbc158
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/addons/simplest-test/package.json
@@ -0,0 +1,6 @@
+{
+ "id": "simplest-test",
+ "directories": {
+ "lib": "."
+ }
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/addons/simplest-test/tests/test-minimal.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/addons/simplest-test/tests/test-minimal.js
new file mode 100644
index 0000000..533cd34
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/addons/simplest-test/tests/test-minimal.js
@@ -0,0 +1,7 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.minimalTest = function(test) {
+ test.assert(true);
+};
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/explicit-icon.png b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/explicit-icon.png
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/explicit-icon.png
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/explicit-icon64.png b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/explicit-icon64.png
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/explicit-icon64.png
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/lib/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/lib/main.js
new file mode 100644
index 0000000..b7e0a1d
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/lib/main.js
@@ -0,0 +1,4 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/package.json
new file mode 100644
index 0000000..8d56d74
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/explicit-icon/package.json
@@ -0,0 +1,5 @@
+{
+ "loader": "lib/main.js",
+ "icon": "explicit-icon.png",
+ "icon64": "explicit-icon64.png"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/icon.png b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/icon.png
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/icon.png
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/icon64.png b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/icon64.png
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/icon64.png
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/lib/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/lib/main.js
new file mode 100644
index 0000000..b7e0a1d
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/lib/main.js
@@ -0,0 +1,4 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/package.json
new file mode 100644
index 0000000..3f0e241
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/implicit-icon/package.json
@@ -0,0 +1,3 @@
+{
+ "loader": "lib/main.js"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/no-icon/lib/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/no-icon/lib/main.js
new file mode 100644
index 0000000..b7e0a1d
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/no-icon/lib/main.js
@@ -0,0 +1,4 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/no-icon/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/no-icon/package.json
new file mode 100644
index 0000000..3f0e241
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588119-files/packages/no-icon/package.json
@@ -0,0 +1,3 @@
+{
+ "loader": "lib/main.js"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588661-files/packages/bar/lib/bar-loader.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588661-files/packages/bar/lib/bar-loader.js
new file mode 100644
index 0000000..b7e0a1d
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588661-files/packages/bar/lib/bar-loader.js
@@ -0,0 +1,4 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588661-files/packages/bar/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588661-files/packages/bar/package.json
new file mode 100644
index 0000000..e83a9d4
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588661-files/packages/bar/package.json
@@ -0,0 +1,3 @@
+{
+ "loader": "lib/bar-loader.js"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588661-files/packages/foo/lib/foo-loader.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588661-files/packages/foo/lib/foo-loader.js
new file mode 100644
index 0000000..b7e0a1d
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588661-files/packages/foo/lib/foo-loader.js
@@ -0,0 +1,4 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588661-files/packages/foo/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588661-files/packages/foo/package.json
new file mode 100644
index 0000000..4648df6
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-588661-files/packages/foo/package.json
@@ -0,0 +1,4 @@
+{
+ "loader": "lib/foo-loader.js",
+ "dependencies": ["bar"]
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/docs/main.md b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/docs/main.md
new file mode 100644
index 0000000..54518d3
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/docs/main.md
@@ -0,0 +1,5 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+minimal docs
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/lib/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/lib/main.js
new file mode 100644
index 0000000..aeda0e7
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/lib/main.js
@@ -0,0 +1,8 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.main = function(options, callbacks) {
+ console.log("minimal");
+ callbacks.quit();
+};
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/package.json
new file mode 100644
index 0000000..45d409a
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-611495-files/jspath-one/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "jspath-one",
+ "author": "Jon Smith",
+ "description": "A package w/ a main module; can be built into an extension."
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/doc/foo.md b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/doc/foo.md
new file mode 100644
index 0000000..c92ddb8
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/doc/foo.md
@@ -0,0 +1,5 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+I am documentation for foo.
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/lib/foo-loader.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/lib/foo-loader.js
new file mode 100644
index 0000000..2daeb35
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/lib/foo-loader.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/package.json
new file mode 100644
index 0000000..ccc61b2
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/package.json
@@ -0,0 +1,3 @@
+{
+ "loader": "lib/foo-loader.js"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/test/test-foo.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/test/test-foo.js
new file mode 100644
index 0000000..bd0cfa9
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/commonjs-naming/test/test-foo.js
@@ -0,0 +1,7 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.testThing = function(test) {
+ test.assertEqual(2, 1 + 1);
+};
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/docs/foo.md b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/docs/foo.md
new file mode 100644
index 0000000..c92ddb8
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/docs/foo.md
@@ -0,0 +1,5 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+I am documentation for foo.
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/lib/foo-loader.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/lib/foo-loader.js
new file mode 100644
index 0000000..2daeb35
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/lib/foo-loader.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/package.json
new file mode 100644
index 0000000..ccc61b2
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/package.json
@@ -0,0 +1,3 @@
+{
+ "loader": "lib/foo-loader.js"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/tests/test-foo.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/tests/test-foo.js
new file mode 100644
index 0000000..bd0cfa9
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-614712-files/packages/original-naming/tests/test-foo.js
@@ -0,0 +1,7 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.testThing = function(test) {
+ test.assertEqual(2, 1 + 1);
+};
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/doc/foo.md b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/doc/foo.md
new file mode 100644
index 0000000..c92ddb8
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/doc/foo.md
@@ -0,0 +1,5 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+I am documentation for foo.
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/lib/foo.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/lib/foo.js
new file mode 100644
index 0000000..2daeb35
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/lib/foo.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/lib/loader.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/lib/loader.js
new file mode 100644
index 0000000..2daeb35
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/lib/loader.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/package.json
new file mode 100644
index 0000000..c2d22aa
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/package.json
@@ -0,0 +1,3 @@
+{
+ "loader": "lib/loader.js"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/test/test-foo.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/test/test-foo.js
new file mode 100644
index 0000000..bd0cfa9
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-lib/test/test-foo.js
@@ -0,0 +1,7 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.testThing = function(test) {
+ test.assertEqual(2, 1 + 1);
+};
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-locale/locale/emptyFolder b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-locale/locale/emptyFolder
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-locale/locale/emptyFolder
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-locale/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-locale/package.json
new file mode 100644
index 0000000..0967ef4
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-locale/package.json
@@ -0,0 +1 @@
+{}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/doc/foo.md b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/doc/foo.md
new file mode 100644
index 0000000..c92ddb8
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/doc/foo.md
@@ -0,0 +1,5 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+I am documentation for foo.
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/foo.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/foo.js
new file mode 100644
index 0000000..2daeb35
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/foo.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/loader.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/loader.js
new file mode 100644
index 0000000..2daeb35
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/loader.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/package.json
new file mode 100644
index 0000000..100249f
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/package.json
@@ -0,0 +1,3 @@
+{
+ "loader": "loader.js"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/test/test-foo.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/test/test-foo.js
new file mode 100644
index 0000000..bd0cfa9
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/default-root/test/test-foo.js
@@ -0,0 +1,7 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.testThing = function(test) {
+ test.assertEqual(2, 1 + 1);
+};
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/alt-lib/foo.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/alt-lib/foo.js
new file mode 100644
index 0000000..2daeb35
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/alt-lib/foo.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/alt-lib/loader.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/alt-lib/loader.js
new file mode 100644
index 0000000..2daeb35
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/alt-lib/loader.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/doc/foo.md b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/doc/foo.md
new file mode 100644
index 0000000..c92ddb8
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/doc/foo.md
@@ -0,0 +1,5 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+I am documentation for foo.
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/package.json
new file mode 100644
index 0000000..f79250e
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/package.json
@@ -0,0 +1,4 @@
+{
+ "directories": { "lib": "./alt-lib" },
+ "loader": "alt-lib/loader.js"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/test/test-foo.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/test/test-foo.js
new file mode 100644
index 0000000..bd0cfa9
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-dir-lib/test/test-foo.js
@@ -0,0 +1,7 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.testThing = function(test) {
+ test.assertEqual(2, 1 + 1);
+};
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/alt2-lib/foo.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/alt2-lib/foo.js
new file mode 100644
index 0000000..2daeb35
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/alt2-lib/foo.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/alt2-lib/loader.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/alt2-lib/loader.js
new file mode 100644
index 0000000..2daeb35
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/alt2-lib/loader.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/doc/foo.md b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/doc/foo.md
new file mode 100644
index 0000000..c92ddb8
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/doc/foo.md
@@ -0,0 +1,5 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+I am documentation for foo.
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/package.json
new file mode 100644
index 0000000..b017baa
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/package.json
@@ -0,0 +1,4 @@
+{
+ "lib": "./alt2-lib",
+ "loader": "alt2-lib/loader.js"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/test/test-foo.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/test/test-foo.js
new file mode 100644
index 0000000..bd0cfa9
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-652227-files/packages/explicit-lib/test/test-foo.js
@@ -0,0 +1,7 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.testThing = function(test) {
+ test.assertEqual(2, 1 + 1);
+};
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/docs/main.md b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/docs/main.md
new file mode 100644
index 0000000..54518d3
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/docs/main.md
@@ -0,0 +1,5 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+minimal docs
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/lib/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/lib/main.js
new file mode 100644
index 0000000..aeda0e7
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/lib/main.js
@@ -0,0 +1,8 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.main = function(options, callbacks) {
+ console.log("minimal");
+ callbacks.quit();
+};
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/package.json
new file mode 100644
index 0000000..de868f7
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-669274-files/packages/extra-options/package.json
@@ -0,0 +1,6 @@
+{
+ "name": "extra-options",
+ "author": "Jon Smith",
+ "description": "A package w/ a main module; can be built into an extension.",
+ "loader": "lib/main.js"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-715340-files/pkg-1-pack/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-715340-files/pkg-1-pack/package.json
new file mode 100644
index 0000000..d18aa3d
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-715340-files/pkg-1-pack/package.json
@@ -0,0 +1,10 @@
+{
+ "name": "empty",
+ "license": "MPL 2.0",
+ "author": "",
+ "version": "0.1",
+ "fullName": "empty",
+ "id": "jid1-80fr8b6qeRlQSQ",
+ "unpack": false,
+ "description": "test unpack= support"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-715340-files/pkg-2-unpack/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-715340-files/pkg-2-unpack/package.json
new file mode 100644
index 0000000..9bcf1eb
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-715340-files/pkg-2-unpack/package.json
@@ -0,0 +1,10 @@
+{
+ "name": "empty",
+ "license": "MPL 2.0",
+ "author": "",
+ "version": "0.1",
+ "fullName": "empty",
+ "id": "jid1-80fr8b6qeRlQSQ",
+ "unpack": true,
+ "description": "test unpack= support"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-715340-files/pkg-3-pack/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-715340-files/pkg-3-pack/package.json
new file mode 100644
index 0000000..45d1d91
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/bug-715340-files/pkg-3-pack/package.json
@@ -0,0 +1,9 @@
+{
+ "name": "empty",
+ "license": "MPL 2.0",
+ "author": "",
+ "version": "0.1",
+ "fullName": "empty",
+ "id": "jid1-80fr8b6qeRlQSQ",
+ "description": "test unpack= support"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/bar-e10s-adapter.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/bar-e10s-adapter.js
new file mode 100644
index 0000000..ad54ae7
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/bar-e10s-adapter.js
@@ -0,0 +1,11 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+if (this.sendMessage) {
+} else {
+ require('bar');
+
+ exports.register = function(process) {
+ };
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/bar.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/bar.js
new file mode 100644
index 0000000..fe9e4fb
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/bar.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+require('chrome');
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/foo.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/foo.js
new file mode 100644
index 0000000..55633d1
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib/foo.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+require('bar');
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/package.json
new file mode 100644
index 0000000..0967ef4
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/package.json
@@ -0,0 +1 @@
+{}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/five/lib/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/five/lib/main.js
new file mode 100644
index 0000000..e32a30f
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/five/lib/main.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.main = "'main' mainly reigns in main(.js)";
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/five/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/five/package.json
new file mode 100644
index 0000000..98e4b85
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/five/package.json
@@ -0,0 +1,3 @@
+{ "name": "five",
+ "main": "./lib/main"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/lib/misc.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/lib/misc.js
new file mode 100644
index 0000000..7e1ce7e
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/lib/misc.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.main = 42;
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/package.json
new file mode 100644
index 0000000..3010fae
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/package.json
@@ -0,0 +1,4 @@
+{ "name": "four-a",
+ "directories": {"lib": "lib"},
+ "main": "./topfiles/main.js"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/topfiles/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/topfiles/main.js
new file mode 100644
index 0000000..7e1ce7e
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four-deps/four-a/topfiles/main.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.main = 42;
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four/lib/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four/lib/main.js
new file mode 100644
index 0000000..b95f7bd
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four/lib/main.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+var a = require("four-a");
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four/package.json
new file mode 100644
index 0000000..53180b9
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/four/package.json
@@ -0,0 +1,3 @@
+{ "name": "four",
+ "main": "main"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/one/lib/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/one/lib/main.js
new file mode 100644
index 0000000..88fd751
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/one/lib/main.js
@@ -0,0 +1,9 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+var panel = require("panel");
+var two = require("two.js");
+var a = require("./two");
+var b = require("sdk/tabs.js");
+var c = require("./subdir/three");
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/one/lib/subdir/three.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/one/lib/subdir/three.js
new file mode 100644
index 0000000..b594f3c
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/one/lib/subdir/three.js
@@ -0,0 +1,6 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.foo = 1;
+var main = require("../main");
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/one/lib/two.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/one/lib/two.js
new file mode 100644
index 0000000..9765219
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/one/lib/two.js
@@ -0,0 +1,8 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
+// this ought to find our sibling, not packages/development-mode/lib/main.js
+var main = require("main");
+exports.foo = 1;
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/one/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/one/package.json
new file mode 100644
index 0000000..edd2b17
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/one/package.json
@@ -0,0 +1,4 @@
+{ "name": "one",
+ "id": "jid1@jetpack",
+ "main": "main"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/seven/data/text.data b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/seven/data/text.data
new file mode 100644
index 0000000..1269488
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/seven/data/text.data
@@ -0,0 +1 @@
+data
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/seven/lib/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/seven/lib/main.js
new file mode 100644
index 0000000..b860821
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/seven/lib/main.js
@@ -0,0 +1,6 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+var self = require("self"); // trigger inclusion of data
+exports.main = function () { console.log("main"); };
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/seven/lib/unused.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/seven/lib/unused.js
new file mode 100644
index 0000000..a7b1c14
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/seven/lib/unused.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.unused = "just pretend I'm not here";
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/seven/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/seven/package.json
new file mode 100644
index 0000000..922c77d
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/seven/package.json
@@ -0,0 +1,4 @@
+{
+ "name": "seven",
+ "id": "jid7"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/six/lib/unused.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/six/lib/unused.js
new file mode 100644
index 0000000..ada31ef
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/six/lib/unused.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.unused = "I am.";
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/six/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/six/package.json
new file mode 100644
index 0000000..906b249
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/six/package.json
@@ -0,0 +1,3 @@
+{ "name": "six",
+ "main": "./unreachable"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/six/unreachable.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/six/unreachable.js
new file mode 100644
index 0000000..e8b229c
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/six/unreachable.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.main = "I am outside lib/ and cannot be reached, yet";
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/main.js
new file mode 100644
index 0000000..cee7380
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/main.js
@@ -0,0 +1,8 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.main = 42;
+require("./subdir/subfile");
+require("self"); // trigger inclusion of our data/ directory
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/subdir/subfile.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/subdir/subfile.js
new file mode 100644
index 0000000..aec24d0
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/subdir/subfile.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.main = "I should be included in a subdir";
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/unused.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/unused.js
new file mode 100644
index 0000000..36c4a4e
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/lib/unused.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.main = "unused, linker should not include me in the XPI";
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/locale/fr-FR.properties b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/locale/fr-FR.properties
new file mode 100644
index 0000000..980ac46
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/locale/fr-FR.properties
@@ -0,0 +1,5 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+Yes= Oui
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/package.json
new file mode 100644
index 0000000..6b796fc
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-a/package.json
@@ -0,0 +1,3 @@
+{ "name": "three-a",
+ "main": "./lib/main.js"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/lib/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/lib/main.js
new file mode 100644
index 0000000..7e1ce7e
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/lib/main.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.main = 42;
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/locale/fr-FR.properties b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/locale/fr-FR.properties
new file mode 100644
index 0000000..c1bf146
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/locale/fr-FR.properties
@@ -0,0 +1,6 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+No= Non
+one= un
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/package.json
new file mode 100644
index 0000000..c0ff5ee
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-b/package.json
@@ -0,0 +1,3 @@
+{ "name": "three-b",
+ "main": "./lib/main"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/lib/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/lib/main.js
new file mode 100644
index 0000000..7e1ce7e
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/lib/main.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.main = 42;
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/lib/sub/foo.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/lib/sub/foo.js
new file mode 100644
index 0000000..5878496
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/lib/sub/foo.js
@@ -0,0 +1,6 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.foo = "you found me down here";
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/locale/fr-FR.properties b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/locale/fr-FR.properties
new file mode 100644
index 0000000..dac3f13
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/locale/fr-FR.properties
@@ -0,0 +1,9 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+No= Nein
+What?= Quoi?
+plural=other
+plural[one]=one
+uft8_value=é
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/package.json
new file mode 100644
index 0000000..169c914
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three-deps/three-c/package.json
@@ -0,0 +1,3 @@
+{ "name": "three-c",
+ "main": "lib/main"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/data/msg.txt b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/data/msg.txt
new file mode 100644
index 0000000..3b18e51
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/data/msg.txt
@@ -0,0 +1 @@
+hello world
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/data/subdir/submsg.txt b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/data/subdir/submsg.txt
new file mode 100644
index 0000000..d2cfe80
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/data/subdir/submsg.txt
@@ -0,0 +1 @@
+hello subdir
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/lib/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/lib/main.js
new file mode 100644
index 0000000..4f59443
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/lib/main.js
@@ -0,0 +1,8 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+var a = require("three-a");
+var b = require("three-b");
+var c = require("three-c");
+var c3 = require("three-c/sub/foo");
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/package.json
new file mode 100644
index 0000000..cbfbc5b
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/package.json
@@ -0,0 +1,3 @@
+{ "name": "three",
+ "main": "main"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/tests/nontest.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/tests/nontest.js
new file mode 100644
index 0000000..edbc08e
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/tests/nontest.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// dummy
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/tests/test-one.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/tests/test-one.js
new file mode 100644
index 0000000..edbc08e
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/tests/test-one.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// dummy
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/tests/test-two.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/tests/test-two.js
new file mode 100644
index 0000000..edbc08e
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/linker-files/three/tests/test-two.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// dummy
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/preferences-files/packages/no-prefs/lib/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/preferences-files/packages/no-prefs/lib/main.js
new file mode 100644
index 0000000..b7e0a1d
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/preferences-files/packages/no-prefs/lib/main.js
@@ -0,0 +1,4 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/preferences-files/packages/no-prefs/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/preferences-files/packages/no-prefs/package.json
new file mode 100644
index 0000000..f1d51b0
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/preferences-files/packages/no-prefs/package.json
@@ -0,0 +1,6 @@
+{
+ "id": "jid1-fZHqN9JfrDBa8A",
+ "fullName": "No Prefs Test",
+ "author": "Erik Vold",
+ "loader": "lib/main.js"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/preferences-files/packages/simple-prefs/lib/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/preferences-files/packages/simple-prefs/lib/main.js
new file mode 100644
index 0000000..b7e0a1d
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/preferences-files/packages/simple-prefs/lib/main.js
@@ -0,0 +1,4 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/preferences-files/packages/simple-prefs/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/preferences-files/packages/simple-prefs/package.json
new file mode 100644
index 0000000..a6bf06b
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/preferences-files/packages/simple-prefs/package.json
@@ -0,0 +1,50 @@
+{
+ "id": "jid1-fZHqN9JfrDBa8A",
+ "fullName": "Simple Prefs Test",
+ "author": "Erik Vold",
+ "preferences": [{
+ "name": "test",
+ "type": "bool",
+ "title": "tëst",
+ "value": false
+ },
+ {
+ "name": "test2",
+ "type": "string",
+ "title": "tëst",
+ "value": "ünicødé"
+ },
+ {
+ "name": "test3",
+ "type": "menulist",
+ "title": "\"><test",
+ "value": "1",
+ "options": [
+ {
+ "value": "0",
+ "label": "label1"
+ },
+ {
+ "value": "1",
+ "label": "label2"
+ }
+ ]
+ },
+ {
+ "name": "test4",
+ "type": "radio",
+ "title": "tëst",
+ "value": "red",
+ "options": [
+ {
+ "value": "red",
+ "label": "rouge"
+ },
+ {
+ "value": "blue",
+ "label": "bleu"
+ }
+ ]
+ }],
+ "loader": "lib/main.js"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/dev-guide-source/index.md b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/dev-guide-source/index.md
new file mode 100644
index 0000000..0f03259
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/dev-guide-source/index.md
@@ -0,0 +1,7 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+# An Imposing Title #
+
+*Some words!*
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/dev-guide-source/no_h1.md b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/dev-guide-source/no_h1.md
new file mode 100644
index 0000000..9859f33
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/dev-guide-source/no_h1.md
@@ -0,0 +1,7 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+## A heading ##
+
+*Some words!*
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/high-level-modules.md b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/high-level-modules.md
new file mode 100644
index 0000000..8745e13
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/high-level-modules.md
@@ -0,0 +1,18 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+# High-Level APIs #
+
+Modules in this section implement high-level APIs for
+building add-ons:
+
+* creating user interfaces
+* interacting with the web
+* interacting with the browser
+
+Unless the documentation explicitly says otherwise, all these modules are
+"supported": meaning that they are relatively stable, and that we'll avoid
+making incompatible changes to them unless absolutely necessary.
+
+<ul id="module-index"></ul>
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/low-level-modules.md b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/low-level-modules.md
new file mode 100644
index 0000000..bc44007
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/low-level-modules.md
@@ -0,0 +1,36 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+# Low-Level APIs #
+
+Modules in this section implement low-level APIs. These
+modules fall roughly into three categories:
+
+* fundamental utilities such as
+[collection](modules/sdk/util/collection.html) and
+[url](modules/sdk/url.html). Many add-ons are likely to
+want to use modules from this category.
+
+* building blocks for higher level modules, such as
+[events](modules/sdk/events/core.html),
+[worker](modules/sdk/content/worker.html), and
+[api-utils](modules/sdk/deprecated/api-utils.html). You're more
+likely to use these if you are building your own modules that
+implement new APIs, thus extending the SDK itself.
+
+* privileged modules that expose powerful low-level capabilities
+such as [window/utils](modules/sdk/window/utils.html) and
+[xhr](modules/sdk/net/xhr.html). You can use these
+modules in your add-on if you need to, but should be aware that
+the cost of privileged access is the need to take more elaborate
+security precautions. In many cases these modules have simpler,
+more restricted analogs among the "High-Level APIs" (for
+example, [windows](modules/sdk/windows.html) or
+[request](modules/sdk/request.html)).
+
+These modules are still in active development, and we expect to
+make incompatible changes to them in future releases.
+
+
+<ul id="module-index"></ul>
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/sdk/aardvark-feeder.md b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/sdk/aardvark-feeder.md
new file mode 100644
index 0000000..3845955
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/sdk/aardvark-feeder.md
@@ -0,0 +1,12 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+The `aardvark-feeder` module simplifies feeding aardvarks.
+
+<api name="feed">
+@function
+ Feed the aardvark.
+@param food {string}
+ The food. Aardvarks will eat anything.
+</api>
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/sdk/anteater/anteater.md b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/sdk/anteater/anteater.md
new file mode 100644
index 0000000..c480ce3
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/sdk/anteater/anteater.md
@@ -0,0 +1,10 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+The `anteater` module should not be used by anyone.
+
+<api name="release">
+@function
+ Releases the anteater. Do not call this function.
+</api>
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/sdk/main.md b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/sdk/main.md
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/sdk/main.md
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/sdk/not_a_doc.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/sdk/not_a_doc.js
new file mode 100644
index 0000000..f4abc3b
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/sdk/not_a_doc.js
@@ -0,0 +1,5 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+not a doc \ No newline at end of file
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/third-party-modules.md b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/third-party-modules.md
new file mode 100644
index 0000000..33e957c
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/module-source/third-party-modules.md
@@ -0,0 +1,11 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+# Third-party APIs #
+
+This section include modules you've added to the SDK. The tutorial on
+[adding menu items to Firefox](dev-guide/tutorials/adding-menus.html)
+explains how to add third-party modules to your SDK installation.
+
+<ul id="module-index"></ul>
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/static-files/another.html b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/static-files/another.html
new file mode 100644
index 0000000..d40a2e8
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/static-files/another.html
@@ -0,0 +1,5 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+another file \ No newline at end of file
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/static-files/base.html b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/static-files/base.html
new file mode 100644
index 0000000..3dd3df1
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/static-files/base.html
@@ -0,0 +1,161 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+"http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+<head>
+ <base >
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
+ <script type="text/javascript" src="static-files/syntaxhighlighter/scripts/shCore.js"></script>
+ <script type="text/javascript" src="static-files/syntaxhighlighter/scripts/shBrushCss.js"></script>
+ <script type="text/javascript" src="static-files/syntaxhighlighter/scripts/shBrushXml.js"></script>
+ <script type="text/javascript" src="static-files/syntaxhighlighter/scripts/shBrushJScript.js"></script>
+ <link rel="stylesheet" type="text/css" media="all" href="static-files/css/base.css">
+ <link rel="stylesheet" type="text/css" media="all" href="static-files/css/header.css">
+ <link rel="stylesheet" type="text/css" media="all" href="static-files/css/footer.css">
+ <link rel="stylesheet" type="text/css" media="all" href="static-files/css/sdk-docs.css">
+ <link rel="stylesheet" type="text/css" media="all" href="static-files/css/api-reference.css">
+ <link rel="stylesheet" type="text/css" href="static-files/syntaxhighlighter/styles/shCore.css">
+ <link rel="stylesheet" type="text/css" href="static-files/syntaxhighlighter/styles/shThemeDefault.css">
+ <!--[if IE]>
+ <style type="text/css">
+ .package-summary .module,
+ .package-entry .module,
+ .package-detail .module {
+ display: block;
+ }
+ </style>
+ <![endif]-->
+
+ <link rel="shortcut icon" type="image/x-icon" href="static-files/media/favicon.png">
+ <title></title>
+</head>
+<body>
+
+<header id="global-header">
+ <div class="funnel">
+ <a id="mozilla-tab" href="http://www.mozilla.org/?ref=logo">Mozilla</a>
+ <div class="menu">
+ <p>
+ <a href="https://builder.addons.mozilla.org/">Add-on Builder</a>
+ </p>
+ <p>
+ <a href="https://addons.mozilla.org/en-US/developers/">Developer Hub</a>
+ </p>
+ </div>
+</header>
+
+
+<header id="site-header">
+ <div class="funnel">
+ <h1>
+ <a href="dev-guide/welcome.html">Add-on SDK<span></span></a>
+ </h1>
+ <div id="version"></div>
+ </div>
+</header>
+
+ <div id="container">
+
+ <div id="columns">
+
+ <div id="main-content-column" class="column">
+ <div id="toc"></div>
+ <div id="main-content"></div>
+ </div>
+
+ <div id="sidebar" class="column">
+ <div class="sidebar-section" id="addon-development">
+ <h2 class="sidebar-section-header">Developer Guide</h2>
+ <ul class="sidebar-section-contents" id="default-section-contents">
+
+ <li class="sidebar-subsection">
+ <a href="dev-guide/tutorials/installation.html"><h3>Installation</h3></a>
+ </li>
+ <li class="sidebar-subsection">
+ <a href="dev-guide/tutorials/tutorials.html"><h3 class="sidebar-subsection-header">Tutorials</h3></a>
+ </li>
+
+ <li class="sidebar-subsection">
+ <a href="dev-guide/guides/index.html"><h3 class="sidebar-subsection-header">Guides</h3></a>
+ </li>
+
+ <li class="sidebar-subsection" id="third-party-packages-subsection">
+ <a href="dev-guide/third-party-apis.html"><h3 class="sidebar-subsection-header">Third-Party APIs</h3></a>
+ <div class="sidebar-subsection-contents">
+ <ul id="third-party-package-summaries"></ul>
+ </div>
+ </li>
+
+ <li class="sidebar-subsection">
+ <a href="dev-guide/high-level-apis.html"><h3 class="sidebar-subsection-header">High-Level APIs</h3></a>
+ <div class="sidebar-subsection-contents">
+ <ul id="high-level-module-summaries"></ul>
+ </div>
+ </li>
+
+ <li class="sidebar-subsection">
+ <h3 class="sidebar-subsection-header">Tools Reference</h3>
+ <div class="sidebar-subsection-contents">
+ <a href="dev-guide/console.html">console</a>
+ <a href="dev-guide/cfx-tool.html">cfx</a>
+ <a href="dev-guide/package-spec.html">package.json</a>
+ </div>
+ </li>
+
+ <li class="sidebar-subsection">
+ <a href="dev-guide/low-level-apis.html"><h3 class="sidebar-subsection-header">Low-Level APIs</h3></a>
+ <div class="sidebar-subsection-contents">
+ <ul id="low-level-module-summaries"></ul>
+ </div>
+ </li>
+
+ </ul>
+ </div>
+
+ <ul class="sidebar-section" id="appendices">
+ <li><a href="https://wiki.mozilla.org/Labs/Jetpack/Release_Notes"><h3>Release Notes</h3></a></li>
+ <li><a href="https://wiki.mozilla.org/Labs/Jetpack"><h3>Jetpack Wiki</h3></a></li>
+ <li><a href="dev-guide/glossary.html"><h3>Glossary</h3></a></li>
+ <li><a href="dev-guide/credits.html"><h3>Credits</h3></a></li>
+
+ </ul>
+<!--end of sidebar column-->
+ </div>
+<!--end of 'columns'-->
+<div class="clearfooter"></div>
+</div>
+</div>
+
+<div role="contentinfo" id="footer">
+ <div class="section">
+ <img alt="" src="static-files/media/footer-logo-med.png" class="footerlogo">
+ <div id="social-footer">
+ <ul>
+ <li>get to know <b>add-ons</b></li>
+ <li><a href="https://addons.mozilla.org/en-US/firefox/about">About</a></li>
+ <li><a href="http://blog.mozilla.com/addons">Blog</a></li>
+ <li class="footer-devhub-link"><a href="https://addons.mozilla.org/en-US/developers/">Developer Hub</a></li>
+ <li><a href="https://addons.mozilla.org/en-US/firefox/faq">FAQ</a></li>
+ <li><a href="https://forums.addons.mozilla.org">Forum</a></li>
+ </ul>
+ </div>
+
+ <div id="copyright">
+ <p id="footer-links">
+ <a href="http://mozilla.com/privacy-policy.html">Privacy Policy</a> &nbsp;|&nbsp;
+ <a href="http://mozilla.com/about/legal.html">Legal Notices</a> &nbsp;|&nbsp;
+ <a href="http://mozilla.com/legal/fraud-report/index.html">Report Trademark Abuse</a>
+ &nbsp;|&nbsp;<a href="https://addons.mozilla.org/z/en-US/developers/" class="mobile-link">View Mobile Site</a>
+ </p>
+ <p>
+ Except where otherwise <a href="http://mozilla.com/about/legal.html#site">noted</a>, content on this site is licensed under the <br> <a href="http://creativecommons.org/licenses/by-sa/3.0/"> Creative Commons Attribution Share-Alike License v3.0 </a> or any later version.
+ </p>
+ </div>
+ </div>
+</div>
+
+<script type="text/javascript" src="static-files/js/jquery.js"></script>
+<script type="text/javascript" src="static-files/js/main.js"></script>
+
+</body>
+
+</html>
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/static-files/index.html b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/static-files/index.html
new file mode 100644
index 0000000..1909a18
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/doc/static-files/index.html
@@ -0,0 +1,27 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<html>
+
+<head>
+
+ <title></title>
+
+</head>
+
+<body>
+
+<div id="left-column">
+
+<ul><li id="high-level-package-summaries"></li></ul>
+
+<ul><li id="low-level-package-summaries"></li></ul>
+
+</div>
+
+<div id="right-column"></div>
+
+</body>
+
+</html>
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/docs/APIreference.html b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/docs/APIreference.html
new file mode 100644
index 0000000..e302641
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/docs/APIreference.html
@@ -0,0 +1,469 @@
+
+<!DOCTYPE html>
+
+<html>
+
+<head>
+
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+
+ <base target="_blank"/>
+
+ <link rel="stylesheet" type="text/css" media="all"
+
+ href="../../../css/base.css" />
+
+ <link rel="stylesheet" type="text/css" media="all"
+
+ href="../../../css/apidocs.css" />
+
+ <title>Add-on SDK Documentation</title>
+
+ <style type="text/css">
+
+ body {
+
+ border: 50px solid #FFFFFF;
+
+ }
+
+ </style>
+
+
+
+ <script type="text/javascript">
+
+ function rewrite_links() {
+
+ var images = document.getElementsByTagName("img");
+
+ for (var i = 0; i < images.length; i++) {
+
+ var before = images[i].src.split("packages/")[0];
+
+ var after = images[i].src.split("/docs")[1];
+
+ images[i].src = before + after;
+
+ }
+
+ }
+
+ </script>
+
+</head>
+
+
+
+<body onload = "rewrite_links()">
+
+<div id="APIsample_module_api_docs" class="module_api_docs">
+ <h1>APIsample</h1>
+ <div class="module_description"><!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+ <h1>Title</h1>
+ <p>Some text here</p>
+ <p>This text appears between the API blocks.</p>
+ <p>Wooo, more text.</p>
+ <p>Some more text here, at the end of the file.</p>
+ </div>
+
+ <div class="api_reference">
+ <h2 class="api_header">API Reference</h2>
+
+ <div class="api_component_group">
+ <h3 class="api_header">Classes</h3>
+
+ <div class="api_component">
+ <h4 class="api_name">empty-class</h4>
+ <p>This class contains nothing.</p>
+ </div>
+
+ <div class="api_component">
+ <h4 class="api_name">only-one-ctor</h4>
+ <p>This class contains only one constructor.</p>
+ <div class="api_component_group">
+ <h5 class="api_header">Constructors</h5>
+
+ <div class="api_component">
+ <h6 class="api_name">one-constructor(options)</h6>
+
+ <div class="parameter_set">
+ <div class="api_component">
+ <div class="api_name">[ options ]</div>
+ <p>An object-bag of goodies.</p>
+ </div>
+
+ </div>
+
+ </div>
+
+ </div>
+
+ </div>
+
+ <div class="api_component">
+ <h4 class="api_name">two-ctors</h4>
+ <p>This class contains two constructors.</p>
+ <div class="api_component_group">
+ <h5 class="api_header">Constructors</h5>
+
+ <div class="api_component">
+ <h6 class="api_name">one-constructor(options)</h6>
+ <p>The first constructor.</p>
+ <div class="parameter_set">
+ <div class="api_component">
+ <div class="api_name">[ options ]</div>
+ <p>An object-bag of goodies.</p>
+ </div>
+
+ </div>
+
+ </div>
+
+ <div class="api_component">
+ <h6 class="api_name">another-constructor(options)</h6>
+ <p>The second constructor.</p>
+ <div class="parameter_set">
+ <div class="api_component">
+ <div class="api_name">[ options ]</div>
+ <p>An object-bag of goodies.</p>
+ </div>
+
+ </div>
+
+ </div>
+
+ </div>
+
+ </div>
+
+ <div class="api_component">
+ <h4 class="api_name">ctor-and-method</h4>
+ <p>This class contains one constructor and one method.</p>
+ <div class="api_component_group">
+ <h5 class="api_header">Constructors</h5>
+
+ <div class="api_component">
+ <h6 class="api_name">one-constructor(options)</h6>
+ <p>The first constructor.</p>
+ <div class="parameter_set">
+ <div class="api_component">
+ <div class="api_name">[ options ]</div>
+ <p>An object-bag of goodies.</p>
+ </div>
+
+ </div>
+
+ </div>
+
+ </div>
+
+ <div class="api_component_group">
+ <h5 class="api_header">Methods</h5>
+
+ <div class="api_component">
+ <h6 class="api_name">a-method(options)</h6>
+ <p>Does things.</p>
+ <div class="parameter_set">
+ <div class="api_component">
+ <div class="api_name">[ options ]</div>
+ <p>An argument.</p>
+ </div>
+
+ </div>
+
+ </div>
+
+ </div>
+
+ </div>
+
+ <div class="api_component">
+ <h4 class="api_name">ctor-method-prop-event</h4>
+ <p>This class contains one constructor, one method, one property and an event.</p>
+ <div class="api_component_group">
+ <h5 class="api_header">Constructors</h5>
+
+ <div class="api_component">
+ <h6 class="api_name">one-constructor(options)</h6>
+ <p>The first constructor.</p>
+ <div class="parameter_set">
+ <div class="api_component">
+ <div class="api_name">[ options ]</div>
+ <p>An object-bag of goodies.</p>
+ </div>
+
+ </div>
+
+ </div>
+
+ </div>
+
+ <div class="api_component_group">
+ <h5 class="api_header">Methods</h5>
+
+ <div class="api_component">
+ <h6 class="api_name">a-method(options)</h6>
+ <p>Does things.</p>
+ <div class="parameter_set">
+ <div class="api_component">
+ <div class="api_name">[ options ]</div>
+ <p>An argument.</p>
+ </div>
+
+ </div>
+
+ </div>
+
+ </div>
+
+ <div class="api_component_group">
+ <h5 class="api_header">Properties</h5>
+
+ <div class="api_component">
+ <h6 class="api_name">a-property : <span class="datatype">bool</span></h6>
+ <p>Represents stuff.</p>
+ </div>
+
+ </div>
+
+ <div class="api_component_group">
+ <h5 class="api_header">Events</h5>
+
+ <div class="api_component">
+ <h6 class="api_name">message</h6>
+ <p>Event emitted when the content script sends a message to the add-on.</p>
+ <div class="parameter_set">
+ <div class="api_component">
+ <div class="api_name"><span class="datatype">JSON</span></div>
+ <p>The message itself as a JSON-serialized object.</p>
+ </div>
+
+ </div>
+
+ </div>
+
+ </div>
+
+ </div>
+
+ </div>
+
+ <div class="api_component_group">
+ <h3 class="api_header">Functions</h3>
+
+ <div class="api_component">
+ <h4 class="api_name">test(argOne, argTwo, argThree, options)</h4>
+ <p>This is a function which does nothing in particular.</p>
+ <div class="parameter_set">
+ <div class="api_component">
+ <div class="api_name">argOne : <span class="datatype">string</span></div>
+ <p>This is the first argument.</p>
+ </div>
+
+ <div class="api_component">
+ <div class="api_name">[ argTwo : <span class="datatype">bool</span> ]</div>
+ <p>This is the second argument.</p>
+ </div>
+
+ <div class="api_component">
+ <div class="api_name">[ argThree = default : <span class="datatype">uri</span> ]</div>
+ <p>This is the third and final argument. And this is
+ a test of the ability to do multiple lines of
+ text.</p>
+ </div>
+
+ <div class="api_component">
+ <div class="api_name">[ options ]</div>
+ <p>Options Bag</p>
+ <div class="api_component">
+ <div class="api_name">[ style : <span class="datatype">string</span> ]</div>
+ <p>Some style information.</p>
+ </div>
+
+ <div class="api_component">
+ <div class="api_name">[ secondToLastOption = True : <span class="datatype">bool</span> ]</div>
+ <p>The last property.</p>
+ </div>
+
+ <div class="api_component">
+ <div class="api_name">[ lastOption : <span class="datatype">uri</span> ]</div>
+ <p>And this time we have
+ A multiline description
+ Written as haiku</p>
+ </div>
+
+ </div>
+
+ </div>
+
+ <div class="returns">Returns: <span class="datatype">object</span>
+ </div>
+
+ </div>
+
+ <div class="api_component">
+ <h4 class="api_name">append(options)</h4>
+ <p>This is a list of options to specify modifications to your slideBar instance.</p>
+ <div class="parameter_set">
+ <div class="api_component">
+ <div class="api_name">options</div>
+ <p>Pass in all of your options here.</p>
+ <div class="api_component">
+ <div class="api_name">[ icon : <span class="datatype">uri</span> ]</div>
+ <p>The HREF of an icon to show as the method of accessing your features slideBar</p>
+ </div>
+
+ <div class="api_component">
+ <div class="api_name">[ html : <span class="datatype">string/xml</span> ]</div>
+ <p>The content of the feature, either as an HTML string,
+ or an E4X document fragment.</p>
+ </div>
+
+ <div class="api_component">
+ <div class="api_name">[ url : <span class="datatype">uri</span> ]</div>
+ <p>The url to load into the content area of the feature</p>
+ </div>
+
+ <div class="api_component">
+ <div class="api_name">[ width : <span class="datatype">int</span> ]</div>
+ <p>Width of the content area and the selected slide size</p>
+ </div>
+
+ <div class="api_component">
+ <div class="api_name">[ persist : <span class="datatype">bool</span> ]</div>
+ <p>Default slide behavior when being selected as follows:
+ If true: blah; If false: double blah.</p>
+ </div>
+
+ <div class="api_component">
+ <div class="api_name">[ autoReload : <span class="datatype">bool</span> ]</div>
+ <p>Automatically reload content on select</p>
+ </div>
+
+ <div class="api_component">
+ <div class="api_name">[ onClick : <span class="datatype">function</span> ]</div>
+ <p>Callback when the icon is clicked</p>
+ </div>
+
+ <div class="api_component">
+ <div class="api_name">[ onSelect : <span class="datatype">function</span> ]</div>
+ <p>Callback when the feature is selected</p>
+ </div>
+
+ <div class="api_component">
+ <div class="api_name">[ onReady : <span class="datatype">function</span> ]</div>
+ <p>Callback when featured is loaded</p>
+ </div>
+
+ </div>
+
+ </div>
+
+ </div>
+
+ <div class="api_component">
+ <h4 class="api_name">cool-func.dot(howMuch, double, options, onemore, options2)</h4>
+
+ <div class="parameter_set">
+ <div class="api_component">
+ <div class="api_name">howMuch : <span class="datatype">string</span></div>
+ <p>How much cool it is.</p>
+ </div>
+
+ <div class="api_component">
+ <div class="api_name">[ double = true : <span class="datatype">bool</span> ]</div>
+ <p>In case you just really need to double it.</p>
+ </div>
+
+ <div class="api_component">
+ <div class="api_name">[ options ]</div>
+ <p>An object-bag of goodies.</p>
+ <div class="api_component">
+ <div class="api_name">callback : <span class="datatype">function</span></div>
+ <p>The callback</p>
+ </div>
+
+ <div class="api_component">
+ <div class="api_name">[ random : <span class="datatype">bool</span> ]</div>
+ <p>Do something random?</p>
+ </div>
+
+ </div>
+
+ <div class="api_component">
+ <div class="api_name">[ onemore : <span class="datatype">bool</span> ]</div>
+ <p>One more paramater</p>
+ </div>
+
+ <div class="api_component">
+ <div class="api_name">[ options2 ]</div>
+ <p>This is a full description of something
+ that really sucks. Because I now have a multiline
+ description of this thingy.</p>
+ <div class="api_component">
+ <div class="api_name">monkey : <span class="datatype">string</span></div>
+ <p>You heard me right</p>
+ </div>
+
+ <div class="api_component">
+ <div class="api_name">[ freak = true : <span class="datatype">bool</span> ]</div>
+ <p>Yes, you are a freak.</p>
+ </div>
+
+ </div>
+
+ </div>
+
+ <div class="returns">Returns: <span class="datatype">string</span><p>A value telling you just how cool you are.
+ A boa-constructor!
+ This description can go on for a while, and can even contain
+ some <strong>realy</strong> fancy things. Like <code>code</code>, or even
+ ~~~~{.javascript}
+ // Some code!
+ ~~~~</p>
+ </div>
+
+ </div>
+
+ <div class="api_component">
+ <h4 class="api_name">random()</h4>
+ <p>A function that returns a random integer between 0 and 10.</p>
+ <div class="returns">Returns: <span class="datatype">int</span><p>The random number.</p>
+ </div>
+
+ </div>
+
+ </div>
+
+ <div class="api_component_group">
+ <h3 class="api_header">Events</h3>
+
+ <div class="api_component">
+ <h4 class="api_name">open</h4>
+ <p>A module-level event called open.</p>
+ <div class="parameter_set">
+ <div class="api_component">
+ <div class="api_name"><span class="datatype">bool</span></div>
+ <p>Yes, it's open.</p>
+ </div>
+
+ </div>
+
+ </div>
+
+ </div>
+
+ </div>
+
+</div>
+
+</body>
+
+
+
+</html>
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/docs/APIsample.md b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/docs/APIsample.md
new file mode 100644
index 0000000..c5090c3
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/docs/APIsample.md
@@ -0,0 +1,162 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+# Title #
+
+Some text here
+
+<api name="test">
+@function
+This is a function which does nothing in particular.
+@returns {object}
+ @prop firststring {string} First string
+ @prop firsturl {url} First URL
+@param argOne {string} This is the first argument.
+@param [argTwo] {bool} This is the second argument.
+@param [argThree=default] {uri}
+ This is the third and final argument. And this is
+ a test of the ability to do multiple lines of
+ text.
+@param [options] Options Bag
+ @prop [style] {string} Some style information.
+ @prop [secondToLastOption=True] {bool} The last property.
+ @prop [lastOption] {uri}
+ And this time we have
+ A multiline description
+ Written as haiku
+</api>
+
+This text appears between the API blocks.
+
+<api name="append">
+@function
+This is a list of options to specify modifications to your slideBar instance.
+@param options
+ Pass in all of your options here.
+ @prop [icon] {uri} The HREF of an icon to show as the method of accessing your features slideBar
+ @prop [html] {string/xml}
+ The content of the feature, either as an HTML string,
+ or an E4X document fragment.
+ @prop [url] {uri} The url to load into the content area of the feature
+ @prop [width] {int} Width of the content area and the selected slide size
+ @prop [persist] {bool}
+ Default slide behavior when being selected as follows:
+ If true: blah; If false: double blah.
+ @prop [autoReload] {bool} Automatically reload content on select
+ @prop [onClick] {function} Callback when the icon is clicked
+ @prop [onSelect] {function} Callback when the feature is selected
+ @prop [onReady] {function} Callback when featured is loaded
+</api>
+
+Wooo, more text.
+
+<api name="cool-func.dot">
+@function
+@returns {string} A value telling you just how cool you are.
+A boa-constructor!
+This description can go on for a while, and can even contain
+some **realy** fancy things. Like `code`, or even
+~~~~{.javascript}
+// Some code!
+~~~~
+@param howMuch {string} How much cool it is.
+@param [double=true] {bool}
+ In case you just really need to double it.
+@param [options] An object-bag of goodies.
+ @prop callback {function} The callback
+ @prop [random] {bool} Do something random?
+@param [onemore] {bool} One more paramater
+@param [options2]
+ This is a full description of something
+ that really sucks. Because I now have a multiline
+ description of this thingy.
+ @prop monkey {string} You heard me right
+ @prop [freak=true] {bool}
+ Yes, you are a freak.
+</api>
+
+<api name="random">
+@function
+A function that returns a random integer between 0 and 10.
+@returns {int} The random number.
+</api>
+
+<api name="empty-class">
+@class
+This class contains nothing.
+</api>
+
+<api name="only-one-ctor">
+@class
+This class contains only one constructor.
+<api name="one-constructor">
+@constructor
+@param [options] An object-bag of goodies.
+</api>
+</api>
+
+<api name="two-ctors">
+@class
+This class contains two constructors.
+<api name="one-constructor">
+@constructor
+The first constructor.
+@param [options] An object-bag of goodies.
+</api>
+<api name="another-constructor">
+@constructor
+The second constructor.
+@param [options] An object-bag of goodies.
+</api>
+</api>
+
+<api name="ctor-and-method">
+@class
+This class contains one constructor and one method.
+<api name="one-constructor">
+@constructor
+The first constructor.
+@param [options] An object-bag of goodies.
+</api>
+<api name="a-method">
+@method
+Does things.
+@param [options] An argument.
+</api>
+</api>
+
+<api name="ctor-method-prop-event">
+@class
+This class contains one constructor, one method, one property and an event.
+<api name="one-constructor">
+@constructor
+The first constructor.
+@param [options] An object-bag of goodies.
+</api>
+<api name="a-method">
+@method
+Does things.
+@param [options] An argument.
+</api>
+<api name="a-property">
+@property {bool}
+Represents stuff.
+</api>
+<api name="message">
+@event
+Event emitted when the content script sends a message to the add-on.
+@argument {JSON}
+The message itself as a JSON-serialized object.
+</api>
+</api>
+
+<api name="open">
+@event
+A module-level event called open.
+@argument {bool}
+Yes, it's open.
+</api>
+
+Some more text here, at the end of the file.
+
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/doc/main.md b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/doc/main.md
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/doc/main.md
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/ignore_me b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/ignore_me
new file mode 100644
index 0000000..014242c
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/ignore_me
@@ -0,0 +1,3 @@
+The docs processor should tolerate (by ignoring) random non-.js files in lib
+directories, such as those left around by editors, version-control systems,
+or OS metadata like .DS_Store . This file exercises that tolerance.
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/main.js
new file mode 100644
index 0000000..0264872
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/main.js
@@ -0,0 +1,8 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.main = function(options, callbacks) {
+ console.log("1 + 1 =", require("bar-module").add(1, 1));
+ callbacks.quit();
+};
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/surprise.js/ignore_me_too b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/surprise.js/ignore_me_too
new file mode 100644
index 0000000..066f9b5
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/lib/surprise.js/ignore_me_too
@@ -0,0 +1,2 @@
+The docs processor should also ignore directories named *.js, and their
+contents.
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/package.json
new file mode 100644
index 0000000..afb5698
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/aardvark/package.json
@@ -0,0 +1,7 @@
+{
+ "author": "Jon Smith",
+ "description": "A package w/ a main module; can be built into an extension.",
+ "keywords": ["potato"],
+ "version": "1.0",
+ "dependencies": ["addon-sdk", "barbeque"]
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/anteater_files/lib/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/anteater_files/lib/main.js
new file mode 100644
index 0000000..0264872
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/anteater_files/lib/main.js
@@ -0,0 +1,8 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.main = function(options, callbacks) {
+ console.log("1 + 1 =", require("bar-module").add(1, 1));
+ callbacks.quit();
+};
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/anteater_files/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/anteater_files/package.json
new file mode 100644
index 0000000..9684581
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/anteater_files/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "anteater",
+ "author": "Jon Smith",
+ "description": "A package w/ a main module; can be built into an extension.",
+ "keywords": ["potato"],
+ "version": "1.0",
+ "dependencies": ["addon-sdk", "barbeque"]
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/api-utils/lib/loader.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/api-utils/lib/loader.js
new file mode 100644
index 0000000..361846d
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/api-utils/lib/loader.js
@@ -0,0 +1,7 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// This module will be imported by the XPCOM harness/boostrapper
+// via Components.utils.import() and is responsible for creating a
+// CommonJS module loader.
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/api-utils/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/api-utils/package.json
new file mode 100644
index 0000000..64eb065
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/api-utils/package.json
@@ -0,0 +1,5 @@
+{
+ "description": "A foundational package that provides a CommonJS module loader implementation.",
+ "keywords": ["potato", "jetpack-low-level"],
+ "loader": "lib/loader.js"
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/barbeque/lib/bar-module.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/barbeque/lib/bar-module.js
new file mode 100644
index 0000000..ff982ae
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/barbeque/lib/bar-module.js
@@ -0,0 +1,7 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.add = function add(a, b) {
+ return a + b;
+};
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/barbeque/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/barbeque/package.json
new file mode 100644
index 0000000..62e3c12
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/barbeque/package.json
@@ -0,0 +1,4 @@
+{
+ "keywords": ["potato", "jetpack-low-level"],
+ "description": "A package used by 'aardvark' as a library."
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/minimal/lib/main.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/minimal/lib/main.js
new file mode 100644
index 0000000..aeda0e7
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/minimal/lib/main.js
@@ -0,0 +1,8 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+exports.main = function(options, callbacks) {
+ console.log("minimal");
+ callbacks.quit();
+};
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/minimal/package.json b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/minimal/package.json
new file mode 100644
index 0000000..530f3c2
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/packages/minimal/package.json
@@ -0,0 +1,4 @@
+{
+ "author": "Jon Smith",
+ "description": "A package w/ a main module; can be built into an extension."
+}
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/xpi-template/components/harness.js b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/xpi-template/components/harness.js
new file mode 100644
index 0000000..a20bf3f
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/static-files/xpi-template/components/harness.js
@@ -0,0 +1,8 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// This file contains XPCOM code that bootstraps an SDK-based add-on
+// by loading its harness-options.json, registering all its resource
+// directories, executing its loader, and then executing its program's
+// main() function.
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_apiparser.py b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_apiparser.py
new file mode 100644
index 0000000..c24f5c3
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_apiparser.py
@@ -0,0 +1,538 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+
+import os
+import unittest
+from cuddlefish.docs.apiparser import parse_hunks, ParseError
+
+tests_path = os.path.abspath(os.path.dirname(__file__))
+static_files_path = os.path.join(tests_path, "static-files")
+
+class ParserTests(unittest.TestCase):
+ def pathname(self, filename):
+ return os.path.join(static_files_path, "docs", filename)
+
+ def parse_text(self, text):
+ return list(parse_hunks(text))
+
+ def parse(self, pathname):
+ return self.parse_text(open(pathname).read())
+
+ def test_parser(self):
+ parsed = self.parse(self.pathname("APIsample.md"))
+ #for i,h in enumerate(parsed):
+ # print i, h
+ self.assertEqual(parsed[0],
+ ("version", 4))
+ self.assertEqual(parsed[1],
+ ("markdown", """\
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+# Title #
+
+Some text here
+
+"""))
+
+ self.assertEqual(parsed[2][0], "api-json")
+ p_test = parsed[2][1]
+ self.assertEqual(p_test["name"], "test")
+ self.assertEqual(p_test["type"], "function")
+ self.assertEqual(p_test["signature"], "test(argOne, argTwo, \
+argThree, options)")
+ self.assertEqual(p_test["description"],
+ "This is a function which does nothing in \
+particular.")
+ r = p_test["returns"]
+ self.assertEqual(r["datatype"], "object")
+ self.assertEqual(r["description"], "")
+ self.assertEqual(len(r["props"]), 2)
+ self.assertEqual(r["props"][0]["datatype"], "string")
+ self.assertEqual(r["props"][0]["description"], "First string")
+ self.assertEqual(r["props"][1]["datatype"], "url")
+ self.assertEqual(r["props"][1]["description"], "First URL")
+
+ self.assertEqual(p_test["params"][0],
+ {"name": "argOne",
+ "required": True,
+ "datatype": "string",
+ "description": "This is the first argument.",
+ "line_number": 15,
+ })
+
+ self.assertEqual(p_test["params"][1],
+ {"name": "argTwo",
+ "required": False,
+ "datatype": "bool",
+ "description": "This is the second argument.",
+ "line_number": 16,
+ })
+
+ self.assertEqual(p_test["params"][2],
+ {"name": "argThree",
+ "required": False,
+ "default": "default",
+ "datatype": "uri",
+ "line_number": 17,
+ "description": """\
+This is the third and final argument. And this is
+a test of the ability to do multiple lines of
+text.""",
+ })
+ p3 = p_test["params"][3]
+ self.assertEqual(p3["name"], "options")
+ self.assertEqual(p3["required"], False)
+ self.failIf("type" in p3)
+ self.assertEqual(p3["description"], "Options Bag")
+ self.assertEqual(p3["props"][0],
+ {"name": "style",
+ "required": False,
+ "datatype": "string",
+ "description": "Some style information.",
+ "line_number": 22,
+ })
+ self.assertEqual(p3["props"][1],
+ {"name": "secondToLastOption",
+ "required": False,
+ "default": "True",
+ "datatype": "bool",
+ "description": "The last property.",
+ "line_number": 23,
+ })
+ self.assertEqual(p3["props"][2]["name"], "lastOption")
+ self.assertEqual(p3["props"][2]["required"], False)
+ self.assertEqual(p3["props"][2]["datatype"], "uri")
+ self.assertEqual(p3["props"][2]["description"], """\
+And this time we have
+A multiline description
+Written as haiku""")
+
+ self.assertEqual(parsed[3][0], "markdown")
+ self.assertEqual(parsed[3][1], "\n\nThis text appears between the \
+API blocks.\n\n")
+
+ self.assertEqual(parsed[4][0], "api-json")
+ p_test = parsed[4][1]
+
+ expected = {'line_number': 32,
+ 'name': 'append',
+ 'params': [{'props':[{'line_number': 37,
+ 'required': False,
+ 'datatype': 'uri',
+ 'name': 'icon',
+ 'description': 'The HREF of an icon to show as the \
+method of accessing your features slideBar'},
+ {'line_number': 38,
+ 'required': False,
+ 'datatype': 'string/xml',
+ 'name': 'html',
+ 'description': 'The content of the feature, either \
+as an HTML string,\nor an E4X document fragment.'},
+ {'line_number': 41,
+ 'required': False,
+ 'datatype': 'uri',
+ 'name': 'url',
+ 'description': 'The url to load into the content area \
+of the feature'},
+ {'line_number': 42,
+ 'required': False,
+ 'datatype': 'int',
+ 'name': 'width',
+ 'description': 'Width of the content area and the \
+selected slide size'},
+ {'line_number': 43,
+ 'required': False,
+ 'datatype': 'bool',
+ 'name': 'persist',
+ 'description': 'Default slide behavior when being \
+selected as follows:\nIf true: blah; If false: double blah.'},
+ {'line_number': 46,
+ 'required': False,
+ 'datatype': 'bool',
+ 'name': 'autoReload',
+ 'description': 'Automatically reload content on \
+select'},
+ {'line_number': 47,
+ 'required': False,
+ 'datatype': 'function',
+ 'name': 'onClick',
+ 'description': 'Callback when the icon is \
+clicked'},
+ {'line_number': 48,
+ 'required': False,
+ 'datatype': 'function',
+ 'name': 'onSelect',
+ 'description': 'Callback when the feature is selected'},
+ {'line_number': 49,
+ 'required': False,
+ 'datatype': 'function',
+ 'name': 'onReady',
+ 'description':
+ 'Callback when featured is loaded'}],
+ 'line_number': 35,
+ 'required': True,
+ 'name': 'options',
+ 'description': 'Pass in all of your options here.'}],
+ 'signature': 'append(options)',
+ 'type': 'function',
+ 'description': 'This is a list of options to specify modifications to your \
+slideBar instance.'}
+ self.assertEqual(p_test, expected)
+
+ self.assertEqual(parsed[6][0], "api-json")
+ p_test = parsed[6][1]
+ self.assertEqual(p_test["name"], "cool-func.dot")
+ self.assertEqual(p_test["signature"], "cool-func.dot(howMuch, double, \
+options, onemore, options2)")
+ self.assertEqual(p_test["returns"]["description"],
+ """\
+A value telling you just how cool you are.
+A boa-constructor!
+This description can go on for a while, and can even contain
+some **realy** fancy things. Like `code`, or even
+~~~~{.javascript}
+// Some code!
+~~~~""")
+ self.assertEqual(p_test["params"][2]["props"][0],
+ {"name": "callback",
+ "required": True,
+ "datatype": "function",
+ "line_number": 67,
+ "description": "The callback",
+ })
+ self.assertEqual(p_test["params"][2]["props"][1],
+ {"name": "random",
+ "required": False,
+ "datatype": "bool",
+ "line_number": 68,
+ "description": "Do something random?",
+ })
+
+ p_test = parsed[8][1]
+ self.assertEqual(p_test["signature"],"random()")
+
+ # tests for classes
+ #1) empty class
+ p_test = parsed[10][1]
+ self.assertEqual(len(p_test), 4)
+ self.assertEqual(p_test["name"], "empty-class")
+ self.assertEqual(p_test["description"], "This class contains nothing.")
+ self.assertEqual(p_test["type"], "class")
+ # 2) class with just one ctor
+ p_test = parsed[12][1]
+ self.assertEqual(len(p_test), 5)
+ self.assertEqual(p_test["name"], "only-one-ctor")
+ self.assertEqual(p_test["description"], "This class contains only \
+one constructor.")
+ self.assertEqual(p_test["type"], "class")
+ constructors = p_test["constructors"]
+ self.assertEqual(len(constructors), 1)
+ self._test_class_constructor(constructors[0], "one-constructor")
+ # 3) class with 2 ctors
+ p_test = parsed[14][1]
+ self.assertEqual(len(p_test), 5)
+ self.assertEqual(p_test["name"], "two-ctors")
+ self.assertEqual(p_test["description"], "This class contains two \
+constructors.")
+ self.assertEqual(p_test["type"], "class")
+ constructors = p_test["constructors"]
+ self.assertEqual(len(constructors), 2)
+ self._test_class_constructor(constructors[0], "one-constructor")
+ self._test_class_constructor(constructors[1], "another-constructor")
+ # 4) class with ctor + method
+ p_test = parsed[16][1]
+ self.assertEqual(len(p_test), 6)
+ self.assertEqual(p_test["name"], "ctor-and-method")
+ self.assertEqual(p_test["description"], "This class contains one \
+constructor and one method.")
+ self.assertEqual(p_test["type"], "class")
+ constructors = p_test["constructors"]
+ self.assertEqual(len(constructors), 1)
+ self._test_class_constructor(constructors[0], "one-constructor")
+ methods = p_test["methods"]
+ self.assertEqual(len(methods), 1)
+ self._test_class_method(methods[0])
+ # 5) class with ctor + method + property
+ p_test = parsed[18][1]
+ self.assertEqual(len(p_test), 8)
+ self.assertEqual(p_test["name"], "ctor-method-prop-event")
+ self.assertEqual(p_test["description"], "This class contains one \
+constructor, one method, one property and an event.")
+ self.assertEqual(p_test["type"], "class")
+ constructors = p_test["constructors"]
+ self.assertEqual(len(constructors), 1)
+ self._test_class_constructor(constructors[0], "one-constructor")
+ methods = p_test["methods"]
+ self.assertEqual(len(methods), 1)
+ self._test_class_method(methods[0])
+ properties = p_test["properties"]
+ self.assertEqual(len(properties), 1)
+ self._test_class_property(properties[0])
+ events = p_test["events"]
+ self.assertEqual(len(events), 1)
+ self._test_class_event(events[0])
+
+ self.assertEqual(parsed[-1][0], "markdown")
+ self.assertEqual(parsed[-1][1], "\n\nSome more text here, \
+at the end of the file.\n\n")
+
+ def _test_class_constructor(self, constructor, name):
+ self.assertEqual(constructor["type"], "constructor")
+ self.assertEqual(constructor["name"], name)
+ params = constructor["params"]
+ self.assertEqual(len(params), 1)
+ self.assertEqual(params[0]["name"], "options")
+ self.assertEqual(params[0]["description"], "An object-bag of goodies.")
+
+ def _test_class_method(self, method):
+ self.assertEqual(method["type"], "method")
+ self.assertEqual(method["name"], "a-method")
+ self.assertEqual(method["description"], "Does things.")
+ params = method["params"]
+ self.assertEqual(len(params), 1)
+ self.assertEqual(params[0]["name"], "options")
+ self.assertEqual(params[0]["description"], "An argument.")
+
+ def _test_class_property(self, prop):
+ self.assertEqual(prop["type"], "property")
+ self.assertEqual(prop["name"], "a-property")
+ self.assertEqual(prop["description"], "Represents stuff.")
+ self.assertEqual(prop["datatype"], "bool")
+
+ def _test_class_event(self, event):
+ self.assertEqual(event["type"], "event")
+ self.assertEqual(event["name"], "message")
+ self.assertEqual(event["description"], "Event emitted when the \
+content script sends a message to the add-on.")
+ arguments = event["arguments"]
+ self.assertEqual(len(arguments), 1)
+ argument = arguments[0]
+ self.assertEqual(argument["datatype"], "JSON")
+ self.assertEqual(argument["description"], "The message itself as a \
+JSON-serialized object.")
+
+ def test_missing_return_propname(self):
+ md = '''\
+<api name="test">
+@method
+This is a function which does nothing in particular.
+@returns {object}
+ @prop {string} First string, but the property name is missing
+ @prop {url} First URL, same problem
+@param argOne {string} This is the first argument.
+</api>
+'''
+ self.assertRaises(ParseError, self.parse_text, md)
+
+ def test_missing_return_proptype(self):
+ md = '''\
+<api name="test">
+@method
+This is a function which does nothing in particular.
+@returns {object}
+ @prop untyped It is an error to omit the type of a return property.
+@param argOne {string} This is the first argument.
+@param [argTwo=True] {bool} This is the second argument.
+</api>
+'''
+ self.assertRaises(ParseError, self.parse_text, md)
+
+ def test_return_propnames(self):
+ md = '''\
+<api name="test">
+@method
+This is a function which does nothing in particular.
+@returns {object}
+ @prop firststring {string} First string.
+ @prop [firsturl] {url} First URL, not always provided.
+@param argOne {string} This is the first argument.
+@param [argTwo=True] {bool} This is the second argument.
+</api>
+'''
+ parsed = self.parse_text(md)
+ r = parsed[1][1]["returns"]
+ self.assertEqual(r["props"][0]["name"], "firststring")
+ self.assertEqual(r["props"][0],
+ {"name": "firststring",
+ "datatype": "string",
+ "description": "First string.",
+ "required": True,
+ "line_number": 5, # 1-indexed
+ })
+ self.assertEqual(r["props"][1],
+ {"name": "firsturl",
+ "datatype": "url",
+ "description": "First URL, not always provided.",
+ "required": False,
+ "line_number": 6,
+ })
+
+ def test_return_description_1(self):
+ md = '''\
+<api name="test">
+@method
+This is a function which does nothing in particular.
+@returns {object} A one-line description.
+ @prop firststring {string} First string.
+ @prop [firsturl] {url} First URL, not always provided.
+@param argOne {string} This is the first argument.
+@param [argTwo=True] {bool} This is the second argument.
+</api>
+'''
+ parsed = self.parse_text(md)
+ r = parsed[1][1]["returns"]
+ self.assertEqual(r["description"], "A one-line description.")
+
+ def test_return_description_2(self):
+ md = '''\
+<api name="test">
+@method
+This is a function which does nothing in particular.
+@returns {object} A six-line description
+ which is consistently indented by two spaces
+ except for this line
+ and preserves the following empty line
+
+ from which a two-space indentation will be removed.
+ @prop firststring {string} First string.
+ @prop [firsturl] {url} First URL, not always provided.
+@param argOne {string} This is the first argument.
+@param [argTwo=True] {bool} This is the second argument.
+</api>
+'''
+ parsed = self.parse_text(md)
+ r = parsed[1][1]["returns"]
+ self.assertEqual(r["description"],
+ "A six-line description\n"
+ "which is consistently indented by two spaces\n"
+ " except for this line\n"
+ "and preserves the following empty line\n"
+ "\n"
+ "from which a two-space indentation will be removed.")
+
+ def test_return_description_3(self):
+ md = '''\
+<api name="test">
+@method
+This is a function which does nothing in particular.
+@returns A one-line untyped description.
+@param argOne {string} This is the first argument.
+@param [argTwo=True] {bool} This is the second argument.
+</api>
+'''
+ parsed = self.parse_text(md)
+ r = parsed[1][1]["returns"]
+ self.assertEqual(r["description"], "A one-line untyped description.")
+
+ # if the return value was supposed to be an array, the correct syntax
+ # would not have any @prop tags:
+ # @returns {array}
+ # Array consists of two elements, a string and a url...
+
+ def test_return_array(self):
+ md = '''\
+<api name="test">
+@method
+This is a function which returns an array.
+@returns {array}
+ Array consists of two elements, a string and a url.
+@param argOne {string} This is the first argument.
+@param [argTwo=True] {bool} This is the second argument.
+</api>
+'''
+ parsed = self.parse_text(md)
+ r = parsed[1][1]["returns"]
+ self.assertEqual(r["description"],
+ "Array consists of two elements, a string and a url.")
+
+ def test_bad_default_on_required_parameter(self):
+ md = '''\
+<api name="test">
+@method
+This is a function which does nothing in particular.
+@returns something
+@param argOne=ILLEGAL {string} Mandatory parameters do not take defaults.
+@param [argTwo=Chicago] {string} This is the second argument.
+</api>
+'''
+ self.assertRaises(ParseError, self.parse_text, md)
+
+ def test_missing_apitype(self):
+ md = '''\
+<api name="test">
+Sorry, you must have a @method or something before the description.
+Putting it after the description is not good enough
+@method
+@returns something
+</api>
+'''
+ self.assertRaises(ParseError, self.parse_text, md)
+
+ def test_missing_param_propname(self):
+ md = '''\
+<api name="test">
+@method
+This is a function which does nothing in particular.
+@param p1 {object} This is a parameter.
+ @prop {string} Oops, props must have a name.
+</api>
+'''
+ self.assertRaises(ParseError, self.parse_text, md)
+
+ def test_missing_param_proptype(self):
+ md = '''\
+<api name="test">
+@method
+This is a function which does nothing in particular.
+@param p1 {object} This is a parameter.
+ @prop name Oops, props must have a type.
+</api>
+'''
+ self.assertRaises(ParseError, self.parse_text, md)
+
+ def test_property(self):
+ md = '''\
+<api name="test">
+@property {foo}
+An object property named test of type foo.
+</api>
+'''
+ parsed = self.parse_text(md)
+ self.assertEqual(parsed[1][0], 'api-json')
+ actual_api_json_obj = parsed[1][1]
+ expected_api_json_obj = {
+ 'line_number': 1,
+ 'datatype': 'foo',
+ 'type': 'property',
+ 'name': 'test',
+ 'description': "An object property named test of type foo."
+ }
+ self.assertEqual(actual_api_json_obj, expected_api_json_obj)
+
+ def test_property_no_type(self):
+ md = '''\
+<api name="test">
+@property
+This property needs to specify a type!
+</api>
+'''
+ self.assertRaises(ParseError, self.parse_text, md)
+
+ def test_missing_api_closing_tag(self):
+ md = '''\
+<api name="test">
+@class
+This is a class with a missing closing tag.
+<api name="doStuff"
+@method
+This method does stuff.
+</api>
+'''
+ self.assertRaises(ParseError, self.parse_text, md)
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_apirenderer.py b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_apirenderer.py
new file mode 100644
index 0000000..24a1c7c
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_apirenderer.py
@@ -0,0 +1,31 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+
+import os
+import unittest
+from cuddlefish.docs.apirenderer import md_to_html
+
+tests_path = os.path.abspath(os.path.dirname(__file__))
+static_files_path = os.path.join(tests_path, "static-files")
+
+class ParserTests(unittest.TestCase):
+ def pathname(self, filename):
+ return os.path.join(static_files_path, "docs", filename)
+
+ def render_markdown(self, pathname):
+ return md_to_html(pathname)
+
+ def test_renderer(self):
+ test = self.render_markdown(self.pathname("APIsample.md"))
+ reference = open(self.pathname("APIreference.html")).read()
+ test_lines = test.splitlines(True)
+ reference_lines = reference.splitlines(True)
+ for x in range(len(test_lines)):
+ self.assertEqual(test_lines[x], reference_lines[x],
+ "line %d: expected '%s', got '%s'"
+ % (x+1, reference_lines[x], test_lines[x]))
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_generate.py b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_generate.py
new file mode 100644
index 0000000..901c889
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_generate.py
@@ -0,0 +1,181 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import os
+import shutil
+import unittest
+import StringIO
+import tarfile
+import HTMLParser
+import urlparse
+import urllib
+
+from cuddlefish.docs import generate
+from cuddlefish.tests import env_root
+
+INITIAL_FILESET = [ ["static-files", "base.html"], \
+ ["dev-guide", "index.html"], \
+ ["modules", "sdk", "aardvark-feeder.html"], \
+ ["modules", "sdk", "anteater", "anteater.html"]]
+
+EXTENDED_FILESET = [ ["static-files", "base.html"], \
+ ["dev-guide", "extra.html"], \
+ ["dev-guide", "index.html"], \
+ ["modules", "sdk", "aardvark-feeder.html"], \
+ ["modules", "sdk", "anteater", "anteater.html"]]
+
+EXTRAFILE = ["dev-guide", "extra.html"]
+
+def get_test_root():
+ return os.path.join(env_root, "python-lib", "cuddlefish", "tests", "static-files")
+
+def get_sdk_docs_root():
+ return os.path.join(get_test_root(), "sdk-docs")
+
+def get_base_url_path():
+ return os.path.join(get_sdk_docs_root(), "doc")
+
+def url_from_path(path):
+ path = path.lstrip("/")
+ return "file://"+"/"+"/".join(path.split(os.sep))+"/"
+
+def get_base_url():
+ return url_from_path(get_base_url_path())
+
+class Link_Checker(HTMLParser.HTMLParser):
+ def __init__(self, tester, filename, base_url):
+ HTMLParser.HTMLParser.__init__(self)
+ self.tester = tester
+ self.filename = filename
+ self.base_url = base_url
+ self.errors = []
+
+ def handle_starttag(self, tag, attrs):
+ link = self.find_link(attrs)
+ if link:
+ self.validate_link(link)
+
+ def handle_startendtag(self, tag, attrs):
+ link = self.find_link(attrs)
+ if link:
+ self.validate_link(link)
+
+ def find_link(self, attrs):
+ attrs = dict(attrs)
+ href = attrs.get('href', '')
+ if href:
+ parsed = urlparse.urlparse(href)
+ if not parsed.scheme:
+ return href
+ src = attrs.get('src', '')
+ if src:
+ parsed = urlparse.urlparse(src)
+ if not parsed.scheme:
+ return src
+
+ def validate_link(self, link):
+ parsed = urlparse.urlparse(link)
+ # there should not be any file:// URLs
+ self.tester.assertNotEqual(parsed.scheme, "file")
+ # any other absolute URLs will not be checked
+ if parsed.scheme:
+ return
+ current_path_as_url = url_from_path(os.path.dirname(self.filename))
+ # otherwise try to open the file at: baseurl + path
+ absolute_url = current_path_as_url + parsed.path
+ try:
+ urllib.urlopen(absolute_url)
+ except IOError:
+ self.errors.append(self.filename + "\n " + absolute_url)
+
+class Generate_Docs_Tests(unittest.TestCase):
+
+ def test_generate_static_docs(self):
+
+ def cleanup():
+ shutil.rmtree(get_base_url_path())
+ tgz.close()
+ os.remove(tar_filename)
+ generate.clean_generated_docs(os.path.join(env_root, "doc"))
+
+ # make sure we start clean
+ if os.path.exists(get_base_url_path()):
+ shutil.rmtree(get_base_url_path())
+ # generate a doc tarball, and extract it
+ base_url = get_base_url()
+ tar_filename = generate.generate_static_docs(env_root)
+ tgz = tarfile.open(tar_filename)
+ tgz.extractall(get_sdk_docs_root())
+ broken_links = []
+ # get each HTML file...
+ for root, subFolders, filenames in os.walk(get_sdk_docs_root()):
+ for filename in filenames:
+ if not filename.endswith(".html"):
+ continue
+ if root.endswith("static-files"):
+ continue
+ filename = os.path.join(root, filename)
+ # ...and feed it to the link checker
+ linkChecker = Link_Checker(self, filename, base_url)
+ linkChecker.feed(open(filename, "r").read())
+ broken_links.extend(linkChecker.errors)
+ if broken_links:
+ print
+ print "The following links are broken:"
+ for broken_link in sorted(broken_links):
+ print " "+ broken_link
+
+ cleanup()
+ self.fail("%d links are broken" % len(broken_links))
+
+ cleanup()
+
+ def test_generate_docs(self):
+ test_root = get_test_root()
+ docs_root = os.path.join(test_root, "doc")
+ generate.clean_generated_docs(docs_root)
+ new_digest = self.check_generate_regenerate_cycle(test_root, INITIAL_FILESET)
+ # touching an MD file under sdk **does** cause a regenerate
+ os.utime(os.path.join(test_root, "doc", "module-source", "sdk", "aardvark-feeder.md"), None)
+ new_digest = self.check_generate_regenerate_cycle(test_root, INITIAL_FILESET, new_digest)
+ # touching a non MD file under sdk **does not** cause a regenerate
+ os.utime(os.path.join(test_root, "doc", "module-source", "sdk", "not_a_doc.js"), None)
+ self.check_generate_is_skipped(test_root, INITIAL_FILESET, new_digest)
+ # touching a non MD file under static-files **does not** cause a regenerate
+ os.utime(os.path.join(docs_root, "static-files", "another.html"), None)
+ new_digest = self.check_generate_is_skipped(test_root, INITIAL_FILESET, new_digest)
+ # touching an MD file under dev-guide **does** cause a regenerate
+ os.utime(os.path.join(docs_root, "dev-guide-source", "index.md"), None)
+ new_digest = self.check_generate_regenerate_cycle(test_root, INITIAL_FILESET, new_digest)
+ # adding a file **does** cause a regenerate
+ open(os.path.join(docs_root, "dev-guide-source", "extra.md"), "w").write("some content")
+ new_digest = self.check_generate_regenerate_cycle(test_root, EXTENDED_FILESET, new_digest)
+ # deleting a file **does** cause a regenerate
+ os.remove(os.path.join(docs_root, "dev-guide-source", "extra.md"))
+ new_digest = self.check_generate_regenerate_cycle(test_root, INITIAL_FILESET, new_digest)
+ # remove the files
+ generate.clean_generated_docs(docs_root)
+
+ def check_generate_is_skipped(self, test_root, files_to_expect, initial_digest):
+ generate.generate_docs(test_root, stdout=StringIO.StringIO())
+ docs_root = os.path.join(test_root, "doc")
+ for file_to_expect in files_to_expect:
+ self.assertTrue(os.path.exists(os.path.join(docs_root, *file_to_expect)))
+ self.assertTrue(initial_digest == open(os.path.join(docs_root, "status.md5"), "r").read())
+
+ def check_generate_regenerate_cycle(self, test_root, files_to_expect, initial_digest = None):
+ # test that if we generate, files are getting generated
+ generate.generate_docs(test_root, stdout=StringIO.StringIO())
+ docs_root = os.path.join(test_root, "doc")
+ for file_to_expect in files_to_expect:
+ self.assertTrue(os.path.exists(os.path.join(docs_root, *file_to_expect)), os.path.join(docs_root, *file_to_expect) + "not found")
+ if initial_digest:
+ self.assertTrue(initial_digest != open(os.path.join(docs_root, "status.md5"), "r").read())
+ # and that if we regenerate, nothing changes...
+ new_digest = open(os.path.join(docs_root, "status.md5"), "r").read()
+ self.check_generate_is_skipped(test_root, files_to_expect, new_digest)
+ return new_digest
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_init.py b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_init.py
new file mode 100644
index 0000000..3558048
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_init.py
@@ -0,0 +1,197 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import os, unittest, shutil
+from StringIO import StringIO
+from cuddlefish import initializer
+from cuddlefish.templates import TEST_MAIN_JS, PACKAGE_JSON
+
+tests_path = os.path.abspath(os.path.dirname(__file__))
+
+class TestInit(unittest.TestCase):
+
+ def run_init_in_subdir(self, dirname, f, *args, **kwargs):
+ top = os.path.abspath(os.getcwd())
+ basedir = os.path.abspath(os.path.join(".test_tmp",self.id(),dirname))
+ if os.path.isdir(basedir):
+ assert basedir.startswith(top)
+ shutil.rmtree(basedir)
+ os.makedirs(basedir)
+ try:
+ os.chdir(basedir)
+ return f(basedir, *args, **kwargs)
+ finally:
+ os.chdir(top)
+
+ def do_test_init(self,basedir):
+ # Let's init the addon, no error admited
+ f = open(".ignoreme","w")
+ f.write("stuff")
+ f.close()
+
+ out, err = StringIO(), StringIO()
+ init_run = initializer(None, ["init"], out, err)
+ out, err = out.getvalue(), err.getvalue()
+ self.assertEqual(init_run, 0)
+ self.assertTrue("* lib directory created" in out)
+ self.assertTrue("* data directory created" in out)
+ self.assertTrue("Have fun!" in out)
+ self.assertEqual(err,"")
+ self.assertTrue(len(os.listdir(basedir))>0)
+ main_js = os.path.join(basedir,"lib","main.js")
+ package_json = os.path.join(basedir,"package.json")
+ test_main_js = os.path.join(basedir,"test","test-main.js")
+ self.assertTrue(os.path.exists(main_js))
+ self.assertTrue(os.path.exists(package_json))
+ self.assertTrue(os.path.exists(test_main_js))
+ self.assertEqual(open(main_js,"r").read(),"")
+ self.assertEqual(open(package_json,"r").read(),
+ PACKAGE_JSON % {"name":"tmp_addon_sample",
+ "fullName": "tmp_addon_SAMPLE" })
+ self.assertEqual(open(test_main_js,"r").read(),TEST_MAIN_JS)
+
+ # Let's check that the addon is initialized
+ out, err = StringIO(), StringIO()
+ init_run = initializer(None, ["init"], out, err)
+ out, err = out.getvalue(), err.getvalue()
+ self.failIfEqual(init_run,0)
+ self.assertTrue("This command must be run in an empty directory." in err)
+
+ def test_initializer(self):
+ self.run_init_in_subdir("tmp_addon_SAMPLE",self.do_test_init)
+
+ def do_test_args(self, basedir):
+ # check that running it with spurious arguments will fail
+ out,err = StringIO(), StringIO()
+ init_run = initializer(None, ["init", "specified-dirname", "extra-arg"], out, err)
+ out, err = out.getvalue(), err.getvalue()
+ self.failIfEqual(init_run, 0)
+ self.assertTrue("Too many arguments" in err)
+
+ def test_args(self):
+ self.run_init_in_subdir("tmp_addon_sample", self.do_test_args)
+
+ def _test_existing_files(self, basedir):
+ f = open("pay_attention_to_me","w")
+ f.write("stuff")
+ f.close()
+ out,err = StringIO(), StringIO()
+ rc = initializer(None, ["init"], out, err)
+ out, err = out.getvalue(), err.getvalue()
+ self.assertEqual(rc, 1)
+ self.failUnless("This command must be run in an empty directory" in err,
+ err)
+ self.failIf(os.path.exists("lib"))
+
+ def test_existing_files(self):
+ self.run_init_in_subdir("existing_files", self._test_existing_files)
+
+ def test_init_subdir(self):
+ parent = os.path.abspath(os.path.join(".test_tmp", self.id()))
+ basedir = os.path.join(parent, "init-basedir")
+ if os.path.exists(parent):
+ shutil.rmtree(parent)
+ os.makedirs(parent)
+
+ # if the basedir exists and is not empty, init should refuse
+ os.makedirs(basedir)
+ f = open(os.path.join(basedir, "boo"), "w")
+ f.write("stuff")
+ f.close()
+ out, err = StringIO(), StringIO()
+ rc = initializer(None, ["init", basedir], out, err)
+ out, err = out.getvalue(), err.getvalue()
+ self.assertEqual(rc, 1)
+ self.assertTrue("testing if directory is empty" in out, out)
+ self.assertTrue("This command must be run in an empty directory." in err,
+ err)
+
+ # a .dotfile should be tolerated
+ os.rename(os.path.join(basedir, "boo"), os.path.join(basedir, ".phew"))
+ out, err = StringIO(), StringIO()
+ rc = initializer(None, ["init", basedir], out, err)
+ out, err = out.getvalue(), err.getvalue()
+ self.assertEqual(rc, 0)
+ self.assertTrue("* data directory created" in out, out)
+ self.assertTrue("Have fun!" in out)
+ self.assertEqual(err,"")
+ self.assertTrue(os.listdir(basedir))
+ main_js = os.path.join(basedir,"lib","main.js")
+ package_json = os.path.join(basedir,"package.json")
+ self.assertTrue(os.path.exists(main_js))
+ self.assertTrue(os.path.exists(package_json))
+ shutil.rmtree(basedir)
+
+ # init should create directories that don't exist already
+ out, err = StringIO(), StringIO()
+ rc = initializer(None, ["init", basedir], out, err)
+ out, err = out.getvalue(), err.getvalue()
+ self.assertEqual(rc, 0)
+ self.assertTrue("* data directory created" in out)
+ self.assertTrue("Have fun!" in out)
+ self.assertEqual(err,"")
+ self.assertTrue(os.listdir(basedir))
+ main_js = os.path.join(basedir,"lib","main.js")
+ package_json = os.path.join(basedir,"package.json")
+ self.assertTrue(os.path.exists(main_js))
+ self.assertTrue(os.path.exists(package_json))
+
+
+class TestCfxQuits(unittest.TestCase):
+
+ def run_cfx(self, addon_name, command):
+ old_cwd = os.getcwd()
+ addon_path = os.path.join(tests_path,
+ "addons", addon_name)
+ os.chdir(addon_path)
+ import sys
+ old_stdout = sys.stdout
+ old_stderr = sys.stderr
+ sys.stdout = out = StringIO()
+ sys.stderr = err = StringIO()
+ try:
+ import cuddlefish
+ args = list(command)
+ # Pass arguments given to cfx so that cfx can find firefox path
+ # if --binary option is given:
+ args.extend(sys.argv[1:])
+ cuddlefish.run(arguments=args)
+ except SystemExit, e:
+ if "code" in e:
+ rc = e.code
+ elif "args" in e and len(e.args)>0:
+ rc = e.args[0]
+ else:
+ rc = 0
+ finally:
+ sys.stdout = old_stdout
+ sys.stderr = old_stderr
+ os.chdir(old_cwd)
+ out.flush()
+ err.flush()
+ return rc, out.getvalue(), err.getvalue()
+
+ # this method doesn't exists in python 2.5,
+ # implements our own
+ def assertIn(self, member, container):
+ """Just like self.assertTrue(a in b), but with a nicer default message."""
+ if member not in container:
+ standardMsg = '"%s" not found in "%s"' % (member,
+ container)
+ self.fail(standardMsg)
+
+ def test_run(self):
+ rc, out, err = self.run_cfx("simplest-test", ["run"])
+ self.assertEqual(rc, 0)
+ self.assertIn("Program terminated successfully.", err)
+
+ def test_test(self):
+ rc, out, err = self.run_cfx("simplest-test", ["test"])
+ self.assertEqual(rc, 0)
+ self.assertIn("1 of 1 tests passed.", err)
+ self.assertIn("Program terminated successfully.", err)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_licenses.py b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_licenses.py
new file mode 100644
index 0000000..60b5957
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_licenses.py
@@ -0,0 +1,88 @@
+
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import unittest
+import os.path
+
+parent = os.path.dirname
+test_dir = parent(os.path.abspath(__file__))
+sdk_root = parent(parent(parent(test_dir)))
+
+def from_sdk_top(fn):
+ return os.path.abspath(os.path.join(sdk_root, fn))
+
+MPL2_URL = "http://mozilla.org/MPL/2.0/"
+
+# These files all come with their own license headers
+skip = [
+ "python-lib/cuddlefish/_version.py", # generated, public domain
+ "doc/static-files/js/jquery.js", # MIT/GPL dual
+ "examples/annotator/data/jquery-1.4.2.min.js", # MIT/GPL dual
+ "examples/reddit-panel/data/jquery-1.4.4.min.js", # MIT/GPL dual
+ "examples/library-detector/data/library-detector.js", # MIT
+ "python-lib/mozrunner/killableprocess.py", # MIT? BSDish?
+ "python-lib/mozrunner/winprocess.py", # MIT
+ "packages/api-utils/tests/test-querystring.js", # MIT
+ "packages/api-utils/lib/promise.js", # MIT
+ "packages/api-utils/tests/test-promise.js", # MIT
+ ]
+absskip = [from_sdk_top(os.path.join(*fn.split("/"))) for fn in skip]
+
+class Licenses(unittest.TestCase):
+ def test(self):
+ # Examine most SDK files to check if they've got an MPL2 license
+ # header. We exclude some files that are known to include different
+ # licenses.
+ self.missing = []
+ self.scan_file(from_sdk_top(os.path.join("python-lib", "jetpack_sdk_env.py")))
+ self.scan(os.path.join("python-lib", "cuddlefish"), [".js", ".py"],
+ skipdirs=["sdk-docs"], # test_generate.py makes this
+ )
+ self.scan(os.path.join("python-lib", "mozrunner"), [".py"])
+
+ for sdk_package in ["addon-kit", "api-utils", "test-harness"]:
+ self.scan(os.path.join("packages", sdk_package),
+ [".js", ".py", ".md"])
+ self.scan("examples", [".js", ".css", ".html", ".md"])
+ self.scan("bin", [".bat", ".ps1"])
+ for fn in [os.path.join("bin", "activate"),
+ os.path.join("bin", "cfx"),
+ os.path.join("bin", "integration-scripts", "buildbot-run-cfx-helper"),
+ os.path.join("bin", "integration-scripts", "integration-check"),
+ ]:
+ self.scan_file(from_sdk_top(fn))
+ self.scan("doc", [".js", ".css", ".md"], skipdirs=["syntaxhighlighter"])
+
+ if self.missing:
+ print
+ print "The following files are missing an MPL2 header:"
+ for fn in sorted(self.missing):
+ print " "+fn
+ self.fail("%d files are missing an MPL2 header" % len(self.missing))
+
+ def scan(self, start, extensions=[], skipdirs=[]):
+ # scan a whole subdirectory
+ start = from_sdk_top(start)
+ for root, dirs, files in os.walk(start):
+ for d in skipdirs:
+ if d in dirs:
+ dirs.remove(d)
+ for fn in files:
+ ext = os.path.splitext(fn)[1]
+ if extensions and ext not in extensions:
+ continue
+ absfn = os.path.join(root, fn)
+ if absfn in absskip:
+ continue
+ self.scan_file(absfn)
+
+ def scan_file(self, fn):
+ # scan a single file
+ if not MPL2_URL in open(fn, "r").read():
+ relfile = fn[len(sdk_root)+1:]
+ self.missing.append(relfile)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_linker.py b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_linker.py
new file mode 100755
index 0000000..792af6f
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_linker.py
@@ -0,0 +1,234 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import os.path
+import shutil
+import zipfile
+from StringIO import StringIO
+import simplejson as json
+import unittest
+import cuddlefish
+from cuddlefish import packaging, manifest
+
+def up(path, generations=1):
+ for i in range(generations):
+ path = os.path.dirname(path)
+ return path
+
+ROOT = up(os.path.abspath(__file__), 4)
+def get_linker_files_dir(name):
+ return os.path.join(up(os.path.abspath(__file__)), "linker-files", name)
+
+class Basic(unittest.TestCase):
+ def get_pkg(self, name):
+ d = get_linker_files_dir(name)
+ return packaging.get_config_in_dir(d)
+
+ def test_deps(self):
+ target_cfg = self.get_pkg("one")
+ pkg_cfg = packaging.build_config(ROOT, target_cfg)
+ deps = packaging.get_deps_for_targets(pkg_cfg, ["one"])
+ self.failUnlessEqual(deps, ["one"])
+ deps = packaging.get_deps_for_targets(pkg_cfg,
+ [target_cfg.name, "addon-sdk"])
+ self.failUnlessEqual(deps, ["addon-sdk", "one"])
+
+ def test_manifest(self):
+ target_cfg = self.get_pkg("one")
+ pkg_cfg = packaging.build_config(ROOT, target_cfg)
+ deps = packaging.get_deps_for_targets(pkg_cfg,
+ [target_cfg.name, "addon-sdk"])
+ self.failUnlessEqual(deps, ["addon-sdk", "one"])
+ # target_cfg.dependencies is not provided, so we'll search through
+ # all known packages (everything in 'deps').
+ m = manifest.build_manifest(target_cfg, pkg_cfg, deps, scan_tests=False)
+ m = m.get_harness_options_manifest()
+
+ def assertReqIs(modname, reqname, path):
+ reqs = m["one/lib/%s.js" % modname]["requirements"]
+ self.failUnlessEqual(reqs[reqname]["path"], path)
+ assertReqIs("main", "panel", "addon-sdk/lib/sdk/panel.js")
+ assertReqIs("main", "two.js", "one/lib/two.js")
+ assertReqIs("main", "./two", "one/lib/two.js")
+ assertReqIs("main", "sdk/tabs.js", "addon-sdk/lib/sdk/tabs.js")
+ assertReqIs("main", "./subdir/three", "one/lib/subdir/three.js")
+ assertReqIs("two", "main", "one/lib/main.js")
+ assertReqIs("subdir/three", "../main", "one/lib/main.js")
+
+ target_cfg.dependencies = []
+ # now, because .dependencies *is* provided, we won't search 'deps',
+ # so we'll get a link error
+ self.assertRaises(manifest.ModuleNotFoundError,
+ manifest.build_manifest,
+ target_cfg, pkg_cfg, deps, scan_tests=False)
+
+ def test_main_in_deps(self):
+ target_cfg = self.get_pkg("three")
+ package_path = [get_linker_files_dir("three-deps")]
+ pkg_cfg = packaging.build_config(ROOT, target_cfg,
+ packagepath=package_path)
+ deps = packaging.get_deps_for_targets(pkg_cfg,
+ [target_cfg.name, "addon-sdk"])
+ self.failUnlessEqual(deps, ["addon-sdk", "three"])
+ m = manifest.build_manifest(target_cfg, pkg_cfg, deps, scan_tests=False)
+ m = m.get_harness_options_manifest()
+ def assertReqIs(modname, reqname, path):
+ reqs = m["three/lib/%s.js" % modname]["requirements"]
+ self.failUnlessEqual(reqs[reqname]["path"], path)
+ assertReqIs("main", "three-a", "three-a/lib/main.js")
+ assertReqIs("main", "three-b", "three-b/lib/main.js")
+ assertReqIs("main", "three-c", "three-c/lib/main.js")
+
+ def test_relative_main_in_top(self):
+ target_cfg = self.get_pkg("five")
+ package_path = []
+ pkg_cfg = packaging.build_config(ROOT, target_cfg,
+ packagepath=package_path)
+ deps = packaging.get_deps_for_targets(pkg_cfg,
+ [target_cfg.name, "addon-sdk"])
+ self.failUnlessEqual(deps, ["addon-sdk", "five"])
+ # all we care about is that this next call doesn't raise an exception
+ m = manifest.build_manifest(target_cfg, pkg_cfg, deps, scan_tests=False)
+ m = m.get_harness_options_manifest()
+ reqs = m["five/lib/main.js"]["requirements"]
+ self.failUnlessEqual(reqs, {});
+
+ def test_unreachable_relative_main_in_top(self):
+ target_cfg = self.get_pkg("six")
+ package_path = []
+ pkg_cfg = packaging.build_config(ROOT, target_cfg,
+ packagepath=package_path)
+ deps = packaging.get_deps_for_targets(pkg_cfg,
+ [target_cfg.name, "addon-sdk"])
+ self.failUnlessEqual(deps, ["addon-sdk", "six"])
+ self.assertRaises(manifest.UnreachablePrefixError,
+ manifest.build_manifest,
+ target_cfg, pkg_cfg, deps, scan_tests=False)
+
+ def test_unreachable_in_deps(self):
+ target_cfg = self.get_pkg("four")
+ package_path = [get_linker_files_dir("four-deps")]
+ pkg_cfg = packaging.build_config(ROOT, target_cfg,
+ packagepath=package_path)
+ deps = packaging.get_deps_for_targets(pkg_cfg,
+ [target_cfg.name, "addon-sdk"])
+ self.failUnlessEqual(deps, ["addon-sdk", "four"])
+ self.assertRaises(manifest.UnreachablePrefixError,
+ manifest.build_manifest,
+ target_cfg, pkg_cfg, deps, scan_tests=False)
+
+class Contents(unittest.TestCase):
+
+ def run_in_subdir(self, dirname, f, *args, **kwargs):
+ top = os.path.abspath(os.getcwd())
+ basedir = os.path.abspath(os.path.join(".test_tmp",self.id(),dirname))
+ if os.path.isdir(basedir):
+ assert basedir.startswith(top)
+ shutil.rmtree(basedir)
+ os.makedirs(basedir)
+ try:
+ os.chdir(basedir)
+ return f(basedir, *args, **kwargs)
+ finally:
+ os.chdir(top)
+
+ def assertIn(self, what, inside_what):
+ self.failUnless(what in inside_what, inside_what)
+
+ def test_jetpackID(self):
+ # this uses "id": "jid7", to which a @jetpack should be appended
+ seven = get_linker_files_dir("seven")
+ def _test(basedir):
+ stdout = StringIO()
+ shutil.copytree(seven, "seven")
+ os.chdir("seven")
+ try:
+ # regrettably, run() always finishes with sys.exit()
+ cuddlefish.run(["xpi", "--no-strip-xpi"],
+ stdout=stdout)
+ except SystemExit, e:
+ self.failUnlessEqual(e.args[0], 0)
+ zf = zipfile.ZipFile("seven.xpi", "r")
+ hopts = json.loads(zf.read("harness-options.json"))
+ self.failUnlessEqual(hopts["jetpackID"], "jid7@jetpack")
+ self.run_in_subdir("x", _test)
+
+ def test_jetpackID_suffix(self):
+ # this uses "id": "jid1@jetpack", so no suffix should be appended
+ one = get_linker_files_dir("one")
+ def _test(basedir):
+ stdout = StringIO()
+ shutil.copytree(one, "one")
+ os.chdir("one")
+ try:
+ # regrettably, run() always finishes with sys.exit()
+ cuddlefish.run(["xpi", "--no-strip-xpi"],
+ stdout=stdout)
+ except SystemExit, e:
+ self.failUnlessEqual(e.args[0], 0)
+ zf = zipfile.ZipFile("one.xpi", "r")
+ hopts = json.loads(zf.read("harness-options.json"))
+ self.failUnlessEqual(hopts["jetpackID"], "jid1@jetpack")
+ self.run_in_subdir("x", _test)
+
+ def test_strip_default(self):
+ seven = get_linker_files_dir("seven")
+ # now run 'cfx xpi' in that directory, except put the generated .xpi
+ # elsewhere
+ def _test(basedir):
+ stdout = StringIO()
+ shutil.copytree(seven, "seven")
+ os.chdir("seven")
+ try:
+ # regrettably, run() always finishes with sys.exit()
+ cuddlefish.run(["xpi"], # --strip-xpi is now the default
+ stdout=stdout)
+ except SystemExit, e:
+ self.failUnlessEqual(e.args[0], 0)
+ zf = zipfile.ZipFile("seven.xpi", "r")
+ names = zf.namelist()
+ # the first problem found in bug 664840 was that cuddlefish.js
+ # (the loader) was stripped out on windows, due to a /-vs-\ bug
+ self.assertIn("resources/addon-sdk/lib/sdk/loader/cuddlefish.js", names)
+ # the second problem found in bug 664840 was that an addon
+ # without an explicit tests/ directory would copy all files from
+ # the package into a bogus JID-PKGNAME-tests/ directory, so check
+ # for that
+ testfiles = [fn for fn in names if "seven/tests" in fn]
+ self.failUnlessEqual([], testfiles)
+ # the third problem was that data files were being stripped from
+ # the XPI. Note that data/ is only supposed to be included if a
+ # module that actually gets used does a require("self") .
+ self.assertIn("resources/seven/data/text.data",
+ names)
+ self.failIf("seven/lib/unused.js"
+ in names, names)
+ self.run_in_subdir("x", _test)
+
+ def test_no_strip(self):
+ seven = get_linker_files_dir("seven")
+ def _test(basedir):
+ stdout = StringIO()
+ shutil.copytree(seven, "seven")
+ os.chdir("seven")
+ try:
+ # regrettably, run() always finishes with sys.exit()
+ cuddlefish.run(["xpi", "--no-strip-xpi"],
+ stdout=stdout)
+ except SystemExit, e:
+ self.failUnlessEqual(e.args[0], 0)
+ zf = zipfile.ZipFile("seven.xpi", "r")
+ names = zf.namelist()
+ self.assertIn("resources/addon-sdk/lib/sdk/loader/cuddlefish.js", names)
+ testfiles = [fn for fn in names if "seven/tests" in fn]
+ self.failUnlessEqual([], testfiles)
+ self.assertIn("resources/seven/data/text.data",
+ names)
+ self.failUnless("resources/seven/lib/unused.js"
+ in names, names)
+ self.run_in_subdir("x", _test)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_manifest.py b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_manifest.py
new file mode 100644
index 0000000..1bced12
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_manifest.py
@@ -0,0 +1,257 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+
+import unittest
+from StringIO import StringIO
+from cuddlefish.manifest import scan_module
+
+class Extra:
+ def failUnlessKeysAre(self, d, keys):
+ self.failUnlessEqual(sorted(d.keys()), sorted(keys))
+
+class Require(unittest.TestCase, Extra):
+ def scan(self, text):
+ lines = StringIO(text).readlines()
+ requires, problems, locations = scan_module("fake.js", lines)
+ self.failUnlessEqual(problems, False)
+ return requires
+
+ def scan_locations(self, text):
+ lines = StringIO(text).readlines()
+ requires, problems, locations = scan_module("fake.js", lines)
+ self.failUnlessEqual(problems, False)
+ return requires, locations
+
+ def test_modules(self):
+ mod = """var foo = require('one');"""
+ requires = self.scan(mod)
+ self.failUnlessKeysAre(requires, ["one"])
+
+ mod = """var foo = require(\"one\");"""
+ requires = self.scan(mod)
+ self.failUnlessKeysAre(requires, ["one"])
+
+ mod = """var foo=require( 'one' ) ; """
+ requires = self.scan(mod)
+ self.failUnlessKeysAre(requires, ["one"])
+
+ mod = """var foo = require('o'+'ne'); // tricky, denied"""
+ requires = self.scan(mod)
+ self.failUnlessKeysAre(requires, [])
+
+ mod = """require('one').immediately.do().stuff();"""
+ requires, locations = self.scan_locations(mod)
+ self.failUnlessKeysAre(requires, ["one"])
+ self.failUnlessEqual(locations, {"one": 1})
+
+ # these forms are commented out, and thus ignored
+
+ mod = """// var foo = require('one');"""
+ requires = self.scan(mod)
+ self.failUnlessKeysAre(requires, [])
+
+ mod = """/* var foo = require('one');"""
+ requires = self.scan(mod)
+ self.failUnlessKeysAre(requires, [])
+
+ mod = """ * var foo = require('one');"""
+ requires = self.scan(mod)
+ self.failUnlessKeysAre(requires, [])
+
+ mod = """ ' var foo = require('one');"""
+ requires = self.scan(mod)
+ self.failUnlessKeysAre(requires, ["one"])
+
+ mod = """ \" var foo = require('one');"""
+ requires = self.scan(mod)
+ self.failUnlessKeysAre(requires, ["one"])
+
+ # multiple requires
+
+ mod = """const foo = require('one');
+ const foo = require('two');"""
+ requires, locations = self.scan_locations(mod)
+ self.failUnlessKeysAre(requires, ["one", "two"])
+ self.failUnlessEqual(locations["one"], 1)
+ self.failUnlessEqual(locations["two"], 2)
+
+ mod = """const foo = require('repeated');
+ const bar = require('repeated');
+ const baz = require('repeated');"""
+ requires, locations = self.scan_locations(mod)
+ self.failUnlessKeysAre(requires, ["repeated"])
+ self.failUnlessEqual(locations["repeated"], 1) # first occurrence
+
+ mod = """const foo = require('one'); const foo = require('two');"""
+ requires = self.scan(mod)
+ self.failUnlessKeysAre(requires, ["one", "two"])
+
+ # define calls
+
+ mod = """define('one', ['two', 'numbers/three'], function(t, th) {});"""
+ requires = self.scan(mod)
+ self.failUnlessKeysAre(requires, ["two", "numbers/three"])
+
+ mod = """define(
+ ['odd',
+ "numbers/four"], function() {});"""
+ requires = self.scan(mod)
+ self.failUnlessKeysAre(requires, ["odd", "numbers/four"])
+
+ mod = """define(function(require, exports, module) {
+ var a = require("some/module/a"),
+ b = require('b/v1');
+ exports.a = a;
+ //This is a fakeout: require('bad');
+ /* And another var bad = require('bad2'); */
+ require('foo').goFoo();
+ });"""
+ requires = self.scan(mod)
+ self.failUnlessKeysAre(requires, ["some/module/a", "b/v1", "foo"])
+
+ mod = """define (
+ "foo",
+ ["bar"], function (bar) {
+ var me = require("me");
+ }
+ )"""
+ requires = self.scan(mod)
+ self.failUnlessKeysAre(requires, ["bar", "me"])
+
+ mod = """define(['se' + 'ven', 'eight', nine], function () {});"""
+ requires = self.scan(mod)
+ self.failUnlessKeysAre(requires, ["eight"])
+
+ # async require calls
+
+ mod = """require(['one'], function(one) {var o = require("one");});"""
+ requires = self.scan(mod)
+ self.failUnlessKeysAre(requires, ["one"])
+
+ mod = """require([ 'one' ], function(one) {var t = require("two");});"""
+ requires = self.scan(mod)
+ self.failUnlessKeysAre(requires, ["one", "two"])
+
+ mod = """require ( ['two', 'numbers/three'], function(t, th) {});"""
+ requires = self.scan(mod)
+ self.failUnlessKeysAre(requires, ["two", "numbers/three"])
+
+ mod = """require (
+ ["bar", "fa" + 'ke' ], function (bar) {
+ var me = require("me");
+ // require("bad").doBad();
+ }
+ )"""
+ requires = self.scan(mod)
+ self.failUnlessKeysAre(requires, ["bar", "me"])
+
+def scan2(text, fn="fake.js"):
+ stderr = StringIO()
+ lines = StringIO(text).readlines()
+ requires, problems, locations = scan_module(fn, lines, stderr)
+ stderr.seek(0)
+ return requires, problems, stderr.readlines()
+
+class Chrome(unittest.TestCase, Extra):
+
+ def test_ignore_loader(self):
+ # we specifically ignore the loader itself
+ mod = """let {Cc,Ci} = require('chrome');"""
+ requires, problems, err = scan2(mod, "blah/cuddlefish.js")
+ self.failUnlessKeysAre(requires, ["chrome"])
+ self.failUnlessEqual(problems, False)
+ self.failUnlessEqual(err, [])
+
+ def test_chrome(self):
+ mod = """let {Cc,Ci} = require('chrome');"""
+ requires, problems, err = scan2(mod)
+ self.failUnlessKeysAre(requires, ["chrome"])
+ self.failUnlessEqual(problems, False)
+ self.failUnlessEqual(err, [])
+
+ mod = """var foo = require('foo');
+ let {Cc,Ci} = require('chrome');"""
+ requires, problems, err = scan2(mod)
+ self.failUnlessKeysAre(requires, ["foo", "chrome"])
+ self.failUnlessEqual(problems, False)
+ self.failUnlessEqual(err, [])
+
+ mod = """let c = require('chrome');"""
+ requires, problems, err = scan2(mod)
+ self.failUnlessKeysAre(requires, ["chrome"])
+ self.failUnlessEqual(problems, False)
+ self.failUnlessEqual(err, [])
+
+ mod = """var foo = require('foo');
+ let c = require('chrome');"""
+ requires, problems, err = scan2(mod)
+ self.failUnlessKeysAre(requires, ["foo", "chrome"])
+ self.failUnlessEqual(problems, False)
+ self.failUnlessEqual(err, [])
+
+ def test_not_chrome(self):
+ # from bug 596595
+ mod = r'soughtLines: new RegExp("^\\s*(\\[[0-9 .]*\\])?\\s*\\(\\((EE|WW)\\)|.* [Cc]hipsets?: \\)|\\s*Backtrace")'
+ requires, problems, err = scan2(mod)
+ self.failUnlessKeysAre(requires, [])
+ self.failUnlessEqual((problems,err), (False, []))
+
+ def test_not_chrome2(self):
+ # from bug 655788
+ mod = r"var foo = 'some stuff Cr';"
+ requires, problems, err = scan2(mod)
+ self.failUnlessKeysAre(requires, [])
+ self.failUnlessEqual((problems,err), (False, []))
+
+class BadChrome(unittest.TestCase, Extra):
+ def test_bad_alias(self):
+ # using Components.* gets you an error, with a message that teaches
+ # you the correct approach.
+ mod = """let Cc = Components.classes;
+ let Cu = Components.utils;
+ """
+ requires, problems, err = scan2(mod)
+ self.failUnlessKeysAre(requires, [])
+ self.failUnlessEqual(problems, True)
+ self.failUnlessEqual(err[1], "The following lines from file fake.js:\n")
+ self.failUnlessEqual(err[2], " 1: let Cc = Components.classes;\n")
+ self.failUnlessEqual(err[3], " 2: let Cu = Components.utils;\n")
+ self.failUnlessEqual(err[4], "use 'Components' to access chrome authority. To do so, you need to add a\n")
+ self.failUnlessEqual(err[5], "line somewhat like the following:\n")
+ self.failUnlessEqual(err[7], ' const {Cc,Cu} = require("chrome");\n')
+ self.failUnlessEqual(err[9], "Then you can use any shortcuts to its properties that you import from the\n")
+
+ def test_bad_misc(self):
+ # If it looks like you're using something that doesn't have an alias,
+ # the warning also suggests a better way.
+ mod = """if (Components.isSuccessCode(foo))
+ """
+ requires, problems, err = scan2(mod)
+ self.failUnlessKeysAre(requires, [])
+ self.failUnlessEqual(problems, True)
+ self.failUnlessEqual(err[1], "The following lines from file fake.js:\n")
+ self.failUnlessEqual(err[2], " 1: if (Components.isSuccessCode(foo))\n")
+ self.failUnlessEqual(err[3], "use 'Components' to access chrome authority. To do so, you need to add a\n")
+ self.failUnlessEqual(err[4], "line somewhat like the following:\n")
+ self.failUnlessEqual(err[6], ' const {components} = require("chrome");\n')
+ self.failUnlessEqual(err[8], "Then you can use any shortcuts to its properties that you import from the\n")
+
+ def test_chrome_components(self):
+ # Bug 636145/774636: We no longer tolerate usages of "Components",
+ # even when adding `require("chrome")` to your module.
+ mod = """require("chrome");
+ var ios = Components.classes['@mozilla.org/network/io-service;1'];"""
+ requires, problems, err = scan2(mod)
+ self.failUnlessKeysAre(requires, ["chrome"])
+ self.failUnlessEqual(problems, True)
+ self.failUnlessEqual(err[1], "The following lines from file fake.js:\n")
+ self.failUnlessEqual(err[2], " 2: var ios = Components.classes['@mozilla.org/network/io-service;1'];\n")
+ self.failUnlessEqual(err[3], "use 'Components' to access chrome authority. To do so, you need to add a\n")
+ self.failUnlessEqual(err[4], "line somewhat like the following:\n")
+ self.failUnlessEqual(err[6], ' const {Cc} = require("chrome");\n')
+ self.failUnlessEqual(err[8], "Then you can use any shortcuts to its properties that you import from the\n")
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_packaging.py b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_packaging.py
new file mode 100644
index 0000000..ccd2812
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_packaging.py
@@ -0,0 +1,116 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import os
+import unittest
+
+from cuddlefish import packaging
+from cuddlefish.bunch import Bunch
+
+tests_path = os.path.abspath(os.path.dirname(__file__))
+static_files_path = os.path.join(tests_path, 'static-files')
+
+def get_configs(pkg_name, dirname='static-files'):
+ root_path = os.path.join(tests_path, dirname)
+ pkg_path = os.path.join(root_path, 'packages', pkg_name)
+ if not (os.path.exists(pkg_path) and os.path.isdir(pkg_path)):
+ raise Exception('path does not exist: %s' % pkg_path)
+ target_cfg = packaging.get_config_in_dir(pkg_path)
+ pkg_cfg = packaging.build_config(root_path, target_cfg)
+ deps = packaging.get_deps_for_targets(pkg_cfg, [pkg_name])
+ build = packaging.generate_build_for_target(
+ pkg_cfg=pkg_cfg,
+ target=pkg_name,
+ deps=deps
+ )
+ return Bunch(target_cfg=target_cfg, pkg_cfg=pkg_cfg, build=build)
+
+class PackagingTests(unittest.TestCase):
+ def test_bug_588661(self):
+ configs = get_configs('foo', 'bug-588661-files')
+ self.assertEqual(configs.build.loader,
+ 'foo/lib/foo-loader.js')
+
+ def test_bug_614712(self):
+ configs = get_configs('commonjs-naming', 'bug-614712-files')
+ packages = configs.pkg_cfg.packages
+ base = os.path.join(tests_path, 'bug-614712-files', 'packages')
+ self.assertEqual(packages['original-naming'].tests,
+ [os.path.join(base, 'original-naming', 'tests')])
+ self.assertEqual(packages['commonjs-naming'].tests,
+ [os.path.join(base, 'commonjs-naming', 'test')])
+
+ def test_basic(self):
+ configs = get_configs('aardvark')
+ packages = configs.pkg_cfg.packages
+
+ self.assertTrue('addon-sdk' in packages)
+ self.assertTrue('aardvark' in packages)
+ self.assertTrue('addon-sdk' in packages.aardvark.dependencies)
+ self.assertEqual(packages['addon-sdk'].loader, 'lib/sdk/loader/cuddlefish.js')
+ self.assertTrue(packages.aardvark.main == 'main')
+ self.assertTrue(packages.aardvark.version == "1.0")
+
+class PackagePath(unittest.TestCase):
+ def test_packagepath(self):
+ root_path = os.path.join(tests_path, 'static-files')
+ pkg_path = os.path.join(root_path, 'packages', 'minimal')
+ target_cfg = packaging.get_config_in_dir(pkg_path)
+ pkg_cfg = packaging.build_config(root_path, target_cfg)
+ base_packages = set(pkg_cfg.packages.keys())
+ ppath = [os.path.join(tests_path, 'bug-611495-files')]
+ pkg_cfg2 = packaging.build_config(root_path, target_cfg, packagepath=ppath)
+ all_packages = set(pkg_cfg2.packages.keys())
+ self.assertEqual(sorted(["jspath-one"]),
+ sorted(all_packages - base_packages))
+
+class Directories(unittest.TestCase):
+ # for bug 652227
+ packages_path = os.path.join(tests_path, "bug-652227-files", "packages")
+ def get_config(self, pkg_name):
+ pkg_path = os.path.join(tests_path, "bug-652227-files", "packages",
+ pkg_name)
+ return packaging.get_config_in_dir(pkg_path)
+
+ def test_explicit_lib(self):
+ # package.json provides .lib
+ p = self.get_config('explicit-lib')
+ self.assertEqual(os.path.abspath(p.lib[0]),
+ os.path.abspath(os.path.join(self.packages_path,
+ "explicit-lib",
+ "alt2-lib")))
+
+ def test_directories_lib(self):
+ # package.json provides .directories.lib
+ p = self.get_config('explicit-dir-lib')
+ self.assertEqual(os.path.abspath(p.lib[0]),
+ os.path.abspath(os.path.join(self.packages_path,
+ "explicit-dir-lib",
+ "alt-lib")))
+
+ def test_lib(self):
+ # package.json is empty, but lib/ exists
+ p = self.get_config("default-lib")
+ self.assertEqual(os.path.abspath(p.lib[0]),
+ os.path.abspath(os.path.join(self.packages_path,
+ "default-lib",
+ "lib")))
+
+ def test_root(self):
+ # package.json is empty, no lib/, so files are in root
+ p = self.get_config('default-root')
+ self.assertEqual(os.path.abspath(p.lib[0]),
+ os.path.abspath(os.path.join(self.packages_path,
+ "default-root")))
+
+ def test_locale(self):
+ # package.json is empty, but locale/ exists and should be used
+ p = self.get_config("default-locale")
+ self.assertEqual(os.path.abspath(p.locale),
+ os.path.abspath(os.path.join(self.packages_path,
+ "default-locale",
+ "locale")))
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_preflight.py b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_preflight.py
new file mode 100644
index 0000000..571b791
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_preflight.py
@@ -0,0 +1,147 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+
+import os, shutil
+import simplejson as json
+import unittest
+import hashlib
+import base64
+from cuddlefish import preflight
+from StringIO import StringIO
+
+class Util(unittest.TestCase):
+ def get_basedir(self):
+ return os.path.join(".test_tmp", self.id())
+ def make_basedir(self):
+ basedir = self.get_basedir()
+ if os.path.isdir(basedir):
+ here = os.path.abspath(os.getcwd())
+ assert os.path.abspath(basedir).startswith(here) # safety
+ shutil.rmtree(basedir)
+ os.makedirs(basedir)
+ return basedir
+
+ def test_base62(self):
+ for i in range(1000):
+ h = hashlib.sha1(str(i)).digest()
+ s1 = base64.b64encode(h, "AB").strip("=")
+ s2 = base64.b64encode(h).strip("=").replace("+","A").replace("/","B")
+ self.failUnlessEqual(s1, s2)
+
+ def write(self, config):
+ basedir = self.get_basedir()
+ fn = os.path.join(basedir, "package.json")
+ open(fn,"w").write(config)
+ def read(self):
+ basedir = self.get_basedir()
+ fn = os.path.join(basedir, "package.json")
+ return open(fn,"r").read()
+
+ def get_cfg(self):
+ cfg = json.loads(self.read())
+ if "name" not in cfg:
+ # the cfx parser always provides a name, even if package.json
+ # doesn't contain one
+ cfg["name"] = "pretend name"
+ return cfg
+
+ def parse(self, keydata):
+ fields = {}
+ fieldnames = []
+ for line in keydata.split("\n"):
+ if line.strip():
+ k,v = line.split(":", 1)
+ k = k.strip() ; v = v.strip()
+ fields[k] = v
+ fieldnames.append(k)
+ return fields, fieldnames
+
+ def test_preflight(self):
+ basedir = self.make_basedir()
+ fn = os.path.join(basedir, "package.json")
+
+ # empty config is not ok: need id (name is automatically supplied)
+ config_orig = "{}"
+ self.write(config_orig)
+ out = StringIO()
+ cfg = self.get_cfg()
+ config_was_ok, modified = preflight.preflight_config(cfg, fn,
+ stderr=out)
+ self.failUnlessEqual(config_was_ok, False)
+ self.failUnlessEqual(modified, True)
+ backup_fn = os.path.join(basedir, "package.json.backup")
+ config_backup = open(backup_fn,"r").read()
+ self.failUnlessEqual(config_backup, config_orig)
+ config = json.loads(self.read())
+ self.failIf("name" in config)
+ self.failUnless("id" in config)
+ self.failUnless(config["id"].startswith("jid1-"), config["id"])
+ self.failUnlessEqual(out.getvalue().strip(),
+ "No 'id' in package.json: creating a new ID for you.")
+ os.unlink(backup_fn)
+
+ # just a name? we add the id
+ config_orig = '{"name": "my-awesome-package"}'
+ self.write(config_orig)
+ out = StringIO()
+ cfg = self.get_cfg()
+ config_was_ok, modified = preflight.preflight_config(cfg, fn,
+ stderr=out)
+ self.failUnlessEqual(config_was_ok, False)
+ self.failUnlessEqual(modified, True)
+ backup_fn = os.path.join(basedir, "package.json.backup")
+ config_backup = open(backup_fn,"r").read()
+ self.failUnlessEqual(config_backup, config_orig)
+ config = json.loads(self.read())
+ self.failUnlessEqual(config["name"], "my-awesome-package")
+ self.failUnless("id" in config)
+ self.failUnless(config["id"].startswith("jid1-"), config["id"])
+ jid = str(config["id"])
+ self.failUnlessEqual(out.getvalue().strip(),
+ "No 'id' in package.json: creating a new ID for you.")
+ os.unlink(backup_fn)
+
+ # name and valid id? great! ship it!
+ config2 = '{"name": "my-awesome-package", "id": "%s"}' % jid
+ self.write(config2)
+ out = StringIO()
+ cfg = self.get_cfg()
+ config_was_ok, modified = preflight.preflight_config(cfg, fn,
+ stderr=out)
+ self.failUnlessEqual(config_was_ok, True)
+ self.failUnlessEqual(modified, False)
+ config2a = self.read()
+ self.failUnlessEqual(config2a, config2)
+ self.failUnlessEqual(out.getvalue().strip(), "")
+
+ # name and anonymous ID? without asking to see its papers, ship it
+ config3 = '{"name": "my-old-skool-package", "id": "anonid0-deadbeef"}'
+ self.write(config3)
+ out = StringIO()
+ cfg = self.get_cfg()
+ config_was_ok, modified = preflight.preflight_config(cfg, fn,
+ stderr=out)
+ self.failUnlessEqual(config_was_ok, True)
+ self.failUnlessEqual(modified, False)
+ config3a = self.read()
+ self.failUnlessEqual(config3a, config3)
+ self.failUnlessEqual(out.getvalue().strip(), "")
+
+ # name and old-style ID? with nostalgic trepidation, ship it
+ config4 = '{"name": "my-old-skool-package", "id": "foo@bar.baz"}'
+ self.write(config4)
+ out = StringIO()
+ cfg = self.get_cfg()
+ config_was_ok, modified = preflight.preflight_config(cfg, fn,
+ stderr=out)
+ self.failUnlessEqual(config_was_ok, True)
+ self.failUnlessEqual(modified, False)
+ config4a = self.read()
+ self.failUnlessEqual(config4a, config4)
+ self.failUnlessEqual(out.getvalue().strip(), "")
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_property_parser.py b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_property_parser.py
new file mode 100644
index 0000000..4988f8e
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_property_parser.py
@@ -0,0 +1,93 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import unittest
+
+from cuddlefish.property_parser import parse, MalformedLocaleFileError
+
+class TestParser(unittest.TestCase):
+
+ def test_parse(self):
+ lines = [
+ # Comments are striped only if `#` is the first non-space character
+ "sharp=#can be in value",
+ "# comment",
+ "#key=value",
+ " # comment2",
+
+ "keyWithNoValue=",
+ "valueWithSpaces= ",
+ "valueWithMultilineSpaces= \\",
+ " \\",
+ " ",
+
+ # All spaces before/after are striped
+ " key = value ",
+ "key2=value2",
+ # Keys can contain '%'
+ "%s key=%s value",
+
+ # Accept empty lines
+ "",
+ " ",
+
+ # Multiline string must use backslash at end of lines
+ "multi=line\\", "value",
+ # With multiline string, left spaces are stripped ...
+ "some= spaces\\", " are\\ ", " stripped ",
+ # ... but not right spaces, except the last line!
+ "but=not \\", "all of \\", " them ",
+
+ # Explicit [other] plural definition
+ "explicitPlural[one] = one",
+ "explicitPlural[other] = other",
+
+ # Implicit [other] plural definition
+ "implicitPlural[one] = one",
+ "implicitPlural = other", # This key is the [other] one
+ ]
+ # Ensure that all lines end with a `\n`
+ # And that strings are unicode ones (parser code relies on it)
+ lines = [unicode(l + "\n") for l in lines]
+ pairs = parse(lines)
+ expected = {
+ "sharp": "#can be in value",
+
+ "key": "value",
+ "key2": "value2",
+ "%s key": "%s value",
+
+ "keyWithNoValue": "",
+ "valueWithSpaces": "",
+ "valueWithMultilineSpaces": "",
+
+ "multi": "linevalue",
+ "some": "spacesarestripped",
+ "but": "not all of them",
+
+ "implicitPlural": {
+ "one": "one",
+ "other": "other"
+ },
+ "explicitPlural": {
+ "one": "one",
+ "other": "other"
+ },
+ }
+ self.assertEqual(pairs, expected)
+
+ def test_exceptions(self):
+ self.failUnlessRaises(MalformedLocaleFileError, parse,
+ ["invalid line with no key value"])
+ self.failUnlessRaises(MalformedLocaleFileError, parse,
+ ["plural[one]=plural with no [other] value"])
+ self.failUnlessRaises(MalformedLocaleFileError, parse,
+ ["multiline with no last empty line=\\"])
+ self.failUnlessRaises(MalformedLocaleFileError, parse,
+ ["=no key"])
+ self.failUnlessRaises(MalformedLocaleFileError, parse,
+ [" =only spaces in key"])
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_rdf.py b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_rdf.py
new file mode 100644
index 0000000..67b486c
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_rdf.py
@@ -0,0 +1,45 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import unittest
+import xml.dom.minidom
+import os.path
+
+from cuddlefish import rdf, packaging
+
+parent = os.path.dirname
+test_dir = parent(os.path.abspath(__file__))
+template_dir = os.path.join(parent(test_dir), "../../app-extension")
+
+class RDFTests(unittest.TestCase):
+ def testBug567660(self):
+ obj = rdf.RDF()
+ data = u'\u2026'.encode('utf-8')
+ x = '<?xml version="1.0" encoding="utf-8"?><blah>%s</blah>' % data
+ obj.dom = xml.dom.minidom.parseString(x)
+ self.assertEqual(obj.dom.documentElement.firstChild.nodeValue,
+ u'\u2026')
+ self.assertEqual(str(obj).replace("\n",""), x.replace("\n",""))
+
+ def failUnlessIn(self, substring, s, msg=""):
+ if substring not in s:
+ self.fail("(%s) substring '%s' not in string '%s'"
+ % (msg, substring, s))
+
+ def testUnpack(self):
+ basedir = os.path.join(test_dir, "bug-715340-files")
+ for n in ["pkg-1-pack", "pkg-2-unpack", "pkg-3-pack"]:
+ cfg = packaging.get_config_in_dir(os.path.join(basedir, n))
+ m = rdf.gen_manifest(template_dir, cfg, jid="JID")
+ if n.endswith("-pack"):
+ # these ones should remain packed
+ self.failUnlessEqual(m.get("em:unpack"), "false")
+ self.failUnlessIn("<em:unpack>false</em:unpack>", str(m), n)
+ else:
+ # and these should be unpacked
+ self.failUnlessEqual(m.get("em:unpack"), "true")
+ self.failUnlessIn("<em:unpack>true</em:unpack>", str(m), n)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_runner.py b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_runner.py
new file mode 100644
index 0000000..26583ab
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_runner.py
@@ -0,0 +1,27 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+
+def xulrunner_app_runner_doctests():
+ """
+ >>> import sys
+ >>> from cuddlefish import runner
+ >>> runner.XulrunnerAppRunner(binary='foo')
+ Traceback (most recent call last):
+ ...
+ Exception: Binary path does not exist foo
+
+ >>> runner.XulrunnerAppRunner(binary=sys.executable)
+ Traceback (most recent call last):
+ ...
+ ValueError: application.ini not found in cmdargs
+
+ >>> runner.XulrunnerAppRunner(binary=sys.executable,
+ ... cmdargs=['application.ini'])
+ Traceback (most recent call last):
+ ...
+ ValueError: file does not exist: 'application.ini'
+ """
+
+ pass
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_util.py b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_util.py
new file mode 100644
index 0000000..aa636a4
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_util.py
@@ -0,0 +1,22 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+
+import unittest
+from cuddlefish.manifest import filter_filenames, filter_dirnames
+
+class Filter(unittest.TestCase):
+ def test_filter_filenames(self):
+ names = ["foo", "bar.js", "image.png",
+ ".hidden", "foo~", ".foo.swp", "bar.js.swp"]
+ self.failUnlessEqual(sorted(filter_filenames(names)),
+ sorted(["foo", "bar.js", "image.png"]))
+
+ def test_filter_dirnames(self):
+ names = ["subdir", "data", ".git", ".hg", ".svn", "defaults"]
+ self.failUnlessEqual(sorted(filter_dirnames(names)),
+ sorted(["subdir", "data", "defaults"]))
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_version.py b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_version.py
new file mode 100644
index 0000000..814c57c
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_version.py
@@ -0,0 +1,28 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import os
+import unittest
+import shutil
+
+from cuddlefish._version import get_versions
+
+class Version(unittest.TestCase):
+ def get_basedir(self):
+ return os.path.join(".test_tmp", self.id())
+ def make_basedir(self):
+ basedir = self.get_basedir()
+ if os.path.isdir(basedir):
+ here = os.path.abspath(os.getcwd())
+ assert os.path.abspath(basedir).startswith(here) # safety
+ shutil.rmtree(basedir)
+ os.makedirs(basedir)
+ return basedir
+
+ def test_current_version(self):
+ # the SDK should be able to determine its own version. We don't care
+ # what it is, merely that it can be computed.
+ version = get_versions()["version"]
+ self.failUnless(isinstance(version, str), (version, type(version)))
+ self.failUnless(len(version) > 0, version)
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_webdocs.py b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_webdocs.py
new file mode 100644
index 0000000..7653bea
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_webdocs.py
@@ -0,0 +1,78 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import os
+import unittest
+
+from cuddlefish.docs import webdocs
+
+class WebDocTests(unittest.TestCase):
+
+ def test_create_guide1_doc(self):
+ root = os.path.join(os.getcwd() + \
+ '/python-lib/cuddlefish/tests/static-files')
+ web_docs = webdocs.WebDocs(root)
+ guide = web_docs.create_guide_page(os.path.join(\
+ root + '/doc/dev-guide-source/index.md'))
+ self._test_common_contents(guide)
+ self.assertTrue(\
+ '<title>An Imposing Title - Add-on SDK Documentation</title>'\
+ in guide)
+ self.assertTrue('<p><em>Some words!</em></p>'\
+ in guide)
+ self.assertTrue('<div id="version">Version '\
+ in guide)
+
+ def test_create_guide2_doc(self):
+ root = os.path.join(os.getcwd() + \
+ '/python-lib/cuddlefish/tests/static-files')
+ web_docs = webdocs.WebDocs(root)
+ guide = web_docs.create_guide_page(os.path.join(\
+ root + '/doc/dev-guide-source/no_h1.md'))
+ self._test_common_contents(guide)
+ self.assertTrue('<title>Add-on SDK Documentation</title>'\
+ in guide)
+ self.assertTrue('<h2>A heading</h2>'\
+ in guide)
+
+ def test_create_module_doc(self):
+ root = os.path.join(os.getcwd() + \
+ '/python-lib/cuddlefish/tests/static-files')
+ web_docs = webdocs.WebDocs(root)
+ module = web_docs.create_module_page(os.path.join(\
+ root + '/doc/module-source/sdk/aardvark-feeder.md'))
+ self._test_common_contents(module)
+ self.assertTrue(\
+ '<title>aardvark-feeder - Add-on SDK Documentation</title>'\
+ in module)
+ self.assertTrue(\
+ '<h1>aardvark-feeder</h1>'\
+ in module)
+ self.assertTrue(\
+ '<div class="module_description">'\
+ in module)
+ self.assertTrue(\
+ '<p>The <code>aardvark-feeder</code> module simplifies feeding aardvarks.</p>'\
+ in module)
+ self.assertTrue(\
+ '<h2 class="api_header">API Reference</h2>'\
+ in module)
+ self.assertTrue(\
+ '<h3 class="api_header">Functions</h3>'\
+ in module)
+ self.assertTrue(\
+ '<h4 class="api_name">feed(food)</h4>'\
+ in module)
+ self.assertTrue(
+ '<p>Feed the aardvark.</p>'\
+ in module)
+
+ def _test_common_contents(self, doc):
+ self.assertTrue(\
+ '<a href="modules/sdk/anteater/anteater.html">anteater/anteater</a>' in doc)
+ self.assertTrue(\
+ '<a href="modules/sdk/aardvark-feeder.html">aardvark-feeder</a>' in doc)
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_xpi.py b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_xpi.py
new file mode 100644
index 0000000..ec5eaa3
--- /dev/null
+++ b/tools/addon-sdk-1.12/python-lib/cuddlefish/tests/test_xpi.py
@@ -0,0 +1,469 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import os
+import unittest
+import zipfile
+import pprint
+import shutil
+
+import simplejson as json
+from cuddlefish import xpi, packaging, manifest, buildJID
+from cuddlefish.tests import test_packaging
+from test_linker import up
+
+import xml.etree.ElementTree as ElementTree
+
+xpi_template_path = os.path.join(test_packaging.static_files_path,
+ 'xpi-template')
+
+fake_manifest = '<RDF><!-- Extension metadata is here. --></RDF>'
+
+class PrefsTests(unittest.TestCase):
+ def makexpi(self, pkg_name):
+ self.xpiname = "%s.xpi" % pkg_name
+ create_xpi(self.xpiname, pkg_name, 'preferences-files')
+ self.xpi = zipfile.ZipFile(self.xpiname, 'r')
+ options = self.xpi.read('harness-options.json')
+ self.xpi_harness_options = json.loads(options)
+
+ def setUp(self):
+ self.xpiname = None
+ self.xpi = None
+
+ def tearDown(self):
+ if self.xpi:
+ self.xpi.close()
+ if self.xpiname and os.path.exists(self.xpiname):
+ os.remove(self.xpiname)
+
+ def testPackageWithSimplePrefs(self):
+ self.makexpi('simple-prefs')
+ self.failUnless('options.xul' in self.xpi.namelist())
+ optsxul = self.xpi.read('options.xul').decode("utf-8")
+ self.failUnlessEqual(self.xpi_harness_options["jetpackID"],
+ "jid1-fZHqN9JfrDBa8A@jetpack")
+
+ root = ElementTree.XML(optsxul.encode('utf-8'))
+
+ xulNamespacePrefix = \
+ "{http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul}"
+
+ settings = root.findall(xulNamespacePrefix + 'setting')
+
+ def assertPref(setting, name, prefType, title):
+ packageName = 'jid1-fZHqN9JfrDBa8A@jetpack'
+ self.failUnlessEqual(setting.get('data-jetpack-id'), packageName)
+ self.failUnlessEqual(setting.get('pref'),
+ 'extensions.' + packageName + '.' + name)
+ self.failUnlessEqual(setting.get('pref-name'), name)
+ self.failUnlessEqual(setting.get('type'), prefType)
+ self.failUnlessEqual(setting.get('title'), title)
+
+ assertPref(settings[0], 'test', 'bool', u't\u00EBst')
+ assertPref(settings[1], 'test2', 'string', u't\u00EBst')
+ assertPref(settings[2], 'test3', 'menulist', '"><test')
+ assertPref(settings[3], 'test4', 'radio', u't\u00EBst')
+
+ menuItems = settings[2].findall(
+ '%(0)smenulist/%(0)smenupopup/%(0)smenuitem' % { "0": xulNamespacePrefix })
+ radios = settings[3].findall(
+ '%(0)sradiogroup/%(0)sradio' % { "0": xulNamespacePrefix })
+
+ def assertOption(option, value, label):
+ self.failUnlessEqual(option.get('value'), value)
+ self.failUnlessEqual(option.get('label'), label)
+
+ assertOption(menuItems[0], "0", "label1")
+ assertOption(menuItems[1], "1", "label2")
+ assertOption(radios[0], "red", "rouge")
+ assertOption(radios[1], "blue", "bleu")
+
+ prefsjs = self.xpi.read('defaults/preferences/prefs.js').decode("utf-8")
+ exp = [u'pref("extensions.jid1-fZHqN9JfrDBa8A@jetpack.test", false);',
+ u'pref("extensions.jid1-fZHqN9JfrDBa8A@jetpack.test2", "\u00FCnic\u00F8d\u00E9");',
+ u'pref("extensions.jid1-fZHqN9JfrDBa8A@jetpack.test3", "1");',
+ u'pref("extensions.jid1-fZHqN9JfrDBa8A@jetpack.test4", "red");',
+ ]
+ self.failUnlessEqual(prefsjs, "\n".join(exp)+"\n")
+
+ def testPackageWithNoPrefs(self):
+ self.makexpi('no-prefs')
+ self.failIf('options.xul' in self.xpi.namelist())
+ self.failUnlessEqual(self.xpi_harness_options["jetpackID"],
+ "jid1-fZHqN9JfrDBa8A@jetpack")
+ prefsjs = self.xpi.read('defaults/preferences/prefs.js').decode("utf-8")
+ self.failUnlessEqual(prefsjs, "")
+
+
+class Bug588119Tests(unittest.TestCase):
+ def makexpi(self, pkg_name):
+ self.xpiname = "%s.xpi" % pkg_name
+ create_xpi(self.xpiname, pkg_name, 'bug-588119-files')
+ self.xpi = zipfile.ZipFile(self.xpiname, 'r')
+ options = self.xpi.read('harness-options.json')
+ self.xpi_harness_options = json.loads(options)
+
+ def setUp(self):
+ self.xpiname = None
+ self.xpi = None
+
+ def tearDown(self):
+ if self.xpi:
+ self.xpi.close()
+ if self.xpiname and os.path.exists(self.xpiname):
+ os.remove(self.xpiname)
+
+ def testPackageWithImplicitIcon(self):
+ self.makexpi('implicit-icon')
+ assert 'icon.png' in self.xpi.namelist()
+
+ def testPackageWithImplicitIcon64(self):
+ self.makexpi('implicit-icon')
+ assert 'icon64.png' in self.xpi.namelist()
+
+ def testPackageWithExplicitIcon(self):
+ self.makexpi('explicit-icon')
+ assert 'icon.png' in self.xpi.namelist()
+
+ def testPackageWithExplicitIcon64(self):
+ self.makexpi('explicit-icon')
+ assert 'icon64.png' in self.xpi.namelist()
+
+ def testPackageWithNoIcon(self):
+ self.makexpi('no-icon')
+ assert 'icon.png' not in self.xpi.namelist()
+
+ def testIconPathNotInHarnessOptions(self):
+ self.makexpi('implicit-icon')
+ assert 'icon' not in self.xpi_harness_options
+
+ def testIcon64PathNotInHarnessOptions(self):
+ self.makexpi('implicit-icon')
+ assert 'icon64' not in self.xpi_harness_options
+
+class ExtraHarnessOptions(unittest.TestCase):
+ def setUp(self):
+ self.xpiname = None
+ self.xpi = None
+
+ def tearDown(self):
+ if self.xpi:
+ self.xpi.close()
+ if self.xpiname and os.path.exists(self.xpiname):
+ os.remove(self.xpiname)
+
+ def testOptions(self):
+ pkg_name = "extra-options"
+ self.xpiname = "%s.xpi" % pkg_name
+ create_xpi(self.xpiname, pkg_name, "bug-669274-files",
+ extra_harness_options={"builderVersion": "futuristic"})
+ self.xpi = zipfile.ZipFile(self.xpiname, 'r')
+ options = self.xpi.read('harness-options.json')
+ hopts = json.loads(options)
+ self.failUnless("builderVersion" in hopts)
+ self.failUnlessEqual(hopts["builderVersion"], "futuristic")
+
+ def testBadOptionName(self):
+ pkg_name = "extra-options"
+ self.xpiname = "%s.xpi" % pkg_name
+ self.failUnlessRaises(xpi.HarnessOptionAlreadyDefinedError,
+ create_xpi,
+ self.xpiname, pkg_name, "bug-669274-files",
+ extra_harness_options={"main": "already in use"})
+
+class SmallXPI(unittest.TestCase):
+ def setUp(self):
+ self.root = up(os.path.abspath(__file__), 4)
+ def get_linker_files_dir(self, name):
+ return os.path.join(up(os.path.abspath(__file__)), "linker-files", name)
+ def get_pkg(self, name):
+ d = self.get_linker_files_dir(name)
+ return packaging.get_config_in_dir(d)
+
+ def get_basedir(self):
+ return os.path.join(".test_tmp", self.id())
+ def make_basedir(self):
+ basedir = self.get_basedir()
+ if os.path.isdir(basedir):
+ here = os.path.abspath(os.getcwd())
+ assert os.path.abspath(basedir).startswith(here) # safety
+ shutil.rmtree(basedir)
+ os.makedirs(basedir)
+ return basedir
+
+ def test_contents(self):
+ target_cfg = self.get_pkg("three")
+ package_path = [self.get_linker_files_dir("three-deps")]
+ pkg_cfg = packaging.build_config(self.root, target_cfg,
+ packagepath=package_path)
+ deps = packaging.get_deps_for_targets(pkg_cfg,
+ [target_cfg.name, "addon-sdk"])
+ addon_sdk_dir = pkg_cfg.packages["addon-sdk"].lib[0]
+ m = manifest.build_manifest(target_cfg, pkg_cfg, deps, scan_tests=False)
+ used_files = list(m.get_used_files())
+ here = up(os.path.abspath(__file__))
+ def absify(*parts):
+ fn = os.path.join(here, "linker-files", *parts)
+ return os.path.abspath(fn)
+ expected = [absify(*parts) for parts in
+ [("three", "lib", "main.js"),
+ ("three-deps", "three-a", "lib", "main.js"),
+ ("three-deps", "three-a", "lib", "subdir", "subfile.js"),
+ ("three", "data", "msg.txt"),
+ ("three", "data", "subdir", "submsg.txt"),
+ ("three-deps", "three-b", "lib", "main.js"),
+ ("three-deps", "three-c", "lib", "main.js"),
+ ("three-deps", "three-c", "lib", "sub", "foo.js")
+ ]]
+
+ add_addon_sdk= lambda path: os.path.join(addon_sdk_dir, path)
+ expected.extend([add_addon_sdk(module) for module in [
+ os.path.join("sdk", "self.js"),
+ os.path.join("sdk", "core", "promise.js"),
+ os.path.join("sdk", "net", "url.js"),
+ os.path.join("sdk", "util", "object.js")
+ ]])
+
+ missing = set(expected) - set(used_files)
+ extra = set(used_files) - set(expected)
+
+ self.failUnlessEqual(list(missing), [])
+ self.failUnlessEqual(list(extra), [])
+ used_deps = m.get_used_packages()
+
+ build = packaging.generate_build_for_target(pkg_cfg, target_cfg.name,
+ used_deps,
+ include_tests=False)
+ options = {'main': target_cfg.main}
+ options.update(build)
+ basedir = self.make_basedir()
+ xpi_name = os.path.join(basedir, "contents.xpi")
+ xpi.build_xpi(template_root_dir=xpi_template_path,
+ manifest=fake_manifest,
+ xpi_path=xpi_name,
+ harness_options=options,
+ limit_to=used_files)
+ x = zipfile.ZipFile(xpi_name, "r")
+ names = x.namelist()
+ expected = ["components/",
+ "components/harness.js",
+ # the real template also has 'bootstrap.js', but the fake
+ # one in tests/static-files/xpi-template doesn't
+ "harness-options.json",
+ "install.rdf",
+ "defaults/preferences/prefs.js",
+ "resources/",
+ "resources/addon-sdk/",
+ "resources/addon-sdk/data/",
+ "resources/addon-sdk/lib/",
+ "resources/addon-sdk/lib/sdk/",
+ "resources/addon-sdk/lib/sdk/self.js",
+ "resources/addon-sdk/lib/sdk/core/",
+ "resources/addon-sdk/lib/sdk/util/",
+ "resources/addon-sdk/lib/sdk/net/",
+ "resources/addon-sdk/lib/sdk/core/promise.js",
+ "resources/addon-sdk/lib/sdk/util/object.js",
+ "resources/addon-sdk/lib/sdk/net/url.js",
+ "resources/three/",
+ "resources/three/lib/",
+ "resources/three/lib/main.js",
+ "resources/three/data/",
+ "resources/three/data/msg.txt",
+ "resources/three/data/subdir/",
+ "resources/three/data/subdir/submsg.txt",
+ "resources/three-a/",
+ "resources/three-a/lib/",
+ "resources/three-a/lib/main.js",
+ "resources/three-a/lib/subdir/",
+ "resources/three-a/lib/subdir/subfile.js",
+ "resources/three-b/",
+ "resources/three-b/lib/",
+ "resources/three-b/lib/main.js",
+ "resources/three-c/",
+ "resources/three-c/lib/",
+ "resources/three-c/lib/main.js",
+ "resources/three-c/lib/sub/",
+ "resources/three-c/lib/sub/foo.js",
+ # notably absent: three-a/lib/unused.js
+ "locale/",
+ "locale/fr-FR.json",
+ "locales.json",
+ ]
+ # showing deltas makes failures easier to investigate
+ missing = set(expected) - set(names)
+ extra = set(names) - set(expected)
+ self.failUnlessEqual((list(missing), list(extra)), ([], []))
+ self.failUnlessEqual(sorted(names), sorted(expected))
+
+ # check locale files
+ localedata = json.loads(x.read("locales.json"))
+ self.failUnlessEqual(sorted(localedata["locales"]), sorted(["fr-FR"]))
+ content = x.read("locale/fr-FR.json")
+ locales = json.loads(content)
+ # Locale files are merged into one.
+ # Conflicts are silently resolved by taking last package translation,
+ # so that we get "No" translation from three-c instead of three-b one.
+ self.failUnlessEqual(locales, json.loads(u'''
+ {
+ "No": "Nein",
+ "one": "un",
+ "What?": "Quoi?",
+ "Yes": "Oui",
+ "plural": {
+ "other": "other",
+ "one": "one"
+ },
+ "uft8_value": "\u00e9"
+ }'''))
+
+ def test_scantests(self):
+ target_cfg = self.get_pkg("three")
+ package_path = [self.get_linker_files_dir("three-deps")]
+ pkg_cfg = packaging.build_config(self.root, target_cfg,
+ packagepath=package_path)
+
+ deps = packaging.get_deps_for_targets(pkg_cfg,
+ [target_cfg.name, "addon-sdk"])
+ m = manifest.build_manifest(target_cfg, pkg_cfg, deps, scan_tests=True)
+ self.failUnlessEqual(sorted(m.get_all_test_modules()),
+ sorted(["test-one", "test-two"]))
+ # the current __init__.py code omits limit_to=used_files for 'cfx
+ # test', so all test files are included in the XPI. But the test
+ # runner will only execute the tests that m.get_all_test_modules()
+ # tells us about (which are put into the .allTestModules property of
+ # harness-options.json).
+ used_deps = m.get_used_packages()
+
+ build = packaging.generate_build_for_target(pkg_cfg, target_cfg.name,
+ used_deps,
+ include_tests=True)
+ options = {'main': target_cfg.main}
+ options.update(build)
+ basedir = self.make_basedir()
+ xpi_name = os.path.join(basedir, "contents.xpi")
+ xpi.build_xpi(template_root_dir=xpi_template_path,
+ manifest=fake_manifest,
+ xpi_path=xpi_name,
+ harness_options=options,
+ limit_to=None)
+ x = zipfile.ZipFile(xpi_name, "r")
+ names = x.namelist()
+ self.failUnless("resources/addon-sdk/lib/sdk/deprecated/unit-test.js" in names, names)
+ self.failUnless("resources/addon-sdk/lib/sdk/deprecated/unit-test-finder.js" in names, names)
+ self.failUnless("resources/addon-sdk/lib/sdk/test/harness.js" in names, names)
+ self.failUnless("resources/addon-sdk/lib/sdk/test/runner.js" in names, names)
+ # all files are copied into the XPI, even the things that don't look
+ # like tests.
+ self.failUnless("resources/three/tests/test-one.js" in names, names)
+ self.failUnless("resources/three/tests/test-two.js" in names, names)
+ self.failUnless("resources/three/tests/nontest.js" in names, names)
+
+ def test_scantests_filter(self):
+ target_cfg = self.get_pkg("three")
+ package_path = [self.get_linker_files_dir("three-deps")]
+ pkg_cfg = packaging.build_config(self.root, target_cfg,
+ packagepath=package_path)
+ deps = packaging.get_deps_for_targets(pkg_cfg,
+ [target_cfg.name, "addon-sdk"])
+ FILTER = ".*one.*"
+ m = manifest.build_manifest(target_cfg, pkg_cfg, deps, scan_tests=True,
+ test_filter_re=FILTER)
+ self.failUnlessEqual(sorted(m.get_all_test_modules()),
+ sorted(["test-one"]))
+ # the current __init__.py code omits limit_to=used_files for 'cfx
+ # test', so all test files are included in the XPI. But the test
+ # runner will only execute the tests that m.get_all_test_modules()
+ # tells us about (which are put into the .allTestModules property of
+ # harness-options.json).
+ used_deps = m.get_used_packages()
+
+ build = packaging.generate_build_for_target(pkg_cfg, target_cfg.name,
+ used_deps,
+ include_tests=True)
+ options = {'main': target_cfg.main}
+ options.update(build)
+ basedir = self.make_basedir()
+ xpi_name = os.path.join(basedir, "contents.xpi")
+ xpi.build_xpi(template_root_dir=xpi_template_path,
+ manifest=fake_manifest,
+ xpi_path=xpi_name,
+ harness_options=options,
+ limit_to=None)
+ x = zipfile.ZipFile(xpi_name, "r")
+ names = x.namelist()
+ self.failUnless("resources/addon-sdk/lib/sdk/deprecated/unit-test.js" in names, names)
+ self.failUnless("resources/addon-sdk/lib/sdk/deprecated/unit-test-finder.js" in names, names)
+ self.failUnless("resources/addon-sdk/lib/sdk/test/harness.js" in names, names)
+ self.failUnless("resources/addon-sdk/lib/sdk/test/runner.js" in names, names)
+ # get_all_test_modules() respects the filter. But all files are still
+ # copied into the XPI.
+ self.failUnless("resources/three/tests/test-one.js" in names, names)
+ self.failUnless("resources/three/tests/test-two.js" in names, names)
+ self.failUnless("resources/three/tests/nontest.js" in names, names)
+
+
+def document_dir(name):
+ if name in ['packages', 'xpi-template']:
+ dirname = os.path.join(test_packaging.static_files_path, name)
+ document_dir_files(dirname)
+ elif name == 'xpi-output':
+ create_xpi('test-xpi.xpi')
+ document_zip_file('test-xpi.xpi')
+ os.remove('test-xpi.xpi')
+ else:
+ raise Exception('unknown dir: %s' % name)
+
+def normpath(path):
+ """
+ Make a platform-specific relative path use '/' as a separator.
+ """
+
+ return path.replace(os.path.sep, '/')
+
+def document_zip_file(path):
+ zip = zipfile.ZipFile(path, 'r')
+ for name in sorted(zip.namelist()):
+ contents = zip.read(name)
+ lines = contents.splitlines()
+ if len(lines) == 1 and name.endswith('.json') and len(lines[0]) > 75:
+ # Ideally we would json-decode this, but it results
+ # in an annoying 'u' before every string literal,
+ # since json decoding makes all strings unicode.
+ contents = eval(contents)
+ contents = pprint.pformat(contents)
+ lines = contents.splitlines()
+ contents = "\n ".join(lines)
+ print "%s:\n %s" % (normpath(name), contents)
+ zip.close()
+
+def document_dir_files(path):
+ filename_contents_tuples = []
+ for dirpath, dirnames, filenames in os.walk(path):
+ relpath = dirpath[len(path)+1:]
+ for filename in filenames:
+ abspath = os.path.join(dirpath, filename)
+ contents = open(abspath, 'r').read()
+ contents = "\n ".join(contents.splitlines())
+ relfilename = os.path.join(relpath, filename)
+ filename_contents_tuples.append((normpath(relfilename), contents))
+ filename_contents_tuples.sort()
+ for filename, contents in filename_contents_tuples:
+ print "%s:" % filename
+ print " %s" % contents
+
+def create_xpi(xpiname, pkg_name='aardvark', dirname='static-files',
+ extra_harness_options={}):
+ configs = test_packaging.get_configs(pkg_name, dirname)
+ options = {'main': configs.target_cfg.main,
+ 'jetpackID': buildJID(configs.target_cfg), }
+ options.update(configs.build)
+ xpi.build_xpi(template_root_dir=xpi_template_path,
+ manifest=fake_manifest,
+ xpi_path=xpiname,
+ harness_options=options,
+ extra_harness_options=extra_harness_options)
+
+if __name__ == '__main__':
+ unittest.main()