Opened on 04/27/2016 at 05:02:01 PM
Closed on 04/27/2016 at 06:19:10 PM
#3998 closed change (fixed)
cssProperties.js content script shouldn't assume that messaging will automatically know the context
Reported by: | trev | Assignee: | trev |
---|---|---|---|
Priority: | P3 | Milestone: | |
Module: | Core | Keywords: | |
Cc: | sebastian | Blocked By: | |
Blocking: | Platform: | Unknown / Cross platform | |
Ready: | yes | Confidential: | no |
Tester: | Unknown | Verified working: | no |
Review URL(s): |
Description (last modified by trev)
Background
As implemented right now, cssProperties.js content script will call ext.backgroundPage.sendMessage() in order to retrieve patterns to be applied. Information about the current window isn't being sent, the assumption is that the background page will know "automatically". This works well in Chrome where there is an instance of the content script in each window, so the context can be deduced from the sender. In Firefox we only run one instance of the content script per process however and have to resort to hacks in order to get the context.
What to change
Rather than use ext.backgroundPage.sendMessage() directly, have the CSSPropertyFilters accept a getFiltersFunc parameter. This should be a function that will retrieve the filters to be applied on the current page. On Chrome this will be a minimal wrapper around ext.backgroundPage.sendMessage(), on Firefox a function bound to the current window.
Integration notes
CSSPropertyFilters constructor has to be passed a new parameter, before addSelectorsFunc. It should be something like:
callback => { ext.backgroundPage.sendMessage( { type: "filters.get", what: "cssproperties" }, callback); }
A commit referencing this issue has landed:
https://hg.adblockplus.org/adblockpluscore/rev/d576e2dac412