Merge from Chromium at DEPS revision r200144

This commit was generated by merge_to_master.py.

Change-Id: I52995489013675af682cee321f417f624396b584
diff --git a/Source/bindings/v8/BindingSecurity.cpp b/Source/bindings/v8/BindingSecurity.cpp
index 78b4833..056a256 100644
--- a/Source/bindings/v8/BindingSecurity.cpp
+++ b/Source/bindings/v8/BindingSecurity.cpp
@@ -38,7 +38,7 @@
 #include "core/page/DOMWindow.h"
 #include "core/page/Frame.h"
 #include "core/page/Settings.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
diff --git a/Source/bindings/v8/DOMDataStore.h b/Source/bindings/v8/DOMDataStore.h
index 0fd99a7..2d1d7b1 100644
--- a/Source/bindings/v8/DOMDataStore.h
+++ b/Source/bindings/v8/DOMDataStore.h
@@ -35,19 +35,14 @@
 #include "bindings/v8/DOMWrapperWorld.h"
 #include "bindings/v8/ScriptWrappable.h"
 #include "bindings/v8/WrapperTypeInfo.h"
-#include "core/dom/Node.h"
 #include <v8.h>
-#include "wtf/HashMap.h"
-#include "wtf/MainThread.h"
 #include "wtf/Noncopyable.h"
-#include "wtf/OwnPtr.h"
 #include "wtf/StdLibExtras.h"
