Bug 65412 - beforeload event doesn't block the resource correctly: it reloads over and over
Summary: beforeload event doesn't block the resource correctly: it reloads over and over
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://movies.nytimes.com/2011/07/29/...
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-30 11:13 PDT by famlam
Modified: 2013-04-15 15:25 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description famlam 2011-07-30 11:13:52 PDT
Summary:
A beforeload event is fired over and over all the time when the resource is blocked

Steps to Reproduce:
1. install AdBlock (http://safariadblock.com/ or for Chrome https://chrome.google.com/webstore/detail/gighmmpiobklfepjocnamgkkbiglidom). Disable all filter lists except for EasyList in it's options page (accessible via the button on the toolbar)
2. visit http://movies.nytimes.com/2011/07/29/movies/cowboys-aliens-with-daniel-craig-review.html
3. open the developer tools (by choosing inspect element on the page). Go to the tab 'profiles' and run a CPU profile. Notice the function 'canload' (safari.self.tab.canLoad, directly called from the beforeload event) from the source code is  called over and over all the time (resulting in high CPU usage).
4. Insert a breakpoint in the injected script 'adblock_start.js' in the function beforeloadHandler (in the line 'var el = event.target'). Notice it's always the same resource (http://graphics8.nytimes.com/ads/images/misc/spacer.gif) being loaded.

Expected Results:
Blocking the resource does block the resource

Actual Results:
Blocking the resource results in the resource being reloaded

Happens in both Chrome and Safari.
Comment 1 famlam 2011-08-07 06:04:05 PDT
Another reproduction case:

enable the German filters of AdBlock and visit http://www.n-tv.de/
Comment 2 famlam 2011-08-30 08:58:44 PDT
Or enable the Chinese filters and go to
http://bbs.kafan.cn/forum-25-1.html
Comment 3 famlam 2011-09-17 12:35:28 PDT
Please note we added a workaround. After 250 times we simply allow it and continue. So the page won't hang anymore. The bug still exists however.