Skip to content

Commit 65478ef

Browse files
committed
Remove Unicode serialization of an origin: url::origin_unicode()
Follows: - whatwg/url#311 - whatwg/html#2689
1 parent 3aca431 commit 65478ef

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

src/url.h

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,6 @@ class url {
196196

197197
// ASCII serialized origin
198198
std::string origin() const;
199-
// Unicode serialized origin in utf-8
200-
std::string origin_unicode() const;
201199

202200
str_view_type protocol() const;
203201

@@ -688,36 +686,6 @@ inline std::string url::origin() const {
688686
return "null"; // opaque origin
689687
}
690688

691-
// Unicode serialization of an origin
692-
// https://html.spec.whatwg.org/multipage/browsers.html#unicode-serialisation-of-an-origin
693-
inline std::string url::origin_unicode() const {
694-
if (is_special_scheme()) {
695-
if (is_file_scheme())
696-
return "null"; // opaque origin
697-
// "scheme://"
698-
std::string str_origin(norm_url_, 0, part_end_[SCHEME_SEP]);
699-
700-
// if host is a domain, then apply domain to Unicode
701-
auto hostv = get_part_view(HOST);
702-
if (host_type() == HostType::Domain) {
703-
simple_buffer<char> buff;
704-
IDNToUnicode(hostv.data(), hostv.length(), buff);
705-
str_origin.append(buff.begin(), buff.end());
706-
} else {
707-
str_origin.append(hostv.data(), hostv.length());
708-
}
709-
710-
if (!is_null(PORT))
711-
str_origin.append(norm_url_.data() + part_end_[HOST], norm_url_.data() + part_end_[PORT]);
712-
return str_origin;
713-
} else if (get_part_view(SCHEME).equal({ "blob", 4 })) {
714-
url u;
715-
if (u.parse(get_part_view(PATH), nullptr) == url_result::Ok)
716-
return u.origin_unicode();
717-
}
718-
return "null"; // opaque origin
719-
}
720-
721689
inline url::str_view_type url::protocol() const {
722690
// "scheme:"
723691
return str_view_type(norm_url_.data(), part_end_[SCHEME] ? part_end_[SCHEME] + 1 : 0);

0 commit comments

Comments
 (0)