Skip to content

Commit

Permalink
Proxy support is there
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Aug 17, 2023
1 parent a62ab35 commit 23000d9
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 339 deletions.
6 changes: 0 additions & 6 deletions src/main/java/org/htmlunit/BrowserVersionFeatures.java
Original file line number Diff line number Diff line change
Expand Up @@ -671,12 +671,6 @@ public enum BrowserVersionFeatures {
@BrowserFeature({CHROME, EDGE, FF, FF_ESR})
JS_API_FETCH,

/**
* Javascript proxy api is supported.
*/
@BrowserFeature({CHROME, EDGE, FF, FF_ESR})
JS_API_PROXY,

/** An area element without a href attribute is focusable. */
@BrowserFeature({FF, FF_ESR})
JS_AREA_WITHOUT_HREF_FOCUSABLE,
Expand Down
16 changes: 0 additions & 16 deletions src/main/java/org/htmlunit/WebClientOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ public class WebClientOptions implements Serializable {
private int webSocketMaxBinaryMessageBufferSize_ = -1;

private boolean isFetchPolyfillEnabled_;
private boolean isProxyPolyfillEnabled_;

/**
* If set to {@code true}, the client will accept connections to any host, regardless of
Expand Down Expand Up @@ -838,19 +837,4 @@ public void setFetchPolyfillEnabled(final boolean enabled) {
public boolean isFetchPolyfillEnabled() {
return isFetchPolyfillEnabled_;
}

/**
* Sets whether or not proxy polyfill should be used.
* @param enabled true to enable proxy polyfill
*/
public void setProxyPolyfillEnabled(final boolean enabled) {
isProxyPolyfillEnabled_ = enabled;
}

/**
* @return true if the proxy api polyfill is enabled
*/
public boolean isProxyPolyfillEnabled() {
return isProxyPolyfillEnabled_;
}
}
6 changes: 1 addition & 5 deletions src/main/java/org/htmlunit/javascript/JavaScriptEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package org.htmlunit.javascript;

import static org.htmlunit.BrowserVersionFeatures.JS_API_FETCH;
import static org.htmlunit.BrowserVersionFeatures.JS_API_PROXY;
import static org.htmlunit.BrowserVersionFeatures.JS_ARRAY_FROM;
import static org.htmlunit.BrowserVersionFeatures.JS_CONSOLE_TIMESTAMP;
import static org.htmlunit.BrowserVersionFeatures.JS_ERROR_CAPTURE_STACK_TRACE;
Expand Down Expand Up @@ -241,6 +240,7 @@ private void init(final WebWindow webWindow, final Page page, final Context cont

if (!browserVersion.hasFeature(JS_REFLECT)) {
deleteProperties(window, "Reflect");
deleteProperties(window, "Proxy");
}

final ScriptableObject errorObject = (ScriptableObject) ScriptableObject.getProperty(window, "Error");
Expand Down Expand Up @@ -549,10 +549,6 @@ public static void applyPolyfills(final WebClient webClient, final BrowserVersio
if (webClient.getOptions().isFetchPolyfillEnabled() && browserVersion.hasFeature(JS_API_FETCH)) {
Polyfill.getFetchPolyfill().apply(context, scriptable);
}

if (webClient.getOptions().isProxyPolyfillEnabled() && browserVersion.hasFeature(JS_API_PROXY)) {
Polyfill.getProxyPolyfill().apply(context, scriptable);
}
}

private static void defineConstructor(final Window window,
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/org/htmlunit/javascript/polyfill/Polyfill.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ public static Polyfill getFetchPolyfill() throws IOException {
return getPolyfill("fetch/fetch.umd.js");
}

public static Polyfill getProxyPolyfill() throws IOException {
return getPolyfill("proxy/es6-proxy-polyfill.js");
}

private static Polyfill getPolyfill(final String resouceName) throws IOException {
Polyfill poly = CACHE.get(resouceName);
if (poly != null) {
Expand Down
191 changes: 0 additions & 191 deletions src/main/resources/org/htmlunit/javascript/polyfill/proxy/LICENSE

This file was deleted.

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions src/test/java/org/htmlunit/general/HostClassNameTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7426,10 +7426,6 @@ public void promiseResolver() throws Exception {
FF = "function Proxy() {\n [native code]\n}",
IE = "exception",
FF_ESR = "function Proxy() {\n [native code]\n}")
@HtmlUnitNYI(CHROME = "exception",
EDGE = "exception",
FF = "exception",
FF_ESR = "exception")
public void proxy() throws Exception {
test("Proxy");
}
Expand Down
Loading

0 comments on commit 23000d9

Please sign in to comment.