Skip to content

Commit

Permalink
more on error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Feb 2, 2025
1 parent 5e09025 commit 314f842
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/test/java/org/htmlunit/javascript/host/ReflectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,38 +70,38 @@ public void applyDetails() throws Exception {
}

@Test
@Alerts("exception")
@Alerts("TypeError")
public void applyMissingArgs() throws Exception {
final String js =
"try {\n"
+ " Reflect.apply();\n"
+ "} catch(e) {\n"
+ " log('exception');\n"
+ " log(e.name);\n"
+ "}";
test(js);
}

@Test
@Alerts("exception")
@Alerts("TypeError")
public void applyTargetNotFunction() throws Exception {
final String js =
"try {\n"
+ " Reflect.apply({}, undefined, [1.75]);\n"
+ "} catch(e) {\n"
+ " log('exception');\n"
+ " log(e.name);\n"
+ "}";
test(js);
}

@Test
@Alerts("exception")
@Alerts("TypeError")
public void applyArgumentsListNotFunction() throws Exception {
final String js =
"var s1 = Symbol('1');"
+ "try {\n"
+ " Reflect.apply(Math.floor, undefined, s1);\n"
+ "} catch(e) {\n"
+ " log('exception');\n"
+ " log(e.name);\n"
+ "}";
test(js);
}
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/org/htmlunit/javascript/host/ScreenTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public void orientation() throws Exception {
+ " log(o);\n"
+ " log(o.type);\n"
+ " log(o.angle);\n"
+ " } catch(e) { log('exception') }\n"
+ " } catch(e) { log(e.name) }\n"
+ " }\n"
+ " </script>\n"
+ "</head>\n"
Expand All @@ -291,7 +291,7 @@ public void mozOrientation() throws Exception {
+ " try {\n"
+ " var o = window.screen.mozOrientation;"
+ " log(o);\n"
+ " } catch(e) { log('exception') }\n"
+ " } catch(e) { log(e.name) }\n"
+ " }\n"
+ " </script>\n"
+ "</head>\n"
Expand All @@ -315,7 +315,7 @@ public void isExtended() throws Exception {
+ " function doTest() {\n"
+ " try {\n"
+ " log(window.screen.isExtended);\n"
+ " } catch(e) { log('exception') }\n"
+ " } catch(e) { log(e.name) }\n"
+ " }\n"
+ " </script>\n"
+ "</head>\n"
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/htmlunit/javascript/host/SetTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public void constructorIteratorParam() throws Exception {
+ " var mySet = new Set(myIterable);\n"
+ " log(mySet.size);\n"
+ " mySet.forEach(logElement);\n"
+ " } catch(e) { log('exception'); }"
+ " } catch(e) { log(e.name); }"
+ "}\n"
+ "</script></head>\n"
+ "<body onload='test()'>\n"
Expand Down

0 comments on commit 314f842

Please sign in to comment.