Re: [dev] [surf] Bug: _SURF_URI and _SURF_GO sometimes won't update

2019-03-01 Thread nzl
This is a bug of surf, it usually happens when browsing some js heavy sites, I 
have something
like the following in my custom version of surf, and it solved the problem.

commit 9280cffc390e79416487d23f6cbca96fb80fc0da
Author: nzl 
Date:   Fri Jan 18 06:44:30 2019 +

signal uri change

diff --git a/surf.c b/surf.c
index 5c8cb4e..fd7223c 100644
--- a/surf.c
+++ b/surf.c
@@ -175,6 +175,7 @@ static gboolean loadfailedtls(WebKitWebView *v, gchar *uri,
 static void loadchanged(WebKitWebView *v, WebKitLoadEvent e, Client *c);
 static void progresschanged(WebKitWebView *v, GParamSpec *ps, Client *c);
 static void titlechanged(WebKitWebView *view, GParamSpec *ps, Client *c);
+static void urichanged(WebKitWebView *view, GParamSpec *ps, Client *c);
 static void mousetargetchanged(WebKitWebView *v, WebKitHitTestResult *h,
guint modifiers, Client *c);
 static gboolean permissionrequested(WebKitWebView *v,
@@ -531,6 +532,8 @@ newclient(void)
 G_CALLBACK(progresschanged), c);
g_signal_connect(G_OBJECT(v), "notify::title",
 G_CALLBACK(titlechanged), c);
+   g_signal_connect(G_OBJECT(v), "notify::uri",
+G_CALLBACK(urichanged), c);
g_signal_connect(G_OBJECT(v), "button-release-event",
 G_CALLBACK(buttonreleased), c);
g_signal_connect(G_OBJECT(v), "close",
@@ -591,8 +594,6 @@ loaduri(Client *c, const char *uri)
free(apath);
}
 
-   setatom(c, AtomUri, url);
-
if (strcmp(url, geturi(c)) == 0) {
a.i = 0;
reload(c, );
@@ -600,9 +601,7 @@ loaduri(Client *c, const char *uri)
if (!useragent)
randuseragent(c);
webkit_web_view_load_uri(c->view, url);
-   updatetitle(c);
}
-
g_free(url);
 }
 
@@ -1159,7 +1158,7 @@ loadchanged(WebKitWebView *v, WebKitLoadEvent e, Client 
*c)
 
switch (e) {
case WEBKIT_LOAD_STARTED:
-   setatom(c, AtomUri, uri);
+   c->overtitle = NULL;
c->title = uri;
c->https = c->insecure = 0;
seturiparameters(c, uri, loadtransient);
@@ -1169,7 +1168,7 @@ loadchanged(WebKitWebView *v, WebKitLoadEvent e, Client 
*c)
g_clear_object(>failedcert);
break;
case WEBKIT_LOAD_REDIRECTED:
-   setatom(c, AtomUri, uri);
+   c->overtitle = NULL;
c->title = uri;
seturiparameters(c, uri, loadtransient);
break;
@@ -1200,6 +1199,12 @@ titlechanged(WebKitWebView *view, GParamSpec *ps, Client 
*c)
updatetitle(c);
 }
 
+void
+urichanged(WebKitWebView *view, GParamSpec *ps, Client *c)
+{
+   setatom(c, AtomUri, geturi(c));
+}
+
 void
 mousetargetchanged(WebKitWebView *v, WebKitHitTestResult *h, guint modifiers,
 Client *c)




Re: [dev] [surf] Bug: _SURF_URI and _SURF_GO sometimes won't update

2019-02-27 Thread Nick
Quoth Szpak: 
> It's not very often so I don't worry much about that, but I have a feeling
> that (at least on my machine) it's related to:
> 1. using proxy (privoxy or squid in my case);
> 2. unfinished page loading, which stops at some percent before 100, like 89%
> or even 40%;
> 
> The problem number 2 was already discussed here on suckless list a while ago
> but I cannot find it now. Maybe someone else can confirm that it's related
> or not.

FYI that was my post, thread starts here: 
http://lists.suckless.org/dev/1803/32607.html

I don't know if it's related to the OP's issue or not.



Re: [dev] [surf] Bug: _SURF_URI and _SURF_GO sometimes won't update

2019-02-27 Thread Szpak

Hi Suleiman,

I can't reproduce your problem just like that (google.de → search →  
redirection → copy/bookmark url). So mostly it works just fine, but  
sometimes I notice similar behavior, which is incorrect url after  
redirection (from duckduckgo in my case).


It's not very often so I don't worry much about that, but I have a feeling  
that (at least on my machine) it's related to:

1. using proxy (privoxy or squid in my case);
2. unfinished page loading, which stops at some percent before 100, like  
89% or even 40%;


The problem number 2 was already discussed here on suckless list a while  
ago but I cannot find it now. Maybe someone else can confirm that it's  
related or not.


Meanwhile try to reproduce bug without proxy (if you use any) and make  
sure that your surf sources are the latest one.


sZpak