xultestrunner 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.gitmodules +3 -0
- data/LICENSE +21 -0
- data/README +17 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/bin/xultest +13 -0
- data/lib/xultestrunner.rb +1 -0
- data/xulapp/application.ini +9 -0
- data/xulapp/chrome/chrome.manifest +2 -0
- data/xulapp/chrome/content/interface/boot.xul +20 -0
- data/xulapp/chrome/content/interface/testharness.html +30 -0
- data/xulapp/chrome/content/lib/xultestcase.js +140 -0
- data/xulapp/chrome/content/lib/xultestrunner.js +120 -0
- data/xulapp/chrome/content/vendor/prototype/LICENSE +16 -0
- data/xulapp/chrome/content/vendor/prototype/prototype.js +4874 -0
- data/xulapp/chrome/content/vendor/scriptaculous/LICENSE +20 -0
- data/xulapp/chrome/content/vendor/scriptaculous/test.css +90 -0
- data/xulapp/chrome/content/vendor/scriptaculous/unittest.js +566 -0
- data/xulapp/chrome/content/vendor/xpcomcore/LICENSE +21 -0
- data/xulapp/chrome/content/vendor/xpcomcore/README +27 -0
- data/xulapp/chrome/content/vendor/xpcomcore/Rakefile +83 -0
- data/xulapp/chrome/content/vendor/xpcomcore/VERSION.yml +5 -0
- data/xulapp/chrome/content/vendor/xpcomcore/bootstrapper.js +32 -0
- data/xulapp/chrome/content/vendor/xpcomcore/components/XPCOMCore.js +120 -0
- data/xulapp/chrome/content/vendor/xpcomcore/doc/files.html +241 -0
- data/xulapp/chrome/content/vendor/xpcomcore/doc/index.html +243 -0
- data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/Error.html +256 -0
- data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/Kernel.html +1030 -0
- data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/LoadError.html +319 -0
- data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/SelfConceptError.html +319 -0
- data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/_global_.html +316 -0
- data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/src/lib_file.js.html +53 -0
- data/xulapp/chrome/content/vendor/xpcomcore/doc/symbols/src/lib_kernel.js.html +251 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/README.txt +186 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame.js +33 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Chain.js +102 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Dumper.js +144 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Hash.js +84 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Link.js +153 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Namespace.js +10 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Opt.js +134 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Reflection.js +26 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/String.js +93 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/frame/Testrun.js +129 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/FOODOC.js +26 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC.js +26 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js +159 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js +16 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js +292 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC.js +104 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/DocComment.js +200 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/DocTag.js +294 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js +126 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js +109 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Lang.js +144 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Parser.js +145 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js +33 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Symbol.js +645 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js +241 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/TextStream.js +41 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Token.js +18 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js +332 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js +133 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Util.js +32 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/lib/JSDOC/Walker.js +474 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/main.js +111 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/commentSrcJson.js +20 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/frameworkPrototype.js +16 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/functionCall.js +10 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/publishSrcHilite.js +62 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/symbolLink.js +10 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/tagParamConfig.js +31 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/plugins/tagSynonyms.js +43 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/run.js +348 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/t/TestDoc.js +144 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/t/runner.js +13 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test.js +325 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/addon.js +24 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/anon_inner.js +14 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/augments.js +31 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/augments2.js +26 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/borrows.js +46 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/borrows2.js +23 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/config.js +22 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/constructs.js +18 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/encoding.js +10 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/encoding_other.js +12 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/event.js +54 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/exports.js +14 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/functions_anon.js +39 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/functions_nested.js +33 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/global.js +13 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/globals.js +25 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/ignore.js +10 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/inner.js +16 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/jsdoc_test.js +477 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/lend.js +33 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/memberof.js +19 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/memberof_constructor.js +17 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/module.js +17 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/name.js +19 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/namespace_nested.js +23 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/nocode.js +13 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/oblit_anon.js +20 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/overview.js +20 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/param_inline.js +37 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/params_optional.js +8 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype.js +17 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype_nested.js +9 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype_oblit.js +13 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/prototype_oblit_constructor.js +24 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/public.js +10 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/scripts/code.js +5 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/scripts/notcode.txt +5 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/shared.js +42 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/shared2.js +2 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/shortcuts.js +22 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/static_this.js +13 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/synonyms.js +31 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/tosource.js +23 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/app/test/variable_redefine.js +14 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/changes.txt +96 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/conf/sample.conf +31 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/build.xml +36 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/build_1.4.xml +36 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/classes/js.jar +0 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/src/JsDebugRun.java +21 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/java/src/JsRun.java +21 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/jsdebug.jar +0 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/jsrun.jar +0 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/jsrun.sh +52 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl +17 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl +56 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/class.tmpl +646 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/index.tmpl +39 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/publish.js +200 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/static/default.css +162 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/static/header.html +2 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/static/index.html +19 -0
- data/xulapp/chrome/content/vendor/xpcomcore/etc/jsdoc-toolkit/templates/jsdoc/symbol.tmpl +35 -0
- data/xulapp/chrome/content/vendor/xpcomcore/lib/file.js +46 -0
- data/xulapp/chrome/content/vendor/xpcomcore/lib/kernel.js +244 -0
- data/xulapp/chrome/content/vendor/xpcomcore/test/file_test.js +16 -0
- data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/love.js +1 -0
- data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/mad_love.js +1 -0
- data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/mad_world.js +1 -0
- data/xulapp/chrome/content/vendor/xpcomcore/test/fixtures/syntax_error.js +1 -0
- data/xulapp/chrome/content/vendor/xpcomcore/test/kernel_test.js +88 -0
- data/xulapp/components/bootstrap.js +93 -0
- data/xulapp/defaults/preferences/prefs.js +14 -0
- data/xultestrunner.gemspec +190 -0
- metadata +207 -0
@@ -0,0 +1,316 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
6
|
+
<meta name="generator" content="JsDoc Toolkit" />
|
7
|
+
|
8
|
+
<title>JsDoc Reference - _global_</title>
|
9
|
+
|
10
|
+
<style type="text/css">
|
11
|
+
/* default.css */
|
12
|
+
body
|
13
|
+
{
|
14
|
+
font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
|
15
|
+
width: 800px;
|
16
|
+
}
|
17
|
+
|
18
|
+
.header
|
19
|
+
{
|
20
|
+
clear: both;
|
21
|
+
background-color: #ccc;
|
22
|
+
padding: 8px;
|
23
|
+
}
|
24
|
+
|
25
|
+
h1
|
26
|
+
{
|
27
|
+
font-size: 150%;
|
28
|
+
font-weight: bold;
|
29
|
+
padding: 0;
|
30
|
+
margin: 1em 0 0 .3em;
|
31
|
+
}
|
32
|
+
|
33
|
+
hr
|
34
|
+
{
|
35
|
+
border: none 0;
|
36
|
+
border-top: 1px solid #7F8FB1;
|
37
|
+
height: 1px;
|
38
|
+
}
|
39
|
+
|
40
|
+
pre.code
|
41
|
+
{
|
42
|
+
display: block;
|
43
|
+
padding: 8px;
|
44
|
+
border: 1px dashed #ccc;
|
45
|
+
}
|
46
|
+
|
47
|
+
#index
|
48
|
+
{
|
49
|
+
margin-top: 24px;
|
50
|
+
float: left;
|
51
|
+
width: 160px;
|
52
|
+
position: absolute;
|
53
|
+
left: 8px;
|
54
|
+
background-color: #F3F3F3;
|
55
|
+
padding: 8px;
|
56
|
+
}
|
57
|
+
|
58
|
+
#content
|
59
|
+
{
|
60
|
+
margin-left: 190px;
|
61
|
+
width: 600px;
|
62
|
+
}
|
63
|
+
|
64
|
+
.classList
|
65
|
+
{
|
66
|
+
list-style-type: none;
|
67
|
+
padding: 0;
|
68
|
+
margin: 0 0 0 8px;
|
69
|
+
font-family: arial, sans-serif;
|
70
|
+
font-size: 1em;
|
71
|
+
overflow: auto;
|
72
|
+
}
|
73
|
+
|
74
|
+
.classList li
|
75
|
+
{
|
76
|
+
padding: 0;
|
77
|
+
margin: 0 0 8px 0;
|
78
|
+
}
|
79
|
+
|
80
|
+
.summaryTable { width: 100%; }
|
81
|
+
|
82
|
+
h1.classTitle
|
83
|
+
{
|
84
|
+
font-size:170%;
|
85
|
+
line-height:130%;
|
86
|
+
}
|
87
|
+
|
88
|
+
h2 { font-size: 110%; }
|
89
|
+
caption, div.sectionTitle
|
90
|
+
{
|
91
|
+
background-color: #7F8FB1;
|
92
|
+
color: #fff;
|
93
|
+
font-size:130%;
|
94
|
+
text-align: left;
|
95
|
+
padding: 2px 6px 2px 6px;
|
96
|
+
border: 1px #7F8FB1 solid;
|
97
|
+
}
|
98
|
+
|
99
|
+
div.sectionTitle { margin-bottom: 8px; }
|
100
|
+
.summaryTable thead { display: none; }
|
101
|
+
|
102
|
+
.summaryTable td
|
103
|
+
{
|
104
|
+
vertical-align: top;
|
105
|
+
padding: 4px;
|
106
|
+
border-bottom: 1px #7F8FB1 solid;
|
107
|
+
border-right: 1px #7F8FB1 solid;
|
108
|
+
}
|
109
|
+
|
110
|
+
/*col#summaryAttributes {}*/
|
111
|
+
.summaryTable td.attributes
|
112
|
+
{
|
113
|
+
border-left: 1px #7F8FB1 solid;
|
114
|
+
width: 140px;
|
115
|
+
text-align: right;
|
116
|
+
}
|
117
|
+
|
118
|
+
td.attributes, .fixedFont
|
119
|
+
{
|
120
|
+
line-height: 15px;
|
121
|
+
color: #002EBE;
|
122
|
+
font-family: "Courier New",Courier,monospace;
|
123
|
+
font-size: 13px;
|
124
|
+
}
|
125
|
+
|
126
|
+
.summaryTable td.nameDescription
|
127
|
+
{
|
128
|
+
text-align: left;
|
129
|
+
font-size: 13px;
|
130
|
+
line-height: 15px;
|
131
|
+
}
|
132
|
+
|
133
|
+
.summaryTable td.nameDescription, .description
|
134
|
+
{
|
135
|
+
line-height: 15px;
|
136
|
+
padding: 4px;
|
137
|
+
padding-left: 4px;
|
138
|
+
}
|
139
|
+
|
140
|
+
.summaryTable { margin-bottom: 8px; }
|
141
|
+
|
142
|
+
ul.inheritsList
|
143
|
+
{
|
144
|
+
list-style: square;
|
145
|
+
margin-left: 20px;
|
146
|
+
padding-left: 0;
|
147
|
+
}
|
148
|
+
|
149
|
+
.detailList {
|
150
|
+
margin-left: 20px;
|
151
|
+
line-height: 15px;
|
152
|
+
}
|
153
|
+
.detailList dt { margin-left: 20px; }
|
154
|
+
|
155
|
+
.detailList .heading
|
156
|
+
{
|
157
|
+
font-weight: bold;
|
158
|
+
padding-bottom: 6px;
|
159
|
+
margin-left: 0;
|
160
|
+
}
|
161
|
+
|
162
|
+
.light, td.attributes, .light a:link, .light a:visited
|
163
|
+
{
|
164
|
+
color: #777;
|
165
|
+
font-style: italic;
|
166
|
+
}
|
167
|
+
|
168
|
+
.fineprint
|
169
|
+
{
|
170
|
+
text-align: right;
|
171
|
+
font-size: 10px;
|
172
|
+
}
|
173
|
+
</style>
|
174
|
+
</head>
|
175
|
+
|
176
|
+
<body>
|
177
|
+
<!-- ============================== header ================================= -->
|
178
|
+
<!-- begin static/header.html -->
|
179
|
+
<div id="header">
|
180
|
+
</div>
|
181
|
+
<!-- end static/header.html -->
|
182
|
+
|
183
|
+
<!-- ============================== classes index ============================ -->
|
184
|
+
<div id="index">
|
185
|
+
<!-- begin publish.classesIndex -->
|
186
|
+
<div align="center"><a href="../index.html">Class Index</a>
|
187
|
+
| <a href="../files.html">File Index</a></div>
|
188
|
+
<hr />
|
189
|
+
<h2>Classes</h2>
|
190
|
+
<ul class="classList">
|
191
|
+
|
192
|
+
<li><i><a href="../symbols/_global_.html">_global_</a></i></li>
|
193
|
+
|
194
|
+
<li><a href="../symbols/Error.html">Error</a></li>
|
195
|
+
|
196
|
+
<li><a href="../symbols/Kernel.html">Kernel</a></li>
|
197
|
+
|
198
|
+
<li><a href="../symbols/LoadError.html">LoadError</a></li>
|
199
|
+
|
200
|
+
<li><a href="../symbols/SelfConceptError.html">SelfConceptError</a></li>
|
201
|
+
|
202
|
+
</ul>
|
203
|
+
<hr />
|
204
|
+
<!-- end publish.classesIndex -->
|
205
|
+
</div>
|
206
|
+
|
207
|
+
<div id="content">
|
208
|
+
<!-- ============================== class title ============================ -->
|
209
|
+
<h1 class="classTitle">
|
210
|
+
|
211
|
+
Built-In Namespace _global_
|
212
|
+
</h1>
|
213
|
+
|
214
|
+
<!-- ============================== class summary ========================== -->
|
215
|
+
<p class="description">
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
</p>
|
222
|
+
|
223
|
+
<!-- ============================== constructor summary ==================== -->
|
224
|
+
|
225
|
+
|
226
|
+
<!-- ============================== properties summary ===================== -->
|
227
|
+
|
228
|
+
|
229
|
+
<!-- ============================== methods summary ======================== -->
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
<table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class _global_.">
|
234
|
+
<caption>Method Summary</caption>
|
235
|
+
<thead>
|
236
|
+
<tr>
|
237
|
+
<th scope="col">Method Attributes</th>
|
238
|
+
<th scope="col">Method Name and Description</th>
|
239
|
+
</tr>
|
240
|
+
</thead>
|
241
|
+
<tbody>
|
242
|
+
|
243
|
+
<tr>
|
244
|
+
<td class="attributes"> </td>
|
245
|
+
<td class="nameDescription">
|
246
|
+
<div class="fixedFont"><b><a href="../symbols/_global_.html#File">File</a></b>()
|
247
|
+
</div>
|
248
|
+
<div class="description">This will have docs when it actually does something</div>
|
249
|
+
</td>
|
250
|
+
</tr>
|
251
|
+
|
252
|
+
</tbody>
|
253
|
+
</table>
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
<!-- ============================== events summary ======================== -->
|
259
|
+
|
260
|
+
|
261
|
+
<!-- ============================== constructor details ==================== -->
|
262
|
+
|
263
|
+
|
264
|
+
<!-- ============================== field details ========================== -->
|
265
|
+
|
266
|
+
|
267
|
+
<!-- ============================== method details ========================= -->
|
268
|
+
|
269
|
+
<div class="sectionTitle">
|
270
|
+
Method Detail
|
271
|
+
</div>
|
272
|
+
|
273
|
+
<a name="File"> </a>
|
274
|
+
<div class="fixedFont">
|
275
|
+
|
276
|
+
|
277
|
+
<b>File</b>()
|
278
|
+
|
279
|
+
</div>
|
280
|
+
<div class="description">
|
281
|
+
This will have docs when it actually does something
|
282
|
+
|
283
|
+
<br />
|
284
|
+
<i>Defined in: </i> <a href="../symbols/src/lib_file.js.html">file.js</a>.
|
285
|
+
|
286
|
+
|
287
|
+
</div>
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
<!-- ============================== event details ========================= -->
|
304
|
+
|
305
|
+
|
306
|
+
<hr />
|
307
|
+
</div>
|
308
|
+
|
309
|
+
|
310
|
+
<!-- ============================== footer ================================= -->
|
311
|
+
<div class="fineprint" style="clear:both">
|
312
|
+
|
313
|
+
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.0 on Sat Oct 03 2009 19:31:42 GMT-0500 (CDT)
|
314
|
+
</div>
|
315
|
+
</body>
|
316
|
+
</html>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
|
2
|
+
.KEYW {color: #933;}
|
3
|
+
.COMM {color: #bbb; font-style: italic;}
|
4
|
+
.NUMB {color: #393;}
|
5
|
+
.STRN {color: #393;}
|
6
|
+
.REGX {color: #339;}
|
7
|
+
.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
|
8
|
+
</style></head><body><pre><span class='line'> 1</span> <span class="COMM">/**
|
9
|
+
<span class='line'> 2</span> * @fileoverview This file defines the implementation of our File object.
|
10
|
+
<span class='line'> 3</span> */</span><span class="WHIT">
|
11
|
+
<span class='line'> 4</span>
|
12
|
+
<span class='line'> 5</span> </span><span class="COMM">/**
|
13
|
+
<span class='line'> 6</span> * This will have docs when it actually does something
|
14
|
+
<span class='line'> 7</span> */</span><span class="WHIT">
|
15
|
+
<span class='line'> 8</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">File</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
16
|
+
<span class='line'> 9</span>
|
17
|
+
<span class='line'> 10</span> </span><span class="COMM">/**
|
18
|
+
<span class='line'> 11</span> * Joins the given string arguments together using the operating system's native path
|
19
|
+
<span class='line'> 12</span> * separator.
|
20
|
+
<span class='line'> 13</span> * @param {String} Set of strings to join together.
|
21
|
+
<span class='line'> 14</span> * @type String
|
22
|
+
<span class='line'> 15</span> */</span><span class="WHIT">
|
23
|
+
<span class='line'> 16</span> </span><span class="NAME">File.join</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
24
|
+
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">file</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$Cc</span><span class="PUNC">[</span><span class="STRN">"@mozilla.org/file/local;1"</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">createInstance</span><span class="PUNC">(</span><span class="NAME">$Ci.nsILocalFile</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
25
|
+
<span class='line'> 18</span> </span><span class="WHIT"> </span><span class="NAME">file.initWithPath</span><span class="PUNC">(</span><span class="NAME">arguments</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
26
|
+
<span class='line'> 19</span> </span><span class="WHIT">
|
27
|
+
<span class='line'> 20</span> </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">arguments.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
28
|
+
<span class='line'> 21</span> </span><span class="WHIT"> </span><span class="NAME">file.append</span><span class="PUNC">(</span><span class="NAME">arguments</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
29
|
+
<span class='line'> 22</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
30
|
+
<span class='line'> 23</span> </span><span class="WHIT">
|
31
|
+
<span class='line'> 24</span> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">file.path</span><span class="PUNC">;</span><span class="WHIT">
|
32
|
+
<span class='line'> 25</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
33
|
+
<span class='line'> 26</span>
|
34
|
+
<span class='line'> 27</span> </span><span class="COMM">/**
|
35
|
+
<span class='line'> 28</span> * Reads the given number of bytes (or the entire contents if the argument is ommitted)
|
36
|
+
<span class='line'> 29</span> * from the specified file
|
37
|
+
<span class='line'> 30</span> * @param {String} Path to a file.
|
38
|
+
<span class='line'> 31</span> * @param {int} Optional - number of bytes to read from the file.
|
39
|
+
<span class='line'> 32</span> * @type String
|
40
|
+
<span class='line'> 33</span> */</span><span class="WHIT">
|
41
|
+
<span class='line'> 34</span> </span><span class="NAME">File.read</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">filePath</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">maxBytes</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
42
|
+
<span class='line'> 35</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">file</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$Cc</span><span class="PUNC">[</span><span class="STRN">"@mozilla.org/file/local;1"</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">createInstance</span><span class="PUNC">(</span><span class="NAME">$Ci.nsILocalFile</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
43
|
+
<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="NAME">file.initWithPath</span><span class="PUNC">(</span><span class="NAME">filePath</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
44
|
+
<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">fileInputStream</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$Cc</span><span class="PUNC">[</span><span class="STRN">"@mozilla.org/network/file-input-stream;1"</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">createInstance</span><span class="PUNC">(</span><span class="NAME">$Ci.nsIFileInputStream</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
45
|
+
<span class='line'> 38</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">scriptableStream</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$Cc</span><span class="PUNC">[</span><span class="STRN">"@mozilla.org/scriptableinputstream;1"</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">createInstance</span><span class="PUNC">(</span><span class="NAME">$Ci.nsIScriptableInputStream</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
46
|
+
<span class='line'> 39</span> </span><span class="WHIT"> </span><span class="NAME">fileInputStream.init</span><span class="PUNC">(</span><span class="NAME">file</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
47
|
+
<span class='line'> 40</span> </span><span class="WHIT"> </span><span class="NAME">scriptableStream.init</span><span class="PUNC">(</span><span class="NAME">fileInputStream</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
48
|
+
<span class='line'> 41</span> </span><span class="WHIT"> </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
49
|
+
<span class='line'> 42</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">scriptableStream.read</span><span class="PUNC">(</span><span class="NAME">maxBytes</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">scriptableStream.available</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
50
|
+
<span class='line'> 43</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">finally</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
51
|
+
<span class='line'> 44</span> </span><span class="WHIT"> </span><span class="NAME">scriptableStream.close</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
52
|
+
<span class='line'> 45</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
53
|
+
<span class='line'> 46</span> </span><span class="PUNC">}</span><span class="PUNC">;</span></pre></body></html>
|
@@ -0,0 +1,251 @@
|
|
1
|
+
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
|
2
|
+
.KEYW {color: #933;}
|
3
|
+
.COMM {color: #bbb; font-style: italic;}
|
4
|
+
.NUMB {color: #393;}
|
5
|
+
.STRN {color: #393;}
|
6
|
+
.REGX {color: #339;}
|
7
|
+
.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
|
8
|
+
</style></head><body><pre><span class='line'> 1</span> <span class="COMM">/**
|
9
|
+
<span class='line'> 2</span> * @fileoverview This file specifies a set of globally useful features/shortcuts
|
10
|
+
<span class='line'> 3</span> * and defines our "Kernel" object, which is the base for doing a lot of simple
|
11
|
+
<span class='line'> 4</span> * things with XPCOMCore such as loading in other files and printing to the
|
12
|
+
<span class='line'> 5</span> * console.
|
13
|
+
<span class='line'> 6</span> */</span><span class="WHIT">
|
14
|
+
<span class='line'> 7</span>
|
15
|
+
<span class='line'> 8</span> </span><span class="COMM">/**
|
16
|
+
<span class='line'> 9</span> * @class Exception representing an error loading a file.
|
17
|
+
<span class='line'> 10</span> * @extends Error
|
18
|
+
<span class='line'> 11</span> * @constructor
|
19
|
+
<span class='line'> 12</span> * @param {String} message The error message to be given for this exception.
|
20
|
+
<span class='line'> 13</span> * @type Error
|
21
|
+
<span class='line'> 14</span> */</span><span class="WHIT">
|
22
|
+
<span class='line'> 15</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">LoadError</span><span class="PUNC">(</span><span class="NAME">message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
23
|
+
<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">err</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="NAME">message</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
24
|
+
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="NAME">err.name</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arguments.callee.name</span><span class="PUNC">;</span><span class="WHIT">
|
25
|
+
<span class='line'> 18</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">err</span><span class="PUNC">;</span><span class="WHIT">
|
26
|
+
<span class='line'> 19</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
27
|
+
<span class='line'> 20</span>
|
28
|
+
<span class='line'> 21</span> </span><span class="COMM">/**
|
29
|
+
<span class='line'> 22</span> * @class Exception representing an error determining what the path to the currently executing file is.
|
30
|
+
<span class='line'> 23</span> * @extends Error
|
31
|
+
<span class='line'> 24</span> * @constructor
|
32
|
+
<span class='line'> 25</span> * @param {String} message The error message to be given for this exception.
|
33
|
+
<span class='line'> 26</span> * @type Error
|
34
|
+
<span class='line'> 27</span> */</span><span class="WHIT">
|
35
|
+
<span class='line'> 28</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">SelfConceptError</span><span class="PUNC">(</span><span class="NAME">message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
36
|
+
<span class='line'> 29</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">err</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="NAME">message</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
37
|
+
<span class='line'> 30</span> </span><span class="WHIT"> </span><span class="NAME">err.name</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arguments.callee.name</span><span class="PUNC">;</span><span class="WHIT">
|
38
|
+
<span class='line'> 31</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">err</span><span class="PUNC">;</span><span class="WHIT">
|
39
|
+
<span class='line'> 32</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
40
|
+
<span class='line'> 33</span>
|
41
|
+
<span class='line'> 34</span> </span><span class="COMM">/**
|
42
|
+
<span class='line'> 35</span> * A pseudo-constructor to make JSDoc happy and actually document things in {@link Kernel}.
|
43
|
+
<span class='line'> 36</span> * If this method is called with an argument, all properties from {@link Kernel} are taken
|
44
|
+
<span class='line'> 37</span> * and defined as the return value of getter methods set on the given object.
|
45
|
+
<span class='line'> 38</span> * @class Our central 'class' containing a lot of properties and methods we need to
|
46
|
+
<span class='line'> 39</span> * build the rest of XPCOMCore on top of.
|
47
|
+
<span class='line'> 40</span> * @param {Object} mixinScope Optional argument, any object to mix {@link Kernel}'s properties
|
48
|
+
<span class='line'> 41</span> * into.
|
49
|
+
<span class='line'> 42</span> * @return The prototype object of the Kernel function.
|
50
|
+
<span class='line'> 43</span> */</span><span class="WHIT">
|
51
|
+
<span class='line'> 44</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">Kernel</span><span class="PUNC">(</span><span class="NAME">mixinScope</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
52
|
+
<span class='line'> 45</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">myPrototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arguments.callee.prototype</span><span class="PUNC">;</span><span class="WHIT">
|
53
|
+
<span class='line'> 46</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">mixinScope</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
54
|
+
<span class='line'> 47</span> </span><span class="WHIT"> </span><span class="COMM">// FIXME - figure out a better way than this object jammed in here to special case our</span><span class="WHIT">
|
55
|
+
<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="COMM">// methods we really want to be calling getters when they're mixed in.</span><span class="WHIT">
|
56
|
+
<span class='line'> 49</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">callingGetters</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="STRN">'$CURRENT_FILE'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">defaultArgs</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NUMB">2</span><span class="PUNC">]</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'$CURRENT_DIRECTORY'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">defaultArgs</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NUMB">3</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
57
|
+
<span class='line'> 50</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">makeGetter</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">attr</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">myPrototype</span><span class="PUNC">[</span><span class="NAME">attr</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
58
|
+
<span class='line'> 51</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">makeCallingGetter</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">attr</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">argsArray</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
59
|
+
<span class='line'> 52</span> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
60
|
+
<span class='line'> 53</span> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">myPrototype</span><span class="PUNC">[</span><span class="NAME">attr</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">apply</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">argsArray</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
61
|
+
<span class='line'> 54</span> </span><span class="PUNC">}</span><span class="WHIT">
|
62
|
+
<span class='line'> 55</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
63
|
+
<span class='line'> 56</span> </span><span class="WHIT">
|
64
|
+
<span class='line'> 57</span> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">p</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">myPrototype</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
65
|
+
<span class='line'> 58</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callingGetters</span><span class="PUNC">[</span><span class="NAME">p</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
66
|
+
<span class='line'> 59</span> </span><span class="WHIT"> </span><span class="NAME">mixinScope.__defineGetter__</span><span class="PUNC">(</span><span class="NAME">p</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">makeCallingGetter</span><span class="PUNC">(</span><span class="NAME">p</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callingGetters</span><span class="PUNC">[</span><span class="NAME">p</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">defaultArgs</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
67
|
+
<span class='line'> 60</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
68
|
+
<span class='line'> 61</span> </span><span class="WHIT"> </span><span class="NAME">mixinScope.__defineGetter__</span><span class="PUNC">(</span><span class="NAME">p</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">makeGetter</span><span class="PUNC">(</span><span class="NAME">p</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
69
|
+
<span class='line'> 62</span> </span><span class="PUNC">}</span><span class="WHIT">
|
70
|
+
<span class='line'> 63</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
71
|
+
<span class='line'> 64</span> </span><span class="WHIT">
|
72
|
+
<span class='line'> 65</span> </span><span class="COMM">// Load up our standard library into the mixinScope.</span><span class="WHIT">
|
73
|
+
<span class='line'> 66</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">standardLibraries</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="STRN">'file'</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
74
|
+
<span class='line'> 67</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">standardLibraryLoader</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
75
|
+
<span class='line'> 68</span> </span><span class="WHIT"> </span><span class="NAME">standardLibraries.forEach</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">library</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">require</span><span class="PUNC">(</span><span class="NAME">library</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
76
|
+
<span class='line'> 69</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
77
|
+
<span class='line'> 70</span> </span><span class="WHIT"> </span><span class="NAME">standardLibraryLoader.call</span><span class="PUNC">(</span><span class="NAME">mixinScope</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
78
|
+
<span class='line'> 71</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
79
|
+
<span class='line'> 72</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">myPrototype</span><span class="PUNC">;</span><span class="WHIT">
|
80
|
+
<span class='line'> 73</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
81
|
+
<span class='line'> 74</span>
|
82
|
+
<span class='line'> 75</span> </span><span class="NAME">Kernel.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
83
|
+
<span class='line'> 76</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
84
|
+
<span class='line'> 77</span> * A shortcut constant to Components.classes.
|
85
|
+
<span class='line'> 78</span> * @final
|
86
|
+
<span class='line'> 79</span> */</span><span class="WHIT">
|
87
|
+
<span class='line'> 80</span> </span><span class="WHIT"> </span><span class="NAME">$Cc</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">Components.classes</span><span class="PUNC">,</span><span class="WHIT">
|
88
|
+
<span class='line'> 81</span>
|
89
|
+
<span class='line'> 82</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
90
|
+
<span class='line'> 83</span> * A shortcut constant to Components.interfaces.
|
91
|
+
<span class='line'> 84</span> * @final
|
92
|
+
<span class='line'> 85</span> */</span><span class="WHIT">
|
93
|
+
<span class='line'> 86</span> </span><span class="WHIT"> </span><span class="NAME">$Ci</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">Components.interfaces</span><span class="PUNC">,</span><span class="WHIT">
|
94
|
+
<span class='line'> 87</span>
|
95
|
+
<span class='line'> 88</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
96
|
+
<span class='line'> 89</span> * A shortcut constant to Components.results.
|
97
|
+
<span class='line'> 90</span> * @final
|
98
|
+
<span class='line'> 91</span> */</span><span class="WHIT">
|
99
|
+
<span class='line'> 92</span> </span><span class="WHIT"> </span><span class="NAME">$Cr</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">Components.results</span><span class="PUNC">,</span><span class="WHIT">
|
100
|
+
<span class='line'> 93</span>
|
101
|
+
<span class='line'> 94</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
102
|
+
<span class='line'> 95</span> * A shortcut constant to Components.utils.
|
103
|
+
<span class='line'> 96</span> * @final
|
104
|
+
<span class='line'> 97</span> */</span><span class="WHIT">
|
105
|
+
<span class='line'> 98</span> </span><span class="WHIT"> </span><span class="NAME">$Cu</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">Components.utils</span><span class="PUNC">,</span><span class="WHIT">
|
106
|
+
<span class='line'> 99</span>
|
107
|
+
<span class='line'>100</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
108
|
+
<span class='line'>101</span> * Taking inspiration from Ruby, this defines the set of paths to check when
|
109
|
+
<span class='line'>102</span> * trying to load a file via either {@link Kernel#load} or {@link Kernel#require}.
|
110
|
+
<span class='line'>103</span> * @final
|
111
|
+
<span class='line'>104</span> * @type Array
|
112
|
+
<span class='line'>105</span> */</span><span class="WHIT">
|
113
|
+
<span class='line'>106</span> </span><span class="WHIT"> </span><span class="NAME">$LOAD_PATH</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">XPCOMCoreConfig.getProperty</span><span class="PUNC">(</span><span class="STRN">'libRoot'</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
|
114
|
+
<span class='line'>107</span>
|
115
|
+
<span class='line'>108</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
116
|
+
<span class='line'>109</span> * Taking inspiration from Ruby, this defines the currently loaded files that
|
117
|
+
<span class='line'>110</span> * have been loaded through {@link Kernel#require}.
|
118
|
+
<span class='line'>111</span> * @final
|
119
|
+
<span class='line'>112</span> * @type Array
|
120
|
+
<span class='line'>113</span> */</span><span class="WHIT">
|
121
|
+
<span class='line'>114</span> </span><span class="WHIT"> </span><span class="NAME">$LOADED_FEATURES</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="STRN">"kernel.js"</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
|
122
|
+
<span class='line'>115</span> </span><span class="WHIT">
|
123
|
+
<span class='line'>116</span> </span><span class="COMM">/**
|
124
|
+
<span class='line'>117</span> * Taking inspiration from Ruby, this method tries to determine the filesystem path to
|
125
|
+
<span class='line'>118</span> * the caller code of this method.
|
126
|
+
<span class='line'>119</span> * NOTE - when {@link Kernel} is mixed into an object, this function gets mixed in via
|
127
|
+
<span class='line'>120</span> * a special case behaviour that makes it a getter that actually calls the function
|
128
|
+
<span class='line'>121</span> * rather than returning the function object itself. This is to facilitate being able
|
129
|
+
<span class='line'>122</span> * to call '$CURRENT_FILE' in your code rather than '$CURRENT_FILE()'. The stackTraversalDepth
|
130
|
+
<span class='line'>123</span> * parameter is there for this reason, since we need to traverse the stack further than
|
131
|
+
<span class='line'>124</span> * normal to find the calling scope than we normally would.
|
132
|
+
<span class='line'>125</span> * @type String
|
133
|
+
<span class='line'>126</span> * @param {int} stackTraversalDepth Optional argument, how far to look up the stack to
|
134
|
+
<span class='line'>127</span> * figure out who called us. The default is usually safe.
|
135
|
+
<span class='line'>128</span> * @throws {@link SelfConceptError} Thrown when we can't figure out what the filesystem
|
136
|
+
<span class='line'>129</span> * path to the current file is.
|
137
|
+
<span class='line'>130</span> */</span><span class="WHIT">
|
138
|
+
<span class='line'>131</span> </span><span class="WHIT"> </span><span class="NAME">$CURRENT_FILE</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">stackTraversalDepth</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
139
|
+
<span class='line'>132</span> </span><span class="WHIT"> </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
140
|
+
<span class='line'>133</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">stackTraversalDepth</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">stackTraversalDepth</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
|
141
|
+
<span class='line'>134</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ioService</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$Cc</span><span class="PUNC">[</span><span class="STRN">"@mozilla.org/network/io-service;1"</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">getService</span><span class="PUNC">(</span><span class="NAME">$Ci.nsIIOService</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
142
|
+
<span class='line'>135</span> </span><span class="WHIT"> </span><span class="COMM">// FIXME - UGH. This is so seedy.</span><span class="WHIT">
|
143
|
+
<span class='line'>136</span> </span><span class="WHIT"> </span><span class="COMM">// Traverse up the stack as far as needed to get our caller's stack frame. Sometimes we need to</span><span class="WHIT">
|
144
|
+
<span class='line'>137</span> </span><span class="WHIT"> </span><span class="COMM">// traverse more than one level up, like when this function is actually called from a getter</span><span class="WHIT">
|
145
|
+
<span class='line'>138</span> </span><span class="WHIT"> </span><span class="COMM">// property that references it.</span><span class="WHIT">
|
146
|
+
<span class='line'>139</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">callerStack</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Components.stack</span><span class="PUNC">;</span><span class="WHIT">
|
147
|
+
<span class='line'>140</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">stackTraversalDepth</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
148
|
+
<span class='line'>141</span> </span><span class="WHIT"> </span><span class="NAME">callerStack</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callerStack.caller</span><span class="PUNC">;</span><span class="WHIT">
|
149
|
+
<span class='line'>142</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
150
|
+
<span class='line'>143</span> </span><span class="WHIT"> </span><span class="COMM">// Split based on the stupid fucking " -> " Gecko puts in the filename and get the last entry</span><span class="WHIT">
|
151
|
+
<span class='line'>144</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ostensiblyUs</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callerStack.filename.split</span><span class="PUNC">(</span><span class="STRN">" -> "</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">slice</span><span class="PUNC">(</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
152
|
+
<span class='line'>145</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">callerFileURI</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ioService.newURI</span><span class="PUNC">(</span><span class="NAME">ostensiblyUs</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
153
|
+
<span class='line'>146</span> </span><span class="WHIT"> </span><span class="COMM">// QI for an nsIFileURL which lets us get a handle on an actual file attribute and automagically does</span><span class="WHIT">
|
154
|
+
<span class='line'>147</span> </span><span class="WHIT"> </span><span class="COMM">// resource: URL resolution for us</span><span class="WHIT">
|
155
|
+
<span class='line'>148</span> </span><span class="WHIT"> </span><span class="NAME">callerFileURI.QueryInterface</span><span class="PUNC">(</span><span class="NAME">$Ci.nsIFileURL</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
156
|
+
<span class='line'>149</span> </span><span class="WHIT"> </span><span class="COMM">// And theoretically, we can now get a handle on an nsIFile and return the path of that.</span><span class="WHIT">
|
157
|
+
<span class='line'>150</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">callerFileURI.file.path</span><span class="PUNC">;</span><span class="WHIT">
|
158
|
+
<span class='line'>151</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
159
|
+
<span class='line'>152</span> </span><span class="WHIT"> </span><span class="KEYW">throw</span><span class="PUNC">(</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">SelfConceptError</span><span class="PUNC">(</span><span class="STRN">"The filesystem location of the current file could not be determined. -- "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
160
|
+
<span class='line'>153</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
161
|
+
<span class='line'>154</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
162
|
+
<span class='line'>155</span> </span><span class="WHIT">
|
163
|
+
<span class='line'>156</span> </span><span class="COMM">/**
|
164
|
+
<span class='line'>157</span> * This method tries to determine the filesystem path to parent directory of the caller
|
165
|
+
<span class='line'>158</span> * code of this method NOTE - see the note on $CURRENT_FILE, as the same applies here.
|
166
|
+
<span class='line'>159</span> * @type String
|
167
|
+
<span class='line'>160</span> * @param {int} stackTraversalDepth Optional argument, how far to look up the stack to
|
168
|
+
<span class='line'>161</span> * figure out who called us. The default is usually safe.
|
169
|
+
<span class='line'>162</span> * @throws {@link SelfConceptError} Thrown when we can't figure out what the filesystem
|
170
|
+
<span class='line'>163</span> * path to the parent directory of the current file is.
|
171
|
+
<span class='line'>164</span> */</span><span class="WHIT">
|
172
|
+
<span class='line'>165</span> </span><span class="WHIT"> </span><span class="NAME">$CURRENT_DIRECTORY</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">stackTraversalDepth</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
173
|
+
<span class='line'>166</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">stackTraversalDepth</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">stackTraversalDepth</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="PUNC">;</span><span class="WHIT">
|
174
|
+
<span class='line'>167</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">currentFilePath</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Kernel.prototype.$CURRENT_FILE</span><span class="PUNC">(</span><span class="NAME">stackTraversalDepth</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
175
|
+
<span class='line'>168</span> </span><span class="WHIT">
|
176
|
+
<span class='line'>169</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">fileObject</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$Cc</span><span class="PUNC">[</span><span class="STRN">"@mozilla.org/file/local;1"</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">createInstance</span><span class="PUNC">(</span><span class="NAME">$Ci.nsILocalFile</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
177
|
+
<span class='line'>170</span> </span><span class="WHIT"> </span><span class="NAME">fileObject.initWithPath</span><span class="PUNC">(</span><span class="NAME">currentFilePath</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
178
|
+
<span class='line'>171</span>
|
179
|
+
<span class='line'>172</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">fileObject.parent.path</span><span class="PUNC">;</span><span class="WHIT">
|
180
|
+
<span class='line'>173</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
181
|
+
<span class='line'>174</span> </span><span class="WHIT">
|
182
|
+
<span class='line'>175</span> </span><span class="COMM">/**
|
183
|
+
<span class='line'>176</span> * Prints a string to standard out, without a trailing newline.
|
184
|
+
<span class='line'>177</span> * @param {String} str String to print to standard out.
|
185
|
+
<span class='line'>178</span> */</span><span class="WHIT">
|
186
|
+
<span class='line'>179</span> </span><span class="WHIT"> </span><span class="NAME">print</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
187
|
+
<span class='line'>180</span> </span><span class="WHIT"> </span><span class="NAME">dump</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
188
|
+
<span class='line'>181</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
189
|
+
<span class='line'>182</span> </span><span class="WHIT">
|
190
|
+
<span class='line'>183</span> </span><span class="COMM">/**
|
191
|
+
<span class='line'>184</span> * Prints a string to standard out, with a trailing newline.
|
192
|
+
<span class='line'>185</span> * @param {String} str String to print to standard out.
|
193
|
+
<span class='line'>186</span> */</span><span class="WHIT">
|
194
|
+
<span class='line'>187</span> </span><span class="WHIT"> </span><span class="NAME">puts</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">str</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
195
|
+
<span class='line'>188</span> </span><span class="WHIT"> </span><span class="NAME">print</span><span class="PUNC">(</span><span class="NAME">str</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"\n"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
196
|
+
<span class='line'>189</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
197
|
+
<span class='line'>190</span> </span><span class="WHIT">
|
198
|
+
<span class='line'>191</span> </span><span class="COMM">/**
|
199
|
+
<span class='line'>192</span> * Searches {@link Kernel#$LOAD_PATH $LOAD_PATH} for files to load into the current global scope.
|
200
|
+
<span class='line'>193</span> * Files loaded via this method will not be added to {@link Kernel#$LOADED_FEATURES} and hence
|
201
|
+
<span class='line'>194</span> * can be repeatedly loaded and executed.
|
202
|
+
<span class='line'>195</span> * @param {String} featurePath Full or relative path including file extension to try and load.
|
203
|
+
<span class='line'>196</span> * @type Boolean
|
204
|
+
<span class='line'>197</span> * @throws {@link LoadError} Thrown when we can't find the specified file in any directories specified
|
205
|
+
<span class='line'>198</span> * in {@link Kernel#$LOAD_PATH $LOAD_PATH}.
|
206
|
+
<span class='line'>199</span> */</span><span class="WHIT">
|
207
|
+
<span class='line'>200</span> </span><span class="WHIT"> </span><span class="NAME">load</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">featurePath</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
208
|
+
<span class='line'>201</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">loader</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$Cc</span><span class="PUNC">[</span><span class="STRN">"@mozilla.org/moz/jssubscript-loader;1"</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">getService</span><span class="PUNC">(</span><span class="NAME">$Ci.mozIJSSubScriptLoader</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
209
|
+
<span class='line'>202</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">foundFile</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
|
210
|
+
<span class='line'>203</span> </span><span class="WHIT"> </span><span class="COMM">// FIXME - so this is kinda shitty. We have an empty entry here so we default to just trying to load </span><span class="WHIT">
|
211
|
+
<span class='line'>204</span> </span><span class="WHIT"> </span><span class="COMM">// from an absolute path</span><span class="WHIT">
|
212
|
+
<span class='line'>205</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">loadPath</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$LOAD_PATH.concat</span><span class="PUNC">(</span><span class="PUNC">[</span><span class="STRN">""</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
213
|
+
<span class='line'>206</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">loadPathLength</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">loadPath.length</span><span class="PUNC">;</span><span class="WHIT">
|
214
|
+
<span class='line'>207</span> </span><span class="WHIT"> </span><span class="COMM">// FIXME - mozilla bug here. if i use foreach on array it ignores the granted security privileges</span><span class="WHIT">
|
215
|
+
<span class='line'>208</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">loadPathLength</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
216
|
+
<span class='line'>209</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">potentialFile</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$Cc</span><span class="PUNC">[</span><span class="STRN">"@mozilla.org/file/local;1"</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">createInstance</span><span class="PUNC">(</span><span class="NAME">$Ci.nsILocalFile</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
217
|
+
<span class='line'>210</span> </span><span class="WHIT"> </span><span class="NAME">potentialFile.initWithPath</span><span class="PUNC">(</span><span class="NAME">loadPath</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"/"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">featurePath</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
218
|
+
<span class='line'>211</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">potentialFile.exists</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
219
|
+
<span class='line'>212</span> </span><span class="NAME">foundFile</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">potentialFile</span><span class="PUNC">;</span><span class="WHIT">
|
220
|
+
<span class='line'>213</span> </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
|
221
|
+
<span class='line'>214</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
222
|
+
<span class='line'>215</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
223
|
+
<span class='line'>216</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">foundFile</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
224
|
+
<span class='line'>217</span> </span><span class="WHIT"> </span><span class="NAME">foundFile.normalize</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
225
|
+
<span class='line'>218</span> </span><span class="WHIT"> </span><span class="NAME">loader.loadSubScript</span><span class="PUNC">(</span><span class="STRN">"file://"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">encodeURI</span><span class="PUNC">(</span><span class="NAME">foundFile.path</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
226
|
+
<span class='line'>219</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
|
227
|
+
<span class='line'>220</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
228
|
+
<span class='line'>221</span> </span><span class="WHIT"> </span><span class="KEYW">throw</span><span class="PUNC">(</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">LoadError</span><span class="PUNC">(</span><span class="STRN">"no such file to load -- "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">featurePath</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
229
|
+
<span class='line'>222</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
230
|
+
<span class='line'>223</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
231
|
+
<span class='line'>224</span>
|
232
|
+
<span class='line'>225</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
233
|
+
<span class='line'>226</span> * Searches {@link Kernel#$LOAD_PATH $LOAD_PATH} for features to load into the current global scope.
|
234
|
+
<span class='line'>227</span> * Files loaded via this method will be added to {@link Kernel#$LOADED_FEATURES} and hence two
|
235
|
+
<span class='line'>228</span> * consecutive calls to this method will not load and execute the code twice.
|
236
|
+
<span class='line'>229</span> * @type Boolean True if successful, false if the specified feature has already been required.
|
237
|
+
<span class='line'>230</span> * @param {String} featurePath Full or relative path without the file extension to try and require.
|
238
|
+
<span class='line'>231</span> * @throws {@link LoadError} Thrown when we can't find the specified feature in any directories specified
|
239
|
+
<span class='line'>232</span> * in {@link Kernel#$LOAD_PATH $LOAD_PATH}.
|
240
|
+
<span class='line'>233</span> */</span><span class="WHIT">
|
241
|
+
<span class='line'>234</span> </span><span class="NAME">require</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">feature</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
242
|
+
<span class='line'>235</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">jsFeature</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">feature</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">".js"</span><span class="PUNC">;</span><span class="WHIT">
|
243
|
+
<span class='line'>236</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">$LOADED_FEATURES.indexOf</span><span class="PUNC">(</span><span class="NAME">jsFeature</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
244
|
+
<span class='line'>237</span> </span><span class="WHIT"> </span><span class="NAME">load</span><span class="PUNC">(</span><span class="NAME">jsFeature</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
245
|
+
<span class='line'>238</span> </span><span class="WHIT"> </span><span class="NAME">$LOADED_FEATURES.push</span><span class="PUNC">(</span><span class="NAME">jsFeature</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
246
|
+
<span class='line'>239</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
|
247
|
+
<span class='line'>240</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
248
|
+
<span class='line'>241</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
|
249
|
+
<span class='line'>242</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
250
|
+
<span class='line'>243</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
251
|
+
<span class='line'>244</span> </span><span class="PUNC">}</span><span class="PUNC">;</span></pre></body></html>
|