tc39 / tc39/test262

Tests for exotic global objects

Open
#538 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs follow-up
Dominant language
JavaScript
Stars
2.8k
Forks
564
Avg merge
3d 7h
Merged PRs (30d)
10

Description

ES2015 accounts for abrupt completions returned by every call to the global object's essential internal methods. For example, from HasRestrictedGlobalProperty:

  1. Let existingProp be globalObject.[GetOwnProperty].
  2. ReturnIfAbrupt(existingProp).

This is because the global object may be an exotic object, as specified by the first step of InitializeHostDefinedRealm:

  1. If this implementation requires use of an exotic object to serve as
    realm's global object, let global be such an object created in an
    implementation defined manner. Otherwise, let global be undefined
    indicating that an ordinary object should be created as the global object.

Test262 should assert correct behavior for such exotic global objects. This will require a new "helper" function such as $CREATE_REALM(globalObject). Similar to print, hosts would be required to provide an implementation prior to test execution.

But taking a step back, I'm having trouble thinking of a use case for this functionality. My worry is that many (most?) implementers have no need for exotic global objects, and therefore would ignore this aspect of the specification (and any tests for it).

Understanding the use case (and the likelihood of compliance) goes beyond the scope of the specification itself, but that perspective is necessary to properly prioritize test-writing efforts in this area. @bterlson and/or @allenwb: do you have a moment to offer your thoughts on this?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with issue #538 and the cited ES2015 sections, especially HasRestrictedGlobalProperty and InitializeHostDefinedRealm. Review how existing host-provided helpers such as print are specified, then determine the scope of a proposed $CREATE_REALM(globalObject) helper. Done would mean agreed use cases and tests that assert correct behavior for exotic global objects.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.