mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
925a464cb8
PR-URL: https://github.com/nodejs/node/pull/51520 Fixes: https://github.com/nodejs/node/issues/51518 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
63 lines
1.2 KiB
JavaScript
63 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
|
|
const { URL } = require('url');
|
|
const assert = require('assert');
|
|
|
|
[
|
|
'toString',
|
|
'toJSON',
|
|
].forEach((i) => {
|
|
assert.throws(() => Reflect.apply(URL.prototype[i], [], {}), {
|
|
name: 'TypeError',
|
|
message: /Receiver must be an instance of class/,
|
|
});
|
|
});
|
|
|
|
[
|
|
'href',
|
|
'search',
|
|
].forEach((i) => {
|
|
assert.throws(() => Reflect.get(URL.prototype, i, {}), {
|
|
name: 'TypeError',
|
|
message: /Receiver must be an instance of class/,
|
|
});
|
|
|
|
assert.throws(() => Reflect.set(URL.prototype, i, null, {}), {
|
|
name: 'TypeError',
|
|
message: /Cannot read private member/,
|
|
});
|
|
});
|
|
|
|
[
|
|
'protocol',
|
|
'username',
|
|
'password',
|
|
'host',
|
|
'hostname',
|
|
'port',
|
|
'pathname',
|
|
'hash',
|
|
].forEach((i) => {
|
|
assert.throws(() => Reflect.get(URL.prototype, i, {}), {
|
|
name: 'TypeError',
|
|
message: /Cannot read private member/,
|
|
});
|
|
|
|
assert.throws(() => Reflect.set(URL.prototype, i, null, {}), {
|
|
name: 'TypeError',
|
|
message: /Cannot read private member/,
|
|
});
|
|
});
|
|
|
|
[
|
|
'origin',
|
|
'searchParams',
|
|
].forEach((i) => {
|
|
assert.throws(() => Reflect.get(URL.prototype, i, {}), {
|
|
name: 'TypeError',
|
|
message: /Cannot read private member/,
|
|
});
|
|
});
|