Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit, MVP

  • Loading branch information...
commit b354d4afa4fccd9e9ac9abf5b8bf25cec3ff7dd3 0 parents
@bryanwoods authored
Showing with 52,876 additions and 0 deletions.
  1. +13 −0 bin/degrees
  2. +14 −0 lib/degrees.coffee
  3. +4 −0 node_modules/contextify/.gitignore
  4. +22 −0 node_modules/contextify/LICENSE.txt
  5. +102 −0 node_modules/contextify/README.md
  6. +9 −0 node_modules/contextify/lib/contextify.js
  7. +31 −0 node_modules/contextify/package.json
  8. +275 −0 node_modules/contextify/src/contextify.cc
  9. +432 −0 node_modules/contextify/test/contextify.js
  10. +18 −0 node_modules/contextify/wscript
  11. +9 −0 node_modules/cssom/.idea/CSSOM.iml
  12. +3 −0  node_modules/cssom/.idea/dictionaries/nv.xml
  13. +5 −0 node_modules/cssom/.idea/encodings.xml
  14. +17 −0 node_modules/cssom/.idea/misc.xml
  15. +9 −0 node_modules/cssom/.idea/modules.xml
  16. +82 −0 node_modules/cssom/.idea/projectCodeStyle.xml
  17. +8 −0 node_modules/cssom/.idea/vcs.xml
  18. +467 −0 node_modules/cssom/.idea/workspace.xml
  19. +19 −0 node_modules/cssom/.livereload
  20. +37 −0 node_modules/cssom/Jakefile
  21. +33 −0 node_modules/cssom/README.mdown
  22. +23 −0 node_modules/cssom/Rakefile
  23. +19 −0 node_modules/cssom/docs/.livereload
  24. +3 −0  node_modules/cssom/docs/bar.css
  25. 0  node_modules/cssom/docs/demo.css
  26. +4 −0 node_modules/cssom/docs/foo.css
  27. +170 −0 node_modules/cssom/docs/parse.html
  28. +431 −0 node_modules/cssom/docs/parse2.html
  29. +100 −0 node_modules/cssom/index.html
  30. +34 −0 node_modules/cssom/lib/CSSImportRule.js
  31. +38 −0 node_modules/cssom/lib/CSSMediaRule.js
  32. +3 −0  node_modules/cssom/lib/CSSOM.js
  33. +38 −0 node_modules/cssom/lib/CSSRule.js
  34. +130 −0 node_modules/cssom/lib/CSSStyleDeclaration.js
  35. +187 −0 node_modules/cssom/lib/CSSStyleRule.js
  36. +85 −0 node_modules/cssom/lib/CSSStyleSheet.js
  37. +61 −0 node_modules/cssom/lib/MediaList.js
  38. +15 −0 node_modules/cssom/lib/StyleSheet.js
  39. +69 −0 node_modules/cssom/lib/clone.js
  40. +10 −0 node_modules/cssom/lib/index.js
  41. +195 −0 node_modules/cssom/lib/parse.js
  42. +17 −0 node_modules/cssom/media.html
  43. +30 −0 node_modules/cssom/package.json
  44. +32 −0 node_modules/cssom/plugins/toHTML.js
  45. +22 −0 node_modules/cssom/server/index.html
  46. +21 −0 node_modules/cssom/server/index.js
  47. +21 −0 node_modules/cssom/shorthands.html
  48. +35 −0 node_modules/cssom/test/CSSStyleDeclaration.test.js
  49. +12 −0 node_modules/cssom/test/CSSStyleRule.test.js
  50. +16 −0 node_modules/cssom/test/CSSStyleSheet.test.js
  51. +21 −0 node_modules/cssom/test/MediaList.test.js
  52. +38 −0 node_modules/cssom/test/clone.test.js
  53. +3 −0  node_modules/cssom/test/fixtures/dummy.css
  54. +97 −0 node_modules/cssom/test/helper.js
  55. +42 −0 node_modules/cssom/test/index.html
  56. +346 −0 node_modules/cssom/test/parse.test.js
  57. +189 −0 node_modules/cssom/test/vendor/qunit.css
  58. +1,341 −0 node_modules/cssom/test/vendor/qunit.js
  59. +17 −0 node_modules/htmlparser/.project
  60. +17 −0 node_modules/htmlparser/.project.bak
  61. +6 −0 node_modules/htmlparser/.settings/.jsdtscope
  62. +1 −0  node_modules/htmlparser/.settings/org.eclipse.wst.jsdt.ui.superType.container
  63. +1 −0  node_modules/htmlparser/.settings/org.eclipse.wst.jsdt.ui.superType.name
  64. +108 −0 node_modules/htmlparser/.tmp_runtests.html.51164~
  65. +108 −0 node_modules/htmlparser/.tmp_runtests.min.html.92328~
  66. +33 −0 node_modules/htmlparser/CHANGELOG
  67. +18 −0 node_modules/htmlparser/LICENSE
  68. +186 −0 node_modules/htmlparser/README.md
  69. +35 −0 node_modules/htmlparser/a
  70. +35 −0 node_modules/htmlparser/b
  71. +35 −0 node_modules/htmlparser/c
  72. +482 −0 node_modules/htmlparser/json2.js
  73. +822 −0 node_modules/htmlparser/lib/htmlparser.js
  74. +22 −0 node_modules/htmlparser/lib/htmlparser.min.js
  75. +6 −0 node_modules/htmlparser/lib/node-htmlparser.js
  76. +6 −0 node_modules/htmlparser/lib/node-htmlparser.min.js
  77. BIN  node_modules/htmlparser/libxmljs.node
  78. +54 −0 node_modules/htmlparser/newparser.js
  79. +754 −0 node_modules/htmlparser/node-htmlparser.old.js
  80. +23 −0 node_modules/htmlparser/package.json
  81. +4 −0 node_modules/htmlparser/profile
  82. +53 −0 node_modules/htmlparser/profile.getelement.js
  83. +199 −0 node_modules/htmlparser/profile.getelement.txt
  84. +63 −0 node_modules/htmlparser/profile.js
  85. +301 −0 node_modules/htmlparser/profileresults.txt
  86. +9 −0 node_modules/htmlparser/pulls/node-htmlparser/CHANGELOG
  87. +18 −0 node_modules/htmlparser/pulls/node-htmlparser/LICENSE
  88. +186 −0 node_modules/htmlparser/pulls/node-htmlparser/README.md
  89. +482 −0 node_modules/htmlparser/pulls/node-htmlparser/json2.js
  90. +772 −0 node_modules/htmlparser/pulls/node-htmlparser/lib/node-htmlparser.js
  91. +22 −0 node_modules/htmlparser/pulls/node-htmlparser/lib/node-htmlparser.min.js
  92. +23 −0 node_modules/htmlparser/pulls/node-htmlparser/package.json
  93. +63 −0 node_modules/htmlparser/pulls/node-htmlparser/profile.js
  94. +107 −0 node_modules/htmlparser/pulls/node-htmlparser/runtests.html
  95. +75 −0 node_modules/htmlparser/pulls/node-htmlparser/runtests.js
  96. +107 −0 node_modules/htmlparser/pulls/node-htmlparser/runtests.min.html
  97. +75 −0 node_modules/htmlparser/pulls/node-htmlparser/runtests.min.js
  98. +15 −0 node_modules/htmlparser/pulls/node-htmlparser/snippet.js
  99. +57 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/01-basic.js
  100. +35 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/02-single_tag_1.js
  101. +36 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/03-single_tag_2.js
  102. +52 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/04-unescaped_in_script.js
  103. +44 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/05-tags_in_comment.js
  104. +44 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/06-comment_in_script.js
  105. +45 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/07-unescaped_in_style.js
  106. +45 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/08-extra_spaces_in_tag.js
  107. +45 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/09-unquoted_attrib.js
  108. +39 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/10-singular_attribute.js
  109. +46 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/11-text_outside_tags.js
  110. +37 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/12-text_only.js
  111. +45 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/13-comment_in_text.js
  112. +53 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/14-comment_in_text_in_script.js
  113. +43 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/15-non-verbose.js
  114. +68 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/16-ignore_whitespace.js
  115. +34 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/17-xml_namespace.js
  116. +36 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/18-enforce_empty_tags.js
  117. +38 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/19-ignore_empty_tags.js
  118. +117 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/20-rss.js
  119. +77 −0 node_modules/htmlparser/pulls/node-htmlparser/tests/21-atom.js
  120. +35 −0 node_modules/htmlparser/pulls/node-htmlparser/utils_example.js
  121. +16 −0 node_modules/htmlparser/rssbug.js
  122. +1 −0  node_modules/htmlparser/rssbug.rss
  123. +108 −0 node_modules/htmlparser/runtests.html
  124. +75 −0 node_modules/htmlparser/runtests.js
  125. +108 −0 node_modules/htmlparser/runtests.min.html
  126. +75 −0 node_modules/htmlparser/runtests.min.js
  127. +15 −0 node_modules/htmlparser/snippet.js
  128. +11 −0 node_modules/htmlparser/testdata/.tmp_test.html.2854~
  129. +2,948 −0 node_modules/htmlparser/testdata/.tmp_trackerchecker.html.65425~
  130. +10 −0 node_modules/htmlparser/testdata/.tmp_trackerchecker.html.76922~
  131. +2,948 −0 node_modules/htmlparser/testdata/.tmp_trackerchecker.html.80022~
  132. +2,948 −0 node_modules/htmlparser/testdata/.tmp_trackerchecker2.html.51378~
  133. +2,947 −0 node_modules/htmlparser/testdata/.tmp_trackerchecker2.html.75287~
  134. +3,311 −0 node_modules/htmlparser/testdata/api.html
  135. +3,460 −0 node_modules/htmlparser/testdata/getelement.html
  136. +2,733 −0 node_modules/htmlparser/testdata/trackerchecker.html
  137. +61 −0 node_modules/htmlparser/tests/01-basic.js
  138. +39 −0 node_modules/htmlparser/tests/02-single_tag_1.js
  139. +40 −0 node_modules/htmlparser/tests/03-single_tag_2.js
  140. +56 −0 node_modules/htmlparser/tests/04-unescaped_in_script.js
  141. +48 −0 node_modules/htmlparser/tests/05-tags_in_comment.js
  142. +48 −0 node_modules/htmlparser/tests/06-comment_in_script.js
  143. +49 −0 node_modules/htmlparser/tests/07-unescaped_in_style.js
  144. +49 −0 node_modules/htmlparser/tests/08-extra_spaces_in_tag.js
  145. +49 −0 node_modules/htmlparser/tests/09-unquoted_attrib.js
  146. +43 −0 node_modules/htmlparser/tests/10-singular_attribute.js
  147. +50 −0 node_modules/htmlparser/tests/11-text_outside_tags.js
  148. +41 −0 node_modules/htmlparser/tests/12-text_only.js
  149. +49 −0 node_modules/htmlparser/tests/13-comment_in_text.js
  150. +57 −0 node_modules/htmlparser/tests/14-comment_in_text_in_script.js
  151. +46 −0 node_modules/htmlparser/tests/15-non-verbose.js
  152. +71 −0 node_modules/htmlparser/tests/16-ignore_whitespace.js
  153. +38 −0 node_modules/htmlparser/tests/17-xml_namespace.js
  154. +40 −0 node_modules/htmlparser/tests/18-enforce_empty_tags.js
  155. +41 −0 node_modules/htmlparser/tests/19-ignore_empty_tags.js
  156. +120 −0 node_modules/htmlparser/tests/20-rss.js
  157. +80 −0 node_modules/htmlparser/tests/21-atom.js
  158. +100 −0 node_modules/htmlparser/tests/22-position_data.js
  159. +35 −0 node_modules/htmlparser/utils_example.js
  160. +1,956 −0 node_modules/htmlparser/v8.log
  161. +6 −0 node_modules/jsdom/.gitignore
  162. +22 −0 node_modules/jsdom/LICENSE.txt
  163. +273 −0 node_modules/jsdom/README.md
  164. +23 −0 node_modules/jsdom/benchmark/mark.js
  165. 0  node_modules/jsdom/benchmark/stats.json
  166. +85 −0 node_modules/jsdom/changelog
  167. +37 −0 node_modules/jsdom/example/browser/browser.js
  168. +1,170 −0 node_modules/jsdom/example/ender/ender.js
  169. +10 −0 node_modules/jsdom/example/ender/run.js
  170. +167 −0 node_modules/jsdom/example/jquery/jquery.js
  171. +9 −0 node_modules/jsdom/example/jquery/run.js
  172. +243 −0 node_modules/jsdom/example/node-xml/example.xml
  173. +46 −0 node_modules/jsdom/example/node-xml/run.js
  174. +743 −0 node_modules/jsdom/example/pure/pure.js
  175. +96 −0 node_modules/jsdom/example/pure/run.js
  176. +10 −0 node_modules/jsdom/example/pure/sax-test.js
  177. +535 −0 node_modules/jsdom/example/pure/sax.js
  178. +166 −0 node_modules/jsdom/example/sizzle/run.js
  179. +534 −0 node_modules/jsdom/example/sizzle/sax.js
  180. +1,066 −0 node_modules/jsdom/example/sizzle/sizzle.js
  181. +402 −0 node_modules/jsdom/lib/jsdom.js
  182. +213 −0 node_modules/jsdom/lib/jsdom/browser/domtohtml.js
  183. +145 −0 node_modules/jsdom/lib/jsdom/browser/htmlencoding.js
  184. +178 −0 node_modules/jsdom/lib/jsdom/browser/htmltodom.js
  185. +515 −0 node_modules/jsdom/lib/jsdom/browser/index.js
  186. +1,723 −0 node_modules/jsdom/lib/jsdom/level1/core.js
  187. +650 −0 node_modules/jsdom/lib/jsdom/level2/core.js
  188. +431 −0 node_modules/jsdom/lib/jsdom/level2/events.js
  189. +1,696 −0 node_modules/jsdom/lib/jsdom/level2/html.js
  190. +7 −0 node_modules/jsdom/lib/jsdom/level2/index.js
  191. +13 −0 node_modules/jsdom/lib/jsdom/level2/languages/javascript.js
  192. +262 −0 node_modules/jsdom/lib/jsdom/level2/style.js
  193. +646 −0 node_modules/jsdom/lib/jsdom/level3/core.js
  194. +296 −0 node_modules/jsdom/lib/jsdom/level3/events.js
  195. +9 −0 node_modules/jsdom/lib/jsdom/level3/html.js
  196. +10 −0 node_modules/jsdom/lib/jsdom/level3/index.js
  197. +221 −0 node_modules/jsdom/lib/jsdom/level3/ls.js
  198. +1,859 −0 node_modules/jsdom/lib/jsdom/level3/xpath.js
  199. +28 −0 node_modules/jsdom/lib/jsdom/selectors/index.js
  200. +1,016 −0 node_modules/jsdom/lib/jsdom/selectors/sizzle.js
  201. +138 −0 node_modules/jsdom/package.json
  202. +22 −0 node_modules/jsdom/status.json
  203. +279 −0 node_modules/jsdom/test/DOMTestCase.js
  204. +4 −0 node_modules/jsdom/test/LICENSE.txt
  205. +31 −0 node_modules/jsdom/test/all.js
