[open-ils-commits] [GIT] Evergreen ILS branch master updated. aff73bfba1fbc30a046ad5b7df65ed862bc84767

Evergreen Git git at git.evergreen-ils.org
Tue Oct 15 16:46:39 EDT 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  aff73bfba1fbc30a046ad5b7df65ed862bc84767 (commit)
       via  d22371c49a1bd6833aaf45571f1d88cb6514bd8d (commit)
       via  de7d768c8c2bbaada238c5570dd3cd7a5eb7ebbc (commit)
       via  09f8847f4dac346c76df9adb617eab2dade65f3d (commit)
      from  55e1bf14026636ab4f4c96e18b494eac0a3e12c9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit aff73bfba1fbc30a046ad5b7df65ed862bc84767
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Mon Oct 14 09:21:58 2013 -0700

    LP#1086458: remove unecessary anonymous hashes when calling xulG.set_tab()
    
    This follows up on observations made by Steven Chan that
    suggests that even the act of creating an anonymous hash and
    passing it to a global function can cause (I assume) JavaScript
    execution contexts to be leaked.
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>

diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js
index 37d92aa..4d923c2 100644
--- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js
+++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js
@@ -1784,7 +1784,7 @@ main.menu.prototype = {
             'refresh_checkout',
             function() {
                 try {
-                    obj.set_tab(obj.url_prefix('XUL_PATRON_BARCODE_ENTRY'),{},{});
+                    obj.set_tab(obj.url_prefix('XUL_PATRON_BARCODE_ENTRY'));
                 } catch(E) {
                     obj.error.sdump('D_ERROR','tab_refresh_checkout_handler: ' + js2JSON(E));
                 }

commit d22371c49a1bd6833aaf45571f1d88cb6514bd8d
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Mon Oct 14 08:47:49 2013 -0700

    LP#1086458: invoke new 'refresh_checkout' event
    
    This implements using the new custom event rather than
    xulG.set_tab() to refresh a refresh of the checkout tab. It
    also removes use of a callback function to request the tab
    refresh in favor of a simple setTimeout().
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>

diff --git a/Open-ILS/xul/staff_client/server/circ/checkout.js b/Open-ILS/xul/staff_client/server/circ/checkout.js
index 78ae98b..bc6fad9 100644
--- a/Open-ILS/xul/staff_client/server/circ/checkout.js
+++ b/Open-ILS/xul/staff_client/server/circ/checkout.js
@@ -233,21 +233,15 @@ circ.checkout.prototype = {
                                 var no_print_prompting = obj.data.hash.aous['circ.staff_client.do_not_auto_attempt_print'];
                                 if (no_print_prompting) {
                                     if (no_print_prompting.indexOf( "Checkout" ) > -1) {
-                                        obj.list.clear();
-                                        xulG.set_tab(urls.XUL_PATRON_BARCODE_ENTRY,{},{}); 
-                                        return;
+                                        obj.refresh_checkout_tab(0);
                                     }
                                 }
                                 if (document.getElementById('checkout_auto').checked) {
-                                    obj.print(true,function() { 
-                                        obj.list.clear();
-                                        xulG.set_tab(urls.XUL_PATRON_BARCODE_ENTRY,{},{}); 
-                                    });
+                                    obj.print(true);
+                                    obj.refresh_checkout_tab(1000);
                                 } else {
-                                    obj.print(false,function() {
-                                        obj.list.clear();
-                                        xulG.set_tab(urls.XUL_PATRON_BARCODE_ENTRY,{},{});
-                                    });
+                                    obj.print(false);
+                                    obj.refresh_checkout_tab(1000);
                                 }
                             } catch(E) {
                                 obj.error.standard_unexpected_error_alert('cmd_checkout_done',E);
@@ -305,7 +299,15 @@ circ.checkout.prototype = {
         }
     },
 
-    'print' : function(silent,f) {
+    'refresh_checkout_tab' : function(delay) {
+        setTimeout(function() {
+            var e = document.createEvent("Events");
+            e.initEvent('refresh_checkout', true, false);
+            document.documentElement.dispatchEvent(e);
+        }, delay);
+    },
+
+    'print' : function(silent) {
         var obj = this;
         try {
             obj.patron = obj.network.simple_request('FM_AU_FLESHED_RETRIEVE_VIA_ID',[ses(),obj.patron_id]);
@@ -317,20 +319,7 @@ circ.checkout.prototype = {
                     'balance_owed' : util.money.sanitize( obj.most_recent_balance_owed ),
                 },
                 'printer_context' : 'receipt',
-                'template' : 'checkout',
-                'callback' : function() {
-                    setTimeout(
-                        function(){
-                            if (typeof f == 'function') { 
-                                setTimeout( 
-                                    function() {
-                                        f();
-                                    }, 1000
-                                );
-                            } 
-                        }, 1000
-                    );
-                }
+                'template' : 'checkout'
             };
             if (silent) { params.no_prompt = true; }
             obj.list.print(params);

commit de7d768c8c2bbaada238c5570dd3cd7a5eb7ebbc
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Thu Sep 26 13:05:26 2013 -0700

    LP#1086458: define custom event for refreshing the checkout page
    
    Using a custom event handled by a chrome event handler rather
    than calling xulG.set_tab() directly avoids any possibility of
    leaking objects and executation contexts from the code that's
    requesting refresh of the checkout page.
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>

diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js
index 2f16bfd..37d92aa 100644
--- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js
+++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js
@@ -1780,6 +1780,20 @@ main.menu.prototype = {
 
         obj.sort_menu(document.getElementById('main.menu.admin'), true);
 
+        document.addEventListener(
+            'refresh_checkout',
+            function() {
+                try {
+                    obj.set_tab(obj.url_prefix('XUL_PATRON_BARCODE_ENTRY'),{},{});
+                } catch(E) {
+                    obj.error.sdump('D_ERROR','tab_refresh_checkout_handler: ' + js2JSON(E));
+                }
+            }
+            ,
+            false,
+            true
+        );
+
         if(params['firstURL']) {
             obj.new_tab(params['firstURL'],{'focus':true},null);
         }

commit 09f8847f4dac346c76df9adb617eab2dade65f3d
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Mon Oct 14 08:23:23 2013 -0700

    LP#1086458: convert last-print information hash to JSON string before caching
    
    By serializing the printing message and context information to a
    JSON string before caching it, we avoid inadvertantly dragging in
    things like Javascript execution contexts and possibly references
    to objects created by the checkout interface.  This was contributing
    to the staff client memory leaks observed during receipt printing.
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>

diff --git a/Open-ILS/xul/staff_client/chrome/content/util/print.js b/Open-ILS/xul/staff_client/chrome/content/util/print.js
index 075b0c1..21d3d8f 100644
--- a/Open-ILS/xul/staff_client/chrome/content/util/print.js
+++ b/Open-ILS/xul/staff_client/chrome/content/util/print.js
@@ -51,9 +51,10 @@ util.print.prototype = {
                 );
                 return;
             }
-            if(obj.data.last_print.context) this.set_context(obj.data.last_print.context);
-            var msg = obj.data.last_print.msg;
-            var params = obj.data.last_print.params; params.no_prompt = false;
+            var last_print = JSON2js(obj.data.last_print);
+            if(last_print.context) this.set_context(last_print.context);
+            var msg = last_print.msg;
+            var params = last_print.params; params.no_prompt = false;
             obj.simple( msg, params );
         } catch(E) {
             this.error.standard_unexpected_error_alert('util.print.reprint_last',E);
@@ -115,7 +116,7 @@ util.print.prototype = {
 
             var obj = this;
 
-            obj.data.last_print = { 'msg' : msg, 'params' : params, 'context' : this.context};
+            obj.data.last_print = js2JSON({ 'msg' : msg, 'params' : params, 'context' : this.context});
             obj.data.stash('last_print');
 
             var silent = false;

-----------------------------------------------------------------------

Summary of changes:
 .../xul/staff_client/chrome/content/main/menu.js   |   14 +++++++
 .../xul/staff_client/chrome/content/util/print.js  |    9 ++--
 Open-ILS/xul/staff_client/server/circ/checkout.js  |   41 +++++++------------
 3 files changed, 34 insertions(+), 30 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list