electron / remote

Bridge JavaScript objects from the main process to the renderer process in Electron.
MIT License
372 stars 50 forks source link

remote.getCurrentWindow returns incomplete window object #132

Open Nantris opened 2 years ago

Nantris commented 2 years ago

Is this an inherent limitation? A design choice?

image

Through this we cannot access anything, like for instance to see if the window is set to remain alwaysOnTop.

Nantris commented 2 years ago

Thanks for your reply, but that's what we're already doing, and it does not work as remote used to work. Almost every property is missing. Where's alwaysOnTop? Where's everything else besides these five properties?

MarshallOfSound commented 2 years ago

remote works via custom getters and setters. The contextBridge API that is exposed to users does not support getters and setters.

Ref: https://github.com/electron/electron/blob/main/shell/renderer/api/electron_api_context_bridge.cc#L482-L487 Ref: https://github.com/electron/electron/blob/main/shell/renderer/api/electron_api_context_bridge.cc#L591-L592

Nantris commented 2 years ago

Very appreciative for the reply @MarshallOfSound. Bummer to not have access to all the old features of remote for debugging though; it made life so much easier when debugging certain issues.

I can't test this currently, but I don't suppose that we could transmit the entire BrowserWindow across contextBridge either, right?