Git Product home page Git Product logo

deno_test262's People

Contributors

andreubot avatar andreubotella avatar

Stargazers

 avatar  avatar

Watchers

 avatar

deno_test262's Issues

Implement the `$262` properties

$262 is a host-defined object that must exist as a property of the global object in test262 tests, and which allows it to test a number of things in the TC39 specification that can't be merely triggered from JS alone:

  • $262.createRealm(). Not currently implementable because Deno doesn't support realms.
  • $262.detachArrayBuffer(). #28
  • $262.evalScript(). #22
  • $262.gc()
  • $262.global
  • $262.IsHTMLDDA. Not implementable because Deno doesn't support the DOM or document.all.
  • $262.agent.start(). #30
  • $262.agent.broadcast(). #55
  • $262.agent.getReport()
  • $262.agent.sleep()
  • $262.agent.monotonicNow()

Implement agents and `$262.agent.start()`

Test262's $262.agent APIs deal with running code in a different agent, in order to test SharedArrayBuffer, Atomics and similar APIs. In Deno the only way to have multiple agents is with workers.

The $262.agent.start() function must start an agent and block until the script passed as the first parameter is running in the agent. The only way to block until the worker is running is by sending a SharedArrayBuffer with worker.postMessage() and using Atomics.wait() to block on it โ€“ with the worker only running the code in the message event listener, after unblocking and notifying the main thread.

Since the global object inside agents created with $262.agent.start() must also be modified before the code can run (see #31), it would seem like the best solution for both things is to have an agent-setup.js file that serves as the workers' main module, and which sets up the global object and listens for the message event. The code to run in the agent is then passed as part of the first message, along with the SharedArrayBuffer.

A test fails because the `--location` flag isn't set

The built-ins/Object/defineProperties/15.2.3.7-2-18.js test fails with:

Test262Error {
  message: 'Expected TypeError, got ReferenceError: Access to "location", run again with --location <href>.'
}

This is because the test runs Object.defineProperties(obj, this), where this is the global object, and Object.defineProperties() gets all of the second argument's properties, including globalThis.location, which throws when getting if the --location argument isn't passed.

This can't be worked around by deleting globalThis.location in the test runner because globalThis.location is non-configurable (due to the LegacyUnforgeable WebIDL attribute). The only way to work around this seems to be to set the --location flag to a dummy URL, like http://example.com

Implement `$262.detachArrayBuffer()`

Transferring ArrayBuffer objects was enabled in denoland/deno#11840, and it will land on Deno 1.14. This will allow detaching ArrayBuffers, which will let us implement this host-defined function required by test262.

Here's an example of detaching an ArrayBuffer in the current Deno canary:

> let buffer = new ArrayBuffer(1024);
undefined
> structuredClone(undefined, {transfer: [buffer]})
undefined
> new Uint8Array(buffer)
Uncaught TypeError: Cannot perform Construct on a detached ArrayBuffer
    at new Uint8Array (<anonymous>)
    at <anonymous>:2:1

Implement the functions in an agent's `$262.agent`

Inside an agent created with $262.agent.start(), there is a $262.agent object, but its properties are different functions from those in the main agent's $262.agent:

  • $262.agent.receiveBroadcast(). Counterpart to the main agent's $262.agent.broadcast(). #55
  • $262.agent.report(). Counterpart to the main agent's $262.agent.getReport().
  • $262.agent.sleep(). Same as the main agent's $262.agent.sleep().
  • $262.agent.leaving()
  • $262.agent.monotonicNow(). Same as the main agent's $262.agent.monotonicNow().

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.