Bug 1102907 - Update web-platform-tests to revision 6e35a4cd58f8fa507fc90b9d7b7ff28153759cac, a=testonly
authorJames Graham <james@hoppipolla.co.uk>
Tue, 13 Jan 2015 09:42:41 +0000
changeset 223542 b57000fb4ca3c2c0b64d92ca3ffcad42e591caed
parent 223541 c38f53efdcc97294cddaf7070eee8f29932df292
child 223543 334f3c8803403f5afa40e1bd0370456feee233e4
push id28098
push userkwierso@gmail.com
push dateWed, 14 Jan 2015 00:52:19 +0000
treeherdermozilla-central@e978b8bc5c45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1102907
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1102907 - Update web-platform-tests to revision 6e35a4cd58f8fa507fc90b9d7b7ff28153759cac, a=testonly
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/WebIDL/ecmascript-binding/es-exceptions/exceptions.html
testing/web-platform/tests/app-uri/resources/idlharness.js
testing/web-platform/tests/app-uri/resources/testharness.css
testing/web-platform/tests/app-uri/resources/testharness.js
testing/web-platform/tests/app-uri/resources/testharnessreport.js
testing/web-platform/tests/content-security-policy/support/checkReport.sub.js
testing/web-platform/tests/docs/test-format-guidelines.md
testing/web-platform/tests/dom/nodes/Document-Element-getElementsByTagNameNS.js
testing/web-platform/tests/dom/nodes/Node-removeChild.html
testing/web-platform/tests/html/dom/documents/resource-metadata-management/document-lastModified-01.html
testing/web-platform/tests/old-tests/submission/Infraware/Session_History/resources/WebIDLParser.js
testing/web-platform/tests/old-tests/submission/Infraware/Session_History/resources/apisample.htm
testing/web-platform/tests/old-tests/submission/Infraware/Session_History/resources/apisample2.htm
testing/web-platform/tests/old-tests/submission/Infraware/Session_History/resources/apisample3.htm
testing/web-platform/tests/old-tests/submission/Infraware/Session_History/resources/idlharness.js
testing/web-platform/tests/old-tests/submission/Infraware/Session_History/resources/readme.md
testing/web-platform/tests/old-tests/submission/Infraware/Session_History/resources/testharness.css
testing/web-platform/tests/old-tests/submission/Infraware/Session_History/resources/testharness.js
testing/web-platform/tests/old-tests/submission/Infraware/Session_History/resources/testharnessreport.js
testing/web-platform/tests/resource-timing/test_resource_timing.js
testing/web-platform/tests/serve.py
testing/web-platform/tests/tools/scripts/manifest.py
testing/web-platform/tests/workers/semantics/interface-objects/001.html
testing/web-platform/tests/workers/semantics/interface-objects/001.worker.js
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -999,28 +999,16 @@
       },
       {
         "url": "/app-uri/resources/icons/w3c-16.png"
       },
       {
         "url": "/app-uri/resources/icons/w3c-48.png"
       },
       {
-        "url": "/app-uri/resources/idlharness.js"
-      },
-      {
-        "url": "/app-uri/resources/testharness.css"
-      },
-      {
-        "url": "/app-uri/resources/testharness.js"
-      },
-      {
-        "url": "/app-uri/resources/testharnessreport.js"
-      },
-      {
         "url": "/battery-status/battery-interface.js"
       },
       {
         "url": "/battery-status/countdown.js"
       },
       {
         "url": "/battery-status/prime.js"
       },
@@ -2775,34 +2763,16 @@
       },
       {
         "url": "/notifications/README.md"
       },
       {
         "url": "/old-tests/submission/Infraware/Session_History/contents/Session_History/css/result.css"
       },
       {
-        "url": "/old-tests/submission/Infraware/Session_History/resources/WebIDLParser.js"
-      },
-      {
-        "url": "/old-tests/submission/Infraware/Session_History/resources/idlharness.js"
-      },
-      {
-        "url": "/old-tests/submission/Infraware/Session_History/resources/readme.md"
-      },
-      {
-        "url": "/old-tests/submission/Infraware/Session_History/resources/testharness.css"
-      },
-      {
-        "url": "/old-tests/submission/Infraware/Session_History/resources/testharness.js"
-      },
-      {
-        "url": "/old-tests/submission/Infraware/Session_History/resources/testharnessreport.js"
-      },
-      {
         "url": "/old-tests/submission/Microsoft/dragdrop/dragdrop_support.js"
       },
       {
         "url": "/old-tests/submission/Microsoft/images/blue-area.png"
       },
       {
         "url": "/old-tests/submission/Microsoft/images/blue-border.png"
       },
@@ -4284,16 +4254,19 @@
       },
       {
         "url": "/workers/semantics/encodings/002.html.headers"
       },
       {
         "url": "/workers/semantics/encodings/003-1.py"
       },
       {
+        "url": "/workers/semantics/interface-objects/001.worker.js"
+      },
+      {
         "url": "/workers/semantics/multiple-workers/004-2.js"
       },
       {
         "url": "/workers/semantics/multiple-workers/006-1.js"
       },
       {
         "url": "/workers/semantics/structured-clone/common.js"
       },
@@ -17274,19 +17247,16 @@
       },
       {
         "url": "/workers/semantics/encodings/003.html"
       },
       {
         "url": "/workers/semantics/encodings/004.html"
       },
       {
-        "url": "/workers/semantics/interface-objects/001.html"
-      },
-      {
         "url": "/workers/semantics/interface-objects/002.html"
       },
       {
         "url": "/workers/semantics/interface-objects/003.html"
       },
       {
         "url": "/workers/semantics/interface-objects/004.html"
       },
@@ -17923,11 +17893,11 @@
         "path": "webdriver/user_input/clear_test.py"
       }
     ]
   },
   "local_changes": {
     "deleted": [],
     "items": {}
   },
-  "rev": "a84b794c43954b4465eb9b967cc934875952fc40",
+  "rev": "6e35a4cd58f8fa507fc90b9d7b7ff28153759cac",
   "url_base": "/"
 }
\ No newline at end of file
--- a/testing/web-platform/tests/WebIDL/ecmascript-binding/es-exceptions/exceptions.html
+++ b/testing/web-platform/tests/WebIDL/ecmascript-binding/es-exceptions/exceptions.html
@@ -14,123 +14,123 @@
  *
  * We don't go out of our way to test everything that's already tested by
  * interfaces.html, like whether all constants are present on the object, but
  * some things are duplicated.
  */
 setup({explicit_done: true});
 
 function testException(exception, global, desc) {
-	// https://heycam.github.io/webidl/#es-exception-objects
-	// (as of 2015-01-03): "The value of the internal [[Prototype]] property of a
-	// DOMException object MUST be the DOMException prototype object from the
-	// global environment the exception object is associated with."
-	test(function() {
-		assert_equals(global.Object.getPrototypeOf(exception),
-		              global.DOMException.prototype);
-	}, desc + "Object.getPrototypeOf(exception) === DOMException.prototype");
+  // https://heycam.github.io/webidl/#es-exception-objects
+  // (as of 2015-01-03): "The value of the internal [[Prototype]] property of a
+  // DOMException object MUST be the DOMException prototype object from the
+  // global environment the exception object is associated with."
+  test(function() {
+    assert_equals(global.Object.getPrototypeOf(exception),
+                  global.DOMException.prototype);
+  }, desc + "Object.getPrototypeOf(exception) === DOMException.prototype");
 
 
-	// https://heycam.github.io/webidl/#es-creating-throwing-exceptions
-	// (as of 2015-01-03): "Call the [[DefineOwnProperty]] internal method of /O/
-	// passing “name”, Property Descriptor { [[Value]]: /N/, [[Writable]]: true,
-	// [[Enumerable]]: true, [[Configurable]]: true }, and false as arguments."
-	test(function() {
-		assert_true(exception.hasOwnProperty("name"));
-	}, desc + "exception.hasOwnProperty(\"name\")");
+  // https://heycam.github.io/webidl/#es-creating-throwing-exceptions
+  // (as of 2015-01-03): "Call the [[DefineOwnProperty]] internal method of /O/
+  // passing “name”, Property Descriptor { [[Value]]: /N/, [[Writable]]: true,
+  // [[Enumerable]]: true, [[Configurable]]: true }, and false as arguments."
+  test(function() {
+    assert_true(exception.hasOwnProperty("name"));
+  }, desc + "exception.hasOwnProperty(\"name\")");
 
-	test(function() {
-		assert_equals(exception.name, "HierarchyRequestError");
-	}, desc + "exception.name === \"HierarchyRequestError\"");
+  test(function() {
+    assert_equals(exception.name, "HierarchyRequestError");
+  }, desc + "exception.name === \"HierarchyRequestError\"");
 
-	test(function() {
-		var desc = global.Object.getOwnPropertyDescriptor(exception, "name");
-		assert_true(desc.writable, "must be writable");
-		assert_true(desc.enumerable, "must be enumerable");
-		assert_true(desc.configurable, "must be configurable");
-	}, desc + "Object.getOwnPropertyDescriptor(exception, \"name\")");
+  test(function() {
+    var desc = global.Object.getOwnPropertyDescriptor(exception, "name");
+    assert_true(desc.writable, "must be writable");
+    assert_true(desc.enumerable, "must be enumerable");
+    assert_true(desc.configurable, "must be configurable");
+  }, desc + "Object.getOwnPropertyDescriptor(exception, \"name\")");
 
 
-	// https://heycam.github.io/webidl/#es-creating-throwing-exceptions
-	// (as of 2015-01-03): "If the optional user agent-defined message /M/ was
-	// specified, then this list has a single element whose value is the result
-	// of converting /M/ to a String value. Otherwise, the list is empty."
-	//
-	// https://heycam.github.io/webidl/#es-DOMException-constructor-object
-	// (as of 2015-01-03): "Call the [[DefineOwnProperty]] internal method of /O/
-	// passing “message”, Property Descriptor { [[Value]]: /S/,
-	// [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }, and
-	// false as arguments."
-	test(function() {
-		if (exception.hasOwnProperty("message")) {
-			var desc = global.Object.getOwnPropertyDescriptor(exception, "message");
-			assert_true(desc.writable, "must be writable");
-			assert_false(desc.enumerable, "must not be enumerable");
-			assert_true(desc.configurable, "must be configurable");
-		}
-	}, desc + "Object.getOwnPropertyDescriptor(exception, \"message\")");
+  // https://heycam.github.io/webidl/#es-creating-throwing-exceptions
+  // (as of 2015-01-03): "If the optional user agent-defined message /M/ was
+  // specified, then this list has a single element whose value is the result
+  // of converting /M/ to a String value. Otherwise, the list is empty."
+  //
+  // https://heycam.github.io/webidl/#es-DOMException-constructor-object
+  // (as of 2015-01-03): "Call the [[DefineOwnProperty]] internal method of /O/
+  // passing “message”, Property Descriptor { [[Value]]: /S/,
+  // [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }, and
+  // false as arguments."
+  test(function() {
+    if (exception.hasOwnProperty("message")) {
+      var desc = global.Object.getOwnPropertyDescriptor(exception, "message");
+      assert_true(desc.writable, "must be writable");
+      assert_false(desc.enumerable, "must not be enumerable");
+      assert_true(desc.configurable, "must be configurable");
+    }
+  }, desc + "Object.getOwnPropertyDescriptor(exception, \"message\")");
 
-	test(function() {
-		if (exception.hasOwnProperty("message")) {
-			// Can't test anything more specific, since it's implementation-defined :(
-			assert_equals(typeof exception.message, "string");
-		} else {
-			// Error.prototype.message
-			assert_equals(exception.message, "");
-		}
-	}, desc + "typeof exception.message === \"string\"");
+  test(function() {
+    if (exception.hasOwnProperty("message")) {
+      // Can't test anything more specific, since it's implementation-defined :(
+      assert_equals(typeof exception.message, "string");
+    } else {
+      // Error.prototype.message
+      assert_equals(exception.message, "");
+    }
+  }, desc + "typeof exception.message === \"string\"");
 
 
-	// https://heycam.github.io/webidl/#es-exception-objects
-	// (as of 2015-01-03): "The class string of a DOMException object MUST be
-	// “DOMException”."
-	test(function() {
-		assert_equals(global.Object.prototype.toString.call(exception),
-					  "[object DOMException]");
-	}, desc + "Object.prototype.toString.call(exception) === \"[object DOMException]\"");
+  // https://heycam.github.io/webidl/#es-exception-objects
+  // (as of 2015-01-03): "The class string of a DOMException object MUST be
+  // “DOMException”."
+  test(function() {
+    assert_equals(global.Object.prototype.toString.call(exception),
+                  "[object DOMException]");
+  }, desc + "Object.prototype.toString.call(exception) === \"[object DOMException]\"");
 
 
-	// https://heycam.github.io/webidl/#es-creating-throwing-exceptions
-	// (as of 2015-01-03): "Call the [[DefineOwnProperty]] internal method of /O/
-	// passing “code”, Property Descriptor { [[Value]]: /code/,
-	// [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true }, and
-	// false as arguments."
-	test(function() {
-		assert_equals(exception.code, global.DOMException.HIERARCHY_REQUEST_ERR);
-	}, desc + "exception.code === DOMException.HIERARCHY_REQUEST_ERR");
+  // https://heycam.github.io/webidl/#es-creating-throwing-exceptions
+  // (as of 2015-01-03): "Call the [[DefineOwnProperty]] internal method of /O/
+  // passing “code”, Property Descriptor { [[Value]]: /code/,
+  // [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true }, and
+  // false as arguments."
+  test(function() {
+    assert_equals(exception.code, global.DOMException.HIERARCHY_REQUEST_ERR);
+  }, desc + "exception.code === DOMException.HIERARCHY_REQUEST_ERR");
 
-	test(function() {
-		var desc = global.Object.getOwnPropertyDescriptor(exception, "name");
-		assert_true(desc.writable, "must be writable");
-		assert_true(desc.enumerable, "must be enumerable");
-		assert_true(desc.configurable, "must be configurable");
-	}, desc + "Object.getOwnPropertyDescriptor(exception, \"code\")");
+  test(function() {
+    var desc = global.Object.getOwnPropertyDescriptor(exception, "name");
+    assert_true(desc.writable, "must be writable");
+    assert_true(desc.enumerable, "must be enumerable");
+    assert_true(desc.configurable, "must be configurable");
+  }, desc + "Object.getOwnPropertyDescriptor(exception, \"code\")");
 }
 
 
 // Test in current window
 var exception = null;
 try {
-	// This should throw a HierarchyRequestError in every browser since the
-	// Stone Age, so we're really only testing exception-throwing details.
-	document.documentElement.appendChild(document);
+  // This should throw a HierarchyRequestError in every browser since the
+  // Stone Age, so we're really only testing exception-throwing details.
+  document.documentElement.appendChild(document);
 } catch(e) {
-	exception = e;
+  exception = e;
 }
 testException(exception, window, "");
 
 // Test in iframe
 var iframe = document.createElement("iframe");
 iframe.src = "about:blank";
 iframe.onload = function() {
-	var exception = null;
-	try {
-		iframe.contentDocument.documentElement.appendChild(iframe.contentDocument);
-	} catch(e) {
-		exception = e;
-	}
-	testException(exception, iframe.contentWindow, "In iframe: ");
+  var exception = null;
+  try {
+    iframe.contentDocument.documentElement.appendChild(iframe.contentDocument);
+  } catch(e) {
+    exception = e;
+  }
+  testException(exception, iframe.contentWindow, "In iframe: ");
 
-	document.body.removeChild(iframe);
-	done();
+  document.body.removeChild(iframe);
+  done();
 };
 document.body.appendChild(iframe);
 </script>
