diff options
author | Erik Kundiman <erik@megapahit.org> | 2025-09-15 06:54:46 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2025-09-15 09:54:39 +0800 |
commit | 4c74344f464928864ef7f70835628be1d92969c3 (patch) | |
tree | 72814839d439f6969593ffcd89d85d6ce74acbab /indra/newview/llviewermedia.cpp | |
parent | df871e95234b670012908d06a6ecc62418e18aa2 (diff) | |
parent | 175400230869963df7a3f126122ace14456c56cb (diff) |
Merge tag 'Second_Life_Release#17540023-2025.07' into 2025.07
Diffstat (limited to 'indra/newview/llviewermedia.cpp')
-rw-r--r-- | indra/newview/llviewermedia.cpp | 65 |
1 files changed, 38 insertions, 27 deletions
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index ce8ce791b9..09bb4a35ad 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1259,35 +1259,46 @@ void LLViewerMedia::getOpenIDCookieCoro(std::string url) { LLAppViewer::instance()->postToMainCoro([=]() { - LLMediaCtrl* media_instance = LLFloaterReg::getInstance("destinations")->getChild<LLMediaCtrl>("destination_guide_contents"); - if (media_instance) + std::string cookie_host = authority.substr(hostStart, hostEnd - hostStart); + std::string cookie_name = ""; + std::string cookie_value = ""; + std::string cookie_path = ""; + bool httponly = true; + bool secure = true; + + LLViewerMedia* inst = getInstance(); + if (inst->parseRawCookie(inst->mOpenIDCookie, cookie_name, cookie_value, cookie_path, httponly, secure)) { - LLViewerMedia* inst = getInstance(); - std::string cookie_host = authority.substr(hostStart, hostEnd - hostStart); - std::string cookie_name = ""; - std::string cookie_value = ""; - std::string cookie_path = ""; - bool httponly = true; - bool secure = true; - if (inst->parseRawCookie(inst->mOpenIDCookie, cookie_name, cookie_value, cookie_path, httponly, secure) && - media_instance->getMediaPlugin()) + // MAINT-5711 - inexplicably, the CEF setCookie function will no longer set the cookie if the + // url and domain are not the same. This used to be my.sl.com and id.sl.com respectively and worked. + // For now, we use the URL for the OpenID POST request since it will have the same authority + // as the domain field. + // (Feels like there must be a less dirty way to construct a URL from component LLURL parts) + // MAINT-6392 - Rider: Do not change, however, the original URI requested, since it is used further + // down. + std::string cefUrl(std::string(inst->mOpenIDURL.mURI) + "://" + std::string(inst->mOpenIDURL.mAuthority)); + + // list of floater names and webbrowser therein to set the cookie that arrived via login into + struct MediaCookieInstance { + std::string floater_name; + std::string browser_name; + }; + struct MediaCookieInstance media_cookie_instances[] = { + {"search", "search_contents" }, + {"marketplace", "marketplace_contents" }, + {"destinations", "destination_guide_contents" }, + }; + for (MediaCookieInstance mci : media_cookie_instances) { - // MAINT-5711 - inexplicably, the CEF setCookie function will no longer set the cookie if the - // url and domain are not the same. This used to be my.sl.com and id.sl.com respectively and worked. - // For now, we use the URL for the OpenID POST request since it will have the same authority - // as the domain field. - // (Feels like there must be a less dirty way to construct a URL from component LLURL parts) - // MAINT-6392 - Rider: Do not change, however, the original URI requested, since it is used further - // down. - std::string cefUrl(std::string(inst->mOpenIDURL.mURI) + "://" + std::string(inst->mOpenIDURL.mAuthority)); - - media_instance->getMediaPlugin()->setCookie(cefUrl, cookie_name, cookie_value, cookie_host, - cookie_path, httponly, secure); - - // Now that we have parsed the raw cookie, we must store it so that each new media instance - // can also get a copy and faciliate logging into internal SL sites. - media_instance->getMediaPlugin()->storeOpenIDCookie(cefUrl, cookie_name, cookie_value, - cookie_host, cookie_path, httponly, secure); + LLMediaCtrl* media_instance = LLFloaterReg::getInstance(mci.floater_name)->getChild<LLMediaCtrl>(mci.browser_name); + if (media_instance && media_instance->getMediaPlugin()) + { + media_instance->getMediaPlugin()->setCookie(cefUrl, cookie_name, cookie_value, cookie_host, + cookie_path, httponly, secure); + + media_instance->getMediaPlugin()->storeOpenIDCookie(cefUrl, cookie_name, cookie_value, + cookie_host, cookie_path, httponly, secure); + } } } }); |