Make <menuitem> pref-controlled and disable by default.
parent
e57592c1ba
commit
6a6db2ef0f
|
@ -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,21 @@
|
|||
|
||||
#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) {
|
||||
if (mozilla::Preferences::GetBool("dom.menuitem.enabled")) {
|
||||
return new mozilla::dom::HTMLMenuItemElement(aNodeInfo, aFromParser);
|
||||
} else {
|
||||
return new mozilla::dom::HTMLUnknownElement(aNodeInfo);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
|
|
@ -496,8 +496,6 @@ var interfaceNamesInGlobalScope =
|
|||
"HTMLMediaElement",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"HTMLMenuElement",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"HTMLMenuItemElement",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"HTMLMetaElement",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
|
|
@ -71,7 +71,6 @@
|
|||
['map', 'Map'],
|
||||
['mark', ''],
|
||||
['menu', 'Menu'],
|
||||
['menuitem', 'MenuItem'],
|
||||
['meta', 'Meta'],
|
||||
['meter', 'Meter'],
|
||||
['nav', ''],
|
||||
|
|
|
@ -82,6 +82,7 @@ interface GlobalEventHandlers {
|
|||
attribute EventHandler onseeked;
|
||||
attribute EventHandler onseeking;
|
||||
attribute EventHandler onselect;
|
||||
[Pref="dom.menuitem.enabled"]
|
||||
attribute EventHandler onshow;
|
||||
//(Not implemented)attribute EventHandler onsort;
|
||||
attribute EventHandler onstalled;
|
||||
|
|
|
@ -49,10 +49,8 @@ interface HTMLElement : Element {
|
|||
attribute DOMString contentEditable;
|
||||
[Pure]
|
||||
readonly attribute boolean isContentEditable;
|
||||
[Pure]
|
||||
[Pure, Pref="dom.menuitem.enabled"]
|
||||
readonly attribute HTMLMenuElement? contextMenu;
|
||||
//[SetterThrows]
|
||||
// attribute HTMLMenuElement? contextMenu;
|
||||
[CEReactions, SetterThrows, Pure]
|
||||
attribute boolean spellcheck;
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@ interface MenuBuilder;
|
|||
// http://www.whatwg.org/specs/web-apps/current-work/#the-menu-element
|
||||
[HTMLConstructor]
|
||||
interface HTMLMenuElement : HTMLElement {
|
||||
[CEReactions, SetterThrows]
|
||||
[CEReactions, SetterThrows, Pref="dom.menuitem.enabled"]
|
||||
attribute DOMString type;
|
||||
[CEReactions, SetterThrows]
|
||||
[CEReactions, SetterThrows, Pref="dom.menuitem.enabled"]
|
||||
attribute DOMString label;
|
||||
};
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
*/
|
||||
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/#the-menuitem-element
|
||||
[HTMLConstructor]
|
||||
[HTMLConstructor, Pref="dom.menuitem.enabled"]
|
||||
interface HTMLMenuItemElement : HTMLElement {
|
||||
[CEReactions, SetterThrows]
|
||||
attribute DOMString type;
|
||||
|
|
|
@ -576,8 +576,10 @@ ul, menu, dir {
|
|||
padding-inline-start: 40px;
|
||||
}
|
||||
|
||||
menu[type="context"] {
|
||||
display: none !important;
|
||||
@supports -moz-bool-pref("dom.menuitem.enabled") {
|
||||
menu[type="context"] {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
ol {
|
||||
|
|
|
@ -4978,6 +4978,9 @@ pref("dom.mozInputMethod.enabled", false);
|
|||
// Enable mapped array buffer by default.
|
||||
pref("dom.mapped_arraybuffer.enabled", true);
|
||||
|
||||
// Whether <menuitem> is a thing or not.
|
||||
pref("dom.menuitem.enabled", false);
|
||||
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
// The tables used for Safebrowsing phishing and malware checks.
|
||||
pref("urlclassifier.malwareTable", "goog-malware-shavar,goog-unwanted-shavar,test-malware-simple,test-unwanted-simple");
|
||||
|
|
Loading…
Reference in New Issue