mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
devtools: Fix source contents tests and fix a race (#38359)
test_sources_list() relied on <https://servo.org/js/load-table.js> to test scripts loaded from multiple origins, but that file was deleted a couple of weeks ago. this patch adds a second internal web server, then replaces that load with scripts loaded from two distinct origins: <http://127.0.0.1:10000> and <http://127.0.0.1:10001>. fixing that test revealed an impl bug where inline module scripts containing `import` statements may never get their source contents populated. this is because the logic for populating source contents for inline scripts only applied to source actors created *before* we finished parsing the page. we assumed that inline scripts always block the parser, but this is not the case. this patch ensures that inline source contents can be populated for source actors created after parse. Testing: adds a new test, test_source_content_with_inline_module_import_external() Fixes: part of #36325 Signed-off-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: atbrakhi <atbrakhi@igalia.com>
This commit is contained in:
parent
900dd8d191
commit
a671c50bc9
3 changed files with 35 additions and 1 deletions
|
@ -112,6 +112,14 @@ class DevtoolsTests(unittest.IsolatedAsyncioTestCase):
|
|||
expected_content = open(self.get_test_path("sources/test.html")).read()
|
||||
self.assert_source_content(f"{self.base_url}/test.html", expected_content)
|
||||
|
||||
def test_source_content_with_inline_module_import_external(self):
|
||||
self.start_web_server(test_dir=self.get_test_path("sources_content_with_inline_module_import_external"))
|
||||
self.run_servoshell()
|
||||
expected_content = open(
|
||||
self.get_test_path("sources_content_with_inline_module_import_external/test.html")
|
||||
).read()
|
||||
self.assert_source_content(f"{self.base_urls[0]}/test.html", expected_content)
|
||||
|
||||
# Test case that uses innerHTML and would actually need the HTML parser
|
||||
# (innerHTML has a fast path for values that don’t contain b'&' | b'\0' | b'<' | b'\r')
|
||||
def test_source_content_inline_script_with_inner_html(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue