Align JavaScript StorageEvent externs with current Web IDL by Copilot · Pull Request #22852 · github/codeql · GitHub
Skip to content

Align JavaScript StorageEvent externs with current Web IDL - #22852

Open
asgerf with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-storage-event-constructor
Open

asgerf with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-storage-event-constructor

Conversation

Copilot AI commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

The zero-argument StorageEvent model causes false positives on valid browser constructor calls. Its legacy initializer also incorrectly marks optional parameters as required.

  • Constructor: Require type and accept an optional StorageEventInit dictionary with inherited event options.
  • Initializer: Make arguments after type optional and correct key nullability.
  • Regression coverage: Cover valid constructor calls and retain detection of excess arguments.
new StorageEvent("storage", { key: "k", newValue: "v" });

Co-authored-by: asgerf <316427+asgerf@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix StorageEvent constructor to accept arguments Align JavaScript StorageEvent externs with current Web IDL Oct 20, 2026
Copilot AI requested a review from asgerf October 20, 2026 13:00
@github-actions github-actions Bot added the JS label Oct 20, 2026
@asgerf
asgerf marked this pull request as ready for review October 21, 2026 08:19
@asgerf
asgerf requested a review from a team as a code owner October 21, 2026 08:19
Copilot AI max review requested due to automatic review settings October 21, 2026 08:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused declarations and regression cases match the intended API, with no blocking correctness issues identified.

1 open issue
What changed in this PR

Updates JavaScript browser externs to match modern StorageEvent signatures and prevent false positives.

Changes:

  • Add the constructor’s required type and optional event dictionary.
  • Correct initializer optionality and key nullability.
  • Cover valid constructor calls and excess arguments.
File Description
javascript/​ql/​test/​query-tests/​LanguageFeatures/​SpuriousArguments/​storageEvent.js Adds constructor regression cases.
javascript/​ql/​test/​query-tests/​LanguageFeatures/​SpuriousArguments/​SpuriousArguments.expected Records the excess-argument alert.
javascript/​ql/​test/​query-tests/​LanguageFeatures/​SpuriousArguments/​externs.js Supplies the updated test signature.
javascript/​externs/​web/​webstorage.js Updates dictionary, constructor, and initializer declarations.

Review effort: Max

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added the requested minorAnalysis change note in commit 55dc32272c0.

Co-authored-by: asgerf <316427+asgerf@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JavaScript externs model StorageEvent() with no type argument

3 participants