Page redirects on startup if it contains an iframe "blocked" in hosts file

Bug #1136574 reported by Musee "lae" Ullah
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Midori Web Browser
Fix Released
Medium
Unassigned

Bug Description

I have a hosts file that redirect ad hosts and other tracking-related hosts to 0.0.0.0, like so:

0.0.0.0 ad.doubleclick.net

When Midori starts up, this causes a page to redirect to whatever URI fails to load and forgets the page it redirected from (so I've ended up with quite a few tabs on blocked hosts with no way to return to the URI that tab was supposed to contain).

So far I've noticed this happens on LinkedIn (http://www.linkedin.com/home), which contains an iframe of ad.doubleclick.net.

This is on:
Midori midori-0.4.8 ((null))
GTK+ 2.24.14 (2.24.15) Glib 2.34.3 (2.34.3)
WebKitGTK+ 1.10.2 (1.10.2) libsoup 2.40.3

Related branches

Revision history for this message
gue5t gue5t (gue5t) wrote :

I believe this is the same bug as <https://bugs.launchpad.net/midori/+bug/1070419>; I have the sites which caused that bug to manifest blocked in this fashion.

Changed in midori:
status: New → Confirmed
Revision history for this message
gue5t gue5t (gue5t) wrote :

I think I figured this out. This only happens when the ad loads in an iframe and is blocked in /etc/hosts, leading the frame to display an error page. I opened midori, attached gdb, and set a breakpoint on midori_view_display_error. Then I browsed to <http://www.handletheheat.com/2013/07/the-ultimate-guide-to-chocolate-chip-cookies.html>, with a /etc/hosts entry causing "dg.specificclick.net" to resolve to "0.0.0.0".

gdb showed midori_view_display_error called from webkit_web_view_load_error_cb, which makes sense. In both calls, the web_frame argument indicated the child frame for the ad, not the webview's main frame. Then, the code of midori_view_display_error calls midori_view_set_html, passing the web_frame along. But midori_view_set_html proceeds to, without considering whether it has a child frame or the main frame, run:

katze_item_set_uri (view->item, uri);
midori_tab_set_special (MIDORI_TAB (view), TRUE);

These should only be done if the errored frame is the webview's main frame. I'll reference this from a branch that fixes the bug, but it looks like a similar problem exists under wk2 with a less clear fix.

André Stösel (ivaldi)
Changed in midori:
status: Confirmed → Fix Committed
Cody Garver (codygarver)
Changed in midori:
milestone: none → 0.5.5-freeze
importance: Undecided → Medium
Cris Dywan (kalikiana)
Changed in midori:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.