haikuwebkit/LayoutTests/js/instance-property-setter-ot...

16 lines
474 B
Plaintext
Raw Permalink Normal View History

Instance property getters / setters cannot be called on another instance of the same type https://bugs.webkit.org/show_bug.cgi?id=153895 Reviewed by Gavin Barraclough. Source/WebCore: It should be possible to call instance property getters / setters on other instances of the same type, as per the WEB IDL specification: - http://heycam.github.io/webidl/#dfn-attribute-getter - http://heycam.github.io/webidl/#dfn-attribute-setter This matches the behavior of Firefox. The issue without our bindings was that the getters / setters were using |slotBase| instead of |thisValue| and therefore ended up using the instance the getter was taken from instead of the actual target object. Test: js/instance-property-getter-other-instance.html js/instance-property-setter-other-instance.html * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): - Have instance getters / setters use thisValue instead of slotBase. - In the case of interfaces that have attributes on the instance for compatibility reasons, try the prototype object if |thisValue| does does have the right type, instead of using slotBase like previously. I believe this maintains the original compatibility intention while also behaving correctly when called on another instance. * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestException.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestNondeterministic.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * bindings/scripts/test/JS/JSattribute.cpp: Rebaseline bindings tests. LayoutTests: * js/dom/script-tests/shadow-navigator-geolocation-in-strict-mode-does-not-throw.js: * js/dom/shadow-navigator-geolocation-in-strict-mode-does-not-throw-expected.txt: Extend this layout test coverage to cover the getter case in addition to the setter case. This test covers the compatibility mode where we don't throw. I made sure to maintain this behavior when refactoring the bindings to avoid breakage. * js/instance-property-getter-other-instance-expected.txt: Rebaseline now that this test passes. * js/instance-property-setter-other-instance-expected.txt: Added. * js/instance-property-setter-other-instance.html: Added. Add test to cover the setter case. Canonical link: https://commits.webkit.org/172030@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196200 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-06 00:18:41 +00:00
Tests that calling an instance property setter on another instance works as expected
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS locationSetter is an instance of function Function() {
[native code]
}
PASS frames[0].document.location.toString() is "about:blank"
locationSetter.call(frames[0].document, 'resources/pass-and-finish.html')
PASS Changed iframe document's location
PASS successfullyParsed is true
TEST COMPLETE