| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e8bc03b commit 9aae767
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -115,7 +115,7 @@ void BindingData::DomainToUnicode(const FunctionCallbackInfo<Value>& args) { | |||
| 115 | 115 | ||
| 116 | 116 | // TODO(@anonrig): Add V8 Fast API for CanParse method | |
| 117 | 117 | void BindingData::CanParse(const FunctionCallbackInfo<Value>& args) { | |
| 118 | - CHECK_GE(args.Length(), 2); | ||
| 118 | + CHECK_GE(args.Length(), 1); | ||
| 119 | 119 | CHECK(args[0]->IsString()); // input | |
| 120 | 120 | // args[1] // base url | |
| 121 | 121 | ||
| Original file line number | Diff line number | Diff 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); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments