Roll IDL to Dartium37 (r181268)

This is the effect of running idlsync.py.

R=terry@google.com

Review URL: https://codereview.chromium.org//540533002

git-svn-id: http://dart.googlecode.com/svn/third_party/WebCore@39836 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/bindings/IDLExtendedAttributes.txt b/bindings/IDLExtendedAttributes.txt
new file mode 100644
index 0000000..dafd683
--- /dev/null
+++ b/bindings/IDLExtendedAttributes.txt
@@ -0,0 +1,112 @@
+#
+# This file describes all Blink IDL extended attributes and allowed values.
+# If any IDL file uses an extended attribute or values not listed below, the
+# build will fail.
+# If you would like to add a new extended attribute or value, please:
+#     (1) add the extended attribute or value to this file
+#     (2) add an explanation to the Blink IDL extended attributes document:
+#         http://www.chromium.org/blink/webidl/blink-idl-extended-attributes
+#     (3) add appropriate test cases to run-bindings-tests
+#
+# The syntax of this file is as follows:
+#     - One extended attribute per one line: Name and (optionally) Values.
+#     - "Attr" means that the Attr does not take a value, i.e. [Attr].
+#     - "Attr=X" means that Attr takes a required value, which must be X;
+#       i.e. [Attr=X].
+#     - "Attr=X|Y|Z" means that Attr takes a required value, and the valid
+#       values are X, Y, and Z, and combinations thereof;
+#       e.g. [Attr=X], [Attr=Y], [Attr=X|Z].
+#       The separator must be | or &, so [Attr=X&Z] is also valid; the
+#       separator makes a difference for Conditional, but otherwise is simply
+#       a style convention.
+#     - "Attr=|X|Y|Z" means that Attr takes an optional value, whose valid
+#       values (if present) are X, Y, and Z, and combinations thereof; e.g.
+#       [Attr], [Attr=X], [Attr=Y], [Attr=X|Z], [Attr=X|Y|Z], [Attr=X&Z].
+#       Note that including an empty value in the list, as in [Attr=X||Y],
+#       is NOT valid: the value is optional, but empty values are not allowed.
+#     - "Attr=*" means that Attr takes a required value, which can be
+#       arbitrary, and combinations thereof, e.g. [Attr=IndexedDB],
+#       [Attr=DeleteFunction], [Attr=X|Y].
+#     - "Attr=|*" means that Attr takes an optional value, which can be
+#       arbitrary, e.g. [Attr], [Attr=X].
+#     - "Attr=X|*" means that Attr takes an required value, which can be
+#       arbitrary, but that "X" is standard, e.g. [Attr=X], [Attr=Foo].
+#
+
+ActiveDOMObject
+CachedAttribute=*
+CallWith=ExecutionContext|ScriptState|ScriptArguments|ActiveWindow|FirstWindow|ThisValue
+CheckSecurity=Frame|Node
+Clamp
+Conditional=*
+Constructor
+# FIXME: remove [ConstructorCallWith=Document], as can instead use
+# [ConstructorCallWith=ExecutionContext] + toDocument(executionContext)
+ConstructorCallWith=ExecutionContext|Document
+Custom=|Getter|Setter|LegacyCallAsFunction|ToV8|VisitDOMWrapper|Wrap|PropertyGetter|PropertyEnumerator|PropertyQuery
+CustomConstructor
+CustomElementCallbacks
+# Dartium specific attributes.
+# DartCustom can have no value or New if New an additional method is added (V8 will not see this method)
+DartCustom=|New|Setter|Getter
+# DartName should have the alias name to be used to resolve.
+DartName=*
+# DartSuppress can have no value will suppress attribute/method, if attribute can also suppress
+# just the DartSuppress=getter or DartSuppress=Setter
+DartSuppress=|Getter|Setter
+# No need to setup Dart API scope when a native function is invoked. 
+DartNoAutoScope
+# End of Dartium attributes.
+Default=Undefined
+DependentLifetime
+DeprecateAs=*
+DoNotCheckConstants
+DoNotCheckSecurity=|Setter
+DoNotCheckSignature
+EnforceRange
+EventConstructor
+ExposeJSAccessors
+Exposed=*
+GarbageCollected
+Global=|*
+Immutable
+ImplementedAs=*
+InitializedByEventConstructor
+LegacyTreatAsPartialInterface
+LogActivity=|GetterOnly|SetterOnly
+LogAllWorlds
+LogPreviousValue
+MeasureAs=*
+NamedConstructor=*
+NoInterfaceObject
+NotEnumerable
+OverrideBuiltins
+PartialInterfaceImplementedAs=*
+# Valid values for [PerContextEnabled] are Context Features, in
+# ContextFeatures::FeatureType in Source/core/dom/ContextFeatures.h
+PerContextEnabled=*
+PerWorldBindings
+PrimaryGlobal=|*
+PutForwards=*
+RaisesException=|Getter|Setter|Constructor
+ReadOnly
+Reflect=|*
+ReflectEmpty=*
+ReflectInvalid=*
+ReflectMissing=*
+ReflectOnly=*
+Replaceable
+# Valid values for [RuntimeEnabled] are the Runtime Enabled Features, listed in
+# Source/core/page/RuntimeEnabledFeatures.in
+RuntimeEnabled=*
+SetWrapperReferenceFrom=*
+SetWrapperReferenceTo=*
+SetterCallWith=ExecutionContext|ScriptArguments|ActiveWindow|FirstWindow
+SpecialWrapFor=*
+TreatNullAs=NullString
+TreatReturnedNullStringAs=Null|Undefined
+TreatUndefinedAs=NullString
+TypeChecking=Interface|Nullable|Unrestricted
+URL
+Unforgeable
+WillBeGarbageCollected
diff --git a/bindings/PRESUBMIT.py b/bindings/PRESUBMIT.py
new file mode 100644
index 0000000..605322d
--- /dev/null
+++ b/bindings/PRESUBMIT.py
@@ -0,0 +1,74 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Blink bindings presubmit script
+
+See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
+for more details about the presubmit API built into gcl.
+"""
+
+# Changes to v8/ do not change generated code or tests, so exclude from
+# _RunBindingsTests
+BLACK_LIST = (r'.*\bv8[\\\/].*',)
+
+def _RunBindingsTests(input_api, output_api):
+    # Skip if nothing to do
+    source_filter = lambda x: input_api.FilterSourceFile(
+                x, black_list=input_api.DEFAULT_BLACK_LIST + BLACK_LIST)
+    if not input_api.AffectedFiles(file_filter=source_filter):
+        return []
+
+    if input_api.is_committing:
+        message_type = output_api.PresubmitError
+    else:
+        message_type = output_api.PresubmitPromptWarning
+
+    pardir = input_api.os_path.pardir
+    run_bindings_tests_path = input_api.os_path.join(input_api.PresubmitLocalPath(), pardir, pardir, 'Tools', 'Scripts', 'run-bindings-tests')
+    cmd_name = 'run-bindings-tests'
+    if input_api.platform == 'win32':
+        # Windows needs some help.
+        cmd = [input_api.python_executable, run_bindings_tests_path]
+    else:
+        cmd = [run_bindings_tests_path]
+    test_cmd = input_api.Command(
+      name=cmd_name,
+      cmd=cmd,
+      kwargs={},
+      message=message_type)
+    if input_api.verbose:
+        print('Running ' + cmd_name)
+    return input_api.RunTests([test_cmd])
+
+
+def CheckChangeOnUpload(input_api, output_api):
+    return _RunBindingsTests(input_api, output_api)
+
+
+def CheckChangeOnCommit(input_api, output_api):
+    return _RunBindingsTests(input_api, output_api)
diff --git a/bindings/README b/bindings/README
new file mode 100644
index 0000000..bf749b3
--- /dev/null
+++ b/bindings/README
@@ -0,0 +1,9 @@
+This directory contains a copy of WebKit/WebCore IDL files.
+See the attached LICENSE-* files in this directory.
+
+Please do not modify the files here.  They are periodically copied
+using the script: $DART_ROOT/sdk/lib/html/scripts/idlsync.py
+
+The current version corresponds to:
+URL: http://src.chromium.org/blink/branches/dart/dartium
+Current revision: 181268
diff --git a/bindings/__init__.py b/bindings/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bindings/__init__.py
diff --git a/bindings/dart/gyp/scripts/build_dart_snapshot.py b/bindings/dart/gyp/scripts/build_dart_snapshot.py
new file mode 100755
index 0000000..323f38a
--- /dev/null
+++ b/bindings/dart/gyp/scripts/build_dart_snapshot.py
@@ -0,0 +1,116 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2011 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# build_dart_snapshot.py generates two C++ files: DartSnapshot.cpp
+# with a constant which is a snapshot of major DOM libs an
+# DartResolver.cpp which is a resolver for dart:html library.
+
+import os.path
+import subprocess
+import sys
+
+
+def main(args):
+    assert(len(args) >= 4)
+    dartPath = args[1]
+    dartSnapshotTemplateFile = args[2]
+    outputFilePath = args[3]
+    genSnapshotBinPath = args[4]
+    snapshottedLibPaths = args[5:]
+
+    def path(*components):
+        return os.path.abspath(os.path.join(*components))
+
+    def dartName(path):
+        # Translates <dirs>/foo_dartium.dart into foo.
+        return (os.path.splitext(os.path.split(path)[1])[0]
+                .replace('_dartium', ''))
+
+    snapshottedLibs = [(dartName(p), path(p))
+                       for p in snapshottedLibPaths]
+
+    # Generate a Dart script to build the snapshot from.
+    snapshotScriptName = os.path.join(outputFilePath, 'snapshotScript.dart')
+    with file(snapshotScriptName, 'w') as snapshotScript:
+        snapshotScript.write('library snapshot;\n')
+        for name, _ in snapshottedLibs:
+            # Skip internal libraries - they should be indirectly imported via the public ones.
+            if not name.startswith('_'):
+                snapshotScript.write('import \'dart:%(name)s\' as %(name)s;\n' % {'name': name})
+
+    binarySnapshotFile = path(outputFilePath, 'DartSnapshot.bin')
+
+    # Build a command to generate the snapshot bin file.
+    command = [
+        'python',
+        path(dartPath, 'runtime', 'tools', 'create_snapshot_bin.py'),
+        '--executable=%s' % path(genSnapshotBinPath),
+        '--output_bin=%s' % binarySnapshotFile,
+        '--script=%s' % snapshotScriptName,
+    ]
+    command.extend(['--url_mapping=dart:%s,%s' % lib for lib in snapshottedLibs])
+
+    pipe = subprocess.Popen(command,
+                            stdout=subprocess.PIPE,
+                            stderr=subprocess.PIPE)
+    out, error = pipe.communicate()
+    if (pipe.returncode != 0):
+        raise Exception('Snapshot bin generation failed: %s/%s' % (out, error))
+
+    # Build a command to generate the snapshot file.
+    command = [
+        'python',
+        path(dartPath, 'runtime', 'tools', 'create_snapshot_file.py'),
+        '--input_cc=%s' % dartSnapshotTemplateFile,
+        '--input_bin=%s' % binarySnapshotFile,
+        '--output=%s' % path(outputFilePath, 'DartSnapshot.bytes'),
+    ]
+
+    pipe = subprocess.Popen(command,
+                            stdout=subprocess.PIPE,
+                            stderr=subprocess.PIPE)
+    out, error = pipe.communicate()
+    if (pipe.returncode != 0):
+        raise Exception('Snapshot file generation failed: %s/%s' % (out, error))
+
+    snapshotSizeInBytes = os.path.getsize(binarySnapshotFile)
+    productDir = os.path.dirname(genSnapshotBinPath)
+    snapshotSizeOutputPath = os.path.join(productDir, 'snapshot-size.txt')
+    with file(snapshotSizeOutputPath, 'w') as snapshotSizeFile:
+        snapshotSizeFile.write('%d\n' % snapshotSizeInBytes)
+
+    return 0
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
diff --git a/bindings/dart/gyp/scripts/create_resources.py b/bindings/dart/gyp/scripts/create_resources.py
new file mode 100644
index 0000000..3b6b992
--- /dev/null
+++ b/bindings/dart/gyp/scripts/create_resources.py
@@ -0,0 +1,116 @@
+# Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+#
+# This python script creates string literals in a C++ source file from a C++
+# source template and one or more resource files.
+
+import os
+import sys
+from os.path import join
+import time
+from optparse import OptionParser
+import re
+from datetime import date
+
+
+def makeResources(root_dir, input_files):
+    result = ''
+    resources = []
+
+    # Write each file's contents as a byte string constant.
+    for resource_file in input_files:
+        if root_dir and resource_file.startswith(root_dir):
+            resource_file_name = resource_file[len(root_dir):]
+        else:
+            resource_file_name = resource_file
+        resource_url = '/%s' % resource_file_name
+        result += '// %s\n' % resource_file
+        result += 'const char '
+        resource_name = re.sub(r'(/|\.|-)', '_', resource_file_name) + '_'
+        result += resource_name
+        result += '[] = {\n   '
+        fileHandle = open(resource_file, 'rb')
+        lineCounter = 0
+        for byte in fileHandle.read():
+            result += r" '\x%02x'," % ord(byte)
+            lineCounter += 1
+            if lineCounter == 10:
+                result += '\n   '
+                lineCounter = 0
+        if lineCounter != 0:
+            result += '\n   '
+        result += ' 0\n};\n\n'
+        resources.append(
+            (resource_url, resource_name, os.stat(resource_file).st_size))
+
+    # Write the resource table.
+    result += 'Resources::resource_map_entry Resources::builtin_resources_[] = '
+    result += '{\n'
+    for res in resources:
+        result += '   { "%s", %s, %d },\n' % res
+    result += '};\n\n'
+    result += 'const intptr_t Resources::builtin_resources_count_ '
+    result += '= %d;\n' % len(resources)
+    return result
+
+
+def makeFile(output_file, root_dir, input_files):
+    cc_text = '''
+// Copyright (c) %d, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+''' % date.today().year
+    cc_text += '#if defined(new)\n'
+    cc_text += '#undef new\n'
+    cc_text += '#endif\n\n'
+    cc_text += '#if defined(delete)\n'
+    cc_text += '#undef delete\n'
+    cc_text += '#endif\n\n'
+    cc_text += '#ifndef NDEBUG\n'
+    cc_text += '#define DEBUG\n'
+    cc_text += '#endif\n'
+    cc_text += '#include "bin/resources.h"\n\n'
+    cc_text += 'namespace dart {\n'
+    cc_text += 'namespace bin {\n'
+    cc_text += makeResources(root_dir, input_files)
+    cc_text += '}  // namespace bin\n} // namespace dart\n'
+    open(output_file, 'w').write(cc_text)
+    return True
+
+
+def main(args):
+    try:
+        # Parse input.
+        parser = OptionParser()
+        parser.add_option("--output",
+                          action="store", type="string",
+                          help="output file name")
+        parser.add_option("--root_prefix",
+                          action="store", type="string",
+                          help="root directory for resources")
+        (options, args) = parser.parse_args()
+        if not options.output:
+            sys.stderr.write('--output not specified\n')
+            return -1
+        if len(args) == 0:
+            sys.stderr.write('No input files specified\n')
+            return -1
+
+        files = []
+        for arg in args:
+            files.append(arg)
+
+        if not makeFile(options.output, options.root_prefix, files):
+            return -1
+
+        return 0
+    except Exception, inst:
+        sys.stderr.write('create_resources.py exception\n')
+        sys.stderr.write(str(inst))
+        sys.stderr.write('\n')
+        return -1
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
diff --git a/bindings/dart/gyp/scripts/dart_action_derivedsourcesallinone.py b/bindings/dart/gyp/scripts/dart_action_derivedsourcesallinone.py
new file mode 100644
index 0000000..969ffa6
--- /dev/null
+++ b/bindings/dart/gyp/scripts/dart_action_derivedsourcesallinone.py
@@ -0,0 +1,77 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2011 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# dart_action_derivedsourceslist.py generates a single or several cpp files
+# that include all Dart bindings cpp files generated from idls.
+#
+# usage: dart_action_derivedsourceslist.py IDL_FILES_LIST -- OUTPUT_FILE1 OUTPUT_FILE2 ...
+#
+# Note that IDL_FILES_LIST is a text file containing the IDL file paths.
+
+import os.path
+import re
+import sys
+
+v8scriptPath = os.path.join(sys.path[0], '../../../../WebCore.gyp/scripts')
+sys.path.append(v8scriptPath)
+
+# FIXME: there are couple of very ugly hacks like duplication of main code and
+# regexp to rewrite V8 prefix to Dart. It all can be easily solved with minimal
+# modifications to action_derivedsourcesallinone.py.
+import action_derivedsourcesallinone as base
+
+
+def main(args):
+    assert(len(args) > 3)
+    inOutBreakIndex = args.index('--')
+    inputFileName = args[1]
+    outputFileNames = args[inOutBreakIndex + 1:]
+
+    inputFile = open(inputFileName, 'r')
+    idlFileNames = inputFile.read().split('\n')
+    inputFile.close()
+
+    filesMetaData = base.extractMetaData(idlFileNames)
+    for fileName in outputFileNames:
+        partition = outputFileNames.index(fileName)
+        fileContents = base.generateContent(filesMetaData, partition, len(outputFileNames))
+        # FIXME: ugly hack---change V8 prefix to Dart.
+        fileContents = re.sub('\n#include "bindings/V8', '\n#include "bindings/Dart', fileContents)
+        base.writeContent(fileContents, fileName)
+
+    return 0
+
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
diff --git a/bindings/dart/gyp/scripts/dart_html_lib_deps.py b/bindings/dart/gyp/scripts/dart_html_lib_deps.py
new file mode 100644
index 0000000..ff534f0
--- /dev/null
+++ b/bindings/dart/gyp/scripts/dart_html_lib_deps.py
@@ -0,0 +1,65 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2012 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+import fnmatch
+import os
+import sys
+
+
+def printAllFilesRecursively(directory, pattern):
+  def matches(basename): return fnmatch.fnmatch(basename, pattern)
+  for root, _, files in os.walk(directory):
+    for basename in filter(matches, files):
+      # gyp operates correctly only on /, not Windows \.
+      print os.path.join(root, basename).replace(os.sep, '/')
+
+
+
+def main(args):
+  dart_html_lib_dir = args[1]
+
+  deps = [
+      ('idl', '*.idl'),
+      ('scripts', '*.py'),
+      ('src', '*.dart'),
+      ('templates', '*.*template'),
+  ]
+
+  for directory, pattern in deps:
+    printAllFilesRecursively(os.path.join(dart_html_lib_dir, directory), pattern)
+
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
diff --git a/bindings/dart/gyp/scripts/generate_dart_bindings.py b/bindings/dart/gyp/scripts/generate_dart_bindings.py
new file mode 100755
index 0000000..a57881d
--- /dev/null
+++ b/bindings/dart/gyp/scripts/generate_dart_bindings.py
@@ -0,0 +1,75 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2012 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import glob
+import os.path
+import sys
+import tempfile
+
+def main(args):
+    assert(len(args) == 6)
+    idlListFileName = args[1]
+    dartiumScriptDir = args[2]
+    dartScriptDir = args[3]
+    outputFilePath = args[4]
+    featureDefines = args[5]
+
+    # Clear out any stale dart/lib/html/scripts/.pyc files that are lurking.
+    for f in glob.glob(os.path.join(dartScriptDir, '*.pyc')):
+      os.remove(f)
+
+    baseDir = os.path.dirname(dartiumScriptDir)
+    idlListFile = open(idlListFileName, 'r')
+    idlFiles = [os.path.join(baseDir, fileName.strip()) for fileName in idlListFile]
+    idlListFile.close()
+
+    def analyse(featureDef):
+      featureDef = featureDef.strip('"')
+      if '=' not in featureDef: return None
+      feature, status = featureDef.split('=')
+      if status == '1':
+        return feature
+      return None
+
+    featureDefines = filter(None, map(analyse, featureDefines.split()))
+
+    sys.path.insert(0, dartScriptDir)
+    import fremontcutbuilder
+    import dartdomgenerator
+
+    database = fremontcutbuilder.build_database(idlFiles, tempfile.mkdtemp(), feature_defines=featureDefines)
+    database.Load()
+    dartdomgenerator.GenerateFromDatabase(database, None, outputFilePath)
+    database.Delete()
+
+    return 0
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
diff --git a/bindings/dart/scripts/__init__.py b/bindings/dart/scripts/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bindings/dart/scripts/__init__.py
diff --git a/bindings/dart/scripts/code_generator_dart.py b/bindings/dart/scripts/code_generator_dart.py
new file mode 100644
index 0000000..93a5f8d
--- /dev/null
+++ b/bindings/dart/scripts/code_generator_dart.py
@@ -0,0 +1,320 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Generate Blink C++ bindings (.h and .cpp files) for use by Dart:HTML.
+
+If run itself, caches Jinja templates (and creates dummy file for build,
+since cache filenames are unpredictable and opaque).
+
+This module is *not* concurrency-safe without care: bytecode caching creates
+a race condition on cache *write* (crashes if one process tries to read a
+partially-written cache). However, if you pre-cache the templates (by running
+the module itself), then you can parallelize compiling individual files, since
+cache *reading* is safe.
+
+Input: An object of class IdlDefinitions, containing an IDL interface X
+Output: DartX.h and DartX.cpp
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
+"""
+
+import os
+import cPickle as pickle
+import re
+import sys
+
+
+# Path handling for libraries and templates
+# Paths have to be normalized because Jinja uses the exact template path to
+# determine the hash used in the cache filename, and we need a pre-caching step
+# to be concurrency-safe. Use absolute path because __file__ is absolute if
+# module is imported, and relative if executed directly.
+# If paths differ between pre-caching and individual file compilation, the cache
+# is regenerated, which causes a race condition and breaks concurrent build,
+# since some compile processes will try to read the partially written cache.
+module_path, module_filename = os.path.split(os.path.realpath(__file__))
+third_party_dir = os.path.normpath(os.path.join(
+    module_path, os.pardir, os.pardir, os.pardir, os.pardir, os.pardir))
+templates_dir = os.path.normpath(os.path.join(module_path, 'templates'))
+
+# Make sure extension is .py, not .pyc or .pyo, so doesn't depend on caching
+module_pyname = os.path.splitext(module_filename)[0] + '.py'
+
+# jinja2 is in chromium's third_party directory.
+# Insert at 1 so at front to override system libraries, and
+# after path[0] == invoking script dir
+sys.path.insert(1, third_party_dir)
+
+# Add the base compiler scripts to the path here as in compiler.py
+dart_script_path = os.path.dirname(os.path.abspath(__file__))
+script_path = os.path.join(os.path.dirname(os.path.dirname(dart_script_path)),
+                          'scripts')
+sys.path.extend([script_path])
+
+import jinja2
+
+import idl_types
+from idl_types import IdlType
+import dart_callback_interface
+import dart_interface
+import dart_types
+from dart_utilities import DartUtilities
+from utilities import write_pickle_file
+from v8_globals import includes, interfaces
+
+# TODO(jacobr): remove this hacked together list.
+INTERFACES_WITHOUT_RESOLVERS = frozenset([
+    'TypeConversions',
+    'GCObservation',
+    'InternalProfilers',
+    'InternalRuntimeFlags',
+    'InternalSettings',
+    'InternalSettingsGenerated',
+    'Internals',
+    'LayerRect',
+    'LayerRectList',
+    'MallocStatistics',
+    'TypeConversions'])
+
+class CodeGeneratorDart(object):
+    def __init__(self, interfaces_info, cache_dir):
+        interfaces_info = interfaces_info or {}
+        self.interfaces_info = interfaces_info
+        self.jinja_env = initialize_jinja_env(cache_dir)
+
+        # Set global type info
+        idl_types.set_ancestors(dict(
+            (interface_name, interface_info['ancestors'])
+            for interface_name, interface_info in interfaces_info.iteritems()
+            if interface_info['ancestors']))
+        IdlType.set_callback_interfaces(set(
+            interface_name
+            for interface_name, interface_info in interfaces_info.iteritems()
+            if interface_info['is_callback_interface']))
+        IdlType.set_implemented_as_interfaces(dict(
+            (interface_name, interface_info['implemented_as'])
+            for interface_name, interface_info in interfaces_info.iteritems()
+            if interface_info['implemented_as']))
+        IdlType.set_garbage_collected_types(set(
+            interface_name
+            for interface_name, interface_info in interfaces_info.iteritems()
+            if 'GarbageCollected' in interface_info['inherited_extended_attributes']))
+        IdlType.set_will_be_garbage_collected_types(set(
+            interface_name
+            for interface_name, interface_info in interfaces_info.iteritems()
+            if 'WillBeGarbageCollected' in interface_info['inherited_extended_attributes']))
+
+    def generate_code(self, definitions, interface_name, idl_pickle_filename,
+                      only_if_changed):
+        """Returns .h/.cpp code as (header_text, cpp_text)."""
+        try:
+            interface = definitions.interfaces[interface_name]
+        except KeyError:
+            raise Exception('%s not in IDL definitions' % interface_name)
+
+        # Store other interfaces for introspection
+        interfaces.update(definitions.interfaces)
+
+        # Set local type info
+        IdlType.set_callback_functions(definitions.callback_functions.keys())
+        IdlType.set_enums((enum.name, enum.values)
+                          for enum in definitions.enumerations.values())
+
+        # Select appropriate Jinja template and contents function
+        if interface.is_callback:
+            header_template_filename = 'callback_interface_h.template'
+            cpp_template_filename = 'callback_interface_cpp.template'
+            generate_contents = dart_callback_interface.generate_callback_interface
+        else:
+            header_template_filename = 'interface_h.template'
+            cpp_template_filename = 'interface_cpp.template'
+            generate_contents = dart_interface.generate_interface
+        header_template = self.jinja_env.get_template(header_template_filename)
+        cpp_template = self.jinja_env.get_template(cpp_template_filename)
+
+        # Generate contents (input parameters for Jinja)
+        template_contents = generate_contents(interface)
+        template_contents['code_generator'] = module_pyname
+
+        # Add includes for interface itself and any dependencies
+        interface_info = self.interfaces_info[interface_name]
+        template_contents['header_includes'].add(interface_info['include_path'])
+        template_contents['header_includes'] = sorted(template_contents['header_includes'])
+        includes.update(interface_info.get('dependencies_include_paths', []))
+
+        # Remove includes that are not needed for Dart and trigger fatal
+        # compile warnings if included. These IDL files need to be
+        # imported by Dart to generate the list of events but the
+        # associated header files do not contain any code used by Dart.
+        includes.discard('core/dom/GlobalEventHandlers.h')
+        includes.discard('core/frame/DOMWindowEventHandlers.h')
+
+        template_contents['cpp_includes'] = sorted(includes)
+
+        idl_world = {'interface': None, 'callback': None}
+
+        # Load the pickle file for this IDL.
+        if os.path.isfile(idl_pickle_filename):
+            with open(idl_pickle_filename) as idl_pickle_file:
+                idl_global_data = pickle.load(idl_pickle_file)
+                idl_pickle_file.close()
+            idl_world['interface'] = idl_global_data['interface']
+            idl_world['callback'] = idl_global_data['callback']
+
+        if 'interface_name' in template_contents:
+            interface_global = {'name': template_contents['interface_name'],
+                                'parent_interface': template_contents['parent_interface'],
+                                'is_active_dom_object': template_contents['is_active_dom_object'],
+                                'is_event_target': template_contents['is_event_target'],
+                                'has_resolver': template_contents['interface_name'] not in INTERFACES_WITHOUT_RESOLVERS,
+                                'is_node': template_contents['is_node'],
+                                'conditional_string': template_contents['conditional_string'],
+                               }
+            idl_world['interface'] = interface_global
+        else:
+            callback_global = {'name': template_contents['cpp_class']}
+            idl_world['callback'] = callback_global
+
+        write_pickle_file(idl_pickle_filename,  idl_world, only_if_changed)
+
+        # Render Jinja templates
+        header_text = header_template.render(template_contents)
+        cpp_text = cpp_template.render(template_contents)
+        return header_text, cpp_text
+
+    # Generates global file for all interfaces.
+    def generate_globals(self, global_pickle_directories, output_directory):
+        header_template_filename = 'global_h.template'
+        cpp_template_filename = 'global_cpp.template'
+
+        # Delete the global pickle file we'll rebuild from each pickle generated
+        # for each IDL file '(%s_globals.pickle) % interface_name'.
+        global_pickle_filename = os.path.join(output_directory, 'global.pickle')
+        if os.path.isfile(global_pickle_filename):
+            os.remove(global_pickle_filename)
+
+        # List of all interfaces and callbacks for global code generation.
+        world = {'interfaces': [], 'callbacks': []}
+
+        # Load all pickled data for each interface.
+        for pickle_directory in global_pickle_directories:
+            listing = os.listdir(pickle_directory)
+            for filename in listing:
+                if filename.endswith('_globals.pickle'):
+                    idl_filename = os.path.join(pickle_directory, filename)
+                    with open(idl_filename) as idl_pickle_file:
+                        idl_world = pickle.load(idl_pickle_file)
+                        if 'interface' in idl_world:
+                            # FIXME: Why are some of these None?
+                            if idl_world['interface']:
+                                world['interfaces'].append(idl_world['interface'])
+                        if 'callbacks' in idl_world:
+                            # FIXME: Why are some of these None?
+                            if idl_world['callbacks']:
+                                world['callbacks'].append(idl_world['callback'])
+                        idl_pickle_file.close()
+
+        world['interfaces'] = sorted(world['interfaces'], key=lambda (x): x['name'])
+        world['callbacks'] = sorted(world['callbacks'], key=lambda (x): x['name'])
+
+        template_contents = world
+        template_contents['code_generator'] = module_pyname
+
+        header_template = self.jinja_env.get_template(header_template_filename)
+        header_text = header_template.render(template_contents)
+
+        cpp_template = self.jinja_env.get_template(cpp_template_filename)
+        cpp_text = cpp_template.render(template_contents)
+        return header_text, cpp_text
+
+
+def initialize_jinja_env(cache_dir):
+    jinja_env = jinja2.Environment(
+        loader=jinja2.FileSystemLoader(templates_dir),
+        # Bytecode cache is not concurrency-safe unless pre-cached:
+        # if pre-cached this is read-only, but writing creates a race condition.
+        # bytecode_cache=jinja2.FileSystemBytecodeCache(cache_dir),
+        keep_trailing_newline=True,  # newline-terminate generated files
+        lstrip_blocks=True,  # so can indent control flow tags
+        trim_blocks=True)
+    jinja_env.filters.update({
+        'blink_capitalize': DartUtilities.capitalize,
+        'conditional': conditional_if_endif,
+        'runtime_enabled': runtime_enabled_if,
+        })
+    return jinja_env
+
+
+# [Conditional]
+def conditional_if_endif(code, conditional_string):
+    # Jinja2 filter to generate if/endif directive blocks
+    if not conditional_string:
+        return code
+    return ('#if %s\n' % conditional_string +
+            code +
+            '#endif // %s\n' % conditional_string)
+
+
+# [RuntimeEnabled]
+def runtime_enabled_if(code, runtime_enabled_function_name):
+    if not runtime_enabled_function_name:
+        return code
+    # Indent if statement to level of original code
+    indent = re.match(' *', code).group(0)
+    return ('%sif (%s())\n' % (indent, runtime_enabled_function_name) +
+            '    %s' % code)
+
+
+################################################################################
+
+def main(argv):
+    # If file itself executed, cache templates
+    try:
+        cache_dir = argv[1]
+        dummy_filename = argv[2]
+    except IndexError as err:
+        print 'Usage: %s OUTPUT_DIR DUMMY_FILENAME' % argv[0]
+        return 1
+
+    # Cache templates
+    jinja_env = initialize_jinja_env(cache_dir)
+    template_filenames = [filename for filename in os.listdir(templates_dir)
+                          # Skip .svn, directories, etc.
+                          if filename.endswith(('.cpp', '.h', '.template'))]
+    for template_filename in template_filenames:
+        jinja_env.get_template(template_filename)
+
+    # Create a dummy file as output for the build system,
+    # since filenames of individual cache files are unpredictable and opaque
+    # (they are hashes of the template path, which varies based on environment)
+    with open(dummy_filename, 'w') as dummy_file:
+        pass  # |open| creates or touches the file
+
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
diff --git a/bindings/dart/scripts/compiler.py b/bindings/dart/scripts/compiler.py
new file mode 100755
index 0000000..1f12119
--- /dev/null
+++ b/bindings/dart/scripts/compiler.py
@@ -0,0 +1,122 @@
+#!/usr/bin/python
+# Copyright (C) 2014 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Compile an .idl file to Dart bindings (.h and .cpp files).
+
+Design doc: ??????
+"""
+
+from optparse import OptionParser
+import os
+import sys
+
+dart_script_path = os.path.dirname(os.path.abspath(__file__))
+script_path = os.path.join(os.path.dirname(os.path.dirname(dart_script_path)),
+                          'scripts')
+sys.path.extend([script_path])
+
+from dart_compiler import IdlCompiler
+from code_generator_dart import CodeGeneratorDart
+
+
+def parse_options():
+    parser = OptionParser()
+    parser.add_option('--output-directory')
+    parser.add_option('--interfaces-info-file')
+    parser.add_option('--write-file-only-if-changed', type='int', default='1')
+    parser.add_option('--generate-global', type='int')
+    parser.add_option("-p", "--global-pickle-directories",
+                      action="store",
+                      type='string',
+                      dest="global_pickle_directories",
+                      nargs=2,
+                      help="Directories to load _globals.pickle files (max 2)")
+
+    # ensure output comes last, so command line easy to parse via regexes
+    parser.disable_interspersed_args()
+
+    options, args = parser.parse_args()
+    if options.output_directory is None:
+        parser.error('Must specify output directory using --output-directory.')
+    options.write_file_only_if_changed = bool(options.write_file_only_if_changed)
+    options.generate_global = bool(options.generate_global)
+    if len(args) != 1:
+        # parser.error('Must specify exactly 1 input file as argument, but %d given.' % len(args))
+        return options, None
+    idl_filename = os.path.realpath(args[0])
+    return options, idl_filename
+
+
+def idl_filename_to_interface_name(idl_filename):
+    basename = os.path.basename(idl_filename)
+    interface_name, _ = os.path.splitext(basename)
+    return interface_name
+
+
+class IdlCompilerDart(IdlCompiler):
+    def __init__(self, *args, **kwargs):
+        IdlCompiler.__init__(self, *args, **kwargs)
+
+        interfaces_info = self.interfaces_info
+        self.output_directory = self.output_directory
+
+        self.code_generator = CodeGeneratorDart(interfaces_info, self.output_directory)
+
+    def compile_file(self, idl_filename):
+        interface_name = idl_filename_to_interface_name(idl_filename)
+        header_filename = os.path.join(self.output_directory,
+                                       'Dart%s.h' % interface_name)
+        cpp_filename = os.path.join(self.output_directory,
+                                    'Dart%s.cpp' % interface_name)
+        self.compile_and_write(idl_filename, (header_filename, cpp_filename))
+
+    def generate_global(self, global_pickle_directories):
+        global_header_filename = os.path.join(self.output_directory, 'DartWebkitClassIds.h')
+        global_cpp_filename = os.path.join(self.output_directory, 'DartWebkitClassIds.cpp')
+        self.generate_global_and_write(global_pickle_directories,
+                                       (global_header_filename, global_cpp_filename))
+
+
+def main():
+    options, idl_filename = parse_options()
+
+    if options.generate_global:
+        idl_compiler = IdlCompilerDart(options.output_directory,
+                                       interfaces_info_filename=options.interfaces_info_file,
+                                       only_if_changed=options.write_file_only_if_changed)
+        idl_compiler.generate_global(options.global_pickle_directories)
+    else:
+        idl_compiler = IdlCompilerDart(options.output_directory,
+                                       interfaces_info_filename=options.interfaces_info_file,
+                                       only_if_changed=options.write_file_only_if_changed)
+        idl_compiler.compile_file(idl_filename)
+
+
+if __name__ == '__main__':
+    sys.exit(main())
diff --git a/bindings/dart/scripts/dart_attributes.py b/bindings/dart/scripts/dart_attributes.py
new file mode 100644
index 0000000..6e295ca
--- /dev/null
+++ b/bindings/dart/scripts/dart_attributes.py
@@ -0,0 +1,459 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Generate template values for attributes.
+
+Extends IdlType with property |constructor_type_name|.
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
+"""
+
+import idl_types
+from idl_types import inherits_interface
+from dart_interface import suppress_getter, suppress_setter
+import dart_types
+from dart_utilities import DartUtilities
+from v8_globals import includes, interfaces
+
+
+def generate_attribute(interface, attribute):
+    idl_type = attribute.idl_type
+    base_idl_type = idl_type.base_type
+    extended_attributes = attribute.extended_attributes
+
+    idl_type.add_includes_for_type()
+
+    # [CheckSecurity]
+    is_check_security_for_node = 'CheckSecurity' in extended_attributes
+    if is_check_security_for_node:
+        includes.add('bindings/common/BindingSecurity.h')
+    # [Custom]
+    has_custom_getter = (('Custom' in extended_attributes and
+                          extended_attributes['Custom'] in [None, 'Getter']) or
+                         ('DartCustom' in extended_attributes and
+                          extended_attributes['DartCustom'] in [None, 'Getter', 'New']))
+    has_custom_setter = (not attribute.is_read_only and
+                         (('Custom' in extended_attributes and
+                          extended_attributes['Custom'] in [None, 'Setter']) or
+                         ('DartCustom' in extended_attributes and
+                          extended_attributes['DartCustom'] in [None, 'Setter', 'New'])))
+
+    is_call_with_script_state = DartUtilities.has_extended_attribute_value(attribute, 'CallWith', 'ScriptState')
+
+    # [CustomElementCallbacks], [Reflect]
+    is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attributes
+    is_reflect = 'Reflect' in extended_attributes
+    if is_custom_element_callbacks or is_reflect:
+        includes.add('core/dom/custom/CustomElementCallbackDispatcher.h')
+    # [RaisesException], [RaisesException=Setter]
+    is_setter_raises_exception = (
+        'RaisesException' in extended_attributes and
+        extended_attributes['RaisesException'] in [None, 'Setter'])
+    # [StrictTypeChecking]
+    has_strict_type_checking = (
+        ('StrictTypeChecking' in extended_attributes or
+         'StrictTypeChecking' in interface.extended_attributes) and
+        idl_type.is_wrapper_type)
+
+    if (base_idl_type == 'EventHandler' and
+        interface.name in ['Window', 'WorkerGlobalScope'] and
+        attribute.name == 'onerror'):
+        includes.add('bindings/v8/V8ErrorHandler.h')
+
+    is_auto_scope = not 'DartNoAutoScope' in extended_attributes
+    contents = {
+        'access_control_list': access_control_list(attribute),
+        'activity_logging_world_list_for_getter': DartUtilities.activity_logging_world_list(attribute, 'Getter'),  # [ActivityLogging]
+        'activity_logging_world_list_for_setter': DartUtilities.activity_logging_world_list(attribute, 'Setter'),  # [ActivityLogging]
+        'cached_attribute_validation_method': extended_attributes.get('CachedAttribute'),
+        'conditional_string': DartUtilities.conditional_string(attribute),
+        'constructor_type': idl_type.constructor_type_name
+                            if is_constructor_attribute(attribute) else None,
+        'cpp_name': DartUtilities.cpp_name(attribute),
+        'cpp_type': idl_type.cpp_type,
+        'deprecate_as': DartUtilities.deprecate_as(attribute),  # [DeprecateAs]
+        'enum_validation_expression': idl_type.enum_validation_expression,
+        'has_custom_getter': has_custom_getter,
+        'has_custom_setter': has_custom_setter,
+        'has_strict_type_checking': has_strict_type_checking,
+        'idl_type': str(idl_type),  # need trailing [] on array for Dictionary::ConversionContext::setConversionType
+        'is_auto_scope': is_auto_scope,
+        'auto_scope': DartUtilities.bool_to_cpp(is_auto_scope),
+        'is_call_with_execution_context': DartUtilities.has_extended_attribute_value(attribute, 'CallWith', 'ExecutionContext'),
+        'is_call_with_script_state': is_call_with_script_state,
+        'is_check_security_for_node': is_check_security_for_node,
+        'is_custom_element_callbacks': is_custom_element_callbacks,
+        'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes,
+        'is_getter_raises_exception': (  # [RaisesException]
+            'RaisesException' in extended_attributes and
+            extended_attributes['RaisesException'] in [None, 'Getter']),
+        'is_partial_interface_member':  'PartialInterfaceImplementedAs' in extended_attributes,
+        'is_initialized_by_event_constructor':
+            'InitializedByEventConstructor' in extended_attributes,
+        'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute),
+        'is_nullable': attribute.idl_type.is_nullable,
+        'is_per_world_bindings': 'PerWorldBindings' in extended_attributes,
+        'is_read_only': attribute.is_read_only,
+        'is_reflect': is_reflect,
+        'is_replaceable': 'Replaceable' in attribute.extended_attributes,
+        'is_setter_call_with_execution_context': DartUtilities.has_extended_attribute_value(attribute, 'SetterCallWith', 'ExecutionContext'),
+        'is_setter_raises_exception': is_setter_raises_exception,
+        'has_setter_exception_state': (
+            is_setter_raises_exception or has_strict_type_checking or
+            idl_type.is_integer_type),
+        'is_static': attribute.is_static,
+        'is_url': 'URL' in extended_attributes,
+        'is_unforgeable': 'Unforgeable' in extended_attributes,
+        'measure_as': DartUtilities.measure_as(attribute),  # [MeasureAs]
+        'name': attribute.name,
+        'per_context_enabled_function': DartUtilities.per_context_enabled_function_name(attribute),  # [PerContextEnabled]
+        'property_attributes': property_attributes(attribute),
+        'put_forwards': 'PutForwards' in extended_attributes,
+        'ref_ptr': 'RefPtrWillBeRawPtr' if idl_type.is_will_be_garbage_collected else 'RefPtr',
+        'reflect_empty': extended_attributes.get('ReflectEmpty'),
+        'reflect_invalid': extended_attributes.get('ReflectInvalid', ''),
+        'reflect_missing': extended_attributes.get('ReflectMissing'),
+        'reflect_only': extended_attributes['ReflectOnly'].split('|')
+            if 'ReflectOnly' in extended_attributes else None,
+        'setter_callback': setter_callback_name(interface, attribute),
+        'v8_type': dart_types.v8_type(base_idl_type),
+        'runtime_enabled_function': DartUtilities.runtime_enabled_function_name(attribute),  # [RuntimeEnabled]
+        'world_suffixes': ['', 'ForMainWorld']
+                          if 'PerWorldBindings' in extended_attributes
+                          else [''],  # [PerWorldBindings]
+    }
+
+    if is_constructor_attribute(attribute):
+        generate_constructor_getter(interface, attribute, contents)
+        return contents
+    if not has_custom_getter:
+        generate_getter(interface, attribute, contents)
+    # FIXME: We did not previously support the PutForwards attribute, so I am
+    # disabling it here for now to get things compiling.
+    # We may wish to revisit this.
+    # if ((not attribute.is_read_only or 'PutForwards' in extended_attributes)):
+    if (not attribute.is_read_only):
+        generate_setter(interface, attribute, contents)
+
+    return contents
+
+
+################################################################################
+# Getter
+################################################################################
+
+def generate_getter(interface, attribute, contents):
+    idl_type = attribute.idl_type
+    base_idl_type = idl_type.base_type
+    extended_attributes = attribute.extended_attributes
+    name = attribute.name
+
+    cpp_value = getter_expression(interface, attribute, contents)
+    # Normally we can inline the function call into the return statement to
+    # avoid the overhead of using a Ref<> temporary, but for some cases
+    # (nullable types, EventHandler, [CachedAttribute], or if there are
+    # exceptions), we need to use a local variable.
+    # FIXME: check if compilers are smart enough to inline this, and if so,
+    # always use a local variable (for readability and CG simplicity).
+    release = False
+    if (idl_type.is_nullable or
+        base_idl_type == 'EventHandler' or
+        'CachedAttribute' in extended_attributes or
+        'ReflectOnly' in extended_attributes or
+        contents['is_getter_raises_exception']):
+        contents['cpp_value_original'] = cpp_value
+        cpp_value = 'result'
+        # EventHandler has special handling
+        if base_idl_type != 'EventHandler' and idl_type.is_interface_type:
+            release = True
+
+    dart_set_return_value = \
+        idl_type.dart_set_return_value(cpp_value,
+                                       extended_attributes=extended_attributes,
+                                       script_wrappable='impl',
+                                       release=release,
+                                       for_main_world=False,
+                                       auto_scope=contents['is_auto_scope'])
+
+    # TODO(terry): Should be able to eliminate suppress_getter as we move from
+    #              IGNORE_MEMBERS to DartSuppress in the IDL.
+    suppress = (suppress_getter(interface.name, attribute.name) or
+                DartUtilities.has_extended_attribute_value(attribute, 'DartSuppress', 'Getter'))
+
+    contents.update({
+        'cpp_value': cpp_value,
+        'dart_set_return_value': dart_set_return_value,
+        'is_getter_suppressed': suppress,
+    })
+
+
+def getter_expression(interface, attribute, contents):
+    arguments = []
+    idl_type = attribute.idl_type
+    this_getter_base_name = getter_base_name(interface, attribute, arguments)
+    getter_name = DartUtilities.scoped_name(interface, attribute, this_getter_base_name)
+
+    arguments.extend(DartUtilities.call_with_arguments(attribute))
+    if ('PartialInterfaceImplementedAs' in attribute.extended_attributes and
+        not attribute.is_static):
+        # Pass by reference.
+        arguments.append('*receiver')
+
+    # TODO(jacobr): refactor has_type_checking_nullable to better match v8.
+    has_type_checking_nullable = (
+        (DartUtilities.has_extended_attribute_value(interface, 'TypeChecking', 'Nullable') or
+         DartUtilities.has_extended_attribute_value(attribute, 'TypeChecking', 'Nullable')) and
+         idl_type.is_wrapper_type)
+
+    if attribute.idl_type.is_nullable and not has_type_checking_nullable:
+        arguments.append('isNull')
+    if contents['is_getter_raises_exception']:
+        arguments.append('es')
+    return '%s(%s)' % (getter_name, ', '.join(arguments))
+
+
+CONTENT_ATTRIBUTE_GETTER_NAMES = {
+    'boolean': 'hasAttribute',
+    'long': 'getIntegralAttribute',
+    'unsigned long': 'getUnsignedIntegralAttribute',
+}
+
+
+def getter_base_name(interface, attribute, arguments):
+    extended_attributes = attribute.extended_attributes
+    if 'Reflect' not in extended_attributes:
+        return DartUtilities.uncapitalize(DartUtilities.cpp_name(attribute))
+
+    content_attribute_name = extended_attributes['Reflect'] or attribute.name.lower()
+    if content_attribute_name in ['class', 'id', 'name']:
+        # Special-case for performance optimization.
+        return 'get%sAttribute' % content_attribute_name.capitalize()
+
+    arguments.append(scoped_content_attribute_name(interface, attribute))
+
+    base_idl_type = attribute.idl_type.base_type
+    if base_idl_type in CONTENT_ATTRIBUTE_GETTER_NAMES:
+        return CONTENT_ATTRIBUTE_GETTER_NAMES[base_idl_type]
+    if 'URL' in attribute.extended_attributes:
+        return 'getURLAttribute'
+    return 'getAttribute'
+
+
+def is_keep_alive_for_gc(interface, attribute):
+    idl_type = attribute.idl_type
+    base_idl_type = idl_type.base_type
+    extended_attributes = attribute.extended_attributes
+    return (
+        # For readonly attributes, for performance reasons we keep the attribute
+        # wrapper alive while the owner wrapper is alive, because the attribute
+        # never changes.
+        (attribute.is_read_only and
+         idl_type.is_wrapper_type and
+         # There are some exceptions, however:
+         not(
+             # Node lifetime is managed by object grouping.
+             inherits_interface(interface.name, 'Node') or
+             inherits_interface(base_idl_type, 'Node') or
+             # A self-reference is unnecessary.
+             attribute.name == 'self' or
+             # FIXME: Remove these hard-coded hacks.
+             base_idl_type in ['EventTarget', 'Window'] or
+             base_idl_type.startswith(('HTML', 'SVG')))))
+
+
+################################################################################
+# Setter
+################################################################################
+
+def generate_setter(interface, attribute, contents):
+    def target_attribute():
+        target_interface_name = attribute.idl_type.base_type
+        target_attribute_name = extended_attributes['PutForwards']
+        target_interface = interfaces[target_interface_name]
+        try:
+            return next(attribute
+                        for attribute in target_interface.attributes
+                        if attribute.name == target_attribute_name)
+        except StopIteration:
+            raise Exception('[PutForward] target not found:\n'
+                            'Attribute "%s" is not present in interface "%s"' %
+                            (target_attribute_name, target_interface_name))
+
+    extended_attributes = attribute.extended_attributes
+    interface_extended_attributes = interface.extended_attributes
+
+    if 'PutForwards' in extended_attributes:
+        # Use target attribute in place of original attribute
+        attribute = target_attribute()
+        this_cpp_type = 'DartStringAdapter'
+    else:
+        this_cpp_type = contents['cpp_type']
+
+    idl_type = attribute.idl_type
+
+    # TODO(terry): Should be able to eliminate suppress_setter as we move from
+    #              IGNORE_MEMBERS to DartSuppress in the IDL.
+    suppress = (suppress_setter(interface.name, attribute.name) or
+                DartUtilities.has_extended_attribute_value(attribute, 'DartSuppress', 'Setter'))
+    contents.update({
+        'is_setter_suppressed':  suppress,
+        'setter_lvalue': dart_types.check_reserved_name(attribute.name),
+        'cpp_type': this_cpp_type,
+        'local_cpp_type': idl_type.cpp_type_args(attribute.extended_attributes, used_as_argument=True),
+        'cpp_setter': setter_expression(interface, attribute, contents),
+        'dart_value_to_local_cpp_value':
+            attribute.idl_type.dart_value_to_local_cpp_value(
+                interface_extended_attributes, extended_attributes, attribute.name, False, 1,
+                contents['is_auto_scope']),
+    })
+
+
+def setter_expression(interface, attribute, contents):
+    extended_attributes = attribute.extended_attributes
+    arguments = DartUtilities.call_with_arguments(attribute, extended_attributes.get('SetterCallWith'))
+
+    this_setter_base_name = setter_base_name(interface, attribute, arguments)
+    setter_name = DartUtilities.scoped_name(interface, attribute, this_setter_base_name)
+
+    if ('PartialInterfaceImplementedAs' in extended_attributes and
+        not attribute.is_static):
+        arguments.append('*receiver')
+    idl_type = attribute.idl_type
+    if idl_type.base_type == 'EventHandler':
+        getter_name = DartUtilities.scoped_name(interface, attribute, DartUtilities.cpp_name(attribute))
+        contents['event_handler_getter_expression'] = '%s(%s)' % (
+            getter_name, ', '.join(arguments))
+        # FIXME(vsm): Do we need to support this? If so, what's our analogue of
+        # V8EventListenerList?
+        arguments.append('nullptr')
+        # if (interface.name in ['Window', 'WorkerGlobalScope'] and
+        #    attribute.name == 'onerror'):
+        #    includes.add('bindings/v8/V8ErrorHandler.h')
+        #    arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHandler>(jsValue, true, info.GetIsolate())')
+        # else:
+        #    arguments.append('V8EventListenerList::getEventListener(jsValue, true, ListenerFindOrCreate)')
+    else:
+        attribute_name = dart_types.check_reserved_name(attribute.name)
+        arguments.append(attribute_name)
+    if contents['is_setter_raises_exception']:
+        arguments.append('es')
+
+    return '%s(%s)' % (setter_name, ', '.join(arguments))
+
+
+CONTENT_ATTRIBUTE_SETTER_NAMES = {
+    'boolean': 'setBooleanAttribute',
+    'long': 'setIntegralAttribute',
+    'unsigned long': 'setUnsignedIntegralAttribute',
+}
+
+
+def setter_base_name(interface, attribute, arguments):
+    if 'Reflect' not in attribute.extended_attributes:
+        return 'set%s' % DartUtilities.capitalize(DartUtilities.cpp_name(attribute))
+    arguments.append(scoped_content_attribute_name(interface, attribute))
+
+    base_idl_type = attribute.idl_type.base_type
+    if base_idl_type in CONTENT_ATTRIBUTE_SETTER_NAMES:
+        return CONTENT_ATTRIBUTE_SETTER_NAMES[base_idl_type]
+    return 'setAttribute'
+
+
+def scoped_content_attribute_name(interface, attribute):
+    content_attribute_name = attribute.extended_attributes['Reflect'] or attribute.name.lower()
+    namespace = 'SVGNames' if interface.name.startswith('SVG') else 'HTMLNames'
+    includes.add('%s.h' % namespace)
+    return 'WebCore::%s::%sAttr' % (namespace, content_attribute_name)
+
+
+################################################################################
+# Attribute configuration
+################################################################################
+
+# [Replaceable]
+def setter_callback_name(interface, attribute):
+    cpp_class_name = DartUtilities.cpp_name(interface)
+    extended_attributes = attribute.extended_attributes
+    if (('Replaceable' in extended_attributes and
+         'PutForwards' not in extended_attributes) or
+        is_constructor_attribute(attribute)):
+        # FIXME: rename to ForceSetAttributeOnThisCallback, since also used for Constructors
+        return '{0}V8Internal::{0}ReplaceableAttributeSetterCallback'.format(cpp_class_name)
+    # FIXME:disabling PutForwards for now since we didn't support it before
+    #    if attribute.is_read_only and 'PutForwards' not in extended_attributes:
+    if attribute.is_read_only:
+        return '0'
+    return '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_name, attribute.name)
+
+
+# [DoNotCheckSecurity], [Unforgeable]
+def access_control_list(attribute):
+    extended_attributes = attribute.extended_attributes
+    access_control = []
+    if 'DoNotCheckSecurity' in extended_attributes:
+        do_not_check_security = extended_attributes['DoNotCheckSecurity']
+        if do_not_check_security == 'Setter':
+            access_control.append('v8::ALL_CAN_WRITE')
+        else:
+            access_control.append('v8::ALL_CAN_READ')
+            if (not attribute.is_read_only or
+                'Replaceable' in extended_attributes):
+                access_control.append('v8::ALL_CAN_WRITE')
+    if 'Unforgeable' in extended_attributes:
+        access_control.append('v8::PROHIBITS_OVERWRITING')
+    return access_control or ['v8::DEFAULT']
+
+
+# [NotEnumerable], [Unforgeable]
+def property_attributes(attribute):
+    extended_attributes = attribute.extended_attributes
+    property_attributes_list = []
+    if ('NotEnumerable' in extended_attributes or
+        is_constructor_attribute(attribute)):
+        property_attributes_list.append('v8::DontEnum')
+    if 'Unforgeable' in extended_attributes:
+        property_attributes_list.append('v8::DontDelete')
+    return property_attributes_list or ['v8::None']
+
+
+################################################################################
+# Constructors
+################################################################################
+
+idl_types.IdlType.constructor_type_name = property(
+    # FIXME: replace this with a [ConstructorAttribute] extended attribute
+    lambda self: DartUtilities.strip_suffix(self.base_type, 'Constructor'))
+
+
+def is_constructor_attribute(attribute):
+    # FIXME: replace this with [ConstructorAttribute] extended attribute
+    return attribute.idl_type.base_type.endswith('Constructor')
+
+
+def generate_constructor_getter(interface, attribute, contents):
+    contents['needs_constructor_getter_callback'] = contents['measure_as'] or contents['deprecate_as']
diff --git a/bindings/dart/scripts/dart_callback_interface.py b/bindings/dart/scripts/dart_callback_interface.py
new file mode 100644
index 0000000..9fb0cea
--- /dev/null
+++ b/bindings/dart/scripts/dart_callback_interface.py
@@ -0,0 +1,132 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Generate template values for a callback interface.
+
+Extends IdlType with property |callback_cpp_type|.
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
+"""
+
+from idl_types import IdlType
+import dart_types
+from dart_utilities import DartUtilities
+from v8_globals import includes
+
+CALLBACK_INTERFACE_H_INCLUDES = frozenset([
+    'bindings/dart/DartCallback.h',
+    'bindings/dart/DartDOMWrapper.h',
+    'bindings/v8/ActiveDOMCallback.h',
+])
+CALLBACK_INTERFACE_CPP_INCLUDES = frozenset([
+    'bindings/dart/DartBindingsCommonIncludes.h',
+    'wtf/GetPtr.h',
+    'wtf/RefPtr.h',
+])
+
+def cpp_type(idl_type):
+    # FIXME: remove this function by making callback types consistent
+    # (always use usual v8_types.cpp_type)
+    idl_type_name = idl_type.name
+    if idl_type_name == 'String':
+        return 'const String&'
+    if idl_type_name == 'void':
+        return 'void'
+    # Callbacks use raw pointers, so used_as_argument=True
+    usual_cpp_type = idl_type.cpp_type_args(used_as_argument=True)
+    if usual_cpp_type.startswith(('Vector', 'HeapVector', 'WillBeHeapVector')):
+        return 'const %s&' % usual_cpp_type
+    return usual_cpp_type
+
+IdlType.callback_cpp_type = property(cpp_type)
+
+
+def generate_callback_interface(callback_interface):
+    includes.clear()
+    includes.update(CALLBACK_INTERFACE_CPP_INCLUDES)
+    name = callback_interface.name
+
+    methods = [generate_method(operation)
+               for operation in callback_interface.operations]
+    template_contents = {
+        'conditional_string': DartUtilities.conditional_string(callback_interface),
+        'cpp_class': name,
+        'dart_class': dart_types.dart_type(callback_interface.name),
+        'v8_class': DartUtilities.v8_class_name(callback_interface),
+        'header_includes': set(CALLBACK_INTERFACE_H_INCLUDES),
+        'methods': methods,
+    }
+    return template_contents
+
+
+def add_includes_for_operation(operation):
+    operation.idl_type.add_includes_for_type()
+    for argument in operation.arguments:
+        argument.idl_type.add_includes_for_type()
+
+
+def generate_method(operation):
+    extended_attributes = operation.extended_attributes
+    idl_type = operation.idl_type
+    idl_type_str = str(idl_type)
+    if idl_type_str not in ['boolean', 'void']:
+        raise Exception('We only support callbacks that return boolean or void values.')
+    is_custom = 'Custom' in extended_attributes
+    if not is_custom:
+        add_includes_for_operation(operation)
+    call_with = extended_attributes.get('CallWith')
+    call_with_this_handle = DartUtilities.extended_attribute_value_contains(call_with, 'ThisValue')
+    contents = {
+        'call_with_this_handle': call_with_this_handle,
+        'cpp_type': idl_type.callback_cpp_type,
+        'custom': is_custom,
+        'idl_type': idl_type_str,
+        'name': operation.name,
+    }
+    contents.update(generate_arguments_contents(operation.arguments, call_with_this_handle))
+    return contents
+
+
+def generate_arguments_contents(arguments, call_with_this_handle):
+    def generate_argument(argument):
+        creation_context = '<Dart%s>' % argument.idl_type.base_type
+        return {
+            'handle': '%sHandle' % argument.name,
+            'cpp_value_to_dart_value': argument.idl_type.cpp_value_to_dart_value(argument.name,
+                                                                                 creation_context=creation_context),
+        }
+
+    argument_declarations = [
+            '%s %s' % (argument.idl_type.callback_cpp_type, argument.name)
+            for argument in arguments]
+    if call_with_this_handle:
+        argument_declarations.insert(0, 'ScriptValue thisValue')
+    return  {
+        'argument_declarations': argument_declarations,
+        'arguments': [generate_argument(argument) for argument in arguments],
+    }
diff --git a/bindings/dart/scripts/dart_compiler.py b/bindings/dart/scripts/dart_compiler.py
new file mode 100755
index 0000000..83457d0
--- /dev/null
+++ b/bindings/dart/scripts/dart_compiler.py
@@ -0,0 +1,131 @@
+#!/usr/bin/python
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Compile an .idl file to Blink C++ bindings (.h and .cpp files) for Dart:HTML.
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
+"""
+
+import abc
+from optparse import OptionParser
+import os
+import cPickle as pickle
+
+from idl_reader import IdlReader
+from utilities import write_file
+
+
+# TODO(terry): Temporary whitelist of IDL files to skip code generating. e.g.,
+#              adding 'Animation.idl' to this list will skip that IDL file.
+SKIP_IDL_FILES = ['']
+
+
+def parse_options():
+    parser = OptionParser()
+    parser.add_option('--idl-attributes-file',
+                      help="location of bindings/IDLExtendedAttributes.txt")
+    parser.add_option('--output-directory')
+    parser.add_option('--interfaces-info-file')
+    parser.add_option('--write-file-only-if-changed', type='int')
+    # ensure output comes last, so command line easy to parse via regexes
+    parser.disable_interspersed_args()
+
+    options, args = parser.parse_args()
+    if options.output_directory is None:
+        parser.error('Must specify output directory using --output-directory.')
+    options.write_file_only_if_changed = bool(options.write_file_only_if_changed)
+    if len(args) != 1:
+        parser.error('Must specify exactly 1 input file as argument, but %d given.' % len(args))
+    idl_filename = os.path.realpath(args[0])
+    return options, idl_filename
+
+
+def idl_filename_to_interface_name(idl_filename):
+    basename = os.path.basename(idl_filename)
+    interface_name, _ = os.path.splitext(basename)
+    return interface_name
+
+
+class IdlCompiler(object):
+    """Abstract Base Class for IDL compilers.
+
+    In concrete classes:
+    * self.code_generator must be set, implementing generate_code()
+      (returning a list of output code), and
+    * compile_file() must be implemented (handling output filenames).
+    """
+    __metaclass__ = abc.ABCMeta
+
+    def __init__(self, output_directory, code_generator=None,
+                 interfaces_info=None, interfaces_info_filename='',
+                 only_if_changed=False):
+        """
+        Args:
+            interfaces_info:
+                interfaces_info dict
+                (avoids auxiliary file in run-bindings-tests)
+            interfaces_info_file: filename of pickled interfaces_info
+        """
+        self.code_generator = code_generator
+        if interfaces_info_filename:
+            with open(interfaces_info_filename) as interfaces_info_file:
+                interfaces_info = pickle.load(interfaces_info_file)
+        self.interfaces_info = interfaces_info
+
+        self.only_if_changed = only_if_changed
+        self.output_directory = output_directory
+        self.reader = IdlReader(interfaces_info, output_directory)
+
+    def compile_and_write(self, idl_filename, output_filenames):
+        interface_name = idl_filename_to_interface_name(idl_filename)
+        idl_pickle_filename = os.path.join(self.output_directory,
+                                           '%s_globals.pickle' % interface_name)
+        definitions = self.reader.read_idl_definitions(idl_filename)
+        output_code_list = self.code_generator.generate_code(definitions,
+                                                             interface_name,
+                                                             idl_pickle_filename,
+                                                             self.only_if_changed)
+
+        # TODO(terry): Temporary to disable code generating an IDL.
+        base_idl_filename = os.path.basename(idl_filename)
+        if base_idl_filename in SKIP_IDL_FILES:
+            print "----- Skipping %s -----" % base_idl_filename
+        else:
+            for output_code, output_filename in zip(output_code_list, output_filenames):
+                write_file(output_code, output_filename, self.only_if_changed)
+
+    def generate_global_and_write(self, global_pickle_directories, output_filenames):
+        output_code_list = self.code_generator.generate_globals(global_pickle_directories,
+                                                                self.output_directory)
+        for output_code, output_filename in zip(output_code_list, output_filenames):
+            write_file(output_code, output_filename, self.only_if_changed)
+
+    @abc.abstractmethod
+    def compile_file(self, idl_filename):
+        pass
diff --git a/bindings/dart/scripts/dart_interface.py b/bindings/dart/scripts/dart_interface.py
new file mode 100644
index 0000000..540c3ac
--- /dev/null
+++ b/bindings/dart/scripts/dart_interface.py
@@ -0,0 +1,1151 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Generate template values for an interface.
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
+"""
+
+from collections import defaultdict
+
+import idl_types
+from idl_types import IdlType, inherits_interface
+import dart_attributes
+import dart_methods
+import dart_types
+from dart_utilities import DartUtilities
+from v8_globals import includes
+
+
+INTERFACE_H_INCLUDES = frozenset([
+    'bindings/dart/DartDOMWrapper.h',
+    'platform/heap/Handle.h',
+])
+
+INTERFACE_CPP_INCLUDES = frozenset([
+    'DartUtilities.h',
+    'wtf/GetPtr.h',
+    'wtf/RefPtr.h',
+])
+
+
+# TODO(terry): Temporary to not generate a method, getter/setter. Format is:
+#
+#               interface_name.method_name
+#               interface_name.get:attribute_name
+#               interface_name.set:attribute_name
+#
+#               Ultimate solution add a special attribute flag to IDL to signal
+#               don't generate IDL entry in Dart (e.g., DartNoGenerate)?
+IGNORE_MEMBERS = frozenset([
+    'AudioBufferSourceNode.looping',  # TODO(vsm): Use deprecated IDL annotation
+    'CSSStyleDeclaration.getPropertyCSSValue',
+    'CanvasRenderingContext2D.clearShadow',
+    'CanvasRenderingContext2D.drawImageFromRect',
+    'CanvasRenderingContext2D.setAlpha',
+    'CanvasRenderingContext2D.setCompositeOperation',
+    'CanvasRenderingContext2D.setFillColor',
+    'CanvasRenderingContext2D.setLineCap',
+    'CanvasRenderingContext2D.setLineJoin',
+    'CanvasRenderingContext2D.setLineWidth',
+    'CanvasRenderingContext2D.setMiterLimit',
+    'CanvasRenderingContext2D.setShadow',
+    'CanvasRenderingContext2D.setStrokeColor',
+    'CharacterData.remove',
+    'Window.call:blur',
+    'Window.call:focus',
+    'Window.clientInformation',
+    'Window.createImageBitmap',
+    'Window.get:frames',
+    'Window.get:length',
+    'Window.on:beforeUnload',
+    'Window.on:webkitTransitionEnd',
+    'Window.pagePopupController',
+    'Window.prompt',
+    'Window.webkitCancelAnimationFrame',
+    'Window.webkitCancelRequestAnimationFrame',
+    'Window.webkitIndexedDB',
+    'Window.webkitRequestAnimationFrame',
+    'Document.alinkColor',
+    'HTMLDocument.all',
+    'Document.applets',
+    'Document.bgColor',
+    'Document.clear',
+    'Document.createAttribute',
+    'Document.createAttributeNS',
+    'Document.createComment',
+    'Document.createExpression',
+    'Document.createNSResolver',
+    'Document.createProcessingInstruction',
+    'Document.designMode',
+    'Document.dir',
+    'Document.evaluate',
+    'Document.fgColor',
+    'Document.get:URL',
+    'Document.get:anchors',
+    'Document.get:characterSet',
+    'Document.get:compatMode',
+    'Document.get:defaultCharset',
+    'Document.get:doctype',
+    'Document.get:documentURI',
+    'Document.get:embeds',
+    'Document.get:forms',
+    'Document.get:inputEncoding',
+    'Document.get:links',
+    'Document.get:plugins',
+    'Document.get:scripts',
+    'Document.get:xmlEncoding',
+    'Document.getElementsByTagNameNS',
+    'Document.getOverrideStyle',
+    'Document.getSelection',
+    'Document.images',
+    'Document.linkColor',
+    'Document.location',
+    'Document.on:wheel',
+    'Document.open',
+    'Document.register',
+    'Document.set:domain',
+    'Document.vlinkColor',
+    'Document.webkitCurrentFullScreenElement',
+    'Document.webkitFullScreenKeyboardInputAllowed',
+    'Document.write',
+    'Document.writeln',
+    'Document.xmlStandalone',
+    'Document.xmlVersion',
+    'DocumentFragment.children',
+    'DocumentType.*',
+    'DOMException.code',
+    'DOMException.ABORT_ERR',
+    'DOMException.DATA_CLONE_ERR',
+    'DOMException.DOMSTRING_SIZE_ERR',
+    'DOMException.HIERARCHY_REQUEST_ERR',
+    'DOMException.INDEX_SIZE_ERR',
+    'DOMException.INUSE_ATTRIBUTE_ERR',
+    'DOMException.INVALID_ACCESS_ERR',
+    'DOMException.INVALID_CHARACTER_ERR',
+    'DOMException.INVALID_MODIFICATION_ERR',
+    'DOMException.INVALID_NODE_TYPE_ERR',
+    'DOMException.INVALID_STATE_ERR',
+    'DOMException.NAMESPACE_ERR',
+    'DOMException.NETWORK_ERR',
+    'DOMException.NOT_FOUND_ERR',
+    'DOMException.NOT_SUPPORTED_ERR',
+    'DOMException.NO_DATA_ALLOWED_ERR',
+    'DOMException.NO_MODIFICATION_ALLOWED_ERR',
+    'DOMException.QUOTA_EXCEEDED_ERR',
+    'DOMException.SECURITY_ERR',
+    'DOMException.SYNTAX_ERR',
+    'DOMException.TIMEOUT_ERR',
+    'DOMException.TYPE_MISMATCH_ERR',
+    'DOMException.URL_MISMATCH_ERR',
+    'DOMException.VALIDATION_ERR',
+    'DOMException.WRONG_DOCUMENT_ERR',
+    'Element.accessKey',
+    'Element.dataset',
+    'Element.get:classList',
+    'Element.getAttributeNode',
+    'Element.getAttributeNodeNS',
+    'Element.getElementsByTagNameNS',
+    'Element.innerText',
+    'Element.on:wheel',
+    'Element.outerText',
+    'Element.removeAttributeNode',
+    'Element.set:outerHTML',
+    'Element.setAttributeNode',
+    'Element.setAttributeNodeNS',
+    'Element.webkitCreateShadowRoot',
+    'Element.webkitMatchesSelector',
+    'Element.webkitPseudo',
+    'Element.webkitShadowRoot',
+    '=Event.returnValue',  # Only suppress on Event, allow for BeforeUnloadEvent.
+    'Event.srcElement',
+    'EventSource.URL',
+    'FontFace.ready',
+    'FontFaceSet.load',
+    'FontFaceSet.ready',
+    'HTMLAnchorElement.charset',
+    'HTMLAnchorElement.coords',
+    'HTMLAnchorElement.rev',
+    'HTMLAnchorElement.shape',
+    'HTMLAnchorElement.text',
+    'HTMLAppletElement.*',
+    'HTMLAreaElement.noHref',
+    'HTMLBRElement.clear',
+    'HTMLBaseFontElement.*',
+    'HTMLBodyElement.aLink',
+    'HTMLBodyElement.background',
+    'HTMLBodyElement.bgColor',
+    'HTMLBodyElement.link',
+    'HTMLBodyElement.on:beforeUnload',
+    'HTMLBodyElement.text',
+    'HTMLBodyElement.vLink',
+    'HTMLDListElement.compact',
+    'HTMLDirectoryElement.*',
+    'HTMLDivElement.align',
+    'HTMLFontElement.*',
+    'HTMLFormControlsCollection.__getter__',
+    'HTMLFormElement.get:elements',
+    'HTMLFrameElement.*',
+    'HTMLFrameSetElement.*',
+    'HTMLHRElement.align',
+    'HTMLHRElement.noShade',
+    'HTMLHRElement.size',
+    'HTMLHRElement.width',
+    'HTMLHeadElement.profile',
+    'HTMLHeadingElement.align',
+    'HTMLHtmlElement.manifest',
+    'HTMLHtmlElement.version',
+    'HTMLIFrameElement.align',
+    'HTMLIFrameElement.frameBorder',
+    'HTMLIFrameElement.longDesc',
+    'HTMLIFrameElement.marginHeight',
+    'HTMLIFrameElement.marginWidth',
+    'HTMLIFrameElement.scrolling',
+    'HTMLImageElement.align',
+    'HTMLImageElement.hspace',
+    'HTMLImageElement.longDesc',
+    'HTMLImageElement.name',
+    'HTMLImageElement.vspace',
+    'HTMLInputElement.align',
+    'HTMLLegendElement.align',
+    'HTMLLinkElement.charset',
+    'HTMLLinkElement.rev',
+    'HTMLLinkElement.target',
+    'HTMLMarqueeElement.*',
+    'HTMLMenuElement.compact',
+    'HTMLMetaElement.scheme',
+    'HTMLOListElement.compact',
+    'HTMLObjectElement.align',
+    'HTMLObjectElement.archive',
+    'HTMLObjectElement.border',
+    'HTMLObjectElement.codeBase',
+    'HTMLObjectElement.codeType',
+    'HTMLObjectElement.declare',
+    'HTMLObjectElement.hspace',
+    'HTMLObjectElement.standby',
+    'HTMLObjectElement.vspace',
+    'HTMLOptionElement.text',
+    'HTMLOptionsCollection.*',
+    'HTMLParagraphElement.align',
+    'HTMLParamElement.type',
+    'HTMLParamElement.valueType',
+    'HTMLPreElement.width',
+    'HTMLScriptElement.text',
+    'HTMLSelectElement.options',
+    'HTMLSelectElement.selectedOptions',
+    'HTMLTableCaptionElement.align',
+    'HTMLTableCellElement.abbr',
+    'HTMLTableCellElement.align',
+    'HTMLTableCellElement.axis',
+    'HTMLTableCellElement.bgColor',
+    'HTMLTableCellElement.ch',
+    'HTMLTableCellElement.chOff',
+    'HTMLTableCellElement.height',
+    'HTMLTableCellElement.noWrap',
+    'HTMLTableCellElement.scope',
+    'HTMLTableCellElement.vAlign',
+    'HTMLTableCellElement.width',
+    'HTMLTableColElement.align',
+    'HTMLTableColElement.ch',
+    'HTMLTableColElement.chOff',
+    'HTMLTableColElement.vAlign',
+    'HTMLTableColElement.width',
+    'HTMLTableElement.align',
+    'HTMLTableElement.bgColor',
+    'HTMLTableElement.cellPadding',
+    'HTMLTableElement.cellSpacing',
+    'HTMLTableElement.frame',
+    'HTMLTableElement.rules',
+    'HTMLTableElement.summary',
+    'HTMLTableElement.width',
+    'HTMLTableRowElement.align',
+    'HTMLTableRowElement.bgColor',
+    'HTMLTableRowElement.ch',
+    'HTMLTableRowElement.chOff',
+    'HTMLTableRowElement.vAlign',
+    'HTMLTableSectionElement.align',
+    'HTMLTableSectionElement.ch',
+    'HTMLTableSectionElement.chOff',
+    'HTMLTableSectionElement.vAlign',
+    'HTMLTitleElement.text',
+    'HTMLUListElement.compact',
+    'HTMLUListElement.type',
+    'Location.valueOf',
+    'MessageEvent.ports',
+    'MessageEvent.webkitInitMessageEvent',
+    'MouseEvent.x',
+    'MouseEvent.y',
+    'Navigator.registerServiceWorker',
+    'Navigator.unregisterServiceWorker',
+    'Node.compareDocumentPosition',
+    'Node.get:DOCUMENT_POSITION_CONTAINED_BY',
+    'Node.get:DOCUMENT_POSITION_CONTAINS',
+    'Node.get:DOCUMENT_POSITION_DISCONNECTED',
+    'Node.get:DOCUMENT_POSITION_FOLLOWING',
+    'Node.get:DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC',
+    'Node.get:DOCUMENT_POSITION_PRECEDING',
+    'Node.get:prefix',
+    'Node.hasAttributes',
+    'Node.isDefaultNamespace',
+    'Node.isEqualNode',
+    'Node.isSameNode',
+    'Node.isSupported',
+    'Node.lookupNamespaceURI',
+    'Node.lookupPrefix',
+    'Node.normalize',
+    'Node.set:nodeValue',
+    'NodeFilter.acceptNode',
+    'NodeIterator.expandEntityReferences',
+    'NodeIterator.filter',
+    'Performance.webkitClearMarks',
+    'Performance.webkitClearMeasures',
+    'Performance.webkitGetEntries',
+    'Performance.webkitGetEntriesByName',
+    'Performance.webkitGetEntriesByType',
+    'Performance.webkitMark',
+    'Performance.webkitMeasure',
+    'ShadowRoot.getElementsByTagNameNS',
+    'SVGElement.getPresentationAttribute',
+    'SVGElementInstance.on:wheel',
+    'WheelEvent.wheelDelta',
+    'Window.on:wheel',
+    'WindowEventHandlers.on:beforeUnload',
+    'WorkerGlobalScope.webkitIndexedDB',
+# TODO(jacobr): should these be removed?
+    'Document.close',
+    'Document.hasFocus',
+])
+
+
+def _suppress_method(interface_name, name):
+    name_to_find = '%s.%s' % (interface_name, name)
+    wildcard_name_to_find = '%s.*' % interface_name
+    return name_to_find in IGNORE_MEMBERS or wildcard_name_to_find in IGNORE_MEMBERS
+
+
+# Both getter and setter are to be suppressed then the attribute is completely
+# disappear.
+def _suppress_attribute(interface_name, name):
+    return (suppress_getter(interface_name, name) and suppress_setter(interface_name, name))
+
+
+def suppress_getter(interface_name, name):
+    name_to_find = '%s.get:%s' % (interface_name, name)
+    wildcard_getter_to_find = '%s.get:*' % interface_name
+    return (name_to_find in IGNORE_MEMBERS or
+            _suppress_method(interface_name, name) or
+            wildcard_getter_to_find in IGNORE_MEMBERS)
+
+
+def suppress_setter(interface_name, name):
+    name_to_find = '%s.set:%s' % (interface_name, name)
+    wildcard_setter_to_find = '%s.set:*' % interface_name
+    return (name_to_find in IGNORE_MEMBERS or
+            _suppress_method(interface_name, name) or
+            wildcard_setter_to_find in IGNORE_MEMBERS)
+
+
+# To suppress an IDL method or attribute with a particular Extended Attribute
+# w/o a value e.g, StrictTypeChecking would be an empty set
+#   'StrictTypeChecking': frozenset([]),
+IGNORE_EXTENDED_ATTRIBUTES = {
+#    'RuntimeEnabled': frozenset(['ExperimentalCanvasFeatures']),
+}
+
+
+# Return True if the method / attribute should be suppressed.
+def _suppress_extended_attributes(extended_attributes):
+    if 'DartSuppress' in extended_attributes and extended_attributes.get('DartSuppress') == None:
+        return True
+
+    # TODO(terry): Eliminate this using DartSuppress extended attribute in the
+    #              IDL files instead of the IGNORE_EXTENDED_ATTRIBUTES list.
+    for extended_attribute_name in extended_attributes:
+        ignore_extended_values = IGNORE_EXTENDED_ATTRIBUTES.get(extended_attribute_name)
+        if ignore_extended_values != None:
+            extended_attribute_value = extended_attributes.get(extended_attribute_name)
+            if ((not ignore_extended_values and extended_attribute_value == None) or
+                extended_attribute_value in ignore_extended_values):
+                return True
+    return False
+
+
+def generate_interface(interface):
+    includes.clear()
+    includes.update(INTERFACE_CPP_INCLUDES)
+    header_includes = set(INTERFACE_H_INCLUDES)
+
+    parent_interface = interface.parent
+    if parent_interface:
+        header_includes.update(dart_types.includes_for_interface(parent_interface))
+    extended_attributes = interface.extended_attributes
+
+    is_audio_buffer = inherits_interface(interface.name, 'AudioBuffer')
+    if is_audio_buffer:
+        includes.add('modules/webaudio/AudioBuffer.h')
+
+    is_document = inherits_interface(interface.name, 'Document')
+    if is_document:
+        # FIXME(vsm): We probably need bindings/dart/DartController and
+        # core/frame/LocalFrame.h here.
+        includes.update(['DartDocument.h'])
+
+    if inherits_interface(interface.name, 'DataTransferItemList'):
+        # FIXME(jacobr): this is a hack.
+        includes.update(['core/html/HTMLCollection.h'])
+
+
+    if inherits_interface(interface.name, 'EventTarget'):
+        includes.update(['DartEventListener.h'])
+
+    # [ActiveDOMObject]
+    is_active_dom_object = 'ActiveDOMObject' in extended_attributes
+
+    # [CheckSecurity]
+    is_check_security = 'CheckSecurity' in extended_attributes
+    if is_check_security:
+        includes.add('bindings/common/BindingSecurity.h')
+
+    # [DependentLifetime]
+    is_dependent_lifetime = 'DependentLifetime' in extended_attributes
+
+    # [MeasureAs]
+# TODO(terry): Remove Me?
+#    is_measure_as = 'MeasureAs' in extended_attributes
+#    if is_measure_as:
+#        includes.add('core/frame/UseCounter.h')
+
+    # [SetWrapperReferenceFrom]
+    reachable_node_function = extended_attributes.get('SetWrapperReferenceFrom')
+    if reachable_node_function:
+        # FIXME(vsm): We may need bindings/dart/DartGCController.h instead.
+        includes.update(['bindings/v8/V8GCController.h',
+                         'core/dom/Element.h'])
+
+    # [SetWrapperReferenceTo]
+    set_wrapper_reference_to_list = [{
+        'name': argument.name,
+        # FIXME: properly should be:
+        # 'cpp_type': argument.idl_type.cpp_type_args(used_as_argument=True),
+        # (if type is non-wrapper type like NodeFilter, normally RefPtr)
+        # Raw pointers faster though, and NodeFilter hacky anyway.
+        'cpp_type': argument.idl_type.implemented_as + '*',
+        'idl_type': argument.idl_type,
+        'v8_type': dart_types.v8_type(argument.idl_type.name),
+    } for argument in extended_attributes.get('SetWrapperReferenceTo', [])]
+    for set_wrapper_reference_to in set_wrapper_reference_to_list:
+        set_wrapper_reference_to['idl_type'].add_includes_for_type()
+
+    # [SpecialWrapFor]
+    if 'SpecialWrapFor' in extended_attributes:
+        special_wrap_for = extended_attributes['SpecialWrapFor'].split('|')
+    else:
+        special_wrap_for = []
+    for special_wrap_interface in special_wrap_for:
+        dart_types.add_includes_for_interface(special_wrap_interface)
+
+    # [Custom=Wrap], [SetWrapperReferenceFrom]
+    has_visit_dom_wrapper = (
+        DartUtilities.has_extended_attribute_value(interface, 'Custom', 'VisitDOMWrapper') or
+        reachable_node_function or
+        set_wrapper_reference_to_list)
+
+    this_gc_type = DartUtilities.gc_type(interface)
+
+    template_contents = {
+        'conditional_string': DartUtilities.conditional_string(interface),  # [Conditional]
+        'cpp_class': DartUtilities.cpp_name(interface),
+        'gc_type': this_gc_type,
+        'has_custom_legacy_call_as_function': DartUtilities.has_extended_attribute_value(interface, 'Custom', 'LegacyCallAsFunction'),  # [Custom=LegacyCallAsFunction]
+        'has_custom_to_v8': DartUtilities.has_extended_attribute_value(interface, 'Custom', 'ToV8'),  # [Custom=ToV8]
+        'has_custom_wrap': DartUtilities.has_extended_attribute_value(interface, 'Custom', 'Wrap'),  # [Custom=Wrap]
+        'has_visit_dom_wrapper': has_visit_dom_wrapper,
+        'header_includes': header_includes,
+        'interface_name': interface.name,
+        'is_active_dom_object': is_active_dom_object,
+        'is_audio_buffer': is_audio_buffer,
+        'is_check_security': is_check_security,
+        'is_dependent_lifetime': is_dependent_lifetime,
+        'is_document': is_document,
+        'is_event_target': inherits_interface(interface.name, 'EventTarget'),
+        'is_exception': interface.is_exception,
+        'is_garbage_collected': this_gc_type == 'GarbageCollectedObject',
+        'is_will_be_garbage_collected': this_gc_type == 'WillBeGarbageCollectedObject',
+        'is_node': inherits_interface(interface.name, 'Node'),
+        'measure_as': DartUtilities.measure_as(interface),  # [MeasureAs]
+        'parent_interface': parent_interface,
+        'pass_cpp_type': dart_types.cpp_template_type(
+            dart_types.cpp_ptr_type('PassRefPtr', 'RawPtr', this_gc_type),
+            DartUtilities.cpp_name(interface)),
+        'reachable_node_function': reachable_node_function,
+        'runtime_enabled_function': DartUtilities.runtime_enabled_function_name(interface),  # [RuntimeEnabled]
+        'set_wrapper_reference_to_list': set_wrapper_reference_to_list,
+        'special_wrap_for': special_wrap_for,
+        'dart_class': dart_types.dart_type(interface.name),
+        'v8_class': DartUtilities.v8_class_name(interface),
+        'wrapper_configuration': 'WrapperConfiguration::Dependent'
+            if (has_visit_dom_wrapper or
+                is_active_dom_object or
+                is_dependent_lifetime)
+            else 'WrapperConfiguration::Independent',
+    }
+
+    # Constructors
+    constructors = [generate_constructor(interface, constructor)
+                    for constructor in interface.constructors
+                    # FIXME: shouldn't put named constructors with constructors
+                    # (currently needed for Perl compatibility)
+                    # Handle named constructors separately
+                    if constructor.name == 'Constructor']
+    generate_constructor_overloads(constructors)
+
+    # [CustomConstructor]
+    custom_constructors = [generate_custom_constructor(interface, constructor)
+                           for constructor in interface.custom_constructors]
+
+    # [EventConstructor]
+    has_event_constructor = 'EventConstructor' in extended_attributes
+    any_type_attributes = [attribute for attribute in interface.attributes
+                           if attribute.idl_type.name == 'Any']
+    if has_event_constructor:
+        includes.add('bindings/common/Dictionary.h')
+        if any_type_attributes:
+            includes.add('bindings/v8/SerializedScriptValue.h')
+
+    # [NamedConstructor]
+    named_constructor = generate_named_constructor(interface)
+
+    if (constructors or custom_constructors or has_event_constructor or
+        named_constructor):
+        includes.add('core/frame/LocalDOMWindow.h')
+
+    template_contents.update({
+        'any_type_attributes': any_type_attributes,
+        'constructors': constructors,
+        'custom_constructors': custom_constructors,
+        'has_custom_constructor': bool(custom_constructors),
+        'has_event_constructor': has_event_constructor,
+        'interface_length':
+            interface_length(interface, constructors + custom_constructors),
+        'is_constructor_call_with_document': DartUtilities.has_extended_attribute_value(
+            interface, 'ConstructorCallWith', 'Document'),  # [ConstructorCallWith=Document]
+        'is_constructor_call_with_execution_context': DartUtilities.has_extended_attribute_value(
+            interface, 'ConstructorCallWith', 'ExecutionContext'),  # [ConstructorCallWith=ExeuctionContext]
+        'is_constructor_raises_exception': extended_attributes.get('RaisesException') == 'Constructor',  # [RaisesException=Constructor]
+        'named_constructor': named_constructor,
+    })
+
+    # Constants
+    template_contents.update({
+        'constants': [generate_constant(constant) for constant in interface.constants],
+        'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes,
+    })
+
+    # Attributes
+    attributes = [dart_attributes.generate_attribute(interface, attribute)
+                  for attribute in interface.attributes
+                      # Skip attributes in the IGNORE_MEMBERS list or if an
+                      # extended attribute is in the IGNORE_EXTENDED_ATTRIBUTES.
+                      if (not _suppress_attribute(interface.name, attribute.name) and
+                          not dart_attributes.is_constructor_attribute(attribute) and
+                          not _suppress_extended_attributes(attribute.extended_attributes) and
+                          not ('DartSuppress' in attribute.extended_attributes and
+                           attribute.extended_attributes.get('DartSuppress') == None))]
+    template_contents.update({
+        'attributes': attributes,
+        'has_accessors': any(attribute['is_expose_js_accessors'] for attribute in attributes),
+        'has_attribute_configuration': any(
+             not (attribute['is_expose_js_accessors'] or
+                  attribute['is_static'] or
+                  attribute['runtime_enabled_function'] or
+                  attribute['per_context_enabled_function'])
+             for attribute in attributes),
+        'has_constructor_attributes': any(attribute['constructor_type'] for attribute in attributes),
+        'has_per_context_enabled_attributes': any(attribute['per_context_enabled_function'] for attribute in attributes),
+        'has_replaceable_attributes': any(attribute['is_replaceable'] for attribute in attributes),
+    })
+
+    # Methods
+    methods = [dart_methods.generate_method(interface, method)
+               for method in interface.operations
+               # Skip anonymous special operations (methods name empty).
+               # Skip methods in our IGNORE_MEMBERS list.
+               # Skip methods w/ extended attributes in IGNORE_EXTENDED_ATTRIBUTES list.
+               if (method.name and
+                   # TODO(terry): Eventual eliminate the IGNORE_MEMBERS in favor of DartSupress.
+                   not _suppress_method(interface.name, method.name) and
+                   not _suppress_extended_attributes(method.extended_attributes) and
+                   not 'DartSuppress' in method.extended_attributes)]
+    generate_overloads(methods)
+    for method in methods:
+        method['do_generate_method_configuration'] = (
+            method['do_not_check_signature'] and
+            not method['per_context_enabled_function'] and
+            # For overloaded methods, only generate one accessor
+            ('overload_index' not in method or method['overload_index'] == 1))
+
+    template_contents.update({
+        'has_origin_safe_method_setter': any(
+            method['is_check_security_for_frame'] and not method['is_read_only']
+            for method in methods),
+        'has_method_configuration': any(method['do_generate_method_configuration'] for method in methods),
+        'has_per_context_enabled_methods': any(method['per_context_enabled_function'] for method in methods),
+        'methods': methods,
+    })
+
+    template_contents.update({
+        'indexed_property_getter': indexed_property_getter(interface),
+        'indexed_property_setter': indexed_property_setter(interface),
+        'indexed_property_deleter': indexed_property_deleter(interface),
+        'is_override_builtins': 'OverrideBuiltins' in extended_attributes,
+        'named_property_getter': named_property_getter(interface),
+        'named_property_setter': named_property_setter(interface),
+        'named_property_deleter': named_property_deleter(interface),
+    })
+
+    return template_contents
+
+
+# [DeprecateAs], [Reflect], [RuntimeEnabled]
+def generate_constant(constant):
+    # (Blink-only) string literals are unquoted in tokenizer, must be re-quoted
+    # in C++.
+    if constant.idl_type.name == 'String':
+        value = '"%s"' % constant.value
+    else:
+        value = constant.value
+
+    extended_attributes = constant.extended_attributes
+    return {
+        'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'),
+        'name': constant.name,
+        # FIXME: use 'reflected_name' as correct 'name'
+        'reflected_name': extended_attributes.get('Reflect', constant.name),
+        'runtime_enabled_function': DartUtilities.runtime_enabled_function_name(constant),
+        'value': value,
+    }
+
+
+################################################################################
+# Overloads
+################################################################################
+
+def generate_overloads(methods):
+    generate_overloads_by_type(methods, is_static=False)  # Regular methods
+    generate_overloads_by_type(methods, is_static=True)
+
+
+def generate_overloads_by_type(methods, is_static):
+    # Generates |overloads| template values and modifies |methods| in place;
+    # |is_static| flag used (instead of partitioning list in 2) because need to
+    # iterate over original list of methods to modify in place
+    method_counts = defaultdict(lambda: 0)
+    for method in methods:
+        if method['is_static'] != is_static:
+            continue
+        name = method['name']
+        # FIXME(vsm): We don't seem to capture optional param
+        # overloads here.
+        method_counts[name] += 1
+
+    # Filter to only methods that are actually overloaded
+    overloaded_method_counts = dict((name, count)
+                                    for name, count in method_counts.iteritems()
+                                    if count > 1)
+
+    # Add overload information only to overloaded methods, so template code can
+    # easily verify if a function is overloaded
+    method_overloads = defaultdict(list)
+    for method in methods:
+        name = method['name']
+        if (method['is_static'] != is_static or
+            name not in overloaded_method_counts):
+            continue
+        # Overload index includes self, so first append, then compute index
+        method_overloads[name].append(method)
+        method.update({
+            'overload_index': len(method_overloads[name]),
+            'overload_resolution_expression': overload_resolution_expression(method),
+        })
+        # FIXME(vsm): Looks like we only handle optional parameters if
+        # the method is already overloaded. For a non-overloaded method
+        # with optional parameters, we never get here.
+
+    # Resolution function is generated after last overloaded function;
+    # package necessary information into |method.overloads| for that method.
+    for method in methods:
+        if (method['is_static'] != is_static or
+            'overload_index' not in method):
+            continue
+        name = method['name']
+        if method['overload_index'] != overloaded_method_counts[name]:
+            continue
+        overloads = method_overloads[name]
+        minimum_number_of_required_arguments = min(
+            overload['number_of_required_arguments']
+            for overload in overloads)
+        method['overloads'] = {
+            'has_exception_state': bool(minimum_number_of_required_arguments),
+            'methods': overloads,
+            'minimum_number_of_required_arguments': minimum_number_of_required_arguments,
+            'name': name,
+        }
+
+
+def overload_resolution_expression(method):
+    # Expression is an OR of ANDs: each term in the OR corresponds to a
+    # possible argument count for a given method, with type checks.
+    # FIXME: Blink's overload resolution algorithm is incorrect, per:
+    # Implement WebIDL overload resolution algorithm.
+    # https://code.google.com/p/chromium/issues/detail?id=293561
+    #
+    # Currently if distinguishing non-primitive type from primitive type,
+    # (e.g., sequence<DOMString> from DOMString or Dictionary from double)
+    # the method with a non-primitive type argument must appear *first* in the
+    # IDL file, since we're not adding a check to primitive types.
+    # FIXME: Once fixed, check IDLs, as usually want methods with primitive
+    # types to appear first (style-wise).
+    #
+    # Properly:
+    # 1. Compute effective overload set.
+    # 2. First check type list length.
+    # 3. If multiple entries for given length, compute distinguishing argument
+    #    index and have check for that type.
+    arguments = method['arguments']
+    overload_checks = [overload_check_expression(method, index)
+                       # check *omitting* optional arguments at |index| and up:
+                       # index 0 => argument_count 0 (no arguments)
+                       # index 1 => argument_count 1 (index 0 argument only)
+                       for index, argument in enumerate(arguments)
+                       if argument['is_optional']]
+    # FIXME: this is wrong if a method has optional arguments and a variadic
+    # one, though there are not yet any examples of this
+    if not method['is_variadic']:
+        # Includes all optional arguments (len = last index + 1)
+        overload_checks.append(overload_check_expression(method, len(arguments)))
+    return ' || '.join('(%s)' % check for check in overload_checks)
+
+
+def overload_check_expression(method, argument_count):
+    overload_checks = ['info.Length() == %s' % argument_count]
+    arguments = method['arguments'][:argument_count]
+    overload_checks.extend(overload_check_argument(index, argument)
+                           for index, argument in
+                           enumerate(arguments))
+    return ' && '.join('(%s)' % check for check in overload_checks if check)
+
+
+def overload_check_argument(index, argument):
+    def null_or_optional_check():
+        # If undefined is passed for an optional argument, the argument should
+        # be treated as missing; otherwise undefined is not allowed.
+
+        # FIXME(vsm): We need Dart specific checks here.
+        if idl_type.is_nullable:
+            if argument['is_optional']:
+                return 'isUndefinedOrNull(%s)'
+            return '%s->IsNull()'
+        if argument['is_optional']:
+            return '%s->IsUndefined()'
+        return None
+
+    cpp_value = 'info[%s]' % index
+    idl_type = argument['idl_type_object']
+    # FIXME(vsm): We need Dart specific checks for the rest of this method.
+    # FIXME: proper type checking, sharing code with attributes and methods
+    # FIXME(terry): StrictTypeChecking no longer supported; TypeChecking is
+    #               new extended attribute.
+    if idl_type.name == 'String' and argument['is_strict_type_checking']:
+        return ' || '.join(['isUndefinedOrNull(%s)' % cpp_value,
+                            '%s->IsString()' % cpp_value,
+                            '%s->IsObject()' % cpp_value])
+    if idl_type.array_or_sequence_type:
+        return '%s->IsArray()' % cpp_value
+    if idl_type.is_callback_interface:
+        return ' || '.join(['%s->IsNull()' % cpp_value,
+                            '%s->IsFunction()' % cpp_value])
+    if idl_type.is_wrapper_type:
+        type_check = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate())'.format(idl_type=idl_type.base_type, cpp_value=cpp_value)
+        if idl_type.is_nullable:
+            type_check = ' || '.join(['%s->IsNull()' % cpp_value, type_check])
+        return type_check
+    if idl_type.is_interface_type:
+        # Non-wrapper types are just objects: we don't distinguish type
+        # We only allow undefined for non-wrapper types (notably Dictionary),
+        # as we need it for optional Dictionary arguments, but we don't want to
+        # change behavior of existing bindings for other types.
+        type_check = '%s->IsObject()' % cpp_value
+        added_check_template = null_or_optional_check()
+        if added_check_template:
+            type_check = ' || '.join([added_check_template % cpp_value,
+                                      type_check])
+        return type_check
+    return None
+
+
+################################################################################
+# Constructors
+################################################################################
+
+# [Constructor]
+def generate_custom_constructor(interface, constructor):
+    return {
+        'arguments': [custom_constructor_argument(argument, index)
+                      for index, argument in enumerate(constructor.arguments)],
+        'auto_scope': 'true',
+        'is_auto_scope': True,
+        'number_of_arguments': len(constructor.arguments),
+        'number_of_required_arguments':
+            number_of_required_arguments(constructor),
+        }
+
+
+# We don't need much from this - just the idl_type_objects and preproceed_type
+# to use in generating the resolver strings.
+def custom_constructor_argument(argument, index):
+    return {
+        'idl_type_object': argument.idl_type,
+        'preprocessed_type': argument.idl_type.preprocessed_type,
+    }
+
+
+# [Constructor]
+def generate_constructor(interface, constructor):
+    return {
+        'argument_list': constructor_argument_list(interface, constructor),
+        # TODO(terry): Use dart_methods.generate_argument instead constructor_argument.
+        'arguments': [constructor_argument(interface, argument, index)
+                      for index, argument in enumerate(constructor.arguments)],
+        'has_exception_state':
+            # [RaisesException=Constructor]
+            interface.extended_attributes.get('RaisesException') == 'Constructor' or
+            any(argument for argument in constructor.arguments
+                if argument.idl_type.name == 'SerializedScriptValue' or
+                   argument.idl_type.is_integer_type),
+        'is_constructor': True,
+        'auto_scope': 'true',
+        'is_auto_scope': True,
+        'is_variadic': False,  # Required for overload resolution
+        'number_of_required_arguments':
+            number_of_required_arguments(constructor),
+        'number_of_arguments': len(constructor.arguments),
+    }
+
+
+def constructor_argument_list(interface, constructor):
+    # FIXME: unify with dart_methods.cpp_argument.
+
+    def cpp_argument(argument):
+        argument_name = dart_types.check_reserved_name(argument.name)
+        idl_type = argument.idl_type
+        if idl_type.is_typed_array_type:
+            return '%s.get()' % argument_name
+
+        return argument_name
+
+    arguments = []
+    # [ConstructorCallWith=ExecutionContext]
+    if DartUtilities.has_extended_attribute_value(interface, 'ConstructorCallWith', 'ExecutionContext'):
+        arguments.append('context')
+    # [ConstructorCallWith=Document]
+    if DartUtilities.has_extended_attribute_value(interface, 'ConstructorCallWith', 'Document'):
+        arguments.append('document')
+
+    arguments.extend([cpp_argument(argument) for argument in constructor.arguments])
+
+    # [RaisesException=Constructor]
+    if interface.extended_attributes.get('RaisesException') == 'Constructor':
+        arguments.append('es')
+
+    return arguments
+
+
+# TODO(terry): Eliminate this function use dart_methods.generate_argument instead
+#              for all constructor arguments.
+def constructor_argument(interface, argument, index):
+    idl_type = argument.idl_type
+    default_value = str(argument.default_value) if argument.default_value else None
+
+    argument_content = {
+        'cpp_type': idl_type.cpp_type_args(),
+        'local_cpp_type': idl_type.cpp_type_args(argument.extended_attributes, used_as_argument=True),
+        # FIXME: check that the default value's type is compatible with the argument's
+        'default_value': default_value,
+        # FIXME: remove once [Default] removed and just use argument.default_value
+        'has_default': 'Default' in argument.extended_attributes or default_value,
+        'idl_type_object': idl_type,
+        'preprocessed_type': idl_type.preprocessed_type,
+        # Dictionary is special-cased, but arrays and sequences shouldn't be
+        'idl_type': not idl_type.array_or_sequence_type and idl_type.base_type,
+        'index': index,
+        'is_array_or_sequence_type': not not idl_type.array_or_sequence_type,
+        'is_optional': argument.is_optional,
+        'is_strict_type_checking': False,  # Required for overload resolution
+        'name': argument.name,
+        'dart_value_to_local_cpp_value': dart_methods.dart_value_to_local_cpp_value(interface, argument, index),
+    }
+    return argument_content
+
+
+def generate_constructor_overloads(constructors):
+    if len(constructors) <= 1:
+        return
+    for overload_index, constructor in enumerate(constructors):
+        constructor.update({
+            'overload_index': overload_index + 1,
+            'overload_resolution_expression':
+                overload_resolution_expression(constructor),
+        })
+
+
+# [NamedConstructor]
+def generate_named_constructor(interface):
+    extended_attributes = interface.extended_attributes
+    if 'NamedConstructor' not in extended_attributes:
+        return None
+    # FIXME: parser should return named constructor separately;
+    # included in constructors (and only name stored in extended attribute)
+    # for Perl compatibility
+    idl_constructor = interface.constructors[0]
+    constructor = generate_constructor(interface, idl_constructor)
+    # FIXME(vsm): We drop the name. We don't use this in Dart APIs right now.
+    # We probably need to encode this somehow to deal with conflicts.
+    # constructor['name'] = extended_attributes['NamedConstructor']
+    return constructor
+
+
+def number_of_required_arguments(constructor):
+    return len([argument for argument in constructor.arguments
+        if not (argument.is_optional and not (('Default' in argument.extended_attributes) or argument.default_value))])
+
+
+def interface_length(interface, constructors):
+    # Docs: http://heycam.github.io/webidl/#es-interface-call
+    if 'EventConstructor' in interface.extended_attributes:
+        return 1
+    if not constructors:
+        return 0
+    return min(constructor['number_of_required_arguments']
+               for constructor in constructors)
+
+
+################################################################################
+# Special operations (methods)
+# http://heycam.github.io/webidl/#idl-special-operations
+################################################################################
+
+def property_getter(getter, cpp_arguments):
+    def is_null_expression(idl_type):
+        if idl_type.is_union_type:
+            return ' && '.join('!result%sEnabled' % i
+                               for i, _ in enumerate(idl_type.member_types))
+        if idl_type.name == 'String':
+            # FIXME(vsm): This looks V8 specific.
+            return 'result.isNull()'
+        if idl_type.is_interface_type:
+            return '!result'
+        return ''
+
+    idl_type = getter.idl_type
+    extended_attributes = getter.extended_attributes
+    is_raises_exception = 'RaisesException' in extended_attributes
+
+    # FIXME: make more generic, so can use dart_methods.cpp_value
+    cpp_method_name = 'receiver->%s' % DartUtilities.cpp_name(getter)
+
+    if is_raises_exception:
+        cpp_arguments.append('es')
+    union_arguments = idl_type.union_arguments
+    if union_arguments:
+        cpp_arguments.extend(union_arguments)
+
+    cpp_value = '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments))
+
+    return {
+        'cpp_type': idl_type.cpp_type,
+        'cpp_value': cpp_value,
+        'is_custom':
+            'Custom' in extended_attributes and
+            (not extended_attributes['Custom'] or
+             DartUtilities.has_extended_attribute_value(getter, 'Custom', 'PropertyGetter')),
+        'is_custom_property_enumerator': DartUtilities.has_extended_attribute_value(
+            getter, 'Custom', 'PropertyEnumerator'),
+        'is_custom_property_query': DartUtilities.has_extended_attribute_value(
+            getter, 'Custom', 'PropertyQuery'),
+        'is_enumerable': 'NotEnumerable' not in extended_attributes,
+        'is_null_expression': is_null_expression(idl_type),
+        'is_raises_exception': is_raises_exception,
+        'name': DartUtilities.cpp_name(getter),
+        'union_arguments': union_arguments,
+        'dart_set_return_value': idl_type.dart_set_return_value('result',
+                                                                extended_attributes=extended_attributes,
+                                                                script_wrappable='receiver',
+                                                                release=idl_type.release)}
+
+
+def property_setter(interface, setter):
+    idl_type = setter.arguments[1].idl_type
+    extended_attributes = setter.extended_attributes
+    interface_extended_attributes = interface.extended_attributes
+    is_raises_exception = 'RaisesException' in extended_attributes
+    return {
+        'has_strict_type_checking':
+            'StrictTypeChecking' in extended_attributes and
+            idl_type.is_wrapper_type,
+        'idl_type': idl_type.base_type,
+        'is_custom': 'Custom' in extended_attributes,
+        'has_exception_state': is_raises_exception or
+                               idl_type.is_integer_type,
+        'is_raises_exception': is_raises_exception,
+        'name': DartUtilities.cpp_name(setter),
+        'dart_value_to_local_cpp_value': idl_type.dart_value_to_local_cpp_value(
+            interface_extended_attributes, extended_attributes, 'propertyValue', False),
+    }
+
+
+def property_deleter(deleter):
+    idl_type = deleter.idl_type
+    if str(idl_type) != 'boolean':
+        raise Exception(
+            'Only deleters with boolean type are allowed, but type is "%s"' %
+            idl_type)
+    extended_attributes = deleter.extended_attributes
+    return {
+        'is_custom': 'Custom' in extended_attributes,
+        'is_raises_exception': 'RaisesException' in extended_attributes,
+        'name': DartUtilities.cpp_name(deleter),
+    }
+
+
+################################################################################
+# Indexed properties
+# http://heycam.github.io/webidl/#idl-indexed-properties
+################################################################################
+
+def indexed_property_getter(interface):
+    try:
+        # Find indexed property getter, if present; has form:
+        # getter TYPE [OPTIONAL_IDENTIFIER](unsigned long ARG1)
+        getter = next(
+            method
+            for method in interface.operations
+            if ('getter' in method.specials and
+                len(method.arguments) == 1 and
+                str(method.arguments[0].idl_type) == 'unsigned long'))
+    except StopIteration:
+        return None
+
+    getter.name = getter.name or 'anonymousIndexedGetter'
+
+    return property_getter(getter, ['index'])
+
+
+def indexed_property_setter(interface):
+    try:
+        # Find indexed property setter, if present; has form:
+        # setter RETURN_TYPE [OPTIONAL_IDENTIFIER](unsigned long ARG1, ARG_TYPE ARG2)
+        setter = next(
+            method
+            for method in interface.operations
+            if ('setter' in method.specials and
+                len(method.arguments) == 2 and
+                str(method.arguments[0].idl_type) == 'unsigned long'))
+    except StopIteration:
+        return None
+
+    return property_setter(interface, setter)
+
+
+def indexed_property_deleter(interface):
+    try:
+        # Find indexed property deleter, if present; has form:
+        # deleter TYPE [OPTIONAL_IDENTIFIER](unsigned long ARG)
+        deleter = next(
+            method
+            for method in interface.operations
+            if ('deleter' in method.specials and
+                len(method.arguments) == 1 and
+                str(method.arguments[0].idl_type) == 'unsigned long'))
+    except StopIteration:
+        return None
+
+    return property_deleter(deleter)
+
+
+################################################################################
+# Named properties
+# http://heycam.github.io/webidl/#idl-named-properties
+################################################################################
+
+def named_property_getter(interface):
+    try:
+        # Find named property getter, if present; has form:
+        # getter TYPE [OPTIONAL_IDENTIFIER](DOMString ARG1)
+        getter = next(
+            method
+            for method in interface.operations
+            if ('getter' in method.specials and
+                len(method.arguments) == 1 and
+                str(method.arguments[0].idl_type) == 'DOMString'))
+    except StopIteration:
+        return None
+
+    getter.name = getter.name or 'anonymousNamedGetter'
+    return property_getter(getter, ['propertyName'])
+
+
+def named_property_setter(interface):
+    try:
+        # Find named property setter, if present; has form:
+        # setter RETURN_TYPE [OPTIONAL_IDENTIFIER](DOMString ARG1, ARG_TYPE ARG2)
+        setter = next(
+            method
+            for method in interface.operations
+            if ('setter' in method.specials and
+                len(method.arguments) == 2 and
+                str(method.arguments[0].idl_type) == 'DOMString'))
+    except StopIteration:
+        return None
+
+    return property_setter(interface, setter)
+
+
+def named_property_deleter(interface):
+    try:
+        # Find named property deleter, if present; has form:
+        # deleter TYPE [OPTIONAL_IDENTIFIER](DOMString ARG)
+        deleter = next(
+            method
+            for method in interface.operations
+            if ('deleter' in method.specials and
+                len(method.arguments) == 1 and
+                str(method.arguments[0].idl_type) == 'DOMString'))
+    except StopIteration:
+        return None
+
+    return property_deleter(deleter)
diff --git a/bindings/dart/scripts/dart_methods.py b/bindings/dart/scripts/dart_methods.py
new file mode 100644
index 0000000..0a59338
--- /dev/null
+++ b/bindings/dart/scripts/dart_methods.py
@@ -0,0 +1,338 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Generate template values for methods.
+
+Extends IdlType and IdlUnionType with property |union_arguments|.
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
+"""
+
+from idl_types import IdlType, IdlUnionType, inherits_interface
+import dart_types
+from dart_utilities import DartUtilities
+from v8_globals import includes
+
+
+def generate_method(interface, method):
+    arguments = method.arguments
+    extended_attributes = method.extended_attributes
+    idl_type = method.idl_type
+    is_static = method.is_static
+    name = method.name
+
+    idl_type.add_includes_for_type()
+    this_cpp_value = cpp_value(interface, method, len(arguments))
+
+    def function_template():
+        if is_static:
+            return 'functionTemplate'
+        if 'Unforgeable' in extended_attributes:
+            return 'instanceTemplate'
+        return 'prototypeTemplate'
+
+    is_call_with_script_arguments = DartUtilities.has_extended_attribute_value(method, 'CallWith', 'ScriptArguments')
+    if is_call_with_script_arguments:
+        includes.update(['bindings/v8/ScriptCallStackFactory.h',
+                         'core/inspector/ScriptArguments.h'])
+    is_call_with_script_state = DartUtilities.has_extended_attribute_value(method, 'CallWith', 'ScriptState')
+    if is_call_with_script_state:
+        includes.add('bindings/dart/DartScriptState.h')
+    is_check_security_for_node = 'CheckSecurity' in extended_attributes
+    if is_check_security_for_node:
+        includes.add('bindings/common/BindingSecurity.h')
+    is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attributes
+    if is_custom_element_callbacks:
+        includes.add('core/dom/custom/CustomElementCallbackDispatcher.h')
+
+    has_event_listener_argument = any(
+        argument for argument in arguments
+        if argument.idl_type.name == 'EventListener')
+    is_check_security_for_frame = (
+        'CheckSecurity' in interface.extended_attributes and
+        'DoNotCheckSecurity' not in extended_attributes)
+    is_raises_exception = 'RaisesException' in extended_attributes
+
+    if idl_type.union_arguments and len(idl_type.union_arguments) > 0:
+        this_cpp_type = []
+        for cpp_type in idl_type.member_types:
+            this_cpp_type.append("RefPtr<%s>" % cpp_type)
+    else:
+        this_cpp_type = idl_type.cpp_type
+
+    is_auto_scope = not 'DartNoAutoScope' in extended_attributes
+    method_data = {
+        'activity_logging_world_list': DartUtilities.activity_logging_world_list(method),  # [ActivityLogging]
+        'arguments': [generate_argument(interface, method, argument, index)
+                      for index, argument in enumerate(arguments)],
+        'conditional_string': DartUtilities.conditional_string(method),
+        'cpp_type': this_cpp_type,
+        'cpp_value': this_cpp_value,
+        'dart_name': extended_attributes.get('DartName'),
+        'deprecate_as': DartUtilities.deprecate_as(method),  # [DeprecateAs]
+        'do_not_check_signature': not(is_static or
+            DartUtilities.has_extended_attribute(method,
+                ['DoNotCheckSecurity', 'DoNotCheckSignature', 'NotEnumerable',
+                 'ReadOnly', 'RuntimeEnabled', 'Unforgeable'])),
+        'function_template': function_template(),
+        'idl_type': idl_type.base_type,
+        'has_event_listener_argument': has_event_listener_argument,
+        'has_exception_state':
+            has_event_listener_argument or
+            is_raises_exception or
+            is_check_security_for_frame or
+            any(argument for argument in arguments
+                if argument.idl_type.name == 'SerializedScriptValue' or
+                   argument.idl_type.is_integer_type),
+        'is_auto_scope': is_auto_scope,
+        'auto_scope': DartUtilities.bool_to_cpp(is_auto_scope),
+        'is_call_with_execution_context': DartUtilities.has_extended_attribute_value(method, 'CallWith', 'ExecutionContext'),
+        'is_call_with_script_arguments': is_call_with_script_arguments,
+        'is_call_with_script_state': is_call_with_script_state,
+        'is_check_security_for_frame': is_check_security_for_frame,
+        'is_check_security_for_node': is_check_security_for_node,
+        'is_custom': 'Custom' in extended_attributes or 'DartCustom' in extended_attributes,
+        'is_custom_dart': 'DartCustom' in extended_attributes,
+        'is_custom_dart_new': DartUtilities.has_extended_attribute_value(method, 'DartCustom', 'New'),
+        'is_custom_element_callbacks': is_custom_element_callbacks,
+        'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes,
+        'is_do_not_check_signature': 'DoNotCheckSignature' in extended_attributes,
+        'is_partial_interface_member': 'PartialInterfaceImplementedAs' in extended_attributes,
+        'is_per_world_bindings': 'PerWorldBindings' in extended_attributes,
+        'is_raises_exception': is_raises_exception,
+        'is_read_only': 'ReadOnly' in extended_attributes,
+        'is_static': is_static,
+        # FIXME(terry): StrictTypeChecking no longer supported; TypeChecking is
+        #               new extended attribute.
+        'is_strict_type_checking':
+            'StrictTypeChecking' in extended_attributes or
+            'StrictTypeChecking' in interface.extended_attributes,
+        'is_variadic': arguments and arguments[-1].is_variadic,
+        'measure_as': DartUtilities.measure_as(method),  # [MeasureAs]
+        'name': name,
+        'number_of_arguments': len(arguments),
+        'number_of_required_arguments': len([
+            argument for argument in arguments
+            if not ((argument.is_optional and not ('Default' in argument.extended_attributes or argument.default_value)) or
+                    argument.is_variadic)]),
+        'number_of_required_or_variadic_arguments': len([
+            argument for argument in arguments
+            if not argument.is_optional]),
+        'per_context_enabled_function': DartUtilities.per_context_enabled_function_name(method),  # [PerContextEnabled]
+        'property_attributes': property_attributes(method),
+        'runtime_enabled_function': DartUtilities.runtime_enabled_function_name(method),  # [RuntimeEnabled]
+        'signature': 'v8::Local<v8::Signature>()' if is_static or 'DoNotCheckSignature' in extended_attributes else 'defaultSignature',
+        'suppressed': (arguments and arguments[-1].is_variadic),  # FIXME: implement variadic
+        'union_arguments': idl_type.union_arguments,
+        'dart_set_return_value': dart_set_return_value(interface.name, method, this_cpp_value),
+        'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended_attributes else [''],  # [PerWorldBindings]
+    }
+    return method_data
+
+
+def generate_argument(interface, method, argument, index):
+    extended_attributes = argument.extended_attributes
+    idl_type = argument.idl_type
+    this_cpp_value = cpp_value(interface, method, index)
+    is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type
+    use_heap_vector_type = is_variadic_wrapper_type and idl_type.is_will_be_garbage_collected
+    auto_scope = not 'DartNoAutoScope' in extended_attributes
+    this_has_default = 'Default' in extended_attributes
+    arg_index = index + 1 if not method.is_static else index
+    preprocessed_type = str(idl_type.preprocessed_type)
+    # FIXMEDART: handle the drift between preprocessed type names in 1847 and
+    # 1985 dartium builds in a more generic way.
+    if preprocessed_type == 'unrestricted float':
+        preprocessed_type = 'float'
+    if preprocessed_type == 'unrestricted double':
+        preprocessed_type = 'double'
+    argument_data = {
+        'cpp_type': idl_type.cpp_type_args(used_in_cpp_sequence=use_heap_vector_type),
+        'cpp_value': this_cpp_value,
+        'local_cpp_type': idl_type.cpp_type_args(argument.extended_attributes, used_as_argument=True),
+        # FIXME: check that the default value's type is compatible with the argument's
+        'default_value': str(argument.default_value) if argument.default_value else None,
+        'enum_validation_expression': idl_type.enum_validation_expression,
+        # Ignore 'Default' in extended_attributes not exposed in dart:html.
+        'has_default': False,
+        'has_event_listener_argument': any(
+            argument_so_far for argument_so_far in method.arguments[:index]
+            if argument_so_far.idl_type.name == 'EventListener'),
+        'idl_type_object': idl_type,
+        'preprocessed_type': preprocessed_type,
+        # Dictionary is special-cased, but arrays and sequences shouldn't be
+        'idl_type': not idl_type.array_or_sequence_type and idl_type.base_type,
+        'index': index,
+        'is_array_or_sequence_type': not not idl_type.array_or_sequence_type,
+        'is_clamp': 'Clamp' in extended_attributes,
+        'is_callback_interface': idl_type.is_callback_interface,
+        'is_nullable': idl_type.is_nullable,
+        # Only expose as optional if no default value.
+        'is_optional': argument.is_optional and not (this_has_default or argument.default_value),
+        'is_strict_type_checking': 'StrictTypeChecking' in extended_attributes,
+        'is_variadic_wrapper_type': is_variadic_wrapper_type,
+        'vector_type': 'WillBeHeapVector' if use_heap_vector_type else 'Vector',
+        'is_wrapper_type': idl_type.is_wrapper_type,
+        'name': argument.name,
+        'dart_set_return_value_for_main_world': dart_set_return_value(interface.name, method, this_cpp_value, for_main_world=True),
+        'dart_set_return_value': dart_set_return_value(interface.name, method, this_cpp_value),
+        'arg_index': arg_index,
+        'dart_value_to_local_cpp_value': dart_value_to_local_cpp_value(interface, argument, arg_index, auto_scope),
+    }
+    return argument_data
+
+
+################################################################################
+# Value handling
+################################################################################
+
+def cpp_value(interface, method, number_of_arguments):
+    def cpp_argument(argument):
+        argument_name = dart_types.check_reserved_name(argument.name)
+        idl_type = argument.idl_type
+
+        if idl_type.is_typed_array_type:
+            return '%s.get()' % argument_name
+
+        if idl_type.name == 'EventListener':
+            if (interface.name == 'EventTarget' and
+                method.name == 'removeEventListener'):
+                # FIXME: remove this special case by moving get() into
+                # EventTarget::removeEventListener
+                return '%s.get()' % argument_name
+            return argument.name
+        if (idl_type.is_callback_interface or
+            idl_type.name in ['NodeFilter', 'XPathNSResolver']):
+            # FIXME: remove this special case
+            return '%s.release()' % argument_name
+        return argument_name
+
+    # Truncate omitted optional arguments
+    arguments = method.arguments[:number_of_arguments]
+    cpp_arguments = DartUtilities.call_with_arguments(method)
+    if ('PartialInterfaceImplementedAs' in method.extended_attributes and not method.is_static):
+        cpp_arguments.append('*receiver')
+
+    cpp_arguments.extend(cpp_argument(argument) for argument in arguments)
+    this_union_arguments = method.idl_type.union_arguments
+    if this_union_arguments:
+        cpp_arguments.extend(this_union_arguments)
+
+    if 'RaisesException' in method.extended_attributes:
+        cpp_arguments.append('es')
+
+    cpp_method_name = DartUtilities.scoped_name(interface, method, DartUtilities.cpp_name(method))
+    return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments))
+
+
+# Mapping of IDL type to DartUtilities helper types.
+def dart_arg_type(argument_type):
+    if (argument_type.cpp_type == 'String'):
+        return 'DartStringAdapter'
+
+    return argument_type.cpp_type
+
+
+def dart_set_return_value(interface_name, method, cpp_value, for_main_world=False):
+    idl_type = method.idl_type
+    extended_attributes = method.extended_attributes
+    if idl_type.name == 'void':
+        return None
+
+    release = False
+
+    if idl_type.is_union_type:
+        release = idl_type.release
+
+    # [CallWith=ScriptState], [RaisesException]
+# TODO(terry): Disable ScriptState temporarily need to handle.
+#    if (has_extended_attribute_value(method, 'CallWith', 'ScriptState') or
+#        'RaisesException' in extended_attributes or
+#        idl_type.is_union_type):
+#        cpp_value = 'result'  # use local variable for value
+#        release = idl_type.release
+
+    auto_scope = not 'DartNoAutoScope' in extended_attributes
+    script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else ''
+    return idl_type.dart_set_return_value(cpp_value, extended_attributes,
+                                          script_wrappable=script_wrappable,
+                                          release=release,
+                                          for_main_world=for_main_world,
+                                          auto_scope=auto_scope)
+
+
+def dart_value_to_local_cpp_value(interface, argument, index, auto_scope=True):
+    extended_attributes = argument.extended_attributes
+    interface_extended_attributes = interface.extended_attributes
+    idl_type = argument.idl_type
+    name = argument.name
+    # TODO(terry): Variadic arguments are not handled but treated as one argument.
+    #    if argument.is_variadic:
+    #        vector_type = 'WillBeHeapVector' if idl_type.is_will_be_garbage_collected else 'Vector'
+    #        return 'V8TRYCATCH_VOID({vector_type}<{cpp_type}>, {name}, toNativeArguments<{cpp_type}>(info, {index}))'.format(
+    #                cpp_type=idl_type.cpp_type, name=name, index=index, vector_type=vector_type)
+
+    # FIXME: V8 has some special logic around the addEventListener and
+    # removeEventListener methods that should be added in somewhere.
+    # There is also some logic in systemnative.py to force a null check
+    # for the useCapture argument of those same methods that we may need to
+    # pull over.
+    null_check = (argument.is_optional and \
+                  (idl_type.is_callback_interface or idl_type == 'Dictionary')) or \
+                 (argument.default_value and argument.default_value.is_null)
+
+    return idl_type.dart_value_to_local_cpp_value(
+        interface_extended_attributes, extended_attributes, name, null_check,
+        index=index, auto_scope=auto_scope)
+
+
+################################################################################
+# Auxiliary functions
+################################################################################
+
+# [NotEnumerable]
+def property_attributes(method):
+    extended_attributes = method.extended_attributes
+    property_attributes_list = []
+    if 'NotEnumerable' in extended_attributes:
+        property_attributes_list.append('v8::DontEnum')
+    if 'ReadOnly' in extended_attributes:
+        property_attributes_list.append('v8::ReadOnly')
+    if property_attributes_list:
+        property_attributes_list.insert(0, 'v8::DontDelete')
+    return property_attributes_list
+
+
+def union_arguments(idl_type):
+    """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for union types, for use in setting return value"""
+    return [arg
+            for i in range(len(idl_type.member_types))
+            for arg in ['result%sEnabled' % i, 'result%s' % i]]
+
+IdlType.union_arguments = property(lambda self: None)
+IdlUnionType.union_arguments = property(union_arguments)
diff --git a/bindings/dart/scripts/dart_tests.py b/bindings/dart/scripts/dart_tests.py
new file mode 100644
index 0000000..f0ad19b
--- /dev/null
+++ b/bindings/dart/scripts/dart_tests.py
@@ -0,0 +1,278 @@
+# Copyright (C) 2014 Google Inc.  All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+import fnmatch
+import os
+import shutil
+import sys
+import tempfile
+
+from webkitpy.common.checkout.scm.detection import detect_scm_system
+from webkitpy.common.system import executive
+from webkitpy.common.system.executive import ScriptError
+
+# Add Source path to PYTHONPATH to support function calls to bindings/scripts
+# for compute_dependencies and idl_compiler
+module_path = os.path.dirname(__file__)
+source_path = os.path.normpath(os.path.join(module_path, os.pardir,
+                                            os.pardir, os.pardir, os.pardir,
+                                            'Source'))
+sys.path.append(source_path)
+
+from bindings.scripts.compute_interfaces_info import compute_interfaces_info, interfaces_info
+from bindings.scripts.idl_compiler import IdlCompilerV8
+
+
+PASS_MESSAGE = 'All tests PASS!'
+FAIL_MESSAGE = """Some tests FAIL!
+To update the reference files, execute:
+    run-bindings-tests --reset-results
+
+If the failures are not due to your changes, test results may be out of sync;
+please rebaseline them in a separate CL, after checking that tests fail in ToT.
+In CL, please set:
+NOTRY=true
+TBR=(someone in Source/bindings/OWNERS or WATCHLISTS:bindings)
+"""
+
+DEPENDENCY_IDL_FILES = set([
+    'SupportTestPartialInterface.idl',
+    'TestImplements.idl',
+    'TestImplements2.idl',
+    'TestImplements3.idl',
+    'TestPartialInterface.idl',
+    'TestPartialInterfacePython.idl',
+    'TestPartialInterfacePython2.idl',
+])
+
+
+EXTENDED_ATTRIBUTES_FILE = 'bindings/IDLExtendedAttributes.txt'
+
+all_input_directory = '.'  # Relative to Source/
+test_input_directory = os.path.join('bindings', 'tests', 'idls')
+reference_directory = os.path.join('bindings', 'tests', 'results')
+
+
+class ScopedTempFileProvider(object):
+    def __init__(self):
+        self.file_handles = []
+        self.file_paths = []
+        self.dir_paths = []
+
+    def __enter__(self):
+        return self
+
+    def __exit__(self, exc_type, exc_value, traceback):
+        for file_handle in self.file_handles:
+            os.close(file_handle)
+        for file_path in self.file_paths:
+            os.remove(file_path)
+        for dir_path in self.dir_paths:
+            # Temporary directories are used as output directories, so they
+            # contains unknown files (they aren't empty), hence use rmtree
+            shutil.rmtree(dir_path)
+
+    def new_temp_file(self):
+        file_handle, file_path = tempfile.mkstemp()
+        self.file_handles.append(file_handle)
+        self.file_paths.append(file_path)
+        return file_handle, file_path
+
+    def new_temp_dir(self):
+        dir_path = tempfile.mkdtemp()
+        self.dir_paths.append(dir_path)
+        return dir_path
+
+
+class DartTests(object):
+    def __init__(self, reset_results, verbose, provider):
+        self.reset_results = reset_results
+        self.verbose = verbose
+        self.executive = executive.Executive()
+        self.provider = provider
+        self.idl_compiler = None
+        _, self.interfaces_info_filename = provider.new_temp_file()
+        # Generate output into the reference directory if resetting results, or
+        # a temp directory if not.
+        if reset_results:
+            self.output_directory = reference_directory
+        else:
+            self.output_directory = provider.new_temp_dir()
+
+    def run_command(self, cmd):
+        output = self.executive.run_command(cmd)
+        if output:
+            print output
+
+    def generate_from_idl(self, idl_file):
+        try:
+            idl_file_fullpath = os.path.realpath(idl_file)
+            self.idl_compiler.compile_file(idl_file_fullpath)
+        except ScriptError, e:
+            print 'ERROR: idl_compiler.py: ' + os.path.basename(idl_file)
+            print e.output
+            return e.exit_code
+
+        return 0
+
+    def generate_interface_dependencies(self):
+        def idl_paths(directory):
+            return [os.path.join(directory, input_file)
+                    for input_file in os.listdir(directory)
+                    if input_file.endswith('.idl')]
+
+        def idl_paths_recursive(directory):
+            idl_paths = []
+            for dirpath, _, files in os.walk(directory):
+                idl_paths.extend(os.path.join(dirpath, filename)
+                                 for filename in fnmatch.filter(files, '*.idl'))
+            return idl_paths
+
+        def write_list_file(idl_paths):
+            list_file, list_filename = self.provider.new_temp_file()
+            list_contents = ''.join(idl_path + '\n'
+                                    for idl_path in idl_paths)
+            os.write(list_file, list_contents)
+            return list_filename
+
+        # We compute interfaces info for *all* IDL files, not just test IDL
+        # files, as code generator output depends on inheritance (both ancestor
+        # chain and inherited extended attributes), and some real interfaces
+        # are special-cased, such as Node.
+        #
+        # For example, when testing the behavior of interfaces that inherit
+        # from Node, we also need to know that these inherit from EventTarget,
+        # since this is also special-cased and Node inherits from EventTarget,
+        # but this inheritance information requires computing dependencies for
+        # the real Node.idl file.
+        try:
+            compute_interfaces_info(idl_paths_recursive(all_input_directory))
+
+        except ScriptError, e:
+            print 'ERROR: compute_interfaces_info.py'
+            print e.output
+            return e.exit_code
+
+        return 0
+
+    def delete_cache_files(self):
+        # FIXME: Instead of deleting cache files, don't generate them.
+        cache_files = [os.path.join(self.output_directory, output_file)
+                       for output_file in os.listdir(self.output_directory)
+                       if (output_file in ('lextab.py',  # PLY lex
+                                           'lextab.pyc',
+                                           'parsetab.pickle') or  # PLY yacc
+                               output_file.endswith('.cache'))]  # Jinja
+        for cache_file in cache_files:
+            os.remove(cache_file)
+
+    def identical_file(self, reference_filename, output_filename):
+        reference_basename = os.path.basename(reference_filename)
+        cmd = ['diff',
+               '-u',
+               '-N',
+               reference_filename,
+               output_filename]
+        try:
+            self.run_command(cmd)
+        except ScriptError, e:
+            # run_command throws an exception on diff (b/c non-zero exit code)
+            print 'FAIL: %s' % reference_basename
+            print e.output
+            return False
+
+        if self.verbose:
+            print 'PASS: %s' % reference_basename
+        return True
+
+    def identical_output_files(self):
+        file_pairs = [(os.path.join(reference_directory, output_file),
+                       os.path.join(self.output_directory, output_file))
+                      for output_file in os.listdir(self.output_directory)]
+        return all([self.identical_file(reference_filename, output_filename)
+                    for (reference_filename, output_filename) in file_pairs])
+
+    def no_excess_files(self):
+        generated_files = set(os.listdir(self.output_directory))
+        generated_files.add('.svn')  # Subversion working copy directory
+        excess_files = [output_file
+                        for output_file in os.listdir(reference_directory)
+                        if output_file not in generated_files]
+        if excess_files:
+            print ('Excess reference files! '
+                  '(probably cruft from renaming or deleting):\n' +
+                  '\n'.join(excess_files))
+            return False
+        return True
+
+    def run_tests(self):
+        # Generate output, immediately dying on failure
+        if self.generate_interface_dependencies():
+            return False
+
+        self.idl_compiler = IdlCompilerV8(self.output_directory,
+                                          EXTENDED_ATTRIBUTES_FILE,
+                                          interfaces_info=interfaces_info,
+                                          only_if_changed=True)
+
+        for input_filename in os.listdir(test_input_directory):
+            if not input_filename.endswith('.idl'):
+                continue
+            if input_filename in DEPENDENCY_IDL_FILES:
+                # Dependencies aren't built (they are used by the dependent)
+                if self.verbose:
+                    print 'DEPENDENCY: %s' % input_filename
+                continue
+
+            idl_path = os.path.join(test_input_directory, input_filename)
+            if self.generate_from_idl(idl_path):
+                return False
+            if self.reset_results and self.verbose:
+                print 'Reset results: %s' % input_filename
+
+        self.delete_cache_files()
+
+        # Detect all changes
+        passed = self.identical_output_files()
+        passed &= self.no_excess_files()
+        return passed
+
+    def main(self):
+        current_scm = detect_scm_system(os.curdir)
+        os.chdir(os.path.join(current_scm.checkout_root, 'Source'))
+
+        all_tests_passed = self.run_tests()
+        if all_tests_passed:
+            if self.verbose:
+                print
+                print PASS_MESSAGE
+            return 0
+        print
+        print FAIL_MESSAGE
+        return -1
+
+
+def run_dart_tests(reset_results, verbose):
+    with ScopedTempFileProvider() as provider:
+        return DartTests(reset_results, verbose, provider).main()
diff --git a/bindings/dart/scripts/dart_types.py b/bindings/dart/scripts/dart_types.py
new file mode 100644
index 0000000..1ca39fb
--- /dev/null
+++ b/bindings/dart/scripts/dart_types.py
@@ -0,0 +1,795 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Functions for type handling and type conversion (Blink/C++ <-> Dart:HTML).
+
+Extends IdlType and IdlUnionType with C++-specific properties, methods, and
+class methods.
+
+Spec:
+http://www.w3.org/TR/WebIDL/#es-type-mapping
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
+"""
+
+import posixpath
+from idl_types import IdlType, IdlUnionType, TYPE_NAMES
+import dart_attributes  # for IdlType.constructor_type_name
+from dart_utilities import DartUtilities
+from v8_globals import includes
+
+
+################################################################################
+# CPP -specific handling of IDL types for Dart:Blink
+################################################################################
+
+NON_WRAPPER_TYPES = frozenset([
+    'CompareHow',
+    'Dictionary',
+    'EventHandler',
+    'EventListener',
+    'MediaQueryListListener',
+    'NodeFilter',
+    'SerializedScriptValue',
+])
+TYPED_ARRAYS = {
+    # (cpp_type, dart_type), used by constructor templates
+    'ArrayBuffer': (None, 'ByteBuffer'),
+    'ArrayBufferView': (None, 'ByteData'),
+    'Float32Array': ('float', 'Float32List'),
+    'Float64Array': ('double', 'Float64List'),
+    'Int8Array': ('signed char', 'Int8List'),
+    'Int16Array': ('short', 'Int16List'),
+    'Int32Array': ('int', 'Int32List'),
+    'Uint8Array': ('unsigned char', 'Uint8List'),
+    'Uint8ClampedArray': ('unsigned char', 'Uint8ClampedList'),
+    'Uint16Array': ('unsigned short', 'Uint16List'),
+    'Uint32Array': ('unsigned int', 'Uint32List'),
+}
+
+IdlType.is_typed_array_type = property(
+    lambda self: self.base_type in TYPED_ARRAYS)
+
+
+IdlType.is_wrapper_type = property(
+    lambda self: (self.is_interface_type and
+                  self.base_type not in NON_WRAPPER_TYPES))
+
+
+################################################################################
+# C++ types
+################################################################################
+
+CPP_TYPE_SAME_AS_IDL_TYPE = set([
+    'double',
+    'float',
+    'long long',
+    'unsigned long long',
+])
+CPP_INT_TYPES = set([
+    'byte',
+    'long',
+    'short',
+])
+CPP_UNSIGNED_TYPES = set([
+    'octet',
+    'unsigned int',
+    'unsigned long',
+    'unsigned short',
+])
+CPP_SPECIAL_CONVERSION_RULES = {
+    'CompareHow': 'Range::CompareHow',
+    'Date': 'double',
+    'Dictionary': 'Dictionary',
+    'EventHandler': 'EventListener*',
+    'MediaQueryListListener': 'RefPtrWillBeRawPtr<MediaQueryListListener>',
+    'Promise': 'ScriptPromise',
+    'ScriptValue': 'ScriptValue',
+    # FIXME: Eliminate custom bindings for XPathNSResolver  http://crbug.com/345529
+    'XPathNSResolver': 'RefPtrWillBeRawPtr<XPathNSResolver>',
+    'boolean': 'bool',
+    'unrestricted double': 'double',
+    'unrestricted float': 'float',
+}
+
+
+def cpp_type(idl_type, extended_attributes=None, used_as_argument=False, used_in_cpp_sequence=False):
+    """Returns C++ type corresponding to IDL type.
+
+    |idl_type| argument is of type IdlType, while return value is a string
+
+    Args:
+        idl_type:
+            IdlType
+        used_as_argument:
+            bool, True if idl_type's raw/primitive C++ type should be returned.
+        will_be_in_heap_object:
+            bool, True if idl_type will be part of a possibly heap allocated
+            object (e.g., appears as an element of a C++ heap vector type.)
+            The C++ type of an interface type changes, if so.
+    """
+    extended_attributes = extended_attributes or {}
+    idl_type = idl_type.preprocessed_type
+
+    # Composite types
+    array_or_sequence_type = idl_type.array_or_sequence_type
+    if array_or_sequence_type:
+        vector_type = cpp_ptr_type('Vector', 'HeapVector', array_or_sequence_type.gc_type)
+        return cpp_template_type(vector_type, array_or_sequence_type.cpp_type_args(used_in_cpp_sequence=True))
+
+    # Simple types
+    base_idl_type = idl_type.base_type
+
+    if base_idl_type in CPP_TYPE_SAME_AS_IDL_TYPE:
+        return base_idl_type
+    if base_idl_type in CPP_INT_TYPES:
+        return 'int'
+    if base_idl_type in CPP_UNSIGNED_TYPES:
+        return 'unsigned'
+    if base_idl_type in CPP_SPECIAL_CONVERSION_RULES:
+        return CPP_SPECIAL_CONVERSION_RULES[base_idl_type]
+
+    if base_idl_type in NON_WRAPPER_TYPES:
+        return 'RefPtr<%s>' % base_idl_type
+    if base_idl_type in ('DOMString', 'ByteString', 'ScalarValueString'):
+        if not used_as_argument:
+            return 'String'
+        return 'DartStringAdapter'
+
+    if idl_type.is_typed_array_type and used_as_argument:
+        return 'RefPtr<%s>' % base_idl_type
+    if idl_type.is_callback_interface:
+        return 'OwnPtr<%s>' % base_idl_type
+    if idl_type.is_interface_type:
+        implemented_as_class = idl_type.implemented_as
+        if used_as_argument:
+            return implemented_as_class + '*'
+        new_type = 'Member' if used_in_cpp_sequence else 'RawPtr'
+        ptr_type = cpp_ptr_type('RefPtr', new_type, idl_type.gc_type)
+        return cpp_template_type(ptr_type, implemented_as_class)
+
+    # Default, assume native type is a pointer with same type name as idl type
+    return base_idl_type + '*'
+
+
+def cpp_type_union(idl_type, extended_attributes=None, used_as_argument=False, will_be_in_heap_object=False):
+    return (member_type.cpp_type for member_type in idl_type.member_types)
+
+# Allow access as idl_type.cpp_type if no arguments
+IdlType.cpp_type = property(cpp_type)
+IdlUnionType.cpp_type = property(cpp_type_union)
+IdlType.cpp_type_args = cpp_type
+IdlUnionType.cpp_type_args = cpp_type_union
+
+
+def cpp_template_type(template, inner_type):
+    """Returns C++ template specialized to type, with space added if needed."""
+    if inner_type.endswith('>'):
+        format_string = '{template}<{inner_type} >'
+    else:
+        format_string = '{template}<{inner_type}>'
+    return format_string.format(template=template, inner_type=inner_type)
+
+
+def cpp_ptr_type(old_type, new_type, gc_type):
+    if gc_type == 'GarbageCollectedObject':
+        return new_type
+    if gc_type == 'WillBeGarbageCollectedObject':
+        if old_type == 'Vector':
+            return 'WillBe' + new_type
+        return old_type + 'WillBe' + new_type
+    return old_type
+
+
+def v8_type(interface_name):
+    return 'V8' + interface_name
+
+
+def dart_type(interface_name):
+    return 'Dart' + str(interface_name)
+
+
+# [ImplementedAs]
+# This handles [ImplementedAs] on interface types, not [ImplementedAs] in the
+# interface being generated. e.g., given:
+#   Foo.idl: interface Foo {attribute Bar bar};
+#   Bar.idl: [ImplementedAs=Zork] interface Bar {};
+# when generating bindings for Foo, the [ImplementedAs] on Bar is needed.
+# This data is external to Foo.idl, and hence computed as global information in
+# compute_interfaces_info.py to avoid having to parse IDLs of all used interfaces.
+IdlType.implemented_as_interfaces = {}
+
+
+def implemented_as(idl_type):
+    base_idl_type = idl_type.base_type
+    if base_idl_type in IdlType.implemented_as_interfaces:
+        return IdlType.implemented_as_interfaces[base_idl_type]
+    return base_idl_type
+
+
+IdlType.implemented_as = property(implemented_as)
+
+IdlType.set_implemented_as_interfaces = classmethod(
+    lambda cls, new_implemented_as_interfaces:
+        cls.implemented_as_interfaces.update(new_implemented_as_interfaces))
+
+# [GarbageCollected]
+IdlType.garbage_collected_types = set()
+
+IdlType.is_garbage_collected = property(
+    lambda self: self.base_type in IdlType.garbage_collected_types)
+
+IdlType.set_garbage_collected_types = classmethod(
+    lambda cls, new_garbage_collected_types:
+        cls.garbage_collected_types.update(new_garbage_collected_types))
+
+
+# [WillBeGarbageCollected]
+IdlType.will_be_garbage_collected_types = set()
+
+IdlType.is_will_be_garbage_collected = property(
+    lambda self: self.base_type in IdlType.will_be_garbage_collected_types)
+
+IdlType.set_will_be_garbage_collected_types = classmethod(
+    lambda cls, new_will_be_garbage_collected_types:
+        cls.will_be_garbage_collected_types.update(new_will_be_garbage_collected_types))
+
+
+def gc_type(idl_type):
+    if idl_type.is_garbage_collected:
+        return 'GarbageCollectedObject'
+    if idl_type.is_will_be_garbage_collected:
+        return 'WillBeGarbageCollectedObject'
+    return 'RefCountedObject'
+
+IdlType.gc_type = property(gc_type)
+
+
+################################################################################
+# Includes
+################################################################################
+
+def includes_for_cpp_class(class_name, relative_dir_posix):
+    return set([posixpath.join('bindings', relative_dir_posix, class_name + '.h')])
+
+# TODO(terry): Will we need this group header for dart:blink?
+INCLUDES_FOR_TYPE = {
+    'object': set(),
+    'CompareHow': set(),
+    'Dictionary': set(['bindings/common/Dictionary.h']),
+    'EventHandler': set(),
+    'EventListener': set(),
+    'HTMLCollection': set(['bindings/core/dart/DartHTMLCollection.h',
+                           'core/dom/ClassCollection.h',
+                           'core/dom/TagCollection.h',
+                           'core/html/HTMLCollection.h',
+                           'core/html/HTMLFormControlsCollection.h',
+                           'core/html/HTMLTableRowsCollection.h']),
+    'MediaQueryListListener': set(['core/css/MediaQueryListListener.h']),
+    'NodeList': set(['bindings/core/dart/DartNodeList.h',
+                     'core/dom/NameNodeList.h',
+                     'core/dom/NodeList.h',
+                     'core/dom/StaticNodeList.h',
+                     'core/html/LabelsNodeList.h']),
+    'Promise': set(),
+    'SerializedScriptValue': set(),
+    'ScriptValue': set(['bindings/dart/DartScriptValue.h']),
+}
+
+
+def includes_for_type(idl_type):
+    idl_type = idl_type.preprocessed_type
+
+    # Composite types
+    array_or_sequence_type = idl_type.array_or_sequence_type
+    if array_or_sequence_type:
+        return includes_for_type(array_or_sequence_type)
+
+    # Simple types
+    base_idl_type = idl_type.base_type
+    if base_idl_type in INCLUDES_FOR_TYPE:
+        return INCLUDES_FOR_TYPE[base_idl_type]
+    if idl_type.is_basic_type:
+        return set()
+    if idl_type.is_typed_array_type:
+        # Typed array factory methods are already provided by DartUtilities.h.
+        return set([])
+    if base_idl_type.endswith('ConstructorConstructor'):
+        # FIXME: rename to NamedConstructor
+        # FIXME: replace with a [NamedConstructorAttribute] extended attribute
+        # Ending with 'ConstructorConstructor' indicates a named constructor,
+        # and these do not have header files, as they are part of the generated
+        # bindings for the interface
+        return set()
+    if base_idl_type.endswith('Constructor'):
+        # FIXME: replace with a [ConstructorAttribute] extended attribute
+        base_idl_type = idl_type.constructor_type_name
+    return set(['Dart%s.h' % base_idl_type])
+
+IdlType.includes_for_type = property(includes_for_type)
+IdlUnionType.includes_for_type = property(
+    lambda self: set.union(*[includes_for_type(member_type)
+                             for member_type in self.member_types]))
+
+
+def add_includes_for_type(idl_type):
+    includes.update(idl_type.includes_for_type)
+
+IdlType.add_includes_for_type = add_includes_for_type
+IdlUnionType.add_includes_for_type = add_includes_for_type
+
+
+def includes_for_interface(interface_name):
+    return IdlType(interface_name).includes_for_type
+
+
+def add_includes_for_interface(interface_name):
+    includes.update(includes_for_interface(interface_name))
+
+
+################################################################################
+# Dart -> C++
+################################################################################
+
+# TODO(terry): Need to fix to handle getter/setters for onEvent.
+DART_FIX_ME = 'DART_UNIMPLEMENTED(/* Conversion unimplemented*/);'
+
+# For a given IDL type, the DartHandle to C++ conversion.
+DART_TO_CPP_VALUE = {
+    # Basic
+    'Date': 'DartUtilities::dartToDate(args, {index}, exception)',
+    'DOMString': 'DartUtilities::dartToString{null_check}(args, {index}, exception, {auto_scope})',
+    'ByteString': 'DartUtilities::dartToByteString{null_check}(args, {index}, exception, {auto_scope})',
+    'ScalarValueString': 'DartUtilities::dartToScalarValueString{null_check}(args, {index}, exception, {auto_scope})',
+    'boolean': 'DartUtilities::dartToBool{null_check}(args, {index}, exception)',
+    'float': 'static_cast<float>(DartUtilities::dartToDouble(args, {index}, exception))',
+    'unrestricted float': 'static_cast<float>(DartUtilities::dartToDouble(args, {index}, exception))',
+    'double': 'DartUtilities::dartToDouble(args, {index}, exception)',
+    'unrestricted double': 'DartUtilities::dartToDouble(args, {index}, exception)',
+    # FIXME(vsm): Inconsistent with V8.
+    'byte': 'DartUtilities::dartToUnsigned(args, {index}, exception)',
+    'octet': 'DartUtilities::dartToUnsigned(args, {index}, exception)',
+    'short': 'DartUtilities::dartToInt(args, {index}, exception)',
+    'unsigned short': 'DartUtilities::dartToUnsigned(args, {index}, exception)',
+    'long': 'DartUtilities::dartToInt(args, {index}, exception)',
+    'unsigned long': 'DartUtilities::dartToUnsignedLongLong(args, {index}, exception)',
+    'long long': 'DartUtilities::dartToLongLong(args, {index}, exception)',
+    'unsigned long long': 'DartUtilities::dartToUnsignedLongLong(args, {index}, exception)',
+    # Interface types
+    'CompareHow': 'static_cast<Range::CompareHow>(0) /* FIXME, DART_TO_CPP_VALUE[CompareHow] */',
+    'Dictionary': 'DartUtilities::dartToDictionary{null_check}(args, {index}, exception)',
+    'EventTarget': '0 /* FIXME, DART_TO_CPP_VALUE[EventTarget] */',
+    'MediaQueryListListener': 'nullptr /* FIXME, DART_TO_CPP_VALUE[MediaQueryListener] */',
+    'NodeFilter': 'nullptr /* FIXME, DART_TO_CPP_VALUE[NodeFilter] */',
+    'Promise': 'nullptr /* FIXME, DART_TO_CPP_VALUE[Promise] */',
+    'SerializedScriptValue': 'nullptr /* FIXME, DART_TO_CPP_VALUE[SerializedScriptValue] */',
+    'ScriptValue': 'DartUtilities::dartToScriptValue{null_check}(args, {index})',
+    # FIXME(vsm): Why don't we have an entry for Window? V8 does.
+    # I think I removed this as the Window object is more special in V8 - it's the
+    # global context as well.  Do we need to special case it?
+    'XPathNSResolver': 'nullptr /* FIXME, DART_TO_CPP_VALUE[XPathNSResolver] */',
+    # FIXME(vsm): This is an enum type (defined in StorageQuota.idl).
+    # We should handle it automatically, but map to a String for now.
+    'StorageType': 'DartUtilities::dartToString(args, {index}, exception, {auto_scope})',
+}
+
+
+def dart_value_to_cpp_value(idl_type, interface_extended_attributes, extended_attributes, variable_name,
+                            null_check, index, auto_scope=True):
+    # Composite types
+    array_or_sequence_type = idl_type.array_or_sequence_type
+    if array_or_sequence_type:
+        return dart_value_to_cpp_value_array_or_sequence(array_or_sequence_type, variable_name, index)
+
+    # Simple types
+    idl_type = idl_type.preprocessed_type
+    add_includes_for_type(idl_type)
+    base_idl_type = idl_type.base_type
+
+    if 'EnforceRange' in extended_attributes:
+        arguments = ', '.join([variable_name, 'EnforceRange', 'exceptionState'])
+    elif idl_type.is_integer_type:  # NormalConversion
+        arguments = ', '.join([variable_name, 'es'])
+    else:
+        arguments = variable_name
+
+    if base_idl_type in DART_TO_CPP_VALUE:
+        cpp_expression_format = DART_TO_CPP_VALUE[base_idl_type]
+    elif idl_type.is_typed_array_type:
+        # FIXME(vsm): V8 generates a type check here as well. Do we need one?
+        # FIXME(vsm): When do we call the externalized version? E.g., see
+        # bindings/dart/custom/DartWaveShaperNodeCustom.cpp - it calls
+        # DartUtilities::dartToExternalizedArrayBufferView instead.
+        # V8 always converts null here
+        cpp_expression_format = ('DartUtilities::dartTo{idl_type}WithNullCheck(args, {index}, exception)')
+    elif idl_type.is_callback_interface:
+        cpp_expression_format = ('Dart{idl_type}::create{null_check}(args, {index}, exception)')
+    else:
+        cpp_expression_format = ('Dart{idl_type}::toNative{null_check}(args, {index}, exception)')
+
+    # We allow the calling context to force a null check to handle
+    # some cases that require calling context info.  V8 handles all
+    # of this differently, and we may wish to reconsider this approach
+    null_check = 'WithNullCheck' \
+        if null_check or allow_null(idl_type, interface_extended_attributes, extended_attributes) else ''
+    return cpp_expression_format.format(null_check=null_check,
+                                        arguments=arguments,
+                                        index=index,
+                                        idl_type=base_idl_type,
+                                        auto_scope=DartUtilities.bool_to_cpp(auto_scope))
+
+
+def dart_value_to_cpp_value_array_or_sequence(array_or_sequence_type, variable_name, index):
+    # Index is None for setters, index (starting at 0) for method arguments,
+    # and is used to provide a human-readable exception message
+
+    if index is None:
+        index = 0  # special case, meaning "setter"
+#    else:
+#        index += 1  # human-readable index
+    if (array_or_sequence_type.is_interface_type and
+        array_or_sequence_type.name != 'Dictionary'):
+        this_cpp_type = array_or_sequence_type.cpp_type
+        ref_ptr_type = 'Member' if array_or_sequence_type.is_will_be_garbage_collected else 'RefPtr'
+        # FIXME(vsm): We're not using ref_ptr_type....
+        expression_format = 'DartUtilities::toNativeVector<{cpp_type} >(args, {index}, {variable_name}, exception)'
+        add_includes_for_type(array_or_sequence_type)
+    else:
+        ref_ptr_type = None
+        this_cpp_type = array_or_sequence_type.cpp_type
+        expression_format = 'DartUtilities::toNativeVector<{cpp_type}>(args, {index}, {variable_name}, exception)'
+    expression = expression_format.format(array_or_sequence_type=array_or_sequence_type.name,
+                                          cpp_type=this_cpp_type, index=index, ref_ptr_type=ref_ptr_type,
+                                          variable_name=variable_name)
+    return expression
+
+
+def dart_value_to_local_cpp_value(idl_type, interface_extended_attributes, extended_attributes,
+                                  variable_name, null_check, index=None, auto_scope=True):
+    """Returns an expression that converts a Dart value to a C++ value as a local value."""
+    idl_type = idl_type.preprocessed_type
+
+    cpp_value = dart_value_to_cpp_value(
+        idl_type, interface_extended_attributes, extended_attributes,
+        variable_name, null_check, index, auto_scope)
+
+    return cpp_value
+
+IdlType.dart_value_to_local_cpp_value = dart_value_to_local_cpp_value
+IdlUnionType.dart_value_to_local_cpp_value = dart_value_to_local_cpp_value
+
+
+# Insure that we don't use C++ reserved names.  Today on default is a problem.
+def check_reserved_name(name):
+    return 'default_value' if (name == 'default') else name
+
+
+################################################################################
+# C++ -> V8
+################################################################################
+
+def preprocess_idl_type(idl_type):
+    if idl_type.is_enum:
+        # Enumerations are internally DOMStrings
+        return IdlType('DOMString')
+    if (idl_type.name == 'Any' or idl_type.is_callback_function):
+        return IdlType('ScriptValue')
+    return idl_type
+
+IdlType.preprocessed_type = property(preprocess_idl_type)
+IdlUnionType.preprocessed_type = property(preprocess_idl_type)
+
+
+def preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes):
+    """Returns IDL type and value, with preliminary type conversions applied."""
+    idl_type = idl_type.preprocessed_type
+    if idl_type.name == 'Promise':
+        idl_type = IdlType('ScriptValue')
+    # FIXME(vsm): V8 maps 'long long' and 'unsigned long long' to double
+    # as they are not representable in ECMAScript.  Should we do the same?
+
+    # HTML5 says that unsigned reflected attributes should be in the range
+    # [0, 2^31). When a value isn't in this range, a default value (or 0)
+    # should be returned instead.
+    extended_attributes = extended_attributes or {}
+    if ('Reflect' in extended_attributes and
+        idl_type.base_type in ['unsigned long', 'unsigned short']):
+        cpp_value = cpp_value.replace('getUnsignedIntegralAttribute',
+                                      'getIntegralAttribute')
+        cpp_value = 'std::max(0, %s)' % cpp_value
+    return idl_type, cpp_value
+
+
+def dart_conversion_type(idl_type, extended_attributes):
+    """Returns Dart conversion type, adding any additional includes.
+
+    The Dart conversion type is used to select the C++ -> Dart conversion function
+    or setDart*ReturnValue function; it can be an idl_type, a cpp_type, or a
+    separate name for the type of conversion (e.g., 'DOMWrapper').
+    """
+    extended_attributes = extended_attributes or {}
+
+    # Composite types
+    array_or_sequence_type = idl_type.array_or_sequence_type
+    if array_or_sequence_type:
+        if array_or_sequence_type.is_interface_type:
+            add_includes_for_type(array_or_sequence_type)
+        return 'array'
+
+    # Simple types
+    base_idl_type = idl_type.base_type
+    # Basic types, without additional includes
+    if base_idl_type in CPP_INT_TYPES or base_idl_type == 'long long':
+        return 'int'
+    if base_idl_type in CPP_UNSIGNED_TYPES or base_idl_type == 'unsigned long long':
+        return 'unsigned'
+    if base_idl_type == 'DOMString':
+        if 'TreatReturnedNullStringAs' not in extended_attributes:
+            return 'DOMString'
+        treat_returned_null_string_as = extended_attributes['TreatReturnedNullStringAs']
+        if treat_returned_null_string_as == 'Null':
+            return 'StringOrNull'
+        if treat_returned_null_string_as == 'Undefined':
+            return 'StringOrUndefined'
+        raise 'Unrecognized TreatReturnNullStringAs value: "%s"' % treat_returned_null_string_as
+    if idl_type.is_basic_type or base_idl_type == 'ScriptValue':
+        return base_idl_type
+
+    # Data type with potential additional includes
+    add_includes_for_type(idl_type)
+    if base_idl_type in DART_SET_RETURN_VALUE:  # Special dartSetReturnValue treatment
+        return base_idl_type
+
+    # Typed arrays don't have special Dart* classes for Dart.
+    if idl_type.is_typed_array_type:
+        if base_idl_type == 'ArrayBuffer':
+            return 'ArrayBuffer'
+        else:
+            return 'TypedList'
+
+    # Pointer type
+    return 'DOMWrapper'
+
+IdlType.dart_conversion_type = dart_conversion_type
+
+
+DART_SET_RETURN_VALUE = {
+    'boolean': 'Dart_SetBooleanReturnValue(args, {cpp_value})',
+    'int': 'DartUtilities::setDartIntegerReturnValue(args, {cpp_value})',
+    'unsigned': 'DartUtilities::setDartUnsignedLongLongReturnValue(args, {cpp_value})',
+    'DOMString': 'DartUtilities::setDartStringReturnValue(args, {cpp_value}, {auto_scope})',
+    # FIXME(terry): Need to handle checking to byte values > 255 throwing exception.
+    'ByteString': 'DartUtilities::setDartByteStringReturnValue(args, {cpp_value}, {auto_scope})',
+    # FIXME(terry):  Need to make valid unicode; match UTF-16 to U+FFFD REPLACEMENT CHARACTER.
+    'ScalarValueString': 'DartUtilities::setDartScalarValueStringReturnValue(args, {cpp_value}, {auto_scope})',
+    # [TreatNullReturnValueAs]
+    'StringOrNull': 'DartUtilities::setDartStringReturnValueWithNullCheck(args, {cpp_value}, {auto_scope})',
+    # FIXME(vsm): How should we handle undefined?
+    'StringOrUndefined': 'DartUtilities::setDartStringReturnValue(args, {cpp_value}, {auto_scope})',
+    'void': '',
+    # We specialize these as well in Dart.
+    'float': 'Dart_SetDoubleReturnValue(args, {cpp_value})',
+    'unrestricted float': 'Dart_SetDoubleReturnValue(args, {cpp_value})',
+    'double': 'Dart_SetDoubleReturnValue(args, {cpp_value})',
+    'unrestricted double': 'Dart_SetDoubleReturnValue(args, {cpp_value})',
+    # No special function, but instead convert value to Dart_Handle
+    # and then use general Dart_SetReturnValue.
+    'array': 'Dart_SetReturnValue(args, {cpp_value})',
+    'Date': 'Dart_SetReturnValue(args, {cpp_value})',
+    'EventHandler': DART_FIX_ME,
+    'ScriptValue': 'Dart_SetReturnValue(args, {cpp_value})',
+    'SerializedScriptValue': DART_FIX_ME,
+    # DOMWrapper
+    # TODO(terry): Remove ForMainWorld stuff.
+    'DOMWrapperForMainWorld': DART_FIX_ME,
+    # FIXME(vsm): V8 has a fast path. Do we?
+    'DOMWrapperFast': 'Dart{type_name}::returnToDart(args, WTF::getPtr({cpp_value}), {auto_scope})',
+    'DOMWrapperDefault': 'Dart{type_name}::returnToDart(args, {cpp_value}, {auto_scope})',
+    # Typed arrays don't have special Dart* classes for Dart.
+    'ArrayBuffer': 'Dart_SetReturnValue(args, DartUtilities::arrayBufferToDart({cpp_value}))',
+    'TypedList': 'Dart_SetReturnValue(args, DartUtilities::arrayBufferViewToDart({cpp_value}))',
+    'Dictionary': DART_FIX_ME,
+}
+
+
+def dart_set_return_value(idl_type, cpp_value,
+                          extended_attributes=None, script_wrappable='',
+                          release=False, for_main_world=False,
+                          auto_scope=True):
+    """Returns a statement that converts a C++ value to a Dart value and sets it as a return value.
+
+    """
+    def dom_wrapper_conversion_type():
+        if not script_wrappable:
+            return 'DOMWrapperDefault'
+        if for_main_world:
+            return 'DOMWrapperForMainWorld'
+        return 'DOMWrapperFast'
+
+    idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes)
+    this_dart_conversion_type = idl_type.dart_conversion_type(extended_attributes)
+    # SetReturn-specific overrides
+    if this_dart_conversion_type in ['Date', 'EventHandler', 'ScriptValue', 'SerializedScriptValue', 'array']:
+        # Convert value to Dart and then use general Dart_SetReturnValue
+        # FIXME(vsm): Why do we differ from V8 here? It doesn't have a
+        # creation_context.
+        creation_context = ''
+        if this_dart_conversion_type == 'array':
+            # FIXME: This is not right if the base type is a primitive, DOMString, etc.
+            # What is the right check for base type?
+            if idl_type.base_type not in DART_TO_CPP_VALUE:
+                creation_context = '<Dart%s>' % idl_type.base_type
+
+        cpp_value = idl_type.cpp_value_to_dart_value(cpp_value, creation_context=creation_context,
+                                                     extended_attributes=extended_attributes)
+    if this_dart_conversion_type == 'DOMWrapper':
+        this_dart_conversion_type = dom_wrapper_conversion_type()
+
+    format_string = DART_SET_RETURN_VALUE[this_dart_conversion_type]
+
+    if release:
+        cpp_value = '%s.release()' % cpp_value
+    statement = format_string.format(cpp_value=cpp_value,
+                                     type_name=idl_type.name,
+                                     script_wrappable=script_wrappable,
+                                     auto_scope=DartUtilities.bool_to_cpp(auto_scope))
+    return statement
+
+
+def dart_set_return_value_union(idl_type, cpp_value, extended_attributes=None,
+                              script_wrappable='', release=False, for_main_world=False,
+                              auto_scope=True):
+    """
+    release: can be either False (False for all member types) or
+             a sequence (list or tuple) of booleans (if specified individually).
+    """
+
+    return [
+        # FIXME(vsm): Why do we use 'result' instead of cpp_value as V8?
+        member_type.dart_set_return_value('result' + str(i),
+                                        extended_attributes,
+                                        script_wrappable,
+                                        release and release[i],
+                                        for_main_world,
+                                        auto_scope)
+            for i, member_type in
+            enumerate(idl_type.member_types)]
+
+IdlType.dart_set_return_value = dart_set_return_value
+IdlUnionType.dart_set_return_value = dart_set_return_value_union
+
+IdlType.release = property(lambda self: self.is_interface_type)
+IdlUnionType.release = property(
+    lambda self: [member_type.is_interface_type
+                  for member_type in self.member_types])
+
+
+CPP_VALUE_TO_DART_VALUE = {
+    # Built-in types
+    # FIXME(vsm): V8 uses DateOrNull - do we need a null check?
+    'Date': 'DartUtilities::dateToDart({cpp_value})',
+    'DOMString': 'DartUtilities::stringToDartString({cpp_value})',
+    'boolean': 'DartUtilities::boolToDart({cpp_value})',
+    'int': 'DartUtilities::intToDart({cpp_value})',
+    'unsigned': 'DartUtilities::unsignedLongLongToDart({cpp_value})',
+    'float': 'DartUtilities::doubleToDart({cpp_value})',
+    'unrestricted float': 'DartUtilities::doubleToDart({cpp_value})',
+    'double': 'DartUtilities::doubleToDart({cpp_value})',
+    'unrestricted double': 'DartUtilities::doubleToDart({cpp_value})',
+    # FIXME(vsm): Dart_Null?
+    'void': '',
+    # Special cases
+    'EventHandler': '-----OOPS TO DART-EVENT---',
+    # We need to generate the NullCheck version in some cases.
+    'ScriptValue': 'DartUtilities::scriptValueToDart({cpp_value})',
+    'SerializedScriptValue': 'DartUtilities::serializedScriptValueToDart({cpp_value})',
+    # General
+    'array': 'DartDOMWrapper::vectorToDart{creation_context}({cpp_value})',
+    'DOMWrapper': 'Dart{idl_type}::toDart({cpp_value})',
+}
+
+
+def cpp_value_to_dart_value(idl_type, cpp_value, creation_context='', extended_attributes=None):
+    """Returns an expression that converts a C++ value to a Dart value."""
+    # the isolate parameter is needed for callback interfaces
+    idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes)
+    this_dart_conversion_type = idl_type.dart_conversion_type(extended_attributes)
+    format_string = CPP_VALUE_TO_DART_VALUE[this_dart_conversion_type]
+    statement = format_string.format(
+        cpp_value=cpp_value, creation_context=creation_context,
+        idl_type=idl_type.base_type)
+    return statement
+
+IdlType.cpp_value_to_dart_value = cpp_value_to_dart_value
+
+
+# Override idl_type.name to not suffix orNull to the name, in Dart we always
+# test for null e.g.,
+#
+#      bool isNull = false;
+#      TYPE* result = receiver->GETTER(isNull);
+#      if (isNull)
+#          return;
+#
+def dart_name(idl_type):
+    """Return type name.
+
+    http://heycam.github.io/webidl/#dfn-type-name
+    """
+    base_type = idl_type.base_type
+    base_type_name = TYPE_NAMES.get(base_type, base_type)
+    if idl_type.is_array:
+        return base_type_name + 'Array'
+    if idl_type.is_sequence:
+        return base_type_name + 'Sequence'
+    return base_type_name
+
+IdlType.name = property(dart_name)
+IdlUnionType.name = property(dart_name)
+
+
+def typechecked_interface(extended_attributes):
+    return ('TypeChecking' in extended_attributes and\
+            DartUtilities.extended_attribute_value_contains(extended_attributes['TypeChecking'], 'Interface'))
+
+
+def typechecked_argument(idl_type, interface_extended_attributes, extended_attributes):
+    return (idl_type.is_wrapper_type and
+            (typechecked_interface(interface_extended_attributes) or
+            (typechecked_interface(extended_attributes))))
+
+
+# If True use the WithNullCheck version when converting.
+def allow_null(idl_type, interface_extended_attributes, extended_attributes):
+    if idl_type.base_type in ('DOMString', 'ByteString', 'ScalarValueString'):
+        # This logic is in cpp_types in v8_types.py, since they handle
+        # this using the V8StringResource type.  We handle it here
+        if (extended_attributes.get('TreatNullAs') == 'NullString' or
+            extended_attributes.get('TreatUndefinedAs') == 'NullString'):
+            return True
+
+        if extended_attributes.get('Default') == 'NullString':
+            return True
+
+        if extended_attributes.get('Default') == 'Undefined':
+            return True
+
+        if idl_type.is_nullable:
+            return True
+
+        return False
+    else:
+        # This logic is implemented in the methods.cpp template in V8
+        if (idl_type.is_nullable or
+           (not typechecked_argument(idl_type, interface_extended_attributes, extended_attributes))):
+            return True
+
+        if extended_attributes.get('Default') == 'Undefined':
+            return True
+
+        return False
diff --git a/bindings/dart/scripts/dart_utilities.py b/bindings/dart/scripts/dart_utilities.py
new file mode 100644
index 0000000..f67437b
--- /dev/null
+++ b/bindings/dart/scripts/dart_utilities.py
@@ -0,0 +1,164 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Functions shared by various parts of the code generator.
+
+Extends IdlType and IdlUnion type with |enum_validation_expression| property.
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
+"""
+
+
+################################################################################
+# Utility function exposed for Dart CodeGenerator. Only 6 methods are special
+# to Dart the rest delegate to the v8_utilities functions.
+################################################################################
+
+
+import v8_types  # Required
+import v8_utilities
+
+
+def _scoped_name(interface, definition, base_name):
+    # partial interfaces are implemented as separate classes, with their members
+    # implemented as static member functions
+    partial_interface_implemented_as = definition.extended_attributes.get('PartialInterfaceImplementedAs')
+    if partial_interface_implemented_as:
+        return '%s::%s' % (partial_interface_implemented_as, base_name)
+    if (definition.is_static or
+        definition.name in ('Constructor', 'NamedConstructor')):
+        return '%s::%s' % (v8_utilities.cpp_name(interface), base_name)
+    return 'receiver->%s' % base_name
+
+
+def _bool_to_cpp(tf):
+    return "true" if tf else "false"
+
+
+# [ActivityLogging]
+def _activity_logging_world_list(member, access_type=None):
+    """Returns a set of world suffixes for which a definition member has activity logging, for specified access type.
+
+    access_type can be 'Getter' or 'Setter' if only checking getting or setting.
+    """
+    if 'ActivityLogging' not in member.extended_attributes:
+        return set()
+    activity_logging = member.extended_attributes['ActivityLogging']
+    # [ActivityLogging=For*] (no prefix, starts with the worlds suffix) means
+    # "log for all use (method)/access (attribute)", otherwise check that value
+    # agrees with specified access_type (Getter/Setter).
+    has_logging = (activity_logging.startswith('For') or
+                   (access_type and activity_logging.startswith(access_type)))
+    if not has_logging:
+        return set()
+# TODO(terry): Remove Me?
+#    includes.add('bindings/v8/V8DOMActivityLogger.h')
+    if activity_logging.endswith('ForIsolatedWorlds'):
+        return set([''])
+    return set(['', 'ForMainWorld'])  # endswith('ForAllWorlds')
+
+
+# [CallWith]
+_CALL_WITH_ARGUMENTS = {
+    'ScriptState': '&state',
+    'ExecutionContext': 'context',
+    'ScriptArguments': 'scriptArguments.release()',
+    'ActiveWindow': 'DartUtilities::callingDomWindowForCurrentIsolate()',
+    'FirstWindow': 'DartUtilities::enteredDomWindowForCurrentIsolate()',
+}
+
+# List because key order matters, as we want arguments in deterministic order
+_CALL_WITH_VALUES = [
+    'ScriptState',
+    'ExecutionContext',
+    'ScriptArguments',
+    'ActiveWindow',
+    'FirstWindow',
+]
+
+
+def _call_with_arguments(member, call_with_values=None):
+    # Optional parameter so setter can override with [SetterCallWith]
+    call_with_values = call_with_values or member.extended_attributes.get('CallWith')
+    if not call_with_values:
+        return []
+    return [_CALL_WITH_ARGUMENTS[value]
+            for value in _CALL_WITH_VALUES
+            if v8_utilities.extended_attribute_value_contains(call_with_values, value)]
+
+
+# [DeprecateAs]
+def _deprecate_as(member):
+    extended_attributes = member.extended_attributes
+    if 'DeprecateAs' not in extended_attributes:
+        return None
+# TODO(terry): Remove me?
+#    includes.add('core/frame/UseCounter.h')
+    return extended_attributes['DeprecateAs']
+
+
+# [MeasureAs]
+def _measure_as(definition_or_member):
+    extended_attributes = definition_or_member.extended_attributes
+    if 'MeasureAs' not in extended_attributes:
+        return None
+# TODO(terry): Remove Me?
+#    includes.add('core/frame/UseCounter.h')
+    return extended_attributes['MeasureAs']
+
+
+################################################################################
+# This is the monkey patched methods most delegate to v8_utilities but some are
+# overridden in dart_utilities.
+################################################################################
+
+
+class dart_utilities_monkey():
+    def __init__(self):
+        self.base_class_name = 'dart_utilities'
+
+DartUtilities = dart_utilities_monkey()
+
+DartUtilities.activity_logging_world_list = _activity_logging_world_list
+DartUtilities.bool_to_cpp = _bool_to_cpp
+DartUtilities.call_with_arguments = _call_with_arguments
+DartUtilities.capitalize = v8_utilities.capitalize
+DartUtilities.conditional_string = v8_utilities.conditional_string
+DartUtilities.cpp_name = v8_utilities.cpp_name
+DartUtilities.deprecate_as = _deprecate_as
+DartUtilities.extended_attribute_value_contains = v8_utilities.extended_attribute_value_contains
+DartUtilities.gc_type = v8_utilities.gc_type
+DartUtilities.has_extended_attribute = v8_utilities.has_extended_attribute
+DartUtilities.has_extended_attribute_value = v8_utilities.has_extended_attribute_value
+DartUtilities.measure_as = _measure_as
+DartUtilities.per_context_enabled_function_name = v8_utilities.per_context_enabled_function_name
+DartUtilities.runtime_enabled_function_name = v8_utilities.runtime_enabled_function_name
+DartUtilities.scoped_name = _scoped_name
+DartUtilities.strip_suffix = v8_utilities.strip_suffix
+DartUtilities.uncapitalize = v8_utilities.uncapitalize
+DartUtilities.v8_class_name = v8_utilities.v8_class_name
diff --git a/bindings/dart/scripts/idl_files.py b/bindings/dart/scripts/idl_files.py
new file mode 100644
index 0000000..8a15e54
--- /dev/null
+++ b/bindings/dart/scripts/idl_files.py
@@ -0,0 +1,750 @@
+# TODO(terry): Temporary file.  Process will be driven by GYP not this file.
+# List of IDL files from Source/core/core.gypi and Source/modules/modules.gypi
+
+import os
+
+
+def full_path(paths, files):
+    full_paths = []
+    for relative_file in files:
+        correct_relative_path = os.path.join(paths[0], paths[1], relative_file)
+        full_paths.append(os.path.realpath(correct_relative_path))
+    return full_paths
+
+
+# This list is copied from Source/core/core.gypi 'core_idl_files'
+# Core IDL files bindings (.dart, .cpp and .h files) will be generated
+core_idl_files = [
+  'animation/Animation.idl',
+  'animation/AnimationEffect.idl',
+  'animation/AnimationPlayer.idl',
+  'animation/AnimationNode.idl',
+  'animation/AnimationTimeline.idl',
+  'animation/Timing.idl',
+  'clipboard/DataTransfer.idl',
+  'clipboard/DataTransferItem.idl',
+  'clipboard/DataTransferItemList.idl',
+  'css/CSS.idl',
+  'css/CSSCharsetRule.idl',
+  'css/CSSFontFaceLoadEvent.idl',
+  'css/CSSFontFaceRule.idl',
+  'css/CSSImportRule.idl',
+  'css/CSSKeyframeRule.idl',
+  'css/CSSKeyframesRule.idl',
+  'css/CSSMediaRule.idl',
+  'css/CSSPageRule.idl',
+  'css/CSSPrimitiveValue.idl',
+  'css/CSSRule.idl',
+  'css/CSSRuleList.idl',
+  'css/CSSStyleDeclaration.idl',
+  'css/CSSStyleRule.idl',
+  'css/CSSStyleSheet.idl',
+  'css/CSSSupportsRule.idl',
+  'css/CSSUnknownRule.idl',
+  'css/CSSValue.idl',
+  'css/CSSValueList.idl',
+  'css/CSSViewportRule.idl',
+  'css/Counter.idl',
+  'css/FontFace.idl',
+  'css/FontFaceSet.idl',
+  'css/FontFaceSetForEachCallback.idl',
+  'css/MediaList.idl',
+  'css/MediaQueryList.idl',
+  'css/RGBColor.idl',
+  'css/Rect.idl',
+  'css/StyleMedia.idl',
+  'css/StyleSheet.idl',
+  'css/StyleSheetList.idl',
+  'css/WebKitCSSFilterRule.idl',
+  'css/WebKitCSSFilterValue.idl',
+  'css/WebKitCSSMatrix.idl',
+  'css/WebKitCSSTransformValue.idl',
+  'dom/Attr.idl',
+  'dom/CDATASection.idl',
+  'dom/CharacterData.idl',
+  'dom/ClientRect.idl',
+  'dom/ClientRectList.idl',
+  'dom/Comment.idl',
+  'dom/DOMError.idl',
+  'dom/DOMException.idl',
+  'dom/DOMImplementation.idl',
+  'dom/DOMSettableTokenList.idl',
+  'dom/DOMStringList.idl',
+  'dom/DOMStringMap.idl',
+  'dom/DOMTokenList.idl',
+  'dom/Document.idl',
+  'dom/DocumentFragment.idl',
+  'dom/DocumentType.idl',
+  'dom/Element.idl',
+  'dom/MessageChannel.idl',
+  'dom/MessagePort.idl',
+  'dom/MutationObserver.idl',
+  'dom/MutationRecord.idl',
+  'dom/NamedNodeMap.idl',
+  'dom/Node.idl',
+  'dom/NodeFilter.idl',
+  'dom/NodeIterator.idl',
+  'dom/NodeList.idl',
+  'dom/Notation.idl',
+  'dom/ProcessingInstruction.idl',
+  'dom/Range.idl',
+  'dom/RequestAnimationFrameCallback.idl',
+  'dom/StringCallback.idl',
+  'dom/Text.idl',
+  'dom/Touch.idl',
+  'dom/TouchList.idl',
+  'dom/TreeWalker.idl',
+  'dom/URL.idl',
+  'dom/XMLDocument.idl',
+  'dom/shadow/ShadowRoot.idl',
+  'events/AnimationPlayerEvent.idl',
+  'events/ApplicationCacheErrorEvent.idl',
+  'events/AutocompleteErrorEvent.idl',
+  'events/BeforeUnloadEvent.idl',
+  'events/CompositionEvent.idl',
+  'events/CustomEvent.idl',
+  'events/ErrorEvent.idl',
+  'events/Event.idl',
+  'events/EventTarget.idl',
+  'events/FocusEvent.idl',
+  'events/HashChangeEvent.idl',
+  'events/KeyboardEvent.idl',
+  'events/MessageEvent.idl',
+  'events/MouseEvent.idl',
+  'events/MutationEvent.idl',
+  'events/OverflowEvent.idl',
+  'events/PageTransitionEvent.idl',
+  'events/PopStateEvent.idl',
+  'events/ProgressEvent.idl',
+  'events/ResourceProgressEvent.idl',
+  'events/SecurityPolicyViolationEvent.idl',
+  'events/TextEvent.idl',
+  'events/TouchEvent.idl',
+  'events/TransitionEvent.idl',
+  'events/UIEvent.idl',
+  'events/WebKitAnimationEvent.idl',
+  'events/WheelEvent.idl',
+  'fileapi/Blob.idl',
+  'fileapi/File.idl',
+  'fileapi/FileError.idl',
+  'fileapi/FileList.idl',
+  'fileapi/FileReader.idl',
+  'fileapi/FileReaderSync.idl',
+  'fileapi/Stream.idl',
+  'frame/BarProp.idl',
+  'frame/Console.idl',
+  'frame/ConsoleBase.idl',
+  'frame/History.idl',
+  'frame/ImageBitmap.idl',
+  'frame/Location.idl',
+  'frame/Navigator.idl',
+  'frame/Screen.idl',
+  'frame/WebKitPoint.idl',
+  'frame/Window.idl',
+  'html/FormData.idl',
+  'html/HTMLAllCollection.idl',
+  'html/HTMLAnchorElement.idl',
+  'html/HTMLAppletElement.idl',
+  'html/HTMLAreaElement.idl',
+  'html/HTMLAudioElement.idl',
+  'html/HTMLBRElement.idl',
+  'html/HTMLBaseElement.idl',
+  'html/HTMLBodyElement.idl',
+  'html/HTMLButtonElement.idl',
+  'html/HTMLCanvasElement.idl',
+  'html/HTMLCollection.idl',
+  'html/HTMLContentElement.idl',
+  'html/HTMLDListElement.idl',
+  'html/HTMLDataListElement.idl',
+  'html/HTMLDetailsElement.idl',
+  'html/HTMLDialogElement.idl',
+  'html/HTMLDirectoryElement.idl',
+  'html/HTMLDivElement.idl',
+  'html/HTMLDocument.idl',
+  'html/HTMLElement.idl',
+  'html/HTMLEmbedElement.idl',
+  'html/HTMLFieldSetElement.idl',
+  'html/HTMLFontElement.idl',
+  'html/HTMLFormControlsCollection.idl',
+  'html/HTMLFormElement.idl',
+  'html/HTMLFrameElement.idl',
+  'html/HTMLFrameSetElement.idl',
+  'html/HTMLHRElement.idl',
+  'html/HTMLHeadElement.idl',
+  'html/HTMLHeadingElement.idl',
+  'html/HTMLHtmlElement.idl',
+  'html/HTMLIFrameElement.idl',
+  'html/HTMLImageElement.idl',
+  'html/HTMLInputElement.idl',
+  'html/HTMLKeygenElement.idl',
+  'html/HTMLLIElement.idl',
+  'html/HTMLLabelElement.idl',
+  'html/HTMLLegendElement.idl',
+  'html/HTMLLinkElement.idl',
+  'html/HTMLMapElement.idl',
+  'html/HTMLMarqueeElement.idl',
+  'html/HTMLMediaElement.idl',
+  'html/HTMLMenuElement.idl',
+  'html/HTMLMetaElement.idl',
+  'html/HTMLMeterElement.idl',
+  'html/HTMLModElement.idl',
+  'html/HTMLOListElement.idl',
+  'html/HTMLObjectElement.idl',
+  'html/HTMLOptGroupElement.idl',
+  'html/HTMLOptionElement.idl',
+  'html/HTMLOptionsCollection.idl',
+  'html/HTMLOutputElement.idl',
+  'html/HTMLParagraphElement.idl',
+  'html/HTMLParamElement.idl',
+  'html/HTMLPictureElement.idl',
+  'html/HTMLPreElement.idl',
+  'html/HTMLProgressElement.idl',
+  'html/HTMLQuoteElement.idl',
+  'html/HTMLScriptElement.idl',
+  'html/HTMLSelectElement.idl',
+  'html/HTMLShadowElement.idl',
+  'html/HTMLSourceElement.idl',
+  'html/HTMLSpanElement.idl',
+  'html/HTMLStyleElement.idl',
+  'html/HTMLTableCaptionElement.idl',
+  'html/HTMLTableCellElement.idl',
+  'html/HTMLTableColElement.idl',
+  'html/HTMLTableElement.idl',
+  'html/HTMLTableRowElement.idl',
+  'html/HTMLTableSectionElement.idl',
+  'html/HTMLTemplateElement.idl',
+  'html/HTMLTextAreaElement.idl',
+  'html/HTMLTitleElement.idl',
+  'html/HTMLTrackElement.idl',
+  'html/HTMLUListElement.idl',
+  'html/HTMLUnknownElement.idl',
+  'html/HTMLVideoElement.idl',
+  'html/ImageData.idl',
+  'html/MediaController.idl',
+  'html/MediaError.idl',
+  'html/MediaKeyError.idl',
+  'html/MediaKeyEvent.idl',
+  'html/RadioNodeList.idl',
+  'html/TextMetrics.idl',
+  'html/TimeRanges.idl',
+  'html/ValidityState.idl',
+  'html/VoidCallback.idl',
+  'html/canvas/ANGLEInstancedArrays.idl',
+  'html/canvas/Canvas2DContextAttributes.idl',
+  'html/canvas/CanvasGradient.idl',
+  'html/canvas/CanvasPattern.idl',
+  'html/canvas/CanvasRenderingContext2D.idl',
+  'html/canvas/EXTBlendMinMax.idl',
+  'html/canvas/EXTFragDepth.idl',
+  'html/canvas/EXTShaderTextureLOD.idl',
+  'html/canvas/EXTTextureFilterAnisotropic.idl',
+  'html/canvas/OESElementIndexUint.idl',
+  'html/canvas/OESStandardDerivatives.idl',
+  'html/canvas/OESTextureFloat.idl',
+  'html/canvas/OESTextureFloatLinear.idl',
+  'html/canvas/OESTextureHalfFloat.idl',
+  'html/canvas/OESTextureHalfFloatLinear.idl',
+  'html/canvas/OESVertexArrayObject.idl',
+  'html/canvas/Path2D.idl',
+  'html/canvas/WebGLActiveInfo.idl',
+  'html/canvas/WebGLBuffer.idl',
+  'html/canvas/WebGLCompressedTextureATC.idl',
+  'html/canvas/WebGLCompressedTextureETC1.idl',
+  'html/canvas/WebGLCompressedTexturePVRTC.idl',
+  'html/canvas/WebGLCompressedTextureS3TC.idl',
+  'html/canvas/WebGLContextAttributes.idl',
+  'html/canvas/WebGLContextEvent.idl',
+  'html/canvas/WebGLDebugRendererInfo.idl',
+  'html/canvas/WebGLDebugShaders.idl',
+  'html/canvas/WebGLDepthTexture.idl',
+  'html/canvas/WebGLDrawBuffers.idl',
+  'html/canvas/WebGLFramebuffer.idl',
+  'html/canvas/WebGLLoseContext.idl',
+  'html/canvas/WebGLProgram.idl',
+  'html/canvas/WebGLRenderbuffer.idl',
+  'html/canvas/WebGLRenderingContext.idl',
+  'html/canvas/WebGLShader.idl',
+  'html/canvas/WebGLShaderPrecisionFormat.idl',
+  'html/canvas/WebGLTexture.idl',
+  'html/canvas/WebGLUniformLocation.idl',
+  'html/canvas/WebGLVertexArrayObjectOES.idl',
+  'html/ime/InputMethodContext.idl',
+  'html/track/AudioTrack.idl',
+  'html/track/AudioTrackList.idl',
+  'html/track/TextTrack.idl',
+  'html/track/TextTrackCue.idl',
+  'html/track/TextTrackCueList.idl',
+  'html/track/TextTrackList.idl',
+  'html/track/TrackEvent.idl',
+  'html/track/VideoTrack.idl',
+  'html/track/VideoTrackList.idl',
+  'html/track/vtt/VTTCue.idl',
+  'html/track/vtt/VTTRegion.idl',
+  'html/track/vtt/VTTRegionList.idl',
+  'inspector/InjectedScriptHost.idl',
+  'inspector/InspectorFrontendHost.idl',
+  'inspector/InspectorOverlayHost.idl',
+  'inspector/JavaScriptCallFrame.idl',
+  'loader/appcache/ApplicationCache.idl',
+  'page/EventSource.idl',
+  'page/PagePopupController.idl',
+  'page/Selection.idl',
+  'plugins/MimeType.idl',
+  'plugins/MimeTypeArray.idl',
+  'plugins/Plugin.idl',
+  'plugins/PluginArray.idl',
+  'storage/Storage.idl',
+  'storage/StorageEvent.idl',
+  'svg/SVGAElement.idl',
+  'svg/SVGAltGlyphDefElement.idl',
+  'svg/SVGAltGlyphElement.idl',
+  'svg/SVGAltGlyphItemElement.idl',
+  'svg/SVGAngle.idl',
+  'svg/SVGAnimateElement.idl',
+  'svg/SVGAnimateMotionElement.idl',
+  'svg/SVGAnimateTransformElement.idl',
+  'svg/SVGAnimatedAngle.idl',
+  'svg/SVGAnimatedBoolean.idl',
+  'svg/SVGAnimatedEnumeration.idl',
+  'svg/SVGAnimatedInteger.idl',
+  'svg/SVGAnimatedLength.idl',
+  'svg/SVGAnimatedLengthList.idl',
+  'svg/SVGAnimatedNumber.idl',
+  'svg/SVGAnimatedNumberList.idl',
+  'svg/SVGAnimatedPreserveAspectRatio.idl',
+  'svg/SVGAnimatedRect.idl',
+  'svg/SVGAnimatedString.idl',
+  'svg/SVGAnimatedTransformList.idl',
+  'svg/SVGAnimationElement.idl',
+  'svg/SVGCircleElement.idl',
+  'svg/SVGClipPathElement.idl',
+  'svg/SVGComponentTransferFunctionElement.idl',
+  'svg/SVGCursorElement.idl',
+  'svg/SVGDefsElement.idl',
+  'svg/SVGDescElement.idl',
+  'svg/SVGDiscardElement.idl',
+  'svg/SVGElement.idl',
+  'svg/SVGEllipseElement.idl',
+  'svg/SVGFEBlendElement.idl',
+  'svg/SVGFEColorMatrixElement.idl',
+  'svg/SVGFEComponentTransferElement.idl',
+  'svg/SVGFECompositeElement.idl',
+  'svg/SVGFEConvolveMatrixElement.idl',
+  'svg/SVGFEDiffuseLightingElement.idl',
+  'svg/SVGFEDisplacementMapElement.idl',
+  'svg/SVGFEDistantLightElement.idl',
+  'svg/SVGFEDropShadowElement.idl',
+  'svg/SVGFEFloodElement.idl',
+  'svg/SVGFEFuncAElement.idl',
+  'svg/SVGFEFuncBElement.idl',
+  'svg/SVGFEFuncGElement.idl',
+  'svg/SVGFEFuncRElement.idl',
+  'svg/SVGFEGaussianBlurElement.idl',
+  'svg/SVGFEImageElement.idl',
+  'svg/SVGFEMergeElement.idl',
+  'svg/SVGFEMergeNodeElement.idl',
+  'svg/SVGFEMorphologyElement.idl',
+  'svg/SVGFEOffsetElement.idl',
+  'svg/SVGFEPointLightElement.idl',
+  'svg/SVGFESpecularLightingElement.idl',
+  'svg/SVGFESpotLightElement.idl',
+  'svg/SVGFETileElement.idl',
+  'svg/SVGFETurbulenceElement.idl',
+  'svg/SVGFilterElement.idl',
+  'svg/SVGFontElement.idl',
+  'svg/SVGFontFaceElement.idl',
+  'svg/SVGFontFaceFormatElement.idl',
+  'svg/SVGFontFaceNameElement.idl',
+  'svg/SVGFontFaceSrcElement.idl',
+  'svg/SVGFontFaceUriElement.idl',
+  'svg/SVGForeignObjectElement.idl',
+  'svg/SVGGElement.idl',
+  'svg/SVGGeometryElement.idl',
+  'svg/SVGGlyphElement.idl',
+  'svg/SVGGlyphRefElement.idl',
+  'svg/SVGGradientElement.idl',
+  'svg/SVGGraphicsElement.idl',
+  'svg/SVGHKernElement.idl',
+  'svg/SVGImageElement.idl',
+  'svg/SVGLength.idl',
+  'svg/SVGLengthList.idl',
+  'svg/SVGLineElement.idl',
+  'svg/SVGLinearGradientElement.idl',
+  'svg/SVGMPathElement.idl',
+  'svg/SVGMarkerElement.idl',
+  'svg/SVGMaskElement.idl',
+  'svg/SVGMatrix.idl',
+  'svg/SVGMetadataElement.idl',
+  'svg/SVGMissingGlyphElement.idl',
+  'svg/SVGNumber.idl',
+  'svg/SVGNumberList.idl',
+  'svg/SVGPathElement.idl',
+  'svg/SVGPathSeg.idl',
+  'svg/SVGPathSegArcAbs.idl',
+  'svg/SVGPathSegArcRel.idl',
+  'svg/SVGPathSegClosePath.idl',
+  'svg/SVGPathSegCurvetoCubicAbs.idl',
+  'svg/SVGPathSegCurvetoCubicRel.idl',
+  'svg/SVGPathSegCurvetoCubicSmoothAbs.idl',
+  'svg/SVGPathSegCurvetoCubicSmoothRel.idl',
+  'svg/SVGPathSegCurvetoQuadraticAbs.idl',
+  'svg/SVGPathSegCurvetoQuadraticRel.idl',
+  'svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl',
+  'svg/SVGPathSegCurvetoQuadraticSmoothRel.idl',
+  'svg/SVGPathSegLinetoAbs.idl',
+  'svg/SVGPathSegLinetoHorizontalAbs.idl',
+  'svg/SVGPathSegLinetoHorizontalRel.idl',
+  'svg/SVGPathSegLinetoRel.idl',
+  'svg/SVGPathSegLinetoVerticalAbs.idl',
+  'svg/SVGPathSegLinetoVerticalRel.idl',
+  'svg/SVGPathSegList.idl',
+  'svg/SVGPathSegMovetoAbs.idl',
+  'svg/SVGPathSegMovetoRel.idl',
+  'svg/SVGPatternElement.idl',
+  'svg/SVGPoint.idl',
+  'svg/SVGPointList.idl',
+  'svg/SVGPolygonElement.idl',
+  'svg/SVGPolylineElement.idl',
+  'svg/SVGPreserveAspectRatio.idl',
+  'svg/SVGRadialGradientElement.idl',
+  'svg/SVGRect.idl',
+  'svg/SVGRectElement.idl',
+  'svg/SVGRenderingIntent.idl',
+  'svg/SVGSVGElement.idl',
+  'svg/SVGScriptElement.idl',
+  'svg/SVGSetElement.idl',
+  'svg/SVGStopElement.idl',
+  'svg/SVGStringList.idl',
+  'svg/SVGStyleElement.idl',
+  'svg/SVGSwitchElement.idl',
+  'svg/SVGSymbolElement.idl',
+  'svg/SVGTSpanElement.idl',
+  'svg/SVGTextContentElement.idl',
+  'svg/SVGTextElement.idl',
+  'svg/SVGTextPathElement.idl',
+  'svg/SVGTextPositioningElement.idl',
+  'svg/SVGTitleElement.idl',
+  'svg/SVGTransform.idl',
+  'svg/SVGTransformList.idl',
+  'svg/SVGUnitTypes.idl',
+  'svg/SVGUseElement.idl',
+  'svg/SVGVKernElement.idl',
+  'svg/SVGViewElement.idl',
+  'svg/SVGViewSpec.idl',
+  'svg/SVGZoomEvent.idl',
+  'timing/MemoryInfo.idl',
+  'timing/Performance.idl',
+  'timing/PerformanceEntry.idl',
+  'timing/PerformanceMark.idl',
+  'timing/PerformanceMeasure.idl',
+  'timing/PerformanceNavigation.idl',
+  'timing/PerformanceResourceTiming.idl',
+  'timing/PerformanceTiming.idl',
+  'workers/DedicatedWorkerGlobalScope.idl',
+  'workers/SharedWorker.idl',
+  'workers/SharedWorkerGlobalScope.idl',
+  'workers/Worker.idl',
+  'workers/WorkerConsole.idl',
+  'workers/WorkerGlobalScope.idl',
+  'workers/WorkerLocation.idl',
+  'workers/WorkerNavigator.idl',
+  'xml/DOMParser.idl',
+  'xml/XMLHttpRequest.idl',
+  'xml/XMLHttpRequestEventTarget.idl',
+  'xml/XMLHttpRequestProgressEvent.idl',
+  'xml/XMLHttpRequestUpload.idl',
+  'xml/XMLSerializer.idl',
+  'xml/XPathEvaluator.idl',
+  'xml/XPathExpression.idl',
+  'xml/XPathNSResolver.idl',
+  'xml/XPathResult.idl',
+  'xml/XSLTProcessor.idl',
+]
+
+
+def full_path_core_idl_files():
+    return full_path(['Source', 'core'], core_idl_files)
+
+
+# This list is copied from Source/core/core.gypi 'core_dependency_idl_files'
+# 'partial interface' or target (right side of) 'implements'
+core_dependency_idl_files = [
+  'animation/DocumentAnimation.idl',
+  'animation/ElementAnimation.idl',
+  'css/DocumentFontFaceSet.idl',
+  'dom/ChildNode.idl',
+  'dom/DocumentFullscreen.idl',
+  'dom/GlobalEventHandlers.idl',
+  'dom/ParentNode.idl',
+  'dom/URLUtils.idl',
+  'dom/URLUtilsReadOnly.idl',
+  'events/EventListener.idl',
+  'events/NavigatorEvents.idl',
+  'frame/NavigatorCPU.idl',
+  'frame/NavigatorID.idl',
+  'frame/NavigatorLanguage.idl',
+  'frame/NavigatorOnLine.idl',
+  'frame/WindowBase64.idl',
+  'frame/WindowEventHandlers.idl',
+  'frame/WindowTimers.idl',
+  'html/canvas/CanvasPathMethods.idl',
+  'html/canvas/WebGLRenderingContextBase.idl',
+  'page/WindowPagePopup.idl',
+  'svg/SVGDocument.idl',
+  'svg/SVGFilterPrimitiveStandardAttributes.idl',
+  'svg/SVGFitToViewBox.idl',
+  'svg/SVGTests.idl',
+  'svg/SVGURIReference.idl',
+  'svg/SVGZoomAndPan.idl',
+  'workers/AbstractWorker.idl',
+  'xml/DocumentXPathEvaluator.idl',
+]
+
+
+def full_path_core_dependency_idl_files():
+    return full_path(['Source', 'core'], core_dependency_idl_files)
+
+
+# This list is copied from Source/modules/modules.gypi 'modules_idl_files'
+# Modules IDL files bindings (.dart, .cpp and .h files) will be generated
+modules_idl_files = [
+  'battery/BatteryManager.idl',
+  'crypto/AesKeyAlgorithm.idl',
+  'crypto/Crypto.idl',
+  'crypto/HmacKeyAlgorithm.idl',
+  'crypto/Key.idl',
+  'crypto/KeyAlgorithm.idl',
+  'crypto/RsaHashedKeyAlgorithm.idl',
+  'crypto/RsaKeyAlgorithm.idl',
+  'crypto/SubtleCrypto.idl',
+  'device_light/DeviceLightEvent.idl',
+  'device_orientation/DeviceAcceleration.idl',
+  'device_orientation/DeviceMotionEvent.idl',
+  'device_orientation/DeviceOrientationEvent.idl',
+  'device_orientation/DeviceRotationRate.idl',
+  'encoding/TextDecoder.idl',
+  'encoding/TextEncoder.idl',
+  'encryptedmedia/MediaKeyMessageEvent.idl',
+  'encryptedmedia/MediaKeyNeededEvent.idl',
+  'encryptedmedia/MediaKeySession.idl',
+  'encryptedmedia/MediaKeys.idl',
+  'filesystem/DOMFileSystem.idl',
+  'filesystem/DOMFileSystemSync.idl',
+  'filesystem/DirectoryEntry.idl',
+  'filesystem/DirectoryEntrySync.idl',
+  'filesystem/DirectoryReader.idl',
+  'filesystem/DirectoryReaderSync.idl',
+  'filesystem/EntriesCallback.idl',
+  'filesystem/Entry.idl',
+  'filesystem/EntryCallback.idl',
+  'filesystem/EntrySync.idl',
+  'filesystem/ErrorCallback.idl',
+  'filesystem/FileCallback.idl',
+  'filesystem/FileEntry.idl',
+  'filesystem/FileEntrySync.idl',
+  'filesystem/FileSystemCallback.idl',
+  'filesystem/FileWriter.idl',
+  'filesystem/FileWriterCallback.idl',
+  'filesystem/FileWriterSync.idl',
+  'filesystem/Metadata.idl',
+  'filesystem/MetadataCallback.idl',
+  'gamepad/Gamepad.idl',
+  'gamepad/GamepadButton.idl',
+  'gamepad/GamepadEvent.idl',
+  'gamepad/GamepadList.idl',
+  'gamepad/WebKitGamepad.idl',
+  'gamepad/WebKitGamepadList.idl',
+  'geolocation/Coordinates.idl',
+  'geolocation/Geolocation.idl',
+  'geolocation/Geoposition.idl',
+  'geolocation/PositionCallback.idl',
+  'geolocation/PositionError.idl',
+  'geolocation/PositionErrorCallback.idl',
+  'indexeddb/IDBCursor.idl',
+  'indexeddb/IDBCursorWithValue.idl',
+  'indexeddb/IDBDatabase.idl',
+  'indexeddb/IDBFactory.idl',
+  'indexeddb/IDBIndex.idl',
+  'indexeddb/IDBKeyRange.idl',
+  'indexeddb/IDBObjectStore.idl',
+  'indexeddb/IDBOpenDBRequest.idl',
+  'indexeddb/IDBRequest.idl',
+  'indexeddb/IDBTransaction.idl',
+  'indexeddb/IDBVersionChangeEvent.idl',
+  'mediasource/MediaSource.idl',
+  'mediasource/SourceBuffer.idl',
+  'mediasource/SourceBufferList.idl',
+  'mediasource/VideoPlaybackQuality.idl',
+  'mediastream/MediaDeviceInfo.idl',
+  'mediastream/MediaDeviceInfoCallback.idl',
+  'mediastream/MediaStream.idl',
+  'mediastream/MediaStreamEvent.idl',
+  'mediastream/MediaStreamTrack.idl',
+  'mediastream/MediaStreamTrackEvent.idl',
+  'mediastream/MediaStreamTrackSourcesCallback.idl',
+  'mediastream/NavigatorUserMediaError.idl',
+  'mediastream/NavigatorUserMediaErrorCallback.idl',
+  'mediastream/NavigatorUserMediaSuccessCallback.idl',
+  'mediastream/RTCDTMFSender.idl',
+  'mediastream/RTCDTMFToneChangeEvent.idl',
+  'mediastream/RTCDataChannel.idl',
+  'mediastream/RTCDataChannelEvent.idl',
+  'mediastream/RTCErrorCallback.idl',
+  'mediastream/RTCIceCandidate.idl',
+  'mediastream/RTCIceCandidateEvent.idl',
+  'mediastream/RTCPeerConnection.idl',
+  'mediastream/RTCSessionDescription.idl',
+  'mediastream/RTCSessionDescriptionCallback.idl',
+  'mediastream/RTCStatsCallback.idl',
+  'mediastream/RTCStatsReport.idl',
+  'mediastream/RTCStatsResponse.idl',
+  'mediastream/SourceInfo.idl',
+  'netinfo/NetworkInformation.idl',
+  'notifications/Notification.idl',
+  'notifications/NotificationPermissionCallback.idl',
+  'performance/WorkerPerformance.idl',
+  'push_messaging/PushEvent.idl',
+  'push_messaging/PushManager.idl',
+  'push_messaging/PushRegistration.idl',
+  'quota/DeprecatedStorageInfo.idl',
+  'quota/DeprecatedStorageQuota.idl',
+  'quota/StorageErrorCallback.idl',
+  'quota/StorageInfo.idl',
+  'quota/StorageQuota.idl',
+  'quota/StorageQuotaCallback.idl',
+  'quota/StorageUsageCallback.idl',
+  'serviceworkers/Client.idl',
+  'serviceworkers/FetchEvent.idl',
+  'serviceworkers/HeaderMap.idl',
+  'serviceworkers/HeaderMapForEachCallback.idl',
+  'serviceworkers/InstallEvent.idl',
+  'serviceworkers/InstallPhaseEvent.idl',
+  'serviceworkers/Request.idl',
+  'serviceworkers/Response.idl',
+  'serviceworkers/ServiceWorker.idl',
+  'serviceworkers/ServiceWorkerClients.idl',
+  'serviceworkers/ServiceWorkerContainer.idl',
+  'serviceworkers/ServiceWorkerGlobalScope.idl',
+  'speech/SpeechGrammar.idl',
+  'speech/SpeechGrammarList.idl',
+  'speech/SpeechRecognition.idl',
+  'speech/SpeechRecognitionAlternative.idl',
+  'speech/SpeechRecognitionError.idl',
+  'speech/SpeechRecognitionEvent.idl',
+  'speech/SpeechRecognitionResult.idl',
+  'speech/SpeechRecognitionResultList.idl',
+  'speech/SpeechSynthesis.idl',
+  'speech/SpeechSynthesisEvent.idl',
+  'speech/SpeechSynthesisUtterance.idl',
+  'speech/SpeechSynthesisVoice.idl',
+  'webaudio/AnalyserNode.idl',
+  'webaudio/AudioBuffer.idl',
+  'webaudio/AudioBufferCallback.idl',
+  'webaudio/AudioBufferSourceNode.idl',
+  'webaudio/AudioContext.idl',
+  'webaudio/AudioDestinationNode.idl',
+  'webaudio/AudioListener.idl',
+  'webaudio/AudioNode.idl',
+  'webaudio/AudioParam.idl',
+  'webaudio/AudioProcessingEvent.idl',
+  'webaudio/AudioSourceNode.idl',
+  'webaudio/BiquadFilterNode.idl',
+  'webaudio/ChannelMergerNode.idl',
+  'webaudio/ChannelSplitterNode.idl',
+  'webaudio/ConvolverNode.idl',
+  'webaudio/DelayNode.idl',
+  'webaudio/DynamicsCompressorNode.idl',
+  'webaudio/GainNode.idl',
+  'webaudio/MediaElementAudioSourceNode.idl',
+  'webaudio/MediaStreamAudioDestinationNode.idl',
+  'webaudio/MediaStreamAudioSourceNode.idl',
+  'webaudio/OfflineAudioCompletionEvent.idl',
+  'webaudio/OfflineAudioContext.idl',
+  'webaudio/OscillatorNode.idl',
+  'webaudio/PannerNode.idl',
+  'webaudio/PeriodicWave.idl',
+  'webaudio/ScriptProcessorNode.idl',
+  'webaudio/WaveShaperNode.idl',
+  'webdatabase/Database.idl',
+  'webdatabase/DatabaseCallback.idl',
+  'webdatabase/DatabaseSync.idl',
+  'webdatabase/SQLError.idl',
+  'webdatabase/SQLResultSet.idl',
+  'webdatabase/SQLResultSetRowList.idl',
+  'webdatabase/SQLStatementCallback.idl',
+  'webdatabase/SQLStatementErrorCallback.idl',
+  'webdatabase/SQLTransaction.idl',
+  'webdatabase/SQLTransactionCallback.idl',
+  'webdatabase/SQLTransactionErrorCallback.idl',
+  'webdatabase/SQLTransactionSync.idl',
+  'webdatabase/SQLTransactionSyncCallback.idl',
+  'webmidi/MIDIAccess.idl',
+  'webmidi/MIDIConnectionEvent.idl',
+  'webmidi/MIDIErrorCallback.idl',
+  'webmidi/MIDIInput.idl',
+  'webmidi/MIDIMessageEvent.idl',
+  'webmidi/MIDIOutput.idl',
+  'webmidi/MIDIPort.idl',
+  'webmidi/MIDISuccessCallback.idl',
+  'websockets/CloseEvent.idl',
+  'websockets/WebSocket.idl',
+]
+
+
+def full_path_modules_idl_files():
+    return full_path(['Source', 'modules'], modules_idl_files)
+
+
+# This list is copied from Source/modules/modules.gypi
+# 'modules_dependency_idl_files'.
+# 'partial interface' or target (right side of) 'implements'
+modules_dependency_idl_files = [
+  'battery/NavigatorBattery.idl',
+  'beacon/NavigatorBeacon.idl',
+  'crypto/WindowCrypto.idl',
+  'crypto/WorkerGlobalScopeCrypto.idl',
+  'device_light/WindowDeviceLight.idl',
+  'device_orientation/WindowDeviceMotion.idl',
+  'device_orientation/WindowDeviceOrientation.idl',
+  'donottrack/NavigatorDoNotTrack.idl',
+  'encryptedmedia/HTMLMediaElementEncryptedMedia.idl',
+  'filesystem/DataTransferItemFileSystem.idl',
+  'filesystem/HTMLInputElementFileSystem.idl',
+  'filesystem/InspectorFrontendHostFileSystem.idl',
+  'filesystem/WindowFileSystem.idl',
+  'filesystem/WorkerGlobalScopeFileSystem.idl',
+  'gamepad/NavigatorGamepad.idl',
+  'geolocation/NavigatorGeolocation.idl',
+  'imagebitmap/ImageBitmapFactories.idl',
+  'imagebitmap/WindowImageBitmapFactories.idl',
+  'indexeddb/WindowIndexedDatabase.idl',
+  'indexeddb/WorkerGlobalScopeIndexedDatabase.idl',
+  'mediasource/HTMLVideoElementMediaSource.idl',
+  'mediasource/URLMediaSource.idl',
+  'mediastream/NavigatorMediaStream.idl',
+  'mediastream/URLMediaStream.idl',
+  'mediastream/WindowMediaStream.idl',
+  'navigatorcontentutils/NavigatorContentUtils.idl',
+  'netinfo/NavigatorNetworkInformation.idl',
+  'netinfo/WorkerNavigatorNetworkInformation.idl',
+  'performance/SharedWorkerPerformance.idl',
+  'performance/WorkerGlobalScopePerformance.idl',
+  'push_messaging/NavigatorPushManager.idl',
+  'push_messaging/ServiceWorkerGlobalScopePush.idl',
+  'quota/NavigatorStorageQuota.idl',
+  'quota/WindowQuota.idl',
+  'quota/WorkerNavigatorStorageQuota.idl',
+  'screen_orientation/ScreenOrientation.idl',
+  'serviceworkers/NavigatorServiceWorker.idl',
+  'speech/WindowSpeech.idl',
+  'speech/WindowSpeechSynthesis.idl',
+  'vibration/NavigatorVibration.idl',
+  'webaudio/WindowWebAudio.idl',
+  'webdatabase/WindowWebDatabase.idl',
+  'webdatabase/WorkerGlobalScopeWebDatabase.idl',
+  'webmidi/NavigatorWebMIDI.idl',
+]
+
+
+def full_path_modules_dependency_idl_files():
+    return full_path(['Source', 'modules'], modules_dependency_idl_files)
diff --git a/bindings/dart/scripts/test/__init__.py b/bindings/dart/scripts/test/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bindings/dart/scripts/test/__init__.py
diff --git a/bindings/dart/scripts/test/main.py b/bindings/dart/scripts/test/main.py
new file mode 100755
index 0000000..db3c00a
--- /dev/null
+++ b/bindings/dart/scripts/test/main.py
@@ -0,0 +1,247 @@
+#!/usr/bin/python
+# Copyright (C) 2010 Google Inc.  All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+import traceback
+
+import fnmatch
+from optparse import OptionParser
+import os
+import shutil
+import sys
+import tempfile
+
+import compute_interfaces_info_individual
+from compute_interfaces_info_individual import compute_info_individual, info_individual
+import compute_interfaces_info_overall
+from compute_interfaces_info_overall import compute_interfaces_info_overall, interfaces_info
+from compiler import IdlCompilerDart
+
+# TODO(terry): Temporary solution list of IDLs to parse and IDL as dependencies.
+from idl_files import full_path_core_idl_files, full_path_core_dependency_idl_files, full_path_modules_idl_files, full_path_modules_dependency_idl_files
+
+#from dart_tests import run_dart_tests
+
+
+EXTENDED_ATTRIBUTES_FILE = 'bindings/IDLExtendedAttributes.txt'
+
+idl_compiler = None
+
+
+def parse_options():
+    parser = OptionParser()
+
+    parser.add_option("--output-directory",
+                      action="store",
+                      type="string",
+                      dest="output_directory",
+                      help="Generate output to a known directory")
+    parser.add_option("-v", "--verbose",
+                      action="store_true",
+                      dest="verbose",
+                      default=False,
+                      help="Show all information messages")
+    parser.add_option("-k", "--keep",
+                      action="store_true",
+                      dest="keep",
+                      default=False,
+                      help="Don't delete the temporary directory on exit")
+    parser.add_option("--compute-idls", type='int', help="Compile IDLs interfaces and dependencies (GYP)")
+    parser.add_option('--globals-only', type='int', help="Generate the globals")
+
+    options, args = parser.parse_args()
+
+    options.compute_idls = bool(options.compute_idls)
+    options.globals_only = bool(options.globals_only)
+
+    return options
+
+
+class ScopedTempFileProvider(object):
+    def __init__(self, keep=False):
+        self.keep = keep
+        self.dir_paths = []
+
+    def __enter__(self):
+        return self
+
+    def __exit__(self, exc_type, exc_value, traceback):
+        if not self.keep:
+            for dir_path in self.dir_paths:
+                # Temporary directories are used as output directories, so they
+                # contains unknown files (they aren't empty), hence use rmtree
+                shutil.rmtree(dir_path)
+
+    def new_temp_dir(self):
+        dir_path = tempfile.mkdtemp()
+        self.dir_paths.append(dir_path)
+        return dir_path
+
+
+class DirectoryProvider(object):
+    def __init__(self, path=""):
+        self.dir_path = path
+
+    def __enter__(self):
+        return self
+
+    def new_temp_dir(self):
+        return self.dir_path
+
+
+def idl_paths_recursive(directory):
+    idl_paths = []
+    for dirpath, _, files in os.walk(directory):
+        idl_paths.extend(os.path.join(dirpath, filename)
+                         for filename in fnmatch.filter(files, '*.idl'))
+    return idl_paths
+
+
+class Build():
+    def __init__(self, provider):
+        self.output_directory = provider.new_temp_dir()
+
+        attrib_file = os.path.join('Source', EXTENDED_ATTRIBUTES_FILE)
+        # Create compiler.
+        self.idl_compiler = IdlCompilerDart(self.output_directory,
+                                            attrib_file,
+                                            interfaces_info=interfaces_info,
+                                            only_if_changed=True)
+
+    def format_exception(self, e):
+        exception_list = traceback.format_stack()
+        exception_list = exception_list[:-2]
+        exception_list.extend(traceback.format_tb(sys.exc_info()[2]))
+        exception_list.extend(traceback.format_exception_only(sys.exc_info()[0], sys.exc_info()[1]))
+
+        exception_str = "Traceback (most recent call last):\n"
+        exception_str += "".join(exception_list)
+        # Removing the last \n
+        exception_str = exception_str[:-1]
+
+        return exception_str
+
+    def generate_from_idl(self, idl_file):
+        try:
+            idl_file_fullpath = os.path.realpath(idl_file)
+            self.idl_compiler.compile_file(idl_file_fullpath)
+        except Exception as err:
+            print 'ERROR: idl_compiler.py: ' + os.path.basename(idl_file)
+            print err
+            print
+            print 'Stack Dump:'
+            print self.format_exception(err)
+
+            return 1
+
+    def generate_global(self):
+        try:
+            self.idl_compiler.generate_global()
+        except Exception as err:
+            print 'ERROR: idl_compiler.py generate global'
+            print err
+            print
+            print 'Stack Dump:'
+            print self.format_exception(err)
+
+            return 1
+
+        return 0
+
+
+def main(argv):
+    '''
+    Runs Dart IDL code generator; IDL files.  IDL files same as GYP files in
+    Source/bindings/core/core.gypi and Source/bindings/modules/modules.gypi (see
+    idl_files.py on list of files).
+
+    To run the PYTHONPATH should have the directories:
+
+        Source/bindings/scripts
+        Source/bindings/scripts/dart
+    '''
+
+    options = parse_options()
+
+    if options.compute_idls:
+        # TODO(terry): Assumes CWD is third_party/WebKit so any call to
+        # full_path_NNNN is prefixing 'Source/core' to path.
+        core_idls = full_path_core_idl_files()
+        core_dependency_idls = full_path_core_dependency_idl_files()
+        modules_idls = full_path_modules_idl_files()
+        modules_dependency_idls = full_path_modules_dependency_idl_files()
+
+        all_interfaces = core_idls + modules_idls
+        all_dependencies = core_dependency_idls + modules_dependency_idls
+        all_files = all_interfaces + all_dependencies
+
+        # 2-stage computation: individual, then overall
+        for idl_filename in all_files:
+            compute_info_individual(idl_filename, 'dart')
+        info_individuals = [info_individual()]
+        compute_interfaces_info_overall(info_individuals)
+
+        # Compile just IDLs with interfaces (no dependencies).
+        if (options.output_directory == None):
+            with ScopedTempFileProvider(keep=options.keep) as provider:
+                build = Build(provider)
+        else:
+            provider = DirectoryProvider(path=options.output_directory)
+            build = Build(provider)
+
+        if options.verbose and options.keep:
+            print 'Output directory %s created' % build.output_directory
+
+        # Compile IDLs
+        for filename in all_interfaces:
+            if not filename.endswith('.idl'):
+                continue
+            if build.generate_from_idl(filename):
+                return False
+
+        if options.verbose:
+            print '%s IDLs with interfaces processed' % len(all_interfaces)
+
+        if options.verbose and not options.keep:
+            print 'Output directory %s deleted' % build.output_directory
+
+    if options.globals_only:
+        if (options.output_directory == None):
+            with ScopedTempFileProvider(keep=options.keep) as provider:
+                build = Build(provider)
+        else:
+            provider = DirectoryProvider(path=options.output_directory)
+            build = Build(provider)
+
+        if options.verbose:
+            print 'Generating global...'
+
+        build.generate_global()
+
+        if options.verbose:
+            print 'Created DartWebkitClassIds .h/.cpp'
+
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
diff --git a/bindings/scripts/__init__.py b/bindings/scripts/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bindings/scripts/__init__.py
diff --git a/bindings/scripts/aggregate_generated_bindings.py b/bindings/scripts/aggregate_generated_bindings.py
new file mode 100755
index 0000000..abb2b81
--- /dev/null
+++ b/bindings/scripts/aggregate_generated_bindings.py
@@ -0,0 +1,236 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2009 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Generate aggregate .cpp files that include multiple V8 binding .cpp files.
+
+This can be a single output file, to preserve symbol space; or multiple output
+files, to reduce maximum compilation unit size and allow parallel compilation.
+
+Usage:
+aggregate_generated_bindings.py COMPONENT_DIR IDL_FILES_LIST -- OUTPUT_FILE1 OUTPUT_FILE2 ...
+
+COMPONENT_DIR is the relative directory of a component, e.g., 'core', 'modules'.
+IDL_FILES_LIST is a text file containing the IDL file paths, so the command
+line doesn't exceed OS length limits.
+OUTPUT_FILE1 etc. are filenames of output files.
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-build
+"""
+
+import errno
+import os
+import re
+import subprocess
+import sys
+
+from utilities import idl_filename_to_interface_name
+
+# A regexp for finding Conditional attributes in interface definitions.
+CONDITIONAL_PATTERN = re.compile(
+    r'\['
+    r'[^\]]*'
+    r'Conditional=([\_0-9a-zA-Z&|]*)'
+    r'[^\]]*'
+    r'\]\s*'
+    r'((callback|partial)\s+)?'
+    r'interface\s+'
+    r'\w+\s*'
+    r'(:\s*\w+\s*)?'
+    r'{',
+    re.MULTILINE)
+
+COPYRIGHT_TEMPLATE = """/*
+ * THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT.
+ *
+ * This file was generated by the action_derivedsourcesallinone.py script.
+ *
+ * Copyright (C) 2009 Google Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+"""
+
+
+def format_conditional(conditional):
+    """Wraps conditional with ENABLE() and replace '&','|' with '&&','||' if
+    more than one conditional is specified."""
+    def wrap_with_enable(s):
+        if s in ['|', '&']:
+            return s * 2
+        return 'ENABLE(' + s + ')'
+    return ' '.join(map(wrap_with_enable, conditional))
+
+
+def extract_conditional(idl_file_path):
+    """Find [Conditional] interface extended attribute."""
+    with open(idl_file_path) as idl_file:
+        idl_contents = idl_file.read()
+
+    match = CONDITIONAL_PATTERN.search(idl_contents)
+    if not match:
+        return None
+    conditional = match.group(1)
+    return re.split('([|&])', conditional)
+
+
+def extract_meta_data(file_paths):
+    """Extracts conditional and interface name from each IDL file."""
+    meta_data_list = []
+
+    for file_path in file_paths:
+        if not file_path.endswith('.idl'):
+            print 'WARNING: non-IDL file passed: "%s"' % file_path
+            continue
+        if not os.path.exists(file_path):
+            print 'WARNING: file not found: "%s"' % file_path
+            continue
+
+        # Extract interface name from file name
+        interface_name = idl_filename_to_interface_name(file_path)
+
+        meta_data = {
+            'conditional': extract_conditional(file_path),
+            'name': interface_name,
+        }
+        meta_data_list.append(meta_data)
+
+    return meta_data_list
+
+
+def generate_content(component_dir, files_meta_data_this_partition, prefix):
+    # Add fixed content.
+    output = [COPYRIGHT_TEMPLATE,
+              '#define NO_IMPLICIT_ATOMICSTRING\n\n']
+
+    # List all includes segmented by if and endif.
+    prev_conditional = None
+    files_meta_data_this_partition.sort(key=lambda e: e['conditional'])
+    for meta_data in files_meta_data_this_partition:
+        conditional = meta_data['conditional']
+        if prev_conditional != conditional:
+            if prev_conditional:
+                output.append('#endif\n')
+            if conditional:
+                output.append('\n#if %s\n' % format_conditional(conditional))
+        prev_conditional = conditional
+
+        output.append('#include "bindings/%s/%s/%s%s.cpp"\n' %
+                      (component_dir, prefix.lower(), prefix, meta_data['name']))
+
+    if prev_conditional:
+        output.append('#endif\n')
+
+    return ''.join(output)
+
+
+def write_content(content, output_file_name):
+    parent_path, file_name = os.path.split(output_file_name)
+    if not os.path.exists(parent_path):
+        print 'Creating directory: %s' % parent_path
+        os.makedirs(parent_path)
+    with open(output_file_name, 'w') as f:
+        f.write(content)
+
+
+def resolve_cygpath(cygdrive_names):
+    if not cygdrive_names:
+        return []
+    cmd = ['cygpath', '-f', '-', '-wa']
+    process = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+    idl_file_names = []
+    for file_name in cygdrive_names:
+        process.stdin.write('%s\n' % file_name)
+        process.stdin.flush()
+        idl_file_names.append(process.stdout.readline().rstrip())
+    process.stdin.close()
+    process.wait()
+    return idl_file_names
+
+
+def main(args):
+    if len(args) <= 4:
+        raise Exception('Expected at least 5 arguments.')
+    if (args[1] == '--dart'):
+        component_dir = args[2]
+        input_file_name = args[3]
+        prefix = 'Dart'
+    else:
+        component_dir = args[1]
+        input_file_name = args[2]
+        prefix = 'V8'
+    in_out_break_index = args.index('--')
+    output_file_names = args[in_out_break_index + 1:]
+
+    with open(input_file_name) as input_file:
+        file_names = sorted([os.path.realpath(line.rstrip('\n'))
+                             for line in input_file])
+        idl_file_names = [file_name for file_name in file_names
+                          if not file_name.startswith('/cygdrive')]
+        cygdrive_names = [file_name for file_name in file_names
+                          if file_name.startswith('/cygdrive')]
+        idl_file_names.extend(resolve_cygpath(cygdrive_names))
+
+    files_meta_data = extract_meta_data(idl_file_names)
+    total_partitions = len(output_file_names)
+    for partition, file_name in enumerate(output_file_names):
+        files_meta_data_this_partition = [
+                meta_data for meta_data in files_meta_data
+                if hash(meta_data['name']) % total_partitions == partition]
+        file_contents = generate_content(component_dir,
+                                         files_meta_data_this_partition,
+                                         prefix)
+        write_content(file_contents, file_name)
+
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
diff --git a/bindings/scripts/blink_idl_lexer.py b/bindings/scripts/blink_idl_lexer.py
new file mode 100644
index 0000000..bbde342
--- /dev/null
+++ b/bindings/scripts/blink_idl_lexer.py
@@ -0,0 +1,127 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Lexer for Blink IDL.
+
+The lexer uses the PLY (Python Lex-Yacc) library to build a tokenizer which
+understands the Blink dialect of Web IDL and produces a token stream suitable
+for the Blink IDL parser.
+
+Blink IDL is identical to Web IDL at the token level, but the base lexer
+does not discard comments. We need to override (and not include comments in
+the token stream), as otherwise comments must be explicitly included in the
+phrase grammar of the parser.
+
+FIXME: Change base lexer to discard comments, and simply used the base
+lexer, eliminating this separate lexer.
+
+Web IDL:
+    http://www.w3.org/TR/WebIDL/
+Web IDL Grammar:
+    http://www.w3.org/TR/WebIDL/#idl-grammar
+PLY:
+    http://www.dabeaz.com/ply/
+
+Design doc:
+http://www.chromium.org/developers/design-documents/idl-compiler#TOC-Front-end
+"""
+
+# Disable attribute validation, as lint can't import parent class to check
+# pylint: disable=E1101
+
+import os.path
+import sys
+
+# PLY is in Chromium src/third_party/ply
+module_path, module_name = os.path.split(__file__)
+third_party = os.path.join(module_path, os.pardir, os.pardir, os.pardir, os.pardir)
+# Insert at front to override system libraries, and after path[0] == script dir
+sys.path.insert(1, third_party)
+from ply import lex
+
+# Base lexer is in Chromium src/tools/idl_parser
+tools_dir = os.path.join(third_party, os.pardir, 'tools')
+sys.path.append(tools_dir)
+from idl_parser.idl_lexer import IDLLexer
+
+REMOVE_TOKENS = ['COMMENT']
+
+
+class BlinkIDLLexer(IDLLexer):
+    # ignore comments
+    def t_COMMENT(self, t):
+        r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)'
+        self.AddLines(t.value.count('\n'))
+
+    # Analogs to _AddToken/_AddTokens in base lexer
+    # Needed to remove COMMENT token, since comments ignored
+    def _RemoveToken(self, token):
+        if token in self.tokens:
+            self.tokens.remove(token)
+
+    def _RemoveTokens(self, tokens):
+        for token in tokens:
+            self._RemoveToken(token)
+
+    def __init__(self, debug=False, optimize=True, outputdir=None):
+        if debug:
+            # Turn off optimization and caching to help debugging
+            optimize = False
+            outputdir = None
+        if outputdir:
+            # Need outputdir in path because lex imports the cached lex table
+            # as a Python module
+            sys.path.append(outputdir)
+
+        IDLLexer.__init__(self)
+        # Overrides to parent class
+        self._RemoveTokens(REMOVE_TOKENS)
+        # Optimized mode substantially decreases startup time (by disabling
+        # error checking), and also allows use of Python's optimized mode.
+        # See: Optimized Mode
+        # http://www.dabeaz.com/ply/ply.html#ply_nn15
+        self._lexobj = lex.lex(object=self,
+                               debug=debug,
+                               optimize=optimize,
+                               outputdir=outputdir)
+
+
+################################################################################
+
+def main(argv):
+    # If file itself executed, build and cache lex table
+    try:
+        outputdir = argv[1]
+    except IndexError as err:
+        print 'Usage: %s OUTPUT_DIR' % argv[0]
+        return 1
+    lexer = BlinkIDLLexer(outputdir=outputdir)
+
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
diff --git a/bindings/scripts/blink_idl_parser.py b/bindings/scripts/blink_idl_parser.py
new file mode 100644
index 0000000..6b205f2
--- /dev/null
+++ b/bindings/scripts/blink_idl_parser.py
@@ -0,0 +1,446 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Parser for Blink IDL.
+
+The parser uses the PLY (Python Lex-Yacc) library to build a set of parsing
+rules which understand the Blink dialect of Web IDL.
+It derives from a standard Web IDL parser, overriding rules where Blink IDL
+differs syntactically or semantically from the base parser, or where the base
+parser diverges from the Web IDL standard.
+
+Web IDL:
+    http://www.w3.org/TR/WebIDL/
+Web IDL Grammar:
+    http://www.w3.org/TR/WebIDL/#idl-grammar
+PLY:
+    http://www.dabeaz.com/ply/
+
+Design doc:
+http://www.chromium.org/developers/design-documents/idl-compiler#TOC-Front-end
+"""
+
+# Disable check for line length and Member as Function due to how grammar rules
+# are defined with PLY
+#
+# pylint: disable=R0201
+# pylint: disable=C0301
+#
+# Disable attribute validation, as lint can't import parent class to check
+# pylint: disable=E1101
+
+import os.path
+import sys
+
+# PLY is in Chromium src/third_party/ply
+module_path, module_name = os.path.split(__file__)
+third_party = os.path.join(module_path, os.pardir, os.pardir, os.pardir, os.pardir)
+# Insert at front to override system libraries, and after path[0] == script dir
+sys.path.insert(1, third_party)
+from ply import yacc
+
+# Base parser is in Chromium src/tools/idl_parser
+tools_dir = os.path.join(module_path, os.pardir, os.pardir, os.pardir, os.pardir, os.pardir, 'tools')
+sys.path.append(tools_dir)
+from idl_parser.idl_parser import IDLParser, ListFromConcat
+from idl_parser.idl_parser import ParseFile as parse_file
+
+from blink_idl_lexer import BlinkIDLLexer
+
+
+# Explicitly set starting symbol to rule defined only in base parser.
+# BEWARE that the starting symbol should NOT be defined in both the base parser
+# and the derived one, as otherwise which is used depends on which line number
+# is lower, which is fragile. Instead, either use one in base parser or
+# create a new symbol, so that this is unambiguous.
+# FIXME: unfortunately, this doesn't work in PLY 3.4, so need to duplicate the
+# rule below.
+STARTING_SYMBOL = 'Definitions'
+
+# We ignore comments (and hence don't need 'Top') but base parser preserves them
+# FIXME: Upstream: comments should be removed in base parser
+REMOVED_RULES = ['Top',  # [0]
+                 'Comments',  # [0.1]
+                 'CommentsRest',  # [0.2]
+                ]
+
+# Remove rules from base class
+# FIXME: add a class method upstream: @classmethod IDLParser._RemoveRules
+for rule in REMOVED_RULES:
+    production_name = 'p_' + rule
+    delattr(IDLParser, production_name)
+
+
+class BlinkIDLParser(IDLParser):
+    # [1]
+    # FIXME: Need to duplicate rule for starting symbol here, with line number
+    # *lower* than in the base parser (idl_parser.py).
+    # This is a bug in PLY: it determines starting symbol by lowest line number.
+    # This can be overridden by the 'start' parameter, but as of PLY 3.4 this
+    # doesn't work correctly.
+    def p_Definitions(self, p):
+        """Definitions : ExtendedAttributeList Definition Definitions
+                       | """
+        if len(p) > 1:
+            p[2].AddChildren(p[1])
+            p[0] = ListFromConcat(p[2], p[3])
+
+    # Below are grammar rules used by yacc, given by functions named p_<RULE>.
+    # * The docstring is the production rule in BNF (grammar).
+    # * The body is the yacc action (semantics).
+    #
+    # The PLY framework builds the actual low-level parser by introspecting this
+    # parser object, selecting all attributes named p_<RULE> as grammar rules.
+    # It extracts the docstrings and uses them as the production rules, building
+    # the table of a LALR parser, and uses the body of the functions as actions.
+    #
+    # Reference:
+    # http://www.dabeaz.com/ply/ply.html#ply_nn23
+    #
+    # Review of yacc:
+    # Yacc parses a token stream, internally producing a Concrete Syntax Tree
+    # (CST), where each node corresponds to a production rule in the grammar.
+    # At each node, it runs an action, which is usually "produce a node in the
+    # Abstract Syntax Tree (AST)" or "ignore this node" (for nodes in the CST
+    # that aren't included in the AST, since only needed for parsing).
+    #
+    # The rules use pseudo-variables; in PLY syntax:
+    # p[0] is the left side: assign return value to p[0] instead of returning,
+    # p[1] ... p[n] are the right side: the values can be accessed, and they
+    # can be modified.
+    # (In yacc these are $$ and $1 ... $n.)
+    #
+    # The rules can look cryptic at first, but there are a few standard
+    # transforms from the CST to AST. With these in mind, the actions should
+    # be reasonably legible.
+    #
+    # * Ignore production
+    #   Discard this branch. Primarily used when one alternative is empty.
+    #
+    #   Sample code:
+    #   if len(p) > 1:
+    #       p[0] = ...
+    #   # Note no assignment if len(p) == 1
+    #
+    # * Eliminate singleton production
+    #   Discard this node in the CST, pass the next level down up the tree.
+    #   Used to ignore productions only necessary for parsing, but not needed
+    #   in the AST.
+    #
+    #   Sample code:
+    #   p[0] = p[1]
+    #
+    # * Build node
+    #   The key type of rule. In this parser, produces object of class IDLNode.
+    #   There are several helper functions:
+    #   * BuildProduction: actually builds an IDLNode, based on a production.
+    #   * BuildAttribute: builds an IDLAttribute, which is a temporary
+    #                     object to hold a name-value pair, which is then
+    #                     set as a Property of the IDLNode when the IDLNode
+    #                     is built.
+    #   * BuildNamed: Same as BuildProduction, and sets the 'NAME' property.
+    #   * BuildTrue: BuildAttribute with value True, for flags.
+    #   See base idl_parser.py for definitions and more examples of use.
+    #
+    #   Sample code:
+    #   # Build node of type NodeType, with value p[1], and children.
+    #   p[0] = self.BuildProduction('NodeType', p, 1, children)
+    #
+    #   # Build named node of type NodeType, with name and value p[1].
+    #   # (children optional)
+    #   p[0] = self.BuildNamed('NodeType', p, 1)
+    #
+    #   # Make a list
+    #   # Used if one node has several children.
+    #   children = ListFromConcat(p[2], p[3])
+    #   p[0] = self.BuildProduction('NodeType', p, 1, children)
+    #
+    #   # Also used to collapse the right-associative tree
+    #   # produced by parsing a list back into a single list.
+    #   """Foos : Foo Foos
+    #           |"""
+    #   if len(p) > 1:
+    #       p[0] = ListFromConcat(p[1], p[2])
+    #
+    #   # Add children.
+    #   # Primarily used to add attributes, produced via BuildTrue.
+    #   # p_StaticAttribute
+    #   """StaticAttribute : STATIC Attribute"""
+    #   p[2].AddChildren(self.BuildTrue('STATIC'))
+    #   p[0] = p[2]
+    #
+    # Numbering scheme for the rules is:
+    # [1] for Web IDL spec (or additions in base parser)
+    #     These should all be upstreamed to the base parser.
+    # [b1] for Blink IDL changes (overrides Web IDL)
+    # [b1.1] for Blink IDL additions, auxiliary rules for [b1]
+    # Numbers are as per Candidate Recommendation 19 April 2012:
+    # http://www.w3.org/TR/2012/CR-WebIDL-20120419/
+
+    # [3] Override action, since we distinguish callbacks
+    # FIXME: Upstream
+    def p_CallbackOrInterface(self, p):
+        """CallbackOrInterface : CALLBACK CallbackRestOrInterface
+                               | Interface"""
+        if len(p) > 2:
+            p[2].AddChildren(self.BuildTrue('CALLBACK'))
+            p[0] = p[2]
+        else:
+            p[0] = p[1]
+
+    # [b27] Add strings, more 'Literal' productions
+    # 'Literal's needed because integers and strings are both internally strings
+    def p_ConstValue(self, p):
+        """ConstValue : BooleanLiteral
+                      | FloatLiteral
+                      | IntegerLiteral
+                      | StringLiteral
+                      | null"""
+        # Standard is (no 'string', fewer 'Literal's):
+        # ConstValue : BooleanLiteral
+        #            | FloatLiteral
+        #            | integer
+        #            | NULL
+        p[0] = p[1]
+
+    # [b27.1]
+    def p_IntegerLiteral(self, p):
+        """IntegerLiteral : integer"""
+        p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'integer'),
+                              self.BuildAttribute('NAME', p[1]))
+
+    # [b27.2]
+    def p_StringLiteral(self, p):
+        """StringLiteral : string"""
+        p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'DOMString'),
+                              self.BuildAttribute('NAME', p[1]))
+
+    # [b47]
+    def p_ExceptionMember(self, p):
+        """ExceptionMember : Const
+                           | ExceptionField
+                           | Attribute
+                           | ExceptionOperation"""
+        # Standard is (no Attribute, no ExceptionOperation):
+        # ExceptionMember : Const
+        #                 | ExceptionField
+        # FIXME: In DOMException.idl, Attributes should be changed to
+        # ExceptionFields, and Attribute removed from this rule.
+        p[0] = p[1]
+
+    # [b47.1]
+    def p_ExceptionOperation(self, p):
+        """ExceptionOperation : Type identifier '(' ')' ';'"""
+        # Needed to handle one case in DOMException.idl:
+        # // Override in a Mozilla compatible format
+        # [NotEnumerable] DOMString toString();
+        # Limited form of Operation to prevent others from being added.
+        # FIXME: Should be a stringifier instead.
+        p[0] = self.BuildNamed('ExceptionOperation', p, 2, p[1])
+
+    # Extended attributes
+    # [b49] Override base parser: remove comment field, since comments stripped
+    # FIXME: Upstream
+    def p_ExtendedAttributeList(self, p):
+        """ExtendedAttributeList : '[' ExtendedAttribute ExtendedAttributes ']'
+                                 | '[' ']'
+                                 | """
+        if len(p) > 3:
+            items = ListFromConcat(p[2], p[3])
+            p[0] = self.BuildProduction('ExtAttributes', p, 1, items)
+
+    # [b50] Allow optional trailing comma
+    # Blink-only, marked as WONTFIX in Web IDL spec:
+    # https://www.w3.org/Bugs/Public/show_bug.cgi?id=22156
+    def p_ExtendedAttributes(self, p):
+        """ExtendedAttributes : ',' ExtendedAttribute ExtendedAttributes
+                              | ','
+                              |"""
+        if len(p) > 3:
+            p[0] = ListFromConcat(p[2], p[3])
+
+    # [b51] Add ExtendedAttributeIdentAndOrIdent
+    def p_ExtendedAttribute(self, p):
+        """ExtendedAttribute : ExtendedAttributeNoArgs
+                             | ExtendedAttributeArgList
+                             | ExtendedAttributeIdent
+                             | ExtendedAttributeIdentList
+                             | ExtendedAttributeStringLiteralList
+                             | ExtendedAttributeNamedArgList"""
+        p[0] = p[1]
+
+    # [59]
+    # FIXME: Upstream UnionType
+    def p_UnionType(self, p):
+        """UnionType : '(' UnionMemberType OR UnionMemberType UnionMemberTypes ')'"""
+        members = ListFromConcat(p[2], p[4], p[5])
+        p[0] = self.BuildProduction('UnionType', p, 1, members)
+
+    # [60]
+    def p_UnionMemberType(self, p):
+        """UnionMemberType : NonAnyType
+                           | UnionType TypeSuffix
+                           | ANY '[' ']' TypeSuffix"""
+        if len(p) == 2:
+            p[0] = self.BuildProduction('Type', p, 1, p[1])
+        elif len(p) == 3:
+            p[0] = self.BuildProduction('Type', p, 1, ListFromConcat(p[1], p[2]))
+        else:
+            any_node = ListFromConcat(self.BuildProduction('Any', p, 1), p[4])
+            p[0] = self.BuildProduction('Type', p, 1, any_node)
+
+    # [61]
+    def p_UnionMemberTypes(self, p):
+        """UnionMemberTypes : OR UnionMemberType UnionMemberTypes
+                            |"""
+        if len(p) > 2:
+            p[0] = ListFromConcat(p[2], p[3])
+
+    # [70] Override base parser to remove non-standard sized array
+    # FIXME: Upstream
+    def p_TypeSuffix(self, p):
+        """TypeSuffix : '[' ']' TypeSuffix
+                      | '?' TypeSuffixStartingWithArray
+                      |"""
+        if len(p) == 4:
+            p[0] = self.BuildProduction('Array', p, 1, p[3])
+        elif len(p) == 3:
+            p[0] = ListFromConcat(self.BuildTrue('NULLABLE'), p[2])
+
+    # [b76.1] Add support for compound Extended Attribute values (A&B and A|B)
+    def p_ExtendedAttributeIdentList(self, p):
+        """ExtendedAttributeIdentList : identifier '=' identifier '&' IdentAndList
+                                      | identifier '=' identifier '|' IdentOrList"""
+        value = self.BuildAttribute('VALUE', p[3] + p[4] + p[5])
+        p[0] = self.BuildNamed('ExtAttribute', p, 1, value)
+
+    # [b76.2] A&B&C
+    def p_IdentAndList(self, p):
+        """IdentAndList : identifier '&' IdentAndList
+                        | identifier"""
+        if len(p) > 3:
+            p[0] = p[1] + p[2] + p[3]
+        else:
+            p[0] = p[1]
+
+    # [b76.3] A|B|C
+    def p_IdentOrList(self, p):
+        """IdentOrList : identifier '|' IdentOrList
+                       | identifier"""
+        if len(p) > 3:
+            p[0] = p[1] + p[2] + p[3]
+        else:
+            p[0] = p[1]
+
+    # Blink extension: Add support for compound Extended Attribute values over string literals ("A"|"B")
+    def p_ExtendedAttributeStringLiteralList(self, p):
+        """ExtendedAttributeStringLiteralList : identifier '=' StringLiteralOrList"""
+        value = self.BuildAttribute('VALUE', p[3])
+        p[0] = self.BuildNamed('ExtAttribute', p, 1, value)
+
+    # Blink extension: one or more string literals. The values aren't propagated as literals,
+    # but their by their value only.
+    def p_StringLiteralOrList(self, p):
+        """StringLiteralOrList : StringLiteral '|' StringLiteralOrList
+                               | StringLiteral"""
+        def unwrap_string(ls):
+            """Reach in and grab the string literal's "NAME"."""
+            return ls[1].value
+
+        if len(p) > 3:
+            p[0] = unwrap_string(p[1]) + p[2] + p[3]
+        else:
+            p[0] = unwrap_string(p[1])
+
+    def __init__(self,
+                 # common parameters
+                 debug=False,
+                 # idl_parser parameters
+                 lexer=None, verbose=False, mute_error=False,
+                 # yacc parameters
+                 outputdir='', optimize=True, write_tables=False,
+                 picklefile=None):
+        if debug:
+            # Turn off optimization and caching, and write out tables,
+            # to help debugging
+            optimize = False
+            outputdir = None
+            picklefile = None
+            write_tables = True
+        if outputdir:
+            picklefile = picklefile or os.path.join(outputdir, 'parsetab.pickle')
+
+        lexer = lexer or BlinkIDLLexer(debug=debug,
+                                       outputdir=outputdir,
+                                       optimize=optimize)
+        self.lexer = lexer
+        self.tokens = lexer.KnownTokens()
+        # Using SLR (instead of LALR) generates the table faster,
+        # but produces the same output. This is ok b/c Web IDL (and Blink IDL)
+        # is an SLR grammar (as is often the case for simple LL(1) grammars).
+        #
+        # Optimized mode substantially decreases startup time (by disabling
+        # error checking), and also allows use of Python's optimized mode.
+        # See: Using Python's Optimized Mode
+        # http://www.dabeaz.com/ply/ply.html#ply_nn38
+        #
+        # |picklefile| allows simpler importing than |tabmodule| (parsetab.py),
+        # as we don't need to modify sys.path; virtually identical speed.
+        # See: CHANGES, Version 3.2
+        # http://ply.googlecode.com/svn/trunk/CHANGES
+        self.yaccobj = yacc.yacc(module=self,
+                                 start=STARTING_SYMBOL,
+                                 method='SLR',
+                                 debug=debug,
+                                 optimize=optimize,
+                                 write_tables=write_tables,
+                                 picklefile=picklefile)
+        self.parse_debug = debug
+        self.verbose = verbose
+        self.mute_error = mute_error
+        self._parse_errors = 0
+        self._parse_warnings = 0
+        self._last_error_msg = None
+        self._last_error_lineno = 0
+        self._last_error_pos = 0
+
+
+################################################################################
+
+def main(argv):
+    # If file itself executed, cache parse table
+    try:
+        outputdir = argv[1]
+    except IndexError as err:
+        print 'Usage: %s OUTPUT_DIR' % argv[0]
+        return 1
+    parser = BlinkIDLParser(outputdir=outputdir)
+
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
diff --git a/bindings/scripts/code_generator_v8.py b/bindings/scripts/code_generator_v8.py
new file mode 100644
index 0000000..778a87e
--- /dev/null
+++ b/bindings/scripts/code_generator_v8.py
@@ -0,0 +1,222 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Generate Blink V8 bindings (.h and .cpp files).
+
+If run itself, caches Jinja templates (and creates dummy file for build,
+since cache filenames are unpredictable and opaque).
+
+This module is *not* concurrency-safe without care: bytecode caching creates
+a race condition on cache *write* (crashes if one process tries to read a
+partially-written cache). However, if you pre-cache the templates (by running
+the module itself), then you can parallelize compiling individual files, since
+cache *reading* is safe.
+
+Input: An object of class IdlDefinitions, containing an IDL interface X
+Output: V8X.h and V8X.cpp
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
+"""
+
+import os
+import posixpath
+import re
+import sys
+
+# Path handling for libraries and templates
+# Paths have to be normalized because Jinja uses the exact template path to
+# determine the hash used in the cache filename, and we need a pre-caching step
+# to be concurrency-safe. Use absolute path because __file__ is absolute if
+# module is imported, and relative if executed directly.
+# If paths differ between pre-caching and individual file compilation, the cache
+# is regenerated, which causes a race condition and breaks concurrent build,
+# since some compile processes will try to read the partially written cache.
+module_path, module_filename = os.path.split(os.path.realpath(__file__))
+third_party_dir = os.path.normpath(os.path.join(
+    module_path, os.pardir, os.pardir, os.pardir, os.pardir))
+templates_dir = os.path.normpath(os.path.join(
+    module_path, os.pardir, 'templates'))
+# Make sure extension is .py, not .pyc or .pyo, so doesn't depend on caching
+module_pyname = os.path.splitext(module_filename)[0] + '.py'
+
+# jinja2 is in chromium's third_party directory.
+# Insert at 1 so at front to override system libraries, and
+# after path[0] == invoking script dir
+sys.path.insert(1, third_party_dir)
+import jinja2
+
+import idl_types
+from idl_types import IdlType
+import v8_callback_interface
+from v8_globals import includes, interfaces
+import v8_interface
+import v8_types
+from v8_utilities import capitalize, cpp_name, conditional_string, v8_class_name
+
+
+class CodeGeneratorV8(object):
+    def __init__(self, interfaces_info, cache_dir):
+        interfaces_info = interfaces_info or {}
+        self.interfaces_info = interfaces_info
+        self.jinja_env = initialize_jinja_env(cache_dir)
+
+        # Set global type info
+        idl_types.set_ancestors(dict(
+            (interface_name, interface_info['ancestors'])
+            for interface_name, interface_info in interfaces_info.iteritems()
+            if interface_info['ancestors']))
+        IdlType.set_callback_interfaces(set(
+            interface_name
+            for interface_name, interface_info in interfaces_info.iteritems()
+            if interface_info['is_callback_interface']))
+        IdlType.set_implemented_as_interfaces(dict(
+            (interface_name, interface_info['implemented_as'])
+            for interface_name, interface_info in interfaces_info.iteritems()
+            if interface_info['implemented_as']))
+        IdlType.set_garbage_collected_types(set(
+            interface_name
+            for interface_name, interface_info in interfaces_info.iteritems()
+            if 'GarbageCollected' in interface_info['inherited_extended_attributes']))
+        IdlType.set_will_be_garbage_collected_types(set(
+            interface_name
+            for interface_name, interface_info in interfaces_info.iteritems()
+            if 'WillBeGarbageCollected' in interface_info['inherited_extended_attributes']))
+        v8_types.set_component_dirs(dict(
+            (interface_name, interface_info['component_dir'])
+            for interface_name, interface_info in interfaces_info.iteritems()))
+
+    def generate_code(self, definitions, interface_name):
+        """Returns .h/.cpp code as (header_text, cpp_text)."""
+        try:
+            interface = definitions.interfaces[interface_name]
+        except KeyError:
+            raise Exception('%s not in IDL definitions' % interface_name)
+
+        # Store other interfaces for introspection
+        interfaces.update(definitions.interfaces)
+
+        # Set local type info
+        IdlType.set_callback_functions(definitions.callback_functions.keys())
+        IdlType.set_enums((enum.name, enum.values)
+                          for enum in definitions.enumerations.values())
+
+        # Select appropriate Jinja template and contents function
+        if interface.is_callback:
+            header_template_filename = 'callback_interface.h'
+            cpp_template_filename = 'callback_interface.cpp'
+            generate_contents = v8_callback_interface.generate_callback_interface
+        else:
+            header_template_filename = 'interface.h'
+            cpp_template_filename = 'interface.cpp'
+            generate_contents = v8_interface.generate_interface
+        header_template = self.jinja_env.get_template(header_template_filename)
+        cpp_template = self.jinja_env.get_template(cpp_template_filename)
+
+        # Generate contents (input parameters for Jinja)
+        template_contents = generate_contents(interface)
+        template_contents['code_generator'] = module_pyname
+
+        # Add includes for interface itself and any dependencies
+        interface_info = self.interfaces_info[interface_name]
+        template_contents['header_includes'].add(interface_info['include_path'])
+        template_contents['header_includes'] = sorted(template_contents['header_includes'])
+        includes.update(interface_info.get('dependencies_include_paths', []))
+        template_contents['cpp_includes'] = sorted(includes)
+
+        # Render Jinja templates
+        header_text = header_template.render(template_contents)
+        cpp_text = cpp_template.render(template_contents)
+        return header_text, cpp_text
+
+
+def initialize_jinja_env(cache_dir):
+    jinja_env = jinja2.Environment(
+        loader=jinja2.FileSystemLoader(templates_dir),
+        # Bytecode cache is not concurrency-safe unless pre-cached:
+        # if pre-cached this is read-only, but writing creates a race condition.
+        bytecode_cache=jinja2.FileSystemBytecodeCache(cache_dir),
+        keep_trailing_newline=True,  # newline-terminate generated files
+        lstrip_blocks=True,  # so can indent control flow tags
+        trim_blocks=True)
+    jinja_env.filters.update({
+        'blink_capitalize': capitalize,
+        'conditional': conditional_if_endif,
+        'runtime_enabled': runtime_enabled_if,
+        })
+    return jinja_env
+
+
+# [Conditional]
+def conditional_if_endif(code, conditional_string):
+    # Jinja2 filter to generate if/endif directive blocks
+    if not conditional_string:
+        return code
+    return ('#if %s\n' % conditional_string +
+            code +
+            '#endif // %s\n' % conditional_string)
+
+
+# [RuntimeEnabled]
+def runtime_enabled_if(code, runtime_enabled_function_name):
+    if not runtime_enabled_function_name:
+        return code
+    # Indent if statement to level of original code
+    indent = re.match(' *', code).group(0)
+    return ('%sif (%s()) {\n' % (indent, runtime_enabled_function_name) +
+            '    %s\n' % '\n    '.join(code.splitlines()) +
+            '%s}\n' % indent)
+
+
+################################################################################
+
+def main(argv):
+    # If file itself executed, cache templates
+    try:
+        cache_dir = argv[1]
+        dummy_filename = argv[2]
+    except IndexError as err:
+        print 'Usage: %s CACHE_DIR DUMMY_FILENAME' % argv[0]
+        return 1
+
+    # Cache templates
+    jinja_env = initialize_jinja_env(cache_dir)
+    template_filenames = [filename for filename in os.listdir(templates_dir)
+                          # Skip .svn, directories, etc.
+                          if filename.endswith(('.cpp', '.h'))]
+    for template_filename in template_filenames:
+        jinja_env.get_template(template_filename)
+
+    # Create a dummy file as output for the build system,
+    # since filenames of individual cache files are unpredictable and opaque
+    # (they are hashes of the template path, which varies based on environment)
+    with open(dummy_filename, 'w') as dummy_file:
+        pass  # |open| creates or touches the file
+
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
diff --git a/bindings/scripts/compute_global_objects.py b/bindings/scripts/compute_global_objects.py
new file mode 100755
index 0000000..93d2eed
--- /dev/null
+++ b/bindings/scripts/compute_global_objects.py
@@ -0,0 +1,113 @@
+#!/usr/bin/python
+#
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Compute global objects.
+
+Global objects are defined by interfaces with [Global] or [PrimaryGlobal] on
+their definition: http://heycam.github.io/webidl/#Global
+
+Design document: http://www.chromium.org/developers/design-documents/idl-build
+"""
+
+import optparse
+import os
+import cPickle as pickle
+import sys
+
+from utilities import get_file_contents, idl_filename_to_interface_name, get_interface_extended_attributes_from_idl, read_file_to_list, read_pickle_files, write_pickle_file
+
+GLOBAL_EXTENDED_ATTRIBUTES = frozenset([
+    'Global',
+    'PrimaryGlobal',
+])
+
+
+def parse_options():
+    usage = 'Usage: %prog [options] [GlobalObjectsComponent.pickle]... [GlobalObjects.pickle]'
+    parser = optparse.OptionParser(usage=usage)
+    parser.add_option('--idl-files-list', help='file listing IDL files')
+    parser.add_option('--write-file-only-if-changed', type='int', help='if true, do not write an output file if it would be identical to the existing one, which avoids unnecessary rebuilds in ninja')
+
+    options, args = parser.parse_args()
+
+    if options.idl_files_list is None:
+        parser.error('Must specify a file listing IDL files using --idl-files-list.')
+    if options.write_file_only_if_changed is None:
+        parser.error('Must specify whether output files are only written if changed using --write-file-only-if-changed.')
+    options.write_file_only_if_changed = bool(options.write_file_only_if_changed)
+    if not args:
+        parser.error('Must specify an output pickle filename as argument, '
+                     'optionally preceeded by input pickle filenames.')
+
+    return options, args
+
+
+def dict_union(dicts):
+    return dict((k, v) for d in dicts for k, v in d.iteritems())
+
+
+def idl_file_to_global_names(idl_filename):
+    """Returns global names, if any, for an IDL file.
+
+    If the [Global] or [PrimaryGlobal] extended attribute is declared with an
+    identifier list argument, then those identifiers are the interface's global
+    names; otherwise, the interface has a single global name, which is the
+    interface's identifier (http://heycam.github.io/webidl/#Global).
+    """
+    interface_name = idl_filename_to_interface_name(idl_filename)
+    full_path = os.path.realpath(idl_filename)
+    idl_file_contents = get_file_contents(full_path)
+    extended_attributes = get_interface_extended_attributes_from_idl(idl_file_contents)
+
+    global_keys = GLOBAL_EXTENDED_ATTRIBUTES.intersection(
+        extended_attributes.iterkeys())
+    if not global_keys:
+        return
+    if len(global_keys) > 1:
+        raise ValueError('The [Global] and [PrimaryGlobal] extended attributes '
+                         'MUST NOT be declared on the same interface.')
+    global_key = next(iter(global_keys))
+
+    global_value = extended_attributes[global_key]
+    if global_value:
+        # FIXME: In spec names are comma-separated, which makes parsing very
+        # difficult (https://www.w3.org/Bugs/Public/show_bug.cgi?id=24959).
+        return global_value.split('&')
+    return [interface_name]
+
+
+def idl_files_to_interface_name_global_names(idl_files):
+    """Yields pairs (interface_name, global_names) found in IDL files."""
+    for idl_filename in idl_files:
+        interface_name = idl_filename_to_interface_name(idl_filename)
+        global_names = idl_file_to_global_names(idl_filename)
+        if global_names:
+            yield interface_name, global_names
+
+
+################################################################################
+
+def main():
+    options, args = parse_options()
+    # args = Input1, Input2, ..., Output
+    output_global_objects_filename = args.pop()
+    interface_name_global_names = dict_union(
+        existing_interface_name_global_names
+        for existing_interface_name_global_names in read_pickle_files(args))
+
+    # Input IDL files are passed in a file, due to OS command line length
+    # limits. This is generated at GYP time, which is ok b/c files are static.
+    idl_files = read_file_to_list(options.idl_files_list)
+    interface_name_global_names.update(
+            idl_files_to_interface_name_global_names(idl_files))
+
+    write_pickle_file(output_global_objects_filename,
+                      interface_name_global_names,
+                      options.write_file_only_if_changed)
+
+
+if __name__ == '__main__':
+    sys.exit(main())
diff --git a/bindings/scripts/compute_interfaces_info_individual.py b/bindings/scripts/compute_interfaces_info_individual.py
new file mode 100755
index 0000000..c3671d9
--- /dev/null
+++ b/bindings/scripts/compute_interfaces_info_individual.py
@@ -0,0 +1,192 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Compute global interface information for individual IDL files.
+
+Auxiliary module for compute_interfaces_info_overall, which consolidates
+this individual information, computing info that spans multiple files
+(dependencies and ancestry).
+
+This distinction is so that individual interface info can be computed
+separately for each component (avoiding duplicated reading of individual
+files), then consolidated using *only* the info visible to a given component.
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-build
+"""
+
+from collections import defaultdict
+import optparse
+import os
+import posixpath
+import sys
+
+from utilities import get_file_contents, read_file_to_list, idl_filename_to_interface_name, write_pickle_file, get_interface_extended_attributes_from_idl, is_callback_interface_from_idl, get_partial_interface_name_from_idl, get_implements_from_idl, get_parent_interface, get_put_forward_interfaces_from_idl
+
+module_path = os.path.dirname(__file__)
+source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir))
+
+# Global variables (filled in and exported)
+interfaces_info = {}
+partial_interface_files = defaultdict(lambda: {
+    'full_paths': [],
+    'include_paths': [],
+})
+
+
+def parse_options():
+    usage = 'Usage: %prog [options] [generated1.idl]...'
+    parser = optparse.OptionParser(usage=usage)
+    parser.add_option('--component-dir', help='component directory')
+    parser.add_option('--idl-files-list', help='file listing IDL files')
+    parser.add_option('--interfaces-info-file', help='output pickle file')
+    parser.add_option('--write-file-only-if-changed', type='int', help='if true, do not write an output file if it would be identical to the existing one, which avoids unnecessary rebuilds in ninja')
+
+    options, args = parser.parse_args()
+    if options.component_dir is None:
+        parser.error('Must specify a component directory using --component-dir.')
+    if options.interfaces_info_file is None:
+        parser.error('Must specify an output file using --interfaces-info-file.')
+    if options.idl_files_list is None:
+        parser.error('Must specify a file listing IDL files using --idl-files-list.')
+    if options.write_file_only_if_changed is None:
+        parser.error('Must specify whether file is only written if changed using --write-file-only-if-changed.')
+    options.write_file_only_if_changed = bool(options.write_file_only_if_changed)
+    return options, args
+
+
+################################################################################
+# Computations
+################################################################################
+
+def include_path(idl_filename, implemented_as=None):
+    """Returns relative path to header file in POSIX format; used in includes.
+
+    POSIX format is used for consistency of output, so reference tests are
+    platform-independent.
+    """
+    relative_path_local = os.path.relpath(idl_filename, source_path)
+    relative_dir_local = os.path.dirname(relative_path_local)
+    relative_dir_posix = relative_dir_local.replace(os.path.sep, posixpath.sep)
+
+    # IDL file basename is used even if only a partial interface file
+    idl_file_basename, _ = os.path.splitext(os.path.basename(idl_filename))
+    cpp_class_name = implemented_as or idl_file_basename
+
+    return posixpath.join(relative_dir_posix, cpp_class_name + '.h')
+
+
+def add_paths_to_partials_dict(partial_interface_name, full_path, this_include_path=None):
+    paths_dict = partial_interface_files[partial_interface_name]
+    paths_dict['full_paths'].append(full_path)
+    if this_include_path:
+        paths_dict['include_paths'].append(this_include_path)
+
+
+def compute_info_individual(idl_filename, component_dir):
+    full_path = os.path.realpath(idl_filename)
+    idl_file_contents = get_file_contents(full_path)
+
+    extended_attributes = get_interface_extended_attributes_from_idl(idl_file_contents)
+    implemented_as = extended_attributes.get('ImplementedAs')
+    this_include_path = include_path(idl_filename, implemented_as)
+
+    # Handle partial interfaces
+    partial_interface_name = get_partial_interface_name_from_idl(idl_file_contents)
+    if partial_interface_name:
+        add_paths_to_partials_dict(partial_interface_name, full_path, this_include_path)
+        return
+
+    # If not a partial interface, the basename is the interface name
+    interface_name = idl_filename_to_interface_name(idl_filename)
+
+    # 'implements' statements can be included in either the file for the
+    # implement*ing* interface (lhs of 'implements') or implement*ed* interface
+    # (rhs of 'implements'). Store both for now, then merge to implement*ing*
+    # interface later.
+    left_interfaces, right_interfaces = get_implements_from_idl(idl_file_contents, interface_name)
+
+    interfaces_info[interface_name] = {
+        'component_dir': component_dir,
+        'extended_attributes': extended_attributes,
+        'full_path': full_path,
+        'implemented_as': implemented_as,
+        'implemented_by_interfaces': left_interfaces,  # private, merged to next
+        'implements_interfaces': right_interfaces,
+        'include_path': this_include_path,
+        # FIXME: temporary private field, while removing old treatement of
+        # 'implements': http://crbug.com/360435
+        'is_legacy_treat_as_partial_interface': 'LegacyTreatAsPartialInterface' in extended_attributes,
+        'is_callback_interface': is_callback_interface_from_idl(idl_file_contents),
+        'parent': get_parent_interface(idl_file_contents),
+        # Interfaces that are referenced (used as types) and that we introspect
+        # during code generation (beyond interface-level data ([ImplementedAs],
+        # is_callback_interface, ancestors, and inherited extended attributes):
+        # deep dependencies.
+        # These cause rebuilds of referrers, due to the dependency, so these
+        # should be minimized; currently only targets of [PutForwards].
+        'referenced_interfaces': get_put_forward_interfaces_from_idl(idl_file_contents),
+    }
+
+
+def info_individual():
+    """Returns info packaged as a dict."""
+    return {
+        'interfaces_info': interfaces_info,
+        # Can't pickle defaultdict, convert to dict
+        'partial_interface_files': dict(partial_interface_files),
+    }
+
+
+################################################################################
+
+def main():
+    options, args = parse_options()
+
+    # Static IDL files are passed in a file (generated at GYP time), due to OS
+    # command line length limits
+    idl_files = read_file_to_list(options.idl_files_list)
+    # Generated IDL files are passed at the command line, since these are in the
+    # build directory, which is determined at build time, not GYP time, so these
+    # cannot be included in the file listing static files
+    idl_files.extend(args)
+
+    # Compute information for individual files
+    # Information is stored in global variables interfaces_info and
+    # partial_interface_files.
+    for idl_filename in idl_files:
+        compute_info_individual(idl_filename, options.component_dir)
+
+    write_pickle_file(options.interfaces_info_file,
+                      info_individual(),
+                      options.write_file_only_if_changed)
+
+
+if __name__ == '__main__':
+    sys.exit(main())
diff --git a/bindings/scripts/compute_interfaces_info_overall.py b/bindings/scripts/compute_interfaces_info_overall.py
new file mode 100755
index 0000000..658ccfa
--- /dev/null
+++ b/bindings/scripts/compute_interfaces_info_overall.py
@@ -0,0 +1,264 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Compute global interface information, including public information, dependencies, and inheritance.
+
+Computed data is stored in a global variable, |interfaces_info|, and written as
+output (concretely, exported as a pickle). This is then used by the IDL compiler
+itself, so it does not need to compute global information itself, and so that
+inter-IDL dependencies are clear, since they are all computed here.
+
+The |interfaces_info| pickle is a *global* dependency: any changes cause a full
+rebuild. This is to avoid having to compute which public data is visible by
+which IDL files on a file-by-file basis, which is very complex for little
+benefit.
+|interfaces_info| should thus only contain data about an interface that
+contains paths or is needed by *other* interfaces, e.g., path data (to abstract
+the compiler from OS-specific file paths) or public data (to avoid having to
+read other interfaces unnecessarily).
+It should *not* contain full information about an interface (e.g., all
+extended attributes), as this would cause unnecessary rebuilds.
+
+|interfaces_info| is a dict, keyed by |interface_name|.
+
+Current keys are:
+* dependencies:
+    'implements_interfaces': targets of 'implements' statements
+    'referenced_interfaces': reference interfaces that are introspected
+                             (currently just targets of [PutForwards])
+
+* inheritance:
+    'ancestors': all ancestor interfaces
+    'inherited_extended_attributes': inherited extended attributes
+                                     (all controlling memory management)
+
+* public:
+    'is_callback_interface': bool, callback interface or not
+    'implemented_as': value of [ImplementedAs=...] on interface (C++ class name)
+
+* paths:
+    'full_path': path to the IDL file, so can lookup an IDL by interface name
+    'include_path': path for use in C++ #include directives
+    'dependencies_full_paths': paths to dependencies (for merging into main)
+    'dependencies_include_paths': paths for use in C++ #include directives
+
+Note that all of these are stable information, unlikely to change without
+moving or deleting files (hence requiring a full rebuild anyway) or significant
+code changes (for inherited extended attributes).
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-build
+"""
+
+from collections import defaultdict
+import cPickle as pickle
+import optparse
+import sys
+
+from utilities import read_pickle_files, write_pickle_file
+
+INHERITED_EXTENDED_ATTRIBUTES = set([
+    'ActiveDOMObject',
+    'DependentLifetime',
+    'GarbageCollected',
+    'WillBeGarbageCollected',
+])
+
+# Main variable (filled in and exported)
+interfaces_info = {}
+
+# Auxiliary variables (not visible to future build steps)
+partial_interface_files = defaultdict(lambda: {
+    'full_paths': [],
+    'include_paths': [],
+})
+parent_interfaces = {}
+inherited_extended_attributes_by_interface = {}  # interface name -> extended attributes
+
+
+class IdlInterfaceFileNotFoundError(Exception):
+    """Raised if the IDL file implementing an interface cannot be found."""
+    pass
+
+
+def parse_options():
+    usage = 'Usage: %prog [InfoIndividual.pickle]... [Info.pickle]'
+    parser = optparse.OptionParser(usage=usage)
+    parser.add_option('--write-file-only-if-changed', type='int', help='if true, do not write an output file if it would be identical to the existing one, which avoids unnecessary rebuilds in ninja')
+
+    options, args = parser.parse_args()
+    if options.write_file_only_if_changed is None:
+        parser.error('Must specify whether file is only written if changed using --write-file-only-if-changed.')
+    options.write_file_only_if_changed = bool(options.write_file_only_if_changed)
+    return options, args
+
+
+def dict_of_dicts_of_lists_update_or_append(existing, other):
+    """Updates an existing dict of dicts of lists, or appends to lists if key already present.
+
+    Needed for merging partial_interface_files across components.
+    """
+    for key, value in other.iteritems():
+        if key not in existing:
+            existing[key] = value
+            continue
+        existing_value = existing[key]
+        for inner_key, inner_value in value.iteritems():
+            existing_value[inner_key].extend(inner_value)
+
+
+################################################################################
+# Computations
+################################################################################
+
+def compute_inheritance_info(interface_name):
+    """Compute inheritance information, namely ancestors and inherited extended attributes."""
+    def generate_ancestors(interface_name):
+        while interface_name in parent_interfaces:
+            interface_name = parent_interfaces[interface_name]
+            yield interface_name
+
+    ancestors = list(generate_ancestors(interface_name))
+    inherited_extended_attributes = inherited_extended_attributes_by_interface[interface_name]
+    for ancestor in ancestors:
+        # Ancestors may not be present, notably if an ancestor is a generated
+        # IDL file and we are running this script from run-bindings-tests,
+        # where we don't generate these files.
+        ancestor_extended_attributes = inherited_extended_attributes_by_interface.get(ancestor, {})
+        inherited_extended_attributes.update(ancestor_extended_attributes)
+
+    interfaces_info[interface_name].update({
+        'ancestors': ancestors,
+        'inherited_extended_attributes': inherited_extended_attributes,
+    })
+
+
+def compute_interfaces_info_overall(info_individuals):
+    """Compute information about IDL files.
+
+    Information is stored in global interfaces_info.
+    """
+    for info in info_individuals:
+        # No overlap between interface names, so ok to use dict.update
+        interfaces_info.update(info['interfaces_info'])
+        # Interfaces in one component may have partial interfaces in
+        # another component. This is ok (not a layering violation), since
+        # partial interfaces are used to *extend* interfaces.
+        # We thus need to update or append if already present
+        dict_of_dicts_of_lists_update_or_append(
+                partial_interface_files, info['partial_interface_files'])
+
+    # Record inheritance information individually
+    for interface_name, interface_info in interfaces_info.iteritems():
+        extended_attributes = interface_info['extended_attributes']
+        inherited_extended_attributes_by_interface[interface_name] = dict(
+                (key, value)
+                for key, value in extended_attributes.iteritems()
+                if key in INHERITED_EXTENDED_ATTRIBUTES)
+        parent = interface_info['parent']
+        if parent:
+            parent_interfaces[interface_name] = parent
+
+    # Once all individual files handled, can compute inheritance information
+    # and dependencies
+
+    # Compute inheritance info
+    for interface_name in interfaces_info:
+        compute_inheritance_info(interface_name)
+
+    # Compute dependencies
+    # Move implements info from implement*ed* interface (rhs of 'implements')
+    # to implement*ing* interface (lhs of 'implements').
+    # Note that moving an 'implements' statement between implementing and
+    # implemented files does not change the info (or hence cause a rebuild)!
+    for right_interface_name, interface_info in interfaces_info.iteritems():
+        for left_interface_name in interface_info['implemented_by_interfaces']:
+            interfaces_info[left_interface_name]['implements_interfaces'].append(right_interface_name)
+        del interface_info['implemented_by_interfaces']
+
+    # An IDL file's dependencies are partial interface files that extend it,
+    # and files for other interfaces that this interfaces implements.
+    for interface_name, interface_info in interfaces_info.iteritems():
+        partial_interface_paths = partial_interface_files[interface_name]
+        partial_interfaces_full_paths = partial_interface_paths['full_paths']
+        # Partial interface definitions each need an include, as they are
+        # implemented in separate classes from the main interface.
+        partial_interfaces_include_paths = partial_interface_paths['include_paths']
+
+        implemented_interfaces = interface_info['implements_interfaces']
+        try:
+            implemented_interfaces_info = [
+                interfaces_info[interface]
+                for interface in implemented_interfaces]
+        except KeyError as key_name:
+            raise IdlInterfaceFileNotFoundError('Could not find the IDL file where the following implemented interface is defined: %s' % key_name)
+        implemented_interfaces_full_paths = [
+            implemented_interface_info['full_path']
+            for implemented_interface_info in implemented_interfaces_info]
+        # Implemented interfaces don't need includes, as this is handled in
+        # the Blink implementation (they are implemented on |impl| itself,
+        # hence header is included in implementing class).
+        # However, they are needed for legacy implemented interfaces that
+        # are being treated as partial interfaces, until we remove these.
+        # http://crbug.com/360435
+        implemented_interfaces_include_paths = [
+            implemented_interface_info['include_path']
+            for implemented_interface_info in implemented_interfaces_info
+            if implemented_interface_info['is_legacy_treat_as_partial_interface']]
+
+        interface_info.update({
+            'dependencies_full_paths': (partial_interfaces_full_paths +
+                                        implemented_interfaces_full_paths),
+            'dependencies_include_paths': (partial_interfaces_include_paths +
+                                           implemented_interfaces_include_paths),
+        })
+
+    # Clean up temporary private information
+    for interface_info in interfaces_info.itervalues():
+        del interface_info['extended_attributes']
+        del interface_info['is_legacy_treat_as_partial_interface']
+        del interface_info['parent']
+
+
+################################################################################
+
+def main():
+    options, args = parse_options()
+    # args = Input1, Input2, ..., Output
+    interfaces_info_filename = args.pop()
+    info_individuals = read_pickle_files(args)
+
+    compute_interfaces_info_overall(info_individuals)
+    write_pickle_file(interfaces_info_filename,
+                      interfaces_info,
+                      options.write_file_only_if_changed)
+
+
+if __name__ == '__main__':
+    sys.exit(main())
diff --git a/bindings/scripts/generate_event_interfaces.py b/bindings/scripts/generate_event_interfaces.py
new file mode 100755
index 0000000..b222cb4
--- /dev/null
+++ b/bindings/scripts/generate_event_interfaces.py
@@ -0,0 +1,122 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Generate event interfaces .in file (EventInterfaces.in).
+
+The event interfaces .in file contains a list of all Event interfaces, i.e.,
+all interfaces that inherit from Event, including Event itself,
+together with certain extended attributes.
+
+Paths are in POSIX format, and relative to Source/.
+
+This list is used in core/ to generate EventFactory and EventNames.
+The .in format is documented in build/scripts/in_file.py.
+"""
+
+from optparse import OptionParser
+import os
+import posixpath
+import sys
+
+from utilities import get_file_contents, read_file_to_list, write_file, get_interface_extended_attributes_from_idl
+
+EXPORTED_EXTENDED_ATTRIBUTES = (
+    'Conditional',
+    'ImplementedAs',
+    'RuntimeEnabled',
+)
+module_path = os.path.dirname(os.path.realpath(__file__))
+source_dir = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir))
+
+
+def parse_options():
+    parser = OptionParser()
+    parser.add_option('--event-idl-files-list', help='file listing event IDL files')
+    parser.add_option('--event-interfaces-file', help='output file')
+    parser.add_option('--write-file-only-if-changed', type='int', help='if true, do not write an output file if it would be identical to the existing one, which avoids unnecessary rebuilds in ninja')
+    parser.add_option('--suffix', help='specify a suffix to the namespace, i.e., "Modules". Default is None.')
+
+    options, args = parser.parse_args()
+    if options.event_idl_files_list is None:
+        parser.error('Must specify a file listing event IDL files using --event-idl-files-list.')
+    if options.event_interfaces_file is None:
+        parser.error('Must specify an output file using --event-interfaces-file.')
+    if options.write_file_only_if_changed is None:
+        parser.error('Must specify whether file is only written if changed using --write-file-only-if-changed.')
+    options.write_file_only_if_changed = bool(options.write_file_only_if_changed)
+    if args:
+        parser.error('No arguments allowed, but %d given.' % len(args))
+    return options
+
+
+def write_event_interfaces_file(event_idl_files, destination_filename, only_if_changed, suffix):
+    def extended_attribute_string(name, value):
+        if name == 'RuntimeEnabled':
+            value += 'Enabled'
+        return name + '=' + value
+
+    def interface_line(full_path):
+        relative_path_local, _ = os.path.splitext(os.path.relpath(full_path, source_dir))
+        relative_path_posix = relative_path_local.replace(os.sep, posixpath.sep)
+
+        idl_file_contents = get_file_contents(full_path)
+        extended_attributes = get_interface_extended_attributes_from_idl(idl_file_contents)
+        extended_attributes_list = [
+            extended_attribute_string(name, extended_attributes[name])
+            for name in EXPORTED_EXTENDED_ATTRIBUTES
+            if name in extended_attributes]
+
+        return '%s %s\n' % (relative_path_posix,
+                            ', '.join(extended_attributes_list))
+
+    lines = ['namespace="Event"\n']
+    if suffix:
+        lines.append('suffix="' + suffix + '"\n')
+    lines.append('\n')
+    interface_lines = [interface_line(event_idl_file)
+                       for event_idl_file in event_idl_files]
+    interface_lines.sort()
+    lines.extend(interface_lines)
+    write_file(''.join(lines), destination_filename, only_if_changed)
+
+
+################################################################################
+
+def main():
+    options = parse_options()
+    event_idl_files = read_file_to_list(options.event_idl_files_list)
+    write_event_interfaces_file(event_idl_files,
+                                options.event_interfaces_file,
+                                options.write_file_only_if_changed,
+                                options.suffix)
+
+
+if __name__ == '__main__':
+    sys.exit(main())
diff --git a/bindings/scripts/generate_global_constructors.py b/bindings/scripts/generate_global_constructors.py
new file mode 100755
index 0000000..81838fe
--- /dev/null
+++ b/bindings/scripts/generate_global_constructors.py
@@ -0,0 +1,184 @@
+#!/usr/bin/python
+#
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Generates interface properties on global objects.
+
+Concretely these are implemented as "constructor attributes", meaning
+"attributes whose name ends with Constructor" (special-cased by code generator),
+hence "global constructors" for short.
+
+For reference on global objects, see:
+http://heycam.github.io/webidl/#Global
+http://heycam.github.io/webidl/#Exposed
+
+Design document: http://www.chromium.org/developers/design-documents/idl-build
+"""
+
+import itertools
+import optparse
+import os
+import cPickle as pickle
+import re
+import sys
+
+from collections import defaultdict
+from utilities import get_file_contents, idl_filename_to_interface_name, read_file_to_list, write_file, get_interface_extended_attributes_from_idl, is_callback_interface_from_idl
+
+interface_name_to_global_names = {}
+global_name_to_constructors = defaultdict(list)
+
+
+HEADER_FORMAT = """// Stub header file for {{idl_basename}}
+// Required because the IDL compiler assumes that a corresponding header file
+// exists for each IDL file.
+"""
+
+def parse_options():
+    parser = optparse.OptionParser()
+    parser.add_option('--idl-files-list', help='file listing IDL files')
+    parser.add_option('--global-objects-file', help='pickle file of global objects')
+    parser.add_option('--write-file-only-if-changed', type='int', help='if true, do not write an output file if it would be identical to the existing one, which avoids unnecessary rebuilds in ninja')
+
+    options, args = parser.parse_args()
+
+    if options.idl_files_list is None:
+        parser.error('Must specify a file listing IDL files using --idl-files-list.')
+    if options.global_objects_file is None:
+        parser.error('Must specify a pickle file of global objects using --global-objects-file.')
+    if options.write_file_only_if_changed is None:
+        parser.error('Must specify whether output files are only written if changed using --write-file-only-if-changed.')
+    options.write_file_only_if_changed = bool(options.write_file_only_if_changed)
+
+    return options, args
+
+
+def flatten_list(iterable):
+    return list(itertools.chain.from_iterable(iterable))
+
+
+def interface_name_to_constructors(interface_name):
+    """Returns constructors for an interface."""
+    global_names = interface_name_to_global_names[interface_name]
+    return flatten_list(global_name_to_constructors[global_name]
+                        for global_name in global_names)
+
+
+def record_global_constructors(idl_filename):
+    interface_name = idl_filename_to_interface_name(idl_filename)
+    full_path = os.path.realpath(idl_filename)
+    idl_file_contents = get_file_contents(full_path)
+    extended_attributes = get_interface_extended_attributes_from_idl(idl_file_contents)
+
+    # An interface property is produced for every non-callback interface
+    # that does not have [NoInterfaceObject].
+    # Callback interfaces with constants also have interface properties,
+    # but there are none of these in Blink.
+    # http://heycam.github.io/webidl/#es-interfaces
+    if (is_callback_interface_from_idl(idl_file_contents) or
+        'NoInterfaceObject' in extended_attributes):
+        return
+
+    # The [Exposed] extended attribute MUST take an identifier list. Each
+    # identifier in the list MUST be a global name. An interface or interface
+    # member the extended attribute applies to will be exposed only on objects
+    # associated with ECMAScript global environments whose global object
+    # implements an interface that has a matching global name.
+    # FIXME: In spec names are comma-separated, but that makes parsing very
+    # difficult (https://www.w3.org/Bugs/Public/show_bug.cgi?id=24959).
+    exposed_global_names = extended_attributes.get('Exposed', 'Window').split('&')
+    new_constructors_list = generate_global_constructors_list(interface_name, extended_attributes)
+    for exposed_global_name in exposed_global_names:
+        global_name_to_constructors[exposed_global_name].extend(new_constructors_list)
+
+
+def generate_global_constructors_list(interface_name, extended_attributes):
+    extended_attributes_list = [
+            name + '=' + extended_attributes[name]
+            for name in 'Conditional', 'PerContextEnabled', 'RuntimeEnabled'
+            if name in extended_attributes]
+    if extended_attributes_list:
+        extended_string = '[%s] ' % ', '.join(extended_attributes_list)
+    else:
+        extended_string = ''
+
+    attribute_string = 'attribute {interface_name}Constructor {interface_name}'.format(interface_name=interface_name)
+    attributes_list = [extended_string + attribute_string]
+
+    # In addition to the usual interface property, for every [NamedConstructor]
+    # extended attribute on an interface, a corresponding property MUST exist
+    # on the ECMAScript global object.
+    # http://heycam.github.io/webidl/#NamedConstructor
+    if 'NamedConstructor' in extended_attributes:
+        named_constructor = extended_attributes['NamedConstructor']
+        # Extract function name, namely everything before opening '('
+        constructor_name = re.sub(r'\(.*', '', named_constructor)
+        # Note the reduplicated 'ConstructorConstructor'
+        # FIXME: rename to NamedConstructor
+        attribute_string = 'attribute %sConstructorConstructor %s' % (interface_name, constructor_name)
+        attributes_list.append(extended_string + attribute_string)
+
+    return attributes_list
+
+
+def write_global_constructors_partial_interface(interface_name, idl_filename, constructor_attributes_list, only_if_changed):
+    # FIXME: replace this with a simple Jinja template
+    lines = (['partial interface %s {\n' % interface_name] +
+             ['    %s;\n' % constructor_attribute
+              # FIXME: sort by interface name (not first by extended attributes)
+              for constructor_attribute in sorted(constructor_attributes_list)] +
+             ['};\n'])
+    write_file(''.join(lines), idl_filename, only_if_changed)
+    header_filename = os.path.splitext(idl_filename)[0] + '.h'
+    idl_basename = os.path.basename(idl_filename)
+    write_file(HEADER_FORMAT.format(idl_basename=idl_basename),
+               header_filename, only_if_changed)
+
+
+################################################################################
+
+def main():
+    options, args = parse_options()
+
+    # Input IDL files are passed in a file, due to OS command line length
+    # limits. This is generated at GYP time, which is ok b/c files are static.
+    idl_files = read_file_to_list(options.idl_files_list)
+
+    # Output IDL files (to generate) are passed at the command line, since
+    # these are in the build directory, which is determined at build time, not
+    # GYP time.
+    # These are passed as pairs of GlobalObjectName, GlobalObject.idl
+    interface_name_idl_filename = [(args[i], args[i + 1])
+                                   for i in range(0, len(args), 2)]
+
+    with open(options.global_objects_file) as global_objects_file:
+        interface_name_to_global_names.update(pickle.load(global_objects_file))
+
+    for idl_filename in idl_files:
+        record_global_constructors(idl_filename)
+
+    # Check for [Exposed] / [Global] mismatch.
+    known_global_names = frozenset(itertools.chain.from_iterable(interface_name_to_global_names.values()))
+    exposed_global_names = frozenset(global_name_to_constructors)
+    if not exposed_global_names.issubset(known_global_names):
+        unknown_global_names = exposed_global_names.difference(known_global_names)
+        raise ValueError('The following global names were used in '
+                         '[Exposed=xxx] but do not match any [Global] / '
+                         '[PrimaryGlobal] interface: %s'
+                         % list(unknown_global_names))
+
+    # Write partial interfaces containing constructor attributes for each
+    # global interface.
+    for interface_name, idl_filename in interface_name_idl_filename:
+        constructors = interface_name_to_constructors(interface_name)
+        write_global_constructors_partial_interface(
+            interface_name,
+            idl_filename,
+            constructors,
+            options.write_file_only_if_changed)
+
+
+if __name__ == '__main__':
+    sys.exit(main())
diff --git a/bindings/scripts/idl_compiler.py b/bindings/scripts/idl_compiler.py
new file mode 100755
index 0000000..6728aff
--- /dev/null
+++ b/bindings/scripts/idl_compiler.py
@@ -0,0 +1,143 @@
+#!/usr/bin/python
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Compile an .idl file to Blink V8 bindings (.h and .cpp files).
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
+"""
+
+import abc
+from optparse import OptionParser
+import os
+import cPickle as pickle
+import sys
+
+from code_generator_v8 import CodeGeneratorV8
+from idl_reader import IdlReader
+from utilities import write_file
+
+
+def parse_options():
+    parser = OptionParser()
+    parser.add_option('--cache-directory',
+                      help='cache directory, defaults to output directory')
+    parser.add_option('--output-directory')
+    parser.add_option('--interfaces-info-file')
+    parser.add_option('--write-file-only-if-changed', type='int')
+    # ensure output comes last, so command line easy to parse via regexes
+    parser.disable_interspersed_args()
+
+    options, args = parser.parse_args()
+    if options.output_directory is None:
+        parser.error('Must specify output directory using --output-directory.')
+    options.write_file_only_if_changed = bool(options.write_file_only_if_changed)
+    if len(args) != 1:
+        parser.error('Must specify exactly 1 input file as argument, but %d given.' % len(args))
+    idl_filename = os.path.realpath(args[0])
+    return options, idl_filename
+
+
+def idl_filename_to_interface_name(idl_filename):
+    basename = os.path.basename(idl_filename)
+    interface_name, _ = os.path.splitext(basename)
+    return interface_name
+
+
+class IdlCompiler(object):
+    """Abstract Base Class for IDL compilers.
+
+    In concrete classes:
+    * self.code_generator must be set, implementing generate_code()
+      (returning a list of output code), and
+    * compile_file() must be implemented (handling output filenames).
+    """
+    __metaclass__ = abc.ABCMeta
+
+    def __init__(self, output_directory, cache_directory='',
+                 code_generator=None, interfaces_info=None,
+                 interfaces_info_filename='', only_if_changed=False):
+        """
+        Args:
+            interfaces_info:
+                interfaces_info dict
+                (avoids auxiliary file in run-bindings-tests)
+            interfaces_info_file: filename of pickled interfaces_info
+        """
+        cache_directory = cache_directory or output_directory
+        self.cache_directory = cache_directory
+        self.code_generator = code_generator
+        if interfaces_info_filename:
+            with open(interfaces_info_filename) as interfaces_info_file:
+                interfaces_info = pickle.load(interfaces_info_file)
+        self.interfaces_info = interfaces_info
+        self.only_if_changed = only_if_changed
+        self.output_directory = output_directory
+        self.reader = IdlReader(interfaces_info, cache_directory)
+
+    def compile_and_write(self, idl_filename, output_filenames):
+        interface_name = idl_filename_to_interface_name(idl_filename)
+        definitions = self.reader.read_idl_definitions(idl_filename)
+        output_code_list = self.code_generator.generate_code(
+            definitions, interface_name)
+        for output_code, output_filename in zip(output_code_list,
+                                                output_filenames):
+            write_file(output_code, output_filename, self.only_if_changed)
+
+    @abc.abstractmethod
+    def compile_file(self, idl_filename):
+        pass
+
+
+class IdlCompilerV8(IdlCompiler):
+    def __init__(self, *args, **kwargs):
+        IdlCompiler.__init__(self, *args, **kwargs)
+        self.code_generator = CodeGeneratorV8(self.interfaces_info,
+                                              self.cache_directory)
+
+    def compile_file(self, idl_filename):
+        interface_name = idl_filename_to_interface_name(idl_filename)
+        header_filename = os.path.join(self.output_directory,
+                                       'V8%s.h' % interface_name)
+        cpp_filename = os.path.join(self.output_directory,
+                                    'V8%s.cpp' % interface_name)
+        self.compile_and_write(idl_filename, (header_filename, cpp_filename))
+
+
+def main():
+    options, idl_filename = parse_options()
+    idl_compiler = IdlCompilerV8(
+        options.output_directory,
+        cache_directory=options.cache_directory,
+        interfaces_info_filename=options.interfaces_info_file,
+        only_if_changed=options.write_file_only_if_changed)
+    idl_compiler.compile_file(idl_filename)
+
+
+if __name__ == '__main__':
+    sys.exit(main())
diff --git a/bindings/scripts/idl_definitions.py b/bindings/scripts/idl_definitions.py
new file mode 100644
index 0000000..50664ba
--- /dev/null
+++ b/bindings/scripts/idl_definitions.py
@@ -0,0 +1,756 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Blink IDL Intermediate Representation (IR) classes.
+
+Classes are primarily constructors, which build an IdlDefinitions object
+(and various contained objects) from an AST (produced by blink_idl_parser).
+
+This is in two steps:
+* Constructors walk the AST, creating objects.
+* Typedef resolution.
+
+Typedefs are all resolved here, and not stored in IR.
+
+Typedef resolution uses some auxiliary classes and OOP techniques to make this
+a generic call, via the resolve_typedefs() method.
+
+Class hierarchy (mostly containment, '<' for inheritance):
+
+IdlDefinitions
+    IdlCallbackFunction < TypedObject
+    IdlEnum :: FIXME: remove, just use a dict for enums
+    IdlInterface
+        IdlAttribute < TypedObject
+        IdlConstant < TypedObject
+        IdlOperation < TypedObject
+            IdlArgument < TypedObject
+    IdlException < IdlInterface
+        (same contents as IdlInterface)
+
+TypedObject :: mixin for typedef resolution
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
+"""
+
+import abc
+
+from idl_types import IdlType, IdlUnionType
+
+SPECIAL_KEYWORD_LIST = ['GETTER', 'SETTER', 'DELETER']
+STANDARD_TYPEDEFS = {
+    # http://www.w3.org/TR/WebIDL/#common-DOMTimeStamp
+    'DOMTimeStamp': 'unsigned long long',
+}
+
+
+################################################################################
+# TypedObject (mixin for typedef resolution)
+################################################################################
+
+class TypedObject(object):
+    """Object with a type, such as an Attribute or Operation (return value).
+
+    The type can be an actual type, or can be a typedef, which must be resolved
+    before passing data to the code generator.
+    """
+    __metaclass__ = abc.ABCMeta
+    idl_type = None
+
+    def resolve_typedefs(self, typedefs):
+        """Resolve typedefs to actual types in the object."""
+        # Constructors don't have their own return type, because it's the
+        # interface itself.
+        if not self.idl_type:
+            return
+        # Need to re-assign self.idl_type, not just mutate idl_type,
+        # since type(idl_type) may change.
+        self.idl_type = self.idl_type.resolve_typedefs(typedefs)
+
+
+################################################################################
+# Definitions (main container class)
+################################################################################
+
+class IdlDefinitions(object):
+    def __init__(self, node):
+        """Args: node: AST root node, class == 'File'"""
+        self.callback_functions = {}
+        self.dictionaries = {}
+        self.enumerations = {}
+        self.interfaces = {}
+
+        node_class = node.GetClass()
+        if node_class != 'File':
+            raise ValueError('Unrecognized node class: %s' % node_class)
+
+        typedefs = dict((typedef_name, IdlType(type_name))
+                        for typedef_name, type_name in
+                        STANDARD_TYPEDEFS.iteritems())
+
+        children = node.GetChildren()
+        for child in children:
+            child_class = child.GetClass()
+            if child_class == 'Interface':
+                interface = IdlInterface(child)
+                self.interfaces[interface.name] = interface
+            elif child_class == 'Exception':
+                exception = IdlException(child)
+                # For simplicity, treat exceptions as interfaces
+                self.interfaces[exception.name] = exception
+            elif child_class == 'Typedef':
+                type_name = child.GetName()
+                typedefs[type_name] = typedef_node_to_type(child)
+            elif child_class == 'Enum':
+                enumeration = IdlEnum(child)
+                self.enumerations[enumeration.name] = enumeration
+            elif child_class == 'Callback':
+                callback_function = IdlCallbackFunction(child)
+                self.callback_functions[callback_function.name] = callback_function
+            elif child_class == 'Implements':
+                # Implements is handled at the interface merging step
+                pass
+            elif child_class == 'Dictionary':
+                dictionary = IdlDictionary(child)
+                self.dictionaries[dictionary.name] = dictionary
+            else:
+                raise ValueError('Unrecognized node class: %s' % child_class)
+
+        # Typedefs are not stored in IR:
+        # Resolve typedefs with the actual types and then discard the Typedefs.
+        # http://www.w3.org/TR/WebIDL/#idl-typedefs
+        self.resolve_typedefs(typedefs)
+
+    def resolve_typedefs(self, typedefs):
+        for callback_function in self.callback_functions.itervalues():
+            callback_function.resolve_typedefs(typedefs)
+        for interface in self.interfaces.itervalues():
+            interface.resolve_typedefs(typedefs)
+
+    def update(self, other):
+        """Update with additional IdlDefinitions."""
+        for interface_name, new_interface in other.interfaces.iteritems():
+            if not new_interface.is_partial:
+                # Add as new interface
+                self.interfaces[interface_name] = new_interface
+                continue
+
+            # Merge partial to existing interface
+            try:
+                self.interfaces[interface_name].merge(new_interface)
+            except KeyError:
+                raise Exception('Tried to merge partial interface for {0}, '
+                                'but no existing interface by that name'
+                                .format(interface_name))
+
+            # Merge callbacks and enumerations
+            self.enumerations.update(other.enumerations)
+            self.callback_functions.update(other.callback_functions)
+
+
+################################################################################
+# Callback Functions
+################################################################################
+
+class IdlCallbackFunction(TypedObject):
+    def __init__(self, node):
+        children = node.GetChildren()
+        num_children = len(children)
+        if num_children != 2:
+            raise ValueError('Expected 2 children, got %s' % num_children)
+        type_node, arguments_node = children
+        arguments_node_class = arguments_node.GetClass()
+        if arguments_node_class != 'Arguments':
+            raise ValueError('Expected Arguments node, got %s' % arguments_node_class)
+
+        self.name = node.GetName()
+        self.idl_type = type_node_to_type(type_node)
+        self.arguments = arguments_node_to_arguments(arguments_node)
+
+    def resolve_typedefs(self, typedefs):
+        TypedObject.resolve_typedefs(self, typedefs)
+        for argument in self.arguments:
+            argument.resolve_typedefs(typedefs)
+
+
+################################################################################
+# Dictionary
+################################################################################
+
+class IdlDictionary(object):
+    def __init__(self, node):
+        self.parent = None
+        self.name = node.GetName()
+        self.members = []
+        for child in node.GetChildren():
+            child_class = child.GetClass()
+            if child_class == 'Inherit':
+                self.parent = child.GetName()
+            elif child_class == 'Key':
+                self.members.append(IdlDictionaryMember(child))
+            else:
+                raise ValueError('Unrecognized node class: %s' % child_class)
+
+
+class IdlDictionaryMember(object):
+    def __init__(self, node):
+        self.default_value = None
+        self.extended_attributes = {}
+        self.idl_type = None
+        self.name = node.GetName()
+        for child in node.GetChildren():
+            child_class = child.GetClass()
+            if child_class == 'Type':
+                self.idl_type = type_node_to_type(child)
+            elif child_class == 'Default':
+                self.default_value = child.GetProperty('VALUE')
+            elif child_class == 'ExtAttributes':
+                self.extended_attributes = ext_attributes_node_to_extended_attributes(child)
+            else:
+                raise ValueError('Unrecognized node class: %s' % child_class)
+
+
+################################################################################
+# Enumerations
+################################################################################
+
+class IdlEnum(object):
+    # FIXME: remove, just treat enums as a dictionary
+    def __init__(self, node):
+        self.name = node.GetName()
+        self.values = []
+        for child in node.GetChildren():
+            self.values.append(child.GetName())
+
+
+################################################################################
+# Interfaces and Exceptions
+################################################################################
+
+class IdlInterface(object):
+    def __init__(self, node=None):
+        self.attributes = []
+        self.constants = []
+        self.constructors = []
+        self.custom_constructors = []
+        self.extended_attributes = {}
+        self.operations = []
+        self.parent = None
+        if not node:  # Early exit for IdlException.__init__
+            return
+
+        self.is_callback = node.GetProperty('CALLBACK') or False
+        self.is_exception = False
+        # FIXME: uppercase 'Partial' => 'PARTIAL' in base IDL parser
+        self.is_partial = node.GetProperty('Partial') or False
+        self.name = node.GetName()
+
+        children = node.GetChildren()
+        for child in children:
+            child_class = child.GetClass()
+            if child_class == 'Attribute':
+                self.attributes.append(IdlAttribute(child))
+            elif child_class == 'Const':
+                self.constants.append(IdlConstant(child))
+            elif child_class == 'ExtAttributes':
+                extended_attributes = ext_attributes_node_to_extended_attributes(child)
+                self.constructors, self.custom_constructors = (
+                    extended_attributes_to_constructors(extended_attributes))
+                clear_constructor_attributes(extended_attributes)
+                self.extended_attributes = extended_attributes
+            elif child_class == 'Operation':
+                self.operations.append(IdlOperation(child))
+            elif child_class == 'Inherit':
+                self.parent = child.GetName()
+            else:
+                raise ValueError('Unrecognized node class: %s' % child_class)
+
+    def resolve_typedefs(self, typedefs):
+        for attribute in self.attributes:
+            attribute.resolve_typedefs(typedefs)
+        for constant in self.constants:
+            constant.resolve_typedefs(typedefs)
+        for constructor in self.constructors:
+            constructor.resolve_typedefs(typedefs)
+        for custom_constructor in self.custom_constructors:
+            custom_constructor.resolve_typedefs(typedefs)
+        for operation in self.operations:
+            operation.resolve_typedefs(typedefs)
+
+    def merge(self, other):
+        """Merge in another interface's members (e.g., partial interface)"""
+        self.attributes.extend(other.attributes)
+        self.constants.extend(other.constants)
+        self.operations.extend(other.operations)
+
+
+class IdlException(IdlInterface):
+    # Properly exceptions and interfaces are distinct, and thus should inherit a
+    # common base class (say, "IdlExceptionOrInterface").
+    # However, there is only one exception (DOMException), and new exceptions
+    # are not expected. Thus it is easier to implement exceptions as a
+    # restricted subclass of interfaces.
+    # http://www.w3.org/TR/WebIDL/#idl-exceptions
+    def __init__(self, node):
+        # Exceptions are similar to Interfaces, but simpler
+        IdlInterface.__init__(self)
+        self.is_callback = False
+        self.is_exception = True
+        self.is_partial = False
+        self.name = node.GetName()
+
+        children = node.GetChildren()
+        for child in children:
+            child_class = child.GetClass()
+            if child_class == 'Attribute':
+                attribute = IdlAttribute(child)
+                self.attributes.append(attribute)
+            elif child_class == 'Const':
+                self.constants.append(IdlConstant(child))
+            elif child_class == 'ExtAttributes':
+                self.extended_attributes = ext_attributes_node_to_extended_attributes(child)
+            elif child_class == 'ExceptionOperation':
+                self.operations.append(IdlOperation.from_exception_operation_node(child))
+            else:
+                raise ValueError('Unrecognized node class: %s' % child_class)
+
+
+################################################################################
+# Attributes
+################################################################################
+
+class IdlAttribute(TypedObject):
+    def __init__(self, node):
+        self.is_read_only = node.GetProperty('READONLY') or False
+        self.is_static = node.GetProperty('STATIC') or False
+        self.name = node.GetName()
+        # Defaults, overridden below
+        self.idl_type = None
+        self.extended_attributes = {}
+
+        children = node.GetChildren()
+        for child in children:
+            child_class = child.GetClass()
+            if child_class == 'Type':
+                self.idl_type = type_node_to_type(child)
+            elif child_class == 'ExtAttributes':
+                self.extended_attributes = ext_attributes_node_to_extended_attributes(child)
+            else:
+                raise ValueError('Unrecognized node class: %s' % child_class)
+
+
+################################################################################
+# Constants
+################################################################################
+
+class IdlConstant(TypedObject):
+    def __init__(self, node):
+        children = node.GetChildren()
+        num_children = len(children)
+        if num_children < 2 or num_children > 3:
+            raise ValueError('Expected 2 or 3 children, got %s' % num_children)
+        type_node = children[0]
+        value_node = children[1]
+        value_node_class = value_node.GetClass()
+        if value_node_class != 'Value':
+            raise ValueError('Expected Value node, got %s' % value_node_class)
+
+        self.name = node.GetName()
+        # ConstType is more limited than Type, so subtree is smaller and
+        # we don't use the full type_node_to_type function.
+        self.idl_type = type_node_inner_to_type(type_node)
+        self.value = value_node.GetName()
+
+        if num_children == 3:
+            ext_attributes_node = children[2]
+            self.extended_attributes = ext_attributes_node_to_extended_attributes(ext_attributes_node)
+        else:
+            self.extended_attributes = {}
+
+
+################################################################################
+# Literals
+################################################################################
+
+class IdlLiteral(object):
+    def __init__(self, idl_type, value):
+        self.idl_type = idl_type
+        self.value = value
+        self.is_null = False
+
+    def __str__(self):
+        if self.idl_type == 'DOMString':
+            return 'String("%s")' % self.value
+        if self.idl_type == 'integer':
+            return '%d' % self.value
+        if self.idl_type == 'float':
+            return '%g' % self.value
+        if self.idl_type == 'boolean':
+            return 'true' if self.value else 'false'
+        raise ValueError('Unsupported literal type: %s' % self.idl_type)
+
+
+class IdlLiteralNull(IdlLiteral):
+    def __init__(self):
+        self.idl_type = 'NULL'
+        self.value = None
+        self.is_null = True
+
+    def __str__(self):
+        return 'nullptr'
+
+
+def default_node_to_idl_literal(node):
+    # FIXME: This code is unnecessarily complicated due to the rather
+    # inconsistent way the upstream IDL parser outputs default values.
+    # http://crbug.com/374178
+    idl_type = node.GetProperty('TYPE')
+    if idl_type == 'DOMString':
+        value = node.GetProperty('NAME')
+        if '"' in value or '\\' in value:
+            raise ValueError('Unsupported string value: %r' % value)
+        return IdlLiteral(idl_type, value)
+    if idl_type == 'integer':
+        return IdlLiteral(idl_type, int(node.GetProperty('NAME')))
+    if idl_type == 'float':
+        return IdlLiteral(idl_type, float(node.GetProperty('VALUE')))
+    if idl_type == 'boolean':
+        return IdlLiteral(idl_type, node.GetProperty('VALUE'))
+    if idl_type == 'NULL':
+        return IdlLiteralNull()
+    raise ValueError('Unrecognized default value type: %s' % idl_type)
+
+
+################################################################################
+# Operations
+################################################################################
+
+class IdlOperation(TypedObject):
+    def __init__(self, node=None):
+        self.arguments = []
+        self.extended_attributes = {}
+        self.specials = []
+        self.is_constructor = False
+
+        if not node:
+            self.is_static = False
+            return
+        self.name = node.GetName()  # FIXME: should just be: or ''
+        # FIXME: AST should use None internally
+        if self.name == '_unnamed_':
+            self.name = ''
+
+        self.is_static = node.GetProperty('STATIC') or False
+        property_dictionary = node.GetProperties()
+        for special_keyword in SPECIAL_KEYWORD_LIST:
+            if special_keyword in property_dictionary:
+                self.specials.append(special_keyword.lower())
+
+        self.idl_type = None
+        children = node.GetChildren()
+        for child in children:
+            child_class = child.GetClass()
+            if child_class == 'Arguments':
+                self.arguments = arguments_node_to_arguments(child)
+            elif child_class == 'Type':
+                self.idl_type = type_node_to_type(child)
+            elif child_class == 'ExtAttributes':
+                self.extended_attributes = ext_attributes_node_to_extended_attributes(child)
+            else:
+                raise ValueError('Unrecognized node class: %s' % child_class)
+
+    @classmethod
+    def from_exception_operation_node(cls, node):
+        # Needed to handle one case in DOMException.idl:
+        # // Override in a Mozilla compatible format
+        # [NotEnumerable] DOMString toString();
+        # FIXME: can we remove this? replace with a stringifier?
+        operation = cls()
+        operation.name = node.GetName()
+        children = node.GetChildren()
+        if len(children) < 1 or len(children) > 2:
+            raise ValueError('ExceptionOperation node with %s children, expected 1 or 2' % len(children))
+
+        type_node = children[0]
+        operation.idl_type = type_node_to_type(type_node)
+
+        if len(children) > 1:
+            ext_attributes_node = children[1]
+            operation.extended_attributes = ext_attributes_node_to_extended_attributes(ext_attributes_node)
+
+        return operation
+
+    @classmethod
+    def constructor_from_arguments_node(cls, name, arguments_node):
+        constructor = cls()
+        constructor.name = name
+        constructor.arguments = arguments_node_to_arguments(arguments_node)
+        constructor.is_constructor = True
+        return constructor
+
+    def resolve_typedefs(self, typedefs):
+        TypedObject.resolve_typedefs(self, typedefs)
+        for argument in self.arguments:
+            argument.resolve_typedefs(typedefs)
+
+
+################################################################################
+# Arguments
+################################################################################
+
+class IdlArgument(TypedObject):
+    def __init__(self, node):
+        self.extended_attributes = {}
+        self.idl_type = None
+        self.is_optional = node.GetProperty('OPTIONAL')  # syntax: (optional T)
+        self.is_variadic = False  # syntax: (T...)
+        self.name = node.GetName()
+        self.default_value = None
+
+        children = node.GetChildren()
+        for child in children:
+            child_class = child.GetClass()
+            if child_class == 'Type':
+                self.idl_type = type_node_to_type(child)
+            elif child_class == 'ExtAttributes':
+                self.extended_attributes = ext_attributes_node_to_extended_attributes(child)
+            elif child_class == 'Argument':
+                child_name = child.GetName()
+                if child_name != '...':
+                    raise ValueError('Unrecognized Argument node; expected "...", got "%s"' % child_name)
+                self.is_variadic = child.GetProperty('ELLIPSIS') or False
+            elif child_class == 'Default':
+                self.default_value = default_node_to_idl_literal(child)
+            else:
+                raise ValueError('Unrecognized node class: %s' % child_class)
+
+
+def arguments_node_to_arguments(node):
+    # [Constructor] and [CustomConstructor] without arguments (the bare form)
+    # have None instead of an arguments node, but have the same meaning as using
+    # an empty argument list, [Constructor()], so special-case this.
+    # http://www.w3.org/TR/WebIDL/#Constructor
+    if node is None:
+        return []
+    return [IdlArgument(argument_node)
+            for argument_node in node.GetChildren()]
+
+
+################################################################################
+# Extended attributes
+################################################################################
+
+def ext_attributes_node_to_extended_attributes(node):
+    """
+    Returns:
+      Dictionary of {ExtAttributeName: ExtAttributeValue}.
+      Value is usually a string, with three exceptions:
+      Constructors: value is a list of Arguments nodes, corresponding to
+        possible signatures of the constructor.
+      CustomConstructors: value is a list of Arguments nodes, corresponding to
+        possible signatures of the custom constructor.
+      NamedConstructor: value is a Call node, corresponding to the single
+        signature of the named constructor.
+    """
+    # Primarily just make a dictionary from the children.
+    # The only complexity is handling various types of constructors:
+    # Constructors and Custom Constructors can have duplicate entries due to
+    # overloading, and thus are stored in temporary lists.
+    # However, Named Constructors cannot be overloaded, and thus do not have
+    # a list.
+    # FIXME: move Constructor logic into separate function, instead of modifying
+    #        extended attributes in-place.
+    constructors = []
+    custom_constructors = []
+    extended_attributes = {}
+
+    def child_node(extended_attribute_node):
+        children = extended_attribute_node.GetChildren()
+        if not children:
+            return None
+        if len(children) > 1:
+            raise ValueError('ExtAttributes node with %s children, expected at most 1' % len(children))
+        return children[0]
+
+    extended_attribute_node_list = node.GetChildren()
+    for extended_attribute_node in extended_attribute_node_list:
+        name = extended_attribute_node.GetName()
+        child = child_node(extended_attribute_node)
+        child_class = child and child.GetClass()
+        if name == 'Constructor':
+            if child_class and child_class != 'Arguments':
+                raise ValueError('Constructor only supports Arguments as child, but has child of class: %s' % child_class)
+            constructors.append(child)
+        elif name == 'CustomConstructor':
+            if child_class and child_class != 'Arguments':
+                raise ValueError('[CustomConstructor] only supports Arguments as child, but has child of class: %s' % child_class)
+            custom_constructors.append(child)
+        elif name == 'NamedConstructor':
+            if child_class and child_class != 'Call':
+                raise ValueError('[NamedConstructor] only supports Call as child, but has child of class: %s' % child_class)
+            extended_attributes[name] = child
+        elif name == 'SetWrapperReferenceTo':
+            if not child:
+                raise ValueError('[SetWrapperReferenceTo] requires a child, but has none.')
+            if child_class != 'Arguments':
+                raise ValueError('[SetWrapperReferenceTo] only supports Arguments as child, but has child of class: %s' % child_class)
+            extended_attributes[name] = arguments_node_to_arguments(child)
+        elif child:
+            raise ValueError('ExtAttributes node with unexpected children: %s' % name)
+        else:
+            value = extended_attribute_node.GetProperty('VALUE')
+            extended_attributes[name] = value
+
+    # Store constructors and custom constructors in special list attributes,
+    # which are deleted later. Note plural in key.
+    if constructors:
+        extended_attributes['Constructors'] = constructors
+    if custom_constructors:
+        extended_attributes['CustomConstructors'] = custom_constructors
+
+    return extended_attributes
+
+
+def extended_attributes_to_constructors(extended_attributes):
+    """Returns constructors and custom_constructors (lists of IdlOperations).
+
+    Auxiliary function for IdlInterface.__init__.
+    """
+
+    constructor_list = extended_attributes.get('Constructors', [])
+    constructors = [
+        IdlOperation.constructor_from_arguments_node('Constructor', arguments_node)
+        for arguments_node in constructor_list]
+
+    custom_constructor_list = extended_attributes.get('CustomConstructors', [])
+    custom_constructors = [
+        IdlOperation.constructor_from_arguments_node('CustomConstructor', arguments_node)
+        for arguments_node in custom_constructor_list]
+
+    if 'NamedConstructor' in extended_attributes:
+        # FIXME: support overloaded named constructors, and make homogeneous
+        name = 'NamedConstructor'
+        call_node = extended_attributes['NamedConstructor']
+        extended_attributes['NamedConstructor'] = call_node.GetName()
+        children = call_node.GetChildren()
+        if len(children) != 1:
+            raise ValueError('NamedConstructor node expects 1 child, got %s.' % len(children))
+        arguments_node = children[0]
+        named_constructor = IdlOperation.constructor_from_arguments_node('NamedConstructor', arguments_node)
+        # FIXME: should return named_constructor separately; appended for Perl
+        constructors.append(named_constructor)
+
+    return constructors, custom_constructors
+
+
+def clear_constructor_attributes(extended_attributes):
+    # Deletes Constructor*s* (plural), sets Constructor (singular)
+    if 'Constructors' in extended_attributes:
+        del extended_attributes['Constructors']
+        extended_attributes['Constructor'] = None
+    if 'CustomConstructors' in extended_attributes:
+        del extended_attributes['CustomConstructors']
+        extended_attributes['CustomConstructor'] = None
+
+
+################################################################################
+# Types
+################################################################################
+
+def type_node_to_type(node):
+    children = node.GetChildren()
+    if len(children) < 1 or len(children) > 2:
+        raise ValueError('Type node expects 1 or 2 children (type + optional array []), got %s (multi-dimensional arrays are not supported).' % len(children))
+
+    type_node_child = children[0]
+
+    if len(children) == 2:
+        array_node = children[1]
+        array_node_class = array_node.GetClass()
+        if array_node_class != 'Array':
+            raise ValueError('Expected Array node as TypeSuffix, got %s node.' % array_node_class)
+        # FIXME: use IdlArrayType instead of is_array, once have that
+        is_array = True
+    else:
+        is_array = False
+
+    is_nullable = node.GetProperty('NULLABLE') or False  # syntax: T?
+
+    return type_node_inner_to_type(type_node_child, is_array=is_array, is_nullable=is_nullable)
+
+
+def type_node_inner_to_type(node, is_array=False, is_nullable=False):
+    # FIXME: remove is_array and is_nullable once have IdlArrayType and IdlNullableType
+    node_class = node.GetClass()
+    # Note Type*r*ef, not Typedef, meaning the type is an identifier, thus
+    # either a typedef shorthand (but not a Typedef declaration itself) or an
+    # interface type. We do not distinguish these, and just use the type name.
+    if node_class in ['PrimitiveType', 'Typeref']:
+        # unrestricted syntax: unrestricted double | unrestricted float
+        is_unrestricted = node.GetProperty('UNRESTRICTED') or False
+        return IdlType(node.GetName(), is_array=is_array, is_nullable=is_nullable, is_unrestricted=is_unrestricted)
+    elif node_class == 'Any':
+        return IdlType('any', is_array=is_array, is_nullable=is_nullable)
+    elif node_class == 'Sequence':
+        if is_array:
+            raise ValueError('Arrays of sequences are not supported')
+        return sequence_node_to_type(node, is_nullable=is_nullable)
+    elif node_class == 'UnionType':
+        if is_array:
+            raise ValueError('Arrays of unions are not supported')
+        return union_type_node_to_idl_union_type(node, is_nullable=is_nullable)
+    raise ValueError('Unrecognized node class: %s' % node_class)
+
+
+def sequence_node_to_type(node, is_nullable=False):
+    children = node.GetChildren()
+    if len(children) != 1:
+        raise ValueError('Sequence node expects exactly 1 child, got %s' % len(children))
+    sequence_child = children[0]
+    sequence_child_class = sequence_child.GetClass()
+    if sequence_child_class != 'Type':
+        raise ValueError('Unrecognized node class: %s' % sequence_child_class)
+    element_type = type_node_to_type(sequence_child).base_type
+    return IdlType(element_type, is_sequence=True, is_nullable=is_nullable)
+
+
+def typedef_node_to_type(node):
+    children = node.GetChildren()
+    if len(children) != 1:
+        raise ValueError('Typedef node with %s children, expected 1' % len(children))
+    child = children[0]
+    child_class = child.GetClass()
+    if child_class != 'Type':
+        raise ValueError('Unrecognized node class: %s' % child_class)
+    return type_node_to_type(child)
+
+
+def union_type_node_to_idl_union_type(node, is_nullable=False):
+    member_types = [type_node_to_type(member_type_node)
+                    for member_type_node in node.GetChildren()]
+    return IdlUnionType(member_types, is_nullable=is_nullable)
diff --git a/bindings/scripts/idl_reader.py b/bindings/scripts/idl_reader.py
new file mode 100644
index 0000000..450c73d
--- /dev/null
+++ b/bindings/scripts/idl_reader.py
@@ -0,0 +1,109 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Read an IDL file or complete IDL interface, producing an IdlDefinitions object.
+
+Design doc:
+http://www.chromium.org/developers/design-documents/idl-compiler#TOC-Front-end
+"""
+
+import os
+
+import blink_idl_parser
+from blink_idl_parser import BlinkIDLParser
+from idl_definitions import IdlDefinitions
+from idl_validator import EXTENDED_ATTRIBUTES_RELATIVE_PATH, IDLInvalidExtendedAttributeError, IDLExtendedAttributeValidator
+from interface_dependency_resolver import InterfaceDependencyResolver
+
+
+class IdlReader(object):
+    def __init__(self, interfaces_info=None, outputdir=''):
+        self.extended_attribute_validator = IDLExtendedAttributeValidator()
+
+        if interfaces_info:
+            self.interface_dependency_resolver = InterfaceDependencyResolver(interfaces_info, self)
+        else:
+            self.interface_dependency_resolver = None
+
+        self.parser = BlinkIDLParser(outputdir=outputdir)
+
+    def read_idl_definitions(self, idl_filename):
+        """Returns an IdlDefinitions object for an IDL file, including all dependencies."""
+        definitions = self.read_idl_file(idl_filename)
+        if not self.interface_dependency_resolver:
+            return definitions
+        self.interface_dependency_resolver.resolve_dependencies(definitions)
+        return definitions
+
+    def read_idl_file(self, idl_filename):
+        """Returns an IdlDefinitions object for an IDL file, without any dependencies.
+
+        The IdlDefinitions object is guaranteed to contain a single
+        IdlInterface; it may also contain other definitions, such as
+        callback functions and enumerations."""
+        ast = blink_idl_parser.parse_file(self.parser, idl_filename)
+        if not ast:
+            raise Exception('Failed to parse %s' % idl_filename)
+        definitions = IdlDefinitions(ast)
+
+        # Validate file contents with filename convention
+        # The Blink IDL filenaming convention is that the file
+        # <interface_name>.idl MUST contain exactly 1 interface (or exception),
+        # and the interface name must agree with the file's basename,
+        # unless it is a partial interface.
+        # (e.g., 'partial interface Foo' can be in FooBar.idl).
+        number_of_interfaces = len(definitions.interfaces)
+        if number_of_interfaces != 1:
+            raise Exception(
+                'Expected exactly 1 interface in file {0}, but found {1}'
+                .format(idl_filename, number_of_interfaces))
+        interface = next(definitions.interfaces.itervalues())
+        idl_file_basename, _ = os.path.splitext(os.path.basename(idl_filename))
+        if not interface.is_partial and interface.name != idl_file_basename:
+            raise Exception(
+                'Interface name "{0}" disagrees with IDL file basename "{1}".'
+                .format(interface.name, idl_file_basename))
+
+        # Validate extended attributes
+        if not self.extended_attribute_validator:
+            return definitions
+
+        try:
+            self.extended_attribute_validator.validate_extended_attributes(definitions)
+        except IDLInvalidExtendedAttributeError as error:
+            raise IDLInvalidExtendedAttributeError("""
+IDL ATTRIBUTE ERROR in file:
+%s:
+    %s
+If you want to add a new IDL extended attribute, please add it to:
+    %s
+and add an explanation to the Blink IDL documentation at:
+    http://www.chromium.org/blink/webidl/blink-idl-extended-attributes
+    """ % (idl_filename, str(error), EXTENDED_ATTRIBUTES_RELATIVE_PATH))
+
+        return definitions
diff --git a/bindings/scripts/idl_types.py b/bindings/scripts/idl_types.py
new file mode 100644
index 0000000..e488e33
--- /dev/null
+++ b/bindings/scripts/idl_types.py
@@ -0,0 +1,321 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+"""IDL type handling.
+
+Classes:
+IdlType
+IdlUnionType
+"""
+
+from collections import defaultdict
+
+
+################################################################################
+# IDL types
+################################################################################
+
+INTEGER_TYPES = frozenset([
+    # http://www.w3.org/TR/WebIDL/#dfn-integer-type
+    'byte',
+    'octet',
+    'short',
+    'unsigned short',
+    # int and unsigned are not IDL types
+    'long',
+    'unsigned long',
+    'long long',
+    'unsigned long long',
+])
+NUMERIC_TYPES = (INTEGER_TYPES | frozenset([
+    # http://www.w3.org/TR/WebIDL/#dfn-numeric-type
+    'float',
+    'unrestricted float',
+    'double',
+    'unrestricted double',
+]))
+# http://www.w3.org/TR/WebIDL/#dfn-primitive-type
+PRIMITIVE_TYPES = (frozenset(['boolean']) | NUMERIC_TYPES)
+BASIC_TYPES = (PRIMITIVE_TYPES | frozenset([
+    # Built-in, non-composite, non-object data types
+    # http://heycam.github.io/webidl/#idl-types
+    'DOMString',
+    'ByteString',
+    'Date',
+    # http://heycam.github.io/webidl/#es-type-mapping
+    'void',
+    # http://encoding.spec.whatwg.org/#type-scalarvaluestring
+    'ScalarValueString',
+]))
+TYPE_NAMES = {
+    # http://heycam.github.io/webidl/#dfn-type-name
+    'any': 'Any',
+    'boolean': 'Boolean',
+    'byte': 'Byte',
+    'octet': 'Octet',
+    'short': 'Short',
+    'unsigned short': 'UnsignedShort',
+    'long': 'Long',
+    'unsigned long': 'UnsignedLong',
+    'long long': 'LongLong',
+    'unsigned long long': 'UnsignedLongLong',
+    'float': 'Float',
+    'unrestricted float': 'UnrestrictedFloat',
+    'double': 'Double',
+    'unrestricted double': 'UnrestrictedDouble',
+    'DOMString': 'String',
+    'ByteString': 'ByteString',
+    'ScalarValueString': 'ScalarValueString',
+    'object': 'Object',
+    'Date': 'Date',
+}
+
+
+################################################################################
+# Inheritance
+################################################################################
+
+ancestors = defaultdict(list)  # interface_name -> ancestors
+
+def inherits_interface(interface_name, ancestor_name):
+    return (interface_name == ancestor_name or
+            ancestor_name in ancestors[interface_name])
+
+
+def set_ancestors(new_ancestors):
+    ancestors.update(new_ancestors)
+
+
+################################################################################
+# IdlType
+################################################################################
+
+class IdlType(object):
+    # FIXME: incorporate Nullable, etc.
+    # FIXME: use nested types: IdlArrayType, IdlNullableType, IdlSequenceType
+    # to support types like short?[] vs. short[]?, instead of treating these
+    # as orthogonal properties (via flags).
+    callback_functions = set()
+    callback_interfaces = set()
+    enums = {}  # name -> values
+
+    def __init__(self, base_type, is_array=False, is_sequence=False, is_nullable=False, is_unrestricted=False):
+        if is_array and is_sequence:
+            raise ValueError('Array of Sequences are not allowed.')
+        if is_unrestricted:
+            self.base_type = 'unrestricted %s' % base_type
+        else:
+            self.base_type = base_type
+        self.is_array = is_array
+        self.is_sequence = is_sequence
+        self.is_nullable = is_nullable
+
+    def __str__(self):
+        type_string = self.base_type
+        if self.is_array:
+            return type_string + '[]'
+        if self.is_sequence:
+            return 'sequence<%s>' % type_string
+        if self.is_nullable:
+            # FIXME: Dictionary::ConversionContext::setConversionType can't
+            # handle the '?' in nullable types (passes nullability separately).
+            # Update that function to handle nullability from the type name,
+            # simplifying its signature.
+            # return type_string + '?'
+            return type_string
+        return type_string
+
+    # FIXME: rename to native_array_element_type and move to v8_types.py
+    @property
+    def array_or_sequence_type(self):
+        return self.array_type or self.sequence_type
+
+    # FIXME: rename to array_element_type
+    @property
+    def array_type(self):
+        return self.is_array and IdlType(self.base_type)
+
+    # FIXME: rename to sequence_element_type
+    @property
+    def sequence_type(self):
+        return self.is_sequence and IdlType(self.base_type)
+
+    @property
+    def is_basic_type(self):
+        return self.base_type in BASIC_TYPES and not self.array_or_sequence_type
+
+    @property
+    def is_callback_function(self):
+        return self.base_type in IdlType.callback_functions
+
+    @property
+    def is_callback_interface(self):
+        return self.base_type in IdlType.callback_interfaces
+
+    @property
+    def is_composite_type(self):
+        return (self.name == 'Any' or
+                self.array_type or
+                self.sequence_type or
+                self.is_union_type)
+
+    @property
+    def is_enum(self):
+        # FIXME: add an IdlEnumType class and a resolve_enums step at end of
+        # IdlDefinitions constructor
+        return self.name in IdlType.enums
+
+    @property
+    def enum_values(self):
+        return IdlType.enums[self.name]
+
+    @property
+    def is_integer_type(self):
+        return self.base_type in INTEGER_TYPES and not self.array_or_sequence_type
+
+    @property
+    def is_numeric_type(self):
+        return self.base_type in NUMERIC_TYPES and not self.array_or_sequence_type
+
+    @property
+    def is_primitive_type(self):
+        return self.base_type in PRIMITIVE_TYPES and not self.array_or_sequence_type
+
+    @property
+    def is_interface_type(self):
+        # Anything that is not another type is an interface type.
+        # http://www.w3.org/TR/WebIDL/#idl-types
+        # http://www.w3.org/TR/WebIDL/#idl-interface
+        # In C++ these are RefPtr or PassRefPtr types.
+        return not(self.is_basic_type or
+                   self.is_composite_type or
+                   self.is_callback_function or
+                   self.is_enum or
+                   self.name == 'Object' or
+                   self.name == 'Promise')  # Promise will be basic in future
+
+    @property
+    def is_union_type(self):
+        return isinstance(self, IdlUnionType)
+
+    @property
+    def name(self):
+        """Return type name.
+
+        http://heycam.github.io/webidl/#dfn-type-name
+        """
+        base_type = self.base_type
+        base_type_name = TYPE_NAMES.get(base_type, base_type)
+        if self.is_array:
+            return base_type_name + 'Array'
+        if self.is_sequence:
+            return base_type_name + 'Sequence'
+        if self.is_nullable:
+            return base_type_name + 'OrNull'
+        return base_type_name
+
+    @classmethod
+    def set_callback_functions(cls, new_callback_functions):
+        cls.callback_functions.update(new_callback_functions)
+
+    @classmethod
+    def set_callback_interfaces(cls, new_callback_interfaces):
+        cls.callback_interfaces.update(new_callback_interfaces)
+
+    @classmethod
+    def set_enums(cls, new_enums):
+        cls.enums.update(new_enums)
+
+    def resolve_typedefs(self, typedefs):
+        if self.base_type not in typedefs:
+            return self
+        new_type = typedefs[self.base_type]
+        if type(new_type) != type(self):
+            # If type changes, need to return a different object,
+            # since can't change type(self)
+            return new_type
+        # If type doesn't change, just mutate self to avoid a new object
+        # FIXME: a bit ugly; use __init__ instead of setting flags
+        self.base_type = new_type.base_type
+        # handle array both in use and in typedef itself:
+        # typedef Type TypeDef;
+        # TypeDef[] ...
+        # and:
+        # typedef Type[] TypeArray
+        # TypeArray ...
+        self.is_array |= new_type.is_array
+        self.is_sequence |= new_type.is_sequence
+        return self
+
+
+################################################################################
+# IdlUnionType
+################################################################################
+
+class IdlUnionType(object):
+    # http://heycam.github.io/webidl/#idl-union
+    # FIXME: derive from IdlType, instead of stand-alone class, to reduce
+    # duplication.
+    def __init__(self, member_types, is_nullable=False):
+        self.member_types = member_types
+        self.is_nullable = is_nullable
+
+    @property
+    def array_or_sequence_type(self):
+        return False
+
+    @property
+    def array_type(self):
+        return False
+
+    @property
+    def is_array(self):
+        # We do not support arrays of union types
+        return False
+
+    @property
+    def base_type(self):
+        return None
+
+    @property
+    def is_basic_type(self):
+        return False
+
+    @property
+    def is_callback_function(self):
+        return False
+
+    @property
+    def is_enum(self):
+        return False
+
+    @property
+    def is_integer_type(self):
+        return False
+
+    @property
+    def is_numeric_type(self):
+        return False
+
+    @property
+    def is_primitivee_type(self):
+        return False
+
+    @property
+    def is_sequence(self):
+        # We do not support sequences of union types
+        return False
+
+    @property
+    def is_union_type(self):
+        return True
+
+    @property
+    def name(self):
+        return 'Or'.join(member_type.name for member_type in self.member_types)
+
+    def resolve_typedefs(self, typedefs):
+        self.member_types = [
+            typedefs.get(member_type, member_type)
+            for member_type in self.member_types]
+        return self
diff --git a/bindings/scripts/idl_validator.py b/bindings/scripts/idl_validator.py
new file mode 100644
index 0000000..e527442
--- /dev/null
+++ b/bindings/scripts/idl_validator.py
@@ -0,0 +1,108 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Validate extended attributes.
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-compiler#TOC-Extended-attribute-validation
+"""
+
+
+import os.path
+import re
+
+module_path = os.path.dirname(__file__)
+source_path = os.path.join(module_path, os.pardir, os.pardir)
+EXTENDED_ATTRIBUTES_RELATIVE_PATH = os.path.join('bindings',
+                                                 'IDLExtendedAttributes.txt')
+EXTENDED_ATTRIBUTES_FILENAME = os.path.join(source_path,
+                                            EXTENDED_ATTRIBUTES_RELATIVE_PATH)
+
+class IDLInvalidExtendedAttributeError(Exception):
+    pass
+
+
+class IDLExtendedAttributeValidator(object):
+    def __init__(self):
+        self.valid_extended_attributes = read_extended_attributes_file()
+
+    def validate_extended_attributes(self, definitions):
+        # FIXME: this should be done when parsing the file, rather than after.
+        for interface in definitions.interfaces.itervalues():
+            self.validate_extended_attributes_node(interface)
+            for attribute in interface.attributes:
+                self.validate_extended_attributes_node(attribute)
+            for operation in interface.operations:
+                self.validate_extended_attributes_node(operation)
+                for argument in operation.arguments:
+                    self.validate_extended_attributes_node(argument)
+
+    def validate_extended_attributes_node(self, node):
+        for name, values_string in node.extended_attributes.iteritems():
+            self.validate_name_values_string(name, values_string)
+
+    def validate_name_values_string(self, name, values_string):
+        if name not in self.valid_extended_attributes:
+            raise IDLInvalidExtendedAttributeError(
+                'Unknown extended attribute [%s]' % name)
+        valid_values = self.valid_extended_attributes[name]
+        if values_string is None and None not in valid_values:
+            raise IDLInvalidExtendedAttributeError(
+                'Missing required argument for extended attribute [%s]' % name)
+        if '*' in valid_values:  # wildcard, any (non-empty) value ok
+            return
+        if values_string is None:
+            values = set([None])
+        else:
+            values = set(re.split('[|&]', values_string))
+        invalid_values = values - valid_values
+        if invalid_values:
+            invalid_value = invalid_values.pop()
+            raise IDLInvalidExtendedAttributeError(
+                'Invalid value "%s" found in extended attribute [%s=%s]' %
+                (invalid_value, name, values_string))
+
+
+def read_extended_attributes_file():
+    def extended_attribute_name_values():
+        with open(EXTENDED_ATTRIBUTES_FILENAME) as extended_attributes_file:
+            for line in extended_attributes_file:
+                line = line.strip()
+                if not line or line.startswith('#'):
+                    continue
+                name, _, values_string = map(str.strip, line.partition('='))
+                value_list = [value.strip() for value in values_string.split('|')]
+                yield name, value_list
+
+    valid_extended_attributes = {}
+    for name, value_list in extended_attribute_name_values():
+        if not value_list:
+            valid_extended_attributes[name] = set([None])
+            continue
+        valid_extended_attributes[name] = set([value if value else None
+                                               for value in value_list])
+    return valid_extended_attributes
diff --git a/bindings/scripts/interface_dependency_resolver.py b/bindings/scripts/interface_dependency_resolver.py
new file mode 100644
index 0000000..c65d3f6
--- /dev/null
+++ b/bindings/scripts/interface_dependency_resolver.py
@@ -0,0 +1,179 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Resolve interface dependencies, producing a merged IdlDefinitions object.
+
+This library computes interface dependencies (partial interfaces and
+implements), reads the dependency files, and merges them to the IdlDefinitions
+for the main IDL file, producing an IdlDefinitions object representing the
+entire interface.
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-compiler#TOC-Dependency-resolution
+"""
+
+import os.path
+
+# The following extended attributes can be applied to a dependency interface,
+# and are then applied to the individual members when merging.
+# Note that this moves the extended attribute from the interface to the member,
+# which changes the semantics and yields different code than the same extended
+# attribute on the main interface.
+DEPENDENCY_EXTENDED_ATTRIBUTES = set([
+    'Conditional',
+    'PerContextEnabled',
+    'RuntimeEnabled',
+])
+
+
+class InterfaceDependencyResolver(object):
+    def __init__(self, interfaces_info, reader):
+        """Initialize dependency resolver.
+
+        Args:
+            interfaces_info:
+                dict of interfaces information, from compute_dependencies.py
+            reader:
+                IdlReader, used for reading dependency files
+        """
+        self.interfaces_info = interfaces_info
+        self.reader = reader
+
+    def resolve_dependencies(self, definitions):
+        """Resolve dependencies, merging them into IDL definitions of main file.
+
+        Dependencies consist of 'partial interface' for the same interface as
+        in the main file, and other interfaces that this interface 'implements'.
+        These are merged into the main IdlInterface, as the main IdlInterface
+        implements all these members.
+
+        Referenced interfaces are added to IdlDefinitions, but not merged into
+        the main IdlInterface, as these are only referenced (their members are
+        introspected, but not implemented in this interface).
+
+        Inherited extended attributes are also added to the main IdlInterface.
+
+        Modifies definitions in place by adding parsed dependencies.
+
+        Args:
+            definitions: IdlDefinitions object, modified in place
+        """
+        target_interface = next(definitions.interfaces.itervalues())
+        interface_name = target_interface.name
+        interface_info = self.interfaces_info[interface_name]
+
+        if 'inherited_extended_attributes' in interface_info:
+            target_interface.extended_attributes.update(
+                interface_info['inherited_extended_attributes'])
+
+        merge_interface_dependencies(definitions,
+                                     target_interface,
+                                     interface_info['dependencies_full_paths'],
+                                     self.reader)
+
+        for referenced_interface_name in interface_info['referenced_interfaces']:
+            referenced_definitions = self.reader.read_idl_definitions(
+                self.interfaces_info[referenced_interface_name]['full_path'])
+            definitions.update(referenced_definitions)
+
+
+def merge_interface_dependencies(definitions, target_interface, dependency_idl_filenames, reader):
+    """Merge dependencies ('partial interface' and 'implements') in dependency_idl_filenames into target_interface.
+
+    No return: modifies target_interface in place.
+    """
+    # Sort so order consistent, so can compare output from run to run.
+    for dependency_idl_filename in sorted(dependency_idl_filenames):
+        dependency_definitions = reader.read_idl_file(dependency_idl_filename)
+        dependency_interface = next(dependency_definitions.interfaces.itervalues())
+        dependency_interface_basename, _ = os.path.splitext(os.path.basename(dependency_idl_filename))
+
+        transfer_extended_attributes(dependency_interface,
+                                     dependency_interface_basename)
+        definitions.update(dependency_definitions)  # merges partial interfaces
+        if not dependency_interface.is_partial:
+            # Implemented interfaces (non-partial dependencies) are also merged
+            # into the target interface, so Code Generator can just iterate
+            # over one list (and not need to handle 'implements' itself).
+            target_interface.merge(dependency_interface)
+
+
+def transfer_extended_attributes(dependency_interface, dependency_interface_basename):
+    """Transfer extended attributes from dependency interface onto members.
+
+    Merging consists of storing certain interface-level data in extended
+    attributes of the *members* (because there is no separate dependency
+    interface post-merging).
+
+    The data storing consists of:
+    * applying certain extended attributes from the dependency interface
+      to its members
+    * storing the C++ class of the implementation in an internal
+      extended attribute of each member, [PartialInterfaceImplementedAs]
+
+    No return: modifies dependency_interface in place.
+    """
+    merged_extended_attributes = dict(
+        (key, value)
+        for key, value in dependency_interface.extended_attributes.iteritems()
+        if key in DEPENDENCY_EXTENDED_ATTRIBUTES)
+
+    # A partial interface's members are implemented as static member functions
+    # in a separate C++ class. This class name is stored in
+    # [PartialInterfaceImplementedAs] which defaults to the basename of
+    # dependency IDL file.
+    # This class name can be overridden by [ImplementedAs] on the partial
+    # interface definition.
+    #
+    # Note that implemented interfaces do *not* need [ImplementedAs], since
+    # they are implemented on the C++ object |impl| itself, just like members of
+    # the main interface definition, so the bindings do not need to know in
+    # which class implemented interfaces are implemented.
+    #
+    # Currently [LegacyTreatAsPartialInterface] can be used to have partial
+    # interface behavior on implemented interfaces, but this is being removed
+    # as legacy cruft:
+    # FIXME: Remove [LegacyTreatAsPartialInterface]
+    # http://crbug.com/360435
+    #
+    # Note that [ImplementedAs] is used with different meanings on interfaces
+    # and members:
+    # for Blink class name and function name (or constant name), respectively.
+    # Thus we do not want to copy this from the interface to the member, but
+    # instead extract it and handle it separately.
+    if (dependency_interface.is_partial or
+        'LegacyTreatAsPartialInterface' in dependency_interface.extended_attributes):
+        merged_extended_attributes['PartialInterfaceImplementedAs'] = (
+            dependency_interface.extended_attributes.get(
+                'ImplementedAs', dependency_interface_basename))
+
+    for attribute in dependency_interface.attributes:
+        attribute.extended_attributes.update(merged_extended_attributes)
+    for constant in dependency_interface.constants:
+        constant.extended_attributes.update(merged_extended_attributes)
+    for operation in dependency_interface.operations:
+        operation.extended_attributes.update(merged_extended_attributes)
diff --git a/bindings/scripts/utilities.py b/bindings/scripts/utilities.py
new file mode 100644
index 0000000..0aeabc2
--- /dev/null
+++ b/bindings/scripts/utilities.py
@@ -0,0 +1,171 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Utility functions (file reading, simple IDL parsing by regexes) for IDL build.
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-build
+"""
+
+import os
+import cPickle as pickle
+import re
+import string
+
+
+class IdlBadFilenameError(Exception):
+    """Raised if an IDL filename disagrees with the interface name in the file."""
+    pass
+
+
+def idl_filename_to_interface_name(idl_filename):
+    # interface name is the root of the basename: InterfaceName.idl
+    return os.path.splitext(os.path.basename(idl_filename))[0]
+
+
+################################################################################
+# Basic file reading/writing
+################################################################################
+
+def get_file_contents(filename):
+    with open(filename) as f:
+        return f.read()
+
+
+def read_file_to_list(filename):
+    """Returns a list of (stripped) lines for a given filename."""
+    with open(filename) as f:
+        return [line.rstrip('\n') for line in f]
+
+
+def read_pickle_files(pickle_filenames):
+    for pickle_filename in pickle_filenames:
+        with open(pickle_filename) as pickle_file:
+            yield pickle.load(pickle_file)
+
+
+def write_file(new_text, destination_filename, only_if_changed):
+    if only_if_changed and os.path.isfile(destination_filename):
+        with open(destination_filename) as destination_file:
+            if destination_file.read() == new_text:
+                return
+    with open(destination_filename, 'w') as destination_file:
+        destination_file.write(new_text)
+
+
+def write_pickle_file(pickle_filename, data, only_if_changed):
+    if only_if_changed and os.path.isfile(pickle_filename):
+        with open(pickle_filename) as pickle_file:
+            try:
+                if pickle.load(pickle_file) == data:
+                    return
+            except (EOFError, pickle.UnpicklingError):
+                # If trouble unpickling, overwrite
+                pass
+    with open(pickle_filename, 'w') as pickle_file:
+        pickle.dump(data, pickle_file)
+
+
+################################################################################
+# IDL parsing
+#
+# We use regular expressions for parsing; this is incorrect (Web IDL is not a
+# regular language), but simple and sufficient in practice.
+# Leading and trailing context (e.g. following '{') used to avoid false matches.
+################################################################################
+
+def get_partial_interface_name_from_idl(file_contents):
+    match = re.search(r'partial\s+interface\s+(\w+)\s*{', file_contents)
+    return match and match.group(1)
+
+
+def get_implements_from_idl(file_contents, interface_name):
+    """Returns lists of implementing and implemented interfaces.
+
+    Rule is: identifier-A implements identifier-B;
+    i.e., implement*ing* implements implement*ed*;
+    http://www.w3.org/TR/WebIDL/#idl-implements-statements
+
+    Returns two lists of interfaces: identifier-As and identifier-Bs.
+    An 'implements' statements can be present in the IDL file for either the
+    implementing or the implemented interface, but not other files.
+    """
+    implements_re = (r'^\s*'
+                     r'(\w+)\s+'
+                     r'implements\s+'
+                     r'(\w+)\s*'
+                     r';')
+    implements_matches = re.finditer(implements_re, file_contents, re.MULTILINE)
+    implements_pairs = [match.groups() for match in implements_matches]
+
+    foreign_implements = [pair for pair in implements_pairs
+                          if interface_name not in pair]
+    if foreign_implements:
+        left, right = foreign_implements.pop()
+        raise IdlBadFilenameError(
+                'implements statement found in unrelated IDL file.\n'
+                'Statement is:\n'
+                '    %s implements %s;\n'
+                'but filename is unrelated "%s.idl"' %
+                (left, right, interface_name))
+
+    return (
+        [left for left, right in implements_pairs if right == interface_name],
+        [right for left, right in implements_pairs if left == interface_name])
+
+
+def is_callback_interface_from_idl(file_contents):
+    match = re.search(r'callback\s+interface\s+\w+\s*{', file_contents)
+    return bool(match)
+
+
+def get_parent_interface(file_contents):
+    match = re.search(r'interface\s+'
+                      r'\w+\s*'
+                      r':\s*(\w+)\s*'
+                      r'{',
+                      file_contents)
+    return match and match.group(1)
+
+
+def get_interface_extended_attributes_from_idl(file_contents):
+    # Strip comments
+    # re.compile needed b/c Python 2.6 doesn't support flags in re.sub
+    single_line_comment_re = re.compile(r'//.*$', flags=re.MULTILINE)
+    block_comment_re = re.compile(r'/\*.*?\*/', flags=re.MULTILINE | re.DOTALL)
+    file_contents = re.sub(single_line_comment_re, '', file_contents)
+    file_contents = re.sub(block_comment_re, '', file_contents)
+
+    match = re.search(r'\[(.*)\]\s*'
+                      r'((callback|partial)\s+)?'
+                      r'(interface|exception)\s+'
+                      r'\w+\s*'
+                      r'(:\s*\w+\s*)?'
+                      r'{',
+                      file_contents, flags=re.DOTALL)
+    if not match:
+        return {}
+
+    extended_attributes_string = match.group(1)
+    extended_attributes = {}
+    # FIXME: this splitting is WRONG: it fails on ExtendedAttributeArgList like
+    # 'NamedConstructor=Foo(a, b)'
+    parts = [extended_attribute.strip()
+             for extended_attribute in extended_attributes_string.split(',')
+             # Discard empty parts, which may exist due to trailing comma
+             if extended_attribute.strip()]
+    for part in parts:
+        name, _, value = map(string.strip, part.partition('='))
+        extended_attributes[name] = value
+    return extended_attributes
+
+
+def get_put_forward_interfaces_from_idl(file_contents):
+    put_forwards_pattern = (r'\[[^\]]*PutForwards=[^\]]*\]\s+'
+                            r'readonly\s+'
+                            r'attribute\s+'
+                            r'(\w+)')
+    return sorted(set(match.group(1)
+                      for match in re.finditer(put_forwards_pattern,
+                                               file_contents,
+                                               flags=re.DOTALL)))
diff --git a/bindings/scripts/v8_attributes.py b/bindings/scripts/v8_attributes.py
new file mode 100644
index 0000000..6dcb2d5
--- /dev/null
+++ b/bindings/scripts/v8_attributes.py
@@ -0,0 +1,436 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Generate template values for attributes.
+
+Extends IdlType with property |constructor_type_name|.
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
+"""
+
+import idl_types
+from idl_types import inherits_interface
+from v8_globals import includes, interfaces
+import v8_types
+import v8_utilities
+from v8_utilities import capitalize, cpp_name, has_extended_attribute, has_extended_attribute_value, scoped_name, strip_suffix, uncapitalize
+
+
+def generate_attribute(interface, attribute):
+    idl_type = attribute.idl_type
+    base_idl_type = idl_type.base_type
+    extended_attributes = attribute.extended_attributes
+
+    idl_type.add_includes_for_type()
+
+    # [CheckSecurity]
+    is_check_security_for_node = 'CheckSecurity' in extended_attributes
+    if is_check_security_for_node:
+        includes.add('bindings/common/BindingSecurity.h')
+    # [Custom]
+    has_custom_getter = ('Custom' in extended_attributes and
+                         extended_attributes['Custom'] in [None, 'Getter'])
+    has_custom_setter = (not attribute.is_read_only and
+                         'Custom' in extended_attributes and
+                         extended_attributes['Custom'] in [None, 'Setter'])
+    # [CustomElementCallbacks], [Reflect]
+    is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attributes
+    is_reflect = 'Reflect' in extended_attributes
+    if is_custom_element_callbacks or is_reflect:
+        includes.add('core/dom/custom/CustomElementCallbackDispatcher.h')
+    # [PerWorldBindings]
+    if 'PerWorldBindings' in extended_attributes:
+        assert idl_type.is_wrapper_type or 'LogActivity' in extended_attributes, '[PerWorldBindings] should only be used with wrapper types: %s.%s' % (interface.name, attribute.name)
+    # [RaisesException], [RaisesException=Setter]
+    is_setter_raises_exception = (
+        'RaisesException' in extended_attributes and
+        extended_attributes['RaisesException'] in [None, 'Setter'])
+    # [TypeChecking]
+    has_type_checking_interface = (
+        (has_extended_attribute_value(interface, 'TypeChecking', 'Interface') or
+         has_extended_attribute_value(attribute, 'TypeChecking', 'Interface')) and
+        idl_type.is_wrapper_type)
+    has_type_checking_nullable = (
+        (has_extended_attribute_value(interface, 'TypeChecking', 'Nullable') or
+         has_extended_attribute_value(attribute, 'TypeChecking', 'Nullable')) and
+         idl_type.is_wrapper_type)
+    has_type_checking_unrestricted = (
+        (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted') or
+         has_extended_attribute_value(attribute, 'TypeChecking', 'Unrestricted')) and
+         idl_type.name in ('Float', 'Double'))
+
+    if (base_idl_type == 'EventHandler' and
+        interface.name in ['Window', 'WorkerGlobalScope'] and
+        attribute.name == 'onerror'):
+        includes.add('bindings/v8/V8ErrorHandler.h')
+
+    contents = {
+        'access_control_list': access_control_list(attribute),
+        'activity_logging_world_list_for_getter': v8_utilities.activity_logging_world_list(attribute, 'Getter'),  # [ActivityLogging]
+        'activity_logging_world_list_for_setter': v8_utilities.activity_logging_world_list(attribute, 'Setter'),  # [ActivityLogging]
+        'activity_logging_include_old_value_for_setter': 'LogPreviousValue' in extended_attributes,  # [ActivityLogging]
+        'activity_logging_world_check': v8_utilities.activity_logging_world_check(attribute),  # [ActivityLogging]
+        'cached_attribute_validation_method': extended_attributes.get('CachedAttribute'),
+        'conditional_string': v8_utilities.conditional_string(attribute),
+        'constructor_type': idl_type.constructor_type_name
+                            if is_constructor_attribute(attribute) else None,
+        'cpp_name': cpp_name(attribute),
+        'cpp_type': idl_type.cpp_type,
+        'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value(cpp_value='original', creation_context='info.Holder()'),
+        'deprecate_as': v8_utilities.deprecate_as(attribute),  # [DeprecateAs]
+        'enum_validation_expression': idl_type.enum_validation_expression,
+        'has_custom_getter': has_custom_getter,
+        'has_custom_setter': has_custom_setter,
+        'has_setter_exception_state':
+            is_setter_raises_exception or has_type_checking_interface or
+            has_type_checking_nullable or has_type_checking_unrestricted or
+            idl_type.is_integer_type or
+            idl_type.name in ('ByteString', 'ScalarValueString'),
+        'has_type_checking_interface': has_type_checking_interface,
+        'has_type_checking_nullable': has_type_checking_nullable,
+        'has_type_checking_unrestricted': has_type_checking_unrestricted,
+        'idl_type': str(idl_type),  # need trailing [] on array for Dictionary::ConversionContext::setConversionType
+        'is_call_with_execution_context': v8_utilities.has_extended_attribute_value(attribute, 'CallWith', 'ExecutionContext'),
+        'is_call_with_script_state': v8_utilities.has_extended_attribute_value(attribute, 'CallWith', 'ScriptState'),
+        'is_check_security_for_node': is_check_security_for_node,
+        'is_custom_element_callbacks': is_custom_element_callbacks,
+        'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes,
+        'is_getter_raises_exception':  # [RaisesException]
+            'RaisesException' in extended_attributes and
+            extended_attributes['RaisesException'] in (None, 'Getter'),
+        'is_initialized_by_event_constructor':
+            'InitializedByEventConstructor' in extended_attributes,
+        'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute),
+        'is_nullable': attribute.idl_type.is_nullable,
+        'is_partial_interface_member':
+            'PartialInterfaceImplementedAs' in extended_attributes,
+        'is_per_world_bindings': 'PerWorldBindings' in extended_attributes,
+        'is_read_only': attribute.is_read_only,
+        'is_reflect': is_reflect,
+        'is_replaceable': 'Replaceable' in attribute.extended_attributes,
+        'is_setter_call_with_execution_context': v8_utilities.has_extended_attribute_value(attribute, 'SetterCallWith', 'ExecutionContext'),
+        'is_setter_raises_exception': is_setter_raises_exception,
+        'is_static': attribute.is_static,
+        'is_url': 'URL' in extended_attributes,
+        'is_unforgeable': 'Unforgeable' in extended_attributes,
+        'measure_as': v8_utilities.measure_as(attribute),  # [MeasureAs]
+        'name': attribute.name,
+        'per_context_enabled_function': v8_utilities.per_context_enabled_function_name(attribute),  # [PerContextEnabled]
+        'property_attributes': property_attributes(attribute),
+        'put_forwards': 'PutForwards' in extended_attributes,
+        'reflect_empty': extended_attributes.get('ReflectEmpty'),
+        'reflect_invalid': extended_attributes.get('ReflectInvalid', ''),
+        'reflect_missing': extended_attributes.get('ReflectMissing'),
+        'reflect_only': extended_attributes['ReflectOnly'].split('|')
+            if 'ReflectOnly' in extended_attributes else None,
+        'setter_callback': setter_callback_name(interface, attribute),
+        'v8_type': v8_types.v8_type(base_idl_type),
+        'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(attribute),  # [RuntimeEnabled]
+        'world_suffixes': ['', 'ForMainWorld']
+                          if 'PerWorldBindings' in extended_attributes
+                          else [''],  # [PerWorldBindings]
+    }
+
+    if is_constructor_attribute(attribute):
+        generate_constructor_getter(interface, attribute, contents)
+        return contents
+    if not has_custom_getter:
+        generate_getter(interface, attribute, contents)
+    if (not has_custom_setter and
+        (not attribute.is_read_only or 'PutForwards' in extended_attributes)):
+        generate_setter(interface, attribute, contents)
+
+    return contents
+
+
+################################################################################
+# Getter
+################################################################################
+
+def generate_getter(interface, attribute, contents):
+    idl_type = attribute.idl_type
+    base_idl_type = idl_type.base_type
+    extended_attributes = attribute.extended_attributes
+
+    cpp_value = getter_expression(interface, attribute, contents)
+    # Normally we can inline the function call into the return statement to
+    # avoid the overhead of using a Ref<> temporary, but for some cases
+    # (nullable types, EventHandler, [CachedAttribute], or if there are
+    # exceptions), we need to use a local variable.
+    # FIXME: check if compilers are smart enough to inline this, and if so,
+    # always use a local variable (for readability and CG simplicity).
+    release = False
+    if (idl_type.is_nullable or
+        base_idl_type == 'EventHandler' or
+        'CachedAttribute' in extended_attributes or
+        'ReflectOnly' in extended_attributes or
+        contents['is_getter_raises_exception']):
+        contents['cpp_value_original'] = cpp_value
+        cpp_value = 'v8Value'
+        # EventHandler has special handling
+        if base_idl_type != 'EventHandler' and idl_type.is_interface_type:
+            release = True
+
+    def v8_set_return_value_statement(for_main_world=False):
+        if contents['is_keep_alive_for_gc']:
+            return 'v8SetReturnValue(info, wrapper)'
+        return idl_type.v8_set_return_value(cpp_value, extended_attributes=extended_attributes, script_wrappable='impl', release=release, for_main_world=for_main_world)
+
+    contents.update({
+        'cpp_value': cpp_value,
+        'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value(cpp_value=cpp_value, creation_context='info.Holder()'),
+        'v8_set_return_value_for_main_world': v8_set_return_value_statement(for_main_world=True),
+        'v8_set_return_value': v8_set_return_value_statement(),
+    })
+
+
+def getter_expression(interface, attribute, contents):
+    arguments = []
+    this_getter_base_name = getter_base_name(interface, attribute, arguments)
+    getter_name = scoped_name(interface, attribute, this_getter_base_name)
+
+    arguments.extend(v8_utilities.call_with_arguments(
+        attribute.extended_attributes.get('CallWith')))
+    # Members of IDL partial interface definitions are implemented in C++ as
+    # static member functions, which for instance members (non-static members)
+    # take *impl as their first argument
+    if ('PartialInterfaceImplementedAs' in attribute.extended_attributes and
+        not attribute.is_static):
+        arguments.append('*impl')
+    if attribute.idl_type.is_nullable and not contents['has_type_checking_nullable']:
+        arguments.append('isNull')
+    if contents['is_getter_raises_exception']:
+        arguments.append('exceptionState')
+    return '%s(%s)' % (getter_name, ', '.join(arguments))
+
+
+CONTENT_ATTRIBUTE_GETTER_NAMES = {
+    'boolean': 'fastHasAttribute',
+    'long': 'getIntegralAttribute',
+    'unsigned long': 'getUnsignedIntegralAttribute',
+}
+
+
+def getter_base_name(interface, attribute, arguments):
+    extended_attributes = attribute.extended_attributes
+    if 'Reflect' not in extended_attributes:
+        return uncapitalize(cpp_name(attribute))
+
+    content_attribute_name = extended_attributes['Reflect'] or attribute.name.lower()
+    if content_attribute_name in ['class', 'id', 'name']:
+        # Special-case for performance optimization.
+        return 'get%sAttribute' % content_attribute_name.capitalize()
+
+    arguments.append(scoped_content_attribute_name(interface, attribute))
+
+    base_idl_type = attribute.idl_type.base_type
+    if base_idl_type in CONTENT_ATTRIBUTE_GETTER_NAMES:
+        return CONTENT_ATTRIBUTE_GETTER_NAMES[base_idl_type]
+    if 'URL' in attribute.extended_attributes:
+        return 'getURLAttribute'
+    return 'fastGetAttribute'
+
+
+def is_keep_alive_for_gc(interface, attribute):
+    idl_type = attribute.idl_type
+    base_idl_type = idl_type.base_type
+    extended_attributes = attribute.extended_attributes
+    return (
+        # For readonly attributes, for performance reasons we keep the attribute
+        # wrapper alive while the owner wrapper is alive, because the attribute
+        # never changes.
+        (attribute.is_read_only and
+         idl_type.is_wrapper_type and
+         # There are some exceptions, however:
+         not(
+             # Node lifetime is managed by object grouping.
+             inherits_interface(interface.name, 'Node') or
+             inherits_interface(base_idl_type, 'Node') or
+             # A self-reference is unnecessary.
+             attribute.name == 'self' or
+             # FIXME: Remove these hard-coded hacks.
+             base_idl_type in ['EventTarget', 'Window'] or
+             base_idl_type.startswith(('HTML', 'SVG')))))
+
+
+################################################################################
+# Setter
+################################################################################
+
+def generate_setter(interface, attribute, contents):
+    def target_attribute():
+        target_interface_name = attribute.idl_type.base_type
+        target_attribute_name = extended_attributes['PutForwards']
+        target_interface = interfaces[target_interface_name]
+        try:
+            return next(attribute
+                        for attribute in target_interface.attributes
+                        if attribute.name == target_attribute_name)
+        except StopIteration:
+            raise Exception('[PutForward] target not found:\n'
+                            'Attribute "%s" is not present in interface "%s"' %
+                            (target_attribute_name, target_interface_name))
+
+    extended_attributes = attribute.extended_attributes
+
+    if 'PutForwards' in extended_attributes:
+        # Use target attribute in place of original attribute
+        attribute = target_attribute()
+
+    contents.update({
+        'cpp_setter': setter_expression(interface, attribute, contents),
+        'v8_value_to_local_cpp_value': attribute.idl_type.v8_value_to_local_cpp_value(extended_attributes, 'v8Value', 'cppValue'),
+    })
+
+
+def setter_expression(interface, attribute, contents):
+    extended_attributes = attribute.extended_attributes
+    arguments = v8_utilities.call_with_arguments(
+        extended_attributes.get('SetterCallWith') or
+        extended_attributes.get('CallWith'))
+
+    this_setter_base_name = setter_base_name(interface, attribute, arguments)
+    setter_name = scoped_name(interface, attribute, this_setter_base_name)
+
+    # Members of IDL partial interface definitions are implemented in C++ as
+    # static member functions, which for instance members (non-static members)
+    # take *impl as their first argument
+    if ('PartialInterfaceImplementedAs' in extended_attributes and
+        not attribute.is_static):
+        arguments.append('*impl')
+    idl_type = attribute.idl_type
+    if idl_type.base_type == 'EventHandler':
+        getter_name = scoped_name(interface, attribute, cpp_name(attribute))
+        contents['event_handler_getter_expression'] = '%s(%s)' % (
+            getter_name, ', '.join(arguments))
+        if (interface.name in ['Window', 'WorkerGlobalScope'] and
+            attribute.name == 'onerror'):
+            includes.add('bindings/v8/V8ErrorHandler.h')
+            arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHandler>(v8Value, true, V8ScriptState::current(info.GetIsolate()))')
+        else:
+            arguments.append('V8EventListenerList::getEventListener(V8ScriptState::current(info.GetIsolate()), v8Value, true, ListenerFindOrCreate)')
+    elif idl_type.is_interface_type and not idl_type.array_type:
+        # FIXME: should be able to eliminate WTF::getPtr in most or all cases
+        arguments.append('WTF::getPtr(cppValue)')
+    else:
+        arguments.append('cppValue')
+    if contents['is_setter_raises_exception']:
+        arguments.append('exceptionState')
+
+    return '%s(%s)' % (setter_name, ', '.join(arguments))
+
+
+CONTENT_ATTRIBUTE_SETTER_NAMES = {
+    'boolean': 'setBooleanAttribute',
+    'long': 'setIntegralAttribute',
+    'unsigned long': 'setUnsignedIntegralAttribute',
+}
+
+
+def setter_base_name(interface, attribute, arguments):
+    if 'Reflect' not in attribute.extended_attributes:
+        return 'set%s' % capitalize(cpp_name(attribute))
+    arguments.append(scoped_content_attribute_name(interface, attribute))
+
+    base_idl_type = attribute.idl_type.base_type
+    if base_idl_type in CONTENT_ATTRIBUTE_SETTER_NAMES:
+        return CONTENT_ATTRIBUTE_SETTER_NAMES[base_idl_type]
+    return 'setAttribute'
+
+
+def scoped_content_attribute_name(interface, attribute):
+    content_attribute_name = attribute.extended_attributes['Reflect'] or attribute.name.lower()
+    namespace = 'SVGNames' if interface.name.startswith('SVG') else 'HTMLNames'
+    includes.add('%s.h' % namespace)
+    return '%s::%sAttr' % (namespace, content_attribute_name)
+
+
+################################################################################
+# Attribute configuration
+################################################################################
+
+# [Replaceable]
+def setter_callback_name(interface, attribute):
+    cpp_class_name = cpp_name(interface)
+    extended_attributes = attribute.extended_attributes
+    if (('Replaceable' in extended_attributes and
+         'PutForwards' not in extended_attributes) or
+        is_constructor_attribute(attribute)):
+        # FIXME: rename to ForceSetAttributeOnThisCallback, since also used for Constructors
+        return '{0}V8Internal::{0}ReplaceableAttributeSetterCallback'.format(cpp_class_name)
+    if attribute.is_read_only and 'PutForwards' not in extended_attributes:
+        return '0'
+    return '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_name, attribute.name)
+
+
+# [DoNotCheckSecurity], [Unforgeable]
+def access_control_list(attribute):
+    extended_attributes = attribute.extended_attributes
+    access_control = []
+    if 'DoNotCheckSecurity' in extended_attributes:
+        do_not_check_security = extended_attributes['DoNotCheckSecurity']
+        if do_not_check_security == 'Setter':
+            access_control.append('v8::ALL_CAN_WRITE')
+        else:
+            access_control.append('v8::ALL_CAN_READ')
+            if (not attribute.is_read_only or
+                'Replaceable' in extended_attributes):
+                access_control.append('v8::ALL_CAN_WRITE')
+    if 'Unforgeable' in extended_attributes:
+        access_control.append('v8::PROHIBITS_OVERWRITING')
+    return access_control or ['v8::DEFAULT']
+
+
+# [NotEnumerable], [Unforgeable]
+def property_attributes(attribute):
+    extended_attributes = attribute.extended_attributes
+    property_attributes_list = []
+    if ('NotEnumerable' in extended_attributes or
+        is_constructor_attribute(attribute)):
+        property_attributes_list.append('v8::DontEnum')
+    if 'Unforgeable' in extended_attributes:
+        property_attributes_list.append('v8::DontDelete')
+    return property_attributes_list or ['v8::None']
+
+
+################################################################################
+# Constructors
+################################################################################
+
+idl_types.IdlType.constructor_type_name = property(
+    # FIXME: replace this with a [ConstructorAttribute] extended attribute
+    lambda self: strip_suffix(self.base_type, 'Constructor'))
+
+
+def is_constructor_attribute(attribute):
+    # FIXME: replace this with [ConstructorAttribute] extended attribute
+    return attribute.idl_type.base_type.endswith('Constructor')
+
+
+def generate_constructor_getter(interface, attribute, contents):
+    contents['needs_constructor_getter_callback'] = contents['measure_as'] or contents['deprecate_as']
diff --git a/bindings/scripts/v8_callback_interface.py b/bindings/scripts/v8_callback_interface.py
new file mode 100644
index 0000000..b1e21d9
--- /dev/null
+++ b/bindings/scripts/v8_callback_interface.py
@@ -0,0 +1,135 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Generate template values for a callback interface.
+
+Extends IdlType with property |callback_cpp_type|.
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
+"""
+
+from idl_types import IdlType
+from v8_globals import includes
+import v8_types
+import v8_utilities
+
+CALLBACK_INTERFACE_H_INCLUDES = frozenset([
+    'bindings/v8/ActiveDOMCallback.h',
+    'bindings/v8/DOMWrapperWorld.h',
+    'bindings/v8/ScopedPersistent.h',
+])
+CALLBACK_INTERFACE_CPP_INCLUDES = frozenset([
+    'bindings/v8/V8Binding.h',
+    'bindings/v8/V8Callback.h',
+    'core/dom/ExecutionContext.h',
+    'wtf/Assertions.h',
+    'wtf/GetPtr.h',
+    'wtf/RefPtr.h',
+])
+
+
+def cpp_type(idl_type):
+    # FIXME: remove this function by making callback types consistent
+    # (always use usual v8_types.cpp_type)
+    idl_type_name = idl_type.name
+    if idl_type_name == 'String':
+        return 'const String&'
+    if idl_type_name == 'void':
+        return 'void'
+    # Callbacks use raw pointers, so used_as_argument=True
+    usual_cpp_type = idl_type.cpp_type_args(used_as_argument=True)
+    if usual_cpp_type.startswith(('Vector', 'HeapVector', 'WillBeHeapVector')):
+        return 'const %s&' % usual_cpp_type
+    return usual_cpp_type
+
+IdlType.callback_cpp_type = property(cpp_type)
+
+
+def generate_callback_interface(callback_interface):
+    includes.clear()
+    includes.update(CALLBACK_INTERFACE_CPP_INCLUDES)
+    return {
+        'conditional_string': v8_utilities.conditional_string(callback_interface),
+        'cpp_class': callback_interface.name,
+        'v8_class': v8_utilities.v8_class_name(callback_interface),
+        'header_includes': set(CALLBACK_INTERFACE_H_INCLUDES),
+        'methods': [generate_method(operation)
+                    for operation in callback_interface.operations
+                    if not v8_utilities.dart_custom_method(operation.extended_attributes)],
+    }
+
+
+def add_includes_for_operation(operation):
+    operation.idl_type.add_includes_for_type()
+    for argument in operation.arguments:
+        argument.idl_type.add_includes_for_type()
+
+
+def generate_method(operation):
+    extended_attributes = operation.extended_attributes
+    idl_type = operation.idl_type
+    idl_type_str = str(idl_type)
+    if idl_type_str not in ['boolean', 'void']:
+        raise Exception('We only support callbacks that return boolean or void values.')
+    is_custom = 'Custom' in extended_attributes
+    if not is_custom:
+        add_includes_for_operation(operation)
+    call_with = extended_attributes.get('CallWith')
+    call_with_this_handle = v8_utilities.extended_attribute_value_contains(call_with, 'ThisValue')
+    contents = {
+        'call_with_this_handle': call_with_this_handle,
+        'cpp_type': idl_type.callback_cpp_type,
+        'custom': is_custom,
+        'idl_type': idl_type_str,
+        'name': operation.name,
+    }
+    contents.update(generate_arguments_contents(operation.arguments, call_with_this_handle))
+    return contents
+
+
+def generate_arguments_contents(arguments, call_with_this_handle):
+    def generate_argument(argument):
+        return {
+            'handle': '%sHandle' % argument.name,
+            # FIXME: setting creation_context=v8::Handle<v8::Object>() is
+            # wrong, as toV8 then implicitly uses the current context, which
+            # causes leaks between isolated worlds if a different context is
+            # used.
+            'cpp_value_to_v8_value': argument.idl_type.cpp_value_to_v8_value(
+                argument.name, isolate='isolate',
+                creation_context='m_scriptState->context()->Global()'),
+        }
+
+    argument_declarations = ['ScriptValue thisValue'] if call_with_this_handle else []
+    argument_declarations.extend(
+        '%s %s' % (argument.idl_type.callback_cpp_type, argument.name)
+        for argument in arguments)
+    return  {
+        'argument_declarations': argument_declarations,
+        'arguments': [generate_argument(argument) for argument in arguments],
+    }
diff --git a/bindings/scripts/v8_globals.py b/bindings/scripts/v8_globals.py
new file mode 100644
index 0000000..9ca2a35
--- /dev/null
+++ b/bindings/scripts/v8_globals.py
@@ -0,0 +1,32 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Module to share global variables (includes and interfaces) across modules."""
+
+includes = set()
+interfaces = {}
diff --git a/bindings/scripts/v8_interface.py b/bindings/scripts/v8_interface.py
new file mode 100644
index 0000000..02f0860
--- /dev/null
+++ b/bindings/scripts/v8_interface.py
@@ -0,0 +1,1089 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+# coding=utf-8
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Generate template values for an interface.
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
+"""
+
+from collections import defaultdict
+import itertools
+from operator import itemgetter
+
+import idl_types
+from idl_types import IdlType, inherits_interface
+import v8_attributes
+from v8_globals import includes
+import v8_methods
+import v8_types
+from v8_types import cpp_ptr_type, cpp_template_type
+import v8_utilities
+from v8_utilities import capitalize, conditional_string, cpp_name, gc_type, has_extended_attribute_value, runtime_enabled_function_name
+
+
+INTERFACE_H_INCLUDES = frozenset([
+    'bindings/v8/V8Binding.h',
+    'bindings/v8/V8DOMWrapper.h',
+    'bindings/v8/WrapperTypeInfo.h',
+    'platform/heap/Handle.h',
+])
+INTERFACE_CPP_INCLUDES = frozenset([
+    'bindings/v8/V8ExceptionState.h',
+    'bindings/v8/V8DOMConfiguration.h',
+    'bindings/v8/V8HiddenValue.h',
+    'bindings/v8/V8ObjectConstructor.h',
+    'core/dom/ContextFeatures.h',
+    'core/dom/Document.h',
+    'platform/RuntimeEnabledFeatures.h',
+    'platform/TraceEvent.h',
+    'wtf/GetPtr.h',
+    'wtf/RefPtr.h',
+])
+
+
+def generate_interface(interface):
+    includes.clear()
+    includes.update(INTERFACE_CPP_INCLUDES)
+    header_includes = set(INTERFACE_H_INCLUDES)
+
+    parent_interface = interface.parent
+    if parent_interface:
+        header_includes.update(v8_types.includes_for_interface(parent_interface))
+    extended_attributes = interface.extended_attributes
+
+    is_audio_buffer = inherits_interface(interface.name, 'AudioBuffer')
+    if is_audio_buffer:
+        includes.add('modules/webaudio/AudioBuffer.h')
+
+    is_document = inherits_interface(interface.name, 'Document')
+    if is_document:
+        includes.update(['bindings/v8/ScriptController.h',
+                         'bindings/v8/V8WindowShell.h',
+                         'core/frame/LocalFrame.h'])
+
+    # [ActiveDOMObject]
+    is_active_dom_object = 'ActiveDOMObject' in extended_attributes
+
+    # [CheckSecurity]
+    is_check_security = 'CheckSecurity' in extended_attributes
+    if is_check_security:
+        includes.add('bindings/common/BindingSecurity.h')
+
+    # [DependentLifetime]
+    is_dependent_lifetime = 'DependentLifetime' in extended_attributes
+
+    # [MeasureAs]
+    is_measure_as = 'MeasureAs' in extended_attributes
+    if is_measure_as:
+        includes.add('core/frame/UseCounter.h')
+
+    # [SetWrapperReferenceFrom]
+    reachable_node_function = extended_attributes.get('SetWrapperReferenceFrom')
+    if reachable_node_function:
+        includes.update(['bindings/v8/V8GCController.h',
+                         'core/dom/Element.h'])
+
+    # [SetWrapperReferenceTo]
+    set_wrapper_reference_to_list = [{
+        'name': argument.name,
+        # FIXME: properly should be:
+        # 'cpp_type': argument.idl_type.cpp_type_args(used_as_argument=True),
+        # (if type is non-wrapper type like NodeFilter, normally RefPtr)
+        # Raw pointers faster though, and NodeFilter hacky anyway.
+        'cpp_type': argument.idl_type.implemented_as + '*',
+        'idl_type': argument.idl_type,
+        'v8_type': v8_types.v8_type(argument.idl_type.name),
+    } for argument in extended_attributes.get('SetWrapperReferenceTo', [])]
+    for set_wrapper_reference_to in set_wrapper_reference_to_list:
+        set_wrapper_reference_to['idl_type'].add_includes_for_type()
+
+    # [SpecialWrapFor]
+    if 'SpecialWrapFor' in extended_attributes:
+        special_wrap_for = extended_attributes['SpecialWrapFor'].split('|')
+    else:
+        special_wrap_for = []
+    for special_wrap_interface in special_wrap_for:
+        v8_types.add_includes_for_interface(special_wrap_interface)
+
+    # [Custom=Wrap], [SetWrapperReferenceFrom]
+    has_visit_dom_wrapper = (
+        has_extended_attribute_value(interface, 'Custom', 'VisitDOMWrapper') or
+        reachable_node_function or
+        set_wrapper_reference_to_list)
+
+    this_gc_type = gc_type(interface)
+
+    template_contents = {
+        'conditional_string': conditional_string(interface),  # [Conditional]
+        'cpp_class': cpp_name(interface),
+        'gc_type': this_gc_type,
+        'has_custom_legacy_call_as_function': has_extended_attribute_value(interface, 'Custom', 'LegacyCallAsFunction'),  # [Custom=LegacyCallAsFunction]
+        'has_custom_to_v8': has_extended_attribute_value(interface, 'Custom', 'ToV8'),  # [Custom=ToV8]
+        'has_custom_wrap': has_extended_attribute_value(interface, 'Custom', 'Wrap'),  # [Custom=Wrap]
+        'has_visit_dom_wrapper': has_visit_dom_wrapper,
+        'header_includes': header_includes,
+        'interface_name': interface.name,
+        'is_active_dom_object': is_active_dom_object,
+        'is_audio_buffer': is_audio_buffer,
+        'is_check_security': is_check_security,
+        'is_dependent_lifetime': is_dependent_lifetime,
+        'is_document': is_document,
+        'is_event_target': inherits_interface(interface.name, 'EventTarget'),
+        'is_exception': interface.is_exception,
+        'is_node': inherits_interface(interface.name, 'Node'),
+        'measure_as': v8_utilities.measure_as(interface),  # [MeasureAs]
+        'parent_interface': parent_interface,
+        'pass_cpp_type': cpp_template_type(
+            cpp_ptr_type('PassRefPtr', 'RawPtr', this_gc_type),
+            cpp_name(interface)),
+        'reachable_node_function': reachable_node_function,
+        'runtime_enabled_function': runtime_enabled_function_name(interface),  # [RuntimeEnabled]
+        'set_wrapper_reference_to_list': set_wrapper_reference_to_list,
+        'special_wrap_for': special_wrap_for,
+        'v8_class': v8_utilities.v8_class_name(interface),
+        'wrapper_configuration': 'WrapperConfiguration::Dependent'
+            if (has_visit_dom_wrapper or
+                is_active_dom_object or
+                is_dependent_lifetime)
+            else 'WrapperConfiguration::Independent',
+    }
+
+    # Constructors
+    constructors = [generate_constructor(interface, constructor)
+                    for constructor in interface.constructors
+                    # FIXME: shouldn't put named constructors with constructors
+                    # (currently needed for Perl compatibility)
+                    # Handle named constructors separately
+                    if constructor.name == 'Constructor']
+    if len(constructors) > 1:
+        template_contents['constructor_overloads'] = generate_overloads(constructors)
+
+    # [CustomConstructor]
+    custom_constructors = [{  # Only needed for computing interface length
+        'number_of_required_arguments':
+            number_of_required_arguments(constructor),
+    } for constructor in interface.custom_constructors]
+
+    # [EventConstructor]
+    has_event_constructor = 'EventConstructor' in extended_attributes
+    any_type_attributes = [attribute for attribute in interface.attributes
+                           if attribute.idl_type.name == 'Any']
+    if has_event_constructor:
+        includes.add('bindings/common/Dictionary.h')
+        if any_type_attributes:
+            includes.add('bindings/v8/SerializedScriptValue.h')
+
+    # [NamedConstructor]
+    named_constructor = generate_named_constructor(interface)
+
+    if (constructors or custom_constructors or has_event_constructor or
+        named_constructor):
+        includes.add('bindings/v8/V8ObjectConstructor.h')
+        includes.add('core/frame/LocalDOMWindow.h')
+
+    template_contents.update({
+        'any_type_attributes': any_type_attributes,
+        'constructors': constructors,
+        'has_custom_constructor': bool(custom_constructors),
+        'has_event_constructor': has_event_constructor,
+        'interface_length':
+            interface_length(interface, constructors + custom_constructors),
+        'is_constructor_call_with_document': has_extended_attribute_value(
+            interface, 'ConstructorCallWith', 'Document'),  # [ConstructorCallWith=Document]
+        'is_constructor_call_with_execution_context': has_extended_attribute_value(
+            interface, 'ConstructorCallWith', 'ExecutionContext'),  # [ConstructorCallWith=ExeuctionContext]
+        'is_constructor_raises_exception': extended_attributes.get('RaisesException') == 'Constructor',  # [RaisesException=Constructor]
+        'named_constructor': named_constructor,
+    })
+
+    # Constants
+    template_contents.update({
+        'constants': [generate_constant(constant) for constant in interface.constants],
+        'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes,
+    })
+
+    # Attributes
+    attributes = [v8_attributes.generate_attribute(interface, attribute)
+                  for attribute in interface.attributes
+                  if not v8_utilities.dart_custom_method(attribute.extended_attributes)]
+    template_contents.update({
+        'attributes': attributes,
+        'has_accessors': any(attribute['is_expose_js_accessors'] for attribute in attributes),
+        'has_attribute_configuration': any(
+             not (attribute['is_expose_js_accessors'] or
+                  attribute['is_static'] or
+                  attribute['runtime_enabled_function'] or
+                  attribute['per_context_enabled_function'])
+             for attribute in attributes),
+        'has_constructor_attributes': any(attribute['constructor_type'] for attribute in attributes),
+        'has_per_context_enabled_attributes': any(attribute['per_context_enabled_function'] for attribute in attributes),
+        'has_replaceable_attributes': any(attribute['is_replaceable'] for attribute in attributes),
+    })
+
+    # Methods
+    methods = [v8_methods.generate_method(interface, method)
+               for method in interface.operations
+               if (method.name and  # Skip anonymous special operations (methods)
+                   not v8_utilities.dart_custom_method(method.extended_attributes))]
+    generate_method_overloads(methods)
+
+    per_context_enabled_methods = []
+    custom_registration_methods = []
+    method_configuration_methods = []
+
+    for method in methods:
+        # Skip all but one method in each set of overloaded methods.
+        if 'overload_index' in method and 'overloads' not in method:
+            continue
+
+        if 'overloads' in method:
+            overloads = method['overloads']
+            per_context_enabled_function = overloads['per_context_enabled_function_all']
+            runtime_enabled_function = overloads['runtime_enabled_function_all']
+            has_custom_registration = overloads['has_custom_registration_all']
+        else:
+            per_context_enabled_function = method['per_context_enabled_function']
+            runtime_enabled_function = method['runtime_enabled_function']
+            has_custom_registration = method['has_custom_registration']
+
+        if per_context_enabled_function:
+            per_context_enabled_methods.append(method)
+            continue
+        if runtime_enabled_function or has_custom_registration:
+            custom_registration_methods.append(method)
+            continue
+        method_configuration_methods.append(method)
+
+    for method in methods:
+        # The value of the Function object’s “length” property is a Number
+        # determined as follows:
+        # 1. Let S be the effective overload set for regular operations (if the
+        # operation is a regular operation) or for static operations (if the
+        # operation is a static operation) with identifier id on interface I and
+        # with argument count 0.
+        # 2. Return the length of the shortest argument list of the entries in S.
+        # FIXME: This calculation doesn't take into account whether runtime
+        # enabled overloads are actually enabled, so length may be incorrect.
+        # E.g., [RuntimeEnabled=Foo] void f(); void f(long x);
+        # should have length 1 if Foo is not enabled, but length 0 if it is.
+        method['length'] = (method['overloads']['minarg'] if 'overloads' in method else
+                            method['number_of_required_arguments'])
+
+    template_contents.update({
+        'custom_registration_methods': custom_registration_methods,
+        'has_origin_safe_method_setter': any(
+            method['is_check_security_for_frame'] and not method['is_read_only']
+            for method in methods),
+        'method_configuration_methods': method_configuration_methods,
+        'per_context_enabled_methods': per_context_enabled_methods,
+        'methods': methods,
+    })
+
+    template_contents.update({
+        'indexed_property_getter': indexed_property_getter(interface),
+        'indexed_property_setter': indexed_property_setter(interface),
+        'indexed_property_deleter': indexed_property_deleter(interface),
+        'is_override_builtins': 'OverrideBuiltins' in extended_attributes,
+        'named_property_getter': named_property_getter(interface),
+        'named_property_setter': named_property_setter(interface),
+        'named_property_deleter': named_property_deleter(interface),
+    })
+
+    return template_contents
+
+
+# [DeprecateAs], [Reflect], [RuntimeEnabled]
+def generate_constant(constant):
+    # (Blink-only) string literals are unquoted in tokenizer, must be re-quoted
+    # in C++.
+    if constant.idl_type.name == 'String':
+        value = '"%s"' % constant.value
+    else:
+        value = constant.value
+
+    extended_attributes = constant.extended_attributes
+    return {
+        'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'),
+        'name': constant.name,
+        # FIXME: use 'reflected_name' as correct 'name'
+        'reflected_name': extended_attributes.get('Reflect', constant.name),
+        'runtime_enabled_function': runtime_enabled_function_name(constant),
+        'value': value,
+    }
+
+
+################################################################################
+# Overloads
+################################################################################
+
+def generate_method_overloads(methods):
+    # Regular methods
+    generate_overloads_by_type([method for method in methods
+                                if not method['is_static']])
+    # Static methods
+    generate_overloads_by_type([method for method in methods
+                                if method['is_static']])
+
+
+def generate_overloads_by_type(methods):
+    """Generates |method.overload*| template values.
+
+    Called separately for static and non-static (regular) methods,
+    as these are overloaded separately.
+    Modifies |method| in place for |method| in |methods|.
+    Doesn't change the |methods| list itself (only the values, i.e. individual
+    methods), so ok to treat these separately.
+    """
+    # Add overload information only to overloaded methods, so template code can
+    # easily verify if a function is overloaded
+    for name, overloads in method_overloads_by_name(methods):
+        # Resolution function is generated after last overloaded function;
+        # package necessary information into |method.overloads| for that method.
+        overloads[-1]['overloads'] = generate_overloads(overloads)
+        overloads[-1]['overloads']['name'] = name
+
+
+def method_overloads_by_name(methods):
+    """Returns generator of overloaded methods by name: [name, [method]]"""
+    # Filter to only methods that are actually overloaded
+    method_counts = Counter(method['name'] for method in methods)
+    overloaded_method_names = set(name
+                                  for name, count in method_counts.iteritems()
+                                  if count > 1)
+    overloaded_methods = [method for method in methods
+                          if method['name'] in overloaded_method_names]
+
+    # Group by name (generally will be defined together, but not necessarily)
+    return sort_and_groupby(overloaded_methods, itemgetter('name'))
+
+
+def generate_overloads(overloads):
+    """Returns |overloads| template values for a single name.
+
+    Sets |method.overload_index| in place for |method| in |overloads|
+    and returns dict of overall overload template values.
+    """
+    assert len(overloads) > 1  # only apply to overloaded names
+    for index, method in enumerate(overloads, 1):
+        method['overload_index'] = index
+
+    effective_overloads_by_length = effective_overload_set_by_length(overloads)
+    lengths = [length for length, _ in effective_overloads_by_length]
+    name = overloads[0].get('name', '<constructor>')
+
+    # Check and fail if all overloads with the shortest acceptable arguments
+    # list are runtime enabled, since we would otherwise set 'length' on the
+    # function object to an incorrect value when none of those overloads were
+    # actually enabled at runtime. The exception is if all overloads are
+    # controlled by the same runtime enabled feature, in which case there would
+    # be no function object at all if it is not enabled.
+    shortest_overloads = effective_overloads_by_length[0][1]
+    if (all(method.get('runtime_enabled_function')
+            for method, _, _ in shortest_overloads) and
+        not common_value(overloads, 'runtime_enabled_function')):
+        raise ValueError('Function.length of %s depends on runtime enabled features' % name)
+
+    # Check and fail if overloads disagree on any of the extended attributes
+    # that affect how the method should be registered.
+    # Skip the check for overloaded constructors, since they don't support any
+    # of the extended attributes in question.
+    if not overloads[0].get('is_constructor'):
+        overload_extended_attributes = [
+            method['custom_registration_extended_attributes']
+            for method in overloads]
+        for extended_attribute in v8_methods.CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES:
+            if common_key(overload_extended_attributes, extended_attribute) is None:
+                raise ValueError('Overloads of %s have conflicting extended attribute %s'
+                                 % (name, extended_attribute))
+
+    return {
+        'deprecate_all_as': common_value(overloads, 'deprecate_as'),  # [DeprecateAs]
+        'length_tests_methods': length_tests_methods(effective_overloads_by_length),
+        'minarg': lengths[0],
+        # 1. Let maxarg be the length of the longest type list of the
+        # entries in S.
+        'maxarg': lengths[-1],
+        'measure_all_as': common_value(overloads, 'measure_as'),  # [MeasureAs]
+        'has_custom_registration_all': common_value(overloads, 'has_custom_registration'),
+        'per_context_enabled_function_all': common_value(overloads, 'per_context_enabled_function'),  # [PerContextEnabled]
+        'runtime_enabled_function_all': common_value(overloads, 'runtime_enabled_function'),  # [RuntimeEnabled]
+        'valid_arities': lengths
+            # Only need to report valid arities if there is a gap in the
+            # sequence of possible lengths, otherwise invalid length means
+            # "not enough arguments".
+            if lengths[-1] - lengths[0] != len(lengths) - 1 else None,
+    }
+
+
+def effective_overload_set(F):
+    """Returns the effective overload set of an overloaded function.
+
+    An effective overload set is the set of overloaded functions + signatures
+    (type list of arguments, with optional and variadic arguments included or
+    not), and is used in the overload resolution algorithm.
+
+    For example, given input [f1(optional long x), f2(DOMString s)], the output
+    is informally [f1(), f1(long), f2(DOMString)], and formally
+    [(f1, [], []), (f1, [long], [optional]), (f2, [DOMString], [required])].
+
+    Currently the optionality list is a list of |is_optional| booleans (True
+    means optional, False means required); to support variadics this needs to
+    be tri-valued as required, optional, or variadic.
+
+    Formally:
+    An effective overload set represents the allowable invocations for a
+    particular operation, constructor (specified with [Constructor] or
+    [NamedConstructor]), legacy caller or callback function.
+
+    An additional argument N (argument count) is needed when overloading
+    variadics, but we don't use that currently.
+
+    Spec: http://heycam.github.io/webidl/#dfn-effective-overload-set
+
+    Formally the input and output lists are sets, but methods are stored
+    internally as dicts, which can't be stored in a set because they are not
+    hashable, so we use lists instead.
+
+    Arguments:
+        F: list of overloads for a given callable name.
+
+    Returns:
+        S: list of tuples of the form (callable, type list, optionality list).
+    """
+    # Code closely follows the algorithm in the spec, for clarity and
+    # correctness, and hence is not very Pythonic.
+
+    # 1. Initialize S to ∅.
+    # (We use a list because we can't use a set, as noted above.)
+    S = []
+
+    # 2. Let F be a set with elements as follows, according to the kind of
+    # effective overload set:
+    # (Passed as argument, nothing to do.)
+
+    # 3. & 4. (maxarg, m) are only needed for variadics, not used.
+
+    # 5. For each operation, extended attribute or callback function X in F:
+    for X in F:  # X is the "callable", F is the overloads.
+        arguments = X['arguments']
+        # 1. Let n be the number of arguments X is declared to take.
+        n = len(arguments)
+        # 2. Let t0..n−1 be a list of types, where ti is the type of X’s
+        # argument at index i.
+        # (“type list”)
+        t = tuple(argument['idl_type_object'] for argument in arguments)
+        # 3. Let o0..n−1 be a list of optionality values, where oi is “variadic”
+        # if X’s argument at index i is a final, variadic argument, “optional”
+        # if the argument is optional, and “required” otherwise.
+        # (“optionality list”)
+        # (We’re just using a boolean for optional vs. required.)
+        o = tuple(argument['is_optional'] for argument in arguments)
+        # 4. Add to S the tuple <X, t0..n−1, o0..n−1>.
+        S.append((X, t, o))
+        # 5. If X is declared to be variadic, then:
+        # (Not used, so not implemented.)
+        # 6. Initialize i to n−1.
+        i = n - 1
+        # 7. While i ≥ 0:
+        # Spec bug (fencepost error); should be “While i > 0:”
+        # https://www.w3.org/Bugs/Public/show_bug.cgi?id=25590
+        while i > 0:
+            # 1. If argument i of X is not optional, then break this loop.
+            if not o[i]:
+                break
+            # 2. Otherwise, add to S the tuple <X, t0..i−1, o0..i−1>.
+            S.append((X, t[:i], o[:i]))
+            # 3. Set i to i−1.
+            i = i - 1
+        # 8. If n > 0 and all arguments of X are optional, then add to S the
+        # tuple <X, (), ()> (where “()” represents the empty list).
+        if n > 0 and all(oi for oi in o):
+            S.append((X, [], []))
+    # 6. The effective overload set is S.
+    return S
+
+
+def effective_overload_set_by_length(overloads):
+    def type_list_length(entry):
+        # Entries in the effective overload set are 3-tuples:
+        # (callable, type list, optionality list)
+        return len(entry[1])
+
+    effective_overloads = effective_overload_set(overloads)
+    return list(sort_and_groupby(effective_overloads, type_list_length))
+
+
+def distinguishing_argument_index(entries):
+    """Returns the distinguishing argument index for a sequence of entries.
+
+    Entries are elements of the effective overload set with the same number
+    of arguments (formally, same type list length), each a 3-tuple of the form
+    (callable, type list, optionality list).
+
+    Spec: http://heycam.github.io/webidl/#dfn-distinguishing-argument-index
+
+    If there is more than one entry in an effective overload set that has a
+    given type list length, then for those entries there must be an index i
+    such that for each pair of entries the types at index i are
+    distinguishable.
+    The lowest such index is termed the distinguishing argument index for the
+    entries of the effective overload set with the given type list length.
+    """
+    # Only applicable “If there is more than one entry”
+    assert len(entries) > 1
+    type_lists = [tuple(idl_type.name for idl_type in entry[1])
+                  for entry in entries]
+    type_list_length = len(type_lists[0])
+    # Only applicable for entries that “[have] a given type list length”
+    assert all(len(type_list) == type_list_length for type_list in type_lists)
+    name = entries[0][0].get('name', 'Constructor')  # for error reporting
+
+    # The spec defines the distinguishing argument index by conditions it must
+    # satisfy, but does not give an algorithm.
+    #
+    # We compute the distinguishing argument index by first computing the
+    # minimum index where not all types are the same, and then checking that
+    # all types in this position are distinguishable (and the optionality lists
+    # up to this point are identical), since "minimum index where not all types
+    # are the same" is a *necessary* condition, and more direct to check than
+    # distinguishability.
+    types_by_index = (set(types) for types in zip(*type_lists))
+    try:
+        # “In addition, for each index j, where j is less than the
+        #  distinguishing argument index for a given type list length, the types
+        #  at index j in all of the entries’ type lists must be the same”
+        index = next(i for i, types in enumerate(types_by_index)
+                     if len(types) > 1)
+    except StopIteration:
+        raise ValueError('No distinguishing index found for %s, length %s:\n'
+                         'All entries have the same type list:\n'
+                         '%s' % (name, type_list_length, type_lists[0]))
+    # Check optionality
+    # “and the booleans in the corresponding list indicating argument
+    #  optionality must be the same.”
+    # FIXME: spec typo: optionality value is no longer a boolean
+    # https://www.w3.org/Bugs/Public/show_bug.cgi?id=25628
+    initial_optionality_lists = set(entry[2][:index] for entry in entries)
+    if len(initial_optionality_lists) > 1:
+        raise ValueError(
+            'Invalid optionality lists for %s, length %s:\n'
+            'Optionality lists differ below distinguishing argument index %s:\n'
+            '%s'
+            % (name, type_list_length, index, set(initial_optionality_lists)))
+
+    # Check distinguishability
+    # http://heycam.github.io/webidl/#dfn-distinguishable
+    # Use names to check for distinct types, since objects are distinct
+    # FIXME: check distinguishability more precisely, for validation
+    distinguishing_argument_type_names = [type_list[index]
+                                          for type_list in type_lists]
+    if (len(set(distinguishing_argument_type_names)) !=
+        len(distinguishing_argument_type_names)):
+        raise ValueError('Types in distinguishing argument are not distinct:\n'
+                         '%s' % distinguishing_argument_type_names)
+
+    return index
+
+
+def length_tests_methods(effective_overloads_by_length):
+    """Returns sorted list of resolution tests and associated methods, by length.
+
+    This builds the main data structure for the overload resolution loop.
+    For a given argument length, bindings test argument at distinguishing
+    argument index, in order given by spec: if it is compatible with
+    (optionality or) type required by an overloaded method, resolve to that
+    method.
+
+    Returns:
+        [(length, [(test, method)])]
+    """
+    return [(length, list(resolution_tests_methods(effective_overloads)))
+            for length, effective_overloads in effective_overloads_by_length]
+
+
+def resolution_tests_methods(effective_overloads):
+    """Yields resolution test and associated method, in resolution order, for effective overloads of a given length.
+
+    This is the heart of the resolution algorithm.
+    http://heycam.github.io/webidl/#dfn-overload-resolution-algorithm
+
+    Note that a given method can be listed multiple times, with different tests!
+    This is to handle implicit type conversion.
+
+    Returns:
+        [(test, method)]
+    """
+    methods = [effective_overload[0]
+               for effective_overload in effective_overloads]
+    if len(methods) == 1:
+        # If only one method with a given length, no test needed
+        yield 'true', methods[0]
+        return
+
+    # 6. If there is more than one entry in S, then set d to be the
+    # distinguishing argument index for the entries of S.
+    index = distinguishing_argument_index(effective_overloads)
+    # (7-9 are for handling |undefined| values for optional arguments before
+    # the distinguishing argument (as “missing”), so you can specify only some
+    # optional arguments. We don’t support this, so we skip these steps.)
+    # 10. If i = d, then:
+    # (d is the distinguishing argument index)
+    # 1. Let V be argi.
+    #     Note: This is the argument that will be used to resolve which
+    #           overload is selected.
+    cpp_value = 'info[%s]' % index
+
+    # Extract argument and IDL type to simplify accessing these in each loop.
+    arguments = [method['arguments'][index] for method in methods]
+    arguments_methods = zip(arguments, methods)
+    idl_types = [argument['idl_type_object'] for argument in arguments]
+    idl_types_methods = zip(idl_types, methods)
+
+    # We can’t do a single loop through all methods or simply sort them, because
+    # a method may be listed in multiple steps of the resolution algorithm, and
+    # which test to apply differs depending on the step.
+    #
+    # Instead, we need to go through all methods at each step, either finding
+    # first match (if only one test is allowed) or filtering to matches (if
+    # multiple tests are allowed), and generating an appropriate tests.
+
+    # 2. If V is undefined, and there is an entry in S whose list of
+    # optionality values has “optional” at index i, then remove from S all
+    # other entries.
+    try:
+        method = next(method for argument, method in arguments_methods
+                      if argument['is_optional'])
+        test = '%s->IsUndefined()' % cpp_value
+        yield test, method
+    except StopIteration:
+        pass
+
+    # 3. Otherwise: if V is null or undefined, and there is an entry in S that
+    # has one of the following types at position i of its type list,
+    # • a nullable type
+    try:
+        method = next(method for idl_type, method in idl_types_methods
+                      if idl_type.is_nullable)
+        test = 'isUndefinedOrNull(%s)' % cpp_value
+        yield test, method
+    except StopIteration:
+        pass
+
+    # 4. Otherwise: if V is a platform object – but not a platform array
+    # object – and there is an entry in S that has one of the following
+    # types at position i of its type list,
+    # • an interface type that V implements
+    # (Unlike most of these tests, this can return multiple methods, since we
+    #  test if it implements an interface. Thus we need a for loop, not a next.)
+    # (We distinguish wrapper types from built-in interface types.)
+    for idl_type, method in ((idl_type, method)
+                             for idl_type, method in idl_types_methods
+                             if idl_type.is_wrapper_type):
+        test = 'V8{idl_type}::hasInstance({cpp_value}, isolate)'.format(idl_type=idl_type.base_type, cpp_value=cpp_value)
+        yield test, method
+
+    # 8. Otherwise: if V is any kind of object except for a native Date object,
+    # a native RegExp object, and there is an entry in S that has one of the
+    # following types at position i of its type list,
+    # • an array type
+    # • a sequence type
+    # ...
+    # • a dictionary
+    try:
+        # FIXME: IDL dictionary not implemented, so use Blink Dictionary
+        # http://crbug.com/321462
+        idl_type, method = next((idl_type, method)
+                                for idl_type, method in idl_types_methods
+                                if (idl_type.array_or_sequence_type or
+                                    idl_type.name == 'Dictionary'))
+        if idl_type.array_or_sequence_type:
+            # (We test for Array instead of generic Object to type-check.)
+            # FIXME: test for Object during resolution, then have type check for
+            # Array in overloaded method: http://crbug.com/262383
+            test = '%s->IsArray()' % cpp_value
+        else:
+            # FIXME: should be '{1}->IsObject() && !{1}->IsDate() && !{1}->IsRegExp()'.format(cpp_value)
+            # FIXME: the IsDate and IsRegExp checks can be skipped if we've
+            # already generated tests for them.
+            test = '%s->IsObject()' % cpp_value
+        yield test, method
+    except StopIteration:
+        pass
+
+    # (Check for exact type matches before performing automatic type conversion;
+    # only needed if distinguishing between primitive types.)
+    if len([idl_type.is_primitive_type for idl_type in idl_types]) > 1:
+        # (Only needed if match in step 11, otherwise redundant.)
+        if any(idl_type.name == 'String' or idl_type.is_enum
+               for idl_type in idl_types):
+            # 10. Otherwise: if V is a Number value, and there is an entry in S
+            # that has one of the following types at position i of its type
+            # list,
+            # • a numeric type
+            try:
+                method = next(method for idl_type, method in idl_types_methods
+                              if idl_type.is_numeric_type)
+                test = '%s->IsNumber()' % cpp_value
+                yield test, method
+            except StopIteration:
+                pass
+
+    # (Perform automatic type conversion, in order. If any of these match,
+    # that’s the end, and no other tests are needed.) To keep this code simple,
+    # we rely on the C++ compiler's dead code elimination to deal with the
+    # redundancy if both cases below trigger.
+
+    # 11. Otherwise: if there is an entry in S that has one of the following
+    # types at position i of its type list,
+    # • DOMString
+    # • an enumeration type
+    # * ByteString
+    # Blink: ScalarValueString is a pending Web IDL addition
+    try:
+        method = next(method for idl_type, method in idl_types_methods
+                      if idl_type.name in ('String',
+                                           'ByteString',
+                                           'ScalarValueString') or
+                      idl_type.is_enum)
+        yield 'true', method
+    except StopIteration:
+        pass
+
+    # 12. Otherwise: if there is an entry in S that has one of the following
+    # types at position i of its type list,
+    # • a numeric type
+    try:
+        method = next(method for idl_type, method in idl_types_methods
+                      if idl_type.is_numeric_type)
+        yield 'true', method
+    except StopIteration:
+        pass
+
+
+################################################################################
+# Utility functions
+################################################################################
+
+def Counter(iterable):
+    # Once using Python 2.7, using collections.Counter
+    counter = defaultdict(lambda: 0)
+    for item in iterable:
+        counter[item] += 1
+    return counter
+
+
+def common(dicts, f):
+    """Returns common result of f across an iterable of dicts, or None.
+
+    Call f for each dict and return its result if the same across all dicts.
+    """
+    values = (f(d) for d in dicts)
+    first_value = next(values)
+    if all(value == first_value for value in values):
+        return first_value
+    return None
+
+
+def common_key(dicts, key):
+    """Returns common presence of a key across an iterable of dicts, or None.
+
+    True if all dicts have the key, False if none of the dicts have the key,
+    and None if some but not all dicts have the key.
+    """
+    return common(dicts, lambda d: key in d)
+
+
+def common_value(dicts, key):
+    """Returns common value of a key across an iterable of dicts, or None.
+
+    Auxiliary function for overloads, so can consolidate an extended attribute
+    that appears with the same value on all items in an overload set.
+    """
+    return common(dicts, lambda d: d.get(key))
+
+
+def sort_and_groupby(l, key=None):
+    """Returns a generator of (key, list), sorting and grouping list by key."""
+    l.sort(key=key)
+    return ((k, list(g)) for k, g in itertools.groupby(l, key))
+
+
+################################################################################
+# Constructors
+################################################################################
+
+# [Constructor]
+def generate_constructor(interface, constructor):
+    arguments_need_try_catch = any(v8_methods.argument_needs_try_catch(argument)
+                                   for argument in constructor.arguments)
+
+    return {
+        'arguments': [v8_methods.generate_argument(interface, constructor, argument, index)
+                      for index, argument in enumerate(constructor.arguments)],
+        'arguments_need_try_catch': arguments_need_try_catch,
+        'cpp_type': cpp_template_type(
+            cpp_ptr_type('RefPtr', 'RawPtr', gc_type(interface)),
+            cpp_name(interface)),
+        'cpp_value': v8_methods.cpp_value(
+            interface, constructor, len(constructor.arguments)),
+        'has_exception_state':
+            # [RaisesException=Constructor]
+            interface.extended_attributes.get('RaisesException') == 'Constructor' or
+            any(argument for argument in constructor.arguments
+                if argument.idl_type.name == 'SerializedScriptValue' or
+                   argument.idl_type.is_integer_type),
+        'is_constructor': True,
+        'is_named_constructor': False,
+        'number_of_required_arguments':
+            number_of_required_arguments(constructor),
+    }
+
+
+# [NamedConstructor]
+def generate_named_constructor(interface):
+    extended_attributes = interface.extended_attributes
+    if 'NamedConstructor' not in extended_attributes:
+        return None
+    # FIXME: parser should return named constructor separately;
+    # included in constructors (and only name stored in extended attribute)
+    # for Perl compatibility
+    idl_constructor = interface.constructors[-1]
+    assert idl_constructor.name == 'NamedConstructor'
+    constructor = generate_constructor(interface, idl_constructor)
+    constructor.update({
+        'name': extended_attributes['NamedConstructor'],
+        'is_named_constructor': True,
+    })
+    return constructor
+
+
+def number_of_required_arguments(constructor):
+    return len([argument for argument in constructor.arguments
+                if not argument.is_optional])
+
+
+def interface_length(interface, constructors):
+    # Docs: http://heycam.github.io/webidl/#es-interface-call
+    if 'EventConstructor' in interface.extended_attributes:
+        return 1
+    if not constructors:
+        return 0
+    return min(constructor['number_of_required_arguments']
+               for constructor in constructors)
+
+
+################################################################################
+# Special operations (methods)
+# http://heycam.github.io/webidl/#idl-special-operations
+################################################################################
+
+def property_getter(getter, cpp_arguments):
+    def is_null_expression(idl_type):
+        if idl_type.is_union_type:
+            return ' && '.join('!result%sEnabled' % i
+                               for i, _ in enumerate(idl_type.member_types))
+        if idl_type.name == 'String':
+            return 'result.isNull()'
+        if idl_type.is_interface_type:
+            return '!result'
+        return ''
+
+    idl_type = getter.idl_type
+    extended_attributes = getter.extended_attributes
+    is_raises_exception = 'RaisesException' in extended_attributes
+
+    # FIXME: make more generic, so can use v8_methods.cpp_value
+    cpp_method_name = 'impl->%s' % cpp_name(getter)
+
+    if is_raises_exception:
+        cpp_arguments.append('exceptionState')
+    union_arguments = idl_type.union_arguments
+    if union_arguments:
+        cpp_arguments.extend(union_arguments)
+
+    cpp_value = '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments))
+
+    return {
+        'cpp_type': idl_type.cpp_type,
+        'cpp_value': cpp_value,
+        'is_custom':
+            'Custom' in extended_attributes and
+            (not extended_attributes['Custom'] or
+             has_extended_attribute_value(getter, 'Custom', 'PropertyGetter')),
+        'is_custom_property_enumerator': has_extended_attribute_value(
+            getter, 'Custom', 'PropertyEnumerator'),
+        'is_custom_property_query': has_extended_attribute_value(
+            getter, 'Custom', 'PropertyQuery'),
+        'is_enumerable': 'NotEnumerable' not in extended_attributes,
+        'is_null_expression': is_null_expression(idl_type),
+        'is_raises_exception': is_raises_exception,
+        'name': cpp_name(getter),
+        'union_arguments': union_arguments,
+        'v8_set_return_value': idl_type.v8_set_return_value('result', extended_attributes=extended_attributes, script_wrappable='impl', release=idl_type.release),
+    }
+
+
+def property_setter(setter):
+    idl_type = setter.arguments[1].idl_type
+    extended_attributes = setter.extended_attributes
+    is_raises_exception = 'RaisesException' in extended_attributes
+    return {
+        'has_type_checking_interface':
+            has_extended_attribute_value(setter, 'TypeChecking', 'Interface') and
+            idl_type.is_wrapper_type,
+        'idl_type': idl_type.base_type,
+        'is_custom': 'Custom' in extended_attributes,
+        'has_exception_state': is_raises_exception or
+                               idl_type.is_integer_type,
+        'is_raises_exception': is_raises_exception,
+        'name': cpp_name(setter),
+        'v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value(
+            extended_attributes, 'v8Value', 'propertyValue'),
+    }
+
+
+def property_deleter(deleter):
+    idl_type = deleter.idl_type
+    if str(idl_type) != 'boolean':
+        raise Exception(
+            'Only deleters with boolean type are allowed, but type is "%s"' %
+            idl_type)
+    extended_attributes = deleter.extended_attributes
+    return {
+        'is_custom': 'Custom' in extended_attributes,
+        'is_raises_exception': 'RaisesException' in extended_attributes,
+        'name': cpp_name(deleter),
+    }
+
+
+################################################################################
+# Indexed properties
+# http://heycam.github.io/webidl/#idl-indexed-properties
+################################################################################
+
+def indexed_property_getter(interface):
+    try:
+        # Find indexed property getter, if present; has form:
+        # getter TYPE [OPTIONAL_IDENTIFIER](unsigned long ARG1)
+        getter = next(
+            method
+            for method in interface.operations
+            if ('getter' in method.specials and
+                len(method.arguments) == 1 and
+                str(method.arguments[0].idl_type) == 'unsigned long'))
+    except StopIteration:
+        return None
+
+    return property_getter(getter, ['index'])
+
+
+def indexed_property_setter(interface):
+    try:
+        # Find indexed property setter, if present; has form:
+        # setter RETURN_TYPE [OPTIONAL_IDENTIFIER](unsigned long ARG1, ARG_TYPE ARG2)
+        setter = next(
+            method
+            for method in interface.operations
+            if ('setter' in method.specials and
+                len(method.arguments) == 2 and
+                str(method.arguments[0].idl_type) == 'unsigned long'))
+    except StopIteration:
+        return None
+
+    return property_setter(setter)
+
+
+def indexed_property_deleter(interface):
+    try:
+        # Find indexed property deleter, if present; has form:
+        # deleter TYPE [OPTIONAL_IDENTIFIER](unsigned long ARG)
+        deleter = next(
+            method
+            for method in interface.operations
+            if ('deleter' in method.specials and
+                len(method.arguments) == 1 and
+                str(method.arguments[0].idl_type) == 'unsigned long'))
+    except StopIteration:
+        return None
+
+    return property_deleter(deleter)
+
+
+################################################################################
+# Named properties
+# http://heycam.github.io/webidl/#idl-named-properties
+################################################################################
+
+def named_property_getter(interface):
+    try:
+        # Find named property getter, if present; has form:
+        # getter TYPE [OPTIONAL_IDENTIFIER](DOMString ARG1)
+        getter = next(
+            method
+            for method in interface.operations
+            if ('getter' in method.specials and
+                len(method.arguments) == 1 and
+                str(method.arguments[0].idl_type) == 'DOMString'))
+    except StopIteration:
+        return None
+
+    getter.name = getter.name or 'anonymousNamedGetter'
+    return property_getter(getter, ['propertyName'])
+
+
+def named_property_setter(interface):
+    try:
+        # Find named property setter, if present; has form:
+        # setter RETURN_TYPE [OPTIONAL_IDENTIFIER](DOMString ARG1, ARG_TYPE ARG2)
+        setter = next(
+            method
+            for method in interface.operations
+            if ('setter' in method.specials and
+                len(method.arguments) == 2 and
+                str(method.arguments[0].idl_type) == 'DOMString'))
+    except StopIteration:
+        return None
+
+    return property_setter(setter)
+
+
+def named_property_deleter(interface):
+    try:
+        # Find named property deleter, if present; has form:
+        # deleter TYPE [OPTIONAL_IDENTIFIER](DOMString ARG)
+        deleter = next(
+            method
+            for method in interface.operations
+            if ('deleter' in method.specials and
+                len(method.arguments) == 1 and
+                str(method.arguments[0].idl_type) == 'DOMString'))
+    except StopIteration:
+        return None
+
+    return property_deleter(deleter)
diff --git a/bindings/scripts/v8_methods.py b/bindings/scripts/v8_methods.py
new file mode 100644
index 0000000..38baa7b
--- /dev/null
+++ b/bindings/scripts/v8_methods.py
@@ -0,0 +1,349 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Generate template values for methods.
+
+Extends IdlType and IdlUnionType with property |union_arguments|.
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
+"""
+
+from idl_types import IdlType, IdlUnionType, inherits_interface
+from v8_globals import includes
+import v8_types
+import v8_utilities
+from v8_utilities import has_extended_attribute_value
+
+
+# Methods with any of these require custom method registration code in the
+# interface's configure*Template() function.
+CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES = frozenset([
+    'DoNotCheckSecurity',
+    'DoNotCheckSignature',
+    'NotEnumerable',
+    'ReadOnly',
+    'Unforgeable',
+])
+
+
+def argument_needs_try_catch(argument):
+    idl_type = argument.idl_type
+    base_type = not idl_type.array_or_sequence_type and idl_type.base_type
+
+    return not (
+        # These cases are handled by separate code paths in the
+        # generate_argument() macro in Source/bindings/templates/methods.cpp.
+        idl_type.is_callback_interface or
+        base_type == 'SerializedScriptValue' or
+        (argument.is_variadic and idl_type.is_wrapper_type) or
+        # String and enumeration arguments converted using one of the
+        # TOSTRING_* macros in Source/bindings/v8/V8BindingMacros.h don't
+        # use a v8::TryCatch.
+        (base_type == 'DOMString' and not argument.is_variadic))
+
+
+def generate_method(interface, method):
+    arguments = method.arguments
+    extended_attributes = method.extended_attributes
+    idl_type = method.idl_type
+    is_static = method.is_static
+    name = method.name
+
+    idl_type.add_includes_for_type()
+    this_cpp_value = cpp_value(interface, method, len(arguments))
+
+    def function_template():
+        if is_static:
+            return 'functionTemplate'
+        if 'Unforgeable' in extended_attributes:
+            return 'instanceTemplate'
+        return 'prototypeTemplate'
+
+    is_call_with_script_arguments = has_extended_attribute_value(method, 'CallWith', 'ScriptArguments')
+    if is_call_with_script_arguments:
+        includes.update(['bindings/v8/ScriptCallStackFactory.h',
+                         'core/inspector/ScriptArguments.h'])
+    is_call_with_script_state = has_extended_attribute_value(method, 'CallWith', 'ScriptState')
+    if is_call_with_script_state:
+        includes.add('bindings/v8/V8ScriptState.h')
+    is_check_security_for_node = 'CheckSecurity' in extended_attributes
+    if is_check_security_for_node:
+        includes.add('bindings/common/BindingSecurity.h')
+    is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attributes
+    if is_custom_element_callbacks:
+        includes.add('core/dom/custom/CustomElementCallbackDispatcher.h')
+
+    has_event_listener_argument = any(
+        argument for argument in arguments
+        if argument.idl_type.name == 'EventListener')
+    is_check_security_for_frame = (
+        'CheckSecurity' in interface.extended_attributes and
+        'DoNotCheckSecurity' not in extended_attributes)
+    is_raises_exception = 'RaisesException' in extended_attributes
+
+    arguments_need_try_catch = any(argument_needs_try_catch(argument)
+                                   for argument in arguments)
+
+    return {
+        'activity_logging_world_list': v8_utilities.activity_logging_world_list(method),  # [ActivityLogging]
+        'arguments': [generate_argument(interface, method, argument, index)
+                      for index, argument in enumerate(arguments)],
+        'arguments_need_try_catch': arguments_need_try_catch,
+        'conditional_string': v8_utilities.conditional_string(method),
+        'cpp_type': idl_type.cpp_type,
+        'cpp_value': this_cpp_value,
+        'custom_registration_extended_attributes':
+            CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES.intersection(
+                extended_attributes.iterkeys()),
+        'deprecate_as': v8_utilities.deprecate_as(method),  # [DeprecateAs]
+        'function_template': function_template(),
+        'has_custom_registration': is_static or
+            v8_utilities.has_extended_attribute(
+                method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES),
+        'has_event_listener_argument': has_event_listener_argument,
+        'has_exception_state':
+            has_event_listener_argument or
+            is_raises_exception or
+            is_check_security_for_frame or
+            any(argument for argument in arguments
+                if argument.idl_type.name in ('ByteString',
+                                              'ScalarValueString',
+                                              'SerializedScriptValue') or
+                   argument.idl_type.is_integer_type),
+        'idl_type': idl_type.base_type,
+        'is_call_with_execution_context': has_extended_attribute_value(method, 'CallWith', 'ExecutionContext'),
+        'is_call_with_script_arguments': is_call_with_script_arguments,
+        'is_call_with_script_state': is_call_with_script_state,
+        'is_check_security_for_frame': is_check_security_for_frame,
+        'is_check_security_for_node': is_check_security_for_node,
+        'is_custom': 'Custom' in extended_attributes,
+        'is_custom_element_callbacks': is_custom_element_callbacks,
+        'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes,
+        'is_do_not_check_signature': 'DoNotCheckSignature' in extended_attributes,
+        'is_partial_interface_member':
+            'PartialInterfaceImplementedAs' in extended_attributes,
+        'is_per_world_bindings': 'PerWorldBindings' in extended_attributes,
+        'is_raises_exception': is_raises_exception,
+        'is_read_only': 'ReadOnly' in extended_attributes,
+        'is_static': is_static,
+        'is_variadic': arguments and arguments[-1].is_variadic,
+        'measure_as': v8_utilities.measure_as(method),  # [MeasureAs]
+        'name': name,
+        'number_of_arguments': len(arguments),
+        'number_of_required_arguments': len([
+            argument for argument in arguments
+            if not (argument.is_optional or argument.is_variadic)]),
+        'number_of_required_or_variadic_arguments': len([
+            argument for argument in arguments
+            if not argument.is_optional]),
+        'per_context_enabled_function': v8_utilities.per_context_enabled_function_name(method),  # [PerContextEnabled]
+        'property_attributes': property_attributes(method),
+        'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(method),  # [RuntimeEnabled]
+        'signature': 'v8::Local<v8::Signature>()' if is_static or 'DoNotCheckSignature' in extended_attributes else 'defaultSignature',
+        'union_arguments': idl_type.union_arguments,
+        'v8_set_return_value_for_main_world': v8_set_return_value(interface.name, method, this_cpp_value, for_main_world=True),
+        'v8_set_return_value': v8_set_return_value(interface.name, method, this_cpp_value),
+        'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended_attributes else [''],  # [PerWorldBindings]
+    }
+
+
+def generate_argument(interface, method, argument, index):
+    extended_attributes = argument.extended_attributes
+    idl_type = argument.idl_type
+    this_cpp_value = cpp_value(interface, method, index)
+    is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type
+
+    return {
+        'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attributes,
+                                           used_as_argument=True,
+                                           used_as_variadic_argument=argument.is_variadic),
+        'cpp_value': this_cpp_value,
+        # FIXME: check that the default value's type is compatible with the argument's
+        'default_value': str(argument.default_value) if argument.default_value else None,
+        'enum_validation_expression': idl_type.enum_validation_expression,
+        # FIXME: remove once [Default] removed and just use argument.default_value
+        'has_default': 'Default' in extended_attributes or argument.default_value,
+        'has_event_listener_argument': any(
+            argument_so_far for argument_so_far in method.arguments[:index]
+            if argument_so_far.idl_type.name == 'EventListener'),
+        'has_type_checking_interface':
+            (has_extended_attribute_value(interface, 'TypeChecking', 'Interface') or
+             has_extended_attribute_value(method, 'TypeChecking', 'Interface')) and
+            idl_type.is_wrapper_type,
+        'has_type_checking_unrestricted':
+            (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted') or
+             has_extended_attribute_value(method, 'TypeChecking', 'Unrestricted')) and
+            idl_type.name in ('Float', 'Double'),
+        # Dictionary is special-cased, but arrays and sequences shouldn't be
+        'idl_type': not idl_type.array_or_sequence_type and idl_type.base_type,
+        'idl_type_object': idl_type,
+        'index': index,
+        'is_clamp': 'Clamp' in extended_attributes,
+        'is_callback_interface': idl_type.is_callback_interface,
+        'is_nullable': idl_type.is_nullable,
+        'is_optional': argument.is_optional,
+        'is_variadic_wrapper_type': is_variadic_wrapper_type,
+        'vector_type': v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc_type),
+        'is_wrapper_type': idl_type.is_wrapper_type,
+        'name': argument.name,
+        'v8_set_return_value_for_main_world': v8_set_return_value(interface.name, method, this_cpp_value, for_main_world=True),
+        'v8_set_return_value': v8_set_return_value(interface.name, method, this_cpp_value),
+        'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(argument, index),
+    }
+
+
+################################################################################
+# Value handling
+################################################################################
+
+def cpp_value(interface, method, number_of_arguments):
+    def cpp_argument(argument):
+        idl_type = argument.idl_type
+        if idl_type.name == 'EventListener':
+            if (interface.name == 'EventTarget' and
+                method.name == 'removeEventListener'):
+                # FIXME: remove this special case by moving get() into
+                # EventTarget::removeEventListener
+                return '%s.get()' % argument.name
+            return argument.name
+        if (idl_type.is_callback_interface or
+            idl_type.name in ['NodeFilter', 'XPathNSResolver']):
+            # FIXME: remove this special case
+            return '%s.release()' % argument.name
+        return argument.name
+
+    # Truncate omitted optional arguments
+    arguments = method.arguments[:number_of_arguments]
+    cpp_arguments = []
+    if method.is_constructor:
+        call_with_values = interface.extended_attributes.get('ConstructorCallWith')
+    else:
+        call_with_values = method.extended_attributes.get('CallWith')
+    cpp_arguments.extend(v8_utilities.call_with_arguments(call_with_values))
+    # Members of IDL partial interface definitions are implemented in C++ as
+    # static member functions, which for instance members (non-static members)
+    # take *impl as their first argument
+    if ('PartialInterfaceImplementedAs' in method.extended_attributes and
+        not method.is_static):
+        cpp_arguments.append('*impl')
+    cpp_arguments.extend(cpp_argument(argument) for argument in arguments)
+    this_union_arguments = method.idl_type and method.idl_type.union_arguments
+    if this_union_arguments:
+        cpp_arguments.extend(this_union_arguments)
+
+    if ('RaisesException' in method.extended_attributes or
+        (method.is_constructor and
+         has_extended_attribute_value(interface, 'RaisesException', 'Constructor'))):
+        cpp_arguments.append('exceptionState')
+
+    if method.name == 'Constructor':
+        base_name = 'create'
+    elif method.name == 'NamedConstructor':
+        base_name = 'createForJSConstructor'
+    else:
+        base_name = v8_utilities.cpp_name(method)
+
+    cpp_method_name = v8_utilities.scoped_name(interface, method, base_name)
+    return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments))
+
+
+def v8_set_return_value(interface_name, method, cpp_value, for_main_world=False):
+    idl_type = method.idl_type
+    extended_attributes = method.extended_attributes
+    if not idl_type or idl_type.name == 'void':
+        # Constructors and void methods don't have a return type
+        return None
+
+    release = False
+    # [CallWith=ScriptState], [RaisesException]
+    if (has_extended_attribute_value(method, 'CallWith', 'ScriptState') or
+        'RaisesException' in extended_attributes or
+        idl_type.is_union_type):
+        cpp_value = 'result'  # use local variable for value
+        release = idl_type.release
+
+    script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else ''
+    return idl_type.v8_set_return_value(cpp_value, extended_attributes, script_wrappable=script_wrappable, release=release, for_main_world=for_main_world)
+
+
+def v8_value_to_local_cpp_variadic_value(argument, index):
+    assert argument.is_variadic
+    idl_type = argument.idl_type
+
+    macro = 'TONATIVE_VOID_INTERNAL'
+    macro_args = [
+      argument.name,
+      'toNativeArguments<%s>(info, %s)' % (idl_type.cpp_type, index),
+    ]
+
+    return '%s(%s)' % (macro, ', '.join(macro_args))
+
+
+def v8_value_to_local_cpp_value(argument, index):
+    extended_attributes = argument.extended_attributes
+    idl_type = argument.idl_type
+    name = argument.name
+    if argument.is_variadic:
+        return v8_value_to_local_cpp_variadic_value(argument, index)
+    # FIXME: This special way of handling string arguments with null defaults
+    # can go away once we fully support default values.
+    if (argument.is_optional and
+        idl_type.name in ('String', 'ByteString', 'ScalarValueString') and
+        argument.default_value and argument.default_value.is_null):
+        v8_value = 'argumentOrNull(info, %s)' % index
+    else:
+        v8_value = 'info[%s]' % index
+    return idl_type.v8_value_to_local_cpp_value(extended_attributes, v8_value,
+                                                name, index=index, declare_variable=False)
+
+
+################################################################################
+# Auxiliary functions
+################################################################################
+
+# [NotEnumerable]
+def property_attributes(method):
+    extended_attributes = method.extended_attributes
+    property_attributes_list = []
+    if 'NotEnumerable' in extended_attributes:
+        property_attributes_list.append('v8::DontEnum')
+    if 'ReadOnly' in extended_attributes:
+        property_attributes_list.append('v8::ReadOnly')
+    if property_attributes_list:
+        property_attributes_list.insert(0, 'v8::DontDelete')
+    return property_attributes_list
+
+
+def union_arguments(idl_type):
+    """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for union types, for use in setting return value"""
+    return [arg
+            for i in range(len(idl_type.member_types))
+            for arg in ['result%sEnabled' % i, 'result%s' % i]]
+
+IdlType.union_arguments = property(lambda self: None)
+IdlUnionType.union_arguments = property(union_arguments)
diff --git a/bindings/scripts/v8_types.py b/bindings/scripts/v8_types.py
new file mode 100644
index 0000000..50e512b
--- /dev/null
+++ b/bindings/scripts/v8_types.py
@@ -0,0 +1,691 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Functions for type handling and type conversion (Blink/C++ <-> V8/JS).
+
+Extends IdlType and IdlUnionType with V8-specific properties, methods, and
+class methods.
+
+Spec:
+http://www.w3.org/TR/WebIDL/#es-type-mapping
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
+"""
+
+import posixpath
+
+from idl_types import IdlType, IdlUnionType
+import v8_attributes  # for IdlType.constructor_type_name
+from v8_globals import includes
+
+
+################################################################################
+# V8-specific handling of IDL types
+################################################################################
+
+NON_WRAPPER_TYPES = frozenset([
+    'CompareHow',
+    'Dictionary',
+    'EventHandler',
+    'EventListener',
+    'MediaQueryListListener',
+    'NodeFilter',
+    'SerializedScriptValue',
+])
+TYPED_ARRAYS = {
+    # (cpp_type, v8_type), used by constructor templates
+    'ArrayBuffer': None,
+    'ArrayBufferView': None,
+    'Float32Array': ('float', 'v8::kExternalFloatArray'),
+    'Float64Array': ('double', 'v8::kExternalDoubleArray'),
+    'Int8Array': ('signed char', 'v8::kExternalByteArray'),
+    'Int16Array': ('short', 'v8::kExternalShortArray'),
+    'Int32Array': ('int', 'v8::kExternalIntArray'),
+    'Uint8Array': ('unsigned char', 'v8::kExternalUnsignedByteArray'),
+    'Uint8ClampedArray': ('unsigned char', 'v8::kExternalPixelArray'),
+    'Uint16Array': ('unsigned short', 'v8::kExternalUnsignedShortArray'),
+    'Uint32Array': ('unsigned int', 'v8::kExternalUnsignedIntArray'),
+}
+
+IdlType.is_typed_array_type = property(
+    lambda self: self.base_type in TYPED_ARRAYS)
+
+
+IdlType.is_wrapper_type = property(
+    lambda self: (self.is_interface_type and
+                  self.base_type not in NON_WRAPPER_TYPES))
+
+
+################################################################################
+# C++ types
+################################################################################
+
+CPP_TYPE_SAME_AS_IDL_TYPE = set([
+    'double',
+    'float',
+    'long long',
+    'unsigned long long',
+])
+CPP_INT_TYPES = set([
+    'byte',
+    'long',
+    'short',
+])
+CPP_UNSIGNED_TYPES = set([
+    'octet',
+    'unsigned int',
+    'unsigned long',
+    'unsigned short',
+])
+CPP_SPECIAL_CONVERSION_RULES = {
+    'CompareHow': 'Range::CompareHow',
+    'Date': 'double',
+    'Dictionary': 'Dictionary',
+    'EventHandler': 'EventListener*',
+    'MediaQueryListListener': 'RefPtrWillBeRawPtr<MediaQueryListListener>',
+    'NodeFilter': 'RefPtrWillBeRawPtr<NodeFilter>',
+    'Promise': 'ScriptPromise',
+    'ScriptValue': 'ScriptValue',
+    # FIXME: Eliminate custom bindings for XPathNSResolver  http://crbug.com/345529
+    'XPathNSResolver': 'RefPtrWillBeRawPtr<XPathNSResolver>',
+    'boolean': 'bool',
+    'unrestricted double': 'double',
+    'unrestricted float': 'float',
+}
+
+
+def cpp_type(idl_type, extended_attributes=None, used_as_argument=False, used_as_variadic_argument=False, used_in_cpp_sequence=False):
+    """Returns C++ type corresponding to IDL type.
+
+    |idl_type| argument is of type IdlType, while return value is a string
+
+    Args:
+        idl_type:
+            IdlType
+        used_as_argument:
+            bool, True if idl_type's raw/primitive C++ type should be returned.
+        used_in_cpp_sequence:
+            bool, True if the C++ type is used as an element of an array or sequence.
+    """
+    def string_mode():
+        # FIXME: the Web IDL spec requires 'EmptyString', not 'NullString',
+        # but we use NullString for performance.
+        if extended_attributes.get('TreatNullAs') != 'NullString':
+            return ''
+        if extended_attributes.get('TreatUndefinedAs') != 'NullString':
+            return 'WithNullCheck'
+        return 'WithUndefinedOrNullCheck'
+
+    extended_attributes = extended_attributes or {}
+    idl_type = idl_type.preprocessed_type
+
+    # Composite types
+    if used_as_variadic_argument:
+        array_or_sequence_type = idl_type
+    else:
+        array_or_sequence_type = idl_type.array_or_sequence_type
+    if array_or_sequence_type:
+        vector_type = cpp_ptr_type('Vector', 'HeapVector', array_or_sequence_type.gc_type)
+        return cpp_template_type(vector_type, array_or_sequence_type.cpp_type_args(used_in_cpp_sequence=True))
+
+    # Simple types
+    base_idl_type = idl_type.base_type
+
+    if base_idl_type in CPP_TYPE_SAME_AS_IDL_TYPE:
+        return base_idl_type
+    if base_idl_type in CPP_INT_TYPES:
+        return 'int'
+    if base_idl_type in CPP_UNSIGNED_TYPES:
+        return 'unsigned'
+    if base_idl_type in CPP_SPECIAL_CONVERSION_RULES:
+        return CPP_SPECIAL_CONVERSION_RULES[base_idl_type]
+
+    if base_idl_type in NON_WRAPPER_TYPES:
+        return 'RefPtr<%s>' % base_idl_type
+    if base_idl_type in ('DOMString', 'ByteString', 'ScalarValueString'):
+        if not used_as_argument:
+            return 'String'
+        return 'V8StringResource<%s>' % string_mode()
+
+    if idl_type.is_typed_array_type and used_as_argument:
+        return base_idl_type + '*'
+    if idl_type.is_interface_type:
+        implemented_as_class = idl_type.implemented_as
+        if used_as_argument:
+            return implemented_as_class + '*'
+        new_type = 'Member' if used_in_cpp_sequence else 'RawPtr'
+        ptr_type = cpp_ptr_type('RefPtr', new_type, idl_type.gc_type)
+        return cpp_template_type(ptr_type, implemented_as_class)
+    # Default, assume native type is a pointer with same type name as idl type
+    return base_idl_type + '*'
+
+
+def cpp_type_union(idl_type, extended_attributes=None, used_as_argument=False):
+    return (member_type.cpp_type for member_type in idl_type.member_types)
+
+
+# Allow access as idl_type.cpp_type if no arguments
+IdlType.cpp_type = property(cpp_type)
+IdlUnionType.cpp_type = property(cpp_type_union)
+IdlType.cpp_type_args = cpp_type
+IdlUnionType.cpp_type_args = cpp_type_union
+
+
+def cpp_template_type(template, inner_type):
+    """Returns C++ template specialized to type, with space added if needed."""
+    if inner_type.endswith('>'):
+        format_string = '{template}<{inner_type} >'
+    else:
+        format_string = '{template}<{inner_type}>'
+    return format_string.format(template=template, inner_type=inner_type)
+
+
+def cpp_ptr_type(old_type, new_type, gc_type):
+    if gc_type == 'GarbageCollectedObject':
+        return new_type
+    if gc_type == 'WillBeGarbageCollectedObject':
+        if old_type == 'Vector':
+            return 'WillBe' + new_type
+        return old_type + 'WillBe' + new_type
+    return old_type
+
+
+def v8_type(interface_name):
+    return 'V8' + interface_name
+
+
+# [ImplementedAs]
+# This handles [ImplementedAs] on interface types, not [ImplementedAs] in the
+# interface being generated. e.g., given:
+#   Foo.idl: interface Foo {attribute Bar bar};
+#   Bar.idl: [ImplementedAs=Zork] interface Bar {};
+# when generating bindings for Foo, the [ImplementedAs] on Bar is needed.
+# This data is external to Foo.idl, and hence computed as global information in
+# compute_interfaces_info.py to avoid having to parse IDLs of all used interfaces.
+IdlType.implemented_as_interfaces = {}
+
+
+def implemented_as(idl_type):
+    base_idl_type = idl_type.base_type
+    if base_idl_type in IdlType.implemented_as_interfaces:
+        return IdlType.implemented_as_interfaces[base_idl_type]
+    return base_idl_type
+
+
+IdlType.implemented_as = property(implemented_as)
+
+IdlType.set_implemented_as_interfaces = classmethod(
+    lambda cls, new_implemented_as_interfaces:
+        cls.implemented_as_interfaces.update(new_implemented_as_interfaces))
+
+
+# [GarbageCollected]
+IdlType.garbage_collected_types = set()
+
+IdlType.is_garbage_collected = property(
+    lambda self: self.base_type in IdlType.garbage_collected_types)
+
+IdlType.set_garbage_collected_types = classmethod(
+    lambda cls, new_garbage_collected_types:
+        cls.garbage_collected_types.update(new_garbage_collected_types))
+
+
+# [WillBeGarbageCollected]
+IdlType.will_be_garbage_collected_types = set()
+
+IdlType.is_will_be_garbage_collected = property(
+    lambda self: self.base_type in IdlType.will_be_garbage_collected_types)
+
+IdlType.set_will_be_garbage_collected_types = classmethod(
+    lambda cls, new_will_be_garbage_collected_types:
+        cls.will_be_garbage_collected_types.update(new_will_be_garbage_collected_types))
+
+
+def gc_type(idl_type):
+    if idl_type.is_garbage_collected:
+        return 'GarbageCollectedObject'
+    if idl_type.is_will_be_garbage_collected:
+        return 'WillBeGarbageCollectedObject'
+    return 'RefCountedObject'
+
+IdlType.gc_type = property(gc_type)
+
+
+################################################################################
+# Includes
+################################################################################
+
+def includes_for_cpp_class(class_name, relative_dir_posix):
+    return set([posixpath.join('bindings', relative_dir_posix, class_name + '.h')])
+
+
+INCLUDES_FOR_TYPE = {
+    'object': set(),
+    'CompareHow': set(),
+    'Dictionary': set(['bindings/common/Dictionary.h']),
+    'EventHandler': set(['bindings/v8/V8AbstractEventListener.h',
+                         'bindings/v8/V8EventListenerList.h']),
+    'EventListener': set(['bindings/common/BindingSecurity.h',
+                          'bindings/v8/V8EventListenerList.h',
+                          'core/frame/LocalDOMWindow.h']),
+    'HTMLCollection': set(['bindings/core/v8/V8HTMLCollection.h',
+                           'core/dom/ClassCollection.h',
+                           'core/dom/TagCollection.h',
+                           'core/html/HTMLCollection.h',
+                           'core/html/HTMLFormControlsCollection.h',
+                           'core/html/HTMLTableRowsCollection.h']),
+    'MediaQueryListListener': set(['core/css/MediaQueryListListener.h']),
+    'NodeList': set(['bindings/core/v8/V8NodeList.h',
+                     'core/dom/NameNodeList.h',
+                     'core/dom/NodeList.h',
+                     'core/dom/StaticNodeList.h',
+                     'core/html/LabelsNodeList.h']),
+    'Promise': set(['bindings/v8/ScriptPromise.h']),
+    'SerializedScriptValue': set(['bindings/v8/SerializedScriptValue.h']),
+    'ScriptValue': set(['bindings/common/ScriptValue.h']),
+}
+
+
+def includes_for_type(idl_type):
+    idl_type = idl_type.preprocessed_type
+
+    # Composite types
+    array_or_sequence_type = idl_type.array_or_sequence_type
+    if array_or_sequence_type:
+        return includes_for_type(array_or_sequence_type)
+
+    # Simple types
+    base_idl_type = idl_type.base_type
+    if base_idl_type in INCLUDES_FOR_TYPE:
+        return INCLUDES_FOR_TYPE[base_idl_type]
+    if idl_type.is_basic_type:
+        return set()
+    if idl_type.is_typed_array_type:
+        return set(['bindings/v8/custom/V8%sCustom.h' % base_idl_type])
+    if base_idl_type.endswith('ConstructorConstructor'):
+        # FIXME: rename to NamedConstructor
+        # FIXME: replace with a [NamedConstructorAttribute] extended attribute
+        # Ending with 'ConstructorConstructor' indicates a named constructor,
+        # and these do not have header files, as they are part of the generated
+        # bindings for the interface
+        return set()
+    if base_idl_type.endswith('Constructor'):
+        # FIXME: replace with a [ConstructorAttribute] extended attribute
+        base_idl_type = idl_type.constructor_type_name
+    return set(['bindings/%s/v8/V8%s.h' % (component_dir[base_idl_type],
+                                           base_idl_type)])
+
+IdlType.includes_for_type = property(includes_for_type)
+IdlUnionType.includes_for_type = property(
+    lambda self: set.union(*[includes_for_type(member_type)
+                             for member_type in self.member_types]))
+
+
+def add_includes_for_type(idl_type):
+    includes.update(idl_type.includes_for_type)
+
+IdlType.add_includes_for_type = add_includes_for_type
+IdlUnionType.add_includes_for_type = add_includes_for_type
+
+
+def includes_for_interface(interface_name):
+    return IdlType(interface_name).includes_for_type
+
+
+def add_includes_for_interface(interface_name):
+    includes.update(includes_for_interface(interface_name))
+
+component_dir = {}
+
+
+def set_component_dirs(new_component_dirs):
+        component_dir.update(new_component_dirs)
+
+
+################################################################################
+# V8 -> C++
+################################################################################
+
+V8_VALUE_TO_CPP_VALUE = {
+    # Basic
+    'Date': 'toCoreDate({v8_value})',
+    'DOMString': '{v8_value}',
+    'ByteString': 'toByteString({arguments})',
+    'ScalarValueString': 'toScalarValueString({arguments})',
+    'boolean': '{v8_value}->BooleanValue()',
+    'float': 'static_cast<float>({v8_value}->NumberValue())',
+    'unrestricted float': 'static_cast<float>({v8_value}->NumberValue())',
+    'double': 'static_cast<double>({v8_value}->NumberValue())',
+    'unrestricted double': 'static_cast<double>({v8_value}->NumberValue())',
+    'byte': 'toInt8({arguments})',
+    'octet': 'toUInt8({arguments})',
+    'short': 'toInt16({arguments})',
+    'unsigned short': 'toUInt16({arguments})',
+    'long': 'toInt32({arguments})',
+    'unsigned long': 'toUInt32({arguments})',
+    'long long': 'toInt64({arguments})',
+    'unsigned long long': 'toUInt64({arguments})',
+    # Interface types
+    'CompareHow': 'static_cast<Range::CompareHow>({v8_value}->Int32Value())',
+    'Dictionary': 'Dictionary({v8_value}, info.GetIsolate())',
+    'EventTarget': 'V8DOMWrapper::isDOMWrapper({v8_value}) ? toWrapperTypeInfo(v8::Handle<v8::Object>::Cast({v8_value}))->toEventTarget(v8::Handle<v8::Object>::Cast({v8_value})) : 0',
+    'MediaQueryListListener': 'MediaQueryListListener::create(V8ScriptState::current(info.GetIsolate()), ScriptValue(V8ScriptState::current(info.GetIsolate()), {v8_value}))',
+    'NodeFilter': 'toNodeFilter({v8_value}, info.Holder(), V8ScriptState::current(info.GetIsolate()))',
+    'Promise': 'ScriptPromise::cast(V8ScriptState::current(info.GetIsolate()), {v8_value})',
+    'SerializedScriptValue': 'SerializedScriptValue::create({v8_value}, info.GetIsolate())',
+    'ScriptValue': 'ScriptValue(V8ScriptState::current(info.GetIsolate()), {v8_value})',
+    'Window': 'toDOMWindow({v8_value}, info.GetIsolate())',
+    'XPathNSResolver': 'toXPathNSResolver({v8_value}, info.GetIsolate())',
+}
+
+
+def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index):
+    # Composite types
+    array_or_sequence_type = idl_type.array_or_sequence_type
+    if array_or_sequence_type:
+        return v8_value_to_cpp_value_array_or_sequence(array_or_sequence_type, v8_value, index)
+
+    # Simple types
+    idl_type = idl_type.preprocessed_type
+    add_includes_for_type(idl_type)
+    base_idl_type = idl_type.base_type
+
+    if 'EnforceRange' in extended_attributes:
+        arguments = ', '.join([v8_value, 'EnforceRange', 'exceptionState'])
+    elif (idl_type.is_integer_type or  # NormalConversion
+          idl_type.name in ('ByteString', 'ScalarValueString')):
+        arguments = ', '.join([v8_value, 'exceptionState'])
+    else:
+        arguments = v8_value
+
+    if base_idl_type in V8_VALUE_TO_CPP_VALUE:
+        cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type]
+    elif idl_type.is_typed_array_type:
+        cpp_expression_format = (
+            '{v8_value}->Is{idl_type}() ? '
+            'V8{idl_type}::toNative(v8::Handle<v8::{idl_type}>::Cast({v8_value})) : 0')
+    else:
+        cpp_expression_format = (
+            'V8{idl_type}::toNativeWithTypeCheck(info.GetIsolate(), {v8_value})')
+
+    return cpp_expression_format.format(arguments=arguments, idl_type=base_idl_type, v8_value=v8_value)
+
+
+def v8_value_to_cpp_value_array_or_sequence(array_or_sequence_type, v8_value, index):
+    # Index is None for setters, index (starting at 0) for method arguments,
+    # and is used to provide a human-readable exception message
+    if index is None:
+        index = 0  # special case, meaning "setter"
+    else:
+        index += 1  # human-readable index
+    if (array_or_sequence_type.is_interface_type and
+        array_or_sequence_type.name != 'Dictionary'):
+        this_cpp_type = None
+        ref_ptr_type = cpp_ptr_type('RefPtr', 'Member', array_or_sequence_type.gc_type)
+        expression_format = '(to{ref_ptr_type}NativeArray<{array_or_sequence_type}, V8{array_or_sequence_type}>({v8_value}, {index}, info.GetIsolate()))'
+        add_includes_for_type(array_or_sequence_type)
+    else:
+        ref_ptr_type = None
+        this_cpp_type = array_or_sequence_type.cpp_type
+        expression_format = 'toNativeArray<{cpp_type}>({v8_value}, {index}, info.GetIsolate())'
+    expression = expression_format.format(array_or_sequence_type=array_or_sequence_type.name, cpp_type=this_cpp_type, index=index, ref_ptr_type=ref_ptr_type, v8_value=v8_value)
+    return expression
+
+
+def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variable_name, index=None, declare_variable=True):
+    """Returns an expression that converts a V8 value to a C++ value and stores it as a local value."""
+    this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attributes, used_as_argument=True)
+
+    idl_type = idl_type.preprocessed_type
+    cpp_value = v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index)
+    args = [variable_name, cpp_value]
+    if idl_type.base_type == 'DOMString' and not idl_type.array_or_sequence_type:
+        macro = 'TOSTRING_VOID'
+    elif (idl_type.is_integer_type or
+          idl_type.name in ('ByteString', 'ScalarValueString')):
+        macro = 'TONATIVE_VOID_EXCEPTIONSTATE'
+        args.append('exceptionState')
+    else:
+        macro = 'TONATIVE_VOID'
+
+    # Macros come in several variants, to minimize expensive creation of
+    # v8::TryCatch.
+    suffix = ''
+
+    if declare_variable:
+        args.insert(0, this_cpp_type)
+    else:
+        suffix += '_INTERNAL'
+
+    return '%s(%s)' % (macro + suffix, ', '.join(args))
+
+
+IdlType.v8_value_to_local_cpp_value = v8_value_to_local_cpp_value
+IdlUnionType.v8_value_to_local_cpp_value = v8_value_to_local_cpp_value
+
+
+################################################################################
+# C++ -> V8
+################################################################################
+
+def preprocess_idl_type(idl_type):
+    if idl_type.is_enum:
+        # Enumerations are internally DOMStrings
+        return IdlType('DOMString')
+    if (idl_type.name == 'Any' or idl_type.is_callback_function):
+        return IdlType('ScriptValue')
+    return idl_type
+
+IdlType.preprocessed_type = property(preprocess_idl_type)
+IdlUnionType.preprocessed_type = property(preprocess_idl_type)
+
+
+def preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes):
+    """Returns IDL type and value, with preliminary type conversions applied."""
+    idl_type = idl_type.preprocessed_type
+    if idl_type.name == 'Promise':
+        idl_type = IdlType('ScriptValue')
+    if idl_type.base_type in ['long long', 'unsigned long long']:
+        # long long and unsigned long long are not representable in ECMAScript;
+        # we represent them as doubles.
+        idl_type = IdlType('double', is_nullable=idl_type.is_nullable)
+        cpp_value = 'static_cast<double>(%s)' % cpp_value
+    # HTML5 says that unsigned reflected attributes should be in the range
+    # [0, 2^31). When a value isn't in this range, a default value (or 0)
+    # should be returned instead.
+    extended_attributes = extended_attributes or {}
+    if ('Reflect' in extended_attributes and
+        idl_type.base_type in ['unsigned long', 'unsigned short']):
+        cpp_value = cpp_value.replace('getUnsignedIntegralAttribute',
+                                      'getIntegralAttribute')
+        cpp_value = 'std::max(0, %s)' % cpp_value
+    return idl_type, cpp_value
+
+
+def v8_conversion_type(idl_type, extended_attributes):
+    """Returns V8 conversion type, adding any additional includes.
+
+    The V8 conversion type is used to select the C++ -> V8 conversion function
+    or v8SetReturnValue* function; it can be an idl_type, a cpp_type, or a
+    separate name for the type of conversion (e.g., 'DOMWrapper').
+    """
+    extended_attributes = extended_attributes or {}
+
+    # Composite types
+    array_or_sequence_type = idl_type.array_or_sequence_type
+    if array_or_sequence_type:
+        if array_or_sequence_type.is_interface_type:
+            add_includes_for_type(array_or_sequence_type)
+        return 'array'
+
+    # Simple types
+    base_idl_type = idl_type.base_type
+    # Basic types, without additional includes
+    if base_idl_type in CPP_INT_TYPES:
+        return 'int'
+    if base_idl_type in CPP_UNSIGNED_TYPES:
+        return 'unsigned'
+    if base_idl_type in ('DOMString', 'ByteString', 'ScalarValueString'):
+        if 'TreatReturnedNullStringAs' not in extended_attributes:
+            return base_idl_type
+        treat_returned_null_string_as = extended_attributes['TreatReturnedNullStringAs']
+        if treat_returned_null_string_as == 'Null':
+            return 'StringOrNull'
+        if treat_returned_null_string_as == 'Undefined':
+            return 'StringOrUndefined'
+        raise 'Unrecognized TreatReturnNullStringAs value: "%s"' % treat_returned_null_string_as
+    if idl_type.is_basic_type or base_idl_type == 'ScriptValue':
+        return base_idl_type
+
+    # Data type with potential additional includes
+    add_includes_for_type(idl_type)
+    if base_idl_type in V8_SET_RETURN_VALUE:  # Special v8SetReturnValue treatment
+        return base_idl_type
+
+    # Pointer type
+    return 'DOMWrapper'
+
+IdlType.v8_conversion_type = v8_conversion_type
+
+
+V8_SET_RETURN_VALUE = {
+    'boolean': 'v8SetReturnValueBool(info, {cpp_value})',
+    'int': 'v8SetReturnValueInt(info, {cpp_value})',
+    'unsigned': 'v8SetReturnValueUnsigned(info, {cpp_value})',
+    'DOMString': 'v8SetReturnValueString(info, {cpp_value}, info.GetIsolate())',
+    'ByteString': 'v8SetReturnValueString(info, {cpp_value}, info.GetIsolate())',
+    'ScalarValueString': 'v8SetReturnValueString(info, {cpp_value}, info.GetIsolate())',
+    # [TreatNullReturnValueAs]
+    'StringOrNull': 'v8SetReturnValueStringOrNull(info, {cpp_value}, info.GetIsolate())',
+    'StringOrUndefined': 'v8SetReturnValueStringOrUndefined(info, {cpp_value}, info.GetIsolate())',
+    'void': '',
+    # No special v8SetReturnValue* function (set value directly)
+    'float': 'v8SetReturnValue(info, {cpp_value})',
+    'unrestricted float': 'v8SetReturnValue(info, {cpp_value})',
+    'double': 'v8SetReturnValue(info, {cpp_value})',
+    'unrestricted double': 'v8SetReturnValue(info, {cpp_value})',
+    # No special v8SetReturnValue* function, but instead convert value to V8
+    # and then use general v8SetReturnValue.
+    'array': 'v8SetReturnValue(info, {cpp_value})',
+    'Date': 'v8SetReturnValue(info, {cpp_value})',
+    'EventHandler': 'v8SetReturnValue(info, {cpp_value})',
+    'ScriptValue': 'v8SetReturnValue(info, {cpp_value})',
+    'SerializedScriptValue': 'v8SetReturnValue(info, {cpp_value})',
+    # DOMWrapper
+    'DOMWrapperForMainWorld': 'v8SetReturnValueForMainWorld(info, WTF::getPtr({cpp_value}))',
+    'DOMWrapperFast': 'v8SetReturnValueFast(info, WTF::getPtr({cpp_value}), {script_wrappable})',
+    'DOMWrapperDefault': 'v8SetReturnValue(info, {cpp_value})',
+}
+
+
+def v8_set_return_value(idl_type, cpp_value, extended_attributes=None, script_wrappable='', release=False, for_main_world=False):
+    """Returns a statement that converts a C++ value to a V8 value and sets it as a return value.
+
+    """
+    def dom_wrapper_conversion_type():
+        if not script_wrappable:
+            return 'DOMWrapperDefault'
+        if for_main_world:
+            return 'DOMWrapperForMainWorld'
+        return 'DOMWrapperFast'
+
+    idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes)
+    this_v8_conversion_type = idl_type.v8_conversion_type(extended_attributes)
+    # SetReturn-specific overrides
+    if this_v8_conversion_type in ['Date', 'EventHandler', 'ScriptValue', 'SerializedScriptValue', 'array']:
+        # Convert value to V8 and then use general v8SetReturnValue
+        cpp_value = idl_type.cpp_value_to_v8_value(cpp_value, extended_attributes=extended_attributes)
+    if this_v8_conversion_type == 'DOMWrapper':
+        this_v8_conversion_type = dom_wrapper_conversion_type()
+
+    format_string = V8_SET_RETURN_VALUE[this_v8_conversion_type]
+    # FIXME: oilpan: Remove .release() once we remove all RefPtrs from generated code.
+    if release:
+        cpp_value = '%s.release()' % cpp_value
+    statement = format_string.format(cpp_value=cpp_value, script_wrappable=script_wrappable)
+    return statement
+
+
+def v8_set_return_value_union(idl_type, cpp_value, extended_attributes=None, script_wrappable='', release=False, for_main_world=False):
+    """
+    release: can be either False (False for all member types) or
+             a sequence (list or tuple) of booleans (if specified individually).
+    """
+
+    return [
+        member_type.v8_set_return_value(cpp_value + str(i),
+                                        extended_attributes,
+                                        script_wrappable,
+                                        release and release[i],
+                                        for_main_world)
+            for i, member_type in
+            enumerate(idl_type.member_types)]
+
+IdlType.v8_set_return_value = v8_set_return_value
+IdlUnionType.v8_set_return_value = v8_set_return_value_union
+
+IdlType.release = property(lambda self: self.is_interface_type)
+IdlUnionType.release = property(
+    lambda self: [member_type.is_interface_type
+                  for member_type in self.member_types])
+
+
+CPP_VALUE_TO_V8_VALUE = {
+    # Built-in types
+    'Date': 'v8DateOrNaN({cpp_value}, {isolate})',
+    'DOMString': 'v8String({isolate}, {cpp_value})',
+    'ByteString': 'v8String({isolate}, {cpp_value})',
+    'ScalarValueString': 'v8String({isolate}, {cpp_value})',
+    'boolean': 'v8Boolean({cpp_value}, {isolate})',
+    'int': 'v8::Integer::New({isolate}, {cpp_value})',
+    'unsigned': 'v8::Integer::NewFromUnsigned({isolate}, {cpp_value})',
+    'float': 'v8::Number::New({isolate}, {cpp_value})',
+    'unrestricted float': 'v8::Number::New({isolate}, {cpp_value})',
+    'double': 'v8::Number::New({isolate}, {cpp_value})',
+    'unrestricted double': 'v8::Number::New({isolate}, {cpp_value})',
+    'void': 'v8Undefined()',
+    # Special cases
+    'EventHandler': '{cpp_value} ? v8::Handle<v8::Value>(V8AbstractEventListener::cast({cpp_value})->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null({isolate}))',
+    'ScriptValue': '{cpp_value}.v8Value()',
+    'SerializedScriptValue': '{cpp_value} ? {cpp_value}->deserialize() : v8::Handle<v8::Value>(v8::Null({isolate}))',
+    # General
+    'array': 'v8Array({cpp_value}, {creation_context}, {isolate})',
+    'DOMWrapper': 'toV8({cpp_value}, {creation_context}, {isolate})',
+}
+
+
+def cpp_value_to_v8_value(idl_type, cpp_value, isolate='info.GetIsolate()', creation_context='info.Holder()', extended_attributes=None):
+    """Returns an expression that converts a C++ value to a V8 value."""
+    # the isolate parameter is needed for callback interfaces
+    idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes)
+    this_v8_conversion_type = idl_type.v8_conversion_type(extended_attributes)
+    format_string = CPP_VALUE_TO_V8_VALUE[this_v8_conversion_type]
+    statement = format_string.format(cpp_value=cpp_value, isolate=isolate, creation_context=creation_context)
+    return statement
+
+IdlType.cpp_value_to_v8_value = cpp_value_to_v8_value
diff --git a/bindings/scripts/v8_utilities.py b/bindings/scripts/v8_utilities.py
new file mode 100644
index 0000000..8067595
--- /dev/null
+++ b/bindings/scripts/v8_utilities.py
@@ -0,0 +1,282 @@
+# Copyright (C) 2013 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Functions shared by various parts of the code generator.
+
+Extends IdlType and IdlUnion type with |enum_validation_expression| property.
+
+Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
+"""
+
+import re
+
+from idl_types import IdlType, IdlUnionType
+import idl_types
+from v8_globals import includes
+import v8_types
+
+ACRONYMS = [
+    'CSSOM',  # must come *before* CSS to match full acronym
+    'CSS',
+    'HTML',
+    'IME',
+    'JS',
+    'SVG',
+    'URL',
+    'WOFF',
+    'XML',
+    'XSLT',
+]
+
+
+################################################################################
+# Extended attribute parsing
+################################################################################
+
+def extended_attribute_value_contains(extended_attribute_value, value):
+    return (extended_attribute_value and
+            value in re.split('[|&]', extended_attribute_value))
+
+
+def has_extended_attribute(definition_or_member, extended_attribute_list):
+    return any(extended_attribute in definition_or_member.extended_attributes
+               for extended_attribute in extended_attribute_list)
+
+
+def has_extended_attribute_value(definition_or_member, name, value):
+    extended_attributes = definition_or_member.extended_attributes
+    return (name in extended_attributes and
+            extended_attribute_value_contains(extended_attributes[name], value))
+
+
+################################################################################
+# String handling
+################################################################################
+
+def capitalize(name):
+    """Capitalize first letter or initial acronym (used in setter names)."""
+    for acronym in ACRONYMS:
+        if name.startswith(acronym.lower()):
+            return name.replace(acronym.lower(), acronym)
+    return name[0].upper() + name[1:]
+
+
+def strip_suffix(string, suffix):
+    if not suffix or not string.endswith(suffix):
+        return string
+    return string[:-len(suffix)]
+
+
+def uncapitalize(name):
+    """Uncapitalizes first letter or initial acronym (used in method names).
+
+    E.g., 'SetURL' becomes 'setURL', but 'URLFoo' becomes 'urlFoo'.
+    """
+    for acronym in ACRONYMS:
+        if name.startswith(acronym):
+            return name.replace(acronym, acronym.lower())
+    return name[0].lower() + name[1:]
+
+
+################################################################################
+# C++
+################################################################################
+
+def enum_validation_expression(idl_type):
+    # FIXME: Add IdlEnumType, move property to derived type, and remove this check
+    if not idl_type.is_enum:
+        return None
+    return ' || '.join(['string == "%s"' % enum_value
+                        for enum_value in idl_type.enum_values])
+IdlType.enum_validation_expression = property(enum_validation_expression)
+
+
+def scoped_name(interface, definition, base_name):
+    # partial interfaces are implemented as separate classes, with their members
+    # implemented as static member functions
+    partial_interface_implemented_as = definition.extended_attributes.get('PartialInterfaceImplementedAs')
+    if partial_interface_implemented_as:
+        return '%s::%s' % (partial_interface_implemented_as, base_name)
+    if (definition.is_static or
+        definition.name in ('Constructor', 'NamedConstructor')):
+        return '%s::%s' % (cpp_name(interface), base_name)
+    return 'impl->%s' % base_name
+
+
+def v8_class_name(interface):
+    return v8_types.v8_type(interface.name)
+
+
+################################################################################
+# Specific extended attributes
+################################################################################
+
+# [ActivityLogging]
+def activity_logging_world_list(member, access_type=''):
+    """Returns a set of world suffixes for which a definition member has activity logging, for specified access type.
+
+    access_type can be 'Getter' or 'Setter' if only checking getting or setting.
+    """
+    extended_attributes = member.extended_attributes
+    if 'LogActivity' not in extended_attributes:
+        return set()
+    log_activity = extended_attributes['LogActivity']
+    if log_activity and not log_activity.startswith(access_type):
+        return set()
+
+    includes.add('bindings/v8/V8DOMActivityLogger.h')
+    if 'LogAllWorlds' in extended_attributes:
+        return set(['', 'ForMainWorld'])
+    return set([''])  # At minimum, include isolated worlds.
+
+
+# [ActivityLogging]
+def activity_logging_world_check(member):
+    """Returns if an isolated world check is required when generating activity
+    logging code.
+
+    The check is required when there is no per-world binding code and logging is
+    required only for isolated world.
+    """
+    extended_attributes = member.extended_attributes
+    if 'LogActivity' not in extended_attributes:
+        return False
+    if ('PerWorldBindings' not in extended_attributes and
+        'LogAllWorlds' not in extended_attributes):
+        return True
+    return False
+
+
+# [CallWith]
+CALL_WITH_ARGUMENTS = {
+    'ScriptState': 'scriptState',
+    'ExecutionContext': 'executionContext',
+    'ScriptArguments': 'scriptArguments.release()',
+    'ActiveWindow': 'callingDOMWindow(info.GetIsolate())',
+    'FirstWindow': 'enteredDOMWindow(info.GetIsolate())',
+    'Document': 'document',
+}
+# List because key order matters, as we want arguments in deterministic order
+CALL_WITH_VALUES = [
+    'ScriptState',
+    'ExecutionContext',
+    'ScriptArguments',
+    'ActiveWindow',
+    'FirstWindow',
+    'Document',
+]
+
+
+def call_with_arguments(call_with_values):
+    if not call_with_values:
+        return []
+    return [CALL_WITH_ARGUMENTS[value]
+            for value in CALL_WITH_VALUES
+            if extended_attribute_value_contains(call_with_values, value)]
+
+
+# [Conditional]
+def conditional_string(definition_or_member):
+    extended_attributes = definition_or_member.extended_attributes
+    if 'Conditional' not in extended_attributes:
+        return None
+    conditional = extended_attributes['Conditional']
+    for operator in '&|':
+        if operator in conditional:
+            conditions = conditional.split(operator)
+            operator_separator = ' %s%s ' % (operator, operator)
+            return operator_separator.join('ENABLE(%s)' % expression for expression in sorted(conditions))
+    return 'ENABLE(%s)' % conditional
+
+
+# [DeprecateAs]
+def deprecate_as(member):
+    extended_attributes = member.extended_attributes
+    if 'DeprecateAs' not in extended_attributes:
+        return None
+    includes.add('core/frame/UseCounter.h')
+    return extended_attributes['DeprecateAs']
+
+
+# [GarbageCollected], [WillBeGarbageCollected]
+def gc_type(definition):
+    extended_attributes = definition.extended_attributes
+    if 'GarbageCollected' in extended_attributes:
+        return 'GarbageCollectedObject'
+    elif 'WillBeGarbageCollected' in extended_attributes:
+        return 'WillBeGarbageCollectedObject'
+    return 'RefCountedObject'
+
+
+# [ImplementedAs]
+def cpp_name(definition_or_member):
+    extended_attributes = definition_or_member.extended_attributes
+    if 'ImplementedAs' not in extended_attributes:
+        return definition_or_member.name
+    return extended_attributes['ImplementedAs']
+
+
+# [MeasureAs]
+def measure_as(definition_or_member):
+    extended_attributes = definition_or_member.extended_attributes
+    if 'MeasureAs' not in extended_attributes:
+        return None
+    includes.add('core/frame/UseCounter.h')
+    return extended_attributes['MeasureAs']
+
+
+# [PerContextEnabled]
+def per_context_enabled_function_name(definition_or_member):
+    extended_attributes = definition_or_member.extended_attributes
+    if 'PerContextEnabled' not in extended_attributes:
+        return None
+    feature_name = extended_attributes['PerContextEnabled']
+    return 'ContextFeatures::%sEnabled' % uncapitalize(feature_name)
+
+
+# [RuntimeEnabled]
+def runtime_enabled_function_name(definition_or_member):
+    """Returns the name of the RuntimeEnabledFeatures function.
+
+    The returned function checks if a method/attribute is enabled.
+    Given extended attribute RuntimeEnabled=FeatureName, return:
+        RuntimeEnabledFeatures::{featureName}Enabled
+    """
+    extended_attributes = definition_or_member.extended_attributes
+    if 'RuntimeEnabled' not in extended_attributes:
+        return None
+    feature_name = extended_attributes['RuntimeEnabled']
+    return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name)
+
+
+################################################################################
+# Dart Specific extended attributes
+################################################################################
+def dart_custom_method(extended_attributes):
+    return ('DartCustom' in extended_attributes and
+            extended_attribute_value_contains(extended_attributes['DartCustom'], 'New'))
diff --git a/core/html/shadow/HTMLShadowElement.idl b/bindings/tests/idls/SVGTestInterface.idl
similarity index 78%
copy from core/html/shadow/HTMLShadowElement.idl
copy to bindings/tests/idls/SVGTestInterface.idl
index 44bc357..6c7511e 100644
--- a/core/html/shadow/HTMLShadowElement.idl
+++ b/bindings/tests/idls/SVGTestInterface.idl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2014 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -28,7 +28,12 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-interface HTMLShadowElement : HTMLElement {
-    attribute boolean resetStyleInheritance;
-    [RuntimeEnabled=ShadowDOM] NodeList getDistributedNodes();
+
+// This test files starts with 'SVG' because /^SVG/ is used as a check
+// for SVG interfaces (to use SVGNames for [Reflect] attributes)
+[
+    DependentLifetime,
+] interface SVGTestInterface {
+    [Reflect] attribute DOMString type; // Test SVGNames namespace
+    // [Immutable] attribute SVGPoint immutablePoint; // [Immutable] is a nop
 };
diff --git a/core/clipboard/Clipboard.idl b/bindings/tests/idls/TestCallbackInterface.idl
similarity index 61%
copy from core/clipboard/Clipboard.idl
copy to bindings/tests/idls/TestCallbackInterface.idl
index 695f70d..cebfa19 100644
--- a/core/clipboard/Clipboard.idl
+++ b/bindings/tests/idls/TestCallbackInterface.idl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -26,18 +26,17 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-[
-] interface Clipboard {
-             [TreatReturnedNullStringAs=Undefined] attribute DOMString dropEffect;
-             [TreatReturnedNullStringAs=Undefined] attribute DOMString effectAllowed;
-    readonly attribute DOMString[] types;
-    readonly attribute FileList files;
-
-    void clearData(optional DOMString type);
-    DOMString getData(DOMString type);
-    boolean setData(DOMString type, DOMString data);
-    [RaisesException] void setDragImage(Element image, long x, long y);
-
-    readonly attribute DataTransferItemList items;
+callback interface TestCallbackInterface {
+  void voidMethod();
+  boolean booleanMethod();
+  void voidMethodBooleanArg(boolean boolArg);
+  void voidMethodSequenceArg(sequence<TestInterfaceEmpty> sequenceArg);
+  void voidMethodFloatArg(float floatArg);
+  void voidMethodTestInterfaceEmptyArg(TestInterfaceEmpty testInterfaceEmptyArg);
+  void voidMethodTestInterfaceEmptyStringArg(TestInterfaceEmpty testInterfaceEmptyArg, DOMString stringArg);
+  [CallWith=ThisValue] void callbackWithThisValueVoidMethodStringArg(DOMString stringArg);
+  [Custom] void customVoidMethodTestInterfaceEmptyArg(TestInterfaceEmpty testInterfaceEmptyArg);
+  // [WillBeGarbageCollected]
+  void voidMethodWillBeGarbageCollectedSequenceArg(sequence<TestInterfaceWillBeGarbageCollected> sequenceArg);
+  void voidMethodWillBeGarbageCollectedArrayArg(TestInterfaceWillBeGarbageCollected[] arrayArg);
 };
-
diff --git a/core/clipboard/Clipboard.idl b/bindings/tests/idls/TestException.idl
similarity index 71%
copy from core/clipboard/Clipboard.idl
copy to bindings/tests/idls/TestException.idl
index 695f70d..a62191c 100644
--- a/core/clipboard/Clipboard.idl
+++ b/bindings/tests/idls/TestException.idl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,17 +27,12 @@
  */
 
 [
-] interface Clipboard {
-             [TreatReturnedNullStringAs=Undefined] attribute DOMString dropEffect;
-             [TreatReturnedNullStringAs=Undefined] attribute DOMString effectAllowed;
-    readonly attribute DOMString[] types;
-    readonly attribute FileList files;
+    DoNotCheckConstants,
+] exception TestException {
+    readonly attribute unsigned short readonlyUnsignedShortAttribute;
+    readonly attribute DOMString readonlyStringAttribute;
 
-    void clearData(optional DOMString type);
-    DOMString getData(DOMString type);
-    boolean setData(DOMString type, DOMString data);
-    [RaisesException] void setDragImage(Element image, long x, long y);
+    const unsigned short UNSIGNED_SHORT_CONSTANT = 1;
 
-    readonly attribute DataTransferItemList items;
+    [NotEnumerable] DOMString toString();
 };
-
diff --git a/bindings/tests/idls/TestImplements.idl b/bindings/tests/idls/TestImplements.idl
new file mode 100644
index 0000000..e6e55db
--- /dev/null
+++ b/bindings/tests/idls/TestImplements.idl
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    NoInterfaceObject, // Always used on target of 'implements'
+] interface TestImplements {
+    static readonly attribute long implementsStaticReadOnlyLongAttribute;
+    static attribute DOMString implementsStaticStringAttribute;
+    readonly attribute DOMString implementsReadonlyStringAttribute;
+    attribute DOMString implementsStringAttribute;
+    attribute Node implementsNodeAttribute;
+    attribute EventHandler implementsEventHandlerAttribute;
+
+    void implementsVoidMethod();
+    [CallWith=ExecutionContext, RaisesException] TestInterfaceEmpty implementsComplexMethod(DOMString strArg, TestInterfaceEmpty testInterfaceEmptyArg);
+    [Custom] void implementsCustomVoidMethod();
+    static void implementsStaticVoidMethod();
+
+    const unsigned short IMPLEMENTS_CONSTANT_1 = 1;
+    [Reflect=IMPLEMENTS_REFLECT_CONSTANT] const unsigned short IMPLEMENTS_CONSTANT_2 = 2;
+
+    [RuntimeEnabled=ImplementsFeatureName] attribute Node implementsRuntimeEnabledNodeAttribute;
+    [PerContextEnabled=ImplementsContextName] attribute Node implementsPerContextEnabledNodeAttribute;
+};
diff --git a/modules/mediasource/WindowMediaSource.idl b/bindings/tests/idls/TestImplements2.idl
similarity index 74%
rename from modules/mediasource/WindowMediaSource.idl
rename to bindings/tests/idls/TestImplements2.idl
index ab65c2f..ce0e357 100644
--- a/modules/mediasource/WindowMediaSource.idl
+++ b/bindings/tests/idls/TestImplements2.idl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2014 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -29,9 +29,13 @@
  */
 
 [
-    RuntimeEnabled=WebKitMediaSource
-] partial interface Window {
-    attribute WebKitMediaSourceConstructor WebKitMediaSource;
-    attribute WebKitSourceBufferConstructor WebKitSourceBuffer;
-    attribute WebKitSourceBufferListConstructor WebKitSourceBufferList;
+    LegacyTreatAsPartialInterface, // Conflicts with default implements behavior
+    NoInterfaceObject, // Always used on target of 'implements'
+    RuntimeEnabled=Implements2FeatureName, // conflicts with [RuntimeEnabled] on member
+] interface TestImplements2 {
+    static attribute DOMString implements2StaticStringAttribute;
+    attribute DOMString implements2StringAttribute;
+    void implements2VoidMethod();
 };
+
+TestInterface implements TestImplements2;
diff --git a/bindings/tests/idls/TestImplements3.idl b/bindings/tests/idls/TestImplements3.idl
new file mode 100644
index 0000000..4d18506
--- /dev/null
+++ b/bindings/tests/idls/TestImplements3.idl
@@ -0,0 +1,14 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+[
+    LegacyTreatAsPartialInterface, // used by [ImplementedAs]
+    ImplementedAs=TestImplements3Implementation, // Conflicts with default implements class name
+    NoInterfaceObject, // Always used on target of 'implements'
+] interface TestImplements3 {
+    attribute DOMString implements3StringAttribute;
+    static attribute DOMString implements3StaticStringAttribute;
+    void implements3VoidMethod();
+    static void implements3StaticVoidMethod();
+};
diff --git a/bindings/tests/idls/TestInterface.idl b/bindings/tests/idls/TestInterface.idl
new file mode 100644
index 0000000..479b016
--- /dev/null
+++ b/bindings/tests/idls/TestInterface.idl
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Test for interface extended attributes and special operations.
+// Also used as a target by TestObject
+
+[
+    ActiveDOMObject,
+    Conditional=CONDITION,
+    Custom=LegacyCallAsFunction|ToV8,
+    DoNotCheckConstants,
+    ImplementedAs=TestInterfaceImplementation,
+    RuntimeEnabled=FeatureName,
+    SetWrapperReferenceTo(TestInterface referencedName),
+    TypeChecking=Interface|Nullable|Unrestricted,
+] interface TestInterface : TestInterfaceEmpty {
+    // members needed to test [ImplementedAs], as this affect attribute
+    // configuration and method configuration, and [TypeChecking]
+    // constants also needed for [DoNotCheckConstants]
+    const unsigned long UNSIGNED_LONG = 0;
+    [Reflect=CONST_CPP] const short CONST_JAVASCRIPT = 1;
+
+    attribute TestInterface testInterfaceAttribute; // Self-referential interface type with [ImplementedAs]
+    attribute TestInterfaceConstructor testInterfaceConstructorAttribute;
+    attribute double doubleAttribute;
+    attribute float floatAttribute;
+    attribute unrestricted double unrestrictedDoubleAttribute;
+    attribute unrestricted float unrestrictedFloatAttribute;
+    static attribute DOMString staticStringAttribute;
+
+    void voidMethodTestInterfaceEmptyArg(TestInterfaceEmpty testInterfaceEmptyArg);
+    void voidMethodDoubleArgFloatArg(double doubleArg, float floatArg);
+    void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg(unrestricted double unrestrictedDoubleArg, unrestricted float unrestrictedFloatArg);
+    [PerWorldBindings] void voidMethod();
+
+    // Anonymous indexed property operations
+    getter DOMString (unsigned long index);
+    setter DOMString (unsigned long index, DOMString value);
+    deleter boolean (unsigned long index);
+
+    // Anonymous named property operations
+    getter DOMString (DOMString name);
+    setter DOMString (DOMString name, DOMString value);
+    deleter boolean (DOMString name);
+};
+
+TestInterface implements TestImplements;
+// TestInterface implements TestImplements2; // at implement*ed* interface
+TestInterface implements TestImplements3;
diff --git a/bindings/tests/idls/TestInterface2.idl b/bindings/tests/idls/TestInterface2.idl
new file mode 100644
index 0000000..bf9c112
--- /dev/null
+++ b/bindings/tests/idls/TestInterface2.idl
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// This is for interface extended attributes that interact with another extended
+// attribute, and thus both cannot be tested at once; and for special
+// operations, which need a separate interface to test on.
+// The more *minor* extended attribute should be put in this file.
+
+[
+    Constructor, // Test interaction with [Custom=Wrap]
+    Custom=Wrap, // Conflicts with and [Custom=ToV8], respectively
+    DependentLifetime, // Covered by [ActiveDOMObject]
+    SetWrapperReferenceFrom=ownerNode, // Conflicts with [SetWrapperReferenceTo]
+    SpecialWrapFor=TestInterface|TestInterfaceEmpty, // Conflicts with [Custom=ToV8]
+] interface TestInterface2 {
+    // Indexed property operations with an identifier
+    [RaisesException] getter TestInterfaceEmpty item(unsigned long index);
+    [RaisesException] setter DOMString setItem(unsigned long index, DOMString value);
+    [RaisesException] deleter boolean deleteItem(unsigned long index);
+
+    // Named property operations with an identifier
+    [RaisesException] getter TestInterfaceEmpty namedItem(DOMString name);
+    [RaisesException] setter DOMString setNamedItem(DOMString name, DOMString value);
+    [RaisesException] deleter boolean deleteNamedItem(DOMString name);
+};
diff --git a/modules/mediasource/WindowMediaSource.idl b/bindings/tests/idls/TestInterface3.idl
similarity index 66%
copy from modules/mediasource/WindowMediaSource.idl
copy to bindings/tests/idls/TestInterface3.idl
index ab65c2f..6b90bda 100644
--- a/modules/mediasource/WindowMediaSource.idl
+++ b/bindings/tests/idls/TestInterface3.idl
@@ -28,10 +28,19 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// This is for interface extended attributes that interact with another extended
+// attribute, and thus both cannot be tested at once; and for special
+// operations, which need a separate interface to test on.
+// The more *minor* extended attribute should be put in this file.
+
 [
-    RuntimeEnabled=WebKitMediaSource
-] partial interface Window {
-    attribute WebKitMediaSourceConstructor WebKitMediaSource;
-    attribute WebKitSourceBufferConstructor WebKitSourceBuffer;
-    attribute WebKitSourceBufferListConstructor WebKitSourceBufferList;
+    Custom=VisitDOMWrapper, // Conflict with [SetWrapperReferenceTo] and [SetWrapperReferenceFrom]
+] interface TestInterface3 {
+    [Custom] getter boolean (unsigned long index);
+    [Custom] setter boolean (unsigned long index, Node value);
+    [Custom] deleter boolean (unsigned long index);
+
+    [Custom=PropertyGetter|PropertyEnumerator|PropertyQuery] getter Node (DOMString name);
+    [Custom] setter Node (DOMString name, Node value);
+    [Custom] deleter boolean (DOMString name);
 };
diff --git a/bindings/tests/idls/TestInterfaceCheckSecurity.idl b/bindings/tests/idls/TestInterfaceCheckSecurity.idl
new file mode 100644
index 0000000..0d20eb9
--- /dev/null
+++ b/bindings/tests/idls/TestInterfaceCheckSecurity.idl
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    CheckSecurity=Frame,
+] interface TestInterfaceCheckSecurity {
+    readonly attribute long longAttribute;
+    void voidMethod();
+
+    [DoNotCheckSecurity] attribute long doNotCheckSecurityLongAttribute;
+    [DoNotCheckSecurity] readonly attribute long doNotCheckSecurityReadonlyLongAttribute; // Separate read only attribute to check attribute configuration
+    [DoNotCheckSecurity=Setter] attribute long doNotCheckSecurityOnSetterLongAttribute;
+    [DoNotCheckSecurity, Replaceable] readonly attribute long doNotCheckSecurityReplaceableReadonlyLongAttribute;
+
+    [DoNotCheckSecurity] void doNotCheckSecurityVoidMethod();
+    [DoNotCheckSecurity, DoNotCheckSignature] void doNotCheckSecurityDoNotCheckSignatureVoidMethod();
+    [DoNotCheckSecurity, PerWorldBindings] void doNotCheckSecurityPerWorldBindingsVoidMethod();
+    [DoNotCheckSecurity, ReadOnly] void doNotCheckSecurityReadOnlyVoidMethod();
+    [DoNotCheckSecurity, Unforgeable] void doNotCheckSecurityUnforgeableVoidMethod();
+};
diff --git a/modules/mediasource/WindowMediaSource.idl b/bindings/tests/idls/TestInterfaceConstructor.idl
similarity index 70%
copy from modules/mediasource/WindowMediaSource.idl
copy to bindings/tests/idls/TestInterfaceConstructor.idl
index ab65c2f..102754e 100644
--- a/modules/mediasource/WindowMediaSource.idl
+++ b/bindings/tests/idls/TestInterfaceConstructor.idl
@@ -28,10 +28,20 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// Note that length == 0 and overloaded; need other tests for other cases.
 [
-    RuntimeEnabled=WebKitMediaSource
-] partial interface Window {
-    attribute WebKitMediaSourceConstructor WebKitMediaSource;
-    attribute WebKitSourceBufferConstructor WebKitSourceBuffer;
-    attribute WebKitSourceBufferListConstructor WebKitSourceBufferList;
+    Constructor,
+    Constructor(
+        double doubleArg,
+        DOMString stringArg,
+        TestInterfaceEmpty testInterfaceEmptyArg,
+        Dictionary dictionaryArg,
+        sequence<DOMString> sequenceStringArg,
+        sequence<Dictionary> sequenceDictionaryArg,
+        optional Dictionary optionalDictionaryArg,
+        [Default=Undefined] optional TestInterfaceEmpty optionalTestInterfaceEmptyArg),
+    ConstructorCallWith=ExecutionContext&Document,
+    MeasureAs=TestFeature,
+    RaisesException=Constructor,
+] interface TestInterfaceConstructor {
 };
diff --git a/bindings/tests/idls/TestInterfaceConstructor2.idl b/bindings/tests/idls/TestInterfaceConstructor2.idl
new file mode 100644
index 0000000..10057de
--- /dev/null
+++ b/bindings/tests/idls/TestInterfaceConstructor2.idl
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Test for length > 0, overloaded constructor.
+// Need separate tests for constructors with length == 0 and length > 0,
+// and for overloaded vs. non-overloaded, if length > 0.
+// length == 0, non-overloaded just omits a block and is not worth another test.
+//
+// Also includes some [Default] arguments (instead of in
+// TestInterfaceConstructor.idl), otherwise overload resolution check string is
+// extremely long and triggers a lint warning (line length).
+[
+    // 2 constructors with same type length, to test overload resolution
+    Constructor(DOMString stringArg),
+    Constructor(Dictionary dictionaryArg),
+    Constructor(
+        TestInterfaceEmpty testInterfaceEmptyArg,
+        long longArg,
+        [Default=Undefined] optional DOMString defaultUndefinedOptionalStringArg,
+        optional DOMString defaultNullStringOptionalStringArg = null,
+        [Default=Undefined] optional Dictionary defaultUndefinedOptionalDictionaryArg,
+        optional DOMString optionalStringArg),
+] interface TestInterfaceConstructor2 {
+};
diff --git a/modules/crypto/Algorithm.idl b/bindings/tests/idls/TestInterfaceConstructor3.idl
similarity index 91%
copy from modules/crypto/Algorithm.idl
copy to bindings/tests/idls/TestInterfaceConstructor3.idl
index a1373bd..19b6669 100644
--- a/modules/crypto/Algorithm.idl
+++ b/bindings/tests/idls/TestInterfaceConstructor3.idl
@@ -28,9 +28,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// Test for length > 0, non-overloaded constructor.
 [
-    WillBeGarbageCollected,
-    NoInterfaceObject
-] interface Algorithm {
-    readonly attribute DOMString name;
+    Constructor(DOMString stringArg),
+] interface TestInterfaceConstructor3 {
 };
diff --git a/modules/crypto/KeyPair.idl b/bindings/tests/idls/TestInterfaceCustomConstructor.idl
similarity index 87%
copy from modules/crypto/KeyPair.idl
copy to bindings/tests/idls/TestInterfaceCustomConstructor.idl
index a27de45..dba8b7a 100644
--- a/modules/crypto/KeyPair.idl
+++ b/bindings/tests/idls/TestInterfaceCustomConstructor.idl
@@ -29,9 +29,8 @@
  */
 
 [
-    WillBeGarbageCollected,
-    NoInterfaceObject
-] interface KeyPair {
-    readonly attribute Key publicKey;
-    readonly attribute Key privateKey;
+    CustomConstructor,
+    CustomConstructor(TestInterfaceEmpty testInterfaceEmptyArg),
+    CustomConstructor(double doubleArg, optional double optionalDoubleArg),
+] interface TestInterfaceCustomConstructor {
 };
diff --git a/modules/crypto/Algorithm.idl b/bindings/tests/idls/TestInterfaceDocument.idl
similarity index 89%
copy from modules/crypto/Algorithm.idl
copy to bindings/tests/idls/TestInterfaceDocument.idl
index a1373bd..2a687e8 100644
--- a/modules/crypto/Algorithm.idl
+++ b/bindings/tests/idls/TestInterfaceDocument.idl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2014 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -28,9 +28,5 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-[
-    WillBeGarbageCollected,
-    NoInterfaceObject
-] interface Algorithm {
-    readonly attribute DOMString name;
+interface TestInterfaceDocument : Document {
 };
diff --git a/modules/crypto/Algorithm.idl b/bindings/tests/idls/TestInterfaceEmpty.idl
similarity index 92%
rename from modules/crypto/Algorithm.idl
rename to bindings/tests/idls/TestInterfaceEmpty.idl
index a1373bd..d9474d5 100644
--- a/modules/crypto/Algorithm.idl
+++ b/bindings/tests/idls/TestInterfaceEmpty.idl
@@ -28,9 +28,5 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-[
-    WillBeGarbageCollected,
-    NoInterfaceObject
-] interface Algorithm {
-    readonly attribute DOMString name;
+interface TestInterfaceEmpty {
 };
diff --git a/bindings/tests/idls/TestInterfaceEventConstructor.idl b/bindings/tests/idls/TestInterfaceEventConstructor.idl
new file mode 100644
index 0000000..e193a0d
--- /dev/null
+++ b/bindings/tests/idls/TestInterfaceEventConstructor.idl
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    EventConstructor,
+    RaisesException=Constructor,
+] interface TestInterfaceEventConstructor : Event {
+    readonly attribute DOMString readonlyStringAttribute;
+
+    [InitializedByEventConstructor] readonly attribute DOMString initializedByEventConstructorReadonlyStringAttribute;
+    [InitializedByEventConstructor] readonly attribute any initializedByEventConstructorReadonlyAnyAttribute;
+    [InitializedByEventConstructor] readonly attribute boolean initializedByEventConstructorReadonlyBooleanAttribute;
+    [InitializedByEventConstructor] readonly attribute long initializedByEventConstructorReadonlyLongAttribute;
+    [InitializedByEventConstructor] readonly attribute Uint8Array initializedByEventConstructorReadonlyUint8ArrayAttribute;
+    [InitializedByEventConstructor] readonly attribute TestInterfaceEmpty initializedByEventConstructorReadonlyTestInterfaceEmptyAttribute;
+    [InitializedByEventConstructor] readonly attribute TestInterfaceEmpty[] initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribute;
+    [InitializedByEventConstructor] readonly attribute TestInterfaceEmpty? initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttribute;
+
+    [DeprecateAs=initializedByEventConstructorReadonlyStringAttribute, InitializedByEventConstructor] readonly attribute DOMString deprecatedInitializedByEventConstructorReadonlyStringAttribute;
+    [ImplementedAs=implementedAsName, InitializedByEventConstructor] readonly attribute DOMString implementedAsInitializedByEventConstructorReadonlyStringAttribute;
+    [DeprecateAs=initializedByEventConstructorReadonlyStringAttribute, ImplementedAs=deprecatedImplementedAsName, InitializedByEventConstructor] readonly attribute DOMString deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttribute;
+};
diff --git a/modules/crypto/Algorithm.idl b/bindings/tests/idls/TestInterfaceEventTarget.idl
similarity index 92%
copy from modules/crypto/Algorithm.idl
copy to bindings/tests/idls/TestInterfaceEventTarget.idl
index a1373bd..742c6d7 100644
--- a/modules/crypto/Algorithm.idl
+++ b/bindings/tests/idls/TestInterfaceEventTarget.idl
@@ -29,8 +29,7 @@
  */
 
 [
-    WillBeGarbageCollected,
-    NoInterfaceObject
-] interface Algorithm {
-    readonly attribute DOMString name;
+    NamedConstructor=Name(),
+    ConstructorCallWith=Document,
+] interface TestInterfaceEventTarget : EventTarget {
 };
diff --git a/bindings/tests/idls/TestInterfaceGarbageCollected.idl b/bindings/tests/idls/TestInterfaceGarbageCollected.idl
new file mode 100644
index 0000000..55739a3
--- /dev/null
+++ b/bindings/tests/idls/TestInterfaceGarbageCollected.idl
@@ -0,0 +1,11 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+[
+    Constructor(DOMString str),
+    GarbageCollected,
+] interface TestInterfaceGarbageCollected : EventTarget { // Inherit from EventTarget to test order of internal fields
+    attribute TestInterfaceGarbageCollected attr1;
+    void func(TestInterfaceGarbageCollected arg);
+};
diff --git a/core/clipboard/Clipboard.idl b/bindings/tests/idls/TestInterfaceNamedConstructor.idl
similarity index 61%
copy from core/clipboard/Clipboard.idl
copy to bindings/tests/idls/TestInterfaceNamedConstructor.idl
index 695f70d..bc8a06b 100644
--- a/core/clipboard/Clipboard.idl
+++ b/bindings/tests/idls/TestInterfaceNamedConstructor.idl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,17 +27,19 @@
  */
 
 [
-] interface Clipboard {
-             [TreatReturnedNullStringAs=Undefined] attribute DOMString dropEffect;
-             [TreatReturnedNullStringAs=Undefined] attribute DOMString effectAllowed;
-    readonly attribute DOMString[] types;
-    readonly attribute FileList files;
-
-    void clearData(optional DOMString type);
-    DOMString getData(DOMString type);
-    boolean setData(DOMString type, DOMString data);
-    [RaisesException] void setDragImage(Element image, long x, long y);
-
-    readonly attribute DataTransferItemList items;
+    ActiveDOMObject,
+    NamedConstructor=Audio(
+        DOMString stringArg,
+        [Default=Undefined] optional boolean defaultUndefinedOptionalBooleanArg,
+        [Default=Undefined] optional long defaultUndefinedOptionalLongArg,
+        [Default=Undefined] optional DOMString defaultUndefinedOptionalStringArg,
+        optional DOMString defaultNullStringOptionalstringArg = null,
+        optional DOMString optionalStringArg),
+    ConstructorCallWith=Document,
+    RaisesException=Constructor,
+] interface TestInterfaceNamedConstructor {
+    // An attribute of type {interface_name}ConstructorConstructor is generated
+    // in *Constructors.idl file, which is a partial interface for the global
+    // object, e.g. Window. We put this here to avoid another test file.
+    attribute TestNamedConstructorConstructor testNamedConstructorConstructorAttribute;
 };
-
diff --git a/modules/crypto/KeyPair.idl b/bindings/tests/idls/TestInterfaceNamedConstructor2.idl
similarity index 89%
rename from modules/crypto/KeyPair.idl
rename to bindings/tests/idls/TestInterfaceNamedConstructor2.idl
index a27de45..1494ffd 100644
--- a/modules/crypto/KeyPair.idl
+++ b/bindings/tests/idls/TestInterfaceNamedConstructor2.idl
@@ -28,10 +28,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// "Number of arguments" check varies if [RaisesException=Constructor] or not
 [
-    WillBeGarbageCollected,
-    NoInterfaceObject
-] interface KeyPair {
-    readonly attribute Key publicKey;
-    readonly attribute Key privateKey;
+    NamedConstructor=Audio(DOMString stringArg),
+] interface TestInterfaceNamedConstructor2 {
 };
diff --git a/modules/mediasource/WebKitSourceBuffer.idl b/bindings/tests/idls/TestInterfaceNode.idl
similarity index 65%
rename from modules/mediasource/WebKitSourceBuffer.idl
rename to bindings/tests/idls/TestInterfaceNode.idl
index a22916a..25c62a5 100644
--- a/modules/mediasource/WebKitSourceBuffer.idl
+++ b/bindings/tests/idls/TestInterfaceNode.idl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2014 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -28,22 +28,15 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-[
-    WillBeGarbageCollected,
-    NoInterfaceObject,
-    RuntimeEnabled=WebKitMediaSource
-] interface WebKitSourceBuffer {
+interface TestInterfaceNode : Node {
+    attribute DOMString stringAttribute;
+    readonly attribute TestInterfaceEmpty readonlyTestInterfaceEmptyAttribute;
+    attribute EventHandler eventHandlerAttribute;
+    [PerWorldBindings] readonly attribute TestInterfaceEmpty perWorldBindingsReadonlyTestInterfaceEmptyAttribute;
+    [Reflect] attribute DOMString reflectStringAttribute;
+    [Reflect, URL] attribute DOMString reflectUrlStringAttribute;
 
-    // Returns the time ranges buffered.
-    [RaisesException=Getter] readonly attribute TimeRanges buffered;
-
-    // Applies an offset to media segment timestamps.
-    [RaisesException=Setter] attribute double timestampOffset;
-
-    // Append segment data.
-    [RaisesException] void append(Uint8Array data);
-
-    // Abort the current segment append sequence.
-    [RaisesException] void abort();
+    TestInterfaceEmpty testInterfaceEmptyMethod();
+    [PerWorldBindings] TestInterfaceEmpty perWorldBindingsTestInterfaceEmptyMethod();
+    [PerWorldBindings] TestInterfaceEmpty perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArg(optional boolean optionalBooleanArgument);
 };
-
diff --git a/modules/crypto/KeyPair.idl b/bindings/tests/idls/TestInterfaceWillBeGarbageCollected.idl
similarity index 79%
copy from modules/crypto/KeyPair.idl
copy to bindings/tests/idls/TestInterfaceWillBeGarbageCollected.idl
index a27de45..be955b0 100644
--- a/modules/crypto/KeyPair.idl
+++ b/bindings/tests/idls/TestInterfaceWillBeGarbageCollected.idl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2014 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -29,9 +29,10 @@
  */
 
 [
+    Constructor(DOMString str),
+    NamedConstructor=TestInterface(DOMString str),
     WillBeGarbageCollected,
-    NoInterfaceObject
-] interface KeyPair {
-    readonly attribute Key publicKey;
-    readonly attribute Key privateKey;
+] interface TestInterfaceWillBeGarbageCollected : EventTarget { // Inherit from EventTarget to test order of internal fields
+    attribute TestInterfaceWillBeGarbageCollected attr1;
+    void func(TestInterfaceWillBeGarbageCollected arg);
 };
diff --git a/bindings/tests/idls/TestNode.idl b/bindings/tests/idls/TestNode.idl
new file mode 100644
index 0000000..301f7f0
--- /dev/null
+++ b/bindings/tests/idls/TestNode.idl
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+[
+    Constructor,
+] interface TestNode : Node {
+    // These attributes are needed to test [PutForwards] in TestObject.idl.
+    attribute DOMString href;
+    [RaisesException=Setter] attribute DOMString hrefThrows;
+    [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString hrefCallWith;
+};
diff --git a/bindings/tests/idls/TestObject.idl b/bindings/tests/idls/TestObject.idl
new file mode 100644
index 0000000..8328c86
--- /dev/null
+++ b/bindings/tests/idls/TestObject.idl
@@ -0,0 +1,528 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+enum TestEnum {"", "EnumValue1", "EnumValue2", "EnumValue3"};
+
+callback VoidCallbackFunction = void ();
+callback AnyCallbackFunctionOptionalAnyArg = any (optional any optionalAnyArg);
+
+dictionary TestDict {
+    boolean booleanMember;
+    long longMember1 = 1;
+};
+
+dictionary TestDictDerived : TestDict {
+    unsigned short unsignedShortMember;
+    float floatMember4 = 4.0;
+};
+
+// No extended attributes on the interface; those go in TestInterface.idl
+interface TestObject {
+    // Constants
+    const unsigned short CONST_VALUE_0 = 0;
+    const unsigned short CONST_VALUE_1 = 1;
+    const unsigned short CONST_VALUE_2 = 2;
+    const unsigned short CONST_VALUE_4 = 4;
+    const unsigned short CONST_VALUE_8 = 8;
+    const short CONST_VALUE_9 = -1;
+    const DOMString CONST_VALUE_10 = "my constant string";
+    const unsigned short CONST_VALUE_11 = 0xffffffff;
+    const unsigned short CONST_VALUE_12 = 0x01;
+    const unsigned short CONST_VALUE_13 = 0X20;
+    const unsigned short CONST_VALUE_14 = 0x1abc;
+    const unsigned short CONST_VALUE_15 = 010;
+    const unsigned short CONST_VALUE_16 = -010;
+    const unsigned short CONST_VALUE_16 = -0x1A;
+    const unsigned short CONST_VALUE_17 = -0X1a;
+
+    // Extended attributes
+    [DeprecateAs=Constant] const short DEPRECATED_CONSTANT = 1;
+    [RuntimeEnabled=FeatureName] const short FEATURE_ENABLED_CONST = 1;
+    [Reflect=CONST_IMPL] const short CONST_JAVASCRIPT = 1;
+
+
+    // Attributes
+    //
+    // Naming convention:
+    // [ExtAttr] attribute Type extAttrTypeNameAttribute;
+    // E.g.,
+    // [Foo] attribute DOMString? fooStringOrNullAttribute
+    //
+    // Type name reference:
+    // http://heycam.github.io/webidl/#dfn-type-name
+    //
+    // TestInterfaceEmpty is used as a stub interface type, for testing behavior
+    // that should not depend on particular type (beyond "interface or not").
+    // read only
+    readonly attribute DOMString readonlyStringAttribute;
+    readonly attribute TestInterfaceEmpty readonlyTestInterfaceEmptyAttribute;
+    readonly attribute long readonlyLongAttribute;
+    // Basic types
+    attribute Date dateAttribute;
+    attribute DOMString stringAttribute;
+    attribute ByteString byteStringAttribute;
+    attribute ScalarValueString scalarValueStringAttribute;
+    attribute DOMTimeStamp domTimeStampAttribute;
+    attribute boolean booleanAttribute;
+    attribute byte byteAttribute;
+    attribute double doubleAttribute;
+    attribute float floatAttribute;
+    attribute long longAttribute;
+    attribute long long longLongAttribute;
+    attribute octet octetAttribute;
+    attribute short shortAttribute;
+    attribute unrestricted double unrestrictedDoubleAttribute;
+    attribute unrestricted float unrestrictedFloatAttribute;
+    attribute unsigned long unsignedLongAttribute;
+    attribute unsigned long long unsignedLongLongAttribute;
+    attribute unsigned short unsignedShortAttribute;
+    // Interface type
+    attribute TestInterfaceEmpty testInterfaceEmptyAttribute;
+    // Self-reference
+    attribute TestObject testObjectAttribute;
+    // Callback function type
+    attribute VoidCallbackFunction voidCallbackFunctionAttribute;
+    attribute AnyCallbackFunctionOptionalAnyArg anyCallbackFunctionOptionalAnyArgAttribute;
+    // Names that begin with an acronym
+    attribute long cssAttribute;
+    attribute long imeAttribute;
+    attribute long svgAttribute;
+    attribute long xmlAttribute;
+    // Non-wrapper types
+    attribute NodeFilter nodeFilterAttribute;
+    attribute SerializedScriptValue serializedScriptValueAttribute;
+    attribute any anyAttribute;
+    // Custom type conversions
+    attribute Promise promiseAttribute;
+    attribute Window windowAttribute;
+    // DOM Node types
+    attribute Document documentAttribute;
+    attribute DocumentFragment documentFragmentAttribute;
+    attribute DocumentType documentTypeAttribute;
+    attribute Element elementAttribute;
+    attribute Node nodeAttribute;
+    attribute ShadowRoot shadowRootAttribute;
+    // Typed arrays
+    attribute ArrayBuffer arrayBufferAttribute;
+    attribute Float32Array float32ArrayAttribute;
+    attribute Uint8Array uint8ArrayAttribute;
+    // Exceptions for is_keep_alive_for_gc
+    readonly attribute TestInterfaceEmpty self;
+    readonly attribute EventTarget readonlyEventTargetAttribute;
+    readonly attribute EventTarget? readonlyEventTargetOrNullAttribute;
+    readonly attribute Window readonlyWindowAttribute;
+    readonly attribute HTMLCollection htmlCollectionAttribute;
+    readonly attribute HTMLElement htmlElementAttribute;
+    // Arrays
+    attribute DOMString[] stringArrayAttribute;
+    attribute TestInterfaceEmpty[] testInterfaceEmptyArrayAttribute;
+    attribute float[] floatArrayAttribute;
+    // Nullable attributes
+    attribute DOMString? stringOrNullAttribute;
+    attribute long? longOrNullAttribute;
+    attribute TestInterface? testInterfaceOrNullAttribute;
+    // Enumerations
+    attribute TestEnum testEnumAttribute;
+    // Static attributes
+    static attribute DOMString staticStringAttribute;
+    static attribute long staticLongAttribute;
+    // Exceptional type
+    attribute EventHandler eventHandlerAttribute;
+
+    // Extended attributes
+    [LogActivity, LogAllWorlds] attribute long activityLoggingAccessForAllWorldsLongAttribute;
+    [LogActivity=GetterOnly, LogAllWorlds] attribute long activityLoggingGetterForAllWorldsLongAttribute;
+    [LogActivity=SetterOnly, LogAllWorlds] attribute long activityLoggingSetterForAllWorldsLongAttribute;
+    [CachedAttribute=isValueDirty] attribute any cachedAttributeAnyAttribute;
+    [CachedAttribute=isArrayDirty] attribute DOMString[] cachedArrayAttribute;
+    [CallWith=ExecutionContext] attribute any callWithExecutionContextAnyAttribute;
+    [CallWith=ScriptState] attribute any callWithScriptStateAnyAttribute;
+    [CallWith=ExecutionContext|ScriptState] attribute any callWithExecutionContextAndScriptStateAnyAttribute;
+    [CheckSecurity=Node] readonly attribute Document checkSecurityForNodeReadonlyDocumentAttribute; // All uses are read only
+    [Conditional=CONDITION] attribute long conditionalLongAttribute;
+    [Conditional=CONDITION_1&CONDITION_2] attribute long conditionalAndLongAttribute;
+    [Conditional=CONDITION_1|CONDITION_2] attribute long conditionalOrLongAttribute;
+    // Constructors: FIXME: replace suffix with [ConstructorAttribute]
+    attribute TestInterfaceEmptyConstructor testInterfaceEmptyConstructorAttribute;
+    [DeprecateAs=deprecatedTestInterfaceEmptyConstructorAttribute] attribute TestInterfaceEmptyConstructor testInterfaceEmptyConstructorAttribute;
+    [MeasureAs=FeatureName] attr