<!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>[198178] 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/198178">198178</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2016-03-14 17:39:59 -0700 (Mon, 14 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: Display Content Security Policy hash in details sidebar for script and style elements
https://bugs.webkit.org/show_bug.cgi?id=155466
&lt;rdar://problem/25152480&gt;

Reviewed by Joseph Pecoraro and Timothy Hatcher.

Source/JavaScriptCore:

Add property contentSecurityPolicyHash to store the CSP hash for an HTML style element or an
applicable HTML script element.

* inspector/protocol/DOM.json:

Source/WebCore:

For convenience, display the SHA-256 Content Security Policy (CSP) hash in the node details
sidebar for the selected HTML script element or HTML style element. A CSP script hash is
only applicable to inline JavaScript scripts. Therefore, we will display a hash for HTML
script elements only if they do not have a src attribute.

Tests: inspector/dom/csp-big5-hash.html
       inspector/dom/csp-hash.html

* inspector/InspectorDOMAgent.cpp:
(WebCore::computeContentSecurityPolicySHA256Hash): Added.
(WebCore::InspectorDOMAgent::buildObjectForNode): For an applicable HTML script- or style-
element, pass the computed SHA-256 CSP hash to the Inspector front end.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js: Add English localized string for the CSP hash UI label.
* UserInterface/Models/DOMNode.js:
(WebInspector.DOMNode): Initialize the instance variable this._contentSecurityPolicyHash
with the value passed from the Inspector back end.
(WebInspector.DOMNode.prototype.contentSecurityPolicyHash): Returns the CSP hash for this node.
* UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
(WebInspector.DOMNodeDetailsSidebarPanel): Append a row to the end of section Identity to display
the CSP hash (if applicable).
(WebInspector.DOMNodeDetailsSidebarPanel.prototype.refresh): Query the underlying WebInspector.DOMNode
for the CSP hash of the selected node.

LayoutTests:

Add tests to ensure that the WebInspector.DOMNode object associated with an HTML style element
or applicable HTML script element has a valid CSP hash.

