Open
Bug 488427
Opened 16 years ago
Updated 2 years ago
nsIFind needs to call FlushPendingNotifications
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
NEW
People
(Reporter: Honza, Unassigned)
Details
(Keywords: good-first-bug, helpwanted, student-project)
Attachments
(3 files)
1.59 KB,
text/html
|
Details | |
2.96 KB,
patch
|
Details | Diff | Splinter Review | |
3.03 KB,
text/html
|
Details |
When nsIFind is used to search also within dynamically inserted content, the Find method always returns null (even if the searched text is there). Here is a scenario that describes the problem. #1) The page, displays a list of expandable items. If an item is expanded, its body is dynamically inserted into the page (just another piece of HTML). #2) The search should include current HTML on the page and also all bodies that don't have to exist on the page (typically all items are collapsed). #3) If the search algorithm, finds out that the specified text is within a body that is *not* currently displayed, the body (HTML) is dynamically inserted (visually, the item is automatically expanded). #4) The new created DOM is immediately used to create a DOM range and passed to range-finder (nsIFind). But it always returns null even if the text is there (I can see it on the page)... If the step #4 is executed asynchronously, it works and the finder returns proper range (nsIDOMRange). The possible workaround is to read "document.body.offsetWidth;" on the document in question between inserting the new DOM nodes and making the nsIFind call According to the preceding discussion here: http://groups.google.com/group/mozilla.dev.platform/browse_thread/thread/02ddb42bd58af96c?hl=en# ...this means that nsIFind just needs to call FlushPendingNotifications in the appropriate methods.
Reporter | ||
Updated•16 years ago
|
Summary: nsIFind needs to call Flush PendingNotifications → nsIFind needs to call FlushPendingNotifications
Updated•16 years ago
|
Version: unspecified → Trunk
Updated•16 years ago
|
Comment 1•15 years ago
|
||
I'd love to see this for 1.9.2, but I don't think I'd hold the release for it.
Flags: wanted1.9.2+
Flags: blocking1.9.2?
Flags: blocking1.9.2-
Comment 2•15 years ago
|
||
I'm having trouble reproducing this bug. I've attached a mochitest testcase which works for me. Could you have a look and let me know if this is different from what you're doing?
Assignee: nobody → jlebar
Status: NEW → ASSIGNED
Comment 3•15 years ago
|
||
I can't seem to reproduce the bug, This test passes both with and without the patch. Can you check if this patch helps?
Comment 4•15 years ago
|
||
Today is code freeze for 1.9.2, so I'm going to go ahead and mark this one as worksforme. If anyone can come up with a failing testcase or suggest how to change mine or David's so they fail, we can re-open this bug.
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → WORKSFORME
Comment 5•13 years ago
|
||
This bug still bites me in Firefox 7.0.1. My extension, Googlebar Lite, uses the nsIFind interface to perform search term highlighting. If I don't use the workaround listed in the original poster's text, the nsIFind interface will skip to the end of the current DOM element, and go on to the next sibling element. For example, assume that I have two paragraphs on a page, both of which have the word "Firefox" listed several times in each. Without the workaround, here's what happens: 1. The interface finds the first result in paragraph 1. 2. I surround said result with a styled span element. 3. I continue searching by calling nsIFind::Find() again. The second time around the loop, it has apparently skipped to paragraph 2 because the DOM has changed beneath its feet. If I can find some time, I'll try to cook up a new test case. With my extension, I was able to consistently reproduce this before finding this workaround.
Comment 6•13 years ago
|
||
This new test case illustrates the reported problem with nsIFind in Firefox. It takes a different approach from the previous test case, but illustrates what I believe is the same problem.
Updated•13 years ago
|
Attachment #565545 -
Attachment mime type: text/plain → text/html
Comment 7•13 years ago
|
||
I cannot seem to get the test case to work in browser now that it's posted here on Bugzilla, but it worked for me when saved as a local file on my system (using Firefox 7.0.1 on Windows XP). This is the first time I've posted a test case, so I may be missing something obvious. When I attempt to run it here on Bugzilla, I get the following error in my console: Error: A script from "https://bug488427.bugzilla.mozilla.org" was denied UniversalXPConnect privileges. Source file: https://bug488427.bugzilla.mozilla.org/attachment.cgi?id=565545 Line: 9 Long story short, if it doesn't work for you, save it locally and try it.
Comment 8•13 years ago
|
||
Yeah, untrusted sites can't prompt for expanded privileges.
Updated•13 years ago
|
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Assignee | ||
Updated•12 years ago
|
Component: DOM: Traversal-Range → DOM: Core & HTML
Comment 9•11 years ago
|
||
I encountered the same behaviour in FF22, developing an extension similar to Jonah Bishop. The workaround also solved the problem for me. Tried to reproduce it today in FF23 but couldn't, so either I've screwed up or something must have changed.
Updated•5 years ago
|
Keywords: good-first-bug
Whiteboard: [good first bug]
Comment 10•4 years ago
|
||
This good-first-bug hasn't had any activity for 6 months, it is automatically unassigned.
For more information, please visit auto_nag documentation.
Assignee: justin.lebar+bug → nobody
Status: REOPENED → NEW
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•