[Webkit-unassigned] [Bug 19844] New: JavaScript Switch statement modifies "this"

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 1 07:23:30 PDT 2008


https://bugs.webkit.org/show_bug.cgi?id=19844

           Summary: JavaScript Switch statement modifies "this"
           Product: WebKit
           Version: 526+ (Nightly build)
          Platform: Macintosh
        OS/Version: Mac OS X 10.5
            Status: UNCONFIRMED
          Severity: Critical
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: fabian.jakobs at 1und1.de


I have encountered a strange error with the latest nightlys (rev. 34824).

Special switch statements seem to modifiy the function context (aka this) and
set if to the value "false". This can be observed in this simple example.


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">
<body>
<script type="text/javascript" charset="utf-8">

function test() {
    alert(this == switchFunction.call(this, 12));
}

function switchFunction(val)
{
  switch (val)
  {
    case this:
      break;

    default:
      break;
  }
  return this;
}
test();

</script>

</body>
</html>


-- 
Configure bugmail: https://bugs.webkit.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