traceur-rb 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +2 -2
- data/lib/js/compile.js +7 -15
- data/lib/traceur.rb +2 -1
- data/lib/traceur/compilation_error.rb +27 -0
- data/lib/traceur/compiler.rb +4 -1
- data/lib/traceur/configuration.rb +1 -1
- data/lib/traceur/node/runner.rb +1 -1
- data/lib/traceur/version.rb +1 -1
- data/spec/examples/syntax_error.js +3 -0
- data/spec/integration/examples_spec.rb +6 -0
- data/vendor/node_modules/traceur/LICENSE +202 -0
- data/vendor/node_modules/traceur/README.md +5 -5
- data/vendor/node_modules/traceur/bin/traceur-runtime.js +1392 -623
- data/vendor/node_modules/traceur/bin/traceur.js +24749 -17990
- data/vendor/node_modules/traceur/node_modules/.bin/semver +2 -2
- data/vendor/node_modules/traceur/node_modules/commander/History.md +222 -0
- data/vendor/node_modules/traceur/node_modules/commander/Readme.md +127 -35
- data/vendor/node_modules/traceur/node_modules/commander/index.js +261 -93
- data/vendor/node_modules/traceur/node_modules/commander/package.json +41 -9
- data/vendor/node_modules/traceur/node_modules/glob/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/README.md +357 -0
- data/vendor/node_modules/traceur/node_modules/glob/common.js +177 -0
- data/vendor/node_modules/traceur/node_modules/glob/glob.js +649 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/.eslintrc +17 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/README.md +37 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/inflight.js +44 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md +36 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json +34 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js +51 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js +33 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/package.json +61 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/test.js +97 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/LICENSE +16 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/README.md +42 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/inherits.js +1 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/inherits_browser.js +23 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/package.json +33 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/test.js +25 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/.npmignore +1 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/.travis.yml +4 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/LICENSE +23 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/README.md +216 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/benchmark.js +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/browser.js +1181 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/minimatch.js +845 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore +2 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml +3 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +121 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js +8 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +191 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +2 -0
- data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/collections → glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match}/.travis.yml +0 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +6 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +80 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +5 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +38 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +73 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +56 -0
- data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/url2 → glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map}/.travis.yml +1 -1
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE +18 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown +62 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js +6 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js +13 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +83 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js +39 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +75 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js +32 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt +1075 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt +182 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js +9 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js +10 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh +24 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js +16 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js +10 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js +13 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js +7 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js +50 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/package.json +60 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/basic.js +399 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/brace-expand.js +45 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/defaults.js +274 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/extglob-ending-with-state-char.js +8 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/LICENSE +27 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/README.md +51 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/README.md +36 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/package.json +34 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js +51 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js +33 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/once.js +21 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/package.json +42 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/test/once.js +23 -0
- data/vendor/node_modules/traceur/node_modules/glob/package.json +72 -0
- data/vendor/node_modules/traceur/node_modules/glob/sync.js +409 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/.release.json +17 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/CHANGELOG.md +165 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/LICENSE +19 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/README.md +364 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/dist/rsvp.js +1671 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/dist/rsvp.min.js +9 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp.js +66 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp.umd.js +50 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/-internal.js +265 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/all-settled.js +71 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/all.js +15 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/asap.js +109 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/config.js +28 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/defer.js +45 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/enumerator.js +125 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/events.js +201 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/filter.js +120 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash-settled.js +124 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash.js +94 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/instrument.js +41 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/map.js +99 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/node.js +281 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise-hash.js +51 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise.js +496 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/all.js +52 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/race.js +105 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/reject.js +47 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/resolve.js +49 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/race.js +15 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/reject.js +16 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/resolve.js +17 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/rethrow.js +46 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/utils.js +39 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/package.json +100 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/README.md +9 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/bower.json +22 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/composer.json +18 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/package.json +52 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.amd.js +1607 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.js +1566 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.min.js +26 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/vertx.js +1 -0
- data/vendor/node_modules/traceur/node_modules/semver/bin/semver +2 -2
- data/vendor/node_modules/traceur/node_modules/semver/package.json +4 -3
- data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js +7 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js.gz +0 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.js +7 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.min.js +1 -1
- data/vendor/node_modules/traceur/node_modules/semver/semver.min.js.gz +0 -0
- data/vendor/node_modules/traceur/node_modules/semver/test/index.js +8 -4
- data/vendor/node_modules/traceur/node_modules/semver/test/ltr.js +2 -1
- data/vendor/node_modules/traceur/node_modules/source-map-support/.npmignore +1 -0
- data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/mime/LICENSE → source-map-support/LICENSE.md} +7 -5
- data/vendor/node_modules/traceur/node_modules/source-map-support/README.md +165 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/browser-source-map-support.js +89 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/index.html +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/require.js +36 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.coffee +13 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.js +24 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.map +10 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-source-map-support.js +89 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/index.html +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.coffee +12 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.js +25 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.map +10 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/build.js +69 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/index.html +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.coffee +12 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.js +25 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.map +10 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/server.js +45 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/.npmignore +2 -0
- data/vendor/node_modules/traceur/node_modules/{q-io → source-map-support/node_modules/source-map}/.travis.yml +1 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/CHANGELOG.md +121 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/LICENSE +28 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/Makefile.dryice.js +166 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/README.md +434 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/assert-shim.js +56 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/mini-require.js +152 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-source-map.jsm +20 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-utils.jsm +18 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-browser.js +8 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-source-map.jsm +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-utils.jsm +21 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/test-prefix.js +8 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/test-suffix.js +3 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map.js +8 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/array-set.js +97 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64-vlq.js +144 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64.js +42 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/binary-search.js +81 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-consumer.js +478 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-generator.js +380 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-node.js +371 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/util.js +205 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/README.md +171 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/amdefine.js +299 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/intercept.js +36 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/package.json +37 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/package.json +142 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/run-tests.js +62 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-api.js +26 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-array-set.js +104 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64-vlq.js +24 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64.js +35 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-binary-search.js +54 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-dog-fooding.js +72 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-consumer.js +451 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-generator.js +417 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-node.js +365 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/util.js +161 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/package.json +52 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/source-map-support.js +381 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/test.js +359 -0
- data/vendor/node_modules/traceur/package.json +234 -20
- data/vendor/node_modules/traceur/src/node/NodeCompiler.js +78 -0
- data/vendor/node_modules/traceur/src/node/System.js +32 -5
- data/vendor/node_modules/traceur/src/node/api.js +28 -93
- data/vendor/node_modules/traceur/src/node/command.js +84 -19
- data/vendor/node_modules/traceur/src/node/compileAllJsFilesInDir.js +40 -0
- data/vendor/node_modules/traceur/src/node/interpreter.js +11 -8
- data/vendor/node_modules/traceur/src/node/recursiveModuleCompile.js +171 -0
- data/vendor/node_modules/traceur/src/node/require.js +7 -21
- data/vendor/node_modules/traceur/src/node/to-amd-compiler.js +2 -7
- data/vendor/node_modules/traceur/src/node/to-closure-compiler.js +28 -0
- data/vendor/node_modules/traceur/src/node/to-commonjs-compiler.js +3 -7
- data/vendor/node_modules/traceur/src/node/traceur.js +1 -1
- metadata +196 -190
- data/vendor/node_modules/traceur/node_modules/q-io/.npmignore +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/CHANGES.md +0 -122
- data/vendor/node_modules/traceur/node_modules/q-io/LICENSE +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/README.md +0 -928
- data/vendor/node_modules/traceur/node_modules/q-io/buffer-stream.js +0 -59
- data/vendor/node_modules/traceur/node_modules/q-io/coverage-report.js +0 -44
- data/vendor/node_modules/traceur/node_modules/q-io/deprecate.js +0 -51
- data/vendor/node_modules/traceur/node_modules/q-io/fs-boot.js +0 -307
- data/vendor/node_modules/traceur/node_modules/q-io/fs-common.js +0 -499
- data/vendor/node_modules/traceur/node_modules/q-io/fs-mock.js +0 -547
- data/vendor/node_modules/traceur/node_modules/q-io/fs-root.js +0 -105
- data/vendor/node_modules/traceur/node_modules/q-io/fs.js +0 -355
- data/vendor/node_modules/traceur/node_modules/q-io/fs2http.js +0 -65
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps.js +0 -152
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/chain.js +0 -24
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/content.js +0 -93
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/cookie.js +0 -154
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/decorators.js +0 -178
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/fs.js +0 -417
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/html.js +0 -58
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/json.js +0 -78
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/negotiate.js +0 -120
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/proxy.js +0 -27
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/redirect.js +0 -209
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/route.js +0 -125
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/status.js +0 -175
- data/vendor/node_modules/traceur/node_modules/q-io/http-cookie.js +0 -75
- data/vendor/node_modules/traceur/node_modules/q-io/http.js +0 -378
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/.npmignore +0 -11
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/CHANGES.md +0 -78
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/LICENSE.md +0 -21
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/README.md +0 -1285
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/collections.js +0 -22
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/dict.js +0 -142
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-map.js +0 -57
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-set.js +0 -183
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-collection.js +0 -261
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-map.js +0 -186
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-order.js +0 -55
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-set.js +0 -59
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/heap.js +0 -236
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/iterator.js +0 -371
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/list.js +0 -435
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/array-changes.js +0 -247
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/map-changes.js +0 -147
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/property-changes.js +0 -448
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/range-changes.js +0 -139
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-map.js +0 -79
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-set.js +0 -142
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/map.js +0 -60
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/multi-map.js +0 -41
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/package.json +0 -12
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync +0 -7
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync.patch +0 -48
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/weak-map.js +0 -590
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/package.json +0 -49
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/set.js +0 -173
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-array.js +0 -274
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-function.js +0 -59
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-object.js +0 -538
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-regexp.js +0 -14
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim.js +0 -6
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-map.js +0 -49
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-set.js +0 -51
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array.js +0 -269
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-map.js +0 -61
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-set.js +0 -736
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/tree-log.js +0 -40
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/weak-map.js +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/README.md +0 -66
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/mime.js +0 -114
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/package.json +0 -35
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/test.js +0 -84
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/mime.types +0 -1588
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/node.types +0 -77
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/CHANGES +0 -15
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/LICENSE +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/README +0 -96
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/lib/mimeparse.js +0 -166
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/package.json +0 -43
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/CONTRIBUTING.md +0 -40
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/LICENSE +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/README.md +0 -813
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/compare-with-callbacks.js +0 -71
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/scenarios.js +0 -36
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/package.json +0 -93
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/q.js +0 -1937
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/queue.js +0 -35
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/.gitmodules +0 -6
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/History.md +0 -36
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Makefile +0 -7
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Readme.md +0 -38
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/benchmark.js +0 -32
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/examples.js +0 -39
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/index.js +0 -2
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/lib/querystring.js +0 -123
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/package.json +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.gitmodules +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.npmignore +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/History.md +0 -128
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Makefile +0 -53
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Readme.md +0 -61
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/bin/expresso +0 -856
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/api.html +0 -1080
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.html +0 -377
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.md +0 -290
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/foot.html +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/head.html +0 -42
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/bar.js +0 -4
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/foo.js +0 -16
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/package.json +0 -12
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/assert.test.js +0 -91
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/async.test.js +0 -12
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/bar.test.js +0 -13
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/foo.test.js +0 -14
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/http.test.js +0 -146
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/async.test.js +0 -39
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/http.test.js +0 -48
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/.gitmodules +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/History.md +0 -22
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Makefile +0 -6
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Readme.md +0 -248
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/examples/runner.js +0 -53
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/index.js +0 -2
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/eql.js +0 -91
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/should.js +0 -548
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/package.json +0 -8
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/test/should.test.js +0 -358
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/test/querystring.test.js +0 -133
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/.npmignore +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/LICENSE.md +0 -20
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/README.md +0 -33
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/package.json +0 -37
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/test/url2-spec.js +0 -125
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/url2.js +0 -151
- data/vendor/node_modules/traceur/node_modules/q-io/package.json +0 -51
- data/vendor/node_modules/traceur/node_modules/q-io/reader.js +0 -133
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/boot-directory-spec.js +0 -47
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/contains-spec.js +0 -11
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/fixtures/hello.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/issues/1-spec.js +0 -33
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/make-tree-spec.js +0 -92
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/append-spec.js +0 -41
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/copy-tree-spec.js +0 -57
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/fixture/hello.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/link-spec.js +0 -70
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/make-tree-spec.js +0 -109
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/merge-spec.js +0 -67
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/move-spec.js +0 -219
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/object-spec.js +0 -20
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/range-spec.js +0 -26
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/read-spec.js +0 -40
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-directory-spec.js +0 -37
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-tree-spec.js +0 -39
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/root-spec.js +0 -32
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/stat-spec.js +0 -26
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/symbolic-link-spec.js +0 -86
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/working-directory-spec.js +0 -31
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/write-spec.js +0 -73
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.js +0 -23
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/read-spec.js +0 -22
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/relative-spec.js +0 -25
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/reroot-spec.js +0 -45
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/write-spec.js +0 -38
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/cookie-spec.js +0 -52
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/directory-list-spec.js +0 -86
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/01234.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/1234.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/5678.txt +0 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/9012/3456.txt +0 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/hosts-spec.js +0 -49
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/interpret-range-spec.js +0 -47
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/partial-range-spec.js +0 -186
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/proxy-spec.js +0 -82
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/symbolic-link-spec.js +0 -110
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http/agent-spec.js +0 -96
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http/basic-spec.js +0 -96
- data/vendor/node_modules/traceur/node_modules/q-io/spec/lib/jasmine-promise.js +0 -42
- data/vendor/node_modules/traceur/node_modules/q-io/writer.js +0 -111
- data/vendor/node_modules/traceur/src/node/compile-single-file.js +0 -69
- data/vendor/node_modules/traceur/src/node/compiler.js +0 -116
- data/vendor/node_modules/traceur/src/node/inline-module.js +0 -149
@@ -1,12 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "weak-map",
|
3
|
-
"version": "1.0.0",
|
4
|
-
"main": "weak-map.js",
|
5
|
-
"readme": "ERROR: No README data found!",
|
6
|
-
"_id": "weak-map@1.0.0",
|
7
|
-
"dist": {
|
8
|
-
"shasum": "78b41fa948c0777ff8f41ad1cda10a37c22bad78"
|
9
|
-
},
|
10
|
-
"_from": "weak-map@1.0.0",
|
11
|
-
"_resolved": "https://registry.npmjs.org/weak-map/-/weak-map-1.0.0.tgz"
|
12
|
-
}
|
@@ -1,48 +0,0 @@
|
|
1
|
-
diff --git a/weak-map.js b/weak-map.js
|
2
|
-
index 9fa5d81..116ca05 100644
|
3
|
-
--- a/weak-map.js
|
4
|
-
+++ b/weak-map.js
|
5
|
-
@@ -77,7 +77,6 @@
|
6
|
-
* prevent access to this channel. (See
|
7
|
-
* PATCH_MUTABLE_FROZEN_WEAKMAP_PROTO in repairES5.js).
|
8
|
-
*/
|
9
|
-
-var WeakMap;
|
10
|
-
|
11
|
-
/**
|
12
|
-
* If this is a full <a href=
|
13
|
-
@@ -127,8 +126,8 @@ var WeakMap;
|
14
|
-
|
15
|
-
// Check if there is already a good-enough WeakMap implementation, and if so
|
16
|
-
// exit without replacing it.
|
17
|
-
- var HostWeakMap = WeakMap;
|
18
|
-
- if (typeof HostWeakMap === 'function') {
|
19
|
-
+ if (typeof WeakMap === 'function') {
|
20
|
-
+ var HostWeakMap = WeakMap;
|
21
|
-
// There is a WeakMap -- is it good enough?
|
22
|
-
if (typeof navigator !== 'undefined' &&
|
23
|
-
/Firefox/.test(navigator.userAgent)) {
|
24
|
-
@@ -150,6 +149,7 @@ var WeakMap;
|
25
|
-
|
26
|
-
// Fall through to installing our WeakMap.
|
27
|
-
} else {
|
28
|
-
+ module.exports = WeakMap;
|
29
|
-
return;
|
30
|
-
}
|
31
|
-
}
|
32
|
-
@@ -565,7 +565,7 @@ var WeakMap;
|
33
|
-
});
|
34
|
-
}
|
35
|
-
DoubleWeakMap.prototype = OurWeakMap.prototype;
|
36
|
-
- WeakMap = DoubleWeakMap;
|
37
|
-
+ module.exports = DoubleWeakMap;
|
38
|
-
|
39
|
-
// define .constructor to hide OurWeakMap ctor
|
40
|
-
Object.defineProperty(WeakMap.prototype, 'constructor', {
|
41
|
-
@@ -585,6 +585,6 @@ var WeakMap;
|
42
|
-
Proxy = undefined;
|
43
|
-
}
|
44
|
-
|
45
|
-
- WeakMap = OurWeakMap;
|
46
|
-
+ module.exports = OurWeakMap;
|
47
|
-
}
|
48
|
-
})();
|
@@ -1,590 +0,0 @@
|
|
1
|
-
// Copyright (C) 2011 Google Inc.
|
2
|
-
//
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
// you may not use this file except in compliance with the License.
|
5
|
-
// You may obtain a copy of the License at
|
6
|
-
//
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
//
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
// See the License for the specific language governing permissions and
|
13
|
-
// limitations under the License.
|
14
|
-
|
15
|
-
/**
|
16
|
-
* @fileoverview Install a leaky WeakMap emulation on platforms that
|
17
|
-
* don't provide a built-in one.
|
18
|
-
*
|
19
|
-
* <p>Assumes that an ES5 platform where, if {@code WeakMap} is
|
20
|
-
* already present, then it conforms to the anticipated ES6
|
21
|
-
* specification. To run this file on an ES5 or almost ES5
|
22
|
-
* implementation where the {@code WeakMap} specification does not
|
23
|
-
* quite conform, run <code>repairES5.js</code> first.
|
24
|
-
*
|
25
|
-
* <p> Even though WeakMapModule is not global, the linter thinks it
|
26
|
-
* is, which is why it is in the overrides list below.
|
27
|
-
*
|
28
|
-
* @author Mark S. Miller
|
29
|
-
* @requires crypto, ArrayBuffer, Uint8Array, navigator
|
30
|
-
* @overrides WeakMap, ses, Proxy
|
31
|
-
* @overrides WeakMapModule
|
32
|
-
*/
|
33
|
-
|
34
|
-
/**
|
35
|
-
* This {@code WeakMap} emulation is observably equivalent to the
|
36
|
-
* ES-Harmony WeakMap, but with leakier garbage collection properties.
|
37
|
-
*
|
38
|
-
* <p>As with true WeakMaps, in this emulation, a key does not
|
39
|
-
* retain maps indexed by that key and (crucially) a map does not
|
40
|
-
* retain the keys it indexes. A map by itself also does not retain
|
41
|
-
* the values associated with that map.
|
42
|
-
*
|
43
|
-
* <p>However, the values associated with a key in some map are
|
44
|
-
* retained so long as that key is retained and those associations are
|
45
|
-
* not overridden. For example, when used to support membranes, all
|
46
|
-
* values exported from a given membrane will live for the lifetime
|
47
|
-
* they would have had in the absence of an interposed membrane. Even
|
48
|
-
* when the membrane is revoked, all objects that would have been
|
49
|
-
* reachable in the absence of revocation will still be reachable, as
|
50
|
-
* far as the GC can tell, even though they will no longer be relevant
|
51
|
-
* to ongoing computation.
|
52
|
-
*
|
53
|
-
* <p>The API implemented here is approximately the API as implemented
|
54
|
-
* in FF6.0a1 and agreed to by MarkM, Andreas Gal, and Dave Herman,
|
55
|
-
* rather than the offially approved proposal page. TODO(erights):
|
56
|
-
* upgrade the ecmascript WeakMap proposal page to explain this API
|
57
|
-
* change and present to EcmaScript committee for their approval.
|
58
|
-
*
|
59
|
-
* <p>The first difference between the emulation here and that in
|
60
|
-
* FF6.0a1 is the presence of non enumerable {@code get___, has___,
|
61
|
-
* set___, and delete___} methods on WeakMap instances to represent
|
62
|
-
* what would be the hidden internal properties of a primitive
|
63
|
-
* implementation. Whereas the FF6.0a1 WeakMap.prototype methods
|
64
|
-
* require their {@code this} to be a genuine WeakMap instance (i.e.,
|
65
|
-
* an object of {@code [[Class]]} "WeakMap}), since there is nothing
|
66
|
-
* unforgeable about the pseudo-internal method names used here,
|
67
|
-
* nothing prevents these emulated prototype methods from being
|
68
|
-
* applied to non-WeakMaps with pseudo-internal methods of the same
|
69
|
-
* names.
|
70
|
-
*
|
71
|
-
* <p>Another difference is that our emulated {@code
|
72
|
-
* WeakMap.prototype} is not itself a WeakMap. A problem with the
|
73
|
-
* current FF6.0a1 API is that WeakMap.prototype is itself a WeakMap
|
74
|
-
* providing ambient mutability and an ambient communications
|
75
|
-
* channel. Thus, if a WeakMap is already present and has this
|
76
|
-
* problem, repairES5.js wraps it in a safe wrappper in order to
|
77
|
-
* prevent access to this channel. (See
|
78
|
-
* PATCH_MUTABLE_FROZEN_WEAKMAP_PROTO in repairES5.js).
|
79
|
-
*/
|
80
|
-
|
81
|
-
/**
|
82
|
-
* If this is a full <a href=
|
83
|
-
* "http://code.google.com/p/es-lab/wiki/SecureableES5"
|
84
|
-
* >secureable ES5</a> platform and the ES-Harmony {@code WeakMap} is
|
85
|
-
* absent, install an approximate emulation.
|
86
|
-
*
|
87
|
-
* <p>If WeakMap is present but cannot store some objects, use our approximate
|
88
|
-
* emulation as a wrapper.
|
89
|
-
*
|
90
|
-
* <p>If this is almost a secureable ES5 platform, then WeakMap.js
|
91
|
-
* should be run after repairES5.js.
|
92
|
-
*
|
93
|
-
* <p>See {@code WeakMap} for documentation of the garbage collection
|
94
|
-
* properties of this WeakMap emulation.
|
95
|
-
*/
|
96
|
-
(function WeakMapModule() {
|
97
|
-
"use strict";
|
98
|
-
|
99
|
-
if (typeof ses !== 'undefined' && ses.ok && !ses.ok()) {
|
100
|
-
// already too broken, so give up
|
101
|
-
return;
|
102
|
-
}
|
103
|
-
|
104
|
-
/**
|
105
|
-
* In some cases (current Firefox), we must make a choice betweeen a
|
106
|
-
* WeakMap which is capable of using all varieties of host objects as
|
107
|
-
* keys and one which is capable of safely using proxies as keys. See
|
108
|
-
* comments below about HostWeakMap and DoubleWeakMap for details.
|
109
|
-
*
|
110
|
-
* This function (which is a global, not exposed to guests) marks a
|
111
|
-
* WeakMap as permitted to do what is necessary to index all host
|
112
|
-
* objects, at the cost of making it unsafe for proxies.
|
113
|
-
*
|
114
|
-
* Do not apply this function to anything which is not a genuine
|
115
|
-
* fresh WeakMap.
|
116
|
-
*/
|
117
|
-
function weakMapPermitHostObjects(map) {
|
118
|
-
// identity of function used as a secret -- good enough and cheap
|
119
|
-
if (map.permitHostObjects___) {
|
120
|
-
map.permitHostObjects___(weakMapPermitHostObjects);
|
121
|
-
}
|
122
|
-
}
|
123
|
-
if (typeof ses !== 'undefined') {
|
124
|
-
ses.weakMapPermitHostObjects = weakMapPermitHostObjects;
|
125
|
-
}
|
126
|
-
|
127
|
-
// Check if there is already a good-enough WeakMap implementation, and if so
|
128
|
-
// exit without replacing it.
|
129
|
-
if (typeof WeakMap === 'function') {
|
130
|
-
var HostWeakMap = WeakMap;
|
131
|
-
// There is a WeakMap -- is it good enough?
|
132
|
-
if (typeof navigator !== 'undefined' &&
|
133
|
-
/Firefox/.test(navigator.userAgent)) {
|
134
|
-
// We're now *assuming not*, because as of this writing (2013-05-06)
|
135
|
-
// Firefox's WeakMaps have a miscellany of objects they won't accept, and
|
136
|
-
// we don't want to make an exhaustive list, and testing for just one
|
137
|
-
// will be a problem if that one is fixed alone (as they did for Event).
|
138
|
-
|
139
|
-
// If there is a platform that we *can* reliably test on, here's how to
|
140
|
-
// do it:
|
141
|
-
// var problematic = ... ;
|
142
|
-
// var testHostMap = new HostWeakMap();
|
143
|
-
// try {
|
144
|
-
// testHostMap.set(problematic, 1); // Firefox 20 will throw here
|
145
|
-
// if (testHostMap.get(problematic) === 1) {
|
146
|
-
// return;
|
147
|
-
// }
|
148
|
-
// } catch (e) {}
|
149
|
-
|
150
|
-
// Fall through to installing our WeakMap.
|
151
|
-
} else {
|
152
|
-
module.exports = WeakMap;
|
153
|
-
return;
|
154
|
-
}
|
155
|
-
}
|
156
|
-
|
157
|
-
var hop = Object.prototype.hasOwnProperty;
|
158
|
-
var gopn = Object.getOwnPropertyNames;
|
159
|
-
var defProp = Object.defineProperty;
|
160
|
-
var isExtensible = Object.isExtensible;
|
161
|
-
|
162
|
-
/**
|
163
|
-
* Security depends on HIDDEN_NAME being both <i>unguessable</i> and
|
164
|
-
* <i>undiscoverable</i> by untrusted code.
|
165
|
-
*
|
166
|
-
* <p>Given the known weaknesses of Math.random() on existing
|
167
|
-
* browsers, it does not generate unguessability we can be confident
|
168
|
-
* of.
|
169
|
-
*
|
170
|
-
* <p>It is the monkey patching logic in this file that is intended
|
171
|
-
* to ensure undiscoverability. The basic idea is that there are
|
172
|
-
* three fundamental means of discovering properties of an object:
|
173
|
-
* The for/in loop, Object.keys(), and Object.getOwnPropertyNames(),
|
174
|
-
* as well as some proposed ES6 extensions that appear on our
|
175
|
-
* whitelist. The first two only discover enumerable properties, and
|
176
|
-
* we only use HIDDEN_NAME to name a non-enumerable property, so the
|
177
|
-
* only remaining threat should be getOwnPropertyNames and some
|
178
|
-
* proposed ES6 extensions that appear on our whitelist. We monkey
|
179
|
-
* patch them to remove HIDDEN_NAME from the list of properties they
|
180
|
-
* returns.
|
181
|
-
*
|
182
|
-
* <p>TODO(erights): On a platform with built-in Proxies, proxies
|
183
|
-
* could be used to trap and thereby discover the HIDDEN_NAME, so we
|
184
|
-
* need to monkey patch Proxy.create, Proxy.createFunction, etc, in
|
185
|
-
* order to wrap the provided handler with the real handler which
|
186
|
-
* filters out all traps using HIDDEN_NAME.
|
187
|
-
*
|
188
|
-
* <p>TODO(erights): Revisit Mike Stay's suggestion that we use an
|
189
|
-
* encapsulated function at a not-necessarily-secret name, which
|
190
|
-
* uses the Stiegler shared-state rights amplification pattern to
|
191
|
-
* reveal the associated value only to the WeakMap in which this key
|
192
|
-
* is associated with that value. Since only the key retains the
|
193
|
-
* function, the function can also remember the key without causing
|
194
|
-
* leakage of the key, so this doesn't violate our general gc
|
195
|
-
* goals. In addition, because the name need not be a guarded
|
196
|
-
* secret, we could efficiently handle cross-frame frozen keys.
|
197
|
-
*/
|
198
|
-
var HIDDEN_NAME_PREFIX = 'weakmap:';
|
199
|
-
var HIDDEN_NAME = HIDDEN_NAME_PREFIX + 'ident:' + Math.random() + '___';
|
200
|
-
|
201
|
-
if (typeof crypto !== 'undefined' &&
|
202
|
-
typeof crypto.getRandomValues === 'function' &&
|
203
|
-
typeof ArrayBuffer === 'function' &&
|
204
|
-
typeof Uint8Array === 'function') {
|
205
|
-
var ab = new ArrayBuffer(25);
|
206
|
-
var u8s = new Uint8Array(ab);
|
207
|
-
crypto.getRandomValues(u8s);
|
208
|
-
HIDDEN_NAME = HIDDEN_NAME_PREFIX + 'rand:' +
|
209
|
-
Array.prototype.map.call(u8s, function(u8) {
|
210
|
-
return (u8 % 36).toString(36);
|
211
|
-
}).join('') + '___';
|
212
|
-
}
|
213
|
-
|
214
|
-
function isNotHiddenName(name) {
|
215
|
-
return !(
|
216
|
-
name.substr(0, HIDDEN_NAME_PREFIX.length) == HIDDEN_NAME_PREFIX &&
|
217
|
-
name.substr(name.length - 3) === '___');
|
218
|
-
}
|
219
|
-
|
220
|
-
/**
|
221
|
-
* Monkey patch getOwnPropertyNames to avoid revealing the
|
222
|
-
* HIDDEN_NAME.
|
223
|
-
*
|
224
|
-
* <p>The ES5.1 spec requires each name to appear only once, but as
|
225
|
-
* of this writing, this requirement is controversial for ES6, so we
|
226
|
-
* made this code robust against this case. If the resulting extra
|
227
|
-
* search turns out to be expensive, we can probably relax this once
|
228
|
-
* ES6 is adequately supported on all major browsers, iff no browser
|
229
|
-
* versions we support at that time have relaxed this constraint
|
230
|
-
* without providing built-in ES6 WeakMaps.
|
231
|
-
*/
|
232
|
-
defProp(Object, 'getOwnPropertyNames', {
|
233
|
-
value: function fakeGetOwnPropertyNames(obj) {
|
234
|
-
return gopn(obj).filter(isNotHiddenName);
|
235
|
-
}
|
236
|
-
});
|
237
|
-
|
238
|
-
/**
|
239
|
-
* getPropertyNames is not in ES5 but it is proposed for ES6 and
|
240
|
-
* does appear in our whitelist, so we need to clean it too.
|
241
|
-
*/
|
242
|
-
if ('getPropertyNames' in Object) {
|
243
|
-
var originalGetPropertyNames = Object.getPropertyNames;
|
244
|
-
defProp(Object, 'getPropertyNames', {
|
245
|
-
value: function fakeGetPropertyNames(obj) {
|
246
|
-
return originalGetPropertyNames(obj).filter(isNotHiddenName);
|
247
|
-
}
|
248
|
-
});
|
249
|
-
}
|
250
|
-
|
251
|
-
/**
|
252
|
-
* <p>To treat objects as identity-keys with reasonable efficiency
|
253
|
-
* on ES5 by itself (i.e., without any object-keyed collections), we
|
254
|
-
* need to add a hidden property to such key objects when we
|
255
|
-
* can. This raises several issues:
|
256
|
-
* <ul>
|
257
|
-
* <li>Arranging to add this property to objects before we lose the
|
258
|
-
* chance, and
|
259
|
-
* <li>Hiding the existence of this new property from most
|
260
|
-
* JavaScript code.
|
261
|
-
* <li>Preventing <i>certification theft</i>, where one object is
|
262
|
-
* created falsely claiming to be the key of an association
|
263
|
-
* actually keyed by another object.
|
264
|
-
* <li>Preventing <i>value theft</i>, where untrusted code with
|
265
|
-
* access to a key object but not a weak map nevertheless
|
266
|
-
* obtains access to the value associated with that key in that
|
267
|
-
* weak map.
|
268
|
-
* </ul>
|
269
|
-
* We do so by
|
270
|
-
* <ul>
|
271
|
-
* <li>Making the name of the hidden property unguessable, so "[]"
|
272
|
-
* indexing, which we cannot intercept, cannot be used to access
|
273
|
-
* a property without knowing the name.
|
274
|
-
* <li>Making the hidden property non-enumerable, so we need not
|
275
|
-
* worry about for-in loops or {@code Object.keys},
|
276
|
-
* <li>monkey patching those reflective methods that would
|
277
|
-
* prevent extensions, to add this hidden property first,
|
278
|
-
* <li>monkey patching those methods that would reveal this
|
279
|
-
* hidden property.
|
280
|
-
* </ul>
|
281
|
-
* Unfortunately, because of same-origin iframes, we cannot reliably
|
282
|
-
* add this hidden property before an object becomes
|
283
|
-
* non-extensible. Instead, if we encounter a non-extensible object
|
284
|
-
* without a hidden record that we can detect (whether or not it has
|
285
|
-
* a hidden record stored under a name secret to us), then we just
|
286
|
-
* use the key object itself to represent its identity in a brute
|
287
|
-
* force leaky map stored in the weak map, losing all the advantages
|
288
|
-
* of weakness for these.
|
289
|
-
*/
|
290
|
-
function getHiddenRecord(key) {
|
291
|
-
if (key !== Object(key)) {
|
292
|
-
throw new TypeError('Not an object: ' + key);
|
293
|
-
}
|
294
|
-
var hiddenRecord = key[HIDDEN_NAME];
|
295
|
-
if (hiddenRecord && hiddenRecord.key === key) { return hiddenRecord; }
|
296
|
-
if (!isExtensible(key)) {
|
297
|
-
// Weak map must brute force, as explained in doc-comment above.
|
298
|
-
return void 0;
|
299
|
-
}
|
300
|
-
var gets = [];
|
301
|
-
var vals = [];
|
302
|
-
hiddenRecord = {
|
303
|
-
key: key, // self pointer for quick own check above.
|
304
|
-
gets: gets, // get___ methods identifying weak maps
|
305
|
-
vals: vals // values associated with this key in each
|
306
|
-
// corresponding weak map.
|
307
|
-
};
|
308
|
-
defProp(key, HIDDEN_NAME, {
|
309
|
-
value: hiddenRecord,
|
310
|
-
writable: false,
|
311
|
-
enumerable: false,
|
312
|
-
configurable: false
|
313
|
-
});
|
314
|
-
return hiddenRecord;
|
315
|
-
}
|
316
|
-
|
317
|
-
|
318
|
-
/**
|
319
|
-
* Monkey patch operations that would make their argument
|
320
|
-
* non-extensible.
|
321
|
-
*
|
322
|
-
* <p>The monkey patched versions throw a TypeError if their
|
323
|
-
* argument is not an object, so it should only be done to functions
|
324
|
-
* that should throw a TypeError anyway if their argument is not an
|
325
|
-
* object.
|
326
|
-
*/
|
327
|
-
(function(){
|
328
|
-
var oldFreeze = Object.freeze;
|
329
|
-
defProp(Object, 'freeze', {
|
330
|
-
value: function identifyingFreeze(obj) {
|
331
|
-
getHiddenRecord(obj);
|
332
|
-
return oldFreeze(obj);
|
333
|
-
}
|
334
|
-
});
|
335
|
-
var oldSeal = Object.seal;
|
336
|
-
defProp(Object, 'seal', {
|
337
|
-
value: function identifyingSeal(obj) {
|
338
|
-
getHiddenRecord(obj);
|
339
|
-
return oldSeal(obj);
|
340
|
-
}
|
341
|
-
});
|
342
|
-
var oldPreventExtensions = Object.preventExtensions;
|
343
|
-
defProp(Object, 'preventExtensions', {
|
344
|
-
value: function identifyingPreventExtensions(obj) {
|
345
|
-
getHiddenRecord(obj);
|
346
|
-
return oldPreventExtensions(obj);
|
347
|
-
}
|
348
|
-
});
|
349
|
-
})();
|
350
|
-
|
351
|
-
|
352
|
-
function constFunc(func) {
|
353
|
-
func.prototype = null;
|
354
|
-
return Object.freeze(func);
|
355
|
-
}
|
356
|
-
|
357
|
-
// Right now (12/25/2012) the histogram supports the current
|
358
|
-
// representation. We should check this occasionally, as a true
|
359
|
-
// constant time representation is easy.
|
360
|
-
// var histogram = [];
|
361
|
-
|
362
|
-
var OurWeakMap = function() {
|
363
|
-
// We are currently (12/25/2012) never encountering any prematurely
|
364
|
-
// non-extensible keys.
|
365
|
-
var keys = []; // brute force for prematurely non-extensible keys.
|
366
|
-
var vals = []; // brute force for corresponding values.
|
367
|
-
|
368
|
-
function get___(key, opt_default) {
|
369
|
-
var hr = getHiddenRecord(key);
|
370
|
-
var i, vs;
|
371
|
-
if (hr) {
|
372
|
-
i = hr.gets.indexOf(get___);
|
373
|
-
vs = hr.vals;
|
374
|
-
} else {
|
375
|
-
i = keys.indexOf(key);
|
376
|
-
vs = vals;
|
377
|
-
}
|
378
|
-
return (i >= 0) ? vs[i] : opt_default;
|
379
|
-
}
|
380
|
-
|
381
|
-
function has___(key) {
|
382
|
-
var hr = getHiddenRecord(key);
|
383
|
-
var i;
|
384
|
-
if (hr) {
|
385
|
-
i = hr.gets.indexOf(get___);
|
386
|
-
} else {
|
387
|
-
i = keys.indexOf(key);
|
388
|
-
}
|
389
|
-
return i >= 0;
|
390
|
-
}
|
391
|
-
|
392
|
-
function set___(key, value) {
|
393
|
-
var hr = getHiddenRecord(key);
|
394
|
-
var i;
|
395
|
-
if (hr) {
|
396
|
-
i = hr.gets.indexOf(get___);
|
397
|
-
if (i >= 0) {
|
398
|
-
hr.vals[i] = value;
|
399
|
-
} else {
|
400
|
-
// i = hr.gets.length;
|
401
|
-
// histogram[i] = (histogram[i] || 0) + 1;
|
402
|
-
hr.gets.push(get___);
|
403
|
-
hr.vals.push(value);
|
404
|
-
}
|
405
|
-
} else {
|
406
|
-
i = keys.indexOf(key);
|
407
|
-
if (i >= 0) {
|
408
|
-
vals[i] = value;
|
409
|
-
} else {
|
410
|
-
keys.push(key);
|
411
|
-
vals.push(value);
|
412
|
-
}
|
413
|
-
}
|
414
|
-
}
|
415
|
-
|
416
|
-
function delete___(key) {
|
417
|
-
var hr = getHiddenRecord(key);
|
418
|
-
var i;
|
419
|
-
if (hr) {
|
420
|
-
i = hr.gets.indexOf(get___);
|
421
|
-
if (i >= 0) {
|
422
|
-
hr.gets.splice(i, 1);
|
423
|
-
hr.vals.splice(i, 1);
|
424
|
-
}
|
425
|
-
} else {
|
426
|
-
i = keys.indexOf(key);
|
427
|
-
if (i >= 0) {
|
428
|
-
keys.splice(i, 1);
|
429
|
-
vals.splice(i, 1);
|
430
|
-
}
|
431
|
-
}
|
432
|
-
return true;
|
433
|
-
}
|
434
|
-
|
435
|
-
return Object.create(OurWeakMap.prototype, {
|
436
|
-
get___: { value: constFunc(get___) },
|
437
|
-
has___: { value: constFunc(has___) },
|
438
|
-
set___: { value: constFunc(set___) },
|
439
|
-
delete___: { value: constFunc(delete___) }
|
440
|
-
});
|
441
|
-
};
|
442
|
-
OurWeakMap.prototype = Object.create(Object.prototype, {
|
443
|
-
get: {
|
444
|
-
/**
|
445
|
-
* Return the value most recently associated with key, or
|
446
|
-
* opt_default if none.
|
447
|
-
*/
|
448
|
-
value: function get(key, opt_default) {
|
449
|
-
return this.get___(key, opt_default);
|
450
|
-
},
|
451
|
-
writable: true,
|
452
|
-
configurable: true
|
453
|
-
},
|
454
|
-
|
455
|
-
has: {
|
456
|
-
/**
|
457
|
-
* Is there a value associated with key in this WeakMap?
|
458
|
-
*/
|
459
|
-
value: function has(key) {
|
460
|
-
return this.has___(key);
|
461
|
-
},
|
462
|
-
writable: true,
|
463
|
-
configurable: true
|
464
|
-
},
|
465
|
-
|
466
|
-
set: {
|
467
|
-
/**
|
468
|
-
* Associate value with key in this WeakMap, overwriting any
|
469
|
-
* previous association if present.
|
470
|
-
*/
|
471
|
-
value: function set(key, value) {
|
472
|
-
this.set___(key, value);
|
473
|
-
},
|
474
|
-
writable: true,
|
475
|
-
configurable: true
|
476
|
-
},
|
477
|
-
|
478
|
-
'delete': {
|
479
|
-
/**
|
480
|
-
* Remove any association for key in this WeakMap, returning
|
481
|
-
* whether there was one.
|
482
|
-
*
|
483
|
-
* <p>Note that the boolean return here does not work like the
|
484
|
-
* {@code delete} operator. The {@code delete} operator returns
|
485
|
-
* whether the deletion succeeds at bringing about a state in
|
486
|
-
* which the deleted property is absent. The {@code delete}
|
487
|
-
* operator therefore returns true if the property was already
|
488
|
-
* absent, whereas this {@code delete} method returns false if
|
489
|
-
* the association was already absent.
|
490
|
-
*/
|
491
|
-
value: function remove(key) {
|
492
|
-
return this.delete___(key);
|
493
|
-
},
|
494
|
-
writable: true,
|
495
|
-
configurable: true
|
496
|
-
}
|
497
|
-
});
|
498
|
-
|
499
|
-
if (typeof HostWeakMap === 'function') {
|
500
|
-
(function() {
|
501
|
-
// If we got here, then the platform has a WeakMap but we are concerned
|
502
|
-
// that it may refuse to store some key types. Therefore, make a map
|
503
|
-
// implementation which makes use of both as possible.
|
504
|
-
|
505
|
-
function DoubleWeakMap() {
|
506
|
-
// Preferable, truly weak map.
|
507
|
-
var hmap = new HostWeakMap();
|
508
|
-
|
509
|
-
// Our hidden-property-based pseudo-weak-map. Lazily initialized in the
|
510
|
-
// 'set' implementation; thus we can avoid performing extra lookups if
|
511
|
-
// we know all entries actually stored are entered in 'hmap'.
|
512
|
-
var omap = undefined;
|
513
|
-
|
514
|
-
// Hidden-property maps are not compatible with proxies because proxies
|
515
|
-
// can observe the hidden name and either accidentally expose it or fail
|
516
|
-
// to allow the hidden property to be set. Therefore, we do not allow
|
517
|
-
// arbitrary WeakMaps to switch to using hidden properties, but only
|
518
|
-
// those which need the ability, and unprivileged code is not allowed
|
519
|
-
// to set the flag.
|
520
|
-
var enableSwitching = false;
|
521
|
-
|
522
|
-
function dget(key, opt_default) {
|
523
|
-
if (omap) {
|
524
|
-
return hmap.has(key) ? hmap.get(key)
|
525
|
-
: omap.get___(key, opt_default);
|
526
|
-
} else {
|
527
|
-
return hmap.get(key, opt_default);
|
528
|
-
}
|
529
|
-
}
|
530
|
-
|
531
|
-
function dhas(key) {
|
532
|
-
return hmap.has(key) || (omap ? omap.has___(key) : false);
|
533
|
-
}
|
534
|
-
|
535
|
-
function dset(key, value) {
|
536
|
-
if (enableSwitching) {
|
537
|
-
try {
|
538
|
-
hmap.set(key, value);
|
539
|
-
} catch (e) {
|
540
|
-
if (!omap) { omap = new OurWeakMap(); }
|
541
|
-
omap.set___(key, value);
|
542
|
-
}
|
543
|
-
} else {
|
544
|
-
hmap.set(key, value);
|
545
|
-
}
|
546
|
-
}
|
547
|
-
|
548
|
-
function ddelete(key) {
|
549
|
-
hmap['delete'](key);
|
550
|
-
if (omap) { omap.delete___(key); }
|
551
|
-
}
|
552
|
-
|
553
|
-
return Object.create(OurWeakMap.prototype, {
|
554
|
-
get___: { value: constFunc(dget) },
|
555
|
-
has___: { value: constFunc(dhas) },
|
556
|
-
set___: { value: constFunc(dset) },
|
557
|
-
delete___: { value: constFunc(ddelete) },
|
558
|
-
permitHostObjects___: { value: constFunc(function(token) {
|
559
|
-
if (token === weakMapPermitHostObjects) {
|
560
|
-
enableSwitching = true;
|
561
|
-
} else {
|
562
|
-
throw new Error('bogus call to permitHostObjects___');
|
563
|
-
}
|
564
|
-
})}
|
565
|
-
});
|
566
|
-
}
|
567
|
-
DoubleWeakMap.prototype = OurWeakMap.prototype;
|
568
|
-
module.exports = DoubleWeakMap;
|
569
|
-
|
570
|
-
// define .constructor to hide OurWeakMap ctor
|
571
|
-
Object.defineProperty(WeakMap.prototype, 'constructor', {
|
572
|
-
value: WeakMap,
|
573
|
-
enumerable: false, // as default .constructor is
|
574
|
-
configurable: true,
|
575
|
-
writable: true
|
576
|
-
});
|
577
|
-
})();
|
578
|
-
} else {
|
579
|
-
// There is no host WeakMap, so we must use the emulation.
|
580
|
-
|
581
|
-
// Emulated WeakMaps are incompatible with native proxies (because proxies
|
582
|
-
// can observe the hidden name), so we must disable Proxy usage (in
|
583
|
-
// ArrayLike and Domado, currently).
|
584
|
-
if (typeof Proxy !== 'undefined') {
|
585
|
-
Proxy = undefined;
|
586
|
-
}
|
587
|
-
|
588
|
-
module.exports = OurWeakMap;
|
589
|
-
}
|
590
|
-
})();
|