deleted file mode 100644
--- a/testing/web-platform/tests/app-uri/resources/idlharness.js
+++ /dev/null
@@ -1,1837 +0,0 @@
-/*
-Distributed under both the W3C Test Suite License [1] and the W3C
-3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
-policies and contribution forms [3].
-
-[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
-[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
-[3] http://www.w3.org/2004/10/27-testcases
-*/
-
-/*
- * This file automatically generates browser tests for WebIDL interfaces, using
- * the testharness.js framework.  To use, first include the following:
- *
- *   <script src=/resources/testharness.js></script>
- *   <script src=/resources/testharnessreport.js></script>
- *   <script src=/resources/webidl2.js></script>
- *   <script src=/resources/idlharness.js></script>
- *
- * Then you'll need some type of IDLs.  Here's some script that can be run on a
- * spec written in HTML, which will grab all the elements with class="idl",
- * concatenate them, and replace the body so you can copy-paste:
- *
-     var s = "";
-     [].forEach.call(document.getElementsByClassName("idl"), function(idl) {
-       //https://www.w3.org/Bugs/Public/show_bug.cgi?id=14914
-       if (!idl.classList.contains("extract"))
-       {
-         s += idl.textContent + "\n\n";
-       }
-     });
-     document.body.innerHTML = '<pre></pre>';
-     document.body.firstChild.textContent = s;
- *
- * (TODO: write this in Python or something so that it can be done from the
- * command line instead.)
- *
- * Once you have that, put it in your script somehow.  The easiest way is to
- * embed it literally in an HTML file with <script type=text/plain> or similar,
- * so that you don't have to do any escaping.  Another possibility is to put it
- * in a separate .idl file that's fetched via XHR or similar.  Sample usage:
- *
- *   var idl_array = new IdlArray();
- *   idl_array.add_untested_idls("interface Node { readonly attribute DOMString nodeName; };");
- *   idl_array.add_idls("interface Document : Node { readonly attribute DOMString URL; };");
- *   idl_array.add_objects({Document: ["document"]});
- *   idl_array.test();
- *
- * This tests that window.Document exists and meets all the requirements of
- * WebIDL.  It also tests that window.document (the result of evaluating the
- * string "document") has URL and nodeName properties that behave as they
- * should, and otherwise meets WebIDL's requirements for an object whose
- * primary interface is Document.  It does not test that window.Node exists,
- * which is what you want if the Node interface is already tested in some other
- * specification's suite and your specification only extends or refers to it.
- * Of course, each IDL string can define many different things, and calls to
- * add_objects() can register many different objects for different interfaces:
- * this is a very simple example.
- *
- * TODO: Write assert_writable, assert_enumerable, assert_configurable and
- * their inverses, and use those instead of just checking
- * getOwnPropertyDescriptor.
- *
- * == Public methods of IdlArray ==
- *
- * IdlArray objects can be obtained with new IdlArray().  Anything not
- * documented in this section should be considered an implementation detail,
- * and outside callers should not use it.
- *
- * add_idls(idl_string):
- *   Parses idl_string (throwing on parse error) and adds the results to the
- *   IdlArray.  All the definitions will be tested when you run test().  If
- *   some of the definitions refer to other definitions, those must be present
- *   too.  For instance, if idl_string says that Document inherits from Node,
- *   the Node interface must also have been provided in some call to add_idls()
- *   or add_untested_idls().
- *
- * add_untested_idls(idl_string):
- *   Like add_idls(), but the definitions will not be tested.  If an untested
- *   interface is added and then extended with a tested partial interface, the
- *   members of the partial interface will still be tested.  Also, all the
- *   members will still be tested for objects added with add_objects(), because
- *   you probably want to test that (for instance) window.document has all the
- *   properties from Node, not just Document, even if the Node interface itself
- *   is tested in a different test suite.
- *
- * add_objects(dict):
- *   dict should be an object whose keys are the names of interfaces or
- *   exceptions, and whose values are arrays of strings.  When an interface or
- *   exception is tested, every string registered for it with add_objects()
- *   will be evaluated, and tests will be run on the result to verify that it
- *   correctly implements that interface or exception.  This is the only way to
- *   test anything about [NoInterfaceObject] interfaces, and there are many
- *   tests that can't be run on any interface without an object to fiddle with.
- *
- *   The interface has to be the *primary* interface of all the objects
- *   provided.  For example, don't pass {Node: ["document"]}, but rather
- *   {Document: ["document"]}.  Assuming the Document interface was declared to
- *   inherit from Node, this will automatically test that document implements
- *   the Node interface too.
- *
- *   Warning: methods will be called on any provided objects, in a manner that
- *   WebIDL requires be safe.  For instance, if a method has mandatory
- *   arguments, the test suite will try calling it with too few arguments to
- *   see if it throws an exception.  If an implementation incorrectly runs the
- *   function instead of throwing, this might have side effects, possibly even
- *   preventing the test suite from running correctly.
- *
- * prevent_multiple_testing(name):
- *   This is a niche method for use in case you're testing many objects that
- *   implement the same interfaces, and don't want to retest the same
- *   interfaces every single time.  For instance, HTML defines many interfaces
- *   that all inherit from HTMLElement, so the HTML test suite has something
- *   like
- *     .add_objects({
- *         HTMLHtmlElement: ['document.documentElement'],
- *         HTMLHeadElement: ['document.head'],
- *         HTMLBodyElement: ['document.body'],
- *         ...
- *     })
- *   and so on for dozens of element types.  This would mean that it would
- *   retest that each and every one of those elements implements HTMLElement,
- *   Element, and Node, which would be thousands of basically redundant tests.
- *   The test suite therefore calls prevent_multiple_testing("HTMLElement").
- *   This means that once one object has been tested to implement HTMLElement
- *   and its ancestors, no other object will be.  Thus in the example code
- *   above, the harness would test that document.documentElement correctly
- *   implements HTMLHtmlElement, HTMLElement, Element, and Node; but
- *   document.head would only be tested for HTMLHeadElement, and so on for
- *   further objects.
- *
- * test():
- *   Run all tests.  This should be called after you've called all other
- *   methods to add IDLs and objects.
- */
-
-/**
- * Notes for people who want to edit this file (not just use it as a library):
- *
- * Most of the interesting stuff happens in the derived classes of IdlObject,
- * especially IdlInterface.  The entry point for all IdlObjects is .test(),
- * which is called by IdlArray.test().  An IdlObject is conceptually just
- * "thing we want to run tests on", and an IdlArray is an array of IdlObjects
- * with some additional data thrown in.
- *
- * The object model is based on what WebIDLParser.js produces, which is in turn
- * based on its pegjs grammar.  If you want to figure out what properties an
- * object will have from WebIDLParser.js, the best way is to look at the
- * grammar:
- *
- *   https://github.com/darobin/webidl.js/blob/master/lib/grammar.peg
- *
- * So for instance:
- *
- *   // interface definition
- *   interface
- *       =   extAttrs:extendedAttributeList? S? "interface" S name:identifier w herit:ifInheritance? w "{" w mem:ifMember* w "}" w ";" w
- *           { return { type: "interface", name: name, inheritance: herit, members: mem, extAttrs: extAttrs }; }
- *
- * This means that an "interface" object will have a .type property equal to
- * the string "interface", a .name property equal to the identifier that the
- * parser found, an .inheritance property equal to either null or the result of
- * the "ifInheritance" production found elsewhere in the grammar, and so on.
- * After each grammatical production is a JavaScript function in curly braces
- * that gets called with suitable arguments and returns some JavaScript value.
- *
- * (Note that the version of WebIDLParser.js we use might sometimes be
- * out-of-date or forked.)
- *
- * The members and methods of the classes defined by this file are all at least
- * briefly documented, hopefully.
- */
-(function(){
-"use strict";
-/// Helpers ///
-function constValue (cnt) {
-    if (cnt.type === "null") return null;
-    if (cnt.type === "NaN") return NaN;
-    if (cnt.type === "Infinity") return cnt.negative ? -Infinity : Infinity;
-    return cnt.value;
-}
-
-/// IdlArray ///
-// Entry point
-window.IdlArray = function()
-//@{
-{
-    /**
-     * A map from strings to the corresponding named IdlObject, such as
-     * IdlInterface or IdlException.  These are the things that test() will run
-     * tests on.
-     */
-    this.members = {};
-
-    /**
-     * A map from strings to arrays of strings.  The keys are interface or
-     * exception names, and are expected to also exist as keys in this.members
-     * (otherwise they'll be ignored).  This is populated by add_objects() --
-     * see documentation at the start of the file.  The actual tests will be
-     * run by calling this.members[name].test_object(obj) for each obj in
-     * this.objects[name].  obj is a string that will be eval'd to produce a
-     * JavaScript value, which is supposed to be an object implementing the
-     * given IdlObject (interface, exception, etc.).
-     */
-    this.objects = {};
-
-    /**
-     * When adding multiple collections of IDLs one at a time, an earlier one
-     * might contain a partial interface or implements statement that depends
-     * on a later one.  Save these up and handle them right before we run
-     * tests.
-     *
-     * .partials is simply an array of objects from WebIDLParser.js'
-     * "partialinterface" production.  .implements maps strings to arrays of
-     * strings, such that
-     *
-     *   A implements B;
-     *   A implements C;
-     *   D implements E;
-     *
-     * results in { A: ["B", "C"], D: ["E"] }.
-     */
-    this.partials = [];
-    this["implements"] = {};
-};
-
-//@}
-IdlArray.prototype.add_idls = function(raw_idls)
-//@{
-{
-    /** Entry point.  See documentation at beginning of file. */
-    this.internal_add_idls(WebIDL2.parse(raw_idls));
-};
-
-//@}
-IdlArray.prototype.add_untested_idls = function(raw_idls)
-//@{
-{
-    /** Entry point.  See documentation at beginning of file. */
-    var parsed_idls = WebIDL2.parse(raw_idls);
-    for (var i = 0; i < parsed_idls.length; i++)
-    {
-        parsed_idls[i].untested = true;
-        if ("members" in parsed_idls[i])
-        {
-            for (var j = 0; j < parsed_idls[i].members.length; j++)
-            {
-                parsed_idls[i].members[j].untested = true;
-            }
-        }
-    }
-    this.internal_add_idls(parsed_idls);
-};
-
-//@}
-IdlArray.prototype.internal_add_idls = function(parsed_idls)
-//@{
-{
-    /**
-     * Internal helper called by add_idls() and add_untested_idls().
-     * parsed_idls is an array of objects that come from WebIDLParser.js's
-     * "definitions" production.  The add_untested_idls() entry point
-     * additionally sets an .untested property on each object (and its
-     * .members) so that they'll be skipped by test() -- they'll only be
-     * used for base interfaces of tested interfaces, return types, etc.
-     */
-    parsed_idls.forEach(function(parsed_idl)
-    {
-        if (parsed_idl.type == "interface" && parsed_idl.partial)
-        {
-            this.partials.push(parsed_idl);
-            return;
-        }
-
-        if (parsed_idl.type == "implements")
-        {
-            if (!(parsed_idl.target in this["implements"]))
-            {
-                this["implements"][parsed_idl.target] = [];
-            }
-            this["implements"][parsed_idl.target].push(parsed_idl["implements"]);
-            return;
-        }
-
-        parsed_idl.array = this;
-        if (parsed_idl.name in this.members)
-        {
-            throw "Duplicate identifier " + parsed_idl.name;
-        }
-        switch(parsed_idl.type)
-        {
-        case "interface":
-            this.members[parsed_idl.name] = new IdlInterface(parsed_idl);
-            break;
-
-        case "exception":
-            this.members[parsed_idl.name] = new IdlException(parsed_idl);
-            break;
-
-        case "dictionary":
-            // Nothing to test, but we need the dictionary info around for type
-            // checks
-            this.members[parsed_idl.name] = new IdlDictionary(parsed_idl);
-            break;
-
-        case "typedef":
-            // TODO
-            console.log("typedef not yet supported");
-            break;
-
-        case "callback":
-            // TODO
-            console.log("callback not yet supported");
-            break;
-
-        case "enum":
-            this.members[parsed_idl.name] = new IdlEnum(parsed_idl);
-            break;
-
-        case "callback":
-            // TODO
-            break;
-
-        default:
-            throw parsed_idl.name + ": " + parsed_idl.type + " not yet supported";
-        }
-    }.bind(this));
-};
-
-//@}
-IdlArray.prototype.add_objects = function(dict)
-//@{
-{
-    /** Entry point.  See documentation at beginning of file. */
-    for (var k in dict)
-    {
-        if (k in this.objects)
-        {
-            this.objects[k] = this.objects[k].concat(dict[k]);
-        }
-        else
-        {
-            this.objects[k] = dict[k];
-        }
-    }
-};
-
-//@}
-IdlArray.prototype.prevent_multiple_testing = function(name)
-//@{
-{
-    /** Entry point.  See documentation at beginning of file. */
-    this.members[name].prevent_multiple_testing = true;
-};
-
-//@}
-IdlArray.prototype.recursively_get_implements = function(interface_name)
-//@{
-{
-    /**
-     * Helper function for test().  Returns an array of things that implement
-     * interface_name, so if the IDL contains
-     *
-     *   A implements B;
-     *   B implements C;
-     *   B implements D;
-     *
-     * then recursively_get_implements("A") should return ["B", "C", "D"].
-     */
-    var ret = this["implements"][interface_name];
-    if (ret === undefined)
-    {
-        return [];
-    }
-    for (var i = 0; i < this["implements"][interface_name].length; i++)
-    {
-        ret = ret.concat(this.recursively_get_implements(ret[i]));
-        if (ret.indexOf(ret[i]) != ret.lastIndexOf(ret[i]))
-        {
-            throw "Circular implements statements involving " + ret[i];
-        }
-    }
-    return ret;
-};
-
-//@}
-IdlArray.prototype.test = function()
-//@{
-{
-    /** Entry point.  See documentation at beginning of file. */
-
-    // First merge in all the partial interfaces and implements statements we
-    // encountered.
-    this.partials.forEach(function(parsed_idl)
-    {
-        if (!(parsed_idl.name in this.members)
-        || !(this.members[parsed_idl.name] instanceof IdlInterface))
-        {
-            throw "Partial interface " + parsed_idl.name + " with no original interface";
-        }
-        if (parsed_idl.extAttrs)
-        {
-            parsed_idl.extAttrs.forEach(function(extAttr)
-            {
-                this.members[parsed_idl.name].extAttrs.push(extAttr);
-            }.bind(this));
-        }
-        parsed_idl.members.forEach(function(member)
-        {
-            this.members[parsed_idl.name].members.push(new IdlInterfaceMember(member));
-        }.bind(this));
-    }.bind(this));
-    this.partials = [];
-
-    for (var lhs in this["implements"])
-    {
-        this.recursively_get_implements(lhs).forEach(function(rhs)
-        {
-            var errStr = lhs + " implements " + rhs + ", but ";
-            if (!(lhs in this.members)) throw errStr + lhs + " is undefined.";
-            if (!(this.members[lhs] instanceof IdlInterface)) throw errStr + lhs + " is not an interface.";
-            if (!(rhs in this.members)) throw errStr + rhs + " is undefined.";
-            if (!(this.members[rhs] instanceof IdlInterface)) throw errStr + rhs + " is not an interface.";
-            this.members[rhs].members.forEach(function(member)
-            {
-                this.members[lhs].members.push(new IdlInterfaceMember(member));
-            }.bind(this));
-        }.bind(this));
-    }
-    this["implements"] = {};
-
-    // Now run test() on every member, and test_object() for every object.
-    for (var name in this.members)
-    {
-        this.members[name].test();
-        if (name in this.objects)
-        {
-            this.objects[name].forEach(function(str)
-            {
-                this.members[name].test_object(str);
-            }.bind(this));
-        }
-    }
-};
-
-//@}
-IdlArray.prototype.assert_type_is = function(value, type)
-//@{
-{
-    /**
-     * Helper function that tests that value is an instance of type according
-     * to the rules of WebIDL.  value is any JavaScript value, and type is an
-     * object produced by WebIDLParser.js' "type" production.  That production
-     * is fairly elaborate due to the complexity of WebIDL's types, so it's
-     * best to look at the grammar to figure out what properties it might have.
-     */
-    if (type.idlType == "any")
-    {
-        // No assertions to make
-        return;
-    }
-
-    if (type.nullable && value === null)
-    {
-        // This is fine
-        return;
-    }
-
-    if (type.array)
-    {
-        // TODO: not supported yet
-        return;
-    }
-
-    if (type.sequence)
-    {
-        assert_true(Array.isArray(value), "is not array");
-        if (!value.length)
-        {
-            // Nothing we can do.
-            return;
-        }
-        this.assert_type_is(value[0], type.idlType.idlType);
-        return;
-    }
-
-    type = type.idlType;
-
-    switch(type)
-    {
-        case "void":
-            assert_equals(value, undefined);
-            return;
-
-        case "boolean":
-            assert_equals(typeof value, "boolean");
-            return;
-
-        case "byte":
-            assert_equals(typeof value, "number");
-            assert_equals(value, Math.floor(value), "not an integer");
-            assert_true(-128 <= value && value <= 127, "byte " + value + " not in range [-128, 127]");
-            return;
-
-        case "octet":
-            assert_equals(typeof value, "number");
-            assert_equals(value, Math.floor(value), "not an integer");
-            assert_true(0 <= value && value <= 255, "octet " + value + " not in range [0, 255]");
-            return;
-
-        case "short":
-            assert_equals(typeof value, "number");
-            assert_equals(value, Math.floor(value), "not an integer");
-            assert_true(-32768 <= value && value <= 32767, "short " + value + " not in range [-32768, 32767]");
-            return;
-
-        case "unsigned short":
-            assert_equals(typeof value, "number");
-            assert_equals(value, Math.floor(value), "not an integer");
-            assert_true(0 <= value && value <= 65535, "unsigned short " + value + " not in range [0, 65535]");
-            return;
-
-        case "long":
-            assert_equals(typeof value, "number");
-            assert_equals(value, Math.floor(value), "not an integer");
-            assert_true(-2147483648 <= value && value <= 2147483647, "long " + value + " not in range [-2147483648, 2147483647]");
-            return;
-
-        case "unsigned long":
-            assert_equals(typeof value, "number");
-            assert_equals(value, Math.floor(value), "not an integer");
-            assert_true(0 <= value && value <= 4294967295, "unsigned long " + value + " not in range [0, 4294967295]");
-            return;
-
-        case "long long":
-            assert_equals(typeof value, "number");
-            return;
-
-        case "unsigned long long":
-            assert_equals(typeof value, "number");
-            assert_true(0 <= value, "unsigned long long is negative");
-            return;
-
-        case "float":
-        case "double":
-            // TODO: distinguish these cases
-            assert_equals(typeof value, "number");
-            return;
-
-        case "DOMString":
-            assert_equals(typeof value, "string");
-            return;
-
-        case "object":
-            assert_true(typeof value == "object" || typeof value == "function", "wrong type: not object or function");
-            return;
-    }
-
-    if (!(type in this.members))
-    {
-        throw "Unrecognized type " + type;
-    }
-
-    if (this.members[type] instanceof IdlInterface)
-    {
-        // We don't want to run the full
-        // IdlInterface.prototype.test_instance_of, because that could result
-        // in an infinite loop.  TODO: This means we don't have tests for
-        // NoInterfaceObject interfaces, and we also can't test objects that
-        // come from another window.
-        assert_true(typeof value == "object" || typeof value == "function", "wrong type: not object or function");
-        if (value instanceof Object
-        && !this.members[type].has_extended_attribute("NoInterfaceObject")
-        && type in window)
-        {
-            assert_true(value instanceof window[type], "not instanceof " + type);
-        }
-    }
-    else if (this.members[type] instanceof IdlEnum)
-    {
-        assert_equals(typeof value, "string");
-    }
-    else if (this.members[type] instanceof IdlDictionary)
-    {
-        // TODO: Test when we actually have something to test this on
-    }
-    else
-    {
-        throw "Type " + type + " isn't an interface or dictionary";
-    }
-};
-//@}
-
-/// IdlObject ///
-function IdlObject() {}
-IdlObject.prototype.test = function()
-//@{
-{
-    /**
-     * By default, this does nothing, so no actual tests are run for IdlObjects
-     * that don't define any (e.g., IdlDictionary at the time of this writing).
-     */
-};
-
-//@}
-IdlObject.prototype.has_extended_attribute = function(name)
-//@{
-{
-    /**
-     * This is only meaningful for things that support extended attributes,
-     * such as interfaces, exceptions, and members.
-     */
-    return this.extAttrs.some(function(o)
-    {
-        return o.name == name;
-    });
-};
-
-//@}
-
-/// IdlDictionary ///
-// Used for IdlArray.prototype.assert_type_is
-function IdlDictionary(obj)
-//@{
-{
-    /**
-     * obj is an object produced by the WebIDLParser.js "dictionary"
-     * production.
-     */
-
-    /** Self-explanatory. */
-    this.name = obj.name;
-
-    /** An array of objects produced by the "dictionaryMember" production. */
-    this.members = obj.members;
-
-    /**
-     * The name (as a string) of the dictionary type we inherit from, or null
-     * if there is none.
-     */
-    this.base = obj.inheritance;
-}
-
-//@}
-IdlDictionary.prototype = Object.create(IdlObject.prototype);
-
-/// IdlExceptionOrInterface ///
-// Code sharing!
-function IdlExceptionOrInterface(obj)
-//@{
-{
-    /**
-     * obj is an object produced by the WebIDLParser.js "exception" or
-     * "interface" production, as appropriate.
-     */
-
-    /** Self-explanatory. */
-    this.name = obj.name;
-
-    /** A back-reference to our IdlArray. */
-    this.array = obj.array;
-
-    /**
-     * An indicator of whether we should run tests on the (exception) interface
-     * object and (exception) interface prototype object.  Tests on members are
-     * controlled by .untested on each member, not this.
-     */
-    this.untested = obj.untested;
-
-    /** An array of objects produced by the "ExtAttr" production. */
-    this.extAttrs = obj.extAttrs;
-
-    /** An array of IdlInterfaceMembers. */
-    this.members = obj.members.map(function(m){return new IdlInterfaceMember(m); });
-
-    /**
-     * The name (as a string) of the type we inherit from, or null if there is
-     * none.
-     */
-    this.base = obj.inheritance;
-}
- 
-//@}
-IdlExceptionOrInterface.prototype = Object.create(IdlObject.prototype);
-IdlExceptionOrInterface.prototype.test = function()
-//@{
-{
-    if (this.has_extended_attribute("NoInterfaceObject"))
-    {
-        // No tests to do without an instance.  TODO: We should still be able
-        // to run tests on the prototype object, if we obtain one through some
-        // other means.
-        return;
-    }
-
-    if (!this.untested)
-    {
-        // First test things to do with the exception/interface object and
-        // exception/interface prototype object.
-        this.test_self();
-    }
-    // Then test things to do with its members (constants, fields, attributes,
-    // operations, . . .).  These are run even if .untested is true, because
-    // members might themselves be marked as .untested.  This might happen to
-    // interfaces if the interface itself is untested but a partial interface
-    // that extends it is tested -- then the interface itself and its initial
-    // members will be marked as untested, but the members added by the partial
-    // interface are still tested.
-    this.test_members();
-};
-
-//@}
-
-/// IdlException ///
-function IdlException(obj) { IdlExceptionOrInterface.call(this, obj); }
-IdlException.prototype = Object.create(IdlExceptionOrInterface.prototype);
-IdlException.prototype.test_self = function()
-//@{
-{
-    test(function()
-    {
-        // "For every exception that is not declared with the
-        // [NoInterfaceObject] extended attribute, a corresponding property
-        // must exist on the exception’s relevant namespace object. The name of
-        // the property is the identifier of the exception, and its value is an
-        // object called the exception interface object, which provides access
-        // to any constants that have been associated with the exception. The
-        // property has the attributes { [[Writable]]: true, [[Enumerable]]:
-        // false, [[Configurable]]: true }."
-        assert_own_property(window, this.name,
-                            "window does not have own property " + format_value(this.name));
-        var desc = Object.getOwnPropertyDescriptor(window, this.name);
-        assert_false("get" in desc, "window's property " + format_value(this.name) + " has getter");
-        assert_false("set" in desc, "window's property " + format_value(this.name) + " has setter");
-        assert_true(desc.writable, "window's property " + format_value(this.name) + " is not writable");
-        assert_false(desc.enumerable, "window's property " + format_value(this.name) + " is enumerable");
-        assert_true(desc.configurable, "window's property " + format_value(this.name) + " is not configurable");
-
-        // "The exception interface object for a given exception must be a
-        // function object."
-        // "If an object is defined to be a function object, then it has
-        // characteristics as follows:"
-        // "Its [[Prototype]] internal property is the Function prototype
-        // object."
-        // Note: This doesn't match browsers as of December 2011, see
-        // http://www.w3.org/Bugs/Public/show_bug.cgi?id=14813
-        assert_equals(Object.getPrototypeOf(window[this.name]), Function.prototype,
-                      "prototype of window's property " + format_value(this.name) + " is not Function.prototype");
-        // "Its [[Get]] internal property is set as described in ECMA-262
-        // section 15.3.5.4."
-        // Not much to test for this.
-        // "Its [[Construct]] internal property is set as described in ECMA-262
-        // section 13.2.2."
-        // Tested below.
-        // "Its [[HasInstance]] internal property is set as described in
-        // ECMA-262 section 15.3.5.3, unless otherwise specified."
-        // TODO
-        // "Its [[Class]] internal property is “Function”."
-        // String() returns something implementation-dependent, because it
-        // calls Function#toString.
-        assert_class_string(window[this.name], "Function",
-                            "class string of " + this.name);
-
-        // TODO: Test 4.9.1.1. Exception interface object [[Call]] method
-        // (which does not match browsers:
-        // http://www.w3.org/Bugs/Public/show_bug.cgi?id=14885)
-    }.bind(this), this.name + " exception: existence and properties of exception interface object");
-
-    test(function()
-    {
-        assert_own_property(window, this.name,
-                            "window does not have own property " + format_value(this.name));
-
-        // "The exception interface object must also have a property named
-        // “prototype” with attributes { [[Writable]]: false, [[Enumerable]]:
-        // false, [[Configurable]]: false } whose value is an object called the
-        // exception interface prototype object. This object also provides
-        // access to the constants that are declared on the exception."
-        assert_own_property(window[this.name], "prototype",
-                            'exception "' + this.name + '" does not have own property "prototype"');
-        var desc = Object.getOwnPropertyDescriptor(window[this.name], "prototype");
-        assert_false("get" in desc, this.name + ".prototype has getter");
-        assert_false("set" in desc, this.name + ".prototype has setter");
-        assert_false(desc.writable, this.name + ".prototype is writable");
-        assert_false(desc.enumerable, this.name + ".prototype is enumerable");
-        assert_false(desc.configurable, this.name + ".prototype is configurable");
-
-        // "The exception interface prototype object for a given exception must
-        // have an internal [[Prototype]] property whose value is as follows:
-        //
-        // "If the exception is declared to inherit from another exception,
-        // then the value of the internal [[Prototype]] property is the
-        // exception interface prototype object for the inherited exception.
-        // "Otherwise, the exception is not declared to inherit from another
-        // exception. The value of the internal [[Prototype]] property is the
-        // Error prototype object ([ECMA-262], section 15.11.3.1)."
-        //
-        // Note: This doesn't match browsers as of December 2011, see
-        // https://www.w3.org/Bugs/Public/show_bug.cgi?id=14887.
-        var inherit_exception = this.base ? this.base : "Error";
-        assert_own_property(window, inherit_exception,
-                            'should inherit from ' + inherit_exception + ', but window has no such property');
-        assert_own_property(window[inherit_exception], "prototype",
-                            'should inherit from ' + inherit_exception + ', but that object has no "prototype" property');
-        assert_equals(Object.getPrototypeOf(window[this.name].prototype),
-                      window[inherit_exception].prototype,
-                      'prototype of ' + this.name + '.prototype is not ' + inherit_exception + '.prototype');
-
-        // "The class string of an exception interface prototype object is the
-        // concatenation of the exception’s identifier and the string
-        // “Prototype”."
-        assert_class_string(window[this.name].prototype, this.name + "Prototype",
-                            "class string of " + this.name + ".prototype");
-        // TODO: Test String(), based on ES definition of
-        // Error.prototype.toString?
-    }.bind(this), this.name + " exception: existence and properties of exception interface prototype object");
-
-    test(function()
-    {
-        assert_own_property(window, this.name,
-                            "window does not have own property " + format_value(this.name));
-        assert_own_property(window[this.name], "prototype",
-                            'interface "' + this.name + '" does not have own property "prototype"');
-
-        // "There must be a property named “name” on the exception interface
-        // prototype object with attributes { [[Writable]]: true,
-        // [[Enumerable]]: false, [[Configurable]]: true } and whose value is
-        // the identifier of the exception."
-        assert_own_property(window[this.name].prototype, "name",
-                'prototype object does not have own property "name"');
-        var desc = Object.getOwnPropertyDescriptor(window[this.name].prototype, "name");
-        assert_false("get" in desc, this.name + ".prototype.name has getter");
-        assert_false("set" in desc, this.name + ".prototype.name has setter");
-        assert_true(desc.writable, this.name + ".prototype.name is not writable");
-        assert_false(desc.enumerable, this.name + ".prototype.name is enumerable");
-        assert_true(desc.configurable, this.name + ".prototype.name is not configurable");
-        assert_equals(desc.value, this.name, this.name + ".prototype.name has incorrect value");
-    }.bind(this), this.name + " exception: existence and properties of exception interface prototype object's \"name\" property");
-
-    test(function()
-    {
-        assert_own_property(window, this.name,
-                            "window does not have own property " + format_value(this.name));
-        assert_own_property(window[this.name], "prototype",
-                            'interface "' + this.name + '" does not have own property "prototype"');
-
-        // "If the [NoInterfaceObject] extended attribute was not specified on
-        // the exception, then there must also be a property named
-        // “constructor” on the exception interface prototype object with
-        // attributes { [[Writable]]: true, [[Enumerable]]: false,
-        // [[Configurable]]: true } and whose value is a reference to the
-        // exception interface object for the exception."
-        assert_own_property(window[this.name].prototype, "constructor",
-                            this.name + '.prototype does not have own property "constructor"');
-        var desc = Object.getOwnPropertyDescriptor(window[this.name].prototype, "constructor");
-        assert_false("get" in desc, this.name + ".prototype.constructor has getter");
-        assert_false("set" in desc, this.name + ".prototype.constructor has setter");
-        assert_true(desc.writable, this.name + ".prototype.constructor is not writable");
-        assert_false(desc.enumerable, this.name + ".prototype.constructor is enumerable");
-        assert_true(desc.configurable, this.name + ".prototype.constructor in not configurable");
-        assert_equals(window[this.name].prototype.constructor, window[this.name],
-                      this.name + '.prototype.constructor is not the same object as ' + this.name);
-    }.bind(this), this.name + " exception: existence and properties of exception interface prototype object's \"constructor\" property");
-};
-
-//@}
-IdlException.prototype.test_members = function()
-//@{
-{
-    for (var i = 0; i < this.members.length; i++)
-    {
-        var member = this.members[i];
-        if (member.untested)
-        {
-            continue;
-        }
-        if (member.type == "const" && member.name != "prototype")
-        {
-            test(function()
-            {
-                assert_own_property(window, this.name,
-                                    "window does not have own property " + format_value(this.name));
-
-                // "For each constant defined on the exception, there must be a
-                // corresponding property on the exception interface object, if
-                // it exists, if the identifier of the constant is not
-                // “prototype”."
-                assert_own_property(window[this.name], member.name);
-                // "The value of the property is the ECMAScript value that is
-                // equivalent to the constant’s IDL value, according to the
-                // rules in section 4.2 above."
-                assert_equals(window[this.name][member.name], constValue(member.value),
-                              "property has wrong value");
-                // "The property has attributes { [[Writable]]: false,
-                // [[Enumerable]]: true, [[Configurable]]: false }."
-                var desc = Object.getOwnPropertyDescriptor(window[this.name], member.name);
-                assert_false("get" in desc, "property has getter");
-                assert_false("set" in desc, "property has setter");
-                assert_false(desc.writable, "property is writable");
-                assert_true(desc.enumerable, "property is not enumerable");
-                assert_false(desc.configurable, "property is configurable");
-            }.bind(this), this.name + " exception: constant " + member.name + " on exception interface object");
-            // "In addition, a property with the same characteristics must
-            // exist on the exception interface prototype object."
-            test(function()
-            {
-                assert_own_property(window, this.name,
-                                    "window does not have own property " + format_value(this.name));
-                assert_own_property(window[this.name], "prototype",
-                                    'exception "' + this.name + '" does not have own property "prototype"');
-
-                assert_own_property(window[this.name].prototype, member.name);
-                assert_equals(window[this.name].prototype[member.name], constValue(member.value),
-                              "property has wrong value");
-                var desc = Object.getOwnPropertyDescriptor(window[this.name].prototype, member.name);
-                assert_false("get" in desc, "property has getter");
-                assert_false("set" in desc, "property has setter");
-                assert_false(desc.writable, "property is writable");
-                assert_true(desc.enumerable, "property is not enumerable");
-                assert_false(desc.configurable, "property is configurable");
-            }.bind(this), this.name + " exception: constant " + member.name + " on exception interface prototype object");
-        }
-        else if (member.type == "field")
-        {
-            test(function()
-            {
-                assert_own_property(window, this.name,
-                                    "window does not have own property " + format_value(this.name));
-                assert_own_property(window[this.name], "prototype",
-                                    'exception "' + this.name + '" does not have own property "prototype"');
-
-                // "For each exception field, there must be a corresponding
-                // property on the exception interface prototype object, whose
-                // characteristics are as follows:
-                // "The name of the property is the identifier of the exception
-                // field."
-                assert_own_property(window[this.name].prototype, member.name);
-                // "The property has attributes { [[Get]]: G, [[Enumerable]]:
-                // true, [[Configurable]]: true }, where G is the exception
-                // field getter, defined below."
-                var desc = Object.getOwnPropertyDescriptor(window[this.name].prototype, member.name);
-                assert_false("value" in desc, "property descriptor has value but is supposed to be accessor");
-                assert_false("writable" in desc, 'property descriptor has "writable" field but is supposed to be accessor');
-                // TODO: ES5 doesn't seem to say whether desc should have a
-                // .set property.
-                assert_true(desc.enumerable, "property is not enumerable");
-                assert_true(desc.configurable, "property is not configurable");
-                // "The exception field getter is a Function object whose
-                // behavior when invoked is as follows:"
-                assert_equals(typeof desc.get, "function", "typeof getter");
-                // "The value of the Function object’s “length” property is the
-                // Number value 0."
-                // This test is before the TypeError tests so that it's easiest
-                // to see that Firefox 11a1 only fails one assert in this test.
-                assert_equals(desc.get.length, 0, "getter length");
-                // "Let O be the result of calling ToObject on the this value.
-                // "If O is not a platform object representing an exception for
-                // the exception on which the exception field was declared,
-                // then throw a TypeError."
-                // TODO: Test on a platform object representing an exception.
-                assert_throws(new TypeError(), function()
-                {
-                    window[this.name].prototype[member.name];
-                }.bind(this), "getting property on prototype object must throw TypeError");
-                assert_throws(new TypeError(), function()
-                {
-                    desc.get.call({});
-                }.bind(this), "calling getter on wrong object type must throw TypeError");
-            }.bind(this), this.name + " exception: field " + member.name + " on exception interface prototype object");
-        }
-    }
-};
-
-//@}
-IdlException.prototype.test_object = function(desc)
-//@{
-{
-    var obj, exception = null;
-    try
-    {
-        obj = eval(desc);
-    }
-    catch(e)
-    {
-        exception = e;
-    }
-
-    test(function()
-    {
-        assert_equals(exception, null, "Unexpected exception when evaluating object");
-        assert_equals(typeof obj, "object", "wrong typeof object");
-
-        // We can't easily test that its prototype is correct if there's no
-        // interface object, or the object is from a different global
-        // environment (not instanceof Object).  TODO: test in this case that
-        // its prototype at least looks correct, even if we can't test that
-        // it's actually correct.
-        if (!this.has_extended_attribute("NoInterfaceObject")
-        && (typeof obj != "object" || obj instanceof Object))
-        {
-            assert_own_property(window, this.name,
-                                "window does not have own property " + format_value(this.name));
-            assert_own_property(window[this.name], "prototype",
-                                'exception "' + this.name + '" does not have own property "prototype"');
-
-            // "The value of the internal [[Prototype]] property of the
-            // exception object must be the exception interface prototype
-            // object from the global environment the exception object is
-            // associated with."
-            assert_equals(Object.getPrototypeOf(obj),
-                          window[this.name].prototype,
-                          desc + "'s prototype is not " + this.name + ".prototype");
-        }
-
-        // "The class string of the exception object must be the identifier of
-        // the exception."
-        assert_class_string(obj, this.name, "class string of " + desc);
-        // Stringifier is not defined for DOMExceptions, because message isn't
-        // defined.
-    }.bind(this), this.name + " must be represented by " + desc);
-
-    for (var i = 0; i < this.members.length; i++)
-    {
-        var member = this.members[i];
-        test(function()
-        {
-            assert_equals(exception, null, "Unexpected exception when evaluating object");
-            assert_equals(typeof obj, "object", "wrong typeof object");
-            assert_inherits(obj, member.name);
-            if (member.type == "const")
-            {
-                assert_equals(obj[member.name], constValue(member.value));
-            }
-            if (member.type == "field")
-            {
-                this.array.assert_type_is(obj[member.name], member.idlType);
-            }
-        }.bind(this), this.name + " exception: " + desc + ' must inherit property "' + member.name + '" with the proper type');
-    }
-};
-//@}
-
-/// IdlInterface ///
-function IdlInterface(obj) { IdlExceptionOrInterface.call(this, obj); }
-IdlInterface.prototype = Object.create(IdlExceptionOrInterface.prototype);
-IdlInterface.prototype.is_callback = function()
-//@{
-{
-    return this.has_extended_attribute("Callback");
-};
-//@}
-
-IdlInterface.prototype.has_constants = function()
-//@{
-{
-    return this.members.any(function(member) {
-        return member.type === "const";
-    });
-};
-//@}
-
-IdlInterface.prototype.test_self = function()
-//@{
-{
-    test(function()
-    {
-        // This function tests WebIDL as of 2012-11-28.
-
-        // "For every interface that:
-        // * is a callback interface that has constants declared on it, or
-        // * is a non-callback interface that is not declared with the
-        //   [NoInterfaceObject] extended attribute,
-        // a corresponding property MUST exist on the ECMAScript global object.
-        // The name of the property is the identifier of the interface, and its
-        // value is an object called the interface object.
-        // The property has the attributes { [[Writable]]: true,
-        // [[Enumerable]]: false, [[Configurable]]: true }."
-        if (this.is_callback() && !this.has_constants()) {
-            return;
-        }
-
-        // TODO: Should we test here that the property is actually writable
-        // etc., or trust getOwnPropertyDescriptor?
-        assert_own_property(window, this.name,
-                            "window does not have own property " + format_value(this.name));
-        var desc = Object.getOwnPropertyDescriptor(window, this.name);
-        assert_false("get" in desc, "window's property " + format_value(this.name) + " has getter");
-        assert_false("set" in desc, "window's property " + format_value(this.name) + " has setter");
-        assert_true(desc.writable, "window's property " + format_value(this.name) + " is not writable");
-        assert_false(desc.enumerable, "window's property " + format_value(this.name) + " is enumerable");
-        assert_true(desc.configurable, "window's property " + format_value(this.name) + " is not configurable");
-
-        if (this.is_callback()) {
-            // "The internal [[Prototype]] property of an interface object for
-            // a callback interface MUST be the Object.prototype object."
-            assert_equals(Object.getPrototypeOf(window[this.name]), Object.prototype,
-                          "prototype of window's property " + format_value(this.name) + " is not Object.prototype");
-
-            return;
-        }
-
-        // "The interface object for a given non-callback interface is a
-        // function object."
-        // "If an object is defined to be a function object, then it has
-        // characteristics as follows:"
-
-        // "* Its [[Prototype]] internal property is the Function prototype
-        //    object."
-        assert_equals(Object.getPrototypeOf(window[this.name]), Function.prototype,
-                      "prototype of window's property " + format_value(this.name) + " is not Function.prototype");
-
-        // "* Its [[Get]] internal property is set as described in ECMA-262
-        //    section 15.3.5.4."
-        // Not much to test for this.
-
-        // "* Its [[Construct]] internal property is set as described in
-        //    ECMA-262 section 13.2.2."
-        // Tested below if no constructor is defined.  TODO: test constructors
-        // if defined.
-
-        // "* Its [[HasInstance]] internal property is set as described in
-        //    ECMA-262 section 15.3.5.3, unless otherwise specified."
-        // TODO
-
-        // "* Its [[NativeBrand]] internal property is “Function”."
-        // String() returns something implementation-dependent, because it calls
-        // Function#toString.
-        assert_class_string(window[this.name], "Function", "class string of " + this.name);
-
-        if (!this.has_extended_attribute("Constructor")) {
-            // "The internal [[Call]] method of the interface object behaves as
-            // follows . . .
-            //
-            // "If I was not declared with a [Constructor] extended attribute,
-            // then throw a TypeError."
-            assert_throws(new TypeError(), function() {
-                window[this.name]();
-            }.bind(this), "interface object didn't throw TypeError when called as a function");
-            assert_throws(new TypeError(), function() {
-                new window[this.name]();
-            }.bind(this), "interface object didn't throw TypeError when called as a constructor");
-        }
-    }.bind(this), this.name + " interface: existence and properties of interface object");
-
-    if (this.has_extended_attribute("Constructor"))
-    {
-        test(function()
-        {
-            assert_own_property(window, this.name,
-                                "window does not have own property " + format_value(this.name));
-
-            // "Interface objects for interfaces declared with a [Constructor]
-            // extended attribute must have a property named “length” with
-            // attributes { [[Writable]]: false, [[Enumerable]]: false,
-            // [[Configurable]]: false } whose value is a Number determined as
-            // follows: . . .
-            // "Return the length of the shortest argument list of the entries
-            // in S."
-            // TODO: Variadic constructors.  Should generalize this so that it
-            // works for testing operation length too (currently we just don't
-            // support multiple operations with the same identifier).
-            var expected_length = this.extAttrs
-                .filter(function(attr) { return attr.name == "Constructor"; })
-                .map(function(attr) {
-                    return attr.arguments ? attr.arguments.filter(
-                        function(arg) {
-                            return !arg.optional;
-                        }).length : 0;
-                })
-                .reduce(function(m, n) { return Math.min(m, n); });
-            assert_own_property(window[this.name], "length");
-            assert_equals(window[this.name].length, expected_length, "wrong value for " + this.name + ".length");
-            var desc = Object.getOwnPropertyDescriptor(window[this.name], "length");
-            assert_false("get" in desc, this.name + ".length has getter");
-            assert_false("set" in desc, this.name + ".length has setter");
-            assert_false(desc.writable, this.name + ".length is writable");
-            assert_false(desc.enumerable, this.name + ".length is enumerable");
-            assert_false(desc.configurable, this.name + ".length is configurable");
-        }.bind(this), this.name + " interface constructor");
-    }
-
-    // TODO: Test named constructors if I find any interfaces that have them.
-
-    test(function()
-    {
-        assert_own_property(window, this.name,
-                            "window does not have own property " + format_value(this.name));
-
-        if (this.has_extended_attribute("Callback")) {
-            assert_false("prototype" in window[this.name],
-                         this.name + ' should not have a "prototype" property');
-            return;
-        }
-
-        // "The interface object must also have a property named “prototype”
-        // with attributes { [[Writable]]: false, [[Enumerable]]: false,
-        // [[Configurable]]: false } whose value is an object called the
-        // interface prototype object. This object has properties that
-        // correspond to the attributes and operations defined on the
-        // interface, and is described in more detail in section 4.5.3 below."
-        assert_own_property(window[this.name], "prototype",
-                            'interface "' + this.name + '" does not have own property "prototype"');
-        var desc = Object.getOwnPropertyDescriptor(window[this.name], "prototype");
-        assert_false("get" in desc, this.name + ".prototype has getter");
-        assert_false("set" in desc, this.name + ".prototype has setter");
-        assert_false(desc.writable, this.name + ".prototype is writable");
-        assert_false(desc.enumerable, this.name + ".prototype is enumerable");
-        assert_false(desc.configurable, this.name + ".prototype is configurable");
-
-        // Next, test that the [[Prototype]] of the interface prototype object
-        // is correct. (This is made somewhat difficult by the existence of
-        // [NoInterfaceObject].)
-        // TODO: Aryeh thinks there's at least other place in this file where
-        //       we try to figure out if an interface prototype object is
-        //       correct. Consolidate that code.
-
-        // "The interface prototype object for a given interface A must have an
-        // internal [[Prototype]] property whose value is as follows:
-        // "If A is not declared to inherit from another interface, then the
-        // value of the internal [[Prototype]] property of A is the Array
-        // prototype object ([ECMA-262], section 15.4.4) if the interface was
-        // declared with ArrayClass, or the Object prototype object otherwise
-        // ([ECMA-262], section 15.2.4).
-        // "Otherwise, A does inherit from another interface. The value of the
-        // internal [[Prototype]] property of A is the interface prototype
-        // object for the inherited interface."
-        var inherit_interface, inherit_interface_has_interface_object;
-        if (this.base) {
-            inherit_interface = this.base;
-            inherit_interface_has_interface_object =
-                !this.array
-                     .members[inherit_interface]
-                     .has_extended_attribute("NoInterfaceObject");
-        } else if (this.has_extended_attribute('ArrayClass')) {
-            inherit_interface = 'Array';
-            inherit_interface_has_interface_object = true;
-        } else {
-            inherit_interface = 'Object';
-            inherit_interface_has_interface_object = true;
-        }
-        if (inherit_interface_has_interface_object) {
-            assert_own_property(window, inherit_interface,
-                                'should inherit from ' + inherit_interface + ', but window has no such property');
-            assert_own_property(window[inherit_interface], 'prototype',
-                                'should inherit from ' + inherit_interface + ', but that object has no "prototype" property');
-            assert_equals(Object.getPrototypeOf(window[this.name].prototype),
-                          window[inherit_interface].prototype,
-                          'prototype of ' + this.name + '.prototype is not ' + inherit_interface + '.prototype');
-        } else {
-            // We can't test that we get the correct object, because this is the
-            // only way to get our hands on it. We only test that its class
-            // string, at least, is correct.
-            assert_class_string(Object.getPrototypeOf(window[this.name].prototype),
-                                inherit_interface + 'Prototype',
-                                'Class name for prototype of ' + this.name +
-                                '.prototype is not "' + inherit_interface + 'Prototype"');
-        }
-
-        // "The class string of an interface prototype object is the
-        // concatenation of the interface’s identifier and the string
-        // “Prototype”."
-        assert_class_string(window[this.name].prototype, this.name + "Prototype",
-                            "class string of " + this.name + ".prototype");
-        // String() should end up calling {}.toString if nothing defines a
-        // stringifier.
-        if (!this.has_stringifier()) {
-            assert_equals(String(window[this.name].prototype), "[object " + this.name + "Prototype]",
-                    "String(" + this.name + ".prototype)");
-        }
-    }.bind(this), this.name + " interface: existence and properties of interface prototype object");
-
-    test(function()
-    {
-        assert_own_property(window, this.name,
-                            "window does not have own property " + format_value(this.name));
-
-        if (this.has_extended_attribute("Callback")) {
-            assert_false("prototype" in window[this.name],
-                         this.name + ' should not have a "prototype" property');
-            return;
-        }
-
-        assert_own_property(window[this.name], "prototype",
-                            'interface "' + this.name + '" does not have own property "prototype"');
-
-        // "If the [NoInterfaceObject] extended attribute was not specified on
-        // the interface, then the interface prototype object must also have a
-        // property named “constructor” with attributes { [[Writable]]: true,
-        // [[Enumerable]]: false, [[Configurable]]: true } whose value is a
-        // reference to the interface object for the interface."
-        assert_own_property(window[this.name].prototype, "constructor",
-                            this.name + '.prototype does not have own property "constructor"');
-        var desc = Object.getOwnPropertyDescriptor(window[this.name].prototype, "constructor");
-        assert_false("get" in desc, this.name + ".prototype.constructor has getter");
-        assert_false("set" in desc, this.name + ".prototype.constructor has setter");
-        assert_true(desc.writable, this.name + ".prototype.constructor is not writable");
-        assert_false(desc.enumerable, this.name + ".prototype.constructor is enumerable");
-        assert_true(desc.configurable, this.name + ".prototype.constructor in not configurable");
-        assert_equals(window[this.name].prototype.constructor, window[this.name],
-                      this.name + '.prototype.constructor is not the same object as ' + this.name);
-    }.bind(this), this.name + ' interface: existence and properties of interface prototype object\'s "constructor" property');
-};
-
-//@}
-IdlInterface.prototype.test_members = function()
-//@{
-{
-    for (var i = 0; i < this.members.length; i++)
-    {
-        var member = this.members[i];
-        if (member.untested)
-        {
-            continue;
-        }
-        if (member.type == "const")
-        {
-            test(function()
-            {
-                assert_own_property(window, this.name,
-                                    "window does not have own property " + format_value(this.name));
-
-                // "For each constant defined on an interface A, there must be
-                // a corresponding property on the interface object, if it
-                // exists."
-                assert_own_property(window[this.name], member.name);
-                // "The value of the property is that which is obtained by
-                // converting the constant’s IDL value to an ECMAScript
-                // value."
-                assert_equals(window[this.name][member.name], constValue(member.value),
-                              "property has wrong value");
-                // "The property has attributes { [[Writable]]: false,
-                // [[Enumerable]]: true, [[Configurable]]: false }."
-                var desc = Object.getOwnPropertyDescriptor(window[this.name], member.name);
-                assert_false("get" in desc, "property has getter");
-                assert_false("set" in desc, "property has setter");
-                assert_false(desc.writable, "property is writable");
-                assert_true(desc.enumerable, "property is not enumerable");
-                assert_false(desc.configurable, "property is configurable");
-            }.bind(this), this.name + " interface: constant " + member.name + " on interface object");
-            // "In addition, a property with the same characteristics must
-            // exist on the interface prototype object."
-            test(function()
-            {
-                assert_own_property(window, this.name,
-                                    "window does not have own property " + format_value(this.name));
-
-                if (this.has_extended_attribute("Callback")) {
-                    assert_false("prototype" in window[this.name],
-                                 this.name + ' should not have a "prototype" property');
-                    return;
-                }
-
-                assert_own_property(window[this.name], "prototype",
-                                    'interface "' + this.name + '" does not have own property "prototype"');
-
-                assert_own_property(window[this.name].prototype, member.name);
-                assert_equals(window[this.name].prototype[member.name], constValue(member.value),
-                              "property has wrong value");
-                var desc = Object.getOwnPropertyDescriptor(window[this.name], member.name);
-                assert_false("get" in desc, "property has getter");
-                assert_false("set" in desc, "property has setter");
-                assert_false(desc.writable, "property is writable");
-                assert_true(desc.enumerable, "property is not enumerable");
-                assert_false(desc.configurable, "property is configurable");
-            }.bind(this), this.name + " interface: constant " + member.name + " on interface prototype object");
-        }
-        else if (member.type == "attribute")
-        {
-            if (member.has_extended_attribute("Unforgeable"))
-            {
-                // We do the checks in test_interface_of instead
-                continue;
-            }
-            test(function()
-            {
-                assert_own_property(window, this.name,
-                                    "window does not have own property " + format_value(this.name));
-                assert_own_property(window[this.name], "prototype",
-                                    'interface "' + this.name + '" does not have own property "prototype"');
-                assert_true(member.name in window[this.name].prototype,
-                            "The prototype object must have a property " +
-                            format_value(member.name));
-
-                // TODO: Needs to test for LenientThis.
-                assert_throws(new TypeError(), function() {
-                    window[this.name].prototype[member.name];
-                }.bind(this), "getting property on prototype object must throw TypeError");
-
-                do_interface_attribute_asserts(window[this.name].prototype, member);
-            }.bind(this), this.name + " interface: attribute " + member.name);
-        }
-        else if (member.type == "operation")
-        {
-            // TODO: Need to correctly handle multiple operations with the same
-            // identifier.
-            if (!member.name)
-            {
-                // Unnamed getter or such
-                continue;
-            }
-            test(function()
-            {
-                assert_own_property(window, this.name,
-                                    "window does not have own property " + format_value(this.name));
-
-                if (this.has_extended_attribute("Callback")) {
-                    assert_false("prototype" in window[this.name],
-                                 this.name + ' should not have a "prototype" property');
-                    return;
-                }
-
-                assert_own_property(window[this.name], "prototype",
-                                    'interface "' + this.name + '" does not have own property "prototype"');
-
-                // "For each unique identifier of an operation defined on the
-                // interface, there must be a corresponding property on the
-                // interface prototype object (if it is a regular operation) or
-                // the interface object (if it is a static operation), unless
-                // the effective overload set for that identifier and operation
-                // and with an argument count of 0 (for the ECMAScript language
-                // binding) has no entries."
-                //
-                // TODO: The library doesn't seem to support static operations.
-                assert_own_property(window[this.name].prototype, member.name,
-                    "interface prototype object missing non-static operation");
-
-                var desc = Object.getOwnPropertyDescriptor(window[this.name].prototype, member.name);
-                // "The property has attributes { [[Writable]]: true,
-                // [[Enumerable]]: true, [[Configurable]]: true }."
-                assert_false("get" in desc, "property has getter");
-                assert_false("set" in desc, "property has setter");
-                assert_true(desc.writable, "property is not writable");
-                assert_true(desc.enumerable, "property is not enumerable");
-                assert_true(desc.configurable, "property is not configurable");
-                // "The value of the property is a Function object whose
-                // behavior is as follows . . ."
-                assert_equals(typeof window[this.name].prototype[member.name], "function",
-                              "property must be a function");
-                // "The value of the Function object’s “length” property is
-                // a Number determined as follows:
-                // ". . .
-                // "Return the length of the shortest argument list of the
-                // entries in S."
-                //
-                // TODO: Doesn't handle overloading or variadic arguments.
-                assert_equals(window[this.name].prototype[member.name].length,
-                    member.arguments.filter(function(arg) {
-                        return !arg.optional;
-                    }).length,
-                    "property has wrong .length");
-
-                // Make some suitable arguments
-                var args = member.arguments.map(function(arg) {
-                    return create_suitable_object(arg.idlType);
-                });
-
-                // "Let O be a value determined as follows:
-                // ". . .
-                // "Otherwise, throw a TypeError."
-                // This should be hit if the operation is not static, there is
-                // no [ImplicitThis] attribute, and the this value is null.
-                //
-                // TODO: We currently ignore the static and [ImplicitThis]
-                // cases.
-                assert_throws(new TypeError(), function() {
-                    window[this.name].prototype[member.name].apply(null, args);
-                }, "calling operation with this = null didn't throw TypeError");
-
-                // ". . . If O is not null and is also not a platform object
-                // that implements interface I, throw a TypeError."
-                //
-                // TODO: Test a platform object that implements some other
-                // interface.  (Have to be sure to get inheritance right.)
-                assert_throws(new TypeError(), function() {
-                    window[this.name].prototype[member.name].apply({}, args);
-                }, "calling operation with this = {} didn't throw TypeError");
-            }.bind(this), this.name + " interface: operation " + member.name +
-            "(" + member.arguments.map(function(m) { return m.idlType.idlType; }) +
-            ")");
-        }
-        // TODO: check more member types, like stringifier
-    }
-};
-
-//@}
-IdlInterface.prototype.test_object = function(desc)
-//@{
-{
-    var obj, exception = null;
-    try
-    {
-        obj = eval(desc);
-    }
-    catch(e)
-    {
-        exception = e;
-    }
-
-    // TODO: WebIDLParser doesn't currently support named legacycallers, so I'm
-    // not sure what those would look like in the AST
-    var expected_typeof = this.members.some(function(member)
-    {
-        return member.legacycaller
-            || ("idlType" in member && member.idlType.legacycaller)
-            || ("idlType" in member && typeof member.idlType == "object"
-            && "idlType" in member.idlType && member.idlType.idlType == "legacycaller");
-    }) ? "function" : "object";
-
-    this.test_primary_interface_of(desc, obj, exception, expected_typeof);
-    var current_interface = this;
-    while (current_interface)
-    {
-        if (!(current_interface.name in this.array.members))
-        {
-            throw "Interface " + current_interface.name + " not found (inherited by " + this.name + ")";
-        }
-        if (current_interface.prevent_multiple_testing && current_interface.already_tested)
-        {
-            return;
-        }
-        current_interface.test_interface_of(desc, obj, exception, expected_typeof);
-        current_interface = this.array.members[current_interface.base];
-    }
-};
-
-//@}
-IdlInterface.prototype.test_primary_interface_of = function(desc, obj, exception, expected_typeof)
-//@{
-{
-    // We can't easily test that its prototype is correct if there's no
-    // interface object, or the object is from a different global environment
-    // (not instanceof Object).  TODO: test in this case that its prototype at
-    // least looks correct, even if we can't test that it's actually correct.
-    if (!this.has_extended_attribute("NoInterfaceObject")
-    && (typeof obj != expected_typeof || obj instanceof Object))
-    {
-        test(function()
-        {
-            assert_equals(exception, null, "Unexpected exception when evaluating object");
-            assert_equals(typeof obj, expected_typeof, "wrong typeof object");
-            assert_own_property(window, this.name,
-                                "window does not have own property " + format_value(this.name));
-            assert_own_property(window[this.name], "prototype",
-                                'interface "' + this.name + '" does not have own property "prototype"');
-
-            // "The value of the internal [[Prototype]] property of the
-            // platform object is the interface prototype object of the primary
-            // interface from the platform object’s associated global
-            // environment."
-            assert_equals(Object.getPrototypeOf(obj),
-                          window[this.name].prototype,
-                          desc + "'s prototype is not " + this.name + ".prototype");
-        }.bind(this), this.name + " must be primary interface of " + desc);
-    }
-
-    // "The class string of a platform object that implements one or more
-    // interfaces must be the identifier of the primary interface of the
-    // platform object."
-    test(function()
-    {
-        assert_equals(exception, null, "Unexpected exception when evaluating object");
-        assert_equals(typeof obj, expected_typeof, "wrong typeof object");
-        assert_class_string(obj, this.name, "class string of " + desc);
-        if (!this.has_stringifier())
-        {
-            assert_equals(String(obj), "[object " + this.name + "]", "String(" + desc + ")");
-        }
-    }.bind(this), "Stringification of " + desc);
-};
-
-//@}
-IdlInterface.prototype.test_interface_of = function(desc, obj, exception, expected_typeof)
-//@{
-{
-    // TODO: Indexed and named properties, more checks on interface members
-    this.already_tested = true;
-
-    for (var i = 0; i < this.members.length; i++)
-    {
-        var member = this.members[i];
-        if (member.has_extended_attribute("Unforgeable"))
-        {
-            test(function()
-            {
-                assert_equals(exception, null, "Unexpected exception when evaluating object");
-                assert_equals(typeof obj, expected_typeof, "wrong typeof object");
-                do_interface_attribute_asserts(obj, member);
-            }.bind(this), this.name + " interface: " + desc + ' must have own property "' + member.name + '"');
-        }
-        else if ((member.type == "const"
-        || member.type == "attribute"
-        || member.type == "operation")
-        && member.name)
-        {
-            test(function()
-            {
-                assert_equals(exception, null, "Unexpected exception when evaluating object");
-                assert_equals(typeof obj, expected_typeof, "wrong typeof object");
-                assert_inherits(obj, member.name);
-                if (member.type == "const")
-                {
-                    assert_equals(obj[member.name], constValue(member.value));
-                }
-                if (member.type == "attribute")
-                {
-                    // Attributes are accessor properties, so they might
-                    // legitimately throw an exception rather than returning
-                    // anything.
-                    var property, thrown = false;
-                    try
-                    {
-                        property = obj[member.name];
-                    }
-                    catch (e)
-                    {
-                        thrown = true;
-                    }
-                    if (!thrown)
-                    {
-                        this.array.assert_type_is(property, member.idlType);
-                    }
-                }
-                if (member.type == "operation")
-                {
-                    assert_equals(typeof obj[member.name], "function");
-                }
-            }.bind(this), this.name + " interface: " + desc + ' must inherit property "' + member.name + '" with the proper type (' + i + ')');
-        }
-        // TODO: This is wrong if there are multiple operations with the same
-        // identifier.
-        // TODO: Test passing arguments of the wrong type.
-        if (member.type == "operation" && member.name && member.arguments.length)
-        {
-            test(function()
-            {
-                assert_equals(exception, null, "Unexpected exception when evaluating object");
-                assert_equals(typeof obj, expected_typeof, "wrong typeof object");
-                assert_inherits(obj, member.name);
-                var args = [];
-                for (var i = 0; i < member.arguments.length; i++)
-                {
-                    if (member.arguments[i].optional)
-                    {
-                        break;
-                    }
-                    assert_throws(new TypeError(), function()
-                    {
-                        obj[member.name].apply(obj, args);
-                    }.bind(this), "Called with " + i + " arguments");
-
-                    args.push(create_suitable_object(member.arguments[i].idlType));
-                }
-            }.bind(this), this.name + " interface: calling " + member.name +
-            "(" + member.arguments.map(function(m) { return m.idlType.idlType; }) +
-            ") on " + desc + " with too few arguments must throw TypeError");
-        }
-    }
-};
-
-//@}
-IdlInterface.prototype.has_stringifier = function()
-//@{
-{
-    if (this.members.some(function(member) { return member.stringifier; })) {
-        return true;
-    }
-    if (this.base &&
-        this.array.members[this.base].has_stringifier()) {
-        return true;
-    }
-    return false;
-};
-
-//@}
-function do_interface_attribute_asserts(obj, member)
-//@{
-{
-    // "For each attribute defined on the interface, there must exist a
-    // corresponding property. If the attribute was declared with the
-    // [Unforgeable] extended attribute, then the property exists on every
-    // object that implements the interface.  Otherwise, it exists on the
-    // interface’s interface prototype object."
-    //
-    // This is called by test_self() with the prototype as obj, and by
-    // test_interface_of() with the object as obj.
-    assert_own_property(obj, member.name);
-
-    // "The property has attributes { [[Get]]: G, [[Set]]: S, [[Enumerable]]:
-    // true, [[Configurable]]: configurable }, where:
-    // "configurable is false if the attribute was declared with the
-    // [Unforgeable] extended attribute and true otherwise;
-    // "G is the attribute getter, defined below; and
-    // "S is the attribute setter, also defined below."
-    var desc = Object.getOwnPropertyDescriptor(obj, member.name);
-    assert_false("value" in desc, 'property descriptor has value but is supposed to be accessor');
-    assert_false("writable" in desc, 'property descriptor has "writable" field but is supposed to be accessor');
-    assert_true(desc.enumerable, "property is not enumerable");
-    if (member.has_extended_attribute("Unforgeable"))
-    {
-        assert_false(desc.configurable, "[Unforgeable] property must not be configurable");
-    }
-    else
-    {
-        assert_true(desc.configurable, "property must be configurable");
-    }
-
-    // "The attribute getter is a Function object whose behavior when invoked
-    // is as follows:
-    // "...
-    // "The value of the Function object’s “length” property is the Number
-    // value 0."
-    assert_equals(typeof desc.get, "function", "getter must be Function");
-    assert_equals(desc.get.length, 0, "getter length must be 0");
-    // TODO: Account for LenientThis
-    assert_throws(new TypeError(), function()
-    {
-        desc.get.call({});
-    }.bind(this), "calling getter on wrong object type must throw TypeError");
-
-    // TODO: Test calling setter on the interface prototype (should throw
-    // TypeError in most cases).
-    //
-    // "The attribute setter is undefined if the attribute is declared readonly
-    // and has neither a [PutForwards] nor a [Replaceable] extended attribute
-    // declared on it.  Otherwise, it is a Function object whose behavior when
-    // invoked is as follows:
-    // "...
-    // "The value of the Function object’s “length” property is the Number
-    // value 1."
-    if (member.readonly
-    && !member.has_extended_attribute("PutForwards")
-    && !member.has_extended_attribute("Replaceable"))
-    {
-        assert_equals(desc.set, undefined, "setter must be undefined for readonly attributes");
-    }
-    else
-    {
-        assert_equals(typeof desc.set, "function", "setter must be function for PutForwards, Replaceable, or non-readonly attributes");
-        assert_equals(desc.set.length, 1, "setter length must be 1");
-    }
-}
-//@}
-
-/// IdlInterfaceMember ///
-function IdlInterfaceMember(obj)
-//@{
-{
-    /**
-     * obj is an object produced by the WebIDLParser.js "ifMember" production.
-     * We just forward all properties to this object without modification,
-     * except for special extAttrs handling.
-     */
-    for (var k in obj)
-    {
-        this[k] = obj[k];
-    }
-    if (!("extAttrs" in this))
-    {
-        this.extAttrs = [];
-    }
-}
-
-//@}
-IdlInterfaceMember.prototype = Object.create(IdlObject.prototype);
-
-/// Internal helper functions ///
-function create_suitable_object(type)
-//@{
-{
-    /**
-     * type is an object produced by the WebIDLParser.js "type" production.  We
-     * return a JavaScript value that matches the type, if we can figure out
-     * how.
-     */
-    if (type.nullable)
-    {
-        return null;
-    }
-    switch (type.idlType)
-    {
-        case "any":
-        case "boolean":
-            return true;
-
-        case "byte": case "octet": case "short": case "unsigned short":
-        case "long": case "unsigned long": case "long long":
-        case "unsigned long long": case "float": case "double":
-            return 7;
-
-        case "DOMString":
-            return "foo";
-
-        case "object":
-            return {a: "b"};
-
-        case "Node":
-            return document.createTextNode("abc");
-    }
-    return null;
-}
-//@}
-
-/// IdlEnum ///
-// Used for IdlArray.prototype.assert_type_is
-function IdlEnum(obj)
-//@{
-{
-    /**
-     * obj is an object produced by the WebIDLParser.js "dictionary"
-     * production.
-     */
-
-    /** Self-explanatory. */
-    this.name = obj.name;
-
-    console.log("Name is " + this.name);
-
-    /** An array of values produced by the "enum" production. */
-    this.values = obj.values;
-
-}
-//@}
-
-IdlEnum.prototype = Object.create(IdlObject.prototype);
-
-IdlEnum.prototype.test = function()
-//@{
-{
-            test(function()
-            {
-		// NOTHING to test
-		return;
-	    });
-}
-//@}
-}());
-// vim: set expandtab shiftwidth=4 tabstop=4 foldmarker=@{,@} foldmethod=marker:
deleted file mode 100644
--- a/testing/web-platform/tests/app-uri/resources/testharness.css
+++ /dev/null
@@ -1,92 +0,0 @@
-html {
-    font-family:DejaVu Sans, Bitstream Vera Sans, Arial, Sans;
-}
-
-#log .warning,
-#log .warning a {
-  color: black;
-  background: yellow;
-}
-
-#log .error,
-#log .error a {
-  color: white;
-  background: red;
-}
-
-#log pre {
-  border: 1px solid black;
-  padding: 1em;
-}
-
-section#summary {
-    margin-bottom:1em;
-}
-
-table#results {
-    border-collapse:collapse;
-    table-layout:fixed;
-    width:100%;
-}
-
-table#results th:first-child,
-table#results td:first-child {
-    width:4em;
-}
-
-table#results th:last-child,
-table#results td:last-child {
-    width:50%;
-}
-
-table#results.assertions th:last-child,
-table#results.assertions td:last-child {
-    width:35%;
-}
-
-table#results th {
-    padding:0;
-    padding-bottom:0.5em;
-    border-bottom:medium solid black;
-}
-
-table#results td {
-    padding:1em;
-    padding-bottom:0.5em;
-    border-bottom:thin solid black;
-}
-
-tr.pass > td:first-child {
-    color:green;
-}
-
-tr.fail > td:first-child {
-    color:red;
-}
-
-tr.timeout > td:first-child {
-    color:red;
-}
-
-tr.notrun > td:first-child {
-    color:blue;
-}
-
-.pass > td:first-child, .fail > td:first-child, .timeout > td:first-child, .notrun > td:first-child {
-    font-variant:small-caps;
-}
-
-table#results span {
-    display:block;
-}
-
-table#results span.expected {
-    font-family:DejaVu Sans Mono, Bitstream Vera Sans Mono, Monospace;
-    white-space:pre;
-}
-
-table#results span.actual {
-    font-family:DejaVu Sans Mono, Bitstream Vera Sans Mono, Monospace;
-    white-space:pre;
-}
-
deleted file mode 100644
--- a/testing/web-platform/tests/app-uri/resources/testharness.js
+++ /dev/null
@@ -1,2232 +0,0 @@
-/*
-Distributed under both the W3C Test Suite License [1] and the W3C
-3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
-policies and contribution forms [3].
-
-[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
-[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
-[3] http://www.w3.org/2004/10/27-testcases
-*/
-
-/*
- * == Introduction ==
- *
- * This file provides a framework for writing testcases. It is intended to
- * provide a convenient API for making common assertions, and to work both
- * for testing synchronous and asynchronous DOM features in a way that
- * promotes clear, robust, tests.
- *
- * == Basic Usage ==
- *
- * To use this file, import the script and the testharnessreport script into
- * the test document:
- * <script src="/resources/testharness.js"></script>
- * <script src="/resources/testharnessreport.js"></script>
- *
- * Within each file one may define one or more tests. Each test is atomic
- * in the sense that a single test has a single result (pass/fail/timeout).
- * Within each test one may have a number of asserts. The test fails at the
- * first failing assert, and the remainder of the test is (typically) not run.
- *
- * If the file containing the tests is a HTML file with an element of id "log"
- * this will be populated with a table containing the test results after all
- * the tests have run.
- *
- * NOTE: By default tests must be created before the load event fires. For ways
- *       to create tests after the load event, see "Determining when all tests
- *       are complete", below
- *
- * == Synchronous Tests ==
- *
- * To create a synchronous test use the test() function:
- *
- * test(test_function, name, properties)
- *
- * test_function is a function that contains the code to test. For example a
- * trivial passing test would be:
- *
- * test(function() {assert_true(true)}, "assert_true with true")
- *
- * The function passed in is run in the test() call.
- *
- * properties is an object that overrides default test properties. The
- * recognised properties are:
- *    timeout - the test timeout in ms
- *
- * e.g.
- * test(test_function, "Sample test", {timeout:1000})
- *
- * would run test_function with a timeout of 1s.
- *
- * Additionally, test-specific metadata can be passed in the properties. These
- * are used when the individual test has different metadata from that stored 
- * in the <head>.
- * The recognized metadata properties are:
- *
- *    help - The url of the part of the specification being tested
- *
- *    assert - A human readable description of what the test is attempting 
- *             to prove
- *
- *    author - Name and contact information for the author of the test in the
- *             format: "Name <email_addr>" or "Name http://contact/url"
- *
- * == Asynchronous Tests ==
- *
- * Testing asynchronous features is somewhat more complex since the result of
- * a test may depend on one or more events or other callbacks. The API provided
- * for testing these features is indended to be rather low-level but hopefully
- * applicable to many situations.
- *
- * To create a test, one starts by getting a Test object using async_test:
- *
- * async_test(name, properties)
- *
- * e.g.
- * var t = async_test("Simple async test")
- *
- * Assertions can be added to the test by calling the step method of the test
- * object with a function containing the test assertions:
- *
- * t.step(function() {assert_true(true)});
- *
- * When all the steps are complete, the done() method must be called:
- *
- * t.done();
- *
- * As a convenience, async_test can also takes a function as first argument.
- * This function is called with the test object as both its `this` object and
- * first argument. The above example can be rewritten as:
- *
- * async_test(function(t) {
- *     object.some_event = function() {
- *         t.step(function (){assert_true(true); t.done();});
- *     };
- * }, "Simple async test");
- *
- * which avoids cluttering the global scope with references to async
- * tests instances.
- *
- * The properties argument is identical to that for test().
- *
- * In many cases it is convenient to run a step in response to an event or a
- * callback. A convenient method of doing this is through the step_func method
- * which returns a function that, when called runs a test step. For example
- *
- * object.some_event = t.step_func(function(e) {assert_true(e.a)});
- *
- * == Making assertions ==
- *
- * Functions for making assertions start assert_
- * The best way to get a list is to look in this file for functions names
- * matching that pattern. The general signature is
- *
- * assert_something(actual, expected, description)
- *
- * although not all assertions precisely match this pattern e.g. assert_true
- * only takes actual and description as arguments.
- *
- * The description parameter is used to present more useful error messages when
- * a test fails
- *
- * NOTE: All asserts must be located in a test() or a step of an async_test().
- *       asserts outside these places won't be detected correctly by the harness
- *       and may cause a file to stop testing.
- *
- * == Setup ==
- *
- * Sometimes tests require non-trivial setup that may fail. For this purpose
- * there is a setup() function, that may be called with one or two arguments.
- * The two argument version is:
- *
- * setup(func, properties)
- *
- * The one argument versions may omit either argument.
- * func is a function to be run synchronously. setup() becomes a no-op once
- * any tests have returned results. Properties are global properties of the test
- * harness. Currently recognised properties are:
- *
- * timeout - The time in ms after which the harness should stop waiting for
- *           tests to complete (this is different to the per-test timeout
- *           because async tests do not start their timer until .step is called)
- *
- * explicit_done - Wait for an explicit call to done() before declaring all
- *                 tests complete (see below)
- *
- * output_document - The document to which results should be logged. By default
- *                   this is the current document but could be an ancestor
- *                   document in some cases e.g. a SVG test loaded in an HTML
- *                   wrapper
- *
- * explicit_timeout - disable file timeout; only stop waiting for results
- *                    when the timeout() function is called (typically for
- *                    use when integrating with some existing test framework
- *                    that has its own timeout mechanism).
- *
- * == Determining when all tests are complete ==
- *
- * By default the test harness will assume there are no more results to come
- * when:
- * 1) There are no Test objects that have been created but not completed
- * 2) The load event on the document has fired
- *
- * This behaviour can be overridden by setting the explicit_done property to
- * true in a call to setup(). If explicit_done is true, the test harness will
- * not assume it is done until the global done() function is called. Once done()
- * is called, the two conditions above apply like normal.
- *
- * == Generating tests ==
- *
- * NOTE: this functionality may be removed
- *
- * There are scenarios in which is is desirable to create a large number of
- * (synchronous) tests that are internally similar but vary in the parameters
- * used. To make this easier, the generate_tests function allows a single
- * function to be called with each set of parameters in a list:
- *
- * generate_tests(test_function, parameter_lists, properties)
- *
- * For example:
- *
- * generate_tests(assert_equals, [
- *     ["Sum one and one", 1+1, 2],
- *     ["Sum one and zero", 1+0, 1]
- *     ])
- *
- * Is equivalent to:
- *
- * test(function() {assert_equals(1+1, 2)}, "Sum one and one")
- * test(function() {assert_equals(1+0, 1)}, "Sum one and zero")
- *
- * Note that the first item in each parameter list corresponds to the name of
- * the test.
- *
- * The properties argument is identical to that for test(). This may be a 
- * single object (used for all generated tests) or an array.
- *
- * == Callback API ==
- *
- * The framework provides callbacks corresponding to 3 events:
- *
- * start - happens when the first Test is created
- * result - happens when a test result is recieved
- * complete - happens when all results are recieved
- *
- * The page defining the tests may add callbacks for these events by calling
- * the following methods:
- *
- *   add_start_callback(callback) - callback called with no arguments
- *   add_result_callback(callback) - callback called with a test argument
- *   add_completion_callback(callback) - callback called with an array of tests
- *                                       and an status object
- *
- * tests have the following properties:
- *   status: A status code. This can be compared to the PASS, FAIL, TIMEOUT and
- *           NOTRUN properties on the test object
- *   message: A message indicating the reason for failure. In the future this
- *            will always be a string
- *
- *  The status object gives the overall status of the harness. It has the
- *  following properties:
- *    status: Can be compared to the OK, ERROR and TIMEOUT properties
- *    message: An error message set when the status is ERROR
- *
- * == External API ==
- *
- * In order to collect the results of multiple pages containing tests, the test
- * harness will, when loaded in a nested browsing context, attempt to call
- * certain functions in each ancestor and opener browsing context:
- *
- * start - start_callback
- * result - result_callback
- * complete - completion_callback
- *
- * These are given the same arguments as the corresponding internal callbacks
- * described above.
- *
- * == External API through cross-document messaging ==
- *
- * Where supported, the test harness will also send messages using
- * cross-document messaging to each ancestor and opener browsing context. Since
- * it uses the wildcard keyword (*), cross-origin communication is enabled and
- * script on different origins can collect the results.
- *
- * This API follows similar conventions as those described above only slightly
- * modified to accommodate message event API. Each message is sent by the harness
- * is passed a single vanilla object, available as the `data` property of the
- * event object. These objects are structures as follows:
- *
- * start - { type: "start" }
- * result - { type: "result", test: Test }
- * complete - { type: "complete", tests: [Test, ...], status: TestsStatus }
- *
- * == List of assertions ==
- *
- * assert_true(actual, description)
- *   asserts that /actual/ is strictly true
- *
- * assert_false(actual, description)
- *   asserts that /actual/ is strictly false
- *
- * assert_equals(actual, expected, description)
- *   asserts that /actual/ is the same value as /expected/
- *
- * assert_not_equals(actual, expected, description)
- *   asserts that /actual/ is a different value to /expected/. Yes, this means
- *   that "expected" is a misnomer
- *
- * assert_in_array(actual, expected, description)
- *   asserts that /expected/ is an Array, and /actual/ is equal to one of the
- *   members -- expected.indexOf(actual) != -1
- *
- * assert_array_equals(actual, expected, description)
- *   asserts that /actual/ and /expected/ have the same length and the value of
- *   each indexed property in /actual/ is the strictly equal to the corresponding
- *   property value in /expected/
- *
- * assert_approx_equals(actual, expected, epsilon, description)
- *   asserts that /actual/ is a number within +/- /epsilon/ of /expected/
- *
- * assert_less_than(actual, expected, description)
- *   asserts that /actual/ is a number less than /expected/
- *
- * assert_greater_than(actual, expected, description)
- *   asserts that /actual/ is a number greater than /expected/
- *
- * assert_less_than_equal(actual, expected, description)
- *   asserts that /actual/ is a number less than or equal to /expected/
- *
- * assert_greater_than_equal(actual, expected, description)
- *   asserts that /actual/ is a number greater than or equal to /expected/
- *
- * assert_regexp_match(actual, expected, description)
- *   asserts that /actual/ matches the regexp /expected/
- *
- * assert_class_string(object, class_name, description)
- *   asserts that the class string of /object/ as returned in
- *   Object.prototype.toString is equal to /class_name/.
- *
- * assert_own_property(object, property_name, description)
- *   assert that object has own property property_name
- *
- * assert_inherits(object, property_name, description)
- *   assert that object does not have an own property named property_name
- *   but that property_name is present in the prototype chain for object
- *
- * assert_idl_attribute(object, attribute_name, description)
- *   assert that an object that is an instance of some interface has the
- *   attribute attribute_name following the conditions specified by WebIDL
- *
- * assert_readonly(object, property_name, description)
- *   assert that property property_name on object is readonly
- *
- * assert_throws(code, func, description)
- *   code - the expected exception:
- *     o string: the thrown exception must be a DOMException with the given
- *               name, e.g., "TimeoutError" (for compatibility with existing
- *               tests, a constant is also supported, e.g., "TIMEOUT_ERR")
- *     o object: the thrown exception must have a property called "name" that
- *               matches code.name
- *     o null:   allow any exception (in general, one of the options above
- *               should be used)
- *   func - a function that should throw
- *
- * assert_unreached(description)
- *   asserts if called. Used to ensure that some codepath is *not* taken e.g.
- *   an event does not fire.
- *
- * assert_any(assert_func, actual, expected_array, extra_arg_1, ... extra_arg_N)
- *   asserts that one assert_func(actual, expected_array_N, extra_arg1, ..., extra_arg_N)
- *   is true for some expected_array_N in expected_array. This only works for assert_func
- *   with signature assert_func(actual, expected, args_1, ..., args_N). Note that tests
- *   with multiple allowed pass conditions are bad practice unless the spec specifically
- *   allows multiple behaviours. Test authors should not use this method simply to hide 
- *   UA bugs.
- *
- * assert_exists(object, property_name, description)
- *   *** deprecated ***
- *   asserts that object has an own property property_name
- *
- * assert_not_exists(object, property_name, description)
- *   *** deprecated ***
- *   assert that object does not have own property property_name
- */
-
-(function ()
-{
-    var debug = false;
-    // default timeout is 5 seconds, test can override if needed
-    var settings = {
-      output:true,
-      timeout:5000,
-      test_timeout:2000
-    };
-
-    var xhtml_ns = "http://www.w3.org/1999/xhtml";
-
-    // script_prefix is used by Output.prototype.show_results() to figure out
-    // where to get testharness.css from.  It's enclosed in an extra closure to
-    // not pollute the library's namespace with variables like "src".
-    var script_prefix = null;
-    (function ()
-    {
-        var scripts = document.getElementsByTagName("script");
-        for (var i = 0; i < scripts.length; i++)
-        {
-            if (scripts[i].src)
-            {
-                var src = scripts[i].src;
-            }
-            else if (scripts[i].href)
-            {
-                //SVG case
-                var src = scripts[i].href.baseVal;
-            }
-            if (src && src.slice(src.length - "testharness.js".length) === "testharness.js")
-            {
-                script_prefix = src.slice(0, src.length - "testharness.js".length);
-                break;
-            }
-        }
-    })();
-
-    /*
-     * API functions
-     */
-
-    var name_counter = 0;
-    function next_default_name()
-    {
-        //Don't use document.title to work around an Opera bug in XHTML documents
-        var title = document.getElementsByTagName("title")[0];
-        var prefix = (title && title.firstChild && title.firstChild.data) || "Untitled";
-        var suffix = name_counter > 0 ? " " + name_counter : "";
-        name_counter++;
-        return prefix + suffix;
-    }
-
-    function test(func, name, properties)
-    {
-        var test_name = name ? name : next_default_name();
-        properties = properties ? properties : {};
-        var test_obj = new Test(test_name, properties);
-        test_obj.step(func);
-        if (test_obj.status === test_obj.NOTRUN) {
-            test_obj.done();
-        }
-    }
-
-    function async_test(func, name, properties)
-    {
-        if (typeof func !== "function") {
-            properties = name;
-            name = func;
-            func = null;
-        }
-        var test_name = name ? name : next_default_name();
-        properties = properties ? properties : {};
-        var test_obj = new Test(test_name, properties);
-        if (func) {
-            test_obj.step(func, test_obj, test_obj);
-        }
-        return test_obj;
-    }
-
-    function setup(func_or_properties, maybe_properties)
-    {
-        var func = null;
-        var properties = {};
-        if (arguments.length === 2) {
-            func = func_or_properties;
-            properties = maybe_properties;
-        } else if (func_or_properties instanceof Function){
-            func = func_or_properties;
-        } else {
-            properties = func_or_properties;
-        }
-        tests.setup(func, properties);
-        output.setup(properties);
-    }
-
-    function done() {
-        tests.end_wait();
-    }
-
-    function generate_tests(func, args, properties) {
-        forEach(args, function(x, i)
-                {
-                    var name = x[0];
-                    test(function()
-                         {
-                             func.apply(this, x.slice(1));
-                         }, 
-                         name, 
-                         Array.isArray(properties) ? properties[i] : properties);
-                });
-    }
-
-    function on_event(object, event, callback)
-    {
-      object.addEventListener(event, callback, false);
-    }
-
-    expose(test, 'test');
-    expose(async_test, 'async_test');
-    expose(generate_tests, 'generate_tests');
-    expose(setup, 'setup');
-    expose(done, 'done');
-    expose(on_event, 'on_event');
-
-    /*
-     * Return a string truncated to the given length, with ... added at the end
-     * if it was longer.
-     */
-    function truncate(s, len)
-    {
-        if (s.length > len) {
-            return s.substring(0, len - 3) + "...";
-        }
-        return s;
-    }
-
-    /*
-     * Convert a value to a nice, human-readable string
-     */
-    function format_value(val, seen)
-    {
-	if (!seen) {
-	    seen = [];
-        }
-        if (typeof val === "object" && val !== null)
-        {
-            if (seen.indexOf(val) >= 0)
-            {
-                return "[...]";
-            }
-	    seen.push(val);
-        }
-        if (Array.isArray(val))
-        {
-            return "[" + val.map(function(x) {return format_value(x, seen)}).join(", ") + "]";
-        }
-
-        switch (typeof val)
-        {
-        case "string":
-            val = val.replace("\\", "\\\\");
-            for (var i = 0; i < 32; i++)
-            {
-                var replace = "\\";
-                switch (i) {
-                case 0: replace += "0"; break;
-                case 1: replace += "x01"; break;
-                case 2: replace += "x02"; break;
-                case 3: replace += "x03"; break;
-                case 4: replace += "x04"; break;
-                case 5: replace += "x05"; break;
-                case 6: replace += "x06"; break;
-                case 7: replace += "x07"; break;
-                case 8: replace += "b"; break;
-                case 9: replace += "t"; break;
-                case 10: replace += "n"; break;
-                case 11: replace += "v"; break;
-                case 12: replace += "f"; break;
-                case 13: replace += "r"; break;
-                case 14: replace += "x0e"; break;
-                case 15: replace += "x0f"; break;
-                case 16: replace += "x10"; break;
-                case 17: replace += "x11"; break;
-                case 18: replace += "x12"; break;
-                case 19: replace += "x13"; break;
-                case 20: replace += "x14"; break;
-                case 21: replace += "x15"; break;
-                case 22: replace += "x16"; break;
-                case 23: replace += "x17"; break;
-                case 24: replace += "x18"; break;
-                case 25: replace += "x19"; break;
-                case 26: replace += "x1a"; break;
-                case 27: replace += "x1b"; break;
-                case 28: replace += "x1c"; break;
-                case 29: replace += "x1d"; break;
-                case 30: replace += "x1e"; break;
-                case 31: replace += "x1f"; break;
-                }
-                val = val.replace(RegExp(String.fromCharCode(i), "g"), replace);
-            }
-            return '"' + val.replace(/"/g, '\\"') + '"';
-        case "boolean":
-        case "undefined":
-            return String(val);
-        case "number":
-            // In JavaScript, -0 === 0 and String(-0) == "0", so we have to
-            // special-case.
-            if (val === -0 && 1/val === -Infinity)
-            {
-                return "-0";
-            }
-            return String(val);
-        case "object":
-            if (val === null)
-            {
-                return "null";
-            }
-
-            // Special-case Node objects, since those come up a lot in my tests.  I
-            // ignore namespaces.  I use duck-typing instead of instanceof, because
-            // instanceof doesn't work if the node is from another window (like an
-            // iframe's contentWindow):
-            // http://www.w3.org/Bugs/Public/show_bug.cgi?id=12295
-            if ("nodeType" in val
-            && "nodeName" in val
-            && "nodeValue" in val
-            && "childNodes" in val)
-            {
-                switch (val.nodeType)
-                {
-                case Node.ELEMENT_NODE:
-                    var ret = "<" + val.tagName.toLowerCase();
-                    for (var i = 0; i < val.attributes.length; i++)
-                    {
-                        ret += " " + val.attributes[i].name + '="' + val.attributes[i].value + '"';
-                    }
-                    ret += ">" + val.innerHTML + "</" + val.tagName.toLowerCase() + ">";
-                    return "Element node " + truncate(ret, 60);
-                case Node.TEXT_NODE:
-                    return 'Text node "' + truncate(val.data, 60) + '"';
-                case Node.PROCESSING_INSTRUCTION_NODE:
-                    return "ProcessingInstruction node with target " + format_value(truncate(val.target, 60)) + " and data " + format_value(truncate(val.data, 60));
-                case Node.COMMENT_NODE:
-                    return "Comment node <!--" + truncate(val.data, 60) + "-->";
-                case Node.DOCUMENT_NODE:
-                    return "Document node with " + val.childNodes.length + (val.childNodes.length == 1 ? " child" : " children");
-                case Node.DOCUMENT_TYPE_NODE:
-                    return "DocumentType node";
-                case Node.DOCUMENT_FRAGMENT_NODE:
-                    return "DocumentFragment node with " + val.childNodes.length + (val.childNodes.length == 1 ? " child" : " children");
-                default:
-                    return "Node object of unknown type";
-                }
-            }
-
-            // Fall through to default
-        default:
-            return typeof val + ' "' + truncate(String(val), 60) + '"';
-        }
-    }
-    expose(format_value, "format_value");
-
-    /*
-     * Assertions
-     */
-
-    function assert_true(actual, description)
-    {
-        assert(actual === true, "assert_true", description,
-                                "expected true got ${actual}", {actual:actual});
-    };
-    expose(assert_true, "assert_true");
-
-    function assert_false(actual, description)
-    {
-        assert(actual === false, "assert_false", description,
-                                 "expected false got ${actual}", {actual:actual});
-    };
-    expose(assert_false, "assert_false");
-
-    function same_value(x, y) {
-        if (y !== y)
-        {
-            //NaN case
-            return x !== x;
-        }
-        else if (x === 0 && y === 0) {
-            //Distinguish +0 and -0
-            return 1/x === 1/y;
-        }
-        else
-        {
-            //typical case
-            return x === y;
-        }
-    }
-
-    function assert_equals(actual, expected, description)
-    {
-         /*
-          * Test if two primitives are equal or two objects
-          * are the same object
-          */
-        if (typeof actual != typeof expected)
-        {
-            assert(false, "assert_equals", description,
-                          "expected (" + typeof expected + ") ${expected} but got (" + typeof actual + ") ${actual}",
-                          {expected:expected, actual:actual});
-            return;
-        }
-        assert(same_value(actual, expected), "assert_equals", description,
-                                             "expected ${expected} but got ${actual}",
-                                             {expected:expected, actual:actual});
-    };
-    expose(assert_equals, "assert_equals");
-
-    function assert_not_equals(actual, expected, description)
-    {
-         /*
-          * Test if two primitives are unequal or two objects
-          * are different objects
-          */
-        assert(!same_value(actual, expected), "assert_not_equals", description,
-                                              "got disallowed value ${actual}",
-                                              {actual:actual});
-    };
-    expose(assert_not_equals, "assert_not_equals");
-
-    function assert_in_array(actual, expected, description)
-    {
-        assert(expected.indexOf(actual) != -1, "assert_in_array", description,
-                                               "value ${actual} not in array ${expected}",
-                                               {actual:actual, expected:expected});
-    }
-    expose(assert_in_array, "assert_in_array");
-
-    function assert_object_equals(actual, expected, description)
-    {
-         //This needs to be improved a great deal
-         function check_equal(actual, expected, stack)
-         {
-             stack.push(actual);
-
-             var p;
-             for (p in actual)
-             {
-                 assert(expected.hasOwnProperty(p), "assert_object_equals", description,
-                                                    "unexpected property ${p}", {p:p});
-
-                 if (typeof actual[p] === "object" && actual[p] !== null)
-                 {
-                     if (stack.indexOf(actual[p]) === -1)
-                     {
-                         check_equal(actual[p], expected[p], stack);
-                     }
-                 }
-                 else
-                 {
-                     assert(same_value(actual[p], expected[p]), "assert_object_equals", description,
-                                                       "property ${p} expected ${expected} got ${actual}",
-                                                       {p:p, expected:expected, actual:actual});
-                 }
-             }
-             for (p in expected)
-             {
-                 assert(actual.hasOwnProperty(p),
-                        "assert_object_equals", description,
-                        "expected property ${p} missing", {p:p});
-             }
-             stack.pop();
-         }
-         check_equal(actual, expected, []);
-    };
-    expose(assert_object_equals, "assert_object_equals");
-
-    function assert_array_equals(actual, expected, description)
-    {
-        assert(actual.length === expected.length,
-               "assert_array_equals", description,
-               "lengths differ, expected ${expected} got ${actual}",
-               {expected:expected.length, actual:actual.length});
-
-        for (var i=0; i < actual.length; i++)
-        {
-            assert(actual.hasOwnProperty(i) === expected.hasOwnProperty(i),
-                   "assert_array_equals", description,
-                   "property ${i}, property expected to be $expected but was $actual",
-                   {i:i, expected:expected.hasOwnProperty(i) ? "present" : "missing",
-                   actual:actual.hasOwnProperty(i) ? "present" : "missing"});
-            assert(same_value(expected[i], actual[i]),
-                   "assert_array_equals", description,
-                   "property ${i}, expected ${expected} but got ${actual}",
-                   {i:i, expected:expected[i], actual:actual[i]});
-        }
-    }
-    expose(assert_array_equals, "assert_array_equals");
-
-    function assert_approx_equals(actual, expected, epsilon, description)
-    {
-        /*
-         * Test if two primitive numbers are equal withing +/- epsilon
-         */
-        assert(typeof actual === "number",
-               "assert_approx_equals", description,
-               "expected a number but got a ${type_actual}",
-               {type_actual:typeof actual});
-
-        assert(Math.abs(actual - expected) <= epsilon,
-               "assert_approx_equals", description,
-               "expected ${expected} +/- ${epsilon} but got ${actual}",
-               {expected:expected, actual:actual, epsilon:epsilon});
-    };
-    expose(assert_approx_equals, "assert_approx_equals");
-
-    function assert_less_than(actual, expected, description)
-    {
-        /*
-         * Test if a primitive number is less than another
-         */
-        assert(typeof actual === "number",
-               "assert_less_than", description,
-               "expected a number but got a ${type_actual}",
-               {type_actual:typeof actual});
-
-        assert(actual < expected,
-               "assert_less_than", description,
-               "expected a number less than ${expected} but got ${actual}",
-               {expected:expected, actual:actual});
-    };
-    expose(assert_less_than, "assert_less_than");
-
-    function assert_greater_than(actual, expected, description)
-    {
-        /*
-         * Test if a primitive number is greater than another
-         */
-        assert(typeof actual === "number",
-               "assert_greater_than", description,
-               "expected a number but got a ${type_actual}",
-               {type_actual:typeof actual});
-
-        assert(actual > expected,
-               "assert_greater_than", description,
-               "expected a number greater than ${expected} but got ${actual}",
-               {expected:expected, actual:actual});
-    };
-    expose(assert_greater_than, "assert_greater_than");
-
-    function assert_less_than_equal(actual, expected, description)
-    {
-        /*
-         * Test if a primitive number is less than or equal to another
-         */
-        assert(typeof actual === "number",
-               "assert_less_than_equal", description,
-               "expected a number but got a ${type_actual}",
-               {type_actual:typeof actual});
-
-        assert(actual <= expected,
-               "assert_less_than", description,
-               "expected a number less than or equal to ${expected} but got ${actual}",
-               {expected:expected, actual:actual});
-    };
-    expose(assert_less_than_equal, "assert_less_than_equal");
-
-    function assert_greater_than_equal(actual, expected, description)
-    {
-        /*
-         * Test if a primitive number is greater than or equal to another
-         */
-        assert(typeof actual === "number",
-               "assert_greater_than_equal", description,
-               "expected a number but got a ${type_actual}",
-               {type_actual:typeof actual});
-
-        assert(actual >= expected,
-               "assert_greater_than_equal", description,
-               "expected a number greater than or equal to ${expected} but got ${actual}",
-               {expected:expected, actual:actual});
-    };
-    expose(assert_greater_than_equal, "assert_greater_than_equal");
-
-    function assert_regexp_match(actual, expected, description) {
-        /*
-         * Test if a string (actual) matches a regexp (expected)
-         */
-        assert(expected.test(actual),
-               "assert_regexp_match", description,
-               "expected ${expected} but got ${actual}",
-               {expected:expected, actual:actual});
-    }
-    expose(assert_regexp_match, "assert_regexp_match");
-
-    function assert_class_string(object, class_string, description) {
-        assert_equals({}.toString.call(object), "[object " + class_string + "]",
-                      description);
-    }
-    expose(assert_class_string, "assert_class_string");
-
-
-    function _assert_own_property(name) {
-        return function(object, property_name, description)
-        {
-            assert(object.hasOwnProperty(property_name),
-                   name, description,
-                   "expected property ${p} missing", {p:property_name});
-        };
-    }
-    expose(_assert_own_property("assert_exists"), "assert_exists");
-    expose(_assert_own_property("assert_own_property"), "assert_own_property");
-
-    function assert_not_exists(object, property_name, description)
-    {
-        assert(!object.hasOwnProperty(property_name),
-               "assert_not_exists", description,
-               "unexpected property ${p} found", {p:property_name});
-    };
-    expose(assert_not_exists, "assert_not_exists");
-
-    function _assert_inherits(name) {
-        return function (object, property_name, description)
-        {
-            assert(typeof object === "object",
-                   name, description,
-                   "provided value is not an object");
-
-            assert("hasOwnProperty" in object,
-                   name, description,
-                   "provided value is an object but has no hasOwnProperty method");
-
-            assert(!object.hasOwnProperty(property_name),
-                   name, description,
-                   "property ${p} found on object expected in prototype chain",
-                   {p:property_name});
-
-            assert(property_name in object,
-                   name, description,
-                   "property ${p} not found in prototype chain",
-                   {p:property_name});
-        };
-    }
-    expose(_assert_inherits("assert_inherits"), "assert_inherits");
-    expose(_assert_inherits("assert_idl_attribute"), "assert_idl_attribute");
-
-    function assert_readonly(object, property_name, description)
-    {
-         var initial_value = object[property_name];
-         try {
-             //Note that this can have side effects in the case where
-             //the property has PutForwards
-             object[property_name] = initial_value + "a"; //XXX use some other value here?
-             assert(same_value(object[property_name], initial_value),
-                    "assert_readonly", description,
-                    "changing property ${p} succeeded",
-                    {p:property_name});
-         }
-         finally
-         {
-             object[property_name] = initial_value;
-         }
-    };
-    expose(assert_readonly, "assert_readonly");
-
-    function assert_throws(code, func, description)
-    {
-        try
-        {
-            func.call(this);
-            assert(false, "assert_throws", description,
-                   "${func} did not throw", {func:func});
-        }
-        catch(e)
-        {
-            if (e instanceof AssertionError) {
-                throw(e);
-            }
-            if (code === null)
-            {
-                return;
-            }
-            if (typeof code === "object")
-            {
-                assert(typeof e == "object" && "name" in e && e.name == code.name,
-                       "assert_throws", description,
-                       "${func} threw ${actual} (${actual_name}) expected ${expected} (${expected_name})",
-                                    {func:func, actual:e, actual_name:e.name,
-                                     expected:code,
-                                     expected_name:code.name});
-                return;
-            }
-
-            var code_name_map = {
-                INDEX_SIZE_ERR: 'IndexSizeError',
-                HIERARCHY_REQUEST_ERR: 'HierarchyRequestError',
-                WRONG_DOCUMENT_ERR: 'WrongDocumentError',
-                INVALID_CHARACTER_ERR: 'InvalidCharacterError',
-                NO_MODIFICATION_ALLOWED_ERR: 'NoModificationAllowedError',
-                NOT_FOUND_ERR: 'NotFoundError',
-                NOT_SUPPORTED_ERR: 'NotSupportedError',
-                INVALID_STATE_ERR: 'InvalidStateError',
-                SYNTAX_ERR: 'SyntaxError',
-                INVALID_MODIFICATION_ERR: 'InvalidModificationError',
-                NAMESPACE_ERR: 'NamespaceError',
-                INVALID_ACCESS_ERR: 'InvalidAccessError',
-                TYPE_MISMATCH_ERR: 'TypeMismatchError',
-                SECURITY_ERR: 'SecurityError',
-                NETWORK_ERR: 'NetworkError',
-                ABORT_ERR: 'AbortError',
-                URL_MISMATCH_ERR: 'URLMismatchError',
-                QUOTA_EXCEEDED_ERR: 'QuotaExceededError',
-                TIMEOUT_ERR: 'TimeoutError',
-                INVALID_NODE_TYPE_ERR: 'InvalidNodeTypeError',
-                DATA_CLONE_ERR: 'DataCloneError'
-            };
-
-            var name = code in code_name_map ? code_name_map[code] : code;
-
-            var name_code_map = {
-                IndexSizeError: 1,
-                HierarchyRequestError: 3,
-                WrongDocumentError: 4,
-                InvalidCharacterError: 5,
-                NoModificationAllowedError: 7,
-                NotFoundError: 8,
-                NotSupportedError: 9,
-                InvalidStateError: 11,
-                SyntaxError: 12,
-                InvalidModificationError: 13,
-                NamespaceError: 14,
-                InvalidAccessError: 15,
-                TypeMismatchError: 17,
-                SecurityError: 18,
-                NetworkError: 19,
-                AbortError: 20,
-                URLMismatchError: 21,
-                QuotaExceededError: 22,
-                TimeoutError: 23,
-                InvalidNodeTypeError: 24,
-                DataCloneError: 25,
-
-                UnknownError: 0,
-                ConstraintError: 0,
-                DataError: 0,
-                TransactionInactiveError: 0,
-                ReadOnlyError: 0,
-                VersionError: 0
-            };
-
-            if (!(name in name_code_map))
-            {
-                throw new AssertionError('Test bug: unrecognized DOMException code "' + code + '" passed to assert_throws()');
-            }
-
-            var required_props = { code: name_code_map[name] };
-
-            if (required_props.code === 0
-            || ("name" in e && e.name !== e.name.toUpperCase() && e.name !== "DOMException"))
-            {
-                // New style exception: also test the name property.
-                required_props.name = name;
-            }
-
-            //We'd like to test that e instanceof the appropriate interface,
-            //but we can't, because we don't know what window it was created
-            //in.  It might be an instanceof the appropriate interface on some
-            //unknown other window.  TODO: Work around this somehow?
-
-            assert(typeof e == "object",
-                   "assert_throws", description,
-                   "${func} threw ${e} with type ${type}, not an object",
-                   {func:func, e:e, type:typeof e});
-
-            for (var prop in required_props)
-            {
-                assert(typeof e == "object" && prop in e && e[prop] == required_props[prop],
-                       "assert_throws", description,
-                       "${func} threw ${e} that is not a DOMException " + code + ": property ${prop} is equal to ${actual}, expected ${expected}",
-                       {func:func, e:e, prop:prop, actual:e[prop], expected:required_props[prop]});
-            }
-        }
-    }
-    expose(assert_throws, "assert_throws");
-
-    function assert_unreached(description) {
-         assert(false, "assert_unreached", description,
-                "Reached unreachable code");
-    }
-    expose(assert_unreached, "assert_unreached");
-
-    function assert_any(assert_func, actual, expected_array) 
-    {
-        var args = [].slice.call(arguments, 3)
-        var errors = []
-        var passed = false;
-        forEach(expected_array, 
-                function(expected)
-                {
-                    try {
-                        assert_func.apply(this, [actual, expected].concat(args))
-                        passed = true;
-                    } catch(e) {
-                        errors.push(e.message);
-                    }
-                });
-        if (!passed) {
-            throw new AssertionError(errors.join("\n\n"));
-        }
-    }
-    expose(assert_any, "assert_any");
-
-    function Test(name, properties)
-    {
-        this.name = name;
-        this.status = this.NOTRUN;
-        this.timeout_id = null;
-        this.is_done = false;
-
-        this.properties = properties;
-        this.timeout_length = properties.timeout ? properties.timeout : settings.test_timeout;
-
-        this.message = null;
-
-        var this_obj = this;
-        this.steps = [];
-
-        tests.push(this);
-    }
-
-    Test.statuses = {
-        PASS:0,
-        FAIL:1,
-        TIMEOUT:2,
-        NOTRUN:3
-    };
-
-    Test.prototype = merge({}, Test.statuses);
-
-    Test.prototype.structured_clone = function()
-    {
-        if(!this._structured_clone)
-        {
-            var msg = this.message;
-            msg = msg ? String(msg) : msg;
-            this._structured_clone = merge({
-                name:String(this.name),
-                status:this.status,
-                message:msg
-            }, Test.statuses);
-        }
-        return this._structured_clone;
-    };
-
-    Test.prototype.step = function(func, this_obj)
-    {
-        //In case the test has already failed
-        if (this.status !== this.NOTRUN)
-        {
-          return;
-        }
-
-        tests.started = true;
-
-        if (this.timeout_id === null) {
-            this.set_timeout();
-        }
-
-        this.steps.push(func);
-
-        if (arguments.length === 1)
-        {
-            this_obj = this;
-        }
-
-        try
-        {
-            return func.apply(this_obj, Array.prototype.slice.call(arguments, 2));
-        }
-        catch(e)
-        {
-            //This can happen if something called synchronously invoked another
-            //step
-            if (this.status !== this.NOTRUN)
-            {
-                return;
-            }
-            this.status = this.FAIL;
-            this.message = (typeof e === "object" && e !== null) ? e.message : e;
-            if (typeof e.stack != "undefined" && typeof e.message == "string") {
-                //Try to make it more informative for some exceptions, at least
-                //in Gecko and WebKit.  This results in a stack dump instead of
-                //just errors like "Cannot read property 'parentNode' of null"
-                //or "root is null".  Makes it a lot longer, of course.
-                this.message += "(stack: " + e.stack + ")";
-            }
-            this.done();
-            if (debug && e.constructor !== AssertionError) {
-                throw e;
-            }
-        }
-    };
-
-    Test.prototype.step_func = function(func, this_obj)
-    {
-        var test_this = this;
-
-        if (arguments.length === 1)
-        {
-            this_obj = test_this;
-        }
-
-        return function()
-        {
-            test_this.step.apply(test_this, [func, this_obj].concat(
-                Array.prototype.slice.call(arguments)));
-        };
-    };
-
-    Test.prototype.step_func_done = function(func, this_obj)
-    {
-        var test_this = this;
-
-        if (arguments.length === 1)
-        {
-            this_obj = test_this;
-        }
-
-        return function()
-        {
-            test_this.step.apply(test_this, [func, this_obj].concat(
-                Array.prototype.slice.call(arguments)));
-            test_this.done();
-        };
-    };
-
-    Test.prototype.set_timeout = function()
-    {
-        var this_obj = this;
-        this.timeout_id = setTimeout(function()
-                                     {
-                                         this_obj.timeout();
-                                     }, this.timeout_length);
-    };
-
-    Test.prototype.timeout = function()
-    {
-        this.status = this.TIMEOUT;
-        this.timeout_id = null;
-        this.message = "Test timed out";
-        this.done();
-    };
-
-    Test.prototype.done = function()
-    {
-        if (this.is_done) {
-            return;
-        }
-        clearTimeout(this.timeout_id);
-        if (this.status === this.NOTRUN)
-        {
-            this.status = this.PASS;
-        }
-        this.is_done = true;
-        tests.result(this);
-    };
-
-
-    /*
-     * Harness
-     */
-
-    function TestsStatus()
-    {
-        this.status = null;
-        this.message = null;
-    }
-
-    TestsStatus.statuses = {
-        OK:0,
-        ERROR:1,
-        TIMEOUT:2
-    };
-
-    TestsStatus.prototype = merge({}, TestsStatus.statuses);
-
-    TestsStatus.prototype.structured_clone = function()
-    {
-        if(!this._structured_clone)
-        {
-            var msg = this.message;
-            msg = msg ? String(msg) : msg;
-            this._structured_clone = merge({
-                status:this.status,
-                message:msg
-            }, TestsStatus.statuses);
-        }
-        return this._structured_clone;
-    };
-
-    function Tests()
-    {
-        this.tests = [];
-        this.num_pending = 0;
-
-        this.phases = {
-            INITIAL:0,
-            SETUP:1,
-            HAVE_TESTS:2,
-            HAVE_RESULTS:3,
-            COMPLETE:4
-        };
-        this.phase = this.phases.INITIAL;
-
-        this.properties = {};
-
-        //All tests can't be done until the load event fires
-        this.all_loaded = false;
-        this.wait_for_finish = false;
-        this.processing_callbacks = false;
-
-        this.timeout_length = settings.timeout;
-        this.timeout_id = null;
-
-        this.start_callbacks = [];
-        this.test_done_callbacks = [];
-        this.all_done_callbacks = [];
-
-        this.status = new TestsStatus();
-
-        var this_obj = this;
-
-        on_event(window, "load",
-                 function()
-                 {
-                     this_obj.all_loaded = true;
-                     if (this_obj.all_done())
-                     {
-                         this_obj.complete();
-                     }
-                 });
-
-        this.set_timeout();
-    }
-
-    Tests.prototype.setup = function(func, properties)
-    {
-        if (this.phase >= this.phases.HAVE_RESULTS)
-        {
-            return;
-        }
-        if (this.phase < this.phases.SETUP)
-        {
-            this.phase = this.phases.SETUP;
-        }
-
-        for (var p in properties)
-        {
-            if (properties.hasOwnProperty(p))
-            {
-                this.properties[p] = properties[p];
-            }
-        }
-
-        if (properties.timeout)
-        {
-            this.timeout_length = properties.timeout;
-        }
-        if (properties.explicit_done)
-        {
-            this.wait_for_finish = true;
-        }
-        if (properties.explicit_timeout) {
-            this.timeout_length = null;
-        }
-
-        if (func)
-        {
-            try
-            {
-                func();
-            } catch(e)
-            {
-                this.status.status = this.status.ERROR;
-                this.status.message = e;
-            };
-        }
-        this.set_timeout();
-    };
-
-    Tests.prototype.set_timeout = function()
-    {
-        var this_obj = this;
-        clearTimeout(this.timeout_id);
-        if (this.timeout_length !== null)
-        {
-            this.timeout_id = setTimeout(function() {
-                                             this_obj.timeout();
-                                         }, this.timeout_length);
-        }
-    };
-
-    Tests.prototype.timeout = function() {
-        this.status.status = this.status.TIMEOUT;
-        this.complete();
-    };
-
-    Tests.prototype.end_wait = function()
-    {
-        this.wait_for_finish = false;
-        if (this.all_done()) {
-            this.complete();
-        }
-    };
-
-    Tests.prototype.push = function(test)
-    {
-        if (this.phase < this.phases.HAVE_TESTS) {
-            this.start();
-        }
-        this.num_pending++;
-        this.tests.push(test);
-    };
-
-    Tests.prototype.all_done = function() {
-        return (this.all_loaded && this.num_pending === 0 &&
-                !this.wait_for_finish && !this.processing_callbacks);
-    };
-
-    Tests.prototype.start = function() {
-        this.phase = this.phases.HAVE_TESTS;
-        this.notify_start();
-    };
-
-    Tests.prototype.notify_start = function() {
-        var this_obj = this;
-        forEach (this.start_callbacks,
-                 function(callback)
-                 {
-                     callback(this_obj.properties);
-                 });
-        forEach_windows(
-                function(w, is_same_origin)
-                {
-                    if(is_same_origin && w.start_callback)
-                    {
-                        try
-                        {
-                            w.start_callback(this_obj.properties);
-                        }
-                        catch(e)
-                        {
-                            if (debug)
-                            {
-                                throw(e);
-                            }
-                        }
-                    }
-                    if (supports_post_message(w) && w !== self)
-                    {
-                        w.postMessage({
-                            type: "start",
-                            properties: this_obj.properties
-                        }, "*");
-                    }
-                });
-    };
-
-    Tests.prototype.result = function(test)
-    {
-        if (this.phase > this.phases.HAVE_RESULTS)
-        {
-            return;
-        }
-        this.phase = this.phases.HAVE_RESULTS;
-        this.num_pending--;
-        this.notify_result(test);
-    };
-
-    Tests.prototype.notify_result = function(test) {
-        var this_obj = this;
-        this.processing_callbacks = true;
-        forEach(this.test_done_callbacks,
-                function(callback)
-                {
-                    callback(test, this_obj);
-                });
-
-        forEach_windows(
-                function(w, is_same_origin)
-                {
-                    if(is_same_origin && w.result_callback)
-                    {
-                        try
-                        {
-                            w.result_callback(test);
-                        }
-                        catch(e)
-                        {
-                            if(debug) {
-                                throw e;
-                            }
-                        }
-                    }
-                    if (supports_post_message(w) && w !== self)
-                    {
-                        w.postMessage({
-                            type: "result",
-                            test: test.structured_clone()
-                        }, "*");
-                    }
-                });
-        this.processing_callbacks = false;
-        if (this_obj.all_done())
-        {
-            this_obj.complete();
-        }
-    };
-
-    Tests.prototype.complete = function() {
-        if (this.phase === this.phases.COMPLETE) {
-            return;
-        }
-        this.phase = this.phases.COMPLETE;
-        var this_obj = this;
-        this.tests.forEach(
-            function(x)
-            {
-                if(x.status === x.NOTRUN)
-                {
-                    this_obj.notify_result(x);
-                }
-            }
-        );
-        this.notify_complete();
-    };
-
-    Tests.prototype.notify_complete = function()
-    {
-        clearTimeout(this.timeout_id);
-        var this_obj = this;
-        var tests = map(this_obj.tests,
-                        function(test)
-                        {
-                            return test.structured_clone();
-                        });
-        if (this.status.status === null)
-        {
-            this.status.status = this.status.OK;
-        }
-
-        forEach (this.all_done_callbacks,
-                 function(callback)
-                 {
-                     callback(this_obj.tests, this_obj.status);
-                 });
-
-        forEach_windows(
-                function(w, is_same_origin)
-                {
-                    if(is_same_origin && w.completion_callback)
-                    {
-                        try
-                        {
-                            w.completion_callback(this_obj.tests, this_obj.status);
-                        }
-                        catch(e)
-                        {
-                            if (debug)
-                            {
-                                throw e;
-                            }
-                        }
-                    }
-                    if (supports_post_message(w) && w !== self)
-                    {
-                        w.postMessage({
-                            type: "complete",
-                            tests: tests,
-                            status: this_obj.status.structured_clone()
-                        }, "*");
-                    }
-                });
-    };
-
-    var tests = new Tests();
-
-    function timeout() {
-        if (tests.timeout_length === null)
-        {
-            tests.timeout();
-        }
-    }
-    expose(timeout, 'timeout');
-
-    function add_start_callback(callback) {
-        tests.start_callbacks.push(callback);
-    }
-
-    function add_result_callback(callback)
-    {
-        tests.test_done_callbacks.push(callback);
-    }
-
-    function add_completion_callback(callback)
-    {
-       tests.all_done_callbacks.push(callback);
-    }
-
-    expose(add_start_callback, 'add_start_callback');
-    expose(add_result_callback, 'add_result_callback');
-    expose(add_completion_callback, 'add_completion_callback');
-
-    /*
-     * Output listener
-    */
-
-    function Output() {
-      this.output_document = document;
-      this.output_node = null;
-      this.done_count = 0;
-      this.enabled = settings.output;
-      this.phase = this.INITIAL;
-    }
-
-    Output.prototype.INITIAL = 0;
-    Output.prototype.STARTED = 1;
-    Output.prototype.HAVE_RESULTS = 2;
-    Output.prototype.COMPLETE = 3;
-
-    Output.prototype.setup = function(properties) {
-        if (this.phase > this.INITIAL) {
-            return;
-        }
-
-        //If output is disabled in testharnessreport.js the test shouldn't be
-        //able to override that
-        this.enabled = this.enabled && (properties.hasOwnProperty("output") ?
-                                        properties.output : settings.output);
-    };
-
-    Output.prototype.init = function(properties)
-    {
-        if (this.phase >= this.STARTED) {
-            return;
-        }
-        if (properties.output_document) {
-            this.output_document = properties.output_document;
-        } else {
-            this.output_document = document;
-        }
-        this.phase = this.STARTED;
-    };
-
-    Output.prototype.resolve_log = function()
-    {
-        var output_document;
-        if (typeof this.output_document === "function")
-        {
-            output_document = this.output_document.apply(undefined);
-        } else
-        {
-            output_document = this.output_document;
-        }
-        if (!output_document)
-        {
-            return;
-        }
-        var node = output_document.getElementById("log");
-        if (node)
-        {
-            this.output_document = output_document;
-            this.output_node = node;
-        }
-    };
-
-    Output.prototype.show_status = function(test)
-    {
-        if (this.phase < this.STARTED)
-        {
-            this.init();
-        }
-        if (!this.enabled)
-        {
-            return;
-        }
-        if (this.phase < this.HAVE_RESULTS)
-        {
-            this.resolve_log();
-            this.phase = this.HAVE_RESULTS;
-        }
-        this.done_count++;
-        if (this.output_node)
-        {
-            if (this.done_count < 100
-            || (this.done_count < 1000 && this.done_count % 100 == 0)
-            || this.done_count % 1000 == 0) {
-                this.output_node.textContent = "Running, "
-                    + this.done_count + " complete, "
-                    + tests.num_pending + " remain";
-            }
-        }
-    };
-
-    Output.prototype.show_results = function (tests, harness_status)
-    {
-        if (this.phase >= this.COMPLETE) {
-            return;
-        }
-        if (!this.enabled)
-        {
-            return;
-        }
-        if (!this.output_node) {
-            this.resolve_log();
-        }
-        this.phase = this.COMPLETE;
-
-        var log = this.output_node;
-        if (!log)
-        {
-            return;
-        }
-        var output_document = this.output_document;
-
-        while (log.lastChild)
-        {
-            log.removeChild(log.lastChild);
-        }
-
-        if (script_prefix != null) {
-            var stylesheet = output_document.createElementNS(xhtml_ns, "link");
-            stylesheet.setAttribute("rel", "stylesheet");
-            stylesheet.setAttribute("href", script_prefix + "testharness.css");
-            var heads = output_document.getElementsByTagName("head");
-            if (heads.length) {
-                heads[0].appendChild(stylesheet);
-            }
-        }
-
-        var status_text = {};
-        status_text[Test.prototype.PASS] = "Pass";
-        status_text[Test.prototype.FAIL] = "Fail";
-        status_text[Test.prototype.TIMEOUT] = "Timeout";
-        status_text[Test.prototype.NOTRUN] = "Not Run";
-
-        var status_number = {};
-        forEach(tests, function(test) {
-                    var status = status_text[test.status];
-                    if (status_number.hasOwnProperty(status))
-                    {
-                        status_number[status] += 1;
-                    } else {
-                        status_number[status] = 1;
-                    }
-                });
-
-        function status_class(status)
-        {
-            return status.replace(/\s/g, '').toLowerCase();
-        }
-
-        var summary_template = ["section", {"id":"summary"},
-                                ["h2", {}, "Summary"],
-                                ["p", {}, "Found ${num_tests} tests"],
-                                function(vars) {
-                                    var rv = [["div", {}]];
-                                    var i=0;
-                                    while (status_text.hasOwnProperty(i)) {
-                                        if (status_number.hasOwnProperty(status_text[i])) {
-                                            var status = status_text[i];
-                                            rv[0].push(["div", {"class":status_class(status)},
-                                                        ["label", {},
-                                                         ["input", {type:"checkbox", checked:"checked"}],
-                                                         status_number[status] + " " + status]]);
-                                        }
-                                        i++;
-                                    }
-                                    return rv;
-                                }];
-
-        log.appendChild(render(summary_template, {num_tests:tests.length}, output_document));
-
-        forEach(output_document.querySelectorAll("section#summary label"),
-                function(element)
-                {
-                    on_event(element, "click",
-                             function(e)
-                             {
-                                 if (output_document.getElementById("results") === null)
-                                 {
-                                     e.preventDefault();
-                                     return;
-                                 }
-                                 var result_class = element.parentNode.getAttribute("class");
-                                 var style_element = output_document.querySelector("style#hide-" + result_class);
-                                 var input_element = element.querySelector("input");
-                                 if (!style_element && !input_element.checked) {
-                                     style_element = output_document.createElementNS(xhtml_ns, "style");
-                                     style_element.id = "hide-" + result_class;
-                                     style_element.textContent = "table#results > tbody > tr."+result_class+"{display:none}";
-                                     output_document.body.appendChild(style_element);
-                                 } else if (style_element && input_element.checked) {
-                                     style_element.parentNode.removeChild(style_element);
-                                 }
-                             });
-                });
-
-        // This use of innerHTML plus manual escaping is not recommended in
-        // general, but is necessary here for performance.  Using textContent
-        // on each individual <td> adds tens of seconds of execution time for
-        // large test suites (tens of thousands of tests).
-        function escape_html(s)
-        {
-            return s.replace(/\&/g, "&amp;")
-                .replace(/</g, "&lt;")
-                .replace(/"/g, "&quot;")
-                .replace(/'/g, "&#39;");
-        }
-
-        function has_assertions()
-        {
-            for (var i = 0; i < tests.length; i++) {
-                if (tests[i].properties.hasOwnProperty("assert")) {
-                    return true;
-                }
-            }
-            return false;
-        }
-        
-        function get_assertion(test)
-        {
-            if (test.properties.hasOwnProperty("assert")) {
-                if (Array.isArray(test.properties.assert)) {
-                    return test.properties.assert.join(' ');
-                }
-                return test.properties.assert;
-            }
-            return '';
-        }
-        
-        log.appendChild(document.createElementNS(xhtml_ns, "section"));
-        var assertions = has_assertions();
-        var html = "<h2>Details</h2><table id='results' " + (assertions ? "class='assertions'" : "" ) + ">"
-            + "<thead><tr><th>Result</th><th>Test Name</th>"
-            + (assertions ? "<th>Assertion</th>" : "")
-            + "<th>Message</th></tr></thead>"
-            + "<tbody>";
-        for (var i = 0; i < tests.length; i++) {
-            html += '<tr class="'
-                + escape_html(status_class(status_text[tests[i].status]))
-                + '"><td>'
-                + escape_html(status_text[tests[i].status])
-                + "</td><td>"
-                + escape_html(tests[i].name)
-                + "</td><td>"
-                + (assertions ? escape_html(get_assertion(tests[i])) + "</td><td>" : "")
-                + escape_html(tests[i].message ? tests[i].message : " ")
-                + "</td></tr>";
-        }
-        html += "</tbody></table>";
-        try {
-            log.lastChild.innerHTML = html;
-        } catch (e) {
-            log.appendChild(document.createElementNS(xhtml_ns, "p"))
-               .textContent = "Setting innerHTML for the log threw an exception.";
-            log.appendChild(document.createElementNS(xhtml_ns, "pre"))
-               .textContent = html;
-        }
-    };
-
-    var output = new Output();
-    add_start_callback(function (properties) {output.init(properties);});
-    add_result_callback(function (test) {output.show_status(tests);});
-    add_completion_callback(function (tests, harness_status) {output.show_results(tests, harness_status);});
-
-    /*
-     * Template code
-     *
-     * A template is just a javascript structure. An element is represented as:
-     *
-     * [tag_name, {attr_name:attr_value}, child1, child2]
-     *
-     * the children can either be strings (which act like text nodes), other templates or
-     * functions (see below)
-     *
-     * A text node is represented as
-     *
-     * ["{text}", value]
-     *
-     * String values have a simple substitution syntax; ${foo} represents a variable foo.
-     *
-     * It is possible to embed logic in templates by using a function in a place where a
-     * node would usually go. The function must either return part of a template or null.
-     *
-     * In cases where a set of nodes are required as output rather than a single node
-     * with children it is possible to just use a list
-     * [node1, node2, node3]
-     *
-     * Usage:
-     *
-     * render(template, substitutions) - take a template and an object mapping
-     * variable names to parameters and return either a DOM node or a list of DOM nodes
-     *
-     * substitute(template, substitutions) - take a template and variable mapping object,
-     * make the variable substitutions and return the substituted template
-     *
-     */
-
-    function is_single_node(template)
-    {
-        return typeof template[0] === "string";
-    }
-
-    function substitute(template, substitutions)
-    {
-        if (typeof template === "function") {
-            var replacement = template(substitutions);
-            if (replacement)
-            {
-                var rv = substitute(replacement, substitutions);
-                return rv;
-            }
-            else
-            {
-                return null;
-            }
-        }
-        else if (is_single_node(template))
-        {
-            return substitute_single(template, substitutions);
-        }
-        else
-        {
-            return filter(map(template, function(x) {
-                                  return substitute(x, substitutions);
-                              }), function(x) {return x !== null;});
-        }
-    }
-
-    function substitute_single(template, substitutions)
-    {
-        var substitution_re = /\${([^ }]*)}/g;
-
-        function do_substitution(input) {
-            var components = input.split(substitution_re);
-            var rv = [];
-            for (var i=0; i<components.length; i+=2)
-            {
-                rv.push(components[i]);
-                if (components[i+1])
-                {
-                    rv.push(String(substitutions[components[i+1]]));
-                }
-            }
-            return rv;
-        }
-
-        var rv = [];
-        rv.push(do_substitution(String(template[0])).join(""));
-
-        if (template[0] === "{text}") {
-            substitute_children(template.slice(1), rv);
-        } else {
-            substitute_attrs(template[1], rv);
-            substitute_children(template.slice(2), rv);
-        }
-
-        function substitute_attrs(attrs, rv)
-        {
-            rv[1] = {};
-            for (var name in template[1])
-            {
-                if (attrs.hasOwnProperty(name))
-                {
-                    var new_name = do_substitution(name).join("");
-                    var new_value = do_substitution(attrs[name]).join("");
-                    rv[1][new_name] = new_value;
-                };
-            }
-        }
-
-        function substitute_children(children, rv)
-        {
-            for (var i=0; i<children.length; i++)
-            {
-                if (children[i] instanceof Object) {
-                    var replacement = substitute(children[i], substitutions);
-                    if (replacement !== null)
-                    {
-                        if (is_single_node(replacement))
-                        {
-                            rv.push(replacement);
-                        }
-                        else
-                        {
-                            extend(rv, replacement);
-                        }
-                    }
-                }
-                else
-                {
-                    extend(rv, do_substitution(String(children[i])));
-                }
-            }
-            return rv;
-        }
-
-        return rv;
-    }
-
- function make_dom_single(template, doc)
- {
-     var output_document = doc || document;
-     if (template[0] === "{text}")
-     {
-         var element = output_document.createTextNode("");
-         for (var i=1; i<template.length; i++)
-         {
-             element.data += template[i];
-         }
-     }
-     else
-     {
-         var element = output_document.createElementNS(xhtml_ns, template[0]);
-         for (var name in template[1]) {
-             if (template[1].hasOwnProperty(name))
-             {
-                 element.setAttribute(name, template[1][name]);
-             }
-         }
-         for (var i=2; i<template.length; i++)
-         {
-             if (template[i] instanceof Object)
-             {
-                 var sub_element = make_dom(template[i]);
-                 element.appendChild(sub_element);
-             }
-             else
-             {
-                 var text_node = output_document.createTextNode(template[i]);
-                 element.appendChild(text_node);
-             }
-         }
-     }
-
-     return element;
- }
-
-
-
- function make_dom(template, substitutions, output_document)
-    {
-        if (is_single_node(template))
-        {
-            return make_dom_single(template, output_document);
-        }
-        else
-        {
-            return map(template, function(x) {
-                           return make_dom_single(x, output_document);
-                       });
-        }
-    }
-
- function render(template, substitutions, output_document)
-    {
-        return make_dom(substitute(template, substitutions), output_document);
-    }
-
-    /*
-     * Utility funcions
-     */
-    function assert(expected_true, function_name, description, error, substitutions)
-    {
-        if (expected_true !== true)
-        {
-            throw new AssertionError(make_message(function_name, description,
-                                                  error, substitutions));
-        }
-    }
-
-    function AssertionError(message)
-    {
-        this.message = message;
-    }
-
-    function make_message(function_name, description, error, substitutions)
-    {
-        for (var p in substitutions) {
-            if (substitutions.hasOwnProperty(p)) {
-                substitutions[p] = format_value(substitutions[p]);
-            }
-        }
-        var node_form = substitute(["{text}", "${function_name}: ${description}" + error],
-                                   merge({function_name:function_name,
-                                          description:(description?description + " ":"")},
-                                          substitutions));
-        return node_form.slice(1).join("");
-    }
-
-    function filter(array, callable, thisObj) {
-        var rv = [];
-        for (var i=0; i<array.length; i++)
-        {
-            if (array.hasOwnProperty(i))
-            {
-                var pass = callable.call(thisObj, array[i], i, array);
-                if (pass) {
-                    rv.push(array[i]);
-                }
-            }
-        }
-        return rv;
-    }
-
-    function map(array, callable, thisObj)
-    {
-        var rv = [];
-        rv.length = array.length;
-        for (var i=0; i<array.length; i++)
-        {
-            if (array.hasOwnProperty(i))
-            {
-                rv[i] = callable.call(thisObj, array[i], i, array);
-            }
-        }
-        return rv;
-    }
-
-    function extend(array, items)
-    {
-        Array.prototype.push.apply(array, items);
-    }
-
-    function forEach (array, callback, thisObj)
-    {
-        for (var i=0; i<array.length; i++)
-        {
-            if (array.hasOwnProperty(i))
-            {
-                callback.call(thisObj, array[i], i, array);
-            }
-        }
-    }
-
-    function merge(a,b)
-    {
-        var rv = {};
-        var p;
-        for (p in a)
-        {
-            rv[p] = a[p];
-        }
-        for (p in b) {
-            rv[p] = b[p];
-        }
-        return rv;
-    }
-
-    function expose(object, name)
-    {
-        var components = name.split(".");
-        var target = window;
-        for (var i=0; i<components.length - 1; i++)
-        {
-            if (!(components[i] in target))
-            {
-                target[components[i]] = {};
-            }
-            target = target[components[i]];
-        }
-        target[components[components.length - 1]] = object;
-    }
-
-    function forEach_windows(callback) {
-        // Iterate of the the windows [self ... top, opener]. The callback is passed
-        // two objects, the first one is the windows object itself, the second one
-        // is a boolean indicating whether or not its on the same origin as the
-        // current window.
-        var cache = forEach_windows.result_cache;
-        if (!cache) {
-            cache = [[self, true]];
-            var w = self;
-            var i = 0;
-            var so;
-            var origins = location.ancestorOrigins;
-            while (w != w.parent)
-            {
-                w = w.parent;
-                // In WebKit, calls to parent windows' properties that aren't on the same
-                // origin cause an error message to be displayed in the error console but
-                // don't throw an exception. This is a deviation from the current HTML5
-                // spec. See: https://bugs.webkit.org/show_bug.cgi?id=43504
-                // The problem with WebKit's behavior is that it pollutes the error console
-                // with error messages that can't be caught.
-                //
-                // This issue can be mitigated by relying on the (for now) proprietary
-                // `location.ancestorOrigins` property which returns an ordered list of
-                // the origins of enclosing windows. See:
-                // http://trac.webkit.org/changeset/113945.
-                if(origins) {
-                    so = (location.origin == origins[i]);
-                }
-                else
-                {
-                    so = is_same_origin(w);
-                }
-                cache.push([w, so]);
-                i++;
-            }
-            w = window.opener;
-            if(w)
-            {
-                // window.opener isn't included in the `location.ancestorOrigins` prop.
-                // We'll just have to deal with a simple check and an error msg on WebKit
-                // browsers in this case.
-                cache.push([w, is_same_origin(w)]);
-            }
-            forEach_windows.result_cache = cache;
-        }
-
-        forEach(cache,
-                function(a)
-                {
-                    callback.apply(null, a);
-                });
-    }
-
-    function is_same_origin(w) {
-        try {
-            'random_prop' in w;
-            return true;
-        } catch(e) {
-            return false;
-        }
-    }
-
-    function supports_post_message(w)
-    {
-        var supports;
-        var type;
-        // Given IE  implements postMessage across nested iframes but not across
-        // windows or tabs, you can't infer cross-origin communication from the presence
-        // of postMessage on the current window object only.
-        //
-        // Touching the postMessage prop on a window can throw if the window is
-        // not from the same origin AND post message is not supported in that
-        // browser. So just doing an existence test here won't do, you also need
-        // to wrap it in a try..cacth block.
-        try
-        {
-            type = typeof w.postMessage;
-            if (type === "function")
-            {
-                supports = true;
-            }
-            // IE8 supports postMessage, but implements it as a host object which
-            // returns "object" as its `typeof`.
-            else if (type === "object")
-            {
-                supports = true;
-            }
-            // This is the case where postMessage isn't supported AND accessing a
-            // window property across origins does NOT throw (e.g. old Safari browser).
-            else
-            {
-                supports = false;
-            }
-        }
-        catch(e) {
-            // This is the case where postMessage isn't supported AND accessing a
-            // window property across origins throws (e.g. old Firefox browser).
-            supports = false;
-        }
-        return supports;
-    }
-})();
-// vim: set expandtab shiftwidth=4 tabstop=4:
deleted file mode 100644
--- a/testing/web-platform/tests/app-uri/resources/testharnessreport.js
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- * This file is intended for vendors to implement
- * code needed to integrate testharness.js tests with their own test systems.
- *
- * The default implementation extracts metadata from the tests and validates 
- * it against the cached version that should be present in the test source 
- * file. If the cache is not found or is out of sync, source code suitable for
- * caching the metadata is optionally generated.
- *
- * The cached metadata is present for extraction by test processing tools that
- * are unable to execute javascript.
- *
- * Metadata is attached to tests via the properties parameter in the test
- * constructor. See testharness.js for details.
- *
- * Typically test system integration will attach callbacks when each test has
- * run, using add_result_callback(callback(test)), or when the whole test file
- * has completed, using 
- * add_completion_callback(callback(tests, harness_status)).
- *
- * For more documentation about the callback functions and the
- * parameters they are called with see testharness.js
- */
-
-
-
-var metadata_generator = {
-
-    currentMetadata: {},
-    cachedMetadata: false,
-    metadataProperties: ['help', 'assert', 'author'],
-    
-    error: function(message) {
-        var messageElement = document.createElement('p');
-        messageElement.setAttribute('class', 'error');
-        this.appendText(messageElement, message);
-        
-        var summary = document.getElementById('summary');
-        if (summary) {
-            summary.parentNode.insertBefore(messageElement, summary);
-        }
-        else {
-            document.body.appendChild(messageElement);
-        }
-    },
-
-    /**
-     * Ensure property value has contact information
-     */
-    validateContact: function(test, propertyName) {
-        var result = true;
-        var value = test.properties[propertyName];
-        var values = Array.isArray(value) ? value : [value];
-        for (var index = 0; index < values.length; index++) {
-            value = values[index];
-            var re = /(\S+)(\s*)<(.*)>(.*)/;
-            if (! re.test(value)) {
-                re = /(\S+)(\s+)(http[s]?:\/\/)(.*)/
-                if (! re.test(value)) {
-                    this.error('Metadata property "' + propertyName + 
-                        '" for test: "' + test.name +
-                        '" must have name and contact information ' +
-                        '("name <email>" or "name http(s)://")');
-                    result = false;
-                }
-            }
-        }
-        return result;
-    },
-    
-    /**
-     * Extract metadata from test object
-     */
-    extractFromTest: function(test) {
-        var testMetadata = {};
-        // filter out metadata from other properties in test
-        for (var metaIndex = 0; metaIndex < this.metadataProperties.length;
-             metaIndex++) {
-            var meta = this.metadataProperties[metaIndex];
-            if (test.properties.hasOwnProperty(meta)) {
-                if ('author' == meta) {
-                    this.validateContact(test, meta);
-                }
-                testMetadata[meta] = test.properties[meta];
-            }
-        }
-        return testMetadata;
-    },
-    
-    /**
-     * Compare cached metadata to extracted metadata
-     */
-    validateCache: function() {
-        for (var testName in this.currentMetadata) {
-            if (! this.cachedMetadata.hasOwnProperty(testName)) {
-                return false;
-            }
-            var testMetadata = this.currentMetadata[testName];
-            var cachedTestMetadata = this.cachedMetadata[testName];
-            delete this.cachedMetadata[testName];
-            
-            for (var metaIndex = 0; metaIndex < this.metadataProperties.length;
-                 metaIndex++) {
-                var meta = this.metadataProperties[metaIndex];
-                if (cachedTestMetadata.hasOwnProperty(meta) && 
-                    testMetadata.hasOwnProperty(meta)) {
-                    if (Array.isArray(cachedTestMetadata[meta])) {
-                      if (! Array.isArray(testMetadata[meta])) {
-                          return false;
-                      }
-                      if (cachedTestMetadata[meta].length == 
-                          testMetadata[meta].length) {
-                          for (var index = 0; 
-                               index < cachedTestMetadata[meta].length; 
-                               index++) {
-                              if (cachedTestMetadata[meta][index] != 
-                                  testMetadata[meta][index]) {
-                                  return false;
-                              }
-                          }
-                      }
-                      else {
-                          return false;
-                      }
-                    }
-                    else {
-                      if (Array.isArray(testMetadata[meta])) {
-                        return false;
-                      }
-                      if (cachedTestMetadata[meta] != testMetadata[meta]) {
-                        return false;
-                      }
-                    }
-                }
-                else if (cachedTestMetadata.hasOwnProperty(meta) || 
-                         testMetadata.hasOwnProperty(meta)) {
-                    return false;
-                }
-            }
-        }
-        for (var testName in this.cachedMetadata) {
-            return false;
-        }
-        return true;
-    },
-  
-    appendText: function(elemement, text) {
-        elemement.appendChild(document.createTextNode(text));
-    },
-  
-    jsonifyArray: function(arrayValue, indent) {
-        var output = '[';
-
-        if (1 == arrayValue.length) {
-            output += JSON.stringify(arrayValue[0]);
-        }
-        else {
-            for (var index = 0; index < arrayValue.length; index++) {
-                if (0 < index) {
-                    output += ',\n  ' + indent;
-                }
-                output += JSON.stringify(arrayValue[index]);
-            }
-        }
-        output += ']';
-        return output;
-    },
-    
-    jsonifyObject: function(objectValue, indent) {
-        var output = '{';
-        
-        var count = 0;
-        for (var property in objectValue) {
-            ++count;
-            if (Array.isArray(objectValue[property]) || 
-                ('object' == typeof(value))) {
-                ++count;
-            }
-        }
-        if (1 == count) {
-            for (var property in objectValue) {
-                output += ' "' + property + '": '
-                          + JSON.stringify(objectValue[property])
-                          + ' ';
-            }
-        }
-        else {
-            var first = true;
-            for (var property in objectValue) {
-                if (! first) {
-                    output += ',';
-                }
-                first = false;
-                output += '\n  ' + indent + '"' + property + '": ';
-                var value = objectValue[property];
-                if (Array.isArray(value)) {
-                    output += this.jsonifyArray(value, indent + 
-                        '                '.substr(0, 5 + property.length));
-                }
-                else if ('object' == typeof(value)) {
-                    output += this.jsonifyObject(value, indent + '  ');
-                }
-                else {
-                    output += JSON.stringify(value);
-                }
-            }
-            if (1 < output.length) {
-                output += '\n' + indent;
-            }
-        }
-        output += '}';
-        return output;
-    },
-  
-    /**
-     * Generate javascript source code for captured metadata
-     * Metadata is in pretty-printed JSON format
-     */
-    generateSource: function() {
-        var source = 
-            '<script id="metadata_cache">/*\n' + 
-            this.jsonifyObject(this.currentMetadata, '') + '\n' + 
-            '*/</script>\n';
-        return source;
-    },
-    
-    /**
-     * Add element containing metadata source code
-     */
-    addSourceElement: function(event) {
-        var sourceWrapper = document.createElement('div');
-        sourceWrapper.setAttribute('id', 'metadata_source');
-
-        var instructions = document.createElement('p');
-        if (this.cachedMetadata) {
-            this.appendText(instructions, 
-                'Replace the existing <script id="metadata_cache"> element ' + 
-                'in the test\'s <head> with the following:');
-        }
-        else {
-            this.appendText(instructions, 
-                'Copy the following into the <head> element of the test ' +
-                'or the test\'s metadata sidecar file:');
-        }
-        sourceWrapper.appendChild(instructions);
-        
-        var sourceElement = document.createElement('pre');
-        this.appendText(sourceElement, this.generateSource());
-
-        sourceWrapper.appendChild(sourceElement);
-        
-        var messageElement = document.getElementById('metadata_issue');
-        messageElement.parentNode.insertBefore(sourceWrapper, 
-                                               messageElement.nextSibling);
-        messageElement.parentNode.removeChild(messageElement);
-
-        (event.preventDefault) ? event.preventDefault() : 
-                                 event.returnValue = false;
-    },
-    
-    /**
-     * Extract the metadata cache from the cache element if present
-     */
-    getCachedMetadata: function() {
-        var cacheElement = document.getElementById('metadata_cache');
-        
-        if (cacheElement) {
-            var cacheText = cacheElement.firstChild.nodeValue;
-            var openBrace = cacheText.indexOf('{');
-            var closeBrace = cacheText.lastIndexOf('}');
-            if ((-1 < openBrace) && (-1 < closeBrace)) {
-                cacheText = cacheText.slice(openBrace, closeBrace + 1);
-                try {
-                    this.cachedMetadata = JSON.parse(cacheText);
-                }
-                catch (exc) {
-                    this.cachedMetadata = 'Invalid JSON in Cached metadata. ';
-                }
-            }
-            else {
-                this.cachedMetadata = 'Metadata not found in cache element. ';
-            }
-        }
-    },
-    
-    /**
-     * Main entry point, extract metadata from tests, compare to cached version
-     * if present.
-     * If cache not present or differs from extrated metadata, generate an error
-     */
-    process: function(tests, harness_status) {
-        for (var index = 0; index < tests.length; index++) {
-            var test = tests[index];
-            if (this.currentMetadata.hasOwnProperty(test.name)) {
-                this.error('Duplicate test name: ' + test.name);
-            }
-            else {
-                this.currentMetadata[test.name] = this.extractFromTest(test);
-            }
-        }
-
-        this.getCachedMetadata();
-        
-        var message = null;
-        var messageClass = 'warning';
-        var showSource = false;
-        
-        if (0 == tests.length) {
-            if (this.cachedMetadata) {
-                message = 'Cached metadata present but no tests. ';
-            }
-        }
-        else if (1 == tests.length) {
-            if (this.cachedMetadata) {
-                message = 'Single test files should not have cached metadata. ';
-            }
-            else {
-                var testMetadata = this.currentMetadata[tests[0].name];
-                var hasMetadata = false;
-                for (var meta in testMetadata) {
-                    hasMetadata |= testMetadata.hasOwnProperty(meta);
-                }
-                if (hasMetadata) {
-                    message = 'Single tests should not have metadata. ' +
-                              'Move metadata to <head>. ';
-                }
-            }
-        }
-        else {
-            if (this.cachedMetadata) {
-                messageClass = 'error';
-                if ('string' == typeof(this.cachedMetadata)) {
-                    message = this.cachedMetadata;
-                    showSource = true;
-                }
-                else if (! this.validateCache()) {
-                    message = 'Cached metadata out of sync. ';
-                    showSource = true;
-                }
-            }
-        }
-        
-        if (message) {
-            var messageElement = document.createElement('p');
-            messageElement.setAttribute('id', 'metadata_issue');
-            messageElement.setAttribute('class', messageClass);
-            this.appendText(messageElement, message);
-            
-            if (showSource) {
-                var link = document.createElement('a');
-                this.appendText(link, 'Click for source code.');
-                link.setAttribute('href', '#');
-                link.setAttribute('onclick', 
-                                  'metadata_generator.addSourceElement(event)');
-                messageElement.appendChild(link);
-            }
-            
-            var summary = document.getElementById('summary');
-            if (summary) {
-                summary.parentNode.insertBefore(messageElement, summary);
-            }
-            else {
-                var log = document.getElementById('log');
-                if (log) {
-                    log.appendChild(messageElement);
-                }
-            }
-        }
-    },
-
-    setup: function() {
-        add_completion_callback(
-            function (tests, harness_status) { 
-                metadata_generator.process(tests, harness_status)
-            });
-    }
-}
-
-metadata_generator.setup();
-// vim: set expandtab shiftwidth=4 tabstop=4:
--- a/testing/web-platform/tests/content-security-policy/support/checkReport.sub.js
+++ b/testing/web-platform/tests/content-security-policy/support/checkReport.sub.js
@@ -26,17 +26,17 @@
     if (cookieName == thisTestName) {
       reportID = cookieValue;
       var cookieToDelete = cookieName + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=" + document.location.pathname.substring(0, document.location.pathname.lastIndexOf('/') + 1);
       document.cookie = cookieToDelete;
       break;
     }
   }
 
-  var reportLocation = location.protocol + "//" + location.host + "/content-security-policy/support/report.py?op=take&timeout=3&reportID=" + reportID;
+  var reportLocation = location.protocol + "//" + location.host + "/content-security-policy/support/report.py?op=take&timeout=5&reportID=" + reportID;
 
   var reportTest = async_test("Violation report status OK.");
   reportTest.step(function () {
 
     var report = new XMLHttpRequest();
     report.onload = reportTest.step_func(function () {
 
         var data = JSON.parse(report.responseText);
--- a/testing/web-platform/tests/docs/test-format-guidelines.md
+++ b/testing/web-platform/tests/docs/test-format-guidelines.md
@@ -180,16 +180,38 @@ new tests. Any of these rules may be bro
 
 ## Advanced Testing Features
 
 Certain test scenarios require more than just static HTML
 generation. This is supported through the
 [wptserve](http://github.com/w3c/wptserve) server. Several scenarios
 in particular are common:
 
+### Standalone workers tests
+
+Tests that only require assertions in a dedicated worker scope can use
+standalone workers tests. In this case, the test is a JavaScript file
+with extension `.worker.js` that imports `testharness.js`. The test can
+then use all the usual APIs, and can be run from the path to the
+JavaScript file with the `.js` removed.
+
+For example, one could write a test for the `Blob` constructor by
+creating a `FileAPI/Blob-constructor.worker.js` as follows:
+
+    importScripts("/resources/testharness.js");
+    test(function () {
+      var blob = new Blob();
+      assert_equals(blob.size, 0);
+      assert_equals(blob.type, "");
+      assert_false(blob.isClosed);
+    }, "The Blob constructor.");
+    done();
+
+This test could then be run from `FileAPI/Blob-constructor.worker`.
+
 ### Tests Involving Multiple Origins
 
 In the test environment, five subdomains are available; `www`, `www1`,
 `www2`, `天気の良い日` and `élève`. These must be used for
 cross-origin tests. In addition two ports are available for http and
 one for websockets. Tests must not hardcode the hostname of the server
 that they expect to be running on or the port numbers, as these are
 not guaranteed by the test environment. Instead tests can get this
--- a/testing/web-platform/tests/dom/nodes/Document-Element-getElementsByTagNameNS.js
+++ b/testing/web-platform/tests/dom/nodes/Document-Element-getElementsByTagNameNS.js
@@ -53,17 +53,17 @@ function test_getElementsByTagNameNS(con
     assert_array_equals(context.getElementsByTagNameNS("test", "BODY"), [t]);
     assert_array_equals(context.getElementsByTagNameNS("test", "body"), []);
   }, "BODY element in test namespace, no prefix")
 
   test(function() {
     var t = element.appendChild(document.createElementNS("http://www.w3.org/1999/xhtml", "abc"))
     this.add_cleanup(function() {element.removeChild(t)})
     assert_array_equals(context.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "abc"), [t]);
-   assert_array_equals(context.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "ABC"), []);
+    assert_array_equals(context.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "ABC"), []);
     assert_array_equals(context.getElementsByTagNameNS("test", "ABC"), []);
   }, "abc element in html namespace")
 
   test(function() {
     var t = element.appendChild(document.createElementNS("http://www.w3.org/1999/xhtml", "ABC"))
     this.add_cleanup(function() {element.removeChild(t)})
     assert_array_equals(context.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "abc"), []);
     assert_array_equals(context.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "ABC"), [t]);
--- a/testing/web-platform/tests/dom/nodes/Node-removeChild.html
+++ b/testing/web-platform/tests/dom/nodes/Node-removeChild.html
@@ -1,37 +1,54 @@
 <!DOCTYPE html>
 <title>Node.removeChild</title>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script src="creators.js"></script>
 <div id="log"></div>
 <iframe src=about:blank></iframe>
 <script>
-var frameDoc = frames[0].document;
-for (var p in creators) {
-  var creator = creators[p];
-  test(function() {
-    var s = frameDoc[creator]("a")
-    assert_equals(s.ownerDocument, frameDoc)
-    assert_throws("NOT_FOUND_ERR", function() { document.body.removeChild(s) })
-    assert_equals(s.ownerDocument, frameDoc)
-  }, "Passing a detached " + p + " with a different node document to removeChild should not affect it.")
-  test(function() {
-    var s = frameDoc[creator]("b")
-    frameDoc.body.appendChild(s)
-    assert_equals(s.ownerDocument, frameDoc)
-    assert_throws("NOT_FOUND_ERR", function() { document.body.removeChild(s) })
-    assert_equals(s.ownerDocument, frameDoc)
-  }, "Passing a non-detached " + p + " with a different node document to removeChild should not affect it.")
-  test(function() {
-    var s = frameDoc[creator]("test")
-    frameDoc.body.appendChild(s)
-    assert_equals(s.ownerDocument, frameDoc)
-    assert_throws("NOT_FOUND_ERR", function() { s.removeChild(frameDoc) })
-    assert_throws("NOT_FOUND_ERR", function() { s.removeChild(document) })
-  }, "Calling removeChild on a " + p + " with no children should throw NOT_FOUND_ERR.")
-}
+var documents = [
+  [function() { return document }, "the main document"],
+  [function() { return frames[0].document }, "a frame document"],
+  [function() { return document.implementation.createHTMLDocument() },
+   "a synthetic document"],
+];
+
+documents.forEach(function(d) {
+  var get = d[0], description = d[1]
+  for (var p in creators) {
+    var creator = creators[p];
+    test(function() {
+      var doc = get();
+      var s = doc[creator]("a")
+      assert_equals(s.ownerDocument, doc)
+      assert_throws("NOT_FOUND_ERR", function() { document.body.removeChild(s) })
+      assert_equals(s.ownerDocument, doc)
+    }, "Passing a detached " + p + " from " + description +
+       " to removeChild should not affect it.")
+
+    test(function() {
+      var doc = get();
+      var s = doc[creator]("b")
+      doc.documentElement.appendChild(s)
+      assert_equals(s.ownerDocument, doc)
+      assert_throws("NOT_FOUND_ERR", function() { document.body.removeChild(s) })
+      assert_equals(s.ownerDocument, doc)
+    }, "Passing a non-detached " + p + " from " + description +
+       " to removeChild should not affect it.")
+
+    test(function() {
+      var doc = get();
+      var s = doc[creator]("test")
+      doc.body.appendChild(s)
+      assert_equals(s.ownerDocument, doc)
+      assert_throws("NOT_FOUND_ERR", function() { s.removeChild(doc) })
+    }, "Calling removeChild on a " + p + " from " + description +
+       " with no children should throw NOT_FOUND_ERR.")
+  }
+});
+
 test(function() {
   assert_throws(new TypeError(), function() { document.body.removeChild(null) })
   assert_throws(new TypeError(), function() { document.body.removeChild({'a':'b'}) })
 }, "Passing a value that is not a Node reference to removeChild should throw TypeError.")
 </script>
--- a/testing/web-platform/tests/html/dom/documents/resource-metadata-management/document-lastModified-01.html
+++ b/testing/web-platform/tests/html/dom/documents/resource-metadata-management/document-lastModified-01.html
@@ -1,36 +1,47 @@
 <!DOCTYPE html>
 <title>document.lastModified should return current local time</title>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <div id="log"></div>
 <script>
   var d = new Date();
-  var localTimeFormatted = ("0" + (d.getHours())).slice(-2)
-    + ":" + ("0" + (d.getMinutes())).slice(-2);
+  var last_modified = document.lastModified;
+  var initial_modified = Date.parse(last_modified) / 1000;
+  var expected = Math.round(d / 1000);
+
+  test(function() {
+    assert_approx_equals(initial_modified, expected, 2.5);
+  }, "Date returned by lastModified is current at page load");
+
+  var pattern = /[0-9]{2}\/[0-9]{2}\/[0-9]{4} ([0-9]{2}):([0-9]{2}):([0-9]{2})/
+
   test(function() {
-    assert_equals(document.lastModified.substring(11, 16), localTimeFormatted,
-     "Hours and minutes should match local time.");
+     assert_regexp_match(last_modified, pattern,
+                         "Format should match the pattern \"NN/NN/NNNN NN:NN:NN\".");
+  }, "Date returned by lastModified is in the form \"MM/DD/YYYY hh:mm:ss\".");
+
+
+  var hours = d.getHours()
+  var minutes = d.getMinutes()
+  var seconds = d.getSeconds()
+
+  test(function() {
+    var local_time = hours * 60 * 60 + minutes * 60 + seconds;
+    var m = pattern.exec(last_modified);
+    var last_modified_time = parseInt(m[1]) * 60 * 60 + parseInt(m[2]) * 60 + parseInt(m[3]);
+    assert_approx_equals(last_modified_time, local_time, 2,
+                         "Hours and minutes should match local time.");
   }, "Date returned by lastModified is in the user's local time zone.");
-  var lastMod = document.lastModified;
-  var pattern = /[0-9]{2}\/[0-9]{2}\/[0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2}/
-  var currentDate = new Date();
-  var month = ("0" + (currentDate.getMonth() + 1)).slice(-2)
-  var day =  ("0" + (currentDate.getDate())).slice(-2)
-  var year = currentDate.getFullYear().toString()
-  var hours = ("0" + (currentDate.getHours())).slice(-2)
-  var minutes = ("0" + (currentDate.getMinutes())).slice(-2)
-  var seconds = ("0" + (currentDate.getSeconds())).slice(-2);
-  test(function() {
-     assert_regexp_match(lastMod, pattern,
-       "Format should match the pattern \"NN/NN/NNNN NN:NN:NN\".");
-     assert_approx_equals(Date.parse(document.lastModified), currentDate, 10);
-  }, "Date returned by lastModified is in the form \"MM/DD/YYYY hh:mm:ss\".");
-  var t = async_test('Date returned by lastModified is current.');
-  var old = Date.parse(document.lastModified);
+
+  var t = async_test("Date returned by lastModified is current after timeout.");
+
   setTimeout(function() {
     t.step(function() {
-      assert_approx_equals(Date.parse(document.lastModified), old + 2000, 300);
+      var new_modified = Date.parse(document.lastModified) / 1000;
+      var new_expected = Math.round(new Date() / 1000);
+      assert_approx_equals(new_modified, new_expected, 2.5,
+                           "(initial value was " + initial_modified + ")");
       t.done();
     });
-  }, 2000);
+  }, 4000);
 </script>
