| 12597 | } |
| 12598 | |
| 12599 | [[nodiscard]] std::string url::get_origin() const noexcept { |
| 12600 | if (is_special()) { |
| 12601 | // Return a new opaque origin. |
| 12602 | if (type == scheme::FILE) { |
| 12603 | return "null"; |
| 12604 | } |
| 12605 | return ada::helpers::concat(get_protocol(), "//", get_host()); |
| 12606 | } |
| 12607 | |
| 12608 | if (non_special_scheme == "blob") { |
| 12609 | if (!path.empty()) { |
| 12610 | auto result = ada::parse<ada::url>(path); |
| 12611 | if (result && |
| 12612 | (result->type == scheme::HTTP || result->type == scheme::HTTPS)) { |
| 12613 | // If pathURL's scheme is not "http" and not "https", then return a |
| 12614 | // new opaque origin. |
| 12615 | return ada::helpers::concat(result->get_protocol(), "//", |
| 12616 | result->get_host()); |
| 12617 | } |
| 12618 | } |
| 12619 | } |
| 12620 | |
| 12621 | // Return a new opaque origin. |
| 12622 | return "null"; |
| 12623 | } |
| 12624 | |
| 12625 | [[nodiscard]] std::string url::get_protocol() const noexcept { |
| 12626 | if (is_special()) { |
no test coverage detected