Repository navigation
Commit 60a5404
committed
fix(ownts): match listener removal by capture flag, default false (Codex)
addEventListener's third argument is identified for removal by its capture flag,
which defaults to false when omitted. The previous check only required matching
options when the acquire HAD a third arg, so add("x", h) (capture false) was
wrongly accepted as released by remove("x", h, true) (capture true), suppressing
the OWN001 leak. Now _capture_flag normalizes each side (omitted/object-without-
capture -> false; true/false; {capture:…}; non-literal -> verbatim) and the
listener is released only when receiver, handler AND capture flag all match — in
both directions. passive/once/signal don't affect removal identity.
test_ownts.py adds the symmetric case (omitted vs remove(...,true) -> leak),
{capture:true}==true, and passive-option normalization. Full suite green; ruff +
mypy --strict clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PVeuchch67CtjSbizYm8gi1 parent dc7ba94 commit 60a5404
2 files changed
Lines changed: 37 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
78 | 95 | | |
79 | 96 | | |
80 | 97 | | |
| |||
95 | 112 | | |
96 | 113 | | |
97 | 114 | | |
98 | | - | |
| 115 | + | |
99 | 116 | | |
100 | 117 | | |
101 | 118 | | |
102 | 119 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | 120 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
111 | 131 | | |
112 | 132 | | |
113 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
72 | 81 | | |
73 | 82 | | |
74 | 83 | | |
| |||
0 commit comments