[Pkg-mozext-commits] [wot] 02/09: Updated versions; bugfix at stats

David Prévot taffit at moszumanska.debian.org
Sat Jul 11 22:49:47 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository wot.

commit 5b22916a187f8611200253f48e824b32a71223ad
Author: Sergey Andryukhin <sorgoz at yandex.com>
Date:   Mon Apr 20 17:32:13 2015 +0300

    Updated versions; bugfix at stats
---
 content/config.js    |   6 +-
 content/core.js      |  35 +--
 content/rw/wot.js    |   4 +-
 content/stats.js     | 630 +++++++++++++++++++++++++--------------------------
 install.rdf.template |   4 +-
 5 files changed, 326 insertions(+), 353 deletions(-)

diff --git a/content/config.js b/content/config.js
index 4487478..5d1ec54 100644
--- a/content/config.js
+++ b/content/config.js
@@ -1,6 +1,6 @@
 /*
 	config.js
-	Copyright © 2005 - 2013  WOT Services Oy <info at mywot.com>
+	Copyright © 2005 - 2015  WOT Services Oy <info at mywot.com>
 
 	This file is part of WOT.
 
@@ -21,7 +21,7 @@
 "use strict";
 
 const WOT_PLATFORM = "firefox";
-const WOT_VERSION  = "20140422";
+const WOT_VERSION  = "20150420";
 
 /*
  * Constants
@@ -406,4 +406,4 @@ const WOT_STATS = {
 	VER: 	"1.0",
 	URL: 	"https://secure.mywot.com/config",
 	ST: 	60 * 1000 * 30
-};
\ No newline at end of file
+};
diff --git a/content/core.js b/content/core.js
index 50e400e..0355223 100755
--- a/content/core.js
+++ b/content/core.js
@@ -74,7 +74,7 @@ wot_listener.prototype =
 			if (tabUrl && wot_stats.isWebURL(tabUrl)) {
 				var ref = browser.contentDocument.referrer;
 				if (request && request.referrer && typeof(request.referrer) != undefined) {
-					ref = request.referrer.asciiSpec;	
+					ref = request.referrer.asciiSpec;
 				}
 
 				wot_stats.loc(tabUrl, ref);
@@ -101,7 +101,7 @@ wot_listener.prototype =
 	},
 
 	onStatusChange: function(browser, webProgress, request, status, message)
-	{ 
+	{
 	},
 
 	onSecurityChange: function(browser, progress, request, state)
@@ -178,7 +178,7 @@ var wot_core =
 			}
 		} catch (e) {
 			dump("wot_core.init: failed with " + e + "\n");
-			console.log("wot_core.init() - error."  +e);
+//			console.log("wot_core.init() - error."  +e);
 		}
 	},
 
@@ -220,8 +220,6 @@ var wot_core =
 				browser.addTabsProgressListener(wot_core.listener);
 
 				if (browser.tabContainer) {
-					browser.tabContainer.addEventListener("TabOpen",
-						wot_core.tabopen, false);
 					browser.tabContainer.addEventListener("TabSelect",
 						wot_core.tabselect, false);
 				}
@@ -256,8 +254,6 @@ var wot_core =
 			}
 
 			if (browser.tabContainer) {
-				browser.tabContainer.removeEventListener("TabOpen",
-					wot_core.tabopen, false);
 				browser.tabContainer.removeEventListener("TabSelect",
 					wot_core.tabselect, false);
 			}
@@ -334,36 +330,13 @@ var wot_core =
 	{
 		try {
 			var browser = getBrowser().selectedTab;
-			/* report selected tab*/
 			var tabUrl = event.target.linkedBrowser.currentURI.spec;
 			wot_stats.focus(tabUrl);
-
-			if (browser && browser.listener) {
-				browser.removeTabsProgressListener(browser.listener);
-				browser.listener = null;
-			}
 		} catch (e) {
 			dump("wot_core.tabselect: failed with " + e + "\n");
 		}
 	},
 
-	tabopen: function(event)
-	{
-		try {
-			var browser = event.target.linkedBrowser;
-
-			if (!browser || browser.listener) {
-				return;
-			}
-
-			/* Catch state changes for background tabs */
-			browser.listener = new wot_listener(browser);
-			browser.addTabsProgressListener(browser.listener);
-		} catch (e) {
-			dump("wot_core.tabopen: failed with " + e + "\n");
-		}
-	},
-
 	showloading: function(pl, request, url, hostname)
 	{
 		try {
@@ -796,4 +769,4 @@ var wot_core =
 	}
 };
 
-wot_core.init();
\ No newline at end of file
+wot_core.init();
diff --git a/content/rw/wot.js b/content/rw/wot.js
index 45982e9..bb8fef3 100644
--- a/content/rw/wot.js
+++ b/content/rw/wot.js
@@ -1,6 +1,6 @@
 /*
 	wot.js
-	Copyright © 2009 - 2014  WOT Services Oy <info at mywot.com>
+	Copyright © 2009 - 2015  WOT Services Oy <info at mywot.com>
 
 	This file is part of WOT.
 
@@ -21,7 +21,7 @@
 "use strict";
 
 var wot = {
-	version: 20140317,
+	version: 20150420,
 	platform: "firefox",
     locale: "en",           // cached value of the locale
     lang: "en-US",          // cached value of the lang
diff --git a/content/stats.js b/content/stats.js
index bb9751a..f1e60af 100755
--- a/content/stats.js
+++ b/content/stats.js
@@ -1,318 +1,318 @@
-var wot_stats = 
+var wot_stats =
 {
-    utils: {
-        serialize: function(obj) 
-        {
-            var str = [];
-            var length = 0;
-            for(var p in obj) {
-                if (obj.hasOwnProperty(p)) {
-                    length++;
-                    str.push(p + "=" + obj[p]);
-                }
-            }
-            return {
-                data: str.join("&"),
-                length:length
-            };
-        },
-
-        postRequest: function(url, data, length, callback) 
-        {
-            try {
-                var http = new XMLHttpRequest();
-                http.open("POST", url, true);
-                http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
-
-                http.onreadystatechange = function() {
-                    if (http.readyState == 4) {
-                        if (http.status == 200) {
-                            if (callback) {
-                                callback(true, http.responseText);
-                            }
-                        }
-                        else {
-                            if (callback) {
-                                callback(false, http.responseText);
-                            }
-                        }
-                    }
-                };
-                http.send(data);          
-            }
-            catch(e) {
-                console.log("postRequest() - error." + e);
-            }
-        },
-
-        dictionaryToQueryString: function(dict) 
-        {
-            var result = '';
-            for(key in dict) {
-                result += key + '=' + dict[key] + '&';
-            }
-            return result.slice(0, result.length - 1); 
-        },
-
-        createRandomString: function (string_size) 
-        {
-            var text = "";
-            var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-
-            for (var i = 0; i < string_size; i++)
-                text += possible.charAt(Math.floor(Math.random() * possible.length));
-
-            return text;
-        },
-
-        RESPONSE_RECEIVED: 4,
-        getRequest: function(url, callback) 
-        {
-            try {
-                var xmlhttp = new XMLHttpRequest();
-                
-                xmlhttp.onreadystatechange = function() {
-                    if (xmlhttp.readyState == wot_stats.utils.RESPONSE_RECEIVED) {
-                        if (xmlhttp.status == 200) {
-                            callback(true,xmlhttp.responseText);
-                        }
-                        else {
-                            callback(false, xmlhttp.responseText);
-                        }
-                    }
-                }
-                xmlhttp.open("GET", url, true);
-                xmlhttp.send();
-            }
-            catch(e){
-                console.log("getRequest() - error. " +e);
-            }
-        },
-
-        getCurrentTime: function() 
-        {
-            return new Date().getTime();
-        }
-    },
-
-    last_prev: "",
-    enabled: false,
-    statusKey: "ok",
-    urlKey: "url",
-
-    load: function()
-    {
-        try {
-            var settings = this.getMonitoringSettings();
-            if (settings != null && settings[this.statusKey] == 1) {
-                this.startMonitoring();
-            }
-            this.fetchSettings();
-        }
-        catch(e) {
-            console.log("load() - error." + e);
-        }
-    },
-
-    isWebURL: function(url) 
-    {
-        return url.toLowerCase().indexOf("http") == 0;
-    },    
-
-    getInstallTime: function() 
-    {
-        var stats_installtime = wot_prefs.getChar("stats_installtime", "");
-        if (stats_installtime === "") {
-            wot_prefs.setChar("stats_installtime", this.utils.getCurrentTime());
-        }
-        return wot_prefs.getChar("stats_installtime", null);
-    },
-
-    setMonitoringSettings: function(settings) 
-    {
-        if (settings) {
-          wot_prefs.setChar("stats_settings", settings);
-        }
-    },
-
-    getMonitoringSettings: function() 
-    {
-        var stats_settings = wot_prefs.getChar("stats_settings", "");
-        if (stats_settings !== "") {
-            try {
-                var settingsJson = JSON.parse(stats_settings);
-                if (typeof settingsJson[this.statusKey] == "undefined" || settingsJson[this.statusKey] == null) {
-                    return null;
-                }
-                if (typeof settingsJson[this.urlKey] == "undefined" || settingsJson[this.urlKey] == null) {
-                    return null;
-                }
-                return settingsJson;
-            }
-            catch(e) {
-                console.log("getMonitoringSettings() - error." + e);
-            }
-            return null;
-        }
-        return null;
-    },
-
-    startMonitoring: function() 
-    {
-        this.enabled = true;
-    },
-
-    fetchSettings: function() 
-    {
-        var url = WOT_STATS.URL;
-        var data = {
-            "s":WOT_STATS.SID,
-            "ins":wot_stats.getInstallTime(),
-            "ver":WOT_STATS.VER
-        };
-        var queryString = this.utils.dictionaryToQueryString(data);
-        url = url + "?" + queryString;
-        this.utils.getRequest(url, this.onSettingsReceived);
-    },
-
-    onSettingsReceived: function(status, response) 
-    {
-        wot_stats.setMonitoringSettings(response);
-        var settings = wot_stats.getMonitoringSettings();
-        
-        if(settings[wot_stats.statusKey] == 1) {
-            wot_stats.startMonitoring();
-        }
-    },
-
-    getUserId: function() 
-    {
-        var stats_uid = wot_prefs.getChar("stats_uid", "");
-        if (stats_uid === "") {
-            wot_prefs.setChar("stats_uid", this.utils.createRandomString(32));  
-        }
-        return wot_prefs.getChar("stats_uid", null);
-    },
-
-    getSession: function() 
-    {
-        var session = wot_prefs.getChar("stats_sess", "");
-        if (session === "") {
-            session = this.createSession();
-            this.saveSession(session);
-        }
-        else {
-            try {
-                if (this.isSessionExpired()) {
-                    session = this.createSession();
-                    this.saveSession(session); 
-                } else {
-                    return JSON.parse(session);
-                }
-            }
-            catch(e) {
-                session = this.createSession();
-                this.saveSession(session);
-            }
-        }
-        return session;
-    },
-
-    isSessionExpired: function() 
-    {
-        var oldSession = wot_prefs.getChar("stats_sess", "");
-        var currentTime = this.utils.getCurrentTime();
-
-        if (oldSession !== "") {
-            var jsonOldSession = JSON.parse(oldSession);
-            var oldSessionTs = jsonOldSession['ts'];
-
-            if (typeof oldSessionTs != "undefined" && oldSessionTs && (currentTime - oldSessionTs) < WOT_STATS.ST) {
-                return false;
-            }
-        }
-        return true;
-    },
-
-    touchSession: function(prev) 
-    {
-        var session = this.getSession();
-        session['ts'] = this.utils.getCurrentTime();
-        if (prev) {
-            session['prev'] = encodeURIComponent(prev);
-        }
-        this.saveSession(session);
-    },
-
-    saveSession: function(session) 
-    {
-        wot_prefs.setChar("stats_sess", JSON.stringify(session)); 
-    },
-
-    createSession: function() 
-    {
-        var session = {
-            "id" : wot_stats.utils.createRandomString(32),
-            "ts" : wot_stats.utils.getCurrentTime(),
-            "prev" : encodeURIComponent("")
-        };
-
-        session = JSON.stringify(session);
-        session = JSON.parse(session);
-        return session;
-    },
-
-    loc: function(url, ref) 
-    {
-        if(this.isWebURL(url)) {
-            this.query(url, ref);
-        }
-    },  
-
-    focus: function(url) 
-    {
-        if(typeof url == "string" && this.isWebURL(url)) {
-            this.last_prev = url;
-        }
-        this.touchSession();
-    },  
-
-    query: function(url, ref) 
-    {
-        if(!this.enabled) {
-            return;
-        }
-        var settings = this.getMonitoringSettings();
-        if (this.last_prev === "") {
-            this.last_prev = decodeURIComponent(this.getSession()['prev']);
-        }
-        data = {
-            "s":WOT_STATS.SID,
-            "md":21,
-            "pid":wot_stats.getUserId(),
-            "sess":wot_stats.getSession()['id'],
-            "q":encodeURIComponent(url),
-            "prev":encodeURIComponent(wot_stats.last_prev),
-            "link":0,
-            "sub": "ff",
-            "tmv": WOT_STATS.VER,
-            "hreferer" : encodeURIComponent(ref),
-            "ts" : wot_stats.utils.getCurrentTime()
-        };
-
-        var requestDataInfo = this.utils.serialize(data);
-        var requestData = requestDataInfo.data;
-        var requestLength = requestDataInfo.length;
-
-        var encoded = btoa(btoa(requestData));        
-        if (encoded != "") {
-            var data = "e=" + encodeURIComponent(encoded);
-            var statsUrl = settings[this.urlKey] + "/valid";
-            this.utils.postRequest(statsUrl, data, requestLength);
-        }
-        this.last_prev = url;      
-        this.touchSession(this.last_prev);
-    }
+	utils: {
+		serialize: function(obj)
+		{
+			var str = [];
+			var length = 0;
+			for(var p in obj) {
+				if (obj.hasOwnProperty(p)) {
+					length++;
+					str.push(p + "=" + obj[p]);
+				}
+			}
+			return {
+				data: str.join("&"),
+				length:length
+			};
+		},
+
+		postRequest: function(url, data, length, callback)
+		{
+			try {
+				var http = new XMLHttpRequest();
+				http.open("POST", url, true);
+				http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+
+				http.onreadystatechange = function() {
+					if (http.readyState == 4) {
+						if (http.status == 200) {
+							if (callback) {
+								callback(true, http.responseText);
+							}
+						}
+						else {
+							if (callback) {
+								callback(false, http.responseText);
+							}
+						}
+					}
+				};
+				http.send(data);
+			}
+			catch(e) {
+				console.log("postRequest() - error." + e);
+			}
+		},
+
+		dictionaryToQueryString: function(dict)
+		{
+			var result = '';
+			for(key in dict) {
+				result += key + '=' + dict[key] + '&';
+			}
+			return result.slice(0, result.length - 1);
+		},
+
+		createRandomString: function (string_size)
+		{
+			var text = "";
+			var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+
+			for (var i = 0; i < string_size; i++)
+				text += possible.charAt(Math.floor(Math.random() * possible.length));
+
+			return text;
+		},
+
+		RESPONSE_RECEIVED: 4,
+		getRequest: function(url, callback)
+		{
+			try {
+				var xmlhttp = new XMLHttpRequest();
+
+				xmlhttp.onreadystatechange = function() {
+					if (xmlhttp.readyState == wot_stats.utils.RESPONSE_RECEIVED) {
+						if (xmlhttp.status == 200) {
+							callback(true,xmlhttp.responseText);
+						}
+						else {
+							callback(false, xmlhttp.responseText);
+						}
+					}
+				}
+				xmlhttp.open("GET", url, true);
+				xmlhttp.send();
+			}
+			catch(e){
+				console.log("getRequest() - error. " +e);
+			}
+		},
+
+		getCurrentTime: function()
+		{
+			return new Date().getTime();
+		}
+	},
+
+	last_prev: "",
+	enabled: false,
+	statusKey: "ok",
+	urlKey: "url",
+
+	load: function()
+	{
+		try {
+			var settings = this.getMonitoringSettings();
+			if (settings != null && settings[this.statusKey] == 1) {
+				this.startMonitoring();
+			}
+			this.fetchSettings();
+		}
+		catch(e) {
+			console.log("load() - error." + e);
+		}
+	},
+
+	isWebURL: function(url)
+	{
+		return url.toLowerCase().indexOf("http") == 0;
+	},
+
+	getInstallTime: function()
+	{
+		var stats_installtime = wot_prefs.getChar("stats_installtime", "");
+		if (stats_installtime === "") {
+			wot_prefs.setChar("stats_installtime", this.utils.getCurrentTime());
+		}
+		return wot_prefs.getChar("stats_installtime", null);
+	},
+
+	setMonitoringSettings: function(settings)
+	{
+		if (settings) {
+			wot_prefs.setChar("stats_settings", settings);
+		}
+	},
+
+	getMonitoringSettings: function()
+	{
+		var stats_settings = wot_prefs.getChar("stats_settings", "");
+		if (stats_settings !== "") {
+			try {
+				var settingsJson = JSON.parse(stats_settings);
+				if (typeof settingsJson[this.statusKey] == "undefined" || settingsJson[this.statusKey] == null) {
+					return null;
+				}
+				if (typeof settingsJson[this.urlKey] == "undefined" || settingsJson[this.urlKey] == null) {
+					return null;
+				}
+				return settingsJson;
+			}
+			catch(e) {
+				console.log("getMonitoringSettings() - error." + e);
+			}
+			return null;
+		}
+		return null;
+	},
+
+	startMonitoring: function()
+	{
+		this.enabled = true;
+	},
+
+	fetchSettings: function()
+	{
+		var url = WOT_STATS.URL;
+		var data = {
+			"s":WOT_STATS.SID,
+			"ins":wot_stats.getInstallTime(),
+			"ver":WOT_STATS.VER
+		};
+		var queryString = this.utils.dictionaryToQueryString(data);
+		url = url + "?" + queryString;
+		this.utils.getRequest(url, this.onSettingsReceived);
+	},
+
+	onSettingsReceived: function(status, response)
+	{
+		wot_stats.setMonitoringSettings(response);
+		var settings = wot_stats.getMonitoringSettings();
+
+		if(settings[wot_stats.statusKey] == 1) {
+			wot_stats.startMonitoring();
+		}
+	},
+
+	getUserId: function()
+	{
+		var stats_uid = wot_prefs.getChar("stats_uid", "");
+		if (stats_uid === "") {
+			wot_prefs.setChar("stats_uid", this.utils.createRandomString(32));
+		}
+		return wot_prefs.getChar("stats_uid", null);
+	},
+
+	getSession: function()
+	{
+		var session = wot_prefs.getChar("stats_sess", "");
+		if (session === "") {
+			session = this.createSession();
+			this.saveSession(session);
+		}
+		else {
+			try {
+				if (this.isSessionExpired()) {
+					session = this.createSession();
+					this.saveSession(session);
+				} else {
+					return JSON.parse(session);
+				}
+			}
+			catch(e) {
+				session = this.createSession();
+				this.saveSession(session);
+			}
+		}
+		return session;
+	},
+
+	isSessionExpired: function()
+	{
+		var oldSession = wot_prefs.getChar("stats_sess", "");
+		var currentTime = this.utils.getCurrentTime();
+
+		if (oldSession !== "") {
+			var jsonOldSession = JSON.parse(oldSession);
+			var oldSessionTs = jsonOldSession['ts'];
+
+			if (typeof oldSessionTs != "undefined" && oldSessionTs && (currentTime - oldSessionTs) < WOT_STATS.ST) {
+				return false;
+			}
+		}
+		return true;
+	},
+
+	touchSession: function(prev)
+	{
+		var session = this.getSession();
+		session['ts'] = this.utils.getCurrentTime();
+		if (prev) {
+			session['prev'] = encodeURIComponent(prev);
+		}
+		this.saveSession(session);
+	},
+
+	saveSession: function(session)
+	{
+		wot_prefs.setChar("stats_sess", JSON.stringify(session));
+	},
+
+	createSession: function()
+	{
+		var session = {
+			"id" : wot_stats.utils.createRandomString(32),
+			"ts" : wot_stats.utils.getCurrentTime(),
+			"prev" : encodeURIComponent("")
+		};
+
+		session = JSON.stringify(session);
+		session = JSON.parse(session);
+		return session;
+	},
+
+	loc: function(url, ref)
+	{
+		if(this.isWebURL(url)) {
+			this.query(url, ref);
+		}
+	},
+
+	focus: function(url)
+	{
+		if(typeof url == "string" && this.isWebURL(url)) {
+			this.last_prev = url;
+		}
+		this.touchSession();
+	},
+
+	query: function(url, ref)
+	{
+		if(!this.enabled) {
+			return;
+		}
+		var settings = this.getMonitoringSettings();
+		if (this.last_prev === "") {
+			this.last_prev = decodeURIComponent(this.getSession()['prev']);
+		}
+		data = {
+			"s":WOT_STATS.SID,
+			"md":21,
+			"pid":wot_stats.getUserId(),
+			"sess":wot_stats.getSession()['id'],
+			"q":encodeURIComponent(url),
+			"prev":encodeURIComponent(wot_stats.last_prev),
+			"link":0,
+			"sub": "ff",
+			"tmv": WOT_STATS.VER,
+			"hreferer" : encodeURIComponent(ref),
+			"ts" : wot_stats.utils.getCurrentTime()
+		};
+
+		var requestDataInfo = this.utils.serialize(data);
+		var requestData = requestDataInfo.data;
+		var requestLength = requestDataInfo.length;
+
+		var encoded = btoa(btoa(requestData));
+		if (encoded != "") {
+			var data = "e=" + encodeURIComponent(encoded);
+			var statsUrl = settings[this.urlKey] + "/valid";
+			this.utils.postRequest(statsUrl, data, requestLength);
+		}
+		this.last_prev = url;
+		this.touchSession(this.last_prev);
+	}
 };
 
-wot_modules.push({ name: "wot_stats", obj: wot_stats });
\ No newline at end of file
+wot_modules.push({ name: "wot_stats", obj: wot_stats });
diff --git a/install.rdf.template b/install.rdf.template
index de05348..54341d0 100644
--- a/install.rdf.template
+++ b/install.rdf.template
@@ -16,7 +16,7 @@
 			<Description>
 				<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
 				<em:minVersion>14.0</em:minVersion>
-				<em:maxVersion>31.0a1</em:maxVersion>
+				<em:maxVersion>41.0</em:maxVersion>
 			</Description>
 		</em:targetApplication>
 
@@ -25,7 +25,7 @@
 		  <Description>
 			<em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
 			<em:minVersion>1.0a</em:minVersion>
-			<em:maxVersion>2.28</em:maxVersion>
+			<em:maxVersion>2.38</em:maxVersion>
 		  </Description>
 		</em:targetApplication>
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/wot.git



More information about the Pkg-mozext-commits mailing list