Bug 1433221 - Revert changes to classid checks for object tags; r?bz draft
authorKyle Machulis <kyle@nonpolynomial.com>
Mon, 30 Apr 2018 21:53:48 -0700
changeset 790069 f52889a6962abc3da3b6e9b22979925763800a70
parent 789972 13f68f6e191da5ae1c9c221669bc633486d5b015
push id108411
push userbmo:kyle@nonpolynomial.com
push dateTue, 01 May 2018 05:27:38 +0000
reviewersbz
bugs1433221, 1279218
milestone61.0a1
Bug 1433221 - Revert changes to classid checks for object tags; r?bz As part of applet/java plugin removal in bug 1279218, classid checking was also removed, as it was not obvious that this was used anywhere other than java plugins. However, jquery uses clsid to identify flash object tags, meaning that flash loaded with jquery may not load properly without this attribute. Revert the attribute removal. MozReview-Commit-ID: BKQ34HGTkvt
dom/base/nsObjectLoadingContent.cpp
dom/base/nsObjectLoadingContent.h
dom/html/HTMLObjectElement.cpp
--- a/dom/base/nsObjectLoadingContent.cpp
+++ b/dom/base/nsObjectLoadingContent.cpp
@@ -1572,16 +1572,30 @@ nsObjectLoadingContent::UpdateObjectPara
   // already opened a channel or tried to instantiate content, whereas channel
   // parameter changes require re-opening the channel even if we haven't gotten
   // that far.
   nsObjectLoadingContent::ParameterUpdateFlags retval = eParamNoChange;
 
   ///
   /// Initial MIME Type
   ///
+
+
+  if (caps & eSupportClassID) {
+    nsAutoString classIDAttr;
+    thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::classid, classIDAttr);
+    if (!classIDAttr.IsEmpty()) {
+      // XXX(johns): Our de-facto behavior since forever was to refuse to load
+      // Objects who don't have a classid we support, regardless of other type
+      // or uri info leads to a valid plugin.
+      newMime.Truncate();
+      stateInvalid = true;
+    }
+  }
+
   ///
   /// Codebase
   ///
 
   nsAutoString codebaseStr;
   nsCOMPtr<nsIURI> docBaseURI = thisElement->GetBaseURI();
   thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::codebase, codebaseStr);
 
--- a/dom/base/nsObjectLoadingContent.h
+++ b/dom/base/nsObjectLoadingContent.h
@@ -298,18 +298,18 @@ class nsObjectLoadingContent : public ns
                         bool aForceLoad = false);
 
     enum Capabilities {
       eSupportImages       = 1u << 0, // Images are supported (imgILoader)
       eSupportPlugins      = 1u << 1, // Plugins are supported (nsIPluginHost)
       eSupportDocuments    = 1u << 2, // Documents are supported
                                         // (nsIDocumentLoaderFactory)
                                         // This flag always includes SVG
-      eSupportClassID      = 1u << 3, // The classid attribute is supported. No
-                                      // longer used.
+      eSupportClassID      = 1u << 3, // The classid attribute is supported. Used with
+                                      // flash.
 
       // If possible to get a *plugin* type from the type attribute *or* file
       // extension, we can use that type and begin loading the plugin before
       // opening a channel.
       // A side effect of this is if the channel fails, the plugin is still
       // running.
       eAllowPluginSkipChannel  = 1u << 4
     };
--- a/dom/html/HTMLObjectElement.cpp
+++ b/dom/html/HTMLObjectElement.cpp
@@ -514,17 +514,17 @@ EventStates
 HTMLObjectElement::IntrinsicState() const
 {
   return nsGenericHTMLFormElement::IntrinsicState() | ObjectState();
 }
 
 uint32_t
 HTMLObjectElement::GetCapabilities() const
 {
-  return nsObjectLoadingContent::GetCapabilities();
+  return nsObjectLoadingContent::GetCapabilities() | eSupportClassID;
 }
 
 void
 HTMLObjectElement::DestroyContent()
 {
   nsObjectLoadingContent::DestroyContent();
   nsGenericHTMLFormElement::DestroyContent();
 }