Bug 1316661 part 4. Eliminate IsCallerChrome callers in HTMLMenuElement. r=smaug

This commit is contained in:
Boris Zbarsky
2016-11-15 00:18:33 -05:00
parent 75c836b7fe
commit e9fb9777b8
6 changed files with 11 additions and 77 deletions

View File

@@ -58,7 +58,7 @@ HTMLMenuElement::~HTMLMenuElement()
}
NS_IMPL_ISUPPORTS_INHERITED(HTMLMenuElement, nsGenericHTMLElement,
nsIDOMHTMLMenuElement, nsIHTMLMenu)
nsIDOMHTMLMenuElement)
NS_IMPL_ELEMENT_CLONE(HTMLMenuElement)
@@ -68,14 +68,12 @@ NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLMenuElement, Type, type,
NS_IMPL_STRING_ATTR(HTMLMenuElement, Label, label)
NS_IMETHODIMP
void
HTMLMenuElement::SendShowEvent()
{
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_DOM_SECURITY_ERR);
nsCOMPtr<nsIDocument> document = GetComposedDoc();
if (!document) {
return NS_ERROR_FAILURE;
return;
}
WidgetEvent event(true, eShow);
@@ -84,25 +82,13 @@ HTMLMenuElement::SendShowEvent()
nsCOMPtr<nsIPresShell> shell = document->GetShell();
if (!shell) {
return NS_ERROR_FAILURE;
return;
}
RefPtr<nsPresContext> presContext = shell->GetPresContext();
nsEventStatus status = nsEventStatus_eIgnore;
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,
&event, nullptr, &status);
return NS_OK;
}
NS_IMETHODIMP
HTMLMenuElement::CreateBuilder(nsIMenuBuilder** _retval)
{
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_DOM_SECURITY_ERR);
nsCOMPtr<nsIMenuBuilder> builder = CreateBuilder();
builder.swap(*_retval);
return NS_OK;
}
already_AddRefed<nsIMenuBuilder>
@@ -117,18 +103,14 @@ HTMLMenuElement::CreateBuilder()
return builder.forget();
}
NS_IMETHODIMP
void
HTMLMenuElement::Build(nsIMenuBuilder* aBuilder)
{
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_DOM_SECURITY_ERR);
if (!aBuilder) {
return NS_OK;
return;
}
BuildSubmenu(EmptyString(), this, aBuilder);
return NS_OK;
}