devtools: Fix getBreakpointListActor handler in watcher actor (#38624)

the Firefox devtools client often sends multiple
`getBreakpointListActor` requests to the watcher actor when connecting,
and the Firefox devtools server returns the same breakpoint list actor
every time, but Servo returns a new breakpoint list actor each time.
this patch aligns Servo’s behaviour with Firefox.

Testing: this patch adds a devtools test

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
This commit is contained in:
shuppy 2025-08-12 20:26:59 +08:00 committed by GitHub
parent b3978439ad
commit 319f4f0e38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 15 deletions

View file

@ -57,6 +57,16 @@ class DevtoolsTests(unittest.IsolatedAsyncioTestCase):
self.web_servers = None
self.web_server_threads = None
# Watcher tests
def test_watcher_returns_same_breakpoint_list_actor_every_time(self):
self.run_servoshell(url="data:text/html,")
devtools = self._setup_devtools_client()
response1 = devtools.watcher.get_breakpoint_list_actor()
response2 = devtools.watcher.get_breakpoint_list_actor()
self.assertEqual(response1["breakpointList"]["actor"], response2["breakpointList"]["actor"])
# Sources list
# Classic script vs module script:
# - <https://html.spec.whatwg.org/multipage/#classic-script>
# - <https://html.spec.whatwg.org/multipage/#module-script>
@ -66,8 +76,6 @@ class DevtoolsTests(unittest.IsolatedAsyncioTestCase):
# Non-worker(?) script sources can be inline, external, or blob.
# Worker script sources can be external or blob.
# Sources list
def test_sources_list(self):
self.start_web_server(test_dir=os.path.join(DevtoolsTests.script_path, "devtools_tests/sources"))
self.run_servoshell()