servo/components/shared
atbrakhi c8ee11fe77
DevTools: sources for HTML files should be the whole HTML file (#37456)
To show the contents of inline scripts in the Sources panel, we need to
send the whole HTML file from script to devtools, not just the script
code. This is trickier than the external script case, but we can look to
[how Firefox does
it](https://servo.zulipchat.com/#narrow/channel/263398-general/topic/Getting.20the.20original.20page.20HTML.20from.20script/near/524392861)
for some inspiration. The process is as follows:

- when we execute a script
  - notify devtools to create the source actor
- if it’s an external script, send the script code to the devtools
server
  - if it’s an inline script, don’t send any source contents yet
  - devtools stores the contents in the source actor
- while loading a new document
  - buffer the markup, so we can send it to devtools
- when we finish loading a new document
  - send the buffered markup to the devtools server
- devtools stores the contents in any source actors with no contents yet
- when a source actor gets a `source` request
  - if we have the contents, send those contents to the client
- if we don’t have the contents (inline script that loaded while
devtools was closed)
    - FUTURE: try to fetch the markup out of cache
    - otherwise send `<!-- not available; please reload! -->`

Testing: Several tests added to test the changes, also updates an
existing test with correct assertion
Fixes: https://github.com/servo/servo/issues/36874

---------

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: Delan Azabani <dazabani@igalia.com>
2025-06-21 18:46:35 +00:00
..
background_hang_monitor Initial IndexedDB Support (#33044) 2025-06-19 05:19:07 +00:00
base imagebitmap: Make ImageBitmap serializable and transferable (#37101) 2025-05-23 20:40:25 +00:00
bluetooth Include WebViewId into EmbedderMsg variants where possible (#35211) 2025-01-30 11:15:35 +00:00
canvas pixels: Move Snapshot and related data structures to pixels (#37590) 2025-06-20 14:47:06 +00:00
compositing script: Get scroll offsets from layout (#37509) 2025-06-20 09:39:12 +00:00
constellation pixels: Move Snapshot and related data structures to pixels (#37590) 2025-06-20 14:47:06 +00:00
devtools DevTools: sources for HTML files should be the whole HTML file (#37456) 2025-06-21 18:46:35 +00:00
embedder [WebDriver] Implement "Find Element(s) From ShadowRoot" (#37578) 2025-06-20 11:54:39 +00:00
fonts Update rustfmt to the 2024 style edition (#35764) 2025-03-03 11:26:53 +00:00
layout Rename script_layout_interface to layout_api (#37591) 2025-06-20 17:13:05 +00:00
net net: Avoid all-encompassing synchronous IPC return type for IndexedDB operations (#37576) 2025-06-20 10:06:56 +00:00
profile Initial IndexedDB Support (#33044) 2025-06-19 05:19:07 +00:00
script compositor: Wait for both Script and the Constellation when shutting down Pipelines (#37505) 2025-06-17 09:56:31 +00:00
webgpu pixels: Move Snapshot and related data structures to pixels (#37590) 2025-06-20 14:47:06 +00:00
webxr libservo: Move EventLooperWaker from webxr_traits to embedder_traits (#36420) 2025-04-09 14:19:33 +00:00