Remind user the executeJavaScript will not run their code immediately (#19129)

Remind user the contents.executeJavaScript will not run their code immediately if the web page still in running.  Without the knowledge, user would think their code not function properly and it's hard to debug because different page have different loading time.

According to  [web-contents.js](731edbe2b6/lib/browser/api/web-contents.js (L199))
This commit is contained in:
lvs 2019-07-11 23:55:30 +08:00 committed by Shelley Vohr
parent 0dbeb49ee0
commit 6d34314457

View file

@ -1034,6 +1034,8 @@ In the browser window some HTML APIs like `requestFullScreen` can only be
invoked by a gesture from the user. Setting `userGesture` to `true` will remove invoked by a gesture from the user. Setting `userGesture` to `true` will remove
this limitation. this limitation.
Code execution will be suspended until web page stop loading.
```js ```js
contents.executeJavaScript('fetch("https://jsonplaceholder.typicode.com/users/1").then(resp => resp.json())', true) contents.executeJavaScript('fetch("https://jsonplaceholder.typicode.com/users/1").then(resp => resp.json())', true)
.then((result) => { .then((result) => {