[Pkg-mozext-commits] [greasemonkey] 05/16: Strip UTF-8 BOM(s) from the front of the user script.
David Prévot
taffit at moszumanska.debian.org
Thu Jan 30 13:42:28 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository greasemonkey.
commit 2abafce33787894dc859a82ce0ea36d853325a22
Author: Anthony Lieuallen <arantius at gmail.com>
Date: Wed Jan 29 11:47:30 2014 -0500
Strip UTF-8 BOM(s) from the front of the user script.
Fixes #1823
---
modules/remoteScript.js | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/modules/remoteScript.js b/modules/remoteScript.js
index e7aa54c..bb91c03 100644
--- a/modules/remoteScript.js
+++ b/modules/remoteScript.js
@@ -124,8 +124,15 @@ DownloadListener.prototype = {
var data = binaryInputStream.readByteArray(aCount);
if (this._tryToParse) {
+ // See #1823. Strip UTF-8 BOM(s) at the very start of the file.
+ while (data && data.length >= 3
+ && data[0] == 0xEF && data[1] == 0xBB && data[2] == 0xBF
+ ) {
+ data = data.slice(3);
+ }
+
this._data = this._data.concat(data);
- if (this._parse(aContext)) this._tryToParse = false;
+ this._tryToParse = !this._parse(aContext);
} else {
this._data = null;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/greasemonkey.git
More information about the Pkg-mozext-commits
mailing list