obtainDeclaredWindow with useDefaultSizeAndLocation true returns an error when creating a window

Issue Description:
Calling obtainDeclaredWindow with useDefaultSizeAndLocation set to true returns an error when creating a window.

I.e. on the first call when the window has not been created yet.

If useDefaultSizeAndLocation is set to false or omitted there is no error and the WindowResult is returned properly.

image


Use case:
I have a bug where the desktop window I am trying to open is starting with a size smaller than what is specified in the manifest before becoming the correct size after a few seconds.

This happens when the window was previously hidden and the app was closed. Then on the next app launch when the window is created, it will start with a smaller size (197x47 the hidden window size) than what is specified in the manifest.

Calling obtainDeclaredWindow with the useDefaultSizeAndLocation parameter set to true will create a window with the correct size specified in the manifest on launch but gives the above error.

The window settings in the manifest.json is below.

    "in_game_secondary": {
        "file": "index.html",
        "native_window": true,
        "transparent": true,
        "resizable": false,
        "grab_focus_on_desktop": false,
        "size": {
          "width": 424,
          "height": 642
        },
        "desktop_only": true,
        "use_os_windowing": true,
        "block_top_window_navigation": true,
        "mute": true,
        "popup_blocker": true,
        "allow_local_file_access": true,
        "is_alt_f4_blocked": true,
        "disable_hardware_acceleration": true
      },

After the window is created, I need to use the size of the window to position it, but since the window is not the correct size the window will be place in the incorrect location.


Can you reproduce it (exact steps to reproduce):
In the console, call obtainDeclaredWindow like in the first screenshot on a window that was not previously created.

Impact for my app: [e.g. x% of the users complained about it, it’s a show-stopper]
mid

Do you currently have a workaround?
Call obtainDeclaredWindow with useDefaultSizeAndLocation set to true and ignore the first error.

Hi!
We’ll take a look at this on sunday and keep you updated.
Thank you for the detailed report!