bug 1281971 - Fix null pointer access in TryToStartImageLoadOnValue. draft
authorcku <cku@mozilla.com>
Sat, 25 Jun 2016 00:52:20 +0800
changeset 381204 f782b61cf5cc30ae89dba05536fd345481ddebdd
parent 380895 d1102663db10b3d4b9358f3cf4e16b7c56902352
child 523914 921d0c156149a545f5d71aedcd6008f4614dd22a
push id21426
push usercku@mozilla.com
push dateFri, 24 Jun 2016 18:10:26 +0000
bugs1281971
milestone50.0a1
bug 1281971 - Fix null pointer access in TryToStartImageLoadOnValue. MozReview-Commit-ID: 6FAXlMb8iQr
layout/style/nsCSSDataBlock.cpp
--- a/layout/style/nsCSSDataBlock.cpp
+++ b/layout/style/nsCSSDataBlock.cpp
@@ -66,20 +66,22 @@ TryToStartImageLoadOnValue(const nsCSSVa
     // For example,
     //   mask-image: url(#mask_id); // refer to a SVG mask element, whose id is
     //                              // "mask_id", in the current document.
     // For such 'mask-image' values (pointing to an in-document element),
     // there is no need to trigger image download.
     if (aProperty == eCSSProperty_mask_image) {
       nsIURI* docURI = aDocument->GetDocumentURI();
       nsIURI* imageURI = aValue.GetURLValue();
-      bool isEqualExceptRef = false;
-      nsresult  rv = imageURI->EqualsExceptRef(docURI, &isEqualExceptRef);
-      if (NS_SUCCEEDED(rv) && isEqualExceptRef) {
-        return;
+      if (imageURI) {
+        bool isEqualExceptRef = false;
+        nsresult  rv = imageURI->EqualsExceptRef(docURI, &isEqualExceptRef);
+        if (NS_SUCCEEDED(rv) && isEqualExceptRef) {
+          return;
+        }
       }
     }
 #endif
     aValue.StartImageLoad(aDocument);
     if (aForTokenStream && aContext) {
       CSSVariableImageTable::Add(aContext, aProperty,
                                  aValue.GetImageStructValue());
     }