Unverified Commit d72f08f5 authored by David Iglesias's avatar David Iglesias Committed by GitHub

[web][debug] Remove RequireJS timeouts for debug builds. (#107868)

parent cda8041e
......@@ -28,6 +28,7 @@ var styles = `
position: absolute;
top: 0px;
left: 0px;
overflow: hidden;
}
.indeterminate {
......@@ -131,6 +132,10 @@ String generateMainModule({
}) {
return '''
/* ENTRYPOINT_EXTENTION_MARKER */
// Disable require module timeout
require.config({
waitSeconds: 0
});
// Create the main module loaded below.
define("$bootstrapModule", ["$entrypoint", "dart_sdk"], function(app, dart_sdk) {
dart_sdk.dart.setStartAsyncSynchronously(true);
......
......@@ -21,7 +21,7 @@ void main() {
expect(result, contains('requireEl.setAttribute("data-main", "main_module.bootstrap");'));
});
test('generateBootstrapScript includes loading indicator', () {
test('generateBootstrapScript includes loading indicator', () {
final String result = generateBootstrapScript(
requireUrl: 'require.js',
mapperUrl: 'mapper.js',
......@@ -30,6 +30,36 @@ test('generateBootstrapScript includes loading indicator', () {
expect(result, contains('"indeterminate"'));
});
// https://github.com/flutter/flutter/issues/107742
test('generateBootstrapScript loading indicator does not trigger scrollbars', () {
final String result = generateBootstrapScript(
requireUrl: 'require.js',
mapperUrl: 'mapper.js',
);
// See: https://regexr.com/6q0ft
final RegExp regex = RegExp(r'(?:\.flutter-loader\s*\{)[^}]+(?:overflow\:\s*hidden;)[^}]+}');
expect(result, matches(regex), reason: '.flutter-loader must have overflow: hidden');
});
// https://github.com/flutter/flutter/issues/82524
test('generateMainModule removes timeout from requireJS', () {
final String result = generateMainModule(
entrypoint: 'foo/bar/main.js',
nullAssertions: false,
nativeNullAssertions: false,
);
// See: https://regexr.com/6q0kp
final RegExp regex = RegExp(
r'(?:require\.config\(\{)(?:.|\s(?!\}\);))*'
r'(?:waitSeconds\:\s*0[,]?)'
r'(?:(?!\}\);).|\s)*\}\);');
expect(result, matches(regex), reason: 'require.config must have a waitSeconds: 0 config entry');
});
test('generateMainModule embeds urls correctly', () {
final String result = generateMainModule(
entrypoint: 'foo/bar/main.js',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment