<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [GTK] Provide frame-related load signals in WebKitWebView"
href="https://bugs.webkit.org/show_bug.cgi?id=157899#c10">Comment # 10</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [GTK] Provide frame-related load signals in WebKitWebView"
href="https://bugs.webkit.org/show_bug.cgi?id=157899">bug 157899</a>
from <span class="vcard"><a class="email" href="mailto:mcrha@redhat.com" title="Milan Crha <mcrha@redhat.com>"> <span class="fn">Milan Crha</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=157899#c9">comment #9</a>)
<span class="quote">> That's indeed not the right way to do it. The web extension should emit a
> signal when document loaded happens instead of relying on web view load
> events that have nothing to do with dom bindings.</span >
I am currently at commit 33e641672d5a84a0 of a webkit git master checkout, the `git log` says: "REGRESSION (r200638): -[DOMHTMLVideoElement play] disappeared from ObjC bindings" and at the end "git-svn-id: <a href="http://svn.webkit.org/repository/webkit/trunk@201212">http://svn.webkit.org/repository/webkit/trunk@201212</a> 268f45cc-cd09-0410-ab3c-d52691b4dbfc".
I modified evolution's code to check these things in a way that there is loaded a page with one iframe, (and the frame is a plain html), thus at the end the structure looks roughly like this:
<html>
<body>
<iframe src="..."></iframe>
</body>
</html>
and the load of the iframe content is done asynchronously, where I added a 5 seconds delay to make things easier. The result of my debug prints is:
web_view_load_changed_cb: 42305544881 started (pid:19619)
web_page_document_loaded_cb: 42305558657 (pid:19653)
> mail_request_process_mail_sync: 42305561698 waiting for 5 seconds (pid:19619)
> mail_request_process_mail_sync: 42310561790 done wait for 5 seconds (pid:19619)
web_view_load_changed_cb: 42310582854 finished (pid:19619)
where the very long number is a result of g_get_monotonic_time () (in microseconds) and the pid 19653 is my web-extension (WebProcess), while the pid 19619 is the evolution itself (UI process).
It shows that the web page's document-loaded signal (caught by web_page_document_loaded_cb) doesn't count with sub-frames and claims the page being loaded as soon as the main frame is populated.
Your proposal to add WebKitFrame::document-loaded signal doesn't scale, because:
a) I cannot connect to one central place, but should connect to the WebKitFrame instances;
b) How do I know that a frame instance had been created?
c) should I traverse the DOM several times to know whether a new frame had been added or not? That's quite inefficient and requires a complex code to maintain.
<span class="quote">> The UI process should wait for the document-loaded signal to allow the user
> click on that button, or send a message to the extension, and the extension
> should queue it until document-loaded happens.</span >
See the debug prints above, it would still not work, because the WebKitPage::document-loaded signal is called when the inner frame content is not ready yet.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>