Bug 575836: Fix logic here. r=jst r=josh
authorChris Jones <jones.chris.g@gmail.com>
Thu, 22 Jul 2010 16:44:11 -0400
changeset 34442 96ae337c41fbff7c1c96ddca599ee5997ffed406
parent 34441 5d60b8125b69637e8e139b3449936f15892f9bdf
child 34447 ad35ca56728931eb312d6fe10d06d9f0e6279af3
push id1470
push userjosh@mozilla.com
push dateThu, 22 Jul 2010 20:46:13 +0000
reviewersjst, josh
bugs575836
milestone1.9.2.8pre
Bug 575836: Fix logic here. r=jst r=josh
layout/generic/nsObjectFrame.cpp
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -3583,19 +3583,20 @@ nsresult nsPluginInstanceOwner::EnsureCa
 
   // Some plugins were never written to understand the "data" attribute of the OBJECT tag.
   // Real and WMP will not play unless they find a "src" attribute, see bug 152334.
   // Nav 4.x would simply replace the "data" with "src". Because some plugins correctly
   // look for "data", lets instead copy the "data" attribute and add another entry
   // to the bottom of the array if there isn't already a "src" specified.
   PRUint16 numRealAttrs = mNumCachedAttrs;
   nsAutoString data;
-  if (mContent->Tag() == nsGkAtoms::object
-    && !mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::src)
-    && mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::data, data)) {
+  if (mContent->Tag() == nsGkAtoms::object &&
+      !mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::src) &&
+      mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::data, data) &&
+      !data.IsEmpty()) {
       mNumCachedAttrs++;
   }
 
   // "plugins.force.wmode" preference is forcing wmode type for plugins
   // possible values - "opaque", "transparent", "windowed"
   nsAdoptingCString wmodeType = nsContentUtils::GetCharPref("plugins.force.wmode");
   if (!wmodeType.IsEmpty())
     mNumCachedAttrs++;
@@ -3643,17 +3644,17 @@ nsresult nsPluginInstanceOwner::EnsureCa
     FixUpURLS(name, value);
 
     mCachedAttrParamNames [nextAttrParamIndex] = ToNewUTF8String(name);
     mCachedAttrParamValues[nextAttrParamIndex] = ToNewUTF8String(value);
     nextAttrParamIndex++;
   }
 
   // if the conditions above were met, copy the "data" attribute to a "src" array entry
-  if (data.Length()) {
+  if (!data.IsEmpty()) {
     mCachedAttrParamNames [nextAttrParamIndex] = ToNewUTF8String(NS_LITERAL_STRING("SRC"));
     mCachedAttrParamValues[nextAttrParamIndex] = ToNewUTF8String(data);
     nextAttrParamIndex++;
   }
 
   // add our PARAM and null separator
   mCachedAttrParamNames [nextAttrParamIndex] = ToNewUTF8String(NS_LITERAL_STRING("PARAM"));
   mCachedAttrParamValues[nextAttrParamIndex] = nsnull;