| <!DOCTYPE html> |
| <meta charset=utf-8> |
| <title>KeyframeEffect::getKeyframes should use correct context</title> |
| |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script src="../../external/wpt/web-animations/testcommon.js"></script> |
| |
| <div id="elem"></div> |
| <iframe id="iframe"></iframe> |
| |
| <script> |
| "use strict"; |
| |
| // This test checks a particularly nasty corner-case of getKeyframes(). Because |
| // getKeyframes() manually constructs a JavaScript object to pass back, care |
| // must be taken to ensure that the resultant object is in the same context as |
| // the KeyframeEffect object it is being applied to. |
| test(function(t) { |
| const effect = new KeyframeEffect(elem, [ |
| { left: "0px" }, |
| { left: "20px" } |
| ], 1000); |
| const iframe = document.getElementById("iframe"); |
| const keyframes = iframe.contentWindow.KeyframeEffect.prototype |
| .getKeyframes.apply(effect); |
| |
| assert_equals(Object.getPrototypeOf(keyframes[0]), Object.prototype); |
| }, "Applying getKeyframes to a KeyframeEffect object from another " |
| + " frame should produce keyframes in the same frame as the object."); |
| |
| </script> |
| |