8000 fix: reject the executeJavaScript promise when it fails to execute the script by MarshallOfSound · Pull Request #18635 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: reject the executeJavaScript promise when it fails to execute the script #18635

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

Merged
merged 4 commits into from
Jun 5, 2019

Conversation

MarshallOfSound
Copy link
Member

Closes #9102

Unfortunately we can't get the actual error message, but can at least reject the promise to avoid leaving it dangling. The best we can do is tell them that their script failed, but not why.

Notes: .executeJavaScript will never leave a promise dangling now, scripts that fail to execute will correctly be rejected

@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Jun 5, 2019
Co-Authored-By: Jeremy Apthorp <nornagon@nornagon.net>
@nornagon
Copy link
Contributor
nornagon commented Jun 5, 2019

It's a bit silly that we can't get the actual error message, because it's totally possible to catch any error and transmit it back. This seems like a flaw in the API exposed by Chromium. Is there perhaps a different API we should be using for this?

Co-Authored-By: Jeremy Apthorp <nornagon@nornagon.net>
@MarshallOfSound
Copy link
Member Author

@nornagon It eventually ends up here --> https://cs.chromium.org/chromium/src/third_party/blink/renderer/bindings/core/v8/script_controller.cc?type=cs&sq=package:chromium&g=0&l=90-145

Where the script is evaluated inside a try catch 🤔

@MarshallOfSound MarshallOfSound merged commit 0fc172f into master Jun 5, 2019
@release-clerk
Copy link
release-clerk bot commented Jun 5, 2019

Release Notes Persisted

.executeJavaScript will never leave a promise dangling now, scripts that fail to execute will correctly be rejected

@MarshallOfSound MarshallOfSound deleted the reject-bad-executes branch June 5, 2019 22:43
@codebytere
Copy link
Member

@MarshallOfSound should we backport this to 6 at least?

promise_.RejectWithErrorMessage(
"Script failed to execute, this normally means an error "
"was thrown. Check the renderer console for the error."
"was thrown, check the renderer console for the error");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is here twice.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How strange 😕 I definitely wouldn't type the same thing twice, the auto-formatter might have done this 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it's because you directly committed my suggestion in the github UI, which can't handle suggesting changing multiple lines

@codebytere codebytere removed the new-pr 🌱 PR opened recently label Jun 10, 2019
@codebytere
Copy link
Member

/trop run backport-to 6-0-x

@trop
Copy link
Contributor
trop bot commented Jun 10, 2019

The backport process for this PR has been manually initiated,
sending your 1's and 0's to "6-0-x" here we go! :D

@trop
Copy link
Contributor
trop bot 8000 commented Jun 10, 2019

I have automatically backported this PR to "6-0-x", please check out #18714

jmercouris added a commit to atlas-engineer/cl-electron that referenced this pull request Mar 5, 2024
Unfortunately we cannot get more information from Electron with
regards to the nature of the error. In fact, the error that it reports
instructs the user to check the JavaScript console within the renderer
for more details.

You can see more information here:

electron/electron#18635
electron/electron#9102
jmercouris added a commit to atlas-engineer/cl-electron that referenced this pull request Mar 6, 2024
Unfortunately we cannot get more information from Electron with
regards to the nature of the error. In fact, the error that it reports
instructs the user to check the JavaScript console within the renderer
for more details.

You can see more information here:

electron/electron#18635
electron/electron#9102
aadcg pushed a commit to atlas-engineer/cl-electron that referenced this pull request Mar 7, 2024
Unfortunately we cannot get more information from Electron with
regards to the nature of the error. In fact, the error that it reports
instructs the user to check the JavaScript console within the renderer
for more details.

You can see more information here:

electron/electron#18635
electron/electron#9102
aadcg added a commit to atlas-engineer/cl-electron that referenced this pull request Mar 7, 2024
Unfortunately we cannot get more information from Electron with regards to the
nature of the error. In fact, the error that it reports instructs the user to
check the JavaScript console within the renderer for more details.

For more information, see:

electron/electron#18635
electron/electron#9102

Fixes #30.
aadcg pushed a commit to atlas-engineer/cl-electron that referenced this pull request Mar 7, 2024
Unfortunately we cannot get more information from Electron with regards to the
nature of the error. In fact, the error that it reports instructs the user to
check the JavaScript console within the renderer for more details.

For more information, see:

electron/electron#18635
electron/electron#9102

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

Successfully merging this pull request may close these issues.

FR: Better error reporting for webContents->executeJavaScript
4 participants
0