Bug 548133 - Remove special handling for object 'pluginurl' param. r=dolske, r=josh, a=akeybl
authorJohn Schoenick <jschoenick@mozilla.com>
Mon, 20 Aug 2012 16:16:02 -0700
changeset 117052 ce4d9f008712cd8c3be9131469e36258d6e8934c
parent 117051 fc9677f8a2f653326147dc52fde22b81d41a2699
child 117053 46430f63e85b8195bdf6794ec0db2ed6e400eace
push id1730
push userryanvm@gmail.com
push dateWed, 21 Nov 2012 23:19:47 +0000
treeherdermozilla-beta@9b66328a0d4e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske, josh, akeybl
bugs548133
milestone18.0
Bug 548133 - Remove special handling for object 'pluginurl' param. r=dolske, r=josh, a=akeybl
content/base/src/nsObjectLoadingContent.cpp
content/base/test/chrome/file_bug391728.html
content/base/test/chrome/file_bug391728_2.html
content/base/test/chrome/test_bug391728.html
content/base/test/test_bug368972.html
dom/plugins/base/nsPluginInstanceOwner.cpp
layout/style/nsCSSPseudoClassList.h
layout/style/nsCSSRuleProcessor.cpp
layout/style/test/test_selectors.html
toolkit/mozapps/plugins/content/pluginFinderBinding.css
toolkit/mozapps/plugins/content/pluginProblemBinding.css
--- a/content/base/src/nsObjectLoadingContent.cpp
+++ b/content/base/src/nsObjectLoadingContent.cpp
@@ -2304,47 +2304,30 @@ nsObjectLoadingContent::LoadFallback(Fal
   NS_ASSERTION(thisContent, "must be a content");
 
   if (!thisContent->IsHTML() || mContentType.IsEmpty()) {
     // Don't let custom fallback handlers run outside HTML, tags without a
     // determined type should always just be alternate content
     aType = eFallbackAlternate;
   }
 
-  /// XXX(johns): This block is just mimicing legacy behavior, not any spec
-  // Check if we have any significant content (excluding param tags) OR a
-  // param named 'pluginUrl'
-  bool hasAlternateContent = false;
-  bool hasPluginUrl = false;
   if (thisContent->Tag() == nsGkAtoms::object &&
       (aType == eFallbackUnsupported ||
        aType == eFallbackDisabled ||
        aType == eFallbackBlocklisted))
   {
+    // Show alternate content instead, if it exists
     for (nsIContent* child = thisContent->GetFirstChild();
-         child; child = child->GetNextSibling())
-    {
-      if (child->IsHTML(nsGkAtoms::param)) {
-        if (child->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
-          NS_LITERAL_STRING("pluginurl"), eIgnoreCase)) {
-          hasPluginUrl = true;
-        }
-      } else if (nsStyleUtil::IsSignificantChild(child, true, false)) {
-        hasAlternateContent = true;
+         child; child = child->GetNextSibling()) {
+      if (!child->IsHTML(nsGkAtoms::param) &&
+          nsStyleUtil::IsSignificantChild(child, true, false)) {
+        aType = eFallbackAlternate;
+        break;
       }
     }
-
-    // Show alternate content if it exists, unless we have a 'pluginurl' param,
-    // in which case the missing-plugin fallback handler will want to handle
-    // it
-    if (hasAlternateContent && !hasPluginUrl) {
-      LOG(("OBJLC [%p]: Unsupported/disabled/blocked plugin has alternate "
-      "content, showing instead of custom handler", this));
-      aType = eFallbackAlternate;
-    }
   }
 
   mType = eType_Null;
   mFallbackType = aType;
 
   //
   // Notify & send events
   //
--- a/content/base/test/chrome/file_bug391728.html
+++ b/content/base/test/chrome/file_bug391728.html
@@ -38,17 +38,17 @@ document.addEventListener("PluginDisable
 document.addEventListener("PluginBlocklisted", blocked_plugin_detected, true);
 </script>
 </head>
 <body>
 <!-- Embeds always fire events and have the pseudo class attached -->
 <div><embed id="plugin1" style="width: 100px; height: 100px" type="application/x-test"></div>
 <div><embed id="plugin2" style="width: 100px; height: 100px" src="data:application/x-test,test"></div>
 
-<!-- So do objects with no content and no pluginurl -->
+<!-- So do objects with a type/uri and no content -->
 <div><object id="plugin3" style="width: 100px; height: 100px" type="application/x-test"></object></div>
 <div><object id="plugin4" style="width: 100px; height: 100px" data="data:application/x-test,test"></object></div>
 
 <!-- The mimetype of the actual data is supposed to be used in preference -->
 <div><embed id="plugin5" style="width: 100px; height: 100px" type="application/x-unknown" src="data:application/x-test,test"></div>
 <div><object id="plugin6" style="width: 100px; height: 100px" type="application/x-unknown" data="data:application/x-test,test"></object></div>
 
 <!-- Params are not considered content -->
@@ -64,37 +64,37 @@ document.addEventListener("PluginBlockli
 
   
 </object></div>
 <div><object id="plugin10" style="width: 100px; height: 100px" data="data:application/x-test,test">
 
   
 </object></div>
 
-<!-- Pluginurl forces the psuedo class and error event regardless of content -->
-<div><object id="plugin11" style="width: 100px; height: 100px" type="application/x-test">
-  <param name="pluginurl" value="http://foo">
-  <p>Fallback content</p>
-</object></div>
-<div><object id="plugin12" style="width: 100px; height: 100px" data="data:application/x-test,test">
-  <param name="pluginurl" value="http://foo">
-  <p>Fallback content</p>
-</object></div>
-
 <!-- No errors or psuedo classes for objects with fallback content -->
 <div><object id="fallback1" style="width: 100px; height: 100px" type="application/x-test">
   <p>Fallback content</p>
 </object></div>
 <div><object id="fallback2" style="width: 100px; height: 100px" data="data:application/x-test,test">
   <p>Fallback content</p>
 </object></div>
 
 <!-- Even other plugins are considered content so no errors dispatched from these
      objects, but the inner embeds do get processed -->
 <div><object id="fallback3" style="width: 100px; height: 100px" type="application/x-test">
-  <embed id="plugin13" style="width: 100px; height: 100px" type="application/x-test">
+  <embed id="plugin11" style="width: 100px; height: 100px" type="application/x-test">
 </object></div>
 <div><object id="fallback4" style="width: 100px; height: 100px" data="data:application/x-test,test">
-  <embed id="plugin14" style="width: 100px; height: 100px" type="application/x-test">
+  <embed id="plugin12" style="width: 100px; height: 100px" type="application/x-test">
+</object></div>
+
+<!-- pluginurl was removed in bug 548133, and should not affect fallback -->
+<div><object id="plugin13" style="width: 100px; height: 100px" data="data:application/x-test,test">
+    <param name="pluginurl">
+</object></div>
+
+<div><object id="fallback5" style="width: 100px; height: 100px" data="data:application/x-test,test">
+    <param name="pluginurl">
+    Fallback content
 </object></div>
 
 </body>
 </html>
--- a/content/base/test/chrome/file_bug391728_2.html
+++ b/content/base/test/chrome/file_bug391728_2.html
@@ -38,17 +38,17 @@ document.addEventListener("PluginDisable
 document.addEventListener("PluginBlocklisted", blocked_plugin_detected, true);
 </script>
 </head>
 <body>
 <!-- Embeds always fire events and have the pseudo class attached -->
 <div><embed id="plugin1" style="width: 100px; height: 100px" type="application/x-unknown"></div>
 <div><embed id="plugin2" style="width: 100px; height: 100px" src="data:application/x-unknown,test"></div>
 
-<!-- So do objects with no content and no pluginurl -->
+<!-- So do objects with a type/uri and no content -->
 <div><object id="plugin3" style="width: 100px; height: 100px" type="application/x-unknown"></object></div>
 <div><object id="plugin4" style="width: 100px; height: 100px" data="data:application/x-unknown,test"></object></div>
 
 <!-- The mimetype of the actual data is supposed to be used in preference -->
 <div><embed id="plugin5" style="width: 100px; height: 100px" type="application/x-test" src="data:application/x-unknown,test"></div>
 <div><object id="plugin6" style="width: 100px; height: 100px" type="application/x-test" data="data:application/x-unknown,test"></object></div>
 
 <!-- Params are not considered content -->
@@ -64,36 +64,37 @@ document.addEventListener("PluginBlockli
 
   
 </object></div>
 <div><object id="plugin10" style="width: 100px; height: 100px" data="data:application/x-unknown,test">
 
   
 </object></div>
 
-<!-- Pluginurl forces the psuedo class and error event regardless of content -->
-<div><object id="plugin11" style="width: 100px; height: 100px" type="application/x-unknown">
-  <param name="pluginurl" value="http://foo">
-  <p>Fallback content</p>
-</object></div>
-<div><object id="plugin12" style="width: 100px; height: 100px" data="data:application/x-unknown,test">
-  <param name="pluginurl" value="http://foo">
-  <p>Fallback content</p>
-</object></div>
-
 <!-- No errors or psuedo classes for objects with fallback content -->
 <div><object id="fallback1" style="width: 100px; height: 100px" type="application/x-unknown">
   <p>Fallback content</p>
 </object></div>
 <div><object id="fallback2" style="width: 100px; height: 100px" data="data:application/x-unknown,test">
   <p>Fallback content</p>
 </object></div>
 
 <!-- Even other plugins are considered content so no errors dispatched from these
      objects, but the inner embeds do get processed -->
 <div><object id="fallback3" style="width: 100px; height: 100px" type="application/x-unknown">
-  <embed id="plugin13" style="width: 100px; height: 100px" type="application/x-unknown">
+  <embed id="plugin11" style="width: 100px; height: 100px" type="application/x-unknown">
 </object></div>
 <div><object id="fallback4" style="width: 100px; height: 100px" data="data:application/x-unknown,test">
-  <embed id="plugin14" style="width: 100px; height: 100px" type="application/x-unknown">
+  <embed id="plugin12" style="width: 100px; height: 100px" type="application/x-unknown">
+</object></div>
+
+<!-- pluginurl was removed in bug 548133, and should not affect fallback -->
+<div><object id="plugin13" style="width: 100px; height: 100px" type="application/x-unknown">
+    <param name="pluginurl">
 </object></div>
+
+<div><object id="fallback5" style="width: 100px; height: 100px" type="applicatin/x-unknown">
+    <param name="pluginurl">
+    Fallback content
+</object></div>
+
 </body>
 </html>
--- a/content/base/test/chrome/test_bug391728.html
+++ b/content/base/test/chrome/test_bug391728.html
@@ -14,19 +14,19 @@ https://bugzilla.mozilla.org/show_bug.cg
 <p id="display"></p>
 <div id="content">
   <iframe id="testframe" width="150" height="250" src="about:blank"></iframe>
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 /** Test for Bug 391728 **/
 // Plugins that should dispatch error events and have the pseudo classes set
-const PLUGIN_COUNT = 14;
+const PLUGIN_COUNT = 13;
 // Plugins that should neither dispatch error events or have the pseudo classes set
-const FALLBACK_COUNT = 4;
+const FALLBACK_COUNT = 5;
 
 var gNextTest = null;
 var gUnknown = [];
 var gBlocked = [];
 var gDisabled = [];
 
 function disabled_plugin_detected(event) {
   gDisabled.push(event.target.id);
--- a/content/base/test/test_bug368972.html
+++ b/content/base/test/test_bug368972.html
@@ -38,57 +38,46 @@ Embed width=100 height=100 style="width:
 <embed id="embed9" type="bogus" width="100" height="100" style="width:400px;"><br>
 Embed height=100 style="width:400px"
 <embed id="embed10" type="bogus" height="100" style="width:400px;"><br>
 Embed height=100 (stylesheet width:400px height:400px)
 <embed id="embed11" type="bogus" height="100"><br>
 
 Object without defined width/height:
 <object id="object1" type="bogus">
-<param name="pluginurl" value="http://foo">
 </object><br>
 Object width=0 height=0
 <object id="object2" type="bogus" width="0" height="0">
-<param name="pluginurl" value="http://foo">
 </object><br>
 Object width=100 height=100
 <object id="object3" type="bogus" width="100" height="100">
-<param name="pluginurl" value="http://foo">
 </object><br>
 Object height=100
 <object id="object4" type="bogus" height="100">
-<param name="pluginurl" value="http://foo">
 </object><br>
 Object width=100
 <object id="object5" type="bogus" width="100">
-<param name="pluginurl" value="http://foo">
 </object><br>
 Object width=100xxx height=100
 <object id="object6" type="bogus" width="100xxx" height="100">
-<param name="pluginurl" value="http://foo">
 </object><br>
 Object width=0100 height=100
 <object id="object7" type="bogus" width="0100" height="100">
-<param name="pluginurl" value="http://foo">
 </object><br>
 Object width= height=100
 <object id="object8" type="bogus" width="" height="100">
-<param name="pluginurl" value="http://foo">
 </object><br>
 Object width=100 height=100 style="width:400px"
 <object id="object9" type="bogus" width="100" height="100" style="width:400px;">
-<param name="pluginurl" value="http://foo">
 </object><br>
 Object height=100 style="width:400px"
 <object id="object10" type="bogus" height="100" style="width:400px;">
-<param name="pluginurl" value="http://foo">
 </object><br>
 Object height=100 (stylesheet width:400px height:400px)
 <object id="object11" type="bogus" height="100">
-<param name="pluginurl" value="http://foo">
 </object><br>
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 function check_size(id, width, height) {
   var element = document.getElementById(id);
   ok(element, "Plugin element " + id + " did not exist");
   var style = window.getComputedStyle(element, null);
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -3838,18 +3838,17 @@ nsObjectFrame* nsPluginInstanceOwner::Ge
 {
   return mObjectFrame;
 }
 
 // Little helper function to resolve relative URL in
 // |value| for certain inputs of |name|
 void nsPluginInstanceOwner::FixUpURLS(const nsString &name, nsAString &value)
 {
-  if (name.LowerCaseEqualsLiteral("pluginurl") ||
-      name.LowerCaseEqualsLiteral("pluginspage")) {        
+  if (name.LowerCaseEqualsLiteral("pluginspage")) {
     nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
     nsAutoString newURL;
     NS_MakeAbsoluteURI(newURL, value, baseURI);
     if (!newURL.IsEmpty())
       value = newURL;
   }
 }
 
--- a/layout/style/nsCSSPseudoClassList.h
+++ b/layout/style/nsCSSPseudoClassList.h
@@ -71,18 +71,16 @@ CSS_PSEUDO_CLASS(onlyChild, ":only-child
 CSS_PSEUDO_CLASS(firstOfType, ":first-of-type")
 CSS_PSEUDO_CLASS(lastOfType, ":last-of-type")
 CSS_PSEUDO_CLASS(onlyOfType, ":only-of-type")
 CSS_PSEUDO_CLASS(nthChild, ":nth-child")
 CSS_PSEUDO_CLASS(nthLastChild, ":nth-last-child")
 CSS_PSEUDO_CLASS(nthOfType, ":nth-of-type")
 CSS_PSEUDO_CLASS(nthLastOfType, ":nth-last-of-type")
 
-CSS_PSEUDO_CLASS(mozHasHandlerRef, ":-moz-has-handlerref")
-
 // Match nodes that are HTML but not XHTML
 CSS_PSEUDO_CLASS(mozIsHTML, ":-moz-is-html")
 
 // Matches anything when the specified look-and-feel metric is set
 CSS_PSEUDO_CLASS(mozSystemMetric, ":-moz-system-metric")
 
 // -moz-locale-dir(ltr) and -moz-locale-dir(rtl) may be used
 // to match based on the locale's chrome direction
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -1905,37 +1905,16 @@ static bool SelectorMatches(Element* aEl
 
       case nsCSSPseudoClasses::ePseudoClass_nthLastOfType:
         if (!nthChildGenericMatches(aElement, aTreeMatchContext, pseudoClass,
                                     true, true)) {
           return false;
         }
         break;
 
-      case nsCSSPseudoClasses::ePseudoClass_mozHasHandlerRef:
-        {
-          nsIContent *child = nullptr;
-          int32_t index = -1;
-
-          do {
-            child = aElement->GetChildAt(++index);
-            if (child && child->IsHTML() &&
-                child->Tag() == nsGkAtoms::param &&
-                child->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
-                                   NS_LITERAL_STRING("pluginurl"),
-                                   eIgnoreCase)) {
-              break;
-            }
-          } while (child);
-          if (!child) {
-            return false;
-          }
-        }
-        break;
-
       case nsCSSPseudoClasses::ePseudoClass_mozIsHTML:
         if (!aTreeMatchContext.mIsHTMLDocument || !aElement->IsHTML()) {
           return false;
         }
         break;
 
       case nsCSSPseudoClasses::ePseudoClass_mozSystemMetric:
         {
--- a/layout/style/test/test_selectors.html
+++ b/layout/style/test/test_selectors.html
@@ -808,17 +808,16 @@ function run() {
     test_parseable(":-moz-window-inactive");
     test_parseable("div p:-moz-window-inactive:hover span");
 
     // Plugin pseudoclasses
     test_parseable(":-moz-type-unsupported");
     test_parseable(":-moz-handler-disabled");
     test_parseable(":-moz-handler-blocked");
     test_parseable(":-moz-handler-crashed");
-    test_parseable(":-moz-has-handlerref");
 
     // Case sensitivity of tag selectors
     function setup_cased_spans(body) {
       var data = [
         { tag: "span" },
         { tag: "sPaN" },
         { tag: "Span" },
         { tag: "SPAN" },
--- a/toolkit/mozapps/plugins/content/pluginFinderBinding.css
+++ b/toolkit/mozapps/plugins/content/pluginFinderBinding.css
@@ -3,16 +3,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 @namespace url(http://www.w3.org/1999/xhtml); /* set default namespace to HTML */
 
 /* This binding is specified separately from the others so that Linux distros can
    override the default Mozilla plugin finder service with their own mechanism. */
 embed:-moz-type-unsupported,
 applet:-moz-type-unsupported,
-object:-moz-has-handlerref:-moz-type-unsupported,
+object:-moz-type-unsupported,
 embed:-moz-type-unsupported-platform,
 applet:-moz-type-unsupported-platform,
-object:-moz-has-handlerref:-moz-type-unsupported-platform {
+object:-moz-type-unsupported-platform {
     display: inline-block;
     overflow: hidden;
     -moz-binding: url('chrome://mozapps/content/plugins/pluginProblem.xml#pluginProblem') !important;
 }
--- a/toolkit/mozapps/plugins/content/pluginProblemBinding.css
+++ b/toolkit/mozapps/plugins/content/pluginProblemBinding.css
@@ -13,18 +13,18 @@ embed:-moz-handler-vulnerable-updatable,
 embed:-moz-handler-vulnerable-no-update,
 applet:-moz-handler-disabled,
 applet:-moz-handler-blocked,
 applet:-moz-handler-crashed,
 applet:-moz-handler-clicktoplay,
 applet:-moz-handler-playpreview,
 applet:-moz-handler-vulnerable-updatable,
 applet:-moz-handler-vulnerable-no-update,
-object:-moz-has-handlerref:-moz-handler-disabled,
-object:-moz-has-handlerref:-moz-handler-blocked,
+object:-moz-handler-disabled,
+object:-moz-handler-blocked,
 object:-moz-handler-crashed,
 object:-moz-handler-clicktoplay,
 object:-moz-handler-playpreview,
 object:-moz-handler-vulnerable-updatable,
 object:-moz-handler-vulnerable-no-update {
     display: inline-block;
     overflow: hidden;
     -moz-binding: url('chrome://mozapps/content/plugins/pluginProblem.xml#pluginProblem') !important;