Nativefier: Popup windows in some websites (Gmail, Hangouts) are blank

Created on 12 Jul 2017  路  14Comments  路  Source: jiahaog/nativefier

Description

When Gmail spawns additional windows those windows appear blank. I assume others have created Gmail apps so I'm curious if there's a workaround.

Steps to Reproduce Issue

Create a Nativefier app of Gmail using the following command:
nativefier --name "Gmail" --electron-version 1.7.4 --internal-urls "mail.google.com.*" "mail.google.com" --counter
Spawn a secondary window in one of two ways:

  1. Receive a new mail notification, click on it, and a blank window appears.
  2. Click the "in new window" button within a message thread to pop out the thread into a new window, an a blank window appears.

Specifications

  • Version of Nativefier (run $ nativefier --version): v7.4.0
  • Version of Node.js (run $ node --version): v6.9.1
  • OS: macOS 10.12.5
  • Architecture x86
bug

Most helpful comment

Any updates or functioning workarounds for this issue? The Office365 Outlook web app is basically unusable due to this.

Thanks!

All 14 comments

Hm, indeed, verified. To future self or anyone working on this, --internal-urls isn't even needed, bug is reproducible with nativefier --name gmail mail.google.com

EDIT 2017-11-16 same problem in Hangouts, see original report at https://github.com/jiahaog/nativefier/issues/489 : in nativefier https://hangouts.google.com/ , open a chat and try to pop the chat out by pressing on the arrow as shown below. A blank popup will open.
image

Any progress on this? Running into the same issue here with our web-based mail app.

We have the option to open up any mail or object in a new window, but that window is somehow linked to the "main" browser tab, as it's fully aware of the new window, and the "main" browser tab can update content in it dynamically, close it, etc..

So I suspect it's failing on some data exchange between the main window, and the new one.

Has worked flawlessly in Chrome for a long time, so it's nothing new in terms of tech...

I'm seeing this on hangouts & office 365 outlook.
Using the steps @ronjouch mentioned for hangouts, I then opened up the developer tools and refreshed the blank popup. From what I can see;
The URL is; https://hangouts.google.com/webchat/frame3?zx=1521747535
There is an error in the console;
frame3?zx=1521747535:23 Uncaught TypeError: Cannot read property 'parent' of undefined
at init (frame3?zx=1521747535:23)
at onload (frame3?zx=1521747535:1)
init @ frame3?zx=1521747535:23
onload @ frame3?zx=1521747535:1

Looking into that a bit more, that JS is initiated by the <body> tag via <body onload="init()">
And the related code in init is;

var cb = window;
...
while (true) {
...
  if (cb == cb.parent) { // <--- cb is apparently undefined and throws the uncaught TypeError exception
...

I can use the console REPL to see that window.parent is actually valid and equal to window - so maybe this is a race condition where the <body onload="init()"> is executed before the window object is ready?

In office 365, it's a different error. It's trying to run this on window.onload inside the new window;
window.opener.popOutProjectionManager.projectionReady(self);
and popOutProjectionManager is undefined, so error. It looks like popOutProjectionManager's supposed to be set from the original window - but hard to debug that because it's in a world of minified JS.

+1 seeing the same things in outlook 365

With the latest nativefier I observe the following log message when Gmail attempts to open a popup but no content appears in the window:

Uncaught TypeError: Cannot read property 'js' of null at onLoad

...which is thrown by the first statement in this function:

function onLoad(){
  var jsFrame=window.opener.js
  if(jsFrame&&jsFrame._GM_ftcb){
    jsFrame._GM_ftcb(window)
    return
  }
  window.setTimeout(onLoad,200)
}

Using the inspector I can confirm that window.opener is null.

This appears to be a limitation of electron. Relevant issues:

Any updates or functioning workarounds for this issue? The Office365 Outlook web app is basically unusable due to this.

Thanks!

This workaround only works in electron@2, and broke in the electron@3
Maybe trouble with window.opener fixed at #15216, #15698, but I didn't have time to check.

Do I need to patch nativefier using Gvozd's patch and use electron 2 for this to work?

Anyone got a fix for this yet by any chance?

Been trying to get popout compose windows working with Gmail, but seems like it's just not possible.

@saulfautley I can鈥檛 check now in the complex
But it looks like it should work in [email protected] with nativeWindowOpen: true
At least there it turns out the correct window.opener

Please check and tell me if it works for you

@Gvozd could you explain to me how to check it with the new electron? Or have you tried it yourself yet? I lack the experience of building here from github, so I used a release build of natifier. Hope you can help.

@basvandenberg-github I didn't work with nativefier
Therefore, I can not say how it should be build, and how to check it

I checked in my working project facebook authorization in a clean [email protected] - it worked with `nativeWindowOpen: true ' and without the aforementioned workaround
Authorization through Google did not check, but I assume that it also now works

Thanks @Gvozd,

Is there anybody here that could and would like to try to make a build with the new electron?

Tried the following with nativefier 10.1.0, but still the Gmail pop-out native window is not working:

nativefier --name Gmail --counter --fast-quit --single-instance --browserwindow-options { "webPreferences": { "webviewTag": "true", "preload": "https://mail.google.com/Applications/Gmail.app/Contents/Resources/app/lib/preload.js.map", "nodeIntegration": "true", "nodeIntegrationInSubFrames": "true", "nativeWindowOpen": "true" } } --user-agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36 Edg/85.0.564.44 --internal-urls ^(https://mail.google.com/)|(https://www.google.com/accounts)|(https://accounts.google.com/) https://mail.google.com/ build

Was this page helpful?
0 / 5 - 0 ratings