Bug 1658017 Comment 3 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

I had a look at this using devtool's `Event Listener Breakpoints` on `mouse > contextmenu`.

Maybe Geoff knows more.

Adding conditional e.preventDefault() seems to fix it in a symptomatic way, but it's definitely not the right fix as it exploits the current faulty design. So this is just a pointer.

https://searchfox.org/comm-central/rev/f045b834713cbfb08b4fcc22f1923f93211ebce4/mozilla/toolkit/content/editMenuOverlay.js#106-108

```
  console.trace();
  console.dir(needsContextMenu);

  if (!needsContextMenu) {
    if (needsContextMenu === false) {
      e.preventDefault();
    }
    return;
  }
```

Observations:

- A single right click on account settings background runs this code twice, with different values for `needsContextMenu` (first `null`, then `false`). That looks wrong in several ways:
  - Why twice?
  - Different returns for same click?
  - needsContextMenu should be boolean, not null.

console.trace() editMenuOverlay.js:106:11
    <anonymous> chrome://global/content/editMenuOverlay.js:106
    (Async: EventListener.handleEvent)
    <anonymous> chrome://global/content/editMenuOverlay.js:96
**null** editMenuOverlay.js:107:11

console.trace() editMenuOverlay.js:106:11
    <anonymous> chrome://global/content/editMenuOverlay.js:106
**false** editMenuOverlay.js:107:11

- Unconditional e.preventDefault() will kill the accounts right-click, but also kills right-clicks on messages in 3-pane. :-/
- right-click on message in message list hits this code only once, with needsContextMenu === **null**.
- So the above pseudo-fix exploits the difference between accounts and other right clicks by checking for *false* of accounts case and canceling the event. Again, clearly not the right fix (also not tested for other side effects).
I had a look at this using devtool's `Event Listener Breakpoints` on `mouse > contextmenu`.

Maybe Geoff knows more.

Adding conditional e.preventDefault() seems to fix it in a symptomatic way, but it's definitely not the right fix as it exploits the current faulty design. So this is just a pointer.

https://searchfox.org/comm-central/rev/f045b834713cbfb08b4fcc22f1923f93211ebce4/mozilla/toolkit/content/editMenuOverlay.js#106-108

```
  console.trace();
  console.dir(needsContextMenu);

  if (!needsContextMenu) {
    if (needsContextMenu === false) {
      e.preventDefault();
    }
    return;
  }
```

Observations:

- A single right click on account settings background runs this code twice, with different values for `needsContextMenu` (first `null`, then `false`). That looks wrong in several ways:
  - Why twice?
  - Different returns for same click?
  - needsContextMenu should be boolean, not null.

console.trace() editMenuOverlay.js:106:11
    <anonymous> chrome://global/content/editMenuOverlay.js:106
    (Async: EventListener.handleEvent)
    <anonymous> chrome://global/content/editMenuOverlay.js:96
**null** editMenuOverlay.js:107:11

console.trace() editMenuOverlay.js:106:11
    <anonymous> chrome://global/content/editMenuOverlay.js:106
**false** editMenuOverlay.js:107:11

- Unconditional e.preventDefault() will kill the undesired accounts right-click, but also kills right-clicks on messages in 3-pane. :-/
- right-click on message in message list hits this code only once, with needsContextMenu === **null**.
- So the above pseudo-fix exploits the difference between accounts and other right clicks by checking for *false* of accounts case and canceling the event. Again, clearly not the right fix (also not tested for other side effects).
I had a look at this using devtool's `Event Listener Breakpoints` on `mouse > contextmenu`.

Maybe Geoff knows more.

Adding conditional e.preventDefault() seems to fix it in a symptomatic way, but it's definitely not the right fix as it exploits the current faulty design. So this is just a pointer.

~https://searchfox.org/comm-central/rev/f045b834713cbfb08b4fcc22f1923f93211ebce4/mozilla/toolkit/content/editMenuOverlay.js#106-108~
EDIT: https://searchfox.org/mozilla-central/rev/e07d5eb5646b40b10df3164e315d4a3108cf9101/toolkit/content/editMenuOverlay.js#106-108

```
  console.trace();
  console.dir(needsContextMenu);

  if (!needsContextMenu) {
    if (needsContextMenu === false) {
      e.preventDefault();
    }
    return;
  }
```

Observations:

- A single right click on account settings background runs this code twice, with different values for `needsContextMenu` (first `null`, then `false`). That looks wrong in several ways:
  - Why twice?
  - Different returns for same click?
  - needsContextMenu should be boolean, not null.

console.trace() editMenuOverlay.js:106:11
    <anonymous> chrome://global/content/editMenuOverlay.js:106
    (Async: EventListener.handleEvent)
    <anonymous> chrome://global/content/editMenuOverlay.js:96
**null** editMenuOverlay.js:107:11

console.trace() editMenuOverlay.js:106:11
    <anonymous> chrome://global/content/editMenuOverlay.js:106
**false** editMenuOverlay.js:107:11

- Unconditional e.preventDefault() will kill the undesired accounts right-click, but also kills right-clicks on messages in 3-pane. :-/
- right-click on message in message list hits this code only once, with needsContextMenu === **null**.
- So the above pseudo-fix exploits the difference between accounts and other right clicks by checking for *false* of accounts case and canceling the event. Again, clearly not the right fix (also not tested for other side effects).

Back to Bug 1658017 Comment 3