[epiphany] prefs-dialog: Do not use embed web context for sync webview



commit edee9612e99442a830327279c014dc4332fa0d4d
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Wed Nov 23 15:17:45 2016 -0600

    prefs-dialog: Do not use embed web context for sync webview
    
    Turns out this is crazy, it results in the Ephy web extension running in
    the web process. Instead, stick with the default web context and just
    set Accept-Lang headers on that as well, so we don't lose localization
    of the login page. We can still safely get user agent etc. via the
    shared settings object.

 embed/ephy-embed-prefs.c |    4 ++++
 src/prefs-dialog.c       |    4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/embed/ephy-embed-prefs.c b/embed/ephy-embed-prefs.c
index c5701e9..d59420a 100644
--- a/embed/ephy-embed-prefs.c
+++ b/embed/ephy-embed-prefs.c
@@ -369,6 +369,10 @@ webkit_pref_callback_accept_languages (GSettings  *settings,
 
   webkit_web_context_set_preferred_languages (web_context, (const char * const *)(void *)array->data);
 
+  /* Set preferred languages also for the default web context, used by the sync
+   * tab in the preferences dialog. It doesn't need spellchecking. */
+  webkit_web_context_set_preferred_languages (webkit_web_context_get_default (), (const char * const *)(void 
*)array->data);
+
   if (g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_ENABLE_SPELL_CHECKING)) {
     char **normalized = normalize_languages ((char **)(void *)array->data);
     webkit_web_context_set_spell_checking_languages (web_context, (const char * const *)normalized);
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index d6a2572..fa2528f 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -409,7 +409,6 @@ out:
 static void
 setup_fxa_sign_in_view (PrefsDialog *dialog)
 {
-  EphyEmbedShell *shell;
   const char *js = "\"use strict\";"
                    "function handleAccountsCommand(evt) {"
                    "  let j = {type: evt.type, detail: evt.detail};"
@@ -417,8 +416,6 @@ setup_fxa_sign_in_view (PrefsDialog *dialog)
                    "};"
                    "window.addEventListener(\"FirefoxAccountsCommand\", handleAccountsCommand);";
 
-  shell = ephy_embed_shell_get_default ();
-
   dialog->fxa_script = webkit_user_script_new (js,
                                                WEBKIT_USER_CONTENT_INJECT_TOP_FRAME,
                                                WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_END,
@@ -433,7 +430,6 @@ setup_fxa_sign_in_view (PrefsDialog *dialog)
                                                                "accountsCommandHandler");
 
   dialog->fxa_web_view = WEBKIT_WEB_VIEW (g_object_new (WEBKIT_TYPE_WEB_VIEW,
-                                                        "web-context", ephy_embed_shell_get_web_context 
(shell),
                                                         "user-content-manager", dialog->fxa_manager,
                                                         "settings", ephy_embed_prefs_get_settings (),
                                                         NULL));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]