- last update
over 1 year ago Composer error. Unable to continue. - last update
over 1 year ago 29,194 pass, 27 fail - last update
over 1 year ago CI aborted - last update
over 1 year ago 29,194 pass, 27 fail - last update
over 1 year ago 29,194 pass, 27 fail - last update
over 1 year ago CI aborted - last update
over 1 year ago CI aborted - Status changed to Needs review
over 1 year ago 1:25am 8 August 2023 54:57 50:49 Running53:08 50:08 Running52:47 50:08 Running- Status changed to RTBC
over 1 year ago 1:07pm 8 August 2023 - 🇨🇦Canada joseph.olstad
RTBC:
has tests, passes tests
tests only fails
Related issues are linked
- last update
over 1 year ago 29,959 pass - last update
over 1 year ago 29,959 pass - last update
over 1 year ago 29,947 pass, 2 fail The last submitted patch, 24: 2990907-24.patch, failed testing. View results →
- last update
about 1 year ago 29,960 pass - Status changed to Needs work
about 1 year ago 11:37am 17 August 2023 - 🇬🇧United Kingdom catch
+++ b/core/tests/Drupal/Tests/Core/Asset/JsOptimizerUnitTest.php @@ -75,6 +75,35 @@ public function testClean($js_asset, $expected) { + /** + * Tests that the javascript may be cleaned without backtracking. + */ + public function testCleanWithRecursionLimit() { + // Specify a hard backtracking limit. + ini_set('pcre.backtrack_limit', 100); + $backtrack_limit = (int) ini_get('pcre.backtrack_limit'); + $this->assertEquals(100, $backtrack_limit); + $script = <<<JS +(function($) { "use strict"; }) +//# sourceMappingURL=data:application/json;charset=utf-8;base64, +JS; + // Generate a source map URL that would exceed the backtrack limit. + $script .= str_repeat('x', $backtrack_limit); + // Add an empty space after the sourcemap, followed by other + // miscellaneous code. + $script .= <<<JS + // I appear after the sourcemap URL. +(function($) { "use strict"; console.log('Hello'); }) +JS; + $expected_script = <<<JS +(function($) { "use strict"; }) +// I appear after the sourcemap URL. +(function($) { "use strict"; console.log('Hello'); }) +JS; + + $this->assertEquals($expected_script, $this->optimizer->clean($script)); + } +
Overall this looks good but the regexp is trying to find both sourceURL and sourceMappingURL so I think we should probably have coverage for both?
It could be an extra method with nearly identical content or maybe one method with a data provider.
I think we'd ideally also have test coverage for the issue raised in #16 when the source code itself contains
//# sourceURL=
in a string, but should not be stripped.- 🇬🇧United Kingdom catch
Actually I wonder if this code is needed at all with Peast - if it strips this already, then we don't need the regexp?
- First commit to issue fork.
- 🇧🇪Belgium dieterholvoet Brussels
I rebased the last patch and added it to a MR.