4

In a content script injected by an extension in Gmail, behavior of window.open is inconsistent. The same code works sometimes, and fails other times.

The code looks similar to this:

var result = window.open(
data.url,
"test-auth",
"toolbar=no," + "location=no," + "status=no," + "menubar=no," + "scrollbars=yes," + "resizable=yes," + "width=600," + "height=800"
);
console.log(result);

When this code is run, one of these three things happens:
a) a new window is opened and a Window object is displayed in the console log
b) nothing happens in the UI and a JSWindowProxy object is displayed in the console log
c) the browser crashes

This is not affected by the popup blocker settings (I've tried to allow or block popups and/or tracking scripts, nothing changes).

The script above should have the same effect every time it is run (either open a new window, or possibly block it if the popup blocker logic requires that).

0.99.126.1-beta

Monterey (12)

  • Vlad replied to this.

    PetkoBossakov Can you post exact steps to reproduce from a new clean orion profile?

      9 months later

      This may be a related issue.

      I use Postman almost everyday and fetch access tokens using their Authentication tab which requires a redirect back to the Postman app after opening the default browser. The webpage that opens in the browser runs the following script:

            var url = 'postman://app/oauth2/callback'
            url += window.location.search || '';
            url += window.location.hash || '';
      
            window.open(url);

      However, nothing happens when this script runs... no errors in the console, and nothing else that I can tell. However, if I enable popups and then change the script to open the window in a popup, it works:

            var url = 'postman://app/oauth2/callback'
            url += window.location.search || '';
            url += window.location.hash || '';
      
            window.open(url, null, 'popup=true');

      My guess is that this issue happens with any native apps that you try to open using windows.open(url) (without the workaround that I mentioned above). I would expect it to work without specifying popup=true in the third parameter of the fuction.

      See windows.open on MDN for details.

        a month later

        @Vlad I'm having this issue when installing my extension inbox2notion.com

        When you try to login, the process goes smoothly but as @PetkoBossakov mentioned it's unsuccessful. After login, the extension should start to sync with your Notion account but it just doesn't appear to be logged in at all on the extension screen.

        If you try this same step in any Chromium browser on desktop it works well. And kiwi browser on android as well.

        Here's the link to the extension

        https://chromewebstore.google.com/detail/inbox2notion/ojhacngljnekkhhhjblmfcenopaphpjg

        Would you be able to have a look at this to see if the issue @PetkoBossakov mentioned could be resolved?

        I'm trying to use this on iPad

        Thanks!

          10 days later

          @Vlad Thanks for reviewing and adding this to the planned list! Do you have any thoughts on when you could prioritize this? Also, do you have any suggestions on if we can work around this on our side in the meantime?

            3 months later

            @Vlad Just checking in, is there any way we can help move this forward? It's a blocker for getting our extension over to iPad users where I believe it would be very valuable. I'm sure it's impacting the ability to use other extensions too. Or if you have advice on if we can get around it somehow on our end let me know. Thanks!

              No one is typing