Skip to content

Commit 5f91190

Browse files
committed
support fileProtocolForXMLHttpRequestsAllowed option
1 parent 80b2253 commit 5f91190

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/main/java/org/openqa/selenium/htmlunit/options/HtmlUnitOption.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,25 @@ public void insert(final WebClientOptions options, final Object value) {
836836
public Object obtain(final WebClientOptions options) {
837837
return options.isFetchPolyfillEnabled();
838838
}
839+
},
840+
841+
/**
842+
* Sets whether or not the file protocol is allowed for XMLHttpRequests.
843+
* <p>
844+
* property: <b>webdriver.htmlunit.fileProtocolForXMLHttpRequestsAllowed</b><br>
845+
* type: {@code boolean}<br>
846+
* default: {@code false}
847+
*/
848+
FILE_PROTOCOL_FOR_XMLHTTPREQUESTS_ALLOWED(optFileProtocolForXMLHttpRequestsAllowed, boolean.class, false) {
849+
@Override
850+
public void insert(final WebClientOptions options, final Object value) {
851+
options.setFileProtocolForXMLHttpRequestsAllowed(TypeCodec.decodeBoolean(value));
852+
}
853+
854+
@Override
855+
public Object obtain(final WebClientOptions options) {
856+
return options.isFileProtocolForXMLHttpRequestsAllowed();
857+
}
839858
};
840859

841860
private final String capabilityKey_;

src/main/java/org/openqa/selenium/htmlunit/options/HtmlUnitOptionNames.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,7 @@ public interface HtmlUnitOptionNames {
138138

139139
/** "fetchPolyfillEnabled". */
140140
String optFetchPolyfillEnabled = "fetchPolyfillEnabled";
141+
142+
/** "fileProtocolForXMLHttpRequestsAllowed". */
143+
String optFileProtocolForXMLHttpRequestsAllowed = "fileProtocolForXMLHttpRequestsAllowed";
141144
}

0 commit comments

Comments
 (0)