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 734453 - Automatically add setup Amazon referral codes
Automatically add setup Amazon referral codes
Status: RESOLVED OBSOLETE
Product: epiphany
Classification: Core
Component: General
unspecified
Other All
: Normal normal
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-08-07 20:18 UTC by Bastien Nocera
Modified: 2018-08-03 20:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ephy-uri-helpers: Small fixes in tracking removal code (1.20 KB, patch)
2014-08-07 20:18 UTC, Bastien Nocera
committed Details | Review
ephy-uri-helpers: Add helper to add GNOME's Amazon referral codes (3.12 KB, patch)
2014-08-07 20:19 UTC, Bastien Nocera
none Details | Review
embed: Add Amazon tags when set up to do so (1.51 KB, patch)
2014-08-07 20:19 UTC, Bastien Nocera
reviewed Details | Review
ephy-uri-helpers: Add helper to add GNOME's Amazon referral codes (3.17 KB, patch)
2014-08-08 08:00 UTC, Bastien Nocera
reviewed Details | Review

Description Bastien Nocera 2014-08-07 20:18:46 UTC
.
Comment 1 Bastien Nocera 2014-08-07 20:18:58 UTC
Created attachment 282841 [details] [review]
ephy-uri-helpers: Small fixes in tracking removal code
Comment 2 Bastien Nocera 2014-08-07 20:19:03 UTC
Created attachment 282842 [details] [review]
ephy-uri-helpers: Add helper to add GNOME's Amazon referral codes

So that we automatically give money to GNOME! (but only when setup to do
so, obviously).
Comment 3 Bastien Nocera 2014-08-07 20:19:08 UTC
Created attachment 282843 [details] [review]
embed: Add Amazon tags when set up to do so
Comment 4 Bastien Nocera 2014-08-07 20:23:53 UTC
This is untested, as my WebKitGTK is too old, but dropping a file like this one, should automatically load the tags when they're absent:
$ cat ~/.config/epiphany/amazon-referral.ini
[Amazon Referral Codes]
www.amazon.co.uk=hadessnet-21
www.amazon.de=hadessnet0f-21
www.amazon.es=hadessnet08-21
www.amazon.fr=hadessnet0b-21
www.amazon.it=hadessnet0e-21

