Skip to content

Migrate host.dart to new JS interop #2448

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 5 commits into from
Apr 10, 2025
Merged

Migrate host.dart to new JS interop #2448

merged 5 commits into from
Apr 10, 2025

Conversation

natebosch
Copy link
Member

Recompile with the latest dart2js.

Recompile with the latest dart2js.
Copy link

github-actions bot commented Jan 17, 2025

PR Health

Changelog Entry
Package Changed Files
package:test pkgs/test/lib/src/runner/browser/static/host.dart.js

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

_lazyFinal($, "_v8EvalLocation", "$get$_v8EvalLocation", () => A.RegExp_RegExp("^eval at (?:\\S.*?) \\((.*)\\)(?:, .*?:\\d+:\\d+)?$", false));
_lazyFinal($, "_firefoxEvalLocation", "$get$_firefoxEvalLocation", () => A.RegExp_RegExp("(\\S+)@(\\S+) line (\\d+) >.* (Function|eval):\\d+:\\d+", false));
_lazyFinal($, "_firefoxSafariFrame", "$get$_firefoxSafariFrame", () => A.RegExp_RegExp("^(?:([^@(/]*)(?:\\(.*\\))?((?:/[^/]*)*)(?:\\(.*\\))?@)?(.*?):(\\d*)(?::(\\d*))?$", false));
_lazyFinal($, "_firefoxSafariJSFrame", "$get$_firefoxSafariJSFrame", () => A.RegExp_RegExp("^(?:([^@(/]*)(?:\\(.*\\))?((?:/[^/]*)*)(?:\\(.*\\))?@)?(.*?):(\\d*)(?::(\\d*))?$", false));
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the blocking line and regex.

@natebosch
Copy link
Member Author

https://github.com/dart-lang/test/security/code-scanning/149

Inefficient regular expression

This part of the regular expression may cause exponential backtracking on strings starting with '(' and containing many repetitions of ')('.

First detected in commit on Aug 9, 2023

As far as I can tell this regex is not changing, but other content on the same line as the regex is changing.

Confusingly the error is reported with the old line number, but the regex doesn't change between the two copies.

@devoncarew @kevmoo - do you know what caused this check to start happening when we previously had this regex checked in? Is it something we can turn off temporarily?

@sigmundch - is this potentially inefficient regex a concern for the dart2js team?

@sigmundch
Copy link
Member

I'm not particularly concerned. This seems to come from https://github.com/dart-lang/tools/blob/ce3003493b86333e7652ee5bb62bc7913b2d11b7/pkgs/stack_trace/lib/src/frame.dart#L71 - this logic is used only to parse frame lines from stack traces in FF/Safari, which usually don't start with ( and usually only contain one pair of parens.

@kevmoo
Copy link
Member

kevmoo commented Jan 21, 2025

that's a HUGE drop in code size. Did we drop dart:html here?

@natebosch
Copy link
Member Author

that's a HUGE drop in code size. Did we drop dart:html here?

it does look like there is a big chunk of removed stuff that look like dart:html wrappers A.AreaElement.prototype = {...

This does not yet migrate to the new interop though. Maybe something made treeshaking work better here? Nothing that is dropped strikes me as something we would be using.

@natebosch natebosch changed the title Recompile host.dart Migrate host.dart to new JS interop Apr 10, 2025
@natebosch natebosch marked this pull request as ready for review April 10, 2025 22:26
@natebosch natebosch requested a review from a team as a code owner April 10, 2025 22:26
@natebosch natebosch merged commit 9f9fd77 into master Apr 10, 2025
4 checks passed
@natebosch natebosch deleted the recompile-host.dart branch April 10, 2025 22:46
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Apr 16, 2025
Revisions updated by `dart tools/rev_sdk_deps.dart`.

ecosystem (https://github.com/dart-lang/ecosystem/compare/7f6f1c1..815d4ba):
  815d4ba  2025-04-15  Devon Carew  [firehose] don't fail publish validation if we see the pub pre-release warning (dart-lang/ecosystem#357)
  e7bae16  2025-04-15  Moritz  Fix label fetching (dart-lang/ecosystem#358)
  7aa1313  2025-04-15  Moritz  Fix PR label fetching (dart-lang/ecosystem#356)

test (https://github.com/dart-lang/test/compare/8643fbf..84eba11):
  84eba115  2025-04-11  Daco Harkes  [native assets] Add support for pub workspaces (dart-lang/test#2484)
  ab850972  2025-04-11  Daco Harkes  [native assets] Add support for pub workspaces
  9f9fd77d  2025-04-10  Nate Bosch  Migrate host.dart to new JS interop (dart-lang/test#2448)

tools (https://github.com/dart-lang/tools/compare/d74f9e1..4a28415):
  4a284152  2025-04-15  Moritz  [package:code_builder] Remove transitive dependency on package:macros (dart-lang/tools#2073)
  2bb6eba7  2025-04-11  Lasse R.H. Nielsen  Simplifies the format for client IDs. (dart-lang/tools#2072)
  77e41774  2025-04-10  Liam Appelbe  [coverage] Prepare to publish (dart-lang/tools#2070)
  e7168ae1  2025-04-10  Liam Appelbe  [coverage] Finish collection as soon as main isolate exits (dart-lang/tools#2069)

vector_math (https://github.com/google/vector_math.dart/compare/f08d7d2..dc9d379):
  dc9d379  2025-04-15  Lukas Klingsbo  chore: Remove test_all.dart since this is built-in to `dart test` (google/vector_math.dart#343)

webdev (https://github.com/dart-lang/webdev/compare/c8b1cfa..5bf833d):
  5bf833d0  2025-04-15  Srujan Gaddam  Support hot reload testing (dart-lang/webdev#2611)
  fa0b74bf  2025-04-14  Srujan Gaddam  Add support for hot restart tests in DWDS with the frontend server (dart-lang/webdev#2608)

Change-Id: Ic3ff6ed88ee2db935dc48fafe1e16a869d73506c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/422580
Reviewed-by: Ivan Inozemtsev <[email protected]>
Commit-Queue: Ivan Inozemtsev <[email protected]>
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.

4 participants