Backed out changeset fef67283fe69
authorBen Bucksch <ben.bucksch@beonex.com>
Thu, 07 Dec 2017 06:04:13 +0100
changeset 22816 187b19434a76550a5db61a1b3137117c278c3b02
parent 22815 fef67283fe696e1175ab56d3c2b367ac30932057
child 22817 158051b8fe505e72db798dfbffeaa604876fca7a
push id13821
push usermozilla.BenB@bucksch.org
push dateThu, 07 Dec 2017 05:04:37 +0000
treeherdercomm-central@187b19434a76 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
backs outfef67283fe696e1175ab56d3c2b367ac30932057
Backed out changeset fef67283fe69
mail/app/profile/all-thunderbird.js
mailnews/mime/jsmime/jsmime.js
mailnews/mime/jsmime/test/test_header.js
--- a/mail/app/profile/all-thunderbird.js
+++ b/mail/app/profile/all-thunderbird.js
@@ -333,22 +333,19 @@ pref("mail.warn_on_shift_delete", true);
 // at least this percentage of the thread pane visible above / below the
 // selected message.
 pref("mail.threadpane.padding.top_percent", 10);
 pref("mail.threadpane.padding.bottom_percent", 10);
 
 // Use correspondents column instead of from/recipient columns.
 pref("mail.threadpane.use_correspondents", true);
 
+// only affects cookies from RSS articles
 // 0-Accept, 1-dontAcceptForeign, 2-dontUse
-pref("network.cookie.cookieBehavior", 2);
-
-// mail protocols normally won't send a referer in any case
-// 0=don't send any, 1=send only on clicks, 2=send on image requests as well
-pref("network.http.sendRefererHeader", 0);
+pref("network.cookie.cookieBehavior", 0);
 
 // clear the SeaMonkey pref, so we don't hear about how we don't have a chrome
 // package registered for editor-region while opening about:config
 pref("editor.throbber.url", "");
 
 // 0=as attachment 2=default forward as inline with attachments
 pref("mail.forward_message_mode", 2);
 
--- a/mailnews/mime/jsmime/jsmime.js
+++ b/mailnews/mime/jsmime/jsmime.js
@@ -18,70 +18,63 @@
 def('mimeutils', function() {
 "use strict";
 
 /**
  * Decode a quoted-printable buffer into a binary string.
  *
  * @param buffer {BinaryString} The string to decode.
  * @param more   {Boolean}      This argument is ignored.
- * @param removeNulls {Boolean} If true, remove null bytes in output.
  * @returns {Array(BinaryString, BinaryString)} The first element of the array
  *          is the decoded string. The second element is always the empty
  *          string.
  */
-function decode_qp(buffer, more, removeNulls = false) {
+function decode_qp(buffer, more) {
   // Unlike base64, quoted-printable isn't stateful across multiple lines, so
   // there is no need to buffer input, so we can always ignore more.
   let decoded = buffer.replace(
     // Replace either =<hex><hex> or =<wsp>CRLF
     /=([0-9A-F][0-9A-F]|[ \t]*(\r\n|[\r\n]|$))/gi,
     function replace_chars(match, param) {
       // If trailing text matches [ \t]*CRLF, drop everything, since it's a
       // soft line break.
       if (param.trim().length == 0)
         return '';
       return String.fromCharCode(parseInt(param, 16));
     });
-  if (removeNulls)
-    decoded = decoded.replace(/\x00/g, '');
   return [decoded, ''];
 }
 
 /**
  * Decode a base64 buffer into a binary string. Unlike window.atob, the buffer
  * may contain non-base64 characters that will be ignored.
  *
  * @param buffer {BinaryString} The string to decode.
  * @param more   {Boolean}      If true, we expect that this function could be
  *                              called again and should retain extra data. If
  *                              false, we should flush all pending output.
- * @param removeNulls {Boolean} If true, remove null bytes in output.
  * @returns {Array(BinaryString, BinaryString)} The first element of the array
  *          is the decoded string. The second element contains the data that
  *          could not be decoded and needs to be retained for the next call.
  */
-function decode_base64(buffer, more, removeNulls = false) {
+function decode_base64(buffer, more) {
   // Drop all non-base64 characters
   let sanitize = buffer.replace(/[^A-Za-z0-9+\/=]/g,'');
   // Remove harmful `=' chars in the middle.
   sanitize = sanitize.replace(/=+([A-Za-z0-9+\/])/g, '$1');
   // We need to encode in groups of 4 chars. If we don't have enough, leave the
   // excess for later. If there aren't any more, drop enough to make it 4.
   let excess = sanitize.length % 4;
   if (excess != 0 && more)
     buffer = sanitize.slice(-excess);
   else
     buffer = '';
   sanitize = sanitize.substring(0, sanitize.length - excess);
   // Use the atob function we (ought to) have in global scope.
-  let decoded = atob(sanitize);
-  if (removeNulls)
-    decoded = decoded.replace(/\x00/g, '');
-  return [decoded, buffer];
+  return [atob(sanitize), buffer];
 }
 
 /**
  * Converts a binary string into a Uint8Array buffer.
  *
  * @param buffer {BinaryString} The string to convert.
  * @returns {Uint8Array} The converted data.
  */
@@ -640,28 +633,28 @@ function decodeRFC2047Words(headerValue)
     let buffer;
     if (encoding == 'B' || encoding == 'b') {
       // Decode base64. If there's any non-base64 data, treat the string as
       // an illegal token.
       if (/[^A-Za-z0-9+\/=]/.exec(text))
         return false;
 
       // Decode the string
-      buffer = mimeutils.decode_base64(text, false, true)[0];
+      buffer = mimeutils.decode_base64(text, false)[0];
     } else if (encoding == 'Q' || encoding == 'q') {
       // Q encoding here looks a lot like quoted-printable text. The differences
       // between quoted-printable and this are that quoted-printable allows you
       // to quote newlines (this doesn't), while this replaces spaces with _.
       // We can reuse the decode_qp code here, since newlines are already
       // stripped from the header. There is one edge case that could trigger a
       // false positive, namely when you have a single = or an = followed by
       // whitespace at the end of the string. Such an input string is already
       // malformed to begin with, so stripping the = and following input in that
       // case should not be an important loss.
-      buffer = mimeutils.decode_qp(text.replace(/_/g, ' '), false, true)[0];
+      buffer = mimeutils.decode_qp(text.replace(/_/g, ' '), false)[0];
     } else {
       return false;
     }
 
     // Make the buffer be a typed array for what follows
     let stringBuffer = buffer;
     buffer = mimeutils.stringToTypedArray(buffer);
 
--- a/mailnews/mime/jsmime/test/test_header.js
+++ b/mailnews/mime/jsmime/test/test_header.js
@@ -401,22 +401,16 @@ suite('headerparser', function () {
       ["=?iso-8859-1?Q?Klaus_Eisschl=E4ger_=28k=2Eeisschlaeger=40t-onli?=" +
         "=?iso-8859-1?Q?ne=2Ede=29?= <k.eisschlaeger@t-online.de>",
         [{name: "Klaus Eisschläger (k.eisschlaeger@t-online.de)",
           email: "k.eisschlaeger@t-online.de"}]],
       ["\"=?UTF-8?Q?=22Claudia_R=C3=B6hschicht=22?= Claudia_Roehschicht@web.de [freecycle-berlin]\" " +
         "<freecycle-berlin-noreply@yahoogroups.de>",
         [{name: "\"Claudia Röhschicht\" Claudia_Roehschicht@web.de [freecycle-berlin]",
           email: "freecycle-berlin-noreply@yahoogroups.de"}]],
-      // Bug 1423432: Encoded strings with null bytes,
-      // in base64 a single null byte can be encoded as AA== to AP==.
-      ["\"null=?UTF-8?Q?=00?=byte\" <nullbyte@example.com>",
-        [{name: "nullbyte", email: "nullbyte@example.com"}]],
-      ["\"null=?UTF-8?B?AA==?=byte\" <nullbyte@example.com>",
-        [{name: "nullbyte", email: "nullbyte@example.com"}]],
     ];
     header_tests.forEach(function (data) {
       arrayTest(data, function () {
         assert.deepEqual(headerparser.parseAddressingHeader(data[0], true),
           data[1]);
       });
     });
   });