summaryrefslogtreecommitdiff
path: root/dom/html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/html')
-rw-r--r--dom/html/HTMLMenuElement.cpp6
-rw-r--r--dom/html/HTMLMenuItemElement.cpp14
-rw-r--r--dom/html/test/browser_content_contextmenu_userinput.js3
-rw-r--r--dom/html/test/mochitest.ini2
4 files changed, 20 insertions, 5 deletions
diff --git a/dom/html/HTMLMenuElement.cpp b/dom/html/HTMLMenuElement.cpp
index 6c096084ac..a099a5289e 100644
--- a/dom/html/HTMLMenuElement.cpp
+++ b/dom/html/HTMLMenuElement.cpp
@@ -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 {
diff --git a/dom/html/HTMLMenuItemElement.cpp b/dom/html/HTMLMenuItemElement.cpp
index 5c5cf8d767..6cf4eb40c2 100644
--- a/dom/html/HTMLMenuItemElement.cpp
+++ b/dom/html/HTMLMenuItemElement.cpp
@@ -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 {
diff --git a/dom/html/test/browser_content_contextmenu_userinput.js b/dom/html/test/browser_content_contextmenu_userinput.js
index 7d0387715b..845ba718e3 100644
--- a/dom/html/test/browser_content_contextmenu_userinput.js
+++ b/dom/html/test/browser_content_contextmenu_userinput.js
@@ -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
diff --git a/dom/html/test/mochitest.ini b/dom/html/test/mochitest.ini
index 5c9c66e614..dcbb73840a 100644
--- a/dom/html/test/mochitest.ini
+++ b/dom/html/test/mochitest.ini
@@ -1,4 +1,6 @@
[DEFAULT]
+prefs =
+ dom.menuitem.enabled=true # only for test_bug617528.html
support-files =
347174transform.xsl
347174transformable.xml