Closed
Bug 1137229
Opened 9 years ago
Closed 9 years ago
Keyboard stops working on OS X
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Tracking
()
RESOLVED
FIXED
mozilla39
People
(Reporter: milan, Assigned: smichaud)
References
Details
(Keywords: regression, Whiteboard: [STR in comment #57])
Attachments
(7 files, 6 obsolete files)
45.91 KB,
text/plain
|
Details | |
962 bytes,
patch
|
masayuki
:
review+
lmandel
:
approval-mozilla-aurora+
lmandel
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
4.08 KB,
text/plain
|
Details | |
5.86 KB,
text/plain
|
Details | |
6.35 KB,
patch
|
smichaud
:
review+
|
Details | Diff | Splinter Review |
6.28 KB,
patch
|
smichaud
:
review+
lmandel
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
6.32 KB,
patch
|
smichaud
:
review+
lmandel
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
Couple of times now in two days. Usually starts while in Yahoo Mail, in Dev edition, and keyboard stops working. After that, even when the Yahoo Mail tab is closed, I now can't type in the URL bar either. I can, however, cut and paste into the URL bar, but only using the Edit->Paste. If I Cmd V, I see the Edit menu item highlight, but nothing shows up in the URL bar. Restarting the browser is the only thing that helps. Not sure what other info I can collect to help with this, let me know.
Comment 1•9 years ago
|
||
Does it help if you focus some other program and then again FF?
Reporter | ||
Comment 2•9 years ago
|
||
Doesn't seem to. In fact, I had the dev edition open while I was typing this bug in the nightly, and went back a couple of times doing the steps I described above.
Comment 3•9 years ago
|
||
Oh, you can reproduce this? I assume this is a regression?
Keywords: regression,
regressionwindow-wanted
Reporter | ||
Comment 4•9 years ago
|
||
I reproduced it twice in two days, but it isn't on command yet, and I'm not quite sure what exact STR leads me to it. However, yes, it is a new problem for me; my dev edition is currently Feb 23rd, it may very well be he one that started it.
Reporter | ||
Comment 5•9 years ago
|
||
Got it to happen just now in the nightly 2015-03-05. I know this isn't actionable, but thought I'd record it. I'll look for an STR - I did have a handful of tabs opened, Flash in some of them, but at the time I ran into this it was just one tab.
Reporter | ||
Updated•9 years ago
|
Summary: Keyboard stops working on OS X, Dev edition → Keyboard stops working on OS X
Comment 6•9 years ago
|
||
Bug 1138466 seems likely to be a duplicate. Milan, did this happen in 38 as well as in 39?
I am seeing this behavior as well on OSX using beta 37. I notice it when NoScript extension is enabled... but could happen other times as well. Keyboard stops working altogether in Firefox -- fields, address bar, search, etc -- but works normally outside of firefox. The only way to fix is close Firefox and restart.
Comment 8•9 years ago
|
||
[Tracking Requested - why for this release]: Apparently happens on FF37 too.
tracking-firefox37:
--- → ?
Comment 9•9 years ago
|
||
Anyone who can see this, is there anything related in the browser console?
Comment 10•9 years ago
|
||
I wonder if this is related to Bug 1110884. So far the issue has been reported on OSX only, AFAIK. But then, comment 7 is about FF37.
Comment 11•9 years ago
|
||
Bug 1092630 did land for FF37. Anyone who can see this, is this perhaps related to plugins in a web page?
Comment 12•9 years ago
|
||
Tracking 37+ on both reported bugs at this point.
Comment 13•9 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #9) > Anyone who can see this, is there anything related in the browser console? Milan is going to come by with his machine if and when this issue reoccurs. In that case, what other information can we try and get to help debug the problem?
Flags: needinfo?(bugs)
Reporter | ||
Comment 14•9 years ago
|
||
Yes, I saw this on 38 and 39. There may have been Flash involved in one of these, and no more than 5-6 tabs total. Note that the events do get through up to a point - when I tried Command W while I was in this state, I did see the top level menu highlight, but that was it - nothing actually happened. Same with Command V for paste.
Flags: needinfo?(milan)
Reporter | ||
Comment 15•9 years ago
|
||
Managed to get a "lesser" version of this bug twice in a couple of minutes now in 38. Went to http://www.theweathernetwork.com/weather/canada/ontario/toronto, scrolled around a bit, picked one of the videos, watched a few seconds, then seeked through to the end, 5, 6 steps, watching a bit each time. At that point, Command W would not close the window, but the URL bar did take text input, and once it did, the Command W went back to working. I'll see if this is common enough to do a regression range, if we think this is the same issue.
Comment 16•9 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #11) > Bug 1092630 did land for FF37. > > Anyone who can see this, is this perhaps related to plugins in a web page? Yeah, I guess that it's the cause. https://hg.mozilla.org/releases/mozilla-beta/filelog/21f52f25675a/widget/cocoa/TextInputHandler.mm
Comment 17•9 years ago
|
||
Milan, the next time the bug occurs can you try to open a new window (through the file menu) and see if the keyboard works there? (the reporter in bug 1138466 said so and if it's the case for you too then it's very likely the same bug). The next time you restart Firefox, please run it with NSPR logging as suggested by Masayuki-san in bug 1138466 comment 8.
Comment 18•9 years ago
|
||
I'm not sure if this actual cause, but looks like this is a bug:
> 1.169 @@ -3302,20 +3285,16 @@ IMEInputHandler::OnDestroyWidget(nsChild
> 1.170 TrueOrFalse(IsIMEComposing())));
> 1.171
> 1.172 // If we're not focused, the focused IMEInputHandler may have been
> 1.173 // created by another widget/nsChildView.
> 1.174 if (sFocusedIMEHandler && sFocusedIMEHandler != this) {
> 1.175 sFocusedIMEHandler->OnDestroyWidget(aDestroyingWidget);
> 1.176 }
> 1.177
> 1.178 - if (!PluginTextInputHandler::OnDestroyWidget(aDestroyingWidget)) {
> 1.179 - return false;
> 1.180 - }
> 1.181 -
> 1.182 if (IsIMEComposing()) {
> 1.183 // If our view is in the composition, we should clean up it.
> 1.184 CancelIMEComposition();
> 1.185 OnEndIMEComposition();
> 1.186 }
> 1.187
> 1.188 mSelectedRange.location = NSNotFound; // Marking dirty
> 1.189 mIMEHasFocus = false;
The bug removes PluginTextInputHandler. At that time, this line is removed. But this called its super class's OnDestroyWidget(). So, TextInputHandlerBase::OnDestroyWidget() is now never called...
Comment 19•9 years ago
|
||
updating my prior comment (#7) to note that I am getting this keyboard locking behavior without NoScript installed also. Opening a new window (through the file menu) does re-enable the keyboard - in the new window only, not the old one.
Assignee | ||
Comment 20•9 years ago
|
||
(Following up comment #18) I just talked to Masayuki on IRC, and he explained that it was the patch for bug 1092630 that dropped those lines: https://hg.mozilla.org/releases/mozilla-beta/diff/a6db8f54f5aa/widget/cocoa/TextInputHandler.mm
Assignee | ||
Comment 21•9 years ago
|
||
Whoever sees this bug, please test with builds dated 2014-02-20 and earlier -- especially m-c and Developer Edition nightlies. Be sure to test with e10s mode off. Those builds don't contain my patch for bug 1110888.
Reporter | ||
Comment 22•9 years ago
|
||
I've removed everything before I started playing video - let me know if there is missing information. Line 15 is where we were just before I started pressing Command W to close the tab (didn't work.) On a side note, opening a new window did not fix this.
Assignee | ||
Comment 23•9 years ago
|
||
People who see this bug: What version(s) of OS X are you using?
Assignee | ||
Comment 24•9 years ago
|
||
(In reply to comment #15) > Managed to get a "lesser" version of this bug ... > At that point, Command W would not close the window ... This is probably unrelated. All you need to do to see it happen is click at least once on a (plugin-created) video. This gives the keyboard focus to the plugin, and from this point it will eat most (all?) cmd-key combinations (like cmd-w). The problem lasts until the plugin loses the keyboard focus.
Reporter | ||
Comment 25•9 years ago
|
||
(In reply to Steven Michaud from comment #23) > People who see this bug: > > What version(s) of OS X are you using? 10.9 (In reply to Steven Michaud from comment #24) > (In reply to comment #15) > > > Managed to get a "lesser" version of this bug ... > > At that point, Command W would not close the window ... > > This is probably unrelated. > > All you need to do to see it happen is click at least once on a > (plugin-created) video. This gives the keyboard focus to the plugin, and > from this point it will eat most (all?) cmd-key combinations (like cmd-w). > The problem lasts until the plugin loses the keyboard focus. Fair enough. The File menu item still flashes though.
Assignee | ||
Comment 26•9 years ago
|
||
Masayuki, I agree that what you found is a bug. I also think fixing it will probably also fix this bug. The patch for bug 1092630 changed the IMEInputHandler class so that it inherited from TextInputHandlerBase rather than PluginTextInputHandler. Accordingly the patch changed the IMEInputHandler constructor to invoke the TextInputHandlerBase constructor (instead of the PluginTextInputHandler constructor). It should also have changed the call to the superclass's OnDestroyWidget() (from IMEInputHandler::OnDestroyWidget()), but instead it just dropped the call. Since then all calls to TextInputHandlerBase::Destroyed() have often returned inaccurate results -- they now always return false! Notice that these calls are invoked all over the place in TextInputHandler.mm. This is truly a disastrous bug. It's amazing the fallout wasn't worse, and that we didn't discover it before now.
Attachment #8575588 -
Flags: review?(masayuki)
Assignee | ||
Comment 27•9 years ago
|
||
I've started a set of tryserver builds: https://treeherder.mozilla.org/#/jobs?repo=try&revision=7f8185f65f28
Comment 28•9 years ago
|
||
(Clearing the ni?. I'm not the right person to answer to OSX or plugins specific issues. Besides, others are looking into this already.)
Flags: needinfo?(bugs)
Comment 29•9 years ago
|
||
(In reply to Milan Sreckovic [:milan] from comment #22) > Created attachment 8575424 [details] > Truncated log > > I've removed everything before I started playing video - let me know if > there is missing information. Line 15 is where we were just before I > started pressing Command W to close the tab (didn't work.) Thank you for the log. Although, our logging code doesn't collect enough information. I'll improve it. Anyway, this log indicates that TextInputHandler believes that it dispatches key events correctly (perhaps on a destroyed widget).
Comment 30•9 years ago
|
||
Comment on attachment 8575588 [details] [diff] [review] Possible fix Thanks! Let's try this.
Attachment #8575588 -
Flags: review?(masayuki) → review+
Assignee | ||
Comment 31•9 years ago
|
||
Comment on attachment 8575588 [details] [diff] [review] Possible fix Landed on mozilla-inbound: https://hg.mozilla.org/integration/mozilla-inbound/rev/cd0ee062c7db
Assignee | ||
Comment 32•9 years ago
|
||
Here's the opt tryserver build from comment #27: http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/smichaud@pobox.com-7f8185f65f28/try-macosx64/firefox-39.0a1.en-US.mac.dmg Whoever sees this bug please test with it (until the patch lands on mozilla-central).
Comment 33•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/cd0ee062c7db
Assignee: nobody → smichaud
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
Assignee | ||
Comment 34•9 years ago
|
||
Comment on attachment 8575588 [details] [diff] [review] Possible fix This patch is in today's mozilla-central nightly. Whoever sees this bug, please test with it.
Reporter | ||
Comment 35•9 years ago
|
||
So far, so good for me, not able to reproduce it.
Assignee | ||
Comment 36•9 years ago
|
||
Comment on attachment 8575588 [details] [diff] [review] Possible fix This patch fixes a simple/stupid mistake in the patch for bug 1092630. It's a very bad mistake, which should have had much worse consequences than this bug. (And we *have* already found at least one crash bug that it caused -- bug 1040939.) So we should uplift the patch even if it doesn't fix this bug or bug 1138466. Because the patch fixes a mistake (because it restores code that was mistakenly dropped), I think the risk is low. Approval Request Comment [Feature/regressing bug #]: 1092630 [User impact if declined]: Crash bugs and other weird keyboard problems [Describe test coverage new/current, TreeHerder]: One day baking on m-c [Risks and why]: Low risk (the patch restores code that was mistakenly dropped) [String/UUID change made/needed]: None
Attachment #8575588 -
Flags: approval-mozilla-beta?
Attachment #8575588 -
Flags: approval-mozilla-aurora?
Comment 37•9 years ago
|
||
Comment on attachment 8575588 [details] [diff] [review] Possible fix Agreed. Let's get this into Beta 5 and try to verify that it does fix the keyboard issue reported in this bug. Beta+ Aurora+
Attachment #8575588 -
Flags: approval-mozilla-beta?
Attachment #8575588 -
Flags: approval-mozilla-beta+
Attachment #8575588 -
Flags: approval-mozilla-aurora?
Attachment #8575588 -
Flags: approval-mozilla-aurora+
Assignee | ||
Comment 38•9 years ago
|
||
Comment on attachment 8575588 [details] [diff] [review] Possible fix Landed on mozilla-aurora: https://hg.mozilla.org/releases/mozilla-aurora/rev/da642d10a83e
Assignee | ||
Updated•9 years ago
|
Assignee | ||
Comment 39•9 years ago
|
||
(Following up comment #36) > (And we *have* already found at least one crash bug that it caused -- bug 1040939.) Bug 1140939.
Assignee | ||
Comment 40•9 years ago
|
||
Comment on attachment 8575588 [details] [diff] [review] Possible fix Landed on mozilla-beta: https://hg.mozilla.org/releases/mozilla-beta/rev/f8c988045bb5
Assignee | ||
Updated•9 years ago
|
Comment 41•9 years ago
|
||
I've tried today to reproduce the original issue and verify this on Firefox 37 Beta 5 (BuildID=20150312193711). I didn't manage to fully block the keyboard on a Macbook Retina 15" with Mac OS X 10.9.5, but I did manage to reproduce the behavior specified in comment 24: "All you need to do to see it happen is click at least once on a (plugin-created) video. This gives the keyboard focus to the plugin, and from this point it will eat most (all?) cmd-key combinations (like cmd-w). The problem lasts until the plugin loses the keyboard focus." To reproduce the issue I just opened a facebook flash game, then any cmd-key combination no longer worked. Note though that I could still easily reproduce this scenario in Firefox 37 Beta 5 which should have this fix, so it may be that the fix does not work correctly. Any thoughts on the above Steven?
Flags: needinfo?(smichaud)
Assignee | ||
Comment 42•9 years ago
|
||
(In reply to comment #41) Like I said in comment #24, this is completely unrelated. The general question of what key combinations plugins should be able to consume/block (when they have they keyboard focus) is one of the things under discussion at bug 1128771.
Flags: needinfo?(smichaud)
Comment 43•9 years ago
|
||
I'm still seeing the full keyboard-locking behavior on Firefox 37 beta 5 - OSX10.10.2. Did the patch make it into beta 5?
Assignee | ||
Comment 44•9 years ago
|
||
> Did the patch make it into beta 5? Yes, it did. Please explain in detail what you mean by the "full keyboard-locking behavior". Be quite sure that you're not seeing what I described in comment #24 (which like I said is unrelated). If you can reproduce what you see reliably, please try to find the regression range in mozilla-central nightlies (here http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/).
Comment 45•9 years ago
|
||
It was recommended I include my experience with possibly the same issue, or at least one that is very similar. This is my comment from IRC: Yeah, the keyboard doesn't work, either. The more obvious issue to me is just that the cursor does not affect any state change on elements in the browser chrome or in a Web page. It's just like hovering over a photo; however, the contents of the hover, like a URL, do display at the bottom of the browser as usual. Clicking a link will do nothing for about ten seconds, then the page will load; the same is true for browser chrome, like with tabs. As far as typing, it's fairly non-responsive, though after several seconds the given input does show the text.
Assignee | ||
Comment 46•9 years ago
|
||
Dane, what you describe sounds like a different bug ... though it's really hard to be sure. Some obvious questions: What versions of Firefox do you see this on? What versions of OS X do you see this on? Does your problem happen with a clean profile? Do you have reliable steps to reproduce? Please be sure to include the latest versions of Firefox in your tests -- particularly today's mozilla-central nightly.
Comment 48•9 years ago
|
||
(In reply to Steven Michaud from comment #46) > Dane, what you describe sounds like a different bug ... though it's really > hard to be sure. I remember Dane saying on IRC that this was happening after resuming OS X from sleep mode and stuff like that. If that's the case, then I believe that's bug 1142957, which should be fixed in today's Nightly. Maybe this issue and bug 1142957 are connected in some way? I guess people still having this issue might want to try with the March 18th Nightly and see if they still have problems.
Comment 49•9 years ago
|
||
(In reply to Steven Michaud from comment #44) > > Did the patch make it into beta 5? > > Yes, it did. > > Please explain in detail what you mean by the "full keyboard-locking > behavior". Be quite sure that you're not seeing what I described in comment > #24 (which like I said is unrelated). > > If you can reproduce what you see reliably, please try to find the > regression range in mozilla-central nightlies (here > http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/). I'm still seeing the original issue, and not what is described in comment 24. the keyboard (all keys) stops working in the existing window. The only way to fix it is to open a new window or close/reopen firefox. It occurs with roughly the same frequency as before patch but I can't identify any particular behavior that causes it.
Assignee | ||
Comment 51•9 years ago
|
||
(Following up comment #48) People should test with the 2015-03-18-05-57-50-mozilla-central nightly (the second of two mozilla-central nightlies dates 2015-03-18).
Assignee | ||
Comment 52•9 years ago
|
||
JB: Please please please test with the mozilla-central nightly mentioned in comment #51, or with today's mozilla-central nightly.
Flags: needinfo?(jwb01)
Comment 53•9 years ago
|
||
(In reply to Steven Michaud from comment #52) > JB: Please please please test with the mozilla-central nightly mentioned in > comment #51, or with today's mozilla-central nightly. ok - testing it now with nightly...
Flags: needinfo?(jwb01)
Comment 54•9 years ago
|
||
(In reply to Steven Michaud from comment #52) > JB: Please please please test with the mozilla-central nightly mentioned in > comment #51, or with today's mozilla-central nightly. Problem still occurs with with the latest mozilla-central nightly. Now I notice it reliably occurs right after clicking on a plug-in created video -- eg., CNN.com. After clicking on the video, all keys on the keyboard stop working in the existing window. The only way to fix is to open a new window or close/reopen firefox.
Assignee | ||
Comment 55•9 years ago
|
||
I just tested with today's mozilla-central nightly on OS X 10.10.2. I loaded one of the cnn.com videos and then clicked on it. I didn't see the bug -- afterwards I was able to click on the location bar in the same window and enter text. Are you still using NoScript? Do you see the problem in Safe Mode? https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe-mode?redirectlocale=en-US&redirectslug=Safe+Mode
Assignee | ||
Updated•9 years ago
|
Flags: needinfo?(jwb01)
Comment 56•9 years ago
|
||
(In reply to Steven Michaud from comment #55) > I just tested with today's mozilla-central nightly on OS X 10.10.2. I > loaded one of the cnn.com videos and then clicked on it. I didn't see the > bug -- afterwards I was able to click on the location bar in the same window > and enter text. > > Are you still using NoScript? > > Do you see the problem in Safe Mode? > https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe- > mode?redirectlocale=en-US&redirectslug=Safe+Mode Still using NoScript -- and yes do see the problem in Safe Mode. Some videos on CNN.com don't cause the issue but I reliably reproduce the problem from CNN.com by clicking on the 'Watch Live TV/CNNgo' video box --usually with a live video playing -- on the mid-right side of the page. (sorry, should have been more specific in my earlier reply.) After clicking, it will bring up a secondary menu asking which cable provider you have. by that point, the keyboard stops working.
Flags: needinfo?(jwb01)
Assignee | ||
Comment 57•9 years ago
|
||
Excellent! Now I can reproduce this bug, too (both in e10s mode and non-e10s mode). Here's your STR over again, in more detail: 1) http://www.cnn.com/ 2) Scroll the page down until you see a "Watch Live TV CNN-go" frame on the right. Wait until a TV program is playing in the box. You don't want the "Watch Live TV CNN-go" floating box, always in the lower left on the cnn.com home page. 3) Click once in the middle of the frame from step 2. Another page will be loaded that asks you to "Select your TV Service Provider". From this point you see the bug in that browser window. You can click in text fields like the location bar and the search box, but you can't enter text there (or navigate using the arrow keys). This remains true (in that browser window) even if you navigate to other pages (for example by clicking on the Back and Forward buttons). Here's the regression range: firefox-2015-02-20-03-02-02-mozilla-central firefox-2015-02-21-03-02-08-mozilla-central http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=1b4c5daa7b7a&tochange=5de3af90c494 I will hg bisect to find the patch that triggered this bug.
Status: RESOLVED → REOPENED
Keywords: regressionwindow-wanted
Resolution: FIXED → ---
Whiteboard: [STR in comment #57]
Comment 58•9 years ago
|
||
This is bad enough that we're likely going to hold the release for a fix.
Assignee | ||
Comment 59•9 years ago
|
||
> I will hg bisect to find the patch that triggered this bug. It's my patch for bug 1110888 that triggered this bug :-( That patch is on the 37 branch and later, so we'll need to deal with this bug (at least on the 37 branch) right away (since the 37 release is coming up soon). It's simply not an option to back out my patch for bug 1110888 (which would cause even worse trouble). So I'll be spending the rest of the weekend finding some kind of fix/workaround -- the simpler the better.
Blocks: 1110888
Assignee | ||
Updated•9 years ago
|
Status: REOPENED → ASSIGNED
Assignee | ||
Comment 60•9 years ago
|
||
Here's another fix for this bug -- this time for the bug itself. The reason for the bug is in cross-platform code, here: http://hg.mozilla.org/mozilla-central/annotate/e730012260a4/dom/base/nsFocusManager.cpp#l818 nsFocusManager::mFocusedContent is cleared without sending any notification (NS_FOCUS_CONTENT or NS_BLUR_CONTENT) to that object. This causes my patch to bug 1110888 to think that the widget containing that object still has a plugin with the keyboard focus -- and therefore misbehave. I tend to think this is a bug. But the comment just above it indicates that it was deliberate. And I dread the thought of messing with nsFocusManager code. In any case I found a reasonably simple workaround. The Element that had the focus gets deleted, and it's possible to register for notification of that. When that happens I call SetPluginFocused(false) on the owning nsIWidget. I tried doing this from the existing calls to UnbindFromTree() and DestroyContent(), but these calls are made "too late" -- after the element's primary frame has been zeroed out (so that aElement->GetPrimaryFrame() returns null and GetWidget() doesn't work). Adding nsIDOMEventTarget to NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED was just a guess. I don't really understand what this code does. But I did find parallel code in dom/html/ImageDocument.cpp/h.
Attachment #8581348 -
Flags: review?(bugs)
Assignee | ||
Comment 61•9 years ago
|
||
> Adding nsIDOMEventTarget to NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED
I meant nsIDOMEventListener.
Comment 62•9 years ago
|
||
Comment on attachment 8581348 [details] [diff] [review] Second fix, for actual bug This is using MutationEvents, r-.
Attachment #8581348 -
Flags: review?(bugs) → review-
Assignee | ||
Comment 63•9 years ago
|
||
I'm going to have to give this a break for the time being. I'm too tired. I'll pick it up again tomorrow.
Assignee | ||
Comment 64•9 years ago
|
||
Another problem that came out when Smaug and I discussed this on IRC: I call SetPluginFocused(false) (in the node removal handler for HTMLObjectElement/HTMLSharedObjectElement) without first checking that the object was actually focused. I need to make that check.
Comment 65•9 years ago
|
||
(In reply to Florin Mezei, QA (:FlorinMezei) from comment #48) > (In reply to Steven Michaud from comment #46) > > Dane, what you describe sounds like a different bug ... though it's really > > hard to be sure. > > I remember Dane saying on IRC that this was happening after resuming OS X > from sleep mode and stuff like that. If that's the case, then I believe > that's bug 1142957, which should be fixed in today's Nightly. > > Maybe this issue and bug 1142957 are connected in some way? I guess people > still having this issue might want to try with the March 18th Nightly and > see if they still have problems. Just to be clear, I noticed that it only actually happened when I was away long enough that OSX would ask for my password to gain access to the computer again--with Firefox being the last window focused before OSX triggered the password prompt.
Comment 66•9 years ago
|
||
nsFocusManger::ContentRemoved() is called by EventStateManager::ContentRemoved(): http://mxr.mozilla.org/mozilla-central/source/dom/events/EventStateManager.cpp#4834 Before the call, IMEStateManager::OnRemoveContent() must be called normally. Then, nsIWidget::SetInputContext() should be called. So, you may be able to catch the context change from "plugin" to another ("enabled", "disabled" or "password") in widget level (perhaps, in nsChildView).
Assignee | ||
Comment 67•9 years ago
|
||
Thanks, Masayuki, I'll give it a try ... tomorrow :-)
Comment 68•9 years ago
|
||
And I guess that nsIWidget::SetPluginFocused() isn't necessary.
Assignee | ||
Comment 69•9 years ago
|
||
> And I guess that nsIWidget::SetPluginFocused() isn't necessary. I think it probably is necessary. When I was writing my patch for bug 1110888 I found that nsIWidget::SetInputContext() isn't reliable. Rather that fix that problem (since I was so short of time) I worked around it. I've also found (I think) that I can rewrite GetWidget() to use nsINode::OwnerDoc() and nsContentUtils::WidgetForDocument() -- that seems to give me the right widget even when called from UnbindFromTree() (even when aElement->GetPrimaryFrame() returns NULL). It was Smaug who suggested checking out OwnerDoc(). But I'm so tired now that I distrust my ability to concentrate (and dot all the 'i's and cross the 't's). So I'll pick it up again tomorrow.
Comment 70•9 years ago
|
||
(In reply to Steven Michaud from comment #69) > > And I guess that nsIWidget::SetPluginFocused() isn't necessary. > > I think it probably is necessary. When I was writing my patch for bug > 1110888 I found that nsIWidget::SetInputContext() isn't reliable. Rather > that fix that problem (since I was so short of time) I worked around it. Hmm, Gecko for Mac OS X is now the first one which doesn't create widget for plugins. Therefore, IMEStateManager may have some bugs around there. > I've also found (I think) that I can rewrite GetWidget() to use > nsINode::OwnerDoc() and nsContentUtils::WidgetForDocument() -- that seems to > give me the right widget even when called from UnbindFromTree() (even when > aElement->GetPrimaryFrame() returns NULL). It was Smaug who suggested > checking out OwnerDoc(). Yeah, sounds like it will work. > But I'm so tired now that I distrust my ability to concentrate (and dot all > the 'i's and cross the 't's). So I'll pick it up again tomorrow. Anyway, you should go to bed :-) Tired brain typically creates bad patches.
Comment 71•9 years ago
|
||
(In reply to Steven Michaud from comment #60) > The reason for the bug is in cross-platform code, here: > > http://hg.mozilla.org/mozilla-central/annotate/e730012260a4/dom/base/ > nsFocusManager.cpp#l818 > > nsFocusManager::mFocusedContent is cleared without sending any notification > (NS_FOCUS_CONTENT or NS_BLUR_CONTENT) to that object. Yeah, we should fix that. Other UAs do that, IIRC, and I think the HTML spec now requires that behavior.
Comment 72•9 years ago
|
||
But for this particular bug we want the safest possible fix. So please, no changes to where blur/focus events are dispatched.
Comment 73•9 years ago
|
||
Right, I didn't mean to suggest we fix that in this bug, as I'm sure there will be some regressions from such a change. But at some point we need to do it.
Assignee | ||
Comment 74•9 years ago
|
||
Here's a revision that doesn't use mutation events. I've tested it both with and without e10s, and it works fine in both cases.
Attachment #8581348 -
Attachment is obsolete: true
Attachment #8581690 -
Flags: review?(bugs)
Assignee | ||
Comment 75•9 years ago
|
||
Comment on attachment 8581690 [details] [diff] [review] Second fix rev1 I've started a tryserver run: https://treeherder.mozilla.org/#/jobs?repo=try&revision=dd96559bbf6a
Comment 76•9 years ago
|
||
Comment on attachment 8581690 [details] [diff] [review] Second fix rev1 > static nsIWidget* GetWidget(Element* aElement) > { > nsIWidget* retval = NULL; >- nsIFrame* frame = aElement->GetPrimaryFrame(); >- if (frame) { >- retval = frame->GetNearestWidget(); >+ nsIDocument* ownerDoc = aElement->OwnerDoc(); >+ if (ownerDoc) { ownerDoc is never null. >-static void OnFocusBlurPlugin(Element* aElement, bool aFocus) >+Element* HTMLObjectElement::sLastFocused = NULL; // Weak Scary, but look like this is used just for comparison. But anyhow, please make sure the variable doesn't ever point to a deleted object. >+ >+void >+HTMLObjectElement::OnFocusBlurPlugin(Element* aElement, bool aFocus) > { > nsIWidget* widget = GetWidget(aElement); > if (widget) { >- bool value = aFocus; >- widget->SetPluginFocused(value); >+ widget->SetPluginFocused(aFocus); >+ if (aFocus) { >+ sLastFocused = aElement; >+ } else { >+ sLastFocused = NULL; NULL? > { >+#ifdef XP_MACOSX >+ // When a page is reloaded (when an nsIDocument's content is removed), the >+ // focused element isn't necessarily sent an NS_BLUR_CONTENT event. See >+ // nsFocusManager::ContentRemoved(). This means that a widget may think it >+ // still contains a focused plugin when it doesn't -- which in turn can >+ // disable text input in the browser window. See bug 1137229. >+ // >+ // This works around the problem. But first check that we actually *were* >+ // focused (before we were unbound from the tree) -- since (otherwise) some >+ // other plugin may still be present and focused in the widget. >+ if (sLastFocused == this) { >+ OnFocusBlurPlugin(this, false); >+ } >+#endif What if the page goes to bfcache? we don't destroy the DOM then. Can the focus still stay in the plugin? Please test. Can a plugin inside display: none; keep the focus? What is the behavior in the current release? Please test.
Attachment #8581690 -
Flags: review?(bugs) → review-
Updated•9 years ago
|
Severity: normal → blocker
Assignee | ||
Comment 77•9 years ago
|
||
>>-static void OnFocusBlurPlugin(Element* aElement, bool aFocus) >>+Element* HTMLObjectElement::sLastFocused = NULL; // Weak > > Scary, but look like this is used just for comparison. But anyhow, > please make sure the variable doesn't ever point to a deleted object. I can't stop sLastFocused from (possibly) pointing to a deleted object, and I don't need to -- since I only ever check for equality. That's why I added the following comment: + // Weak pointer. May be invalid. Use only for equality checks. NULL if last + // action was blur. + static Element* sLastFocused; I'm trying to figure out how to do the tests you requested.
Assignee | ||
Comment 78•9 years ago
|
||
Anyone know how to reliably make a page go into bfcache?
Comment 79•9 years ago
|
||
(In reply to Steven Michaud from comment #77) > I can't stop sLastFocused from (possibly) pointing to a deleted > object, Yes you can. Just clear it in dtor, assuming it points to the object being deleted. > and I don't need to -- since I only ever check for equality. Sure, but we have had some many sec-critical bugs because of raw pointers, so let's be a bit careful.
Comment 80•9 years ago
|
||
(In reply to Steven Michaud from comment #78) > Anyone know how to reliably make a page go into bfcache? If a page doesn't have beforeunload or unload event listeners and doesn't have active network connections it should enter bfcache when a new page is loaded. http://mxr.mozilla.org/mozilla-central/source/dom/base/nsDocument.cpp?rev=ca6d6b665bc1#8802
Assignee | ||
Comment 81•9 years ago
|
||
> Just clear it in dtor, assuming it points to the object being deleted.
But that implies another equality check on a possibly deleted object :-)
Comment 82•9 years ago
|
||
No. the object isn't deleted when dtor is called.
Assignee | ||
Comment 83•9 years ago
|
||
But we don't know whether or not sLastFocused has been deleted, and we'll need to compare "this" to that.
Comment 84•9 years ago
|
||
If you always check sLastFocused in object/embed dtor and clear it if sLastFocused == this, then sLastFocused never points to a deleted object.
Assignee | ||
Comment 85•9 years ago
|
||
> and clear it if sLastFocused == this
This implies an equality check with sLastFocused. But yes, I now see that if you always NULL sLastFocused when sLastFocused == this, sLastFocused will never point to an object that has been deleted.
Assignee | ||
Comment 86•9 years ago
|
||
> What if the page goes to bfcache? we don't destroy the DOM then. Can > the focus still stay in the plugin? Please test. I figured out how to test this. I found out that when a page containing a focused plugin goes into the bfcache, an NS_BLUR_CONTENT event does get sent to it (even without my patch). So we don't need to worry about that case. I tested with an interpose library that logs calls to HTMLObjectElement::HandleFocusBlurPlugin() with aEvent->message == NS_FOCUS_CONTENT or NS_BLUR_CONTENT. It also prints a stack trace for each call. Here's the page I tested with (which contains a single Flash plugin): http://www.adobe.com/devnet/archive/flash/articles/puzzle_game.html I loaded that page, clicked once on the Flash plugin (to focus it), then clicked once on the Back button. The corresponding HTMLObjectElement() received an NS_BLUR_CONTENT event, and the stack shows that the event was sent as the page was going into the bfcache (as it was being "hidden"). One test down, one to go.
Assignee | ||
Comment 87•9 years ago
|
||
Assignee | ||
Comment 88•9 years ago
|
||
Comment on attachment 8582022 [details]
Testcase to make a plugin display: none
Oh hell, it doesn't work from bugzilla.mozilla.org. I'll have to post it to my people.mozilla.com account.
Attachment #8582022 -
Attachment is obsolete: true
Assignee | ||
Comment 89•9 years ago
|
||
Here's my testcase to make a plugin display: none (or more specifically, to make the div that contains it display: none): http://people.mozilla.org/~stmichaud/bmo/bugzilla1137229/displaynone.html This also causes an NS_BLUR_CONTENT event to be sent to the corresponding HTMLObjectElement. So we also don't need to worry about display: none. I've attached the stack.
Assignee | ||
Comment 90•9 years ago
|
||
I've tested my two testcases in FF 37b7, and found that neither of them triggers this bug.
Assignee | ||
Comment 91•9 years ago
|
||
This is the same as my rev1 patch, except I changed every NULL to nullptr and I added code to both destructors to zero sLastFocused if it matches.
Attachment #8581690 -
Attachment is obsolete: true
Attachment #8582051 -
Flags: review?(bugs)
Assignee | ||
Comment 92•9 years ago
|
||
Smaug found another possible problem, and sent me a suggested fix. After dinner I'm going to test it and post a revised patch, later tonight. Smaug says he'll review it tomorrow morning.
Assignee | ||
Comment 93•9 years ago
|
||
Here's my rev2 patch with Smaug's suggested changes (plus a few additional minor changes of my own). His concern is about what might happen if nsIWidget::SetPluginFocused() is called from UnbindFromTree() -- particularly that Gecko code might run or the event loop might get spun. I told him this is extremely unlikely, but I'm unable to prove it. His response was to come up with a way to run nsIWidget::SetPluginFocus() from a script runner -- which only runs when it's safe to run scripts. I tested this as best I can, and it worked fine. But the STR for this bug only works when CNN is playing a "live" TV program in the "Watch Live TV CNN-go" frame -- which is generally not late at night, as it now is. So my final and most important test will need to wait until tomorrow morning.
Attachment #8582051 -
Attachment is obsolete: true
Attachment #8582051 -
Flags: review?(bugs)
Attachment #8582208 -
Flags: review?(bugs)
Comment 94•9 years ago
|
||
Comment on attachment 8582208 [details] Second fix rev3 > static nsIWidget* GetWidget(Element* aElement) > { >- nsIWidget* retval = NULL; >- nsIFrame* frame = aElement->GetPrimaryFrame(); >- if (frame) { >- retval = frame->GetNearestWidget(); >+ nsIWidget* retval = nullptr; >+ nsIDocument* ownerDoc = aElement->OwnerDoc(); >+ if (ownerDoc) { >+ retval = nsContentUtils::WidgetForDocument(ownerDoc); > } You undid my changes to GetWidget. OwnerDoc() returns always valid value. No need to null check (but I had added null check for aElement, but I guess that isn't needed either with this patch) >+ NS_IMETHOD Run() >+ { >+ if (mElement) { >+ HTMLObjectElement::sLastFocused = mElement; >+ bool value = true; >+ mWidget->SetPluginFocused(value); >+ } else if (!HTMLObjectElement::sLastFocused) { >+ bool value = false; >+ mWidget->SetPluginFocused(value); >+ } Odd, 'value' variable. Just pass true/false > #ifdef XP_MACOSX > // nsIDOMEventTarget > NS_IMETHOD PostHandleEvent(EventChainPostVisitor& aVisitor) override; >+ // Helper methods >+ static void OnFocusBlurPlugin(Element* aElement, bool aFocus); > static void HandleFocusBlurPlugin(Element* aElement, WidgetEvent* aEvent); >+ // Weak pointer. NULL if last action was blur. s/NULL/Null/ or nullptr
Attachment #8582208 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 95•9 years ago
|
||
Carrying forward r+. I tested this morning with the STR from comment #57, and everything went fine. It's interesting to note that only for calls from UnbindFromTree() did the call to AddScriptRunner() make any difference. In calls (indirectly) from HandleFocusBlurPlugin(), PluginFocusSetter::Run() always ran immediately (because AddScriptRunner() deemed it safe to do so). (I didn't see any calls to nsIWidget::SetPluginFocused() from the destructors (directly or indirectly) -- presumably because GetWidget() will always return null at that point.) > You undid my changes to GetWidget. Oops, that was inadvertent. But since neither aElement nor the results of aElement->OwnerDoc() need to be null-checked, I was able to simplify the code still further. > Odd, 'value' variable. Just pass true/false This doesn't work -- you get a syntax error from the compiler, probably because nsIWidget::SetPluginFocused() takes a bool&. So I didn't change my code here. >>+ // Weak pointer. NULL if last action was blur. >s/NULL/Null/ or nullptr Done
Attachment #8582208 -
Attachment is obsolete: true
Attachment #8582485 -
Flags: review+
Assignee | ||
Comment 96•9 years ago
|
||
Comment on attachment 8582485 [details] [diff] [review] Second fix, what I will land Landed on mozilla-inbound: https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound&revision=cb2fce9d19c7
Assignee | ||
Comment 97•9 years ago
|
||
Aurora/Beta patch coming up.
Comment 98•9 years ago
|
||
Backed out for Werror bustage. I would have let you fix in-place, but you weren't on IRC from what I could tell. https://hg.mozilla.org/integration/mozilla-inbound/rev/ceac43ebc32f https://treeherder.mozilla.org/logviewer.html#?job_id=7993963&repo=mozilla-inbound
Assignee | ||
Comment 99•9 years ago
|
||
Sigh, dumb mistake. This will fix it, but mozilla-inbound is now closed. Carrying forward r+.
Attachment #8582485 -
Attachment is obsolete: true
Attachment #8582540 -
Flags: review+
Assignee | ||
Comment 100•9 years ago
|
||
> but you weren't on IRC
For future reference, I'm always on IRC when I'm working, in #macdev. My nick is smichaud.
Assignee | ||
Comment 101•9 years ago
|
||
Approval Request Comment [Feature/regressing bug #]: Bug/design flaw in nsFocusManager [User impact if declined]: Bad UI bug. [Describe test coverage new/current, TreeHerder]: Hand testing by me. [Risks and why]: Low to moderate. Simple change, but in code that can be tricky. [String/UUID change made/needed]: none Carrying forward r+.
Attachment #8582554 -
Flags: review+
Attachment #8582554 -
Flags: approval-mozilla-aurora?
Assignee | ||
Comment 102•9 years ago
|
||
Approval Request Comment [Feature/regressing bug #]: Bug/design flaw in nsFocusManager [User impact if declined]: Bad UI bug [Describe test coverage new/current, TreeHerder]: Hand testing by me [Risks and why]: Low to moderate. Simple change, but in code that can be tricky. [String/UUID change made/needed]: None Carrying forward r+.
Attachment #8582555 -
Flags: review+
Attachment #8582555 -
Flags: approval-mozilla-beta?
Assignee | ||
Comment 103•9 years ago
|
||
I assume that FF 37 RC1 is intended to come off the beta branch. Please let me know if that's wrong, and if I need to prepare a version of my patch for yet another branch.
Comment 104•9 years ago
|
||
(In reply to Steven Michaud from comment #103) > I assume that FF 37 RC1 is intended to come off the beta branch. Please let > me know if that's wrong, and if I need to prepare a version of my patch for > yet another branch. You only need to land on Beta. We will move the code from mozilla-beta -> mozilla-release before building RC1. If any follow-ups are needed after RC1 they'll need to land on mozilla-beta *and* mozilla-release.
Comment 105•9 years ago
|
||
Comment on attachment 8582555 [details] [diff] [review] Second fix, beta patch We can't ship with this issue in 37 so we're going to take the fix in the RC. This hasn't landed on m-i (as Steven noted in comment 99). I'm a bit uncomfortable taking the change without it having landed on m-c but I don't see that we have much choice at this point in the schedule. Beta+ Aurora+
Attachment #8582555 -
Flags: approval-mozilla-beta? → approval-mozilla-beta+
Updated•9 years ago
|
Attachment #8582554 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Assignee | ||
Comment 106•9 years ago
|
||
Comment on attachment 8582554 [details] [diff] [review] Second fix, aurora patch Landed on mozilla-aurora: https://hg.mozilla.org/releases/mozilla-aurora/rev/d46dc75c02ae
Assignee | ||
Updated•9 years ago
|
Assignee | ||
Comment 107•9 years ago
|
||
Beta is currently closed, so landing there will have to wait a bit.
Comment 108•9 years ago
|
||
(In reply to Steven Michaud from comment #107) > Beta is currently closed, so landing there will have to wait a bit. mozilla-beta is always closed for the week leading up to the release, I think you're probably fine to push there since you have approval. I also noticed that we actually already uplifted code to mozilla-release, so you will need to land there as well. Sorry for the bad information earlier =\
Assignee | ||
Comment 109•9 years ago
|
||
Comment on attachment 8582555 [details] [diff] [review] Second fix, beta patch Landed on mozilla-beta: https://hg.mozilla.org/releases/mozilla-beta/rev/45961b7d67dc
Assignee | ||
Updated•9 years ago
|
Assignee | ||
Comment 110•9 years ago
|
||
(In reply to comment #108) RyanVM tells me that he'll merge beta to release again, so I don't have to separately land my patch on the release branch.
Assignee | ||
Comment 111•9 years ago
|
||
Comment on attachment 8582540 [details] [diff] [review] Second fix, what I will reland Landed on mozilla-inbound: https://hg.mozilla.org/integration/mozilla-inbound/rev/3beddf2d2c8d
Updated•9 years ago
|
Flags: qe-verify+
Comment 113•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/3beddf2d2c8d
Status: ASSIGNED → RESOLVED
Closed: 9 years ago → 9 years ago
Resolution: --- → FIXED
Comment 115•9 years ago
|
||
I wasn't able to reproduce the original issue (with STR from comment #57) on Mac OSX 10.9.5 using Firefox Nightly 39.0a1 (2015-03-18, 2015-03-20 and 2015-02-25). In this case, I cannot verify if the bug is fixed on the Firefox 37 and Firefox 38.
Flags: qe-verify+
Assignee | ||
Comment 116•9 years ago
|
||
(In reply to comment #115) You need to follow the STR in comment #57 exactly. In particular, note this in step 2 -- "wait until a TV program is playing in the box". Whenever I tested during US daylight hours, there was always something playing there (though I had to wait for up to a minute for it to appear). But after about 10pm local time (in the US) I generally didn't see anything playing in the box. It's also possible, I suppose, that you won't ever see anything playing in the box outside the US -- or even see the box at all. (I'm in the US, in the Central timezone (which currently uses CDT).)
Comment 117•9 years ago
|
||
I'm not able to verify the issue with STR from comment #57: I can not see any TV program playing in the box because I don't have access to any TV Service Provider (I can't create an account for either one of the TV Service Provider).
Assignee | ||
Comment 118•9 years ago
|
||
(In rely to comment #117) I don't have any accounts, either. The cnn.com site must behave differently when accessed from outside the US (as I presume you're doing). You might be able to use a VNC to get around this ... but I don't know exactly how to do that.
Comment 119•9 years ago
|
||
This is still happening with OSX 10.10.4 with firefox 39. One test that I did was to use the file menu to create a new FF window. Keyboard input works in the new window but not the original window. I also created a new tab in the keyboard non-responsive window and the keyboard does not work. The only solution is to either create new window or restart firefox to make the keyboard work again.
Assignee | ||
Comment 120•9 years ago
|
||
(In reply to comment #119) The original bug was fixed. What you're seeing is almost certainly something new, with similar symptoms. Please open a new bug and CC me. Be sure to give detailed steps to reproduce, with specific URLs. Also be sure to test with a clean profile.
Updated•5 years ago
|
Component: Event Handling → User events and focus handling
You need to log in
before you can comment on or make changes to this bug.
Description
•