fix(javascript): preserve intrinsic invocation read identity

This commit is contained in:
morluto
2026-10-12 01:22:43 +08:00
parent 097f0d54af
commit 1a322ab75b
7 changed files with 231 additions and 86 deletions
@@ -571,6 +571,9 @@ describe("Electron module interop bound mutators", () => {
'const change = Object.defineProperty.call; change(null,Object,"create",{value:customCreate});',
'const {apply:change} = Object.defineProperty; change(null,[Object,"create",{value:customCreate}]);',
'const change = Reflect.apply.call; change(null,Object.defineProperty,null,[Object,"create",{value:customCreate}]);',
'(0, Object.defineProperty)(Object,"create",{value:customCreate});',
'const change = Object.defineProperty.bind(null,Object,"create"); (0, change)({value:customCreate});',
'(0, Reflect.apply)(Object.defineProperty,null,[Object,"create",{value:customCreate}]);',
])("rejects intrinsic writes through a bound mutator: %s", (write) => {
expect(
analyzeJavaScriptStaticSource(
@@ -597,6 +600,7 @@ describe("Electron module interop bound mutators", () => {
'const {apply:change} = Object.defineProperty; change(null,[metadata,"x",{value:1}]);',
'Reflect.set(metadata,"x",1,{});',
'const receiver = {}; Reflect.set({},"x",1,receiver);',
'(0, Object.defineProperty)(metadata,"x",{value:1});',
])("keeps a fresh bound target or unused binding separate: %s", (write) => {
expect(
analyzeJavaScriptStaticSource(