update page_template
This commit is contained in:
19
resources/page_template/libs/brotli/LICENSE
Normal file
19
resources/page_template/libs/brotli/LICENSE
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
12
resources/page_template/libs/brotli/WORKSPACE
Normal file
12
resources/page_template/libs/brotli/WORKSPACE
Normal file
@@ -0,0 +1,12 @@
|
||||
workspace(name = "org_brotli_js")
|
||||
|
||||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
|
||||
|
||||
git_repository(
|
||||
name = "io_bazel_rules_closure",
|
||||
commit = "29ec97e7c85d607ba9e41cab3993fbb13f812c4b",
|
||||
remote = "https://github.com/bazelbuild/rules_closure.git",
|
||||
)
|
||||
|
||||
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories")
|
||||
closure_repositories()
|
||||
2031
resources/page_template/libs/brotli/decode.js
Normal file
2031
resources/page_template/libs/brotli/decode.js
Normal file
File diff suppressed because one or more lines are too long
2
resources/page_template/libs/brotli/decode.min.js
vendored
Normal file
2
resources/page_template/libs/brotli/decode.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
79
resources/page_template/libs/brotli/decode_test.js
Normal file
79
resources/page_template/libs/brotli/decode_test.js
Normal file
@@ -0,0 +1,79 @@
|
||||
goog.require('goog.testing.asserts');
|
||||
goog.require('goog.testing.jsunit');
|
||||
|
||||
/**
|
||||
* @param {!Int8Array} bytes
|
||||
* @return {string}
|
||||
*/
|
||||
function bytesToString(bytes) {
|
||||
return String.fromCharCode.apply(null, new Uint16Array(bytes));
|
||||
}
|
||||
|
||||
function testMetadata() {
|
||||
assertEquals("", bytesToString(BrotliDecode(Int8Array.from([1, 11, 0, 42, 3]))));
|
||||
}
|
||||
|
||||
function testEmpty() {
|
||||
assertEquals("", bytesToString(BrotliDecode(Int8Array.from([6]))));
|
||||
assertEquals("", bytesToString(BrotliDecode(Int8Array.from([0x81, 1]))));
|
||||
}
|
||||
|
||||
function testBaseDictWord() {
|
||||
var input = Int8Array.from([
|
||||
0x1b, 0x03, 0x00, 0x00, 0x00, 0x00, 0x80, 0xe3, 0xb4, 0x0d, 0x00, 0x00,
|
||||
0x07, 0x5b, 0x26, 0x31, 0x40, 0x02, 0x00, 0xe0, 0x4e, 0x1b, 0x41, 0x02
|
||||
]);
|
||||
/** @type {!Int8Array} */
|
||||
var output = BrotliDecode(input);
|
||||
assertEquals("time", bytesToString(output));
|
||||
}
|
||||
|
||||
function testBlockCountMessage() {
|
||||
var input = Int8Array.from([
|
||||
0x1b, 0x0b, 0x00, 0x11, 0x01, 0x8c, 0xc1, 0xc5, 0x0d, 0x08, 0x00, 0x22,
|
||||
0x65, 0xe1, 0xfc, 0xfd, 0x22, 0x2c, 0xc4, 0x00, 0x00, 0x38, 0xd8, 0x32,
|
||||
0x89, 0x01, 0x12, 0x00, 0x00, 0x77, 0xda, 0x04, 0x10, 0x42, 0x00, 0x00, 0x00
|
||||
]);
|
||||
/** @type {!Int8Array} */
|
||||
var output = BrotliDecode(input);
|
||||
assertEquals("aabbaaaaabab", bytesToString(output));
|
||||
}
|
||||
|
||||
function testCompressedUncompressedShortCompressedSmallWindow() {
|
||||
var input = Int8Array.from([
|
||||
0x21, 0xf4, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xa7, 0x6d, 0x00, 0x00,
|
||||
0x38, 0xd8, 0x32, 0x89, 0x01, 0x12, 0x00, 0x00, 0x77, 0xda, 0x34, 0x7b,
|
||||
0xdb, 0x50, 0x80, 0x02, 0x80, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x31,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x4e, 0xdb, 0x00, 0x00, 0x70, 0xb0,
|
||||
0x65, 0x12, 0x03, 0x24, 0x00, 0x00, 0xee, 0xb4, 0x11, 0x24, 0x00
|
||||
]);
|
||||
/** @type {!Int8Array} */
|
||||
var output = BrotliDecode(input);
|
||||
assertEquals(
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
|
||||
"aaaaaaaaaaaaaabbbbbbbbbb", bytesToString(output));
|
||||
}
|
||||
|
||||
function testIntactDistanceRingBuffer0() {
|
||||
var input = Int8Array.from([
|
||||
0x1b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x80, 0xe3, 0xb4, 0x0d, 0x00, 0x00,
|
||||
0x07, 0x5b, 0x26, 0x31, 0x40, 0x02, 0x00, 0xe0, 0x4e, 0x1b, 0xa1, 0x80,
|
||||
0x20, 0x00
|
||||
]);
|
||||
/** @type {!Int8Array} */
|
||||
var output = BrotliDecode(input);
|
||||
assertEquals("himselfself", bytesToString(output));
|
||||
}
|
||||
65
resources/page_template/libs/brotli/polyfill.js
Normal file
65
resources/page_template/libs/brotli/polyfill.js
Normal file
@@ -0,0 +1,65 @@
|
||||
if (!Int32Array.__proto__.from) {
|
||||
Object.defineProperty(Int32Array.__proto__, 'from', {
|
||||
value: function(obj) {
|
||||
obj = Object(obj);
|
||||
if (!obj['length']) {
|
||||
return new this(0);
|
||||
}
|
||||
var typed_array = new this(obj.length);
|
||||
for(var i = 0; i < typed_array.length; i++) {
|
||||
typed_array[i] = obj[i];
|
||||
}
|
||||
return typed_array;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!Array.prototype.copyWithin) {
|
||||
Array.prototype.copyWithin = function(target, start, end) {
|
||||
var O = Object(this);
|
||||
var len = O.length >>> 0;
|
||||
var to = target | 0;
|
||||
var from = start | 0;
|
||||
var count = Math.min(Math.min(end | 0, len) - from, len - to);
|
||||
var direction = 1;
|
||||
if (from < to && to < (from + count)) {
|
||||
direction = -1;
|
||||
from += count - 1;
|
||||
to += count - 1;
|
||||
}
|
||||
while (count > 0) {
|
||||
O[to] = O[from];
|
||||
from += direction;
|
||||
to += direction;
|
||||
count--;
|
||||
}
|
||||
return O;
|
||||
};
|
||||
}
|
||||
|
||||
if (!Array.prototype.fill) {
|
||||
Object.defineProperty(Array.prototype, 'fill', {
|
||||
value: function(value, start, end) {
|
||||
end = end | 0;
|
||||
var O = Object(this);
|
||||
var k = start | 0;
|
||||
while (k < end) {
|
||||
O[k] = value;
|
||||
k++;
|
||||
}
|
||||
return O;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!Int8Array.prototype.copyWithin) {
|
||||
Int8Array.prototype.copyWithin = Array.prototype.copyWithin;
|
||||
}
|
||||
|
||||
if (!Int8Array.prototype.fill) {
|
||||
Int8Array.prototype.fill = Array.prototype.fill;
|
||||
}
|
||||
|
||||
if (!Int32Array.prototype.fill) {
|
||||
Int32Array.prototype.fill = Array.prototype.fill;
|
||||
}
|
||||
Reference in New Issue
Block a user