Skip to content

Commit

Permalink
conditionallyCreatedFunction (issue #354)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Apr 10, 2023
1 parent 256925f commit 6506925
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<htmlunitcssparser.version>3.0.0</htmlunitcssparser.version>
<htmlunitneko.version>3.1.0-SNAPSHOT</htmlunitneko.version>
<htmlunitcorejs.version>3.0.0</htmlunitcorejs.version>
<htmlunitcorejs.version>3.1.0-SNAPSHOT</htmlunitcorejs.version>
<htmlunitxpath.version>3.0.0</htmlunitxpath.version>

<htmlunitdriver.version>4.8.3-SNAPSHOT</htmlunitdriver.version>
Expand Down
2 changes: 1 addition & 1 deletion src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
&lt;a href="http://code.google.com/p/googleappengine/issues/detail?id=4784"&gt; is solved.
</action>
<action type="fix" dev="rbri" issue="578">
Calls to hasOwnProperty() and getOwnPropertyDescriptor now takes care of form elements accessable from
Calls to hasOwnProperty() and getOwnPropertyDescriptor now taking care of form elements accessible from
the form object.
</action>
<action type="fix" dev="rbri">
Expand Down
21 changes: 21 additions & 0 deletions src/test/java/org/htmlunit/javascript/FunctionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,25 @@ public void boundFunction_toString() throws Exception {

loadPageVerifyTitle2(html);
}

/**
* @throws Exception if the test fails
*/
@Test
@Alerts("foo = undefined")
public void conditionallyCreatedFunction() throws Exception {
final String html
= "<html><head></head>\n"
+ "<body>\n"
+ "<script>\n"
+ LOG_TITLE_FUNCTION
+ " log('foo = ' + foo);\n"
+ " if (false) {\n"
+ " function foo() { return 1; }\n"
+ " }\n"
+ "</script>\n"
+ "</body></html>";

loadPageVerifyTitle2(html);
}
}

0 comments on commit 6506925

Please sign in to comment.