From e21d42c2087605afe28c6527f3d8e3b562591cdb Mon Sep 17 00:00:00 2001 From: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> Date: Wed, 10 Mar 2021 15:00:00 +0100 Subject: [PATCH] =?UTF-8?q?[WebIDL]=20Test=C2=A0subclassing=20of=C2=A0lega?= =?UTF-8?q?cy=C2=A0factory=C2=A0functions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legacy-factor-function-subclass.window.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 WebIDL/ecmascript-binding/legacy-factor-function-subclass.window.js diff --git a/WebIDL/ecmascript-binding/legacy-factor-function-subclass.window.js b/WebIDL/ecmascript-binding/legacy-factor-function-subclass.window.js new file mode 100644 index 00000000000000..1fd64f41bb2e8e --- /dev/null +++ b/WebIDL/ecmascript-binding/legacy-factor-function-subclass.window.js @@ -0,0 +1,13 @@ +"use strict"; + +test(() => { + class CustomImage extends Image {} + var instance = new CustomImage(); + + assert_equals( + Object.getPrototypeOf(instance), CustomImage.prototype, + "Object.getPrototypeOf(instance) === CustomImage.prototype"); + + assert_true(instance instanceof CustomImage, "instance instanceof CustomImage"); + assert_true(instance instanceof HTMLImageElement, "instance instanceof HTMLImageElement"); +}, "[LegacyFactoryFunction] can be subclassed and correctly handles NewTarget");