servo/components
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
..
allocator Organize component Cargo.toml dependencies (#36224) 2025-03-30 19:03:54 +00:00
background_hang_monitor Organize component Cargo.toml dependencies (#36224) 2025-03-30 19:03:54 +00:00
bluetooth Replace bluetooth Readme with corrected version from devices repository (#36429) 2025-04-10 18:02:45 +00:00
canvas canvas: Make draw_options non optional in fill_rect (#37603) 2025-06-21 09:34:28 +00:00
compositing libservo: Remove TouchEventType argument from WebView::notify_scroll_event (#37588) 2025-06-20 13:59:01 +00:00
config Layout: Add Debug Print for The Scroll Tree (#37522) 2025-06-20 07:16:30 +00:00
constellation constellation: add multiprocess support on Windows (#37580) 2025-06-21 02:32:18 +00:00
deny_public_fields Add rust-version to all Cargo.toml files (#33483) 2024-09-17 16:39:07 +00:00
devtools DevTools: sources for HTML files should be the whole HTML file (#37456) 2025-06-21 18:46:35 +00:00
dom_struct script: Feature-gate all crown support. (#35055) 2025-01-18 21:36:15 +00:00
domobject_derive Update rustfmt to the 2024 style edition (#35764) 2025-03-03 11:26:53 +00:00
fonts Initial IndexedDB Support (#33044) 2025-06-19 05:19:07 +00:00
geometry servoshell: Allow overriding screen resolution with a command-line argument (#34038) 2024-10-30 11:54:13 +00:00
hyper_serde Update rustfmt to the 2024 style edition (#35764) 2025-03-03 11:26:53 +00:00
jstraceable_derive Add rust-version to all Cargo.toml files (#33483) 2024-09-17 16:39:07 +00:00
layout Rename script_layout_interface to layout_api (#37591) 2025-06-20 17:13:05 +00:00
malloc_size_of Add support for static SVG images using resvg crate (#36721) 2025-05-27 11:02:40 +00:00
media compositing: Combine webrender_traits and compositing_traits (#36372) 2025-04-06 17:34:18 +00:00
metrics Removing unused dependencies in crates. (#37096) 2025-05-23 12:58:00 +00:00
net net: Avoid all-encompassing synchronous IPC return type for IndexedDB operations (#37576) 2025-06-20 10:06:56 +00:00
pixels pixels: Move Snapshot and related data structures to pixels (#37590) 2025-06-20 14:47:06 +00:00
profile Profile: Resident Segments was not correctly parsing /proc/self/smaps as the regexp did not work anymore. (#37549) 2025-06-19 09:19:31 +00:00
rand Migrate to the 2024 edition (#35755) 2025-03-13 10:28:11 +00:00
range Add rust-version to all Cargo.toml files (#33483) 2024-09-17 16:39:07 +00:00
script DevTools: sources for HTML files should be the whole HTML file (#37456) 2025-06-21 18:46:35 +00:00
script_bindings script: Expose IDBVersionChangeEvent to worker globals. (#37573) 2025-06-20 07:42:36 +00:00
servo Rename script_layout_interface to layout_api (#37591) 2025-06-20 17:13:05 +00:00
servo_tracing [tracing] Add convenience macro for function tracing (#36573) 2025-04-22 19:58:20 +00:00
shared DevTools: sources for HTML files should be the whole HTML file (#37456) 2025-06-21 18:46:35 +00:00
timers script: Allow reflows that do not produce display lists (#37186) 2025-06-12 19:25:04 +00:00
url script: complete resolve_module_specifier (#37552) 2025-06-21 06:17:27 +00:00
webdriver_server [WebDriver:Release Actions] Fix wrong comments and Improve codestyle (#37585) 2025-06-21 18:31:19 +00:00
webgl pixels: Move Snapshot and related data structures to pixels (#37590) 2025-06-20 14:47:06 +00:00
webgpu pixels: Move Snapshot and related data structures to pixels (#37590) 2025-06-20 14:47:06 +00:00
webxr Removing unused dependencies in crates. (#37096) 2025-05-23 12:58:00 +00:00