Bug 1066383, rework custom html menu item handling to support contextmenu attribute in separate process, r=janv,mconley,peterv
This commit is contained in:
@@ -9,11 +9,13 @@
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/dom/HTMLMenuElementBinding.h"
|
||||
#include "mozilla/dom/HTMLMenuItemElement.h"
|
||||
#include "nsIMenuBuilder.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsXULContextMenuBuilder.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
#define HTMLMENUBUILDER_CONTRACTID "@mozilla.org/content/html-menu-builder;1"
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Menu)
|
||||
|
||||
namespace mozilla {
|
||||
@@ -97,12 +99,8 @@ HTMLMenuElement::CreateBuilder(nsIMenuBuilder** _retval)
|
||||
{
|
||||
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_DOM_SECURITY_ERR);
|
||||
|
||||
*_retval = nullptr;
|
||||
|
||||
if (mType == MENU_TYPE_CONTEXT) {
|
||||
NS_ADDREF(*_retval = new nsXULContextMenuBuilder());
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIMenuBuilder> builder = CreateBuilder();
|
||||
builder.swap(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -113,8 +111,9 @@ HTMLMenuElement::CreateBuilder()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIMenuBuilder> ret = new nsXULContextMenuBuilder();
|
||||
return ret.forget();
|
||||
nsCOMPtr<nsIMenuBuilder> builder = do_CreateInstance(HTMLMENUBUILDER_CONTRACTID);
|
||||
NS_WARN_IF(!builder);
|
||||
return builder.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
||||
Reference in New Issue
Block a user