From 7ef70a3e687e086275734ba4914b52c67d2e81b5 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 14 Oct 2013 08:23:23 -0700 Subject: [PATCH] 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 Signed-off-by: Mike Rylander --- Open-ILS/xul/staff_client/chrome/content/util/print.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 f67f708d73..1e6f5fc6be 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; -- 2.11.0