Bug 232736 - Flash mimetype association is ignored
Summary: Flash mimetype association is ignored
Status: RESOLVED FIXED
Alias: None
Product: kwebkitpart
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: webkit-devel
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-30 19:08 UTC by Chris
Modified: 2012-09-05 21:41 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 1.3.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris 2010-03-30 19:08:17 UTC
Version:            (using Devel)
Compiler:          GCC 4.3.4 
OS:                Linux
Installed from:    Compiled sources

The embedding options set for application/x-shockwave-flash, as set in System Settings->Advanced->File Associations, are ignored when using the WebKit kpart with Konqueror. When a page is rendered using WebKit, flash applets are run directly in the page, instead of being embedded using kmplayer/knpplayer or nspluginviewer. When the view mode is switched to KHTML, the flash applet properly loads with the selected kmplayer kpart.

This makes it very problematic to use WebKit on sites that have flash content, as the flash plugin freezing or crashing will take the whole browser with it instead of just knpplayer or nspluginviewer.

Oddly enough, the Plugins section of Konqueror's configuration does have an effect.. unchecking the "Enable plugins globally" option prevents the flash plugin from loading. However, there is no way to get it to embed using the kpart selected under the File Associations.
Comment 1 Dawit Alemayehu 2010-03-31 09:06:57 UTC
(In reply to comment #0)
> The embedding options set for application/x-shockwave-flash, as set in System
> Settings->Advanced->File Associations, are ignored when using the WebKit kpart
> with Konqueror. When a page is rendered using WebKit, flash applets are run
> directly in the page, instead of being embedded using kmplayer/knpplayer or
> nspluginviewer. When the view mode is switched to KHTML, the flash applet
> properly loads with the selected kmplayer kpart.

That happens not because kwebkitpart, actually kdewebkit, is incapable of embedding nspluginviewer, but rather because there were multitude of problems in doing so. Originally, handling of flash content was deffered to QtWebKit because using nspluginviewer under kdewebkit/qtwebkit resulted many random crashes and other nasty side effects. Nowadays though those issues mostly do not exist and have been replaced by other equally annoying issues. For example, clicking on links inside of a flash content does not currently work. Also there seems to be trouble with resizing active or paused content on demand which seems to cause crashes. 
That is why we purposefully blocking the use of nspluginviewer or whatever else is configured to handle flash in KDE right now.

> This makes it very problematic to use WebKit on sites that have flash content,
> as the flash plugin freezing or crashing will take the whole browser with it
> instead of just knpplayer or nspluginviewer.

Right... the current nsplugin viewer included in QtWebKit is an in-process viewer. There were/are plans to change it to out of process for the same reasons you state here, but I have no idea what became of that goal.

> Oddly enough, the Plugins section of Konqueror's configuration does have an
> effect.. unchecking the "Enable plugins globally" option prevents the flash
> plugin from loading. However, there is no way to get it to embed using the
> kpart selected under the File Associations.

That is because kwebkitpart tries hard to support, however KHTML specific they may be, all of Konqueror's configuration and the nspluginviewer does not work for reasons stated above...

BTW, since you seem to have compiled KDE from source, you can easily change  kdewebkit to use KDE's preferred viewer for flash content by simply commenting out the 2 lines below 

if (!excludedMimeType(mimeType))
    part = KMimeTypeTrader::createPartInstanceFromQuery<...>(...);

from "kdelibs/kdewebkit/kwebpluginfactory.cpp".
Comment 2 Chris 2010-03-31 10:18:16 UTC
Odd.. I'm pretty sure I selected Gentoo Package with Recent SVN or Snapshot Version (I used an ebuild that pulled kwebkitpart from KDE's SVN, built, and installed it using emerge). But either way, I unmerged it and reinstalled using a properly-built checkout. The rest of KDE was built using Gentoo's standard packages.

> Originally, handling of flash content was deffered to QtWebKit because using nspluginviewer under kdewebkit/qtwebkit resulted many random crashes and other nasty side effects.

I see. Thanks for the clarification.

