Add samples for cross document notifications.

The test harness automatically notifies containing documents via
callbacks and cross document messaging when a test is running in a child
document. Introduce apisample11 and apisample12 that demonstrate these
notifications in action.
Introduce promise_test.

promise_test is similar to an async_test, but reduces the boilerplate
needed to write tests that use Promises. See apisample13.html for
examples that use promise_test.
Use !== to compare against 'null'
Insert missing ';'
Notify completion for incomplete tests when harness times out.

When the test harness times out, tests that haven't completed either
receive a status of NOTRUN or TIMEOUT. Callback functions registered via
add_result_callback() were only being invoked for tests that were
NOTRUN. This change invokes result callabcks for all tests which have
not completed by the time the test harness times out.
Remove extra whitespace.
Remove debugging code.
Refactor test environment specific logic into a class.

This change pull all the logic for interacting with the test environment
into a separate class. This is done in preparation for allowing web
workers to use testharness directly.
Support using testharness.js from a worker.

A test document that invokes a web worker for testing needs to call
fetch_tests_from_worker(). This sets up the client document to receive
test results.

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. The testharness sends tests results from the worker to any
connected client document that called fetch_tests_from_worker(). See
apisample14.html.

This change adds support for dedicated, shared and service workers.