Browse files

Bug 731779: Integrate the Add-on SDK loader and API libraries into Fi…

…refox (uplifting from addon-sdk a16bbd5772880b578a939eeb65102bca6560d494)
  • Loading branch information...
1 parent cc8d75d commit fa914b814af4485910cfe4bf2b3082aa95b73b26 @Mossop Mossop committed Feb 1, 2013
Showing with 19,815 additions and 0 deletions.
  1. +5 −0 addon-sdk/source/.gitattributes
  2. +20 −0 addon-sdk/source/.gitignore
  3. +14 −0 addon-sdk/source/.hgignore
  4. +64 −0 addon-sdk/source/.hgtags
  5. +30 −0 addon-sdk/source/LICENSE
  6. +45 −0 addon-sdk/source/README
  7. +11 −0 addon-sdk/source/app-extension/application.ini
  8. +275 −0 addon-sdk/source/app-extension/bootstrap.js
  9. +33 −0 addon-sdk/source/app-extension/install.rdf
  10. +86 −0 addon-sdk/source/bin/activate
  11. +134 −0 addon-sdk/source/bin/activate.bat
  12. +99 −0 addon-sdk/source/bin/activate.ps1
  13. +33 −0 addon-sdk/source/bin/cfx
  14. +6 −0 addon-sdk/source/bin/cfx.bat
  15. +23 −0 addon-sdk/source/bin/deactivate.bat
  16. +14 −0 addon-sdk/source/bin/integration-scripts/buildbot-run-cfx-helper
  17. +364 −0 addon-sdk/source/bin/integration-scripts/integration-check
  18. +13 −0 addon-sdk/source/data/index.html
  19. +49 −0 addon-sdk/source/data/mofo_logo.SVG
  20. BIN addon-sdk/source/data/moz_favicon.ico
  21. +1 −0 addon-sdk/source/data/pagemod-css-include-file.css
  22. +5 −0 addon-sdk/source/data/test-content-symbiont.js
  23. +5 −0 addon-sdk/source/data/test-context-menu.js
  24. +20 −0 addon-sdk/source/data/test-iframe-postmessage.html
  25. +9 −0 addon-sdk/source/data/test-iframe.html
  26. +11 −0 addon-sdk/source/data/test-iframe.js
  27. +6 −0 addon-sdk/source/data/test-message-manager.js
  28. +1 −0 addon-sdk/source/data/test-net-url.txt
  29. +12 −0 addon-sdk/source/data/test-page-mod.html
  30. +13 −0 addon-sdk/source/data/test-page-worker.html
  31. +29 −0 addon-sdk/source/data/test-page-worker.js
  32. +18 −0 addon-sdk/source/data/test-trusted-document.html
  33. +13 −0 addon-sdk/source/data/test.html
  34. +908 −0 addon-sdk/source/doc/dev-guide-source/cfx-tool.md
  35. +46 −0 addon-sdk/source/doc/dev-guide-source/console.md
  36. +68 −0 addon-sdk/source/doc/dev-guide-source/credits.md
  37. +73 −0 addon-sdk/source/doc/dev-guide-source/glossary.md
  38. +164 −0 addon-sdk/source/doc/dev-guide-source/guides/content-scripts/accessing-the-dom.md
  39. +246 −0 addon-sdk/source/doc/dev-guide-source/guides/content-scripts/communicating-with-other-scripts.md
  40. +93 −0 addon-sdk/source/doc/dev-guide-source/guides/content-scripts/index.md
  41. +79 −0 addon-sdk/source/doc/dev-guide-source/guides/content-scripts/loading.md
  42. +71 −0 addon-sdk/source/doc/dev-guide-source/guides/content-scripts/reddit-example.md
  43. +183 −0 addon-sdk/source/doc/dev-guide-source/guides/content-scripts/using-port.md
  44. +184 −0 addon-sdk/source/doc/dev-guide-source/guides/content-scripts/using-postmessage.md
  45. +153 −0 addon-sdk/source/doc/dev-guide-source/guides/events.md
  46. +103 −0 addon-sdk/source/doc/dev-guide-source/guides/firefox-compatibility.md
  47. +190 −0 addon-sdk/source/doc/dev-guide-source/guides/index.md
  48. +218 −0 addon-sdk/source/doc/dev-guide-source/guides/library-detector.md
  49. +231 −0 addon-sdk/source/doc/dev-guide-source/guides/modules.md
  50. +33 −0 addon-sdk/source/doc/dev-guide-source/guides/program-id.md
  51. +107 −0 addon-sdk/source/doc/dev-guide-source/guides/sdk-vs-xul.md
  52. +104 −0 addon-sdk/source/doc/dev-guide-source/guides/stability.md
  53. +119 −0 addon-sdk/source/doc/dev-guide-source/guides/two-types-of-scripts.md
  54. +325 −0 addon-sdk/source/doc/dev-guide-source/guides/xul-migration.md
  55. +16 −0 addon-sdk/source/doc/dev-guide-source/high-level-apis.md
  56. +155 −0 addon-sdk/source/doc/dev-guide-source/index.md
  57. +34 −0 addon-sdk/source/doc/dev-guide-source/low-level-apis.md
  58. +121 −0 addon-sdk/source/doc/dev-guide-source/package-spec.md
  59. +190 −0 addon-sdk/source/doc/dev-guide-source/search.md
  60. +7 −0 addon-sdk/source/doc/dev-guide-source/third-party-apis.md
  61. +89 −0 addon-sdk/source/doc/dev-guide-source/tutorials/add-a-context-menu-item.md
  62. +142 −0 addon-sdk/source/doc/dev-guide-source/tutorials/adding-menus.md
  63. +174 −0 addon-sdk/source/doc/dev-guide-source/tutorials/adding-toolbar-button.md
  64. +344 −0 addon-sdk/source/doc/dev-guide-source/tutorials/annotator/creating.md
  65. +213 −0 addon-sdk/source/doc/dev-guide-source/tutorials/annotator/displaying.md
  66. +31 −0 addon-sdk/source/doc/dev-guide-source/tutorials/annotator/index.md
  67. +63 −0 addon-sdk/source/doc/dev-guide-source/tutorials/annotator/overview.md
  68. +369 −0 addon-sdk/source/doc/dev-guide-source/tutorials/annotator/storing.md
  69. +115 −0 addon-sdk/source/doc/dev-guide-source/tutorials/annotator/widget.md
  70. +105 −0 addon-sdk/source/doc/dev-guide-source/tutorials/chrome.md
  71. +151 −0 addon-sdk/source/doc/dev-guide-source/tutorials/display-a-popup.md
  72. +273 −0 addon-sdk/source/doc/dev-guide-source/tutorials/event-targets.md
  73. +170 −0 addon-sdk/source/doc/dev-guide-source/tutorials/getting-started-with-cfx.md
  74. +244 −0 addon-sdk/source/doc/dev-guide-source/tutorials/index.md
  75. +160 −0 addon-sdk/source/doc/dev-guide-source/tutorials/installation.md
  76. +441 −0 addon-sdk/source/doc/dev-guide-source/tutorials/l10n.md
  77. +73 −0 addon-sdk/source/doc/dev-guide-source/tutorials/list-open-tabs.md
  78. +55 −0 addon-sdk/source/doc/dev-guide-source/tutorials/listen-for-page-load.md
  79. +103 −0 addon-sdk/source/doc/dev-guide-source/tutorials/load-and-unload.md
  80. +67 −0 addon-sdk/source/doc/dev-guide-source/tutorials/logging.md
  81. +350 −0 addon-sdk/source/doc/dev-guide-source/tutorials/mobile.md
  82. +153 −0 addon-sdk/source/doc/dev-guide-source/tutorials/modifying-web-pages-tab.md
  83. +242 −0 addon-sdk/source/doc/dev-guide-source/tutorials/modifying-web-pages-url.md
  84. +57 −0 addon-sdk/source/doc/dev-guide-source/tutorials/open-a-web-page.md
  85. +408 −0 addon-sdk/source/doc/dev-guide-source/tutorials/reusable-modules.md
  86. +5 −0 addon-sdk/source/doc/dev-guide-source/tutorials/third-party-apis
  87. +208 −0 addon-sdk/source/doc/dev-guide-source/tutorials/troubleshooting.md
  88. +163 −0 addon-sdk/source/doc/dev-guide-source/tutorials/unit-testing.md
  89. +18 −0 addon-sdk/source/doc/module-source/high-level-modules.md
  90. +36 −0 addon-sdk/source/doc/module-source/low-level-modules.md
  91. +32 −0 addon-sdk/source/doc/module-source/sdk/addon-page.md
  92. +50 −0 addon-sdk/source/doc/module-source/sdk/base64.md
  93. +91 −0 addon-sdk/source/doc/module-source/sdk/clipboard.md
  94. +7 −0 addon-sdk/source/doc/module-source/sdk/console/plain-text.md
  95. +66 −0 addon-sdk/source/doc/module-source/sdk/console/traceback.md
  96. +20 −0 addon-sdk/source/doc/module-source/sdk/content/content.md
  97. +122 −0 addon-sdk/source/doc/module-source/sdk/content/loader.md
  98. +149 −0 addon-sdk/source/doc/module-source/sdk/content/symbiont.md
  99. +135 −0 addon-sdk/source/doc/module-source/sdk/content/worker.md
  100. +726 −0 addon-sdk/source/doc/module-source/sdk/context-menu.md
  101. +276 −0 addon-sdk/source/doc/module-source/sdk/core/heritage.md
  102. +71 −0 addon-sdk/source/doc/module-source/sdk/core/namespace.md
  103. +394 −0 addon-sdk/source/doc/module-source/sdk/core/promise.md
  104. +169 −0 addon-sdk/source/doc/module-source/sdk/deprecated/api-utils.md
  105. +72 −0 addon-sdk/source/doc/module-source/sdk/deprecated/app-strings.md
  106. +165 −0 addon-sdk/source/doc/module-source/sdk/deprecated/cortex.md
  107. +46 −0 addon-sdk/source/doc/module-source/sdk/deprecated/errors.md
  108. +83 −0 addon-sdk/source/doc/module-source/sdk/deprecated/events.md
  109. +301 −0 addon-sdk/source/doc/module-source/sdk/deprecated/light-traits.md
  110. +81 −0 addon-sdk/source/doc/module-source/sdk/deprecated/observer-service.md
  111. +147 −0 addon-sdk/source/doc/module-source/sdk/deprecated/tab-browser.md
  112. +251 −0 addon-sdk/source/doc/module-source/sdk/deprecated/traits.md
  113. +96 −0 addon-sdk/source/doc/module-source/sdk/deprecated/window-utils.md
  114. +128 −0 addon-sdk/source/doc/module-source/sdk/event/core.md
  115. +155 −0 addon-sdk/source/doc/module-source/sdk/event/target.md
  116. +78 −0 addon-sdk/source/doc/module-source/sdk/frame/hidden-frame.md
  117. +55 −0 addon-sdk/source/doc/module-source/sdk/frame/utils.md
  118. +100 −0 addon-sdk/source/doc/module-source/sdk/hotkeys.md
  119. +134 −0 addon-sdk/source/doc/module-source/sdk/indexed-db.md
  120. +68 −0 addon-sdk/source/doc/module-source/sdk/io/byte-streams.md
  121. +150 −0 addon-sdk/source/doc/module-source/sdk/io/file.md
  122. +102 −0 addon-sdk/source/doc/module-source/sdk/io/text-streams.md
  123. +107 −0 addon-sdk/source/doc/module-source/sdk/l10n.md
  124. +7 −0 addon-sdk/source/doc/module-source/sdk/loader/cuddlefish.md
  125. +100 −0 addon-sdk/source/doc/module-source/sdk/loader/sandbox.md
  126. +24 −0 addon-sdk/source/doc/module-source/sdk/net/url.md
  127. +95 −0 addon-sdk/source/doc/module-source/sdk/net/xhr.md
  128. +64 −0 addon-sdk/source/doc/module-source/sdk/notifications.md
  129. +621 −0 addon-sdk/source/doc/module-source/sdk/page-mod.md
  130. +259 −0 addon-sdk/source/doc/module-source/sdk/page-mod/match-pattern.md
  131. +331 −0 addon-sdk/source/doc/module-source/sdk/page-worker.md
  132. +614 −0 addon-sdk/source/doc/module-source/sdk/panel.md
  133. +568 −0 addon-sdk/source/doc/module-source/sdk/passwords.md
  134. +590 −0 addon-sdk/source/doc/module-source/sdk/platform/xpcom.md
  135. +123 −0 addon-sdk/source/doc/module-source/sdk/preferences/service.md
  136. +86 −0 addon-sdk/source/doc/module-source/sdk/private-browsing.md
  137. +37 −0 addon-sdk/source/doc/module-source/sdk/querystring.md
  138. +204 −0 addon-sdk/source/doc/module-source/sdk/request.md
  139. +90 −0 addon-sdk/source/doc/module-source/sdk/selection.md
  140. +94 −0 addon-sdk/source/doc/module-source/sdk/self.md
  141. +357 −0 addon-sdk/source/doc/module-source/sdk/simple-prefs.md
  142. +220 −0 addon-sdk/source/doc/module-source/sdk/simple-storage.md
Sorry, we could not display the entire diff because too many files (790) changed.
View
5 addon-sdk/source/.gitattributes
@@ -0,0 +1,5 @@
+.gitignore export-ignore
+.hgignore export-ignore
+.hgtags export-ignore
+.gitattributes export-ignore
+python-lib/cuddlefish/_version.py export-subst
View
20 addon-sdk/source/.gitignore
@@ -0,0 +1,20 @@
+local.json
+python-lib/cuddlefish/app-extension/components/jetpack.xpt
+testdocs.tgz
+jetpack-sdk-docs.tgz
+.test_tmp/
+doc/dev-guide/
+doc/index.html
+doc/modules/
+doc/status.md5
+packages/*
+
+# Python
+*.pyc
+
+# OSX
+*.DS_Store
+
+# Windows
+*Thumbs.db
+
View
14 addon-sdk/source/.hgignore
@@ -0,0 +1,14 @@
+syntax: glob
+local.json
+python-lib/cuddlefish/app-extension/components/jetpack.xpt
+testdocs.tgz
+jetpack-sdk-docs.tgz
+.test_tmp
+jetpack-sdk-docs
+
+# These should really be in a global .hgignore, but such a thing
+# seems ridiculously confusing to set up, so we'll include some
+# common intermediate files here.
+*.pyc
+*~
+*.DS_Store
View
64 addon-sdk/source/.hgtags
@@ -0,0 +1,64 @@
+39c45211aa250d43f6e54b776a60ef07a7a4cbb6 jep-31-examples
+0120642297b217680e75e68c4005a93b16466001 0.1rc1
+1fd7993ff2cec39c5948a1b2535b78c2d4c65858 0.1rc2
+530e51d02922ad05fd43e8cf113618068216b0cf 0.1
+ed11a9e3ae23aefd56ac88042b9816887d10a04f 0.2rc1
+f70ab8998abdce809bda93408435f83648909cdd 0.2rc2
+f70ab8998abdce809bda93408435f83648909cdd 0.2
+436968c6ec833d9c18a15426be26595a44b79283 0.3rc1
+a3b091d29607f0bcecf77fe27801ba901142f1c9 0.3
+06031b56312ad7f1880a9620b4d26ce253a23b23 0.3rc2
+a3b091d29607f0bcecf77fe27801ba901142f1c9 0.3
+4b08c8a8c1eef71ac3aa54e004b68e87049ca56b 0.3
+6884e54fd6a1cfa9ec63910c46d2cbf51495b584 0.3rc3
+4b08c8a8c1eef71ac3aa54e004b68e87049ca56b 0.3
+cd70b7140ec20689255f1248512a1e5b9cf90a32 0.3
+d9d733666ca8738e9665ba816d5d12f41fc0d216 0.4rc1
+8d2871fc10df16740273f53ef05815310da4b210 0.4
+201e60065b1aef23259a71756f93207cffa2abd5 0.4rc2
+8d2871fc10df16740273f53ef05815310da4b210 0.4
+c0e5bbdcafad4572a5de22e533543bf3330a869e 0.4
+201e60065b1aef23259a71756f93207cffa2abd5 0.4rc2
+a8dceaefd6f3376b7bc1619cccd854591b76ecc0 0.4rc2
+c0e5bbdcafad4572a5de22e533543bf3330a869e 0.4
+dfa3bdfedb12d743b5e0ac19d0ecf116b567a0b3 0.4
+b519a0848585e2a665a14aac2fb6f15c0a839e6c 0.4rc3
+dfa3bdfedb12d743b5e0ac19d0ecf116b567a0b3 0.4
+05acdf4987c28d8cc1d5a12d87e71b1445fdd6b7 0.4
+04b5afe48d1cee819d9f0af72ed16556a075b67d 0.5rc1
+1968150561097bcfeeb28a75801ef881d2fcbbf5 0.5
+3236e68e6f2e36353e47f01a9b8acfce56686263 0.5rc2
+1968150561097bcfeeb28a75801ef881d2fcbbf5 0.5
+0097da78aa23be8b7a5a811c4be0e3e35395af43 0.5
+be7016807a69c910ac31ff068a6c2bde0a25c9d4 0.5rc3
+0097da78aa23be8b7a5a811c4be0e3e35395af43 0.5
+83e97107e4a381b898c780b32e30e48b0e4d37f3 0.5
+182a405aa393dbd412e671e8516d2decd8e8d80c 0.6rc1
+96799a3d96abfdb1408f9b8e30479668f1feed70 0.6
+c5f6cdfa36b2ad33d8017e6844992de0b0a6c0e0 0.6rc2
+96799a3d96abfdb1408f9b8e30479668f1feed70 0.6
+65c393fbc6af7db79a4a2e903d06b17e90d254bf 0.6
+3e747e3e307a4e853d468b03357f96b2172bad37 0.7rc1
+b0e97e12eb9115f08127cc447d459f871c5046ed 0.7
+37288479d249168668abd60a907620fa7f593128 0.7rc2
+b0e97e12eb9115f08127cc447d459f871c5046ed 0.7
+db0eabc310619d00ce47372ecaafba7d2539b601 0.7
+37288479d249168668abd60a907620fa7f593128 0.7rc2
+b90bedb83525d8f32ebb4d3833e8d91efa991b6d 0.7rc2
+db0eabc310619d00ce47372ecaafba7d2539b601 0.7
+e6ea2e5c5274cbbb0278dc976844dbf51818a95e 0.7
+b90bedb83525d8f32ebb4d3833e8d91efa991b6d 0.7rc2
+9b978d823509de5d52ca222b9907f72591c68c5a 0.7rc2
+e6ea2e5c5274cbbb0278dc976844dbf51818a95e 0.7
+cd71e1e77c93adf169b9f38184b1f95d423876ba 0.7
+67e3fd285fa955898a2641226c86725365d68b95 0.8rc1
+b2f9405db6d74c21601ca9c250887411c837396a 0.8
+67e3fd285fa955898a2641226c86725365d68b95 0.8rc1
+56e8179ff5b467959ddf33978558d7eb5346ee53 0.8rc1
+b2f9405db6d74c21601ca9c250887411c837396a 0.8
+51a22a186b1c7d8e7292a5ec9670752dad223ca1 0.8
+d150cca77cfef60dee2f2fe7c892fd7fc5ce83c4 0.9rc1
+1e106beb57f65fabc32682f277de51a8101c919b 0.9
+173d56fa8cc1c5622eae70f1ae88ef789de4722b 0.9rc2
+1e106beb57f65fabc32682f277de51a8101c919b 0.9
+cde12eefd178d7a0ee7d5e9ae77f3089bcbdc6ec 0.9
View
30 addon-sdk/source/LICENSE
@@ -0,0 +1,30 @@
+The files which make up the SDK are developed by Mozilla and licensed
+under the MPL 2.0 (http://mozilla.org/MPL/2.0/), with the exception of the
+components listed below, which are made available by their authors under
+the licenses listed alongside.
+
+syntaxhighlighter
+------------------
+doc/static-files/syntaxhighlighter
+Made available under the MIT license.
+
+jQuery
+------
+examples/reddit-panel/data/jquery-1.4.4.min.js
+examples/annotator/data/jquery-1.4.2.min.js
+Made available under the MIT license.
+
+simplejson
+----------
+python-lib/simplejson
+Made available under the MIT license.
+
+Python Markdown
+---------------
+python-lib/markdown
+Made available under the BSD license.
+
+LibraryDetector
+---------------
+examples/library-detector/data/library-detector.js
+Made available under the MIT license.
View
45 addon-sdk/source/README
@@ -0,0 +1,45 @@
+Add-on SDK README
+==================
+
+Before proceeding, please make sure you've installed Python 2.5,
+2.6, or 2.7 (if it's not already on your system):
+
+ http://python.org/download/
+
+Note that Python 3.0 and 3.1 are not supported in this release.
+
+For Windows users, MozillaBuild (https://wiki.mozilla.org/MozillaBuild)
+will install the correct version of Python and the MSYS package, which
+will make it easier to work with the SDK.
+
+To get started, first enter the same directory that this README file
+is in (the SDK's root directory) using a shell program. On Unix systems
+or on Windows with MSYS, you can execute the following command:
+
+ source bin/activate
+
+Windows users using cmd.exe should instead run:
+
+ bin\activate.bat
+
+Then run:
+
+ cfx docs
+
+This should start a documentation server and open a web browser
+with further instructions.
+
+If you get an error when running cfx or have any other problems getting
+started, see the "Troubleshooting" guide at:
+https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/troubleshooting.html
+
+Bugs
+-------
+
+* file a bug: https://bugzilla.mozilla.org/enter_bug.cgi?product=Add-on%20SDK
+
+
+Style Guidelines
+--------------------
+
+* https://github.com/mozilla/addon-sdk/wiki/Coding-style-guide
View
11 addon-sdk/source/app-extension/application.ini
@@ -0,0 +1,11 @@
+[App]
+Vendor=Varma
+Name=Test App
+Version=1.0
+BuildID=20060101
+Copyright=Copyright (c) 2009 Atul Varma
+ID=xulapp@toolness.com
+
+[Gecko]
+MinVersion=1.9.2.0
+MaxVersion=2.0.*
View
275 addon-sdk/source/app-extension/bootstrap.js
@@ -0,0 +1,275 @@
+/* vim:set ts=2 sw=2 sts=2 expandtab */
+/* 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/. */
+
+// @see http://mxr.mozilla.org/mozilla-central/source/js/src/xpconnect/loader/mozJSComponentLoader.cpp
+
+'use strict';
+
+// IMPORTANT: Avoid adding any initialization tasks here, if you need to do
+// something before add-on is loaded consider addon/runner module instead!
+
+const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu,
+ results: Cr, manager: Cm } = Components;
+const ioService = Cc['@mozilla.org/network/io-service;1'].
+ getService(Ci.nsIIOService);
+const resourceHandler = ioService.getProtocolHandler('resource').
+ QueryInterface(Ci.nsIResProtocolHandler);
+const systemPrincipal = CC('@mozilla.org/systemprincipal;1', 'nsIPrincipal')();
+const scriptLoader = Cc['@mozilla.org/moz/jssubscript-loader;1'].
+ getService(Ci.mozIJSSubScriptLoader);
+
+const REASON = [ 'unknown', 'startup', 'shutdown', 'enable', 'disable',
+ 'install', 'uninstall', 'upgrade', 'downgrade' ];
+
+const bind = Function.call.bind(Function.bind);
+
+let loader = null;
+let unload = null;
+let cuddlefishSandbox = null;
+let nukeTimer = null;
+
+// Utility function that synchronously reads local resource from the given
+// `uri` and returns content string.
+function readURI(uri) {
+ let ioservice = Cc['@mozilla.org/network/io-service;1'].
+ getService(Ci.nsIIOService);
+ let channel = ioservice.newChannel(uri, 'UTF-8', null);
+ let stream = channel.open();
+
+ let cstream = Cc['@mozilla.org/intl/converter-input-stream;1'].
+ createInstance(Ci.nsIConverterInputStream);
+ cstream.init(stream, 'UTF-8', 0, 0);
+
+ let str = {};
+ let data = '';
+ let read = 0;
+ do {
+ read = cstream.readString(0xffffffff, str);
+ data += str.value;
+ } while (read != 0);
+
+ cstream.close();
+
+ return data;
+}
+
+// Utility function that converts cfx-py generated paths to a
+// module ids.
+function path2id(path) {
+ // Strips out `/lib` and `.js` from package/lib/path.js
+ return path.replace(/([^\/]*)\/lib/, '$1').replace(/.js$/, '');
+}
+// Utility function that takes old manifest format and creates a manifest
+// in a new format: https://github.com/mozilla/addon-sdk/wiki/JEP-Linker
+function manifestV2(manifest) {
+ return Object.keys(manifest).reduce(function(result, path) {
+ let entry = manifest[path];
+ let id = path2id(path);
+ let requirements = entry.requirements || {};
+ result[id] = {
+ requirements: Object.keys(requirements).reduce(function(result, path) {
+ result[path] = path2id(requirements[path].path);
+ return result;
+ }, {})
+ };
+ return result
+ }, {});
+}
+
+// We don't do anything on install & uninstall yet, but in a future
+// we should allow add-ons to cleanup after uninstall.
+function install(data, reason) {}
+function uninstall(data, reason) {}
+
+function startup(data, reasonCode) {
+ try {
+ let reason = REASON[reasonCode];
+ // URI for the root of the XPI file.
+ // 'jar:' URI if the addon is packed, 'file:' URI otherwise.
+ // (Used by l10n module in order to fetch `locale` folder)
+ let rootURI = data.resourceURI.spec;
+
+ // TODO: Maybe we should perform read harness-options.json asynchronously,
+ // since we can't do anything until 'sessionstore-windows-restored' anyway.
+ let options = JSON.parse(readURI(rootURI + './harness-options.json'));
+
+ let id = options.jetpackID;
+ let name = options.name;
+ // Register a new resource 'domain' for this addon which is mapping to
+ // XPI's `resources` folder.
+ // Generate the domain name by using jetpack ID, which is the extension ID
+ // by stripping common characters that doesn't work as a domain name:
+ let uuidRe =
+ /^\{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\}$/;
+
+ let domain = id.
+ toLowerCase().
+ replace(/@/g, '-at-').
+ replace(/\./g, '-dot-').
+ replace(uuidRe, '$1');
+
+ let prefixURI = 'resource://' + domain + '/';
+ let resourcesURI = ioService.newURI(rootURI + '/resources/', null, null);
+ resourceHandler.setSubstitution(domain, resourcesURI);
+
+ // Create path to URLs mapping supported by loader.
+ let paths = Object.keys(options.metadata).reduce(function(result, name) {
+ result[name + '/'] = prefixURI + name + '/lib/'
+ result[name + '/tests/'] = prefixURI + name + '/tests/'
+ return result
+ }, {
+ // Relative modules resolve to add-on package lib
+ './': prefixURI + name + '/lib/',
+ 'toolkit/': 'resource://gre/modules/toolkit/',
+ '': 'resources:///modules/'
+ });
+
+ // Make version 2 of the manifest
+ let manifest = manifestV2(options.manifest);
+
+ // Import `cuddlefish.js` module using a Sandbox and bootstrap loader.
+ let cuddlefishURI = prefixURI + options.loader;
+ cuddlefishSandbox = loadSandbox(cuddlefishURI);
+ let cuddlefish = cuddlefishSandbox.exports;
+
+ // Normalize `options.mainPath` so that it looks like one that will come
+ // in a new version of linker.
+ let main = path2id(options.mainPath);
+
+ unload = cuddlefish.unload;
+ loader = cuddlefish.Loader({
+ paths: paths,
+ // modules manifest.
+ manifest: manifest,
+
+ // Add-on ID used by different APIs as a unique identifier.
+ id: id,
+ // Add-on name.
+ name: name,
+ // Add-on version.
+ version: options.metadata[name].version,
+ // Add-on package descriptor.
+ metadata: options.metadata[name],
+ // Add-on load reason.
+ loadReason: reason,
+
+ prefixURI: prefixURI,
+ // Add-on URI.
+ rootURI: rootURI,
+ // options used by system module.
+ // File to write 'OK' or 'FAIL' (exit code emulation).
+ resultFile: options.resultFile,
+ // File to write stdout.
+ logFile: options.logFile,
+ // Arguments passed as --static-args
+ staticArgs: options.staticArgs,
+
+ // Arguments related to test runner.
+ modules: {
+ '@test/options': {
+ allTestModules: options.allTestModules,
+ iterations: options.iterations,
+ filter: options.filter,
+ profileMemory: options.profileMemory,
+ stopOnError: options.stopOnError,
+ verbose: options.verbose,
+ parseable: options.parseable,
+ }
+ }
+ });
+
+ let module = cuddlefish.Module('addon-sdk/sdk/loader/cuddlefish', cuddlefishURI);
+ let require = cuddlefish.Require(loader, module);
+
+ require('sdk/addon/runner').startup(reason, {
+ loader: loader,
+ main: main,
+ prefsURI: rootURI + 'defaults/preferences/prefs.js'
+ });
+ } catch (error) {
+ dump('Bootstrap error: ' + error.message + '\n' +
+ (error.stack || error.fileName + ': ' + error.lineNumber) + '\n');
+ throw error;
+ }
+};
+
+function loadSandbox(uri) {
+ let proto = {
+ sandboxPrototype: {
+ loadSandbox: loadSandbox,
+ ChromeWorker: ChromeWorker
+ }
+ };
+ let sandbox = Cu.Sandbox(systemPrincipal, proto);
+ // Create a fake commonjs environnement just to enable loading loader.js
+ // correctly
+ sandbox.exports = {};
+ sandbox.module = { uri: uri, exports: sandbox.exports };
+ sandbox.require = function (id) {
+ if (id !== "chrome")
+ throw new Error("Bootstrap sandbox `require` method isn't implemented.");
+
+ return Object.freeze({ Cc: Cc, Ci: Ci, Cu: Cu, Cr: Cr, Cm: Cm,
+ CC: bind(CC, Components), components: Components,
+ ChromeWorker: ChromeWorker });
+ };
+ scriptLoader.loadSubScript(uri, sandbox, 'UTF-8');
+ return sandbox;
+}
+
+function unloadSandbox(sandbox) {
+ if ("nukeSandbox" in Cu)
+ Cu.nukeSandbox(sandbox);
+}
+
+function setTimeout(callback, delay) {
+ let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
+ timer.initWithCallback({ notify: callback }, delay,
+ Ci.nsITimer.TYPE_ONE_SHOT);
+ return timer;
+}
+
+function shutdown(data, reasonCode) {
+ let reason = REASON[reasonCode];
+ if (loader) {
+ unload(loader, reason);
+ unload = null;
+ // Avoid leaking all modules when something goes wrong with one particular
+ // module. Do not clean it up immediatly in order to allow executing some
+ // actions on addon disabling.
+ // We need to keep a reference to the timer, otherwise it is collected
+ // and won't ever fire.
+ nukeTimer = setTimeout(nukeModules, 1000);
+ }
+};
+
+function nukeModules() {
+ nukeTimer = null;
+ // module objects store `exports` which comes from sandboxes
+ // We should avoid keeping link to these object to avoid leaking sandboxes
+ for (let key in loader.modules) {
+ delete loader.modules[key];
+ }
+ // Direct links to sandboxes should be removed too
+ for (let key in loader.sandboxes) {
+ let sandbox = loader.sandboxes[key];
+ delete loader.sandboxes[key];
+ // Bug 775067: From FF17 we can kill all CCW from a given sandbox
+ unloadSandbox(sandbox);
+ }
+ loader = null;
+
+ // both `toolkit/loader` and `system/xul-app` are loaded as JSM's via
+ // `cuddlefish.js`, and needs to be unloaded to avoid memory leaks, when
+ // the addon is unload.
+
+ unloadSandbox(cuddlefishSandbox.loaderSandbox);
+ unloadSandbox(cuddlefishSandbox.xulappSandbox);
+
+ // Bug 764840: We need to unload cuddlefish otherwise it will stay alive
+ // and keep a reference to this compartment.
+ unloadSandbox(cuddlefishSandbox);
+ cuddlefishSandbox = null;
+}
View
33 addon-sdk/source/app-extension/install.rdf
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!-- 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/. -->
+
+
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+ <Description about="urn:mozilla:install-manifest">
+ <em:id>xulapp@toolness.com</em:id>
+ <em:version>1.0</em:version>
+ <em:type>2</em:type>
+ <em:bootstrap>true</em:bootstrap>
+ <em:unpack>false</em:unpack>
+
+ <!-- Firefox -->
+ <em:targetApplication>
+ <Description>
+ <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>18.0</em:minVersion>
+ <em:maxVersion>21.0a1</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+
+ <!-- Front End MetaData -->
+ <em:name>Test App</em:name>
+ <em:description>Harness for tests.</em:description>
+ <em:creator>Mozilla Corporation</em:creator>
+ <em:homepageURL></em:homepageURL>
+ <em:optionsType></em:optionsType>
+ <em:updateURL></em:updateURL>
+ </Description>
+</RDF>
View
86 addon-sdk/source/bin/activate
@@ -0,0 +1,86 @@
+# 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 must be used with "source bin/activate" *from bash*
+# you cannot run it directly
+
+deactivate () {
+ if [ -n "$_OLD_VIRTUAL_PATH" ] ; then
+ PATH="$_OLD_VIRTUAL_PATH"
+ export PATH
+ unset _OLD_VIRTUAL_PATH
+ fi
+
+ # This should detect bash and zsh, which have a hash command that must
+ # be called to get it to forget past commands. Without forgetting
+ # past commands the $PATH changes we made may not be respected
+ if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
+ hash -r
+ fi
+
+ if [ -n "$_OLD_VIRTUAL_PS1" ] ; then
+ PS1="$_OLD_VIRTUAL_PS1"
+ export PS1
+ unset _OLD_VIRTUAL_PS1
+ fi
+
+ if [ -n "$_OLD_PYTHONPATH" ] ; then
+ PYTHONPATH="$_OLD_PYTHONPATH"
+ export PYTHONPATH
+ unset _OLD_PYTHONPATH
+ fi
+
+ unset CUDDLEFISH_ROOT
+
+ unset VIRTUAL_ENV
+ if [ ! "$1" = "nondestructive" ] ; then
+ # Self destruct!
+ unset deactivate
+ fi
+}
+
+# unset irrelavent variables
+deactivate nondestructive
+
+_OLD_PYTHONPATH="$PYTHONPATH"
+_OLD_VIRTUAL_PATH="$PATH"
+
+VIRTUAL_ENV="`pwd`"
+
+if [ "x$OSTYPE" = "xmsys" ] ; then
+ CUDDLEFISH_ROOT="`pwd -W | sed s,/,\\\\\\\\,g`"
+ PATH="`pwd`/bin:$PATH"
+ # msys will convert any env vars with PATH in it to use msys
+ # form and will unconvert before launching
+ PYTHONPATH="`pwd -W`/python-lib;$PYTHONPATH"
+else
+ CUDDLEFISH_ROOT="$VIRTUAL_ENV"
+ PYTHONPATH="$VIRTUAL_ENV/python-lib:$PYTHONPATH"
+ PATH="$VIRTUAL_ENV/bin:$PATH"
+fi
+
+VIRTUAL_ENV="`pwd`"
+
+export CUDDLEFISH_ROOT
+export PYTHONPATH
+export PATH
+
+_OLD_VIRTUAL_PS1="$PS1"
+if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
+ # special case for Aspen magic directories
+ # see http://www.zetadev.com/software/aspen/
+ PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
+else
+ PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
+fi
+export PS1
+
+# This should detect bash and zsh, which have a hash command that must
+# be called to get it to forget past commands. Without forgetting
+# past commands the $PATH changes we made may not be respected
+if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
+ hash -r
+fi
+
+python -c "from jetpack_sdk_env import welcome; welcome()"
View
134 addon-sdk/source/bin/activate.bat
@@ -0,0 +1,134 @@
+@echo off
+rem This Source Code Form is subject to the terms of the Mozilla Public
+rem License, v. 2.0. If a copy of the MPL was not distributed with this
+rem file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+set VIRTUAL_ENV=%~dp0
+set VIRTUAL_ENV=%VIRTUAL_ENV:~0,-5%
+set CUDDLEFISH_ROOT=%VIRTUAL_ENV%
+
+SET PYTHONKEY=SOFTWARE\Python\PythonCore
+
+rem look for 32-bit windows and python, or 64-bit windows and python
+
+SET PYTHONVERSION=2.7
+call:CheckPython PYTHONINSTALL %PYTHONKEY%\%PYTHONVERSION%\InstallPath
+if "%PYTHONINSTALL%" NEQ "" goto FoundPython
+
+SET PYTHONVERSION=2.6
+call:CheckPython PYTHONINSTALL %PYTHONKEY%\%PYTHONVERSION%\InstallPath
+if "%PYTHONINSTALL%" NEQ "" goto FoundPython
+
+SET PYTHONVERSION=2.5
+call:CheckPython PYTHONINSTALL %PYTHONKEY%\%PYTHONVERSION%\InstallPath
+if "%PYTHONINSTALL%" NEQ "" goto FoundPython
+
+if not defined ProgramFiles(x86) goto win32
+
+rem look for 32-bit python on 64-bit windows
+
+SET PYTHONKEY=SOFTWARE\Wow6432Node\Python\PythonCore
+
+SET PYTHONVERSION=2.7
+call:CheckPython PYTHONINSTALL %PYTHONKEY%\%PYTHONVERSION%\InstallPath
+if "%PYTHONINSTALL%" NEQ "" goto FoundPython
+
+SET PYTHONVERSION=2.6
+call:CheckPython PYTHONINSTALL %PYTHONKEY%\%PYTHONVERSION%\InstallPath
+if "%PYTHONINSTALL%" NEQ "" goto FoundPython
+
+SET PYTHONVERSION=2.5
+call:CheckPython PYTHONINSTALL %PYTHONKEY%\%PYTHONVERSION%\InstallPath
+if "%PYTHONINSTALL%" NEQ "" goto FoundPython
+
+:win32
+
+SET PYTHONVERSION=
+set PYTHONKEY=
+echo Warning: Failed to find Python installation directory
+goto :EOF
+
+:FoundPython
+
+if defined _OLD_PYTHONPATH (
+ set PYTHONPATH=%_OLD_PYTHONPATH%
+)
+if not defined PYTHONPATH (
+ set PYTHONPATH=;
+)
+set _OLD_PYTHONPATH=%PYTHONPATH%
+set PYTHONPATH=%VIRTUAL_ENV%\python-lib;%PYTHONPATH%
+
+if not defined PROMPT (
+ set PROMPT=$P$G
+)
+
+if defined _OLD_VIRTUAL_PROMPT (
+ set PROMPT=%_OLD_VIRTUAL_PROMPT%
+)
+
+set _OLD_VIRTUAL_PROMPT=%PROMPT%
+set PROMPT=(%VIRTUAL_ENV%) %PROMPT%
+
+if defined _OLD_VIRTUAL_PATH goto OLDPATH
+goto SKIPPATH
+:OLDPATH
+PATH %_OLD_VIRTUAL_PATH%
+
+:SKIPPATH
+set _OLD_VIRTUAL_PATH=%PATH%
+PATH %VIRTUAL_ENV%\bin;%PYTHONINSTALL%;%PATH%
+set PYTHONKEY=
+set PYTHONINSTALL=
+set PYTHONVERSION=
+set key=
+set reg=
+set _tokens=
+python -c "from jetpack_sdk_env import welcome; welcome()"
+GOTO :EOF
+
+:CheckPython
+::CheckPython(retVal, key)
+::Reads the registry at %2% and checks if a Python exists there.
+::Checks both HKLM and HKCU, then checks the executable actually exists.
+SET key=%2%
+SET "%~1="
+SET reg=reg
+if defined ProgramFiles(x86) (
+ rem 32-bit cmd on 64-bit windows
+ if exist %WINDIR%\sysnative\reg.exe SET reg=%WINDIR%\sysnative\reg.exe
+)
+rem On Vista+, the last line of output is:
+rem (default) REG_SZ the_value
+rem (but note the word "default" will be localized.
+rem On XP, the last line of output is:
+rem <NO NAME>\tREG_SZ\tthe_value
+rem (not sure if "NO NAME" is localized or not!)
+rem SO: we use ")>" as the tokens to split on, then nuke
+rem the REG_SZ and any tabs or spaces.
+FOR /F "usebackq tokens=2 delims=)>" %%A IN (`%reg% QUERY HKLM\%key% /ve 2^>NUL`) DO SET "%~1=%%A"
+rem Remove the REG_SZ
+set PYTHONINSTALL=%PYTHONINSTALL:REG_SZ=%
+rem Remove tabs (note the literal \t in the next line
+set PYTHONINSTALL=%PYTHONINSTALL: =%
+rem Remove spaces.
+set PYTHONINSTALL=%PYTHONINSTALL: =%
+if exist %PYTHONINSTALL%\python.exe goto :EOF
+rem It may be a 32bit Python directory built from source, in which case the
+rem executable is in the PCBuild directory.
+if exist %PYTHONINSTALL%\PCBuild\python.exe (set "PYTHONINSTALL=%PYTHONINSTALL%\PCBuild" & goto :EOF)
+rem Or maybe a 64bit build directory.
+if exist %PYTHONINSTALL%\PCBuild\amd64\python.exe (set "PYTHONINSTALL=%PYTHONINSTALL%\PCBuild\amd64" & goto :EOF)
+
+rem And try HKCU
+FOR /F "usebackq tokens=2 delims=)>" %%A IN (`%reg% QUERY HKCU\%key% /ve 2^>NUL`) DO SET "%~1=%%A"
+set PYTHONINSTALL=%PYTHONINSTALL:REG_SZ=%
+set PYTHONINSTALL=%PYTHONINSTALL: =%
+set PYTHONINSTALL=%PYTHONINSTALL: =%
+if exist %PYTHONINSTALL%\python.exe goto :EOF
+if exist %PYTHONINSTALL%\PCBuild\python.exe (set "PYTHONINSTALL=%PYTHONINSTALL%\PCBuild" & goto :EOF)
+if exist %PYTHONINSTALL%\PCBuild\amd64\python.exe (set "PYTHONINSTALL=%PYTHONINSTALL%\PCBuild\amd64" & goto :EOF)
+rem can't find it here, so arrange to try the next key
+set PYTHONINSTALL=
+
+GOTO :EOF
View
99 addon-sdk/source/bin/activate.ps1
@@ -0,0 +1,99 @@
+# 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/.
+
+$Env:VIRTUAL_ENV = (gl);
+$Env:CUDDLEFISH_ROOT = $Env:VIRTUAL_ENV;
+
+# http://stackoverflow.com/questions/5648931/powershell-test-if-registry-value-exists/5652674#5652674
+Function Test-RegistryValue {
+ param(
+ [Alias("PSPath")]
+ [Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
+ [String]$Path
+ ,
+ [Parameter(Position = 1, Mandatory = $true)]
+ [String]$Name
+ ,
+ [Switch]$PassThru
+ )
+
+ process {
+ if (Test-Path $Path) {
+ $Key = Get-Item -LiteralPath $Path
+ if ($Key.GetValue($Name, $null) -ne $null) {
+ if ($PassThru) {
+ Get-ItemProperty $Path $Name
+ } else {
+ $true
+ }
+ } else {
+ $false
+ }
+ } else {
+ $false
+ }
+ }
+}
+
+$WINCURVERKEY = 'HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion';
+$WIN64 = (Test-RegistryValue $WINCURVERKEY 'ProgramFilesDir (x86)');
+
+if($WIN64) {
+ $PYTHONKEY='HKLM:SOFTWARE\Wow6432Node\Python\PythonCore';
+}
+else {
+ $PYTHONKEY='HKLM:SOFTWARE\Python\PythonCore';
+}
+
+$Env:PYTHONVERSION = '';
+$Env:PYTHONINSTALL = '';
+
+foreach ($version in @('2.6', '2.5', '2.4')) {
+ if (Test-RegistryValue "$PYTHONKEY\$version\InstallPath" '(default)') {
+ $Env:PYTHONVERSION = $version;
+ }
+}
+
+if ($Env:PYTHONVERSION) {
+ $Env:PYTHONINSTALL = (Get-Item "$PYTHONKEY\$version\InstallPath)").'(default)';
+}
+
+if ($Env:PYTHONINSTALL) {
+ $Env:Path += ";$Env:PYTHONINSTALL";
+}
+
+if (Test-Path Env:_OLD_PYTHONPATH) {
+ $Env:PYTHONPATH = $Env:_OLD_PYTHONPATH;
+}
+else {
+ $Env:PYTHONPATH = '';
+}
+
+$Env:_OLD_PYTHONPATH=$Env:PYTHONPATH;
+$Env:PYTHONPATH= "$Env:VIRTUAL_ENV\python-lib;$Env:PYTHONPATH";
+
+if (Test-Path Function:_OLD_VIRTUAL_PROMPT) {
+ Set-Content Function:Prompt (Get-Content Function:_OLD_VIRTUAL_PROMPT);
+}
+else {
+ function global:_OLD_VIRTUAL_PROMPT {}
+}
+
+Set-Content Function:_OLD_VIRTUAL_PROMPT (Get-Content Function:Prompt);
+
+function global:prompt { "($Env:VIRTUAL_ENV) $(_OLD_VIRTUAL_PROMPT)"; };
+
+if (Test-Path Env:_OLD_VIRTUAL_PATH) {
+ $Env:PATH = $Env:_OLD_VIRTUAL_PATH;
+}
+else {
+ $Env:_OLD_VIRTUAL_PATH = $Env:PATH;
+}
+
+$Env:Path="$Env:VIRTUAL_ENV\bin;$Env:Path"
+
+[System.Console]::WriteLine("Note: this PowerShell SDK activation script is experimental.")
+
+python -c "from jetpack_sdk_env import welcome; welcome()"
+
View
33 addon-sdk/source/bin/cfx
@@ -0,0 +1,33 @@
+#! /usr/bin/env python
+# 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 sys
+
+# set the cuddlefish "root directory" for this process if it's not already
+# set in the environment
+cuddlefish_root = os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0])))
+
+if 'CUDDLEFISH_ROOT' not in os.environ:
+ os.environ['CUDDLEFISH_ROOT'] = cuddlefish_root
+
+# add our own python-lib path to the python module search path.
+python_lib_dir = os.path.join(cuddlefish_root, "python-lib")
+if python_lib_dir not in sys.path:
+ sys.path.insert(0, python_lib_dir)
+
+# now export to env so sub-processes get it too
+if 'PYTHONPATH' not in os.environ:
+ os.environ['PYTHONPATH'] = python_lib_dir
+elif python_lib_dir not in os.environ['PYTHONPATH'].split(os.pathsep):
+ paths = os.environ['PYTHONPATH'].split(os.pathsep)
+ paths.insert(0, python_lib_dir)
+ os.environ['PYTHONPATH'] = os.pathsep.join(paths)
+
+import cuddlefish
+
+if __name__ == '__main__':
+ cuddlefish.run()
View
6 addon-sdk/source/bin/cfx.bat
@@ -0,0 +1,6 @@
+@echo off
+rem This Source Code Form is subject to the terms of the Mozilla Public
+rem License, v. 2.0. If a copy of the MPL was not distributed with this
+rem file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+python "%VIRTUAL_ENV%\bin\cfx" %*
View
23 addon-sdk/source/bin/deactivate.bat
@@ -0,0 +1,23 @@
+@echo off
+rem This Source Code Form is subject to the terms of the Mozilla Public
+rem License, v. 2.0. If a copy of the MPL was not distributed with this
+rem file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+if defined _OLD_VIRTUAL_PROMPT (
+ set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
+)
+set _OLD_VIRTUAL_PROMPT=
+
+if defined _OLD_VIRTUAL_PATH (
+ set "PATH=%_OLD_VIRTUAL_PATH%"
+)
+set _OLD_VIRTUAL_PATH=
+
+if defined _OLD_PYTHONPATH (
+ set "PYTHONPATH=%_OLD_PYTHONPATH%"
+)
+set _OLD_PYTHONPATH=
+
+set CUDDLEFISH_ROOT=
+
+:END
View
14 addon-sdk/source/bin/integration-scripts/buildbot-run-cfx-helper
@@ -0,0 +1,14 @@
+#!/bin/bash
+# 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/.
+
+
+source ./bin/activate
+if [ type -P xvfb-run ]
+then
+ xvfb-run cfx $*
+else
+ cfx $*
+fi
+deactivate
View
364 addon-sdk/source/bin/integration-scripts/integration-check
@@ -0,0 +1,364 @@
+#!/usr/bin/env python
+# 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 signal
+import threading
+import urllib2, urllib
+import zipfile
+import tarfile
+import subprocess
+import optparse
+import sys, re
+#import win32api
+
+
+class SDK:
+ def __init__(self):
+ try:
+ # Take the current working directory
+ self.default_path = os.getcwd()
+ if sys.platform == "win32":
+ self.mswindows = True
+ else:
+ self.mswindows = False
+ # Take the default home path of the user.
+ home = os.path.expanduser('~')
+
+ # The following are the parameters that can be used to pass a dynamic URL, a specific path or a binry. The binary is not used yet. It will be used in version 2.0
+ # If a dynamic path is to be mentioned, it should start with a '/'. For eg. "/Desktop"
+ parser = optparse.OptionParser()
+ parser.add_option('-u', '--url', dest = 'url', default = 'https://ftp.mozilla.org/pub/mozilla.org/labs/jetpack/addon-sdk-latest.zip')
+ parser.add_option('-p', '--path', dest = 'path', default = self.default_path)
+ parser.add_option('-b', '--binary', dest = 'binary')#, default='/Applications/Firefox.app')
+ (options, args) = parser.parse_args()
+
+ # Get the URL from the parameter
+ self.link = options.url
+ # Set the base path for the user. If the user supplies the path, use the home variable as well. Else, take the default path of this script as the installation directory.
+ if options.path!=self.default_path:
+ if self.mswindows:
+ self.base_path = home + str(options.path).strip() + '\\'
+ else:
+ self.base_path = home + str(options.path).strip() + '/'
+ else:
+ if self.mswindows:
+ self.base_path = str(options.path).strip() + '\\'
+ else:
+ self.base_path = str(options.path).strip() + '/'
+ assert ' ' not in self.base_path, "You cannot have a space in your home path. Please remove the space before you continue."
+ print('Your Base path is =' + self.base_path)
+
+ # This assignment is not used in this program. It will be used in version 2 of this script.
+ self.bin = options.binary
+ # if app or bin is empty, dont pass anything
+
+ # Search for the .zip file or tarball file in the URL.
+ i = self.link.rfind('/')
+
+ self.fname = self.link[i+1:]
+ z = re.search('zip',self.fname,re.I)
+ g = re.search('gz',self.fname,re.I)
+ if z:
+ print 'zip file present in the URL.'
+ self.zip = True
+ self.gz = False
+ elif g:
+ print 'gz file present in the URL'
+ self.gz = True
+ self.zip = False
+ else:
+ print 'zip/gz file not present. Check the URL.'
+ return
+ print("File name is =" + self.fname)
+
+ # Join the base path and the zip/tar file name to crate a complete Local file path.
+ self.fpath = self.base_path + self.fname
+ print('Your local file path will be=' + self.fpath)
+ except AssertionError, e:
+ print e.args[0]
+ sys.exit(1)
+
+ # Download function - to download the SDK from the URL to the local machine.
+ def download(self,url,fpath,fname):
+ try:
+ # Start the download
+ print("Downloading...Please be patient!")
+ urllib.urlretrieve(url,filename = fname)
+ print('Download was successful.')
+ except ValueError: # Handles broken URL errors.
+ print 'The URL is ether broken or the file does not exist. Please enter the correct URL.'
+ raise
+ except urllib2.URLError: # Handles URL errors
+ print '\nURL not correct. Check again!'
+ raise
+
+ # Function to extract the downloaded zipfile.
+ def extract(self, zipfilepath, extfile):
+ try:
+ # Timeout is set to 30 seconds.
+ timeout = 30
+ # Change the directory to the location of the zip file.
+ try:
+ os.chdir(zipfilepath)
+ except OSError:
+ # Will reach here if zip file doesnt exist
+ print 'O/S Error:' + zipfilepath + 'does not exist'
+ raise
+
+ # Get the folder name of Jetpack to get the exact version number.
+ if self.zip:
+ try:
+ f = zipfile.ZipFile(extfile, "r")
+ except IOError as (errno, strerror): # Handles file errors
+ print "I/O error - Cannot perform extract operation: {1}".format(errno, strerror)
+ raise
+ list = f.namelist()[0]
+ temp_name = list.split('/')
+ print('Folder Name= ' +temp_name[0])
+ self.folder_name = temp_name[0]
+ elif self.gz:
+ try:
+ f = tarfile.open(extfile,'r')
+ except IOError as (errno, strerror): # Handles file errors
+ print "I/O error - Cannot perform extract operation: {1}".format(errno, strerror)
+ raise
+ list = f.getnames()[0]
+ temp_name = list.split('/')
+ print('Folder Name= ' +temp_name[0])
+ self.folder_name = temp_name[0]
+
+ print ('Starting to Extract...')
+
+ # Timeout code. The subprocess.popen exeutes the command and the thread waits for a timeout. If the process does not finish within the mentioned-
+ # timeout, the process is killed.
+ kill_check = threading.Event()
+
+ if self.zip:
+ # Call the command to unzip the file.
+ if self.mswindows:
+ zipfile.ZipFile.extractall(f)
+ else:
+ p = subprocess.Popen('unzip '+extfile, stdout=subprocess.PIPE, shell=True)
+ pid = p.pid
+ elif self.gz:
+ # Call the command to untar the file.
+ if self.mswindows:
+ tarfile.TarFile.extractall(f)
+ else:
+ p = subprocess.Popen('tar -xf '+extfile, stdout=subprocess.PIPE, shell=True)
+ pid = p.pid
+
+ #No need to handle for windows because windows automatically replaces old files with new files. It does not ask the user(as it does in Mac/Unix)
+ if self.mswindows==False:
+ watch = threading.Timer(timeout, kill_process, args=(pid, kill_check, self.mswindows ))
+ watch.start()
+ (stdout, stderr) = p.communicate()
+ watch.cancel() # if it's still waiting to run
+ success = not kill_check.isSet()
+
+ # Abort process if process fails.
+ if not success:
+ raise RuntimeError
+ kill_check.clear()
+ print('Extraction Successful.')
+ except RuntimeError:
+ print "Ending the program"
+ sys.exit(1)
+ except:
+ print "Error during file extraction: ", sys.exc_info()[0]
+ raise
+
+ # Function to run the cfx testall comands and to make sure the SDK is not broken.
+ def run_testall(self, home_path, folder_name):
+ try:
+ timeout = 500
+
+ self.new_dir = home_path + folder_name
+ try:
+ os.chdir(self.new_dir)
+ except OSError:
+ # Will reach here if the jetpack 0.X directory doesnt exist
+ print 'O/S Error: Jetpack directory does not exist at ' + self.new_dir
+ raise
+ print '\nStarting tests...'
+ # Timeout code. The subprocess.popen exeutes the command and the thread waits for a timeout. If the process does not finish within the mentioned-
+ # timeout, the process is killed.
+ kill_check = threading.Event()
+
+ # Set the path for the logs. They will be in the parent directory of the Jetpack SDK.
+ log_path = home_path + 'tests.log'
+
+ # Subprocess call to set up the jetpack environment and to start the tests. Also sends the output to a log file.
+ if self.bin != None:
+ if self.mswindows:
+ p = subprocess.Popen("bin\\activate && cfx testall -a firefox -b \"" + self.bin + "\"" , stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ proc_handle = p._handle
+ (stdout,stderr) = p.communicate()
+ else:
+ p = subprocess.Popen('. bin/activate; cfx testall -a firefox -b ' + self.bin , stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ pid = p.pid
+ (stdout,stderr) = p.communicate()
+ elif self.bin == None:
+ if self.mswindows:
+ p=subprocess.Popen('bin\\activate && cfx testall -a firefox > '+log_path, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ proc_handle = p._handle
+ (stdout,stderr) = p.communicate()
+ else:
+ p = subprocess.Popen('. bin/activate; cfx testall -a firefox > '+log_path, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ pid = p.pid
+ (stdout,stderr) = p.communicate()
+
+ #Write the output to log file
+ f=open(log_path,"w")
+ f.write(stdout+stderr)
+ f.close()
+
+ #Watchdog for timeout process
+ if self.mswindows:
+ watch = threading.Timer(timeout, kill_process, args=(proc_handle, kill_check, self.mswindows))
+ else:
+ watch = threading.Timer(timeout, kill_process, args=(pid, kill_check, self.mswindows))
+ watch.start()
+ watch.cancel() # if it's still waiting to run
+ success = not kill_check.isSet()
+ if not success:
+ raise RuntimeError
+ kill_check.clear()
+
+ if p.returncode!=0:
+ print('\nAll tests were not successful. Check the test-logs in the jetpack directory.')
+ result_sdk(home_path)
+ #sys.exit(1)
+ raise RuntimeError
+ else:
+ ret_code=result_sdk(home_path)
+ if ret_code==0:
+ print('\nAll tests were successful. Yay \o/ . Running a sample package test now...')
+ else:
+ print ('\nThere were errors during the tests.Take a look at logs')
+ raise RuntimeError
+ except RuntimeError:
+ print "Ending the program"
+ sys.exit(1)
+ except:
+ print "Error during the testall command execution:", sys.exc_info()[0]
+ raise
+
+ def package(self, example_dir):
+ try:
+ timeout = 30
+
+ print '\nNow Running packaging tests...'
+
+ kill_check = threading.Event()
+
+ # Set the path for the example logs. They will be in the parent directory of the Jetpack SDK.
+ exlog_path = example_dir + 'test-example.log'
+ # Subprocess call to test the sample example for packaging.
+ if self.bin!=None:
+ if self.mswindows:
+ p = subprocess.Popen('bin\\activate && cfx run --pkgdir examples\\reading-data --static-args="{\\"quitWhenDone\\":true}" -b \"" + self.bin + "\"' , stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ proc_handle = p._handle
+ (stdout, stderr) = p.communicate()
+ else:
+ p = subprocess.Popen('. bin/activate; cfx run --pkgdir examples/reading-data --static-args=\'{\"quitWhenDone\":true}\' -b ' + self.bin , stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ pid = p.pid
+ (stdout, stderr) = p.communicate()
+ elif self.bin==None:
+ if self.mswindows:
+ p = subprocess.Popen('bin\\activate && cfx run --pkgdir examples\\reading-data --static-args="{\\"quitWhenDone\\":true}"', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ proc_handle = p._handle
+ (stdout, stderr) = p.communicate()
+ else:
+ p = subprocess.Popen('. bin/activate; cfx run --pkgdir examples/reading-data --static-args=\'{\"quitWhenDone\":true}\' ', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ pid = p.pid
+ (stdout, stderr) = p.communicate()
+
+ #Write the output to log file
+ f=open(exlog_path,"w")
+ f.write(stdout+stderr)
+ f.close()
+
+ #Watch dog for timeout process
+ if self.mswindows:
+ watch = threading.Timer(timeout, kill_process, args=(proc_handle, kill_check, self.mswindows))
+ else:
+ watch = threading.Timer(timeout, kill_process, args=(pid, kill_check, self.mswindows))
+ watch.start()
+ watch.cancel() # if it's still waiting to run
+ success = not kill_check.isSet()
+ if not success:
+ raise RuntimeError
+ kill_check.clear()
+
+ if p.returncode != 0:
+ print('\nSample tests were not executed correctly. Check the test-example log in jetpack diretory.')
+ result_example(example_dir)
+ raise RuntimeError
+ else:
+ ret_code=result_example(example_dir)
+ if ret_code==0:
+ print('\nAll tests pass. The SDK is working! Yay \o/')
+ else:
+ print ('\nTests passed with warning.Take a look at logs')
+ sys.exit(1)
+
+ except RuntimeError:
+ print "Ending program"
+ sys.exit(1)
+ except:
+ print "Error during running sample tests:", sys.exc_info()[0]
+ raise
+
+def result_sdk(sdk_dir):
+ log_path = sdk_dir + 'tests.log'
+ print 'Results are logged at:' + log_path
+ try:
+ f = open(log_path,'r')
+ # Handles file errors
+ except IOError :
+ print 'I/O error - Cannot open test log at ' + log_path
+ raise
+
+ for line in reversed(open(log_path).readlines()):
+ if line.strip()=='FAIL':
+ print ('\nOverall result - FAIL. Look at the test log at '+log_path)
+ return 1
+ return 0
+
+
+def result_example(sdk_dir):
+ exlog_path = sdk_dir + 'test-example.log'
+ print 'Sample test results are logged at:' + exlog_path
+ try:
+ f = open(exlog_path,'r')
+ # Handles file errors
+ except IOError :
+ print 'I/O error - Cannot open sample test log at ' + exlog_path
+ raise
+
+ #Read the file in reverse and check for the keyword 'FAIL'.
+ for line in reversed(open(exlog_path).readlines()):
+ if line.strip()=='FAIL':
+ print ('\nOverall result for Sample tests - FAIL. Look at the test log at '+exlog_path)
+ return 1
+ return 0
+
+def kill_process(process, kill_check, mswindows):
+ print '\nProcess Timedout. Killing the process. Please Rerun this script.'
+ if mswindows:
+ win32api.TerminateProcess(process, -1)
+ else:
+ os.kill(process, signal.SIGKILL)
+ kill_check.set()# tell the main routine to kill. Used SIGKILL to hard kill the process.
+ return
+
+if __name__ == "__main__":
+ obj = SDK()
+ obj.download(obj.link,obj.fpath,obj.fname)
+ obj.extract(obj.base_path,obj.fname)
+ obj.run_testall(obj.base_path,obj.folder_name)
+ obj.package(obj.base_path)
View
13 addon-sdk/source/data/index.html
@@ -0,0 +1,13 @@
+<!-- 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>
+ <meta charset="UTF-8">
+ <title>Add-on Page</title>
+ </head>
+ <body>
+ <p>This is an add-on page test!</p>
+ </body>
+</html>
View
49 addon-sdk/source/data/mofo_logo.SVG
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generator: Adobe Illustrator 12.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 51448) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY ns_svg "http://www.w3.org/2000/svg">
+ <!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg version="1.1" id="svg2997" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200" viewBox="-0.5 -0.5 200 200" overflow="visible" enable-background="new -0.5 -0.5 200 200" xml:space="preserve">
+<path id="path85" fill="#FFFFFF" d="M-2559.936,6359.65c19.127,26.489,46.371,47.744,80.988,44.707 C-2479.339,6371.648-2523.898,6352.641-2559.936,6359.65z"/>
+<path id="path93" fill="#FFFFFF" d="M-2634.014,6073.506c4.082-7.232,2.571-17.81,3.831-26.684 c-9.019,4.635-15.506,14.72-24.551,18.641C-2652.134,6070.818-2640.447,6070.829-2634.014,6073.506z"/>
+<path id="path95" fill="#FFFFFF" d="M-2687.179,6018.109l-18.654,18.212c4.158,3.301,9.676,8.132,17.11,6.36L-2687.179,6018.109z"/>
+<path id="path97" fill="#FFFFFF" d="M-2731.117,5998.391c-4.356-0.363-14.41,20.156-18.785,19.857l14.762,8.728 C-2730.055,6027.281-2732.816,6001.961-2731.117,5998.391L-2731.117,5998.391z"/>
+<path id="path99" fill="#FFFFFF" d="M-2776.505,5989.09l4.736-11.668c-10.245,0.813-15.511,20.68-21.719,26.244 C-2776.37,6007.109-2775.727,6011.81-2776.505,5989.09z"/>
+<path id="path101" fill="#FFFFFF" d="M-2825.16,5962.186l-18.405,31.539l17.091,3.962L-2825.16,5962.186L-2825.16,5962.186z"/>
+<path id="path103" fill="#FFFFFF" d="M-2872.173,5967.636l-21.059,16.139C-2872.035,5992.07-2870.821,5995.181-2872.173,5967.636z"/>
+<path id="path105" fill="#FFFFFF" d="M-2922.987,5980.398c-3.084-9.172-0.18-20.226,0.396-29.914 c-4.952,9.422-16.338,16.166-17.745,27.299C-2935.489,5981.802-2928.796,5980.021-2922.987,5980.398L-2922.987,5980.398z"/>
+<g>
+ <path id="path9" d="M70.165,21.946C62.09,27.292,49.432,38.35,43.382,44.795c1.491,0.208,3.068-0.957,4.751-1.179l11.635-3.192 c-4.833,4.151-15.001,11.47-17.946,17.234c3.632-1.309,11.254-5.699,15.043-6.059c-3.309,3.038-10.214,8.801-12.378,12.469 c0.261,0.124,0.08,0.445,0.12,0.669c2.846-1.635,9.763-5.91,12.9-6.199c-3.229,3.484-9.169,10.193-10.47,14.688 c2.804-1.913,9.856-5.792,12.944-6.969c-0.703,1.773-2.262,3.09-3.276,4.864c-1.399,2.453-4.711,5.246-4.834,8.161 c2.46-2.375,5.51-4.474,8.571-6.148c-1.365,2.947-3.876,5.384-4.561,8.892c2.007-2.02,5.813-3.071,8.399-4.005l-0.312,0.311 c-0.224,0.191-3.136,2.335-5.121,4.727c1.765-0.114,0.449-0.334,2.707,0.18l-0.043,0.114 c-0.154,13.494,25.501,18.427,41.224,17.743c3.314-6.419,1.525-16.789,10.088-21.247c5.764-3.067,6.416-4.742,13.068-3.491 c3.596,0.674,11.461,3.392,15.227,2.534c3.514-2.033,5.221-2.928,8.332-5.37c3.01-4.574-23.988-19.398-2.164-0.171 c5.236,1.121,6.588,0.954,8.139-1.376c0.693-1.88,2.348-6.877,3.859-10.133l0.107-1.76c-1.467-4.414-1.111-11.965-1.852-13.053 c-4.842-6.713-22.34-7.764-30.256-16.596c1.35-4.384-1.482-7.997-4.367-10.738c-4.332-3.187-10.313-1.722-14.925-0.399 c-5.255-1.099-10.117-2.986-15.233-4.48C81.381,13.626,70.165,21.946,70.165,21.946L70.165,21.946z"/>
+ <path id="path11" fill="#FF1A00" d="M103.517,25.68l-3.771,1.438c-0.453-0.901,0.676-1.757,1.126-2.599 c0.322-0.616,1.247-0.961,1.465-1.705c-4.877-0.786-9.486-3.178-14.688-2.354c-5.563,0.878-8.802,3.003-12.005,5.54 c-1.617,0.885-2.396,2.142-3.968,3.201c-1.92,1.729-2.755,5.176-3.233,5.833c2.785-1.206,5.587-1.026,7.479-1.663 c-7.115,4.447-8.358,13.134-6.39,20.38l-0.116,0.159c-2.391-1.429-3.083-4.065-3.745-6.371c-0.471,1.515-0.538,3.44-0.859,5.132 c-0.764-0.713-1.184-1.734-1.61-2.644c-0.799,7.668,2.938,13.913,7.521,19.966c3.068,4.058-2.923,6.744-1.512,11.838l7.206-0.404 c0.929-0.348,0.64-0.223,0.64-0.223c-1.806,3.613-11.365,6.352-13.201,8.417c0.513,0.425,8.917-2.164,11.991-2.687l-9.045,5.112 c0.899,0.277-0.028,3.311,1.946,3.023c12.508,3.713,26.597,8.866,28.792,3.488c1.831-3.419,4.541-9.21,4.122-12.49l1.941-2.949 c-2.59,0.643-5.199,1.691-7.202,3.823c-0.599-1.256,0.342-2.763,0.81-3.951c1.343-2.41,4.026-3.686,6.151-5.056l-4.464-1.976 c-2.25-3.864-6.523-7.047-6.639-11.586l1.057,0.36c4.069,4.621,9.854,8.371,15.647,8.639c-3.943-0.338,16.471-2.743,15.271-4.472 c2.17,3.121,8.729,4.432,13.52,6.071c2.201-0.792,3.162-0.566,4.816-2.057c-0.705-0.765-1.795-1.39-2.844-1.787 c-6.295-1.738-21.162-4.796-24.365-10.986c-0.604,2.637,1.838,4.812,4.566,7.061l-5.873-0.826 c-10.331-4.782-9.083-12.984-6.813-20.78l0.785,6.508l2.025,3.548c3.851-6.966,1.835-6.1-5.898-15.494l5.832,2.228 c2.663,2.142,7.04,5.845,10.921,8.417c10.453,6.845,15.625,11.381,28.891,12.311l4.092,0.908c2.896-7.59-2.719-14.597-1.021-3.989 c-2.166-2.631-4.283-5.066-3.842-6.439c-0.76-1.147,3.143-4.014,2.811-5.319c-3.83-3.894-20.389-5.984-29.381-14.907 c-0.264,1.492,4.158,5.354,4.924,6.683c-8.918,0.088-14.174-2.651-15.127-5.542c-0.195-0.481,0.047-2.623,0.998-3.313 c1.287-0.672,2.541-1.693,4.02-1.83c-2.316-1.891-5.25,0.643-7.302,1.788c-1.594,2.737,0.889,5.788,1.202,8.014 c-2.175-0.549-5.111-4.378-5.471-6.782c-3.306,0.362-6.34-0.065-8.881-1.974c2.243-0.492,4.56-1.331,6.906-1.755 c6.143-1.34,12.598-7.655,18.803-2.72l-2.889-3.672C113.848,21.654,108.812,24.342,103.517,25.68L103.517,25.68z"/>
+ <path id="path13" d="M83.254,28.459c-1.649,1.924-3.302,3.85-3.687,6.437l0.369,0.434c1.102-1.326,2.753-2.437,4.274-3.207 c0.002,2.726,1.76,5.399,4.11,6.713l0.395,0.028c-0.498-2.879-0.166-6.399,0.96-8.998c1.793-1.508,4.151-2.106,5.668-3.692 c-3.797-0.888-7.411-0.136-10.658,1.1L83.254,28.459L83.254,28.459z"/>
+ <path id="path15" fill="#FFFFFF" d="M121.379,36.471c-1.561-2.157-3.777-3.888-6.594-3.642 C114.814,35.491,118.443,37.043,121.379,36.471z"/>
+ <path id="path17" d="M98.854,36.815c-2.445,0.187-4.736,0.622-7.041,1.224c1.017,0.937,2.302,1.252,3.266,2.129 c-3.017,1.137-6.176,1.861-8.813,4.186l0.546,0.325c4.878-1.015,10.645-0.929,15.732,0.16l0.294-0.212l-2.948-5.361l4.533-0.981 c-2.405-2.249-5.156-4.46-8.322-5.422C96.585,34.171,97.917,35.479,98.854,36.815L98.854,36.815L98.854,36.815z"/>
+ <path id="path19" d="M116.564,42.189c2.406,0.445,5.064,0.503,7.357,0.074c-3.787-1.932-8.625-1.552-11.639-4.944 C112.852,39.099,114.086,41.968,116.564,42.189z"/>
+ <path id="path21" d="M80.567,55.828c0.943,3.023-2.23,6.707,0.312,9.485c2.165,2.522,4.81,4.614,7.354,6.464l-0.225-0.943 c-2.266-2.647-4.349-5.569-5.396-8.716c2.656,0.928,5.463,2.216,8.496,2.646c-3.416-5.104-9.678-9.984-7.319-16.97 c0.129-1.154,1.655-2.041,1.271-3.113C81.49,47.408,79.996,51.435,80.567,55.828L80.567,55.828z"/>
+ <path id="path23" fill="#FFFFFF" d="M127.412,59.77c-0.334,0.589-0.213,1.45-0.316,2.174c0.738-0.379,1.264-1.199,2-1.518 C128.883,59.988,127.934,59.986,127.412,59.77z"/>
+ <path id="path25" fill="#FFFFFF" d="M131.738,64.284l1.518-1.487c-0.336-0.267-0.785-0.661-1.395-0.518L131.738,64.284z"/>
+ <path id="path27" fill="#FFFFFF" d="M135.316,65.887c0.355,0.026,1.174-1.643,1.531-1.618l-1.203-0.711 C135.229,63.532,135.455,65.593,135.316,65.887z"/>
+ <path id="path29" fill="#FFFFFF" d="M139.012,66.644l-0.385,0.95c0.836-0.067,1.264-1.684,1.766-2.138 C139.002,65.177,138.949,64.793,139.012,66.644z"/>
+ <path id="path31" fill="#FFFFFF" d="M142.977,68.834l1.498-2.569l-1.395-0.32L142.977,68.834z"/>
+ <path id="path33" fill="#FFFFFF" d="M146.801,68.39l1.715-1.312C146.789,66.4,146.691,66.147,146.801,68.39z"/>
+ <path id="path35" fill="#FFFFFF" d="M150.938,67.35c0.254,0.748,0.02,1.647-0.031,2.436c0.404-0.766,1.332-1.313,1.445-2.221 C151.957,67.233,151.412,67.382,150.938,67.35L150.938,67.35z"/>
+ <path id="path37" d="M99.399,96.021c0.547,1.031,0.572,2.285,1.119,3.315c1.295-2.793,1.147-6.148-0.533-8.659 c-2.923-1.288-5.745-2.625-8.264-4.671C92.768,89.577,96.192,93.513,99.399,96.021L99.399,96.021z"/>
+ <path id="path71" d="M117.387,36.775c-0.953-0.248-1.51-1.317-1.25-2.393c0.268-1.079,1.252-1.75,2.207-1.502 c0.955,0.245,1.512,1.318,1.25,2.393C119.328,36.348,118.34,37.021,117.387,36.775z"/>
+ <path id="path75" d="M98.356,103.161l2.835-2.31c-2.758-1.791-7.426-5.004-9.95-7.387C93.224,97.589,93.284,102.152,98.356,103.161 z"/>
+ <path id="path2225" d="M57.859,84.722c11.552,15.175,27.262,21.19,46.412,19.542l-1.629-3.542 c-17.031,0.631-31.21-3.592-40.875-17.588L57.859,84.722z"/>
+ <path id="path2343" d="M10.063,170.061c2.903,0.027,5.809-0.039,8.712,0.014l-0.375,2.293l-5.096,0.02l-0.021,3.24h4.088v2.342 h-4.088v6.334h-3.22V170.061z"/>
+ <path id="path3315" d="M30.648,184.227c-2.242-0.338-3.854-1.586-4.75-3.68c-0.511-1.191-0.656-2.105-0.596-3.748 c0.061-1.664,0.254-2.451,0.886-3.605c0.814-1.488,1.881-2.344,3.555-2.846c0.877-0.266,1.065-0.291,2.274-0.293 c1.095-0.004,1.446,0.029,2.078,0.201c2.303,0.627,3.802,2.172,4.426,4.559c0.288,1.105,0.265,3.764-0.042,4.846 c-0.697,2.463-2.385,4.098-4.674,4.527C33.093,184.322,31.412,184.342,30.648,184.227z M32.991,181.963 c0.926-0.281,1.579-1.137,1.876-2.463c0.205-0.91,0.238-3.596,0.058-4.547c-0.335-1.762-1.328-2.654-2.957-2.656 c-1.589-0.002-2.456,0.793-2.912,2.67c-0.214,0.883-0.238,3.438-0.041,4.396c0.279,1.357,0.877,2.211,1.761,2.512 C31.381,182.082,32.455,182.123,32.991,181.963z"/>
+ <path id="flowRoot5258" d="M47.563,170.053h3.446v8.381c0,1.154,0.179,1.98,0.537,2.48c0.364,0.492,0.955,0.883,1.772,0.883 c0.823,0,1.414-0.391,1.772-0.883c0.364-0.5,0.546-1.326,0.546-2.48v-8.381h3.445v8.381c0,1.979-0.474,3.451-1.423,4.418 c-0.948,0.967-2.396,1.451-4.34,1.451c-1.939,0-3.383-0.484-4.331-1.451c-0.949-0.967-1.423-2.439-1.423-4.418V170.053"/>
+ <path id="path6262" d="M68.606,170.053l3.509,0.051c1.381,2.793,2.899,5.531,4.078,8.41l0.197,0.504l-0.049-1.01l-0.18-7.951h2.948 v14.246h-3.182l-0.363-0.758c-1.15-2.398-3.13-6.629-3.602-7.697c-0.302-0.684-0.524-1.137-0.495-1.012 c0.029,0.127,0.083,2.309,0.119,4.848l0.065,4.619h-3.047V170.053z"/>
+ <path id="text8203" d="M92.398,182.191l0.931,0.002c0.986,0,1.843-1.076,2.366-1.844c0.522-0.766,0.977-1.873,0.977-3.322 c0-1.424-0.431-2.496-0.905-3.213c-0.469-0.725-1.17-1.424-2.104-1.424l-1.265-0.002v9.805 M88.878,184.303v-14.25h4.209 c1.173,0,2.12,0.104,2.84,0.311c0.72,0.201,1.357,0.529,1.912,0.986c0.8,0.65,1.393,1.455,1.776,2.41 c0.39,0.949,0.584,2.084,0.584,3.404c0,1.223-0.2,2.328-0.6,3.314c-0.4,0.986-0.981,1.813-1.744,2.482 c-0.544,0.475-1.155,0.818-1.832,1.031c-0.678,0.207-1.558,0.311-2.641,0.311H88.878"/>
+ <path id="path9182" d="M106.307,184.277l5.092-14.225h3.457c1.617,4.746,3.281,9.477,4.885,14.225l-3.457,0.023l-1.084-3.391 l-4.433,0.002l-1.083,3.389C108.559,184.289,107.431,184.324,106.307,184.277z M113.051,173.643l-1.51,4.887h2.873 C113.82,176.934,113.57,175.254,113.051,173.643z"/>
+ <path id="path10154" d="M127.924,172.535h-3.867v-2.48c3.799,0,7.6-0.004,11.4,0c-0.002,0-0.529,2.479-0.529,2.479l-3.748,0.002 v11.768h-3.256V172.535z"/>
+ <path id="path11126" d="M142.326,170.053h3.471v14.242h-3.471V170.053z"/>
+ <path id="path14040" d="M159.949,184.227c-2.24-0.338-3.854-1.586-4.748-3.68c-0.512-1.191-0.656-2.105-0.598-3.748 c0.061-1.664,0.254-2.451,0.885-3.605c0.816-1.488,1.883-2.344,3.557-2.846c0.877-0.266,1.064-0.291,2.275-0.293 c1.094-0.004,1.445,0.029,2.076,0.201c2.305,0.627,3.803,2.172,4.426,4.559c0.289,1.105,0.266,3.764-0.041,4.846 c-0.697,2.463-2.387,4.098-4.676,4.527C162.395,184.322,160.713,184.342,159.949,184.227z M162.293,181.963 c0.926-0.281,1.578-1.137,1.875-2.463c0.205-0.91,0.24-3.596,0.059-4.547c-0.336-1.762-1.328-2.654-2.957-2.656 c-1.59-0.002-2.457,0.793-2.912,2.67c-0.215,0.883-0.238,3.438-0.041,4.396c0.279,1.357,0.877,2.211,1.762,2.512 C160.682,182.082,161.756,182.123,162.293,181.963z"/>
+ <path id="path2224" d="M176.656,170.053l3.563,0.051c1.402,2.793,2.945,5.531,4.143,8.41l0.199,0.504l-0.049-1.01l-0.182-7.951 h2.992v14.246h-3.23l-0.369-0.758c-1.168-2.398-3.178-6.629-3.658-7.697c-0.305-0.684-0.531-1.137-0.502-1.012 c0.031,0.127,0.086,2.309,0.121,4.848l0.066,4.619h-3.094V170.053z"/>
+ <g id="g3173" transform="translate(-0.4495808,1251.722)">
+ <path id="path2320" d="M185.373-1089.163c-1.527-0.85-2.496-1.666-3.189-2.689l-0.402-0.596l-0.586,0.516 c-0.816,0.725-1.141,0.965-1.887,1.406c-1.727,1.02-4.043,1.439-6.92,1.252c-5.955-0.385-9.082-3.238-9.49-8.66 c-0.182-2.412,0.223-4.607,1.158-6.289c1.281-2.305,3.789-3.914,7.313-4.695c1.803-0.398,3.266-0.545,5.977-0.594l2.516-0.049 l-0.049-1.311c-0.027-0.723-0.09-1.543-0.137-1.824c-0.25-1.477-0.871-2.223-2.035-2.445c-0.902-0.17-1.32-0.18-2.357-0.053 c-2.006,0.246-4.098,1.066-6.678,2.623c-0.691,0.416-1.297,0.744-1.346,0.725c-0.096-0.037-3.463-5.682-3.461-5.799 c0.008-0.166,2.094-1.316,3.582-1.973c4.023-1.775,6.543-2.377,9.953-2.377c3.17,0,5.359,0.533,7.127,1.736 c0.693,0.473,1.736,1.551,2.115,2.186c0.35,0.586,0.777,1.646,1.012,2.51l0.189,0.691l-0.041,4.766 c-0.021,2.619-0.041,6.43-0.041,8.467c0,4.178,0,4.18,0.633,5.414c0.273,0.537,0.498,0.814,1.266,1.57 c0.855,0.842,0.922,0.93,0.809,1.059c-0.068,0.076-1.029,1.184-2.137,2.461c-1.109,1.275-2.057,2.328-2.107,2.338 C186.108-1088.786,185.756-1088.953,185.373-1089.163z M175.903-1095.453c1.229-0.154,2.246-0.641,3.182-1.518l0.508-0.477 l0.055-3.168l0.053-3.168l-1.316,0.057c-4.154,0.178-5.707,0.842-6.377,2.729c-0.213,0.596-0.295,2.16-0.146,2.787 c0.334,1.418,1.457,2.533,2.768,2.748c0.246,0.039,0.486,0.078,0.531,0.082C175.203-1095.374,175.539-1095.408,175.903-1095.453z M137.623-1089.718c-1.318-0.205-2.459-0.68-3.502-1.459c-1.109-0.826-1.762-1.803-2.238-3.348 c-0.445-1.441-0.436-1.025-0.49-18.475c-0.051-15.838-0.057-16.158-0.236-18.186c-0.102-1.135-0.162-2.086-0.137-2.111 c0.074-0.074,8.055-1.891,8.154-1.857c0.098,0.037,0.248,1.135,0.361,2.654c0.162,10.801,0.012,21.605,0.156,32.406 c0.063,2.619,0.086,2.936,0.24,3.373c0.379,1.078,0.902,1.469,1.963,1.465c0.336,0,0.662-0.018,0.727-0.039 c0.105-0.033,0.479,1.133,1.371,4.289l0.162,0.578l-1.271,0.334C141.034-1089.607,139.186-1089.476,137.623-1089.718z M154.555-1089.644c-1.066-0.125-1.982-0.391-2.85-0.822c-2.164-1.08-3.219-2.633-3.713-5.475 c-0.066-0.375-0.109-5.193-0.146-16.57c-0.053-15.98-0.055-16.049-0.25-18.383c-0.117-1.43-0.164-2.367-0.119-2.408 c0.102-0.088,8.1-1.91,8.152-1.857c0.088,0.088,0.268,1.711,0.348,3.148c0.213,11.125-0.035,22.258,0.162,33.383 c0.055,1.18,0.107,1.611,0.238,1.984c0.221,0.625,0.525,1.014,0.945,1.199c0.457,0.203,1.182,0.281,1.516,0.166 c0.174-0.063,0.283-0.066,0.316-0.014c0.078,0.129,1.402,4.816,1.369,4.85c-0.016,0.018-0.504,0.164-1.084,0.328 C158.041-1089.722,155.75-1089.501,154.555-1089.644z M67.676-1089.716c-0.134-0.018-0.61-0.076-1.059-0.127 c-0.447-0.053-1.237-0.215-1.756-0.363c-5.568-1.582-9.046-6.182-9.853-13.021c-0.124-1.047-0.123-3.988,0.001-5.09 c0.362-3.213,1.4-6.119,2.997-8.387c1.083-1.537,2.861-3.086,4.462-3.889c2.021-1.016,3.78-1.402,6.368-1.402 c2.15,0,3.536,0.219,5.156,0.816c3.931,1.449,7.106,5.004,8.254,9.238c0.922,3.398,0.905,8.645-0.037,12.051 c-0.744,2.691-2.024,4.861-3.966,6.725s-4.086,2.918-6.7,3.297C70.775-1089.757,68.143-1089.654,67.676-1089.716z M70.77-1096.027 c1.815-0.824,2.693-2.672,3.095-6.512c0.153-1.465,0.177-5.111,0.041-6.512c-0.375-3.879-1.335-5.748-3.356-6.531 c-1.055-0.41-2.505-0.303-3.577,0.262c-1.823,0.959-2.647,2.99-2.926,7.207c-0.158,2.404-0.013,5.633,0.343,7.572 c0.475,2.602,1.225,3.77,2.859,4.457c0.768,0.322,1.166,0.387,2.144,0.344C70.09-1095.769,70.293-1095.812,70.77-1096.027z M10.314-1116.745c-0.13-1.063-0.376-2.029-0.667-2.621c-0.147-0.301-0.224-0.547-0.182-0.584c0.09-0.078,7.021-1.965,7.22-1.965 c0.204,0,0.671,0.98,0.915,1.92c0.112,0.432,0.204,0.855,0.204,0.939c0,0.086,0.027,0.152,0.061,0.152 c0.034-0.002,0.391-0.277,0.794-0.615c1.52-1.27,3.532-2.127,5.465-2.324c2.115-0.217,4.02,0.1,5.551,0.92 c0.98,0.527,2.146,1.512,2.768,2.336l0.488,0.646l0.314-0.326c0.76-0.789,2.256-1.92,3.307-2.496 c0.898-0.494,2.17-0.893,3.413-1.074c1.114-0.16,3.312-0.063,4.384,0.197c1.185,0.287,2.204,0.719,2.971,1.26 c1.574,1.109,2.172,2.082,2.584,4.207c0.172,0.885,0.174,1.025,0.203,13.373l0.029,12.479H42.15v-10.934 c0-7.029-0.03-11.18-0.084-11.623c-0.198-1.623-0.574-2.096-1.798-2.268c-1.429-0.199-3.438,0.574-5.267,2.025l-0.667,0.529 l0,22.27h-7.729c-0.473-7.383,0.652-15.438-0.186-22.727c-0.296-1.432-0.807-1.955-2.059-2.107 c-1.462-0.178-3.452,0.498-5.153,1.75l-0.664,0.488l-0.005,22.596h-7.979C10.282-1099.062,11.051-1108.048,10.314-1116.745z M86.536-1095.492l14.459-19.949l-13.248-0.043v-5.779h23.043v5.578c-4.503,6.535-9.129,12.986-13.598,19.545l14.179,0.037 l-0.059,0.182l-1.888,5.559l-22.899,0.041L86.536-1095.492z M116.735-1120.853l0.184-0.041c2.588-0.43,5.186-0.809,7.775-1.227 l0.266-0.045v31.844h-8.225V-1120.853z M120.276-1124.939c-1.963-0.195-3.682-1.678-4.188-3.611 c-0.703-2.688,0.707-5.361,3.273-6.201c0.484-0.158,0.754-0.191,1.592-0.191c1.578,0,2.482,0.357,3.508,1.381 c0.986,0.986,1.412,2.068,1.418,3.586c0.004,1.563-0.406,2.584-1.457,3.637C123.332-1125.245,121.934-1124.773,120.276-1124.939z"/>
+ </g>
+</g>
+</svg>
View
BIN addon-sdk/source/data/moz_favicon.ico
Binary file not shown.
View
1 addon-sdk/source/data/pagemod-css-include-file.css
@@ -0,0 +1 @@
+div { border: 10px solid black; }
View
5 addon-sdk/source/data/test-content-symbiont.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/. */
+
+// test-content-symbiont
View
5 addon-sdk/source/data/test-context-menu.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/. */
+
+self.on("context", function () true);
View
20 addon-sdk/source/data/test-iframe-postmessage.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <script>
+ window.addEventListener("message", function(msg) {
+ parent.postMessage(msg.data, "*");
+ });
+
+ parent.postMessage({
+ first: "a string",
+ second: ["an", "array"],
+ third: {an: 'object'}
+ }, '*');
+ </script>
+ </head>
+ <body>
+ <h1>Inner iframe</h1>
+ </body>
+</html>
View
9 addon-sdk/source/data/test-iframe.html
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="UTF-8">
+</head>
+<body>
+ <iframe id="inner" src="about:blank"></iframe>
+</body>
+</html>
View
11 addon-sdk/source/data/test-iframe.js
@@ -0,0 +1,11 @@
+
+var count = 0
+
+setTimeout(function() {
+ window.addEventListener("message", function(msg) {
+ if (++count > 1) self.postMessage(msg.data);
+ else msg.source.postMessage(msg.data, '*');
+ });
+
+ document.getElementById('inner').src = iframePath;
+}, 0);
View
6 addon-sdk/source/data/test-message-manager.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/. */
+
+const TEST_VALUE = 11;
+
View
1 addon-sdk/source/data/test-net-url.txt
@@ -0,0 +1 @@
+Hello, ゼロ!
View
12 addon-sdk/source/data/test-page-mod.html
@@ -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/. -->
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>Page Mod test</title>
+</head>
+<body>
+ <p id="paragraph">Lorem ipsum dolor sit amet.</p>
+</body>
+</html>
View
13 addon-sdk/source/data/test-page-worker.html
@@ -0,0 +1,13 @@
+<!-- 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>
+ <meta charset="UTF-8">
+ <title>Page Worker test</title>
+</head>
+<body>
+ <p id="paragraph">Lorem ipsum dolor sit amet.</p>
+</body>
+</html>
View
29 addon-sdk/source/data/test-page-worker.js
@@ -0,0 +1,29 @@
+/* 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/. */
+
+
+// get title directly
+self.postMessage(["equal", document.title, "Page Worker test",
+ "Correct page title accessed directly"]);
+
+// get <p> directly
+let p = document.getElementById("paragraph");
+self.postMessage(["ok", !!p, "<p> can be accessed directly"]);
+self.postMessage(["equal", p.firstChild.nodeValue,
+ "Lorem ipsum dolor sit amet.",
+ "Correct text node expected"]);
+
+// Modify page
+let div = document.createElement("div");
+div.setAttribute("id", "block");
+div.appendChild(document.createTextNode("Test text created"));
+document.body.appendChild(div);
+
+// Check back the modification
+div = document.getElementById("block");
+self.postMessage(["ok", !!div, "<div> can be accessed directly"]);
+self.postMessage(["equal", div.firstChild.nodeValue,
+ "Test text created", "Correct text node expected"]);
+self.postMessage(["done"]);
+
View
18 addon-sdk/source/data/test-trusted-document.html
@@ -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/. -->
+
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>Worker test</title>
+</head>
+<body>
+ <p id="paragraph">Lorem ipsum dolor sit amet.</p>
+ <script>
+ addon.port.on('addon-to-document', function (arg) {
+ addon.port.emit('document-to-addon', arg);
+ });
+ </script>
+</body>
+</html>
View
13 addon-sdk/source/data/test.html
@@ -0,0 +1,13 @@
+<!-- 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>
+ <meta charset="UTF-8">
+ <title>foo</title>
+ </head>
+ <body>
+ <p>bar</p>
+ </body>
+</html>
View
908 addon-sdk/source/doc/dev-guide-source/cfx-tool.md
@@ -0,0 +1,908 @@
+<!-- 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/. -->
+
+# cfx #
+
+The `cfx` command-line tool gives you access to the SDK documentation and
+development servers as well as testing, running, and building add-ons.
+`cfx` usage is:
+
+<pre>
+ cfx [options] command [command-specific options]
+</pre>
+
+"Options" are global options applicable to the tool itself or to all
+commands (for example `--help`). `cfx` supports the following global options:
+
+<pre>
+ -h, --help - show a help message and exit
+ -v, --verbose - enable lots of output
+</pre>
+
+"Command-specific options" are only
+applicable to a subset of the commands.
+
+## Supported Commands ##
+
+### cfx docs ###
+
+This command displays the documentation for the SDK. The documentation is
+shipped with the SDK in [Markdown](http://daringfireball.net/projects/markdown/)
+format. The first time this command is executed, and any time after the
+Markdown files on disk have changed, `cfx docs` will generate a set of HTML
+pages from them and launch a web browser to display them. If the Markdown files
+haven't changed, `cfx docs` just launches a browser initialized to the set of
+generated pages.
+
+To regenerate the documentation associated with a single file, you can
+specify the file as an argument. For example:
+
+<pre>
+ cfx docs doc/dev-guide-source/addon-development/cfx-tool.md
+</pre>
+
+This command will regenerate only the HTML page you're reading.
+This is useful if you're iteratively editing a single file, and don't want to wait for cfx to
+regenerate the complete documentation tree.
+
+### cfx init ####
+Create a new directory called "my-addon", change into it, and run `cfx init`.
+
+This command will create an skeleton add-on, as a starting point for your
+own add-on development, with the following file structure:
+
+<ul class="tree">
+ <li>my-addon
+ <ul>
+ <li>data</li>
+ <li>docs
+ <ul><li>main.md</li></ul>
+ </li>
+ <li>lib
+ <ul><li>main.js</li></ul>
+ </li>
+ <li>package.json</li>
+ <li>README.md</li>
+ <li>tests
+ <ul><li>test-main.js</li></ul>
+ </li>
+ </ul>
+ </li>
+</ul>
+
+<div style="clear:both"></div>
+
+### cfx run ###
+
+This command is used to run the add-on. Called with no options it looks for a
+file called `package.json` in the current directory, loads the corresponding
+add-on, and runs it under the version of Firefox it finds in the platform's
+default install path.
+
+#### Supported Options #####
+
+You can point `cfx run` at a different `package.json` file using the
+`--pkgdir` option, and pass arguments to your add-on using the
+`--static-args` option.
+
+You can specify a different version of the
+<a href="dev-guide/glossary.html#host-application">host application</a>
+using the `--binary` option, passing in the path to the application binary to
+run. The path may be specified as a full path or may be relative to the current
+directory. But note that the version must be 4.0b7 or later.
+
+`cfx run` runs the host application with a new
+[profile](http://support.mozilla.com/en-US/kb/profiles). You can specify an
+existing profile using the `--profiledir` option, and this gives you access to
+that profile's history, bookmarks, and other add-ons. This enables you to run
+your add-on alongside debuggers like [Firebug](http://getfirebug.com/).
+See <a href="dev-guide/cfx-tool.html#profiledir">
+"Using --profiledir"</a> for more information.
+
+<table>
+<colgroup>
+<col width="30%">
+<col width="70%">
+</colgroup>
+
+<tr>
+ <td>
+ <code>-b BINARY, --binary=BINARY</code>
+ </td>
+ <td>
+ Use the host application binary specified in BINARY. BINARY may be specified as
+ a full path or as a path relative to the current directory.
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>--binary-args=CMDARGS</code>
+ </td>
+ <td>
+ <p>Pass <a href="http://kb.mozillazine.org/Command_line_arguments">extra
+ arguments</a> to the binary being executed (for example, Firefox).</p>
+ <p>For example, to pass the
+ <code>-jsconsole</code> argument to Firefox, which will launch the
+ <a href="https://developer.mozilla.org/en/Error_Console">JavaScript
+ Error Console</a>, try the following:</p>
+ <pre>cfx run --binary-args -jsconsole</pre>
+ <p>To pass multiple arguments, or arguments containing spaces, quote them:</p>
+ <pre>cfx run --binary-args '-url "www.mozilla.org" -jsconsole'</pre>
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>--extra-packages=EXTRA_PACKAGES</code>
+ </td>
+ <td>
+ Extra packages to include, specified as a comma-separated list of package
+ names.
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>-g CONFIG, --use-config=CONFIG</code>
+ </td>
+ <td>
+ Pass a set of options by
+ <a href="dev-guide/cfx-tool.html#configurations">referencing a named configuration</a>.
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>-p PROFILEDIR, --profiledir=PROFILEDIR</code>
+ </td>
+ <td>
+ <p>Use an existing
+ <a href="http://support.mozilla.com/en-US/kb/profiles">profile</a>
+ located in PROFILEDIR. PROFILEDIR may be specified as
+ a full path or as a path relative to the current directory.</p>
+
+ <p>See <a href="dev-guide/cfx-tool.html#profiledir">
+ "Using --profiledir"</a> for more information.
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>--pkgdir=PKGDIR</code>
+ </td>
+ <td>
+ Use an add-on located in PKGDIR. PKGDIR may be specified as
+ a full path or as a path relative to the current directory.
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>--static-args=STATIC_ARGS</code>
+ </td>
+ <td>
+ <a href="dev-guide/cfx-tool.html#arguments">Pass arguments to your add-on</a>,
+ in JSON format.
+ </td>
+</tr>
+
+</table>
+
+#### Experimental Options ####
+
+<table>
+<colgroup>
+<col width="30%">
+<col width="70%">
+</colgroup>
+
+<tr>
+ <td>
+ <code>-a APP, --app=APP</code>
+ </td>
+ <td>
+ By default, <code>cfx run</code> uses Firefox as the
+ <a href="dev-guide/glossary.html#host-application">host application</a>.
+ This option enables you to select a different host. You can specify
+ "firefox", "xulrunner", "fennec", or "thunderbird". But note that at
+ present only Firefox is supported.
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>--no-run</code>
+ </td>
+ <td>
+ <p>With this option <code>cfx</code> will not execute the command, but
+ will print out the command that it would have used to execute the
+ command.</p>
+ <p>For example, if you type:</p>
+ <pre>
+cfx run ---no-run</pre>
+ <p>you will see something like:</p>
+ <pre>
+To launch the application, enter the following command:
+ /path/to/firefox/firefox-bin -profile
+ /path/to/profile/tmpJDNlP6.mozrunner -foreground -no-remote</pre>
+ <p>This enables you to run the add-on without going through
+ <code>cfx</code>, which might be useful if you want to run it
+ inside a debugger like GDB.</p>
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>--templatedir=TEMPLATEDIR</code>
+ </td>
+ <td>
+ The <code>cfx run</code> command constructs the add-on using a extension
+ template which you can find under the SDK root, in
+ <code>app-extension</code>.
+ Use the <code>--templatedir</code> option to specify a different template.
+ TEMPLATEDIR may be specified as a full path or as a path relative to the
+ current directory.
+ </td>
+</tr>
+
+</table>
+
+#### Internal Options ####
+
+<table>
+<colgroup>
+<col width="30%">
+<col width="70%">
+</colgroup>
+
+<tr>
+ <td>
+ <code>--addons=ADDONS</code>
+ </td>
+ <td>
+ Paths of add-ons to install, comma-separated. ADDONS may be specified as
+ a full path or as a path relative to the current directory.
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>--e10s</code>
+ </td>
+ <td>
+ If this option is set then the add-on runs in a separate process.
+ This option is currently not implemented.
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>--keydir=KEYDIR</code>
+ </td>
+ <td>
+ Supply a different location for
+ <a href="dev-guide/guides/program-id.html">signing keys</a>.
+ KEYDIR may be specified as a full path or as a path relative to the
+ current directory.
+ </td>
+</tr>
+
+</table>
+
+### cfx test ###
+
+Run available tests for the specified package.
+
+<span class="aside">Note the hyphen after "test" in the module name.
+`cfx test` will include a module called "test-myCode.js", but will exclude
+modules called "test_myCode.js" or "testMyCode.js".</span>
+
+Called with no options this command will look for a file called `package.json`
+in the current directory. If `package.json` exists, `cfx` will load the
+corresponding add-on, load from the `tests` directory
+any modules that start with the word `test-` and run the unit tests
+they contain.
+
+See the
+[tutorial on unit testing](dev-guide/tutorials/unit-testing.html) and the
+[reference documentation for the `assert` module](modules/sdk/test/assert.html)
+for details.
+
+#### Supported Options #####
+
+As with `cfx run` you can use options to control which host application binary
+version to use, and to select a profile.
+
+You can also control which tests are run: you
+can test dependent packages, filter the tests by name and run tests multiple
+times.
+
+<table>
+<colgroup>
+<col width="30%">
+<col width="70%">
+</colgroup>
+
+<tr>
+ <td>
+ <code>-b BINARY, --binary=BINARY</code>
+ </td>
+ <td>
+ Use the host application binary specified in BINARY. BINARY may be specified as
+ a full path or as a path relative to the current directory.
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>--binary-args=CMDARGS</code>
+ </td>
+ <td>
+ <p>Pass <a href="http://kb.mozillazine.org/Command_line_arguments">extra
+ arguments</a> to the binary being executed (for example, Firefox).</p>
+ <p>For example, to pass the
+ <code>-jsconsole</code> argument to Firefox, which will launch the
+ <a href="https://developer.mozilla.org/en/Error_Console">JavaScript
+ Error Console</a>, try the following:</p>
+ <pre>cfx run --binary-args -jsconsole</pre>
+ <p>To pass multiple arguments, or arguments containing spaces, quote them:</p>
+ <pre>cfx run --binary-args '-url "www.mozilla.org" -jsconsole'</pre>
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>--dependencies</code>
+ </td>
+ <td>
+ Load and run any tests that are included with modules that your package
+ depends on.
+ <br>
+ For example: if your add-on depends on modules from the SDK, then
+ <code>cfx</code> will run the unit tests for the SDK's modules as well
+ as yours.
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>-f FILENAME[:TESTNAME], --filter=FILENAME[:TESTNAME]</code>
+ </td>
+ <td>
+ Only run tests whose filenames match FILENAME and
+ optionally match TESTNAME, both regexps (test, testall, testex, testpkgs)
+ <br>
+ For example: if you specify <code>--filter data</code>, then
+ <code>cfx</code> will only run tests in those modules whose name contain
+ the string "data".
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>-g CONFIG, --use-config=CONFIG</code>
+ </td>
+ <td>
+ Pass a set of options by
+ <a href="dev-guide/cfx-tool.html#configurations">referencing a named configuration</a>.
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>-p PROFILEDIR, --profiledir=PROFILEDIR</code>
+ </td>
+ <td>
+ <p>Use an existing
+ <a href="http://support.mozilla.com/en-US/kb/profiles">profile</a>
+ located in PROFILEDIR. PROFILEDIR may be specified as
+ a full path or as a path relative to the current directory.</p>
+
+ <p>See <a href="dev-guide/cfx-tool.html#profiledir">
+ "Using --profiledir"</a> for more information.
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>--times=ITERATIONS</code>
+ </td>
+ <td>
+ Execute tests ITERATIONS number of times.
+ </td>
+</tr>
+
+</table>
+
+#### Experimental Options ####
+
+<table>
+<colgroup>
+<col width="30%">
+<col width="70%">
+</colgroup>
+
+<tr>
+ <td>
+ <code>-a APP, --app=APP</code>
+ </td>
+ <td>
+ By default, <code>cfx test</code> uses Firefox as the
+ <a href="dev-guide/glossary.html#host-application">host application</a>.
+ This option enables you to select a different host. You can specify
+ "firefox", "xulrunner", "fennec", or "thunderbird". But note that at
+ present only Firefox is supported.
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>--no-run</code>
+ </td>
+ <td>
+ <p>With this option <code>cfx</code> will not execute the command, but
+ will print out the command that it would have used to execute the
+ command.</p>
+ <p>For example, if you type:</p>
+ <pre>
+cfx run ---no-run</pre>
+ <p>you will see something like:</p>
+ <pre>
+To launch the application, enter the following command:
+ /path/to/firefox/firefox-bin -profile
+ /path/to/profile/tmpJDNlP6.mozrunner -foreground -no-remote</pre>
+ <p>This enables you to run the add-on without going through
+ <code>cfx</code>, which might be useful if you want to run it
+ inside a debugger like GDB.</p>
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>--use-server</code>
+ </td>
+ <td>
+ Run tests using a server previously started with <code>cfx develop</code>.
+ </td>
+</tr>
+
+</table>
+
+#### Internal Options ####
+
+<table>
+<colgroup>
+<col width="30%">
+<col width="70%">
+</colgroup>
+
+<tr>
+ <td>
+ <code>--addons=ADDONS</code>
+ </td>
+ <td>
+ Paths of add-ons to install, comma-separated.
+ ADDONS may be specified as full paths or relative to the
+ current directory.
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>--e10s</code>
+ </td>
+ <td>
+ If this option is set then the add-on runs in a separate process.
+ This option is currently not implemented.
+ </td>
+</tr>
+
+<tr>
+ <td>
+ <code>--keydir=KEYDIR</code>
+ </td>
+ <td>
+ Supply a different location for
+ <a href="dev-guide/guides/program-id.html">signing keys</a>.
+ KEYDIR may be specified as a full path or as a path relative to the