[gnome-maps/wip/mlundblad/webkit-sandboxing] WIP: osmAccountDialog: Enable sandboxing on web view



commit 338336f215c5cffea3a8e7ee45bb4da7ce2078f4
Author: Marcus Lundblad <ml update uu se>
Date:   Wed May 13 23:24:25 2020 +0200

    WIP: osmAccountDialog: Enable sandboxing on web view

 data/ui/osm-account-dialog.ui | 11 -----------
 src/osmAccountDialog.js       | 14 +++++++++++++-
 2 files changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/data/ui/osm-account-dialog.ui b/data/ui/osm-account-dialog.ui
index a9d88d2f..14a312e1 100644
--- a/data/ui/osm-account-dialog.ui
+++ b/data/ui/osm-account-dialog.ui
@@ -187,17 +187,6 @@ OpenStreetMap account.</property>
                 <property name="visible">True</property>
                 <property name="row-spacing">10</property>
                 <property name="margin">20</property>
-                <child>
-                  <object class="WebKitWebView" id="verifyView">
-                    <property name="visible">True</property>
-                    <property name="halign">GTK_ALIGN_FILL</property>
-                    <property name="height-request">150</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">0</property>
-                  </packing>
-                </child>
                 <child>
                   <object class="GtkGrid">
                     <property name="visible">True</property>
diff --git a/src/osmAccountDialog.js b/src/osmAccountDialog.js
index 56a6b983..b9a0ae7d 100644
--- a/src/osmAccountDialog.js
+++ b/src/osmAccountDialog.js
@@ -39,7 +39,7 @@ var OSMAccountDialog = GObject.registerClass({
                        'signInSpinner',
                        'signUpLinkButton',
                        'resetPasswordLabel',
-                       'verifyView',
+                       'verifyGrid',
                        'verificationEntry',
                        'verifyButton',
                        'verificationFailedLabel',
@@ -78,6 +78,18 @@ var OSMAccountDialog = GObject.registerClass({
             this._signedInUserLabel.label = Application.osmEdit.username;
             this._stack.visible_child_name = 'logged-in';
         }
+
+        /* initilize verification web view, we do it programmatically rather
+         * declare it in the .ui file to be able to enable WebKit sandboxing
+         */
+        let webContext = WebKit2.WebContext.get_default();
+
+        webContext.set_sandbox_enabled(true);
+        this._verifyView = WebKit2.WebView.new_with_context(webContext);
+        this._verifyView.visible = true;
+        this._verifyView.halign = Gtk.Align.FILL;
+        this._verifyView.height_request = 150;
+        this._verifyGrid.attach(this._verifyView, 0, 0, 1, 1);
     }
 
     _onCredentialsChanged() {


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