EXT-6466 "Move "Enable Cookies" checkbox...", EXT-6402 "Add feature to disable Web plugins via prefs" and EXT-6401 "Add feature to disable Javascript via prefs"

Apologies for the multiple commit of Jiras - these changes are closely related and impossible to commit deparately
Reviewed by Monroe
meow-7.2.2
Callum Prentice 2010-03-18 16:53:27 -07:00
parent fabae99883
commit cb7fbc8a20
8 changed files with 150 additions and 40 deletions

View File

@ -696,6 +696,20 @@ void LLPluginClassMedia::setLanguageCode(const std::string &language_code)
sendMessage(message);
}
void LLPluginClassMedia::setPluginsEnabled(const bool enabled)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "plugins_enabled");
message.setValueBoolean("enable", enabled);
sendMessage(message);
}
void LLPluginClassMedia::setJavascriptEnabled(const bool enabled)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "javascript_enabled");
message.setValueBoolean("enable", enabled);
sendMessage(message);
}
LLPluginClassMedia::ETargetType getTargetTypeFromLLQtWebkit(int target_type)
{
// convert a LinkTargetType value from llqtwebkit to an ETargetType
@ -1065,6 +1079,7 @@ void LLPluginClassMedia::clear_cookies()
void LLPluginClassMedia::enable_cookies(bool enable)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "enable_cookies");
message.setValueBoolean("enable", enable);
sendMessage(message);
}

View File

@ -179,6 +179,8 @@ public:
// These can be called before init(), and they will be queued and sent before the media init message.
void setUserDataPath(const std::string &user_data_path);
void setLanguageCode(const std::string &language_code);
void setPluginsEnabled(const bool enabled);
void setJavascriptEnabled(const bool enabled);
///////////////////////////////////
// media browser class functions

View File

@ -89,6 +89,9 @@ private:
std::string mProfileDir;
std::string mHostLanguage;
bool mCookiesEnabled;
bool mJavascriptEnabled;
bool mPluginsEnabled;
enum
{
@ -277,21 +280,18 @@ private:
{
LLQtWebKit::getInstance()->setHostLanguage(mHostLanguage);
}
// turn on/off cookies based on what host app tells us
LLQtWebKit::getInstance()->enableCookies( mCookiesEnabled );
// turn on/off plugins based on what host app tells us
LLQtWebKit::getInstance()->enablePlugins( mPluginsEnabled );
// turn on/off Javascript based on what host app tells us
LLQtWebKit::getInstance()->enableJavascript( mJavascriptEnabled );
// create single browser window
mBrowserWindowId = LLQtWebKit::getInstance()->createBrowserWindow( mWidth, mHeight );
#if LL_WINDOWS
// Enable plugins
LLQtWebKit::getInstance()->enablePlugins(true);
#elif LL_DARWIN
// Enable plugins
LLQtWebKit::getInstance()->enablePlugins(true);
#elif LL_LINUX
// Enable plugins
LLQtWebKit::getInstance()->enablePlugins(true);
#endif
// Enable cookies
LLQtWebKit::getInstance()->enableCookies( true );
// tell LLQtWebKit about the size of the browser window
LLQtWebKit::getInstance()->setSize( mBrowserWindowId, mWidth, mHeight );
@ -671,6 +671,10 @@ MediaPluginWebKit::MediaPluginWebKit(LLPluginInstance::sendMessageFunction host_
mBackgroundR = 0.0f;
mBackgroundG = 0.0f;
mBackgroundB = 0.0f;
mHostLanguage = "en"; // default to english
mJavascriptEnabled = true; // default to on
mPluginsEnabled = true; // default to on
}
MediaPluginWebKit::~MediaPluginWebKit()
@ -825,6 +829,14 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
// FIXME: Should we do anything with this if it comes in after the browser has been initialized?
}
else if(message_name == "plugins_enabled")
{
mPluginsEnabled = message_in.getValueBoolean("enable");
}
else if(message_name == "javascript_enabled")
{
mJavascriptEnabled = message_in.getValueBoolean("enable");
}
else if(message_name == "size_change")
{
std::string name = message_in.getValue("name");
@ -1026,8 +1038,18 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
}
else if(message_name == "enable_cookies")
{
bool val = message_in.getValueBoolean("enable");
LLQtWebKit::getInstance()->enableCookies( val );
mCookiesEnabled = message_in.getValueBoolean("enable");
LLQtWebKit::getInstance()->enableCookies( mCookiesEnabled );
}
else if(message_name == "enable_plugins")
{
mPluginsEnabled = message_in.getValueBoolean("enable");
LLQtWebKit::getInstance()->enablePlugins( mPluginsEnabled );
}
else if(message_name == "enable_javascript")
{
mJavascriptEnabled = message_in.getValueBoolean("enable");
//LLQtWebKit::getInstance()->enableJavascript( mJavascriptEnabled );
}
else if(message_name == "proxy_setup")
{

View File

@ -1563,6 +1563,28 @@
<key>Value</key>
<integer>1</integer>
</map>
<key>BrowserJavascriptEnabled</key>
<map>
<key>Comment</key>
<string>Enable Javascript in the built-in Web browser?</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>BrowserPluginsEnabled</key>
<map>
<key>Comment</key>
<string>Enable Web plugins in the built-in Web browser?</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>CreateToolCopyCenters</key>
<map>
<key>Comment</key>

View File

@ -1260,6 +1260,19 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
media_source->setSize(default_width, default_height);
media_source->setUserDataPath(user_data_path);
media_source->setLanguageCode(LLUI::getLanguage());
// collect 'cookies enabled' setting from prefs and send to embedded browser
bool cookies_enabled = gSavedSettings.getBOOL( "CookiesEnabled" );
media_source->enable_cookies( cookies_enabled );
// collect 'plugins enabled' setting from prefs and send to embedded browser
bool plugins_enabled = gSavedSettings.getBOOL( "BrowserPluginsEnabled" );
media_source->setPluginsEnabled( plugins_enabled );
// collect 'javascript enabled' setting from prefs and send to embedded browser
bool javascript_enabled = gSavedSettings.getBOOL( "BrowserJavascriptEnabled" );
media_source->setJavascriptEnabled( javascript_enabled );
if (media_source->init(launcher_name, plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")))
{
return media_source;

View File

@ -68,15 +68,6 @@
left="30"
name="auto_disengage_mic_check"
top_pad="10"
width="350" />
<check_box
control_name="CookiesEnabled"
height="16"
label="Accept cookies"
layout="topleft"
left="30"
name="cookies_enabled"
top_pad="10"
width="350" />
<text
type="string"

View File

@ -265,8 +265,18 @@
layout="topleft"
left_delta="50"
name="use_external_browser"
top_pad="4"
top_pad="-2"
width="480">
<radio_item
height="20"
label="Use my browser (IE, Firefox, Safari)"
layout="topleft"
left_delta="0"
name="external"
value="1"
top="0"
tool_tip="Use the default system web browser for help, web links, etc. Not recommended if running full screen."
width="480" />
<radio_item
height="20"
label="Use built-in browser"
@ -275,25 +285,60 @@
name="internal"
value=""
tool_tip="Use the built-in web browser for help, web links, etc. This browser opens as a new window inside [APP_NAME]."
top="0"
width="480" />
<radio_item
height="20"
label="Use my browser (IE, Firefox, Safari)"
layout="topleft"
left_delta="0"
name="external"
value="1"
tool_tip="Use the default system web browser for help, web links, etc. Not recommended if running full screen."
top_delta="20"
width="480" />
</radio_group>
<check_box
top_delta="2"
enabled="true"
follows="left|top"
height="18"
initial_value="true"
control_name="BrowserPluginsEnabled"
label="Enable plugins"
left_delta="20"
mouse_opaque="true"
name="browser_plugins_enabled"
radio_style="false"
width="400"
top_pad="5"/>
<check_box
top_delta="4"
enabled="true"
follows="left|top"
height="14"
initial_value="true"
control_name="CookiesEnabled"
label="Accept cookies"
left_delta="0"
mouse_opaque="true"
name="cookies_enabled"
radio_style="false"
width="400"
top_pad="5"/>
<check_box
top_delta="4"
enabled="true"
follows="left|top"
height="16"
height="14"
initial_value="true"
control_name="BrowserJavascriptEnabled"
label="Enable Javascript"
left_delta="0"
mouse_opaque="true"
name="browser_javascript_enabled"
radio_style="false"
width="400"
top_pad="5"/>
<check_box
top_delta="4"
enabled="true"
follows="left|top"
height="14"
initial_value="false"
control_name="BrowserProxyEnabled"
label="Enable Web Proxy"
@ -308,9 +353,9 @@
follows="left|top"
height="10"
layout="topleft"
left_delta="1"
left_delta="20"
name="Proxy location"
top_delta="20"
top_delta="16"
width="300">
Proxy location:
</text>
@ -335,7 +380,7 @@
increment="1"
initial_value="80"
label="Port number:"
label_width="75"
label_width="70"
layout="topleft"
left_delta="230"
max_val="12000"

View File

@ -962,9 +962,9 @@ anguage Infrstructure (CLI) international standard</string>
<key>windows</key>
<map>
<key>md5sum</key>
<string>ee5d242ea468ba9a82d2bf8581aa308d</string>
<string>93b49cfea365fe082eda3e466a9beec3</string>
<key>url</key>
<uri>http://viewer-source-downloads.s3.amazonaws.com/install_pkgs/llqtwebkit-windows-qt4.6-20100312.tar.bz2</uri>
<uri>http://viewer-source-downloads.s3.amazonaws.com/install_pkgs/llqtwebkit-windows-qt4.6-20100318.tar.bz2</uri>
</map>
</map>
</map>