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

Update userScripts.execute() to receive multiple js sources #745

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

EmiliaPaz
Copy link
Contributor

Updated as discussed in #477 (comment)

…multiplesources

Update userScripts.execute() to receive multiple js soruces
@EmiliaPaz EmiliaPaz requested a review from Rob--W January 9, 2025 20:43
@EmiliaPaz EmiliaPaz changed the title Update userScripts.execute() to receive multiple js soruces @EmiliaPaz Update userScripts.execute() to receive multiple js sources @EmiliaPaz Jan 14, 2025
@Rob--W Rob--W changed the title Update userScripts.execute() to receive multiple js sources @EmiliaPaz Update userScripts.execute() to receive multiple js sources Jan 16, 2025
Copy link
Member

@Rob--W Rob--W left a comment

Choose a reason for hiding this comment

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

Can we specify what the behavior should be when a runtime error occurs while executing one of the ScriptSources?

Options:

  • Interrupt execution and propagate error to the caller.
  • Log error and continue executing the next script.

Since executeScript is specified to propagate the result to the caller, it would make sense to propagate errors.

On the other hand, if registered declaratively, the expected behavior is to run them all (and uncaught errors be reported to the console).

There is something to say for either approach.

For comparison, where I checked Chrome's current scripting.executeScript implementation will eventually be handled by the generic logic that is shared between declarative scripts and executeScript (ScriptInjection::InjectJs. This will ultimately just execute all scripts and swallow errors (in WebScriptExecutor::Execute). Now that I see this code, I guess that it also explains why scripting.executeScript does not expose errors in Chrome (https://issues.chromium.org/issues/40205757).

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

Successfully merging this pull request may close these issues.

2 participants