Bug 938772. Don't give the anonymous poster <img> an empty 'src' attribute if we don't have a 'poster' attribute. r=cpearce
☠☠ backed out by 65bdf48eb148 ☠ ☠
authorRobert O'Callahan <robert@ocallahan.org>
Wed, 04 Dec 2013 14:06:16 +1300
changeset 173461 8b51998bca5bca1e5b413ae27407562cd9e583ac
parent 173460 21b263335af58ee73f156340039b37d6fd5d27d0
child 173462 dda95b5cb52869b40812cd22b0dc225e821da662
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs938772
milestone28.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 938772. Don't give the anonymous poster <img> an empty 'src' attribute if we don't have a 'poster' attribute. r=cpearce
layout/generic/nsVideoFrame.cpp
layout/generic/nsVideoFrame.h
layout/generic/test/mochitest.ini
layout/generic/test/test_bug938772.html
layout/inspector/inCSSValueSearch.cpp
layout/inspector/inCSSValueSearch.h
layout/inspector/inDOMUtils.cpp
layout/inspector/inDOMUtils.h
layout/inspector/inDOMView.cpp
layout/inspector/inDOMView.h
layout/inspector/inDeepTreeWalker.cpp
layout/inspector/inDeepTreeWalker.h
layout/inspector/inFlasher.cpp
layout/inspector/inFlasher.h
layout/inspector/inICSSValueSearch.idl
layout/inspector/inIDOMUtils.idl
layout/inspector/inIDOMView.idl
layout/inspector/inIDeepTreeWalker.idl
layout/inspector/inIFlasher.idl
layout/inspector/inISearchObserver.idl
layout/inspector/inISearchProcess.idl
layout/inspector/inLayoutUtils.cpp
layout/inspector/inLayoutUtils.h
layout/inspector/inSearchLoop.cpp
layout/inspector/inSearchLoop.h
layout/inspector/moz.build
layout/inspector/nsFontFace.cpp
layout/inspector/nsFontFace.h
layout/inspector/nsFontFaceList.cpp
layout/inspector/nsFontFaceList.h
layout/inspector/nsIDOMFontFace.idl
layout/inspector/nsIDOMFontFaceList.idl
layout/xul/crashtests/131008-1.xul
layout/xul/crashtests/137216-1.xul
layout/xul/crashtests/140218-1.xml
layout/xul/crashtests/151826-1.xul
layout/xul/crashtests/168724-1.xul
layout/xul/crashtests/189814-1.xul
layout/xul/crashtests/237787-1.xul
layout/xul/crashtests/265161-1.xul
layout/xul/crashtests/289410-1.xul
layout/xul/crashtests/291702-1.xul
layout/xul/crashtests/291702-2.xul
layout/xul/crashtests/291702-3.xul
layout/xul/crashtests/294371-1.xul
layout/xul/crashtests/311457-1.html
layout/xul/crashtests/321056-1.xhtml
layout/xul/crashtests/322786-1.xul
layout/xul/crashtests/325377.xul
layout/xul/crashtests/326834-1-inner.xul
layout/xul/crashtests/326834-1.html
layout/xul/crashtests/326879-1.xul
layout/xul/crashtests/327776-1.xul
layout/xul/crashtests/328135-1.xul
layout/xul/crashtests/329327-1.xul
layout/xul/crashtests/329407-1.xml
layout/xul/crashtests/329477-1.xhtml
layout/xul/crashtests/336962-1.xul
layout/xul/crashtests/344228-1.xul
layout/xul/crashtests/346083-1.xul
layout/xul/crashtests/346281-1.xul
layout/xul/crashtests/350460.xul
layout/xul/crashtests/360642-1.xul
layout/xul/crashtests/365151.xul
layout/xul/crashtests/366112-1.xul
layout/xul/crashtests/369942-1.xhtml
layout/xul/crashtests/374102-1.xul
layout/xul/crashtests/376137-1.html
layout/xul/crashtests/376137-2.html
layout/xul/crashtests/377592-1.svg
layout/xul/crashtests/381862.html
layout/xul/crashtests/382746-1.xul
layout/xul/crashtests/382899-1.xul
layout/xul/crashtests/383236-1.xul
layout/xul/crashtests/384037-1.xhtml
layout/xul/crashtests/384105-1-inner.xul
layout/xul/crashtests/384105-1.html
layout/xul/crashtests/384491-1.xhtml
layout/xul/crashtests/384871-1-inner.xul
layout/xul/crashtests/384871-1.html
layout/xul/crashtests/387033-1.xhtml
layout/xul/crashtests/387080-1.xul
layout/xul/crashtests/391974-1-inner.xul
layout/xul/crashtests/391974-1.html
layout/xul/crashtests/394120-1.xhtml
layout/xul/crashtests/397293.xhtml
layout/xul/crashtests/397304-1.html
layout/xul/crashtests/398326-1.xhtml
layout/xul/crashtests/399013.xul
layout/xul/crashtests/400779-1.xhtml
layout/xul/crashtests/402912-1.xhtml
layout/xul/crashtests/408904-1.xul
layout/xul/crashtests/412479-1.xhtml
layout/xul/crashtests/415394-1.xhtml
layout/xul/crashtests/420424-1.xul
layout/xul/crashtests/430356-1.xhtml
layout/xul/crashtests/431738.xhtml
layout/xul/crashtests/432058-1.xul
layout/xul/crashtests/432068-1.xul
layout/xul/crashtests/432068-2.xul
layout/xul/crashtests/433296-1.xul
layout/xul/crashtests/433429.xul
layout/xul/crashtests/434458-1.xul
layout/xul/crashtests/452185.html
layout/xul/crashtests/452185.xml
layout/xul/crashtests/460900-1.xul
layout/xul/crashtests/464149-1.xul
layout/xul/crashtests/464407-1.xhtml
layout/xul/crashtests/467080.xul
layout/xul/crashtests/467481-1.xul
layout/xul/crashtests/470063-1.html
layout/xul/crashtests/470272.html
layout/xul/crashtests/472189.xul
layout/xul/crashtests/475133.html
layout/xul/crashtests/488210-1.xhtml
layout/xul/crashtests/495728-1.xul
layout/xul/crashtests/508927-1.xul
layout/xul/crashtests/508927-2.xul
layout/xul/crashtests/514300-1.xul
layout/xul/crashtests/536931-1.xhtml
layout/xul/crashtests/538308-1.xul
layout/xul/crashtests/557174-1.xml
layout/xul/crashtests/564705-1.xul
layout/xul/crashtests/583957-1.html
layout/xul/crashtests/crashtests.list
layout/xul/crashtests/menulist-focused.xhtml
layout/xul/moz.build
layout/xul/nsBox.cpp
layout/xul/nsBox.h
layout/xul/nsBoxFrame.cpp
layout/xul/nsBoxFrame.h
layout/xul/nsBoxLayout.cpp
layout/xul/nsBoxLayout.h
layout/xul/nsBoxLayoutState.cpp
layout/xul/nsBoxLayoutState.h
layout/xul/nsBoxObject.cpp
layout/xul/nsBoxObject.h
layout/xul/nsButtonBoxFrame.cpp
layout/xul/nsButtonBoxFrame.h
layout/xul/nsContainerBoxObject.cpp
layout/xul/nsDeckFrame.cpp
layout/xul/nsDeckFrame.h
layout/xul/nsDocElementBoxFrame.cpp
layout/xul/nsGroupBoxFrame.cpp
layout/xul/nsIBoxObject.idl
layout/xul/nsIBrowserBoxObject.idl
layout/xul/nsIContainerBoxObject.idl
layout/xul/nsIEditorBoxObject.idl
layout/xul/nsIIFrameBoxObject.idl
layout/xul/nsIListBoxObject.idl
layout/xul/nsIMenuBoxObject.idl
layout/xul/nsIPopupBoxObject.idl
layout/xul/nsIRootBox.h
layout/xul/nsIScrollBoxObject.idl
layout/xul/nsIScrollbarMediator.h
layout/xul/nsISliderListener.idl
layout/xul/nsImageBoxFrame.cpp
layout/xul/nsImageBoxFrame.h
layout/xul/nsLeafBoxFrame.cpp
layout/xul/nsLeafBoxFrame.h
layout/xul/nsListBoxBodyFrame.cpp
layout/xul/nsListBoxBodyFrame.h
layout/xul/nsListBoxLayout.cpp
layout/xul/nsListBoxLayout.h
layout/xul/nsListBoxObject.cpp
layout/xul/nsListItemFrame.cpp
layout/xul/nsListItemFrame.h
layout/xul/nsMenuBarFrame.cpp
layout/xul/nsMenuBarFrame.h
layout/xul/nsMenuBarListener.cpp
layout/xul/nsMenuBarListener.h
layout/xul/nsMenuBoxObject.cpp
layout/xul/nsMenuFrame.cpp
layout/xul/nsMenuFrame.h
layout/xul/nsMenuParent.h
layout/xul/nsMenuPopupFrame.cpp
layout/xul/nsMenuPopupFrame.h
layout/xul/nsPIBoxObject.h
layout/xul/nsPIListBoxObject.h
layout/xul/nsPopupBoxObject.cpp
layout/xul/nsPopupSetFrame.cpp
layout/xul/nsPopupSetFrame.h
layout/xul/nsProgressMeterFrame.cpp
layout/xul/nsProgressMeterFrame.h
layout/xul/nsRepeatService.cpp
layout/xul/nsRepeatService.h
layout/xul/nsResizerFrame.cpp
layout/xul/nsResizerFrame.h
layout/xul/nsRootBoxFrame.cpp
layout/xul/nsScrollBoxFrame.cpp
layout/xul/nsScrollBoxObject.cpp
layout/xul/nsScrollbarButtonFrame.cpp
layout/xul/nsScrollbarButtonFrame.h
layout/xul/nsScrollbarFrame.cpp
layout/xul/nsScrollbarFrame.h
layout/xul/nsSliderFrame.cpp
layout/xul/nsSliderFrame.h
layout/xul/nsSplitterFrame.cpp
layout/xul/nsSplitterFrame.h
layout/xul/nsSprocketLayout.cpp
layout/xul/nsSprocketLayout.h
layout/xul/nsStackFrame.cpp
layout/xul/nsStackFrame.h
layout/xul/nsStackLayout.cpp
layout/xul/nsStackLayout.h
layout/xul/nsTextBoxFrame.cpp
layout/xul/nsTextBoxFrame.h
layout/xul/nsTitleBarFrame.cpp
layout/xul/nsTitleBarFrame.h
layout/xul/nsXULLabelFrame.cpp
layout/xul/nsXULLabelFrame.h
layout/xul/nsXULPopupManager.cpp
layout/xul/nsXULPopupManager.h
layout/xul/nsXULTooltipListener.cpp
layout/xul/nsXULTooltipListener.h
layout/xul/reftest/image-scaling-min-height-1-ref.xul
layout/xul/reftest/image-scaling-min-height-1.xul
layout/xul/reftest/image-size-ref.xul
layout/xul/reftest/image-size.xul
layout/xul/reftest/image4x3.png
layout/xul/reftest/popup-explicit-size-ref.xul
layout/xul/reftest/popup-explicit-size.xul
layout/xul/reftest/reftest.list
layout/xul/reftest/textbox-multiline-noresize.xul
layout/xul/reftest/textbox-multiline-ref.xul
layout/xul/reftest/textbox-multiline-resize.xul
layout/xul/test/test_bug381167.xhtml
layout/xul/test/test_bug393970.xul
layout/xul/test/test_bug477754.xul
layout/xul/test/test_bug511075.html
layout/xul/test/test_popupSizeTo.xul
layout/xul/test/test_resizer.xul
layout/xul/test/test_resizer_incontent.xul
layout/xul/test/test_splitter.xul
layout/xul/test/test_stack.xul
layout/xul/test/test_windowminmaxsize.xul
layout/xul/test/window_resizer.xul
layout/xul/test/window_resizer_element.xul
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -87,18 +87,17 @@ nsVideoFrame::CreateAnonymousContent(nsT
     // as the image is native anonymous, and so can't be reframed (currently).
     nsCOMPtr<nsIImageLoadingContent> imgContent = do_QueryInterface(mPosterImage);
     NS_ENSURE_TRUE(imgContent, NS_ERROR_FAILURE);
 
     imgContent->ForceImageState(true, 0);
     // And now have it update its internal state
     element->UpdateState(false);
 
-    nsresult res = UpdatePosterSource(false);
-    NS_ENSURE_SUCCESS(res,res);
+    UpdatePosterSource(false);
 
     if (!aElements.AppendElement(mPosterImage))
       return NS_ERROR_OUT_OF_MEMORY;
 
     // Set up the caption overlay div for showing any TextTrack data
     nodeInfo = nodeInfoManager->GetNodeInfo(nsGkAtoms::div,
                                             nullptr,
                                             kNameSpaceID_XHTML,
@@ -587,40 +586,41 @@ nsVideoFrame::GetVideoIntrinsicSize(nsRe
       return imgsize;
     }
   }
 
   return nsSize(nsPresContext::CSSPixelsToAppUnits(size.width),
                 nsPresContext::CSSPixelsToAppUnits(size.height));
 }
 