Sorry, we could not display the entire diff because too many files (460) changed.
13 bin/degrees
@@ -0,0 +1,13 @@
+#!/usr/local/bin/node
+(function() {
+ var WUNDERGROUND_URL, jsdom;
+ jsdom = require('jsdom');
+ WUNDERGROUND_URL = 'http://www.wunderground.com/cgi-bin/findweather/hdfForecast?query=11231';
+ jsdom.env(WUNDERGROUND_URL, ['http://code.jquery.com/jquery-1.5.min.js'], function(errors, window) {
+ var $, high, low;
+ $ = window.jQuery;
+ high = $('.fctHiLow .b').html();
+ low = $('.fctHiLow').first().html().split('|')[1].split('°')[0].trim();
+ return console.log("Today's high: " + high + "\nToday's low: " + low);
+ });
+}).call(this);
14 lib/degrees.coffee
@@ -0,0 +1,14 @@
+jsdom = require 'jsdom'
+
+BASE_URL = "http://www.wunderground.com/cgi-bin/findweather/hdfForecast?query="
+args = process.argv
+zip = if args[2] then args[2] else "11231"
+
+jsdom.env BASE_URL + zip,
+ ['http://code.jquery.com/jquery-1.5.min.js'],
+ (errors, window) ->
+ $ = window.jQuery
+ high = $('.fctHiLow .b').html()
+ low = $('.fctHiLow').first().html().split('|')[1].split('°')[0].trim()
+
+ console.log "Today's high: #{high}\nToday's low: #{low}"
4 node_modules/contextify/.gitignore
@@ -0,0 +1,4 @@
+.lock-wscript
+build/
+*.swp
+*.swo
22 node_modules/contextify/LICENSE.txt
@@ -0,0 +1,22 @@
+Copyright (c) 2011 Brian McDaniel
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
102 node_modules/contextify/README.md
@@ -0,0 +1,102 @@
+# Contextify
+
+Turn an object into a V8 execution context. A contextified object acts as the global 'this' when executing scripts in its context. Contextify adds 3 methods to the contextified object: run(code, filename), getGlobal(), and dispose(). The main difference between Contextify and Node's vm methods is that Contextify allows asynchronous functions to continue executing in the Contextified object's context. See vm vs. Contextify below for more discussion.
+
+## Examples
+```javascript
+var Contextify = require('contextify');
+var sandbox = { console : console, prop1 : 'prop1'};
+Contextify(sandbox);
+sandbox.run('console.log(prop1);');
+sandbox.dispose(); // free the resources allocated for the context.
+```
+
+```javascript
+var sandbox = Contextify(); // returns an empty contextified object.
+sandbox.run('var x = 3;');
+console.log(sandbox.x); // prints 3
+sandbox.dispose();
+```
+
+```javascript
+var sandbox = Contextify({setTimeout : setTimeout});
+sandbox.run("setTimeout(function () { x = 3; }, 5);");
+console.log(sandbox.x); // prints undefined
+setTimeout(function () {
+ console.log(sandbox.x); // prints 3
+ sandbox.dispose();
+}, 10);
+```
+## Details
+
+**Contextify([sandbox])**
+
+ sandbox - The object to contextify, which will be modified as described below
+ If no sandbox is specified, an empty object will be allocated and used instead.
+
+ Returns the contextified object. It doesn't make a copy, so if you already have a reference
+ to the sandbox, you don't need to catch the return value.
+
+A Contextified object has 2 methods added to it:
+
+**run(code, [filename])**
+
+ code - string containing JavaScript to execute
+ filename - an optional filename for debugging.
+
+ Runs the code in the Contextified object's context.
+
+**getGlobal()**
+
+Returns the actual global object for the V8 context. The global object is initialized with interceptors (discussed below) which forward accesses on it to the contextified object. This means the contextified object acts like the global object in most cases. Sometimes, though, you need to make a reference to the actual global object.
+
+For example:
+
+```javascript
+var window = Contextify({console : console});
+window.window = window;
+window.run("console.log(window === this);");
+// prints false.
+```
+
+```javascript
+var window = Contextify({console : console});
+window.window = window.getGlobal();
+window.run("console.log(window === this);");
+// prints true
+```
+
+The global object returned by getGlobal() can be treated like the contextified sandbox object, except that defining getters/setters will not work on it. Define getters and setters on the actual sandbox object instead.
+
+**dispose()**
+
+Frees the memory allocated for the underlying V8 context. If you don't call this when you're done, the V8 context memory will leak, as will the sandbox memory, since the context's global stores a strong reference to the sandbox object. You can still use your sandbox object after calling dispose(), but it's unsafe to use a global previously returned from getGlobal(). run, getGlobal, and dispose will be removed from the sandbox object.
+
+## Install
+
+ npm install contextify
+
+## require('vm') vs. Contextify
+
+Node's vm functions (runInContext etc) work by copying the values from the sandbox object onto a context's global object, executing the passed in script, then copying the results back. This means that scripts that create asynchronous functions (using mechanisms like setTimeout) won't have see the results of executing those functions, since the copying in/out only occurs during an explicit call to runInContext and friends.
+
+Contextify creates a V8 context, and uses interceptors (see: http://code.google.com/apis/v8/embed.html#interceptors) to forward global object accesses to the sandbox object. This means there is no copying in or out, so asynchronous functions have the expected effect on the sandbox object.
+
+## Tests
+
+Testing is done with nodeunit. Run the tests with
+
+ nodeunit test/
+
+Output:
+
+ OK: 92 assertions (27ms)
+
+
+## Building
+
+ node-waf configure build
+
+## Acknowledgments
+
+Inspiration taken from Assaf's Zombie.js context solution: https://github.com/assaf/zombie
9 node_modules/contextify/lib/contextify.js
@@ -0,0 +1,9 @@
+try {
+ module.exports = require('../build/Release/contextify').wrap;
+} catch (e) {
+ console.log("Internal Contextify ERROR: Make sure Contextify is built " +
+ "with your current Node version.\nTo rebuild, go to the " +
+ "Contextify root folder and run 'node-waf distclean && " +
+ "node-waf configure build'.");
+ throw e;
+}
31 node_modules/contextify/package.json
@@ -0,0 +1,31 @@
+{
+ "author": "Brian McDaniel <brianmcd05@gmail.com>",
+ "name": "contextify",
+ "description": "Turn an object into a persistent execution context.",
+ "keywords": [
+ "context",
+ "vm"
+ ],
+ "version": "0.0.5",
+ "repository": {
+ "type" : "git",
+ "url": "https://github.com/brianmcd/contextify.git"
+ },
+ "main": "./lib/contextify.js",
+ "directories": {
+ "lib": "./lib"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ },
+ "licenses": [
+ {
+ "type" : "MIT",
+ "url" : "http://github.com/brianmcd/contextify/blob/master/LICENSE.txt"
+ }
+ ],
+ "dependencies": {},
+ "devDependencies": {
+ "nodeunit" : ">=0.5.x"
+ }
+}
275 node_modules/contextify/src/contextify.cc
@@ -0,0 +1,275 @@
+#include "node.h"
+#include <string>
+using namespace v8;
+using namespace node;
+
+struct ContextifyInfo;
+
+static Handle<Value> Wrap(const Arguments& args);
+static Handle<Value> Run(const Arguments& args);
+static Handle<Value> GetGlobal(const Arguments& args);
+static Persistent<Context> CreateContext(ContextifyInfo* info);
+
+// Interceptor functions for global object template.
+static Handle<Value> GlobalPropertyGetter(Local<String> property,
+ const AccessorInfo &accessInfo);
+static Handle<Value> GlobalPropertySetter(Local<String> property,
+ Local<Value> value,
+ const AccessorInfo &accessInfo);
+static Handle<Integer> GlobalPropertyQuery(Local<String> property,
+ const AccessorInfo &accessInfo);
+static Handle<Boolean> GlobalPropertyDeleter(Local<String> property,
+ const AccessorInfo &accessInfo);
+static Handle<Array> GlobalPropertyEnumerator(const AccessorInfo &accessInfo);
+
+// ContextifyInfo (and the context) will live until dispose() is called on
+// the sandbox or global.
+struct ContextifyInfo {
+ Persistent<Context> context;
+ Persistent<Object> sandbox;
+ Persistent<Object> global;
+
+ void SetContext(Persistent<Context> context) {
+ this->context = context;
+ }
+
+ void SetSandbox(Local<Object> sandbox) {
+ this->sandbox = Persistent<Object>::New(sandbox);
+ }
+
+ void SetGlobal(Local<Object> global) {
+ this->global = Persistent<Object>::New(global);
+ }
+};
+
+// Dispose is attached to the sandbox as 'dispose'. It must be called to
+// free the sandbox and context memory. ContextifyInfo keeps a strong
+// persistent reference to the sandbox, so if this isn't called, the sandbox
+// and the context will both leak.
+static Handle<Value> Dispose(const Arguments& args) {
+ Local<Value> wrapped = args.This()->GetHiddenValue(String::New("info"));
+ void* unwrapped = External::Unwrap(wrapped);
+ if (unwrapped == NULL) {
+ return ThrowException(String::New("Called dispose() twice."));
+ }
+ ContextifyInfo* info = static_cast<ContextifyInfo*>(unwrapped);
+ info->sandbox->SetHiddenValue(String::New("info"), External::Wrap(NULL));
+ info->global->SetHiddenValue(String::New("info"), External::Wrap(NULL));
+ info->context.Dispose();
+ info->context.Clear();
+ info->global.Dispose();
+ info->global.Clear();
+ info->sandbox->Delete(String::NewSymbol("run"));
+ info->sandbox->Delete(String::NewSymbol("getGlobal"));
+ info->sandbox->Delete(String::NewSymbol("dispose"));
+ // Note: this won't actually free the sandbox memory unless references from
+ // the JavaScript side are also dropped.
+ info->sandbox.Dispose();
+ info->sandbox.Clear();
+ delete info;
+ return Undefined();
+}
+
+// We only want to create 1 Function instance for each of these in this
+// context. Was previously creating a new Function for each Contextified
+// object and causing a memory leak.
+Persistent<Function> runFunc;
+Persistent<Function> getGlobalFunc;
+Persistent<Function> disposeFunc;
+
+// args[0] = the sandbox object
+static Handle<Value> Wrap(const Arguments& args) {
+ HandleScope scope;
+ Local<Object> sandbox;
+ if ((args.Length() > 0) && (args[0]->IsObject())) {
+ sandbox = args[0]->ToObject();
+ } else {
+ sandbox = Object::New();
+ }
+ // info is cleaned up by itself when the sandbox gets GC'd.
+ ContextifyInfo* info = new ContextifyInfo();
+ info->SetSandbox(sandbox);
+ Persistent<Context> context = CreateContext(info);
+ info->SetContext(context);
+ info->SetGlobal(context->Global());
+
+ Local<Value> wrapped = External::Wrap(info);
+ sandbox->SetHiddenValue(String::New("info"), wrapped);
+ info->global->SetHiddenValue(String::New("info"), wrapped);
+
+ if (runFunc.IsEmpty()) {
+ Local<FunctionTemplate> runTmpl = FunctionTemplate::New(Run);
+ runFunc = Persistent<Function>::New(runTmpl->GetFunction());
+ }
+ sandbox->Set(String::NewSymbol("run"), runFunc);
+
+ if (getGlobalFunc.IsEmpty()) {
+ Local<FunctionTemplate> getGlobalTmpl = FunctionTemplate::New(GetGlobal);
+ getGlobalFunc = Persistent<Function>::New(getGlobalTmpl->GetFunction());
+ }
+ sandbox->Set(String::NewSymbol("getGlobal"), getGlobalFunc);
+
+ if (disposeFunc.IsEmpty()) {
+ Local<FunctionTemplate> disposeFuncTmpl = FunctionTemplate::New(Dispose);
+ disposeFunc = Persistent<Function>::New(disposeFuncTmpl->GetFunction());
+ }
+ sandbox->Set(String::NewSymbol("dispose"), disposeFunc);
+
+ return scope.Close(sandbox);
+}
+
+// Create a context whose global object uses the sandbox to lookup and set
+// properties.
+static Persistent<Context> CreateContext(ContextifyInfo* info) {
+ HandleScope scope;
+ // Set up the context's global object.
+ Local<FunctionTemplate> ftmpl = FunctionTemplate::New();
+ ftmpl->SetHiddenPrototype(true);
+ ftmpl->SetClassName(info->sandbox->GetConstructorName());
+ Local<ObjectTemplate> otmpl = ftmpl->InstanceTemplate();
+ otmpl->SetNamedPropertyHandler(GlobalPropertyGetter,
+ GlobalPropertySetter,
+ GlobalPropertyQuery,
+ GlobalPropertyDeleter,
+ GlobalPropertyEnumerator);
+ Persistent<Context> context = Context::New(NULL, otmpl);
+
+ // Get rid of the proxy object.
+ context->DetachGlobal();
+ return context;
+}
+
+/*
+ * args[0] = String of code
+ * args[1] = filename
+ */
+static Handle<Value> Run(const Arguments& args) {
+ HandleScope scope;
+ Local<Value> wrapped = args.This()->GetHiddenValue(String::New("info"));
+ void* unwrapped = External::Unwrap(wrapped);
+ if (unwrapped == NULL) {
+ return ThrowException(String::New("Called run() after dispose()."));
+ }
+ ContextifyInfo* info = static_cast<ContextifyInfo*>(unwrapped);
+ Persistent<Context> context = info->context;
+ context->Enter();
+ Local<String> code = args[0]->ToString();
+ TryCatch trycatch;
+ Handle<Script> script;
+ if (args.Length() > 1) {
+ script = Script::Compile(code, args[1]->ToString());
+ } else {
+ script = Script::Compile(code);
+ }
+ if (script.IsEmpty()) {
+ context->Exit();
+ return trycatch.ReThrow();
+ }
+ Handle<Value> result = script->Run();
+ context->Exit();
+ if (result.IsEmpty()) {
+ return trycatch.ReThrow();
+ }
+ return scope.Close(result);
+}
+
+static Handle<Value> GetGlobal(const Arguments& args) {
+ HandleScope scope;
+ Local<Value> wrapped = args.This()->GetHiddenValue(String::New("info"));
+ void* unwrapped = External::Unwrap(wrapped);
+ if (unwrapped == NULL) {
+ return ThrowException(String::New("Called getGlobal() after dispose()."));
+ }
+ ContextifyInfo* info = static_cast<ContextifyInfo*>(unwrapped);
+ return scope.Close(info->global);
+}
+
+static Handle<Value> GlobalPropertyGetter (Local<String> property,
+ const AccessorInfo &accessInfo) {
+ HandleScope scope;
+ Local<Value> wrapped = accessInfo.This()->GetHiddenValue(String::New("info"));
+ void* unwrapped = External::Unwrap(wrapped);
+ if (unwrapped == NULL) {
+ return ThrowException(String::New("Called getGlobal() after dispose()."));
+ }
+ ContextifyInfo* info = static_cast<ContextifyInfo*>(unwrapped);
+ Persistent<Object> sandbox = info->sandbox;
+ // First check the sandbox object.
+ Local<Value> rv = sandbox->Get(property);
+ if (rv->IsUndefined()) {
+ // Next, check the global object (things like Object, Array, etc).
+ // This needs to call GetRealNamedProperty or else we'll get stuck in
+ // an infinite loop here.
+ rv = info->global->GetRealNamedProperty(property);
+ }
+ return scope.Close(rv);
+}
+
+// Global variables get set back on the sandbox object.
+static Handle<Value> GlobalPropertySetter (Local<String> property,
+ Local<Value> value,
+ const AccessorInfo &accessInfo) {
+ HandleScope scope;
+ Local<Value> wrapped = accessInfo.This()->GetHiddenValue(String::New("info"));
+ void* unwrapped = External::Unwrap(wrapped);
+ if (unwrapped == NULL) {
+ return ThrowException(String::New("Tried to set a property on global after dispose()."));
+ }
+ ContextifyInfo* info = static_cast<ContextifyInfo*>(unwrapped);
+ Persistent<Object> sandbox = info->sandbox;
+ bool success = sandbox->Set(property, value);
+ return scope.Close(value);
+}
+
+static Handle<Integer> GlobalPropertyQuery(Local<String> property,
+ const AccessorInfo &accessInfo) {
+ HandleScope scope;
+ return scope.Close(Integer::New(None));
+}
+
+static Handle<Boolean> GlobalPropertyDeleter(Local<String> property,
+ const AccessorInfo &accessInfo) {
+ HandleScope scope;
+ Local<Value> wrapped = accessInfo.This()->GetHiddenValue(String::New("info"));
+ void* unwrapped = External::Unwrap(wrapped);
+ if (unwrapped == NULL) {
+ ThrowException(String::New("Tried to delete a property on global after dispose()."));
+ return False();
+ }
+ ContextifyInfo* info = static_cast<ContextifyInfo*>(unwrapped);
+ Persistent<Object> sandbox = info->sandbox;
+ bool success = sandbox->Delete(property);
+ if (!success) {
+ Persistent<Context> context = info->context;
+ success = info->global->Delete(property);
+ }
+ return scope.Close(Boolean::New(success));
+}
+
+static Handle<Array> GlobalPropertyEnumerator(const AccessorInfo &accessInfo) {
+ HandleScope scope;
+ Local<Value> wrapped = accessInfo.This()->GetHiddenValue(String::New("info"));
+ void* unwrapped = External::Unwrap(wrapped);
+ if (unwrapped == NULL) {
+ // We can't throw an exception because we have to return an Array,
+ // and ThrowException returns a value. Returning an empty Array is
+ // better than segfaulting.
+ return scope.Close(Array::New());
+ }
+ ContextifyInfo* info = static_cast<ContextifyInfo*>(unwrapped);
+ Persistent<Object> sandbox = info->sandbox;
+ return scope.Close(sandbox->GetPropertyNames());
+}
+
+// Export the C++ Wrap method as 'wrap' on the module.
+static void Init(Handle<Object> target) {
+ HandleScope scope;
+ NODE_SET_METHOD(target, "wrap", Wrap);
+}
+
+extern "C" {
+ static void init(Handle<Object> target) {
+ Init(target);
+ }
+ NODE_MODULE(contextify, init);
+}
432 node_modules/contextify/test/contextify.js
@@ -0,0 +1,432 @@
+var Contextify = require('../lib/contextify.js');
+
+exports['basic tests'] = {
+ // Creating a context shouldn't fail.
+ 'blank context' : function (test) {
+ var ctx = Contextify({});
+ test.notEqual(ctx, null);
+ test.notEqual(ctx, undefined);
+ test.done();
+ },
+
+ // Creating a context with sandbox shouldn't change existing sandbox
+ // properties.
+ 'basic context' : function (test) {
+ var sandbox = {
+ prop1 : 'prop1',
+ prop2 : 'prop2'
+ };
+ Contextify(sandbox);
+ test.equal(sandbox.prop1, 'prop1');
+ test.equal(sandbox.prop2, 'prop2');
+ test.done();
+ },
+
+ // Ensure that the correct properties exist on a wrapped sandbox.
+ 'test contextified object extra properties' : function (test) {
+ var sandbox = Contextify({});
+ test.notEqual(sandbox.run, undefined);
+ test.notEqual(sandbox.getGlobal, undefined);
+ test.notEqual(sandbox.dispose, undefined);
+ test.done();
+ },
+
+ // Passing undefined should create an empty context.
+ 'test undefined sandbox' : function (test) {
+ // Should return an empty object.
+ test.notEqual(Contextify(undefined, undefined), undefined);
+ test.notEqual(Contextify(), undefined);
+ test.done();
+ },
+
+ // Make sure properties that aren't there...aren't there.
+ 'test for nonexistent properties' : function (test) {
+ var global = Contextify({}).getGlobal();
+ test.equal(global.test1, undefined);
+ test.done();
+ },
+
+ // Make sure run can be called with a filename parameter.
+ 'test run with filename' : function (test) {
+ var sandbox = Contextify();
+ sandbox.run('var x = 3', "test.js");
+ test.equal(sandbox.x, 3);
+ test.done();
+ },
+
+ // Make sure getters/setters on the sandbox object are used.
+ 'test accessors on sandbox' : function (test) {
+ var sandbox = {};
+ sandbox.__defineGetter__('test', function () { return 3;});
+ sandbox.__defineSetter__('test2', function (val) { this.x = val;});
+ Contextify(sandbox);
+ var global = sandbox.getGlobal();
+ test.equal(global.test, 3);
+ sandbox.test2 = 5;
+ test.equal(sandbox.x, 5);
+ global.test2 = 7;
+ test.equal(global.x, 7);
+ test.equal(sandbox.x, 7);
+ test.done();
+ },
+
+ // Make sure dispose cleans up the sandbox.
+ 'test dispose' : function (test) {
+ var sandbox = Contextify();
+ test.notEqual(sandbox.run, undefined);
+ test.notEqual(sandbox.getGlobal, undefined);
+ test.notEqual(sandbox.dispose, undefined);
+ sandbox.dispose();
+ test.equal(sandbox.run, undefined);
+ test.equal(sandbox.getGlobal, undefined);
+ test.equal(sandbox.dispose, undefined);
+ test.done();
+ }
+};
+
+exports['synchronous script tests'] = {
+ // Synchronous context script execution:
+ // Ensure that global variables are put on the sandbox object.
+ 'global variables in scripts should go on sandbox' : function (test) {
+ var sandbox = {
+ prop1 : 'prop1',
+ prop2 : 'prop2'
+ };
+ Contextify(sandbox);
+ sandbox.run('x = 3');
+ test.equal(sandbox.x, 3);
+ test.done();
+ },
+
+ // Synchronous context script execution:
+ // Ensure that sandbox properties can be accessed as global variables.
+ 'sandbox properties should be globals' : function (test) {
+ var sandbox = {
+ prop1 : 'prop1',
+ prop2 : 'prop2'
+ };
+ Contextify(sandbox);
+ sandbox.run("test1 = (prop1 == 'prop1');" +
+ "test2 = (prop2 == 'prop2');");
+ test.ok(sandbox.test1);
+ test.ok(sandbox.test2);
+ test.done();
+ }
+};
+
+exports['asynchronous script tests'] = {
+ // Asynchronous context script execution:
+ // Ensure that global variables are put on the sandbox object.
+ 'global variables in scripts should go on sandbox' : function (test) {
+ var sandbox = {
+ setTimeout : setTimeout,
+ prop1 : 'prop1',
+ prop2 : 'prop2'
+ };
+ Contextify(sandbox);
+ sandbox.run('setTimeout(function () {x = 3}, 0);');
+ test.equal(sandbox.x, undefined);
+ setTimeout(function () {
+ test.equal(sandbox.x, 3);
+ test.done();
+ }, 0);
+ },
+
+ // Asynchronous context script execution:
+ // Ensure that sandbox properties can be accessed as global variables.
+ 'sandbox properties should be globals' : function (test) {
+ var sandbox = {
+ setTimeout : setTimeout,
+ prop1 : 'prop1',
+ prop2 : 'prop2'
+ };
+ Contextify(sandbox);
+ sandbox.run("setTimeout(function () {" +
+ "test1 = (prop1 == 'prop1');" +
+ "test2 = (prop2 == 'prop2');" +
+ "}, 0)");
+ test.equal(sandbox.test1, undefined);
+ test.equal(sandbox.test2, undefined);
+ setTimeout(function () {
+ test.ok(sandbox.test1);
+ test.ok(sandbox.test2);
+ test.done();
+ }, 0);
+ }
+};
+
+exports['test global'] = {
+ // Make sure getGlobal() works.
+ 'basic test' : function (test) {
+ var sandbox = {
+ prop1 : 'prop1',
+ prop2 : 'prop2'
+ };
+ Contextify(sandbox);
+ var global = sandbox.getGlobal();
+ test.notDeepEqual(global, null);
+ test.notDeepEqual(global, undefined);
+ // Make sure global is forwarding properly.
+ test.equal(global.prop1, 'prop1');
+ test.equal(global.prop2, 'prop2');
+ global.prop3 = 'prop3';
+ test.equal(sandbox.prop3, 'prop3');
+ test.done();
+ },
+
+ // Make sure that references to the global are correct.
+ 'self references to the global object' : function (test) {
+ var sandbox = Contextify({});
+ var global = sandbox.getGlobal();
+ sandbox.ref1 = global;
+ sandbox.ref2 = {
+ ref2 : global
+ };
+ sandbox.run("test1 = (this == ref1);" +
+ "test2 = (this == ref2.ref2);");
+ test.ok(sandbox.test1);
+ test.ok(sandbox.test2);
+ test.done();
+ },
+
+ // Make sure the enumerator is enumerating correctly.
+ 'test enumerator' : function (test) {
+ var sandbox = {
+ prop1 : 'prop1',
+ prop2 : 'prop2'
+ };
+ var global = Contextify(sandbox).getGlobal();
+ var globalProps = Object.keys(global);
+ test.equal(globalProps.length, 5);
+ test.ok(globalProps.indexOf('prop1') != -1);
+ test.ok(globalProps.indexOf('prop2') != -1);
+ test.ok(globalProps.indexOf('run') != -1);
+ test.ok(globalProps.indexOf('getGlobal') != -1);
+ test.ok(globalProps.indexOf('dispose') != -1);
+ test.done();
+ },
+
+ // Make sure deleter is working.
+ 'test deleter' : function (test) {
+ var sandbox = {
+ prop1 : 'prop1',
+ prop2 : 'prop2'
+ };
+ var global = Contextify(sandbox).getGlobal();
+ test.equal(Object.keys(global).length, 5);
+ test.equal(Object.keys(sandbox).length, 5);
+ delete global.prop1;
+ test.equal(Object.keys(global).length, 4);
+ test.equal(Object.keys(sandbox).length, 4);
+ delete global.prop2;
+ test.equal(Object.keys(global).length, 3);
+ test.equal(Object.keys(sandbox).length, 3);
+ delete global.run;
+ test.equal(Object.keys(global).length, 2);
+ test.equal(Object.keys(sandbox).length, 2);
+ delete global.getGlobal;
+ test.equal(Object.keys(global).length, 1);
+ test.equal(Object.keys(sandbox).length, 1);
+ delete global.dispose;
+ test.equal(Object.keys(global).length, 0);
+ test.equal(Object.keys(sandbox).length, 0);
+ test.done();
+ },
+
+ // Make sure the global's class name is the same as the sandbox.
+ 'test global class name' : function (test) {
+ function DOMWindow () {};
+ var sandbox = Contextify(new DOMWindow());
+ var global = sandbox.getGlobal();
+ test.equal(sandbox.constructor.name, 'DOMWindow');
+ test.equal(sandbox.constructor.name, global.constructor.name);
+ sandbox.run('thisName = this.constructor.name');
+ test.equal(sandbox.thisName, sandbox.constructor.name);
+ test.done();
+ },
+
+ // Make sure functions in global scope are accessible through global.
+ 'test global functions' : function (test) {
+ var sandbox = Contextify();
+ var global = sandbox.getGlobal();
+ sandbox.run("function testing () {}");
+ test.notEqual(global.testing, undefined);
+ test.done();
+ },
+
+ // Make sure global can be a receiver for run().
+ 'test global.run()' : function (test) {
+ var global = Contextify().getGlobal();
+ global.run("x = 5");
+ test.equal(global.x, 5);
+ test.done();
+ },
+
+ // Make sure global can be a receiver for getGlobal().
+ 'test global.getGlobal()' : function (test) {
+ var global = Contextify().getGlobal();
+ test.deepEqual(global, global.getGlobal());
+ test.done();
+ },
+
+ //Make sure global can be a receiver for dispose().
+ 'test global.dispose()' : function (test) {
+ var sandbox = Contextify();
+ var global = sandbox.getGlobal();
+ test.notEqual(global.run, undefined);
+ test.notEqual(global.getGlobal, undefined);
+ test.notEqual(global.dispose, undefined);
+ global.dispose();
+ // It's not safe to use the global after disposing.
+ test.equal(sandbox.run, undefined);
+ test.equal(sandbox.getGlobal, undefined);
+ test.equal(sandbox.dispose, undefined);
+ test.done();
+ }
+};
+
+
+// Test that multiple contexts don't interfere with each other.
+exports['test multiple contexts'] = function (test) {
+ var sandbox1 = {
+ prop1 : 'prop1',
+ prop2 : 'prop2'
+ };
+ var sandbox2 = {
+ prop1 : 'prop1',
+ prop2 : 'prop2'
+ };
+ var global1 = Contextify(sandbox1).getGlobal();
+ var global2 = Contextify(sandbox2).getGlobal();
+ test.equal(global1.prop1, 'prop1');
+ test.equal(global2.prop1, 'prop1');
+ sandbox1.run('test = 3');
+ sandbox2.run('test = 4');
+ test.equal(sandbox1.test, 3);
+ test.equal(global1.test, 3);
+ test.equal(sandbox2.test, 4);
+ test.equal(global2.test, 4);
+ test.done();
+};
+
+// Test console - segfaults in REPL.
+exports['test console'] = function (test) {
+ var sandbox = {
+ console : console,
+ prop1 : 'prop1'
+ };
+ Contextify(sandbox);
+ test.doesNotThrow(function () {
+ sandbox.run('console.log(prop1);');
+ });
+ test.done();
+};
+
+
+// Make sure exceptions get thrown for invalid scripts.
+exports['test exceptions'] = {
+ 'basic test' : function (test) {
+ var sandbox = Contextify();
+ test.throws(function () {
+ sandbox.run('doh');
+ });
+ test.throws(function () {
+ sandbox.run('x = y');
+ });
+ test.throws(function () {
+ sandbox.run('function ( { (( }{);');
+ });
+ test.done();
+ },
+
+ 'test double dispose() - sandbox' : function (test) {
+ var sandbox = Contextify();
+ test.doesNotThrow(function () {
+ sandbox.dispose();
+ });
+ test.throws(function () {
+ sandbox.dispose();
+ }, 'Called dispose() twice.');
+ test.done();
+ },
+
+ 'test double dispose - global' : function (test) {
+ var sandbox = Contextify();
+ var global = sandbox.getGlobal();
+ test.doesNotThrow(function () {
+ global.dispose();
+ });
+ test.throws(function () {
+ global.dispose();
+ }, 'Called dispose() twice.');
+ test.done();
+ },
+
+ 'test run() after dispose()' : function (test) {
+ var sandbox = Contextify();
+ test.doesNotThrow(function () {
+ sandbox.dispose();
+ });
+ test.throws(function () {
+ sandbox.run('var x = 3');
+ }, 'Called run() after dispose().');
+ test.done();
+ },
+
+ 'test getGlobal() after dispose()' : function (test) {
+ var sandbox = Contextify();
+ test.doesNotThrow(function () {
+ sandbox.dispose();
+ });
+ test.throws(function () {
+ var g = sandbox.getGlobal();
+ }, 'Called getGlobal() after dispose().');
+ test.done();
+ },
+
+ 'test global property getter after dispose()' : function (test) {
+ var sandbox = Contextify({prop1 : 'test'});
+ var global = sandbox.getGlobal();
+ test.doesNotThrow(function () {
+ sandbox.dispose();
+ });
+ test.throws(function () {
+ var x = global.prop1;
+ }, 'Tried to access global after dispose().');
+ test.done();
+ },
+
+ 'test global property setter after dispose()' : function (test) {
+ var sandbox = Contextify();
+ var global = sandbox.getGlobal();
+ test.doesNotThrow(function () {
+ sandbox.dispose();
+ });
+ test.throws(function () {
+ global.x = 3;
+ }, 'Tried to set a property on global after dispose().');
+ test.done();
+ },
+
+ 'test global property deleter after dispose()' : function (test) {
+ var sandbox = Contextify({prop1 : 'test'});
+ var global = sandbox.getGlobal();
+ test.doesNotThrow(function () {
+ sandbox.dispose();
+ });
+ test.throws(function () {
+ delete global.prop1;
+ }, 'Tried to delete a property on global after dispose().');
+ test.done();
+
+ }
+};
+
+exports['test global property enumerator after dispose()'] = function (test) {
+ var sandbox = Contextify({prop1 : 'test', prop2 : 'test'});
+ var global = sandbox.getGlobal();
+ sandbox.dispose();
+ var props = Object.keys(global);
+ test.equal(props.length, 0);
+ test.done();
+};
18 node_modules/contextify/wscript
@@ -0,0 +1,18 @@
+import Options
+import os
+import sys
+
+VERSION = '0.0.5'
+
+def set_options(opt):
+ opt.tool_options("compiler_cxx")
+
+def configure(conf):
+ conf.check_tool("compiler_cxx")
+ conf.check_tool("node_addon")
+ conf.env.set_variant("Release")
+
+def build(bld):
+ obj = bld.new_task_gen("cxx", "shlib", "node_addon")
+ obj.target = "contextify"
+ obj.source = "src/contextify.cc"
9 node_modules/cssom/.idea/CSSOM.iml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="RUBY_MODULE" version="4">
+ <component name="NewModuleRootManager">
+ <content url="file://$MODULE_DIR$" />
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
+
3  node_modules/cssom/.idea/dictionaries/nv.xml
@@ -0,0 +1,3 @@
+<component name="ProjectDictionaryState">
+ <dictionary name="nv" />
+</component>
5 node_modules/cssom/.idea/encodings.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" defaultCharsetForPropertiesFiles="UTF-8" />
+</project>
+
17 node_modules/cssom/.idea/misc.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="DependencyValidationManager">
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </component>
+ <component name="ProjectDetails">
+ <option name="projectName" value="CSSOM" />
+ </component>
+ <component name="ProjectResources">
+ <default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
+ </component>
+ <component name="ProjectRootManager" version="2" project-jdk-name="Ruby SDK 1.8.7 (/usr/bin/ruby)" project-jdk-type="RUBY_SDK" />
+ <component name="SvnBranchConfigurationManager">
+ <option name="mySupportsUserInfoFilter" value="true" />
+ </component>
+</project>
+
9 node_modules/cssom/.idea/modules.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/.idea/CSSOM.iml" filepath="$PROJECT_DIR$/.idea/CSSOM.iml" />
+ </modules>
+ </component>
+</project>
+
82 node_modules/cssom/.idea/projectCodeStyle.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="CodeStyleSettingsManager">
+ <option name="PER_PROJECT_SETTINGS">
+ <value>
+ <option name="USE_SAME_INDENTS" value="true" />
+ <option name="OTHER_INDENT_OPTIONS">
+ <value>
+ <option name="INDENT_SIZE" value="4" />
+ <option name="CONTINUATION_INDENT_SIZE" value="0" />
+ <option name="TAB_SIZE" value="4" />
+ <option name="USE_TAB_CHARACTER" value="true" />
+ <option name="SMART_TABS" value="false" />
+ <option name="LABEL_INDENT_SIZE" value="0" />
+ <option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
+ </value>
+ </option>
+ <option name="LINE_SEPARATOR" value="&#10;" />
+ <option name="XML_ATTRIBUTE_WRAP" value="0" />
+ <option name="XML_TEXT_WRAP" value="0" />
+ <option name="XML_ALIGN_ATTRIBUTES" value="false" />
+ <option name="HTML_ATTRIBUTE_WRAP" value="0" />
+ <option name="HTML_TEXT_WRAP" value="0" />
+ <option name="HTML_ALIGN_ATTRIBUTES" value="false" />
+ <option name="HTML_DO_NOT_INDENT_CHILDREN_OF" value="html,body,thead,tbody,tfoot,style,script" />
+ <ADDITIONAL_INDENT_OPTIONS fileType="js">
+ <option name="INDENT_SIZE" value="4" />
+ <option name="CONTINUATION_INDENT_SIZE" value="8" />
+ <option name="TAB_SIZE" value="4" />
+ <option name="USE_TAB_CHARACTER" value="false" />
+ <option name="SMART_TABS" value="false" />
+ <option name="LABEL_INDENT_SIZE" value="0" />
+ <option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
+ </ADDITIONAL_INDENT_OPTIONS>
+ <ADDITIONAL_INDENT_OPTIONS fileType="jsp">
+ <option name="INDENT_SIZE" value="4" />
+ <option name="CONTINUATION_INDENT_SIZE" value="8" />
+ <option name="TAB_SIZE" value="4" />
+ <option name="USE_TAB_CHARACTER" value="false" />
+ <option name="SMART_TABS" value="false" />
+ <option name="LABEL_INDENT_SIZE" value="0" />
+ <option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
+ </ADDITIONAL_INDENT_OPTIONS>
+ <ADDITIONAL_INDENT_OPTIONS fileType="sass">
+ <option name="INDENT_SIZE" value="2" />
+ <option name="CONTINUATION_INDENT_SIZE" value="8" />
+ <option name="TAB_SIZE" value="4" />
+ <option name="USE_TAB_CHARACTER" value="false" />
+ <option name="SMART_TABS" value="false" />
+ <option name="LABEL_INDENT_SIZE" value="0" />
+ <option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
+ </ADDITIONAL_INDENT_OPTIONS>
+ <ADDITIONAL_INDENT_OPTIONS fileType="xml">
+ <option name="INDENT_SIZE" value="4" />
+ <option name="CONTINUATION_INDENT_SIZE" value="8" />
+ <option name="TAB_SIZE" value="4" />
+ <option name="USE_TAB_CHARACTER" value="false" />
+ <option name="SMART_TABS" value="false" />
+ <option name="LABEL_INDENT_SIZE" value="0" />
+ <option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
+ </ADDITIONAL_INDENT_OPTIONS>
+ <ADDITIONAL_INDENT_OPTIONS fileType="yml">
+ <option name="INDENT_SIZE" value="2" />
+ <option name="CONTINUATION_INDENT_SIZE" value="8" />
+ <option name="TAB_SIZE" value="4" />
+ <option name="USE_TAB_CHARACTER" value="false" />
+ <option name="SMART_TABS" value="false" />
+ <option name="LABEL_INDENT_SIZE" value="0" />
+ <option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
+ </ADDITIONAL_INDENT_OPTIONS>
+ </value>
+ </option>
+ <option name="USE_PER_PROJECT_SETTINGS" value="true" />
+ </component>
+</project>
+
8 node_modules/cssom/.idea/vcs.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="" />
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
+ </component>
+</project>
+
467 node_modules/cssom/.idea/workspace.xml
@@ -0,0 +1,467 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ChangeListManager">
+ <list default="true" id="30285013-672e-4686-875b-58c4268c29f5" name="Default" comment="">
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/docs/build.html" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/CSSImportRule.js" afterPath="$PROJECT_DIR$/lib/CSSImportRule.js" />
+ </list>
+ <ignored path=".idea/workspace.xml" />
+ <ignored path="CSSOM.iws" />
+ <option name="TRACKING_ENABLED" value="true" />
+ <option name="SHOW_DIALOG" value="false" />
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+ <option name="LAST_RESOLUTION" value="IGNORE" />
+ </component>
+ <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
+ <component name="CreatePatchCommitExecutor">
+ <option name="PATCH_PATH" value="" />
+ <option name="REVERSE_PATCH" value="false" />
+ </component>
+ <component name="DaemonCodeAnalyzer">
+ <disable_hints />
+ </component>
+ <component name="FavoritesManager">
+ <favorites_list name="CSSOM" />
+ </component>
+ <component name="FileEditorManager">
+ <leaf>
+ <file leaf-file-name="parse.html" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/docs/parse.html">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="26" column="16" selection-start="713" selection-end="713" vertical-scroll-proportion="-16.0">
+ <folding>
+ <marker date="1292697557000" expanded="true" signature="681:774" placeholder="{...}" />
+ </folding>
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="parse2.html" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/docs/parse2.html">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="197" column="25" selection-start="3686" selection-end="3686" vertical-scroll-proportion="-0.6666667">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="build.html" pinned="false" current="true" current-in-tab="true">
+ <entry file="file://$PROJECT_DIR$/docs/build.html">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="50" column="28" selection-start="1126" selection-end="1126" vertical-scroll-proportion="0.6090535">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="parse.js" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/lib/parse.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="44" column="11" selection-start="880" selection-end="880" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="CSSOM.js" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/build/CSSOM.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="11" column="11" selection-start="226" selection-end="226" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="helper.js" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/test/helper.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="32" column="0" selection-start="771" selection-end="771" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="qunit.js" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/test/vendor/qunit.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="42" column="59" selection-start="1027" selection-end="1027" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="CSSStyleDeclaration.test.js" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/test/CSSStyleDeclaration.test.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="12" column="19" selection-start="279" selection-end="279" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="CSSStyleDeclaration.js" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/lib/CSSStyleDeclaration.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="105" column="22" selection-start="2425" selection-end="2443" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="clone.test.js" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/test/clone.test.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="36" column="14" selection-start="805" selection-end="805" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ </leaf>
+ </component>
+ <component name="FindManager">
+ <FindUsagesManager>
+ <setting name="OPEN_NEW_TAB" value="false" />
+ </FindUsagesManager>
+ </component>
+ <component name="Git.Branch.Configurations">
+ <option name="CURRENT" value="parser" />
+ <option name="CONFIGURATIONS">
+ <array>
+ <BranchConfiguration>
+ <option name="IS_AUTO_DETECTED" value="true" />
+ <option name="NAME" value="master" />
+ <option name="BRANCHES">
+ <array>
+ <BranchInfo>
+ <option name="ROOT" value="$PROJECT_DIR$" />
+ <option name="REFERENCE" value="master" />
+ </BranchInfo>
+ </array>
+ </option>
+ </BranchConfiguration>
+ <BranchConfiguration>
+ <option name="IS_AUTO_DETECTED" value="true" />
+ <option name="NAME" value="parser" />
+ <option name="BRANCHES">
+ <array>
+ <BranchInfo>
+ <option name="ROOT" value="$PROJECT_DIR$" />
+ <option name="REFERENCE" value="parser" />
+ </BranchInfo>
+ </array>
+ </option>
+ </BranchConfiguration>
+ </array>
+ </option>
+ </component>
+ <component name="Git.Settings">
+ <option name="CHECKOUT_INCLUDE_TAGS" value="false" />
+ <option name="UPDATE_CHANGES_POLICY" value="STASH" />
+ </component>
+ <component name="IdeDocumentHistory">
+ <option name="changedFiles">
+ <list>
+ <option value="$PROJECT_DIR$/test/parse.test.js" />
+ <option value="$PROJECT_DIR$/lib/CSSImportRule.js" />
+ <option value="$PROJECT_DIR$/server/index.html" />
+ <option value="$PROJECT_DIR$/server/index.js" />
+ <option value="$PROJECT_DIR$/lib/parse.js" />
+ <option value="$PROJECT_DIR$/lib/index.js" />
+ <option value="$PROJECT_DIR$/test/index.html" />
+ <option value="$PROJECT_DIR$/test/clone.test.js" />
+ <option value="$PROJECT_DIR$/lib/clone.js" />
+ <option value="$PROJECT_DIR$/test/helper.js" />
+ <option value="$PROJECT_DIR$/test/vendor/qunit.js" />
+ <option value="$PROJECT_DIR$/lib/CSSStyleDeclaration.js" />
+ <option value="$PROJECT_DIR$/test/CSSStyleDeclaration.test.js" />
+ <option value="$PROJECT_DIR$/docs/parse2.html" />
+ <option value="$PROJECT_DIR$/docs/parse.html" />
+ <option value="$PROJECT_DIR$/docs/build.html" />
+ </list>
+ </option>
+ </component>
+ <component name="PerforceDirect.Settings">
+ <option name="ENABLED" value="false" />
+ </component>
+ <component name="ProjectLevelVcsManager">
+ <OptionsSetting value="true" id="Add" />
+ <OptionsSetting value="true" id="Remove" />
+ <OptionsSetting value="true" id="Checkout" />
+ <OptionsSetting value="true" id="Update" />
+ <OptionsSetting value="true" id="Status" />
+ <OptionsSetting value="true" id="Edit" />
+ <ConfirmationsSetting value="2" id="Add" />
+ <ConfirmationsSetting value="0" id="Remove" />
+ </component>
+ <component name="ProjectReloadState">
+ <option name="STATE" value="0" />
+ </component>
+ <component name="ProjectView">
+ <navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
+ <flattenPackages />
+ <showMembers />
+ <showModules />
+ <showLibraryContents ProjectPane="false" />
+ <hideEmptyPackages />
+ <abbreviatePackageNames />
+ <autoscrollToSource />
+ <autoscrollFromSource />
+ <sortByType />
+ </navigator>
+ <panes>
+ <pane id="Favorites" />
+ <pane id="Scope" />
+ <pane id="ProjectPane">
+ <subPane>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="CSSOM" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="CSSOM" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ </subPane>
+ </pane>
+ </panes>
+ </component>
+ <component name="PropertiesComponent">
+ <property name="options.splitter.main.proportions" value="0.3" />
+ <property name="WebServerToolWindowFactoryState" value="true" />
+ <property name="WebServerToolWindowPanel.toolwindow.show.permissions" value="false" />
+ <property name="WebServerToolWindowPanel.toolwindow.show.date" value="false" />
+ <property name="options.lastSelected" value="preferences.sourceCode.HTML" />
+ <property name="WebServerToolWindowPanel.toolwindow.show.size" value="false" />
+ <property name="WebServerToolWindowPanel.toolwindow.highlight.symlinks" value="true" />
+ <property name="DefaultHtmlFileTemplate" value="Html5" />
+ <property name="WebServerToolWindowPanel.toolwindow.highlight.mappings" value="true" />
+ <property name="options.searchVisible" value="true" />
+ <property name="options.splitter.details.proportions" value="0.2" />
+ <property name="GoToClass.includeJavaFiles" value="false" />
+ </component>
+ <component name="PublishConfig" exclude=".svn;.cvs;.idea;.DS_Store;.git;.hg" autoUpload="true">
+ <servers>
+ <server id="03e3dd9a-a049-4a09-8d26-9d8ee4abc8ea">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" />
+ </mappings>
+ </serverdata>
+ </server>
+ </servers>
+ </component>
+ <component name="RunManager">
+ <configuration default="true" type="JavascriptDebugSession" factoryName="Remote">
+ <JSRemoteDebuggerConfigurationSettings>
+ <option name="engineId" value="embedded" />
+ <option name="fileUrl" />
+ </JSRemoteDebuggerConfigurationSettings>
+ <method />
+ </configuration>
+ <list size="0" />
+ </component>
+ <component name="ShelveChangesManager" show_recycled="false" />
+ <component name="SvnConfiguration" maxAnnotateRevisions="500">
+ <option name="USER" value="" />
+ <option name="PASSWORD" value="" />
+ <option name="LAST_MERGED_REVISION" />
+ <option name="UPDATE_RUN_STATUS" value="false" />
+ <option name="MERGE_DRY_RUN" value="false" />
+ <option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
+ <option name="UPDATE_LOCK_ON_DEMAND" value="false" />
+ <option name="IGNORE_SPACES_IN_MERGE" value="false" />
+ <option name="DETECT_NESTED_COPIES" value="false" />
+ <option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
+ <option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
+ <option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
+ <configuration useDefault="true">$USER_HOME$/.subversion_IDEA</configuration>
+ <myIsUseDefaultProxy>false</myIsUseDefaultProxy>
+ <supportedVersion>125</supportedVersion>
+ </component>
+ <component name="TaskManager">
+ <task active="true" id="Default" summary="Default task">
+ <changelist id="30285013-672e-4686-875b-58c4268c29f5" name="Default" comment="" />
+ <created>1285386214790</created>
+ <updated>1285386214790</updated>
+ </task>
+ <servers />
+ </component>
+ <component name="TodoView" selected-index="0">
+ <todo-panel id="selected-file">
+ <are-packages-shown value="false" />
+ <are-modules-shown value="false" />
+ <flatten-packages value="false" />
+ <is-autoscroll-to-source value="false" />
+ </todo-panel>
+ <todo-panel id="all">
+ <are-packages-shown value="false" />
+ <are-modules-shown value="false" />
+ <flatten-packages value="false" />
+ <is-autoscroll-to-source value="false" />
+ </todo-panel>
+ <todo-panel id="default-changelist">
+ <are-packages-shown value="false" />
+ <are-modules-shown value="false" />
+ <flatten-packages value="false" />
+ <is-autoscroll-to-source value="false" />
+ </todo-panel>
+ </component>
+ <component name="ToolWindowManager">
+ <frame x="851" y="22" width="907" height="1087" extended-state="0" />
+ <editor active="true" />
+ <layout>
+ <window_info id="Changes" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" />
+ <window_info id="TODO" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.2691867" sideWeight="0.3254902" order="1" side_tool="true" content_ui="tabs" />
+ <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.24948454" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
+ <window_info id="Remote Host" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3866775" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
+ <window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3565976" sideWeight="0.9709977" order="0" side_tool="false" content_ui="tabs" />
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+ <window_info id="Version Control" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="4" side_tool="true" content_ui="tabs" />
+ <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
+ <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+ <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.327451" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+ <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+ <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+ <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
+ </layout>
+ </component>
+ <component name="VcsManagerConfiguration">
+ <option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
+ <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
+ <option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
+ <option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="true" />
+ <option name="ENABLE_BACKGROUND_PROCESSES" value="true" />
+ <option name="CHANGED_ON_SERVER_INTERVAL" value="5" />
+ <option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
+ <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
+ <option name="LAST_COMMIT_MESSAGE" />
+ <option name="MAKE_NEW_CHANGELIST_ACTIVE" value="true" />
+ <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
+ <option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
+ <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
+ <option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
+ <option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
+ <option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
+ <option name="ACTIVE_VCS_NAME" />
+ <option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
+ <option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
+ <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
+ <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
+ </component>
+ <component name="XDebuggerManager">
+ <breakpoint-manager />
+ </component>
+ <component name="XSLT-Support.FileAssociations.UIState">
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="CSSOM" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ </component>
+ <component name="editorHistoryManager">
+ <entry file="file://$PROJECT_DIR$/server/index.html">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="11" column="39" selection-start="306" selection-end="306" vertical-scroll-proportion="0.30877194" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/server/index.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="15" column="40" selection-start="432" selection-end="432" vertical-scroll-proportion="0.4040404" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/test/index.html">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="15" column="34" selection-start="423" selection-end="423" vertical-scroll-proportion="-10.0" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/lib/CSSStyleRule.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="4" column="2" selection-start="143" selection-end="143" vertical-scroll-proportion="0.0" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/lib/CSSStyleSheet.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="12" column="6" selection-start="250" selection-end="250" vertical-scroll-proportion="0.0" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/lib/clone.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="55" column="9" selection-start="1506" selection-end="1506" vertical-scroll-proportion="0.0" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/lib/parse.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="44" column="11" selection-start="880" selection-end="880" vertical-scroll-proportion="0.0" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/build/CSSOM.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="11" column="11" selection-start="226" selection-end="226" vertical-scroll-proportion="0.0" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/test/helper.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="32" column="0" selection-start="771" selection-end="771" vertical-scroll-proportion="0.0" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/test/vendor/qunit.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="42" column="59" selection-start="1027" selection-end="1027" vertical-scroll-proportion="0.0" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/test/CSSStyleDeclaration.test.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="12" column="19" selection-start="279" selection-end="279" vertical-scroll-proportion="0.0" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/lib/CSSStyleDeclaration.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="105" column="22" selection-start="2425" selection-end="2443" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/test/clone.test.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="36" column="14" selection-start="805" selection-end="805" vertical-scroll-proportion="0.0" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/docs/parse.html">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="26" column="16" selection-start="713" selection-end="713" vertical-scroll-proportion="-16.0">
+ <folding>
+ <marker date="1292697557000" expanded="true" signature="681:774" placeholder="{...}" />
+ </folding>
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/docs/parse2.html">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="197" column="25" selection-start="3686" selection-end="3686" vertical-scroll-proportion="-0.6666667">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/docs/build.html">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="50" column="28" selection-start="1126" selection-end="1126" vertical-scroll-proportion="0.6090535">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </component>
+</project>
+
19 node_modules/cssom/.livereload
@@ -0,0 +1,19 @@
+# Lines starting with pound sign (#) are ignored.
+
+# additional extensions to monitor
+#config.exts << 'haml'
+
+# exclude files with NAMES matching this mask
+#config.exclusions << '~*'
+# exclude files with PATHS matching this mask (if the mask contains a slash)
+#config.exclusions << '/excluded_dir/*'
+# exclude files with PATHS matching this REGEXP
+#config.exclusions << /somedir.*(ab){2,4}.(css|js)$/
+
+# reload the whole page when .js changes
+#config.apply_js_live = false
+# reload the whole page when .css changes
+#config.apply_css_live = false
+
+# wait 100ms for more changes before reloading a page
+#config.grace_period = 0.1
37 node_modules/cssom/Jakefile
@@ -0,0 +1,37 @@
+var PATH = require("path");
+var FS = require("fs");
+
+function readFile(path) {
+ var abs_path = PATH.join(__dirname, "lib", path);
+ return FS.readFileSync(abs_path, "utf8");
+}
+
+function stripCommonJS(text) {
+ return text.replace(/\/\/\.CommonJS(?:.|\n)*?\/\/\/CommonJS/g, "");
+}
+
+desc("Packages lib files into the one huge");
+task("default", [], function(){
+ var files = [readFile("CSSOM.js")];
+ var index_file = readFile("index.js");
+
+ (function(){
+ var exports = {};
+ function require(path) {
+ var text = readFile(path + ".js");
+ files.push(stripCommonJS(text).trimLeft());
+ return {};
+ }
+ eval(index_file);
+ })();
+
+ var build_dir = PATH.join(__dirname, "build");
+ try {
+ FS.statSync(build_dir);
+ } catch(e) {
+ FS.mkdirSync(build_dir, 0755);
+ }
+ var build_path = PATH.join(build_dir, "CSSOM.js");
+ FS.writeFileSync(build_path, files.join(""));
+ process.stdout.write("build/CSSOM.js is done\n");
+});
33 node_modules/cssom/README.mdown
@@ -0,0 +1,33 @@
+# CSSOM
+
+CSSOM.js is a CSS parser written in pure JavaScript. It also a partial implementation of [CSS Object Model](http://dev.w3.org/csswg/cssom/).
+
+ CSSOM.parse("body {color: black}")
+ -> {
+ cssRules: [
+ {
+ selectorText: "body",
+ style: {
+ 0: "color",
+ color: "black",
+ length: 1
+ }
+ }
+ ]
+ }
+
+
+## [Parser demo](http://nv.github.com/CSSOM/docs/parse.html)
+
+
+## [Tests](http://nv.github.com/CSSOM/test/)
+
+Works well in Google Chrome 6+, Safari 5+, Firefox 3.6+, Opera 10.63+.
+Doesn't work in IE < 9 because of unsupported getters/setters.
+
+## Build
+
+Build one-file version of CSSOM.js with [Jake](http://github.com/mde/node-jake):
+
+ ➤ jake
+ build/CSSOM.js is done
23 node_modules/cssom/Rakefile
@@ -0,0 +1,23 @@
+def version
+ git_describe_tags = `git describe --tags`
+ tag = git_describe_tags.split('-').first || git_describe_tags
+ tag.strip!
+ commit = `git rev-list --full-history #{tag}.. -- src/ | wc -l`.strip
+ tag.slice! 0
+ "#{tag}.#{commit}"
+end
+
+task :upload do
+ require 'net/github-upload'
+ gh = Net::GitHub::Upload.new(
+ :login => `git config github.user`.chomp,
+ :token => `git config github.token`.chomp
+ )
+ puts gh.upload(
+ :repos => 'CSSOM',
+ :file => 'build/CSSOM.js',
+ :name => "CSSOM.v#{version}.js",
+ :content_type => 'text/javascript',
+ :description => "CSS Object Model implemented in pure JavaScript"
+ )
+end
19 node_modules/cssom/docs/.livereload
@@ -0,0 +1,19 @@
+# Lines starting with pound sign (#) are ignored.
+
+# additional extensions to monitor
+#config.exts << 'haml'
+
+# exclude files with NAMES matching this mask
+#config.exclusions << '~*'
+# exclude files with PATHS matching this mask (if the mask contains a slash)
+#config.exclusions << '/excluded_dir/*'
+# exclude files with PATHS matching this REGEXP
+#config.exclusions << /somedir.*(ab){2,4}.(css|js)$/
+
+# reload the whole page when .js changes
+#config.apply_js_live = false
+# reload the whole page when .css changes
+#config.apply_css_live = false
+
+# wait 100ms for more changes before reloading a page
+#config.grace_period = 0.1
3  node_modules/cssom/docs/bar.css
@@ -0,0 +1,3 @@
+body * {
+ color: red !important;
+}
0  node_modules/cssom/docs/demo.css
No changes.
4 node_modules/cssom/docs/foo.css
@@ -0,0 +1,4 @@
+@import "bar.css" screen;
+body {
+ background: black !important;
+}
170 node_modules/cssom/docs/parse.html
@@ -0,0 +1,170 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>CSSOM.js parse method</title>
+ <script>
+ var exports = {};
+ function require(){
+ return exports;
+ }
+ </script>
+ <script src="../lib/CSSStyleDeclaration.js"></script>
+ <script src="../lib/CSSRule.js"></script>
+ <script src="../lib/CSSStyleRule.js"></script>
+ <script src="../lib/CSSImportRule.js"></script>
+ <script src="../lib/MediaList.js"></script>
+ <script src="../lib/CSSMediaRule.js"></script>
+ <script src="../lib/StyleSheet.js"></script>
+ <script src="../lib/CSSStyleSheet.js"></script>
+ <script src="../lib/parse.js"></script>
+ <script>
+ window.CSSOM = exports;
+ </script>
+ <style type="text/css">
+ html, body {
+ background: #333;
+ color: #EEE;
+ font: 12px sans-serif;
+ margin: 0;
+ height: 100%;
+ }
+ body {
+ padding-bottom: 1.7em;