-#include "wtf/ThreadSpecific.h"
-#include "wtf/Threading.h"
-#include "wtf/Vector.h"
 
 namespace WebCore {
 
+class Node;
+
 class DOMDataStore {
     WTF_MAKE_NONCOPYABLE(DOMDataStore);
 public:
diff --git a/Source/bindings/v8/DOMWrapperWorld.h b/Source/bindings/v8/DOMWrapperWorld.h
index d4250cc..22128c6 100644
--- a/Source/bindings/v8/DOMWrapperWorld.h
+++ b/Source/bindings/v8/DOMWrapperWorld.h
@@ -33,7 +33,7 @@
 
 #include "bindings/v8/V8DOMActivityLogger.h"
 #include "bindings/v8/V8PerContextData.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 #include <v8.h>
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
diff --git a/Source/bindings/v8/NPV8Object.cpp b/Source/bindings/v8/NPV8Object.cpp
index 9a5dcbd..496cd81 100644
--- a/Source/bindings/v8/NPV8Object.cpp
+++ b/Source/bindings/v8/NPV8Object.cpp
@@ -34,6 +34,7 @@
 #include "bindings/v8/V8Binding.h"
 #include "bindings/v8/V8GCController.h"
 #include "bindings/v8/V8NPUtils.h"
+#include "bindings/v8/V8ObjectConstructor.h"
 #include "bindings/v8/WrapperTypeInfo.h"
 #include "bindings/v8/npruntime_impl.h"
 #include "bindings/v8/npruntime_priv.h"
@@ -167,7 +168,10 @@
         objectVector = &iter->value;
     }
     V8NPObject* v8npObject = reinterpret_cast<V8NPObject*>(_NPN_CreateObject(npp, &V8NPObjectClass));
-    v8npObject->v8Object = v8::Persistent<v8::Object>::New(v8::Isolate::GetCurrent(), object);
+    // This is uninitialized memory, we need to clear it so that
+    // Persistent::Reset won't try to Dispose anything bogus.
+    v8npObject->v8Object.Clear();
+    v8npObject->v8Object.Reset(v8::Isolate::GetCurrent(), object);
     v8npObject->rootObject = root;
 
     if (objectVector)
diff --git a/Source/bindings/v8/PageScriptDebugServer.cpp b/Source/bindings/v8/PageScriptDebugServer.cpp
index a7c3864..63340b4 100644
--- a/Source/bindings/v8/PageScriptDebugServer.cpp
+++ b/Source/bindings/v8/PageScriptDebugServer.cpp
@@ -35,6 +35,7 @@
 #include "V8DOMWindow.h"
 #include "bindings/v8/ScriptController.h"
 #include "bindings/v8/V8Binding.h"
+#include "bindings/v8/V8DOMWindowShell.h"
 #include "bindings/v8/V8RecursionScope.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/inspector/ScriptDebugListener.h"
diff --git a/Source/bindings/v8/ScopedPersistent.h b/Source/bindings/v8/ScopedPersistent.h
index 2af9917..35dbc1f 100644
--- a/Source/bindings/v8/ScopedPersistent.h
+++ b/Source/bindings/v8/ScopedPersistent.h
@@ -43,7 +43,7 @@
     ScopedPersistent() { }
 
     explicit ScopedPersistent(v8::Handle<T> handle)
-        : m_handle(v8::Persistent<T>::New(v8::Isolate::GetCurrent(), handle))
+        : m_handle(v8::Isolate::GetCurrent(), handle)
     {
     }
 
@@ -60,7 +60,7 @@
     void set(v8::Handle<T> handle)
     {
         clear();
-        m_handle = v8::Persistent<T>::New(v8::Isolate::GetCurrent(), handle);
+        m_handle.Reset(v8::Isolate::GetCurrent(), handle);
     }
 
     // Note: This is clear in the OwnPtr sense, not the v8::Handle sense.
diff --git a/Source/bindings/v8/ScriptController.cpp b/Source/bindings/v8/ScriptController.cpp
index 7c1d923..1005475 100644
--- a/Source/bindings/v8/ScriptController.cpp
+++ b/Source/bindings/v8/ScriptController.cpp
@@ -35,12 +35,14 @@
 #include "V8DOMWindow.h"
 #include "V8Event.h"
 #include "V8HTMLElement.h"
+#include "bindings/v8/BindingSecurity.h"
 #include "bindings/v8/NPObjectWrapper.h"
 #include "bindings/v8/NPV8Object.h"
 #include "bindings/v8/ScriptCallStackFactory.h"
 #include "bindings/v8/ScriptSourceCode.h"
 #include "bindings/v8/ScriptValue.h"
 #include "bindings/v8/V8Binding.h"
+#include "bindings/v8/V8DOMWindowShell.h"
 #include "bindings/v8/V8GCController.h"
 #include "bindings/v8/V8HiddenPropertyName.h"
 #include "bindings/v8/V8NPObject.h"
@@ -72,7 +74,7 @@
 #include "core/platform/Widget.h"
 #include "core/platform/chromium/TraceEvent.h"
 #include "core/plugins/PluginView.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/StringExtras.h"
diff --git a/Source/bindings/v8/ScriptDebugServer.h b/Source/bindings/v8/ScriptDebugServer.h
index f4b8d4e..f20adaa 100644
--- a/Source/bindings/v8/ScriptDebugServer.h
+++ b/Source/bindings/v8/ScriptDebugServer.h
@@ -98,7 +98,7 @@
     virtual void runScript(ScriptState*, const String& scriptId, ScriptValue* result, bool* wasThrown, String* exceptionMessage);
 
 protected:
-    ScriptDebugServer(v8::Isolate*);
+    explicit ScriptDebugServer(v8::Isolate*);
     virtual ~ScriptDebugServer();
     
     ScriptValue currentCallFrame();
diff --git a/Source/bindings/v8/ScriptEventListener.cpp b/Source/bindings/v8/ScriptEventListener.cpp
index 364fc06..e7838b7 100644
--- a/Source/bindings/v8/ScriptEventListener.cpp
+++ b/Source/bindings/v8/ScriptEventListener.cpp
@@ -35,6 +35,7 @@
 #include "bindings/v8/ScriptScope.h"
 #include "bindings/v8/V8AbstractEventListener.h"
 #include "bindings/v8/V8Binding.h"
+#include "bindings/v8/V8DOMWindowShell.h"
 #include "core/dom/Document.h"
 #include "core/dom/DocumentParser.h"
 #include "core/dom/EventListener.h"
diff --git a/Source/bindings/v8/ScriptProfiler.cpp b/Source/bindings/v8/ScriptProfiler.cpp
index cfa2e8d..4362d46 100644
--- a/Source/bindings/v8/ScriptProfiler.cpp
+++ b/Source/bindings/v8/ScriptProfiler.cpp
@@ -39,6 +39,7 @@
 #include "bindings/v8/V8Binding.h"
 #include "bindings/v8/V8DOMWrapper.h"
 #include "bindings/v8/WrapperTypeInfo.h"
+#include "core/dom/Document.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/inspector/BindingVisitors.h"
 
diff --git a/Source/bindings/v8/V8Binding.cpp b/Source/bindings/v8/V8Binding.cpp
index d052430..e7357ca 100644
--- a/Source/bindings/v8/V8Binding.cpp
+++ b/Source/bindings/v8/V8Binding.cpp
@@ -37,11 +37,14 @@
 #include "V8WorkerContext.h"
 #include "V8XPathNSResolver.h"
 #include "bindings/v8/ScriptController.h"
+#include "bindings/v8/V8DOMWindowShell.h"
 #include "bindings/v8/V8NodeFilterCondition.h"
 #include "bindings/v8/V8ObjectConstructor.h"
 #include "bindings/v8/WorkerScriptController.h"
+#include "bindings/v8/custom/V8CustomXPathNSResolver.h"
 #include "core/dom/DOMStringList.h"
 #include "core/dom/Element.h"
+#include "core/dom/NodeFilter.h"
 #include "core/dom/QualifiedName.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "core/inspector/BindingVisitors.h"
diff --git a/Source/bindings/v8/V8Binding.h b/Source/bindings/v8/V8Binding.h
index 8a63dea..af429b8 100644
--- a/Source/bindings/v8/V8Binding.h
+++ b/Source/bindings/v8/V8Binding.h
@@ -32,27 +32,25 @@
 #ifndef V8Binding_h
 #define V8Binding_h
 
-#include "bindings/v8/BindingSecurity.h"
 #include "bindings/v8/DOMWrapperWorld.h"
 #include "bindings/v8/V8BindingMacros.h"
-#include "bindings/v8/V8DOMConfiguration.h"
-#include "bindings/v8/V8DOMWrapper.h"
-#include "bindings/v8/V8HiddenPropertyName.h"
-#include "bindings/v8/V8ObjectConstructor.h"
 #include "bindings/v8/V8PerIsolateData.h"
 #include "bindings/v8/V8StringResource.h"
 #include "bindings/v8/V8ThrowException.h"
 #include "bindings/v8/V8ValueCache.h"
-#include "core/dom/Document.h"
-#include "core/dom/NodeFilter.h"
-#include "wtf/Noncopyable.h"
+#include "wtf/MathExtras.h"
 #include "wtf/text/AtomicString.h"
 #include <v8.h>
 
 namespace WebCore {
 
     class DOMStringList;
+    class DOMWindow;
+    class Document;
+    class Frame;
+    class NodeFilter;
     class ScriptExecutionContext;
+    class XPathNSResolver;
 
     const int kMaxRecursionDepth = 22;
 
diff --git a/Source/bindings/v8/V8Callback.h b/Source/bindings/v8/V8Callback.h
index e07d713..45c1660 100644
--- a/Source/bindings/v8/V8Callback.h
+++ b/Source/bindings/v8/V8Callback.h
@@ -32,6 +32,7 @@
 #define V8Callback_h
 
 #include "bindings/v8/V8Binding.h"
+#include "bindings/v8/V8Utilities.h"
 #include "core/dom/ExceptionCode.h"
 #include <v8.h>
 
diff --git a/Source/bindings/v8/V8DOMWindowShell.cpp b/Source/bindings/v8/V8DOMWindowShell.cpp
index 04ee83a..87ed4e7 100644
--- a/Source/bindings/v8/V8DOMWindowShell.cpp
+++ b/Source/bindings/v8/V8DOMWindowShell.cpp
@@ -60,7 +60,7 @@
 #include "core/page/Frame.h"
 #include "core/page/Page.h"
 #include "core/platform/HistogramSupport.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 #include "wtf/Assertions.h"
 #include "wtf/OwnArrayPtr.h"
 #include "wtf/StringExtras.h"
diff --git a/Source/bindings/v8/V8DOMWindowShell.h b/Source/bindings/v8/V8DOMWindowShell.h
index 19ac2b4..9e52918 100644
--- a/Source/bindings/v8/V8DOMWindowShell.h
+++ b/Source/bindings/v8/V8DOMWindowShell.h
@@ -35,7 +35,7 @@
 #include "bindings/v8/ScopedPersistent.h"
 #include "bindings/v8/V8PerContextData.h"
 #include "bindings/v8/WrapperTypeInfo.h"
-#include "origin/SecurityOrigin.h"
+#include "weborigin/SecurityOrigin.h"
 #include <v8.h>
 #include "wtf/Forward.h"
 #include "wtf/HashMap.h"
diff --git a/Source/bindings/v8/V8DOMWrapper.h b/Source/bindings/v8/V8DOMWrapper.h
index 3c3fde1..ab47334 100644
--- a/Source/bindings/v8/V8DOMWrapper.h
+++ b/Source/bindings/v8/V8DOMWrapper.h
@@ -32,20 +32,14 @@
 #define V8DOMWrapper_h
 
 #include "bindings/v8/DOMDataStore.h"
-#include "bindings/v8/DOMWrapperWorld.h"
-#include "bindings/v8/V8DOMWindowShell.h"
-#include "bindings/v8/V8Utilities.h"
-#include "bindings/v8/WrapperTypeInfo.h"
-#include "bindings/v8/custom/V8CustomXPathNSResolver.h"
-#include "core/dom/Event.h"
-#include "core/dom/Node.h"
 #include <v8.h>
-#include "wtf/MainThread.h"
 #include "wtf/PassRefPtr.h"
-#include "wtf/text/WTFString.h"
+#include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
+struct WrapperTypeInfo;
+
     class V8DOMWrapper {
     public:
 #ifndef NDEBUG
diff --git a/Source/bindings/v8/V8GCController.cpp b/Source/bindings/v8/V8GCController.cpp
index d276080..fc53af3 100644
--- a/Source/bindings/v8/V8GCController.cpp
+++ b/Source/bindings/v8/V8GCController.cpp
@@ -175,11 +175,11 @@
                 continue;
             }
             while (!node->nextSibling()) {
-                if (!node->parentNode())
+                if (!node->parentOrShadowHostNode())
                     break;
-                node = node->parentNode();
+                node = node->parentOrShadowHostNode();
             }
-            if (node->parentNode())
+            if (node->parentOrShadowHostNode())
                 node = node->nextSibling();
         } while (node != startNode);
 
diff --git a/Source/bindings/v8/V8LazyEventListener.cpp b/Source/bindings/v8/V8LazyEventListener.cpp
index 14bf19b..403b53f 100644
--- a/Source/bindings/v8/V8LazyEventListener.cpp
+++ b/Source/bindings/v8/V8LazyEventListener.cpp
@@ -220,7 +220,7 @@
     v8::Persistent<v8::FunctionTemplate>& toStringTemplate =
         V8PerIsolateData::current()->lazyEventListenerToStringTemplate();
     if (toStringTemplate.IsEmpty())
-        toStringTemplate = v8::Persistent<v8::FunctionTemplate>::New(isolate, v8::FunctionTemplate::New(V8LazyEventListenerToString));
+        toStringTemplate.Reset(isolate, v8::FunctionTemplate::New(V8LazyEventListenerToString));
     v8::Local<v8::Function> toStringFunction;
     if (!toStringTemplate.IsEmpty())
         toStringFunction = toStringTemplate->GetFunction();
diff --git a/Source/bindings/v8/V8MutationCallback.cpp b/Source/bindings/v8/V8MutationCallback.cpp
index 25655dc..4f99232 100644
--- a/Source/bindings/v8/V8MutationCallback.cpp
+++ b/Source/bindings/v8/V8MutationCallback.cpp
@@ -30,6 +30,7 @@
 #include "V8MutationRecord.h"
 #include "bindings/v8/ScriptController.h"
 #include "bindings/v8/V8Binding.h"
+#include "bindings/v8/V8HiddenPropertyName.h"
 #include "core/dom/ScriptExecutionContext.h"
 #include "wtf/Assertions.h"
 
diff --git a/Source/bindings/v8/V8NPObject.cpp b/Source/bindings/v8/V8NPObject.cpp
index 9dfb6f7..1b45891 100644
--- a/Source/bindings/v8/V8NPObject.cpp
+++ b/Source/bindings/v8/V8NPObject.cpp
@@ -251,7 +251,7 @@
             // Create a new template.
             v8::Local<v8::FunctionTemplate> temp = v8::FunctionTemplate::New();
             temp->SetCallHandler(npObjectMethodHandler, key);
-            functionTemplate = v8::Persistent<v8::FunctionTemplate>::New(isolate, temp);
+            functionTemplate.Reset(isolate, temp);
             V8NPTemplateMap::sharedInstance(isolate).set(id, functionTemplate);
         }
 
