Bug 113288 - [Gtk] calls of endPrinting early in UIProcess crashes webprocess
Summary: [Gtk] calls of endPrinting early in UIProcess crashes webprocess
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Printing (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-26 02:56 PDT by Alban Browaeys
Modified: 2017-08-21 13:37 PDT (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alban Browaeys 2013-03-26 02:56:55 PDT
UI process :
Source/WebKit2/UIProcess/WebPageProxy.cpp
WebPageProxy::printFrame calls WebPageProxy::endPrinting
as print is async and has not complete before end of WebPageProxy::printFrame where WebPageProxy::endPrinting happens thus cannot print
(it will be called in webkitPrintOperation finish do we really need to call it while initiating the print operation ?)

also there seems to  be no way to stop connected handlers via gtk printers enumeration from spawning after the webkit print operation is freed. 

Local fix: I ended up commented endPrinting call in WebPageProxy::printFrame.

This fix early endPrint, thus no more destroy of the print operation gtk unix before gtk enumeration printers complete 
(this fixes the segfault asgtkprint list_added_cb attached to  printer_list no more call WebKit::WebPrintOperationGtkUnix::enumeratePrintersFunction  
after the printer operation is destroyed. ) and print operation can reach the send job to printer step thus print happens.


WebProcess segfault of webkit enumerate handler after free of webkit print operation by UIProcess WebPageProxy printFrame sync call 
to endPrinting (message to the WebProcess):

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff451bec7 in gtk_print_settings_get (settings=0x0, key=0x7ffff47a82c1 "printer")
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/gtk+/gtk/gtkprintsettings.c:174
174	  return g_hash_table_lookup (settings->hash, key);
(gdb) bt
#0  0x00007ffff451bec7 in gtk_print_settings_get (settings=0x0, key=0x7ffff47a82c1 "printer")
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/gtk+/gtk/gtkprintsettings.c:174
#1  0x00007ffff451c35a in gtk_print_settings_get_printer (settings=0x0)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/gtk+/gtk/gtkprintsettings.c:528
#2  0x00007ffff5c30529 in WebKit::WebPrintOperationGtkUnix::enumeratePrintersFunction (printer=0x6674f0 [GtkPrinterCups], printOperation=
    0x7fff812a8420)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:61
#3  0x00007ffff46a2157 in list_added_cb (backend=0x118d650 [GtkPrintBackendCups], printer=0x6674f0 [GtkPrinterCups], printer_list=0x12b8e70)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/gtk+/gtk/gtkprinter.c:1129
#4  0x00007ffff295797d in g_cclosure_marshal_VOID__OBJECTv (closure=0x1484ba0, return_value=0x0, instance=0x118d650, args=0x7fffffffb848, 
    marshal_data=0x0, n_params=1, param_types=0x12b4bb0) at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/glib/gobject/gmarshal.c:1312
#5  0x00007ffff2952fa7 in _g_closure_invoke_va (closure=0x1484ba0, return_value=0x0, instance=0x118d650, args=0x7fffffffb848, n_params=1, 
    param_types=0x12b4bb0) at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/glib/gobject/gclosure.c:840
#6  0x00007ffff296eee2 in g_signal_emit_valist (instance=0x118d650, signal_id=303, detail=0, var_args=0x7fffffffb848)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/glib/gobject/gsignal.c:3234
#7  0x00007ffff297023d in g_signal_emit_by_name (instance=0x118d650, detailed_signal=0x7fff80a757e3 "printer-added")
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/glib/gobject/gsignal.c:3424
#8  0x00007fff80a6b1f2 in cups_request_printer_list_cb (cups_backend=0x118d650 [GtkPrintBackendCups], result=0x147a4a0, user_data=0x1483e40)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/gtk+/modules/printbackends/cups/gtkprintbackendcups.c:3099
#9  0x00007fff80a67c90 in cups_dispatch_watch_dispatch (source=0x14846d0, callback=0x7fff80a6aded <cups_request_printer_list_cb>, user_data=
    0x1483e40) at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/gtk+/modules/printbackends/cups/gtkprintbackendcups.c:1361
#10 0x00007ffff2645ad4 in g_main_dispatch (context=0x6459d0) at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/glib/glib/gmain.c:3054
#11 0x00007ffff264682b in g_main_context_dispatch (context=0x6459d0) at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/glib/glib/gmain.c:3630
#12 0x00007ffff2646a1d in g_main_context_iterate (context=0x6459d0, block=1, dispatch=1, self=0x697470)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/glib/glib/gmain.c:3701
#13 0x00007ffff2646e46 in g_main_loop_run (loop=0x6ea830) at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/glib/glib/gmain.c:3895
#14 0x00007ffff5bd89e4 in WebKit::WebProcessMainGtk (argc=2, argv=0x7fffffffbc98)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp:83
#15 0x00007ffff1624a55 in __libc_start_main (main=0x4008d0 <main(int, char**)>, argc=2, ubp_av=0x7fffffffbc98, init=<optimized out>, 
    fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffbc88) at libc-start.c:260
#16 0x0000000000400901 in _start ()


The free of the webkit print operation before the enumerate handler trigger:

#0  WebKit::WebPrintOperationGtkUnix::~WebPrintOperationGtkUnix (this=0x7f1ac34ef0b0, __in_chrg=<optimized out>)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:51
#1  0x00007f1b5668c586 in deref (this=<optimized out>)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WTF/wtf/RefCounted.h:202
#2  derefIfNotNull<WebKit::WebPrintOperationGtk> (ptr=<optimized out>)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WTF/wtf/PassRefPtr.h:53
#3  operator= (optr=0x0, this=0x7f1b3eed5d18) at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WTF/wtf/RefPtr.h:126
#4  WebKit::WebPage::endPrinting (this=0x7f1b3eed5800)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/WebProcess/WebPage/WebPage.cpp:3274
#5  0x00007f1b566b1fa2 in callMemberFunction<WebKit::WebPage, void (WebKit::WebPage::*)()> (function=<optimized out>, object=0x7f1b3eed5800)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/Platform/CoreIPC/HandleMessage.h:15
#6  handleMessage<Messages::WebPage::EndPrinting, WebKit::WebPage, void (WebKit::WebPage::*)()> (decoder=..., function=<optimized out>, object=
    0x7f1b3eed5800) at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/Platform/CoreIPC/HandleMessage.h:334
#7  WebKit::WebPage::didReceiveWebPageMessage (this=0x7f1b3eed5800, decoder=...) at DerivedSources/WebKit2/WebPageMessageReceiver.cpp:563
#8  0x00007f1b565050fb in CoreIPC::MessageReceiverMap::dispatchMessage (this=0x1ed9e08, connection=0x7f1b3eeb7d80, decoder=...)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.cpp:86
#9  0x00007f1b56696f56 in WebKit::WebProcess::didReceiveMessage (this=0x1ed9db0, connection=0x7f1b3eeb7d80, decoder=...)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/WebProcess/WebProcess.cpp:597
#10 0x00007f1b564ffbc0 in CoreIPC::Connection::dispatchMessage (this=0x7f1b3eeb7d80, incomingMessage=...)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/Platform/CoreIPC/Connection.cpp:780
#11 0x00007f1b565014d6 in CoreIPC::Connection::SyncMessageState::dispatchMessages (this=0x7f1b3eeabdd0, allowedConnection=0x7f1b3eeb7d80)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/Platform/CoreIPC/Connection.cpp:187
#12 0x00007f1b573ec5fc in operator() (this=<synthetic pointer>)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WTF/wtf/Functional.h:704
#13 WebCore::RunLoop::performWork (this=0x7f1b3eeafc98)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebCore/platform/RunLoop.cpp:106
#14 0x00007f1b57853fe9 in WebCore::RunLoop::queueWork (runLoop=<optimized out>)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebCore/platform/gtk/RunLoopGtk.cpp:104
#15 0x00007f1b5309722f in g_idle_dispatch (source=0x7f1af4001c50, callback=0x7f1b57853fe0 <WebCore::RunLoop::queueWork(WebCore::RunLoop*)>, 
    user_data=0x7f1b3eeafc98) at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/glib/glib/gmain.c:5205
