Find in this page: Phrase not found in visible (display:block) <script>, <head>
Categories
(Core :: Find Backend, defect, P5)
Tracking
()
People
(Reporter: sergeykish, Assigned: A-NEUN, Mentored)
References
(Blocks 1 open bug)
Details
(Keywords: good-first-bug, Whiteboard: [lang=c++])
Attachments
(2 files, 1 obsolete file)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0
Steps to reproduce:
I've displayed <title> and <script> with CSS
head, title,script, style { display: block }
And searched for text in these elements
Actual results:
"Phrase not found" in <title> and <script>.
Found in <p> and <style>.
Expected results:
It should highlight text that I search
Comment 1•5 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
Reporter | ||
Comment 2•5 years ago
|
||
Added <style> inside <head> (is not searchable).
Added colours to highlight structure
Updated•5 years ago
|
Comment 3•5 years ago
|
||
Resetting severity to default of --
.
Comment 4•5 years ago
|
||
The priority flag is not set for this bug.
:mikedeboer, could you have a look please?
For more information, please visit auto_nag documentation.
Reporter | ||
Comment 5•5 years ago
|
||
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0
Reproduced
Reporter | ||
Updated•5 years ago
|
Comment 6•5 years ago
|
||
This is the relevant check. I don't think script
should really be there, the IsDisplayedNode
check should be more than enough.
So the patch is trivial, and the test should be in test_find.html
and should be pretty easy to add too.
Assignee | ||
Comment 7•4 years ago
|
||
Updated•4 years ago
|
Assignee | ||
Comment 8•4 years ago
|
||
Finding within a visible <script> works now, but <head> still does not.
I also had some trouble creating a test for it, as </script>, even within a string, terminates the script running within the test.
Comment 9•4 years ago
|
||
(In reply to Tilden Windsor [:A-NEUN] from comment #8)
Finding within a visible <script> works now, but <head> still does not.
I also had some trouble creating a test for it, as </script>, even within a string, terminates the script running within the test.
You can use "</" + "script>"
or such instead :)
Assignee | ||
Comment 10•4 years ago
|
||
Thanks! I will try that now.
Reporter | ||
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Comment 11•4 years ago
|
||
Done.
Reporter | ||
Comment 12•4 years ago
|
||
(In reply to Tilden Windsor [:A-NEUN] from comment #8)
Finding within a visible <script> works now, but <head> still does not.
I also had some trouble creating a test for it, as </script>, even within a string, terminates the script running within the test.
https://searchfox.org/mozilla-central/rev/7fd1c1c34923ece7ad8c822bee062dd0491d64dc/toolkit/components/find/nsFind.cpp#336
https://searchfox.org/mozilla-central/source/accessible/xpcom/xpcAccessibleTextRange.cpp#36
I believe it has something to do with Range.
Just checked - Ctrl+A on the sample page - it selects only <body>
getSelection()
//Selection { anchorNode: body, anchorOffset: 0, focusNode: body, focusOffset: 5, isCollapsed: false, rangeCount: 1, type: "Range", caretBidiLevel: 0 }
Comment 13•4 years ago
|
||
That's not the right place in the code, but you're right that at least for find-in-page we do limit results to the <body>
: https://searchfox.org/mozilla-central/rev/9193635dca8cfdcb68f114306194ffc860456044/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp#748-750
I don't know why that code is really there. Seems to go back to when the findbar was first introduced. I think we should use GetRootElement
unconditionally. Probably separate patch though, with separate test.
Reporter | ||
Comment 14•4 years ago
|
||
That was quick
I've tracked only to mFind->Find() https://searchfox.org/mozilla-central/rev/9193635dca8cfdcb68f114306194ffc860456044/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp#451
So is Ctrl+A is coincidence?
Comment 15•4 years ago
|
||
Yes, Ctrl+A is probably a separate one. This one looks suspect.
Assignee | ||
Comment 16•4 years ago
|
||
Could you vouch for my request for tryserver access, as I think it would be useful for checking the tests remotely?
Comment 17•4 years ago
|
||
Ah, found it. Should be a separate bug probably.
Comment 18•4 years ago
|
||
(In reply to Tilden Windsor [:A-NEUN] from comment #16)
Could you vouch for my request for tryserver access, as I think it would be useful for checking the tests remotely?
Yes, happy to. Please ni? me in your request?
Comment 19•4 years ago
|
||
Ok, so there are a couple places that do make assumptions about HTML documents having body contents and so on. It'd be better to change all those in a different bug.
Assignee | ||
Comment 20•4 years ago
|
||
This is the request:
https://bugzilla.mozilla.org/show_bug.cgi?id=1638582
Reporter | ||
Comment 21•4 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #17)
Ah, found it. Should be a separate bug probably.
Thank you, https://bugzilla.mozilla.org/show_bug.cgi?id=1638969
Comment 22•4 years ago
|
||
Comment 23•4 years ago
|
||
bugherder |
Reporter | ||
Comment 24•4 years ago
|
||
Updated•4 years ago
|
Description
•