Bug 1153145 - Ensure trusted focus events from web content focus plugins. r=smaug

This commit is contained in:
Steven Michaud 2015-06-10 15:30:25 -05:00
parent eb8458f023
commit 75821a1f80

View File

@ -161,7 +161,12 @@ HTMLObjectElement::OnFocusBlurPlugin(Element* aElement, bool aFocus)
nsCOMPtr<nsIObjectLoadingContent> olc = do_QueryInterface(aElement);
bool hasRunningPlugin = false;
if (olc) {
olc->GetHasRunningPlugin(&hasRunningPlugin);
// nsIObjectLoadingContent::GetHasRunningPlugin() fails when
// nsContentUtils::IsCallerChrome() returns false (which it can do even
// when we're processing a trusted focus event). We work around this by
// calling nsObjectLoadingContent::HasRunningPlugin() directly.
hasRunningPlugin =
static_cast<nsObjectLoadingContent*>(olc.get())->HasRunningPlugin();
}
if (!hasRunningPlugin) {
aFocus = false;