Closed Bug 1613292 Opened 4 years ago Closed 4 years ago

Web share impl is using a localized string for a web-visible exception

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

This is both a privacy leak and a compat risk.

Navigator::Share has this bit:

    nsAutoString message;
    nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
                                       "WebShareAPI_NeedOneMember", message);
    aRv.ThrowTypeError<MSG_MISSING_REQUIRED_DICTIONARY_MEMBER>(message);
    return nullptr;

There are two problems here:

  1. We should not be throwing localized strings to content as exceptions.
  2. This is misusing the MSG_MISSING_REQUIRED_DICTIONARY_MEMBER error, which expects a single argument: a description of the member. The string here is adding all sorts of other stuff, and will break badly if the MSG_MISSING_REQUIRED_DICTIONARY_MEMBER message is reworded.
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Component: DOM: CSS Object Model → DOM: Core & HTML
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/497d7a741b54
Stop throwing localized errors from web share code to web content. r=farre
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74
Has Regression Range: --- → yes
Keywords: regression
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: