Merging with upstream master

This commit is contained in:
n1474335 2017-03-21 23:18:59 +00:00
commit b5078599dc
11 changed files with 102 additions and 67 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -151,6 +151,10 @@ var FlowControl = {
jumpNum = ings[0],
maxJumps = ings[1];
if (jumpNum < 0) {
jumpNum--;
}
if (state.numJumps >= maxJumps) {
return state;
}
@ -178,6 +182,10 @@ var FlowControl = {
jumpNum = ings[1],
maxJumps = ings[2];
if (jumpNum < 0) {
jumpNum--;
}
if (state.numJumps >= maxJumps) {
return state;
}

View file

@ -1028,20 +1028,37 @@ var Utils = {
};
var formatFile = function(file, i) {
var blob = new Blob(
[new Uint8Array(file.bytes)],
{type: "octet/stream"}
);
var blobUrl = URL.createObjectURL(blob);
var downloadAnchorElem = "<a href='" + blobUrl + "' " +
"title='Download " + Utils.escapeHtml(file.fileName) + "' " +
"download='" + Utils.escapeHtml(file.fileName) + "'>\u21B4</a>";
var expandFileContentsElem = "<a href='#collapse" + i + "' " +
"class='collapsed' " +
"data-toggle='collapse' " +
"aria-expanded='true' " +
"aria-controls='collapse" + i + "' " +
"title=\"Show/hide contents of '" + Utils.escapeHtml(file.fileName) + "'\">&#x1F50D</a>";
var html = "<div class='panel panel-default'>" +
"<div class='panel-heading' role='tab' id='heading" + i + "'>" +
"<h4 class='panel-title'>" +
"<a class='collapsed' role='button' data-toggle='collapse' " +
"href='#collapse" + i + "' " +
"aria-expanded='true' aria-controls='collapse" + i +"'>" +
file.fileName +
"<div>" +
Utils.escapeHtml(file.fileName) +
" " + expandFileContentsElem +
" " + downloadAnchorElem +
"<span class='pull-right'>" +
// These are for formatting when stripping HTML
"<span style='display: none'>\n</span>" +
file.size.toLocaleString() + " bytes" +
"<span style='display: none'>\n</span>" +
"</span>" +
"</a>" +
"</div>" +
"</h4>" +
"</div>" +
"<div id='collapse" + i + "' class='panel-collapse collapse' " +

View file

@ -31,6 +31,7 @@ var Base64 = {
{name: "Xxencoding: +-0-9A-Za-z", value: "+\\-0-9A-Za-z"},
{name: "BinHex: !-,-0-689@A-NP-VX-Z[`a-fh-mp-r", value: "!-,-0-689@A-NP-VX-Z[`a-fh-mp-r"},
{name: "ROT13: N-ZA-Mn-za-m0-9+/=", value: "N-ZA-Mn-za-m0-9+/="},
{name: "UNIX crypt: ./0-9A-Za-z", value: "./0-9A-Za-z"},
],
/**

View file

@ -309,9 +309,8 @@ var Compress = {
files = [];
filenames.forEach(function(fileName) {
var contents = unzip.decompress(fileName);
contents = Utils.byteArrayToUtf8(contents);
var bytes = unzip.decompress(fileName);
var contents = Utils.byteArrayToUtf8(bytes);
var file = {
fileName: fileName,
@ -320,6 +319,7 @@ var Compress = {
var isDir = contents.length === 0 && fileName.endsWith("/");
if (!isDir) {
file.bytes = bytes;
file.contents = contents;
}
@ -477,6 +477,13 @@ var Compress = {
this.position = 0;
};
Stream.prototype.getBytes = function(bytesToGet) {
var newPosition = this.position + bytesToGet;
var bytes = this.bytes.slice(this.position, newPosition);
this.position = newPosition;
return bytes;
};
Stream.prototype.readString = function(numBytes) {
var result = "";
for (var i = this.position; i < this.position + numBytes; i++) {
@ -535,11 +542,9 @@ var Compress = {
endPosition += 512 - (file.size % 512);
}
file.contents = "";
while (stream.position < endPosition) {
file.contents += stream.readString(512);
}
file.bytes = stream.getBytes(file.size);
file.contents = Utils.byteArrayToUtf8(file.bytes);
stream.position = endPosition;
} else if (file.type === "5") {
// Directory
files.push(file);

View file

@ -19,8 +19,8 @@ var HTTP = {
* @returns {string}
*/
runStripHeaders: function(input, args) {
var headerEnd = input.indexOf("\r\n\r\n") +
(headerEnd < 0) ? input.indexOf("\n\n") + 2 : headerEnd + 4;
var headerEnd = input.indexOf("\r\n\r\n");
headerEnd = (headerEnd < 0) ? input.indexOf("\n\n") + 2 : headerEnd + 4;
return (headerEnd < 2) ? input : input.slice(headerEnd, input.length);
},

View file

@ -209,6 +209,22 @@ var IP = {
output += "\nThis is a reserved multicast address.";
output += "\nMulticast addresses range: ff00::/8";
}
// Detect possible EUI-64 addresses
if ((ipv6[5] & 0xff === 0xff) && (ipv6[6] >>> 8 === 0xfe)) {
output += "\n\nThis IPv6 address contains a modified EUI-64 address, identified by the presence of FF:FE in the 12th and 13th octets.";
var intIdent = Utils.hex(ipv6[4] >>> 8) + ":" + Utils.hex(ipv6[4] & 0xff) + ":" +
Utils.hex(ipv6[5] >>> 8) + ":" + Utils.hex(ipv6[5] & 0xff) + ":" +
Utils.hex(ipv6[6] >>> 8) + ":" + Utils.hex(ipv6[6] & 0xff) + ":" +
Utils.hex(ipv6[7] >>> 8) + ":" + Utils.hex(ipv6[7] & 0xff),
mac = Utils.hex((ipv6[4] >>> 8) ^ 2) + ":" + Utils.hex(ipv6[4] & 0xff) + ":" +
Utils.hex(ipv6[5] >>> 8) + ":" + Utils.hex(ipv6[6] & 0xff) + ":" +
Utils.hex(ipv6[7] >>> 8) + ":" + Utils.hex(ipv6[7] & 0xff);
output += "\nInterface identifier: " + intIdent +
"\nMAC address: " + mac;
}
} else {
return "Invalid IPv6 address";
}

View file

@ -1,35 +1,21 @@
214 source files
<<<<<<< HEAD
115922 lines
4.3M size
117639 lines
4.4M size
144 JavaScript source files
106730 lines
145 JavaScript source files
108404 lines
3.8M size
=======
116142 lines
size
144 JavaScript source files
106912 lines
4.9M size
>>>>>>> 9404f1e0b82fc74a83561a2184ce524f358f375f
83 third party JavaScript source files
86259 lines
3.7M size
84 third party JavaScript source files
87417 lines
3.1M size
61 first party JavaScript source files
<<<<<<< HEAD
20471 lines
764K size
=======
20653 lines
1.3M size
>>>>>>> 9404f1e0b82fc74a83561a2184ce524f358f375f
20987 lines
780K size
uncompressed JavaScript size
compressed JavaScript size
3.5M uncompressed JavaScript size
1.9M compressed JavaScript size
15 categories
177 operations
178 operations