Skip to content

Commit

Permalink
Window.postMessage() throws a SyntaxError
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Feb 2, 2025
1 parent 889f24e commit 1cf107e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

<body>
<release version="4.10.0" date="February xx, 2025" description="Bugfixes">
<action type="fix" dev="rbri">
Window.postMessage() throws a SyntaxError.
</action>
<action type="fix" dev="rbri">
Window.atob()/btoa() throws an InvalidCharacterError.
</action>
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/org/htmlunit/javascript/host/Window.java
Original file line number Diff line number Diff line change
Expand Up @@ -1983,10 +1983,9 @@ public static void postMessage(final Context context, final Scriptable scope,
targetURL = new URL(targetOrigin);
}
catch (final Exception e) {
throw JavaScriptEngine.throwAsScriptRuntimeEx(
new Exception(
"SyntaxError: Failed to execute 'postMessage' on 'Window': Invalid target origin '"
+ targetOrigin + "' was specified (reason: " + e.getMessage() + "."));
throw JavaScriptEngine.syntaxError(
"Failed to execute 'postMessage' on 'Window': Invalid target origin '"
+ targetOrigin + "' was specified (reason: " + e.getMessage() + ".");
}
}

Expand Down

0 comments on commit 1cf107e

Please sign in to comment.