Closed Bug 209037 Opened 21 years ago Closed 21 years ago

Bookmarklet "javascript:window.find()" is broken.

Categories

(SeaMonkey :: UI Design, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: PierreDeKat, Assigned: neil)

References

()

Details

(Keywords: fixed1.8)

Attachments

(3 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030529
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030529

Ref: http://bugzilla.mozilla.org/show_bug.cgi?id=9550
Ref: search toolkit.jar for "window.find()"

At one time, a method was implemented for calling up Mozilla's "Find in this
Page" dialog via a bookmarklet "javascript:window.find()" but that method no
longer appears to work. The dialog is called up, but Mozilla makes no attempt to
actually search for the text that is entered into the dialog box.

Reproducible: Always

Steps to Reproduce:
1. Create bookmarklet "javascript:window.find()"
2. Open a webpage containing text
3. Launch said bookmark
4. Enter text into "Find in this Page" dialog box
5. Click Find

Actual Results:  
Mozilla makes no effort to search document for text entered into "Find in this
Page" dialog box.

Expected Results:  
Mozilla should have searched the document for the text entered into the "Find in
this Page" dialog box.

A variety of other bookmarklets -- including "javascript:void(find())" and
"javascript:(function(){find();})()" -- work similarly, pulling up the FITP
dialog, only to have Mozilla ignore the requested search.
Sounds like a focus problem to me....  The content area does not have focus, so
the find dialog gets hooked up to nothing useful  (my guess).
Using the JS console to force focus with
top.getTopWin().content.focus();top.getTopWin().content.find(); also fails.
I was just noticing that I may have quoted the script differently than what I
was using at the time. I think I was actually trying
"javascript:void(window.find())" when I came to the conclusion that there must
be a problem somewhere.

Interestingly, "javascript:window.find()" works flawlessly in Netscape 4.79, as
does the simpler "javascript:find()", as does "javascript:void(find())", as does
"javascript:(function(){find();})()". So there are at least four different ways
of accomplishing the task in NN4, but none that work in Mozilla.
I can't get window.find() to work within web page as well. moz2004013108/win2k
Status: UNCONFIRMED → NEW
Component: Bookmarks → DOM: Level 0
Ever confirmed: true
Assignee: p_ch → general
QA Contact: chrispetersen → ian
Attached file Testcase
This shows that this only happens when the find dialog is involved.
window.find('some text') works fine.
This is not a DOM bug. Looks like a regression from bug 127589.
Component: DOM: Level 0 → XP Apps
Assignee: general → jag
QA Contact: ian → pawyskoczka
Attached patch Proposed patchSplinter Review
The way that the find dialog was testing for how it was opened caused this:
JavaScript error:
chrome://global/content/finddialog.js line 91: invalid 'instanceof' operand
window.opener.nsFindInstData
Assignee: jag → neil.parkwaycc.co.uk
Status: NEW → ASSIGNED
Attachment #140368 - Flags: superreview?(jag)
Attachment #140368 - Flags: review?(timeless)
Attachment #140368 - Flags: review?(timeless) → review+
Comment on attachment 140368 [details] [diff] [review]
Proposed patch

sr=jag.
Attachment #140368 - Flags: superreview?(jag) → superreview+
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Product: Core → Mozilla Application Suite
This was never fixed for Firefox. The bookmarklet case is an instance where the
old find dialog is still used.
Attachment #196181 - Flags: review?(mconnor)
Attachment #196181 - Flags: approval1.8b5?
Comment on attachment 196181 [details] [diff] [review]
patch for Firefox

please don't request approval until you've got appropriate reviews.
Attachment #196181 - Flags: approval1.8b5?
Attachment #196181 - Flags: review?(mconnor) → review+
Whiteboard: [checkin needed]
Comment on attachment 196181 [details] [diff] [review]
patch for Firefox

This should be safe, since this patch is already since very long in Seamonkey.
Attachment #196181 - Flags: approval1.8b5?
Trunk:
mozilla/toolkit/content/finddialog.js; new revision: 1.12;
Whiteboard: [checkin needed]
Comment on attachment 196181 [details] [diff] [review]
patch for Firefox

Per bug meeting - approved for 1.8b5 branch.
Attachment #196181 - Flags: approval1.8b5? → approval1.8b5+
1.8 Branch:
mozilla/toolkit/content/finddialog.js; new revision: 1.11.10.1;
Keywords: fixed1.8
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: