Repository navigation
Compare the JavaScript Builder's Promise value as text, so a browser with promises gets the promise form - #194
Draft
jwrosewell wants to merge 3 commits into
Draft
jwrosewell wants to merge 3 commits into
jwrosewell wants to merge 3 commits into
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 dbaf099c 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
JavaScriptBuilderElementcompares with"Full".equals(supportsPromisesValue.getValue()). One line of package code. No public name is removed or renamed.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.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
Run 43911891574 built 7fd9ea0 merged with
rc81e3d4a 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. Configure and all nine Build and Test jobs passed, andJavaScriptBuilderPromiseTestspassed in all nine, read from each job's log. Each of its tenSetting 'PullRequestSha'lines names 7fd9ea0, and its Configure job printed "Left out 6 macOS entries". The run's last job, which only gathers the results, was still waiting for a runner when this was written.macOS was left out of this draft's full build under the 9 November decision. The rc head is built with macOS before it merges into main.
Base branch
Branched from
rc81e3d4a.What remains
#178 changes the same class to minify the script, in other methods, and holds the minified forms keyed on whether the browser supports promises, so with both in a browser with promises gets the minified promise form.