#16 0x00007f1b53094ad4 in g_main_dispatch (context=0x1e569d0) at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/glib/glib/gmain.c:3054
#17 0x00007f1b5309582b in g_main_context_dispatch (context=0x1e569d0) at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/glib/glib/gmain.c:3630
#18 0x00007f1b53095a1d in g_main_context_iterate (context=0x1e569d0, block=1, dispatch=1, self=0x1ea8270)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/glib/glib/gmain.c:3701
---Type <return> to continue, or q <return> to quit---
#19 0x00007f1b53095e46 in g_main_loop_run (loop=0x1e85400) at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/glib/glib/gmain.c:3895
#20 0x00007f1b566279e4 in WebKit::WebProcessMainGtk (argc=2, argv=0x7fff289a72f8)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp:83
#21 0x00007f1b52073a55 in __libc_start_main (main=0x4008d0 <main(int, char**)>, argc=2, ubp_av=0x7fff289a72f8, init=<optimized out>, 
    fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff289a72e8) at libc-start.c:260
#22 0x0000000000400901 in _start ()
=> happens before the enumeration complete
 => printer_list->daata == this is destroyed before use

p *this
$11 = {<WebKit::WebPrintOperationGtk> = {<WTF::RefCounted<WebKit::WebPrintOperationGtk>> = {<WTF::RefCountedBase> = {m_refCount = 
    1}, <No data fields>}, _vptr.WebPrintOperationGtk = 0x7f1b57f5a650 <vtable for WebKit::WebPrintOperationGtkUnix+16>, m_webPage = 0x7f1b3eed5800, 
    m_printSettings = {m_ptr = 0x7f1acc015540 [GtkPrintSettings]}, m_pageSetup = {m_ptr = 0x2b9da30 [GtkPageSetup]}, m_printContext = 0x2a7ac60, 
    m_callbackID = 11, m_cairoContext = {m_ptr = 0x0}, m_xDPI = 1, m_yDPI = 1, m_printPagesIdleId = 0, m_numberOfPagesToPrint = 0, m_pagesToPrint = 
    0, m_pagePosition = 0, m_pageRanges = 0x0, m_pageRangesCount = 0, m_needsRotation = false, m_numberUp = 1, m_numberUpLayout = 0, m_pageSet = 0, 
    m_reverse = false, m_copies = 1, m_collateCopies = false, m_scale = 1}, m_printJob = 
/home/prahal/Projects/Devel/Gnome/jhbuild/gdb/debian/gdb/gdb/findvar.c:176: internal-error: extract_typed_address: type is not a pointer or reference
A problem internal to GDB has been detected,



epiphany UIProcess calling endPrint on the WebProcess


(gdb) b WebKit::WebPageProxy::printFrame
Breakpoint 1 at 0x7f0c55125f94: file /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/UIProcess/WebPageProxy.cpp, line 2709.
(gdb) b WebKit::WebPageProxy::endPrinting
Breakpoint 2 at 0x7f0c5512a37a: file /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/UIProcess/WebPageProxy.cpp, line 3999.
(gdb) c
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x00007f0c502281ad in poll () at ../sysdeps/unix/syscall-template.S:81
81	in ../sysdeps/unix/syscall-template.S
(gdb) info b
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   0x00007f0c55125f94 in WebKit::WebPageProxy::printFrame(unsigned long) 
                                                   at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/UIProcess/WebPageProxy.cpp:2709
2       breakpoint     keep y   0x00007f0c5512a37a in WebKit::WebPageProxy::endPrinting() 
                                                   at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/UIProcess/WebPageProxy.cpp:3999

Breakpoint 1, WebKit::WebPageProxy::printFrame (this=0x7f0c40715800, frameID=8)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/UIProcess/WebPageProxy.cpp:2709
2709	    m_isPerformingDOMPrintOperation = true;
(gdb) l
2704	}
2705	
2706	void WebPageProxy::printFrame(uint64_t frameID)
2707	{
2708	    ASSERT(!m_isPerformingDOMPrintOperation);
2709	    m_isPerformingDOMPrintOperation = true;
2710	
2711	    WebFrameProxy* frame = m_process->webFrame(frameID);
2712	    MESSAGE_CHECK(frame);
2713	
(gdb) n
2711	    WebFrameProxy* frame = m_process->webFrame(frameID);
(gdb) 
2712	    MESSAGE_CHECK(frame);
(gdb) 
2714	    m_uiClient.printFrame(this, frame);
(gdb) s
WebKit::WebUIClient::printFrame (this=0x7f0c40715988, page=0x7f0c40715800, frame=0x7f0c406b8a80)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/UIProcess/WebUIClient.cpp:386
386	    if (!m_client.printFrame)
(gdb) n
385	{
(gdb) 
386	    if (!m_client.printFrame)
(gdb) 
389	    m_client.printFrame(toAPI(page), toAPI(frame), m_client.clientInfo);
(gdb) l
384	void WebUIClient::printFrame(WebPageProxy* page, WebFrameProxy* frame)
385	{
386	    if (!m_client.printFrame)
387	        return;
388	
389	    m_client.printFrame(toAPI(page), toAPI(frame), m_client.clientInfo);
390	}
391	
392	bool WebUIClient::canRunModal() const
393	{
(gdb) s
printFrame (page=0x7f0c40715800, frame=0x7f0c406b8a80)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp:140
140	{
(gdb) bt
#0  printFrame (page=0x7f0c40715800, frame=0x7f0c406b8a80)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp:140
#1  0x00007f0c55126013 in WebKit::WebPageProxy::printFrame (this=0x7f0c40715800, frameID=8)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/UIProcess/WebPageProxy.cpp:2714
#2  0x00007f0c551f61b0 in callMemberFunction<WebKit::WebPageProxy, void (WebKit::WebPageProxy::*)(unsigned long), unsigned long> (
    function=<optimized out>, object=0x7f0c40715800, args=...)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/Platform/CoreIPC/HandleMessage.h:95
#3  handleMessage<Messages::WebPageProxy::PrintFrame, WebKit::WebPageProxy, void (WebKit::WebPageProxy::*)(unsigned long)> (replyEncoder=..., 
    function=<optimized out>, object=0x7f0c40715800, decoder=...)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/Platform/CoreIPC/HandleMessage.h:345
#4  WebKit::WebPageProxy::didReceiveSyncMessage (this=0x7f0c40715800, connection=<optimized out>, decoder=..., replyEncoder=...)
    at DerivedSources/WebKit2/WebPageProxyMessageReceiver.cpp:737
#5  0x00007f0c550533b7 in CoreIPC::MessageReceiverMap::dispatchSyncMessage (this=0x7f0c4070db80, connection=0x7f0c40710d80, decoder=..., 
    replyEncoder=...) at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.cpp:103
#6  0x00007f0c55163efb in WebKit::WebProcessProxy::didReceiveSyncMessage (this=0x7f0c4070db40, connection=0x7f0c40710d80, decoder=..., replyEncoder=
    ...) at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/UIProcess/WebProcessProxy.cpp:372
