Skip to content

Commit

Permalink
Implementation of Plugin/PluginArray/MimeType/MimeTypeArray rewritten…
Browse files Browse the repository at this point in the history
…. The navigator properties

plugins and mimeTypes returning static results in all browsers.
Class PluginConfiguration removed, the config is static for all browsers.
A bit more code cleanup - flash is finally gone.
  • Loading branch information
rbri committed Nov 20, 2024
1 parent 4104d0a commit cff71d2
Show file tree
Hide file tree
Showing 17 changed files with 740 additions and 449 deletions.
10 changes: 10 additions & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@

<body>
<release version="4.7.0" date="November xx, 2024" description="Bugfixes, Chrome/Edge 131">
<action type="update" dev="rbri">
Implementation of Plugin/PluginArray/MimeType/MimeTypeArray rewritten. The navigator properties
plugins and mimeTypes returning static results in all browsers.
</action>
<action type="remove" dev="rbri">
Class PluginConfiguration removed, the config is static for all browsers.
</action>
<action type="update" dev="rbri">
A bit more code cleanup - flash is finally gone.
</action>
<action type="update" dev="rbri">
Upgrade Apache commons-io to 2.18.0.
</action>
Expand Down
17 changes: 0 additions & 17 deletions src/main/java/org/htmlunit/BrowserVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.lang.reflect.Field;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -112,7 +111,6 @@ public final class BrowserVersion implements Serializable {
/** The default browser version. */
private static BrowserVersion DefaultBrowserVersion_ = BEST_SUPPORTED;

/* Register plugins for the browser versions. */
static {
FIREFOX_ESR.applicationVersion_ = "5.0 (Windows)";
FIREFOX_ESR.userAgent_ = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:"
Expand Down Expand Up @@ -401,7 +399,6 @@ public final class BrowserVersion implements Serializable {
private String platform_ = PLATFORM_WIN32;
private TimeZone systemTimezone_ = TimeZone.getTimeZone(TIMEZONE_NEW_YORK);
private String userAgent_;
private final Set<PluginConfiguration> plugins_;
private final Set<BrowserVersionFeatures> features_;
private String acceptEncodingHeader_;
private String acceptLanguageHeader_;
Expand Down Expand Up @@ -436,7 +433,6 @@ public final class BrowserVersion implements Serializable {
secClientHintUserAgentHeader_ = "";
secClientHintUserAgentPlatformHeader_ = "\"Windows\"";

plugins_ = new HashSet<>();
features_ = EnumSet.noneOf(BrowserVersionFeatures.class);
uploadMimeTypes_ = new HashMap<>();

Expand Down Expand Up @@ -732,15 +728,6 @@ public String getSecClientHintUserAgentPlatformHeader() {
return secClientHintUserAgentPlatformHeader_;
}

/**
* Returns the available plugins. This makes only sense for Firefox as only this
* browser makes this kind of information available via JavaScript.
* @return the available plugins
*/
public Set<PluginConfiguration> getPlugins() {
return plugins_;
}

/**
* Indicates if this instance has the given feature. Used for HtmlUnit internal processing.
* @param property the property name
Expand Down Expand Up @@ -872,10 +859,6 @@ public BrowserVersionBuilder(final BrowserVersion version) {
.setHeaderNamesOrdered(version.getHeaderNamesOrdered())
.setFontHeights(version.fontHeights_);

for (final PluginConfiguration pluginConf : version.getPlugins()) {
workPiece_.plugins_.add(pluginConf.clone());
}

workPiece_.features_.addAll(version.features_);
workPiece_.uploadMimeTypes_.putAll(version.uploadMimeTypes_);
}
Expand Down
194 changes: 0 additions & 194 deletions src/main/java/org/htmlunit/PluginConfiguration.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import org.htmlunit.javascript.host.Screen;
import org.htmlunit.javascript.host.ScreenOrientation;
import org.htmlunit.javascript.host.SharedWorker;
import org.htmlunit.javascript.host.SimpleArray;
import org.htmlunit.javascript.host.Storage;
import org.htmlunit.javascript.host.StorageManager;
import org.htmlunit.javascript.host.TextDecoder;
Expand Down Expand Up @@ -659,7 +658,7 @@ public final class JavaScriptConfiguration extends AbstractJavaScriptConfigurati
Screen.class, ScreenOrientation.class, ScriptProcessorNode.class,
SecurityPolicyViolationEvent.class, Selection.class, ServiceWorker.class, ServiceWorkerContainer.class,
ServiceWorkerRegistration.class,
ShadowRoot.class, SharedWorker.class, SimpleArray.class, SourceBuffer.class, SourceBufferList.class,
ShadowRoot.class, SharedWorker.class, SourceBuffer.class, SourceBufferList.class,
SpeechSynthesis.class, SpeechSynthesisErrorEvent.class, SpeechSynthesisEvent.class,
SpeechSynthesisUtterance.class, SpeechSynthesisVoice.class,
StereoPannerNode.class, Storage.class, StorageEvent.class, StorageManager.class,
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/htmlunit/javascript/host/MimeType.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* @author Ahmed Ashour
* @author Ronald Brill
*
* @see <a href="http://www.xulplanet.com/references/objref/MimeType.html">XUL Planet</a>
* @see <a href="https://developer.mozilla.org/en-US/docs/Web/API/MimeType">MimeType</a>
*/
@JsxClass
public class MimeType extends HtmlUnitScriptable {
Expand Down Expand Up @@ -98,7 +98,7 @@ public String getType() {
* @return the plugin
*/
@JsxGetter
public Object getEnabledPlugin() {
public Plugin getEnabledPlugin() {
return enabledPlugin_;
}
}
Loading

0 comments on commit cff71d2

Please sign in to comment.