diff options
Diffstat (limited to 'src/bun.js/bindings/URLDecomposition.cpp')
-rw-r--r-- | src/bun.js/bindings/URLDecomposition.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/bun.js/bindings/URLDecomposition.cpp b/src/bun.js/bindings/URLDecomposition.cpp index f13d6b093..14cf25b6c 100644 --- a/src/bun.js/bindings/URLDecomposition.cpp +++ b/src/bun.js/bindings/URLDecomposition.cpp @@ -32,20 +32,11 @@ namespace WebCore { String URLDecomposition::origin() const { auto fullURL = this->fullURL(); - auto protocol = fullURL.protocol(); - auto host = fullURL.host(); - auto port = fullURL.port(); - if (protocol == "file"_s) - return "file://"_s; + if (fullURL.protocolIsInHTTPFamily() or fullURL.protocolIsInFTPFamily() or fullURL.protocolIs("ws"_s) or fullURL.protocolIs("wss"_s)) + return fullURL.protocolHostAndPort(); - if (protocol.isEmpty() && host.isEmpty()) - return {}; - - if (!port) - return makeString(protocol, "://", host); - - return makeString(protocol, "://", host, ':', static_cast<uint32_t>(*port)); + return "null"_s; } String URLDecomposition::protocol() const |