зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1191292
- Keep ecma_6/Reflect/apply.js from permafailing when Gecko 42 merges to Aurora. r=Waldo.
--HG-- extra : commitid : EeGMbyJL0Du extra : rebase_source : a555132dee99b2a3b3e3816032d3a821f77fa29c extra : amend_source : 54942b865cd000c90626a71c6c22d5dfd3d3b0b1
This commit is contained in:
Родитель
09e6660ab4
Коммит
996744154e
|
@ -1 +1 @@
|
|||
load(libdir + "../../tests/ecma_6/Class/shell.js");
|
||||
load(libdir + "../../tests/ecma_6/shell.js");
|
||||
|
|
|
@ -4,15 +4,6 @@
|
|||
if (typeof version != 'undefined')
|
||||
version(185);
|
||||
|
||||
function classesEnabled() {
|
||||
try {
|
||||
new Function("class Foo { constructor() { } }");
|
||||
return true;
|
||||
} catch (e if e instanceof SyntaxError) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function assertThrownErrorContains(thunk, substr) {
|
||||
try {
|
||||
thunk();
|
||||
|
|
|
@ -5,8 +5,11 @@
|
|||
assertEq(Reflect.apply(Math.floor, undefined, [1.75]), 1);
|
||||
|
||||
// Reflect.apply requires a target object that's callable.
|
||||
class clsX { constructor() {} } // classes are not callable
|
||||
var nonCallable = [{}, [], clsX];
|
||||
var nonCallable = [{}, []];
|
||||
if (classesEnabled()) {
|
||||
// classes are not callable
|
||||
nonCallable.push(eval("(class clsX { constructor() {} })"));
|
||||
}
|
||||
for (var value of nonCallable) {
|
||||
assertThrowsInstanceOf(() => Reflect.apply(nonCallable), TypeError);
|
||||
}
|
||||
|
|
|
@ -30,16 +30,6 @@ var bound = f.bind(null, "carrot");
|
|||
assertDeepEq(Reflect.construct(bound, []), new bound);
|
||||
|
||||
// Classes:
|
||||
function classesEnabled(testCode = "class Foo { constructor() {} }") {
|
||||
try {
|
||||
new Function(testCode);
|
||||
return true;
|
||||
} catch (e) {
|
||||
if (!(e instanceof SyntaxError))
|
||||
throw e;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (classesEnabled()) {
|
||||
eval(`{
|
||||
class Base {
|
||||
|
|
|
@ -215,3 +215,14 @@ if (typeof assertWarning === 'undefined') {
|
|||
disableLastWarning();
|
||||
}
|
||||
}
|
||||
|
||||
function classesEnabled(testCode = "class Foo { constructor() {} }") {
|
||||
try {
|
||||
new Function(testCode);
|
||||
return true;
|
||||
} catch (e) {
|
||||
if (!(e instanceof SyntaxError))
|
||||
throw e;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче