Bug 186278

Summary: [WPE][GTK] Cannot download main resource for media files
Product: WebKit Reporter: Michael Catanzaro <mcatanzaro>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: REOPENED ---    
Severity: Normal CC: agomez, bugs-noreply, mcatanzaro, pnormand
Priority: P2    
Version: WebKit Nightly Build   
Hardware: PC   
OS: Linux   
See Also: https://bugs.webkit.org/show_bug.cgi?id=186276
https://bugzilla.gnome.org/show_bug.cgi?id=746737

Description Michael Catanzaro 2018-06-04 12:45:42 PDT
In Epiphany, visit either of these resources, then right click and "Save Page As":

Audio: https://upload.wikimedia.org/wikipedia/commons/9/90/Papalotla-sound.ogg

Video: https://upload.wikimedia.org/wikipedia/commons/3/35/Nerven_(1919).webm

Don't use "Save Video As" since that works fine. If you instead use "Save Page As" the browser will crash due to bug #186276. But with the patch from that bug to fix the crash, it still fails to download the media. I've been debugging a little bit:

 * In WebPage::getMainResourceDataOfFrame, frame->coreFrame()->loader().documentLoader() returns a valid DocumentLoader, but then loader->mainResourceData() returns nullptr. Bad. Turns out DoucmentLoader::m_mainResourceData is nullptr.
 * Why? Not sure, I haven't dived in deep enough. But it seems that webkitWebViewResourceLoadStarted (in WebKitWebView.cpp) gets called *three* times, instead of once, as I would expect. WebKitWebView assumes the first resource load is the main resource, which seems like it should be a safe assumption, but I'm going to guess that the real main resource is the third one (not sure). Looks like something weird is going on inside WebCore. Requires further investigation.
Comment 1 Michael Catanzaro 2018-06-04 12:54:38 PDT
BTW what Epiphany is doing here is (1) webkit_web_view_get_main_resource() then (2) webkit_web_resource_get_data().
Comment 2 Philippe Normand 2019-07-23 03:45:49 PDT
I can't reproduce this with Ephy TP 3.33.4-29-gf6bb1bce5 and I doubt it's related with GStreamer anyway.
Comment 3 Michael Catanzaro 2019-07-23 06:40:13 PDT
This one is fixed!
Comment 4 Michael Catanzaro 2020-03-22 10:23:25 PDT
Reopening. I closed this in error; it's not fixed after all. Since r243608, the files are now "successfully" downloaded instead of crashing the UI process, but they are one-byte files containing only a NULL byte.