[tor-commits] [torbirdy/develop] Remove redundant patches and associated overlays for #6314 and #6315

sukhbir at torproject.org sukhbir at torproject.org
Fri Nov 25 05:54:48 UTC 2016


commit 6b53dfaa246f46ae83abd3e2edf5dd12643c2ec6
Author: Sukhbir Singh <sukhbir at torproject.org>
Date:   Mon May 16 17:43:23 2016 -0400

    Remove redundant patches and associated overlays for #6314 and #6315
    
    Patches for the above two bugs have been merged upstream by Arthur Edelstein
    and our patches and the overlay for the messenger window are redundant. See
    the above tickets for more information.
---
 Makefile                          |   4 +-
 chrome.manifest                   |   1 -
 chrome/content/composeoverlay.js  |  85 -------------------------
 chrome/content/composeoverlay.xul |   7 --
 chrome/skin/contents.rdf          |   4 --
 patches/date.patch                |  70 --------------------
 patches/mailnewspref.patch        |  26 --------
 patches/messageid.patch           |  49 --------------
 patches/unified.patch             | 130 --------------------------------------
 9 files changed, 2 insertions(+), 374 deletions(-)

diff --git a/Makefile b/Makefile
index 48c661c..7dca2f9 100644
--- a/Makefile
+++ b/Makefile
@@ -4,11 +4,11 @@ VERSION := $(shell cat install.rdf|grep '<em:version>'|cut -d\> -f2|cut -d\< -f1
 FAKETIME := 200001010000
 
 make-xpi:
-	zip -r ../torbirdy-$(VERSION).xpi * -x "debian/*" -x "patches/*" -x "ChangeLog" -x "Makefile" -x "gpg.conf" -x "import-translations.sh" -x "README.RELEASE"
+	zip -r ../torbirdy-$(VERSION).xpi * -x "debian/*" -x "ChangeLog" -x "Makefile" -x "gpg.conf" -x "import-translations.sh" -x "README.RELEASE"
 
 make-reproducible:
 	find . -print0 | xargs -0 touch -t $(FAKETIME)
-	zip -X ../torbirdy-$(VERSION).xpi `find . | sort` -x "debian/*" -x "patches/*" -x "ChangeLog" -x "Makefile" -x "gpg.conf" -x "import-translations.sh" -x "README.RELEASE" -x *.git*
+	zip -X ../torbirdy-$(VERSION).xpi `find . | sort` -x "debian/*" -x "ChangeLog" -x "Makefile" -x "gpg.conf" -x "import-translations.sh" -x "README.RELEASE" -x *.git*
 
 clean:
 	rm -f ../torbirdy-$(VERSION).xpi
diff --git a/chrome.manifest b/chrome.manifest
index 33b0a10..d61ecd5 100644
--- a/chrome.manifest
+++ b/chrome.manifest
@@ -1,7 +1,6 @@
 content castironthunderbirdclub chrome/content/
 
 overlay chrome://messenger/content/messenger.xul chrome://castironthunderbirdclub/content/overlay.xul application={3550f703-e582-4d05-9a08-453d09bdfdc6}
-overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://castironthunderbirdclub/content/composeoverlay.xul
 overlay chrome://messenger/content/accountcreation/emailWizard.xul chrome://castironthunderbirdclub/content/emailwizard.xul
 overlay chrome://messenger-newsblog/content/feedAccountWizard.xul chrome://castironthunderbirdclub/content/feedwizard.xul
 overlay chrome://messenger/content/AccountWizard.xul chrome://castironthunderbirdclub/content/nntpwizard.xul
diff --git a/chrome/content/composeoverlay.js b/chrome/content/composeoverlay.js
deleted file mode 100644
index 843cfbc..0000000
--- a/chrome/content/composeoverlay.js
+++ /dev/null
@@ -1,85 +0,0 @@
-var Ci = Components.interfaces;
-var Cc = Components.classes;
-
-function torbirdyTextRandom() {
-  // Generate alphanumeric random numbers.
-  var inChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-=_";
-  var randomString = '';
-  for (var i = 0; i < 10; i++) {
-    var num = Math.floor(Math.random() * inChars.length);
-    randomString += inChars.substring(num, num+1);
-  }
-  return randomString;
-}
-
-function torbirdyHexString(charCode) {
-  return ("0" + charCode.toString(16)).slice(-2);
-}
-
-function send_event_handler(event) {
-  var msgcomposeWindow = document.getElementById("msgcomposeWindow");
-  var msg_type = msgcomposeWindow.getAttribute("msgtype");
-
-  var prefs = Cc["@mozilla.org/preferences-service;1"]
-                 .getService(Ci.nsIPrefBranch);
-
-  var is_custom_msg_id = prefs.getBoolPref("mailnews.custom_message_id");
-
-  if (is_custom_msg_id) {
-    // Only continue if this is an actual send event.
-    if (!(msg_type == nsIMsgCompDeliverMode.Now || msg_type == nsIMsgCompDeliverMode.Later))
-      return;
-
-    // We now generate the custom message-ID based on the approach described in tagnaq's paper.
-    var to_field = gMsgCompose.compFields.to;
-    var cc_field = gMsgCompose.compFields.cc;
-    var subject_field = gMsgCompose.compFields.subject;
-
-    // When a message is forwarded, remove the references header.
-    // See https://trac.torproject.org/projects/tor/ticket/6392
-    if (gMsgCompose.type === 3 || gMsgCompose.type === 4) {
-      gMsgCompose.compFields.references = '';
-    }
-
-    // Get the text of the body.
-    try {
-      var editor = GetCurrentEditor();
-      var body = editor.outputToString('text/plain', 4);
-    } catch(ex) {
-      // We couldn't get the editor.
-      var body = '';
-    }
-
-    // Generate an 'email' and append a random number. The SHA512 hash of this email will be used later.
-    var mail = to_field + cc_field + subject_field + body + Math.random();
-
-    // Generate a SHA512 hash of the string above.
-    var converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
-                        .createInstance(Ci.nsIScriptableUnicodeConverter);
-    var ch = Cc["@mozilla.org/security/hash;1"]
-                 .createInstance(Ci.nsICryptoHash);
-    converter.charset = "UTF-8";
-
-    var result = {};
-    var data = converter.convertToByteArray(mail, result);
-    ch.init(ch.SHA512);
-    ch.update(data, data.length);
-
-    var hash = ch.finish(false);
-    var pref_hash = [torbirdyHexString(hash.charCodeAt(i)) for (i in hash)].join("").slice(0, 40);
-    // Randomize characters to upper case and lower case.
-    var choices = [true, false];
-    pref_hash = [choices[Math.floor(Math.random() * choices.length)] ?
-                        e.toUpperCase() : e.toLowerCase() for each (e in pref_hash.split(""))].join("");
-
-    // Introduce more randomness.
-    var randomString = torbirdyTextRandom();
-    var message_id = pref_hash + randomString;
-
-    // Set the preference to use the custom generated header ID.
-    // This is the message-ID that will be used in the outgoing message.
-    prefs.setCharPref("mailnews.header.custom_message_id", message_id);
-  }
-}
-
-window.addEventListener("compose-send-message", send_event_handler, true);
diff --git a/chrome/content/composeoverlay.xul b/chrome/content/composeoverlay.xul
deleted file mode 100644
index b9e8aea..0000000
--- a/chrome/content/composeoverlay.xul
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<overlay id="castironthunderbirdclub-compose-overlay"
-    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-  <script type="application/javascript" src="chrome://castironthunderbirdclub/content/composeoverlay.js" />
-
-</overlay>
diff --git a/chrome/skin/contents.rdf b/chrome/skin/contents.rdf
index 219e790..28d6c2e 100644
--- a/chrome/skin/contents.rdf
+++ b/chrome/skin/contents.rdf
@@ -19,7 +19,6 @@
         <li resource="chrome://global/content/customizeToolbar.xul"/>
         <!-- thunderbird -->
         <li resource="chrome://messenger/content/messenger.xul"/>
-        <li resource="chrome://messenger/content/messengercompose/messengercompose.xul"/>
     </Seq>
 
     <Seq about="chrome://global/content/customizeToolbar.xul">
@@ -30,8 +29,5 @@
     <Seq about="chrome://messenger/content/messenger.xul">
         <li>chrome://castironthunderbirdclub/skin/castironthunderbirdclub.css</li>
     </Seq>
-    <Seq about="chrome://messenger/content/messengercompose/messengercompose.xul">
-        <li>chrome://castironthunderbirdclub/skin/castironthunderbirdclub.css</li>
-    </Seq>
 
 </RDF>
diff --git a/patches/date.patch b/patches/date.patch
deleted file mode 100644
index eb3883c..0000000
--- a/patches/date.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-# HG changeset patch
-# Parent ec138f1fcabf10f11ba4a4ba662cba34ab625691
-# User Sukhbir Singh <sukhbir.in at gmail.com>
-Added support for removing the Date header
-
-
-diff --git a/mailnews/compose/src/nsMsgCompUtils.cpp b/mailnews/compose/src/nsMsgCompUtils.cpp
---- a/mailnews/compose/src/nsMsgCompUtils.cpp
-+++ b/mailnews/compose/src/nsMsgCompUtils.cpp
-@@ -364,36 +364,42 @@ mime_generate_headers (nsMsgCompFields *
-     if (deliver_mode == MSG_SaveAsTemplate) {
-       const char *pStr = fields->GetTemplateName();
-       pStr = pStr ? pStr : "";
-       ENCODE_AND_PUSH("X-Template: ", false, pStr, charset, usemime);
-     }
- #endif /* SUPPORT_X_TEMPLATE_NAME */
-   }
- 
--  PRExplodedTime now;
--  PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &now);
--  int gmtoffset = (now.tm_params.tp_gmt_offset + now.tm_params.tp_dst_offset) / 60;
-+  bool local_date_header = true;
-+  prefs->GetBoolPref("mailnews.local_date_header_generation", &local_date_header);
- 
--  /* Use PR_FormatTimeUSEnglish() to format the date in US English format,
--     then figure out what our local GMT offset is, and append it (since
--     PR_FormatTimeUSEnglish() can't do that.) Generate four digit years as
--     per RFC 1123 (superceding RFC 822.)
--   */
--  PR_FormatTimeUSEnglish(buffer_tail, 100,
--               "Date: %a, %d %b %Y %H:%M:%S ",
--               &now);
-+  if (local_date_header)
-+  {
-+    PRExplodedTime now;
-+    PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &now);
-+    int gmtoffset = (now.tm_params.tp_gmt_offset + now.tm_params.tp_dst_offset) / 60;
- 
--  buffer_tail += PL_strlen (buffer_tail);
--  PR_snprintf(buffer_tail, buffer + size - buffer_tail,
--        "%c%02d%02d" CRLF,
--        (gmtoffset >= 0 ? '+' : '-'),
--        ((gmtoffset >= 0 ? gmtoffset : -gmtoffset) / 60),
--        ((gmtoffset >= 0 ? gmtoffset : -gmtoffset) % 60));
--  buffer_tail += PL_strlen (buffer_tail);
-+    /* Use PR_FormatTimeUSEnglish() to format the date in US English format,
-+       then figure out what our local GMT offset is, and append it (since
-+       PR_FormatTimeUSEnglish() can't do that.) Generate four digit years as
-+       per RFC 1123 (superceding RFC 822.)
-+     */
-+    PR_FormatTimeUSEnglish(buffer_tail, 100,
-+                 "Date: %a, %d %b %Y %H:%M:%S ",
-+                 &now);
-+
-+    buffer_tail += PL_strlen (buffer_tail);
-+    PR_snprintf(buffer_tail, buffer + size - buffer_tail,
-+          "%c%02d%02d" CRLF,
-+          (gmtoffset >= 0 ? '+' : '-'),
-+          ((gmtoffset >= 0 ? gmtoffset : -gmtoffset) / 60),
-+          ((gmtoffset >= 0 ? gmtoffset : -gmtoffset) % 60));
-+    buffer_tail += PL_strlen (buffer_tail);
-+  }
- 
-   if (pFrom && *pFrom)
-   {
-     ENCODE_AND_PUSH("From: ", true, pFrom, charset, usemime);
-   }
- 
-   if (pReplyTo && *pReplyTo)
-   {
diff --git a/patches/mailnewspref.patch b/patches/mailnewspref.patch
deleted file mode 100644
index 6bffc79..0000000
--- a/patches/mailnewspref.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-# HG changeset patch
-# Parent 721cec51e68558ab41a21d7f3db1b7de0e20f3bd
-# User Sukhbir Singh <sukhbir.in at gmail.com>
-Set the default preferences for the patches (https://bugzilla.mozilla.org/show_bug.cgi?id=776397)
-
-
-diff --git a/mailnews/mailnews.js b/mailnews/mailnews.js
---- a/mailnews/mailnews.js
-+++ b/mailnews/mailnews.js
-@@ -814,8 +814,16 @@ pref("mail.smtp.qos", 0);
- pref("mail.nntp.qos", 0);
- 
- // default value for IMAP4
- // in a DSCP environment this should be 56 (0x38, or AF13), ibid.
- pref("mail.imap.qos", 0);
- 
- // PgpMime Addon
- pref("mail.pgpmime.addon_url", "https://addons.mozilla.org/addon/enigmail/");
-+
-+// Send emails with the Date header. 
-+// If set to false, the Date header will be inserted by the MSA (RFC 4409/RFC 6409).
-+pref("mailnews.local_date_header_generation", true);
-+
-+// Allow a custom message-ID to be set through an extension.
-+pref("mailnews.custom_message_id", false);
-+pref("mailnews.header.custom_message_id", "");
diff --git a/patches/messageid.patch b/patches/messageid.patch
deleted file mode 100644
index 1cbebc8..0000000
--- a/patches/messageid.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-# HG changeset patch
-# Parent 433268decbc634fd8855bdc114a9356dfec431dd
-# User Sukhbir Singh <sukhbir.in at gmail.com>
-Added support for setting a custom message-ID
-
-
-diff --git a/mailnews/compose/src/nsMsgCompUtils.cpp b/mailnews/compose/src/nsMsgCompUtils.cpp
---- a/mailnews/compose/src/nsMsgCompUtils.cpp
-+++ b/mailnews/compose/src/nsMsgCompUtils.cpp
-@@ -1109,19 +1109,36 @@ msg_generate_message_id (nsIMsgIdentity 
-       ++host;
-   }
- 
-   if (!isValidHost(host))
-   /* If we couldn't find a valid host name to use, we can't generate a
-      valid message ID, so bail, and let NNTP and SMTP generate them. */
-     return 0;
- 
--  GenerateGlobalRandomBytes((unsigned char *) &salt, sizeof(salt));
--  return PR_smprintf("<%lX.%lX@%s>",
--           (unsigned long) now, (unsigned long) salt, host);
-+  bool custom_message_id = false;
-+  nsCString message_id;
-+
-+  nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
-+  if (NS_SUCCEEDED(rv)) {
-+    prefs->GetBoolPref("mailnews.custom_message_id", &custom_message_id);
-+    prefs->GetCharPref("mailnews.header.custom_message_id", getter_Copies(message_id));
-+  }
-+
-+  if (!custom_message_id)
-+  {
-+    GenerateGlobalRandomBytes((unsigned char *) &salt, sizeof(salt));
-+    return PR_smprintf("<%lX.%lX@%s>",
-+             (unsigned long) now, (unsigned long) salt, host);
-+  }
-+  else
-+  {
-+    return PR_smprintf("<%s@%s>",
-+             message_id.get(), host);
-+  }
- }
- 
- 
- inline static bool is7bitCharset(const nsCString& charset)
- {
-   // charset name is canonical (no worry about case-sensitivity)
-   return charset.EqualsLiteral("HZ-GB-2312") ||
-          Substring(charset, 0, 8).EqualsLiteral("ISO-2022-");
diff --git a/patches/unified.patch b/patches/unified.patch
deleted file mode 100644
index 0aa1120..0000000
--- a/patches/unified.patch
+++ /dev/null
@@ -1,130 +0,0 @@
-# HG changeset patch
-# Parent a9d426e01d37d2a72fcfeb8cd63242982d04adb2
-# User Sukhbir Singh <sukhbir.in at gmail.com>
-Prevent local timestamp disclosure via Date and Message-ID header fields.
-
-
-diff --git a/mailnews/compose/src/nsMsgCompUtils.cpp b/mailnews/compose/src/nsMsgCompUtils.cpp
---- a/mailnews/compose/src/nsMsgCompUtils.cpp
-+++ b/mailnews/compose/src/nsMsgCompUtils.cpp
-@@ -364,36 +364,42 @@ mime_generate_headers (nsMsgCompFields *
-     if (deliver_mode == MSG_SaveAsTemplate) {
-       const char *pStr = fields->GetTemplateName();
-       pStr = pStr ? pStr : "";
-       ENCODE_AND_PUSH("X-Template: ", false, pStr, charset, usemime);
-     }
- #endif /* SUPPORT_X_TEMPLATE_NAME */
-   }
- 
--  PRExplodedTime now;
--  PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &now);
--  int gmtoffset = (now.tm_params.tp_gmt_offset + now.tm_params.tp_dst_offset) / 60;
-+  bool local_date_header = true;
-+  prefs->GetBoolPref("mailnews.local_date_header_generation", &local_date_header);
- 
--  /* Use PR_FormatTimeUSEnglish() to format the date in US English format,
--     then figure out what our local GMT offset is, and append it (since
--     PR_FormatTimeUSEnglish() can't do that.) Generate four digit years as
--     per RFC 1123 (superceding RFC 822.)
--   */
--  PR_FormatTimeUSEnglish(buffer_tail, 100,
--               "Date: %a, %d %b %Y %H:%M:%S ",
--               &now);
-+  if (local_date_header)
-+  {
-+    PRExplodedTime now;
-+    PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &now);
-+    int gmtoffset = (now.tm_params.tp_gmt_offset + now.tm_params.tp_dst_offset) / 60;
- 
--  buffer_tail += PL_strlen (buffer_tail);
--  PR_snprintf(buffer_tail, buffer + size - buffer_tail,
--        "%c%02d%02d" CRLF,
--        (gmtoffset >= 0 ? '+' : '-'),
--        ((gmtoffset >= 0 ? gmtoffset : -gmtoffset) / 60),
--        ((gmtoffset >= 0 ? gmtoffset : -gmtoffset) % 60));
--  buffer_tail += PL_strlen (buffer_tail);
-+    /* Use PR_FormatTimeUSEnglish() to format the date in US English format,
-+       then figure out what our local GMT offset is, and append it (since
-+       PR_FormatTimeUSEnglish() can't do that.) Generate four digit years as
-+       per RFC 1123 (superceding RFC 822.)
-+     */
-+    PR_FormatTimeUSEnglish(buffer_tail, 100,
-+                 "Date: %a, %d %b %Y %H:%M:%S ",
-+                 &now);
-+
-+    buffer_tail += PL_strlen (buffer_tail);
-+    PR_snprintf(buffer_tail, buffer + size - buffer_tail,
-+          "%c%02d%02d" CRLF,
-+          (gmtoffset >= 0 ? '+' : '-'),
-+          ((gmtoffset >= 0 ? gmtoffset : -gmtoffset) / 60),
-+          ((gmtoffset >= 0 ? gmtoffset : -gmtoffset) % 60));
-+    buffer_tail += PL_strlen (buffer_tail);
-+  }
- 
-   if (pFrom && *pFrom)
-   {
-     ENCODE_AND_PUSH("From: ", true, pFrom, charset, usemime);
-   }
- 
-   if (pReplyTo && *pReplyTo)
-   {
-@@ -1109,19 +1115,36 @@ msg_generate_message_id (nsIMsgIdentity 
-       ++host;
-   }
- 
-   if (!isValidHost(host))
-   /* If we couldn't find a valid host name to use, we can't generate a
-      valid message ID, so bail, and let NNTP and SMTP generate them. */
-     return 0;
- 
--  GenerateGlobalRandomBytes((unsigned char *) &salt, sizeof(salt));
--  return PR_smprintf("<%lX.%lX@%s>",
--           (unsigned long) now, (unsigned long) salt, host);
-+  bool custom_message_id = false;
-+  nsCString message_id;
-+
-+  nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
-+  if (NS_SUCCEEDED(rv)) {
-+    prefs->GetBoolPref("mailnews.custom_message_id", &custom_message_id);
-+    prefs->GetCharPref("mailnews.header.custom_message_id", getter_Copies(message_id));
-+  }
-+
-+  if (!custom_message_id)
-+  {
-+    GenerateGlobalRandomBytes((unsigned char *) &salt, sizeof(salt));
-+    return PR_smprintf("<%lX.%lX@%s>",
-+             (unsigned long) now, (unsigned long) salt, host);
-+  }
-+  else
-+  {
-+    return PR_smprintf("<%s@%s>",
-+             message_id.get(), host);
-+  }
- }
- 
- 
- inline static bool is7bitCharset(const nsCString& charset)
- {
-   // charset name is canonical (no worry about case-sensitivity)
-   return charset.EqualsLiteral("HZ-GB-2312") ||
-          Substring(charset, 0, 8).EqualsLiteral("ISO-2022-");
-diff --git a/mailnews/mailnews.js b/mailnews/mailnews.js
---- a/mailnews/mailnews.js
-+++ b/mailnews/mailnews.js
-@@ -821,8 +821,16 @@ pref("mail.smtp.qos", 0);
- pref("mail.nntp.qos", 0);
- 
- // default value for IMAP4
- // in a DSCP environment this should be 56 (0x38, or AF13), ibid.
- pref("mail.imap.qos", 0);
- 
- // PgpMime Addon
- pref("mail.pgpmime.addon_url", "https://addons.mozilla.org/addon/enigmail/");
-+
-+// Send emails with the Date header.
-+// If set to false, the Date header will be inserted by the MSA (RFC 4409/RFC 6409).
-+pref("mailnews.local_date_header_generation", true);
-+
-+// Allow a custom message-ID to be set through an extension.
-+pref("mailnews.custom_message_id", false);
-+pref("mailnews.header.custom_message_id", "");





More information about the tor-commits mailing list