Bug 258367

Summary: tinymce html editor popup blocked
Product: [Frameworks and Libraries] kwebkitpart Reporter: kavol <kavol>
Component: generalAssignee: webkit-devel
Status: RESOLVED FIXED    
Severity: normal CC: adawit, jreznik, nucleo
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description kavol 2010-11-30 12:55:13 UTC
Version:           unspecified (using KDE 4.5.3) 
OS:                Linux

Using webkit part in Konqueror, opening the HTML source editor of TinyMCE does not work, I'm getting an error dialogue saying that the popup window was blocked.

This works without any problem with KHTML.

Reproducible: Always

Steps to Reproduce:
1. Open http://tinymce.moxiecode.com/examples/example_11.php in Konqueror
2. Choose View => View mode => WebKit
3. From TinyMCE toolbar choose the button labeled "HTML" (Edit HTML source)

Actual Results:  
empty (about:blank) window is opened

a dialogue saying "Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool." appears and you can't do anything with Konqueror until you click Ok in that dialogue

then you're back to the WYSIWIG editor page (with that about:blank window in the background)

Expected Results:  
TinyMCE's HTML source editor appears, you can edit the source then save (update) it or cancel the edit

This does not happen with every instance of TinyMCE - for example, I was unable to reproduce this bug with http://tinymce.moxiecode.com/examples/full.php
However, I report against webkit, as I think even if there is some problem with TinyMCE itself, the behaviour should be the same for WebKit and KHTML (and KHTML works in this case).
Comment 1 Jaroslav Reznik 2010-11-30 13:04:30 UTC
This debug output (for kvolny's 3rd step)

konqueror(6860)/kdecore (trader) KMimeTypeTrader::query: query for mimeType  "text/html" ,  "Application"  : returning  7  offers
konqueror(6860)/kdecore (trader) KMimeTypeTrader::query: query for mimeType  "text/html" ,  "KParts/ReadOnlyPart"  : returning  3  offers
konqueror(6860)/kdecore (KLibrary) findLibraryInternal: plugins should not have a 'lib' prefix: "libkhtmlpart.so"
konqueror(6860)/kdecore (KLibrary) findLibraryInternal: plugins should not have a 'lib' prefix: "libkhtmlpart.so"
konqueror(6860)/kdecore (KLibrary) kde4Factory: The library "/usr/lib64/kde4/libkhtmlpart.so" does not offer a qt_plugin_instance function.
konqueror(6860)/kparts KParts::Plugin::pluginInfos: found KParts Plugin :  "/usr/share/kde4/apps/khtml/kpartplugins/akregator_konqfeedicon.rc"
konqueror(6860)/kparts KParts::Plugin::pluginInfos: found KParts Plugin :  "/usr/share/kde4/apps/khtml/kpartplugins/autorefresh.rc"
konqueror(6860)/kparts KParts::Plugin::pluginInfos: found KParts Plugin :  "/usr/share/kde4/apps/khtml/kpartplugins/crashesplugin.rc"
konqueror(6860)/kparts KParts::Plugin::pluginInfos: found KParts Plugin :  "/usr/share/kde4/apps/khtml/kpartplugins/kget_plug_in.rc"
konqueror(6860)/kparts KParts::Plugin::pluginInfos: found KParts Plugin :  "/usr/share/kde4/apps/khtml/kpartplugins/khtmlkttsd.rc"
konqueror(6860)/kparts KParts::Plugin::pluginInfos: found KParts Plugin :  "/usr/share/kde4/apps/khtml/kpartplugins/khtmlsettingsplugin.rc"
konqueror(6860)/kparts KParts::Plugin::pluginInfos: found KParts Plugin :  "/usr/share/kde4/apps/khtml/kpartplugins/minitoolsplugin.rc"
konqueror(6860)/kparts KParts::Plugin::pluginInfos: found KParts Plugin :  "/usr/share/kde4/apps/khtml/kpartplugins/plugin_adblock.rc"
konqueror(6860)/kparts KParts::Plugin::pluginInfos: found KParts Plugin :  "/usr/share/kde4/apps/khtml/kpartplugins/plugin_babelfish.rc"
konqueror(6860)/kparts KParts::Plugin::pluginInfos: found KParts Plugin :  "/usr/share/kde4/apps/khtml/kpartplugins/plugin_domtreeviewer.rc"
konqueror(6860)/kparts KParts::Plugin::pluginInfos: found KParts Plugin :  "/usr/share/kde4/apps/khtml/kpartplugins/plugin_rellinks.rc"
konqueror(6860)/kparts KParts::Plugin::pluginInfos: found KParts Plugin :  "/usr/share/kde4/apps/khtml/kpartplugins/plugin_validators.rc"
konqueror(6860)/kparts KParts::Plugin::pluginInfos: found KParts Plugin :  "/usr/share/kde4/apps/khtml/kpartplugins/plugin_webarchiver.rc"
konqueror(6860)/kparts KParts::Plugin::pluginInfos: found KParts Plugin :  "/usr/share/kde4/apps/khtml/kpartplugins/uachangerplugin.rc"
konqueror(6860)/kparts KParts::Plugin::loadPlugins: load plugin  "konqfeedicon"   "akregatorkonqfeedicon"   ""
konqueror(6860)/kparts KParts::Plugin::loadPlugins: load plugin  "kget_browser_integration"   "kget_browser_integration"   ""
konqueror(6860)/kdecore (KLibrary) kde4Factory: The library "/usr/lib64/kde4/kget_browser_integration.so" does not offer a qt_plugin_instance function.
konqueror(6860)/kparts KParts::Plugin::loadPlugins: load plugin  "khtmlkttsdplugin"   "khtmlkttsdplugin"   ""
konqueror(6860)/kparts KParts::Plugin::loadPlugins: load plugin  "khtmlsettingsplugin"   "khtmlsettingsplugin"   ""
konqueror(6860)/kparts KParts::Plugin::loadPlugins: load plugin  "Minitools"   "minitoolsplugin"   ""
konqueror(6860)/kparts KParts::Plugin::loadPlugins: load plugin  "adblock"   "adblock"   ""
konqueror(6860)/kparts KParts::Plugin::loadPlugins: load plugin  "babelfish"   "babelfishplugin"   ""
konqueror(6860)/kparts KParts::Plugin::loadPlugins: load plugin  "webarchiver"   "webarchiverplugin"   ""
konqueror(6860)/kparts KParts::Plugin::loadPlugins: load plugin  "UserAgentChanger"   "uachangerplugin"   ""
konqueror(6860)/khtml (part) KHTMLPart::openUrl: KHTMLPart(0x2e5de50) opening KUrl("about:blank")
konqueror(6860)/kio (Scheduler) KIO::SchedulerPrivate::doJob: KIO::SimpleJob(0x280a700)
konqueror(6860) WebPage::createWindow: Got a null or non kwebkitpart KHTMLPart(0x2e5de50) 
konqueror(6860)/khtml (html) DOM::HTMLDocumentImpl::changeModes:  using compatibility parseMode
konqueror(6860)/kio (KIOJob) KIO::TransferJob::slotFinished: KUrl("about:blank")

1. it tries to open about:blank, not http://tinymce.moxiecode.com/js/tinymce/jscripts/tiny_mce/themes/advanced/source_editor.htm as KHTML  KPart does (correct one)
2. it tries to use non kwebkitpart
Comment 2 Jaroslav Reznik 2010-11-30 13:12:19 UTC
It DOES work when kwebkitpart is default one for text/html mimetype ==> more generic bug probably - new windows should be opened by same kpart as parent window kpart to avoid "WebPage::createWindow: Got a null or non kwebkitpart KHTMLPart".
Comment 3 nucleo 2010-11-30 16:15:00 UTC
Note that fix from similar bug
https://bugs.kde.org/show_bug.cgi?id=253708
not fixes tinymce site problem.
Comment 4 Dawit Alemayehu 2010-11-30 21:35:41 UTC
The only difference between this bug and br# 253708 is the fact that in this bug the request for showing the url in a new window comes from a link that uses "javascript:" url.

Unfortunately, unlike the workaround provided for 253708, this issue cannot be worked around at this level mainly because it is not exactly a kwebkitpart bug. Because QtWebKit expects an instance of a QWebPage when creating new windows and does not provide a means of accessing the the user for a create new window request that originated programatically, i.e javascript window.open, there is no easy workaround for this issue.

The easiest way to address this bug would be to change how the BrowserHost, namely Konqueror, handles createNewWindow request for such cases. That is when the steps outlined in this bug report are performed, the new window created should use kwebkitpart even when the default rendering engine is khtml. The same holds true if kwebkitpart is the default rendering engine...
Comment 5 Dawit Alemayehu 2010-12-11 05:51:44 UTC
SVN commit 1205386 by adawit:

- Redid the implementation of QWebPage::createWindow yet again. Hopefully for the last time.
- Added a fake QWebPage implementation to properly handle creation of new Windows through
  javascript whenever the returned KPart is a non kwebkitpart.
- Added slot to handle all the *VisibilityChangeRequested(bool) signals from QWebPage.
- Added slot to handle the printRequested signal from QWebPage.
- Moved three slots from WebPage to KWebKitPartPrivate.

BUG:258367


 M  +1 -0      CMakeLists.txt  
 A             fakepage.cpp   [License: LGPL (v2+)]
 A             fakepage.h   [License: LGPL (v2+)]
 M  +82 -11    kwebkitpart_p.cpp  
 M  +4 -0      kwebkitpart_p.h  
 M  +52 -31    webpage.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1205386
Comment 6 Dawit Alemayehu 2010-12-11 05:53:24 UTC
Note that these changes fix bug 258367 by themselves. However, as I stated in comment #4 changes are still required in Konqueror in order the address the issue correctly. The user reasonably expects the last rendering engine they explicitly selected to still be used if a new page is created through some action they take. That too is being addressed in Konqueror by dfaure. See the following commit http://websvn.kde.org/?view=revision&revision=1204922.
Comment 7 nucleo 2010-12-11 10:55:29 UTC
(In reply to comment #6)
> WebSVN link: http://websvn.kde.org/?view=rev&revision=1205386
Is this fix can be backported to kwebkitpart-stable?
And fix from bug 253708?
> WebSVN link: http://websvn.kde.org/?view=rev&revision=1202466
Comment 8 Dawit Alemayehu 2010-12-12 03:12:46 UTC
SVN commit 1205667 by adawit:

- Yet more createWindow related changes. Guess spoke too soon on previous commit.
  This implementation is a robust generic fix that handles all window creation
  requests from the browsing engine, i.e. QWebPage::createWindow. 

  Besides dealing with previous bugs such as 253708 and 258367 more appropriately, 
  it also prevents the duplicate creation of a new window if another one with the 
  same name already exists.

CCBUG:253708
CCBUG:258367


 M  +0 -1      CMakeLists.txt  
 D             fakepage.cpp  
 D             fakepage.h  
 M  +171 -127  webpage.cpp  
 M  +36 -0     webpage.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1205667