autobench 0.0.1alpha1

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.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +16 -0
  3. data/README.md +123 -0
  4. data/bin/autobench +180 -0
  5. data/bin/autobench-config +162 -0
  6. data/lib/autobench.rb +28 -0
  7. data/lib/autobench/client.rb +78 -0
  8. data/lib/autobench/common.rb +49 -0
  9. data/lib/autobench/config.rb +62 -0
  10. data/lib/autobench/render.rb +102 -0
  11. data/lib/autobench/version.rb +3 -0
  12. data/lib/autobench/yslow.rb +75 -0
  13. data/lib/phantomas/README.md +296 -0
  14. data/lib/phantomas/core/formatter.js +65 -0
  15. data/lib/phantomas/core/helper.js +64 -0
  16. data/lib/phantomas/core/modules/requestsMonitor/requestsMonitor.js +214 -0
  17. data/lib/phantomas/core/pads.js +16 -0
  18. data/lib/phantomas/core/phantomas.js +418 -0
  19. data/lib/phantomas/lib/args.js +27 -0
  20. data/lib/phantomas/lib/modules/_coffee-script.js +2 -0
  21. data/lib/phantomas/lib/modules/assert.js +326 -0
  22. data/lib/phantomas/lib/modules/events.js +216 -0
  23. data/lib/phantomas/lib/modules/http.js +55 -0
  24. data/lib/phantomas/lib/modules/path.js +441 -0
  25. data/lib/phantomas/lib/modules/punycode.js +510 -0
  26. data/lib/phantomas/lib/modules/querystring.js +214 -0
  27. data/lib/phantomas/lib/modules/tty.js +7 -0
  28. data/lib/phantomas/lib/modules/url.js +625 -0
  29. data/lib/phantomas/lib/modules/util.js +520 -0
  30. data/lib/phantomas/modules/ajaxRequests/ajaxRequests.js +15 -0
  31. data/lib/phantomas/modules/assetsTypes/assetsTypes.js +21 -0
  32. data/lib/phantomas/modules/cacheHits/cacheHits.js +28 -0
  33. data/lib/phantomas/modules/caching/caching.js +66 -0
  34. data/lib/phantomas/modules/cookies/cookies.js +54 -0
  35. data/lib/phantomas/modules/domComplexity/domComplexity.js +130 -0
  36. data/lib/phantomas/modules/domQueries/domQueries.js +148 -0
  37. data/lib/phantomas/modules/domains/domains.js +49 -0
  38. data/lib/phantomas/modules/globalVariables/globalVariables.js +44 -0
  39. data/lib/phantomas/modules/headers/headers.js +48 -0
  40. data/lib/phantomas/modules/localStorage/localStorage.js +14 -0
  41. data/lib/phantomas/modules/requestsStats/requestsStats.js +71 -0
  42. data/lib/phantomas/modules/staticAssets/staticAssets.js +40 -0
  43. data/lib/phantomas/modules/waterfall/waterfall.js +62 -0
  44. data/lib/phantomas/modules/windowPerformance/windowPerformance.js +36 -0
  45. data/lib/phantomas/package.json +27 -0
  46. data/lib/phantomas/phantomas.js +35 -0
  47. data/lib/phantomas/run-multiple.js +177 -0
  48. data/lib/yslow.js +5 -0
  49. metadata +135 -0
