зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1313490 - Part 2: Remove unnecessary expression closure from jstests. r=evilpie
This commit is contained in:
Родитель
b15d6aadc1
Коммит
a6acd75a3a
|
@ -27,7 +27,7 @@ function run_test() {
|
|||
|
||||
var timer = new Timer;
|
||||
var next = query.slice(1);
|
||||
timer.initWithCallback({ notify: function() doSearch(next) });
|
||||
timer.initWithCallback({ notify: function() { return doSearch(next); } });
|
||||
}
|
||||
});
|
||||
})("title");
|
||||
|
|
|
@ -86,11 +86,11 @@ assertEq(testLenientAndStrict('Function("x","y","\'use strict\'")',
|
|||
* The parameter lists of function expressions should not contain
|
||||
* duplicate identifiers.
|
||||
*/
|
||||
assertEq(testLenientAndStrict('(function (x,x) 2)',
|
||||
assertEq(testLenientAndStrict('(function (x,x) {})',
|
||||
parsesSuccessfully,
|
||||
parseRaisesException(SyntaxError)),
|
||||
true);
|
||||
assertEq(testLenientAndStrict('(function (x,y) 2)',
|
||||
assertEq(testLenientAndStrict('(function (x,y) {})',
|
||||
parsesSuccessfully,
|
||||
parsesSuccessfully),
|
||||
true);
|
||||
|
@ -173,19 +173,19 @@ assertEq(testLenientAndStrict('(function eval(){"use strict";})',
|
|||
parseRaisesException(SyntaxError),
|
||||
parseRaisesException(SyntaxError)),
|
||||
true);
|
||||
assertEq(testLenientAndStrict('(function f(eval) 2)',
|
||||
assertEq(testLenientAndStrict('(function f(eval) {})',
|
||||
parsesSuccessfully,
|
||||
parseRaisesException(SyntaxError)),
|
||||
true);
|
||||
assertEq(testLenientAndStrict('(function f([eval]) 2)',
|
||||
assertEq(testLenientAndStrict('(function f([eval]) {})',
|
||||
parsesSuccessfully,
|
||||
parseRaisesException(SyntaxError)),
|
||||
true);
|
||||
assertEq(testLenientAndStrict('(function f({x:eval}) 2)',
|
||||
assertEq(testLenientAndStrict('(function f({x:eval}) {})',
|
||||
parsesSuccessfully,
|
||||
parseRaisesException(SyntaxError)),
|
||||
true);
|
||||
assertEq(testLenientAndStrict('(function eval() 2)',
|
||||
assertEq(testLenientAndStrict('(function eval() {})',
|
||||
parsesSuccessfully,
|
||||
parseRaisesException(SyntaxError)),
|
||||
true);
|
||||
|
@ -277,19 +277,19 @@ assertEq(testLenientAndStrict('(function arguments(){"use strict";})',
|
|||
parseRaisesException(SyntaxError),
|
||||
parseRaisesException(SyntaxError)),
|
||||
true);
|
||||
assertEq(testLenientAndStrict('(function f(arguments) 2)',
|
||||
assertEq(testLenientAndStrict('(function f(arguments) {})',
|
||||
parsesSuccessfully,
|
||||
parseRaisesException(SyntaxError)),
|
||||
true);
|
||||
assertEq(testLenientAndStrict('(function f([arguments]) 2)',
|
||||
assertEq(testLenientAndStrict('(function f([arguments]) {})',
|
||||
parsesSuccessfully,
|
||||
parseRaisesException(SyntaxError)),
|
||||
true);
|
||||
assertEq(testLenientAndStrict('(function f({x:arguments}) 2)',
|
||||
assertEq(testLenientAndStrict('(function f({x:arguments}) {})',
|
||||
parsesSuccessfully,
|
||||
parseRaisesException(SyntaxError)),
|
||||
true);
|
||||
assertEq(testLenientAndStrict('(function arguments() 2)',
|
||||
assertEq(testLenientAndStrict('(function arguments() {})',
|
||||
parsesSuccessfully,
|
||||
parseRaisesException(SyntaxError)),
|
||||
true);
|
||||
|
|
|
@ -10,7 +10,7 @@ assertThrowsInstanceOf(() => eval('new.target'), SyntaxError);
|
|||
// new.target is invalid inside indirect eval.
|
||||
let ieval = eval;
|
||||
try {
|
||||
(function () ieval('new.target'))();
|
||||
(function () { return ieval('new.target'); })();
|
||||
assertEq(false, true);
|
||||
} catch (e if e instanceof SyntaxError) { }
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ var expect = '';
|
|||
printBugNumber(BUGNUMBER);
|
||||
printStatus (summary);
|
||||
|
||||
(this.__defineGetter__("x", function (x)'foo'.replace(/o/g, [1].push)));
|
||||
(this.__defineGetter__("x", function (x) { return 'foo'.replace(/o/g, [1].push); }));
|
||||
for(let y in [,,,]) for(let y in [,,,]) x = x;
|
||||
|
||||
reportCompare(expect, actual, summary);
|
||||
|
|
|
@ -22,7 +22,7 @@ function test()
|
|||
|
||||
try
|
||||
{
|
||||
this.__defineGetter__('x', function() 2); for (var j=0;j<4;++j) { x=1; }
|
||||
this.__defineGetter__('x', function() { return 2; }); for (var j=0;j<4;++j) { x=1; }
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ function test()
|
|||
expect = 'TypeError: [].__proto__ is not a function';
|
||||
|
||||
|
||||
Array.prototype.__proto__ = function () 3;
|
||||
Array.prototype.__proto__ = function () { return 3; };
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ function test()
|
|||
printStatus (summary);
|
||||
|
||||
|
||||
for (var j=0;j<5;++j) (new (function(q) q)).a;
|
||||
for (var j=0;j<5;++j) (new (function(q) { return q; })).a;
|
||||
|
||||
|
||||
reportCompare(expect, actual, summary);
|
||||
|
|
|
@ -53,8 +53,9 @@ var url=new SNI.Ads.Url();
|
|||
this.addParameter=url.addParameter;
|
||||
this.getParameter=url.getParameter;
|
||||
}
|
||||
function DartAd()
|
||||
AdUrl.prototype=new Ad();
|
||||
function DartAd() {
|
||||
return AdUrl.prototype=new Ad();
|
||||
}
|
||||
function AdUrl() { }
|
||||
function AdRestriction() {
|
||||
var p=new SNI.MetaData.Parameter();
|
||||
|
|
|
@ -22,7 +22,7 @@ function test()
|
|||
|
||||
|
||||
for (let f in [1,1]);
|
||||
Object.prototype.__defineGetter__('x', function() gc());
|
||||
Object.prototype.__defineGetter__('x', function() { return gc(); });
|
||||
(function() { for each (let j in [1,1,1,1,1]) { var y = .2; } })();
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ function test()
|
|||
|
||||
try
|
||||
{
|
||||
var o = {toString: function()(i > 2) ? this : "foo"};
|
||||
var o = {toString: function() { return (i > 2) ? this : "foo"; }};
|
||||
var s = "";
|
||||
for (var i = 0; i < 5; i++)
|
||||
s += o + o;
|
||||
|
|
|
@ -23,7 +23,7 @@ function test()
|
|||
expect = '11111';
|
||||
|
||||
|
||||
(function(d) { for (let j = 0; j < 5; ++j) { actual += ('' + d); } })({valueOf: function()1});
|
||||
(function(d) { for (let j = 0; j < 5; ++j) { actual += ('' + d); } })({valueOf: function() { return 1; }});
|
||||
|
||||
|
||||
reportCompare(expect, actual, summary);
|
||||
|
|
|
@ -20,7 +20,7 @@ function test()
|
|||
printBugNumber(BUGNUMBER);
|
||||
printStatus (summary);
|
||||
|
||||
(function() { x = 0; function x() 4; var x; const y = 1; })();
|
||||
(function() { x = 0; function x() { return 4; }; var x; const y = 1; })();
|
||||
|
||||
reportCompare(expect, actual, summary);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ function test()
|
|||
|
||||
(function (){
|
||||
var x;
|
||||
eval("var x; (function ()x)");
|
||||
eval("var x; (function () { return x; })");
|
||||
}
|
||||
)();
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ function test()
|
|||
|
||||
// ------- Comment #27 From Brendan Eich
|
||||
|
||||
function f(x){function g(y)x+y;return g}
|
||||
function f(x){function g(y) { return x+y; } return g}
|
||||
g = f(2);
|
||||
|
||||
actual = String(g(3));
|
||||
|
|
|
@ -24,7 +24,7 @@ function test()
|
|||
|
||||
// ------- Comment #79 From Jason Orendorff
|
||||
|
||||
x; var x; function x() 0
|
||||
x; var x; function x() { return 0; }
|
||||
|
||||
// Assertion failure: !(pn->pn_dflags & flag), at ../jsparse.h:635
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ function test()
|
|||
|
||||
// =====
|
||||
|
||||
(function(){function x(){} function x()y})();
|
||||
(function(){function x(){} function x() { return y; }})();
|
||||
|
||||
// Assertion failure: JOF_OPTYPE(op) == JOF_ATOM, at ../jsemit.cpp:1710
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ function test()
|
|||
// ------- Comment #121 From Gary Kwong [:nth10sd]
|
||||
|
||||
// without -j
|
||||
x = function()x;
|
||||
x = function() { return x; };
|
||||
|
||||
// Assertion failure: !(pn->pn_dflags & flag), at ../jsparse.h:651
|
||||
|
||||
|
|
|
@ -22,12 +22,12 @@ function test()
|
|||
printStatus (summary);
|
||||
|
||||
// crash [@ js_Interpret]
|
||||
(eval("(function(){ this.watch(\"x\", function () { new function ()y } ); const y = undefined });"))();
|
||||
(eval("(function(){ this.watch(\"x\", function () { new function () { return y; } } ); const y = undefined });"))();
|
||||
x = NaN;
|
||||
reportCompare(expect, actual, summary + ': 2');
|
||||
|
||||
// Assertion failure: JOF_OPTYPE(op) == JOF_ATOM, at ../jsemit.cpp:5916
|
||||
({ set z(v){}, set y(v)--x, set w(v)--w });
|
||||
({ set z(v){}, set y(v) { return --x; }, set w(v) { return --w; } });
|
||||
reportCompare(expect, actual, summary + ': 3');
|
||||
|
||||
exitFunc ('test');
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
var sandbox = evalcx('');
|
||||
var foreign = evalcx('({ get f() this, set x(v) { result = this } })', sandbox);
|
||||
var foreign = evalcx('({ get f() { return this; }, set x(v) { result = this } })', sandbox);
|
||||
var local = Object.create(foreign);
|
||||
|
||||
reportCompare(local, local.f, "this should be set correctly in getters");
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// http://creativecommons.org/licenses/publicdomain/
|
||||
|
||||
(function () {
|
||||
var [x, y] = [1, function () x];
|
||||
var [x, y] = [1, function () { return x; }];
|
||||
assertEq(y(), 1);
|
||||
})();
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
(function () {
|
||||
var obj = {prop: 1};
|
||||
var [x, {prop: y}] = [function () y, obj];
|
||||
var [x, {prop: y}] = [function () { return y; }, obj];
|
||||
assertEq(y, 1);
|
||||
assertEq(x(), 1);
|
||||
})();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// http://creativecommons.org/licenses/publicdomain/
|
||||
|
||||
(function () {
|
||||
var [x, y] = [function () y, 13];
|
||||
var [x, y] = [function () { return y; }, 13];
|
||||
assertEq(x(), 13);
|
||||
})();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче