[open-ils-commits] [GIT] Evergreen ILS branch rel_2_4 updated. f0e75d70147afc087af0d63a3f70163a409971c5

Evergreen Git git at git.evergreen-ils.org
Thu Oct 31 11:33:21 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_4 has been updated
       via  f0e75d70147afc087af0d63a3f70163a409971c5 (commit)
       via  2c03e0d8481d043f68b83894550d4a7030b08860 (commit)
       via  b79032ac05dcfa7a6d955c826579a70d281f50c9 (commit)
       via  0c07c042166c8114cf38359de60ac83edcabff39 (commit)
      from  30254da66050e4a6ba1262b62391eb016e83a72f (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 f0e75d70147afc087af0d63a3f70163a409971c5
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 b7a9543..414baec 100644
--- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js
+++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js
@@ -1766,7 +1766,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 2c03e0d8481d043f68b83894550d4a7030b08860
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 ea6afa6..e59bf74 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 b79032ac05dcfa7a6d955c826579a70d281f50c9
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 1aa293f..b7a9543 100644
--- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js
+++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js
@@ -1762,6 +1762,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 0c07c042166c8114cf38359de60ac83edcabff39
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 30e0ba7..5547e7e 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