dangling tab when clicking download link with target="_blank"

Bug #973646 reported by natano
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Midori Web Browser
Fix Released
Undecided
natano

Bug Description

when clicking on a download link with target="_blank" a new tab opens and the save dialog appears. after selecting a choice in the save dialog the (empty) tab is still there.

Revision history for this message
natano (natanoptacek) wrote :
Cris Dywan (kalikiana)
Changed in midori:
status: New → Confirmed
Revision history for this message
Cris Dywan (kalikiana) wrote :

You probably already know, but for the record: It's impossible to know beforehand if a URL is a website or a download. So if a link opens a new tab, it cannot be prevented in WebKit without indefinitely waiting for the full network response ie. freezing Midori or opening a tab after an unknown delay.

I appreciate your looking into it. It's slightly awkward that the view closes a tab (read: pulls itself out of the swamp) but the general idea is probably good. It'd be good to have a more specific check than "is_blank" to avoid closing unrelated tabs.

An idea that came up in IRC in relation to this patch is showing download options inside the tab, to sort of turn the flaw into a feature. I personally feel it doesn't satisfy as a solution.

Revision history for this message
natano (natanoptacek) wrote :

How could the tab be unrelated? Isn't the given view the view in which the download has been started?
Maybe the closing of the tab can be implemented with a signal, to get the code out there.

The attached patch does not change anything significant to the previous patch, but applies cleanly to the git tree.

Revision history for this message
Cris Dywan (kalikiana) wrote :

The code doesn't open the new view in the same function, so I assume you can't know with certainty what it contains and it could contain javascript-created content. The safe way might be to look at the data source and check it's literally empty.

Cris Dywan (kalikiana)
tags: added: review
Revision history for this message
natano (natanoptacek) wrote :
Revision history for this message
natano (natanoptacek) wrote :

The patch should addres the issues you have described in the previous posts.
Please let me know if the patch needs reworking.

Revision history for this message
Cris Dywan (kalikiana) wrote :

All g_assert here should be g_return_if_fail. It's better to have warnings than crash the browser if something's wrong.

The updated check on the data source looks good.

The refactoring of the function would be nice to keep separate if that's fine with you. Otherwise it's harder to see the key changes in the history later. The WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE should also be separate for the same reason, it's a small detail that would disappear in the whole.

Changed in midori:
assignee: nobody → natano (natanoptacek)
Revision history for this message
natano (natanoptacek) wrote :

Thank you for the review!

Revision history for this message
natano (natanoptacek) wrote :
Revision history for this message
natano (natanoptacek) wrote :
Revision history for this message
natano (natanoptacek) wrote :

The patches should apply in the order I have posted them.

Revision history for this message
Cris Dywan (kalikiana) wrote :

Very nice, thanks a lot. I noticed while committing the return FALSE in midori_browser_remove_tab_idle and changed it to G_SOURCE_REMOVE - the symbol is defined in Midori even with older GLib's and it makes the code more readable.

Changed in midori:
status: Confirmed → Fix Committed
tags: removed: review
Revision history for this message
natano (natanoptacek) wrote :

Ok, thank you for the pointer.

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.