Bug 16817

Summary: Flash opens in new window when leaving a page
Product: swfdec Reporter: Daniel Gryniewicz <dang>
Component: pluginAssignee: swfdec ml <swfdec>
Status: CLOSED NOTOURBUG QA Contact: swfdec ml <swfdec>
Severity: normal    
Priority: medium CC: bugs.freedesktop, comicfans44, ed
Version: 0.6.6   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: reduced plugin source

Description Daniel Gryniewicz 2008-07-23 09:13:35 UTC
Starting with xulrunner 1.9, some flash opens in a new window.  An example is http://www.gamefly.com/member/ (or almost any other gamefly page).  Killing the window with the window manager quickly causes a crash in the browser.  I've verified this in epiphany (2.22.x and 2.23.5) and in firefox 3.0.1.  This did not happen with xulrunner 1.8.

This has been reported as launchpad https://bugs.launchpad.net/ubuntu/+source/firefox-3.0/+bug/250769

Since this is new behavior in xulrunner 1.9, it seems likely to be a xulrunner bug rather than a swfdec bug, but it also seems likely that swfdec will respond better and faster than xulrunner (and it may be a deliberate API change).

I've also seen this with 0.7.2, so it's not a 0.6.6 issue, even tho that's what gentoo ships.
Comment 1 Benjamin Otte 2008-07-23 12:00:34 UTC
I've never seen that happen before. And your link goes to a site that requires being logged in. Do you have a site that does not require this but causes this behavior?
Comment 2 Daniel Gryniewicz 2008-07-23 12:56:48 UTC
www.mgoblue.com does it, too.

It occures to me that it may be related to my greasemonkey script that removes flash.  Let me check.
Comment 3 Daniel Gryniewicz 2008-07-23 13:13:52 UTC
Okay, it's semi-related to my greasemonkey script.  That script causes it to happen when the page finishes loading (and the flash is made invisible).  It still happens, tho, when I close the tab containing the flash, even without the script.  I'll attach the script, if it's useful.

Since it happens in both firefox 3.0.1 and epiphany 2.23.5 (and sometimes even in liferea 1.4.16b) I'm assuming it's related to xulrunner, as that's the only thing they all have in common.

Is there something I could do to help debug?
Comment 4 Benjamin Otte 2008-07-23 15:02:42 UTC
It doesn't happen on mgoblue.com for me. But I'm using Hardy's Firefox 3.0rc-something, not 3.0.1, so that might be part of the problem, though i'd blame the script.

But it looks like this would most likely be a Mozilla or script problem and not a Swfdec issue. But no idea really.
Comment 5 Daniel Gryniewicz 2008-07-25 09:12:10 UTC
Changing the discription, because I'm able to see this in epiphany 2.23.5 with webkit-gtk 35024 as well.  This is with swfdec 0.7.2 (obviously).  This one happened on youtube, and it appears to happen on all flash for me.
Comment 6 Pavel Roskin 2008-07-29 21:59:44 UTC
This bug manifests itself on the current Fedora development (Rawhide) x86_64.  I can reproduce it with Firefox 3.0.1 and Seamonkey 1.1.11.  I tried versions 0.6.0, 0.6.8 and the trunk.  All of them have this problem.

