Commit Graph

18 Commits

Author SHA1 Message Date
Lasse R.H. Nielsen 56505e0575 Stop using Match.group.
The `Match.operator[]` does the same thing and is
generally recommended (and shorter).
(I want to deprecate `group` and `groups`)

Tested: Refactoring.
CoreLibraryReviewExempt: Calling equivalent function.
Change-Id: I4c758968ae622fe16b7322be1b29b05b91e7fcd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489021
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2026-03-20 09:09:46 -07:00
Mayank Patke 4978ad148c [dart2js_tools] Update pubspec to 3.8 and reformat.
Change-Id: I8216c8d0bcbaf2b9fe6aecb256b9a3f9d5efc47a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427562
Auto-Submit: Mayank Patke <fishythefish@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-05-08 14:36:29 -07:00
Devon Carew 3c973fb292 [lints] address diagnostics related to strict_top_level_inference
Change-Id: I228058202855900f0adba73c1ab04d35180a6e5d
Tested: this is an analyzer diagnostic only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414900
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-03-17 08:27:57 -07:00
Mayank Patke 5633c40d39 [dart2js_tools] Update pubspec to 3.7 and reformat.
Change-Id: I7d865d8c4d2fc7145a2c0567252edafba058b9e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400741
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Auto-Submit: Mayank Patke <fishythefish@google.com>
2024-12-13 13:02:41 -08:00
Devon Carew e2fe203adc [deps] roll package:lints to the latest
Change-Id: I582f956cd4b712203c2f6dd630b4e1384040446d
Tested: analysis clean (this is a lint only related change)
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329400
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-10-05 03:36:59 +00:00
Devon Carew 21ab29fef6 [deps] rev package:source_maps to the latest
Change-Id: Ic0926143ea98bc3bc1eebfaca0d20c3f5578154a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282808
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-02-13 21:18:37 +00:00
Devon Carew 8935cb0a53 [pkg] use package:lints/recommended.yaml as the default analysis config
Change-Id: I302b8e9d6568ac43ec4e9ba29b660e1528f4d61a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281223
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-02-08 16:56:05 +00:00
Nate Bosch 33e174084a Replace Uri.scheme == with Uri.isScheme
Use `hasScheme` in place of comparing against the empty string, and
`isScheme` to compare against all other schemes.

TEST=No behavior changes.

Change-Id: Ifc9fd13c6cf37933ebd4a754c4b500dedbcb291b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231185
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2022-02-08 21:38:57 +00:00
Nicholas Shahan 50fb0c6e61 [dart2js] Migrate dart2js_tools to null safety
Change-Id: I43186c26521eca6405d0ab8b3a50b545a91b5cc2
Issue: https://github.com/dart-lang/sdk/issues/46617
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215013
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-10-08 23:54:54 +00:00
Nicholas Shahan 9ae8713216 Revert "[dart2js] Migrate dart2js_tools to null safety"
This reverts commit 4b1de45034.

Reason for revert: Null safety error appears when test fail:
error: Null check operator used on a null value

Original change's description:
> [dart2js] Migrate dart2js_tools to null safety
>
> Change-Id: If93f66f4da2dafb50f58434eb112b1f8af6648c7
> Issue: https://github.com/dart-lang/sdk/issues/46617
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208363
> Commit-Queue: Nicholas Shahan <nshahan@google.com>
> Reviewed-by: Stephen Adams <sra@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Issue: https://github.com/dart-lang/sdk/issues/46617
Change-Id: I7ef7d95a6715d667698e0dfcb38375fd79b4cc73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210540
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-08-19 01:23:15 +00:00
Nicholas Shahan 4b1de45034 [dart2js] Migrate dart2js_tools to null safety
Change-Id: If93f66f4da2dafb50f58434eb112b1f8af6648c7
Issue: https://github.com/dart-lang/sdk/issues/46617
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208363
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-08-17 19:40:42 +00:00
Mark Zhou 656584e8b6 [dart2js] Reexporting check in _extractMinifiedNames.
It seems this was introduced internally only in cl/220297783 but never ported externally

Change-Id: Ibcc35b091a32b422b86b7eea36b52165b11987d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205625
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2021-06-30 22:50:14 +00:00
Mark Zhou a725f0c835 [dart2js] Updating deobfuscator function name resolution to support method definitions.
Change-Id: Ie0ddce9e42ab9f069aebddc7514da95e9b240b60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204745
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-06-24 23:12:42 +00:00
Sigmund Cherem 4a42831e85 Use source-maps in test runner to expand JavaScript stack traces.
This works on all browsers, in d8, and supports both dartdevk and
dart2js. In the case of dart2js, this also expands minified names and
inlined data.

The result is presented to users as a separate section, so the original
JS stack trace is printed as is, and a second deobfuscated stack trace
is printed afterwards.

Change-Id: I10af5e0241a8c87ad8db48234ce52cfb51a27411
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132966
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2020-01-24 20:00:13 +00:00
Sigmund Cherem db2c9eeb76 dart2js_tools cleanups from the previous CL comments
TBR=johnniwinther@google.com

Change-Id: I252751d8163a056784b10dcb58633c4206a849a0
Reviewed-on: https://dart-review.googlesource.com/c/82883
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-11-05 19:35:16 +00:00
Sigmund Cherem 61df5fdec8 Encode dart2js source-map extensions in strings.
This reduce the memory footprint and cost of parsing these extensions.  Another
advantage is a reduction on the size of the .map files.  On a large customer
app, this was a 11% reduction, and the frames section was about 1Mb (excluding
the extra names and uris added on the existing tables).

The encoding works as follows:
 - minified names are written as a list of names and indices, in pairs.

    {'n1': 1, 'n2': 2} => 'n1,1,n2,2'

 - frames are encoded using a sequence of values with markers for the different
   kind of frames. Numbers are encoded using VLQ deltas. We use VLQ because it's
   already available to any parser that deals with the mappings).

This change also uses the dart2js_tools parser implementation for all unit tests.

Change-Id: Iacc2833c6517eb473955cc618adec501c610870f
Reviewed-on: https://dart-review.googlesource.com/c/82780
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-11-05 18:24:33 +00:00
Sigmund Cherem 0e35e41121 Upstream recent changes to dart2js tools
Changes include:
  * Added a couple no-such-method decoders.
  * Apply deobfuscation rules more than once per line
  * Fixed pattern matched for minified names.
  * Added support for expanding the call signature from call selectors
  * Fix backward search to find the function declaration
  * Refactor trace deobfuscation logic:
    * add dependency on stack\_trace to parse frames
    * add library to expose trace deobfsucation and keep that separate from
      printing the results
  * Fix off-by-one error when extracting the name of a function whose index is 0.
  * Avoid crash if we can't get a function name.

Change-Id: I016a293efadbdd8ddf66a007b182d5485eb2311f
Reviewed-on: https://dart-review.googlesource.com/c/82711
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Sigmund Cherem <sigmund@google.com>
2018-11-05 18:24:33 +00:00
Sigmund Cherem 7c77ed04f4 Move deobfuscation tools to the SDK repo
This is an initial implementation of the dart deobfuscator tool.

Let me know your thoughts on the package name. I used to have this named as
`package:deobfuscate`, but it feels like we will want to add more tools that are
not about deobfuscation in the future, so I picked `package:dart2js_tools`
instead. That also gives us the opportunity to move over the dart2js_info code
here too.

Change-Id: I2ff948982969c9c76bc84cdc78cbe237abc87378
Reviewed-on: https://dart-review.googlesource.com/69243
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-08-09 22:55:04 +00:00