@@ -0,0 +1,510 @@
1
+ /*! http://mths.be/punycode by @mathias */
2
+ ;(function(root) {
3
+
4
+ /**
5
+ * The `punycode` object.
6
+ * @name punycode
7
+ * @type Object
8
+ */
9
+ var punycode,
10
+
11
+ /** Detect free variables `define`, `exports`, `module` and `require` */
12
+ freeDefine = typeof define == 'function' && typeof define.amd == 'object' &&
13
+ define.amd && define,
14
+ freeExports = typeof exports == 'object' && exports,
15
+ freeModule = typeof module == 'object' && module,
16
+ freeRequire = typeof require == 'function' && require,
17
+
18
+ /** Highest positive signed 32-bit float value */
19
+ maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
20
+
21
+ /** Bootstring parameters */
22
+ base = 36,
23
+ tMin = 1,
24
+ tMax = 26,
25
+ skew = 38,
26
+ damp = 700,
27
+ initialBias = 72,
28
+ initialN = 128, // 0x80
29
+ delimiter = '-', // '\x2D'
30
+
31
+ /** Regular expressions */
32
+ regexNonASCII = /[^ -~]/, // unprintable ASCII chars + non-ASCII chars
33
+ regexPunycode = /^xn--/,
34
+
35
+ /** Error messages */
36
+ errors = {
37
+ 'overflow': 'Overflow: input needs wider integers to process.',
38
+ 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
39
+ 'invalid-input': 'Invalid input'
40
+ },
41
+
42
+ /** Convenience shortcuts */
43
+ baseMinusTMin = base - tMin,
44
+ floor = Math.floor,
45
+ stringFromCharCode = String.fromCharCode,
46
+
47
+ /** Temporary variable */
48
+ key;
49
+
50
+ /*--------------------------------------------------------------------------*/
51
+
52
+ /**
53
+ * A generic error utility function.
54
+ * @private
55
+ * @param {String} type The error type.
56
+ * @returns {Error} Throws a `RangeError` with the applicable error message.
57
+ */
58
+ function error(type) {
59
+ throw RangeError(errors[type]);
60
+ }
61
+
62
+ /**
63
+ * A generic `Array#map` utility function.
64
+ * @private
65
+ * @param {Array} array The array to iterate over.
66
+ * @param {Function} callback The function that gets called for every array
67
+ * item.
68
+ * @returns {Array} A new array of values returned by the callback function.
69
+ */
70
+ function map(array, fn) {
71
+ var length = array.length;
72
+ while (length--) {
73
+ array[length] = fn(array[length]);
74
+ }
75
+ return array;
76
+ }
77
+
78
+ /**
79
+ * A simple `Array#map`-like wrapper to work with domain name strings.
80
+ * @private
81
+ * @param {String} domain The domain name.
82
+ * @param {Function} callback The function that gets called for every
83
+ * character.
84
+ * @returns {Array} A new string of characters returned by the callback
85
+ * function.
86
+ */
87
+ function mapDomain(string, fn) {
88
+ var glue = '.';
89
+ return map(string.split(glue), fn).join(glue);
90
+ }
91
+
92
+ /**
93
+ * Creates an array containing the decimal code points of each Unicode
94
+ * character in the string. While JavaScript uses UCS-2 internally,
95
+ * this function will convert a pair of surrogate halves (each of which
96
+ * UCS-2 exposes as separate characters) into a single code point,
97
+ * matching UTF-16.
98
+ * @see `punycode.ucs2.encode`
99
+ * @see <http://mathiasbynens.be/notes/javascript-encoding>
100
+ * @memberOf punycode.ucs2
101
+ * @name decode
102
+ * @param {String} string The Unicode input string (UCS-2).
103
+ * @returns {Array} The new array of code points.
104
+ */
105
+ function ucs2decode(string) {
106
+ var output = [],
107
+ counter = 0,
108
+ length = string.length,
109
+ value,
110
+ extra;
111
+ while (counter < length) {
112
+ value = string.charCodeAt(counter++);
113
+ if ((value & 0xF800) == 0xD800 && counter < length) {
114
+ // high surrogate, and there is a next character
115
+ extra = string.charCodeAt(counter++);
116
+ if ((extra & 0xFC00) == 0xDC00) { // low surrogate
117
+ output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
118
+ } else {
119
+ output.push(value, extra);
120
+ }
121
+ } else {
122
+ output.push(value);
123
+ }
124
+ }
125
+ return output;
126
+ }
127
+
128
+ /**
129
+ * Creates a string based on an array of decimal code points.
130
+ * @see `punycode.ucs2.decode`
131
+ * @memberOf punycode.ucs2
132
+ * @name encode
133
+ * @param {Array} codePoints The array of decimal code points.
134
+ * @returns {String} The new Unicode string (UCS-2).
135
+ */
136
+ function ucs2encode(array) {
137
+ return map(array, function(value) {
138
+ var output = '';
139
+ if (value > 0xFFFF) {
140
+ value -= 0x10000;
141
+ output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
142
+ value = 0xDC00 | value & 0x3FF;
143
+ }
144
+ output += stringFromCharCode(value);
145
+ return output;
146
+ }).join('');
147
+ }
148
+
149
+ /**
150
+ * Converts a basic code point into a digit/integer.
151
+ * @see `digitToBasic()`
152
+ * @private
153
+ * @param {Number} codePoint The basic (decimal) code point.
154
+ * @returns {Number} The numeric value of a basic code point (for use in
155
+ * representing integers) in the range `0` to `base - 1`, or `base` if
156
+ * the code point does not represent a value.
157
+ */
158
+ function basicToDigit(codePoint) {
159
+ return codePoint - 48 < 10
160
+ ? codePoint - 22
161
+ : codePoint - 65 < 26
162
+ ? codePoint - 65
163
+ : codePoint - 97 < 26
164
+ ? codePoint - 97
165
+ : base;
166
+ }
167
+
168
+ /**
169
+ * Converts a digit/integer into a basic code point.
170
+ * @see `basicToDigit()`
171
+ * @private
172
+ * @param {Number} digit The numeric value of a basic code point.
173
+ * @returns {Number} The basic code point whose value (when used for
174
+ * representing integers) is `digit`, which needs to be in the range
175
+ * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
176
+ * used; else, the lowercase form is used. The behavior is undefined
177
+ * if flag is non-zero and `digit` has no uppercase form.
178
+ */
179
+ function digitToBasic(digit, flag) {
180
+ // 0..25 map to ASCII a..z or A..Z
181
+ // 26..35 map to ASCII 0..9
182
+ return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
183
+ }
184
+
185
+ /**
186
+ * Bias adaptation function as per section 3.4 of RFC 3492.
187
+ * http://tools.ietf.org/html/rfc3492#section-3.4
188
+ * @private
189
+ */
190
+ function adapt(delta, numPoints, firstTime) {
191
+ var k = 0;
192
+ delta = firstTime ? floor(delta / damp) : delta >> 1;
193
+ delta += floor(delta / numPoints);
194
+ for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
195
+ delta = floor(delta / baseMinusTMin);
196
+ }
197
+ return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
198
+ }
199
+
200
+ /**
201
+ * Converts a basic code point to lowercase is `flag` is falsy, or to
202
+ * uppercase if `flag` is truthy. The code point is unchanged if it's
203
+ * caseless. The behavior is undefined if `codePoint` is not a basic code
204
+ * point.
205
+ * @private
206
+ * @param {Number} codePoint The numeric value of a basic code point.
207
+ * @returns {Number} The resulting basic code point.
208
+ */
209
+ function encodeBasic(codePoint, flag) {
210
+ codePoint -= (codePoint - 97 < 26) << 5;
211
+ return codePoint + (!flag && codePoint - 65 < 26) << 5;
212
+ }
213
+
214
+ /**
215
+ * Converts a Punycode string of ASCII code points to a string of Unicode
216
+ * code points.
217
+ * @memberOf punycode
218
+ * @param {String} input The Punycode string of ASCII code points.
219
+ * @returns {String} The resulting string of Unicode code points.
220
+ */
221
+ function decode(input) {
222
+ // Don't use UCS-2
223
+ var output = [],
224
+ inputLength = input.length,
225
+ out,
226
+ i = 0,
227
+ n = initialN,
228
+ bias = initialBias,
229
+ basic,
230
+ j,
231
+ index,
232
+ oldi,
233
+ w,
234
+ k,
235
+ digit,
236
+ t,
237
+ length,
238
+ /** Cached calculation results */
239
+ baseMinusT;
240
+
241
+ // Handle the basic code points: let `basic` be the number of input code
242
+ // points before the last delimiter, or `0` if there is none, then copy
243
+ // the first basic code points to the output.
244
+
245
+ basic = input.lastIndexOf(delimiter);
246
+ if (basic < 0) {
247
+ basic = 0;
248
+ }
249
+
250
+ for (j = 0; j < basic; ++j) {
251
+ // if it's not a basic code point
252
+ if (input.charCodeAt(j) >= 0x80) {
253
+ error('not-basic');
254
+ }
255
+ output.push(input.charCodeAt(j));
256
+ }
257
+
258
+ // Main decoding loop: start just after the last delimiter if any basic code
259
+ // points were copied; start at the beginning otherwise.
260
+
261
+ for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
262
+
263
+ // `index` is the index of the next character to be consumed.
264
+ // Decode a generalized variable-length integer into `delta`,
265
+ // which gets added to `i`. The overflow checking is easier
266
+ // if we increase `i` as we go, then subtract off its starting
267
+ // value at the end to obtain `delta`.
268
+ for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
269
+
270
+ if (index >= inputLength) {
271
+ error('invalid-input');
272
+ }
273
+
274
+ digit = basicToDigit(input.charCodeAt(index++));
275
+
276
+ if (digit >= base || digit > floor((maxInt - i) / w)) {
277
+ error('overflow');
278
+ }
279
+
280
+ i += digit * w;
281
+ t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
282
+
283
+ if (digit < t) {
284
+ break;
285
+ }
286
+
287
+ baseMinusT = base - t;
288
+ if (w > floor(maxInt / baseMinusT)) {
289
+ error('overflow');
290
+ }
291
+
292
+ w *= baseMinusT;
293
+
294
+ }
295
+
296
+ out = output.length + 1;
297
+ bias = adapt(i - oldi, out, oldi == 0);
298
+
299
+ // `i` was supposed to wrap around from `out` to `0`,
300
+ // incrementing `n` each time, so we'll fix that now:
301
+ if (floor(i / out) > maxInt - n) {
302
+ error('overflow');
303
+ }
304
+
305
+ n += floor(i / out);
306
+ i %= out;
307
+
308
+ // Insert `n` at position `i` of the output
309
+ output.splice(i++, 0, n);
310
+
311
+ }
312
+
313
+ return ucs2encode(output);
314
+ }
315
+
316
+ /**
317
+ * Converts a string of Unicode code points to a Punycode string of ASCII
318
+ * code points.
319
+ * @memberOf punycode
320
+ * @param {String} input The string of Unicode code points.
321
+ * @returns {String} The resulting Punycode string of ASCII code points.
322
+ */
323
+ function encode(input) {
324
+ var n,
325
+ delta,
326
+ handledCPCount,
327
+ basicLength,
328
+ bias,
329
+ j,
330
+ m,
331
+ q,
332
+ k,
333
+ t,
334
+ currentValue,
335
+ output = [],
336
+ /** `inputLength` will hold the number of code points in `input`. */
337
+ inputLength,
338
+ /** Cached calculation results */
339
+ handledCPCountPlusOne,
340
+ baseMinusT,
341
+ qMinusT;
342
+
343
+ // Convert the input in UCS-2 to Unicode
344
+ input = ucs2decode(input);
345
+
346
+ // Cache the length
347
+ inputLength = input.length;
348
+
349
+ // Initialize the state
350
+ n = initialN;
351
+ delta = 0;
352
+ bias = initialBias;
353
+
354
+ // Handle the basic code points
355
+ for (j = 0; j < inputLength; ++j) {
356
+ currentValue = input[j];
357
+ if (currentValue < 0x80) {
358
+ output.push(stringFromCharCode(currentValue));
359
+ }
360
+ }
361
+
362
+ handledCPCount = basicLength = output.length;
363
+
364
+ // `handledCPCount` is the number of code points that have been handled;
365
+ // `basicLength` is the number of basic code points.
366
+
367
+ // Finish the basic string - if it is not empty - with a delimiter
368
+ if (basicLength) {
369
+ output.push(delimiter);
370
+ }
371
+
372
+ // Main encoding loop:
373
+ while (handledCPCount < inputLength) {
374
+
375
+ // All non-basic code points < n have been handled already. Find the next
376
+ // larger one:
377
+ for (m = maxInt, j = 0; j < inputLength; ++j) {
378
+ currentValue = input[j];
379
+ if (currentValue >= n && currentValue < m) {
380
+ m = currentValue;
381
+ }
382
+ }
383
+
384
+ // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
385
+ // but guard against overflow
386
+ handledCPCountPlusOne = handledCPCount + 1;
387
+ if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
388
+ error('overflow');
389
+ }
390
+
391
+ delta += (m - n) * handledCPCountPlusOne;
392
+ n = m;
393
+
394
+ for (j = 0; j < inputLength; ++j) {
395
+ currentValue = input[j];
396
+
397
+ if (currentValue < n && ++delta > maxInt) {
398
+ error('overflow');
399
+ }
400
+
401
+ if (currentValue == n) {
402
+ // Represent delta as a generalized variable-length integer
403
+ for (q = delta, k = base; /* no condition */; k += base) {
404
+ t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
405
+ if (q < t) {
406
+ break;
407
+ }
408
+ qMinusT = q - t;
409
+ baseMinusT = base - t;
410
+ output.push(
411
+ stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
412
+ );
413
+ q = floor(qMinusT / baseMinusT);
414
+ }
415
+
416
+ output.push(stringFromCharCode(digitToBasic(q, 0)));
417
+ bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
418
+ delta = 0;
419
+ ++handledCPCount;
420
+ }
421
+ }
422
+
423
+ ++delta;
424
+ ++n;
425
+
426
+ }
427
+ return output.join('');
428
+ }
429
+
430
+ /**
431
+ * Converts a Punycode string representing a domain name to Unicode. Only the
432
+ * Punycoded parts of the domain name will be converted, i.e. it doesn't
433
+ * matter if you call it on a string that has already been converted to
434
+ * Unicode.
435
+ * @memberOf punycode
436
+ * @param {String} domain The Punycode domain name to convert to Unicode.
437
+ * @returns {String} The Unicode representation of the given Punycode
438
+ * string.
439
+ */
440
+ function toUnicode(domain) {
441
+ return mapDomain(domain, function(string) {
442
+ return regexPunycode.test(string)
443
+ ? decode(string.slice(4).toLowerCase())
444
+ : string;
445
+ });
446
+ }
447
+
448
+ /**
449
+ * Converts a Unicode string representing a domain name to Punycode. Only the
450
+ * non-ASCII parts of the domain name will be converted, i.e. it doesn't
451
+ * matter if you call it with a domain that's already in ASCII.
452
+ * @memberOf punycode
453
+ * @param {String} domain The domain name to convert, as a Unicode string.
454
+ * @returns {String} The Punycode representation of the given domain name.
455
+ */
456
+ function toASCII(domain) {
457
+ return mapDomain(domain, function(string) {
458
+ return regexNonASCII.test(string)
459
+ ? 'xn--' + encode(string)
460
+ : string;
461
+ });
462
+ }
463
+
464
+ /*--------------------------------------------------------------------------*/
465
+
466
+ /** Define the public API */
467
+ punycode = {
468
+ /**
469
+ * A string representing the current Punycode.js version number.
470
+ * @memberOf punycode
471
+ * @type String
472
+ */
473
+ 'version': '1.1.1',
474
+ /**
475
+ * An object of methods to convert from JavaScript's internal character
476
+ * representation (UCS-2) to decimal Unicode code points, and back.
477
+ * @see <http://mathiasbynens.be/notes/javascript-encoding>
478
+ * @memberOf punycode
479
+ * @type Object
480
+ */
481
+ 'ucs2': {
482
+ 'decode': ucs2decode,
483
+ 'encode': ucs2encode
484
+ },
485
+ 'decode': decode,
486
+ 'encode': encode,
487
+ 'toASCII': toASCII,
488
+ 'toUnicode': toUnicode
489
+ };
490
+
491
+ /** Expose `punycode` */
492
+ if (freeExports) {
493
+ if (freeModule && freeModule.exports == freeExports) {
494
+ // in Node.js or Ringo 0.8+
495
+ freeModule.exports = punycode;
496
+ } else {
497
+ // in Narwhal or Ringo 0.7-
498
+ for (key in punycode) {
499
+ punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
500
+ }
501
+ }
502
+ } else if (freeDefine) {
503
+ // via curl.js or RequireJS
504
+ define('punycode', punycode);
505
+ } else {
506
+ // in a browser or Rhino
507
+ root.punycode = punycode;
508
+ }
509
+
510
+ }(this));