<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[205411] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/205411">205411</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2016-09-03 16:34:00 -0700 (Sat, 03 Sep 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Streamline DOMImplementation, and move it to our new DOM exception system
https://bugs.webkit.org/show_bug.cgi?id=161295

Reviewed by Ryosuke Niwa.

Source/WebCore:

* WebCore.xcodeproj/project.pbxproj: Added new headers to project.

* bindings/js/JSDOMBinding.h:
(WebCore::toJS): Added an overload for ExceptionOr&lt;&gt;; this handles the
exception case here so it doesn't need to be handled in generated code
for the binding. Implemented here so that ExceptionOr.h does not know
about bindings. But since this is a template, it will only compile when
instantiated and there is no need to include ExceptionOr.h and indirectly
the Variant.h header in this header.
(WebCore::toJSNewlyCreated): Ditto.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateCallbackImplementation): Refer to JSC::Exception with explicit
namespace to avoid ambiguity with WebCore::Exception.

* dom/DOMImplementation.cpp:
(WebCore::DOMImplementation::createDocumentType): Changed to return
ExceptionOr.
(WebCore::createXMLDocument): Added. Helper used in createDocument.
(WebCore::DOMImplementation::getInterface): Deleted. This was unused.
(WebCore::DOMImplementation::createDocument): Changed to return
ExceptionOr.
(WebCore::DOMImplementation::createCSSStyleSheet): Removed the unused
ExceptionCode out argument.
(WebCore::isValidXMLMIMETypeChar): Deleted. Moved to MIMETypeRegistry.
(WebCore::DOMImplementation::isXMLMIMEType): Ditto.
(WebCore::DOMImplementation::isTextMIMEType): Ditto.

* dom/DOMImplementation.h: Changed functions as described above to
return ExceptionOr values. Also removed unused getInterface function,
and isXMLMIMEType and isTextMIMEType, which both moved to the
MIMETypeRegistry class alongside all the other similar MIME type
functions.

* dom/DOMImplementation.idl: Reorganized this to match the IDL files
in the specifications a little better. Also removed [RaisesException]
since that is only needed for the old legacy ExceptionCode&amp; style.

* dom/Document.cpp:
(WebCore::Document::setXMLVersion): Removed call to the
DOMImplementation::hasFeature function since the values passed in
unconditionally result in the return value &quot;true&quot;. This is left over
either from specification language, or from an ancient version of this
code that worked in a &quot;no XML supported&quot; mode.
(WebCore::Document::setXMLStandalone): Ditto.

* dom/Document.h: Removed the ExceptionCode&amp; out argument from setXMLStandalone.
* dom/Document.idl: Removed [SetterRaisesException] from xmlStandalone.

* dom/Exception.h: Added.
* dom/ExceptionOr.h: Added.

* html/HTMLTemplateElement.cpp: Removed unneeded include of DOMImplementation.h.

* inspector/InspectorPageAgent.cpp:
(WebCore::createXHRTextDecoder): Use isXMLMIMEType in its new location in
MIMETypeRegistry.
* inspector/NetworkResourcesData.cpp:
(WebCore::createOtherResourceTextDecoder): Ditto.

* loader/FrameLoader.cpp: Removed unneeded include of DOMImplementation.h.

* loader/TextResourceDecoder.cpp:
(WebCore::TextResourceDecoder::determineContentType): Use isXMLMIMEType in its
new location in MIMETypeRegistry.

* platform/MIMETypeRegistry.cpp:
(WebCore::MIMETypeRegistry::isTextMIMEType): Added. Moved here from
DOMImplementation.
(WebCore::isValidXMLMIMETypeChar): Ditto.
(WebCore::MIMETypeRegistry::isXMLMIMEType): Ditto.

* platform/MIMETypeRegistry.h: Added isXMLMIMEType and isTextMIMEType.
Made isUnsupportedTextMIMEType private.

* svg/SVGElement.cpp:
(WebCore::SVGElement::isSupported): Deleted. This function was never called.
* svg/SVGElement.h: Updated for the above change.

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::responseIsXML): Use isXMLMIMEType in its new
location in MIMETypeRegistry.

* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::startDocument): Updated since setXMLStandalone
no longer can raise an exception.

Source/WebKit/mac:

* DOM/DOMDOMImplementation.mm:
(unwrap): Added. Use this instead of the IMPL macro.
(-[DOMImplementation dealloc]): Updated to use unwrap.
(-[DOMImplementation hasFeature:version:]): Ditto.
(-[DOMImplementation createDocumentType:publicId:systemId:]): Updated to work with
ExceptionOr.
(-[DOMImplementation createDocument:qualifiedName:doctype:]): Ditto.
(-[DOMImplementation createCSSStyleSheet:media:]): Removed exception logic since
this function can no longer raise an exception.
(-[DOMImplementation createHTMLDocument:]): Updated to use unwrap.
(-[DOMImplementation hasFeature::]): Changed to call the non-deprecated version
rather than duplicating its implementation. Also moved into the category as defined
in the header.
(-[DOMImplementation createDocumentType:::]): Ditto.
(-[DOMImplementation createDocument:::]): Ditto.
(-[DOMImplementation createCSSStyleSheet::]): Ditto.

* DOM/DOMDocument.mm: Removed unneeded include of DOMImplementation.h.
(-[DOMDocument setXmlStandalone:]): Updated since setXMLStandalone no longer can
raise an exception.

* WebView/WebFrame.mm:
(-[WebFrame _canProvideDocumentSource]): Updated to use isTextMIMEType in its new
location in MIMETypeRegistry instead of in DOMImplementation.

Source/WebKit/win:

* WebFrame.cpp:
(WebFrame::canProvideDocumentSource): Updated to use isXMLMIMEType in its new
location in MIMETypeRegistry instead of in DOMImplementation.

Source/WebKit2:

* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::isDisplayingMarkupDocument): Use isXMLMIMEType in its
new location in MIMETypeRegistry rather than in DOMImplementation.
(WebKit::WebFrameProxy::isDisplayingPDFDocument): Removed unneeded redundant
check for empty string, already done by MIMETypeRegistry.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMBindingh">trunk/Source/WebCore/bindings/js/JSDOMBinding.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestCallbackcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestCallbackFunctioncpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDOMImplementationcpp">trunk/Source/WebCore/dom/DOMImplementation.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDOMImplementationh">trunk/Source/WebCore/dom/DOMImplementation.h</a></li>
<li><a href="#trunkSourceWebCoredomDOMImplementationidl">trunk/Source/WebCore/dom/DOMImplementation.idl</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
<li><a href="#trunkSourceWebCoredomDocumentidl">trunk/Source/WebCore/dom/Document.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTemplateElementcpp">trunk/Source/WebCore/html/HTMLTemplateElement.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorPageAgentcpp">trunk/Source/WebCore/inspector/InspectorPageAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorNetworkResourcesDatacpp">trunk/Source/WebCore/inspector/NetworkResourcesData.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoadercpp">trunk/Source/WebCore/loader/FrameLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderTextResourceDecodercpp">trunk/Source/WebCore/loader/TextResourceDecoder.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformMIMETypeRegistrycpp">trunk/Source/WebCore/platform/MIMETypeRegistry.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformMIMETypeRegistryh">trunk/Source/WebCore/platform/MIMETypeRegistry.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGElementcpp">trunk/Source/WebCore/svg/SVGElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGElementh">trunk/Source/WebCore/svg/SVGElement.h</a></li>
<li><a href="#trunkSourceWebCorexmlXMLHttpRequestcpp">trunk/Source/WebCore/xml/XMLHttpRequest.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlparserXMLDocumentParserLibxml2cpp">trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacDOMDOMDOMImplementationmm">trunk/Source/WebKit/mac/DOM/DOMDOMImplementation.mm</a></li>
<li><a href="#trunkSourceWebKitmacDOMDOMDocumentmm">trunk/Source/WebKit/mac/DOM/DOMDocument.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebFramemm">trunk/Source/WebKit/mac/WebView/WebFrame.mm</a></li>
<li><a href="#trunkSourceWebKitwinChangeLog">trunk/Source/WebKit/win/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitwinWebFramecpp">trunk/Source/WebKit/win/WebFrame.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebFrameProxycpp">trunk/Source/WebKit2/UIProcess/WebFrameProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMDOMImplementationcpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMDocumentcpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoredomExceptionh">trunk/Source/WebCore/dom/Exception.h</a></li>
<li><a href="#trunkSourceWebCoredomExceptionOrh">trunk/Source/WebCore/dom/ExceptionOr.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/ChangeLog        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -1,3 +1,97 @@
</span><ins>+2016-09-03  Darin Adler  &lt;darin@apple.com&gt;
+
+        Streamline DOMImplementation, and move it to our new DOM exception system
+        https://bugs.webkit.org/show_bug.cgi?id=161295
+
+        Reviewed by Ryosuke Niwa.
+
+        * WebCore.xcodeproj/project.pbxproj: Added new headers to project.
+
+        * bindings/js/JSDOMBinding.h:
+        (WebCore::toJS): Added an overload for ExceptionOr&lt;&gt;; this handles the
+        exception case here so it doesn't need to be handled in generated code
+        for the binding. Implemented here so that ExceptionOr.h does not know
+        about bindings. But since this is a template, it will only compile when
+        instantiated and there is no need to include ExceptionOr.h and indirectly
+        the Variant.h header in this header.
+        (WebCore::toJSNewlyCreated): Ditto.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateCallbackImplementation): Refer to JSC::Exception with explicit
+        namespace to avoid ambiguity with WebCore::Exception.
+
+        * dom/DOMImplementation.cpp:
+        (WebCore::DOMImplementation::createDocumentType): Changed to return
+        ExceptionOr.
+        (WebCore::createXMLDocument): Added. Helper used in createDocument.
+        (WebCore::DOMImplementation::getInterface): Deleted. This was unused.
+        (WebCore::DOMImplementation::createDocument): Changed to return
+        ExceptionOr.
+        (WebCore::DOMImplementation::createCSSStyleSheet): Removed the unused
+        ExceptionCode out argument.
+        (WebCore::isValidXMLMIMETypeChar): Deleted. Moved to MIMETypeRegistry.
+        (WebCore::DOMImplementation::isXMLMIMEType): Ditto.
+        (WebCore::DOMImplementation::isTextMIMEType): Ditto.
+
+        * dom/DOMImplementation.h: Changed functions as described above to
+        return ExceptionOr values. Also removed unused getInterface function,
+        and isXMLMIMEType and isTextMIMEType, which both moved to the
+        MIMETypeRegistry class alongside all the other similar MIME type
+        functions.
+
+        * dom/DOMImplementation.idl: Reorganized this to match the IDL files
+        in the specifications a little better. Also removed [RaisesException]
+        since that is only needed for the old legacy ExceptionCode&amp; style.
+
+        * dom/Document.cpp:
+        (WebCore::Document::setXMLVersion): Removed call to the
+        DOMImplementation::hasFeature function since the values passed in
+        unconditionally result in the return value &quot;true&quot;. This is left over
+        either from specification language, or from an ancient version of this
+        code that worked in a &quot;no XML supported&quot; mode.
+        (WebCore::Document::setXMLStandalone): Ditto.
+
+        * dom/Document.h: Removed the ExceptionCode&amp; out argument from setXMLStandalone.
+        * dom/Document.idl: Removed [SetterRaisesException] from xmlStandalone.
+
+        * dom/Exception.h: Added.
+        * dom/ExceptionOr.h: Added.
+
+        * html/HTMLTemplateElement.cpp: Removed unneeded include of DOMImplementation.h.
+
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::createXHRTextDecoder): Use isXMLMIMEType in its new location in
+        MIMETypeRegistry.
+        * inspector/NetworkResourcesData.cpp:
+        (WebCore::createOtherResourceTextDecoder): Ditto.
+
+        * loader/FrameLoader.cpp: Removed unneeded include of DOMImplementation.h.
+
+        * loader/TextResourceDecoder.cpp:
+        (WebCore::TextResourceDecoder::determineContentType): Use isXMLMIMEType in its
+        new location in MIMETypeRegistry.
+
+        * platform/MIMETypeRegistry.cpp:
+        (WebCore::MIMETypeRegistry::isTextMIMEType): Added. Moved here from
+        DOMImplementation.
+        (WebCore::isValidXMLMIMETypeChar): Ditto.
+        (WebCore::MIMETypeRegistry::isXMLMIMEType): Ditto.
+
+        * platform/MIMETypeRegistry.h: Added isXMLMIMEType and isTextMIMEType.
+        Made isUnsupportedTextMIMEType private.
+
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::isSupported): Deleted. This function was never called.
+        * svg/SVGElement.h: Updated for the above change.
+
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::responseIsXML): Use isXMLMIMEType in its new
+        location in MIMETypeRegistry.
+
+        * xml/parser/XMLDocumentParserLibxml2.cpp:
+        (WebCore::XMLDocumentParser::startDocument): Updated since setXMLStandalone
+        no longer can raise an exception.
+
</ins><span class="cx"> 2016-09-03  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unbreak customElements.whenDefined after r205383 with a crash fix
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -3275,6 +3275,8 @@
</span><span class="cx">                 93C4F6EB1108F9A50099D0DB /* AccessibilityScrollbar.h in Headers */ = {isa = PBXBuildFile; fileRef = 93C4F6E91108F9A50099D0DB /* AccessibilityScrollbar.h */; };
</span><span class="cx">                 93CCF0270AF6C52900018E89 /* NavigationAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 93CCF0260AF6C52900018E89 /* NavigationAction.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 93CCF0600AF6CA7600018E89 /* NavigationAction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93CCF05F0AF6CA7600018E89 /* NavigationAction.cpp */; };
</span><ins>+                93D196311D6CAB7600FC7E47 /* ExceptionOr.h in Headers */ = {isa = PBXBuildFile; fileRef = 93D196301D6CAB7600FC7E47 /* ExceptionOr.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                93D196331D6CAB8200FC7E47 /* Exception.h in Headers */ = {isa = PBXBuildFile; fileRef = 93D196321D6CAB8200FC7E47 /* Exception.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 93D4379F1D57B15300AB85EA /* JSMainThreadExecState.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F934D831189F1EE00508D5D /* JSMainThreadExecState.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 93D437A01D57B19A00AB85EA /* CustomElementReactionQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B56C9A81C89312800C456DF /* CustomElementReactionQueue.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 93D437A11D57B3F400AB85EA /* ElementDescendantIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = ADE11F4A18D8311B0078983B /* ElementDescendantIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -10437,6 +10439,8 @@
</span><span class="cx">                 93CA4CA209DF93FA00DF8677 /* svg.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = svg.css; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 93CCF0260AF6C52900018E89 /* NavigationAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigationAction.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 93CCF05F0AF6CA7600018E89 /* NavigationAction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NavigationAction.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                93D196301D6CAB7600FC7E47 /* ExceptionOr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionOr.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                93D196321D6CAB8200FC7E47 /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Exception.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 93D9D53B0DA27E180077216C /* RangeBoundaryPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RangeBoundaryPoint.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 93E227DB0AF589AD00D48324 /* DocumentLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentLoader.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 93E227DD0AF589AD00D48324 /* NetscapePlugInStreamLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapePlugInStreamLoader.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -22996,11 +23000,13 @@
</span><span class="cx">                                 E12EDB7A0B308A78002704B6 /* EventTarget.h */,
</span><span class="cx">                                 85AFA7420AAF298400E84305 /* EventTarget.idl */,
</span><span class="cx">                                 CDCE5CD014633BC900D47CCA /* EventTargetFactory.in */,
</span><ins>+                                93D196321D6CAB8200FC7E47 /* Exception.h */,
</ins><span class="cx">                                 BC60D8F00D2A11E000B9918F /* ExceptionBase.cpp */,
</span><span class="cx">                                 BC60D8F10D2A11E000B9918F /* ExceptionBase.h */,
</span><span class="cx">                                 935FBCF109BA143B00E230B1 /* ExceptionCode.h */,
</span><span class="cx">                                 A7CACDB013CE875B00BBBE3F /* ExceptionCodePlaceholder.cpp */,
</span><span class="cx">                                 A74BB76A13BDA86300FF7BF0 /* ExceptionCodePlaceholder.h */,
</span><ins>+                                93D196301D6CAB7600FC7E47 /* ExceptionOr.h */,
</ins><span class="cx">                                 E47E276716036EDC00EE2AFB /* ExtensionStyleSheets.cpp */,
</span><span class="cx">                                 E47E276416036ED200EE2AFB /* ExtensionStyleSheets.h */,
</span><span class="cx">                                 B6D9D23414EABD260090D75E /* FocusEvent.cpp */,
</span><span class="lines">@@ -25598,6 +25604,7 @@
</span><span class="cx">                                 078E093917D16B2C00420AA1 /* MediaStreamCreationClient.h in Headers */,
</span><span class="cx">                                 078E091617D14D1C00420AA1 /* MediaStreamEvent.h in Headers */,
</span><span class="cx">                                 078E093717D16B2C00420AA1 /* MediaStreamPrivate.h in Headers */,
</span><ins>+                                93D196331D6CAB8200FC7E47 /* Exception.h in Headers */,
</ins><span class="cx">                                 078E091717D14D1C00420AA1 /* MediaStreamRegistry.h in Headers */,
</span><span class="cx">                                 078E091817D14D1C00420AA1 /* MediaStreamTrack.h in Headers */,
</span><span class="cx">                                 078E091917D14D1C00420AA1 /* MediaStreamTrackEvent.h in Headers */,
</span><span class="lines">@@ -26668,6 +26675,7 @@
</span><span class="cx">                                 B2227AD70D00BF220071B782 /* SVGTransform.h in Headers */,
</span><span class="cx">                                 B2227ADA0D00BF220071B782 /* SVGTransformable.h in Headers */,
</span><span class="cx">                                 B2227ADD0D00BF220071B782 /* SVGTransformDistance.h in Headers */,
</span><ins>+                                93D196311D6CAB7600FC7E47 /* ExceptionOr.h in Headers */,
</ins><span class="cx">                                 B2227ADF0D00BF220071B782 /* SVGTransformList.h in Headers */,
</span><span class="cx">                                 08C7136E128956A3001B107E /* SVGTransformListPropertyTearOff.h in Headers */,
</span><span class="cx">                                 B2227AE20D00BF220071B782 /* SVGTRefElement.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMBindingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -23,9 +23,9 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><ins>+#include &quot;DOMWrapperWorld.h&quot;
</ins><span class="cx"> #include &quot;JSDOMGlobalObject.h&quot;
</span><span class="cx"> #include &quot;JSDOMWrapper.h&quot;
</span><del>-#include &quot;DOMWrapperWorld.h&quot;
</del><span class="cx"> #include &quot;ScriptWrappable.h&quot;
</span><span class="cx"> #include &quot;ScriptWrappableInlines.h&quot;
</span><span class="cx"> #include &quot;WebCoreTypedArrayController.h&quot;
</span><span class="lines">@@ -69,8 +69,10 @@
</span><span class="cx"> 
</span><span class="cx"> struct ExceptionCodeWithMessage;
</span><span class="cx"> 
</span><del>-typedef int ExceptionCode;
</del><ins>+template&lt;typename&gt; class ExceptionOr;
</ins><span class="cx"> 
</span><ins>+using ExceptionCode = int;
+
</ins><span class="cx"> struct ExceptionDetails {
</span><span class="cx">     String message;
</span><span class="cx">     int lineNumber { 0 };
</span><span class="lines">@@ -186,6 +188,9 @@
</span><span class="cx"> WEBCORE_EXPORT void setDOMException(JSC::ExecState*, ExceptionCode);
</span><span class="cx"> void setDOMException(JSC::ExecState*, const ExceptionCodeWithMessage&amp;);
</span><span class="cx"> 
</span><ins>+template&lt;typename T&gt; inline JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, ExceptionOr&lt;T&gt;&amp;&amp;);
+template&lt;typename T&gt; inline JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, ExceptionOr&lt;T&gt;&amp;&amp;);
+
</ins><span class="cx"> JSC::JSValue jsString(JSC::ExecState*, const URL&amp;); // empty if the URL is null
</span><span class="cx"> 
</span><span class="cx"> JSC::JSValue jsStringOrNull(JSC::ExecState*, const String&amp;); // null if the string is null
</span><span class="lines">@@ -808,4 +813,23 @@
</span><span class="cx">     return optionalNumber ? JSC::jsNumber(optionalNumber.value()) : JSC::jsNull();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template&lt;typename T&gt; inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, ExceptionOr&lt;T&gt;&amp;&amp; value)
+{
+    if (UNLIKELY(value.hasException())) {
+        setDOMException(state, value.exceptionCode());
+        return JSC::jsUndefined();
+    }
+    return toJS(state, globalObject, value.takeReturnValue());
+}
+
+template&lt;typename T&gt; inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, ExceptionOr&lt;T&gt;&amp;&amp; value)
+{
+    // FIXME: It's really annoying to have two of these functions. Should find a way to combine toJS and toJSNewlyCreated.
+    if (UNLIKELY(value.hasException())) {
+        setDOMException(state, value.exceptionCode());
+        return JSC::jsUndefined();
+    }
+    return toJSNewlyCreated(state, globalObject, value.takeReturnValue());
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -4341,7 +4341,7 @@
</span><span class="cx">                 push(@implContent, &quot;    args.append(&quot; . NativeToJSValue($param, 1, $interface, $paramName, &quot;m_data&quot;) . &quot;);\n&quot;);
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            push(@implContent, &quot;\n    NakedPtr&lt;Exception&gt; returnedException;\n&quot;);
</del><ins>+            push(@implContent, &quot;\n    NakedPtr&lt;JSC::Exception&gt; returnedException;\n&quot;);
</ins><span class="cx"> 
</span><span class="cx">             my $propertyToLookup = &quot;Identifier::fromString(state, \&quot;${functionName}\&quot;)&quot;;
</span><span class="cx">             my $invokeMethod = &quot;JSCallbackData::CallbackType::FunctionOrObject&quot;;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestCallbackcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -108,7 +108,7 @@
</span><span class="cx">     ExecState* state = m_data-&gt;globalObject()-&gt;globalExec();
</span><span class="cx">     MarkedArgumentBuffer args;
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; returnedException;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; returnedException;
</ins><span class="cx">     m_data-&gt;invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(state, &quot;callbackWithNoParam&quot;), returnedException);
</span><span class="cx">     if (returnedException)
</span><span class="cx">         reportException(state, returnedException);
</span><span class="lines">@@ -128,7 +128,7 @@
</span><span class="cx">     MarkedArgumentBuffer args;
</span><span class="cx">     args.append(toJS(state, m_data-&gt;globalObject(), arrayParam));
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; returnedException;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; returnedException;
</ins><span class="cx">     m_data-&gt;invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(state, &quot;callbackWithArrayParam&quot;), returnedException);
</span><span class="cx">     if (returnedException)
</span><span class="cx">         reportException(state, returnedException);
</span><span class="lines">@@ -149,7 +149,7 @@
</span><span class="cx">     args.append(srzParam ? srzParam-&gt;deserialize(state, m_data-&gt;globalObject(), 0) : jsNull());
</span><span class="cx">     args.append(jsStringWithCache(state, strArg));
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; returnedException;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; returnedException;
</ins><span class="cx">     m_data-&gt;invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(state, &quot;callbackWithSerializedScriptValueParam&quot;), returnedException);
</span><span class="cx">     if (returnedException)
</span><span class="cx">         reportException(state, returnedException);
</span><span class="lines">@@ -169,7 +169,7 @@
</span><span class="cx">     MarkedArgumentBuffer args;
</span><span class="cx">     args.append(toJS(state, m_data-&gt;globalObject(), listParam));
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; returnedException;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; returnedException;
</ins><span class="cx">     m_data-&gt;invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(state, &quot;callbackWithStringList&quot;), returnedException);
</span><span class="cx">     if (returnedException)
</span><span class="cx">         reportException(state, returnedException);
</span><span class="lines">@@ -189,7 +189,7 @@
</span><span class="cx">     MarkedArgumentBuffer args;
</span><span class="cx">     args.append(jsBoolean(boolParam));
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; returnedException;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; returnedException;
</ins><span class="cx">     m_data-&gt;invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(state, &quot;callbackWithBoolean&quot;), returnedException);
</span><span class="cx">     if (returnedException)
</span><span class="cx">         reportException(state, returnedException);
</span><span class="lines">@@ -210,7 +210,7 @@
</span><span class="cx">     args.append(jsNumber(longParam));
</span><span class="cx">     args.append(toJS(state, m_data-&gt;globalObject(), testNodeParam));
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; returnedException;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; returnedException;
</ins><span class="cx">     m_data-&gt;invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(state, &quot;callbackRequiresThisToPass&quot;), returnedException);
</span><span class="cx">     if (returnedException)
</span><span class="cx">         reportException(state, returnedException);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestCallbackFunctioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -72,7 +72,7 @@
</span><span class="cx">     ExecState* state = m_data-&gt;globalObject()-&gt;globalExec();
</span><span class="cx">     MarkedArgumentBuffer args;
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; returnedException;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; returnedException;
</ins><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     m_data-&gt;invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), returnedException);
</span><span class="cx">     if (returnedException)
</span><span class="lines">@@ -93,7 +93,7 @@
</span><span class="cx">     MarkedArgumentBuffer args;
</span><span class="cx">     args.append(toJS(state, m_data-&gt;globalObject(), arrayParam));
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; returnedException;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; returnedException;
</ins><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     m_data-&gt;invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), returnedException);
</span><span class="cx">     if (returnedException)
</span><span class="lines">@@ -115,7 +115,7 @@
</span><span class="cx">     args.append(srzParam ? srzParam-&gt;deserialize(state, m_data-&gt;globalObject(), 0) : jsNull());
</span><span class="cx">     args.append(jsStringWithCache(state, strArg));
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; returnedException;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; returnedException;
</ins><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     m_data-&gt;invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), returnedException);
</span><span class="cx">     if (returnedException)
</span><span class="lines">@@ -136,7 +136,7 @@
</span><span class="cx">     MarkedArgumentBuffer args;
</span><span class="cx">     args.append(toJS(state, m_data-&gt;globalObject(), listParam));
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; returnedException;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; returnedException;
</ins><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     m_data-&gt;invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), returnedException);
</span><span class="cx">     if (returnedException)
</span><span class="lines">@@ -157,7 +157,7 @@
</span><span class="cx">     MarkedArgumentBuffer args;
</span><span class="cx">     args.append(jsBoolean(boolParam));
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; returnedException;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; returnedException;
</ins><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     m_data-&gt;invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), returnedException);
</span><span class="cx">     if (returnedException)
</span><span class="lines">@@ -179,7 +179,7 @@
</span><span class="cx">     args.append(jsNumber(longParam));
</span><span class="cx">     args.append(toJS(state, m_data-&gt;globalObject(), testNodeParam));
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; returnedException;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; returnedException;
</ins><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     m_data-&gt;invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), returnedException);
</span><span class="cx">     if (returnedException)
</span></span></pre></div>
<a id="trunkSourceWebCoredomDOMImplementationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DOMImplementation.cpp (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DOMImplementation.cpp        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/dom/DOMImplementation.cpp        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -25,25 +25,25 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;DOMImplementation.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;CSSStyleSheet.h&quot;
</ins><span class="cx"> #include &quot;ContentType.h&quot;
</span><del>-#include &quot;CSSStyleSheet.h&quot;
</del><span class="cx"> #include &quot;DocumentType.h&quot;
</span><span class="cx"> #include &quot;Element.h&quot;
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><ins>+#include &quot;FTPDirectoryDocument.h&quot;
</ins><span class="cx"> #include &quot;Frame.h&quot;
</span><span class="cx"> #include &quot;FrameLoader.h&quot;
</span><span class="cx"> #include &quot;FrameLoaderClient.h&quot;
</span><del>-#include &quot;FTPDirectoryDocument.h&quot;
</del><span class="cx"> #include &quot;HTMLDocument.h&quot;
</span><span class="cx"> #include &quot;HTMLHeadElement.h&quot;
</span><span class="cx"> #include &quot;HTMLTitleElement.h&quot;
</span><span class="cx"> #include &quot;Image.h&quot;
</span><span class="cx"> #include &quot;ImageDocument.h&quot;
</span><ins>+#include &quot;MIMETypeRegistry.h&quot;
</ins><span class="cx"> #include &quot;MainFrame.h&quot;
</span><span class="cx"> #include &quot;MediaDocument.h&quot;
</span><ins>+#include &quot;MediaList.h&quot;
</ins><span class="cx"> #include &quot;MediaPlayer.h&quot;
</span><del>-#include &quot;MediaList.h&quot;
-#include &quot;MIMETypeRegistry.h&quot;
</del><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;PluginData.h&quot;
</span><span class="cx"> #include &quot;PluginDocument.h&quot;
</span><span class="lines">@@ -73,6 +73,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO)
</span><ins>+
</ins><span class="cx"> class DOMImplementationSupportsTypeClient : public MediaPlayerSupportsTypeClient {
</span><span class="cx"> public:
</span><span class="cx">     DOMImplementationSupportsTypeClient(bool needsHacks, const String&amp; host)
</span><span class="lines">@@ -88,6 +89,7 @@
</span><span class="cx">     bool m_needsHacks;
</span><span class="cx">     String m_host;
</span><span class="cx"> };
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> static bool isSupportedSVG10Feature(const String&amp; feature, const String&amp; version)
</span><span class="lines">@@ -207,103 +209,58 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;DocumentType&gt; DOMImplementation::createDocumentType(const String&amp; qualifiedName,
-    const String&amp; publicId, const String&amp; systemId, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;Ref&lt;DocumentType&gt;&gt; DOMImplementation::createDocumentType(const String&amp; qualifiedName, const String&amp; publicId, const String&amp; systemId)
</ins><span class="cx"> {
</span><del>-    String prefix, localName;
-    if (!Document::parseQualifiedName(qualifiedName, prefix, localName, ec))
-        return 0;
</del><ins>+    ExceptionCode ec = 0;
+    String prefix;
+    String localName;
+    Document::parseQualifiedName(qualifiedName, prefix, localName, ec);
+    if (ec)
+        return Exception(ec);
</ins><span class="cx"> 
</span><span class="cx">     return DocumentType::create(m_document, qualifiedName, publicId, systemId);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-DOMImplementation* DOMImplementation::getInterface(const String&amp; /*feature*/)
</del><ins>+static inline Ref&lt;XMLDocument&gt; createXMLDocument(const String&amp; namespaceURI)
</ins><span class="cx"> {
</span><del>-    return 0;
</del><ins>+    if (namespaceURI == SVGNames::svgNamespaceURI)
+        return SVGDocument::create(nullptr, URL());
+    if (namespaceURI == HTMLNames::xhtmlNamespaceURI)
+        return XMLDocument::createXHTML(nullptr, URL());
+    return XMLDocument::create(nullptr, URL());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;XMLDocument&gt; DOMImplementation::createDocument(const String&amp; namespaceURI,
-    const String&amp; qualifiedName, DocumentType* doctype, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;Ref&lt;XMLDocument&gt;&gt; DOMImplementation::createDocument(const String&amp; namespaceURI, const String&amp; qualifiedName, DocumentType* documentType)
</ins><span class="cx"> {
</span><del>-    RefPtr&lt;XMLDocument&gt; doc;
-    if (namespaceURI == SVGNames::svgNamespaceURI)
-        doc = SVGDocument::create(0, URL());
-    else if (namespaceURI == HTMLNames::xhtmlNamespaceURI)
-        doc = XMLDocument::createXHTML(0, URL());
-    else
-        doc = XMLDocument::create(0, URL());
</del><ins>+    auto document = createXMLDocument(namespaceURI);
</ins><span class="cx"> 
</span><del>-    doc-&gt;setSecurityOriginPolicy(m_document.securityOriginPolicy());
</del><ins>+    document-&gt;setSecurityOriginPolicy(m_document.securityOriginPolicy());
</ins><span class="cx"> 
</span><del>-    RefPtr&lt;Node&gt; documentElement;
</del><ins>+    RefPtr&lt;Element&gt; documentElement;
</ins><span class="cx">     if (!qualifiedName.isEmpty()) {
</span><del>-        documentElement = doc-&gt;createElementNS(namespaceURI, qualifiedName, ec);
</del><ins>+        ExceptionCode ec = 0;
+        documentElement = document-&gt;createElementNS(namespaceURI, qualifiedName, ec);
</ins><span class="cx">         if (ec)
</span><del>-            return nullptr;
</del><ins>+            return Exception(ec);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (doctype)
-        doc-&gt;appendChild(*doctype);
</del><ins>+    if (documentType)
+        document-&gt;appendChild(*documentType);
</ins><span class="cx">     if (documentElement)
</span><del>-        doc-&gt;appendChild(*documentElement);
</del><ins>+        document-&gt;appendChild(*documentElement);
</ins><span class="cx"> 
</span><del>-    return doc;
</del><ins>+    return WTFMove(document);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Ref&lt;CSSStyleSheet&gt; DOMImplementation::createCSSStyleSheet(const String&amp;, const String&amp; media, ExceptionCode&amp;)
</del><ins>+Ref&lt;CSSStyleSheet&gt; DOMImplementation::createCSSStyleSheet(const String&amp;, const String&amp; media)
</ins><span class="cx"> {
</span><span class="cx">     // FIXME: Title should be set.
</span><span class="cx">     // FIXME: Media could have wrong syntax, in which case we should generate an exception.
</span><del>-    Ref&lt;CSSStyleSheet&gt; sheet = CSSStyleSheet::create(StyleSheetContents::create());
</del><ins>+    auto sheet = CSSStyleSheet::create(StyleSheetContents::create());
</ins><span class="cx">     sheet-&gt;setMediaQueries(MediaQuerySet::createAllowingDescriptionSyntax(media));
</span><span class="cx">     return sheet;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline bool isValidXMLMIMETypeChar(UChar c)
-{
-    // Valid characters per RFCs 3023 and 2045:
-    // 0-9a-zA-Z_-+~!$^{}|.%'`#&amp;*
-    return isASCIIAlphanumeric(c) || c == '!' || c == '#' || c == '$' || c == '%' || c == '&amp;' || c == '\'' || c == '*' || c == '+'
-        || c == '-' || c == '.' || c == '^' || c == '_' || c == '`' || c == '{' || c == '|' || c == '}' || c == '~';
-}
-
-bool DOMImplementation::isXMLMIMEType(const String&amp; mimeType)
-{
-    // FIXME: Can we move this logic to MIMETypeRegistry and have this just be a single function call?
-
-    if (equalLettersIgnoringASCIICase(mimeType, &quot;text/xml&quot;) || equalLettersIgnoringASCIICase(mimeType, &quot;application/xml&quot;) || equalLettersIgnoringASCIICase(mimeType, &quot;text/xsl&quot;))
-        return true;
-
-    if (!mimeType.endsWith(&quot;+xml&quot;, false))
-        return false;
-
-    size_t slashPosition = mimeType.find('/');
-    // Take into account the '+xml' ending of mimeType.
-    if (slashPosition == notFound || !slashPosition || slashPosition == mimeType.length() - 5)
-        return false;
-
-    // Again, mimeType ends with '+xml', no need to check the validity of that substring.
-    size_t mimeLength = mimeType.length();
-    for (size_t i = 0; i &lt; mimeLength - 4; ++i) {
-        if (!isValidXMLMIMETypeChar(mimeType[i]) &amp;&amp; i != slashPosition)
-            return false;
-    }
-
-    return true;
-}
-
-bool DOMImplementation::isTextMIMEType(const String&amp; mimeType)
-{
-    // FIXME: Can we move this logic to MIMETypeRegistry and have this just be a single function call?
-
-    return MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType)
-        || equalLettersIgnoringASCIICase(mimeType, &quot;application/json&quot;) // Render JSON as text/plain.
-        || (mimeType.startsWith(&quot;text/&quot;, false)
-            &amp;&amp; !equalLettersIgnoringASCIICase(mimeType, &quot;text/html&quot;)
-            &amp;&amp; !equalLettersIgnoringASCIICase(mimeType, &quot;text/xml&quot;)
-            &amp;&amp; !equalLettersIgnoringASCIICase(mimeType, &quot;text/xsl&quot;));
-}
-
</del><span class="cx"> Ref&lt;HTMLDocument&gt; DOMImplementation::createHTMLDocument(const String&amp; title)
</span><span class="cx"> {
</span><span class="cx">     auto document = HTMLDocument::create(nullptr, URL());
</span><span class="lines">@@ -321,6 +278,9 @@
</span><span class="cx"> 
</span><span class="cx"> Ref&lt;Document&gt; DOMImplementation::createDocument(const String&amp; type, Frame* frame, const URL&amp; url)
</span><span class="cx"> {
</span><ins>+    // FIXME: Confusing to have this here with public DOM APIs for creating documents. This is different enough that it should perhaps be moved.
+    // FIXME: This function is doing case insensitive comparisons on MIME types. Should do equalLettersIgnoringASCIICase instead.
+
</ins><span class="cx">     // Plugins cannot take HTML and XHTML from us, and we don't even need to initialize the plugin database for those.
</span><span class="cx">     if (type == &quot;text/html&quot;)
</span><span class="cx">         return HTMLDocument::create(frame, url);
</span><span class="lines">@@ -338,7 +298,7 @@
</span><span class="cx">         return ImageDocument::create(*frame, url);
</span><span class="cx"> 
</span><span class="cx">     PluginData* pluginData = nullptr;
</span><del>-    PluginData::AllowedPluginTypes allowedPluginTypes = PluginData::OnlyApplicationPlugins;
</del><ins>+    auto allowedPluginTypes = PluginData::OnlyApplicationPlugins;
</ins><span class="cx">     if (frame &amp;&amp; frame-&gt;page()) {
</span><span class="cx">         if (frame-&gt;loader().subframeLoader().allowPlugins())
</span><span class="cx">             allowedPluginTypes = PluginData::AllPlugins;
</span><span class="lines">@@ -369,13 +329,13 @@
</span><span class="cx">     // and also serves as an optimization to prevent loading the plug-in database in the common case.
</span><span class="cx">     if (type != &quot;text/plain&quot; &amp;&amp; ((pluginData &amp;&amp; pluginData-&gt;supportsWebVisibleMimeType(type, allowedPluginTypes)) || (frame &amp;&amp; frame-&gt;loader().client().shouldAlwaysUsePluginDocument(type))))
</span><span class="cx">         return PluginDocument::create(frame, url);
</span><del>-    if (isTextMIMEType(type))
</del><ins>+    if (MIMETypeRegistry::isTextMIMEType(type))
</ins><span class="cx">         return TextDocument::create(frame, url);
</span><span class="cx"> 
</span><span class="cx">     if (type == &quot;image/svg+xml&quot;)
</span><span class="cx">         return SVGDocument::create(frame, url);
</span><span class="cx"> 
</span><del>-    if (isXMLMIMEType(type))
</del><ins>+    if (MIMETypeRegistry::isXMLMIMEType(type))
</ins><span class="cx">         return XMLDocument::create(frame, url);
</span><span class="cx"> 
</span><span class="cx">     return HTMLDocument::create(frame, url);
</span></span></pre></div>
<a id="trunkSourceWebCoredomDOMImplementationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DOMImplementation.h (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DOMImplementation.h        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/dom/DOMImplementation.h        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx">  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
</span><span class="cx">  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
</span><span class="cx">  *           (C) 2001 Dirk Mueller (mueller@kde.org)
</span><del>- * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2004, 2005, 2006, 2008, 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="cx">  * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -23,6 +23,7 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><ins>+#include &quot;ExceptionOr.h&quot;
</ins><span class="cx"> #include &quot;XMLDocument.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -36,25 +37,14 @@
</span><span class="cx">     void deref() { m_document.deref(); }
</span><span class="cx">     Document&amp; document() { return m_document; }
</span><span class="cx"> 
</span><del>-    // DOM methods &amp; attributes for DOMImplementation
</del><ins>+    WEBCORE_EXPORT ExceptionOr&lt;Ref&lt;DocumentType&gt;&gt; createDocumentType(const String&amp; qualifiedName, const String&amp; publicId, const String&amp; systemId);
+    WEBCORE_EXPORT ExceptionOr&lt;Ref&lt;XMLDocument&gt;&gt; createDocument(const String&amp; namespaceURI, const String&amp; qualifiedName, DocumentType*);
+    WEBCORE_EXPORT Ref&lt;HTMLDocument&gt; createHTMLDocument(const String&amp; title);
</ins><span class="cx">     WEBCORE_EXPORT static bool hasFeature(const String&amp; feature, const String&amp; version);
</span><del>-    WEBCORE_EXPORT RefPtr&lt;DocumentType&gt; createDocumentType(const String&amp; qualifiedName, const String&amp; publicId, const String&amp; systemId, ExceptionCode&amp;);
-    WEBCORE_EXPORT RefPtr&lt;XMLDocument&gt; createDocument(const String&amp; namespaceURI, const String&amp; qualifiedName, DocumentType*, ExceptionCode&amp;);
</del><ins>+    WEBCORE_EXPORT static Ref&lt;CSSStyleSheet&gt; createCSSStyleSheet(const String&amp; title, const String&amp; media);
</ins><span class="cx"> 
</span><del>-    DOMImplementation* getInterface(const String&amp; feature);
-
-    // From the DOMImplementationCSS interface
-    WEBCORE_EXPORT static Ref&lt;CSSStyleSheet&gt; createCSSStyleSheet(const String&amp; title, const String&amp; media, ExceptionCode&amp;);
-
-    // From the HTMLDOMImplementation interface
-    WEBCORE_EXPORT Ref&lt;HTMLDocument&gt; createHTMLDocument(const String&amp; title);
-
-    // Other methods (not part of DOM)
</del><span class="cx">     static Ref&lt;Document&gt; createDocument(const String&amp; MIMEType, Frame*, const URL&amp;);
</span><span class="cx"> 
</span><del>-    WEBCORE_EXPORT static bool isXMLMIMEType(const String&amp; MIMEType);
-    WEBCORE_EXPORT static bool isTextMIMEType(const String&amp; MIMEType);
-
</del><span class="cx"> private:
</span><span class="cx">     Document&amp; m_document;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoredomDOMImplementationidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DOMImplementation.idl (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DOMImplementation.idl        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/dom/DOMImplementation.idl        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -23,15 +23,14 @@
</span><span class="cx">     GenerateIsReachable=ImplDocument,
</span><span class="cx">     ImplementationLacksVTable,
</span><span class="cx"> ] interface DOMImplementation {
</span><ins>+    [NewObject] DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId);
+    [NewObject] XMLDocument createDocument(DOMString? namespaceURI, [TreatNullAs=EmptyString] DOMString qualifiedName, optional DocumentType? doctype = null);
+    [NewObject] HTMLDocument createHTMLDocument(optional DOMString title);
+
+    // FIXME: Latest DOM specification says this should ignore all arguments and always return true.
</ins><span class="cx">     // FIXME: Using &quot;undefined&quot; as default parameter value is wrong.
</span><span class="cx">     boolean hasFeature(optional DOMString feature = &quot;undefined&quot;, [TreatNullAs=EmptyString] optional DOMString version = &quot;undefined&quot;);
</span><span class="cx"> 
</span><del>-    [RaisesException, NewObject] DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId);
-
-    [NewObject, RaisesException] XMLDocument createDocument(DOMString? namespaceURI, [TreatNullAs=EmptyString] DOMString qualifiedName, optional DocumentType? doctype = null);
-
</del><span class="cx">     // FIXME: Using &quot;undefined&quot; as default parameter value is wrong.
</span><del>-    [RaisesException] CSSStyleSheet createCSSStyleSheet(optional DOMString title = &quot;undefined&quot;, optional DOMString media = &quot;undefined&quot;);
-
-    [NewObject] HTMLDocument createHTMLDocument(optional DOMString title);
</del><ins>+    CSSStyleSheet createCSSStyleSheet(optional DOMString title = &quot;undefined&quot;, optional DOMString media = &quot;undefined&quot;);
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/dom/Document.cpp        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -1373,11 +1373,6 @@
</span><span class="cx"> 
</span><span class="cx"> void Document::setXMLVersion(const String&amp; version, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><del>-    if (!implementation().hasFeature(&quot;XML&quot;, String())) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-
</del><span class="cx">     if (!XMLDocumentParser::supportsXMLVersion(version)) {
</span><span class="cx">         ec = NOT_SUPPORTED_ERR;
</span><span class="cx">         return;
</span><span class="lines">@@ -1386,13 +1381,8 @@
</span><span class="cx">     m_xmlVersion = version;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Document::setXMLStandalone(bool standalone, ExceptionCode&amp; ec)
</del><ins>+void Document::setXMLStandalone(bool standalone)
</ins><span class="cx"> {
</span><del>-    if (!implementation().hasFeature(&quot;XML&quot;, String())) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
-
</del><span class="cx">     m_xmlStandalone = standalone ? Standalone : NotStandalone;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/dom/Document.h        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -442,7 +442,7 @@
</span><span class="cx"> 
</span><span class="cx">     void setXMLEncoding(const String&amp; encoding) { m_xmlEncoding = encoding; } // read-only property, only to be set from XMLDocumentParser
</span><span class="cx">     WEBCORE_EXPORT void setXMLVersion(const String&amp;, ExceptionCode&amp;);
</span><del>-    WEBCORE_EXPORT void setXMLStandalone(bool, ExceptionCode&amp;);
</del><ins>+    WEBCORE_EXPORT void setXMLStandalone(bool);
</ins><span class="cx">     void setHasXMLDeclaration(bool hasXMLDeclaration) { m_hasXMLDeclaration = hasXMLDeclaration ? 1 : 0; }
</span><span class="cx"> 
</span><span class="cx">     String documentURI() const { return m_documentURI; }
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.idl (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.idl        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/dom/Document.idl        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx"> 
</span><span class="cx">     readonly attribute DOMString? xmlEncoding;
</span><span class="cx">     [SetterRaisesException] attribute DOMString? xmlVersion;
</span><del>-    [SetterRaisesException] attribute boolean xmlStandalone;
</del><ins>+    attribute boolean xmlStandalone;
</ins><span class="cx"> 
</span><span class="cx">     [RaisesException] Node adoptNode(Node source);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomExceptionh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/dom/Exception.h (0 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Exception.h                                (rev 0)
+++ trunk/Source/WebCore/dom/Exception.h        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+/*
+
+Copyright (C) 2016 Apple Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1.  Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+2.  Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#pragma once
+
+namespace WebCore {
+
+using ExceptionCode = int;
+
+class Exception {
+public:
+    explicit Exception(ExceptionCode);
+
+    WEBCORE_EXPORT ExceptionCode code() const;
+
+private:
+    ExceptionCode m_code;
+};
+
+inline Exception::Exception(ExceptionCode code)
+    : m_code(code)
+{
+}
+
+inline ExceptionCode Exception::code() const
+{
+    return m_code;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoredomExceptionOrh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/dom/ExceptionOr.h (0 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ExceptionOr.h                                (rev 0)
+++ trunk/Source/WebCore/dom/ExceptionOr.h        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -0,0 +1,72 @@
</span><ins>+/*
+
+Copyright (C) 2016 Apple Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1.  Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+2.  Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#pragma once
+
+#include &quot;Exception.h&quot;
+#include &lt;wtf/Variant.h&gt;
+
+namespace WebCore {
+
+template&lt;typename ReturnType&gt; class ExceptionOr {
+public:
+    ExceptionOr(Exception&amp;&amp;);
+    ExceptionOr(ReturnType&amp;&amp;);
+
+    bool hasException() const;
+    ExceptionCode exceptionCode() const;
+    ReturnType&amp;&amp; takeReturnValue();
+
+private:
+    std::experimental::variant&lt;Exception, ReturnType&gt; m_value;
+};
+
+template&lt;typename ReturnType&gt; inline ExceptionOr&lt;ReturnType&gt;::ExceptionOr(Exception&amp;&amp; exception)
+    : m_value(WTFMove(exception))
+{
+}
+
+template&lt;typename ReturnType&gt; inline ExceptionOr&lt;ReturnType&gt;::ExceptionOr(ReturnType&amp;&amp; returnValue)
+    : m_value(WTFMove(returnValue))
+{
+}
+
+template&lt;typename ReturnType&gt; inline bool ExceptionOr&lt;ReturnType&gt;::hasException() const
+{
+    return std::experimental::holds_alternative&lt;Exception&gt;(m_value);
+}
+
+template&lt;typename ReturnType&gt; inline ExceptionCode ExceptionOr&lt;ReturnType&gt;::exceptionCode() const
+{
+    return std::experimental::get&lt;Exception&gt;(m_value).code();
+}
+
+template&lt;typename ReturnType&gt; inline ReturnType&amp;&amp; ExceptionOr&lt;ReturnType&gt;::takeReturnValue()
+{
+    return std::experimental::get&lt;ReturnType&gt;(WTFMove(m_value));
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTemplateElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTemplateElement.cpp (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTemplateElement.cpp        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/html/HTMLTemplateElement.cpp        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -29,10 +29,8 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><del>-
</del><span class="cx"> #include &quot;HTMLTemplateElement.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;DOMImplementation.h&quot;
</del><span class="cx"> #include &quot;DocumentFragment.h&quot;
</span><span class="cx"> #include &quot;HTMLDocument.h&quot;
</span><span class="cx"> #include &quot;TemplateContentDocumentFragment.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorPageAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -40,7 +40,6 @@
</span><span class="cx"> #include &quot;CachedScript.h&quot;
</span><span class="cx"> #include &quot;Cookie.h&quot;
</span><span class="cx"> #include &quot;CookieJar.h&quot;
</span><del>-#include &quot;DOMImplementation.h&quot;
</del><span class="cx"> #include &quot;DOMPatchSupport.h&quot;
</span><span class="cx"> #include &quot;DOMWrapperWorld.h&quot;
</span><span class="cx"> #include &quot;Document.h&quot;
</span><span class="lines">@@ -59,6 +58,7 @@
</span><span class="cx"> #include &quot;InspectorOverlay.h&quot;
</span><span class="cx"> #include &quot;InspectorTimelineAgent.h&quot;
</span><span class="cx"> #include &quot;InstrumentingAgents.h&quot;
</span><ins>+#include &quot;MIMETypeRegistry.h&quot;
</ins><span class="cx"> #include &quot;MainFrame.h&quot;
</span><span class="cx"> #include &quot;MemoryCache.h&quot;
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="lines">@@ -128,7 +128,7 @@
</span><span class="cx">     RefPtr&lt;TextResourceDecoder&gt; decoder;
</span><span class="cx">     if (!textEncodingName.isEmpty())
</span><span class="cx">         decoder = TextResourceDecoder::create(&quot;text/plain&quot;, textEncodingName);
</span><del>-    else if (DOMImplementation::isXMLMIMEType(mimeType)) {
</del><ins>+    else if (MIMETypeRegistry::isXMLMIMEType(mimeType)) {
</ins><span class="cx">         decoder = TextResourceDecoder::create(&quot;application/xml&quot;);
</span><span class="cx">         decoder-&gt;useLenientXMLDecoding();
</span><span class="cx">     } else if (equalLettersIgnoringASCIICase(mimeType, &quot;text/html&quot;))
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorNetworkResourcesDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/NetworkResourcesData.cpp (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/NetworkResourcesData.cpp        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/inspector/NetworkResourcesData.cpp        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -30,24 +30,18 @@
</span><span class="cx"> #include &quot;NetworkResourcesData.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CachedResource.h&quot;
</span><del>-#include &quot;DOMImplementation.h&quot;
</del><ins>+#include &quot;MIMETypeRegistry.h&quot;
</ins><span class="cx"> #include &quot;ResourceResponse.h&quot;
</span><span class="cx"> #include &quot;SharedBuffer.h&quot;
</span><span class="cx"> #include &quot;TextResourceDecoder.h&quot;
</span><span class="cx"> 
</span><del>-namespace {
-// 100MB
-static const size_t maximumResourcesContentSize = 100 * 1000 * 1000;
-
-// 10MB
-static const size_t maximumSingleResourceContentSize = 10 * 1000 * 1000;
-}
-
</del><span class="cx"> using namespace Inspector;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-// ResourceData
</del><ins>+static const size_t maximumResourcesContentSize = 100 * 1000 * 1000; // 100MB
+static const size_t maximumSingleResourceContentSize = 10 * 1000 * 1000; // 10MB
+
</ins><span class="cx"> NetworkResourcesData::ResourceData::ResourceData(const String&amp; requestId, const String&amp; loaderId)
</span><span class="cx">     : m_requestId(requestId)
</span><span class="cx">     , m_loaderId(loaderId)
</span><span class="lines">@@ -117,7 +111,6 @@
</span><span class="cx">     return contentSizeInBytes(m_content) - dataLength;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// NetworkResourcesData
</del><span class="cx"> NetworkResourcesData::NetworkResourcesData()
</span><span class="cx">     : m_contentSize(0)
</span><span class="cx">     , m_maximumResourcesContentSize(maximumResourcesContentSize)
</span><span class="lines">@@ -141,7 +134,7 @@
</span><span class="cx">     RefPtr&lt;TextResourceDecoder&gt; decoder;
</span><span class="cx">     if (!textEncodingName.isEmpty())
</span><span class="cx">         decoder = TextResourceDecoder::create(&quot;text/plain&quot;, textEncodingName);
</span><del>-    else if (DOMImplementation::isXMLMIMEType(mimeType)) {
</del><ins>+    else if (MIMETypeRegistry::isXMLMIMEType(mimeType)) {
</ins><span class="cx">         decoder = TextResourceDecoder::create(&quot;application/xml&quot;);
</span><span class="cx">         decoder-&gt;useLenientXMLDecoding();
</span><span class="cx">     } else if (equalLettersIgnoringASCIICase(mimeType, &quot;text/html&quot;))
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.cpp        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -45,7 +45,6 @@
</span><span class="cx"> #include &quot;ChromeClient.h&quot;
</span><span class="cx"> #include &quot;ContentFilter.h&quot;
</span><span class="cx"> #include &quot;ContentSecurityPolicy.h&quot;
</span><del>-#include &quot;DOMImplementation.h&quot;
</del><span class="cx"> #include &quot;DOMWindow.h&quot;
</span><span class="cx"> #include &quot;DatabaseManager.h&quot;
</span><span class="cx"> #include &quot;DiagnosticLoggingClient.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderTextResourceDecodercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/TextResourceDecoder.cpp (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/TextResourceDecoder.cpp        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/loader/TextResourceDecoder.cpp        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -23,9 +23,9 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;TextResourceDecoder.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;DOMImplementation.h&quot;
</del><span class="cx"> #include &quot;HTMLMetaCharsetParser.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><ins>+#include &quot;MIMETypeRegistry.h&quot;
</ins><span class="cx"> #include &quot;TextCodec.h&quot;
</span><span class="cx"> #include &quot;TextEncoding.h&quot;
</span><span class="cx"> #include &quot;TextEncodingDetector.h&quot;
</span><span class="lines">@@ -306,7 +306,7 @@
</span><span class="cx">         return CSS;
</span><span class="cx">     if (equalLettersIgnoringASCIICase(mimeType, &quot;text/html&quot;))
</span><span class="cx">         return HTML;
</span><del>-    if (DOMImplementation::isXMLMIMEType(mimeType))
</del><ins>+    if (MIMETypeRegistry::isXMLMIMEType(mimeType))
</ins><span class="cx">         return XML;
</span><span class="cx">     return PlainText;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformMIMETypeRegistrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.cpp (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/MIMETypeRegistry.cpp        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/platform/MIMETypeRegistry.cpp        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2008, 2009 Apple Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2006-2016 Apple Inc.  All rights reserved.
</ins><span class="cx">  * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -29,21 +29,22 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;MediaPlayer.h&quot;
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><del>-#include &lt;wtf/HashSet.h&gt;
</del><span class="cx"> #include &lt;wtf/MainThread.h&gt;
</span><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> #include &lt;wtf/StdLibExtras.h&gt;
</span><del>-#include &lt;wtf/text/StringHash.h&gt;
</del><span class="cx"> 
</span><span class="cx"> #if USE(CG)
</span><span class="cx"> #include &quot;ImageSourceCG.h&quot;
</span><del>-#if !PLATFORM(IOS)
</del><ins>+#include &lt;wtf/RetainPtr.h&gt;
+#endif
+
+#if USE(CG) &amp;&amp; !PLATFORM(IOS)
</ins><span class="cx"> #include &lt;ApplicationServices/ApplicationServices.h&gt;
</span><del>-#else
</del><ins>+#endif
+
+#if PLATFORM(IOS)
</ins><span class="cx"> #include &lt;ImageIO/CGImageDestination.h&gt;
</span><span class="cx"> #endif
</span><del>-#include &lt;wtf/RetainPtr.h&gt;
-#endif
</del><span class="cx"> 
</span><span class="cx"> #if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
</span><span class="cx"> #include &quot;ArchiveFactory.h&quot;
</span><span class="lines">@@ -542,6 +543,47 @@
</span><span class="cx">     return unsupportedTextMIMETypes-&gt;contains(mimeType);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool MIMETypeRegistry::isTextMIMEType(const String&amp; mimeType)
+{
+    return isSupportedJavaScriptMIMEType(mimeType)
+        || equalLettersIgnoringASCIICase(mimeType, &quot;application/json&quot;) // Render JSON as text/plain.
+        || (mimeType.startsWith(&quot;text/&quot;, false)
+            &amp;&amp; !equalLettersIgnoringASCIICase(mimeType, &quot;text/html&quot;)
+            &amp;&amp; !equalLettersIgnoringASCIICase(mimeType, &quot;text/xml&quot;)
+            &amp;&amp; !equalLettersIgnoringASCIICase(mimeType, &quot;text/xsl&quot;));
+}
+
+
+static inline bool isValidXMLMIMETypeChar(UChar c)
+{
+    // Valid characters per RFCs 3023 and 2045: 0-9a-zA-Z_-+~!$^{}|.%'`#&amp;*
+    return isASCIIAlphanumeric(c) || c == '!' || c == '#' || c == '$' || c == '%' || c == '&amp;' || c == '\'' || c == '*' || c == '+'
+        || c == '-' || c == '.' || c == '^' || c == '_' || c == '`' || c == '{' || c == '|' || c == '}' || c == '~';
+}
+
+bool MIMETypeRegistry::isXMLMIMEType(const String&amp; mimeType)
+{
+    if (equalLettersIgnoringASCIICase(mimeType, &quot;text/xml&quot;) || equalLettersIgnoringASCIICase(mimeType, &quot;application/xml&quot;) || equalLettersIgnoringASCIICase(mimeType, &quot;text/xsl&quot;))
+        return true;
+
+    if (!mimeType.endsWith(&quot;+xml&quot;, false))
+        return false;
+
+    size_t slashPosition = mimeType.find('/');
+    // Take into account the '+xml' ending of mimeType.
+    if (slashPosition == notFound || !slashPosition || slashPosition == mimeType.length() - 5)
+        return false;
+
+    // Again, mimeType ends with '+xml', no need to check the validity of that substring.
+    size_t mimeLength = mimeType.length();
+    for (size_t i = 0; i &lt; mimeLength - 4; ++i) {
+        if (!isValidXMLMIMETypeChar(mimeType[i]) &amp;&amp; i != slashPosition)
+            return false;
+    }
+
+    return true;
+}
+
</ins><span class="cx"> bool MIMETypeRegistry::isJavaAppletMIMEType(const String&amp; mimeType)
</span><span class="cx"> {
</span><span class="cx">     // Since this set is very limited and is likely to remain so we won't bother with the overhead
</span><span class="lines">@@ -577,7 +619,7 @@
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     if (mimeType.startsWith(&quot;text/&quot;, false))
</span><del>-        return !MIMETypeRegistry::isUnsupportedTextMIMEType(mimeType);
</del><ins>+        return !isUnsupportedTextMIMEType(mimeType);
</ins><span class="cx"> 
</span><span class="cx">     return false;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformMIMETypeRegistryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.h (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/MIMETypeRegistry.h        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/platform/MIMETypeRegistry.h        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006 Apple Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -13,7 +13,7 @@
</span><span class="cx">  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
</span><span class="cx">  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
</span><span class="cx">  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
</span><del>- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
</del><ins>+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
</ins><span class="cx">  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
</span><span class="cx">  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
</span><span class="cx">  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
</span><span class="lines">@@ -23,13 +23,11 @@
</span><span class="cx">  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef MIMETypeRegistry_h
-#define MIMETypeRegistry_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;wtf/HashSet.h&gt;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> #include &lt;wtf/text/StringHash.h&gt;
</span><del>-#include &lt;wtf/text/WTFString.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -60,16 +58,12 @@
</span><span class="cx">     static bool isSupportedJavaScriptMIMEType(const String&amp; mimeType);    
</span><span class="cx"> 
</span><span class="cx">     // Check to see if a non-image MIME type is suitable for being loaded as a
</span><del>-    // document in a frame.  Includes supported JavaScript MIME types.
</del><ins>+    // document in a frame. Includes supported JavaScript MIME types.
</ins><span class="cx">     WEBCORE_EXPORT static bool isSupportedNonImageMIMEType(const String&amp; mimeType);
</span><span class="cx"> 
</span><span class="cx">     // Check to see if a MIME type is suitable for being loaded using &lt;video&gt; and &lt;audio&gt;.
</span><span class="cx">     WEBCORE_EXPORT static bool isSupportedMediaMIMEType(const String&amp; mimeType);
</span><span class="cx"> 
</span><del>-    // Check to see if the MIME type is not suitable for being loaded as a text
-    // document in a frame. Only valid for MIME types begining with &quot;text/&quot;.
-    static bool isUnsupportedTextMIMEType(const String&amp; mimeType);
-
</del><span class="cx">     // Check to see if a MIME type is a valid Java applet mime type.
</span><span class="cx">     WEBCORE_EXPORT static bool isJavaAppletMIMEType(const String&amp; mimeType);
</span><span class="cx"> 
</span><span class="lines">@@ -86,6 +80,15 @@
</span><span class="cx">     // &quot;text/&quot; and isUnsupportedTextMIMEType() returns false.
</span><span class="cx">     WEBCORE_EXPORT static bool canShowMIMEType(const String&amp; mimeType);
</span><span class="cx"> 
</span><ins>+    // Check to see if a MIME type is one where an XML document should be created
+    // rather than an HTML document.
+    WEBCORE_EXPORT static bool isXMLMIMEType(const String&amp; mimeType);
+
+    // Used in page load algorithm to decide whether to display as a text
+    // document in a frame. Not a good idea to use elsewhere, because that code
+    // makes this test is after many other tests are done on the MIME type.
+    WEBCORE_EXPORT static bool isTextMIMEType(const String&amp; mimeType);
+
</ins><span class="cx">     // FIXME: WebKit coding style says we should not have the word &quot;get&quot; in the names of these functions.
</span><span class="cx">     // FIXME: Would be nice to find a way to avoid exposing these sets, even worse exposing non-const references.
</span><span class="cx">     WEBCORE_EXPORT static HashSet&lt;String, ASCIICaseInsensitiveHash&gt;&amp; getSupportedImageMIMETypes();
</span><span class="lines">@@ -100,10 +103,13 @@
</span><span class="cx">     // FIXME: WebKit coding style says we should not have the word &quot;get&quot; in the name of this function.
</span><span class="cx">     // FIXME: Unclear what the concept of a normalized MIME type is; currently it's a platform-specific notion.
</span><span class="cx">     static String getNormalizedMIMEType(const String&amp;);
</span><ins>+
+private:
+    // Check to see if the MIME type is not suitable for being loaded as a text
+    // document in a frame. Only valid for MIME types begining with &quot;text/&quot;.
+    static bool isUnsupportedTextMIMEType(const String&amp; mimeType);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> const String&amp; defaultMIMEType();
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // MIMETypeRegistry_h
</del></span></pre></div>
<a id="trunkSourceWebCoresvgSVGElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGElement.cpp (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGElement.cpp        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/svg/SVGElement.cpp        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -27,7 +27,6 @@
</span><span class="cx"> #include &quot;SVGElement.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CSSParser.h&quot;
</span><del>-#include &quot;DOMImplementation.h&quot;
</del><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;ElementIterator.h&quot;
</span><span class="cx"> #include &quot;Event.h&quot;
</span><span class="lines">@@ -362,11 +361,6 @@
</span><span class="cx">     ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool SVGElement::isSupported(StringImpl* feature, StringImpl* version) const
-{
-    return DOMImplementation::hasFeature(feature, version);
-}
-
</del><span class="cx"> void SVGElement::removedFrom(ContainerNode&amp; rootParent)
</span><span class="cx"> {
</span><span class="cx">     bool wasInDocument = rootParent.inDocument();
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGElement.h (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGElement.h        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/svg/SVGElement.h        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann &lt;zimmermann@kde.org&gt;
</span><span class="cx">  * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis &lt;buis@kde.org&gt;
</span><del>- * Copyright (C) 2009, 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2009-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2013 Samsung Electronics. All rights reserved.
</span><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="lines">@@ -20,10 +20,8 @@
</span><span class="cx">  * Boston, MA 02110-1301, USA.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef SVGElement_h
-#define SVGElement_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><del>-#include &quot;CSSPropertyNames.h&quot;
</del><span class="cx"> #include &quot;SVGAnimatedString.h&quot;
</span><span class="cx"> #include &quot;SVGLangSpace.h&quot;
</span><span class="cx"> #include &quot;SVGLocatable.h&quot;
</span><span class="lines">@@ -31,7 +29,6 @@
</span><span class="cx"> #include &quot;SVGParsingError.h&quot;
</span><span class="cx"> #include &quot;SVGPropertyInfo.h&quot;
</span><span class="cx"> #include &quot;StyledElement.h&quot;
</span><del>-#include &quot;Timer.h&quot;
</del><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/HashSet.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -86,7 +83,7 @@
</span><span class="cx">     void svgLoadEventTimerFired();
</span><span class="cx">     virtual Timer* svgLoadEventTimer();
</span><span class="cx"> 
</span><del>-    virtual AffineTransform* supplementalTransform() { return 0; }
</del><ins>+    virtual AffineTransform* supplementalTransform() { return nullptr; }
</ins><span class="cx"> 
</span><span class="cx">     void invalidateSVGAttributes() { ensureUniqueElementData().setAnimatedSVGAttributesAreDirty(true); }
</span><span class="cx">     void invalidateSVGPresentationAttributeStyle()
</span><span class="lines">@@ -180,8 +177,6 @@
</span><span class="cx"> private:
</span><span class="cx">     const RenderStyle* computedStyle(PseudoId = NOPSEUDO) final;
</span><span class="cx"> 
</span><del>-    virtual bool isSupported(StringImpl* feature, StringImpl* version) const;
-
</del><span class="cx">     virtual void clearTarget() { }
</span><span class="cx"> 
</span><span class="cx">     void buildPendingResourcesIfNeeded();
</span><span class="lines">@@ -264,5 +259,3 @@
</span><span class="cx"> SPECIALIZE_TYPE_TRAITS_END()
</span><span class="cx"> 
</span><span class="cx"> #include &quot;SVGElementTypeHelpers.h&quot;
</span><del>-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebCorexmlXMLHttpRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -28,7 +28,6 @@
</span><span class="cx"> #include &quot;ContentSecurityPolicy.h&quot;
</span><span class="cx"> #include &quot;CrossOriginAccessControl.h&quot;
</span><span class="cx"> #include &quot;DOMFormData.h&quot;
</span><del>-#include &quot;DOMImplementation.h&quot;
</del><span class="cx"> #include &quot;Event.h&quot;
</span><span class="cx"> #include &quot;EventNames.h&quot;
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><span class="lines">@@ -39,6 +38,7 @@
</span><span class="cx"> #include &quot;InspectorInstrumentation.h&quot;
</span><span class="cx"> #include &quot;JSDOMBinding.h&quot;
</span><span class="cx"> #include &quot;JSDOMWindow.h&quot;
</span><ins>+#include &quot;MIMETypeRegistry.h&quot;
</ins><span class="cx"> #include &quot;MemoryCache.h&quot;
</span><span class="cx"> #include &quot;ParsedContentType.h&quot;
</span><span class="cx"> #include &quot;ResourceError.h&quot;
</span><span class="lines">@@ -59,7 +59,6 @@
</span><span class="cx"> #include &lt;runtime/ArrayBufferView.h&gt;
</span><span class="cx"> #include &lt;runtime/JSCInlines.h&gt;
</span><span class="cx"> #include &lt;runtime/JSLock.h&gt;
</span><del>-#include &lt;wtf/Ref.h&gt;
</del><span class="cx"> #include &lt;wtf/RefCountedLeakCounter.h&gt;
</span><span class="cx"> #include &lt;wtf/StdLibExtras.h&gt;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="lines">@@ -935,7 +934,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool XMLHttpRequest::responseIsXML() const
</span><span class="cx"> {
</span><del>-    return DOMImplementation::isXMLMIMEType(responseMIMEType());
</del><ins>+    return MIMETypeRegistry::isXMLMIMEType(responseMIMEType());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int XMLHttpRequest::status() const
</span></span></pre></div>
<a id="trunkSourceWebCorexmlparserXMLDocumentParserLibxml2cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -1064,7 +1064,7 @@
</span><span class="cx">     if (version)
</span><span class="cx">         document()-&gt;setXMLVersion(toString(version), ASSERT_NO_EXCEPTION);
</span><span class="cx">     if (standalone != StandaloneUnspecified)
</span><del>-        document()-&gt;setXMLStandalone(standaloneInfo == StandaloneYes, ASSERT_NO_EXCEPTION);
</del><ins>+        document()-&gt;setXMLStandalone(standaloneInfo == StandaloneYes);
</ins><span class="cx">     if (encoding)
</span><span class="cx">         document()-&gt;setXMLEncoding(toString(encoding));
</span><span class="cx">     document()-&gt;setHasXMLDeclaration(true);
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebKit/mac/ChangeLog        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2016-09-03  Darin Adler  &lt;darin@apple.com&gt;
+
+        Streamline DOMImplementation, and move it to our new DOM exception system
+        https://bugs.webkit.org/show_bug.cgi?id=161295
+
+        Reviewed by Ryosuke Niwa.
+
+        * DOM/DOMDOMImplementation.mm:
+        (unwrap): Added. Use this instead of the IMPL macro.
+        (-[DOMImplementation dealloc]): Updated to use unwrap.
+        (-[DOMImplementation hasFeature:version:]): Ditto.
+        (-[DOMImplementation createDocumentType:publicId:systemId:]): Updated to work with
+        ExceptionOr.
+        (-[DOMImplementation createDocument:qualifiedName:doctype:]): Ditto.
+        (-[DOMImplementation createCSSStyleSheet:media:]): Removed exception logic since
+        this function can no longer raise an exception.
+        (-[DOMImplementation createHTMLDocument:]): Updated to use unwrap.
+        (-[DOMImplementation hasFeature::]): Changed to call the non-deprecated version
+        rather than duplicating its implementation. Also moved into the category as defined
+        in the header.
+        (-[DOMImplementation createDocumentType:::]): Ditto.
+        (-[DOMImplementation createDocument:::]): Ditto.
+        (-[DOMImplementation createCSSStyleSheet::]): Ditto.
+
+        * DOM/DOMDocument.mm: Removed unneeded include of DOMImplementation.h.
+        (-[DOMDocument setXmlStandalone:]): Updated since setXMLStandalone no longer can
+        raise an exception.
+
+        * WebView/WebFrame.mm:
+        (-[WebFrame _canProvideDocumentSource]): Updated to use isTextMIMEType in its new
+        location in MIMETypeRegistry instead of in DOMImplementation.
+
</ins><span class="cx"> 2016-09-03  Brian Weinstein  &lt;bweinstein@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Implement a stub version of FrameLoaderClient::shouldUseContentExtensionsForURL.
</span></span></pre></div>
<a id="trunkSourceWebKitmacDOMDOMDOMImplementationmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/DOM/DOMDOMImplementation.mm (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/DOM/DOMDOMImplementation.mm        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebKit/mac/DOM/DOMDOMImplementation.mm        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -30,32 +30,29 @@
</span><span class="cx"> #import &quot;DOMDocumentTypeInternal.h&quot;
</span><span class="cx"> #import &quot;DOMHTMLDocumentInternal.h&quot;
</span><span class="cx"> #import &quot;DOMInternal.h&quot;
</span><del>-#import &quot;DOMNodeInternal.h&quot;
</del><span class="cx"> #import &quot;ExceptionHandlers.h&quot;
</span><span class="cx"> #import &lt;WebCore/CSSStyleSheet.h&gt;
</span><span class="cx"> #import &lt;WebCore/DOMImplementation.h&gt;
</span><del>-#import &lt;WebCore/Document.h&gt;
</del><span class="cx"> #import &lt;WebCore/DocumentType.h&gt;
</span><span class="cx"> #import &lt;WebCore/HTMLDocument.h&gt;
</span><span class="cx"> #import &lt;WebCore/JSMainThreadExecState.h&gt;
</span><span class="cx"> #import &lt;WebCore/ThreadCheck.h&gt;
</span><del>-#import &lt;WebCore/URL.h&gt;
</del><span class="cx"> #import &lt;WebCore/WebCoreObjCExtras.h&gt;
</span><span class="cx"> #import &lt;WebCore/WebScriptObjectPrivate.h&gt;
</span><del>-#import &lt;WebCore/XMLDocument.h&gt;
-#import &lt;wtf/GetPtr.h&gt;
</del><span class="cx"> 
</span><del>-#define IMPL reinterpret_cast&lt;WebCore::DOMImplementation*&gt;(_internal)
-
</del><span class="cx"> @implementation DOMImplementation
</span><span class="cx"> 
</span><ins>+static inline WebCore::DOMImplementation&amp; unwrap(DOMImplementation&amp; wrapper)
+{
+    return *reinterpret_cast&lt;WebCore::DOMImplementation*&gt;(wrapper._internal);
+}
+
</ins><span class="cx"> - (void)dealloc
</span><span class="cx"> {
</span><span class="cx">     if (WebCoreObjCScheduleDeallocateOnMainThread([DOMImplementation class], self))
</span><span class="cx">         return;
</span><del>-
</del><span class="cx">     if (_internal)
</span><del>-        IMPL-&gt;deref();
</del><ins>+        unwrap(*self).deref();
</ins><span class="cx">     [super dealloc];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -62,73 +59,61 @@
</span><span class="cx"> - (BOOL)hasFeature:(NSString *)feature version:(NSString *)version
</span><span class="cx"> {
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span><del>-    return IMPL-&gt;hasFeature(feature, version);
</del><ins>+    return unwrap(*self).hasFeature(feature, version);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (BOOL)hasFeature:(NSString *)feature :(NSString *)version
</del><ins>+- (DOMDocumentType *)createDocumentType:(NSString *)qualifiedName publicId:(NSString *)publicId systemId:(NSString *)systemId
</ins><span class="cx"> {
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span><del>-    return IMPL-&gt;hasFeature(feature, version);
</del><ins>+    auto result = unwrap(*self).createDocumentType(qualifiedName, publicId, systemId);
+    if (result.hasException())
+        raiseDOMException(result.exceptionCode());
+    return kit(result.takeReturnValue().ptr());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (DOMDocumentType *)createDocumentType:(NSString *)qualifiedName publicId:(NSString *)publicId systemId:(NSString *)systemId
</del><ins>+- (DOMDocument *)createDocument:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName doctype:(DOMDocumentType *)doctype
</ins><span class="cx"> {
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span><del>-    WebCore::ExceptionCode ec = 0;
-    DOMDocumentType *result = kit(WTF::getPtr(IMPL-&gt;createDocumentType(qualifiedName, publicId, systemId, ec)));
-    raiseOnDOMError(ec);
-    return result;
</del><ins>+    auto result = unwrap(*self).createDocument(namespaceURI, qualifiedName, core(doctype));
+    if (result.hasException())
+        raiseDOMException(result.exceptionCode());
+    return kit(result.takeReturnValue().ptr());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (DOMDocumentType *)createDocumentType:(NSString *)qualifiedName :(NSString *)publicId :(NSString *)systemId
</del><ins>+- (DOMCSSStyleSheet *)createCSSStyleSheet:(NSString *)title media:(NSString *)media
</ins><span class="cx"> {
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span><del>-    WebCore::ExceptionCode ec = 0;
-    DOMDocumentType *result = kit(WTF::getPtr(IMPL-&gt;createDocumentType(qualifiedName, publicId, systemId, ec)));
-    raiseOnDOMError(ec);
-    return result;
</del><ins>+    return kit(unwrap(*self).createCSSStyleSheet(title, media).ptr());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (DOMDocument *)createDocument:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName doctype:(DOMDocumentType *)doctype
</del><ins>+- (DOMHTMLDocument *)createHTMLDocument:(NSString *)title
</ins><span class="cx"> {
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span><del>-    WebCore::ExceptionCode ec = 0;
-    DOMDocument *result = kit(WTF::getPtr(IMPL-&gt;createDocument(namespaceURI, qualifiedName, core(doctype), ec)));
-    raiseOnDOMError(ec);
-    return result;
</del><ins>+    return kit(unwrap(*self).createHTMLDocument(title).ptr());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (DOMDocument *)createDocument:(NSString *)namespaceURI :(NSString *)qualifiedName :(DOMDocumentType *)doctype
</del><ins>+@end
+
+@implementation DOMImplementation (DOMImplementationDeprecated)
+
+- (BOOL)hasFeature:(NSString *)feature :(NSString *)version
</ins><span class="cx"> {
</span><del>-    WebCore::JSMainThreadNullState state;
-    WebCore::ExceptionCode ec = 0;
-    DOMDocument *result = kit(WTF::getPtr(IMPL-&gt;createDocument(namespaceURI, qualifiedName, core(doctype), ec)));
-    raiseOnDOMError(ec);
-    return result;
</del><ins>+    return [self hasFeature:feature version:version];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (DOMCSSStyleSheet *)createCSSStyleSheet:(NSString *)title media:(NSString *)media
</del><ins>+- (DOMDocumentType *)createDocumentType:(NSString *)qualifiedName :(NSString *)publicId :(NSString *)systemId
</ins><span class="cx"> {
</span><del>-    WebCore::JSMainThreadNullState state;
-    WebCore::ExceptionCode ec = 0;
-    DOMCSSStyleSheet *result = kit(WTF::getPtr(IMPL-&gt;createCSSStyleSheet(title, media, ec)));
-    raiseOnDOMError(ec);
-    return result;
</del><ins>+    return [self createDocumentType:qualifiedName publicId:publicId systemId:systemId];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (DOMCSSStyleSheet *)createCSSStyleSheet:(NSString *)title :(NSString *)media
</del><ins>+- (DOMDocument *)createDocument:(NSString *)namespaceURI :(NSString *)qualifiedName :(DOMDocumentType *)doctype
</ins><span class="cx"> {
</span><del>-    WebCore::JSMainThreadNullState state;
-    WebCore::ExceptionCode ec = 0;
-    DOMCSSStyleSheet *result = kit(WTF::getPtr(IMPL-&gt;createCSSStyleSheet(title, media, ec)));
-    raiseOnDOMError(ec);
-    return result;
</del><ins>+    return [self createDocument:namespaceURI qualifiedName:qualifiedName doctype:doctype];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (DOMHTMLDocument *)createHTMLDocument:(NSString *)title
</del><ins>+- (DOMCSSStyleSheet *)createCSSStyleSheet:(NSString *)title :(NSString *)media
</ins><span class="cx"> {
</span><del>-    WebCore::JSMainThreadNullState state;
-    return kit(WTF::getPtr(IMPL-&gt;createHTMLDocument(title)));
</del><ins>+    return [self createCSSStyleSheet:title media:media];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKitmacDOMDOMDocumentmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/DOM/DOMDocument.mm (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/DOM/DOMDocument.mm        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebKit/mac/DOM/DOMDocument.mm        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -46,7 +46,6 @@
</span><span class="cx"> #import &quot;DOMHTMLElementInternal.h&quot;
</span><span class="cx"> #import &quot;DOMHTMLHeadElementInternal.h&quot;
</span><span class="cx"> #import &quot;DOMHTMLScriptElementInternal.h&quot;
</span><del>-#import &lt;WebCore/DOMImplementation.h&gt;
</del><span class="cx"> #import &quot;DOMInternal.h&quot;
</span><span class="cx"> #import &quot;DOMNodeInternal.h&quot;
</span><span class="cx"> #import &quot;DOMNodeIteratorInternal.h&quot;
</span><span class="lines">@@ -147,9 +146,7 @@
</span><span class="cx"> - (void)setXmlStandalone:(BOOL)newXmlStandalone
</span><span class="cx"> {
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span><del>-    WebCore::ExceptionCode ec = 0;
-    IMPL-&gt;setXMLStandalone(newXmlStandalone, ec);
-    raiseOnDOMError(ec);
</del><ins>+    IMPL-&gt;setXMLStandalone(newXmlStandalone);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (NSString *)documentURI
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebFramemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebFrame.mm (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebFrame.mm        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebKit/mac/WebView/WebFrame.mm        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -61,7 +61,6 @@
</span><span class="cx"> #import &lt;WebCore/CachedResourceLoader.h&gt;
</span><span class="cx"> #import &lt;WebCore/Chrome.h&gt;
</span><span class="cx"> #import &lt;WebCore/ColorMac.h&gt;
</span><del>-#import &lt;WebCore/DOMImplementation.h&gt;
</del><span class="cx"> #import &lt;WebCore/DatabaseManager.h&gt;
</span><span class="cx"> #import &lt;WebCore/DocumentFragment.h&gt;
</span><span class="cx"> #import &lt;WebCore/DocumentLoader.h&gt;
</span><span class="lines">@@ -80,6 +79,7 @@
</span><span class="cx"> #import &lt;WebCore/HitTestResult.h&gt;
</span><span class="cx"> #import &lt;WebCore/JSNode.h&gt;
</span><span class="cx"> #import &lt;WebCore/LegacyWebArchive.h&gt;
</span><ins>+#import &lt;WebCore/MIMETypeRegistry.h&gt;
</ins><span class="cx"> #import &lt;WebCore/MainFrame.h&gt;
</span><span class="cx"> #import &lt;WebCore/Page.h&gt;
</span><span class="cx"> #import &lt;WebCore/PlatformEventFactoryMac.h&gt;
</span><span class="lines">@@ -101,9 +101,9 @@
</span><span class="cx"> #import &lt;WebCore/markup.h&gt;
</span><span class="cx"> #import &lt;WebKitSystemInterface.h&gt;
</span><span class="cx"> #import &lt;bindings/ScriptValue.h&gt;
</span><ins>+#import &lt;runtime/JSCJSValue.h&gt;
</ins><span class="cx"> #import &lt;runtime/JSLock.h&gt;
</span><span class="cx"> #import &lt;runtime/JSObject.h&gt;
</span><del>-#import &lt;runtime/JSCJSValue.h&gt;
</del><span class="cx"> #import &lt;wtf/CurrentTime.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="lines">@@ -111,7 +111,6 @@
</span><span class="cx"> #import &quot;WebResource.h&quot;
</span><span class="cx"> #import &quot;WebUIKitDelegate.h&quot;
</span><span class="cx"> #import &lt;WebCore/Document.h&gt;
</span><del>-#import &lt;WebCore/Editor.h&gt;
</del><span class="cx"> #import &lt;WebCore/EditorClient.h&gt;
</span><span class="cx"> #import &lt;WebCore/FocusController.h&gt;
</span><span class="cx"> #import &lt;WebCore/Font.h&gt;
</span><span class="lines">@@ -988,7 +987,7 @@
</span><span class="cx">     String mimeType = frame-&gt;document()-&gt;loader()-&gt;writer().mimeType();
</span><span class="cx">     PluginData* pluginData = frame-&gt;page() ? &amp;frame-&gt;page()-&gt;pluginData() : 0;
</span><span class="cx"> 
</span><del>-    if (WebCore::DOMImplementation::isTextMIMEType(mimeType)
</del><ins>+    if (WebCore::MIMETypeRegistry::isTextMIMEType(mimeType)
</ins><span class="cx">         || Image::supportsType(mimeType)
</span><span class="cx">         || (pluginData &amp;&amp; pluginData-&gt;supportsWebVisibleMimeType(mimeType, PluginData::AllPlugins) &amp;&amp; frame-&gt;loader().subframeLoader().allowPlugins())
</span><span class="cx">         || (pluginData &amp;&amp; pluginData-&gt;supportsWebVisibleMimeType(mimeType, PluginData::OnlyApplicationPlugins)))
</span></span></pre></div>
<a id="trunkSourceWebKitwinChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/ChangeLog (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/ChangeLog        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebKit/win/ChangeLog        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-09-03  Darin Adler  &lt;darin@apple.com&gt;
+
+        Streamline DOMImplementation, and move it to our new DOM exception system
+        https://bugs.webkit.org/show_bug.cgi?id=161295
+
+        Reviewed by Ryosuke Niwa.
+
+        * WebFrame.cpp:
+        (WebFrame::canProvideDocumentSource): Updated to use isXMLMIMEType in its new
+        location in MIMETypeRegistry instead of in DOMImplementation.
+
</ins><span class="cx"> 2016-09-02  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Build fix attempt after r205381.
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebFrame.cpp (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebFrame.cpp        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebKit/win/WebFrame.cpp        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -59,7 +59,6 @@
</span><span class="cx"> #include &lt;WebCore/Document.h&gt;
</span><span class="cx"> #include &lt;WebCore/DocumentLoader.h&gt;
</span><span class="cx"> #include &lt;WebCore/DocumentMarkerController.h&gt;
</span><del>-#include &lt;WebCore/DOMImplementation.h&gt;
</del><span class="cx"> #include &lt;WebCore/DOMWindow.h&gt;
</span><span class="cx"> #include &lt;WebCore/Editor.h&gt;
</span><span class="cx"> #include &lt;WebCore/Event.h&gt;
</span><span class="lines">@@ -81,6 +80,7 @@
</span><span class="cx"> #include &lt;WebCore/HTMLPlugInElement.h&gt;
</span><span class="cx"> #include &lt;WebCore/JSDOMWindow.h&gt;
</span><span class="cx"> #include &lt;WebCore/KeyboardEvent.h&gt;
</span><ins>+#include &lt;WebCore/MIMETypeRegistry.h&gt;
</ins><span class="cx"> #include &lt;WebCore/MainFrame.h&gt;
</span><span class="cx"> #include &lt;WebCore/MouseRelatedEvent.h&gt;
</span><span class="cx"> #include &lt;WebCore/NotImplemented.h&gt;
</span><span class="lines">@@ -1385,7 +1385,7 @@
</span><span class="cx">         BString mimeTypeBStr;
</span><span class="cx">         if (SUCCEEDED(urlResponse-&gt;MIMEType(&amp;mimeTypeBStr))) {
</span><span class="cx">             String mimeType(mimeTypeBStr, SysStringLen(mimeTypeBStr));
</span><del>-            *result = mimeType == &quot;text/html&quot; || WebCore::DOMImplementation::isXMLMIMEType(mimeType);
</del><ins>+            *result = mimeType == &quot;text/html&quot; || WebCore::MIMETypeRegistry::isXMLMIMEType(mimeType);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     return hr;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebKit2/ChangeLog        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-09-03  Darin Adler  &lt;darin@apple.com&gt;
+
+        Streamline DOMImplementation, and move it to our new DOM exception system
+        https://bugs.webkit.org/show_bug.cgi?id=161295
+
+        Reviewed by Ryosuke Niwa.
+
+        * UIProcess/WebFrameProxy.cpp:
+        (WebKit::WebFrameProxy::isDisplayingMarkupDocument): Use isXMLMIMEType in its
+        new location in MIMETypeRegistry rather than in DOMImplementation.
+        (WebKit::WebFrameProxy::isDisplayingPDFDocument): Removed unneeded redundant
+        check for empty string, already done by MIMETypeRegistry.
+
</ins><span class="cx"> 2016-09-03  Brian Weinstein  &lt;bweinstein@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Implement WebFrameLoaderClient::shouldUseContentExtensionsForURL and consult the InjectedBundlePageLoaderClient.
</span><span class="lines">@@ -20,6 +33,16 @@
</span><span class="cx">         or not we should use content extensions for this URL.
</span><span class="cx">         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
</span><span class="cx"> 
</span><ins>+        * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp:
+        (webkit_dom_dom_implementation_create_document_type): Updated to work with ExceptionOr.
+        (webkit_dom_dom_implementation_create_document): Updated to work with ExceptionOr.
+        (webkit_dom_dom_implementation_create_css_style_sheet): Updated since this function
+        can no longer raise an exception.
+
+        * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp:
+        (webkit_dom_document_set_xml_standalone): Updated since this function can no longer
+        raise an exception.
+
</ins><span class="cx"> 2016-09-03  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Move WebKit2 WebInspector files to #pragma once
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebFrameProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebFrameProxy.cpp (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebFrameProxy.cpp        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebKit2/UIProcess/WebFrameProxy.cpp        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -32,7 +32,6 @@
</span><span class="cx"> #include &quot;WebPageMessages.h&quot;
</span><span class="cx"> #include &quot;WebPageProxy.h&quot;
</span><span class="cx"> #include &quot;WebProcessPool.h&quot;
</span><del>-#include &lt;WebCore/DOMImplementation.h&gt;
</del><span class="cx"> #include &lt;WebCore/Image.h&gt;
</span><span class="cx"> #include &lt;WebCore/MIMETypeRegistry.h&gt;
</span><span class="cx"> #include &lt;stdio.h&gt;
</span><span class="lines">@@ -117,15 +116,13 @@
</span><span class="cx"> 
</span><span class="cx"> bool WebFrameProxy::isDisplayingMarkupDocument() const
</span><span class="cx"> {
</span><del>-    // FIXME: This check should be moved to somewhere in WebCore.
-    return m_MIMEType == &quot;text/html&quot; || m_MIMEType == &quot;image/svg+xml&quot; || m_MIMEType == &quot;application/x-webarchive&quot; || DOMImplementation::isXMLMIMEType(m_MIMEType);
</del><ins>+    // FIXME: This should be a call to a single MIMETypeRegistry function; adding a new one if needed.
+    // FIXME: This is doing case sensitive comparisons on MIME types, should be using ASCII case insensitive instead.
+    return m_MIMEType == &quot;text/html&quot; || m_MIMEType == &quot;image/svg+xml&quot; || m_MIMEType == &quot;application/x-webarchive&quot; || MIMETypeRegistry::isXMLMIMEType(m_MIMEType);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool WebFrameProxy::isDisplayingPDFDocument() const
</span><span class="cx"> {
</span><del>-    if (m_MIMEType.isEmpty())
-        return false;
-
</del><span class="cx">     return MIMETypeRegistry::isPDFOrPostScriptMIMEType(m_MIMEType);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMDOMImplementationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -1,6 +1,5 @@
</span><span class="cx"> /*
</span><span class="cx">  *  This file is part of the WebKit open source project.
</span><del>- *  This file has been generated by generate-bindings.pl. DO NOT MODIFY!
</del><span class="cx">  *
</span><span class="cx">  *  This library is free software; you can redistribute it and/or
</span><span class="cx">  *  modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -21,12 +20,8 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;WebKitDOMDOMImplementation.h&quot;
</span><span class="cx"> 
</span><del>-#include &lt;WebCore/CSSImportRule.h&gt;
</del><ins>+#include &quot;ConvertToUTF8String.h&quot;
</ins><span class="cx"> #include &quot;DOMObjectCache.h&quot;
</span><del>-#include &lt;WebCore/Document.h&gt;
-#include &lt;WebCore/ExceptionCode.h&gt;
-#include &lt;WebCore/ExceptionCodeDescription.h&gt;
-#include &lt;WebCore/JSMainThreadExecState.h&gt;
</del><span class="cx"> #include &quot;WebKitDOMCSSStyleSheetPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitDOMDOMImplementationPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitDOMDocumentPrivate.h&quot;
</span><span class="lines">@@ -33,7 +28,11 @@
</span><span class="cx"> #include &quot;WebKitDOMDocumentTypePrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitDOMHTMLDocumentPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitDOMPrivate.h&quot;
</span><del>-#include &quot;ConvertToUTF8String.h&quot;
</del><ins>+#include &lt;WebCore/CSSImportRule.h&gt;
+#include &lt;WebCore/Document.h&gt;
+#include &lt;WebCore/ExceptionCode.h&gt;
+#include &lt;WebCore/ExceptionCodeDescription.h&gt;
+#include &lt;WebCore/JSMainThreadExecState.h&gt;
</ins><span class="cx"> #include &lt;wtf/GetPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/RefPtr.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -131,13 +130,12 @@
</span><span class="cx">     WTF::String convertedQualifiedName = WTF::String::fromUTF8(qualifiedName);
</span><span class="cx">     WTF::String convertedPublicId = WTF::String::fromUTF8(publicId);
</span><span class="cx">     WTF::String convertedSystemId = WTF::String::fromUTF8(systemId);
</span><del>-    WebCore::ExceptionCode ec = 0;
-    RefPtr&lt;WebCore::DocumentType&gt; gobjectResult = WTF::getPtr(item-&gt;createDocumentType(convertedQualifiedName, convertedPublicId, convertedSystemId, ec));
-    if (ec) {
-        WebCore::ExceptionCodeDescription ecdesc(ec);
</del><ins>+    auto result = item-&gt;createDocumentType(convertedQualifiedName, convertedPublicId, convertedSystemId);
+    if (result.hasException()) {
+        WebCore::ExceptionCodeDescription ecdesc(result.exceptionCode());
</ins><span class="cx">         g_set_error_literal(error, g_quark_from_string(&quot;WEBKIT_DOM&quot;), ecdesc.code, ecdesc.name);
</span><span class="cx">     }
</span><del>-    return WebKit::kit(gobjectResult.get());
</del><ins>+    return WebKit::kit(result.takeReturnValue().ptr());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebKitDOMDocument* webkit_dom_dom_implementation_create_document(WebKitDOMDOMImplementation* self, const gchar* namespaceURI, const gchar* qualifiedName, WebKitDOMDocumentType* doctype, GError** error)
</span><span class="lines">@@ -151,13 +149,12 @@
</span><span class="cx">     WTF::String convertedNamespaceURI = WTF::String::fromUTF8(namespaceURI);
</span><span class="cx">     WTF::String convertedQualifiedName = WTF::String::fromUTF8(qualifiedName);
</span><span class="cx">     WebCore::DocumentType* convertedDoctype = WebKit::core(doctype);
</span><del>-    WebCore::ExceptionCode ec = 0;
-    RefPtr&lt;WebCore::Document&gt; gobjectResult = WTF::getPtr(item-&gt;createDocument(convertedNamespaceURI, convertedQualifiedName, convertedDoctype, ec));
-    if (ec) {
-        WebCore::ExceptionCodeDescription ecdesc(ec);
</del><ins>+    auto result = item-&gt;createDocument(convertedNamespaceURI, convertedQualifiedName, convertedDoctype);
+    if (result.hasException()) {
+        WebCore::ExceptionCodeDescription ecdesc(result.exceptionCode());
</ins><span class="cx">         g_set_error_literal(error, g_quark_from_string(&quot;WEBKIT_DOM&quot;), ecdesc.code, ecdesc.name);
</span><span class="cx">     }
</span><del>-    return WebKit::kit(gobjectResult.get());
</del><ins>+    return WebKit::kit(result.takeReturnValue().ptr());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebKitDOMCSSStyleSheet* webkit_dom_dom_implementation_create_css_style_sheet(WebKitDOMDOMImplementation* self, const gchar* title, const gchar* media, GError** error)
</span><span class="lines">@@ -170,12 +167,7 @@
</span><span class="cx">     WebCore::DOMImplementation* item = WebKit::core(self);
</span><span class="cx">     WTF::String convertedTitle = WTF::String::fromUTF8(title);
</span><span class="cx">     WTF::String convertedMedia = WTF::String::fromUTF8(media);
</span><del>-    WebCore::ExceptionCode ec = 0;
-    RefPtr&lt;WebCore::CSSStyleSheet&gt; gobjectResult = WTF::getPtr(item-&gt;createCSSStyleSheet(convertedTitle, convertedMedia, ec));
-    if (ec) {
-        WebCore::ExceptionCodeDescription ecdesc(ec);
-        g_set_error_literal(error, g_quark_from_string(&quot;WEBKIT_DOM&quot;), ecdesc.code, ecdesc.name);
-    }
</del><ins>+    RefPtr&lt;WebCore::CSSStyleSheet&gt; gobjectResult = WTF::getPtr(item-&gt;createCSSStyleSheet(convertedTitle, convertedMedia));
</ins><span class="cx">     return WebKit::kit(gobjectResult.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp (205410 => 205411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp        2016-09-03 23:25:47 UTC (rev 205410)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp        2016-09-03 23:34:00 UTC (rev 205411)
</span><span class="lines">@@ -1,6 +1,5 @@
</span><span class="cx"> /*
</span><span class="cx">  *  This file is part of the WebKit open source project.
</span><del>- *  This file has been generated by generate-bindings.pl. DO NOT MODIFY!
</del><span class="cx">  *
</span><span class="cx">  *  This library is free software; you can redistribute it and/or
</span><span class="cx">  *  modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -21,13 +20,9 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;WebKitDOMDocument.h&quot;
</span><span class="cx"> 
</span><del>-#include &lt;WebCore/CSSImportRule.h&gt;
</del><ins>+#include &quot;ConvertToUTF8String.h&quot;
</ins><span class="cx"> #include &quot;DOMObjectCache.h&quot;
</span><del>-#include &lt;WebCore/Document.h&gt;
-#include &lt;WebCore/ExceptionCode.h&gt;
-#include &lt;WebCore/ExceptionCodeDescription.h&gt;
</del><span class="cx"> #include &quot;GObjectEventListener.h&quot;
</span><del>-#include &lt;WebCore/JSMainThreadExecState.h&gt;
</del><span class="cx"> #include &quot;WebKitDOMAttrPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitDOMCDATASectionPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitDOMCSSStyleDeclarationPrivate.h&quot;
</span><span class="lines">@@ -37,6 +32,7 @@
</span><span class="cx"> #include &quot;WebKitDOMDocumentFragmentPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitDOMDocumentPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitDOMDocumentTypePrivate.h&quot;
</span><ins>+#include &quot;WebKitDOMDocumentUnstable.h&quot;
</ins><span class="cx"> #include &quot;WebKitDOMElementPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitDOMEventPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitDOMEventTarget.h&quot;
</span><span class="lines">@@ -57,8 +53,11 @@
</span><span class="cx"> #include &quot;WebKitDOMXPathExpressionPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitDOMXPathNSResolverPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitDOMXPathResultPrivate.h&quot;
</span><del>-#include &quot;ConvertToUTF8String.h&quot;
-#include &quot;WebKitDOMDocumentUnstable.h&quot;
</del><ins>+#include &lt;WebCore/CSSImportRule.h&gt;
+#include &lt;WebCore/Document.h&gt;
+#include &lt;WebCore/ExceptionCode.h&gt;
+#include &lt;WebCore/ExceptionCodeDescription.h&gt;
+#include &lt;WebCore/JSMainThreadExecState.h&gt;
</ins><span class="cx"> #include &lt;wtf/GetPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/RefPtr.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -1497,13 +1496,7 @@
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span><span class="cx">     g_return_if_fail(WEBKIT_DOM_IS_DOCUMENT(self));
</span><span class="cx">     g_return_if_fail(!error || !*error);
</span><del>-    WebCore::Document* item = WebKit::core(self);
-    WebCore::ExceptionCode ec = 0;
-    item-&gt;setXMLStandalone(value, ec);
-    if (ec) {
-        WebCore::ExceptionCodeDescription ecdesc(ec);
-        g_set_error_literal(error, g_quark_from_string(&quot;WEBKIT_DOM&quot;), ecdesc.code, ecdesc.name);
-    }
</del><ins>+    WebKit::core(self)-&gt;setXMLStandalone(value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> gchar* webkit_dom_document_get_document_uri(WebKitDOMDocument* self)
</span></span></pre>
</div>
</div>

</body>
</html>