cannot input with ATOK Passport's moji pallet
Categories
(Core :: DOM: UI Events & Focus Handling, defect, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr60 | --- | unaffected |
firefox66 | --- | unaffected |
firefox67 | --- | unaffected |
firefox68 | + | verified |
firefox69 | --- | verified |
People
(Reporter: ayakawa.m, Assigned: hsivonen)
References
(Regression)
Details
(Keywords: inputmethod, regression)
Attachments
(3 files, 1 obsolete file)
(deleted),
text/x-phabricator-request
|
jcristau
:
approval-mozilla-beta+
|
Details |
(deleted),
text/x-phabricator-request
|
jcristau
:
approval-mozilla-beta+
|
Details |
(deleted),
text/x-phabricator-request
|
jcristau
:
approval-mozilla-beta+
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0
Steps to reproduce:
- use IME:ATOK Passport
- set current cursor to Editable item(URL bar, Text area)
- enable ATOK and open ATOK 文字パレット(moji pallet)
- select some charactor and push 確定
Actual results:
no charactor input.
Expected results:
input selected charactor.
Comment 1•6 years ago
|
||
I couldn't reproduce the problem on the location bar of the Firefox itself. However, I've successfully reproduced it on a contenteditable=true Web contents, for example: https://piro.sakura.ne.jp/apps/emoji-editor.html
My environment is:
- UA: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0
- Build ID: 20190507214514
- OS: Windows 10 1809
- ATOK Passport ver.31.1.6
Reporter | ||
Comment 2•6 years ago
|
||
I retried this bug, URL bar accept to input with moji pallet.
thank you piro for your infomation.
Reporter | ||
Comment 3•6 years ago
|
||
regression range
2019/03/18 - 2019/03/19
build aa59ec8e : this bug is happen. But, after input char with keyboard, can input with moji pallet.
build 2244c803 : never input.
Updated•6 years ago
|
Comment 4•6 years ago
|
||
regression by "Bug 1524242 - Capture TabParent of out-of-process iframe when creating TextComposition. r=masayuki" according to mozgression.
Comment 5•6 years ago
|
||
moving to right component since this is regression by bug 1524242
Comment 6•6 years ago
|
||
[Tracking Requested - why for this release]: This is new regression of 68, and breaks features of IME (and perhaps, some a11y tools).
When user clicks in Moji-pallet of ATOK, Firefox has lost focus. In such case, does BrowserParent::GetFocused()
return nullptr
?
https://searchfox.org/mozilla-central/rev/197210b8c139b64f642edaa3336d26b9c1761568/layout/base/PresShell.cpp#8267
If so, TextComposition
is created for the main process even when active element has TabParent
in it. So, perhaps, there should be BrowserParent::GetActive()
which returns TabParent
for active element (i.e., active element in the window is not associated with TabParent
, should return nullptr
. I.e., not simply returns /last/ focused TabParent
).
Assignee | ||
Comment 7•6 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Might be slow response)(away 5/10~5/19) from comment #6)
[Tracking Requested - why for this release]: This is new regression of 68, and breaks features of IME (and perhaps, some a11y tools).
When user clicks in Moji-pallet of ATOK, Firefox has lost focus. In such case, does
BrowserParent::GetFocused()
returnnullptr
?
I believe so.
If so,
TextComposition
is created for the main process even when active element hasTabParent
in it. So, perhaps, there should beBrowserParent::GetActive()
which returnsTabParent
for active element (i.e., active element in the window is not associated withTabParent
, should returnnullptr
. I.e., not simply returns /last/ focusedTabParent
).
How should we differentiate between "Before Firefox as a whole lost focus, the focus was in Web content" and "Before Firefox as a whole lost focus, the focus was in chrome"? Or is there some other check elsewhere which would make returning the last-focused Web content OK here even if logically focus was in chrome before Firefox as a whole lost focus?
Can we make Widget trigger caching of the focused BrowserParent
(including nullptr
if chrome is focused) when Firefox as a whole is about to lose focus? What would be the right place in the Widget code to do stuff before letting Firefox as a whole lose focus before actually triggeting the focus deactivation?
Comment 8•6 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #7)
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Might be slow response)(away 5/10~5/19) from comment #6)
[Tracking Requested - why for this release]: This is new regression of 68, and breaks features of IME (and perhaps, some a11y tools).
When user clicks in Moji-pallet of ATOK, Firefox has lost focus. In such case, does
BrowserParent::GetFocused()
returnnullptr
?I believe so.
Okay, that means it's the cause.
If so,
TextComposition
is created for the main process even when active element hasTabParent
in it. So, perhaps, there should beBrowserParent::GetActive()
which returnsTabParent
for active element (i.e., active element in the window is not associated withTabParent
, should returnnullptr
. I.e., not simply returns /last/ focusedTabParent
).How should we differentiate between "Before Firefox as a whole lost focus, the focus was in Web content" and "Before Firefox as a whole lost focus, the focus was in chrome"?
In the latter case, and <input>
in chrome widget, 3rd party apps can input text into it. This is what the behavior mentioned in comment 2.
Or is there some other check elsewhere which would make returning the last-focused Web content OK here even if logically focus was in chrome before Firefox as a whole lost focus?
No, we shouldn't need such checks. We should handle input events even on inactive windows with active element in active document in it.
Can we make Widget trigger caching of the focused
BrowserParent
(includingnullptr
if chrome is focused) when Firefox as a whole is about to lose focus? What would be the right place in the Widget code to do stuff before letting Firefox as a whole lose focus before actually triggeting the focus deactivation?
Currently, BrowserParent::PopFocus()
makes itself forget focus information when BrowserParent::Deactivate()
is called. From a point of view of user input event handling, this must be wrong. Any 3rd party applications (including IME and a11y tools) can synthesize input events even on inactive window (i.e., on inactive nsIWidget
instance). So, if we can keep sFocusStack
even during inactive, this must be able to fix easy. Can we do that? Or we need to move the information into another one?
Note that if web content moves focus with Element.focus()
on inactive window, the target should be changed to new active element. So, I think that BrowserParent
needs to keep managing focused TabParent
even while it's inactive.
Assignee | ||
Comment 9•6 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Might be slow response)(away 5/10~5/19) from comment #8)
No, we shouldn't need such checks. We should handle input events even on inactive windows with active element in active document in it.
This surprises me, considering that a window becoming inactive means that IME composition gets committed. If inactive windows are expected not to have normal IME compositions, how does TextComposition
get created in this case?
Can we make Widget trigger caching of the focused
BrowserParent
(includingnullptr
if chrome is focused) when Firefox as a whole is about to lose focus? What would be the right place in the Widget code to do stuff before letting Firefox as a whole lose focus before actually triggeting the focus deactivation?Currently,
BrowserParent::PopFocus()
makes itself forget focus information whenBrowserParent::Deactivate()
is called. From a point of view of user input event handling, this must be wrong. Any 3rd party applications (including IME and a11y tools) can synthesize input events even on inactive window (i.e., on inactivensIWidget
instance). So, if we can keepsFocusStack
even during inactive, this must be able to fix easy. Can we do that?
The code I added for Fission IME handling is based on the assumption that inactive windows cannot receive keyboard events or perform IME compositions.
Activate
/Deactive
calls don't carry information on whether focus is moving or the whole native window is going to the background, so we can't simply keep the stack.
Or we need to move the information into another one?
We could take a snapshot of the top of the focus stack before the stack changes if we act from a widget signal before actually performing the Deactivate
calls, but...
Note that if web content moves focus with
Element.focus()
on inactive window, the target should be changed to new active element. So, I think thatBrowserParent
needs to keep managing focusedTabParent
even while it's inactive.
...just taking a snapshot wouldn't handle the case of Web content moving focus in an inactive window. I don't have any obvious ideas of how the case of focus moving in an inactive window between processes could be handled. Do you have a suggestion? How bad would it be if we didn't handle that case?
Comment 10•6 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #9)
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Might be slow response)(away 5/10~5/19) from comment #8)
No, we shouldn't need such checks. We should handle input events even on inactive windows with active element in active document in it.
This surprises me, considering that a window becoming inactive means that IME composition gets committed.
IIRC, on Linux, IME itself does it, but not so on Windows. On Windows, if parent process becomes busy, it temporarily loses focus, but we shouldn't commit composition in the moment.
If inactive windows are expected not to have normal IME compositions, how does
TextComposition
get created in this case?
No, we've not expected that since some software keyboard may steal focus from active application like this case. So, we need to handle it with active element in active document in active TabParent in the window which receives input events during inactive.
Can we make Widget trigger caching of the focused
BrowserParent
(includingnullptr
if chrome is focused) when Firefox as a whole is about to lose focus? What would be the right place in the Widget code to do stuff before letting Firefox as a whole lose focus before actually triggeting the focus deactivation?Currently,
BrowserParent::PopFocus()
makes itself forget focus information whenBrowserParent::Deactivate()
is called. From a point of view of user input event handling, this must be wrong. Any 3rd party applications (including IME and a11y tools) can synthesize input events even on inactive window (i.e., on inactivensIWidget
instance). So, if we can keepsFocusStack
even during inactive, this must be able to fix easy. Can we do that?The code I added for Fission IME handling is based on the assumption that inactive windows cannot receive keyboard events or perform IME compositions.
Activate
/Deactive
calls don't carry information on whether focus is moving or the whole native window is going to the background, so we can't simply keep the stack.
I think that we don't need to check the difference. For example, on Windows, other applications can send text input messages to inactive window even when another window of the process is active (although not realistic scenario). So, we should keep managing focus in each window.
Or we need to move the information into another one?
We could take a snapshot of the top of the focus stack before the stack changes if we act from a widget signal before actually performing the
Deactivate
calls, but...Note that if web content moves focus with
Element.focus()
on inactive window, the target should be changed to new active element. So, I think thatBrowserParent
needs to keep managing focusedTabParent
even while it's inactive....just taking a snapshot wouldn't handle the case of Web content moving focus in an inactive window. I don't have any obvious ideas of how the case of focus moving in an inactive window between processes could be handled. Do you have a suggestion? How bad would it be if we didn't handle that case?
For short-term goal to fix this in realistic scenarios, snap-shot at inactivating may fix this (unless web apps changes focus immediately before that).
Unfortunately, I've not yet understood the focus handling in Fission world. So, I have no idea which can help you for now...
Assignee | ||
Comment 11•6 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Might be slow response)(away 5/10~5/19) from comment #10)
For short-term goal to fix this in realistic scenarios, snap-shot at inactivating may fix this (unless web apps changes focus immediately before that).
I'll pursue this approach first, because I don't have ideas of how to fix this properly.
Assignee | ||
Comment 12•6 years ago
|
||
This seems to be the closest to platform-specific code for handling window moving to background:
https://searchfox.org/mozilla-central/rev/197210b8c139b64f642edaa3336d26b9c1761568/xpfe/appshell/nsWebShellWindow.cpp#808
Assignee | ||
Comment 13•6 years ago
|
||
The snapshot should probably be taken right about here:
https://searchfox.org/mozilla-central/rev/197210b8c139b64f642edaa3336d26b9c1761568/dom/base/nsFocusManager.cpp#737
Comment 14•6 years ago
|
||
Is the regressing patch something we can back out of 68, to give us more time?
Assignee | ||
Comment 15•6 years ago
|
||
(In reply to Julien Cristau [:jcristau] from comment #14)
Is the regressing patch something we can back out of 68, to give us more time?
The patch won't back out cleanly. There has been quite a bit of Fission work with interdependencies and intervening renames. In any case it would require manually undoing the changes instead of just backing out, and it's likely that the amount of code affected in such reversal would be rather large.
I think there's a good chance that the snapshot approach discussed in earlier comments will fix the user impact for practical purposes despite being obviously inadequate to handle scenarios where page-provided JS moves focus between content processes in a background window. Since Fission isn't yet enabled to the point that the user base in general would be running with Fission, the edge cases should not be relevant at this time (unless page JS manages to hand focus from Web content to chrome in a background window).
Assignee | ||
Comment 16•6 years ago
|
||
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 17•6 years ago
|
||
Assignee | ||
Comment 18•6 years ago
|
||
Does the build available from https://queue.taskcluster.net/v1/task/TZ80qIZHQGu4ASlghuHu_w/runs/0/artifacts/public/build/target.zip fix the problem?
Assignee | ||
Comment 20•6 years ago
|
||
(In reply to Takeshi Ichimaru(a.k.a. Ayakawa) from comment #19)
I tested it, not fix.
Thank you.
I'll re-verify that my patch works the way I expected it to, but other than that, I don't now have ideas of what might be wrong. :-(
Assignee | ||
Comment 21•6 years ago
|
||
(In reply to Takeshi Ichimaru(a.k.a. Ayakawa) from comment #3)
build aa59ec8e : this bug is happen
Ooh, part of this uses pasting and not a composition.
Assignee | ||
Comment 22•6 years ago
|
||
Assignee | ||
Comment 23•6 years ago
|
||
Does https://queue.taskcluster.net/v1/task/LA90ZkghTt2LMCXb6WlMfg/runs/0/artifacts/public/build/target.zip fix the problem?
Assignee | ||
Comment 25•6 years ago
|
||
Assignee | ||
Comment 26•6 years ago
|
||
I think it's not enough to be able to deliver composition events, but it's probably also necessary to be able to respond to content queries properly. My current guess is that with the current patch the content cache in parent goes into a state that's inconsistent with the ability to deliver composition events. I fail to see what might flush the content cache, though.
Masayuki, does that guess seem right? Considering the current patch, what should I change to keep the content cache responsive when Firefox is in the background?
Comment 27•6 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #26)
I think it's not enough to be able to deliver composition events,
Yes. Query content events and keypress events should also be delivered to the active document/element.
but it's probably also necessary to be able to respond to content queries properly.
Exactly.
My current guess is that with the current patch the content cache in parent goes into a state that's inconsistent with the ability to deliver composition events. I fail to see what might flush the content cache, though.
Masayuki, does that guess seem right? Considering the current patch, what should I change to keep the content cache responsive when Firefox is in the background?
I guess so. I'll check what's going with debugger. (And do you have a bug# which implements new TabParent
management? I'd like to check how the main process knows new TabParent
when it gets focus again.)
Assignee | ||
Comment 28•6 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Might be slow response) from comment #27)
(In reply to Henri Sivonen (:hsivonen) from comment #26)
I think it's not enough to be able to deliver composition events,
Yes. Query content events and keypress events should also be delivered to the active document/element.
OK. Key events aren't handled by the patch, but my attempt to deliver query content events doesn't work, because for whatever reason, the event dispatch doesn't get as far as the point where the event is actually routed.
but it's probably also necessary to be able to respond to content queries properly.
Exactly.
My current guess is that with the current patch the content cache in parent goes into a state that's inconsistent with the ability to deliver composition events. I fail to see what might flush the content cache, though.
Masayuki, does that guess seem right? Considering the current patch, what should I change to keep the content cache responsive when Firefox is in the background?
I guess so. I'll check what's going with debugger.
Thank you.
(And do you have a bug# which implements new
TabParent
management? I'd like to check how the main process knows newTabParent
when it gets focus again.)
Bug 1535537. nsFocusManager knows to initiate the right Activate
chain when a window is raised.
Comment 29•6 years ago
|
||
Ah, when active window becomes inactive, in the main process, nsFocusManager::WindowLowered()
calls nsFocusManager::Blur()
, then, it calls BrowserParent::Deactive()
, then, it calls BrowserParent::PopFocus()
, then, [it calls IMEStateManager::OnFocusMovedBetweenBrowsers()
],(https://searchfox.org/mozilla-central/rev/952521e6164ddffa3f34bc8cfa5a81afc5b859c4/dom/ipc/BrowserParent.cpp#2699) then, IMEStateManager::NotifyIME()
is called with NOTIFY_IME_OF_BLUR
and finally, TSFTextStore
is destroyed. So, we've already notified Windows of stopping handling composition. Therefore, moji pallet does nothing even when user tries to input some characters.
I have a question here, why do we need to forget focused BrowserParent
s when it goes inactive? Instead, cannot we make nsFocusManager
forget all focused BrowerParent
s when another window becomes active?
Comment 30•6 years ago
|
||
Fortunately, in content process, StopIMEStateManagement()
is called from IMEStateManager::OnFocusMovedBetweenBrowsers()
in the main process. Therefore, there is no conflict between main process IME state and content process IME state.
However, this fact means that, 68 has another regression which is same as bug 835262.
Assignee | ||
Comment 31•6 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Might be slow response) from comment #29)
I have a question here, why do we need to forget focused
BrowserParent
s when it goes inactive? Instead, cannot we makensFocusManager
forget all focusedBrowerParent
s when another window becomes active?
When focus moves out of an out-of-process iframe, BrowserParent::Deactivate
and the stack is popped.
AFAICT, we don't have a way to distinguish between "This out-of-process iframe is getting Deactivate
because Firefox as a whole is deactivating" and "This out-of-process iframe is getting Deactivate
because focus is moving to its Web-hierarchy parent".
I guess one thing that would not work for Fission but would make the Fission code not break non-Fission for now would be not popping top-level BrowserParent
until another top-level BrowserParent
is pushed.
Comment 32•6 years ago
|
||
The most important cause of this bug is, Fission code tries to manage "focused" element, but we need to manage "active" element (i.e., the result of document.activeElement
). So, I think that Fission code should keep focused BrowserParent
s even after entirely inactivated. Additionally, it should keep managing BrowserParent
array when active element is modified during inactive. Anyway, such changes cannot be fixed in 68 though.
What is the reason why Fission code manages "focus" elements rather than "active" elements?
Assignee | ||
Comment 33•6 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Might be slow response) from comment #32)
What is the reason why Fission code manages "focus" elements rather than "active" elements?
Because I wasn't aware of the finer points of the distinction, and Activate
/Deactivate
were the pre-existing cross-process hooks.
Updated•6 years ago
|
Assignee | ||
Comment 34•6 years ago
|
||
The latest patch avoids popping the stack in response to window lowering. MOZ_LOG on Linux indicates it works like it is supposed to.
Assignee | ||
Comment 35•6 years ago
|
||
Does the build at https://queue.taskcluster.net/v1/task/IajrwCQ9QcORCQjxkM5xwQ/runs/0/artifacts/public/build/target.zip fix the problem for you?
Reporter | ||
Comment 36•6 years ago
|
||
Good. I can input with Moji Panel.
But, need to input some char with keyboard before we input with Moji Panel. ( same as comment 3 good case )
Assignee | ||
Comment 37•6 years ago
|
||
(In reply to Takeshi Ichimaru(a.k.a. Ayakawa) from comment #36)
Good. I can input with Moji Panel.
Thank you.
But, need to input some char with keyboard before we input with Moji Panel. ( same as comment 3 good case )
Masayuki, do you have insight into what mechanism causes prior keyboard input to make a difference?
Comment 38•6 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #37)
(In reply to Takeshi Ichimaru(a.k.a. Ayakawa) from comment #36)
But, need to input some char with keyboard before we input with Moji Panel. ( same as comment 3 good case )
Masayuki, do you have insight into what mechanism causes prior keyboard input to make a difference?
Sorry for the delay. I've not completely investigated it yet, the root cause is, IMEContentObserver::KeepAliveDuringDeactive()
returns false
only until user type a character in editable content on the puppet widget. It seems that this is a regression of bug 1349255. So, please go ahead with ignoring this symptom (out of scope of this bug).
Assignee | ||
Comment 39•6 years ago
|
||
Thanks.
Comment 40•6 years ago
|
||
Comment 41•6 years ago
|
||
Backed out changeset 79436da3bf79 (Bug 1549930) for causing perma browser chrome failures in browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js CLOSED TREE
https://treeherder.mozilla.org/#/jobs?repo=autoland&resultStatus=testfailed%2Cbusted%2Cexception&classifiedState=unclassified&fromchange=26625ccc272ce893c72ccd0dab2d5ef6b727ddae&selectedJob=248547861
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=248547861&repo=autoland&lineNumber=2785
Comment 42•6 years ago
|
||
Comment 43•6 years ago
|
||
There are also bc leakcheck:
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=248576034&repo=autoland&lineNumber=57111
Updated•6 years ago
|
Updated•6 years ago
|
Assignee | ||
Comment 44•6 years ago
|
||
Assignee | ||
Comment 45•6 years ago
|
||
rrosario, browser_privatebrowsing_about.js seems to first fail with "url bar has hidden focused" for me locally. However, that bit didn't fail in CI: https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=79436da3bf79&selectedJob=248547861
Any idea why that test might fail with ASAN, which generally makes things slower?
Comment 46•6 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #45)
Any idea why that test might fail with ASAN, which generally makes things slower?
I guess we should be waiting for the condition instead of checking it synchronously. Want to try this change below? Or file a bug and I'll take care of it. Thanks
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js
index 14fd6c7bd2635..b276473dbe051 100644
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js
@@ -105,14 +105,16 @@ add_task(async function test_myths_link() {
await BrowserTestUtils.closeWindow(win);
});
-function urlBarHasHiddenFocus(win) {
- return win.gURLBar.hasAttribute("focused") &&
- win.gURLBar.textbox.classList.contains("hidden-focus");
+async function urlBarHasHiddenFocus(win) {
+ await BrowserTestUtils.waitForCondition(
+ () => win.gURLBar.hasAttribute("focused") && win.gURLBar.textbox.classList.contains("hidden-focus"),
+ "URL bar has hidden focus");
}
-function urlBarHasNormalFocus(win) {
- return win.gURLBar.hasAttribute("focused") &&
- !win.gURLBar.textbox.classList.contains("hidden-focus");
+async function urlBarHasNormalFocus(win) {
+ await BrowserTestUtils.waitForCondition(
+ () => win.gURLBar.hasAttribute("focused") && !win.gURLBar.textbox.classList.contains("hidden-focus"),
+ "URL bar has normal focus");
}
/**
@@ -127,13 +129,13 @@ add_task(async function test_search_handoff_on_keydown() {
btn.click();
ok(btn.classList.contains("focused"), "in-content search has focus styles");
});
- ok(urlBarHasHiddenFocus(win), "url bar has hidden focused");
+ await urlBarHasHiddenFocus(win);
await new Promise(r => EventUtils.synthesizeKey("f", {}, win, r));
await ContentTask.spawn(tab, null, async function() {
ok(content.document.getElementById("search-handoff-button").classList.contains("hidden"),
"in-content search is hidden");
});
- ok(urlBarHasNormalFocus(win), "url bar has normal focused");
+ await urlBarHasNormalFocus(win);
is(win.gURLBar.value, "@google f", "url bar has search text");
await UrlbarTestUtils.promiseSearchComplete(win);
// Close the popup.
@@ -159,9 +161,10 @@ add_task(async function test_search_handoff_on_composition_start() {
await ContentTask.spawn(tab, null, async function() {
content.document.getElementById("search-handoff-button").click();
});
- ok(urlBarHasHiddenFocus(win), "url bar has hidden focused");
+ await urlBarHasHiddenFocus(win);
await new Promise(r => EventUtils.synthesizeComposition({type: "compositionstart"}, win, r));
- ok(urlBarHasNormalFocus(win), "url bar has normal focused");
+ await urlBarHasNormalFocus(win);
+
await BrowserTestUtils.closeWindow(win);
});
@@ -176,7 +179,7 @@ add_task(async function test_search_handoff_on_paste() {
await ContentTask.spawn(tab, null, async function() {
content.document.getElementById("search-handoff-button").click();
});
- ok(urlBarHasHiddenFocus(win), "url bar has hidden focused");
+ await urlBarHasHiddenFocus(win);
var helper = SpecialPowers.Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(SpecialPowers.Ci.nsIClipboardHelper);
helper.copyString("words");
@@ -186,7 +189,7 @@ add_task(async function test_search_handoff_on_paste() {
if (UrlbarPrefs.get("quantumbar")) {
await UrlbarTestUtils.promiseSearchComplete(win);
}
- ok(urlBarHasNormalFocus(win), "url bar has normal focused");
+ await urlBarHasNormalFocus(win);
is(win.gURLBar.value, "@google words", "url bar has search text");
await BrowserTestUtils.closeWindow(win);
Assignee | ||
Comment 47•5 years ago
|
||
Thanks. Let's see it on try:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=9af7514ecbcced4213fdcc49ab447f711ec773e1
Assignee | ||
Comment 48•5 years ago
|
||
Why might the change here, not popping the active BrowserParent
stack when a window is lowered and no Firefox window is raised, cause APZ stuff to leak on Windows: https://treeherder.mozilla.org/#/jobs?repo=try&revision=ec596e58136c258581c6849703438336de458c87&selectedJob=249746155 ?
Notably, the stack doesn't increment the refcount for BrowserParent
objects.
Assignee | ||
Comment 49•5 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #48)
Notably, the stack doesn't increment the refcount for
BrowserParent
objects.
The observable change should be BrowserParent::GetFocused
returning non-null where it previously returned nullptr
, but I don't see obvious APZ callers: https://searchfox.org/mozilla-central/search?q=symbol:_ZN7mozilla3dom13BrowserParent10GetFocusedEv&redirect=false
Comment 50•5 years ago
|
||
The "APZ stuff" you see being leaked has the misfortune of being alphabetically superior to all the other things being leaked and so shows up in the TH summary while everything else is omitted. If you look at the full log you'll see all the things being leaked, and in that list is a nsWindow and nsBaseWidget. The APZ stuff is just hanging off those, so if you fix the window leak the APZ stuff will automatically go away.
Assignee | ||
Comment 51•5 years ago
|
||
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #50)
The "APZ stuff" you see being leaked has the misfortune of being alphabetically superior to all the other things being leaked and so shows up in the TH summary while everything else is omitted. If you look at the full log you'll see all the things being leaked, and in that list is a nsWindow and nsBaseWidget. The APZ stuff is just hanging off those, so if you fix the window leak the APZ stuff will automatically go away.
Thanks.
Masayuki, it seems to me that IMEStateManager
holds non-owning pointers to nsIWidget
. What might be holding an unreleased strong ref?
Assignee | ||
Comment 52•5 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #47)
Thanks. Let's see it on try:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=9af7514ecbcced4213fdcc49ab447f711ec773e1
Still fails. Filed bug 1556745.
Comment 53•5 years ago
|
||
Well, there is TSFTextStore
in the list and the number of leaked widget is just 1. So, I think that your patch does not send NOTIFY_IME_OF_BLUR
at shutting down, therefore, there is no change to release TSFTextStore
for widget/windows
and it keeps grabbing nsWindow
.
Assignee | ||
Comment 54•5 years ago
|
||
Assignee | ||
Comment 55•5 years ago
|
||
Assignee | ||
Comment 56•5 years ago
|
||
Assignee | ||
Comment 57•5 years ago
|
||
Assignee | ||
Comment 58•5 years ago
|
||
Assignee | ||
Comment 59•5 years ago
|
||
Still leaks the window even when observing shutdown:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=8310ba2ade2cefaf0b15a4ce7138b691b22c5fd5&selectedJob=250588695
Masayuki, how did TSFTextStore
manage not to leak the window prior to the Fission changes? Also, do you have advice relating to the structure of TSFTextStrore
regarding how to add nsIAsyncShutdown
to it? (The patch whose try run is in comment 58 just hopes that TSFTextStore
gets cleaned up soon enough, but since it still leaks, it looks like nsIAsyncShutdown
is needed.)
Assignee | ||
Comment 60•5 years ago
|
||
Also, since TSFTextStore
didn't leak before the patch here, does it mean that our shutdown sequence involves lowering the last window right before shutting down? Maybe instead of adding nsIAsyncShutdown
, the first popping avoidance code should check if we are shutting down and let the popping happen if we are shutting down.
Assignee | ||
Comment 61•5 years ago
|
||
Let's try checking if we're shutting down in nsFocusManager
:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=d45c588f310a4c4a4d564f03aafb6a7cda519cc2
Comment 62•5 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #59)
Masayuki, how did
TSFTextStore
manage not to leak the window prior to the Fission changes? Also, do you have advice relating to the structure ofTSFTextStrore
regarding how to addnsIAsyncShutdown
to it? (The patch whose try run is in comment 58 just hopes thatTSFTextStore
gets cleaned up soon enough, but since it still leaks, it looks likensIAsyncShutdown
is needed.)
When the widget in the main process is destroyed at shutdown, IMEStateManager::WidgetDestroyed()
is called, and it calls IMEStateManager::NotifyIMEOfBlurForChildProcess()
and it notifies the destroyed with of NOTIFY_IME_OF_BLUR
, then, it notifies TSFTextStore
of the blur, finally, TSFTextStore
destroys the active instance.
Assignee | ||
Comment 63•5 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Might be slow response) from comment #62)
When the widget in the main process is destroyed at shutdown,
IMEStateManager::WidgetDestroyed()
is called
This requires nsBaseWidget::~nsBaseWidget()
to run, since it is what calls IMEStateManager::WidgetDestroyed()
. What was the previous mechanism that ensured that the reference to the widget from TSFTextStore
was nulled out first to allow nsBaseWidget::~nsBaseWidget()
to run?
Trying a weak reference:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=f8e463559620579749a3c0c2f6b5e989680c140d
Comment 64•5 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #63)
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Might be slow response) from comment #62)
When the widget in the main process is destroyed at shutdown,
IMEStateManager::WidgetDestroyed()
is calledThis requires
nsBaseWidget::~nsBaseWidget()
to run
Ah, sorry.
Then, I guess, IMEStateManager::OnDestroyPresContext()
-> IMEStateManager::DestroyIMEContentObserver()
-> IMEContentObserver::Destroy()
, or IMEStateManager::OnTabParentDestoying()
-> IMEStateManager::NotifyIMEOfBlurForChildProcess()
?
Assignee | ||
Comment 65•5 years ago
|
||
By making the reference from TSFTextStore
to the window weak, the leak became substantially smaller:
09:24:40 INFO - TEST-INFO | leakcheck | default leaked 1 TSFTextStore
09:24:40 INFO - TEST-INFO | leakcheck | default leaked 1 TextEventDispatcher
09:24:40 INFO - TEST-INFO | leakcheck | default leaked 1 WeakReference<nsWindowBase>
09:24:40 INFO - TEST-INFO | leakcheck | default leaked 3 nsTArray_base
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=251119561&repo=try&lineNumber=14914
I'm guessing we're left with Windows itself holding a reference to TSFTextStore
. Let's see if this makes that go away:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=dbb81fb83e1cec29fcb6b578dede596ffc5c7bf7
Comment 66•5 years ago
|
||
Why don't you make BrowserParent
tell its destruction to IMEStateManager
? If so, IMEStateManager
can notify widget of NOTIFY_IME_OF_BLUR
and that must clean up the leaked objects...
Assignee | ||
Comment 67•5 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Might be slow response) from comment #66)
Why don't you make
BrowserParent
tell its destruction toIMEStateManager
? If so,IMEStateManager
can notify widget ofNOTIFY_IME_OF_BLUR
and that must clean up the leaked objects...
That's already supposed to happen:
https://searchfox.org/mozilla-central/source/dom/ipc/BrowserParent.cpp#576
Yet, there's this shutdown leak.
Assignee | ||
Comment 68•5 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #67)
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Might be slow response) from comment #66)
Why don't you make
BrowserParent
tell its destruction toIMEStateManager
? If so,IMEStateManager
can notify widget ofNOTIFY_IME_OF_BLUR
and that must clean up the leaked objects...That's already supposed to happen:
https://searchfox.org/mozilla-central/source/dom/ipc/BrowserParent.cpp#576
Trying to restore some old code on the assumption that the current code at that point isn't forceful enough:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=a22f74c1d459b5f1e2480fc11a0b44e1219a8389
Assignee | ||
Comment 69•5 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #68)
(In reply to Henri Sivonen (:hsivonen) from comment #67)
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Might be slow response) from comment #66)
Why don't you make
BrowserParent
tell its destruction toIMEStateManager
? If so,IMEStateManager
can notify widget ofNOTIFY_IME_OF_BLUR
and that must clean up the leaked objects...That's already supposed to happen:
https://searchfox.org/mozilla-central/source/dom/ipc/BrowserParent.cpp#576Trying to restore some old code on the assumption that the current code at that point isn't forceful enough:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=a22f74c1d459b5f1e2480fc11a0b44e1219a8389
Still leaks. By code inspection I found one case where we null out sFocusedIMEWidget
without notifying it of blur first. Let's try changing that:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=ffd11c1f2205169ab6f9904149997d0135742986
Assignee | ||
Comment 70•5 years ago
|
||
Maybe this assignment to sWidget
happens too soon?
https://searchfox.org/mozilla-central/rev/c606cdd6d014fee4034da1702d484c0d41b604c9/dom/events/IMEStateManager.cpp#182
Assignee | ||
Comment 71•5 years ago
|
||
Or perhaps we need to null out sContent
and sPresContext
on shutdown?
Assignee | ||
Comment 72•5 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #71)
Or perhaps we need to null out
sContent
andsPresContext
on shutdown?
Trying to set sWidget
later and nulling out sContent
and sPresContext
when the chrome focus gets focus:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=0265b853f4162cca110f8144035deab8b38b3251
Assignee | ||
Comment 73•5 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #72)
(In reply to Henri Sivonen (:hsivonen) from comment #71)
Or perhaps we need to null out
sContent
andsPresContext
on shutdown?Trying to set
sWidget
later and nulling outsContent
andsPresContext
when the chrome focus gets focus:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=0265b853f4162cca110f8144035deab8b38b3251
Still leaks.
Let's try combining this with the earlier attempt of trying to make Windows release TSFTextStore
on the TSFTextStore
termination path if not already released:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=431007145d48b8f110fff8175f3b503cd38a100a
Comment 74•5 years ago
|
||
Indeed, looks like that NOTIFY_IME_OF_BLUR
is called via DestroyIMEContentObserver()
or directly from IMEStateManager::OnFocusMovedBetweenBrowsers()
.
I wonder, IMEStateManager::sFocusedIMEBrowserParent
is StaticRefPtr
and it's managed at same time of sFocusedIMEWidget
. I guess that it means that NotifyIME(NOTIFY_IME_OF_BLUR)
failed at some point. That might be:
- https://searchfox.org/mozilla-central/rev/c606cdd6d014fee4034da1702d484c0d41b604c9/widget/TextEventDispatcher.cpp#428-431
- https://searchfox.org/mozilla-central/rev/c606cdd6d014fee4034da1702d484c0d41b604c9/widget/windows/WinTextEventDispatcherListener.cpp#40-42
However, I don't see the latter's warning in the log. TextEventDispatcher::mListener
is cleared when OnDestroyWidget()
is called. And it's called when nsIWidget::OnDestroy()
is called. So, it must be too early in this case.
Comment 75•5 years ago
|
||
One possible solution is, you make nsBaseWidget::OnDestroy()
call IMEStateManager::WidgetDestroyed()
. Then, NOTIFY_IME_OF_BLUR
must be handled as expected.
Assignee | ||
Comment 76•5 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Might be slow response) from comment #75)
One possible solution is, you make
nsBaseWidget::OnDestroy()
callIMEStateManager::WidgetDestroyed()
. Then,NOTIFY_IME_OF_BLUR
must be handled as expected.
Thanks. Trying that:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=9c8505b09c1436101221d0b91c5bf4b58b3aad76
Assignee | ||
Comment 77•5 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #76)
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Might be slow response) from comment #75)
One possible solution is, you make
nsBaseWidget::OnDestroy()
callIMEStateManager::WidgetDestroyed()
. Then,NOTIFY_IME_OF_BLUR
must be handled as expected.Thanks. Trying that:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=9c8505b09c1436101221d0b91c5bf4b58b3aad76
Still leaks. :-(
Assignee | ||
Comment 78•5 years ago
|
||
Upon quit, notify all remaining widgets of IME blur no matter what:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=6f095060bd092d9df64dbe1017038af46f089049
Assignee | ||
Comment 79•5 years ago
|
||
Also prevent IME from re-gaining focus once we're quitting:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=9d0fd8d571c9be0dabf215e9dbc09265ca933bd2
Assignee | ||
Comment 80•5 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #79)
Also prevent IME from re-gaining focus once we're quitting:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=9d0fd8d571c9be0dabf215e9dbc09265ca933bd2
Still leaks.
Masayuki, do you have more ideas of what could either cause Gecko not to release references to TSFTextStore
or to cause Windows not to do so?
AFAICT, the only case where notifying IME of blur does not decrement the reference count immediately is the case where we are in the middle of processing a key message from Windows, but I'd hope the test harness isn't sending Gecko key events upon shutdown.
Assignee | ||
Comment 81•5 years ago
|
||
Oops. Forgot to register the observer for the right topic.
Assignee | ||
Comment 82•5 years ago
|
||
With the additional topic registration:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=a60cb341a59204e26a6456d8dd267f962e596bce
Updated•5 years ago
|
Assignee | ||
Comment 83•5 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #82)
With the additional topic registration:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=a60cb341a59204e26a6456d8dd267f962e596bce
Progress! Let's see if some of the intermediate steps were unnecessary:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=357224c0bc30db01aac38b9177deacb4a6944e21
Assignee | ||
Comment 84•5 years ago
|
||
Another try run for comparing random oranges:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=b59553097f91c15ea62c7a255799c46d85f5f50f
(Looks like the fix for the leak on Windows needs to be disabled on Android.)
Assignee | ||
Comment 85•5 years ago
|
||
Assignee | ||
Comment 86•5 years ago
|
||
Comment 87•5 years ago
|
||
Congratulations! But I think that it should be enabled in non-Android platforms because only Android widget handles IME in each content process so that in the future, same leak may occur in macOS and Linux if something depends on NOTIFY_IME_OF_BLUR
.
Assignee | ||
Comment 88•5 years ago
|
||
Assignee | ||
Comment 89•5 years ago
|
||
Assignee | ||
Comment 90•5 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Might be slow response) from comment #87)
Congratulations! But I think that it should be enabled in non-Android platforms because only Android widget handles IME in each content process so that in the future, same leak may occur in macOS and Linux if something depends on
NOTIFY_IME_OF_BLUR
.
OK. Let's try that:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=7b1a1b6dcce3fce1824b1ef276afa377edd38ed5
Comment 91•5 years ago
|
||
Comment 92•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/05f060556310
https://hg.mozilla.org/mozilla-central/rev/164ae5b4ff06
https://hg.mozilla.org/mozilla-central/rev/9b9e4c12e414
Comment 93•5 years ago
|
||
Per comment 6 it sounds like we probably want this in 68? Please request uplift if so.
Comment 94•5 years ago
|
||
If it's too late/risky for 68, I think that we should fix this only in 68 ESR when this patch goes to late beta.
Assignee | ||
Comment 95•5 years ago
|
||
(In reply to Julien Cristau [:jcristau] from comment #93)
Per comment 6 it sounds like we probably want this in 68? Please request uplift if so.
I intend to request uplift, but I'd like to wait for a Nightly cycle just in case.
Assignee | ||
Comment 96•5 years ago
|
||
Also, I can't verify Nightly with Atok myself at the moment, so it would be great if someone with access to Atok could confirm that the latest Nightly works OK.
Reporter | ||
Comment 97•5 years ago
|
||
I tested ATOK MOJI Pallet with build 40c99f4752f968db32f189243b4432b18d1b3471 (2019-06-17).
There is no problem.
Assignee | ||
Comment 98•5 years ago
|
||
Comment on attachment 9064401 [details]
Bug 1549930 - Avoid popping BrowserParent in response to window lowering.
Beta/Release Uplift Approval Request
- User impact if declined: Users of ATOK, a third-party Japanese IME, won't be able to use a character palette feature of ATOK to enter text into Firefox on Windows. (The primary IME functionality of ATOK is unaffected: The bug relates only to a secondary character palette feature of ATOK.)
- Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: Yes
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: None
- Risk to taking this patch: Medium
- Why is the change risky/not risky? (and alternatives if risky): I estimate the risk is somewhere between low and medium. The reason why risk should be low are 1) the behavior of keeping IME focused when Firefox stops being the frontmost app restores a behavior that existed previously, 2) when switching windows within Firefox, the result with the change is supposed to go through the same state transition only with a different trigger mechanism, and 3) the shutdown changes affect the app only when shutting down and IME doesn't need to work when we've committed to shutting down. The reason for saying this should be towards medium is that when switching Firefox windows, state changes that previously triggered on one of the windows getting lowered are now triggered from the other window getting raised instead. The effect is supposed to be equivalent in the case Firefox as a whole stays as the frontmost app, but there's a non-zero chance that it isn't exactly equivalent after all.
The alternatives would be either to wait a little longer on Nightly before uplift to 68 beta or to ship non-ESR 68 with the regression and uplifting only to 68 ESR after even more time on Nightly.
- String changes made/needed: None
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 99•5 years ago
|
||
(In reply to Takeshi Ichimaru(a.k.a. Ayakawa) from comment #97)
I tested ATOK MOJI Pallet with build 40c99f4752f968db32f189243b4432b18d1b3471 (2019-06-17).
There is no problem.
Thank you for testing (and for reporting the bug in the first place). Based on your comment, I marked this as verified in Nightly in comment 98.
Comment 100•5 years ago
|
||
Comment on attachment 9064401 [details]
Bug 1549930 - Avoid popping BrowserParent in response to window lowering.
ime fix for 68.0b12
Updated•5 years ago
|
Updated•5 years ago
|
Comment 101•5 years ago
|
||
bugherder uplift |
Comment 102•5 years ago
|
||
Takeshi Ichimaru would you mind testing on latest beta build as well?
https://archive.mozilla.org/pub/firefox/candidates/68.0b12-candidates/build1/
Reporter | ||
Comment 103•5 years ago
|
||
I tested with 68.0b12-candidates build1, and there is no problem.
Comment 104•5 years ago
|
||
(In reply to Takeshi Ichimaru(a.k.a. Ayakawa) from comment #103)
I tested with 68.0b12-candidates build1, and there is no problem.
Thanks so much. Closing the bug based on your verification.
Updated•3 years ago
|
Description
•