diff options
author | Callum Linden <113564339+callumlinden@users.noreply.github.com> | 2025-08-22 16:21:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-22 16:21:31 -0700 |
commit | cefee59b0e5fff683a50fe61633a9c14493d7145 (patch) | |
tree | 9b7ece084971f038db19291ba3c981b7b50bbf8d /indra/newview/llviewermedia.cpp | |
parent | 1022be69862db187594f2971fa9602d46f13e372 (diff) |
Improved open performance for some web based UI floaters by preloading the web content during login (#4574)
* First phase of some work to replace certain UI web based floaters with a much more simple floater (no more browserish web-content-floater) and then pre-load content as login is progressing. This means that after login, the floater can be opened much more rapidly than now. This first commit does this process for the Search floater
* This commit brings in a new marketplace floater than hosts the marketplace web page (no more webcontent floater here either). It works as expected and opens quickly but the user is not logged in when the page is opened so that needs to be tackled before we can declare that this is a viable solution
* This commit introduces a way to set the openID cookie that arrives via login.cgi into all the instances that are preloaded - the result is that when you open the preloaded floater after login, you are logged into your linden account
* Fix a mac only warning as error - function overrides a member function but is not marked 'override'
* Marchcat spotted left over cruft from earlier dev when we used a trimmed down URL for the pre-load search. Now we use the same search URL throughout and zero out the query parameters
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 82a52e63f6..c6bc252efd 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); + } } } }); |