Permalink
Browse files

Click might happen up to 15ms before unload

When checking if the current URL is the same as the clicked URL of the
previous page, we should allow some grace period for the time between
click and unload.  15ms seems appropriate since it's the least count for
the JS timer on Windows so we're unlikely to get something smaller than
that.

This solves an issue with going from HTTP to HTTPS since referrers are
hidden for privacy reasons.
  • Loading branch information...
1 parent 441fc7e commit 86eeb99fa8d173d131a93f2880a9f826fc3e2682 @bluesmoon committed May 29, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 plugins/rt.js
View
@@ -107,8 +107,13 @@ impl = {
BOOMR.debug("Read from cookie " + BOOMR.utils.objectToString(subcookies), "rt");
if(subcookies.s && subcookies.r) {
this.r = subcookies.r;
+
+ BOOMR.debug(this.r + " =?= " + this.r2, "rt");
+ BOOMR.debug(subcookies.s + " <? " + (+subcookies.cl+15), "rt");
+ BOOMR.debug(subcookies.nu + " =?= " + d.URL.replace(/#.*/, ''), "rt");
+
if(!this.strict_referrer || this.r === this.r2 ||
- ( subcookies.s === +subcookies.cl && subcookies.nu === d.URL.replace(/#.*/, '') )
+ ( subcookies.s < +subcookies.cl + 15 && subcookies.nu === d.URL.replace(/#.*/, '') )
) {
this.t_start = subcookies.s;
if(+subcookies.hd > subcookies.s) {

0 comments on commit 86eeb99

Please sign in to comment.