MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / FromJson

Method FromJson

cpp/iedriver/BrowserCookie.cpp:36–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36BrowserCookie BrowserCookie::FromJson(const Json::Value& json_cookie) {
37 BrowserCookie cookie;
38 cookie.name_ = json_cookie["name"].asString();
39 cookie.value_ = json_cookie["value"].asString();
40 cookie.is_secure_ = json_cookie["secure"].asBool();
41
42 Json::Value expiry = json_cookie.get("expiry", Json::Value::null);
43 if (!expiry.isNull()) {
44 if (expiry.isNumeric()) {
45 cookie.expiration_time_ = expiry.asUInt64();
46 }
47 }
48
49 Json::Value domain = json_cookie.get("domain", Json::Value::null);
50 if (!domain.isNull() && domain.isString() && domain.asString() != "") {
51 cookie.domain_ = domain.asString();
52 }
53
54 Json::Value path = json_cookie.get("path", Json::Value::null);
55 if (!path.isNull() && path.isString() && path.asString() != "") {
56 cookie.path_ = path.asString();
57 }
58 return cookie;
59}
60
61std::string BrowserCookie::ToString() const {
62 std::string cookie_string(this->name_ +

Callers

nothing calls this directly

Calls 4

asStringMethod · 0.80
isNullMethod · 0.80
isNumericMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected