GNOME Bugzilla – Bug 738475
Restore in-browser view source mode
Last modified: 2018-06-01 21:13:52 UTC
Created attachment 288414 [details] View Source epiphany 3.14 I don't know when this started happening, but just like the title says. View Source only duplicates the current open tab. Steps to reproduce: 1. Open epiphany 2. Click "View Source" in the application menu. Reproducible: Always Details: epiphany-3.14.0-1.fc21.x86_64 webkitgtk4-2.6.0-2.fc21.x86_64
Confirmed, I can reproduce this.
Yes, this is a regression in 3.14 :-( The view source mode was removed from WebKit. This should be easy to fix, though, by implementing a custom URI scheme and using a light js library for syntax highlighting like rainbow.
Right. So after a lot of discussion gEdit no longer handles View Source and now we‘re back at square 1! Can't we just re-instate gEdit?
There's a setting for that, internal-view-source, disable it and you will see the source in the default editor.
Well if it's that easy to work around this bug, why isn't it set by default (at least for as long there's no better solution)?
Created attachment 288715 [details] [review] Add workaround for missing view source mode We'll open the source in the default text editor instead
The problem we've discussed with Rainbow is that it's Apache 2.0, which is incompatible with GPLv2. I think we'd need to relicense Epiphany (as a whole, not necessarily individual source files) from GPLv2+ to GPLv3+. I'm all in favor of that and it's easy (since each file is already GPLv2+, we don't need anybody's permission to make the change), we just have to agree it's something we want to do.
(In reply to comment #5) > Well if it's that easy to work around this bug, why isn't it set by default (at > least for as long there's no better solution)? Good question :-P You are indeed right.
Review of attachment 288715 [details] [review]: ::: src/window-commands.c @@ +1395,3 @@ address = ephy_web_view_get_address (ephy_embed_get_web_view (embed)); +/* Disabled due to bug #738475 Please use #if 0 instead of a comment. And start the comment with FIXME: so that greping FIXME will show this line.
(In reply to comment #7) > The problem we've discussed with Rainbow is that it's Apache 2.0, which is > incompatible with GPLv2. I think we'd need to relicense Epiphany (as a whole, > not necessarily individual source files) from GPLv2+ to GPLv3+. I'm all in > favor of that and it's easy (since each file is already GPLv2+, we don't need > anybody's permission to make the change), we just have to agree it's something > we want to do. Could you propose it in the mailing list?
*** Bug 731558 has been marked as a duplicate of this bug. ***
(In reply to comment #10) > Could you propose it in the mailing list? https://mail.gnome.org/archives/epiphany-list/2014-October/msg00012.html
Comment on attachment 288715 [details] [review] Add workaround for missing view source mode Attachment 288715 [details] pushed as b58fb28 - Add workaround for missing view source mode
OK I have this implemented. I'm pushing a version without syntax highlighting to master, and the version with syntax highlighting to wip/rainbowjs. I don't think we're going to be able to merge the Rainbow version. Unfortunately it is slow... very, very, very slow. It can handle stuff like example.com, but e.g. www.gnome.org takes 45 seconds to highlight, git.gnome.org takes 2 minutes and 45 seconds, and I'm not patient enough to see how long it takes on github.com. So that's clearly not acceptable (GtkSourceView can do this instantaneously!)
(In reply to Michael Catanzaro from comment #14) > OK I have this implemented. I'm pushing a version without syntax > highlighting to master, and the version with syntax highlighting to > wip/rainbowjs. Actually I'll let them sit in Bugzilla for a little while; I don't plan to come back to this immediately.
Created attachment 335323 [details] [review] Add URI handler for view source mode For now, it just displays the original page with all the subresources removed. Not very useful! But the next step is to make it display the page's source, and that will be useful indeed.
Created attachment 335324 [details] [review] Relicense to GPLv3+ So we don't need a legal review to deterimine if we can use Rainbow Also because http://www.gnu.org/licenses/rms-why-gplv3.html
Created attachment 335325 [details] [review] Use Rainbow for syntax highlighting
(In reply to Michael Catanzaro from comment #16) > Created attachment 335323 [details] [review] [review] > Add URI handler for view source mode > > For now, it just displays the original page with all the subresources > removed. Not very useful! But the next step is to make it display the > page's source, and that will be useful indeed. Ah, I squashed the next commit into it, let's try again with an accurate commit message.
Created attachment 335328 [details] [review] Add URI handler for view source mode So we don't have to open these in gedit anymore. Disadvantage: the URL that gets displayed is actually pulled from the server again, so it might not actually be what's displayed in your browser. This might be undesirable.
Created attachment 335329 [details] [review] Relicense to GPLv3+ So we don't need a legal review to deterimine if we can use Rainbow Also because http://www.gnu.org/licenses/rms-why-gplv3.html
Created attachment 335330 [details] [review] Use Rainbow for syntax highlighting
(In reply to Michael Catanzaro from comment #14) > I don't think we're going to be able to merge the Rainbow version. > Unfortunately it is slow... very, very, very slow. It can handle stuff like > example.com, but e.g. www.gnome.org takes 45 seconds to highlight, > git.gnome.org takes 2 minutes and 45 seconds, and I'm not patient enough to > see how long it takes on github.com. So that's clearly not acceptable > (GtkSourceView can do this instantaneously!) I tried Prism instead (prismjs.com) and it's several orders of magnitude faster, and really pretty, so let's use that instead.
Comment on attachment 335329 [details] [review] Relicense to GPLv3+ I'm still inclined to do this, but it's a separate issue now.
Created attachment 335331 [details] [review] Add URI handler for view source mode So we don't have to open these in gedit anymore. Disadvantage: the URL that gets displayed is actually pulled from the server again, so it might not actually be what's displayed in your browser. This might be undesirable.
Created attachment 335332 [details] [review] Add Prism syntax highlighting in view source mode It's MIT licensed. Thanks Prism developers!
Unfortunately since the horizontal scrollbar is at the bottom of the <pre> area, it's hard for users to realize it's even possible to scroll horizontally. :(
The following fixes have been pushed: 8a3c6b1 view-source-handler: Get content from existing embed if possible 8968687 Add Prism syntax highlighting in view source mode d6d9d25 Add URI handler for view source mode
Created attachment 335383 [details] [review] view-source-handler: Get content from existing embed if possible Instead of always hitting the network to download the page again, first try to get the source from an existing web view that matches the URI to be displayed. Be careful to ignore the web view if it has a deferred load or hasn't finished loading yet. It's not perfect, in that it could get the source code from the wrong tab if two different tabs are displaying the same URI, but let not perfect be the enemy of the good.
Created attachment 335384 [details] [review] Add Prism syntax highlighting in view source mode It's MIT licensed. Thanks Prism developers!
Created attachment 335386 [details] [review] Add URI handler for view source mode So we don't have to open these in gedit anymore. Disadvantage: the URL that gets displayed is actually pulled from the server again, so it might not actually be what's displayed in your browser. This might be undesirable.
Reopening. Reverted this in bug #775145.
I pushed a sidebranch with this code restored: https://git.gnome.org/browse/epiphany/log/?h=wip/view-source That would be a good starting place for anybody looking to work on this.
I'm going to bring this back without any syntax highlighting for now. Resolves https://github.com/flathub/org.gnome.Epiphany/issues/4.