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 738475 - Restore in-browser view source mode
Restore in-browser view source mode
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: General
3.14.x (obsolete)
Other Linux
: Normal enhancement
: ---
Assigned To: Michael Catanzaro
Epiphany Maintainers
: 731558 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2014-10-13 18:45 UTC by Eddy Castillo
Modified: 2018-06-01 21:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
View Source epiphany 3.14 (179.11 KB, application/octet-stream)
2014-10-13 18:45 UTC, Eddy Castillo
  Details
Add workaround for missing view source mode (940 bytes, patch)
2014-10-17 02:05 UTC, Michael Catanzaro
committed Details | Review
Add URI handler for view source mode (16.63 KB, patch)
2016-09-11 22:38 UTC, Michael Catanzaro
none Details | Review
Relicense to GPLv3+ (374.87 KB, patch)
2016-09-11 22:38 UTC, Michael Catanzaro
none Details | Review
Use Rainbow for syntax highlighting (124.96 KB, patch)
2016-09-11 22:38 UTC, Michael Catanzaro
none Details | Review
Add URI handler for view source mode (16.67 KB, patch)
2016-09-11 22:49 UTC, Michael Catanzaro
none Details | Review
Relicense to GPLv3+ (374.87 KB, patch)
2016-09-11 22:49 UTC, Michael Catanzaro
none Details | Review
Use Rainbow for syntax highlighting (124.96 KB, patch)
2016-09-11 22:49 UTC, Michael Catanzaro
none Details | Review
Add URI handler for view source mode (16.70 KB, patch)
2016-09-11 23:56 UTC, Michael Catanzaro
committed Details | Review
Add Prism syntax highlighting in view source mode (25.68 KB, patch)
2016-09-11 23:56 UTC, Michael Catanzaro
committed Details | Review
view-source-handler: Get content from existing embed if possible (6.86 KB, patch)
2016-09-12 18:39 UTC, Michael Catanzaro
committed Details | Review
Add Prism syntax highlighting in view source mode (25.68 KB, patch)
2016-09-12 18:39 UTC, Michael Catanzaro
committed Details | Review
Add URI handler for view source mode (16.70 KB, patch)
2016-09-12 18:39 UTC, Michael Catanzaro
committed Details | Review

Description Eddy Castillo 2014-10-13 18:45:47 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
Comment 1 Reinout van Schouwen 2014-10-13 21:38:06 UTC
Confirmed, I can reproduce this.
Comment 2 Carlos Garcia Campos 2014-10-14 05:58:29 UTC
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.
Comment 3 Reinout van Schouwen 2014-10-14 20:50:23 UTC
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?
Comment 4 Carlos Garcia Campos 2014-10-15 05:56:52 UTC
There's a setting for that, internal-view-source, disable it and you will see the source in the default editor.
Comment 5 Reinout van Schouwen 2014-10-16 19:44:04 UTC
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)?
Comment 6 Michael Catanzaro 2014-10-17 02:05:37 UTC
Created attachment 288715 [details] [review]
Add workaround for missing view source mode

We'll open the source in the default text editor instead
Comment 7 Michael Catanzaro 2014-10-17 02:10:33 UTC
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.
Comment 8 Carlos Garcia Campos 2014-10-17 05:36:28 UTC
(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.
Comment 9 Carlos Garcia Campos 2014-10-17 05:38:24 UTC
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.
Comment 10 Carlos Garcia Campos 2014-10-17 05:39:30 UTC
(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?
Comment 11 Michael Catanzaro 2014-10-18 02:33:44 UTC
*** Bug 731558 has been marked as a duplicate of this bug. ***
Comment 12 Michael Catanzaro 2014-10-18 20:46:46 UTC
(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 13 Michael Catanzaro 2014-10-18 20:58:10 UTC
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
Comment 14 Michael Catanzaro 2016-09-11 22:33:58 UTC
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!)
Comment 15 Michael Catanzaro 2016-09-11 22:38:09 UTC
(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.
Comment 16 Michael Catanzaro 2016-09-11 22:38:31 UTC
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.
Comment 17 Michael Catanzaro 2016-09-11 22:38:38 UTC
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
Comment 18 Michael Catanzaro 2016-09-11 22:38:42 UTC
Created attachment 335325 [details] [review]
Use Rainbow for syntax highlighting
Comment 19 Michael Catanzaro 2016-09-11 22:47:03 UTC
(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.
Comment 20 Michael Catanzaro 2016-09-11 22:49:25 UTC
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.
Comment 21 Michael Catanzaro 2016-09-11 22:49:32 UTC
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
Comment 22 Michael Catanzaro 2016-09-11 22:49:37 UTC
Created attachment 335330 [details] [review]
Use Rainbow for syntax highlighting
Comment 23 Michael Catanzaro 2016-09-11 23:23:10 UTC
(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 24 Michael Catanzaro 2016-09-11 23:30:10 UTC
Comment on attachment 335329 [details] [review]
Relicense to GPLv3+

I'm still inclined to do this, but it's a separate issue now.
Comment 25 Michael Catanzaro 2016-09-11 23:56:46 UTC
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.
Comment 26 Michael Catanzaro 2016-09-11 23:56:50 UTC
Created attachment 335332 [details] [review]
Add Prism syntax highlighting in view source mode

It's MIT licensed. Thanks Prism developers!
Comment 27 Michael Catanzaro 2016-09-11 23:57:40 UTC
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. :(
Comment 28 Michael Catanzaro 2016-09-12 18:39:29 UTC
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
Comment 29 Michael Catanzaro 2016-09-12 18:39:40 UTC
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.
Comment 30 Michael Catanzaro 2016-09-12 18:39:45 UTC
Created attachment 335384 [details] [review]
Add Prism syntax highlighting in view source mode

It's MIT licensed. Thanks Prism developers!
Comment 31 Michael Catanzaro 2016-09-12 18:39:49 UTC
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.
Comment 32 Michael Catanzaro 2017-02-12 00:43:49 UTC
Reopening. Reverted this in bug #775145.
Comment 33 Michael Catanzaro 2017-02-12 03:41:30 UTC
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.
Comment 34 Michael Catanzaro 2018-06-01 21:12:56 UTC
I'm going to bring this back without any syntax highlighting for now. Resolves https://github.com/flathub/org.gnome.Epiphany/issues/4.