Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit e15c2cc

Browse files
committed
Signal an error if an Isolate.spawnUri call uses an unsupported URI
Fixes flutter/flutter#76371
1 parent cd6c9bc commit e15c2cc

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

common/settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ struct Settings {
118118

119119
// Used as the script URI in debug messages. Does not affect how the Dart code
120120
// is executed.
121-
std::string advisory_script_uri = "main.dart";
121+
std::string advisory_script_uri = "file:///main.dart";
122122
// Used as the script entrypoint in debug messages. Does not affect how the
123123
// Dart code is executed.
124124
std::string advisory_script_entrypoint = "main";

runtime/dart_isolate.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,14 @@ Dart_Isolate DartIsolate::DartIsolateGroupCreateCallback(
929929
DartIsolateGroupData& parent_group_data =
930930
(*parent_isolate_data)->GetIsolateGroupData();
931931

932+
if (parent_group_data.GetSettings().advisory_script_uri !=
933+
advisory_script_uri) {
934+
std::string error_msg =
935+
std::string("Unsupported isolate URI: ") + advisory_script_uri;
936+
*error = fml::strdup(error_msg.c_str());
937+
return nullptr;
938+
}
939+
932940
auto isolate_group_data =
933941
std::make_unique<std::shared_ptr<DartIsolateGroupData>>(
934942
std::shared_ptr<DartIsolateGroupData>(new DartIsolateGroupData(

0 commit comments

Comments
 (0)