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)
meow-7.2.2
callum 2011-03-17 17:18:58 -07:00
parent 3f64343b0b
commit b3e444c74e
9 changed files with 42 additions and 45 deletions

View File

@ -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");

View File

@ -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;

View File

@ -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 <title> 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

View File

@ -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");

View File

@ -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>

View File

@ -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)

View File

@ -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()

View File

@ -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();

View File

@ -981,9 +981,9 @@ anguage Infrstructure (CLI) international standard</string>
<key>darwin</key>
<map>
<key>md5sum</key>
<string>13f9be04ba029d19f822abdcb755c700</string>
<string>a5fb7db2c7722fa0cf0a02ee535a97a0</string>
<key>url</key>
<uri>http://viewer-source-downloads.s3.amazonaws.com/install_pkgs/llqtwebkit-darwin-4.7.1-20110302.tar.bz2</uri>
<uri>http://viewer-source-downloads.s3.amazonaws.com/install_pkgs/llqtwebkit-darwin-qt4.7.1-20110317.tar.bz2</uri>
</map>
<key>linux</key>
<map>
@ -995,9 +995,9 @@ anguage Infrstructure (CLI) international standard</string>
<key>windows</key>
<map>
<key>md5sum</key>
<string>7cc9626ff4ac035f8605c996d18ea6a9</string>
<string>c5344b115345770080fc1f6d2a0cfbd7</string>
<key>url</key>
<uri>http://viewer-source-downloads.s3.amazonaws.com/install_pkgs/llqtwebkit-windows-qt4.7.1-20110302.tar.bz2</uri>
<uri>http://viewer-source-downloads.s3.amazonaws.com/install_pkgs/llqtwebkit-windows-qt4.7.1-20110317.tar.bz2</uri>
</map>
</map>
</map>