Use a regular expression to extract prefix URL for testharness.css.
Support using testharness.js from a worker.

This change introduces an abstraction for aspects of testharness.js that
require a DOM and adds two implementations of this abstraction:
WindowTestEnvironment and WorkerTestEnvironment. The latter is safe for
use within a web worker or a service worker.

Within a worker, the test harness can be imported via:

   importScripts('/resources/testharness.js');

Once imported, the worker can invoke tests using test(), async_test()
etc. with the following caveats:

- Test results won't be reported anywhere by default. A mechanism by which
  a client document can capture and expose test results from a worker
  will be added soon.

- Lacking common metadata usually provided via <title> and <meta>
  elements, each test much provide its own properties.

There should be no behavior change for regular testharness based tests.
Introduce promise_test().

promise_test() is similar in character to async_test() but intends to
reduce the boilerplate of writing tests for code that return promises.

It requires a function object as the first parameter. This function,
when called with a test object as its only parameter is expected to
return a thenable (a Promise or an object that supports .then and .catch
methods).

When the returned thenable fulfills, the test is considered done. If the
thenable rejects, the test fails in a manner similar to having been
terminated with an unhandled exception.
Support synthesizing tests from test results.

Introduce synthesize_tests(). This method when called with an array of
test results and a harness status creates a set of synthesized tests
that mirror the provided results.

A service worker or a web worker can run full fidelity tests and then
pass the results over to a client document. This client document can
then call synthesize_tests() to replicate the test run from the worker.
Any reporting infrastructure that's already in place can then handle the
worker's test results in the same manner as handling tests run directly
on the client document.
Clean-up extra whitespace.