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

delete window.open in electron does not restore original electron implementation #633

Open
3 tasks done
miroslavvojtus opened this issue Feb 27, 2020 · 1 comment
Open
3 tasks done

Comments

@miroslavvojtus
Copy link

miroslavvojtus commented Feb 27, 2020

Bug Report

Problem

What is expected to happen?

delete window.open will restore original window.open function on Electron platform or update documentation.

What does actually happen?

delete window.open removes any window.open implementaiton in Electron wrapper.

Information

The command to revert window.open replacement proposed in documentation does not work with Electron platform as there is no window.__proto__.open function in place.

Thus I had to fix it in another, maybe not valid, way.

document.addEventListener('deviceready', () => {
    if (cordova.platformId === "electron") {
        // working revert of InAppBrowser window.open function replacement
        window.open = cordova.require("cordova/modulemapper").getOriginalSymbol(window, 'window.open');
        // window.open("url","_blank", null) is of instance electron.BrowserWindow
    }
});

Command or Code

document.addEventListener('deviceready', () => {
    if (cordova.platformId === "electron") {
        // non-working revert of InAppBrowser window.open function replacement
        delete window.open;
        // window.open === undefined
    }
});

Environment, Platform, Device

Windows + Electron platform

Version information

All releavant on latest as of today:
Cordova CLI 9.0.1
cordova-electron 1.1.1
cordova-ios 5.1.1
cordova-plugin-inappbrowser 3.2.0

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@NiklasMerz
Copy link
Member

It is planned for the next version to remove that overwrite. See #600

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