Bug 1322736 part.4 Remove pref to enable BeforeAfterKeyboardEvent and permission to allow to handle the event r?smaug
MozReview-Commit-ID: BcYcN4soTvg
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -679,19 +679,16 @@ pref("dom.ipc.reuse_parent_app", false);
// When a process receives a system message, we hold a CPU wake lock on its
// behalf for this many seconds, or until it handles the system message,
// whichever comes first.
pref("dom.ipc.systemMessageCPULockTimeoutSec", 30);
// Ignore the "dialog=1" feature in window.open.
pref("dom.disable_window_open_dialog_feature", true);
-// Enable before keyboard events and after keyboard events.
-pref("dom.beforeAfterKeyboardEvent.enabled", true);
-
// Screen reader support
pref("accessibility.accessfu.activate", 2);
pref("accessibility.accessfu.quicknav_modes", "Link,Heading,FormElement,Landmark,ListItem");
// Active quicknav mode, index value of list from quicknav_modes
pref("accessibility.accessfu.quicknav_index", 0);
// Setting for an utterance order (0 - description first, 1 - description last).
pref("accessibility.accessfu.utterance", 1);
// Whether to skip images with empty alt text
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -739,17 +739,16 @@ nsIPresShell::FrameSelection()
//----------------------------------------------------------------------
static bool sSynthMouseMove = true;
static uint32_t sNextPresShellId;
static bool sPointerEventEnabled = true;
static bool sPointerEventImplicitCapture = false;
static bool sAccessibleCaretEnabled = false;
static bool sAccessibleCaretOnTouch = false;
-static bool sBeforeAfterKeyboardEventEnabled = false;
/* static */ bool
PresShell::AccessibleCaretEnabled(nsIDocShell* aDocShell)
{
static bool initialized = false;
if (!initialized) {
Preferences::AddBoolVarCache(&sAccessibleCaretEnabled, "layout.accessiblecaret.enabled");
Preferences::AddBoolVarCache(&sAccessibleCaretOnTouch, "layout.accessiblecaret.enabled_on_touch");
@@ -764,28 +763,16 @@ PresShell::AccessibleCaretEnabled(nsIDoc
if (sAccessibleCaretOnTouch && dom::TouchEvent::PrefEnabled(aDocShell)) {
return true;
}
// Otherwise, disabled.
return false;
}
/* static */ bool
-PresShell::BeforeAfterKeyboardEventEnabled()
-{
- static bool sInitialized = false;
- if (!sInitialized) {
- Preferences::AddBoolVarCache(&sBeforeAfterKeyboardEventEnabled,
- "dom.beforeAfterKeyboardEvent.enabled");
- sInitialized = true;
- }
- return sBeforeAfterKeyboardEventEnabled;
-}
-
-/* static */ bool
PresShell::IsTargetIframe(nsINode* aTarget)
{
return aTarget && aTarget->IsHTMLElement(nsGkAtoms::iframe);
}
PresShell::PresShell()
: mMouseLocation(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE)
{
@@ -7036,65 +7023,16 @@ public:
private:
int32_t mPointerId;
uint16_t mPointerType;
bool mIsPrimary;
bool mIsSet;
};
-static bool
-CheckPermissionForBeforeAfterKeyboardEvent(Element* aElement)
-{
- // An element which is chrome-privileged should be able to handle before
- // events and after events.
- nsIPrincipal* principal = aElement->NodePrincipal();
- if (nsContentUtils::IsSystemPrincipal(principal)) {
- return true;
- }
-
- // An element which has "before-after-keyboard-event" permission should be
- // able to handle before events and after events.
- nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
- uint32_t permission = nsIPermissionManager::DENY_ACTION;
- if (permMgr) {
- permMgr->TestPermissionFromPrincipal(principal, "before-after-keyboard-event", &permission);
- if (permission == nsIPermissionManager::ALLOW_ACTION) {
- return true;
- }
- }
-
- return false;
-}
-
-static void
-BuildTargetChainForBeforeAfterKeyboardEvent(nsINode* aTarget,
- nsTArray<nsCOMPtr<Element> >& aChain,
- bool aTargetIsIframe)
-{
- Element* frameElement;
- // If event target is not an iframe, skip the event target and get its
- // parent frame.
- if (aTargetIsIframe) {
- frameElement = aTarget->AsElement();
- } else {
- nsPIDOMWindowOuter* window = aTarget->OwnerDoc()->GetWindow();
- frameElement = window ? window->GetFrameElementInternal() : nullptr;
- }
-
- // Check permission for all ancestors and add them into the target chain.
- while (frameElement) {
- if (CheckPermissionForBeforeAfterKeyboardEvent(frameElement)) {
- aChain.AppendElement(frameElement);
- }
- nsPIDOMWindowOuter* window = frameElement->OwnerDoc()->GetWindow();
- frameElement = window ? window->GetFrameElementInternal() : nullptr;
- }
-}
-
bool
PresShell::CanDispatchEvent(const WidgetGUIEvent* aEvent) const
{
bool rv =
mPresContext && !mHaveShutDown && nsContentUtils::IsSafeToRunScript();
if (aEvent) {
rv &= (aEvent && aEvent->mWidget && !aEvent->mWidget->Destroyed());
}
--- a/layout/base/PresShell.h
+++ b/layout/base/PresShell.h
@@ -86,19 +86,16 @@ public:
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
// nsISupports
NS_DECL_ISUPPORTS
static bool AccessibleCaretEnabled(nsIDocShell* aDocShell);
- // BeforeAfterKeyboardEvent preference
- static bool BeforeAfterKeyboardEventEnabled();
-
static bool IsTargetIframe(nsINode* aTarget);
void Init(nsIDocument* aDocument, nsPresContext* aPresContext,
nsViewManager* aViewManager, mozilla::StyleSetHandle aStyleSet);
virtual void Destroy() override;
virtual void UpdatePreferenceStyles() override;
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5246,19 +5246,16 @@ pref("dom.caches.enabled", true);
// supported will be disabled. This threshold can be adjusted to suit other
// platforms; and set to 0 to disable the low-memory check altogether.
pref("camera.control.low_memory_thresholdMB", 404);
#endif
// UDPSocket API
pref("dom.udpsocket.enabled", false);
-// Disable before keyboard events and after keyboard events by default.
-pref("dom.beforeAfterKeyboardEvent.enabled", false);
-
// Presentation API
pref("dom.presentation.enabled", false);
pref("dom.presentation.controller.enabled", false);
pref("dom.presentation.receiver.enabled", false);
// Presentation Device
pref("dom.presentation.tcp_server.debug", false);
pref("dom.presentation.discovery.enabled", false);
--- a/testing/mochitest/manifest.webapp
+++ b/testing/mochitest/manifest.webapp
@@ -21,17 +21,16 @@
"camera":{},
"geolocation":{},
"wifi-manage":{},
"desktop-notification":{},
"idle":{},
"network-events":{},
"audio-channel-content":{},
"audio-channel-alarm":{},
- "before-after-keyboard-event":{}
},
"locales": {
"en-US": {
"name": "Mochitest",
"description": "Mochitests"
}
},
"default_locale": "en-US"