Skip to content

Commit

Permalink
fix: finishRun stack overflow (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdnoC authored Sep 27, 2021
1 parent 566897a commit 41b817e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/com/deque/html/axecore/selenium/AxeBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public class AxeBuilder {
"var context = typeof arguments[0] === 'string' ? JSON.parse(arguments[0]) : arguments[0];" +
"context = context || document;" +
"var options = JSON.parse(arguments[1]);" +
"axe.run(context, options).then(callback)";
"axe.run(context, options).then(res => JSON.parse(JSON.stringify(res))).then(callback)";

public final String unsafeAllOrigins = "<unsafe_all_origins>";
public final String sameOrign = "<same_origin>";
Expand Down Expand Up @@ -129,8 +129,9 @@ public class AxeBuilder {
"const context = typeof arguments[0] == 'string' ? JSON.parse(arguments[0]) : arguments[0];" +
"const options = JSON.parse(arguments[1]);" +
"const cb = arguments[arguments.length - 1];" +
"window.c = context; window.o = options;" + // FIXME
"window.axe.runPartial(context, options).then(cb);";
// JSON passthrough removes propereties that are set to undefined. Fixes an infinite loop in
// finishRun
"window.axe.runPartial(context, options).then(res => JSON.parse(JSON.stringify(res))).then(cb);";

private static String frameContextScript =
"const context = typeof arguments[0] == 'string' ? JSON.parse(arguments[0]) : arguments[0];" +
Expand Down

0 comments on commit 41b817e

Please sign in to comment.