mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 09:09:43 +00:00
Revert "LibJS: Reduce number of proxy traps called during for..in…
…iteration"
This reverts commit 357eeba49c
.
This commit is contained in:
parent
9ec986753a
commit
ed62aa6224
Notes:
github-actions[bot]
2025-03-21 16:45:28 +00:00
Author: https://github.com/tcl3
Commit: ed62aa6224
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4035
2 changed files with 49 additions and 90 deletions
|
@ -1,40 +0,0 @@
|
|||
test("for..in iteration Proxy traps", () => {
|
||||
let traps = [];
|
||||
let array = [1, 2, 3];
|
||||
let from = new Proxy(array, {
|
||||
getPrototypeOf: function (t) {
|
||||
traps.push("getPrototypeOf");
|
||||
return Reflect.getPrototypeOf(t);
|
||||
},
|
||||
ownKeys: function (t) {
|
||||
traps.push("ownKeys");
|
||||
return Reflect.ownKeys(t);
|
||||
},
|
||||
has: function (t, p) {
|
||||
traps.push("has");
|
||||
return Reflect.has(t, p);
|
||||
},
|
||||
getOwnPropertyDescriptor: function (t, p) {
|
||||
traps.push("getOwnPropertyDescriptor");
|
||||
return Reflect.getOwnPropertyDescriptor(t, p);
|
||||
},
|
||||
});
|
||||
const to = [];
|
||||
for (const prop in from) {
|
||||
to.push(prop);
|
||||
from.pop();
|
||||
}
|
||||
|
||||
expect(to).toEqual(["0", "1"]);
|
||||
|
||||
expect(traps).toEqual([
|
||||
"ownKeys",
|
||||
"getPrototypeOf",
|
||||
"getOwnPropertyDescriptor",
|
||||
"getOwnPropertyDescriptor",
|
||||
"getOwnPropertyDescriptor",
|
||||
"getOwnPropertyDescriptor",
|
||||
"getOwnPropertyDescriptor",
|
||||
"getOwnPropertyDescriptor",
|
||||
]);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue