[Pkg-mozext-commits] [wot] 137/226: Bug fixes related to RW updates and WelcomeTip

David Prévot taffit at moszumanska.debian.org
Fri May 1 00:35:44 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 3791d9d33b9ebae10f00f49d19d95abce0027acd
Author: Sergey Andryukhin <sorgoz at yandex.com>
Date:   Mon Sep 2 14:45:09 2013 +0300

    Bug fixes related to RW updates and WelcomeTip
---
 content/ratingwindow.js      |  6 ++++++
 content/rw/proxies.js        | 18 +++++++++++-------
 content/rw/ratingwindow.html |  2 +-
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/content/ratingwindow.js b/content/ratingwindow.js
index 75330c5..9d7dd25 100644
--- a/content/ratingwindow.js
+++ b/content/ratingwindow.js
@@ -23,6 +23,7 @@ var wot_rw = {
     RW_URL: "chrome://wot/content/rw/ratingwindow.html",
     FRAME_ID: "wot-rwframe",
     is_inited: false,
+    is_visible: false,
     CHAN_ELEM_ID: "wot-ratingwindow",
     CHAN_EVENT_ID: "wotrw",
     IGNORED_PREFS: ["ratingwindow_shown"],
@@ -65,6 +66,7 @@ var wot_rw = {
     /* Called when the popup window is hidden */
     on_hide_popup: function()
     {
+        this.is_visible = false;
         try {
             wot_rw.unseenmessage();
 
@@ -86,6 +88,8 @@ var wot_rw = {
 
         if (!rw || !rw_doc || !rw_wot) return;
 
+        this.is_visible = true;
+
         if (!this.is_inited) {
             this.initialize(rw, rw_doc, rw_wot);
             // RW will ask BG to update it, so no need to update it here
@@ -184,6 +188,8 @@ var wot_rw = {
         // Updates content of Rating Window. RW must be already initialized (locales, categories info, etc).
         wdump("RW.update()");
 
+        if (!this.is_visible) return;
+
         var rw = this.get_rw_window(),
             rw_doc = this.get_rw_document(),
             rw_wot = this.get_rw_wot(),
diff --git a/content/rw/proxies.js b/content/rw/proxies.js
index 8ea29fc..eba9fe2 100644
--- a/content/rw/proxies.js
+++ b/content/rw/proxies.js
@@ -20,9 +20,12 @@
 
 // The purpose of this file is to handle objects and methods that exist in Chrome browser but doesn't in Firefox
 
-var wot_bg = {    // background page object
+var wot_bg = {
+    wot: {}
+};    // background page object
+
+$.extend(wot_bg.wot, wot, {
 
-    wot: {
         prefs: { // preferences
 
             _prefs: {},
@@ -226,9 +229,9 @@ var wot_bg = {    // background page object
                 }
             }
         }
-    },
+    });
 
-    console: {
+    wot_bg.console = {
 
         log: function(args) {
             if (window.console && window.console.log) {
@@ -248,15 +251,16 @@ var wot_bg = {    // background page object
             }
             wot_bg.wot.core.moz_send("log", { args: arguments });
         }
-    }
-
-};
+    };
 
 // IN order to allow RatingWindow to close itself we redefine the global method (what a nasty life!).
 window.close = function() {
     wot_bg.wot.core.moz_send("close", null);
 };
 
+// Magic trick to supply wot.prefs with actual code
+$.extend(wot, { prefs: wot_bg.wot.prefs });
+
 var chrome = {
     extension: {
         getBackgroundPage: function () {
diff --git a/content/rw/ratingwindow.html b/content/rw/ratingwindow.html
index 08e4c8d..548145a 100644
--- a/content/rw/ratingwindow.html
+++ b/content/rw/ratingwindow.html
@@ -25,8 +25,8 @@
 <head>
     <script type="text/javascript" src="chrome://wot/content/libs/jquery.js"></script>
     <script type="text/javascript" src="chrome://wot/content/libs/jquery.menu-aim.js"></script>
-    <script type="text/javascript" src="chrome://wot/content/rw/proxies.js"></script>
     <script type="text/javascript" src="chrome://wot/content/rw/wot.js"></script>
+    <script type="text/javascript" src="chrome://wot/content/rw/proxies.js"></script>
     <script type="text/javascript" src="chrome://wot/content/rw/keeper_constants.js"></script>
     <script type="text/javascript" src="chrome://wot/content/injections/ga_configure.js"></script>
     <script type="text/javascript" src="chrome://wot/content/rw/ratingwindow.js"></script>

-- 
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