xultestrunner 0.2.9 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. data/.document +5 -0
  2. data/.gitignore +4 -1
  3. data/LICENSE +17 -18
  4. data/README.rdoc +18 -0
  5. data/Rakefile +65 -40
  6. data/VERSION +1 -1
  7. data/bin/xultest +1 -12
  8. data/lib/xultestrunner.rb +1 -1
  9. data/test/test_helper.rb +9 -0
  10. data/test/xultestrunner_test.rb +7 -0
  11. data/xpcomcore/app/application.ini +12 -0
  12. data/xpcomcore/app/chrome/chrome.manifest +1 -0
  13. data/xpcomcore/app/chrome/content/xul/main_window.xul +6 -0
  14. data/xpcomcore/app/components/bootstrapper.js +70 -0
  15. data/xpcomcore/app/defaults/preferences/prefs.js +7 -0
  16. data/xultestrunner.gemspec +21 -150
  17. metadata +27 -153
  18. data/.gitmodules +0 -3
  19. data/README +0 -17
  20. data/xulapp/application.ini +0 -9
  21. data/xulapp/chrome/chrome.manifest +0 -2
  22. data/xulapp/chrome/content/interface/boot.xul +0 -20
  23. data/xulapp/chrome/content/interface/testharness.html +0 -30
  24. data/xulapp/chrome/content/lib/xultestcase.js +0 -140
  25. data/xulapp/chrome/content/lib/xultestrunner.js +0 -120
  26. data/xulapp/chrome/content/vendor/prototype/LICENSE +0 -16
  27. data/xulapp/chrome/content/vendor/prototype/prototype.js +0 -4874
  28. data/xulapp/chrome/content/vendor/scriptaculous/LICENSE +0 -20
  29. data/xulapp/chrome/content/vendor/scriptaculous/test.css +0 -90
  30. data/xulapp/chrome/content/vendor/scriptaculous/unittest.js +0 -566
  31. data/xulapp/chrome/content/vendor/xpcomcore/LICENSE +0 -21
  32. data/xulapp/chrome/content/vendor/xpcomcore/README +0 -27
  33. data/xulapp/chrome/content/vendor/xpcomcore/Rakefile +0 -83
  34. data/xulapp/chrome/content/vendor/xpcomcore/VERSION.yml +0 -5
  35. data/xulapp/chrome/content/vendor/xpcomcore/bootstrapper.js +0 -32
  36. data/xulapp/chrome/content/vendor/xpcomcore/components/XPCOMCore.js +0 -120
  37. data/xulapp/chrome/content/vendor/xpcomcore/doc/files.html +0 -241
  38. data/xulapp/chrome/content/vendor/xpcomcore/doc/index.html +0 -243
  39. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/Error.html +0 -256
  40. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/Kernel.html +0 -1030
  41. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/LoadError.html +0 -319
  42. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/SelfConceptError.html +0 -319
  43. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/_global_.html +0 -316
  44. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/src/lib_file.js.html +0 -53
  45. data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/src/lib_kernel.js.html +0 -251
  46. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/README.txt +0 -186
  47. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Chain.js +0 -102
  48. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Dumper.js +0 -144
  49. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Hash.js +0 -84
  50. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Link.js +0 -153
  51. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Namespace.js +0 -10
  52. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Opt.js +0 -134
  53. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Reflection.js +0 -26
  54. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/String.js +0 -93
  55. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Testrun.js +0 -129
  56. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame.js +0 -33
  57. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/FOODOC.js +0 -26
  58. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js +0 -159
  59. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js +0 -16
  60. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js +0 -292
  61. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC.js +0 -26
  62. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/DocComment.js +0 -200
  63. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/DocTag.js +0 -294
  64. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js +0 -126
  65. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js +0 -109
  66. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Lang.js +0 -144
  67. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Parser.js +0 -145
  68. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js +0 -33
  69. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Symbol.js +0 -645
  70. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js +0 -241
  71. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/TextStream.js +0 -41
  72. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Token.js +0 -18
  73. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js +0 -332
  74. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js +0 -133
  75. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Util.js +0 -32
  76. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Walker.js +0 -474
  77. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC.js +0 -104
  78. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/main.js +0 -111
  79. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/commentSrcJson.js +0 -20
  80. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/frameworkPrototype.js +0 -16
  81. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/functionCall.js +0 -10
  82. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/publishSrcHilite.js +0 -62
  83. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/symbolLink.js +0 -10
  84. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/tagParamConfig.js +0 -31
  85. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/tagSynonyms.js +0 -43
  86. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/run.js +0 -348
  87. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/t/TestDoc.js +0 -144
  88. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/t/runner.js +0 -13
  89. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/addon.js +0 -24
  90. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/anon_inner.js +0 -14
  91. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/augments.js +0 -31
  92. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/augments2.js +0 -26
  93. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/borrows.js +0 -46
  94. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/borrows2.js +0 -23
  95. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/config.js +0 -22
  96. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/constructs.js +0 -18
  97. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/encoding.js +0 -10
  98. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/encoding_other.js +0 -12
  99. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/event.js +0 -54
  100. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/exports.js +0 -14
  101. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/functions_anon.js +0 -39
  102. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/functions_nested.js +0 -33
  103. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/global.js +0 -13
  104. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/globals.js +0 -25
  105. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/ignore.js +0 -10
  106. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/inner.js +0 -16
  107. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/jsdoc_test.js +0 -477
  108. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/lend.js +0 -33
  109. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/memberof.js +0 -19
  110. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/memberof_constructor.js +0 -17
  111. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/module.js +0 -17
  112. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/name.js +0 -19
  113. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/namespace_nested.js +0 -23
  114. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/nocode.js +0 -13
  115. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/oblit_anon.js +0 -20
  116. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/overview.js +0 -20
  117. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/param_inline.js +0 -37
  118. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/params_optional.js +0 -8
  119. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype.js +0 -17
  120. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype_nested.js +0 -9
  121. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype_oblit.js +0 -13
  122. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype_oblit_constructor.js +0 -24
  123. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/public.js +0 -10
  124. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/scripts/code.js +0 -5
  125. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/scripts/notcode.txt +0 -5
  126. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/shared.js +0 -42
  127. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/shared2.js +0 -2
  128. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/shortcuts.js +0 -22
  129. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/static_this.js +0 -13
  130. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/synonyms.js +0 -31
  131. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/tosource.js +0 -23
  132. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/variable_redefine.js +0 -14
  133. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test.js +0 -325
  134. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/changes.txt +0 -96
  135. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/conf/sample.conf +0 -31
  136. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/build.xml +0 -36
  137. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/build_1.4.xml +0 -36
  138. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/classes/js.jar +0 -0
  139. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/src/JsDebugRun.java +0 -21
  140. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/src/JsRun.java +0 -21
  141. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/jsdebug.jar +0 -0
  142. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/jsrun.jar +0 -0
  143. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/jsrun.sh +0 -52
  144. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl +0 -17
  145. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl +0 -56
  146. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/class.tmpl +0 -646
  147. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/index.tmpl +0 -39
  148. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/publish.js +0 -200
  149. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/static/default.css +0 -162
  150. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/static/header.html +0 -2
  151. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/static/index.html +0 -19
  152. data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/symbol.tmpl +0 -35
  153. data/xulapp/chrome/content/vendor/xpcomcore/lib/file.js +0 -46
  154. data/xulapp/chrome/content/vendor/xpcomcore/lib/kernel.js +0 -244
  155. data/xulapp/chrome/content/vendor/xpcomcore/test/file_test.js +0 -16
  156. data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/love.js +0 -1
  157. data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/mad_love.js +0 -1
  158. data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/mad_world.js +0 -1
  159. data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/syntax_error.js +0 -1
  160. data/xulapp/chrome/content/vendor/xpcomcore/test/kernel_test.js +0 -88
  161. data/xulapp/components/bootstrap.js +0 -93
  162. data/xulapp/defaults/preferences/prefs.js +0 -14