deleted file mode 100644
--- a/testing/web-platform/tests/old-tests/submission/Infraware/Session_History/resources/WebIDLParser.js
+++ /dev/null
@@ -1,5990 +0,0 @@
-// From https://github.com/darobin/webidl.js/tree/, under MIT license
-window.WebIDLParser = (function(){
-  /*
-   * Generated by PEG.js 0.7.0.
-   *
-   * http://pegjs.majda.cz/
-   */
-  
-  function quote(s) {
-    /*
-     * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a
-     * string literal except for the closing quote character, backslash,
-     * carriage return, line separator, paragraph separator, and line feed.
-     * Any character may appear in the form of an escape sequence.
-     *
-     * For portability, we also escape escape all control and non-ASCII
-     * characters. Note that "\0" and "\v" escape sequences are not used
-     * because JSHint does not like the first and IE the second.
-     */
-     return '"' + s
-      .replace(/\\/g, '\\\\')  // backslash
-      .replace(/"/g, '\\"')    // closing quote character
-      .replace(/\x08/g, '\\b') // backspace
-      .replace(/\t/g, '\\t')   // horizontal tab
-      .replace(/\n/g, '\\n')   // line feed
-      .replace(/\f/g, '\\f')   // form feed
-      .replace(/\r/g, '\\r')   // carriage return
-      .replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g, escape)
-      + '"';
-  }
-  
-  var result = {
-    /*
-     * Parses the input with a generated parser. If the parsing is successfull,
-     * returns a value explicitly or implicitly specified by the grammar from
-     * which the parser was generated (see |PEG.buildParser|). If the parsing is
-     * unsuccessful, throws |PEG.parser.SyntaxError| describing the error.
-     */
-    parse: function(input, startRule) {
-      var parseFunctions = {
-        "space": parse_space,
-        "s": parse_s,
-        "w": parse_w,
-        "identifier": parse_identifier,
-        "octal": parse_octal,
-        "hex": parse_hex,
-        "decimal": parse_decimal,
-        "integer": parse_integer,
-        "floatEe": parse_floatEe,
-        "expFloat": parse_expFloat,
-        "leadFloat": parse_leadFloat,
-        "dotFloat": parse_dotFloat,
-        "float": parse_float,
-        "string": parse_string,
-        "other": parse_other,
-        "type": parse_type,
-        "TypeDesc": parse_TypeDesc,
-        "Sequence": parse_Sequence,
-        "ArrayType": parse_ArrayType,
-        "UnionType": parse_UnionType,
-        "TypeList": parse_TypeList,
-        "TypeListRest": parse_TypeListRest,
-        "SimpleType": parse_SimpleType,
-        "PrimitiveType": parse_PrimitiveType,
-        "FloatType": parse_FloatType,
-        "UnsignedIntegerType": parse_UnsignedIntegerType,
-        "ScopedNameList": parse_ScopedNameList,
-        "ScopedNameListRest": parse_ScopedNameListRest,
-        "ScopedName": parse_ScopedName,
-        "AbsoluteScopedName": parse_AbsoluteScopedName,
-        "RelativeScopedName": parse_RelativeScopedName,
-        "ScopedNameRest": parse_ScopedNameRest,
-        "BooleanLiteral": parse_BooleanLiteral,
-        "Nullable": parse_Nullable,
-        "ReturnType": parse_ReturnType,
-        "definitions": parse_definitions,
-        "definition": parse_definition,
-        "partialinterface": parse_partialinterface,
-        "partialdictionary": parse_partialdictionary,
-        "callbackinterface": parse_callbackinterface,
-        "module": parse_module,
-        "implements": parse_implements,
-        "interface": parse_interface,
-        "enum": parse_enum,
-        "callback": parse_callback,
-        "EnumValues": parse_EnumValues,
-        "EnumValuesRest": parse_EnumValuesRest,
-        "Inheritance": parse_Inheritance,
-        "InheritanceInner": parse_InheritanceInner,
-        "InterfaceMemberList": parse_InterfaceMemberList,
-        "InterfaceMember": parse_InterfaceMember,
-        "const": parse_const,
-        "constExpr": parse_constExpr,
-        "attrOrOp": parse_attrOrOp,
-        "Stringifier": parse_Stringifier,
-        "Attribute": parse_Attribute,
-        "GetRaises": parse_GetRaises,
-        "SetRaises": parse_SetRaises,
-        "Operation": parse_Operation,
-        "Qualifiers": parse_Qualifiers,
-        "Special": parse_Special,
-        "OperationRest": parse_OperationRest,
-        "Arguments": parse_Arguments,
-        "ArgumentsRest": parse_ArgumentsRest,
-        "Argument": parse_Argument,
-        "Raises": parse_Raises,
-        "dictionary": parse_dictionary,
-        "DictionaryMemberList": parse_DictionaryMemberList,
-        "DictionaryMember": parse_DictionaryMember,
-        "defaultValue": parse_defaultValue,
-        "typedef": parse_typedef,
-        "exception": parse_exception,
-        "ExceptionMembers": parse_ExceptionMembers,
-        "ExceptionMember": parse_ExceptionMember,
-        "field": parse_field,
-        "ExtendedAttributeList": parse_ExtendedAttributeList,
-        "ExtendedAttributeListInner": parse_ExtendedAttributeListInner,
-        "ExtAttrs": parse_ExtAttrs,
-        "ExtAttrsRest": parse_ExtAttrsRest,
-        "ExtAttr": parse_ExtAttr,
-        "ExtAttrNoArg": parse_ExtAttrNoArg,
-        "ExtAttrNameValue": parse_ExtAttrNameValue,
-        "ExtAttrNamedArgList": parse_ExtAttrNamedArgList,
-        "ExtAttrNamedArgList": parse_ExtAttrNamedArgList,
-        "ExtAttrArgList": parse_ExtAttrArgList
-      };
-      
-      if (startRule !== undefined) {
-        if (parseFunctions[startRule] === undefined) {
-          throw new Error("Invalid rule name: " + quote(startRule) + ".");
-        }
-      } else {
-        startRule = "definitions";
-      }
-      
-      var pos = 0;
-      var reportFailures = 0;
-      var rightmostFailuresPos = 0;
-      var rightmostFailuresExpected = [];
-      
-      function padLeft(input, padding, length) {
-        var result = input;
-        
-        var padLength = length - input.length;
-        for (var i = 0; i < padLength; i++) {
-          result = padding + result;
-        }
-        
-        return result;
-      }
-      
-      function escape(ch) {
-        var charCode = ch.charCodeAt(0);
-        var escapeChar;
-        var length;
-        
-        if (charCode <= 0xFF) {
-          escapeChar = 'x';
-          length = 2;
-        } else {
-          escapeChar = 'u';
-          length = 4;
-        }
-        
-        return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length);
-      }
-      
-      function matchFailed(failure) {
-        if (pos < rightmostFailuresPos) {
-          return;
-        }
-        
-        if (pos > rightmostFailuresPos) {
-          rightmostFailuresPos = pos;
-          rightmostFailuresExpected = [];
-        }
-        
-        rightmostFailuresExpected.push(failure);
-      }
-      
-      function parse_space() {
-        var result0, result1, result2, result3;
-        var pos0, pos1, pos2;
-        
-        if (input.charCodeAt(pos) === 32) {
-          result0 = " ";
-          pos++;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\" \"");
-          }
-        }
-        if (result0 === null) {
-          if (input.charCodeAt(pos) === 9) {
-            result0 = "\t";
-            pos++;
-          } else {
-            result0 = null;
-            if (reportFailures === 0) {
-              matchFailed("\"\\t\"");
-            }
-          }
-          if (result0 === null) {
-            if (input.charCodeAt(pos) === 13) {
-              result0 = "\r";
-              pos++;
-            } else {
-              result0 = null;
-              if (reportFailures === 0) {
-                matchFailed("\"\\r\"");
-              }
-            }
-            if (result0 === null) {
-              if (input.charCodeAt(pos) === 10) {
-                result0 = "\n";
-                pos++;
-              } else {
-                result0 = null;
-                if (reportFailures === 0) {
-                  matchFailed("\"\\n\"");
-                }
-              }
-              if (result0 === null) {
-                if (input.charCodeAt(pos) === 12) {
-                  result0 = "\f";
-                  pos++;
-                } else {
-                  result0 = null;
-                  if (reportFailures === 0) {
-                    matchFailed("\"\\f\"");
-                  }
-                }
-                if (result0 === null) {
-                  pos0 = pos;
-                  if (input.substr(pos, 2) === "//") {
-                    result0 = "//";
-                    pos += 2;
-                  } else {
-                    result0 = null;
-                    if (reportFailures === 0) {
-                      matchFailed("\"//\"");
-                    }
-                  }
-                  if (result0 !== null) {
-                    result1 = [];
-                    if (/^[^\n]/.test(input.charAt(pos))) {
-                      result2 = input.charAt(pos);
-                      pos++;
-                    } else {
-                      result2 = null;
-                      if (reportFailures === 0) {
-                        matchFailed("[^\\n]");
-                      }
-                    }
-                    while (result2 !== null) {
-                      result1.push(result2);
-                      if (/^[^\n]/.test(input.charAt(pos))) {
-                        result2 = input.charAt(pos);
-                        pos++;
-                      } else {
-                        result2 = null;
-                        if (reportFailures === 0) {
-                          matchFailed("[^\\n]");
-                        }
-                      }
-                    }
-                    if (result1 !== null) {
-                      if (input.charCodeAt(pos) === 10) {
-                        result2 = "\n";
-                        pos++;
-                      } else {
-                        result2 = null;
-                        if (reportFailures === 0) {
-                          matchFailed("\"\\n\"");
-                        }
-                      }
-                      if (result2 !== null) {
-                        result0 = [result0, result1, result2];
-                      } else {
-                        result0 = null;
-                        pos = pos0;
-                      }
-                    } else {
-                      result0 = null;
-                      pos = pos0;
-                    }
-                  } else {
-                    result0 = null;
-                    pos = pos0;
-                  }
-                  if (result0 === null) {
-                    pos0 = pos;
-                    if (input.substr(pos, 2) === "/*") {
-                      result0 = "/*";
-                      pos += 2;
-                    } else {
-                      result0 = null;
-                      if (reportFailures === 0) {
-                        matchFailed("\"/*\"");
-                      }
-                    }
-                    if (result0 !== null) {
-                      result1 = [];
-                      if (/^[^*]/.test(input.charAt(pos))) {
-                        result2 = input.charAt(pos);
-                        pos++;
-                      } else {
-                        result2 = null;
-                        if (reportFailures === 0) {
-                          matchFailed("[^*]");
-                        }
-                      }
-                      if (result2 === null) {
-                        pos1 = pos;
-                        if (input.charCodeAt(pos) === 42) {
-                          result2 = "*";
-                          pos++;
-                        } else {
-                          result2 = null;
-                          if (reportFailures === 0) {
-                            matchFailed("\"*\"");
-                          }
-                        }
-                        if (result2 !== null) {
-                          pos2 = pos;
-                          reportFailures++;
-                          if (input.charCodeAt(pos) === 47) {
-                            result3 = "/";
-                            pos++;
-                          } else {
-                            result3 = null;
-                            if (reportFailures === 0) {
-                              matchFailed("\"/\"");
-                            }
-                          }
-                          reportFailures--;
-                          if (result3 === null) {
-                            result3 = "";
-                          } else {
-                            result3 = null;
-                            pos = pos2;
-                          }
-                          if (result3 !== null) {
-                            result2 = [result2, result3];
-                          } else {
-                            result2 = null;
-                            pos = pos1;
-                          }
-                        } else {
-                          result2 = null;
-                          pos = pos1;
-                        }
-                      }
-                      while (result2 !== null) {
-                        result1.push(result2);
-                        if (/^[^*]/.test(input.charAt(pos))) {
-                          result2 = input.charAt(pos);
-                          pos++;
-                        } else {
-                          result2 = null;
-                          if (reportFailures === 0) {
-                            matchFailed("[^*]");
-                          }
-                        }
-                        if (result2 === null) {
-                          pos1 = pos;
-                          if (input.charCodeAt(pos) === 42) {
-                            result2 = "*";
-                            pos++;
-                          } else {
-                            result2 = null;
-                            if (reportFailures === 0) {
-                              matchFailed("\"*\"");
-                            }
-                          }
-                          if (result2 !== null) {
-                            pos2 = pos;
-                            reportFailures++;
-                            if (input.charCodeAt(pos) === 47) {
-                              result3 = "/";
-                              pos++;
-                            } else {
-                              result3 = null;
-                              if (reportFailures === 0) {
-                                matchFailed("\"/\"");
-                              }
-                            }
-                            reportFailures--;
-                            if (result3 === null) {
-                              result3 = "";
-                            } else {
-                              result3 = null;
-                              pos = pos2;
-                            }
-                            if (result3 !== null) {
-                              result2 = [result2, result3];
-                            } else {
-                              result2 = null;
-                              pos = pos1;
-                            }
-                          } else {
-                            result2 = null;
-                            pos = pos1;
-                          }
-                        }
-                      }
-                      if (result1 !== null) {
-                        if (input.substr(pos, 2) === "*/") {
-                          result2 = "*/";
-                          pos += 2;
-                        } else {
-                          result2 = null;
-                          if (reportFailures === 0) {
-                            matchFailed("\"*/\"");
-                          }
-                        }
-                        if (result2 !== null) {
-                          result0 = [result0, result1, result2];
-                        } else {
-                          result0 = null;
-                          pos = pos0;
-                        }
-                      } else {
-                        result0 = null;
-                        pos = pos0;
-                      }
-                    } else {
-                      result0 = null;
-                      pos = pos0;
-                    }
-                  }
-                }
-              }
-            }
-          }
-        }
-        return result0;
-      }
-      
-      function parse_s() {
-        var result0, result1;
-        
-        result1 = parse_space();
-        if (result1 !== null) {
-          result0 = [];
-          while (result1 !== null) {
-            result0.push(result1);
-            result1 = parse_space();
-          }
-        } else {
-          result0 = null;
-        }
-        return result0;
-      }
-      
-      function parse_w() {
-        var result0;
-        
-        result0 = parse_s();
-        result0 = result0 !== null ? result0 : "";
-        return result0;
-      }
-      
-      function parse_identifier() {
-        var result0, result1, result2;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (/^[A-Z_a-z]/.test(input.charAt(pos))) {
-          result0 = input.charAt(pos);
-          pos++;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("[A-Z_a-z]");
-          }
-        }
-        if (result0 !== null) {
-          result1 = [];
-          if (/^[0-9A-Z_a-z]/.test(input.charAt(pos))) {
-            result2 = input.charAt(pos);
-            pos++;
-          } else {
-            result2 = null;
-            if (reportFailures === 0) {
-              matchFailed("[0-9A-Z_a-z]");
-            }
-          }
-          while (result2 !== null) {
-            result1.push(result2);
-            if (/^[0-9A-Z_a-z]/.test(input.charAt(pos))) {
-              result2 = input.charAt(pos);
-              pos++;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("[0-9A-Z_a-z]");
-              }
-            }
-          }
-          if (result1 !== null) {
-            result0 = [result0, result1];
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, nmstart, nmchars) { return nmstart + nmchars.join(""); })(pos0, result0[0], result0[1]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_octal() {
-        var result0, result1, result2;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (input.charCodeAt(pos) === 48) {
-          result0 = "0";
-          pos++;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\"0\"");
-          }
-        }
-        if (result0 !== null) {
-          result1 = [];
-          if (/^[0-7]/.test(input.charAt(pos))) {
-            result2 = input.charAt(pos);
-            pos++;
-          } else {
-            result2 = null;
-            if (reportFailures === 0) {
-              matchFailed("[0-7]");
-            }
-          }
-          while (result2 !== null) {
-            result1.push(result2);
-            if (/^[0-7]/.test(input.charAt(pos))) {
-              result2 = input.charAt(pos);
-              pos++;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("[0-7]");
-              }
-            }
-          }
-          if (result1 !== null) {
-            result0 = [result0, result1];
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, value) { return "0" + value.join(""); })(pos0, result0[1]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_hex() {
-        var result0, result1, result2, result3;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (input.charCodeAt(pos) === 48) {
-          result0 = "0";
-          pos++;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\"0\"");
-          }
-        }
-        if (result0 !== null) {
-          if (/^[Xx]/.test(input.charAt(pos))) {
-            result1 = input.charAt(pos);
-            pos++;
-          } else {
-            result1 = null;
-            if (reportFailures === 0) {
-              matchFailed("[Xx]");
-            }
-          }
-          if (result1 !== null) {
-            if (/^[0-9A-Fa-f]/.test(input.charAt(pos))) {
-              result3 = input.charAt(pos);
-              pos++;
-            } else {
-              result3 = null;
-              if (reportFailures === 0) {
-                matchFailed("[0-9A-Fa-f]");
-              }
-            }
-            if (result3 !== null) {
-              result2 = [];
-              while (result3 !== null) {
-                result2.push(result3);
-                if (/^[0-9A-Fa-f]/.test(input.charAt(pos))) {
-                  result3 = input.charAt(pos);
-                  pos++;
-                } else {
-                  result3 = null;
-                  if (reportFailures === 0) {
-                    matchFailed("[0-9A-Fa-f]");
-                  }
-                }
-              }
-            } else {
-              result2 = null;
-            }
-            if (result2 !== null) {
-              result0 = [result0, result1, result2];
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, x, value) { return "0" + x + value.join(""); })(pos0, result0[1], result0[2]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_decimal() {
-        var result0, result1, result2;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (/^[0-9]/.test(input.charAt(pos))) {
-          result0 = input.charAt(pos);
-          pos++;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("[0-9]");
-          }
-        }
-        if (result0 !== null) {
-          result1 = [];
-          if (/^[0-9]/.test(input.charAt(pos))) {
-            result2 = input.charAt(pos);
-            pos++;
-          } else {
-            result2 = null;
-            if (reportFailures === 0) {
-              matchFailed("[0-9]");
-            }
-          }
-          while (result2 !== null) {
-            result1.push(result2);
-            if (/^[0-9]/.test(input.charAt(pos))) {
-              result2 = input.charAt(pos);
-              pos++;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("[0-9]");
-              }
-            }
-          }
-          if (result1 !== null) {
-            result0 = [result0, result1];
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, numStart, numRest) { return numStart + numRest.join(""); })(pos0, result0[0], result0[1]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_integer() {
-        var result0, result1;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (input.charCodeAt(pos) === 45) {
-          result0 = "-";
-          pos++;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\"-\"");
-          }
-        }
-        result0 = result0 !== null ? result0 : "";
-        if (result0 !== null) {
-          result1 = parse_hex();
-          if (result1 === null) {
-            result1 = parse_octal();
-            if (result1 === null) {
-              result1 = parse_decimal();
-            }
-          }
-          if (result1 !== null) {
-            result0 = [result0, result1];
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, neg, num) { return neg + num; })(pos0, result0[0], result0[1]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_floatEe() {
-        var result0, result1, result2, result3;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (/^[Ee]/.test(input.charAt(pos))) {
-          result0 = input.charAt(pos);
-          pos++;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("[Ee]");
-          }
-        }
-        if (result0 !== null) {
-          if (/^[+\-]/.test(input.charAt(pos))) {
-            result1 = input.charAt(pos);
-            pos++;
-          } else {
-            result1 = null;
-            if (reportFailures === 0) {
-              matchFailed("[+\\-]");
-            }
-          }
-          result1 = result1 !== null ? result1 : "";
-          if (result1 !== null) {
-            if (/^[0-9]/.test(input.charAt(pos))) {
-              result3 = input.charAt(pos);
-              pos++;
-            } else {
-              result3 = null;
-              if (reportFailures === 0) {
-                matchFailed("[0-9]");
-              }
-            }
-            if (result3 !== null) {
-              result2 = [];
-              while (result3 !== null) {
-                result2.push(result3);
-                if (/^[0-9]/.test(input.charAt(pos))) {
-                  result3 = input.charAt(pos);
-                  pos++;
-                } else {
-                  result3 = null;
-                  if (reportFailures === 0) {
-                    matchFailed("[0-9]");
-                  }
-                }
-              }
-            } else {
-              result2 = null;
-            }
-            if (result2 !== null) {
-              result0 = [result0, result1, result2];
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, e, sign, exp) { return e + sign + exp.join(""); })(pos0, result0[0], result0[1], result0[2]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_expFloat() {
-        var result0, result1;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (/^[0-9]/.test(input.charAt(pos))) {
-          result1 = input.charAt(pos);
-          pos++;
-        } else {
-          result1 = null;
-          if (reportFailures === 0) {
-            matchFailed("[0-9]");
-          }
-        }
-        if (result1 !== null) {
-          result0 = [];
-          while (result1 !== null) {
-            result0.push(result1);
-            if (/^[0-9]/.test(input.charAt(pos))) {
-              result1 = input.charAt(pos);
-              pos++;
-            } else {
-              result1 = null;
-              if (reportFailures === 0) {
-                matchFailed("[0-9]");
-              }
-            }
-          }
-        } else {
-          result0 = null;
-        }
-        if (result0 !== null) {
-          result1 = parse_floatEe();
-          if (result1 !== null) {
-            result0 = [result0, result1];
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, num, fee) { return num.join("") + fee; })(pos0, result0[0], result0[1]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_leadFloat() {
-        var result0, result1, result2, result3;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (/^[0-9]/.test(input.charAt(pos))) {
-          result1 = input.charAt(pos);
-          pos++;
-        } else {
-          result1 = null;
-          if (reportFailures === 0) {
-            matchFailed("[0-9]");
-          }
-        }
-        if (result1 !== null) {
-          result0 = [];
-          while (result1 !== null) {
-            result0.push(result1);
-            if (/^[0-9]/.test(input.charAt(pos))) {
-              result1 = input.charAt(pos);
-              pos++;
-            } else {
-              result1 = null;
-              if (reportFailures === 0) {
-                matchFailed("[0-9]");
-              }
-            }
-          }
-        } else {
-          result0 = null;
-        }
-        if (result0 !== null) {
-          if (input.charCodeAt(pos) === 46) {
-            result1 = ".";
-            pos++;
-          } else {
-            result1 = null;
-            if (reportFailures === 0) {
-              matchFailed("\".\"");
-            }
-          }
-          if (result1 !== null) {
-            result2 = [];
-            if (/^[0-9]/.test(input.charAt(pos))) {
-              result3 = input.charAt(pos);
-              pos++;
-            } else {
-              result3 = null;
-              if (reportFailures === 0) {
-                matchFailed("[0-9]");
-              }
-            }
-            while (result3 !== null) {
-              result2.push(result3);
-              if (/^[0-9]/.test(input.charAt(pos))) {
-                result3 = input.charAt(pos);
-                pos++;
-              } else {
-                result3 = null;
-                if (reportFailures === 0) {
-                  matchFailed("[0-9]");
-                }
-              }
-            }
-            if (result2 !== null) {
-              result3 = parse_floatEe();
-              result3 = result3 !== null ? result3 : "";
-              if (result3 !== null) {
-                result0 = [result0, result1, result2, result3];
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, num, dec, fee) { return num.join("") + "." + dec.join("") + fee; })(pos0, result0[0], result0[2], result0[3]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_dotFloat() {
-        var result0, result1, result2, result3;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = [];
-        if (/^[0-9]/.test(input.charAt(pos))) {
-          result1 = input.charAt(pos);
-          pos++;
-        } else {
-          result1 = null;
-          if (reportFailures === 0) {
-            matchFailed("[0-9]");
-          }
-        }
-        while (result1 !== null) {
-          result0.push(result1);
-          if (/^[0-9]/.test(input.charAt(pos))) {
-            result1 = input.charAt(pos);
-            pos++;
-          } else {
-            result1 = null;
-            if (reportFailures === 0) {
-              matchFailed("[0-9]");
-            }
-          }
-        }
-        if (result0 !== null) {
-          if (input.charCodeAt(pos) === 46) {
-            result1 = ".";
-            pos++;
-          } else {
-            result1 = null;
-            if (reportFailures === 0) {
-              matchFailed("\".\"");
-            }
-          }
-          if (result1 !== null) {
-            if (/^[0-9]/.test(input.charAt(pos))) {
-              result3 = input.charAt(pos);
-              pos++;
-            } else {
-              result3 = null;
-              if (reportFailures === 0) {
-                matchFailed("[0-9]");
-              }
-            }
-            if (result3 !== null) {
-              result2 = [];
-              while (result3 !== null) {
-                result2.push(result3);
-                if (/^[0-9]/.test(input.charAt(pos))) {
-                  result3 = input.charAt(pos);
-                  pos++;
-                } else {
-                  result3 = null;
-                  if (reportFailures === 0) {
-                    matchFailed("[0-9]");
-                  }
-                }
-              }
-            } else {
-              result2 = null;
-            }
-            if (result2 !== null) {
-              result3 = parse_floatEe();
-              result3 = result3 !== null ? result3 : "";
-              if (result3 !== null) {
-                result0 = [result0, result1, result2, result3];
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, num, dec, fee) { return num.join("") + "." + dec.join("") + fee; })(pos0, result0[0], result0[2], result0[3]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_float() {
-        var result0, result1;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (input.charCodeAt(pos) === 45) {
-          result0 = "-";
-          pos++;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\"-\"");
-          }
-        }
-        result0 = result0 !== null ? result0 : "";
-        if (result0 !== null) {
-          result1 = parse_leadFloat();
-          if (result1 === null) {
-            result1 = parse_dotFloat();
-            if (result1 === null) {
-              result1 = parse_expFloat();
-              if (result1 === null) {
-                if (input.substr(pos, 8) === "Infinity") {
-                  result1 = "Infinity";
-                  pos += 8;
-                } else {
-                  result1 = null;
-                  if (reportFailures === 0) {
-                    matchFailed("\"Infinity\"");
-                  }
-                }
-              }
-            }
-          }
-          if (result1 !== null) {
-            result0 = [result0, result1];
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, neg, num) { return neg + num; })(pos0, result0[0], result0[1]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_string() {
-        var result0, result1, result2;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (input.charCodeAt(pos) === 34) {
-          result0 = "\"";
-          pos++;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\"\\\"\"");
-          }
-        }
-        if (result0 !== null) {
-          result1 = [];
-          if (/^[^""]/.test(input.charAt(pos))) {
-            result2 = input.charAt(pos);
-            pos++;
-          } else {
-            result2 = null;
-            if (reportFailures === 0) {
-              matchFailed("[^\"\"]");
-            }
-          }
-          while (result2 !== null) {
-            result1.push(result2);
-            if (/^[^""]/.test(input.charAt(pos))) {
-              result2 = input.charAt(pos);
-              pos++;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("[^\"\"]");
-              }
-            }
-          }
-          if (result1 !== null) {
-            if (input.charCodeAt(pos) === 34) {
-              result2 = "\"";
-              pos++;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("\"\\\"\"");
-              }
-            }
-            if (result2 !== null) {
-              result0 = [result0, result1, result2];
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, str) { return str.join(""); })(pos0, result0[1]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_other() {
-        var result0, result1;
-        var pos0;
-        
-        pos0 = pos;
-        if (/^[^\t\n\r 0-9A-Z_a-z]/.test(input.charAt(pos))) {
-          result1 = input.charAt(pos);
-          pos++;
-        } else {
-          result1 = null;
-          if (reportFailures === 0) {
-            matchFailed("[^\\t\\n\\r 0-9A-Z_a-z]");
-          }
-        }
-        if (result1 !== null) {
-          result0 = [];
-          while (result1 !== null) {
-            result0.push(result1);
-            if (/^[^\t\n\r 0-9A-Z_a-z]/.test(input.charAt(pos))) {
-              result1 = input.charAt(pos);
-              pos++;
-            } else {
-              result1 = null;
-              if (reportFailures === 0) {
-                matchFailed("[^\\t\\n\\r 0-9A-Z_a-z]");
-              }
-            }
-          }
-        } else {
-          result0 = null;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, other) { return other.join(""); })(pos0, result0);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_type() {
-        var result0, result1;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_TypeDesc();
-        if (result0 !== null) {
-          result1 = parse_Nullable();
-          if (result1 !== null) {
-            result0 = [result0, result1];
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, type, nullable) {
-                    if (!type.sequence) type.sequence = false;
-                    type.nullable = nullable;
-                    return type; })(pos0, result0[0], result0[1]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_TypeDesc() {
-        var result0;
-        var pos0;
-        
-        pos0 = pos;
-        result0 = parse_Sequence();
-        if (result0 === null) {
-          result0 = parse_ArrayType();
-          if (result0 === null) {
-            result0 = parse_SimpleType();
-            if (result0 === null) {
-              result0 = parse_UnionType();
-            }
-          }
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, type) { return type; })(pos0, result0);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_Sequence() {
-        var result0, result1, result2;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (input.substr(pos, 9) === "sequence<") {
-          result0 = "sequence<";
-          pos += 9;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\"sequence<\"");
-          }
-        }
-        if (result0 !== null) {
-          result1 = parse_type();
-          if (result1 !== null) {
-            if (input.charCodeAt(pos) === 62) {
-              result2 = ">";
-              pos++;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("\">\"");
-              }
-            }
-            if (result2 !== null) {
-              result0 = [result0, result1, result2];
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, type) { return { sequence: true, array: false, idlType: type, members: [] }; })(pos0, result0[1]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_ArrayType() {
-        var result0, result1;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_SimpleType();
-        if (result0 !== null) {
-          if (input.substr(pos, 2) === "[]") {
-            result1 = "[]";
-            pos += 2;
-          } else {
-            result1 = null;
-            if (reportFailures === 0) {
-              matchFailed("\"[]\"");
-            }
-          }
-          if (result1 !== null) {
-            result0 = [result0, result1];
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, type) {
-                    type.array = true;
-                    return type;
-                })(pos0, result0[0]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_UnionType() {
-        var result0, result1, result2, result3, result4;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (input.charCodeAt(pos) === 40) {
-          result0 = "(";
-          pos++;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\"(\"");
-          }
-        }
-        if (result0 !== null) {
-          result1 = parse_w();
-          if (result1 !== null) {
-            result2 = parse_TypeList();
-            if (result2 !== null) {
-              result3 = parse_w();
-              if (result3 !== null) {
-                if (input.charCodeAt(pos) === 41) {
-                  result4 = ")";
-                  pos++;
-                } else {
-                  result4 = null;
-                  if (reportFailures === 0) {
-                    matchFailed("\")\"");
-                  }
-                }
-                if (result4 !== null) {
-                  result0 = [result0, result1, result2, result3, result4];
-                } else {
-                  result0 = null;
-                  pos = pos1;
-                }
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, members) { return { idlType: "union", members: members, sequence: false, array: false }; })(pos0, result0[2]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_TypeList() {
-        var result0, result1, result2, result3, result4, result5, result6;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_type();
-        if (result0 !== null) {
-          result1 = parse_s();
-          if (result1 !== null) {
-            if (input.substr(pos, 2) === "or") {
-              result2 = "or";
-              pos += 2;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("\"or\"");
-              }
-            }
-            if (result2 !== null) {
-              result3 = parse_s();
-              if (result3 !== null) {
-                result4 = parse_type();
-                if (result4 !== null) {
-                  result5 = [];
-                  result6 = parse_TypeListRest();
-                  while (result6 !== null) {
-                    result5.push(result6);
-                    result6 = parse_TypeListRest();
-                  }
-                  if (result5 !== null) {
-                    result0 = [result0, result1, result2, result3, result4, result5];
-                  } else {
-                    result0 = null;
-                    pos = pos1;
-                  }
-                } else {
-                  result0 = null;
-                  pos = pos1;
-                }
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, first, second, others) {   var ret = [first, second];
-                    for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); }
-                    return ret; })(pos0, result0[0], result0[4], result0[5]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_TypeListRest() {
-        var result0, result1, result2, result3;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_s();
-        if (result0 !== null) {
-          if (input.substr(pos, 2) === "or") {
-            result1 = "or";
-            pos += 2;
-          } else {
-            result1 = null;
-            if (reportFailures === 0) {
-              matchFailed("\"or\"");
-            }
-          }
-          if (result1 !== null) {
-            result2 = parse_s();
-            if (result2 !== null) {
-              result3 = parse_type();
-              if (result3 !== null) {
-                result0 = [result0, result1, result2, result3];
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, rest) { return rest; })(pos0, result0[3]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_SimpleType() {
-        var result0;
-        var pos0;
-        
-        pos0 = pos;
-        result0 = parse_PrimitiveType();
-        if (result0 === null) {
-          result0 = parse_UnsignedIntegerType();
-          if (result0 === null) {
-            result0 = parse_FloatType();
-            if (result0 === null) {
-              result0 = parse_ScopedName();
-            }
-          }
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, type) { return { sequence: false, array: false, idlType: type, members: [] }; })(pos0, result0);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_PrimitiveType() {
-        var result0, result1;
-        var pos0, pos1, pos2;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (input.substr(pos, 3) === "any") {
-          result0 = "any";
-          pos += 3;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\"any\"");
-          }
-        }
-        if (result0 === null) {
-          if (input.substr(pos, 6) === "object") {
-            result0 = "object";
-            pos += 6;
-          } else {
-            result0 = null;
-            if (reportFailures === 0) {
-              matchFailed("\"object\"");
-            }
-          }
-          if (result0 === null) {
-            if (input.substr(pos, 7) === "boolean") {
-              result0 = "boolean";
-              pos += 7;
-            } else {
-              result0 = null;
-              if (reportFailures === 0) {
-                matchFailed("\"boolean\"");
-              }
-            }
-            if (result0 === null) {
-              if (input.substr(pos, 5) === "octet") {
-                result0 = "octet";
-                pos += 5;
-              } else {
-                result0 = null;
-                if (reportFailures === 0) {
-                  matchFailed("\"octet\"");
-                }
-              }
-              if (result0 === null) {
-                if (input.substr(pos, 9) === "DOMString") {
-                  result0 = "DOMString";
-                  pos += 9;
-                } else {
-                  result0 = null;
-                  if (reportFailures === 0) {
-                    matchFailed("\"DOMString\"");
-                  }
-                }
-              }
-            }
-          }
-        }
-        if (result0 !== null) {
-          pos2 = pos;
-          reportFailures++;
-          if (/^[A-Za-z0-9]/.test(input.charAt(pos))) {
-            result1 = input.charAt(pos);
-            pos++;
-          } else {
-            result1 = null;
-            if (reportFailures === 0) {
-              matchFailed("[A-Za-z0-9]");
-            }
-          }
-          reportFailures--;
-          if (result1 === null) {
-            result1 = "";
-          } else {
-            result1 = null;
-            pos = pos2;
-          }
-          if (result1 !== null) {
-            result0 = [result0, result1];
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, type) { return type; })(pos0, result0[0]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_FloatType() {
-        var result0, result1, result2;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (input.substr(pos, 12) === "unrestricted") {
-          result0 = "unrestricted";
-          pos += 12;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\"unrestricted\"");
-          }
-        }
-        result0 = result0 !== null ? result0 : "";
-        if (result0 !== null) {
-          result1 = parse_s();
-          if (result1 !== null) {
-            if (input.substr(pos, 5) === "float") {
-              result2 = "float";
-              pos += 5;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("\"float\"");
-              }
-            }
-            if (result2 === null) {
-              if (input.substr(pos, 6) === "double") {
-                result2 = "double";
-                pos += 6;
-              } else {
-                result2 = null;
-                if (reportFailures === 0) {
-                  matchFailed("\"double\"");
-                }
-              }
-            }
-            if (result2 !== null) {
-              result0 = [result0, result1, result2];
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, unr, kind) { return (unr ? "unrestricted " : "") + (kind); })(pos0, result0[0], result0[2]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_UnsignedIntegerType() {
-        var result0, result1, result2, result3, result4;
-        var pos0, pos1, pos2;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (input.substr(pos, 8) === "unsigned") {
-          result0 = "unsigned";
-          pos += 8;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\"unsigned\"");
-          }
-        }
-        result0 = result0 !== null ? result0 : "";
-        if (result0 !== null) {
-          result1 = parse_s();
-          if (result1 !== null) {
-            pos2 = pos;
-            if (input.substr(pos, 4) === "long") {
-              result2 = "long";
-              pos += 4;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("\"long\"");
-              }
-            }
-            if (result2 !== null) {
-              result3 = parse_s();
-              if (result3 !== null) {
-                if (input.substr(pos, 4) === "long") {
-                  result4 = "long";
-                  pos += 4;
-                } else {
-                  result4 = null;
-                  if (reportFailures === 0) {
-                    matchFailed("\"long\"");
-                  }
-                }
-                if (result4 !== null) {
-                  result2 = [result2, result3, result4];
-                } else {
-                  result2 = null;
-                  pos = pos2;
-                }
-              } else {
-                result2 = null;
-                pos = pos2;
-              }
-            } else {
-              result2 = null;
-              pos = pos2;
-            }
-            if (result2 === null) {
-              if (input.substr(pos, 4) === "long") {
-                result2 = "long";
-                pos += 4;
-              } else {
-                result2 = null;
-                if (reportFailures === 0) {
-                  matchFailed("\"long\"");
-                }
-              }
-              if (result2 === null) {
-                if (input.substr(pos, 5) === "short") {
-                  result2 = "short";
-                  pos += 5;
-                } else {
-                  result2 = null;
-                  if (reportFailures === 0) {
-                    matchFailed("\"short\"");
-                  }
-                }
-                if (result2 === null) {
-                  if (input.substr(pos, 4) === "byte") {
-                    result2 = "byte";
-                    pos += 4;
-                  } else {
-                    result2 = null;
-                    if (reportFailures === 0) {
-                      matchFailed("\"byte\"");
-                    }
-                  }
-                }
-              }
-            }
-            if (result2 !== null) {
-              result0 = [result0, result1, result2];
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, uns, kind) { return (uns ? "unsigned " : "") + (kind.join ? kind.join("") : kind); })(pos0, result0[0], result0[2]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_ScopedNameList() {
-        var result0, result1, result2;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_ScopedName();
-        if (result0 !== null) {
-          result1 = [];
-          result2 = parse_ScopedNameListRest();
-          while (result2 !== null) {
-            result1.push(result2);
-            result2 = parse_ScopedNameListRest();
-          }
-          if (result1 !== null) {
-            result0 = [result0, result1];
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, first, others) {   var ret = [first];
-                    for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); }
-                    return ret; })(pos0, result0[0], result0[1]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_ScopedNameListRest() {
-        var result0, result1, result2, result3;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_w();
-        if (result0 !== null) {
-          if (input.charCodeAt(pos) === 44) {
-            result1 = ",";
-            pos++;
-          } else {
-            result1 = null;
-            if (reportFailures === 0) {
-              matchFailed("\",\"");
-            }
-          }
-          if (result1 !== null) {
-            result2 = parse_w();
-            if (result2 !== null) {
-              result3 = parse_ScopedName();
-              if (result3 !== null) {
-                result0 = [result0, result1, result2, result3];
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, rest) { return rest; })(pos0, result0[3]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_ScopedName() {
-        var result0;
-        var pos0;
-        
-        pos0 = pos;
-        result0 = parse_AbsoluteScopedName();
-        if (result0 === null) {
-          result0 = parse_RelativeScopedName();
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, name) { return name; })(pos0, result0);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_AbsoluteScopedName() {
-        var result0, result1;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (input.substr(pos, 2) === "::") {
-          result0 = "::";
-          pos += 2;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\"::\"");
-          }
-        }
-        if (result0 !== null) {
-          result1 = parse_RelativeScopedName();
-          if (result1 !== null) {
-            result0 = [result0, result1];
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, rel) { return "::" + rel; })(pos0, result0[1]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_RelativeScopedName() {
-        var result0, result1, result2;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_identifier();
-        if (result0 !== null) {
-          result1 = [];
-          result2 = parse_ScopedNameRest();
-          while (result2 !== null) {
-            result1.push(result2);
-            result2 = parse_ScopedNameRest();
-          }
-          if (result1 !== null) {
-            result0 = [result0, result1];
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, name, rest) { return name + rest.join(""); })(pos0, result0[0], result0[1]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_ScopedNameRest() {
-        var result0, result1;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (input.substr(pos, 2) === "::") {
-          result0 = "::";
-          pos += 2;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\"::\"");
-          }
-        }
-        if (result0 !== null) {
-          result1 = parse_identifier();
-          if (result1 !== null) {
-            result0 = [result0, result1];
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, name) { return name.join(""); })(pos0, result0);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_BooleanLiteral() {
-        var result0;
-        var pos0;
-        
-        pos0 = pos;
-        if (input.substr(pos, 4) === "true") {
-          result0 = "true";
-          pos += 4;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\"true\"");
-          }
-        }
-        if (result0 === null) {
-          if (input.substr(pos, 5) === "false") {
-            result0 = "false";
-            pos += 5;
-          } else {
-            result0 = null;
-            if (reportFailures === 0) {
-              matchFailed("\"false\"");
-            }
-          }
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, value) { return value; })(pos0, result0);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_Nullable() {
-        var result0;
-        var pos0;
-        
-        pos0 = pos;
-        if (input.charCodeAt(pos) === 63) {
-          result0 = "?";
-          pos++;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\"?\"");
-          }
-        }
-        result0 = result0 !== null ? result0 : "";
-        if (result0 !== null) {
-          result0 = (function(offset, nullable) { return nullable ? true : false; })(pos0, result0);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_ReturnType() {
-        var result0;
-        var pos0;
-        
-        pos0 = pos;
-        if (input.substr(pos, 4) === "void") {
-          result0 = "void";
-          pos += 4;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\"void\"");
-          }
-        }
-        if (result0 === null) {
-          result0 = parse_type();
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, ret) { return ret; })(pos0, result0);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_definitions() {
-        var result0, result1, result2;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_w();
-        if (result0 !== null) {
-          result1 = [];
-          result2 = parse_definition();
-          while (result2 !== null) {
-            result1.push(result2);
-            result2 = parse_definition();
-          }
-          if (result1 !== null) {
-            result0 = [result0, result1];
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, defs) { return defs; })(pos0, result0[1]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_definition() {
-        var result0;
-        var pos0;
-        
-        pos0 = pos;
-        result0 = parse_partialdictionary();
-        if (result0 === null) {
-          result0 = parse_partialinterface();
-          if (result0 === null) {
-            result0 = parse_callbackinterface();
-            if (result0 === null) {
-              result0 = parse_module();
-              if (result0 === null) {
-                result0 = parse_interface();
-                if (result0 === null) {
-                  result0 = parse_dictionary();
-                  if (result0 === null) {
-                    result0 = parse_typedef();
-                    if (result0 === null) {
-                      result0 = parse_exception();
-                      if (result0 === null) {
-                        result0 = parse_implements();
-                        if (result0 === null) {
-                          result0 = parse_enum();
-                          if (result0 === null) {
-                            result0 = parse_callback();
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          }
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, def) { return def; })(pos0, result0);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_partialinterface() {
-        var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_ExtendedAttributeList();
-        if (result0 !== null) {
-          result1 = parse_s();
-          result1 = result1 !== null ? result1 : "";
-          if (result1 !== null) {
-            if (input.substr(pos, 7) === "partial") {
-              result2 = "partial";
-              pos += 7;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("\"partial\"");
-              }
-            }
-            if (result2 !== null) {
-              result3 = parse_s();
-              if (result3 !== null) {
-                if (input.substr(pos, 9) === "interface") {
-                  result4 = "interface";
-                  pos += 9;
-                } else {
-                  result4 = null;
-                  if (reportFailures === 0) {
-                    matchFailed("\"interface\"");
-                  }
-                }
-                if (result4 !== null) {
-                  result5 = parse_s();
-                  if (result5 !== null) {
-                    result6 = parse_identifier();
-                    if (result6 !== null) {
-                      result7 = parse_w();
-                      if (result7 !== null) {
-                        if (input.charCodeAt(pos) === 123) {
-                          result8 = "{";
-                          pos++;
-                        } else {
-                          result8 = null;
-                          if (reportFailures === 0) {
-                            matchFailed("\"{\"");
-                          }
-                        }
-                        if (result8 !== null) {
-                          result9 = parse_w();
-                          if (result9 !== null) {
-                            result10 = parse_InterfaceMemberList();
-                            if (result10 !== null) {
-                              result11 = parse_w();
-                              if (result11 !== null) {
-                                if (input.charCodeAt(pos) === 125) {
-                                  result12 = "}";
-                                  pos++;
-                                } else {
-                                  result12 = null;
-                                  if (reportFailures === 0) {
-                                    matchFailed("\"}\"");
-                                  }
-                                }
-                                if (result12 !== null) {
-                                  result13 = parse_w();
-                                  if (result13 !== null) {
-                                    if (input.charCodeAt(pos) === 59) {
-                                      result14 = ";";
-                                      pos++;
-                                    } else {
-                                      result14 = null;
-                                      if (reportFailures === 0) {
-                                        matchFailed("\";\"");
-                                      }
-                                    }
-                                    if (result14 !== null) {
-                                      result15 = parse_w();
-                                      if (result15 !== null) {
-                                        result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15];
-                                      } else {
-                                        result0 = null;
-                                        pos = pos1;
-                                      }
-                                    } else {
-                                      result0 = null;
-                                      pos = pos1;
-                                    }
-                                  } else {
-                                    result0 = null;
-                                    pos = pos1;
-                                  }
-                                } else {
-                                  result0 = null;
-                                  pos = pos1;
-                                }
-                              } else {
-                                result0 = null;
-                                pos = pos1;
-                              }
-                            } else {
-                              result0 = null;
-                              pos = pos1;
-                            }
-                          } else {
-                            result0 = null;
-                            pos = pos1;
-                          }
-                        } else {
-                          result0 = null;
-                          pos = pos1;
-                        }
-                      } else {
-                        result0 = null;
-                        pos = pos1;
-                      }
-                    } else {
-                      result0 = null;
-                      pos = pos1;
-                    }
-                  } else {
-                    result0 = null;
-                    pos = pos1;
-                  }
-                } else {
-                  result0 = null;
-                  pos = pos1;
-                }
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, extAttrs, name, mem) { return { type: "partialinterface", name: name, members: mem, extAttrs: extAttrs }; })(pos0, result0[0], result0[6], result0[10]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_partialdictionary() {
-        var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (input.substr(pos, 7) === "partial") {
-          result0 = "partial";
-          pos += 7;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\"partial\"");
-          }
-        }
-        if (result0 !== null) {
-          result1 = parse_s();
-          if (result1 !== null) {
-            if (input.substr(pos, 10) === "dictionary") {
-              result2 = "dictionary";
-              pos += 10;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("\"dictionary\"");
-              }
-            }
-            if (result2 !== null) {
-              result3 = parse_s();
-              if (result3 !== null) {
-                result4 = parse_identifier();
-                if (result4 !== null) {
-                  result5 = parse_w();
-                  if (result5 !== null) {
-                    if (input.charCodeAt(pos) === 123) {
-                      result6 = "{";
-                      pos++;
-                    } else {
-                      result6 = null;
-                      if (reportFailures === 0) {
-                        matchFailed("\"{\"");
-                      }
-                    }
-                    if (result6 !== null) {
-                      result7 = parse_w();
-                      if (result7 !== null) {
-                        result8 = parse_DictionaryMemberList();
-                        if (result8 !== null) {
-                          result9 = parse_w();
-                          if (result9 !== null) {
-                            if (input.charCodeAt(pos) === 125) {
-                              result10 = "}";
-                              pos++;
-                            } else {
-                              result10 = null;
-                              if (reportFailures === 0) {
-                                matchFailed("\"}\"");
-                              }
-                            }
-                            if (result10 !== null) {
-                              result11 = parse_w();
-                              if (result11 !== null) {
-                                if (input.charCodeAt(pos) === 59) {
-                                  result12 = ";";
-                                  pos++;
-                                } else {
-                                  result12 = null;
-                                  if (reportFailures === 0) {
-                                    matchFailed("\";\"");
-                                  }
-                                }
-                                if (result12 !== null) {
-                                  result13 = parse_w();
-                                  if (result13 !== null) {
-                                    result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13];
-                                  } else {
-                                    result0 = null;
-                                    pos = pos1;
-                                  }
-                                } else {
-                                  result0 = null;
-                                  pos = pos1;
-                                }
-                              } else {
-                                result0 = null;
-                                pos = pos1;
-                              }
-                            } else {
-                              result0 = null;
-                              pos = pos1;
-                            }
-                          } else {
-                            result0 = null;
-                            pos = pos1;
-                          }
-                        } else {
-                          result0 = null;
-                          pos = pos1;
-                        }
-                      } else {
-                        result0 = null;
-                        pos = pos1;
-                      }
-                    } else {
-                      result0 = null;
-                      pos = pos1;
-                    }
-                  } else {
-                    result0 = null;
-                    pos = pos1;
-                  }
-                } else {
-                  result0 = null;
-                  pos = pos1;
-                }
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, name, members) {
-                    return {
-                        type: "partialdictionary",
-                        name: name,
-                        members: members
-                    };
-                })(pos0, result0[4], result0[8]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_callbackinterface() {
-        var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_ExtendedAttributeList();
-        if (result0 !== null) {
-          result1 = parse_s();
-          result1 = result1 !== null ? result1 : "";
-          if (result1 !== null) {
-            if (input.substr(pos, 8) === "callback") {
-              result2 = "callback";
-              pos += 8;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("\"callback\"");
-              }
-            }
-            if (result2 !== null) {
-              result3 = parse_s();
-              if (result3 !== null) {
-                if (input.substr(pos, 9) === "interface") {
-                  result4 = "interface";
-                  pos += 9;
-                } else {
-                  result4 = null;
-                  if (reportFailures === 0) {
-                    matchFailed("\"interface\"");
-                  }
-                }
-                if (result4 !== null) {
-                  result5 = parse_s();
-                  if (result5 !== null) {
-                    result6 = parse_identifier();
-                    if (result6 !== null) {
-                      result7 = parse_w();
-                      if (result7 !== null) {
-                        if (input.charCodeAt(pos) === 123) {
-                          result8 = "{";
-                          pos++;
-                        } else {
-                          result8 = null;
-                          if (reportFailures === 0) {
-                            matchFailed("\"{\"");
-                          }
-                        }
-                        if (result8 !== null) {
-                          result9 = parse_w();
-                          if (result9 !== null) {
-                            result10 = parse_InterfaceMemberList();
-                            if (result10 !== null) {
-                              result11 = parse_w();
-                              if (result11 !== null) {
-                                if (input.charCodeAt(pos) === 125) {
-                                  result12 = "}";
-                                  pos++;
-                                } else {
-                                  result12 = null;
-                                  if (reportFailures === 0) {
-                                    matchFailed("\"}\"");
-                                  }
-                                }
-                                if (result12 !== null) {
-                                  result13 = parse_w();
-                                  if (result13 !== null) {
-                                    if (input.charCodeAt(pos) === 59) {
-                                      result14 = ";";
-                                      pos++;
-                                    } else {
-                                      result14 = null;
-                                      if (reportFailures === 0) {
-                                        matchFailed("\";\"");
-                                      }
-                                    }
-                                    if (result14 !== null) {
-                                      result15 = parse_w();
-                                      if (result15 !== null) {
-                                        result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15];
-                                      } else {
-                                        result0 = null;
-                                        pos = pos1;
-                                      }
-                                    } else {
-                                      result0 = null;
-                                      pos = pos1;
-                                    }
-                                  } else {
-                                    result0 = null;
-                                    pos = pos1;
-                                  }
-                                } else {
-                                  result0 = null;
-                                  pos = pos1;
-                                }
-                              } else {
-                                result0 = null;
-                                pos = pos1;
-                              }
-                            } else {
-                              result0 = null;
-                              pos = pos1;
-                            }
-                          } else {
-                            result0 = null;
-                            pos = pos1;
-                          }
-                        } else {
-                          result0 = null;
-                          pos = pos1;
-                        }
-                      } else {
-                        result0 = null;
-                        pos = pos1;
-                      }
-                    } else {
-                      result0 = null;
-                      pos = pos1;
-                    }
-                  } else {
-                    result0 = null;
-                    pos = pos1;
-                  }
-                } else {
-                  result0 = null;
-                  pos = pos1;
-                }
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, extAttrs, name, mem) { return { type: "callbackinterface", name: name, members: mem, extAttrs: extAttrs }; })(pos0, result0[0], result0[6], result0[10]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_module() {
-        var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_ExtendedAttributeList();
-        if (result0 !== null) {
-          result1 = parse_s();
-          result1 = result1 !== null ? result1 : "";
-          if (result1 !== null) {
-            if (input.substr(pos, 6) === "module") {
-              result2 = "module";
-              pos += 6;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("\"module\"");
-              }
-            }
-            if (result2 !== null) {
-              result3 = parse_s();
-              if (result3 !== null) {
-                result4 = parse_identifier();
-                if (result4 !== null) {
-                  result5 = parse_w();
-                  if (result5 !== null) {
-                    if (input.charCodeAt(pos) === 123) {
-                      result6 = "{";
-                      pos++;
-                    } else {
-                      result6 = null;
-                      if (reportFailures === 0) {
-                        matchFailed("\"{\"");
-                      }
-                    }
-                    if (result6 !== null) {
-                      result7 = parse_w();
-                      if (result7 !== null) {
-                        result8 = parse_definitions();
-                        if (result8 !== null) {
-                          result9 = parse_w();
-                          if (result9 !== null) {
-                            if (input.charCodeAt(pos) === 125) {
-                              result10 = "}";
-                              pos++;
-                            } else {
-                              result10 = null;
-                              if (reportFailures === 0) {
-                                matchFailed("\"}\"");
-                              }
-                            }
-                            if (result10 !== null) {
-                              result11 = parse_w();
-                              if (result11 !== null) {
-                                if (input.charCodeAt(pos) === 59) {
-                                  result12 = ";";
-                                  pos++;
-                                } else {
-                                  result12 = null;
-                                  if (reportFailures === 0) {
-                                    matchFailed("\";\"");
-                                  }
-                                }
-                                if (result12 !== null) {
-                                  result13 = parse_w();
-                                  if (result13 !== null) {
-                                    result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13];
-                                  } else {
-                                    result0 = null;
-                                    pos = pos1;
-                                  }
-                                } else {
-                                  result0 = null;
-                                  pos = pos1;
-                                }
-                              } else {
-                                result0 = null;
-                                pos = pos1;
-                              }
-                            } else {
-                              result0 = null;
-                              pos = pos1;
-                            }
-                          } else {
-                            result0 = null;
-                            pos = pos1;
-                          }
-                        } else {
-                          result0 = null;
-                          pos = pos1;
-                        }
-                      } else {
-                        result0 = null;
-                        pos = pos1;
-                      }
-                    } else {
-                      result0 = null;
-                      pos = pos1;
-                    }
-                  } else {
-                    result0 = null;
-                    pos = pos1;
-                  }
-                } else {
-                  result0 = null;
-                  pos = pos1;
-                }
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, extAttrs, name, defs) { return { type: "module", name: name, definitions: defs, extAttrs: extAttrs }; })(pos0, result0[0], result0[4], result0[8]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_implements() {
-        var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_ExtendedAttributeList();
-        if (result0 !== null) {
-          result1 = parse_s();
-          result1 = result1 !== null ? result1 : "";
-          if (result1 !== null) {
-            result2 = parse_ScopedName();
-            if (result2 !== null) {
-              result3 = parse_s();
-              if (result3 !== null) {
-                if (input.substr(pos, 10) === "implements") {
-                  result4 = "implements";
-                  pos += 10;
-                } else {
-                  result4 = null;
-                  if (reportFailures === 0) {
-                    matchFailed("\"implements\"");
-                  }
-                }
-                if (result4 !== null) {
-                  result5 = parse_s();
-                  if (result5 !== null) {
-                    result6 = parse_ScopedName();
-                    if (result6 !== null) {
-                      result7 = parse_w();
-                      if (result7 !== null) {
-                        if (input.charCodeAt(pos) === 59) {
-                          result8 = ";";
-                          pos++;
-                        } else {
-                          result8 = null;
-                          if (reportFailures === 0) {
-                            matchFailed("\";\"");
-                          }
-                        }
-                        if (result8 !== null) {
-                          result9 = parse_w();
-                          if (result9 !== null) {
-                            result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9];
-                          } else {
-                            result0 = null;
-                            pos = pos1;
-                          }
-                        } else {
-                          result0 = null;
-                          pos = pos1;
-                        }
-                      } else {
-                        result0 = null;
-                        pos = pos1;
-                      }
-                    } else {
-                      result0 = null;
-                      pos = pos1;
-                    }
-                  } else {
-                    result0 = null;
-                    pos = pos1;
-                  }
-                } else {
-                  result0 = null;
-                  pos = pos1;
-                }
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, extAttrs, target, impl) { return { type: 'implements', target: target, 'implements': impl, extAttrs: extAttrs }; })(pos0, result0[0], result0[2], result0[6]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_interface() {
-        var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_ExtendedAttributeList();
-        if (result0 !== null) {
-          result1 = parse_s();
-          result1 = result1 !== null ? result1 : "";
-          if (result1 !== null) {
-            if (input.substr(pos, 9) === "interface") {
-              result2 = "interface";
-              pos += 9;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("\"interface\"");
-              }
-            }
-            if (result2 !== null) {
-              result3 = parse_s();
-              if (result3 !== null) {
-                result4 = parse_identifier();
-                if (result4 !== null) {
-                  result5 = parse_w();
-                  if (result5 !== null) {
-                    result6 = parse_Inheritance();
-                    if (result6 !== null) {
-                      result7 = parse_w();
-                      if (result7 !== null) {
-                        if (input.charCodeAt(pos) === 123) {
-                          result8 = "{";
-                          pos++;
-                        } else {
-                          result8 = null;
-                          if (reportFailures === 0) {
-                            matchFailed("\"{\"");
-                          }
-                        }
-                        if (result8 !== null) {
-                          result9 = parse_w();
-                          if (result9 !== null) {
-                            result10 = parse_InterfaceMemberList();
-                            if (result10 !== null) {
-                              result11 = parse_w();
-                              if (result11 !== null) {
-                                if (input.charCodeAt(pos) === 125) {
-                                  result12 = "}";
-                                  pos++;
-                                } else {
-                                  result12 = null;
-                                  if (reportFailures === 0) {
-                                    matchFailed("\"}\"");
-                                  }
-                                }
-                                if (result12 !== null) {
-                                  result13 = parse_w();
-                                  if (result13 !== null) {
-                                    if (input.charCodeAt(pos) === 59) {
-                                      result14 = ";";
-                                      pos++;
-                                    } else {
-                                      result14 = null;
-                                      if (reportFailures === 0) {
-                                        matchFailed("\";\"");
-                                      }
-                                    }
-                                    if (result14 !== null) {
-                                      result15 = parse_w();
-                                      if (result15 !== null) {
-                                        result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15];
-                                      } else {
-                                        result0 = null;
-                                        pos = pos1;
-                                      }
-                                    } else {
-                                      result0 = null;
-                                      pos = pos1;
-                                    }
-                                  } else {
-                                    result0 = null;
-                                    pos = pos1;
-                                  }
-                                } else {
-                                  result0 = null;
-                                  pos = pos1;
-                                }
-                              } else {
-                                result0 = null;
-                                pos = pos1;
-                              }
-                            } else {
-                              result0 = null;
-                              pos = pos1;
-                            }
-                          } else {
-                            result0 = null;
-                            pos = pos1;
-                          }
-                        } else {
-                          result0 = null;
-                          pos = pos1;
-                        }
-                      } else {
-                        result0 = null;
-                        pos = pos1;
-                      }
-                    } else {
-                      result0 = null;
-                      pos = pos1;
-                    }
-                  } else {
-                    result0 = null;
-                    pos = pos1;
-                  }
-                } else {
-                  result0 = null;
-                  pos = pos1;
-                }
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, extAttrs, name, herit, mem) { return { type: "interface", name: name, inheritance: herit, members: mem, extAttrs: extAttrs }; })(pos0, result0[0], result0[4], result0[6], result0[10]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_enum() {
-        var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_ExtendedAttributeList();
-        if (result0 !== null) {
-          result1 = parse_s();
-          result1 = result1 !== null ? result1 : "";
-          if (result1 !== null) {
-            if (input.substr(pos, 4) === "enum") {
-              result2 = "enum";
-              pos += 4;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("\"enum\"");
-              }
-            }
-            if (result2 !== null) {
-              result3 = parse_s();
-              if (result3 !== null) {
-                result4 = parse_identifier();
-                if (result4 !== null) {
-                  result5 = parse_w();
-                  if (result5 !== null) {
-                    if (input.charCodeAt(pos) === 123) {
-                      result6 = "{";
-                      pos++;
-                    } else {
-                      result6 = null;
-                      if (reportFailures === 0) {
-                        matchFailed("\"{\"");
-                      }
-                    }
-                    if (result6 !== null) {
-                      result7 = parse_w();
-                      if (result7 !== null) {
-                        result8 = parse_EnumValues();
-                        if (result8 !== null) {
-                          result9 = parse_w();
-                          result9 = result9 !== null ? result9 : "";
-                          if (result9 !== null) {
-                            if (input.charCodeAt(pos) === 44) {
-                              result10 = ",";
-                              pos++;
-                            } else {
-                              result10 = null;
-                              if (reportFailures === 0) {
-                                matchFailed("\",\"");
-                              }
-                            }
-                            result10 = result10 !== null ? result10 : "";
-                            if (result10 !== null) {
-                              result11 = parse_w();
-                              if (result11 !== null) {
-                                if (input.charCodeAt(pos) === 125) {
-                                  result12 = "}";
-                                  pos++;
-                                } else {
-                                  result12 = null;
-                                  if (reportFailures === 0) {
-                                    matchFailed("\"}\"");
-                                  }
-                                }
-                                if (result12 !== null) {
-                                  result13 = parse_w();
-                                  if (result13 !== null) {
-                                    if (input.charCodeAt(pos) === 59) {
-                                      result14 = ";";
-                                      pos++;
-                                    } else {
-                                      result14 = null;
-                                      if (reportFailures === 0) {
-                                        matchFailed("\";\"");
-                                      }
-                                    }
-                                    if (result14 !== null) {
-                                      result15 = parse_w();
-                                      if (result15 !== null) {
-                                        result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15];
-                                      } else {
-                                        result0 = null;
-                                        pos = pos1;
-                                      }
-                                    } else {
-                                      result0 = null;
-                                      pos = pos1;
-                                    }
-                                  } else {
-                                    result0 = null;
-                                    pos = pos1;
-                                  }
-                                } else {
-                                  result0 = null;
-                                  pos = pos1;
-                                }
-                              } else {
-                                result0 = null;
-                                pos = pos1;
-                              }
-                            } else {
-                              result0 = null;
-                              pos = pos1;
-                            }
-                          } else {
-                            result0 = null;
-                            pos = pos1;
-                          }
-                        } else {
-                          result0 = null;
-                          pos = pos1;
-                        }
-                      } else {
-                        result0 = null;
-                        pos = pos1;
-                      }
-                    } else {
-                      result0 = null;
-                      pos = pos1;
-                    }
-                  } else {
-                    result0 = null;
-                    pos = pos1;
-                  }
-                } else {
-                  result0 = null;
-                  pos = pos1;
-                }
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, extAttrs, name, values) { return { type: "enum", name: name, values: values, extAttrs: extAttrs }; })(pos0, result0[0], result0[4], result0[8]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_callback() {
-        var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16, result17;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_ExtendedAttributeList();
-        if (result0 !== null) {
-          result1 = parse_s();
-          result1 = result1 !== null ? result1 : "";
-          if (result1 !== null) {
-            if (input.substr(pos, 8) === "callback") {
-              result2 = "callback";
-              pos += 8;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("\"callback\"");
-              }
-            }
-            if (result2 !== null) {
-              result3 = parse_s();
-              if (result3 !== null) {
-                result4 = parse_identifier();
-                if (result4 !== null) {
-                  result5 = parse_w();
-                  if (result5 !== null) {
-                    if (input.charCodeAt(pos) === 61) {
-                      result6 = "=";
-                      pos++;
-                    } else {
-                      result6 = null;
-                      if (reportFailures === 0) {
-                        matchFailed("\"=\"");
-                      }
-                    }
-                    if (result6 !== null) {
-                      result7 = parse_w();
-                      if (result7 !== null) {
-                        result8 = parse_ReturnType();
-                        if (result8 !== null) {
-                          result9 = parse_s();
-                          if (result9 !== null) {
-                            if (input.charCodeAt(pos) === 40) {
-                              result10 = "(";
-                              pos++;
-                            } else {
-                              result10 = null;
-                              if (reportFailures === 0) {
-                                matchFailed("\"(\"");
-                              }
-                            }
-                            if (result10 !== null) {
-                              result11 = parse_w();
-                              if (result11 !== null) {
-                                result12 = parse_Arguments();
-                                if (result12 !== null) {
-                                  result13 = parse_w();
-                                  if (result13 !== null) {
-                                    if (input.charCodeAt(pos) === 41) {
-                                      result14 = ")";
-                                      pos++;
-                                    } else {
-                                      result14 = null;
-                                      if (reportFailures === 0) {
-                                        matchFailed("\")\"");
-                                      }
-                                    }
-                                    if (result14 !== null) {
-                                      result15 = parse_w();
-                                      if (result15 !== null) {
-                                        if (input.charCodeAt(pos) === 59) {
-                                          result16 = ";";
-                                          pos++;
-                                        } else {
-                                          result16 = null;
-                                          if (reportFailures === 0) {
-                                            matchFailed("\";\"");
-                                          }
-                                        }
-                                        if (result16 !== null) {
-                                          result17 = parse_w();
-                                          if (result17 !== null) {
-                                            result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16, result17];
-                                          } else {
-                                            result0 = null;
-                                            pos = pos1;
-                                          }
-                                        } else {
-                                          result0 = null;
-                                          pos = pos1;
-                                        }
-                                      } else {
-                                        result0 = null;
-                                        pos = pos1;
-                                      }
-                                    } else {
-                                      result0 = null;
-                                      pos = pos1;
-                                    }
-                                  } else {
-                                    result0 = null;
-                                    pos = pos1;
-                                  }
-                                } else {
-                                  result0 = null;
-                                  pos = pos1;
-                                }
-                              } else {
-                                result0 = null;
-                                pos = pos1;
-                              }
-                            } else {
-                              result0 = null;
-                              pos = pos1;
-                            }
-                          } else {
-                            result0 = null;
-                            pos = pos1;
-                          }
-                        } else {
-                          result0 = null;
-                          pos = pos1;
-                        }
-                      } else {
-                        result0 = null;
-                        pos = pos1;
-                      }
-                    } else {
-                      result0 = null;
-                      pos = pos1;
-                    }
-                  } else {
-                    result0 = null;
-                    pos = pos1;
-                  }
-                } else {
-                  result0 = null;
-                  pos = pos1;
-                }
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, extAttrs, name, ret, args) { return { type: "callback", idlType: ret, name: name, args: args, extAttrs: extAttrs }; })(pos0, result0[0], result0[4], result0[8], result0[12]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_EnumValues() {
-        var result0, result1, result2;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_string();
-        if (result0 !== null) {
-          result1 = [];
-          result2 = parse_EnumValuesRest();
-          while (result2 !== null) {
-            result1.push(result2);
-            result2 = parse_EnumValuesRest();
-          }
-          if (result1 !== null) {
-            result0 = [result0, result1];
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, first, others) {   var ret = [first];
-                    for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); }
-                    return ret; })(pos0, result0[0], result0[1]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_EnumValuesRest() {
-        var result0, result1, result2, result3;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_w();
-        if (result0 !== null) {
-          if (input.charCodeAt(pos) === 44) {
-            result1 = ",";
-            pos++;
-          } else {
-            result1 = null;
-            if (reportFailures === 0) {
-              matchFailed("\",\"");
-            }
-          }
-          if (result1 !== null) {
-            result2 = parse_w();
-            if (result2 !== null) {
-              result3 = parse_string();
-              if (result3 !== null) {
-                result0 = [result0, result1, result2, result3];
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, rest) { return rest; })(pos0, result0[3]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_Inheritance() {
-        var result0;
-        var pos0;
-        
-        pos0 = pos;
-        result0 = parse_InheritanceInner();
-        result0 = result0 !== null ? result0 : "";
-        if (result0 !== null) {
-          result0 = (function(offset, herit) { return herit ? herit : []; })(pos0, result0);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_InheritanceInner() {
-        var result0, result1, result2;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (input.charCodeAt(pos) === 58) {
-          result0 = ":";
-          pos++;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\":\"");
-          }
-        }
-        if (result0 !== null) {
-          result1 = parse_w();
-          if (result1 !== null) {
-            result2 = parse_ScopedNameList();
-            if (result2 !== null) {
-              result0 = [result0, result1, result2];
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, herit) { return herit; })(pos0, result0[2]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_InterfaceMemberList() {
-        var result0, result1;
-        var pos0;
-        
-        pos0 = pos;
-        result0 = [];
-        result1 = parse_InterfaceMember();
-        while (result1 !== null) {
-          result0.push(result1);
-          result1 = parse_InterfaceMember();
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, mem) { return mem ? mem : []; })(pos0, result0);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_InterfaceMember() {
-        var result0;
-        var pos0;
-        
-        pos0 = pos;
-        result0 = parse_const();
-        if (result0 === null) {
-          result0 = parse_attrOrOp();
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, mem) { return mem; })(pos0, result0);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_const() {
-        var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_ExtendedAttributeList();
-        if (result0 !== null) {
-          result1 = parse_s();
-          result1 = result1 !== null ? result1 : "";
-          if (result1 !== null) {
-            if (input.substr(pos, 5) === "const") {
-              result2 = "const";
-              pos += 5;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("\"const\"");
-              }
-            }
-            if (result2 !== null) {
-              result3 = parse_s();
-              if (result3 !== null) {
-                result4 = parse_type();
-                if (result4 !== null) {
-                  result5 = parse_s();
-                  if (result5 !== null) {
-                    result6 = parse_identifier();
-                    if (result6 !== null) {
-                      result7 = parse_w();
-                      if (result7 !== null) {
-                        if (input.charCodeAt(pos) === 61) {
-                          result8 = "=";
-                          pos++;
-                        } else {
-                          result8 = null;
-                          if (reportFailures === 0) {
-                            matchFailed("\"=\"");
-                          }
-                        }
-                        if (result8 !== null) {
-                          result9 = parse_w();
-                          if (result9 !== null) {
-                            result10 = parse_constExpr();
-                            if (result10 !== null) {
-                              result11 = parse_w();
-                              if (result11 !== null) {
-                                if (input.charCodeAt(pos) === 59) {
-                                  result12 = ";";
-                                  pos++;
-                                } else {
-                                  result12 = null;
-                                  if (reportFailures === 0) {
-                                    matchFailed("\";\"");
-                                  }
-                                }
-                                if (result12 !== null) {
-                                  result13 = parse_w();
-                                  if (result13 !== null) {
-                                    result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13];
-                                  } else {
-                                    result0 = null;
-                                    pos = pos1;
-                                  }
-                                } else {
-                                  result0 = null;
-                                  pos = pos1;
-                                }
-                              } else {
-                                result0 = null;
-                                pos = pos1;
-                              }
-                            } else {
-                              result0 = null;
-                              pos = pos1;
-                            }
-                          } else {
-                            result0 = null;
-                            pos = pos1;
-                          }
-                        } else {
-                          result0 = null;
-                          pos = pos1;
-                        }
-                      } else {
-                        result0 = null;
-                        pos = pos1;
-                      }
-                    } else {
-                      result0 = null;
-                      pos = pos1;
-                    }
-                  } else {
-                    result0 = null;
-                    pos = pos1;
-                  }
-                } else {
-                  result0 = null;
-                  pos = pos1;
-                }
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, extAttrs, type, name, value) { return { type: "const", extAttrs: extAttrs, idlType: type, name: name, value: value }; })(pos0, result0[0], result0[4], result0[6], result0[10]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_constExpr() {
-        var result0;
-        var pos0;
-        
-        pos0 = pos;
-        result0 = parse_BooleanLiteral();
-        if (result0 === null) {
-          result0 = parse_float();
-          if (result0 === null) {
-            result0 = parse_integer();
-            if (result0 === null) {
-              if (input.substr(pos, 3) === "NaN") {
-                result0 = "NaN";
-                pos += 3;
-              } else {
-                result0 = null;
-                if (reportFailures === 0) {
-                  matchFailed("\"NaN\"");
-                }
-              }
-              if (result0 === null) {
-                if (input.substr(pos, 4) === "null") {
-                  result0 = "null";
-                  pos += 4;
-                } else {
-                  result0 = null;
-                  if (reportFailures === 0) {
-                    matchFailed("\"null\"");
-                  }
-                }
-                if (result0 === null) {
-                  if (input.charCodeAt(pos) === 39) {
-                    result0 = "'";
-                    pos++;
-                  } else {
-                    result0 = null;
-                    if (reportFailures === 0) {
-                      matchFailed("\"'\"");
-                    }
-                  }
-                }
-              }
-            }
-          }
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, value) { return value; })(pos0, result0);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_attrOrOp() {
-        var result0;
-        var pos0;
-        
-        pos0 = pos;
-        result0 = parse_Stringifier();
-        if (result0 === null) {
-          result0 = parse_Attribute();
-          if (result0 === null) {
-            result0 = parse_Operation();
-          }
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, ao) { return ao; })(pos0, result0);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_Stringifier() {
-        var result0, result1, result2;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (input.substr(pos, 11) === "stringifier") {
-          result0 = "stringifier";
-          pos += 11;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\"stringifier\"");
-          }
-        }
-        if (result0 !== null) {
-          result1 = parse_w();
-          if (result1 !== null) {
-            result2 = parse_Attribute();
-            if (result2 === null) {
-              result2 = parse_OperationRest();
-              if (result2 === null) {
-                if (input.charCodeAt(pos) === 59) {
-                  result2 = ";";
-                  pos++;
-                } else {
-                  result2 = null;
-                  if (reportFailures === 0) {
-                    matchFailed("\";\"");
-                  }
-                }
-              }
-            }
-            if (result2 !== null) {
-              result0 = [result0, result1, result2];
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, rest) {
-                    if (rest === ";") return { type: "stringifier", stringifier: true };
-                    else {
-                        rest.stringifier = true;
-                        return rest;
-                    }
-                })(pos0, result0[2]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_Attribute() {
-        var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14;
-        var pos0, pos1, pos2;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_ExtendedAttributeList();
-        if (result0 !== null) {
-          result1 = parse_w();
-          if (result1 !== null) {
-            pos2 = pos;
-            if (input.substr(pos, 8) === "readonly") {
-              result2 = "readonly";
-              pos += 8;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("\"readonly\"");
-              }
-            }
-            if (result2 !== null) {
-              result3 = parse_s();
-              if (result3 !== null) {
-                result2 = [result2, result3];
-              } else {
-                result2 = null;
-                pos = pos2;
-              }
-            } else {
-              result2 = null;
-              pos = pos2;
-            }
-            result2 = result2 !== null ? result2 : "";
-            if (result2 !== null) {
-              if (input.substr(pos, 9) === "attribute") {
-                result3 = "attribute";
-                pos += 9;
-              } else {
-                result3 = null;
-                if (reportFailures === 0) {
-                  matchFailed("\"attribute\"");
-                }
-              }
-              if (result3 !== null) {
-                result4 = parse_s();
-                if (result4 !== null) {
-                  result5 = parse_type();
-                  if (result5 !== null) {
-                    result6 = parse_s();
-                    if (result6 !== null) {
-                      result7 = parse_identifier();
-                      if (result7 !== null) {
-                        result8 = parse_w();
-                        if (result8 !== null) {
-                          result9 = parse_GetRaises();
-                          result9 = result9 !== null ? result9 : "";
-                          if (result9 !== null) {
-                            result10 = parse_w();
-                            if (result10 !== null) {
-                              result11 = parse_SetRaises();
-                              result11 = result11 !== null ? result11 : "";
-                              if (result11 !== null) {
-                                result12 = parse_w();
-                                if (result12 !== null) {
-                                  if (input.charCodeAt(pos) === 59) {
-                                    result13 = ";";
-                                    pos++;
-                                  } else {
-                                    result13 = null;
-                                    if (reportFailures === 0) {
-                                      matchFailed("\";\"");
-                                    }
-                                  }
-                                  if (result13 !== null) {
-                                    result14 = parse_w();
-                                    if (result14 !== null) {
-                                      result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14];
-                                    } else {
-                                      result0 = null;
-                                      pos = pos1;
-                                    }
-                                  } else {
-                                    result0 = null;
-                                    pos = pos1;
-                                  }
-                                } else {
-                                  result0 = null;
-                                  pos = pos1;
-                                }
-                              } else {
-                                result0 = null;
-                                pos = pos1;
-                              }
-                            } else {
-                              result0 = null;
-                              pos = pos1;
-                            }
-                          } else {
-                            result0 = null;
-                            pos = pos1;
-                          }
-                        } else {
-                          result0 = null;
-                          pos = pos1;
-                        }
-                      } else {
-                        result0 = null;
-                        pos = pos1;
-                      }
-                    } else {
-                      result0 = null;
-                      pos = pos1;
-                    }
-                  } else {
-                    result0 = null;
-                    pos = pos1;
-                  }
-                } else {
-                  result0 = null;
-                  pos = pos1;
-                }
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, extAttrs, ro, type, name, gr, sr) { return { type: "attribute", extAttrs: extAttrs, idlType: type, name: name, readonly: (ro ? true : false), getraises: gr, setraises: sr }; })(pos0, result0[0], result0[2], result0[5], result0[7], result0[9], result0[11]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_GetRaises() {
-        var result0, result1, result2, result3, result4;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (input.substr(pos, 9) === "getraises") {
-          result0 = "getraises";
-          pos += 9;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\"getraises\"");
-          }
-        }
-        if (result0 !== null) {
-          result1 = parse_w();
-          if (result1 !== null) {
-            if (input.charCodeAt(pos) === 40) {
-              result2 = "(";
-              pos++;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("\"(\"");
-              }
-            }
-            if (result2 !== null) {
-              result3 = parse_ScopedNameList();
-              if (result3 !== null) {
-                if (input.charCodeAt(pos) === 41) {
-                  result4 = ")";
-                  pos++;
-                } else {
-                  result4 = null;
-                  if (reportFailures === 0) {
-                    matchFailed("\")\"");
-                  }
-                }
-                if (result4 !== null) {
-                  result0 = [result0, result1, result2, result3, result4];
-                } else {
-                  result0 = null;
-                  pos = pos1;
-                }
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, list) { return list; })(pos0, result0[3]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_SetRaises() {
-        var result0, result1, result2, result3, result4;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        if (input.substr(pos, 9) === "setraises") {
-          result0 = "setraises";
-          pos += 9;
-        } else {
-          result0 = null;
-          if (reportFailures === 0) {
-            matchFailed("\"setraises\"");
-          }
-        }
-        if (result0 !== null) {
-          result1 = parse_w();
-          if (result1 !== null) {
-            if (input.charCodeAt(pos) === 40) {
-              result2 = "(";
-              pos++;
-            } else {
-              result2 = null;
-              if (reportFailures === 0) {
-                matchFailed("\"(\"");
-              }
-            }
-            if (result2 !== null) {
-              result3 = parse_ScopedNameList();
-              if (result3 !== null) {
-                if (input.charCodeAt(pos) === 41) {
-                  result4 = ")";
-                  pos++;
-                } else {
-                  result4 = null;
-                  if (reportFailures === 0) {
-                    matchFailed("\")\"");
-                  }
-                }
-                if (result4 !== null) {
-                  result0 = [result0, result1, result2, result3, result4];
-                } else {
-                  result0 = null;
-                  pos = pos1;
-                }
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, list) { return list; })(pos0, result0[3]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_Operation() {
-        var result0, result1, result2, result3, result4;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_ExtendedAttributeList();
-        if (result0 !== null) {
-          result1 = parse_w();
-          if (result1 !== null) {
-            result2 = parse_Qualifiers();
-            if (result2 !== null) {
-              result3 = parse_w();
-              if (result3 !== null) {
-                result4 = parse_OperationRest();
-                if (result4 !== null) {
-                  result0 = [result0, result1, result2, result3, result4];
-                } else {
-                  result0 = null;
-                  pos = pos1;
-                }
-              } else {
-                result0 = null;
-                pos = pos1;
-              }
-            } else {
-              result0 = null;
-              pos = pos1;
-            }
-          } else {
-            result0 = null;
-            pos = pos1;
-          }
-        } else {
-          result0 = null;
-          pos = pos1;
-        }
-        if (result0 !== null) {
-          result0 = (function(offset, extAttrs, quals, rest) {
-                    for (var k in quals) rest[k] = quals[k];
-                    if (extAttrs) rest.extAttrs = extAttrs;
-                    return rest;
-                })(pos0, result0[0], result0[2], result0[4]);
-        }
-        if (result0 === null) {
-          pos = pos0;
-        }
-        return result0;
-      }
-      
-      function parse_Qualifiers() {
-        var result0, result1, result2;
-        var pos0, pos1;
-        
-        pos0 = pos;
-        pos1 = pos;
-        result0 = parse_w();
-        if (result0 !== null) {
-          if (input.substr(pos, 6) === "static") {
-            result1 = "static";
-            pos += 6;
-          } else {
-            result1 = null;
-            if (reportFailures === 0) {
-              matchFailed("\"static\"");
-            }
-          }
-          if (result1 === null) {
-            result1 = [];