Bug 1433221 - Revert changes to classid checks for object tags; r=bz
authorKyle Machulis <kyle@nonpolynomial.com>
Mon, 30 Apr 2018 21:53:48 -0700
changeset 472843 66a5836c66b16f6962db7ef0ec7b99d7f7573698
parent 472842 d1a03dc50fba506983a294d4a74cee495ff07a73
child 472844 b70479effe0da387e2a00683191411348c9f2c16
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1433221, 1279218
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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 removed, as it was not obvious that this was used anywhere other than java plugins. The classid is still a valid attribute on object tags (and is sometimes used on tags for flash embedding). We want to use a fallback strategy when we find objects with classid attributes, as we don't support them, meaning we need to revert our prior removal of the check. 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,29 @@ 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 & eFallbackIfClassIDPresent) {
+    nsAutoString classIDAttr;
+    thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::classid, classIDAttr);
+    // We don't support class ID plugin references, so we should always treat
+    // having class Ids as attributes as invalid, and fallback accordingly.
+    if (!classIDAttr.IsEmpty()) {
+      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
@@ -268,17 +268,17 @@ class nsObjectLoadingContent : public ns
      * <embed> tag.
      *
      * The instantiated plugin depends on:
      * - The URI (<embed src>, <object data>)
      * - The type 'hint' (type attribute)
      * - The mime type returned by opening the URI
      * - Enabled plugins claiming the ultimate mime type
      * - The capabilities returned by GetCapabilities
-     * - The classid attribute, if eSupportClassID is among the capabilities
+     * - The classid attribute, if eFallbackIfClassIDPresent is among the capabilities
      *
      * If eAllowPluginSkipChannel is true, we may skip opening the URI if our
      * type hint points to a valid plugin, deferring that responsibility to the
      * plugin.
      * Similarly, if no URI is provided, but a type hint for a valid plugin is
      * present, that plugin will be instantiated
      *
      * Otherwise a request to that URI is made and the type sent by the server
@@ -296,20 +296,22 @@ class nsObjectLoadingContent : public ns
      */
     nsresult LoadObject(bool aNotify,
                         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.
+                                      // (nsIDocumentLoaderFactory)
+                                      // This flag always includes SVG
+
+      // Node supports class ID as an attribute, and should fallback if it is
+      // present, as class IDs are not supported.
+      eFallbackIfClassIDPresent = 1u << 3,
 
       // 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() | eFallbackIfClassIDPresent;
 }
 
 void
 HTMLObjectElement::DestroyContent()
 {
   nsObjectLoadingContent::DestroyContent();
   nsGenericHTMLFormElement::DestroyContent();
 }