Skip to content

[BUG] editor window bounds not being saved on Firefox #2391

@mga316

Description

@mga316

Hello,

there are two problems with the "Open editor from popup in a new window" setting.

addEventListener('resize', debounce(savePosition, 100));

In the above code, the event object is passed to savePosition for the wnd parameter and so it won't work as expected. I assume debounce(() => savePosition(), 100) was intended here.

The second problem is in savePosition itself:

if (wnd.state === 'normal') {

Firefox sometimes incorrectly reports the popup's state as maximized when it actually isn't and so then the window bounds aren't saved. The obvious "fix" would be to just remove that if-condition —at least on my end, the maximize button is greyed out and the popup can't be maximized anyway— but I understand it's there to work around the limitation mentioned in the comment.

Here are the steps to reproduce, although it only appears to happen sporadically. Unfortunately, when it does happen, all subsequent resize events keep reporting the window state as maximized.

Sequence of actions:

  1. Clear extension state
    chrome.storage.local.clear(() => chrome.extension.getBackgroundPage().location.reload())
  2. Open settings and enable 'Open editor from popup in a new window'
  3. Open a new tab, click the plus icon in VM to create a new script
  4. Resize the editor window

Problem:

Window bounds are not saved.

Expected result:

Window bounds are saved.

Devtools console contents:

N/A

Environment:

  • OS: Windows 10
  • Browser: Firefox 145.0, Firefox 115.17.0 ESR
  • Violentmonkey Version: BETA 2.31.2b
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions