Skip to content

Commit

Permalink
Fix WebClient missing polyfill
Browse files Browse the repository at this point in the history
Thanks to @basil for raising awareness of this - jenkinsci/jenkins#9148 (comment).

We're now using the JavaScript fetch() API for the builds widget which requires 
a polyfill for HtmlUnit. This polyfill is enabled by default as part of the Jenkins 
test harness createWebClient(), however in this case that method wasn't used 
as a couple of methods of WebClient needed to be overridden.

This MR enables the polyfill for that web client.
  • Loading branch information
janfaracik authored Jun 14, 2024
1 parent 6461f7b commit 7edda3e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public AuthorizeProjectJenkinsRule(

@Override
public WebClient createWebClient() {
return new WebClient() {
WebClient webClient = new WebClient() {
private static final long serialVersionUID = 3389654318647204218L;

@Override
Expand All @@ -68,6 +68,8 @@ public void throwFailingHttpStatusCodeExceptionIfNecessary(WebResponse webRespon
super.throwFailingHttpStatusCodeExceptionIfNecessary(webResponse);
}
};
webClient.getOptions().setFetchPolyfillEnabled(true);
return webClient;
}

public void before() throws Throwable {
Expand Down

0 comments on commit 7edda3e

Please sign in to comment.