Merge from Chromium at DEPS revision r215849

This commit was generated by merge_to_master.py.

Change-Id: I9e6d77256a64b87c056aa64e44c8f8cdc852f5d2
diff --git a/Source/core/accessibility/AccessibilityNodeObject.cpp b/Source/core/accessibility/AccessibilityNodeObject.cpp
index b25e68b..ca2626e 100644
--- a/Source/core/accessibility/AccessibilityNodeObject.cpp
+++ b/Source/core/accessibility/AccessibilityNodeObject.cpp
@@ -211,7 +211,7 @@
         return ParagraphRole;
     if (isHTMLLabelElement(node()))
         return LabelRole;
-    if (node()->isFocusable())
+    if (node()->isElementNode() && toElement(node())->isFocusable())
         return GroupRole;
 
     return UnknownRole;
@@ -1039,7 +1039,7 @@
     if (node && node->isTextNode())
         return toText(node)->wholeText();
 
-    String result;
+    StringBuilder builder;
     for (AccessibilityObject* child = firstChild(); child; child = child->nextSibling()) {
         if (!shouldUseAccessiblityObjectInnerText(child))
             continue;
@@ -1048,15 +1048,15 @@
             Vector<AccessibilityText> textOrder;
             toAccessibilityNodeObject(child)->alternativeText(textOrder);
             if (textOrder.size() > 0) {
-                result.append(textOrder[0].text);
+                builder.append(textOrder[0].text);
                 continue;
             }
         }
 
-        result.append(child->textUnderElement());
+        builder.append(child->textUnderElement());
     }
 
-    return result;
+    return builder.toString();
 }
 
 String AccessibilityNodeObject::accessibilityDescription() const
diff --git a/Source/core/accessibility/AccessibilityRenderObject.cpp b/Source/core/accessibility/AccessibilityRenderObject.cpp
index 24ac75a..359a0c9 100644
--- a/Source/core/accessibility/AccessibilityRenderObject.cpp
+++ b/Source/core/accessibility/AccessibilityRenderObject.cpp
@@ -29,6 +29,7 @@
 #include "config.h"
 #include "core/accessibility/AccessibilityRenderObject.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/accessibility/AXObjectCache.h"
 #include "core/accessibility/AccessibilityImageMapLink.h"
 #include "core/accessibility/AccessibilitySVGRoot.h"
@@ -1892,7 +1893,7 @@
         return VisiblePosition(firstPositionInOrBeforeNode(node), DOWNSTREAM);
 
     RefPtr<Range> range = Range::create(m_renderer->document());
-    range->selectNodeContents(node, IGNORE_EXCEPTION);
+    range->selectNodeContents(node, IGNORE_EXCEPTION_STATE);
     CharacterIterator it(range.get());
     it.advance(index - 1);
     return VisiblePosition(Position(it.range()->endContainer(), it.range()->endOffset(), Position::PositionIsOffsetInAnch\
@@ -1918,8 +1919,8 @@
         return 0;
 
     RefPtr<Range> range = Range::create(m_renderer->document());
-    range->setStart(node, 0, IGNORE_EXCEPTION);
-    range->setEnd(indexPosition, IGNORE_EXCEPTION);
+    range->setStart(node, 0, IGNORE_EXCEPTION_STATE);
+    range->setEnd(indexPosition, IGNORE_EXCEPTION_STATE);
 
     return TextIterator::rangeLength(range.get());
 }
@@ -2017,7 +2018,7 @@
 
     VisibleSelection visibleSelection = selection();
     RefPtr<Range> currentSelectionRange = visibleSelection.toNormalizedRange();
-    if (!currentSelectionRange || !currentSelectionRange->intersectsNode(node, IGNORE_EXCEPTION))
+    if (!currentSelectionRange || !currentSelectionRange->intersectsNode(node, IGNORE_EXCEPTION_STATE))
         return PlainTextRange();
 
     int start = indexForVisiblePosition(visibleSelection.start());
diff --git a/Source/core/core.gypi b/Source/core/core.gypi
index d9e4a12..939ffc3 100644
--- a/Source/core/core.gypi
+++ b/Source/core/core.gypi
@@ -27,8 +27,6 @@
             'css/FontLoader.idl',
             'css/MediaList.idl',
             'css/MediaQueryList.idl',
-            'css/Rect.idl',
-            'css/RGBColor.idl',
             'css/StyleMedia.idl',
             'css/StyleSheet.idl',
             'css/StyleSheetList.idl',
@@ -202,12 +200,10 @@
             'html/canvas/ANGLEInstancedArrays.idl',
             'html/canvas/ArrayBufferView.idl',
             'html/canvas/CanvasGradient.idl',
-            'html/canvas/CanvasPattern.idl',
             'html/canvas/CanvasRenderingContext.idl',
             'html/canvas/CanvasRenderingContext2D.idl',
             'html/canvas/Canvas2DContextAttributes.idl',
             'html/canvas/DataView.idl',
-            'html/canvas/EXTFragDepth.idl',
             'html/canvas/EXTTextureFilterAnisotropic.idl',
             'html/canvas/Float32Array.idl',
             'html/canvas/Float64Array.idl',
@@ -215,19 +211,14 @@
             'html/canvas/Int32Array.idl',
             'html/canvas/Int8Array.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/OESElementIndexUint.idl',
             'html/canvas/Path.idl',
             'html/canvas/Uint16Array.idl',
             'html/canvas/Uint32Array.idl',
             'html/canvas/Uint8Array.idl',
             'html/canvas/Uint8ClampedArray.idl',
             'html/canvas/WebGLActiveInfo.idl',
-            'html/canvas/WebGLBuffer.idl',
             'html/canvas/WebGLCompressedTextureATC.idl',
             'html/canvas/WebGLCompressedTexturePVRTC.idl',
             'html/canvas/WebGLCompressedTextureS3TC.idl',
@@ -237,16 +228,9 @@
             '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/Composition.idl',
             'html/ime/InputMethodContext.idl',
             'html/shadow/HTMLContentElement.idl',
@@ -288,8 +272,6 @@
             'page/SpeechInputResultList.idl',
             'page/WebKitPoint.idl',
             'page/Window.idl',
-            'page/WindowBase64.idl',
-            'page/WindowTimers.idl',
             'page/WorkerNavigator.idl',
             'plugins/MimeType.idl',
             'plugins/MimeTypeArray.idl',
@@ -304,7 +286,6 @@
             'workers/WorkerGlobalScope.idl',
             'workers/WorkerLocation.idl',
             'xml/DOMParser.idl',
-            'xml/DocumentXPathEvaluator.idl',
             'xml/XMLHttpRequest.idl',
             'xml/XMLHttpRequestProgressEvent.idl',
             'xml/XMLHttpRequestUpload.idl',
@@ -316,24 +297,43 @@
             'xml/XSLTProcessor.idl',
         ],
         'python_core_idl_files': [
+            'css/RGBColor.idl',
+            'css/Rect.idl',
             'dom/ChildNode.idl',
             'dom/DocumentFullscreen.idl',
             'dom/ParentNode.idl',
             'dom/RequestAnimationFrameCallback.idl',
             'dom/StringCallback.idl',
             'html/VoidCallback.idl',
+            'html/canvas/CanvasPattern.idl',
+            'html/canvas/EXTFragDepth.idl',
+            'html/canvas/OESElementIndexUint.idl',
+            'html/canvas/OESTextureFloat.idl',
+            'html/canvas/OESTextureFloatLinear.idl',
+            'html/canvas/OESTextureHalfFloatLinear.idl',
+            'html/canvas/WebGLBuffer.idl',
+            'html/canvas/WebGLFramebuffer.idl',
+            'html/canvas/WebGLProgram.idl',
+            'html/canvas/WebGLRenderbuffer.idl',
+            'html/canvas/WebGLShader.idl',
+            'html/canvas/WebGLTexture.idl',
+            'html/canvas/WebGLUniformLocation.idl',
+            'html/canvas/WebGLVertexArrayObjectOES.idl',
+            'page/WindowBase64.idl',
             'page/WindowPagePopup.idl',
+            'page/WindowTimers.idl',
             'workers/AbstractWorker.idl',
+            'xml/DocumentXPathEvaluator.idl',
         ],
         'deprecated_perl_svg_idl_files': [
             'svg/SVGAElement.idl',
+            'svg/SVGAltGlyphDefElement.idl',
             'svg/SVGAltGlyphElement.idl',
             'svg/SVGAltGlyphItemElement.idl',
-            'svg/SVGAltGlyphDefElement.idl',
             'svg/SVGAngle.idl',
             'svg/SVGAnimateColorElement.idl',
-            'svg/SVGAnimateMotionElement.idl',
             'svg/SVGAnimateElement.idl',
+            'svg/SVGAnimateMotionElement.idl',
             'svg/SVGAnimateTransformElement.idl',
             'svg/SVGAnimatedAngle.idl',
             'svg/SVGAnimatedBoolean.idl',
@@ -404,12 +404,12 @@
             '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/SVGMPathElement.idl',
             'svg/SVGNumber.idl',
             'svg/SVGNumberList.idl',
             'svg/SVGPaint.idl',
@@ -464,9 +464,9 @@
             'svg/SVGTransformList.idl',
             'svg/SVGUnitTypes.idl',
             'svg/SVGUseElement.idl',
+            'svg/SVGVKernElement.idl',
             'svg/SVGViewElement.idl',
             'svg/SVGViewSpec.idl',
-            'svg/SVGVKernElement.idl',
             'svg/SVGZoomEvent.idl',
         ],
         'python_svg_idl_files': [
@@ -2709,9 +2709,6 @@
             'platform/chromium/ClipboardUtilitiesChromium.h',
             'platform/chromium/DragDataRef.h',
             'platform/chromium/FileSystemChromium.cpp',
-            'platform/chromium/FileSystemChromiumLinux.cpp',
-            'platform/chromium/FileSystemChromiumMac.mm',
-            'platform/chromium/FileSystemChromiumWin.cpp',
             'platform/chromium/FramelessScrollView.cpp',
             'platform/chromium/FramelessScrollView.h',
             'platform/chromium/FramelessScrollViewClient.h',
diff --git a/Source/core/css/CSSCharsetRule.h b/Source/core/css/CSSCharsetRule.h
index a284fb1..ac95a4b 100644
--- a/Source/core/css/CSSCharsetRule.h
+++ b/Source/core/css/CSSCharsetRule.h
@@ -26,6 +26,8 @@
 
 namespace WebCore {
 
+class ExceptionState;
+
 class CSSCharsetRule : public CSSRule {
 public:
     static PassRefPtr<CSSCharsetRule> create(CSSStyleSheet* parent, const String& encoding)
@@ -40,7 +42,7 @@
     virtual void reattach(StyleRuleBase* rule) OVERRIDE { ASSERT_UNUSED(rule, !rule); }
 
     const String& encoding() const { return m_encoding; }
-    void setEncoding(const String& encoding, ExceptionCode&) { m_encoding = encoding; }
+    void setEncoding(const String& encoding, ExceptionState&) { m_encoding = encoding; }
 
 private:
     CSSCharsetRule(CSSStyleSheet* parent, const String& encoding);
diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp
index ee703d1..df1ea64 100644
--- a/Source/core/css/CSSComputedStyleDeclaration.cpp
+++ b/Source/core/css/CSSComputedStyleDeclaration.cpp
@@ -28,6 +28,7 @@
 #include "FontFamilyNames.h"
 #include "RuntimeEnabledFeatures.h"
 #include "StylePropertyShorthand.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/css/BasicShapeFunctions.h"
 #include "core/css/CSSArrayFunctionValue.h"
 #include "core/css/CSSAspectRatioValue.h"
@@ -1228,9 +1229,9 @@
     return result.toString();
 }
 
-void CSSComputedStyleDeclaration::setCssText(const String&, ExceptionCode& ec)
+void CSSComputedStyleDeclaration::setCssText(const String&, ExceptionState& es)
 {
-    ec = NoModificationAllowedError;
+    es.throwDOMException(NoModificationAllowedError);
 }
 
 static CSSValueID cssIdentifierForFontSizeKeyword(int keywordSize)
@@ -2983,14 +2984,14 @@
     return false;
 }
 
-void CSSComputedStyleDeclaration::setProperty(const String&, const String&, const String&, ExceptionCode& ec)
+void CSSComputedStyleDeclaration::setProperty(const String&, const String&, const String&, ExceptionState& es)
 {
-    ec = NoModificationAllowedError;
+    es.throwDOMException(NoModificationAllowedError);
 }
 
-String CSSComputedStyleDeclaration::removeProperty(const String&, ExceptionCode& ec)
+String CSSComputedStyleDeclaration::removeProperty(const String&, ExceptionState& es)
 {
-    ec = NoModificationAllowedError;
+    es.throwDOMException(NoModificationAllowedError);
     return String();
 }
 
@@ -3004,9 +3005,9 @@
     return getPropertyValue(propertyID);
 }
 
-void CSSComputedStyleDeclaration::setPropertyInternal(CSSPropertyID, const String&, bool, ExceptionCode& ec)
+void CSSComputedStyleDeclaration::setPropertyInternal(CSSPropertyID, const String&, bool, ExceptionState& es)
 {
-    ec = NoModificationAllowedError;
+    es.throwDOMException(NoModificationAllowedError);
 }
 
 const HashMap<AtomicString, String>* CSSComputedStyleDeclaration::variableMap() const
@@ -3042,10 +3043,10 @@
     return it->value;
 }
 
-void CSSComputedStyleDeclaration::setVariableValue(const AtomicString&, const String&, ExceptionCode& ec)
+void CSSComputedStyleDeclaration::setVariableValue(const AtomicString&, const String&, ExceptionState& es)
 {
     ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
-    ec = NoModificationAllowedError;
+    es.throwDOMException(NoModificationAllowedError);
 }
 
 bool CSSComputedStyleDeclaration::removeVariable(const AtomicString&)
@@ -3054,10 +3055,10 @@
     return false;
 }
 
-void CSSComputedStyleDeclaration::clearVariables(ExceptionCode& ec)
+void CSSComputedStyleDeclaration::clearVariables(ExceptionState& es)
 {
     ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
-    ec = NoModificationAllowedError;
+    es.throwDOMException(NoModificationAllowedError);
 }
 
 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getBackgroundShorthandValue() const
diff --git a/Source/core/css/CSSComputedStyleDeclaration.h b/Source/core/css/CSSComputedStyleDeclaration.h
index 1f2a35f..3e461e2 100644
--- a/Source/core/css/CSSComputedStyleDeclaration.h
+++ b/Source/core/css/CSSComputedStyleDeclaration.h
@@ -35,6 +35,9 @@
 class CSSPrimitiveValue;
 class CSSValueList;
 class Color;
+class CustomFilterNumberParameter;
+class CustomFilterParameter;
+class ExceptionState;
 class MutableStylePropertySet;
 class Node;
 class RenderObject;
@@ -44,9 +47,6 @@
 class StylePropertySet;
 class StylePropertyShorthand;
 
-class CustomFilterNumberParameter;
-class CustomFilterParameter;
-
 enum EUpdateLayout { DoNotUpdateLayout = false, UpdateLayout = true };
 
 class CSSComputedStyleDeclaration : public CSSStyleDeclaration {
@@ -93,20 +93,20 @@
     virtual String getPropertyPriority(const String& propertyName);
     virtual String getPropertyShorthand(const String& propertyName);
     virtual bool isPropertyImplicit(const String& propertyName);
-    virtual void setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode&);
-    virtual String removeProperty(const String& propertyName, ExceptionCode&);
+    virtual void setProperty(const String& propertyName, const String& value, const String& priority, ExceptionState&);
+    virtual String removeProperty(const String& propertyName, ExceptionState&);
     virtual String cssText() const;
-    virtual void setCssText(const String&, ExceptionCode&);
+    virtual void setCssText(const String&, ExceptionState&);
     virtual PassRefPtr<CSSValue> getPropertyCSSValueInternal(CSSPropertyID);
     virtual String getPropertyValueInternal(CSSPropertyID);
-    virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionCode&);
+    virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionState&);
 
     const HashMap<AtomicString, String>* variableMap() const;
     virtual unsigned variableCount() const OVERRIDE;
     virtual String variableValue(const AtomicString& name) const OVERRIDE;
-    virtual void setVariableValue(const AtomicString& name, const String& value, ExceptionCode&) OVERRIDE;
+    virtual void setVariableValue(const AtomicString& name, const String& value, ExceptionState&) OVERRIDE;
     virtual bool removeVariable(const AtomicString& name) OVERRIDE;
-    virtual void clearVariables(ExceptionCode&) OVERRIDE;
+    virtual void clearVariables(ExceptionState&) OVERRIDE;
 
     virtual bool cssPropertyMatches(CSSPropertyID, const CSSValue*) const OVERRIDE;
 
diff --git a/Source/core/css/CSSGrammar.y.in b/Source/core/css/CSSGrammar.y.in
index adcd2ad..4ef806b 100644
--- a/Source/core/css/CSSGrammar.y.in
+++ b/Source/core/css/CSSGrammar.y.in
@@ -1182,6 +1182,8 @@
         while (end->tagHistory())
             end = end->tagHistory();
         end->setRelation(CSSSelector::Descendant);
+        if ($1->isContentPseudoElement())
+            end->setRelationIsAffectedByPseudoContent();
         end->setTagHistory(parser->sinkFloatingSelector($1));
     }
     | selector combinator simple_selector {
@@ -1190,6 +1192,8 @@
         while (end->tagHistory())
             end = end->tagHistory();
         end->setRelation($2);
+        if ($1->isContentPseudoElement())
+            end->setRelationIsAffectedByPseudoContent();
         end->setTagHistory(parser->sinkFloatingSelector($1));
     }
     ;
diff --git a/Source/core/css/CSSGroupingRule.cpp b/Source/core/css/CSSGroupingRule.cpp
index 0d62e42..413d85a 100644
--- a/Source/core/css/CSSGroupingRule.cpp
+++ b/Source/core/css/CSSGroupingRule.cpp
@@ -29,9 +29,9 @@
  */
 
 #include "config.h"
-
 #include "core/css/CSSGroupingRule.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/css/CSSParser.h"
 #include "core/css/CSSRuleList.h"
 #include "core/css/CSSStyleSheet.h"
@@ -57,13 +57,13 @@
     }
 }
 
-unsigned CSSGroupingRule::insertRule(const String& ruleString, unsigned index, ExceptionCode& ec)
+unsigned CSSGroupingRule::insertRule(const String& ruleString, unsigned index, ExceptionState& es)
 {
     ASSERT(m_childRuleCSSOMWrappers.size() == m_groupRule->childRules().size());
 
     if (index > m_groupRule->childRules().size()) {
         // IndexSizeError: Raised if the specified index is not a valid insertion point.
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return 0;
     }
 
@@ -72,7 +72,7 @@
     RefPtr<StyleRuleBase> newRule = parser.parseRule(styleSheet ? styleSheet->contents() : 0, ruleString);
     if (!newRule) {
         // SyntaxError: Raised if the specified rule has a syntax error and is unparsable.
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return 0;
     }
 
@@ -84,7 +84,7 @@
         // HierarchyRequestError: Raised if the rule cannot be inserted at the specified
         // index, e.g., if an @import rule is inserted after a standard rule set or other
         // at-rule.
-        ec = HierarchyRequestError;
+        es.throwDOMException(HierarchyRequestError);
         return 0;
     }
     CSSStyleSheet::RuleMutationScope mutationScope(this);
@@ -95,14 +95,14 @@
     return index;
 }
 
-void CSSGroupingRule::deleteRule(unsigned index, ExceptionCode& ec)
+void CSSGroupingRule::deleteRule(unsigned index, ExceptionState& es)
 {
     ASSERT(m_childRuleCSSOMWrappers.size() == m_groupRule->childRules().size());
 
     if (index >= m_groupRule->childRules().size()) {
         // IndexSizeError: Raised if the specified index does not correspond to a
         // rule in the media rule list.
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
diff --git a/Source/core/css/CSSGroupingRule.h b/Source/core/css/CSSGroupingRule.h
index 3e0aea0..1249f3d 100644
--- a/Source/core/css/CSSGroupingRule.h
+++ b/Source/core/css/CSSGroupingRule.h
@@ -29,6 +29,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class CSSRuleList;
 
 class CSSGroupingRule : public CSSRule {
@@ -39,8 +40,8 @@
 
     CSSRuleList* cssRules() const;
 
-    unsigned insertRule(const String& rule, unsigned index, ExceptionCode&);
-    void deleteRule(unsigned index, ExceptionCode&);
+    unsigned insertRule(const String& rule, unsigned index, ExceptionState&);
+    void deleteRule(unsigned index, ExceptionState&);
 
     // For CSSRuleList
     unsigned length() const;
diff --git a/Source/core/css/CSSMatrix.cpp b/Source/core/css/CSSMatrix.cpp
index 49777ff..7866dd9 100644
--- a/Source/core/css/CSSMatrix.cpp
+++ b/Source/core/css/CSSMatrix.cpp
@@ -28,6 +28,7 @@
 
 #include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/css/CSSParser.h"
 #include "core/css/StylePropertySet.h"
 #include "core/css/resolver/TransformBuilder.h"
@@ -42,17 +43,17 @@
     ScriptWrappable::init(this);
 }
 
-CSSMatrix::CSSMatrix(const String& s, ExceptionCode& ec)
+CSSMatrix::CSSMatrix(const String& s, ExceptionState& es)
 {
     ScriptWrappable::init(this);
-    setMatrixValue(s, ec);
+    setMatrixValue(s, es);
 }
 
 CSSMatrix::~CSSMatrix()
 {
 }
 
-void CSSMatrix::setMatrixValue(const String& string, ExceptionCode& ec)
+void CSSMatrix::setMatrixValue(const String& string, ExceptionState& es)
 {
     if (string.isEmpty())
         return;
@@ -69,7 +70,7 @@
 
         TransformOperations operations;
         if (!TransformBuilder::createTransformOperations(value.get(), 0, 0, operations)) {
-            ec = SyntaxError;
+            es.throwDOMException(SyntaxError);
             return;
         }
 
@@ -78,7 +79,7 @@
         TransformationMatrix t;
         for (unsigned i = 0; i < operations.operations().size(); ++i) {
             if (operations.operations()[i].get()->apply(t, IntSize(0, 0))) {
-                ec = SyntaxError;
+                es.throwDOMException(SyntaxError);
                 return;
             }
         }
@@ -86,7 +87,7 @@
         // set the matrix
         m_matrix = t;
     } else { // There is something there but parsing failed.
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
     }
 }
 
@@ -99,10 +100,10 @@
     return CSSMatrix::create(TransformationMatrix(m_matrix).multiply(secondMatrix->m_matrix));
 }
 
-PassRefPtr<CSSMatrix> CSSMatrix::inverse(ExceptionCode& ec) const
+PassRefPtr<CSSMatrix> CSSMatrix::inverse(ExceptionState& es) const
 {
     if (!m_matrix.isInvertible()) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
diff --git a/Source/core/css/CSSMatrix.h b/Source/core/css/CSSMatrix.h
index dea37ac..1f3397d 100644
--- a/Source/core/css/CSSMatrix.h
+++ b/Source/core/css/CSSMatrix.h
@@ -33,7 +33,7 @@
 
 namespace WebCore {
 
-typedef int ExceptionCode;
+class ExceptionState;
 
 class CSSMatrix : public ScriptWrappable, public RefCounted<CSSMatrix> {
 public:
@@ -41,9 +41,9 @@
     {
         return adoptRef(new CSSMatrix(m));
     }
-    static PassRefPtr<CSSMatrix> create(const String& s, ExceptionCode& ec)
+    static PassRefPtr<CSSMatrix> create(const String& s, ExceptionState& es)
     {
-        return adoptRef(new CSSMatrix(s, ec));
+        return adoptRef(new CSSMatrix(s, es));
     }
 
     virtual ~CSSMatrix();
@@ -96,7 +96,7 @@
     void setM43(double f) { m_matrix.setM43(f); }
     void setM44(double f) { m_matrix.setM44(f); }
 
-    void setMatrixValue(const String&, ExceptionCode&);
+    void setMatrixValue(const String&, ExceptionState&);
 
     // The following math function return a new matrix with the
     // specified operation applied. The this value is not modified.
@@ -105,7 +105,7 @@
     PassRefPtr<CSSMatrix> multiply(CSSMatrix* secondMatrix) const;
 
     // Return the inverse of this matrix. Throw an exception if the matrix is not invertible
-    PassRefPtr<CSSMatrix> inverse(ExceptionCode&) const;
+    PassRefPtr<CSSMatrix> inverse(ExceptionState&) const;
 
     // Return this matrix translated by the passed values.
     // Passing a NaN will use a value of 0. This allows the 3D form to used for 2D operations
@@ -151,7 +151,7 @@
 
 protected:
     CSSMatrix(const TransformationMatrix&);
-    CSSMatrix(const String&, ExceptionCode&);
+    CSSMatrix(const String&, ExceptionState&);
 
     TransformationMatrix m_matrix;
 };
diff --git a/Source/core/css/CSSParser-in.cpp b/Source/core/css/CSSParser-in.cpp
index b38112b..e16ad35 100644
--- a/Source/core/css/CSSParser-in.cpp
+++ b/Source/core/css/CSSParser-in.cpp
@@ -11208,14 +11208,21 @@
         return rewriteSpecifiersForShadowDistributed(specifiers, distributedPseudoElementSelector);
     }
 
-    if (!specifiers->needsCrossingTreeScopeBoundary()) {
-        if (tag == anyQName())
-            return specifiers;
-        specifiers->prependTagSelector(tag, tagIsForNamespaceRule);
-        return specifiers;
-    }
+    if (specifiers->needsCrossingTreeScopeBoundary())
+        return rewriteSpecifiersWithElementNameForCustomPseudoElement(tag, elementName, specifiers, tagIsForNamespaceRule);
 
-    // We should treat ::cue in the same way as custom pseudo element.
+    if (specifiers->isContentPseudoElement())
+        return rewriteSpecifiersWithElementNameForContentPseudoElement(tag, elementName, specifiers, tagIsForNamespaceRule);
+
+    if (tag == anyQName())
+        return specifiers;
+    if (!(specifiers->pseudoType() == CSSSelector::PseudoCue))
+        specifiers->prependTagSelector(tag, tagIsForNamespaceRule);
+    return specifiers;
+}
+
+CSSParserSelector* CSSParser::rewriteSpecifiersWithElementNameForCustomPseudoElement(const QualifiedName& tag, const AtomicString& elementName, CSSParserSelector* specifiers, bool tagIsForNamespaceRule)
+{
     CSSParserSelector* lastShadowPseudo = specifiers;
     CSSParserSelector* history = specifiers;
     while (history->tagHistory()) {
@@ -11238,6 +11245,30 @@
     return specifiers;
 }
 
+CSSParserSelector* CSSParser::rewriteSpecifiersWithElementNameForContentPseudoElement(const QualifiedName& tag, const AtomicString& elementName, CSSParserSelector* specifiers, bool tagIsForNamespaceRule)
+{
+    CSSParserSelector* last = specifiers;
+    CSSParserSelector* history = specifiers;
+    while (history->tagHistory()) {
+        history = history->tagHistory();
+        if (history->isContentPseudoElement() || history->relationIsAffectedByPseudoContent())
+            last = history;
+    }
+
+    if (last->tagHistory()) {
+        if (tag != anyQName())
+            last->tagHistory()->prependTagSelector(tag, tagIsForNamespaceRule);
+        return specifiers;
+    }
+
+    // For shadow-ID pseudo-elements to be correctly matched, the ShadowPseudo combinator has to be used.
+    // We therefore create a new Selector with that combinator here in any case, even if matching any (host) element in any namespace (i.e. '*').
+    OwnPtr<CSSParserSelector> elementNameSelector = adoptPtr(new CSSParserSelector(tag));
+    last->setTagHistory(elementNameSelector.release());
+    last->setRelation(CSSSelector::SubSelector);
+    return specifiers;
+}
+
 CSSParserSelector* CSSParser::rewriteSpecifiersForShadowDistributed(CSSParserSelector* specifiers, CSSParserSelector* distributedPseudoElementSelector)
 {
     CSSParserSelector* argumentSelector = distributedPseudoElementSelector->functionArgumentSelector();
@@ -11257,7 +11288,7 @@
     case CSSSelector::Child:
     case CSSSelector::Descendant:
         end->setTagHistory(sinkFloatingSelector(specifiers));
-        end->setRelationIsForShadowDistributed();
+        end->setRelationIsAffectedByPseudoContent();
         return argumentSelector;
     default:
         return 0;
@@ -11271,11 +11302,19 @@
         newSpecifier->appendTagHistory(CSSSelector::ShadowPseudo, sinkFloatingSelector(specifiers));
         return newSpecifier;
     }
+    if (newSpecifier->isContentPseudoElement()) {
+        newSpecifier->appendTagHistory(CSSSelector::SubSelector, sinkFloatingSelector(specifiers));
+        return newSpecifier;
+    }
     if (specifiers->needsCrossingTreeScopeBoundary()) {
         // Specifiers for unknown pseudo element go right behind it in the chain.
         specifiers->insertTagHistory(CSSSelector::SubSelector, sinkFloatingSelector(newSpecifier), CSSSelector::ShadowPseudo);
         return specifiers;
     }
+    if (specifiers->isContentPseudoElement()) {
+        specifiers->insertTagHistory(CSSSelector::SubSelector, sinkFloatingSelector(newSpecifier), CSSSelector::SubSelector);
+        return specifiers;
+    }
     specifiers->appendTagHistory(CSSSelector::SubSelector, sinkFloatingSelector(newSpecifier));
     return specifiers;
 }
diff --git a/Source/core/css/CSSParser.h b/Source/core/css/CSSParser.h
index 6c858ed..2e44bfc 100644
--- a/Source/core/css/CSSParser.h
+++ b/Source/core/css/CSSParser.h
@@ -344,6 +344,8 @@
     QualifiedName determineNameInNamespace(const AtomicString& prefix, const AtomicString& localName);
 
     CSSParserSelector* rewriteSpecifiersWithElementName(const AtomicString& namespacePrefix, const AtomicString& elementName, CSSParserSelector*, bool isNamespacePlaceholder = false);
+    CSSParserSelector* rewriteSpecifiersWithElementNameForCustomPseudoElement(const QualifiedName& tag, const AtomicString& elementName, CSSParserSelector* specifiers, bool tagIsForNamespaceRule);
+    CSSParserSelector* rewriteSpecifiersWithElementNameForContentPseudoElement(const QualifiedName& tag, const AtomicString& elementName, CSSParserSelector* specifiers, bool tagIsForNamespaceRule);
     CSSParserSelector* rewriteSpecifiersWithNamespaceIfNeeded(CSSParserSelector*);
     CSSParserSelector* rewriteSpecifiers(CSSParserSelector*, CSSParserSelector*);
     CSSParserSelector* rewriteSpecifiersForShadowDistributed(CSSParserSelector* specifiers, CSSParserSelector* distributedPseudoElementSelector);
diff --git a/Source/core/css/CSSParserValues.h b/Source/core/css/CSSParserValues.h
index 0d331c6..87deccb 100644
--- a/Source/core/css/CSSParserValues.h
+++ b/Source/core/css/CSSParserValues.h
@@ -211,7 +211,8 @@
     void setMatch(CSSSelector::Match value) { m_selector->m_match = value; }
     void setRelation(CSSSelector::Relation value) { m_selector->m_relation = value; }
     void setForPage() { m_selector->setForPage(); }
-    void setRelationIsForShadowDistributed() { m_selector->setRelationIsForShadowDistributed(); }
+    void setRelationIsAffectedByPseudoContent() { m_selector->setRelationIsAffectedByPseudoContent(); }
+    bool relationIsAffectedByPseudoContent() const { return m_selector->relationIsAffectedByPseudoContent(); }
     void setMatchUserAgentOnly() { m_selector->setMatchUserAgentOnly(); }
 
     void adoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectorVector);
@@ -220,6 +221,7 @@
     void setFunctionArgumentSelector(CSSParserSelector* selector) { m_functionArgumentSelector = selector; }
     bool isDistributedPseudoElement() const { return m_selector->isDistributedPseudoElement(); }
     CSSParserSelector* findDistributedPseudoElementSelector() const;
+    bool isContentPseudoElement() const { return m_selector->isContentPseudoElement(); }
 
     CSSSelector::PseudoType pseudoType() const { return m_selector->pseudoType(); }
     bool isCustomPseudoElement() const { return m_selector->isCustomPseudoElement(); }
diff --git a/Source/core/css/CSSPrimitiveValue.cpp b/Source/core/css/CSSPrimitiveValue.cpp
index af02ba1..0fc6469 100644
--- a/Source/core/css/CSSPrimitiveValue.cpp
+++ b/Source/core/css/CSSPrimitiveValue.cpp
@@ -23,6 +23,7 @@
 
 #include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/css/CSSBasicShapes.h"
 #include "core/css/CSSCalculationValue.h"
 #include "core/css/CSSHelper.h"
@@ -591,12 +592,12 @@
     return result * multiplier;
 }
 
-void CSSPrimitiveValue::setFloatValue(unsigned short, double, ExceptionCode& ec)
+void CSSPrimitiveValue::setFloatValue(unsigned short, double, ExceptionState& es)
 {
     // Keeping values immutable makes optimizations easier and allows sharing of the primitive value objects.
     // No other engine supports mutating style through this API. Computed style is always read-only anyway.
     // Supporting setter would require making primitive value copy-on-write and taking care of style invalidation.
-    ec = NoModificationAllowedError;
+    es.throwDOMException(NoModificationAllowedError);
 }
 
 double CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(unsigned short unitType)
@@ -651,16 +652,16 @@
     return factor;
 }
 
-double CSSPrimitiveValue::getDoubleValue(unsigned short unitType, ExceptionCode& ec) const
+double CSSPrimitiveValue::getDoubleValue(unsigned short unitType, ExceptionState& es) const
 {
     double result = 0;
     bool success = getDoubleValueInternal(static_cast<UnitTypes>(unitType), &result);
     if (!success) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0.0;
     }
 
-    ec = 0;
+    es.clearException();
     return result;
 }
 
@@ -752,17 +753,17 @@
     return true;
 }
 
-void CSSPrimitiveValue::setStringValue(unsigned short, const String&, ExceptionCode& ec)
+void CSSPrimitiveValue::setStringValue(unsigned short, const String&, ExceptionState& es)
 {
     // Keeping values immutable makes optimizations easier and allows sharing of the primitive value objects.
     // No other engine supports mutating style through this API. Computed style is always read-only anyway.
     // Supporting setter would require making primitive value copy-on-write and taking care of style invalidation.
-    ec = NoModificationAllowedError;
+    es.throwDOMException(NoModificationAllowedError);
 }
 
-String CSSPrimitiveValue::getStringValue(ExceptionCode& ec) const
+String CSSPrimitiveValue::getStringValue(ExceptionState& es) const
 {
-    ec = 0;
+    es.clearException();
     switch (m_primitiveUnitType) {
         case CSS_STRING:
         case CSS_ATTR:
@@ -774,7 +775,7 @@
         case CSS_PROPERTY_ID:
             return propertyName(m_value.propertyID);
         default:
-            ec = InvalidAccessError;
+            es.throwDOMException(InvalidAccessError);
             break;
     }
 
@@ -800,44 +801,44 @@
     return String();
 }
 
-Counter* CSSPrimitiveValue::getCounterValue(ExceptionCode& ec) const
+Counter* CSSPrimitiveValue::getCounterValue(ExceptionState& es) const
 {
-    ec = 0;
+    es.clearException();
     if (m_primitiveUnitType != CSS_COUNTER) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
     return m_value.counter;
 }
 
-Rect* CSSPrimitiveValue::getRectValue(ExceptionCode& ec) const
+Rect* CSSPrimitiveValue::getRectValue(ExceptionState& es) const
 {
-    ec = 0;
+    es.clearException();
     if (m_primitiveUnitType != CSS_RECT) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
     return m_value.rect;
 }
 
-Quad* CSSPrimitiveValue::getQuadValue(ExceptionCode& ec) const
+Quad* CSSPrimitiveValue::getQuadValue(ExceptionState& es) const
 {
-    ec = 0;
+    es.clearException();
     if (m_primitiveUnitType != CSS_QUAD) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
     return m_value.quad;
 }
 
-PassRefPtr<RGBColor> CSSPrimitiveValue::getRGBColorValue(ExceptionCode& ec) const
+PassRefPtr<RGBColor> CSSPrimitiveValue::getRGBColorValue(ExceptionState& es) const
 {
-    ec = 0;
+    es.clearException();
     if (m_primitiveUnitType != CSS_RGBCOLOR) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -845,11 +846,11 @@
     return RGBColor::create(m_value.rgbcolor);
 }
 
-Pair* CSSPrimitiveValue::getPairValue(ExceptionCode& ec) const
+Pair* CSSPrimitiveValue::getPairValue(ExceptionState& es) const
 {
-    ec = 0;
+    es.clearException();
     if (m_primitiveUnitType != CSS_PAIR) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
diff --git a/Source/core/css/CSSPrimitiveValue.h b/Source/core/css/CSSPrimitiveValue.h
index c0c3f4f..9e5e820 100644
--- a/Source/core/css/CSSPrimitiveValue.h
+++ b/Source/core/css/CSSPrimitiveValue.h
@@ -32,14 +32,15 @@
 
 namespace WebCore {
 
+class CSSBasicShape;
 class CSSCalcValue;
 class Counter;
+class ExceptionState;
 class Pair;
 class Quad;
 class RGBColor;
 class Rect;
 class RenderStyle;
-class CSSBasicShape;
 
 struct Length;
 
@@ -261,40 +262,40 @@
     // use with care!!!
     void setPrimitiveType(unsigned short type) { m_primitiveUnitType = type; }
 
-    double getDoubleValue(unsigned short unitType, ExceptionCode&) const;
+    double getDoubleValue(unsigned short unitType, ExceptionState&) const;
     double getDoubleValue(unsigned short unitType) const;
     double getDoubleValue() const;
 
-    void setFloatValue(unsigned short unitType, double floatValue, ExceptionCode&);
-    float getFloatValue(unsigned short unitType, ExceptionCode& ec) const { return getValue<float>(unitType, ec); }
+    void setFloatValue(unsigned short unitType, double floatValue, ExceptionState&);
+    float getFloatValue(unsigned short unitType, ExceptionState& es) const { return getValue<float>(unitType, es); }
     float getFloatValue(unsigned short unitType) const { return getValue<float>(unitType); }
     float getFloatValue() const { return getValue<float>(); }
 
-    int getIntValue(unsigned short unitType, ExceptionCode& ec) const { return getValue<int>(unitType, ec); }
+    int getIntValue(unsigned short unitType, ExceptionState& es) const { return getValue<int>(unitType, es); }
     int getIntValue(unsigned short unitType) const { return getValue<int>(unitType); }
     int getIntValue() const { return getValue<int>(); }
 
-    template<typename T> inline T getValue(unsigned short unitType, ExceptionCode& ec) const { return clampTo<T>(getDoubleValue(unitType, ec)); }
+    template<typename T> inline T getValue(unsigned short unitType, ExceptionState& es) const { return clampTo<T>(getDoubleValue(unitType, es)); }
     template<typename T> inline T getValue(unsigned short unitType) const { return clampTo<T>(getDoubleValue(unitType)); }
     template<typename T> inline T getValue() const { return clampTo<T>(getDoubleValue()); }
 
-    void setStringValue(unsigned short stringType, const String& stringValue, ExceptionCode&);
-    String getStringValue(ExceptionCode&) const;
+    void setStringValue(unsigned short stringType, const String& stringValue, ExceptionState&);
+    String getStringValue(ExceptionState&) const;
     String getStringValue() const;
 
-    Counter* getCounterValue(ExceptionCode&) const;
+    Counter* getCounterValue(ExceptionState&) const;
     Counter* getCounterValue() const { return m_primitiveUnitType != CSS_COUNTER ? 0 : m_value.counter; }
 
-    Rect* getRectValue(ExceptionCode&) const;
+    Rect* getRectValue(ExceptionState&) const;
     Rect* getRectValue() const { return m_primitiveUnitType != CSS_RECT ? 0 : m_value.rect; }
 
-    Quad* getQuadValue(ExceptionCode&) const;
+    Quad* getQuadValue(ExceptionState&) const;
     Quad* getQuadValue() const { return m_primitiveUnitType != CSS_QUAD ? 0 : m_value.quad; }
 
-    PassRefPtr<RGBColor> getRGBColorValue(ExceptionCode&) const;
+    PassRefPtr<RGBColor> getRGBColorValue(ExceptionState&) const;
     RGBA32 getRGBA32Value() const { return m_primitiveUnitType != CSS_RGBCOLOR ? 0 : m_value.rgbcolor; }
 
-    Pair* getPairValue(ExceptionCode&) const;
+    Pair* getPairValue(ExceptionState&) const;
     Pair* getPairValue() const { return m_primitiveUnitType != CSS_PAIR ? 0 : m_value.pair; }
 
     CSSBasicShape* getShapeValue() const { return m_primitiveUnitType != CSS_SHAPE ? 0 : m_value.shape; }
diff --git a/Source/core/css/CSSRule.h b/Source/core/css/CSSRule.h
index e1a0378..f386873 100644
--- a/Source/core/css/CSSRule.h
+++ b/Source/core/css/CSSRule.h
@@ -31,7 +31,6 @@
 class CSSStyleSheet;
 class StyleRuleBase;
 struct CSSParserContext;
-typedef int ExceptionCode;
 
 class CSSRule : public RefCounted<CSSRule> {
 public:
diff --git a/Source/core/css/CSSSelector.cpp b/Source/core/css/CSSSelector.cpp
index e5d582c..4fea65d 100644
--- a/Source/core/css/CSSSelector.cpp
+++ b/Source/core/css/CSSSelector.cpp
@@ -249,6 +249,7 @@
     case PseudoDistributed:
     case PseudoPart:
     case PseudoUnresolved:
+    case PseudoContent:
         return NOPSEUDO;
     case PseudoNotParsed:
         ASSERT_NOT_REACHED();
@@ -339,6 +340,7 @@
     DEFINE_STATIC_LOCAL(AtomicString, scope, ("scope", AtomicString::ConstructFromLiteral));
     DEFINE_STATIC_LOCAL(AtomicString, part, ("part(", AtomicString::ConstructFromLiteral));
     DEFINE_STATIC_LOCAL(AtomicString, unresolved, ("unresolved", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, content, ("content", AtomicString::ConstructFromLiteral));
 
     static HashMap<StringImpl*, CSSSelector::PseudoType>* nameToPseudoType = 0;
     if (!nameToPseudoType) {
@@ -422,6 +424,8 @@
             nameToPseudoType->set(part.impl(), CSSSelector::PseudoPart);
         if (RuntimeEnabledFeatures::customDOMElementsEnabled())
             nameToPseudoType->set(unresolved.impl(), CSSSelector::PseudoUnresolved);
+        if (RuntimeEnabledFeatures::shadowDOMEnabled())
+            nameToPseudoType->set(content.impl(), CSSSelector::PseudoContent);
     }
     return nameToPseudoType;
 }
@@ -475,6 +479,7 @@
     case PseudoUserAgentCustomElement:
     case PseudoWebKitCustomElement:
     case PseudoPart:
+    case PseudoContent:
         element = true;
         break;
     case PseudoUnknown:
@@ -642,9 +647,18 @@
         } else if (cs->m_match == CSSSelector::PseudoElement) {
             str.appendLiteral("::");
             str.append(cs->value());
-            if (cs->pseudoType() == PseudoPart) {
+
+            switch (cs->pseudoType()) {
+            case PseudoPart:
                 str.append(cs->argument());
                 str.append(')');
+                break;
+            case PseudoContent:
+                if (cs->relation() == CSSSelector::SubSelector && cs->tagHistory())
+                    return cs->tagHistory()->selectorText() + str.toString() + rightSide;
+                break;
+            default:
+                break;
             }
         } else if (cs->isAttributeSelector()) {
             str.append('[');
@@ -693,11 +707,11 @@
     if (const CSSSelector* tagHistory = cs->tagHistory()) {
         switch (cs->relation()) {
         case CSSSelector::Descendant:
-            if (cs->relationIsForShadowDistributed())
+            if (cs->relationIsAffectedByPseudoContent() && tagHistory->pseudoType() != CSSSelector::PseudoContent)
                 return tagHistory->selectorText("::-webkit-distributed(" + str.toString() + rightSide + ")");
             return tagHistory->selectorText(" " + str.toString() + rightSide);
         case CSSSelector::Child:
-            if (cs->relationIsForShadowDistributed())
+            if (cs->relationIsAffectedByPseudoContent() && tagHistory->pseudoType() != CSSSelector::PseudoContent)
                 return tagHistory->selectorText("::-webkit-distributed(> " + str.toString() + rightSide + ")");
             return tagHistory->selectorText(" > " + str.toString() + rightSide);
         case CSSSelector::DirectAdjacent:
diff --git a/Source/core/css/CSSSelector.h b/Source/core/css/CSSSelector.h
index aa80e17..32ee1f5 100644
--- a/Source/core/css/CSSSelector.h
+++ b/Source/core/css/CSSSelector.h
@@ -161,7 +161,8 @@
             PseudoSeamlessDocument,
             PseudoDistributed,
             PseudoPart,
-            PseudoUnresolved
+            PseudoUnresolved,
+            PseudoContent
         };
 
         enum MarginBoxType {
@@ -219,6 +220,7 @@
         bool isSiblingSelector() const;
         bool isAttributeSelector() const;
         bool isDistributedPseudoElement() const;
+        bool isContentPseudoElement() const;
 
         Relation relation() const { return static_cast<Relation>(m_relation); }
 
@@ -232,8 +234,8 @@
         bool isForPage() const { return m_isForPage; }
         void setForPage() { m_isForPage = true; }
 
-        bool relationIsForShadowDistributed() const { return m_relationIsForShadowDistributed; }
-        void setRelationIsForShadowDistributed() { m_relationIsForShadowDistributed = true; }
+        bool relationIsAffectedByPseudoContent() const { return m_relationIsAffectedByPseudoContent; }
+        void setRelationIsAffectedByPseudoContent() { m_relationIsAffectedByPseudoContent = true; }
 
         unsigned m_relation           : 3; // enum Relation
         mutable unsigned m_match      : 4; // enum Match
@@ -246,7 +248,7 @@
         unsigned m_hasRareData            : 1;
         unsigned m_isForPage              : 1;
         unsigned m_tagIsForNamespaceRule  : 1;
-        unsigned m_relationIsForShadowDistributed  : 1;
+        unsigned m_relationIsAffectedByPseudoContent  : 1;
 
         unsigned specificityForOneSelector() const;
         unsigned specificityForPage() const;
@@ -341,6 +343,11 @@
     return m_match == PseudoElement && pseudoType() == PseudoDistributed;
 }
 
+inline bool CSSSelector::isContentPseudoElement() const
+{
+    return m_match == PseudoElement && pseudoType() == PseudoContent;
+}
+
 inline void CSSSelector::setValue(const AtomicString& value)
 {
     ASSERT(m_match != Tag);
@@ -369,7 +376,7 @@
     , m_hasRareData(false)
     , m_isForPage(false)
     , m_tagIsForNamespaceRule(false)
-    , m_relationIsForShadowDistributed(false)
+    , m_relationIsAffectedByPseudoContent(false)
 {
 }
 
@@ -383,7 +390,7 @@
     , m_hasRareData(false)
     , m_isForPage(false)
     , m_tagIsForNamespaceRule(tagIsForNamespaceRule)
-    , m_relationIsForShadowDistributed(false)
+    , m_relationIsAffectedByPseudoContent(false)
 {
     m_data.m_tagQName = tagQName.impl();
     m_data.m_tagQName->ref();
@@ -399,7 +406,7 @@
     , m_hasRareData(o.m_hasRareData)
     , m_isForPage(o.m_isForPage)
     , m_tagIsForNamespaceRule(o.m_tagIsForNamespaceRule)
-    , m_relationIsForShadowDistributed(o.m_relationIsForShadowDistributed)
+    , m_relationIsAffectedByPseudoContent(o.m_relationIsAffectedByPseudoContent)
 {
     if (o.m_match == Tag) {
         m_data.m_tagQName = o.m_data.m_tagQName;
diff --git a/Source/core/css/CSSSelectorList.cpp b/Source/core/css/CSSSelectorList.cpp
index f5125b7..bf79681 100644
--- a/Source/core/css/CSSSelectorList.cpp
+++ b/Source/core/css/CSSSelectorList.cpp
@@ -183,7 +183,7 @@
 public:
     bool operator()(const CSSSelector* selector)
     {
-        return selector->relationIsForShadowDistributed();
+        return selector->relationIsAffectedByPseudoContent();
     }
 };
 
diff --git a/Source/core/css/CSSStyleDeclaration.h b/Source/core/css/CSSStyleDeclaration.h
index 0459adc..5d30cae 100644
--- a/Source/core/css/CSSStyleDeclaration.h
+++ b/Source/core/css/CSSStyleDeclaration.h
@@ -33,11 +33,10 @@
 class CSSRule;
 class CSSStyleSheet;
 class CSSValue;
+class ExceptionState;
 class MutableStylePropertySet;
 class VariablesIterator;
 
-typedef int ExceptionCode;
-
 class CSSStyleDeclaration : public ScriptWrappable {
     WTF_MAKE_NONCOPYABLE(CSSStyleDeclaration); WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -48,7 +47,7 @@
 
     virtual CSSRule* parentRule() const = 0;
     virtual String cssText() const = 0;
-    virtual void setCssText(const String&, ExceptionCode&) = 0;
+    virtual void setCssText(const String&, ExceptionState&) = 0;
     virtual unsigned length() const = 0;
     virtual String item(unsigned index) const = 0;
     virtual PassRefPtr<CSSValue> getPropertyCSSValue(const String& propertyName) = 0;
@@ -56,22 +55,22 @@
     virtual String getPropertyPriority(const String& propertyName) = 0;
     virtual String getPropertyShorthand(const String& propertyName) = 0;
     virtual bool isPropertyImplicit(const String& propertyName) = 0;
-    virtual void setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode&) = 0;
-    virtual String removeProperty(const String& propertyName, ExceptionCode&) = 0;
+    virtual void setProperty(const String& propertyName, const String& value, const String& priority, ExceptionState&) = 0;
+    virtual String removeProperty(const String& propertyName, ExceptionState&) = 0;
 
     PassRefPtr<CSSVariablesMap> var();
     virtual unsigned variableCount() const = 0;
     virtual String variableValue(const AtomicString& name) const = 0;
-    virtual void setVariableValue(const AtomicString& name, const String& value, ExceptionCode&) = 0;
+    virtual void setVariableValue(const AtomicString& name, const String& value, ExceptionState&) = 0;
     virtual bool removeVariable(const AtomicString& name) = 0;
-    virtual void clearVariables(ExceptionCode&) = 0;
+    virtual void clearVariables(ExceptionState&) = 0;
 
     // CSSPropertyID versions of the CSSOM functions to support bindings and editing.
     // Use the non-virtual methods in the concrete subclasses when possible.
     // The CSSValue returned by this function should not be exposed to the web as it may be used by multiple documents at the same time.
     virtual PassRefPtr<CSSValue> getPropertyCSSValueInternal(CSSPropertyID) = 0;
     virtual String getPropertyValueInternal(CSSPropertyID) = 0;
-    virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionCode&) = 0;
+    virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionState&) = 0;
 
     virtual PassRefPtr<MutableStylePropertySet> copyProperties() const = 0;
 
diff --git a/Source/core/css/CSSStyleSheet.cpp b/Source/core/css/CSSStyleSheet.cpp
index 56d6783..40edc40 100644
--- a/Source/core/css/CSSStyleSheet.cpp
+++ b/Source/core/css/CSSStyleSheet.cpp
@@ -23,6 +23,7 @@
 
 #include "HTMLNames.h"
 #include "SVGNames.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/css/CSSCharsetRule.h"
 #include "core/css/CSSImportRule.h"
 #include "core/css/CSSParser.h"
@@ -244,27 +245,27 @@
     return nonCharsetRules.release();
 }
 
-unsigned CSSStyleSheet::insertRule(const String& ruleString, unsigned index, ExceptionCode& ec)
+unsigned CSSStyleSheet::insertRule(const String& ruleString, unsigned index, ExceptionState& es)
 {
     ASSERT(m_childRuleCSSOMWrappers.isEmpty() || m_childRuleCSSOMWrappers.size() == m_contents->ruleCount());
 
-    ec = 0;
+    es.clearException();
     if (index > length()) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return 0;
     }
     CSSParser p(m_contents->parserContext(), UseCounter::getFrom(this));
     RefPtr<StyleRuleBase> rule = p.parseRule(m_contents.get(), ruleString);
 
     if (!rule) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return 0;
     }
     RuleMutationScope mutationScope(this);
 
     bool success = m_contents->wrapperInsertRule(rule, index);
     if (!success) {
-        ec = HierarchyRequestError;
+        es.throwDOMException(HierarchyRequestError);
         return 0;
     }
     if (!m_childRuleCSSOMWrappers.isEmpty())
@@ -273,13 +274,13 @@
     return index;
 }
 
-void CSSStyleSheet::deleteRule(unsigned index, ExceptionCode& ec)
+void CSSStyleSheet::deleteRule(unsigned index, ExceptionState& es)
 {
     ASSERT(m_childRuleCSSOMWrappers.isEmpty() || m_childRuleCSSOMWrappers.size() == m_contents->ruleCount());
 
-    ec = 0;
+    es.clearException();
     if (index >= length()) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
     RuleMutationScope mutationScope(this);
@@ -293,7 +294,7 @@
     }
 }
 
-int CSSStyleSheet::addRule(const String& selector, const String& style, int index, ExceptionCode& ec)
+int CSSStyleSheet::addRule(const String& selector, const String& style, int index, ExceptionState& es)
 {
     StringBuilder text;
     text.append(selector);
@@ -302,15 +303,15 @@
     if (!style.isEmpty())
         text.append(' ');
     text.append('}');
-    insertRule(text.toString(), index, ec);
+    insertRule(text.toString(), index, es);
 
     // As per Microsoft documentation, always return -1.
     return -1;
 }
 
-int CSSStyleSheet::addRule(const String& selector, const String& style, ExceptionCode& ec)
+int CSSStyleSheet::addRule(const String& selector, const String& style, ExceptionState& es)
 {
-    return addRule(selector, style, length(), ec);
+    return addRule(selector, style, length(), es);
 }
 
 
diff --git a/Source/core/css/CSSStyleSheet.h b/Source/core/css/CSSStyleSheet.h
index e955bf3..83b4f9d 100644
--- a/Source/core/css/CSSStyleSheet.h
+++ b/Source/core/css/CSSStyleSheet.h
@@ -36,12 +36,11 @@
 class CSSStyleSheet;
 class CachedCSSStyleSheet;
 class Document;
+class ExceptionState;
 class MediaQuerySet;
 class SecurityOrigin;
 class StyleSheetContents;
 
-typedef int ExceptionCode;
-
 class CSSStyleSheet : public StyleSheet {
 public:
     static PassRefPtr<CSSStyleSheet> create(PassRefPtr<StyleSheetContents>, CSSImportRule* ownerRule = 0);
@@ -59,14 +58,14 @@
     virtual void setDisabled(bool) OVERRIDE;
 
     PassRefPtr<CSSRuleList> cssRules();
-    unsigned insertRule(const String& rule, unsigned index, ExceptionCode&);
-    void deleteRule(unsigned index, ExceptionCode&);
+    unsigned insertRule(const String& rule, unsigned index, ExceptionState&);
+    void deleteRule(unsigned index, ExceptionState&);
 
     // IE Extensions
     PassRefPtr<CSSRuleList> rules();
-    int addRule(const String& selector, const String& style, int index, ExceptionCode&);
-    int addRule(const String& selector, const String& style, ExceptionCode&);
-    void removeRule(unsigned index, ExceptionCode& ec) { deleteRule(index, ec); }
+    int addRule(const String& selector, const String& style, int index, ExceptionState&);
+    int addRule(const String& selector, const String& style, ExceptionState&);
+    void removeRule(unsigned index, ExceptionState& es) { deleteRule(index, es); }
 
     // For CSSRuleList.
     unsigned length() const;
diff --git a/Source/core/css/CSSValue.h b/Source/core/css/CSSValue.h
index 4307838..a244c84 100644
--- a/Source/core/css/CSSValue.h
+++ b/Source/core/css/CSSValue.h
@@ -29,6 +29,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class StyleSheetContents;
 
 enum CssTextFormattingFlags { QuoteCSSStringIfNeeded, AlwaysQuoteCSSString };
@@ -60,7 +61,7 @@
     Type cssValueType() const;
 
     String cssText() const;
-    void setCssText(const String&, ExceptionCode&) { } // FIXME: Not implemented.
+    void setCssText(const String&, ExceptionState&) { } // FIXME: Not implemented.
     String serializeResolvingVariables(const HashMap<AtomicString, String>&) const;
 
     bool isPrimitiveValue() const { return m_classType == PrimitiveClass; }
diff --git a/Source/core/css/CSSVariablesMap.cpp b/Source/core/css/CSSVariablesMap.cpp
index a104e43..599a9dc 100644
--- a/Source/core/css/CSSVariablesMap.cpp
+++ b/Source/core/css/CSSVariablesMap.cpp
@@ -29,6 +29,7 @@
 #include "config.h"
 #include "core/css/CSSVariablesMap.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/css/CSSStyleDeclaration.h"
 
 namespace WebCore {
@@ -54,10 +55,10 @@
     return false;
 }
 
-void CSSVariablesMap::set(const AtomicString& name, const String& value, ExceptionCode& ec) const
+void CSSVariablesMap::set(const AtomicString& name, const String& value, ExceptionState& es) const
 {
     if (m_styleDeclaration)
-        m_styleDeclaration->setVariableValue(name, value, ec);
+        m_styleDeclaration->setVariableValue(name, value, es);
 }
 
 bool CSSVariablesMap::remove(const AtomicString& name) const
@@ -67,10 +68,10 @@
     return false;
 }
 
-void CSSVariablesMap::clear(ExceptionCode& ec) const
+void CSSVariablesMap::clear(ExceptionState& es) const
 {
     if (m_styleDeclaration)
-        return m_styleDeclaration->clearVariables(ec);
+        return m_styleDeclaration->clearVariables(es);
 }
 
 } // namespace WebCore
diff --git a/Source/core/css/CSSVariablesMap.h b/Source/core/css/CSSVariablesMap.h
index bd7878a..5c23695 100644
--- a/Source/core/css/CSSVariablesMap.h
+++ b/Source/core/css/CSSVariablesMap.h
@@ -35,8 +35,7 @@
 namespace WebCore {
 
 class CSSStyleDeclaration;
-
-typedef int ExceptionCode;
+class ExceptionState;
 
 class CSSVariablesMap : public RefCounted<CSSVariablesMap> {
 public:
@@ -50,9 +49,9 @@
     unsigned size() const;
     String get(const AtomicString& name) const;
     bool has(const AtomicString& name) const;
-    void set(const AtomicString& name, const String& value, ExceptionCode&) const;
+    void set(const AtomicString& name, const String& value, ExceptionState&) const;
     bool remove(const AtomicString& name) const;
-    void clear(ExceptionCode&) const;
+    void clear(ExceptionState&) const;
 
     void clearStyleDeclaration() { m_styleDeclaration = 0; }
 
diff --git a/Source/core/css/MediaList.cpp b/Source/core/css/MediaList.cpp
index e512cc3..fd60ac5 100644
--- a/Source/core/css/MediaList.cpp
+++ b/Source/core/css/MediaList.cpp
@@ -20,6 +20,7 @@
 #include "config.h"
 #include "core/css/MediaList.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/css/CSSParser.h"
 #include "core/css/CSSStyleSheet.h"
 #include "core/css/MediaFeatureNames.h"
@@ -195,26 +196,26 @@
     return String();
 }
 
-void MediaList::deleteMedium(const String& medium, ExceptionCode& ec)
+void MediaList::deleteMedium(const String& medium, ExceptionState& es)
 {
     CSSStyleSheet::RuleMutationScope mutationScope(m_parentRule);
 
     bool success = m_mediaQueries->remove(medium);
     if (!success) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
     if (m_parentStyleSheet)
         m_parentStyleSheet->didMutate();
 }
 
-void MediaList::appendMedium(const String& medium, ExceptionCode& ec)
+void MediaList::appendMedium(const String& medium, ExceptionState& es)
 {
     CSSStyleSheet::RuleMutationScope mutationScope(m_parentRule);
 
     bool success = m_mediaQueries->add(medium);
     if (!success) {
-        ec = InvalidCharacterError;
+        es.throwDOMException(InvalidCharacterError);
         return;
     }
 
diff --git a/Source/core/css/MediaList.h b/Source/core/css/MediaList.h
index 7bf87c2..80223b0 100644
--- a/Source/core/css/MediaList.h
+++ b/Source/core/css/MediaList.h
@@ -33,6 +33,7 @@
 class CSSRule;
 class CSSStyleSheet;
 class Document;
+class ExceptionState;
 class MediaList;
 class MediaQuery;
 
@@ -79,8 +80,8 @@
 
     unsigned length() const { return m_mediaQueries->queryVector().size(); }
     String item(unsigned index) const;
-    void deleteMedium(const String& oldMedium, ExceptionCode&);
-    void appendMedium(const String& newMedium, ExceptionCode&);
+    void deleteMedium(const String& oldMedium, ExceptionState&);
+    void appendMedium(const String& newMedium, ExceptionState&);
 
     String mediaText() const { return m_mediaQueries->mediaText(); }
     void setMediaText(const String&);
diff --git a/Source/core/css/PropertySetCSSStyleDeclaration.cpp b/Source/core/css/PropertySetCSSStyleDeclaration.cpp
index 27f0159..53a41b6 100644
--- a/Source/core/css/PropertySetCSSStyleDeclaration.cpp
+++ b/Source/core/css/PropertySetCSSStyleDeclaration.cpp
@@ -24,6 +24,7 @@
 
 #include "HTMLNames.h"
 #include "RuntimeEnabledFeatures.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/css/CSSParser.h"
 #include "core/css/CSSStyleSheet.h"
 #include "core/css/StylePropertySet.h"
@@ -148,13 +149,13 @@
     return m_propertySet->asText();
 }
 
-void PropertySetCSSStyleDeclaration::setCssText(const String& text, ExceptionCode& ec)
+void PropertySetCSSStyleDeclaration::setCssText(const String& text, ExceptionState& es)
 {
     StyleAttributeMutationScope mutationScope(this);
     willMutate();
 
-    ec = 0;
-    // FIXME: Detect syntax errors and set ec.
+    es.clearException();
+    // FIXME: Detect syntax errors and set es.
     m_propertySet->parseDeclaration(text, contextStyleSheet());
 
     didMutate(PropertyChanged);
@@ -205,7 +206,7 @@
     return m_propertySet->isPropertyImplicit(propertyID);
 }
 
-void PropertySetCSSStyleDeclaration::setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode& ec)
+void PropertySetCSSStyleDeclaration::setProperty(const String& propertyName, const String& value, const String& priority, ExceptionState& es)
 {
     StyleAttributeMutationScope mutationScope(this);
     CSSPropertyID propertyID = cssPropertyID(propertyName);
@@ -216,7 +217,7 @@
 
     willMutate();
 
-    ec = 0;
+    es.clearException();
     bool changed = m_propertySet->setProperty(propertyID, value, important, contextStyleSheet());
 
     didMutate(changed ? PropertyChanged : NoChanges);
@@ -228,7 +229,7 @@
     }
 }
 
-String PropertySetCSSStyleDeclaration::removeProperty(const String& propertyName, ExceptionCode& ec)
+String PropertySetCSSStyleDeclaration::removeProperty(const String& propertyName, ExceptionState& es)
 {
     StyleAttributeMutationScope mutationScope(this);
     CSSPropertyID propertyID = cssPropertyID(propertyName);
@@ -237,7 +238,7 @@
 
     willMutate();
 
-    ec = 0;
+    es.clearException();
     String result;
     bool changed = m_propertySet->removeProperty(propertyID, &result);
 
@@ -258,12 +259,12 @@
     return m_propertySet->getPropertyValue(propertyID);
 }
 
-void PropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID propertyID, const String& value, bool important, ExceptionCode& ec)
+void PropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID propertyID, const String& value, bool important, ExceptionState& es)
 {
     StyleAttributeMutationScope mutationScope(this);
     willMutate();
 
-    ec = 0;
+    es.clearException();
     bool changed = m_propertySet->setProperty(propertyID, value, important, contextStyleSheet());
 
     didMutate(changed ? PropertyChanged : NoChanges);
@@ -284,7 +285,7 @@
     return m_propertySet->variableValue(name);
 }
 
-void PropertySetCSSStyleDeclaration::setVariableValue(const AtomicString& name, const String& value, ExceptionCode&)
+void PropertySetCSSStyleDeclaration::setVariableValue(const AtomicString& name, const String& value, ExceptionState&)
 {
     ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
     StyleAttributeMutationScope mutationScope(this);
@@ -307,7 +308,7 @@
     return changed;
 }
 
-void PropertySetCSSStyleDeclaration::clearVariables(ExceptionCode&)
+void PropertySetCSSStyleDeclaration::clearVariables(ExceptionState&)
 {
     ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
     StyleAttributeMutationScope mutationScope(this);
diff --git a/Source/core/css/PropertySetCSSStyleDeclaration.h b/Source/core/css/PropertySetCSSStyleDeclaration.h
index 85169d5..4bb4c7f 100644
--- a/Source/core/css/PropertySetCSSStyleDeclaration.h
+++ b/Source/core/css/PropertySetCSSStyleDeclaration.h
@@ -32,12 +32,13 @@
 
 namespace WebCore {
 
-class CSSRule;
 class CSSProperty;
+class CSSRule;
 class CSSValue;
+class Element;
+class ExceptionState;
 class MutableStylePropertySet;
 class StyleSheetContents;
-class Element;
 
 class PropertySetCSSStyleDeclaration : public CSSStyleDeclaration {
 public:
@@ -59,19 +60,19 @@
     virtual String getPropertyPriority(const String& propertyName) OVERRIDE;
     virtual String getPropertyShorthand(const String& propertyName) OVERRIDE;
     virtual bool isPropertyImplicit(const String& propertyName) OVERRIDE;
-    virtual void setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode&) OVERRIDE;
-    virtual String removeProperty(const String& propertyName, ExceptionCode&) OVERRIDE;
+    virtual void setProperty(const String& propertyName, const String& value, const String& priority, ExceptionState&) OVERRIDE;
+    virtual String removeProperty(const String& propertyName, ExceptionState&) OVERRIDE;
     virtual String cssText() const OVERRIDE;
-    virtual void setCssText(const String&, ExceptionCode&) OVERRIDE;
+    virtual void setCssText(const String&, ExceptionState&) OVERRIDE;
     virtual PassRefPtr<CSSValue> getPropertyCSSValueInternal(CSSPropertyID) OVERRIDE;
     virtual String getPropertyValueInternal(CSSPropertyID) OVERRIDE;
-    virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionCode&) OVERRIDE;
+    virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionState&) OVERRIDE;
 
     virtual unsigned variableCount() const OVERRIDE;
     virtual String variableValue(const AtomicString& name) const OVERRIDE;
-    virtual void setVariableValue(const AtomicString& name, const String& value, ExceptionCode&) OVERRIDE;
+    virtual void setVariableValue(const AtomicString& name, const String& value, ExceptionState&) OVERRIDE;
     virtual bool removeVariable(const AtomicString& name) OVERRIDE;
-    virtual void clearVariables(ExceptionCode&) OVERRIDE;
+    virtual void clearVariables(ExceptionState&) OVERRIDE;
 
     virtual bool cssPropertyMatches(CSSPropertyID, const CSSValue*) const OVERRIDE;
     virtual PassRefPtr<MutableStylePropertySet> copyProperties() const OVERRIDE;
diff --git a/Source/core/css/SelectorChecker.cpp b/Source/core/css/SelectorChecker.cpp
index 1b80f44..03d9571 100644
--- a/Source/core/css/SelectorChecker.cpp
+++ b/Source/core/css/SelectorChecker.cpp
@@ -108,6 +108,9 @@
         if (context.selector->isCustomPseudoElement()) {
             if (!matchesCustomPseudoElement(context.element, context.selector))
                 return SelectorFailsLocally;
+        } else if (context.selector->isContentPseudoElement()) {
+            if (!context.element->isInShadowTree() || !context.element->isInsertionPoint())
+                return SelectorFailsLocally;
         } else {
             if ((!context.elementStyle && m_mode == ResolvingStyle) || m_mode == QueryingRules)
                 return SelectorFailsLocally;
@@ -157,7 +160,7 @@
 
     switch (relation) {
     case CSSSelector::Descendant:
-        if (context.selector->relationIsForShadowDistributed()) {
+        if (context.selector->relationIsAffectedByPseudoContent()) {
             for (Element* element = context.element; element; element = element->parentElement()) {
                 if (matchForShadowDistributed(element, siblingTraversalStrategy, ignoreDynamicPseudo, nextContext) == SelectorMatches)
                     return SelectorMatches;
@@ -176,7 +179,7 @@
         }
         return SelectorFailsCompletely;
     case CSSSelector::Child:
-        if (context.selector->relationIsForShadowDistributed())
+        if (context.selector->relationIsAffectedByPseudoContent())
             return matchForShadowDistributed(context.element, siblingTraversalStrategy, ignoreDynamicPseudo, nextContext);
         nextContext.element = context.element->parentElement();
         if (!nextContext.element)
diff --git a/Source/core/css/SelectorFilter.cpp b/Source/core/css/SelectorFilter.cpp
index 239bc45..2c3c727 100644
--- a/Source/core/css/SelectorFilter.cpp
+++ b/Source/core/css/SelectorFilter.cpp
@@ -140,7 +140,7 @@
     size_t remainingHashesToCheck = 4;
 
     CSSSelector::Relation relation = selector->relation();
-    bool relationIsForShadowDistributed = selector->relationIsForShadowDistributed();
+    bool relationIsAffectedByPseudoContent = selector->relationIsAffectedByPseudoContent();
 
     // Skip the topmost selector. It is handled quickly by the rule hashes.
     bool skipOverSubselectors = true;
@@ -164,7 +164,7 @@
             break;
         case CSSSelector::Descendant:
         case CSSSelector::Child:
-            if (relationIsForShadowDistributed) {
+            if (relationIsAffectedByPseudoContent) {
                 skipOverSubselectors = true;
                 break;
             }
@@ -179,7 +179,7 @@
         }
 
         relation = selector->relation();
-        relationIsForShadowDistributed = selector->relationIsForShadowDistributed();
+        relationIsAffectedByPseudoContent = selector->relationIsAffectedByPseudoContent();
     }
 
     return false;
diff --git a/Source/core/dom/Attr.cpp b/Source/core/dom/Attr.cpp
index 70afc51..510a383 100644
--- a/Source/core/dom/Attr.cpp
+++ b/Source/core/dom/Attr.cpp
@@ -24,6 +24,8 @@
 #include "core/dom/Attr.h"
 
 #include "XMLNSNames.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Element.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/ScopedEventQueue.h"
@@ -89,16 +91,16 @@
     }
 }
 
-void Attr::setPrefix(const AtomicString& prefix, ExceptionCode& ec)
+void Attr::setPrefix(const AtomicString& prefix, ExceptionState& es)
 {
-    ec = 0;
-    checkSetPrefix(prefix, ec);
-    if (ec)
+    es.clearException();
+    checkSetPrefix(prefix, es);
+    if (es.hadException())
         return;
 
     if ((prefix == xmlnsAtom && namespaceURI() != XMLNSNames::xmlnsNamespaceURI)
         || static_cast<Attr*>(this)->qualifiedName() == xmlnsAtom) {
-        ec = NamespaceError;
+        es.throwDOMException(NamespaceError);
         return;
     }
 
@@ -124,7 +126,7 @@
     invalidateNodeListCachesInAncestors(&m_name, m_element);
 }
 
-void Attr::setValue(const AtomicString& value, ExceptionCode&)
+void Attr::setValue(const AtomicString& value, ExceptionState&)
 {
     if (m_element)
         m_element->willModifyAttribute(qualifiedName(), this->value(), value);
@@ -137,7 +139,7 @@
 
 void Attr::setNodeValue(const String& v)
 {
-    setValue(v, IGNORE_EXCEPTION);
+    setValue(v, IGNORE_EXCEPTION_STATE);
 }
 
 PassRefPtr<Node> Attr::cloneNode(bool /*deep*/)
diff --git a/Source/core/dom/Attr.h b/Source/core/dom/Attr.h
index 82a7e13..3673be2 100644
--- a/Source/core/dom/Attr.h
+++ b/Source/core/dom/Attr.h
@@ -31,6 +31,7 @@
 namespace WebCore {
 
 class CSSStyleDeclaration;
+class ExceptionState;
 class MutableStylePropertySet;
 
 // Attr can have Text children
@@ -50,7 +51,7 @@
     Element* ownerElement() const { return m_element; }
 
     const AtomicString& value() const;
-    void setValue(const AtomicString&, ExceptionCode&);
+    void setValue(const AtomicString&, ExceptionState&);
     void setValue(const AtomicString&);
 
     const QualifiedName& qualifiedName() const { return m_name; }
@@ -75,7 +76,7 @@
     virtual const AtomicString& namespaceURI() const OVERRIDE { return m_name.namespaceURI(); }
     virtual const AtomicString& prefix() const OVERRIDE { return m_name.prefix(); }
 
-    virtual void setPrefix(const AtomicString&, ExceptionCode&);
+    virtual void setPrefix(const AtomicString&, ExceptionState&);
 
     virtual String nodeValue() const OVERRIDE { return value(); }
     virtual void setNodeValue(const String&);
diff --git a/Source/core/dom/CharacterData.cpp b/Source/core/dom/CharacterData.cpp
index eb8a383..cc386f5 100644
--- a/Source/core/dom/CharacterData.cpp
+++ b/Source/core/dom/CharacterData.cpp
@@ -22,6 +22,7 @@
 #include "config.h"
 #include "core/dom/CharacterData.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/Document.h"
 #include "core/dom/EventNames.h"
 #include "core/dom/ExceptionCode.h"
@@ -56,10 +57,10 @@
     document()->textRemoved(this, 0, oldLength);
 }
 
-String CharacterData::substringData(unsigned offset, unsigned count, ExceptionCode& ec)
+String CharacterData::substringData(unsigned offset, unsigned count, ExceptionState& es)
 {
     if (offset > length()) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return String();
     }
 
@@ -116,10 +117,10 @@
     // FIXME: Should we call textInserted here?
 }
 
-void CharacterData::insertData(unsigned offset, const String& data, ExceptionCode& ec)
+void CharacterData::insertData(unsigned offset, const String& data, ExceptionState& es)
 {
     if (offset > length()) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
@@ -131,10 +132,10 @@
     document()->textInserted(this, offset, data.length());
 }
 
-void CharacterData::deleteData(unsigned offset, unsigned count, ExceptionCode& ec)
+void CharacterData::deleteData(unsigned offset, unsigned count, ExceptionState& es)
 {
     if (offset > length()) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
@@ -152,10 +153,10 @@
     document()->textRemoved(this, offset, realCount);
 }
 
-void CharacterData::replaceData(unsigned offset, unsigned count, const String& data, ExceptionCode& ec)
+void CharacterData::replaceData(unsigned offset, unsigned count, const String& data, ExceptionState& es)
 {
     if (offset > length()) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
diff --git a/Source/core/dom/CharacterData.h b/Source/core/dom/CharacterData.h
index 6dc7e68..8077364 100644
--- a/Source/core/dom/CharacterData.h
+++ b/Source/core/dom/CharacterData.h
@@ -28,17 +28,19 @@
 
 namespace WebCore {
 
+class ExceptionState;
+
 class CharacterData : public Node {
 public:
     void atomize();
     String data() const { return m_data; }
     void setData(const String&);
     unsigned length() const { return m_data.length(); }
-    String substringData(unsigned offset, unsigned count, ExceptionCode&);
+    String substringData(unsigned offset, unsigned count, ExceptionState&);
     void appendData(const String&);
-    void insertData(unsigned offset, const String&, ExceptionCode&);
-    void deleteData(unsigned offset, unsigned count, ExceptionCode&);
-    void replaceData(unsigned offset, unsigned count, const String&, ExceptionCode&);
+    void insertData(unsigned offset, const String&, ExceptionState&);
+    void deleteData(unsigned offset, unsigned count, ExceptionState&);
+    void replaceData(unsigned offset, unsigned count, const String&, ExceptionState&);
 
     bool containsOnlyWhitespace() const;
 
diff --git a/Source/core/dom/CharacterData.idl b/Source/core/dom/CharacterData.idl
index 0999ab7..10972ba 100644
--- a/Source/core/dom/CharacterData.idl
+++ b/Source/core/dom/CharacterData.idl
@@ -23,7 +23,7 @@
 
     readonly attribute unsigned long length;
 
-    [TreatReturnedNullStringAs=Null, RaisesException] DOMString substringData([Default=Undefined] optional unsigned long offset, [IsIndex,Default=Undefined] optional unsigned long length);
+    [TreatReturnedNullStringAs=Null, RaisesException] DOMString substringData(unsigned long offset, unsigned long length);
 
     void appendData(DOMString data);
     [RaisesException] void insertData(unsigned long offset, DOMString data);
diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp
index e8aceb8..3924585 100644
--- a/Source/core/dom/ContainerNode.cpp
+++ b/Source/core/dom/ContainerNode.cpp
@@ -23,6 +23,8 @@
 #include "config.h"
 #include "core/dom/ContainerNode.h"
 
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/ChildListMutationScope.h"
 #include "core/dom/ContainerNodeAlgorithms.h"
 #include "core/dom/EventNames.h"
@@ -60,12 +62,12 @@
 unsigned NoEventDispatchAssertion::s_count = 0;
 #endif
 
-static void collectChildrenAndRemoveFromOldParent(Node* node, NodeVector& nodes, ExceptionCode& ec)
+static void collectChildrenAndRemoveFromOldParent(Node* node, NodeVector& nodes, ExceptionState& es)
 {
     if (node->nodeType() != Node::DOCUMENT_FRAGMENT_NODE) {
         nodes.append(node);
         if (ContainerNode* oldParent = node->parentNode())
-            oldParent->removeChild(node, ec);
+            oldParent->removeChild(node, es);
         return;
     }
     getChildNodes(node, nodes);
@@ -102,7 +104,7 @@
         if (children[i]->attached())
             children[i]->detach();
         // FIXME: We need a no mutation event version of adoptNode.
-        RefPtr<Node> child = document()->adoptNode(children[i].release(), ASSERT_NO_EXCEPTION);
+        RefPtr<Node> child = document()->adoptNode(children[i].release(), ASSERT_NO_EXCEPTION_STATE);
         parserAppendChild(child.get());
         // FIXME: Together with adoptNode above, the tree scope might get updated recursively twice
         // (if the document changed or oldParent was in a shadow tree, AND *this is in a shadow tree).
@@ -145,72 +147,77 @@
         : newChild->contains(newParent);
 }
 
-static inline ExceptionCode checkAcceptChild(ContainerNode* newParent, Node* newChild, Node* oldChild)
+static inline bool checkAcceptChild(ContainerNode* newParent, Node* newChild, Node* oldChild, ExceptionState& es)
 {
     // Not mentioned in spec: throw NotFoundError if newChild is null
-    if (!newChild)
-        return NotFoundError;
+    if (!newChild) {
+        es.throwDOMException(NotFoundError);
+        return false;
+    }
 
     // Use common case fast path if possible.
     if ((newChild->isElementNode() || newChild->isTextNode()) && newParent->isElementNode()) {
         ASSERT(!newParent->isDocumentTypeNode());
         ASSERT(isChildTypeAllowed(newParent, newChild));
-        if (containsConsideringHostElements(newChild, newParent))
-            return HierarchyRequestError;
-        return 0;
+        if (containsConsideringHostElements(newChild, newParent)) {
+            es.throwDOMException(HierarchyRequestError);
+            return false;
+        }
+        return true;
     }
 
     // This should never happen, but also protect release builds from tree corruption.
     ASSERT(!newChild->isPseudoElement());
-    if (newChild->isPseudoElement())
-        return HierarchyRequestError;
-
-    if (newChild->inDocument() && newChild->isDocumentTypeNode())
-        return HierarchyRequestError;
-    if (containsConsideringHostElements(newChild, newParent))
-        return HierarchyRequestError;
-
-    if (oldChild && newParent->isDocumentNode()) {
-        if (!toDocument(newParent)->canReplaceChild(newChild, oldChild))
-            return HierarchyRequestError;
-    } else if (!isChildTypeAllowed(newParent, newChild)) {
-        return HierarchyRequestError;
+    if (newChild->isPseudoElement()) {
+        es.throwDOMException(HierarchyRequestError);
+        return false;
     }
 
-    return 0;
+    if (newChild->inDocument() && newChild->isDocumentTypeNode()) {
+        es.throwDOMException(HierarchyRequestError);
+        return false;
+    }
+    if (containsConsideringHostElements(newChild, newParent)) {
+        es.throwDOMException(HierarchyRequestError);
+        return false;
+    }
+
+    if (oldChild && newParent->isDocumentNode()) {
+        if (!toDocument(newParent)->canReplaceChild(newChild, oldChild)) {
+            es.throwDOMException(HierarchyRequestError);
+            return false;
+        }
+    } else if (!isChildTypeAllowed(newParent, newChild)) {
+        es.throwDOMException(HierarchyRequestError);
+        return false;
+    }
+
+    return true;
 }
 
-static inline bool checkAcceptChildGuaranteedNodeTypes(ContainerNode* newParent, Node* newChild, ExceptionCode& ec)
+static inline bool checkAcceptChildGuaranteedNodeTypes(ContainerNode* newParent, Node* newChild, ExceptionState& es)
 {
     ASSERT(!newParent->isDocumentTypeNode());
     ASSERT(isChildTypeAllowed(newParent, newChild));
     if (newChild->contains(newParent)) {
-        ec = HierarchyRequestError;
+        es.throwDOMException(HierarchyRequestError);
         return false;
     }
 
     return true;
 }
 
-static inline bool checkAddChild(ContainerNode* newParent, Node* newChild, ExceptionCode& ec)
+static inline bool checkAddChild(ContainerNode* newParent, Node* newChild, ExceptionState& es)
 {
-    ec = checkAcceptChild(newParent, newChild, 0);
-    if (ec)
-        return false;
-
-    return true;
+    return checkAcceptChild(newParent, newChild, 0, es);
 }
 
-static inline bool checkReplaceChild(ContainerNode* newParent, Node* newChild, Node* oldChild, ExceptionCode& ec)
+static inline bool checkReplaceChild(ContainerNode* newParent, Node* newChild, Node* oldChild, ExceptionState& es)
 {
-    ec = checkAcceptChild(newParent, newChild, oldChild);
-    if (ec)
-        return false;
-
-    return true;
+    return checkAcceptChild(newParent, newChild, oldChild, es);
 }
 
-void ContainerNode::insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode& ec, AttachBehavior attachBehavior)
+void ContainerNode::insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionState& es, AttachBehavior attachBehavior)
 {
     // Check that this node is not "floating".
     // If it is, it can be deleted as a side effect of sending mutation events.
@@ -218,21 +225,21 @@
 
     RefPtr<Node> protect(this);
 
-    ec = 0;
+    es.clearException();
 
     // insertBefore(node, 0) is equivalent to appendChild(node)
     if (!refChild) {
-        appendChild(newChild, ec, attachBehavior);
+        appendChild(newChild, es, attachBehavior);
         return;
     }
 
     // Make sure adding the new child is OK.
-    if (!checkAddChild(this, newChild.get(), ec))
+    if (!checkAddChild(this, newChild.get(), es))
         return;
 
     // NotFoundError: Raised if refChild is not a child of this node
     if (refChild->parentNode() != this) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
 
@@ -242,14 +249,14 @@
     RefPtr<Node> next = refChild;
 
     NodeVector targets;
-    collectChildrenAndRemoveFromOldParent(newChild.get(), targets, ec);
-    if (ec)
+    collectChildrenAndRemoveFromOldParent(newChild.get(), targets, es);
+    if (es.hadException())
         return;
     if (targets.isEmpty())
         return;
 
     // We need this extra check because collectChildrenAndRemoveFromOldParent() can fire mutation events.
-    if (!checkAcceptChildGuaranteedNodeTypes(this, newChild.get(), ec))
+    if (!checkAcceptChildGuaranteedNodeTypes(this, newChild.get(), es))
         return;
 
     InspectorInstrumentation::willInsertDOMNode(document(), this);
@@ -315,7 +322,7 @@
         return;
 
     if (document() != newChild->document())
-        document()->adoptNode(newChild.get(), ASSERT_NO_EXCEPTION);
+        document()->adoptNode(newChild.get(), ASSERT_NO_EXCEPTION_STATE);
 
     insertBeforeCommon(nextChild, newChild.get());
 
@@ -327,7 +334,7 @@
     ChildNodeInsertionNotifier(this).notify(newChild.get());
 }
 
-void ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode& ec, AttachBehavior attachBehavior)
+void ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionState& es, AttachBehavior attachBehavior)
 {
     // Check that this node is not "floating".
     // If it is, it can be deleted as a side effect of sending mutation events.
@@ -335,23 +342,23 @@
 
     RefPtr<Node> protect(this);
 
-    ec = 0;
+    es.clearException();
 
     if (oldChild == newChild) // nothing to do
         return;
 
     if (!oldChild) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
 
     // Make sure replacing the old child with the new is ok
-    if (!checkReplaceChild(this, newChild.get(), oldChild, ec))
+    if (!checkReplaceChild(this, newChild.get(), oldChild, es))
         return;
 
     // NotFoundError: Raised if oldChild is not a child of this node.
     if (oldChild->parentNode() != this) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
 
@@ -361,24 +368,24 @@
 
     // Remove the node we're replacing
     RefPtr<Node> removedChild = oldChild;
-    removeChild(oldChild, ec);
-    if (ec)
+    removeChild(oldChild, es);
+    if (es.hadException())
         return;
 
     if (next && (next->previousSibling() == newChild || next == newChild)) // nothing to do
         return;
 
     // Does this one more time because removeChild() fires a MutationEvent.
-    if (!checkReplaceChild(this, newChild.get(), oldChild, ec))
+    if (!checkReplaceChild(this, newChild.get(), oldChild, es))
         return;
 
     NodeVector targets;
-    collectChildrenAndRemoveFromOldParent(newChild.get(), targets, ec);
-    if (ec)
+    collectChildrenAndRemoveFromOldParent(newChild.get(), targets, es);
+    if (es.hadException())
         return;
 
     // Does this yet another check because collectChildrenAndRemoveFromOldParent() fires a MutationEvent.
-    if (!checkReplaceChild(this, newChild.get(), oldChild, ec))
+    if (!checkReplaceChild(this, newChild.get(), oldChild, es))
         return;
 
     InspectorInstrumentation::willInsertDOMNode(document(), this);
@@ -448,7 +455,7 @@
     ChildFrameDisconnector(this).disconnect();
 }
 
-void ContainerNode::removeChild(Node* oldChild, ExceptionCode& ec)
+void ContainerNode::removeChild(Node* oldChild, ExceptionState& es)
 {
     // Check that this node is not "floating".
     // If it is, it can be deleted as a side effect of sending mutation events.
@@ -456,11 +463,11 @@
 
     RefPtr<Node> protect(this);
 
-    ec = 0;
+    es.clearException();
 
     // NotFoundError: Raised if oldChild is not a child of this node.
     if (!oldChild || oldChild->parentNode() != this) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
 
@@ -474,7 +481,7 @@
     // Events fired when blurring currently focused node might have moved this
     // child into a different parent.
     if (child->parentNode() != this) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
 
@@ -482,7 +489,7 @@
 
     // Mutation events might have moved this child into a different parent.
     if (child->parentNode() != this) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
 
@@ -589,7 +596,7 @@
     dispatchSubtreeModifiedEvent();
 }
 
-void ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, AttachBehavior attachBehavior)
+void ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionState& es, AttachBehavior attachBehavior)
 {
     RefPtr<ContainerNode> protect(this);
 
@@ -597,25 +604,25 @@
     // If it is, it can be deleted as a side effect of sending mutation events.
     ASSERT(refCount() || parentOrShadowHostNode());
 
-    ec = 0;
+    es.clearException();
 
     // Make sure adding the new child is ok
-    if (!checkAddChild(this, newChild.get(), ec))
+    if (!checkAddChild(this, newChild.get(), es))
         return;
 
     if (newChild == m_lastChild) // nothing to do
         return;
 
     NodeVector targets;
-    collectChildrenAndRemoveFromOldParent(newChild.get(), targets, ec);
-    if (ec)
+    collectChildrenAndRemoveFromOldParent(newChild.get(), targets, es);
+    if (es.hadException())
         return;
 
     if (targets.isEmpty())
         return;
 
     // We need this extra check because collectChildrenAndRemoveFromOldParent() can fire mutation events.
-    if (!checkAcceptChildGuaranteedNodeTypes(this, newChild.get(), ec))
+    if (!checkAcceptChildGuaranteedNodeTypes(this, newChild.get(), es))
         return;
 
     InspectorInstrumentation::willInsertDOMNode(document(), this);
@@ -653,7 +660,7 @@
     ASSERT(!hasTagName(HTMLNames::templateTag));
 
     if (document() != newChild->document())
-        document()->adoptNode(newChild.get(), ASSERT_NO_EXCEPTION);
+        document()->adoptNode(newChild.get(), ASSERT_NO_EXCEPTION_STATE);
 
     Node* last = m_lastChild;
     {
@@ -733,9 +740,9 @@
 
 void ContainerNode::cloneChildNodes(ContainerNode *clone)
 {
-    ExceptionCode ec = 0;
-    for (Node* n = firstChild(); n && !ec; n = n->nextSibling())
-        clone->appendChild(n->cloneNode(true), ec);
+    TrackExceptionState es;
+    for (Node* n = firstChild(); n && !es.hadException(); n = n->nextSibling())
+        clone->appendChild(n->cloneNode(true), es);
 }
 
 
diff --git a/Source/core/dom/ContainerNode.h b/Source/core/dom/ContainerNode.h
index f7ea2e8..ef3862b 100644
--- a/Source/core/dom/ContainerNode.h
+++ b/Source/core/dom/ContainerNode.h
@@ -24,13 +24,14 @@
 #ifndef ContainerNode_h
 #define ContainerNode_h
 
-#include "core/dom/ExceptionCodePlaceholder.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Node.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/Vector.h"
 
 namespace WebCore {
 
+class ExceptionState;
 class FloatPoint;
 class HTMLCollection;
 
@@ -95,10 +96,10 @@
     unsigned childNodeCount() const;
     Node* childNode(unsigned index) const;
 
-    void insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode& = ASSERT_NO_EXCEPTION, AttachBehavior = AttachNow);
-    void replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode& = ASSERT_NO_EXCEPTION, AttachBehavior = AttachNow);
-    void removeChild(Node* child, ExceptionCode& = ASSERT_NO_EXCEPTION);
-    void appendChild(PassRefPtr<Node> newChild, ExceptionCode& = ASSERT_NO_EXCEPTION, AttachBehavior = AttachNow);
+    void insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionState& = ASSERT_NO_EXCEPTION_STATE, AttachBehavior = AttachNow);
+    void replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionState& = ASSERT_NO_EXCEPTION_STATE, AttachBehavior = AttachNow);
+    void removeChild(Node* child, ExceptionState& = ASSERT_NO_EXCEPTION_STATE);
+    void appendChild(PassRefPtr<Node> newChild, ExceptionState& = ASSERT_NO_EXCEPTION_STATE, AttachBehavior = AttachNow);
 
     // These methods are only used during parsing.
     // They don't send DOM mutation events or handle reparenting.
diff --git a/Source/core/dom/CustomElementRegistrationContext.cpp b/Source/core/dom/CustomElementRegistrationContext.cpp
index d37ba1e..1a7ea72 100644
--- a/Source/core/dom/CustomElementRegistrationContext.cpp
+++ b/Source/core/dom/CustomElementRegistrationContext.cpp
@@ -34,6 +34,7 @@
 #include "HTMLNames.h"
 #include "MathMLNames.h"
 #include "SVGNames.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/CustomElement.h"
 #include "core/dom/CustomElementDefinition.h"
 #include "core/dom/Element.h"
@@ -44,9 +45,9 @@
 
 namespace WebCore {
 
-void CustomElementRegistrationContext::registerElement(Document* document, CustomElementConstructorBuilder* constructorBuilder, const AtomicString& type, ExceptionCode& ec)
+void CustomElementRegistrationContext::registerElement(Document* document, CustomElementConstructorBuilder* constructorBuilder, const AtomicString& type, ExceptionState& es)
 {
-    CustomElementDefinition* definition = m_registry.registerElement(document, constructorBuilder, type, ec);
+    CustomElementDefinition* definition = m_registry.registerElement(document, constructorBuilder, type, es);
 
     if (!definition)
         return;
diff --git a/Source/core/dom/CustomElementRegistrationContext.h b/Source/core/dom/CustomElementRegistrationContext.h
index c8c2e15..f45f053 100644
--- a/Source/core/dom/CustomElementRegistrationContext.h
+++ b/Source/core/dom/CustomElementRegistrationContext.h
@@ -34,7 +34,6 @@
 #include "core/dom/CustomElementDescriptor.h"
 #include "core/dom/CustomElementRegistry.h"
 #include "core/dom/CustomElementUpgradeCandidateMap.h"
-#include "core/dom/ExceptionCode.h"
 #include "core/dom/QualifiedName.h"
 #include "wtf/HashMap.h"
 #include "wtf/PassRefPtr.h"
@@ -47,6 +46,7 @@
 class CustomElementDefinition;
 class Document;
 class Element;
+class ExceptionState;
 
 class CustomElementRegistrationContext : public RefCounted<CustomElementRegistrationContext> {
 public:
@@ -61,7 +61,7 @@
     static bool isCustomTagName(const AtomicString& localName);
 
     // Definitions
-    void registerElement(Document*, CustomElementConstructorBuilder*, const AtomicString& type, ExceptionCode&);
+    void registerElement(Document*, CustomElementConstructorBuilder*, const AtomicString& type, ExceptionState&);
 
     // Instance creation
     PassRefPtr<Element> createCustomTagElement(Document*, const QualifiedName&);
diff --git a/Source/core/dom/CustomElementRegistry.cpp b/Source/core/dom/CustomElementRegistry.cpp
index 5755cc3..ac55220 100644
--- a/Source/core/dom/CustomElementRegistry.cpp
+++ b/Source/core/dom/CustomElementRegistry.cpp
@@ -34,9 +34,11 @@
 #include "HTMLNames.h"
 #include "SVGNames.h"
 #include "bindings/v8/CustomElementConstructorBuilder.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/CustomElementDefinition.h"
 #include "core/dom/CustomElementRegistrationContext.h"
 #include "core/dom/DocumentLifecycleObserver.h"
+#include "core/dom/ExceptionCode.h"
 
 namespace WebCore {
 
@@ -56,7 +58,7 @@
     bool m_wentAway;
 };
 
-CustomElementDefinition* CustomElementRegistry::registerElement(Document* document, CustomElementConstructorBuilder* constructorBuilder, const AtomicString& userSuppliedName, ExceptionCode& ec)
+CustomElementDefinition* CustomElementRegistry::registerElement(Document* document, CustomElementConstructorBuilder* constructorBuilder, const AtomicString& userSuppliedName, ExceptionState& es)
 {
     // FIXME: In every instance except one it is the
     // CustomElementConstructorBuilder that observes document
@@ -65,30 +67,30 @@
     RegistrationContextObserver observer(document);
 
     if (!constructorBuilder->isFeatureAllowed()) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
     AtomicString type = userSuppliedName.lower();
     if (!CustomElementRegistrationContext::isValidTypeName(type)) {
-        ec = InvalidCharacterError;
+        es.throwDOMException(InvalidCharacterError);
         return 0;
     }
 
     if (!constructorBuilder->validateOptions()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
     QualifiedName tagName = nullQName();
     if (!constructorBuilder->findTagName(type, tagName)) {
-        ec = NamespaceError;
+        es.throwDOMException(NamespaceError);
         return 0;
     }
     ASSERT(tagName.namespaceURI() == HTMLNames::xhtmlNamespaceURI || tagName.namespaceURI() == SVGNames::svgNamespaceURI);
 
     if (m_registeredTypeNames.contains(type)) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
@@ -99,7 +101,7 @@
     // Consulting the constructor builder could execute script and
     // kill the document.
     if (observer.registrationContextWentAway()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
@@ -107,7 +109,7 @@
     RefPtr<CustomElementDefinition> definition = CustomElementDefinition::create(descriptor, lifecycleCallbacks);
 
     if (!constructorBuilder->createConstructor(document, definition.get())) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
@@ -115,7 +117,7 @@
     m_registeredTypeNames.add(descriptor.type());
 
     if (!constructorBuilder->didRegisterDefinition(definition.get())) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
diff --git a/Source/core/dom/CustomElementRegistry.h b/Source/core/dom/CustomElementRegistry.h
index 36477fe..c9ff8db 100644
--- a/Source/core/dom/CustomElementRegistry.h
+++ b/Source/core/dom/CustomElementRegistry.h
@@ -34,7 +34,6 @@
 #include "core/dom/CustomElementDefinition.h"
 #include "core/dom/CustomElementDescriptor.h"
 #include "core/dom/CustomElementDescriptorHash.h"
-#include "core/dom/ExceptionCode.h"
 #include "wtf/HashMap.h"
 #include "wtf/HashSet.h"
 #include "wtf/RefPtr.h"
@@ -45,6 +44,7 @@
 
 class CustomElementConstructorBuilder;
 class Document;
+class ExceptionState;
 
 class CustomElementRegistry {
     WTF_MAKE_NONCOPYABLE(CustomElementRegistry);
@@ -54,7 +54,7 @@
     CustomElementRegistry() { }
     virtual ~CustomElementRegistry() { }
 
-    CustomElementDefinition* registerElement(Document*, CustomElementConstructorBuilder*, const AtomicString& name, ExceptionCode&);
+    CustomElementDefinition* registerElement(Document*, CustomElementConstructorBuilder*, const AtomicString& name, ExceptionState&);
     CustomElementDefinition* find(const CustomElementDescriptor&) const;
 
 private:
diff --git a/Source/core/dom/DOMImplementation.cpp b/Source/core/dom/DOMImplementation.cpp
index d4b633c..14c51fe 100644
--- a/Source/core/dom/DOMImplementation.cpp
+++ b/Source/core/dom/DOMImplementation.cpp
@@ -27,6 +27,7 @@
 
 #include "HTMLNames.h"
 #include "SVGNames.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/css/CSSStyleSheet.h"
 #include "core/css/MediaList.h"
 #include "core/css/StyleSheetContents.h"
@@ -177,10 +178,10 @@
 }
 
 PassRefPtr<DocumentType> DOMImplementation::createDocumentType(const String& qualifiedName,
-    const String& publicId, const String& systemId, ExceptionCode& ec)
+    const String& publicId, const String& systemId, ExceptionState& es)
 {
     String prefix, localName;
-    if (!Document::parseQualifiedName(qualifiedName, prefix, localName, ec))
+    if (!Document::parseQualifiedName(qualifiedName, prefix, localName, es))
         return 0;
 
     return DocumentType::create(0, qualifiedName, publicId, systemId);
@@ -192,7 +193,7 @@
 }
 
 PassRefPtr<Document> DOMImplementation::createDocument(const String& namespaceURI,
-    const String& qualifiedName, DocumentType* doctype, ExceptionCode& ec)
+    const String& qualifiedName, DocumentType* doctype, ExceptionState& es)
 {
     RefPtr<Document> doc;
     if (namespaceURI == SVGNames::svgNamespaceURI)
@@ -207,8 +208,8 @@
 
     RefPtr<Node> documentElement;
     if (!qualifiedName.isEmpty()) {
-        documentElement = doc->createElementNS(namespaceURI, qualifiedName, ec);
-        if (ec)
+        documentElement = doc->createElementNS(namespaceURI, qualifiedName, es);
+        if (es.hadException())
             return 0;
     }
 
@@ -218,7 +219,7 @@
     // other exceptions to WrongDocumentError (based on order mentioned in spec),
     // but this matches the new DOM Core spec (http://www.w3.org/TR/domcore/).
     if (doctype && doctype->document()) {
-        ec = WrongDocumentError;
+        es.throwDOMException(WrongDocumentError);
         return 0;
     }
 
diff --git a/Source/core/dom/DOMImplementation.h b/Source/core/dom/DOMImplementation.h
index e09ff6e..153f4c4 100644
--- a/Source/core/dom/DOMImplementation.h
+++ b/Source/core/dom/DOMImplementation.h
@@ -33,12 +33,11 @@
 class CSSStyleSheet;
 class Document;
 class DocumentType;
+class ExceptionState;
 class Frame;
 class HTMLDocument;
 class KURL;
 
-typedef int ExceptionCode;
-
 class DOMImplementation : public ScriptWrappable {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -50,8 +49,8 @@
 
     // DOM methods & attributes for DOMImplementation
     static bool hasFeature(const String& feature, const String& version);
-    PassRefPtr<DocumentType> createDocumentType(const String& qualifiedName, const String& publicId, const String& systemId, ExceptionCode&);
-    PassRefPtr<Document> createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType*, ExceptionCode&);
+    PassRefPtr<DocumentType> createDocumentType(const String& qualifiedName, const String& publicId, const String& systemId, ExceptionState&);
+    PassRefPtr<Document> createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType*, ExceptionState&);
 
     DOMImplementation* getInterface(const String& feature);
 
diff --git a/Source/core/dom/DOMStringMap.cpp b/Source/core/dom/DOMStringMap.cpp
index 21415cd..f5f1f9d 100644
--- a/Source/core/dom/DOMStringMap.cpp
+++ b/Source/core/dom/DOMStringMap.cpp
@@ -32,7 +32,7 @@
 {
 }
 
-bool DOMStringMap::namedPropertyQuery(const AtomicString& name, ExceptionCode& ec)
+bool DOMStringMap::namedPropertyQuery(const AtomicString& name, ExceptionState&)
 {
     return contains(name);
 }
diff --git a/Source/core/dom/DOMStringMap.h b/Source/core/dom/DOMStringMap.h
index 3408945..1ded783 100644
--- a/Source/core/dom/DOMStringMap.h
+++ b/Source/core/dom/DOMStringMap.h
@@ -26,6 +26,7 @@
 #ifndef DOMStringMap_h
 #define DOMStringMap_h
 
+#include "bindings/v8/ExceptionState.h"
 #include "bindings/v8/ScriptWrappable.h"
 #include "wtf/Noncopyable.h"
 #include "wtf/Vector.h"
@@ -34,7 +35,6 @@
 namespace WebCore {
 
 class Element;
-typedef int ExceptionCode;
 
 class DOMStringMap : public ScriptWrappable {
     WTF_MAKE_NONCOPYABLE(DOMStringMap); WTF_MAKE_FAST_ALLOCATED;
@@ -47,29 +47,29 @@
     virtual void getNames(Vector<String>&) = 0;
     virtual String item(const String& name) = 0;
     virtual bool contains(const String& name) = 0;
-    virtual void setItem(const String& name, const String& value, ExceptionCode&) = 0;
-    virtual void deleteItem(const String& name, ExceptionCode&) = 0;
-    bool anonymousNamedSetter(const String& name, const String& value, ExceptionCode& ec)
+    virtual void setItem(const String& name, const String& value, ExceptionState&) = 0;
+    virtual void deleteItem(const String& name, ExceptionState&) = 0;
+    bool anonymousNamedSetter(const String& name, const String& value, ExceptionState& es)
     {
-        setItem(name, value, ec);
+        setItem(name, value, es);
         return true;
     }
-    bool anonymousNamedDeleter(const AtomicString& name, ExceptionCode& ec)
+    bool anonymousNamedDeleter(const AtomicString& name, ExceptionState& es)
     {
-        deleteItem(name, ec);
-        bool result = !ec;
+        deleteItem(name, es);
+        bool result = !es.hadException();
         // DOMStringMap deleter should ignore exception.
         // Behavior of Firefox and Opera are same.
         // delete document.body.dataset["-foo"] // false instead of DOM Exception 12
         // LayoutTests/fast/dom/HTMLSelectElement/select-selectedIndex-multiple.html
-        ec = 0;
+        es.clearException();
         return result;
     }
-    void namedPropertyEnumerator(Vector<String>& names, ExceptionCode&)
+    void namedPropertyEnumerator(Vector<String>& names, ExceptionState&)
     {
         getNames(names);
     }
-    bool namedPropertyQuery(const AtomicString&, ExceptionCode&);
+    bool namedPropertyQuery(const AtomicString&, ExceptionState&);
 
     virtual Element* element() = 0;
 
diff --git a/Source/core/dom/DataTransferItemList.h b/Source/core/dom/DataTransferItemList.h
index 4e9c6d6..91fd967 100644
--- a/Source/core/dom/DataTransferItemList.h
+++ b/Source/core/dom/DataTransferItemList.h
@@ -41,7 +41,7 @@
 class Clipboard;
 class File;
 
-typedef int ExceptionCode;
+class ExceptionState;
 
 class DataTransferItemList : public RefCounted<DataTransferItemList>, public ScriptWrappable {
 public:
@@ -54,9 +54,9 @@
 
     virtual size_t length() const = 0;
     virtual PassRefPtr<DataTransferItem> item(unsigned long index) = 0;
-    virtual void deleteItem(unsigned long index, ExceptionCode&) = 0;
+    virtual void deleteItem(unsigned long index, ExceptionState&) = 0;
     virtual void clear() = 0;
-    virtual void add(const String& data, const String& type, ExceptionCode&) = 0;
+    virtual void add(const String& data, const String& type, ExceptionState&) = 0;
     virtual void add(PassRefPtr<File>) = 0;
 };
 
diff --git a/Source/core/dom/DatasetDOMStringMap.cpp b/Source/core/dom/DatasetDOMStringMap.cpp
index 10e9b40..fbeaa54 100644
--- a/Source/core/dom/DatasetDOMStringMap.cpp
+++ b/Source/core/dom/DatasetDOMStringMap.cpp
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "core/dom/DatasetDOMStringMap.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/Attribute.h"
 #include "core/dom/Element.h"
 #include "core/dom/ExceptionCode.h"
@@ -176,20 +177,20 @@
     return false;
 }
 
-void DatasetDOMStringMap::setItem(const String& name, const String& value, ExceptionCode& ec)
+void DatasetDOMStringMap::setItem(const String& name, const String& value, ExceptionState& es)
 {
     if (!isValidPropertyName(name)) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return;
     }
 
-    m_element->setAttribute(convertPropertyNameToAttributeName(name), value, ec);
+    m_element->setAttribute(convertPropertyNameToAttributeName(name), value, es);
 }
 
-void DatasetDOMStringMap::deleteItem(const String& name, ExceptionCode& ec)
+void DatasetDOMStringMap::deleteItem(const String& name, ExceptionState& es)
 {
     if (!isValidPropertyName(name)) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return;
     }
 
diff --git a/Source/core/dom/DatasetDOMStringMap.h b/Source/core/dom/DatasetDOMStringMap.h
index c716181..9bbd1d0 100644
--- a/Source/core/dom/DatasetDOMStringMap.h
+++ b/Source/core/dom/DatasetDOMStringMap.h
@@ -32,6 +32,7 @@
 namespace WebCore {
 
 class Element;
+class ExceptionState;
 
 class DatasetDOMStringMap : public DOMStringMap {
 public:
@@ -46,8 +47,8 @@
     virtual void getNames(Vector<String>&);
     virtual String item(const String& name);
     virtual bool contains(const String& name);
-    virtual void setItem(const String& name, const String& value, ExceptionCode&);
-    virtual void deleteItem(const String& name, ExceptionCode&);
+    virtual void setItem(const String& name, const String& value, ExceptionState&);
+    virtual void deleteItem(const String& name, ExceptionState&);
 
     virtual Element* element() { return m_element; }
 
diff --git a/Source/core/dom/DecodedDataDocumentParser.cpp b/Source/core/dom/DecodedDataDocumentParser.cpp
index 610d44e..462051c 100644
--- a/Source/core/dom/DecodedDataDocumentParser.cpp
+++ b/Source/core/dom/DecodedDataDocumentParser.cpp
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "core/dom/DecodedDataDocumentParser.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
 #include "core/loader/TextResourceDecoder.h"
@@ -74,7 +75,7 @@
     CString originalBytes = titleElement->textContent().latin1();
     OwnPtr<TextCodec> codec = newTextCodec(m_document->decoder()->encoding());
     String correctlyDecodedTitle = codec->decode(originalBytes.data(), originalBytes.length(), true);
-    titleElement->setTextContent(correctlyDecodedTitle, IGNORE_EXCEPTION);
+    titleElement->setTextContent(correctlyDecodedTitle, IGNORE_EXCEPTION_STATE);
 }
 
 }
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index ad152ed..a912fc8 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -37,6 +37,8 @@
 #include "XMLNames.h"
 #include "bindings/v8/CustomElementConstructorBuilder.h"
 #include "bindings/v8/Dictionary.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "bindings/v8/ScriptController.h"
 #include "core/accessibility/AXObjectCache.h"
 #include "core/animation/DocumentTimeline.h"
@@ -68,7 +70,6 @@
 #include "core/dom/EventListener.h"
 #include "core/dom/EventNames.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/HashChangeEvent.h"
 #include "core/dom/NamedFlowCollection.h"
 #include "core/dom/NodeFilter.h"
@@ -690,10 +691,10 @@
     clearStyleResolver();
 }
 
-PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionCode& ec)
+PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionState& es)
 {
     if (!isValidName(name)) {
-        ec = InvalidCharacterError;
+        es.throwDOMException(InvalidCharacterError);
         return 0;
     }
 
@@ -703,10 +704,10 @@
     return createElement(QualifiedName(nullAtom, name, nullAtom), false);
 }
 
-PassRefPtr<Element> Document::createElement(const AtomicString& localName, const AtomicString& typeExtension, ExceptionCode& ec)
+PassRefPtr<Element> Document::createElement(const AtomicString& localName, const AtomicString& typeExtension, ExceptionState& es)
 {
     if (!isValidName(localName)) {
-        ec = InvalidCharacterError;
+        es.throwDOMException(InvalidCharacterError);
         return 0;
     }
 
@@ -715,7 +716,7 @@
     if (CustomElementRegistrationContext::isCustomTagName(localName) && registrationContext())
         element = registrationContext()->createCustomTagElement(this, QualifiedName(nullAtom, localName, xhtmlNamespaceURI));
     else
-        element = createElement(localName, ec);
+        element = createElement(localName, es);
 
     if (!typeExtension.isNull() && !typeExtension.isEmpty())
         CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element.get(), typeExtension);
@@ -723,15 +724,15 @@
     return element;
 }
 
-PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI, const String& qualifiedName, const AtomicString& typeExtension, ExceptionCode& ec)
+PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI, const String& qualifiedName, const AtomicString& typeExtension, ExceptionState& es)
 {
     String prefix, localName;
-    if (!parseQualifiedName(qualifiedName, prefix, localName, ec))
+    if (!parseQualifiedName(qualifiedName, prefix, localName, es))
         return 0;
 
     QualifiedName qName(prefix, localName, namespaceURI);
     if (!hasValidNamespaceForElements(qName)) {
-        ec = NamespaceError;
+        es.throwDOMException(NamespaceError);
         return 0;
     }
 
@@ -739,7 +740,7 @@
     if (CustomElementRegistrationContext::isCustomTagName(qName.localName()) && registrationContext())
         element = registrationContext()->createCustomTagElement(this, qName);
     else
-        element = createElementNS(namespaceURI, qualifiedName, ec);
+        element = createElementNS(namespaceURI, qualifiedName, es);
 
     if (!typeExtension.isNull() && !typeExtension.isEmpty())
         CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element.get(), typeExtension);
@@ -747,20 +748,20 @@
     return element;
 }
 
-ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicString& name, ExceptionCode& ec)
+ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicString& name, ExceptionState& es)
 {
-    return registerElement(state, name, Dictionary(), ec);
+    return registerElement(state, name, Dictionary(), es);
 }
 
-ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicString& name, const Dictionary& options, ExceptionCode& ec)
+ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicString& name, const Dictionary& options, ExceptionState& es)
 {
     if (!registrationContext()) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return ScriptValue();
     }
 
     CustomElementConstructorBuilder constructorBuilder(state, &options);
-    registrationContext()->registerElement(this, &constructorBuilder, name, ec);
+    registrationContext()->registerElement(this, &constructorBuilder, name, es);
     return constructorBuilder.bindingsReturnValue();
 }
 
@@ -795,23 +796,23 @@
     return Comment::create(this, data);
 }
 
-PassRefPtr<CDATASection> Document::createCDATASection(const String& data, ExceptionCode& ec)
+PassRefPtr<CDATASection> Document::createCDATASection(const String& data, ExceptionState& es)
 {
     if (isHTMLDocument()) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
     return CDATASection::create(this, data);
 }
 
-PassRefPtr<ProcessingInstruction> Document::createProcessingInstruction(const String& target, const String& data, ExceptionCode& ec)
+PassRefPtr<ProcessingInstruction> Document::createProcessingInstruction(const String& target, const String& data, ExceptionState& es)
 {
     if (!isValidName(target)) {
-        ec = InvalidCharacterError;
+        es.throwDOMException(InvalidCharacterError);
         return 0;
     }
     if (isHTMLDocument()) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
     return ProcessingInstruction::create(this, target, data);
@@ -827,12 +828,12 @@
     return MutableStylePropertySet::create()->ensureCSSStyleDeclaration();
 }
 
-PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionCode& ec)
+PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionState& es)
 {
-    ec = 0;
+    es.clearException();
 
     if (!importedNode) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
@@ -840,9 +841,9 @@
     case TEXT_NODE:
         return createTextNode(importedNode->nodeValue());
     case CDATA_SECTION_NODE:
-        return createCDATASection(importedNode->nodeValue(), ec);
+        return createCDATASection(importedNode->nodeValue(), es);
     case PROCESSING_INSTRUCTION_NODE:
-        return createProcessingInstruction(importedNode->nodeName(), importedNode->nodeValue(), ec);
+        return createProcessingInstruction(importedNode->nodeName(), importedNode->nodeValue(), es);
     case COMMENT_NODE:
         return createComment(importedNode->nodeValue());
     case ELEMENT_NODE: {
@@ -850,7 +851,7 @@
         // FIXME: The following check might be unnecessary. Is it possible that
         // oldElement has mismatched prefix/namespace?
         if (!hasValidNamespaceForElements(oldElement->tagQName())) {
-            ec = NamespaceError;
+            es.throwDOMException(NamespaceError);
             return 0;
         }
         RefPtr<Element> newElement = createElement(oldElement->tagQName(), false);
@@ -859,11 +860,11 @@
 
         if (deep) {
             for (Node* oldChild = oldElement->firstChild(); oldChild; oldChild = oldChild->nextSibling()) {
-                RefPtr<Node> newChild = importNode(oldChild, true, ec);
-                if (ec)
+                RefPtr<Node> newChild = importNode(oldChild, true, es);
+                if (es.hadException())
                     return 0;
-                newElement->appendChild(newChild.release(), ec);
-                if (ec)
+                newElement->appendChild(newChild.release(), es);
+                if (es.hadException())
                     return 0;
             }
         }
@@ -882,11 +883,11 @@
         RefPtr<DocumentFragment> newFragment = createDocumentFragment();
         if (deep) {
             for (Node* oldChild = oldFragment->firstChild(); oldChild; oldChild = oldChild->nextSibling()) {
-                RefPtr<Node> newChild = importNode(oldChild, true, ec);
-                if (ec)
+                RefPtr<Node> newChild = importNode(oldChild, true, es);
+                if (es.hadException())
                     return 0;
-                newFragment->appendChild(newChild.release(), ec);
-                if (ec)
+                newFragment->appendChild(newChild.release(), es);
+                if (es.hadException())
                     return 0;
             }
         }
@@ -902,14 +903,14 @@
     case XPATH_NAMESPACE_NODE:
         break;
     }
-    ec = NotSupportedError;
+    es.throwDOMException(NotSupportedError);
     return 0;
 }
 
-PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionCode& ec)
+PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionState& es)
 {
     if (!source) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
@@ -921,32 +922,32 @@
     case DOCUMENT_NODE:
     case DOCUMENT_TYPE_NODE:
     case XPATH_NAMESPACE_NODE:
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     case ATTRIBUTE_NODE: {
         Attr* attr = toAttr(source.get());
         if (attr->ownerElement())
-            attr->ownerElement()->removeAttributeNode(attr, ec);
+            attr->ownerElement()->removeAttributeNode(attr, es);
         attr->setSpecified(true);
         break;
     }
     default:
         if (source->isShadowRoot()) {
             // ShadowRoot cannot disconnect itself from the host node.
-            ec = HierarchyRequestError;
+            es.throwDOMException(HierarchyRequestError);
             return 0;
         }
 
         if (source->isFrameOwnerElement()) {
             HTMLFrameOwnerElement* frameOwnerElement = toFrameOwnerElement(source.get());
             if (frame() && frame()->tree()->isDescendantOf(frameOwnerElement->contentFrame())) {
-                ec = HierarchyRequestError;
+                es.throwDOMException(HierarchyRequestError);
                 return 0;
             }
         }
         if (source->parentNode()) {
-            source->parentNode()->removeChild(source.get(), ec);
-            if (ec)
+            source->parentNode()->removeChild(source.get(), es);
+            if (es.hadException())
                 return 0;
         }
     }
@@ -1040,15 +1041,15 @@
     return m_namedFlows.get();
 }
 
-PassRefPtr<Element> Document::createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode& ec)
+PassRefPtr<Element> Document::createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionState& es)
 {
     String prefix, localName;
-    if (!parseQualifiedName(qualifiedName, prefix, localName, ec))
+    if (!parseQualifiedName(qualifiedName, prefix, localName, es))
         return 0;
 
     QualifiedName qName(prefix, localName, namespaceURI);
     if (!hasValidNamespaceForElements(qName)) {
-        ec = NamespaceError;
+        es.throwDOMException(NamespaceError);
         return 0;
     }
 
@@ -1132,25 +1133,25 @@
     setNeedsStyleRecalc();
 }
 
-void Document::setXMLVersion(const String& version, ExceptionCode& ec)
+void Document::setXMLVersion(const String& version, ExceptionState& es)
 {
     if (!implementation()->hasFeature("XML", String())) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
 
     if (!XMLDocumentParser::supportsXMLVersion(version)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
 
     m_xmlVersion = version;
 }
 
-void Document::setXMLStandalone(bool standalone, ExceptionCode& ec)
+void Document::setXMLStandalone(bool standalone, ExceptionState& es)
 {
     if (!implementation()->hasFeature("XML", String())) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
 
@@ -1313,7 +1314,7 @@
     else if (!m_titleElement) {
         if (HTMLElement* headElement = head()) {
             m_titleElement = createElement(titleTag, false);
-            headElement->appendChild(m_titleElement, ASSERT_NO_EXCEPTION, AttachLazily);
+            headElement->appendChild(m_titleElement, ASSERT_NO_EXCEPTION_STATE, AttachLazily);
         }
     }
 
@@ -1446,20 +1447,20 @@
     return Range::create(this);
 }
 
-PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, ExceptionCode& ec)
+PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, ExceptionState& es)
 {
     // FIXME: Probably this should be handled within the bindings layer and TypeError should be thrown.
     if (!root) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
     return NodeIterator::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilter>());
 }
 
-PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, ExceptionCode& ec)
+PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, ExceptionState& es)
 {
     if (!root) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
     // FIXME: It might be a good idea to emit a warning if |whatToShow| contains a bit that is not defined in
@@ -1467,20 +1468,20 @@
     return NodeIterator::create(root, whatToShow, PassRefPtr<NodeFilter>());
 }
 
-PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter> filter, ExceptionCode& ec)
+PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter> filter, ExceptionState& es)
 {
     if (!root) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
     // FIXME: Ditto.
     return NodeIterator::create(root, whatToShow, filter);
 }
 
-PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences, ExceptionCode& ec)
+PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences, ExceptionState& es)
 {
     if (!root) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
     // FIXME: Warn if |expandEntityReferences| is specified. This optional argument is deprecated in DOM4.
@@ -1488,38 +1489,38 @@
     return NodeIterator::create(root, whatToShow, filter);
 }
 
-PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, ExceptionCode& ec)
+PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, ExceptionState& es)
 {
     if (!root) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
     return TreeWalker::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilter>());
 }
 
-PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToShow, ExceptionCode& ec)
+PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToShow, ExceptionState& es)
 {
     if (!root) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
     return TreeWalker::create(root, whatToShow, PassRefPtr<NodeFilter>());
 }
 
-PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter> filter, ExceptionCode& ec)
+PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter> filter, ExceptionState& es)
 {
     if (!root) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
     return TreeWalker::create(root, whatToShow, filter);
 }
 
-PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences, ExceptionCode& ec)
+PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences, ExceptionState& es)
 {
     UNUSED_PARAM(expandEntityReferences);
     if (!root) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
     return TreeWalker::create(root, whatToShow, filter);
@@ -1557,7 +1558,7 @@
 
 bool Document::hasPendingForcedStyleRecalc() const
 {
-    return hasPendingStyleRecalc() && styleChangeType() == SubtreeStyleChange;
+    return hasPendingStyleRecalc() && styleChangeType() >= SubtreeStyleChange;
 }
 
 void Document::styleRecalcTimerFired(Timer<Document>*)
@@ -1632,7 +1633,7 @@
         if (!renderer())
             goto bailOut;
 
-        if (styleChangeType() == SubtreeStyleChange)
+        if (styleChangeType() >= SubtreeStyleChange)
             change = Force;
 
         // Recalculating the root style (on the document) is not needed in the common case.
@@ -2141,17 +2142,17 @@
     return 0;
 }
 
-void Document::setBody(PassRefPtr<HTMLElement> prpNewBody, ExceptionCode& ec)
+void Document::setBody(PassRefPtr<HTMLElement> prpNewBody, ExceptionState& es)
 {
     RefPtr<HTMLElement> newBody = prpNewBody;
 
     if (!newBody || !documentElement()) {
-        ec = HierarchyRequestError;
+        es.throwDOMException(HierarchyRequestError);
         return;
     }
 
     if (!newBody->hasTagName(bodyTag) && !newBody->hasTagName(framesetTag)) {
-        ec = HierarchyRequestError;
+        es.throwDOMException(HierarchyRequestError);
         return;
     }
 
@@ -2160,9 +2161,9 @@
         return;
 
     if (oldBody)
-        documentElement()->replaceChild(newBody.release(), oldBody, ec, AttachLazily);
+        documentElement()->replaceChild(newBody.release(), oldBody, es, AttachLazily);
     else
-        documentElement()->appendChild(newBody.release(), ec, AttachLazily);
+        documentElement()->appendChild(newBody.release(), es, AttachLazily);
 }
 
 HTMLHeadElement* Document::head()
@@ -2722,7 +2723,7 @@
         return;
 
     // Exception (for sandboxed documents) ignored.
-    toHTMLDocument(this)->setCookie(content, IGNORE_EXCEPTION);
+    toHTMLDocument(this)->setCookie(content, IGNORE_EXCEPTION_STATE);
 }
 
 void Document::processHttpEquivXFrameOptions(const String& content)
@@ -3471,13 +3472,13 @@
     m_eventQueue->enqueueEvent(event);
 }
 
-PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionCode& ec)
+PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionState& es)
 {
     RefPtr<Event> event = EventFactory::create(eventType);
     if (event)
         return event.release();
 
-    ec = NotSupportedError;
+    es.throwDOMException(NotSupportedError);
     return 0;
 }
 
@@ -3539,7 +3540,7 @@
     return frame()->ownerElement();
 }
 
-String Document::cookie(ExceptionCode& ec) const
+String Document::cookie(ExceptionState& es) const
 {
     if (page() && !page()->settings()->cookieEnabled())
         return String();
@@ -3549,7 +3550,7 @@
     // browsing context.
 
     if (!securityOrigin()->canAccessCookies()) {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return String();
     }
 
@@ -3560,7 +3561,7 @@
     return cookies(this, cookieURL);
 }
 
-void Document::setCookie(const String& value, ExceptionCode& ec)
+void Document::setCookie(const String& value, ExceptionState& es)
 {
     if (page() && !page()->settings()->cookieEnabled())
         return;
@@ -3570,7 +3571,7 @@
     // browsing context.
 
     if (!securityOrigin()->canAccessCookies()) {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return;
     }
 
@@ -3593,10 +3594,10 @@
     return securityOrigin()->domain();
 }
 
-void Document::setDomain(const String& newDomain, ExceptionCode& ec)
+void Document::setDomain(const String& newDomain, ExceptionState& es)
 {
     if (SchemeRegistry::isDomainRelaxationForbiddenForURLScheme(securityOrigin()->protocol())) {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return;
     }
 
@@ -3622,14 +3623,14 @@
     int newLength = newDomain.length();
     // e.g. newDomain = webkit.org (10) and domain() = www.webkit.org (14)
     if (newLength >= oldLength) {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return;
     }
 
     String test = domain();
     // Check that it's a subdomain, not e.g. "ebkit.org"
     if (test[oldLength - newLength - 1] != '.') {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return;
     }
 
@@ -3637,7 +3638,7 @@
     // and we check that it's the same thing as newDomain
     test.remove(0, oldLength - newLength);
     if (test != newDomain) {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return;
     }
 
@@ -3744,7 +3745,7 @@
 }
 
 template<typename CharType>
-static bool parseQualifiedNameInternal(const String& qualifiedName, const CharType* characters, unsigned length, String& prefix, String& localName, ExceptionCode& ec)
+static bool parseQualifiedNameInternal(const String& qualifiedName, const CharType* characters, unsigned length, String& prefix, String& localName, ExceptionState& es)
 {
     bool nameStart = true;
     bool sawColon = false;
@@ -3755,7 +3756,7 @@
         U16_NEXT(characters, i, length, c)
         if (c == ':') {
             if (sawColon) {
-                ec = NamespaceError;
+                es.throwDOMException(NamespaceError);
                 return false; // multiple colons: not allowed
             }
             nameStart = true;
@@ -3763,13 +3764,13 @@
             colonPos = i - 1;
         } else if (nameStart) {
             if (!isValidNameStart(c)) {
-                ec = InvalidCharacterError;
+                es.throwDOMException(InvalidCharacterError);
                 return false;
             }
             nameStart = false;
         } else {
             if (!isValidNamePart(c)) {
-                ec = InvalidCharacterError;
+                es.throwDOMException(InvalidCharacterError);
                 return false;
             }
         }
@@ -3781,32 +3782,32 @@
     } else {
         prefix = qualifiedName.substring(0, colonPos);
         if (prefix.isEmpty()) {
-            ec = NamespaceError;
+            es.throwDOMException(NamespaceError);
             return false;
         }
         localName = qualifiedName.substring(colonPos + 1);
     }
 
     if (localName.isEmpty()) {
-        ec = NamespaceError;
+        es.throwDOMException(NamespaceError);
         return false;
     }
 
     return true;
 }
 
-bool Document::parseQualifiedName(const String& qualifiedName, String& prefix, String& localName, ExceptionCode& ec)
+bool Document::parseQualifiedName(const String& qualifiedName, String& prefix, String& localName, ExceptionState& es)
 {
     unsigned length = qualifiedName.length();
 
     if (!length) {
-        ec = InvalidCharacterError;
+        es.throwDOMException(InvalidCharacterError);
         return false;
     }
 
     if (qualifiedName.is8Bit())
-        return parseQualifiedNameInternal(qualifiedName, qualifiedName.characters8(), length, prefix, localName, ec);
-    return parseQualifiedNameInternal(qualifiedName, qualifiedName.characters16(), length, prefix, localName, ec);
+        return parseQualifiedNameInternal(qualifiedName, qualifiedName.characters8(), length, prefix, localName, es);
+    return parseQualifiedNameInternal(qualifiedName, qualifiedName.characters16(), length, prefix, localName, es);
 }
 
 void Document::setDecoder(PassRefPtr<TextResourceDecoder> decoder)
@@ -3988,21 +3989,21 @@
     return doc;
 }
 
-PassRefPtr<Attr> Document::createAttribute(const String& name, ExceptionCode& ec)
+PassRefPtr<Attr> Document::createAttribute(const String& name, ExceptionState& es)
 {
-    return createAttributeNS(String(), name, ec, true);
+    return createAttributeNS(String(), name, es, true);
 }
 
-PassRefPtr<Attr> Document::createAttributeNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode& ec, bool shouldIgnoreNamespaceChecks)
+PassRefPtr<Attr> Document::createAttributeNS(const String& namespaceURI, const String& qualifiedName, ExceptionState& es, bool shouldIgnoreNamespaceChecks)
 {
     String prefix, localName;
-    if (!parseQualifiedName(qualifiedName, prefix, localName, ec))
+    if (!parseQualifiedName(qualifiedName, prefix, localName, es))
         return 0;
 
     QualifiedName qName(prefix, localName, namespaceURI);
 
     if (!shouldIgnoreNamespaceChecks && !hasValidNamespaceForAttributes(qName)) {
-        ec = NamespaceError;
+        es.throwDOMException(NamespaceError);
         return 0;
     }
 
@@ -4085,12 +4086,12 @@
 
 PassRefPtr<HTMLCollection> Document::windowNamedItems(const AtomicString& name)
 {
-    return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<WindowNameCollection>(this, WindowNamedItems, name);
+    return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<HTMLNameCollection>(this, WindowNamedItems, name);
 }
 
 PassRefPtr<HTMLCollection> Document::documentNamedItems(const AtomicString& name)
 {
-    return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<DocumentNameCollection>(this, DocumentNamedItems, name);
+    return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<HTMLNameCollection>(this, DocumentNamedItems, name);
 }
 
 void Document::finishedParsing()
diff --git a/Source/core/dom/Document.h b/Source/core/dom/Document.h
index f9eb213..4d3ba07 100644
--- a/Source/core/dom/Document.h
+++ b/Source/core/dom/Document.h
@@ -64,7 +64,6 @@
 class CSSStyleDeclaration;
 class CSSStyleSheet;
 class CachedCSSStyleSheet;
-class ResourceFetcher;
 class CachedScript;
 class CanvasRenderingContext;
 class CharacterData;
@@ -77,6 +76,7 @@
 class DOMSecurityPolicy;
 class DOMSelection;
 class DOMWindow;
+class DOMWrapperWorld;
 class Database;
 class DatabaseThread;
 class DocumentFragment;
@@ -92,31 +92,31 @@
 class Element;
 class Event;
 class EventListener;
-class FloatRect;
+class ExceptionState;
 class FloatQuad;
+class FloatRect;
 class FormController;
 class Frame;
 class FrameView;
+class HTMLAllCollection;
 class HTMLCanvasElement;
 class HTMLCollection;
-class HTMLAllCollection;
 class HTMLDocument;
 class HTMLElement;
 class HTMLFrameOwnerElement;
 class HTMLHeadElement;
-class HTMLImport;
 class HTMLIFrameElement;
+class HTMLImport;
 class HTMLMapElement;
 class HTMLNameCollection;
 class HTMLScriptElement;
 class HitTestRequest;
 class HitTestResult;
 class IntPoint;
+class JSNode;
 class LayoutPoint;
 class LayoutRect;
 class LiveNodeListBase;
-class DOMWrapperWorld;
-class JSNode;
 class Locale;
 class MediaQueryList;
 class MediaQueryMatcher;
@@ -132,6 +132,7 @@
 class RegisteredEventListener;
 class RenderView;
 class RequestAnimationFrameCallback;
+class ResourceFetcher;
 class SVGDocumentExtensions;
 class ScriptElementData;
 class ScriptRunner;
@@ -307,17 +308,17 @@
 
     bool hasManifest() const;
 
-    PassRefPtr<Element> createElement(const AtomicString& name, ExceptionCode&);
+    PassRefPtr<Element> createElement(const AtomicString& name, ExceptionState&);
     PassRefPtr<DocumentFragment> createDocumentFragment();
     PassRefPtr<Text> createTextNode(const String& data);
     PassRefPtr<Comment> createComment(const String& data);
-    PassRefPtr<CDATASection> createCDATASection(const String& data, ExceptionCode&);
-    PassRefPtr<ProcessingInstruction> createProcessingInstruction(const String& target, const String& data, ExceptionCode&);
-    PassRefPtr<Attr> createAttribute(const String& name, ExceptionCode&);
-    PassRefPtr<Attr> createAttributeNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&, bool shouldIgnoreNamespaceChecks = false);
-    PassRefPtr<Node> importNode(Node* importedNode, ExceptionCode& ec) { return importNode(importedNode, true, ec); }
-    PassRefPtr<Node> importNode(Node* importedNode, bool deep, ExceptionCode&);
-    PassRefPtr<Element> createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&);
+    PassRefPtr<CDATASection> createCDATASection(const String& data, ExceptionState&);
+    PassRefPtr<ProcessingInstruction> createProcessingInstruction(const String& target, const String& data, ExceptionState&);
+    PassRefPtr<Attr> createAttribute(const String& name, ExceptionState&);
+    PassRefPtr<Attr> createAttributeNS(const String& namespaceURI, const String& qualifiedName, ExceptionState&, bool shouldIgnoreNamespaceChecks = false);
+    PassRefPtr<Node> importNode(Node* importedNode, ExceptionState& ec) { return importNode(importedNode, true, ec); }
+    PassRefPtr<Node> importNode(Node* importedNode, bool deep, ExceptionState&);
+    PassRefPtr<Element> createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionState&);
     PassRefPtr<Element> createElement(const QualifiedName&, bool createdByParser);
 
     bool cssStickyPositionEnabled() const;
@@ -372,8 +373,8 @@
     bool hasXMLDeclaration() const { return m_hasXMLDeclaration; }
 
     void setXMLEncoding(const String& encoding) { m_xmlEncoding = encoding; } // read-only property, only to be set from XMLDocumentParser
-    void setXMLVersion(const String&, ExceptionCode&);
-    void setXMLStandalone(bool, ExceptionCode&);
+    void setXMLVersion(const String&, ExceptionState&);
+    void setXMLStandalone(bool, ExceptionState&);
     void setHasXMLDeclaration(bool hasXMLDeclaration) { m_hasXMLDeclaration = hasXMLDeclaration ? 1 : 0; }
 
     String documentURI() const { return m_documentURI; }
@@ -386,7 +387,7 @@
 
     DOMSecurityPolicy* securityPolicy();
 
-    PassRefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionCode&);
+    PassRefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionState&);
 
     PassRefPtr<HTMLCollection> images();
     PassRefPtr<HTMLCollection> embeds();
@@ -467,15 +468,15 @@
 
     PassRefPtr<Range> createRange();
 
-    PassRefPtr<NodeIterator> createNodeIterator(Node* root, ExceptionCode&);
-    PassRefPtr<NodeIterator> createNodeIterator(Node* root, unsigned whatToShow, ExceptionCode&);
-    PassRefPtr<NodeIterator> createNodeIterator(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter>, ExceptionCode&);
-    PassRefPtr<NodeIterator> createNodeIterator(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter>, bool expandEntityReferences, ExceptionCode&);
+    PassRefPtr<NodeIterator> createNodeIterator(Node* root, ExceptionState&);
+    PassRefPtr<NodeIterator> createNodeIterator(Node* root, unsigned whatToShow, ExceptionState&);
+    PassRefPtr<NodeIterator> createNodeIterator(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter>, ExceptionState&);
+    PassRefPtr<NodeIterator> createNodeIterator(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter>, bool expandEntityReferences, ExceptionState&);
 
-    PassRefPtr<TreeWalker> createTreeWalker(Node* root, ExceptionCode&);
-    PassRefPtr<TreeWalker> createTreeWalker(Node* root, unsigned whatToShow, ExceptionCode&);
-    PassRefPtr<TreeWalker> createTreeWalker(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter>, ExceptionCode&);
-    PassRefPtr<TreeWalker> createTreeWalker(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter>, bool expandEntityReferences, ExceptionCode&);
+    PassRefPtr<TreeWalker> createTreeWalker(Node* root, ExceptionState&);
+    PassRefPtr<TreeWalker> createTreeWalker(Node* root, unsigned whatToShow, ExceptionState&);
+    PassRefPtr<TreeWalker> createTreeWalker(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter>, ExceptionState&);
+    PassRefPtr<TreeWalker> createTreeWalker(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter>, bool expandEntityReferences, ExceptionState&);
 
     // Special support for editing
     PassRefPtr<CSSStyleDeclaration> createCSSStyleDeclaration();
@@ -695,7 +696,7 @@
     EventListener* getWindowAttributeEventListener(const AtomicString& eventType, DOMWrapperWorld* isolatedWorld);
     void dispatchWindowEvent(PassRefPtr<Event>, PassRefPtr<EventTarget> = 0);
 
-    PassRefPtr<Event> createEvent(const String& eventType, ExceptionCode&);
+    PassRefPtr<Event> createEvent(const String& eventType, ExceptionState&);
 
     // keep track of what types of event listeners are registered, so we don't
     // dispatch events unnecessarily
@@ -757,13 +758,13 @@
     void setTitleElement(const StringWithDirection&, Element* titleElement);
     void removeTitle(Element* titleElement);
 
-    String cookie(ExceptionCode&) const;
-    void setCookie(const String&, ExceptionCode&);
+    String cookie(ExceptionState&) const;
+    void setCookie(const String&, ExceptionState&);
 
     String referrer() const;
 
     String domain() const;
-    void setDomain(const String& newDomain, ExceptionCode&);
+    void setDomain(const String& newDomain, ExceptionState&);
 
     String lastModified() const;
 
@@ -790,14 +791,14 @@
     // The following breaks a qualified name into a prefix and a local name.
     // It also does a validity check, and returns false if the qualified name
     // is invalid.  It also sets ExceptionCode when name is invalid.
-    static bool parseQualifiedName(const String& qualifiedName, String& prefix, String& localName, ExceptionCode&);
+    static bool parseQualifiedName(const String& qualifiedName, String& prefix, String& localName, ExceptionState&);
 
     // Checks to make sure prefix and namespace do not conflict (per DOM Core 3)
     static bool hasValidNamespaceForElements(const QualifiedName&);
     static bool hasValidNamespaceForAttributes(const QualifiedName&);
 
     HTMLElement* body() const;
-    void setBody(PassRefPtr<HTMLElement>, ExceptionCode&);
+    void setBody(PassRefPtr<HTMLElement>, ExceptionState&);
 
     HTMLHeadElement* head();
 
@@ -979,10 +980,10 @@
 
     TextAutosizer* textAutosizer() { return m_textAutosizer.get(); }
 
-    PassRefPtr<Element> createElement(const AtomicString& localName, const AtomicString& typeExtension, ExceptionCode&);
-    PassRefPtr<Element> createElementNS(const AtomicString& namespaceURI, const String& qualifiedName, const AtomicString& typeExtension, ExceptionCode&);
-    ScriptValue registerElement(WebCore::ScriptState*, const AtomicString& name, ExceptionCode&);
-    ScriptValue registerElement(WebCore::ScriptState*, const AtomicString& name, const Dictionary& options, ExceptionCode&);
+    PassRefPtr<Element> createElement(const AtomicString& localName, const AtomicString& typeExtension, ExceptionState&);
+    PassRefPtr<Element> createElementNS(const AtomicString& namespaceURI, const String& qualifiedName, const AtomicString& typeExtension, ExceptionState&);
+    ScriptValue registerElement(WebCore::ScriptState*, const AtomicString& name, ExceptionState&);
+    ScriptValue registerElement(WebCore::ScriptState*, const AtomicString& name, const Dictionary& options, ExceptionState&);
     CustomElementRegistrationContext* registrationContext() { return m_registrationContext.get(); }
 
     void setImport(HTMLImport*);
diff --git a/Source/core/dom/DocumentOrderedMap.cpp b/Source/core/dom/DocumentOrderedMap.cpp
index c5df110..76f236a 100644
--- a/Source/core/dom/DocumentOrderedMap.cpp
+++ b/Source/core/dom/DocumentOrderedMap.cpp
@@ -37,7 +37,6 @@
 #include "core/dom/TreeScope.h"
 #include "core/html/HTMLLabelElement.h"
 #include "core/html/HTMLMapElement.h"
-#include "core/html/HTMLNameCollection.h"
 
 namespace WebCore {
 
@@ -48,11 +47,6 @@
     return element->getIdAttribute().impl() == key;
 }
 
-inline bool keyMatchesName(StringImpl* key, Element* element)
-{
-    return element->getNameAttribute().impl() == key;
-}
-
 inline bool keyMatchesMapName(StringImpl* key, Element* element)
 {
     return element->hasTagName(mapTag) && toHTMLMapElement(element)->getName().impl() == key;
@@ -68,16 +62,6 @@
     return isHTMLLabelElement(element) && element->getAttribute(forAttr).impl() == key;
 }
 
-inline bool keyMatchesWindowNamedItem(StringImpl* key, Element* element)
-{
-    return WindowNameCollection::nodeMatches(element, key);
-}
-
-inline bool keyMatchesDocumentNamedItem(StringImpl* key, Element* element)
-{
-    return DocumentNameCollection::nodeMatches(element, key);
-}
-
 void DocumentOrderedMap::clear()
 {
     m_map.clear();
@@ -159,11 +143,6 @@
     return get<keyMatchesId>(key, scope);
 }
 
-Element* DocumentOrderedMap::getElementByName(StringImpl* key, const TreeScope* scope) const
-{
-    return get<keyMatchesName>(key, scope);
-}
-
 Element* DocumentOrderedMap::getElementByMapName(StringImpl* key, const TreeScope* scope) const
 {
     return get<keyMatchesMapName>(key, scope);
@@ -179,14 +158,4 @@
     return get<keyMatchesLabelForAttribute>(key, scope);
 }
 
-Element* DocumentOrderedMap::getElementByWindowNamedItem(StringImpl* key, const TreeScope* scope) const
-{
-    return get<keyMatchesWindowNamedItem>(key, scope);
-}
-
-Element* DocumentOrderedMap::getElementByDocumentNamedItem(StringImpl* key, const TreeScope* scope) const
-{
-    return get<keyMatchesDocumentNamedItem>(key, scope);
-}
-
 } // namespace WebCore
diff --git a/Source/core/dom/DocumentOrderedMap.h b/Source/core/dom/DocumentOrderedMap.h
index 762da72..b6fc8e0 100644
--- a/Source/core/dom/DocumentOrderedMap.h
+++ b/Source/core/dom/DocumentOrderedMap.h
@@ -47,15 +47,12 @@
     void clear();
 
     bool contains(StringImpl*) const;
-    bool mightContainMultiple(StringImpl*) const;
+    bool containsMultiple(StringImpl*) const;
     // concrete instantiations of the get<>() method template
     Element* getElementById(StringImpl*, const TreeScope*) const;
-    Element* getElementByName(StringImpl*, const TreeScope*) const;
     Element* getElementByMapName(StringImpl*, const TreeScope*) const;
     Element* getElementByLowercasedMapName(StringImpl*, const TreeScope*) const;
     Element* getElementByLabelForAttribute(StringImpl*, const TreeScope*) const;
-    Element* getElementByWindowNamedItem(StringImpl*, const TreeScope*) const;
-    Element* getElementByDocumentNamedItem(StringImpl*, const TreeScope*) const;
 
     void checkConsistency() const;
 
@@ -76,9 +73,9 @@
     return m_map.contains(id) || m_duplicateCounts.contains(id);
 }
 
-inline bool DocumentOrderedMap::mightContainMultiple(StringImpl* id) const
+inline bool DocumentOrderedMap::containsMultiple(StringImpl* id) const
 {
-    return (m_map.contains(id) ? 1 : 0) + m_duplicateCounts.count(id) > 1;
+    return m_duplicateCounts.contains(id);
 }
 
 } // namespace WebCore
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index c18dec2..8ba2fda 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -32,6 +32,7 @@
 #include "RuntimeEnabledFeatures.h"
 #include "SVGNames.h"
 #include "XMLNames.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/accessibility/AXObjectCache.h"
 #include "core/animation/DocumentTimeline.h"
 #include "core/css/CSSParser.h"
@@ -75,7 +76,6 @@
 #include "core/html/HTMLFormControlsCollection.h"
 #include "core/html/HTMLFrameOwnerElement.h"
 #include "core/html/HTMLLabelElement.h"
-#include "core/html/HTMLNameCollection.h"
 #include "core/html/HTMLOptionsCollection.h"
 #include "core/html/HTMLTableRowsCollection.h"
 #include "core/html/parser/HTMLParserIdioms.h"
@@ -826,10 +826,10 @@
     return getAttribute(QualifiedName(nullAtom, localName, namespaceURI));
 }
 
-void Element::setAttribute(const AtomicString& localName, const AtomicString& value, ExceptionCode& ec)
+void Element::setAttribute(const AtomicString& localName, const AtomicString& value, ExceptionState& es)
 {
     if (!Document::isValidName(localName)) {
-        ec = InvalidCharacterError;
+        es.throwDOMException(InvalidCharacterError);
         return;
     }
 
@@ -1164,11 +1164,11 @@
     return m_tagName.toString();
 }
 
-void Element::setPrefix(const AtomicString& prefix, ExceptionCode& ec)
+void Element::setPrefix(const AtomicString& prefix, ExceptionState& es)
 {
-    ec = 0;
-    checkSetPrefix(prefix, ec);
-    if (ec)
+    es.clearException();
+    checkSetPrefix(prefix, es);
+    if (es.hadException())
         return;
 
     m_tagName.setPrefix(prefix.isEmpty() ? AtomicString() : prefix);
@@ -1249,7 +1249,7 @@
 
     const AtomicString& nameValue = getNameAttribute();
     if (!nameValue.isNull())
-        updateName(scope, nullAtom, nameValue);
+        updateName(nullAtom, nameValue);
 
     if (hasTagName(labelTag)) {
         if (scope->shouldCacheLabelsByForAttribute())
@@ -1288,7 +1288,7 @@
 
         const AtomicString& nameValue = getNameAttribute();
         if (!nameValue.isNull())
-            updateName(insertionPoint->treeScope(), nameValue, nullAtom);
+            updateName(nameValue, nullAtom);
 
         if (hasTagName(labelTag)) {
             TreeScope* treeScope = insertionPoint->treeScope();
@@ -1502,7 +1502,7 @@
             change = Force;
         }
 
-        if (styleChangeType() == SubtreeStyleChange)
+        if (styleChangeType() >= SubtreeStyleChange)
             change = Force;
         else if (change != Force)
             change = localChange;
@@ -1542,7 +1542,7 @@
             if (forceCheckOfNextElementSibling || forceCheckOfAnyElementSibling)
                 element->setNeedsStyleRecalc();
 
-            bool childRulesChanged = element->needsStyleRecalc() && element->styleChangeType() == SubtreeStyleChange;
+            bool childRulesChanged = element->needsStyleRecalc() && element->styleChangeType() >= SubtreeStyleChange;
             forceCheckOfNextElementSibling = childRulesChanged && hasDirectAdjacentRules;
             forceCheckOfAnyElementSibling = forceCheckOfAnyElementSibling || (childRulesChanged && hasIndirectAdjacentRules);
 
@@ -1583,7 +1583,7 @@
         elementShadow->didAffectSelector(mask);
 }
 
-PassRefPtr<ShadowRoot> Element::createShadowRoot(ExceptionCode& ec)
+PassRefPtr<ShadowRoot> Element::createShadowRoot(ExceptionState& es)
 {
     if (alwaysCreateUserAgentShadowRoot())
         ensureUserAgentShadowRoot();
@@ -1595,7 +1595,7 @@
     // subtrees won't work well in that element. Until they are fixed, we disable
     // adding author shadow root for them.
     if (!areAuthorShadowsAllowed()) {
-        ec = HierarchyRequestError;
+        es.throwDOMException(HierarchyRequestError);
         return 0;
     }
     return ensureShadow()->addShadowRoot(this, ShadowRoot::AuthorShadowRoot);
@@ -1671,7 +1671,7 @@
 static void checkForSiblingStyleChanges(Element* e, RenderStyle* style, bool finishedParsingCallback,
                                         Node* beforeChange, Node* afterChange, int childCountDelta)
 {
-    if (!e->attached() || e->document()->hasPendingForcedStyleRecalc() || e->styleChangeType() == SubtreeStyleChange)
+    if (!e->attached() || e->document()->hasPendingForcedStyleRecalc() || e->styleChangeType() >= SubtreeStyleChange)
         return;
 
     // :empty selector.
@@ -1811,10 +1811,10 @@
     return *attrNodeListForElement(this);
 }
 
-PassRefPtr<Attr> Element::setAttributeNode(Attr* attrNode, ExceptionCode& ec)
+PassRefPtr<Attr> Element::setAttributeNode(Attr* attrNode, ExceptionState& es)
 {
     if (!attrNode) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return 0;
     }
 
@@ -1825,7 +1825,7 @@
     // InUseAttributeError: Raised if node is an Attr that is already an attribute of another Element object.
     // The DOM user must explicitly clone Attr nodes to re-use them in other elements.
     if (attrNode->ownerElement()) {
-        ec = InUseAttributeError;
+        es.throwDOMException(InUseAttributeError);
         return 0;
     }
 
@@ -1849,19 +1849,19 @@
     return oldAttrNode.release();
 }
 
-PassRefPtr<Attr> Element::setAttributeNodeNS(Attr* attr, ExceptionCode& ec)
+PassRefPtr<Attr> Element::setAttributeNodeNS(Attr* attr, ExceptionState& es)
 {
-    return setAttributeNode(attr, ec);
+    return setAttributeNode(attr, es);
 }
 
-PassRefPtr<Attr> Element::removeAttributeNode(Attr* attr, ExceptionCode& ec)
+PassRefPtr<Attr> Element::removeAttributeNode(Attr* attr, ExceptionState& es)
 {
     if (!attr) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return 0;
     }
     if (attr->ownerElement() != this) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return 0;
     }
 
@@ -1871,7 +1871,7 @@
 
     size_t index = elementData()->getAttrIndex(attr);
     if (index == notFound) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return 0;
     }
 
@@ -1880,17 +1880,17 @@
     return guard.release();
 }
 
-bool Element::parseAttributeName(QualifiedName& out, const AtomicString& namespaceURI, const AtomicString& qualifiedName, ExceptionCode& ec)
+bool Element::parseAttributeName(QualifiedName& out, const AtomicString& namespaceURI, const AtomicString& qualifiedName, ExceptionState& es)
 {
     String prefix, localName;
-    if (!Document::parseQualifiedName(qualifiedName, prefix, localName, ec))
+    if (!Document::parseQualifiedName(qualifiedName, prefix, localName, es))
         return false;
-    ASSERT(!ec);
+    ASSERT(!es.hadException());
 
     QualifiedName qName(prefix, localName, namespaceURI);
 
     if (!Document::hasValidNamespaceForAttributes(qName)) {
-        ec = NamespaceError;
+        es.throwDOMException(NamespaceError);
         return false;
     }
 
@@ -1898,10 +1898,10 @@
     return true;
 }
 
-void Element::setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode& ec)
+void Element::setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionState& es)
 {
     QualifiedName parsedName = anyName;
-    if (!parseAttributeName(parsedName, namespaceURI, qualifiedName, ec))
+    if (!parseAttributeName(parsedName, namespaceURI, qualifiedName, es))
         return;
     setAttribute(parsedName, value);
 }
@@ -2076,6 +2076,11 @@
     }
 }
 
+bool Element::isFocusable() const
+{
+    return inDocument() && supportsFocus() && !isInert() && rendererIsFocusable();
+}
+
 bool Element::isKeyboardFocusable() const
 {
     return isFocusable() && tabIndex() >= 0;
@@ -2497,14 +2502,14 @@
     return 0;
 }
 
-bool Element::webkitMatchesSelector(const String& selector, ExceptionCode& ec)
+bool Element::webkitMatchesSelector(const String& selector, ExceptionState& es)
 {
     if (selector.isEmpty()) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return false;
     }
 
-    SelectorQuery* selectorQuery = document()->selectorQueryCache()->add(selector, document(), ec);
+    SelectorQuery* selectorQuery = document()->selectorQueryCache()->add(selector, document(), es);
     if (!selectorQuery)
         return false;
     return selectorQuery->matches(this);
@@ -2756,48 +2761,17 @@
 
 inline void Element::updateName(const AtomicString& oldName, const AtomicString& newName)
 {
-    if (!isInTreeScope())
+    if (!inDocument() || isInShadowTree())
         return;
 
     if (oldName == newName)
         return;
 
-    updateName(treeScope(), oldName, newName);
+    if (shouldRegisterAsNamedItem())
+        updateNamedItemRegistration(oldName, newName);
 }
 
-void Element::updateName(TreeScope* scope, const AtomicString& oldName, const AtomicString& newName)
-{
-    ASSERT(isInTreeScope());
-    ASSERT(oldName != newName);
-
-    if (!oldName.isEmpty())
-        scope->removeElementByName(oldName, this);
-    if (!newName.isEmpty())
-        scope->addElementByName(newName, this);
-
-    if (!inDocument() || isInShadowTree())
-        return;
-
-    Document* ownerDocument = document();
-    if (!ownerDocument->isHTMLDocument())
-        return;
-
-    if (WindowNameCollection::nodeMatchesIfNameAttributeMatch(this)) {
-        if (!oldName.isEmpty())
-            toHTMLDocument(ownerDocument)->windowNamedItemMap().remove(oldName.impl(), this);
-        if (!newName.isEmpty())
-            toHTMLDocument(ownerDocument)->windowNamedItemMap().add(newName.impl(), this);
-    }
-
-    if (DocumentNameCollection::nodeMatchesIfNameAttributeMatch(this)) {
-        if (!oldName.isEmpty())
-            toHTMLDocument(ownerDocument)->removeNamedDocumentItem(oldName, this);
-        if (!newName.isEmpty())
-            toHTMLDocument(ownerDocument)->addNamedDocumentItem(newName, this);
-    }
-}
-
-void Element::updateId(const AtomicString& oldId, const AtomicString& newId)
+inline void Element::updateId(const AtomicString& oldId, const AtomicString& newId)
 {
     if (!isInTreeScope())
         return;
@@ -2818,26 +2792,8 @@
     if (!newId.isEmpty())
         scope->addElementById(newId, this);
 
-    if (!inDocument() || isInShadowTree())
-        return;
-
-    Document* ownerDocument = document();
-    if (!ownerDocument->isHTMLDocument())
-        return;
-
-    if (WindowNameCollection::nodeMatchesIfIdAttributeMatch(this)) {
-        if (!oldId.isEmpty())
-            toHTMLDocument(ownerDocument)->windowNamedItemMap().remove(oldId.impl(), this);
-        if (!newId.isEmpty())
-            toHTMLDocument(ownerDocument)->windowNamedItemMap().add(newId.impl(), this);
-    }
-
-    if (DocumentNameCollection::nodeMatchesIfIdAttributeMatch(this)) {
-        if (!oldId.isEmpty())
-            toHTMLDocument(ownerDocument)->removeNamedDocumentItem(oldId, this);
-        if (!newId.isEmpty())
-            toHTMLDocument(ownerDocument)->addNamedDocumentItem(newId, this);
-    }
+    if (shouldRegisterAsExtraNamedItem())
+        updateExtraNamedItemRegistration(oldId, newId);
 }
 
 void Element::updateLabel(TreeScope* scope, const AtomicString& oldForAttributeValue, const AtomicString& newForAttributeValue)
@@ -2923,6 +2879,30 @@
     }
 }
 
+void Element::updateNamedItemRegistration(const AtomicString& oldName, const AtomicString& newName)
+{
+    if (!document()->isHTMLDocument())
+        return;
+
+    if (!oldName.isEmpty())
+        toHTMLDocument(document())->removeNamedItem(oldName);
+
+    if (!newName.isEmpty())
+        toHTMLDocument(document())->addNamedItem(newName);
+}
+
+void Element::updateExtraNamedItemRegistration(const AtomicString& oldId, const AtomicString& newId)
+{
+    if (!document()->isHTMLDocument())
+        return;
+
+    if (!oldId.isEmpty())
+        toHTMLDocument(document())->removeExtraNamedItem(oldId);
+
+    if (!newId.isEmpty())
+        toHTMLDocument(document())->addExtraNamedItem(newId);
+}
+
 PassRefPtr<HTMLCollection> Element::ensureCachedHTMLCollection(CollectionType type)
 {
     if (HTMLCollection* collection = cachedHTMLCollection(type))
diff --git a/Source/core/dom/Element.h b/Source/core/dom/Element.h
index 31ced21..dd7d113 100644
--- a/Source/core/dom/Element.h
+++ b/Source/core/dom/Element.h
@@ -48,6 +48,7 @@
 class Element;
 class ElementRareData;
 class ElementShadow;
+class ExceptionState;
 class Image;
 class InputMethodContext;
 class IntSize;
@@ -274,9 +275,9 @@
     const AtomicString& getAttribute(const AtomicString& name) const;
     const AtomicString& getAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName) const;
 
-    void setAttribute(const AtomicString& name, const AtomicString& value, ExceptionCode&);
-    static bool parseAttributeName(QualifiedName&, const AtomicString& namespaceURI, const AtomicString& qualifiedName, ExceptionCode&);
-    void setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode&);
+    void setAttribute(const AtomicString& name, const AtomicString& value, ExceptionState&);
+    static bool parseAttributeName(QualifiedName&, const AtomicString& namespaceURI, const AtomicString& qualifiedName, ExceptionState&);
+    void setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionState&);
 
     bool isIdAttributeName(const QualifiedName&) const;
     const AtomicString& getIdAttribute() const;
@@ -342,9 +343,9 @@
 
     PassRefPtr<Attr> getAttributeNode(const AtomicString& name);
     PassRefPtr<Attr> getAttributeNodeNS(const AtomicString& namespaceURI, const AtomicString& localName);
-    PassRefPtr<Attr> setAttributeNode(Attr*, ExceptionCode&);
-    PassRefPtr<Attr> setAttributeNodeNS(Attr*, ExceptionCode&);
-    PassRefPtr<Attr> removeAttributeNode(Attr*, ExceptionCode&);
+    PassRefPtr<Attr> setAttributeNode(Attr*, ExceptionState&);
+    PassRefPtr<Attr> setAttributeNodeNS(Attr*, ExceptionState&);
+    PassRefPtr<Attr> removeAttributeNode(Attr*, ExceptionState&);
 
     PassRefPtr<Attr> attrIfExists(const QualifiedName&);
     PassRefPtr<Attr> ensureAttr(const QualifiedName&);
@@ -438,7 +439,7 @@
 
     ElementShadow* shadow() const;
     ElementShadow* ensureShadow();
-    PassRefPtr<ShadowRoot> createShadowRoot(ExceptionCode&);
+    PassRefPtr<ShadowRoot> createShadowRoot(ExceptionState&);
     ShadowRoot* shadowRoot() const;
 
     bool hasAuthorShadowRoot() const { return shadowRoot(); }
@@ -507,6 +508,8 @@
     virtual void focus(bool restorePreviousSelection = true, FocusDirection = FocusDirectionNone);
     virtual void updateFocusAppearance(bool restorePreviousSelection);
     virtual void blur();
+    // Whether the node can actually be focused.
+    bool isFocusable() const;
     virtual bool isKeyboardFocusable() const;
     virtual bool isMouseFocusable() const;
     virtual void dispatchFocusEvent(Element* oldFocusedElement, FocusDirection);
@@ -542,7 +545,7 @@
 
     virtual bool matchesReadOnlyPseudoClass() const { return false; }
     virtual bool matchesReadWritePseudoClass() const { return false; }
-    bool webkitMatchesSelector(const String& selectors, ExceptionCode&);
+    bool webkitMatchesSelector(const String& selectors, ExceptionState&);
     virtual bool shouldAppearIndeterminate() const { return false; }
 
     DOMTokenList* classList();
@@ -663,6 +666,9 @@
     virtual void didRecalcStyle(StyleChange);
     virtual PassRefPtr<RenderStyle> customStyleForRenderer();
 
+    virtual bool shouldRegisterAsNamedItem() const { return false; }
+    virtual bool shouldRegisterAsExtraNamedItem() const { return false; }
+
     void clearTabIndexExplicitlyIfNeeded();
     void setTabIndexExplicitly(short);
     virtual bool supportsFocus() const OVERRIDE;
@@ -711,12 +717,11 @@
     void updateId(const AtomicString& oldId, const AtomicString& newId);
     void updateId(TreeScope*, const AtomicString& oldId, const AtomicString& newId);
     void updateName(const AtomicString& oldName, const AtomicString& newName);
-    void updateName(TreeScope*, const AtomicString& oldName, const AtomicString& newName);
     void updateLabel(TreeScope*, const AtomicString& oldForAttributeValue, const AtomicString& newForAttributeValue);
 
     void scrollByUnits(int units, ScrollGranularity);
 
-    virtual void setPrefix(const AtomicString&, ExceptionCode&) OVERRIDE FINAL;
+    virtual void setPrefix(const AtomicString&, ExceptionState&) OVERRIDE FINAL;
     virtual NodeType nodeType() const OVERRIDE FINAL;
     virtual bool childTypeAllowed(NodeType) const OVERRIDE FINAL;
 
@@ -754,6 +759,9 @@
 
     SpellcheckAttributeState spellcheckAttributeState() const;
 
+    void updateNamedItemRegistration(const AtomicString& oldName, const AtomicString& newName);
+    void updateExtraNamedItemRegistration(const AtomicString& oldName, const AtomicString& newName);
+
     void unregisterNamedFlowContentNode();
 
     void createUniqueElementData();
diff --git a/Source/core/dom/EventTarget.cpp b/Source/core/dom/EventTarget.cpp
index 522f44c..8facd5a 100644
--- a/Source/core/dom/EventTarget.cpp
+++ b/Source/core/dom/EventTarget.cpp
@@ -33,6 +33,7 @@
 #include "core/dom/EventTarget.h"
 
 #include "bindings/v8/DOMWrapperWorld.h"
+#include "bindings/v8/ExceptionState.h"
 #include "bindings/v8/ScriptController.h"
 #include "core/dom/Event.h"
 #include "core/dom/ExceptionCode.h"
@@ -140,10 +141,10 @@
     return removeEventListener(eventType, listener, false);
 }
 
-bool EventTarget::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec)
+bool EventTarget::dispatchEvent(PassRefPtr<Event> event, ExceptionState& es)
 {
     if (!event || event->type().isEmpty() || event->isBeingDispatched()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return false;
     }
 
diff --git a/Source/core/dom/EventTarget.h b/Source/core/dom/EventTarget.h
index a0c3a0e..5e95e0f 100644
--- a/Source/core/dom/EventTarget.h
+++ b/Source/core/dom/EventTarget.h
@@ -39,12 +39,13 @@
 namespace WebCore {
 
     class AudioContext;
-    class DedicatedWorkerGlobalScope;
     class DOMApplicationCache;
     class DOMWindow;
+    class DedicatedWorkerGlobalScope;
     class Event;
     class EventListener;
     class EventSource;
+    class ExceptionState;
     class FileReader;
     class FileWriter;
     class IDBDatabase;
@@ -71,8 +72,6 @@
     class XMLHttpRequest;
     class XMLHttpRequestUpload;
 
-    typedef int ExceptionCode;
-
     struct FiringEventIterator {
         FiringEventIterator(const AtomicString& eventType, size_t& iterator, size_t& end)
             : eventType(eventType)
@@ -112,7 +111,7 @@
         virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
         virtual void removeAllEventListeners();
         virtual bool dispatchEvent(PassRefPtr<Event>);
-        bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); // DOM API
+        bool dispatchEvent(PassRefPtr<Event>, ExceptionState&); // DOM API
         virtual void uncaughtExceptionInEventHandler();
 
         // Used for legacy "onEvent" attribute APIs.
diff --git a/Source/core/dom/MessagePort.cpp b/Source/core/dom/MessagePort.cpp
index be7ab66..efdb7ce 100644
--- a/Source/core/dom/MessagePort.cpp
+++ b/Source/core/dom/MessagePort.cpp
@@ -28,6 +28,7 @@
 #include "core/dom/MessagePort.h"
 
 #include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Document.h"
 #include "core/dom/EventNames.h"
 #include "core/dom/ExceptionCode.h"
@@ -169,7 +170,7 @@
         OwnPtr<MessagePortArray> ports = MessagePort::entanglePorts(*m_scriptExecutionContext, channels.release());
         RefPtr<Event> evt = MessageEvent::create(ports.release(), message.release());
 
-        dispatchEvent(evt.release(), ASSERT_NO_EXCEPTION);
+        dispatchEvent(evt.release(), ASSERT_NO_EXCEPTION_STATE);
     }
 }
 
diff --git a/Source/core/dom/MutationObserver.cpp b/Source/core/dom/MutationObserver.cpp
index a2e4084..e2d5fec 100644
--- a/Source/core/dom/MutationObserver.cpp
+++ b/Source/core/dom/MutationObserver.cpp
@@ -29,11 +29,11 @@
  */
 
 #include "config.h"
-
 #include "core/dom/MutationObserver.h"
 
 #include <algorithm>
 #include "bindings/v8/Dictionary.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/Document.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/MutationCallback.h"
@@ -81,10 +81,10 @@
         && ((options & CharacterData) || !(options & CharacterDataOldValue));
 }
 
-void MutationObserver::observe(Node* node, const Dictionary& optionsDictionary, ExceptionCode& ec)
+void MutationObserver::observe(Node* node, const Dictionary& optionsDictionary, ExceptionState& es)
 {
     if (!node) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
 
@@ -111,7 +111,7 @@
         options |= AttributeFilter;
 
     if (!validateOptions(options)) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return;
     }
 
diff --git a/Source/core/dom/MutationObserver.h b/Source/core/dom/MutationObserver.h
index 2a78bbf..3f2941d 100644
--- a/Source/core/dom/MutationObserver.h
+++ b/Source/core/dom/MutationObserver.h
@@ -41,13 +41,12 @@
 namespace WebCore {
 
 class Dictionary;
+class ExceptionState;
 class MutationCallback;
 class MutationObserverRegistration;
 class MutationRecord;
 class Node;
 
-typedef int ExceptionCode;
-
 typedef unsigned char MutationObserverOptions;
 typedef unsigned char MutationRecordDeliveryOptions;
 
@@ -76,7 +75,7 @@
 
     ~MutationObserver();
 
-    void observe(Node*, const Dictionary&, ExceptionCode&);
+    void observe(Node*, const Dictionary&, ExceptionState&);
     Vector<RefPtr<MutationRecord> > takeRecords();
     void disconnect();
     void observationStarted(MutationObserverRegistration*);
diff --git a/Source/core/dom/NamedNodeMap.cpp b/Source/core/dom/NamedNodeMap.cpp
index 0f93b6d..b24e12d 100644
--- a/Source/core/dom/NamedNodeMap.cpp
+++ b/Source/core/dom/NamedNodeMap.cpp
@@ -25,6 +25,7 @@
 #include "config.h"
 #include "core/dom/NamedNodeMap.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/Attr.h"
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
@@ -59,45 +60,45 @@
     return m_element->getAttributeNodeNS(namespaceURI, localName);
 }
 
-PassRefPtr<Node> NamedNodeMap::removeNamedItem(const AtomicString& name, ExceptionCode& ec)
+PassRefPtr<Node> NamedNodeMap::removeNamedItem(const AtomicString& name, ExceptionState& es)
 {
     size_t index = m_element->hasAttributes() ? m_element->getAttributeItemIndex(name, shouldIgnoreAttributeCase(m_element)) : notFound;
     if (index == notFound) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return 0;
     }
     return m_element->detachAttribute(index);
 }
 
-PassRefPtr<Node> NamedNodeMap::removeNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName, ExceptionCode& ec)
+PassRefPtr<Node> NamedNodeMap::removeNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName, ExceptionState& es)
 {
     size_t index = m_element->hasAttributes() ? m_element->getAttributeItemIndex(QualifiedName(nullAtom, localName, namespaceURI)) : notFound;
     if (index == notFound) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return 0;
     }
     return m_element->detachAttribute(index);
 }
 
-PassRefPtr<Node> NamedNodeMap::setNamedItem(Node* node, ExceptionCode& ec)
+PassRefPtr<Node> NamedNodeMap::setNamedItem(Node* node, ExceptionState& es)
 {
     if (!node) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return 0;
     }
 
     // Not mentioned in spec: throw a HIERARCHY_REQUEST_ERROR if the user passes in a non-attribute node
     if (!node->isAttributeNode()) {
-        ec = HierarchyRequestError;
+        es.throwDOMException(HierarchyRequestError);
         return 0;
     }
 
-    return m_element->setAttributeNode(toAttr(node), ec);
+    return m_element->setAttributeNode(toAttr(node), es);
 }
 
-PassRefPtr<Node> NamedNodeMap::setNamedItemNS(Node* node, ExceptionCode& ec)
+PassRefPtr<Node> NamedNodeMap::setNamedItemNS(Node* node, ExceptionState& es)
 {
-    return setNamedItem(node, ec);
+    return setNamedItem(node, es);
 }
 
 PassRefPtr<Node> NamedNodeMap::item(unsigned index) const
diff --git a/Source/core/dom/NamedNodeMap.h b/Source/core/dom/NamedNodeMap.h
index cbb12b4..f01102c 100644
--- a/Source/core/dom/NamedNodeMap.h
+++ b/Source/core/dom/NamedNodeMap.h
@@ -34,8 +34,7 @@
 
 class Node;
 class Element;
-
-typedef int ExceptionCode;
+class ExceptionState;
 
 class NamedNodeMap : public ScriptWrappable {
     WTF_MAKE_FAST_ALLOCATED;
@@ -52,13 +51,13 @@
     // Public DOM interface.
 
     PassRefPtr<Node> getNamedItem(const AtomicString&) const;
-    PassRefPtr<Node> removeNamedItem(const AtomicString& name, ExceptionCode&);
+    PassRefPtr<Node> removeNamedItem(const AtomicString& name, ExceptionState&);
 
     PassRefPtr<Node> getNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName) const;
-    PassRefPtr<Node> removeNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName, ExceptionCode&);
+    PassRefPtr<Node> removeNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName, ExceptionState&);
 
-    PassRefPtr<Node> setNamedItem(Node*, ExceptionCode&);
-    PassRefPtr<Node> setNamedItemNS(Node*, ExceptionCode&);
+    PassRefPtr<Node> setNamedItem(Node*, ExceptionState&);
+    PassRefPtr<Node> setNamedItemNS(Node*, ExceptionState&);
 
     PassRefPtr<Node> item(unsigned index) const;
     size_t length() const;
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index edd958d..6b64f8a 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -27,6 +27,8 @@
 
 #include "HTMLNames.h"
 #include "XMLNames.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/accessibility/AXObjectCache.h"
 #include "core/dom/Attr.h"
 #include "core/dom/Attribute.h"
@@ -46,7 +48,6 @@
 #include "core/dom/EventListener.h"
 #include "core/dom/EventNames.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/GestureEvent.h"
 #include "core/dom/KeyboardEvent.h"
 #include "core/dom/LiveNodeList.h"
@@ -510,42 +511,42 @@
     return lastChild();
 }
 
-void Node::insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode& ec, AttachBehavior attachBehavior)
+void Node::insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionState& es, AttachBehavior attachBehavior)
 {
     if (isContainerNode())
-        toContainerNode(this)->insertBefore(newChild, refChild, ec, attachBehavior);
+        toContainerNode(this)->insertBefore(newChild, refChild, es, attachBehavior);
     else
-        ec = HierarchyRequestError;
+        es.throwDOMException(HierarchyRequestError);
 }
 
-void Node::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode& ec, AttachBehavior attachBehavior)
+void Node::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionState& es, AttachBehavior attachBehavior)
 {
     if (isContainerNode())
-        toContainerNode(this)->replaceChild(newChild, oldChild, ec, attachBehavior);
+        toContainerNode(this)->replaceChild(newChild, oldChild, es, attachBehavior);
     else
-        ec = HierarchyRequestError;
+        es.throwDOMException(HierarchyRequestError);
 }
 
-void Node::removeChild(Node* oldChild, ExceptionCode& ec)
+void Node::removeChild(Node* oldChild, ExceptionState& es)
 {
     if (isContainerNode())
-        toContainerNode(this)->removeChild(oldChild, ec);
+        toContainerNode(this)->removeChild(oldChild, es);
     else
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
 }
 
-void Node::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, AttachBehavior attachBehavior)
+void Node::appendChild(PassRefPtr<Node> newChild, ExceptionState& es, AttachBehavior attachBehavior)
 {
     if (isContainerNode())
-        toContainerNode(this)->appendChild(newChild, ec, attachBehavior);
+        toContainerNode(this)->appendChild(newChild, es, attachBehavior);
     else
-        ec = HierarchyRequestError;
+        es.throwDOMException(HierarchyRequestError);
 }
 
-void Node::remove(ExceptionCode& ec)
+void Node::remove(ExceptionState& es)
 {
     if (ContainerNode* parent = parentNode())
-        parent->removeChild(this, ec);
+        parent->removeChild(this, es);
 }
 
 void Node::normalize()
@@ -575,7 +576,7 @@
         if (!text->length()) {
             // Care must be taken to get the next node before removing the current node.
             node = NodeTraversal::nextPostOrder(node.get());
-            text->remove(IGNORE_EXCEPTION);
+            text->remove(IGNORE_EXCEPTION_STATE);
             continue;
         }
 
@@ -587,7 +588,7 @@
 
             // Remove empty text nodes.
             if (!nextText->length()) {
-                nextText->remove(IGNORE_EXCEPTION);
+                nextText->remove(IGNORE_EXCEPTION_STATE);
                 continue;
             }
 
@@ -595,7 +596,7 @@
             unsigned offset = text->length();
             text->appendData(nextText->data());
             document()->textNodesMerged(nextText.get(), offset);
-            nextText->remove(IGNORE_EXCEPTION);
+            nextText->remove(IGNORE_EXCEPTION_STATE);
         }
 
         node = NodeTraversal::nextPostOrder(node.get());
@@ -608,12 +609,12 @@
     return nullAtom;
 }
 
-void Node::setPrefix(const AtomicString& /*prefix*/, ExceptionCode& ec)
+void Node::setPrefix(const AtomicString& /*prefix*/, ExceptionState& es)
 {
     // The spec says that for nodes other than elements and attributes, prefix is always null.
     // It does not say what to do when the user tries to set the prefix on another type of
     // node, however Mozilla throws a NamespaceError exception.
-    ec = NamespaceError;
+    es.throwDOMException(NamespaceError);
 }
 
 const AtomicString& Node::localName() const
@@ -846,7 +847,7 @@
     }
     markAncestorsWithChildNeedsStyleRecalc();
     for (Node* node = this; node; node = NodeTraversal::next(node, this)) {
-        node->setStyleChange(SubtreeStyleChange);
+        node->setStyleChange(LazyAttachStyleChange);
         node->setChildNeedsStyleRecalc();
         // FIXME: This flag is only used by HTMLFrameElementBase and doesn't look needed.
         if (shouldSetAttached == SetAttached)
@@ -863,15 +864,6 @@
     return false;
 }
 
-bool Node::isFocusable() const
-{
-    if (!inDocument() || !supportsFocus())
-        return false;
-    if (isElementNode() && toElement(this)->isInert())
-        return false;
-    return rendererIsFocusable();
-}
-
 Node* Node::focusDelegate()
 {
     return this;
@@ -961,13 +953,13 @@
     rareData()->clearNodeLists();
 }
 
-void Node::checkSetPrefix(const AtomicString& prefix, ExceptionCode& ec)
+void Node::checkSetPrefix(const AtomicString& prefix, ExceptionState& es)
 {
     // Perform error checking as required by spec for setting Node.prefix. Used by
     // Element::setPrefix() and Attr::setPrefix()
 
     if (!prefix.isEmpty() && !Document::isValidName(prefix)) {
-        ec = InvalidCharacterError;
+        es.throwDOMException(InvalidCharacterError);
         return;
     }
 
@@ -976,7 +968,7 @@
     const AtomicString& nodeNamespaceURI = namespaceURI();
     if ((nodeNamespaceURI.isEmpty() && !prefix.isEmpty())
         || (prefix == xmlAtom && nodeNamespaceURI != XMLNames::xmlNamespaceURI)) {
-        ec = NamespaceError;
+        es.throwDOMException(NamespaceError);
         return;
     }
     // Attribute-specific checks are in Attr::setPrefix().
@@ -1368,27 +1360,27 @@
     return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<RadioNodeList>(this, RadioNodeListType, name);
 }
 
-PassRefPtr<Element> Node::querySelector(const AtomicString& selectors, ExceptionCode& ec)
+PassRefPtr<Element> Node::querySelector(const AtomicString& selectors, ExceptionState& es)
 {
     if (selectors.isEmpty()) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return 0;
     }
 
-    SelectorQuery* selectorQuery = document()->selectorQueryCache()->add(selectors, document(), ec);
+    SelectorQuery* selectorQuery = document()->selectorQueryCache()->add(selectors, document(), es);
     if (!selectorQuery)
         return 0;
     return selectorQuery->queryFirst(this);
 }
 
-PassRefPtr<NodeList> Node::querySelectorAll(const AtomicString& selectors, ExceptionCode& ec)
+PassRefPtr<NodeList> Node::querySelectorAll(const AtomicString& selectors, ExceptionState& es)
 {
     if (selectors.isEmpty()) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return 0;
     }
 
-    SelectorQuery* selectorQuery = document()->selectorQueryCache()->add(selectors, document(), ec);
+    SelectorQuery* selectorQuery = document()->selectorQueryCache()->add(selectors, document(), es);
     if (!selectorQuery)
         return 0;
     return selectorQuery->queryAll(this);
@@ -1679,7 +1671,7 @@
     return isNullString ? String() : content.toString();
 }
 
-void Node::setTextContent(const String& text, ExceptionCode& ec)
+void Node::setTextContent(const String& text, ExceptionState& es)
 {
     switch (nodeType()) {
         case TEXT_NODE:
@@ -1696,7 +1688,7 @@
             ChildListMutationScope mutation(this);
             container->removeChildren();
             if (!text.isEmpty())
-                container->appendChild(document()->createTextNode(text), ec, AttachLazily);
+                container->appendChild(document()->createTextNode(text), es, AttachLazily);
             return;
         }
         case DOCUMENT_NODE:
@@ -2591,7 +2583,7 @@
 void Node::textRects(Vector<IntRect>& rects) const
 {
     RefPtr<Range> range = Range::create(document());
-    range->selectNodeContents(const_cast<Node*>(this), IGNORE_EXCEPTION);
+    range->selectNodeContents(const_cast<Node*>(this), IGNORE_EXCEPTION_STATE);
     range->textRects(rects);
 }
 
diff --git a/Source/core/dom/Node.h b/Source/core/dom/Node.h
index 2a11ef9..1a6287f 100644
--- a/Source/core/dom/Node.h
+++ b/Source/core/dom/Node.h
@@ -55,6 +55,7 @@
 class EventContext;
 class EventDispatchMediator;
 class EventListener;
+class ExceptionState;
 class FloatPoint;
 class Frame;
 class HTMLInputElement;
@@ -82,14 +83,13 @@
 class TagNodeList;
 class TouchEvent;
 
-typedef int ExceptionCode;
-
 const int nodeStyleChangeShift = 14;
 
 enum StyleChangeType {
     NoStyleChange = 0,
     LocalStyleChange = 1 << nodeStyleChangeShift,
     SubtreeStyleChange = 2 << nodeStyleChangeShift,
+    LazyAttachStyleChange = 3 << nodeStyleChangeShift,
 };
 
 // If the style change is from the renderer then we'll call setStyle on the
@@ -192,7 +192,7 @@
     // ChildNode interface API
     Element* previousElementSibling() const;
     Element* nextElementSibling() const;
-    void remove(ExceptionCode&);
+    void remove(ExceptionState&);
 
     Node* pseudoAwareNextSibling() const;
     Node* pseudoAwarePreviousSibling() const;
@@ -204,17 +204,17 @@
     // These should all actually return a node, but this is only important for language bindings,
     // which will already know and hold a ref on the right node to return. Returning bool allows
     // these methods to be more efficient since they don't need to return a ref
-    void insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode&, AttachBehavior = AttachNow);
-    void replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode&, AttachBehavior = AttachNow);
-    void removeChild(Node* child, ExceptionCode&);
-    void appendChild(PassRefPtr<Node> newChild, ExceptionCode&, AttachBehavior = AttachNow);
+    void insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionState&, AttachBehavior = AttachNow);
+    void replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionState&, AttachBehavior = AttachNow);
+    void removeChild(Node* child, ExceptionState&);
+    void appendChild(PassRefPtr<Node> newChild, ExceptionState&, AttachBehavior = AttachNow);
 
     bool hasChildNodes() const { return firstChild(); }
     virtual PassRefPtr<Node> cloneNode(bool deep = true) = 0;
     virtual const AtomicString& localName() const;
     virtual const AtomicString& namespaceURI() const;
     virtual const AtomicString& prefix() const;
-    virtual void setPrefix(const AtomicString&, ExceptionCode&);
+    virtual void setPrefix(const AtomicString&, ExceptionState&);
     void normalize();
 
     bool isSameNode(Node* other) const { return this == other; }
@@ -225,7 +225,7 @@
     String lookupNamespacePrefix(const AtomicString& namespaceURI, const Element* originalElement) const;
 
     String textContent(bool convertBRsToNewlines = false) const;
-    void setTextContent(const String&, ExceptionCode&);
+    void setTextContent(const String&, ExceptionState&);
 
     Node* lastDescendant() const;
     Node* firstDescendant() const;
@@ -434,8 +434,6 @@
     // rendererIsFocusable(), this method may be called when layout is not up to
     // date, so it must not use the renderer to determine focusability.
     virtual bool supportsFocus() const;
-    // Whether the node can actually be focused.
-    bool isFocusable() const;
     virtual Node* focusDelegate();
     // This is called only when the node is focused.
     virtual bool shouldHaveFocusAppearance() const;
@@ -516,7 +514,7 @@
     unsigned childNodeCount() const;
     Node* childNode(unsigned index) const;
 
-    void checkSetPrefix(const AtomicString& prefix, ExceptionCode&);
+    void checkSetPrefix(const AtomicString& prefix, ExceptionState&);
     bool isDescendantOf(const Node*) const;
     bool contains(const Node*) const;
     bool containsIncludingShadowDOM(const Node*) const;
@@ -641,8 +639,8 @@
     virtual bool willRespondToMouseClickEvents();
     virtual bool willRespondToTouchEvents();
 
-    PassRefPtr<Element> querySelector(const AtomicString& selectors, ExceptionCode&);
-    PassRefPtr<NodeList> querySelectorAll(const AtomicString& selectors, ExceptionCode&);
+    PassRefPtr<Element> querySelector(const AtomicString& selectors, ExceptionState&);
+    PassRefPtr<NodeList> querySelectorAll(const AtomicString& selectors, ExceptionState&);
 
     unsigned short compareDocumentPosition(const Node*) const;
 
@@ -928,6 +926,9 @@
 
 inline void Node::lazyReattach(ShouldSetAttached shouldSetAttached)
 {
+    if (styleChangeType() == LazyAttachStyleChange)
+        return;
+
     AttachContext context;
     context.performingReattach = true;
 
diff --git a/Source/core/dom/NodeIterator.cpp b/Source/core/dom/NodeIterator.cpp
index bcd2bfe..6bb4d9f 100644
--- a/Source/core/dom/NodeIterator.cpp
+++ b/Source/core/dom/NodeIterator.cpp
@@ -25,6 +25,7 @@
 #include "config.h"
 #include "core/dom/NodeIterator.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "bindings/v8/ScriptState.h"
 #include "core/dom/Document.h"
 #include "core/dom/ExceptionCode.h"
@@ -90,10 +91,10 @@
         ownerDocument->detachNodeIterator(this);
 }
 
-PassRefPtr<Node> NodeIterator::nextNode(ScriptState* state, ExceptionCode& ec)
+PassRefPtr<Node> NodeIterator::nextNode(ScriptState* state, ExceptionState& es)
 {
     if (m_detached) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
@@ -119,10 +120,10 @@
     return result.release();
 }
 
-PassRefPtr<Node> NodeIterator::previousNode(ScriptState* state, ExceptionCode& ec)
+PassRefPtr<Node> NodeIterator::previousNode(ScriptState* state, ExceptionState& es)
 {
     if (m_detached) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
diff --git a/Source/core/dom/NodeIterator.h b/Source/core/dom/NodeIterator.h
index 5aafc13..4c504bf 100644
--- a/Source/core/dom/NodeIterator.h
+++ b/Source/core/dom/NodeIterator.h
@@ -33,46 +33,46 @@
 
 namespace WebCore {
 
-    typedef int ExceptionCode;
+class ExceptionState;
 
-    class NodeIterator : public ScriptWrappable, public RefCounted<NodeIterator>, public Traversal {
-    public:
-        static PassRefPtr<NodeIterator> create(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<NodeFilter> filter)
-        {
-            return adoptRef(new NodeIterator(rootNode, whatToShow, filter));
-        }
-        ~NodeIterator();
+class NodeIterator : public ScriptWrappable, public RefCounted<NodeIterator>, public Traversal {
+public:
+    static PassRefPtr<NodeIterator> create(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<NodeFilter> filter)
+    {
+        return adoptRef(new NodeIterator(rootNode, whatToShow, filter));
+    }
+    ~NodeIterator();
 
-        PassRefPtr<Node> nextNode(ScriptState*, ExceptionCode&);
-        PassRefPtr<Node> previousNode(ScriptState*, ExceptionCode&);
-        void detach();
+    PassRefPtr<Node> nextNode(ScriptState*, ExceptionState&);
+    PassRefPtr<Node> previousNode(ScriptState*, ExceptionState&);
+    void detach();
 
-        Node* referenceNode() const { return m_referenceNode.node.get(); }
-        bool pointerBeforeReferenceNode() const { return m_referenceNode.isPointerBeforeNode; }
+    Node* referenceNode() const { return m_referenceNode.node.get(); }
+    bool pointerBeforeReferenceNode() const { return m_referenceNode.isPointerBeforeNode; }
 
-        // This function is called before any node is removed from the document tree.
-        void nodeWillBeRemoved(Node*);
+    // This function is called before any node is removed from the document tree.
+    void nodeWillBeRemoved(Node*);
 
-    private:
-        NodeIterator(PassRefPtr<Node>, unsigned whatToShow, PassRefPtr<NodeFilter>);
+private:
+    NodeIterator(PassRefPtr<Node>, unsigned whatToShow, PassRefPtr<NodeFilter>);
 
-        struct NodePointer {
-            RefPtr<Node> node;
-            bool isPointerBeforeNode;
-            NodePointer();
-            NodePointer(PassRefPtr<Node>, bool);
-            void clear();
-            bool moveToNext(Node* root);
-            bool moveToPrevious(Node* root);
-        };
-
-        void updateForNodeRemoval(Node* nodeToBeRemoved, NodePointer&) const;
-
-        NodePointer m_referenceNode;
-        NodePointer m_candidateNode;
-        bool m_detached;
+    struct NodePointer {
+        RefPtr<Node> node;
+        bool isPointerBeforeNode;
+        NodePointer();
+        NodePointer(PassRefPtr<Node>, bool);
+        void clear();
+        bool moveToNext(Node* root);
+        bool moveToPrevious(Node* root);
     };
 
+    void updateForNodeRemoval(Node* nodeToBeRemoved, NodePointer&) const;
+
+    NodePointer m_referenceNode;
+    NodePointer m_candidateNode;
+    bool m_detached;
+};
+
 } // namespace WebCore
 
 #endif // NodeIterator_h
diff --git a/Source/core/dom/NodeList.idl b/Source/core/dom/NodeList.idl
index 37634f7..794ba11 100644
--- a/Source/core/dom/NodeList.idl
+++ b/Source/core/dom/NodeList.idl
@@ -23,7 +23,7 @@
     DependentLifetime
 ] interface NodeList {
 
-    getter Node item([IsIndex,Default=Undefined] optional unsigned long index);
+    getter Node item(unsigned long index);
     [ImplementedAs=anonymousNamedGetter, OverrideBuiltins, NotEnumerable] getter (Node or unsigned long) (DOMString name);
 
     readonly attribute unsigned long length;
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp
index 2f4de90..d6cd653 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -25,7 +25,8 @@
 #include "config.h"
 #include "core/dom/Range.h"
 
-#include <stdio.h>
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/ClientRect.h"
 #include "core/dom/ClientRectList.h"
 #include "core/dom/DocumentFragment.h"
@@ -48,6 +49,7 @@
 #include "wtf/Vector.h"
 #include "wtf/text/CString.h"
 #include "wtf/text/StringBuilder.h"
+#include <stdio.h>
 
 namespace WebCore {
 
@@ -123,50 +125,50 @@
     m_ownerDocument->attachRange(this);
 }
 
-Node* Range::startContainer(ExceptionCode& ec) const
+Node* Range::startContainer(ExceptionState& es) const
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
     return m_start.container();
 }
 
-int Range::startOffset(ExceptionCode& ec) const
+int Range::startOffset(ExceptionState& es) const
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
     return m_start.offset();
 }
 
-Node* Range::endContainer(ExceptionCode& ec) const
+Node* Range::endContainer(ExceptionState& es) const
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
     return m_end.container();
 }
 
-int Range::endOffset(ExceptionCode& ec) const
+int Range::endOffset(ExceptionState& es) const
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
     return m_end.offset();
 }
 
-Node* Range::commonAncestorContainer(ExceptionCode& ec) const
+Node* Range::commonAncestorContainer(ExceptionState& es) const
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
@@ -184,10 +186,10 @@
     return 0;
 }
 
-bool Range::collapsed(ExceptionCode& ec) const
+bool Range::collapsed(ExceptionState& es) const
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
@@ -203,18 +205,18 @@
     while (startRootContainer->parentNode())
         startRootContainer = startRootContainer->parentNode();
 
-    return startRootContainer != endRootContainer || (Range::compareBoundaryPoints(start, end, ASSERT_NO_EXCEPTION) > 0);
+    return startRootContainer != endRootContainer || (Range::compareBoundaryPoints(start, end, ASSERT_NO_EXCEPTION_STATE) > 0);
 }
 
-void Range::setStart(PassRefPtr<Node> refNode, int offset, ExceptionCode& ec)
+void Range::setStart(PassRefPtr<Node> refNode, int offset, ExceptionState& es)
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
     if (!refNode) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
 
@@ -224,26 +226,26 @@
         didMoveDocument = true;
     }
 
-    ec = 0;
-    Node* childNode = checkNodeWOffset(refNode.get(), offset, ec);
-    if (ec)
+    es.clearException();
+    Node* childNode = checkNodeWOffset(refNode.get(), offset, es);
+    if (es.hadException())
         return;
 
     m_start.set(refNode, offset, childNode);
 
     if (didMoveDocument || checkForDifferentRootContainer(m_start, m_end))
-        collapse(true, ec);
+        collapse(true, es);
 }
 
-void Range::setEnd(PassRefPtr<Node> refNode, int offset, ExceptionCode& ec)
+void Range::setEnd(PassRefPtr<Node> refNode, int offset, ExceptionState& es)
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
     if (!refNode) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
 
@@ -253,33 +255,33 @@
         didMoveDocument = true;
     }
 
-    ec = 0;
-    Node* childNode = checkNodeWOffset(refNode.get(), offset, ec);
-    if (ec)
+    es.clearException();
+    Node* childNode = checkNodeWOffset(refNode.get(), offset, es);
+    if (es.hadException())
         return;
 
     m_end.set(refNode, offset, childNode);
 
     if (didMoveDocument || checkForDifferentRootContainer(m_start, m_end))
-        collapse(false, ec);
+        collapse(false, es);
 }
 
-void Range::setStart(const Position& start, ExceptionCode& ec)
+void Range::setStart(const Position& start, ExceptionState& es)
 {
     Position parentAnchored = start.parentAnchoredEquivalent();
-    setStart(parentAnchored.containerNode(), parentAnchored.offsetInContainerNode(), ec);
+    setStart(parentAnchored.containerNode(), parentAnchored.offsetInContainerNode(), es);
 }
 
-void Range::setEnd(const Position& end, ExceptionCode& ec)
+void Range::setEnd(const Position& end, ExceptionState& es)
 {
     Position parentAnchored = end.parentAnchoredEquivalent();
-    setEnd(parentAnchored.containerNode(), parentAnchored.offsetInContainerNode(), ec);
+    setEnd(parentAnchored.containerNode(), parentAnchored.offsetInContainerNode(), es);
 }
 
-void Range::collapse(bool toStart, ExceptionCode& ec)
+void Range::collapse(bool toStart, ExceptionState& es)
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
@@ -289,15 +291,15 @@
         m_start = m_end;
 }
 
-bool Range::isPointInRange(Node* refNode, int offset, ExceptionCode& ec)
+bool Range::isPointInRange(Node* refNode, int offset, ExceptionState& es)
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return false;
     }
 
     if (!refNode) {
-        ec = HierarchyRequestError;
+        es.throwDOMException(HierarchyRequestError);
         return false;
     }
 
@@ -305,69 +307,69 @@
         return false;
     }
 
-    ec = 0;
-    checkNodeWOffset(refNode, offset, ec);
-    if (ec)
+    es.clearException();
+    checkNodeWOffset(refNode, offset, es);
+    if (es.hadException())
         return false;
 
-    return compareBoundaryPoints(refNode, offset, m_start.container(), m_start.offset(), ec) >= 0 && !ec
-        && compareBoundaryPoints(refNode, offset, m_end.container(), m_end.offset(), ec) <= 0 && !ec;
+    return compareBoundaryPoints(refNode, offset, m_start.container(), m_start.offset(), es) >= 0 && !es.hadException()
+        && compareBoundaryPoints(refNode, offset, m_end.container(), m_end.offset(), es) <= 0 && !es.hadException();
 }
 
-short Range::comparePoint(Node* refNode, int offset, ExceptionCode& ec) const
+short Range::comparePoint(Node* refNode, int offset, ExceptionState& es) const
 {
     // http://developer.mozilla.org/en/docs/DOM:range.comparePoint
     // This method returns -1, 0 or 1 depending on if the point described by the
     // refNode node and an offset within the node is before, same as, or after the range respectively.
 
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
     if (!refNode) {
-        ec = HierarchyRequestError;
+        es.throwDOMException(HierarchyRequestError);
         return 0;
     }
 
     if (!refNode->attached() || refNode->document() != m_ownerDocument) {
-        ec = WrongDocumentError;
+        es.throwDOMException(WrongDocumentError);
         return 0;
     }
 
-    ec = 0;
-    checkNodeWOffset(refNode, offset, ec);
-    if (ec)
+    es.clearException();
+    checkNodeWOffset(refNode, offset, es);
+    if (es.hadException())
         return 0;
 
     // compare to start, and point comes before
-    if (compareBoundaryPoints(refNode, offset, m_start.container(), m_start.offset(), ec) < 0)
+    if (compareBoundaryPoints(refNode, offset, m_start.container(), m_start.offset(), es) < 0)
         return -1;
 
-    if (ec)
+    if (es.hadException())
         return 0;
 
     // compare to end, and point comes after
-    if (compareBoundaryPoints(refNode, offset, m_end.container(), m_end.offset(), ec) > 0 && !ec)
+    if (compareBoundaryPoints(refNode, offset, m_end.container(), m_end.offset(), es) > 0 && !es.hadException())
         return 1;
 
     // point is in the middle of this range, or on the boundary points
     return 0;
 }
 
-Range::CompareResults Range::compareNode(Node* refNode, ExceptionCode& ec) const
+Range::CompareResults Range::compareNode(Node* refNode, ExceptionState& es) const
 {
     // http://developer.mozilla.org/en/docs/DOM:range.compareNode
     // This method returns 0, 1, 2, or 3 based on if the node is before, after,
     // before and after(surrounds), or inside the range, respectively
 
     if (!refNode) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return NODE_BEFORE;
     }
 
     if (!m_start.container() && refNode->attached()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return NODE_BEFORE;
     }
 
@@ -387,43 +389,43 @@
     if (!parentNode) {
         // if the node is the top document we should return NODE_BEFORE_AND_AFTER
         // but we throw to match firefox behavior
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return NODE_BEFORE;
     }
 
-    if (comparePoint(parentNode, nodeIndex, ec) < 0) { // starts before
-        if (comparePoint(parentNode, nodeIndex + 1, ec) > 0) // ends after the range
+    if (comparePoint(parentNode, nodeIndex, es) < 0) { // starts before
+        if (comparePoint(parentNode, nodeIndex + 1, es) > 0) // ends after the range
             return NODE_BEFORE_AND_AFTER;
         return NODE_BEFORE; // ends before or in the range
-    } else { // starts at or after the range start
-        if (comparePoint(parentNode, nodeIndex + 1, ec) > 0) // ends after the range
-            return NODE_AFTER;
-        return NODE_INSIDE; // ends inside the range
     }
+    // starts at or after the range start
+    if (comparePoint(parentNode, nodeIndex + 1, es) > 0) // ends after the range
+        return NODE_AFTER;
+    return NODE_INSIDE; // ends inside the range
 }
 
-short Range::compareBoundaryPoints(CompareHow how, const Range* sourceRange, ExceptionCode& ec) const
+short Range::compareBoundaryPoints(CompareHow how, const Range* sourceRange, ExceptionState& es) const
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
     if (!sourceRange) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return 0;
     }
 
-    ec = 0;
-    Node* thisCont = commonAncestorContainer(ec);
-    if (ec)
+    es.clearException();
+    Node* thisCont = commonAncestorContainer(es);
+    if (es.hadException())
         return 0;
-    Node* sourceCont = sourceRange->commonAncestorContainer(ec);
-    if (ec)
+    Node* sourceCont = sourceRange->commonAncestorContainer(es);
+    if (es.hadException())
         return 0;
 
     if (thisCont->document() != sourceCont->document()) {
-        ec = WrongDocumentError;
+        es.throwDOMException(WrongDocumentError);
         return 0;
     }
 
@@ -434,26 +436,26 @@
     while (sourceTop->parentNode())
         sourceTop = sourceTop->parentNode();
     if (thisTop != sourceTop) { // in different DocumentFragments
-        ec = WrongDocumentError;
+        es.throwDOMException(WrongDocumentError);
         return 0;
     }
 
     switch (how) {
         case START_TO_START:
-            return compareBoundaryPoints(m_start, sourceRange->m_start, ec);
+            return compareBoundaryPoints(m_start, sourceRange->m_start, es);
         case START_TO_END:
-            return compareBoundaryPoints(m_end, sourceRange->m_start, ec);
+            return compareBoundaryPoints(m_end, sourceRange->m_start, es);
         case END_TO_END:
-            return compareBoundaryPoints(m_end, sourceRange->m_end, ec);
+            return compareBoundaryPoints(m_end, sourceRange->m_end, es);
         case END_TO_START:
-            return compareBoundaryPoints(m_start, sourceRange->m_end, ec);
+            return compareBoundaryPoints(m_start, sourceRange->m_end, es);
     }
 
-    ec = SyntaxError;
+    es.throwDOMException(SyntaxError);
     return 0;
 }
 
-short Range::compareBoundaryPoints(Node* containerA, int offsetA, Node* containerB, int offsetB, ExceptionCode& ec)
+short Range::compareBoundaryPoints(Node* containerA, int offsetA, Node* containerB, int offsetB, ExceptionState& es)
 {
     ASSERT(containerA);
     ASSERT(containerB);
@@ -515,7 +517,7 @@
     // ### we need to do a traversal here instead
     Node* commonAncestor = commonAncestorContainer(containerA, containerB);
     if (!commonAncestor) {
-        ec = WrongDocumentError;
+        es.throwDOMException(WrongDocumentError);
         return 0;
     }
     Node* childA = containerA;
@@ -546,38 +548,38 @@
     return 0;
 }
 
-short Range::compareBoundaryPoints(const RangeBoundaryPoint& boundaryA, const RangeBoundaryPoint& boundaryB, ExceptionCode& ec)
+short Range::compareBoundaryPoints(const RangeBoundaryPoint& boundaryA, const RangeBoundaryPoint& boundaryB, ExceptionState& es)
 {
-    return compareBoundaryPoints(boundaryA.container(), boundaryA.offset(), boundaryB.container(), boundaryB.offset(), ec);
+    return compareBoundaryPoints(boundaryA.container(), boundaryA.offset(), boundaryB.container(), boundaryB.offset(), es);
 }
 
 bool Range::boundaryPointsValid() const
 {
-    ExceptionCode ec = 0;
-    return m_start.container() && compareBoundaryPoints(m_start, m_end, ec) <= 0 && !ec;
+    TrackExceptionState es;
+    return m_start.container() && compareBoundaryPoints(m_start, m_end, es) <= 0 && !es.hadException();
 }
 
-void Range::deleteContents(ExceptionCode& ec)
+void Range::deleteContents(ExceptionState& es)
 {
-    checkDeleteExtract(ec);
-    if (ec)
+    checkDeleteExtract(es);
+    if (es.hadException())
         return;
 
-    processContents(DELETE_CONTENTS, ec);
+    processContents(DELETE_CONTENTS, es);
 }
 
-bool Range::intersectsNode(Node* refNode, ExceptionCode& ec)
+bool Range::intersectsNode(Node* refNode, ExceptionState& es)
 {
     // http://developer.mozilla.org/en/docs/DOM:range.intersectsNode
     // Returns a bool if the node intersects the range.
 
     // Throw exception if the range is already detached.
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return false;
     }
     if (!refNode) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return false;
     }
 
@@ -592,15 +594,17 @@
     if (!parentNode) {
         // if the node is the top document we should return NODE_BEFORE_AND_AFTER
         // but we throw to match firefox behavior
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return false;
     }
 
-    if (comparePoint(parentNode, nodeIndex, ec) < 0 && // starts before start
-        comparePoint(parentNode, nodeIndex + 1, ec) < 0) { // ends before start
+    if (comparePoint(parentNode, nodeIndex, es) < 0 // starts before start
+        && comparePoint(parentNode, nodeIndex + 1, es) < 0) { // ends before start
         return false;
-    } else if (comparePoint(parentNode, nodeIndex, ec) > 0 && // starts after end
-               comparePoint(parentNode, nodeIndex + 1, ec) > 0) { // ends after end
+    }
+
+    if (comparePoint(parentNode, nodeIndex, es) > 0 // starts after end
+        && comparePoint(parentNode, nodeIndex + 1, es) > 0) { // ends after end
         return false;
     }
 
@@ -664,7 +668,7 @@
     return 0;
 }
 
-PassRefPtr<DocumentFragment> Range::processContents(ActionType action, ExceptionCode& ec)
+PassRefPtr<DocumentFragment> Range::processContents(ActionType action, ExceptionState& es)
 {
     typedef Vector<RefPtr<Node> > NodeVector;
 
@@ -672,19 +676,19 @@
     if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS)
         fragment = DocumentFragment::create(m_ownerDocument.get());
 
-    ec = 0;
-    if (collapsed(ec))
+    es.clearException();
+    if (collapsed(es))
         return fragment.release();
-    if (ec)
+    if (es.hadException())
         return 0;
 
-    RefPtr<Node> commonRoot = commonAncestorContainer(ec);
-    if (ec)
+    RefPtr<Node> commonRoot = commonAncestorContainer(es);
+    if (es.hadException())
         return 0;
     ASSERT(commonRoot);
 
     if (m_start.container() == m_end.container()) {
-        processContentsBetweenOffsets(action, fragment, m_start.container(), m_start.offset(), m_end.offset(), ec);
+        processContentsBetweenOffsets(action, fragment, m_start.container(), m_start.offset(), m_end.offset(), es);
         return fragment;
     }
 
@@ -718,14 +722,14 @@
 
     RefPtr<Node> leftContents;
     if (originalStart.container() != commonRoot && commonRoot->contains(originalStart.container())) {
-        leftContents = processContentsBetweenOffsets(action, 0, originalStart.container(), originalStart.offset(), lengthOfContentsInNode(originalStart.container()), ec);
-        leftContents = processAncestorsAndTheirSiblings(action, originalStart.container(), ProcessContentsForward, leftContents, commonRoot.get(), ec);
+        leftContents = processContentsBetweenOffsets(action, 0, originalStart.container(), originalStart.offset(), lengthOfContentsInNode(originalStart.container()), es);
+        leftContents = processAncestorsAndTheirSiblings(action, originalStart.container(), ProcessContentsForward, leftContents, commonRoot.get(), es);
     }
 
     RefPtr<Node> rightContents;
     if (m_end.container() != commonRoot && commonRoot->contains(originalEnd.container())) {
-        rightContents = processContentsBetweenOffsets(action, 0, originalEnd.container(), 0, originalEnd.offset(), ec);
-        rightContents = processAncestorsAndTheirSiblings(action, originalEnd.container(), ProcessContentsBackward, rightContents, commonRoot.get(), ec);
+        rightContents = processContentsBetweenOffsets(action, 0, originalEnd.container(), 0, originalEnd.offset(), es);
+        rightContents = processAncestorsAndTheirSiblings(action, originalEnd.container(), ProcessContentsBackward, rightContents, commonRoot.get(), es);
     }
 
     // delete all children of commonRoot between the start and end container
@@ -737,10 +741,10 @@
     // Collapse the range, making sure that the result is not within a node that was partially selected.
     if (action == EXTRACT_CONTENTS || action == DELETE_CONTENTS) {
         if (partialStart && commonRoot->contains(partialStart.get()))
-            setStart(partialStart->parentNode(), partialStart->nodeIndex() + 1, ec);
+            setStart(partialStart->parentNode(), partialStart->nodeIndex() + 1, es);
         else if (partialEnd && commonRoot->contains(partialEnd.get()))
-            setStart(partialEnd->parentNode(), partialEnd->nodeIndex(), ec);
-        if (ec)
+            setStart(partialEnd->parentNode(), partialEnd->nodeIndex(), es);
+        if (es.hadException())
             return 0;
         m_end = m_start;
     }
@@ -752,31 +756,31 @@
     // (or just delete the stuff in between)
 
     if ((action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) && leftContents)
-        fragment->appendChild(leftContents, ec);
+        fragment->appendChild(leftContents, es);
 
     if (processStart) {
         NodeVector nodes;
         for (Node* n = processStart.get(); n && n != processEnd; n = n->nextSibling())
             nodes.append(n);
-        processNodes(action, nodes, commonRoot, fragment, ec);
+        processNodes(action, nodes, commonRoot, fragment, es);
     }
 
     if ((action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) && rightContents)
-        fragment->appendChild(rightContents, ec);
+        fragment->appendChild(rightContents, es);
 
     return fragment.release();
 }
 
-static inline void deleteCharacterData(PassRefPtr<CharacterData> data, unsigned startOffset, unsigned endOffset, ExceptionCode& ec)
+static inline void deleteCharacterData(PassRefPtr<CharacterData> data, unsigned startOffset, unsigned endOffset, ExceptionState& es)
 {
     if (data->length() - endOffset)
-        data->deleteData(endOffset, data->length() - endOffset, ec);
+        data->deleteData(endOffset, data->length() - endOffset, es);
     if (startOffset)
-        data->deleteData(0, startOffset, ec);
+        data->deleteData(0, startOffset, es);
 }
 
 PassRefPtr<Node> Range::processContentsBetweenOffsets(ActionType action, PassRefPtr<DocumentFragment> fragment,
-    Node* container, unsigned startOffset, unsigned endOffset, ExceptionCode& ec)
+    Node* container, unsigned startOffset, unsigned endOffset, ExceptionState& es)
 {
     ASSERT(container);
     ASSERT(startOffset <= endOffset);
@@ -790,15 +794,15 @@
         ASSERT(endOffset <= static_cast<CharacterData*>(container)->length());
         if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) {
             RefPtr<CharacterData> c = static_pointer_cast<CharacterData>(container->cloneNode(true));
-            deleteCharacterData(c, startOffset, endOffset, ec);
+            deleteCharacterData(c, startOffset, endOffset, es);
             if (fragment) {
                 result = fragment;
-                result->appendChild(c.release(), ec);
+                result->appendChild(c.release(), es);
             } else
                 result = c.release();
         }
         if (action == EXTRACT_CONTENTS || action == DELETE_CONTENTS)
-            static_cast<CharacterData*>(container)->deleteData(startOffset, endOffset - startOffset, ec);
+            static_cast<CharacterData*>(container)->deleteData(startOffset, endOffset - startOffset, es);
         break;
     case Node::PROCESSING_INSTRUCTION_NODE:
         ASSERT(endOffset <= static_cast<ProcessingInstruction*>(container)->data().length());
@@ -807,7 +811,7 @@
             c->setData(c->data().substring(startOffset, endOffset - startOffset));
             if (fragment) {
                 result = fragment;
-                result->appendChild(c.release(), ec);
+                result->appendChild(c.release(), es);
             } else
                 result = c.release();
         }
@@ -841,31 +845,31 @@
         for (unsigned i = startOffset; n && i < endOffset; i++, n = n->nextSibling())
             nodes.append(n);
 
-        processNodes(action, nodes, container, result, ec);
+        processNodes(action, nodes, container, result, es);
         break;
     }
 
     return result.release();
 }
 
-void Range::processNodes(ActionType action, Vector<RefPtr<Node> >& nodes, PassRefPtr<Node> oldContainer, PassRefPtr<Node> newContainer, ExceptionCode& ec)
+void Range::processNodes(ActionType action, Vector<RefPtr<Node> >& nodes, PassRefPtr<Node> oldContainer, PassRefPtr<Node> newContainer, ExceptionState& es)
 {
     for (unsigned i = 0; i < nodes.size(); i++) {
         switch (action) {
         case DELETE_CONTENTS:
-            oldContainer->removeChild(nodes[i].get(), ec);
+            oldContainer->removeChild(nodes[i].get(), es);
             break;
         case EXTRACT_CONTENTS:
-            newContainer->appendChild(nodes[i].release(), ec); // will remove n from its parent
+            newContainer->appendChild(nodes[i].release(), es); // will remove n from its parent
             break;
         case CLONE_CONTENTS:
-            newContainer->appendChild(nodes[i]->cloneNode(true), ec);
+            newContainer->appendChild(nodes[i]->cloneNode(true), es);
             break;
         }
     }
 }
 
-PassRefPtr<Node> Range::processAncestorsAndTheirSiblings(ActionType action, Node* container, ContentsProcessDirection direction, PassRefPtr<Node> passedClonedContainer, Node* commonRoot, ExceptionCode& ec)
+PassRefPtr<Node> Range::processAncestorsAndTheirSiblings(ActionType action, Node* container, ContentsProcessDirection direction, PassRefPtr<Node> passedClonedContainer, Node* commonRoot, ExceptionState& es)
 {
     typedef Vector<RefPtr<Node> > NodeVector;
 
@@ -879,7 +883,7 @@
         RefPtr<Node> ancestor = *it;
         if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) {
             if (RefPtr<Node> clonedAncestor = ancestor->cloneNode(false)) { // Might have been removed already during mutation event.
-                clonedAncestor->appendChild(clonedContainer, ec);
+                clonedAncestor->appendChild(clonedContainer, es);
                 clonedContainer = clonedAncestor;
             }
         }
@@ -898,19 +902,19 @@
             Node* child = it->get();
             switch (action) {
             case DELETE_CONTENTS:
-                ancestor->removeChild(child, ec);
+                ancestor->removeChild(child, es);
                 break;
             case EXTRACT_CONTENTS: // will remove child from ancestor
                 if (direction == ProcessContentsForward)
-                    clonedContainer->appendChild(child, ec);
+                    clonedContainer->appendChild(child, es);
                 else
-                    clonedContainer->insertBefore(child, clonedContainer->firstChild(), ec);
+                    clonedContainer->insertBefore(child, clonedContainer->firstChild(), es);
                 break;
             case CLONE_CONTENTS:
                 if (direction == ProcessContentsForward)
-                    clonedContainer->appendChild(child->cloneNode(true), ec);
+                    clonedContainer->appendChild(child->cloneNode(true), es);
                 else
-                    clonedContainer->insertBefore(child->cloneNode(true), clonedContainer->firstChild(), ec);
+                    clonedContainer->insertBefore(child->cloneNode(true), clonedContainer->firstChild(), es);
                 break;
             }
         }
@@ -920,38 +924,38 @@
     return clonedContainer.release();
 }
 
-PassRefPtr<DocumentFragment> Range::extractContents(ExceptionCode& ec)
+PassRefPtr<DocumentFragment> Range::extractContents(ExceptionState& es)
 {
-    checkDeleteExtract(ec);
-    if (ec)
+    checkDeleteExtract(es);
+    if (es.hadException())
         return 0;
 
-    return processContents(EXTRACT_CONTENTS, ec);
+    return processContents(EXTRACT_CONTENTS, es);
 }
 
-PassRefPtr<DocumentFragment> Range::cloneContents(ExceptionCode& ec)
+PassRefPtr<DocumentFragment> Range::cloneContents(ExceptionState& es)
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
-    return processContents(CLONE_CONTENTS, ec);
+    return processContents(CLONE_CONTENTS, es);
 }
 
-void Range::insertNode(PassRefPtr<Node> prpNewNode, ExceptionCode& ec)
+void Range::insertNode(PassRefPtr<Node> prpNewNode, ExceptionState& es)
 {
     RefPtr<Node> newNode = prpNewNode;
 
-    ec = 0;
+    es.clearException();
 
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
     if (!newNode) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
 
@@ -961,7 +965,7 @@
     // an extra one here - if a text node is going to split, it must have a parent to insert into
     bool startIsText = m_start.container()->isTextNode();
     if (startIsText && !m_start.container()->parentNode()) {
-        ec = HierarchyRequestError;
+        es.throwDOMException(HierarchyRequestError);
         return;
     }
 
@@ -980,7 +984,7 @@
         numNewChildren = 0;
         for (Node* c = newNode->firstChild(); c; c = c->nextSibling()) {
             if (!checkAgainst->childTypeAllowed(c->nodeType())) {
-                ec = HierarchyRequestError;
+                es.throwDOMException(HierarchyRequestError);
                 return;
             }
             ++numNewChildren;
@@ -988,14 +992,14 @@
     } else {
         numNewChildren = 1;
         if (!checkAgainst->childTypeAllowed(newNodeType)) {
-            ec = HierarchyRequestError;
+            es.throwDOMException(HierarchyRequestError);
             return;
         }
     }
 
     for (Node* n = m_start.container(); n; n = n->parentNode()) {
         if (n == newNode) {
-            ec = HierarchyRequestError;
+            es.throwDOMException(HierarchyRequestError);
             return;
         }
     }
@@ -1006,11 +1010,11 @@
     case Node::ENTITY_NODE:
     case Node::NOTATION_NODE:
     case Node::DOCUMENT_NODE:
-        ec = InvalidNodeTypeError;
+        es.throwDOMException(InvalidNodeTypeError);
         return;
     default:
         if (newNode->isShadowRoot()) {
-            ec = InvalidNodeTypeError;
+            es.throwDOMException(InvalidNodeTypeError);
             return;
         }
         break;
@@ -1021,13 +1025,13 @@
     RefPtr<Node> container;
     if (startIsText) {
         container = m_start.container();
-        RefPtr<Text> newText = toText(container.get())->splitText(m_start.offset(), ec);
-        if (ec)
+        RefPtr<Text> newText = toText(container.get())->splitText(m_start.offset(), es);
+        if (es.hadException())
             return;
 
         container = m_start.container();
-        container->parentNode()->insertBefore(newNode.release(), newText.get(), ec);
-        if (ec)
+        container->parentNode()->insertBefore(newNode.release(), newText.get(), es);
+        if (es.hadException())
             return;
 
         if (collapsed)
@@ -1039,8 +1043,8 @@
 
         int startOffset = m_start.offset();
         container = m_start.container();
-        container->insertBefore(newNode.release(), container->childNode(startOffset), ec);
-        if (ec)
+        container->insertBefore(newNode.release(), container->childNode(startOffset), es);
+        if (es.hadException())
             return;
 
         if (collapsed && numNewChildren)
@@ -1048,10 +1052,10 @@
     }
 }
 
-String Range::toString(ExceptionCode& ec) const
+String Range::toString(ExceptionState& es) const
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return String();
     }
 
@@ -1088,20 +1092,20 @@
     return plainText(this);
 }
 
-PassRefPtr<DocumentFragment> Range::createContextualFragment(const String& markup, ExceptionCode& ec)
+PassRefPtr<DocumentFragment> Range::createContextualFragment(const String& markup, ExceptionState& es)
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
     Node* element = m_start.container()->isElementNode() ? m_start.container() : m_start.container()->parentNode();
     if (!element || !element->isHTMLElement()) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
-    RefPtr<DocumentFragment> fragment = WebCore::createContextualFragment(markup, toHTMLElement(element), AllowScriptingContentAndDoNotMarkAlreadyStarted, ec);
+    RefPtr<DocumentFragment> fragment = WebCore::createContextualFragment(markup, toHTMLElement(element), AllowScriptingContentAndDoNotMarkAlreadyStarted, es);
     if (!fragment)
         return 0;
 
@@ -1109,11 +1113,11 @@
 }
 
 
-void Range::detach(ExceptionCode& ec)
+void Range::detach(ExceptionState& es)
 {
     // Check first to see if we've already detached:
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
@@ -1123,23 +1127,23 @@
     m_end.clear();
 }
 
-Node* Range::checkNodeWOffset(Node* n, int offset, ExceptionCode& ec) const
+Node* Range::checkNodeWOffset(Node* n, int offset, ExceptionState& es) const
 {
     switch (n->nodeType()) {
         case Node::DOCUMENT_TYPE_NODE:
         case Node::ENTITY_NODE:
         case Node::NOTATION_NODE:
-            ec = InvalidNodeTypeError;
+            es.throwDOMException(InvalidNodeTypeError);
             return 0;
         case Node::CDATA_SECTION_NODE:
         case Node::COMMENT_NODE:
         case Node::TEXT_NODE:
             if (static_cast<unsigned>(offset) > static_cast<CharacterData*>(n)->length())
-                ec = IndexSizeError;
+                es.throwDOMException(IndexSizeError);
             return 0;
         case Node::PROCESSING_INSTRUCTION_NODE:
             if (static_cast<unsigned>(offset) > static_cast<ProcessingInstruction*>(n)->data().length())
-                ec = IndexSizeError;
+                es.throwDOMException(IndexSizeError);
             return 0;
         case Node::ATTRIBUTE_NODE:
         case Node::DOCUMENT_FRAGMENT_NODE:
@@ -1150,7 +1154,7 @@
                 return 0;
             Node* childBefore = n->childNode(offset - 1);
             if (!childBefore)
-                ec = IndexSizeError;
+                es.throwDOMException(IndexSizeError);
             return childBefore;
         }
     }
@@ -1158,7 +1162,7 @@
     return 0;
 }
 
-void Range::checkNodeBA(Node* n, ExceptionCode& ec) const
+void Range::checkNodeBA(Node* n, ExceptionState& es) const
 {
     // InvalidNodeTypeError: Raised if the root container of refNode is not an
     // Attr, Document, DocumentFragment or ShadowRoot node, or part of a SVG shadow DOM tree,
@@ -1170,7 +1174,7 @@
         case Node::DOCUMENT_NODE:
         case Node::ENTITY_NODE:
         case Node::NOTATION_NODE:
-            ec = InvalidNodeTypeError;
+            es.throwDOMException(InvalidNodeTypeError);
             return;
         case Node::CDATA_SECTION_NODE:
         case Node::COMMENT_NODE:
@@ -1200,90 +1204,90 @@
         case Node::PROCESSING_INSTRUCTION_NODE:
         case Node::TEXT_NODE:
         case Node::XPATH_NAMESPACE_NODE:
-            ec = InvalidNodeTypeError;
+            es.throwDOMException(InvalidNodeTypeError);
             return;
     }
 }
 
-PassRefPtr<Range> Range::cloneRange(ExceptionCode& ec) const
+PassRefPtr<Range> Range::cloneRange(ExceptionState& es) const
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
     return Range::create(m_ownerDocument, m_start.container(), m_start.offset(), m_end.container(), m_end.offset());
 }
 
-void Range::setStartAfter(Node* refNode, ExceptionCode& ec)
+void Range::setStartAfter(Node* refNode, ExceptionState& es)
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
     if (!refNode) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
 
-    ec = 0;
-    checkNodeBA(refNode, ec);
-    if (ec)
+    es.clearException();
+    checkNodeBA(refNode, es);
+    if (es.hadException())
         return;
 
-    setStart(refNode->parentNode(), refNode->nodeIndex() + 1, ec);
+    setStart(refNode->parentNode(), refNode->nodeIndex() + 1, es);
 }
 
-void Range::setEndBefore(Node* refNode, ExceptionCode& ec)
+void Range::setEndBefore(Node* refNode, ExceptionState& es)
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
     if (!refNode) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
 
-    ec = 0;
-    checkNodeBA(refNode, ec);
-    if (ec)
+    es.clearException();
+    checkNodeBA(refNode, es);
+    if (es.hadException())
         return;
 
-    setEnd(refNode->parentNode(), refNode->nodeIndex(), ec);
+    setEnd(refNode->parentNode(), refNode->nodeIndex(), es);
 }
 
-void Range::setEndAfter(Node* refNode, ExceptionCode& ec)
+void Range::setEndAfter(Node* refNode, ExceptionState& es)
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
     if (!refNode) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
 
-    ec = 0;
-    checkNodeBA(refNode, ec);
-    if (ec)
+    es.clearException();
+    checkNodeBA(refNode, es);
+    if (es.hadException())
         return;
 
-    setEnd(refNode->parentNode(), refNode->nodeIndex() + 1, ec);
+    setEnd(refNode->parentNode(), refNode->nodeIndex() + 1, es);
 }
 
-void Range::selectNode(Node* refNode, ExceptionCode& ec)
+void Range::selectNode(Node* refNode, ExceptionState& es)
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
     if (!refNode) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
 
@@ -1305,7 +1309,7 @@
             case Node::DOCUMENT_TYPE_NODE:
             case Node::ENTITY_NODE:
             case Node::NOTATION_NODE:
-                ec = InvalidNodeTypeError;
+                es.throwDOMException(InvalidNodeTypeError);
                 return;
         }
     }
@@ -1324,29 +1328,29 @@
         case Node::DOCUMENT_NODE:
         case Node::ENTITY_NODE:
         case Node::NOTATION_NODE:
-            ec = InvalidNodeTypeError;
+            es.throwDOMException(InvalidNodeTypeError);
             return;
     }
 
     if (m_ownerDocument != refNode->document())
         setDocument(refNode->document());
 
-    ec = 0;
-    setStartBefore(refNode, ec);
-    if (ec)
+    es.clearException();
+    setStartBefore(refNode, es);
+    if (es.hadException())
         return;
-    setEndAfter(refNode, ec);
+    setEndAfter(refNode, es);
 }
 
-void Range::selectNodeContents(Node* refNode, ExceptionCode& ec)
+void Range::selectNodeContents(Node* refNode, ExceptionState& es)
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
     if (!refNode) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
 
@@ -1367,7 +1371,7 @@
             case Node::DOCUMENT_TYPE_NODE:
             case Node::ENTITY_NODE:
             case Node::NOTATION_NODE:
-                ec = InvalidNodeTypeError;
+                es.throwDOMException(InvalidNodeTypeError);
                 return;
         }
     }
@@ -1379,17 +1383,17 @@
     m_end.setToEndOfNode(refNode);
 }
 
-void Range::surroundContents(PassRefPtr<Node> passNewParent, ExceptionCode& ec)
+void Range::surroundContents(PassRefPtr<Node> passNewParent, ExceptionState& es)
 {
     RefPtr<Node> newParent = passNewParent;
 
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
     if (!newParent) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
 
@@ -1402,7 +1406,7 @@
         case Node::DOCUMENT_TYPE_NODE:
         case Node::ENTITY_NODE:
         case Node::NOTATION_NODE:
-            ec = InvalidNodeTypeError;
+            es.throwDOMException(InvalidNodeTypeError);
             return;
         case Node::CDATA_SECTION_NODE:
         case Node::COMMENT_NODE:
@@ -1422,12 +1426,12 @@
     if (parentOfNewParent->isCharacterDataNode())
         parentOfNewParent = parentOfNewParent->parentNode();
     if (!parentOfNewParent || !parentOfNewParent->childTypeAllowed(newParent->nodeType())) {
-        ec = HierarchyRequestError;
+        es.throwDOMException(HierarchyRequestError);
         return;
     }
 
     if (newParent->contains(m_start.container())) {
-        ec = HierarchyRequestError;
+        es.throwDOMException(HierarchyRequestError);
         return;
     }
 
@@ -1442,63 +1446,63 @@
     if (endNonTextContainer->nodeType() == Node::TEXT_NODE)
         endNonTextContainer = endNonTextContainer->parentNode();
     if (startNonTextContainer != endNonTextContainer) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
-    ec = 0;
+    es.clearException();
     while (Node* n = newParent->firstChild()) {
-        toContainerNode(newParent.get())->removeChild(n, ec);
-        if (ec)
+        toContainerNode(newParent.get())->removeChild(n, es);
+        if (es.hadException())
             return;
     }
-    RefPtr<DocumentFragment> fragment = extractContents(ec);
-    if (ec)
+    RefPtr<DocumentFragment> fragment = extractContents(es);
+    if (es.hadException())
         return;
-    insertNode(newParent, ec);
-    if (ec)
+    insertNode(newParent, es);
+    if (es.hadException())
         return;
-    newParent->appendChild(fragment.release(), ec);
-    if (ec)
+    newParent->appendChild(fragment.release(), es);
+    if (es.hadException())
         return;
-    selectNode(newParent.get(), ec);
+    selectNode(newParent.get(), es);
 }
 
-void Range::setStartBefore(Node* refNode, ExceptionCode& ec)
+void Range::setStartBefore(Node* refNode, ExceptionState& es)
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
     if (!refNode) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
 
-    ec = 0;
-    checkNodeBA(refNode, ec);
-    if (ec)
+    es.clearException();
+    checkNodeBA(refNode, es);
+    if (es.hadException())
         return;
 
-    setStart(refNode->parentNode(), refNode->nodeIndex(), ec);
+    setStart(refNode->parentNode(), refNode->nodeIndex(), es);
 }
 
-void Range::checkDeleteExtract(ExceptionCode& ec)
+void Range::checkDeleteExtract(ExceptionState& es)
 {
     if (!m_start.container()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
-    ec = 0;
-    if (!commonAncestorContainer(ec) || ec)
+    es.clearException();
+    if (!commonAncestorContainer(es) || es)
         return;
 
     Node* pastLast = pastLastNode();
     for (Node* n = firstNode(); n != pastLast; n = NodeTraversal::next(n)) {
         if (n->nodeType() == Node::DOCUMENT_TYPE_NODE) {
-            ec = HierarchyRequestError;
+            es.throwDOMException(HierarchyRequestError);
             return;
         }
     }
@@ -1648,8 +1652,7 @@
 {
     ASSERT(node);
     RefPtr<Range> range = Range::create(node->document());
-    int exception = 0;
-    range->selectNodeContents(node, exception);
+    range->selectNodeContents(node, IGNORE_EXCEPTION_STATE);
     return range.release();
 }
 
@@ -1819,7 +1822,7 @@
     boundaryTextNodesSplit(m_end, oldNode);
 }
 
-void Range::expand(const String& unit, ExceptionCode& ec)
+void Range::expand(const String& unit, ExceptionState& es)
 {
     VisiblePosition start(startPosition());
     VisiblePosition end(endPosition());
@@ -1837,8 +1840,8 @@
         end = endOfDocument(end);
     } else
         return;
-    setStart(start.deepEquivalent().containerNode(), start.deepEquivalent().computeOffsetInContainerNode(), ec);
-    setEnd(end.deepEquivalent().containerNode(), end.deepEquivalent().computeOffsetInContainerNode(), ec);
+    setStart(start.deepEquivalent().containerNode(), start.deepEquivalent().computeOffsetInContainerNode(), es);
+    setEnd(end.deepEquivalent().containerNode(), end.deepEquivalent().computeOffsetInContainerNode(), es);
 }
 
 PassRefPtr<ClientRectList> Range::getClientRects() const
diff --git a/Source/core/dom/Range.h b/Source/core/dom/Range.h
index 1591515..f496cb7 100644
--- a/Source/core/dom/Range.h
+++ b/Source/core/dom/Range.h
@@ -25,8 +25,8 @@
 #ifndef Range_h
 #define Range_h
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "bindings/v8/ScriptWrappable.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/RangeBoundaryPoint.h"
 #include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/IntRect.h"
@@ -41,6 +41,7 @@
 class ContainerNode;
 class Document;
 class DocumentFragment;
+class ExceptionState;
 class FloatQuad;
 class Node;
 class NodeWithIndex;
@@ -59,53 +60,53 @@
     Node* endContainer() const { return m_end.container(); }
     int endOffset() const { return m_end.offset(); }
 
-    Node* startContainer(ExceptionCode&) const;
-    int startOffset(ExceptionCode&) const;
-    Node* endContainer(ExceptionCode&) const;
-    int endOffset(ExceptionCode&) const;
-    bool collapsed(ExceptionCode&) const;
+    Node* startContainer(ExceptionState&) const;
+    int startOffset(ExceptionState&) const;
+    Node* endContainer(ExceptionState&) const;
+    int endOffset(ExceptionState&) const;
+    bool collapsed(ExceptionState&) const;
 
-    Node* commonAncestorContainer(ExceptionCode&) const;
+    Node* commonAncestorContainer(ExceptionState&) const;
     static Node* commonAncestorContainer(Node* containerA, Node* containerB);
-    void setStart(PassRefPtr<Node> container, int offset, ExceptionCode& = ASSERT_NO_EXCEPTION);
-    void setEnd(PassRefPtr<Node> container, int offset, ExceptionCode& = ASSERT_NO_EXCEPTION);
-    void collapse(bool toStart, ExceptionCode&);
-    bool isPointInRange(Node* refNode, int offset, ExceptionCode&);
-    short comparePoint(Node* refNode, int offset, ExceptionCode&) const;
+    void setStart(PassRefPtr<Node> container, int offset, ExceptionState& = ASSERT_NO_EXCEPTION_STATE);
+    void setEnd(PassRefPtr<Node> container, int offset, ExceptionState& = ASSERT_NO_EXCEPTION_STATE);
+    void collapse(bool toStart, ExceptionState&);
+    bool isPointInRange(Node* refNode, int offset, ExceptionState&);
+    short comparePoint(Node* refNode, int offset, ExceptionState&) const;
     enum CompareResults { NODE_BEFORE, NODE_AFTER, NODE_BEFORE_AND_AFTER, NODE_INSIDE };
-    CompareResults compareNode(Node* refNode, ExceptionCode&) const;
+    CompareResults compareNode(Node* refNode, ExceptionState&) const;
     enum CompareHow { START_TO_START, START_TO_END, END_TO_END, END_TO_START };
-    short compareBoundaryPoints(CompareHow, const Range* sourceRange, ExceptionCode&) const;
-    static short compareBoundaryPoints(Node* containerA, int offsetA, Node* containerB, int offsetB, ExceptionCode&);
-    static short compareBoundaryPoints(const RangeBoundaryPoint& boundaryA, const RangeBoundaryPoint& boundaryB, ExceptionCode&);
+    short compareBoundaryPoints(CompareHow, const Range* sourceRange, ExceptionState&) const;
+    static short compareBoundaryPoints(Node* containerA, int offsetA, Node* containerB, int offsetB, ExceptionState&);
+    static short compareBoundaryPoints(const RangeBoundaryPoint& boundaryA, const RangeBoundaryPoint& boundaryB, ExceptionState&);
     bool boundaryPointsValid() const;
-    bool intersectsNode(Node* refNode, ExceptionCode&);
-    void deleteContents(ExceptionCode&);
-    PassRefPtr<DocumentFragment> extractContents(ExceptionCode&);
-    PassRefPtr<DocumentFragment> cloneContents(ExceptionCode&);
-    void insertNode(PassRefPtr<Node>, ExceptionCode&);
-    String toString(ExceptionCode&) const;
+    bool intersectsNode(Node* refNode, ExceptionState&);
+    void deleteContents(ExceptionState&);
+    PassRefPtr<DocumentFragment> extractContents(ExceptionState&);
+    PassRefPtr<DocumentFragment> cloneContents(ExceptionState&);
+    void insertNode(PassRefPtr<Node>, ExceptionState&);
+    String toString(ExceptionState&) const;
 
     String toHTML() const;
     String text() const;
 
-    PassRefPtr<DocumentFragment> createContextualFragment(const String& html, ExceptionCode&);
+    PassRefPtr<DocumentFragment> createContextualFragment(const String& html, ExceptionState&);
 
-    void detach(ExceptionCode&);
-    PassRefPtr<Range> cloneRange(ExceptionCode&) const;
+    void detach(ExceptionState&);
+    PassRefPtr<Range> cloneRange(ExceptionState&) const;
 
-    void setStartAfter(Node*, ExceptionCode& = ASSERT_NO_EXCEPTION);
-    void setEndBefore(Node*, ExceptionCode& = ASSERT_NO_EXCEPTION);
-    void setEndAfter(Node*, ExceptionCode& = ASSERT_NO_EXCEPTION);
-    void selectNode(Node*, ExceptionCode& = ASSERT_NO_EXCEPTION);
-    void selectNodeContents(Node*, ExceptionCode&);
-    void surroundContents(PassRefPtr<Node>, ExceptionCode&);
-    void setStartBefore(Node*, ExceptionCode&);
+    void setStartAfter(Node*, ExceptionState& = ASSERT_NO_EXCEPTION_STATE);
+    void setEndBefore(Node*, ExceptionState& = ASSERT_NO_EXCEPTION_STATE);
+    void setEndAfter(Node*, ExceptionState& = ASSERT_NO_EXCEPTION_STATE);
+    void selectNode(Node*, ExceptionState& = ASSERT_NO_EXCEPTION_STATE);
+    void selectNodeContents(Node*, ExceptionState&);
+    void surroundContents(PassRefPtr<Node>, ExceptionState&);
+    void setStartBefore(Node*, ExceptionState&);
 
     const Position startPosition() const { return m_start.toPosition(); }
     const Position endPosition() const { return m_end.toPosition(); }
-    void setStart(const Position&, ExceptionCode& = ASSERT_NO_EXCEPTION);
-    void setEnd(const Position&, ExceptionCode& = ASSERT_NO_EXCEPTION);
+    void setStart(const Position&, ExceptionState& = ASSERT_NO_EXCEPTION_STATE);
+    void setEnd(const Position&, ExceptionState& = ASSERT_NO_EXCEPTION_STATE);
 
     Node* firstNode() const;
     Node* pastLastNode() const;
@@ -139,7 +140,7 @@
     // Expand range to a unit (word or sentence or block or document) boundary.
     // Please refer to https://bugs.webkit.org/show_bug.cgi?id=27632 comment #5
     // for details.
-    void expand(const String&, ExceptionCode&);
+    void expand(const String&, ExceptionState&);
 
     PassRefPtr<ClientRectList> getClientRects() const;
     PassRefPtr<ClientRect> getBoundingClientRect() const;
@@ -154,18 +155,18 @@
 
     void setDocument(Document*);
 
-    Node* checkNodeWOffset(Node*, int offset, ExceptionCode&) const;
-    void checkNodeBA(Node*, ExceptionCode&) const;
-    void checkDeleteExtract(ExceptionCode&);
+    Node* checkNodeWOffset(Node*, int offset, ExceptionState&) const;
+    void checkNodeBA(Node*, ExceptionState&) const;
+    void checkDeleteExtract(ExceptionState&);
     int maxStartOffset() const;
     int maxEndOffset() const;
 
     enum ActionType { DELETE_CONTENTS, EXTRACT_CONTENTS, CLONE_CONTENTS };
-    PassRefPtr<DocumentFragment> processContents(ActionType, ExceptionCode&);
-    static PassRefPtr<Node> processContentsBetweenOffsets(ActionType, PassRefPtr<DocumentFragment>, Node*, unsigned startOffset, unsigned endOffset, ExceptionCode&);
-    static void processNodes(ActionType, Vector<RefPtr<Node> >&, PassRefPtr<Node> oldContainer, PassRefPtr<Node> newContainer, ExceptionCode&);
+    PassRefPtr<DocumentFragment> processContents(ActionType, ExceptionState&);
+    static PassRefPtr<Node> processContentsBetweenOffsets(ActionType, PassRefPtr<DocumentFragment>, Node*, unsigned startOffset, unsigned endOffset, ExceptionState&);
+    static void processNodes(ActionType, Vector<RefPtr<Node> >&, PassRefPtr<Node> oldContainer, PassRefPtr<Node> newContainer, ExceptionState&);
     enum ContentsProcessDirection { ProcessContentsForward, ProcessContentsBackward };
-    static PassRefPtr<Node> processAncestorsAndTheirSiblings(ActionType, Node* container, ContentsProcessDirection, PassRefPtr<Node> clonedContainer, Node* commonRoot, ExceptionCode&);
+    static PassRefPtr<Node> processAncestorsAndTheirSiblings(ActionType, Node* container, ContentsProcessDirection, PassRefPtr<Node> clonedContainer, Node* commonRoot, ExceptionState&);
 
     RefPtr<Document> m_ownerDocument;
     RangeBoundaryPoint m_start;
diff --git a/Source/core/dom/SelectorQuery.cpp b/Source/core/dom/SelectorQuery.cpp
index 87b6d81..9e99139 100644
--- a/Source/core/dom/SelectorQuery.cpp
+++ b/Source/core/dom/SelectorQuery.cpp
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "core/dom/SelectorQuery.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/css/CSSParser.h"
 #include "core/css/CSSSelectorList.h"
 #include "core/css/SelectorChecker.h"
@@ -479,7 +480,7 @@
     return m_selectors.queryFirst(rootNode);
 }
 
-SelectorQuery* SelectorQueryCache::add(const AtomicString& selectors, Document* document, ExceptionCode& ec)
+SelectorQuery* SelectorQueryCache::add(const AtomicString& selectors, Document* document, ExceptionState& es)
 {
     HashMap<AtomicString, OwnPtr<SelectorQuery> >::iterator it = m_entries.find(selectors);
     if (it != m_entries.end())
@@ -490,13 +491,13 @@
     parser.parseSelector(selectors, selectorList);
 
     if (!selectorList.first() || selectorList.hasInvalidSelector()) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return 0;
     }
 
     // throw a NamespaceError if the selector includes any namespace prefixes.
     if (selectorList.selectorsNeedNamespaceResolution()) {
-        ec = NamespaceError;
+        es.throwDOMException(NamespaceError);
         return 0;
     }
 
diff --git a/Source/core/dom/SelectorQuery.h b/Source/core/dom/SelectorQuery.h
index 2e3bbe4..66f12a6 100644
--- a/Source/core/dom/SelectorQuery.h
+++ b/Source/core/dom/SelectorQuery.h
@@ -33,11 +33,10 @@
 
 namespace WebCore {
 
-typedef int ExceptionCode;
-
 class CSSSelector;
 class Document;
 class Element;
+class ExceptionState;
 class Node;
 class NodeList;
 class SimpleNodeList;
@@ -89,7 +88,7 @@
 class SelectorQueryCache {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    SelectorQuery* add(const AtomicString&, Document*, ExceptionCode&);
+    SelectorQuery* add(const AtomicString&, Document*, ExceptionState&);
     void invalidate();
 
 private:
diff --git a/Source/core/dom/Text.cpp b/Source/core/dom/Text.cpp
index 05d6e80..dce6f09 100644
--- a/Source/core/dom/Text.cpp
+++ b/Source/core/dom/Text.cpp
@@ -23,9 +23,10 @@
 #include "core/dom/Text.h"
 
 #include "SVGNames.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/css/resolver/StyleResolver.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/NodeRenderStyle.h"
 #include "core/dom/NodeRenderingContext.h"
 #include "core/dom/ScopedEventQueue.h"
@@ -50,14 +51,14 @@
     return adoptRef(new Text(document, data, CreateEditingText));
 }
 
-PassRefPtr<Text> Text::splitText(unsigned offset, ExceptionCode& ec)
+PassRefPtr<Text> Text::splitText(unsigned offset, ExceptionState& es)
 {
-    ec = 0;
+    es.clearException();
 
     // IndexSizeError: Raised if the specified offset is negative or greater than
     // the number of 16-bit units in data.
     if (offset > length()) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return 0;
     }
 
@@ -69,8 +70,8 @@
     didModifyData(oldStr);
 
     if (parentNode())
-        parentNode()->insertBefore(newText.get(), nextSibling(), ec);
-    if (ec)
+        parentNode()->insertBefore(newText.get(), nextSibling(), es);
+    if (es.hadException())
         return 0;
 
     if (parentNode())
@@ -154,7 +155,7 @@
     for (RefPtr<Node> n = startText; n && n != this && n->isTextNode() && n->parentNode() == parent;) {
         RefPtr<Node> nodeToRemove(n.release());
         n = nodeToRemove->nextSibling();
-        parent->removeChild(nodeToRemove.get(), IGNORE_EXCEPTION);
+        parent->removeChild(nodeToRemove.get(), IGNORE_EXCEPTION_STATE);
     }
 
     if (this != endText) {
@@ -162,13 +163,13 @@
         for (RefPtr<Node> n = nextSibling(); n && n != onePastEndText && n->isTextNode() && n->parentNode() == parent;) {
             RefPtr<Node> nodeToRemove(n.release());
             n = nodeToRemove->nextSibling();
-            parent->removeChild(nodeToRemove.get(), IGNORE_EXCEPTION);
+            parent->removeChild(nodeToRemove.get(), IGNORE_EXCEPTION_STATE);
         }
     }
 
     if (newText.isEmpty()) {
         if (parent && parentNode() == parent)
-            parent->removeChild(this, IGNORE_EXCEPTION);
+            parent->removeChild(this, IGNORE_EXCEPTION_STATE);
         return 0;
     }
 
diff --git a/Source/core/dom/Text.h b/Source/core/dom/Text.h
index 1ca47b8..2384fbd 100644
--- a/Source/core/dom/Text.h
+++ b/Source/core/dom/Text.h
@@ -27,6 +27,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class RenderText;
 class ScriptExecutionContext;
 
@@ -38,7 +39,7 @@
     static PassRefPtr<Text> createWithLengthLimit(Document*, const String&, unsigned positionInString, unsigned lengthLimit = defaultLengthLimit);
     static PassRefPtr<Text> createEditingText(Document*, const String&);
 
-    PassRefPtr<Text> splitText(unsigned offset, ExceptionCode&);
+    PassRefPtr<Text> splitText(unsigned offset, ExceptionState&);
 
     // DOM Level 3: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-1312295772
 
diff --git a/Source/core/dom/Text.idl b/Source/core/dom/Text.idl
index 8ed5b8d..aa82a41 100644
--- a/Source/core/dom/Text.idl
+++ b/Source/core/dom/Text.idl
@@ -23,10 +23,9 @@
 ] interface Text : CharacterData {
 
     // DOM Level 1
-
-    [RaisesException] Text splitText([IsIndex,Default=Undefined] optional unsigned long offset);
+    [RaisesException] Text splitText(unsigned long offset);
 
     // Introduced in DOM Level 3:
     readonly attribute DOMString       wholeText;
-    Text                               replaceWholeText([Default=Undefined] optional DOMString content);
+    Text                               replaceWholeText(DOMString content); // Removed from DOM4.
 };
diff --git a/Source/core/dom/TreeScope.cpp b/Source/core/dom/TreeScope.cpp
index 042539e..6afde25 100644
--- a/Source/core/dom/TreeScope.cpp
+++ b/Source/core/dom/TreeScope.cpp
@@ -55,7 +55,7 @@
 
 struct SameSizeAsTreeScope {
     virtual ~SameSizeAsTreeScope();
-    void* pointers[9];
+    void* pointers[8];
     int ints[1];
 };
 
@@ -162,29 +162,6 @@
     m_idTargetObserverRegistry->notifyObservers(elementId);
 }
 
-Element* TreeScope::getElementByName(const AtomicString& name) const
-{
-    if (name.isEmpty())
-        return 0;
-    if (!m_elementsByName)
-        return 0;
-    return m_elementsByName->getElementByName(name.impl(), this);
-}
-
-void TreeScope::addElementByName(const AtomicString& name, Element* element)
-{
-    if (!m_elementsByName)
-        m_elementsByName = adoptPtr(new DocumentOrderedMap);
-    m_elementsByName->add(name.impl(), element);
-}
-
-void TreeScope::removeElementByName(const AtomicString& name, Element* element)
-{
-    if (!m_elementsByName)
-        return;
-    m_elementsByName->remove(name.impl(), element);
-}
-
 Node* TreeScope::ancestorInThisScope(Node* node) const
 {
     while (node) {
diff --git a/Source/core/dom/TreeScope.h b/Source/core/dom/TreeScope.h
index 8edba5e..54144ab 100644
--- a/Source/core/dom/TreeScope.h
+++ b/Source/core/dom/TreeScope.h
@@ -56,17 +56,11 @@
 
     Element* adjustedFocusedElement();
     Element* getElementById(const AtomicString&) const;
-    bool hasElementWithId(const AtomicString&) const;
+    bool hasElementWithId(StringImpl* id) const;
     bool containsMultipleElementsWithId(const AtomicString& id) const;
     void addElementById(const AtomicString& elementId, Element*);
     void removeElementById(const AtomicString& elementId, Element*);
 
-    Element* getElementByName(const AtomicString&) const;
-    bool hasElementWithName(const AtomicString&) const;
-    bool containsMultipleElementsWithName(const AtomicString&) const;
-    void addElementByName(const AtomicString&, Element*);
-    void removeElementByName(const AtomicString&, Element*);
-
     Document* documentScope() const { return m_documentScope; }
 
     Node* ancestorInThisScope(Node*) const;
@@ -172,7 +166,6 @@
     int m_guardRefCount;
 
     OwnPtr<DocumentOrderedMap> m_elementsById;
-    OwnPtr<DocumentOrderedMap> m_elementsByName;
     OwnPtr<DocumentOrderedMap> m_imageMapsByName;
     OwnPtr<DocumentOrderedMap> m_labelsByForAttribute;
 
@@ -181,27 +174,15 @@
     mutable RefPtr<DOMSelection> m_selection;
 };
 
-inline bool TreeScope::hasElementWithId(const AtomicString& id) const
+inline bool TreeScope::hasElementWithId(StringImpl* id) const
 {
-    ASSERT(id.impl());
-    return m_elementsById && m_elementsById->contains(id.impl());
+    ASSERT(id);
+    return m_elementsById && m_elementsById->contains(id);
 }
 
 inline bool TreeScope::containsMultipleElementsWithId(const AtomicString& id) const
 {
-    return m_elementsById && m_elementsById->mightContainMultiple(id.impl());
-}
-
-inline bool TreeScope::hasElementWithName(const AtomicString& id) const
-{
-    ASSERT(id.impl());
-    return m_elementsByName && m_elementsByName->contains(id.impl());
-}
-
-inline bool TreeScope::containsMultipleElementsWithName(const AtomicString& name) const
-{
-    ASSERT(name.impl());
-    return m_elementsByName && m_elementsByName->mightContainMultiple(name.impl());
+    return m_elementsById && m_elementsById->containsMultiple(id.impl());
 }
 
 Node* nodeFromPoint(Document*, int x, int y, LayoutPoint* localPoint = 0);
diff --git a/Source/core/dom/TreeWalker.cpp b/Source/core/dom/TreeWalker.cpp
index 626a4fc..bc0b775 100644
--- a/Source/core/dom/TreeWalker.cpp
+++ b/Source/core/dom/TreeWalker.cpp
@@ -25,6 +25,7 @@
 #include "config.h"
 #include "core/dom/TreeWalker.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "bindings/v8/ScriptState.h"
 #include "core/dom/ContainerNode.h"
 #include "core/dom/ExceptionCode.h"
@@ -41,10 +42,10 @@
     ScriptWrappable::init(this);
 }
 
-void TreeWalker::setCurrentNode(PassRefPtr<Node> node, ExceptionCode& ec)
+void TreeWalker::setCurrentNode(PassRefPtr<Node> node, ExceptionState& es)
 {
     if (!node) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
     m_current = node;
diff --git a/Source/core/dom/TreeWalker.h b/Source/core/dom/TreeWalker.h
index 9fcc954..354e449 100644
--- a/Source/core/dom/TreeWalker.h
+++ b/Source/core/dom/TreeWalker.h
@@ -33,33 +33,33 @@
 
 namespace WebCore {
 
-    typedef int ExceptionCode;
+class ExceptionState;
 
-    class TreeWalker : public ScriptWrappable, public RefCounted<TreeWalker>, public Traversal {
-    public:
-        static PassRefPtr<TreeWalker> create(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<NodeFilter> filter)
-        {
-            return adoptRef(new TreeWalker(rootNode, whatToShow, filter));
-        }
+class TreeWalker : public ScriptWrappable, public RefCounted<TreeWalker>, public Traversal {
+public:
+    static PassRefPtr<TreeWalker> create(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<NodeFilter> filter)
+    {
+        return adoptRef(new TreeWalker(rootNode, whatToShow, filter));
+    }
 
-        Node* currentNode() const { return m_current.get(); }
-        void setCurrentNode(PassRefPtr<Node>, ExceptionCode&);
+    Node* currentNode() const { return m_current.get(); }
+    void setCurrentNode(PassRefPtr<Node>, ExceptionState&);
 
-        Node* parentNode(ScriptState*);
-        Node* firstChild(ScriptState*);
-        Node* lastChild(ScriptState*);
-        Node* previousSibling(ScriptState*);
-        Node* nextSibling(ScriptState*);
-        Node* previousNode(ScriptState*);
-        Node* nextNode(ScriptState*);
+    Node* parentNode(ScriptState*);
+    Node* firstChild(ScriptState*);
+    Node* lastChild(ScriptState*);
+    Node* previousSibling(ScriptState*);
+    Node* nextSibling(ScriptState*);
+    Node* previousNode(ScriptState*);
+    Node* nextNode(ScriptState*);
 
-    private:
-        TreeWalker(PassRefPtr<Node>, unsigned whatToShow, PassRefPtr<NodeFilter>);
+private:
+    TreeWalker(PassRefPtr<Node>, unsigned whatToShow, PassRefPtr<NodeFilter>);
 
-        Node* setCurrent(PassRefPtr<Node>);
+    Node* setCurrent(PassRefPtr<Node>);
 
-        RefPtr<Node> m_current;
-    };
+    RefPtr<Node> m_current;
+};
 
 } // namespace WebCore
 
diff --git a/Source/core/dom/shadow/ShadowRoot.cpp b/Source/core/dom/shadow/ShadowRoot.cpp
index b993e91..e6d22f4 100644
--- a/Source/core/dom/shadow/ShadowRoot.cpp
+++ b/Source/core/dom/shadow/ShadowRoot.cpp
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "core/dom/shadow/ShadowRoot.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/css/resolver/StyleResolver.h"
 #include "core/dom/Text.h"
 #include "core/dom/shadow/ContentDistributor.h"
@@ -106,9 +107,9 @@
     return older;
 }
 
-PassRefPtr<Node> ShadowRoot::cloneNode(bool, ExceptionCode& ec)
+PassRefPtr<Node> ShadowRoot::cloneNode(bool, ExceptionState& es)
 {
-    ec = DataCloneError;
+    es.throwDOMException(DataCloneError);
     return 0;
 }
 
@@ -117,15 +118,15 @@
     return createMarkup(this, ChildrenOnly);
 }
 
-void ShadowRoot::setInnerHTML(const String& markup, ExceptionCode& ec)
+void ShadowRoot::setInnerHTML(const String& markup, ExceptionState& es)
 {
     if (isOrphan()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
 
-    if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, host(), AllowScriptingContent, ec))
-        replaceChildrenWithFragment(this, fragment.release(), ec);
+    if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, host(), AllowScriptingContent, es))
+        replaceChildrenWithFragment(this, fragment.release(), es);
 }
 
 bool ShadowRoot::childTypeAllowed(NodeType type) const
@@ -161,7 +162,7 @@
     // When we're set to lazyAttach we'll have a SubtreeStyleChange and we'll need
     // to promote the change to a Force for all our descendants so they get a
     // recalc and will attach.
-    if (styleChangeType() == SubtreeStyleChange)
+    if (styleChangeType() >= SubtreeStyleChange)
         change = Force;
 
     // FIXME: This doesn't handle :hover + div properly like Element::recalcStyle does.
diff --git a/Source/core/dom/shadow/ShadowRoot.h b/Source/core/dom/shadow/ShadowRoot.h
index 3759557..f1bedcc 100644
--- a/Source/core/dom/shadow/ShadowRoot.h
+++ b/Source/core/dom/shadow/ShadowRoot.h
@@ -31,13 +31,13 @@
 #include "core/dom/Document.h"
 #include "core/dom/DocumentFragment.h"
 #include "core/dom/Element.h"
-#include "core/dom/ExceptionCode.h"
 #include "core/dom/TreeScope.h"
 #include "wtf/DoublyLinkedList.h"
 
 namespace WebCore {
 
 class ElementShadow;
+class ExceptionState;
 class InsertionPoint;
 class ScopeContentDistribution;
 
@@ -69,7 +69,7 @@
     ElementShadow* owner() const { return host() ? host()->shadow() : 0; }
 
     String innerHTML() const;
-    void setInnerHTML(const String&, ExceptionCode&);
+    void setInnerHTML(const String&, ExceptionState&);
 
     Element* activeElement() const;
 
@@ -102,8 +102,8 @@
 
     ShadowRootType type() const { return static_cast<ShadowRootType>(m_type); }
 
-    PassRefPtr<Node> cloneNode(bool, ExceptionCode&);
-    PassRefPtr<Node> cloneNode(ExceptionCode& ec) { return cloneNode(true, ec); }
+    PassRefPtr<Node> cloneNode(bool, ExceptionState&);
+    PassRefPtr<Node> cloneNode(ExceptionState& es) { return cloneNode(true, es); }
 
 private:
     ShadowRoot(Document*, ShadowRootType);
diff --git a/Source/core/editing/AppendNodeCommand.cpp b/Source/core/editing/AppendNodeCommand.cpp
index ef9dcd4..264b586 100644
--- a/Source/core/editing/AppendNodeCommand.cpp
+++ b/Source/core/editing/AppendNodeCommand.cpp
@@ -26,9 +26,9 @@
 #include "config.h"
 #include "core/editing/AppendNodeCommand.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/accessibility/AXObjectCache.h"
 #include "core/dom/Document.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 
 namespace WebCore {
 
@@ -60,7 +60,7 @@
     if (!m_parent->rendererIsEditable() && m_parent->attached())
         return;
 
-    m_parent->appendChild(m_node.get(), IGNORE_EXCEPTION, AttachLazily);
+    m_parent->appendChild(m_node.get(), IGNORE_EXCEPTION_STATE, AttachLazily);
 
     if (AXObjectCache::accessibilityEnabled())
         sendAXTextChangedIgnoringLineBreaks(m_node.get(), AXObjectCache::AXTextInserted);
@@ -75,7 +75,7 @@
     if (AXObjectCache::accessibilityEnabled())
         sendAXTextChangedIgnoringLineBreaks(m_node.get(), AXObjectCache::AXTextDeleted);
 
-    m_node->remove(IGNORE_EXCEPTION);
+    m_node->remove(IGNORE_EXCEPTION_STATE);
 }
 
 #ifndef NDEBUG
diff --git a/Source/core/editing/ApplyBlockElementCommand.cpp b/Source/core/editing/ApplyBlockElementCommand.cpp
index ba071e3..a5c1c23 100644
--- a/Source/core/editing/ApplyBlockElementCommand.cpp
+++ b/Source/core/editing/ApplyBlockElementCommand.cpp
@@ -28,6 +28,7 @@
 #include "core/editing/ApplyBlockElementCommand.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Text.h"
 #include "core/editing/VisiblePosition.h"
 #include "core/editing/VisibleUnits.h"
@@ -160,9 +161,9 @@
     if (!textNode || !textNode->isTextNode() || offset < 0 || offset >= textNode->maxCharacterOffset())
         return false;
 
-    ExceptionCode ec = 0;
-    String textAtPosition = toText(textNode)->substringData(offset, 1, ec);
-    if (ec)
+    TrackExceptionState es;
+    String textAtPosition = toText(textNode)->substringData(offset, 1, es);
+    if (es.hadException())
         return false;
 
     return textAtPosition[0] == '\n';
diff --git a/Source/core/editing/CompositeEditCommand.cpp b/Source/core/editing/CompositeEditCommand.cpp
index 1ff5ef6..34e26cf 100644
--- a/Source/core/editing/CompositeEditCommand.cpp
+++ b/Source/core/editing/CompositeEditCommand.cpp
@@ -27,10 +27,10 @@
 #include "core/editing/CompositeEditCommand.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Document.h"
 #include "core/dom/DocumentFragment.h"
 #include "core/dom/DocumentMarkerController.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/Range.h"
 #include "core/dom/ScopedEventQueue.h"
@@ -890,7 +890,7 @@
 PassRefPtr<Node> CompositeEditCommand::insertNewDefaultParagraphElementAt(const Position& position)
 {
     RefPtr<Element> paragraphElement = createDefaultParagraphElement(document());
-    paragraphElement->appendChild(createBreakElement(document()), IGNORE_EXCEPTION);
+    paragraphElement->appendChild(createBreakElement(document()), IGNORE_EXCEPTION_STATE);
     insertNodeAt(paragraphElement, position);
     return paragraphElement.release();
 }
diff --git a/Source/core/editing/DeleteFromTextNodeCommand.cpp b/Source/core/editing/DeleteFromTextNodeCommand.cpp
index 2841a49..97bf22b 100644
--- a/Source/core/editing/DeleteFromTextNodeCommand.cpp
+++ b/Source/core/editing/DeleteFromTextNodeCommand.cpp
@@ -24,11 +24,11 @@
  */
 
 #include "config.h"
-#include "core/dom/Document.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/editing/DeleteFromTextNodeCommand.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/accessibility/AXObjectCache.h"
+#include "core/dom/Document.h"
 #include "core/dom/Text.h"
 
 namespace WebCore {
@@ -51,16 +51,16 @@
     if (!m_node->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable))
         return;
 
-    ExceptionCode ec = 0;
-    m_text = m_node->substringData(m_offset, m_count, ec);
-    if (ec)
+    TrackExceptionState es;
+    m_text = m_node->substringData(m_offset, m_count, es);
+    if (es.hadException())
         return;
 
     // Need to notify this before actually deleting the text
     if (AXObjectCache* cache = document()->existingAXObjectCache())
         cache->nodeTextChangeNotification(m_node.get(), AXObjectCache::AXTextDeleted, m_offset, m_text);
 
-    m_node->deleteData(m_offset, m_count, ec);
+    m_node->deleteData(m_offset, m_count, es);
 }
 
 void DeleteFromTextNodeCommand::doUnapply()
@@ -70,7 +70,7 @@
     if (!m_node->rendererIsEditable())
         return;
 
-    m_node->insertData(m_offset, m_text, IGNORE_EXCEPTION);
+    m_node->insertData(m_offset, m_text, IGNORE_EXCEPTION_STATE);
 
     if (AXObjectCache* cache = document()->existingAXObjectCache())
         cache->nodeTextChangeNotification(m_node.get(), AXObjectCache::AXTextInserted, m_offset, m_text);
diff --git a/Source/core/editing/EditingStyle.cpp b/Source/core/editing/EditingStyle.cpp
index 9491554..a343689 100644
--- a/Source/core/editing/EditingStyle.cpp
+++ b/Source/core/editing/EditingStyle.cpp
@@ -29,6 +29,7 @@
 
 #include "CSSValueKeywords.h"
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/css/CSSComputedStyleDeclaration.h"
 #include "core/css/CSSParser.h"
 #include "core/css/CSSRuleList.h"
@@ -1242,7 +1243,7 @@
     // and find the background color of the common ancestor.
     if (shouldUseBackgroundColorInEffect && (selection.isRange() || hasTransparentBackgroundColor(style->m_mutableStyle.get()))) {
         RefPtr<Range> range(selection.toNormalizedRange());
-        if (PassRefPtr<CSSValue> value = backgroundColorInEffect(range->commonAncestorContainer(IGNORE_EXCEPTION)))
+        if (PassRefPtr<CSSValue> value = backgroundColorInEffect(range->commonAncestorContainer(IGNORE_EXCEPTION_STATE)))
             style->setProperty(CSSPropertyBackgroundColor, value->cssText());
     }
 
diff --git a/Source/core/editing/Editor.cpp b/Source/core/editing/Editor.cpp
index a8f90e5..1eb42c9 100644
--- a/Source/core/editing/Editor.cpp
+++ b/Source/core/editing/Editor.cpp
@@ -29,6 +29,7 @@
 
 #include "CSSPropertyNames.h"
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/accessibility/AXObjectCache.h"
 #include "core/css/CSSComputedStyleDeclaration.h"
 #include "core/css/StylePropertySet.h"
@@ -38,7 +39,6 @@
 #include "core/dom/DocumentFragment.h"
 #include "core/dom/DocumentMarkerController.h"
 #include "core/dom/EventNames.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/KeyboardEvent.h"
 #include "core/dom/NodeList.h"
 #include "core/dom/NodeTraversal.h"
@@ -254,7 +254,7 @@
     if (!startContainer->rendererIsEditable() || !endContainer->rendererIsEditable())
         return false;
 
-    if (range->collapsed(IGNORE_EXCEPTION)) {
+    if (range->collapsed(IGNORE_EXCEPTION_STATE)) {
         VisiblePosition start(range->startPosition(), DOWNSTREAM);
         VisiblePosition previous = start.previous();
         // FIXME: We sometimes allow deletions at the start of editable roots, like when the caret is in an empty list item.
@@ -335,7 +335,7 @@
     Node* target = findEventTargetFromSelection();
     if (!target)
         return;
-    target->dispatchEvent(TextEvent::createForPlainTextPaste(m_frame->domWindow(), pastingText, smartReplace), IGNORE_EXCEPTION);
+    target->dispatchEvent(TextEvent::createForPlainTextPaste(m_frame->domWindow(), pastingText, smartReplace), IGNORE_EXCEPTION_STATE);
 }
 
 void Editor::pasteAsFragment(PassRefPtr<DocumentFragment> pastingFragment, bool smartReplace, bool matchStyle)
@@ -343,7 +343,7 @@
     Node* target = findEventTargetFromSelection();
     if (!target)
         return;
-    target->dispatchEvent(TextEvent::createForFragmentPaste(m_frame->domWindow(), pastingFragment, smartReplace, matchStyle), IGNORE_EXCEPTION);
+    target->dispatchEvent(TextEvent::createForFragmentPaste(m_frame->domWindow(), pastingFragment, smartReplace, matchStyle), IGNORE_EXCEPTION_STATE);
 }
 
 void Editor::pasteAsPlainTextBypassingDHTML()
@@ -425,7 +425,7 @@
 
 bool Editor::shouldDeleteRange(Range* range) const
 {
-    if (!range || range->collapsed(IGNORE_EXCEPTION))
+    if (!range || range->collapsed(IGNORE_EXCEPTION_STATE))
         return false;
 
     if (!canDeleteRange(range))
@@ -601,7 +601,7 @@
     RefPtr<Clipboard> clipboard = newGeneralClipboard(policy, m_frame);
 
     RefPtr<Event> evt = ClipboardEvent::create(eventType, true, true, clipboard);
-    target->dispatchEvent(evt, IGNORE_EXCEPTION);
+    target->dispatchEvent(evt, IGNORE_EXCEPTION_STATE);
     bool noDefaultProcessing = evt->defaultPrevented();
     if (noDefaultProcessing && policy == ClipboardWritable) {
         Pasteboard* pasteboard = Pasteboard::generalPasteboard();
@@ -720,9 +720,9 @@
 static void dispatchEditableContentChangedEvents(PassRefPtr<Element> startRoot, PassRefPtr<Element> endRoot)
 {
     if (startRoot)
-        startRoot->dispatchEvent(Event::create(eventNames().webkitEditableContentChangedEvent, false, false), IGNORE_EXCEPTION);
+        startRoot->dispatchEvent(Event::create(eventNames().webkitEditableContentChangedEvent, false, false), IGNORE_EXCEPTION_STATE);
     if (endRoot && endRoot != startRoot)
-        endRoot->dispatchEvent(Event::create(eventNames().webkitEditableContentChangedEvent, false, false), IGNORE_EXCEPTION);
+        endRoot->dispatchEvent(Event::create(eventNames().webkitEditableContentChangedEvent, false, false), IGNORE_EXCEPTION_STATE);
 }
 
 void Editor::appliedEditing(PassRefPtr<CompositeEditCommand> cmd)
@@ -1196,7 +1196,7 @@
     // the DOM Event specification.
     if (Element* target = m_frame->document()->focusedElement()) {
         RefPtr<CompositionEvent> event = CompositionEvent::create(eventNames().compositionendEvent, m_frame->domWindow(), text);
-        target->dispatchEvent(event, IGNORE_EXCEPTION);
+        target->dispatchEvent(event, IGNORE_EXCEPTION_STATE);
     }
 
     // If text is empty, then delete the old composition here.  If text is non-empty, InsertTextCommand::input
@@ -1266,7 +1266,7 @@
                 event = CompositionEvent::create(eventNames().compositionendEvent, m_frame->domWindow(), text);
         }
         if (event.get())
-            target->dispatchEvent(event, IGNORE_EXCEPTION);
+            target->dispatchEvent(event, IGNORE_EXCEPTION_STATE);
     }
 
     // If text is empty, then delete the old composition here.  If text is non-empty, InsertTextCommand::input
@@ -1356,14 +1356,14 @@
             return;
 
         Position rangeCompliantPosition = position.parentAnchoredEquivalent();
-        spellingSearchRange->setStart(rangeCompliantPosition.deprecatedNode(), rangeCompliantPosition.deprecatedEditingOffset(), IGNORE_EXCEPTION);
+        spellingSearchRange->setStart(rangeCompliantPosition.deprecatedNode(), rangeCompliantPosition.deprecatedEditingOffset(), IGNORE_EXCEPTION_STATE);
         startedWithSelection = false; // won't need to wrap
     }
 
     // topNode defines the whole range we want to operate on
     Node* topNode = highestEditableRoot(position);
     // FIXME: lastOffsetForEditing() is wrong here if editingIgnoresContent(highestEditableRoot()) returns true (e.g. a <table>)
-    spellingSearchRange->setEnd(topNode, lastOffsetForEditing(topNode), IGNORE_EXCEPTION);
+    spellingSearchRange->setEnd(topNode, lastOffsetForEditing(topNode), IGNORE_EXCEPTION_STATE);
 
     // If spellingSearchRange starts in the middle of a word, advance to the next word so we start checking
     // at a word boundary. Going back by one char and then forward by a word does the trick.
@@ -1374,7 +1374,7 @@
         // else we were already at the start of the editable node
     }
 
-    if (spellingSearchRange->collapsed(IGNORE_EXCEPTION))
+    if (spellingSearchRange->collapsed(IGNORE_EXCEPTION_STATE))
         return; // nothing to search in
 
     // Get the spell checker if it is available
@@ -1399,7 +1399,7 @@
     String foundItem;
     RefPtr<Range> firstMisspellingRange;
     if (unifiedTextCheckerEnabled()) {
-        grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION);
+        grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION_STATE);
         foundItem = TextCheckingHelper(client(), spellingSearchRange).findFirstMisspellingOrBadGrammar(isGrammarCheckingEnabled(), isSpelling, foundOffset, grammarDetail);
         if (isSpelling) {
             misspelledWord = foundItem;
@@ -1410,12 +1410,12 @@
         }
     } else {
         misspelledWord = TextCheckingHelper(client(), spellingSearchRange).findFirstMisspelling(misspellingOffset, false, firstMisspellingRange);
-        grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION);
+        grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION_STATE);
         if (!misspelledWord.isEmpty()) {
             // Stop looking at start of next misspelled word
             CharacterIterator chars(grammarSearchRange.get());
             chars.advance(misspellingOffset);
-            grammarSearchRange->setEnd(chars.range()->startContainer(), chars.range()->startOffset(), IGNORE_EXCEPTION);
+            grammarSearchRange->setEnd(chars.range()->startContainer(), chars.range()->startOffset(), IGNORE_EXCEPTION_STATE);
         }
 
         if (isGrammarCheckingEnabled())
@@ -1425,12 +1425,12 @@
     // If we found neither bad grammar nor a misspelled word, wrap and try again (but don't bother if we started at the beginning of the
     // block rather than at a selection).
     if (startedWithSelection && !misspelledWord && !badGrammarPhrase) {
-        spellingSearchRange->setStart(topNode, 0, IGNORE_EXCEPTION);
+        spellingSearchRange->setStart(topNode, 0, IGNORE_EXCEPTION_STATE);
         // going until the end of the very first chunk we tested is far enough
-        spellingSearchRange->setEnd(searchEndNodeAfterWrap, searchEndOffsetAfterWrap, IGNORE_EXCEPTION);
+        spellingSearchRange->setEnd(searchEndNodeAfterWrap, searchEndOffsetAfterWrap, IGNORE_EXCEPTION_STATE);
 
         if (unifiedTextCheckerEnabled()) {
-            grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION);
+            grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION_STATE);
             foundItem = TextCheckingHelper(client(), spellingSearchRange).findFirstMisspellingOrBadGrammar(isGrammarCheckingEnabled(), isSpelling, foundOffset, grammarDetail);
             if (isSpelling) {
                 misspelledWord = foundItem;
@@ -1441,12 +1441,12 @@
             }
         } else {
             misspelledWord = TextCheckingHelper(client(), spellingSearchRange).findFirstMisspelling(misspellingOffset, false, firstMisspellingRange);
-            grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION);
+            grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION_STATE);
             if (!misspelledWord.isEmpty()) {
                 // Stop looking at start of next misspelled word
                 CharacterIterator chars(grammarSearchRange.get());
                 chars.advance(misspellingOffset);
-                grammarSearchRange->setEnd(chars.range()->startContainer(), chars.range()->startOffset(), IGNORE_EXCEPTION);
+                grammarSearchRange->setEnd(chars.range()->startContainer(), chars.range()->startOffset(), IGNORE_EXCEPTION_STATE);
             }
 
             if (isGrammarCheckingEnabled())
@@ -1724,7 +1724,7 @@
         if (m_frame->selection()->selectionType() == VisibleSelection::CaretSelection) {
             // Attempt to save the caret position so we can restore it later if needed
             Position caretPosition = m_frame->selection()->end();
-            selectionOffset = paragraph.offsetTo(caretPosition, ASSERT_NO_EXCEPTION);
+            selectionOffset = paragraph.offsetTo(caretPosition, ASSERT_NO_EXCEPTION_STATE);
             restoreSelectionAfterChange = true;
             if (selectionOffset > 0 && (static_cast<unsigned>(selectionOffset) > paragraph.text().length() || paragraph.textCharAt(selectionOffset - 1) == newlineCharacter))
                 adjustSelectionForParagraphBoundaries = true;
@@ -2146,8 +2146,8 @@
 
     // Mutate using the CSSOM wrapper so we get the same event behavior as a script.
     CSSStyleDeclaration* style = element->style();
-    style->setPropertyInternal(CSSPropertyWordWrap, "break-word", false, IGNORE_EXCEPTION);
-    style->setPropertyInternal(CSSPropertyWebkitLineBreak, "after-white-space", false, IGNORE_EXCEPTION);
+    style->setPropertyInternal(CSSPropertyWordWrap, "break-word", false, IGNORE_EXCEPTION_STATE);
+    style->setPropertyInternal(CSSPropertyWebkitLineBreak, "after-white-space", false, IGNORE_EXCEPTION_STATE);
 }
 
 // Searches from the beginning of the document if nothing is selected.
@@ -2231,7 +2231,7 @@
     }
 
     // If nothing was found in the shadow tree, search in main content following the shadow tree.
-    if (resultRange->collapsed(ASSERT_NO_EXCEPTION) && shadowTreeRoot) {
+    if (resultRange->collapsed(ASSERT_NO_EXCEPTION_STATE) && shadowTreeRoot) {
         searchRange = rangeOfContents(m_frame->document());
         if (forward)
             searchRange->setStartAfter(shadowTreeRoot->shadowHost());
@@ -2243,7 +2243,7 @@
 
     // If we didn't find anything and we're wrapping, search again in the entire document (this will
     // redundantly re-search the area already searched in some cases).
-    if (resultRange->collapsed(ASSERT_NO_EXCEPTION) && options & WrapAround) {
+    if (resultRange->collapsed(ASSERT_NO_EXCEPTION_STATE) && options & WrapAround) {
         searchRange = rangeOfContents(m_frame->document());
         resultRange = findPlainText(searchRange.get(), target, options);
         // We used to return false here if we ended up with the same range that we started with
@@ -2251,7 +2251,7 @@
         // this should be a success case instead, so we'll just fall through in that case.
     }
 
-    return resultRange->collapsed(ASSERT_NO_EXCEPTION) ? 0 : resultRange.release();
+    return resultRange->collapsed(ASSERT_NO_EXCEPTION_STATE) ? 0 : resultRange.release();
 }
 
 void Editor::setMarkedTextMatchesAreHighlighted(bool flag)
diff --git a/Source/core/editing/EditorCommand.cpp b/Source/core/editing/EditorCommand.cpp
index 1661a07..14fef14 100644
--- a/Source/core/editing/EditorCommand.cpp
+++ b/Source/core/editing/EditorCommand.cpp
@@ -31,11 +31,11 @@
 #include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/css/CSSValueList.h"
 #include "core/css/StylePropertySet.h"
 #include "core/dom/DocumentFragment.h"
 #include "core/dom/Event.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/UserTypingGestureIndicator.h"
 #include "core/editing/CreateLinkCommand.h"
 #include "core/editing/FormatBlockCommand.h"
@@ -198,9 +198,9 @@
 static bool executeInsertNode(Frame* frame, PassRefPtr<Node> content)
 {
     RefPtr<DocumentFragment> fragment = DocumentFragment::create(frame->document());
-    ExceptionCode ec = 0;
-    fragment->appendChild(content, ec);
-    if (ec)
+    TrackExceptionState es;
+    fragment->appendChild(content, es);
+    if (es.hadException())
         return false;
     return executeInsertFragment(frame, fragment.release());
 }
@@ -212,7 +212,7 @@
     RefPtr<Range> newRange = selection.toNormalizedRange();
     if (!newRange)
         return false;
-    if (newRange->collapsed(IGNORE_EXCEPTION))
+    if (newRange->collapsed(IGNORE_EXCEPTION_STATE))
         return false;
     RefPtr<Range> oldRange = frame->selection()->selection().toNormalizedRange();
     EAffinity affinity = frame->selection()->affinity();
@@ -264,8 +264,8 @@
 
 static RefPtr<Range> unionDOMRanges(Range* a, Range* b)
 {
-    Range* start = a->compareBoundaryPoints(Range::START_TO_START, b, ASSERT_NO_EXCEPTION) <= 0 ? a : b;
-    Range* end = a->compareBoundaryPoints(Range::END_TO_END, b, ASSERT_NO_EXCEPTION) <= 0 ? b : a;
+    Range* start = a->compareBoundaryPoints(Range::START_TO_START, b, ASSERT_NO_EXCEPTION_STATE) <= 0 ? a : b;
+    Range* end = a->compareBoundaryPoints(Range::END_TO_END, b, ASSERT_NO_EXCEPTION_STATE) <= 0 ? b : a;
 
     return Range::create(a->ownerDocument(), start->startContainer(), start->startOffset(), end->endContainer(), end->endOffset());
 }
@@ -441,7 +441,7 @@
         tagName = tagName.substring(1, tagName.length() - 2);
 
     String localName, prefix;
-    if (!Document::parseQualifiedName(tagName, prefix, localName, IGNORE_EXCEPTION))
+    if (!Document::parseQualifiedName(tagName, prefix, localName, IGNORE_EXCEPTION_STATE))
         return false;
     QualifiedName qualifiedTagName(prefix, localName, xhtmlNamespaceURI);
 
diff --git a/Source/core/editing/FormatBlockCommand.cpp b/Source/core/editing/FormatBlockCommand.cpp
index ecc7e98..7acb96b 100644
--- a/Source/core/editing/FormatBlockCommand.cpp
+++ b/Source/core/editing/FormatBlockCommand.cpp
@@ -25,9 +25,9 @@
 
 #include "config.h"
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/Range.h"
 #include "core/editing/FormatBlockCommand.h"
 #include "core/editing/VisibleUnits.h"
@@ -100,7 +100,7 @@
     if (!range)
         return 0;
 
-    Node* commonAncestor = range->commonAncestorContainer(IGNORE_EXCEPTION);
+    Node* commonAncestor = range->commonAncestorContainer(IGNORE_EXCEPTION_STATE);
     while (commonAncestor && !isElementForFormatBlock(commonAncestor))
         commonAncestor = commonAncestor->parentNode();
 
diff --git a/Source/core/editing/FrameSelection.cpp b/Source/core/editing/FrameSelection.cpp
index bd8ed46..4276da6 100644
--- a/Source/core/editing/FrameSelection.cpp
+++ b/Source/core/editing/FrameSelection.cpp
@@ -28,6 +28,7 @@
 
 #include <stdio.h>
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/accessibility/AXObjectCache.h"
 #include "core/css/StylePropertySet.h"
 #include "core/dom/CharacterData.h"
@@ -415,9 +416,9 @@
         else
             m_selection.setWithoutValidation(m_selection.end(), m_selection.start());
     } else if (RefPtr<Range> range = m_selection.firstRange()) {
-        ExceptionCode ec = 0;
-        Range::CompareResults compareResult = range->compareNode(node, ec);
-        if (!ec && (compareResult == Range::NODE_BEFORE_AND_AFTER || compareResult == Range::NODE_INSIDE)) {
+        TrackExceptionState es;
+        Range::CompareResults compareResult = range->compareNode(node, es);
+        if (!es.hadException() && (compareResult == Range::NODE_BEFORE_AND_AFTER || compareResult == Range::NODE_INSIDE)) {
             // If we did nothing here, when this node's renderer was destroyed, the rect that it
             // occupied would be invalidated, but, selection gaps that change as a result of
             // the removal wouldn't be invalidated.
@@ -1676,9 +1677,9 @@
 
     // Non-collapsed ranges are not allowed to start at the end of a line that is wrapped,
     // they start at the beginning of the next line instead
-    ExceptionCode ec = 0;
-    bool collapsed = range->collapsed(ec);
-    if (ec)
+    TrackExceptionState es;
+    bool collapsed = range->collapsed(es);
+    if (es.hadException())
         return false;
 
     // FIXME: Can we provide extentAffinity?
diff --git a/Source/core/editing/InsertIntoTextNodeCommand.cpp b/Source/core/editing/InsertIntoTextNodeCommand.cpp
index 613dfc9..4e1845f 100644
--- a/Source/core/editing/InsertIntoTextNodeCommand.cpp
+++ b/Source/core/editing/InsertIntoTextNodeCommand.cpp
@@ -26,9 +26,9 @@
 #include "config.h"
 #include "core/editing/InsertIntoTextNodeCommand.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/accessibility/AXObjectCache.h"
 #include "core/dom/Document.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/Text.h"
 #include "core/page/Settings.h"
 #include "core/rendering/RenderText.h"
@@ -61,7 +61,7 @@
             renderText->momentarilyRevealLastTypedCharacter(m_offset + m_text.length() - 1);
     }
 
-    m_node->insertData(m_offset, m_text, IGNORE_EXCEPTION);
+    m_node->insertData(m_offset, m_text, IGNORE_EXCEPTION_STATE);
 
     if (AXObjectCache* cache = document()->existingAXObjectCache())
         cache->nodeTextChangeNotification(m_node.get(), AXObjectCache::AXTextInserted, m_offset, m_text);
@@ -76,7 +76,7 @@
     if (AXObjectCache* cache = document()->existingAXObjectCache())
         cache->nodeTextChangeNotification(m_node.get(), AXObjectCache::AXTextDeleted, m_offset, m_text);
 
-    m_node->deleteData(m_offset, m_text.length(), IGNORE_EXCEPTION);
+    m_node->deleteData(m_offset, m_text.length(), IGNORE_EXCEPTION_STATE);
 }
 
 #ifndef NDEBUG
diff --git a/Source/core/editing/InsertListCommand.cpp b/Source/core/editing/InsertListCommand.cpp
index ac1d950..3fd3bf9 100644
--- a/Source/core/editing/InsertListCommand.cpp
+++ b/Source/core/editing/InsertListCommand.cpp
@@ -24,10 +24,11 @@
  */
 
 #include "config.h"
-#include "HTMLNames.h"
-#include "core/dom/Element.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/editing/InsertListCommand.h"
+
+#include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
+#include "core/dom/Element.h"
 #include "core/editing/TextIterator.h"
 #include "core/editing/VisibleUnits.h"
 #include "core/editing/htmlediting.h"
@@ -233,9 +234,9 @@
             // Restore the start and the end of current selection if they started inside listNode
             // because moveParagraphWithClones could have removed them.
             if (rangeStartIsInList && newList)
-                currentSelection->setStart(newList, 0, IGNORE_EXCEPTION);
+                currentSelection->setStart(newList, 0, IGNORE_EXCEPTION_STATE);
             if (rangeEndIsInList && newList)
-                currentSelection->setEnd(newList, lastOffsetInNode(newList.get()), IGNORE_EXCEPTION);
+                currentSelection->setEnd(newList, lastOffsetInNode(newList.get()), IGNORE_EXCEPTION_STATE);
 
             setEndingSelection(VisiblePosition(firstPositionInNode(newList.get())));
 
diff --git a/Source/core/editing/InsertNodeBeforeCommand.cpp b/Source/core/editing/InsertNodeBeforeCommand.cpp
index d48a13b..42553f5 100644
--- a/Source/core/editing/InsertNodeBeforeCommand.cpp
+++ b/Source/core/editing/InsertNodeBeforeCommand.cpp
@@ -26,9 +26,9 @@
 #include "config.h"
 #include "core/editing/InsertNodeBeforeCommand.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/accessibility/AXObjectCache.h"
 #include "core/dom/Document.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 
 namespace WebCore {
 
@@ -54,7 +54,7 @@
         return;
     ASSERT(parent->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable));
 
-    parent->insertBefore(m_insertChild.get(), m_refChild.get(), IGNORE_EXCEPTION, AttachLazily);
+    parent->insertBefore(m_insertChild.get(), m_refChild.get(), IGNORE_EXCEPTION_STATE, AttachLazily);
 
     if (AXObjectCache* cache = document()->existingAXObjectCache())
         cache->nodeTextChangeNotification(m_insertChild.get(), AXObjectCache::AXTextInserted, 0, m_insertChild->nodeValue());
@@ -69,7 +69,7 @@
     if (AXObjectCache* cache = document()->existingAXObjectCache())
         cache->nodeTextChangeNotification(m_insertChild.get(), AXObjectCache::AXTextDeleted, 0, m_insertChild->nodeValue());
 
-    m_insertChild->remove(IGNORE_EXCEPTION);
+    m_insertChild->remove(IGNORE_EXCEPTION_STATE);
 }
 
 #ifndef NDEBUG
diff --git a/Source/core/editing/MergeIdenticalElementsCommand.cpp b/Source/core/editing/MergeIdenticalElementsCommand.cpp
index a23bfc0..12490bc 100644
--- a/Source/core/editing/MergeIdenticalElementsCommand.cpp
+++ b/Source/core/editing/MergeIdenticalElementsCommand.cpp
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "core/editing/MergeIdenticalElementsCommand.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Element.h"
 
 namespace WebCore {
@@ -53,9 +54,9 @@
 
     size_t size = children.size();
     for (size_t i = 0; i < size; ++i)
-        m_element2->insertBefore(children[i].release(), m_atChild.get(), IGNORE_EXCEPTION);
+        m_element2->insertBefore(children[i].release(), m_atChild.get(), IGNORE_EXCEPTION_STATE);
 
-    m_element1->remove(IGNORE_EXCEPTION);
+    m_element1->remove(IGNORE_EXCEPTION_STATE);
 }
 
 void MergeIdenticalElementsCommand::doUnapply()
@@ -69,10 +70,10 @@
     if (!parent || !parent->rendererIsEditable())
         return;
 
-    ExceptionCode ec = 0;
+    TrackExceptionState es;
 
-    parent->insertBefore(m_element1.get(), m_element2.get(), ec);
-    if (ec)
+    parent->insertBefore(m_element1.get(), m_element2.get(), es);
+    if (es.hadException())
         return;
 
     Vector<RefPtr<Node> > children;
@@ -81,7 +82,7 @@
 
     size_t size = children.size();
     for (size_t i = 0; i < size; ++i)
-        m_element1->appendChild(children[i].release(), ec);
+        m_element1->appendChild(children[i].release(), es);
 }
 
 #ifndef NDEBUG
diff --git a/Source/core/editing/RemoveCSSPropertyCommand.cpp b/Source/core/editing/RemoveCSSPropertyCommand.cpp
index caaa174..13c4389 100644
--- a/Source/core/editing/RemoveCSSPropertyCommand.cpp
+++ b/Source/core/editing/RemoveCSSPropertyCommand.cpp
@@ -26,10 +26,10 @@
 #include "config.h"
 #include "core/editing/RemoveCSSPropertyCommand.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/css/CSSStyleDeclaration.h"
 #include "core/css/StylePropertySet.h"
 #include "core/dom/Element.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "wtf/Assertions.h"
 
 namespace WebCore {
@@ -55,12 +55,12 @@
 
     // Mutate using the CSSOM wrapper so we get the same event behavior as a script.
     // Setting to null string removes the property. We don't have internal version of removeProperty.
-    m_element->style()->setPropertyInternal(m_property, String(), false, IGNORE_EXCEPTION);
+    m_element->style()->setPropertyInternal(m_property, String(), false, IGNORE_EXCEPTION_STATE);
 }
 
 void RemoveCSSPropertyCommand::doUnapply()
 {
-    m_element->style()->setPropertyInternal(m_property, m_oldValue, m_important, IGNORE_EXCEPTION);
+    m_element->style()->setPropertyInternal(m_property, m_oldValue, m_important, IGNORE_EXCEPTION_STATE);
 }
 
 #ifndef NDEBUG
diff --git a/Source/core/editing/RemoveNodeCommand.cpp b/Source/core/editing/RemoveNodeCommand.cpp
index 01ec7a2..92591fc 100644
--- a/Source/core/editing/RemoveNodeCommand.cpp
+++ b/Source/core/editing/RemoveNodeCommand.cpp
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "core/editing/RemoveNodeCommand.h"
 
-#include "core/dom/ExceptionCodePlaceholder.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Node.h"
 #include "wtf/Assertions.h"
 
@@ -52,7 +52,7 @@
     m_parent = parent;
     m_refChild = m_node->nextSibling();
 
-    m_node->remove(IGNORE_EXCEPTION);
+    m_node->remove(IGNORE_EXCEPTION_STATE);
 }
 
 void RemoveNodeCommand::doUnapply()
@@ -62,7 +62,7 @@
     if (!parent || !parent->rendererIsEditable())
         return;
 
-    parent->insertBefore(m_node.get(), refChild.get(), IGNORE_EXCEPTION);
+    parent->insertBefore(m_node.get(), refChild.get(), IGNORE_EXCEPTION_STATE);
 }
 
 #ifndef NDEBUG
diff --git a/Source/core/editing/ReplaceNodeWithSpanCommand.cpp b/Source/core/editing/ReplaceNodeWithSpanCommand.cpp
index 8141f80..f87ffb1 100644
--- a/Source/core/editing/ReplaceNodeWithSpanCommand.cpp
+++ b/Source/core/editing/ReplaceNodeWithSpanCommand.cpp
@@ -32,9 +32,9 @@
 #include "core/editing/ReplaceNodeWithSpanCommand.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/editing/htmlediting.h"
 #include "core/html/HTMLElement.h"
-
 #include "wtf/Assertions.h"
 
 namespace WebCore {
@@ -52,17 +52,17 @@
 {
     ASSERT(nodeToReplace->inDocument());
     RefPtr<ContainerNode> parentNode = nodeToReplace->parentNode();
-    parentNode->insertBefore(newNode, nodeToReplace, ASSERT_NO_EXCEPTION);
+    parentNode->insertBefore(newNode, nodeToReplace, ASSERT_NO_EXCEPTION_STATE);
 
     NodeVector children;
     getChildNodes(nodeToReplace, children);
     for (size_t i = 0; i < children.size(); ++i)
-        newNode->appendChild(children[i], ASSERT_NO_EXCEPTION);
+        newNode->appendChild(children[i], ASSERT_NO_EXCEPTION_STATE);
 
     // FIXME: Fix this to send the proper MutationRecords when MutationObservers are present.
     newNode->cloneDataFromElement(*nodeToReplace);
 
-    parentNode->removeChild(nodeToReplace, ASSERT_NO_EXCEPTION);
+    parentNode->removeChild(nodeToReplace, ASSERT_NO_EXCEPTION_STATE);
 }
 
 void ReplaceNodeWithSpanCommand::doApply()
diff --git a/Source/core/editing/ReplaceSelectionCommand.cpp b/Source/core/editing/ReplaceSelectionCommand.cpp
index 5639956..68253e9 100644
--- a/Source/core/editing/ReplaceSelectionCommand.cpp
+++ b/Source/core/editing/ReplaceSelectionCommand.cpp
@@ -29,6 +29,7 @@
 
 #include "CSSPropertyNames.h"
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/css/CSSStyleDeclaration.h"
 #include "core/css/StylePropertySet.h"
 #include "core/dom/BeforeTextInsertedEvent.h"
@@ -36,7 +37,6 @@
 #include "core/dom/DocumentFragment.h"
 #include "core/dom/Element.h"
 #include "core/dom/EventNames.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/Text.h"
 #include "core/editing/ApplyStyleCommand.h"
@@ -178,7 +178,7 @@
 
     // Give the root a chance to change the text.
     RefPtr<BeforeTextInsertedEvent> evt = BeforeTextInsertedEvent::create(text);
-    editableRoot->dispatchEvent(evt, ASSERT_NO_EXCEPTION);
+    editableRoot->dispatchEvent(evt, ASSERT_NO_EXCEPTION_STATE);
     if (text != evt->text() || !editableRoot->rendererIsRichlyEditable()) {
         restoreAndRemoveTestRenderingNodesToFragment(holder.get());
 
@@ -229,7 +229,7 @@
     if (!parent)
         return;
 
-    parent->removeChild(node.get(), ASSERT_NO_EXCEPTION);
+    parent->removeChild(node.get(), ASSERT_NO_EXCEPTION_STATE);
 }
 
 void ReplacementFragment::insertNodeBefore(PassRefPtr<Node> node, Node* refNode)
@@ -241,15 +241,15 @@
     if (!parent)
         return;
 
-    parent->insertBefore(node, refNode, ASSERT_NO_EXCEPTION);
+    parent->insertBefore(node, refNode, ASSERT_NO_EXCEPTION_STATE);
 }
 
 PassRefPtr<Element> ReplacementFragment::insertFragmentForTestRendering(Node* rootEditableElement)
 {
     RefPtr<Element> holder = createDefaultParagraphElement(m_document.get());
 
-    holder->appendChild(m_fragment, ASSERT_NO_EXCEPTION);
-    rootEditableElement->appendChild(holder.get(), ASSERT_NO_EXCEPTION);
+    holder->appendChild(m_fragment, ASSERT_NO_EXCEPTION_STATE);
+    rootEditableElement->appendChild(holder.get(), ASSERT_NO_EXCEPTION_STATE);
     m_document->updateLayoutIgnorePendingStylesheets();
 
     return holder.release();
@@ -261,8 +261,8 @@
         return;
 
     while (RefPtr<Node> node = holder->firstChild()) {
-        holder->removeChild(node.get(), ASSERT_NO_EXCEPTION);
-        m_fragment->appendChild(node.get(), ASSERT_NO_EXCEPTION);
+        holder->removeChild(node.get(), ASSERT_NO_EXCEPTION_STATE);
+        m_fragment->appendChild(node.get(), ASSERT_NO_EXCEPTION_STATE);
     }
 
     removeNode(holder);
@@ -547,9 +547,9 @@
 
             // Mutate using the CSSOM wrapper so we get the same event behavior as a script.
             if (isBlock(element))
-                element->style()->setPropertyInternal(CSSPropertyDisplay, "inline", false, IGNORE_EXCEPTION);
+                element->style()->setPropertyInternal(CSSPropertyDisplay, "inline", false, IGNORE_EXCEPTION_STATE);
             if (element->renderer() && element->renderer()->style()->isFloating())
-                element->style()->setPropertyInternal(CSSPropertyFloat, "none", false, IGNORE_EXCEPTION);
+                element->style()->setPropertyInternal(CSSPropertyFloat, "none", false, IGNORE_EXCEPTION_STATE);
         }
     }
 }
@@ -1429,7 +1429,7 @@
     }
 
     while (RefPtr<Node> listItem = listElement->firstChild()) {
-        listElement->removeChild(listItem.get(), ASSERT_NO_EXCEPTION);
+        listElement->removeChild(listItem.get(), ASSERT_NO_EXCEPTION_STATE);
         if (isStart || isMiddle) {
             insertNodeBefore(listItem, lastNode);
             insertedNodes.respondToNodeInsertion(listItem.get());
diff --git a/Source/core/editing/SplitElementCommand.cpp b/Source/core/editing/SplitElementCommand.cpp
index 69323c3..aa07239 100644
--- a/Source/core/editing/SplitElementCommand.cpp
+++ b/Source/core/editing/SplitElementCommand.cpp
@@ -27,6 +27,7 @@
 #include "core/editing/SplitElementCommand.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Element.h"
 #include "wtf/Assertions.h"
 
@@ -51,13 +52,13 @@
     for (Node* node = m_element2->firstChild(); node != m_atChild; node = node->nextSibling())
         children.append(node);
 
-    ExceptionCode ec = 0;
+    TrackExceptionState es;
 
     ContainerNode* parent = m_element2->parentNode();
     if (!parent || !parent->rendererIsEditable())
         return;
-    parent->insertBefore(m_element1.get(), m_element2.get(), ec);
-    if (ec)
+    parent->insertBefore(m_element1.get(), m_element2.get(), es);
+    if (es.hadException())
         return;
 
     // Delete id attribute from the second element because the same id cannot be used for more than one element
@@ -65,7 +66,7 @@
 
     size_t size = children.size();
     for (size_t i = 0; i < size; ++i)
-        m_element1->appendChild(children[i], ec);
+        m_element1->appendChild(children[i], es);
 }
 
 void SplitElementCommand::doApply()
@@ -88,13 +89,13 @@
 
     size_t size = children.size();
     for (size_t i = 0; i < size; ++i)
-        m_element2->insertBefore(children[i].get(), refChild.get(), IGNORE_EXCEPTION);
+        m_element2->insertBefore(children[i].get(), refChild.get(), IGNORE_EXCEPTION_STATE);
 
     // Recover the id attribute of the original element.
     if (m_element1->hasAttribute(HTMLNames::idAttr))
         m_element2->setAttribute(HTMLNames::idAttr, m_element1->getAttribute(HTMLNames::idAttr));
 
-    m_element1->remove(IGNORE_EXCEPTION);
+    m_element1->remove(IGNORE_EXCEPTION_STATE);
 }
 
 void SplitElementCommand::doReapply()
diff --git a/Source/core/editing/SplitTextNodeCommand.cpp b/Source/core/editing/SplitTextNodeCommand.cpp
index 002af62..7ae05c9 100644
--- a/Source/core/editing/SplitTextNodeCommand.cpp
+++ b/Source/core/editing/SplitTextNodeCommand.cpp
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "core/editing/SplitTextNodeCommand.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Document.h"
 #include "core/dom/DocumentMarkerController.h"
 #include "core/dom/Text.h"
@@ -54,7 +55,7 @@
     if (!parent || !parent->rendererIsEditable())
         return;
 
-    String prefixText = m_text2->substringData(0, m_offset, IGNORE_EXCEPTION);
+    String prefixText = m_text2->substringData(0, m_offset, IGNORE_EXCEPTION_STATE);
     if (prefixText.isEmpty())
         return;
 
@@ -74,10 +75,10 @@
 
     String prefixText = m_text1->data();
 
-    m_text2->insertData(0, prefixText, ASSERT_NO_EXCEPTION);
+    m_text2->insertData(0, prefixText, ASSERT_NO_EXCEPTION_STATE);
 
     document()->markers()->copyMarkers(m_text1.get(), 0, prefixText.length(), m_text2.get(), 0);
-    m_text1->remove(ASSERT_NO_EXCEPTION);
+    m_text1->remove(ASSERT_NO_EXCEPTION_STATE);
 }
 
 void SplitTextNodeCommand::doReapply()
@@ -94,11 +95,11 @@
 
 void SplitTextNodeCommand::insertText1AndTrimText2()
 {
-    ExceptionCode ec = 0;
-    m_text2->parentNode()->insertBefore(m_text1.get(), m_text2.get(), ec);
-    if (ec)
+    TrackExceptionState es;
+    m_text2->parentNode()->insertBefore(m_text1.get(), m_text2.get(), es);
+    if (es.hadException())
         return;
-    m_text2->deleteData(0, m_offset, ec);
+    m_text2->deleteData(0, m_offset, es);
 }
 
 #ifndef NDEBUG
diff --git a/Source/core/editing/TextCheckingHelper.cpp b/Source/core/editing/TextCheckingHelper.cpp
index 9bc38fe..8fef697 100644
--- a/Source/core/editing/TextCheckingHelper.cpp
+++ b/Source/core/editing/TextCheckingHelper.cpp
@@ -27,6 +27,8 @@
 #include "config.h"
 #include "core/editing/TextCheckingHelper.h"
 
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Document.h"
 #include "core/dom/DocumentMarkerController.h"
 #include "core/dom/Range.h"
@@ -97,7 +99,7 @@
 
 static PassRefPtr<Range> expandToParagraphBoundary(PassRefPtr<Range> range)
 {
-    RefPtr<Range> paragraphRange = range->cloneRange(IGNORE_EXCEPTION);
+    RefPtr<Range> paragraphRange = range->cloneRange(IGNORE_EXCEPTION_STATE);
     setStart(paragraphRange.get(), startOfParagraph(range->startPosition()));
     setEnd(paragraphRange.get(), endOfParagraph(range->endPosition()));
     return paragraphRange;
@@ -158,12 +160,12 @@
     return TextIterator::subrange(paragraphRange().get(), characterOffset, characterCount);
 }
 
-int TextCheckingParagraph::offsetTo(const Position& position, ExceptionCode& ec) const
+int TextCheckingParagraph::offsetTo(const Position& position, ExceptionState& es) const
 {
     ASSERT(m_checkingRange);
-    RefPtr<Range> range = offsetAsRange()->cloneRange(ASSERT_NO_EXCEPTION);
-    range->setEnd(position.containerNode(), position.computeOffsetInContainerNode(), ec);
-    if (ec)
+    RefPtr<Range> range = offsetAsRange()->cloneRange(ASSERT_NO_EXCEPTION_STATE);
+    range->setEnd(position.containerNode(), position.computeOffsetInContainerNode(), es);
+    if (es.hadException())
         return 0;
     return TextIterator::rangeLength(range.get());
 }
@@ -304,7 +306,7 @@
     // Expand the search range to encompass entire paragraphs, since text checking needs that much context.
     // Determine the character offset from the start of the paragraph to the start of the original search range,
     // since we will want to ignore results in this area.
-    RefPtr<Range> paragraphRange = m_range->cloneRange(IGNORE_EXCEPTION);
+    RefPtr<Range> paragraphRange = m_range->cloneRange(IGNORE_EXCEPTION_STATE);
     setStart(paragraphRange.get(), startOfParagraph(m_range->startPosition()));
     int totalRangeLength = TextIterator::rangeLength(paragraphRange.get());
     setEnd(paragraphRange.get(), endOfParagraph(m_range->startPosition()));
diff --git a/Source/core/editing/TextCheckingHelper.h b/Source/core/editing/TextCheckingHelper.h
index 7a4acc4..c18021c 100644
--- a/Source/core/editing/TextCheckingHelper.h
+++ b/Source/core/editing/TextCheckingHelper.h
@@ -21,13 +21,13 @@
 #ifndef TextCheckingHelper_h
 #define TextCheckingHelper_h
 
-#include "core/dom/ExceptionCode.h"
 #include "core/page/EditorClient.h"
 #include "core/platform/text/TextChecking.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
+class ExceptionState;
 class Range;
 class Position;
 struct TextCheckingResult;
@@ -40,7 +40,7 @@
 
     int rangeLength() const;
     PassRefPtr<Range> subrange(int characterOffset, int characterCount) const;
-    int offsetTo(const Position&, ExceptionCode&) const;
+    int offsetTo(const Position&, ExceptionState&) const;
     void expandRangeToNextEnd();
 
     const String& text() const;
diff --git a/Source/core/editing/TextInsertionBaseCommand.cpp b/Source/core/editing/TextInsertionBaseCommand.cpp
index e9a9b23..b0092e5 100644
--- a/Source/core/editing/TextInsertionBaseCommand.cpp
+++ b/Source/core/editing/TextInsertionBaseCommand.cpp
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "core/editing/TextInsertionBaseCommand.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/BeforeTextInsertedEvent.h"
 #include "core/dom/Element.h"
 #include "core/dom/Node.h"
@@ -63,7 +64,7 @@
         if (startNode->rootEditableElement()) {
             // Send BeforeTextInsertedEvent. The event handler will update text if necessary.
             RefPtr<BeforeTextInsertedEvent> evt = BeforeTextInsertedEvent::create(text);
-            startNode->rootEditableElement()->dispatchEvent(evt, IGNORE_EXCEPTION);
+            startNode->rootEditableElement()->dispatchEvent(evt, IGNORE_EXCEPTION_STATE);
             newText = evt->text();
         }
     }
@@ -77,7 +78,7 @@
         return false;
 
     RefPtr<BeforeTextInsertedEvent> event = BeforeTextInsertedEvent::create(String("\n"));
-    node->dispatchEvent(event, IGNORE_EXCEPTION);
+    node->dispatchEvent(event, IGNORE_EXCEPTION_STATE);
     return event->text().length();
 }
 
diff --git a/Source/core/editing/TextIterator.cpp b/Source/core/editing/TextIterator.cpp
index d11344e..c8ecc32 100644
--- a/Source/core/editing/TextIterator.cpp
+++ b/Source/core/editing/TextIterator.cpp
@@ -28,8 +28,8 @@
 #include "core/editing/TextIterator.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Document.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/Range.h"
 #include "core/dom/shadow/ShadowRoot.h"
@@ -1377,8 +1377,8 @@
             Node* n = r->startContainer();
             ASSERT(n == r->endContainer());
             int offset = r->startOffset() + m_runOffset;
-            r->setStart(n, offset, ASSERT_NO_EXCEPTION);
-            r->setEnd(n, offset + 1, ASSERT_NO_EXCEPTION);
+            r->setStart(n, offset, ASSERT_NO_EXCEPTION_STATE);
+            r->setEnd(n, offset + 1, ASSERT_NO_EXCEPTION_STATE);
         }
     }
     return r.release();
@@ -1476,8 +1476,8 @@
             Node* n = r->startContainer();
             ASSERT(n == r->endContainer());
             int offset = r->endOffset() - m_runOffset;
-            r->setStart(n, offset - 1, ASSERT_NO_EXCEPTION);
-            r->setEnd(n, offset, ASSERT_NO_EXCEPTION);
+            r->setStart(n, offset - 1, ASSERT_NO_EXCEPTION_STATE);
+            r->setEnd(n, offset, ASSERT_NO_EXCEPTION_STATE);
         }
     }
     return r.release();
@@ -1575,8 +1575,7 @@
 
         // Start gobbling chunks until we get to a suitable stopping point
         m_textIterator.appendTextTo(m_buffer);
-        int exception = 0;
-        m_range->setEnd(m_textIterator.range()->endContainer(), m_textIterator.range()->endOffset(), exception);
+        m_range->setEnd(m_textIterator.range()->endContainer(), m_textIterator.range()->endOffset(), IGNORE_EXCEPTION_STATE);
     }
 }
 
@@ -2247,8 +2246,8 @@
     if (rangeLocation == 0 && rangeLength == 0 && it.atEnd()) {
         textRunRange = it.range();
 
-        resultRange->setStart(textRunRange->startContainer(), 0, ASSERT_NO_EXCEPTION);
-        resultRange->setEnd(textRunRange->startContainer(), 0, ASSERT_NO_EXCEPTION);
+        resultRange->setStart(textRunRange->startContainer(), 0, ASSERT_NO_EXCEPTION_STATE);
+        resultRange->setEnd(textRunRange->startContainer(), 0, ASSERT_NO_EXCEPTION_STATE);
 
         return resultRange.release();
     }
@@ -2270,40 +2269,38 @@
                 it.advance();
                 if (!it.atEnd()) {
                     RefPtr<Range> range = it.range();
-                    textRunRange->setEnd(range->startContainer(), range->startOffset(), ASSERT_NO_EXCEPTION);
+                    textRunRange->setEnd(range->startContainer(), range->startOffset(), ASSERT_NO_EXCEPTION_STATE);
                 } else {
                     Position runStart = textRunRange->startPosition();
                     Position runEnd = VisiblePosition(runStart).next().deepEquivalent();
                     if (runEnd.isNotNull())
-                        textRunRange->setEnd(runEnd.containerNode(), runEnd.computeOffsetInContainerNode(), ASSERT_NO_EXCEPTION);
+                        textRunRange->setEnd(runEnd.containerNode(), runEnd.computeOffsetInContainerNode(), ASSERT_NO_EXCEPTION_STATE);
                 }
             }
         }
 
         if (foundStart) {
             startRangeFound = true;
-            int exception = 0;
             if (textRunRange->startContainer()->isTextNode()) {
                 int offset = rangeLocation - docTextPosition;
-                resultRange->setStart(textRunRange->startContainer(), offset + textRunRange->startOffset(), exception);
+                resultRange->setStart(textRunRange->startContainer(), offset + textRunRange->startOffset(), IGNORE_EXCEPTION_STATE);
             } else {
                 if (rangeLocation == docTextPosition)
-                    resultRange->setStart(textRunRange->startContainer(), textRunRange->startOffset(), exception);
+                    resultRange->setStart(textRunRange->startContainer(), textRunRange->startOffset(), IGNORE_EXCEPTION_STATE);
                 else
-                    resultRange->setStart(textRunRange->endContainer(), textRunRange->endOffset(), exception);
+                    resultRange->setStart(textRunRange->endContainer(), textRunRange->endOffset(), IGNORE_EXCEPTION_STATE);
             }
         }
 
         if (foundEnd) {
-            int exception = 0;
             if (textRunRange->startContainer()->isTextNode()) {
                 int offset = rangeEnd - docTextPosition;
-                resultRange->setEnd(textRunRange->startContainer(), offset + textRunRange->startOffset(), exception);
+                resultRange->setEnd(textRunRange->startContainer(), offset + textRunRange->startOffset(), IGNORE_EXCEPTION_STATE);
             } else {
                 if (rangeEnd == docTextPosition)
-                    resultRange->setEnd(textRunRange->startContainer(), textRunRange->startOffset(), exception);
+                    resultRange->setEnd(textRunRange->startContainer(), textRunRange->startOffset(), IGNORE_EXCEPTION_STATE);
                 else
-                    resultRange->setEnd(textRunRange->endContainer(), textRunRange->endOffset(), exception);
+                    resultRange->setEnd(textRunRange->endContainer(), textRunRange->endOffset(), IGNORE_EXCEPTION_STATE);
             }
             docTextPosition += len;
             break;
@@ -2315,8 +2312,7 @@
         return 0;
 
     if (rangeLength != 0 && rangeEnd > docTextPosition) { // rangeEnd is out of bounds
-        int exception = 0;
-        resultRange->setEnd(textRunRange->endContainer(), textRunRange->endOffset(), exception);
+        resultRange->setEnd(textRunRange->endContainer(), textRunRange->endOffset(), IGNORE_EXCEPTION_STATE);
     }
 
     return resultRange.release();
@@ -2344,7 +2340,7 @@
     ASSERT(testRange->startContainer() == scope);
     location = TextIterator::rangeLength(testRange.get());
 
-    testRange->setEnd(range->endContainer(), range->endOffset(), IGNORE_EXCEPTION);
+    testRange->setEnd(range->endContainer(), range->endOffset(), IGNORE_EXCEPTION_STATE);
     ASSERT(testRange->startContainer() == scope);
     length = TextIterator::rangeLength(testRange.get()) - location;
     return true;
@@ -2382,8 +2378,8 @@
 
 static PassRefPtr<Range> collapsedToBoundary(const Range* range, bool forward)
 {
-    RefPtr<Range> result = range->cloneRange(ASSERT_NO_EXCEPTION);
-    result->collapse(!forward, ASSERT_NO_EXCEPTION);
+    RefPtr<Range> result = range->cloneRange(ASSERT_NO_EXCEPTION_STATE);
+    result->collapse(!forward, ASSERT_NO_EXCEPTION_STATE);
     return result.release();
 }
 
@@ -2397,7 +2393,7 @@
     if (buffer.needsMoreContext()) {
         RefPtr<Range> startRange = it.range();
         RefPtr<Range> beforeStartRange = startRange->ownerDocument()->createRange();
-        beforeStartRange->setEnd(startRange->startContainer(), startRange->startOffset(), IGNORE_EXCEPTION);
+        beforeStartRange->setEnd(startRange->startContainer(), startRange->startOffset(), IGNORE_EXCEPTION_STATE);
         for (SimplifiedBackwardsTextIterator backwardsIterator(beforeStartRange.get()); !backwardsIterator.atEnd(); backwardsIterator.advance()) {
             Vector<UChar, 1024> characters;
             backwardsIterator.prependTextTo(characters);
diff --git a/Source/core/editing/VisiblePosition.cpp b/Source/core/editing/VisiblePosition.cpp
index 38ad01f..d727a3d 100644
--- a/Source/core/editing/VisiblePosition.cpp
+++ b/Source/core/editing/VisiblePosition.cpp
@@ -29,6 +29,7 @@
 
 #include <stdio.h>
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Document.h"
 #include "core/dom/Range.h"
 #include "core/dom/Text.h"
@@ -697,9 +698,9 @@
     if (!r)
         return false;
     Position p = visiblePosition.deepEquivalent().parentAnchoredEquivalent();
-    int code = 0;
-    r->setStart(p.containerNode(), p.offsetInContainerNode(), code);
-    return code == 0;
+    TrackExceptionState es;
+    r->setStart(p.containerNode(), p.offsetInContainerNode(), es);
+    return !es.hadException();
 }
 
 bool setEnd(Range *r, const VisiblePosition &visiblePosition)
@@ -707,9 +708,9 @@
     if (!r)
         return false;
     Position p = visiblePosition.deepEquivalent().parentAnchoredEquivalent();
-    int code = 0;
-    r->setEnd(p.containerNode(), p.offsetInContainerNode(), code);
-    return code == 0;
+    TrackExceptionState es;
+    r->setEnd(p.containerNode(), p.offsetInContainerNode(), es);
+    return !es.hadException();
 }
 
 Element* enclosingBlockFlowElement(const VisiblePosition &visiblePosition)
diff --git a/Source/core/editing/VisibleSelection.cpp b/Source/core/editing/VisibleSelection.cpp
index a259177..40f8fcc 100644
--- a/Source/core/editing/VisibleSelection.cpp
+++ b/Source/core/editing/VisibleSelection.cpp
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "core/editing/VisibleSelection.h"
 
-#include <stdio.h>
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
 #include "core/dom/Range.h"
@@ -40,6 +40,7 @@
 #include "wtf/text/CString.h"
 #include "wtf/text/StringBuilder.h"
 #include "wtf/unicode/CharacterNames.h"
+#include <stdio.h>
 
 namespace WebCore {
 
@@ -214,14 +215,14 @@
         return 0;
 
     RefPtr<Range> searchRange(Range::create(d));
-    ExceptionCode ec = 0;
+    TrackExceptionState es;
 
     Position start(pos.parentAnchoredEquivalent());
-    searchRange->selectNodeContents(boundary, ec);
-    searchRange->setStart(start.containerNode(), start.offsetInContainerNode(), ec);
+    searchRange->selectNodeContents(boundary, es);
+    searchRange->setStart(start.containerNode(), start.offsetInContainerNode(), es);
 
-    ASSERT(!ec);
-    if (ec)
+    ASSERT(!es.hadException());
+    if (es.hadException())
         return 0;
 
     return searchRange.release();
diff --git a/Source/core/editing/VisibleUnits.cpp b/Source/core/editing/VisibleUnits.cpp
index 1895013..04f4003 100644
--- a/Source/core/editing/VisibleUnits.cpp
+++ b/Source/core/editing/VisibleUnits.cpp
@@ -27,6 +27,7 @@
 #include "core/editing/VisibleUnits.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
 #include "core/dom/NodeTraversal.h"
@@ -457,11 +458,11 @@
     Vector<UChar, 1024> string;
     unsigned suffixLength = 0;
 
-    ExceptionCode ec = 0;
+    TrackExceptionState es;
     if (requiresContextForWordBoundary(c.characterBefore())) {
         RefPtr<Range> forwardsScanRange(d->createRange());
-        forwardsScanRange->setEndAfter(boundary, ec);
-        forwardsScanRange->setStart(end.deprecatedNode(), end.deprecatedEditingOffset(), ec);
+        forwardsScanRange->setEndAfter(boundary, es);
+        forwardsScanRange->setStart(end.deprecatedNode(), end.deprecatedEditingOffset(), es);
         TextIterator forwardsIterator(forwardsScanRange.get());
         while (!forwardsIterator.atEnd()) {
             Vector<UChar, 1024> characters;
@@ -475,11 +476,11 @@
         }
     }
 
-    searchRange->setStart(start.deprecatedNode(), start.deprecatedEditingOffset(), ec);
-    searchRange->setEnd(end.deprecatedNode(), end.deprecatedEditingOffset(), ec);
+    searchRange->setStart(start.deprecatedNode(), start.deprecatedEditingOffset(), es);
+    searchRange->setEnd(end.deprecatedNode(), end.deprecatedEditingOffset(), es);
 
-    ASSERT(!ec);
-    if (ec)
+    ASSERT(!es.hadException());
+    if (es.hadException())
         return VisiblePosition();
 
     SimplifiedBackwardsTextIterator it(searchRange.get());
@@ -539,7 +540,7 @@
 
     if (requiresContextForWordBoundary(c.characterAfter())) {
         RefPtr<Range> backwardsScanRange(d->createRange());
-        backwardsScanRange->setEnd(start.deprecatedNode(), start.deprecatedEditingOffset(), IGNORE_EXCEPTION);
+        backwardsScanRange->setEnd(start.deprecatedNode(), start.deprecatedEditingOffset(), IGNORE_EXCEPTION_STATE);
         SimplifiedBackwardsTextIterator backwardsIterator(backwardsScanRange.get());
         while (!backwardsIterator.atEnd()) {
             Vector<UChar, 1024> characters;
@@ -554,8 +555,8 @@
         }
     }
 
-    searchRange->selectNodeContents(boundary, IGNORE_EXCEPTION);
-    searchRange->setStart(start.deprecatedNode(), start.deprecatedEditingOffset(), IGNORE_EXCEPTION);
+    searchRange->selectNodeContents(boundary, IGNORE_EXCEPTION_STATE);
+    searchRange->setStart(start.deprecatedNode(), start.deprecatedEditingOffset(), IGNORE_EXCEPTION_STATE);
     TextIterator it(searchRange.get(), TextIteratorEmitsCharactersBetweenAllVisiblePositions);
     unsigned next = 0;
     bool inTextSecurityMode = start.deprecatedNode() && start.deprecatedNode()->renderer() && start.deprecatedNode()->renderer()->style()->textSecurity() != TSNONE;
diff --git a/Source/core/editing/WrapContentsInDummySpanCommand.cpp b/Source/core/editing/WrapContentsInDummySpanCommand.cpp
index 5013f92..9808d42 100644
--- a/Source/core/editing/WrapContentsInDummySpanCommand.cpp
+++ b/Source/core/editing/WrapContentsInDummySpanCommand.cpp
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "core/editing/WrapContentsInDummySpanCommand.h"
 
-#include "core/dom/ExceptionCodePlaceholder.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/editing/ApplyStyleCommand.h"
 #include "core/html/HTMLElement.h"
 
@@ -47,9 +47,9 @@
 
     size_t size = children.size();
     for (size_t i = 0; i < size; ++i)
-        m_dummySpan->appendChild(children[i].release(), IGNORE_EXCEPTION);
+        m_dummySpan->appendChild(children[i].release(), IGNORE_EXCEPTION_STATE);
 
-    m_element->appendChild(m_dummySpan.get(), IGNORE_EXCEPTION);
+    m_element->appendChild(m_dummySpan.get(), IGNORE_EXCEPTION_STATE);
 }
 
 void WrapContentsInDummySpanCommand::doApply()
@@ -72,9 +72,9 @@
 
     size_t size = children.size();
     for (size_t i = 0; i < size; ++i)
-        m_element->appendChild(children[i].release(), IGNORE_EXCEPTION);
+        m_element->appendChild(children[i].release(), IGNORE_EXCEPTION_STATE);
 
-    m_dummySpan->remove(IGNORE_EXCEPTION);
+    m_dummySpan->remove(IGNORE_EXCEPTION_STATE);
 }
 
 void WrapContentsInDummySpanCommand::doReapply()
diff --git a/Source/core/editing/htmlediting.cpp b/Source/core/editing/htmlediting.cpp
index 5a399f1..8a7e648 100644
--- a/Source/core/editing/htmlediting.cpp
+++ b/Source/core/editing/htmlediting.cpp
@@ -28,8 +28,9 @@
 
 #include "HTMLElementFactory.h"
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Document.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/PositionIterator.h"
 #include "core/dom/Range.h"
@@ -96,7 +97,7 @@
             bias = 1;
     }
 
-    int result = Range::compareBoundaryPoints(nodeA, offsetA, nodeB, offsetB, IGNORE_EXCEPTION);
+    int result = Range::compareBoundaryPoints(nodeA, offsetA, nodeB, offsetB, IGNORE_EXCEPTION_STATE);
     return result ? result : bias;
 }
 
@@ -523,13 +524,13 @@
 // Create a range object with two visible positions, start and end.
 // create(PassRefPtr<Document>, const Position&, const Position&); will use deprecatedEditingOffset
 // Use this function instead of create a regular range object (avoiding editing offset).
-PassRefPtr<Range> createRange(PassRefPtr<Document> document, const VisiblePosition& start, const VisiblePosition& end, ExceptionCode& ec)
+PassRefPtr<Range> createRange(PassRefPtr<Document> document, const VisiblePosition& start, const VisiblePosition& end, ExceptionState& es)
 {
-    ec = 0;
+    es.clearException();
     RefPtr<Range> selectedRange = Range::create(document);
-    selectedRange->setStart(start.deepEquivalent().containerNode(), start.deepEquivalent().computeOffsetInContainerNode(), ec);
-    if (!ec)
-        selectedRange->setEnd(end.deepEquivalent().containerNode(), end.deepEquivalent().computeOffsetInContainerNode(), ec);
+    selectedRange->setStart(start.deepEquivalent().containerNode(), start.deepEquivalent().computeOffsetInContainerNode(), es);
+    if (!es.hadException())
+        selectedRange->setEnd(end.deepEquivalent().containerNode(), end.deepEquivalent().computeOffsetInContainerNode(), es);
     return selectedRange.release();
 }
 
@@ -896,7 +897,7 @@
     if (!tabTextNode)
         tabTextNode = document->createEditingTextNode("\t");
 
-    spanElement->appendChild(tabTextNode.release(), ASSERT_NO_EXCEPTION);
+    spanElement->appendChild(tabTextNode.release(), ASSERT_NO_EXCEPTION_STATE);
 
     return spanElement.release();
 }
@@ -1090,7 +1091,7 @@
     ASSERT(node);
     ASSERT(selectedRange);
     // If the node is inside the range, then it surely is contained within
-    if (selectedRange->compareNode(node, IGNORE_EXCEPTION) == Range::NODE_INSIDE)
+    if (selectedRange->compareNode(node, IGNORE_EXCEPTION_STATE) == Range::NODE_INSIDE)
         return true;
 
     bool startIsVisuallySame = visiblePositionBeforeNode(node) == selectedRange->startPosition();
diff --git a/Source/core/editing/htmlediting.h b/Source/core/editing/htmlediting.h
index aa5c2ca..3500e03 100644
--- a/Source/core/editing/htmlediting.h
+++ b/Source/core/editing/htmlediting.h
@@ -36,6 +36,7 @@
 
 class Document;
 class Element;
+class ExceptionState;
 class HTMLElement;
 class Node;
 class Position;
@@ -186,7 +187,7 @@
 
 // Functions returning Range
 
-PassRefPtr<Range> createRange(PassRefPtr<Document>, const VisiblePosition& start, const VisiblePosition& end, ExceptionCode&);
+PassRefPtr<Range> createRange(PassRefPtr<Document>, const VisiblePosition& start, const VisiblePosition& end, ExceptionState&);
 
 // -------------------------------------------------------------------------
 // HTMLElement
diff --git a/Source/core/editing/markup.cpp b/Source/core/editing/markup.cpp
index e5b0060..da3b8c9 100644
--- a/Source/core/editing/markup.cpp
+++ b/Source/core/editing/markup.cpp
@@ -32,6 +32,7 @@
 #include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/css/CSSPrimitiveValue.h"
 #include "core/css/CSSValue.h"
 #include "core/css/StylePropertySet.h"
@@ -40,7 +41,6 @@
 #include "core/dom/ContextFeatures.h"
 #include "core/dom/DocumentFragment.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/Range.h"
 #include "core/editing/Editor.h"
@@ -496,7 +496,7 @@
 
 static Node* highestAncestorToWrapMarkup(const Range* range, EAnnotateForInterchange shouldAnnotate, Node* constrainingAncestor)
 {
-    Node* commonAncestor = range->commonAncestorContainer(IGNORE_EXCEPTION);
+    Node* commonAncestor = range->commonAncestorContainer(IGNORE_EXCEPTION_STATE);
     ASSERT(commonAncestor);
     Node* specialCommonAncestor = 0;
     if (shouldAnnotate == AnnotateForInterchange) {
@@ -549,10 +549,10 @@
     ASSERT(updatedRange);
     DEFINE_STATIC_LOCAL(const String, interchangeNewlineString, (ASCIILiteral("<br class=\"" AppleInterchangeNewline "\">")));
 
-    bool collapsed = updatedRange->collapsed(ASSERT_NO_EXCEPTION);
+    bool collapsed = updatedRange->collapsed(ASSERT_NO_EXCEPTION_STATE);
     if (collapsed)
         return emptyString();
-    Node* commonAncestor = updatedRange->commonAncestorContainer(ASSERT_NO_EXCEPTION);
+    Node* commonAncestor = updatedRange->commonAncestorContainer(ASSERT_NO_EXCEPTION_STATE);
     if (!commonAncestor)
         return emptyString();
 
@@ -577,7 +577,7 @@
         accumulator.appendString(interchangeNewlineString);
         startNode = visibleStart.next().deepEquivalent().deprecatedNode();
 
-        if (pastEnd && Range::compareBoundaryPoints(startNode, 0, pastEnd, 0, ASSERT_NO_EXCEPTION) >= 0)
+        if (pastEnd && Range::compareBoundaryPoints(startNode, 0, pastEnd, 0, ASSERT_NO_EXCEPTION_STATE) >= 0)
             return interchangeNewlineString;
     }
 
@@ -682,7 +682,7 @@
         }
         next = NodeTraversal::nextSkippingChildren(node.get());
         ASSERT(!node->contains(nodeAfterContext));
-        node->parentNode()->removeChild(node.get(), ASSERT_NO_EXCEPTION);
+        node->parentNode()->removeChild(node.get(), ASSERT_NO_EXCEPTION_STATE);
         if (nodeBeforeContext == node)
             break;
     }
@@ -690,7 +690,7 @@
     ASSERT(nodeAfterContext->parentNode());
     for (RefPtr<Node> node = nodeAfterContext; node; node = next) {
         next = NodeTraversal::nextSkippingChildren(node.get());
-        node->parentNode()->removeChild(node.get(), ASSERT_NO_EXCEPTION);
+        node->parentNode()->removeChild(node.get(), ASSERT_NO_EXCEPTION_STATE);
     }
 }
 
@@ -720,7 +720,7 @@
         positionAfterNode(nodeBeforeContext.get()).parentAnchoredEquivalent(),
         positionBeforeNode(nodeAfterContext.get()).parentAnchoredEquivalent());
 
-    Node* commonAncestor = range->commonAncestorContainer(ASSERT_NO_EXCEPTION);
+    Node* commonAncestor = range->commonAncestorContainer(ASSERT_NO_EXCEPTION_STATE);
     Node* specialCommonAncestor = ancestorToRetainStructureAndAppearanceWithNoRenderer(commonAncestor);
 
     // When there's a special common ancestor outside of the fragment, we must include it as well to
@@ -728,7 +728,7 @@
     // TD, we need to include the enclosing TABLE tag as well.
     RefPtr<DocumentFragment> fragment = DocumentFragment::create(document);
     if (specialCommonAncestor)
-        fragment->appendChild(specialCommonAncestor, ASSERT_NO_EXCEPTION);
+        fragment->appendChild(specialCommonAncestor, ASSERT_NO_EXCEPTION_STATE);
     else
         fragment->takeAllChildrenFrom(toContainerNode(commonAncestor));
 
@@ -751,7 +751,7 @@
     Document* document = paragraph->document();
 
     if (string.isEmpty()) {
-        paragraph->appendChild(createBlockPlaceholderElement(document), ASSERT_NO_EXCEPTION);
+        paragraph->appendChild(createBlockPlaceholderElement(document), ASSERT_NO_EXCEPTION_STATE);
         return;
     }
 
@@ -768,11 +768,11 @@
         // append the non-tab textual part
         if (!s.isEmpty()) {
             if (!tabText.isEmpty()) {
-                paragraph->appendChild(createTabSpanElement(document, tabText), ASSERT_NO_EXCEPTION);
+                paragraph->appendChild(createTabSpanElement(document, tabText), ASSERT_NO_EXCEPTION_STATE);
                 tabText = emptyString();
             }
             RefPtr<Node> textNode = document->createTextNode(stringWithRebalancedWhitespace(s, first, i + 1 == numEntries));
-            paragraph->appendChild(textNode.release(), ASSERT_NO_EXCEPTION);
+            paragraph->appendChild(textNode.release(), ASSERT_NO_EXCEPTION_STATE);
         }
 
         // there is a tab after every entry, except the last entry
@@ -780,7 +780,7 @@
         if (i + 1 != numEntries)
             tabText.append('\t');
         else if (!tabText.isEmpty())
-            paragraph->appendChild(createTabSpanElement(document, tabText), ASSERT_NO_EXCEPTION);
+            paragraph->appendChild(createTabSpanElement(document, tabText), ASSERT_NO_EXCEPTION_STATE);
 
         first = false;
     }
@@ -821,11 +821,11 @@
 
     RenderObject* renderer = styleNode->renderer();
     if (renderer && renderer->style()->preserveNewline()) {
-        fragment->appendChild(document->createTextNode(string), ASSERT_NO_EXCEPTION);
+        fragment->appendChild(document->createTextNode(string), ASSERT_NO_EXCEPTION_STATE);
         if (string.endsWith('\n')) {
             RefPtr<Element> element = createBreakElement(document);
             element->setAttribute(classAttr, AppleInterchangeNewline);
-            fragment->appendChild(element.release(), ASSERT_NO_EXCEPTION);
+            fragment->appendChild(element.release(), ASSERT_NO_EXCEPTION_STATE);
         }
         return fragment.release();
     }
@@ -867,7 +867,7 @@
                 element = createDefaultParagraphElement(document);
             fillContainerFromString(element.get(), s);
         }
-        fragment->appendChild(element.release(), ASSERT_NO_EXCEPTION);
+        fragment->appendChild(element.release(), ASSERT_NO_EXCEPTION_STATE);
     }
     return fragment.release();
 }
@@ -882,8 +882,8 @@
     size_t size = nodes.size();
     for (size_t i = 0; i < size; ++i) {
         RefPtr<Element> element = createDefaultParagraphElement(document);
-        element->appendChild(nodes[i], ASSERT_NO_EXCEPTION);
-        fragment->appendChild(element.release(), ASSERT_NO_EXCEPTION);
+        element->appendChild(nodes[i], ASSERT_NO_EXCEPTION_STATE);
+        fragment->appendChild(element.release(), ASSERT_NO_EXCEPTION_STATE);
     }
 
     return fragment.release();
@@ -943,7 +943,7 @@
     return markup.toString();
 }
 
-PassRefPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String& markup, Element* contextElement, ParserContentPolicy parserContentPolicy, ExceptionCode& ec)
+PassRefPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String& markup, Element* contextElement, ParserContentPolicy parserContentPolicy, ExceptionState& es)
 {
     Document* document = contextElement->hasTagName(templateTag) ? contextElement->document()->ensureTemplateDocument() : contextElement->document();
     RefPtr<DocumentFragment> fragment = DocumentFragment::create(document);
@@ -955,7 +955,7 @@
 
     bool wasValid = fragment->parseXML(markup, contextElement, parserContentPolicy);
     if (!wasValid) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return 0;
     }
     return fragment.release();
@@ -990,27 +990,27 @@
     RefPtr<Node> nextChild;
     for (RefPtr<Node> child = element->firstChild(); child; child = nextChild) {
         nextChild = child->nextSibling();
-        element->removeChild(child.get(), ASSERT_NO_EXCEPTION);
-        fragment->insertBefore(child, element, ASSERT_NO_EXCEPTION);
+        element->removeChild(child.get(), ASSERT_NO_EXCEPTION_STATE);
+        fragment->insertBefore(child, element, ASSERT_NO_EXCEPTION_STATE);
     }
-    fragment->removeChild(element, ASSERT_NO_EXCEPTION);
+    fragment->removeChild(element, ASSERT_NO_EXCEPTION_STATE);
 }
 
-PassRefPtr<DocumentFragment> createContextualFragment(const String& markup, HTMLElement* element, ParserContentPolicy parserContentPolicy, ExceptionCode& ec)
+PassRefPtr<DocumentFragment> createContextualFragment(const String& markup, HTMLElement* element, ParserContentPolicy parserContentPolicy, ExceptionState& es)
 {
     ASSERT(element);
     if (element->ieForbidsInsertHTML()) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
     if (element->hasLocalName(colTag) || element->hasLocalName(colgroupTag) || element->hasLocalName(framesetTag)
         || element->hasLocalName(headTag) || element->hasLocalName(styleTag) || element->hasLocalName(titleTag)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
-    RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, element, parserContentPolicy, ec);
+    RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, element, parserContentPolicy, es);
     if (!fragment)
         return 0;
 
@@ -1042,7 +1042,7 @@
     return hasOneChild(node) && node->firstChild()->isTextNode();
 }
 
-void replaceChildrenWithFragment(ContainerNode* container, PassRefPtr<DocumentFragment> fragment, ExceptionCode& ec)
+void replaceChildrenWithFragment(ContainerNode* container, PassRefPtr<DocumentFragment> fragment, ExceptionState& es)
 {
     RefPtr<ContainerNode> containerNode(container);
 
@@ -1059,15 +1059,15 @@
     }
 
     if (hasOneChild(containerNode.get())) {
-        containerNode->replaceChild(fragment, containerNode->firstChild(), ec);
+        containerNode->replaceChild(fragment, containerNode->firstChild(), es);
         return;
     }
 
     containerNode->removeChildren();
-    containerNode->appendChild(fragment, ec);
+    containerNode->appendChild(fragment, es);
 }
 
-void replaceChildrenWithText(ContainerNode* container, const String& text, ExceptionCode& ec)
+void replaceChildrenWithText(ContainerNode* container, const String& text, ExceptionState& es)
 {
     RefPtr<ContainerNode> containerNode(container);
 
@@ -1081,12 +1081,12 @@
     RefPtr<Text> textNode = Text::create(containerNode->document(), text);
 
     if (hasOneChild(containerNode.get())) {
-        containerNode->replaceChild(textNode.release(), containerNode->firstChild(), ec);
+        containerNode->replaceChild(textNode.release(), containerNode->firstChild(), es);
         return;
     }
 
     containerNode->removeChildren();
-    containerNode->appendChild(textNode.release(), ec);
+    containerNode->appendChild(textNode.release(), es);
 }
 
 }
diff --git a/Source/core/editing/markup.h b/Source/core/editing/markup.h
index acb34df..2b80d11 100644
--- a/Source/core/editing/markup.h
+++ b/Source/core/editing/markup.h
@@ -37,14 +37,13 @@
 class Document;
 class DocumentFragment;
 class Element;
+class ExceptionState;
 class HTMLElement;
 class KURL;
 class Node;
 class QualifiedName;
 class Range;
 
-typedef int ExceptionCode;
-
 enum EChildrenOnly { IncludeNode, ChildrenOnly };
 enum EAbsoluteURLs { DoNotResolveURLs, ResolveAllURLs, ResolveNonLocalURLs };
 
@@ -52,16 +51,16 @@
 PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document*, const String& markup, const String& baseURL, ParserContentPolicy = AllowScriptingContent);
 PassRefPtr<DocumentFragment> createFragmentFromMarkupWithContext(Document*, const String& markup, unsigned fragmentStart, unsigned fragmentEnd, const String& baseURL, ParserContentPolicy);
 PassRefPtr<DocumentFragment> createFragmentFromNodes(Document*, const Vector<Node*>&);
-PassRefPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String&, Element*, ParserContentPolicy, ExceptionCode&);
+PassRefPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String&, Element*, ParserContentPolicy, ExceptionState&);
 PassRefPtr<DocumentFragment> createFragmentForTransformToFragment(const String&, const String& sourceMIMEType, Document* outputDoc);
-PassRefPtr<DocumentFragment> createContextualFragment(const String&, HTMLElement*, ParserContentPolicy, ExceptionCode&);
+PassRefPtr<DocumentFragment> createContextualFragment(const String&, HTMLElement*, ParserContentPolicy, ExceptionState&);
 
 bool isPlainTextMarkup(Node*);
 
 // These methods are used by HTMLElement & ShadowRoot to replace the
 // children with respected fragment/text.
-void replaceChildrenWithFragment(ContainerNode*, PassRefPtr<DocumentFragment>, ExceptionCode&);
-void replaceChildrenWithText(ContainerNode*, const String&, ExceptionCode&);
+void replaceChildrenWithFragment(ContainerNode*, PassRefPtr<DocumentFragment>, ExceptionState&);
+void replaceChildrenWithText(ContainerNode*, const String&, ExceptionState&);
 
 String createMarkup(const Range*, Vector<Node*>* = 0, EAnnotateForInterchange = DoNotAnnotateForInterchange, bool convertBlocksToInlines = false, EAbsoluteURLs = DoNotResolveURLs, Node* constrainingAncestor = 0);
 String createMarkup(const Node*, EChildrenOnly = IncludeNode, Vector<Node*>* = 0, EAbsoluteURLs = DoNotResolveURLs, Vector<QualifiedName>* tagNamesToSkip = 0);
diff --git a/Source/core/fileapi/File.cpp b/Source/core/fileapi/File.cpp
index 5a971a8..cb04664 100644
--- a/Source/core/fileapi/File.cpp
+++ b/Source/core/fileapi/File.cpp
@@ -29,6 +29,8 @@
 #include "core/platform/FileMetadata.h"
 #include "core/platform/FileSystem.h"
 #include "core/platform/MIMETypeRegistry.h"
+#include "public/platform/Platform.h"
+#include "public/platform/WebFileUtilities.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/DateMath.h"
 #include "wtf/text/WTFString.h"
@@ -94,7 +96,7 @@
 File::File(const String& path, ContentTypeLookupPolicy policy)
     : Blob(createBlobDataForFile(path, policy), -1)
     , m_path(path)
-    , m_name(pathGetFileName(path))
+    , m_name(WebKit::Platform::current()->fileUtilities()->baseName(path))
     , m_snapshotSize(-1)
     , m_snapshotModificationTime(invalidFileTime())
 {
@@ -108,7 +110,7 @@
     , m_snapshotModificationTime(invalidFileTime())
 {
     ScriptWrappable::init(this);
-    m_name = pathGetFileName(path);
+    m_name = WebKit::Platform::current()->fileUtilities()->baseName(path);
     // FIXME: File object serialization/deserialization does not include
     // newer file object data members: m_name and m_relativePath.
     // See SerializedScriptValue.cpp for js and v8.
diff --git a/Source/core/fileapi/FileReader.cpp b/Source/core/fileapi/FileReader.cpp
index 5535a8b..1bdefdb 100644
--- a/Source/core/fileapi/FileReader.cpp
+++ b/Source/core/fileapi/FileReader.cpp
@@ -31,6 +31,7 @@
 #include "config.h"
 #include "core/fileapi/FileReader.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/CrossThreadTask.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/ProgressEvent.h"
@@ -97,27 +98,27 @@
     terminate();
 }
 
-void FileReader::readAsArrayBuffer(Blob* blob, ExceptionCode& ec)
+void FileReader::readAsArrayBuffer(Blob* blob, ExceptionState& es)
 {
     if (!blob)
         return;
 
     LOG(FileAPI, "FileReader: reading as array buffer: %s %s\n", utf8BlobURL(blob).data(), utf8FilePath(blob).data());
 
-    readInternal(blob, FileReaderLoader::ReadAsArrayBuffer, ec);
+    readInternal(blob, FileReaderLoader::ReadAsArrayBuffer, es);
 }
 
-void FileReader::readAsBinaryString(Blob* blob, ExceptionCode& ec)
+void FileReader::readAsBinaryString(Blob* blob, ExceptionState& es)
 {
     if (!blob)
         return;
 
     LOG(FileAPI, "FileReader: reading as binary: %s %s\n", utf8BlobURL(blob).data(), utf8FilePath(blob).data());
 
-    readInternal(blob, FileReaderLoader::ReadAsBinaryString, ec);
+    readInternal(blob, FileReaderLoader::ReadAsBinaryString, es);
 }
 
-void FileReader::readAsText(Blob* blob, const String& encoding, ExceptionCode& ec)
+void FileReader::readAsText(Blob* blob, const String& encoding, ExceptionState& es)
 {
     if (!blob)
         return;
@@ -125,29 +126,29 @@
     LOG(FileAPI, "FileReader: reading as text: %s %s\n", utf8BlobURL(blob).data(), utf8FilePath(blob).data());
 
     m_encoding = encoding;
-    readInternal(blob, FileReaderLoader::ReadAsText, ec);
+    readInternal(blob, FileReaderLoader::ReadAsText, es);
 }
 
-void FileReader::readAsText(Blob* blob, ExceptionCode& ec)
+void FileReader::readAsText(Blob* blob, ExceptionState& es)
 {
-    readAsText(blob, String(), ec);
+    readAsText(blob, String(), es);
 }
 
-void FileReader::readAsDataURL(Blob* blob, ExceptionCode& ec)
+void FileReader::readAsDataURL(Blob* blob, ExceptionState& es)
 {
     if (!blob)
         return;
 
     LOG(FileAPI, "FileReader: reading as data URL: %s %s\n", utf8BlobURL(blob).data(), utf8FilePath(blob).data());
 
-    readInternal(blob, FileReaderLoader::ReadAsDataURL, ec);
+    readInternal(blob, FileReaderLoader::ReadAsDataURL, es);
 }
 
-void FileReader::readInternal(Blob* blob, FileReaderLoader::ReadType type, ExceptionCode& ec)
+void FileReader::readInternal(Blob* blob, FileReaderLoader::ReadType type, ExceptionState& es)
 {
     // If multiple concurrent read methods are called on the same FileReader, InvalidStateError should be thrown when the state is LOADING.
     if (m_state == LOADING) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
diff --git a/Source/core/fileapi/FileReader.h b/Source/core/fileapi/FileReader.h
index 27a4a2b..feefa8e 100644
--- a/Source/core/fileapi/FileReader.h
+++ b/Source/core/fileapi/FileReader.h
@@ -44,10 +44,9 @@
 namespace WebCore {
 
 class Blob;
+class ExceptionState;
 class ScriptExecutionContext;
 
-typedef int ExceptionCode;
-
 class FileReader : public RefCounted<FileReader>, public ScriptWrappable, public ActiveDOMObject, public EventTarget, public FileReaderLoaderClient {
 public:
     static PassRefPtr<FileReader> create(ScriptExecutionContext*);
@@ -60,11 +59,11 @@
         DONE = 2
     };
 
-    void readAsArrayBuffer(Blob*, ExceptionCode&);
-    void readAsBinaryString(Blob*, ExceptionCode&);
-    void readAsText(Blob*, const String& encoding, ExceptionCode&);
-    void readAsText(Blob*, ExceptionCode&);
-    void readAsDataURL(Blob*, ExceptionCode&);
+    void readAsArrayBuffer(Blob*, ExceptionState&);
+    void readAsBinaryString(Blob*, ExceptionState&);
+    void readAsText(Blob*, const String& encoding, ExceptionState&);
+    void readAsText(Blob*, ExceptionState&);
+    void readAsDataURL(Blob*, ExceptionState&);
     void abort();
 
     void doAbort();
@@ -109,7 +108,7 @@
     virtual EventTargetData* ensureEventTargetData() { return &m_eventTargetData; }
 
     void terminate();
-    void readInternal(Blob*, FileReaderLoader::ReadType, ExceptionCode&);
+    void readInternal(Blob*, FileReaderLoader::ReadType, ExceptionState&);
     void fireErrorEvent(int httpStatusCode);
     void fireEvent(const AtomicString& type);
 
diff --git a/Source/core/html/BaseChooserOnlyDateAndTimeInputType.cpp b/Source/core/html/BaseChooserOnlyDateAndTimeInputType.cpp
index 4682522..a8902d8 100644
--- a/Source/core/html/BaseChooserOnlyDateAndTimeInputType.cpp
+++ b/Source/core/html/BaseChooserOnlyDateAndTimeInputType.cpp
@@ -27,6 +27,7 @@
 #if !ENABLE(INPUT_MULTIPLE_FIELDS_UI)
 #include "core/html/BaseChooserOnlyDateAndTimeInputType.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "bindings/v8/ScriptController.h"
 #include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLDivElement.h"
@@ -76,7 +77,7 @@
         // Need to put something to keep text baseline.
         displayValue = ASCIILiteral(" ");
     }
-    toHTMLElement(node)->setInnerText(displayValue, ASSERT_NO_EXCEPTION);
+    toHTMLElement(node)->setInnerText(displayValue, ASSERT_NO_EXCEPTION_STATE);
 }
 
 void BaseChooserOnlyDateAndTimeInputType::setValue(const String& value, bool valueChanged, TextFieldEventBehavior eventBehavior)
diff --git a/Source/core/html/BaseDateAndTimeInputType.cpp b/Source/core/html/BaseDateAndTimeInputType.cpp
index 6013692..c86d076 100644
--- a/Source/core/html/BaseDateAndTimeInputType.cpp
+++ b/Source/core/html/BaseDateAndTimeInputType.cpp
@@ -52,7 +52,7 @@
     return valueAsDouble();
 }
 
-void BaseDateAndTimeInputType::setValueAsDate(double value, ExceptionCode&) const
+void BaseDateAndTimeInputType::setValueAsDate(double value, ExceptionState&) const
 {
     element()->setValue(serializeWithMilliseconds(value));
 }
@@ -63,7 +63,7 @@
     return value.isFinite() ? value.toDouble() : DateComponents::invalidMilliseconds();
 }
 
-void BaseDateAndTimeInputType::setValueAsDecimal(const Decimal& newValue, TextFieldEventBehavior eventBehavior, ExceptionCode&) const
+void BaseDateAndTimeInputType::setValueAsDecimal(const Decimal& newValue, TextFieldEventBehavior eventBehavior, ExceptionState&) const
 {
     element()->setValue(serialize(newValue), eventBehavior);
 }
diff --git a/Source/core/html/BaseDateAndTimeInputType.h b/Source/core/html/BaseDateAndTimeInputType.h
index 5416764..25e90c0 100644
--- a/Source/core/html/BaseDateAndTimeInputType.h
+++ b/Source/core/html/BaseDateAndTimeInputType.h
@@ -36,6 +36,8 @@
 
 namespace WebCore {
 
+class ExceptionState;
+
 // A super class of date, datetime, datetime-local, month, time, and week types.
 class BaseDateAndTimeInputType : public InputType {
 protected:
@@ -52,9 +54,9 @@
     virtual bool parseToDateComponentsInternal(const String&, DateComponents*) const = 0;
     virtual DateComponents::Type dateType() const = 0;
     virtual double valueAsDate() const OVERRIDE;
-    virtual void setValueAsDate(double, ExceptionCode&) const OVERRIDE;
+    virtual void setValueAsDate(double, ExceptionState&) const OVERRIDE;
     virtual double valueAsDouble() const OVERRIDE;
-    virtual void setValueAsDecimal(const Decimal&, TextFieldEventBehavior, ExceptionCode&) const OVERRIDE;
+    virtual void setValueAsDecimal(const Decimal&, TextFieldEventBehavior, ExceptionState&) const OVERRIDE;
     virtual bool typeMismatchFor(const String&) const OVERRIDE;
     virtual bool typeMismatch() const OVERRIDE;
     virtual bool valueMissing(const String&) const OVERRIDE;
diff --git a/Source/core/html/ColorInputType.cpp b/Source/core/html/ColorInputType.cpp
index 5a839f0..4855f03 100644
--- a/Source/core/html/ColorInputType.cpp
+++ b/Source/core/html/ColorInputType.cpp
@@ -33,6 +33,7 @@
 
 #include "CSSPropertyNames.h"
 #include "RuntimeEnabledFeatures.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "bindings/v8/ScriptController.h"
 #include "core/dom/MouseEvent.h"
 #include "core/dom/shadow/ShadowRoot.h"
@@ -122,8 +123,8 @@
     wrapperElement->setPseudo(AtomicString("-webkit-color-swatch-wrapper", AtomicString::ConstructFromLiteral));
     RefPtr<HTMLDivElement> colorSwatch = HTMLDivElement::create(document);
     colorSwatch->setPseudo(AtomicString("-webkit-color-swatch", AtomicString::ConstructFromLiteral));
-    wrapperElement->appendChild(colorSwatch.release(), ASSERT_NO_EXCEPTION);
-    element()->userAgentShadowRoot()->appendChild(wrapperElement.release(), ASSERT_NO_EXCEPTION);
+    wrapperElement->appendChild(colorSwatch.release(), ASSERT_NO_EXCEPTION_STATE);
+    element()->userAgentShadowRoot()->appendChild(wrapperElement.release(), ASSERT_NO_EXCEPTION_STATE);
 
     updateColorSwatch();
 }
diff --git a/Source/core/html/DOMSettableTokenList.cpp b/Source/core/html/DOMSettableTokenList.cpp
index a1dcafb..f311268 100644
--- a/Source/core/html/DOMSettableTokenList.cpp
+++ b/Source/core/html/DOMSettableTokenList.cpp
@@ -25,6 +25,8 @@
 #include "config.h"
 #include "core/html/DOMSettableTokenList.h"
 
+#include "bindings/v8/ExceptionState.h"
+
 namespace WebCore {
 
 DOMSettableTokenList::DOMSettableTokenList()
@@ -50,9 +52,9 @@
     return m_tokens.contains(token);
 }
 
-void DOMSettableTokenList::add(const Vector<String>& tokens, ExceptionCode& ec)
+void DOMSettableTokenList::add(const Vector<String>& tokens, ExceptionState& es)
 {
-    DOMTokenList::add(tokens, ec);
+    DOMTokenList::add(tokens, es);
 
     for (size_t i = 0; i < tokens.size(); ++i) {
         if (m_tokens.isNull())
@@ -71,9 +73,9 @@
         m_tokens.add(token);
 }
 
-void DOMSettableTokenList::remove(const Vector<String>& tokens, ExceptionCode& ec)
+void DOMSettableTokenList::remove(const Vector<String>& tokens, ExceptionState& es)
 {
-    DOMTokenList::remove(tokens, ec);
+    DOMTokenList::remove(tokens, es);
     for (size_t i = 0; i < tokens.size(); ++i)
         m_tokens.remove(tokens[i]);
 }
diff --git a/Source/core/html/DOMSettableTokenList.h b/Source/core/html/DOMSettableTokenList.h
index caa1079..ed1a725 100644
--- a/Source/core/html/DOMSettableTokenList.h
+++ b/Source/core/html/DOMSettableTokenList.h
@@ -32,7 +32,7 @@
 
 namespace WebCore {
 
-typedef int ExceptionCode;
+class ExceptionState;
 
 class DOMSettableTokenList : public DOMTokenList, public RefCounted<DOMSettableTokenList> {
     WTF_MAKE_FAST_ALLOCATED;
@@ -49,8 +49,8 @@
     virtual unsigned length() const OVERRIDE { return m_tokens.size(); }
     virtual const AtomicString item(unsigned index) const OVERRIDE;
 
-    virtual void add(const Vector<String>&, ExceptionCode&) OVERRIDE;
-    virtual void remove(const Vector<String>&, ExceptionCode&) OVERRIDE;
+    virtual void add(const Vector<String>&, ExceptionState&) OVERRIDE;
+    virtual void remove(const Vector<String>&, ExceptionState&) OVERRIDE;
 
     virtual AtomicString value() const OVERRIDE { return m_value; }
     virtual void setValue(const AtomicString&) OVERRIDE;
diff --git a/Source/core/html/DOMTokenList.cpp b/Source/core/html/DOMTokenList.cpp
index 2f9b122..74f7279 100644
--- a/Source/core/html/DOMTokenList.cpp
+++ b/Source/core/html/DOMTokenList.cpp
@@ -25,23 +25,24 @@
 #include "config.h"
 #include "core/html/DOMTokenList.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
-bool DOMTokenList::validateToken(const AtomicString& token, ExceptionCode& ec)
+bool DOMTokenList::validateToken(const AtomicString& token, ExceptionState& es)
 {
     if (token.isEmpty()) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return false;
     }
 
     unsigned length = token.length();
     for (unsigned i = 0; i < length; ++i) {
         if (isHTMLSpace(token[i])) {
-            ec = InvalidCharacterError;
+            es.throwDOMException(InvalidCharacterError);
             return false;
         }
     }
@@ -49,35 +50,35 @@
     return true;
 }
 
-bool DOMTokenList::validateTokens(const Vector<String>& tokens, ExceptionCode& ec)
+bool DOMTokenList::validateTokens(const Vector<String>& tokens, ExceptionState& es)
 {
     for (size_t i = 0; i < tokens.size(); ++i) {
-        if (!validateToken(tokens[i], ec))
+        if (!validateToken(tokens[i], es))
             return false;
     }
 
     return true;
 }
 
-bool DOMTokenList::contains(const AtomicString& token, ExceptionCode& ec) const
+bool DOMTokenList::contains(const AtomicString& token, ExceptionState& es) const
 {
-    if (!validateToken(token, ec))
+    if (!validateToken(token, es))
         return false;
     return containsInternal(token);
 }
 
-void DOMTokenList::add(const AtomicString& token, ExceptionCode& ec)
+void DOMTokenList::add(const AtomicString& token, ExceptionState& es)
 {
     Vector<String> tokens;
     tokens.append(token.string());
-    add(tokens, ec);
+    add(tokens, es);
 }
 
-void DOMTokenList::add(const Vector<String>& tokens, ExceptionCode& ec)
+void DOMTokenList::add(const Vector<String>& tokens, ExceptionState& es)
 {
     Vector<String> filteredTokens;
     for (size_t i = 0; i < tokens.size(); ++i) {
-        if (!validateToken(tokens[i], ec))
+        if (!validateToken(tokens[i], es))
             return;
         if (!containsInternal(tokens[i]))
             filteredTokens.append(tokens[i]);
@@ -89,16 +90,16 @@
     setValue(addTokens(value(), filteredTokens));
 }
 
-void DOMTokenList::remove(const AtomicString& token, ExceptionCode& ec)
+void DOMTokenList::remove(const AtomicString& token, ExceptionState& es)
 {
     Vector<String> tokens;
     tokens.append(token.string());
-    remove(tokens, ec);
+    remove(tokens, es);
 }
 
-void DOMTokenList::remove(const Vector<String>& tokens, ExceptionCode& ec)
+void DOMTokenList::remove(const Vector<String>& tokens, ExceptionState& es)
 {
-    if (!validateTokens(tokens, ec))
+    if (!validateTokens(tokens, es))
         return;
 
     // Check using containsInternal first since it is a lot faster than going
@@ -115,9 +116,9 @@
         setValue(removeTokens(value(), tokens));
 }
 
-bool DOMTokenList::toggle(const AtomicString& token, ExceptionCode& ec)
+bool DOMTokenList::toggle(const AtomicString& token, ExceptionState& es)
 {
-    if (!validateToken(token, ec))
+    if (!validateToken(token, es))
         return false;
 
     if (containsInternal(token)) {
@@ -128,9 +129,9 @@
     return true;
 }
 
-bool DOMTokenList::toggle(const AtomicString& token, bool force, ExceptionCode& ec)
+bool DOMTokenList::toggle(const AtomicString& token, bool force, ExceptionState& es)
 {
-    if (!validateToken(token, ec))
+    if (!validateToken(token, es))
         return false;
 
     if (force)
diff --git a/Source/core/html/DOMTokenList.h b/Source/core/html/DOMTokenList.h
index 400a830..a476803 100644
--- a/Source/core/html/DOMTokenList.h
+++ b/Source/core/html/DOMTokenList.h
@@ -32,8 +32,7 @@
 namespace WebCore {
 
 class Element;
-
-typedef int ExceptionCode;
+class ExceptionState;
 
 class DOMTokenList : public ScriptWrappable {
     WTF_MAKE_NONCOPYABLE(DOMTokenList); WTF_MAKE_FAST_ALLOCATED;
@@ -50,13 +49,13 @@
     virtual unsigned length() const = 0;
     virtual const AtomicString item(unsigned index) const = 0;
 
-    bool contains(const AtomicString&, ExceptionCode&) const;
-    virtual void add(const Vector<String>&, ExceptionCode&);
-    void add(const AtomicString&, ExceptionCode&);
-    virtual void remove(const Vector<String>&, ExceptionCode&);
-    void remove(const AtomicString&, ExceptionCode&);
-    bool toggle(const AtomicString&, ExceptionCode&);
-    bool toggle(const AtomicString&, bool force, ExceptionCode&);
+    bool contains(const AtomicString&, ExceptionState&) const;
+    virtual void add(const Vector<String>&, ExceptionState&);
+    void add(const AtomicString&, ExceptionState&);
+    virtual void remove(const Vector<String>&, ExceptionState&);
+    void remove(const AtomicString&, ExceptionState&);
+    bool toggle(const AtomicString&, ExceptionState&);
+    bool toggle(const AtomicString&, bool force, ExceptionState&);
 
     AtomicString toString() const { return value(); }
 
@@ -70,8 +69,8 @@
     virtual bool containsInternal(const AtomicString&) const = 0;
     virtual void removeInternal(const AtomicString&);
 
-    static bool validateToken(const AtomicString&, ExceptionCode&);
-    static bool validateTokens(const Vector<String>&, ExceptionCode&);
+    static bool validateToken(const AtomicString&, ExceptionState&);
+    static bool validateTokens(const Vector<String>&, ExceptionState&);
     static String addToken(const AtomicString&, const AtomicString&);
     static String addTokens(const AtomicString&, const Vector<String>&);
     static String removeToken(const AtomicString&, const AtomicString&);
diff --git a/Source/core/html/DateTimeLocalInputType.cpp b/Source/core/html/DateTimeLocalInputType.cpp
index 5edd420..10769fb 100644
--- a/Source/core/html/DateTimeLocalInputType.cpp
+++ b/Source/core/html/DateTimeLocalInputType.cpp
@@ -32,6 +32,7 @@
 #include "core/html/DateTimeLocalInputType.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/InputTypeNames.h"
 #include "core/platform/DateComponents.h"
@@ -78,10 +79,10 @@
     return DateComponents::invalidMilliseconds();
 }
 
-void DateTimeLocalInputType::setValueAsDate(double value, ExceptionCode& ec) const
+void DateTimeLocalInputType::setValueAsDate(double value, ExceptionState& es) const
 {
     // valueAsDate doesn't work for the datetime-local type according to the standard.
-    InputType::setValueAsDate(value, ec);
+    InputType::setValueAsDate(value, es);
 }
 
 StepRange DateTimeLocalInputType::createStepRange(AnyStepHandling anyStepHandling) const
diff --git a/Source/core/html/DateTimeLocalInputType.h b/Source/core/html/DateTimeLocalInputType.h
index 5b89a78..6a06c24 100644
--- a/Source/core/html/DateTimeLocalInputType.h
+++ b/Source/core/html/DateTimeLocalInputType.h
@@ -36,6 +36,8 @@
 
 namespace WebCore {
 
+class ExceptionState;
+
 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
 typedef BaseMultipleFieldsDateAndTimeInputType BaseDateTimeLocalInputType;
 #else
@@ -52,7 +54,7 @@
     virtual const AtomicString& formControlType() const OVERRIDE;
     virtual DateComponents::Type dateType() const OVERRIDE;
     virtual double valueAsDate() const OVERRIDE;
-    virtual void setValueAsDate(double, ExceptionCode&) const OVERRIDE;
+    virtual void setValueAsDate(double, ExceptionState&) const OVERRIDE;
     virtual StepRange createStepRange(AnyStepHandling) const;
     virtual bool parseToDateComponentsInternal(const String&, DateComponents*) const OVERRIDE;
     virtual bool setMillisecondToDateComponents(double, DateComponents*) const OVERRIDE;
diff --git a/Source/core/html/FileInputType.cpp b/Source/core/html/FileInputType.cpp
index b63e46d..6fa8726 100644
--- a/Source/core/html/FileInputType.cpp
+++ b/Source/core/html/FileInputType.cpp
@@ -23,6 +23,7 @@
 #include "core/html/FileInputType.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "bindings/v8/ScriptController.h"
 #include "core/dom/Event.h"
 #include "core/dom/shadow/ShadowRoot.h"
@@ -259,7 +260,7 @@
     button->setType(InputTypeNames::button());
     button->setAttribute(valueAttr, element()->multiple() ? fileButtonChooseMultipleFilesLabel() : fileButtonChooseFileLabel());
     button->setPseudo(AtomicString("-webkit-file-upload-button", AtomicString::ConstructFromLiteral));
-    element()->userAgentShadowRoot()->appendChild(button.release(), IGNORE_EXCEPTION);
+    element()->userAgentShadowRoot()->appendChild(button.release(), IGNORE_EXCEPTION_STATE);
 }
 
 void FileInputType::disabledAttributeChanged()
diff --git a/Source/core/html/HTMLAppletElement.h b/Source/core/html/HTMLAppletElement.h
index 03ebbdb..179317b 100644
--- a/Source/core/html/HTMLAppletElement.h
+++ b/Source/core/html/HTMLAppletElement.h
@@ -43,6 +43,9 @@
     virtual void updateWidget(PluginCreationOption) OVERRIDE;
 
     bool canEmbedJava() const;
+
+    virtual bool shouldRegisterAsNamedItem() const OVERRIDE { return true; }
+    virtual bool shouldRegisterAsExtraNamedItem() const OVERRIDE { return true; }
 };
 
 }
diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp
index 55b386c..e277196 100644
--- a/Source/core/html/HTMLCanvasElement.cpp
+++ b/Source/core/html/HTMLCanvasElement.cpp
@@ -30,23 +30,22 @@
 
 #include <math.h>
 #include "HTMLNames.h"
+#include "RuntimeEnabledFeatures.h"
+#include "bindings/v8/ExceptionState.h"
 #include "bindings/v8/ScriptController.h"
 #include "core/dom/Document.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/html/ImageData.h"
 #include "core/html/canvas/Canvas2DContextAttributes.h"
 #include "core/html/canvas/CanvasRenderingContext2D.h"
+#include "core/html/canvas/WebGLContextAttributes.h"
+#include "core/html/canvas/WebGLRenderingContext.h"
 #include "core/page/Frame.h"
-#include "RuntimeEnabledFeatures.h"
 #include "core/page/Settings.h"
 #include "core/platform/MIMETypeRegistry.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/platform/graphics/ImageBuffer.h"
 #include "core/rendering/RenderHTMLCanvas.h"
-
-#include "core/html/canvas/WebGLContextAttributes.h"
-#include "core/html/canvas/WebGLRenderingContext.h"
-
 #include "public/platform/Platform.h"
 
 namespace WebCore {
@@ -368,10 +367,10 @@
     return lowercaseMimeType;
 }
 
-String HTMLCanvasElement::toDataURL(const String& mimeType, const double* quality, ExceptionCode& ec)
+String HTMLCanvasElement::toDataURL(const String& mimeType, const double* quality, ExceptionState& es)
 {
     if (!m_originClean) {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return String();
     }
 
diff --git a/Source/core/html/HTMLCanvasElement.h b/Source/core/html/HTMLCanvasElement.h
index 0589e4c..2aed48b 100644
--- a/Source/core/html/HTMLCanvasElement.h
+++ b/Source/core/html/HTMLCanvasElement.h
@@ -90,8 +90,8 @@
     CanvasRenderingContext* getContext(const String&, CanvasContextAttributes* attributes = 0);
 
     static String toEncodingMimeType(const String& mimeType);
-    String toDataURL(const String& mimeType, const double* quality, ExceptionCode&);
-    String toDataURL(const String& mimeType, ExceptionCode& ec) { return toDataURL(mimeType, 0, ec); }
+    String toDataURL(const String& mimeType, const double* quality, ExceptionState&);
+    String toDataURL(const String& mimeType, ExceptionState& es) { return toDataURL(mimeType, 0, es); }
 
     // Used for rendering
     void didDraw(const FloatRect&);
diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp
index 7bf3bed..613c57a 100644
--- a/Source/core/html/HTMLCollection.cpp
+++ b/Source/core/html/HTMLCollection.cpp
@@ -29,7 +29,6 @@
 #include "core/dom/NodeRareData.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/html/HTMLElement.h"
-#include "core/html/HTMLNameCollection.h"
 #include "core/html/HTMLObjectElement.h"
 #include "core/html/HTMLOptionElement.h"
 
@@ -222,12 +221,10 @@
     case DocAll:
     case NodeChildren:
         return true;
-    case DocumentNamedItems:
-        return static_cast<const DocumentNameCollection*>(htmlCollection)->nodeMatches(element);
-    case WindowNamedItems:
-        return static_cast<const WindowNameCollection*>(htmlCollection)->nodeMatches(element);
     case FormControls:
+    case DocumentNamedItems:
     case TableRows:
+    case WindowNamedItems:
     case ChildNodeListType:
     case ClassNodeListType:
     case NameNodeListType:
@@ -510,6 +507,21 @@
         || element->hasLocalName(selectTag);
 }
 
+bool HTMLCollection::checkForNameMatch(Element* element, bool checkName, const AtomicString& name) const
+{
+    if (!element->isHTMLElement())
+        return false;
+
+    HTMLElement* e = toHTMLElement(element);
+    if (!checkName)
+        return e->getIdAttribute() == name;
+
+    if (type() == DocAll && !nameShouldBeVisibleInDocumentAll(e))
+        return false;
+
+    return e->getNameAttribute() == name && e->getIdAttribute() != name;
+}
+
 inline Element* firstMatchingChildElement(const HTMLCollection* nodeList, ContainerNode* root)
 {
     Element* element = ElementTraversal::firstWithin(root);
@@ -576,42 +588,26 @@
     // that are allowed a name attribute.
 
     ContainerNode* root = rootContainerNode();
-    if (name.isEmpty() || !root)
+    if (!root)
         return 0;
 
-    if (!overridesItemAfter() && root->isInTreeScope()) {
-        TreeScope* treeScope = root->treeScope();
-        Element* candidate = 0;
-        if (treeScope->hasElementWithId(name)) {
-            if (!treeScope->containsMultipleElementsWithId(name))
-                candidate = treeScope->getElementById(name);
-        } else if (treeScope->hasElementWithName(name)) {
-            if (!treeScope->containsMultipleElementsWithName(name)) {
-                candidate = treeScope->getElementByName(name);
-                if (candidate && type() == DocAll && (!candidate->isHTMLElement() || !nameShouldBeVisibleInDocumentAll(toHTMLElement(candidate))))
-                    candidate = 0;
-            }
-        } else {
-            return 0;
+    unsigned arrayOffset = 0;
+    unsigned i = 0;
+    for (Element* element = traverseFirstElement(arrayOffset, root); element; element = traverseNextElement(arrayOffset, element, root)) {
+        if (checkForNameMatch(element, /* checkName */ false, name)) {
+            setItemCache(element, i, arrayOffset);
+            return element;
         }
-
-        if (candidate
-            && isMatchingElement(this, candidate)
-            && (shouldOnlyIncludeDirectChildren() ? candidate->parentNode() == root : candidate->isDescendantOf(root)))
-            return candidate;
+        i++;
     }
 
-    // The pathological case. We need to walk the entire subtree.
-    updateNameCache();
-
-    if (Vector<Element*>* idResults = idCache(name)) {
-        if (idResults->size())
-            return idResults->at(0);
-    }
-
-    if (Vector<Element*>* nameResults = nameCache(name)) {
-        if (nameResults->size())
-            return nameResults->at(0);
+    i = 0;
+    for (Element* element = traverseFirstElement(arrayOffset, root); element; element = traverseNextElement(arrayOffset, element, root)) {
+        if (checkForNameMatch(element, /* checkName */ true, name)) {
+            setItemCache(element, i, arrayOffset);
+            return element;
+        }
+        i++;
     }
 
     return 0;
@@ -644,8 +640,22 @@
 
 bool HTMLCollection::hasNamedItem(const AtomicString& name) const
 {
-    // FIXME: We can do better when there are multiple elements of the same name.
-    return namedItem(name);
+    if (name.isEmpty())
+        return false;
+
+    updateNameCache();
+
+    if (Vector<Element*>* cache = idCache(name)) {
+        if (!cache->isEmpty())
+            return true;
+    }
+
+    if (Vector<Element*>* cache = nameCache(name)) {
+        if (!cache->isEmpty())
+            return true;
+    }
+
+    return false;
 }
 
 void HTMLCollection::namedItems(const AtomicString& name, Vector<RefPtr<Node> >& result) const
diff --git a/Source/core/html/HTMLCollection.h b/Source/core/html/HTMLCollection.h
index e11029d..585cd9e 100644
--- a/Source/core/html/HTMLCollection.h
+++ b/Source/core/html/HTMLCollection.h
@@ -77,6 +77,7 @@
     void appendNameCache(const AtomicString& name, Element* element) const { append(m_nameCache, name, element); }
 
 private:
+    bool checkForNameMatch(Element*, bool checkName, const AtomicString& name) const;
     Element* traverseNextElement(unsigned& offsetInArray, Element* previous, ContainerNode* root) const;
 
     virtual bool isLiveNodeList() const OVERRIDE { ASSERT_NOT_REACHED(); return true; }
diff --git a/Source/core/html/HTMLDetailsElement.cpp b/Source/core/html/HTMLDetailsElement.cpp
index c0e1f9e..442e9d3 100644
--- a/Source/core/html/HTMLDetailsElement.cpp
+++ b/Source/core/html/HTMLDetailsElement.cpp
@@ -22,6 +22,7 @@
 #include "core/html/HTMLDetailsElement.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/NodeRenderingContext.h"
 #include "core/dom/Text.h"
 #include "core/dom/shadow/ShadowRoot.h"
@@ -63,14 +64,14 @@
 void HTMLDetailsElement::didAddUserAgentShadowRoot(ShadowRoot* root)
 {
     RefPtr<HTMLSummaryElement> defaultSummary = HTMLSummaryElement::create(summaryTag, document());
-    defaultSummary->appendChild(Text::create(document(), defaultDetailsSummaryText()), ASSERT_NO_EXCEPTION);
+    defaultSummary->appendChild(Text::create(document(), defaultDetailsSummaryText()), ASSERT_NO_EXCEPTION_STATE);
 
     RefPtr<HTMLContentElement> content = HTMLContentElement::create(document());
     content->setSelect(summaryQuerySelector());
     content->appendChild(defaultSummary);
 
-    root->appendChild(content, ASSERT_NO_EXCEPTION, AttachLazily);
-    root->appendChild(HTMLContentElement::create(document()), ASSERT_NO_EXCEPTION, AttachLazily);
+    root->appendChild(content, ASSERT_NO_EXCEPTION_STATE, AttachLazily);
+    root->appendChild(HTMLContentElement::create(document()), ASSERT_NO_EXCEPTION_STATE, AttachLazily);
 }
 
 Element* HTMLDetailsElement::findMainSummary() const
diff --git a/Source/core/html/HTMLDialogElement.cpp b/Source/core/html/HTMLDialogElement.cpp
index bdd1b6a..2cc07bd 100644
--- a/Source/core/html/HTMLDialogElement.cpp
+++ b/Source/core/html/HTMLDialogElement.cpp
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "core/html/HTMLDialogElement.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/page/FrameView.h"
 #include "core/rendering/RenderBlock.h"
@@ -56,10 +57,10 @@
     return adoptRef(new HTMLDialogElement(tagName, document));
 }
 
-void HTMLDialogElement::close(const String& returnValue, ExceptionCode& ec)
+void HTMLDialogElement::close(const String& returnValue, ExceptionState& es)
 {
     if (!fastHasAttribute(openAttr)) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
     setBooleanAttribute(openAttr, false);
@@ -112,10 +113,10 @@
     reposition();
 }
 
-void HTMLDialogElement::showModal(ExceptionCode& ec)
+void HTMLDialogElement::showModal(ExceptionState& es)
 {
     if (fastHasAttribute(openAttr) || !inDocument()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
     document()->addToTopLayer(this);
diff --git a/Source/core/html/HTMLDialogElement.h b/Source/core/html/HTMLDialogElement.h
index 948b8d4..a34d33e 100644
--- a/Source/core/html/HTMLDialogElement.h
+++ b/Source/core/html/HTMLDialogElement.h
@@ -31,15 +31,16 @@
 namespace WebCore {
 
 class Document;
+class ExceptionState;
 class QualifiedName;
 
 class HTMLDialogElement FINAL : public HTMLElement {
 public:
     static PassRefPtr<HTMLDialogElement> create(const QualifiedName&, Document*);
 
-    void close(const String& returnValue, ExceptionCode&);
+    void close(const String& returnValue, ExceptionState&);
     void show();
-    void showModal(ExceptionCode&);
+    void showModal(ExceptionState&);
 
     String returnValue() const { return m_returnValue; }
     void setReturnValue(const String& returnValue) { m_returnValue = returnValue; }
diff --git a/Source/core/html/HTMLDocument.cpp b/Source/core/html/HTMLDocument.cpp
index abbbe00..33f5417 100644
--- a/Source/core/html/HTMLDocument.cpp
+++ b/Source/core/html/HTMLDocument.cpp
@@ -220,6 +220,44 @@
 // not part of the DOM
 // --------------------------------------------------------------------------
 
+void HTMLDocument::addItemToMap(HashCountedSet<StringImpl*>& map, const AtomicString& name)
+{
+    if (name.isEmpty())
+        return;
+    map.add(name.impl());
+    if (Frame* f = frame())
+        f->script()->namedItemAdded(this, name);
+}
+
+void HTMLDocument::removeItemFromMap(HashCountedSet<StringImpl*>& map, const AtomicString& name)
+{
+    if (name.isEmpty())
+        return;
+    map.remove(name.impl());
+    if (Frame* f = frame())
+        f->script()->namedItemRemoved(this, name);
+}
+
+void HTMLDocument::addNamedItem(const AtomicString& name)
+{
+    addItemToMap(m_namedItemCounts, name);
+}
+
+void HTMLDocument::removeNamedItem(const AtomicString& name)
+{
+    removeItemFromMap(m_namedItemCounts, name);
+}
+
+void HTMLDocument::addExtraNamedItem(const AtomicString& name)
+{
+    addItemToMap(m_extraNamedItemCounts, name);
+}
+
+void HTMLDocument::removeExtraNamedItem(const AtomicString& name)
+{
+    removeItemFromMap(m_extraNamedItemCounts, name);
+}
+
 static void addLocalNameToSet(HashSet<StringImpl*>* set, const QualifiedName& qName)
 {
     set->add(qName.localName().impl());
@@ -287,20 +325,6 @@
     return !isPossibleHTMLAttr || !htmlCaseInsensitiveAttributesSet->contains(attributeName.localName().impl());
 }
 
-void HTMLDocument::addNamedDocumentItem(const AtomicString& key, Element* element)
-{
-    m_documentNamedItem.add(key.impl(), element);
-    if (Frame* frame = this->frame())
-        frame->script()->namedItemAdded(this, key);
-}
-
-void HTMLDocument::removeNamedDocumentItem(const AtomicString& key, Element* element)
-{
-    m_documentNamedItem.remove(key.impl(), element);
-    if (Frame* frame = this->frame())
-        frame->script()->namedItemRemoved(this, key);
-}
-
 void HTMLDocument::clear()
 {
     // FIXME: This does nothing, and that seems unlikely to be correct.
diff --git a/Source/core/html/HTMLDocument.h b/Source/core/html/HTMLDocument.h
index 0714b6d..4d6332e 100644
--- a/Source/core/html/HTMLDocument.h
+++ b/Source/core/html/HTMLDocument.h
@@ -66,11 +66,13 @@
     void captureEvents() { }
     void releaseEvents() { }
 
-    DocumentOrderedMap& windowNamedItemMap() { return m_windowNamedItem; }
+    void addNamedItem(const AtomicString& name);
+    void removeNamedItem(const AtomicString& name);
+    bool hasNamedItem(StringImpl* name);
 
-    void addNamedDocumentItem(const AtomicString&, Element*);
-    void removeNamedDocumentItem(const AtomicString&, Element*);
-    DocumentOrderedMap& documentNamedItemMap() { return m_documentNamedItem; }
+    void addExtraNamedItem(const AtomicString& name);
+    void removeExtraNamedItem(const AtomicString& name);
+    bool hasExtraNamedItem(StringImpl* name);
 
     static bool isCaseSensitiveAttribute(const QualifiedName&);
 
@@ -79,11 +81,25 @@
 
 private:
     HTMLBodyElement* bodyAsHTMLBodyElement() const;
+    void addItemToMap(HashCountedSet<StringImpl*>&, const AtomicString&);
+    void removeItemFromMap(HashCountedSet<StringImpl*>&, const AtomicString&);
 
-    DocumentOrderedMap m_documentNamedItem;
-    DocumentOrderedMap m_windowNamedItem;
+    HashCountedSet<StringImpl*> m_namedItemCounts;
+    HashCountedSet<StringImpl*> m_extraNamedItemCounts;
 };
 
+inline bool HTMLDocument::hasNamedItem(StringImpl* name)
+{
+    ASSERT(name);
+    return m_namedItemCounts.contains(name);
+}
+
+inline bool HTMLDocument::hasExtraNamedItem(StringImpl* name)
+{
+    ASSERT(name);
+    return m_extraNamedItemCounts.contains(name);
+}
+
 inline HTMLDocument* toHTMLDocument(Document* document)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!document || document->isHTMLDocument());
diff --git a/Source/core/html/HTMLElement.cpp b/Source/core/html/HTMLElement.cpp
index b1538f4..de8a8fa 100644
--- a/Source/core/html/HTMLElement.cpp
+++ b/Source/core/html/HTMLElement.cpp
@@ -29,6 +29,7 @@
 #include "CSSValueKeywords.h"
 #include "HTMLNames.h"
 #include "XMLNames.h"
+#include "bindings/v8/ExceptionState.h"
 #include "bindings/v8/ScriptController.h"
 #include "bindings/v8/ScriptEventListener.h"
 #include "core/css/CSSParser.h"
@@ -315,17 +316,17 @@
     return createMarkup(this);
 }
 
-void HTMLElement::setInnerHTML(const String& html, ExceptionCode& ec)
+void HTMLElement::setInnerHTML(const String& html, ExceptionState& es)
 {
-    if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, this, AllowScriptingContent, ec)) {
+    if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, this, AllowScriptingContent, es)) {
         ContainerNode* container = this;
         if (hasLocalName(templateTag))
             container = toHTMLTemplateElement(this)->content();
-        replaceChildrenWithFragment(container, fragment.release(), ec);
+        replaceChildrenWithFragment(container, fragment.release(), es);
     }
 }
 
-static void mergeWithNextTextNode(PassRefPtr<Node> node, ExceptionCode& ec)
+static void mergeWithNextTextNode(PassRefPtr<Node> node, ExceptionState& es)
 {
     ASSERT(node && node->isTextNode());
     Node* next = node->nextSibling();
@@ -336,34 +337,34 @@
     RefPtr<Text> textNext = toText(next);
     textNode->appendData(textNext->data());
     if (textNext->parentNode()) // Might have been removed by mutation event.
-        textNext->remove(ec);
+        textNext->remove(es);
 }
 
-void HTMLElement::setOuterHTML(const String& html, ExceptionCode& ec)
+void HTMLElement::setOuterHTML(const String& html, ExceptionState& es)
 {
     Node* p = parentNode();
     if (!p || !p->isHTMLElement()) {
-        ec = NoModificationAllowedError;
+        es.throwDOMException(NoModificationAllowedError);
         return;
     }
     RefPtr<HTMLElement> parent = toHTMLElement(p);
     RefPtr<Node> prev = previousSibling();
     RefPtr<Node> next = nextSibling();
 
-    RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, parent.get(), AllowScriptingContent, ec);
-    if (ec)
+    RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, parent.get(), AllowScriptingContent, es);
+    if (es.hadException())
         return;
 
-    parent->replaceChild(fragment.release(), this, ec);
+    parent->replaceChild(fragment.release(), this, es);
     RefPtr<Node> node = next ? next->previousSibling() : 0;
-    if (!ec && node && node->isTextNode())
-        mergeWithNextTextNode(node.release(), ec);
+    if (!es.hadException() && node && node->isTextNode())
+        mergeWithNextTextNode(node.release(), es);
 
-    if (!ec && prev && prev->isTextNode())
-        mergeWithNextTextNode(prev.release(), ec);
+    if (!es.hadException() && prev && prev->isTextNode())
+        mergeWithNextTextNode(prev.release(), es);
 }
 
-PassRefPtr<DocumentFragment> HTMLElement::textToFragment(const String& text, ExceptionCode& ec)
+PassRefPtr<DocumentFragment> HTMLElement::textToFragment(const String& text, ExceptionState& es)
 {
     RefPtr<DocumentFragment> fragment = DocumentFragment::create(document());
     unsigned int i, length = text.length();
@@ -377,13 +378,13 @@
               break;
         }
 
-        fragment->appendChild(Text::create(document(), text.substring(start, i - start)), ec);
-        if (ec)
+        fragment->appendChild(Text::create(document(), text.substring(start, i - start)), es);
+        if (es.hadException())
             return 0;
 
         if (c == '\r' || c == '\n') {
-            fragment->appendChild(HTMLBRElement::create(document()), ec);
-            if (ec)
+            fragment->appendChild(HTMLBRElement::create(document()), es);
+            if (es.hadException())
                 return 0;
             // Make sure \r\n doesn't result in two line breaks.
             if (c == '\r' && i + 1 < length && text[i + 1] == '\n')
@@ -396,17 +397,17 @@
     return fragment;
 }
 
-void HTMLElement::setInnerText(const String& text, ExceptionCode& ec)
+void HTMLElement::setInnerText(const String& text, ExceptionState& es)
 {
     if (ieForbidsInsertHTML()) {
-        ec = NoModificationAllowedError;
+        es.throwDOMException(NoModificationAllowedError);
         return;
     }
     if (hasLocalName(colTag) || hasLocalName(colgroupTag) || hasLocalName(framesetTag) ||
         hasLocalName(headTag) || hasLocalName(htmlTag) || hasLocalName(tableTag) ||
         hasLocalName(tbodyTag) || hasLocalName(tfootTag) || hasLocalName(theadTag) ||
         hasLocalName(trTag)) {
-        ec = NoModificationAllowedError;
+        es.throwDOMException(NoModificationAllowedError);
         return;
     }
 
@@ -417,7 +418,7 @@
             removeChildren();
             return;
         }
-        replaceChildrenWithText(this, text, ec);
+        replaceChildrenWithText(this, text, es);
         return;
     }
 
@@ -427,69 +428,69 @@
     RenderObject* r = renderer();
     if (r && r->style()->preserveNewline()) {
         if (!text.contains('\r')) {
-            replaceChildrenWithText(this, text, ec);
+            replaceChildrenWithText(this, text, es);
             return;
         }
         String textWithConsistentLineBreaks = text;
         textWithConsistentLineBreaks.replace("\r\n", "\n");
         textWithConsistentLineBreaks.replace('\r', '\n');
-        replaceChildrenWithText(this, textWithConsistentLineBreaks, ec);
+        replaceChildrenWithText(this, textWithConsistentLineBreaks, es);
         return;
     }
 
     // Add text nodes and <br> elements.
-    ec = 0;
-    RefPtr<DocumentFragment> fragment = textToFragment(text, ec);
-    if (!ec)
-        replaceChildrenWithFragment(this, fragment.release(), ec);
+    es.clearException();
+    RefPtr<DocumentFragment> fragment = textToFragment(text, es);
+    if (!es.hadException())
+        replaceChildrenWithFragment(this, fragment.release(), es);
 }
 
-void HTMLElement::setOuterText(const String &text, ExceptionCode& ec)
+void HTMLElement::setOuterText(const String &text, ExceptionState& es)
 {
     if (ieForbidsInsertHTML()) {
-        ec = NoModificationAllowedError;
+        es.throwDOMException(NoModificationAllowedError);
         return;
     }
     if (hasLocalName(colTag) || hasLocalName(colgroupTag) || hasLocalName(framesetTag) ||
         hasLocalName(headTag) || hasLocalName(htmlTag) || hasLocalName(tableTag) ||
         hasLocalName(tbodyTag) || hasLocalName(tfootTag) || hasLocalName(theadTag) ||
         hasLocalName(trTag)) {
-        ec = NoModificationAllowedError;
+        es.throwDOMException(NoModificationAllowedError);
         return;
     }
 
     ContainerNode* parent = parentNode();
     if (!parent) {
-        ec = NoModificationAllowedError;
+        es.throwDOMException(NoModificationAllowedError);
         return;
     }
 
     RefPtr<Node> prev = previousSibling();
     RefPtr<Node> next = nextSibling();
     RefPtr<Node> newChild;
-    ec = 0;
+    es.clearException();
 
     // Convert text to fragment with <br> tags instead of linebreaks if needed.
     if (text.contains('\r') || text.contains('\n'))
-        newChild = textToFragment(text, ec);
+        newChild = textToFragment(text, es);
     else
         newChild = Text::create(document(), text);
 
     if (!this || !parentNode())
-        ec = HierarchyRequestError;
-    if (ec)
+        es.throwDOMException(HierarchyRequestError);
+    if (es.hadException())
         return;
-    parent->replaceChild(newChild.release(), this, ec);
+    parent->replaceChild(newChild.release(), this, es);
 
     RefPtr<Node> node = next ? next->previousSibling() : 0;
-    if (!ec && node && node->isTextNode())
-        mergeWithNextTextNode(node.release(), ec);
+    if (!es.hadException() && node && node->isTextNode())
+        mergeWithNextTextNode(node.release(), es);
 
-    if (!ec && prev && prev->isTextNode())
-        mergeWithNextTextNode(prev.release(), ec);
+    if (!es.hadException() && prev && prev->isTextNode())
+        mergeWithNextTextNode(prev.release(), es);
 }
 
-Node* HTMLElement::insertAdjacent(const String& where, Node* newChild, ExceptionCode& ec)
+Node* HTMLElement::insertAdjacent(const String& where, Node* newChild, ExceptionState& es)
 {
     // In Internet Explorer if the element has no parent and where is "beforeBegin" or "afterEnd",
     // a document fragment is created and the elements appended in the correct order. This document
@@ -500,81 +501,81 @@
 
     if (equalIgnoringCase(where, "beforeBegin")) {
         if (ContainerNode* parent = this->parentNode()) {
-            parent->insertBefore(newChild, this, ec, AttachLazily);
-            if (!ec)
+            parent->insertBefore(newChild, this, es, AttachLazily);
+            if (!es.hadException())
                 return newChild;
         }
         return 0;
     }
 
     if (equalIgnoringCase(where, "afterBegin")) {
-        insertBefore(newChild, firstChild(), ec, AttachLazily);
-        return ec ? 0 : newChild;
+        insertBefore(newChild, firstChild(), es, AttachLazily);
+        return es.hadException() ? 0 : newChild;
     }
 
     if (equalIgnoringCase(where, "beforeEnd")) {
-        appendChild(newChild, ec, AttachLazily);
-        return ec ? 0 : newChild;
+        appendChild(newChild, es, AttachLazily);
+        return es.hadException() ? 0 : newChild;
     }
 
     if (equalIgnoringCase(where, "afterEnd")) {
         if (ContainerNode* parent = this->parentNode()) {
-            parent->insertBefore(newChild, nextSibling(), ec, AttachLazily);
-            if (!ec)
+            parent->insertBefore(newChild, nextSibling(), es, AttachLazily);
+            if (!es.hadException())
                 return newChild;
         }
         return 0;
     }
 
     // IE throws COM Exception E_INVALIDARG; this is the best DOM exception alternative.
-    ec = NotSupportedError;
+    es.throwDOMException(NotSupportedError);
     return 0;
 }
 
-Element* HTMLElement::insertAdjacentElement(const String& where, Element* newChild, ExceptionCode& ec)
+Element* HTMLElement::insertAdjacentElement(const String& where, Element* newChild, ExceptionState& es)
 {
     if (!newChild) {
         // IE throws COM Exception E_INVALIDARG; this is the best DOM exception alternative.
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return 0;
     }
 
-    Node* returnValue = insertAdjacent(where, newChild, ec);
+    Node* returnValue = insertAdjacent(where, newChild, es);
     return toElement(returnValue);
 }
 
 // Step 3 of http://www.whatwg.org/specs/web-apps/current-work/multipage/apis-in-html-documents.html#insertadjacenthtml()
-static Element* contextElementForInsertion(const String& where, Element* element, ExceptionCode& ec)
+static Element* contextElementForInsertion(const String& where, Element* element, ExceptionState& es)
 {
     if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "afterEnd")) {
         ContainerNode* parent = element->parentNode();
         if (parent && !parent->isElementNode()) {
-            ec = NoModificationAllowedError;
+            es.throwDOMException(NoModificationAllowedError);
             return 0;
         }
         return toElement(parent);
     }
     if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "beforeEnd"))
         return element;
-    ec =  SyntaxError;
+    es.throwDOMException(SyntaxError);
     return 0;
 }
 
-void HTMLElement::insertAdjacentHTML(const String& where, const String& markup, ExceptionCode& ec)
+void HTMLElement::insertAdjacentHTML(const String& where, const String& markup, ExceptionState& es)
 {
-    Element* contextElement = contextElementForInsertion(where, this, ec);
+    Element* contextElement = contextElementForInsertion(where, this, es);
     if (!contextElement)
         return;
-    RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, contextElement, AllowScriptingContent, ec);
+    RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, contextElement, AllowScriptingContent, es);
     if (!fragment)
         return;
-    insertAdjacent(where, fragment.get(), ec);
+    insertAdjacent(where, fragment.get(), es);
 }
 
-void HTMLElement::insertAdjacentText(const String& where, const String& text, ExceptionCode& ec)
+void HTMLElement::insertAdjacentText(const String& where, const String& text, ExceptionState& es)
 {
     RefPtr<Text> textNode = document()->createTextNode(text);
-    insertAdjacent(where, textNode.get(), ec);
+    insertAdjacent(where, textNode.get(), es);
 }
 
 void HTMLElement::applyAlignmentAttributeToStyle(const AtomicString& alignment, MutableStylePropertySet* style)
@@ -661,7 +662,7 @@
     return "inherit";
 }
 
-void HTMLElement::setContentEditable(const String& enabled, ExceptionCode& ec)
+void HTMLElement::setContentEditable(const String& enabled, ExceptionState& es)
 {
     if (equalIgnoringCase(enabled, "true"))
         setAttribute(contenteditableAttr, "true");
@@ -672,7 +673,7 @@
     else if (equalIgnoringCase(enabled, "inherit"))
         removeAttribute(contenteditableAttr);
     else
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
 }
 
 bool HTMLElement::draggable() const
diff --git a/Source/core/html/HTMLElement.h b/Source/core/html/HTMLElement.h
index 4918a7a..40eafa3 100644
--- a/Source/core/html/HTMLElement.h
+++ b/Source/core/html/HTMLElement.h
@@ -30,6 +30,7 @@
 class DocumentFragment;
 class HTMLCollection;
 class HTMLFormElement;
+class ExceptionState;
 
 enum TranslateAttributeMode {
     TranslateAttributeYes,
@@ -48,20 +49,20 @@
 
     String innerHTML() const;
     String outerHTML() const;
-    void setInnerHTML(const String&, ExceptionCode&);
-    void setOuterHTML(const String&, ExceptionCode&);
-    void setInnerText(const String&, ExceptionCode&);
-    void setOuterText(const String&, ExceptionCode&);
+    void setInnerHTML(const String&, ExceptionState&);
+    void setOuterHTML(const String&, ExceptionState&);
+    void setInnerText(const String&, ExceptionState&);
+    void setOuterText(const String&, ExceptionState&);
 
-    Element* insertAdjacentElement(const String& where, Element* newChild, ExceptionCode&);
-    void insertAdjacentHTML(const String& where, const String& html, ExceptionCode&);
-    void insertAdjacentText(const String& where, const String& text, ExceptionCode&);
+    Element* insertAdjacentElement(const String& where, Element* newChild, ExceptionState&);
+    void insertAdjacentHTML(const String& where, const String& html, ExceptionState&);
+    void insertAdjacentText(const String& where, const String& text, ExceptionState&);
 
     virtual bool hasCustomFocusLogic() const;
     virtual bool supportsFocus() const;
 
     String contentEditable() const;
-    void setContentEditable(const String&, ExceptionCode&);
+    void setContentEditable(const String&, ExceptionState&);
 
     virtual bool draggable() const;
     void setDraggable(bool);
@@ -118,8 +119,8 @@
 
     virtual HTMLFormElement* virtualForm() const;
 
-    Node* insertAdjacent(const String& where, Node* newChild, ExceptionCode&);
-    PassRefPtr<DocumentFragment> textToFragment(const String&, ExceptionCode&);
+    Node* insertAdjacent(const String& where, Node* newChild, ExceptionState&);
+    PassRefPtr<DocumentFragment> textToFragment(const String&, ExceptionState&);
 
     void dirAttributeChanged(const AtomicString&);
     void adjustDirectionalityIfNeededAfterChildAttributeChanged(Element* child);
diff --git a/Source/core/html/HTMLEmbedElement.h b/Source/core/html/HTMLEmbedElement.h
index bd3a002..a5acdc8 100644
--- a/Source/core/html/HTMLEmbedElement.h
+++ b/Source/core/html/HTMLEmbedElement.h
@@ -50,6 +50,8 @@
     virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
 
     void parametersForPlugin(Vector<String>& paramNames, Vector<String>& paramValues);
+
+    virtual bool shouldRegisterAsNamedItem() const OVERRIDE { return true; }
 };
 
 }
diff --git a/Source/core/html/HTMLFormElement.h b/Source/core/html/HTMLFormElement.h
index 817575f..a0bd172 100644
--- a/Source/core/html/HTMLFormElement.h
+++ b/Source/core/html/HTMLFormElement.h
@@ -140,6 +140,8 @@
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
     virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
 
+    virtual bool shouldRegisterAsNamedItem() const OVERRIDE { return true; }
+
     virtual void copyNonAttributePropertiesFromElement(const Element&) OVERRIDE;
 
     void submit(Event*, bool activateSubmitButton, bool processingUserGesture, FormSubmissionTrigger);
diff --git a/Source/core/html/HTMLFrameOwnerElement.cpp b/Source/core/html/HTMLFrameOwnerElement.cpp
index 3835575..8378678 100644
--- a/Source/core/html/HTMLFrameOwnerElement.cpp
+++ b/Source/core/html/HTMLFrameOwnerElement.cpp
@@ -21,6 +21,7 @@
 #include "config.h"
 #include "core/html/HTMLFrameOwnerElement.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
@@ -112,13 +113,13 @@
     return m_contentFrame && HTMLElement::isKeyboardFocusable();
 }
 
-SVGDocument* HTMLFrameOwnerElement::getSVGDocument(ExceptionCode& ec) const
+SVGDocument* HTMLFrameOwnerElement::getSVGDocument(ExceptionState& es) const
 {
     Document* doc = contentDocument();
     if (doc && doc->isSVGDocument())
         return toSVGDocument(doc);
     // Spec: http://www.w3.org/TR/SVG/struct.html#InterfaceGetSVGDocument
-    ec = NotSupportedError;
+    es.throwDOMException(NotSupportedError);
     return 0;
 }
 
diff --git a/Source/core/html/HTMLFrameOwnerElement.h b/Source/core/html/HTMLFrameOwnerElement.h
index d8bd923..bf8ef0c 100644
--- a/Source/core/html/HTMLFrameOwnerElement.h
+++ b/Source/core/html/HTMLFrameOwnerElement.h
@@ -26,6 +26,7 @@
 namespace WebCore {
 
 class DOMWindow;
+class ExceptionState;
 class Frame;
 class RenderPart;
 class SVGDocument;
@@ -48,7 +49,7 @@
     // RenderObject when using fallback content.
     RenderPart* renderPart() const;
 
-    SVGDocument* getSVGDocument(ExceptionCode&) const;
+    SVGDocument* getSVGDocument(ExceptionState&) const;
 
     virtual ScrollbarMode scrollingMode() const { return ScrollbarAuto; }
 
diff --git a/Source/core/html/HTMLIFrameElement.cpp b/Source/core/html/HTMLIFrameElement.cpp
index fc757bb..7e25c2a 100644
--- a/Source/core/html/HTMLIFrameElement.cpp
+++ b/Source/core/html/HTMLIFrameElement.cpp
@@ -77,7 +77,14 @@
 
 void HTMLIFrameElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
-    if (name == sandboxAttr) {
+    if (name == nameAttr) {
+        if (inDocument() && document()->isHTMLDocument() && !isInShadowTree()) {
+            HTMLDocument* document = toHTMLDocument(this->document());
+            document->removeExtraNamedItem(m_name);
+            document->addExtraNamedItem(value);
+        }
+        m_name = value;
+    } else if (name == sandboxAttr) {
         String invalidTokens;
         setSandboxFlags(value.isNull() ? SandboxNone : SecurityContext::parseSandboxPolicy(value, invalidTokens));
         if (!invalidTokens.isNull())
@@ -100,6 +107,21 @@
     return new RenderIFrame(this);
 }
 
+Node::InsertionNotificationRequest HTMLIFrameElement::insertedInto(ContainerNode* insertionPoint)
+{
+    InsertionNotificationRequest result = HTMLFrameElementBase::insertedInto(insertionPoint);
+    if (insertionPoint->inDocument() && document()->isHTMLDocument() && !insertionPoint->isInShadowTree())
+        toHTMLDocument(document())->addExtraNamedItem(m_name);
+    return result;
+}
+
+void HTMLIFrameElement::removedFrom(ContainerNode* insertionPoint)
+{
+    HTMLFrameElementBase::removedFrom(insertionPoint);
+    if (insertionPoint->inDocument() && document()->isHTMLDocument() && !insertionPoint->isInShadowTree())
+        toHTMLDocument(document())->removeExtraNamedItem(m_name);
+}
+
 bool HTMLIFrameElement::shouldDisplaySeamlessly() const
 {
     return contentDocument() && contentDocument()->shouldDisplaySeamlesslyWithParent();
diff --git a/Source/core/html/HTMLIFrameElement.h b/Source/core/html/HTMLIFrameElement.h
index d7306f4..9aa74ae 100644
--- a/Source/core/html/HTMLIFrameElement.h
+++ b/Source/core/html/HTMLIFrameElement.h
@@ -41,6 +41,9 @@
     virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
     virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStylePropertySet*) OVERRIDE;
 
+    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
+    virtual void removedFrom(ContainerNode*) OVERRIDE;
+
     virtual bool rendererIsNeeded(const NodeRenderingContext&);
     virtual RenderObject* createRenderer(RenderStyle*);
 
@@ -49,6 +52,7 @@
     virtual bool loadedNonEmptyDocument() const OVERRIDE { return m_didLoadNonEmptyDocument; }
     virtual void didLoadNonEmptyDocument() OVERRIDE { m_didLoadNonEmptyDocument = true; }
 
+    AtomicString m_name;
     bool m_didLoadNonEmptyDocument;
 };
 
diff --git a/Source/core/html/HTMLImageElement.cpp b/Source/core/html/HTMLImageElement.cpp
index 1e53ef1..e96f979 100644
--- a/Source/core/html/HTMLImageElement.cpp
+++ b/Source/core/html/HTMLImageElement.cpp
@@ -28,7 +28,6 @@
 #include "bindings/v8/ScriptEventListener.h"
 #include "core/dom/Attribute.h"
 #include "core/dom/EventNames.h"
-#include "core/html/HTMLDocument.h"
 #include "core/html/HTMLFormElement.h"
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/loader/cache/CachedImage.h"
@@ -123,22 +122,8 @@
         BlendMode blendOp = BlendModeNormal;
         if (!parseCompositeAndBlendOperator(value, m_compositeOperator, blendOp))
             m_compositeOperator = CompositeSourceOver;
-    } else {
-        if (name == nameAttr) {
-            bool willHaveName = !value.isNull();
-            if (hasName() != willHaveName && inDocument() && !isInShadowTree() && document()->isHTMLDocument()) {
-                HTMLDocument* document = toHTMLDocument(this->document());
-                const AtomicString& id = getIdAttribute();
-                if (!id.isEmpty()) {
-                    if (willHaveName)
-                        document->addNamedDocumentItem(id, this);
-                    else
-                        document->removeNamedDocumentItem(id, this);
-                }
-            }
-        }
+    } else
         HTMLElement::parseAttribute(name, value);
-    }
 }
 
 String HTMLImageElement::altText() const
diff --git a/Source/core/html/HTMLImageElement.h b/Source/core/html/HTMLImageElement.h
index 2630353..9cebf82 100644
--- a/Source/core/html/HTMLImageElement.h
+++ b/Source/core/html/HTMLImageElement.h
@@ -101,6 +101,8 @@
 
     virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
     virtual void removedFrom(ContainerNode*) OVERRIDE;
+    virtual bool shouldRegisterAsNamedItem() const OVERRIDE { return true; }
+    virtual bool shouldRegisterAsExtraNamedItem() const OVERRIDE { return true; }
 
     virtual Image* imageContents() OVERRIDE;
 
diff --git a/Source/core/html/HTMLInputElement.cpp b/Source/core/html/HTMLInputElement.cpp
index cae1f57..3512604 100644
--- a/Source/core/html/HTMLInputElement.cpp
+++ b/Source/core/html/HTMLInputElement.cpp
@@ -32,6 +32,7 @@
 #include "CSSPropertyNames.h"
 #include "HTMLNames.h"
 #include "RuntimeEnabledFeatures.h"
+#include "bindings/v8/ExceptionState.h"
 #include "bindings/v8/ScriptEventListener.h"
 #include "core/accessibility/AXObjectCache.h"
 #include "core/dom/BeforeTextInsertedEvent.h"
@@ -340,14 +341,14 @@
     return m_inputType->findClosestTickMarkValue(value);
 }
 
-void HTMLInputElement::stepUp(int n, ExceptionCode& ec)
+void HTMLInputElement::stepUp(int n, ExceptionState& es)
 {
-    m_inputType->stepUp(n, ec);
+    m_inputType->stepUp(n, es);
 }
 
-void HTMLInputElement::stepDown(int n, ExceptionCode& ec)
+void HTMLInputElement::stepDown(int n, ExceptionState& es)
 {
-    m_inputType->stepUp(-n, ec);
+    m_inputType->stepUp(-n, es);
 }
 
 void HTMLInputElement::blur()
@@ -556,73 +557,73 @@
     return isTextField();
 }
 
-int HTMLInputElement::selectionStartForBinding(ExceptionCode& ec) const
+int HTMLInputElement::selectionStartForBinding(ExceptionState& es) const
 {
     if (!canHaveSelection()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
     return HTMLTextFormControlElement::selectionStart();
 }
 
-int HTMLInputElement::selectionEndForBinding(ExceptionCode& ec) const
+int HTMLInputElement::selectionEndForBinding(ExceptionState& es) const
 {
     if (!canHaveSelection()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
     return HTMLTextFormControlElement::selectionEnd();
 }
 
-String HTMLInputElement::selectionDirectionForBinding(ExceptionCode& ec) const
+String HTMLInputElement::selectionDirectionForBinding(ExceptionState& es) const
 {
     if (!canHaveSelection()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return String();
     }
     return HTMLTextFormControlElement::selectionDirection();
 }
 
-void HTMLInputElement::setSelectionStartForBinding(int start, ExceptionCode& ec)
+void HTMLInputElement::setSelectionStartForBinding(int start, ExceptionState& es)
 {
     if (!canHaveSelection()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
     HTMLTextFormControlElement::setSelectionStart(start);
 }
 
-void HTMLInputElement::setSelectionEndForBinding(int end, ExceptionCode& ec)
+void HTMLInputElement::setSelectionEndForBinding(int end, ExceptionState& es)
 {
     if (!canHaveSelection()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
     HTMLTextFormControlElement::setSelectionEnd(end);
 }
 
-void HTMLInputElement::setSelectionDirectionForBinding(const String& direction, ExceptionCode& ec)
+void HTMLInputElement::setSelectionDirectionForBinding(const String& direction, ExceptionState& es)
 {
     if (!canHaveSelection()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
     HTMLTextFormControlElement::setSelectionDirection(direction);
 }
 
-void HTMLInputElement::setSelectionRangeForBinding(int start, int end, ExceptionCode& ec)
+void HTMLInputElement::setSelectionRangeForBinding(int start, int end, ExceptionState& es)
 {
     if (!canHaveSelection()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
     HTMLTextFormControlElement::setSelectionRange(start, end);
 }
 
-void HTMLInputElement::setSelectionRangeForBinding(int start, int end, const String& direction, ExceptionCode& ec)
+void HTMLInputElement::setSelectionRangeForBinding(int start, int end, const String& direction, ExceptionState& es)
 {
     if (!canHaveSelection()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
     HTMLTextFormControlElement::setSelectionRange(start, end, direction);
@@ -1030,10 +1031,10 @@
     dispatchInputEvent();
 }
 
-void HTMLInputElement::setValue(const String& value, ExceptionCode& ec, TextFieldEventBehavior eventBehavior)
+void HTMLInputElement::setValue(const String& value, ExceptionState& es, TextFieldEventBehavior eventBehavior)
 {
     if (isFileUpload() && !value.isEmpty()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
     setValue(value, eventBehavior);
@@ -1072,9 +1073,9 @@
     return m_inputType->valueAsDate();
 }
 
-void HTMLInputElement::setValueAsDate(double value, ExceptionCode& ec)
+void HTMLInputElement::setValueAsDate(double value, ExceptionState& es)
 {
-    m_inputType->setValueAsDate(value, ec);
+    m_inputType->setValueAsDate(value, es);
 }
 
 double HTMLInputElement::valueAsNumber() const
@@ -1082,13 +1083,13 @@
     return m_inputType->valueAsDouble();
 }
 
-void HTMLInputElement::setValueAsNumber(double newValue, ExceptionCode& ec, TextFieldEventBehavior eventBehavior)
+void HTMLInputElement::setValueAsNumber(double newValue, ExceptionState& es, TextFieldEventBehavior eventBehavior)
 {
     if (!std::isfinite(newValue)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
-    m_inputType->setValueAsDouble(newValue, eventBehavior, ec);
+    m_inputType->setValueAsDouble(newValue, eventBehavior, es);
 }
 
 void HTMLInputElement::setValueFromRenderer(const String& value)
@@ -1317,10 +1318,10 @@
     return m_maxLength;
 }
 
-void HTMLInputElement::setMaxLength(int maxLength, ExceptionCode& ec)
+void HTMLInputElement::setMaxLength(int maxLength, ExceptionState& es)
 {
     if (maxLength < 0)
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
     else
         setAttribute(maxlengthAttr, String::number(maxLength));
 }
@@ -1335,10 +1336,10 @@
     setAttribute(sizeAttr, String::number(size));
 }
 
-void HTMLInputElement::setSize(unsigned size, ExceptionCode& ec)
+void HTMLInputElement::setSize(unsigned size, ExceptionState& es)
 {
     if (!size)
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
     else
         setSize(size);
 }
@@ -1829,24 +1830,24 @@
     m_element->listAttributeTargetChanged();
 }
 
-void HTMLInputElement::setRangeText(const String& replacement, ExceptionCode& ec)
+void HTMLInputElement::setRangeText(const String& replacement, ExceptionState& es)
 {
     if (!m_inputType->supportsSelectionAPI()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
-    HTMLTextFormControlElement::setRangeText(replacement, ec);
+    HTMLTextFormControlElement::setRangeText(replacement, es);
 }
 
-void HTMLInputElement::setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionCode& ec)
+void HTMLInputElement::setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionState& es)
 {
     if (!m_inputType->supportsSelectionAPI()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
-    HTMLTextFormControlElement::setRangeText(replacement, start, end, selectionMode, ec);
+    HTMLTextFormControlElement::setRangeText(replacement, start, end, selectionMode, es);
 }
 
 bool HTMLInputElement::setupDateTimeChooserParameters(DateTimeChooserParameters& parameters)
diff --git a/Source/core/html/HTMLInputElement.h b/Source/core/html/HTMLInputElement.h
index 18da1fe..268be2b 100644
--- a/Source/core/html/HTMLInputElement.h
+++ b/Source/core/html/HTMLInputElement.h
@@ -33,6 +33,7 @@
 
 class CheckedRadioButtons;
 class DragData;
+class ExceptionState;
 class FileList;
 class HTMLDataListElement;
 class HTMLImageLoader;
@@ -76,10 +77,10 @@
     Decimal findClosestTickMarkValue(const Decimal&);
 
     // Implementations of HTMLInputElement::stepUp() and stepDown().
-    void stepUp(int, ExceptionCode&);
-    void stepDown(int, ExceptionCode&);
-    void stepUp(ExceptionCode& ec) { stepUp(1, ec); }
-    void stepDown(ExceptionCode& ec) { stepDown(1, ec); }
+    void stepUp(int, ExceptionState&);
+    void stepDown(int, ExceptionState&);
+    void stepUp(ExceptionState& es) { stepUp(1, es); }
+    void stepDown(ExceptionState& es) { stepDown(1, es); }
     // stepUp()/stepDown() for user-interaction.
     bool isSteppable() const;
 
@@ -147,7 +148,7 @@
     void setType(const String&);
 
     String value() const;
-    void setValue(const String&, ExceptionCode&, TextFieldEventBehavior = DispatchNoEvent);
+    void setValue(const String&, ExceptionState&, TextFieldEventBehavior = DispatchNoEvent);
     void setValue(const String&, TextFieldEventBehavior = DispatchNoEvent);
     void setValueForUser(const String&);
     // Checks if the specified string would be a valid value.
@@ -168,23 +169,23 @@
     void setEditingValue(const String&);
 
     double valueAsDate() const;
-    void setValueAsDate(double, ExceptionCode&);
+    void setValueAsDate(double, ExceptionState&);
 
     double valueAsNumber() const;
-    void setValueAsNumber(double, ExceptionCode&, TextFieldEventBehavior = DispatchNoEvent);
+    void setValueAsNumber(double, ExceptionState&, TextFieldEventBehavior = DispatchNoEvent);
 
     String valueWithDefault() const;
 
     void setValueFromRenderer(const String&);
 
-    int selectionStartForBinding(ExceptionCode&) const;
-    int selectionEndForBinding(ExceptionCode&) const;
-    String selectionDirectionForBinding(ExceptionCode&) const;
-    void setSelectionStartForBinding(int, ExceptionCode&);
-    void setSelectionEndForBinding(int, ExceptionCode&);
-    void setSelectionDirectionForBinding(const String&, ExceptionCode&);
-    void setSelectionRangeForBinding(int start, int end, ExceptionCode&);
-    void setSelectionRangeForBinding(int start, int end, const String& direction, ExceptionCode&);
+    int selectionStartForBinding(ExceptionState&) const;
+    int selectionEndForBinding(ExceptionState&) const;
+    String selectionDirectionForBinding(ExceptionState&) const;
+    void setSelectionStartForBinding(int, ExceptionState&);
+    void setSelectionEndForBinding(int, ExceptionState&);
+    void setSelectionDirectionForBinding(const String&, ExceptionState&);
+    void setSelectionRangeForBinding(int start, int end, ExceptionState&);
+    void setSelectionRangeForBinding(int start, int end, const String& direction, ExceptionState&);
 
     virtual bool rendererIsNeeded(const NodeRenderingContext&);
     virtual RenderObject* createRenderer(RenderStyle*);
@@ -209,12 +210,12 @@
     String alt() const;
 
     void setSize(unsigned);
-    void setSize(unsigned, ExceptionCode&);
+    void setSize(unsigned, ExceptionState&);
 
     KURL src() const;
 
     virtual int maxLength() const;
-    void setMaxLength(int, ExceptionCode&);
+    void setMaxLength(int, ExceptionState&);
 
     bool multiple() const;
 
@@ -282,8 +283,8 @@
 
     virtual bool matchesReadOnlyPseudoClass() const OVERRIDE;
     virtual bool matchesReadWritePseudoClass() const OVERRIDE;
-    virtual void setRangeText(const String& replacement, ExceptionCode&) OVERRIDE;
-    virtual void setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionCode&) OVERRIDE;
+    virtual void setRangeText(const String& replacement, ExceptionState&) OVERRIDE;
+    virtual void setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionState&) OVERRIDE;
 
     bool hasImageLoader() const { return m_imageLoader; }
     HTMLImageLoader* imageLoader();
diff --git a/Source/core/html/HTMLKeygenElement.cpp b/Source/core/html/HTMLKeygenElement.cpp
index ff619e2..f2a2eff 100644
--- a/Source/core/html/HTMLKeygenElement.cpp
+++ b/Source/core/html/HTMLKeygenElement.cpp
@@ -26,6 +26,7 @@
 #include "core/html/HTMLKeygenElement.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Document.h"
 #include "core/dom/Text.h"
 #include "core/dom/shadow/ShadowRoot.h"
@@ -61,11 +62,11 @@
     select->setPseudo(keygenSelectPseudoId);
     for (size_t i = 0; i < keys.size(); ++i) {
         RefPtr<HTMLOptionElement> option = HTMLOptionElement::create(document());
-        option->appendChild(Text::create(document(), keys[i]), ASSERT_NO_EXCEPTION);
-        select->appendChild(option, ASSERT_NO_EXCEPTION);
+        option->appendChild(Text::create(document(), keys[i]), ASSERT_NO_EXCEPTION_STATE);
+        select->appendChild(option, ASSERT_NO_EXCEPTION_STATE);
     }
 
-    root->appendChild(select, ASSERT_NO_EXCEPTION);
+    root->appendChild(select, ASSERT_NO_EXCEPTION_STATE);
 }
 
 void HTMLKeygenElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
diff --git a/Source/core/html/HTMLMarqueeElement.cpp b/Source/core/html/HTMLMarqueeElement.cpp
index 2b321e9..aa7963d 100644
--- a/Source/core/html/HTMLMarqueeElement.cpp
+++ b/Source/core/html/HTMLMarqueeElement.cpp
@@ -26,6 +26,7 @@
 #include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/rendering/RenderMarquee.h"
 
@@ -127,10 +128,10 @@
     return ok && scrollAmount >= 0 ? scrollAmount : RenderStyle::initialMarqueeIncrement().intValue();
 }
 
-void HTMLMarqueeElement::setScrollAmount(int scrollAmount, ExceptionCode& ec)
+void HTMLMarqueeElement::setScrollAmount(int scrollAmount, ExceptionState& es)
 {
     if (scrollAmount < 0)
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
     else
         setIntegralAttribute(scrollamountAttr, scrollAmount);
 }
@@ -142,10 +143,10 @@
     return ok && scrollDelay >= 0 ? scrollDelay : RenderStyle::initialMarqueeSpeed();
 }
 
-void HTMLMarqueeElement::setScrollDelay(int scrollDelay, ExceptionCode& ec)
+void HTMLMarqueeElement::setScrollDelay(int scrollDelay, ExceptionState& es)
 {
     if (scrollDelay < 0)
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
     else
         setIntegralAttribute(scrolldelayAttr, scrollDelay);
 }
@@ -157,10 +158,10 @@
     return ok && loopValue > 0 ? loopValue : -1;
 }
 
-void HTMLMarqueeElement::setLoop(int loop, ExceptionCode& ec)
+void HTMLMarqueeElement::setLoop(int loop, ExceptionState& es)
 {
     if (loop <= 0 && loop != -1)
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
     else
         setIntegralAttribute(loopAttr, loop);
 }
diff --git a/Source/core/html/HTMLMarqueeElement.h b/Source/core/html/HTMLMarqueeElement.h
index 0ca06ac..c1bc4b8 100644
--- a/Source/core/html/HTMLMarqueeElement.h
+++ b/Source/core/html/HTMLMarqueeElement.h
@@ -28,6 +28,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class RenderMarquee;
 
 class HTMLMarqueeElement FINAL : public HTMLElement, private ActiveDOMObject {
@@ -42,13 +43,13 @@
     void stop();
 
     int scrollAmount() const;
-    void setScrollAmount(int, ExceptionCode&);
+    void setScrollAmount(int, ExceptionState&);
 
     int scrollDelay() const;
-    void setScrollDelay(int, ExceptionCode&);
+    void setScrollDelay(int, ExceptionState&);
 
     int loop() const;
-    void setLoop(int, ExceptionCode&);
+    void setLoop(int, ExceptionState&);
 
 private:
     HTMLMarqueeElement(const QualifiedName&, Document*);
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index f7fa25f..fd2679e 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -28,6 +28,8 @@
 
 #include "HTMLNames.h"
 #include "RuntimeEnabledFeatures.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "bindings/v8/ScriptController.h"
 #include "bindings/v8/ScriptEventListener.h"
 #include "core/css/MediaList.h"
@@ -36,7 +38,6 @@
 #include "core/dom/Event.h"
 #include "core/dom/EventNames.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/FullscreenElementStack.h"
 #include "core/dom/NodeRenderingContext.h"
 #include "core/dom/shadow/ShadowRoot.h"
@@ -151,19 +152,21 @@
         map.add(document, set);
 }
 
-static ExceptionCode exceptionCodeForMediaKeyException(MediaPlayer::MediaKeyException exception)
+static void throwExceptionForMediaKeyException(MediaPlayer::MediaKeyException exception, ExceptionState& es)
 {
     switch (exception) {
     case MediaPlayer::NoError:
-        return 0;
+        return;
     case MediaPlayer::InvalidPlayerState:
-        return InvalidStateError;
+        es.throwDOMException(InvalidStateError);
+        return;
     case MediaPlayer::KeySystemNotSupported:
-        return NotSupportedError;
+        es.throwDOMException(NotSupportedError);
+        return;
     }
 
     ASSERT_NOT_REACHED();
-    return InvalidStateError;
+    return;
 }
 
 class TrackDisplayUpdateScope {
@@ -1834,7 +1837,7 @@
     m_player->prepareToPlay();
 }
 
-void HTMLMediaElement::seek(double time, ExceptionCode& ec)
+void HTMLMediaElement::seek(double time, ExceptionState& es)
 {
     LOG(Media, "HTMLMediaElement::seek(%f)", time);
 
@@ -1842,7 +1845,7 @@
 
     // 1 - If the media element's readyState is HAVE_NOTHING, then raise an InvalidStateError exception.
     if (m_readyState == HAVE_NOTHING || !m_player) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
@@ -2006,13 +2009,13 @@
     return m_cachedTime;
 }
 
-void HTMLMediaElement::setCurrentTime(double time, ExceptionCode& ec)
+void HTMLMediaElement::setCurrentTime(double time, ExceptionState& es)
 {
     if (m_mediaController) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
-    seek(time, ec);
+    seek(time, es);
 }
 
 double HTMLMediaElement::startTime() const
@@ -2170,7 +2173,7 @@
         scheduleDelayedAction(LoadMediaResource);
 
     if (endedPlayback())
-        seek(0, IGNORE_EXCEPTION);
+        seek(0, IGNORE_EXCEPTION_STATE);
 
     if (m_mediaController)
         m_mediaController->bringElementUpToSpeed(this);
@@ -2230,15 +2233,15 @@
     m_mediaSource = 0;
 }
 
-void HTMLMediaElement::webkitGenerateKeyRequest(const String& keySystem, PassRefPtr<Uint8Array> initData, ExceptionCode& ec)
+void HTMLMediaElement::webkitGenerateKeyRequest(const String& keySystem, PassRefPtr<Uint8Array> initData, ExceptionState& es)
 {
     if (keySystem.isEmpty()) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return;
     }
 
     if (!m_player) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
@@ -2250,33 +2253,33 @@
     }
 
     MediaPlayer::MediaKeyException result = m_player->generateKeyRequest(keySystem, initDataPointer, initDataLength);
-    ec = exceptionCodeForMediaKeyException(result);
+    throwExceptionForMediaKeyException(result, es);
 }
 
-void HTMLMediaElement::webkitGenerateKeyRequest(const String& keySystem, ExceptionCode& ec)
+void HTMLMediaElement::webkitGenerateKeyRequest(const String& keySystem, ExceptionState& es)
 {
-    webkitGenerateKeyRequest(keySystem, Uint8Array::create(0), ec);
+    webkitGenerateKeyRequest(keySystem, Uint8Array::create(0), es);
 }
 
-void HTMLMediaElement::webkitAddKey(const String& keySystem, PassRefPtr<Uint8Array> key, PassRefPtr<Uint8Array> initData, const String& sessionId, ExceptionCode& ec)
+void HTMLMediaElement::webkitAddKey(const String& keySystem, PassRefPtr<Uint8Array> key, PassRefPtr<Uint8Array> initData, const String& sessionId, ExceptionState& es)
 {
     if (keySystem.isEmpty()) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return;
     }
 
     if (!key) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return;
     }
 
     if (!key->length()) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return;
     }
 
     if (!m_player) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
@@ -2288,28 +2291,28 @@
     }
 
     MediaPlayer::MediaKeyException result = m_player->addKey(keySystem, key->data(), key->length(), initDataPointer, initDataLength, sessionId);
-    ec = exceptionCodeForMediaKeyException(result);
+    throwExceptionForMediaKeyException(result, es);
 }
 
-void HTMLMediaElement::webkitAddKey(const String& keySystem, PassRefPtr<Uint8Array> key, ExceptionCode& ec)
+void HTMLMediaElement::webkitAddKey(const String& keySystem, PassRefPtr<Uint8Array> key, ExceptionState& es)
 {
-    webkitAddKey(keySystem, key, Uint8Array::create(0), String(), ec);
+    webkitAddKey(keySystem, key, Uint8Array::create(0), String(), es);
 }
 
-void HTMLMediaElement::webkitCancelKeyRequest(const String& keySystem, const String& sessionId, ExceptionCode& ec)
+void HTMLMediaElement::webkitCancelKeyRequest(const String& keySystem, const String& sessionId, ExceptionState& es)
 {
     if (keySystem.isEmpty()) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return;
     }
 
     if (!m_player) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
     MediaPlayer::MediaKeyException result = m_player->cancelKeyRequest(keySystem, sessionId);
-    ec = exceptionCodeForMediaKeyException(result);
+    throwExceptionForMediaKeyException(result, es);
 }
 
 bool HTMLMediaElement::loop() const
@@ -2349,12 +2352,12 @@
     return m_volume;
 }
 
-void HTMLMediaElement::setVolume(double vol, ExceptionCode& ec)
+void HTMLMediaElement::setVolume(double vol, ExceptionState& es)
 {
     LOG(Media, "HTMLMediaElement::setVolume(%f)", vol);
 
     if (vol < 0.0f || vol > 1.0f) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
@@ -2499,8 +2502,8 @@
     double buffered = 0;
     RefPtr<TimeRanges> timeRanges = m_player->buffered();
     for (unsigned i = 0; i < timeRanges->length(); ++i) {
-        double start = timeRanges->start(i, IGNORE_EXCEPTION);
-        double end = timeRanges->end(i, IGNORE_EXCEPTION);
+        double start = timeRanges->start(i, IGNORE_EXCEPTION_STATE);
+        double end = timeRanges->end(i, IGNORE_EXCEPTION_STATE);
         buffered += end - start;
     }
     return buffered / duration;
@@ -2596,7 +2599,7 @@
     }
 }
 
-PassRefPtr<TextTrack> HTMLMediaElement::addTextTrack(const String& kind, const String& label, const String& language, ExceptionCode& ec)
+PassRefPtr<TextTrack> HTMLMediaElement::addTextTrack(const String& kind, const String& label, const String& language, ExceptionState& es)
 {
     if (!RuntimeEnabledFeatures::videoTrackEnabled())
         return 0;
@@ -2606,7 +2609,7 @@
 
     // 1. If kind is not one of the following strings, then throw a SyntaxError exception and abort these steps
     if (!TextTrack::isValidKindKeyword(kind)) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return 0;
     }
 
@@ -3105,7 +3108,7 @@
         if (loop() && !m_mediaController) {
             m_sentEndEvent = false;
             //  then seek to the earliest possible position of the media resource and abort these steps.
-            seek(startTime(), IGNORE_EXCEPTION);
+            seek(startTime(), IGNORE_EXCEPTION_STATE);
         } else {
             // If the media element does not have a current media controller, and the media element
             // has still ended playback, and the direction of playback is still forwards, and paused
@@ -3145,7 +3148,7 @@
     double now = currentTime();
     double dur = duration();
     if (now > dur)
-        seek(dur, IGNORE_EXCEPTION);
+        seek(dur, IGNORE_EXCEPTION_STATE);
 }
 
 void HTMLMediaElement::mediaPlayerPlaybackStateChanged()
@@ -3672,7 +3675,7 @@
     if (isFullscreen())
         mediaControls->enteredFullscreen();
 
-    ensureUserAgentShadowRoot()->appendChild(mediaControls, ASSERT_NO_EXCEPTION);
+    ensureUserAgentShadowRoot()->appendChild(mediaControls, ASSERT_NO_EXCEPTION_STATE);
 
     if (!controls() || !inDocument())
         mediaControls->hide();
@@ -3940,7 +3943,7 @@
 {
     if (m_fragmentStartTime != MediaPlayer::invalidTime()) {
         m_sentEndEvent = false;
-        seek(m_fragmentStartTime, IGNORE_EXCEPTION);
+        seek(m_fragmentStartTime, IGNORE_EXCEPTION_STATE);
     }
 }
 
diff --git a/Source/core/html/HTMLMediaElement.h b/Source/core/html/HTMLMediaElement.h
index a59e984..a91948f 100644
--- a/Source/core/html/HTMLMediaElement.h
+++ b/Source/core/html/HTMLMediaElement.h
@@ -46,6 +46,7 @@
 #endif
 class ContentType;
 class Event;
+class ExceptionState;
 class HTMLSourceElement;
 class HTMLTrackElement;
 class KURL;
@@ -121,7 +122,7 @@
 
 // playback state
     double currentTime() const;
-    void setCurrentTime(double, ExceptionCode&);
+    void setCurrentTime(double, ExceptionState&);
     double initialTime() const;
     double startTime() const;
     double duration() const;
@@ -155,11 +156,11 @@
 //  Media Source.
     void closeMediaSource();
 
-    void webkitGenerateKeyRequest(const String& keySystem, PassRefPtr<Uint8Array> initData, ExceptionCode&);
-    void webkitGenerateKeyRequest(const String& keySystem, ExceptionCode&);
-    void webkitAddKey(const String& keySystem, PassRefPtr<Uint8Array> key, PassRefPtr<Uint8Array> initData, const String& sessionId, ExceptionCode&);
-    void webkitAddKey(const String& keySystem, PassRefPtr<Uint8Array> key, ExceptionCode&);
-    void webkitCancelKeyRequest(const String& keySystem, const String& sessionId, ExceptionCode&);
+    void webkitGenerateKeyRequest(const String& keySystem, PassRefPtr<Uint8Array> initData, ExceptionState&);
+    void webkitGenerateKeyRequest(const String& keySystem, ExceptionState&);
+    void webkitAddKey(const String& keySystem, PassRefPtr<Uint8Array> key, PassRefPtr<Uint8Array> initData, const String& sessionId, ExceptionState&);
+    void webkitAddKey(const String& keySystem, PassRefPtr<Uint8Array> key, ExceptionState&);
+    void webkitCancelKeyRequest(const String& keySystem, const String& sessionId, ExceptionState&);
 
     DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitkeyadded);
     DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitkeyerror);
@@ -175,7 +176,7 @@
     bool controls() const;
     void setControls(bool);
     double volume() const;
-    void setVolume(double, ExceptionCode&);
+    void setVolume(double, ExceptionState&);
     bool muted() const;
     void setMuted(bool);
 
@@ -187,9 +188,9 @@
 
     double percentLoaded() const;
 
-    PassRefPtr<TextTrack> addTextTrack(const String& kind, const String& label, const String& language, ExceptionCode&);
-    PassRefPtr<TextTrack> addTextTrack(const String& kind, const String& label, ExceptionCode& ec) { return addTextTrack(kind, label, emptyString(), ec); }
-    PassRefPtr<TextTrack> addTextTrack(const String& kind, ExceptionCode& ec) { return addTextTrack(kind, emptyString(), emptyString(), ec); }
+    PassRefPtr<TextTrack> addTextTrack(const String& kind, const String& label, const String& language, ExceptionState&);
+    PassRefPtr<TextTrack> addTextTrack(const String& kind, const String& label, ExceptionState& es) { return addTextTrack(kind, label, emptyString(), es); }
+    PassRefPtr<TextTrack> addTextTrack(const String& kind, ExceptionState& es) { return addTextTrack(kind, emptyString(), emptyString(), es); }
 
     TextTrackList* textTracks();
     CueList currentlyActiveCues() const { return m_currentlyActiveCues; }
@@ -383,7 +384,7 @@
     void startProgressEventTimer();
     void stopPeriodicTimers();
 
-    void seek(double time, ExceptionCode&);
+    void seek(double time, ExceptionState&);
     void finishSeek();
     void checkIfSeekNeeded();
     void addPlayedRange(double start, double end);
diff --git a/Source/core/html/HTMLMeterElement.cpp b/Source/core/html/HTMLMeterElement.cpp
index 45aaee9..a8e15ee 100644
--- a/Source/core/html/HTMLMeterElement.cpp
+++ b/Source/core/html/HTMLMeterElement.cpp
@@ -23,6 +23,8 @@
 #include "core/html/HTMLMeterElement.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/NodeRenderingContext.h"
 #include "core/dom/shadow/ShadowRoot.h"
@@ -75,10 +77,10 @@
     return parseToDoubleForNumberType(getAttribute(minAttr), 0);
 }
 
-void HTMLMeterElement::setMin(double min, ExceptionCode& ec)
+void HTMLMeterElement::setMin(double min, ExceptionState& es)
 {
     if (!std::isfinite(min)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
     setAttribute(minAttr, String::number(min));
@@ -89,10 +91,10 @@
     return std::max(parseToDoubleForNumberType(getAttribute(maxAttr), std::max(1.0, min())), min());
 }
 
-void HTMLMeterElement::setMax(double max, ExceptionCode& ec)
+void HTMLMeterElement::setMax(double max, ExceptionState& es)
 {
     if (!std::isfinite(max)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
     setAttribute(maxAttr, String::number(max));
@@ -104,10 +106,10 @@
     return std::min(std::max(value, min()), max());
 }
 
-void HTMLMeterElement::setValue(double value, ExceptionCode& ec)
+void HTMLMeterElement::setValue(double value, ExceptionState& es)
 {
     if (!std::isfinite(value)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
     setAttribute(valueAttr, String::number(value));
@@ -119,10 +121,10 @@
     return std::min(std::max(low, min()), max());
 }
 
-void HTMLMeterElement::setLow(double low, ExceptionCode& ec)
+void HTMLMeterElement::setLow(double low, ExceptionState& es)
 {
     if (!std::isfinite(low)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
     setAttribute(lowAttr, String::number(low));
@@ -134,10 +136,10 @@
     return std::min(std::max(high, low()), max());
 }
 
-void HTMLMeterElement::setHigh(double high, ExceptionCode& ec)
+void HTMLMeterElement::setHigh(double high, ExceptionState& es)
 {
     if (!std::isfinite(high)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
     setAttribute(highAttr, String::number(high));
@@ -149,10 +151,10 @@
     return std::min(std::max(optimum, min()), max());
 }
 
-void HTMLMeterElement::setOptimum(double optimum, ExceptionCode& ec)
+void HTMLMeterElement::setOptimum(double optimum, ExceptionState& es)
 {
     if (!std::isfinite(optimum)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
     setAttribute(optimumAttr, String::number(optimum));
@@ -231,9 +233,9 @@
     m_value = MeterValueElement::create(document());
     m_value->setWidthPercentage(0);
     m_value->updatePseudo();
-    bar->appendChild(m_value, ASSERT_NO_EXCEPTION);
+    bar->appendChild(m_value, ASSERT_NO_EXCEPTION_STATE);
 
-    inner->appendChild(bar, ASSERT_NO_EXCEPTION);
+    inner->appendChild(bar, ASSERT_NO_EXCEPTION_STATE);
 }
 
 } // namespace
diff --git a/Source/core/html/HTMLMeterElement.h b/Source/core/html/HTMLMeterElement.h
index b40093c..67aecbe 100644
--- a/Source/core/html/HTMLMeterElement.h
+++ b/Source/core/html/HTMLMeterElement.h
@@ -25,6 +25,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class MeterValueElement;
 class RenderMeter;
 
@@ -39,22 +40,22 @@
     };
 
     double min() const;
-    void setMin(double, ExceptionCode&);
+    void setMin(double, ExceptionState&);
 
     double max() const;
-    void setMax(double, ExceptionCode&);
+    void setMax(double, ExceptionState&);
 
     double value() const;
-    void setValue(double, ExceptionCode&);
+    void setValue(double, ExceptionState&);
 
     double low() const;
-    void setLow(double, ExceptionCode&);
+    void setLow(double, ExceptionState&);
 
     double high() const;
-    void setHigh(double, ExceptionCode&);
+    void setHigh(double, ExceptionState&);
 
     double optimum() const;
-    void setOptimum(double, ExceptionCode&);
+    void setOptimum(double, ExceptionState&);
 
     double valueRatio() const;
     GaugeRegion gaugeRegion() const;
diff --git a/Source/core/html/HTMLNameCollection.cpp b/Source/core/html/HTMLNameCollection.cpp
index e141a8d..6e637b2 100644
--- a/Source/core/html/HTMLNameCollection.cpp
+++ b/Source/core/html/HTMLNameCollection.cpp
@@ -34,7 +34,7 @@
 using namespace HTMLNames;
 
 HTMLNameCollection::HTMLNameCollection(Node* document, CollectionType type, const AtomicString& name)
-    : HTMLCollection(document, type, DoesNotOverrideItemAfter)
+    : HTMLCollection(document, type, OverridesItemAfter)
     , m_name(name)
 {
 }
@@ -48,47 +48,58 @@
     ownerNode()->nodeLists()->removeCacheWithAtomicName(this, type(), m_name);
 }
 
-bool WindowNameCollection::nodeMatchesIfNameAttributeMatch(Element* element)
+Element* HTMLNameCollection::virtualItemAfter(unsigned& offsetInArray, Element* previous) const
 {
-    return element->hasTagName(imgTag) || element->hasTagName(formTag) || element->hasTagName(appletTag)
-        || element->hasTagName(embedTag) || element->hasTagName(objectTag);
-}
+    ASSERT_UNUSED(offsetInArray, !offsetInArray);
+    ASSERT(previous != ownerNode());
 
-bool WindowNameCollection::nodeMatches(Element* element, const AtomicString& name)
-{
-    // Find only images, forms, applets, embeds and objects by name, but anything by id
-    if (nodeMatchesIfNameAttributeMatch(element) && element->getNameAttribute() == name)
-        return true;
-    return element->getIdAttribute() == name;
-}
+    Element* current;
+    if (!previous)
+        current = ElementTraversal::firstWithin(ownerNode());
+    else
+        current = ElementTraversal::next(previous, ownerNode());
 
-bool DocumentNameCollection::nodeMatchesIfIdAttributeMatch(Element* element)
-{
-    // FIXME: we need to fix HTMLImageElement to update the hash map for us when name attribute has been removed.
-    return element->hasTagName(appletTag) || (element->hasTagName(objectTag) && toHTMLObjectElement(element)->isDocNamedItem())
-        || (element->hasTagName(imgTag) && element->hasName());
-}
+    for (; current; current = ElementTraversal::next(current, ownerNode())) {
+        switch (type()) {
+        case WindowNamedItems:
+            // find only images, forms, applets, embeds and objects by name,
+            // but anything by id
+            if (current->hasTagName(imgTag)
+                || current->hasTagName(formTag)
+                || current->hasTagName(appletTag)
+                || current->hasTagName(embedTag)
+                || current->hasTagName(objectTag)) {
+                if (current->getNameAttribute() == m_name)
+                    return current;
+            }
+            if (current->getIdAttribute() == m_name)
+                return current;
+            break;
+        case DocumentNamedItems:
+            // find images, forms, applets, embeds, objects and iframes by name,
+            // applets and object by id, and images by id but only if they have
+            // a name attribute (this very strange rule matches IE)
+            if (current->hasTagName(formTag) || current->hasTagName(embedTag) || current->hasTagName(iframeTag)) {
+                if (current->getNameAttribute() == m_name)
+                    return current;
+            } else if (current->hasTagName(appletTag)) {
+                if (current->getNameAttribute() == m_name || current->getIdAttribute() == m_name)
+                    return current;
+            } else if (current->hasTagName(objectTag)) {
+                if ((current->getNameAttribute() == m_name || current->getIdAttribute() == m_name)
+                    && static_cast<HTMLObjectElement*>(current)->isDocNamedItem())
+                    return current;
+            } else if (current->hasTagName(imgTag)) {
+                if (current->getNameAttribute() == m_name || (current->getIdAttribute() == m_name && current->hasName()))
+                    return current;
+            }
+            break;
+        default:
+            ASSERT_NOT_REACHED();
+        }
+    }
 
-bool DocumentNameCollection::nodeMatchesIfNameAttributeMatch(Element* element)
-{
-    return element->hasTagName(formTag) || element->hasTagName(embedTag) || element->hasTagName(iframeTag)
-        || element->hasTagName(appletTag) || (element->hasTagName(objectTag) && toHTMLObjectElement(element)->isDocNamedItem())
-        || element->hasTagName(imgTag);
-}
-
-bool DocumentNameCollection::nodeMatches(Element* element, const AtomicString& name)
-{
-    // Find images, forms, applets, embeds, objects and iframes by name, applets and object by id, and images by id
-    // but only if they have a name attribute (this very strange rule matches IE)
-    if (element->hasTagName(formTag) || element->hasTagName(embedTag) || element->hasTagName(iframeTag))
-        return element->getNameAttribute() == name;
-    if (element->hasTagName(appletTag))
-        return element->getNameAttribute() == name || element->getIdAttribute() == name;
-    if (element->hasTagName(objectTag))
-        return (element->getNameAttribute() == name || element->getIdAttribute() == name) && toHTMLObjectElement(element)->isDocNamedItem();
-    if (element->hasTagName(imgTag))
-        return element->getNameAttribute() == name || (element->getIdAttribute() == name && element->hasName());
-    return false;
+    return 0;
 }
 
 }
diff --git a/Source/core/html/HTMLNameCollection.h b/Source/core/html/HTMLNameCollection.h
index 523c139..a13039d 100644
--- a/Source/core/html/HTMLNameCollection.h
+++ b/Source/core/html/HTMLNameCollection.h
@@ -33,56 +33,21 @@
 
 class HTMLNameCollection : public HTMLCollection {
 public:
+    static PassRefPtr<HTMLNameCollection> create(Node* document, CollectionType type, const AtomicString& name)
+    {
+        return adoptRef(new HTMLNameCollection(document, type, name));
+    }
+
     ~HTMLNameCollection();
 
-protected:
+private:
     HTMLNameCollection(Node*, CollectionType, const AtomicString& name);
 
+    virtual Element* virtualItemAfter(unsigned& offsetInArray, Element*) const OVERRIDE;
+
     AtomicString m_name;
 };
 
-class WindowNameCollection : public HTMLNameCollection {
-public:
-    static PassRefPtr<WindowNameCollection> create(Node* document, CollectionType type, const AtomicString& name)
-    {
-        return adoptRef(new WindowNameCollection(document, type, name));
-    }
-
-    bool nodeMatches(Element* element) const { return nodeMatches(element, m_name); }
-
-    static bool nodeMatchesIfIdAttributeMatch(Element*) { return true; }
-    static bool nodeMatchesIfNameAttributeMatch(Element*);
-    static bool nodeMatches(Element*, const AtomicString&);
-
-private:
-    WindowNameCollection(Node* document, CollectionType type, const AtomicString& name)
-        : HTMLNameCollection(document, type, name)
-    {
-        ASSERT(type == WindowNamedItems);
-    }
-};
-
-class DocumentNameCollection : public HTMLNameCollection {
-public:
-    static PassRefPtr<DocumentNameCollection> create(Node* document, CollectionType type, const AtomicString& name)
-    {
-        return adoptRef(new DocumentNameCollection(document, type, name));
-    }
-
-    static bool nodeMatchesIfIdAttributeMatch(Element*);
-    static bool nodeMatchesIfNameAttributeMatch(Element*);
-    bool nodeMatches(Element* element) const { return nodeMatches(element, m_name); }
-
-    static bool nodeMatches(Element*, const AtomicString&);
-
-private:
-    DocumentNameCollection(Node* document, CollectionType type, const AtomicString& name)
-        : HTMLNameCollection(document, type, name)
-    {
-        ASSERT(type == DocumentNamedItems);
-    }
-};
-
 }
 
 #endif
diff --git a/Source/core/html/HTMLObjectElement.cpp b/Source/core/html/HTMLObjectElement.cpp
index 44c7f10..12e6f8a 100644
--- a/Source/core/html/HTMLObjectElement.cpp
+++ b/Source/core/html/HTMLObjectElement.cpp
@@ -427,23 +427,14 @@
             isNamedItem = false;
         child = child->nextSibling();
     }
-    if (isNamedItem != wasNamedItem && inDocument() && !isInShadowTree() && document()->isHTMLDocument()) {
+    if (isNamedItem != wasNamedItem && document()->isHTMLDocument()) {
         HTMLDocument* document = toHTMLDocument(this->document());
-
-        const AtomicString& id = getIdAttribute();
-        if (!id.isEmpty()) {
-            if (isNamedItem)
-                document->addNamedDocumentItem(id, this);
-            else
-                document->removeNamedDocumentItem(id, this);
-        }
-
-        const AtomicString& name = getNameAttribute();
-        if (!name.isEmpty()) {
-            if (isNamedItem)
-                document->addNamedDocumentItem(name, this);
-            else
-                document->removeNamedDocumentItem(name, this);
+        if (isNamedItem) {
+            document->addNamedItem(getNameAttribute());
+            document->addExtraNamedItem(getIdAttribute());
+        } else {
+            document->removeNamedItem(getNameAttribute());
+            document->removeExtraNamedItem(getIdAttribute());
         }
     }
     m_docNamedItem = isNamedItem;
diff --git a/Source/core/html/HTMLObjectElement.h b/Source/core/html/HTMLObjectElement.h
index a18b7b7..5b8d1d2 100644
--- a/Source/core/html/HTMLObjectElement.h
+++ b/Source/core/html/HTMLObjectElement.h
@@ -101,17 +101,14 @@
     virtual void derefFormAssociatedElement() { deref(); }
     virtual HTMLFormElement* virtualForm() const;
 
+    virtual bool shouldRegisterAsNamedItem() const OVERRIDE { return isDocNamedItem(); }
+    virtual bool shouldRegisterAsExtraNamedItem() const OVERRIDE { return isDocNamedItem(); }
+
     String m_classId;
     bool m_docNamedItem : 1;
     bool m_useFallbackContent : 1;
 };
 
-inline HTMLObjectElement* toHTMLObjectElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(HTMLNames::objectTag));
-    return static_cast<HTMLObjectElement*>(node);
-}
-
 }
 
 #endif
diff --git a/Source/core/html/HTMLOptionElement.cpp b/Source/core/html/HTMLOptionElement.cpp
index 6884d9a..2ae3b05 100644
--- a/Source/core/html/HTMLOptionElement.cpp
+++ b/Source/core/html/HTMLOptionElement.cpp
@@ -28,6 +28,7 @@
 #include "core/html/HTMLOptionElement.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/Document.h"
 #include "core/dom/NodeRenderStyle.h"
 #include "core/dom/NodeTraversal.h"
@@ -66,15 +67,15 @@
 }
 
 PassRefPtr<HTMLOptionElement> HTMLOptionElement::createForJSConstructor(Document* document, const String& data, const String& value,
-        bool defaultSelected, bool selected, ExceptionCode& ec)
+    bool defaultSelected, bool selected, ExceptionState& es)
 {
     RefPtr<HTMLOptionElement> element = adoptRef(new HTMLOptionElement(optionTag, document));
 
     RefPtr<Text> text = Text::create(document, data.isNull() ? "" : data);
 
-    ec = 0;
-    element->appendChild(text.release(), ec);
-    if (ec)
+    es.clearException();
+    element->appendChild(text.release(), es);
+    if (es.hadException())
         return 0;
 
     if (!value.isNull())
@@ -128,7 +129,7 @@
     return document->displayStringModifiedByEncoding(text).stripWhiteSpace(isHTMLSpace).simplifyWhiteSpace(isHTMLSpace);
 }
 
-void HTMLOptionElement::setText(const String &text, ExceptionCode& ec)
+void HTMLOptionElement::setText(const String &text, ExceptionState& es)
 {
     RefPtr<Node> protectFromMutationEvents(this);
 
@@ -145,7 +146,7 @@
         toText(child)->setData(text);
     else {
         removeChildren();
-        appendChild(Text::create(document(), text), ec, AttachLazily);
+        appendChild(Text::create(document(), text), es, AttachLazily);
     }
 
     if (selectIsMenuList && select->selectedIndex() != oldSelectedIndex)
diff --git a/Source/core/html/HTMLOptionElement.h b/Source/core/html/HTMLOptionElement.h
index a0e81c4..f1cb609 100644
--- a/Source/core/html/HTMLOptionElement.h
+++ b/Source/core/html/HTMLOptionElement.h
@@ -29,6 +29,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class HTMLDataListElement;
 class HTMLSelectElement;
 
@@ -37,10 +38,10 @@
     static PassRefPtr<HTMLOptionElement> create(Document*);
     static PassRefPtr<HTMLOptionElement> create(const QualifiedName&, Document*);
     static PassRefPtr<HTMLOptionElement> createForJSConstructor(Document*, const String& data, const String& value,
-       bool defaultSelected, bool selected, ExceptionCode&);
+        bool defaultSelected, bool selected, ExceptionState&);
 
     virtual String text() const;
-    void setText(const String&, ExceptionCode&);
+    void setText(const String&, ExceptionState&);
 
     int index() const;
 
diff --git a/Source/core/html/HTMLOptionsCollection.cpp b/Source/core/html/HTMLOptionsCollection.cpp
index 66ea1ed..a53bc91 100644
--- a/Source/core/html/HTMLOptionsCollection.cpp
+++ b/Source/core/html/HTMLOptionsCollection.cpp
@@ -21,6 +21,7 @@
 #include "config.h"
 #include "core/html/HTMLOptionsCollection.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/NamedNodesCollection.h"
 #include "core/html/HTMLOptionElement.h"
@@ -40,34 +41,34 @@
     return adoptRef(new HTMLOptionsCollection(select));
 }
 
-void HTMLOptionsCollection::add(PassRefPtr<HTMLOptionElement> element, ExceptionCode& ec)
+void HTMLOptionsCollection::add(PassRefPtr<HTMLOptionElement> element, ExceptionState& es)
 {
-    add(element, length(), ec);
+    add(element, length(), es);
 }
 
-void HTMLOptionsCollection::add(PassRefPtr<HTMLOptionElement> element, int index, ExceptionCode& ec)
+void HTMLOptionsCollection::add(PassRefPtr<HTMLOptionElement> element, int index, ExceptionState& es)
 {
     HTMLOptionElement* newOption = element.get();
 
     if (!newOption) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return;
     }
 
     if (index < -1) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
-    ec = 0;
+    es.clearException();
     HTMLSelectElement* select = toHTMLSelectElement(ownerNode());
 
     if (index == -1 || unsigned(index) >= length())
-        select->add(newOption, 0, ec);
+        select->add(newOption, 0, es);
     else
-        select->add(newOption, toHTMLOptionElement(item(index)), ec);
+        select->add(newOption, toHTMLOptionElement(item(index)), es);
 
-    ASSERT(!ec);
+    ASSERT(!es.hadException());
 }
 
 void HTMLOptionsCollection::remove(int index)
@@ -85,9 +86,9 @@
     toHTMLSelectElement(ownerNode())->setSelectedIndex(index);
 }
 
-void HTMLOptionsCollection::setLength(unsigned length, ExceptionCode& ec)
+void HTMLOptionsCollection::setLength(unsigned length, ExceptionState& es)
 {
-    toHTMLSelectElement(ownerNode())->setLength(length, ec);
+    toHTMLSelectElement(ownerNode())->setLength(length, es);
 }
 
 void HTMLOptionsCollection::anonymousNamedGetter(const AtomicString& name, bool& returnValue0Enabled, RefPtr<NodeList>& returnValue0, bool& returnValue1Enabled, RefPtr<Node>& returnValue1)
@@ -108,21 +109,21 @@
     returnValue0 = NamedNodesCollection::create(namedItems);
 }
 
-bool HTMLOptionsCollection::anonymousIndexedSetterRemove(unsigned index, ExceptionCode& ec)
+bool HTMLOptionsCollection::anonymousIndexedSetterRemove(unsigned index, ExceptionState& es)
 {
     HTMLSelectElement* base = toHTMLSelectElement(ownerNode());
     base->remove(index);
     return true;
 }
 
-bool HTMLOptionsCollection::anonymousIndexedSetter(unsigned index, PassRefPtr<HTMLOptionElement> value, ExceptionCode& ec)
+bool HTMLOptionsCollection::anonymousIndexedSetter(unsigned index, PassRefPtr<HTMLOptionElement> value, ExceptionState& es)
 {
     HTMLSelectElement* base = toHTMLSelectElement(ownerNode());
     if (!value) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return true;
     }
-    base->setOption(index, value.get(), ec);
+    base->setOption(index, value.get(), es);
     return true;
 }
 
diff --git a/Source/core/html/HTMLOptionsCollection.h b/Source/core/html/HTMLOptionsCollection.h
index b6255f9..cc19193 100644
--- a/Source/core/html/HTMLOptionsCollection.h
+++ b/Source/core/html/HTMLOptionsCollection.h
@@ -28,26 +28,25 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class HTMLOptionElement;
 class HTMLSelectElement;
 
-typedef int ExceptionCode;
-
 class HTMLOptionsCollection : public HTMLCollection {
 public:
     static PassRefPtr<HTMLOptionsCollection> create(Node*, CollectionType);
 
-    void add(PassRefPtr<HTMLOptionElement>, ExceptionCode&);
-    void add(PassRefPtr<HTMLOptionElement>, int index, ExceptionCode&);
+    void add(PassRefPtr<HTMLOptionElement>, ExceptionState&);
+    void add(PassRefPtr<HTMLOptionElement>, int index, ExceptionState&);
     void remove(int index);
 
     int selectedIndex() const;
     void setSelectedIndex(int);
 
-    void setLength(unsigned, ExceptionCode&);
+    void setLength(unsigned, ExceptionState&);
     void anonymousNamedGetter(const AtomicString& name, bool&, RefPtr<NodeList>&, bool&, RefPtr<Node>&);
-    bool anonymousIndexedSetter(unsigned, PassRefPtr<HTMLOptionElement>, ExceptionCode&);
-    bool anonymousIndexedSetterRemove(unsigned, ExceptionCode&);
+    bool anonymousIndexedSetter(unsigned, PassRefPtr<HTMLOptionElement>, ExceptionState&);
+    bool anonymousIndexedSetterRemove(unsigned, ExceptionState&);
 
 private:
     HTMLOptionsCollection(Node*);
diff --git a/Source/core/html/HTMLOutputElement.cpp b/Source/core/html/HTMLOutputElement.cpp
index 03da9bf..676f049 100644
--- a/Source/core/html/HTMLOutputElement.cpp
+++ b/Source/core/html/HTMLOutputElement.cpp
@@ -32,7 +32,7 @@
 #include "core/html/HTMLOutputElement.h"
 
 #include "HTMLNames.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 
 namespace WebCore {
 
@@ -138,7 +138,7 @@
 {
     ASSERT(!m_isSetTextContentInProgress);
     m_isSetTextContentInProgress = true;
-    setTextContent(value, IGNORE_EXCEPTION);
+    setTextContent(value, IGNORE_EXCEPTION_STATE);
 }
 
 } // namespace
diff --git a/Source/core/html/HTMLProgressElement.cpp b/Source/core/html/HTMLProgressElement.cpp
index bd621b0..a74f188 100644
--- a/Source/core/html/HTMLProgressElement.cpp
+++ b/Source/core/html/HTMLProgressElement.cpp
@@ -23,6 +23,8 @@
 #include "core/html/HTMLProgressElement.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/NodeRenderingContext.h"
 #include "core/dom/shadow/ShadowRoot.h"
@@ -97,10 +99,10 @@
     return !std::isfinite(value) || value < 0 ? 0 : std::min(value, max());
 }
 
-void HTMLProgressElement::setValue(double value, ExceptionCode& ec)
+void HTMLProgressElement::setValue(double value, ExceptionState& es)
 {
     if (!std::isfinite(value)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
     setAttribute(valueAttr, String::number(value >= 0 ? value : 0));
@@ -112,10 +114,10 @@
     return !std::isfinite(max) || max <= 0 ? 1 : max;
 }
 
-void HTMLProgressElement::setMax(double max, ExceptionCode& ec)
+void HTMLProgressElement::setMax(double max, ExceptionState& es)
 {
     if (!std::isfinite(max)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
     setAttribute(maxAttr, String::number(max > 0 ? max : 1));
@@ -155,9 +157,9 @@
     RefPtr<ProgressValueElement> value = ProgressValueElement::create(document());
     m_value = value.get();
     m_value->setWidthPercentage(HTMLProgressElement::IndeterminatePosition * 100);
-    bar->appendChild(m_value, ASSERT_NO_EXCEPTION);
+    bar->appendChild(m_value, ASSERT_NO_EXCEPTION_STATE);
 
-    inner->appendChild(bar, ASSERT_NO_EXCEPTION);
+    inner->appendChild(bar, ASSERT_NO_EXCEPTION_STATE);
 }
 
 bool HTMLProgressElement::shouldAppearIndeterminate() const
diff --git a/Source/core/html/HTMLProgressElement.h b/Source/core/html/HTMLProgressElement.h
index 128f712..5a4d6f1 100644
--- a/Source/core/html/HTMLProgressElement.h
+++ b/Source/core/html/HTMLProgressElement.h
@@ -25,6 +25,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class ProgressValueElement;
 class RenderProgress;
 
@@ -36,10 +37,10 @@
     static PassRefPtr<HTMLProgressElement> create(const QualifiedName&, Document*);
 
     double value() const;
-    void setValue(double, ExceptionCode&);
+    void setValue(double, ExceptionState&);
 
     double max() const;
-    void setMax(double, ExceptionCode&);
+    void setMax(double, ExceptionState&);
 
     double position() const;
 
diff --git a/Source/core/html/HTMLScriptElement.cpp b/Source/core/html/HTMLScriptElement.cpp
index 880f10d..b26f7b5 100644
--- a/Source/core/html/HTMLScriptElement.cpp
+++ b/Source/core/html/HTMLScriptElement.cpp
@@ -24,6 +24,7 @@
 #include "core/html/HTMLScriptElement.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "bindings/v8/ScriptEventListener.h"
 #include "core/dom/Attribute.h"
 #include "core/dom/Document.h"
@@ -93,7 +94,7 @@
     if (numChildren > 0)
         removeChildren();
 
-    appendChild(document()->createTextNode(value.impl()), IGNORE_EXCEPTION);
+    appendChild(document()->createTextNode(value.impl()), IGNORE_EXCEPTION_STATE);
 }
 
 void HTMLScriptElement::setAsync(bool async)
diff --git a/Source/core/html/HTMLSelectElement.cpp b/Source/core/html/HTMLSelectElement.cpp
index c12cda9..4693888 100644
--- a/Source/core/html/HTMLSelectElement.cpp
+++ b/Source/core/html/HTMLSelectElement.cpp
@@ -29,10 +29,11 @@
 #include "core/html/HTMLSelectElement.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/accessibility/AXObjectCache.h"
 #include "core/dom/Attribute.h"
 #include "core/dom/EventNames.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/KeyboardEvent.h"
 #include "core/dom/MouseEvent.h"
 #include "core/dom/NodeRenderingContext.h"
@@ -210,7 +211,7 @@
     return lastSelectedListIndex();
 }
 
-void HTMLSelectElement::add(HTMLElement* element, HTMLElement* before, ExceptionCode& ec)
+void HTMLSelectElement::add(HTMLElement* element, HTMLElement* before, ExceptionState& es)
 {
     // Make sure the element is ref'd and deref'd so we don't leak it.
     RefPtr<HTMLElement> protectNewChild(element);
@@ -218,7 +219,7 @@
     if (!element || !(element->hasLocalName(optionTag) || element->hasLocalName(hrTag)))
         return;
 
-    insertBefore(element, before, ec, AttachLazily);
+    insertBefore(element, before, es, AttachLazily);
     setNeedsValidityCheck();
 }
 
@@ -228,7 +229,7 @@
     if (listIndex < 0)
         return;
 
-    listItems()[listIndex]->remove(IGNORE_EXCEPTION);
+    listItems()[listIndex]->remove(IGNORE_EXCEPTION_STATE);
 }
 
 void HTMLSelectElement::remove(HTMLOptionElement* option)
@@ -236,7 +237,7 @@
     if (option->ownerSelectElement() != this)
         return;
 
-    option->remove(IGNORE_EXCEPTION);
+    option->remove(IGNORE_EXCEPTION_STATE);
 }
 
 String HTMLSelectElement::value() const
@@ -416,32 +417,32 @@
     return options()->item(index);
 }
 
-void HTMLSelectElement::setOption(unsigned index, HTMLOptionElement* option, ExceptionCode& ec)
+void HTMLSelectElement::setOption(unsigned index, HTMLOptionElement* option, ExceptionState& es)
 {
-    ec = 0;
+    es.clearException();
     if (index > maxSelectItems - 1)
         index = maxSelectItems - 1;
     int diff = index - length();
     RefPtr<HTMLElement> before = 0;
     // Out of array bounds? First insert empty dummies.
     if (diff > 0) {
-        setLength(index, ec);
+        setLength(index, es);
         // Replace an existing entry?
     } else if (diff < 0) {
         before = toHTMLElement(options()->item(index+1));
         remove(index);
     }
     // Finally add the new element.
-    if (!ec) {
-        add(option, before.get(), ec);
+    if (!es.hadException()) {
+        add(option, before.get(), es);
         if (diff >= 0 && option->selected())
             optionSelectionStateChanged(option, true);
     }
 }
 
-void HTMLSelectElement::setLength(unsigned newLen, ExceptionCode& ec)
+void HTMLSelectElement::setLength(unsigned newLen, ExceptionState& es)
 {
-    ec = 0;
+    es.clearException();
     if (newLen > maxSelectItems)
         newLen = maxSelectItems;
     int diff = length() - newLen;
@@ -450,8 +451,8 @@
         do {
             RefPtr<Element> option = document()->createElement(optionTag, false);
             ASSERT(option);
-            add(toHTMLElement(option.get()), 0, ec);
-            if (ec)
+            add(toHTMLElement(option.get()), 0, es);
+            if (es.hadException())
                 break;
         } while (++diff);
     } else {
@@ -472,7 +473,7 @@
         for (size_t i = 0; i < itemsToRemove.size(); ++i) {
             Element* item = itemsToRemove[i].get();
             if (item->parentNode())
-                item->parentNode()->removeChild(item, ec);
+                item->parentNode()->removeChild(item, es);
         }
     }
     setNeedsValidityCheck();
@@ -1569,17 +1570,17 @@
     updateListItemSelectedStates();
 }
 
-bool HTMLSelectElement::anonymousIndexedSetter(unsigned index, PassRefPtr<HTMLOptionElement> value, ExceptionCode& ec)
+bool HTMLSelectElement::anonymousIndexedSetter(unsigned index, PassRefPtr<HTMLOptionElement> value, ExceptionState& es)
 {
     if (!value) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return false;
     }
-    setOption(index, value.get(), ec);
+    setOption(index, value.get(), es);
     return true;
 }
 
-bool HTMLSelectElement::anonymousIndexedSetterRemove(unsigned index, ExceptionCode& ec)
+bool HTMLSelectElement::anonymousIndexedSetterRemove(unsigned index, ExceptionState& es)
 {
     remove(index);
     return true;
diff --git a/Source/core/html/HTMLSelectElement.h b/Source/core/html/HTMLSelectElement.h
index 6c579aa..321329f 100644
--- a/Source/core/html/HTMLSelectElement.h
+++ b/Source/core/html/HTMLSelectElement.h
@@ -34,6 +34,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class HTMLOptionElement;
 
 class HTMLSelectElement FINAL : public HTMLFormControlElementWithState, public TypeAheadDataSource {
@@ -59,7 +60,7 @@
 
     bool usesMenuList() const;
 
-    void add(HTMLElement*, HTMLElement* beforeElement, ExceptionCode&);
+    void add(HTMLElement*, HTMLElement* beforeElement, ExceptionState&);
     void remove(int index);
     void remove(HTMLOptionElement*);
 
@@ -84,8 +85,8 @@
 
     void setSize(int);
 
-    void setOption(unsigned index, HTMLOptionElement*, ExceptionCode&);
-    void setLength(unsigned, ExceptionCode&);
+    void setOption(unsigned index, HTMLOptionElement*, ExceptionState&);
+    void setLength(unsigned, ExceptionState&);
 
     Node* namedItem(const AtomicString& name);
     Node* item(unsigned index);
@@ -108,8 +109,8 @@
     // For use in the implementation of HTMLOptionElement.
     void optionSelectionStateChanged(HTMLOptionElement*, bool optionIsSelected);
     bool isParsingInProgress() const { return m_isParsingInProgress; }
-    bool anonymousIndexedSetter(unsigned, PassRefPtr<HTMLOptionElement>, ExceptionCode&);
-    bool anonymousIndexedSetterRemove(unsigned, ExceptionCode&);
+    bool anonymousIndexedSetter(unsigned, PassRefPtr<HTMLOptionElement>, ExceptionState&);
+    bool anonymousIndexedSetterRemove(unsigned, ExceptionState&);
 
 protected:
     HTMLSelectElement(const QualifiedName&, Document*, HTMLFormElement*, bool createdByParser);
diff --git a/Source/core/html/HTMLSelectElement.idl b/Source/core/html/HTMLSelectElement.idl
index a1d0e77..6a511b2 100644
--- a/Source/core/html/HTMLSelectElement.idl
+++ b/Source/core/html/HTMLSelectElement.idl
@@ -32,7 +32,7 @@
     readonly attribute HTMLOptionsCollection options;
     [SetterRaisesException] attribute unsigned long length;
 
-    getter Node item([IsIndex,Default=Undefined] optional unsigned long index);
+    getter Node item(unsigned long index);
     [ImplementedAs=anonymousIndexedSetter, RaisesException] setter HTMLOptionElement (unsigned long index, [TreatNullAs=anonymousIndexedSetterRemove, TreatUndefinedAs=anonymousIndexedSetterRemove] HTMLOptionElement value);
     Node namedItem([Default=Undefined] optional DOMString name);
      [RaisesException] void add([Default=Undefined] optional HTMLElement element,
diff --git a/Source/core/html/HTMLSummaryElement.cpp b/Source/core/html/HTMLSummaryElement.cpp
index 4ef21db..dcd081b 100644
--- a/Source/core/html/HTMLSummaryElement.cpp
+++ b/Source/core/html/HTMLSummaryElement.cpp
@@ -22,6 +22,7 @@
 #include "core/html/HTMLSummaryElement.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/KeyboardEvent.h"
 #include "core/dom/NodeRenderingContext.h"
 #include "core/dom/shadow/ShadowRoot.h"
@@ -54,8 +55,8 @@
 
 void HTMLSummaryElement::didAddUserAgentShadowRoot(ShadowRoot* root)
 {
-    root->appendChild(DetailsMarkerControl::create(document()), ASSERT_NO_EXCEPTION, AttachLazily);
-    root->appendChild(HTMLContentElement::create(document()), ASSERT_NO_EXCEPTION, AttachLazily);
+    root->appendChild(DetailsMarkerControl::create(document()), ASSERT_NO_EXCEPTION_STATE, AttachLazily);
+    root->appendChild(HTMLContentElement::create(document()), ASSERT_NO_EXCEPTION_STATE, AttachLazily);
 }
 
 HTMLDetailsElement* HTMLSummaryElement::detailsElement() const
diff --git a/Source/core/html/HTMLTableElement.cpp b/Source/core/html/HTMLTableElement.cpp
index f0fa060..7999e71 100644
--- a/Source/core/html/HTMLTableElement.cpp
+++ b/Source/core/html/HTMLTableElement.cpp
@@ -28,12 +28,13 @@
 #include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/css/CSSImageValue.h"
 #include "core/css/CSSValuePool.h"
 #include "core/css/StylePropertySet.h"
 #include "core/dom/Attribute.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/html/HTMLTableCaptionElement.h"
 #include "core/html/HTMLTableRowElement.h"
 #include "core/html/HTMLTableRowsCollection.h"
@@ -76,10 +77,10 @@
     return 0;
 }
 
-void HTMLTableElement::setCaption(PassRefPtr<HTMLTableCaptionElement> newCaption, ExceptionCode& ec)
+void HTMLTableElement::setCaption(PassRefPtr<HTMLTableCaptionElement> newCaption, ExceptionState& es)
 {
     deleteCaption();
-    insertBefore(newCaption, firstChild(), ec);
+    insertBefore(newCaption, firstChild(), es);
 }
 
 HTMLTableSectionElement* HTMLTableElement::tHead() const
@@ -91,7 +92,7 @@
     return 0;
 }
 
-void HTMLTableElement::setTHead(PassRefPtr<HTMLTableSectionElement> newHead, ExceptionCode& ec)
+void HTMLTableElement::setTHead(PassRefPtr<HTMLTableSectionElement> newHead, ExceptionState& es)
 {
     deleteTHead();
 
@@ -100,7 +101,7 @@
         if (child->isElementNode() && !child->hasTagName(captionTag) && !child->hasTagName(colgroupTag))
             break;
 
-    insertBefore(newHead, child, ec);
+    insertBefore(newHead, child, es);
 }
 
 HTMLTableSectionElement* HTMLTableElement::tFoot() const
@@ -112,7 +113,7 @@
     return 0;
 }
 
-void HTMLTableElement::setTFoot(PassRefPtr<HTMLTableSectionElement> newFoot, ExceptionCode& ec)
+void HTMLTableElement::setTFoot(PassRefPtr<HTMLTableSectionElement> newFoot, ExceptionState& es)
 {
     deleteTFoot();
 
@@ -121,7 +122,7 @@
         if (child->isElementNode() && !child->hasTagName(captionTag) && !child->hasTagName(colgroupTag) && !child->hasTagName(theadTag))
             break;
 
-    insertBefore(newFoot, child, ec);
+    insertBefore(newFoot, child, es);
 }
 
 PassRefPtr<HTMLElement> HTMLTableElement::createTHead()
@@ -129,13 +130,13 @@
     if (HTMLTableSectionElement* existingHead = tHead())
         return existingHead;
     RefPtr<HTMLTableSectionElement> head = HTMLTableSectionElement::create(theadTag, document());
-    setTHead(head, IGNORE_EXCEPTION);
+    setTHead(head, IGNORE_EXCEPTION_STATE);
     return head.release();
 }
 
 void HTMLTableElement::deleteTHead()
 {
-    removeChild(tHead(), IGNORE_EXCEPTION);
+    removeChild(tHead(), IGNORE_EXCEPTION_STATE);
 }
 
 PassRefPtr<HTMLElement> HTMLTableElement::createTFoot()
@@ -143,20 +144,21 @@
     if (HTMLTableSectionElement* existingFoot = tFoot())
         return existingFoot;
     RefPtr<HTMLTableSectionElement> foot = HTMLTableSectionElement::create(tfootTag, document());
-    setTFoot(foot, IGNORE_EXCEPTION);
+    setTFoot(foot, IGNORE_EXCEPTION_STATE);
     return foot.release();
 }
 
 void HTMLTableElement::deleteTFoot()
 {
-    removeChild(tFoot(), IGNORE_EXCEPTION);
+    removeChild(tFoot(), IGNORE_EXCEPTION_STATE);
 }
 
 PassRefPtr<HTMLElement> HTMLTableElement::createTBody()
 {
     RefPtr<HTMLTableSectionElement> body = HTMLTableSectionElement::create(tbodyTag, document());
     Node* referenceElement = lastBody() ? lastBody()->nextSibling() : 0;
-    insertBefore(body, referenceElement, ASSERT_NO_EXCEPTION);
+
+    insertBefore(body, referenceElement, ASSERT_NO_EXCEPTION_STATE);
     return body.release();
 }
 
@@ -165,13 +167,13 @@
     if (HTMLTableCaptionElement* existingCaption = caption())
         return existingCaption;
     RefPtr<HTMLTableCaptionElement> caption = HTMLTableCaptionElement::create(captionTag, document());
-    setCaption(caption, IGNORE_EXCEPTION);
+    setCaption(caption, IGNORE_EXCEPTION_STATE);
     return caption.release();
 }
 
 void HTMLTableElement::deleteCaption()
 {
-    removeChild(caption(), IGNORE_EXCEPTION);
+    removeChild(caption(), IGNORE_EXCEPTION_STATE);
 }
 
 HTMLTableSectionElement* HTMLTableElement::lastBody() const
@@ -183,10 +185,10 @@
     return 0;
 }
 
-PassRefPtr<HTMLElement> HTMLTableElement::insertRow(int index, ExceptionCode& ec)
+PassRefPtr<HTMLElement> HTMLTableElement::insertRow(int index, ExceptionState& es)
 {
     if (index < -1) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return 0;
     }
 
@@ -201,7 +203,7 @@
             row = HTMLTableRowsCollection::rowAfter(this, lastRow.get());
             if (!row) {
                 if (i != index) {
-                    ec = IndexSizeError;
+                    es.throwDOMException(IndexSizeError);
                     return 0;
                 }
                 break;
@@ -218,18 +220,18 @@
         if (!parent) {
             RefPtr<HTMLTableSectionElement> newBody = HTMLTableSectionElement::create(tbodyTag, document());
             RefPtr<HTMLTableRowElement> newRow = HTMLTableRowElement::create(document());
-            newBody->appendChild(newRow, ec);
-            appendChild(newBody.release(), ec, AttachLazily);
+            newBody->appendChild(newRow, es);
+            appendChild(newBody.release(), es, AttachLazily);
             return newRow.release();
         }
     }
 
     RefPtr<HTMLTableRowElement> newRow = HTMLTableRowElement::create(document());
-    parent->insertBefore(newRow, row.get(), ec, AttachLazily);
+    parent->insertBefore(newRow, row.get(), es, AttachLazily);
     return newRow.release();
 }
 
-void HTMLTableElement::deleteRow(int index, ExceptionCode& ec)
+void HTMLTableElement::deleteRow(int index, ExceptionState& es)
 {
     HTMLTableRowElement* row = 0;
     if (index == -1)
@@ -242,10 +244,10 @@
         }
     }
     if (!row) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
-    row->remove(ec);
+    row->remove(es);
 }
 
 static inline bool isTableCellAncestor(Node* n)
diff --git a/Source/core/html/HTMLTableElement.h b/Source/core/html/HTMLTableElement.h
index c9b4afd..b203747 100644
--- a/Source/core/html/HTMLTableElement.h
+++ b/Source/core/html/HTMLTableElement.h
@@ -30,6 +30,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class HTMLCollection;
 class HTMLTableCaptionElement;
 class HTMLTableRowsCollection;
@@ -41,13 +42,13 @@
     static PassRefPtr<HTMLTableElement> create(const QualifiedName&, Document*);
 
     HTMLTableCaptionElement* caption() const;
-    void setCaption(PassRefPtr<HTMLTableCaptionElement>, ExceptionCode&);
+    void setCaption(PassRefPtr<HTMLTableCaptionElement>, ExceptionState&);
 
     HTMLTableSectionElement* tHead() const;
-    void setTHead(PassRefPtr<HTMLTableSectionElement>, ExceptionCode&);
+    void setTHead(PassRefPtr<HTMLTableSectionElement>, ExceptionState&);
 
     HTMLTableSectionElement* tFoot() const;
-    void setTFoot(PassRefPtr<HTMLTableSectionElement>, ExceptionCode&);
+    void setTFoot(PassRefPtr<HTMLTableSectionElement>, ExceptionState&);
 
     PassRefPtr<HTMLElement> createTHead();
     void deleteTHead();
@@ -56,8 +57,8 @@
     PassRefPtr<HTMLElement> createTBody();
     PassRefPtr<HTMLElement> createCaption();
     void deleteCaption();
-    PassRefPtr<HTMLElement> insertRow(int index, ExceptionCode&);
-    void deleteRow(int index, ExceptionCode&);
+    PassRefPtr<HTMLElement> insertRow(int index, ExceptionState&);
+    void deleteRow(int index, ExceptionState&);
 
     PassRefPtr<HTMLCollection> rows();
     PassRefPtr<HTMLCollection> tBodies();
diff --git a/Source/core/html/HTMLTableRowElement.cpp b/Source/core/html/HTMLTableRowElement.cpp
index 79882ae..09e364f 100644
--- a/Source/core/html/HTMLTableRowElement.cpp
+++ b/Source/core/html/HTMLTableRowElement.cpp
@@ -26,6 +26,7 @@
 #include "core/html/HTMLTableRowElement.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/html/HTMLCollection.h"
 #include "core/html/HTMLTableCellElement.h"
@@ -117,30 +118,30 @@
     return rIndex;
 }
 
-PassRefPtr<HTMLElement> HTMLTableRowElement::insertCell(int index, ExceptionCode& ec)
+PassRefPtr<HTMLElement> HTMLTableRowElement::insertCell(int index, ExceptionState& es)
 {
     RefPtr<HTMLCollection> children = cells();
     int numCells = children ? children->length() : 0;
     if (index < -1 || index > numCells) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return 0;
     }
 
     RefPtr<HTMLTableCellElement> cell = HTMLTableCellElement::create(tdTag, document());
     if (index < 0 || index >= numCells)
-        appendChild(cell, ec, AttachLazily);
+        appendChild(cell, es, AttachLazily);
     else {
         Node* n;
         if (index < 1)
             n = firstChild();
         else
             n = children->item(index);
-        insertBefore(cell, n, ec, AttachLazily);
+        insertBefore(cell, n, es, AttachLazily);
     }
     return cell.release();
 }
 
-void HTMLTableRowElement::deleteCell(int index, ExceptionCode& ec)
+void HTMLTableRowElement::deleteCell(int index, ExceptionState& es)
 {
     RefPtr<HTMLCollection> children = cells();
     int numCells = children ? children->length() : 0;
@@ -148,9 +149,9 @@
         index = numCells-1;
     if (index >= 0 && index < numCells) {
         RefPtr<Node> cell = children->item(index);
-        HTMLElement::removeChild(cell.get(), ec);
+        HTMLElement::removeChild(cell.get(), es);
     } else {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
     }
 }
 
@@ -159,9 +160,9 @@
     return ensureCachedHTMLCollection(TRCells);
 }
 
-void HTMLTableRowElement::setCells(HTMLCollection*, ExceptionCode& ec)
+void HTMLTableRowElement::setCells(HTMLCollection*, ExceptionState& es)
 {
-    ec = NoModificationAllowedError;
+    es.throwDOMException(NoModificationAllowedError);
 }
 
 }
diff --git a/Source/core/html/HTMLTableRowElement.h b/Source/core/html/HTMLTableRowElement.h
index 3eb2ee8..a45f31b 100644
--- a/Source/core/html/HTMLTableRowElement.h
+++ b/Source/core/html/HTMLTableRowElement.h
@@ -30,6 +30,8 @@
 
 namespace WebCore {
 
+class ExceptionState;
+
 class HTMLTableRowElement FINAL : public HTMLTablePartElement {
 public:
     static PassRefPtr<HTMLTableRowElement> create(Document*);
@@ -41,11 +43,11 @@
     int sectionRowIndex() const;
     void setSectionRowIndex(int);
 
-    PassRefPtr<HTMLElement> insertCell(int index, ExceptionCode&);
-    void deleteCell(int index, ExceptionCode&);
+    PassRefPtr<HTMLElement> insertCell(int index, ExceptionState&);
+    void deleteCell(int index, ExceptionState&);
 
     PassRefPtr<HTMLCollection> cells();
-    void setCells(HTMLCollection *, ExceptionCode&);
+    void setCells(HTMLCollection *, ExceptionState&);
 
 private:
     HTMLTableRowElement(const QualifiedName&, Document*);
diff --git a/Source/core/html/HTMLTableSectionElement.cpp b/Source/core/html/HTMLTableSectionElement.cpp
index 5ca10cf..29f7a20 100644
--- a/Source/core/html/HTMLTableSectionElement.cpp
+++ b/Source/core/html/HTMLTableSectionElement.cpp
@@ -26,6 +26,7 @@
 #include "core/html/HTMLTableSectionElement.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/html/HTMLCollection.h"
 #include "core/html/HTMLTableElement.h"
@@ -55,30 +56,30 @@
 
 // these functions are rather slow, since we need to get the row at
 // the index... but they aren't used during usual HTML parsing anyway
-PassRefPtr<HTMLElement> HTMLTableSectionElement::insertRow(int index, ExceptionCode& ec)
+PassRefPtr<HTMLElement> HTMLTableSectionElement::insertRow(int index, ExceptionState& es)
 {
     RefPtr<HTMLTableRowElement> row;
     RefPtr<HTMLCollection> children = rows();
     int numRows = children ? (int)children->length() : 0;
     if (index < -1 || index > numRows)
-        ec = IndexSizeError; // per the DOM
+        es.throwDOMException(IndexSizeError); // per the DOM
     else {
         row = HTMLTableRowElement::create(trTag, document());
         if (numRows == index || index == -1)
-            appendChild(row, ec, AttachLazily);
+            appendChild(row, es, AttachLazily);
         else {
             Node* n;
             if (index < 1)
                 n = firstChild();
             else
                 n = children->item(index);
-            insertBefore(row, n, ec, AttachLazily);
+            insertBefore(row, n, es, AttachLazily);
         }
     }
     return row.release();
 }
 
-void HTMLTableSectionElement::deleteRow(int index, ExceptionCode& ec)
+void HTMLTableSectionElement::deleteRow(int index, ExceptionState& es)
 {
     RefPtr<HTMLCollection> children = rows();
     int numRows = children ? (int)children->length() : 0;
@@ -86,9 +87,9 @@
         index = numRows - 1;
     if (index >= 0 && index < numRows) {
         RefPtr<Node> row = children->item(index);
-        HTMLElement::removeChild(row.get(), ec);
+        HTMLElement::removeChild(row.get(), es);
     } else {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
     }
 }
 
diff --git a/Source/core/html/HTMLTableSectionElement.h b/Source/core/html/HTMLTableSectionElement.h
index b0302be..e121a16 100644
--- a/Source/core/html/HTMLTableSectionElement.h
+++ b/Source/core/html/HTMLTableSectionElement.h
@@ -30,12 +30,14 @@
 
 namespace WebCore {
 
+class ExceptionState;
+
 class HTMLTableSectionElement FINAL : public HTMLTablePartElement {
 public:
     static PassRefPtr<HTMLTableSectionElement> create(const QualifiedName&, Document*);
 
-    PassRefPtr<HTMLElement> insertRow(int index, ExceptionCode&);
-    void deleteRow(int index, ExceptionCode&);
+    PassRefPtr<HTMLElement> insertRow(int index, ExceptionState&);
+    void deleteRow(int index, ExceptionState&);
 
     int numRows() const;
 
diff --git a/Source/core/html/HTMLTextAreaElement.cpp b/Source/core/html/HTMLTextAreaElement.cpp
index 88d289f..9f12cc4 100644
--- a/Source/core/html/HTMLTextAreaElement.cpp
+++ b/Source/core/html/HTMLTextAreaElement.cpp
@@ -28,12 +28,13 @@
 
 #include "CSSValueKeywords.h"
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/BeforeTextInsertedEvent.h"
 #include "core/dom/Document.h"
 #include "core/dom/Event.h"
 #include "core/dom/EventNames.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/Text.h"
 #include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/FrameSelection.h"
@@ -105,7 +106,7 @@
 
 void HTMLTextAreaElement::didAddUserAgentShadowRoot(ShadowRoot* root)
 {
-    root->appendChild(TextControlInnerTextElement::create(document()), ASSERT_NO_EXCEPTION);
+    root->appendChild(TextControlInnerTextElement::create(document()), ASSERT_NO_EXCEPTION_STATE);
 }
 
 const AtomicString& HTMLTextAreaElement::formControlType() const
@@ -418,14 +419,14 @@
     }
     size_t size = textNodes.size();
     for (size_t i = 0; i < size; ++i)
-        removeChild(textNodes[i].get(), IGNORE_EXCEPTION);
+        removeChild(textNodes[i].get(), IGNORE_EXCEPTION_STATE);
 
     // Normalize line endings.
     String value = defaultValue;
     value.replace("\r\n", "\n");
     value.replace('\r', '\n');
 
-    insertBefore(document()->createTextNode(value), firstChild(), IGNORE_EXCEPTION);
+    insertBefore(document()->createTextNode(value), firstChild(), IGNORE_EXCEPTION_STATE);
 
     if (!m_isDirty)
         setNonDirtyValue(value);
@@ -438,10 +439,10 @@
     return ok && value >= 0 ? value : -1;
 }
 
-void HTMLTextAreaElement::setMaxLength(int newValue, ExceptionCode& ec)
+void HTMLTextAreaElement::setMaxLength(int newValue, ExceptionState& es)
 {
     if (newValue < 0)
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
     else
         setAttribute(maxlengthAttr, String::number(newValue));
 }
@@ -540,7 +541,7 @@
     String placeholderText = strippedPlaceholder();
     if (placeholderText.isEmpty()) {
         if (m_placeholder) {
-            userAgentShadowRoot()->removeChild(m_placeholder, ASSERT_NO_EXCEPTION);
+            userAgentShadowRoot()->removeChild(m_placeholder, ASSERT_NO_EXCEPTION_STATE);
             m_placeholder = 0;
         }
         return;
@@ -549,9 +550,9 @@
         RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document());
         m_placeholder = placeholder.get();
         m_placeholder->setPseudo(AtomicString("-webkit-input-placeholder", AtomicString::ConstructFromLiteral));
-        userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->nextSibling(), ASSERT_NO_EXCEPTION);
+        userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->nextSibling(), ASSERT_NO_EXCEPTION_STATE);
     }
-    m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION);
+    m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION_STATE);
     fixPlaceholderRenderer(m_placeholder, innerTextElement());
 }
 
diff --git a/Source/core/html/HTMLTextAreaElement.h b/Source/core/html/HTMLTextAreaElement.h
index 702de3a..2331bc1 100644
--- a/Source/core/html/HTMLTextAreaElement.h
+++ b/Source/core/html/HTMLTextAreaElement.h
@@ -29,6 +29,7 @@
 namespace WebCore {
 
 class BeforeTextInsertedEvent;
+class ExceptionState;
 class VisibleSelection;
 
 class HTMLTextAreaElement FINAL : public HTMLTextFormControlElement {
@@ -46,7 +47,7 @@
     void setDefaultValue(const String&);
     int textLength() const { return value().length(); }
     virtual int maxLength() const;
-    void setMaxLength(int, ExceptionCode&);
+    void setMaxLength(int, ExceptionState&);
     // For ValidityState
     virtual String validationMessage() const OVERRIDE;
     virtual bool valueMissing() const OVERRIDE;
diff --git a/Source/core/html/HTMLTextFormControlElement.cpp b/Source/core/html/HTMLTextFormControlElement.cpp
index cfc10a5..138f8dd 100644
--- a/Source/core/html/HTMLTextFormControlElement.cpp
+++ b/Source/core/html/HTMLTextFormControlElement.cpp
@@ -26,6 +26,8 @@
 #include "core/html/HTMLTextFormControlElement.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/accessibility/AXObjectCache.h"
 #include "core/dom/Document.h"
 #include "core/dom/Event.h"
@@ -216,15 +218,15 @@
 }
 
 
-void HTMLTextFormControlElement::setRangeText(const String& replacement, ExceptionCode& ec)
+void HTMLTextFormControlElement::setRangeText(const String& replacement, ExceptionState& es)
 {
-    setRangeText(replacement, selectionStart(), selectionEnd(), String(), ec);
+    setRangeText(replacement, selectionStart(), selectionEnd(), String(), es);
 }
 
-void HTMLTextFormControlElement::setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionCode& ec)
+void HTMLTextFormControlElement::setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionState& es)
 {
     if (start > end) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
@@ -329,7 +331,7 @@
     if (index <= 0)
         return VisiblePosition(firstPositionInNode(innerTextElement()), DOWNSTREAM);
     RefPtr<Range> range = Range::create(document());
-    range->selectNodeContents(innerTextElement(), ASSERT_NO_EXCEPTION);
+    range->selectNodeContents(innerTextElement(), ASSERT_NO_EXCEPTION_STATE);
     CharacterIterator it(range.get());
     it.advance(index - 1);
     return VisiblePosition(it.range()->endPosition(), UPSTREAM);
@@ -341,8 +343,8 @@
     if (enclosingTextFormControl(indexPosition) != this)
         return 0;
     RefPtr<Range> range = Range::create(indexPosition.document());
-    range->setStart(innerTextElement(), 0, ASSERT_NO_EXCEPTION);
-    range->setEnd(indexPosition.containerNode(), indexPosition.offsetInContainerNode(), ASSERT_NO_EXCEPTION);
+    range->setStart(innerTextElement(), 0, ASSERT_NO_EXCEPTION_STATE);
+    range->setEnd(indexPosition.containerNode(), indexPosition.offsetInContainerNode(), ASSERT_NO_EXCEPTION_STATE);
     return TextIterator::rangeLength(range.get());
 }
 
@@ -523,10 +525,10 @@
             if (AXObjectCache* cache = document()->existingAXObjectCache())
                 cache->postNotification(this, AXObjectCache::AXValueChanged, false);
         }
-        innerTextElement()->setInnerText(value, ASSERT_NO_EXCEPTION);
+        innerTextElement()->setInnerText(value, ASSERT_NO_EXCEPTION_STATE);
 
         if (value.endsWith('\n') || value.endsWith('\r'))
-            innerTextElement()->appendChild(HTMLBRElement::create(document()), ASSERT_NO_EXCEPTION, AttachLazily);
+            innerTextElement()->appendChild(HTMLBRElement::create(document()), ASSERT_NO_EXCEPTION_STATE, AttachLazily);
     }
 
     setFormControlValueMatchesRenderer(true);
diff --git a/Source/core/html/HTMLTextFormControlElement.h b/Source/core/html/HTMLTextFormControlElement.h
index 36bd6c4..369b04d 100644
--- a/Source/core/html/HTMLTextFormControlElement.h
+++ b/Source/core/html/HTMLTextFormControlElement.h
@@ -29,6 +29,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class Position;
 class RenderTextControl;
 class VisiblePosition;
@@ -65,8 +66,8 @@
     void setSelectionEnd(int);
     void setSelectionDirection(const String&);
     void select();
-    virtual void setRangeText(const String& replacement, ExceptionCode&);
-    virtual void setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionCode&);
+    virtual void setRangeText(const String& replacement, ExceptionState&);
+    virtual void setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionState&);
     void setSelectionRange(int start, int end, const String& direction);
     void setSelectionRange(int start, int end, TextFieldSelectionDirection = SelectionHasNoDirection);
     PassRefPtr<Range> selection() const;
diff --git a/Source/core/html/HTMLTitleElement.cpp b/Source/core/html/HTMLTitleElement.cpp
index 0b5a37c..d6084c3 100644
--- a/Source/core/html/HTMLTitleElement.cpp
+++ b/Source/core/html/HTMLTitleElement.cpp
@@ -24,6 +24,7 @@
 #include "core/html/HTMLTitleElement.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Document.h"
 #include "core/dom/Text.h"
 #include "core/rendering/style/RenderStyle.h"
@@ -148,7 +149,7 @@
         if (numChildren > 0)
             removeChildren();
 
-        appendChild(document()->createTextNode(valueCopy.impl()), IGNORE_EXCEPTION);
+        appendChild(document()->createTextNode(valueCopy.impl()), IGNORE_EXCEPTION_STATE);
     }
 }
 
diff --git a/Source/core/html/HTMLTrackElement.cpp b/Source/core/html/HTMLTrackElement.cpp
index 17e9e65..cfa7ea2 100644
--- a/Source/core/html/HTMLTrackElement.cpp
+++ b/Source/core/html/HTMLTrackElement.cpp
@@ -27,6 +27,7 @@
 #include "core/html/HTMLTrackElement.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Event.h"
 #include "core/html/HTMLMediaElement.h"
 #include "core/page/ContentSecurityPolicy.h"
@@ -273,7 +274,7 @@
 
     if (status == Failure) {
         setReadyState(HTMLTrackElement::TRACK_ERROR);
-        dispatchEvent(Event::create(eventNames().errorEvent, false, false), IGNORE_EXCEPTION);
+        dispatchEvent(Event::create(eventNames().errorEvent, false, false), IGNORE_EXCEPTION_STATE);
         return;
     }
 
@@ -284,7 +285,7 @@
 
     //     2. If the file was successfully processed, fire a simple event named load at the
     //        track element.
-    dispatchEvent(Event::create(eventNames().loadEvent, false, false), IGNORE_EXCEPTION);
+    dispatchEvent(Event::create(eventNames().loadEvent, false, false), IGNORE_EXCEPTION_STATE);
 }
 
 // NOTE: The values in the TextTrack::ReadinessState enum must stay in sync with those in HTMLTrackElement::ReadyState.
diff --git a/Source/core/html/HTMLVideoElement.cpp b/Source/core/html/HTMLVideoElement.cpp
index b72896f..2c6b0fa 100644
--- a/Source/core/html/HTMLVideoElement.cpp
+++ b/Source/core/html/HTMLVideoElement.cpp
@@ -28,6 +28,7 @@
 
 #include "CSSPropertyNames.h"
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionState.h"
 #include "bindings/v8/ScriptController.h"
 #include "core/dom/Attribute.h"
 #include "core/dom/Document.h"
@@ -219,7 +220,7 @@
     return player()->hasVideo() && player()->readyState() >= MediaPlayer::HaveCurrentData;
 }
 
-void HTMLVideoElement::webkitEnterFullscreen(ExceptionCode& ec)
+void HTMLVideoElement::webkitEnterFullscreen(ExceptionState& es)
 {
     if (isFullscreen())
         return;
@@ -227,7 +228,7 @@
     // Generate an exception if this isn't called in response to a user gesture, or if the
     // element does not support fullscreen.
     if ((userGestureRequiredForFullscreen() && !ScriptController::processingUserGesture()) || !supportsFullscreen()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
diff --git a/Source/core/html/HTMLVideoElement.h b/Source/core/html/HTMLVideoElement.h
index b668bae..04b2395 100644
--- a/Source/core/html/HTMLVideoElement.h
+++ b/Source/core/html/HTMLVideoElement.h
@@ -30,6 +30,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class HTMLImageLoader;
 
 class HTMLVideoElement FINAL : public HTMLMediaElement {
@@ -44,14 +45,14 @@
     unsigned videoHeight() const;
 
     // Fullscreen
-    void webkitEnterFullscreen(ExceptionCode&);
+    void webkitEnterFullscreen(ExceptionState&);
     void webkitExitFullscreen();
     bool webkitSupportsFullscreen();
     bool webkitDisplayingFullscreen();
 
     // FIXME: Maintain "FullScreen" capitalization scheme for backwards compatibility.
     // https://bugs.webkit.org/show_bug.cgi?id=36081
-    void webkitEnterFullScreen(ExceptionCode& ec) { webkitEnterFullscreen(ec); }
+    void webkitEnterFullScreen(ExceptionState& es) { webkitEnterFullscreen(es); }
     void webkitExitFullScreen() { webkitExitFullscreen(); }
 
     // Statistics
diff --git a/Source/core/html/ImageDocument.cpp b/Source/core/html/ImageDocument.cpp
index 31edf27..d03b945 100644
--- a/Source/core/html/ImageDocument.cpp
+++ b/Source/core/html/ImageDocument.cpp
@@ -26,9 +26,9 @@
 #include "core/html/ImageDocument.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/EventListener.h"
 #include "core/dom/EventNames.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/MouseEvent.h"
 #include "core/dom/RawDataDocumentParser.h"
 #include "core/html/HTMLBodyElement.h"
@@ -167,7 +167,7 @@
 void ImageDocument::createDocumentStructure()
 {
     RefPtr<HTMLHtmlElement> rootElement = HTMLHtmlElement::create(this);
-    appendChild(rootElement, ASSERT_NO_EXCEPTION, AttachLazily);
+    appendChild(rootElement, ASSERT_NO_EXCEPTION_STATE, AttachLazily);
     rootElement->insertedByParser();
 
     if (frame() && frame()->loader())
@@ -177,7 +177,7 @@
     RefPtr<HTMLMetaElement> meta = HTMLMetaElement::create(this);
     meta->setAttribute(nameAttr, "viewport");
     meta->setAttribute(contentAttr, "width=device-width");
-    head->appendChild(meta, ASSERT_NO_EXCEPTION, AttachLazily);
+    head->appendChild(meta, ASSERT_NO_EXCEPTION_STATE, AttachLazily);
 
     RefPtr<HTMLBodyElement> body = HTMLBodyElement::create(this);
     body->setAttribute(styleAttr, "margin: 0px;");
@@ -186,7 +186,7 @@
     m_imageElement->setAttribute(styleAttr, "-webkit-user-select: none");
     m_imageElement->setLoadManually(true);
     m_imageElement->setSrc(url().string());
-    body->appendChild(m_imageElement.get(), ASSERT_NO_EXCEPTION, AttachLazily);
+    body->appendChild(m_imageElement.get(), ASSERT_NO_EXCEPTION_STATE, AttachLazily);
 
     if (shouldShrinkToFit()) {
         // Add event listeners
@@ -196,8 +196,8 @@
         m_imageElement->addEventListener("click", listener.release(), false);
     }
 
-    rootElement->appendChild(head, ASSERT_NO_EXCEPTION, AttachLazily);
-    rootElement->appendChild(body, ASSERT_NO_EXCEPTION, AttachLazily);
+    rootElement->appendChild(head, ASSERT_NO_EXCEPTION_STATE, AttachLazily);
+    rootElement->appendChild(body, ASSERT_NO_EXCEPTION_STATE, AttachLazily);
 }
 
 float ImageDocument::scale() const
diff --git a/Source/core/html/InputType.cpp b/Source/core/html/InputType.cpp
index 3fae879..ae22f5f 100644
--- a/Source/core/html/InputType.cpp
+++ b/Source/core/html/InputType.cpp
@@ -30,9 +30,10 @@
 
 #include <limits>
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/accessibility/AXObjectCache.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/KeyboardEvent.h"
 #include "core/dom/NodeRenderStyle.h"
 #include "core/dom/ScopedEventQueue.h"
@@ -192,9 +193,9 @@
     return DateComponents::invalidMilliseconds();
 }
 
-void InputType::setValueAsDate(double, ExceptionCode& ec) const
+void InputType::setValueAsDate(double, ExceptionState& es) const
 {
-    ec = InvalidStateError;
+    es.throwDOMException(InvalidStateError);
 }
 
 double InputType::valueAsDouble() const
@@ -202,14 +203,14 @@
     return numeric_limits<double>::quiet_NaN();
 }
 
-void InputType::setValueAsDouble(double doubleValue, TextFieldEventBehavior eventBehavior, ExceptionCode& ec) const
+void InputType::setValueAsDouble(double doubleValue, TextFieldEventBehavior eventBehavior, ExceptionState& es) const
 {
-    setValueAsDecimal(Decimal::fromDouble(doubleValue), eventBehavior, ec);
+    setValueAsDecimal(Decimal::fromDouble(doubleValue), eventBehavior, es);
 }
 
-void InputType::setValueAsDecimal(const Decimal&, TextFieldEventBehavior, ExceptionCode& ec) const
+void InputType::setValueAsDecimal(const Decimal&, TextFieldEventBehavior, ExceptionState& es) const
 {
-    ec = InvalidStateError;
+    es.throwDOMException(InvalidStateError);
 }
 
 bool InputType::supportsValidation() const
@@ -933,28 +934,28 @@
     return 0;
 }
 
-void InputType::applyStep(int count, AnyStepHandling anyStepHandling, TextFieldEventBehavior eventBehavior, ExceptionCode& ec)
+void InputType::applyStep(int count, AnyStepHandling anyStepHandling, TextFieldEventBehavior eventBehavior, ExceptionState& es)
 {
     StepRange stepRange(createStepRange(anyStepHandling));
     if (!stepRange.hasStep()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
     const Decimal current = parseToNumberOrNaN(element()->value());
     if (!current.isFinite()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
     Decimal newValue = current + stepRange.step() * count;
     if (!newValue.isFinite()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
     const Decimal acceptableErrorValue = stepRange.acceptableError();
     if (newValue - stepRange.minimum() < -acceptableErrorValue) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
     if (newValue < stepRange.minimum())
@@ -965,13 +966,13 @@
         newValue = stepRange.alignValueForStep(current, newValue);
 
     if (newValue - stepRange.maximum() > acceptableErrorValue) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
     if (newValue > stepRange.maximum())
         newValue = stepRange.maximum();
 
-    setValueAsDecimal(newValue, eventBehavior, ec);
+    setValueAsDecimal(newValue, eventBehavior, es);
 
     if (AXObjectCache* cache = element()->document()->existingAXObjectCache())
         cache->postNotification(element(), AXObjectCache::AXValueChanged, true);
@@ -990,13 +991,13 @@
     return StepRange();
 }
 
-void InputType::stepUp(int n, ExceptionCode& ec)
+void InputType::stepUp(int n, ExceptionState& es)
 {
     if (!isSteppable()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
-    applyStep(n, RejectAny, DispatchNoEvent, ec);
+    applyStep(n, RejectAny, DispatchNoEvent, es);
 }
 
 void InputType::stepUpFromRenderer(int n)
@@ -1070,10 +1071,10 @@
             current = stepRange.minimum() - nextDiff;
         if (current > stepRange.maximum() - nextDiff)
             current = stepRange.maximum() - nextDiff;
-        setValueAsDecimal(current, DispatchNoEvent, IGNORE_EXCEPTION);
+        setValueAsDecimal(current, DispatchNoEvent, IGNORE_EXCEPTION_STATE);
     }
     if ((sign > 0 && current < stepRange.minimum()) || (sign < 0 && current > stepRange.maximum()))
-        setValueAsDecimal(sign > 0 ? stepRange.minimum() : stepRange.maximum(), DispatchInputAndChangeEvent, IGNORE_EXCEPTION);
+        setValueAsDecimal(sign > 0 ? stepRange.minimum() : stepRange.maximum(), DispatchInputAndChangeEvent, IGNORE_EXCEPTION_STATE);
     else {
         if (stepMismatch(element()->value())) {
             ASSERT(!step.isZero());
@@ -1091,13 +1092,14 @@
             if (newValue > stepRange.maximum())
                 newValue = stepRange.maximum();
 
-            setValueAsDecimal(newValue, n == 1 || n == -1 ? DispatchInputAndChangeEvent : DispatchNoEvent, IGNORE_EXCEPTION);
+            setValueAsDecimal(newValue, n == 1 || n == -1 ? DispatchInputAndChangeEvent : DispatchNoEvent, IGNORE_EXCEPTION_STATE);
             if (n > 1)
-                applyStep(n - 1, AnyIsDefaultStep, DispatchInputAndChangeEvent, IGNORE_EXCEPTION);
+                applyStep(n - 1, AnyIsDefaultStep, DispatchInputAndChangeEvent, IGNORE_EXCEPTION_STATE);
             else if (n < -1)
-                applyStep(n + 1, AnyIsDefaultStep, DispatchInputAndChangeEvent, IGNORE_EXCEPTION);
-        } else
-            applyStep(n, AnyIsDefaultStep, DispatchInputAndChangeEvent, IGNORE_EXCEPTION);
+                applyStep(n + 1, AnyIsDefaultStep, DispatchInputAndChangeEvent, IGNORE_EXCEPTION_STATE);
+        } else {
+            applyStep(n, AnyIsDefaultStep, DispatchInputAndChangeEvent, IGNORE_EXCEPTION_STATE);
+        }
     }
 }
 
diff --git a/Source/core/html/InputType.h b/Source/core/html/InputType.h
index e8be8f1..f7fc51c 100644
--- a/Source/core/html/InputType.h
+++ b/Source/core/html/InputType.h
@@ -49,6 +49,7 @@
 class DateComponents;
 class DragData;
 class Event;
+class ExceptionState;
 class FileList;
 class FormDataList;
 class HTMLElement;
@@ -61,8 +62,6 @@
 class RenderStyle;
 class TouchEvent;
 
-typedef int ExceptionCode;
-
 struct ClickHandlingState {
     WTF_MAKE_FAST_ALLOCATED;
 
@@ -136,10 +135,10 @@
     virtual String fallbackValue() const; // Checked last, if both internal storage and value attribute are missing.
     virtual String defaultValue() const; // Checked after even fallbackValue, only when the valueWithDefault function is called.
     virtual double valueAsDate() const;
-    virtual void setValueAsDate(double, ExceptionCode&) const;
+    virtual void setValueAsDate(double, ExceptionState&) const;
     virtual double valueAsDouble() const;
-    virtual void setValueAsDouble(double, TextFieldEventBehavior, ExceptionCode&) const;
-    virtual void setValueAsDecimal(const Decimal&, TextFieldEventBehavior, ExceptionCode&) const;
+    virtual void setValueAsDouble(double, TextFieldEventBehavior, ExceptionState&) const;
+    virtual void setValueAsDecimal(const Decimal&, TextFieldEventBehavior, ExceptionState&) const;
 
     // Validation functions
     virtual String validationMessage() const;
@@ -164,7 +163,7 @@
     bool stepMismatch(const String&) const;
     virtual bool getAllowedValueStep(Decimal*) const;
     virtual StepRange createStepRange(AnyStepHandling) const;
-    virtual void stepUp(int, ExceptionCode&);
+    virtual void stepUp(int, ExceptionState&);
     virtual void stepUpFromRenderer(int);
     virtual String badInputText() const;
     virtual String typeMismatchText() const;
@@ -309,7 +308,7 @@
 
 private:
     // Helper for stepUp()/stepDown(). Adds step value * count to the current value.
-    void applyStep(int count, AnyStepHandling, TextFieldEventBehavior, ExceptionCode&);
+    void applyStep(int count, AnyStepHandling, TextFieldEventBehavior, ExceptionState&);
 
     // Raw pointer because the HTMLInputElement object owns this InputType object.
     HTMLInputElement* m_element;
diff --git a/Source/core/html/MediaController.cpp b/Source/core/html/MediaController.cpp
index 4e60eb9..4c9e49e 100644
--- a/Source/core/html/MediaController.cpp
+++ b/Source/core/html/MediaController.cpp
@@ -24,9 +24,10 @@
  */
 
 #include "config.h"
-
 #include "core/html/MediaController.h"
 
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/html/HTMLMediaElement.h"
 #include "core/html/TimeRanges.h"
@@ -157,7 +158,7 @@
     return m_position;
 }
 
-void MediaController::setCurrentTime(double time, ExceptionCode& ec)
+void MediaController::setCurrentTime(double time, ExceptionState& es)
 {
     // When the user agent is to seek the media controller to a particular new playback position,
     // it must follow these steps:
@@ -173,7 +174,7 @@
 
     // Seek each slaved media element to the new playback position relative to the media element timeline.
     for (size_t index = 0; index < m_mediaElements.size(); ++index)
-        m_mediaElements[index]->seek(time, ec);
+        m_mediaElements[index]->seek(time, es);
 
     scheduleTimeupdateEvent();
 }
@@ -251,7 +252,7 @@
     scheduleEvent(eventNames().ratechangeEvent);
 }
 
-void MediaController::setVolume(double level, ExceptionCode& ec)
+void MediaController::setVolume(double level, ExceptionState& es)
 {
     if (m_volume == level)
         return;
@@ -259,7 +260,7 @@
     // If the new value is outside the range 0.0 to 1.0 inclusive, then, on setting, an
     // IndexSizeError exception must be raised instead.
     if (level < 0 || level > 1) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
@@ -481,7 +482,7 @@
     // When the user agent is to bring a media element up to speed with its new media controller,
     // it must seek that media element to the MediaController's media controller position relative
     // to the media element's timeline.
-    element->seek(currentTime(), IGNORE_EXCEPTION);
+    element->seek(currentTime(), IGNORE_EXCEPTION_STATE);
 }
 
 bool MediaController::isBlocked() const
@@ -547,7 +548,7 @@
     m_pendingEvents.swap(pendingEvents);
     size_t count = pendingEvents.size();
     for (size_t index = 0; index < count; ++index)
-        dispatchEvent(pendingEvents[index].release(), IGNORE_EXCEPTION);
+        dispatchEvent(pendingEvents[index].release(), IGNORE_EXCEPTION_STATE);
 }
 
 void MediaController::clearPositionTimerFired(Timer<MediaController>*)
diff --git a/Source/core/html/MediaController.h b/Source/core/html/MediaController.h
index ec9f485..2a833de 100644
--- a/Source/core/html/MediaController.h
+++ b/Source/core/html/MediaController.h
@@ -38,8 +38,9 @@
 namespace WebCore {
 
 class Clock;
-class HTMLMediaElement;
 class Event;
+class ExceptionState;
+class HTMLMediaElement;
 class ScriptExecutionContext;
 
 class MediaController : public RefCounted<MediaController>, public ScriptWrappable, public MediaControllerInterface, public EventTarget {
@@ -59,7 +60,7 @@
 
     virtual double duration() const;
     virtual double currentTime() const;
-    virtual void setCurrentTime(double, ExceptionCode&);
+    virtual void setCurrentTime(double, ExceptionState&);
 
     virtual bool paused() const { return m_paused; }
     virtual void play();
@@ -73,7 +74,7 @@
     virtual void setPlaybackRate(double);
 
     virtual double volume() const { return m_volume; }
-    virtual void setVolume(double, ExceptionCode&);
+    virtual void setVolume(double, ExceptionState&);
 
     virtual bool muted() const { return m_muted; }
     virtual void setMuted(bool);
diff --git a/Source/core/html/MediaControllerInterface.h b/Source/core/html/MediaControllerInterface.h
index 8adb9c8..9f8f704 100644
--- a/Source/core/html/MediaControllerInterface.h
+++ b/Source/core/html/MediaControllerInterface.h
@@ -30,10 +30,9 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class TimeRanges;
 
-typedef int ExceptionCode;
-
 class MediaControllerInterface {
 public:
     virtual ~MediaControllerInterface() { };
@@ -45,7 +44,7 @@
 
     virtual double duration() const = 0;
     virtual double currentTime() const = 0;
-    virtual void setCurrentTime(double, ExceptionCode&) = 0;
+    virtual void setCurrentTime(double, ExceptionState&) = 0;
 
     virtual bool paused() const = 0;
     virtual void play() = 0;
@@ -58,7 +57,7 @@
     virtual void setPlaybackRate(double) = 0;
 
     virtual double volume() const = 0;
-    virtual void setVolume(double, ExceptionCode&) = 0;
+    virtual void setVolume(double, ExceptionState&) = 0;
 
     virtual bool muted() const = 0;
     virtual void setMuted(bool) = 0;
diff --git a/Source/core/html/MediaDocument.cpp b/Source/core/html/MediaDocument.cpp
index 5292264..bb4a1a1 100644
--- a/Source/core/html/MediaDocument.cpp
+++ b/Source/core/html/MediaDocument.cpp
@@ -28,8 +28,8 @@
 #include "core/html/MediaDocument.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/EventNames.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/KeyboardEvent.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/RawDataDocumentParser.h"
@@ -82,7 +82,7 @@
     RefPtr<HTMLMetaElement> meta = HTMLMetaElement::create(document());
     meta->setAttribute(nameAttr, "viewport");
     meta->setAttribute(contentAttr, "width=device-width");
-    head->appendChild(meta.release(), ASSERT_NO_EXCEPTION);
+    head->appendChild(meta.release(), ASSERT_NO_EXCEPTION_STATE);
 
     RefPtr<HTMLVideoElement> media = HTMLVideoElement::create(document());
     media->setAttribute(controlsAttr, "");
@@ -95,15 +95,15 @@
     if (DocumentLoader* loader = document()->loader())
         source->setType(loader->responseMIMEType());
 
-    media->appendChild(source.release(), ASSERT_NO_EXCEPTION);
+    media->appendChild(source.release(), ASSERT_NO_EXCEPTION_STATE);
 
     RefPtr<HTMLBodyElement> body = HTMLBodyElement::create(document());
-    body->appendChild(media.release(), ASSERT_NO_EXCEPTION);
+    body->appendChild(media.release(), ASSERT_NO_EXCEPTION_STATE);
 
-    rootElement->appendChild(head.release(), ASSERT_NO_EXCEPTION);
-    rootElement->appendChild(body.release(), ASSERT_NO_EXCEPTION);
+    rootElement->appendChild(head.release(), ASSERT_NO_EXCEPTION_STATE);
+    rootElement->appendChild(body.release(), ASSERT_NO_EXCEPTION_STATE);
 
-    document()->appendChild(rootElement.release(), ASSERT_NO_EXCEPTION, AttachLazily);
+    document()->appendChild(rootElement.release(), ASSERT_NO_EXCEPTION_STATE, AttachLazily);
     m_didBuildDocumentStructure = true;
 }
 
diff --git a/Source/core/html/NumberInputType.cpp b/Source/core/html/NumberInputType.cpp
index 6b49e00..a1d0ada 100644
--- a/Source/core/html/NumberInputType.cpp
+++ b/Source/core/html/NumberInputType.cpp
@@ -34,6 +34,7 @@
 
 #include <limits>
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/KeyboardEvent.h"
 #include "core/html/HTMLInputElement.h"
@@ -122,31 +123,31 @@
     return parseToDoubleForNumberType(element()->value());
 }
 
-void NumberInputType::setValueAsDouble(double newValue, TextFieldEventBehavior eventBehavior, ExceptionCode& ec) const
+void NumberInputType::setValueAsDouble(double newValue, TextFieldEventBehavior eventBehavior, ExceptionState& es) const
 {
     // FIXME: We should use numeric_limits<double>::max for number input type.
     const double floatMax = numeric_limits<float>::max();
     if (newValue < -floatMax) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
     if (newValue > floatMax) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
     element()->setValue(serializeForNumberType(newValue), eventBehavior);
 }
 
-void NumberInputType::setValueAsDecimal(const Decimal& newValue, TextFieldEventBehavior eventBehavior, ExceptionCode& ec) const
+void NumberInputType::setValueAsDecimal(const Decimal& newValue, TextFieldEventBehavior eventBehavior, ExceptionState& es) const
 {
     // FIXME: We should use numeric_limits<double>::max for number input type.
     const Decimal floatMax = Decimal::fromDouble(numeric_limits<float>::max());
     if (newValue < -floatMax) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
     if (newValue > floatMax) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
     element()->setValue(serializeForNumberType(newValue), eventBehavior);
diff --git a/Source/core/html/NumberInputType.h b/Source/core/html/NumberInputType.h
index e5ed8e5..866e873 100644
--- a/Source/core/html/NumberInputType.h
+++ b/Source/core/html/NumberInputType.h
@@ -35,6 +35,8 @@
 
 namespace WebCore {
 
+class ExceptionState;
+
 class NumberInputType : public TextFieldInputType {
 public:
     static PassOwnPtr<InputType> create(HTMLInputElement*);
@@ -45,8 +47,8 @@
     virtual const AtomicString& formControlType() const OVERRIDE;
     virtual void setValue(const String&, bool valueChanged, TextFieldEventBehavior) OVERRIDE;
     virtual double valueAsDouble() const OVERRIDE;
-    virtual void setValueAsDouble(double, TextFieldEventBehavior, ExceptionCode&) const OVERRIDE;
-    virtual void setValueAsDecimal(const Decimal&, TextFieldEventBehavior, ExceptionCode&) const OVERRIDE;
+    virtual void setValueAsDouble(double, TextFieldEventBehavior, ExceptionState&) const OVERRIDE;
+    virtual void setValueAsDecimal(const Decimal&, TextFieldEventBehavior, ExceptionState&) const OVERRIDE;
     virtual bool typeMismatchFor(const String&) const OVERRIDE;
     virtual bool typeMismatch() const OVERRIDE;
     virtual bool sizeShouldIncludeDecoration(int defaultSize, int& preferredSize) const OVERRIDE;
diff --git a/Source/core/html/PluginDocument.cpp b/Source/core/html/PluginDocument.cpp
index 9e0fd7e..8da02b6 100644
--- a/Source/core/html/PluginDocument.cpp
+++ b/Source/core/html/PluginDocument.cpp
@@ -26,7 +26,7 @@
 #include "core/html/PluginDocument.h"
 
 #include "HTMLNames.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/RawDataDocumentParser.h"
 #include "core/html/HTMLEmbedElement.h"
 #include "core/html/HTMLHtmlElement.h"
@@ -71,7 +71,7 @@
 void PluginDocumentParser::createDocumentStructure()
 {
     RefPtr<Element> rootElement = document()->createElement(htmlTag, false);
-    document()->appendChild(rootElement, IGNORE_EXCEPTION);
+    document()->appendChild(rootElement, IGNORE_EXCEPTION_STATE);
     toHTMLHtmlElement(rootElement.get())->insertedByParser();
 
     if (document()->frame() && document()->frame()->loader())
@@ -82,7 +82,7 @@
     body->setAttribute(marginheightAttr, "0");
     body->setAttribute(styleAttr, "background-color: rgb(38,38,38)");
 
-    rootElement->appendChild(body, IGNORE_EXCEPTION);
+    rootElement->appendChild(body, IGNORE_EXCEPTION_STATE);
 
     RefPtr<Element> embedElement = document()->createElement(embedTag, false);
 
@@ -100,7 +100,7 @@
 
     toPluginDocument(document())->setPluginNode(m_embedElement);
 
-    body->appendChild(embedElement, IGNORE_EXCEPTION);
+    body->appendChild(embedElement, IGNORE_EXCEPTION_STATE);
 
     Frame* frame = document()->frame();
     if (!frame)
diff --git a/Source/core/html/RangeInputType.cpp b/Source/core/html/RangeInputType.cpp
index 0571747..eef08b5 100644
--- a/Source/core/html/RangeInputType.cpp
+++ b/Source/core/html/RangeInputType.cpp
@@ -34,8 +34,8 @@
 
 #include <limits>
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/accessibility/AXObjectCache.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/KeyboardEvent.h"
 #include "core/dom/MouseEvent.h"
 #include "core/dom/ScopedEventQueue.h"
@@ -104,7 +104,7 @@
     return parseToDoubleForNumberType(element()->value());
 }
 
-void RangeInputType::setValueAsDecimal(const Decimal& newValue, TextFieldEventBehavior eventBehavior, ExceptionCode&) const
+void RangeInputType::setValueAsDecimal(const Decimal& newValue, TextFieldEventBehavior eventBehavior, ExceptionState&) const
 {
     element()->setValue(serialize(newValue), eventBehavior);
 }
@@ -231,7 +231,7 @@
     if (newValue != current) {
         EventQueueScope scope;
         TextFieldEventBehavior eventBehavior = DispatchChangeEvent;
-        setValueAsDecimal(newValue, eventBehavior, IGNORE_EXCEPTION);
+        setValueAsDecimal(newValue, eventBehavior, IGNORE_EXCEPTION_STATE);
 
         if (AXObjectCache* cache = element()->document()->existingAXObjectCache())
             cache->postNotification(element(), AXObjectCache::AXValueChanged, true);
@@ -248,10 +248,10 @@
     Document* document = element()->document();
     RefPtr<HTMLDivElement> track = HTMLDivElement::create(document);
     track->setPseudo(AtomicString("-webkit-slider-runnable-track", AtomicString::ConstructFromLiteral));
-    track->appendChild(SliderThumbElement::create(document), IGNORE_EXCEPTION);
+    track->appendChild(SliderThumbElement::create(document), IGNORE_EXCEPTION_STATE);
     RefPtr<HTMLElement> container = SliderContainerElement::create(document);
-    container->appendChild(track.release(), IGNORE_EXCEPTION);
-    element()->userAgentShadowRoot()->appendChild(container.release(), IGNORE_EXCEPTION);
+    container->appendChild(track.release(), IGNORE_EXCEPTION_STATE);
+    element()->userAgentShadowRoot()->appendChild(container.release(), IGNORE_EXCEPTION_STATE);
 }
 
 RenderObject* RangeInputType::createRenderer(RenderStyle*) const
diff --git a/Source/core/html/RangeInputType.h b/Source/core/html/RangeInputType.h
index 2b6e24d..d08863e 100644
--- a/Source/core/html/RangeInputType.h
+++ b/Source/core/html/RangeInputType.h
@@ -35,6 +35,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class SliderThumbElement;
 
 class RangeInputType : public InputType {
@@ -47,7 +48,7 @@
     virtual bool isRangeControl() const OVERRIDE;
     virtual const AtomicString& formControlType() const OVERRIDE;
     virtual double valueAsDouble() const OVERRIDE;
-    virtual void setValueAsDecimal(const Decimal&, TextFieldEventBehavior, ExceptionCode&) const OVERRIDE;
+    virtual void setValueAsDecimal(const Decimal&, TextFieldEventBehavior, ExceptionState&) const OVERRIDE;
     virtual bool typeMismatchFor(const String&) const OVERRIDE;
     virtual bool supportsRequired() const OVERRIDE;
     virtual StepRange createStepRange(AnyStepHandling) const OVERRIDE;
diff --git a/Source/core/html/SearchInputType.cpp b/Source/core/html/SearchInputType.cpp
index 25a7d87..4cbfbe1 100644
--- a/Source/core/html/SearchInputType.cpp
+++ b/Source/core/html/SearchInputType.cpp
@@ -32,6 +32,7 @@
 #include "core/html/SearchInputType.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/KeyboardEvent.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/InputTypeNames.h"
@@ -100,11 +101,11 @@
 
     RefPtr<SearchFieldDecorationElement> searchDecoration = SearchFieldDecorationElement::create(element()->document());
     m_searchDecoration = searchDecoration.get();
-    container->insertBefore(m_searchDecoration, textWrapper, IGNORE_EXCEPTION);
+    container->insertBefore(m_searchDecoration, textWrapper, IGNORE_EXCEPTION_STATE);
 
     RefPtr<SearchFieldCancelButtonElement> cancelButton = SearchFieldCancelButtonElement::create(element()->document());
     m_cancelButton = cancelButton.get();
-    container->insertBefore(m_cancelButton, textWrapper->nextSibling(), IGNORE_EXCEPTION);
+    container->insertBefore(m_cancelButton, textWrapper->nextSibling(), IGNORE_EXCEPTION_STATE);
 }
 
 HTMLElement* SearchInputType::searchDecorationElement() const
diff --git a/Source/core/html/TextFieldInputType.cpp b/Source/core/html/TextFieldInputType.cpp
index a27c173..771d638 100644
--- a/Source/core/html/TextFieldInputType.cpp
+++ b/Source/core/html/TextFieldInputType.cpp
@@ -33,6 +33,7 @@
 #include "core/html/TextFieldInputType.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/BeforeTextInsertedEvent.h"
 #include "core/dom/KeyboardEvent.h"
 #include "core/dom/NodeRenderStyle.h"
@@ -245,30 +246,30 @@
 
     m_innerText = TextControlInnerTextElement::create(document);
     if (!createsContainer) {
-        element()->userAgentShadowRoot()->appendChild(m_innerText, IGNORE_EXCEPTION);
+        element()->userAgentShadowRoot()->appendChild(m_innerText, IGNORE_EXCEPTION_STATE);
         return;
     }
 
     ShadowRoot* shadowRoot = element()->userAgentShadowRoot();
     m_container = TextControlInnerContainer::create(document);
     m_container->setPseudo(AtomicString("-webkit-textfield-decoration-container", AtomicString::ConstructFromLiteral));
-    shadowRoot->appendChild(m_container, IGNORE_EXCEPTION);
+    shadowRoot->appendChild(m_container, IGNORE_EXCEPTION_STATE);
 
     m_innerBlock = TextControlInnerElement::create(document);
-    m_innerBlock->appendChild(m_innerText, IGNORE_EXCEPTION);
-    m_container->appendChild(m_innerBlock, IGNORE_EXCEPTION);
+    m_innerBlock->appendChild(m_innerText, IGNORE_EXCEPTION_STATE);
+    m_container->appendChild(m_innerBlock, IGNORE_EXCEPTION_STATE);
 
 #if ENABLE(INPUT_SPEECH)
     ASSERT(!m_speechButton);
     if (element()->isSpeechEnabled()) {
         m_speechButton = InputFieldSpeechButtonElement::create(document);
-        m_container->appendChild(m_speechButton, IGNORE_EXCEPTION);
+        m_container->appendChild(m_speechButton, IGNORE_EXCEPTION_STATE);
     }
 #endif
 
     if (shouldHaveSpinButton) {
         m_innerSpinButton = SpinButtonElement::create(document, *this);
-        m_container->appendChild(m_innerSpinButton, IGNORE_EXCEPTION);
+        m_container->appendChild(m_innerSpinButton, IGNORE_EXCEPTION_STATE);
     }
 }
 
@@ -419,7 +420,7 @@
     String placeholderText = element()->strippedPlaceholder();
     if (placeholderText.isEmpty()) {
         if (m_placeholder) {
-            m_placeholder->parentNode()->removeChild(m_placeholder.get(), ASSERT_NO_EXCEPTION);
+            m_placeholder->parentNode()->removeChild(m_placeholder.get(), ASSERT_NO_EXCEPTION_STATE);
             m_placeholder.clear();
         }
         return;
@@ -427,9 +428,9 @@
     if (!m_placeholder) {
         m_placeholder = HTMLDivElement::create(element()->document());
         m_placeholder->setPseudo(AtomicString("-webkit-input-placeholder", AtomicString::ConstructFromLiteral));
-        element()->userAgentShadowRoot()->insertBefore(m_placeholder, m_container ? m_container->nextSibling() : innerTextElement()->nextSibling(), ASSERT_NO_EXCEPTION);
+        element()->userAgentShadowRoot()->insertBefore(m_placeholder, m_container ? m_container->nextSibling() : innerTextElement()->nextSibling(), ASSERT_NO_EXCEPTION_STATE);
     }
-    m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION);
+    m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION_STATE);
     element()->fixPlaceholderRenderer(m_placeholder.get(), m_container ? m_container.get() : m_innerText.get());
 }
 
diff --git a/Source/core/html/TimeRanges.cpp b/Source/core/html/TimeRanges.cpp
index 1657115..48966e7 100644
--- a/Source/core/html/TimeRanges.cpp
+++ b/Source/core/html/TimeRanges.cpp
@@ -24,12 +24,12 @@
  */
 
 #include "config.h"
-
 #include "core/html/TimeRanges.h"
 
-#include <math.h>
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
+#include <math.h>
 
 using namespace WebCore;
 using namespace std;
@@ -102,19 +102,19 @@
     m_ranges.swap(unioned->m_ranges);
 }
 
-double TimeRanges::start(unsigned index, ExceptionCode& ec) const
+double TimeRanges::start(unsigned index, ExceptionState& es) const
 {
     if (index >= length()) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return 0;
     }
     return m_ranges[index].m_start;
 }
 
-double TimeRanges::end(unsigned index, ExceptionCode& ec) const
+double TimeRanges::end(unsigned index, ExceptionState& es) const
 {
     if (index >= length()) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return 0;
     }
     return m_ranges[index].m_end;
@@ -166,7 +166,7 @@
 bool TimeRanges::contain(double time) const
 {
     for (unsigned n = 0; n < length(); n++) {
-        if (time >= start(n, IGNORE_EXCEPTION) && time <= end(n, IGNORE_EXCEPTION))
+        if (time >= start(n, IGNORE_EXCEPTION_STATE) && time <= end(n, IGNORE_EXCEPTION_STATE))
             return true;
     }
     return false;
@@ -177,8 +177,8 @@
     double closest = 0;
     unsigned count = length();
     for (unsigned ndx = 0; ndx < count; ndx++) {
-        double startTime = start(ndx, IGNORE_EXCEPTION);
-        double endTime = end(ndx, IGNORE_EXCEPTION);
+        double startTime = start(ndx, IGNORE_EXCEPTION_STATE);
+        double endTime = end(ndx, IGNORE_EXCEPTION_STATE);
         if (time >= startTime && time <= endTime)
             return time;
         if (fabs(startTime - time) < closest)
diff --git a/Source/core/html/TimeRanges.h b/Source/core/html/TimeRanges.h
index e58de4a..39a16d3 100644
--- a/Source/core/html/TimeRanges.h
+++ b/Source/core/html/TimeRanges.h
@@ -35,7 +35,7 @@
 
 namespace WebCore {
 
-typedef int ExceptionCode;
+class ExceptionState;
 
 class TimeRanges : public RefCounted<TimeRanges>, public ScriptWrappable {
 public:
@@ -53,8 +53,8 @@
     void unionWith(const TimeRanges*);
 
     unsigned length() const { return m_ranges.size(); }
-    double start(unsigned index, ExceptionCode&) const;
-    double end(unsigned index, ExceptionCode&) const;
+    double start(unsigned index, ExceptionState&) const;
+    double end(unsigned index, ExceptionState&) const;
 
     void add(double start, double end);
 
diff --git a/Source/core/html/TimeRangesTest.cpp b/Source/core/html/TimeRangesTest.cpp
index 12c5104..19bbd36 100644
--- a/Source/core/html/TimeRangesTest.cpp
+++ b/Source/core/html/TimeRangesTest.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "core/html/TimeRanges.h"
 
-#include "core/dom/ExceptionCodePlaceholder.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include <gtest/gtest.h>
 
 #include <sstream>
@@ -43,7 +43,7 @@
     std::stringstream ss;
     ss << "{";
     for (unsigned i = 0; i < ranges.length(); ++i)
-        ss << " [" << ranges.start(i, IGNORE_EXCEPTION) << "," << ranges.end(i, IGNORE_EXCEPTION) << ")";
+        ss << " [" << ranges.start(i, IGNORE_EXCEPTION_STATE) << "," << ranges.end(i, IGNORE_EXCEPTION_STATE) << ")";
     ss << " }";
 
     return ss.str();
@@ -75,7 +75,7 @@
 
     // Add the values in rangeA to rangeB in reverse order.
     for (int i = rangeA->length() - 1; i >= 0; --i)
-        rangeB->add(rangeA->start(i, IGNORE_EXCEPTION), rangeA->end(i, IGNORE_EXCEPTION));
+        rangeB->add(rangeA->start(i, IGNORE_EXCEPTION_STATE), rangeA->end(i, IGNORE_EXCEPTION_STATE));
 
     ASSERT_RANGE(expected, rangeB);
 }
diff --git a/Source/core/html/canvas/CanvasGradient.cpp b/Source/core/html/canvas/CanvasGradient.cpp
index da78718..394ebf0 100644
--- a/Source/core/html/canvas/CanvasGradient.cpp
+++ b/Source/core/html/canvas/CanvasGradient.cpp
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "core/html/canvas/CanvasGradient.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/html/canvas/CanvasPattern.h"
 #include "core/html/canvas/CanvasStyle.h"
@@ -45,16 +46,16 @@
     ScriptWrappable::init(this);
 }
 
-void CanvasGradient::addColorStop(float value, const String& color, ExceptionCode& ec)
+void CanvasGradient::addColorStop(float value, const String& color, ExceptionState& es)
 {
     if (!(value >= 0 && value <= 1.0f)) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
     RGBA32 rgba = 0;
     if (!parseColorOrCurrentColor(rgba, color, 0 /*canvas*/)) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return;
     }
 
diff --git a/Source/core/html/canvas/CanvasGradient.h b/Source/core/html/canvas/CanvasGradient.h
index 5f0ebdc..76d564b 100644
--- a/Source/core/html/canvas/CanvasGradient.h
+++ b/Source/core/html/canvas/CanvasGradient.h
@@ -35,7 +35,7 @@
 
 namespace WebCore {
 
-typedef int ExceptionCode;
+class ExceptionState;
 
 class CanvasGradient : public RefCounted<CanvasGradient>, public ScriptWrappable {
 public:
@@ -50,7 +50,7 @@
 
     Gradient* gradient() const { return m_gradient.get(); }
 
-    void addColorStop(float value, const String& color, ExceptionCode&);
+    void addColorStop(float value, const String& color, ExceptionState&);
 
 private:
     CanvasGradient(const FloatPoint& p0, const FloatPoint& p1);
diff --git a/Source/core/html/canvas/CanvasPathMethods.cpp b/Source/core/html/canvas/CanvasPathMethods.cpp
index f5515d1..25c4604 100644
--- a/Source/core/html/canvas/CanvasPathMethods.cpp
+++ b/Source/core/html/canvas/CanvasPathMethods.cpp
@@ -35,6 +35,7 @@
 #include "config.h"
 #include "core/html/canvas/CanvasPathMethods.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/platform/graphics/FloatRect.h"
 #include "wtf/MathExtras.h"
@@ -105,14 +106,14 @@
         m_path.addBezierCurveTo(cp1, cp2, p1);
 }
 
-void CanvasPathMethods::arcTo(float x1, float y1, float x2, float y2, float r, ExceptionCode& ec)
+void CanvasPathMethods::arcTo(float x1, float y1, float x2, float y2, float r, ExceptionState& es)
 {
-    ec = 0;
+    es.clearException();
     if (!std::isfinite(x1) || !std::isfinite(y1) || !std::isfinite(x2) || !std::isfinite(y2) || !std::isfinite(r))
         return;
 
     if (r < 0) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
@@ -130,14 +131,14 @@
         m_path.addArcTo(p1, p2, r);
 }
 
-void CanvasPathMethods::arc(float x, float y, float r, float sa, float ea, bool anticlockwise, ExceptionCode& ec)
+void CanvasPathMethods::arc(float x, float y, float r, float sa, float ea, bool anticlockwise, ExceptionState& es)
 {
-    ec = 0;
+    es.clearException();
     if (!std::isfinite(x) || !std::isfinite(y) || !std::isfinite(r) || !std::isfinite(sa) || !std::isfinite(ea))
         return;
 
     if (r < 0) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
diff --git a/Source/core/html/canvas/CanvasPathMethods.h b/Source/core/html/canvas/CanvasPathMethods.h
index 3259697..f5b51a5 100644
--- a/Source/core/html/canvas/CanvasPathMethods.h
+++ b/Source/core/html/canvas/CanvasPathMethods.h
@@ -33,10 +33,9 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class FloatRect;
 
-typedef int ExceptionCode;
-
 class CanvasPathMethods {
 public:
     virtual ~CanvasPathMethods() { }
@@ -46,8 +45,8 @@
     void lineTo(float x, float y);
     void quadraticCurveTo(float cpx, float cpy, float x, float y);
     void bezierCurveTo(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y);
-    void arcTo(float x0, float y0, float x1, float y1, float radius, ExceptionCode&);
-    void arc(float x, float y, float r, float sa, float ea, bool anticlockwise, ExceptionCode&);
+    void arcTo(float x0, float y0, float x1, float y1, float radius, ExceptionState&);
+    void arc(float x, float y, float r, float sa, float ea, bool anticlockwise, ExceptionState&);
     void rect(float x, float y, float width, float height);
 
     virtual bool isTransformInvertible() const { return true; }
diff --git a/Source/core/html/canvas/CanvasPattern.cpp b/Source/core/html/canvas/CanvasPattern.cpp
index 9b71023..db04afd 100644
--- a/Source/core/html/canvas/CanvasPattern.cpp
+++ b/Source/core/html/canvas/CanvasPattern.cpp
@@ -26,14 +26,15 @@
 #include "config.h"
 #include "core/html/canvas/CanvasPattern.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
-void CanvasPattern::parseRepetitionType(const String& type, bool& repeatX, bool& repeatY, ExceptionCode& ec)
+void CanvasPattern::parseRepetitionType(const String& type, bool& repeatX, bool& repeatY, ExceptionState& es)
 {
-    ec = 0;
+    es.clearException();
     if (type.isEmpty() || type == "repeat") {
         repeatX = true;
         repeatY = true;
@@ -54,7 +55,7 @@
         repeatY = true;
         return;
     }
-    ec = SyntaxError;
+    es.throwDOMException(SyntaxError);
 }
 
 CanvasPattern::CanvasPattern(PassRefPtr<Image> image, bool repeatX, bool repeatY, bool originClean)
diff --git a/Source/core/html/canvas/CanvasPattern.h b/Source/core/html/canvas/CanvasPattern.h
index 64ee634..f1095f2 100644
--- a/Source/core/html/canvas/CanvasPattern.h
+++ b/Source/core/html/canvas/CanvasPattern.h
@@ -34,13 +34,12 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class Image;
 
-typedef int ExceptionCode;
-
 class CanvasPattern : public RefCounted<CanvasPattern>, public ScriptWrappable {
 public:
-    static void parseRepetitionType(const String&, bool& repeatX, bool& repeatY, ExceptionCode&);
+    static void parseRepetitionType(const String&, bool& repeatX, bool& repeatY, ExceptionState&);
 
     static PassRefPtr<CanvasPattern> create(PassRefPtr<Image> image, bool repeatX, bool repeatY, bool originClean)
     {
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
index e29bce5..e834207 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
@@ -34,13 +34,14 @@
 #include "core/html/canvas/CanvasRenderingContext2D.h"
 
 #include "CSSPropertyNames.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/accessibility/AXObjectCache.h"
 #include "core/css/CSSFontSelector.h"
 #include "core/css/CSSParser.h"
 #include "core/css/StylePropertySet.h"
 #include "core/css/resolver/StyleResolver.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/html/HTMLCanvasElement.h"
 #include "core/html/HTMLImageElement.h"
 #include "core/html/HTMLMediaElement.h"
@@ -63,7 +64,6 @@
 #include "core/rendering/RenderLayer.h"
 #include "core/rendering/RenderTheme.h"
 #include "weborigin/SecurityOrigin.h"
-
 #include "wtf/CheckedArithmetic.h"
 #include "wtf/MathExtras.h"
 #include "wtf/OwnPtr.h"
@@ -1239,34 +1239,34 @@
     }
 }
 
-void CanvasRenderingContext2D::drawImage(ImageBitmap* bitmap, float x, float y, ExceptionCode& ec)
+void CanvasRenderingContext2D::drawImage(ImageBitmap* bitmap, float x, float y, ExceptionState& es)
 {
     if (!bitmap) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return;
     }
-    drawImage(bitmap, x, y, bitmap->width(), bitmap->height(), ec);
+    drawImage(bitmap, x, y, bitmap->width(), bitmap->height(), es);
 }
 
 void CanvasRenderingContext2D::drawImage(ImageBitmap* bitmap,
-    float x, float y, float width, float height, ExceptionCode& ec)
+    float x, float y, float width, float height, ExceptionState& es)
 {
     if (!bitmap) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return;
     }
     if (!bitmap->bitmapWidth() || !bitmap->bitmapHeight())
         return;
 
-    drawImage(bitmap, 0, 0, bitmap->bitmapWidth(), bitmap->bitmapHeight(), x, y, width, height, ec);
+    drawImage(bitmap, 0, 0, bitmap->bitmapWidth(), bitmap->bitmapHeight(), x, y, width, height, es);
 }
 
 void CanvasRenderingContext2D::drawImage(ImageBitmap* bitmap,
     float sx, float sy, float sw, float sh,
-    float dx, float dy, float dw, float dh, ExceptionCode& ec)
+    float dx, float dy, float dw, float dh, ExceptionState& es)
 {
     if (!bitmap) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return;
     }
 
@@ -1290,7 +1290,7 @@
 
     FloatRect imageRect = FloatRect(FloatPoint(), bitmap->bitmapSize());
     if (!srcRect.width() || !srcRect.height()) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
     if (!imageRect.intersects(normalizedSrcRect))
@@ -1303,47 +1303,47 @@
     drawImageInternal(imageForRendering, normalizedSrcRect, actualDstRect, state().m_globalComposite, state().m_globalBlend);
 }
 
-void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, float x, float y, ExceptionCode& ec)
+void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, float x, float y, ExceptionState& es)
 {
     if (!image) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return;
     }
     LayoutSize s = size(image);
-    drawImage(image, x, y, s.width(), s.height(), ec);
+    drawImage(image, x, y, s.width(), s.height(), es);
 }
 
 void CanvasRenderingContext2D::drawImage(HTMLImageElement* image,
-    float x, float y, float width, float height, ExceptionCode& ec)
+    float x, float y, float width, float height, ExceptionState& es)
 {
     if (!image) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return;
     }
     LayoutSize s = size(image);
-    drawImage(image, FloatRect(0, 0, s.width(), s.height()), FloatRect(x, y, width, height), ec);
+    drawImage(image, FloatRect(0, 0, s.width(), s.height()), FloatRect(x, y, width, height), es);
 }
 
 void CanvasRenderingContext2D::drawImage(HTMLImageElement* image,
     float sx, float sy, float sw, float sh,
-    float dx, float dy, float dw, float dh, ExceptionCode& ec)
+    float dx, float dy, float dw, float dh, ExceptionState& es)
 {
-    drawImage(image, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), ec);
+    drawImage(image, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), es);
 }
 
-void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionCode& ec)
+void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionState& es)
 {
-    drawImage(image, srcRect, dstRect, state().m_globalComposite, state().m_globalBlend, ec);
+    drawImage(image, srcRect, dstRect, state().m_globalComposite, state().m_globalBlend, es);
 }
 
-void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRect& srcRect, const FloatRect& dstRect, const CompositeOperator& op, const BlendMode& blendMode, ExceptionCode& ec)
+void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRect& srcRect, const FloatRect& dstRect, const CompositeOperator& op, const BlendMode& blendMode, ExceptionState& es)
 {
     if (!image) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return;
     }
 
-    ec = 0;
+    es.clearException();
 
     if (!std::isfinite(dstRect.x()) || !std::isfinite(dstRect.y()) || !std::isfinite(dstRect.width()) || !std::isfinite(dstRect.height())
         || !std::isfinite(srcRect.x()) || !std::isfinite(srcRect.y()) || !std::isfinite(srcRect.width()) || !std::isfinite(srcRect.height()))
@@ -1360,7 +1360,7 @@
 
     FloatRect imageRect = FloatRect(FloatPoint(), size(image));
     if (!srcRect.width() || !srcRect.height()) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
     if (!imageRect.intersects(normalizedSrcRect))
@@ -1385,45 +1385,45 @@
     drawImageInternal(imageForRendering, normalizedSrcRect, normalizedDstRect, op, blendMode);
 }
 
-void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, float x, float y, ExceptionCode& ec)
+void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, float x, float y, ExceptionState& es)
 {
-    drawImage(sourceCanvas, 0, 0, sourceCanvas->width(), sourceCanvas->height(), x, y, sourceCanvas->width(), sourceCanvas->height(), ec);
+    drawImage(sourceCanvas, 0, 0, sourceCanvas->width(), sourceCanvas->height(), x, y, sourceCanvas->width(), sourceCanvas->height(), es);
 }
 
 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas,
-    float x, float y, float width, float height, ExceptionCode& ec)
+    float x, float y, float width, float height, ExceptionState& es)
 {
-    drawImage(sourceCanvas, FloatRect(0, 0, sourceCanvas->width(), sourceCanvas->height()), FloatRect(x, y, width, height), ec);
+    drawImage(sourceCanvas, FloatRect(0, 0, sourceCanvas->width(), sourceCanvas->height()), FloatRect(x, y, width, height), es);
 }
 
 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas,
     float sx, float sy, float sw, float sh,
-    float dx, float dy, float dw, float dh, ExceptionCode& ec)
+    float dx, float dy, float dw, float dh, ExceptionState& es)
 {
-    drawImage(sourceCanvas, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), ec);
+    drawImage(sourceCanvas, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), es);
 }
 
 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, const FloatRect& srcRect,
-    const FloatRect& dstRect, ExceptionCode& ec)
+    const FloatRect& dstRect, ExceptionState& es)
 {
     if (!sourceCanvas) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return;
     }
 
     FloatRect srcCanvasRect = FloatRect(FloatPoint(), sourceCanvas->size());
 
     if (!srcCanvasRect.width() || !srcCanvasRect.height()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
     if (!srcRect.width() || !srcRect.height()) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
-    ec = 0;
+    es.clearException();
 
     FloatRect normalizedSrcRect = normalizeRect(srcRect);
     FloatRect normalizedDstRect = normalizeRect(dstRect);
@@ -1469,50 +1469,49 @@
     }
 }
 
-void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, float x, float y, ExceptionCode& ec)
+void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, float x, float y, ExceptionState& es)
 {
     if (!video) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return;
     }
     IntSize s = size(video);
-    drawImage(video, x, y, s.width(), s.height(), ec);
+    drawImage(video, x, y, s.width(), s.height(), es);
 }
 
 void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video,
-                                         float x, float y, float width, float height, ExceptionCode& ec)
+    float x, float y, float width, float height, ExceptionState& es)
 {
     if (!video) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return;
     }
     IntSize s = size(video);
-    drawImage(video, FloatRect(0, 0, s.width(), s.height()), FloatRect(x, y, width, height), ec);
+    drawImage(video, FloatRect(0, 0, s.width(), s.height()), FloatRect(x, y, width, height), es);
 }
 
 void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video,
     float sx, float sy, float sw, float sh,
-    float dx, float dy, float dw, float dh, ExceptionCode& ec)
+    float dx, float dy, float dw, float dh, ExceptionState& es)
 {
-    drawImage(video, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), ec);
+    drawImage(video, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), es);
 }
 
-void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, const FloatRect& srcRect, const FloatRect& dstRect,
-                                         ExceptionCode& ec)
+void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionState& es)
 {
     if (!video) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return;
     }
 
-    ec = 0;
+    es.clearException();
 
     if (video->readyState() == HTMLMediaElement::HAVE_NOTHING || video->readyState() == HTMLMediaElement::HAVE_METADATA)
         return;
 
     FloatRect videoRect = FloatRect(FloatPoint(), size(video));
     if (!srcRect.width() || !srcRect.height()) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
@@ -1552,7 +1551,7 @@
     if (!parseCompositeAndBlendOperator(compositeOperation, op, blendOp) || blendOp != BlendModeNormal)
         op = CompositeSourceOver;
 
-    drawImage(image, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), op, BlendModeNormal, IGNORE_EXCEPTION);
+    drawImage(image, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), op, BlendModeNormal, IGNORE_EXCEPTION_STATE);
 }
 
 void CanvasRenderingContext2D::setAlpha(float alpha)
@@ -1706,10 +1705,10 @@
     compositeBuffer(buffer.get(), bufferRect, state().m_globalComposite);
 }
 
-PassRefPtr<CanvasGradient> CanvasRenderingContext2D::createLinearGradient(float x0, float y0, float x1, float y1, ExceptionCode& ec)
+PassRefPtr<CanvasGradient> CanvasRenderingContext2D::createLinearGradient(float x0, float y0, float x1, float y1, ExceptionState& es)
 {
     if (!std::isfinite(x0) || !std::isfinite(y0) || !std::isfinite(x1) || !std::isfinite(y1)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
@@ -1717,15 +1716,15 @@
     return gradient.release();
 }
 
-PassRefPtr<CanvasGradient> CanvasRenderingContext2D::createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, ExceptionCode& ec)
+PassRefPtr<CanvasGradient> CanvasRenderingContext2D::createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, ExceptionState& es)
 {
     if (!std::isfinite(x0) || !std::isfinite(y0) || !std::isfinite(r0) || !std::isfinite(x1) || !std::isfinite(y1) || !std::isfinite(r1)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
     if (r0 < 0 || r1 < 0) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return 0;
     }
 
@@ -1734,16 +1733,16 @@
 }
 
 PassRefPtr<CanvasPattern> CanvasRenderingContext2D::createPattern(HTMLImageElement* image,
-    const String& repetitionType, ExceptionCode& ec)
+    const String& repetitionType, ExceptionState& es)
 {
     if (!image) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return 0;
     }
     bool repeatX, repeatY;
-    ec = 0;
-    CanvasPattern::parseRepetitionType(repetitionType, repeatX, repeatY, ec);
-    if (ec)
+    es.clearException();
+    CanvasPattern::parseRepetitionType(repetitionType, repeatX, repeatY, es);
+    if (es.hadException())
         return 0;
 
     if (!image->complete())
@@ -1763,21 +1762,21 @@
 }
 
 PassRefPtr<CanvasPattern> CanvasRenderingContext2D::createPattern(HTMLCanvasElement* canvas,
-    const String& repetitionType, ExceptionCode& ec)
+    const String& repetitionType, ExceptionState& es)
 {
     if (!canvas) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return 0;
     }
     if (!canvas->width() || !canvas->height()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
     bool repeatX, repeatY;
-    ec = 0;
-    CanvasPattern::parseRepetitionType(repetitionType, repeatX, repeatY, ec);
-    if (ec)
+    es.clearException();
+    CanvasPattern::parseRepetitionType(repetitionType, repeatX, repeatY, es);
+    if (es.hadException())
         return 0;
     return CanvasPattern::create(canvas->copiedImage(), repeatX, repeatY, canvas->originClean());
 }
@@ -1847,25 +1846,25 @@
     return data.release();
 }
 
-PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(PassRefPtr<ImageData> imageData, ExceptionCode& ec) const
+PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(PassRefPtr<ImageData> imageData, ExceptionState& es) const
 {
     if (!imageData) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
     return createEmptyImageData(imageData->size());
 }
 
-PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(float sw, float sh, ExceptionCode& ec) const
+PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(float sw, float sh, ExceptionState& es) const
 {
-    ec = 0;
+    es.clearException();
     if (!sw || !sh) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return 0;
     }
     if (!std::isfinite(sw) || !std::isfinite(sh)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
@@ -1882,31 +1881,31 @@
     return createEmptyImageData(size);
 }
 
-PassRefPtr<ImageData> CanvasRenderingContext2D::getImageData(float sx, float sy, float sw, float sh, ExceptionCode& ec) const
+PassRefPtr<ImageData> CanvasRenderingContext2D::getImageData(float sx, float sy, float sw, float sh, ExceptionState& es) const
 {
-    return getImageData(ImageBuffer::LogicalCoordinateSystem, sx, sy, sw, sh, ec);
+    return getImageData(ImageBuffer::LogicalCoordinateSystem, sx, sy, sw, sh, es);
 }
 
-PassRefPtr<ImageData> CanvasRenderingContext2D::webkitGetImageDataHD(float sx, float sy, float sw, float sh, ExceptionCode& ec) const
+PassRefPtr<ImageData> CanvasRenderingContext2D::webkitGetImageDataHD(float sx, float sy, float sw, float sh, ExceptionState& es) const
 {
-    return getImageData(ImageBuffer::BackingStoreCoordinateSystem, sx, sy, sw, sh, ec);
+    return getImageData(ImageBuffer::BackingStoreCoordinateSystem, sx, sy, sw, sh, es);
 }
 
-PassRefPtr<ImageData> CanvasRenderingContext2D::getImageData(ImageBuffer::CoordinateSystem coordinateSystem, float sx, float sy, float sw, float sh, ExceptionCode& ec) const
+PassRefPtr<ImageData> CanvasRenderingContext2D::getImageData(ImageBuffer::CoordinateSystem coordinateSystem, float sx, float sy, float sw, float sh, ExceptionState& es) const
 {
     if (!canvas()->originClean()) {
         DEFINE_STATIC_LOCAL(String, consoleMessage, (ASCIILiteral("Unable to get image data from canvas because the canvas has been tainted by cross-origin data.")));
         canvas()->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, consoleMessage);
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return 0;
     }
 
     if (!sw || !sh) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return 0;
     }
     if (!std::isfinite(sx) || !std::isfinite(sy) || !std::isfinite(sw) || !std::isfinite(sh)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
@@ -1939,44 +1938,44 @@
     return ImageData::create(imageDataRect.size(), byteArray.release());
 }
 
-void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, ExceptionCode& ec)
+void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, ExceptionState& es)
 {
     if (!data) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return;
     }
-    putImageData(data, dx, dy, 0, 0, data->width(), data->height(), ec);
+    putImageData(data, dx, dy, 0, 0, data->width(), data->height(), es);
 }
 
-void CanvasRenderingContext2D::webkitPutImageDataHD(ImageData* data, float dx, float dy, ExceptionCode& ec)
+void CanvasRenderingContext2D::webkitPutImageDataHD(ImageData* data, float dx, float dy, ExceptionState& es)
 {
     if (!data) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return;
     }
-    webkitPutImageDataHD(data, dx, dy, 0, 0, data->width(), data->height(), ec);
+    webkitPutImageDataHD(data, dx, dy, 0, 0, data->width(), data->height(), es);
 }
 
 void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, float dirtyX, float dirtyY,
-                                            float dirtyWidth, float dirtyHeight, ExceptionCode& ec)
+    float dirtyWidth, float dirtyHeight, ExceptionState& es)
 {
-    putImageData(data, ImageBuffer::LogicalCoordinateSystem, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight, ec);
+    putImageData(data, ImageBuffer::LogicalCoordinateSystem, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight, es);
 }
 
-void CanvasRenderingContext2D::webkitPutImageDataHD(ImageData* data, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionCode& ec)
+void CanvasRenderingContext2D::webkitPutImageDataHD(ImageData* data, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionState& es)
 {
-    putImageData(data, ImageBuffer::BackingStoreCoordinateSystem, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight, ec);
+    putImageData(data, ImageBuffer::BackingStoreCoordinateSystem, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight, es);
 }
 
 void CanvasRenderingContext2D::putImageData(ImageData* data, ImageBuffer::CoordinateSystem coordinateSystem, float dx, float dy, float dirtyX, float dirtyY,
-                                            float dirtyWidth, float dirtyHeight, ExceptionCode& ec)
+    float dirtyWidth, float dirtyHeight, ExceptionState& es)
 {
     if (!data) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return;
     }
     if (!std::isfinite(dx) || !std::isfinite(dy) || !std::isfinite(dirtyX) || !std::isfinite(dirtyY) || !std::isfinite(dirtyWidth) || !std::isfinite(dirtyHeight)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
 
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.h b/Source/core/html/canvas/CanvasRenderingContext2D.h
index 80b91bc..8d05fc0 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.h
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.h
@@ -49,6 +49,7 @@
 class CanvasStyle;
 class DOMPath;
 class Element;
+class ExceptionState;
 class FloatRect;
 class GraphicsContext;
 class HTMLCanvasElement;
@@ -58,7 +59,6 @@
 class ImageData;
 class TextMetrics;
 
-typedef int ExceptionCode;
 typedef HashMap<String, RefPtr<MutableStylePropertySet> > MutableStylePropertyMap;
 
 class CanvasRenderingContext2D : public CanvasRenderingContext, public CanvasPathMethods {
@@ -162,22 +162,22 @@
 
     void clearShadow();
 
-    void drawImage(ImageBitmap*, float x, float y, ExceptionCode&);
-    void drawImage(ImageBitmap*, float x, float y, float width, float height, ExceptionCode&);
-    void drawImage(ImageBitmap*, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionCode&);
-    void drawImage(HTMLImageElement*, float x, float y, ExceptionCode&);
-    void drawImage(HTMLImageElement*, float x, float y, float width, float height, ExceptionCode&);
-    void drawImage(HTMLImageElement*, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionCode&);
-    void drawImage(HTMLImageElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionCode&);
-    void drawImage(HTMLImageElement*, const FloatRect& srcRect, const FloatRect& dstRect, const CompositeOperator&, const BlendMode&, ExceptionCode&);
-    void drawImage(HTMLCanvasElement*, float x, float y, ExceptionCode&);
-    void drawImage(HTMLCanvasElement*, float x, float y, float width, float height, ExceptionCode&);
-    void drawImage(HTMLCanvasElement*, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionCode&);
-    void drawImage(HTMLCanvasElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionCode&);
-    void drawImage(HTMLVideoElement*, float x, float y, ExceptionCode&);
-    void drawImage(HTMLVideoElement*, float x, float y, float width, float height, ExceptionCode&);
-    void drawImage(HTMLVideoElement*, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionCode&);
-    void drawImage(HTMLVideoElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionCode&);
+    void drawImage(ImageBitmap*, float x, float y, ExceptionState&);
+    void drawImage(ImageBitmap*, float x, float y, float width, float height, ExceptionState&);
+    void drawImage(ImageBitmap*, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionState&);
+    void drawImage(HTMLImageElement*, float x, float y, ExceptionState&);
+    void drawImage(HTMLImageElement*, float x, float y, float width, float height, ExceptionState&);
+    void drawImage(HTMLImageElement*, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionState&);
+    void drawImage(HTMLImageElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionState&);
+    void drawImage(HTMLImageElement*, const FloatRect& srcRect, const FloatRect& dstRect, const CompositeOperator&, const BlendMode&, ExceptionState&);
+    void drawImage(HTMLCanvasElement*, float x, float y, ExceptionState&);
+    void drawImage(HTMLCanvasElement*, float x, float y, float width, float height, ExceptionState&);
+    void drawImage(HTMLCanvasElement*, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionState&);
+    void drawImage(HTMLCanvasElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionState&);
+    void drawImage(HTMLVideoElement*, float x, float y, ExceptionState&);
+    void drawImage(HTMLVideoElement*, float x, float y, float width, float height, ExceptionState&);
+    void drawImage(HTMLVideoElement*, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionState&);
+    void drawImage(HTMLVideoElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionState&);
 
     void drawImageFromRect(HTMLImageElement*, float sx = 0, float sy = 0, float sw = 0, float sh = 0,
                            float dx = 0, float dy = 0, float dw = 0, float dh = 0, const String& compositeOperation = emptyString());
@@ -186,19 +186,19 @@
 
     void setCompositeOperation(const String&);
 
-    PassRefPtr<CanvasGradient> createLinearGradient(float x0, float y0, float x1, float y1, ExceptionCode&);
-    PassRefPtr<CanvasGradient> createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, ExceptionCode&);
-    PassRefPtr<CanvasPattern> createPattern(HTMLImageElement*, const String& repetitionType, ExceptionCode&);
-    PassRefPtr<CanvasPattern> createPattern(HTMLCanvasElement*, const String& repetitionType, ExceptionCode&);
+    PassRefPtr<CanvasGradient> createLinearGradient(float x0, float y0, float x1, float y1, ExceptionState&);
+    PassRefPtr<CanvasGradient> createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, ExceptionState&);
+    PassRefPtr<CanvasPattern> createPattern(HTMLImageElement*, const String& repetitionType, ExceptionState&);
+    PassRefPtr<CanvasPattern> createPattern(HTMLCanvasElement*, const String& repetitionType, ExceptionState&);
 
-    PassRefPtr<ImageData> createImageData(PassRefPtr<ImageData>, ExceptionCode&) const;
-    PassRefPtr<ImageData> createImageData(float width, float height, ExceptionCode&) const;
-    PassRefPtr<ImageData> getImageData(float sx, float sy, float sw, float sh, ExceptionCode&) const;
-    PassRefPtr<ImageData> webkitGetImageDataHD(float sx, float sy, float sw, float sh, ExceptionCode&) const;
-    void putImageData(ImageData*, float dx, float dy, ExceptionCode&);
-    void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionCode&);
-    void webkitPutImageDataHD(ImageData*, float dx, float dy, ExceptionCode&);
-    void webkitPutImageDataHD(ImageData*, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionCode&);
+    PassRefPtr<ImageData> createImageData(PassRefPtr<ImageData>, ExceptionState&) const;
+    PassRefPtr<ImageData> createImageData(float width, float height, ExceptionState&) const;
+    PassRefPtr<ImageData> getImageData(float sx, float sy, float sw, float sh, ExceptionState&) const;
+    PassRefPtr<ImageData> webkitGetImageDataHD(float sx, float sy, float sw, float sh, ExceptionState&) const;
+    void putImageData(ImageData*, float dx, float dy, ExceptionState&);
+    void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionState&);
+    void webkitPutImageDataHD(ImageData*, float dx, float dy, ExceptionState&);
+    void webkitPutImageDataHD(ImageData*, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionState&);
 
     float webkitBackingStorePixelRatio() const { return canvas()->deviceScaleFactor(); }
 
@@ -322,8 +322,8 @@
     template<class T> void fullCanvasCompositedFill(const T&);
     template<class T> void fullCanvasCompositedDrawImage(T*, const FloatRect&, const FloatRect&, CompositeOperator);
 
-    PassRefPtr<ImageData> getImageData(ImageBuffer::CoordinateSystem, float sx, float sy, float sw, float sh, ExceptionCode&) const;
-    void putImageData(ImageData*, ImageBuffer::CoordinateSystem, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionCode&);
+    PassRefPtr<ImageData> getImageData(ImageBuffer::CoordinateSystem, float sx, float sy, float sw, float sh, ExceptionState&) const;
+    void putImageData(ImageData*, ImageBuffer::CoordinateSystem, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionState&);
 
     bool focusRingCallIsValid(const Path&, Element*);
     void updateFocusRingAccessibility(const Path&, Element*);
diff --git a/Source/core/html/canvas/DataView.cpp b/Source/core/html/canvas/DataView.cpp
index df95f82..b35984d 100644
--- a/Source/core/html/canvas/DataView.cpp
+++ b/Source/core/html/canvas/DataView.cpp
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "core/html/canvas/DataView.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/html/canvas/CheckedInt.h"
 #include "wtf/CPU.h"
@@ -129,10 +130,10 @@
 }
 
 template<typename T>
-T DataView::getData(unsigned byteOffset, bool littleEndian, ExceptionCode& ec) const
+T DataView::getData(unsigned byteOffset, bool littleEndian, ExceptionState& es) const
 {
     if (beyondRange<T>(byteOffset)) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return 0;
     }
 
@@ -144,10 +145,10 @@
 }
 
 template<typename T>
-void DataView::setData(unsigned byteOffset, T value, bool littleEndian, ExceptionCode& ec)
+void DataView::setData(unsigned byteOffset, T value, bool littleEndian, ExceptionState& es)
 {
     if (beyondRange<T>(byteOffset)) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
@@ -158,84 +159,84 @@
     memcpy(static_cast<char*>(m_baseAddress) + byteOffset, tempValue.bytes, sizeof(T));
 }
 
-int8_t DataView::getInt8(unsigned byteOffset, ExceptionCode& ec)
+int8_t DataView::getInt8(unsigned byteOffset, ExceptionState& es)
 {
-    return getData<int8_t>(byteOffset, false, ec);
+    return getData<int8_t>(byteOffset, false, es);
 }
 
-uint8_t DataView::getUint8(unsigned byteOffset, ExceptionCode& ec)
+uint8_t DataView::getUint8(unsigned byteOffset, ExceptionState& es)
 {
-    return getData<uint8_t>(byteOffset, false, ec);
+    return getData<uint8_t>(byteOffset, false, es);
 }
 
-int16_t DataView::getInt16(unsigned byteOffset, bool littleEndian, ExceptionCode& ec)
+int16_t DataView::getInt16(unsigned byteOffset, bool littleEndian, ExceptionState& es)
 {
-    return getData<int16_t>(byteOffset, littleEndian, ec);
+    return getData<int16_t>(byteOffset, littleEndian, es);
 }
 
-uint16_t DataView::getUint16(unsigned byteOffset, bool littleEndian, ExceptionCode& ec)
+uint16_t DataView::getUint16(unsigned byteOffset, bool littleEndian, ExceptionState& es)
 {
-    return getData<uint16_t>(byteOffset, littleEndian, ec);
+    return getData<uint16_t>(byteOffset, littleEndian, es);
 }
 
-int32_t DataView::getInt32(unsigned byteOffset, bool littleEndian, ExceptionCode& ec)
+int32_t DataView::getInt32(unsigned byteOffset, bool littleEndian, ExceptionState& es)
 {
-    return getData<int32_t>(byteOffset, littleEndian, ec);
+    return getData<int32_t>(byteOffset, littleEndian, es);
 }
 
-uint32_t DataView::getUint32(unsigned byteOffset, bool littleEndian, ExceptionCode& ec)
+uint32_t DataView::getUint32(unsigned byteOffset, bool littleEndian, ExceptionState& es)
 {
-    return getData<uint32_t>(byteOffset, littleEndian, ec);
+    return getData<uint32_t>(byteOffset, littleEndian, es);
 }
 
-float DataView::getFloat32(unsigned byteOffset, bool littleEndian, ExceptionCode& ec)
+float DataView::getFloat32(unsigned byteOffset, bool littleEndian, ExceptionState& es)
 {
-    return getData<float>(byteOffset, littleEndian, ec);
+    return getData<float>(byteOffset, littleEndian, es);
 }
 
-double DataView::getFloat64(unsigned byteOffset, bool littleEndian, ExceptionCode& ec)
+double DataView::getFloat64(unsigned byteOffset, bool littleEndian, ExceptionState& es)
 {
-    return getData<double>(byteOffset, littleEndian, ec);
+    return getData<double>(byteOffset, littleEndian, es);
 }
 
-void DataView::setInt8(unsigned byteOffset, int8_t value, ExceptionCode& ec)
+void DataView::setInt8(unsigned byteOffset, int8_t value, ExceptionState& es)
 {
-    setData<int8_t>(byteOffset, value, false, ec);
+    setData<int8_t>(byteOffset, value, false, es);
 }
 
-void DataView::setUint8(unsigned byteOffset, uint8_t value, ExceptionCode& ec)
+void DataView::setUint8(unsigned byteOffset, uint8_t value, ExceptionState& es)
 {
-    setData<uint8_t>(byteOffset, value, false, ec);
+    setData<uint8_t>(byteOffset, value, false, es);
 }
 
-void DataView::setInt16(unsigned byteOffset, short value, bool littleEndian, ExceptionCode& ec)
+void DataView::setInt16(unsigned byteOffset, short value, bool littleEndian, ExceptionState& es)
 {
-    setData<int16_t>(byteOffset, value, littleEndian, ec);
+    setData<int16_t>(byteOffset, value, littleEndian, es);
 }
 
-void DataView::setUint16(unsigned byteOffset, uint16_t value, bool littleEndian, ExceptionCode& ec)
+void DataView::setUint16(unsigned byteOffset, uint16_t value, bool littleEndian, ExceptionState& es)
 {
-    setData<uint16_t>(byteOffset, value, littleEndian, ec);
+    setData<uint16_t>(byteOffset, value, littleEndian, es);
 }
 
-void DataView::setInt32(unsigned byteOffset, int32_t value, bool littleEndian, ExceptionCode& ec)
+void DataView::setInt32(unsigned byteOffset, int32_t value, bool littleEndian, ExceptionState& es)
 {
-    setData<int32_t>(byteOffset, value, littleEndian, ec);
+    setData<int32_t>(byteOffset, value, littleEndian, es);
 }
 
-void DataView::setUint32(unsigned byteOffset, uint32_t value, bool littleEndian, ExceptionCode& ec)
+void DataView::setUint32(unsigned byteOffset, uint32_t value, bool littleEndian, ExceptionState& es)
 {
-    setData<uint32_t>(byteOffset, value, littleEndian, ec);
+    setData<uint32_t>(byteOffset, value, littleEndian, es);
 }
 
-void DataView::setFloat32(unsigned byteOffset, float value, bool littleEndian, ExceptionCode& ec)
+void DataView::setFloat32(unsigned byteOffset, float value, bool littleEndian, ExceptionState& es)
 {
-    setData<float>(byteOffset, value, littleEndian, ec);
+    setData<float>(byteOffset, value, littleEndian, es);
 }
 
-void DataView::setFloat64(unsigned byteOffset, double value, bool littleEndian, ExceptionCode& ec)
+void DataView::setFloat64(unsigned byteOffset, double value, bool littleEndian, ExceptionState& es)
 {
-    setData<double>(byteOffset, value, littleEndian, ec);
+    setData<double>(byteOffset, value, littleEndian, es);
 }
 
 void DataView::neuter()
diff --git a/Source/core/html/canvas/DataView.h b/Source/core/html/canvas/DataView.h
index 67afae6..4a9728d 100644
--- a/Source/core/html/canvas/DataView.h
+++ b/Source/core/html/canvas/DataView.h
@@ -32,7 +32,7 @@
 
 namespace WebCore {
 
-typedef int ExceptionCode;
+class ExceptionState;
 
 class DataView : public ArrayBufferView, public ScriptWrappable {
 public:
@@ -43,35 +43,35 @@
     virtual unsigned byteLength() const { return m_byteLength; }
     virtual PassRefPtr<ArrayBufferView> slice(int, int) const { return 0; }
 
-    int8_t getInt8(unsigned byteOffset, ExceptionCode&);
-    uint8_t getUint8(unsigned byteOffset, ExceptionCode&);
-    int16_t getInt16(unsigned byteOffset, ExceptionCode& ec) { return getInt16(byteOffset, false, ec); }
-    int16_t getInt16(unsigned byteOffset, bool littleEndian, ExceptionCode&);
-    uint16_t getUint16(unsigned byteOffset, ExceptionCode& ec) { return getUint16(byteOffset, false, ec); }
-    uint16_t getUint16(unsigned byteOffset, bool littleEndian, ExceptionCode&);
-    int32_t getInt32(unsigned byteOffset, ExceptionCode& ec) { return getInt32(byteOffset, false, ec); }
-    int32_t getInt32(unsigned byteOffset, bool littleEndian, ExceptionCode&);
-    uint32_t getUint32(unsigned byteOffset, ExceptionCode& ec) { return getUint32(byteOffset, false, ec); }
-    uint32_t getUint32(unsigned byteOffset, bool littleEndian, ExceptionCode&);
-    float getFloat32(unsigned byteOffset, ExceptionCode& ec) { return getFloat32(byteOffset, false, ec); }
-    float getFloat32(unsigned byteOffset, bool littleEndian, ExceptionCode&);
-    double getFloat64(unsigned byteOffset, ExceptionCode& ec) { return getFloat64(byteOffset, false, ec); }
-    double getFloat64(unsigned byteOffset, bool littleEndian, ExceptionCode&);
+    int8_t getInt8(unsigned byteOffset, ExceptionState&);
+    uint8_t getUint8(unsigned byteOffset, ExceptionState&);
+    int16_t getInt16(unsigned byteOffset, ExceptionState& ec) { return getInt16(byteOffset, false, ec); }
+    int16_t getInt16(unsigned byteOffset, bool littleEndian, ExceptionState&);
+    uint16_t getUint16(unsigned byteOffset, ExceptionState& ec) { return getUint16(byteOffset, false, ec); }
+    uint16_t getUint16(unsigned byteOffset, bool littleEndian, ExceptionState&);
+    int32_t getInt32(unsigned byteOffset, ExceptionState& ec) { return getInt32(byteOffset, false, ec); }
+    int32_t getInt32(unsigned byteOffset, bool littleEndian, ExceptionState&);
+    uint32_t getUint32(unsigned byteOffset, ExceptionState& ec) { return getUint32(byteOffset, false, ec); }
+    uint32_t getUint32(unsigned byteOffset, bool littleEndian, ExceptionState&);
+    float getFloat32(unsigned byteOffset, ExceptionState& ec) { return getFloat32(byteOffset, false, ec); }
+    float getFloat32(unsigned byteOffset, bool littleEndian, ExceptionState&);
+    double getFloat64(unsigned byteOffset, ExceptionState& ec) { return getFloat64(byteOffset, false, ec); }
+    double getFloat64(unsigned byteOffset, bool littleEndian, ExceptionState&);
 
-    void setInt8(unsigned byteOffset, int8_t value, ExceptionCode&);
-    void setUint8(unsigned byteOffset, uint8_t value, ExceptionCode&);
-    void setInt16(unsigned byteOffset, int16_t value, ExceptionCode& ec) { setInt16(byteOffset, value, false, ec); }
-    void setInt16(unsigned byteOffset, int16_t value, bool littleEndian, ExceptionCode&);
-    void setUint16(unsigned byteOffset, uint16_t value, ExceptionCode& ec) { setUint16(byteOffset, value, false, ec); }
-    void setUint16(unsigned byteOffset, uint16_t value, bool littleEndian, ExceptionCode&);
-    void setInt32(unsigned byteOffset, int32_t value, ExceptionCode& ec) { setInt32(byteOffset, value, false, ec); }
-    void setInt32(unsigned byteOffset, int32_t value, bool littleEndian, ExceptionCode&);
-    void setUint32(unsigned byteOffset, uint32_t value, ExceptionCode& ec) { setUint32(byteOffset, value, false, ec); }
-    void setUint32(unsigned byteOffset, uint32_t value, bool littleEndian, ExceptionCode&);
-    void setFloat32(unsigned byteOffset, float value, ExceptionCode& ec) { setFloat32(byteOffset, value, false, ec); }
-    void setFloat32(unsigned byteOffset, float value, bool littleEndian, ExceptionCode&);
-    void setFloat64(unsigned byteOffset, double value, ExceptionCode& ec) { setFloat64(byteOffset, value, false, ec); }
-    void setFloat64(unsigned byteOffset, double value, bool littleEndian, ExceptionCode&);
+    void setInt8(unsigned byteOffset, int8_t value, ExceptionState&);
+    void setUint8(unsigned byteOffset, uint8_t value, ExceptionState&);
+    void setInt16(unsigned byteOffset, int16_t value, ExceptionState& ec) { setInt16(byteOffset, value, false, ec); }
+    void setInt16(unsigned byteOffset, int16_t value, bool littleEndian, ExceptionState&);
+    void setUint16(unsigned byteOffset, uint16_t value, ExceptionState& ec) { setUint16(byteOffset, value, false, ec); }
+    void setUint16(unsigned byteOffset, uint16_t value, bool littleEndian, ExceptionState&);
+    void setInt32(unsigned byteOffset, int32_t value, ExceptionState& ec) { setInt32(byteOffset, value, false, ec); }
+    void setInt32(unsigned byteOffset, int32_t value, bool littleEndian, ExceptionState&);
+    void setUint32(unsigned byteOffset, uint32_t value, ExceptionState& ec) { setUint32(byteOffset, value, false, ec); }
+    void setUint32(unsigned byteOffset, uint32_t value, bool littleEndian, ExceptionState&);
+    void setFloat32(unsigned byteOffset, float value, ExceptionState& ec) { setFloat32(byteOffset, value, false, ec); }
+    void setFloat32(unsigned byteOffset, float value, bool littleEndian, ExceptionState&);
+    void setFloat64(unsigned byteOffset, double value, ExceptionState& ec) { setFloat64(byteOffset, value, false, ec); }
+    void setFloat64(unsigned byteOffset, double value, bool littleEndian, ExceptionState&);
 
     virtual ViewType getType() const
     {
@@ -88,10 +88,10 @@
     inline bool beyondRange(unsigned byteOffset) const { return byteOffset >= m_byteLength || byteOffset + sizeof(T) > m_byteLength; }
 
     template<typename T>
-    T getData(unsigned byteOffset, bool littleEndian, ExceptionCode&) const;
+    T getData(unsigned byteOffset, bool littleEndian, ExceptionState&) const;
 
     template<typename T>
-    void setData(unsigned byteOffset, T value, bool littleEndian, ExceptionCode&);
+    void setData(unsigned byteOffset, T value, bool littleEndian, ExceptionState&);
 
     unsigned m_byteLength;
 };
diff --git a/Source/core/html/canvas/OESVertexArrayObject.cpp b/Source/core/html/canvas/OESVertexArrayObject.cpp
index 7065c3b..9c5c2c3 100644
--- a/Source/core/html/canvas/OESVertexArrayObject.cpp
+++ b/Source/core/html/canvas/OESVertexArrayObject.cpp
@@ -27,6 +27,7 @@
 
 #include "core/html/canvas/OESVertexArrayObject.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/html/canvas/WebGLRenderingContext.h"
 #include "core/html/canvas/WebGLVertexArrayObjectOES.h"
 #include "core/platform/graphics/Extensions3D.h"
@@ -87,9 +88,9 @@
     return extensions->isVertexArrayOES(arrayObject->object());
 }
 
-void OESVertexArrayObject::bindVertexArrayOES(WebGLVertexArrayObjectOES* arrayObject, ExceptionCode& ec)
+void OESVertexArrayObject::bindVertexArrayOES(WebGLVertexArrayObjectOES* arrayObject, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isLost())
         return;
 
diff --git a/Source/core/html/canvas/OESVertexArrayObject.h b/Source/core/html/canvas/OESVertexArrayObject.h
index 142a14b..8cd0bb5 100644
--- a/Source/core/html/canvas/OESVertexArrayObject.h
+++ b/Source/core/html/canvas/OESVertexArrayObject.h
@@ -33,11 +33,10 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class WebGLRenderingContext;
 class WebGLVertexArrayObjectOES;
 
-typedef int ExceptionCode;
-
 class OESVertexArrayObject : public WebGLExtension, public ScriptWrappable {
 public:
     static PassRefPtr<OESVertexArrayObject> create(WebGLRenderingContext*);
@@ -50,7 +49,7 @@
     PassRefPtr<WebGLVertexArrayObjectOES> createVertexArrayOES();
     void deleteVertexArrayOES(WebGLVertexArrayObjectOES*);
     GC3Dboolean isVertexArrayOES(WebGLVertexArrayObjectOES*);
-    void bindVertexArrayOES(WebGLVertexArrayObjectOES*, ExceptionCode&);
+    void bindVertexArrayOES(WebGLVertexArrayObjectOES*, ExceptionState&);
 
 private:
     OESVertexArrayObject(WebGLRenderingContext*);
diff --git a/Source/core/html/canvas/WebGLDebugShaders.cpp b/Source/core/html/canvas/WebGLDebugShaders.cpp
index 2448230..43d14d1 100644
--- a/Source/core/html/canvas/WebGLDebugShaders.cpp
+++ b/Source/core/html/canvas/WebGLDebugShaders.cpp
@@ -24,9 +24,9 @@
  */
 
 #include "config.h"
-
 #include "core/html/canvas/WebGLDebugShaders.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/html/canvas/WebGLRenderingContext.h"
 #include "core/html/canvas/WebGLShader.h"
 #include "core/platform/graphics/Extensions3D.h"
@@ -53,9 +53,9 @@
     return adoptRef(new WebGLDebugShaders(context));
 }
 
-String WebGLDebugShaders::getTranslatedShaderSource(WebGLShader* shader, ExceptionCode& ec)
+String WebGLDebugShaders::getTranslatedShaderSource(WebGLShader* shader, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isLost())
         return String();
     if (!m_context->validateWebGLObject("getTranslatedShaderSource", shader))
diff --git a/Source/core/html/canvas/WebGLDebugShaders.h b/Source/core/html/canvas/WebGLDebugShaders.h
index 8c19c5a..8478275 100644
--- a/Source/core/html/canvas/WebGLDebugShaders.h
+++ b/Source/core/html/canvas/WebGLDebugShaders.h
@@ -32,10 +32,9 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class WebGLShader;
 
-typedef int ExceptionCode;
-
 class WebGLDebugShaders : public WebGLExtension, public ScriptWrappable {
 public:
     static PassRefPtr<WebGLDebugShaders> create(WebGLRenderingContext*);
@@ -45,7 +44,7 @@
     virtual ~WebGLDebugShaders();
     virtual ExtensionName getName() const;
 
-    String getTranslatedShaderSource(WebGLShader*, ExceptionCode&);
+    String getTranslatedShaderSource(WebGLShader*, ExceptionState&);
 
 private:
     WebGLDebugShaders(WebGLRenderingContext*);
diff --git a/Source/core/html/canvas/WebGLRenderingContext.cpp b/Source/core/html/canvas/WebGLRenderingContext.cpp
index e03fd7b..826efde 100644
--- a/Source/core/html/canvas/WebGLRenderingContext.cpp
+++ b/Source/core/html/canvas/WebGLRenderingContext.cpp
@@ -24,10 +24,11 @@
  */
 
 #include "config.h"
-
 #include "core/html/canvas/WebGLRenderingContext.h"
 
 #include "RuntimeEnabledFeatures.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/html/HTMLCanvasElement.h"
 #include "core/html/HTMLImageElement.h"
@@ -987,9 +988,9 @@
     return 0;
 }
 
-void WebGLRenderingContext::activeTexture(GC3Denum texture, ExceptionCode& ec)
+void WebGLRenderingContext::activeTexture(GC3Denum texture, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost())
         return;
     if (texture - GraphicsContext3D::TEXTURE0 >= m_textureUnits.size()) {
@@ -1003,9 +1004,9 @@
 
 }
 
-void WebGLRenderingContext::attachShader(WebGLProgram* program, WebGLShader* shader, ExceptionCode& ec)
+void WebGLRenderingContext::attachShader(WebGLProgram* program, WebGLShader* shader, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateWebGLObject("attachShader", program) || !validateWebGLObject("attachShader", shader))
         return;
     if (!program->attachShader(shader)) {
@@ -1016,9 +1017,9 @@
     shader->onAttached();
 }
 
-void WebGLRenderingContext::bindAttribLocation(WebGLProgram* program, GC3Duint index, const String& name, ExceptionCode& ec)
+void WebGLRenderingContext::bindAttribLocation(WebGLProgram* program, GC3Duint index, const String& name, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateWebGLObject("bindAttribLocation", program))
         return;
     if (!validateLocationLength("bindAttribLocation", name))
@@ -1051,9 +1052,9 @@
     return true;
 }
 
-void WebGLRenderingContext::bindBuffer(GC3Denum target, WebGLBuffer* buffer, ExceptionCode& ec)
+void WebGLRenderingContext::bindBuffer(GC3Denum target, WebGLBuffer* buffer, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     bool deleted;
     if (!checkObjectToBeBound("bindBuffer", buffer, deleted))
         return;
@@ -1077,9 +1078,9 @@
         buffer->setTarget(target);
 }
 
-void WebGLRenderingContext::bindFramebuffer(GC3Denum target, WebGLFramebuffer* buffer, ExceptionCode& ec)
+void WebGLRenderingContext::bindFramebuffer(GC3Denum target, WebGLFramebuffer* buffer, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     bool deleted;
     if (!checkObjectToBeBound("bindFramebuffer", buffer, deleted))
         return;
@@ -1101,9 +1102,9 @@
     applyStencilTest();
 }
 
-void WebGLRenderingContext::bindRenderbuffer(GC3Denum target, WebGLRenderbuffer* renderBuffer, ExceptionCode& ec)
+void WebGLRenderingContext::bindRenderbuffer(GC3Denum target, WebGLRenderbuffer* renderBuffer, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     bool deleted;
     if (!checkObjectToBeBound("bindRenderbuffer", renderBuffer, deleted))
         return;
@@ -1119,9 +1120,9 @@
         renderBuffer->setHasEverBeenBound();
 }
 
-void WebGLRenderingContext::bindTexture(GC3Denum target, WebGLTexture* texture, ExceptionCode& ec)
+void WebGLRenderingContext::bindTexture(GC3Denum target, WebGLTexture* texture, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     bool deleted;
     if (!checkObjectToBeBound("bindTexture", texture, deleted))
         return;
@@ -1198,9 +1199,9 @@
     m_context->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
 }
 
-void WebGLRenderingContext::bufferData(GC3Denum target, long long size, GC3Denum usage, ExceptionCode& ec)
+void WebGLRenderingContext::bufferData(GC3Denum target, long long size, GC3Denum usage, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost())
         return;
     WebGLBuffer* buffer = validateBufferDataParameters("bufferData", target, usage);
@@ -1218,9 +1219,9 @@
     m_context->bufferData(target, static_cast<GC3Dsizeiptr>(size), usage);
 }
 
-void WebGLRenderingContext::bufferData(GC3Denum target, ArrayBuffer* data, GC3Denum usage, ExceptionCode& ec)
+void WebGLRenderingContext::bufferData(GC3Denum target, ArrayBuffer* data, GC3Denum usage, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost())
         return;
     WebGLBuffer* buffer = validateBufferDataParameters("bufferData", target, usage);
@@ -1233,9 +1234,9 @@
     m_context->bufferData(target, data->byteLength(), data->data(), usage);
 }
 
-void WebGLRenderingContext::bufferData(GC3Denum target, ArrayBufferView* data, GC3Denum usage, ExceptionCode& ec)
+void WebGLRenderingContext::bufferData(GC3Denum target, ArrayBufferView* data, GC3Denum usage, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost())
         return;
     WebGLBuffer* buffer = validateBufferDataParameters("bufferData", target, usage);
@@ -1249,9 +1250,9 @@
     m_context->bufferData(target, data->byteLength(), data->baseAddress(), usage);
 }
 
-void WebGLRenderingContext::bufferSubData(GC3Denum target, long long offset, ArrayBuffer* data, ExceptionCode& ec)
+void WebGLRenderingContext::bufferSubData(GC3Denum target, long long offset, ArrayBuffer* data, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost())
         return;
     WebGLBuffer* buffer = validateBufferDataParameters("bufferSubData", target, GraphicsContext3D::STATIC_DRAW);
@@ -1267,9 +1268,9 @@
     m_context->bufferSubData(target, static_cast<GC3Dintptr>(offset), data->byteLength(), data->data());
 }
 
-void WebGLRenderingContext::bufferSubData(GC3Denum target, long long offset, ArrayBufferView* data, ExceptionCode& ec)
+void WebGLRenderingContext::bufferSubData(GC3Denum target, long long offset, ArrayBufferView* data, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost())
         return;
     WebGLBuffer* buffer = validateBufferDataParameters("bufferSubData", target, GraphicsContext3D::STATIC_DRAW);
@@ -1369,9 +1370,9 @@
     m_context->colorMask(red, green, blue, alpha);
 }
 
-void WebGLRenderingContext::compileShader(WebGLShader* shader, ExceptionCode& ec)
+void WebGLRenderingContext::compileShader(WebGLShader* shader, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateWebGLObject("compileShader", shader))
         return;
     m_context->compileShader(objectOrZero(shader));
@@ -1576,9 +1577,9 @@
     return renderbuffer->emulatedStencilBuffer();
 }
 
-PassRefPtr<WebGLShader> WebGLRenderingContext::createShader(GC3Denum type, ExceptionCode& ec)
+PassRefPtr<WebGLShader> WebGLRenderingContext::createShader(GC3Denum type, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost())
         return 0;
     if (type != GraphicsContext3D::VERTEX_SHADER && type != GraphicsContext3D::FRAGMENT_SHADER) {
@@ -1711,9 +1712,9 @@
     m_context->depthRange(zNear, zFar);
 }
 
-void WebGLRenderingContext::detachShader(WebGLProgram* program, WebGLShader* shader, ExceptionCode& ec)
+void WebGLRenderingContext::detachShader(WebGLProgram* program, WebGLShader* shader, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateWebGLObject("detachShader", program) || !validateWebGLObject("detachShader", shader))
         return;
     if (!program->detachShader(shader)) {
@@ -1740,9 +1741,9 @@
     m_context->disable(cap);
 }
 
-void WebGLRenderingContext::disableVertexAttribArray(GC3Duint index, ExceptionCode& ec)
+void WebGLRenderingContext::disableVertexAttribArray(GC3Duint index, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost())
         return;
     if (index >= m_maxVertexAttribs) {
@@ -1784,9 +1785,9 @@
     return true;
 }
 
-void WebGLRenderingContext::drawArrays(GC3Denum mode, GC3Dint first, GC3Dsizei count, ExceptionCode& ec)
+void WebGLRenderingContext::drawArrays(GC3Denum mode, GC3Dint first, GC3Dsizei count, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
 
     if (!validateDrawArrays("drawArrays", mode, first, count))
         return;
@@ -1799,9 +1800,9 @@
     markContextChanged();
 }
 
-void WebGLRenderingContext::drawElements(GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, ExceptionCode& ec)
+void WebGLRenderingContext::drawElements(GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
 
     if (!validateDrawElements("drawElements", mode, count, type, offset))
         return;
@@ -1862,9 +1863,9 @@
     m_context->enable(cap);
 }
 
-void WebGLRenderingContext::enableVertexAttribArray(GC3Duint index, ExceptionCode& ec)
+void WebGLRenderingContext::enableVertexAttribArray(GC3Duint index, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost())
         return;
     if (index >= m_maxVertexAttribs) {
@@ -1892,9 +1893,9 @@
     m_context->flush();
 }
 
-void WebGLRenderingContext::framebufferRenderbuffer(GC3Denum target, GC3Denum attachment, GC3Denum renderbuffertarget, WebGLRenderbuffer* buffer, ExceptionCode& ec)
+void WebGLRenderingContext::framebufferRenderbuffer(GC3Denum target, GC3Denum attachment, GC3Denum renderbuffertarget, WebGLRenderbuffer* buffer, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateFramebufferFuncParameters("framebufferRenderbuffer", target, attachment))
         return;
     if (renderbuffertarget != GraphicsContext3D::RENDERBUFFER) {
@@ -1935,9 +1936,9 @@
     applyStencilTest();
 }
 
-void WebGLRenderingContext::framebufferTexture2D(GC3Denum target, GC3Denum attachment, GC3Denum textarget, WebGLTexture* texture, GC3Dint level, ExceptionCode& ec)
+void WebGLRenderingContext::framebufferTexture2D(GC3Denum target, GC3Denum attachment, GC3Denum textarget, WebGLTexture* texture, GC3Dint level, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateFramebufferFuncParameters("framebufferTexture2D", target, attachment))
         return;
     if (level) {
@@ -2020,9 +2021,9 @@
     tex->generateMipmapLevelInfo();
 }
 
-PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveAttrib(WebGLProgram* program, GC3Duint index, ExceptionCode& ec)
+PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveAttrib(WebGLProgram* program, GC3Duint index, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateWebGLObject("getActiveAttrib", program))
         return 0;
     ActiveInfo info;
@@ -2031,9 +2032,9 @@
     return WebGLActiveInfo::create(info.name, info.type, info.size);
 }
 
-PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveUniform(WebGLProgram* program, GC3Duint index, ExceptionCode& ec)
+PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveUniform(WebGLProgram* program, GC3Duint index, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateWebGLObject("getActiveUniform", program))
         return 0;
     ActiveInfo info;
@@ -2042,9 +2043,9 @@
     return WebGLActiveInfo::create(info.name, info.type, info.size);
 }
 
-bool WebGLRenderingContext::getAttachedShaders(WebGLProgram* program, Vector<RefPtr<WebGLShader> >& shaderObjects, ExceptionCode& ec)
+bool WebGLRenderingContext::getAttachedShaders(WebGLProgram* program, Vector<RefPtr<WebGLShader> >& shaderObjects, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     shaderObjects.clear();
     if (isContextLost() || !validateWebGLObject("getAttachedShaders", program))
         return false;
@@ -2078,9 +2079,9 @@
     return m_context->getAttribLocation(objectOrZero(program), name);
 }
 
-WebGLGetInfo WebGLRenderingContext::getBufferParameter(GC3Denum target, GC3Denum pname, ExceptionCode& ec)
+WebGLGetInfo WebGLRenderingContext::getBufferParameter(GC3Denum target, GC3Denum pname, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost())
         return WebGLGetInfo();
     if (target != GraphicsContext3D::ARRAY_BUFFER && target != GraphicsContext3D::ELEMENT_ARRAY_BUFFER) {
@@ -2168,9 +2169,9 @@
     return 0;
 }
 
-WebGLGetInfo WebGLRenderingContext::getFramebufferAttachmentParameter(GC3Denum target, GC3Denum attachment, GC3Denum pname, ExceptionCode& ec)
+WebGLGetInfo WebGLRenderingContext::getFramebufferAttachmentParameter(GC3Denum target, GC3Denum attachment, GC3Denum pname, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateFramebufferFuncParameters("getFramebufferAttachmentParameter", target, attachment))
         return WebGLGetInfo();
 
@@ -2220,9 +2221,9 @@
     }
 }
 
-WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname, ExceptionCode& ec)
+WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost())
         return WebGLGetInfo();
     const int intZero = 0;
@@ -2458,9 +2459,9 @@
     }
 }
 
-WebGLGetInfo WebGLRenderingContext::getProgramParameter(WebGLProgram* program, GC3Denum pname, ExceptionCode& ec)
+WebGLGetInfo WebGLRenderingContext::getProgramParameter(WebGLProgram* program, GC3Denum pname, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateWebGLObject("getProgramParameter", program))
         return WebGLGetInfo();
 
@@ -2484,9 +2485,9 @@
     }
 }
 
-String WebGLRenderingContext::getProgramInfoLog(WebGLProgram* program, ExceptionCode& ec)
+String WebGLRenderingContext::getProgramInfoLog(WebGLProgram* program, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost())
         return String();
     if (!validateWebGLObject("getProgramInfoLog", program))
@@ -2494,9 +2495,9 @@
     return ensureNotNull(m_context->getProgramInfoLog(objectOrZero(program)));
 }
 
-WebGLGetInfo WebGLRenderingContext::getRenderbufferParameter(GC3Denum target, GC3Denum pname, ExceptionCode& ec)
+WebGLGetInfo WebGLRenderingContext::getRenderbufferParameter(GC3Denum target, GC3Denum pname, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost())
         return WebGLGetInfo();
     if (target != GraphicsContext3D::RENDERBUFFER) {
@@ -2536,9 +2537,9 @@
     }
 }
 
-WebGLGetInfo WebGLRenderingContext::getShaderParameter(WebGLShader* shader, GC3Denum pname, ExceptionCode& ec)
+WebGLGetInfo WebGLRenderingContext::getShaderParameter(WebGLShader* shader, GC3Denum pname, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateWebGLObject("getShaderParameter", shader))
         return WebGLGetInfo();
     GC3Dint value = 0;
@@ -2557,9 +2558,9 @@
     }
 }
 
-String WebGLRenderingContext::getShaderInfoLog(WebGLShader* shader, ExceptionCode& ec)
+String WebGLRenderingContext::getShaderInfoLog(WebGLShader* shader, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost())
         return String();
     if (!validateWebGLObject("getShaderInfoLog", shader))
@@ -2567,9 +2568,9 @@
     return ensureNotNull(m_context->getShaderInfoLog(objectOrZero(shader)));
 }
 
-PassRefPtr<WebGLShaderPrecisionFormat> WebGLRenderingContext::getShaderPrecisionFormat(GC3Denum shaderType, GC3Denum precisionType, ExceptionCode& ec)
+PassRefPtr<WebGLShaderPrecisionFormat> WebGLRenderingContext::getShaderPrecisionFormat(GC3Denum shaderType, GC3Denum precisionType, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost())
         return 0;
     switch (shaderType) {
@@ -2599,9 +2600,9 @@
     return WebGLShaderPrecisionFormat::create(range[0], range[1], precision);
 }
 
-String WebGLRenderingContext::getShaderSource(WebGLShader* shader, ExceptionCode& ec)
+String WebGLRenderingContext::getShaderSource(WebGLShader* shader, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost())
         return String();
     if (!validateWebGLObject("getShaderSource", shader))
@@ -2628,9 +2629,9 @@
     return result;
 }
 
-WebGLGetInfo WebGLRenderingContext::getTexParameter(GC3Denum target, GC3Denum pname, ExceptionCode& ec)
+WebGLGetInfo WebGLRenderingContext::getTexParameter(GC3Denum target, GC3Denum pname, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost())
         return WebGLGetInfo();
     WebGLTexture* tex = validateTextureBinding("getTexParameter", target, false);
@@ -2657,9 +2658,9 @@
     }
 }
 
-WebGLGetInfo WebGLRenderingContext::getUniform(WebGLProgram* program, const WebGLUniformLocation* uniformLocation, ExceptionCode& ec)
+WebGLGetInfo WebGLRenderingContext::getUniform(WebGLProgram* program, const WebGLUniformLocation* uniformLocation, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateWebGLObject("getUniform", program))
         return WebGLGetInfo();
     if (!uniformLocation || uniformLocation->program() != program) {
@@ -2800,9 +2801,9 @@
     return WebGLGetInfo();
 }
 
-PassRefPtr<WebGLUniformLocation> WebGLRenderingContext::getUniformLocation(WebGLProgram* program, const String& name, ExceptionCode& ec)
+PassRefPtr<WebGLUniformLocation> WebGLRenderingContext::getUniformLocation(WebGLProgram* program, const String& name, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateWebGLObject("getUniformLocation", program))
         return 0;
     if (!validateLocationLength("getUniformLocation", name))
@@ -2821,9 +2822,9 @@
     return WebGLUniformLocation::create(program, uniformLocation);
 }
 
-WebGLGetInfo WebGLRenderingContext::getVertexAttrib(GC3Duint index, GC3Denum pname, ExceptionCode& ec)
+WebGLGetInfo WebGLRenderingContext::getVertexAttrib(GC3Duint index, GC3Denum pname, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost())
         return WebGLGetInfo();
     if (index >= m_maxVertexAttribs) {
@@ -2972,9 +2973,9 @@
     m_context->lineWidth(width);
 }
 
-void WebGLRenderingContext::linkProgram(WebGLProgram* program, ExceptionCode& ec)
+void WebGLRenderingContext::linkProgram(WebGLProgram* program, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateWebGLObject("linkProgram", program))
         return;
 
@@ -3027,7 +3028,7 @@
     m_context->polygonOffset(factor, units);
 }
 
-void WebGLRenderingContext::readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, ArrayBufferView* pixels, ExceptionCode&)
+void WebGLRenderingContext::readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, ArrayBufferView* pixels, ExceptionState&)
 {
     if (isContextLost())
         return;
@@ -3176,9 +3177,9 @@
     m_context->scissor(x, y, width, height);
 }
 
-void WebGLRenderingContext::shaderSource(WebGLShader* shader, const String& string, ExceptionCode& ec)
+void WebGLRenderingContext::shaderSource(WebGLShader* shader, const String& string, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateWebGLObject("shaderSource", shader))
         return;
     String stringWithoutComments = StripComments(string).result();
@@ -3274,11 +3275,11 @@
     m_context->stencilOpSeparate(face, fail, zfail, zpass);
 }
 
-void WebGLRenderingContext::texImage2DBase(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, const void* pixels, ExceptionCode& ec)
+void WebGLRenderingContext::texImage2DBase(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, const void* pixels, ExceptionState& es)
 {
     // All calling functions check isContextLost, so a duplicate check is not needed here.
     // FIXME: For now we ignore any errors returned
-    ec = 0;
+    es.clearException();
     WebGLTexture* tex = validateTextureBinding("texImage2D", target, true);
     ASSERT(validateTexFuncParameters("texImage2D", NotTexSubImage2D, target, level, internalformat, width, height, border, format, type));
     ASSERT(tex);
@@ -3289,10 +3290,10 @@
     tex->setLevelInfo(target, level, internalformat, width, height, type);
 }
 
-void WebGLRenderingContext::texImage2DImpl(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Denum format, GC3Denum type, Image* image, GraphicsContext3D::ImageHtmlDomSource domSource, bool flipY, bool premultiplyAlpha, ExceptionCode& ec)
+void WebGLRenderingContext::texImage2DImpl(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Denum format, GC3Denum type, Image* image, GraphicsContext3D::ImageHtmlDomSource domSource, bool flipY, bool premultiplyAlpha, ExceptionState& es)
 {
     // All calling functions check isContextLost, so a duplicate check is not needed here.
-    ec = 0;
+    es.clearException();
     Vector<uint8_t> data;
     GraphicsContext3D::ImageExtractor imageExtractor(image, domSource, premultiplyAlpha, m_unpackColorspaceConversion == GraphicsContext3D::NONE);
     if (!imageExtractor.extractSucceeded()) {
@@ -3315,7 +3316,7 @@
 
     if (m_unpackAlignment != 1)
         m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1);
-    texImage2DBase(target, level, internalformat, image->width(), image->height(), 0, format, type, needConversion ? data.data() : imagePixelData, ec);
+    texImage2DBase(target, level, internalformat, image->width(), image->height(), 0, format, type, needConversion ? data.data() : imagePixelData, es);
     if (m_unpackAlignment != 1)
         m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
 }
@@ -3364,8 +3365,8 @@
 }
 
 void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
-                                       GC3Dsizei width, GC3Dsizei height, GC3Dint border,
-                                       GC3Denum format, GC3Denum type, ArrayBufferView* pixels, ExceptionCode& ec)
+    GC3Dsizei width, GC3Dsizei height, GC3Dint border,
+    GC3Denum format, GC3Denum type, ArrayBufferView* pixels, ExceptionState& es)
 {
     if (isContextLost() || !validateTexFuncData("texImage2D", level, width, height, format, type, pixels, NullAllowed)
         || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceArrayBufferView, target, level, internalformat, width, height, border, format, type, 0, 0))
@@ -3385,16 +3386,15 @@
     }
     if (changeUnpackAlignment)
         m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1);
-    texImage2DBase(target, level, internalformat, width, height, border,
-                   format, type, data, ec);
+    texImage2DBase(target, level, internalformat, width, height, border, format, type, data, es);
     if (changeUnpackAlignment)
         m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
 }
 
 void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
-                                       GC3Denum format, GC3Denum type, ImageData* pixels, ExceptionCode& ec)
+    GC3Denum format, GC3Denum type, ImageData* pixels, ExceptionState& es)
 {
-    ec = 0;
+    es.clearException();
     if (isContextLost() || !pixels || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceImageData, target, level, internalformat, pixels->width(), pixels->height(), 0, format, type, 0, 0))
         return;
     Vector<uint8_t> data;
@@ -3411,29 +3411,29 @@
     }
     if (m_unpackAlignment != 1)
         m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1);
-    texImage2DBase(target, level, internalformat, pixels->width(), pixels->height(), 0, format, type, needConversion ? data.data() : pixels->data()->data(), ec);
+    texImage2DBase(target, level, internalformat, pixels->width(), pixels->height(), 0, format, type, needConversion ? data.data() : pixels->data()->data(), es);
     if (m_unpackAlignment != 1)
         m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
 }
 
 void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
-                                       GC3Denum format, GC3Denum type, HTMLImageElement* image, ExceptionCode& ec)
+    GC3Denum format, GC3Denum type, HTMLImageElement* image, ExceptionState& es)
 {
-    ec = 0;
-    if (isContextLost() || !validateHTMLImageElement("texImage2D", image, ec))
+    es.clearException();
+    if (isContextLost() || !validateHTMLImageElement("texImage2D", image, es))
         return;
     Image* imageForRender = image->cachedImage()->imageForRenderer(image->renderer());
     if (!imageForRender || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLImageElement, target, level, internalformat, imageForRender->width(), imageForRender->height(), 0, format, type, 0, 0))
         return;
 
-    texImage2DImpl(target, level, internalformat, format, type, imageForRender, GraphicsContext3D::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, ec);
+    texImage2DImpl(target, level, internalformat, format, type, imageForRender, GraphicsContext3D::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, es);
 }
 
 void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
-                                       GC3Denum format, GC3Denum type, HTMLCanvasElement* canvas, ExceptionCode& ec)
+    GC3Denum format, GC3Denum type, HTMLCanvasElement* canvas, ExceptionState& es)
 {
-    ec = 0;
-    if (isContextLost() || !validateHTMLCanvasElement("texImage2D", canvas, ec) || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLCanvasElement, target, level, internalformat, canvas->width(), canvas->height(), 0, format, type, 0, 0))
+    es.clearException();
+    if (isContextLost() || !validateHTMLCanvasElement("texImage2D", canvas, es) || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLCanvasElement, target, level, internalformat, canvas->width(), canvas->height(), 0, format, type, 0, 0))
         return;
 
     WebGLTexture* texture = validateTextureBinding("texImage2D", target, true);
@@ -3449,12 +3449,12 @@
 
     RefPtr<ImageData> imageData = canvas->getImageData();
     if (imageData)
-        texImage2D(target, level, internalformat, format, type, imageData.get(), ec);
+        texImage2D(target, level, internalformat, format, type, imageData.get(), es);
     else
-        texImage2DImpl(target, level, internalformat, format, type, canvas->copiedImage(), GraphicsContext3D::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, ec);
+        texImage2DImpl(target, level, internalformat, format, type, canvas->copiedImage(), GraphicsContext3D::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, es);
 }
 
-PassRefPtr<Image> WebGLRenderingContext::videoFrameToImage(HTMLVideoElement* video, BackingStoreCopy backingStoreCopy, ExceptionCode&)
+PassRefPtr<Image> WebGLRenderingContext::videoFrameToImage(HTMLVideoElement* video, BackingStoreCopy backingStoreCopy, ExceptionState&)
 {
     IntSize size(video->videoWidth(), video->videoHeight());
     ImageBuffer* buf = m_videoCache.imageBuffer(size);
@@ -3469,10 +3469,10 @@
 }
 
 void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
-                                       GC3Denum format, GC3Denum type, HTMLVideoElement* video, ExceptionCode& ec)
+    GC3Denum format, GC3Denum type, HTMLVideoElement* video, ExceptionState& es)
 {
-    ec = 0;
-    if (isContextLost() || !validateHTMLVideoElement("texImage2D", video, ec)
+    es.clearException();
+    if (isContextLost() || !validateHTMLVideoElement("texImage2D", video, es)
         || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLVideoElement, target, level, internalformat, video->videoWidth(), video->videoHeight(), 0, format, type, 0, 0))
         return;
 
@@ -3487,10 +3487,10 @@
     }
 
     // Normal pure SW path.
-    RefPtr<Image> image = videoFrameToImage(video, ImageBuffer::fastCopyImageMode(), ec);
+    RefPtr<Image> image = videoFrameToImage(video, ImageBuffer::fastCopyImageMode(), es);
     if (!image)
         return;
-    texImage2DImpl(target, level, internalformat, format, type, image.get(), GraphicsContext3D::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha, ec);
+    texImage2DImpl(target, level, internalformat, format, type, image.get(), GraphicsContext3D::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha, es);
 }
 
 void WebGLRenderingContext::texParameter(GC3Denum target, GC3Denum pname, GC3Dfloat paramf, GC3Dint parami, bool isFloat)
@@ -3541,10 +3541,10 @@
     texParameter(target, pname, 0, param, false);
 }
 
-void WebGLRenderingContext::texSubImage2DBase(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, const void* pixels, ExceptionCode& ec)
+void WebGLRenderingContext::texSubImage2DBase(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, const void* pixels, ExceptionState& es)
 {
     // FIXME: For now we ignore any errors returned
-    ec = 0;
+    es.clearException();
     ASSERT(!isContextLost());
     ASSERT(validateTexFuncParameters("texSubImage2D", TexSubImage2D, target, level, format, width, height, 0, format, type));
     ASSERT(validateSize("texSubImage2D", xoffset, yoffset));
@@ -3563,10 +3563,10 @@
     m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
 }
 
-void WebGLRenderingContext::texSubImage2DImpl(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Denum format, GC3Denum type, Image* image, GraphicsContext3D::ImageHtmlDomSource domSource, bool flipY, bool premultiplyAlpha, ExceptionCode& ec)
+void WebGLRenderingContext::texSubImage2DImpl(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Denum format, GC3Denum type, Image* image, GraphicsContext3D::ImageHtmlDomSource domSource, bool flipY, bool premultiplyAlpha, ExceptionState& es)
 {
     // All calling functions check isContextLost, so a duplicate check is not needed here.
-    ec = 0;
+    es.clearException();
     Vector<uint8_t> data;
     GraphicsContext3D::ImageExtractor imageExtractor(image, domSource, premultiplyAlpha, m_unpackColorspaceConversion == GraphicsContext3D::NONE);
     if (!imageExtractor.extractSucceeded()) {
@@ -3589,14 +3589,14 @@
 
     if (m_unpackAlignment != 1)
         m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1);
-    texSubImage2DBase(target, level, xoffset, yoffset, image->width(), image->height(), format, type,  needConversion ? data.data() : imagePixelData, ec);
+    texSubImage2DBase(target, level, xoffset, yoffset, image->width(), image->height(), format, type,  needConversion ? data.data() : imagePixelData, es);
     if (m_unpackAlignment != 1)
         m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
 }
 
 void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
-                                          GC3Dsizei width, GC3Dsizei height,
-                                          GC3Denum format, GC3Denum type, ArrayBufferView* pixels, ExceptionCode& ec)
+    GC3Dsizei width, GC3Dsizei height,
+    GC3Denum format, GC3Denum type, ArrayBufferView* pixels, ExceptionState& es)
 {
     if (isContextLost() || !validateTexFuncData("texSubImage2D", level, width, height, format, type, pixels, NullNotAllowed)
         || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceArrayBufferView, target, level, format, width, height, 0, format, type, xoffset, yoffset))
@@ -3616,15 +3616,15 @@
     }
     if (changeUnpackAlignment)
         m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1);
-    texSubImage2DBase(target, level, xoffset, yoffset, width, height, format, type, data, ec);
+    texSubImage2DBase(target, level, xoffset, yoffset, width, height, format, type, data, es);
     if (changeUnpackAlignment)
         m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
 }
 
 void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
-                                          GC3Denum format, GC3Denum type, ImageData* pixels, ExceptionCode& ec)
+    GC3Denum format, GC3Denum type, ImageData* pixels, ExceptionState& es)
 {
-    ec = 0;
+    es.clearException();
     if (isContextLost() || !pixels || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceImageData, target, level, format,  pixels->width(), pixels->height(), 0, format, type, xoffset, yoffset))
         return;
 
@@ -3642,56 +3642,56 @@
     }
     if (m_unpackAlignment != 1)
         m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1);
-    texSubImage2DBase(target, level, xoffset, yoffset, pixels->width(), pixels->height(), format, type, needConversion ? data.data() : pixels->data()->data(), ec);
+    texSubImage2DBase(target, level, xoffset, yoffset, pixels->width(), pixels->height(), format, type, needConversion ? data.data() : pixels->data()->data(), es);
     if (m_unpackAlignment != 1)
         m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
 }
 
 void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
-                                          GC3Denum format, GC3Denum type, HTMLImageElement* image, ExceptionCode& ec)
+    GC3Denum format, GC3Denum type, HTMLImageElement* image, ExceptionState& es)
 {
-    ec = 0;
-    if (isContextLost() || !validateHTMLImageElement("texSubImage2D", image, ec))
+    es.clearException();
+    if (isContextLost() || !validateHTMLImageElement("texSubImage2D", image, es))
         return;
     Image* imageForRender = image->cachedImage()->imageForRenderer(image->renderer());
     if (!imageForRender || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLImageElement, target, level, format, imageForRender->width(), imageForRender->height(), 0, format, type, xoffset, yoffset))
         return;
 
-    texSubImage2DImpl(target, level, xoffset, yoffset, format, type, imageForRender, GraphicsContext3D::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, ec);
+    texSubImage2DImpl(target, level, xoffset, yoffset, format, type, imageForRender, GraphicsContext3D::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, es);
 }
 
 void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
-                                          GC3Denum format, GC3Denum type, HTMLCanvasElement* canvas, ExceptionCode& ec)
+    GC3Denum format, GC3Denum type, HTMLCanvasElement* canvas, ExceptionState& es)
 {
-    ec = 0;
-    if (isContextLost() || !validateHTMLCanvasElement("texSubImage2D", canvas, ec)
+    es.clearException();
+    if (isContextLost() || !validateHTMLCanvasElement("texSubImage2D", canvas, es)
         || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLCanvasElement, target, level, format, canvas->width(), canvas->height(), 0, format, type, xoffset, yoffset))
         return;
 
     RefPtr<ImageData> imageData = canvas->getImageData();
     if (imageData)
-        texSubImage2D(target, level, xoffset, yoffset, format, type, imageData.get(), ec);
+        texSubImage2D(target, level, xoffset, yoffset, format, type, imageData.get(), es);
     else
-        texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas->copiedImage(), GraphicsContext3D::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, ec);
+        texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas->copiedImage(), GraphicsContext3D::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, es);
 }
 
 void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
-                                          GC3Denum format, GC3Denum type, HTMLVideoElement* video, ExceptionCode& ec)
+    GC3Denum format, GC3Denum type, HTMLVideoElement* video, ExceptionState& es)
 {
-    ec = 0;
-    if (isContextLost() || !validateHTMLVideoElement("texSubImage2D", video, ec)
+    es.clearException();
+    if (isContextLost() || !validateHTMLVideoElement("texSubImage2D", video, es)
         || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLVideoElement, target, level, format, video->videoWidth(), video->videoHeight(), 0, format, type, xoffset, yoffset))
         return;
 
-    RefPtr<Image> image = videoFrameToImage(video, ImageBuffer::fastCopyImageMode(), ec);
+    RefPtr<Image> image = videoFrameToImage(video, ImageBuffer::fastCopyImageMode(), es);
     if (!image)
         return;
-    texSubImage2DImpl(target, level, xoffset, yoffset, format, type, image.get(), GraphicsContext3D::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha, ec);
+    texSubImage2DImpl(target, level, xoffset, yoffset, format, type, image.get(), GraphicsContext3D::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha, es);
 }
 
-void WebGLRenderingContext::uniform1f(const WebGLUniformLocation* location, GC3Dfloat x, ExceptionCode& ec)
+void WebGLRenderingContext::uniform1f(const WebGLUniformLocation* location, GC3Dfloat x, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !location)
         return;
 
@@ -3703,27 +3703,27 @@
     m_context->uniform1f(location->location(), x);
 }
 
-void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode& ec)
+void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformParameters("uniform1fv", location, v, 1))
         return;
 
     m_context->uniform1fv(location->location(), v->length(), v->data());
 }
 
-void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size, ExceptionCode& ec)
+void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformParameters("uniform1fv", location, v, size, 1))
         return;
 
     m_context->uniform1fv(location->location(), size, v);
 }
 
-void WebGLRenderingContext::uniform1i(const WebGLUniformLocation* location, GC3Dint x, ExceptionCode& ec)
+void WebGLRenderingContext::uniform1i(const WebGLUniformLocation* location, GC3Dint x, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !location)
         return;
 
@@ -3735,27 +3735,27 @@
     m_context->uniform1i(location->location(), x);
 }
 
-void WebGLRenderingContext::uniform1iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode& ec)
+void WebGLRenderingContext::uniform1iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformParameters("uniform1iv", location, v, 1))
         return;
 
     m_context->uniform1iv(location->location(), v->length(), v->data());
 }
 
-void WebGLRenderingContext::uniform1iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size, ExceptionCode& ec)
+void WebGLRenderingContext::uniform1iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformParameters("uniform1iv", location, v, size, 1))
         return;
 
     m_context->uniform1iv(location->location(), size, v);
 }
 
-void WebGLRenderingContext::uniform2f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, ExceptionCode& ec)
+void WebGLRenderingContext::uniform2f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !location)
         return;
 
@@ -3767,27 +3767,27 @@
     m_context->uniform2f(location->location(), x, y);
 }
 
-void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode& ec)
+void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformParameters("uniform2fv", location, v, 2))
         return;
 
     m_context->uniform2fv(location->location(), v->length() / 2, v->data());
 }
 
-void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size, ExceptionCode& ec)
+void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformParameters("uniform2fv", location, v, size, 2))
         return;
 
     m_context->uniform2fv(location->location(), size / 2, v);
 }
 
-void WebGLRenderingContext::uniform2i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, ExceptionCode& ec)
+void WebGLRenderingContext::uniform2i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !location)
         return;
 
@@ -3799,27 +3799,27 @@
     m_context->uniform2i(location->location(), x, y);
 }
 
-void WebGLRenderingContext::uniform2iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode& ec)
+void WebGLRenderingContext::uniform2iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformParameters("uniform2iv", location, v, 2))
         return;
 
     m_context->uniform2iv(location->location(), v->length() / 2, v->data());
 }
 
-void WebGLRenderingContext::uniform2iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size, ExceptionCode& ec)
+void WebGLRenderingContext::uniform2iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformParameters("uniform2iv", location, v, size, 2))
         return;
 
     m_context->uniform2iv(location->location(), size / 2, v);
 }
 
-void WebGLRenderingContext::uniform3f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, ExceptionCode& ec)
+void WebGLRenderingContext::uniform3f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !location)
         return;
 
@@ -3831,27 +3831,27 @@
     m_context->uniform3f(location->location(), x, y, z);
 }
 
-void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode& ec)
+void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformParameters("uniform3fv", location, v, 3))
         return;
 
     m_context->uniform3fv(location->location(), v->length() / 3, v->data());
 }
 
-void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size, ExceptionCode& ec)
+void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformParameters("uniform3fv", location, v, size, 3))
         return;
 
     m_context->uniform3fv(location->location(), size / 3, v);
 }
 
-void WebGLRenderingContext::uniform3i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, GC3Dint z, ExceptionCode& ec)
+void WebGLRenderingContext::uniform3i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, GC3Dint z, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !location)
         return;
 
@@ -3863,27 +3863,27 @@
     m_context->uniform3i(location->location(), x, y, z);
 }
 
-void WebGLRenderingContext::uniform3iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode& ec)
+void WebGLRenderingContext::uniform3iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformParameters("uniform3iv", location, v, 3))
         return;
 
     m_context->uniform3iv(location->location(), v->length() / 3, v->data());
 }
 
-void WebGLRenderingContext::uniform3iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size, ExceptionCode& ec)
+void WebGLRenderingContext::uniform3iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformParameters("uniform3iv", location, v, size, 3))
         return;
 
     m_context->uniform3iv(location->location(), size / 3, v);
 }
 
-void WebGLRenderingContext::uniform4f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, GC3Dfloat w, ExceptionCode& ec)
+void WebGLRenderingContext::uniform4f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, GC3Dfloat w, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !location)
         return;
 
@@ -3895,27 +3895,27 @@
     m_context->uniform4f(location->location(), x, y, z, w);
 }
 
-void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode& ec)
+void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformParameters("uniform4fv", location, v, 4))
         return;
 
     m_context->uniform4fv(location->location(), v->length() / 4, v->data());
 }
 
-void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size, ExceptionCode& ec)
+void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformParameters("uniform4fv", location, v, size, 4))
         return;
 
     m_context->uniform4fv(location->location(), size / 4, v);
 }
 
-void WebGLRenderingContext::uniform4i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, GC3Dint z, GC3Dint w, ExceptionCode& ec)
+void WebGLRenderingContext::uniform4i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, GC3Dint z, GC3Dint w, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !location)
         return;
 
@@ -3927,75 +3927,75 @@
     m_context->uniform4i(location->location(), x, y, z, w);
 }
 
-void WebGLRenderingContext::uniform4iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode& ec)
+void WebGLRenderingContext::uniform4iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformParameters("uniform4iv", location, v, 4))
         return;
 
     m_context->uniform4iv(location->location(), v->length() / 4, v->data());
 }
 
-void WebGLRenderingContext::uniform4iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size, ExceptionCode& ec)
+void WebGLRenderingContext::uniform4iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformParameters("uniform4iv", location, v, size, 4))
         return;
 
     m_context->uniform4iv(location->location(), size / 4, v);
 }
 
-void WebGLRenderingContext::uniformMatrix2fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* v, ExceptionCode& ec)
+void WebGLRenderingContext::uniformMatrix2fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* v, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, v, 4))
         return;
     m_context->uniformMatrix2fv(location->location(), v->length() / 4, transpose, v->data());
 }
 
-void WebGLRenderingContext::uniformMatrix2fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* v, GC3Dsizei size, ExceptionCode& ec)
+void WebGLRenderingContext::uniformMatrix2fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* v, GC3Dsizei size, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, v, size, 4))
         return;
     m_context->uniformMatrix2fv(location->location(), size / 4, transpose, v);
 }
 
-void WebGLRenderingContext::uniformMatrix3fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* v, ExceptionCode& ec)
+void WebGLRenderingContext::uniformMatrix3fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* v, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, v, 9))
         return;
     m_context->uniformMatrix3fv(location->location(), v->length() / 9, transpose, v->data());
 }
 
-void WebGLRenderingContext::uniformMatrix3fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* v, GC3Dsizei size, ExceptionCode& ec)
+void WebGLRenderingContext::uniformMatrix3fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* v, GC3Dsizei size, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, v, size, 9))
         return;
     m_context->uniformMatrix3fv(location->location(), size / 9, transpose, v);
 }
 
-void WebGLRenderingContext::uniformMatrix4fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* v, ExceptionCode& ec)
+void WebGLRenderingContext::uniformMatrix4fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* v, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, v, 16))
         return;
     m_context->uniformMatrix4fv(location->location(), v->length() / 16, transpose, v->data());
 }
 
-void WebGLRenderingContext::uniformMatrix4fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* v, GC3Dsizei size, ExceptionCode& ec)
+void WebGLRenderingContext::uniformMatrix4fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* v, GC3Dsizei size, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, v, size, 16))
         return;
     m_context->uniformMatrix4fv(location->location(), size / 16, transpose, v);
 }
 
-void WebGLRenderingContext::useProgram(WebGLProgram* program, ExceptionCode& ec)
+void WebGLRenderingContext::useProgram(WebGLProgram* program, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     bool deleted;
     if (!checkObjectToBeBound("useProgram", program, deleted))
         return;
@@ -4015,9 +4015,9 @@
     }
 }
 
-void WebGLRenderingContext::validateProgram(WebGLProgram* program, ExceptionCode& ec)
+void WebGLRenderingContext::validateProgram(WebGLProgram* program, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost() || !validateWebGLObject("validateProgram", program))
         return;
     m_context->validateProgram(objectOrZero(program));
@@ -4083,9 +4083,9 @@
     vertexAttribfvImpl("vertexAttrib4fv", index, v, size, 4);
 }
 
-void WebGLRenderingContext::vertexAttribPointer(GC3Duint index, GC3Dint size, GC3Denum type, GC3Dboolean normalized, GC3Dsizei stride, long long offset, ExceptionCode& ec)
+void WebGLRenderingContext::vertexAttribPointer(GC3Duint index, GC3Dint size, GC3Denum type, GC3Dboolean normalized, GC3Dsizei stride, long long offset, ExceptionState& es)
 {
-    UNUSED_PARAM(ec);
+    UNUSED_PARAM(es);
     if (isContextLost())
         return;
     switch (type) {
@@ -5149,7 +5149,7 @@
     return 0;
 }
 
-bool WebGLRenderingContext::validateHTMLImageElement(const char* functionName, HTMLImageElement* image, ExceptionCode& ec)
+bool WebGLRenderingContext::validateHTMLImageElement(const char* functionName, HTMLImageElement* image, ExceptionState& es)
 {
     if (!image || !image->cachedImage()) {
         synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no image");
@@ -5161,33 +5161,33 @@
         return false;
     }
     if (wouldTaintOrigin(image)) {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return false;
     }
     return true;
 }
 
-bool WebGLRenderingContext::validateHTMLCanvasElement(const char* functionName, HTMLCanvasElement* canvas, ExceptionCode& ec)
+bool WebGLRenderingContext::validateHTMLCanvasElement(const char* functionName, HTMLCanvasElement* canvas, ExceptionState& es)
 {
     if (!canvas || !canvas->buffer()) {
         synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no canvas");
         return false;
     }
     if (wouldTaintOrigin(canvas)) {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return false;
     }
     return true;
 }
 
-bool WebGLRenderingContext::validateHTMLVideoElement(const char* functionName, HTMLVideoElement* video, ExceptionCode& ec)
+bool WebGLRenderingContext::validateHTMLVideoElement(const char* functionName, HTMLVideoElement* video, ExceptionState& es)
 {
     if (!video || !video->videoWidth() || !video->videoHeight()) {
         synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no video");
         return false;
     }
     if (wouldTaintOrigin(video)) {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return false;
     }
     return true;
@@ -5594,14 +5594,12 @@
 
 void WebGLRenderingContext::restoreCurrentFramebuffer()
 {
-    ExceptionCode ec;
-    bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_framebufferBinding.get(), ec);
+    bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_framebufferBinding.get(), IGNORE_EXCEPTION_STATE);
 }
 
 void WebGLRenderingContext::restoreCurrentTexture2D()
 {
-    ExceptionCode ec;
-    bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureUnits[m_activeTextureUnit].m_texture2DBinding.get(), ec);
+    bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureUnits[m_activeTextureUnit].m_texture2DBinding.get(), IGNORE_EXCEPTION_STATE);
 }
 
 void WebGLRenderingContext::multisamplingChanged(bool enabled)
diff --git a/Source/core/html/canvas/WebGLRenderingContext.h b/Source/core/html/canvas/WebGLRenderingContext.h
index d758090..2b3f7fb 100644
--- a/Source/core/html/canvas/WebGLRenderingContext.h
+++ b/Source/core/html/canvas/WebGLRenderingContext.h
@@ -45,32 +45,33 @@
 
 class ANGLEInstancedArrays;
 class DrawingBuffer;
-class WebGLDrawBuffers;
 class EXTFragDepth;
 class EXTTextureFilterAnisotropic;
+class ExceptionState;
 class HTMLImageElement;
 class HTMLVideoElement;
 class ImageBuffer;
 class ImageData;
 class IntSize;
+class OESElementIndexUint;
 class OESStandardDerivatives;
 class OESTextureFloat;
-class OESTextureHalfFloat;
 class OESTextureFloatLinear;
+class OESTextureHalfFloat;
 class OESTextureHalfFloatLinear;
 class OESVertexArrayObject;
-class OESElementIndexUint;
 class WebGLActiveInfo;
 class WebGLBuffer;
-class WebGLContextGroup;
-class WebGLContextObject;
 class WebGLCompressedTextureATC;
 class WebGLCompressedTexturePVRTC;
 class WebGLCompressedTextureS3TC;
 class WebGLContextAttributes;
+class WebGLContextGroup;
+class WebGLContextObject;
 class WebGLDebugRendererInfo;
 class WebGLDebugShaders;
 class WebGLDepthTexture;
+class WebGLDrawBuffers;
 class WebGLExtension;
 class WebGLFramebuffer;
 class WebGLLoseContext;
@@ -78,14 +79,12 @@
 class WebGLProgram;
 class WebGLRenderbuffer;
 class WebGLShader;
-class WebGLSharedObject;
 class WebGLShaderPrecisionFormat;
+class WebGLSharedObject;
 class WebGLTexture;
 class WebGLUniformLocation;
 class WebGLVertexArrayObjectOES;
 
-typedef int ExceptionCode;
-
 class WebGLRenderingContext : public CanvasRenderingContext, public ActiveDOMObject, private Page::MultisamplingChangedObserver {
 public:
     static PassOwnPtr<WebGLRenderingContext> create(HTMLCanvasElement*, WebGLContextAttributes*);
@@ -97,24 +96,24 @@
     int drawingBufferWidth() const;
     int drawingBufferHeight() const;
 
-    void activeTexture(GC3Denum texture, ExceptionCode&);
-    void attachShader(WebGLProgram*, WebGLShader*, ExceptionCode&);
-    void bindAttribLocation(WebGLProgram*, GC3Duint index, const String& name, ExceptionCode&);
-    void bindBuffer(GC3Denum target, WebGLBuffer*, ExceptionCode&);
-    void bindFramebuffer(GC3Denum target, WebGLFramebuffer*, ExceptionCode&);
-    void bindRenderbuffer(GC3Denum target, WebGLRenderbuffer*, ExceptionCode&);
-    void bindTexture(GC3Denum target, WebGLTexture*, ExceptionCode&);
+    void activeTexture(GC3Denum texture, ExceptionState&);
+    void attachShader(WebGLProgram*, WebGLShader*, ExceptionState&);
+    void bindAttribLocation(WebGLProgram*, GC3Duint index, const String& name, ExceptionState&);
+    void bindBuffer(GC3Denum target, WebGLBuffer*, ExceptionState&);
+    void bindFramebuffer(GC3Denum target, WebGLFramebuffer*, ExceptionState&);
+    void bindRenderbuffer(GC3Denum target, WebGLRenderbuffer*, ExceptionState&);
+    void bindTexture(GC3Denum target, WebGLTexture*, ExceptionState&);
     void blendColor(GC3Dfloat red, GC3Dfloat green, GC3Dfloat blue, GC3Dfloat alpha);
     void blendEquation(GC3Denum mode);
     void blendEquationSeparate(GC3Denum modeRGB, GC3Denum modeAlpha);
     void blendFunc(GC3Denum sfactor, GC3Denum dfactor);
     void blendFuncSeparate(GC3Denum srcRGB, GC3Denum dstRGB, GC3Denum srcAlpha, GC3Denum dstAlpha);
 
-    void bufferData(GC3Denum target, long long size, GC3Denum usage, ExceptionCode&);
-    void bufferData(GC3Denum target, ArrayBuffer* data, GC3Denum usage, ExceptionCode&);
-    void bufferData(GC3Denum target, ArrayBufferView* data, GC3Denum usage, ExceptionCode&);
-    void bufferSubData(GC3Denum target, long long offset, ArrayBuffer* data, ExceptionCode&);
-    void bufferSubData(GC3Denum target, long long offset, ArrayBufferView* data, ExceptionCode&);
+    void bufferData(GC3Denum target, long long size, GC3Denum usage, ExceptionState&);
+    void bufferData(GC3Denum target, ArrayBuffer* data, GC3Denum usage, ExceptionState&);
+    void bufferData(GC3Denum target, ArrayBufferView* data, GC3Denum usage, ExceptionState&);
+    void bufferSubData(GC3Denum target, long long offset, ArrayBuffer* data, ExceptionState&);
+    void bufferSubData(GC3Denum target, long long offset, ArrayBufferView* data, ExceptionState&);
 
     GC3Denum checkFramebufferStatus(GC3Denum target);
     void clear(GC3Dbitfield mask);
@@ -122,7 +121,7 @@
     void clearDepth(GC3Dfloat);
     void clearStencil(GC3Dint);
     void colorMask(GC3Dboolean red, GC3Dboolean green, GC3Dboolean blue, GC3Dboolean alpha);
-    void compileShader(WebGLShader*, ExceptionCode&);
+    void compileShader(WebGLShader*, ExceptionState&);
 
     void compressedTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width,
                               GC3Dsizei height, GC3Dint border, ArrayBufferView* data);
@@ -136,7 +135,7 @@
     PassRefPtr<WebGLFramebuffer> createFramebuffer();
     PassRefPtr<WebGLProgram> createProgram();
     PassRefPtr<WebGLRenderbuffer> createRenderbuffer();
-    PassRefPtr<WebGLShader> createShader(GC3Denum type, ExceptionCode&);
+    PassRefPtr<WebGLShader> createShader(GC3Denum type, ExceptionState&);
     PassRefPtr<WebGLTexture> createTexture();
 
     void cullFace(GC3Denum mode);
@@ -151,46 +150,46 @@
     void depthFunc(GC3Denum);
     void depthMask(GC3Dboolean);
     void depthRange(GC3Dfloat zNear, GC3Dfloat zFar);
-    void detachShader(WebGLProgram*, WebGLShader*, ExceptionCode&);
+    void detachShader(WebGLProgram*, WebGLShader*, ExceptionState&);
     void disable(GC3Denum cap);
-    void disableVertexAttribArray(GC3Duint index, ExceptionCode&);
-    void drawArrays(GC3Denum mode, GC3Dint first, GC3Dsizei count, ExceptionCode&);
-    void drawElements(GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, ExceptionCode&);
+    void disableVertexAttribArray(GC3Duint index, ExceptionState&);
+    void drawArrays(GC3Denum mode, GC3Dint first, GC3Dsizei count, ExceptionState&);
+    void drawElements(GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, ExceptionState&);
 
     void drawArraysInstancedANGLE(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount);
     void drawElementsInstancedANGLE(GC3Denum mode, GC3Dsizei count, GC3Denum type, GC3Dintptr offset, GC3Dsizei primcount);
 
     void enable(GC3Denum cap);
-    void enableVertexAttribArray(GC3Duint index, ExceptionCode&);
+    void enableVertexAttribArray(GC3Duint index, ExceptionState&);
     void finish();
     void flush();
-    void framebufferRenderbuffer(GC3Denum target, GC3Denum attachment, GC3Denum renderbuffertarget, WebGLRenderbuffer*, ExceptionCode&);
-    void framebufferTexture2D(GC3Denum target, GC3Denum attachment, GC3Denum textarget, WebGLTexture*, GC3Dint level, ExceptionCode&);
+    void framebufferRenderbuffer(GC3Denum target, GC3Denum attachment, GC3Denum renderbuffertarget, WebGLRenderbuffer*, ExceptionState&);
+    void framebufferTexture2D(GC3Denum target, GC3Denum attachment, GC3Denum textarget, WebGLTexture*, GC3Dint level, ExceptionState&);
     void frontFace(GC3Denum mode);
     void generateMipmap(GC3Denum target);
 
-    PassRefPtr<WebGLActiveInfo> getActiveAttrib(WebGLProgram*, GC3Duint index, ExceptionCode&);
-    PassRefPtr<WebGLActiveInfo> getActiveUniform(WebGLProgram*, GC3Duint index, ExceptionCode&);
-    bool getAttachedShaders(WebGLProgram*, Vector<RefPtr<WebGLShader> >&, ExceptionCode&);
+    PassRefPtr<WebGLActiveInfo> getActiveAttrib(WebGLProgram*, GC3Duint index, ExceptionState&);
+    PassRefPtr<WebGLActiveInfo> getActiveUniform(WebGLProgram*, GC3Duint index, ExceptionState&);
+    bool getAttachedShaders(WebGLProgram*, Vector<RefPtr<WebGLShader> >&, ExceptionState&);
     GC3Dint getAttribLocation(WebGLProgram*, const String& name);
-    WebGLGetInfo getBufferParameter(GC3Denum target, GC3Denum pname, ExceptionCode&);
+    WebGLGetInfo getBufferParameter(GC3Denum target, GC3Denum pname, ExceptionState&);
     PassRefPtr<WebGLContextAttributes> getContextAttributes();
     GC3Denum getError();
     PassRefPtr<WebGLExtension> getExtension(const String& name);
-    WebGLGetInfo getFramebufferAttachmentParameter(GC3Denum target, GC3Denum attachment, GC3Denum pname, ExceptionCode&);
-    WebGLGetInfo getParameter(GC3Denum pname, ExceptionCode&);
-    WebGLGetInfo getProgramParameter(WebGLProgram*, GC3Denum pname, ExceptionCode&);
-    String getProgramInfoLog(WebGLProgram*, ExceptionCode&);
-    WebGLGetInfo getRenderbufferParameter(GC3Denum target, GC3Denum pname, ExceptionCode&);
-    WebGLGetInfo getShaderParameter(WebGLShader*, GC3Denum pname, ExceptionCode&);
-    String getShaderInfoLog(WebGLShader*, ExceptionCode&);
-    PassRefPtr<WebGLShaderPrecisionFormat> getShaderPrecisionFormat(GC3Denum shaderType, GC3Denum precisionType, ExceptionCode&);
-    String getShaderSource(WebGLShader*, ExceptionCode&);
+    WebGLGetInfo getFramebufferAttachmentParameter(GC3Denum target, GC3Denum attachment, GC3Denum pname, ExceptionState&);
+    WebGLGetInfo getParameter(GC3Denum pname, ExceptionState&);
+    WebGLGetInfo getProgramParameter(WebGLProgram*, GC3Denum pname, ExceptionState&);
+    String getProgramInfoLog(WebGLProgram*, ExceptionState&);
+    WebGLGetInfo getRenderbufferParameter(GC3Denum target, GC3Denum pname, ExceptionState&);
+    WebGLGetInfo getShaderParameter(WebGLShader*, GC3Denum pname, ExceptionState&);
+    String getShaderInfoLog(WebGLShader*, ExceptionState&);
+    PassRefPtr<WebGLShaderPrecisionFormat> getShaderPrecisionFormat(GC3Denum shaderType, GC3Denum precisionType, ExceptionState&);
+    String getShaderSource(WebGLShader*, ExceptionState&);
     Vector<String> getSupportedExtensions();
-    WebGLGetInfo getTexParameter(GC3Denum target, GC3Denum pname, ExceptionCode&);
-    WebGLGetInfo getUniform(WebGLProgram*, const WebGLUniformLocation*, ExceptionCode&);
-    PassRefPtr<WebGLUniformLocation> getUniformLocation(WebGLProgram*, const String&, ExceptionCode&);
-    WebGLGetInfo getVertexAttrib(GC3Duint index, GC3Denum pname, ExceptionCode&);
+    WebGLGetInfo getTexParameter(GC3Denum target, GC3Denum pname, ExceptionState&);
+    WebGLGetInfo getUniform(WebGLProgram*, const WebGLUniformLocation*, ExceptionState&);
+    PassRefPtr<WebGLUniformLocation> getUniformLocation(WebGLProgram*, const String&, ExceptionState&);
+    WebGLGetInfo getVertexAttrib(GC3Duint index, GC3Denum pname, ExceptionState&);
     long long getVertexAttribOffset(GC3Duint index, GC3Denum pname);
 
     void hint(GC3Denum target, GC3Denum mode);
@@ -204,14 +203,14 @@
     GC3Dboolean isTexture(WebGLTexture*);
 
     void lineWidth(GC3Dfloat);
-    void linkProgram(WebGLProgram*, ExceptionCode&);
+    void linkProgram(WebGLProgram*, ExceptionState&);
     void pixelStorei(GC3Denum pname, GC3Dint param);
     void polygonOffset(GC3Dfloat factor, GC3Dfloat units);
-    void readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, ArrayBufferView* pixels, ExceptionCode&);
+    void readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, ArrayBufferView* pixels, ExceptionState&);
     void renderbufferStorage(GC3Denum target, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height);
     void sampleCoverage(GC3Dfloat value, GC3Dboolean invert);
     void scissor(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height);
-    void shaderSource(WebGLShader*, const String&, ExceptionCode&);
+    void shaderSource(WebGLShader*, const String&, ExceptionState&);
     void stencilFunc(GC3Denum func, GC3Dint ref, GC3Duint mask);
     void stencilFuncSeparate(GC3Denum face, GC3Denum func, GC3Dint ref, GC3Duint mask);
     void stencilMask(GC3Duint);
@@ -220,80 +219,80 @@
     void stencilOpSeparate(GC3Denum face, GC3Denum fail, GC3Denum zfail, GC3Denum zpass);
 
     void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
-                    GC3Dsizei width, GC3Dsizei height, GC3Dint border,
-                    GC3Denum format, GC3Denum type, ArrayBufferView*, ExceptionCode&);
+        GC3Dsizei width, GC3Dsizei height, GC3Dint border,
+        GC3Denum format, GC3Denum type, ArrayBufferView*, ExceptionState&);
     void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
-                    GC3Denum format, GC3Denum type, ImageData*, ExceptionCode&);
+        GC3Denum format, GC3Denum type, ImageData*, ExceptionState&);
     void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
-                    GC3Denum format, GC3Denum type, HTMLImageElement*, ExceptionCode&);
+        GC3Denum format, GC3Denum type, HTMLImageElement*, ExceptionState&);
     void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
-                    GC3Denum format, GC3Denum type, HTMLCanvasElement*, ExceptionCode&);
+        GC3Denum format, GC3Denum type, HTMLCanvasElement*, ExceptionState&);
     void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
-                    GC3Denum format, GC3Denum type, HTMLVideoElement*, ExceptionCode&);
+        GC3Denum format, GC3Denum type, HTMLVideoElement*, ExceptionState&);
 
     void texParameterf(GC3Denum target, GC3Denum pname, GC3Dfloat param);
     void texParameteri(GC3Denum target, GC3Denum pname, GC3Dint param);
 
     void texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
-                       GC3Dsizei width, GC3Dsizei height,
-                       GC3Denum format, GC3Denum type, ArrayBufferView*, ExceptionCode&);
+        GC3Dsizei width, GC3Dsizei height,
+        GC3Denum format, GC3Denum type, ArrayBufferView*, ExceptionState&);
     void texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
-                       GC3Denum format, GC3Denum type, ImageData*, ExceptionCode&);
+        GC3Denum format, GC3Denum type, ImageData*, ExceptionState&);
     void texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
-                       GC3Denum format, GC3Denum type, HTMLImageElement*, ExceptionCode&);
+        GC3Denum format, GC3Denum type, HTMLImageElement*, ExceptionState&);
     void texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
-                       GC3Denum format, GC3Denum type, HTMLCanvasElement*, ExceptionCode&);
+        GC3Denum format, GC3Denum type, HTMLCanvasElement*, ExceptionState&);
     void texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
-                       GC3Denum format, GC3Denum type, HTMLVideoElement*, ExceptionCode&);
+        GC3Denum format, GC3Denum type, HTMLVideoElement*, ExceptionState&);
 
-    void uniform1f(const WebGLUniformLocation* location, GC3Dfloat x, ExceptionCode&);
-    void uniform1fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode&);
-    void uniform1fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size, ExceptionCode&);
-    void uniform1i(const WebGLUniformLocation* location, GC3Dint x, ExceptionCode&);
-    void uniform1iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode&);
-    void uniform1iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size, ExceptionCode&);
-    void uniform2f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, ExceptionCode&);
-    void uniform2fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode&);
-    void uniform2fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size, ExceptionCode&);
-    void uniform2i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, ExceptionCode&);
-    void uniform2iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode&);
-    void uniform2iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size, ExceptionCode&);
-    void uniform3f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, ExceptionCode&);
-    void uniform3fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode&);
-    void uniform3fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size, ExceptionCode&);
-    void uniform3i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, GC3Dint z, ExceptionCode&);
-    void uniform3iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode&);
-    void uniform3iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size, ExceptionCode&);
-    void uniform4f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, GC3Dfloat w, ExceptionCode&);
-    void uniform4fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode&);
-    void uniform4fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size, ExceptionCode&);
-    void uniform4i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, GC3Dint z, GC3Dint w, ExceptionCode&);
-    void uniform4iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode&);
-    void uniform4iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size, ExceptionCode&);
-    void uniformMatrix2fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* value, ExceptionCode&);
-    void uniformMatrix2fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* value, GC3Dsizei size, ExceptionCode&);
-    void uniformMatrix3fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* value, ExceptionCode&);
-    void uniformMatrix3fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* value, GC3Dsizei size, ExceptionCode&);
-    void uniformMatrix4fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* value, ExceptionCode&);
-    void uniformMatrix4fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* value, GC3Dsizei size, ExceptionCode&);
+    void uniform1f(const WebGLUniformLocation*, GC3Dfloat x, ExceptionState&);
+    void uniform1fv(const WebGLUniformLocation*, Float32Array* v, ExceptionState&);
+    void uniform1fv(const WebGLUniformLocation*, GC3Dfloat* v, GC3Dsizei, ExceptionState&);
+    void uniform1i(const WebGLUniformLocation*, GC3Dint x, ExceptionState&);
+    void uniform1iv(const WebGLUniformLocation*, Int32Array* v, ExceptionState&);
+    void uniform1iv(const WebGLUniformLocation*, GC3Dint* v, GC3Dsizei, ExceptionState&);
+    void uniform2f(const WebGLUniformLocation*, GC3Dfloat x, GC3Dfloat y, ExceptionState&);
+    void uniform2fv(const WebGLUniformLocation*, Float32Array* v, ExceptionState&);
+    void uniform2fv(const WebGLUniformLocation*, GC3Dfloat* v, GC3Dsizei, ExceptionState&);
+    void uniform2i(const WebGLUniformLocation*, GC3Dint x, GC3Dint y, ExceptionState&);
+    void uniform2iv(const WebGLUniformLocation*, Int32Array* v, ExceptionState&);
+    void uniform2iv(const WebGLUniformLocation*, GC3Dint* v, GC3Dsizei, ExceptionState&);
+    void uniform3f(const WebGLUniformLocation*, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, ExceptionState&);
+    void uniform3fv(const WebGLUniformLocation*, Float32Array* v, ExceptionState&);
+    void uniform3fv(const WebGLUniformLocation*, GC3Dfloat* v, GC3Dsizei, ExceptionState&);
+    void uniform3i(const WebGLUniformLocation*, GC3Dint x, GC3Dint y, GC3Dint z, ExceptionState&);
+    void uniform3iv(const WebGLUniformLocation*, Int32Array* v, ExceptionState&);
+    void uniform3iv(const WebGLUniformLocation*, GC3Dint* v, GC3Dsizei, ExceptionState&);
+    void uniform4f(const WebGLUniformLocation*, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, GC3Dfloat w, ExceptionState&);
+    void uniform4fv(const WebGLUniformLocation*, Float32Array* v, ExceptionState&);
+    void uniform4fv(const WebGLUniformLocation*, GC3Dfloat* v, GC3Dsizei, ExceptionState&);
+    void uniform4i(const WebGLUniformLocation*, GC3Dint x, GC3Dint y, GC3Dint z, GC3Dint w, ExceptionState&);
+    void uniform4iv(const WebGLUniformLocation*, Int32Array* v, ExceptionState&);
+    void uniform4iv(const WebGLUniformLocation*, GC3Dint* v, GC3Dsizei, ExceptionState&);
+    void uniformMatrix2fv(const WebGLUniformLocation*, GC3Dboolean transpose, Float32Array* value, ExceptionState&);
+    void uniformMatrix2fv(const WebGLUniformLocation*, GC3Dboolean transpose, GC3Dfloat* value, GC3Dsizei, ExceptionState&);
+    void uniformMatrix3fv(const WebGLUniformLocation*, GC3Dboolean transpose, Float32Array* value, ExceptionState&);
+    void uniformMatrix3fv(const WebGLUniformLocation*, GC3Dboolean transpose, GC3Dfloat* value, GC3Dsizei, ExceptionState&);
+    void uniformMatrix4fv(const WebGLUniformLocation*, GC3Dboolean transpose, Float32Array* value, ExceptionState&);
+    void uniformMatrix4fv(const WebGLUniformLocation*, GC3Dboolean transpose, GC3Dfloat* value, GC3Dsizei, ExceptionState&);
 
-    void useProgram(WebGLProgram*, ExceptionCode&);
-    void validateProgram(WebGLProgram*, ExceptionCode&);
+    void useProgram(WebGLProgram*, ExceptionState&);
+    void validateProgram(WebGLProgram*, ExceptionState&);
 
     void vertexAttrib1f(GC3Duint index, GC3Dfloat x);
     void vertexAttrib1fv(GC3Duint index, Float32Array* values);
-    void vertexAttrib1fv(GC3Duint index, GC3Dfloat* values, GC3Dsizei size);
+    void vertexAttrib1fv(GC3Duint index, GC3Dfloat* values, GC3Dsizei);
     void vertexAttrib2f(GC3Duint index, GC3Dfloat x, GC3Dfloat y);
     void vertexAttrib2fv(GC3Duint index, Float32Array* values);
-    void vertexAttrib2fv(GC3Duint index, GC3Dfloat* values, GC3Dsizei size);
+    void vertexAttrib2fv(GC3Duint index, GC3Dfloat* values, GC3Dsizei);
     void vertexAttrib3f(GC3Duint index, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z);
     void vertexAttrib3fv(GC3Duint index, Float32Array* values);
-    void vertexAttrib3fv(GC3Duint index, GC3Dfloat* values, GC3Dsizei size);
+    void vertexAttrib3fv(GC3Duint index, GC3Dfloat* values, GC3Dsizei);
     void vertexAttrib4f(GC3Duint index, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, GC3Dfloat w);
     void vertexAttrib4fv(GC3Duint index, Float32Array* values);
-    void vertexAttrib4fv(GC3Duint index, GC3Dfloat* values, GC3Dsizei size);
+    void vertexAttrib4fv(GC3Duint index, GC3Dfloat* values, GC3Dsizei);
     void vertexAttribPointer(GC3Duint index, GC3Dint size, GC3Denum type, GC3Dboolean normalized,
-                             GC3Dsizei stride, long long offset, ExceptionCode&);
+        GC3Dsizei stride, long long offset, ExceptionState&);
 
     void vertexAttribDivisorANGLE(GC3Duint index, GC3Duint divisor);
 
@@ -374,7 +373,7 @@
     void addCompressedTextureFormat(GC3Denum);
     void removeAllCompressedTextureFormats();
 
-    PassRefPtr<Image> videoFrameToImage(HTMLVideoElement*, BackingStoreCopy, ExceptionCode&);
+    PassRefPtr<Image> videoFrameToImage(HTMLVideoElement*, BackingStoreCopy, ExceptionState&);
 
     WebGLRenderbuffer* ensureEmulatedStencilBuffer(GC3Denum target, WebGLRenderbuffer*);
 
@@ -646,10 +645,10 @@
     // Helper to restore state that clearing the framebuffer may destroy.
     void restoreStateAfterClear();
 
-    void texImage2DBase(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, const void* pixels, ExceptionCode&);
-    void texImage2DImpl(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Denum format, GC3Denum type, Image*, GraphicsContext3D::ImageHtmlDomSource, bool flipY, bool premultiplyAlpha, ExceptionCode&);
-    void texSubImage2DBase(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, const void* pixels, ExceptionCode&);
-    void texSubImage2DImpl(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Denum format, GC3Denum type, Image*, GraphicsContext3D::ImageHtmlDomSource, bool flipY, bool premultiplyAlpha, ExceptionCode&);
+    void texImage2DBase(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, const void* pixels, ExceptionState&);
+    void texImage2DImpl(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Denum format, GC3Denum type, Image*, GraphicsContext3D::ImageHtmlDomSource, bool flipY, bool premultiplyAlpha, ExceptionState&);
+    void texSubImage2DBase(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, const void* pixels, ExceptionState&);
+    void texSubImage2DImpl(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Denum format, GC3Denum type, Image*, GraphicsContext3D::ImageHtmlDomSource, bool flipY, bool premultiplyAlpha, ExceptionState&);
 
     void handleTextureCompleteness(const char*, bool);
     void createFallbackBlackTextures1x1();
@@ -802,13 +801,13 @@
     WebGLBuffer* validateBufferDataParameters(const char* functionName, GC3Denum target, GC3Denum usage);
 
     // Helper function for tex{Sub}Image2D to make sure image is ready and wouldn't taint Origin.
-    bool validateHTMLImageElement(const char* functionName, HTMLImageElement*, ExceptionCode&);
+    bool validateHTMLImageElement(const char* functionName, HTMLImageElement*, ExceptionState&);
 
     // Helper function for tex{Sub}Image2D to make sure canvas is ready and wouldn't taint Origin.
-    bool validateHTMLCanvasElement(const char* functionName, HTMLCanvasElement*, ExceptionCode&);
+    bool validateHTMLCanvasElement(const char* functionName, HTMLCanvasElement*, ExceptionState&);
 
     // Helper function for tex{Sub}Image2D to make sure video is ready wouldn't taint Origin.
-    bool validateHTMLVideoElement(const char* functionName, HTMLVideoElement*, ExceptionCode&);
+    bool validateHTMLVideoElement(const char* functionName, HTMLVideoElement*, ExceptionState&);
 
     // Helper function to validate drawArrays(Instanced) calls
     bool validateDrawArrays(const char* functionName, GC3Denum mode, GC3Dint first, GC3Dsizei count);
diff --git a/Source/core/html/parser/HTMLTreeBuilder.cpp b/Source/core/html/parser/HTMLTreeBuilder.cpp
index 12a9b74..4afa8b0 100644
--- a/Source/core/html/parser/HTMLTreeBuilder.cpp
+++ b/Source/core/html/parser/HTMLTreeBuilder.cpp
@@ -33,6 +33,7 @@
 #include "XLinkNames.h"
 #include "XMLNSNames.h"
 #include "XMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/DocumentFragment.h"
 #include "core/html/HTMLFormElement.h"
 #include "core/html/HTMLHtmlElement.h"
@@ -672,7 +673,7 @@
         }
         if (!m_framesetOk)
             return;
-        m_tree.openElements()->bodyElement()->remove(ASSERT_NO_EXCEPTION);
+        m_tree.openElements()->bodyElement()->remove(ASSERT_NO_EXCEPTION_STATE);
         m_tree.openElements()->popUntil(m_tree.openElements()->bodyElement());
         m_tree.openElements()->popHTMLBodyElement();
         ASSERT(m_tree.openElements()->top() == m_tree.openElements()->htmlElement());
diff --git a/Source/core/html/shadow/DateTimeEditElement.cpp b/Source/core/html/shadow/DateTimeEditElement.cpp
index 1583b8e..febdacc 100644
--- a/Source/core/html/shadow/DateTimeEditElement.cpp
+++ b/Source/core/html/shadow/DateTimeEditElement.cpp
@@ -28,6 +28,7 @@
 #include "core/html/shadow/DateTimeEditElement.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/MouseEvent.h"
 #include "core/dom/Text.h"
 #include "core/html/DateTimeFieldsState.h"
@@ -409,7 +410,7 @@
             element->appendChild(Text::create(m_editElement.document(), String(&rightToLeftMark, 1)));
     }
     element->appendChild(Text::create(m_editElement.document(), text));
-    m_editElement.fieldsWrapperElement()->appendChild(element, ASSERT_NO_EXCEPTION, AttachLazily);
+    m_editElement.fieldsWrapperElement()->appendChild(element, ASSERT_NO_EXCEPTION_STATE, AttachLazily);
 }
 
 DateTimeNumericFieldElement::Step DateTimeEditBuilder::createStep(double msPerFieldUnit, double msPerFieldSize) const
@@ -463,7 +464,7 @@
     if (m_fields.size() == m_fields.capacity())
         return;
     m_fields.append(field.get());
-    fieldsWrapperElement()->appendChild(field, ASSERT_NO_EXCEPTION, AttachLazily);
+    fieldsWrapperElement()->appendChild(field, ASSERT_NO_EXCEPTION_STATE, AttachLazily);
 }
 
 bool DateTimeEditElement::anyEditableFieldsHaveValues() const
@@ -652,7 +653,7 @@
     if (!firstChild()) {
         RefPtr<HTMLDivElement> element = HTMLDivElement::create(document());
         element->setPseudo(fieldsWrapperPseudoId);
-        appendChild(element.get(), ASSERT_NO_EXCEPTION, AttachLazily);
+        appendChild(element.get(), ASSERT_NO_EXCEPTION_STATE, AttachLazily);
     }
     Element* fieldsWrapper = fieldsWrapperElement();
 
diff --git a/Source/core/html/shadow/MediaControlElementTypes.cpp b/Source/core/html/shadow/MediaControlElementTypes.cpp
index 7eba7a7..88b1d77 100644
--- a/Source/core/html/shadow/MediaControlElementTypes.cpp
+++ b/Source/core/html/shadow/MediaControlElementTypes.cpp
@@ -33,8 +33,8 @@
 
 #include "CSSValueKeywords.h"
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/css/StylePropertySet.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/MouseEvent.h"
 
 namespace WebCore {
@@ -185,7 +185,7 @@
 
     double volume = value().toDouble();
     if (volume != mediaController()->volume())
-        mediaController()->setVolume(volume, ASSERT_NO_EXCEPTION);
+        mediaController()->setVolume(volume, ASSERT_NO_EXCEPTION_STATE);
     if (m_clearMutedOnUserInteraction)
         mediaController()->setMuted(false);
 }
diff --git a/Source/core/html/shadow/MediaControlElements.cpp b/Source/core/html/shadow/MediaControlElements.cpp
index 44d62fe..1b9da36 100644
--- a/Source/core/html/shadow/MediaControlElements.cpp
+++ b/Source/core/html/shadow/MediaControlElements.cpp
@@ -28,11 +28,10 @@
  */
 
 #include "config.h"
-
 #include "core/html/shadow/MediaControlElements.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/EventNames.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/FullscreenElementStack.h"
 #include "core/dom/MouseEvent.h"
 #include "core/html/DOMTokenList.h"
@@ -163,7 +162,7 @@
     setInlineStyleProperty(CSSPropertyMarginLeft, 0.0, CSSPrimitiveValue::CSS_PX);
     setInlineStyleProperty(CSSPropertyMarginTop, 0.0, CSSPrimitiveValue::CSS_PX);
 
-    classList()->add("dragged", IGNORE_EXCEPTION);
+    classList()->add("dragged", IGNORE_EXCEPTION_STATE);
 }
 
 void MediaControlPanelElement::resetPosition()
@@ -173,7 +172,7 @@
     removeInlineStyleProperty(CSSPropertyMarginLeft);
     removeInlineStyleProperty(CSSPropertyMarginTop);
 
-    classList()->remove("dragged", IGNORE_EXCEPTION);
+    classList()->remove("dragged", IGNORE_EXCEPTION_STATE);
 
     m_cumulativeDragOffset.setX(0);
     m_cumulativeDragOffset.setY(0);
@@ -501,7 +500,7 @@
 
     double time = value().toDouble();
     if (event->type() == eventNames().inputEvent && time != mediaController()->currentTime())
-        mediaController()->setCurrentTime(time, IGNORE_EXCEPTION);
+        mediaController()->setCurrentTime(time, IGNORE_EXCEPTION_STATE);
 
     RenderSlider* slider = toRenderSlider(renderer());
     if (slider && slider->inDragMode())
@@ -749,9 +748,10 @@
             // WebVTT region whose region identifier is identical to cue's text
             // track cue region identifier, run the following substeps:
 #endif
-            if (displayBox->hasChildNodes() && !contains(displayBox.get()))
+            if (displayBox->hasChildNodes() && !contains(displayBox.get())) {
                 // Note: the display tree of a cue is removed when the active flag of the cue is unset.
-                appendChild(displayBox, ASSERT_NO_EXCEPTION, AttachNow);
+                appendChild(displayBox, ASSERT_NO_EXCEPTION_STATE, AttachNow);
+            }
 #if ENABLE(WEBVTT_REGIONS)
         } else {
             // Let region be the WebVTT region whose region identifier
diff --git a/Source/core/html/shadow/MediaControls.cpp b/Source/core/html/shadow/MediaControls.cpp
index 4e3ff07..5aca99a 100644
--- a/Source/core/html/shadow/MediaControls.cpp
+++ b/Source/core/html/shadow/MediaControls.cpp
@@ -25,10 +25,9 @@
  */
 
 #include "config.h"
-
 #include "core/html/shadow/MediaControls.h"
 
-#include "core/dom/ExceptionCodePlaceholder.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 
 namespace WebCore {
 
@@ -360,7 +359,7 @@
         m_textDisplayContainer->setMediaController(m_mediaController);
 
     // Insert it before the first controller element so it always displays behind the controls.
-    insertBefore(textDisplayContainer.release(), m_panel, IGNORE_EXCEPTION, AttachLazily);
+    insertBefore(textDisplayContainer.release(), m_panel, IGNORE_EXCEPTION_STATE, AttachLazily);
 }
 
 void MediaControls::showTextTrackDisplay()
diff --git a/Source/core/html/shadow/MediaControlsChromium.cpp b/Source/core/html/shadow/MediaControlsChromium.cpp
index 4d94377..3d7c3b7 100644
--- a/Source/core/html/shadow/MediaControlsChromium.cpp
+++ b/Source/core/html/shadow/MediaControlsChromium.cpp
@@ -25,10 +25,9 @@
  */
 
 #include "config.h"
-
 #include "core/html/shadow/MediaControlsChromium.h"
 
-#include "core/dom/ExceptionCodePlaceholder.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 
 using namespace std;
 
@@ -69,68 +68,68 @@
 
     RefPtr<MediaControlPanelElement> panel = MediaControlPanelElement::create(document);
 
-    ExceptionCode ec;
+    TrackExceptionState es;
 
     RefPtr<MediaControlPlayButtonElement> playButton = MediaControlPlayButtonElement::create(document);
     m_playButton = playButton.get();
-    panel->appendChild(playButton.release(), ec, AttachLazily);
-    if (ec)
+    panel->appendChild(playButton.release(), es, AttachLazily);
+    if (es.hadException())
         return false;
 
     RefPtr<MediaControlTimelineElement> timeline = MediaControlTimelineElement::create(document, this);
     m_timeline = timeline.get();
-    panel->appendChild(timeline.release(), ec, AttachLazily);
-    if (ec)
+    panel->appendChild(timeline.release(), es, AttachLazily);
+    if (es.hadException())
         return false;
 
     RefPtr<MediaControlCurrentTimeDisplayElement> currentTimeDisplay = MediaControlCurrentTimeDisplayElement::create(document);
     m_currentTimeDisplay = currentTimeDisplay.get();
     m_currentTimeDisplay->hide();
-    panel->appendChild(currentTimeDisplay.release(), ec, AttachLazily);
-    if (ec)
+    panel->appendChild(currentTimeDisplay.release(), es, AttachLazily);
+    if (es.hadException())
         return false;
 
     RefPtr<MediaControlTimeRemainingDisplayElement> durationDisplay = MediaControlTimeRemainingDisplayElement::create(document);
     m_durationDisplay = durationDisplay.get();
-    panel->appendChild(durationDisplay.release(), ec, AttachLazily);
-    if (ec)
+    panel->appendChild(durationDisplay.release(), es, AttachLazily);
+    if (es.hadException())
         return false;
 
     RefPtr<MediaControlPanelMuteButtonElement> panelMuteButton = MediaControlPanelMuteButtonElement::create(document, this);
     m_panelMuteButton = panelMuteButton.get();
-    panel->appendChild(panelMuteButton.release(), ec, AttachLazily);
-    if (ec)
+    panel->appendChild(panelMuteButton.release(), es, AttachLazily);
+    if (es.hadException())
         return false;
 
     RefPtr<MediaControlPanelVolumeSliderElement> slider = MediaControlPanelVolumeSliderElement::create(document);
     m_volumeSlider = slider.get();
     m_volumeSlider->setClearMutedOnUserInteraction(true);
-    panel->appendChild(slider.release(), ec, AttachLazily);
-    if (ec)
+    panel->appendChild(slider.release(), es, AttachLazily);
+    if (es.hadException())
         return false;
 
     if (document->page()->theme()->supportsClosedCaptioning()) {
         RefPtr<MediaControlToggleClosedCaptionsButtonElement> toggleClosedCaptionsButton = MediaControlToggleClosedCaptionsButtonElement::create(document, this);
         m_toggleClosedCaptionsButton = toggleClosedCaptionsButton.get();
-        panel->appendChild(toggleClosedCaptionsButton.release(), ec, AttachLazily);
-        if (ec)
+        panel->appendChild(toggleClosedCaptionsButton.release(), es, AttachLazily);
+        if (es.hadException())
             return false;
     }
 
     RefPtr<MediaControlFullscreenButtonElement> fullscreenButton = MediaControlFullscreenButtonElement::create(document);
     m_fullScreenButton = fullscreenButton.get();
-    panel->appendChild(fullscreenButton.release(), ec, AttachLazily);
-    if (ec)
+    panel->appendChild(fullscreenButton.release(), es, AttachLazily);
+    if (es.hadException())
         return false;
 
     m_panel = panel.get();
-    enclosure->appendChild(panel.release(), ec, AttachLazily);
-    if (ec)
+    enclosure->appendChild(panel.release(), es, AttachLazily);
+    if (es.hadException())
         return false;
 
     m_enclosure = enclosure.get();
-    appendChild(enclosure.release(), ec, AttachLazily);
-    if (ec)
+    appendChild(enclosure.release(), es, AttachLazily);
+    if (es.hadException())
         return false;
 
     return true;
@@ -156,7 +155,7 @@
         return;
 
     double duration = m_mediaController->duration();
-    m_durationDisplay->setInnerText(page->theme()->formatMediaControlsTime(duration), ASSERT_NO_EXCEPTION);
+    m_durationDisplay->setInnerText(page->theme()->formatMediaControlsTime(duration), ASSERT_NO_EXCEPTION_STATE);
     m_durationDisplay->setCurrentValue(duration);
 
     MediaControls::reset();
@@ -186,7 +185,7 @@
     }
 
     // Allow the theme to format the time.
-    m_currentTimeDisplay->setInnerText(page->theme()->formatMediaControlsCurrentTime(now, duration), IGNORE_EXCEPTION);
+    m_currentTimeDisplay->setInnerText(page->theme()->formatMediaControlsCurrentTime(now, duration), IGNORE_EXCEPTION_STATE);
     m_currentTimeDisplay->setCurrentValue(now);
 }
 
@@ -218,7 +217,7 @@
 {
     // Insert it before the first controller element so it always displays behind the controls.
     // In the Chromium case, that's the enclosure element.
-    insertBefore(textTrackContainer, m_enclosure, ASSERT_NO_EXCEPTION, AttachLazily);
+    insertBefore(textTrackContainer, m_enclosure, ASSERT_NO_EXCEPTION_STATE, AttachLazily);
 }
 
 
diff --git a/Source/core/html/shadow/MediaControlsChromiumAndroid.cpp b/Source/core/html/shadow/MediaControlsChromiumAndroid.cpp
index 34e61af..d09c2fe 100644
--- a/Source/core/html/shadow/MediaControlsChromiumAndroid.cpp
+++ b/Source/core/html/shadow/MediaControlsChromiumAndroid.cpp
@@ -24,9 +24,10 @@
  */
 
 #include "config.h"
-
 #include "core/html/shadow/MediaControlsChromiumAndroid.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
+
 namespace WebCore {
 
 MediaControlsChromiumAndroid::MediaControlsChromiumAndroid(Document* document)
@@ -48,18 +49,18 @@
 
     RefPtr<MediaControlsChromiumAndroid> controls = adoptRef(new MediaControlsChromiumAndroid(document));
 
-    ExceptionCode ec;
+    TrackExceptionState es;
 
     RefPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = MediaControlOverlayEnclosureElement::create(document);
     RefPtr<MediaControlOverlayPlayButtonElement> overlayPlayButton = MediaControlOverlayPlayButtonElement::create(document);
     controls->m_overlayPlayButton = overlayPlayButton.get();
-    overlayEnclosure->appendChild(overlayPlayButton.release(), ec, AttachLazily);
-    if (ec)
+    overlayEnclosure->appendChild(overlayPlayButton.release(), es, AttachLazily);
+    if (es.hadException())
         return 0;
 
     controls->m_overlayEnclosure = overlayEnclosure.get();
-    controls->appendChild(overlayEnclosure.release(), ec, AttachLazily);
-    if (ec)
+    controls->appendChild(overlayEnclosure.release(), es, AttachLazily);
+    if (es.hadException())
         return 0;
 
     if (controls->initializeControls(document))
@@ -92,6 +93,6 @@
 void MediaControlsChromiumAndroid::insertTextTrackContainer(PassRefPtr<MediaControlTextTrackContainerElement> textTrackContainer)
 {
     // Insert it before the overlay play button so it always displays behind it.
-    m_overlayEnclosure->insertBefore(textTrackContainer, m_overlayPlayButton, ASSERT_NO_EXCEPTION, AttachLazily);
+    m_overlayEnclosure->insertBefore(textTrackContainer, m_overlayPlayButton, ASSERT_NO_EXCEPTION_STATE, AttachLazily);
 }
 }
diff --git a/Source/core/html/track/InbandTextTrack.cpp b/Source/core/html/track/InbandTextTrack.cpp
index 2a3d975..7dcb1df 100644
--- a/Source/core/html/track/InbandTextTrack.cpp
+++ b/Source/core/html/track/InbandTextTrack.cpp
@@ -26,12 +26,12 @@
 #include "config.h"
 #include "core/html/track/InbandTextTrack.h"
 
-#include <math.h>
-#include "core/dom/ExceptionCodePlaceholder.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/html/track/TextTrackCueGeneric.h"
 #include "core/platform/Logging.h"
 #include "core/platform/graphics/InbandTextTrackPrivate.h"
 #include "wtf/UnusedParam.h"
+#include <math.h>
 
 namespace WebCore {
 
@@ -151,22 +151,22 @@
     cue->setFontName(cueData->fontName());
 
     if (cueData->position() > 0)
-        cue->setPosition(lround(cueData->position()), IGNORE_EXCEPTION);
+        cue->setPosition(lround(cueData->position()), IGNORE_EXCEPTION_STATE);
     if (cueData->line() > 0)
-        cue->setLine(lround(cueData->line()), IGNORE_EXCEPTION);
+        cue->setLine(lround(cueData->line()), IGNORE_EXCEPTION_STATE);
     if (cueData->size() > 0)
-        cue->setSize(lround(cueData->size()), IGNORE_EXCEPTION);
+        cue->setSize(lround(cueData->size()), IGNORE_EXCEPTION_STATE);
     if (cueData->backgroundColor().alpha())
         cue->setBackgroundColor(cueData->backgroundColor().rgb());
     if (cueData->foregroundColor().alpha())
         cue->setForegroundColor(cueData->foregroundColor().rgb());
 
     if (cueData->align() == GenericCueData::Start)
-        cue->setAlign(ASCIILiteral("start"), IGNORE_EXCEPTION);
+        cue->setAlign(ASCIILiteral("start"), IGNORE_EXCEPTION_STATE);
     else if (cueData->align() == GenericCueData::Middle)
-        cue->setAlign(ASCIILiteral("middle"), IGNORE_EXCEPTION);
+        cue->setAlign(ASCIILiteral("middle"), IGNORE_EXCEPTION_STATE);
     else if (cueData->align() == GenericCueData::End)
-        cue->setAlign(ASCIILiteral("end"), IGNORE_EXCEPTION);
+        cue->setAlign(ASCIILiteral("end"), IGNORE_EXCEPTION_STATE);
     cue->setSnapToLines(false);
 
     if (hasCue(cue.get())) {
diff --git a/Source/core/html/track/TextTrack.cpp b/Source/core/html/track/TextTrack.cpp
index 1840626..abaaf3c 100644
--- a/Source/core/html/track/TextTrack.cpp
+++ b/Source/core/html/track/TextTrack.cpp
@@ -30,9 +30,9 @@
  */
 
 #include "config.h"
-
 #include "core/html/track/TextTrack.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/html/HTMLMediaElement.h"
 #include "core/html/track/TextTrackCueList.h"
@@ -244,7 +244,7 @@
     // list of cues.
     TextTrack* cueTrack = cue->track();
     if (cueTrack && cueTrack != this)
-        cueTrack->removeCue(cue.get(), ASSERT_NO_EXCEPTION);
+        cueTrack->removeCue(cue.get(), ASSERT_NO_EXCEPTION_STATE);
 
     // 2. Add cue to the method's TextTrack object's text track's text track list of cues.
     cue->setTrack(this);
@@ -254,7 +254,7 @@
         m_client->textTrackAddCue(this, cue.get());
 }
 
-void TextTrack::removeCue(TextTrackCue* cue, ExceptionCode& ec)
+void TextTrack::removeCue(TextTrackCue* cue, ExceptionState& es)
 {
     if (!cue)
         return;
@@ -266,13 +266,13 @@
     // 1. If the given cue is not currently listed in the method's TextTrack
     // object's text track's text track list of cues, then throw a NotFoundError exception.
     if (cue->track() != this) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
 
     // 2. Remove cue from the method's TextTrack object's text track's text track list of cues.
     if (!m_cues || !m_cues->remove(cue)) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
@@ -321,7 +321,7 @@
     // region from that text track list of regions.
     TextTrack* regionTrack = region->track();
     if (regionTrack && regionTrack != this)
-        regionTrack->removeRegion(region.get(), ASSERT_NO_EXCEPTION);
+        regionTrack->removeRegion(region.get(), ASSERT_NO_EXCEPTION_STATE);
 
     // 2. If the method's TextTrack object's text track list of regions contains
     // a region with the same identifier as region replace the values of that
@@ -339,7 +339,7 @@
     regionList->add(region);
 }
 
-void TextTrack::removeRegion(TextTrackRegion* region, ExceptionCode &ec)
+void TextTrack::removeRegion(TextTrackRegion* region, ExceptionCode &es)
 {
     if (!region)
         return;
@@ -347,12 +347,12 @@
     // 1. If the given region is not currently listed in the method's TextTrack
     // object's text track list of regions, then throw a NotFoundError exception.
     if (region->track() != this) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return;
     }
 
     if (!m_regions || !m_regions->remove(region)) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
diff --git a/Source/core/html/track/TextTrack.h b/Source/core/html/track/TextTrack.h
index 655eb31..c16b447 100644
--- a/Source/core/html/track/TextTrack.h
+++ b/Source/core/html/track/TextTrack.h
@@ -28,12 +28,12 @@
 #define TextTrack_h
 
 #include "bindings/v8/ScriptWrappable.h"
-#include "core/dom/ExceptionCode.h"
 #include "core/html/track/TrackBase.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
+class ExceptionState;
 class HTMLMediaElement;
 class TextTrack;
 class TextTrackCue;
@@ -99,13 +99,13 @@
     TextTrackClient* client() { return m_client; }
 
     void addCue(PassRefPtr<TextTrackCue>);
-    void removeCue(TextTrackCue*, ExceptionCode&);
+    void removeCue(TextTrackCue*, ExceptionState&);
     bool hasCue(TextTrackCue*);
 
 #if ENABLE(WEBVTT_REGIONS)
     TextTrackRegionList* regions();
     void addRegion(PassRefPtr<TextTrackRegion>);
-    void removeRegion(TextTrackRegion*, ExceptionCode&);
+    void removeRegion(TextTrackRegion*, ExceptionState&);
 #endif
 
     void cueWillChange(TextTrackCue*);
diff --git a/Source/core/html/track/TextTrackCue.cpp b/Source/core/html/track/TextTrackCue.cpp
index d7c0a4f..e3cd1de 100644
--- a/Source/core/html/track/TextTrackCue.cpp
+++ b/Source/core/html/track/TextTrackCue.cpp
@@ -35,6 +35,7 @@
 
 #include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/DocumentFragment.h"
 #include "core/dom/Event.h"
 #include "core/dom/NodeTraversal.h"
@@ -221,7 +222,7 @@
 
 TextTrackCue::~TextTrackCue()
 {
-    displayTreeInternal()->remove(ASSERT_NO_EXCEPTION);
+    displayTreeInternal()->remove(ASSERT_NO_EXCEPTION_STATE);
 }
 
 PassRefPtr<TextTrackCueBox> TextTrackCue::createDisplayTree()
@@ -270,11 +271,11 @@
     cueDidChange();
 }
 
-void TextTrackCue::setStartTime(double value, ExceptionCode& ec)
+void TextTrackCue::setStartTime(double value, ExceptionState& es)
 {
     // NaN, Infinity and -Infinity values should trigger a TypeError.
     if (std::isinf(value) || std::isnan(value)) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return;
     }
 
@@ -287,11 +288,11 @@
     cueDidChange();
 }
 
-void TextTrackCue::setEndTime(double value, ExceptionCode& ec)
+void TextTrackCue::setEndTime(double value, ExceptionState& es)
 {
     // NaN, Infinity and -Infinity values should trigger a TypeError.
     if (std::isinf(value) || std::isnan(value)) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return;
     }
 
@@ -329,7 +330,7 @@
     }
 }
 
-void TextTrackCue::setVertical(const String& value, ExceptionCode& ec)
+void TextTrackCue::setVertical(const String& value, ExceptionState& es)
 {
     // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-vertical
     // On setting, the text track cue writing direction must be set to the value given
@@ -345,7 +346,7 @@
     else if (value == verticalGrowingRightKeyword())
         direction = VerticalGrowingRight;
     else
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
 
     if (direction == m_writingDirection)
         return;
@@ -365,13 +366,13 @@
     cueDidChange();
 }
 
-void TextTrackCue::setLine(int position, ExceptionCode& ec)
+void TextTrackCue::setLine(int position, ExceptionState& es)
 {
     // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-line
     // On setting, if the text track cue snap-to-lines flag is not set, and the new
     // value is negative or greater than 100, then throw an IndexSizeError exception.
     if (!m_snapToLines && (position < 0 || position > 100)) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
@@ -385,13 +386,13 @@
     cueDidChange();
 }
 
-void TextTrackCue::setPosition(int position, ExceptionCode& ec)
+void TextTrackCue::setPosition(int position, ExceptionState& es)
 {
     // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-position
     // On setting, if the new value is negative or greater than 100, then throw an IndexSizeError exception.
     // Otherwise, set the text track cue text position to the new value.
     if (position < 0 || position > 100) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
@@ -404,13 +405,13 @@
     cueDidChange();
 }
 
-void TextTrackCue::setSize(int size, ExceptionCode& ec)
+void TextTrackCue::setSize(int size, ExceptionState& es)
 {
     // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-size
     // On setting, if the new value is negative or greater than 100, then throw an IndexSizeError
     // exception. Otherwise, set the text track cue size to the new value.
     if (size < 0 || size > 100) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
@@ -438,7 +439,7 @@
     }
 }
 
-void TextTrackCue::setAlign(const String& value, ExceptionCode& ec)
+void TextTrackCue::setAlign(const String& value, ExceptionState& es)
 {
     // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-align
     // On setting, the text track cue alignment must be set to the value given in the
@@ -454,7 +455,7 @@
     else if (value == endKeyword())
         alignment = End;
     else
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
 
     if (alignment == m_cueAlignment)
         return;
@@ -504,7 +505,7 @@
             clonedNode = toWebVTTElement(node)->createEquivalentHTMLElement(ownerDocument());
         else
             clonedNode = node->cloneNode(false);
-        parent->appendChild(clonedNode, ASSERT_NO_EXCEPTION);
+        parent->appendChild(clonedNode, ASSERT_NO_EXCEPTION_STATE);
         if (node->isContainerNode())
             copyWebVTTNodeToDOMTree(toContainerNode(node), toContainerNode(clonedNode.get()));
     }
@@ -803,7 +804,7 @@
 
     // Note: This is contained by default in m_cueBackgroundBox.
     m_cueBackgroundBox->setPseudo(cueShadowPseudoId());
-    displayTree->appendChild(m_cueBackgroundBox, ASSERT_NO_EXCEPTION, AttachLazily);
+    displayTree->appendChild(m_cueBackgroundBox, ASSERT_NO_EXCEPTION_STATE, AttachLazily);
 
     // FIXME(BUG 79916): Runs of children of WebVTT Ruby Objects that are not
     // WebVTT Ruby Text Objects must be wrapped in anonymous boxes whose
@@ -834,7 +835,7 @@
         region->willRemoveTextTrackCueBox(m_displayTree.get());
 #endif
 
-    displayTreeInternal()->remove(ASSERT_NO_EXCEPTION);
+    displayTreeInternal()->remove(ASSERT_NO_EXCEPTION_STATE);
 }
 
 std::pair<double, double> TextTrackCue::getPositionCoordinates() const
diff --git a/Source/core/html/track/TextTrackCue.h b/Source/core/html/track/TextTrackCue.h
index 8c29667..82efa89 100644
--- a/Source/core/html/track/TextTrackCue.h
+++ b/Source/core/html/track/TextTrackCue.h
@@ -40,6 +40,7 @@
 namespace WebCore {
 
 class DocumentFragment;
+class ExceptionState;
 class ScriptExecutionContext;
 class TextTrack;
 class TextTrackCue;
@@ -90,31 +91,31 @@
     void setId(const String&);
 
     double startTime() const { return m_startTime; }
-    void setStartTime(double, ExceptionCode&);
+    void setStartTime(double, ExceptionState&);
 
     double endTime() const { return m_endTime; }
-    void setEndTime(double, ExceptionCode&);
+    void setEndTime(double, ExceptionState&);
 
     bool pauseOnExit() const { return m_pauseOnExit; }
     void setPauseOnExit(bool);
 
     const String& vertical() const;
-    void setVertical(const String&, ExceptionCode&);
+    void setVertical(const String&, ExceptionState&);
 
     bool snapToLines() const { return m_snapToLines; }
     void setSnapToLines(bool);
 
     int line() const { return m_linePosition; }
-    virtual void setLine(int, ExceptionCode&);
+    virtual void setLine(int, ExceptionState&);
 
     int position() const { return m_textPosition; }
-    virtual void setPosition(int, ExceptionCode&);
+    virtual void setPosition(int, ExceptionState&);
 
     int size() const { return m_cueSize; }
-    virtual void setSize(int, ExceptionCode&);
+    virtual void setSize(int, ExceptionState&);
 
     const String& align() const;
-    void setAlign(const String&, ExceptionCode&);
+    void setAlign(const String&, ExceptionState&);
 
     const String& text() const { return m_content; }
     void setText(const String&);
diff --git a/Source/core/html/track/TextTrackCueGeneric.cpp b/Source/core/html/track/TextTrackCueGeneric.cpp
index 2ea70e3..a7d4cbe 100644
--- a/Source/core/html/track/TextTrackCueGeneric.cpp
+++ b/Source/core/html/track/TextTrackCueGeneric.cpp
@@ -24,11 +24,11 @@
  */
 
 #include "config.h"
-
 #include "core/html/track/TextTrackCueGeneric.h"
 
 #include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/html/HTMLDivElement.h"
 #include "core/html/track/TextTrackCue.h"
 
@@ -116,16 +116,16 @@
     return TextTrackCueGenericBoxElement::create(ownerDocument(), this);
 }
 
-void TextTrackCueGeneric::setLine(int line, ExceptionCode& ec)
+void TextTrackCueGeneric::setLine(int line, ExceptionState& es)
 {
     m_defaultPosition = false;
-    TextTrackCue::setLine(line, ec);
+    TextTrackCue::setLine(line, es);
 }
 
-void TextTrackCueGeneric::setPosition(int position, ExceptionCode& ec)
+void TextTrackCueGeneric::setPosition(int position, ExceptionState& es)
 {
     m_defaultPosition = false;
-    TextTrackCue::setPosition(position, ec);
+    TextTrackCue::setPosition(position, es);
 }
 
 void TextTrackCueGeneric::videoSizeDidChange(const IntSize& videoSize)
diff --git a/Source/core/html/track/TextTrackCueGeneric.h b/Source/core/html/track/TextTrackCueGeneric.h
index 292f727..9034222 100644
--- a/Source/core/html/track/TextTrackCueGeneric.h
+++ b/Source/core/html/track/TextTrackCueGeneric.h
@@ -31,6 +31,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class GenericCueData;
 
 // A "generic" cue is a non-WebVTT cue, so it is not positioned/sized with the WebVTT logic.
@@ -45,8 +46,8 @@
 
     virtual PassRefPtr<TextTrackCueBox> createDisplayTree() OVERRIDE;
 
-    virtual void setLine(int, ExceptionCode&) OVERRIDE;
-    virtual void setPosition(int, ExceptionCode&) OVERRIDE;
+    virtual void setLine(int, ExceptionState&) OVERRIDE;
+    virtual void setPosition(int, ExceptionState&) OVERRIDE;
 
     bool useDefaultPosition() const { return m_defaultPosition; }
 
diff --git a/Source/core/html/track/TextTrackList.cpp b/Source/core/html/track/TextTrackList.cpp
index 5be8aaf..0d28070 100644
--- a/Source/core/html/track/TextTrackList.cpp
+++ b/Source/core/html/track/TextTrackList.cpp
@@ -24,9 +24,9 @@
  */
 
 #include "config.h"
-
 #include "core/html/track/TextTrackList.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/EventNames.h"
 #include "core/html/HTMLMediaElement.h"
 #include "core/html/track/InbandTextTrack.h"
@@ -263,7 +263,7 @@
     m_pendingEvents.swap(pendingEvents);
     size_t count = pendingEvents.size();
     for (size_t index = 0; index < count; ++index)
-        dispatchEvent(pendingEvents[index].release(), IGNORE_EXCEPTION);
+        dispatchEvent(pendingEvents[index].release(), IGNORE_EXCEPTION_STATE);
     --m_dispatchingEvents;
 }
 
diff --git a/Source/core/html/track/TextTrackRegion.cpp b/Source/core/html/track/TextTrackRegion.cpp
index 236f2f7..f515080 100644
--- a/Source/core/html/track/TextTrackRegion.cpp
+++ b/Source/core/html/track/TextTrackRegion.cpp
@@ -34,8 +34,9 @@
 
 #include "core/html/track/TextTrackRegion.h"
 
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/ClientRect.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/html/DOMTokenList.h"
 #include "core/html/HTMLDivElement.h"
 #include "core/html/track/WebVTTParser.h"
@@ -99,85 +100,85 @@
     m_id = id;
 }
 
-void TextTrackRegion::setWidth(double value, ExceptionCode& ec)
+void TextTrackRegion::setWidth(double value, ExceptionState& es)
 {
     if (std::isinf(value) || std::isnan(value)) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return;
     }
 
     if (value < 0 || value > 100) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
     m_width = value;
 }
 
-void TextTrackRegion::setHeight(long value, ExceptionCode& ec)
+void TextTrackRegion::setHeight(long value, ExceptionState& es)
 {
     if (value < 0) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
     m_heightInLines = value;
 }
 
-void TextTrackRegion::setRegionAnchorX(double value, ExceptionCode& ec)
+void TextTrackRegion::setRegionAnchorX(double value, ExceptionState& es)
 {
     if (std::isinf(value) || std::isnan(value)) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return;
     }
 
     if (value < 0 || value > 100) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
     m_regionAnchor.setX(value);
 }
 
-void TextTrackRegion::setRegionAnchorY(double value, ExceptionCode& ec)
+void TextTrackRegion::setRegionAnchorY(double value, ExceptionState& es)
 {
     if (std::isinf(value) || std::isnan(value)) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return;
     }
 
     if (value < 0 || value > 100) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
     m_regionAnchor.setY(value);
 }
 
-void TextTrackRegion::setViewportAnchorX(double value, ExceptionCode& ec)
+void TextTrackRegion::setViewportAnchorX(double value, ExceptionState& es)
 {
     if (std::isinf(value) || std::isnan(value)) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return;
     }
 
     if (value < 0 || value > 100) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
     m_viewportAnchor.setX(value);
 }
 
-void TextTrackRegion::setViewportAnchorY(double value, ExceptionCode& ec)
+void TextTrackRegion::setViewportAnchorY(double value, ExceptionState& es)
 {
     if (std::isinf(value) || std::isnan(value)) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return;
     }
 
     if (value < 0 || value > 100) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
@@ -194,12 +195,12 @@
     return "";
 }
 
-void TextTrackRegion::setScroll(const AtomicString& value, ExceptionCode& ec)
+void TextTrackRegion::setScroll(const AtomicString& value, ExceptionState& es)
 {
     DEFINE_STATIC_LOCAL(const AtomicString, upScrollValueKeyword, ("up", AtomicString::ConstructFromLiteral));
 
     if (value != emptyString() && value != upScrollValueKeyword) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return;
     }
 
@@ -214,7 +215,7 @@
     m_regionAnchor = FloatPoint(region->regionAnchorX(), region->regionAnchorY());
     m_viewportAnchor = FloatPoint(region->viewportAnchorX(), region->viewportAnchorY());
 
-    setScroll(region->scroll(), ASSERT_NO_EXCEPTION);
+    setScroll(region->scroll(), ASSERT_NO_EXCEPTION_STATE);
 }
 
 void TextTrackRegion::setRegionSettings(const String& input)
@@ -372,7 +373,7 @@
     double boxHeight = box->getBoundingClientRect()->bottom() - box->getBoundingClientRect()->top();
     float regionBottom = m_regionDisplayTree->getBoundingClientRect()->bottom();
 
-    m_cueContainer->classList()->remove(textTrackCueContainerScrollingClass(), IGNORE_EXCEPTION);
+    m_cueContainer->classList()->remove(textTrackCueContainerScrollingClass(), IGNORE_EXCEPTION_STATE);
 
     m_currentTop += boxHeight;
     m_cueContainer->setInlineStyleProperty(CSSPropertyTop, m_currentTop, CSSPrimitiveValue::CSS_PX);
@@ -384,7 +385,7 @@
     if (m_cueContainer->contains(displayBox.get()))
         return;
 
-    m_cueContainer->appendChild(displayBox, ASSERT_NO_EXCEPTION, AttachNow);
+    m_cueContainer->appendChild(displayBox, ASSERT_NO_EXCEPTION_STATE, AttachNow);
     displayLastTextTrackCueBox();
 }
 
@@ -399,7 +400,7 @@
 
     // If it's a scrolling region, add the scrolling class.
     if (isScrollingRegion())
-        m_cueContainer->classList()->add(textTrackCueContainerScrollingClass(), IGNORE_EXCEPTION);
+        m_cueContainer->classList()->add(textTrackCueContainerScrollingClass(), IGNORE_EXCEPTION_STATE);
 
     float regionBottom = m_regionDisplayTree->getBoundingClientRect()->bottom();
 
diff --git a/Source/core/html/track/TextTrackRegion.h b/Source/core/html/track/TextTrackRegion.h
index 920a54b..f0642fb 100644
--- a/Source/core/html/track/TextTrackRegion.h
+++ b/Source/core/html/track/TextTrackRegion.h
@@ -42,6 +42,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class HTMLDivElement;
 class TextTrackCueBox;
 
@@ -61,25 +62,25 @@
     void setId(const String&);
 
     double width() const { return m_width; }
-    void setWidth(double, ExceptionCode&);
+    void setWidth(double, ExceptionState&);
 
     long height() const { return m_heightInLines; }
-    void setHeight(long, ExceptionCode&);
+    void setHeight(long, ExceptionState&);
 
     double regionAnchorX() const { return m_regionAnchor.x(); }
-    void setRegionAnchorX(double, ExceptionCode&);
+    void setRegionAnchorX(double, ExceptionState&);
 
     double regionAnchorY() const { return m_regionAnchor.y(); }
-    void setRegionAnchorY(double, ExceptionCode&);
+    void setRegionAnchorY(double, ExceptionState&);
 
     double viewportAnchorX() const { return m_viewportAnchor.x(); }
-    void setViewportAnchorX(double, ExceptionCode&);
+    void setViewportAnchorX(double, ExceptionState&);
 
     double viewportAnchorY() const { return m_viewportAnchor.y(); }
-    void setViewportAnchorY(double, ExceptionCode&);
+    void setViewportAnchorY(double, ExceptionState&);
 
     const AtomicString scroll() const;
-    void setScroll(const AtomicString&, ExceptionCode&);
+    void setScroll(const AtomicString&, ExceptionState&);
 
     void updateParametersFromRegion(TextTrackRegion*);
 
diff --git a/Source/core/inspector/DOMEditor.cpp b/Source/core/inspector/DOMEditor.cpp
index 3dd881c..671bf08 100644
--- a/Source/core/inspector/DOMEditor.cpp
+++ b/Source/core/inspector/DOMEditor.cpp
@@ -31,9 +31,10 @@
 #include "config.h"
 #include "core/inspector/DOMEditor.h"
 
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/DOMException.h"
 #include "core/dom/Element.h"
-#include "core/dom/ExceptionCode.h"
 #include "core/dom/Node.h"
 #include "core/dom/Text.h"
 #include "core/editing/markup.h"
@@ -55,22 +56,22 @@
     {
     }
 
-    virtual bool perform(ExceptionCode& ec)
+    virtual bool perform(ExceptionState& es)
     {
         m_anchorNode = m_node->nextSibling();
-        return redo(ec);
+        return redo(es);
     }
 
-    virtual bool undo(ExceptionCode& ec)
+    virtual bool undo(ExceptionState& es)
     {
-        m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), ec);
-        return !ec;
+        m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), es);
+        return !es.hadException();
     }
 
-    virtual bool redo(ExceptionCode& ec)
+    virtual bool redo(ExceptionState& es)
     {
-        m_parentNode->removeChild(m_node.get(), ec);
-        return !ec;
+        m_parentNode->removeChild(m_node.get(), es);
+        return !es.hadException();
     }
 
 private:
@@ -90,33 +91,33 @@
     {
     }
 
-    virtual bool perform(ExceptionCode& ec)
+    virtual bool perform(ExceptionState& es)
     {
         if (m_node->parentNode()) {
             m_removeChildAction = adoptPtr(new RemoveChildAction(m_node->parentNode(), m_node.get()));
-            if (!m_removeChildAction->perform(ec))
+            if (!m_removeChildAction->perform(es))
                 return false;
         }
-        m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), ec);
-        return !ec;
+        m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), es);
+        return !es.hadException();
     }
 
-    virtual bool undo(ExceptionCode& ec)
+    virtual bool undo(ExceptionState& es)
     {
-        m_parentNode->removeChild(m_node.get(), ec);
-        if (ec)
+        m_parentNode->removeChild(m_node.get(), es);
+        if (es.hadException())
             return false;
         if (m_removeChildAction)
-            return m_removeChildAction->undo(ec);
+            return m_removeChildAction->undo(es);
         return true;
     }
 
-    virtual bool redo(ExceptionCode& ec)
+    virtual bool redo(ExceptionState& es)
     {
-        if (m_removeChildAction && !m_removeChildAction->redo(ec))
+        if (m_removeChildAction && !m_removeChildAction->redo(es))
             return false;
-        m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), ec);
-        return !ec;
+        m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), es);
+        return !es.hadException();
     }
 
 private:
@@ -136,19 +137,19 @@
     {
     }
 
-    virtual bool perform(ExceptionCode& ec)
+    virtual bool perform(ExceptionState& es)
     {
         m_value = m_element->getAttribute(m_name);
-        return redo(ec);
+        return redo(es);
     }
 
-    virtual bool undo(ExceptionCode& ec)
+    virtual bool undo(ExceptionState& es)
     {
-        m_element->setAttribute(m_name, m_value, ec);
+        m_element->setAttribute(m_name, m_value, es);
         return true;
     }
 
-    virtual bool redo(ExceptionCode&)
+    virtual bool redo(ExceptionState&)
     {
         m_element->removeAttribute(m_name);
         return true;
@@ -172,26 +173,26 @@
     {
     }
 
-    virtual bool perform(ExceptionCode& ec)
+    virtual bool perform(ExceptionState& es)
     {
         m_hadAttribute = m_element->hasAttribute(m_name);
         if (m_hadAttribute)
             m_oldValue = m_element->getAttribute(m_name);
-        return redo(ec);
+        return redo(es);
     }
 
-    virtual bool undo(ExceptionCode& ec)
+    virtual bool undo(ExceptionState& es)
     {
         if (m_hadAttribute)
-            m_element->setAttribute(m_name, m_oldValue, ec);
+            m_element->setAttribute(m_name, m_oldValue, es);
         else
             m_element->removeAttribute(m_name);
         return true;
     }
 
-    virtual bool redo(ExceptionCode& ec)
+    virtual bool redo(ExceptionState& es)
     {
-        m_element->setAttribute(m_name, m_value, ec);
+        m_element->setAttribute(m_name, m_value, es);
         return true;
     }
 
@@ -217,22 +218,22 @@
     {
     }
 
-    virtual bool perform(ExceptionCode& ec)
+    virtual bool perform(ExceptionState& es)
     {
         m_oldHTML = createMarkup(m_node.get());
         DOMPatchSupport domPatchSupport(m_domEditor.get(), m_node->ownerDocument());
-        m_newNode = domPatchSupport.patchNode(m_node.get(), m_html, ec);
-        return !ec;
+        m_newNode = domPatchSupport.patchNode(m_node.get(), m_html, es);
+        return !es.hadException();
     }
 
-    virtual bool undo(ExceptionCode& ec)
+    virtual bool undo(ExceptionState& es)
     {
-        return m_history->undo(ec);
+        return m_history->undo(es);
     }
 
-    virtual bool redo(ExceptionCode& ec)
+    virtual bool redo(ExceptionState& es)
     {
-        return m_history->redo(ec);
+        return m_history->redo(es);
     }
 
     Node* newNode()
@@ -260,19 +261,19 @@
     {
     }
 
-    virtual bool perform(ExceptionCode& ec)
+    virtual bool perform(ExceptionState& es)
     {
         m_oldText = m_textNode->wholeText();
-        return redo(ec);
+        return redo(es);
     }
 
-    virtual bool undo(ExceptionCode&)
+    virtual bool undo(ExceptionState&)
     {
         m_textNode->replaceWholeText(m_oldText);
         return true;
     }
 
-    virtual bool redo(ExceptionCode&)
+    virtual bool redo(ExceptionState&)
     {
         m_textNode->replaceWholeText(m_text);
         return true;
@@ -295,21 +296,21 @@
     {
     }
 
-    virtual bool perform(ExceptionCode& ec)
+    virtual bool perform(ExceptionState& es)
     {
-        return redo(ec);
+        return redo(es);
     }
 
-    virtual bool undo(ExceptionCode& ec)
+    virtual bool undo(ExceptionState& es)
     {
-        m_parentNode->replaceChild(m_oldNode, m_newNode.get(), ec);
-        return !ec;
+        m_parentNode->replaceChild(m_oldNode, m_newNode.get(), es);
+        return !es.hadException();
     }
 
-    virtual bool redo(ExceptionCode& ec)
+    virtual bool redo(ExceptionState& es)
     {
-        m_parentNode->replaceChild(m_newNode, m_oldNode.get(), ec);
-        return !ec;
+        m_parentNode->replaceChild(m_newNode, m_oldNode.get(), es);
+        return !es.hadException();
     }
 
 private:
@@ -328,19 +329,19 @@
     {
     }
 
-    virtual bool perform(ExceptionCode&)
+    virtual bool perform(ExceptionState&)
     {
         m_oldValue = m_node->nodeValue();
-        return redo(IGNORE_EXCEPTION);
+        return redo(IGNORE_EXCEPTION_STATE);
     }
 
-    virtual bool undo(ExceptionCode&)
+    virtual bool undo(ExceptionState&)
     {
         m_node->setNodeValue(m_oldValue);
         return true;
     }
 
-    virtual bool redo(ExceptionCode&)
+    virtual bool redo(ExceptionState&)
     {
         m_node->setNodeValue(m_value);
         return true;
@@ -356,102 +357,102 @@
 
 DOMEditor::~DOMEditor() { }
 
-bool DOMEditor::insertBefore(Node* parentNode, PassRefPtr<Node> node, Node* anchorNode, ExceptionCode& ec)
+bool DOMEditor::insertBefore(Node* parentNode, PassRefPtr<Node> node, Node* anchorNode, ExceptionState& es)
 {
-    return m_history->perform(adoptPtr(new InsertBeforeAction(parentNode, node, anchorNode)), ec);
+    return m_history->perform(adoptPtr(new InsertBeforeAction(parentNode, node, anchorNode)), es);
 }
 
-bool DOMEditor::removeChild(Node* parentNode, Node* node, ExceptionCode& ec)
+bool DOMEditor::removeChild(Node* parentNode, Node* node, ExceptionState& es)
 {
-    return m_history->perform(adoptPtr(new RemoveChildAction(parentNode, node)), ec);
+    return m_history->perform(adoptPtr(new RemoveChildAction(parentNode, node)), es);
 }
 
-bool DOMEditor::setAttribute(Element* element, const String& name, const String& value, ExceptionCode& ec)
+bool DOMEditor::setAttribute(Element* element, const String& name, const String& value, ExceptionState& es)
 {
-    return m_history->perform(adoptPtr(new SetAttributeAction(element, name, value)), ec);
+    return m_history->perform(adoptPtr(new SetAttributeAction(element, name, value)), es);
 }
 
-bool DOMEditor::removeAttribute(Element* element, const String& name, ExceptionCode& ec)
+bool DOMEditor::removeAttribute(Element* element, const String& name, ExceptionState& es)
 {
-    return m_history->perform(adoptPtr(new RemoveAttributeAction(element, name)), ec);
+    return m_history->perform(adoptPtr(new RemoveAttributeAction(element, name)), es);
 }
 
-bool DOMEditor::setOuterHTML(Node* node, const String& html, Node** newNode, ExceptionCode& ec)
+bool DOMEditor::setOuterHTML(Node* node, const String& html, Node** newNode, ExceptionState& es)
 {
     OwnPtr<SetOuterHTMLAction> action = adoptPtr(new SetOuterHTMLAction(node, html));
     SetOuterHTMLAction* rawAction = action.get();
-    bool result = m_history->perform(action.release(), ec);
+    bool result = m_history->perform(action.release(), es);
     if (result)
         *newNode = rawAction->newNode();
     return result;
 }
 
-bool DOMEditor::replaceWholeText(Text* textNode, const String& text, ExceptionCode& ec)
+bool DOMEditor::replaceWholeText(Text* textNode, const String& text, ExceptionState& es)
 {
-    return m_history->perform(adoptPtr(new ReplaceWholeTextAction(textNode, text)), ec);
+    return m_history->perform(adoptPtr(new ReplaceWholeTextAction(textNode, text)), es);
 }
 
-bool DOMEditor::replaceChild(Node* parentNode, PassRefPtr<Node> newNode, Node* oldNode, ExceptionCode& ec)
+bool DOMEditor::replaceChild(Node* parentNode, PassRefPtr<Node> newNode, Node* oldNode, ExceptionState& es)
 {
-    return m_history->perform(adoptPtr(new ReplaceChildNodeAction(parentNode, newNode, oldNode)), ec);
+    return m_history->perform(adoptPtr(new ReplaceChildNodeAction(parentNode, newNode, oldNode)), es);
 }
 
-bool DOMEditor::setNodeValue(Node* node, const String& value, ExceptionCode& ec)
+bool DOMEditor::setNodeValue(Node* node, const String& value, ExceptionState& es)
 {
-    return m_history->perform(adoptPtr(new SetNodeValueAction(node, value)), ec);
+    return m_history->perform(adoptPtr(new SetNodeValueAction(node, value)), es);
 }
 
-static void populateErrorString(const ExceptionCode& ec, ErrorString* errorString)
+static void populateErrorString(ExceptionState& es, ErrorString* errorString)
 {
-    if (ec)
-        *errorString = DOMException::getErrorName(ec);
+    if (es.hadException())
+        *errorString = DOMException::getErrorName(es);
 }
 
 bool DOMEditor::insertBefore(Node* parentNode, PassRefPtr<Node> node, Node* anchorNode, ErrorString* errorString)
 {
-    ExceptionCode ec = 0;
-    bool result = insertBefore(parentNode, node, anchorNode, ec);
-    populateErrorString(ec, errorString);
+    TrackExceptionState es;
+    bool result = insertBefore(parentNode, node, anchorNode, es);
+    populateErrorString(es, errorString);
     return result;
 }
 
 bool DOMEditor::removeChild(Node* parentNode, Node* node, ErrorString* errorString)
 {
-    ExceptionCode ec = 0;
-    bool result = removeChild(parentNode, node, ec);
-    populateErrorString(ec, errorString);
+    TrackExceptionState es;
+    bool result = removeChild(parentNode, node, es);
+    populateErrorString(es, errorString);
     return result;
 }
 
 bool DOMEditor::setAttribute(Element* element, const String& name, const String& value, ErrorString* errorString)
 {
-    ExceptionCode ec = 0;
-    bool result = setAttribute(element, name, value, ec);
-    populateErrorString(ec, errorString);
+    TrackExceptionState es;
+    bool result = setAttribute(element, name, value, es);
+    populateErrorString(es, errorString);
     return result;
 }
 
 bool DOMEditor::removeAttribute(Element* element, const String& name, ErrorString* errorString)
 {
-    ExceptionCode ec = 0;
-    bool result = removeAttribute(element, name, ec);
-    populateErrorString(ec, errorString);
+    TrackExceptionState es;
+    bool result = removeAttribute(element, name, es);
+    populateErrorString(es, errorString);
     return result;
 }
 
 bool DOMEditor::setOuterHTML(Node* node, const String& html, Node** newNode, ErrorString* errorString)
 {
-    ExceptionCode ec = 0;
-    bool result = setOuterHTML(node, html, newNode, ec);
-    populateErrorString(ec, errorString);
+    TrackExceptionState es;
+    bool result = setOuterHTML(node, html, newNode, es);
+    populateErrorString(es, errorString);
     return result;
 }
 
 bool DOMEditor::replaceWholeText(Text* textNode, const String& text, ErrorString* errorString)
 {
-    ExceptionCode ec = 0;
-    bool result = replaceWholeText(textNode, text, ec);
-    populateErrorString(ec, errorString);
+    TrackExceptionState es;
+    bool result = replaceWholeText(textNode, text, es);
+    populateErrorString(es, errorString);
     return result;
 }
 
diff --git a/Source/core/inspector/DOMEditor.h b/Source/core/inspector/DOMEditor.h
index aef98b5..b0be0cf 100644
--- a/Source/core/inspector/DOMEditor.h
+++ b/Source/core/inspector/DOMEditor.h
@@ -31,17 +31,16 @@
 #ifndef DOMEditor_h
 #define DOMEditor_h
 
-#include "core/dom/ExceptionCode.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
 class Element;
+class ExceptionState;
 class InspectorHistory;
 class Node;
 class Text;
 
-
 typedef String ErrorString;
 
 class DOMEditor {
@@ -50,14 +49,14 @@
     explicit DOMEditor(InspectorHistory*);
     ~DOMEditor();
 
-    bool insertBefore(Node* parentNode, PassRefPtr<Node>, Node* anchorNode, ExceptionCode&);
-    bool removeChild(Node* parentNode, Node*, ExceptionCode&);
-    bool setAttribute(Element*, const String& name, const String& value, ExceptionCode&);
-    bool removeAttribute(Element*, const String& name, ExceptionCode&);
-    bool setOuterHTML(Node*, const String& html, Node** newNode, ExceptionCode&);
-    bool replaceWholeText(Text*, const String& text, ExceptionCode&);
-    bool replaceChild(Node* parentNode, PassRefPtr<Node> newNode, Node* oldNode, ExceptionCode&);
-    bool setNodeValue(Node* parentNode, const String& value, ExceptionCode&);
+    bool insertBefore(Node* parentNode, PassRefPtr<Node>, Node* anchorNode, ExceptionState&);
+    bool removeChild(Node* parentNode, Node*, ExceptionState&);
+    bool setAttribute(Element*, const String& name, const String& value, ExceptionState&);
+    bool removeAttribute(Element*, const String& name, ExceptionState&);
+    bool setOuterHTML(Node*, const String& html, Node** newNode, ExceptionState&);
+    bool replaceWholeText(Text*, const String& text, ExceptionState&);
+    bool replaceChild(Node* parentNode, PassRefPtr<Node> newNode, Node* oldNode, ExceptionState&);
+    bool setNodeValue(Node* parentNode, const String& value, ExceptionState&);
 
     bool insertBefore(Node* parentNode, PassRefPtr<Node>, Node* anchorNode, ErrorString*);
     bool removeChild(Node* parentNode, Node*, ErrorString*);
diff --git a/Source/core/inspector/DOMPatchSupport.cpp b/Source/core/inspector/DOMPatchSupport.cpp
index 60978ab..70afeda 100644
--- a/Source/core/inspector/DOMPatchSupport.cpp
+++ b/Source/core/inspector/DOMPatchSupport.cpp
@@ -32,6 +32,8 @@
 #include "core/inspector/DOMPatchSupport.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Attribute.h"
 #include "core/dom/ContextFeatures.h"
 #include "core/dom/Document.h"
@@ -106,14 +108,14 @@
     OwnPtr<Digest> oldInfo = createDigest(m_document->documentElement(), 0);
     OwnPtr<Digest> newInfo = createDigest(newDocument->documentElement(), &m_unusedNodesMap);
 
-    if (!innerPatchNode(oldInfo.get(), newInfo.get(), IGNORE_EXCEPTION)) {
+    if (!innerPatchNode(oldInfo.get(), newInfo.get(), IGNORE_EXCEPTION_STATE)) {
         // Fall back to rewrite.
         m_document->write(markup);
         m_document->close();
     }
 }
 
-Node* DOMPatchSupport::patchNode(Node* node, const String& markup, ExceptionCode& ec)
+Node* DOMPatchSupport::patchNode(Node* node, const String& markup, ExceptionState& es)
 {
     // Don't parse <html> as a fragment.
     if (node->isDocumentNode() || (node->parentNode() && node->parentNode()->isDocumentNode())) {
@@ -151,16 +153,16 @@
     for (Node* child = node->nextSibling(); child; child = child->nextSibling())
         newList.append(createDigest(child, 0));
 
-    if (!innerPatchChildren(parentNode, oldList, newList, ec)) {
+    if (!innerPatchChildren(parentNode, oldList, newList, es)) {
         // Fall back to total replace.
-        ec = 0;
-        if (!m_domEditor->replaceChild(parentNode, fragment.release(), node, ec))
+        es.clearException();
+        if (!m_domEditor->replaceChild(parentNode, fragment.release(), node, es))
             return 0;
     }
     return previousSibling ? previousSibling->nextSibling() : parentNode->firstChild();
 }
 
-bool DOMPatchSupport::innerPatchNode(Digest* oldDigest, Digest* newDigest, ExceptionCode& ec)
+bool DOMPatchSupport::innerPatchNode(Digest* oldDigest, Digest* newDigest, ExceptionState& es)
 {
     if (oldDigest->m_sha1 == newDigest->m_sha1)
         return true;
@@ -169,10 +171,10 @@
     Node* newNode = newDigest->m_node;
 
     if (newNode->nodeType() != oldNode->nodeType() || newNode->nodeName() != oldNode->nodeName())
-        return m_domEditor->replaceChild(oldNode->parentNode(), newNode, oldNode, ec);
+        return m_domEditor->replaceChild(oldNode->parentNode(), newNode, oldNode, es);
 
     if (oldNode->nodeValue() != newNode->nodeValue()) {
-        if (!m_domEditor->setNodeValue(oldNode, newNode->nodeValue(), ec))
+        if (!m_domEditor->setNodeValue(oldNode, newNode->nodeValue(), es))
             return false;
     }
 
@@ -187,7 +189,7 @@
         if (oldElement->hasAttributesWithoutUpdate()) {
             while (oldElement->attributeCount()) {
                 const Attribute* attribute = oldElement->attributeItem(0);
-                if (!m_domEditor->removeAttribute(oldElement, attribute->localName(), ec))
+                if (!m_domEditor->removeAttribute(oldElement, attribute->localName(), es))
                     return false;
             }
         }
@@ -197,13 +199,13 @@
             size_t numAttrs = newElement->attributeCount();
             for (size_t i = 0; i < numAttrs; ++i) {
                 const Attribute* attribute = newElement->attributeItem(i);
-                if (!m_domEditor->setAttribute(oldElement, attribute->name().localName(), attribute->value(), ec))
+                if (!m_domEditor->setAttribute(oldElement, attribute->name().localName(), attribute->value(), es))
                     return false;
             }
         }
     }
 
-    bool result = innerPatchChildren(oldElement, oldDigest->m_children, newDigest->m_children, ec);
+    bool result = innerPatchChildren(oldElement, oldDigest->m_children, newDigest->m_children, es);
     m_unusedNodesMap.remove(newDigest->m_sha1);
     return result;
 }
@@ -296,7 +298,7 @@
     return make_pair(oldMap, newMap);
 }
 
-bool DOMPatchSupport::innerPatchChildren(ContainerNode* parentNode, const Vector<OwnPtr<Digest> >& oldList, const Vector<OwnPtr<Digest> >& newList, ExceptionCode& ec)
+bool DOMPatchSupport::innerPatchChildren(ContainerNode* parentNode, const Vector<OwnPtr<Digest> >& oldList, const Vector<OwnPtr<Digest> >& newList, ExceptionState& es)
 {
     pair<ResultMap, ResultMap> resultMaps = diff(oldList, newList);
     ResultMap& oldMap = resultMaps.first;
@@ -334,11 +336,11 @@
             if (anchorAfter - anchorCandidate == 1 && anchorCandidate < newList.size())
                 merges.set(newList[anchorCandidate].get(), oldList[i].get());
             else {
-                if (!removeChildAndMoveToNew(oldList[i].get(), ec))
+                if (!removeChildAndMoveToNew(oldList[i].get(), es))
                     return false;
             }
         } else {
-            if (!removeChildAndMoveToNew(oldList[i].get(), ec))
+            if (!removeChildAndMoveToNew(oldList[i].get(), es))
                 return false;
         }
     }
@@ -371,7 +373,7 @@
 
     // 2. Patch nodes marked for merge.
     for (HashMap<Digest*, Digest*>::iterator it = merges.begin(); it != merges.end(); ++it) {
-        if (!innerPatchNode(it->value, it->key, ec))
+        if (!innerPatchNode(it->value, it->key, es))
             return false;
     }
 
@@ -379,7 +381,7 @@
     for (size_t i = 0; i < newMap.size(); ++i) {
         if (newMap[i].first || merges.contains(newList[i].get()))
             continue;
-        if (!insertBeforeAndMarkAsUsed(parentNode, newList[i].get(), parentNode->childNode(i), ec))
+        if (!insertBeforeAndMarkAsUsed(parentNode, newList[i].get(), parentNode->childNode(i), es))
             return false;
     }
 
@@ -394,7 +396,7 @@
         if (node->hasTagName(bodyTag) || node->hasTagName(headTag))
             continue; // Never move head or body, move the rest of the nodes around them.
 
-        if (!m_domEditor->insertBefore(parentNode, node.release(), anchorNode, ec))
+        if (!m_domEditor->insertBefore(parentNode, node.release(), anchorNode, es))
             return false;
     }
     return true;
@@ -450,17 +452,17 @@
     return adoptPtr(digest);
 }
 
-bool DOMPatchSupport::insertBeforeAndMarkAsUsed(ContainerNode* parentNode, Digest* digest, Node* anchor, ExceptionCode& ec)
+bool DOMPatchSupport::insertBeforeAndMarkAsUsed(ContainerNode* parentNode, Digest* digest, Node* anchor, ExceptionState& es)
 {
-    bool result = m_domEditor->insertBefore(parentNode, digest->m_node, anchor, ec);
+    bool result = m_domEditor->insertBefore(parentNode, digest->m_node, anchor, es);
     markNodeAsUsed(digest);
     return result;
 }
 
-bool DOMPatchSupport::removeChildAndMoveToNew(Digest* oldDigest, ExceptionCode& ec)
+bool DOMPatchSupport::removeChildAndMoveToNew(Digest* oldDigest, ExceptionState& es)
 {
     RefPtr<Node> oldNode = oldDigest->m_node;
-    if (!m_domEditor->removeChild(oldNode->parentNode(), oldNode.get(), ec))
+    if (!m_domEditor->removeChild(oldNode->parentNode(), oldNode.get(), es))
         return false;
 
     // Diff works within levels. In order not to lose the node identity when user
@@ -472,7 +474,7 @@
     if (it != m_unusedNodesMap.end()) {
         Digest* newDigest = it->value;
         Node* newNode = newDigest->m_node;
-        if (!m_domEditor->replaceChild(newNode->parentNode(), oldNode, newNode, ec))
+        if (!m_domEditor->replaceChild(newNode->parentNode(), oldNode, newNode, es))
             return false;
         newDigest->m_node = oldNode.get();
         markNodeAsUsed(newDigest);
@@ -480,7 +482,7 @@
     }
 
     for (size_t i = 0; i < oldDigest->m_children.size(); ++i) {
-        if (!removeChildAndMoveToNew(oldDigest->m_children[i].get(), ec))
+        if (!removeChildAndMoveToNew(oldDigest->m_children[i].get(), es))
             return false;
     }
     return true;
diff --git a/Source/core/inspector/DOMPatchSupport.h b/Source/core/inspector/DOMPatchSupport.h
index f261ecf..f843c83 100644
--- a/Source/core/inspector/DOMPatchSupport.h
+++ b/Source/core/inspector/DOMPatchSupport.h
@@ -31,7 +31,6 @@
 #ifndef DOMPatchSupport_h
 #define DOMPatchSupport_h
 
-#include "core/dom/ExceptionCode.h"
 #include "wtf/HashMap.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
@@ -43,9 +42,9 @@
 class ContainerNode;
 class DOMEditor;
 class Document;
+class ExceptionState;
 class Node;
 
-
 class DOMPatchSupport {
     WTF_MAKE_NONCOPYABLE(DOMPatchSupport);
 public:
@@ -55,19 +54,19 @@
     virtual ~DOMPatchSupport();
 
     void patchDocument(const String& markup);
-    Node* patchNode(Node*, const String& markup, ExceptionCode&);
+    Node* patchNode(Node*, const String& markup, ExceptionState&);
 
 private:
     struct Digest;
     typedef Vector<pair<Digest*, size_t> > ResultMap;
     typedef HashMap<String, Digest*> UnusedNodesMap;
 
-    bool innerPatchNode(Digest* oldNode, Digest* newNode, ExceptionCode&);
+    bool innerPatchNode(Digest* oldNode, Digest* newNode, ExceptionState&);
     std::pair<ResultMap, ResultMap> diff(const Vector<OwnPtr<Digest> >& oldChildren, const Vector<OwnPtr<Digest> >& newChildren);
-    bool innerPatchChildren(ContainerNode*, const Vector<OwnPtr<Digest> >& oldChildren, const Vector<OwnPtr<Digest> >& newChildren, ExceptionCode&);
+    bool innerPatchChildren(ContainerNode*, const Vector<OwnPtr<Digest> >& oldChildren, const Vector<OwnPtr<Digest> >& newChildren, ExceptionState&);
     PassOwnPtr<Digest> createDigest(Node*, UnusedNodesMap*);
-    bool insertBeforeAndMarkAsUsed(ContainerNode*, Digest*, Node* anchor, ExceptionCode&);
-    bool removeChildAndMoveToNew(Digest*, ExceptionCode&);
+    bool insertBeforeAndMarkAsUsed(ContainerNode*, Digest*, Node* anchor, ExceptionState&);
+    bool removeChildAndMoveToNew(Digest*, ExceptionState&);
     void markNodeAsUsed(Digest*);
 #ifdef DEBUG_DOM_PATCH_SUPPORT
     void dumpMap(const ResultMap&, const String& name);
diff --git a/Source/core/inspector/InspectorAgent.cpp b/Source/core/inspector/InspectorAgent.cpp
index faedf80..51436c3 100644
--- a/Source/core/inspector/InspectorAgent.cpp
+++ b/Source/core/inspector/InspectorAgent.cpp
@@ -47,8 +47,6 @@
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/text/StringBuilder.h"
 
-using namespace std;
-
 namespace WebCore {
 
 namespace InspectorAgentState {
diff --git a/Source/core/inspector/InspectorCSSAgent.cpp b/Source/core/inspector/InspectorCSSAgent.cpp
index e07fa5d..a8d9183 100644
--- a/Source/core/inspector/InspectorCSSAgent.cpp
+++ b/Source/core/inspector/InspectorCSSAgent.cpp
@@ -43,7 +43,6 @@
 #include "core/css/StyleSheetContents.h"
 #include "core/css/StyleSheetList.h"
 #include "core/css/resolver/StyleResolver.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/NamedFlow.h"
 #include "core/dom/NamedFlowCollection.h"
 #include "core/dom/Node.h"
@@ -268,25 +267,25 @@
     {
     }
 
-    virtual bool perform(ExceptionCode& ec)
+    virtual bool perform(ExceptionState& es)
     {
         if (!m_styleSheet->getText(&m_oldText))
             return false;
-        return redo(ec);
+        return redo(es);
     }
 
-    virtual bool undo(ExceptionCode& ec)
+    virtual bool undo(ExceptionState& es)
     {
-        if (m_styleSheet->setText(m_oldText, ec)) {
+        if (m_styleSheet->setText(m_oldText, es)) {
             m_styleSheet->reparseStyleSheet(m_oldText);
             return true;
         }
         return false;
     }
 
-    virtual bool redo(ExceptionCode& ec)
+    virtual bool redo(ExceptionState& es)
     {
-        if (m_styleSheet->setText(m_text, ec)) {
+        if (m_styleSheet->setText(m_text, es)) {
             m_styleSheet->reparseStyleSheet(m_text);
             return true;
         }
@@ -326,20 +325,20 @@
         return mergeId() + ": " + m_oldText + " -> " + m_text;
     }
 
-    virtual bool perform(ExceptionCode& ec)
+    virtual bool perform(ExceptionState& es)
     {
-        return redo(ec);
+        return redo(es);
     }
 
-    virtual bool undo(ExceptionCode& ec)
+    virtual bool undo(ExceptionState& es)
     {
         String placeholder;
-        return m_styleSheet->setStyleText(m_cssId, m_oldText, &placeholder, ec);
+        return m_styleSheet->setStyleText(m_cssId, m_oldText, &placeholder, es);
     }
 
-    virtual bool redo(ExceptionCode& ec)
+    virtual bool redo(ExceptionState& es)
     {
-        return m_styleSheet->setStyleText(m_cssId, m_text, &m_oldText, ec);
+        return m_styleSheet->setStyleText(m_cssId, m_text, &m_oldText, es);
     }
 
     virtual String mergeId()
@@ -378,21 +377,21 @@
         return mergeId() + ": " + m_oldText + " -> " + m_text;
     }
 
-    virtual bool perform(ExceptionCode& ec)
+    virtual bool perform(ExceptionState& es)
     {
-        return redo(ec);
+        return redo(es);
     }
 
-    virtual bool undo(ExceptionCode& ec)
+    virtual bool undo(ExceptionState& es)
     {
         String placeholder;
-        return m_styleSheet->setPropertyText(m_cssId, m_propertyIndex, m_overwrite ? m_oldText : "", true, &placeholder, ec);
+        return m_styleSheet->setPropertyText(m_cssId, m_propertyIndex, m_overwrite ? m_oldText : "", true, &placeholder, es);
     }
 
-    virtual bool redo(ExceptionCode& ec)
+    virtual bool redo(ExceptionState& es)
     {
         String oldText;
-        bool result = m_styleSheet->setPropertyText(m_cssId, m_propertyIndex, m_text, m_overwrite, &oldText, ec);
+        bool result = m_styleSheet->setPropertyText(m_cssId, m_propertyIndex, m_text, m_overwrite, &oldText, es);
         m_oldText = oldText.stripWhiteSpace();
         // FIXME: remove this once the model handles this case.
         if (!m_oldText.endsWith(';'))
@@ -432,19 +431,19 @@
     {
     }
 
-    virtual bool perform(ExceptionCode& ec)
+    virtual bool perform(ExceptionState& es)
     {
-        return redo(ec);
+        return redo(es);
     }
 
-    virtual bool undo(ExceptionCode& ec)
+    virtual bool undo(ExceptionState& es)
     {
-        return m_styleSheet->toggleProperty(m_cssId, m_propertyIndex, !m_disable, ec);
+        return m_styleSheet->toggleProperty(m_cssId, m_propertyIndex, !m_disable, es);
     }
 
-    virtual bool redo(ExceptionCode& ec)
+    virtual bool redo(ExceptionState& es)
     {
-        return m_styleSheet->toggleProperty(m_cssId, m_propertyIndex, m_disable, ec);
+        return m_styleSheet->toggleProperty(m_cssId, m_propertyIndex, m_disable, es);
     }
 
 private:
@@ -463,22 +462,22 @@
     {
     }
 
-    virtual bool perform(ExceptionCode& ec)
+    virtual bool perform(ExceptionState& es)
     {
-        m_oldSelector = m_styleSheet->ruleSelector(m_cssId, ec);
-        if (ec)
+        m_oldSelector = m_styleSheet->ruleSelector(m_cssId, es);
+        if (es.hadException())
             return false;
-        return redo(ec);
+        return redo(es);
     }
 
-    virtual bool undo(ExceptionCode& ec)
+    virtual bool undo(ExceptionState& es)
     {
-        return m_styleSheet->setRuleSelector(m_cssId, m_oldSelector, ec);
+        return m_styleSheet->setRuleSelector(m_cssId, m_oldSelector, es);
     }
 
-    virtual bool redo(ExceptionCode& ec)
+    virtual bool redo(ExceptionState& es)
     {
-        return m_styleSheet->setRuleSelector(m_cssId, m_selector, ec);
+        return m_styleSheet->setRuleSelector(m_cssId, m_selector, es);
     }
 
 private:
@@ -496,20 +495,20 @@
     {
     }
 
-    virtual bool perform(ExceptionCode& ec)
+    virtual bool perform(ExceptionState& es)
     {
-        return redo(ec);
+        return redo(es);
     }
 
-    virtual bool undo(ExceptionCode& ec)
+    virtual bool undo(ExceptionState& es)
     {
-        return m_styleSheet->deleteRule(m_newId, ec);
+        return m_styleSheet->deleteRule(m_newId, es);
     }
 
-    virtual bool redo(ExceptionCode& ec)
+    virtual bool redo(ExceptionState& es)
     {
-        CSSStyleRule* cssStyleRule = m_styleSheet->addRule(m_selector, ec);
-        if (ec)
+        CSSStyleRule* cssStyleRule = m_styleSheet->addRule(m_selector, es);
+        if (es.hadException())
             return false;
         m_newId = m_styleSheet->ruleId(cssStyleRule);
         return true;
@@ -1081,9 +1080,9 @@
     if (!inspectorStyleSheet)
         return;
 
-    ExceptionCode ec = 0;
-    m_domAgent->history()->perform(adoptPtr(new SetStyleSheetTextAction(inspectorStyleSheet, text)), ec);
-    *errorString = InspectorDOMAgent::toErrorString(ec);
+    TrackExceptionState es;
+    m_domAgent->history()->perform(adoptPtr(new SetStyleSheetTextAction(inspectorStyleSheet, text)), es);
+    *errorString = InspectorDOMAgent::toErrorString(es);
 }
 
 void InspectorCSSAgent::setStyleText(ErrorString* errorString, const RefPtr<JSONObject>& fullStyleId, const String& text, RefPtr<TypeBuilder::CSS::CSSStyle>& result)
@@ -1095,11 +1094,11 @@
     if (!inspectorStyleSheet)
         return;
 
-    ExceptionCode ec = 0;
-    m_domAgent->history()->perform(adoptPtr(new SetStyleTextAction(inspectorStyleSheet, compoundId, text)), ec);
-    if (!ec)
+    TrackExceptionState es;
+    m_domAgent->history()->perform(adoptPtr(new SetStyleTextAction(inspectorStyleSheet, compoundId, text)), es);
+    if (!es.hadException())
         result = inspectorStyleSheet->buildObjectForStyle(inspectorStyleSheet->styleForId(compoundId));
-    *errorString = InspectorDOMAgent::toErrorString(ec);
+    *errorString = InspectorDOMAgent::toErrorString(es);
 }
 
 void InspectorCSSAgent::setPropertyText(ErrorString* errorString, const RefPtr<JSONObject>& fullStyleId, int propertyIndex, const String& text, bool overwrite, RefPtr<TypeBuilder::CSS::CSSStyle>& result)
@@ -1111,11 +1110,11 @@
     if (!inspectorStyleSheet)
         return;
 
-    ExceptionCode ec = 0;
-    bool success = m_domAgent->history()->perform(adoptPtr(new SetPropertyTextAction(inspectorStyleSheet, compoundId, propertyIndex, text, overwrite)), ec);
+    TrackExceptionState es;
+    bool success = m_domAgent->history()->perform(adoptPtr(new SetPropertyTextAction(inspectorStyleSheet, compoundId, propertyIndex, text, overwrite)), es);
     if (success)
         result = inspectorStyleSheet->buildObjectForStyle(inspectorStyleSheet->styleForId(compoundId));
-    *errorString = InspectorDOMAgent::toErrorString(ec);
+    *errorString = InspectorDOMAgent::toErrorString(es);
 }
 
 void InspectorCSSAgent::toggleProperty(ErrorString* errorString, const RefPtr<JSONObject>& fullStyleId, int propertyIndex, bool disable, RefPtr<TypeBuilder::CSS::CSSStyle>& result)
@@ -1127,11 +1126,11 @@
     if (!inspectorStyleSheet)
         return;
 
-    ExceptionCode ec = 0;
-    bool success = m_domAgent->history()->perform(adoptPtr(new TogglePropertyAction(inspectorStyleSheet, compoundId, propertyIndex, disable)), ec);
+    TrackExceptionState es;
+    bool success = m_domAgent->history()->perform(adoptPtr(new TogglePropertyAction(inspectorStyleSheet, compoundId, propertyIndex, disable)), es);
     if (success)
         result = inspectorStyleSheet->buildObjectForStyle(inspectorStyleSheet->styleForId(compoundId));
-    *errorString = InspectorDOMAgent::toErrorString(ec);
+    *errorString = InspectorDOMAgent::toErrorString(es);
 }
 
 void InspectorCSSAgent::setRuleSelector(ErrorString* errorString, const RefPtr<JSONObject>& fullRuleId, const String& selector, RefPtr<TypeBuilder::CSS::CSSRule>& result)
@@ -1143,14 +1142,14 @@
     if (!inspectorStyleSheet)
         return;
 
-    ExceptionCode ec = 0;
-    bool success = m_domAgent->history()->perform(adoptPtr(new SetRuleSelectorAction(inspectorStyleSheet, compoundId, selector)), ec);
+    TrackExceptionState es;
+    bool success = m_domAgent->history()->perform(adoptPtr(new SetRuleSelectorAction(inspectorStyleSheet, compoundId, selector)), es);
 
     if (success) {
         CSSStyleRule* rule = inspectorStyleSheet->ruleForId(compoundId);
         result = inspectorStyleSheet->buildObjectForRule(rule, buildMediaListChain(rule));
     }
-    *errorString = InspectorDOMAgent::toErrorString(ec);
+    *errorString = InspectorDOMAgent::toErrorString(es);
 }
 
 void InspectorCSSAgent::addRule(ErrorString* errorString, const int contextNodeId, const String& selector, RefPtr<TypeBuilder::CSS::CSSRule>& result)
@@ -1165,12 +1164,12 @@
         return;
     }
 
-    ExceptionCode ec = 0;
+    TrackExceptionState es;
     OwnPtr<AddRuleAction> action = adoptPtr(new AddRuleAction(inspectorStyleSheet, selector));
     AddRuleAction* rawAction = action.get();
-    bool success = m_domAgent->history()->perform(action.release(), ec);
+    bool success = m_domAgent->history()->perform(action.release(), es);
     if (!success) {
-        *errorString = InspectorDOMAgent::toErrorString(ec);
+        *errorString = InspectorDOMAgent::toErrorString(es);
         return;
     }
 
@@ -1451,11 +1450,11 @@
     if (inspectorStyleSheet || !createIfAbsent)
         return inspectorStyleSheet.get();
 
-    ExceptionCode ec = 0;
-    RefPtr<Element> styleElement = document->createElement("style", ec);
-    if (!ec)
-        styleElement->setAttribute("type", "text/css", ec);
-    if (!ec) {
+    TrackExceptionState es;
+    RefPtr<Element> styleElement = document->createElement("style", es);
+    if (!es.hadException())
+        styleElement->setAttribute("type", "text/css", es);
+    if (!es.hadException()) {
         ContainerNode* targetNode;
         // HEAD is absent in ImageDocuments, for example.
         if (document->head())
@@ -1467,12 +1466,12 @@
 
         InlineStyleOverrideScope overrideScope(document);
         m_creatingViaInspectorStyleSheet = true;
-        targetNode->appendChild(styleElement, ec, AttachLazily);
+        targetNode->appendChild(styleElement, es, AttachLazily);
         // At this point the added stylesheet will get bound through the updateActiveStyleSheets() invocation.
         // We just need to pick the respective InspectorStyleSheet from m_documentToInspectorStyleSheet.
         m_creatingViaInspectorStyleSheet = false;
     }
-    if (ec)
+    if (es.hadException())
         return 0;
 
     return m_documentToInspectorStyleSheet.get(document);
@@ -1557,7 +1556,7 @@
         const CSSSelectorList& selectorList = rule->styleRule()->selectorList();
         long index = 0;
         for (const CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(selector)) {
-            bool matched = element->webkitMatchesSelector(selector->selectorText(), IGNORE_EXCEPTION);
+            bool matched = element->webkitMatchesSelector(selector->selectorText(), IGNORE_EXCEPTION_STATE);
             if (matched)
                 matchingSelectors->addItem(index);
             ++index;
diff --git a/Source/core/inspector/InspectorDOMAgent.cpp b/Source/core/inspector/InspectorDOMAgent.cpp
index 5de1f85..d7c46bf 100644
--- a/Source/core/inspector/InspectorDOMAgent.cpp
+++ b/Source/core/inspector/InspectorDOMAgent.cpp
@@ -33,6 +33,8 @@
 
 #include "HTMLNames.h"
 #include "InspectorFrontend.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "bindings/v8/ScriptEventListener.h"
 #include "core/dom/Attr.h"
 #include "core/dom/CharacterData.h"
@@ -212,10 +214,10 @@
     m_elements.clear();
 }
 
-String InspectorDOMAgent::toErrorString(const ExceptionCode& ec)
+String InspectorDOMAgent::toErrorString(ExceptionState& es)
 {
-    if (ec)
-        return DOMException::getErrorName(ec);
+    if (es.hadException())
+        return DOMException::getErrorName(es);
     return "";
 }
 
@@ -541,9 +543,9 @@
     if (!node)
         return;
 
-    ExceptionCode ec = 0;
-    RefPtr<Element> element = node->querySelector(selectors, ec);
-    if (ec) {
+    TrackExceptionState es;
+    RefPtr<Element> element = node->querySelector(selectors, es);
+    if (es.hadException()) {
         *errorString = "DOM Error while querying";
         return;
     }
@@ -558,9 +560,9 @@
     if (!node)
         return;
 
-    ExceptionCode ec = 0;
-    RefPtr<NodeList> nodes = node->querySelectorAll(selectors, ec);
-    if (ec) {
+    TrackExceptionState es;
+    RefPtr<NodeList> nodes = node->querySelectorAll(selectors, es);
+    if (es.hadException()) {
         *errorString = "DOM Error while querying";
         return;
     }
@@ -741,9 +743,9 @@
     if (!oldNode || !oldNode->isElementNode())
         return;
 
-    ExceptionCode ec = 0;
-    RefPtr<Element> newElem = oldNode->document()->createElement(tagName, ec);
-    if (ec)
+    TrackExceptionState es;
+    RefPtr<Element> newElem = oldNode->document()->createElement(tagName, es);
+    if (es.hadException())
         return;
 
     // Copy over the original node's attributes.
@@ -976,15 +978,15 @@
         // XPath evaluation
         for (Vector<Document*>::iterator it = docs.begin(); it != docs.end(); ++it) {
             Document* document = *it;
-            ExceptionCode ec = 0;
-            RefPtr<XPathResult> result = DocumentXPathEvaluator::evaluate(document, whitespaceTrimmedQuery, document, 0, XPathResult::ORDERED_NODE_SNAPSHOT_TYPE, 0, ec);
-            if (ec || !result)
+            TrackExceptionState es;
+            RefPtr<XPathResult> result = DocumentXPathEvaluator::evaluate(document, whitespaceTrimmedQuery, document, 0, XPathResult::ORDERED_NODE_SNAPSHOT_TYPE, 0, es);
+            if (es.hadException() || !result)
                 continue;
 
-            unsigned long size = result->snapshotLength(ec);
-            for (unsigned long i = 0; !ec && i < size; ++i) {
-                Node* node = result->snapshotItem(i, ec);
-                if (ec)
+            unsigned long size = result->snapshotLength(es);
+            for (unsigned long i = 0; !es.hadException() && i < size; ++i) {
+                Node* node = result->snapshotItem(i, es);
+                if (es.hadException())
                     break;
 
                 if (node->nodeType() == Node::ATTRIBUTE_NODE)
@@ -996,9 +998,9 @@
         // Selector evaluation
         for (Vector<Document*>::iterator it = docs.begin(); it != docs.end(); ++it) {
             Document* document = *it;
-            ExceptionCode ec = 0;
-            RefPtr<NodeList> nodeList = document->querySelectorAll(whitespaceTrimmedQuery, ec);
-            if (ec || !nodeList)
+            TrackExceptionState es;
+            RefPtr<NodeList> nodeList = document->querySelectorAll(whitespaceTrimmedQuery, es);
+            if (es.hadException() || !nodeList)
                 continue;
 
             unsigned size = nodeList->length();
@@ -1239,16 +1241,16 @@
 
 void InspectorDOMAgent::undo(ErrorString* errorString)
 {
-    ExceptionCode ec = 0;
-    m_history->undo(ec);
-    *errorString = InspectorDOMAgent::toErrorString(ec);
+    TrackExceptionState es;
+    m_history->undo(es);
+    *errorString = InspectorDOMAgent::toErrorString(es);
 }
 
 void InspectorDOMAgent::redo(ErrorString* errorString)
 {
-    ExceptionCode ec = 0;
-    m_history->redo(ec);
-    *errorString = InspectorDOMAgent::toErrorString(ec);
+    TrackExceptionState es;
+    m_history->redo(es);
+    *errorString = InspectorDOMAgent::toErrorString(es);
 }
 
 void InspectorDOMAgent::markUndoableState(ErrorString*)
diff --git a/Source/core/inspector/InspectorDOMAgent.h b/Source/core/inspector/InspectorDOMAgent.h
index 17e7a5e..c143fa2 100644
--- a/Source/core/inspector/InspectorDOMAgent.h
+++ b/Source/core/inspector/InspectorDOMAgent.h
@@ -46,18 +46,20 @@
 #include "wtf/text/AtomicString.h"
 
 namespace WebCore {
-class ContainerNode;
+
 class CharacterData;
+class ContainerNode;
 class DOMEditor;
 class Document;
 class Element;
 class Event;
+class ExceptionState;
+class HTMLElement;
 class InspectorClient;
 class InspectorFrontend;
 class InspectorHistory;
 class InspectorOverlay;
 class InspectorPageAgent;
-class HTMLElement;
 class InspectorState;
 class InstrumentingAgents;
 class NameNodeMap;
@@ -103,7 +105,7 @@
         return adoptPtr(new InspectorDOMAgent(instrumentingAgents, pageAgent, inspectorState, injectedScriptManager, overlay, client));
     }
 
-    static String toErrorString(const ExceptionCode&);
+    static String toErrorString(ExceptionState&);
 
     ~InspectorDOMAgent();
 
diff --git a/Source/core/inspector/InspectorDOMStorageAgent.cpp b/Source/core/inspector/InspectorDOMStorageAgent.cpp
index 8656ada..fd079bb 100644
--- a/Source/core/inspector/InspectorDOMStorageAgent.cpp
+++ b/Source/core/inspector/InspectorDOMStorageAgent.cpp
@@ -31,6 +31,7 @@
 #include "core/inspector/InspectorDOMStorageAgent.h"
 
 #include "InspectorFrontend.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/DOMException.h"
 #include "core/dom/Document.h"
 #include "core/dom/ExceptionCode.h"
@@ -115,13 +116,13 @@
 
     RefPtr<TypeBuilder::Array<TypeBuilder::Array<String> > > storageItems = TypeBuilder::Array<TypeBuilder::Array<String> >::create();
 
-    ExceptionCode ec = 0;
-    for (unsigned i = 0; i < storageArea->length(ec, frame); ++i) {
-        String name(storageArea->key(i, ec, frame));
-        if (hadException(ec, errorString))
+    TrackExceptionState es;
+    for (unsigned i = 0; i < storageArea->length(es, frame); ++i) {
+        String name(storageArea->key(i, es, frame));
+        if (hadException(es, errorString))
             return;
-        String value(storageArea->getItem(name, ec, frame));
-        if (hadException(ec, errorString))
+        String value(storageArea->getItem(name, es, frame));
+        if (hadException(es, errorString))
             return;
         RefPtr<TypeBuilder::Array<String> > entry = TypeBuilder::Array<String>::create();
         entry->addItem(name);
@@ -131,10 +132,10 @@
     items = storageItems.release();
 }
 
-static String toErrorString(const ExceptionCode& ec)
+static String toErrorString(ExceptionState& es)
 {
-    if (ec)
-        return DOMException::getErrorName(ec);
+    if (es.hadException())
+        return DOMException::getErrorName(es);
     return "";
 }
 
@@ -147,9 +148,9 @@
         return;
     }
 
-    ExceptionCode exception = 0;
-    storageArea->setItem(key, value, exception, frame);
-    *errorString = toErrorString(exception);
+    TrackExceptionState es;
+    storageArea->setItem(key, value, es, frame);
+    *errorString = toErrorString(es);
 }
 
 void InspectorDOMStorageAgent::removeDOMStorageItem(ErrorString* errorString, const RefPtr<JSONObject>& storageId, const String& key)
@@ -161,9 +162,9 @@
         return;
     }
 
-    ExceptionCode exception = 0;
-    storageArea->removeItem(key, exception, frame);
-    *errorString = toErrorString(exception);
+    TrackExceptionState es;
+    storageArea->removeItem(key, es, frame);
+    *errorString = toErrorString(es);
 }
 
 String InspectorDOMStorageAgent::storageId(Storage* storage)
diff --git a/Source/core/inspector/InspectorFileSystemAgent.cpp b/Source/core/inspector/InspectorFileSystemAgent.cpp
index fffd4dc..a58e182 100644
--- a/Source/core/inspector/InspectorFileSystemAgent.cpp
+++ b/Source/core/inspector/InspectorFileSystemAgent.cpp
@@ -31,6 +31,7 @@
 #include "config.h"
 #include "core/inspector/InspectorFileSystemAgent.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/DOMImplementation.h"
 #include "core/dom/Document.h"
 #include "core/dom/Event.h"
@@ -494,7 +495,7 @@
     m_reader->setOnload(this);
     m_reader->setOnerror(this);
 
-    m_reader->readAsArrayBuffer(blob.get(), IGNORE_EXCEPTION);
+    m_reader->readAsArrayBuffer(blob.get(), IGNORE_EXCEPTION_STATE);
     return true;
 }
 
diff --git a/Source/core/inspector/InspectorFrontendHost.cpp b/Source/core/inspector/InspectorFrontendHost.cpp
index 2d24786..333afc2 100644
--- a/Source/core/inspector/InspectorFrontendHost.cpp
+++ b/Source/core/inspector/InspectorFrontendHost.cpp
@@ -49,8 +49,6 @@
 #include "core/rendering/RenderTheme.h"
 #include "modules/filesystem/DOMFileSystem.h"
 
-using namespace std;
-
 namespace WebCore {
 
 class FrontendMenuProvider : public ContextMenuProvider {
diff --git a/Source/core/inspector/InspectorHistory.cpp b/Source/core/inspector/InspectorHistory.cpp
index 565c142..2ce8091 100644
--- a/Source/core/inspector/InspectorHistory.cpp
+++ b/Source/core/inspector/InspectorHistory.cpp
@@ -31,7 +31,8 @@
 #include "config.h"
 #include "core/inspector/InspectorHistory.h"
 
-#include "core/dom/ExceptionCodePlaceholder.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Node.h"
 
 namespace WebCore {
@@ -42,11 +43,11 @@
 public:
     UndoableStateMark() : InspectorHistory::Action("[UndoableState]") { }
 
-    virtual bool perform(ExceptionCode&) { return true; }
+    virtual bool perform(ExceptionState&) { return true; }
 
-    virtual bool undo(ExceptionCode&) { return true; }
+    virtual bool undo(ExceptionState&) { return true; }
 
-    virtual bool redo(ExceptionCode&) { return true; }
+    virtual bool redo(ExceptionState&) { return true; }
 
     virtual bool isUndoableStateMark() { return true; }
 };
@@ -84,9 +85,9 @@
 
 InspectorHistory::~InspectorHistory() { }
 
-bool InspectorHistory::perform(PassOwnPtr<Action> action, ExceptionCode& ec)
+bool InspectorHistory::perform(PassOwnPtr<Action> action, ExceptionState& es)
 {
-    if (!action->perform(ec))
+    if (!action->perform(es))
         return false;
 
     if (!action->mergeId().isEmpty() && m_afterLastActionIndex > 0 && action->mergeId() == m_history[m_afterLastActionIndex - 1]->mergeId())
@@ -101,17 +102,17 @@
 
 void InspectorHistory::markUndoableState()
 {
-    perform(adoptPtr(new UndoableStateMark()), IGNORE_EXCEPTION);
+    perform(adoptPtr(new UndoableStateMark()), IGNORE_EXCEPTION_STATE);
 }
 
-bool InspectorHistory::undo(ExceptionCode& ec)
+bool InspectorHistory::undo(ExceptionState& es)
 {
     while (m_afterLastActionIndex > 0 && m_history[m_afterLastActionIndex - 1]->isUndoableStateMark())
         --m_afterLastActionIndex;
 
     while (m_afterLastActionIndex > 0) {
         Action* action = m_history[m_afterLastActionIndex - 1].get();
-        if (!action->undo(ec)) {
+        if (!action->undo(es)) {
             reset();
             return false;
         }
@@ -123,14 +124,14 @@
     return true;
 }
 
-bool InspectorHistory::redo(ExceptionCode& ec)
+bool InspectorHistory::redo(ExceptionState& es)
 {
     while (m_afterLastActionIndex < m_history.size() && m_history[m_afterLastActionIndex]->isUndoableStateMark())
         ++m_afterLastActionIndex;
 
     while (m_afterLastActionIndex < m_history.size()) {
         Action* action = m_history[m_afterLastActionIndex].get();
-        if (!action->redo(ec)) {
+        if (!action->redo(es)) {
             reset();
             return false;
         }
diff --git a/Source/core/inspector/InspectorHistory.h b/Source/core/inspector/InspectorHistory.h
index 72fd5bc..cdd1e8f 100644
--- a/Source/core/inspector/InspectorHistory.h
+++ b/Source/core/inspector/InspectorHistory.h
@@ -31,7 +31,6 @@
 #ifndef InspectorHistory_h
 #define InspectorHistory_h
 
-#include "core/dom/ExceptionCode.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/Vector.h"
 #include "wtf/text/WTFString.h"
@@ -40,6 +39,7 @@
 
 class ContainerNode;
 class Element;
+class ExceptionState;
 class Node;
 
 
@@ -56,10 +56,10 @@
         virtual String mergeId();
         virtual void merge(PassOwnPtr<Action>);
 
-        virtual bool perform(ExceptionCode&) = 0;
+        virtual bool perform(ExceptionState&) = 0;
 
-        virtual bool undo(ExceptionCode&) = 0;
-        virtual bool redo(ExceptionCode&) = 0;
+        virtual bool undo(ExceptionState&) = 0;
+        virtual bool redo(ExceptionState&) = 0;
 
         virtual bool isUndoableStateMark();
     private:
@@ -69,11 +69,11 @@
     InspectorHistory();
     virtual ~InspectorHistory();
 
-    bool perform(PassOwnPtr<Action>, ExceptionCode&);
+    bool perform(PassOwnPtr<Action>, ExceptionState&);
     void markUndoableState();
 
-    bool undo(ExceptionCode&);
-    bool redo(ExceptionCode&);
+    bool undo(ExceptionState&);
+    bool redo(ExceptionState&);
     void reset();
 
 private:
diff --git a/Source/core/inspector/InspectorPageAgent.cpp b/Source/core/inspector/InspectorPageAgent.cpp
index e3efef5..d1d28f2 100644
--- a/Source/core/inspector/InspectorPageAgent.cpp
+++ b/Source/core/inspector/InspectorPageAgent.cpp
@@ -77,8 +77,6 @@
 #include "wtf/text/Base64.h"
 #include "wtf/text/TextEncoding.h"
 
-using namespace std;
-
 namespace WebCore {
 
 namespace PageAgentState {
diff --git a/Source/core/inspector/InspectorResourceAgent.cpp b/Source/core/inspector/InspectorResourceAgent.cpp
index 2f7c771..633f2e9 100644
--- a/Source/core/inspector/InspectorResourceAgent.cpp
+++ b/Source/core/inspector/InspectorResourceAgent.cpp
@@ -32,9 +32,9 @@
 #include "core/inspector/InspectorResourceAgent.h"
 
 #include "InspectorFrontend.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "bindings/v8/ScriptCallStackFactory.h"
 #include "core/dom/Document.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/ScriptableDocumentParser.h"
 #include "core/inspector/IdentifiersFactory.h"
 #include "core/inspector/InspectorClient.h"
@@ -656,11 +656,11 @@
     if (cachedResource)
         memoryCache()->remove(cachedResource);
 
-    xhr->open(xhrReplayData->method(), xhrReplayData->url(), xhrReplayData->async(), IGNORE_EXCEPTION);
+    xhr->open(xhrReplayData->method(), xhrReplayData->url(), xhrReplayData->async(), IGNORE_EXCEPTION_STATE);
     HTTPHeaderMap::const_iterator end = xhrReplayData->headers().end();
     for (HTTPHeaderMap::const_iterator it = xhrReplayData->headers().begin(); it!= end; ++it)
-        xhr->setRequestHeader(it->key, it->value, IGNORE_EXCEPTION);
-    xhr->sendForInspectorXHRReplay(xhrReplayData->formData(), IGNORE_EXCEPTION);
+        xhr->setRequestHeader(it->key, it->value, IGNORE_EXCEPTION_STATE);
+    xhr->sendForInspectorXHRReplay(xhrReplayData->formData(), IGNORE_EXCEPTION_STATE);
 }
 
 void InspectorResourceAgent::canClearBrowserCache(ErrorString*, bool* result)
diff --git a/Source/core/inspector/InspectorStyleSheet.cpp b/Source/core/inspector/InspectorStyleSheet.cpp
index e556b84..68e1c8e 100644
--- a/Source/core/inspector/InspectorStyleSheet.cpp
+++ b/Source/core/inspector/InspectorStyleSheet.cpp
@@ -28,6 +28,8 @@
 #include "CSSPropertyNames.h"
 #include "HTMLNames.h"
 #include "SVGNames.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/css/CSSHostRule.h"
 #include "core/css/CSSKeyframesRule.h"
 #include "core/css/CSSMediaRule.h"
@@ -546,13 +548,13 @@
 //
 // The propertyText (if not empty) is checked to be a valid style declaration (containing at least one property). If not,
 // the method returns false (denoting an error).
-bool InspectorStyle::setPropertyText(unsigned index, const String& propertyText, bool overwrite, String* oldText, ExceptionCode& ec)
+bool InspectorStyle::setPropertyText(unsigned index, const String& propertyText, bool overwrite, String* oldText, ExceptionState& es)
 {
     ASSERT(m_parentStyleSheet);
     DEFINE_STATIC_LOCAL(String, bogusPropertyName, (ASCIILiteral("-webkit-boguz-propertee")));
 
     if (!m_parentStyleSheet->ensureParsedDataReady()) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return false;
     }
 
@@ -567,27 +569,27 @@
 
         // At least one property + the bogus property added just above should be present.
         if (propertyCount < 2) {
-            ec = SyntaxError;
+            es.throwDOMException(SyntaxError);
             return false;
         }
 
         // Check for the proper propertyText termination (the parser could at least restore to the PROPERTY_NAME state).
         if (propertyData.at(propertyCount - 1).name != bogusPropertyName) {
-            ec = SyntaxError;
+            es.throwDOMException(SyntaxError);
             return false;
         }
     }
 
     RefPtr<CSSRuleSourceData> sourceData = extractSourceData();
     if (!sourceData) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return false;
     }
 
     String text;
     bool success = styleText(&text);
     if (!success) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return false;
     }
 
@@ -597,7 +599,7 @@
     InspectorStyleTextEditor editor(&allProperties, text, newLineAndWhitespaceDelimiters());
     if (overwrite) {
         if (index >= allProperties.size()) {
-            ec = IndexSizeError;
+            es.throwDOMException(IndexSizeError);
             return false;
         }
         *oldText = allProperties.at(index).rawText;
@@ -608,31 +610,31 @@
     return applyStyleText(editor.styleText());
 }
 
-bool InspectorStyle::toggleProperty(unsigned index, bool disable, ExceptionCode& ec)
+bool InspectorStyle::toggleProperty(unsigned index, bool disable, ExceptionState& es)
 {
     ASSERT(m_parentStyleSheet);
     if (!m_parentStyleSheet->ensureParsedDataReady()) {
-        ec = NoModificationAllowedError;
+        es.throwDOMException(NoModificationAllowedError);
         return false;
     }
 
     RefPtr<CSSRuleSourceData> sourceData = extractSourceData();
     if (!sourceData) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return false;
     }
 
     String text;
     bool success = styleText(&text);
     if (!success) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return false;
     }
 
     Vector<InspectorStyleProperty> allProperties;
     populateAllProperties(allProperties);
     if (index >= allProperties.size()) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return false;
     }
 
@@ -1025,9 +1027,9 @@
     m_pageStyleSheet->ownerDocument()->styleResolverChanged(RecalcStyleImmediately, FullStyleUpdate);
 }
 
-bool InspectorStyleSheet::setText(const String& text, ExceptionCode& ec)
+bool InspectorStyleSheet::setText(const String& text, ExceptionState& es)
 {
-    if (!checkPageStyleSheet(ec))
+    if (!checkPageStyleSheet(es))
         return false;
     if (!m_parsedStyleSheet)
         return false;
@@ -1038,35 +1040,35 @@
     return true;
 }
 
-String InspectorStyleSheet::ruleSelector(const InspectorCSSId& id, ExceptionCode& ec)
+String InspectorStyleSheet::ruleSelector(const InspectorCSSId& id, ExceptionState& es)
 {
     CSSStyleRule* rule = ruleForId(id);
     if (!rule) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return "";
     }
     return rule->selectorText();
 }
 
-bool InspectorStyleSheet::setRuleSelector(const InspectorCSSId& id, const String& selector, ExceptionCode& ec)
+bool InspectorStyleSheet::setRuleSelector(const InspectorCSSId& id, const String& selector, ExceptionState& es)
 {
-    if (!checkPageStyleSheet(ec))
+    if (!checkPageStyleSheet(es))
         return false;
     CSSStyleRule* rule = ruleForId(id);
     if (!rule) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return false;
     }
     CSSStyleSheet* styleSheet = rule->parentStyleSheet();
     if (!styleSheet || !ensureParsedDataReady()) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return false;
     }
 
     rule->setSelectorText(selector);
     RefPtr<CSSRuleSourceData> sourceData = ruleSourceDataFor(rule->style());
     if (!sourceData) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return false;
     }
 
@@ -1084,26 +1086,26 @@
     return selectorList.isValid();
 }
 
-CSSStyleRule* InspectorStyleSheet::addRule(const String& selector, ExceptionCode& ec)
+CSSStyleRule* InspectorStyleSheet::addRule(const String& selector, ExceptionState& es)
 {
-    if (!checkPageStyleSheet(ec))
+    if (!checkPageStyleSheet(es))
         return 0;
     if (!checkStyleRuleSelector(m_pageStyleSheet->ownerDocument(), selector)) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return 0;
     }
 
     String text;
     bool success = getText(&text);
     if (!success) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return 0;
     }
     StringBuilder styleSheetText;
     styleSheetText.append(text);
 
-    m_pageStyleSheet->addRule(selector, "", ec);
-    if (ec)
+    m_pageStyleSheet->addRule(selector, "", es);
+    if (es.hadException())
         return 0;
     ASSERT(m_pageStyleSheet->length());
     unsigned lastRuleIndex = m_pageStyleSheet->length() - 1;
@@ -1114,8 +1116,8 @@
     if (!styleRule) {
         // What we just added has to be a CSSStyleRule - we cannot handle other types of rules yet.
         // If it is not a style rule, pretend we never touched the stylesheet.
-        m_pageStyleSheet->deleteRule(lastRuleIndex, ASSERT_NO_EXCEPTION);
-        ec = SyntaxError;
+        m_pageStyleSheet->deleteRule(lastRuleIndex, ASSERT_NO_EXCEPTION_STATE);
+        es.throwDOMException(SyntaxError);
         return 0;
     }
 
@@ -1125,43 +1127,43 @@
     styleSheetText.append(selector);
     styleSheetText.appendLiteral(" {}");
     // Using setText() as this operation changes the style sheet rule set.
-    setText(styleSheetText.toString(), ASSERT_NO_EXCEPTION);
+    setText(styleSheetText.toString(), ASSERT_NO_EXCEPTION_STATE);
 
     fireStyleSheetChanged();
 
     return styleRule;
 }
 
-bool InspectorStyleSheet::deleteRule(const InspectorCSSId& id, ExceptionCode& ec)
+bool InspectorStyleSheet::deleteRule(const InspectorCSSId& id, ExceptionState& es)
 {
-    if (!checkPageStyleSheet(ec))
+    if (!checkPageStyleSheet(es))
         return false;
     RefPtr<CSSStyleRule> rule = ruleForId(id);
     if (!rule) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return false;
     }
     CSSStyleSheet* styleSheet = rule->parentStyleSheet();
     if (!styleSheet || !ensureParsedDataReady()) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return false;
     }
 
     RefPtr<CSSRuleSourceData> sourceData = ruleSourceDataFor(rule->style());
     if (!sourceData) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return false;
     }
 
-    styleSheet->deleteRule(id.ordinal(), ec);
+    styleSheet->deleteRule(id.ordinal(), es);
     // |rule| MAY NOT be addressed after this line!
 
-    if (ec)
+    if (es.hadException())
         return false;
 
     String sheetText = m_parsedStyleSheet->text();
     sheetText.remove(sourceData->ruleHeaderRange.start, sourceData->ruleBodyRange.end - sourceData->ruleHeaderRange.start + 1);
-    setText(sheetText, ASSERT_NO_EXCEPTION);
+    setText(sheetText, ASSERT_NO_EXCEPTION_STATE);
     fireStyleSheetChanged();
     return true;
 }
@@ -1325,17 +1327,17 @@
     return result.release();
 }
 
-bool InspectorStyleSheet::setStyleText(const InspectorCSSId& id, const String& text, String* oldText, ExceptionCode& ec)
+bool InspectorStyleSheet::setStyleText(const InspectorCSSId& id, const String& text, String* oldText, ExceptionState& es)
 {
     RefPtr<InspectorStyle> inspectorStyle = inspectorStyleForId(id);
     if (!inspectorStyle || !inspectorStyle->cssStyle()) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return false;
     }
 
     bool success = inspectorStyle->styleText(oldText);
     if (!success) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return false;
     }
 
@@ -1343,33 +1345,33 @@
     if (success)
         fireStyleSheetChanged();
     else
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
     return success;
 }
 
-bool InspectorStyleSheet::setPropertyText(const InspectorCSSId& id, unsigned propertyIndex, const String& text, bool overwrite, String* oldText, ExceptionCode& ec)
+bool InspectorStyleSheet::setPropertyText(const InspectorCSSId& id, unsigned propertyIndex, const String& text, bool overwrite, String* oldText, ExceptionState& es)
 {
     RefPtr<InspectorStyle> inspectorStyle = inspectorStyleForId(id);
     if (!inspectorStyle) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return false;
     }
 
-    bool success = inspectorStyle->setPropertyText(propertyIndex, text, overwrite, oldText, ec);
+    bool success = inspectorStyle->setPropertyText(propertyIndex, text, overwrite, oldText, es);
     if (success)
         fireStyleSheetChanged();
     return success;
 }
 
-bool InspectorStyleSheet::toggleProperty(const InspectorCSSId& id, unsigned propertyIndex, bool disable, ExceptionCode& ec)
+bool InspectorStyleSheet::toggleProperty(const InspectorCSSId& id, unsigned propertyIndex, bool disable, ExceptionState& es)
 {
     RefPtr<InspectorStyle> inspectorStyle = inspectorStyleForId(id);
     if (!inspectorStyle) {
-        ec = NotFoundError;
+        es.throwDOMException(NotFoundError);
         return false;
     }
 
-    bool success = inspectorStyle->toggleProperty(propertyIndex, disable, ec);
+    bool success = inspectorStyle->toggleProperty(propertyIndex, disable, es);
     if (success)
         fireStyleSheetChanged();
     return success;
@@ -1536,10 +1538,10 @@
     return index == notFound ? UINT_MAX : static_cast<unsigned>(index);
 }
 
-bool InspectorStyleSheet::checkPageStyleSheet(ExceptionCode& ec) const
+bool InspectorStyleSheet::checkPageStyleSheet(ExceptionState& es) const
 {
     if (!m_pageStyleSheet) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return false;
     }
     return true;
@@ -1605,12 +1607,12 @@
     if (id.isEmpty())
         return false;
 
-    ExceptionCode ec = 0;
-    style->setCssText(text, ec);
-    if (!ec)
+    TrackExceptionState es;
+    style->setCssText(text, es);
+    if (!es.hadException())
         m_parsedStyleSheet->setText(patchedStyleSheetText);
 
-    return !ec;
+    return !es.hadException();
 }
 
 bool InspectorStyleSheet::styleSheetTextWithChangedStyle(CSSStyleDeclaration* style, const String& newStyleText, String* result)
@@ -1732,17 +1734,17 @@
 bool InspectorStyleSheetForInlineStyle::setStyleText(CSSStyleDeclaration* style, const String& text)
 {
     ASSERT_UNUSED(style, style == inlineStyle());
-    ExceptionCode ec = 0;
+    TrackExceptionState es;
 
     {
         InspectorCSSAgent::InlineStyleOverrideScope overrideScope(m_element->ownerDocument());
-        m_element->setAttribute("style", text, ec);
+        m_element->setAttribute("style", text, es);
     }
 
     m_styleText = text;
     m_isStyleTextValid = true;
     m_ruleSourceData.clear();
-    return !ec;
+    return !es.hadException();
 }
 
 PassOwnPtr<Vector<unsigned> > InspectorStyleSheetForInlineStyle::lineEndings() const
diff --git a/Source/core/inspector/InspectorStyleSheet.h b/Source/core/inspector/InspectorStyleSheet.h
index 441af6e..cd5751a 100644
--- a/Source/core/inspector/InspectorStyleSheet.h
+++ b/Source/core/inspector/InspectorStyleSheet.h
@@ -28,7 +28,6 @@
 #include "InspectorTypeBuilder.h"
 #include "core/css/CSSPropertySourceData.h"
 #include "core/css/CSSStyleDeclaration.h"
-#include "core/dom/ExceptionCode.h"
 #include "core/inspector/InspectorStyleTextEditor.h"
 #include "core/platform/JSONValues.h"
 #include "wtf/HashMap.h"
@@ -47,6 +46,7 @@
 class CSSStyleSheet;
 class Document;
 class Element;
+class ExceptionState;
 class InspectorPageAgent;
 class InspectorStyleSheet;
 class Node;
@@ -137,8 +137,8 @@
     CSSStyleDeclaration* cssStyle() const { return m_style.get(); }
     PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle() const;
     PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> > buildArrayForComputedStyle() const;
-    bool setPropertyText(unsigned index, const String& text, bool overwrite, String* oldText, ExceptionCode&);
-    bool toggleProperty(unsigned index, bool disable, ExceptionCode&);
+    bool setPropertyText(unsigned index, const String& text, bool overwrite, String* oldText, ExceptionState&);
+    bool toggleProperty(unsigned index, bool disable, ExceptionState&);
     bool styleText(String* result) const;
 
 private:
@@ -185,19 +185,19 @@
     CSSStyleSheet* pageStyleSheet() const { return m_pageStyleSheet.get(); }
     bool isReparsing() const { return m_isReparsing; }
     void reparseStyleSheet(const String&);
-    bool setText(const String&, ExceptionCode&);
-    String ruleSelector(const InspectorCSSId&, ExceptionCode&);
-    bool setRuleSelector(const InspectorCSSId&, const String& selector, ExceptionCode&);
-    CSSStyleRule* addRule(const String& selector, ExceptionCode&);
-    bool deleteRule(const InspectorCSSId&, ExceptionCode&);
+    bool setText(const String&, ExceptionState&);
+    String ruleSelector(const InspectorCSSId&, ExceptionState&);
+    bool setRuleSelector(const InspectorCSSId&, const String& selector, ExceptionState&);
+    CSSStyleRule* addRule(const String& selector, ExceptionState&);
+    bool deleteRule(const InspectorCSSId&, ExceptionState&);
     CSSStyleRule* ruleForId(const InspectorCSSId&) const;
     bool fillObjectForStyleSheet(PassRefPtr<TypeBuilder::CSS::CSSStyleSheetBody>);
     PassRefPtr<TypeBuilder::CSS::CSSStyleSheetHeader> buildObjectForStyleSheetInfo() const;
     PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*, PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSMedia> >);
     PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForStyle(CSSStyleDeclaration*);
-    bool setStyleText(const InspectorCSSId&, const String& text, String* oldText, ExceptionCode&);
-    bool setPropertyText(const InspectorCSSId&, unsigned propertyIndex, const String& text, bool overwrite, String* oldPropertyText, ExceptionCode&);
-    bool toggleProperty(const InspectorCSSId&, unsigned propertyIndex, bool disable, ExceptionCode&);
+    bool setStyleText(const InspectorCSSId&, const String& text, String* oldText, ExceptionState&);
+    bool setPropertyText(const InspectorCSSId&, unsigned propertyIndex, const String& text, bool overwrite, String* oldPropertyText, ExceptionState&);
+    bool toggleProperty(const InspectorCSSId&, unsigned propertyIndex, bool disable, ExceptionState&);
 
     virtual TypeBuilder::CSS::StyleSheetOrigin::Enum origin() const { return m_origin; }
     virtual bool getText(String* result) const;
@@ -228,7 +228,7 @@
 private:
     friend class InspectorStyle;
 
-    bool checkPageStyleSheet(ExceptionCode&) const;
+    bool checkPageStyleSheet(ExceptionState&) const;
     bool ensureText() const;
     bool ensureSourceData();
     void ensureFlatRules() const;
diff --git a/Source/core/loader/appcache/DOMApplicationCache.cpp b/Source/core/loader/appcache/DOMApplicationCache.cpp
index 14733f2..7c4e6d1 100644
--- a/Source/core/loader/appcache/DOMApplicationCache.cpp
+++ b/Source/core/loader/appcache/DOMApplicationCache.cpp
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "core/loader/appcache/DOMApplicationCache.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/Document.h"
 #include "core/dom/EventListener.h"
 #include "core/dom/EventNames.h"
@@ -68,18 +69,18 @@
     return cacheHost->status();
 }
 
-void DOMApplicationCache::update(ExceptionCode& ec)
+void DOMApplicationCache::update(ExceptionState& es)
 {
     ApplicationCacheHost* cacheHost = applicationCacheHost();
     if (!cacheHost || !cacheHost->update())
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
 }
 
-void DOMApplicationCache::swapCache(ExceptionCode& ec)
+void DOMApplicationCache::swapCache(ExceptionState& es)
 {
     ApplicationCacheHost* cacheHost = applicationCacheHost();
     if (!cacheHost || !cacheHost->swapCache())
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
 }
 
 void DOMApplicationCache::abort()
diff --git a/Source/core/loader/appcache/DOMApplicationCache.h b/Source/core/loader/appcache/DOMApplicationCache.h
index 812de18..ee7d452 100644
--- a/Source/core/loader/appcache/DOMApplicationCache.h
+++ b/Source/core/loader/appcache/DOMApplicationCache.h
@@ -37,6 +37,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class Frame;
 class KURL;
 
@@ -48,8 +49,8 @@
     virtual void willDestroyGlobalObjectInFrame() OVERRIDE;
 
     unsigned short status() const;
-    void update(ExceptionCode&);
-    void swapCache(ExceptionCode&);
+    void update(ExceptionState&);
+    void swapCache(ExceptionState&);
     void abort();
 
     // EventTarget impl
diff --git a/Source/core/page/DOMSelection.cpp b/Source/core/page/DOMSelection.cpp
index a9ecb80..5d9bbde 100644
--- a/Source/core/page/DOMSelection.cpp
+++ b/Source/core/page/DOMSelection.cpp
@@ -31,6 +31,8 @@
 #include "config.h"
 #include "core/page/DOMSelection.h"
 
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Document.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/Node.h"
@@ -191,13 +193,13 @@
     return m_frame->selection()->isNone() ? 0 : 1;
 }
 
-void DOMSelection::collapse(Node* node, int offset, ExceptionCode& ec)
+void DOMSelection::collapse(Node* node, int offset, ExceptionState& es)
 {
     if (!m_frame)
         return;
 
     if (offset < 0) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
@@ -208,7 +210,7 @@
     m_frame->selection()->moveTo(VisiblePosition(createLegacyEditingPosition(node, offset), DOWNSTREAM));
 }
 
-void DOMSelection::collapseToEnd(ExceptionCode& ec)
+void DOMSelection::collapseToEnd(ExceptionState& es)
 {
     if (!m_frame)
         return;
@@ -216,14 +218,14 @@
     const VisibleSelection& selection = m_frame->selection()->selection();
 
     if (selection.isNone()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
     m_frame->selection()->moveTo(VisiblePosition(selection.end(), DOWNSTREAM));
 }
 
-void DOMSelection::collapseToStart(ExceptionCode& ec)
+void DOMSelection::collapseToStart(ExceptionState& es)
 {
     if (!m_frame)
         return;
@@ -231,7 +233,7 @@
     const VisibleSelection& selection = m_frame->selection()->selection();
 
     if (selection.isNone()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
@@ -245,13 +247,13 @@
     m_frame->selection()->clear();
 }
 
-void DOMSelection::setBaseAndExtent(Node* baseNode, int baseOffset, Node* extentNode, int extentOffset, ExceptionCode& ec)
+void DOMSelection::setBaseAndExtent(Node* baseNode, int baseOffset, Node* extentNode, int extentOffset, ExceptionState& es)
 {
     if (!m_frame)
         return;
 
     if (baseOffset < 0 || extentOffset < 0) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
@@ -265,12 +267,12 @@
     m_frame->selection()->moveTo(visibleBase, visibleExtent);
 }
 
-void DOMSelection::setPosition(Node* node, int offset, ExceptionCode& ec)
+void DOMSelection::setPosition(Node* node, int offset, ExceptionState& es)
 {
     if (!m_frame)
         return;
     if (offset < 0) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
@@ -331,18 +333,18 @@
     m_frame->selection()->modify(alter, direction, granularity);
 }
 
-void DOMSelection::extend(Node* node, int offset, ExceptionCode& ec)
+void DOMSelection::extend(Node* node, int offset, ExceptionState& es)
 {
     if (!m_frame)
         return;
 
     if (!node) {
-        ec = TypeMismatchError;
+        es.throwDOMException(TypeMismatchError);
         return;
     }
 
     if (offset < 0 || offset > (node->offsetInCharacters() ? caretMaxOffset(node) : (int)node->childNodeCount())) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
@@ -353,13 +355,13 @@
     m_frame->selection()->setExtent(VisiblePosition(createLegacyEditingPosition(node, offset), DOWNSTREAM));
 }
 
-PassRefPtr<Range> DOMSelection::getRangeAt(int index, ExceptionCode& ec)
+PassRefPtr<Range> DOMSelection::getRangeAt(int index, ExceptionState& es)
 {
     if (!m_frame)
         return 0;
 
     if (index < 0 || index >= rangeCount()) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return 0;
     }
 
@@ -398,10 +400,10 @@
     }
 
     RefPtr<Range> range = selection->selection().toNormalizedRange();
-    if (r->compareBoundaryPoints(Range::START_TO_START, range.get(), IGNORE_EXCEPTION) == -1) {
+    if (r->compareBoundaryPoints(Range::START_TO_START, range.get(), IGNORE_EXCEPTION_STATE) == -1) {
         // We don't support discontiguous selection. We don't do anything if r and range don't intersect.
-        if (r->compareBoundaryPoints(Range::START_TO_END, range.get(), IGNORE_EXCEPTION) > -1) {
-            if (r->compareBoundaryPoints(Range::END_TO_END, range.get(), IGNORE_EXCEPTION) == -1)
+        if (r->compareBoundaryPoints(Range::START_TO_END, range.get(), IGNORE_EXCEPTION_STATE) > -1) {
+            if (r->compareBoundaryPoints(Range::END_TO_END, range.get(), IGNORE_EXCEPTION_STATE) == -1)
                 // The original range and r intersect.
                 selection->setSelection(VisibleSelection(r->startPosition(), range->endPosition(), DOWNSTREAM));
             else
@@ -410,9 +412,9 @@
         }
     } else {
         // We don't support discontiguous selection. We don't do anything if r and range don't intersect.
-        ExceptionCode ec = 0;
-        if (r->compareBoundaryPoints(Range::END_TO_START, range.get(), ec) < 1 && !ec) {
-            if (r->compareBoundaryPoints(Range::END_TO_END, range.get(), IGNORE_EXCEPTION) == -1)
+        TrackExceptionState es;
+        if (r->compareBoundaryPoints(Range::END_TO_START, range.get(), es) < 1 && !es.hadException()) {
+            if (r->compareBoundaryPoints(Range::END_TO_END, range.get(), IGNORE_EXCEPTION_STATE) == -1)
                 // The original range contains r.
                 selection->setSelection(VisibleSelection(range.get()));
             else
@@ -439,9 +441,9 @@
     if (!selectedRange)
         return;
 
-    selectedRange->deleteContents(ASSERT_NO_EXCEPTION);
+    selectedRange->deleteContents(ASSERT_NO_EXCEPTION_STATE);
 
-    setBaseAndExtent(selectedRange->startContainer(ASSERT_NO_EXCEPTION), selectedRange->startOffset(), selectedRange->startContainer(), selectedRange->startOffset(), ASSERT_NO_EXCEPTION);
+    setBaseAndExtent(selectedRange->startContainer(ASSERT_NO_EXCEPTION_STATE), selectedRange->startOffset(), selectedRange->startContainer(), selectedRange->startOffset(), ASSERT_NO_EXCEPTION_STATE);
 }
 
 bool DOMSelection::containsNode(const Node* n, bool allowPartial) const
@@ -461,29 +463,29 @@
     if (!parentNode)
         return false;
 
-    ExceptionCode ec = 0;
-    bool nodeFullySelected = Range::compareBoundaryPoints(parentNode, nodeIndex, selectedRange->startContainer(), selectedRange->startOffset(), ec) >= 0 && !ec
-        && Range::compareBoundaryPoints(parentNode, nodeIndex + 1, selectedRange->endContainer(), selectedRange->endOffset(), ec) <= 0 && !ec;
-    ASSERT(!ec);
+    TrackExceptionState es;
+    bool nodeFullySelected = Range::compareBoundaryPoints(parentNode, nodeIndex, selectedRange->startContainer(), selectedRange->startOffset(), es) >= 0 && !es.hadException()
+        && Range::compareBoundaryPoints(parentNode, nodeIndex + 1, selectedRange->endContainer(), selectedRange->endOffset(), es) <= 0 && !es.hadException();
+    ASSERT(!es.hadException());
     if (nodeFullySelected)
         return true;
 
-    bool nodeFullyUnselected = (Range::compareBoundaryPoints(parentNode, nodeIndex, selectedRange->endContainer(), selectedRange->endOffset(), ec) > 0 && !ec)
-        || (Range::compareBoundaryPoints(parentNode, nodeIndex + 1, selectedRange->startContainer(), selectedRange->startOffset(), ec) < 0 && !ec);
-    ASSERT(!ec);
+    bool nodeFullyUnselected = (Range::compareBoundaryPoints(parentNode, nodeIndex, selectedRange->endContainer(), selectedRange->endOffset(), es) > 0 && !es.hadException())
+        || (Range::compareBoundaryPoints(parentNode, nodeIndex + 1, selectedRange->startContainer(), selectedRange->startOffset(), es) < 0 && !es.hadException());
+    ASSERT(!es.hadException());
     if (nodeFullyUnselected)
         return false;
 
     return allowPartial || n->isTextNode();
 }
 
-void DOMSelection::selectAllChildren(Node* n, ExceptionCode& ec)
+void DOMSelection::selectAllChildren(Node* n, ExceptionState& es)
 {
     if (!n)
         return;
 
     // This doesn't (and shouldn't) select text node characters.
-    setBaseAndExtent(n, 0, n, n->childNodeCount(), ec);
+    setBaseAndExtent(n, 0, n, n->childNodeCount(), es);
 }
 
 String DOMSelection::toString()
diff --git a/Source/core/page/DOMSelection.h b/Source/core/page/DOMSelection.h
index e95d000..16d48f1 100644
--- a/Source/core/page/DOMSelection.h
+++ b/Source/core/page/DOMSelection.h
@@ -39,6 +39,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class Frame;
 class Node;
 class Position;
@@ -46,8 +47,6 @@
 class TreeScope;
 class VisibleSelection;
 
-typedef int ExceptionCode;
-
 class DOMSelection : public RefCounted<DOMSelection>, public ScriptWrappable, public DOMWindowProperty {
 public:
     static PassRefPtr<DOMSelection> create(const TreeScope* treeScope) { return adoptRef(new DOMSelection(treeScope)); }
@@ -61,8 +60,8 @@
     int baseOffset() const;
     int extentOffset() const;
     String type() const;
-    void setBaseAndExtent(Node* baseNode, int baseOffset, Node* extentNode, int extentOffset, ExceptionCode&);
-    void setPosition(Node*, int offset, ExceptionCode&);
+    void setBaseAndExtent(Node* baseNode, int baseOffset, Node* extentNode, int extentOffset, ExceptionState&);
+    void setPosition(Node*, int offset, ExceptionState&);
     void modify(const String& alter, const String& direction, const String& granularity);
 
     // Mozilla Selection Object API
@@ -77,16 +76,16 @@
     int focusOffset() const;
     bool isCollapsed() const;
     int rangeCount() const;
-    void collapse(Node*, int offset, ExceptionCode&);
-    void collapseToEnd(ExceptionCode&);
-    void collapseToStart(ExceptionCode&);
-    void extend(Node*, int offset, ExceptionCode&);
-    PassRefPtr<Range> getRangeAt(int, ExceptionCode&);
+    void collapse(Node*, int offset, ExceptionState&);
+    void collapseToEnd(ExceptionState&);
+    void collapseToStart(ExceptionState&);
+    void extend(Node*, int offset, ExceptionState&);
+    PassRefPtr<Range> getRangeAt(int, ExceptionState&);
     void removeAllRanges();
     void addRange(Range*);
     void deleteFromDocument();
     bool containsNode(const Node*, bool partlyContained) const;
-    void selectAllChildren(Node*, ExceptionCode&);
+    void selectAllChildren(Node*, ExceptionState&);
 
     String toString();
 
diff --git a/Source/core/page/DOMWindow.cpp b/Source/core/page/DOMWindow.cpp
index bb69bb6..0cf3686 100644
--- a/Source/core/page/DOMWindow.cpp
+++ b/Source/core/page/DOMWindow.cpp
@@ -33,6 +33,7 @@
 #include <algorithm>
 #include "RuntimeEnabledFeatures.h"
 #include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "bindings/v8/ScriptCallStackFactory.h"
 #include "bindings/v8/ScriptController.h"
 #include "bindings/v8/SerializedScriptValue.h"
@@ -49,7 +50,6 @@
 #include "core/dom/EventListener.h"
 #include "core/dom/EventNames.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/MessageEvent.h"
 #include "core/dom/PageTransitionEvent.h"
 #include "core/dom/RequestAnimationFrameCallback.h"
@@ -629,7 +629,7 @@
     return m_location.get();
 }
 
-Storage* DOMWindow::sessionStorage(ExceptionCode& ec) const
+Storage* DOMWindow::sessionStorage(ExceptionState& es) const
 {
     if (!isCurrentlyDisplayedInFrame())
         return 0;
@@ -639,13 +639,13 @@
         return 0;
 
     if (!document->securityOrigin()->canAccessLocalStorage()) {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return 0;
     }
 
     if (m_sessionStorage) {
         if (!m_sessionStorage->area()->canAccessStorage(m_frame)) {
-            ec = SecurityError;
+            es.throwDOMException(SecurityError);
             return 0;
         }
         return m_sessionStorage.get();
@@ -657,7 +657,7 @@
 
     OwnPtr<StorageArea> storageArea = page->sessionStorage()->storageArea(document->securityOrigin());
     if (!storageArea->canAccessStorage(m_frame)) {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return 0;
     }
 
@@ -665,7 +665,7 @@
     return m_sessionStorage.get();
 }
 
-Storage* DOMWindow::localStorage(ExceptionCode& ec) const
+Storage* DOMWindow::localStorage(ExceptionState& es) const
 {
     if (!isCurrentlyDisplayedInFrame())
         return 0;
@@ -675,13 +675,13 @@
         return 0;
 
     if (!document->securityOrigin()->canAccessLocalStorage()) {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return 0;
     }
 
     if (m_localStorage) {
         if (!m_localStorage->area()->canAccessStorage(m_frame)) {
-            ec = SecurityError;
+            es.throwDOMException(SecurityError);
             return 0;
         }
         return m_localStorage.get();
@@ -696,7 +696,7 @@
 
     OwnPtr<StorageArea> storageArea = StorageNamespace::localStorageArea(document->securityOrigin());
     if (!storageArea->canAccessStorage(m_frame)) {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return 0;
     }
 
@@ -1389,8 +1389,8 @@
     // notifications about storage events that might be triggered in other processes. Rather
     // than subscribe to these notifications explicitly, we subscribe to them implicitly to
     // simplify the work done by the system.
-    window->localStorage(IGNORE_EXCEPTION);
-    window->sessionStorage(IGNORE_EXCEPTION);
+    window->localStorage(IGNORE_EXCEPTION_STATE);
+    window->sessionStorage(IGNORE_EXCEPTION_STATE);
 }
 
 bool DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
diff --git a/Source/core/page/DOMWindow.h b/Source/core/page/DOMWindow.h
index b35b548..ae98cf0 100644
--- a/Source/core/page/DOMWindow.h
+++ b/Source/core/page/DOMWindow.h
@@ -77,8 +77,6 @@
 
     typedef Vector<RefPtr<MessagePort>, 1> MessagePortArray;
 
-    typedef int ExceptionCode;
-
     enum SetLocationLocking { LockHistoryBasedOnGestureState, LockHistoryAndBackForwardList };
 
     class DOMWindow : public RefCounted<DOMWindow>, public ScriptWrappable, public EventTarget, public FrameDestructionObserver, public Supplementable<DOMWindow> {
@@ -339,8 +337,8 @@
         DEFINE_ATTRIBUTE_EVENT_LISTENER(deviceorientation);
 
         // HTML 5 key/value storage
-        Storage* sessionStorage(ExceptionCode&) const;
-        Storage* localStorage(ExceptionCode&) const;
+        Storage* sessionStorage(ExceptionState&) const;
+        Storage* localStorage(ExceptionState&) const;
         Storage* optionalSessionStorage() const { return m_sessionStorage.get(); }
         Storage* optionalLocalStorage() const { return m_localStorage.get(); }
 
diff --git a/Source/core/page/DOMWindowBase64.cpp b/Source/core/page/DOMWindowBase64.cpp
index 7d3252b..c6ba45b 100644
--- a/Source/core/page/DOMWindowBase64.cpp
+++ b/Source/core/page/DOMWindowBase64.cpp
@@ -33,38 +33,40 @@
 #include "config.h"
 #include "core/page/DOMWindowBase64.h"
 
+#include "bindings/v8/ExceptionState.h"
+#include "core/dom/ExceptionCode.h"
 #include "wtf/text/Base64.h"
 
 namespace WebCore {
 
 namespace DOMWindowBase64 {
 
-String btoa(void*, const String& stringToEncode, ExceptionCode& ec)
+String btoa(void*, const String& stringToEncode, ExceptionState& es)
 {
     if (stringToEncode.isNull())
         return String();
 
     if (!stringToEncode.containsOnlyLatin1()) {
-        ec = InvalidCharacterError;
+        es.throwDOMException(InvalidCharacterError);
         return String();
     }
 
     return base64Encode(stringToEncode.latin1());
 }
 
-String atob(void*, const String& encodedString, ExceptionCode& ec)
+String atob(void*, const String& encodedString, ExceptionState& es)
 {
     if (encodedString.isNull())
         return String();
 
     if (!encodedString.containsOnlyLatin1()) {
-        ec = InvalidCharacterError;
+        es.throwDOMException(InvalidCharacterError);
         return String();
     }
 
     Vector<char> out;
     if (!base64Decode(encodedString, out, Base64FailOnInvalidCharacter, Base64StrictPaddingValidation)) {
-        ec = InvalidCharacterError;
+        es.throwDOMException(InvalidCharacterError);
         return String();
     }
 
diff --git a/Source/core/page/DOMWindowBase64.h b/Source/core/page/DOMWindowBase64.h
index 50b7972..21001e0 100644
--- a/Source/core/page/DOMWindowBase64.h
+++ b/Source/core/page/DOMWindowBase64.h
@@ -33,14 +33,15 @@
 #ifndef DOMWindowBase64_h
 #define DOMWindowBase64_h
 
-#include "core/dom/ExceptionCode.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
+class ExceptionState;
+
 namespace DOMWindowBase64 {
-String btoa(void*, const String& stringToEncode, ExceptionCode&);
-String atob(void*, const String& encodedString, ExceptionCode&);
+String btoa(void*, const String& stringToEncode, ExceptionState&);
+String atob(void*, const String& encodedString, ExceptionState&);
 }
 
 } // namespace WebCore
diff --git a/Source/core/page/DragController.cpp b/Source/core/page/DragController.cpp
index 3843ff5..f4ceae5 100644
--- a/Source/core/page/DragController.cpp
+++ b/Source/core/page/DragController.cpp
@@ -28,12 +28,12 @@
 #include "core/page/DragController.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Clipboard.h"
 #include "core/dom/ClipboardAccessPolicy.h"
 #include "core/dom/Document.h"
 #include "core/dom/DocumentFragment.h"
 #include "core/dom/Element.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/Node.h"
 #include "core/dom/Text.h"
 #include "core/dom/TextEvent.h"
@@ -169,9 +169,9 @@
                         title = url;
                 }
                 RefPtr<Node> anchorText = document->createTextNode(title);
-                anchor->appendChild(anchorText, IGNORE_EXCEPTION);
+                anchor->appendChild(anchorText, IGNORE_EXCEPTION_STATE);
                 RefPtr<DocumentFragment> fragment = document->createDocumentFragment();
-                fragment->appendChild(anchor, IGNORE_EXCEPTION);
+                fragment->appendChild(anchor, IGNORE_EXCEPTION_STATE);
                 return fragment.get();
             }
         }
@@ -443,7 +443,7 @@
     ASSERT(m_page->dragCaretController()->hasCaret());
     String text = m_page->dragCaretController()->isContentRichlyEditable() ? "" : dragData->asPlainText(innerFrame);
     Node* target = innerFrame->editor()->findEventTargetFrom(m_page->dragCaretController()->caretPosition());
-    return target->dispatchEvent(TextEvent::createForDrop(innerFrame->domWindow(), text), IGNORE_EXCEPTION);
+    return target->dispatchEvent(TextEvent::createForDrop(innerFrame->domWindow(), text), IGNORE_EXCEPTION_STATE);
 }
 
 bool DragController::concludeEditDrag(DragData* dragData)
@@ -686,7 +686,7 @@
 {
     if (node->isContentRichlyEditable()) {
         RefPtr<Range> range = source->document()->createRange();
-        range->selectNode(node, ASSERT_NO_EXCEPTION);
+        range->selectNode(node, ASSERT_NO_EXCEPTION_STATE);
         source->selection()->setSelection(VisibleSelection(range.get(), DOWNSTREAM));
     }
     clipboard->declareAndWriteDragImage(node, !linkURL.isEmpty() ? linkURL : imageURL, label, source);
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp
index 7b3e0b5..2b58ed4 100644
--- a/Source/core/page/EventHandler.cpp
+++ b/Source/core/page/EventHandler.cpp
@@ -30,12 +30,12 @@
 
 #include "HTMLNames.h"
 #include "SVGNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Document.h"
 #include "core/dom/DocumentEventQueue.h"
 #include "core/dom/DocumentMarkerController.h"
 #include "core/dom/EventNames.h"
 #include "core/dom/EventPathWalker.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/FullscreenElementStack.h"
 #include "core/dom/KeyboardEvent.h"
 #include "core/dom/MouseEvent.h"
@@ -1711,7 +1711,7 @@
         event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(),
         0, 0, clipboard);
 
-    dragTarget->dispatchEvent(me.get(), IGNORE_EXCEPTION);
+    dragTarget->dispatchEvent(me.get(), IGNORE_EXCEPTION_STATE);
     return me->defaultPrevented();
 }
 
@@ -2044,7 +2044,7 @@
     // FrameSelection::setFocusedNodeIfNeeded.
     if (element
         && m_frame->selection()->isRange()
-        && m_frame->selection()->toNormalizedRange()->compareNode(element, IGNORE_EXCEPTION) == Range::NODE_INSIDE
+        && m_frame->selection()->toNormalizedRange()->compareNode(element, IGNORE_EXCEPTION_STATE) == Range::NODE_INSIDE
         && element->isDescendantOf(m_frame->document()->focusedElement()))
         return true;
 
@@ -3008,13 +3008,13 @@
     keydown->setTarget(node);
 
     if (initialKeyEvent.type() == PlatformEvent::RawKeyDown) {
-        node->dispatchEvent(keydown, IGNORE_EXCEPTION);
+        node->dispatchEvent(keydown, IGNORE_EXCEPTION_STATE);
         // If frame changed as a result of keydown dispatch, then return true to avoid sending a subsequent keypress message to the new frame.
         bool changedFocusedFrame = m_frame->page() && m_frame != m_frame->page()->focusController()->focusedOrMainFrame();
         return keydown->defaultHandled() || keydown->defaultPrevented() || changedFocusedFrame;
     }
 
-    node->dispatchEvent(keydown, IGNORE_EXCEPTION);
+    node->dispatchEvent(keydown, IGNORE_EXCEPTION_STATE);
     // If frame changed as a result of keydown dispatch, then return early to avoid sending a subsequent keypress message to the new frame.
     bool changedFocusedFrame = m_frame->page() && m_frame != m_frame->page()->focusController()->focusedOrMainFrame();
     bool keydownResult = keydown->defaultHandled() || keydown->defaultPrevented() || changedFocusedFrame;
@@ -3035,7 +3035,7 @@
     keypress->setTarget(node);
     if (keydownResult)
         keypress->setDefaultPrevented(true);
-    node->dispatchEvent(keypress, IGNORE_EXCEPTION);
+    node->dispatchEvent(keypress, IGNORE_EXCEPTION_STATE);
 
     return keydownResult || keypress->defaultPrevented() || keypress->defaultHandled();
 }
@@ -3329,7 +3329,7 @@
     RefPtr<TextEvent> event = TextEvent::create(m_frame->domWindow(), text, inputType);
     event->setUnderlyingEvent(underlyingEvent);
 
-    target->dispatchEvent(event, IGNORE_EXCEPTION);
+    target->dispatchEvent(event, IGNORE_EXCEPTION_STATE);
     return event->defaultHandled();
 }
 
diff --git a/Source/core/page/EventSource.cpp b/Source/core/page/EventSource.cpp
index d410de9..205cfaa 100644
--- a/Source/core/page/EventSource.cpp
+++ b/Source/core/page/EventSource.cpp
@@ -34,6 +34,7 @@
 #include "core/page/EventSource.h"
 
 #include "bindings/v8/Dictionary.h"
+#include "bindings/v8/ExceptionState.h"
 #include "bindings/v8/ScriptController.h"
 #include "bindings/v8/SerializedScriptValue.h"
 #include "core/dom/Document.h"
@@ -71,16 +72,16 @@
     eventSourceInit.get("withCredentials", m_withCredentials);
 }
 
-PassRefPtr<EventSource> EventSource::create(ScriptExecutionContext* context, const String& url, const Dictionary& eventSourceInit, ExceptionCode& ec)
+PassRefPtr<EventSource> EventSource::create(ScriptExecutionContext* context, const String& url, const Dictionary& eventSourceInit, ExceptionState& es)
 {
     if (url.isEmpty()) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return 0;
     }
 
     KURL fullURL = context->completeURL(url);
     if (!fullURL.isValid()) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return 0;
     }
 
@@ -92,7 +93,7 @@
     }
     if (!shouldBypassMainWorldContentSecurityPolicy && !context->contentSecurityPolicy()->allowConnectToSource(fullURL)) {
         // FIXME: Should this be throwing an exception?
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return 0;
     }
 
diff --git a/Source/core/page/EventSource.h b/Source/core/page/EventSource.h
index d22c229..c407e09 100644
--- a/Source/core/page/EventSource.h
+++ b/Source/core/page/EventSource.h
@@ -44,6 +44,7 @@
 namespace WebCore {
 
 class Dictionary;
+class ExceptionState;
 class MessageEvent;
 class ResourceResponse;
 class TextResourceDecoder;
@@ -52,7 +53,7 @@
 class EventSource : public RefCounted<EventSource>, public ScriptWrappable, public EventTarget, private ThreadableLoaderClient, public ActiveDOMObject {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassRefPtr<EventSource> create(ScriptExecutionContext*, const String& url, const Dictionary&, ExceptionCode&);
+    static PassRefPtr<EventSource> create(ScriptExecutionContext*, const String& url, const Dictionary&, ExceptionState&);
     virtual ~EventSource();
 
     static const unsigned long long defaultReconnectDelay;
diff --git a/Source/core/page/FocusController.cpp b/Source/core/page/FocusController.cpp
index fdf5280..ebb81c4 100644
--- a/Source/core/page/FocusController.cpp
+++ b/Source/core/page/FocusController.cpp
@@ -127,15 +127,18 @@
         document->focusedElement()->dispatchFocusEvent(0, FocusDirectionNone);
 }
 
-static inline bool hasCustomFocusLogic(Node* node)
+static inline bool hasCustomFocusLogic(Element* element)
 {
-    return node->isHTMLElement() && toHTMLElement(node)->hasCustomFocusLogic();
+    return element->isHTMLElement() && toHTMLElement(element)->hasCustomFocusLogic();
 }
 
 static inline bool isNonFocusableShadowHost(Node* node)
 {
     ASSERT(node);
-    return !node->isFocusable() && isShadowHost(node) && !hasCustomFocusLogic(node);
+    if (!node->isElementNode())
+        return false;
+    Element* element = toElement(node);
+    return !element->isFocusable() && isShadowHost(element) && !hasCustomFocusLogic(element);
 }
 
 static inline bool isNonKeyboardFocusableShadowHost(Node* node)
diff --git a/Source/core/page/FrameActionScheduler.cpp b/Source/core/page/FrameActionScheduler.cpp
index dd09db0..e2278fa 100644
--- a/Source/core/page/FrameActionScheduler.cpp
+++ b/Source/core/page/FrameActionScheduler.cpp
@@ -26,8 +26,8 @@
 #include "config.h"
 #include "core/page/FrameActionScheduler.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Event.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/Node.h"
 #include "wtf/Vector.h"
 
@@ -45,7 +45,7 @@
     {
         // Only dispatch events to nodes that are in the document
         if (m_eventTarget->inDocument())
-            m_eventTarget->dispatchEvent(m_event, IGNORE_EXCEPTION);
+            m_eventTarget->dispatchEvent(m_event, IGNORE_EXCEPTION_STATE);
     }
 
 private:
diff --git a/Source/core/page/History.cpp b/Source/core/page/History.cpp
index 727f3d0..2d5cefc 100644
--- a/Source/core/page/History.cpp
+++ b/Source/core/page/History.cpp
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "core/page/History.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "bindings/v8/SerializedScriptValue.h"
 #include "core/dom/Document.h"
 #include "core/dom/ExceptionCode.h"
@@ -138,14 +139,14 @@
     return KURL(baseURL, urlString);
 }
 
-void History::stateObjectAdded(PassRefPtr<SerializedScriptValue> data, const String& title, const String& urlString, StateObjectType stateObjectType, ExceptionCode& ec)
+void History::stateObjectAdded(PassRefPtr<SerializedScriptValue> data, const String& title, const String& urlString, StateObjectType stateObjectType, ExceptionState& es)
 {
     if (!m_frame || !m_frame->page())
         return;
 
     KURL fullURL = urlForState(urlString);
     if (!fullURL.isValid() || !m_frame->document()->securityOrigin()->canRequest(fullURL)) {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return;
     }
 
diff --git a/Source/core/page/History.h b/Source/core/page/History.h
index e571730..9c74eae 100644
--- a/Source/core/page/History.h
+++ b/Source/core/page/History.h
@@ -38,7 +38,7 @@
 class Frame;
 class KURL;
 class ScriptExecutionContext;
-typedef int ExceptionCode;
+class ExceptionState;
 
 class History : public ScriptWrappable, public RefCounted<History>, public DOMWindowProperty {
 public:
@@ -61,7 +61,7 @@
         StateObjectPush,
         StateObjectReplace
     };
-    void stateObjectAdded(PassRefPtr<SerializedScriptValue>, const String& title, const String& url, StateObjectType, ExceptionCode&);
+    void stateObjectAdded(PassRefPtr<SerializedScriptValue>, const String& title, const String& url, StateObjectType, ExceptionState&);
 
 private:
     explicit History(Frame*);
diff --git a/Source/core/page/ImageBitmapFactories.cpp b/Source/core/page/ImageBitmapFactories.cpp
index bdd063d..c22a22f 100644
--- a/Source/core/page/ImageBitmapFactories.cpp
+++ b/Source/core/page/ImageBitmapFactories.cpp
@@ -33,6 +33,7 @@
 
 #include "RuntimeEnabledFeatures.h"
 #include "V8ImageBitmap.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/html/HTMLCanvasElement.h"
 #include "core/html/HTMLImageElement.h"
@@ -70,148 +71,148 @@
     return resolver->promise();
 }
 
-ScriptObject createImageBitmap(EventTarget* eventTarget, HTMLImageElement* image, ExceptionCode& ec)
+ScriptObject createImageBitmap(EventTarget* eventTarget, HTMLImageElement* image, ExceptionState& es)
 {
     LayoutSize s = sizeFor(image);
-    return createImageBitmap(eventTarget, image, 0, 0, s.width(), s.height(), ec);
+    return createImageBitmap(eventTarget, image, 0, 0, s.width(), s.height(), es);
 }
 
-ScriptObject createImageBitmap(EventTarget* eventTarget, HTMLImageElement* image, int sx, int sy, int sw, int sh, ExceptionCode& ec)
+ScriptObject createImageBitmap(EventTarget* eventTarget, HTMLImageElement* image, int sx, int sy, int sw, int sh, ExceptionState& es)
 {
     if (!image) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return ScriptObject();
     }
     if (!image->cachedImage()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return ScriptObject();
     }
     if (image->cachedImage()->image()->isSVGImage()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return ScriptObject();
     }
     if (!sw || !sh) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return ScriptObject();
     }
     if (!image->cachedImage()->image()->hasSingleSecurityOrigin()) {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return ScriptObject();
     }
     if (!image->cachedImage()->passesAccessControlCheck(eventTarget->toDOMWindow()->document()->securityOrigin())
     && eventTarget->toDOMWindow()->document()->securityOrigin()->taintsCanvas(image->src())) {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return ScriptObject();
     }
     // FIXME: make ImageBitmap creation asynchronous crbug.com/258082
     return resolveImageBitmap(ImageBitmap::create(image, IntRect(sx, sy, sw, sh)));
 }
 
-ScriptObject createImageBitmap(EventTarget* eventTarget, HTMLVideoElement* video, ExceptionCode& ec)
+ScriptObject createImageBitmap(EventTarget* eventTarget, HTMLVideoElement* video, ExceptionState& es)
 {
     IntSize s = sizeFor(video);
-    return createImageBitmap(eventTarget, video, 0, 0, s.width(), s.height(), ec);
+    return createImageBitmap(eventTarget, video, 0, 0, s.width(), s.height(), es);
 }
 
-ScriptObject createImageBitmap(EventTarget* eventTarget, HTMLVideoElement* video, int sx, int sy, int sw, int sh, ExceptionCode& ec)
+ScriptObject createImageBitmap(EventTarget* eventTarget, HTMLVideoElement* video, int sx, int sy, int sw, int sh, ExceptionState& es)
 {
     if (!video) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return ScriptObject();
     }
     if (!video->player()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return ScriptObject();
     }
     if (video->networkState() == HTMLMediaElement::NETWORK_EMPTY) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return ScriptObject();
     }
     if (video->player()->readyState() <= MediaPlayer::HaveMetadata) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return ScriptObject();
     }
     if (!sw || !sh) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return ScriptObject();
     }
     if (!video->hasSingleSecurityOrigin()) {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return ScriptObject();
     }
     if (!video->player()->didPassCORSAccessCheck() && eventTarget->toDOMWindow()->document()->securityOrigin()->taintsCanvas(video->currentSrc())) {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return ScriptObject();
     }
     // FIXME: make ImageBitmap creation asynchronous crbug.com/258082
     return resolveImageBitmap(ImageBitmap::create(video, IntRect(sx, sy, sw, sh)));
 }
 
-ScriptObject createImageBitmap(EventTarget* eventTarget, CanvasRenderingContext2D* context, ExceptionCode& ec)
+ScriptObject createImageBitmap(EventTarget* eventTarget, CanvasRenderingContext2D* context, ExceptionState& es)
 {
-    return createImageBitmap(eventTarget, context->canvas(), ec);
+    return createImageBitmap(eventTarget, context->canvas(), es);
 }
 
-ScriptObject createImageBitmap(EventTarget* eventTarget, CanvasRenderingContext2D* context, int sx, int sy, int sw, int sh, ExceptionCode& ec)
+ScriptObject createImageBitmap(EventTarget* eventTarget, CanvasRenderingContext2D* context, int sx, int sy, int sw, int sh, ExceptionState& es)
 {
-    return createImageBitmap(eventTarget, context->canvas(), sx, sy, sw, sh, ec);
+    return createImageBitmap(eventTarget, context->canvas(), sx, sy, sw, sh, es);
 }
 
-ScriptObject createImageBitmap(EventTarget* eventTarget, HTMLCanvasElement* canvas, ExceptionCode& ec)
+ScriptObject createImageBitmap(EventTarget* eventTarget, HTMLCanvasElement* canvas, ExceptionState& es)
 {
-    return createImageBitmap(eventTarget, canvas, 0, 0, canvas->width(), canvas->height(), ec);
+    return createImageBitmap(eventTarget, canvas, 0, 0, canvas->width(), canvas->height(), es);
 }
 
-ScriptObject createImageBitmap(EventTarget* eventTarget, HTMLCanvasElement* canvas, int sx, int sy, int sw, int sh, ExceptionCode& ec)
+ScriptObject createImageBitmap(EventTarget* eventTarget, HTMLCanvasElement* canvas, int sx, int sy, int sw, int sh, ExceptionState& es)
 {
     if (!canvas) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return ScriptObject();
     }
     if (!canvas->originClean()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return ScriptObject();
     }
     if (!sw || !sh) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return ScriptObject();
     }
     // FIXME: make ImageBitmap creation asynchronous crbug.com/258082
     return resolveImageBitmap(ImageBitmap::create(canvas, IntRect(sx, sy, sw, sh)));
 }
 
-ScriptObject createImageBitmap(EventTarget* eventTarget, ImageData* data, ExceptionCode& ec)
+ScriptObject createImageBitmap(EventTarget* eventTarget, ImageData* data, ExceptionState& es)
 {
-    return createImageBitmap(eventTarget, data, 0, 0, data->width(), data->height(), ec);
+    return createImageBitmap(eventTarget, data, 0, 0, data->width(), data->height(), es);
 }
 
-ScriptObject createImageBitmap(EventTarget* eventTarget, ImageData* data, int sx, int sy, int sw, int sh, ExceptionCode& ec)
+ScriptObject createImageBitmap(EventTarget* eventTarget, ImageData* data, int sx, int sy, int sw, int sh, ExceptionState& es)
 {
     if (!data) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return ScriptObject();
     }
     if (!sw || !sh) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return ScriptObject();
     }
     // FIXME: make ImageBitmap creation asynchronous crbug.com/258082
     return resolveImageBitmap(ImageBitmap::create(data, IntRect(sx, sy, sw, sh)));
 }
 
-ScriptObject createImageBitmap(EventTarget* eventTarget, ImageBitmap* bitmap, ExceptionCode& ec)
+ScriptObject createImageBitmap(EventTarget* eventTarget, ImageBitmap* bitmap, ExceptionState& es)
 {
-    return createImageBitmap(eventTarget, bitmap, 0, 0, bitmap->width(), bitmap->height(), ec);
+    return createImageBitmap(eventTarget, bitmap, 0, 0, bitmap->width(), bitmap->height(), es);
 }
 
-ScriptObject createImageBitmap(EventTarget* eventTarget, ImageBitmap* bitmap, int sx, int sy, int sw, int sh, ExceptionCode& ec)
+ScriptObject createImageBitmap(EventTarget* eventTarget, ImageBitmap* bitmap, int sx, int sy, int sw, int sh, ExceptionState& es)
 {
     if (!bitmap) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return ScriptObject();
     }
     if (!sw || !sh) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return ScriptObject();
     }
     // FIXME: make ImageBitmap creation asynchronous crbug.com/258082
diff --git a/Source/core/page/ImageBitmapFactories.h b/Source/core/page/ImageBitmapFactories.h
index aa8ec49..05feca4 100644
--- a/Source/core/page/ImageBitmapFactories.h
+++ b/Source/core/page/ImageBitmapFactories.h
@@ -37,6 +37,7 @@
 
 class CanvasRenderingContext2D;
 class EventTarget;
+class ExceptionState;
 class HTMLCanvasElement;
 class HTMLImageElement;
 class HTMLVideoElement;
@@ -45,20 +46,18 @@
 
 namespace ImageBitmapFactories {
 
-typedef int ExceptionCode;
-
-ScriptObject createImageBitmap(EventTarget*, HTMLImageElement*, ExceptionCode&);
-ScriptObject createImageBitmap(EventTarget*, HTMLImageElement*, int sx, int sy, int sw, int sh, ExceptionCode&);
-ScriptObject createImageBitmap(EventTarget*, HTMLVideoElement*, ExceptionCode&);
-ScriptObject createImageBitmap(EventTarget*, HTMLVideoElement*, int sx, int sy, int sw, int sh, ExceptionCode&);
-ScriptObject createImageBitmap(EventTarget*, CanvasRenderingContext2D*, ExceptionCode&);
-ScriptObject createImageBitmap(EventTarget*, CanvasRenderingContext2D*, int sx, int sy, int sw, int sh, ExceptionCode&);
-ScriptObject createImageBitmap(EventTarget*, HTMLCanvasElement*, ExceptionCode&);
-ScriptObject createImageBitmap(EventTarget*, HTMLCanvasElement*, int sx, int sy, int sw, int sh, ExceptionCode&);
-ScriptObject createImageBitmap(EventTarget*, ImageData*, ExceptionCode&);
-ScriptObject createImageBitmap(EventTarget*, ImageData*, int sx, int sy, int sw, int sh, ExceptionCode&);
-ScriptObject createImageBitmap(EventTarget*, ImageBitmap*, ExceptionCode&);
-ScriptObject createImageBitmap(EventTarget*, ImageBitmap*, int sx, int sy, int sw, int sh, ExceptionCode&);
+ScriptObject createImageBitmap(EventTarget*, HTMLImageElement*, ExceptionState&);
+ScriptObject createImageBitmap(EventTarget*, HTMLImageElement*, int sx, int sy, int sw, int sh, ExceptionState&);
+ScriptObject createImageBitmap(EventTarget*, HTMLVideoElement*, ExceptionState&);
+ScriptObject createImageBitmap(EventTarget*, HTMLVideoElement*, int sx, int sy, int sw, int sh, ExceptionState&);
+ScriptObject createImageBitmap(EventTarget*, CanvasRenderingContext2D*, ExceptionState&);
+ScriptObject createImageBitmap(EventTarget*, CanvasRenderingContext2D*, int sx, int sy, int sw, int sh, ExceptionState&);
+ScriptObject createImageBitmap(EventTarget*, HTMLCanvasElement*, ExceptionState&);
+ScriptObject createImageBitmap(EventTarget*, HTMLCanvasElement*, int sx, int sy, int sw, int sh, ExceptionState&);
+ScriptObject createImageBitmap(EventTarget*, ImageData*, ExceptionState&);
+ScriptObject createImageBitmap(EventTarget*, ImageData*, int sx, int sy, int sw, int sh, ExceptionState&);
+ScriptObject createImageBitmap(EventTarget*, ImageBitmap*, ExceptionState&);
+ScriptObject createImageBitmap(EventTarget*, ImageBitmap*, int sx, int sy, int sw, int sh, ExceptionState&);
 
 } // namesapce ImageBitmapFactories
 } // namespace WebCore
diff --git a/Source/core/page/Location.cpp b/Source/core/page/Location.cpp
index 8c9607c..a7aaac0 100644
--- a/Source/core/page/Location.cpp
+++ b/Source/core/page/Location.cpp
@@ -29,6 +29,7 @@
 #include "config.h"
 #include "core/page/Location.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/Document.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/loader/FrameLoader.h"
@@ -151,13 +152,13 @@
     setLocation(url, activeWindow, firstWindow);
 }
 
-void Location::setProtocol(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& protocol, ExceptionCode& ec)
+void Location::setProtocol(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& protocol, ExceptionState& es)
 {
     if (!m_frame)
         return;
     KURL url = m_frame->document()->url();
     if (!url.setProtocol(protocol)) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return;
     }
     setLocation(url.string(), activeWindow, firstWindow);
diff --git a/Source/core/page/Location.h b/Source/core/page/Location.h
index 2f57ac9..63c5b3c 100644
--- a/Source/core/page/Location.h
+++ b/Source/core/page/Location.h
@@ -39,11 +39,10 @@
 namespace WebCore {
 
 class DOMWindow;
+class ExceptionState;
 class Frame;
 class KURL;
 
-typedef int ExceptionCode;
-
 class Location : public ScriptWrappable, public RefCounted<Location>, public DOMWindowProperty {
 public:
     static PassRefPtr<Location> create(Frame* frame) { return adoptRef(new Location(frame)); }
@@ -55,7 +54,7 @@
     void replace(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
     void reload(DOMWindow* activeWindow);
 
-    void setProtocol(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&, ExceptionCode&);
+    void setProtocol(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&, ExceptionState&);
     String protocol() const;
     void setHost(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
     String host() const;
diff --git a/Source/core/page/Performance.cpp b/Source/core/page/Performance.cpp
index 7bf80e7..c7bd0a6 100644
--- a/Source/core/page/Performance.cpp
+++ b/Source/core/page/Performance.cpp
@@ -256,12 +256,12 @@
     return &m_eventTargetData;
 }
 
-void Performance::mark(const String& markName, ExceptionCode& ec)
+void Performance::mark(const String& markName, ExceptionState& es)
 {
-    ec = 0;
+    es.clearException();
     if (!m_userTiming)
         m_userTiming = UserTiming::create(this);
-    m_userTiming->mark(markName, ec);
+    m_userTiming->mark(markName, es);
 }
 
 void Performance::clearMarks(const String& markName)
@@ -271,12 +271,12 @@
     m_userTiming->clearMarks(markName);
 }
 
-void Performance::measure(const String& measureName, const String& startMark, const String& endMark, ExceptionCode& ec)
+void Performance::measure(const String& measureName, const String& startMark, const String& endMark, ExceptionState& es)
 {
-    ec = 0;
+    es.clearException();
     if (!m_userTiming)
         m_userTiming = UserTiming::create(this);
-    m_userTiming->measure(measureName, startMark, endMark, ec);
+    m_userTiming->measure(measureName, startMark, endMark, es);
 }
 
 void Performance::clearMeasures(const String& measureName)
diff --git a/Source/core/page/Performance.h b/Source/core/page/Performance.h
index a5ff477..ef2e211 100644
--- a/Source/core/page/Performance.h
+++ b/Source/core/page/Performance.h
@@ -47,6 +47,7 @@
 namespace WebCore {
 
 class Document;
+class ExceptionState;
 class ResourceRequest;
 class ResourceResponse;
 class ResourceTimingInfo;
@@ -79,10 +80,10 @@
     using RefCounted<Performance>::ref;
     using RefCounted<Performance>::deref;
 
-    void mark(const String& markName, ExceptionCode&);
+    void mark(const String& markName, ExceptionState&);
     void clearMarks(const String& markName);
 
-    void measure(const String& measureName, const String& startMark, const String& endMark, ExceptionCode&);
+    void measure(const String& measureName, const String& startMark, const String& endMark, ExceptionState&);
     void clearMeasures(const String& measureName);
 
 private:
diff --git a/Source/core/page/PerformanceUserTiming.cpp b/Source/core/page/PerformanceUserTiming.cpp
index c2e2587..2d8cbd8 100644
--- a/Source/core/page/PerformanceUserTiming.cpp
+++ b/Source/core/page/PerformanceUserTiming.cpp
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "core/page/PerformanceUserTiming.h"
 
+#include "bindings/v8/ExceptionState.h"
+#include "core/dom/ExceptionCode.h"
 #include "core/page/Performance.h"
 #include "core/page/PerformanceMark.h"
 #include "core/page/PerformanceMeasure.h"
@@ -96,11 +98,11 @@
         performanceEntryMap.remove(name);
 }
 
-void UserTiming::mark(const String& markName, ExceptionCode& ec)
+void UserTiming::mark(const String& markName, ExceptionState& es)
 {
-    ec = 0;
+    es.clearException();
     if (restrictedKeyMap().contains(markName)) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return;
     }
 
@@ -113,9 +115,9 @@
     clearPeformanceEntries(m_marksMap, markName);
 }
 
-double UserTiming::findExistingMarkStartTime(const String& markName, ExceptionCode& ec)
+double UserTiming::findExistingMarkStartTime(const String& markName, ExceptionState& es)
 {
-    ec = 0;
+    es.clearException();
 
     if (m_marksMap.contains(markName))
         return m_marksMap.get(markName).last()->startTime();
@@ -123,17 +125,17 @@
     if (restrictedKeyMap().contains(markName)) {
         double value = static_cast<double>((m_performance->timing()->*(restrictedKeyMap().get(markName)))());
         if (!value) {
-            ec = InvalidAccessError;
+            es.throwDOMException(InvalidAccessError);
             return 0.0;
         }
         return value - m_performance->timing()->navigationStart();
     }
 
-    ec = SyntaxError;
+    es.throwDOMException(SyntaxError);
     return 0.0;
 }
 
-void UserTiming::measure(const String& measureName, const String& startMark, const String& endMark, ExceptionCode& ec)
+void UserTiming::measure(const String& measureName, const String& startMark, const String& endMark, ExceptionState& es)
 {
     double startTime = 0.0;
     double endTime = 0.0;
@@ -142,15 +144,15 @@
         endTime = m_performance->now();
     else if (endMark.isNull()) {
         endTime = m_performance->now();
-        startTime = findExistingMarkStartTime(startMark, ec);
-        if (ec)
+        startTime = findExistingMarkStartTime(startMark, es);
+        if (es.hadException())
             return;
     } else {
-        endTime = findExistingMarkStartTime(endMark, ec);
-        if (ec)
+        endTime = findExistingMarkStartTime(endMark, es);
+        if (es.hadException())
             return;
-        startTime = findExistingMarkStartTime(startMark, ec);
-        if (ec)
+        startTime = findExistingMarkStartTime(startMark, es);
+        if (es.hadException())
             return;
     }
 
diff --git a/Source/core/page/PerformanceUserTiming.h b/Source/core/page/PerformanceUserTiming.h
index 9caf169..1f150ae 100644
--- a/Source/core/page/PerformanceUserTiming.h
+++ b/Source/core/page/PerformanceUserTiming.h
@@ -26,7 +26,6 @@
 #ifndef PerformanceUserTiming_h
 #define PerformanceUserTiming_h
 
-#include "core/dom/ExceptionCode.h"
 #include "core/page/PerformanceTiming.h"
 #include "wtf/HashMap.h"
 #include "wtf/PassRefPtr.h"
@@ -36,6 +35,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class Performance;
 class PerformanceEntry;
 
@@ -46,10 +46,10 @@
 public:
     static PassRefPtr<UserTiming> create(Performance* performance) { return adoptRef(new UserTiming(performance)); }
 
-    void mark(const String& markName, ExceptionCode&);
+    void mark(const String& markName, ExceptionState&);
     void clearMarks(const String& markName);
 
-    void measure(const String& measureName, const String& startMark, const String& endMark, ExceptionCode&);
+    void measure(const String& measureName, const String& startMark, const String& endMark, ExceptionState&);
     void clearMeasures(const String& measureName);
 
     Vector<RefPtr<PerformanceEntry> > getMarks() const;
@@ -61,7 +61,7 @@
 private:
     explicit UserTiming(Performance*);
 
-    double findExistingMarkStartTime(const String& markName, ExceptionCode&);
+    double findExistingMarkStartTime(const String& markName, ExceptionState&);
     Performance* m_performance;
     PerformanceEntryMap m_marksMap;
     PerformanceEntryMap m_measuresMap;
diff --git a/Source/core/platform/FileSystem.h b/Source/core/platform/FileSystem.h
index fc3c71f..9af0eca 100644
--- a/Source/core/platform/FileSystem.h
+++ b/Source/core/platform/FileSystem.h
@@ -55,7 +55,6 @@
 bool getFileSize(const String&, long long& result);
 bool getFileModificationTime(const String&, time_t& result);
 bool getFileMetadata(const String&, FileMetadata&);
-String pathGetFileName(const String&);
 String directoryName(const String&);
 
 inline double invalidFileTime() { return std::numeric_limits<double>::quiet_NaN(); }
diff --git a/Source/core/platform/chromium/ChromiumDataObject.cpp b/Source/core/platform/chromium/ChromiumDataObject.cpp
index 3b32349..b4ba2f3 100644
--- a/Source/core/platform/chromium/ChromiumDataObject.cpp
+++ b/Source/core/platform/chromium/ChromiumDataObject.cpp
@@ -31,12 +31,12 @@
 #include "config.h"
 #include "core/platform/chromium/ChromiumDataObject.h"
 
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/DataTransferItem.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/platform/chromium/ClipboardMimeTypes.h"
 #include "core/platform/chromium/ClipboardUtilitiesChromium.h"
-
 #include "public/platform/Platform.h"
 #include "public/platform/WebClipboard.h"
 
@@ -90,10 +90,10 @@
     m_itemList.clear();
 }
 
-void ChromiumDataObject::add(const String& data, const String& type, ExceptionCode& ec)
+void ChromiumDataObject::add(const String& data, const String& type, ExceptionState& es)
 {
     if (!internalAddStringItem(ChromiumDataObjectItem::createFromString(type, data)))
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
 }
 
 void ChromiumDataObject::add(PassRefPtr<File> file, ScriptExecutionContext* context)
@@ -155,7 +155,7 @@
 bool ChromiumDataObject::setData(const String& type, const String& data)
 {
     clearData(type);
-    add(data, type, ASSERT_NO_EXCEPTION);
+    add(data, type, ASSERT_NO_EXCEPTION_STATE);
     return true;
 }
 
diff --git a/Source/core/platform/chromium/ChromiumDataObject.h b/Source/core/platform/chromium/ChromiumDataObject.h
index f788aae..0406317 100644
--- a/Source/core/platform/chromium/ChromiumDataObject.h
+++ b/Source/core/platform/chromium/ChromiumDataObject.h
@@ -42,11 +42,10 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class KURL;
 class SharedBuffer;
 
-typedef int ExceptionCode;
-
 // A data object for holding data that would be in a clipboard or moved
 // during a drag-n-drop operation.  This is the data that WebCore is aware
 // of and is not specific to a platform.
@@ -63,7 +62,7 @@
     // FIXME: Implement V8DataTransferItemList::indexedPropertyDeleter to get this called.
     void deleteItem(unsigned long index);
     void clearAll();
-    void add(const String& data, const String& type, ExceptionCode&);
+    void add(const String& data, const String& type, ExceptionState&);
     void add(PassRefPtr<File>, ScriptExecutionContext*);
 
     // WebCore helpers.
diff --git a/Source/core/platform/chromium/ClipboardChromium.cpp b/Source/core/platform/chromium/ClipboardChromium.cpp
index ae03d4c..188cc6f 100644
--- a/Source/core/platform/chromium/ClipboardChromium.cpp
+++ b/Source/core/platform/chromium/ClipboardChromium.cpp
@@ -28,6 +28,7 @@
 #include "core/platform/chromium/ClipboardChromium.h"
 
 #include "HTMLNames.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/DataTransferItemList.h"
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
@@ -62,9 +63,9 @@
 
     virtual size_t length() const;
     virtual PassRefPtr<DataTransferItem> item(unsigned long index) OVERRIDE;
-    virtual void deleteItem(unsigned long index, ExceptionCode&) OVERRIDE;
+    virtual void deleteItem(unsigned long index, ExceptionState&) OVERRIDE;
     virtual void clear() OVERRIDE;
-    virtual void add(const String& data, const String& type, ExceptionCode&) OVERRIDE;
+    virtual void add(const String& data, const String& type, ExceptionState&) OVERRIDE;
     virtual void add(PassRefPtr<File>) OVERRIDE;
 
 private:
@@ -103,10 +104,10 @@
     return DataTransferItemPolicyWrapper::create(m_clipboard, item);
 }
 
-void DataTransferItemListPolicyWrapper::deleteItem(unsigned long index, ExceptionCode& ec)
+void DataTransferItemListPolicyWrapper::deleteItem(unsigned long index, ExceptionState& es)
 {
     if (!m_clipboard->canWriteData()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
     m_dataObject->deleteItem(index);
@@ -119,11 +120,11 @@
     m_dataObject->clearAll();
 }
 
-void DataTransferItemListPolicyWrapper::add(const String& data, const String& type, ExceptionCode& ec)
+void DataTransferItemListPolicyWrapper::add(const String& data, const String& type, ExceptionState& es)
 {
     if (!m_clipboard->canWriteData())
         return;
-    m_dataObject->add(data, type, ec);
+    m_dataObject->add(data, type, es);
 }
 
 void DataTransferItemListPolicyWrapper::add(PassRefPtr<File> file)
diff --git a/Source/core/platform/chromium/FileSystemChromiumLinux.cpp b/Source/core/platform/chromium/FileSystemChromiumLinux.cpp
deleted file mode 100644
index 4d1d4a8..0000000
--- a/Source/core/platform/chromium/FileSystemChromiumLinux.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2008, 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.
- */
-
-#include "config.h"
-#include "core/platform/FileSystem.h"
-
-namespace WebCore {
-
-String pathGetFileName(const String& path)
-{
-    return path.substring(path.reverseFind('/') + 1);
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/chromium/FileSystemChromiumMac.mm b/Source/core/platform/chromium/FileSystemChromiumMac.mm
deleted file mode 100644
index 0d32135..0000000
--- a/Source/core/platform/chromium/FileSystemChromiumMac.mm
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2008, 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.
- */
-
-#import "config.h"
-#import "core/platform/FileSystem.h"
-
-#import <Foundation/NSFileManager.h>
-#import <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-String pathGetFileName(const String& path)
-{
-    return [path lastPathComponent];
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/chromium/FileSystemChromiumWin.cpp b/Source/core/platform/chromium/FileSystemChromiumWin.cpp
deleted file mode 100644
index 3b9d2f8..0000000
--- a/Source/core/platform/chromium/FileSystemChromiumWin.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2008, 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.
- */
-
-#include "config.h"
-#include "core/platform/FileSystem.h"
-
-#include <windows.h>
-#include <shlwapi.h>
-
-namespace WebCore {
-
-String pathGetFileName(const String& path)
-{
-    return String(PathFindFileName(path.charactersWithNullTermination().data()));
-}
-
-} // namespace WebCore
diff --git a/Source/core/rendering/RenderMediaControlsChromium.cpp b/Source/core/rendering/RenderMediaControlsChromium.cpp
index f08f4ce..84b1928 100644
--- a/Source/core/rendering/RenderMediaControlsChromium.cpp
+++ b/Source/core/rendering/RenderMediaControlsChromium.cpp
@@ -28,6 +28,7 @@
 #include "config.h"
 #include "core/rendering/RenderMediaControlsChromium.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/html/HTMLMediaElement.h"
 #include "core/html/TimeRanges.h"
 #include "core/platform/graphics/Gradient.h"
@@ -215,8 +216,8 @@
         return true;
 
     for (unsigned i = 0; i < bufferedTimeRanges->length(); ++i) {
-        float start = bufferedTimeRanges->start(i, ASSERT_NO_EXCEPTION);
-        float end = bufferedTimeRanges->end(i, ASSERT_NO_EXCEPTION);
+        float start = bufferedTimeRanges->start(i, ASSERT_NO_EXCEPTION_STATE);
+        float end = bufferedTimeRanges->end(i, ASSERT_NO_EXCEPTION_STATE);
         if (std::isnan(start) || std::isnan(end) || start > currentTime || end < currentTime)
             continue;
         int startPosition = int(start * rect.width() / duration);
diff --git a/Source/core/rendering/RenderNamedFlowThread.cpp b/Source/core/rendering/RenderNamedFlowThread.cpp
index b7e7388..76905a7 100644
--- a/Source/core/rendering/RenderNamedFlowThread.cpp
+++ b/Source/core/rendering/RenderNamedFlowThread.cpp
@@ -27,7 +27,7 @@
 #include "core/rendering/RenderNamedFlowThread.h"
 
 #include "RuntimeEnabledFeatures.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/NamedFlow.h"
 #include "core/dom/NodeRenderingContext.h"
 #include "core/dom/NodeTraversal.h"
@@ -612,16 +612,16 @@
             if (!boxIntersectsRegion(logicalTopForRenderer, logicalBottomForRenderer, logicalTopForRegion, logicalBottomForRegion)) {
                 if (foundStartPosition) {
                     if (!startsAboveRegion) {
-                        if (range->intersectsNode(node, IGNORE_EXCEPTION))
-                            range->setEndBefore(node, IGNORE_EXCEPTION);
-                        rangeObjects.append(range->cloneRange(IGNORE_EXCEPTION));
+                        if (range->intersectsNode(node, IGNORE_EXCEPTION_STATE))
+                            range->setEndBefore(node, IGNORE_EXCEPTION_STATE);
+                        rangeObjects.append(range->cloneRange(IGNORE_EXCEPTION_STATE));
                         range = Range::create(contentNode->document());
                         startsAboveRegion = true;
                     } else
                         skipOverOutsideNodes = true;
                 }
                 if (skipOverOutsideNodes)
-                    range->setStartAfter(node, IGNORE_EXCEPTION);
+                    range->setStartAfter(node, IGNORE_EXCEPTION_STATE);
                 foundStartPosition = false;
                 continue;
             }
@@ -648,7 +648,7 @@
                 // the range is closed.
                 if (startsAboveRegion) {
                     startsAboveRegion = false;
-                    range->setStartBefore(node, IGNORE_EXCEPTION);
+                    range->setStartBefore(node, IGNORE_EXCEPTION_STATE);
                 }
             }
             skipOverOutsideNodes  = false;
@@ -682,7 +682,7 @@
                 // for elements that ends inside the region, set the end position to be after them
                 // allow this end position to be changed only by other elements that are not descendants of the current end node
                 if (endsBelowRegion || (!endsBelowRegion && !node->isDescendantOf(lastEndNode))) {
-                    range->setEndAfter(node, IGNORE_EXCEPTION);
+                    range->setEndAfter(node, IGNORE_EXCEPTION_STATE);
                     endsBelowRegion = false;
                     lastEndNode = node;
                 }
diff --git a/Source/core/rendering/style/SVGRenderStyle.h b/Source/core/rendering/style/SVGRenderStyle.h
index 7fd3d75..7af9ce5 100644
--- a/Source/core/rendering/style/SVGRenderStyle.h
+++ b/Source/core/rendering/style/SVGRenderStyle.h
@@ -23,8 +23,8 @@
 #ifndef SVGRenderStyle_h
 #define SVGRenderStyle_h
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/css/CSSValueList.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/platform/graphics/GraphicsTypes.h"
 #include "core/platform/graphics/Path.h"
 #include "core/rendering/style/DataRef.h"
@@ -97,28 +97,28 @@
     static SVGLength initialBaselineShiftValue()
     {
         SVGLength length;
-        length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION);
+        length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION_STATE);
         return length;
     }
 
     static SVGLength initialKerning()
     {
         SVGLength length;
-        length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION);
+        length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION_STATE);
         return length;
     }
 
     static SVGLength initialStrokeDashOffset()
     {
         SVGLength length;
-        length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION);
+        length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION_STATE);
         return length;
     }
 
     static SVGLength initialStrokeWidth()
     {
         SVGLength length;
-        length.newValueSpecifiedUnits(LengthTypeNumber, 1, ASSERT_NO_EXCEPTION);
+        length.newValueSpecifiedUnits(LengthTypeNumber, 1, ASSERT_NO_EXCEPTION_STATE);
         return length;
     }
 
diff --git a/Source/core/storage/Storage.cpp b/Source/core/storage/Storage.cpp
index 7ae2a87..3458828 100644
--- a/Source/core/storage/Storage.cpp
+++ b/Source/core/storage/Storage.cpp
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "core/storage/Storage.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "wtf/PassOwnPtr.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
@@ -50,74 +51,74 @@
 {
 }
 
-String Storage::anonymousIndexedGetter(unsigned index, ExceptionCode& ec)
+String Storage::anonymousIndexedGetter(unsigned index, ExceptionState& es)
 {
-    return anonymousNamedGetter(String::number(index), ec);
+    return anonymousNamedGetter(String::number(index), es);
 }
 
-String Storage::anonymousNamedGetter(const AtomicString& name, ExceptionCode& ec)
+String Storage::anonymousNamedGetter(const AtomicString& name, ExceptionState& es)
 {
-    ec = 0;
-    bool found = contains(name, ec);
-    if (ec || !found)
+    es.clearException();
+    bool found = contains(name, es);
+    if (es.hadException() || !found)
         return String();
-    String result = getItem(name, ec);
-    if (ec)
+    String result = getItem(name, es);
+    if (es.hadException())
         return String();
     return result;
 }
 
-bool Storage::anonymousNamedSetter(const AtomicString& name, const AtomicString& value, ExceptionCode& ec)
+bool Storage::anonymousNamedSetter(const AtomicString& name, const AtomicString& value, ExceptionState& es)
 {
-    setItem(name, value, ec);
+    setItem(name, value, es);
     return true;
 }
 
-bool Storage::anonymousIndexedSetter(unsigned index, const AtomicString& value, ExceptionCode& ec)
+bool Storage::anonymousIndexedSetter(unsigned index, const AtomicString& value, ExceptionState& es)
 {
-    return anonymousNamedSetter(String::number(index), value, ec);
+    return anonymousNamedSetter(String::number(index), value, es);
 }
 
-bool Storage::anonymousNamedDeleter(const AtomicString& name, ExceptionCode& ec)
+bool Storage::anonymousNamedDeleter(const AtomicString& name, ExceptionState& es)
 {
-    bool found = contains(name, ec);
-    if (!found || ec)
+    bool found = contains(name, es);
+    if (!found || es.hadException())
         return false;
-    removeItem(name, ec);
-    if (ec)
+    removeItem(name, es);
+    if (es.hadException())
         return false;
     return true;
 }
 
-bool Storage::anonymousIndexedDeleter(unsigned index, ExceptionCode& ec)
+bool Storage::anonymousIndexedDeleter(unsigned index, ExceptionState& es)
 {
-    return anonymousNamedDeleter(String::number(index), ec);
+    return anonymousNamedDeleter(String::number(index), es);
 }
 
-void Storage::namedPropertyEnumerator(Vector<String>& names, ExceptionCode& ec)
+void Storage::namedPropertyEnumerator(Vector<String>& names, ExceptionState& es)
 {
-    unsigned length = this->length(ec);
-    if (ec)
+    unsigned length = this->length(es);
+    if (es.hadException())
         return;
     names.resize(length);
     for (unsigned i = 0; i < length; ++i) {
-        String key = this->key(i, ec);
-        if (ec)
+        String key = this->key(i, es);
+        if (es.hadException())
             return;
         ASSERT(!key.isNull());
-        String val = getItem(key, ec);
-        if (ec)
+        String val = getItem(key, es);
+        if (es.hadException())
             return;
         names[i] = key;
     }
 }
 
-bool Storage::namedPropertyQuery(const AtomicString& name, ExceptionCode& ec)
+bool Storage::namedPropertyQuery(const AtomicString& name, ExceptionState& es)
 {
     if (name == "length")
         return false;
-    bool found = contains(name, ec);
-    if (ec || !found)
+    bool found = contains(name, es);
+    if (es.hadException() || !found)
         return false;
     return true;
 }
diff --git a/Source/core/storage/Storage.h b/Source/core/storage/Storage.h
index 76d3149..4ffefd5 100644
--- a/Source/core/storage/Storage.h
+++ b/Source/core/storage/Storage.h
@@ -35,38 +35,38 @@
 
 namespace WebCore {
 
-    class Frame;
-    typedef int ExceptionCode;
+class ExceptionState;
+class Frame;
 
-    class Storage : public ScriptWrappable, public RefCounted<Storage>, public DOMWindowProperty {
-    public:
-        static PassRefPtr<Storage> create(Frame*, PassOwnPtr<StorageArea>);
-        ~Storage();
+class Storage : public ScriptWrappable, public RefCounted<Storage>, public DOMWindowProperty {
+public:
+    static PassRefPtr<Storage> create(Frame*, PassOwnPtr<StorageArea>);
+    ~Storage();
 
-        unsigned length(ExceptionCode& ec) const { return m_storageArea->length(ec, m_frame); }
-        String key(unsigned index, ExceptionCode& ec) const { return m_storageArea->key(index, ec, m_frame); }
-        String getItem(const String& key, ExceptionCode& ec) const { return m_storageArea->getItem(key, ec, m_frame); }
-        void setItem(const String& key, const String& value, ExceptionCode& ec) { m_storageArea->setItem(key, value, ec, m_frame); }
-        void removeItem(const String& key, ExceptionCode& ec) { m_storageArea->removeItem(key, ec, m_frame); }
-        void clear(ExceptionCode& ec) { m_storageArea->clear(ec, m_frame); }
-        bool contains(const String& key, ExceptionCode& ec) const { return m_storageArea->contains(key, ec, m_frame); }
+    unsigned length(ExceptionState& ec) const { return m_storageArea->length(ec, m_frame); }
+    String key(unsigned index, ExceptionState& ec) const { return m_storageArea->key(index, ec, m_frame); }
+    String getItem(const String& key, ExceptionState& ec) const { return m_storageArea->getItem(key, ec, m_frame); }
+    void setItem(const String& key, const String& value, ExceptionState& ec) { m_storageArea->setItem(key, value, ec, m_frame); }
+    void removeItem(const String& key, ExceptionState& ec) { m_storageArea->removeItem(key, ec, m_frame); }
+    void clear(ExceptionState& ec) { m_storageArea->clear(ec, m_frame); }
+    bool contains(const String& key, ExceptionState& ec) const { return m_storageArea->contains(key, ec, m_frame); }
 
-        StorageArea* area() const { return m_storageArea.get(); }
+    StorageArea* area() const { return m_storageArea.get(); }
 
-        String anonymousIndexedGetter(unsigned, ExceptionCode&);
-        String anonymousNamedGetter(const AtomicString&, ExceptionCode&);
-        bool anonymousNamedSetter(const AtomicString& name, const AtomicString& value, ExceptionCode&);
-        bool anonymousIndexedSetter(unsigned, const AtomicString&, ExceptionCode&);
-        bool anonymousNamedDeleter(const AtomicString&, ExceptionCode&);
-        bool anonymousIndexedDeleter(unsigned, ExceptionCode&);
-        void namedPropertyEnumerator(Vector<String>&, ExceptionCode&);
-        bool namedPropertyQuery(const AtomicString&, ExceptionCode&);
+    String anonymousIndexedGetter(unsigned, ExceptionState&);
+    String anonymousNamedGetter(const AtomicString&, ExceptionState&);
+    bool anonymousNamedSetter(const AtomicString& name, const AtomicString& value, ExceptionState&);
+    bool anonymousIndexedSetter(unsigned, const AtomicString&, ExceptionState&);
+    bool anonymousNamedDeleter(const AtomicString&, ExceptionState&);
+    bool anonymousIndexedDeleter(unsigned, ExceptionState&);
+    void namedPropertyEnumerator(Vector<String>&, ExceptionState&);
+    bool namedPropertyQuery(const AtomicString&, ExceptionState&);
 
-    private:
-        Storage(Frame*, PassOwnPtr<StorageArea>);
+private:
+    Storage(Frame*, PassOwnPtr<StorageArea>);
 
-        OwnPtr<StorageArea> m_storageArea;
-    };
+    OwnPtr<StorageArea> m_storageArea;
+};
 
 } // namespace WebCore
 
diff --git a/Source/core/storage/StorageArea.h b/Source/core/storage/StorageArea.h
index b2f88a1..00533e5 100644
--- a/Source/core/storage/StorageArea.h
+++ b/Source/core/storage/StorageArea.h
@@ -31,10 +31,10 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class Frame;
 class SecurityOrigin;
 class StorageSyncManager;
-typedef int ExceptionCode;
 enum StorageType { LocalStorage, SessionStorage };
 
 class StorageArea {
@@ -43,13 +43,13 @@
 
     // The HTML5 DOM Storage API
     // FIXME: We should pass Document instead of Frame. Also, that parameter should go first.
-    virtual unsigned length(ExceptionCode&, Frame* sourceFrame) = 0;
-    virtual String key(unsigned index, ExceptionCode&, Frame* sourceFrame) = 0;
-    virtual String getItem(const String& key, ExceptionCode&, Frame* sourceFrame) = 0;
-    virtual void setItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame) = 0;
-    virtual void removeItem(const String& key, ExceptionCode&, Frame* sourceFrame) = 0;
-    virtual void clear(ExceptionCode&, Frame* sourceFrame) = 0;
-    virtual bool contains(const String& key, ExceptionCode&, Frame* sourceFrame) = 0;
+    virtual unsigned length(ExceptionState&, Frame* sourceFrame) = 0;
+    virtual String key(unsigned index, ExceptionState&, Frame* sourceFrame) = 0;
+    virtual String getItem(const String& key, ExceptionState&, Frame* sourceFrame) = 0;
+    virtual void setItem(const String& key, const String& value, ExceptionState&, Frame* sourceFrame) = 0;
+    virtual void removeItem(const String& key, ExceptionState&, Frame* sourceFrame) = 0;
+    virtual void clear(ExceptionState&, Frame* sourceFrame) = 0;
+    virtual bool contains(const String& key, ExceptionState&, Frame* sourceFrame) = 0;
 
     virtual bool canAccessStorage(Frame*) = 0;
 
diff --git a/Source/core/svg/SVGAltGlyphElement.cpp b/Source/core/svg/SVGAltGlyphElement.cpp
index 0f4132d..c5224b8 100644
--- a/Source/core/svg/SVGAltGlyphElement.cpp
+++ b/Source/core/svg/SVGAltGlyphElement.cpp
@@ -27,6 +27,7 @@
 
 #include "SVGNames.h"
 #include "XLinkNames.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/NodeRenderingContext.h"
 #include "core/rendering/svg/RenderSVGTSpan.h"
@@ -55,9 +56,9 @@
     return adoptRef(new SVGAltGlyphElement(tagName, document));
 }
 
-void SVGAltGlyphElement::setGlyphRef(const AtomicString&, ExceptionCode& ec)
+void SVGAltGlyphElement::setGlyphRef(const AtomicString&, ExceptionState& es)
 {
-    ec = NoModificationAllowedError;
+    es.throwDOMException(NoModificationAllowedError);
 }
 
 const AtomicString& SVGAltGlyphElement::glyphRef() const
@@ -65,9 +66,9 @@
     return fastGetAttribute(SVGNames::glyphRefAttr);
 }
 
-void SVGAltGlyphElement::setFormat(const AtomicString&, ExceptionCode& ec)
+void SVGAltGlyphElement::setFormat(const AtomicString&, ExceptionState& es)
 {
-    ec = NoModificationAllowedError;
+    es.throwDOMException(NoModificationAllowedError);
 }
 
 const AtomicString& SVGAltGlyphElement::format() const
diff --git a/Source/core/svg/SVGAltGlyphElement.h b/Source/core/svg/SVGAltGlyphElement.h
index 6ed5525..9ab0bca 100644
--- a/Source/core/svg/SVGAltGlyphElement.h
+++ b/Source/core/svg/SVGAltGlyphElement.h
@@ -29,6 +29,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class SVGGlyphElement;
 
 class SVGAltGlyphElement FINAL : public SVGTextPositioningElement,
@@ -37,9 +38,9 @@
     static PassRefPtr<SVGAltGlyphElement> create(const QualifiedName&, Document*);
 
     const AtomicString& glyphRef() const;
-    void setGlyphRef(const AtomicString&, ExceptionCode&);
+    void setGlyphRef(const AtomicString&, ExceptionState&);
     const AtomicString& format() const;
-    void setFormat(const AtomicString&, ExceptionCode&);
+    void setFormat(const AtomicString&, ExceptionState&);
 
     bool hasValidGlyphElements(Vector<String>& glyphNames) const;
 
diff --git a/Source/core/svg/SVGAngle.cpp b/Source/core/svg/SVGAngle.cpp
index e88f600..661f935 100644
--- a/Source/core/svg/SVGAngle.cpp
+++ b/Source/core/svg/SVGAngle.cpp
@@ -22,6 +22,7 @@
 #include "config.h"
 #include "core/svg/SVGAngle.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/svg/SVGParserUtilities.h"
 #include "wtf/MathExtras.h"
@@ -149,7 +150,7 @@
     return true;
 }
 
-void SVGAngle::setValueAsString(const String& value, ExceptionCode& ec)
+void SVGAngle::setValueAsString(const String& value, ExceptionState& es)
 {
     if (value.isEmpty()) {
         m_unitType = SVG_ANGLETYPE_UNSPECIFIED;
@@ -162,7 +163,7 @@
     bool success = value.is8Bit() ? parseValue<LChar>(value, valueInSpecifiedUnits, unitType)
                                   : parseValue<UChar>(value, valueInSpecifiedUnits, unitType);
     if (!success) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return;
     }
 
@@ -170,10 +171,10 @@
     m_valueInSpecifiedUnits = valueInSpecifiedUnits;
 }
 
-void SVGAngle::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits, ExceptionCode& ec)
+void SVGAngle::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits, ExceptionState& es)
 {
     if (unitType == SVG_ANGLETYPE_UNKNOWN || unitType > SVG_ANGLETYPE_GRAD) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
 
@@ -183,10 +184,10 @@
     m_valueInSpecifiedUnits = valueInSpecifiedUnits;
 }
 
-void SVGAngle::convertToSpecifiedUnits(unsigned short unitType, ExceptionCode& ec)
+void SVGAngle::convertToSpecifiedUnits(unsigned short unitType, ExceptionState& es)
 {
     if (unitType == SVG_ANGLETYPE_UNKNOWN || m_unitType == SVG_ANGLETYPE_UNKNOWN || unitType > SVG_ANGLETYPE_GRAD) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
 
diff --git a/Source/core/svg/SVGAngle.h b/Source/core/svg/SVGAngle.h
index fa3b743..860d3f0 100644
--- a/Source/core/svg/SVGAngle.h
+++ b/Source/core/svg/SVGAngle.h
@@ -26,7 +26,7 @@
 
 namespace WebCore {
 
-typedef int ExceptionCode;
+class ExceptionState;
 
 class SVGAngle {
     WTF_MAKE_FAST_ALLOCATED;
@@ -49,11 +49,11 @@
     void setValueInSpecifiedUnits(float valueInSpecifiedUnits) { m_valueInSpecifiedUnits = valueInSpecifiedUnits; }
     float valueInSpecifiedUnits() const { return m_valueInSpecifiedUnits; }
 
-    void setValueAsString(const String&, ExceptionCode&);
+    void setValueAsString(const String&, ExceptionState&);
     String valueAsString() const;
 
-    void newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits, ExceptionCode&);
-    void convertToSpecifiedUnits(unsigned short unitType, ExceptionCode&);
+    void newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits, ExceptionState&);
+    void convertToSpecifiedUnits(unsigned short unitType, ExceptionState&);
 
 private:
     SVGAngleType m_unitType;
diff --git a/Source/core/svg/SVGAnimatedAngle.cpp b/Source/core/svg/SVGAnimatedAngle.cpp
index 857248f..b560432 100644
--- a/Source/core/svg/SVGAnimatedAngle.cpp
+++ b/Source/core/svg/SVGAnimatedAngle.cpp
@@ -18,9 +18,9 @@
  */
 
 #include "config.h"
-
 #include "core/svg/SVGAnimatedAngle.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/svg/SVGAnimateElement.h"
 #include "core/svg/SVGMarkerElement.h"
 
@@ -34,7 +34,7 @@
 static inline SVGAngle& sharedSVGAngle(const String& valueAsString)
 {
     DEFINE_STATIC_LOCAL(SVGAngle, sharedAngle, ());
-    sharedAngle.setValueAsString(valueAsString, ASSERT_NO_EXCEPTION);
+    sharedAngle.setValueAsString(valueAsString, ASSERT_NO_EXCEPTION_STATE);
     return sharedAngle;
 }
 
@@ -150,9 +150,9 @@
 float SVGAnimatedAngleAnimator::calculateDistance(const String& fromString, const String& toString)
 {
     SVGAngle from = SVGAngle();
-    from.setValueAsString(fromString, ASSERT_NO_EXCEPTION);
+    from.setValueAsString(fromString, ASSERT_NO_EXCEPTION_STATE);
     SVGAngle to = SVGAngle();
-    to.setValueAsString(toString, ASSERT_NO_EXCEPTION);
+    to.setValueAsString(toString, ASSERT_NO_EXCEPTION_STATE);
     return fabsf(to.value() - from.value());
 }
 
diff --git a/Source/core/svg/SVGAnimatedLength.cpp b/Source/core/svg/SVGAnimatedLength.cpp
index 3059518..1492cae 100644
--- a/Source/core/svg/SVGAnimatedLength.cpp
+++ b/Source/core/svg/SVGAnimatedLength.cpp
@@ -18,9 +18,9 @@
  */
 
 #include "config.h"
-
 #include "core/svg/SVGAnimatedLength.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/svg/SVGAnimateElement.h"
 #include "core/svg/SVGAnimatedNumber.h"
 
@@ -35,7 +35,7 @@
 static inline SVGLength& sharedSVGLength(SVGLengthMode mode, const String& valueAsString)
 {
     DEFINE_STATIC_LOCAL(SVGLength, sharedLength, ());
-    sharedLength.setValueAsString(valueAsString, mode, ASSERT_NO_EXCEPTION);
+    sharedLength.setValueAsString(valueAsString, mode, ASSERT_NO_EXCEPTION_STATE);
     return sharedLength;
 }
 
@@ -78,7 +78,7 @@
     const SVGLength& fromLength = from->length();
     SVGLength& toLength = to->length();
 
-    toLength.setValue(toLength.value(lengthContext) + fromLength.value(lengthContext), lengthContext, ASSERT_NO_EXCEPTION);
+    toLength.setValue(toLength.value(lengthContext) + fromLength.value(lengthContext), lengthContext, ASSERT_NO_EXCEPTION_STATE);
 }
 
 static SVGLength parseLengthFromString(SVGAnimationElement* animationElement, const String& string)
@@ -105,7 +105,7 @@
     SVGLengthType unitType = percentage < 0.5 ? fromSVGLength.unitType() : toSVGLength.unitType();
     m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromSVGLength.value(lengthContext), toSVGLength.value(lengthContext), toAtEndOfDurationSVGLength.value(lengthContext), animatedNumber);
 
-    animatedSVGLength.setValue(lengthContext, animatedNumber, m_lengthMode, unitType, ASSERT_NO_EXCEPTION);
+    animatedSVGLength.setValue(lengthContext, animatedNumber, m_lengthMode, unitType, ASSERT_NO_EXCEPTION_STATE);
 }
 
 float SVGAnimatedLengthAnimator::calculateDistance(const String& fromString, const String& toString)
diff --git a/Source/core/svg/SVGAnimatedLengthList.cpp b/Source/core/svg/SVGAnimatedLengthList.cpp
index cea57d9..1e0533e 100644
--- a/Source/core/svg/SVGAnimatedLengthList.cpp
+++ b/Source/core/svg/SVGAnimatedLengthList.cpp
@@ -18,9 +18,9 @@
  */
 
 #include "config.h"
-
 #include "core/svg/SVGAnimatedLengthList.h"
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/svg/SVGAnimateElement.h"
 #include "core/svg/SVGAnimatedNumber.h"
 
@@ -78,7 +78,7 @@
 
     SVGLengthContext lengthContext(m_contextElement);
     for (unsigned i = 0; i < fromLengthListSize; ++i)
-        toLengthList[i].setValue(toLengthList[i].value(lengthContext) + fromLengthList[i].value(lengthContext), lengthContext, ASSERT_NO_EXCEPTION);
+        toLengthList[i].setValue(toLengthList[i].value(lengthContext) + fromLengthList[i].value(lengthContext), lengthContext, ASSERT_NO_EXCEPTION_STATE);
 }
 
 static SVGLengthList parseLengthListFromString(SVGAnimationElement* animationElement, const String& string)
@@ -122,7 +122,7 @@
         float effectiveToAtEnd = i < toAtEndOfDurationListSize ? toAtEndOfDurationLengthList[i].value(lengthContext) : 0;
 
         m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom, toLengthList[i].value(lengthContext), effectiveToAtEnd, animatedNumber);
-        animatedLengthList[i].setValue(lengthContext, animatedNumber, m_lengthMode, unitType, ASSERT_NO_EXCEPTION);
+        animatedLengthList[i].setValue(lengthContext, animatedNumber, m_lengthMode, unitType, ASSERT_NO_EXCEPTION_STATE);
     }
 }
 
diff --git a/Source/core/svg/SVGAnimatedType.cpp b/Source/core/svg/SVGAnimatedType.cpp
index 8816e7a..8a1031d 100644
--- a/Source/core/svg/SVGAnimatedType.cpp
+++ b/Source/core/svg/SVGAnimatedType.cpp
@@ -18,9 +18,10 @@
  */
 
 #include "config.h"
-
 #include "core/svg/SVGAnimatedType.h"
 
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/svg/SVGParserUtilities.h"
 #include "core/svg/SVGPathByteStream.h"
 
@@ -280,9 +281,9 @@
         break;
     case AnimatedLength: {
         ASSERT(m_data.length);
-        ExceptionCode ec = 0;
-        m_data.length->setValueAsString(value, SVGLength::lengthModeForAnimatedLengthAttribute(attrName), ec);
-        return !ec;
+        TrackExceptionState es;
+        m_data.length->setValueAsString(value, SVGLength::lengthModeForAnimatedLengthAttribute(attrName), es);
+        return !es.hadException();
     }
     case AnimatedLengthList:
         ASSERT(m_data.lengthList);
diff --git a/Source/core/svg/SVGColor.cpp b/Source/core/svg/SVGColor.cpp
index 71782e9..933f44f 100644
--- a/Source/core/svg/SVGColor.cpp
+++ b/Source/core/svg/SVGColor.cpp
@@ -20,9 +20,9 @@
  */
 
 #include "config.h"
-
 #include "core/svg/SVGColor.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/css/CSSParser.h"
 #include "core/css/RGBColor.h"
 
@@ -58,21 +58,21 @@
     return false;
 }
 
-void SVGColor::setRGBColor(const String&, ExceptionCode& ec)
+void SVGColor::setRGBColor(const String&, ExceptionState& es)
 {
     // The whole SVGColor interface is deprecated in SVG 1.1 (2nd edition).
     // The setters are the most problematic part so we remove the support for those first.
-    ec = NoModificationAllowedError;
+    es.throwDOMException(NoModificationAllowedError);
 }
 
-void SVGColor::setRGBColorICCColor(const String&, const String&, ExceptionCode& ec)
+void SVGColor::setRGBColorICCColor(const String&, const String&, ExceptionState& es)
 {
-    ec = NoModificationAllowedError;
+    es.throwDOMException(NoModificationAllowedError);
 }
 
-void SVGColor::setColor(unsigned short, const String&, const String&, ExceptionCode& ec)
+void SVGColor::setColor(unsigned short, const String&, const String&, ExceptionState& es)
 {
-    ec = NoModificationAllowedError;
+    es.throwDOMException(NoModificationAllowedError);
 }
 
 String SVGColor::customCssText() const
diff --git a/Source/core/svg/SVGColor.h b/Source/core/svg/SVGColor.h
index fca9d76..0622a70 100644
--- a/Source/core/svg/SVGColor.h
+++ b/Source/core/svg/SVGColor.h
@@ -28,6 +28,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class RGBColor;
 
 class SVGColor : public CSSValue {
@@ -70,9 +71,9 @@
         return color;
     }
 
-    void setRGBColor(const String& rgbColor, ExceptionCode&);
-    void setRGBColorICCColor(const String& rgbColor, const String& iccColor, ExceptionCode&);
-    void setColor(unsigned short colorType, const String& rgbColor, const String& iccColor, ExceptionCode&);
+    void setRGBColor(const String& rgbColor, ExceptionState&);
+    void setRGBColorICCColor(const String& rgbColor, const String& iccColor, ExceptionState&);
+    void setColor(unsigned short colorType, const String& rgbColor, const String& iccColor, ExceptionState&);
 
     String customCssText() const;
 
diff --git a/Source/core/svg/SVGDocument.cpp b/Source/core/svg/SVGDocument.cpp
index 06dd368..72908db 100644
--- a/Source/core/svg/SVGDocument.cpp
+++ b/Source/core/svg/SVGDocument.cpp
@@ -22,8 +22,8 @@
 #include "core/svg/SVGDocument.h"
 
 #include "SVGNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/EventNames.h"
-#include "core/dom/ExceptionCode.h"
 #include "core/dom/NodeRenderingContext.h"
 #include "core/page/FrameView.h"
 #include "core/rendering/RenderView.h"
@@ -52,18 +52,18 @@
 
 void SVGDocument::dispatchZoomEvent(float prevScale, float newScale)
 {
-    RefPtr<SVGZoomEvent> event = static_pointer_cast<SVGZoomEvent>(createEvent("SVGZoomEvents", IGNORE_EXCEPTION));
+    RefPtr<SVGZoomEvent> event = static_pointer_cast<SVGZoomEvent>(createEvent("SVGZoomEvents", IGNORE_EXCEPTION_STATE));
     event->initEvent(eventNames().zoomEvent, true, false);
     event->setPreviousScale(prevScale);
     event->setNewScale(newScale);
-    rootElement()->dispatchEvent(event.release(), IGNORE_EXCEPTION);
+    rootElement()->dispatchEvent(event.release(), IGNORE_EXCEPTION_STATE);
 }
 
 void SVGDocument::dispatchScrollEvent()
 {
-    RefPtr<Event> event = createEvent("SVGEvents", IGNORE_EXCEPTION);
+    RefPtr<Event> event = createEvent("SVGEvents", IGNORE_EXCEPTION_STATE);
     event->initEvent(eventNames().scrollEvent, true, false);
-    rootElement()->dispatchEvent(event.release(), IGNORE_EXCEPTION);
+    rootElement()->dispatchEvent(event.release(), IGNORE_EXCEPTION_STATE);
 }
 
 bool SVGDocument::zoomAndPanEnabled() const
diff --git a/Source/core/svg/SVGLength.cpp b/Source/core/svg/SVGLength.cpp
index 726bb2b..190b0d6 100644
--- a/Source/core/svg/SVGLength.cpp
+++ b/Source/core/svg/SVGLength.cpp
@@ -24,9 +24,10 @@
 #include "core/svg/SVGLength.h"
 
 #include "SVGNames.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/css/CSSPrimitiveValue.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/svg/SVGParserUtilities.h"
 #include "wtf/MathExtras.h"
 #include "wtf/text/WTFString.h"
@@ -121,14 +122,14 @@
     : m_valueInSpecifiedUnits(0)
     , m_unit(storeUnit(mode, LengthTypeNumber))
 {
-    setValueAsString(valueAsString, IGNORE_EXCEPTION);
+    setValueAsString(valueAsString, IGNORE_EXCEPTION_STATE);
 }
 
 SVGLength::SVGLength(const SVGLengthContext& context, float value, SVGLengthMode mode, SVGLengthType unitType)
     : m_valueInSpecifiedUnits(0)
     , m_unit(storeUnit(mode, unitType))
 {
-    setValue(value, context, ASSERT_NO_EXCEPTION);
+    setValue(value, context, ASSERT_NO_EXCEPTION_STATE);
 }
 
 SVGLength::SVGLength(const SVGLength& other)
@@ -137,11 +138,11 @@
 {
 }
 
-void SVGLength::setValueAsString(const String& valueAsString, SVGLengthMode mode, ExceptionCode& ec)
+void SVGLength::setValueAsString(const String& valueAsString, SVGLengthMode mode, ExceptionState& es)
 {
     m_valueInSpecifiedUnits = 0;
     m_unit = storeUnit(mode, LengthTypeNumber);
-    setValueAsString(valueAsString, ec);
+    setValueAsString(valueAsString, es);
 }
 
 bool SVGLength::operator==(const SVGLength& other) const
@@ -157,12 +158,12 @@
 
 SVGLength SVGLength::construct(SVGLengthMode mode, const String& valueAsString, SVGParsingError& parseError, SVGLengthNegativeValuesMode negativeValuesMode)
 {
-    ExceptionCode ec = 0;
+    TrackExceptionState es;
     SVGLength length(mode);
 
-    length.setValueAsString(valueAsString, ec);
+    length.setValueAsString(valueAsString, es);
 
-    if (ec)
+    if (es.hadException())
         parseError = ParsingAttributeFailedError;
     else if (negativeValuesMode == ForbidNegativeLengths && length.valueInSpecifiedUnits() < 0)
         parseError = NegativeValueForbiddenError;
@@ -182,29 +183,29 @@
 
 float SVGLength::value(const SVGLengthContext& context) const
 {
-    return value(context, IGNORE_EXCEPTION);
+    return value(context, IGNORE_EXCEPTION_STATE);
 }
 
-float SVGLength::value(const SVGLengthContext& context, ExceptionCode& ec) const
+float SVGLength::value(const SVGLengthContext& context, ExceptionState& es) const
 {
-    return context.convertValueToUserUnits(m_valueInSpecifiedUnits, extractMode(m_unit), extractType(m_unit), ec);
+    return context.convertValueToUserUnits(m_valueInSpecifiedUnits, extractMode(m_unit), extractType(m_unit), es);
 }
 
-void SVGLength::setValue(const SVGLengthContext& context, float value, SVGLengthMode mode, SVGLengthType unitType, ExceptionCode& ec)
+void SVGLength::setValue(const SVGLengthContext& context, float value, SVGLengthMode mode, SVGLengthType unitType, ExceptionState& es)
 {
     m_unit = storeUnit(mode, unitType);
-    setValue(value, context, ec);
+    setValue(value, context, es);
 }
 
-void SVGLength::setValue(float value, const SVGLengthContext& context, ExceptionCode& ec)
+void SVGLength::setValue(float value, const SVGLengthContext& context, ExceptionState& es)
 {
     // 100% = 100.0 instead of 1.0 for historical reasons, this could eventually be changed
     if (extractType(m_unit) == LengthTypePercentage)
         value = value / 100;
 
-    ec = 0;
-    float convertedValue = context.convertValueFromUserUnits(value, extractMode(m_unit), extractType(m_unit), ec);
-    if (!ec)
+    es.clearException();
+    float convertedValue = context.convertValueFromUserUnits(value, extractMode(m_unit), extractType(m_unit), es);
+    if (!es.hadException())
         m_valueInSpecifiedUnits = convertedValue;
 }
 float SVGLength::valueAsPercentage() const
@@ -233,7 +234,7 @@
     return true;
 }
 
-void SVGLength::setValueAsString(const String& string, ExceptionCode& ec)
+void SVGLength::setValueAsString(const String& string, ExceptionState& es)
 {
     if (string.isEmpty())
         return;
@@ -246,7 +247,7 @@
         parseValueInternal<UChar>(string, convertedNumber, type);
 
     if (!success) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return;
     }
 
@@ -259,10 +260,10 @@
     return String::number(m_valueInSpecifiedUnits) + lengthTypeToString(extractType(m_unit));
 }
 
-void SVGLength::newValueSpecifiedUnits(unsigned short type, float value, ExceptionCode& ec)
+void SVGLength::newValueSpecifiedUnits(unsigned short type, float value, ExceptionState& es)
 {
     if (type == LengthTypeUnknown || type > LengthTypePC) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
 
@@ -270,21 +271,21 @@
     m_valueInSpecifiedUnits = value;
 }
 
-void SVGLength::convertToSpecifiedUnits(unsigned short type, const SVGLengthContext& context, ExceptionCode& ec)
+void SVGLength::convertToSpecifiedUnits(unsigned short type, const SVGLengthContext& context, ExceptionState& es)
 {
     if (type == LengthTypeUnknown || type > LengthTypePC) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
 
-    float valueInUserUnits = value(context, ec);
-    if (ec)
+    float valueInUserUnits = value(context, es);
+    if (es.hadException())
         return;
 
     unsigned int originalUnitAndType = m_unit;
     m_unit = storeUnit(extractMode(m_unit), static_cast<SVGLengthType>(type));
-    setValue(valueInUserUnits, context, ec);
-    if (!ec)
+    setValue(valueInUserUnits, context, es);
+    if (!es.hadException())
         return;
 
     // Eventually restore old unit and type
@@ -336,10 +337,10 @@
     if (svgType == LengthTypeUnknown)
         return SVGLength();
 
-    ExceptionCode ec = 0;
+    TrackExceptionState es;
     SVGLength length;
-    length.newValueSpecifiedUnits(svgType, value->getFloatValue(), ec);
-    if (ec)
+    length.newValueSpecifiedUnits(svgType, value->getFloatValue(), es);
+    if (es.hadException())
         return SVGLength();
 
     return length;
diff --git a/Source/core/svg/SVGLength.h b/Source/core/svg/SVGLength.h
index 413ab68..590610e 100644
--- a/Source/core/svg/SVGLength.h
+++ b/Source/core/svg/SVGLength.h
@@ -21,6 +21,7 @@
 #ifndef SVGLength_h
 #define SVGLength_h
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/platform/animation/AnimationUtilities.h"
 #include "core/svg/SVGLengthContext.h"
 #include "core/svg/SVGParsingError.h"
@@ -29,10 +30,9 @@
 namespace WebCore {
 
 class CSSPrimitiveValue;
+class ExceptionState;
 class QualifiedName;
 
-typedef int ExceptionCode;
-
 enum SVGLengthNegativeValuesMode {
     AllowNegativeLengths,
     ForbidNegativeLengths
@@ -69,9 +69,9 @@
     static SVGLength construct(SVGLengthMode, const String&, SVGParsingError&, SVGLengthNegativeValuesMode = AllowNegativeLengths);
 
     float value(const SVGLengthContext&) const;
-    float value(const SVGLengthContext&, ExceptionCode&) const;
-    void setValue(float, const SVGLengthContext&, ExceptionCode&);
-    void setValue(const SVGLengthContext&, float, SVGLengthMode, SVGLengthType, ExceptionCode&);
+    float value(const SVGLengthContext&, ExceptionState&) const;
+    void setValue(float, const SVGLengthContext&, ExceptionState&);
+    void setValue(const SVGLengthContext&, float, SVGLengthMode, SVGLengthType, ExceptionState&);
 
     float valueInSpecifiedUnits() const { return m_valueInSpecifiedUnits; }
     void setValueInSpecifiedUnits(float value) { m_valueInSpecifiedUnits = value; }
@@ -79,11 +79,11 @@
     float valueAsPercentage() const;
 
     String valueAsString() const;
-    void setValueAsString(const String&, ExceptionCode&);
-    void setValueAsString(const String&, SVGLengthMode, ExceptionCode&);
+    void setValueAsString(const String&, ExceptionState&);
+    void setValueAsString(const String&, SVGLengthMode, ExceptionState&);
 
-    void newValueSpecifiedUnits(unsigned short, float valueInSpecifiedUnits, ExceptionCode&);
-    void convertToSpecifiedUnits(unsigned short, const SVGLengthContext&, ExceptionCode&);
+    void newValueSpecifiedUnits(unsigned short, float valueInSpecifiedUnits, ExceptionState&);
+    void convertToSpecifiedUnits(unsigned short, const SVGLengthContext&, ExceptionState&);
 
     // Helper functions
     inline bool isRelative() const
@@ -114,13 +114,13 @@
             return *this;
 
         SVGLength length;
-        ExceptionCode ec = 0;
+        TrackExceptionState es;
 
         if (fromType == LengthTypePercentage || toType == LengthTypePercentage) {
             float fromPercent = from.valueAsPercentage() * 100;
             float toPercent = valueAsPercentage() * 100;
-            length.newValueSpecifiedUnits(LengthTypePercentage, WebCore::blend(fromPercent, toPercent, progress), ec);
-            if (ec)
+            length.newValueSpecifiedUnits(LengthTypePercentage, WebCore::blend(fromPercent, toPercent, progress), es);
+            if (es.hadException())
                 return SVGLength();
             return length;
         }
@@ -129,10 +129,10 @@
             float fromValue = from.valueInSpecifiedUnits();
             float toValue = valueInSpecifiedUnits();
             if (isZero())
-                length.newValueSpecifiedUnits(fromType, WebCore::blend(fromValue, toValue, progress), ec);
+                length.newValueSpecifiedUnits(fromType, WebCore::blend(fromValue, toValue, progress), es);
             else
-                length.newValueSpecifiedUnits(toType, WebCore::blend(fromValue, toValue, progress), ec);
-            if (ec)
+                length.newValueSpecifiedUnits(toType, WebCore::blend(fromValue, toValue, progress), es);
+            if (es.hadException())
                 return SVGLength();
             return length;
         }
@@ -141,18 +141,18 @@
         ASSERT(!from.isRelative());
 
         SVGLengthContext nonRelativeLengthContext(0);
-        float fromValueInUserUnits = nonRelativeLengthContext.convertValueToUserUnits(from.valueInSpecifiedUnits(), from.unitMode(), fromType, ec);
-        if (ec)
+        float fromValueInUserUnits = nonRelativeLengthContext.convertValueToUserUnits(from.valueInSpecifiedUnits(), from.unitMode(), fromType, es);
+        if (es.hadException())
             return SVGLength();
 
-        float fromValue = nonRelativeLengthContext.convertValueFromUserUnits(fromValueInUserUnits, unitMode(), toType, ec);
-        if (ec)
+        float fromValue = nonRelativeLengthContext.convertValueFromUserUnits(fromValueInUserUnits, unitMode(), toType, es);
+        if (es.hadException())
             return SVGLength();
 
         float toValue = valueInSpecifiedUnits();
-        length.newValueSpecifiedUnits(toType, WebCore::blend(fromValue, toValue, progress), ec);
+        length.newValueSpecifiedUnits(toType, WebCore::blend(fromValue, toValue, progress), es);
 
-        if (ec)
+        if (es.hadException())
             return SVGLength();
         return length;
     }
diff --git a/Source/core/svg/SVGLengthContext.cpp b/Source/core/svg/SVGLengthContext.cpp
index b6563cb..7f214a3 100644
--- a/Source/core/svg/SVGLengthContext.cpp
+++ b/Source/core/svg/SVGLengthContext.cpp
@@ -21,10 +21,10 @@
  */
 
 #include "config.h"
-
 #include "core/svg/SVGLengthContext.h"
 
 #include "SVGNames.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/css/CSSHelper.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/page/Frame.h"
@@ -87,30 +87,30 @@
     return x.valueAsPercentage();
 }
 
-float SVGLengthContext::convertValueToUserUnits(float value, SVGLengthMode mode, SVGLengthType fromUnit, ExceptionCode& ec) const
+float SVGLengthContext::convertValueToUserUnits(float value, SVGLengthMode mode, SVGLengthType fromUnit, ExceptionState& es) const
 {
     // If the SVGLengthContext carries a custom viewport, force resolving against it.
     if (!m_overridenViewport.isEmpty()) {
         // 100% = 100.0 instead of 1.0 for historical reasons, this could eventually be changed
         if (fromUnit == LengthTypePercentage)
             value /= 100;
-        return convertValueFromPercentageToUserUnits(value, mode, ec);
+        return convertValueFromPercentageToUserUnits(value, mode, es);
     }
 
     switch (fromUnit) {
     case LengthTypeUnknown:
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     case LengthTypeNumber:
         return value;
     case LengthTypePX:
         return value;
     case LengthTypePercentage:
-        return convertValueFromPercentageToUserUnits(value / 100, mode, ec);
+        return convertValueFromPercentageToUserUnits(value / 100, mode, es);
     case LengthTypeEMS:
-        return convertValueFromEMSToUserUnits(value, ec);
+        return convertValueFromEMSToUserUnits(value, es);
     case LengthTypeEXS:
-        return convertValueFromEXSToUserUnits(value, ec);
+        return convertValueFromEXSToUserUnits(value, es);
     case LengthTypeCM:
         return value * cssPixelsPerInch / 2.54f;
     case LengthTypeMM:
@@ -127,20 +127,20 @@
     return 0;
 }
 
-float SVGLengthContext::convertValueFromUserUnits(float value, SVGLengthMode mode, SVGLengthType toUnit, ExceptionCode& ec) const
+float SVGLengthContext::convertValueFromUserUnits(float value, SVGLengthMode mode, SVGLengthType toUnit, ExceptionState& es) const
 {
     switch (toUnit) {
     case LengthTypeUnknown:
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     case LengthTypeNumber:
         return value;
     case LengthTypePercentage:
-        return convertValueFromUserUnitsToPercentage(value * 100, mode, ec);
+        return convertValueFromUserUnitsToPercentage(value * 100, mode, es);
     case LengthTypeEMS:
-        return convertValueFromUserUnitsToEMS(value, ec);
+        return convertValueFromUserUnitsToEMS(value, es);
     case LengthTypeEXS:
-        return convertValueFromUserUnitsToEXS(value, ec);
+        return convertValueFromUserUnitsToEXS(value, es);
     case LengthTypePX:
         return value;
     case LengthTypeCM:
@@ -159,12 +159,12 @@
     return 0;
 }
 
-float SVGLengthContext::convertValueFromUserUnitsToPercentage(float value, SVGLengthMode mode, ExceptionCode& ec) const
+float SVGLengthContext::convertValueFromUserUnitsToPercentage(float value, SVGLengthMode mode, ExceptionState& es) const
 {
     float width = 0;
     float height = 0;
     if (!determineViewport(width, height)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
@@ -181,12 +181,12 @@
     return 0;
 }
 
-float SVGLengthContext::convertValueFromPercentageToUserUnits(float value, SVGLengthMode mode, ExceptionCode& ec) const
+float SVGLengthContext::convertValueFromPercentageToUserUnits(float value, SVGLengthMode mode, ExceptionState& es) const
 {
     float width = 0;
     float height = 0;
     if (!determineViewport(width, height)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
@@ -220,39 +220,39 @@
     return 0;
 }
 
-float SVGLengthContext::convertValueFromUserUnitsToEMS(float value, ExceptionCode& ec) const
+float SVGLengthContext::convertValueFromUserUnitsToEMS(float value, ExceptionState& es) const
 {
     RenderStyle* style = renderStyleForLengthResolving(m_context);
     if (!style) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
     float fontSize = style->specifiedFontSize();
     if (!fontSize) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
     return value / fontSize;
 }
 
-float SVGLengthContext::convertValueFromEMSToUserUnits(float value, ExceptionCode& ec) const
+float SVGLengthContext::convertValueFromEMSToUserUnits(float value, ExceptionState& es) const
 {
     RenderStyle* style = renderStyleForLengthResolving(m_context);
     if (!style) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
     return value * style->specifiedFontSize();
 }
 
-float SVGLengthContext::convertValueFromUserUnitsToEXS(float value, ExceptionCode& ec) const
+float SVGLengthContext::convertValueFromUserUnitsToEXS(float value, ExceptionState& es) const
 {
     RenderStyle* style = renderStyleForLengthResolving(m_context);
     if (!style) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
@@ -260,18 +260,18 @@
     // if this causes problems in real world cases maybe it would be best to remove this
     float xHeight = ceilf(style->fontMetrics().xHeight());
     if (!xHeight) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
     return value / xHeight;
 }
 
-float SVGLengthContext::convertValueFromEXSToUserUnits(float value, ExceptionCode& ec) const
+float SVGLengthContext::convertValueFromEXSToUserUnits(float value, ExceptionState& es) const
 {
     RenderStyle* style = renderStyleForLengthResolving(m_context);
     if (!style) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
diff --git a/Source/core/svg/SVGLengthContext.h b/Source/core/svg/SVGLengthContext.h
index 2de1c2c..c2fea4e 100644
--- a/Source/core/svg/SVGLengthContext.h
+++ b/Source/core/svg/SVGLengthContext.h
@@ -25,11 +25,10 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class SVGElement;
 class SVGLength;
 
-typedef int ExceptionCode;
-
 enum SVGLengthType {
     LengthTypeUnknown = 0,
     LengthTypeNumber,
@@ -64,22 +63,22 @@
     static FloatPoint resolvePoint(const SVGElement*, SVGUnitTypes::SVGUnitType, const SVGLength& x, const SVGLength& y);
     static float resolveLength(const SVGElement*, SVGUnitTypes::SVGUnitType, const SVGLength&);
 
-    float convertValueToUserUnits(float, SVGLengthMode, SVGLengthType fromUnit, ExceptionCode&) const;
-    float convertValueFromUserUnits(float, SVGLengthMode, SVGLengthType toUnit, ExceptionCode&) const;
+    float convertValueToUserUnits(float, SVGLengthMode, SVGLengthType fromUnit, ExceptionState&) const;
+    float convertValueFromUserUnits(float, SVGLengthMode, SVGLengthType toUnit, ExceptionState&) const;
 
     bool determineViewport(float& width, float& height) const;
 
 private:
     SVGLengthContext(const SVGElement*, const FloatRect& viewport);
 
-    float convertValueFromUserUnitsToPercentage(float value, SVGLengthMode, ExceptionCode&) const;
-    float convertValueFromPercentageToUserUnits(float value, SVGLengthMode, ExceptionCode&) const;
+    float convertValueFromUserUnitsToPercentage(float value, SVGLengthMode, ExceptionState&) const;
+    float convertValueFromPercentageToUserUnits(float value, SVGLengthMode, ExceptionState&) const;
 
-    float convertValueFromUserUnitsToEMS(float value, ExceptionCode&) const;
-    float convertValueFromEMSToUserUnits(float value, ExceptionCode&) const;
+    float convertValueFromUserUnitsToEMS(float value, ExceptionState&) const;
+    float convertValueFromEMSToUserUnits(float value, ExceptionState&) const;
 
-    float convertValueFromUserUnitsToEXS(float value, ExceptionCode&) const;
-    float convertValueFromEXSToUserUnits(float value, ExceptionCode&) const;
+    float convertValueFromUserUnitsToEXS(float value, ExceptionState&) const;
+    float convertValueFromEXSToUserUnits(float value, ExceptionState&) const;
 
     const SVGElement* m_context;
     FloatRect m_overridenViewport;
diff --git a/Source/core/svg/SVGLengthList.cpp b/Source/core/svg/SVGLengthList.cpp
index f3bd2e1..deb8bf0 100644
--- a/Source/core/svg/SVGLengthList.cpp
+++ b/Source/core/svg/SVGLengthList.cpp
@@ -21,6 +21,8 @@
 #include "config.h"
 #include "core/svg/SVGLengthList.h"
 
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/svg/SVGParserUtilities.h"
 #include "wtf/text/StringBuilder.h"
 
@@ -29,7 +31,7 @@
 template<typename CharType>
 void SVGLengthList::parseInternal(const CharType*& ptr, const CharType* end, SVGLengthMode mode)
 {
-    ExceptionCode ec = 0;
+    TrackExceptionState es;
 
     while (ptr < end) {
         const CharType* start = ptr;
@@ -42,8 +44,8 @@
         String valueString(start, ptr - start);
         if (valueString.isEmpty())
             return;
-        length.setValueAsString(valueString, ec);
-        if (ec)
+        length.setValueAsString(valueString, es);
+        if (es.hadException())
             return;
         append(length);
         skipOptionalSVGSpacesOrDelimiter(ptr, end);
diff --git a/Source/core/svg/SVGLocatable.cpp b/Source/core/svg/SVGLocatable.cpp
index d462fa2..e8ce64a 100644
--- a/Source/core/svg/SVGLocatable.cpp
+++ b/Source/core/svg/SVGLocatable.cpp
@@ -21,10 +21,10 @@
  */
 
 #include "config.h"
-
 #include "core/svg/SVGLocatable.h"
 
 #include "SVGNames.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/rendering/RenderObject.h"
 #include "core/svg/SVGGraphicsElement.h"
@@ -97,14 +97,14 @@
     return ctm;
 }
 
-AffineTransform SVGLocatable::getTransformToElement(SVGElement* target, ExceptionCode& ec, StyleUpdateStrategy styleUpdateStrategy)
+AffineTransform SVGLocatable::getTransformToElement(SVGElement* target, ExceptionState& es, StyleUpdateStrategy styleUpdateStrategy)
 {
     AffineTransform ctm = getCTM(styleUpdateStrategy);
 
     if (target && target->isSVGGraphicsElement()) {
         AffineTransform targetCTM = toSVGGraphicsElement(target)->getCTM(styleUpdateStrategy);
         if (!targetCTM.isInvertible()) {
-            ec = InvalidStateError;
+            es.throwDOMException(InvalidStateError);
             return ctm;
         }
         ctm = targetCTM.inverse() * ctm;
diff --git a/Source/core/svg/SVGLocatable.h b/Source/core/svg/SVGLocatable.h
index b397aaf..6ab6aad 100644
--- a/Source/core/svg/SVGLocatable.h
+++ b/Source/core/svg/SVGLocatable.h
@@ -27,10 +27,9 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class SVGElement;
 
-typedef int ExceptionCode;
-
 class SVGLocatable {
 public:
     virtual ~SVGLocatable() { }
@@ -44,7 +43,7 @@
     virtual SVGRect getBBox(StyleUpdateStrategy) = 0;
     virtual AffineTransform getCTM(StyleUpdateStrategy) = 0;
     virtual AffineTransform getScreenCTM(StyleUpdateStrategy) = 0;
-    AffineTransform getTransformToElement(SVGElement*, ExceptionCode&, StyleUpdateStrategy = AllowStyleUpdate);
+    AffineTransform getTransformToElement(SVGElement*, ExceptionState&, StyleUpdateStrategy = AllowStyleUpdate);
 
     static SVGElement* nearestViewportElement(const SVGElement*);
     static SVGElement* farthestViewportElement(const SVGElement*);
diff --git a/Source/core/svg/SVGMarkerElement.h b/Source/core/svg/SVGMarkerElement.h
index b389755..5117bb6 100644
--- a/Source/core/svg/SVGMarkerElement.h
+++ b/Source/core/svg/SVGMarkerElement.h
@@ -21,6 +21,7 @@
 #ifndef SVGMarkerElement_h
 #define SVGMarkerElement_h
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/svg/SVGAnimatedAngle.h"
 #include "core/svg/SVGAnimatedBoolean.h"
 #include "core/svg/SVGAnimatedEnumeration.h"
@@ -85,9 +86,9 @@
         if (value == "auto")
             return SVGMarkerOrientAuto;
 
-        ExceptionCode ec = 0;
-        angle.setValueAsString(value, ec);
-        if (!ec)
+        TrackExceptionState es;
+        angle.setValueAsString(value, es);
+        if (!es.hadException())
             return SVGMarkerOrientAngle;
         return SVGMarkerOrientUnknown;
     }
diff --git a/Source/core/svg/SVGMatrix.h b/Source/core/svg/SVGMatrix.h
index 5b5a541..7451d32 100644
--- a/Source/core/svg/SVGMatrix.h
+++ b/Source/core/svg/SVGMatrix.h
@@ -20,13 +20,12 @@
 #ifndef SVGMatrix_h
 #define SVGMatrix_h
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/platform/graphics/transforms/AffineTransform.h"
 
 namespace WebCore {
 
-typedef int ExceptionCode;
-
 // Only used in the bindings.
 class SVGMatrix : public AffineTransform {
 public:
@@ -104,23 +103,23 @@
         return static_cast<SVGMatrix>(copy);
     }
 
-    SVGMatrix inverse(ExceptionCode& ec) const
+    SVGMatrix inverse(ExceptionState& es) const
     {
         AffineTransform transform = AffineTransform::inverse();
         if (!isInvertible()) {
             // FIXME: This used to have a more specific error message:
             // "An attempt was made to invert a matrix that is not invertible."
             // When switching to SVG2 style exceptions we lost this information.
-            ec = InvalidStateError;
+            es.throwDOMException(InvalidStateError);
         }
 
         return transform;
     }
 
-    SVGMatrix rotateFromVector(double x, double y, ExceptionCode& ec)
+    SVGMatrix rotateFromVector(double x, double y, ExceptionState& es)
     {
         if (!x || !y)
-            ec = InvalidAccessError;
+            es.throwDOMException(InvalidAccessError);
 
         AffineTransform copy = *this;
         copy.rotateFromVector(x, y);
diff --git a/Source/core/svg/SVGPaint.cpp b/Source/core/svg/SVGPaint.cpp
index cb25e99..fd976af 100644
--- a/Source/core/svg/SVGPaint.cpp
+++ b/Source/core/svg/SVGPaint.cpp
@@ -20,9 +20,9 @@
  */
 
 #include "config.h"
-
 #include "core/svg/SVGPaint.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
@@ -63,9 +63,9 @@
     // The setters are the most problematic part so we remove the support for those first.
 }
 
-void SVGPaint::setPaint(unsigned short, const String&, const String&, const String&, ExceptionCode& ec)
+void SVGPaint::setPaint(unsigned short, const String&, const String&, const String&, ExceptionState& es)
 {
-    ec = NoModificationAllowedError;
+    es.throwDOMException(NoModificationAllowedError);
 }
 
 String SVGPaint::customCssText() const
diff --git a/Source/core/svg/SVGPaint.h b/Source/core/svg/SVGPaint.h
index e43eb01..f4f387d 100644
--- a/Source/core/svg/SVGPaint.h
+++ b/Source/core/svg/SVGPaint.h
@@ -28,6 +28,8 @@
 
 namespace WebCore {
 
+class ExceptionState;
+
 class SVGPaint : public SVGColor {
 public:
     enum SVGPaintType {
@@ -88,7 +90,7 @@
     String uri() const { return m_uri; }
 
     void setUri(const String&);
-    void setPaint(unsigned short paintType, const String& uri, const String& rgbColor, const String& iccColor, ExceptionCode&);
+    void setPaint(unsigned short paintType, const String& uri, const String& rgbColor, const String& iccColor, ExceptionState&);
 
     String customCssText() const;
 
diff --git a/Source/core/svg/SVGPreserveAspectRatio.cpp b/Source/core/svg/SVGPreserveAspectRatio.cpp
index 546c83b..5e425e3 100644
--- a/Source/core/svg/SVGPreserveAspectRatio.cpp
+++ b/Source/core/svg/SVGPreserveAspectRatio.cpp
@@ -22,6 +22,7 @@
 #include "config.h"
 #include "core/svg/SVGPreserveAspectRatio.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/transforms/AffineTransform.h"
@@ -36,20 +37,20 @@
 {
 }
 
-void SVGPreserveAspectRatio::setAlign(unsigned short align, ExceptionCode& ec)
+void SVGPreserveAspectRatio::setAlign(unsigned short align, ExceptionState& es)
 {
     if (align == SVG_PRESERVEASPECTRATIO_UNKNOWN || align > SVG_PRESERVEASPECTRATIO_XMAXYMAX) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
 
     m_align = static_cast<SVGPreserveAspectRatioType>(align);
 }
 
-void SVGPreserveAspectRatio::setMeetOrSlice(unsigned short meetOrSlice, ExceptionCode& ec)
+void SVGPreserveAspectRatio::setMeetOrSlice(unsigned short meetOrSlice, ExceptionState& es)
 {
     if (meetOrSlice == SVG_MEETORSLICE_UNKNOWN || meetOrSlice > SVG_MEETORSLICE_SLICE) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return;
     }
 
diff --git a/Source/core/svg/SVGPreserveAspectRatio.h b/Source/core/svg/SVGPreserveAspectRatio.h
index e8a6cd4..aae01cd 100644
--- a/Source/core/svg/SVGPreserveAspectRatio.h
+++ b/Source/core/svg/SVGPreserveAspectRatio.h
@@ -26,10 +26,9 @@
 namespace WebCore {
 
 class AffineTransform;
+class ExceptionState;
 class FloatRect;
 
-typedef int ExceptionCode;
-
 class SVGPreserveAspectRatio {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -55,10 +54,10 @@
 
     SVGPreserveAspectRatio();
 
-    void setAlign(unsigned short align, ExceptionCode&);
+    void setAlign(unsigned short align, ExceptionState&);
     unsigned short align() const { return m_align; }
 
-    void setMeetOrSlice(unsigned short, ExceptionCode&);
+    void setMeetOrSlice(unsigned short, ExceptionState&);
     unsigned short meetOrSlice() const { return m_meetOrSlice; }
 
     void transformRect(FloatRect& destRect, FloatRect& srcRect);
diff --git a/Source/core/svg/SVGTRefElement.cpp b/Source/core/svg/SVGTRefElement.cpp
index 8dfa40f..8140f57 100644
--- a/Source/core/svg/SVGTRefElement.cpp
+++ b/Source/core/svg/SVGTRefElement.cpp
@@ -20,14 +20,13 @@
  */
 
 #include "config.h"
-
 #include "core/svg/SVGTRefElement.h"
 
 #include "SVGNames.h"
 #include "XLinkNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/EventListener.h"
 #include "core/dom/EventNames.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/MutationEvent.h"
 #include "core/dom/NodeRenderingContext.h"
 #include "core/dom/Text.h"
@@ -151,7 +150,7 @@
 void SVGTRefElement::updateReferencedText(Element* target)
 {
     if (target)
-        replaceChildrenWithText(userAgentShadowRoot(), target->textContent(), ASSERT_NO_EXCEPTION);
+        replaceChildrenWithText(userAgentShadowRoot(), target->textContent(), ASSERT_NO_EXCEPTION_STATE);
     else
         userAgentShadowRoot()->removeChildren();
 }
diff --git a/Source/core/svg/SVGTextContentElement.cpp b/Source/core/svg/SVGTextContentElement.cpp
index 1886df5..025655b 100644
--- a/Source/core/svg/SVGTextContentElement.cpp
+++ b/Source/core/svg/SVGTextContentElement.cpp
@@ -19,13 +19,14 @@
  */
 
 #include "config.h"
-
 #include "core/svg/SVGTextContentElement.h"
 
 #include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
 #include "SVGNames.h"
 #include "XMLNames.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/editing/FrameSelection.h"
 #include "core/page/Frame.h"
 #include "core/rendering/RenderObject.h"
@@ -93,7 +94,7 @@
 {
     DEFINE_STATIC_LOCAL(SVGLength, defaultTextLength, (LengthModeOther));
     if (m_specifiedTextLength == defaultTextLength)
-        m_textLength.value.newValueSpecifiedUnits(LengthTypeNumber, getComputedTextLength(), ASSERT_NO_EXCEPTION);
+        m_textLength.value.newValueSpecifiedUnits(LengthTypeNumber, getComputedTextLength(), ASSERT_NO_EXCEPTION_STATE);
 
     m_textLength.shouldSynchronize = true;
     return static_pointer_cast<SVGAnimatedLength>(lookupOrCreateTextLengthWrapper(this));
@@ -112,61 +113,61 @@
     return SVGTextQuery(renderer()).textLength();
 }
 
-float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchars, ExceptionCode& ec)
+float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchars, ExceptionState& es)
 {
     document()->updateLayoutIgnorePendingStylesheets();
 
     unsigned numberOfChars = getNumberOfChars();
     if (charnum >= numberOfChars) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return 0.0f;
     }
 
     return SVGTextQuery(renderer()).subStringLength(charnum, nchars);
 }
 
-SVGPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, ExceptionCode& ec)
+SVGPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, ExceptionState& es)
 {
     document()->updateLayoutIgnorePendingStylesheets();
 
     if (charnum > getNumberOfChars()) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return FloatPoint();
     }
 
     return SVGTextQuery(renderer()).startPositionOfCharacter(charnum);
 }
 
-SVGPoint SVGTextContentElement::getEndPositionOfChar(unsigned charnum, ExceptionCode& ec)
+SVGPoint SVGTextContentElement::getEndPositionOfChar(unsigned charnum, ExceptionState& es)
 {
     document()->updateLayoutIgnorePendingStylesheets();
 
     if (charnum > getNumberOfChars()) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return FloatPoint();
     }
 
     return SVGTextQuery(renderer()).endPositionOfCharacter(charnum);
 }
 
-SVGRect SVGTextContentElement::getExtentOfChar(unsigned charnum, ExceptionCode& ec)
+SVGRect SVGTextContentElement::getExtentOfChar(unsigned charnum, ExceptionState& es)
 {
     document()->updateLayoutIgnorePendingStylesheets();
 
     if (charnum > getNumberOfChars()) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return SVGRect();
     }
 
     return SVGTextQuery(renderer()).extentOfCharacter(charnum);
 }
 
-float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionCode& ec)
+float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionState& es)
 {
     document()->updateLayoutIgnorePendingStylesheets();
 
     if (charnum > getNumberOfChars()) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return 0.0f;
     }
 
@@ -179,11 +180,11 @@
     return SVGTextQuery(renderer()).characterNumberAtPosition(point);
 }
 
-void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, ExceptionCode& ec)
+void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, ExceptionState& es)
 {
     unsigned numberOfChars = getNumberOfChars();
     if (charnum >= numberOfChars) {
-        ec = IndexSizeError;
+        es.throwDOMException(IndexSizeError);
         return;
     }
 
diff --git a/Source/core/svg/SVGTextContentElement.h b/Source/core/svg/SVGTextContentElement.h
index 8004c68..3cccd0e 100644
--- a/Source/core/svg/SVGTextContentElement.h
+++ b/Source/core/svg/SVGTextContentElement.h
@@ -29,6 +29,8 @@
 
 namespace WebCore {
 
+class ExceptionState;
+
 enum SVGLengthAdjustType {
     SVGLengthAdjustUnknown,
     SVGLengthAdjustSpacing,
@@ -76,13 +78,13 @@
 
     unsigned getNumberOfChars();
     float getComputedTextLength();
-    float getSubStringLength(unsigned charnum, unsigned nchars, ExceptionCode&);
-    SVGPoint getStartPositionOfChar(unsigned charnum, ExceptionCode&);
-    SVGPoint getEndPositionOfChar(unsigned charnum, ExceptionCode&);
-    SVGRect getExtentOfChar(unsigned charnum, ExceptionCode&);
-    float getRotationOfChar(unsigned charnum, ExceptionCode&);
+    float getSubStringLength(unsigned charnum, unsigned nchars, ExceptionState&);
+    SVGPoint getStartPositionOfChar(unsigned charnum, ExceptionState&);
+    SVGPoint getEndPositionOfChar(unsigned charnum, ExceptionState&);
+    SVGRect getExtentOfChar(unsigned charnum, ExceptionState&);
+    float getRotationOfChar(unsigned charnum, ExceptionState&);
     int getCharNumAtPosition(const SVGPoint&);
-    void selectSubString(unsigned charnum, unsigned nchars, ExceptionCode&);
+    void selectSubString(unsigned charnum, unsigned nchars, ExceptionState&);
 
     static SVGTextContentElement* elementFromRenderer(RenderObject*);
 
diff --git a/Source/core/svg/SVGUseElement.cpp b/Source/core/svg/SVGUseElement.cpp
index 6a1ec89..db9dae3 100644
--- a/Source/core/svg/SVGUseElement.cpp
+++ b/Source/core/svg/SVGUseElement.cpp
@@ -28,6 +28,7 @@
 
 #include "SVGNames.h"
 #include "XLinkNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Document.h"
 #include "core/dom/Event.h"
 #include "core/dom/NodeTraversal.h"
@@ -514,7 +515,7 @@
     // Eventually dump shadow tree
 #ifdef DUMP_SHADOW_TREE
     RefPtr<XMLSerializer> serializer = XMLSerializer::create();
-    String markup = serializer->serializeToString(shadowTreeRootElement, ASSERT_NO_EXCEPTION);
+    String markup = serializer->serializeToString(shadowTreeRootElement, ASSERT_NO_EXCEPTION_STATE);
     fprintf(stderr, "Dumping <use> shadow tree markup:\n%s\n", markup.latin1().data());
 #endif
 }
diff --git a/Source/core/svg/SVGViewSpec.cpp b/Source/core/svg/SVGViewSpec.cpp
index 17da037..69fc7d3 100644
--- a/Source/core/svg/SVGViewSpec.cpp
+++ b/Source/core/svg/SVGViewSpec.cpp
@@ -18,10 +18,10 @@
  */
 
 #include "config.h"
-
 #include "core/svg/SVGViewSpec.h"
 
 #include "SVGNames.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/Document.h"
 #include "core/svg/SVGAnimatedTransformList.h"
 #include "core/svg/SVGFitToViewBox.h"
@@ -103,10 +103,10 @@
     return s_identifier;
 }
 
-void SVGViewSpec::setZoomAndPan(unsigned short, ExceptionCode& ec)
+void SVGViewSpec::setZoomAndPan(unsigned short, ExceptionState& es)
 {
     // SVGViewSpec and all of its content is read-only.
-    ec = NoModificationAllowedError;
+    es.throwDOMException(NoModificationAllowedError);
 }
 
 void SVGViewSpec::setTransformString(const String& transform)
diff --git a/Source/core/svg/SVGViewSpec.h b/Source/core/svg/SVGViewSpec.h
index 17308ee..fd90616 100644
--- a/Source/core/svg/SVGViewSpec.h
+++ b/Source/core/svg/SVGViewSpec.h
@@ -29,6 +29,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class SVGElement;
 class SVGTransformListPropertyTearOff;
 
@@ -60,7 +61,7 @@
 
     SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; }
     void setZoomAndPan(unsigned short zoomAndPan) { setZoomAndPanBaseValue(zoomAndPan); }
-    void setZoomAndPan(unsigned short, ExceptionCode&);
+    void setZoomAndPan(unsigned short, ExceptionState&);
     void setZoomAndPanBaseValue(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan::parseFromNumber(zoomAndPan); }
 
     SVGElement* contextElement() const { return m_contextElement; }
diff --git a/Source/core/svg/animation/SVGSMILElement.cpp b/Source/core/svg/animation/SVGSMILElement.cpp
index 3074000..b5d1341 100644
--- a/Source/core/svg/animation/SVGSMILElement.cpp
+++ b/Source/core/svg/animation/SVGSMILElement.cpp
@@ -24,11 +24,11 @@
  */
 
 #include "config.h"
-
 #include "core/svg/animation/SVGSMILElement.h"
 
 #include "SVGNames.h"
 #include "XLinkNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Document.h"
 #include "core/dom/EventListener.h"
 #include "core/platform/FloatConversion.h"
@@ -195,7 +195,7 @@
 
     String prefix;
     String localName;
-    if (!Document::parseQualifiedName(attributeName, prefix, localName, ASSERT_NO_EXCEPTION))
+    if (!Document::parseQualifiedName(attributeName, prefix, localName, ASSERT_NO_EXCEPTION_STATE))
         return anyQName();
 
     String namespaceURI = svgElement->lookupNamespaceURI(prefix);
diff --git a/Source/core/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h b/Source/core/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h
index 271b88b..cd6014b 100644
--- a/Source/core/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h
+++ b/Source/core/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h
@@ -20,7 +20,7 @@
 #ifndef SVGAnimatedEnumerationPropertyTearOff_h
 #define SVGAnimatedEnumerationPropertyTearOff_h
 
-#include "core/dom/ExceptionCode.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/svg/properties/SVGAnimatedStaticPropertyTearOff.h"
 #include "core/svg/properties/SVGPropertyTraits.h"
 
@@ -29,14 +29,14 @@
 template<typename EnumType>
 class SVGAnimatedEnumerationPropertyTearOff : public SVGAnimatedStaticPropertyTearOff<unsigned> {
 public:
-    virtual void setBaseVal(const unsigned& property, ExceptionCode& ec)
+    virtual void setBaseVal(const unsigned& property, ExceptionState& es)
     {
         // All SVG enumeration values, that are allowed to be set via SVG DOM start with 1, 0 corresponds to unknown and is not settable through SVG DOM.
         if (!property || property > SVGPropertyTraits<EnumType>::highestEnumValue()) {
-            ec = TypeError;
+            es.throwTypeError();
             return;
         }
-        SVGAnimatedStaticPropertyTearOff<unsigned>::setBaseVal(property, ec);
+        SVGAnimatedStaticPropertyTearOff<unsigned>::setBaseVal(property, es);
     }
 
     static PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<EnumType> > create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, EnumType& property)
diff --git a/Source/core/svg/properties/SVGAnimatedStaticPropertyTearOff.h b/Source/core/svg/properties/SVGAnimatedStaticPropertyTearOff.h
index 52fc03b..fb3e610 100644
--- a/Source/core/svg/properties/SVGAnimatedStaticPropertyTearOff.h
+++ b/Source/core/svg/properties/SVGAnimatedStaticPropertyTearOff.h
@@ -24,6 +24,8 @@
 
 namespace WebCore {
 
+class ExceptionState;
+
 template<typename PropertyType>
 class SVGAnimatedStaticPropertyTearOff : public SVGAnimatedProperty {
 public:
@@ -41,7 +43,7 @@
         return m_property;
     }
 
-    virtual void setBaseVal(const PropertyType& property, ExceptionCode&)
+    virtual void setBaseVal(const PropertyType& property, ExceptionState&)
     {
         m_property = property;
         commitChange();
diff --git a/Source/core/svg/properties/SVGListProperty.h b/Source/core/svg/properties/SVGListProperty.h
index de9c656..bdc702a 100644
--- a/Source/core/svg/properties/SVGListProperty.h
+++ b/Source/core/svg/properties/SVGListProperty.h
@@ -20,6 +20,7 @@
 #ifndef SVGListProperty_h
 #define SVGListProperty_h
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/svg/properties/SVGPropertyTearOff.h"
 #include "core/svg/properties/SVGPropertyTraits.h"
@@ -48,10 +49,10 @@
     typedef SVGAnimatedListPropertyTearOff<PropertyType> AnimatedListPropertyTearOff;
     typedef typename SVGAnimatedListPropertyTearOff<PropertyType>::ListWrapperCache ListWrapperCache;
 
-    bool canAlterList(ExceptionCode& ec) const
+    bool canAlterList(ExceptionState& es) const
     {
         if (m_role == AnimValRole) {
-            ec = NoModificationAllowedError;
+            es.throwDOMException(NoModificationAllowedError);
             return false;
         }
 
@@ -96,18 +97,18 @@
     }
 
     // SVGList::clear()
-    void clearValues(ExceptionCode& ec)
+    void clearValues(ExceptionState& es)
     {
-        if (!canAlterList(ec))
+        if (!canAlterList(es))
             return;
 
         m_values->clear();
         commitChange();
     }
 
-    void clearValuesAndWrappers(ExceptionCode& ec)
+    void clearValuesAndWrappers(ExceptionState& es)
     {
-        if (!canAlterList(ec))
+        if (!canAlterList(es))
             return;
 
         detachListWrappers(0);
@@ -122,9 +123,9 @@
     }
 
     // SVGList::initialize()
-    ListItemType initializeValues(const ListItemType& newItem, ExceptionCode& ec)
+    ListItemType initializeValues(const ListItemType& newItem, ExceptionState& es)
     {
-        if (!canAlterList(ec))
+        if (!canAlterList(es))
             return ListItemType();
 
         // Spec: If the inserted item is already in a list, it is removed from its previous list before it is inserted into this list.
@@ -138,15 +139,15 @@
         return newItem;
     }
 
-    PassListItemTearOff initializeValuesAndWrappers(PassListItemTearOff passNewItem, ExceptionCode& ec)
+    PassListItemTearOff initializeValuesAndWrappers(PassListItemTearOff passNewItem, ExceptionState& es)
     {
         ASSERT(m_wrappers);
-        if (!canAlterList(ec))
+        if (!canAlterList(es))
             return 0;
 
         // Not specified, but FF/Opera do it this way, and it's just sane.
         if (!passNewItem) {
-            ec = TypeError;
+            es.throwDOMException(TypeError);
             return 0;
         }
 
@@ -168,29 +169,29 @@
     }
 
     // SVGList::getItem()
-    bool canGetItem(unsigned index, ExceptionCode& ec)
+    bool canGetItem(unsigned index, ExceptionState& es)
     {
         if (index >= m_values->size()) {
-            ec = IndexSizeError;
+            es.throwDOMException(IndexSizeError);
             return false;
         }
 
         return true;
     }
 
-    ListItemType getItemValues(unsigned index, ExceptionCode& ec)
+    ListItemType getItemValues(unsigned index, ExceptionState& es)
     {
-        if (!canGetItem(index, ec))
+        if (!canGetItem(index, es))
             return ListItemType();
 
         // Spec: Returns the specified item from the list. The returned item is the item itself and not a copy.
         return m_values->at(index);
     }
 
-    PassListItemTearOff getItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, unsigned index, ExceptionCode& ec)
+    PassListItemTearOff getItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, unsigned index, ExceptionState& es)
     {
         ASSERT(m_wrappers);
-        if (!canGetItem(index, ec))
+        if (!canGetItem(index, es))
             return 0;
 
         // Spec: Returns the specified item from the list. The returned item is the item itself and not a copy.
@@ -209,9 +210,9 @@
     }
 
     // SVGList::insertItemBefore()
-    ListItemType insertItemBeforeValues(const ListItemType& newItem, unsigned index, ExceptionCode& ec)
+    ListItemType insertItemBeforeValues(const ListItemType& newItem, unsigned index, ExceptionState& es)
     {
-        if (!canAlterList(ec))
+        if (!canAlterList(es))
             return ListItemType();
 
         // Spec: If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
@@ -232,15 +233,15 @@
         return newItem;
     }
 
-    PassListItemTearOff insertItemBeforeValuesAndWrappers(PassListItemTearOff passNewItem, unsigned index, ExceptionCode& ec)
+    PassListItemTearOff insertItemBeforeValuesAndWrappers(PassListItemTearOff passNewItem, unsigned index, ExceptionState& es)
     {
         ASSERT(m_wrappers);
-        if (!canAlterList(ec))
+        if (!canAlterList(es))
             return 0;
 
         // Not specified, but FF/Opera do it this way, and it's just sane.
         if (!passNewItem) {
-            ec = TypeError;
+            es.throwDOMException(TypeError);
             return 0;
         }
 
@@ -267,22 +268,22 @@
     }
 
     // SVGList::replaceItem()
-    bool canReplaceItem(unsigned index, ExceptionCode& ec)
+    bool canReplaceItem(unsigned index, ExceptionState& es)
     {
-        if (!canAlterList(ec))
+        if (!canAlterList(es))
             return false;
 
         if (index >= m_values->size()) {
-            ec = IndexSizeError;
+            es.throwDOMException(IndexSizeError);
             return false;
         }
 
         return true;
     }
 
-    ListItemType replaceItemValues(const ListItemType& newItem, unsigned index, ExceptionCode& ec)
+    ListItemType replaceItemValues(const ListItemType& newItem, unsigned index, ExceptionState& es)
     {
-        if (!canReplaceItem(index, ec))
+        if (!canReplaceItem(index, es))
             return ListItemType();
 
         // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
@@ -294,7 +295,7 @@
 
         if (m_values->isEmpty()) {
             // 'newItem' already lived in our list, we removed it, and now we're empty, which means there's nothing to replace.
-            ec = IndexSizeError;
+            es.throwDOMException(IndexSizeError);
             return ListItemType();
         }
 
@@ -305,15 +306,15 @@
         return newItem;
     }
 
-    PassListItemTearOff replaceItemValuesAndWrappers(PassListItemTearOff passNewItem, unsigned index, ExceptionCode& ec)
+    PassListItemTearOff replaceItemValuesAndWrappers(PassListItemTearOff passNewItem, unsigned index, ExceptionState& es)
     {
         ASSERT(m_wrappers);
-        if (!canReplaceItem(index, ec))
+        if (!canReplaceItem(index, es))
             return 0;
 
         // Not specified, but FF/Opera do it this way, and it's just sane.
         if (!passNewItem) {
-            ec = TypeError;
+            es.throwDOMException(TypeError);
             return 0;
         }
 
@@ -328,7 +329,7 @@
         if (m_values->isEmpty()) {
             ASSERT(m_wrappers->isEmpty());
             // 'passNewItem' already lived in our list, we removed it, and now we're empty, which means there's nothing to replace.
-            ec = IndexSizeError;
+            es.throwDOMException(IndexSizeError);
             return 0;
         }
 
@@ -346,22 +347,22 @@
     }
 
     // SVGList::removeItem()
-    bool canRemoveItem(unsigned index, ExceptionCode& ec)
+    bool canRemoveItem(unsigned index, ExceptionState& es)
     {
-        if (!canAlterList(ec))
+        if (!canAlterList(es))
             return false;
 
         if (index >= m_values->size()) {
-            ec = IndexSizeError;
+            es.throwDOMException(IndexSizeError);
             return false;
         }
 
         return true;
     }
 
-    ListItemType removeItemValues(unsigned index, ExceptionCode& ec)
+    ListItemType removeItemValues(unsigned index, ExceptionState& es)
     {
-        if (!canRemoveItem(index, ec))
+        if (!canRemoveItem(index, es))
             return ListItemType();
 
         ListItemType oldItem = m_values->at(index);
@@ -371,10 +372,10 @@
         return oldItem;
     }
 
-    PassListItemTearOff removeItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, unsigned index, ExceptionCode& ec)
+    PassListItemTearOff removeItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, unsigned index, ExceptionState& es)
     {
         ASSERT(m_wrappers);
-        if (!canRemoveItem(index, ec))
+        if (!canRemoveItem(index, es))
             return 0;
 
         ASSERT(m_values->size() == m_wrappers->size());
@@ -393,9 +394,9 @@
     }
 
     // SVGList::appendItem()
-    ListItemType appendItemValues(const ListItemType& newItem, ExceptionCode& ec)
+    ListItemType appendItemValues(const ListItemType& newItem, ExceptionState& es)
     {
-        if (!canAlterList(ec))
+        if (!canAlterList(es))
             return ListItemType();
 
         // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
@@ -408,15 +409,15 @@
         return newItem;
     }
 
-    PassListItemTearOff appendItemValuesAndWrappers(PassListItemTearOff passNewItem, ExceptionCode& ec)
+    PassListItemTearOff appendItemValuesAndWrappers(PassListItemTearOff passNewItem, ExceptionState& es)
     {
         ASSERT(m_wrappers);
-        if (!canAlterList(ec))
+        if (!canAlterList(es))
             return 0;
 
         // Not specified, but FF/Opera do it this way, and it's just sane.
         if (!passNewItem) {
-            ec = TypeError;
+            es.throwDOMException(TypeError);
             return 0;
         }
 
diff --git a/Source/core/svg/properties/SVGListPropertyTearOff.h b/Source/core/svg/properties/SVGListPropertyTearOff.h
index 307e063..c6246d7 100644
--- a/Source/core/svg/properties/SVGListPropertyTearOff.h
+++ b/Source/core/svg/properties/SVGListPropertyTearOff.h
@@ -24,6 +24,8 @@
 
 namespace WebCore {
 
+class ExceptionState;
+
 template<typename PropertyType>
 class SVGListPropertyTearOff : public SVGListProperty<PropertyType> {
 public:
@@ -78,39 +80,39 @@
     }
 
     // SVGList API
-    void clear(ExceptionCode& ec)
+    void clear(ExceptionState& es)
     {
-        Base::clearValuesAndWrappers(ec);
+        Base::clearValuesAndWrappers(es);
     }
 
-    PassListItemTearOff initialize(PassListItemTearOff passNewItem, ExceptionCode& ec)
+    PassListItemTearOff initialize(PassListItemTearOff passNewItem, ExceptionState& es)
     {
-        return Base::initializeValuesAndWrappers(passNewItem, ec);
+        return Base::initializeValuesAndWrappers(passNewItem, es);
     }
 
-    PassListItemTearOff getItem(unsigned index, ExceptionCode& ec)
+    PassListItemTearOff getItem(unsigned index, ExceptionState& es)
     {
-        return Base::getItemValuesAndWrappers(m_animatedProperty.get(), index, ec);
+        return Base::getItemValuesAndWrappers(m_animatedProperty.get(), index, es);
     }
 
-    PassListItemTearOff insertItemBefore(PassListItemTearOff passNewItem, unsigned index, ExceptionCode& ec)
+    PassListItemTearOff insertItemBefore(PassListItemTearOff passNewItem, unsigned index, ExceptionState& es)
     {
-        return Base::insertItemBeforeValuesAndWrappers(passNewItem, index, ec);
+        return Base::insertItemBeforeValuesAndWrappers(passNewItem, index, es);
     }
 
-    PassListItemTearOff replaceItem(PassListItemTearOff passNewItem, unsigned index, ExceptionCode& ec)
+    PassListItemTearOff replaceItem(PassListItemTearOff passNewItem, unsigned index, ExceptionState& es)
     {
-        return Base::replaceItemValuesAndWrappers(passNewItem, index, ec);
+        return Base::replaceItemValuesAndWrappers(passNewItem, index, es);
     }
 
-    PassListItemTearOff removeItem(unsigned index, ExceptionCode& ec)
+    PassListItemTearOff removeItem(unsigned index, ExceptionState& es)
     {
-        return Base::removeItemValuesAndWrappers(m_animatedProperty.get(), index, ec);
+        return Base::removeItemValuesAndWrappers(m_animatedProperty.get(), index, es);
     }
 
-    PassListItemTearOff appendItem(PassListItemTearOff passNewItem, ExceptionCode& ec)
+    PassListItemTearOff appendItem(PassListItemTearOff passNewItem, ExceptionState& es)
     {
-        return Base::appendItemValuesAndWrappers(passNewItem, ec);
+        return Base::appendItemValuesAndWrappers(passNewItem, es);
     }
 
 protected:
diff --git a/Source/core/svg/properties/SVGPathSegListPropertyTearOff.cpp b/Source/core/svg/properties/SVGPathSegListPropertyTearOff.cpp
index 6a15cad..72a6bbb 100644
--- a/Source/core/svg/properties/SVGPathSegListPropertyTearOff.cpp
+++ b/Source/core/svg/properties/SVGPathSegListPropertyTearOff.cpp
@@ -18,10 +18,10 @@
  */
 
 #include "config.h"
-
 #include "core/svg/properties/SVGPathSegListPropertyTearOff.h"
 
 #include "SVGNames.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/svg/SVGPathElement.h"
 #include "core/svg/SVGPathSegWithContext.h"
@@ -39,19 +39,19 @@
     }
 }
 
-void SVGPathSegListPropertyTearOff::clear(ExceptionCode& ec)
+void SVGPathSegListPropertyTearOff::clear(ExceptionState& es)
 {
     ASSERT(m_values);
     if (m_values->isEmpty())
         return;
 
     clearContextAndRoles();
-    SVGPathSegListPropertyTearOff::Base::clearValues(ec);
+    SVGPathSegListPropertyTearOff::Base::clearValues(es);
 }
 
-SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::getItem(unsigned index, ExceptionCode& ec)
+SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::getItem(unsigned index, ExceptionState& es)
 {
-    ListItemType returnedItem = Base::getItemValues(index, ec);
+    ListItemType returnedItem = Base::getItemValues(index, es);
     if (returnedItem) {
         ASSERT(static_cast<SVGPathSegWithContext*>(returnedItem.get())->contextElement() == contextElement());
         ASSERT(static_cast<SVGPathSegWithContext*>(returnedItem.get())->role() == m_pathSegRole);
@@ -59,11 +59,11 @@
     return returnedItem.release();
 }
 
-SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::replaceItem(PassListItemType passNewItem, unsigned index, ExceptionCode& ec)
+SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::replaceItem(PassListItemType passNewItem, unsigned index, ExceptionState& es)
 {
     // Not specified, but FF/Opera do it this way, and it's just sane.
     if (!passNewItem) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return 0;
     }
 
@@ -74,12 +74,12 @@
     }
 
     ListItemType newItem = passNewItem;
-    return Base::replaceItemValues(newItem, index, ec);
+    return Base::replaceItemValues(newItem, index, es);
 }
 
-SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::removeItem(unsigned index, ExceptionCode& ec)
+SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::removeItem(unsigned index, ExceptionState& es)
 {
-    SVGPathSegListPropertyTearOff::ListItemType removedItem = SVGPathSegListPropertyTearOff::Base::removeItemValues(index, ec);
+    SVGPathSegListPropertyTearOff::ListItemType removedItem = SVGPathSegListPropertyTearOff::Base::removeItemValues(index, es);
     if (removedItem)
         static_cast<SVGPathSegWithContext*>(removedItem.get())->setContextAndRole(0, PathSegUndefinedRole);
     return removedItem.release();
diff --git a/Source/core/svg/properties/SVGPathSegListPropertyTearOff.h b/Source/core/svg/properties/SVGPathSegListPropertyTearOff.h
index 5761f7c..56055ed 100644
--- a/Source/core/svg/properties/SVGPathSegListPropertyTearOff.h
+++ b/Source/core/svg/properties/SVGPathSegListPropertyTearOff.h
@@ -20,7 +20,7 @@
 #ifndef SVGPathSegListPropertyTearOff_h
 #define SVGPathSegListPropertyTearOff_h
 
-#include "core/dom/ExceptionCode.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/svg/SVGPathSegList.h"
 #include "core/svg/properties/SVGAnimatedListPropertyTearOff.h"
 
@@ -66,49 +66,49 @@
     }
 
     // SVGList API
-    void clear(ExceptionCode&);
+    void clear(ExceptionState&);
 
-    PassListItemType initialize(PassListItemType passNewItem, ExceptionCode& ec)
+    PassListItemType initialize(PassListItemType passNewItem, ExceptionState& es)
     {
         // Not specified, but FF/Opera do it this way, and it's just sane.
         if (!passNewItem) {
-            ec = TypeError;
+            es.throwTypeError();
             return 0;
         }
 
         clearContextAndRoles();
         ListItemType newItem = passNewItem;
-        return Base::initializeValues(newItem, ec);
+        return Base::initializeValues(newItem, es);
     }
 
-    PassListItemType getItem(unsigned index, ExceptionCode&);
+    PassListItemType getItem(unsigned index, ExceptionState&);
 
-    PassListItemType insertItemBefore(PassListItemType passNewItem, unsigned index, ExceptionCode& ec)
+    PassListItemType insertItemBefore(PassListItemType passNewItem, unsigned index, ExceptionState& es)
     {
         // Not specified, but FF/Opera do it this way, and it's just sane.
         if (!passNewItem) {
-            ec = TypeError;
+            es.throwTypeError();
             return 0;
         }
 
         ListItemType newItem = passNewItem;
-        return Base::insertItemBeforeValues(newItem, index, ec);
+        return Base::insertItemBeforeValues(newItem, index, es);
     }
 
-    PassListItemType replaceItem(PassListItemType, unsigned index, ExceptionCode&);
+    PassListItemType replaceItem(PassListItemType, unsigned index, ExceptionState&);
 
-    PassListItemType removeItem(unsigned index, ExceptionCode&);
+    PassListItemType removeItem(unsigned index, ExceptionState&);
 
-    PassListItemType appendItem(PassListItemType passNewItem, ExceptionCode& ec)
+    PassListItemType appendItem(PassListItemType passNewItem, ExceptionState& es)
     {
         // Not specified, but FF/Opera do it this way, and it's just sane.
         if (!passNewItem) {
-            ec = TypeError;
+            es.throwTypeError();
             return 0;
         }
 
         ListItemType newItem = passNewItem;
-        return Base::appendItemValues(newItem, ec);
+        return Base::appendItemValues(newItem, es);
     }
 
 private:
diff --git a/Source/core/svg/properties/SVGStaticListPropertyTearOff.h b/Source/core/svg/properties/SVGStaticListPropertyTearOff.h
index 621112e..367560f 100644
--- a/Source/core/svg/properties/SVGStaticListPropertyTearOff.h
+++ b/Source/core/svg/properties/SVGStaticListPropertyTearOff.h
@@ -24,6 +24,8 @@
 
 namespace WebCore {
 
+class ExceptionState;
+
 template<typename PropertyType>
 class SVGStaticListPropertyTearOff : public SVGListProperty<PropertyType> {
 public:
@@ -42,39 +44,39 @@
     }
 
     // SVGList API
-    void clear(ExceptionCode& ec)
+    void clear(ExceptionState& es)
     {
-        Base::clearValues(ec);
+        Base::clearValues(es);
     }
 
-    ListItemType initialize(const ListItemType& newItem, ExceptionCode& ec)
+    ListItemType initialize(const ListItemType& newItem, ExceptionState& es)
     {
-        return Base::initializeValues(newItem, ec);
+        return Base::initializeValues(newItem, es);
     }
 
-    ListItemType getItem(unsigned index, ExceptionCode& ec)
+    ListItemType getItem(unsigned index, ExceptionState& es)
     {
-        return Base::getItemValues(index, ec);
+        return Base::getItemValues(index, es);
     }
 
-    ListItemType insertItemBefore(const ListItemType& newItem, unsigned index, ExceptionCode& ec)
+    ListItemType insertItemBefore(const ListItemType& newItem, unsigned index, ExceptionState& es)
     {
-        return Base::insertItemBeforeValues(newItem, index, ec);
+        return Base::insertItemBeforeValues(newItem, index, es);
     }
 
-    ListItemType replaceItem(const ListItemType& newItem, unsigned index, ExceptionCode& ec)
+    ListItemType replaceItem(const ListItemType& newItem, unsigned index, ExceptionState& es)
     {
-        return Base::replaceItemValues(newItem, index, ec);
+        return Base::replaceItemValues(newItem, index, es);
     }
 
-    ListItemType removeItem(unsigned index, ExceptionCode& ec)
+    ListItemType removeItem(unsigned index, ExceptionState& es)
     {
-        return Base::removeItemValues(index, ec);
+        return Base::removeItemValues(index, es);
     }
 
-    ListItemType appendItem(const ListItemType& newItem, ExceptionCode& ec)
+    ListItemType appendItem(const ListItemType& newItem, ExceptionState& es)
     {
-        return Base::appendItemValues(newItem, ec);
+        return Base::appendItemValues(newItem, es);
     }
 
 private:
diff --git a/Source/core/svg/properties/SVGTransformListPropertyTearOff.h b/Source/core/svg/properties/SVGTransformListPropertyTearOff.h
index 3387b6d..b306456 100644
--- a/Source/core/svg/properties/SVGTransformListPropertyTearOff.h
+++ b/Source/core/svg/properties/SVGTransformListPropertyTearOff.h
@@ -20,6 +20,8 @@
 #ifndef SVGTransformListPropertyTearOff_h
 #define SVGTransformListPropertyTearOff_h
 
+#include "bindings/v8/ExceptionState.h"
+#include "core/dom/ExceptionCode.h"
 #include "core/svg/SVGTransformList.h"
 #include "core/svg/properties/SVGListPropertyTearOff.h"
 
@@ -37,21 +39,21 @@
         return adoptRef(new SVGTransformListPropertyTearOff(animatedProperty, role, values, wrappers));
     }
 
-    PassRefPtr<SVGPropertyTearOff<SVGTransform> > createSVGTransformFromMatrix(SVGPropertyTearOff<SVGMatrix>* matrix, ExceptionCode& ec)
+    PassRefPtr<SVGPropertyTearOff<SVGTransform> > createSVGTransformFromMatrix(SVGPropertyTearOff<SVGMatrix>* matrix, ExceptionState& es)
     {
         ASSERT(m_values);
         if (!matrix) {
-            ec = TypeMismatchError;
+            es.throwDOMException(TypeMismatchError);
             return 0;
         }
         return SVGPropertyTearOff<SVGTransform>::create(m_values->createSVGTransformFromMatrix(matrix->propertyReference()));
     }
 
-    PassRefPtr<SVGPropertyTearOff<SVGTransform> > consolidate(ExceptionCode& ec)
+    PassRefPtr<SVGPropertyTearOff<SVGTransform> > consolidate(ExceptionState& es)
     {
         ASSERT(m_values);
         ASSERT(m_wrappers);
-        if (!canAlterList(ec))
+        if (!canAlterList(es))
             return 0;
 
         ASSERT(m_values->size() == m_wrappers->size());
diff --git a/Source/core/testing/InternalSettings.cpp b/Source/core/testing/InternalSettings.cpp
index 4d213d1..29e34ec 100644
--- a/Source/core/testing/InternalSettings.cpp
+++ b/Source/core/testing/InternalSettings.cpp
@@ -28,6 +28,7 @@
 #include "InternalSettings.h"
 
 #include "RuntimeEnabledFeatures.h"
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
@@ -37,19 +38,19 @@
 
 #define InternalSettingsGuardForSettingsReturn(returnValue) \
     if (!settings()) { \
-        ec = InvalidAccessError; \
+        es.throwDOMException(InvalidAccessError); \
         return returnValue; \
     }
 
 #define InternalSettingsGuardForSettings()  \
     if (!settings()) { \
-        ec = InvalidAccessError; \
+        es.throwDOMException(InvalidAccessError); \
         return; \
     }
 
 #define InternalSettingsGuardForPage() \
     if (!page()) { \
-        ec = InvalidAccessError; \
+        es.throwDOMException(InvalidAccessError); \
         return; \
     }
 
@@ -154,7 +155,7 @@
     return page()->settings();
 }
 
-void InternalSettings::setMockScrollbarsEnabled(bool enabled, ExceptionCode& ec)
+void InternalSettings::setMockScrollbarsEnabled(bool enabled, ExceptionState& es)
 {
     InternalSettingsGuardForSettings();
     settings()->setMockScrollbarsEnabled(enabled);
@@ -175,7 +176,7 @@
     RuntimeEnabledFeatures::setStyleScopedEnabled(enabled);
 }
 
-void InternalSettings::setTouchEventEmulationEnabled(bool enabled, ExceptionCode& ec)
+void InternalSettings::setTouchEventEmulationEnabled(bool enabled, ExceptionState& es)
 {
     InternalSettingsGuardForSettings();
     settings()->setTouchEventEmulationEnabled(enabled);
@@ -183,7 +184,7 @@
 
 // FIXME: This is a temporary flag and should be removed once accelerated
 // overflow scroll is ready (crbug.com/254111).
-void InternalSettings::setCompositorDrivenAcceleratedScrollingEnabled(bool enabled, ExceptionCode& ec)
+void InternalSettings::setCompositorDrivenAcceleratedScrollingEnabled(bool enabled, ExceptionState& es)
 {
     InternalSettingsGuardForSettings();
     settings()->setCompositorDrivenAcceleratedScrollingEnabled(enabled);
@@ -197,67 +198,67 @@
         (settings->*setter)(family, code);
 }
 
-void InternalSettings::setStandardFontFamily(const String& family, const String& script, ExceptionCode& ec)
+void InternalSettings::setStandardFontFamily(const String& family, const String& script, ExceptionState& es)
 {
     InternalSettingsGuardForSettings();
     setFontFamily(settings(), family, script, &Settings::setStandardFontFamily);
 }
 
-void InternalSettings::setSerifFontFamily(const String& family, const String& script, ExceptionCode& ec)
+void InternalSettings::setSerifFontFamily(const String& family, const String& script, ExceptionState& es)
 {
     InternalSettingsGuardForSettings();
     setFontFamily(settings(), family, script, &Settings::setSerifFontFamily);
 }
 
-void InternalSettings::setSansSerifFontFamily(const String& family, const String& script, ExceptionCode& ec)
+void InternalSettings::setSansSerifFontFamily(const String& family, const String& script, ExceptionState& es)
 {
     InternalSettingsGuardForSettings();
     setFontFamily(settings(), family, script, &Settings::setSansSerifFontFamily);
 }
 
-void InternalSettings::setFixedFontFamily(const String& family, const String& script, ExceptionCode& ec)
+void InternalSettings::setFixedFontFamily(const String& family, const String& script, ExceptionState& es)
 {
     InternalSettingsGuardForSettings();
     setFontFamily(settings(), family, script, &Settings::setFixedFontFamily);
 }
 
-void InternalSettings::setCursiveFontFamily(const String& family, const String& script, ExceptionCode& ec)
+void InternalSettings::setCursiveFontFamily(const String& family, const String& script, ExceptionState& es)
 {
     InternalSettingsGuardForSettings();
     setFontFamily(settings(), family, script, &Settings::setCursiveFontFamily);
 }
 
-void InternalSettings::setFantasyFontFamily(const String& family, const String& script, ExceptionCode& ec)
+void InternalSettings::setFantasyFontFamily(const String& family, const String& script, ExceptionState& es)
 {
     InternalSettingsGuardForSettings();
     setFontFamily(settings(), family, script, &Settings::setFantasyFontFamily);
 }
 
-void InternalSettings::setPictographFontFamily(const String& family, const String& script, ExceptionCode& ec)
+void InternalSettings::setPictographFontFamily(const String& family, const String& script, ExceptionState& es)
 {
     InternalSettingsGuardForSettings();
     setFontFamily(settings(), family, script, &Settings::setPictographFontFamily);
 }
 
-void InternalSettings::setTextAutosizingEnabled(bool enabled, ExceptionCode& ec)
+void InternalSettings::setTextAutosizingEnabled(bool enabled, ExceptionState& es)
 {
     InternalSettingsGuardForSettings();
     settings()->setTextAutosizingEnabled(enabled);
 }
 
-void InternalSettings::setTextAutosizingWindowSizeOverride(int width, int height, ExceptionCode& ec)
+void InternalSettings::setTextAutosizingWindowSizeOverride(int width, int height, ExceptionState& es)
 {
     InternalSettingsGuardForSettings();
     settings()->setTextAutosizingWindowSizeOverride(IntSize(width, height));
 }
 
-void InternalSettings::setMediaTypeOverride(const String& mediaType, ExceptionCode& ec)
+void InternalSettings::setMediaTypeOverride(const String& mediaType, ExceptionState& es)
 {
     InternalSettingsGuardForSettings();
     settings()->setMediaTypeOverride(mediaType);
 }
 
-void InternalSettings::setTextAutosizingFontScaleFactor(float fontScaleFactor, ExceptionCode& ec)
+void InternalSettings::setTextAutosizingFontScaleFactor(float fontScaleFactor, ExceptionState& es)
 {
     InternalSettingsGuardForSettings();
     settings()->setTextAutosizingFontScaleFactor(fontScaleFactor);
@@ -268,7 +269,7 @@
     RuntimeEnabledFeatures::setCSSExclusionsEnabled(enabled);
 }
 
-void InternalSettings::setEditingBehavior(const String& editingBehavior, ExceptionCode& ec)
+void InternalSettings::setEditingBehavior(const String& editingBehavior, ExceptionState& es)
 {
     InternalSettingsGuardForSettings();
     if (equalIgnoringCase(editingBehavior, "win"))
@@ -280,7 +281,7 @@
     else if (equalIgnoringCase(editingBehavior, "android"))
         settings()->setEditingBehaviorType(EditingAndroidBehavior);
     else
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
 }
 
 void InternalSettings::setLazyLayoutEnabled(bool enabled)
@@ -293,13 +294,13 @@
     RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(enabled);
 }
 
-void InternalSettings::setImagesEnabled(bool enabled, ExceptionCode& ec)
+void InternalSettings::setImagesEnabled(bool enabled, ExceptionState& es)
 {
     InternalSettingsGuardForSettings();
     settings()->setImagesEnabled(enabled);
 }
 
-void InternalSettings::setDefaultVideoPosterURL(const String& url, ExceptionCode& ec)
+void InternalSettings::setDefaultVideoPosterURL(const String& url, ExceptionState& es)
 {
     InternalSettingsGuardForSettings();
     settings()->setDefaultVideoPosterURL(url);
diff --git a/Source/core/testing/InternalSettings.h b/Source/core/testing/InternalSettings.h
index b77e01b..186385d 100644
--- a/Source/core/testing/InternalSettings.h
+++ b/Source/core/testing/InternalSettings.h
@@ -36,10 +36,9 @@
 
 namespace WebCore {
 
-typedef int ExceptionCode;
-
-class Frame;
 class Document;
+class ExceptionState;
+class Frame;
 class Page;
 class Settings;
 
@@ -80,28 +79,28 @@
     virtual ~InternalSettings();
     void resetToConsistentState();
 
-    void setStandardFontFamily(const String& family, const String& script, ExceptionCode&);
-    void setSerifFontFamily(const String& family, const String& script, ExceptionCode&);
-    void setSansSerifFontFamily(const String& family, const String& script, ExceptionCode&);
-    void setFixedFontFamily(const String& family, const String& script, ExceptionCode&);
-    void setCursiveFontFamily(const String& family, const String& script, ExceptionCode&);
-    void setFantasyFontFamily(const String& family, const String& script, ExceptionCode&);
-    void setPictographFontFamily(const String& family, const String& script, ExceptionCode&);
+    void setStandardFontFamily(const String& family, const String& script, ExceptionState&);
+    void setSerifFontFamily(const String& family, const String& script, ExceptionState&);
+    void setSansSerifFontFamily(const String& family, const String& script, ExceptionState&);
+    void setFixedFontFamily(const String& family, const String& script, ExceptionState&);
+    void setCursiveFontFamily(const String& family, const String& script, ExceptionState&);
+    void setFantasyFontFamily(const String& family, const String& script, ExceptionState&);
+    void setPictographFontFamily(const String& family, const String& script, ExceptionState&);
 
-    void setDefaultVideoPosterURL(const String& url, ExceptionCode&);
-    void setEditingBehavior(const String&, ExceptionCode&);
-    void setImagesEnabled(bool, ExceptionCode&);
-    void setMediaTypeOverride(const String& mediaType, ExceptionCode&);
-    void setMockScrollbarsEnabled(bool, ExceptionCode&);
-    void setTextAutosizingEnabled(bool, ExceptionCode&);
-    void setTextAutosizingFontScaleFactor(float fontScaleFactor, ExceptionCode&);
-    void setTextAutosizingWindowSizeOverride(int width, int height, ExceptionCode&);
-    void setTouchEventEmulationEnabled(bool, ExceptionCode&);
-    void setUsesOverlayScrollbars(bool, ExceptionCode&);
+    void setDefaultVideoPosterURL(const String& url, ExceptionState&);
+    void setEditingBehavior(const String&, ExceptionState&);
+    void setImagesEnabled(bool, ExceptionState&);
+    void setMediaTypeOverride(const String& mediaType, ExceptionState&);
+    void setMockScrollbarsEnabled(bool, ExceptionState&);
+    void setTextAutosizingEnabled(bool, ExceptionState&);
+    void setTextAutosizingFontScaleFactor(float fontScaleFactor, ExceptionState&);
+    void setTextAutosizingWindowSizeOverride(int width, int height, ExceptionState&);
+    void setTouchEventEmulationEnabled(bool, ExceptionState&);
+    void setUsesOverlayScrollbars(bool, ExceptionState&);
 
     // FIXME: This is a temporary flag and should be removed once accelerated
     // overflow scroll is ready (crbug.com/254111).
-    void setCompositorDrivenAcceleratedScrollingEnabled(bool, ExceptionCode&);
+    void setCompositorDrivenAcceleratedScrollingEnabled(bool, ExceptionState&);
 
     // FIXME: The following are RuntimeEnabledFeatures and likely
     // cannot be changed after process start. These setters should
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
index e618f8d..f29fa25 100644
--- a/Source/core/testing/Internals.cpp
+++ b/Source/core/testing/Internals.cpp
@@ -38,6 +38,7 @@
 #include "MockPagePopupDriver.h"
 #include "RuntimeEnabledFeatures.h"
 #include "TypeConversions.h"
+#include "bindings/v8/ExceptionState.h"
 #include "bindings/v8/SerializedScriptValue.h"
 #include "bindings/v8/V8ThrowException.h"
 #include "core/css/StyleSheetContents.h"
@@ -295,81 +296,81 @@
     CRASH();
 }
 
-PassRefPtr<Element> Internals::createContentElement(ExceptionCode& ec)
+PassRefPtr<Element> Internals::createContentElement(ExceptionState& es)
 {
     Document* document = contextDocument();
     if (!document) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
     return HTMLContentElement::create(document);
 }
 
-bool Internals::isValidContentSelect(Element* insertionPoint, ExceptionCode& ec)
+bool Internals::isValidContentSelect(Element* insertionPoint, ExceptionState& es)
 {
     if (!insertionPoint || !insertionPoint->isInsertionPoint()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return false;
     }
 
     return isHTMLContentElement(insertionPoint) && toHTMLContentElement(insertionPoint)->isSelectValid();
 }
 
-Node* Internals::treeScopeRootNode(Node* node, ExceptionCode& ec)
+Node* Internals::treeScopeRootNode(Node* node, ExceptionState& es)
 {
     if (!node) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
     return node->treeScope()->rootNode();
 }
 
-Node* Internals::parentTreeScope(Node* node, ExceptionCode& ec)
+Node* Internals::parentTreeScope(Node* node, ExceptionState& es)
 {
     if (!node) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
     const TreeScope* parentTreeScope = node->treeScope()->parentTreeScope();
     return parentTreeScope ? parentTreeScope->rootNode() : 0;
 }
 
-bool Internals::hasSelectorForIdInShadow(Element* host, const String& idValue, ExceptionCode& ec)
+bool Internals::hasSelectorForIdInShadow(Element* host, const String& idValue, ExceptionState& es)
 {
     if (!host || !host->shadow()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
     return host->shadow()->distributor().ensureSelectFeatureSet(host->shadow()).hasSelectorForId(idValue);
 }
 
-bool Internals::hasSelectorForClassInShadow(Element* host, const String& className, ExceptionCode& ec)
+bool Internals::hasSelectorForClassInShadow(Element* host, const String& className, ExceptionState& es)
 {
     if (!host || !host->shadow()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
     return host->shadow()->distributor().ensureSelectFeatureSet(host->shadow()).hasSelectorForClass(className);
 }
 
-bool Internals::hasSelectorForAttributeInShadow(Element* host, const String& attributeName, ExceptionCode& ec)
+bool Internals::hasSelectorForAttributeInShadow(Element* host, const String& attributeName, ExceptionState& es)
 {
     if (!host || !host->shadow()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
     return host->shadow()->distributor().ensureSelectFeatureSet(host->shadow()).hasSelectorForAttribute(attributeName);
 }
 
-bool Internals::hasSelectorForPseudoClassInShadow(Element* host, const String& pseudoClass, ExceptionCode& ec)
+bool Internals::hasSelectorForPseudoClassInShadow(Element* host, const String& pseudoClass, ExceptionState& es)
 {
     if (!host || !host->shadow()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -393,10 +394,10 @@
     return false;
 }
 
-unsigned short Internals::compareTreeScopePosition(const Node* node1, const Node* node2, ExceptionCode& ec) const
+unsigned short Internals::compareTreeScopePosition(const Node* node1, const Node* node2, ExceptionState& es) const
 {
     if (!node1 || !node2) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
     const TreeScope* treeScope1 = node1->isDocumentNode() ? static_cast<const TreeScope*>(toDocument(node1)) :
@@ -404,7 +405,7 @@
     const TreeScope* treeScope2 = node2->isDocumentNode() ? static_cast<const TreeScope*>(toDocument(node2)) :
         node2->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node2)) : 0;
     if (!treeScope1 || !treeScope2) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
     return treeScope1->comparePosition(treeScope2);
@@ -420,10 +421,10 @@
     return 0;
 }
 
-void Internals::suspendAnimations(Document* document, ExceptionCode& ec) const
+void Internals::suspendAnimations(Document* document, ExceptionState& es) const
 {
     if (!document || !document->frame()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
 
@@ -436,10 +437,10 @@
     }
 }
 
-void Internals::resumeAnimations(Document* document, ExceptionCode& ec) const
+void Internals::resumeAnimations(Document* document, ExceptionState& es) const
 {
     if (!document || !document->frame()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
 
@@ -452,10 +453,10 @@
     }
 }
 
-void Internals::pauseAnimations(double pauseTime, ExceptionCode& ec)
+void Internals::pauseAnimations(double pauseTime, ExceptionState& es)
 {
     if (pauseTime < 0) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
 
@@ -463,28 +464,28 @@
         frame()->animation()->pauseAnimationsForTesting(pauseTime);
 }
 
-bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionCode& ec) const
+bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionState& es) const
 {
     if (root && root->isShadowRoot())
         return toShadowRoot(root)->containsShadowElements();
 
-    ec = InvalidAccessError;
+    es.throwDOMException(InvalidAccessError);
     return 0;
 }
 
-bool Internals::hasContentElement(const Node* root, ExceptionCode& ec) const
+bool Internals::hasContentElement(const Node* root, ExceptionState& es) const
 {
     if (root && root->isShadowRoot())
         return toShadowRoot(root)->containsContentElements();
 
-    ec = InvalidAccessError;
+    es.throwDOMException(InvalidAccessError);
     return 0;
 }
 
-size_t Internals::countElementShadow(const Node* root, ExceptionCode& ec) const
+size_t Internals::countElementShadow(const Node* root, ExceptionState& es) const
 {
     if (!root || !root->isShadowRoot()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
     if (const ScopeContentDistribution* distribution = toShadowRoot(root)->scopeDistribution())
@@ -492,20 +493,20 @@
     return 0;
 }
 
-bool Internals::attached(Node* node, ExceptionCode& ec)
+bool Internals::attached(Node* node, ExceptionState& es)
 {
     if (!node) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return false;
     }
 
     return node->attached();
 }
 
-Node* Internals::nextSiblingByWalker(Node* node, ExceptionCode& ec)
+Node* Internals::nextSiblingByWalker(Node* node, ExceptionState& es)
 {
     if (!node) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
     ComposedShadowTreeWalker walker(node);
@@ -513,10 +514,10 @@
     return walker.get();
 }
 
-Node* Internals::firstChildByWalker(Node* node, ExceptionCode& ec)
+Node* Internals::firstChildByWalker(Node* node, ExceptionState& es)
 {
     if (!node) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
     ComposedShadowTreeWalker walker(node);
@@ -524,10 +525,10 @@
     return walker.get();
 }
 
-Node* Internals::lastChildByWalker(Node* node, ExceptionCode& ec)
+Node* Internals::lastChildByWalker(Node* node, ExceptionState& es)
 {
     if (!node) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
     ComposedShadowTreeWalker walker(node);
@@ -535,10 +536,10 @@
     return walker.get();
 }
 
-Node* Internals::nextNodeByWalker(Node* node, ExceptionCode& ec)
+Node* Internals::nextNodeByWalker(Node* node, ExceptionState& es)
 {
     if (!node) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
     ComposedShadowTreeWalker walker(node);
@@ -546,10 +547,10 @@
     return walker.get();
 }
 
-Node* Internals::previousNodeByWalker(Node* node, ExceptionCode& ec)
+Node* Internals::previousNodeByWalker(Node* node, ExceptionState& es)
 {
     if (!node) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
     ComposedShadowTreeWalker walker(node);
@@ -557,35 +558,35 @@
     return walker.get();
 }
 
-String Internals::elementRenderTreeAsText(Element* element, ExceptionCode& ec)
+String Internals::elementRenderTreeAsText(Element* element, ExceptionState& es)
 {
     if (!element) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return String();
     }
 
     String representation = externalRepresentation(element);
     if (representation.isEmpty()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return String();
     }
 
     return representation;
 }
 
-size_t Internals::numberOfScopedHTMLStyleChildren(const Node* scope, ExceptionCode& ec) const
+size_t Internals::numberOfScopedHTMLStyleChildren(const Node* scope, ExceptionState& es) const
 {
     if (scope && (scope->isElementNode() || scope->isShadowRoot()))
         return scope->numberOfScopedHTMLStyleChildren();
 
-    ec = InvalidAccessError;
+    es.throwDOMException(InvalidAccessError);
     return 0;
 }
 
-PassRefPtr<CSSComputedStyleDeclaration> Internals::computedStyleIncludingVisitedInfo(Node* node, ExceptionCode& ec) const
+PassRefPtr<CSSComputedStyleDeclaration> Internals::computedStyleIncludingVisitedInfo(Node* node, ExceptionState& es) const
 {
     if (!node) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -593,30 +594,30 @@
     return CSSComputedStyleDeclaration::create(node, allowVisitedStyle);
 }
 
-ShadowRoot* Internals::ensureShadowRoot(Element* host, ExceptionCode& ec)
+ShadowRoot* Internals::ensureShadowRoot(Element* host, ExceptionState& es)
 {
     if (!host) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
     if (ElementShadow* shadow = host->shadow())
         return shadow->youngestShadowRoot();
 
-    return host->createShadowRoot(ec).get();
+    return host->createShadowRoot(es).get();
 }
 
-ShadowRoot* Internals::shadowRoot(Element* host, ExceptionCode& ec)
+ShadowRoot* Internals::shadowRoot(Element* host, ExceptionState& es)
 {
     // FIXME: Internals::shadowRoot() in tests should be converted to youngestShadowRoot() or oldestShadowRoot().
     // https://bugs.webkit.org/show_bug.cgi?id=78465
-    return youngestShadowRoot(host, ec);
+    return youngestShadowRoot(host, es);
 }
 
-ShadowRoot* Internals::youngestShadowRoot(Element* host, ExceptionCode& ec)
+ShadowRoot* Internals::youngestShadowRoot(Element* host, ExceptionState& es)
 {
     if (!host) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -625,10 +626,10 @@
     return 0;
 }
 
-ShadowRoot* Internals::oldestShadowRoot(Element* host, ExceptionCode& ec)
+ShadowRoot* Internals::oldestShadowRoot(Element* host, ExceptionState& es)
 {
     if (!host) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -637,30 +638,30 @@
     return 0;
 }
 
-ShadowRoot* Internals::youngerShadowRoot(Node* shadow, ExceptionCode& ec)
+ShadowRoot* Internals::youngerShadowRoot(Node* shadow, ExceptionState& es)
 {
     if (!shadow || !shadow->isShadowRoot()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
     return toShadowRoot(shadow)->youngerShadowRoot();
 }
 
-ShadowRoot* Internals::olderShadowRoot(Node* shadow, ExceptionCode& ec)
+ShadowRoot* Internals::olderShadowRoot(Node* shadow, ExceptionState& es)
 {
     if (!shadow || !shadow->isShadowRoot()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
     return toShadowRoot(shadow)->olderShadowRoot();
 }
 
-String Internals::shadowRootType(const Node* root, ExceptionCode& ec) const
+String Internals::shadowRootType(const Node* root, ExceptionState& es) const
 {
     if (!root || !root->isShadowRoot()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return String();
     }
 
@@ -675,10 +676,10 @@
     }
 }
 
-Element* Internals::includerFor(Node* node, ExceptionCode& ec)
+Element* Internals::includerFor(Node* node, ExceptionState& es)
 {
     if (!node) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -687,20 +688,20 @@
     return parentDetails.insertionPoint();
 }
 
-String Internals::shadowPseudoId(Element* element, ExceptionCode& ec)
+String Internals::shadowPseudoId(Element* element, ExceptionState& es)
 {
     if (!element) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return String();
     }
 
     return element->shadowPseudoId().string();
 }
 
-void Internals::setShadowPseudoId(Element* element, const String& id, ExceptionCode& ec)
+void Internals::setShadowPseudoId(Element* element, const String& id, ExceptionState& es)
 {
     if (!element) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
 
@@ -724,26 +725,26 @@
     toHTMLInputElement(element)->selectColorInColorChooser(StyleColor(colorValue).color());
 }
 
-Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionCode& ec)
+Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionState& es)
 {
     HistoryItem* mainItem = frame()->loader()->history()->previousItem();
     if (!mainItem) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return Vector<String>();
     }
     String uniqueName = frame()->tree()->uniqueName();
     if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqueName)) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return Vector<String>();
     }
     return mainItem->target() == uniqueName ? mainItem->documentState() : mainItem->childItemWithTarget(uniqueName)->documentState();
 }
 
-void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& state, ExceptionCode& ec)
+void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& state, ExceptionState& es)
 {
     HistoryItem* mainItem = frame()->loader()->history()->previousItem();
     if (!mainItem) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
     String uniqueName = frame()->tree()->uniqueName();
@@ -752,7 +753,7 @@
     else if (HistoryItem* subItem = mainItem->childItemWithTarget(uniqueName))
         subItem->setDocumentState(state);
     else
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
 }
 
 void Internals::enableMockSpeechSynthesizer()
@@ -767,7 +768,7 @@
     synthesis->setPlatformSynthesizer(PlatformSpeechSynthesizerMock::create(synthesis));
 }
 
-void Internals::setEnableMockPagePopup(bool enabled, ExceptionCode& ec)
+void Internals::setEnableMockPagePopup(bool enabled, ExceptionState& es)
 {
     Document* document = contextDocument();
     if (!document || !document->page())
@@ -787,32 +788,32 @@
     return s_pagePopupDriver ? s_pagePopupDriver->pagePopupController() : 0;
 }
 
-PassRefPtr<ClientRect> Internals::unscaledViewportRect(ExceptionCode& ec)
+PassRefPtr<ClientRect> Internals::unscaledViewportRect(ExceptionState& es)
 {
     Document* document = contextDocument();
     if (!document || !document->view()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return ClientRect::create();
     }
 
     return ClientRect::create(document->view()->visibleContentRect());
 }
 
-PassRefPtr<ClientRect> Internals::absoluteCaretBounds(ExceptionCode& ec)
+PassRefPtr<ClientRect> Internals::absoluteCaretBounds(ExceptionState& es)
 {
     Document* document = contextDocument();
     if (!document || !document->frame() || !document->frame()->selection()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return ClientRect::create();
     }
 
     return ClientRect::create(document->frame()->selection()->absoluteCaretBounds());
 }
 
-PassRefPtr<ClientRect> Internals::boundingBox(Element* element, ExceptionCode& ec)
+PassRefPtr<ClientRect> Internals::boundingBox(Element* element, ExceptionState& es)
 {
     if (!element) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return ClientRect::create();
     }
 
@@ -823,10 +824,10 @@
     return ClientRect::create(renderer->absoluteBoundingBoxRectIgnoringTransforms());
 }
 
-PassRefPtr<ClientRectList> Internals::inspectorHighlightRects(Document* document, ExceptionCode& ec)
+PassRefPtr<ClientRectList> Internals::inspectorHighlightRects(Document* document, ExceptionState& es)
 {
     if (!document || !document->page() || !document->page()->inspectorController()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return ClientRectList::create();
     }
 
@@ -835,32 +836,32 @@
     return ClientRectList::create(highlight.quads);
 }
 
-unsigned Internals::markerCountForNode(Node* node, const String& markerType, ExceptionCode& ec)
+unsigned Internals::markerCountForNode(Node* node, const String& markerType, ExceptionState& es)
 {
     if (!node) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
     DocumentMarker::MarkerTypes markerTypes = 0;
     if (!markerTypesFrom(markerType, markerTypes)) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return 0;
     }
 
     return node->document()->markers()->markersFor(node, markerTypes).size();
 }
 
-DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
+DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsigned index, ExceptionState& es)
 {
     if (!node) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
     DocumentMarker::MarkerTypes markerTypes = 0;
     if (!markerTypesFrom(markerType, markerTypes)) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return 0;
     }
 
@@ -870,17 +871,17 @@
     return markers[index];
 }
 
-PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
+PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& markerType, unsigned index, ExceptionState& es)
 {
-    DocumentMarker* marker = markerAt(node, markerType, index, ec);
+    DocumentMarker* marker = markerAt(node, markerType, index, es);
     if (!marker)
         return 0;
     return Range::create(node->document(), node, marker->startOffset(), node, marker->endOffset());
 }
 
-String Internals::markerDescriptionForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
+String Internals::markerDescriptionForNode(Node* node, const String& markerType, unsigned index, ExceptionState& es)
 {
-    DocumentMarker* marker = markerAt(node, markerType, index, ec);
+    DocumentMarker* marker = markerAt(node, markerType, index, es);
     if (!marker)
         return String();
     return marker->description();
@@ -892,10 +893,10 @@
     range->ownerDocument()->markers()->addTextMatchMarker(range, isActive);
 }
 
-void Internals::setScrollViewPosition(Document* document, long x, long y, ExceptionCode& ec)
+void Internals::setScrollViewPosition(Document* document, long x, long y, ExceptionState& es)
 {
     if (!document || !document->view()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
 
@@ -910,10 +911,10 @@
     frameView->setConstrainsScrollingToContentEdge(constrainsScrollingToContentEdgeOldValue);
 }
 
-void Internals::setPagination(Document* document, const String& mode, int gap, int pageLength, ExceptionCode& ec)
+void Internals::setPagination(Document* document, const String& mode, int gap, int pageLength, ExceptionState& es)
 {
     if (!document || !document->page()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
     Page* page = document->page();
@@ -930,7 +931,7 @@
     else if (mode == "BottomToTopPaginated")
         pagination.mode = Pagination::BottomToTopPaginated;
     else {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return;
     }
 
@@ -939,10 +940,10 @@
     page->setPagination(pagination);
 }
 
-String Internals::configurationForViewport(Document* document, float, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec)
+String Internals::configurationForViewport(Document* document, float, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionState& es)
 {
     if (!document || !document->page()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return String();
     }
     Page* page = document->page();
@@ -977,10 +978,10 @@
     return builder.toString();
 }
 
-bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionCode& ec)
+bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionState& es)
 {
     if (!textField) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return false;
     }
 
@@ -991,92 +992,92 @@
     if (textField->tagName() == "TEXTAREA")
         return toHTMLTextAreaElement(textField)->lastChangeWasUserEdit();
 
-    ec = InvalidNodeTypeError;
+    es.throwDOMException(InvalidNodeTypeError);
     return false;
 }
 
-bool Internals::elementShouldAutoComplete(Element* element, ExceptionCode& ec)
+bool Internals::elementShouldAutoComplete(Element* element, ExceptionState& es)
 {
     if (!element) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return false;
     }
 
     if (element->hasTagName(inputTag))
         return toHTMLInputElement(element)->shouldAutocomplete();
 
-    ec = InvalidNodeTypeError;
+    es.throwDOMException(InvalidNodeTypeError);
     return false;
 }
 
-String Internals::suggestedValue(Element* element, ExceptionCode& ec)
+String Internals::suggestedValue(Element* element, ExceptionState& es)
 {
     if (!element) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return String();
     }
 
     if (!element->hasTagName(inputTag)) {
-        ec = InvalidNodeTypeError;
+        es.throwDOMException(InvalidNodeTypeError);
         return String();
     }
 
     return toHTMLInputElement(element)->suggestedValue();
 }
 
-void Internals::setSuggestedValue(Element* element, const String& value, ExceptionCode& ec)
+void Internals::setSuggestedValue(Element* element, const String& value, ExceptionState& es)
 {
     if (!element) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
 
     if (!element->hasTagName(inputTag)) {
-        ec = InvalidNodeTypeError;
+        es.throwDOMException(InvalidNodeTypeError);
         return;
     }
 
     toHTMLInputElement(element)->setSuggestedValue(value);
 }
 
-void Internals::setEditingValue(Element* element, const String& value, ExceptionCode& ec)
+void Internals::setEditingValue(Element* element, const String& value, ExceptionState& es)
 {
     if (!element) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
 
     if (!element->hasTagName(inputTag)) {
-        ec = InvalidNodeTypeError;
+        es.throwDOMException(InvalidNodeTypeError);
         return;
     }
 
     toHTMLInputElement(element)->setEditingValue(value);
 }
 
-void Internals::setAutofilled(Element* element, bool enabled, ExceptionCode& ec)
+void Internals::setAutofilled(Element* element, bool enabled, ExceptionState& es)
 {
     if (!element->hasTagName(inputTag)) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
     toHTMLInputElement(element)->setAutofilled(enabled);
 }
 
-void Internals::scrollElementToRect(Element* element, long x, long y, long w, long h, ExceptionCode& ec)
+void Internals::scrollElementToRect(Element* element, long x, long y, long w, long h, ExceptionState& es)
 {
     if (!element || !element->document() || !element->document()->view()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
     FrameView* frameView = element->document()->view();
     frameView->scrollElementToRect(element, IntRect(x, y, w, h));
 }
 
-void Internals::paintControlTints(Document* document, ExceptionCode& ec)
+void Internals::paintControlTints(Document* document, ExceptionState& es)
 {
     if (!document || !document->view()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
 
@@ -1084,20 +1085,20 @@
     frameView->paintControlTints();
 }
 
-PassRefPtr<Range> Internals::rangeFromLocationAndLength(Element* scope, int rangeLocation, int rangeLength, ExceptionCode& ec)
+PassRefPtr<Range> Internals::rangeFromLocationAndLength(Element* scope, int rangeLocation, int rangeLength, ExceptionState& es)
 {
     if (!scope) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
     return TextIterator::rangeFromLocationAndLength(scope, rangeLocation, rangeLength);
 }
 
-unsigned Internals::locationFromRange(Element* scope, const Range* range, ExceptionCode& ec)
+unsigned Internals::locationFromRange(Element* scope, const Range* range, ExceptionState& es)
 {
     if (!scope || !range) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -1107,10 +1108,10 @@
     return location;
 }
 
-unsigned Internals::lengthFromRange(Element* scope, const Range* range, ExceptionCode& ec)
+unsigned Internals::lengthFromRange(Element* scope, const Range* range, ExceptionState& es)
 {
     if (!scope || !range) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -1120,20 +1121,20 @@
     return length;
 }
 
-String Internals::rangeAsText(const Range* range, ExceptionCode& ec)
+String Internals::rangeAsText(const Range* range, ExceptionState& es)
 {
     if (!range) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return String();
     }
 
     return range->text();
 }
 
-PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestClickableNode(long x, long y, long width, long height, Document* document, ExceptionCode& ec)
+PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestClickableNode(long x, long y, long width, long height, Document* document, ExceptionState& es)
 {
     if (!document || !document->frame()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -1152,10 +1153,10 @@
     return 0;
 }
 
-Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width, long height, Document* document, ExceptionCode& ec)
+Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width, long height, Document* document, ExceptionState& es)
 {
     if (!document || !document->frame()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -1170,10 +1171,10 @@
     return targetNode;
 }
 
-PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document* document, ExceptionCode& ec)
+PassRefPtr<DOMPoint> Internals::touchPositionAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document* document, ExceptionState& es)
 {
     if (!document || !document->frame()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -1192,10 +1193,10 @@
     return DOMPoint::create(x, y);
 }
 
-Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document* document, ExceptionCode& ec)
+Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document* document, ExceptionState& es)
 {
     if (!document || !document->frame()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -1210,10 +1211,10 @@
     return targetNode;
 }
 
-PassRefPtr<ClientRect> Internals::bestZoomableAreaForTouchPoint(long x, long y, long width, long height, Document* document, ExceptionCode& ec)
+PassRefPtr<ClientRect> Internals::bestZoomableAreaForTouchPoint(long x, long y, long width, long height, Document* document, ExceptionState& es)
 {
     if (!document || !document->frame()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -1232,24 +1233,24 @@
 }
 
 
-int Internals::lastSpellCheckRequestSequence(Document* document, ExceptionCode& ec)
+int Internals::lastSpellCheckRequestSequence(Document* document, ExceptionState& es)
 {
     SpellChecker* checker = spellchecker(document);
 
     if (!checker) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return -1;
     }
 
     return checker->lastRequestSequence();
 }
 
-int Internals::lastSpellCheckProcessedSequence(Document* document, ExceptionCode& ec)
+int Internals::lastSpellCheckProcessedSequence(Document* document, ExceptionState& es)
 {
     SpellChecker* checker = spellchecker(document);
 
     if (!checker) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return -1;
     }
 
@@ -1266,20 +1267,20 @@
     WebCore::overrideUserPreferredLanguages(languages);
 }
 
-unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionCode& ec)
+unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionState& es)
 {
     if (!document) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
     return document->wheelEventHandlerCount();
 }
 
-unsigned Internals::touchEventHandlerCount(Document* document, ExceptionCode& ec)
+unsigned Internals::touchEventHandlerCount(Document* document, ExceptionState& es)
 {
     if (!document) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -1293,10 +1294,10 @@
     return count;
 }
 
-LayerRectList* Internals::touchEventTargetLayerRects(Document* document, ExceptionCode& ec)
+LayerRectList* Internals::touchEventTargetLayerRects(Document* document, ExceptionState& es)
 {
     if (!document || !document->view() || !document->page() || document != contextDocument()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -1306,10 +1307,10 @@
     return m_currentTouchEventRects.get();
 }
 
-unsigned Internals::touchEventTargetLayerRectsUpdateCount(Document* document, ExceptionCode& ec)
+unsigned Internals::touchEventTargetLayerRectsUpdateCount(Document* document, ExceptionState& es)
 {
     if (!document || !document->view() || !document->page() || document != contextDocument()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -1338,10 +1339,10 @@
 }
 
 PassRefPtr<NodeList> Internals::nodesFromRect(Document* document, int centerX, int centerY, unsigned topPadding, unsigned rightPadding,
-    unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent, ExceptionCode& ec) const
+    unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent, ExceptionState& es) const
 {
     if (!document || !document->frame() || !document->frame()->view()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -1399,7 +1400,7 @@
     inspectorController->didCancelFrame();
 }
 
-bool Internals::hasSpellingMarker(Document* document, int from, int length, ExceptionCode&)
+bool Internals::hasSpellingMarker(Document* document, int from, int length, ExceptionState&)
 {
     if (!document || !document->frame())
         return 0;
@@ -1407,7 +1408,7 @@
     return document->frame()->editor()->selectionStartHasMarkerFor(DocumentMarker::Spelling, from, length);
 }
 
-void Internals::setContinuousSpellCheckingEnabled(bool enabled, ExceptionCode&)
+void Internals::setContinuousSpellCheckingEnabled(bool enabled, ExceptionState&)
 {
     if (!contextDocument() || !contextDocument()->frame() || !contextDocument()->frame()->editor())
         return;
@@ -1416,7 +1417,7 @@
         contextDocument()->frame()->editor()->toggleContinuousSpellChecking();
 }
 
-bool Internals::isOverwriteModeEnabled(Document* document, ExceptionCode&)
+bool Internals::isOverwriteModeEnabled(Document* document, ExceptionState&)
 {
     if (!document || !document->frame())
         return 0;
@@ -1424,7 +1425,7 @@
     return document->frame()->editor()->isOverwriteModeEnabled();
 }
 
-void Internals::toggleOverwriteModeEnabled(Document* document, ExceptionCode&)
+void Internals::toggleOverwriteModeEnabled(Document* document, ExceptionState&)
 {
     if (!document || !document->frame())
         return;
@@ -1506,17 +1507,17 @@
     return result;
 }
 
-void Internals::setInspectorResourcesDataSizeLimits(int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode& ec)
+void Internals::setInspectorResourcesDataSizeLimits(int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionState& es)
 {
     Page* page = contextDocument()->frame()->page();
     if (!page || !page->inspectorController()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
     page->inspectorController()->setResourcesDataSizeLimitsFromInternals(maximumResourcesContentSize, maximumSingleResourceContentSize);
 }
 
-bool Internals::hasGrammarMarker(Document* document, int from, int length, ExceptionCode&)
+bool Internals::hasGrammarMarker(Document* document, int from, int length, ExceptionState&)
 {
     if (!document || !document->frame())
         return 0;
@@ -1524,7 +1525,7 @@
     return document->frame()->editor()->selectionStartHasMarkerFor(DocumentMarker::Grammar, from, length);
 }
 
-unsigned Internals::numberOfScrollableAreas(Document* document, ExceptionCode&)
+unsigned Internals::numberOfScrollableAreas(Document* document, ExceptionState&)
 {
     unsigned count = 0;
     Frame* frame = document->frame();
@@ -1539,30 +1540,30 @@
     return count;
 }
 
-bool Internals::isPageBoxVisible(Document* document, int pageNumber, ExceptionCode& ec)
+bool Internals::isPageBoxVisible(Document* document, int pageNumber, ExceptionState& es)
 {
     if (!document) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return false;
     }
 
     return document->isPageBoxVisible(pageNumber);
 }
 
-String Internals::layerTreeAsText(Document* document, ExceptionCode& ec) const
+String Internals::layerTreeAsText(Document* document, ExceptionState& es) const
 {
-    return layerTreeAsText(document, 0, ec);
+    return layerTreeAsText(document, 0, es);
 }
 
-String Internals::elementLayerTreeAsText(Element* element, ExceptionCode& ec) const
+String Internals::elementLayerTreeAsText(Element* element, ExceptionState& es) const
 {
-    return elementLayerTreeAsText(element, 0, ec);
+    return elementLayerTreeAsText(element, 0, es);
 }
 
-static PassRefPtr<NodeList> paintOrderList(Element* element, ExceptionCode& ec, RenderLayer::PaintOrderListType type)
+static PassRefPtr<NodeList> paintOrderList(Element* element, ExceptionState& es, RenderLayer::PaintOrderListType type)
 {
     if (!element) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -1570,13 +1571,13 @@
 
     RenderObject* renderer = element->renderer();
     if (!renderer || !renderer->isBox()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
     RenderLayer* layer = toRenderBox(renderer)->layer();
     if (!layer) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -1585,30 +1586,30 @@
     return StaticNodeList::adopt(nodes);
 }
 
-PassRefPtr<NodeList> Internals::paintOrderListBeforePromote(Element* element, ExceptionCode& ec)
+PassRefPtr<NodeList> Internals::paintOrderListBeforePromote(Element* element, ExceptionState& es)
 {
-    return paintOrderList(element, ec, RenderLayer::BeforePromote);
+    return paintOrderList(element, es, RenderLayer::BeforePromote);
 }
 
-PassRefPtr<NodeList> Internals::paintOrderListAfterPromote(Element* element, ExceptionCode& ec)
+PassRefPtr<NodeList> Internals::paintOrderListAfterPromote(Element* element, ExceptionState& es)
 {
-    return paintOrderList(element, ec, RenderLayer::AfterPromote);
+    return paintOrderList(element, es, RenderLayer::AfterPromote);
 }
 
-String Internals::layerTreeAsText(Document* document, unsigned flags, ExceptionCode& ec) const
+String Internals::layerTreeAsText(Document* document, unsigned flags, ExceptionState& es) const
 {
     if (!document || !document->frame()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return String();
     }
 
     return document->frame()->layerTreeAsText(flags);
 }
 
-String Internals::elementLayerTreeAsText(Element* element, unsigned flags, ExceptionCode& ec) const
+String Internals::elementLayerTreeAsText(Element* element, unsigned flags, ExceptionState& es) const
 {
     if (!element) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return String();
     }
 
@@ -1616,7 +1617,7 @@
 
     RenderObject* renderer = element->renderer();
     if (!renderer || !renderer->isBox()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return String();
     }
 
@@ -1631,10 +1632,10 @@
     return layer->backing()->graphicsLayer()->layerTreeAsText(flags);
 }
 
-void Internals::setNeedsCompositedScrolling(Element* element, unsigned needsCompositedScrolling, ExceptionCode& ec)
+void Internals::setNeedsCompositedScrolling(Element* element, unsigned needsCompositedScrolling, ExceptionState& es)
 {
     if (!element) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
 
@@ -1642,38 +1643,38 @@
 
     RenderObject* renderer = element->renderer();
     if (!renderer || !renderer->isBox()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
 
     RenderLayer* layer = toRenderBox(renderer)->layer();
     if (!layer) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
 
     layer->setForceNeedsCompositedScrolling(static_cast<RenderLayer::ForceNeedsCompositedScrollingMode>(needsCompositedScrolling));
 }
 
-String Internals::repaintRectsAsText(Document* document, ExceptionCode& ec) const
+String Internals::repaintRectsAsText(Document* document, ExceptionState& es) const
 {
     if (!document || !document->frame()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return String();
     }
 
     return document->frame()->trackedRepaintRectsAsText();
 }
 
-String Internals::scrollingStateTreeAsText(Document* document, ExceptionCode& ec) const
+String Internals::scrollingStateTreeAsText(Document* document, ExceptionState& es) const
 {
     return String();
 }
 
-String Internals::mainThreadScrollingReasons(Document* document, ExceptionCode& ec) const
+String Internals::mainThreadScrollingReasons(Document* document, ExceptionState& es) const
 {
     if (!document || !document->frame()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return String();
     }
 
@@ -1684,10 +1685,10 @@
     return page->mainThreadScrollingReasonsAsText();
 }
 
-PassRefPtr<ClientRectList> Internals::nonFastScrollableRects(Document* document, ExceptionCode& ec) const
+PassRefPtr<ClientRectList> Internals::nonFastScrollableRects(Document* document, ExceptionState& es) const
 {
     if (!document || !document->frame()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
@@ -1698,10 +1699,10 @@
     return page->nonFastScrollableRects(document->frame());
 }
 
-void Internals::garbageCollectDocumentResources(Document* document, ExceptionCode& ec) const
+void Internals::garbageCollectDocumentResources(Document* document, ExceptionState& es) const
 {
     if (!document) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
 
@@ -1783,52 +1784,52 @@
     return PrintContext::numberOfPages(frame(), FloatSize(pageWidth, pageHeight));
 }
 
-String Internals::pageProperty(String propertyName, int pageNumber, ExceptionCode& ec) const
+String Internals::pageProperty(String propertyName, int pageNumber, ExceptionState& es) const
 {
     if (!frame()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return String();
     }
 
     return PrintContext::pageProperty(frame(), propertyName.utf8().data(), pageNumber);
 }
 
-String Internals::pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft, ExceptionCode& ec) const
+String Internals::pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft, ExceptionState& es) const
 {
     if (!frame()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return String();
     }
 
     return PrintContext::pageSizeAndMarginsInPixels(frame(), pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft);
 }
 
-void Internals::setDeviceScaleFactor(float scaleFactor, ExceptionCode& ec)
+void Internals::setDeviceScaleFactor(float scaleFactor, ExceptionState& es)
 {
     Document* document = contextDocument();
     if (!document || !document->page()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
     Page* page = document->page();
     page->setDeviceScaleFactor(scaleFactor);
 }
 
-void Internals::setPageScaleFactor(float scaleFactor, int x, int y, ExceptionCode& ec)
+void Internals::setPageScaleFactor(float scaleFactor, int x, int y, ExceptionState& es)
 {
     Document* document = contextDocument();
     if (!document || !document->page()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
     Page* page = document->page();
     page->setPageScaleFactor(scaleFactor, IntPoint(x, y));
 }
 
-void Internals::setIsCursorVisible(Document* document, bool isVisible, ExceptionCode& ec)
+void Internals::setIsCursorVisible(Document* document, bool isVisible, ExceptionState& es)
 {
     if (!document || !document->page()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
     document->page()->setIsCursorVisible(isVisible);
@@ -1888,10 +1889,10 @@
     return FormController::getReferencedFilePaths(frame()->loader()->history()->currentItem()->documentState());
 }
 
-void Internals::startTrackingRepaints(Document* document, ExceptionCode& ec)
+void Internals::startTrackingRepaints(Document* document, ExceptionState& es)
 {
     if (!document || !document->view()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
 
@@ -1899,10 +1900,10 @@
     frameView->setTracksRepaints(true);
 }
 
-void Internals::stopTrackingRepaints(Document* document, ExceptionCode& ec)
+void Internals::stopTrackingRepaints(Document* document, ExceptionState& es)
 {
     if (!document || !document->view()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
 
@@ -1963,10 +1964,10 @@
     return "UNKNOWN";
 }
 
-String Internals::getCurrentCursorInfo(Document* document, ExceptionCode& ec)
+String Internals::getCurrentCursorInfo(Document* document, ExceptionState& es)
 {
     if (!document || !document->frame()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return String();
     }
 
@@ -2019,39 +2020,39 @@
     frame()->loader()->reload(endToEnd ? EndToEndReload : NormalReload);
 }
 
-PassRefPtr<ClientRect> Internals::selectionBounds(ExceptionCode& ec)
+PassRefPtr<ClientRect> Internals::selectionBounds(ExceptionState& es)
 {
     Document* document = contextDocument();
     if (!document || !document->frame() || !document->frame()->selection()) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return 0;
     }
 
     return ClientRect::create(document->frame()->selection()->bounds());
 }
 
-String Internals::markerTextForListItem(Element* element, ExceptionCode& ec)
+String Internals::markerTextForListItem(Element* element, ExceptionState& es)
 {
     if (!element) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return String();
     }
     return WebCore::markerTextForListItem(element);
 }
 
-String Internals::getImageSourceURL(Element* element, ExceptionCode& ec)
+String Internals::getImageSourceURL(Element* element, ExceptionState& es)
 {
     if (!element) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return String();
     }
     return element->imageSourceURL();
 }
 
-String Internals::baseURL(Document* document, ExceptionCode& ec)
+String Internals::baseURL(Document* document, ExceptionState& es)
 {
     if (!document) {
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return String();
     }
 
diff --git a/Source/core/testing/Internals.h b/Source/core/testing/Internals.h
index 3b602a0..c9fdf12 100644
--- a/Source/core/testing/Internals.h
+++ b/Source/core/testing/Internals.h
@@ -27,10 +27,10 @@
 #ifndef Internals_h
 #define Internals_h
 
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "bindings/v8/ScriptValue.h"
 #include "core/css/CSSComputedStyleDeclaration.h"
 #include "core/dom/ContextLifecycleObserver.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/NodeList.h"
 #include "core/page/scrolling/ScrollingCoordinator.h"
 #include <wtf/ArrayBuffer.h>
@@ -48,25 +48,24 @@
 class Document;
 class DocumentMarker;
 class Element;
+class ExceptionState;
 class Frame;
 class GCObservation;
 class InspectorFrontendChannelDummy;
-class InternalRuntimeFlags;
 class InternalProfilers;
+class InternalRuntimeFlags;
 class InternalSettings;
 class LayerRectList;
+class MallocStatistics;
 class Node;
 class Page;
 class PagePopupController;
 class Range;
 class ScriptExecutionContext;
-class ShadowRoot;
-class MallocStatistics;
 class SerializedScriptValue;
+class ShadowRoot;
 class TypeConversions;
 
-typedef int ExceptionCode;
-
 class Internals : public RefCounted<Internals>
     , public ContextLifecycleObserver
     , public ScrollingCoordinator::TouchEventTargetRectsObserver {
@@ -76,7 +75,7 @@
 
     static void resetToConsistentState(Page*);
 
-    String elementRenderTreeAsText(Element*, ExceptionCode&);
+    String elementRenderTreeAsText(Element*, ExceptionState&);
 
     String address(Node*);
 
@@ -87,123 +86,123 @@
 
     void crash();
 
-    size_t numberOfScopedHTMLStyleChildren(const Node*, ExceptionCode&) const;
-    PassRefPtr<CSSComputedStyleDeclaration> computedStyleIncludingVisitedInfo(Node*, ExceptionCode&) const;
+    size_t numberOfScopedHTMLStyleChildren(const Node*, ExceptionState&) const;
+    PassRefPtr<CSSComputedStyleDeclaration> computedStyleIncludingVisitedInfo(Node*, ExceptionState&) const;
 
-    ShadowRoot* ensureShadowRoot(Element* host, ExceptionCode&);
-    ShadowRoot* shadowRoot(Element* host, ExceptionCode&);
-    ShadowRoot* youngestShadowRoot(Element* host, ExceptionCode&);
-    ShadowRoot* oldestShadowRoot(Element* host, ExceptionCode&);
-    ShadowRoot* youngerShadowRoot(Node* shadow, ExceptionCode&);
-    ShadowRoot* olderShadowRoot(Node* shadow, ExceptionCode&);
-    String shadowRootType(const Node*, ExceptionCode&) const;
-    bool hasShadowInsertionPoint(const Node*, ExceptionCode&) const;
-    bool hasContentElement(const Node*, ExceptionCode&) const;
-    size_t countElementShadow(const Node*, ExceptionCode&) const;
-    Element* includerFor(Node*, ExceptionCode&);
-    String shadowPseudoId(Element*, ExceptionCode&);
-    void setShadowPseudoId(Element*, const String&, ExceptionCode&);
+    ShadowRoot* ensureShadowRoot(Element* host, ExceptionState&);
+    ShadowRoot* shadowRoot(Element* host, ExceptionState&);
+    ShadowRoot* youngestShadowRoot(Element* host, ExceptionState&);
+    ShadowRoot* oldestShadowRoot(Element* host, ExceptionState&);
+    ShadowRoot* youngerShadowRoot(Node* shadow, ExceptionState&);
+    ShadowRoot* olderShadowRoot(Node* shadow, ExceptionState&);
+    String shadowRootType(const Node*, ExceptionState&) const;
+    bool hasShadowInsertionPoint(const Node*, ExceptionState&) const;
+    bool hasContentElement(const Node*, ExceptionState&) const;
+    size_t countElementShadow(const Node*, ExceptionState&) const;
+    Element* includerFor(Node*, ExceptionState&);
+    String shadowPseudoId(Element*, ExceptionState&);
+    void setShadowPseudoId(Element*, const String&, ExceptionState&);
 
     // CSS Animation / Transition testing.
     unsigned numberOfActiveAnimations() const;
-    void suspendAnimations(Document*, ExceptionCode&) const;
-    void resumeAnimations(Document*, ExceptionCode&) const;
-    void pauseAnimations(double pauseTime, ExceptionCode&);
+    void suspendAnimations(Document*, ExceptionState&) const;
+    void resumeAnimations(Document*, ExceptionState&) const;
+    void pauseAnimations(double pauseTime, ExceptionState&);
 
-    PassRefPtr<Element> createContentElement(ExceptionCode&);
-    bool isValidContentSelect(Element* insertionPoint, ExceptionCode&);
-    Node* treeScopeRootNode(Node*, ExceptionCode&);
-    Node* parentTreeScope(Node*, ExceptionCode&);
-    bool hasSelectorForIdInShadow(Element* host, const String& idValue, ExceptionCode&);
-    bool hasSelectorForClassInShadow(Element* host, const String& className, ExceptionCode&);
-    bool hasSelectorForAttributeInShadow(Element* host, const String& attributeName, ExceptionCode&);
-    bool hasSelectorForPseudoClassInShadow(Element* host, const String& pseudoClass, ExceptionCode&);
-    unsigned short compareTreeScopePosition(const Node*, const Node*, ExceptionCode&) const;
+    PassRefPtr<Element> createContentElement(ExceptionState&);
+    bool isValidContentSelect(Element* insertionPoint, ExceptionState&);
+    Node* treeScopeRootNode(Node*, ExceptionState&);
+    Node* parentTreeScope(Node*, ExceptionState&);
+    bool hasSelectorForIdInShadow(Element* host, const String& idValue, ExceptionState&);
+    bool hasSelectorForClassInShadow(Element* host, const String& className, ExceptionState&);
+    bool hasSelectorForAttributeInShadow(Element* host, const String& attributeName, ExceptionState&);
+    bool hasSelectorForPseudoClassInShadow(Element* host, const String& pseudoClass, ExceptionState&);
+    unsigned short compareTreeScopePosition(const Node*, const Node*, ExceptionState&) const;
 
-    bool attached(Node*, ExceptionCode&);
+    bool attached(Node*, ExceptionState&);
 
     // FIXME: Rename these functions if walker is prefered.
-    Node* nextSiblingByWalker(Node*, ExceptionCode&);
-    Node* firstChildByWalker(Node*, ExceptionCode&);
-    Node* lastChildByWalker(Node*, ExceptionCode&);
-    Node* nextNodeByWalker(Node*, ExceptionCode&);
-    Node* previousNodeByWalker(Node*, ExceptionCode&);
+    Node* nextSiblingByWalker(Node*, ExceptionState&);
+    Node* firstChildByWalker(Node*, ExceptionState&);
+    Node* lastChildByWalker(Node*, ExceptionState&);
+    Node* nextNodeByWalker(Node*, ExceptionState&);
+    Node* previousNodeByWalker(Node*, ExceptionState&);
 
     String visiblePlaceholder(Element*);
     void selectColorInColorChooser(Element*, const String& colorValue);
-    Vector<String> formControlStateOfPreviousHistoryItem(ExceptionCode&);
-    void setFormControlStateOfPreviousHistoryItem(const Vector<String>&, ExceptionCode&);
-    void setEnableMockPagePopup(bool, ExceptionCode&);
+    Vector<String> formControlStateOfPreviousHistoryItem(ExceptionState&);
+    void setFormControlStateOfPreviousHistoryItem(const Vector<String>&, ExceptionState&);
+    void setEnableMockPagePopup(bool, ExceptionState&);
     PassRefPtr<PagePopupController> pagePopupController();
 
-    PassRefPtr<ClientRect> unscaledViewportRect(ExceptionCode&);
+    PassRefPtr<ClientRect> unscaledViewportRect(ExceptionState&);
 
-    PassRefPtr<ClientRect> absoluteCaretBounds(ExceptionCode&);
+    PassRefPtr<ClientRect> absoluteCaretBounds(ExceptionState&);
 
-    PassRefPtr<ClientRect> boundingBox(Element*, ExceptionCode&);
+    PassRefPtr<ClientRect> boundingBox(Element*, ExceptionState&);
 
-    PassRefPtr<ClientRectList> inspectorHighlightRects(Document*, ExceptionCode&);
+    PassRefPtr<ClientRectList> inspectorHighlightRects(Document*, ExceptionState&);
 
-    unsigned markerCountForNode(Node*, const String&, ExceptionCode&);
-    PassRefPtr<Range> markerRangeForNode(Node*, const String& markerType, unsigned index, ExceptionCode&);
-    String markerDescriptionForNode(Node*, const String& markerType, unsigned index, ExceptionCode&);
+    unsigned markerCountForNode(Node*, const String&, ExceptionState&);
+    PassRefPtr<Range> markerRangeForNode(Node*, const String& markerType, unsigned index, ExceptionState&);
+    String markerDescriptionForNode(Node*, const String& markerType, unsigned index, ExceptionState&);
     void addTextMatchMarker(const Range*, bool isActive);
 
-    void setScrollViewPosition(Document*, long x, long y, ExceptionCode&);
-    void setPagination(Document* document, const String& mode, int gap, ExceptionCode& ec) { setPagination(document, mode, gap, 0, ec); }
-    void setPagination(Document*, const String& mode, int gap, int pageLength, ExceptionCode&);
-    String configurationForViewport(Document*, float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode&);
+    void setScrollViewPosition(Document*, long x, long y, ExceptionState&);
+    void setPagination(Document* document, const String& mode, int gap, ExceptionState& ec) { setPagination(document, mode, gap, 0, ec); }
+    void setPagination(Document*, const String& mode, int gap, int pageLength, ExceptionState&);
+    String configurationForViewport(Document*, float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionState&);
 
-    bool wasLastChangeUserEdit(Element* textField, ExceptionCode&);
-    bool elementShouldAutoComplete(Element* inputElement, ExceptionCode&);
-    String suggestedValue(Element* inputElement, ExceptionCode&);
-    void setSuggestedValue(Element* inputElement, const String&, ExceptionCode&);
-    void setEditingValue(Element* inputElement, const String&, ExceptionCode&);
-    void setAutofilled(Element*, bool enabled, ExceptionCode&);
-    void scrollElementToRect(Element*, long x, long y, long w, long h, ExceptionCode&);
+    bool wasLastChangeUserEdit(Element* textField, ExceptionState&);
+    bool elementShouldAutoComplete(Element* inputElement, ExceptionState&);
+    String suggestedValue(Element* inputElement, ExceptionState&);
+    void setSuggestedValue(Element* inputElement, const String&, ExceptionState&);
+    void setEditingValue(Element* inputElement, const String&, ExceptionState&);
+    void setAutofilled(Element*, bool enabled, ExceptionState&);
+    void scrollElementToRect(Element*, long x, long y, long w, long h, ExceptionState&);
 
-    void paintControlTints(Document*, ExceptionCode&);
+    void paintControlTints(Document*, ExceptionState&);
 
-    PassRefPtr<Range> rangeFromLocationAndLength(Element* scope, int rangeLocation, int rangeLength, ExceptionCode&);
-    unsigned locationFromRange(Element* scope, const Range*, ExceptionCode&);
-    unsigned lengthFromRange(Element* scope, const Range*, ExceptionCode&);
-    String rangeAsText(const Range*, ExceptionCode&);
+    PassRefPtr<Range> rangeFromLocationAndLength(Element* scope, int rangeLocation, int rangeLength, ExceptionState&);
+    unsigned locationFromRange(Element* scope, const Range*, ExceptionState&);
+    unsigned lengthFromRange(Element* scope, const Range*, ExceptionState&);
+    String rangeAsText(const Range*, ExceptionState&);
 
-    PassRefPtr<DOMPoint> touchPositionAdjustedToBestClickableNode(long x, long y, long width, long height, Document*, ExceptionCode&);
-    Node* touchNodeAdjustedToBestClickableNode(long x, long y, long width, long height, Document*, ExceptionCode&);
-    PassRefPtr<DOMPoint> touchPositionAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document*, ExceptionCode&);
-    Node* touchNodeAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document*, ExceptionCode&);
-    PassRefPtr<ClientRect> bestZoomableAreaForTouchPoint(long x, long y, long width, long height, Document*, ExceptionCode&);
+    PassRefPtr<DOMPoint> touchPositionAdjustedToBestClickableNode(long x, long y, long width, long height, Document*, ExceptionState&);
+    Node* touchNodeAdjustedToBestClickableNode(long x, long y, long width, long height, Document*, ExceptionState&);
+    PassRefPtr<DOMPoint> touchPositionAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document*, ExceptionState&);
+    Node* touchNodeAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document*, ExceptionState&);
+    PassRefPtr<ClientRect> bestZoomableAreaForTouchPoint(long x, long y, long width, long height, Document*, ExceptionState&);
 
-    int lastSpellCheckRequestSequence(Document*, ExceptionCode&);
-    int lastSpellCheckProcessedSequence(Document*, ExceptionCode&);
+    int lastSpellCheckRequestSequence(Document*, ExceptionState&);
+    int lastSpellCheckProcessedSequence(Document*, ExceptionState&);
 
     Vector<String> userPreferredLanguages() const;
     void setUserPreferredLanguages(const Vector<String>&);
 
-    unsigned wheelEventHandlerCount(Document*, ExceptionCode&);
-    unsigned touchEventHandlerCount(Document*, ExceptionCode&);
-    LayerRectList* touchEventTargetLayerRects(Document*, ExceptionCode&);
-    unsigned touchEventTargetLayerRectsUpdateCount(Document*, ExceptionCode&);
+    unsigned wheelEventHandlerCount(Document*, ExceptionState&);
+    unsigned touchEventHandlerCount(Document*, ExceptionState&);
+    LayerRectList* touchEventTargetLayerRects(Document*, ExceptionState&);
+    unsigned touchEventTargetLayerRectsUpdateCount(Document*, ExceptionState&);
     virtual void touchEventTargetRectsChanged(const LayerHitTestRects&);
 
     // This is used to test rect based hit testing like what's done on touch screens.
     PassRefPtr<NodeList> nodesFromRect(Document*, int x, int y, unsigned topPadding, unsigned rightPadding,
-        unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent, ExceptionCode&) const;
+        unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent, ExceptionState&) const;
 
     void emitInspectorDidBeginFrame();
     void emitInspectorDidCancelFrame();
 
-    bool hasSpellingMarker(Document*, int from, int length, ExceptionCode&);
-    bool hasGrammarMarker(Document*, int from, int length, ExceptionCode&);
-    void setContinuousSpellCheckingEnabled(bool enabled, ExceptionCode&);
+    bool hasSpellingMarker(Document*, int from, int length, ExceptionState&);
+    bool hasGrammarMarker(Document*, int from, int length, ExceptionState&);
+    void setContinuousSpellCheckingEnabled(bool enabled, ExceptionState&);
 
-    bool isOverwriteModeEnabled(Document*, ExceptionCode&);
-    void toggleOverwriteModeEnabled(Document*, ExceptionCode&);
+    bool isOverwriteModeEnabled(Document*, ExceptionState&);
+    void toggleOverwriteModeEnabled(Document*, ExceptionState&);
 
-    unsigned numberOfScrollableAreas(Document*, ExceptionCode&);
+    unsigned numberOfScrollableAreas(Document*, ExceptionState&);
 
-    bool isPageBoxVisible(Document*, int pageNumber, ExceptionCode&);
+    bool isPageBoxVisible(Document*, int pageNumber, ExceptionState&);
 
     static const char* internalsId;
 
@@ -212,24 +211,24 @@
     InternalProfilers* profilers();
     unsigned workerThreadCount() const;
 
-    void setDeviceProximity(Document*, const String& eventType, double value, double min, double max, ExceptionCode&);
+    void setDeviceProximity(Document*, const String& eventType, double value, double min, double max, ExceptionState&);
 
-    String layerTreeAsText(Document*, unsigned flags, ExceptionCode&) const;
-    String layerTreeAsText(Document*, ExceptionCode&) const;
-    String elementLayerTreeAsText(Element*, unsigned flags, ExceptionCode&) const;
-    String elementLayerTreeAsText(Element*, ExceptionCode&) const;
+    String layerTreeAsText(Document*, unsigned flags, ExceptionState&) const;
+    String layerTreeAsText(Document*, ExceptionState&) const;
+    String elementLayerTreeAsText(Element*, unsigned flags, ExceptionState&) const;
+    String elementLayerTreeAsText(Element*, ExceptionState&) const;
 
-    PassRefPtr<NodeList> paintOrderListBeforePromote(Element*, ExceptionCode&);
-    PassRefPtr<NodeList> paintOrderListAfterPromote(Element*, ExceptionCode&);
+    PassRefPtr<NodeList> paintOrderListBeforePromote(Element*, ExceptionState&);
+    PassRefPtr<NodeList> paintOrderListAfterPromote(Element*, ExceptionState&);
 
-    void setNeedsCompositedScrolling(Element*, unsigned value, ExceptionCode&);
+    void setNeedsCompositedScrolling(Element*, unsigned value, ExceptionState&);
 
-    String repaintRectsAsText(Document*, ExceptionCode&) const;
-    String scrollingStateTreeAsText(Document*, ExceptionCode&) const;
-    String mainThreadScrollingReasons(Document*, ExceptionCode&) const;
-    PassRefPtr<ClientRectList> nonFastScrollableRects(Document*, ExceptionCode&) const;
+    String repaintRectsAsText(Document*, ExceptionState&) const;
+    String scrollingStateTreeAsText(Document*, ExceptionState&) const;
+    String mainThreadScrollingReasons(Document*, ExceptionState&) const;
+    PassRefPtr<ClientRectList> nonFastScrollableRects(Document*, ExceptionState&) const;
 
-    void garbageCollectDocumentResources(Document*, ExceptionCode&) const;
+    void garbageCollectDocumentResources(Document*, ExceptionState&) const;
     void evictAllResources() const;
 
     void allowRoundingHacks() const;
@@ -243,7 +242,7 @@
     PassRefPtr<DOMWindow> openDummyInspectorFrontend(const String& url);
     void closeDummyInspectorFrontend();
     Vector<unsigned long> setMemoryCacheCapacities(unsigned long minDeadBytes, unsigned long maxDeadBytes, unsigned long totalBytes);
-    void setInspectorResourcesDataSizeLimits(int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode&);
+    void setInspectorResourcesDataSizeLimits(int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionState&);
 
     String counterValue(Element*);
 
@@ -252,13 +251,13 @@
     Vector<String> allIconURLs(Document*) const;
 
     int numberOfPages(float pageWidthInPixels = 800, float pageHeightInPixels = 600);
-    String pageProperty(String, int, ExceptionCode& = ASSERT_NO_EXCEPTION) const;
-    String pageSizeAndMarginsInPixels(int, int, int, int, int, int, int, ExceptionCode& = ASSERT_NO_EXCEPTION) const;
+    String pageProperty(String, int, ExceptionState& = ASSERT_NO_EXCEPTION_STATE) const;
+    String pageSizeAndMarginsInPixels(int, int, int, int, int, int, int, ExceptionState& = ASSERT_NO_EXCEPTION_STATE) const;
 
-    void setDeviceScaleFactor(float scaleFactor, ExceptionCode&);
-    void setPageScaleFactor(float scaleFactor, int x, int y, ExceptionCode&);
+    void setDeviceScaleFactor(float scaleFactor, ExceptionState&);
+    void setPageScaleFactor(float scaleFactor, int x, int y, ExceptionState&);
 
-    void setIsCursorVisible(Document*, bool, ExceptionCode&);
+    void setIsCursorVisible(Document*, bool, ExceptionState&);
 
     void webkitWillEnterFullScreenForElement(Document*, Element*);
     void webkitDidEnterFullScreenForElement(Document*, Element*);
@@ -273,28 +272,28 @@
 
     Vector<String> getReferencedFilePaths() const;
 
-    void startTrackingRepaints(Document*, ExceptionCode&);
-    void stopTrackingRepaints(Document*, ExceptionCode&);
+    void startTrackingRepaints(Document*, ExceptionState&);
+    void stopTrackingRepaints(Document*, ExceptionState&);
 
     PassRefPtr<ArrayBuffer> serializeObject(PassRefPtr<SerializedScriptValue>) const;
     PassRefPtr<SerializedScriptValue> deserializeBuffer(PassRefPtr<ArrayBuffer>) const;
 
     void setUsesOverlayScrollbars(bool enabled);
 
-    String getCurrentCursorInfo(Document*, ExceptionCode&);
+    String getCurrentCursorInfo(Document*, ExceptionState&);
 
-    String markerTextForListItem(Element*, ExceptionCode&);
+    String markerTextForListItem(Element*, ExceptionState&);
 
     void forceReload(bool endToEnd);
 
     void enableMockSpeechSynthesizer();
 
-    String getImageSourceURL(Element*, ExceptionCode&);
+    String getImageSourceURL(Element*, ExceptionState&);
 
     bool isSelectPopupVisible(Node*);
 
-    PassRefPtr<ClientRect> selectionBounds(ExceptionCode&);
-    String baseURL(Document*, ExceptionCode&);
+    PassRefPtr<ClientRect> selectionBounds(ExceptionState&);
+    String baseURL(Document*, ExceptionState&);
 
     bool loseSharedGraphicsContext3D();
 
@@ -304,7 +303,7 @@
     Frame* frame() const;
     Vector<String> iconURLs(Document*, int iconTypesMask) const;
 
-    DocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionCode&);
+    DocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionState&);
     RefPtr<DOMWindow> m_frontendWindow;
     OwnPtr<InspectorFrontendChannelDummy> m_frontendChannel;
     RefPtr<InternalRuntimeFlags> m_runtimeFlags;
diff --git a/Source/core/testing/MockPagePopupDriver.cpp b/Source/core/testing/MockPagePopupDriver.cpp
index 23594d6..ffe4b52 100644
--- a/Source/core/testing/MockPagePopupDriver.cpp
+++ b/Source/core/testing/MockPagePopupDriver.cpp
@@ -28,6 +28,7 @@
 
 #include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/html/HTMLIFrameElement.h"
 #include "core/loader/DocumentLoader.h"
 #include "core/loader/DocumentWriter.h"
@@ -67,7 +68,7 @@
     m_iframe->setInlineStyleProperty(CSSPropertyLeft, originBoundsInRootView.x(), CSSPrimitiveValue::CSS_PX, true);
     m_iframe->setInlineStyleProperty(CSSPropertyTop, originBoundsInRootView.maxY(), CSSPrimitiveValue::CSS_PX, true);
     if (document->body())
-        document->body()->appendChild(m_iframe.get(), ASSERT_NO_EXCEPTION, AttachLazily);
+        document->body()->appendChild(m_iframe.get(), ASSERT_NO_EXCEPTION_STATE, AttachLazily);
     Frame* contentFrame = m_iframe->contentFrame();
     DocumentWriter* writer = contentFrame->loader()->activeDocumentLoader()->beginWriting("text/html", "UTF-8");
     const char scriptToSetUpPagePopupController[] = "<script>window.pagePopupController = parent.internals.pagePopupController;</script>";
diff --git a/Source/core/webcore_platform.target.darwin-arm.mk b/Source/core/webcore_platform.target.darwin-arm.mk
index 7493bde..13dd1db 100644
--- a/Source/core/webcore_platform.target.darwin-arm.mk
+++ b/Source/core/webcore_platform.target.darwin-arm.mk
@@ -121,7 +121,6 @@
 	third_party/WebKit/Source/core/platform/chromium/ClipboardMimeTypes.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ClipboardUtilitiesChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/FileSystemChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/FileSystemChromiumLinux.cpp \
 	third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.cpp \
 	third_party/WebKit/Source/core/platform/chromium/GamepadsChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/HistogramSupportChromium.cpp \
diff --git a/Source/core/webcore_platform.target.darwin-mips.mk b/Source/core/webcore_platform.target.darwin-mips.mk
index ace53db..c45c3b4 100644
--- a/Source/core/webcore_platform.target.darwin-mips.mk
+++ b/Source/core/webcore_platform.target.darwin-mips.mk
@@ -121,7 +121,6 @@
 	third_party/WebKit/Source/core/platform/chromium/ClipboardMimeTypes.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ClipboardUtilitiesChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/FileSystemChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/FileSystemChromiumLinux.cpp \
 	third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.cpp \
 	third_party/WebKit/Source/core/platform/chromium/GamepadsChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/HistogramSupportChromium.cpp \
diff --git a/Source/core/webcore_platform.target.darwin-x86.mk b/Source/core/webcore_platform.target.darwin-x86.mk
index 9377569..75ddd31 100644
--- a/Source/core/webcore_platform.target.darwin-x86.mk
+++ b/Source/core/webcore_platform.target.darwin-x86.mk
@@ -121,7 +121,6 @@
 	third_party/WebKit/Source/core/platform/chromium/ClipboardMimeTypes.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ClipboardUtilitiesChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/FileSystemChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/FileSystemChromiumLinux.cpp \
 	third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.cpp \
 	third_party/WebKit/Source/core/platform/chromium/GamepadsChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/HistogramSupportChromium.cpp \
diff --git a/Source/core/webcore_platform.target.linux-arm.mk b/Source/core/webcore_platform.target.linux-arm.mk
index 7493bde..13dd1db 100644
--- a/Source/core/webcore_platform.target.linux-arm.mk
+++ b/Source/core/webcore_platform.target.linux-arm.mk
@@ -121,7 +121,6 @@
 	third_party/WebKit/Source/core/platform/chromium/ClipboardMimeTypes.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ClipboardUtilitiesChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/FileSystemChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/FileSystemChromiumLinux.cpp \
 	third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.cpp \
 	third_party/WebKit/Source/core/platform/chromium/GamepadsChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/HistogramSupportChromium.cpp \
diff --git a/Source/core/webcore_platform.target.linux-mips.mk b/Source/core/webcore_platform.target.linux-mips.mk
index ace53db..c45c3b4 100644
--- a/Source/core/webcore_platform.target.linux-mips.mk
+++ b/Source/core/webcore_platform.target.linux-mips.mk
@@ -121,7 +121,6 @@
 	third_party/WebKit/Source/core/platform/chromium/ClipboardMimeTypes.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ClipboardUtilitiesChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/FileSystemChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/FileSystemChromiumLinux.cpp \
 	third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.cpp \
 	third_party/WebKit/Source/core/platform/chromium/GamepadsChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/HistogramSupportChromium.cpp \
diff --git a/Source/core/webcore_platform.target.linux-x86.mk b/Source/core/webcore_platform.target.linux-x86.mk
index 9377569..75ddd31 100644
--- a/Source/core/webcore_platform.target.linux-x86.mk
+++ b/Source/core/webcore_platform.target.linux-x86.mk
@@ -121,7 +121,6 @@
 	third_party/WebKit/Source/core/platform/chromium/ClipboardMimeTypes.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ClipboardUtilitiesChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/FileSystemChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/FileSystemChromiumLinux.cpp \
 	third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.cpp \
 	third_party/WebKit/Source/core/platform/chromium/GamepadsChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/HistogramSupportChromium.cpp \
diff --git a/Source/core/xml/DocumentXPathEvaluator.cpp b/Source/core/xml/DocumentXPathEvaluator.cpp
index 2fbd529..b5a3e5c 100644
--- a/Source/core/xml/DocumentXPathEvaluator.cpp
+++ b/Source/core/xml/DocumentXPathEvaluator.cpp
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "core/xml/DocumentXPathEvaluator.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ScriptExecutionContext.h"
 #include "core/xml/XPathEvaluator.h"
 #include "core/xml/XPathExpression.h"
@@ -53,12 +54,12 @@
 }
 
 PassRefPtr<XPathExpression> DocumentXPathEvaluator::createExpression(ScriptExecutionContext* context,
-    const String& expression, XPathNSResolver* resolver, ExceptionCode& ec)
+    const String& expression, XPathNSResolver* resolver, ExceptionState& es)
 {
     DocumentXPathEvaluator* suplement = from(context);
     if (!suplement->m_xpathEvaluator)
         suplement->m_xpathEvaluator = XPathEvaluator::create();
-    return suplement->m_xpathEvaluator->createExpression(expression, resolver, ec);
+    return suplement->m_xpathEvaluator->createExpression(expression, resolver, es);
 }
 
 PassRefPtr<XPathNSResolver> DocumentXPathEvaluator::createNSResolver(ScriptExecutionContext* context, Node* nodeResolver)
@@ -71,12 +72,12 @@
 
 PassRefPtr<XPathResult> DocumentXPathEvaluator::evaluate(ScriptExecutionContext* context, const String& expression,
     Node* contextNode, XPathNSResolver* resolver, unsigned short type,
-    XPathResult* result, ExceptionCode& ec)
+    XPathResult* result, ExceptionState& es)
 {
     DocumentXPathEvaluator* suplement = from(context);
     if (!suplement->m_xpathEvaluator)
         suplement->m_xpathEvaluator = XPathEvaluator::create();
-    return suplement->m_xpathEvaluator->evaluate(expression, contextNode, resolver, type, result, ec);
+    return suplement->m_xpathEvaluator->evaluate(expression, contextNode, resolver, type, result, es);
 }
 
 } // namespace WebCore
diff --git a/Source/core/xml/DocumentXPathEvaluator.h b/Source/core/xml/DocumentXPathEvaluator.h
index d0dab29..eda4f2d 100644
--- a/Source/core/xml/DocumentXPathEvaluator.h
+++ b/Source/core/xml/DocumentXPathEvaluator.h
@@ -31,6 +31,7 @@
 
 namespace WebCore {
 
+class ExceptionState;
 class ScriptExecutionContext;
 class XPathExpression;
 class XPathNSResolver;
@@ -43,11 +44,11 @@
     static DocumentXPathEvaluator* from(ScriptExecutionContext*);
 
     static PassRefPtr<XPathExpression> createExpression(ScriptExecutionContext*,
-        const String& expression, XPathNSResolver*, ExceptionCode&);
+        const String& expression, XPathNSResolver*, ExceptionState&);
     static PassRefPtr<XPathNSResolver> createNSResolver(ScriptExecutionContext*, Node* nodeResolver);
     static PassRefPtr<XPathResult> evaluate(ScriptExecutionContext*,
         const String& expression, Node* contextNode, XPathNSResolver*,
-        unsigned short type, XPathResult*, ExceptionCode&);
+        unsigned short type, XPathResult*, ExceptionState&);
 
 private:
     DocumentXPathEvaluator();
diff --git a/Source/core/xml/XMLHttpRequest.cpp b/Source/core/xml/XMLHttpRequest.cpp
index 2c97108..d061fa0 100644
--- a/Source/core/xml/XMLHttpRequest.cpp
+++ b/Source/core/xml/XMLHttpRequest.cpp
@@ -24,12 +24,7 @@
 #include "core/xml/XMLHttpRequest.h"
 
 #include "FetchInitiatorTypeNames.h"
-#include <wtf/ArrayBuffer.h>
-#include <wtf/ArrayBufferView.h>
-#include <wtf/RefCountedLeakCounter.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/text/CString.h>
-#include <wtf/UnusedParam.h>
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ContextFeatures.h"
 #include "core/dom/DOMImplementation.h"
 #include "core/dom/Event.h"
@@ -57,6 +52,12 @@
 #include "core/xml/XMLHttpRequestProgressEvent.h"
 #include "core/xml/XMLHttpRequestUpload.h"
 #include "weborigin/SecurityOrigin.h"
+#include "wtf/ArrayBuffer.h"
+#include "wtf/ArrayBufferView.h"
+#include "wtf/RefCountedLeakCounter.h"
+#include "wtf/StdLibExtras.h"
+#include "wtf/UnusedParam.h"
+#include "wtf/text/CString.h"
 
 namespace WebCore {
 
@@ -211,10 +212,10 @@
     return m_state;
 }
 
-ScriptString XMLHttpRequest::responseText(ExceptionCode& ec)
+ScriptString XMLHttpRequest::responseText(ExceptionState& es)
 {
     if (m_responseTypeCode != ResponseTypeDefault && m_responseTypeCode != ResponseTypeText) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return ScriptString();
     }
     if (m_error || (m_state != LOADING && m_state != DONE))
@@ -222,10 +223,10 @@
     return m_responseText;
 }
 
-Document* XMLHttpRequest::responseXML(ExceptionCode& ec)
+Document* XMLHttpRequest::responseXML(ExceptionState& es)
 {
     if (m_responseTypeCode != ResponseTypeDefault && m_responseTypeCode != ResponseTypeDocument) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
@@ -259,10 +260,10 @@
     return m_responseDocument.get();
 }
 
-Blob* XMLHttpRequest::responseBlob(ExceptionCode& ec)
+Blob* XMLHttpRequest::responseBlob(ExceptionState& es)
 {
     if (m_responseTypeCode != ResponseTypeBlob) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
     // We always return null before DONE.
@@ -294,10 +295,10 @@
     return m_responseBlob.get();
 }
 
-ArrayBuffer* XMLHttpRequest::responseArrayBuffer(ExceptionCode& ec)
+ArrayBuffer* XMLHttpRequest::responseArrayBuffer(ExceptionState& es)
 {
     if (m_responseTypeCode != ResponseTypeArrayBuffer) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
@@ -312,22 +313,22 @@
     return m_responseArrayBuffer.get();
 }
 
-void XMLHttpRequest::setTimeout(unsigned long timeout, ExceptionCode& ec)
+void XMLHttpRequest::setTimeout(unsigned long timeout, ExceptionState& es)
 {
     // FIXME: Need to trigger or update the timeout Timer here, if needed. http://webkit.org/b/98156
     // XHR2 spec, 4.7.3. "This implies that the timeout attribute can be set while fetching is in progress. If that occurs it will still be measured relative to the start of fetching."
     if (scriptExecutionContext()->isDocument() && !m_async) {
         logConsoleError(scriptExecutionContext(), "XMLHttpRequest.timeout cannot be set for synchronous HTTP(S) requests made from the window context.");
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
     m_timeoutMilliseconds = timeout;
 }
 
-void XMLHttpRequest::setResponseType(const String& responseType, ExceptionCode& ec)
+void XMLHttpRequest::setResponseType(const String& responseType, ExceptionState& es)
 {
     if (m_state >= LOADING) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
@@ -337,7 +338,7 @@
     // such as file: and data: still make sense to allow.
     if (!m_async && scriptExecutionContext()->isDocument() && m_url.protocolIsInHTTPFamily()) {
         logConsoleError(scriptExecutionContext(), "XMLHttpRequest.responseType cannot be changed for synchronous HTTP(S) requests made from the window context.");
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return;
     }
 
@@ -406,10 +407,10 @@
     }
 }
 
-void XMLHttpRequest::setWithCredentials(bool value, ExceptionCode& ec)
+void XMLHttpRequest::setWithCredentials(bool value, ExceptionState& es)
 {
     if (m_state > OPENED || m_loader) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
@@ -442,12 +443,12 @@
         && !name.startsWith(staticData->m_secHeaderPrefix, false);
 }
 
-void XMLHttpRequest::open(const String& method, const KURL& url, ExceptionCode& ec)
+void XMLHttpRequest::open(const String& method, const KURL& url, ExceptionState& es)
 {
-    open(method, url, true, ec);
+    open(method, url, true, es);
 }
 
-void XMLHttpRequest::open(const String& method, const KURL& url, bool async, ExceptionCode& ec)
+void XMLHttpRequest::open(const String& method, const KURL& url, bool async, ExceptionState& es)
 {
     internalAbort();
     State previousState = m_state;
@@ -462,25 +463,25 @@
     ASSERT(m_state == UNSENT);
 
     if (!isValidHTTPToken(method)) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return;
     }
 
     if (!isAllowedHTTPMethod(method)) {
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return;
     }
 
     if (!ContentSecurityPolicy::shouldBypassMainWorld(scriptExecutionContext()) && !scriptExecutionContext()->contentSecurityPolicy()->allowConnectToSource(url)) {
         // FIXME: Should this be throwing an exception?
-        ec = SecurityError;
+        es.throwDOMException(SecurityError);
         return;
     }
 
     if (!async && scriptExecutionContext()->isDocument()) {
         if (document()->settings() && !document()->settings()->syncXHRInDocumentsEnabled()) {
             logConsoleError(scriptExecutionContext(), "Synchronous XMLHttpRequests are disabled for this page.");
-            ec = InvalidAccessError;
+            es.throwDOMException(InvalidAccessError);
             return;
         }
 
@@ -490,14 +491,14 @@
         // such as file: and data: still make sense to allow.
         if (url.protocolIsInHTTPFamily() && m_responseTypeCode != ResponseTypeDefault) {
             logConsoleError(scriptExecutionContext(), "Synchronous HTTP(S) requests made from the window context cannot have XMLHttpRequest.responseType set.");
-            ec = InvalidAccessError;
+            es.throwDOMException(InvalidAccessError);
             return;
         }
 
         // Similarly, timeouts are disabled for synchronous requests as well.
         if (m_timeoutMilliseconds > 0) {
             logConsoleError(scriptExecutionContext(), "Synchronous XMLHttpRequests must not have a timeout value set.");
-            ec = InvalidAccessError;
+            es.throwDOMException(InvalidAccessError);
             return;
         }
     }
@@ -518,30 +519,30 @@
         m_state = OPENED;
 }
 
-void XMLHttpRequest::open(const String& method, const KURL& url, bool async, const String& user, ExceptionCode& ec)
+void XMLHttpRequest::open(const String& method, const KURL& url, bool async, const String& user, ExceptionState& es)
 {
     KURL urlWithCredentials(url);
     urlWithCredentials.setUser(user);
 
-    open(method, urlWithCredentials, async, ec);
+    open(method, urlWithCredentials, async, es);
 }
 
-void XMLHttpRequest::open(const String& method, const KURL& url, bool async, const String& user, const String& password, ExceptionCode& ec)
+void XMLHttpRequest::open(const String& method, const KURL& url, bool async, const String& user, const String& password, ExceptionState& es)
 {
     KURL urlWithCredentials(url);
     urlWithCredentials.setUser(user);
     urlWithCredentials.setPass(password);
 
-    open(method, urlWithCredentials, async, ec);
+    open(method, urlWithCredentials, async, es);
 }
 
-bool XMLHttpRequest::initSend(ExceptionCode& ec)
+bool XMLHttpRequest::initSend(ExceptionState& es)
 {
     if (!scriptExecutionContext())
         return false;
 
     if (m_state != OPENED || m_loader) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return false;
     }
 
@@ -549,9 +550,9 @@
     return true;
 }
 
-void XMLHttpRequest::send(ExceptionCode& ec)
+void XMLHttpRequest::send(ExceptionState& es)
 {
-    send(String(), ec);
+    send(String(), es);
 }
 
 bool XMLHttpRequest::areMethodAndURLValidForSend()
@@ -559,11 +560,11 @@
     return m_method != "GET" && m_method != "HEAD" && m_url.protocolIsInHTTPFamily();
 }
 
-void XMLHttpRequest::send(Document* document, ExceptionCode& ec)
+void XMLHttpRequest::send(Document* document, ExceptionState& es)
 {
     ASSERT(document);
 
-    if (!initSend(ec))
+    if (!initSend(es))
         return;
 
     if (areMethodAndURLValidForSend()) {
@@ -583,12 +584,12 @@
             m_requestEntityBody->setAlwaysStream(true);
     }
 
-    createRequest(ec);
+    createRequest(es);
 }
 
-void XMLHttpRequest::send(const String& body, ExceptionCode& ec)
+void XMLHttpRequest::send(const String& body, ExceptionState& es)
 {
-    if (!initSend(ec))
+    if (!initSend(es))
         return;
 
     if (!body.isNull() && areMethodAndURLValidForSend()) {
@@ -605,12 +606,12 @@
             m_requestEntityBody->setAlwaysStream(true);
     }
 
-    createRequest(ec);
+    createRequest(es);
 }
 
-void XMLHttpRequest::send(Blob* body, ExceptionCode& ec)
+void XMLHttpRequest::send(Blob* body, ExceptionState& es)
 {
-    if (!initSend(ec))
+    if (!initSend(es))
         return;
 
     if (areMethodAndURLValidForSend()) {
@@ -633,12 +634,12 @@
             m_requestEntityBody->appendBlob(body->url());
     }
 
-    createRequest(ec);
+    createRequest(es);
 }
 
-void XMLHttpRequest::send(DOMFormData* body, ExceptionCode& ec)
+void XMLHttpRequest::send(DOMFormData* body, ExceptionState& es)
 {
-    if (!initSend(ec))
+    if (!initSend(es))
         return;
 
     if (areMethodAndURLValidForSend()) {
@@ -651,29 +652,29 @@
         }
     }
 
-    createRequest(ec);
+    createRequest(es);
 }
 
-void XMLHttpRequest::send(ArrayBuffer* body, ExceptionCode& ec)
+void XMLHttpRequest::send(ArrayBuffer* body, ExceptionState& es)
 {
     String consoleMessage("ArrayBuffer is deprecated in XMLHttpRequest.send(). Use ArrayBufferView instead.");
     scriptExecutionContext()->addConsoleMessage(JSMessageSource, WarningMessageLevel, consoleMessage);
 
     HistogramSupport::histogramEnumeration("WebCore.XHR.send.ArrayBufferOrView", XMLHttpRequestSendArrayBuffer, XMLHttpRequestSendArrayBufferOrViewMax);
 
-    sendBytesData(body->data(), body->byteLength(), ec);
+    sendBytesData(body->data(), body->byteLength(), es);
 }
 
-void XMLHttpRequest::send(ArrayBufferView* body, ExceptionCode& ec)
+void XMLHttpRequest::send(ArrayBufferView* body, ExceptionState& es)
 {
     HistogramSupport::histogramEnumeration("WebCore.XHR.send.ArrayBufferOrView", XMLHttpRequestSendArrayBufferView, XMLHttpRequestSendArrayBufferOrViewMax);
 
-    sendBytesData(body->baseAddress(), body->byteLength(), ec);
+    sendBytesData(body->baseAddress(), body->byteLength(), es);
 }
 
-void XMLHttpRequest::sendBytesData(const void* data, size_t length, ExceptionCode& ec)
+void XMLHttpRequest::sendBytesData(const void* data, size_t length, ExceptionState& es)
 {
-    if (!initSend(ec))
+    if (!initSend(es))
         return;
 
     if (areMethodAndURLValidForSend()) {
@@ -682,21 +683,21 @@
             m_requestEntityBody->setAlwaysStream(true);
     }
 
-    createRequest(ec);
+    createRequest(es);
 }
 
-void XMLHttpRequest::sendForInspectorXHRReplay(PassRefPtr<FormData> formData, ExceptionCode& ec)
+void XMLHttpRequest::sendForInspectorXHRReplay(PassRefPtr<FormData> formData, ExceptionState& es)
 {
     m_requestEntityBody = formData ? formData->deepCopy() : 0;
-    createRequest(ec);
-    m_exceptionCode = ec;
+    createRequest(es);
+    m_exceptionCode = es;
 }
 
-void XMLHttpRequest::createRequest(ExceptionCode& ec)
+void XMLHttpRequest::createRequest(ExceptionState& es)
 {
     // Only GET request is supported for blob URL.
     if (m_url.protocolIs("blob") && m_method != "GET") {
-        ec = NetworkError;
+        es.throwDOMException(NetworkError);
         return;
     }
 
@@ -772,7 +773,8 @@
 
     if (!m_exceptionCode && m_error)
         m_exceptionCode = NetworkError;
-    ec = m_exceptionCode;
+    if (m_exceptionCode)
+        es.throwDOMException(m_exceptionCode);
 }
 
 void XMLHttpRequest::abort()
@@ -899,15 +901,15 @@
     m_mimeTypeOverride = override;
 }
 
-void XMLHttpRequest::setRequestHeader(const AtomicString& name, const String& value, ExceptionCode& ec)
+void XMLHttpRequest::setRequestHeader(const AtomicString& name, const String& value, ExceptionState& es)
 {
     if (m_state != OPENED || m_loader) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return;
     }
 
     if (!isValidHTTPToken(name) || !isValidHTTPHeaderValue(value)) {
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return;
     }
 
@@ -932,10 +934,10 @@
     return m_requestHeaders.get(name);
 }
 
-String XMLHttpRequest::getAllResponseHeaders(ExceptionCode& ec) const
+String XMLHttpRequest::getAllResponseHeaders(ExceptionState& es) const
 {
     if (m_state < HEADERS_RECEIVED) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return "";
     }
 
@@ -968,10 +970,10 @@
     return stringBuilder.toString();
 }
 
-String XMLHttpRequest::getResponseHeader(const AtomicString& name, ExceptionCode& ec) const
+String XMLHttpRequest::getResponseHeader(const AtomicString& name, ExceptionState& es) const
 {
     if (m_state < HEADERS_RECEIVED) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return String();
     }
 
@@ -1013,7 +1015,7 @@
     return DOMImplementation::isXMLMIMEType(responseMIMEType().lower());
 }
 
-int XMLHttpRequest::status(ExceptionCode& ec) const
+int XMLHttpRequest::status(ExceptionState& es) const
 {
     if (m_response.httpStatusCode())
         return m_response.httpStatusCode();
@@ -1021,20 +1023,20 @@
     if (m_state == OPENED) {
         // Firefox only raises an exception in this state; we match it.
         // Note the case of local file requests, where we have no HTTP response code! Firefox never raises an exception for those, but we match HTTP case for consistency.
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
     }
 
     return 0;
 }
 
-String XMLHttpRequest::statusText(ExceptionCode& ec) const
+String XMLHttpRequest::statusText(ExceptionState& es) const
 {
     if (!m_response.httpStatusText().isNull())
         return m_response.httpStatusText();
 
     if (m_state == OPENED) {
         // See comments in status() above.
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
     }
 
     return String();
diff --git a/Source/core/xml/XMLHttpRequest.h b/Source/core/xml/XMLHttpRequest.h
index 8f3bc2a..fde3a84 100644
--- a/Source/core/xml/XMLHttpRequest.h
+++ b/Source/core/xml/XMLHttpRequest.h
@@ -40,14 +40,17 @@
 namespace WebCore {
 
 class Blob;
-class Document;
 class DOMFormData;
+class Document;
+class ExceptionState;
 class ResourceRequest;
 class SecurityOrigin;
 class SharedBuffer;
 class TextResourceDecoder;
 class ThreadableLoader;
 
+typedef int ExceptionCode;
+
 class XMLHttpRequest : public ScriptWrappable, public RefCounted<XMLHttpRequest>, public EventTarget, private ThreadableLoaderClient, public ActiveDOMObject {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -82,46 +85,46 @@
     virtual ScriptExecutionContext* scriptExecutionContext() const;
 
     const KURL& url() const { return m_url; }
-    String statusText(ExceptionCode&) const;
-    int status(ExceptionCode&) const;
+    String statusText(ExceptionState&) const;
+    int status(ExceptionState&) const;
     State readyState() const;
     bool withCredentials() const { return m_includeCredentials; }
-    void setWithCredentials(bool, ExceptionCode&);
-    void open(const String& method, const KURL&, ExceptionCode&);
-    void open(const String& method, const KURL&, bool async, ExceptionCode&);
-    void open(const String& method, const KURL&, bool async, const String& user, ExceptionCode&);
-    void open(const String& method, const KURL&, bool async, const String& user, const String& password, ExceptionCode&);
-    void send(ExceptionCode&);
-    void send(Document*, ExceptionCode&);
-    void send(const String&, ExceptionCode&);
-    void send(Blob*, ExceptionCode&);
-    void send(DOMFormData*, ExceptionCode&);
-    void send(ArrayBuffer*, ExceptionCode&);
-    void send(ArrayBufferView*, ExceptionCode&);
+    void setWithCredentials(bool, ExceptionState&);
+    void open(const String& method, const KURL&, ExceptionState&);
+    void open(const String& method, const KURL&, bool async, ExceptionState&);
+    void open(const String& method, const KURL&, bool async, const String& user, ExceptionState&);
+    void open(const String& method, const KURL&, bool async, const String& user, const String& password, ExceptionState&);
+    void send(ExceptionState&);
+    void send(Document*, ExceptionState&);
+    void send(const String&, ExceptionState&);
+    void send(Blob*, ExceptionState&);
+    void send(DOMFormData*, ExceptionState&);
+    void send(ArrayBuffer*, ExceptionState&);
+    void send(ArrayBufferView*, ExceptionState&);
     void abort();
-    void setRequestHeader(const AtomicString& name, const String& value, ExceptionCode&);
+    void setRequestHeader(const AtomicString& name, const String& value, ExceptionState&);
     void overrideMimeType(const String& override);
-    String getAllResponseHeaders(ExceptionCode&) const;
-    String getResponseHeader(const AtomicString& name, ExceptionCode&) const;
-    ScriptString responseText(ExceptionCode&);
-    Document* responseXML(ExceptionCode&);
-    Blob* responseBlob(ExceptionCode&);
+    String getAllResponseHeaders(ExceptionState&) const;
+    String getResponseHeader(const AtomicString& name, ExceptionState&) const;
+    ScriptString responseText(ExceptionState&);
+    Document* responseXML(ExceptionState&);
+    Blob* responseBlob(ExceptionState&);
     unsigned long timeout() const { return m_timeoutMilliseconds; }
-    void setTimeout(unsigned long timeout, ExceptionCode&);
+    void setTimeout(unsigned long timeout, ExceptionState&);
 
-    void sendForInspectorXHRReplay(PassRefPtr<FormData>, ExceptionCode&);
+    void sendForInspectorXHRReplay(PassRefPtr<FormData>, ExceptionState&);
 
     // Expose HTTP validation methods for other untrusted requests.
     static bool isAllowedHTTPMethod(const String&);
     static String uppercaseKnownHTTPMethod(const String&);
     static bool isAllowedHTTPHeader(const String&);
 
-    void setResponseType(const String&, ExceptionCode&);
+    void setResponseType(const String&, ExceptionState&);
     String responseType();
     ResponseTypeCode responseTypeCode() const { return m_responseTypeCode; }
 
     // response attribute has custom getter.
-    ArrayBuffer* responseArrayBuffer(ExceptionCode&);
+    ArrayBuffer* responseArrayBuffer(ExceptionState&);
 
     void setLastSendLineNumber(unsigned lineNumber) { m_lastSendLineNumber = lineNumber; }
     void setLastSendURL(const String& url) { m_lastSendURL = url; }
@@ -163,8 +166,8 @@
 
     bool areMethodAndURLValidForSend();
 
-    bool initSend(ExceptionCode&);
-    void sendBytesData(const void*, size_t, ExceptionCode&);
+    bool initSend(ExceptionState&);
+    void sendBytesData(const void*, size_t, ExceptionState&);
 
     String getRequestHeader(const AtomicString& name) const;
     void setRequestHeaderInternal(const AtomicString& name, const String& value);
@@ -178,7 +181,7 @@
     void clearResponseBuffers();
     void clearRequest();
 
-    void createRequest(ExceptionCode&);
+    void createRequest(ExceptionState&);
 
     void genericError();
     void networkError();
diff --git a/Source/core/xml/XMLSerializer.cpp b/Source/core/xml/XMLSerializer.cpp
index ad6305d..ad32db4 100644
--- a/Source/core/xml/XMLSerializer.cpp
+++ b/Source/core/xml/XMLSerializer.cpp
@@ -20,6 +20,7 @@
 #include "config.h"
 #include "core/xml/XMLSerializer.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/Document.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/editing/markup.h"
@@ -27,7 +28,7 @@
 
 namespace WebCore {
 
-String XMLSerializer::serializeToString(Node* node, ExceptionCode& ec)
+String XMLSerializer::serializeToString(Node* node, ExceptionState& es)
 {
     if (!node)
         return String();
@@ -38,7 +39,7 @@
         // with it.  It should be the only type of node where this is possible.
         ASSERT(node->nodeType() == Node::DOCUMENT_TYPE_NODE);
 
-        ec = InvalidAccessError;
+        es.throwDOMException(InvalidAccessError);
         return String();
     }
 
diff --git a/Source/core/xml/XMLSerializer.h b/Source/core/xml/XMLSerializer.h
index fd080ef..53d8c73 100644
--- a/Source/core/xml/XMLSerializer.h
+++ b/Source/core/xml/XMLSerializer.h
@@ -27,15 +27,14 @@
 
 namespace WebCore {
 
-typedef int ExceptionCode;
-
+class ExceptionState;
 class Node;
 
 class XMLSerializer : public RefCounted<XMLSerializer>, public ScriptWrappable {
 public:
     static PassRefPtr<XMLSerializer> create() { return adoptRef(new XMLSerializer); }
 
-    String serializeToString(Node*, ExceptionCode&);
+    String serializeToString(Node*, ExceptionState&);
 
 private:
     XMLSerializer()
diff --git a/Source/core/xml/XMLTreeViewer.cpp b/Source/core/xml/XMLTreeViewer.cpp
index 4c9109b..9b5f5a7 100644
--- a/Source/core/xml/XMLTreeViewer.cpp
+++ b/Source/core/xml/XMLTreeViewer.cpp
@@ -31,11 +31,11 @@
 
 #include "XMLViewerCSS.h"
 #include "XMLViewerJS.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "bindings/v8/ScriptController.h"
 #include "bindings/v8/ScriptSourceCode.h"
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/Text.h"
 #include "core/page/Frame.h"
 
@@ -48,20 +48,6 @@
 {
 }
 
-bool XMLTreeViewer::hasNoStyleInformation() const
-{
-    if (m_document->sawElementsInKnownNamespaces() || m_document->transformSourceDocument())
-        return false;
-
-    if (!m_document->frame() || !m_document->frame()->page())
-        return false;
-
-    if (m_document->frame()->tree()->parent())
-        return false; // This document is not in a top frame
-
-    return true;
-}
-
 void XMLTreeViewer::transformDocumentToTreeView()
 {
     m_document->setIsViewSource(true);
@@ -72,7 +58,7 @@
 
     String cssString(reinterpret_cast<const char*>(XMLViewer_css), sizeof(XMLViewer_css));
     RefPtr<Text> text = m_document->createTextNode(cssString);
-    m_document->getElementById("xml-viewer-style")->appendChild(text, IGNORE_EXCEPTION, AttachLazily);
+    m_document->getElementById("xml-viewer-style")->appendChild(text, IGNORE_EXCEPTION_STATE, AttachLazily);
 }
 
 } // namespace WebCore
diff --git a/Source/core/xml/XMLTreeViewer.h b/Source/core/xml/XMLTreeViewer.h
index 45cdcb1..73d4047 100644
--- a/Source/core/xml/XMLTreeViewer.h
+++ b/Source/core/xml/XMLTreeViewer.h
@@ -38,7 +38,6 @@
     explicit XMLTreeViewer(Document*);
     virtual ~XMLTreeViewer() {};
 
-    bool hasNoStyleInformation() const;
     void transformDocumentToTreeView();
 
 private:
diff --git a/Source/core/xml/XPathEvaluator.cpp b/Source/core/xml/XPathEvaluator.cpp
index b98b814..09e77ce 100644
--- a/Source/core/xml/XPathEvaluator.cpp
+++ b/Source/core/xml/XPathEvaluator.cpp
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "core/xml/XPathEvaluator.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/Node.h"
 #include "core/xml/NativeXPathNSResolver.h"
@@ -38,11 +39,9 @@
 
 using namespace XPath;
 
-PassRefPtr<XPathExpression> XPathEvaluator::createExpression(const String& expression,
-                                                             XPathNSResolver* resolver,
-                                                             ExceptionCode& ec)
+PassRefPtr<XPathExpression> XPathEvaluator::createExpression(const String& expression, XPathNSResolver* resolver, ExceptionState& es)
 {
-    return XPathExpression::createExpression(expression, resolver, ec);
+    return XPathExpression::createExpression(expression, resolver, es);
 }
 
 PassRefPtr<XPathNSResolver> XPathEvaluator::createNSResolver(Node* nodeResolver)
@@ -50,24 +49,20 @@
     return NativeXPathNSResolver::create(nodeResolver);
 }
 
-PassRefPtr<XPathResult> XPathEvaluator::evaluate(const String& expression,
-                                                 Node* contextNode,
-                                                 XPathNSResolver* resolver,
-                                                 unsigned short type,
-                                                 XPathResult* result,
-                                                 ExceptionCode& ec)
+PassRefPtr<XPathResult> XPathEvaluator::evaluate(const String& expression, Node* contextNode,
+    XPathNSResolver* resolver, unsigned short type, XPathResult* result, ExceptionState& es)
 {
     if (!isValidContextNode(contextNode)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
-    ec = 0;
-    RefPtr<XPathExpression> expr = createExpression(expression, resolver, ec);
-    if (ec)
+    es.clearException();
+    RefPtr<XPathExpression> expr = createExpression(expression, resolver, es);
+    if (es.hadException())
         return 0;
 
-    return expr->evaluate(contextNode, type, result, ec);
+    return expr->evaluate(contextNode, type, result, es);
 }
 
 }
diff --git a/Source/core/xml/XPathEvaluator.h b/Source/core/xml/XPathEvaluator.h
index d3906ee..6ad05dc 100644
--- a/Source/core/xml/XPathEvaluator.h
+++ b/Source/core/xml/XPathEvaluator.h
@@ -34,8 +34,7 @@
 
 namespace WebCore {
 
-typedef int ExceptionCode;
-
+class ExceptionState;
 class Node;
 class XPathExpression;
 class XPathNSResolver;
@@ -45,10 +44,10 @@
 public:
     static PassRefPtr<XPathEvaluator> create() { return adoptRef(new XPathEvaluator); }
 
-    PassRefPtr<XPathExpression> createExpression(const String& expression, XPathNSResolver*, ExceptionCode&);
+    PassRefPtr<XPathExpression> createExpression(const String& expression, XPathNSResolver*, ExceptionState&);
     PassRefPtr<XPathNSResolver> createNSResolver(Node* nodeResolver);
     PassRefPtr<XPathResult> evaluate(const String& expression, Node* contextNode,
-        XPathNSResolver*, unsigned short type, XPathResult*, ExceptionCode&);
+        XPathNSResolver*, unsigned short type, XPathResult*, ExceptionState&);
 
 private:
     XPathEvaluator()
diff --git a/Source/core/xml/XPathExpression.cpp b/Source/core/xml/XPathExpression.cpp
index 3b80c02..2e2df63 100644
--- a/Source/core/xml/XPathExpression.cpp
+++ b/Source/core/xml/XPathExpression.cpp
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "core/xml/XPathExpression.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/xml/XPathExpressionNode.h"
 #include "core/xml/XPathNSResolver.h"
@@ -39,12 +40,12 @@
 
 using namespace XPath;
 
-PassRefPtr<XPathExpression> XPathExpression::createExpression(const String& expression, XPathNSResolver* resolver, ExceptionCode& ec)
+PassRefPtr<XPathExpression> XPathExpression::createExpression(const String& expression, XPathNSResolver* resolver, ExceptionState& es)
 {
     RefPtr<XPathExpression> expr = XPathExpression::create();
     Parser parser;
 
-    expr->m_topExpression = parser.parseStatement(expression, resolver, ec);
+    expr->m_topExpression = parser.parseStatement(expression, resolver, es);
     if (!expr->m_topExpression)
         return 0;
 
@@ -56,10 +57,10 @@
     delete m_topExpression;
 }
 
-PassRefPtr<XPathResult> XPathExpression::evaluate(Node* contextNode, unsigned short type, XPathResult*, ExceptionCode& ec)
+PassRefPtr<XPathResult> XPathExpression::evaluate(Node* contextNode, unsigned short type, XPathResult*, ExceptionState& es)
 {
     if (!isValidContextNode(contextNode)) {
-        ec = NotSupportedError;
+        es.throwDOMException(NotSupportedError);
         return 0;
     }
 
@@ -73,14 +74,14 @@
 
     if (evaluationContext.hadTypeConversionError) {
         // It is not specified what to do if type conversion fails while evaluating an expression.
-        ec = SyntaxError;
+        es.throwDOMException(SyntaxError);
         return 0;
     }
 
     if (type != XPathResult::ANY_TYPE) {
-        ec = 0;
-        result->convertTo(type, ec);
-        if (ec)
+        es.clearException();
+        result->convertTo(type, es);
+        if (es.hadException())
             return 0;
     }
 
diff --git a/Source/core/xml/XPathExpression.h b/Source/core/xml/XPathExpression.h
index fdc28dc..083a3f5 100644
--- a/Source/core/xml/XPathExpression.h
+++ b/Source/core/xml/XPathExpression.h
@@ -34,8 +34,7 @@
 
 namespace WebCore {
 
-typedef int ExceptionCode;
-
+class ExceptionState;
 class Node;
 class XPathNSResolver;
 class XPathResult;
@@ -49,8 +48,8 @@
     static PassRefPtr<XPathExpression> create() { return adoptRef(new XPathExpression); }
     ~XPathExpression();
 
-    static PassRefPtr<XPathExpression> createExpression(const String& expression, XPathNSResolver*, ExceptionCode&);
-    PassRefPtr<XPathResult> evaluate(Node* contextNode, unsigned short type, XPathResult*, ExceptionCode&);
+    static PassRefPtr<XPathExpression> createExpression(const String& expression, XPathNSResolver*, ExceptionState&);
+    PassRefPtr<XPathResult> evaluate(Node* contextNode, unsigned short type, XPathResult*, ExceptionState&);
 
 private:
     XPathExpression()
diff --git a/Source/core/xml/XPathParser.cpp b/Source/core/xml/XPathParser.cpp
index c547edd..4f2c8b2 100644
--- a/Source/core/xml/XPathParser.cpp
+++ b/Source/core/xml/XPathParser.cpp
@@ -28,6 +28,7 @@
 #include "config.h"
 #include "core/xml/XPathParser.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/xml/XPathEvaluator.h"
 #include "core/xml/XPathNSResolver.h"
@@ -463,7 +464,7 @@
     return true;
 }
 
-Expression* Parser::parseStatement(const String& statement, PassRefPtr<XPathNSResolver> resolver, ExceptionCode& ec)
+Expression* Parser::parseStatement(const String& statement, PassRefPtr<XPathNSResolver> resolver, ExceptionState& es)
 {
     reset(statement);
 
@@ -501,9 +502,9 @@
         m_topExpr = 0;
 
         if (m_gotNamespaceError)
-            ec = NamespaceError;
+            es.throwDOMException(NamespaceError);
         else
-            ec = SyntaxError;
+            es.throwDOMException(SyntaxError);
         return 0;
     }
 
diff --git a/Source/core/xml/XPathParser.h b/Source/core/xml/XPathParser.h
index 1db22b1..57c6dc5 100644
--- a/Source/core/xml/XPathParser.h
+++ b/Source/core/xml/XPathParser.h
@@ -32,98 +32,98 @@
 
 namespace WebCore {
 
-    typedef int ExceptionCode;
+class ExceptionState;
+class XPathNSResolver;
 
-    class XPathNSResolver;
+namespace XPath {
 
-    namespace XPath {
+class Expression;
+class ParseNode;
+class Predicate;
 
-        class Expression;
-        class ParseNode;
-        class Predicate;
+struct Token {
+    int type;
+    String str;
+    Step::Axis axis;
+    NumericOp::Opcode numop;
+    EqTestOp::Opcode eqop;
 
-        struct Token {
-            int type;
-            String str;
-            Step::Axis axis;
-            NumericOp::Opcode numop;
-            EqTestOp::Opcode eqop;
+    Token(int t) : type(t) { }
+    Token(int t, const String& v): type(t), str(v) { }
+    Token(int t, Step::Axis v): type(t), axis(v) { }
+    Token(int t, NumericOp::Opcode v): type(t), numop(v) { }
+    Token(int t, EqTestOp::Opcode v): type(t), eqop(v) { }
+};
 
-            Token(int t) : type(t) {}
-            Token(int t, const String& v): type(t), str(v) {}
-            Token(int t, Step::Axis v): type(t), axis(v) {}
-            Token(int t, NumericOp::Opcode v): type(t), numop(v) {}
-            Token(int t, EqTestOp::Opcode v): type(t), eqop(v) {}
-        };
+class Parser {
+    WTF_MAKE_NONCOPYABLE(Parser);
+public:
+    Parser();
+    ~Parser();
 
-        class Parser {
-            WTF_MAKE_NONCOPYABLE(Parser);
-        public:
-            Parser();
-            ~Parser();
+    XPathNSResolver* resolver() const { return m_resolver.get(); }
+    bool expandQName(const String& qName, String& localName, String& namespaceURI);
 
-            XPathNSResolver* resolver() const { return m_resolver.get(); }
-            bool expandQName(const String& qName, String& localName, String& namespaceURI);
+    Expression* parseStatement(const String& statement, PassRefPtr<XPathNSResolver>, ExceptionState&);
 
-            Expression* parseStatement(const String& statement, PassRefPtr<XPathNSResolver>, ExceptionCode&);
+    static Parser* current() { return currentParser; }
 
-            static Parser* current() { return currentParser; }
+    int lex(void* yylval);
 
-            int lex(void* yylval);
+    Expression* m_topExpr;
+    bool m_gotNamespaceError;
 
-            Expression* m_topExpr;
-            bool m_gotNamespaceError;
+    void registerParseNode(ParseNode*);
+    void unregisterParseNode(ParseNode*);
 
-            void registerParseNode(ParseNode*);
-            void unregisterParseNode(ParseNode*);
+    void registerPredicateVector(Vector<Predicate*>*);
+    void deletePredicateVector(Vector<Predicate*>*);
 
-            void registerPredicateVector(Vector<Predicate*>*);
-            void deletePredicateVector(Vector<Predicate*>*);
+    void registerExpressionVector(Vector<Expression*>*);
+    void deleteExpressionVector(Vector<Expression*>*);
 
-            void registerExpressionVector(Vector<Expression*>*);
-            void deleteExpressionVector(Vector<Expression*>*);
+    void registerString(String*);
+    void deleteString(String*);
 
-            void registerString(String*);
-            void deleteString(String*);
+    void registerNodeTest(Step::NodeTest*);
+    void deleteNodeTest(Step::NodeTest*);
 
-            void registerNodeTest(Step::NodeTest*);
-            void deleteNodeTest(Step::NodeTest*);
+private:
+    bool isBinaryOperatorContext() const;
 
-        private:
-            bool isBinaryOperatorContext() const;
+    void skipWS();
+    Token makeTokenAndAdvance(int type, int advance = 1);
+    Token makeTokenAndAdvance(int type, NumericOp::Opcode, int advance = 1);
+    Token makeTokenAndAdvance(int type, EqTestOp::Opcode, int advance = 1);
+    char peekAheadHelper();
+    char peekCurHelper();
 
-            void skipWS();
-            Token makeTokenAndAdvance(int type, int advance = 1);
-            Token makeTokenAndAdvance(int type, NumericOp::Opcode, int advance = 1);
-            Token makeTokenAndAdvance(int type, EqTestOp::Opcode, int advance = 1);
-            char peekAheadHelper();
-            char peekCurHelper();
+    Token lexString();
+    Token lexNumber();
+    bool lexNCName(String&);
+    bool lexQName(String&);
 
-            Token lexString();
-            Token lexNumber();
-            bool lexNCName(String&);
-            bool lexQName(String&);
+    Token nextToken();
+    Token nextTokenInternal();
 
-            Token nextToken();
-            Token nextTokenInternal();
+    void reset(const String& data);
 
-            void reset(const String& data);
+    static Parser* currentParser;
 
-            static Parser* currentParser;
+    unsigned m_nextPos;
+    String m_data;
+    int m_lastTokenType;
+    RefPtr<XPathNSResolver> m_resolver;
 
-            unsigned m_nextPos;
-            String m_data;
-            int m_lastTokenType;
-            RefPtr<XPathNSResolver> m_resolver;
+    HashSet<ParseNode*> m_parseNodes;
+    HashSet<Vector<Predicate*>*> m_predicateVectors;
+    HashSet<Vector<Expression*>*> m_expressionVectors;
+    HashSet<String*> m_strings;
+    HashSet<Step::NodeTest*> m_nodeTests;
+};
 
-            HashSet<ParseNode*> m_parseNodes;
-            HashSet<Vector<Predicate*>*> m_predicateVectors;
-            HashSet<Vector<Expression*>*> m_expressionVectors;
-            HashSet<String*> m_strings;
-            HashSet<Step::NodeTest*> m_nodeTests;
-        };
+} // XPath
 
-    }
-}
+} // WebCore
 
 #endif
diff --git a/Source/core/xml/XPathResult.cpp b/Source/core/xml/XPathResult.cpp
index 4a20e45..c1e9732 100644
--- a/Source/core/xml/XPathResult.cpp
+++ b/Source/core/xml/XPathResult.cpp
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "core/xml/XPathResult.h"
 
+#include "bindings/v8/ExceptionState.h"
 #include "core/dom/Document.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/xml/XPathEvaluator.h"
@@ -66,7 +67,7 @@
 {
 }
 
-void XPathResult::convertTo(unsigned short type, ExceptionCode& ec)
+void XPathResult::convertTo(unsigned short type, ExceptionState& es)
 {
     switch (type) {
         case ANY_TYPE:
@@ -88,14 +89,14 @@
         case ANY_UNORDERED_NODE_TYPE:
         case FIRST_ORDERED_NODE_TYPE: // This is correct - singleNodeValue() will take care of ordering.
             if (!m_value.isNodeSet()) {
-                ec = TypeError;
+                es.throwDOMException(TypeError);
                 return;
             }
             m_resultType = type;
             break;
         case ORDERED_NODE_ITERATOR_TYPE:
             if (!m_value.isNodeSet()) {
-                ec = TypeError;
+                es.throwDOMException(TypeError);
                 return;
             }
             m_nodeSet.sort();
@@ -103,7 +104,7 @@
             break;
         case ORDERED_NODE_SNAPSHOT_TYPE:
             if (!m_value.isNodeSet()) {
-                ec = TypeError;
+                es.throwDOMException(TypeError);
                 return;
             }
             m_value.toNodeSet().sort();
@@ -117,37 +118,37 @@
     return m_resultType;
 }
 
-double XPathResult::numberValue(ExceptionCode& ec) const
+double XPathResult::numberValue(ExceptionState& es) const
 {
     if (resultType() != NUMBER_TYPE) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return 0.0;
     }
     return m_value.toNumber();
 }
 
-String XPathResult::stringValue(ExceptionCode& ec) const
+String XPathResult::stringValue(ExceptionState& es) const
 {
     if (resultType() != STRING_TYPE) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return String();
     }
     return m_value.toString();
 }
 
-bool XPathResult::booleanValue(ExceptionCode& ec) const
+bool XPathResult::booleanValue(ExceptionState& es) const
 {
     if (resultType() != BOOLEAN_TYPE) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return false;
     }
     return m_value.toBoolean();
 }
 
-Node* XPathResult::singleNodeValue(ExceptionCode& ec) const
+Node* XPathResult::singleNodeValue(ExceptionState& es) const
 {
     if (resultType() != ANY_UNORDERED_NODE_TYPE && resultType() != FIRST_ORDERED_NODE_TYPE) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return 0;
     }
 
@@ -167,25 +168,25 @@
     return m_document->domTreeVersion() != m_domTreeVersion;
 }
 
-unsigned long XPathResult::snapshotLength(ExceptionCode& ec) const
+unsigned long XPathResult::snapshotLength(ExceptionState& es) const
 {
     if (resultType() != UNORDERED_NODE_SNAPSHOT_TYPE && resultType() != ORDERED_NODE_SNAPSHOT_TYPE) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return 0;
     }
 
     return m_value.toNodeSet().size();
 }
 
-Node* XPathResult::iterateNext(ExceptionCode& ec)
+Node* XPathResult::iterateNext(ExceptionState& es)
 {
     if (resultType() != UNORDERED_NODE_ITERATOR_TYPE && resultType() != ORDERED_NODE_ITERATOR_TYPE) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return 0;
     }
 
     if (invalidIteratorState()) {
-        ec = InvalidStateError;
+        es.throwDOMException(InvalidStateError);
         return 0;
     }
 
@@ -199,10 +200,10 @@
     return node;
 }
 
-Node* XPathResult::snapshotItem(unsigned long index, ExceptionCode& ec)
+Node* XPathResult::snapshotItem(unsigned long index, ExceptionState& es)
 {
     if (resultType() != UNORDERED_NODE_SNAPSHOT_TYPE && resultType() != ORDERED_NODE_SNAPSHOT_TYPE) {
-        ec = TypeError;
+        es.throwDOMException(TypeError);
         return 0;
     }
 
diff --git a/Source/core/xml/XPathResult.h b/Source/core/xml/XPathResult.h
index 9bafba5..319ef6c 100644
--- a/Source/core/xml/XPathResult.h
+++ b/Source/core/xml/XPathResult.h
@@ -34,9 +34,8 @@
 
 namespace WebCore {
 
-typedef int ExceptionCode;
-
 class Document;
+class ExceptionState;
 class Node;
 
 class XPathResult : public RefCounted<XPathResult>, public ScriptWrappable {
@@ -57,19 +56,19 @@
     static PassRefPtr<XPathResult> create(Document* document, const XPath::Value& value) { return adoptRef(new XPathResult(document, value)); }
     ~XPathResult();
 
-    void convertTo(unsigned short type, ExceptionCode&);
+    void convertTo(unsigned short type, ExceptionState&);
 
     unsigned short resultType() const;
 
-    double numberValue(ExceptionCode&) const;
-    String stringValue(ExceptionCode&) const;
-    bool booleanValue(ExceptionCode&) const;
-    Node* singleNodeValue(ExceptionCode&) const;
+    double numberValue(ExceptionState&) const;
+    String stringValue(ExceptionState&) const;
+    bool booleanValue(ExceptionState&) const;
+    Node* singleNodeValue(ExceptionState&) const;
 
     bool invalidIteratorState() const;
-    unsigned long snapshotLength(ExceptionCode&) const;
-    Node* iterateNext(ExceptionCode&);
-    Node* snapshotItem(unsigned long index, ExceptionCode&);
+    unsigned long snapshotLength(ExceptionState&) const;
+    Node* iterateNext(ExceptionState&);
+    Node* snapshotItem(unsigned long index, ExceptionState&);
 
     const XPath::Value& value() const { return m_value; }
 
diff --git a/Source/core/xml/parser/XMLDocumentParser.cpp b/Source/core/xml/parser/XMLDocumentParser.cpp
index 34cd188..7bbc2a1 100644
--- a/Source/core/xml/parser/XMLDocumentParser.cpp
+++ b/Source/core/xml/parser/XMLDocumentParser.cpp
@@ -37,6 +37,7 @@
 #include <wtf/Vector.h>
 #include "HTMLNames.h"
 #include "XMLNSNames.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "bindings/v8/ScriptController.h"
 #include "bindings/v8/ScriptSourceCode.h"
 #include "core/dom/CDATASection.h"
@@ -44,7 +45,6 @@
 #include "core/dom/Document.h"
 #include "core/dom/DocumentFragment.h"
 #include "core/dom/DocumentType.h"
-#include "core/dom/ExceptionCodePlaceholder.h"
 #include "core/dom/ProcessingInstruction.h"
 #include "core/dom/ScriptLoader.h"
 #include "core/dom/TransformSource.h"
@@ -97,6 +97,20 @@
     return AtomicString::fromUTF8(reinterpret_cast<const char*>(string));
 }
 
+static inline bool hasNoStyleInformation(Document* document)
+{
+    if (document->sawElementsInKnownNamespaces() || document->transformSourceDocument())
+        return false;
+
+    if (!document->frame() || !document->frame()->page())
+        return false;
+
+    if (document->frame()->tree()->parent())
+        return false; // This document is not in a top frame
+
+    return true;
+}
+
 class PendingStartElementNSCallback FINAL : public XMLDocumentParser::PendingCallback {
 public:
     PendingStartElementNSCallback(const AtomicString& localName, const AtomicString& prefix, const AtomicString& uri,
@@ -865,17 +879,17 @@
 };
 typedef struct _xmlSAX2Namespace xmlSAX2Namespace;
 
-static inline void handleNamespaceAttributes(Vector<Attribute>& prefixedAttributes, const xmlChar** libxmlNamespaces, int nb_namespaces, ExceptionCode& ec)
+static inline void handleNamespaceAttributes(Vector<Attribute>& prefixedAttributes, const xmlChar** libxmlNamespaces, int nbNamespaces, ExceptionState& es)
 {
     xmlSAX2Namespace* namespaces = reinterpret_cast<xmlSAX2Namespace*>(libxmlNamespaces);
-    for (int i = 0; i < nb_namespaces; i++) {
+    for (int i = 0; i < nbNamespaces; i++) {
         AtomicString namespaceQName = xmlnsAtom;
         AtomicString namespaceURI = toAtomicString(namespaces[i].uri);
         if (namespaces[i].prefix)
             namespaceQName = "xmlns:" + toString(namespaces[i].prefix);
 
         QualifiedName parsedName = anyName;
-        if (!Element::parseAttributeName(parsedName, XMLNSNames::xmlnsNamespaceURI, namespaceQName, ec))
+        if (!Element::parseAttributeName(parsedName, XMLNSNames::xmlnsNamespaceURI, namespaceQName, es))
             return;
 
         prefixedAttributes.append(Attribute(parsedName, namespaceURI));
@@ -891,10 +905,10 @@
 };
 typedef struct _xmlSAX2Attributes xmlSAX2Attributes;
 
-static inline void handleElementAttributes(Vector<Attribute>& prefixedAttributes, const xmlChar** libxmlAttributes, int nb_attributes, ExceptionCode& ec)
+static inline void handleElementAttributes(Vector<Attribute>& prefixedAttributes, const xmlChar** libxmlAttributes, int nbAttributes, ExceptionState& es)
 {
     xmlSAX2Attributes* attributes = reinterpret_cast<xmlSAX2Attributes*>(libxmlAttributes);
-    for (int i = 0; i < nb_attributes; i++) {
+    for (int i = 0; i < nbAttributes; i++) {
         int valueLength = static_cast<int>(attributes[i].end - attributes[i].value);
         AtomicString attrValue = toAtomicString(attributes[i].value, valueLength);
         String attrPrefix = toString(attributes[i].prefix);
@@ -902,22 +916,22 @@
         AtomicString attrQName = attrPrefix.isEmpty() ? toAtomicString(attributes[i].localname) : attrPrefix + ":" + toString(attributes[i].localname);
 
         QualifiedName parsedName = anyName;
-        if (!Element::parseAttributeName(parsedName, attrURI, attrQName, ec))
+        if (!Element::parseAttributeName(parsedName, attrURI, attrQName, es))
             return;
 
         prefixedAttributes.append(Attribute(parsedName, attrValue));
     }
 }
 
-void XMLDocumentParser::startElementNs(const AtomicString& localName, const AtomicString& prefix, const AtomicString& uri, int nb_namespaces,
-                                  const xmlChar** libxmlNamespaces, int nb_attributes, int nb_defaulted, const xmlChar** libxmlAttributes)
+void XMLDocumentParser::startElementNs(const AtomicString& localName, const AtomicString& prefix, const AtomicString& uri, int nbNamespaces,
+    const xmlChar** libxmlNamespaces, int nbAttributes, int nbDefaulted, const xmlChar** libxmlAttributes)
 {
     if (isStopped())
         return;
 
     if (m_parserPaused) {
-        m_pendingCallbacks.append(adoptPtr(new PendingStartElementNSCallback(localName, prefix, uri, nb_namespaces, libxmlNamespaces,
-            nb_attributes, nb_defaulted, libxmlAttributes)));
+        m_pendingCallbacks.append(adoptPtr(new PendingStartElementNSCallback(localName, prefix, uri, nbNamespaces, libxmlNamespaces,
+            nbAttributes, nbDefaulted, libxmlAttributes)));
         return;
     }
 
@@ -942,17 +956,17 @@
     }
 
     Vector<Attribute> prefixedAttributes;
-    ExceptionCode ec = 0;
-    handleNamespaceAttributes(prefixedAttributes, libxmlNamespaces, nb_namespaces, ec);
-    if (ec) {
+    TrackExceptionState es;
+    handleNamespaceAttributes(prefixedAttributes, libxmlNamespaces, nbNamespaces, es);
+    if (es.hadException()) {
         setAttributes(newElement.get(), prefixedAttributes, parserContentPolicy());
         stopParsing();
         return;
     }
 
-    handleElementAttributes(prefixedAttributes, libxmlAttributes, nb_attributes, ec);
+    handleElementAttributes(prefixedAttributes, libxmlAttributes, nbAttributes, es);
     setAttributes(newElement.get(), prefixedAttributes, parserContentPolicy());
-    if (ec) {
+    if (es.hadException()) {
         stopParsing();
         return;
     }
@@ -1002,7 +1016,7 @@
 
     if (!scriptingContentIsAllowed(parserContentPolicy()) && n->isElementNode() && toScriptLoaderIfPossible(toElement(n.get()))) {
         popCurrentNode();
-        n->remove(IGNORE_EXCEPTION);
+        n->remove(IGNORE_EXCEPTION_STATE);
         return;
     }
 
@@ -1113,9 +1127,9 @@
     exitText();
 
     // ### handle exceptions
-    ExceptionCode ec = 0;
-    RefPtr<ProcessingInstruction> pi = m_currentNode->document()->createProcessingInstruction(target, data, ec);
-    if (ec)
+    TrackExceptionState es;
+    RefPtr<ProcessingInstruction> pi = m_currentNode->document()->createProcessingInstruction(target, data, es);
+    if (es.hadException())
         return;
 
     pi->setCreatedByParser(true);
@@ -1185,9 +1199,9 @@
     }
 
     if (!version.isNull())
-        document()->setXMLVersion(version, ASSERT_NO_EXCEPTION);
+        document()->setXMLVersion(version, ASSERT_NO_EXCEPTION_STATE);
     if (standalone != StandaloneUnspecified)
-        document()->setXMLStandalone(standaloneInfo == StandaloneYes, ASSERT_NO_EXCEPTION);
+        document()->setXMLStandalone(standaloneInfo == StandaloneYes, ASSERT_NO_EXCEPTION_STATE);
     if (!encoding.isNull())
         document()->setXMLEncoding(encoding);
     document()->setHasXMLDeclaration(true);
@@ -1218,9 +1232,9 @@
     return static_cast<XMLDocumentParser*>(ctxt->_private);
 }
 
-static void startElementNsHandler(void* closure, const xmlChar* localName, const xmlChar* prefix, const xmlChar* uri, int nb_namespaces, const xmlChar** namespaces, int nb_attributes, int nb_defaulted, const xmlChar** libxmlAttributes)
+static void startElementNsHandler(void* closure, const xmlChar* localName, const xmlChar* prefix, const xmlChar* uri, int nbNamespaces, const xmlChar** namespaces, int nbAttributes, int nbDefaulted, const xmlChar** libxmlAttributes)
 {
-    getParser(closure)->startElementNs(toAtomicString(localName), toAtomicString(prefix), toAtomicString(uri), nb_namespaces, namespaces, nb_attributes, nb_defaulted, libxmlAttributes);
+    getParser(closure)->startElementNs(toAtomicString(localName), toAtomicString(prefix), toAtomicString(uri), nbNamespaces, namespaces, nbAttributes, nbDefaulted, libxmlAttributes);
 }
 
 static void endElementNsHandler(void* closure, const xmlChar*, const xmlChar*, const xmlChar*)
@@ -1439,9 +1453,9 @@
         }
     }
 
-    XMLTreeViewer xmlTreeViewer(document());
-    bool xmlViewerMode = !m_sawError && !m_sawCSS && !m_sawXSLTransform && xmlTreeViewer.hasNoStyleInformation();
+    bool xmlViewerMode = !m_sawError && !m_sawCSS && !m_sawXSLTransform && hasNoStyleInformation(document());
     if (xmlViewerMode) {
+        XMLTreeViewer xmlTreeViewer(document());
         xmlTreeViewer.transformDocumentToTreeView();
     } else if (m_sawXSLTransform) {
         xmlDocPtr doc = xmlDocPtrForString(document()->fetcher(), m_originalSourceForTransform.toString(), document()->url().string());
@@ -1567,8 +1581,8 @@
 };
 
 static void attributesStartElementNsHandler(void* closure, const xmlChar* xmlLocalName, const xmlChar* /*xmlPrefix*/,
-                                            const xmlChar* /*xmlURI*/, int /*nb_namespaces*/, const xmlChar** /*namespaces*/,
-                                            int nb_attributes, int /*nb_defaulted*/, const xmlChar** libxmlAttributes)
+    const xmlChar* /*xmlURI*/, int /*nbNamespaces*/, const xmlChar** /*namespaces*/,
+    int nbAttributes, int /*nbDefaulted*/, const xmlChar** libxmlAttributes)
 {
     if (strcmp(reinterpret_cast<const char*>(xmlLocalName), "attrs") != 0)
         return;
@@ -1579,7 +1593,7 @@
     state->gotAttributes = true;
 
     xmlSAX2Attributes* attributes = reinterpret_cast<xmlSAX2Attributes*>(libxmlAttributes);
-    for (int i = 0; i < nb_attributes; i++) {
+    for (int i = 0; i < nbAttributes; i++) {
         String attrLocalName = toString(attributes[i].localname);
         int valueLength = (int) (attributes[i].end - attributes[i].value);
         String attrValue = toString(attributes[i].value, valueLength);