[tbb-commits] [tor-browser/tor-browser-45.1.0esr-6.0-1] fixup! Bug 12827: Create preference to disable SVG.

gk at torproject.org gk at torproject.org
Mon May 16 09:03:45 UTC 2016


commit 7ffe3230d2b6020394803784c140765e7c8e4b76
Author: Kathy Brade <brade at pearlcrescent.com>
Date:   Tue May 10 16:57:17 2016 -0400

    fixup! Bug 12827: Create preference to disable SVG.
    
    When SVGs are disabled, do no load SVG images within the
    Page Info Media tab (bug 18770).
---
 image/ImageFactory.cpp | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/image/ImageFactory.cpp b/image/ImageFactory.cpp
index 9298d74..ec20c78 100644
--- a/image/ImageFactory.cpp
+++ b/image/ImageFactory.cpp
@@ -98,8 +98,10 @@ ImageFactory::CreateImage(nsIRequest* aRequest,
     nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest));
     isBlocked = !NS_SVGEnabledForChannel(channel);
     if (!isBlocked && channel && !NS_SVGEnabledForChannel(nullptr)) {
-      // Special case for favicons: block this image load if SVGs are
-      // disallowed from content and if this image load originated from the
+      // This SVG was not blocked based on the channel but SVGs are
+      // disallowed from content. Check some special cases.
+
+      // For favicons, block this SVG image load if it originated from the
       // favicon xul:image node within a tab.
       nsCOMPtr<nsILoadInfo> loadInfo;
       nsresult rv = channel->GetLoadInfo(getter_AddRefs(loadInfo));
@@ -111,6 +113,17 @@ ImageFactory::CreateImage(nsIRequest* aRequest,
             nsAutoString anonid;
             elem->GetAttribute(NS_LITERAL_STRING("anonid"), anonid);
             isBlocked = anonid.EqualsLiteral("tab-icon-image");
+
+            if (!isBlocked) {
+              // For the Page Info "Media" tab, block this SVG image load if
+              // it originated from a node within a chrome document that has
+              // an id of "thepreviewimage".
+              if (nsContentUtils::IsChromeDoc(node->OwnerDoc())) {
+                nsAutoString loadingID;
+                elem->GetId(loadingID);
+                isBlocked = loadingID.EqualsLiteral("thepreviewimage");
+              }
+            }
           }
         }
       }



More information about the tbb-commits mailing list