Permalink
Browse files

Merge pull request #2052 from palant/deprecate-repo r=Mossop

Deprecate the standalone SDK repository
  • Loading branch information...
2 parents 0ecebf2 + 486f13f commit 83ffd8bf8d65866a78c670bf8bb4485de10f03e5 @Mossop Mossop committed on GitHub Sep 9, 2016
Showing with 5 additions and 23,408 deletions.
  1. +0 −5 .gitattributes
  2. +0 −36 .gitignore
  3. +0 −15 .hgignore
  4. 0 .hgtags
  5. +0 −18 .jpmignore
  6. +0 −26 .travis.yml
  7. +0 −54 CONTRIBUTING.md
  8. +0 −30 LICENSE
  9. +5 −32 README.md
  10. +0 −11 app-extension/application.ini
  11. +0 −358 app-extension/bootstrap.js
  12. +0 −33 app-extension/install.rdf
  13. +0 −84 bin/activate
  14. +0 −134 bin/activate.bat
  15. +0 −66 bin/activate.fish
  16. +0 −99 bin/activate.ps1
  17. +0 −33 bin/cfx
  18. +0 −6 bin/cfx.bat
  19. +0 −23 bin/deactivate.bat
  20. +0 −7 bin/fx-download.sh
  21. +0 −14 bin/integration-scripts/buildbot-run-cfx-helper
  22. +0 −364 bin/integration-scripts/integration-check
  23. +0 −34 bin/jpm-test.js
  24. +0 −64 bin/node-scripts/apply-patch.js
  25. +0 −57 bin/node-scripts/test.addons.js
  26. +0 −145 bin/node-scripts/test.docs.js
  27. +0 −45 bin/node-scripts/test.examples.js
  28. +0 −37 bin/node-scripts/test.firefox-bin.js
  29. +0 −68 bin/node-scripts/test.ini.js
  30. +0 −28 bin/node-scripts/test.modules.js
  31. +0 −141 bin/node-scripts/update-ini.js
  32. +0 −104 bin/node-scripts/utils.js
  33. +0 −11 bin/node-scripts/words.txt
  34. +0 −3 examples/actor-repl/README.md
  35. +0 −5 examples/actor-repl/data/codemirror-compressed.js
  36. +0 −264 examples/actor-repl/data/codemirror.css
  37. +0 −147 examples/actor-repl/data/index.html
  38. +0 −117 examples/actor-repl/data/main.css
  39. BIN examples/actor-repl/data/robot.png
  40. +0 −37 examples/actor-repl/index.js
  41. +0 −10 examples/actor-repl/package.json
  42. +0 −10 examples/actor-repl/test/test-main.js
  43. +0 −816 examples/debug-client/data/client.js
  44. +0 −50 examples/debug-client/data/index.html
  45. BIN examples/debug-client/data/plugin.png
  46. +0 −28 examples/debug-client/data/task.js
  47. +0 −33 examples/debug-client/index.js
  48. +0 −10 examples/debug-client/package.json
  49. +0 −10 examples/debug-client/test/test-main.js
  50. BIN examples/reading-data/data/mom.png
  51. +0 −7 examples/reading-data/data/sample.html
  52. +0 −53 examples/reading-data/lib/main.js
  53. +0 −9 examples/reading-data/package.json
  54. +0 −25 examples/reading-data/tests/test-main.js
  55. BIN examples/theme/data/icon-16.png
  56. +0 −9 examples/theme/data/index.html
  57. +0 −7 examples/theme/data/theme.css
  58. +0 −37 examples/theme/lib/main.js
  59. +0 −10 examples/theme/package.json
  60. +0 −10 examples/theme/test/test-main.js
  61. BIN examples/toolbar-api/data/favicon.ico
  62. +0 −21 examples/toolbar-api/data/index.html
  63. +0 −48 examples/toolbar-api/lib/main.js
  64. +0 −12 examples/toolbar-api/package.json
  65. +0 −10 examples/toolbar-api/test/test-main.js
  66. +0 −39 examples/ui-button-apis/lib/main.js
  67. +0 −10 examples/ui-button-apis/package.json
  68. +0 −29 examples/ui-button-apis/tests/test-main.js
  69. +0 −44 gulpfile.js
  70. +0 −95 lib/dev/debuggee.js
  71. +0 −120 lib/dev/frame-script.js
  72. +0 −255 lib/dev/panel.js
  73. +0 −14 lib/dev/panel/view.js
  74. +0 −64 lib/dev/ports.js
  75. +0 −135 lib/dev/theme.js
  76. +0 −17 lib/dev/theme/hooks.js
  77. +0 −106 lib/dev/toolbox.js
  78. +0 −40 lib/dev/utils.js
  79. +0 −3,848 lib/dev/volcan.js
  80. +0 −5 lib/diffpatcher/.travis.yml
  81. +0 −14 lib/diffpatcher/History.md
  82. +0 −18 lib/diffpatcher/License.md
  83. +0 −70 lib/diffpatcher/Readme.md
  84. +0 −45 lib/diffpatcher/diff.js
  85. +0 −5 lib/diffpatcher/index.js
  86. +0 −54 lib/diffpatcher/package.json
  87. +0 −21 lib/diffpatcher/patch.js
  88. +0 −36 lib/diffpatcher/rebase.js
  89. +0 −3 lib/diffpatcher/test/common.js
  90. +0 −59 lib/diffpatcher/test/diff.js
  91. +0 −14 lib/diffpatcher/test/index.js
  92. +0 −83 lib/diffpatcher/test/patch.js
  93. +0 −3 lib/diffpatcher/test/tap.js
  94. +0 −27 lib/framescript/FrameScriptManager.jsm
  95. +0 −94 lib/framescript/content.jsm
  96. +0 −215 lib/framescript/context-menu.js
  97. +0 −26 lib/framescript/manager.js
  98. +0 −25 lib/framescript/util.js
  99. +0 −3 lib/index.js
  100. +0 −53 lib/jetpack-id/index.js
  101. +0 −28 lib/jetpack-id/package.json
  102. +0 −5 lib/method/.travis.yml
  103. +0 −55 lib/method/History.md
  104. +0 −18 lib/method/License.md
  105. +0 −117 lib/method/Readme.md
  106. +0 −225 lib/method/core.js
  107. +0 −41 lib/method/package.json
  108. +0 −20 lib/method/test/browser.js
  109. +0 −272 lib/method/test/common.js
  110. +0 −112 lib/mozilla-toolkit-versioning/index.js
  111. +0 −15 lib/mozilla-toolkit-versioning/lib/utils.js
  112. +0 −21 lib/mozilla-toolkit-versioning/package.json
  113. +0 −90 lib/node/os.js
  114. +0 −171 lib/sdk/addon/bootstrap.js
  115. +0 −56 lib/sdk/addon/events.js
  116. +0 −12 lib/sdk/addon/host.js
  117. +0 −121 lib/sdk/addon/installer.js
  118. +0 −18 lib/sdk/addon/manager.js
  119. +0 −180 lib/sdk/addon/runner.js
  120. +0 −66 lib/sdk/addon/window.js
  121. +0 −47 lib/sdk/base64.js
  122. +0 −20 lib/sdk/browser/events.js
  123. +0 −337 lib/sdk/clipboard.js
  124. +0 −78 lib/sdk/console/plain-text.js
  125. +0 −86 lib/sdk/console/traceback.js
  126. +0 −305 lib/sdk/content/content-worker.js
  127. +0 −17 lib/sdk/content/content.js
  128. +0 −408 lib/sdk/content/context-menu.js
  129. +0 −57 lib/sdk/content/events.js
  130. +0 −129 lib/sdk/content/l10n-html.js
  131. +0 −74 lib/sdk/content/loader.js
  132. +0 −68 lib/sdk/content/mod.js
  133. +0 −236 lib/sdk/content/page-mod.js
  134. +0 −154 lib/sdk/content/page-worker.js
  135. +0 −426 lib/sdk/content/sandbox.js
  136. +0 −12 lib/sdk/content/sandbox/events.js
  137. +0 −58 lib/sdk/content/tab-events.js
  138. +0 −51 lib/sdk/content/thumbnail.js
  139. +0 −105 lib/sdk/content/utils.js
  140. +0 −148 lib/sdk/content/worker-child.js
  141. +0 −180 lib/sdk/content/worker.js
  142. +0 −1,188 lib/sdk/context-menu.js
  143. +0 −147 lib/sdk/context-menu/context.js
  144. +0 −384 lib/sdk/context-menu/core.js
  145. +0 −112 lib/sdk/context-menu/readers.js
  146. +0 −32 lib/sdk/context-menu@2.js
  147. +0 −133 lib/sdk/core/disposable.js
  148. +0 −184 lib/sdk/core/heritage.js
  149. +0 −43 lib/sdk/core/namespace.js
  150. +0 −89 lib/sdk/core/observer.js
  151. +0 −118 lib/sdk/core/promise.js
  152. +0 −29 lib/sdk/core/reference.js
  153. +0 −197 lib/sdk/deprecated/api-utils.js
  154. +0 −54 lib/sdk/deprecated/events/assembler.js
  155. +0 −288 lib/sdk/deprecated/sync-worker.js
  156. +0 −199 lib/sdk/deprecated/unit-test-finder.js
  157. +0 −584 lib/sdk/deprecated/unit-test.js
  158. +0 −199 lib/sdk/deprecated/window-utils.js
  159. +0 −18 lib/sdk/dom/events-shimmed.js
  160. +0 −192 lib/sdk/dom/events.js
  161. +0 −63 lib/sdk/dom/events/keys.js
  162. +0 −65 lib/sdk/event/chrome.js
  163. +0 −193 lib/sdk/event/core.js
  164. +0 −76 lib/sdk/event/dom.js
  165. +0 −74 lib/sdk/event/target.js
  166. +0 −280 lib/sdk/event/utils.js
  167. +0 −115 lib/sdk/frame/hidden-frame.js
  168. +0 −94 lib/sdk/frame/utils.js
  169. +0 −500 lib/sdk/fs/path.js
  170. +0 −40 lib/sdk/hotkeys.js
  171. +0 −79 lib/sdk/indexed-db.js
  172. +0 −73 lib/sdk/input/browser.js
  173. +0 −28 lib/sdk/input/customizable-ui.js
  174. +0 −85 lib/sdk/input/frame.js
  175. +0 −113 lib/sdk/input/system.js
  176. +0 −351 lib/sdk/io/buffer.js
  177. +0 −104 lib/sdk/io/byte-streams.js
  178. +0 −196 lib/sdk/io/file.js
  179. +0 −984 lib/sdk/io/fs.js
  180. +0 −440 lib/sdk/io/stream.js
  181. +0 −235 lib/sdk/io/text-streams.js
  182. +0 −110 lib/sdk/keyboard/hotkeys.js
  183. +0 −58 lib/sdk/keyboard/observer.js
  184. +0 −189 lib/sdk/keyboard/utils.js
  185. +0 −91 lib/sdk/l10n.js
  186. +0 −9 lib/sdk/l10n/core.js
  187. +0 −32 lib/sdk/l10n/html.js
  188. +0 −36 lib/sdk/l10n/json/core.js
  189. +0 −70 lib/sdk/l10n/loader.js
  190. +0 −127 lib/sdk/l10n/locale.js
