Closed Bug 1910756 Opened 11 months ago Closed 11 months ago

"Share" entry in tab context menu doesn't get its "id" attribute

Categories

(Firefox :: Untriaged, defect)

Firefox 128
defect

Tracking

()

RESOLVED INVALID

People

(Reporter: vlakoff, Unassigned)

Details

Steps to reproduce:

I noticed the following issue when playing around to remove the "Share" entry in tab context menu, using "userChrome.css" customization.

See at https://searchfox.org/mozilla-central/rev/20d128ef2bcaff950172fe46eada6bc74673bd25/browser/base/content/browser.js#2841

let l10nID =
  menu.id == "tabContextMenu"
    ? "tab-context-share-url"
    : "menu-file-share-url";
document.l10n.setAttributes(shareURL, l10nID);

The 2nd argument (l10nID) passed to setAttributes() is a string, whereas it is expected to be a "name->value" object. Should probably be replaced with shareURL.setAttribute('id', l10nID).

Actual results:

"Share" entry in tab context menu doesn't have "id" attribute.

Expected results:

"Share" entry in tab context menu should have an "id" attribute, with value "tab-context-share-url".

On a related note, this "Share" entry can be more efficiently removed by using "about:config":

Create a new setting browser.menu.share_url.allow, with value false.

Refs https://searchfox.org/mozilla-central/rev/20d128ef2bcaff950172fe46eada6bc74673bd25/browser/base/content/browser.js#2805

Mmmm… such "tab-context-..." values are not for "id" attributes, but for "data-lazy-l10n-id" attributes.
See https://searchfox.org/mozilla-central/source/browser/base/content/main-popupset.inc.xhtml

It seems that passing a string as 2nd argument to document.l10n.setAttributes() is fine, although I didn't find the method definition.
Search for "setAttributes": https://searchfox.org/mozilla-central/search?q=symbol:%23setAttributes&redirect=false

I didn't understand the rationale of these "localized IDs", but I don't care much about this.

So, the code should be fine actually. And I'm happily using the available "about:config" setting.

Status: UNCONFIRMED → RESOLVED
Closed: 11 months ago
Resolution: --- → INVALID

(I figured out what these "data-lazy-l10n-id" are for. It's a mechanism for lazy-localizing elements.)

You need to log in before you can comment on or make changes to this bug.