From b3e444c74e0f31ba9d63d7bed934f017bf2499df Mon Sep 17 00:00:00 2001 From: callum Date: Thu, 17 Mar 2011 17:18:58 -0700 Subject: SOCIAL-634 FIX Error condition content for Destination Guide, Avatar Picker, and Help if S3 content or web content is not available. (Included refs to new LLQtWebKit that supports functionality) --- indra/llplugin/llpluginclassmedia.cpp | 16 ++++++---------- indra/llplugin/llpluginclassmedia.h | 5 ++++- indra/llplugin/llpluginclassmediaowner.h | 3 ++- indra/media_plugins/webkit/media_plugin_webkit.cpp | 18 +++++++++--------- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llfloaterwebcontent.cpp | 6 ++++++ indra/newview/llmediactrl.cpp | 16 ---------------- indra/newview/llmediactrl.h | 4 ---- 8 files changed, 38 insertions(+), 41 deletions(-) (limited to 'indra') diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index 26a20cede8..57f91a57ca 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -146,6 +146,7 @@ void LLPluginClassMedia::reset() mClickURL.clear(); mClickTarget.clear(); mClickUUID.clear(); + mStatusCode = 0; // media_time class mCurrentTime = 0.0f; @@ -1027,6 +1028,11 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) mClickTarget.clear(); mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLICK_LINK_NOFOLLOW); } + else if(message_name == "navigate_error_page") + { + mStatusCode = message.getValueS32("status_code"); + mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_NAVIGATE_ERROR_PAGE); + } else if(message_name == "cookie_set") { if(mOwner) @@ -1192,16 +1198,6 @@ void LLPluginClassMedia::browse_back() sendMessage(message); } -void LLPluginClassMedia::set_status_redirect(int code, const std::string &url) -{ - LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "set_status_redirect"); - - message.setValueS32("code", code); - message.setValue("url", url); - - sendMessage(message); -} - void LLPluginClassMedia::setBrowserUserAgent(const std::string& user_agent) { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "set_user_agent"); diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h index 618e928a08..a940633b88 100644 --- a/indra/llplugin/llpluginclassmedia.h +++ b/indra/llplugin/llpluginclassmedia.h @@ -199,7 +199,6 @@ public: void browse_reload(bool ignore_cache = false); void browse_forward(); void browse_back(); - void set_status_redirect(int code, const std::string &url); void setBrowserUserAgent(const std::string& user_agent); void proxyWindowOpened(const std::string &target, const std::string &uuid); void proxyWindowClosed(const std::string &uuid); @@ -232,6 +231,9 @@ public: // This is valid during MEDIA_EVENT_CLICK_LINK_HREF and MEDIA_EVENT_GEOMETRY_CHANGE std::string getClickUUID() const { return mClickUUID; }; + + // This is valid after MEDIA_EVENT_NAVIGATE_ERROR_PAGE + S32 getStatusCode() const { return mStatusCode; }; // These are valid during MEDIA_EVENT_GEOMETRY_CHANGE S32 getGeometryX() const { return mGeometryX; }; @@ -384,6 +386,7 @@ protected: S32 mGeometryY; S32 mGeometryWidth; S32 mGeometryHeight; + S32 mStatusCode; std::string mAuthURL; std::string mAuthRealm; std::string mHoverText; diff --git a/indra/llplugin/llpluginclassmediaowner.h b/indra/llplugin/llpluginclassmediaowner.h index 42e93cc6d7..5a4fb1ce90 100644 --- a/indra/llplugin/llpluginclassmediaowner.h +++ b/indra/llplugin/llpluginclassmediaowner.h @@ -52,12 +52,13 @@ public: MEDIA_EVENT_STATUS_TEXT_CHANGED, // browser has updated the status text MEDIA_EVENT_NAME_CHANGED, // browser has updated the name of the media (typically tag) MEDIA_EVENT_LOCATION_CHANGED, // browser location (URL) has changed (maybe due to internal navagation/frames/etc) + MEDIA_EVENT_NAVIGATE_ERROR_PAGE, // browser navigated to a page that resulted in an HTTP error MEDIA_EVENT_CLICK_LINK_HREF, // I'm not entirely sure what the semantics of these two are MEDIA_EVENT_CLICK_LINK_NOFOLLOW, MEDIA_EVENT_CLOSE_REQUEST, // The plugin requested its window be closed (currently hooked up to javascript window.close in webkit) MEDIA_EVENT_PICK_FILE_REQUEST, // The plugin wants the user to pick a file MEDIA_EVENT_GEOMETRY_CHANGE, // The plugin requested its window geometry be changed (per the javascript window interface) - + MEDIA_EVENT_PLUGIN_FAILED_LAUNCH, // The plugin failed to launch MEDIA_EVENT_PLUGIN_FAILED, // The plugin died unexpectedly diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index d6f8ae3e16..c1bc9adec0 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -490,6 +490,15 @@ private: } } + //////////////////////////////////////////////////////////////////////////////// + // virtual + void onNavigateErrorPage(const EventType& event) + { + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "navigate_error_page"); + message.setValueS32("status_code", event.getIntValue()); + sendMessage(message); + } + //////////////////////////////////////////////////////////////////////////////// // virtual void onLocationChange(const EventType& event) @@ -1225,15 +1234,6 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) { LLQtWebKit::getInstance()->userAction( mBrowserWindowId, LLQtWebKit::UA_NAVIGATE_BACK ); } - else if(message_name == "set_status_redirect") - { - int code = message_in.getValueS32("code"); - std::string url = message_in.getValue("url"); - if ( 404 == code ) // browser lib only supports 404 right now - { - LLQtWebKit::getInstance()->set404RedirectUrl( mBrowserWindowId, url ); - }; - } else if(message_name == "set_user_agent") { mUserAgent = message_in.getValue("user_agent"); diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6a89f5681d..c626538808 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -12586,5 +12586,16 @@ <key>Value</key> <integer>1</integer> </map> + <key>WebContentFloaterErrorURL</key> + <map> + <key>Comment</key> + <string>URL to navigate to if the Web content floater hits a page with a 400-499 HTTP status code</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>String</string> + <key>Value</key> + <string>http://common-flash-secondlife-com.s3.amazonaws.com/viewer/v2.6/damballah/404.html</string> + </map> </map> </llsd> diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp index 058567492b..76fb985b39 100644 --- a/indra/newview/llfloaterwebcontent.cpp +++ b/indra/newview/llfloaterwebcontent.cpp @@ -328,6 +328,12 @@ void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent const std::string link = self->getHoverLink(); mStatusBarText->setText( link ); } + else if(event == MEDIA_EVENT_NAVIGATE_ERROR_PAGE ) + { + std::string redirect_url = gSavedSettings.getString("WebContentFloaterErrorURL"); + mWebBrowser->navigateTo(redirect_url, "text/html"); + set_current_url(redirect_url); + } } void LLFloaterWebContent::set_current_url(const std::string& url) diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 9493fddf50..24038d0ee6 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -501,22 +501,6 @@ bool LLMediaCtrl::canNavigateForward() return false; } -//////////////////////////////////////////////////////////////////////////////// -// -void LLMediaCtrl::set404RedirectUrl( std::string redirect_url ) -{ - if(mMediaSource && mMediaSource->hasMedia()) - mMediaSource->getMediaPlugin()->set_status_redirect( 404, redirect_url ); -} - -//////////////////////////////////////////////////////////////////////////////// -// -void LLMediaCtrl::clr404RedirectUrl() -{ - if(mMediaSource && mMediaSource->hasMedia()) - mMediaSource->getMediaPlugin()->set_status_redirect(404, ""); -} - //////////////////////////////////////////////////////////////////////////////// // void LLMediaCtrl::clearCache() diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h index 38a74f90d3..7a28b0986d 100644 --- a/indra/newview/llmediactrl.h +++ b/indra/newview/llmediactrl.h @@ -113,10 +113,6 @@ public: void setTarget(const std::string& target); - // set/clear URL to visit when a 404 page is reached - void set404RedirectUrl( std::string redirect_url ); - void clr404RedirectUrl(); - // Clear the browser cache when the instance gets loaded void clearCache(); -- cgit v1.2.3