#7  0x00007f0c5504db0c in CoreIPC::Connection::dispatchSyncMessage (this=0x7f0c40710d80, decoder=...)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/Platform/CoreIPC/Connection.cpp:728
#8  0x00007f0c5504dc25 in CoreIPC::Connection::dispatchMessage (this=0x7f0c40710d80, incomingMessage=...)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/Platform/CoreIPC/Connection.cpp:778
#9  0x00007f0c5504f4d6 in CoreIPC::Connection::SyncMessageState::dispatchMessages (this=0x7f0c406bddd0, allowedConnection=0x7f0c40710d80)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/Platform/CoreIPC/Connection.cpp:187
#10 0x00007f0c55f3a4c3 in operator() (this=<synthetic pointer>)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WTF/wtf/Functional.h:704
#11 WebCore::RunLoop::performWork (this=0x7f0c406b7c30)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebCore/platform/RunLoop.cpp:91
#12 0x00007f0c563a1fe9 in WebCore::RunLoop::queueWork (runLoop=<optimized out>)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebCore/platform/gtk/RunLoopGtk.cpp:104
#13 0x00007f0c50d9922f in g_idle_dispatch (source=0x7f0bdc007260, callback=0x7f0c563a1fe0 <WebCore::RunLoop::queueWork(WebCore::RunLoop*)>, 
    user_data=0x7f0c406b7c30) at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/glib/glib/gmain.c:5205
