fsevents 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of fsevents might be problematic. Click here for more details.

Files changed (87) hide show
  1. package/node_modules/node-pre-gyp/CHANGELOG.md +4 -0
  2. package/node_modules/node-pre-gyp/README.md +1 -1
  3. package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +4 -0
  4. package/node_modules/node-pre-gyp/lib/util/versioning.js +16 -0
  5. package/node_modules/node-pre-gyp/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/readable-stream/node_modules/core-util-is/package.json +1 -1
  6. package/node_modules/node-pre-gyp/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/readable-stream/node_modules/inherits/package.json +1 -1
  7. package/node_modules/node-pre-gyp/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/readable-stream/package.json +1 -1
  8. package/node_modules/node-pre-gyp/node_modules/rc/lib/utils.js +5 -3
  9. package/node_modules/node-pre-gyp/node_modules/rc/package.json +7 -8
  10. package/node_modules/node-pre-gyp/node_modules/rc/test/nested-env-vars.js +1 -0
  11. package/node_modules/node-pre-gyp/node_modules/request/.npmignore +3 -0
  12. package/node_modules/node-pre-gyp/node_modules/request/CHANGELOG.md +6 -0
  13. package/node_modules/node-pre-gyp/node_modules/request/README.md +2 -2
  14. package/node_modules/node-pre-gyp/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/package.json +1 -1
  15. package/node_modules/node-pre-gyp/node_modules/request/node_modules/har-validator/node_modules/bluebird/README.md +1 -1
  16. package/node_modules/node-pre-gyp/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/browser/bluebird.js +10 -4
  17. package/node_modules/node-pre-gyp/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/browser/bluebird.min.js +3 -3
  18. package/node_modules/node-pre-gyp/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/timers.js +9 -3
  19. package/node_modules/node-pre-gyp/node_modules/request/node_modules/har-validator/node_modules/bluebird/package.json +7 -7
  20. package/node_modules/node-pre-gyp/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/escape-string-regexp/package.json +1 -1
  21. package/node_modules/node-pre-gyp/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/jsonpointer/package.json +1 -2
  22. package/node_modules/node-pre-gyp/node_modules/request/node_modules/hawk/node_modules/boom/package.json +2 -1
  23. package/node_modules/node-pre-gyp/node_modules/request/node_modules/hawk/node_modules/hoek/package.json +2 -1
  24. package/node_modules/node-pre-gyp/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json +2 -7
  25. package/node_modules/node-pre-gyp/node_modules/request/node_modules/http-signature/node_modules/ctype/package.json +1 -6
  26. package/node_modules/node-pre-gyp/node_modules/request/node_modules/mime-types/node_modules/mime-db/package.json +2 -1
  27. package/node_modules/node-pre-gyp/node_modules/request/node_modules/mime-types/package.json +2 -1
  28. package/node_modules/node-pre-gyp/node_modules/request/node_modules/qs/package.json +2 -1
  29. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/README.md +12 -6
  30. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/lib/cookie.js +32 -12
  31. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/lib/pubsuffix.js +2 -2
  32. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/package.json +35 -12
  33. package/node_modules/node-pre-gyp/node_modules/request/package.json +7 -7
  34. package/node_modules/node-pre-gyp/node_modules/request/request.js +6 -3
  35. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/inherits/package.json +1 -1
  36. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore +3 -2
  37. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +1 -0
  38. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +9 -9
  39. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/minimatch/package.json +12 -16
  40. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/package.json +10 -11
  41. package/node_modules/node-pre-gyp/node_modules/semver/package.json +2 -1
  42. package/node_modules/node-pre-gyp/node_modules/tar/node_modules/inherits/package.json +1 -1
  43. package/node_modules/node-pre-gyp/node_modules/tar/package.json +2 -1
  44. package/node_modules/node-pre-gyp/node_modules/tar-pack/node_modules/fstream-ignore/node_modules/inherits/package.json +1 -1
  45. package/node_modules/node-pre-gyp/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/package.json +1 -1
  46. package/node_modules/node-pre-gyp/node_modules/tar-pack/node_modules/readable-stream/package.json +1 -1
  47. package/node_modules/node-pre-gyp/package.json +8 -9
  48. package/package.json +2 -2
  49. package/node_modules/node-pre-gyp/node_modules/request/disabled.appveyor.yml +0 -36
  50. package/node_modules/node-pre-gyp/node_modules/request/examples/README.md +0 -115
  51. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/.editorconfig +0 -12
  52. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/.jshintrc +0 -70
  53. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/.npmignore +0 -4
  54. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/.travis.yml +0 -9
  55. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/LICENSE +0 -74
  56. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/generate-pubsuffix.js +0 -293
  57. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/public-suffix.txt +0 -10309
  58. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/test/api_test.js +0 -372
  59. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/test/cookie_jar_test.js +0 -468
  60. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/test/cookie_sorting_test.js +0 -156
  61. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/test/cookie_to_json_test.js +0 -164
  62. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/test/cookie_to_string_test.js +0 -162
  63. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/test/date_test.js +0 -79
  64. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/test/domain_and_path_test.js +0 -201
  65. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/test/ietf_data/dates/bsd-examples.json +0 -168
  66. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/test/ietf_data/dates/examples.json +0 -48
  67. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/test/ietf_data/parser.json +0 -1959
  68. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/test/ietf_test.js +0 -105
  69. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/test/jar_serialization_test.js +0 -348
  70. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/test/lifetime_test.js +0 -97
  71. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/test/parsing_test.js +0 -294
  72. package/node_modules/node-pre-gyp/node_modules/request/node_modules/tough-cookie/test/regression_test.js +0 -143
  73. package/node_modules/node-pre-gyp/node_modules/request/release.sh +0 -45
  74. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/minimatch/browser.js +0 -1159
  75. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml +0 -3
  76. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js +0 -32
  77. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt +0 -1075
  78. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt +0 -182
  79. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js +0 -9
  80. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js +0 -10
  81. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh +0 -24
  82. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js +0 -15
  83. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js +0 -16
  84. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js +0 -10
  85. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js +0 -13
  86. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js +0 -7
  87. package/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js +0 -50
