JavaScript externs model StorageEvent() with no type argument
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 84/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript
调研方向
从 javascript/externs/web/webstorage.js 开始,将 StorageEvent 构造函数和 initStorageEvent 的声明与 issue 中描述的当前 Web IDL 进行比较。更新 extern 签名,使文档中说明的类型和可选参数得到表示,然后验证所示的有效构造函数用法不再被建模为零参数。
由索引模型根据 Issue 内容生成。
描述
Description
javascript/externs/web/webstorage.js still models StorageEvent as a zero-argument constructor:
/**
* @see http://www.w3.org/TR/2011/CR-webstorage-20111208/#the-storage-event
* @extends {Event}
* @constructor
*/
function StorageEvent() {}
Current HTML (the-storageevent-interface) defines:
constructor(DOMString type, optional StorageEventInit eventInitDict = {});
new StorageEvent('storage', { key, newValue, ... }) is valid in browsers (constructor available since 2018). CodeQL 2.27.0 reported a false positive on a standards-conforming new StorageEvent('storage', { ... }) call used in a synthetic StorageEvent test.
initStorageEvent in the same file also follows the old required-argument list; the spec method has optional arguments after type.
I searched this tracker for StorageEvent / StorageEventInit / webstorage externs and did not find an existing issue.
Reproduction
- Analyze JavaScript that constructs
new StorageEvent('storage', { key: 'k', newValue: 'v' }). - Observe a CodeQL alert that treats the constructor as taking no parameters.
Expected
Externs should match the current constructor (type plus optional StorageEventInit) so valid Web IDL usage is not flagged.
This is a modeling/false-positive report only. No exploit is claimed.
- 主要语言
- CodeQL
- 星标
- 10.1k
- 派生
- 2.1k
- 平均合并
- 2 天 11 小时
- 30 天内合并 PR
- 129
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github/codeql 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 78/100
-
false-positive
难度 2/5 1-3 小时 新手友好度 70/100
-
false-positive
难度 3/5 1-2 天 新手友好度 68/100
-
难度 4/5 3-5 天 新手友好度 55/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
-
help wanted
难度 2/5 1-3 小时 新手友好度 72/100
hemilabs/ui-monorepo#2332 ·
-
Help-Wanted Needs-Triage Package-Update
难度 2/5 1-3 小时 新手友好度 78/100
microsoft/winget-pkgs#438662 ·
-
priority: p3
难度 2/5 1-3 小时 新手友好度 72/100
googleapis/librarian#7636 ·
-
bug good first issue
难度 2/5 1-3 小时 新手友好度 75/100
olcf/olcf-test-harness#278 · 1 条评论 ·