Bug 985303. Part 1: Assert that nsViews are only associated with a specific, limited set of frame types. r=dbaron
authorRobert O'Callahan <robert@ocallahan.org>
Thu, 03 Apr 2014 04:24:58 -0400
changeset 197031 7c7f680de70eafe0cf33680549dae83855af086e
parent 197030 93265ade3bc9b335fe47058dc2a0f3368e077109
child 197032 82f376050e58af01283cdaa4f7b8c1fabb074856
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs985303
milestone31.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 985303. Part 1: Assert that nsViews are only associated with a specific, limited set of frame types. r=dbaron
layout/generic/nsFrame.cpp
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -4473,16 +4473,27 @@ nsIFrame::GetViewExternal() const
 }
 
 nsresult
 nsIFrame::SetView(nsView* aView)
 {
   if (aView) {
     aView->SetFrame(this);
 
+#ifdef DEBUG
+    nsIAtom* frameType = GetType();
+    NS_ASSERTION(frameType == nsGkAtoms::scrollFrame ||
+                 frameType == nsGkAtoms::subDocumentFrame ||
+                 frameType == nsGkAtoms::listControlFrame ||
+                 frameType == nsGkAtoms::objectFrame ||
+                 frameType == nsGkAtoms::viewportFrame ||
+                 frameType == nsGkAtoms::menuPopupFrame,
+                 "Only specific frame types can have an nsView");
+#endif
+
     // Set a property on the frame
     Properties().Set(ViewProperty(), aView);
 
     // Set the frame state bit that says the frame has a view
     AddStateBits(NS_FRAME_HAS_VIEW);
 
     // Let all of the ancestors know they have a descendant with a view.
     for (nsIFrame* f = GetParent();