@@ -1,105 +0,0 @@
1
- /*!
2
- * Copyright (c) 2015, Salesforce.com, Inc.
3
- * All rights reserved.
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions are met:
7
- *
8
- * 1. Redistributions of source code must retain the above copyright notice,
9
- * this list of conditions and the following disclaimer.
10
- *
11
- * 2. Redistributions in binary form must reproduce the above copyright notice,
12
- * this list of conditions and the following disclaimer in the documentation
13
- * and/or other materials provided with the distribution.
14
- *
15
- * 3. Neither the name of Salesforce.com nor the names of its contributors may
16
- * be used to endorse or promote products derived from this software without
17
- * specific prior written permission.
18
- *
19
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
- * POSSIBILITY OF SUCH DAMAGE.
30
- */
31
-
32
- 'use strict';
33
- var vows = require('vows');
34
- var assert = require('assert');
35
- var fs = require('fs');
36
- var path = require('path');
37
- var url = require('url');
38
- var tough = require('../lib/cookie');
39
- var Cookie = tough.Cookie;
40
- var CookieJar = tough.CookieJar;
41
-
42
- function readJson(filePath) {
43
- filePath = path.join(__dirname, filePath);
44
- return JSON.parse(fs.readFileSync(filePath).toString());
45
- }
46
-
47
- function setGetCookieVows() {
48
- var theVows = {};
49
- var data = readJson('./ietf_data/parser.json');
50
-
51
- data.forEach(function (testCase) {
52
- theVows[testCase.test] = function () {
53
- var jar = new CookieJar();
54
- var expected = testCase['sent']
55
- var sentFrom = 'http://home.example.org/cookie-parser?' + testCase.test;
56
- var sentTo = testCase['sent-to'] ?
57
- url.resolve('http://home.example.org', testCase['sent-to']) :
58
- 'http://home.example.org/cookie-parser-result?' + testCase.test;
59
-
60
- testCase['received'].forEach(function (cookieStr) {
61
- jar.setCookieSync(cookieStr, sentFrom, {ignoreError: true});
62
- });
63
-
64
- var actual = jar.getCookiesSync(sentTo,{sort:true});
65
-
66
- assert.strictEqual(actual.length, expected.length);
67
-
68
- actual.forEach(function (actualCookie, idx) {
69
- var expectedCookie = expected[idx];
70
- assert.strictEqual(actualCookie.key, expectedCookie.name);
71
- assert.strictEqual(actualCookie.value, expectedCookie.value);
72
- });
73
- };
74
- });
75
-
76
- return {'Set/get cookie tests': theVows};
77
- }
78
-
79
- function dateVows() {
80
- var theVows = {};
81
-
82
- [
83
- './ietf_data/dates/bsd-examples.json',
84
- './ietf_data/dates/examples.json'
85
- ].forEach(function (filePath) {
86
- var data = readJson(filePath);
87
- var fileName = path.basename(filePath);
88
-
89
- data.forEach(function (testCase) {
90
- theVows[fileName + ' : ' + testCase.test] = function () {
91
- var actual = tough.parseDate(testCase.test);
92
- actual = actual ? actual.toUTCString() : null;
93
- assert.strictEqual(actual, testCase.expected);
94
- };
95
- });
96
- });
97
-
98
- return {'Date': theVows};
99
- }
100
-
101
- vows
102
- .describe('IETF http state tests')
103
- .addBatch(setGetCookieVows())
104
- .addBatch(dateVows())
105
- .export(module);
@@ -1,348 +0,0 @@
1
- /*!
2
- * Copyright (c) 2015, Salesforce.com, Inc.
3
- * All rights reserved.
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions are met:
7
- *
8
- * 1. Redistributions of source code must retain the above copyright notice,
9
- * this list of conditions and the following disclaimer.
10
- *
11
- * 2. Redistributions in binary form must reproduce the above copyright notice,
12
- * this list of conditions and the following disclaimer in the documentation
13
- * and/or other materials provided with the distribution.
14
- *
15
- * 3. Neither the name of Salesforce.com nor the names of its contributors may
16
- * be used to endorse or promote products derived from this software without
17
- * specific prior written permission.
18
- *
19
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
- * POSSIBILITY OF SUCH DAMAGE.
30
- */
31
-
32
- 'use strict';
33
- var vows = require('vows');
34
- var assert = require('assert');
35
- var tough = require('../lib/cookie');
36
- var Cookie = tough.Cookie;
37
- var CookieJar = tough.CookieJar;
38
- var Store = tough.Store;
39
- var MemoryCookieStore = tough.MemoryCookieStore;
40
- var VERSION = require('../package.json').version;
41
-
42
- var domains = ['example.com','www.example.com','example.net'];
43
- var paths = ['/','/foo','/foo/bar'];
44
-
45
- var isInteger = Number.isInteger || function(value) {
46
- // Node 0.10 (still supported) doesn't have Number.isInteger
47
- // from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger
48
- return typeof value === "number" &&
49
- isFinite(value) &&
50
- Math.floor(value) === value;
51
- };
52
-
53
- function setUp(context) {
54
- context.now = new Date();
55
- context.nowISO = context.now.toISOString();
56
- context.expires = new Date(context.now.getTime() + 86400000);
57
-
58
- var c, domain;
59
- context.jar = new CookieJar();
60
-
61
- context.totalCookies = 0;
62
-
63
- // Do paths first since the MemoryCookieStore index is domain at the top
64
- // level. This should cause the preservation of creation order in
65
- // getAllCookies to be exercised.
66
- for (var i = 0; i<paths.length; i++) {
67
- var path = paths[i];
68
- for (var j = 0; j<domains.length; j++) {
69
- domain = domains[j];
70
- c = new Cookie({
71
- expires: context.expires,
72
- domain: domain,
73
- path: path,
74
- key: 'key',
75
- value: 'value'+j+i
76
- });
77
- context.jar.setCookieSync(c, 'http://'+domain+'/', {now: context.now});
78
- context.totalCookies++;
79
- }
80
- }
81
-
82
- // corner cases
83
- domain = 'example.com';
84
- var cornerCases = [
85
- { expires: 'Infinity', key: 'infExp', value: 'infExp' },
86
- { maxAge: 3600, key: 'max', value: 'max' },
87
- { expires: context.expires, key: 'flags', value: 'flags',
88
- secure: true, httpOnly: true },
89
- { expires: context.expires, key: 'honly', value: 'honly',
90
- hostOnly: true, domain: 'www.example.org' },
91
- ];
92
-
93
- for (var i = 0; i<cornerCases.length; i++) {
94
- cornerCases[i].domain = cornerCases[i].domain || 'example.org';
95
- cornerCases[i].path = '/';
96
- c = new Cookie(cornerCases[i]);
97
- context.jar.setCookieSync(c, 'https://www.example.org/', {now: context.now});
98
- context.totalCookies++;
99
- }
100
- }
101
-
102
- function checkMetadata(serialized) {
103
- assert.notEqual(serialized, null);
104
- assert.isObject(serialized);
105
- assert.equal(serialized.version, 'tough-cookie@'+VERSION);
106
- assert.equal(serialized.storeType, 'MemoryCookieStore');
107
- assert.typeOf(serialized.rejectPublicSuffixes, 'boolean');
108
- assert.isArray(serialized.cookies);
109
- }
110
-
111
- var serializedCookiePropTypes = {
112
- 'key': 'string',
113
- 'value': 'string',
114
- 'expires': 'isoDate', // if "Infinity" it's supposed to be missing
115
- 'maxAge': 'intOrInf',
116
- 'domain': 'string',
117
- 'path': 'string',
118
- 'secure': 'boolean',
119
- 'httpOnly': 'boolean',
120
- 'extensions': 'array', // of strings, technically
121
- 'hostOnly': 'boolean',
122
- 'pathIsDefault': 'boolean',
123
- 'creation': 'isoDate',
124
- 'lastAccessed': 'isoDate'
125
- };
126
-
127
- function validateSerializedCookie(cookie) {
128
- assert.isObject(cookie);
129
- assert.isFalse(cookie instanceof Cookie);
130
-
131
- Object.keys(cookie).forEach(function(prop) {
132
- var type = serializedCookiePropTypes[prop];
133
- switch(type) {
134
- case 'string':
135
- case 'boolean':
136
- case 'array':
137
- case 'number':
138
- assert.typeOf(cookie[prop], type);
139
- break;
140
-
141
- case 'intOrInf':
142
- if (cookie[prop] === 'Infinity' || cookie[prop] === '-Infinity') {
143
- assert(true);
144
- } else {
145
- assert(isInteger(cookie[prop]),
146
- "serialized property isn't integer: "+prop);
147
- }
148
- break;
149
-
150
- case 'isoDate':
151
- // rather than a regexp, assert it's parsable and equal
152
- var parsed = Date.parse(cookie[prop]);
153
- assert(parsed, 'could not parse serialized date property');
154
- // assert.equals(cookie[prop], parsed.toISOString());
155
- break;
156
-
157
- default:
158
- assert.fail("unexpected serialized property: "+prop);
159
- }
160
- });
161
-
162
- }
163
-
164
- vows
165
- .describe('CookieJar serialization')
166
- .addBatch({
167
- "Assumptions:": {
168
- "serializableProperties all accounted for": function() {
169
- var actualKeys = Cookie.serializableProperties.concat([]); // copy
170
- actualKeys.sort();
171
- var expectedKeys = Object.keys(serializedCookiePropTypes);
172
- expectedKeys.sort();
173
- assert.deepEqual(actualKeys, expectedKeys);
174
- }
175
- }
176
- })
177
- .addBatch({
178
- "For Stores without getAllCookies": {
179
- topic: function() {
180
- var store = new Store();
181
- store.synchronous = true;
182
- var jar = new CookieJar(store);
183
- return jar;
184
- },
185
- "Cannot call toJSON": function(jar) {
186
- assert.throws(function() {
187
- jar.toJSON();
188
- }, 'getAllCookies is not implemented (therefore jar cannot be serialized)');
189
- }
190
- }
191
- })
192
- .addBatch({
193
- "For async stores": {
194
- topic: function() {
195
- var store = new MemoryCookieStore();
196
- store.synchronous = false; // pretend it's async
197
- var jar = new CookieJar(store);
198
- return jar;
199
- },
200
- "Cannot call toJSON": function(jar) {
201
- assert.throws(function() {
202
- jar.toJSON();
203
- }, 'CookieJar store is not synchronous; use async API instead.');
204
- }
205
- }
206
- })
207
- .addBatch({
208
- "With a small store": {
209
- topic: function() {
210
- var now = this.now = new Date();
211
- this.jar = new CookieJar();
212
- // domain cookie with custom extension
213
- var cookie = Cookie.parse('sid=one; domain=example.com; path=/; fubar');
214
- this.jar.setCookieSync(cookie, 'http://example.com/', {now: this.now});
215
-
216
- cookie = Cookie.parse('sid=two; domain=example.net; path=/; fubar');
217
- this.jar.setCookieSync(cookie, 'http://example.net/', {now: this.now});
218
-
219
- return this.jar;
220
- },
221
-
222
- "serialize synchronously": {
223
- topic: function(jar) {
224
- return jar.serializeSync();
225
- },
226
- "it gives a serialization with the two cookies": function(data) {
227
- checkMetadata(data);
228
- assert.equal(data.cookies.length, 2);
229
- data.cookies.forEach(function(cookie) {
230
- validateSerializedCookie(cookie);
231
- });
232
- },
233
- "then deserialize": {
234
- topic: function(data) {
235
- return CookieJar.deserializeSync(data);
236
- },
237
- "memstores are identical": function(newJar) {
238
- assert.deepEqual(this.jar.store, newJar.store);
239
- }
240
- }
241
- },
242
-
243
- "serialize asynchronously": {
244
- topic: function(jar) {
245
- jar.serialize(this.callback);
246
- },
247
- "it gives a serialization with the two cookies": function(data) {
248
- checkMetadata(data);
249
- assert.equal(data.cookies.length, 2);
250
- data.cookies.forEach(function(cookie) {
251
- validateSerializedCookie(cookie);
252
- });
253
- },
254
- "then deserialize": {
255
- topic: function(data) {
256
- CookieJar.deserialize(data, this.callback);
257
- },
258
- "memstores are identical": function(newJar) {
259
- assert.deepEqual(this.jar.store, newJar.store);
260
- }
261
- }
262
- }
263
- }
264
- })
265
- .addBatch({
266
- "With a moderately-sized store": {
267
- topic: function() {
268
- setUp(this);
269
- this.jar.serialize(this.callback);
270
- },
271
- "has expected metadata": function(err,jsonObj) {
272
- assert.isNull(err);
273
- assert.equal(jsonObj.version, 'tough-cookie@'+VERSION);
274
- assert.isTrue(jsonObj.rejectPublicSuffixes);
275
- assert.equal(jsonObj.storeType, 'MemoryCookieStore');
276
- },
277
- "has a bunch of objects as 'raw' cookies": function(jsonObj) {
278
- assert.isArray(jsonObj.cookies);
279
- assert.equal(jsonObj.cookies.length, this.totalCookies);
280
-
281
- jsonObj.cookies.forEach(function(cookie) {
282
- validateSerializedCookie(cookie);
283
-
284
- if (cookie.key === 'key') {
285
- assert.match(cookie.value, /^value\d\d/);
286
- }
287
-
288
- if (cookie.key === 'infExp' || cookie.key === 'max') {
289
- assert.isUndefined(cookie.expires);
290
- } else {
291
- assert.strictEqual(cookie.expires, this.expires.toISOString())
292
- }
293
-
294
- if (cookie.key === 'max') {
295
- assert.strictEqual(cookie.maxAge, 3600);
296
- } else {
297
- assert.isUndefined(cookie.maxAge);
298
- }
299
-
300
- assert.equal(cookie.hostOnly, cookie.key === 'honly');
301
-
302
- if (cookie.key === 'flags') {
303
- assert.isTrue(cookie.secure);
304
- assert.isTrue(cookie.httpOnly);
305
- } else {
306
- assert.isUndefined(cookie.secure);
307
- assert.isUndefined(cookie.httpOnly);
308
- }
309
-
310
- assert.strictEqual(cookie.creation, this.nowISO);
311
- assert.strictEqual(cookie.lastAccessed, this.nowISO);
312
-
313
- }, this);
314
- },
315
-
316
- "then taking it for a round-trip": {
317
- topic: function(jsonObj) {
318
- CookieJar.deserialize(jsonObj, this.callback);
319
- },
320
- "memstore index is identical": function(err,newJar) {
321
- assert.deepEqual(newJar.store.idx, this.jar.store.idx);
322
- },
323
- "then spot-check retrieval": {
324
- topic: function(newJar) {
325
- newJar.getCookies('http://example.org/', this.callback);
326
- },
327
- "gets expected cookies": function(results) {
328
- assert.isArray(results);
329
- assert.equal(results.length, 2);
330
-
331
- results.forEach(function(cookie) {
332
- assert.instanceOf(cookie, Cookie);
333
-
334
- if (cookie.key === 'infExp') {
335
- assert.strictEqual(cookie.expires, "Infinity");
336
- assert.strictEqual(cookie.TTL(this.now), Infinity);
337
- } else if (cookie.key === 'max') {
338
- assert.strictEqual(cookie.TTL(this.now), 3600*1000);
339
- } else {
340
- assert.fail('Unexpected cookie key: '+cookie.key);
341
- }
342
- }.bind(this));
343
- }
344
- }
345
- }
346
- }
347
- })
348
- .export(module);
@@ -1,97 +0,0 @@
1
- /*!
2
- * Copyright (c) 2015, Salesforce.com, Inc.
3
- * All rights reserved.
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions are met:
7
- *
8
- * 1. Redistributions of source code must retain the above copyright notice,
9
- * this list of conditions and the following disclaimer.
10
- *
11
- * 2. Redistributions in binary form must reproduce the above copyright notice,
12
- * this list of conditions and the following disclaimer in the documentation
13
- * and/or other materials provided with the distribution.
14
- *
15
- * 3. Neither the name of Salesforce.com nor the names of its contributors may
16
- * be used to endorse or promote products derived from this software without
17
- * specific prior written permission.
18
- *
19
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
- * POSSIBILITY OF SUCH DAMAGE.
30
- */
31
-
32
- 'use strict';
33
- var vows = require('vows');
34
- var assert = require('assert');
35
- var tough = require('../lib/cookie');
36
- var Cookie = tough.Cookie;
37
-
38
- vows
39
- .describe('Lifetime')
40
- .addBatch({
41
- "TTL with max-age": function () {
42
- var c = new Cookie();
43
- c.maxAge = 123;
44
- assert.equal(c.TTL(), 123000);
45
- assert.equal(c.expiryTime(new Date(9000000)), 9123000);
46
- },
47
- "TTL with zero max-age": function () {
48
- var c = new Cookie();
49
- c.key = 'a';
50
- c.value = 'b';
51
- c.maxAge = 0; // should be treated as "earliest representable"
52
- assert.equal(c.TTL(), 0);
53
- assert.equal(c.expiryTime(new Date(9000000)), -Infinity);
54
- assert.ok(!c.validate()); // not valid, really: non-zero-digit *DIGIT
55
- },
56
- "TTL with negative max-age": function () {
57
- var c = new Cookie();
58
- c.key = 'a';
59
- c.value = 'b';
60
- c.maxAge = -1; // should be treated as "earliest representable"
61
- assert.equal(c.TTL(), 0);
62
- assert.equal(c.expiryTime(new Date(9000000)), -Infinity);
63
- assert.ok(!c.validate()); // not valid, really: non-zero-digit *DIGIT
64
- },
65
- "TTL with max-age and expires": function () {
66
- var c = new Cookie();
67
- c.maxAge = 123;
68
- c.expires = new Date(Date.now() + 9000);
69
- assert.equal(c.TTL(), 123000);
70
- assert.ok(c.isPersistent());
71
- },
72
- "TTL with expires": function () {
73
- var c = new Cookie();
74
- var now = Date.now();
75
- c.expires = new Date(now + 9000);
76
- assert.equal(c.TTL(now), 9000);
77
- assert.equal(c.expiryTime(), c.expires.getTime());
78
- },
79
- "TTL with old expires": function () {
80
- var c = new Cookie();
81
- c.setExpires('17 Oct 2010 00:00:00 GMT');
82
- assert.ok(c.TTL() < 0);
83
- assert.ok(c.isPersistent());
84
- },
85
- "default TTL": {
86
- topic: function () {
87
- return new Cookie();
88
- },
89
- "is Infinite-future": function (c) {
90
- assert.equal(c.TTL(), Infinity)
91
- },
92
- "is a 'session' cookie": function (c) {
93
- assert.ok(!c.isPersistent())
94
- }
95
- }
96
- })
97
- .export(module);