-nsresult
+void
 nsVideoFrame::UpdatePosterSource(bool aNotify)
 {
   NS_ASSERTION(HasVideoElement(), "Only call this on <video> elements.");
   HTMLVideoElement* element = static_cast<HTMLVideoElement*>(GetContent());
 
-  nsAutoString posterStr;
-  element->GetPoster(posterStr);
-  nsresult res = mPosterImage->SetAttr(kNameSpaceID_None,
-                                       nsGkAtoms::src,
-                                       posterStr,
-                                       aNotify);
-  NS_ENSURE_SUCCESS(res,res);
-  return NS_OK;
+  if (element->HasAttr(kNameSpaceID_None, nsGkAtoms::poster)) {
+    nsAutoString posterStr;
+    element->GetPoster(posterStr);
+    mPosterImage->SetAttr(kNameSpaceID_None,
+                          nsGkAtoms::src,
+                          posterStr,
+                          aNotify);
+  } else {
+    mPosterImage->UnsetAttr(kNameSpaceID_None, nsGkAtoms::poster, aNotify);
+  }
 }
 
 NS_IMETHODIMP
 nsVideoFrame::AttributeChanged(int32_t aNameSpaceID,
                                nsIAtom* aAttribute,
                                int32_t aModType)
 {
   if (aAttribute == nsGkAtoms::poster && HasVideoElement()) {
-    nsresult res = UpdatePosterSource(true);
-    NS_ENSURE_SUCCESS(res,res);
+    UpdatePosterSource(true);
   }
   return nsContainerFrame::AttributeChanged(aNameSpaceID,
                                             aAttribute,
                                             aModType);
 }
 
 bool nsVideoFrame::HasVideoElement() {
   nsCOMPtr<nsIDOMHTMLVideoElement> videoDomElement = do_QueryInterface(mContent);
--- a/layout/generic/nsVideoFrame.h
+++ b/layout/generic/nsVideoFrame.h
@@ -107,17 +107,17 @@ protected:
   // Returns true if there is video data to render. Can return false
   // when we're the frame for an audio element, or we've created a video
   // element for a media which is audio-only.
   bool HasVideoData();
 
   // Sets the mPosterImage's src attribute to be the video's poster attribute,
   // if we're the frame for a video element. Only call on frames for video
   // elements, not for frames for audio elements.
-  nsresult UpdatePosterSource(bool aNotify);
+  void UpdatePosterSource(bool aNotify);
 
   virtual ~nsVideoFrame();
 
   nsMargin mBorderPadding;
 
   // Anonymous child which is bound via XBL to the video controls.
   nsCOMPtr<nsIContent> mVideoControls;
 
--- a/layout/generic/test/mochitest.ini
+++ b/layout/generic/test/mochitest.ini
@@ -74,16 +74,17 @@ support-files = bug633762_iframe.html
 [test_bug735641.html]
 [test_bug748961.html]
 [test_bug784410.html]
 [test_bug785324.html]
 [test_bug791616.html]
 [test_bug831780.html]
 [test_bug841361.html]
 [test_bug904810.html]
+[test_bug938772.html]
 [test_contained_plugin_transplant.html]
 [test_image_selection.html]
 [test_image_selection_2.html]
 [test_invalidate_during_plugin_paint.html]
 [test_movement_by_characters.html]
 [test_movement_by_words.html]
 # Disable the caret movement by word test on Linux because the shortcut keys
 # are defined in system level.  So, it depends on the environment.
new file mode 100644
--- /dev/null
+++ b/layout/generic/test/test_bug938772.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=938772
+-->
+<title>Test for Bug 938772</title>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" href="/tests/SimpleTest/test.css">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=938772">Mozilla Bug 938772</a>
+<p id="display"></p>
+<iframe id="i"
+        src="data:text/html,<base href='http://basetag/basetag'><video id='v' onerror='v.failed=true'></video>"></iframe>
+<pre id="test">
+<script>
+SimpleTest.waitForExplicitFinish();
+
+i.onload = function() {
+  ok(!i.contentDocument.getElementById("v").failed,
+     "Check whether an error was reported");
+  SimpleTest.finish();
+};
+</script>
+