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

App open event broken: fires only once, passed arguments are jumbled up #7991

Open
2 of 3 tasks
bastimeyer opened this issue Nov 1, 2022 · 2 comments
Open
2 of 3 tasks
Labels

Comments

@bastimeyer
Copy link

Issue Type

  • Bug Report
  • Feature Request
  • Successfully reproduced against the latest version of NW.js?

Current/Missing Behavior

Two issues in regards to the App open event, on both NW1 and NW2:

  1. The event does only trigger once.
    This was apparently fixed multiple times, last time in BUG: Event 'open' stop works after once triggered #7969 and prior to that in Event 'open' on app is triggered once #7860.
    0.67 was the last version where the event fired more than once.

  2. The first argument of the event's callback (aka. the passed argument string) is completely messed up and its content jumbled.

    It not only mixes the passed command line with those set in the manifest's chromium-args field, but it also adds NW.js and Chromium specific ones, like --nwapp=..., --no-sandbox, or --user-data-dir=..., etc., and most importantly, it messes with the order of passed arguments, which is a big issue.

    For example, if I pass the following arguments when launching the same NW.js app twice:
    /path/to/nw --foo bar --baz=qux -a b -cd 123

    Then the resulting argument string of the open event is
    /path/to/nw --foo --baz=qux -a -cd --enable-crashpad CONTENTS_OF_CHROMIUM_ARGS_FIELD --user-data-dir=/path/to/user-data-dir --no-sandbox --no-zygote --flag-switches-begin --flag-switches-end --nwapp=/path/to/nwapp bar b 123

    As you can see, this breaks the paramname paramvalue syntax, as it moves every word/token starting with - to the beginning.

Additional Info

  • Operating System: Arch Linux
  • NW.js Version: tested 0.64 - 0.70

Reproduction

package.json

{
	"name": "nwjs-app-open",
	"version": "0.0.1",
	"main": "index.html"
}

index.html

<!doctype html>
<script>
(function() {
const { App } = require("nw.gui");
const log = msg => process.stdout.write(`${msg}\n`);
App.on("open", command => log(command));
})()
</script>
@panther7
Copy link

Probably same as #7990

@ssnangua
Copy link

Is there anything new?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants