core-js 3.48.0 → 3.50.0
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.
- package/README.md +2 -2
- package/actual/iterator/chunks.js +8 -0
- package/actual/iterator/concat.js +4 -0
- package/actual/iterator/from.js +4 -0
- package/actual/iterator/includes.js +8 -0
- package/actual/iterator/index.js +4 -1
- package/actual/iterator/join.js +8 -0
- package/actual/iterator/windows.js +8 -0
- package/actual/iterator/zip-keyed.js +6 -21
- package/actual/iterator/zip.js +6 -19
- package/actual/promise/all-keyed.js +16 -0
- package/actual/promise/all-settled-keyed.js +16 -0
- package/actual/promise/index.js +4 -0
- package/configurator.js +1 -1
- package/es/index.js +2 -0
- package/es/iterator/index.js +4 -0
- package/es/iterator/zip-keyed.js +24 -0
- package/es/iterator/zip.js +22 -0
- package/es/object/define-properties.js +2 -2
- package/es/object/define-property.js +2 -2
- package/es/object/get-own-property-descriptor.js +2 -2
- package/es/promise/try.js +2 -2
- package/features/iterator/includes.js +2 -0
- package/features/iterator/join.js +2 -0
- package/features/promise/all-keyed.js +2 -0
- package/features/promise/all-settled-keyed.js +2 -0
- package/full/index.js +6 -0
- package/full/iterator/chunks.js +2 -6
- package/full/iterator/concat.js +0 -2
- package/full/iterator/from.js +0 -2
- package/full/iterator/includes.js +4 -0
- package/full/iterator/index.js +0 -2
- package/full/iterator/join.js +4 -0
- package/full/iterator/range.js +3 -1
- package/full/iterator/windows.js +2 -6
- package/full/iterator/zip-keyed.js +0 -2
- package/full/iterator/zip.js +0 -2
- package/full/promise/all-keyed.js +4 -0
- package/full/promise/all-settled-keyed.js +4 -0
- package/internals/add-disposable-resource.js +1 -1
- package/internals/advance-string-index.js +1 -1
- package/internals/array-buffer-transfer.js +4 -1
- package/internals/array-buffer-view-core.js +1 -1
- package/internals/array-buffer.js +1 -2
- package/internals/array-fill.js +2 -1
- package/internals/array-from-async.js +7 -9
- package/internals/array-from.js +15 -4
- package/internals/async-from-sync-iterator.js +28 -4
- package/internals/async-iterator-close.js +11 -3
- package/internals/async-iterator-create-proxy.js +61 -22
- package/internals/async-iterator-iteration.js +7 -4
- package/internals/async-iterator-map.js +20 -18
- package/internals/does-not-exceed-safe-integer.js +1 -1
- package/internals/environment-is-ios.js +1 -2
- package/internals/error-stack-clear.js +1 -1
- package/internals/function-bind-native.js +1 -1
- package/internals/function-name.js +1 -1
- package/internals/get-async-iterator-flattenable.js +1 -1
- package/internals/get-async-iterator.js +1 -1
- package/internals/get-internal-iterator.js +1 -0
- package/internals/get-iterator-flattenable.js +1 -1
- package/internals/get-iterator-internal.js +14 -0
- package/internals/get-iterator-method-internal.js +14 -0
- package/internals/get-iterator-method.js +4 -7
- package/internals/get-iterator-record.js +1 -1
- package/internals/get-iterator.js +4 -5
- package/internals/is-iterable.js +4 -10
- package/internals/iterate.js +10 -5
- package/internals/iterator-chunk-size-validation.js +17 -0
- package/internals/iterator-cleanup-state.js +6 -0
- package/internals/iterator-create-proxy.js +14 -5
- package/internals/iterator-window.js +4 -6
- package/internals/iterator-zip.js +4 -3
- package/internals/iterators.js +1 -1
- package/internals/math-log1p.js +3 -1
- package/internals/numeric-range-iterator.js +9 -4
- package/internals/regexp-exec.js +20 -13
- package/internals/set-difference.js +1 -1
- package/internals/set-is-disjoint-from.js +1 -1
- package/internals/set-is-superset-of.js +1 -1
- package/internals/shared-store.js +2 -2
- package/internals/shared.js +3 -1
- package/internals/string-pad.js +2 -1
- package/internals/string-parse.js +1 -1
- package/internals/string-repeat.js +2 -1
- package/internals/to-uint8-clamped.js +11 -3
- package/internals/typed-array-constructor.js +1 -2
- package/internals/typed-array-from.js +5 -3
- package/internals/uint8-from-base64.js +4 -2
- package/internals/uint8-from-hex.js +10 -10
- package/internals/url-percent-coding.js +171 -0
- package/modules/es.array.flat.js +2 -1
- package/modules/es.array.from-async.js +1 -1
- package/modules/es.array.includes.js +7 -1
- package/modules/es.array.sort.js +3 -1
- package/modules/es.data-view.get-float16.js +1 -1
- package/modules/es.data-view.set-float16.js +2 -1
- package/modules/es.date.set-year.js +4 -1
- package/modules/es.date.to-json.js +1 -1
- package/modules/es.error.is-error.js +1 -1
- package/modules/es.escape.js +10 -8
- package/modules/es.iterator.concat.js +5 -4
- package/modules/es.iterator.drop.js +16 -1
- package/modules/es.iterator.flat-map.js +12 -14
- package/modules/es.iterator.take.js +22 -2
- package/modules/es.iterator.zip-keyed.js +70 -0
- package/modules/es.iterator.zip.js +92 -0
- package/modules/es.json.parse.js +14 -2
- package/modules/es.json.stringify.js +157 -38
- package/modules/es.map.get-or-insert-computed.js +3 -4
- package/modules/es.map.get-or-insert.js +2 -3
- package/modules/es.map.group-by.js +2 -0
- package/modules/es.math.asinh.js +6 -1
- package/modules/es.math.atanh.js +2 -2
- package/modules/es.math.cbrt.js +3 -1
- package/modules/es.math.sum-precise.js +3 -3
- package/modules/es.number.to-exponential.js +15 -6
- package/modules/es.object.group-by.js +2 -0
- package/modules/es.object.proto.js +2 -1
- package/modules/es.promise.try.js +16 -8
- package/modules/es.reflect.construct.js +1 -1
- package/modules/es.reflect.define-property.js +10 -0
- package/modules/es.reflect.delete-property.js +5 -2
- package/modules/es.reflect.get.js +9 -7
- package/modules/es.reflect.set.js +14 -9
- package/modules/es.regexp.constructor.js +16 -5
- package/modules/es.string.ends-with.js +1 -1
- package/modules/es.string.from-code-point.js +2 -2
- package/modules/es.string.match-all.js +1 -1
- package/modules/es.string.match.js +5 -3
- package/modules/es.string.replace.js +9 -8
- package/modules/es.string.search.js +3 -1
- package/modules/es.string.split.js +7 -5
- package/modules/es.string.starts-with.js +1 -1
- package/modules/es.string.substr.js +5 -7
- package/modules/es.symbol.constructor.js +3 -2
- package/modules/es.symbol.description.js +9 -0
- package/modules/es.typed-array.sort.js +3 -3
- package/modules/es.uint8-array.from-base64.js +1 -1
- package/modules/es.uint8-array.from-hex.js +1 -1
- package/modules/es.uint8-array.set-from-base64.js +1 -1
- package/modules/es.uint8-array.set-from-hex.js +1 -1
- package/modules/es.uint8-array.to-base64.js +23 -6
- package/modules/es.uint8-array.to-hex.js +6 -4
- package/modules/es.weak-map.get-or-insert-computed.js +2 -2
- package/modules/es.weak-map.get-or-insert.js +2 -3
- package/modules/esnext.array.is-template-object.js +1 -1
- package/modules/esnext.async-iterator.reduce.js +2 -2
- package/modules/esnext.async-iterator.take.js +4 -2
- package/modules/esnext.bigint.range.js +1 -1
- package/modules/esnext.iterator.chunks.js +6 -8
- package/modules/esnext.iterator.includes.js +44 -0
- package/modules/esnext.iterator.join.js +31 -0
- package/modules/esnext.iterator.range.js +1 -1
- package/modules/esnext.iterator.windows.js +2 -1
- package/modules/esnext.iterator.zip-keyed.js +2 -70
- package/modules/esnext.iterator.zip.js +2 -90
- package/modules/esnext.number.from-string.js +30 -3
- package/modules/esnext.number.range.js +1 -1
- package/modules/esnext.observable.from.js +6 -3
- package/modules/esnext.promise.all-keyed.js +57 -0
- package/modules/esnext.promise.all-settled-keyed.js +60 -0
- package/modules/esnext.string.dedent.js +1 -1
- package/modules/web.atob.js +15 -6
- package/modules/web.btoa.js +10 -3
- package/modules/web.structured-clone.js +2 -2
- package/modules/web.url-search-params.constructor.js +13 -130
- package/modules/web.url-search-params.delete.js +6 -9
- package/modules/web.url.constructor.js +154 -39
- package/modules/web.url.parse.js +1 -1
- package/modules/web.url.to-json.js +4 -1
- package/package.json +8 -1
- package/proposals/await-dictionary.js +4 -0
- package/proposals/iterator-includes.js +3 -0
- package/proposals/iterator-join.js +3 -0
- package/stable/index.js +2 -0
- package/stable/iterator/zip-keyed.js +5 -0
- package/stable/iterator/zip.js +5 -0
- package/stage/3.js +4 -0
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`
|
|
3
3
|
require('../modules/es.array.iterator');
|
|
4
|
-
require('../modules/es.string.from-code-point');
|
|
5
4
|
var $ = require('../internals/export');
|
|
6
5
|
var globalThis = require('../internals/global-this');
|
|
7
6
|
var safeGetBuiltIn = require('../internals/safe-get-built-in');
|
|
8
|
-
var getBuiltIn = require('../internals/get-built-in');
|
|
9
7
|
var call = require('../internals/function-call');
|
|
10
8
|
var uncurryThis = require('../internals/function-uncurry-this');
|
|
11
9
|
var DESCRIPTORS = require('../internals/descriptors');
|
|
12
10
|
var USE_NATIVE_URL = require('../internals/url-constructor-detection');
|
|
11
|
+
var percentCoding = require('../internals/url-percent-coding');
|
|
13
12
|
var defineBuiltIn = require('../internals/define-built-in');
|
|
14
13
|
var defineBuiltInAccessor = require('../internals/define-built-in-accessor');
|
|
15
14
|
var defineBuiltIns = require('../internals/define-built-ins');
|
|
@@ -26,8 +25,8 @@ var isObject = require('../internals/is-object');
|
|
|
26
25
|
var $toString = require('../internals/to-string');
|
|
27
26
|
var create = require('../internals/object-create');
|
|
28
27
|
var createPropertyDescriptor = require('../internals/create-property-descriptor');
|
|
29
|
-
var getIterator = require('../internals/get-iterator');
|
|
30
|
-
var getIteratorMethod = require('../internals/get-iterator-method');
|
|
28
|
+
var getIterator = require('../internals/get-iterator-internal');
|
|
29
|
+
var getIteratorMethod = require('../internals/get-iterator-method-internal');
|
|
31
30
|
var createIterResultObject = require('../internals/create-iter-result-object');
|
|
32
31
|
var validateArgumentsLength = require('../internals/validate-arguments-length');
|
|
33
32
|
var wellKnownSymbol = require('../internals/well-known-symbol');
|
|
@@ -39,6 +38,8 @@ var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator';
|
|
|
39
38
|
var setInternalState = InternalStateModule.set;
|
|
40
39
|
var getInternalParamsState = InternalStateModule.getterFor(URL_SEARCH_PARAMS);
|
|
41
40
|
var getInternalIteratorState = InternalStateModule.getterFor(URL_SEARCH_PARAMS_ITERATOR);
|
|
41
|
+
var percentDecode = percentCoding.decode;
|
|
42
|
+
var percentEncode = percentCoding.encode;
|
|
42
43
|
|
|
43
44
|
var nativeFetch = safeGetBuiltIn('fetch');
|
|
44
45
|
var NativeRequest = safeGetBuiltIn('Request');
|
|
@@ -46,10 +47,6 @@ var Headers = safeGetBuiltIn('Headers');
|
|
|
46
47
|
var RequestPrototype = NativeRequest && NativeRequest.prototype;
|
|
47
48
|
var HeadersPrototype = Headers && Headers.prototype;
|
|
48
49
|
var TypeError = globalThis.TypeError;
|
|
49
|
-
var encodeURIComponent = globalThis.encodeURIComponent;
|
|
50
|
-
var fromCharCode = String.fromCharCode;
|
|
51
|
-
var fromCodePoint = getBuiltIn('String', 'fromCodePoint');
|
|
52
|
-
var $parseInt = parseInt;
|
|
53
50
|
var charAt = uncurryThis(''.charAt);
|
|
54
51
|
var join = uncurryThis([].join);
|
|
55
52
|
var push = uncurryThis([].push);
|
|
@@ -58,125 +55,12 @@ var shift = uncurryThis([].shift);
|
|
|
58
55
|
var splice = uncurryThis([].splice);
|
|
59
56
|
var split = uncurryThis(''.split);
|
|
60
57
|
var stringSlice = uncurryThis(''.slice);
|
|
61
|
-
var exec = uncurryThis(/./.exec);
|
|
62
58
|
|
|
63
59
|
var plus = /\+/g;
|
|
64
|
-
var FALLBACK_REPLACER = '\uFFFD';
|
|
65
|
-
var VALID_HEX = /^[0-9a-f]+$/i;
|
|
66
60
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return $parseInt(substr, 16);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
var getLeadingOnes = function (octet) {
|
|
75
|
-
var count = 0;
|
|
76
|
-
for (var mask = 0x80; mask > 0 && (octet & mask) !== 0; mask >>= 1) {
|
|
77
|
-
count++;
|
|
78
|
-
}
|
|
79
|
-
return count;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
var utf8Decode = function (octets) {
|
|
83
|
-
var codePoint = null;
|
|
84
|
-
|
|
85
|
-
switch (octets.length) {
|
|
86
|
-
case 1:
|
|
87
|
-
codePoint = octets[0];
|
|
88
|
-
break;
|
|
89
|
-
case 2:
|
|
90
|
-
codePoint = (octets[0] & 0x1F) << 6 | (octets[1] & 0x3F);
|
|
91
|
-
break;
|
|
92
|
-
case 3:
|
|
93
|
-
codePoint = (octets[0] & 0x0F) << 12 | (octets[1] & 0x3F) << 6 | (octets[2] & 0x3F);
|
|
94
|
-
break;
|
|
95
|
-
case 4:
|
|
96
|
-
codePoint = (octets[0] & 0x07) << 18 | (octets[1] & 0x3F) << 12 | (octets[2] & 0x3F) << 6 | (octets[3] & 0x3F);
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return codePoint > 0x10FFFF ? null : codePoint;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
var decode = function (input) {
|
|
104
|
-
input = replace(input, plus, ' ');
|
|
105
|
-
var length = input.length;
|
|
106
|
-
var result = '';
|
|
107
|
-
var i = 0;
|
|
108
|
-
|
|
109
|
-
while (i < length) {
|
|
110
|
-
var decodedChar = charAt(input, i);
|
|
111
|
-
|
|
112
|
-
if (decodedChar === '%') {
|
|
113
|
-
if (charAt(input, i + 1) === '%' || i + 3 > length) {
|
|
114
|
-
result += '%';
|
|
115
|
-
i++;
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
var octet = parseHexOctet(input, i + 1);
|
|
120
|
-
|
|
121
|
-
// eslint-disable-next-line no-self-compare -- NaN check
|
|
122
|
-
if (octet !== octet) {
|
|
123
|
-
result += decodedChar;
|
|
124
|
-
i++;
|
|
125
|
-
continue;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
i += 2;
|
|
129
|
-
var byteSequenceLength = getLeadingOnes(octet);
|
|
130
|
-
|
|
131
|
-
if (byteSequenceLength === 0) {
|
|
132
|
-
decodedChar = fromCharCode(octet);
|
|
133
|
-
} else {
|
|
134
|
-
if (byteSequenceLength === 1 || byteSequenceLength > 4) {
|
|
135
|
-
result += FALLBACK_REPLACER;
|
|
136
|
-
i++;
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
var octets = [octet];
|
|
141
|
-
var sequenceIndex = 1;
|
|
142
|
-
|
|
143
|
-
while (sequenceIndex < byteSequenceLength) {
|
|
144
|
-
i++;
|
|
145
|
-
if (i + 3 > length || charAt(input, i) !== '%') break;
|
|
146
|
-
|
|
147
|
-
var nextByte = parseHexOctet(input, i + 1);
|
|
148
|
-
|
|
149
|
-
// eslint-disable-next-line no-self-compare -- NaN check
|
|
150
|
-
if (nextByte !== nextByte) {
|
|
151
|
-
i += 3;
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
if (nextByte > 191 || nextByte < 128) break;
|
|
155
|
-
|
|
156
|
-
push(octets, nextByte);
|
|
157
|
-
i += 2;
|
|
158
|
-
sequenceIndex++;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (octets.length !== byteSequenceLength) {
|
|
162
|
-
result += FALLBACK_REPLACER;
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
var codePoint = utf8Decode(octets);
|
|
167
|
-
if (codePoint === null) {
|
|
168
|
-
result += FALLBACK_REPLACER;
|
|
169
|
-
} else {
|
|
170
|
-
decodedChar = fromCodePoint(codePoint);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
result += decodedChar;
|
|
176
|
-
i++;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return result;
|
|
61
|
+
// https://url.spec.whatwg.org/#urlencoded-parsing - `+` decodes to a space
|
|
62
|
+
var decodeQueryComponent = function (input) {
|
|
63
|
+
return percentDecode(replace(input, plus, ' '));
|
|
180
64
|
};
|
|
181
65
|
|
|
182
66
|
var find = /[!'()~]|%20/g;
|
|
@@ -195,7 +79,7 @@ var replacer = function (match) {
|
|
|
195
79
|
};
|
|
196
80
|
|
|
197
81
|
var serialize = function (it) {
|
|
198
|
-
return replace(
|
|
82
|
+
return replace(percentEncode(it), find, replacer);
|
|
199
83
|
};
|
|
200
84
|
|
|
201
85
|
var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) {
|
|
@@ -269,8 +153,8 @@ URLSearchParamsState.prototype = {
|
|
|
269
153
|
if (attribute.length) {
|
|
270
154
|
entry = split(attribute, '=');
|
|
271
155
|
push(entries, {
|
|
272
|
-
key:
|
|
273
|
-
value:
|
|
156
|
+
key: decodeQueryComponent(shift(entry)),
|
|
157
|
+
value: decodeQueryComponent(join(entry, '='))
|
|
274
158
|
});
|
|
275
159
|
}
|
|
276
160
|
}
|
|
@@ -330,7 +214,6 @@ defineBuiltIns(URLSearchParamsPrototype, {
|
|
|
330
214
|
var entry = entries[index];
|
|
331
215
|
if (entry.key === key && (value === undefined || entry.value === value)) {
|
|
332
216
|
splice(entries, index, 1);
|
|
333
|
-
if (value !== undefined) break;
|
|
334
217
|
} else index++;
|
|
335
218
|
}
|
|
336
219
|
if (!DESCRIPTORS) this.size = entries.length;
|
|
@@ -380,7 +263,7 @@ defineBuiltIns(URLSearchParamsPrototype, {
|
|
|
380
263
|
// https://url.spec.whatwg.org/#dom-urlsearchparams-set
|
|
381
264
|
set: function set(name, value) {
|
|
382
265
|
var state = getInternalParamsState(this);
|
|
383
|
-
validateArgumentsLength(arguments.length,
|
|
266
|
+
validateArgumentsLength(arguments.length, 2);
|
|
384
267
|
var entries = state.entries;
|
|
385
268
|
var found = false;
|
|
386
269
|
var key = $toString(name);
|
|
@@ -445,7 +328,7 @@ defineBuiltIn(URLSearchParamsPrototype, 'toString', function toString() {
|
|
|
445
328
|
}, { enumerable: true });
|
|
446
329
|
|
|
447
330
|
// `URLSearchParams.prototype.size` getter
|
|
448
|
-
// https://
|
|
331
|
+
// https://url.spec.whatwg.org/#dom-urlsearchparams-size
|
|
449
332
|
if (DESCRIPTORS) defineBuiltInAccessor(URLSearchParamsPrototype, 'size', {
|
|
450
333
|
get: function size() {
|
|
451
334
|
return getInternalParamsState(this).entries.length;
|
|
@@ -30,19 +30,16 @@ if (params + '' !== 'a=2') {
|
|
|
30
30
|
var key = toString(name);
|
|
31
31
|
var value = toString($value);
|
|
32
32
|
var index = 0;
|
|
33
|
-
var dindex = 0;
|
|
34
|
-
var found = false;
|
|
35
33
|
var entriesLength = entries.length;
|
|
36
34
|
var entry;
|
|
37
35
|
while (index < entriesLength) {
|
|
38
|
-
entry = entries[index
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
$delete(this, entry.key);
|
|
42
|
-
} else dindex++;
|
|
36
|
+
entry = entries[index];
|
|
37
|
+
$delete(this, entry.key);
|
|
38
|
+
index++;
|
|
43
39
|
}
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
index = 0;
|
|
41
|
+
while (index < entriesLength) {
|
|
42
|
+
entry = entries[index++];
|
|
46
43
|
if (!(entry.key === key && entry.value === value)) append(this, entry.key, entry.value);
|
|
47
44
|
}
|
|
48
45
|
}, { enumerable: true, unsafe: true });
|
|
@@ -16,6 +16,7 @@ var arrayFrom = require('../internals/array-from');
|
|
|
16
16
|
var arraySlice = require('../internals/array-slice');
|
|
17
17
|
var codeAt = require('../internals/string-multibyte').codeAt;
|
|
18
18
|
var toASCII = require('../internals/string-punycode-to-ascii');
|
|
19
|
+
var percentCoding = require('../internals/url-percent-coding');
|
|
19
20
|
var $toString = require('../internals/to-string');
|
|
20
21
|
var setToStringTag = require('../internals/set-to-string-tag');
|
|
21
22
|
var validateArgumentsLength = require('../internals/validate-arguments-length');
|
|
@@ -26,12 +27,15 @@ var setInternalState = InternalStateModule.set;
|
|
|
26
27
|
var getInternalURLState = InternalStateModule.getterFor('URL');
|
|
27
28
|
var URLSearchParams = URLSearchParamsModule.URLSearchParams;
|
|
28
29
|
var getInternalSearchParamsState = URLSearchParamsModule.getState;
|
|
30
|
+
var percentDecode = percentCoding.decode;
|
|
31
|
+
var percentEncode = percentCoding.encode;
|
|
29
32
|
|
|
30
33
|
var NativeURL = globalThis.URL;
|
|
31
34
|
var TypeError = globalThis.TypeError;
|
|
32
35
|
var parseInt = globalThis.parseInt;
|
|
33
36
|
var floor = Math.floor;
|
|
34
37
|
var pow = Math.pow;
|
|
38
|
+
var fromCharCode = String.fromCharCode;
|
|
35
39
|
var charAt = uncurryThis(''.charAt);
|
|
36
40
|
var exec = uncurryThis(/./.exec);
|
|
37
41
|
var join = uncurryThis([].join);
|
|
@@ -41,6 +45,7 @@ var push = uncurryThis([].push);
|
|
|
41
45
|
var replace = uncurryThis(''.replace);
|
|
42
46
|
var shift = uncurryThis([].shift);
|
|
43
47
|
var split = uncurryThis(''.split);
|
|
48
|
+
var stringIndexOf = uncurryThis(''.indexOf);
|
|
44
49
|
var stringSlice = uncurryThis(''.slice);
|
|
45
50
|
var toLowerCase = uncurryThis(''.toLowerCase);
|
|
46
51
|
var unshift = uncurryThis([].unshift);
|
|
@@ -51,24 +56,113 @@ var INVALID_HOST = 'Invalid host';
|
|
|
51
56
|
var INVALID_PORT = 'Invalid port';
|
|
52
57
|
|
|
53
58
|
var ALPHA = /[a-z]/i;
|
|
54
|
-
|
|
55
|
-
var ALPHANUMERIC = /[\d+-.a-z]/i;
|
|
59
|
+
var ALPHANUMERIC_PLUS_MINUS_DOT = /[\d+\-.a-z]/i;
|
|
56
60
|
var DIGIT = /\d/;
|
|
57
61
|
var HEX_START = /^0x/i;
|
|
58
62
|
var OCT = /^[0-7]+$/;
|
|
59
63
|
var DEC = /^\d+$/;
|
|
60
64
|
var HEX = /^[\da-f]+$/i;
|
|
61
65
|
/* eslint-disable regexp/no-control-character -- safe */
|
|
62
|
-
|
|
63
|
-
var
|
|
66
|
+
// https://url.spec.whatwg.org/#forbidden-domain-code-point
|
|
67
|
+
var FORBIDDEN_DOMAIN_CODE_POINT = /[\u0000-\u0020#%/:<>?@[\\\]^|\u007F]/;
|
|
68
|
+
// https://url.spec.whatwg.org/#forbidden-host-code-point
|
|
69
|
+
var FORBIDDEN_HOST_CODE_POINT = /[\0\t\n\r #/:<>?@[\\\]^|]/;
|
|
64
70
|
var LEADING_C0_CONTROL_OR_SPACE = /^[\u0000-\u0020]+/;
|
|
65
71
|
var TRAILING_C0_CONTROL_OR_SPACE = /(^|[^\u0000-\u0020])[\u0000-\u0020]+$/;
|
|
66
72
|
var TAB_AND_NEW_LINE = /[\t\n\r]/g;
|
|
73
|
+
var NON_ASCII = /[^\u0000-\u007F]/;
|
|
67
74
|
/* eslint-enable regexp/no-control-character -- safe */
|
|
75
|
+
// UTS#46 maps these onto a string containing a forbidden domain code point, so a domain
|
|
76
|
+
// holding one is rejected - listing them is far smaller than shipping the mapping table
|
|
77
|
+
var MAPPED_ONTO_FORBIDDEN = '\u00A8\u00AF\u00B4\u00B8\u02D8\u02D9\u02DA\u02DB\u02DC\u02DD\u037A\u0384\u0385\u1FBD\u1FBF\u1FC0'
|
|
78
|
+
+ '\u1FC1\u1FCD\u1FCE\u1FCF\u1FDD\u1FDE\u1FDF\u1FED\u1FEE\u1FFD\u1FFE\u2017\u203E\u2047\u2048\u2049'
|
|
79
|
+
+ '\u2100\u2101\u2105\u2106\u2A74\u309B\u309C\uFC5E\uFC5F\uFC60\uFC61\uFC62\uFC63\uFDFA\uFDFB\uFE13'
|
|
80
|
+
+ '\uFE16\uFE47\uFE48\uFE49\uFE4A\uFE4B\uFE4C\uFE55\uFE56\uFE5F\uFE64\uFE65\uFE68\uFE6A\uFE6B\uFE70'
|
|
81
|
+
+ '\uFE72\uFE74\uFE76\uFE78\uFE7A\uFE7C\uFE7E\uFFE3';
|
|
68
82
|
// eslint-disable-next-line no-unassigned-vars -- expected `undefined` value
|
|
69
83
|
var EOF;
|
|
70
84
|
|
|
71
|
-
// https://
|
|
85
|
+
// https://www.unicode.org/reports/tr46/#IDNA_Mapping_Table
|
|
86
|
+
var isIgnoredCodePoint = function (code) {
|
|
87
|
+
return code === 0xAD || code === 0x34F || code === 0x200B || code === 0x3164
|
|
88
|
+
|| code === 0xFEFF || code === 0xFFA0
|
|
89
|
+
|| (code >= 0x115F && code <= 0x1160)
|
|
90
|
+
|| (code >= 0x17B4 && code <= 0x17B5)
|
|
91
|
+
|| (code >= 0x180B && code <= 0x180F)
|
|
92
|
+
|| (code >= 0x2060 && code <= 0x2064) || (code >= 0x206A && code <= 0x206F)
|
|
93
|
+
|| (code >= 0xFE00 && code <= 0xFE0F)
|
|
94
|
+
|| (code >= 0xE0100 && code <= 0xE01EF);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
var isDisallowedCodePoint = function (code) {
|
|
98
|
+
return code === 0xFFFD
|
|
99
|
+
// lone surrogate - a matched pair is a single code point and never lands here
|
|
100
|
+
|| (code >= 0xD800 && code <= 0xDFFF)
|
|
101
|
+
// C1 controls
|
|
102
|
+
|| (code >= 0x80 && code <= 0x9F)
|
|
103
|
+
// line and paragraph separators, bidirectional formatting characters
|
|
104
|
+
|| (code >= 0x200E && code <= 0x200F) || (code >= 0x2028 && code <= 0x2029)
|
|
105
|
+
|| (code >= 0x202A && code <= 0x202E) || (code >= 0x2065 && code <= 0x2069)
|
|
106
|
+
// noncharacters
|
|
107
|
+
|| (code >= 0xFDD0 && code <= 0xFDEF) || (code & 0xFFFE) === 0xFFFE
|
|
108
|
+
// private use
|
|
109
|
+
|| (code >= 0xE000 && code <= 0xF8FF) || (code >= 0xF0000 && code <= 0x10FFFD);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
var mapCodePoint = function (code) {
|
|
113
|
+
// full-width forms
|
|
114
|
+
if (code >= 0xFF01 && code <= 0xFF5E) return code - 0xFEE0;
|
|
115
|
+
// spaces and the listed code points collapse onto a forbidden domain code point; a space
|
|
116
|
+
// stands in for the real mapping since either way the domain is rejected
|
|
117
|
+
if (code === 0xA0 || code === 0x1680 || code === 0x202F || code === 0x205F || code === 0x3000) return 0x20;
|
|
118
|
+
if (code >= 0x2000 && code <= 0x200A) return 0x20;
|
|
119
|
+
// the list holds no supplementary code point, and `fromCharCode` would truncate one
|
|
120
|
+
if (code <= 0xFFFF && stringIndexOf(MAPPED_ONTO_FORBIDDEN, fromCharCode(code)) > -1) return 0x20;
|
|
121
|
+
return code;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// https://url.spec.whatwg.org/#concept-domain-to-ascii
|
|
125
|
+
// A subset of UTS#46 processing - the full mapping table is too large to ship. Covered are the
|
|
126
|
+
// entries cheap to express: the ignored and disallowed code points, full-width forms, and the
|
|
127
|
+
// code points mapping onto a forbidden domain code point. Not covered, so such domains are
|
|
128
|
+
// punycoded rather than mapped or rejected: unassigned code points, half-width forms,
|
|
129
|
+
// compatibility decompositions, NFC, CheckJoiners, CheckBidi, and labels that already arrive
|
|
130
|
+
// punycoded - those are not decoded back for validation.
|
|
131
|
+
var domainToASCII = function (domain) {
|
|
132
|
+
// every mapped, ignored and disallowed code point is non-ASCII, so an ASCII domain
|
|
133
|
+
// needs the punycode step only - this keeps the common case off the slow path
|
|
134
|
+
if (!exec(NON_ASCII, domain)) return domain === '' ? null : toASCII(domain);
|
|
135
|
+
var codePoints = arrayFrom(domain);
|
|
136
|
+
var result = '';
|
|
137
|
+
var index, code, mapped;
|
|
138
|
+
for (index = 0; index < codePoints.length; index++) {
|
|
139
|
+
code = codeAt(codePoints[index], 0);
|
|
140
|
+
if (isDisallowedCodePoint(code)) return null;
|
|
141
|
+
if (isIgnoredCodePoint(code)) continue;
|
|
142
|
+
mapped = mapCodePoint(code);
|
|
143
|
+
result += mapped === code ? codePoints[index] : fromCharCode(mapped);
|
|
144
|
+
}
|
|
145
|
+
return result === '' ? null : toASCII(result);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// https://url.spec.whatwg.org/#ends-in-a-number-checker
|
|
149
|
+
var endsInNumber = function (input) {
|
|
150
|
+
var parts = split(input, '.');
|
|
151
|
+
var last, hexPart;
|
|
152
|
+
if (parts[parts.length - 1] === '') {
|
|
153
|
+
if (parts.length === 1) return false;
|
|
154
|
+
parts.length--;
|
|
155
|
+
}
|
|
156
|
+
last = parts[parts.length - 1];
|
|
157
|
+
if (exec(DEC, last)) return true;
|
|
158
|
+
if (exec(HEX_START, last)) {
|
|
159
|
+
hexPart = stringSlice(last, 2);
|
|
160
|
+
return hexPart === '' || !!exec(HEX, hexPart);
|
|
161
|
+
}
|
|
162
|
+
return false;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// https://url.spec.whatwg.org/#concept-ipv4-parser
|
|
72
166
|
var parseIPv4 = function (input) {
|
|
73
167
|
var parts = split(input, '.');
|
|
74
168
|
var partsLength, numbers, index, part, radix, number, ipv4;
|
|
@@ -76,11 +170,11 @@ var parseIPv4 = function (input) {
|
|
|
76
170
|
parts.length--;
|
|
77
171
|
}
|
|
78
172
|
partsLength = parts.length;
|
|
79
|
-
if (partsLength > 4) return
|
|
173
|
+
if (partsLength > 4) return null;
|
|
80
174
|
numbers = [];
|
|
81
175
|
for (index = 0; index < partsLength; index++) {
|
|
82
176
|
part = parts[index];
|
|
83
|
-
if (part === '') return
|
|
177
|
+
if (part === '') return null;
|
|
84
178
|
radix = 10;
|
|
85
179
|
if (part.length > 1 && charAt(part, 0) === '0') {
|
|
86
180
|
radix = exec(HEX_START, part) ? 16 : 8;
|
|
@@ -89,7 +183,7 @@ var parseIPv4 = function (input) {
|
|
|
89
183
|
if (part === '') {
|
|
90
184
|
number = 0;
|
|
91
185
|
} else {
|
|
92
|
-
if (!exec(radix === 10 ? DEC : radix === 8 ? OCT : HEX, part)) return
|
|
186
|
+
if (!exec(radix === 10 ? DEC : radix === 8 ? OCT : HEX, part)) return null;
|
|
93
187
|
number = parseInt(part, radix);
|
|
94
188
|
}
|
|
95
189
|
push(numbers, number);
|
|
@@ -242,20 +336,31 @@ var serializeHost = function (host) {
|
|
|
242
336
|
return host;
|
|
243
337
|
};
|
|
244
338
|
|
|
339
|
+
// https://url.spec.whatwg.org/#c0-control-percent-encode-set
|
|
340
|
+
// empty because the set is the code points outside U+0020..U+007E, which the range
|
|
341
|
+
// check below already covers; the sets extending it only add code points inside it
|
|
245
342
|
var C0ControlPercentEncodeSet = {};
|
|
343
|
+
var queryPercentEncodeSet = assign({}, C0ControlPercentEncodeSet, {
|
|
344
|
+
' ': 1, '"': 1, '#': 1, '<': 1, '>': 1
|
|
345
|
+
});
|
|
346
|
+
var specialQueryPercentEncodeSet = assign({}, queryPercentEncodeSet, {
|
|
347
|
+
"'": 1
|
|
348
|
+
});
|
|
246
349
|
var fragmentPercentEncodeSet = assign({}, C0ControlPercentEncodeSet, {
|
|
247
350
|
' ': 1, '"': 1, '<': 1, '>': 1, '`': 1
|
|
248
351
|
});
|
|
249
352
|
var pathPercentEncodeSet = assign({}, fragmentPercentEncodeSet, {
|
|
250
|
-
'#': 1, '?': 1, '{': 1, '}': 1
|
|
353
|
+
'#': 1, '?': 1, '{': 1, '}': 1, '^': 1
|
|
251
354
|
});
|
|
252
355
|
var userinfoPercentEncodeSet = assign({}, pathPercentEncodeSet, {
|
|
253
356
|
'/': 1, ':': 1, ';': 1, '=': 1, '@': 1, '[': 1, '\\': 1, ']': 1, '^': 1, '|': 1
|
|
254
357
|
});
|
|
255
358
|
|
|
256
|
-
|
|
359
|
+
// https://url.spec.whatwg.org/#string-utf-8-percent-encode
|
|
360
|
+
var utf8PercentEncode = function (chr, set) {
|
|
257
361
|
var code = codeAt(chr, 0);
|
|
258
|
-
|
|
362
|
+
// percent-encoding leaves ' alone, but it belongs to the special-query percent-encode set
|
|
363
|
+
return code >= 0x20 && code < 0x7F && !hasOwn(set, chr) ? chr : chr === "'" && hasOwn(set, chr) ? '%27' : percentEncode(chr);
|
|
259
364
|
};
|
|
260
365
|
|
|
261
366
|
// https://url.spec.whatwg.org/#special-scheme
|
|
@@ -383,13 +488,13 @@ URLState.prototype = {
|
|
|
383
488
|
break;
|
|
384
489
|
|
|
385
490
|
case SCHEME:
|
|
386
|
-
if (chr &&
|
|
491
|
+
if (chr && exec(ALPHANUMERIC_PLUS_MINUS_DOT, chr)) {
|
|
387
492
|
buffer += toLowerCase(chr);
|
|
388
493
|
} else if (chr === ':') {
|
|
389
494
|
if (stateOverride && (
|
|
390
495
|
(url.isSpecial() !== hasOwn(specialSchemes, buffer)) ||
|
|
391
496
|
(buffer === 'file' && (url.includesCredentials() || url.port !== null)) ||
|
|
392
|
-
(url.scheme === 'file' &&
|
|
497
|
+
(url.scheme === 'file' && url.host === '')
|
|
393
498
|
)) return;
|
|
394
499
|
url.scheme = buffer;
|
|
395
500
|
if (stateOverride) {
|
|
@@ -485,7 +590,7 @@ URLState.prototype = {
|
|
|
485
590
|
url.host = base.host;
|
|
486
591
|
url.port = base.port;
|
|
487
592
|
url.path = arraySlice(base.path);
|
|
488
|
-
url.path.length--;
|
|
593
|
+
if (url.path.length) url.path.length--;
|
|
489
594
|
state = PATH;
|
|
490
595
|
continue;
|
|
491
596
|
} break;
|
|
@@ -506,7 +611,7 @@ URLState.prototype = {
|
|
|
506
611
|
|
|
507
612
|
case SPECIAL_AUTHORITY_SLASHES:
|
|
508
613
|
state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
|
|
509
|
-
if (chr !== '/' ||
|
|
614
|
+
if (chr !== '/' || codePoints[pointer + 1] !== '/') continue;
|
|
510
615
|
pointer++;
|
|
511
616
|
break;
|
|
512
617
|
|
|
@@ -527,7 +632,7 @@ URLState.prototype = {
|
|
|
527
632
|
seenPasswordToken = true;
|
|
528
633
|
continue;
|
|
529
634
|
}
|
|
530
|
-
var encodedCodePoints =
|
|
635
|
+
var encodedCodePoints = utf8PercentEncode(codePoint, userinfoPercentEncodeSet);
|
|
531
636
|
if (seenPasswordToken) url.password += encodedCodePoints;
|
|
532
637
|
else url.username += encodedCodePoints;
|
|
533
638
|
}
|
|
@@ -550,11 +655,11 @@ URLState.prototype = {
|
|
|
550
655
|
continue;
|
|
551
656
|
} else if (chr === ':' && !seenBracket) {
|
|
552
657
|
if (buffer === '') return INVALID_HOST;
|
|
658
|
+
if (stateOverride === HOSTNAME) return;
|
|
553
659
|
failure = url.parseHost(buffer);
|
|
554
660
|
if (failure) return failure;
|
|
555
661
|
buffer = '';
|
|
556
662
|
state = PORT;
|
|
557
|
-
if (stateOverride === HOSTNAME) return;
|
|
558
663
|
} else if (
|
|
559
664
|
chr === EOF || chr === '/' || chr === '?' || chr === '#' ||
|
|
560
665
|
(chr === '\\' && url.isSpecial())
|
|
@@ -595,6 +700,7 @@ URLState.prototype = {
|
|
|
595
700
|
|
|
596
701
|
case FILE:
|
|
597
702
|
url.scheme = 'file';
|
|
703
|
+
url.host = '';
|
|
598
704
|
if (chr === '/' || chr === '\\') state = FILE_SLASH;
|
|
599
705
|
else if (base && base.scheme === 'file') {
|
|
600
706
|
switch (chr) {
|
|
@@ -617,8 +723,8 @@ URLState.prototype = {
|
|
|
617
723
|
state = FRAGMENT;
|
|
618
724
|
break;
|
|
619
725
|
default:
|
|
726
|
+
url.host = base.host;
|
|
620
727
|
if (!startsWithWindowsDriveLetter(join(arraySlice(codePoints, pointer), ''))) {
|
|
621
|
-
url.host = base.host;
|
|
622
728
|
url.path = arraySlice(base.path);
|
|
623
729
|
url.shortenPath();
|
|
624
730
|
}
|
|
@@ -635,9 +741,10 @@ URLState.prototype = {
|
|
|
635
741
|
state = FILE_HOST;
|
|
636
742
|
break;
|
|
637
743
|
}
|
|
638
|
-
if (base && base.scheme === 'file'
|
|
639
|
-
|
|
640
|
-
|
|
744
|
+
if (base && base.scheme === 'file') {
|
|
745
|
+
url.host = base.host;
|
|
746
|
+
if (!startsWithWindowsDriveLetter(join(arraySlice(codePoints, pointer), ''))
|
|
747
|
+
&& isWindowsDriveLetter(base.path[0], true)) push(url.path, base.path[0]);
|
|
641
748
|
}
|
|
642
749
|
state = PATH;
|
|
643
750
|
continue;
|
|
@@ -693,7 +800,8 @@ URLState.prototype = {
|
|
|
693
800
|
}
|
|
694
801
|
} else {
|
|
695
802
|
if (url.scheme === 'file' && !url.path.length && isWindowsDriveLetter(buffer)) {
|
|
696
|
-
|
|
803
|
+
// eslint-disable-next-line max-depth -- ok
|
|
804
|
+
if (url.host !== null && url.host !== '') url.host = '';
|
|
697
805
|
buffer = charAt(buffer, 0) + ':'; // normalize windows drive letter
|
|
698
806
|
}
|
|
699
807
|
push(url.path, buffer);
|
|
@@ -712,7 +820,7 @@ URLState.prototype = {
|
|
|
712
820
|
state = FRAGMENT;
|
|
713
821
|
}
|
|
714
822
|
} else {
|
|
715
|
-
buffer +=
|
|
823
|
+
buffer += utf8PercentEncode(chr, pathPercentEncodeSet);
|
|
716
824
|
} break;
|
|
717
825
|
|
|
718
826
|
case CANNOT_BE_A_BASE_URL_PATH:
|
|
@@ -723,7 +831,11 @@ URLState.prototype = {
|
|
|
723
831
|
url.fragment = '';
|
|
724
832
|
state = FRAGMENT;
|
|
725
833
|
} else if (chr !== EOF) {
|
|
726
|
-
|
|
834
|
+
if (chr === ' ') {
|
|
835
|
+
url.path[0] += codePoints[pointer + 1] === '?' || codePoints[pointer + 1] === '#' ? '%20' : ' ';
|
|
836
|
+
} else {
|
|
837
|
+
url.path[0] += utf8PercentEncode(chr, C0ControlPercentEncodeSet);
|
|
838
|
+
}
|
|
727
839
|
} break;
|
|
728
840
|
|
|
729
841
|
case QUERY:
|
|
@@ -731,13 +843,11 @@ URLState.prototype = {
|
|
|
731
843
|
url.fragment = '';
|
|
732
844
|
state = FRAGMENT;
|
|
733
845
|
} else if (chr !== EOF) {
|
|
734
|
-
|
|
735
|
-
else if (chr === '#') url.query += '%23';
|
|
736
|
-
else url.query += percentEncode(chr, C0ControlPercentEncodeSet);
|
|
846
|
+
url.query += utf8PercentEncode(chr, url.isSpecial() ? specialQueryPercentEncodeSet : queryPercentEncodeSet);
|
|
737
847
|
} break;
|
|
738
848
|
|
|
739
849
|
case FRAGMENT:
|
|
740
|
-
if (chr !== EOF) url.fragment +=
|
|
850
|
+
if (chr !== EOF) url.fragment += utf8PercentEncode(chr, fragmentPercentEncodeSet);
|
|
741
851
|
break;
|
|
742
852
|
}
|
|
743
853
|
|
|
@@ -754,24 +864,28 @@ URLState.prototype = {
|
|
|
754
864
|
this.host = result;
|
|
755
865
|
// opaque host
|
|
756
866
|
} else if (!this.isSpecial()) {
|
|
757
|
-
if (exec(
|
|
867
|
+
if (exec(FORBIDDEN_HOST_CODE_POINT, input)) return INVALID_HOST;
|
|
758
868
|
result = '';
|
|
759
869
|
codePoints = arrayFrom(input);
|
|
760
870
|
for (index = 0; index < codePoints.length; index++) {
|
|
761
|
-
result +=
|
|
871
|
+
result += utf8PercentEncode(codePoints[index], C0ControlPercentEncodeSet);
|
|
762
872
|
}
|
|
763
873
|
this.host = result;
|
|
764
874
|
} else {
|
|
765
|
-
input =
|
|
766
|
-
if (exec(
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
875
|
+
input = domainToASCII(percentDecode(input));
|
|
876
|
+
if (input === null || exec(FORBIDDEN_DOMAIN_CODE_POINT, input)) return INVALID_HOST;
|
|
877
|
+
if (endsInNumber(input)) {
|
|
878
|
+
result = parseIPv4(input);
|
|
879
|
+
if (result === null) return INVALID_HOST;
|
|
880
|
+
this.host = result;
|
|
881
|
+
} else {
|
|
882
|
+
this.host = input;
|
|
883
|
+
}
|
|
770
884
|
}
|
|
771
885
|
},
|
|
772
886
|
// https://url.spec.whatwg.org/#cannot-have-a-username-password-port
|
|
773
887
|
cannotHaveUsernamePasswordPort: function () {
|
|
774
|
-
return
|
|
888
|
+
return this.host === null || this.host === '' || this.cannotBeABaseURL || this.scheme === 'file';
|
|
775
889
|
},
|
|
776
890
|
// https://url.spec.whatwg.org/#include-credentials
|
|
777
891
|
includesCredentials: function () {
|
|
@@ -809,6 +923,7 @@ URLState.prototype = {
|
|
|
809
923
|
output += serializeHost(host);
|
|
810
924
|
if (port !== null) output += ':' + port;
|
|
811
925
|
} else if (scheme === 'file') output += '//';
|
|
926
|
+
if (host === null && !url.cannotBeABaseURL && path.length > 1 && path[0] === '') output += '/.';
|
|
812
927
|
output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : '';
|
|
813
928
|
if (query !== null) output += '?' + query;
|
|
814
929
|
if (fragment !== null) output += '#' + fragment;
|
|
@@ -825,7 +940,7 @@ URLState.prototype = {
|
|
|
825
940
|
var scheme = this.scheme;
|
|
826
941
|
var port = this.port;
|
|
827
942
|
if (scheme === 'blob') try {
|
|
828
|
-
return new URLConstructor(
|
|
943
|
+
return new URLConstructor(this.path[0]).origin;
|
|
829
944
|
} catch (error) {
|
|
830
945
|
return 'null';
|
|
831
946
|
}
|
|
@@ -848,7 +963,7 @@ URLState.prototype = {
|
|
|
848
963
|
if (this.cannotHaveUsernamePasswordPort()) return;
|
|
849
964
|
this.username = '';
|
|
850
965
|
for (var i = 0; i < codePoints.length; i++) {
|
|
851
|
-
this.username +=
|
|
966
|
+
this.username += utf8PercentEncode(codePoints[i], userinfoPercentEncodeSet);
|
|
852
967
|
}
|
|
853
968
|
},
|
|
854
969
|
// https://url.spec.whatwg.org/#dom-url-password
|
|
@@ -860,7 +975,7 @@ URLState.prototype = {
|
|
|
860
975
|
if (this.cannotHaveUsernamePasswordPort()) return;
|
|
861
976
|
this.password = '';
|
|
862
977
|
for (var i = 0; i < codePoints.length; i++) {
|
|
863
|
-
this.password +=
|
|
978
|
+
this.password += utf8PercentEncode(codePoints[i], userinfoPercentEncodeSet);
|
|
864
979
|
}
|
|
865
980
|
},
|
|
866
981
|
// https://url.spec.whatwg.org/#dom-url-host
|
package/modules/web.url.parse.js
CHANGED
|
@@ -8,7 +8,7 @@ var USE_NATIVE_URL = require('../internals/url-constructor-detection');
|
|
|
8
8
|
var URL = getBuiltIn('URL');
|
|
9
9
|
|
|
10
10
|
// `URL.parse` method
|
|
11
|
-
// https://url.spec.whatwg.org/#dom-url-
|
|
11
|
+
// https://url.spec.whatwg.org/#dom-url-parse
|
|
12
12
|
$({ target: 'URL', stat: true, forced: !USE_NATIVE_URL }, {
|
|
13
13
|
parse: function parse(url) {
|
|
14
14
|
var length = validateArgumentsLength(arguments.length, 1);
|