summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Müllner <fmuellner@gnome.org>2023-03-08 20:03:40 +0100
committerMarge Bot <marge-bot@gnome.org>2023-04-25 10:45:19 +0000
commit8cbf620639cdcc4ef84686c603dcbf11c754578f (patch)
treec3396fc3224159c4c3f73b9307b6c66f85f63e13
parentf7c8ff7a0c0747ccb126ae52315d8f873668474a (diff)
downloadgnome-shell-8cbf620639cdcc4ef84686c603dcbf11c754578f.tar.gz
portalHelper: Don't use deprecated API during policy decision
NavigationPolicyDecision.get_request() is deprecated, and the method from the corresponding NavigationAction should be used instead. Rearrange the code to do that. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2690>
-rw-r--r--js/portalHelper/main.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/js/portalHelper/main.js b/js/portalHelper/main.js
index 8560a4958..9e2b133ae 100644
--- a/js/portalHelper/main.js
+++ b/js/portalHelper/main.js
@@ -207,8 +207,13 @@ class PortalWindow extends Gtk.ApplicationWindow {
}
_onDecidePolicy(view, decision, type) {
+ if (type === WebKit.PolicyDecisionType.RESPONSE)
+ return false;
+
+ const navigationAction = decision.get_navigation_action();
+ const request = navigationAction.get_request();
+
if (type === WebKit.PolicyDecisionType.NEW_WINDOW_ACTION) {
- let navigationAction = decision.get_navigation_action();
if (navigationAction.is_user_gesture()) {
// Even though the portal asks for a new window,
// perform the navigation in the current one. Some
@@ -217,17 +222,13 @@ class PortalWindow extends Gtk.ApplicationWindow {
// user go through. We don't risk popups taking over
// the page because we check that the navigation is
// user initiated.
- this._webView.load_request(navigationAction.get_request());
+ this._webView.load_request(request);
}
decision.ignore();
return true;
}
- if (type !== WebKit.PolicyDecisionType.NAVIGATION_ACTION)
- return false;
-
- let request = decision.get_request();
const uri = GLib.Uri.parse(request.get_uri(), HTTP_URI_FLAGS);
if (uri.get_host() !== this._uri.get_host() && this._originalUrlWasGnome) {