From fa8ee8e98c006e471b17a2ce49a763ea1c90f262 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 --- 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 075b0c1201..21d3d8f782 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