I can reproduce it every time on youtube.com.  I can also reproduce it on Pinch Hitter 2 (http://www.addictinggames.com/pinchhitter2.html), which confirms that video playback is irrelevant.

When leaving the page, a new window opens.  It has the size of the original plugin area.  In case of youtube.com, the window is just a white rectangle.  However, when closing the browser, an image from the plugin can briefly appear in the window before it gets closed.
Comment 7 Benjamin Otte 2008-07-30 01:24:34 UTC
Some more information:
https://bugzilla.mozilla.org/show_bug.cgi?id=263160 might or might not be related. I poked Karl Tomlinson from Mozilla about it, and he did not have any idea what could cause this either.
The biggest problem from my part is that I did not change a single line of code in the embedding stuff from when this problem did not appear _at all_.

Your systems make me think that some other software is the cause for this sudden change in behavior, likely one of Mozilla, Gtk or X. The best way forward would probably be downgrading those packages to see if that makes the problem go away, but that's likely a boring and time-consuming thing to do.

I'd of course also take a patch that makes Swfdec stop doing this. :)
Comment 8 Maciej Piechotka 2008-07-30 02:00:50 UTC
Reproduced in 0.7.2 on x86.
I do not use greasmonkey (in fact I do not use Firefox - only xulrunner)
Comment 9 Maciej Piechotka 2008-07-30 02:01:37 UTC
Reproduced in 0.7.2 on x86.
I do not use greasmonkey (in fact I do not use Firefox - only xulrunner).
Sometimes it crash the browser instead.
Comment 10 Riccardo Magliocchetti 2008-07-30 08:46:39 UTC
*** Bug 16902 has been marked as a duplicate of this bug. ***
Comment 11 Pavel Roskin 2008-07-30 10:10:10 UTC
Fixefox 3.0.1 and Seamonkey 1.1.11 don't have this problem on Fedora 9.  I tend to think that the problem is related to gtk.  It's 2.12.11 on Fedora 9 and 2.13.5 on RawHide.  Ubuntu 8.10 alpha1 uses 2.13.3.  Perhaps gtk 2.13.x refuses a request to close the plugin window, so it gets detached instead (just guessing).
Comment 12 Pavel Roskin 2008-08-01 23:49:11 UTC
Created attachment 18074 [details]
reduced plugin source
Comment 13 Pavel Roskin 2008-08-01 23:54:58 UTC
The attached replacement for plugin.c source has no references to swfdec, yet it leaves open windows on Fedora Development, but not on Fedora 9.  What we need is to get a correctly working plugin and reduce it to a similar minimal form to find out when the empty windows begin to appear.

mplayerplug-in behaves correctly, but it's in C++ and has some complicated stuff (control window, full screen support).
Comment 14 Daniel Gryniewicz 2008-08-03 07:00:16 UTC
Okay, I'm now getting a crash in epiphany every time I scroll a (not playing) flash widget out of the screen.  It seems likely to be related to this.  I'll check to see if downgrading gtk+ helps at a later point (I'm using 2.13.5), but that's a non-trivial issue.  In the meantime, here's the backtrace.  Hopefully it will give a hint?

#0  0x00007fd3ef22186b in raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:41
41	  return INLINE_SYSCALL (tgkill, 3, pid, THREAD_GETMEM (THREAD_SELF, tid),
(gdb) bt
#0  0x00007fd3ef22186b in raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:41
#1  0x00007fd3e61d6acd in nsProfileLock::FatalSignalHandler (signo=11) at nsProfileLock.cpp:212
#2  <signal handler called>
#3  cairo_draw_with_xlib (cr=0x33d5400, callback=0x7fd3e2cdc424 <NativeRendering>, closure=0x7ffffaf21d80, dpy=0x0, width=425, height=355, is_opaque=CAIRO_XLIB_DRAWING_OPAQUE, capabilities=27, 
    result=0x0) at cairo-xlib-utils.c:329
#4  0x00007fd3e2cdc534 in gfxXlibNativeRenderer::Draw (this=0x7ffffaf21a70, dpy=0x0, ctx=0x3cd1430, width=425, height=355, flags=0, output=0x0) at gfxXlibNativeRenderer.cpp:101
#5  0x00007fd3d978c058 in nsPluginInstanceOwner::Paint (this=0x4a90a10, aRenderingContext=@0x2493b60, aDirtyRect=@0x7ffffaf21eb0) at nsObjectFrame.cpp:4076
#6  0x00007fd3d978c0a4 in nsObjectFrame::PaintPlugin (this=0x3ef78b0, aRenderingContext=@0x2493b60, aDirtyRect=@0x7ffffaf21eb0) at nsObjectFrame.cpp:1400
#7  0x00007fd3d978c12d in PaintPlugin (aFrame=0x3ef78b0, aCtx=0x2493b60, aDirtyRect=@0x7ffffaf21f80, aPt={x = -84795632, y = 32767}) at nsObjectFrame.cpp:1096
#8  0x00007fd3d977bd4c in nsDisplayGeneric::Paint (this=0x48b01c8, aBuilder=<value optimized out>, aCtx=0x2493b60, aDirtyRect=@0x7ffffaf21f80) at ../base/nsDisplayList.h:862
#9  0x00007fd3d973591c in nsDisplayList::Paint (this=<value optimized out>, aBuilder=0x7ffffaf22010, aCtx=0x2493b60, aDirtyRect=@0x7ffffaf21f80) at nsDisplayList.cpp:296
#10 0x00007fd3d97359aa in nsDisplayClip::Paint (this=<value optimized out>, aBuilder=0x7ffffaf22010, aCtx=0x2493b60, aDirtyRect=<value optimized out>) at nsDisplayList.cpp:693
#11 0x00007fd3d973591c in nsDisplayList::Paint (this=<value optimized out>, aBuilder=0x7ffffaf22010, aCtx=0x2493b60, aDirtyRect=@0x7ffffaf225c0) at nsDisplayList.cpp:296
#12 0x00007fd3d9744842 in nsLayoutUtils::PaintFrame (aRenderingContext=0x2493b60, aFrame=<value optimized out>, aDirtyRegion=@0x7ffffaf22590, aBackground=4278190080) at nsLayoutUtils.cpp:988
#13 0x00007fd3d974aa3e in PresShell::Paint (this=<value optimized out>, aView=0x0, aRenderingContext=0x2493b60, aDirtyRegion=@0x7ffffaf22590) at nsPresShell.cpp:5413
#14 0x00007fd3d9972eea in nsViewManager::RenderViews (this=0x29c3db0, aView=<value optimized out>, aRC=@0x2493b60, aRegion=@0x7ffffaf226a0) at nsViewManager.cpp:614
#15 0x00007fd3d997350b in nsViewManager::Refresh (this=0x29c3db0, aView=0x3cc7ee0, aContext=0x2493b60, aRegion=<value optimized out>, aUpdateFlags=1) at nsViewManager.cpp:502
#16 0x00007fd3d9973eaa in nsViewManager::DispatchEvent (this=0x29c3db0, aEvent=0x7ffffaf22870, aStatus=0x7ffffaf2282c) at nsViewManager.cpp:1134
#17 0x00007fd3d996ed7d in HandleEvent (aEvent=0x7ffffaf22870) at nsView.cpp:168
#18 0x00007fd3dbb21a39 in nsCommonWidget::DispatchEvent (this=0x3ccb550, aEvent=0x7ffffaf22870, aStatus=@0x0) at nsCommonWidget.cpp:158
#19 0x00007fd3dbb1d934 in nsWindow::OnExposeEvent (this=0x3ccb550, aWidget=<value optimized out>, aEvent=0x7ffffaf22f50) at nsWindow.cpp:1763
#20 0x00007fd3dbb1df03 in expose_event_cb (widget=0x25ff8b0, event=0x7ffffaf22f50) at nsWindow.cpp:4529
#21 0x00007fd3f0eb77ba in _gtk_marshal_BOOLEAN__BOXED (closure=0x25ff6a0, return_value=0x7ffffaf22c40, n_param_values=<value optimized out>, param_values=0x3a64e00, 
    invocation_hint=<value optimized out>, marshal_data=0x7fd3dbb1decf) at gtkmarshalers.c:84
#22 0x00007fd3eedd8c34 in IA__g_closure_invoke (closure=0x25ff6a0, return_value=0x7ffffaf22c40, n_param_values=2, param_values=0x3a64e00, invocation_hint=0x7ffffaf22c00) at gclosure.c:767
#23 0x00007fd3eedecd40 in signal_emit_unlocked_R (node=0x1a01a00, detail=0, instance=0x25ff8b0, emission_return=0x7ffffaf22d80, instance_and_params=0x3a64e00) at gsignal.c:3244
#24 0x00007fd3eedee3db in IA__g_signal_emit_valist (instance=0x25ff8b0, signal_id=<value optimized out>, detail=0, var_args=0x7ffffaf22de0) at gsignal.c:2987
#25 0x00007fd3eedeea2d in IA__g_signal_emit (instance=0x299f010, signal_id=4210170912, detail=0) at gsignal.c:3034
#26 0x00007fd3f0fb46fa in gtk_widget_event_internal (widget=0x25ff8b0, event=0x7ffffaf22f50) at gtkwidget.c:4743
#27 0x00007fd3f0eb1d71 in IA__gtk_main_do_event (event=0x7ffffaf22f50) at gtkmain.c:1529
#28 0x00007fd3f08fc1ca in gdk_window_process_updates_internal (window=0x24cf540) at gdkwindow.c:2598
#29 0x00007fd3f08fc94a in IA__gdk_window_process_updates (window=0x24cf540, update_children=0) at gdkwindow.c:2714
#30 0x00007fd3dbb1e787 in nsWindow::Update (this=<value optimized out>) at nsWindow.cpp:1219
#31 0x00007fd3d9971898 in nsViewManager::UpdateWidgetsForView (this=0x29c3db0, aView=0x7ffffaf21c20) at nsViewManager.cpp:1770
#32 0x00007fd3d99718a9 in nsViewManager::UpdateWidgetsForView (this=0x29c3db0, aView=<value optimized out>) at nsViewManager.cpp:1776
#33 0x00007fd3d99718a9 in nsViewManager::UpdateWidgetsForView (this=0x29c3db0, aView=<value optimized out>) at nsViewManager.cpp:1776
#34 0x00007fd3d9971ab7 in nsViewManager::ForceUpdate (this=0x4001e2a) at nsViewManager.cpp:2005
#35 0x00007fd3d98b3178 in nsEventStateManager::DoScrollText (this=0x29c32e0, aPresContext=0x29c2ee0, aTargetFrame=<value optimized out>, aEvent=0x7ffffaf235f0, aNumLines=3, aScrollHorizontal=0, 
    aScrollQuantity=nsEventStateManager::eScrollByLine) at nsEventStateManager.cpp:2254
