Skip to content

Commit 499e75a

Browse files
committed
url: do not public expose inspect methods on URL
PR-URL: #10906 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
1 parent 57e5315 commit 499e75a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/internal/url.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class TupleOrigin {
7777
return result;
7878
}
7979

80-
inspect() {
80+
[util.inspect.custom]() {
8181
return `TupleOrigin {
8282
scheme: ${this[kScheme]},
8383
host: ${this[kHost]},
@@ -235,7 +235,7 @@ class URL {
235235
return (this[context].flags & binding.URL_FLAGS_CANNOT_BE_BASE) !== 0;
236236
}
237237

238-
inspect(depth, opts) {
238+
[util.inspect.custom](depth, opts) {
239239
const ctx = this[context];
240240
var ret = 'URL {\n';
241241
ret += ` href: ${this.href}\n`;

test/parallel/test-whatwg-url-parsing.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
const common = require('../common');
4+
const util = require('util');
45

56
if (!common.hasIntl) {
67
// A handful of the tests fail when ICU is not included.
@@ -144,8 +145,8 @@ for (const test of allTests) {
144145
const url = test.url ? new URL(test.url) : new URL(test.input, test.base);
145146

146147
for (const showHidden of [true, false]) {
147-
const res = url.inspect(null, {
148-
showHidden: showHidden
148+
const res = util.inspect(url, {
149+
showHidden
149150
});
150151

151152
const lines = res.split('\n');

0 commit comments

Comments
 (0)