Skip to content

fix(core/webidl): warn when partial interface has local dfn#5242

Open
marcoscaceres wants to merge 3 commits into
mainfrom
fix/3563-partial-warning
Open

fix(core/webidl): warn when partial interface has local dfn#5242
marcoscaceres wants to merge 3 commits into
mainfrom
fix/3563-partial-warning

Conversation

@marcoscaceres
Copy link
Copy Markdown
Contributor

Closes #3563

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new core/webidl authoring warning for cases where a local <dfn> is used for a WebIDL partial definition, aiming to catch specs that redefine interfaces which are actually defined elsewhere.

Changes:

  • Adds warning logic in defineIdlName() for partial IDL definitions that resolve to a local <dfn> without data-cite.
  • Uses a regex-based scan of local IDL blocks to suppress the warning when a non-partial definition exists in the same spec.
  • Adds a spec test covering the new warning behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/core/webidl.js Adds the new partial-definition warning and local non-partial detection logic.
tests/spec/core/webidl-spec.js Adds a regression test asserting that the new warning is emitted.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/core/webidl.js Outdated
Comment thread src/core/webidl.js Outdated
Comment thread tests/spec/core/webidl-spec.js
@marcoscaceres marcoscaceres force-pushed the fix/3563-partial-warning branch 2 times, most recently from 9c95265 to c1c071e Compare May 4, 2026 07:12
@marcoscaceres
Copy link
Copy Markdown
Contributor Author

@copilot Can you confirm all your feedback has been addressed? Can you fix anything that was not addressed?

Copy link
Copy Markdown
Contributor

Copilot AI commented May 4, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • accounts.google.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4753 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-48733896 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,10648861418896615980,16836846209980864181,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,18135446614111970105,2054948351698793841,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4832 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-42169880 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2785306091981146254,16644792986603739778,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,383350975946342508,9413738897093942760,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-48733896 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9876/?id=48733896 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)
  • android.clients.google.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4753 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-48733896 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,10648861418896615980,16836846209980864181,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,18135446614111970105,2054948351698793841,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4832 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-42169880 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2785306091981146254,16644792986603739778,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,383350975946342508,9413738897093942760,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-48733896 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9876/?id=48733896 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)
  • clients2.google.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4832 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-42169880 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2785306091981146254,16644792986603739778,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,383350975946342508,9413738897093942760,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4753 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-48733896 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,10648861418896615980,16836846209980864181,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,18135446614111970105,2054948351698793841,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-48733896 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9876/?id=48733896 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)
  • clientservices.googleapis.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4753 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-48733896 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,10648861418896615980,16836846209980864181,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,18135446614111970105,2054948351698793841,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4832 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-42169880 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2785306091981146254,16644792986603739778,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,383350975946342508,9413738897093942760,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-42169880 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9877/?id=42169880 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)
  • optimizationguide-pa.googleapis.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4753 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-48733896 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,10648861418896615980,16836846209980864181,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,18135446614111970105,2054948351698793841,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4832 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-42169880 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2785306091981146254,16644792986603739778,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,383350975946342508,9413738897093942760,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-48733896 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9876/?id=48733896 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)
  • redirector.gvt1.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4753 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-48733896 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,10648861418896615980,16836846209980864181,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,18135446614111970105,2054948351698793841,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-48733896 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9876/?id=48733896 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4832 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-42169880 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2785306091981146254,16644792986603739778,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,383350975946342508,9413738897093942760,4 --trace-process-track-uuid=3190708989122997041 (dns block)
  • safebrowsingohttpgateway.googleapis.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4832 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-42169880 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2785306091981146254,16644792986603739778,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,383350975946342508,9413738897093942760,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4753 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-48733896 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,10648861418896615980,16836846209980864181,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,18135446614111970105,2054948351698793841,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-48733896 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9876/?id=48733896 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)
  • update.googleapis.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4832 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-42169880 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2785306091981146254,16644792986603739778,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,383350975946342508,9413738897093942760,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-42169880 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9877/?id=42169880 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4753 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-48733896 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,10648861418896615980,16836846209980864181,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,18135446614111970105,2054948351698793841,4 --trace-process-track-uuid=3190708989122997041 (dns block)
  • www.google.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4753 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-48733896 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,10648861418896615980,16836846209980864181,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,18135446614111970105,2054948351698793841,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=4832 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-42169880 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2785306091981146254,16644792986603739778,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,383350975946342508,9413738897093942760,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/google/chrome/chrome /usr/bin/google-chrome --user-data-dir=/tmp/karma-42169880 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications http://localhost:9877/?id=42169880 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@marcoscaceres
Copy link
Copy Markdown
Contributor Author

@copilot Can you confirm all your feedback has been addressed? Can you fix anything that was not addressed?

Copy link
Copy Markdown
Contributor

Copilot AI commented May 5, 2026

@copilot Can you confirm all your feedback has been addressed? Can you fix anything that was not addressed?

All three items of feedback are addressed in commit d7018ec:

  1. Extended attributes regex — changed ^\\s* to (?:^|\\])\\s* so [Exposed=Window] interface Foo {} is correctly identified as a non-partial base definition.
  2. pre.webidl coverage — selector is "pre.idl, pre.webidl", both element classes are scanned (was already correct in the first commit).
  3. Non-warning path tests — three new tests were added:
    • "does not warn when a non-partial base exists locally"
    • "does not warn when dfn has data-cite"
    • "does not warn when non-partial base has same-line extended attributes" (directly exercises the regex fix)

…ata-cite

Checks raw IDL source for non-partial definitions to avoid false
positives. Only warns when no non-partial definition exists.

Closes #3563
…heck

The regex for detecting non-partial base definitions required the
declaration keyword at start-of-line, missing same-line extended
attributes like `[Exposed=Window] interface Foo`. Now allows an
optional `]` before the keyword.

Add 3 regression tests: non-partial base exists (no warning),
data-cite dfn (no warning), extended-attribute-prefixed base (no warning).
@marcoscaceres marcoscaceres force-pushed the fix/3563-partial-warning branch from d7018ec to 7f2c792 Compare May 5, 2026 09:58
@marcoscaceres
Copy link
Copy Markdown
Contributor Author

@copilot Can you confirm all your feedback has been addressed? Can you fix anything that was not addressed?

…al check

Agent-Logs-Url: https://github.com/speced/respec/sessions/56153fca-bad2-4ace-a20e-628ca0d9e7cd

Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

@copilot Can you confirm all your feedback has been addressed? Can you fix anything that was not addressed?

All original feedback is addressed. I also found and fixed one additional issue: the extended-attribute test was named "warns for partial with extended-attribute-prefixed base" but was actually asserting zero warnings — corrected to "does not warn when non-partial base has same-line extended attributes" in commit 5cd835a.

@marcoscaceres marcoscaceres marked this pull request as ready for review May 9, 2026 02:40
@marcoscaceres marcoscaceres requested review from sidvishnoi and removed request for sidvishnoi May 9, 2026 02:40
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.

Disallow re-defining (via dfn) interface names when using partial interfaces

3 participants