#36 0x00007fd3d98b3693 in nsEventStateManager::PostHandleEvent (this=0x29c32e0, aPresContext=0x29c2ee0, aEvent=0x7ffffaf235f0, aTargetFrame=0x3ccaef8, aStatus=0x7ffffaf234dc, aView=<value optimized out>)
    at nsEventStateManager.cpp:2507
#37 0x00007fd3d9749c24 in PresShell::HandleEventInternal (this=0x29c97a0, aEvent=0x7ffffaf235f0, aView=<value optimized out>, aStatus=0x7ffffaf234dc) at nsPresShell.cpp:5942
#38 0x00007fd3d974a316 in PresShell::HandlePositionedEvent (this=0x29c97a0, aView=0x29c3e40, aTargetFrame=<value optimized out>, aEvent=0x7ffffaf235f0, aEventStatus=0x7ffffaf234dc)
    at nsPresShell.cpp:5809
#39 0x00007fd3d974a7c3 in PresShell::HandleEvent (this=0x29c97a0, aView=0x29c3e40, aEvent=0x7ffffaf235f0, aEventStatus=0x7ffffaf234dc) at nsPresShell.cpp:5669
#40 0x00007fd3d997219f in nsViewManager::HandleEvent (this=<value optimized out>, aView=0x29c3e40, aPoint=<value optimized out>, aEvent=0x7ffffaf235f0, aCaptured=425) at nsViewManager.cpp:1382
#41 0x00007fd3d9973b9c in nsViewManager::DispatchEvent (this=0x29c3db0, aEvent=0x7ffffaf235f0, aStatus=0x7ffffaf235bc) at nsViewManager.cpp:1337
#42 0x00007fd3d996ed7d in HandleEvent (aEvent=0x7ffffaf235f0) at nsView.cpp:168
#43 0x00007fd3dbb21a39 in nsCommonWidget::DispatchEvent (this=0x3ccb550, aEvent=0x7ffffaf235f0, aStatus=@0x0) at nsCommonWidget.cpp:158
#44 0x00007fd3dbb1c274 in nsWindow::OnScrollEvent (this=0x3ccb550, aWidget=<value optimized out>, aEvent=0x32a9d50) at nsWindow.cpp:2597
#45 0x00007fd3dbb1c315 in scroll_event_cb (widget=0x25ff8b0, event=0x32a9d50) at nsWindow.cpp:4833
#46 0x00007fd3f0eb77ba in _gtk_marshal_BOOLEAN__BOXED (closure=0x2601970, return_value=0x7ffffaf238a0, n_param_values=<value optimized out>, param_values=0x41f7230, 
    invocation_hint=<value optimized out>, marshal_data=0x7fd3dbb1c2eb) at gtkmarshalers.c:84
#47 0x00007fd3eedd8c34 in IA__g_closure_invoke (closure=0x2601970, return_value=0x7ffffaf238a0, n_param_values=2, param_values=0x41f7230, invocation_hint=0x7ffffaf23860) at gclosure.c:767
#48 0x00007fd3eedecd40 in signal_emit_unlocked_R (node=0x1944ef0, detail=0, instance=0x25ff8b0, emission_return=0x7ffffaf239e0, instance_and_params=0x41f7230) at gsignal.c:3244
#49 0x00007fd3eedee3db in IA__g_signal_emit_valist (instance=0x25ff8b0, signal_id=<value optimized out>, detail=0, var_args=0x7ffffaf23a40) at gsignal.c:2987
#50 0x00007fd3eedeea2d in IA__g_signal_emit (instance=0x299f010, signal_id=4210170912, detail=0) at gsignal.c:3034
#51 0x00007fd3f0fb46fa in gtk_widget_event_internal (widget=0x25ff8b0, event=0x32a9d50) at gtkwidget.c:4743
#52 0x00007fd3f0eb109d in IA__gtk_propagate_event (widget=0x25ff8b0, event=0x32a9d50) at gtkmain.c:2352
#53 0x00007fd3f0eb2025 in IA__gtk_main_do_event (event=0x32a9d50) at gtkmain.c:1553
#54 0x00007fd3f091478d in gdk_event_dispatch (source=<value optimized out>, callback=<value optimized out>, user_data=<value optimized out>) at gdkevents-x11.c:2365
---Type <return> to continue, or q <return> to quit---
#55 0x00007fd3eeb28c5b in IA__g_main_context_dispatch (context=0x1367010) at gmain.c:2068
#56 0x00007fd3eeb2be85 in g_main_context_iterate (context=0x1367010, block=1, dispatch=1, self=<value optimized out>) at gmain.c:2701
#57 0x00007fd3eeb2c366 in IA__g_main_loop_run (loop=0x1c96270) at gmain.c:2924
#58 0x00007fd3f0eb234e in IA__gtk_main () at gtkmain.c:1172
#59 0x000000000043a415 in main (argc=1, argv=<value optimized out>) at ephy-main.c:742
Comment 15 Karl Tomlinson 2008-08-03 13:39:41 UTC
(In reply to comment #14)
> I'm now getting a crash in epiphany every time I scroll a (not playing)
> flash widget out of the screen.

> #3  cairo_draw_with_xlib (cr=0x33d5400, callback=0x7fd3e2cdc424
> <NativeRendering>, closure=0x7ffffaf21d80, dpy=0x0, width=425, height=355,
> is_opaque=CAIRO_XLIB_DRAWING_OPAQUE, capabilities=27, 
>     result=0x0) at cairo-xlib-utils.c:329

