Back out 6d605438199c (bug 758589) for bug 759243
authorPhil Ringnalda <philringnalda@gmail.com>
Mon, 28 May 2012 22:44:57 -0700
changeset 95157 cf9f2ec3699237f32d69b82e6ba06c4156c3211f
parent 95156 8ad6067e90f7deeea99ae626b934790176c6cfb1
child 95158 8a8c0d8b1ac7996a5193a8fbbc0975681d42f374
push id9968
push userphilringnalda@gmail.com
push dateTue, 29 May 2012 05:49:26 +0000
treeherdermozilla-inbound@8a8c0d8b1ac7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs758589, 759243
milestone15.0a1
backs out6d605438199cf30d64ee530986668e182292f6b1
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
Back out 6d605438199c (bug 758589) for bug 759243
layout/generic/nsSelection.cpp
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -1088,21 +1088,20 @@ nsFrameSelection::MoveCaret(PRUint32    
 
 NS_IMETHODIMP
 nsTypedSelection::ToString(PRUnichar **aReturn)
 {
   if (!aReturn) {
     return NS_ERROR_NULL_POINTER;
   }
   // We need Flush_Style here to make sure frames have been created for
-  // the selected content.  Use mFrameSelection->GetShell() which returns
-  // null if the Selection has been disconnected (the shell is Destroyed).
-  nsCOMPtr<nsIPresShell> shell =
-    mFrameSelection ? mFrameSelection->GetShell() : nsnull;
-  if (!shell) {
+  // the selected content.
+  nsCOMPtr<nsIPresShell> shell;
+  nsresult rv = GetPresShell(getter_AddRefs(shell));
+  if (NS_FAILED(rv) || !shell) {
     *aReturn = ToNewUnicode(EmptyString());
     return NS_OK;
   }
   shell->FlushPendingNotifications(Flush_Style);
 
   return ToStringWithFormat("text/plain",
                             nsIDocumentEncoder::SkipInvisibleContent,
                             0, aReturn);