Backout a6f040934c99 (Bug 548133) for reftest orange

This commit is contained in:
John Schoenick 2012-09-05 14:52:20 -07:00
parent 916da33f22
commit f25d874531
11 changed files with 91 additions and 18 deletions

View File

@ -2281,19 +2281,36 @@ nsObjectLoadingContent::LoadFallback(FallbackType aType, bool aNotify) {
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) &&
nsStyleUtil::IsSignificantChild(child, true, false)) {
aType = eFallbackAlternate;
break;
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;
}
}
// 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;
}
}

View File

@ -43,7 +43,7 @@ document.addEventListener("PluginBlocklisted", blocked_plugin_detected, true);
<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 a type/uri and no content -->
<!-- So do objects with no content and no pluginurl -->
<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>
@ -69,6 +69,16 @@ document.addEventListener("PluginBlocklisted", blocked_plugin_detected, true);
</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>
@ -80,10 +90,10 @@ document.addEventListener("PluginBlocklisted", blocked_plugin_detected, true);
<!-- 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="plugin11" style="width: 100px; height: 100px" type="application/x-test">
<embed id="plugin13" 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="plugin12" style="width: 100px; height: 100px" type="application/x-test">
<embed id="plugin14" style="width: 100px; height: 100px" type="application/x-test">
</object></div>
</body>

View File

@ -43,7 +43,7 @@ document.addEventListener("PluginBlocklisted", blocked_plugin_detected, true);
<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 a type/uri and no content -->
<!-- So do objects with no content and no pluginurl -->
<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>
@ -69,6 +69,16 @@ document.addEventListener("PluginBlocklisted", blocked_plugin_detected, true);
</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>
@ -80,10 +90,10 @@ document.addEventListener("PluginBlocklisted", blocked_plugin_detected, true);
<!-- 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="plugin11" style="width: 100px; height: 100px" type="application/x-unknown">
<embed id="plugin13" 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="plugin12" style="width: 100px; height: 100px" type="application/x-unknown">
<embed id="plugin14" style="width: 100px; height: 100px" type="application/x-unknown">
</object></div>
</body>
</html>

View File

@ -19,7 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=391728
<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 = 12;
const PLUGIN_COUNT = 14;
// Plugins that should neither dispatch error events or have the pseudo classes set
const FALLBACK_COUNT = 4;

View File

@ -43,36 +43,47 @@ Embed height=100 (stylesheet width:400px height:400px)
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">

View File

@ -3762,7 +3762,8 @@ nsObjectFrame* nsPluginInstanceOwner::GetFrame()
// |value| for certain inputs of |name|
void nsPluginInstanceOwner::FixUpURLS(const nsString &name, nsAString &value)
{
if (name.LowerCaseEqualsLiteral("pluginspage")) {
if (name.LowerCaseEqualsLiteral("pluginurl") ||
name.LowerCaseEqualsLiteral("pluginspage")) {
nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
nsAutoString newURL;
NS_MakeAbsoluteURI(newURL, value, baseURI);

View File

@ -76,6 +76,8 @@ 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")

View File

@ -1909,6 +1909,27 @@ static bool SelectorMatches(Element* aElement,
}
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;

View File

@ -813,6 +813,7 @@ function run() {
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) {

View File

@ -8,10 +8,10 @@
override the default Mozilla plugin finder service with their own mechanism. */
embed:-moz-type-unsupported,
applet:-moz-type-unsupported,
object:-moz-type-unsupported,
object:-moz-has-handlerref:-moz-type-unsupported,
embed:-moz-type-unsupported-platform,
applet:-moz-type-unsupported-platform,
object:-moz-type-unsupported-platform {
object:-moz-has-handlerref:-moz-type-unsupported-platform {
display: inline-block;
overflow: hidden;
-moz-binding: url('chrome://mozapps/content/plugins/pluginProblem.xml#pluginProblem') !important;

View File

@ -18,8 +18,8 @@ applet:-moz-handler-clicktoplay,
applet:-moz-handler-playpreview,
applet:-moz-handler-vulnerable-updatable,
applet:-moz-handler-vulnerable-no-update,
object:-moz-handler-disabled,
object:-moz-handler-blocked,
object:-moz-has-handlerref:-moz-handler-disabled,
object:-moz-has-handlerref:-moz-handler-blocked,
object:-moz-handler-crashed,
object:-moz-handler-clicktoplay,
object:-moz-handler-playpreview,