@@ -1,244 +0,0 @@
1
- /**
2
- * @fileoverview This file specifies a set of globally useful features/shortcuts
3
- * and defines our "Kernel" object, which is the base for doing a lot of simple
4
- * things with XPCOMCore such as loading in other files and printing to the
5
- * console.
6
- */
7
-
8
- /**
9
- * @class Exception representing an error loading a file.
10
- * @extends Error
11
- * @constructor
12
- * @param {String} message The error message to be given for this exception.
13
- * @type Error
14
- */
15
- function LoadError(message) {
16
- var err = new Error(message);
17
- err.name = arguments.callee.name;
18
- return err;
19
- };
20
-
21
- /**
22
- * @class Exception representing an error determining what the path to the currently executing file is.
23
- * @extends Error
24
- * @constructor
25
- * @param {String} message The error message to be given for this exception.
26
- * @type Error
27
- */
28
- function SelfConceptError(message) {
29
- var err = new Error(message);
30
- err.name = arguments.callee.name;
31
- return err;
32
- };
33
-
34
- /**
35
- * A pseudo-constructor to make JSDoc happy and actually document things in {@link Kernel}.
36
- * If this method is called with an argument, all properties from {@link Kernel} are taken
37
- * and defined as the return value of getter methods set on the given object.
38
- * @class Our central 'class' containing a lot of properties and methods we need to
39
- * build the rest of XPCOMCore on top of.
40
- * @param {Object} mixinScope Optional argument, any object to mix {@link Kernel}'s properties
41
- * into.
42
- * @return The prototype object of the Kernel function.
43
- */
44
- function Kernel(mixinScope) {
45
- var myPrototype = arguments.callee.prototype;
46
- if (mixinScope) {
47
- // FIXME - figure out a better way than this object jammed in here to special case our
48
- // methods we really want to be calling getters when they're mixed in.
49
- var callingGetters = {'$CURRENT_FILE': {defaultArgs: [2]}, '$CURRENT_DIRECTORY': {defaultArgs: [3] }};
50
- var makeGetter = function(attr) { return function() { return myPrototype[attr]; } };
51
- var makeCallingGetter = function(attr, argsArray) {
52
- return function() {
53
- return myPrototype[attr].apply(this, argsArray);
54
- }
55
- };
56
-
57
- for (var p in myPrototype) {
58
- if (callingGetters[p]) {
59
- mixinScope.__defineGetter__(p, makeCallingGetter(p, callingGetters[p].defaultArgs || []));
60
- } else {
61
- mixinScope.__defineGetter__(p, makeGetter(p));
62
- }
63
- };
64
-
65
- // Load up our standard library into the mixinScope.
66
- var standardLibraries = ['file'];
67
- var standardLibraryLoader = function() {
68
- standardLibraries.forEach(function(library) { require(library); }, this);
69
- };
70
- standardLibraryLoader.call(mixinScope);
71
- };
72
- return myPrototype;
73
- };
74
-
75
- Kernel.prototype = {
76
- /**
77
- * A shortcut constant to Components.classes.
78
- * @final
79
- */
80
- $Cc: Components.classes,
81
-
82
- /**
83
- * A shortcut constant to Components.interfaces.
84
- * @final
85
- */
86
- $Ci: Components.interfaces,
87
-
88
- /**
89
- * A shortcut constant to Components.results.
90
- * @final
91
- */
92
- $Cr: Components.results,
93
-
94
- /**
95
- * A shortcut constant to Components.utils.
96
- * @final
97
- */
98
- $Cu: Components.utils,
99
-
100
- /**
101
- * Taking inspiration from Ruby, this defines the set of paths to check when
102
- * trying to load a file via either {@link Kernel#load} or {@link Kernel#require}.
103
- * @final
104
- * @type Array
105
- */
106
- $LOAD_PATH: [XPCOMCoreConfig.getProperty('libRoot')],
107
-
108
- /**
109
- * Taking inspiration from Ruby, this defines the currently loaded files that
110
- * have been loaded through {@link Kernel#require}.
111
- * @final
112
- * @type Array
113
- */
114
- $LOADED_FEATURES: ["kernel.js"],
115
-
116
- /**
117
- * Taking inspiration from Ruby, this method tries to determine the filesystem path to
118
- * the caller code of this method.
119
- * NOTE - when {@link Kernel} is mixed into an object, this function gets mixed in via
120
- * a special case behaviour that makes it a getter that actually calls the function
121
- * rather than returning the function object itself. This is to facilitate being able
122
- * to call '$CURRENT_FILE' in your code rather than '$CURRENT_FILE()'. The stackTraversalDepth
123
- * parameter is there for this reason, since we need to traverse the stack further than
124
- * normal to find the calling scope than we normally would.
125
- * @type String
126
- * @param {int} stackTraversalDepth Optional argument, how far to look up the stack to
127
- * figure out who called us. The default is usually safe.
128
- * @throws {@link SelfConceptError} Thrown when we can't figure out what the filesystem
129
- * path to the current file is.
130
- */
131
- $CURRENT_FILE: function(stackTraversalDepth) {
132
- try {
133
- var stackTraversalDepth = stackTraversalDepth || 1;
134
- var ioService = $Cc["@mozilla.org/network/io-service;1"].getService($Ci.nsIIOService);
135
- // FIXME - UGH. This is so seedy.
136
- // Traverse up the stack as far as needed to get our caller's stack frame. Sometimes we need to
137
- // traverse more than one level up, like when this function is actually called from a getter
138
- // property that references it.
139
- var callerStack = Components.stack;
140
- for (var i = 0; i < stackTraversalDepth; i++) {
141
- callerStack = callerStack.caller;
142
- }
143
- // Split based on the stupid fucking " -> " Gecko puts in the filename and get the last entry
144
- var ostensiblyUs = callerStack.filename.split(" -> ").slice(-1);
145
- var callerFileURI = ioService.newURI(ostensiblyUs, null, null);
146
- // QI for an nsIFileURL which lets us get a handle on an actual file attribute and automagically does
147
- // resource: URL resolution for us
148
- callerFileURI.QueryInterface($Ci.nsIFileURL);
149
- // And theoretically, we can now get a handle on an nsIFile and return the path of that.
150
- return callerFileURI.file.path;
151
- } catch(e) {
152
- throw(new SelfConceptError("The filesystem location of the current file could not be determined. -- " + e));
153
- }
154
- },
155
-
156
- /**
157
- * This method tries to determine the filesystem path to parent directory of the caller
158
- * code of this method NOTE - see the note on $CURRENT_FILE, as the same applies here.
159
- * @type String
160
- * @param {int} stackTraversalDepth Optional argument, how far to look up the stack to
161
- * figure out who called us. The default is usually safe.
162
- * @throws {@link SelfConceptError} Thrown when we can't figure out what the filesystem
163
- * path to the parent directory of the current file is.
164
- */
165
- $CURRENT_DIRECTORY: function(stackTraversalDepth) {
166
- var stackTraversalDepth = stackTraversalDepth || 2;
167
- var currentFilePath = Kernel.prototype.$CURRENT_FILE(stackTraversalDepth);
168
-
169
- var fileObject = $Cc["@mozilla.org/file/local;1"].createInstance($Ci.nsILocalFile);
170
- fileObject.initWithPath(currentFilePath);
171
-
172
- return fileObject.parent.path;
173
- },
174
-
175
- /**
176
- * Prints a string to standard out, without a trailing newline.
177
- * @param {String} str String to print to standard out.
178
- */
179
- print: function(str) {
180
- dump(str);
181
- },
182
-
183
- /**
184
- * Prints a string to standard out, with a trailing newline.
185
- * @param {String} str String to print to standard out.
186
- */
187
- puts: function(str) {
188
- print(str + "\n");
189
- },
190
-
191
- /**
192
- * Searches {@link Kernel#$LOAD_PATH $LOAD_PATH} for files to load into the current global scope.
193
- * Files loaded via this method will not be added to {@link Kernel#$LOADED_FEATURES} and hence
194
- * can be repeatedly loaded and executed.
195
- * @param {String} featurePath Full or relative path including file extension to try and load.
196
- * @type Boolean
197
- * @throws {@link LoadError} Thrown when we can't find the specified file in any directories specified
198
- * in {@link Kernel#$LOAD_PATH $LOAD_PATH}.
199
- */
200
- load: function(featurePath) {
201
- var loader = $Cc["@mozilla.org/moz/jssubscript-loader;1"].getService($Ci.mozIJSSubScriptLoader);
202
- var foundFile = null;
203
- // FIXME - so this is kinda shitty. We have an empty entry here so we default to just trying to load
204
- // from an absolute path
205
- var loadPath = $LOAD_PATH.concat([""]);
206
- var loadPathLength = loadPath.length;
207
- // FIXME - mozilla bug here. if i use foreach on array it ignores the granted security privileges
208
- for (var i = 0; i < loadPathLength; i++) {
209
- var potentialFile = $Cc["@mozilla.org/file/local;1"].createInstance($Ci.nsILocalFile);
210
- potentialFile.initWithPath(loadPath[i] + "/" + featurePath);
211
- if (potentialFile.exists()) {
212
- foundFile = potentialFile;
213
- break;
214
- }
215
- };
216
- if (foundFile) {
217
- foundFile.normalize();
218
- loader.loadSubScript("file://" + encodeURI(foundFile.path));
219
- return true;
220
- } else {
221
- throw(new LoadError("no such file to load -- " + featurePath));
222
- }
223
- },
224
-
225
- /**
226
- * Searches {@link Kernel#$LOAD_PATH $LOAD_PATH} for features to load into the current global scope.
227
- * Files loaded via this method will be added to {@link Kernel#$LOADED_FEATURES} and hence two
228
- * consecutive calls to this method will not load and execute the code twice.
229
- * @type Boolean True if successful, false if the specified feature has already been required.
230
- * @param {String} featurePath Full or relative path without the file extension to try and require.
231
- * @throws {@link LoadError} Thrown when we can't find the specified feature in any directories specified
232
- * in {@link Kernel#$LOAD_PATH $LOAD_PATH}.
233
- */
234
- require: function(feature) {
235
- var jsFeature = feature + ".js";
236
- if ($LOADED_FEATURES.indexOf(jsFeature) == -1) {
237
- load(jsFeature);
238
- $LOADED_FEATURES.push(jsFeature);
239
- return true;
240
- } else {
241
- return false;
242
- }
243
- }
244
- };
@@ -1,16 +0,0 @@
1
- XULTestCase.create("File Test", function(setup, teardown, test) {
2
- setup(function() {
3
- });
4
-
5
- test("File.join should properly put together strings", function() {
6
- this.assertEqual($CURRENT_FILE, File.join($CURRENT_DIRECTORY, "file_test.js"));
7
- });
8
-
9
- test("File.read without a maxBytes argument should read the entire contents of a file if it exists", function() {
10
- this.assertEqual("var love = true;", File.read(File.join($CURRENT_DIRECTORY, "fixtures", "love.js")));
11
- });
12
-
13
- test("File.read with a maxBytes argument should read the given number of bytes from a file", function() {
14
- this.assertEqual("var love", File.read(File.join($CURRENT_DIRECTORY, "fixtures", "love.js"), 8));
15
- });
16
- });
@@ -1 +0,0 @@
1
- var love = true;
@@ -1 +0,0 @@
1
- var mad_love = true;
@@ -1 +0,0 @@
1
- var mad_world = true;
@@ -1,88 +0,0 @@
1
- XULTestCase.create("Kernel Test", function(setup, teardown, test) {
2
- setup(function() {
3
- // FIXME: Replace with real File class.
4
- this.File = Components.Constructor("@mozilla.org/file/local;1", $Ci.nsILocalFile, "initWithPath");
5
- $LOAD_PATH.push(this.File($CURRENT_FILE).parent.path + "/fixtures");
6
- });
7
-
8
- test("Kernel() function should mix its properties into the passed in scope", function(){
9
- var newScope = {};
10
- this.assertNotEqual(0, Kernel.prototype.__count__);
11
- this.assertEqual(0, newScope.__count__);
12
- Kernel(newScope);
13
- this.assertEqual(Kernel.prototype.__count__, newScope.__count__);
14
- });
15
-
16
-
17
- test("$CURRENT_FILE should be exposed as a getter that returns a value that is not a function", function(){
18
- this.assertNotEqual("function", typeof($CURRENT_FILE));
19
- });
20
-
21
- test("$CURRENT_FILE should end in kernel_test.js", function(){
22
- this.assertMatch(/kernel_test.js$/, $CURRENT_FILE);
23
- });
24
-
25
-
26
- test("$CURRENT_DIRECTORY should be exposed as a getter that returns a value that is not a function", function(){
27
- this.assertNotEqual("function", typeof($CURRENT_DIRECTORY));
28
- });
29
-
30
- test("$CURRENT_DIRECTORY should end in test", function(){
31
- this.assertMatch(/test$/, $CURRENT_DIRECTORY);
32
- });
33
-
34
-
35
- test("load should throw an exception when you give it a non-existent resource", function() {
36
- this.assertRaise("LoadError", function() {
37
- load("some-junk");
38
- });
39
- });
40
-
41
- test("load should return true when it can load a file successfully", function() {
42
- this.assertEqual(true, load("love.js"));
43
- });
44
-
45
- test("load should bubble up a syntax error if the loaded file is syntactically whack", function() {
46
- this.assertRaise("SyntaxError", function() { load("syntax_error.js") });
47
- });
48
-
49
- test("load should allow loading a resource multiple times", function() {
50
- load("love.js");
51
- this.assertEqual(true, love);
52
-
53
- love = false;
54
- load("love.js");
55
- this.assertEqual(true, love);
56
- });
57
-
58
- test("load works when using absolute paths", function() {
59
- love = false;
60
-
61
- var absolutePath = this.File($CURRENT_FILE).parent.path + "/fixtures/love.js";
62
- // FIXME: this is unix-only and janky:
63
- this.assertMatch(/^\//, absolutePath);
64
-
65
- load(absolutePath);
66
- this.assertEqual(true, love);
67
- });
68
-
69
-
70
- test("require should load a file the first time (just like load)", function() {
71
- this.assertEqual(true, require("love"));
72
- });
73
-
74
- test("require should return false if the resource has already been loaded", function() {
75
- require("mad_love");
76
- this.assertEqual(false, require("mad_love"));
77
- });
78
-
79
- test("require should not load a resource that's already been loaded", function() {
80
- require("mad_world");
81
- this.assertEqual(true, mad_world);
82
-
83
- mad_world = false;
84
- require("mad_world");
85
- this.assertEqual(false, mad_world);
86
- });
87
-
88
- });
@@ -1,93 +0,0 @@
1
- var altXPCCoreLocation = Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment).get('XPCOMCORE');
2
- // FIXME - this will break if the full path isnt specified in the XPCOMCORE environment var
3
- var xpcomCoreLocation = (altXPCCoreLocation ? "file://" + altXPCCoreLocation : "resource://app/chrome/content/vendor/xpcomcore");
4
- Components.utils.import(xpcomCoreLocation + "/bootstrapper.js");
5
- XPCOMCore({scope: this});
6
-
7
- // Meat and potatoes begins here.
8
- $Cu.import("resource://gre/modules/XPCOMUtils.jsm");
9
-
10
- // Singleton time
11
- var xtrCommandLineHandlerInstance = null;
12
- var xtrCommandLineHandler = function() {
13
- if (xtrCommandLineHandlerInstance) { return xtrCommandLineHandlerInstance; }
14
- this.wrappedJSObject = this;
15
- xtrCommandLineHandlerInstance = this;
16
- };
17
-
18
- xtrCommandLineHandler.prototype = {
19
- args: {},
20
- classDescription: "XULTestRunner Command Line Handler",
21
- contractID: "@conflagrationjs.org/xultestrunner/app-startup-clh;1",
22
- classID: Components.ID("{1073bad0-9b5c-11de-8a39-0800200c9a66}"),
23
- // FIXME - Firefox 3.5.2 has included a weird bug where getService on my
24
- // XPCOM component fails so the helpInfo never shows up.
25
- // http://groups.google.com/group/mozilla.dev.extensions/browse_thread/thread/e505ce76e23c5289#
26
- helpInfo: " -testDir Path to a test directory.\n -testFile Path to a single test file.\n",
27
- QueryInterface: XPCOMUtils.generateQI([$Ci.nsIObserver, $Ci.nsICommandLineHandler]),
28
- _xpcom_categories: [{category: "command-line-handler", entry: "m-xultestrunner"}],
29
-
30
- handle: function(cmdLine) {
31
- try {
32
- var testDir = cmdLine.handleFlagWithParam("testDir", false);
33
- var testFile = cmdLine.handleFlagWithParam("testFile", false);
34
- // We got either flag with no params if this is thrown.
35
- } catch (e if e.result == $Cr.NS_ERROR_ILLEGAL_VALUE) {
36
- this._handleEmptyPaths();
37
- }
38
- this._handleArguments(cmdLine, testDir, testFile);
39
- },
40
-
41
- _handleArguments: function(cmdLine, testDir, testFile) {
42
- if (testDir) {
43
- this._catchMissingFile(testDir, function(){
44
- this.args.testDir = this._normalizePath(cmdLine.workingDirectory, testDir);
45
- });
46
- } else if (testFile) {
47
- this._catchMissingFile(testFile, function(){
48
- this.args.testFile = this._normalizePath(cmdLine.workingDirectory, testFile);
49
- });
50
- } else {
51
- this._handleNoArguments();
52
- }
53
- },
54
-
55
- _handleEmptyPaths: function() {
56
- puts("-testDir or -testFile were given without arguments. Please specify a path to a test file or directory.");
57
- throw($Cr.NS_ERROR_ABORT);
58
- },
59
-
60
- _handleNoArguments: function() {
61
- puts("-testDir or -testFile must be specified. Please specify a path to a test file or directory.");
62
- throw($Cr.NS_ERROR_ABORT);
63
- },
64
-
65
- // FIXME - ghetto. but cmdLine.resolvePath is busted like a fox. a firefox. HAHAHAHA
66
- _normalizePath: function(workingDirFile, path) {
67
- if (path.match(/^\//)) {
68
- var fullPath = $Cc["@mozilla.org/file/local;1"].createInstance($Ci.nsILocalFile);
69
- fullPath.initWithPath(path);
70
- } else {
71
- var fullPath = workingDirFile.clone();
72
- fullPath.QueryInterface($Ci.nsILocalFile);
73
- fullPath.appendRelativePath(path);
74
- }
75
- fullPath.normalize();
76
- return fullPath;
77
- },
78
-
79
- _catchMissingFile: function(attemptedPath, wrappedFunc) {
80
- try {
81
- wrappedFunc.call(this);
82
- } catch (e if e.result == $Cr.NS_ERROR_FILE_NOT_FOUND) {
83
- puts("Given path '" + attemptedPath + "' does not exist.");
84
- throw($Cr.NS_ERROR_ABORT);
85
- }
86
- }
87
-
88
- };
89
-
90
-
91
- NSGetModule = function(compMgr, fileSpec) {
92
- return XPCOMUtils.generateModule([xtrCommandLineHandler]);
93
- };
@@ -1,14 +0,0 @@
1
- pref("toolkit.defaultChromeURI", "chrome://xultestrunner/content/interface/boot.xul");
2
- pref("toolkit.defaultChromeFeatures", "chrome,menubar,status,resizable");
3
-
4
- // FIXME - grants the browser crazy privileges to run tests
5
- pref("signed.applets.codebase_principal_support", true);
6
- pref("capability.principal.codebase.p0.granted", "UniversalXPConnect UniversalBrowserRead UniversalBrowserWrite UniversalPreferencesRead UniversalPreferencesWrite CapabilityPreferencesAccess UniversalFileRead");
7
- pref("capability.principal.codebase.p0.id", "resource://xultestrunner");
8
- pref("capability.principal.codebase.p0.subjectName", "");
9
-
10
- pref("javascript.options.showInConsole", true);
11
- // TODO - only disable caching in development mode.
12
- pref("nglayout.debug.disable_xul_cache", true);
13
- pref("nglayout.debug.disable_xul_fastload", true);
14
- pref("browser.dom.window.dump.enabled", true);