Bug 1423990 - Follow-up for conditionally compiled code for Thunderbird. r=smaug
authorJorg K <jorgk@jorgk.com>
Tue, 26 Dec 2017 02:58:00 +0200
changeset 714624 ee9a4618a978c3ff9e7e139482ea041d46724f61
parent 714594 01cbfc6c625f669383adc16e899d6690cde63484
child 714625 db45ed3a43eba86e66236baf132b929770f84b4a
child 714655 c174adc1b48b2fd6ed11079437bfaafe82bf50a9
push id93978
push userbmo:bpostelnicu@mozilla.com
push dateWed, 27 Dec 2017 11:35:02 +0000
reviewerssmaug
bugs1423990
milestone59.0a1
Bug 1423990 - Follow-up for conditionally compiled code for Thunderbird. r=smaug
dom/base/nsDocumentEncoder.cpp
--- a/dom/base/nsDocumentEncoder.cpp
+++ b/dom/base/nsDocumentEncoder.cpp
@@ -1404,17 +1404,18 @@ nsHTMLCopyEncoder::SetSelection(nsISelec
       // The proper fix would be this:
       // For case 1:
       // Communicate the fact that HTML is required to EncodeToString(),
       // bug 1141786.
       // For case 2:
       // Wait for Firefox to get fixed to detect pre-formatting correctly,
       // bug 1174452.
       nsAutoString styleVal;
-      if (selContent->GetAttr(kNameSpaceID_None, nsGkAtoms::style, styleVal) &&
+      if (selContent->IsElement() &&
+          selContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::style, styleVal) &&
           styleVal.Find(NS_LITERAL_STRING("pre-wrap")) != kNotFound) {
         mIsTextWidget = true;
         break;
       }
     }
 #endif
   }