Bug 1383791 - Download an SVG resource only if the mask URL consists of a fragment. r=heycam
authorcku <cku@mozilla.com>
Wed, 19 Jul 2017 19:45:34 +0800
changeset 419417 0e7ce13991ca8821d6f8efa57eb56857860f6b6b
parent 419416 ad4358c129b1d5ae50a3cba9145eafaddab19c2e
child 419418 e7613d8dfb7cc5cb04c47342782077b9a57edcbb
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1383791
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1383791 - Download an SVG resource only if the mask URL consists of a fragment. r=heycam MozReview-Commit-ID: OT6ipv3qSj
layout/svg/nsSVGEffects.cpp
--- a/layout/svg/nsSVGEffects.cpp
+++ b/layout/svg/nsSVGEffects.cpp
@@ -392,18 +392,30 @@ nsSVGMarkerProperty::DoUpdate()
 NS_IMPL_ISUPPORTS(nsSVGMaskProperty, nsISupports)
 
 nsSVGMaskProperty::nsSVGMaskProperty(nsIFrame* aFrame)
 {
   const nsStyleSVGReset *svgReset = aFrame->StyleSVGReset();
 
   for (uint32_t i = 0; i < svgReset->mMask.mImageCount; i++) {
     nsCOMPtr<nsIURI> maskUri = nsSVGEffects::GetMaskURI(aFrame, i);
-    nsSVGPaintingProperty* prop = new nsSVGPaintingProperty(maskUri, aFrame,
-                                                            false);
+    bool hasRef = false;
+    if (maskUri) {
+      maskUri->GetHasRef(&hasRef);
+    }
+
+    // Accrording to maskUri, nsSVGPaintingProperty's ctor may trigger an
+    // external SVG resource download, so we should pass maskUri in only if
+    // maskUri has a chance pointing to an SVG mask resource.
+    //
+    // And, an URL may refer to an SVG mask resource if it consists of
+    // a fragment.
+    nsSVGPaintingProperty* prop =
+      new nsSVGPaintingProperty(hasRef ? maskUri.get() : nullptr,
+                                aFrame, false);
     mProperties.AppendElement(prop);
   }
 }
 
 bool
 nsSVGTextPathProperty::TargetIsValid()
 {
   Element* target = GetTarget();