mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 531682 - fixing eval(source, scope) to match 191, 192 semantics. r=mrbkap
This commit is contained in:
parent
4ab577e3c3
commit
969bdae222
@ -1404,7 +1404,9 @@ obj_eval(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
* with object to maintain invariants in the engine (see bug 520164).
|
||||
*/
|
||||
if (scopeobj->getParent()) {
|
||||
withObject = js_NewWithObject(cx, scopeobj, scopeobj->getParent(), 0);
|
||||
withObject = js_NewWithObject(cx, scopeobj,
|
||||
JS_GetGlobalForObject(cx, scopeobj),
|
||||
0);
|
||||
if (!withObject) {
|
||||
ok = JS_FALSE;
|
||||
goto out;
|
||||
|
35
js/src/tests/js1_4/Eval/regress-531682.js
Normal file
35
js/src/tests/js1_4/Eval/regress-531682.js
Normal file
@ -0,0 +1,35 @@
|
||||
/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/licenses/publicdomain/
|
||||
*/
|
||||
|
||||
var gTestfile = 'regress-531682.js';
|
||||
//-----------------------------------------------------------------------------
|
||||
var BUGNUMBER = 531682;
|
||||
var summary = 'Checking proper wrapping of scope in eval(source, scope)';
|
||||
var actual;
|
||||
var expect;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
var x = 0;
|
||||
|
||||
test();
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function scope1() {
|
||||
eval('var x = 1;');
|
||||
return function() { return x; }
|
||||
}
|
||||
|
||||
function test() {
|
||||
enterFunc ('test');
|
||||
printBugNumber(BUGNUMBER);
|
||||
printStatus (summary);
|
||||
|
||||
// The scope chain in eval should be just scope1() and the global object.
|
||||
actual = eval('x', scope1());
|
||||
expect = 0;
|
||||
reportCompare(expect, actual, summary);
|
||||
exitFunc ('test');
|
||||
}
|
Loading…
Reference in New Issue
Block a user