Closed Bug 1427306 Opened 6 years ago Closed 6 years ago

Allow to check browser/page/sidebar action value existence

Categories

(WebExtensions :: Frontend, enhancement, P5)

enhancement

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: Oriol, Unassigned)

Details

(Whiteboard: [design-decision-denied])

The browser/page/sidebar action APIs allow to do the following:
 - Set a tab-specific value, or a global value that will be used in tabs without a specific value
 - Since bug 1419940 and bug 1424538, unset a tab-specific or global value
 - Get tab-specific or global values

I think there is a basic functionality that is missing: check whether a tab-specific or global value has been defined. This can't be known just by getting the value, because if it doesn't exist you will get the inherited value.

So I propose adding an `inherit` property to the `details` parameter of all get* methods. It would be optional and default to `true`, which would be the current behavior. When set to false, the returned promise would resolve to `null` if there was no value.

For example, in an extension with

  "browser_action": {
    "default_title": "default"
  },

you could run this code:

  await browser.browserAction.getTitle({inherit: false}); // null
  await browser.browserAction.getTitle({inherit: true}); // "default"
  await browser.browserAction.getTitle({tabId, inherit: false}); // null
  await browser.browserAction.getTitle({tabId, inherit: true}); // "default"

  browser.browserAction.setTitle({title: "global"});

  await browser.browserAction.getTitle({inherit: false}); // "global"
  await browser.browserAction.getTitle({inherit: true}); // "global"
  await browser.browserAction.getTitle({tabId, inherit: false}); // null
  await browser.browserAction.getTitle({tabId, inherit: true}); // "global"

  browser.browserAction.setTitle({tabId, title: "tab"});

  await browser.browserAction.getTitle({inherit: false}); // "global"
  await browser.browserAction.getTitle({inherit: true}); // "global"
  await browser.browserAction.getTitle({tabId, inherit: false}); // "tab"
  await browser.browserAction.getTitle({tabId, inherit: true}); // "tab"
Priority: -- → P5
Hi Oriol, this has been added to the agenda for the January 16, 2018 WebExtensions APIs triage meeting. Would you be able to join us? 

Here’s a quick overview of what to expect at the triage: 

* We normally spend 5 minutes per bug
* The more information in the bug, the better
* The goal of the triage is to give a general thumbs up or thumbs down on a proposal; we won't be going deep into implementation details

Relevant Links: 

* Wiki for the meeting: https://wiki.mozilla.org/WebExtensions/Triage#Next_Meeting
* Meeting agenda: https://docs.google.com/document/d/13AiUqFgtLsuJ17QjzUOQ7nBN1U_ZEO0yzMaHLLl0JKk/edit#
* Vision doc for WebExtensions: https://wiki.mozilla.org/WebExtensions/Vision
Whiteboard: [design-decision-needed] → [design-decision-denied]
Closing all open bugs with the [design-decision-denied] whiteboard flag.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.