From 69ff22a78ec86e78157067e3f49ec456f2464ed2 Mon Sep 17 00:00:00 2001 From: Bogdan Tara Date: Fri, 20 Mar 2020 11:25:11 +0200 Subject: [PATCH] Backed out changeset e50cbce87f8d (bug 1618539) for nsFocusManager related crashes CLOSED TREE --- .../tests/browser/browser_locationBarExternalLoad.js | 8 ++++++++ dom/base/nsFocusManager.cpp | 3 +-- dom/base/test/chrome/bug418986-1.js | 10 ++++------ dom/interfaces/base/nsIFocusManager.idl | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/browser/components/urlbar/tests/browser/browser_locationBarExternalLoad.js b/browser/components/urlbar/tests/browser/browser_locationBarExternalLoad.js index 3560179be40d..1b1da7510d7e 100644 --- a/browser/components/urlbar/tests/browser/browser_locationBarExternalLoad.js +++ b/browser/components/urlbar/tests/browser/browser_locationBarExternalLoad.js @@ -76,6 +76,14 @@ async function testURL(url, loadFunc, endFunc) { null, "focusedElement not null" ); + + if (arg.isRemote) { + Assert.equal( + Services.focus.activeWindow, + content, + "activeWindow not correct" + ); + } } ); diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index 66f909efa9f1..bda26d186806 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -359,8 +359,7 @@ InputContextAction::Cause nsFocusManager::GetFocusMoveActionCause( NS_IMETHODIMP nsFocusManager::GetActiveWindow(mozIDOMWindowProxy** aWindow) { - MOZ_ASSERT(XRE_IsParentProcess(), - "Must not be called outside the parent process."); + // TODO mActiveWindow in content process NS_IF_ADDREF(*aWindow = mActiveWindow); return NS_OK; } diff --git a/dom/base/test/chrome/bug418986-1.js b/dom/base/test/chrome/bug418986-1.js index 72653a7718c4..8e8408c9b331 100644 --- a/dom/base/test/chrome/bug418986-1.js +++ b/dom/base/test/chrome/bug418986-1.js @@ -7,10 +7,8 @@ var test = function(isContent) { set: [["security.allow_eval_with_system_principal", true]], }); - if (!isContent) { - let { ww } = SpecialPowers.Services; - window.chromeWindow = ww.activeWindow; - } + let { ww } = SpecialPowers.Services; + window.chromeWindow = ww.activeWindow; // The pairs of values expected to be the same when // fingerprinting resistance is enabled. @@ -64,11 +62,11 @@ var test = function(isContent) { pairs.map(function([item, onVal]) { if (resisting) { checkPair("window." + item, onVal); - } else if (!isContent && !item.startsWith("moz")) { + } else if (!item.startsWith("moz")) { checkPair("window." + item, "chromeWindow." + item); } }); - if (!isContent && !resisting) { + if (!resisting) { // Hard to predict these values, but we can enforce constraints: ok( window.mozInnerScreenX >= chromeWindow.mozInnerScreenX, diff --git a/dom/interfaces/base/nsIFocusManager.idl b/dom/interfaces/base/nsIFocusManager.idl index da159593d6c2..d060eec0ed33 100644 --- a/dom/interfaces/base/nsIFocusManager.idl +++ b/dom/interfaces/base/nsIFocusManager.idl @@ -45,7 +45,7 @@ interface nsIFocusManager : nsISupports { /** * The most active (frontmost) window, or null if no window that is part of - * the application is active. Do not use outside the parent process. + * the application is active. */ readonly attribute mozIDOMWindowProxy activeWindow;