Skip to content

Commit

Permalink
Version 3.7.0-116.0.dev
Browse files Browse the repository at this point in the history
Merge 22833d5 into dev
  • Loading branch information
Dart CI committed Nov 7, 2024
2 parents b2e7085 + 22833d5 commit d73be3d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 41 deletions.
12 changes: 12 additions & 0 deletions pkg/dev_compiler/lib/js/ddc/ddc_module_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -1909,6 +1909,18 @@ if (!self.deferred_loader) {
get extensionNames() {
return dartDeveloperLibrary()._extensions.keys().toList();
}

/**
* Returns a Dart stack trace string given an error caught in JS. If the
* error is a Dart error or JS `Error`, we use the built-in stack. If the
* error is neither, we try to construct a stack trace if possible.
*
* @param {any} error The error for which a stack trace will be produced.
* @returns {String} The stringified stack trace.
*/
stackTrace(error) {
return dartRuntimeLibrary().stackTrace(error).toString();
}
}

const debugger_ = new Debugger();
Expand Down
37 changes: 12 additions & 25 deletions pkg/test_runner/lib/src/browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,10 @@ String ddcHtml(
var hotReloadFormat = ddcModuleFormat && canaryMode;

var sdkAndAsyncHelperSetup = """
_isolate_helper.startRootIsolate(function() {}, []);
_debugger.registerDevtoolsFormatter();
testErrorToStackTrace = function(error) {
var stackTrace = runtime.stackTrace(error).toString();
var stackTrace = getStackTraceString(error);
var lines = stackTrace.split("\\n");
Expand All @@ -195,19 +194,6 @@ testErrorToStackTrace = function(error) {
// lines too.
return lines.join("\\n");
};
runtime.addAsyncCallback = function() {
expect.async_helper.asyncStart();
};
runtime.removeAsyncCallback = function() {
// removeAsyncCallback() is called *before* the async operation is
// performed, but we don't want to report the test as being done until
// after that operation completes, so wait for that callback to run.
setTimeout(() => {
expect.async_helper.asyncEnd();
}, 0);
};
""";

var sdkFlagSetup = """
Expand All @@ -232,12 +218,11 @@ runtime.jsInteropNonNullAsserts($jsInteropNonNullAsserts);
String libraryImports;
String startCode;
if (hotReloadFormat) {
var import = 'dartDevEmbedder.importLibrary';
libraryImports = """
let runtime = $import("dart:_runtime");
let expect = $import("package:expect/async_helper.dart");
let _isolate_helper = $import("dart:_isolate_helper");
let _debugger = $import("dart:_debugger");
let _debugger = dartDevEmbedder.debugger;
let getStackTraceString = function(error) {
return _debugger.stackTrace(error);
}
""";
sdkFlagSetup = """
let sdkOptions = {
Expand All @@ -255,8 +240,9 @@ runtime.jsInteropNonNullAsserts($jsInteropNonNullAsserts);
libraryImports = """
let sdk = dart_library.import("dart_sdk", "$appName");
let runtime = sdk.dart;
let expect = dart_library.import("expect", "$appName");
let _isolate_helper = sdk._isolate_helper;
let getStackTraceString = function(error) {
return runtime.stackTrace(error).toString();
}
let _debugger = sdk._debugger;
""";
startCode = """dart_library.start("$appName", "$uuid", "$testName",
Expand Down Expand Up @@ -305,10 +291,11 @@ $packagePaths
<script type="text/javascript"
src="/root_dart/third_party/requirejs/require.js"></script>
<script type="text/javascript">
requirejs(["$testName", "dart_sdk", "expect"],
function($testId, sdk, expect) {
requirejs(["$testName", "dart_sdk"], function($testId, sdk) {
let runtime = sdk.dart;
let _isolate_helper = sdk._isolate_helper;
let getStackTraceString = function(error) {
return runtime.stackTrace(error).toString();
}
let _debugger = sdk._debugger;
$sdkAndAsyncHelperSetup
Expand Down
15 changes: 0 additions & 15 deletions sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/runtime.dart
Original file line number Diff line number Diff line change
Expand Up @@ -275,18 +275,3 @@ void hotRestart() {
JS('', '#.clear()', deferredImports);
}
}

/// Marks enqueuing an async operation.
///
/// This will be called by library code when enqueuing an async operation
/// controlled by the JavaScript event handler.
///
/// It will also call [removeAsyncCallback] when Dart callback is about to be
/// executed (note this is called *before* the callback executes, so more
/// async operations could be added from that).
void Function() addAsyncCallback = JS('', 'function() {}');

/// Marks leaving a javascript async operation.
///
/// See [addAsyncCallback].
void Function() removeAsyncCallback = JS('', 'function() {}');
2 changes: 1 addition & 1 deletion tools/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ CHANNEL dev
MAJOR 3
MINOR 7
PATCH 0
PRERELEASE 115
PRERELEASE 116
PRERELEASE_PATCH 0

0 comments on commit d73be3d

Please sign in to comment.