Bug 1680167 - Part 4: MOZ_CAN_RUN_SCRIPT in dom/xul r=masayuki

Differential Revision: https://phabricator.services.mozilla.com/D98627
This commit is contained in:
Kagami Sascha Rosylight 2020-12-03 22:08:44 +00:00
parent 8ab2900b08
commit 00c44d3b04
4 changed files with 9 additions and 7 deletions

View File

@ -14,8 +14,10 @@ webidl Element;
[scriptable, uuid(a9fa9fd3-8d62-4f94-9ed8-3ea9c3cf0773)]
interface nsIDOMXULCommandDispatcher : nsISupports
{
attribute Element focusedElement;
attribute mozIDOMWindowProxy focusedWindow;
[setter_can_run_script]
attribute Element focusedElement;
[setter_can_run_script]
attribute mozIDOMWindowProxy focusedWindow;
void addCommandUpdater(in Element updater,
in AString events,

View File

@ -150,7 +150,7 @@ nsXULCommandDispatcher::GetFocusedWindow(mozIDOMWindowProxy** aWindow) {
NS_IMETHODIMP
nsXULCommandDispatcher::SetFocusedElement(Element* aElement) {
nsFocusManager* fm = nsFocusManager::GetFocusManager();
RefPtr<nsFocusManager> fm = nsFocusManager::GetFocusManager();
NS_ENSURE_TRUE(fm, NS_ERROR_FAILURE);
if (aElement) {
@ -170,7 +170,7 @@ nsXULCommandDispatcher::SetFocusedWindow(mozIDOMWindowProxy* aWindow) {
nsCOMPtr<nsPIDOMWindowOuter> window = nsPIDOMWindowOuter::From(aWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
nsFocusManager* fm = nsFocusManager::GetFocusManager();
RefPtr<nsFocusManager> fm = nsFocusManager::GetFocusManager();
NS_ENSURE_TRUE(fm, NS_ERROR_FAILURE);
// get the containing frame for the window, and set it as focused. This will

View File

@ -210,8 +210,7 @@ nsresult nsXULPopupListener::FireFocusOnTargetContent(
currFrame = currFrame->GetParent();
}
nsFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {
if (RefPtr<nsFocusManager> fm = nsFocusManager::GetFocusManager()) {
if (newFocusElement) {
uint32_t focusFlags =
nsIFocusManager::FLAG_BYMOUSE | nsIFocusManager::FLAG_NOSCROLL;

View File

@ -50,7 +50,8 @@ class nsXULPopupListener : public nsIDOMEventListener {
private:
#ifndef NS_CONTEXT_MENU_IS_MOUSEUP
// When a context menu is opened, focus the target of the contextmenu event.
nsresult FireFocusOnTargetContent(nsIContent* aTargetContent, bool aIsTouch);
MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult
FireFocusOnTargetContent(nsIContent* aTargetContent, bool aIsTouch);
#endif
// |mElement| is the node to which this listener is attached.