Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update WebIDL.py #32495

Merged
merged 8 commits into from
Jun 15, 2024
Merged

Update WebIDL.py #32495

merged 8 commits into from
Jun 15, 2024

Conversation

wusyong
Copy link
Contributor

@wusyong wusyong commented Jun 14, 2024

We found some codegen error when trying to add queuing strategy, but firefox has exact webidl and works fine.
It's time to update servo's webidl.py to fix this issue.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #___ (GitHub issue number if applicable)
  • There are tests for these changes. WPT suite should pass.

@wusyong wusyong changed the title Update WebIDL Update WebIDL.py Jun 14, 2024
@wusyong wusyong marked this pull request as ready for review June 14, 2024 12:31
@sagudev sagudev added the T-linux-wpt-2020 Do a try run of the WPT label Jun 14, 2024
@github-actions github-actions bot removed the T-linux-wpt-2020 Do a try run of the WPT label Jun 14, 2024
Copy link

🔨 Triggering try run (#9516389545) for Linux WPT

Copy link

Test results for linux-wpt-layout-2020 from try job (#9516389545):

Flaky unexpected result (11)
  • OK /css/css-fonts/variations/at-font-face-font-matching.html (#20684)
    • FAIL [expected PASS] subtest: Matching font-weight: '400' should prefer '500' over '350 399'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

  • OK /custom-elements/form-associated/ElementInternals-setFormValue.html (#29174)
    • PASS [expected FAIL] subtest: setFormValue with an empty FormData should submit nothing
    • PASS [expected FAIL] subtest: Newline normalization - \r\n in name (urlencoded)
  • TIMEOUT /fetch/api/basic/keepalive.any.html (#29536)
    • TIMEOUT [expected PASS] subtest: [keepalive] simple GET request on 'load' [no payload]; setting up

      Test timed out
      

    • NOTRUN [expected TIMEOUT] subtest: [keepalive] simple GET request on 'pagehide' [no payload]; setting up
  • OK /html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/a-click.html (#28697)
    • FAIL [expected PASS] subtest: aElement.click() before the load event must NOT replace

      assert_equals: expected "http://web-platform.test:8000/common/blank.html?thereplacement" but got "http://web-platform.test:8000/html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/resources/code-injector.html?pipe=sub(none)&code=%0A%20%20%20%20const%20a%20%3D%20document.createElement(%22a%22)%3B%0A%20%20%20%20a.href%20%3D%20%22%2Fcommon%2Fblank.html%3Fthereplacement%22%3B%0A%20%20%20%20document.currentScript.before(a)%3B%0A%20%20%20%20a.click()%3B%0A%20%20"
      

  • TIMEOUT [expected OK] /html/interaction/focus/the-autofocus-attribute/autofocus-dialog.html (#29087)
    • TIMEOUT [expected FAIL] subtest: <dialog>-contained autofocus element gets focused when the dialog is shown

      Test timed out
      

  • TIMEOUT /html/interaction/focus/the-autofocus-attribute/supported-elements.html (#24145)
    • FAIL [expected TIMEOUT] subtest: Element with tabindex should support autofocus

      assert_equals: expected "SPAN" but got "BODY"
      

    • TIMEOUT [expected NOTRUN] subtest: Non-HTMLElement should not support autofocus

      Test timed out
      

  • CRASH [expected OK] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-1.html (#24066)
  • CRASH [expected OK] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-3.html (#24066)
  • OK /html/semantics/embedded-content/the-img-element/non-active-document.html (#21544)
    • FAIL [expected PASS] subtest: DOMParser

      assert_unreached: got unexpected load event Reached unreachable code
      

    • FAIL [expected PASS] subtest: createHTMLDocument

      assert_unreached: got unexpected error event Reached unreachable code
      

    • FAIL [expected PASS] subtest: <template>

      assert_unreached: got unexpected error event Reached unreachable code
      

  • OK /html/semantics/forms/form-submission-0/multipart-formdata.window.html (#28725)
    • PASS [expected FAIL] subtest: multipart/form-data: 0x00 in name (normal form)
  • OK /workers/WorkerGlobalScope-close.html (#23064)
    • PASS [expected FAIL] subtest: Test sending a message after closing.
Stable unexpected results that are known to be intermittent (15)
  • FAIL [expected PASS] /_mozilla/css/iframe/hide_and_show.html (#15265)
  • TIMEOUT /fetch/metadata/generated/element-img-environment-change.https.sub.html (#30111)
    • TIMEOUT [expected NOTRUN] subtest: sec-fetch-site - Same site, no attributes

      Test timed out
      

  • TIMEOUT [expected OK] /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/iframe-src-aboutblank-navigate-immediately.html (#29048)
    • TIMEOUT [expected FAIL] subtest: Navigating to a different document with form submission

      Test timed out
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-same-origin.window.html (#29049)
    • PASS [expected FAIL] subtest: Same-origin navigation started from unload handler must be ignored
  • OK /html/browsers/history/the-history-interface/traverse_the_history_5.html (#21383)
    • PASS [expected FAIL] subtest: Multiple history traversals, last would be aborted
  • OK [expected CRASH] /html/browsers/windows/embedded-opener-remove-frame.html (#23867)
  • OK [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html (#22647)
    • FAIL [expected TIMEOUT] subtest: Check that popups from a sandboxed iframe escape the sandbox if allow-popups-to-escape-sandbox is used

      assert_equals: It came from a sandboxed iframe expected "null" but got "http://web-platform.test:8000"
      

  • TIMEOUT [expected OK] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-3.html (#24057)
    • TIMEOUT [expected FAIL] subtest: Check that popups from a sandboxed iframe escape the sandbox if allow-popups-to-escape-sandbox is used

      Test timed out
      

  • OK [expected CRASH] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-2.html (#22154)
    • FAIL [expected NOTRUN] subtest: Check that popups from a sandboxed iframe do not escape the sandbox

      assert_equals: It came from a sandboxed iframe expected "null" but got "http://web-platform.test:8000"
      

  • OK [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-cross-site.tentative.sub.window.html (#31754)
    • FAIL [expected TIMEOUT] subtest: A cross-site unsandboxed iframe navigation consumes user activation and disallows top-level navigation.

      promise_test: Unhandled rejection with value: object "TypeError: element.scrollIntoView is not a function"
      

  • OK [expected TIMEOUT] /html/semantics/forms/form-submission-0/reparent-form-during-planned-navigation-task.html (#29724)
    • PASS [expected TIMEOUT] subtest: reparent-form-during-planned-navigation-task
  • OK /html/semantics/forms/form-submission-0/text-plain.window.html (#28687)
    • PASS [expected FAIL] subtest: text/plain: Basic test (formdata event)
  • OK /html/syntax/parsing/DOMContentLoaded-defer.html (#21550)
    • FAIL [expected PASS] subtest: The end: DOMContentLoaded and defer scripts

      assert_false: DOMContentLoaded should not have fired before executing a task queued from a defer script expected false got true
      

  • OK /html/webappapis/dynamic-markup-insertion/document-write/module-delayed.html (#27659)
    • PASS [expected FAIL] subtest: async document.write in a module
  • TIMEOUT /resource-timing/test_resource_timing.https.html (#25216)
    • FAIL [expected PASS] subtest: PerformanceEntry has correct name, initiatorType, startTime, and duration (img)

      assert_equals: expected 7007488 but got 7007232
      

Copy link

✨ Try run (#9516389545) succeeded.

@wusyong wusyong requested a review from jdm June 15, 2024 02:51
@jdm
Copy link
Member

jdm commented Jun 15, 2024

The following diff builds for me:

diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 5bb0a8aaec..e3ff49930f 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -3981,12 +3981,7 @@ let args = CallArgs::from_vp(vp, argc);
 let global = GlobalScope::from_object(args.callee());
 """

-        # Exposure set {'DissimilarOriginWindow', 'Window'} should downcast to Window.
-        # DissimilarOriginWindow is not for external usage.
-        if len(self.exposureSet) == 2 and "Window" in self.exposureSet and "DissimilarOriginWindow" in self.exposureSet:
-            print(self.exposureSet)
-            preamble += "let global = DomRoot::downcast::<dom::types::Window>(global).unwrap();\n"
-        elif len(self.exposureSet) == 1:
+        if len(self.exposureSet) == 1:
             preamble += ("let global = DomRoot::downcast::<dom::types::%s>(global).unwrap();\n" %
                          list(self.exposureSet)[0])
         return CGList([CGGeneric(preamble), self.generate_code()])
@@ -6136,11 +6131,7 @@ let args = CallArgs::from_vp(vp, argc);
 let global = GlobalScope::from_object(JS_CALLEE(*cx, vp).to_object());
 """

-        # Exposure set {'DissimilarOriginWindow', 'Window'} should downcast to Window.
-        # DissimilarOriginWindow is not for external usage.
-        if len(self.exposureSet) == 2 and "Window" in self.exposureSet and "DissimilarOriginWindow" in self.exposureSet:
-            preamble += "let global = DomRoot::downcast::<dom::types::Window>(global).unwrap();\n"
-        elif len(self.exposureSet) == 1:
+        if len(self.exposureSet) == 1:
             preamble += """\
 let global = DomRoot::downcast::<dom::types::%s>(global).unwrap();
 """ % list(self.exposureSet)[0]
diff --git a/components/script/dom/webidls/DissimilarOriginWindow.webidl b/components/script/dom/webidls/DissimilarOriginWindow.webidl
index 2e55d33f00..bce8bddb57 100644
--- a/components/script/dom/webidls/DissimilarOriginWindow.webidl
+++ b/components/script/dom/webidls/DissimilarOriginWindow.webidl
@@ -13,7 +13,7 @@
 // way to enforce security policy.

 // https://html.spec.whatwg.org/multipage/#window
-[Global=(Window,DissimilarOriginWindow), Exposed=(Window,DissimilarOriginWindow), LegacyNoInterfaceObject]
+[Global=DissimilarOriginWindow, Exposed=(Window,DissimilarOriginWindow), LegacyNoInterfaceObject]
 interface DissimilarOriginWindow : GlobalScope {
   [LegacyUnforgeable] readonly attribute WindowProxy window;
   [BinaryName="Self_", Replaceable] readonly attribute WindowProxy self;

@jdm jdm enabled auto-merge June 15, 2024 04:16
@jdm jdm added this pull request to the merge queue Jun 15, 2024
Merged via the queue into servo:main with commit 8eed3b4 Jun 15, 2024
9 checks passed
@wusyong wusyong deleted the webidl branch June 15, 2024 05:39
shanehandley pushed a commit to shanehandley/servo that referenced this pull request Jun 15, 2024
* Update WebIDL.py

* Update WebIDL.py

* Add builtin-array.patch

* Fix CodegenRust.py and Configuration.py

* Fix missing downcasts

* mach fmt

* Update check and comment to explain why we need this check

* Update Global of DissimilarOriginWindow.webidl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants