commit 71c63c6a7455b34cd14662a0dbe4166599b77936 parent e45c48a66f4782ce0d4147d822336f8d1412a564 Author: Simon Kornblith <simon@simonster.com> Date: Tue, 21 Feb 2012 22:18:43 -0500 Attempt to escape wrapper hell by serializing and unserializing the item Diffstat:
| M | chrome/content/zotero/tools/testTranslators/translatorTester.js | | | 5 | +++++ |
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/chrome/content/zotero/tools/testTranslators/translatorTester.js b/chrome/content/zotero/tools/testTranslators/translatorTester.js @@ -100,6 +100,11 @@ Zotero_TranslatorTester._sanitizeItem = function(item, forSave) { } } + // try to convert to JSON and back to get rid of undesirable undeletable elements; this may fail + try { + item = JSON.parse(JSON.stringify(item)); + } catch(e) {}; + // remove fields to be ignored for(var j=0, n=Zotero_TranslatorTester_IGNORE_FIELDS.length; j<n; j++) { delete item[Zotero_TranslatorTester_IGNORE_FIELDS[j]];