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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to set arbitrary arguments in a renderer process #11850

Merged
merged 1 commit into from Feb 12, 2018

Conversation

Projects
None yet
3 participants
@MarshallOfSound
Member

MarshallOfSound commented Feb 7, 2018

This provides an easy way to send additional data to a renderer process preload script. Something like --my-app-channel=beta for instance 馃槃

@MarshallOfSound MarshallOfSound requested review from electron/docs as code owners Feb 7, 2018

@ckerr

Suggestion inline to replace deprecated libcc API calls, but otherwise LGTM. Nice job on the docs and tests.

}
}
}

This comment has been minimized.

@ckerr

ckerr Feb 7, 2018

Member

DictionaryValue::GetList is deprecated, and the newer API wraps around std::vector<base::Value> so I think the nondeprecated version would look something like this (disclaimer: untested):

// Custom args for renderer process
const base::Value* customArgs = web_preferences.FindPath(options::kCustomArgs);
if ((customArgs != nullptr) && (customArgs->is_list())) {
  for (const base::Value& customArg : customArgs->GetList()) {
    if (customArg.is_string()) {
      command_line->AppendArg(customArg.GetString());
    }
  }
}
@@ -353,6 +353,9 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
script. You can use the `will-attach-webview` event on [webContents](web-contents.md)
to strip away the `preload` script and to validate or alter the
`<webview>`'s initial settings.
* `additionArguments` String[] (optional) - A list of strings that will be appended
to `process.argv` in the renderer process of this app. Useful for passing smalls

This comment has been minimized.

@ckerr

ckerr Feb 7, 2018

Member

s/smalls/small/

w.loadURL(`file://${path.join(fixtures, 'api', 'blank.html')}`)
})
})

This comment has been minimized.

@ckerr

ckerr Feb 7, 2018

Member

馃憤 on the tests and docs, thanks for adding these in the initial pass 鉂わ笍

edit: oh but do make the linter happy too

  /home/builduser/project/spec/api-browser-window-spec.js:1079:12: Unexpected trailing comma.
  /home/builduser/project/spec/api-browser-window-spec.js:1096:12: Unexpected trailing comma.
@MarshallOfSound

This comment has been minimized.

Member

MarshallOfSound commented Feb 10, 2018

@ckerr Updated 馃憤

@codebytere

This comment has been minimized.

Member

codebytere commented Feb 11, 2018

@MarshallOfSound looks like this died on lint

@codebytere

once , LGTM!

@ckerr

ckerr approved these changes Feb 12, 2018

@ckerr ckerr merged commit b3234f6 into master Feb 12, 2018

8 checks passed

ci/circleci: electron-linux-arm Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-arm-test Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-arm64 Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-arm64-test Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-ia32 Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-x64 Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/jenkins/pr-head This commit looks good
Details

@codebytere codebytere deleted the additional-arguments branch Feb 12, 2018

sethlu added a commit to sethlu/electron that referenced this pull request May 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment