Open Bug 1465995 Opened 6 years ago Updated 2 years ago

Implement ShowPageAction for declarativeContent API

Categories

(WebExtensions :: General, enhancement, P5)

59 Branch
enhancement

Tracking

(Not tracked)

Iteration:
65.1 - Nov 2

People

(Reporter: mconca, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 2 obsolete files)

Declarative action that shows the extension's page action when the corresponding conditions are met. This is meant to be compatible with Chrome's declarativeContent.ShowPageAction declarative action.
Priority: -- → P3
Product: Toolkit → WebExtensions
Assignee: nobody → rob
Status: NEW → ASSIGNED
Iteration: --- → 65.1 (Nov 2)

Require extension API functions that start with a capital to be called
with "new", since these look like constructors.

The internal API implementation is not called with "new", because the
resulting class instance would belong to a privileged context and be
inaccessible to (unprivileged) extension code anyway.
It is the responsibility of these "constructor" implementations to
create and return an object that is cloned into the extension contexts's
scope.

  • Move isShown call from handleLocationChange to updateButton.

  • Move tab / tabData at the top of updateButton into the
    requestAnimationFrame call to avoid potentially updating the page
    action with data from an inactive tab shortly after a tab switch.

  • Remove showMatches / hideMatches from TabContext, as they are
    not specific to tabs.

  • Remove unnecessary guard on browserPageAction assignment.

Depends on D25589

See the comment at the top of ext-declarativeContent.js for an overview.
This is an implementation of the rule registry and evaluation engine of
the declarativeContent API. It is kept simple for now, supporting only
URL-based conditions and showing page actions. The logic is designed to
support content-based conditions such as matching by CSS selectors. The
actual interaction with content is part of the next patch.

The next patches will add the following functionality:

  • Supporting content-based conditions (i.e. match by CSS selector).
  • More actions (SetIcon, IgnoreRules)

Potential future improvements:

  • The rule engine logic can be part of toolkit/, but is in browser/ for
    now to minimize the amount of changes. If the approach of this patch
    looks right, it may make sense to add a separate patch that performs
    the necessary refactoring of mobile code and move the implementation
    to toolkit/.

  • StartupCache is currently the primary storage for rules, and a
    runtime.onInstalled event is forged when the cache disappears,
    e.g. when an add-on is disabled and re-enabled.
    This artificial event could be removed if the rules are stored
    elsewhere besides StartupCache.

Depends on D25590

Priority: P3 → P1
Assignee: rob → nobody
Status: ASSIGNED → NEW
Priority: P1 → P3
Assignee: nobody → rob
Status: NEW → ASSIGNED
Priority: P3 → P5

The following patch is waiting for review from an inactive reviewer:

ID Title Author Reviewer Status
D25591 Bug 1465995 - Implement declarativeContent.ShowPageAction robwu rpl: Resigned from review
zombie: Resigned from review

:robwu, could you please find another reviewer or abandon the patch if it is no longer relevant?

For more information, please visit auto_nag documentation.

Flags: needinfo?(rob)
Attachment #9054844 - Attachment is obsolete: true
Attachment #9054846 - Attachment is obsolete: true
Assignee: rob → nobody
Status: ASSIGNED → NEW
Flags: needinfo?(rob)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: