Skip to content

Commit

Permalink
tests: Test Proxy hasProperty override is called for hasOwnProperty
Browse files Browse the repository at this point in the history
  • Loading branch information
evilpie committed Jul 27, 2024
1 parent 1687739 commit 64c6782
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/tests/swfs/avm2/proxy_hasownproperty/Test.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package {
import flash.display.Sprite;

public class Test extends Sprite {
public function Test() {
var proxy: TestProxy = new TestProxy();
trace('// proxy["hasOwnProperty"](123)');
trace(proxy["hasOwnProperty"](123));

trace('// proxy.hasOwnProperty("foobar")');
trace(proxy.hasOwnProperty("foobar"));

trace('// Object.prototype.hasOwnProperty.call(proxy, "hello world")');
trace(Object.prototype.hasOwnProperty.call(proxy, "hello world"));
}
}
}

import flash.utils.Proxy;
import flash.utils.flash_proxy;

dynamic class TestProxy extends Proxy {
override flash_proxy function hasProperty(name:*):Boolean {
trace("hasProperty: " + typeof name + " " + name);
return name == "foobar";
}
}
8 changes: 8 additions & 0 deletions tests/tests/swfs/avm2/proxy_hasownproperty/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// proxy["hasOwnProperty"](123)
hasProperty: string 123
false
// proxy.hasOwnProperty("foobar")
hasProperty: string foobar
true
// Object.prototype.hasOwnProperty.call(proxy, "hello world")
false
Binary file not shown.
1 change: 1 addition & 0 deletions tests/tests/swfs/avm2/proxy_hasownproperty/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
num_ticks = 1

0 comments on commit 64c6782

Please sign in to comment.