Opened 2 years ago

Closed 4 months ago

Last modified 3 months ago

#3200 closed defect (fixed)

Element hiding not applied to page preloaded by Safari when typing URL

Reported by: arthur Assignee: mjethani
Priority: P2 Milestone: Adblock-Plus-for-Safari-next
Module: Platform Keywords:
Cc: mario, greiner, sebastian Blocked By:
Blocking: Platform: Safari
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29436567/

Description (last modified by greiner)

Environment

  • Safari 9.0 (10601.1.56.2)
  • OS X Yosemite 10.10.5
  • MacBook Pro
  • Adblock Plus 1.9.3
  • EasyList Germany+EasyList

How to reproduce

  1. Add the custom filter ##body
  2. Open a new tab and navigate to a website
  3. Repeat the previous step
  4. Reload the last tab

Observed behaviour

Page body hidden in step 2 and step 4 but visible in step 3.

Expected behaviour

Page body should be hidden in steps 2 to 4.

Notes for testing

Make sure to use a different site on each try because as soon as a URL is entered once it will be remembered even after browser restarts.

Background

Safari preloads previously visited URLs when it is chosen as the top result on typing into the addressbar. Those page loads are not affected by our extension. Disabling "Preload Top Hit in the background" in Safari's preferences should fix this issue but we need to work around that in the extension.

Change History (13)

comment:1 Changed 2 years ago by sebastian

  • Cc greiner sebastian added
  • Owner sebastian deleted

I talked to greiner. He will look into this.

comment:2 Changed 2 years ago by greiner

  • Summary changed from Element hiding broken in Safari 9 to Element hiding not applied when switching of Acceptable Ads in Safari 9

I tried to reproduce it with the following setup:

Mac OSX 10.11 Beta
Safari 9.0
Adblock Plus 1.9.3
EasyList Germany+EasyList

There was no indication to me that element hiding wasn't working. What I can imagine is that Safari is heavily caching pages (even after a browser restart) which would explain why reloading the tab resolves the issue.

comment:3 Changed 2 years ago by greiner

  • Description modified (diff)
  • Summary changed from Element hiding not applied when switching of Acceptable Ads in Safari 9 to Element hiding not applied to page preloaded by Safari when typing URL

The issue appears to be caused by Safari preloading the URL that it suggests when typing in the addressbar. A confirmed workaround for this is unchecking "Preload Top Hit in the background" in the Safari preferences.

I updated the ticket accordingly.

comment:4 Changed 2 years ago by greiner

  • Component changed from Unknown to Platform

comment:5 Changed 2 years ago by sebastian

I still wonder why that is. Note that we already address preloaded tabs, by relying on content scripts rather than using the Windows and Tabs API on Safari. Might it be that there is a bug in Safari 9 that content scripts don't run in preloaded tabs anymore? OTherwise, could you spot any JavaScript error in the global page or content script?

comment:6 Changed 2 years ago by arthur

It seems this also causes the "Block element" menu to disappear.

comment:7 Changed 2 years ago by greiner

  • Description modified (diff)

comment:8 Changed 2 years ago by sebastian

  • Priority changed from Unknown to P2
  • Ready set

comment:9 Changed 7 months ago by mjethani

  • Owner set to mjethani

comment:10 Changed 7 months ago by mjethani

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:11 Changed 4 months ago by abpbot

A commit referencing this issue has landed:
Issue 3200 - Delay initialization for prerendered documents

comment:12 Changed 4 months ago by mjethani

  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:13 Changed 3 months ago by sebastian

  • Milestone set to Adblock-Plus-for-Safari-next
Note: See TracTickets for help on using tickets.