mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-30 04:17:31 +09:00
Issue #1719 - Make <menuitem> pref-controlled and disable by default.
Resolves #1719
This commit is contained in:
parent
74680d59a1
commit
a828a5f321
12 changed files with 32 additions and 16 deletions
|
|
@ -137,9 +137,9 @@ HTMLMenuElement::ParseAttribute(int32_t aNamespaceID,
|
|||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::type) {
|
||||
bool success = aResult.ParseEnumValue(aValue, kMenuTypeTable,
|
||||
false);
|
||||
if (aNamespaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::type &&
|
||||
Preferences::GetBool("dom.menuitem.enabled")) {
|
||||
bool success = aResult.ParseEnumValue(aValue, kMenuTypeTable, false);
|
||||
if (success) {
|
||||
mType = aResult.GetEnumValue();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -7,12 +7,22 @@
|
|||
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/HTMLMenuItemElementBinding.h"
|
||||
#include "mozilla/dom/HTMLUnknownElement.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(MenuItem)
|
||||
nsGenericHTMLElement*
|
||||
NS_NewHTMLMenuItemElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
mozilla::dom::FromParser aFromParser) {
|
||||
RefPtr<mozilla::dom::NodeInfo> nodeInfo(aNodeInfo);
|
||||
if (mozilla::Preferences::GetBool("dom.menuitem.enabled")) {
|
||||
return new mozilla::dom::HTMLMenuItemElement(nodeInfo.forget(), aFromParser);
|
||||
} else {
|
||||
return new mozilla::dom::HTMLUnknownElement(nodeInfo.forget());
|
||||
}
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ const kPage = "http://example.org/browser/" +
|
|||
"dom/html/test/file_content_contextmenu.html";
|
||||
|
||||
add_task(function* () {
|
||||
yield SpecialPowers.pushPrefEnv({
|
||||
set: [["dom.menuitem.enabled", true]],
|
||||
});
|
||||
yield BrowserTestUtils.withNewTab({
|
||||
gBrowser,
|
||||
url: kPage
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
[DEFAULT]
|
||||
prefs =
|
||||
dom.menuitem.enabled=true # only for test_bug617528.html
|
||||
support-files =
|
||||
347174transform.xsl
|
||||
347174transformable.xml
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue