After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 787849 - flatpak: Can't view page source
flatpak: Can't view page source
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Michael Catanzaro
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-09-18 16:11 UTC by Alexander Mikhaylenko
Modified: 2017-12-04 17:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
flatpak: Implement view page source (15.16 KB, patch)
2017-12-04 17:33 UTC, Michael Catanzaro
committed Details | Review

Description Alexander Mikhaylenko 2017-09-18 16:11:03 UTC
When I click "Page Source", it duplicates current tab instead. No output in console or errors.
Runtime: org.gnome.Platform//3.26
Comment 1 Michael Catanzaro 2017-09-18 16:14:44 UTC
It's supposed to open in the default text editor. Is it possible that the default text editor is Epiphany inside the flatpak environment? I bet it is. Try something like this to test:

$ flatpak run org.gnome.Epiphany --command /bin/bash
$ xdg-mime query default text/plain

I have no clue how that could be expected to work inside flatpak, unfortunately, since gedit is not going to be inside the runtime.

The real solution is probably to get embedded view source working again (see the wip/view-source branch).
Comment 2 Alexander Mikhaylenko 2017-09-18 16:18:33 UTC
See also https://bugzilla.gnome.org/show_bug.cgi?id=787850, it's pretty much the same thing, except it can't be worked around like this
Comment 3 Alexander Mikhaylenko 2017-09-18 16:24:51 UTC
xdg-mime: Command not found
Comment 4 Michael Catanzaro 2017-09-18 17:46:16 UTC
In window_cmd_page_source() and save_temp_source_close_cb(), try replacing the calls to ephy_file_launch_handler() with g_app_info_launch_default_for_uri() so that it uses flatpak's open-uri portal.
Comment 5 Michael Catanzaro 2017-11-17 17:13:53 UTC
(In reply to Michael Catanzaro from comment #4)
> In window_cmd_page_source() and save_temp_source_close_cb(), try replacing
> the calls to ephy_file_launch_handler() with
> g_app_info_launch_default_for_uri() so that it uses flatpak's open-uri
> portal.

This is hard. The portal won't work, because we'll never get to the portal, because Ephy can always open the file itself, and so it will always be chosen as the default app. I don't think this is fixable without using the portal D-Bus API directly.
Comment 6 Michael Catanzaro 2017-11-17 17:14:56 UTC
Best solution is probably to restore the in-browser view source handler... even if there's no syntax highlighting. See the wip/view-source branch.
Comment 7 Michael Catanzaro 2017-12-04 17:33:19 UTC
The following fix has been pushed:
5d7e827 flatpak: Implement view page source
Comment 8 Michael Catanzaro 2017-12-04 17:33:22 UTC
Created attachment 364936 [details] [review]
flatpak: Implement view page source

This was way too hard!

We really need to reimplement in-browser view source mode. But we have
always supported external view source mode, using the default text/plain
handler, via a hidden GSetting. So even once we restore in-browser view
source, we will still want to keep this code around.

We have to use the portal D-Bus API manually because the only way to get
it using GLib is to use g_app_info_launch_default_for_uri(), and that
will always pick Epiphany itself as the default handler, because
Epiphany supports opening HTML files. The portal is only accessible via
a fallback path.