[Webkit-unassigned] [Bug 119654] New: [Qt] Avoid calling QWebPage's virtual functions during deletion of QWebPage
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sat Aug 10 07:37:07 PDT 2013
https://bugs.webkit.org/show_bug.cgi?id=119654
Summary: [Qt] Avoid calling QWebPage's virtual functions during
deletion of QWebPage
Product: WebKit
Version: 528+ (Nightly build)
Platform: All
OS/Version: All
Status: UNCONFIRMED
Severity: Critical
Priority: P2
Component: WebKit Qt
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: arurajku at cisco.com
CC: allan.jensen at digia.com, hausmann at webkit.org,
jocelyn.turcotte at digia.com, noam at webkit.org,
ararunprasad at gmail.com
What is the problem ?
--------------------
class UnLoadTestPage : public QWebPage
{
Q_OBJECT
public:
virtual void javaScriptAlert(QWebFrame *originatingFrame, const QString& msg)
{
qDebug()<<"alert:"<<msg;
}
};
UnLoadTestPage* tstPage = new UnLoadTestPage();
tstPage->mainFrame()->evaluateJavaScript("window.onunload=function(){alert('hello');}");
delete tstPage;
In the above sample code my overriden javaScriptAlert(..) won't be called, because onunload event is fired from ~QWebPage during that time overriden UnLoadTestPage is already destroyed.
What is the solution?
---------------------
1. Provide C++ API to send "unload" event(as like Blackberry port's WebPage::prepareToDestroy, http://trac.webkit.org/browser/trunk/Source/WebKit/blackberry/Api/WebPage.h#L114), so it is the responsibility of the QtWebKit embedder to call this new C++ API in their destructors(or before deleting their QWebPage instance).
(ex: tstPage->prepareToDestroy)
2. Provide C++ API to delete any QWebPage instance, which will take care of sending "unload" event before destroying any QWebPage instance.
(ex: tstPage->deletePage(); or QWebPage::deletePage(tstPage); //static C++ API)
3. Provide both #1 & #2.
Any Side effects?
-----------------
No.Existing flow is unaffected, if embedder didn't call QWebPage::prepareToDestroy then unload event will be generated as like the current flow.
I prefer solution #3 and will upload the fix soon.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list