Repository navigation
Compare the JavaScript Builder's Promise value as text, so a browser with promises gets the promise form - #194
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
JavaScriptBuilderElement.getSupportsPromisesread thePromiseProperty and comparedsupportsPromisesValue.getValue() == "Full". In Java==compares two strings by reference, not by their text. A value read from the Device Detection data file is a String made at run time, so the comparison was false even when the value was "Full", and every browser was given the script's form for a browser without promises. Only the literal "Full", as a unit test gives it, matched, which is why no existing test saw it.What the specification says
javascript-builder.md line 98 at d79bbe3b gives the template's
_supportsPromisesvalue asso
_supportsPromisesis true when the Property's value is the text "Full", whoever made the String that holds it.What changed
JavaScriptBuilderElement.getSupportsPromisescompares with"Full".equals(supportsPromisesValue.getValue())at line 440. One line of package code. No public name is removed or renamed. Thecatchbelow it is unchanged, so every exit of the method still sets the flag.Before you upgrade
A browser whose
Promisevalue is "Full" now gets the script's promise form, where it got the form for a browser without promises. Anything that compared the script byte for byte for such a browser sees a different script.Released tests
The draft changes no released test. The released JavaScript Builder test classes on
mainareCookieTests,JavaScriptBuilderElementBuilderTests,JavaScriptBuilderTests,JavaScriptObjectNameTests,JavaScriptUrlTests,SessionIdAndSequenceTestsand theflowelementstests, and all of them passed in the build of the head below.Tests
JavaScriptBuilderPromiseTests.PromiseFull_MadeAtRunTime_GivesThePromiseForm, new, renders the script for a request whosePromiseis "Full" made at run time (new StringBuilder("Fu").append("ll")), for the literal "Full" and for "None". It checks the literal gives a different script from "None", so the test can see the promise form, and that "Full" made at run time gives the same script as the literal. It mocks the Flow Data and needs no browser, because the existingJavaScriptBuilderTestsclass is skipped where there is no Chrome driver.Red and green, run 43911806420 on
tmp/red-promise. At the test commit 4c75843 the test failed with "Full made at run time did not give the promise form.", the first assertion having passed. At the fix 7fd9ea0 it passed, 1 of 1.Build of the head
Run 43952784482 on
tmp/pr-matrix-194y(workflow commit ac6d36e onrc820a544) built the head b6c613f, as theSetting 'PullRequestSha'line of its Windows Java 21 job names, on nine configurations, Ubuntu x64 with Java 8, 11, 17 and 21, Ubuntu arm64 with Java 17, and Windows with Java 8, 11, 17 and 21. macOS was left out, and therchead is built with macOS before it merges intomain.device-detection.hash.engine.on-premise, a module this draft does not touch. ThereDataRefreshTests.Refresh_FromSeveralThreads_EngineStillWorksreported "java.lang.RuntimeException: Insufficient memory allocated for the operation" and the forked Java process then stopped ("The forked VM terminated without properly saying goodbye"). That test came in withrc, andrchas changed its file since 820a544.JavaScriptBuilderPromiseTests1 run and 0 failures, and every other JavaScript Builder test class passing (JavaScriptBuilderTests15 run, none skipped,JavaScriptMinifyTests22 run).The tests of what this draft touches are green on the head.
Base branch
Branched from
rc81e3d4a, withrc820a544 merged in at b6c613f. That merge brought in #178, which minifies the script by default, so the build above shows the promise form is chosen with minification on.Changes at this head
One commit follows the fix, 7fd9ea0.
rc820a544 in, which brings #178 and its default minification of the script. The build of the head above showsJavaScriptBuilderPromiseTestspassing with minification on, so the promise form is still chosen for "Full" made at run time once the script is minified.What remains
Nothing in this draft. The Windows Java 21 failure is in the data refresh test from several threads that
rcalready holds, not in anything this draft changes.