<!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>[164036] trunk</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/164036">164036</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-02-13 10:31:45 -0800 (Thu, 13 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Document should be constructable
https://bugs.webkit.org/show_bug.cgi?id=115643

Patch by László Langó &lt;llango.u-szeged@partner.samsung.com&gt; on 2014-02-13
Reviewed by Darin Adler.

Source/WebCore:

http://www.w3.org/TR/2014/WD-dom-20140204/#interface-document
Make Document constructable so that one can do &quot;new Document&quot;
instead of &quot;document.implementation.createHTMLDocument('')&quot;.

Test: fast/dom/Document/document-constructor.html

* dom/Document.cpp:
(WebCore::Document::create):
(WebCore::Document::origin):
* dom/Document.h:
* dom/Document.idl:

LayoutTests:

* fast/dom/Document/document-constructor-expected.txt: Added.
* fast/dom/Document/document-constructor.html: Added.
* fast/dom/dom-constructors-expected.txt:
* fast/dom/dom-constructors.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomdomconstructorsexpectedtxt">trunk/LayoutTests/fast/dom/dom-constructors-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomdomconstructorshtml">trunk/LayoutTests/fast/dom/dom-constructors.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</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>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomDocumentdocumentconstructorexpectedtxt">trunk/LayoutTests/fast/dom/Document/document-constructor-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomDocumentdocumentconstructorhtml">trunk/LayoutTests/fast/dom/Document/document-constructor.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (164035 => 164036)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-02-13 18:07:05 UTC (rev 164035)
+++ trunk/LayoutTests/ChangeLog        2014-02-13 18:31:45 UTC (rev 164036)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-02-13  László Langó  &lt;llango.u-szeged@partner.samsung.com&gt;
+
+        Document should be constructable
+        https://bugs.webkit.org/show_bug.cgi?id=115643
+
+        Reviewed by Darin Adler.
+
+        * fast/dom/Document/document-constructor-expected.txt: Added.
+        * fast/dom/Document/document-constructor.html: Added.
+        * fast/dom/dom-constructors-expected.txt:
+        * fast/dom/dom-constructors.html:
+
</ins><span class="cx"> 2014-02-13  Javier Fernandez  &lt;jfernandez@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Grid Layout] Rename named areas property
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomDocumentdocumentconstructorexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/Document/document-constructor-expected.txt (0 => 164036)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Document/document-constructor-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/Document/document-constructor-expected.txt        2014-02-13 18:31:45 UTC (rev 164036)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+This tests that Document is constructable.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS typeof new Document is &quot;object&quot;
+PASS Object.prototype.toString.call(new Document) is &quot;[object Document]&quot;
+PASS new Document instanceof Document is true
+PASS Object.getPrototypeOf(new Document) is Document.prototype
+PASS document.origin is new Document().origin
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDocumentdocumentconstructorhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/Document/document-constructor.html (0 => 164036)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Document/document-constructor.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/Document/document-constructor.html        2014-02-13 18:31:45 UTC (rev 164036)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+
+description('This tests that Document is constructable.');
+
+shouldBe('typeof new Document', '&quot;object&quot;');
+shouldBe('Object.prototype.toString.call(new Document)', '&quot;[object Document]&quot;');
+shouldBeTrue('new Document instanceof Document');
+shouldBe('Object.getPrototypeOf(new Document)', 'Document.prototype');
+shouldBe('document.origin', 'new Document().origin');
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomdomconstructorsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/dom-constructors-expected.txt (164035 => 164036)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/dom-constructors-expected.txt        2014-02-13 18:07:05 UTC (rev 164035)
+++ trunk/LayoutTests/fast/dom/dom-constructors-expected.txt        2014-02-13 18:31:45 UTC (rev 164036)
</span><span class="lines">@@ -6,7 +6,6 @@
</span><span class="cx"> PASS TryAllocate('Attr') is 'exception'
</span><span class="cx"> PASS TryAllocate('CharacterData') is 'exception'
</span><span class="cx"> PASS TryAllocate('CDATASection') is 'exception'
</span><del>-PASS TryAllocate('Document') is 'exception'
</del><span class="cx"> PASS TryAllocate('DocumentType') is 'exception'
</span><span class="cx"> PASS TryAllocate('Element') is 'exception'
</span><span class="cx"> PASS TryAllocate('Entity') is 'exception'
</span><span class="lines">@@ -131,6 +130,9 @@
</span><span class="cx"> PASS TryAllocate('DOMParser') is '[object DOMParser]'
</span><span class="cx"> PASS TryAllocate('DOMParser') is '[object DOMParser]'
</span><span class="cx"> PASS TryAllocate('DOMParser') is '[object DOMParser]'
</span><ins>+PASS TryAllocate('Document') is '[object Document]'
+PASS TryAllocate('Document') is '[object Document]'
+PASS TryAllocate('Document') is '[object Document]'
</ins><span class="cx"> PASS TryAllocate('DocumentFragment') is '[object DocumentFragment]'
</span><span class="cx"> PASS TryAllocate('DocumentFragment') is '[object DocumentFragment]'
</span><span class="cx"> PASS TryAllocate('DocumentFragment') is '[object DocumentFragment]'
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomdomconstructorshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/dom-constructors.html (164035 => 164036)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/dom-constructors.html        2014-02-13 18:07:05 UTC (rev 164035)
+++ trunk/LayoutTests/fast/dom/dom-constructors.html        2014-02-13 18:31:45 UTC (rev 164036)
</span><span class="lines">@@ -16,7 +16,6 @@
</span><span class="cx">     'Attr',
</span><span class="cx">     'CharacterData',
</span><span class="cx">     'CDATASection',
</span><del>-    'Document',
</del><span class="cx">     'DocumentType',
</span><span class="cx">     'Element',
</span><span class="cx">     'Entity',
</span><span class="lines">@@ -135,6 +134,7 @@
</span><span class="cx"> var objects_constructor = [
</span><span class="cx">     'Comment',
</span><span class="cx">     'DOMParser',
</span><ins>+    'Document',
</ins><span class="cx">     'DocumentFragment',
</span><span class="cx">     'Range',
</span><span class="cx">     'Text',
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (164035 => 164036)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-13 18:07:05 UTC (rev 164035)
+++ trunk/Source/WebCore/ChangeLog        2014-02-13 18:31:45 UTC (rev 164036)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2014-02-13  László Langó  &lt;llango.u-szeged@partner.samsung.com&gt;
+
+        Document should be constructable
+        https://bugs.webkit.org/show_bug.cgi?id=115643
+
+        Reviewed by Darin Adler.
+
+        http://www.w3.org/TR/2014/WD-dom-20140204/#interface-document
+        Make Document constructable so that one can do &quot;new Document&quot;
+        instead of &quot;document.implementation.createHTMLDocument('')&quot;.
+
+        Test: fast/dom/Document/document-constructor.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::create):
+        (WebCore::Document::origin):
+        * dom/Document.h:
+        * dom/Document.idl:
+
</ins><span class="cx"> 2014-02-13  Javier Fernandez  &lt;jfernandez@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Grid Layout] Rename named areas property
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (164035 => 164036)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2014-02-13 18:07:05 UTC (rev 164035)
+++ trunk/Source/WebCore/dom/Document.cpp        2014-02-13 18:31:45 UTC (rev 164036)
</span><span class="lines">@@ -559,6 +559,13 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+PassRefPtr&lt;Document&gt; Document::create(ScriptExecutionContext&amp; context)
+{
+    RefPtr&lt;Document&gt; document = adoptRef(new Document(nullptr, URL()));
+    document-&gt;setSecurityOrigin(context.securityOrigin());
+    return document;
+}
+
</ins><span class="cx"> Document::~Document()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!renderView());
</span><span class="lines">@@ -3757,6 +3764,11 @@
</span><span class="cx">     return String();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+String Document::origin() const
+{
+    return securityOrigin()-&gt;databaseIdentifier();
+}
+
</ins><span class="cx"> String Document::domain() const
</span><span class="cx"> {
</span><span class="cx">     return securityOrigin()-&gt;domain();
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (164035 => 164036)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2014-02-13 18:07:05 UTC (rev 164035)
+++ trunk/Source/WebCore/dom/Document.h        2014-02-13 18:31:45 UTC (rev 164036)
</span><span class="lines">@@ -259,6 +259,8 @@
</span><span class="cx">     {
</span><span class="cx">         return adoptRef(new Document(frame, url, DefaultDocumentClass, NonRenderedPlaceholder));
</span><span class="cx">     }
</span><ins>+    static PassRefPtr&lt;Document&gt; create(ScriptExecutionContext&amp;);
+
</ins><span class="cx">     virtual ~Document();
</span><span class="cx"> 
</span><span class="cx">     MediaQueryMatcher&amp; mediaQueryMatcher();
</span><span class="lines">@@ -841,6 +843,8 @@
</span><span class="cx"> 
</span><span class="cx">     String referrer() const;
</span><span class="cx"> 
</span><ins>+    String origin() const;
+
</ins><span class="cx">     String domain() const;
</span><span class="cx">     void setDomain(const String&amp; newDomain, ExceptionCode&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.idl (164035 => 164036)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.idl        2014-02-13 18:07:05 UTC (rev 164035)
+++ trunk/Source/WebCore/dom/Document.idl        2014-02-13 18:31:45 UTC (rev 164036)
</span><span class="lines">@@ -19,6 +19,8 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> [
</span><ins>+    Constructor,
+    ConstructorCallWith=ScriptExecutionContext,
</ins><span class="cx">     CustomToJSObject,
</span><span class="cx">     JSGenerateToNativeObject,
</span><span class="cx"> ] interface Document : Node {
</span><span class="lines">@@ -351,5 +353,8 @@
</span><span class="cx"> 
</span><span class="cx">     // currentscript API: http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-document-currentscript
</span><span class="cx">     readonly attribute HTMLScriptElement currentScript;
</span><ins>+
+    // http://www.w3.org/TR/2014/WD-dom-20140204/#dom-document-origin
+    readonly attribute DOMString origin;
</ins><span class="cx"> };
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>