@@ -430,7 +430,7 @@
     // can be used by DOM bindings.
     v8::Isolate* isolate = v8::Isolate::GetCurrent();
     if (npObjectDesc.IsEmpty()) {
-        npObjectDesc = v8::Persistent<v8::FunctionTemplate>::New(isolate, v8::FunctionTemplate::New());
+        npObjectDesc.Reset(isolate, v8::FunctionTemplate::New());
         npObjectDesc->InstanceTemplate()->SetInternalFieldCount(npObjectInternalFieldCount);
         npObjectDesc->InstanceTemplate()->SetNamedPropertyHandler(npObjectNamedPropertyGetter, npObjectNamedPropertySetter, npObjectQueryProperty, 0, npObjectNamedPropertyEnumerator);
         npObjectDesc->InstanceTemplate()->SetIndexedPropertyHandler(npObjectIndexedPropertyGetter, npObjectIndexedPropertySetter, 0, 0, npObjectIndexedPropertyEnumerator);
diff --git a/Source/bindings/v8/V8ObjectConstructor.cpp b/Source/bindings/v8/V8ObjectConstructor.cpp
index 44806f1..c68d1d2 100644
--- a/Source/bindings/v8/V8ObjectConstructor.cpp
+++ b/Source/bindings/v8/V8ObjectConstructor.cpp
@@ -27,6 +27,7 @@
 
 #include "bindings/v8/V8Binding.h"
 #include "bindings/v8/V8RecursionScope.h"
+#include "core/dom/Document.h"
 #include "core/page/Frame.h"
 #include "core/platform/chromium/TraceEvent.h"
 
diff --git a/Source/bindings/v8/V8PerIsolateData.cpp b/Source/bindings/v8/V8PerIsolateData.cpp
index f980330..7c96d0b 100644
--- a/Source/bindings/v8/V8PerIsolateData.cpp
+++ b/Source/bindings/v8/V8PerIsolateData.cpp
@@ -26,9 +26,13 @@
 #include "config.h"
 #include "bindings/v8/V8PerIsolateData.h"
 
+#include "bindings/v8/DOMDataStore.h"
 #include "bindings/v8/ScriptGCEvent.h"
 #include "bindings/v8/ScriptProfiler.h"
 #include "bindings/v8/V8Binding.h"
+#include "bindings/v8/V8HiddenPropertyName.h"
+#include "bindings/v8/V8ObjectConstructor.h"
+#include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "wtf/MemoryInstrumentationHashMap.h"
 #include "wtf/MemoryInstrumentationVector.h"
 
diff --git a/Source/bindings/v8/V8StringResource.cpp b/Source/bindings/v8/V8StringResource.cpp
index dd25982..47f4d9b 100644
--- a/Source/bindings/v8/V8StringResource.cpp
+++ b/Source/bindings/v8/V8StringResource.cpp
@@ -28,6 +28,7 @@
 
 #include "bindings/v8/V8Binding.h"
 #include "core/inspector/BindingVisitors.h"
+#include "wtf/MainThread.h"
 
 namespace WebCore {
 
diff --git a/Source/bindings/v8/V8ValueCache.cpp b/Source/bindings/v8/V8ValueCache.cpp
index 7ff9791..4aca287 100644
--- a/Source/bindings/v8/V8ValueCache.cpp
+++ b/Source/bindings/v8/V8ValueCache.cpp
@@ -27,8 +27,11 @@
 #include "bindings/v8/V8ValueCache.h"
 
 #include "bindings/v8/V8Binding.h"
+#include "bindings/v8/V8Utilities.h"
 #include "core/dom/WebCoreMemoryInstrumentation.h"
 #include "wtf/MemoryInstrumentationHashMap.h"
+#include "wtf/MemoryInstrumentationSequence.h"
+#include "wtf/text/StringHash.h"
 
 namespace WTF {
 
diff --git a/Source/bindings/v8/WorkerScriptController.cpp b/Source/bindings/v8/WorkerScriptController.cpp
index 9b58ca0..82097ed 100644
--- a/Source/bindings/v8/WorkerScriptController.cpp
+++ b/Source/bindings/v8/WorkerScriptController.cpp
@@ -39,6 +39,7 @@
 #include "bindings/v8/ScriptValue.h"
 #include "bindings/v8/V8GCController.h"
 #include "bindings/v8/V8Initializer.h"
+#include "bindings/v8/V8ObjectConstructor.h"
 #include "bindings/v8/V8ScriptRunner.h"
 #include "bindings/v8/WrapperTypeInfo.h"
 #include "core/inspector/ScriptCallStack.h"
diff --git a/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h b/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h
index 0472ad0..134ec36 100644
--- a/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h
+++ b/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h
@@ -36,6 +36,7 @@
 
 #include "V8ArrayBuffer.h"
 #include "bindings/v8/V8Binding.h"
+#include "bindings/v8/V8ObjectConstructor.h"
 #include "bindings/v8/custom/V8ArrayBufferCustom.h"
 
 namespace WebCore {
diff --git a/Source/bindings/v8/custom/V8AudioContextCustom.cpp b/Source/bindings/v8/custom/V8AudioContextCustom.cpp
index 659680c..7f7e099 100644
--- a/Source/bindings/v8/custom/V8AudioContextCustom.cpp
+++ b/Source/bindings/v8/custom/V8AudioContextCustom.cpp
@@ -32,6 +32,7 @@
 #include "V8AudioBuffer.h"
 #include "V8OfflineAudioContext.h"
 #include "bindings/v8/V8Binding.h"
+#include "core/dom/Document.h"
 #include "core/page/Frame.h"
 #include "modules/webaudio/AudioBuffer.h"
 #include "modules/webaudio/AudioContext.h"
@@ -48,10 +49,7 @@
     
     if (!args.Length()) {
         // Constructor for default AudioContext which talks to audio hardware.
-        ExceptionCode ec = 0;
-        audioContext = AudioContext::create(document, ec);
-        if (ec)
-            return setDOMException(ec, args.GetIsolate());
+        audioContext = AudioContext::create(document);
         if (!audioContext.get())
             return throwError(v8SyntaxError, "audio resources unavailable for AudioContext construction", args.GetIsolate());
     } else {
diff --git a/Source/bindings/v8/custom/V8CustomElementConstructorCustom.cpp b/Source/bindings/v8/custom/V8CustomElementConstructorCustom.cpp
index 4a82721..7e65e81 100644
--- a/Source/bindings/v8/custom/V8CustomElementConstructorCustom.cpp
+++ b/Source/bindings/v8/custom/V8CustomElementConstructorCustom.cpp
@@ -35,6 +35,7 @@
 #include "V8Element.h"
 #include "bindings/v8/CustomElementHelpers.h"
 #include "bindings/v8/V8Binding.h"
+#include "bindings/v8/V8ObjectConstructor.h"
 #include "core/dom/CustomElementConstructor.h"
 
 namespace WebCore {
diff --git a/Source/bindings/v8/custom/V8DOMWindowCustom.cpp b/Source/bindings/v8/custom/V8DOMWindowCustom.cpp
index b5a22d6..b44eff8 100644
--- a/Source/bindings/v8/custom/V8DOMWindowCustom.cpp
+++ b/Source/bindings/v8/custom/V8DOMWindowCustom.cpp
@@ -33,6 +33,7 @@
 
 #include "V8HTMLCollection.h"
 #include "V8Node.h"
+#include "bindings/v8/BindingSecurity.h"
 #include "bindings/v8/ScheduledAction.h"
 #include "bindings/v8/ScriptController.h"
 #include "bindings/v8/ScriptSourceCode.h"
diff --git a/Source/bindings/v8/custom/V8DOMFormDataCustom.cpp b/Source/bindings/v8/custom/V8FormDataCustom.cpp
similarity index 91%
rename from Source/bindings/v8/custom/V8DOMFormDataCustom.cpp
rename to Source/bindings/v8/custom/V8FormDataCustom.cpp
index 12d43bf..f078e72 100644
--- a/Source/bindings/v8/custom/V8DOMFormDataCustom.cpp
+++ b/Source/bindings/v8/custom/V8FormDataCustom.cpp
@@ -29,7 +29,7 @@
  */
 
 #include "config.h"
-#include "V8DOMFormData.h"
+#include "V8FormData.h"
 
 #include "V8Blob.h"
 #include "V8HTMLFormElement.h"
@@ -39,7 +39,7 @@
 
 namespace WebCore {
 
-v8::Handle<v8::Value> V8DOMFormData::constructorCustom(const v8::Arguments& args)
+v8::Handle<v8::Value> V8FormData::constructorCustom(const v8::Arguments& args)
 {
     HTMLFormElement* form = 0;
     if (args.Length() > 0 && V8HTMLFormElement::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate())))
@@ -51,12 +51,12 @@
     return wrapper;
 }
 
-v8::Handle<v8::Value> V8DOMFormData::appendMethodCustom(const v8::Arguments& args)
+v8::Handle<v8::Value> V8FormData::appendMethodCustom(const v8::Arguments& args)
 {
     if (args.Length() < 2)
         return throwError(v8SyntaxError, "Not enough arguments", args.GetIsolate());
 
-    DOMFormData* domFormData = V8DOMFormData::toNative(args.Holder());
+    DOMFormData* domFormData = V8FormData::toNative(args.Holder());
 
     String name = toWebCoreStringWithNullCheck(args[0]);
 
diff --git a/Source/bindings/v8/custom/V8HTMLDocumentCustom.cpp b/Source/bindings/v8/custom/V8HTMLDocumentCustom.cpp
index 7c21d5d..3d3e9a3 100644
--- a/Source/bindings/v8/custom/V8HTMLDocumentCustom.cpp
+++ b/Source/bindings/v8/custom/V8HTMLDocumentCustom.cpp
@@ -59,7 +59,7 @@
     WrapperWorldType currentWorldType = worldType(isolate);
     v8::Persistent<v8::FunctionTemplate> shadowTemplate;
     if (!V8PerIsolateData::from(isolate)->hasPrivateTemplate(currentWorldType, &shadowTemplateUniqueKey)) {
-        shadowTemplate = v8::Persistent<v8::FunctionTemplate>::New(isolate, v8::FunctionTemplate::New());
+        shadowTemplate.Reset(isolate, v8::FunctionTemplate::New());
         if (shadowTemplate.IsEmpty())
             return v8::Local<v8::Object>();
         shadowTemplate->SetClassName(v8::String::NewSymbol("HTMLDocument"));
diff --git a/Source/bindings/v8/custom/V8HTMLFormElementCustom.cpp b/Source/bindings/v8/custom/V8HTMLFormElementCustom.cpp
index d178d98..de64785 100644
--- a/Source/bindings/v8/custom/V8HTMLFormElementCustom.cpp
+++ b/Source/bindings/v8/custom/V8HTMLFormElementCustom.cpp
@@ -40,16 +40,6 @@
 
 namespace WebCore {
 
-v8::Handle<v8::Value> V8HTMLFormElement::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-{
-    HTMLFormElement* form = V8HTMLFormElement::toNative(info.Holder());
-
-    RefPtr<Node> formElement = form->elements()->item(index);
-    if (!formElement)
-        return v8Undefined();
-    return toV8Fast(formElement.release(), info, form);
-}
-
 v8::Handle<v8::Value> V8HTMLFormElement::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
 {
     HTMLFormElement* imp = V8HTMLFormElement::toNative(info.Holder());
diff --git a/Source/bindings/v8/custom/V8HTMLFrameElementCustom.cpp b/Source/bindings/v8/custom/V8HTMLFrameElementCustom.cpp
index eae1518..e242e33 100644
--- a/Source/bindings/v8/custom/V8HTMLFrameElementCustom.cpp
+++ b/Source/bindings/v8/custom/V8HTMLFrameElementCustom.cpp
@@ -32,6 +32,7 @@
 #include "V8HTMLFrameElement.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/BindingSecurity.h"
 #include "bindings/v8/V8Binding.h"
 #include "core/html/HTMLFrameElement.h"
 
diff --git a/Source/bindings/v8/custom/V8HTMLImageElementConstructor.cpp b/Source/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
index a94a095..98e8a40 100644
--- a/Source/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
+++ b/Source/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
@@ -34,7 +34,9 @@
 #include "HTMLNames.h"
 #include "V8Document.h"
 #include "V8HTMLImageElement.h"
+#include "bindings/v8/BindingSecurity.h"
 #include "bindings/v8/V8Binding.h"
+#include "bindings/v8/V8ObjectConstructor.h"
 #include "core/dom/Document.h"
 #include "core/html/HTMLImageElement.h"
 #include "core/page/Frame.h"
@@ -94,7 +96,7 @@
     result->SetClassName(v8::String::NewSymbol("HTMLImageElement"));
     result->Inherit(V8HTMLImageElement::GetTemplate(isolate, worldType));
 
-    cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(isolate, result);
+    cachedTemplate.Reset(isolate, result);
     return cachedTemplate;
 }
 
diff --git a/Source/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp b/Source/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
index d8ba7f2..b7e9b2e 100644
--- a/Source/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
+++ b/Source/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
@@ -134,17 +134,6 @@
     setDOMException(ec, info.GetIsolate());
 }
 
-v8::Handle<v8::Value> V8HTMLOptionsCollection::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-{
-    HTMLOptionsCollection* collection = V8HTMLOptionsCollection::toNative(info.Holder());
-
-    RefPtr<Node> result = collection->item(index);
-    if (!result)
-        return v8Undefined();
-
-    return toV8Fast(result.release(), info, collection);
-}
-
 v8::Handle<v8::Value> V8HTMLOptionsCollection::indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
 {
     HTMLOptionsCollection* collection = V8HTMLOptionsCollection::toNative(info.Holder());
diff --git a/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
index 6ef94c1..262353a 100644
--- a/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -46,6 +46,7 @@
 #include "V8Uint8Array.h"
 #include "V8Uint8ClampedArray.h"
 #include "bindings/tests/results/V8Float64Array.h"
+#include "bindings/v8/BindingSecurity.h"
 #include "bindings/v8/ScriptDebugServer.h"
 #include "bindings/v8/ScriptValue.h"
 #include "bindings/v8/V8AbstractEventListener.h"
diff --git a/Source/bindings/v8/custom/V8InjectedScriptManager.cpp b/Source/bindings/v8/custom/V8InjectedScriptManager.cpp
index e3341a9..f446175 100644
--- a/Source/bindings/v8/custom/V8InjectedScriptManager.cpp
+++ b/Source/bindings/v8/custom/V8InjectedScriptManager.cpp
@@ -33,9 +33,11 @@
 
 #include "V8DOMWindow.h"
 #include "V8InjectedScriptHost.h"
+#include "bindings/v8/BindingSecurity.h"
 #include "bindings/v8/ScriptDebugServer.h"
 #include "bindings/v8/ScriptObject.h"
 #include "bindings/v8/V8Binding.h"
+#include "bindings/v8/V8ObjectConstructor.h"
 #include "bindings/v8/V8RecursionScope.h"
 #include "core/inspector/InjectedScriptHost.h"
 #include "core/page/DOMWindow.h"
diff --git a/Source/bindings/v8/custom/V8LocationCustom.cpp b/Source/bindings/v8/custom/V8LocationCustom.cpp
index 1a13944..4cdc8aa 100644
--- a/Source/bindings/v8/custom/V8LocationCustom.cpp
+++ b/Source/bindings/v8/custom/V8LocationCustom.cpp
@@ -32,6 +32,7 @@
 #include "V8Location.h"
 
 #include "V8DOMWindow.h"
+#include "bindings/v8/BindingSecurity.h"
 #include "bindings/v8/V8Binding.h"
 #include "bindings/v8/V8EventListener.h"
 #include "bindings/v8/V8Utilities.h"
diff --git a/Source/bindings/v8/custom/V8MessageChannelCustom.cpp b/Source/bindings/v8/custom/V8MessageChannelCustom.cpp
index 1ff918c..918f43a 100644
--- a/Source/bindings/v8/custom/V8MessageChannelCustom.cpp
+++ b/Source/bindings/v8/custom/V8MessageChannelCustom.cpp
@@ -33,6 +33,7 @@
 
 #include "V8MessagePort.h"
 #include "bindings/v8/V8Binding.h"
+#include "bindings/v8/V8HiddenPropertyName.h"
 #include "bindings/v8/V8Utilities.h"
 #include "core/dom/Document.h"
 #include "core/dom/MessageChannel.h"
diff --git a/Source/bindings/v8/custom/V8NodeCustom.cpp b/Source/bindings/v8/custom/V8NodeCustom.cpp
index ef83dd8..913bb38 100644
--- a/Source/bindings/v8/custom/V8NodeCustom.cpp
+++ b/Source/bindings/v8/custom/V8NodeCustom.cpp
@@ -43,13 +43,14 @@
 #include "V8Node.h"
 #include "V8Notation.h"
 #include "V8ProcessingInstruction.h"
+#include "V8ShadowRoot.h"
 #include "V8Text.h"
 #include "bindings/v8/V8AbstractEventListener.h"
 #include "bindings/v8/V8Binding.h"
 #include "bindings/v8/V8EventListener.h"
 #include "core/dom/Document.h"
 #include "core/dom/EventListener.h"
-#include "core/dom/ShadowRoot.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "wtf/RefPtr.h"
 
 #if ENABLE(SVG)
@@ -149,6 +150,8 @@
     case Node::DOCUMENT_TYPE_NODE:
         return wrap(static_cast<DocumentType*>(impl), creationContext, isolate);
     case Node::DOCUMENT_FRAGMENT_NODE:
+        if (impl->isShadowRoot())
+            return wrap(toShadowRoot(impl), creationContext, isolate);
         return wrap(static_cast<DocumentFragment*>(impl), creationContext, isolate);
     case Node::NOTATION_NODE:
         return wrap(static_cast<Notation*>(impl), creationContext, isolate);
diff --git a/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
index 0a06220..af9dbca 100644
--- a/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
+++ b/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
@@ -67,6 +67,7 @@
 #include "V8WebGLUniformLocation.h"
 #include "V8WebGLVertexArrayObjectOES.h"
 #include "bindings/v8/V8Binding.h"
+#include "bindings/v8/V8HiddenPropertyName.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/html/canvas/WebGLRenderingContext.h"
 #include "core/platform/NotImplemented.h"
diff --git a/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
index 950d62f..66554ff 100644
--- a/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
+++ b/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
@@ -34,8 +34,8 @@
 #include "V8ArrayBuffer.h"
 #include "V8ArrayBufferView.h"
 #include "V8Blob.h"
-#include "V8DOMFormData.h"
 #include "V8Document.h"
+#include "V8FormData.h"
 #include "V8HTMLDocument.h"
 #include "bindings/v8/V8Binding.h"
 #include "bindings/v8/V8Utilities.h"
@@ -193,9 +193,9 @@
             Blob* blob = V8Blob::toNative(object);
             ASSERT(blob);
             xmlHttpRequest->send(blob, ec);
-        } else if (V8DOMFormData::HasInstance(arg, args.GetIsolate(), currentWorldType)) {
+        } else if (V8FormData::HasInstance(arg, args.GetIsolate(), currentWorldType)) {
             v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
-            DOMFormData* domFormData = V8DOMFormData::toNative(object);
+            DOMFormData* domFormData = V8FormData::toNative(object);
             ASSERT(domFormData);
             xmlHttpRequest->send(domFormData, ec);
         } else if (V8ArrayBuffer::HasInstance(arg, args.GetIsolate(), currentWorldType)) {