apache / apache/cordova-plugin-inappbrowser

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

Open
#633 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.1k
Forks
2.2k
PR merge metrics
No merged PRs in 30d

Description

# 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

- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Start by tracing the Electron platform's window.open replacement and the cordova/modulemapper original-symbol lookup, then reproduce the documented delete window.open snippet on Electron. Done means the original Electron window.open implementation is restored reliably, or the documentation accurately describes the supported restoration method.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, javascript
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.