From 738b0c7068c0f5c084e1fe8da3ac60085e961fcc Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Thu, 19 Aug 2010 14:29:59 -0600 Subject: [PATCH] Bug #9186: ViewPort - assign random DOM IDs for rows. Don't use mailbox/UID information - there could potentially be issues with bad characters, exceedingly long mailbox names, etc. The recent mailbox encoding changes had broken message access for any mailbox that had null characters (e.g. virtual folders, search results) --- imp/js/viewport.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/imp/js/viewport.js b/imp/js/viewport.js index b20840e6b..86c5dfe43 100644 --- a/imp/js/viewport.js +++ b/imp/js/viewport.js @@ -1458,6 +1458,7 @@ ViewPort_Buffer = Class.create({ initialize: function(vp, view) { + this.id = 0; this.vp = vp; this.view = view; this.clear(); @@ -1562,7 +1563,9 @@ ViewPort_Buffer = Class.create({ if (!Object.isUndefined(e)) { // We can directly write the rownum to the original object // since we will always rewrite when creating rows. - e.VP_domid = 'VProw' + this.view + '_' + u; + if (!e.VP_domid) { + e.VP_domid = 'VProw_' + (++this.id); + } e.VP_rownum = this.uidlist.get(u); e.VP_id = u; return e; @@ -1729,7 +1732,7 @@ ViewPort_Selection = Class.create({ // Fall-through case 'domid': - return d.invoke('substring', 6 + this.buffer.getView().length); + return this._search({ VP_domid: { equal: d } }, this.buffer.getData(this.buffer.getAllUIDs())).get('uid'); case 'rownum': return this.buffer.rowsToUIDs(d); @@ -1781,7 +1784,12 @@ ViewPort_Selection = Class.create({ // regex - Matches the RegExp contained in the query. search: function(params) { - return new ViewPort_Selection(this.buffer, 'uid', this.get('dataob').findAll(function(i) { + return this._search(params, this.get('dataob')); + }, + + _search: function(params, data) + { + return new ViewPort_Selection(this.buffer, 'uid', data.findAll(function(i) { // i = data object return $H(params).all(function(k) { // k.key = search key; k.value = search criteria -- 2.11.0