From b2d561252641aad1b7aa45c13104678dc73d460f Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 7 Apr 2015 16:59:33 -0400 Subject: [PATCH] Fix sync and debug output submission in Nightly (sendAsBinary() removal) --- .../content/zotero/preferences/preferences_advanced.js | 9 ++++++++- chrome/content/zotero/xpcom/sync.js | 7 ++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/preferences/preferences_advanced.js b/chrome/content/zotero/preferences/preferences_advanced.js index ea54b5af63..97ccefe46d 100644 --- a/chrome/content/zotero/preferences/preferences_advanced.js +++ b/chrome/content/zotero/preferences/preferences_advanced.js @@ -730,9 +730,16 @@ Zotero_Preferences.Debug_Output = { } }; try { - req.sendAsBinary(data); + // Send binary data + let numBytes = data.length, ui8Data = new Uint8Array(numBytes); + for (let i = 0; i < numBytes; i++) { + ui8Data[i] = data.charCodeAt(i) & 0xff; + } + req.send(ui8Data); } catch (e) { + Zotero.debug(e, 1); + Components.utils.reportError(e); ps.alert( null, Zotero.getString('general.error'), diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js index c5c264d986..f2a9fc3249 100644 --- a/chrome/content/zotero/xpcom/sync.js +++ b/chrome/content/zotero/xpcom/sync.js @@ -1804,7 +1804,12 @@ Zotero.Sync.Server = new function () { } }; try { - req.sendAsBinary(data); + // Send binary data + let numBytes = data.length, ui8Data = new Uint8Array(numBytes); + for (let i = 0; i < numBytes; i++) { + ui8Data[i] = data.charCodeAt(i) & 0xff; + } + req.send(ui8Data); } catch (e) { _error(e);