Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remembersWindowFrame doesn't always work #148

Open
oscarmarcelo opened this issue May 12, 2020 · 2 comments
Open

remembersWindowFrame doesn't always work #148

oscarmarcelo opened this issue May 12, 2020 · 2 comments

Comments

@oscarmarcelo
Copy link

Description

Sometimes, when using executeJavaScript(), it breaks the plugin ability to remember BrowserWindow frame positions and dimensions.

I also found other other cases where this also happens, but using executeJavaScript() was the only case that I found a kind of pattern.

Pattern exploration

I didn't yet figured out the cause here, but it seems to be consistent. It happens always on the same executeJavaScript() calls. Some work fine, some don't, but the ones that don't work are always the same ones and happen every time they are called.

At first I thought that it was related to the content I was passing (and it might actually be, I'm not sure yet), but I tried lots of different kinds (functions with zero, one, and multiple arguments, arguments being numbers, strings, and JSON stringified objects)

Results

Once this happens, it affects all new BrowserWindow instances (of the same plugin, at least), until Sketch restarts. Additionally, when using Safari's Devtools, it won't close automatically when the affected BrowserWindow and all subsequent BrowserWindows close.

There are no visible console errors (neither via webview DevTools or via Sketch DevTools), which I assume that this is breaking internally. I also tried looking for something meaningful via macOS Console, but although I see some errors, I can't really pinpoint anything related to the plugin or this package.

@mathieudutour
Copy link
Member

Additionally, when using Safari's Devtools, it won't close automatically when the affected BrowserWindow and all subsequent BrowserWindows close.

That makes me think that there is a long-running script that isn't finished when closing the window - and so the instance isn't cleaned up, so never actually closed to remember its position.
Not sure why tho

@oscarmarcelo
Copy link
Author

oscarmarcelo commented May 12, 2020

@mathieudutour You mean on my side or on the package side? I'm not using fibers anywhere...

I'm planning on releasing the plugin next week. I'll notify you then, so you can test the case I have here.

For now I'm manually storing the window bounds in the plugin settings as a workaround. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants