Mask timezone, language, architecture and plugins

This commit is contained in:
Christian Dywan 2011-04-19 23:07:22 +02:00
parent 683c9d3d32
commit 7152189d82
2 changed files with 21 additions and 0 deletions

View file

@ -2070,6 +2070,8 @@ main (int argc,
g_set_application_name (_("Midori (Private Browsing)")); g_set_application_name (_("Midori (Private Browsing)"));
if (!config && !webapp) if (!config && !webapp)
config = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, NULL); config = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, NULL);
/* Mask the timezone, which can be read by Javascript */
g_setenv ("TZ", "UTC", TRUE);
} }
else else
g_set_application_name (_("Midori")); g_set_application_name (_("Midori"));
@ -2214,6 +2216,7 @@ main (int argc,
if (private) if (private)
{ {
g_object_set (settings, g_object_set (settings,
"preferred-languages", "en",
#if WEBKIT_CHECK_VERSION (1, 1, 2) #if WEBKIT_CHECK_VERSION (1, 1, 2)
"enable-private-browsing", TRUE, "enable-private-browsing", TRUE,
#endif #endif

View file

@ -3169,6 +3169,24 @@ webkit_web_view_window_object_cleared_cb (GtkWidget* web_view,
JSObjectRef js_window, JSObjectRef js_window,
MidoriView* view) MidoriView* view)
{ {
#if WEBKIT_CHECK_VERSION (1, 1, 2)
if (katze_object_get_boolean (view->settings, "enable-private-browsing"))
{
/* Mask language, architecture, no plugin list */
gchar* result = sokoke_js_script_eval (js_context,
"navigator = { 'appName': 'Netscape',"
"'appCodeName': 'Mozilla',"
"'appVersion': '5.0 (X11)',"
"'userAgent': navigator.userAgent,"
"'language': 'en-US',"
"'platform': 'Linux i686',"
"'cookieEnabled': true,"
"'plugins': {'refresh': function () { } } };",
NULL);
g_free (result);
}
#endif
g_signal_emit (view, signals[CONTEXT_READY], 0, js_context); g_signal_emit (view, signals[CONTEXT_READY], 0, js_context);
} }