On 11/5/26 11:43 AM, Paul wrote:
> On Thu, 11/5/2026 7:00 AM, T wrote:
>> On 11/4/26 11:25 PM, Paul wrote:
>>> In any case, there is no "3" in there. Doing that, relies
>>> on some behavior, a behavior I haven't seen handled in source.
>>> I don't know if there is a sanitizing code in there somewhere
>>> for this, or not.
>>>
>>> Paul
>>
>>
>> Hi Paul,
>>
>> According to my favorite SI, 3 is "unpublished".
>>
>> -T
>
> I downloaded the source, and looked for evidence of this.
>
> When the preference is used, it is not in fact being sanitized.
> The preference is not "coerced" internally for consumption.
> The behavior you got, is a "behavior via negligence",
> it's a fallthrough case which is not defined.
>
> ****************** ext-messageDisplay.js ****************
> /**
> * Check the users preference on opening new messages in tabs or windows.
> *
> * @returns {"tab"|"window"} - Either "tab" or "window".
> */
> function getDefaultMessageOpenLocation() {
> const pref = Services.prefs.getIntPref("mail.openMessageBehavior");
> return pref == MailConsts.OpenMessageBehavior.NEW_TAB ? "tab" : "window";
> }
>
> I think that's checking whether the value is exactly "2" or not.
> A value of "3" does not match, so it is going to use a window
> for the job. How, or whether, it is in "existing windows" mode,
> there is no function defined "near" that routine to set a boolean
> for the purpose.
>
> const MC.OpenMessageBehavior = {
> NEW_WINDOW: 0,
> EXISTING_WINDOW: 1,
> NEW_TAB: 2,
> };
>
> If we look at this
>
> *********************** MailUtils.sys.mjs **************************
>
> const behaviorEnum = lazy.MailConsts.OpenMessageBehavior;
> switch (openMessageBehavior) {
> case behaviorEnum.NEW_WINDOW:
> this.openMessagesInNewWindows(aMsgHdrs, aViewWrapperToClone);
> break;
> case behaviorEnum.EXISTING_WINDOW:
> // Try reusing an existing window. If we can't, fall back to opening
> // new windows.
> if (
> aMsgHdrs.length > 1 ||
> !this.openMessageInExistingWindow(aMsgHdrs[0])
> ) {
> this.openMessagesInNewWindows(aMsgHdrs, aViewWrapperToClone);
> }
> break;
> case behaviorEnum.NEW_TAB:
> this.openMessageInNewTab(
> aMsgHdrs,
> aViewWrapperToClone,
> aTabmail,
> shiftPressed,
> forceTab
> );
> break;
> }
> },
>
> it has no Default selection. A value of 3 will cause it
> to not open the message at all. It's not marked as such.
> Neither do the test routines, check a value outside the
> ENUM set, to determine whether "do nothing" is what happened.
>
> There is no sanitizing, and this is "expected behavior" when it
> comes to about:config. The rule is "you break it, you bought it"
> with about:config. If you enter an illegal value manually (the
> tool would not do this when you use an actual Preferences dialog),
> then we cannot predict what would happen.
>
> In this case, no variant of "this.openMessage" is involved
> when the value is set to 3 (by a mischievous user and about:config).
>
> So in fact, there is no sanitizing of the setting at all.
> it does not return to the (default) value of 2, when the
> value is out of range. Instead, the behavior is one of
> a "no match with respect to ENUM set" and it doesn't
> do anything.
>
> I determined this, by downloading the source tarball, unpacking
> it, and I used Agent Ransack content-search capability, to
> see how many "test routines" versus "actual code" were involved.
> Agent Ransack is significantly faster on the second search.
> The first search (which might be loading everything into
> the read cache), is pretty damn slow.
>
> Paul
Have you thought of trying it out on your own computer
to see what happens?