Sorry, we could not display the entire diff because too many files (988) changed.
View
5 .gitattributes
@@ -1,5 +0,0 @@
-.gitignore export-ignore
-.hgignore export-ignore
-.hgtags export-ignore
-.gitattributes export-ignore
-python-lib/cuddlefish/_version.py export-subst
View
36 .gitignore
@@ -1,36 +0,0 @@
-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/*
-node_modules
-cache
-
-# Python
-*.pyc
-
-# OSX
-*.DS_Store
-
-# Windows
-*Thumbs.db
-
-# Ignore subtrees
-
-# git@github.com:jsantell/jetpack-id.git
-lib/jetpack-id/*
-!lib/jetpack-id/index.js
-!lib/jetpack-id/package.json
-
-# git@github.com:jsantell/mozilla-toolkit-versioning.git
-lib/mozilla-toolkit-versioning/*
-!lib/mozilla-toolkit-versioning/index.js
-!lib/mozilla-toolkit-versioning/lib
-lib/mozilla-toolkit-versioning/lib/*
-!lib/mozilla-toolkit-versioning/lib/*.js
-!lib/mozilla-toolkit-versioning/package.json
View
15 .hgignore
@@ -1,15 +0,0 @@
-syntax: glob
-local.json
-python-lib/cuddlefish/app-extension/components/jetpack.xpt
-testdocs.tgz
-jetpack-sdk-docs.tgz
-.test_tmp
-jetpack-sdk-docs
-node_modules
-
-# 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
0 .hgtags
No changes.
View
18 .jpmignore
@@ -1,18 +0,0 @@
-local.json
-mapping.json
-CONTRIBUTING.md
-@addon-sdk.xpi
-.*
-app-extension/
-bin/
-modules/
-node_modules/
-examples/
-cache/
-
-# Python
-python-lib/
-*.pyc
-
-# Windows
-*Thumbs.db
View
26 .travis.yml
@@ -1,26 +0,0 @@
-sudo: false
-language: node_js
-node_js:
- - "0.12"
-
-env:
- - JPM_FX_DEBUG=0
- - JPM_FX_DEBUG=1
-
-notifications:
- irc: "irc.mozilla.org#jetpack"
-
-cache:
- directories:
- - cache
-
-before_install:
- - "export DISPLAY=:99.0"
- - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16 -extension RANDR"
-
-before_script:
- - npm install fx-download -g
- - npm install gulp -g
- - bash bin/fx-download.sh
- - export JPM_FIREFOX_BINARY=$TRAVIS_BUILD_DIR/../firefox/firefox
- - cd $TRAVIS_BUILD_DIR
View
54 CONTRIBUTING.md
@@ -1,54 +0,0 @@
-## Overview
-
-- Changes should follow the [design guidelines], as well as the [coding style guide]
-- All changes need tests
-- In order to land, changes need a review by one of the Jetpack reviewers
-- Changes may need an API review
-- Changes may need a review from a Mozilla platform domain-expert
-
-If you have questions, ask in [#jetpack on IRC][jetpack irc channel] or on the [Jetpack mailing list].
-
-## How to Make Code Contributions
-
-Follow the [standard mozilla contribution guidelines](https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Introduction). All contributions and patches should be through Bugzilla.
-
-Pull requests on github are not accepted and new pull requests on github will be rejected.
-
-## Good First Bugs
-
-There is a list of [good first bugs here][good first bugs].
-
-## Reviewers
-
-Changes should be reviewed by someone on the [add-on sdk review team](https://bugzilla.mozilla.org/page.cgi?id=review_suggestions.html#Add-on%20SDK) within Bugzilla.
-
-Others who might be able to help include:
-
-- [@mossop]
-- [@gozala]
-- [@ZER0]
-- [@jsantell]
-- [@zombie]
-
-For review of Mozilla platform usage and best practices, ask [@autonome],
-[@0c0w3], or [@mossop] to find the domain expert.
-
-For API and developer ergonomics review, ask [@gozala].
-
-[design guidelines]:https://wiki.mozilla.org/Labs/Jetpack/Design_Guidelines
-[jetpack irc channel]:irc://irc.mozilla.org/#jetpack
-[Jetpack mailing list]:http://groups.google.com/group/mozilla-labs-jetpack
-[open bugs]:https://bugzilla.mozilla.org/buglist.cgi?quicksearch=product%3ASDK
-[make bug]:https://bugzilla.mozilla.org/enter_bug.cgi?product=Add-on%20SDK&component=general
-[test intro]:https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Unit_testing
-[test API]:https://developer.mozilla.org/en-US/Add-ons/SDK/Low-Level_APIs/test_assert
-[coding style guide]:https://github.com/mozilla/addon-sdk/wiki/Coding-style-guide
-[Add-on SDK repo]:https://github.com/mozilla/addon-sdk
-[GitHub]:https://github.com/
-[good first bugs]:https://bugzilla.mozilla.org/buglist.cgi?list_id=7345714&columnlist=bug_severity%2Cpriority%2Cassigned_to%2Cbug_status%2Ctarget_milestone%2Cresolution%2Cshort_desc%2Cchangeddate&query_based_on=jetpack-good-1st-bugs&status_whiteboard_type=allwordssubstr&query_format=advanced&status_whiteboard=[good%20first%20bug]&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=VERIFIED&product=Add-on%20SDK&known_name=jetpack-good-1st-bugs
-
-[@mossop]:https://github.com/mossop/
-[@gozala]:https://github.com/Gozala/
-[@ZER0]:https://github.com/ZER0/
-[@jsantell]:https://github.com/jsantell
-[@zombie]:https://github.com/zombie
View
30 LICENSE
@@ -1,30 +0,0 @@
-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
37 README.md
@@ -1,34 +1,7 @@
-# Mozilla Add-on SDK [![Build Status](https://travis-ci.org/mozilla/addon-sdk.png)](https://travis-ci.org/mozilla/addon-sdk)
+# Mozilla Add-on SDK has moved!
-We suggest that developers of new add-ons [should look at using WebExtensions](https://developer.mozilla.org/en-US/Add-ons/WebExtensions).
+Add-on SDK is now part of the Firefox codebase, you can find the current code in the corresponding [Git](https://github.com/mozilla/gecko-dev/tree/master/addon-sdk/source) or [Mercurial](https://hg.mozilla.org/mozilla-central/file/tip/addon-sdk/source) repository. Additional resources:
-Using the Add-on SDK you can create Firefox add-ons using standard Web technologies: JavaScript, HTML, and CSS. The SDK includes JavaScript APIs which you can use to create add-ons, and tools for creating, running, testing, and packaging add-ons.
-
-If you find a problem, please [report the bug here](https://bugzilla.mozilla.org/enter_bug.cgi?product=Add-on%20SDK).
-
-## Developing Add-ons
-
-These resources offer some help:
-
-* [Add-on SDK Documentation](https://developer.mozilla.org/en-US/Add-ons/SDK)
-* [Community Developed Modules](https://github.com/mozilla/addon-sdk/wiki/Community-developed-modules)
-* [Jetpack FAQ](https://wiki.mozilla.org/Jetpack/FAQ)
-* [StackOverflow Questions](http://stackoverflow.com/questions/tagged/firefox-addon-sdk)
-* [Mailing List](https://wiki.mozilla.org/Jetpack#Mailing_list)
-* #jetpack on irc.mozilla.org
-
-## Contributing Code
-
-Please read these two guides if you wish to make some patches to the addon-sdk:
-
-* [Contribute Guide](https://github.com/mozilla/addon-sdk/blob/master/CONTRIBUTING.md)
-* [Style Guide](https://github.com/mozilla/addon-sdk/wiki/Coding-style-guide)
-
-## Issues
-
-We use [bugzilla](https://bugzilla.mozilla.org/) as our issue tracker, here are some useful links:
-
-* [File a bug](https://bugzilla.mozilla.org/enter_bug.cgi?product=Add-on%20SDK)
-* [Open bugs](https://bugzilla.mozilla.org/buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&columnlist=bug_severity%2Cpriority%2Cassigned_to%2Cbug_status%2Ctarget_milestone%2Cresolution%2Cshort_desc%2Cchangeddate&product=Add-on%20SDK&query_format=advanced&order=priority)
-* [Good first bugs](https://bugzilla.mozilla.org/buglist.cgi?status_whiteboard=[good+first+bug]&&resolution=---&product=Add-on+SDK)
-* [Good next bugs](https://bugzilla.mozilla.org/buglist.cgi?status_whiteboard=[good+next+bug]&&resolution=---&product=Add-on+SDK)
+* [Add-on SDK Overview](https://github.com/mozilla/gecko-dev/blob/master/addon-sdk/source/README.md)
+* [Reporting a bug](https://bugzilla.mozilla.org/enter_bug.cgi?product=Add-on%20SDK)
+* [Contribution Guide](https://github.com/mozilla/gecko-dev/blob/master/addon-sdk/source/CONTRIBUTING.md)
View
11 app-extension/application.ini
@@ -1,11 +0,0 @@
-[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
358 app-extension/bootstrap.js
@@ -1,358 +0,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/. */
-
-// @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 prefService = Cc['@mozilla.org/preferences-service;1'].
- getService(Ci.nsIPrefService).
- QueryInterface(Ci.nsIPrefBranch);
-const appInfo = Cc["@mozilla.org/xre/app-info;1"].
- getService(Ci.nsIXULAppInfo);
-const vc = Cc["@mozilla.org/xpcom/version-comparator;1"].
- getService(Ci.nsIVersionComparator);
-
-const { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {});
-
-const Startup = Cu.import("resource://gre/modules/sdk/system/Startup.js", {}).exports;
-
-
-const REASON = [ 'unknown', 'startup', 'shutdown', 'enable', 'disable',
- 'install', 'uninstall', 'upgrade', 'downgrade' ];
-
-const bind = Function.call.bind(Function.bind);
-
-var loader = null;
-var unload = null;
-var cuddlefishSandbox = null;
-var nukeTimer = null;
-
-var resourceDomains = [];
-function setResourceSubstitution(domain, uri) {
- resourceDomains.push(domain);
- resourceHandler.setSubstitution(domain, uri);
-}
-
-// Utility function that synchronously reads local resource from the given
-// `uri` and returns content string.
-function readURI(uri) {
- let channel = NetUtil.newChannel({
- uri: NetUtil.newURI(uri, 'UTF-8'),
- loadUsingSystemPrincipal: true
- });
-
- let stream = channel.open2();
-
- 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;
-}
-
-// 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;
-
- // Clean the metadata
- options.metadata[name]['permissions'] = options.metadata[name]['permissions'] || {};
-
- // freeze the permissionss
- Object.freeze(options.metadata[name]['permissions']);
- // freeze the metadata
- Object.freeze(options.metadata[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);
- setResourceSubstitution(domain, resourcesURI);
-
- // Create path to URLs mapping supported by loader.
- let paths = {
- // Relative modules resolve to add-on package lib
- './': prefixURI + name + '/lib/',
- './tests/': prefixURI + name + '/tests/',
- '': 'resource://gre/modules/commonjs/'
- };
-
- // Maps addon lib and tests ressource folders for each package
- paths = Object.keys(options.metadata).reduce(function(result, name) {
- result[name + '/'] = prefixURI + name + '/lib/'
- result[name + '/tests/'] = prefixURI + name + '/tests/'
- return result;
- }, paths);
-
- // We need to map tests folder when we run sdk tests whose package name
- // is stripped
- if (name == 'addon-sdk')
- paths['tests/'] = prefixURI + name + '/tests/';
-
- let useBundledSDK = options['force-use-bundled-sdk'];
- if (!useBundledSDK) {
- try {
- useBundledSDK = prefService.getBoolPref("extensions.addon-sdk.useBundledSDK");
- }
- catch (e) {
- // Pref doesn't exist, allow using Firefox shipped SDK
- }
- }
-
- // Starting with Firefox 21.0a1, we start using modules shipped into firefox
- // Still allow using modules from the xpi if the manifest tell us to do so.
- // And only try to look for sdk modules in xpi if the xpi actually ship them
- if (options['is-sdk-bundled'] &&
- (vc.compare(appInfo.version, '21.0a1') < 0 || useBundledSDK)) {
- // Maps sdk module folders to their resource folder
- paths[''] = prefixURI + 'addon-sdk/lib/';
- // test.js is usually found in root commonjs or SDK_ROOT/lib/ folder,
- // so that it isn't shipped in the xpi. Keep a copy of it in sdk/ folder
- // until we no longer support SDK modules in XPI:
- paths['test'] = prefixURI + 'addon-sdk/lib/sdk/test.js';
- }
-
- // Retrieve list of module folder overloads based on preferences in order to
- // eventually used a local modules instead of files shipped into Firefox.
- let branch = prefService.getBranch('extensions.modules.' + id + '.path');
- paths = branch.getChildList('', {}).reduce(function (result, name) {
- // Allows overloading of any sub folder by replacing . by / in pref name
- let path = name.substr(1).split('.').join('/');
- // Only accept overloading folder by ensuring always ending with `/`
- if (path) path += '/';
- let fileURI = branch.getCharPref(name);
-
- // On mobile, file URI has to end with a `/` otherwise, setSubstitution
- // takes the parent folder instead.
- if (fileURI[fileURI.length-1] !== '/')
- fileURI += '/';
-
- // Maps the given file:// URI to a resource:// in order to avoid various
- // failure that happens with file:// URI and be close to production env
- let resourcesURI = ioService.newURI(fileURI, null, null);
- let resName = 'extensions.modules.' + domain + '.commonjs.path' + name;
- setResourceSubstitution(resName, resourcesURI);
-
- result[path] = 'resource://' + resName + '/';
- return result;
- }, paths);
-
- // Make version 2 of the manifest
- let manifest = options.manifest;
-
- // Import `cuddlefish.js` module using a Sandbox and bootstrap loader.
- let cuddlefishPath = 'loader/cuddlefish.js';
- let cuddlefishURI = 'resource://gre/modules/commonjs/sdk/' + cuddlefishPath;
- if (paths['sdk/']) { // sdk folder has been overloaded
- // (from pref, or cuddlefish is still in the xpi)
- cuddlefishURI = paths['sdk/'] + cuddlefishPath;
- }
- else if (paths['']) { // root modules folder has been overloaded
- cuddlefishURI = paths[''] + 'sdk/' + cuddlefishPath;
- }
-
- 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 = 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,
- // Arguments passed as --static-args
- staticArgs: options.staticArgs,
-
- // Option to prevent automatic kill of firefox during tests
- noQuit: options.no_quit,
-
- // Add-on preferences branch name
- preferencesBranch: options.preferencesBranch,
-
- // Arguments related to test runner.
- modules: {
- '@test/options': {
- iterations: options.iterations,
- filter: options.filter,
- profileMemory: options.profileMemory,
- stopOnError: options.stopOnError,
- verbose: options.verbose,
- parseable: options.parseable,
- checkMemory: options.check_memory,
- }
- }
- });
-
- let module = cuddlefish.Module('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 ? error.message : String(error)) + '\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;
-
- // Don't waste time cleaning up if the application is shutting down
- if (reason != "shutdown") {
- // 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);
-
- // Bug 944951 - bootstrap.js must remove the added resource: URIs on unload
- resourceDomains.forEach(domain => {
- resourceHandler.setSubstitution(domain, null);
- })
- }
- }
-};
-
-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);
-
- // 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 app-extension/install.rdf
@@ -1,33 +0,0 @@
-<?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>26.0</em:minVersion>
- <em:maxVersion>30.0</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:optionsURL></em:optionsURL>
- <em:updateURL></em:updateURL>
- </Description>
-</RDF>
View
84 bin/activate
@@ -1,84 +0,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/.
-
-# 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
-
- PYTHONPATH="$_OLD_PYTHONPATH"
- export PYTHONPATH
- unset _OLD_PYTHONPATH
-
- 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 bin/activate.bat
@@ -1,134 +0,0 @@
-@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
66 bin/activate.fish
@@ -1,66 +0,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/.
-
-# This file must be used with "source bin/activate.fish" *from fish*
-# you cannot run it directly
-
-# Much of this code is based off of the activate.fish file for the
-# virtualenv project. http://ur1.ca/ehmd6
-
-function deactivate -d "Exit addon-sdk and return to normal shell environment"
- if test -n "$_OLD_VIRTUAL_PATH"
- set -gx PATH $_OLD_VIRTUAL_PATH
- set -e _OLD_VIRTUAL_PATH
- end
-
- if test -n "$_OLD_PYTHONPATH"
- set -gx PYTHONPATH $_OLD_PYTHONPATH
- set -e _OLD_PYTHONPATH
- end
-
- if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
- functions -e fish_prompt
- set -e _OLD_FISH_PROMPT_OVERRIDE
- . ( begin
- printf "function fish_prompt\n\t#"
- functions _old_fish_prompt
- end | psub )
-
- functions -e _old_fish_prompt
- end
-
- set -e CUDDLEFISH_ROOT
- set -e VIRTUAL_ENV
-
- if test "$argv[1]" != "nondestructive"
- functions -e deactivate
- end
-end
-
-# unset irrelavent variables
-deactivate nondestructive
-
-set -gx _OLD_PYTHONPATH $PYTHONPATH
-set -gx _OLD_VIRTUAL_PATH $PATH
-set -gx _OLD_FISH_PROMPT_OVERRIDE "true"
-
-set VIRTUAL_ENV (pwd)
-
-set -gx CUDDLEFISH_ROOT $VIRTUAL_ENV
-set -gx PYTHONPATH "$VIRTUAL_ENV/python-lib" $PYTHONPATH
-set -gx PATH "$VIRTUAL_ENV/bin" $PATH
-
-# save the current fish_prompt function as the function _old_fish_prompt
-. ( begin
- printf "function _old_fish_prompt\n\t#"
- functions fish_prompt
- end | psub )
-
-# with the original prompt function renamed, we can override with our own.
-function fish_prompt
- printf "(%s)%s%s" (basename "$VIRTUAL_ENV") (set_color normal) (_old_fish_prompt)
- return
-end
-
-python -c "from jetpack_sdk_env import welcome; welcome()"
View
99 bin/activate.ps1
@@ -1,99 +0,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/.
-
-$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 bin/cfx
@@ -1,33 +0,0 @@
-#! /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 bin/cfx.bat
@@ -1,6 +0,0 @@
-@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 bin/deactivate.bat
@@ -1,23 +0,0 @@
-@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
7 bin/fx-download.sh
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-if [ "$JPM_FX_DEBUG" = "1" ]; then
- fx-download --branch nightly -c prerelease --host ftp.mozilla.org ../firefox --debug
-else
- fx-download --branch nightly -c prerelease --host ftp.mozilla.org ../firefox
-fi
View
14 bin/integration-scripts/buildbot-run-cfx-helper
@@ -1,14 +0,0 @@
-#!/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 bin/integration-scripts/integration-check
@@ -1,364 +0,0 @@
-#!/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
34 bin/jpm-test.js
@@ -1,34 +0,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/. */
-"use strict";
-
-var Promise = require("promise");
-var Mocha = require("mocha");
-var mocha = new Mocha({
- ui: "bdd",
- reporter: "spec",
- timeout: 900000
-});
-
-var isDebug = require("./node-scripts/utils").isDebug;
-
-exports.run = function(type) {
- return new Promise(function(resolve) {
- type = type || "";
- [
- (!isDebug && /^(firefox-bin)?$/.test(type)) && require.resolve("../bin/node-scripts/test.firefox-bin"),
- (!isDebug && /^(docs)?$/.test(type)) && require.resolve("../bin/node-scripts/test.docs"),
- (!isDebug && /^(ini)?$/.test(type)) && require.resolve("../bin/node-scripts/test.ini"),
- (/^(examples)?$/.test(type)) && require.resolve("../bin/node-scripts/test.examples"),
- (!isDebug && /^(addons)?$/.test(type)) && require.resolve("../bin/node-scripts/test.addons"),
- (!isDebug && /^(modules)?$/.test(type)) && require.resolve("../bin/node-scripts/test.modules"),
- ].forEach(function(filepath) {
- filepath && mocha.addFile(filepath);
- })
-
- mocha.run(function(failures) {
- resolve(failures);
- });
- });
-}
View
64 bin/node-scripts/apply-patch.js
@@ -1,64 +0,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/. */
-"use strict";
-
-var path = require("path");
-var cp = require("child_process");
-var fs = require("fs");
-var Promise = require("promise");
-var patcher = require("patch-editor");
-var readParam = require("./utils").readParam;
-
-var isKeeper = /\/addon-sdk\/source/;
-
-function apply(options) {
- return clean(options).then(function() {
- return new Promise(function(resolve) {
- var patch = path.resolve(readParam("patch"));
- var proc = cp.spawn("git", ["apply", patch]);
- proc.stdout.pipe(process.stdout);
- proc.stderr.pipe(process.stderr);
- proc.on("close", resolve);
- });
- });
-}
-exports.apply = apply;
-
-function clean(options) {
- return new Promise(function(resolve) {
- var patch = path.resolve(readParam("patch"));
- if (!patch) {
- throw new Error("no --patch was provided.");
- }
- console.log("Cleaning patch " + patch);
-
- patcher.getChunks({ patch: patch }).then(function(chunks) {
- var keepers = [];
-
- for (var i = chunks.length - 1; i >= 0; i--) {
- var chunk = chunks[i];
- var files = chunk.getFilesChanged();
-
- // check if the file changed is related to the addon-sdk/source directory
- var keepIt = files.map(function(file) {
- return (isKeeper.test(file));
- }).reduce(function(prev, curr) {
- return prev || curr;
- }, false);
-
- if (keepIt) {
- keepers.push(chunk);
- }
- }
-
- var contents = "\n" + keepers.join("\n") + "\n";
- contents = contents.replace(/\/addon-sdk\/source/g, "");
-
- fs.writeFileSync(patch, contents, { encoding: "utf8" });
-
- console.log("Done cleaning patch.");
- }).then(resolve).catch(console.error);
- });
-}
-exports.clean = clean;
View
57 bin/node-scripts/test.addons.js
@@ -1,57 +0,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/. */
-"use strict";
-
-var utils = require("./utils");
-var path = require("path");
-var fs = require("fs");
-var jpm = utils.run;
-var readParam = utils.readParam;
-var isDebug = utils.isDebug;
-
-var addonsPath = path.join(__dirname, "..", "..", "test", "addons");
-
-var binary = process.env.JPM_FIREFOX_BINARY || "nightly";
-var filterPattern = readParam("filter");
-
-describe("jpm test sdk addons", function () {
- fs.readdirSync(addonsPath)
- .filter(fileFilter.bind(null, addonsPath))
- .forEach(function (file) {
- it(file, function (done) {
- var addonPath = path.join(addonsPath, file);
- process.chdir(addonPath);
-
- var options = { cwd: addonPath, env: { JPM_FIREFOX_BINARY: binary }};
- if (process.env.DISPLAY) {
- options.env.DISPLAY = process.env.DISPLAY;
- }
- if (/^e10s/.test(file)) {
- options.e10s = true;
- }
-
- jpm("run", options).then(done).catch(done);
- });
- });
-});
-
-function fileFilter(root, file) {
- var matcher = filterPattern && new RegExp(filterPattern);
- if (/^(l10n-properties|simple-prefs|page-mod-debugger)/.test(file)) {
- return false;
- }
-
- // filter additional add-ons when using debug builds
- if (isDebug) {
- if (/^(chrome|e10s)/.test(file)) {
- return false;
- }
- }
-
- if (matcher && !matcher.test(file)) {
- return false;
- }
- var stat = fs.statSync(path.join(root, file))
- return (stat && stat.isDirectory());
-}
View
145 bin/node-scripts/test.docs.js
@@ -1,145 +0,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/. */
-"use strict";
-
-var createHash = require('crypto').createHash;
-var fs = require("fs");
-var fsExtra = require("fs-extra")
-var path = require("path");
-var Promise = require("promise");
-var chai = require("chai");
-var expect = chai.expect;
-var teacher = require("teacher");
-
-var rootURI = path.join(__dirname, "..", "..");
-
-// get a list of words that fail spell check but are still acceptable
-var NEW_WORDS = fs.readFileSync(path.join(__dirname, "words.txt")).toString().trim().split("\n");
-
-var CACHE_PATH = path.join(__dirname, "..", "..", "cache", "spellchecks.json");
-
-var CACHE = {};
-
-try {
- CACHE = JSON.parse(fs.readFileSync(CACHE_PATH).toString());
-}
-catch (e) {}
-
-function md5(str) {
- return createHash("md5").update(str).digest("utf8");
-}
-
-function addCacheHash(hash) {
- CACHE[hash] = true;
- fsExtra.ensureFileSync(CACHE_PATH);
- fsExtra.writeJSONSync(CACHE_PATH, CACHE);
-}
-
-describe("Spell Checking", function () {
- it("Spellcheck CONTRIBUTING.md", function (done) {
- var readme = path.join(rootURI, "CONTRIBUTING.md");
-
- fs.readFile(readme, function (err, data) {
- if (err) {
- throw err;
- }
- var text = data.toString();
- var hash = md5(text);
-
- // skip this test if we know we have done the
- // exact same test with positive results before
- if (CACHE[hash]) {
- expect(CACHE[hash]).to.be.equal(true);
- return done();
- }
-
- teacher.check(text, function(err, data) {
- expect(err).to.be.equal(null);
-
- var results = data || [];
- results = results.filter(function(result) {
- if (NEW_WORDS.indexOf(result.string.toLowerCase()) != -1) {
- return false;
- }
-
- // ignore anything that starts with a dash
- if (result.string[0] == "-") {
- return false;
- }
-
- if (!(new RegExp(result.string)).test(text)) {
- return false;
- }
-
- return true;
- })
-
- if (results.length > 0) {
- console.log(results);
- }
- else {
- addCacheHash(hash);
- }
-
- expect(results.length).to.be.equal(0);
-
- setTimeout(done, 500);
- });
- });
- });
-
- it("Spellcheck README.md", function (done) {
- var readme = path.join(rootURI, "README.md");
-
- fs.readFile(readme, function (err, data) {
- if (err) {
- throw err;
- }
- var text = data.toString();
- var hash = md5(text);
-
- // skip this test if we know we have done the
- // exact same test with positive results before
- if (CACHE[hash]) {
- expect(CACHE[hash]).to.be.equal(true);
- return done();
- }
-
- teacher.check(text, function(err, data) {
- expect(err).to.be.equal(null);
-
- var results = data || [];
- results = results.filter(function(result) {
- if (NEW_WORDS.indexOf(result.string.toLowerCase()) != -1) {
- return false;
- }
-
- // ignore anything that starts with a dash
- if (result.string[0] == "-") {
- return false;
- }
-
- // ignore anything that we don't find in the original text,
- // for some reason "bootstrap.js" becomes "bootstrapjs".
- if (!(new RegExp(result.string)).test(text)) {
- return false;
- }
-
- return true;
- })
-
- if (results.length > 0) {
- console.log(results);
- }
- else {
- addCacheHash(hash);
- }
-
- expect(results.length).to.be.equal(0);
-
- done();
- });
- });
- });
-});
View
45 bin/node-scripts/test.examples.js
@@ -1,45 +0,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/. */
-"use strict";
-
-var utils = require("./utils");
-var path = require("path");
-var fs = require("fs");
-var jpm = utils.run;
-var readParam = utils.readParam;
-
-var examplesPath = path.join(__dirname, "..", "..", "examples");
-
-var binary = process.env.JPM_FIREFOX_BINARY || "nightly";
-var filterPattern = readParam("filter");
-
-describe("jpm test sdk examples", function () {
- fs.readdirSync(examplesPath)
- .filter(fileFilter.bind(null, examplesPath))
- .forEach(function (file) {
- it(file, function (done) {
- var addonPath = path.join(examplesPath, file);
- process.chdir(addonPath);
-
- var options = { cwd: addonPath, env: { JPM_FIREFOX_BINARY: binary }};
- if (process.env.DISPLAY) {
- options.env.DISPLAY = process.env.DISPLAY;
- }
-
- jpm("test", options).then(done);
- });
- });
-});
-
-function fileFilter(root, file) {
- var matcher = filterPattern && new RegExp(filterPattern);
- if (/^(reading-data)/.test(file)) {
- return false;
- }
- if (matcher && !matcher.test(file)) {
- return false;
- }
- var stat = fs.statSync(path.join(root, file))
- return (stat && stat.isDirectory());
-}
View
37 bin/node-scripts/test.firefox-bin.js
@@ -1,37 +0,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/. */
-"use strict";
-
-var fs = require("fs");
-var Promise = require("promise");
-var chai = require("chai");
-var expect = chai.expect;
-var normalizeBinary = require("fx-runner/lib/utils").normalizeBinary;
-
-//var firefox_binary = process.env["JPM_FIREFOX_BINARY"] || normalizeBinary("nightly");
-
-describe("Checking Firefox binary", function () {
-
- it("using matching fx-runner version with jpm", function () {
- var sdkPackageJSON = require("../../package.json");
- var jpmPackageINI = require("jpm/package.json");
- expect(sdkPackageJSON.devDependencies["fx-runner"]).to.be.equal(jpmPackageINI.dependencies["fx-runner"]);
- });
-
- it("exists", function (done) {
- var useEnvVar = new Promise(function(resolve) {
- resolve(process.env["JPM_FIREFOX_BINARY"]);
- });
-
- var firefox_binary = process.env["JPM_FIREFOX_BINARY"] ? useEnvVar : normalizeBinary("nightly");
- firefox_binary.then(function(path) {
- expect(path).to.be.ok;
- fs.exists(path, function (exists) {
- expect(exists).to.be.ok;
- done();
- });
- })
- });
-
-});
View
68 bin/node-scripts/test.ini.js
@@ -1,68 +0,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/. */
-"use strict";
-
-var fs = require("fs");
-var path = require("path");
-var Promise = require("promise");
-var chai = require("chai");
-var expect = chai.expect;
-var ini = require("./update-ini");
-
-var addonINI = path.resolve("./test/addons/jetpack-addon.ini");
-var packageINI = path.resolve("./test/jetpack-package.ini");
-
-describe("Checking ini files", function () {
-
- it("Check test/addons/jetpack-addon.ini", function (done) {
-
- fs.readFile(addonINI, function (err, data) {
- if (err) {
- throw err;
- }
- // filter comments
- var text = data.toString().split("\n").filter(function(line) {
- return !/^\s*#/.test(line);
- }).join("\n");
- var expected = "";
-
- ini.makeAddonIniContent()
- .then(function(contents) {
- expected = contents;
-
- setTimeout(function end() {
- expect(text.trim()).to.be.equal(expected.trim());
- done();
- });
- });
- });
-
- });
-
- it("Check test/jetpack-package.ini", function (done) {
-
- fs.readFile(packageINI, function (err, data) {
- if (err) {
- throw err;