Opened 6 years ago

Closed 5 years ago

#345 closed change (rejected)

[Chrome, Opera, Safari?] Replace blocked images and documents with minimal valid content.

Reported by: lewisje Assignee:
Priority: Unknown Milestone:
Module: Platform Keywords:
Cc: smultron45@…, trev Blocked By:
Blocking: Platform:
Ready: no Confidential: no
Tester: Verified working: no
Review URL(s):

Description

Background

This will reduce the incidence of "blocked by an extension" messages in the browser and error messages in the console and promote a cleaner layout in pages in which content is blocked but the corresponding elements are not hidden.

What to Change

For blocked images, instead of cancelling the request, redirect to the same 67-byte 1x1px transparent PNG that was used in the old developer versions of Adblock Plus that tested out the WebRequest API and is now used by AdBlock, ScriptSafe, and Ghostery:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==

For blocked (X)HTML documents, instead of cancelling the request, redirect to about:blank; this and the above action are what the old WebRequest developer versions of Adblock Plus did and what AdBlock for Chrome and Opera still does (I haven't checked whether it does this on Safari, but if so it would be nice to copy its approach).

Other Possibilities

Other possibilities include replacing blocked XHRs with "data:application/xml," and blocked stylesheets with "data:text/css," and blocked scripts with "data:application/javascript," (including the commas) but the primary effect will be to reduce errors in the console; although I have mentioned many more possibilities here, they aren't such a high priority: https://adblockplus.org/forum/viewtopic.php?t=18911

Future Developments

If it is possible to do something similar on other platforms (I've only investigated WebRequest, not nsIContentPolicy or anything on Safari, IE, or Android), this would be an improvement there too; also, if declarativeWebRequest becomes available in Chrome Stable, it might become more elegant to redirect to either a blank image or a blank document, because that API has built-in methods for such redirects.

Change History (5)

comment:1 Changed 6 years ago by mapx

  • Cc smultron45@… added

comment:2 Changed 6 years ago by trev

  • Cc trev added

The problem with redirecting via WebRequest API is the conflicts with other extensions - if two extensions decide to redirect and use different URLs for that (a likely scenario) then Chrome will show a scary error message. As things are now, Chrome has no proper way of resolving these conflicts.

IMHO we should rather invest some time into fixing the scenarios where collapsing blocked elements doesn't work.

comment:3 Changed 6 years ago by trev

Last edited 6 years ago by trev (previous) (diff)

comment:4 Changed 5 years ago by philll

@trev: So can we close this issue for now?

comment:5 Changed 5 years ago by trev

  • Resolution set to rejected
  • Status changed from new to closed

Yes, closing. If you have specific scenarios where we don't collapse blocked content - please file issues for them.

Note: See TracTickets for help on using tickets.