Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8897305

Browse filesBrowse files
anonrigdanielleadams
authored andcommitted
url: handle URL.canParse without base parameter
PR-URL: #47547 Backport-PR-URL: #48345 Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 0dc485e commit 8897305
Copy full SHA for 8897305

File tree

Expand file treeCollapse file tree

2 files changed

+22
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+22
-1
lines changed
Open diff view settings
Collapse file

‎src/node_url.cc‎

Copy file name to clipboardExpand all lines: src/node_url.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void BindingData::DomainToUnicode(const FunctionCallbackInfo<Value>& args) {
115115

116116
// TODO(@anonrig): Add V8 Fast API for CanParse method
117117
void BindingData::CanParse(const FunctionCallbackInfo<Value>& args) {
118-
CHECK_GE(args.Length(), 2);
118+
CHECK_GE(args.Length(), 1);
119119
CHECK(args[0]->IsString()); // input
120120
// args[1] // base url
121121

Collapse file
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Flags: --expose-internals
2+
'use strict';
3+
4+
require('../common');
5+
6+
const { URL } = require('url');
7+
const assert = require('assert');
8+
9+
let internalBinding;
10+
try {
11+
internalBinding = require('internal/test/binding').internalBinding;
12+
} catch (e) {
13+
console.log('using `test/parallel/test-whatwg-url-canparse` requires `--expose-internals`');
14+
throw e;
15+
}
16+
17+
const { canParse } = internalBinding('url');
18+
19+
// It should not throw when called without a base string
20+
assert.strictEqual(URL.canParse('https://example.org'), true);
21+
assert.strictEqual(canParse('https://example.org'), true);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.