| Summary: | Web Inspector: Search results don't select source code line in fetch json | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Jeff Johnson <opendarwin> | ||||||
| Component: | Web Inspector | Assignee: | Nobody <webkit-unassigned> | ||||||
| Status: | NEW --- | ||||||||
| Severity: | Normal | CC: | greggy, inspector-bugzilla-changes, qianlangchen, webkit-bug-importer | ||||||
| Priority: | P2 | Keywords: | InRadar | ||||||
| Version: | Safari 17 | ||||||||
| Hardware: | Mac (Apple Silicon) | ||||||||
| OS: | All | ||||||||
| Attachments: |
|
||||||||
|
Description
Jeff Johnson
2023-11-01 07:32:31 PDT
Created attachment 468444 [details]
Screenshot showing selected text in main document html
This doesn't seem like a bug. (Well, the flash isn't ideal but I couldn't reproduce that) I don’t understand the request, here. What if there were more than one match in the resource? What should be highlighted then after step 4? (In reply to Greg Marriott from comment #3) > This doesn't seem like a bug. (Well, the flash isn't ideal but I couldn't > reproduce that) I don’t understand the request, here. What if there were > more than one match in the resource? What should be highlighted then after > step 4? I don't understand the confusion. In the search results, there's one line for each match in a file, so if there are multiple matches in a file, then there will be multiple items in the search results for that file, and you can click on each of those search results individually. That's just basic web inspector search functionality. I think Jeff is pointing out that our link to source code location from the search results are not working properly for the particular search result in that JSON file. This happens in general on that same website (https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow). Search any string from the JSON file `customizing_the_notarization_workflow.json`, such as "documentVersion" or ":true," and you'll find that search results always seems to link to the top of file rather than where the contents are. --- I believe the reason that this happens is because our file viewer automatically prettifies the contents when the file is first opened, where the "Pretty Print" button on the top right (with a "{}" icon) is highlighted blue. Disable prettifying and you'll see that the file is just one line. So the fix we might need to apply should be either * Disable auto-enabling prettifying source file when jumping from a search result, or * Re-compute the search results' locations in the file after it's prettified - We don't necessarily need to do this for all files at the time of searching, just when a search result is clicked - However, prettifying a file might change its contents by adding whitespaces (e.g. `:true` becomes `: true`), so we do need to somehow work around that in the fix |