Repository navigation
Refuse the Window property names the specification lists as the object name - #60
Merged
Merged
Conversation
The comment skipped arguments and read location as one of the Window properties a top level var cannot replace, where location is refused for a different reason, being that a top level var navigates the page away. Python, Go and Rust already say both.
jwrosewell
marked this pull request as ready for review
November 11, 2026 13:05
This was referenced Nov 11, 2026
Draft
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
The JavaScript builder writes the client side object's name into the script as
a top level
var, as a session storage key and inside string literals. Thelist of names it refused,
reservedObjectNamesinjavascriptbuilder.js,
held only the reserved words of the language, the three global values
Infinity,NaNandundefined, and the constructor the script defines. Aname such as
window,location,localStorageorevalwas thereforeaccepted, and in a browser a top level
varcannot replace those properties ofthe Window object, so the object would never be created.
var locationisworse, because the Window object declares
locationwith[PutForwards=href],so the assignment sets
location.hrefto the object's text,[object Object], and navigates the page away.Python, PHP, Go and Rust already refuse them, so a name a site may set in one
language was refused there and accepted here.
What the specification says
javascript-builder.md, Object name,
at the fixed commit 8aa2de01 on
rc, says a valid object name matches^[A-Za-z_$][A-Za-z0-9_$]*$and is none of the following.It also says
caches,cookieStoreanddocumentPictureInPictureexist onlyin a secure context and are refused on every page, so that whether a name is
valid does not depend on the page's scheme. And that a configured name which
is not valid MUST be refused when the element is built, using the language's
usual configuration error.
Change
javascriptbuilder.js
reservedObjectNamesgainseval,argumentsand the 28 Window propertynames the page lists, which are the same 28 names and in the same order as
51degrees-python#73
added to
RESERVED_WORDS.arguments, and says thatlocationis refused because a top level
varnavigates the page away rather thanbecause it cannot be replaced, which is the reason Python, Go and Rust give.
isValidObjectNamealready decided both routes, so both are closed by the onelist. A name that arrives as the
query.fod-js-object-nameevidence is ignoredwith a warning and the configured name is used, and a name set in the builder's
options is refused when the element is built with
objName is invalid.Nothing else changes. One comment in
callbackUrl.test.js
is wrapped to 80 columns, which the 19021bc commit did and which is left in
rather than moving the head again for a comment.
The same change in the other languages
eval,argumentsand the 28 names, same order.NET #123 and Java
#88 carry the same
change and are not mine.
Tests
objectName.test.js
adds three parameterised tests over two lists, which are the same two lists
Python #73 uses.
refusedNamesholds the 30 names the specification refuses that are notreserved words of the language. For each, a name in the evidence is ignored
with one warning and the script still builds a working
fodobject, and aname in the builder's options throws
objName is invalid.allowedNamesholdsself,frames,parent,opener,length,windows,WindowandcachesX, which are Window properties a top levelvarcan replace and near misses of refused names. Each is used as given,with no warning, and the script parses and runs.
Red. Run 43019585447,
on
tmp/node-60-red, which isrcat 8b9fc3d with this test file and nothingelse from the branch. 60 of the 86 tests failed, being the two tests for each
of the 30 refused names, and the 26 that passed are the 8 allowed names and the
tests the file already had.
Green. Run 43019785636,
on
tmp/node-60-green, which is this head. 86 of 86 passed.Full build. Run 43019649181, on
tmp/pr-matrix-60, success. Every one of its sevenSetting 'PullRequestSha'lines readsb0bd8f6df50b04a259534caddca5aea33016cd31, which is this head. Configure printed "Left out 2 macOS entries".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.
What remains
Nothing in Node. The same change in .NET and Java is in
51degrees-dotnet#123
and 51degrees-java#88.