Bug 1491406 - Add URI_NORELATIVE to mailbox: and imap: URLs to avoid TLD base lookup. r=aceman
authorJorg K <jorgk@jorgk.com>
Sat, 15 Sep 2018 00:10:48 +0200
changeset 33153 b5438a85767acdfa26aaa60f532d3f8e4bee979b
parent 33152 3643f8b54e3412c4a7bc5fb89a089e482253b769
child 33154 7fed66ae20ae6fbad019248d8c7908aef7c23834
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersaceman
bugs1491406
Bug 1491406 - Add URI_NORELATIVE to mailbox: and imap: URLs to avoid TLD base lookup. r=aceman
mailnews/imap/src/nsImapService.cpp
mailnews/imap/test/unit/test_imapProtocols.js
mailnews/local/src/nsMailboxService.cpp
mailnews/local/test/unit/test_mailboxProtocol.js
--- a/mailnews/imap/src/nsImapService.cpp
+++ b/mailnews/imap/src/nsImapService.cpp
@@ -2440,20 +2440,20 @@ NS_IMETHODIMP nsImapService::GetDefaultP
 {
   NS_ENSURE_ARG_POINTER(aDefaultPort);
   *aDefaultPort = nsIImapUrl::DEFAULT_IMAP_PORT;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsImapService::GetProtocolFlags(uint32_t *result)
 {
-  *result = URI_STD | URI_FORBIDS_AUTOMATIC_DOCUMENT_REPLACEMENT |
-  URI_DANGEROUS_TO_LOAD | ALLOWS_PROXY | URI_FORBIDS_COOKIE_ACCESS
+  *result = URI_NORELATIVE | URI_FORBIDS_AUTOMATIC_DOCUMENT_REPLACEMENT |
+    URI_DANGEROUS_TO_LOAD | ALLOWS_PROXY | URI_FORBIDS_COOKIE_ACCESS
 #ifdef IS_ORIGIN_IS_FULL_SPEC_DEFINED
-  | ORIGIN_IS_FULL_SPEC
+    | ORIGIN_IS_FULL_SPEC
 #endif
   ;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsImapService::AllowPort(int32_t port, const char *scheme, bool *aRetVal)
 {
   // allow imap to run on any port
--- a/mailnews/imap/test/unit/test_imapProtocols.js
+++ b/mailnews/imap/test/unit/test_imapProtocols.js
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /*
  * Test suite for IMAP nsIProtocolHandler implementations.
  */
 
 var defaultProtocolFlags =
-  Ci.nsIProtocolHandler.URI_STD |
+  Ci.nsIProtocolHandler.URI_NORELATIVE |
   Ci.nsIProtocolHandler.URI_FORBIDS_AUTOMATIC_DOCUMENT_REPLACEMENT |
   Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD |
   Ci.nsIProtocolHandler.ALLOWS_PROXY |
   Ci.nsIProtocolHandler.URI_FORBIDS_COOKIE_ACCESS |
   Ci.nsIProtocolHandler.ORIGIN_IS_FULL_SPEC;
 
 var protocols =
   [ { protocol: "imap",
--- a/mailnews/local/src/nsMailboxService.cpp
+++ b/mailnews/local/src/nsMailboxService.cpp
@@ -529,17 +529,17 @@ NS_IMETHODIMP nsMailboxService::AllowPor
   // don't override anything.
   *_retval = false;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMailboxService::GetProtocolFlags(uint32_t *result)
 {
   NS_ENSURE_ARG_POINTER(result);
-  *result = URI_STD | URI_FORBIDS_AUTOMATIC_DOCUMENT_REPLACEMENT |
+  *result = URI_NORELATIVE | URI_FORBIDS_AUTOMATIC_DOCUMENT_REPLACEMENT |
             URI_DANGEROUS_TO_LOAD | URI_FORBIDS_COOKIE_ACCESS
 #ifdef IS_ORIGIN_IS_FULL_SPEC_DEFINED
             | ORIGIN_IS_FULL_SPEC
 #endif
   ;
   return NS_OK;
 }
 
--- a/mailnews/local/test/unit/test_mailboxProtocol.js
+++ b/mailnews/local/test/unit/test_mailboxProtocol.js
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /*
  * Test suite for getting mailbox urls via the protocol handler.
  */
 
 var defaultProtocolFlags =
+  Ci.nsIProtocolHandler.URI_NORELATIVE |
   Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD |
-  Ci.nsIProtocolHandler.URI_STD |
   Ci.nsIProtocolHandler.URI_FORBIDS_AUTOMATIC_DOCUMENT_REPLACEMENT |
   Ci.nsIProtocolHandler.URI_FORBIDS_COOKIE_ACCESS |
   Ci.nsIProtocolHandler.ORIGIN_IS_FULL_SPEC;
 
 var protocols =
   [ { protocol: "mailbox",
       urlSpec: "mailbox://user@localhost/",
       // mailbox protocol doesn't use a port