Closed Bug 1007595 Opened 11 years ago Closed 7 years ago

Two mystery resize events triggered on app frame when launched

Categories

(Core :: Layout, defect, P3)

ARM
Gonk (Firefox OS)
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: timdream, Unassigned)

References

Details

Attachments

(1 obsolete file)

+++ This bug was initially created as a clone of Bug #1005751 +++ Please read bug 1005751 comment 1. I was trying to make the keyboard launch faster, but when it do (which makes it call |window.resize()|) it will receives multiple resize events. The resize handler was there to detect orientation change, so the extra JS layout calculation because of these events will make the keyboard sadly slower instead... I am pretty sure the keyboard iframe have no change the size, since we always set it to the size of the entire screen with CSS. Kanru, Cervantes, what can possible cause this? Debugging in Gecko is needed... it might have something to do with transitions we do on the frame.
Flags: needinfo?(kchen)
Flags: needinfo?(cyu)
Some black box testing: - purposely delay the keyboard launch with setTimeout() will indeed make the resize event go away. - in |apps/system/style/system/keyboard.css|, disabling transition: transform and only keeping the opacity transition will not fix the bug.
- remove |transition| in CSS (which breaks keyboard manager) will not make resize event go away.
OK, commenting out |window.resize()| still triggers resize event.... This might not be a Gecko bug.
Assignee: nobody → timdream
Component: DOM → Gaia::Keyboard
Flags: needinfo?(kchen)
Flags: needinfo?(cyu)
Product: Core → Firefox OS
Summary: Mystery resize event triggered when keyboard app call window.resize() too early → Mystery resize event triggered when keyboard app do something too early
Whiteboard: [p=?]
Version: Trunk → unspecified
I can now confirm keyboard frame simply always receive two resize events regardless. I cleared out keyboard.js and still receiving the event. We didn't receive them before simply because we didn't attach event listener earlier enough. I will test the same thing on template app.
Component: Gaia::Keyboard → DOM
Flags: needinfo?(kchen)
Flags: needinfo?(cyu)
Product: Firefox OS → Core
Summary: Mystery resize event triggered when keyboard app do something too early → Mystery resize event triggered on keyboard app frame
Hum, I receive resize event in the template app too :'(.
Summary: Mystery resize event triggered on keyboard app frame → Mystery resize event triggered on app frame when launched
Assignee: timdream → nobody
Whiteboard: [p=?]
Summary: Mystery resize event triggered on app frame when launched → Two mystery resize events triggered on app frame when launched
Sounds like a layout bug then. It is PresShell which decides when to dispatch a resize event.
Component: DOM → Layout
It's possible (although perhaps unlikely) that this is related to bug 1005964.
Flags: needinfo?(kchen)
Flags: needinfo?(cyu)
Not knowing if this helps. This is where 2 resize events are fired: 1: #11 0x40b3a962 in mozilla::dom::EventListener::HandleEvent (this=0x431a9ae0, cx=0x435897a0, aThisVal=..., event=..., aRv=...) at dom/bindings/EventListenerBinding.cpp:43 #12 0x40de54e0 in HandleEvent<mozilla::dom::EventTarget*> (this=0x43d380a0, aListener=<value optimized out>, aDOMEvent=<value optimized out>, aCurrentTarget=0x431ef3e0) at ../../dist/include/mozilla/dom/EventListenerBinding.h:53 #13 mozilla::EventListenerManager::HandleEventSubType (this=0x43d380a0, aListener=<value optimized out>, aDOMEvent=<value optimized out>, aCurrentTarget=0x431ef3e0) at dom/events/EventListenerManager.cpp:947 #14 0x40de564e in mozilla::EventListenerManager::HandleEventInternal (this=0x43d380a0, aPresContext=<value optimized out>, aEvent=0xbef14420, aDOMEvent=0xbef143bc, aCurrentTarget=0x431ef3e0, aEventStatus=0xbef143c0) at dom/events/EventListenerManager.cpp:1011 #15 0x40de357a in mozilla::EventListenerManager::HandleEvent (this=<value optimized out>, aVisitor=<value optimized out>, aCd=<value optimized out>) at ../../dist/include/mozilla/EventListenerManager.h:328 #16 mozilla::EventTargetChainItem::HandleEvent (this=<value optimized out>, aVisitor=<value optimized out>, aCd=<value optimized out>) at dom/events/EventDispatcher.cpp:197 #17 0x40de366a in mozilla::EventTargetChainItem::HandleEventTargetChain (aChain=..., aVisitor=..., aCallback=0x0, aCd=...) at dom/events/EventDispatcher.cpp:287 #18 0x40de3f40 in mozilla::EventDispatcher::Dispatch (aTarget=<value optimized out>, aPresContext=0x435db800, aEvent=0xbef14420, aDOMEvent=<value optimized out>, aEventStatus=0xbef14474, aCallback=0x0, aTargets=0x0) at dom/events/EventDispatcher.cpp:598 #19 0x410eac26 in PresShell::FireResizeEvent (this=0x43042f00) at layout/base/nsPresShell.cpp:2064 #20 0x410ee28a in PresShell::FlushPendingNotifications (this=0x43042f00, aFlush=...) at layout/base/nsPresShell.cpp:4003 #21 0x410e7c7a in PresShell::FlushPendingNotifications (this=<value optimized out>, aType=<value optimized out>) at layout/base/nsPresShell.cpp:3938 #22 0x410ed234 in PresShell::HandlePostedReflowCallbacks (this=0x43042f00, aInterruptible=true) at layout/base/nsPresShell.cpp:3906 #23 0x410ed256 in PresShell::DidDoReflow (this=0x43042f00, aInterruptible=true, aWasInterrupted=false) at layout/base/nsPresShell.cpp:8250 #24 0x410ed3dc in PresShell::ResizeReflowIgnoreOverride (this=0x43042f00, aWidth=19200, aHeight=<value optimized out>) at layout/base/nsPresShell.cpp:2009 #25 0x410ed52a in PresShell::ResizeReflowOverride (this=0x4, aWidth=1, aHeight=0) at layout/base/nsPresShell.cpp:1939 #26 0x40d6be74 in nsDOMWindowUtils::SetCSSViewport (this=<value optimized out>, aWidthPx=320, aHeightPx=480) at dom/base/nsDOMWindowUtils.cpp:299 #27 0x40cd1310 in mozilla::dom::TabChildBase::SetCSSViewport (this=<value optimized out>, aSize=...) at dom/ipc/TabChild.cpp:158 #28 0x40cd47f0 in mozilla::dom::TabChildBase::HandlePossibleViewportChange (this=0x431bc760) at dom/ipc/TabChild.cpp:229 #29 0x40cd4c8e in mozilla::dom::TabChild::Observe (this=0x431bc760, aSubject=0x4030d000, aTopic=<value optimized out>, aData=0x0) at dom/ipc/TabChild.cpp:763 #30 0x406e4bba in nsObserverList::NotifyObservers (this=<value optimized out>, aSubject=0x4030d000, aTopic=0x41ad9cac "before-first-paint", someData=0x0) at xpcom/ds/nsObserverList.cpp:96 #31 0x406e4df0 in nsObserverService::NotifyObservers (this=<value optimized out>, aSubject=0x4030d000, aTopic=0x41ad9cac "before-first-paint", someData=0x0) at xpcom/ds/nsObserverService.cpp:302 #32 0x410ed910 in nsBeforeFirstPaintDispatcher::Run (this=0x43cf12b0) at layout/base/nsPresShell.cpp:521 #33 0x40ed779c in nsContentUtils::AddScriptRunner (aRunnable=<value optimized out>) at content/base/src/nsContentUtils.cpp:4726 #34 0x410ed6b4 in PresShell::UnsuppressAndInvalidate (this=0x43042f00) at layout/base/nsPresShell.cpp:3767 #35 0x410ed8ee in PresShell::UnsuppressPainting (this=0x43042f00) at layout/base/nsPresShell.cpp:3810 #36 0x410e68d0 in nsDocumentViewer::LoadComplete (this=0x4303ced0, aStatus=1137474560) at layout/base/nsDocumentViewer.cpp:1033 #37 0x41290006 in nsDocShell::EndPageLoad (this=0x43256000, aProgress=<value optimized out>, aChannel=0x43061440, aStatus=0) at docshell/base/nsDocShell.cpp:6966 #38 0x4129870e in nsDocShell::OnStateChange (this=0x43256000, aProgress=0x43256014, aRequest=<value optimized out>, aStateFlags=<value optimized out>, aStatus=0) at docshell/base/nsDocShell.cpp:6765 #39 0x409dc93a in nsDocLoader::DoFireOnStateChange (this=0x43256000, aProgress=0x43256014, aRequest=0x43061440, aStateFlags=@0xbef14d9c, aStatus=0) at uriloader/base/nsDocLoader.cpp:1268 #40 0x409dcb86 in nsDocLoader::doStopDocumentLoad (this=<value optimized out>, request=0x43061440, aStatus=0) at uriloader/base/nsDocLoader.cpp:850 #41 0x409dccf2 in nsDocLoader::DocLoaderIsEmpty (this=0x43256000, aFlushLayout=<value optimized out>) at uriloader/base/nsDocLoader.cpp:740 #42 0x409dce54 in nsDocLoader::OnStopRequest (this=0x43256000, aRequest=0x40321b18, aCtxt=<value optimized out>, aStatus=0) at uriloader/base/nsDocLoader.cpp:624 #43 0x407351aa in nsLoadGroup::RemoveRequest (this=0x432d4dc0, request=0x40321b18, ctxt=0x0, aStatus=0) at netwerk/base/src/nsLoadGroup.cpp:689 #44 0x40ec1e1e in nsDocument::DoUnblockOnload (this=0x4030d000) at content/base/src/nsDocument.cpp:8716 #45 0x40ec1e30 in nsUnblockOnloadEvent::Run (this=<value optimized out>) at content/base/src/nsDocument.cpp:8669 #46 0x406fbe32 in nsThread::ProcessNextEvent (this=0x403024e0, mayWait=false, result=0xbef14edf) at xpcom/threads/nsThread.cpp:715 #47 0x406ca1dc in NS_ProcessNextEvent (thread=0x0, mayWait=false) at xpcom/glue/nsThreadUtils.cpp:263 #48 0x40844d8c in mozilla::ipc::MessagePump::Run (this=0x40301ac0, aDelegate=0xbef157ec) at ipc/glue/MessagePump.cpp:95 #49 0x40844e5a in mozilla::ipc::MessagePumpForChildProcess::Run (this=0x40301ac0, aDelegate=0xbef157ec) at ipc/glue/MessagePump.cpp:283 #50 0x408386d8 in MessageLoop::RunInternal (this=0x1000000) at ipc/chromium/src/base/message_loop.cc:229 #51 0x40838756 in MessageLoop::RunHandler (this=0xbef157ec) at ipc/chromium/src/base/message_loop.cc:222 #52 MessageLoop::Run (this=0xbef157ec) at ipc/chromium/src/base/message_loop.cc:196 #53 0x40cf7680 in nsBaseAppShell::Run (this=0x4325b040) at widget/xpwidgets/nsBaseAppShell.cpp:164 #54 0x4133b7de in XRE_RunAppShell () at toolkit/xre/nsEmbedFunctions.cpp:679 #55 0x40844e28 in mozilla::ipc::MessagePumpForChildProcess::Run (this=0x40301ac0, aDelegate=0xbef157ec) at ipc/glue/MessagePump.cpp:253 #56 0x408386d8 in MessageLoop::RunInternal (this=0x4325b040) at ipc/chromium/src/base/message_loop.cc:229 #57 0x40838756 in MessageLoop::RunHandler (this=0xbef157ec) at ipc/chromium/src/base/message_loop.cc:222 #58 MessageLoop::Run (this=0xbef157ec) at ipc/chromium/src/base/message_loop.cc:196 #59 0x4133bc4c in XRE_InitChildProcess (aArgc=-1091479160, aArgv=0xbef158fc, aProcess=1077145600) at toolkit/xre/nsEmbedFunctions.cpp:516 #60 0x000087a0 in main (argc=8, argv=0xbef15984) at ipc/app/MozillaRuntimeMain.cpp:149 2. #11 0x40b3a962 in mozilla::dom::EventListener::HandleEvent (this=0x431a9ae0, cx=0x435897a0, aThisVal=..., event=..., aRv=...) at dom/bindings/EventListenerBinding.cpp:43 #12 0x40de54e0 in HandleEvent<mozilla::dom::EventTarget*> (this=0x43d380a0, aListener=<value optimized out>, aDOMEvent=<value optimized out>, aCurrentTarget=0x431ef3e0) at ../../dist/include/mozilla/dom/EventListenerBinding.h:53 #13 mozilla::EventListenerManager::HandleEventSubType (this=0x43d380a0, aListener=<value optimized out>, aDOMEvent=<value optimized out>, aCurrentTarget=0x431ef3e0) at dom/events/EventListenerManager.cpp:947 #14 0x40de564e in mozilla::EventListenerManager::HandleEventInternal (this=0x43d380a0, aPresContext=<value optimized out>, aEvent=0xbef14490, aDOMEvent=0xbef1442c, aCurrentTarget=0x431ef3e0, aEventStatus=0xbef14430) at dom/events/EventListenerManager.cpp:1011 #15 0x40de357a in mozilla::EventListenerManager::HandleEvent (this=<value optimized out>, aVisitor=<value optimized out>, aCd=<value optimized out>) at ../../dist/include/mozilla/EventListenerManager.h:328 #16 mozilla::EventTargetChainItem::HandleEvent (this=<value optimized out>, aVisitor=<value optimized out>, aCd=<value optimized out>) at dom/events/EventDispatcher.cpp:197 #17 0x40de366a in mozilla::EventTargetChainItem::HandleEventTargetChain (aChain=..., aVisitor=..., aCallback=0x0, aCd=...) at dom/events/EventDispatcher.cpp:287 #18 0x40de3f40 in mozilla::EventDispatcher::Dispatch (aTarget=<value optimized out>, aPresContext=0x435db800, aEvent=0xbef14490, aDOMEvent=<value optimized out>, aEventStatus=0xbef144e4, aCallback=0x0, aTargets=0x0) at dom/events/EventDispatcher.cpp:598 #19 0x410eac26 in PresShell::FireResizeEvent (this=0x43042f00) at layout/base/nsPresShell.cpp:2064 #20 0x410ee28a in PresShell::FlushPendingNotifications (this=0x43042f00, aFlush=...) at layout/base/nsPresShell.cpp:4003 #21 0x410e7c7a in PresShell::FlushPendingNotifications (this=<value optimized out>, aType=<value optimized out>) at layout/base/nsPresShell.cpp:3938 #22 0x40ebf48a in nsDocument::FlushPendingNotifications (this=0x4030d000, aType=Flush_Layout) at content/base/src/nsDocument.cpp:7844 #23 0x40ee227a in mozilla::dom::Element::GetPrimaryFrame (this=0x43d4a7c0, aType=Flush_Content) at content/base/src/Element.cpp:1651 #24 0x40ee4534 in mozilla::dom::Element::GetScrollFrame (this=0x43d4a7c0, aStyledFrame=0x0, aFlushLayout=false) at content/base/src/Element.cpp:523 #25 0x40ee4662 in mozilla::dom::Element::ScrollWidth (this=0x43d4a7c0) at content/base/src/Element.cpp:651 #26 0x40cd46a6 in mozilla::dom::TabChildBase::GetPageSize (this=<value optimized out>, aDocument=<value optimized out>, aViewport=...) at dom/ipc/TabChild.cpp:175 #27 0x40cd492c in mozilla::dom::TabChildBase::HandlePossibleViewportChange (this=0x431bc760) at dom/ipc/TabChild.cpp:305 #28 0x40cd4c8e in mozilla::dom::TabChild::Observe (this=0x431bc760, aSubject=0x4030d000, aTopic=<value optimized out>, aData=0x0) at dom/ipc/TabChild.cpp:763 #29 0x406e4bba in nsObserverList::NotifyObservers (this=<value optimized out>, aSubject=0x4030d000, aTopic=0x41ad9cac "before-first-paint", someData=0x0) at xpcom/ds/nsObserverList.cpp:96 #30 0x406e4df0 in nsObserverService::NotifyObservers (this=<value optimized out>, aSubject=0x4030d000, aTopic=0x41ad9cac "before-first-paint", someData=0x0) at xpcom/ds/nsObserverService.cpp:302 #31 0x410ed910 in nsBeforeFirstPaintDispatcher::Run (this=0x43cf12b0) at layout/base/nsPresShell.cpp:521 #32 0x40ed779c in nsContentUtils::AddScriptRunner (aRunnable=<value optimized out>) at content/base/src/nsContentUtils.cpp:4726 #33 0x410ed6b4 in PresShell::UnsuppressAndInvalidate (this=0x43042f00) at layout/base/nsPresShell.cpp:3767 #34 0x410ed8ee in PresShell::UnsuppressPainting (this=0x43042f00) at layout/base/nsPresShell.cpp:3810 #35 0x410e68d0 in nsDocumentViewer::LoadComplete (this=0x4303ced0, aStatus=1137474560) at layout/base/nsDocumentViewer.cpp:1033 #36 0x41290006 in nsDocShell::EndPageLoad (this=0x43256000, aProgress=<value optimized out>, aChannel=0x43061440, aStatus=0) at docshell/base/nsDocShell.cpp:6966 #37 0x4129870e in nsDocShell::OnStateChange (this=0x43256000, aProgress=0x43256014, aRequest=<value optimized out>, aStateFlags=<value optimized out>, aStatus=0) at docshell/base/nsDocShell.cpp:6765 #38 0x409dc93a in nsDocLoader::DoFireOnStateChange (this=0x43256000, aProgress=0x43256014, aRequest=0x43061440, aStateFlags=@0xbef14d9c, aStatus=0) at uriloader/base/nsDocLoader.cpp:1268 #39 0x409dcb86 in nsDocLoader::doStopDocumentLoad (this=<value optimized out>, request=0x43061440, aStatus=0) at uriloader/base/nsDocLoader.cpp:850 #40 0x409dccf2 in nsDocLoader::DocLoaderIsEmpty (this=0x43256000, aFlushLayout=<value optimized out>) at uriloader/base/nsDocLoader.cpp:740 #41 0x409dce54 in nsDocLoader::OnStopRequest (this=0x43256000, aRequest=0x40321b18, aCtxt=<value optimized out>, aStatus=0) at uriloader/base/nsDocLoader.cpp:624 #42 0x407351aa in nsLoadGroup::RemoveRequest (this=0x432d4dc0, request=0x40321b18, ctxt=0x0, aStatus=0) at netwerk/base/src/nsLoadGroup.cpp:689 #43 0x40ec1e1e in nsDocument::DoUnblockOnload (this=0x4030d000) at content/base/src/nsDocument.cpp:8716 #44 0x40ec1e30 in nsUnblockOnloadEvent::Run (this=<value optimized out>) at content/base/src/nsDocument.cpp:8669 #45 0x406fbe32 in nsThread::ProcessNextEvent (this=0x403024e0, mayWait=false, result=0xbef14edf) at xpcom/threads/nsThread.cpp:715 #46 0x406ca1dc in NS_ProcessNextEvent (thread=0x0, mayWait=false) at xpcom/glue/nsThreadUtils.cpp:263 #47 0x40844d8c in mozilla::ipc::MessagePump::Run (this=0x40301ac0, aDelegate=0xbef157ec) at ipc/glue/MessagePump.cpp:95 #48 0x40844e5a in mozilla::ipc::MessagePumpForChildProcess::Run (this=0x40301ac0, aDelegate=0xbef157ec) at ipc/glue/MessagePump.cpp:283 #49 0x408386d8 in MessageLoop::RunInternal (this=0x1000000) at ipc/chromium/src/base/message_loop.cc:229 #50 0x40838756 in MessageLoop::RunHandler (this=0xbef157ec) at ipc/chromium/src/base/message_loop.cc:222 #51 MessageLoop::Run (this=0xbef157ec) at ipc/chromium/src/base/message_loop.cc:196 #52 0x40cf7680 in nsBaseAppShell::Run (this=0x4325b040) at widget/xpwidgets/nsBaseAppShell.cpp:164 #53 0x4133b7de in XRE_RunAppShell () at toolkit/xre/nsEmbedFunctions.cpp:679 #54 0x40844e28 in mozilla::ipc::MessagePumpForChildProcess::Run (this=0x40301ac0, aDelegate=0xbef157ec) at ipc/glue/MessagePump.cpp:253 #55 0x408386d8 in MessageLoop::RunInternal (this=0x4325b040) at ipc/chromium/src/base/message_loop.cc:229 #56 0x40838756 in MessageLoop::RunHandler (this=0xbef157ec) at ipc/chromium/src/base/message_loop.cc:222 #57 MessageLoop::Run (this=0xbef157ec) at ipc/chromium/src/base/message_loop.cc:196 #58 0x4133bc4c in XRE_InitChildProcess (aArgc=-1091479160, aArgv=0xbef158fc, aProcess=1077145600) at toolkit/xre/nsEmbedFunctions.cpp:516 #59 0x000087a0 in main (argc=8, argv=0xbef15984) at ipc/app/MozillaRuntimeMain.cpp:149
That second resize event is the only one that should be getting fired. See the comment at http://mxr.mozilla.org/mozilla-central/source/dom/ipc/TabChild.cpp?rev=b347f6eb2239#301 IIRC the SetCSSViewport call (the one that is triggering the first resize event in your stacks above) should only be setting a flag somewhere in layout, and the resize event should be generated lazily.
:kats, Why should there be a second resize event? Do we know what action in System caused the resize event?
Sorry if I wasn't clear - the first resize event as listed in comment 8 shouldn't be happening, as far as I know. Only one resize event should be getting triggered. There isn't any particular reason for this resize event except that on mobile we need to set the CSS viewport based on the meta-viewport tag and our default values and that triggers the resize event.
Looks like this is related to bug 997101
FYI, in bug 995886 comment 78, Jan found that if System app introduce a force sync reflow right after appending the iframe to the body, the multiple resize events will be gone.
So the funny thing is that I can't reproduce this on a Peak with Gecko from GP and 1.4 Gaia, but I can on a Flame (with self compiled mc, and gaia 1.4). Maybe GP patched this themselves?
Depends on: 1072392
Bug 997101 may have gotten rid of the extra resize - probably worth checking again to see if the behaviour you get now is better.
Flags: needinfo?(timdream)
Let me see if this is fixed already.
So there is only one event now in the template app. However, I still get *one* resize event even if I removed the meta viewport tag.
Flags: needinfo?(timdream)
Changed commit description to match Mozilla commit message conventions.
Comment on attachment 8605376 [details] [diff] [review] 0001-Make-nsQtNetworkLinkService-destructor-private.patch Wrong bug #.
Attachment #8605376 - Attachment is obsolete: true
Status: NEW → RESOLVED
Closed: 7 years ago
Priority: P1 → P3
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: