Repository navigation
error handling: - #46
Merged
Merged
Conversation
|
Can one of the admins verify this patch? |
Plamen5kov
force-pushed
the
plamen5kov/error_service
branch
2 times, most recently
from
March 26, 2015 06:34
567a8ba to
b31829e
Compare
-now the errors raise a pending intent and the app doesn't crash -refactored a bit
Plamen5kov
force-pushed
the
plamen5kov/error_service
branch
from
March 26, 2015 10:16
b31829e to
f105428
Compare
edusperoni
added a commit
that referenced
this pull request
Nov 25, 2026
) ### Description Stacked on #2134 (Ada 4.1.1). This is the Android half of NativeScript/ios#606. As #2134 stands, the upgrade adds about 89 KB per ABI to `libNativeScript.so`. This PR takes back most of that. **1. Build ada at `-Os`.** ada was compiled at the runtime-wide `-O3`. At `-Os`, ada's code is about 50 KB smaller per ABI. Native benchmark on two phones (median of 3 rounds, ns per operation): | | Galaxy S20 FE `-O3` | `-Os` | Galaxy S8 `-O3` | `-Os` | |---|---|---|---|---| | absolute URL parse | 192 | 214 (+11%) | 441 | 519 (+18%) | | relative URL parse | 130 | 154 (+19%) | 336 | 388 (+15%) | | IDN host parse | 1027 | 1097 (+7%) | 2203 | 2352 (+7%) | | URLSearchParams | 609 | 599 (−2%) | 1408 | 1360 (−3%) | The slowdown is tens of nanoseconds per `new URL()`. Only `ada.cpp` changes; the rest of the runtime stays at `-O3`, and local Debug builds are unaffected. **2. Parse each URL once.** - `new URL(input, base)` called `ada::can_parse(input, &base)`, which parses both, then parsed both again. It now parses each once. - `URL.canParse` uses `ada::parse` as well, so `ada::can_parse` and its second parser instantiation are no longer linked. - These fixes ride along: - `canParse` stringifies its arguments instead of casting them to `v8::String` unchecked, so `URL.canParse(urlObject)` no longer reads a non-string as a string; - `canParse` treats an undefined base as absent and no longer truncates at an embedded NUL; - `new URL()` without arguments throws a `TypeError` instead of reading `undefined` as a string; - a base object whose `toString()` throws now propagates the exception instead of aborting in `ToLocalChecked()`. **3. URLPattern capture groups and `hasRegExpGroups`.** Found while adding specs: `testURLPattern.js` was never `require`d from `mainpage.js`, so the Android URLPattern specs never ran. Once registered, they exposed two bugs: - `v8_regex_provider::regex_search` returned `RegExp.exec`'s whole match as the first capture. Every named group read its predecessor's value, so `:id` in `/books/:id` got `/books/123`. ada also received one more result than it has group names. iOS already skips element 0. - The `hasRegExpGroups` getter was registered as `hasRegexpGroups`. Both now match iOS, and the specs now cover `test()`/`exec()` with capture groups. **Size.** arm64 `optimized` build. Numbers are loaded bytes from the `lld` link map (code, rodata, data, unwind), because stripped `.so` sizes are page-rounded. | | ada | whole `libNativeScript.so` | |---|---|---| | main (ada 4.0.0) | 297.7 KB | 26,285,061 | | #2134 (ada 4.1.1) | 391.8 KB | 26,374,175 | | this PR | 307.2 KB | 26,290,495 (−83.7 KB vs #2134) | | this PR + `-fdata-sections` from #2136 | 250.9 KB | 26,233,370 (−140.8 KB vs #2134, −51.7 KB vs main) | **Not ported from iOS:** - **Symbol visibility.** The iOS PR's biggest saving was hiding ada's symbols. Android already builds with `-fvisibility=hidden` and a version script. The equivalent loss here came from `-fno-data-sections`: it put every ada vtable in one section, so unused code like the `ada::url` parser stayed linked. #2136 removes that flag. - **System ICU for IDNA.** The NDK's `libicu.so` exists only from API 31 and ships no `uidna.h`. The only system UTS #46 is Java's `android.icu.text.IDNA` (API 24+, ICU 56 / Unicode 8 at the bottom of the range), which would need JNI. Left out. - **`std::regex`.** The Android runtime has no `std::regex` use; URLPattern already runs on V8's RegExp. ### Does your commit message include the wording below to reference a specific issue in this repo? No. ### Related Pull Requests - #2134, the base of this PR - #2136, which removes `-fno-data-sections`; together they reach the last size row above - NativeScript/ios#606, the iOS counterpart ### Does your pull request have unit tests? Yes. The full suite passes on an API 36 arm64 emulator: 1,792 specs, 0 failures. `testURLPattern.js` now runs, and new specs cover: - relative URLs against string and `URL` bases; - invalid bases; - a throwing base `toString()`; - `new URL()` without arguments; - `URL.canParse` with string, `URL`-object and undefined arguments; - IDN hosts (Unicode, uppercase `xn--`, ZWJ rejection); - non-ASCII URLPattern group names; - URLPattern `test()`/`exec()` with capture groups. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit - **Bug Fixes** - Improved URL construction and validation, including relative URLs, base handling, and internationalized hostnames. - Updated `URL.canParse()` to validate inputs and optional bases consistently. - Corrected URLPattern capture-group results and the exposed `hasRegExpGroups` property name. - **Tests** - Added coverage for URL parsing, validation, internationalized hostnames, and URLPattern matching and captures. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
-now the errors raise a pending intent and the app doesn't crash
-refactored a bit
resolved #42