diff options
Diffstat (limited to 'indra/newview/llfloatertos.cpp')
-rw-r--r-- | indra/newview/llfloatertos.cpp | 54 |
1 files changed, 39 insertions, 15 deletions
diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp index 69ee8cd547..b4c6f7da9e 100644 --- a/indra/newview/llfloatertos.cpp +++ b/indra/newview/llfloatertos.cpp @@ -57,7 +57,9 @@ LLFloaterTOS::LLFloaterTOS(const LLSD& data) : LLModalDialog( data["message"].asString() ), mMessage(data["message"].asString()), mWebBrowserWindowId( 0 ), - mLoadCompleteCount( 0 ), + mLoadingScreenLoaded(false), + mSiteAlive(false), + mRealNavigateBegun(false), mReplyPumpName(data["reply_pump"].asString()) { } @@ -138,8 +140,10 @@ BOOL LLFloaterTOS::postBuild() if ( web_browser ) { web_browser->addObserver(this); - gResponsePtr = LLIamHere::build( this ); - LLHTTPClient::get( getString( "real_url" ), gResponsePtr ); + + // Don't use the start_url parameter for this browser instance -- it may finish loading before we get to add our observer. + // Store the URL separately and navigate here instead. + web_browser->navigateTo( getString( "loading_url" ) ); } return TRUE; @@ -147,18 +151,28 @@ BOOL LLFloaterTOS::postBuild() void LLFloaterTOS::setSiteIsAlive( bool alive ) { + mSiteAlive = alive; + // only do this for TOS pages if (hasChild("tos_html")) { - LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("tos_html"); // if the contents of the site was retrieved if ( alive ) { // navigate to the "real" page - web_browser->navigateTo( getString( "real_url" ) ); + if(!mRealNavigateBegun && mSiteAlive) + { + LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("tos_html"); + if(web_browser) + { + mRealNavigateBegun = true; + web_browser->navigateTo( getString( "real_url" ) ); + } + } } else { + LL_INFOS("TOS") << "ToS page: ToS page unavailable!" << LL_ENDL; // normally this is set when navigation to TOS page navigation completes (so you can't accept before TOS loads) // but if the page is unavailable, we need to do this now LLCheckBoxCtrl* tos_agreement = getChild<LLCheckBoxCtrl>("agree_chk"); @@ -169,7 +183,6 @@ void LLFloaterTOS::setSiteIsAlive( bool alive ) LLFloaterTOS::~LLFloaterTOS() { - // tell the responder we're not here anymore if ( gResponsePtr ) gResponsePtr->setParent( 0 ); @@ -186,15 +199,15 @@ void LLFloaterTOS::draw() void LLFloaterTOS::updateAgree(LLUICtrl*, void* userdata ) { LLFloaterTOS* self = (LLFloaterTOS*) userdata; - bool agree = self->childGetValue("agree_chk").asBoolean(); - self->childSetEnabled("Continue", agree); + bool agree = self->getChild<LLUICtrl>("agree_chk")->getValue().asBoolean(); + self->getChildView("Continue")->setEnabled(agree); } // static void LLFloaterTOS::onContinue( void* userdata ) { LLFloaterTOS* self = (LLFloaterTOS*) userdata; - llinfos << "User agrees with TOS." << llendl; + LL_INFOS("TOS") << "User agrees with TOS." << LL_ENDL; if(self->mReplyPumpName != "") { @@ -208,7 +221,7 @@ void LLFloaterTOS::onContinue( void* userdata ) void LLFloaterTOS::onCancel( void* userdata ) { LLFloaterTOS* self = (LLFloaterTOS*) userdata; - llinfos << "User disagrees with TOS." << llendl; + LL_INFOS("TOS") << "User disagrees with TOS." << LL_ENDL; LLNotificationsUtil::add("MustAgreeToLogIn", LLSD(), LLSD(), login_alert_done); if(self->mReplyPumpName != "") @@ -216,8 +229,13 @@ void LLFloaterTOS::onCancel( void* userdata ) LLEventPumps::instance().obtain(self->mReplyPumpName).post(LLSD(false)); } - self->mLoadCompleteCount = 0; // reset counter for next time we come to TOS - self->closeFloater(); // destroys this object + // reset state for next time we come to TOS + self->mLoadingScreenLoaded = false; + self->mSiteAlive = false; + self->mRealNavigateBegun = false; + + // destroys this object + self->closeFloater(); } //virtual @@ -225,10 +243,16 @@ void LLFloaterTOS::handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent ev { if(event == MEDIA_EVENT_NAVIGATE_COMPLETE) { - // skip past the loading screen navigate complete - if ( ++mLoadCompleteCount == 2 ) + if(!mLoadingScreenLoaded) + { + mLoadingScreenLoaded = true; + + gResponsePtr = LLIamHere::build( this ); + LLHTTPClient::get( getString( "real_url" ), gResponsePtr ); + } + else if(mRealNavigateBegun) { - llinfos << "NAVIGATE COMPLETE" << llendl; + LL_INFOS("TOS") << "TOS: NAVIGATE COMPLETE" << LL_ENDL; // enable Agree to TOS radio button now that page has loaded LLCheckBoxCtrl * tos_agreement = getChild<LLCheckBoxCtrl>("agree_chk"); tos_agreement->setEnabled( true ); |