Skip to content

Commit

Permalink
Remove remaining Java code in HTMLObjectElement
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=255327
rdar://107955360

Reviewed by Chris Dumez.

Java has been gone from the web for a while now.

* Source/WebCore/html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::parametersForPlugin):
(WebCore::HTMLObjectElement::updateWidget):
(WebCore::HTMLObjectElement::hasValidClassId): Deleted.
* Source/WebCore/html/HTMLObjectElement.h:
* Source/WebCore/platform/MIMETypeRegistry.cpp:
(WebCore::MIMETypeRegistry::isJavaAppletMIMEType): Deleted.
* Source/WebCore/platform/MIMETypeRegistry.h:

Canonical link: https://commits.webkit.org/263275@main
  • Loading branch information
annevk committed Apr 22, 2023
1 parent a093df4 commit 8159c43
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 38 deletions.
26 changes: 4 additions & 22 deletions Source/WebCore/html/HTMLObjectElement.cpp
Expand Up @@ -186,17 +186,6 @@ void HTMLObjectElement::parametersForPlugin(Vector<AtomString>& paramNames, Vect
}
}

// When OBJECT is used for an applet via Sun's Java plugin, the CODEBASE attribute in the tag
// points to the Java plugin itself (an ActiveX component) while the actual applet CODEBASE is
// in a PARAM tag. See <http://java.sun.com/products/plugin/1.2/docs/tags.html>. This means
// we have to explicitly suppress the tag's CODEBASE attribute if there is none in a PARAM,
// else our Java plugin will misinterpret it. [4004531]
String codebase;
if (MIMETypeRegistry::isJavaAppletMIMEType(serviceType)) {
codebase = "codebase"_s;
uniqueParamNames.add(codebase.impl()); // pretend we found it in a PARAM already
}

// Turn the attributes of the <object> element into arrays, but don't override <param> values.
if (hasAttributes()) {
for (const Attribute& attribute : attributesIterator()) {
Expand Down Expand Up @@ -235,16 +224,6 @@ bool HTMLObjectElement::hasFallbackContent() const
return false;
}

bool HTMLObjectElement::hasValidClassId()
{
if (MIMETypeRegistry::isJavaAppletMIMEType(serviceType()) && protocolIs(attributeWithoutSynchronization(classidAttr), "java"_s))
return true;

// HTML5 says that fallback content should be rendered if a non-empty
// classid is specified for which the UA can't find a suitable plug-in.
return attributeWithoutSynchronization(classidAttr).isEmpty();
}

// FIXME: This should be unified with HTMLEmbedElement::updateWidget and
// moved down into HTMLPluginImageElement.cpp
void HTMLObjectElement::updateWidget(CreatePlugins createPlugins)
Expand Down Expand Up @@ -289,9 +268,12 @@ void HTMLObjectElement::updateWidget(CreatePlugins createPlugins)

Ref protectedThis = *this; // Plugin loading can make arbitrary DOM mutations.

// HTML5 says that fallback content should be rendered if a non-empty
// classid is specified for which the UA can't find a suitable plug-in.
//
// Dispatching a beforeLoad event could have executed code that changed the document.
// Make sure the URL is still safe to load.
bool success = hasValidClassId() && canLoadURL(url);
bool success = attributeWithoutSynchronization(classidAttr).isEmpty() && canLoadURL(url);
if (success)
success = requestObject(url, serviceType, paramNames, paramValues);
if (!success && hasFallbackContent())
Expand Down
2 changes: 0 additions & 2 deletions Source/WebCore/html/HTMLObjectElement.h
Expand Up @@ -80,8 +80,6 @@ class HTMLObjectElement final : public HTMLPlugInImageElement, public FormListed
// so that we can better share code between <object> and <embed>.
void parametersForPlugin(Vector<AtomString>& paramNames, Vector<AtomString>& paramValues, String& url, String& serviceType);

bool hasValidClassId();

void refFormAssociatedElement() const final { ref(); }
void derefFormAssociatedElement() const final { deref(); }

Expand Down
11 changes: 0 additions & 11 deletions Source/WebCore/platform/MIMETypeRegistry.cpp
Expand Up @@ -630,17 +630,6 @@ bool MIMETypeRegistry::isXMLEntityMIMEType(StringView mimeType)
|| equalLettersIgnoringASCIICase(mimeType, "application/xml-external-parsed-entity"_s);
}

bool MIMETypeRegistry::isJavaAppletMIMEType(const String& mimeType)
{
// Since this set is very limited and is likely to remain so we won't bother with the overhead
// of using a hash set.
// Any of the MIME types below may be followed by any number of specific versions of the JVM,
// which is why we use startsWith()
return startsWithLettersIgnoringASCIICase(mimeType, "application/x-java-applet"_s)
|| startsWithLettersIgnoringASCIICase(mimeType, "application/x-java-bean"_s)
|| startsWithLettersIgnoringASCIICase(mimeType, "application/x-java-vm"_s);
}

bool MIMETypeRegistry::isPDFMIMEType(const String& mimeType)
{
static constexpr SortedArraySet set { pdfMIMETypeArray };
Expand Down
3 changes: 0 additions & 3 deletions Source/WebCore/platform/MIMETypeRegistry.h
Expand Up @@ -98,9 +98,6 @@ class MIMETypeRegistry {
// Check to see if a MIME type is suitable for being loaded using <track>>.
WEBCORE_EXPORT static bool isSupportedTextTrackMIMEType(const String& mimeType);

// Check to see if a MIME type is a valid Java applet mime type.
WEBCORE_EXPORT static bool isJavaAppletMIMEType(const String& mimeType);

// Check to see if a MIME type is a plugin implemented by the browser.
static bool isApplicationPluginMIMEType(const String& mimeType);

Expand Down

0 comments on commit 8159c43

Please sign in to comment.