Closed Bug 148713 Opened 23 years ago Closed 23 years ago

infinite loop in search/replace

Categories

(SeaMonkey :: UI Design, defect)

defect
Not set
major

Tracking

(Not tracked)

VERIFIED FIXED
mozilla1.0.1

People

(Reporter: mozeditor, Assigned: akkzilla)

References

Details

(Whiteboard: [ADT2 RTM] [ETA 07/01])

Attachments

(1 file, 1 obsolete file)

from #composer channel on mozilla irc: 5:45 PM: *** brantgurga (chatzilla@dialup-65.58.70.147.Dial1.Indianapolis1.Level3.net) has joined channel #composer 55:46 PM: brantgurga: Search and Replace has a bug 5:46 PM: brantgurga: Try replacing "test" with "this test" and click replace all. 5:46 PM: brantgurga: Recursive searching causes infinite loop.
Did I pick the correct component? cc'ing Akkana and Kin.
I'm not sure what the right component is, but this would probably be my bug. But I don't see it. What page were you editing? I tried just copying the text of this bug and pasting it into a composer page (so the word "test" appeared a couple of times), setting the caret near the beginning of the file, then replacing "test" with "this test" and clicking replace all. It did the replace, no infinite loop. On what version of mozilla did you see this? I tried on a branch release build and on a current trunk build.
Managed to reproduce this with today's branch. Steps: 1) Edit this bug in Composer 2) Hit Ctrl-F 3) Text to find is "test" and text to replace with is "test this" 4) Select wrap around and search backwards 5) Replace all Hangs with 100% cpu and eventually crashes.
Yup! I see it too. Taking the bug.
Assignee: sgehani → akkana
Target Milestone: --- → mozilla1.0.1
Fix coming, cc some possible reviewers, add ADT2 hoping there might be a chance to get this into MachV since it's a hang and it's not that unusual a case.
Status: NEW → ASSIGNED
Whiteboard: ADT2
Attached patch A fix. (obsolete) — Splinter Review
The code made the assumption that the inserted text would end up selected. In fact, the editor puts the selection after the inserted text, so we were finding it on the next iteration. (I thought I checked for that case, but I guess I only checked for it in the forward direction). The only solution I found was to save the selection by collapsing the found range before inserting, in the reverse direction. That doesn't work in the forward direction, though, apparently because of the direction that range gravity collapses the range after the selected contents disappear, so in the forward direction I kept the existing code. Seeking review -- Joe? Charley? Kathy?
Blocks: 145071
This file generated some JS strict warnings -- let's fix them as long as we're in here, since it's just a couple lines more. I've included fixes for all the warnings I could find.
Attachment #86734 - Attachment is obsolete: true
Comment on attachment 86744 [details] [diff] [review] Include strict warning fixes (bug 145071) r=brade
Attachment #86744 - Flags: review+
Comment on attachment 86744 [details] [diff] [review] Include strict warning fixes (bug 145071) sr=kin@netscape.com
Attachment #86744 - Flags: superreview+
Fixed on trunk. Adding adt1.0.1 keyword to request branch checkin, since this fixes a hang.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Keywords: adt1.0.1
Resolution: --- → FIXED
Whiteboard: ADT2 → [ADT2 RTM] [ETA 06/24]
In response to an ADT question: this patch does not involve any string changes.
Blocks: 143047
Keywords: nsbeta1nsbeta1+
VERIFIED Fixed on the trunk with 20020627 builds. Turns out this was the wrong component. reassigning, if there need be any follow-up the right QA can help you out.but in the meantime -to save time- this bug _is_ 'verified' on trunk builds.
Status: RESOLVED → VERIFIED
Component: Search → XP Apps: GUI Features
QA Contact: claudius
adt1.0.1+ (on ADT's behalf) approval for checkin to the 1.0 branch, pending drivers' approval. pls check this in asap, then add the "fixed1.0.1" keyword.
Keywords: adt1.0.1adt1.0.1+
Whiteboard: [ADT2 RTM] [ETA 06/24] → [ADT2 RTM] [ETA 07/01]
Attachment #86744 - Flags: approval+
please checkin to the 1.0.1 branch. once there, remove the "mozilla1.0.1+" keyword and add the "fixed1.0.1" keyword.
Fixed on the branch too.
verified on 1.0.1branch win2k build 8-23.
Product: Core → Mozilla Application Suite
Component: XP Apps: GUI Features → UI Design
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: