[Pkg-mozext-commits] [wot] 71/226: Fixes #25 Don't use synchronous http requests
David Prévot
taffit at moszumanska.debian.org
Fri May 1 00:35:35 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 46af2ae3ddd90569d8fc6ba6c545ea3c5fca39c5
Author: Sergey Andryukhin <sorgoz at yandex.com>
Date: Wed Jan 16 11:56:30 2013 +0200
Fixes #25 Don't use synchronous http requests
---
content/config.js | 2 +-
content/injections/wot_proxy.js | 2 +-
skin/include/blocked.js | 53 ++++++++++++++++++++++++-----------------
3 files changed, 33 insertions(+), 24 deletions(-)
diff --git a/content/config.js b/content/config.js
index ca5b2d3..5536111 100644
--- a/content/config.js
+++ b/content/config.js
@@ -19,7 +19,7 @@
*/
const WOT_PLATFORM = "firefox";
-const WOT_VERSION = "20130107";
+const WOT_VERSION = "20130116";
/*
* Constants
diff --git a/content/injections/wot_proxy.js b/content/injections/wot_proxy.js
index 39bc710..8102b44 100644
--- a/content/injections/wot_proxy.js
+++ b/content/injections/wot_proxy.js
@@ -24,7 +24,7 @@
* */
var wot = {
- version: "20130107", // TODO: init this value from the add-on core code
+ version: "20130116", // TODO: init this value from the add-on core code
platform: "firefox",
debug: false, // when changing this, don't forget to switch ga_id value also!
default_component: 0,
diff --git a/skin/include/blocked.js b/skin/include/blocked.js
index 76557da..b61a8e8 100644
--- a/skin/include/blocked.js
+++ b/skin/include/blocked.js
@@ -1,6 +1,6 @@
/*
warning.js
- Copyright © 2012 - WOT Services Oy <info at mywot.com>
+ Copyright © 2012 - 2013 WOT Services Oy <info at mywot.com>
This file is part of WOT.
@@ -25,25 +25,31 @@ var blocked_target = null;
var l10n = {};
var wot_modules = [];
-function load_l10n() {
+function load_l10n(callback) {
// loads locale stings for add-on, parse them and store in l10n object
try {
xhr = new XMLHttpRequest();
- xhr.open("GET", "chrome://wot/locale/wot.properties", false);
- xhr.send();
- var text = xhr.responseText;
+ xhr.open("GET", "chrome://wot/locale/wot.properties", true);
- // detect separator
- var sep = "\r\n";
- if (text.indexOf(sep) < 1) {
- sep = "\n";
- }
+ xhr.onload = function(e) {
+ var text = xhr.responseText;
- var lines = text.split(sep);
- for(var i=0; i < lines.length; i++) {
- var pair = lines[i].split(" = ", 2);
- l10n[pair[0]] = pair[1];
- }
+ // detect separator
+ var sep = "\r\n";
+ if (text.indexOf(sep) < 1) {
+ sep = "\n";
+ }
+
+ var lines = text.split(sep);
+ for(var i=0; i < lines.length; i++) {
+ var pair = lines[i].split(" = ", 2);
+ l10n[pair[0]] = pair[1];
+ }
+
+ callback();
+ };
+
+ xhr.send();
} catch (e) {
console.log("Exception in blocked.js / load_l10n()");
@@ -112,14 +118,8 @@ function blocked_info()
location.href = "http://www.mywot.com/scorecard/" + blocked_target;
}
}
-function blocked_load()
-{
- if (!window.location.search) {
- return;
- }
-
- load_l10n();
+function blocked_action() {
var query = atob(decodeURIComponent(window.location.search.substr(1)));
var m = /target=([^&]*)/.exec(query);
@@ -188,3 +188,12 @@ function blocked_load()
wot_warning.add(blocked_target, document, WOT_WARNING_DOM, reasons.reason);
}
}
+
+function blocked_load()
+{
+ if (!window.location.search) {
+ return;
+ }
+
+ load_l10n(blocked_action);
+}
--
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