• Michael Catanzaro's avatar
    window: launch URLs whenever triggered by user gesture · ce013449
    Michael Catanzaro authored
    Currently we check the default app for the URI scheme and call
    gtk_show_uri_on_window() only if the default app is not NULL and is not
    Epiphany. This fails under flatpak because there we cannot check the
    user's default apps. It is always NULL, so we bail out and refuse to
    launch any app for the URL. Oops.
    
    This code was originally added to prevent us from launching Epiphany in
    a recursive loop if it somehow gets registered as the default handler
    for a scheme that it doesn't actually support, as in #1053. In this
    case, we should only relaunch ourselves once because the second launch
    will be triggered by API request, when the new instance calls
    webkit_web_view_load_uri(). That's not a user gesture and will avoid the
    recursion.
    
    This change also prevents websites from opening URLs without user
    intervention.
    
    Thanks to Adrian Perez for proposing this solution!
    
    Fixes #1385
    
    Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/951>
    
    
    (cherry picked from commit 6c223bb8b3e75026eeecc61424e5a73649aca1f2)
    ce013449