I remember a similar problem in early 4.0, where flash with nspluginviewer would cause crashes with Konqueror/KHTML. The work-around was to use KMPlayer's Ice Ape plugin, which could load the flash plugin with knpplayer, and interact with the browser in place of nspluginviewer. I kept that set up since it more or less worked, and provided a nice Click-to-Play functionality (for some objects). I wonder if the same workaround would work for qt/kdewebkit.

I'll see if I can get emerge to apply a patch to kdelibs to remove those lines and see how well (or not) it works.
Comment 3 Dawit Alemayehu 2010-03-31 16:57:00 UTC
On Wednesday 31 March 2010 03:06:59 Dawit Alemayehu wrote:
> https://bugs.kde.org/show_bug.cgi?id=232736
> 
> 
> Dawit Alemayehu <adawit@kde.org> changed:
> 
>            What    |Removed                     |Added
> ---------------------------------------------------------------------------
> - CC|                            |adawit@kde.org
>           Component|general                     |kdewebkit
>             Product|kwebkitpart                 |kdelibs
> 
> 
> 
> 
> --- Comment #1 from Dawit Alemayehu <adawit kde org>  2010-03-31 09:06:57
> --- (In reply to comment #0)
> BTW, since you seem to have compiled KDE from source, you can easily change
> kdewebkit to use KDE's preferred viewer for flash content by simply
> commenting out the 2 lines below
> 
> if (!excludedMimeType(mimeType))
>     part = KMimeTypeTrader::createPartInstanceFromQuery<...>(...);
> 
> from "kdelibs/kdewebkit/kwebpluginfactory.cpp".

Oops, this is wrong. You should only comment out the if statement! 
Alternatively, you can simply change the excludedMimeType function to return 
false as follows:

static bool excludedMimeType(const QString &type)
{
# if 1
    return false;
#else
    // Let QtWebKit handle flash and java applets...
    return (type == QL1S("application/x-shockwave-flash") ||
            type == QL1S("application/futuresplash") ||
            type.startsWith(QL1S("application/x-java")));
#endif
}
Comment 4 Chris 2010-06-25 11:49:06 UTC
Well, I've been using a patch that commented out the
if (!excludedMimeType(mimeType))
check, and it's worked "fine" since 4.4.1 (with the problem you've described, that links in flash content don't work). However, since updating to 4.4.4, it doesn't work so well anymore.

With Adobe's flash plugin installed, Konqueror/WebKit will always try to use it over the association and regardless of the "Enable plugins globally" option, and regardless of the detected plugins (ie. even if there's nothing listed in the Plugins tab, it'll still load up the .so). This is compounded by the problem that the plugin will *always* crash in a gdk call.

Oddly, if I uninstall Adobe's flash plugin, it'll fall back to using the proper association again. If I then reinstall the plugin, it'll continue using the proper association until the browser restarts, when it'll try to use the plugin directly (again, regardless of whether plugins are enabled or if it's been detected).
Comment 5 Dawit Alemayehu 2012-05-05 05:54:46 UTC
Git commit 36b0aebb726890d915bba8e50dee52cb411e739b by Dawit Alemayehu.
Committed on 05/05/2012 at 00:18.
Pushed by adawit into branch 'master'.

Added an option, "DisableInternalPluginHandling", that allows the user to disable
the internal handling of flash and java applets.

Currently it lacks GUI configuration, but it can be activated by adding the
aforementioned option to the "General" section of $KDEHOME/share/config/kwebkitpartrc
and setting it to "true".
FIXED-IN: 4.9.0

M  +1    -1    CMakeLists.txt
M  +1    -0    src/CMakeLists.txt
M  +1    -0    src/kwebkitpart.cpp
M  +85   -0    src/kwebkitpart_ext.cpp
M  +28   -0    src/kwebkitpart_ext.h
M  +3    -0    src/webpage.cpp
A  +115  -0    src/webpluginfactory.cpp     [License: LGPL (v2.1+)]
A  +39   -0    src/webpluginfactory.h     [License: LGPL (v2.1+)]

http://commits.kde.org/kwebkitpart/36b0aebb726890d915bba8e50dee52cb411e739b