mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 20:30:04 +02:00
update node modules
This commit is contained in:
30
node_modules/whatwg-url/lib/url-state-machine.js
generated
vendored
30
node_modules/whatwg-url/lib/url-state-machine.js
generated
vendored
@@ -63,6 +63,10 @@ function isSpecial(url) {
|
||||
return isSpecialScheme(url.scheme);
|
||||
}
|
||||
|
||||
function isNotSpecial(url) {
|
||||
return !isSpecialScheme(url.scheme);
|
||||
}
|
||||
|
||||
function defaultPort(scheme) {
|
||||
return specialSchemes[scheme];
|
||||
}
|
||||
@@ -358,7 +362,7 @@ function serializeIPv6(address) {
|
||||
return output;
|
||||
}
|
||||
|
||||
function parseHost(input, isSpecialArg) {
|
||||
function parseHost(input, isNotSpecialArg = false) {
|
||||
if (input[0] === "[") {
|
||||
if (input[input.length - 1] !== "]") {
|
||||
return failure;
|
||||
@@ -367,7 +371,7 @@ function parseHost(input, isSpecialArg) {
|
||||
return parseIPv6(input.substring(1, input.length - 1));
|
||||
}
|
||||
|
||||
if (!isSpecialArg) {
|
||||
if (isNotSpecialArg) {
|
||||
return parseOpaqueHost(input);
|
||||
}
|
||||
|
||||
@@ -816,7 +820,7 @@ URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) {
|
||||
return failure;
|
||||
}
|
||||
|
||||
const host = parseHost(this.buffer, isSpecial(this.url));
|
||||
const host = parseHost(this.buffer, isNotSpecial(this.url));
|
||||
if (host === failure) {
|
||||
return failure;
|
||||
}
|
||||
@@ -839,7 +843,7 @@ URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const host = parseHost(this.buffer, isSpecial(this.url));
|
||||
const host = parseHost(this.buffer, isNotSpecial(this.url));
|
||||
if (host === failure) {
|
||||
return failure;
|
||||
}
|
||||
@@ -978,7 +982,7 @@ URLStateMachine.prototype["parse file host"] = function parseFileHost(c, cStr) {
|
||||
}
|
||||
this.state = "path start";
|
||||
} else {
|
||||
let host = parseHost(this.buffer, isSpecial(this.url));
|
||||
let host = parseHost(this.buffer, isNotSpecial(this.url));
|
||||
if (host === failure) {
|
||||
return failure;
|
||||
}
|
||||
@@ -1117,8 +1121,10 @@ URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) {
|
||||
|
||||
const buffer = Buffer.from(this.buffer); // TODO: Use encoding override instead
|
||||
for (let i = 0; i < buffer.length; ++i) {
|
||||
if (buffer[i] < 0x21 || buffer[i] > 0x7E || buffer[i] === 0x22 || buffer[i] === 0x23 ||
|
||||
buffer[i] === 0x3C || buffer[i] === 0x3E) {
|
||||
if (buffer[i] < 0x21 ||
|
||||
buffer[i] > 0x7E ||
|
||||
buffer[i] === 0x22 || buffer[i] === 0x23 || buffer[i] === 0x3C || buffer[i] === 0x3E ||
|
||||
(buffer[i] === 0x27 && isSpecial(this.url))) {
|
||||
this.url.query += percentEncode(buffer[i]);
|
||||
} else {
|
||||
this.url.query += String.fromCodePoint(buffer[i]);
|
||||
@@ -1238,8 +1244,14 @@ module.exports.serializeURLOrigin = function (url) {
|
||||
port: url.port
|
||||
});
|
||||
case "file":
|
||||
// spec says "exercise to the reader", chrome says "file://"
|
||||
return "file://";
|
||||
// The spec says:
|
||||
// > Unfortunate as it is, this is left as an exercise to the reader. When in doubt, return a new opaque origin.
|
||||
// Browsers tested so far:
|
||||
// - Chrome says "file://", but treats file: URLs as cross-origin for most (all?) purposes; see e.g.
|
||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=37586
|
||||
// - Firefox says "null", but treats file: URLs as same-origin sometimes based on directory stuff; see
|
||||
// https://developer.mozilla.org/en-US/docs/Archive/Misc_top_level/Same-origin_policy_for_file:_URIs
|
||||
return "null";
|
||||
default:
|
||||
// serializing an opaque origin returns "null"
|
||||
return "null";
|
||||
|
Reference in New Issue
Block a user