That's a different issue (which will be fixed in Firefox 3.0.2):

https://bugzilla.mozilla.org/show_bug.cgi?id=435764

It is fixed in recent firefox mozilla-central and 1.9.0 nightly builds:

http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/?C=M;O=D
Comment 16 Karl Tomlinson 2008-08-03 14:07:32 UTC
(In reply to comment #13)
> The attached replacement for plugin.c source has no references to swfdec, yet
> it leaves open windows on Fedora Development, but not on Fedora 9.

That's very useful, thank you.  It's a very minimal plugin, suggesting that the problem is some interaction between browser (Mozilla and webkit) code and their libraries rather than anything to do with swfdec-mozilla.

Note that Gentoo doesn't provide 2.13 versions of gtk+, and Daniel was seeing this on Gentoo, so that would seem to rule out the gtk+-2.13 theory.  (I haven't been able to reproduce myself, on amd64 Gentoo.)

> What we need is to get a correctly working plugin and reduce it to a
> similar minimal form to find out when the empty windows begin to appear.

Diamondx is a simple plugin that would be interesting to test.  It uses the XEmbed API rather than the old Xt API (used by swfdec-mozilla).

http://multimedia.cx/diamondx/
Comment 17 Daniel Gryniewicz 2008-08-03 17:56:27 UTC
Gentoo does provide 2.13 gtk+ (in an overlay) and I am indeed seeing this on 2.13.  I don't have swfdec on any of my non 2.13 boxes ATM, so I won't be able to test that theory for a couple of days at least.

I just tested the diamondx plugin, and it appears to work correctly.
Comment 18 Karl Tomlinson 2008-08-03 19:30:12 UTC
If it's only Xt plugins that are seeing this problem, then it may be that a change in GTK means that the order of asynchronous operations with the X server have changed.  Xt plugins use an X Server connection (Display) that is different from the one used in the browser, so there is the possibility of operations getting out of order.

Running Mozilla (and maybe Epiphany) with the "--sync" option will make the operations on the browser's Display synchronous (at a cost to performance), and so may correct things, but I don't know any way to make the Xt plugin's Display process operations synchronously.
Comment 19 Benjamin Otte 2008-08-04 12:12:25 UTC
small side note: Swfdec does use neither Xt nor XEmbed, but Gdk directly.
Comment 20 Benjamin Otte 2008-08-22 04:49:08 UTC
This is http://bugzilla.gnome.org/show_bug.cgi?id=548993 now.
Comment 21 Ed Catmur 2008-08-25 14:08:28 UTC
Possible patch at http://bugzilla.gnome.org/show_bug.cgi?id=548993#c2
Comment 22 Benjamin Otte 2008-08-27 23:44:34 UTC
Since Ed's patch was commmitted to gtk trunk, I assume we can close this bug.
Comment 23 Daniel Gryniewicz 2008-08-28 06:16:14 UTC
I agree.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.