#14 0x00007f0c50d96ad4 in g_main_dispatch (context=0x1930490) at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/glib/glib/gmain.c:3054
#15 0x00007f0c50d9782b in g_main_context_dispatch (context=0x1930490) at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/glib/glib/gmain.c:3630
#16 0x00007f0c50d97a1d in g_main_context_iterate (context=0x1930490, block=1, dispatch=1, self=0x19812d0)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/glib/glib/gmain.c:3701
---Type <return> to continue, or q <return> to quit---
#17 0x00007f0c50d97ae1 in g_main_context_iteration (context=0x1930490, may_block=1)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/glib/glib/gmain.c:3762
#18 0x00007f0c515cc052 in g_application_run (application=0x1aed050 [EphyShell], argc=1, argv=0x7fffd2077dc8)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/glib/gio/gapplication.c:1623
#19 0x00000000004339a6 in main (argc=1, argv=0x7fffd2077dc8) at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/epiphany/src/ephy-main.c:472
(gdb) l
135	{
136	    webkitWebViewMouseTargetChanged(WEBKIT_WEB_VIEW(clientInfo), toImpl(hitTestResult), wkEventModifiersToGdkModifiers(modifiers));
137	}
138	
139	static void printFrame(WKPageRef page, WKFrameRef frame, const void*)
140	{
141	    webkitWebViewPrintFrame(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()), toImpl(frame));
142	}
143	
144	static void runOpenPanel(WKPageRef page, WKFrameRef frame, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef listener, const void *clientInfo)
(gdb) s
141	    webkitWebViewPrintFrame(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()), toImpl(frame));
(gdb) 
webkit_web_view_get_type ()
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:194
194	WEBKIT_DEFINE_TYPE(WebKitWebView, webkit_web_view, WEBKIT_TYPE_WEB_VIEW_BASE)
(gdb) n
printFrame (page=0x7f0c40715800, frame=0x7f0c406b8a80)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/UIProcess/API/gtk/WebKitUIClient.cpp:142
142	}
(gdb) s
141	    webkitWebViewPrintFrame(WEBKIT_WEB_VIEW(toImpl(page)->viewWidget()), toImpl(frame));
(gdb) s
webkitWebViewPrintFrame (webView=0x292a640 [EphyWebView], frame=0x7f0c406b8a80)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:1579
1579	{
(gdb) l
1574	    priv->mouseTargetHitTestResult = adoptGRef(webkitHitTestResultCreate(hitTestResult));
1575	    g_signal_emit(webView, signals[MOUSE_TARGET_CHANGED], 0, priv->mouseTargetHitTestResult.get(), modifiers);
1576	}
1577	
1578	void webkitWebViewPrintFrame(WebKitWebView* webView, WebFrameProxy* frame)
1579	{
1580	    GRefPtr<WebKitPrintOperation> printOperation = adoptGRef(webkit_print_operation_new(webView));
1581	    gboolean returnValue;
1582	    g_signal_emit(webView, signals[PRINT], 0, printOperation.get(), &returnValue);
1583	    if (returnValue)
(gdb) n
1580	    GRefPtr<WebKitPrintOperation> printOperation = adoptGRef(webkit_print_operation_new(webView));
(gdb) 
1582	    g_signal_emit(webView, signals[PRINT], 0, printOperation.get(), &returnValue);
(gdb) l
1577	
1578	void webkitWebViewPrintFrame(WebKitWebView* webView, WebFrameProxy* frame)
1579	{
1580	    GRefPtr<WebKitPrintOperation> printOperation = adoptGRef(webkit_print_operation_new(webView));
1581	    gboolean returnValue;
1582	    g_signal_emit(webView, signals[PRINT], 0, printOperation.get(), &returnValue);
1583	    if (returnValue)
1584	        return;
1585	
1586	    WebKitPrintOperationResponse response = webkitPrintOperationRunDialogForFrame(printOperation.get(), 0, frame);
(gdb) l
1587	    if (response == WEBKIT_PRINT_OPERATION_RESPONSE_CANCEL)
1588	        return;
1589	    g_signal_connect(printOperation.leakRef(), "finished", G_CALLBACK(g_object_unref), 0);
1590	}
1591	
1592	static void mainResourceResponseChangedCallback(WebKitWebResource*, GParamSpec*, WebKitWebView* webView)
1593	{
1594	    webkitWebViewDisconnectMainResourceResponseChangedSignalHandler(webView);
1595	    webkitWebViewEmitDelayedLoadEvents(webView);
1596	}
(gdb) n
1580	    GRefPtr<WebKitPrintOperation> printOperation = adoptGRef(webkit_print_operation_new(webView));
(gdb) 
1582	    g_signal_emit(webView, signals[PRINT], 0, printOperation.get(), &returnValue);
(gdb) 
1583	    if (returnValue)
(gdb) 
1586	    WebKitPrintOperationResponse response = webkitPrintOperationRunDialogForFrame(printOperation.get(), 0, frame);
(gdb) 
[New Thread 0x7f0b98ff9700 (LWP 31868)]
1587	    if (response == WEBKIT_PRINT_OPERATION_RESPONSE_CANCEL)
(gdb) n
1589	    g_signal_connect(printOperation.leakRef(), "finished", G_CALLBACK(g_object_unref), 0);
(gdb) 
1590	}
(gdb) 
[Thread 0x7f0b98ff9700 (LWP 31868) exited]
WebKit::WebPageProxy::printFrame (this=0x7f0c40715800, frameID=8)
    at /home/prahal/Projects/Devel/Gnome/jhbuild/gnome/webkitgtk-1.11.92/Source/WebKit2/UIProcess/WebPageProxy.cpp:2716
2716	    endPrinting(); // Send a message synchronously while m_isPerformingDOMPrintOperation is still true.
(gdb) l
2711	    WebFrameProxy* frame = m_process->webFrame(frameID);
2712	    MESSAGE_CHECK(frame);
2713	
2714	    m_uiClient.printFrame(this, frame);
2715	
2716	    endPrinting(); // Send a message synchronously while m_isPerformingDOMPrintOperation is still true.
2717	    m_isPerformingDOMPrintOperation = false;
2718	}
2719	
2720	void WebPageProxy::printMainFrame()
(gdb) q
Comment 1 Alexey Proskuryakov 2013-03-26 11:32:09 PDT
> as print is async

I suspect that this assumption is the root cause of this bug. This code implements window.print() JavaScript API, which is synchronous.