Bug 1165982 - Part 2: Validate an nsRange::SelectNode call in nsHTMLEditRules::Init. r=ehsan, a=sledru
authorNathan Froyd <froydnj@mozilla.com>
Tue, 19 May 2015 14:08:54 -0400
changeset 274768 670f70e5143ecad289b52a663c86f7b8464a2e6f
parent 274767 c49d7de6e59aabab6b246a7a2bee0529b9d703c8
child 274769 67cd704a1cfdabae472c11008a32ab74616601ff
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, sledru
bugs1165982
milestone40.0a2
Bug 1165982 - Part 2: Validate an nsRange::SelectNode call in nsHTMLEditRules::Init. r=ehsan, a=sledru
editor/libeditor/nsHTMLEditRules.cpp
--- a/editor/libeditor/nsHTMLEditRules.cpp
+++ b/editor/libeditor/nsHTMLEditRules.cpp
@@ -271,16 +271,17 @@ nsHTMLEditRules::Init(nsPlaintextEditor 
   nsAutoLockRulesSniffing lockIt((nsTextEditRules*)this);
   if (!mDocChangeRange) {
     mDocChangeRange = new nsRange(node);
   }
 
   if (node->IsElement()) {
     ErrorResult rv;
     mDocChangeRange->SelectNode(*node, rv);
+    NS_ENSURE_TRUE(!rv.Failed(), rv.StealNSResult());
     AdjustSpecialBreaks();
   }
 
   // add ourselves as a listener to edit actions
   res = mHTMLEditor->AddEditActionListener(this);
 
   return res;
 }