| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0c67a7a commit 01b6525
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -145,7 +145,6 @@ class URLContext { | |||
| 145 | 145 | href = ''; | |
| 146 | 146 | origin = ''; | |
| 147 | 147 | protocol = ''; | |
| 148 | - host = ''; | ||
| 149 | 148 | hostname = ''; | |
| 150 | 149 | pathname = ''; | |
| 151 | 150 | search = ''; | |
@@ -634,14 +633,13 @@ class URL { | |||
| 634 | 633 | return constructHref(this[context], options); | |
| 635 | 634 | } | |
| 636 | 635 | ||
| 637 | - #onParseComplete = (href, origin, protocol, host, hostname, pathname, | ||
| 636 | + #onParseComplete = (href, origin, protocol, hostname, pathname, | ||
| 638 | 637 | search, username, password, port, hash, hasHost, | |
| 639 | 638 | hasOpaquePath) => { | |
| 640 | 639 | const ctx = this[context]; | |
| 641 | 640 | ctx.href = href; | |
| 642 | 641 | ctx.origin = origin; | |
| 643 | 642 | ctx.protocol = protocol; | |
| 644 | - ctx.host = host; | ||
| 645 | 643 | ctx.hostname = hostname; | |
| 646 | 644 | ctx.pathname = pathname; | |
| 647 | 645 | ctx.search = search; | |
@@ -724,7 +722,9 @@ class URL { | |||
| 724 | 722 | get host() { | |
| 725 | 723 | if (!isURLThis(this)) | |
| 726 | 724 | throw new ERR_INVALID_THIS('URL'); | |
| 727 | - return this[context].host; | ||
| 725 | + const port = this[context].port; | ||
| 726 | + const suffix = port.length > 0 ? `:${port}` : ''; | ||
| 727 | + return this[context].hostname + suffix; | ||
| 728 | 728 | } | |
| 729 | 729 | ||
| 730 | 730 | set host(value) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -52,16 +52,15 @@ void SetArgs(Environment* env, Local<Value> argv[12], const ada::result& url) { | |||
| 52 | 52 | argv[0] = Utf8String(isolate, url->get_href()); | |
| 53 | 53 | argv[1] = Utf8String(isolate, url->get_origin()); | |
| 54 | 54 | argv[2] = Utf8String(isolate, url->get_protocol()); | |
| 55 | - argv[3] = Utf8String(isolate, url->get_host()); | ||
| 56 | - argv[4] = Utf8String(isolate, url->get_hostname()); | ||
| 57 | - argv[5] = Utf8String(isolate, url->get_pathname()); | ||
| 58 | - argv[6] = Utf8String(isolate, url->get_search()); | ||
| 59 | - argv[7] = Utf8String(isolate, url->get_username()); | ||
| 60 | - argv[8] = Utf8String(isolate, url->get_password()); | ||
| 61 | - argv[9] = Utf8String(isolate, url->get_port()); | ||
| 62 | - argv[10] = Utf8String(isolate, url->get_hash()); | ||
| 63 | - argv[11] = Boolean::New(isolate, url->host.has_value()); | ||
| 64 | - argv[12] = Boolean::New(isolate, url->has_opaque_path); | ||
| 55 | + argv[3] = Utf8String(isolate, url->get_hostname()); | ||
| 56 | + argv[4] = Utf8String(isolate, url->get_pathname()); | ||
| 57 | + argv[5] = Utf8String(isolate, url->get_search()); | ||
| 58 | + argv[6] = Utf8String(isolate, url->get_username()); | ||
| 59 | + argv[7] = Utf8String(isolate, url->get_password()); | ||
| 60 | + argv[8] = Utf8String(isolate, url->get_port()); | ||
| 61 | + argv[9] = Utf8String(isolate, url->get_hash()); | ||
| 62 | + argv[10] = Boolean::New(isolate, url->host.has_value()); | ||
| 63 | + argv[11] = Boolean::New(isolate, url->has_opaque_path); | ||
| 65 | 64 | } | |
| 66 | 65 | ||
| 67 | 66 | void Parse(const FunctionCallbackInfo<Value>& args) { | |
@@ -108,7 +107,6 @@ void Parse(const FunctionCallbackInfo<Value>& args) { | |||
| 108 | 107 | undef, | |
| 109 | 108 | undef, | |
| 110 | 109 | undef, | |
| 111 | - undef, | ||
| 112 | 110 | }; | |
| 113 | 111 | SetArgs(env, argv, out); | |
| 114 | 112 | USE(success_callback_->Call( | |
@@ -259,7 +257,6 @@ void UpdateUrl(const FunctionCallbackInfo<Value>& args) { | |||
| 259 | 257 | undef, | |
| 260 | 258 | undef, | |
| 261 | 259 | undef, | |
| 262 | - undef, | ||
| 263 | 260 | }; | |
| 264 | 261 | SetArgs(env, argv, out); | |
| 265 | 262 | USE(success_callback_->Call( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,7 +49,6 @@ assert.strictEqual( | |||
| 49 | 49 | href: 'https://username:password@host.name:8080/path/name/?que=ry#hash', | |
| 50 | 50 | origin: 'https://host.name:8080', | |
| 51 | 51 | protocol: 'https:', | |
| 52 | - host: 'host.name:8080', | ||
| 53 | 52 | hostname: 'host.name', | |
| 54 | 53 | pathname: '/path/name/', | |
| 55 | 54 | search: '?que=ry', | |
| Back | FazBrowse Home | New Git URL |
0 commit comments