Bug 1158412 - Remove assertion for document prescontex and add crash test; r=jdm
authorEdgar Chen <echen@mozilla.com>
Fri, 15 Apr 2016 09:33:20 -0400
changeset 317740 038ff8933b43546cd77633bf522bc819c6b7b4fe
parent 317739 8bcb31d3dfcaae0bbcdc53708a685cc3b4c5c628
child 317741 a46d02998795b1e04849fc6d4fe0fbe09235fcca
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs1158412
milestone48.0a1
Bug 1158412 - Remove assertion for document prescontex and add crash test; r=jdm MozReview-Commit-ID: BSrmQLfjYUi
dom/base/ResponsiveImageSelector.cpp
dom/base/crashtests/1158412.html
dom/base/crashtests/crashtests.list
--- a/dom/base/ResponsiveImageSelector.cpp
+++ b/dom/base/ResponsiveImageSelector.cpp
@@ -424,17 +424,16 @@ bool
 ResponsiveImageSelector::ComputeFinalWidthForCurrentViewport(double *aWidth)
 {
   unsigned int numSizes = mSizeQueries.Length();
   nsIDocument* doc = Document();
   nsIPresShell *presShell = doc ? doc->GetShell() : nullptr;
   nsPresContext *pctx = presShell ? presShell->GetPresContext() : nullptr;
 
   if (!pctx) {
-    MOZ_ASSERT(false, "Unable to find presContext for this content");
     return false;
   }
 
   MOZ_ASSERT(numSizes == mSizeValues.Length(),
              "mSizeValues length differs from mSizeQueries");
 
   unsigned int i;
   for (i = 0; i < numSizes; i++) {
new file mode 100644
--- /dev/null
+++ b/dom/base/crashtests/1158412.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<script>
+
+function boom()
+{
+    document.styleSheetSets.expando = null;
+    var otherDoc = document.implementation.createDocument("", "", null);
+    var otherSpan = otherDoc.createElementNS("http://www.w3.org/1999/xhtml", "span");
+
+    var img = document.createElementNS("http://www.w3.org/1999/xhtml", "img");
+    img.srcset = "data:,a 1w, data:,b 1w";
+    img.sizes = "1px";
+    otherSpan.appendChild(img);
+}
+
+</script>
+</head>
+<body onload="boom();"></body>
+</html>
\ No newline at end of file
--- a/dom/base/crashtests/crashtests.list
+++ b/dom/base/crashtests/crashtests.list
@@ -194,15 +194,16 @@ load 942979.html
 load 973401.html
 load 978646.html
 pref(dom.webcomponents.enabled,true) load 1024428-1.html
 load 1026714.html
 pref(dom.webcomponents.enabled,true) load 1027461-1.html
 pref(dom.webcomponents.enabled,true) load 1029710.html
 load 1154598.xhtml
 load 1157995.html
+load 1158412.html
 load 1181619.html
 load structured_clone_container_throws.html
 HTTP(..) load xhr_abortinprogress.html
 load xhr_empty_datauri.html
 load xhr_html_nullresponse.html
 load 1230422.html
 load 1251361.html