[open-ils-commits] [GIT] Evergreen ILS branch rel_2_3 updated. afe024425fa277ef741f58010b7f4dcf1753b79f

Evergreen Git git at git.evergreen-ils.org
Thu Oct 31 11:43:43 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, rel_2_3 has been updated
       via  afe024425fa277ef741f58010b7f4dcf1753b79f (commit)
       via  9b0cf345412baab86288800cbe02ca50b9b41ac4 (commit)
       via  d40c1b17be1f70f6bbba880ba0059b5d8c53031f (commit)
       via  7ef70a3e687e086275734ba4914b52c67d2e81b5 (commit)
      from  c146a8ff3c5bc61665ae17203a0f313d7dc9a9bd (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 afe024425fa277ef741f58010b7f4dcf1753b79f
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: Mike Rylander <mrylander at gmail.com>

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 402b13f..3f800de 100644
--- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js
+++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js
@@ -1687,7 +1687,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 9b0cf345412baab86288800cbe02ca50b9b41ac4
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: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/xul/staff_client/server/circ/checkout.js b/Open-ILS/xul/staff_client/server/circ/checkout.js
index e8a7169..c8220b1 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 d40c1b17be1f70f6bbba880ba0059b5d8c53031f
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: Mike Rylander <mrylander at gmail.com>

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 d9db611..402b13f 100644
--- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js
+++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js
@@ -1683,6 +1683,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 7ef70a3e687e086275734ba4914b52c67d2e81b5
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: Mike Rylander <mrylander at gmail.com>

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 f67f708..1e6f5fc 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