Files
palemoon27/js/src/tests/ecma_6/Class/methodOverwrites.js
T
roytam1 395e2e581b import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1219494 - Part 2. gfx/2d and gfxCrash. r=milan (2beb096938)
- Bug 1233069 - add override declarations to Windows graphics headers; r=Bas (a7f6e7d7f4)
- Bug 1230357. Enable subpixel text on skia content backends. r=lsalzman (86d91dece3)
- Bug 1225977 - fix DrawTargetSkia::MaskSurface with non-zero offset. r=jmuizelaar (5d63e35dc7)
- Bug 1230740 - wallpaper patch for a missing nullptr scenario. r=bas (bdfadb90ae)
- Bug 1233401 - Do Statistics static initialization from JS_Init; r=jandem (5f8383cd4a)
- Bug 1232113 - "Make the format specifiers in JS_snprintf() invocations more portable". r=evilpies (4b0481a222)
- Bug 1233722 - Add a documentation comment for JSOP_DEBUGCHECKSELFHOSTED. DONTBUILD. r=efaust (741fedfca9)
- Bug 1233722 - Followup: Differentiate between non-debug and opt builds. (rs=arai) DONTBUILD comment-only (234db53445)
- Bug 1227144 - Remove unused AutoRegExpStaticsBuffer; r=jonco (b7a21b5471)
- Bug 1233302: Don't seed the SavedStacks PRNG unless we're actually going to use it. r=fitzgen (4763a5eab5)
- Bug 1233187 - Use normal Rooted for AutoLocationValueRooter; r=fitzgen (90aea4363c)
- Bug 1208850 - Inline functions exported to self-hosting global. r=till (b0fbfc7245)
- Bug 1197932 - Remove Nightly-only restriction from ES6 Classes. (r=jorendorff) (11e58dfe79)
- Bug 1233011 - SharedArrayBuffer subclassing + tests. r=efaust (95c08f129e)
- Bug 1232264 - SharedArrayBuffer is only a constructor. r=arai (ae98086e9b)
- Bug 1233863 - ARM64: Set up pseudo stack pointer in proglogues. r=sstangl (9db659f62b)
- Bug 1232269 - Use the correct receiver when calling an own getter or setter on an unboxed object, r=jandem. (b28b8e4061)
- Bug 1233096 - Give JS::ubi::RootList its full type name as its concreteTypeName; r=jimb (6cab2fd056)
- Bug 1229829 - make sameBuffer more discriminating. r=waldo (fa7723a152)
- Bug 1233175 - refine an assertion. r=terrence (3bc1da0783)
- Bug 1231314 - Turn mozilla-config.h and js-confdefs.h into CONFIGURE_DEFINE_FILES. r=gps (b20e88acbb)
- Bug 1233966 - build fixes for FreeBSD. r=jrmuizel (a94c01b3aa)
2023-06-15 15:50:32 +08:00

81 lines
2.6 KiB
JavaScript

// Ensure that we can overwrite methods when more tha one is present.
{
var result = 0;
// Regardless of order, the constructor is overridden by any CPN, because it's
// processed seperately.
class a { ["constructor"]() { result += 1; }; constructor() { result += 2; } }
var aInst = new a();
assertEq(result, 2);
aInst.constructor();
assertEq(result, 3);
class b { constructor() { result += 2; } ["constructor"]() { result += 1; }; }
var bInst = new b();
assertEq(result, 5);
bInst.constructor();
assertEq(result, 6);
class c { constructor() { } method() { result += 1 } get method() { result += 2 } }
new c().method;
assertEq(result, 8);
class d { constructor() { } get method() { result += 1 } method() { result += 2 } }
new d().method();
assertEq(result, 10);
// getters and setter should not overwrite each other, but merge cleanly.
class e { constructor() { } get method() { result += 1 } set method(x) { } }
new e().method;
assertEq(result, 11);
class f { constructor() { }
set method(x) { throw "NO"; }
method() { throw "NO" }
get method() { return new Function("result += 1"); }
}
new f().method();
assertEq(result, 12);
}
// Try again with expressions.
{
var result = 0;
// Regardless of order, the constructor is overridden by any CPN, because it's
// processed seperately.
let a = class { ["constructor"]() { result += 1; }; constructor() { result += 2; } };
var aInst = new a();
assertEq(result, 2);
aInst.constructor();
assertEq(result, 3);
let b = class { constructor() { result += 2; } ["constructor"]() { result += 1; }; };
var bInst = new b();
assertEq(result, 5);
bInst.constructor();
assertEq(result, 6);
let c = class { constructor() { } method() { result += 1 } get method() { result += 2 } };
new c().method;
assertEq(result, 8);
let d = class { constructor() { } get method() { result += 1 } method() { result += 2 } };
new d().method();
assertEq(result, 10);
// getters and setter should not overwrite each other, but merge cleanly.
let e = class { constructor() { } get method() { result += 1 } set method(x) { } };
new e().method;
assertEq(result, 11);
let f = class { constructor() { }
set method(x) { throw "NO"; }
method() { throw "NO" }
get method() { return new Function("result += 1"); }
};
new f().method();
assertEq(result, 12);
}
if (typeof reportCompare === "function")
reportCompare(0, 0, "OK");