-
Notifications
You must be signed in to change notification settings - Fork 656
Description
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:
- Clear extension state
chrome.storage.local.clear(() => chrome.extension.getBackgroundPage().location.reload()) - Open settings and enable 'Open editor from popup in a new window'
- Open a new tab, click the plus icon in VM to create a new script
- 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
