[Webkit-unassigned] [Bug 7751] Scope is broken with nested evals inside of functions.

bugzilla-daemon at opendarwin.org bugzilla-daemon at opendarwin.org
Mon Mar 13 05:13:49 PST 2006


http://bugzilla.opendarwin.org/show_bug.cgi?id=7751





------- Comment #1 from tolmasky at gmail.com  2006-03-13 05:13 PDT -------
Created an attachment (id=7046)
 --> (http://bugzilla.opendarwin.org/attachment.cgi?id=7046&action=view)
Breaks scope.

We should be seeing this alerted:

yup!
[Object Window]
function a() ...
function a() ...
function a() ...
true
Bluebird of happiness

(run it through firefox, it will gives this result).
However, we instead get this:

yup!
[Obejct Window]
undefined
function a()...
undefined
true
Bluebird of happiness

The strange thing is that "this" really thinks its window, but it doesn't
behave like it since a() doesnt get registered into window.

If you comment out the r function, so that everything that happens is global,
like this:

<script>

alert("yup!");

//function r()
//{
    var predefined_js= "alert(this);function a(){alert('bluebird of
happiness');}alert(this.a);alert(a);alert(window.a);alert(this===window);";
    var main_js= "eval.apply(window, [predefined_js]); main= function() { a();
return 0; }";

    eval.apply(window, [main_js]);
//}

//r();

main();

</script>

Now it works as it should.


-- 
Configure bugmail: http://bugzilla.opendarwin.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list