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 未關閉false-positive
難度 4/5 3-5 天 新手友好度 15/100
-
false-positive
難度 3/5 1-2 天 新手友好度 68/100
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
idean3885/claude-ops-agent#521 ·
-
難度 2/5 1-3 小時 新手友好度 72/100
0xMiden/bridge-portal#132 ·
-
bug
難度 2/5 1-3 小時 新手友好度 84/100
newrelic-experimental/preflight#793 · 1 則留言 ·
-
enhancement
難度 2/5 1-3 小時 新手友好度 70/100
babalae/bettergi-scripts-list#3674 ·
-
難度 2/5 1-3 小時 新手友好度 88/100
caddyserver/caddy#8046 ·