зеркало из https://github.com/mozilla/pjs.git
Bug 409025: OBJECTs with type attribute but no data attribute do not fire
plugin errors. r=biesi, sr=jst
This commit is contained in:
Родитель
583175cfbb
Коммит
b1750cf16a
|
@ -876,6 +876,24 @@ IsAboutBlank(nsIURI* aURI)
|
||||||
return str.EqualsLiteral("about:blank");
|
return str.EqualsLiteral("about:blank");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsObjectLoadingContent::UpdateFallbackState(nsIContent* aContent,
|
||||||
|
AutoFallback& fallback,
|
||||||
|
const nsCString& aTypeHint)
|
||||||
|
{
|
||||||
|
PluginSupportState pluginState = GetPluginDisabledState(aTypeHint);
|
||||||
|
if (pluginState == ePluginUnsupported) {
|
||||||
|
// For unknown plugins notify the UI and allow the unknown plugin binding
|
||||||
|
// to attach.
|
||||||
|
FirePluginError(aContent, PR_FALSE);
|
||||||
|
fallback.TypeUnsupported();
|
||||||
|
}
|
||||||
|
else if (pluginState == ePluginBlocklisted) {
|
||||||
|
// For blocklisted plugins just send a notification to the UI.
|
||||||
|
FirePluginError(aContent, PR_TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsObjectLoadingContent::LoadObject(nsIURI* aURI,
|
nsObjectLoadingContent::LoadObject(nsIURI* aURI,
|
||||||
PRBool aNotify,
|
PRBool aNotify,
|
||||||
|
@ -1052,18 +1070,8 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
|
||||||
case eType_Loading:
|
case eType_Loading:
|
||||||
NS_NOTREACHED("Should not have a loading type here!");
|
NS_NOTREACHED("Should not have a loading type here!");
|
||||||
case eType_Null:
|
case eType_Null:
|
||||||
// No need to load anything
|
// No need to load anything, notify of the failure.
|
||||||
PluginSupportState pluginState = GetPluginSupportState(thisContent,
|
UpdateFallbackState(thisContent, fallback, aTypeHint);
|
||||||
aTypeHint);
|
|
||||||
if (pluginState == ePluginUnsupported ||
|
|
||||||
pluginState == ePluginBlocklisted) {
|
|
||||||
FirePluginError(thisContent, pluginState == ePluginBlocklisted);
|
|
||||||
}
|
|
||||||
if (pluginState != ePluginDisabled &&
|
|
||||||
pluginState != ePluginBlocklisted) {
|
|
||||||
fallback.TypeUnsupported();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -1124,22 +1132,37 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!aURI) {
|
if (!aURI) {
|
||||||
// No URI and no type... nothing we can do.
|
// No URI and if we have got this far no enabled plugin supports the type
|
||||||
LOG(("OBJLC [%p]: no URI\n", this));
|
LOG(("OBJLC [%p]: no URI\n", this));
|
||||||
rv = NS_ERROR_NOT_AVAILABLE;
|
rv = NS_ERROR_NOT_AVAILABLE;
|
||||||
|
|
||||||
|
// We should only notify the UI if there is at least a type to go on for
|
||||||
|
// finding a plugin to use.
|
||||||
|
if (!aTypeHint.IsEmpty()) {
|
||||||
|
UpdateFallbackState(thisContent, fallback, aTypeHint);
|
||||||
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// E.g. mms://
|
||||||
if (!CanHandleURI(aURI)) {
|
if (!CanHandleURI(aURI)) {
|
||||||
LOG(("OBJLC [%p]: can't handle URI\n", this));
|
LOG(("OBJLC [%p]: can't handle URI\n", this));
|
||||||
if (aTypeHint.IsEmpty()) {
|
if (aTypeHint.IsEmpty()) {
|
||||||
rv = NS_ERROR_NOT_AVAILABLE;
|
rv = NS_ERROR_NOT_AVAILABLE;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
// E.g. mms://
|
|
||||||
mType = eType_Plugin;
|
|
||||||
|
|
||||||
rv = TryInstantiate(aTypeHint, aURI);
|
if (IsSupportedPlugin(aTypeHint)) {
|
||||||
|
mType = eType_Plugin;
|
||||||
|
|
||||||
|
rv = TryInstantiate(aTypeHint, aURI);
|
||||||
|
} else {
|
||||||
|
rv = NS_ERROR_NOT_AVAILABLE;
|
||||||
|
// No plugin to load, notify of the failure.
|
||||||
|
UpdateFallbackState(thisContent, fallback, aTypeHint);
|
||||||
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -338,6 +338,15 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
||||||
static PluginSupportState
|
static PluginSupportState
|
||||||
GetPluginDisabledState(const nsCString& aContentType);
|
GetPluginDisabledState(const nsCString& aContentType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When there is no usable plugin available this will send UI events and
|
||||||
|
* update the AutoFallback object appropriate to the reason for there being
|
||||||
|
* no plugin available.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
UpdateFallbackState(nsIContent* aContent, AutoFallback& fallback,
|
||||||
|
const nsCString& aTypeHint);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The final listener to ship the data to (imagelib, uriloader, etc)
|
* The final listener to ship the data to (imagelib, uriloader, etc)
|
||||||
*/
|
*/
|
||||||
|
|
Загрузка…
Ссылка в новой задаче