* inspector/dom/csp-big5-hash-expected.txt: Added.
* inspector/dom/csp-big5-hash.html: Added.
* inspector/dom/csp-hash-expected.txt: Added.
* inspector/dom/csp-hash.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorprotocolDOMjson">trunk/Source/JavaScriptCore/inspector/protocol/DOM.json</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorDOMAgentcpp">trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs">trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsDOMNodejs">trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsDOMNodeDetailsSidebarPaneljs">trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectordomcspbig5hashexpectedtxt">trunk/LayoutTests/inspector/dom/csp-big5-hash-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectordomcspbig5hashhtml">trunk/LayoutTests/inspector/dom/csp-big5-hash.html</a></li>
<li><a href="#trunkLayoutTestsinspectordomcsphashexpectedtxt">trunk/LayoutTests/inspector/dom/csp-hash-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectordomcsphashhtml">trunk/LayoutTests/inspector/dom/csp-hash.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (198177 => 198178)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-03-15 00:22:45 UTC (rev 198177)
+++ trunk/LayoutTests/ChangeLog        2016-03-15 00:39:59 UTC (rev 198178)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-03-14  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        Web Inspector: Display Content Security Policy hash in details sidebar for script and style elements
+        https://bugs.webkit.org/show_bug.cgi?id=155466
+        &lt;rdar://problem/25152480&gt;
+
+        Reviewed by Joseph Pecoraro and Timothy Hatcher.
+
+        Add tests to ensure that the WebInspector.DOMNode object associated with an HTML style element
+        or applicable HTML script element has a valid CSP hash.
+
+        * inspector/dom/csp-big5-hash-expected.txt: Added.
+        * inspector/dom/csp-big5-hash.html: Added.
+        * inspector/dom/csp-hash-expected.txt: Added.
+        * inspector/dom/csp-hash.html: Added.
+
</ins><span class="cx"> 2016-03-14  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r194394): &gt;2x slow-down on CDjs
</span></span></pre></div>
<a id="trunkLayoutTestsinspectordomcspbig5hashexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/dom/csp-big5-hash-expected.txt (0 => 198178)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/dom/csp-big5-hash-expected.txt                                (rev 0)
+++ trunk/LayoutTests/inspector/dom/csp-big5-hash-expected.txt        2016-03-15 00:39:59 UTC (rev 198178)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+Test for Content Security Policy hash support on DOM.DOMNode in a document with character set Big5.
+
+
+PASS: Got DOMNode for #stylesheet-1
+PASS: DOMNode has hash sha256-duNBvCmzrFc3RVVqS8ufweBf2QOq1THuEh3UZWP7ZpU=
+
+PASS: Got DOMNode for #script-1
+PASS: DOMNode has hash sha256-0eDk4my9q3qcCQTZ02clVW0RxDNPW9n9lXTCdyGY4Js=
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectordomcspbig5hashhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/dom/csp-big5-hash.html (0 => 198178)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/dom/csp-big5-hash.html                                (rev 0)
+++ trunk/LayoutTests/inspector/dom/csp-big5-hash.html        2016-03-15 00:39:59 UTC (rev 198178)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;Big5&quot;&gt;
+&lt;script src=&quot;../../http/tests/inspector/resources/inspector-test.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+function test() {
+    let testCases = [
+       {selector: &quot;#stylesheet-1&quot;, hash: &quot;sha256-duNBvCmzrFc3RVVqS8ufweBf2QOq1THuEh3UZWP7ZpU=&quot;},
+       {selector: &quot;#script-1&quot;, hash: &quot;sha256-0eDk4my9q3qcCQTZ02clVW0RxDNPW9n9lXTCdyGY4Js=&quot;},
+    ];
+    WebInspector.domTreeManager.requestDocument(function(documentNode) {
+        for (let {selector, hash} of testCases) {
+            WebInspector.domTreeManager.querySelector(documentNode.id, selector, function(nodeId) {
+                let domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+                InspectorTest.log(&quot;&quot;);
+                InspectorTest.expectThat(domNode, `Got DOMNode for ${selector}`);
+                InspectorTest.expectThat(domNode.contentSecurityPolicyHash() === hash, `DOMNode has hash ${hash}`);
+            });
+        }
+        InspectorTest.completeTest();
+    });
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+    &lt;p&gt;Test for Content Security Policy hash support on DOM.DOMNode in a document with character set Big5.&lt;/p&gt;
+    &lt;style id=&quot;stylesheet-1&quot;&gt;#test1 { background-color: blue; } /* \xA4\xF4 */&lt;/style&gt;
+    &lt;script id=&quot;script-1&quot;&gt;var thisIsAnInlineScript = true; // \xA4\xF4&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectordomcsphashexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/dom/csp-hash-expected.txt (0 => 198178)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/dom/csp-hash-expected.txt                                (rev 0)
+++ trunk/LayoutTests/inspector/dom/csp-hash-expected.txt        2016-03-15 00:39:59 UTC (rev 198178)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+Test for Content Security Policy hash support on DOM.DOMNode.
+
+
+PASS: Got DOMNode for #stylesheet-without-whitespace
+PASS: DOMNode has hash sha256-NW7+Fm6YV404pkklaopT0jgCBCmfOAn0K+NtIfyPN4A=
+
+PASS: Got DOMNode for #stylesheet-with-whitespace
+PASS: DOMNode has hash sha256-b5lOENncCyOGrTlLzIlify6a9ddSaiGTBFF/jcYcj0k=
+
+PASS: Got DOMNode for #stylesheet-with-ignored-charset
+PASS: DOMNode has hash sha256-Nyij5I3ne5qy0HQHZD8sKjbedAqMQDJ2riYqGniSYTc=
+
+PASS: Got DOMNode for #script-without-whitespace
+PASS: DOMNode has hash sha256-tVRjKJA9OYKEzYP5h7H2XbuSVgOjLD74/zqHyl+/xOM=
+
+PASS: Got DOMNode for #script-with-whitespace
+PASS: DOMNode has hash sha256-hSQRzSxNGYtVe272nNs1poXibikReR/Y+NfX6TsCqzo=
+
+PASS: Got DOMNode for #script-with-unicode-code-point-00C5
+PASS: DOMNode has hash sha256-YcKgriaBGkU6FsWZXgDLv4Wo5UZ5Qe5hNp6Psb3RJOE=
+
+PASS: Got DOMNode for #script-with-unicode-code-point-212B
+PASS: DOMNode has hash sha256-YcKgriaBGkU6FsWZXgDLv4Wo5UZ5Qe5hNp6Psb3RJOE=
+
+PASS: Got DOMNode for #external-stylesheet
+PASS: DOMNode has hash undefined
+
+PASS: Got DOMNode for #external-script
+PASS: DOMNode has hash undefined
+
+PASS: Got DOMNode for #external-stylesheet
+PASS: DOMNode has hash undefined
+
+PASS: Got DOMNode for #paragraph
+PASS: DOMNode has hash undefined
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectordomcsphashhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/dom/csp-hash.html (0 => 198178)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/dom/csp-hash.html                                (rev 0)
+++ trunk/LayoutTests/inspector/dom/csp-hash.html        2016-03-15 00:39:59 UTC (rev 198178)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;UTF8&quot;&gt;
+&lt;script src=&quot;../../http/tests/inspector/resources/inspector-test.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+function test() {
+    let testCases = [
+        {selector: &quot;#stylesheet-without-whitespace&quot;, hash: &quot;sha256-NW7+Fm6YV404pkklaopT0jgCBCmfOAn0K+NtIfyPN4A=&quot;},
+        {selector: &quot;#stylesheet-with-whitespace&quot;, hash: &quot;sha256-b5lOENncCyOGrTlLzIlify6a9ddSaiGTBFF/jcYcj0k=&quot;},
+        {selector: &quot;#stylesheet-with-ignored-charset&quot;, hash: &quot;sha256-Nyij5I3ne5qy0HQHZD8sKjbedAqMQDJ2riYqGniSYTc=&quot;},
+        {selector: &quot;#script-without-whitespace&quot;, hash: &quot;sha256-tVRjKJA9OYKEzYP5h7H2XbuSVgOjLD74/zqHyl+/xOM=&quot;},
+        {selector: &quot;#script-with-whitespace&quot;, hash: &quot;sha256-hSQRzSxNGYtVe272nNs1poXibikReR/Y+NfX6TsCqzo=&quot;},
+        {selector: &quot;#script-with-unicode-code-point-00C5&quot;, hash: &quot;sha256-YcKgriaBGkU6FsWZXgDLv4Wo5UZ5Qe5hNp6Psb3RJOE=&quot;},
+        {selector: &quot;#script-with-unicode-code-point-212B&quot;, hash: &quot;sha256-YcKgriaBGkU6FsWZXgDLv4Wo5UZ5Qe5hNp6Psb3RJOE=&quot;}, // Same hash as for script #script-with-unicode-code-point-00C5.
+        {selector: &quot;#external-stylesheet&quot;, hash: undefined},
+        {selector: &quot;#external-script&quot;, hash: undefined},
+        {selector: &quot;#external-stylesheet&quot;, hash: undefined},
+        {selector: &quot;#paragraph&quot;, hash: undefined},
+    ];
+
+    WebInspector.domTreeManager.requestDocument(function(documentNode) {
+        for (let {selector, hash} of testCases) {
+            WebInspector.domTreeManager.querySelector(documentNode.id, selector, function(nodeId) {
+                let domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+                InspectorTest.log(&quot;&quot;);
+                InspectorTest.expectThat(domNode, `Got DOMNode for ${selector}`);
+                InspectorTest.expectThat(domNode.contentSecurityPolicyHash() === hash, `DOMNode has hash ${hash}`);
+            });
+        }
+        InspectorTest.completeTest();
+    });
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+    &lt;p&gt;Test for Content Security Policy hash support on DOM.DOMNode.&lt;/p&gt;
+
+    &lt;!-- Elements that can have a Content Security Policy hash --&gt;
+    &lt;style id=&quot;stylesheet-without-whitespace&quot;&gt;#test1 { background-color: blue; }&lt;/style&gt;
+    &lt;style id=&quot;stylesheet-with-whitespace&quot;&gt;
+    #test2 {
+        background-color: yellow;
+    }
+    &lt;/style&gt;
+    &lt;style id=&quot;stylesheet-with-ignored-charset&quot;&gt;
+    @charset &quot;Big5&quot;; /* This should be ignored. */
+    #test3 {
+        background-color: magenta;
+    }
+    &lt;/style&gt;
+
+    &lt;script id=&quot;script-without-whitespace&quot;&gt;var thisIsAnInlineScript = true;&lt;/script&gt;
+    &lt;script id=&quot;script-with-whitespace&quot;&gt;
+        var thisIsAnotherInlineScript = true;
+    &lt;/script&gt;
+    &lt;script id=&quot;script-with-unicode-code-point-00C5&quot;&gt;
+        // Å
+    &lt;/script&gt;
+     &lt;!-- Hash of this script should be equivalent to hash of script script-with-unicode-code-point-00C5. --&gt;
+    &lt;script id=&quot;script-with-unicode-code-point-212B&quot;&gt;
+        // Å
+    &lt;/script&gt;
+
+    &lt;!-- Elements that cannot have a Content Security Policy hash --&gt;
+    &lt;!-- FIXME: We should make this more comprehensive. --&gt;
+    &lt;link id=&quot;external-stylesheet&quot; rel=&quot;stylesheet&quot; href=&quot;&quot;&gt;
+    &lt;script id=&quot;external-script&quot; src=&quot;&quot;&gt;&lt;/script&gt;
+    &lt;p id=&quot;paragraph&quot;&gt;&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (198177 => 198178)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-03-15 00:22:45 UTC (rev 198177)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-03-15 00:39:59 UTC (rev 198178)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-03-14  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        Web Inspector: Display Content Security Policy hash in details sidebar for script and style elements
+        https://bugs.webkit.org/show_bug.cgi?id=155466
+        &lt;rdar://problem/25152480&gt;
+
+        Reviewed by Joseph Pecoraro and Timothy Hatcher.
+
+        Add property contentSecurityPolicyHash to store the CSP hash for an HTML style element or an
+        applicable HTML script element.
+
+        * inspector/protocol/DOM.json:
+
</ins><span class="cx"> 2016-03-14  Joonghun Park  &lt;jh718.park@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Purge PassRefPtr from ArrayBuffer, ArchiveResource, Pasteboard, LegacyWebArchive and DataObjectGtk
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorprotocolDOMjson"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/protocol/DOM.json (198177 => 198178)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/protocol/DOM.json        2016-03-15 00:22:45 UTC (rev 198177)
+++ trunk/Source/JavaScriptCore/inspector/protocol/DOM.json        2016-03-15 00:39:59 UTC (rev 198178)
</span><span class="lines">@@ -51,7 +51,8 @@
</span><span class="cx">                 { &quot;name&quot;: &quot;shadowRoots&quot;, &quot;type&quot;: &quot;array&quot;, &quot;optional&quot;: true, &quot;items&quot;: { &quot;$ref&quot;: &quot;Node&quot; }, &quot;description&quot;: &quot;Shadow root list for given element host.&quot; },
</span><span class="cx">                 { &quot;name&quot;: &quot;templateContent&quot;, &quot;$ref&quot;: &quot;Node&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Content document fragment for template elements&quot; },
</span><span class="cx">                 { &quot;name&quot;: &quot;pseudoElements&quot;, &quot;type&quot;: &quot;array&quot;, &quot;items&quot;: { &quot;$ref&quot;: &quot;Node&quot; }, &quot;optional&quot;: true, &quot;description&quot;: &quot;Pseudo elements associated with this node.&quot; },
</span><del>-                { &quot;name&quot;: &quot;role&quot;, &quot;type&quot;: &quot;string&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Computed value for first recognized role token, default role per element, or overridden role.&quot; }
</del><ins>+                { &quot;name&quot;: &quot;role&quot;, &quot;type&quot;: &quot;string&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Computed value for first recognized role token, default role per element, or overridden role.&quot; },
+                { &quot;name&quot;: &quot;contentSecurityPolicyHash&quot;, &quot;type&quot;: &quot;string&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Computed SHA-256 Content Security Policy hash source for given element.&quot; }
</ins><span class="cx">             ],
</span><span class="cx">             &quot;description&quot;: &quot;DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. DOMNode is a base node mirror type.&quot;
</span><span class="cx">         },
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (198177 => 198178)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-15 00:22:45 UTC (rev 198177)
+++ trunk/Source/WebCore/ChangeLog        2016-03-15 00:39:59 UTC (rev 198178)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2016-03-14  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        Web Inspector: Display Content Security Policy hash in details sidebar for script and style elements
+        https://bugs.webkit.org/show_bug.cgi?id=155466
+        &lt;rdar://problem/25152480&gt;
+
+        Reviewed by Joseph Pecoraro and Timothy Hatcher.
+
+        For convenience, display the SHA-256 Content Security Policy (CSP) hash in the node details
+        sidebar for the selected HTML script element or HTML style element. A CSP script hash is
+        only applicable to inline JavaScript scripts. Therefore, we will display a hash for HTML
+        script elements only if they do not have a src attribute.
+
+        Tests: inspector/dom/csp-big5-hash.html
+               inspector/dom/csp-hash.html
+
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::computeContentSecurityPolicySHA256Hash): Added.
+        (WebCore::InspectorDOMAgent::buildObjectForNode): For an applicable HTML script- or style-
+        element, pass the computed SHA-256 CSP hash to the Inspector front end.
+
</ins><span class="cx"> 2016-03-14  Joonghun Park  &lt;jh718.park@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Purge PassRefPtr from ArrayBuffer, ArchiveResource, Pasteboard, LegacyWebArchive and DataObjectGtk
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorDOMAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (198177 => 198178)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp        2016-03-15 00:22:45 UTC (rev 198177)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp        2016-03-15 00:39:59 UTC (rev 198178)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2009, 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2009, 2015-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2011 Google Inc. All rights reserved.
</span><span class="cx">  * Copyright (C) 2009 Joseph Pecoraro
</span><span class="cx">  *
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx"> #include &quot;ContainerNode.h&quot;
</span><span class="cx"> #include &quot;Cookie.h&quot;
</span><span class="cx"> #include &quot;CookieJar.h&quot;
</span><ins>+#include &quot;CryptoDigest.h&quot;
</ins><span class="cx"> #include &quot;DOMEditor.h&quot;
</span><span class="cx"> #include &quot;DOMPatchSupport.h&quot;
</span><span class="cx"> #include &quot;DOMWindow.h&quot;
</span><span class="lines">@@ -86,6 +87,7 @@
</span><span class="cx"> #include &quot;StyleResolver.h&quot;
</span><span class="cx"> #include &quot;StyleSheetList.h&quot;
</span><span class="cx"> #include &quot;Text.h&quot;
</span><ins>+#include &quot;TextNodeTraversal.h&quot;
</ins><span class="cx"> #include &quot;XPathResult.h&quot;
</span><span class="cx"> #include &quot;htmlediting.h&quot;
</span><span class="cx"> #include &quot;markup.h&quot;
</span><span class="lines">@@ -93,6 +95,7 @@
</span><span class="cx"> #include &lt;inspector/InjectedScript.h&gt;
</span><span class="cx"> #include &lt;inspector/InjectedScriptManager.h&gt;
</span><span class="cx"> #include &lt;runtime/JSCInlines.h&gt;
</span><ins>+#include &lt;wtf/text/Base64.h&gt;
</ins><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -1268,6 +1271,19 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static String computeContentSecurityPolicySHA256Hash(const Element&amp; element)
+{
+    // FIXME: Compute the digest with respect to the raw bytes received from the page.
+    // See &lt;https://bugs.webkit.org/show_bug.cgi?id=155184&gt;.
+    TextEncoding documentEncoding = element.document().textEncoding();
+    const TextEncoding&amp; encodingToUse = documentEncoding.isValid() ? documentEncoding : UTF8Encoding();
+    CString content = encodingToUse.encode(TextNodeTraversal::contentsAsString(element), EntitiesForUnencodables);
+    auto cryptoDigest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_256);
+    cryptoDigest-&gt;addBytes(content.data(), content.length());
+    Vector&lt;uint8_t&gt; digest = cryptoDigest-&gt;computeHash();
+    return makeString(&quot;sha256-&quot;, base64Encode(digest.data(), digest.size()));
+}
+
</ins><span class="cx"> Ref&lt;Inspector::Protocol::DOM::Node&gt; InspectorDOMAgent::buildObjectForNode(Node* node, int depth, NodeToIdMap* nodesMap)
</span><span class="cx"> {
</span><span class="cx">     int id = bind(node, nodesMap);
</span><span class="lines">@@ -1341,6 +1357,9 @@
</span><span class="cx">             value-&gt;setTemplateContent(buildObjectForNode(downcast&lt;HTMLTemplateElement&gt;(element).content(), 0, nodesMap));
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+        if (is&lt;HTMLStyleElement&gt;(element) || (is&lt;HTMLScriptElement&gt;(element) &amp;&amp; !element.fastHasAttribute(HTMLNames::srcAttr)))
+            value-&gt;setContentSecurityPolicyHash(computeContentSecurityPolicySHA256Hash(element));
+
</ins><span class="cx">         if (element.pseudoId()) {
</span><span class="cx">             Inspector::Protocol::DOM::PseudoType pseudoType;
</span><span class="cx">             if (pseudoElementType(element.pseudoId(), &amp;pseudoType))
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (198177 => 198178)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2016-03-15 00:22:45 UTC (rev 198177)
+++ trunk/Source/WebInspectorUI/ChangeLog        2016-03-15 00:39:59 UTC (rev 198178)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2016-03-14  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        Web Inspector: Display Content Security Policy hash in details sidebar for script and style elements
+        https://bugs.webkit.org/show_bug.cgi?id=155466
+        &lt;rdar://problem/25152480&gt;
+
+        Reviewed by Joseph Pecoraro and Timothy Hatcher.
+
+        * Localizations/en.lproj/localizedStrings.js: Add English localized string for the CSP hash UI label.
+        * UserInterface/Models/DOMNode.js:
+        (WebInspector.DOMNode): Initialize the instance variable this._contentSecurityPolicyHash
+        with the value passed from the Inspector back end.
+        (WebInspector.DOMNode.prototype.contentSecurityPolicyHash): Returns the CSP hash for this node.
+        * UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
+        (WebInspector.DOMNodeDetailsSidebarPanel): Append a row to the end of section Identity to display
+        the CSP hash (if applicable).
+        (WebInspector.DOMNodeDetailsSidebarPanel.prototype.refresh): Query the underlying WebInspector.DOMNode
+        for the CSP hash of the selected node.
+
</ins><span class="cx"> 2016-03-14  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: REGRESSION(r197974): HeapAllocationsTimelineView broken, doesn't handle Timeline Sidebar Navigation removal
</span></span></pre></div>
<a id="trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (198177 => 198178)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2016-03-15 00:22:45 UTC (rev 198177)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2016-03-15 00:39:59 UTC (rev 198178)
</span><span class="lines">@@ -188,6 +188,7 @@
</span><span class="cx"> localizedStrings[&quot;Container Regions&quot;] = &quot;Container Regions&quot;;
</span><span class="cx"> localizedStrings[&quot;Content&quot;] = &quot;Content&quot;;
</span><span class="cx"> localizedStrings[&quot;Content Flow&quot;] = &quot;Content Flow&quot;;
</span><ins>+localizedStrings[&quot;CSP Hash&quot;] = &quot;CSP Hash&quot;;
</ins><span class="cx"> localizedStrings[&quot;Content Security Policy violation of directive: %s&quot;] = &quot;Content Security Policy violation of directive: %s&quot;;
</span><span class="cx"> localizedStrings[&quot;Continue script execution (%s or %s)&quot;] = &quot;Continue script execution (%s or %s)&quot;;
</span><span class="cx"> localizedStrings[&quot;Continue to Here&quot;] = &quot;Continue to Here&quot;;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsDOMNodejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js (198177 => 198178)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js        2016-03-15 00:22:45 UTC (rev 198177)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js        2016-03-15 00:39:59 UTC (rev 198178)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2009, 2010 Google Inc. All rights reserved.
</span><span class="cx">  * Copyright (C) 2009 Joseph Pecoraro
</span><del>- * Copyright (C) 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013, 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 are
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx">         this._nodeValue = payload.nodeValue;
</span><span class="cx">         this._pseudoType = payload.pseudoType;
</span><span class="cx">         this._computedRole = payload.role;
</span><ins>+        this._contentSecurityPolicyHash = payload.contentSecurityPolicyHash;
</ins><span class="cx"> 
</span><span class="cx">         if (this._nodeType === Node.DOCUMENT_NODE)
</span><span class="cx">             this.ownerDocument = this;
</span><span class="lines">@@ -228,6 +229,11 @@
</span><span class="cx">         return this._computedRole;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    contentSecurityPolicyHash()
+    {
+        return this._contentSecurityPolicyHash;
+    }
+
</ins><span class="cx">     hasAttributes()
</span><span class="cx">     {
</span><span class="cx">         return this._attributes.length &gt; 0;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsDOMNodeDetailsSidebarPaneljs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js (198177 => 198178)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js        2016-03-15 00:22:45 UTC (rev 198177)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js        2016-03-15 00:39:59 UTC (rev 198178)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-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">@@ -38,8 +38,9 @@
</span><span class="cx">         this._identityNodeTypeRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString(&quot;Type&quot;));
</span><span class="cx">         this._identityNodeNameRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString(&quot;Name&quot;));
</span><span class="cx">         this._identityNodeValueRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString(&quot;Value&quot;));
</span><ins>+        this._identityNodeContentSecurityPolicyHashRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString(&quot;CSP Hash&quot;));
</ins><span class="cx"> 
</span><del>-        var identityGroup = new WebInspector.DetailsSectionGroup([this._identityNodeTypeRow, this._identityNodeNameRow, this._identityNodeValueRow]);
</del><ins>+        var identityGroup = new WebInspector.DetailsSectionGroup([this._identityNodeTypeRow, this._identityNodeNameRow, this._identityNodeValueRow, this._identityNodeContentSecurityPolicyHashRow]);
</ins><span class="cx">         var identitySection = new WebInspector.DetailsSection(&quot;dom-node-identity&quot;, WebInspector.UIString(&quot;Identity&quot;), [identityGroup]);
</span><span class="cx"> 
</span><span class="cx">         this._attributesDataGridRow = new WebInspector.DetailsSectionDataGridRow(null, WebInspector.UIString(&quot;No Attributes&quot;));
</span><span class="lines">@@ -104,6 +105,7 @@
</span><span class="cx">         this._identityNodeTypeRow.value = this._nodeTypeDisplayName();
</span><span class="cx">         this._identityNodeNameRow.value = domNode.nodeNameInCorrectCase();
</span><span class="cx">         this._identityNodeValueRow.value = domNode.nodeValue();
</span><ins>+        this._identityNodeContentSecurityPolicyHashRow.value = domNode.contentSecurityPolicyHash();
</ins><span class="cx"> 
</span><span class="cx">         this._refreshAttributes();
</span><span class="cx">         this._refreshProperties();
</span></span></pre>
</div>
</div>

</body>
</html>