Closed Bug 75291 Opened 25 years ago Closed 25 years ago

Infinite Loop when switching from EditSource back to Normal Mode

Categories

(Core :: DOM: Editor, defect, P1)

x86
Windows NT
defect

Tracking

()

VERIFIED FIXED
mozilla0.9

People

(Reporter: kinmoz, Assigned: mjudge)

References

Details

Attachments

(1 file)

I'm seeing an infinite loop in string code when going from Normal edit mode, to Edit Source mode, and back to Normal edit mode. To reproduce: 1. Start a blank composer window. 2. Make sure the View->Toolbars->Edit Mode Toolbar menu item is checked. 3. Type anything. 4. Hit the "<HTML> Source" tab at the bottom of the window. 5. Hit the "Normal" tab at the bottom of the window. You should now hit an assertion and enter an infinite loop. The infinite loop is happening in OutputIterator&copy_string(). When it happens, you will see the following assertion thrown from copy_string(): NS_ASSERTION(count_copied > 0, "|copy_string| will never terminate"); The infinite loop is being triggered by the following line in nsHTMLEditor::RebuildDocumentFromSource(): nsAutoString bodyTag(Substring(beginbody,endclosebody));//<bodyXXXX > Here's the stack that leads up to the inifinte loop: NTDLL! 77f762e8() nsDebug::Assertion(const char * 0x100d9f8c ??_C@_0CD@LMHB@?$HMcopy_string?$HM?5will?5never?5termina@, const char * 0x100d9fb8 ??_C@_0BB@HMLA@count_copied?5?$DO?50?$AA@, const char * 0x100d9fcc ??_C@_0CB@FPEE@?4?4?2?4?4?2dist?2include?2nsAlgorithm?4h@, int 77) line 286 + 13 bytes copy_string(nsReadingIterator<unsigned short> & {...}, const nsReadingIterator<unsigned short> & {...}, CalculateLength<unsigned short> & {...}) line 77 + 28 bytes Distance_Impl(const nsReadingIterator<unsigned short> & {...}, const nsReadingIterator<unsigned short> & {...}) line 91 + 17 bytes Distance(const nsReadingIterator<unsigned short> & {...}, const nsReadingIterator<unsigned short> & {...}) line 99 + 13 bytes nsPromiseSubstring::nsPromiseSubstring(const nsReadingIterator<unsigned short> & {...}, const nsReadingIterator<unsigned short> & {...}) line 74 + 13 bytes Substring(const nsReadingIterator<unsigned short> & {...}, const nsReadingIterator<unsigned short> & {...}) line 178 + 17 bytes nsHTMLEditor::RebuildDocumentFromSource(nsHTMLEditor * const 0x06da32f8, const nsAString & {...}) line 1664 + 20 bytes nsEditorShell::RebuildDocumentFromSource(nsEditorShell * const 0x06d480f0, const unsigned short * 0x07485210) line 2681 + 42 bytes XPTC_InvokeByIndex(nsISupports * 0x06d480f0, unsigned int 54, unsigned int 1, nsXPTCVariant * 0x0012d87c) line 139 nsXPCWrappedNativeClass::CallWrappedMethod(JSContext * 0x0557d4b0, nsXPCWrappedNative * 0x06dc5de0, const XPCNativeMemberDescriptor * 0x0102525c, nsXPCWrappedNativeClass::CallMode CALL_METHOD, unsigned int 1, long * 0x0105ad60, long * 0x0012da64) line 934 + 42 bytes WrappedNative_CallMethod(JSContext * 0x0557d4b0, JSObject * 0x00fcafa0, unsigned int 1, long * 0x0105ad60, long * 0x0012da64) line 250 + 34 bytes js_Invoke(JSContext * 0x0557d4b0, unsigned int 1, unsigned int 0) line 786 + 23 bytes js_Interpret(JSContext * 0x0557d4b0, long * 0x0012e7e4) line 2679 + 15 bytes js_Invoke(JSContext * 0x0557d4b0, unsigned int 1, unsigned int 2) line 803 + 13 bytes js_InternalInvoke(JSContext * 0x0557d4b0, JSObject * 0x00fcabb8, long 17141376, unsigned int 0, unsigned int 1, long * 0x0012e97c, long * 0x0012e90c) line 875 + 20 bytes JS_CallFunctionValue(JSContext * 0x0557d4b0, JSObject * 0x00fcabb8, long 17141376, unsigned int 1, long * 0x0012e97c, long * 0x0012e90c) line 3340 + 31 bytes nsJSContext::CallEventHandler(nsJSContext * const 0x05124b80, void * 0x00fcabb8, void * 0x01058e80, unsigned int 1, void * 0x0012e97c, int * 0x0012e978, int 0) line 940 + 33 bytes nsJSEventListener::HandleEvent(nsIDOMEvent * 0x06d3d714) line 154 + 64 bytes nsEventListenerManager::HandleEventSubType(nsListenerStruct * 0x06c0e270, nsIDOMEvent * 0x06d3d714, nsIDOMEventTarget * 0x068bea58, unsigned int 8, unsigned int 7) line 920 + 19 bytes nsEventListenerManager::HandleEvent(nsIPresContext * 0x066d5ee0, nsEvent * 0x0012f268, nsIDOMEvent * * 0x0012f12c, nsIDOMEventTarget * 0x068bea58, unsigned int 7, nsEventStatus * 0x0012f2ac) line 1848 + 39 bytes nsXULElement::HandleDOMEvent(nsXULElement * const 0x068bea50, nsIPresContext * 0x066d5ee0, nsEvent * 0x0012f268, nsIDOMEvent * * 0x0012f12c, unsigned int 1, nsEventStatus * 0x0012f2ac) line 3671 PresShell::HandleDOMEventWithTarget(PresShell * const 0x062848b0, nsIContent * 0x068bea50, nsEvent * 0x0012f268, nsEventStatus * 0x0012f2ac) line 5172 + 39 bytes nsButtonBoxFrame::MouseClicked(nsIPresContext * 0x066d5ee0, nsGUIEvent * 0x0012f45c) line 181 nsButtonBoxFrame::HandleEvent(nsButtonBoxFrame * const 0x00fd4930, nsIPresContext * 0x066d5ee0, nsGUIEvent * 0x0012f45c, nsEventStatus * 0x0012f74c) line 128 PresShell::HandleEventInternal(nsEvent * 0x0012f45c, nsIView * 0x00000000, unsigned int 1, nsEventStatus * 0x0012f74c) line 5140 + 41 bytes PresShell::HandleEventWithTarget(PresShell * const 0x062848b0, nsEvent * 0x0012f45c, nsIFrame * 0x00fd4930, nsIContent * 0x068bea50, unsigned int 1, nsEventStatus * 0x0012f74c) line 5098 + 22 bytes nsEventStateManager::CheckForAndDispatchClick(nsEventStateManager * const 0x06ba2840, nsIPresContext * 0x066d5ee0, nsMouseEvent * 0x0012f858, nsEventStatus * 0x0012f74c) line 2291 + 61 bytes nsEventStateManager::PostHandleEvent(nsEventStateManager * const 0x06ba2848, nsIPresContext * 0x066d5ee0, nsEvent * 0x0012f858, nsIFrame * 0x00fd4930, nsEventStatus * 0x0012f74c, nsIView * 0x0669e940) line 1390 + 28 bytes PresShell::HandleEventInternal(nsEvent * 0x0012f858, nsIView * 0x0669e940, unsigned int 1, nsEventStatus * 0x0012f74c) line 5145 + 43 bytes PresShell::HandleEvent(PresShell * const 0x062848b4, nsIView * 0x0669e940, nsGUIEvent * 0x0012f858, nsEventStatus * 0x0012f74c, int 1, int & 1) line 5052 + 25 bytes nsView::HandleEvent(nsView * const 0x0669e940, nsGUIEvent * 0x0012f858, unsigned int 28, nsEventStatus * 0x0012f74c, int 1, int & 1) line 379 nsViewManager::DispatchEvent(nsViewManager * const 0x06697240, nsGUIEvent * 0x0012f858, nsEventStatus * 0x0012f74c) line 1996 HandleEvent(nsGUIEvent * 0x0012f858) line 68 nsWindow::DispatchEvent(nsWindow * const 0x066e6904, nsGUIEvent * 0x0012f858, nsEventStatus & nsEventStatus_eIgnore) line 695 + 10 bytes nsWindow::DispatchWindowEvent(nsGUIEvent * 0x0012f858) line 716 nsWindow::DispatchMouseEvent(unsigned int 301, nsPoint * 0x00000000) line 4018 + 21 bytes ChildWindow::DispatchMouseEvent(unsigned int 301, nsPoint * 0x00000000) line 4263 nsWindow::ProcessMessage(unsigned int 514, unsigned int 0, long 46071844, long * 0x0012fc10) line 3000 + 24 bytes nsWindow::WindowProc(HWND__ * 0x00080908, unsigned int 514, unsigned int 0, long 46071844) line 950 + 27 bytes
Marking as regression with milestone mozilla0.9.
Severity: normal → major
Keywords: regression
Priority: -- → P1
Target Milestone: --- → mozilla0.9
Note: I also removed the line "bodyTag.ToLowerCase();" This essentially fixes 0.9 bug 74039, although both that bug and inserting HTML source in general have a problem when "<body" is not already lowercase. Mike is working with Scott Collins on that issue -- we need case-insensitive versions of the new string methods.
Whiteboard: FIX IN HAND need sr=
*** Bug 75265 has been marked as a duplicate of this bug. ***
sr=sfraser
r=mjudge checked in.
Status: NEW → RESOLVED
Closed: 25 years ago
Keywords: regression
Resolution: --- → FIXED
Whiteboard: FIX IN HAND need sr=
verified using optimized linux build from today 8am.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: