This fixes https://github.com/nativefier/nativefier/pull/1222#issuecomment-860913698 , where:
1. When it works (e.g. initial page load), CSS is slower to inject (you can see pages without injected CSS)
2. CSS isn't injected when navigating to a page
On both Windows & Linux, a `git revert 9a6c6f870d && npm run build` fixes the issue.
--
I'm still not 100% sure what went wrong, but I suspect that the new version of Electron may not be firing onHeadersReceived for the actual navigation events, and only its child requests. To counteract it, I'm now injecting at the navigation event as well. I was able to reproduce the issue and this does seem to fix it. Please let me know if it does for you as well..
Also I noticed some funkiness in your logs where we're trying to inject on font files. So I realized the method is probably not nearly as important as the content-type, so I've switched blacklist methods to blacklist content-types.
* Only add a new window handler to the main window
* Update app/src/components/mainWindow.ts
Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
```
Uncaught Exception:
TypeError: Cannot read property 'show' of undefined
at App.<anonymous> (/src/main.ts:177:18)
```
Seems like an oversight of the recent refactor.
* macOS: fix crash on activating main window (fix #1210)
* Eliminate need for global mainWindow, refactor widevine / non-widevine events (#1218)
Co-authored-by: Adam Weeden <adamweeden@gmail.com>
* Catch promise errors better
* Move subFunctions to bottom of createNewWindow
* Use parents when creating child BrowserWindow instances
* Some about:blank pages have an anchor (for some reason)
* Inject browserWindowOptions better
* Interim refactor to MainWindow object
* Split up the window functions/helpers/events some
* Further separate out window functions + tests
* Add a mock for unit testing functions that access electron
* Add unit tests for onWillPreventUnload
* Improve windowEvents tests
* Add the first test for windowHelpers
* Move WebRequest event handling to node
* insertCSS completely under test
* clearAppData completely under test
* Fix contextMenu require bug
* More tests + fixes
* Fix + add to createNewTab tests
* Convert createMainWindow back to func + work out gremlins
* Move setupWindow away from main since its shared
* Make sure contextMenu is handling promises
* Fix issues with fullscreen not working + menu refactor
* Run jest against app/dist so that we can hit app unit tests as well
* Requested PR changes
* Catch promise errors better
* Move subFunctions to bottom of createNewWindow
* Use parents when creating child BrowserWindow instances
* Some about:blank pages have an anchor (for some reason)
* Inject browserWindowOptions better
* Interim refactor to MainWindow object
* Split up the window functions/helpers/events some
* Further separate out window functions + tests
* Add a mock for unit testing functions that access electron
* Add unit tests for onWillPreventUnload
* Improve windowEvents tests
* Add the first test for windowHelpers
* Move WebRequest event handling to node
* insertCSS completely under test
* clearAppData completely under test
* Fix contextMenu require bug
* More tests + fixes
* Fix + add to createNewTab tests
* Convert createMainWindow back to func + work out gremlins
* Move setupWindow away from main since its shared
* Make sure contextMenu is handling promises
It contains a weird mix of stuff and hides valuable files from view at the root of the repo. Better to have:
- Docs at the root
- Rest of the github/release-related hodgepodge (screenshots, scripts) in hidden folder .github
Domain-ish URL test now also covers considering internal URLs with different sub-domains like
- `https://listen.tidal.com`
- `https://login.tidal.com`
Co-authored-by: Daniel Fuchs <dfuchs@multamedio.de>
Co-authored-by: Adam Weeden <adamweeden@gmail.com>
Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
This is a follow-up of https://github.com/nativefier/nativefier/pull/1162#discussion_r623766247
PR #1162 introduced a new `generateRandomSuffix` helper function,
used it for its needs (avoiding collisions of injected js/css).
But it also replaced existing appname normalizing logic with it,
introducing randomness in a place that used to be deterministic.
As a result, starting with dd6e15fb5 / v43.1.0, re-creating an app would cause
the app to use a different appName, thus a different appData folder, thus
losing user data including cookies.
This PR leaves the `--inject` fixes of #1176, but reverts the appName logic
to the pre-#1176 code.