Menu

#234 when variable name, function name conflict with keywords

Latest SVN
closed
None
5
2016-05-18
2005-02-28
Lu Wei
No

I am not sure whether this issue was raised before
when a variable/funname was accidentally chosen a name
overlaps with a "keyword", like "scroll" "navigator",
HTMLUNIT will fail.
actually in most browser's implementation, overwriting
of internal function is allowed. ie.

function alert(){
  scroll = "xxx";
  document.write(scroll);
}
function navigator(){
  alert("xxx");
}

the aboves can be executed in most of the browsers
without any problem.

Discussion

  • Marc Guillemot

    Marc Guillemot - 2007-08-20

    Logged In: YES
    user_id=402164
    Originator: NO

    Added unit test com.gargoylesoftware.htmlunit.javascript.host.WindowTest#testOverwriteFunctions() as notYetImplemented()

     
  • Marc Guillemot

    Marc Guillemot - 2007-08-20

    Logged In: YES
    user_id=402164
    Originator: NO

    Added unit test com.gargoylesoftware.htmlunit.javascript.host.WindowTest#testOverwriteFunctions() as notYetImplemented()

     
  • Daniel Gredler

    Daniel Gredler - 2008-07-09

    Logged In: YES
    user_id=1109422
    Originator: NO

    https://bugzilla.mozilla.org/show_bug.cgi?id=443491

     
  • Daniel Gredler

    Daniel Gredler - 2008-07-10

    Logged In: YES
    user_id=1109422
    Originator: NO

    This has been fixed in the latest Rhino builds (both Rhino proper and the HtmlUnit fork). Should be included with HtmlUnit 2.2.

     
  • Ahmed Ashour

    Ahmed Ashour - 2016-05-18
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -4,12 +4,16 @@
     HTMLUNIT will fail.
     actually in most browser's implementation, overwriting
     of internal function is allowed. ie.
    +
    +~~~
     function alert(){
    - scroll = "xxx";
    - document.write(scroll);
    +  scroll = "xxx";
    +  document.write(scroll);
     }
     function navigator(){
    - alert("xxx");
    +  alert("xxx");
     }
    +~~~
    +
     the aboves can be executed in most of the browsers
     without any problem.
    
    • Group: --> Latest SVN
     

Log in to post a comment.