Bug 1407229 - Temporary fix for changes in bug 1406278: Changed parameters of HTMLImageElement::SetSrc/GetSrc() and HTMLLinkElement::SetHref(). rs=bustage-fix
authorJorg K <jorgk@jorgk.com>
Tue, 10 Oct 2017 19:32:04 +0200
changeset 29157 2ca8d8d5694114518128c96dea2ff48c23a5474d
parent 29156 7598eb747cce9175bd010c3d8c63d524835d3414
child 29158 e6c1d0bc8fa54e32f3663e44b405eddea98bfe6e
push id2068
push userclokep@gmail.com
push dateMon, 13 Nov 2017 19:02:14 +0000
treeherdercomm-beta@9c7e7ce8672b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage-fix
bugs1407229, 1406278
Bug 1407229 - Temporary fix for changes in bug 1406278: Changed parameters of HTMLImageElement::SetSrc/GetSrc() and HTMLLinkElement::SetHref(). rs=bustage-fix
mailnews/compose/src/nsMsgCompose.cpp
mailnews/compose/src/nsMsgSend.cpp
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -77,16 +77,17 @@
 #include "mozilla/dom/HTMLLinkElement.h"
 #include "nsStreamConverter.h"
 #include "nsISelection.h"
 #include "nsJSEnvironment.h"
 #include "nsIObserverService.h"
 #include "nsIProtocolHandler.h"
 #include "nsContentUtils.h"
 #include "nsIFileURL.h"
+#include "nsIPrincipal.h" // XXX TEMPORARY
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::mailnews;
 
 static nsresult GetReplyHeaderInfo(int32_t* reply_header_type,
                                    nsString& reply_header_authorwrote,
                                    nsString& reply_header_ondateauthorwrote,
@@ -266,17 +267,17 @@ bool nsMsgCompose::IsEmbeddedObjectSafe(
     return false;
 
   nsCOMPtr<Element> objectAsElement = do_QueryInterface(object);
   RefPtr<HTMLImageElement>  image  = HTMLImageElement::FromContentOrNull(objectAsElement);
   RefPtr<HTMLLinkElement>   link   = HTMLLinkElement::FromContentOrNull(objectAsElement);
   RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::FromContentOrNull(objectAsElement);
 
   if (image)
-    image->GetSrc(objURL);
+    { uint64_t ignored; image->GetSrc(objURL, *(nsIPrincipal*)(&ignored)); } // XXX TEMPORARY
   else if (link)
     link->GetHref(objURL);
   else if (anchor)
     anchor->GetHref(objURL);
   else
     return false;
 
   if (!objURL.IsEmpty())
@@ -369,17 +370,17 @@ nsresult nsMsgCompose::ResetUrisForEmbed
         RefPtr<mozilla::dom::HTMLImageElement> image =
           mozilla::dom::HTMLImageElement::FromContentOrNull(imageElement);
         if (!image)
           continue;
         nsCString partNum;
         mMsgSend->GetPartForDomIndex(i, partNum);
         // do we care about anything besides images?
         nsAutoString objURL;
-        image->GetSrc(objURL);
+        uint64_t ignored; image->GetSrc(objURL, *(nsIPrincipal*)(&ignored)); // XXX TEMPORARY
 
         // First we need to make sure that the URL is associated with a message
         // protocol so we don't accidentally manipulate a URL like:
         // http://www.site.com/retrieve.html?C=image.jpg.
         nsCOMPtr<nsIIOService> ioService = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
         NS_ENSURE_SUCCESS(rv, rv);
         nsAutoCString scheme;
         ioService->ExtractScheme(NS_ConvertUTF16toUTF8(objURL), scheme);
@@ -437,17 +438,17 @@ nsresult nsMsgCompose::ResetUrisForEmbed
         bool specHasQ = (spec.FindChar('?') != kNotFound);
         if (specHasQ && restOfUrl.CharAt(0) == '?')
           restOfUrl.SetCharAt('&', 0);
         else if (!specHasQ && restOfUrl.CharAt(0) == '&')
           restOfUrl.SetCharAt('?', 0);
         AppendUTF8toUTF16(spec, newSrc);
         newSrc.Append(restOfUrl);
         IgnoredErrorResult rv2;
-        image->SetSrc(newSrc, rv2);
+        image->SetSrc(newSrc, *nsContentUtils::GetSystemPrincipal(), rv2); // XXX TEMPORARY
       }
     }
   }
 
   return NS_OK;
 }
 
 
--- a/mailnews/compose/src/nsMsgSend.cpp
+++ b/mailnews/compose/src/nsMsgSend.cpp
@@ -78,16 +78,17 @@
 #include "mozilla/dom/HTMLBodyElement.h"
 #include "mozilla/dom/HTMLImageElement.h"
 #include "mozilla/dom/HTMLLinkElement.h"
 #include "nsIMutableArray.h"
 #include "nsIMsgFilterService.h"
 #include "nsIMsgProtocolInfo.h"
 #include "mozIDOMWindow.h"
 #include "mozilla/Preferences.h"
+#include "nsIPrincipal.h" // XXX TEMPORARY
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::mailnews;
 
 static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
 
 #define PREF_MAIL_SEND_STRUCT "mail.send_struct"
@@ -1309,17 +1310,17 @@ nsMsgComposeAndSend::GetEmbeddedObjectIn
   }
   else if (image)        // Is this an image?
   {
     nsString    tUrl;
     nsString    tName;
     nsString    tDesc;
 
     // Create the URI
-    image->GetSrc(tUrl);
+    uint64_t ignored; image->GetSrc(tUrl, *(nsIPrincipal*)(&ignored)); // XXX TEMPORARY
     if (tUrl.IsEmpty())
       return NS_OK;
 
     nsAutoCString turlC;
     CopyUTF16toUTF8(tUrl, turlC);
     if (NS_FAILED(nsMsgNewURL(getter_AddRefs(attachment->m_url), turlC)))
     {
       // Well, the first time failed...which means we probably didn't get
@@ -1833,22 +1834,22 @@ nsMsgComposeAndSend::ProcessMultipartRel
       if (anchor)
       {
         anchor->GetHref(domURL);
         anchor->SetHref(newSpec, rv2);
       }
       else if (link)
       {
         link->GetHref(domURL);
-        link->SetHref(newSpec, rv2);
+        link->SetHref(newSpec, *nsContentUtils::GetSystemPrincipal(), rv2); // XXX TEMPORARY
       }
       else if (image)
       {
-        image->GetSrc(domURL);
-        image->SetSrc(newSpec, rv2);
+        uint64_t ignored; image->GetSrc(domURL, *(nsIPrincipal*)(&ignored)); // XXX TEMPORARY
+        image->SetSrc(newSpec, *nsContentUtils::GetSystemPrincipal(), rv2); // XXX TEMPORARY
       }
       else if (body)
       {
         body->GetBackground(domURL);
         body->SetBackground(newSpec, rv2);
       }
 
       if (!domURL.IsEmpty())
@@ -1877,19 +1878,19 @@ nsMsgComposeAndSend::ProcessMultipartRel
     RefPtr<HTMLBodyElement>   body   = HTMLBodyElement::FromContentOrNull(nodeAsElement);
 
       // STRING USE WARNING: hoisting the following conversion might save code-space, since it happens along every path
 
     IgnoredErrorResult rv2;
     if (anchor) {
       anchor->SetHref(NS_ConvertASCIItoUTF16(domSaveArray[i].url), rv2);
     } else if (link) {
-      link->SetHref(NS_ConvertASCIItoUTF16(domSaveArray[i].url), rv2);
+      link->SetHref(NS_ConvertASCIItoUTF16(domSaveArray[i].url), *nsContentUtils::GetSystemPrincipal(), rv2); // XXX TEMPORARY
     } else if (image) {
-      image->SetSrc(NS_ConvertASCIItoUTF16(domSaveArray[i].url), rv2);
+      image->SetSrc(NS_ConvertASCIItoUTF16(domSaveArray[i].url), *nsContentUtils::GetSystemPrincipal(), rv2); // XXX TEMPORARY
     }
     else if (body) {
       body->SetBackground(NS_ConvertASCIItoUTF16(domSaveArray[i].url), rv2);
     }
 
     free(domSaveArray[i].url);
   }