(that's my own referral code, we would obviously have a file that's GNOME's referral code if we ever deploy this feature).
Comment 5 Michael Catanzaro 2014-08-07 22:13:55 UTC
Review of attachment 282842 [details] [review]:

Worth mentioning that your sample key file is missing www.amazon.com

::: lib/ephy-uri-helpers.c
@@ +297,3 @@
+    return ret;
+
+  host = soup_uri_get_host (uri);

This could be NULL e.g. if it's an about: URI; you should bail if so.

@@ +302,3 @@
+    goto bail;
+
+  query = soup_uri_get_query (uri);

If I type www.amazon.co.uk then the query will always be null; this is the ?key=value&key=value portion of the URL. So you'll always bail here before you get a chance to append your referrer.
Comment 6 Bastien Nocera 2014-08-08 08:00:27 UTC
Created attachment 282878 [details] [review]
ephy-uri-helpers: Add helper to add GNOME's Amazon referral codes

So that we automatically give money to GNOME! (but only when setup to do
so, obviously).
Comment 7 Michael Catanzaro 2014-08-08 15:24:28 UTC
Review of attachment 282843 [details] [review]:

::: embed/web-extension/ephy-web-extension.c
@@ +149,3 @@
+  if (new_uri) {
+    webkit_uri_request_set_uri (request, new_uri);
+    request_uri = webkit_uri_request_get_uri (request);

Now ephy_add_amazon_referral() works, but this variable is later used only to test whether the page should be blocked by adblock.
Comment 8 Bastien Nocera 2014-08-08 17:52:40 UTC
(In reply to comment #7)
> Review of attachment 282843 [details] [review]:
> 
> ::: embed/web-extension/ephy-web-extension.c
> @@ +149,3 @@
> +  if (new_uri) {
> +    webkit_uri_request_set_uri (request, new_uri);
> +    request_uri = webkit_uri_request_get_uri (request);
> 
> Now ephy_add_amazon_referral() works, but this variable is later used only to
> test whether the page should be blocked by adblock.

Is that a problem, or do we automatically assume that anything coming from amazon isn't adverts? It could be...
Comment 9 Michael Catanzaro 2014-08-09 00:10:18 UTC
The problem is the new URI with the referrer appended is not used for anything else. (I still wind up at www.amazon.co.uk without the referrer.)
Comment 10 Bastien Nocera 2014-08-09 00:16:03 UTC
(In reply to comment #9)
> The problem is the new URI with the referrer appended is not used for anything
> else. (I still wind up at www.amazon.co.uk without the referrer.)

No, we call webkit_uri_request_set_uri() with that new URI. It's the same code as when we remove analytics just above (unless that's not working either...).
Comment 11 Michael Catanzaro 2014-08-09 14:02:17 UTC
(In reply to comment #10)
> No, we call webkit_uri_request_set_uri() with that new URI. It's the same code
> as when we remove analytics just above (unless that's not working either...).

Doesn't seem to be working, e.g. http://www.imdb.com/news/ni57577848/?ref_=hm_nw_tp_t4 should be stripped but isn't.

But I'm not sure what's wrong. You're right that changing the URIRequest passed to the send-request signal handler ought to change the page that's loaded.
Comment 12 Michael Catanzaro 2014-08-09 16:45:22 UTC
(In reply to comment #11)
> But I'm not sure what's wrong. You're right that changing the URIRequest passed
> to the send-request signal handler ought to change the page that's loaded.

Checking with Wireshark, it's working properly, I think, it's just that the change does not appear in Epiphany's address bar.
Comment 13 Michael Catanzaro 2014-08-09 17:10:26 UTC
I think WebKitWebPage::willSendRequestForFrame() needs to update the WebView's address property if the URIRequest is different after the send-request signal is emitted. Carlos, is that correct? Is there any reasonable way to accomplish that?
Comment 14 Michael Catanzaro 2014-09-11 03:49:11 UTC
Comment on attachment 282841 [details] [review]
ephy-uri-helpers: Small fixes in tracking removal code

Attachment 282841 [details] pushed as d5e3f0b - ephy-uri-helpers: Small fixes in tracking removal code
Comment 15 Michael Catanzaro 2015-06-24 21:54:08 UTC
Comment on attachment 282843 [details] [review]
embed: Add Amazon tags when set up to do so

Removing from the unreviewed patches list, since there is an outstanding problem ("I think WebKitWebPage::willSendRequestForFrame() needs to update the WebView's address property if the URIRequest is different after the send-request signal is emitted.")
Comment 16 Bastien Nocera 2015-06-24 22:11:05 UTC
(In reply to Michael Catanzaro from comment #15)
> Comment on attachment 282843 [details] [review] [review]
> embed: Add Amazon tags when set up to do so
> 
> Removing from the unreviewed patches list, since there is an outstanding
> problem ("I think WebKitWebPage::willSendRequestForFrame() needs to update
> the WebView's address property if the URIRequest is different after the
> send-request signal is emitted.")

Is that a bug that needs to be filed against WebKit?
Comment 17 Michael Catanzaro 2015-06-24 23:01:20 UTC
Oh, yes; I didn't read my own comment closely enough. This should be easy.
Comment 18 Michael Catanzaro 2015-06-25 03:00:02 UTC
(In reply to Michael Catanzaro from comment #17)
> This should be easy.

Ha, ha, ha.....
Comment 19 Michael Catanzaro 2015-08-12 18:16:38 UTC
Review of attachment 282841 [details] [review]:

Hm, this one is trivial
Comment 20 Michael Catanzaro 2015-08-12 18:20:58 UTC
Review of attachment 282843 [details] [review]:

In the commit message, /s/embed/web-extension/

Changes are good
Comment 21 Michael Catanzaro 2015-08-12 18:35:33 UTC
Review of attachment 282878 [details] [review]:

Thoughts on this:

* My primary concern: I want to see approval from our pro bono counsel, since this could possibly be an... issue.
* If approved, we should install the keyfile by default. (I presume you were planning to do this; otherwise, I don't see the advantage of setting it up manually over using Amazon Smile.)
* Ideally I would finish WebKit 146306 first.
* Code changes are good.

::: lib/ephy-uri-helpers.c
@@ +264,3 @@
+    g_key_file_unref (keyfile);
+    g_free (path);
+    return NULL;

The 'goto out' style would work better for this cleanup.

@@ +306,3 @@
+
+  query = soup_uri_get_query (uri);
+  if (query) {

You could probably split this into another function, gboolean ephy_should_add_amazon_referral().

@@ +338,3 @@
+bail:
+  g_clear_pointer (&tag, g_free);
+  g_list_free_full (items, (GDestroyNotify) query_item_free);

This cast is necessary?
Comment 22 Bastien Nocera 2015-08-17 18:32:52 UTC
Comment on attachment 282841 [details] [review]
ephy-uri-helpers: Small fixes in tracking removal code

Was committed in d5e3f0b6dceaf22d03cc13ef633a93317100be6b
Comment 23 GNOME Infrastructure Team 2018-08-03 20:21:39 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/epiphany/issues/247.