Bug 595337 - Crash [@ nsTextEditorState::InitializeKeyboardEventListeners] on print preview close with iframe, position:fixed and input r,a=roc
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 13 Sep 2010 16:36:43 -0400
changeset 53793 d668a9be7bd4c196d97e25f72d0c5647fcbbdf08
parent 53792 a6b06ebcbae2ee9c0bb8b29095aed74a0c5ad73f
child 53794 e9fbcd30350b33419e6e07520bb77810f7c52d3e
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs595337
milestone2.0b7pre
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 595337 - Crash [@ nsTextEditorState::InitializeKeyboardEventListeners] on print preview close with iframe, position:fixed and input r,a=roc
layout/base/tests/chrome/printpreview_helper.xul
layout/forms/nsTextControlFrame.cpp
--- a/layout/base/tests/chrome/printpreview_helper.xul
+++ b/layout/base/tests/chrome/printpreview_helper.xul
@@ -213,16 +213,31 @@ function runTest4() {
   window.frames[0].document.body.innerHTML =
     "<iframe style='display: none;' src='data:text/html,<iframe>'></iframe>";
   setTimeout(runTest4end, 500);
 }
 
 function runTest4end() {
   printpreview();
   exitprintpreview();
+
+  setTimeout(runTest5, 0);
+}
+
+// This is a crash test for bug 595337
+function runTest5() {
+  window.frames[0].document.body.innerHTML =
+    '<iframe style="position: fixed; visibility: hidden; bottom: 10em;"></iframe>' +
+    '<input contenteditable="true" style="display: table; page-break-before: left; width: 10000px;">';
+  setTimeout(runTest5end, 500);
+}
+
+function runTest5end() {
+  printpreview();
+  exitprintpreview();
   SimpleTest.finish();
   window.close();
 }
 
 ]]></script>
 <table style="border: 1px solid black;" xmlns="http://www.w3.org/1999/xhtml">
 <tr><th>Print preview canvas 1</th><th>Print preview canvas 2</th></tr>
 <tr>
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -1348,21 +1348,21 @@ nsTextControlFrame::SetInitialChildList(
 
   nsIFrame* first = GetFirstChild(nsnull);
 
   // Mark the scroll frame as being a reflow root. This will allow
   // incremental reflows to be initiated at the scroll frame, rather
   // than descending from the root frame of the frame hierarchy.
   if (first) {
     first->AddStateBits(NS_FRAME_REFLOW_ROOT);
+
+    nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
+    NS_ASSERTION(txtCtrl, "Content not a text control element");
+    txtCtrl->InitializeKeyboardEventListeners();
   }
-
-  nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
-  NS_ASSERTION(txtCtrl, "Content not a text control element");
-  txtCtrl->InitializeKeyboardEventListeners();
   return rv;
 }
 
 PRBool
 nsTextControlFrame::IsScrollable() const
 {
   return !IsSingleLineTextControl();
 }