Opened 9 months ago

Closed 9 months ago

Last modified 5 months ago

#5695 closed change (fixed)

Check for extensionTypes.CSSOrigin to determine if user style sheets are supported

Reported by: mjethani Assignee: mjethani
Priority: P3 Milestone: Adblock-Plus-3.0-for-Firefox
Module: Platform Keywords:
Cc: sebastian, trev, kzar, Ross Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29545645/

Description (last modified by sebastian)

Background

Currently lib/cssInjection.js in adblockpluschrome calls the tabs.insertCSS API at least once and decides that user style sheets are not supported only if the function call fails accordingly.

A better approach is to check for CSSOrigin in extensionTypes, as this involves less (complicated) code, and avoids a first attempt to use insertCSS() on browsers that don't support cssOrigin.

What to change

In lib/cssInjection.js, check for "CSSOrigin" in chrome.extensionTypes to determine if user style sheets are supported. Remove try...catch from hideElements and make it just a function call; do not return any value. Make changes to the calling code in the same file accordingly.

Hints for testers

Same as #5090, also see comment 24 and 25.

Change History (5)

comment:1 Changed 9 months ago by sebastian

  • Description modified (diff)
  • Priority changed from Unknown to P3
  • Ready set

comment:2 Changed 9 months ago by abpbot

A commit referencing this issue has landed:
Issue 5695 - Use tabs.insertCSS if extensionTypes.CSSOrigin exists

comment:3 Changed 9 months ago by mjethani

  • Milestone set to Adblock-Plus-for-Chrome-Opera-next
  • Resolution set to fixed
  • Review URL(s) modified (diff)
  • Status changed from new to closed

comment:4 Changed 5 months ago by abpbot

A commit referencing this issue has landed:
Issue 5695 - Use tabs.insertCSS if extensionTypes.CSSOrigin exists

comment:5 Changed 5 months ago by sebastian

  • Cc kzar Ross added

For reference, this change was included in Adblock Plus 3.0 for Firefox, and will be the only change included in Adblock Plus 1.13.5 for Chrome/Opera.

While the way we did feature detection as of Adblock Plus 1.13.4 causes user stylsheets already being used on Chrome >=66 (currently Canary), the way the feature detection was changed here, user stylesheets are only used on Firefox (due to the lack of chrome.extensionTypes on Chrome). While we eventually want to use user stylesheets on Chrome too, it currently causes pages to be rendered blank.

Last edited 5 months ago by sebastian (previous) (diff)
Note: See TracTickets for help on using tickets.