Skip to content

[dartdevc] <String>.replaceAll(<RegExp>, ...) throws in Firefox #37492

@leonsenft

Description

@leonsenft
  • Dart SDK Version (dart --version): 2.3.3-dev.0.0
  • Whether you are using Windows, MacOSX, or Linux (if applicable): Linux
  • Whether you are using Chrome, Safari, Firefox, Edge (if applicable): Firefox 60.7.2esr-1

To reproduce, compile with DDC and serve the following main.dart:

void main() {
  var s = 'Hello world!';
  var r = RegExp('o');
  print(s.replaceAll(r, 'a'));
}

Passing a RegExp to String.replaceAll() causes the following error to be thrown:

DartError                                                 http://localhost:8080/path_to_project/web/dart_sdk.js:5930:7
load__dart_sdk/dart.throw                                 http://localhost:8080/path_to_project/web/dart_sdk.js:4605:11
load__dart_sdk/dart._throwBooleanConversionError          http://localhost:8080/path_to_project/web/dart_sdk.js:4924:12
load__dart_sdk/dart.test                                  http://localhost:8080/path_to_project/web/dart_sdk.js:4916:22
makeNative                                                http://localhost:8080/path_to_project/web/dart_sdk.js:17495:15
load__dart_sdk/_js_helper.JSSyntaxRegExp<                 http://localhost:8080/path_to_project/web/dart_sdk.js:17472:42
load__dart_sdk/_js_helper.regExpGetGlobalNative           http://localhost:8080/path_to_project/web/dart_sdk.js:17448:9
load__dart_sdk/_js_helper.stringReplaceAllUnchecked       http://localhost:8080/path_to_project/web/dart_sdk.js:17981:16
load__dart_sdk/_interceptors.JSString<                    http://localhost:8080/path_to_project/web/dart_sdk.js:8985:14
load__app_library/path_to_project__web__main.main         main.dart:10:9
start                                                     http://localhost:8080/path_to_project/web/dart_library.js:302:5
finishHotRestart/<                                        http://localhost:8080/path_to_project/web/dart_library.js:257:9
cb                                                        http://localhost:8080/path_to_project/web/app_ddc_bundle.js:239:7
window.$dartWarmReload/xhttp.onreadystatechange/el.onload http://localhost:8080/path_to_project/web/app_ddc_bundle.js:27

See angulardart/angular#1828 for background.

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onarea-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.customer-flutterweb-dev-compiler

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions