Bug 264037

Summary: Web Inspector: Search results don't select source code line in fetch json
Product: WebKit Reporter: Jeff Johnson <opendarwin>
Component: Web InspectorAssignee: 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 Flags
Screenshot demonstrating the bug
none
Screenshot showing selected text in main document html none

Jeff Johnson
Reported 2023-11-01 07:32:31 PDT
Created attachment 468443 [details] Screenshot demonstrating the bug Steps to reproduce: 1. Open Safari web inspector 2. Open https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow in tab 3. In web inspector, search for "Notarize plug-ins for other software packages" 4. Select the search result in the file "customizing_the_notarization_workflow.json" Expected results: Line 434 is selected, which contains the matched text. Actual results: Line 1 is briefly flashed, and no text is selected. See the attached screenshots.
Attachments
Screenshot demonstrating the bug (243.30 KB, image/png)
2023-11-01 07:32 PDT, Jeff Johnson
no flags
Screenshot showing selected text in main document html (340.35 KB, image/png)
2023-11-01 07:33 PDT, Jeff Johnson
no flags
Jeff Johnson
Comment 1 2023-11-01 07:33:11 PDT
Created attachment 468444 [details] Screenshot showing selected text in main document html
Radar WebKit Bug Importer
Comment 2 2023-11-08 06:33:15 PST
Greg Marriott
Comment 3 2024-05-28 13:35:18 PDT
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?
Jeff Johnson
Comment 4 2024-05-28 13:49:04 PDT
(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.
Qianlang Chen
Comment 5 2024-05-28 15:32:32 PDT
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
Note You need to log in before you can comment on or make changes to this bug.