Skip to content

Commit 58a7bcc

Browse files
authored
Merge branch 'main-4.x' into issue-2540
2 parents c309712 + 0e4fcc5 commit 58a7bcc

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

java-accessibility-checker/src/main/java/com/ibm/able/equalaccess/enginecontext/EngineContextLocal.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public void loadEngine() {
4141
// Creates and enters a Context. The Context stores information
4242
// about the execution environment of a script.
4343
engine = Context.enter();
44+
engine.setLanguageVersion(Context.VERSION_ES6);
4445

4546
// Initialize the standard objects (Object, Function, etc.)
4647
// This must be done before scripts can be executed. Returns
@@ -92,13 +93,14 @@ public String encodeURIComponent(String s) {
9293
// Creates and enters a Context. The Context stores information
9394
// about the execution environment of a script.
9495
engine = Context.enter();
96+
engine.setLanguageVersion(Context.VERSION_ES6);
9597

9698
// Initialize the standard objects (Object, Function, etc.)
9799
// This must be done before scripts can be executed. Returns
98100
// a scope object that we use in later calls.
99101
engineScope = engine.initStandardObjects();
100102
}
101-
String scriptStr = String.format("encodeURIComponent(`%s`)", s.replace("\"", "\\\""));
103+
String scriptStr = String.format("encodeURIComponent(%s)", gson.toJson(s));
102104
return engine.evaluateString(engineScope, scriptStr, "<cmd>", 1, null).toString();
103105
}
104106

@@ -109,7 +111,7 @@ public String getProfile() {
109111

110112
@Override
111113
public String getHelp(String ruleId, String reasonId, String helpRoot) {
112-
String scriptStr = String.format("ace_checker.engine.getHelp(`%s`,`%s`,`%s`)", ruleId, reasonId, helpRoot);
114+
String scriptStr = String.format("ace_checker.engine.getHelp(%s,%s,%s)", gson.toJson(ruleId), gson.toJson(reasonId), gson.toJson(helpRoot));
113115
return engine.evaluateString(engineScope, scriptStr, "<cmd>", 1, null).toString();
114116
}
115117
}

0 commit comments

Comments
 (0)