MCPcopy Create free account
hub / github.com/NativeScript/android / get_origin

Method get_origin

test-app/runtime/src/main/cpp/ada/ada.cpp:12599–12623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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()) {

Callers 2

GetOriginMethod · 0.80
ada_get_originFunction · 0.80

Calls 5

is_specialFunction · 0.85
concatFunction · 0.85
get_hostMethod · 0.80
get_protocolMethod · 0.60
emptyMethod · 0.45

Tested by

no test coverage detected