<!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>[161512] trunk/Tools</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/161512">161512</a></dd>
<dt>Author</dt> <dd>brian.holt@samsung.com</dd>
<dt>Date</dt> <dd>2014-01-08 10:30:12 -0800 (Wed, 08 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] Parse Valgrind xml leak files
https://bugs.webkit.org/show_bug.cgi?id=119446

Reviewed by Alejandro G. Castro.

Parse the xml files generated by Valgrind to yield useful
information about the memory leaks.

* Scripts/webkitpy/port/gtk.py:
(GtkPort.__init__):
(GtkPort.setup_test_run): Clear the previous output files before new
run.
(GtkPort.print_leaks_summary):

* Scripts/webkitpy/port/leakdetector_valgrind.py: Added.
Parse the xml files generated by Valgrind and summarise leaks
into an easily understandable list.
(get_text_of):
(get_CDATA_of):
(gather_frames):
(ValgrindError):
(ValgrindError.__init__):
(ValgrindError.__str__):
(ValgrindError.unique_string):
(ValgrindError.error_hash):
(ValgrindError.__hash__):
(ValgrindError.__eq__):
(LeakDetectorValgrind):
(LeakDetectorValgrind.__init__):
(LeakDetectorValgrind._parse_leaks_output):
(LeakDetectorValgrind.leaks_files_in_results_directory):
(LeakDetectorValgrind.clean_leaks_files_from_results_directory):
(LeakDetectorValgrind.parse_and_print_leaks_detail):

* Scripts/webkitpy/port/leakdetector_valgrind_unittest.py: Added.
(make_mock_valgrind_output):
(make_mock_incomplete_valgrind_output):
(make_mock_valgrind_results):
(make_mock_valgrind_results_incomplete):
(make_mock_valgrind_results_empty):
(make_mock_valgrind_results_misformatted):
(LeakDetectorValgrindTest):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_pass):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_incomplete):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_empty):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_misformatted):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_pass):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_incomplete):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_empty):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_misformatted):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptswebkitpyportgtkpy">trunk/Tools/Scripts/webkitpy/port/gtk.py</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsScriptswebkitpyportleakdetector_valgrindpy">trunk/Tools/Scripts/webkitpy/port/leakdetector_valgrind.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportleakdetector_valgrind_unittestpy">trunk/Tools/Scripts/webkitpy/port/leakdetector_valgrind_unittest.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (161511 => 161512)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-01-08 18:29:27 UTC (rev 161511)
+++ trunk/Tools/ChangeLog        2014-01-08 18:30:12 UTC (rev 161512)
</span><span class="lines">@@ -1,3 +1,56 @@
</span><ins>+2014-01-08  Brian Holt  &lt;brian.holt@samsung.com&gt;
+
+        [GTK] Parse Valgrind xml leak files
+        https://bugs.webkit.org/show_bug.cgi?id=119446
+
+        Reviewed by Alejandro G. Castro.
+
+        Parse the xml files generated by Valgrind to yield useful
+        information about the memory leaks.
+
+        * Scripts/webkitpy/port/gtk.py:
+        (GtkPort.__init__):
+        (GtkPort.setup_test_run): Clear the previous output files before new
+        run.
+        (GtkPort.print_leaks_summary):
+
+        * Scripts/webkitpy/port/leakdetector_valgrind.py: Added.
+        Parse the xml files generated by Valgrind and summarise leaks
+        into an easily understandable list.
+        (get_text_of):
+        (get_CDATA_of):
+        (gather_frames):
+        (ValgrindError):
+        (ValgrindError.__init__):
+        (ValgrindError.__str__):
+        (ValgrindError.unique_string):
+        (ValgrindError.error_hash):
+        (ValgrindError.__hash__):
+        (ValgrindError.__eq__):
+        (LeakDetectorValgrind):
+        (LeakDetectorValgrind.__init__):
+        (LeakDetectorValgrind._parse_leaks_output):
+        (LeakDetectorValgrind.leaks_files_in_results_directory):
+        (LeakDetectorValgrind.clean_leaks_files_from_results_directory):
+        (LeakDetectorValgrind.parse_and_print_leaks_detail):
+
+        * Scripts/webkitpy/port/leakdetector_valgrind_unittest.py: Added.
+        (make_mock_valgrind_output):
+        (make_mock_incomplete_valgrind_output):
+        (make_mock_valgrind_results):
+        (make_mock_valgrind_results_incomplete):
+        (make_mock_valgrind_results_empty):
+        (make_mock_valgrind_results_misformatted):
+        (LeakDetectorValgrindTest):
+        (LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_pass):
+        (LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_incomplete):
+        (LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_empty):
+        (LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_misformatted):
+        (LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_pass):
+        (LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_incomplete):
+        (LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_empty):
+        (LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_misformatted):
+
</ins><span class="cx"> 2014-01-08  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r161427.
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportgtkpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/gtk.py (161511 => 161512)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/gtk.py        2014-01-08 18:29:27 UTC (rev 161511)
+++ trunk/Tools/Scripts/webkitpy/port/gtk.py        2014-01-08 18:30:12 UTC (rev 161512)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> from webkitpy.port.xvfbdriver import XvfbDriver
</span><span class="cx"> from webkitpy.port.westondriver import WestonDriver
</span><span class="cx"> from webkitpy.port.linux_get_crash_log import GDBCrashLogGenerator
</span><ins>+from webkitpy.port.leakdetector_valgrind import LeakDetectorValgrind
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> class GtkPort(Port):
</span><span class="lines">@@ -46,6 +47,7 @@
</span><span class="cx">     def __init__(self, *args, **kwargs):
</span><span class="cx">         super(GtkPort, self).__init__(*args, **kwargs)
</span><span class="cx">         self._pulseaudio_sanitizer = PulseAudioSanitizer()
</span><ins>+        self._leakdetector = LeakDetectorValgrind(self._filesystem, self.results_directory())
</ins><span class="cx"> 
</span><span class="cx">         if self.get_option(&quot;leaks&quot;):
</span><span class="cx">             if not self.get_option(&quot;wrapper&quot;):
</span><span class="lines">@@ -81,6 +83,9 @@
</span><span class="cx">         super(GtkPort, self).setup_test_run()
</span><span class="cx">         self._pulseaudio_sanitizer.unload_pulseaudio_module()
</span><span class="cx"> 
</span><ins>+        if self.get_option(&quot;leaks&quot;):
+            self._leakdetector.clean_leaks_files_from_results_directory()
+
</ins><span class="cx">     def clean_up_test_run(self):
</span><span class="cx">         super(GtkPort, self).clean_up_test_run()
</span><span class="cx">         self._pulseaudio_sanitizer.restore_pulseaudio_module()
</span><span class="lines">@@ -159,6 +164,16 @@
</span><span class="cx">     def _port_specific_expectations_files(self):
</span><span class="cx">         return [self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in reversed(self._search_paths())]
</span><span class="cx"> 
</span><ins>+    def print_leaks_summary(self):
+        if not self.get_option('leaks'):
+            return
+        # FIXME: This is a hack, but we don't have a better way to get this information from the workers yet
+        # because we're in the manager process.
+        leaks_files = self._leakdetector.leaks_files_in_results_directory()
+        if not leaks_files:
+            return
+        self._leakdetector.parse_and_print_leaks_detail(leaks_files)
+
</ins><span class="cx">     # FIXME: We should find a way to share this implmentation with Gtk,
</span><span class="cx">     # or teach run-launcher how to call run-safari and move this down to Port.
</span><span class="cx">     def show_results_html_file(self, results_filename):
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportleakdetector_valgrindpy"></a>
<div class="addfile"><h4>Added: trunk/Tools/Scripts/webkitpy/port/leakdetector_valgrind.py (0 => 161512)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/leakdetector_valgrind.py                                (rev 0)
+++ trunk/Tools/Scripts/webkitpy/port/leakdetector_valgrind.py        2014-01-08 18:30:12 UTC (rev 161512)
</span><span class="lines">@@ -0,0 +1,294 @@
</span><ins>+# Copyright (C) 2013 Samsung Electronics. All rights reserved.
+#
+# Based on code from Chromium, copyright as follows:
+#
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+from collections import defaultdict
+import hashlib
+import logging
+import re
+import subprocess
+from xml.dom.minidom import parseString
+from xml.parsers.expat import ExpatError
+
+_log = logging.getLogger(__name__)
+
+
+def get_text_of(top_node, name):
+    &quot;&quot;&quot; Returns all text in all DOM nodes with a certain |name| that are children of |top_node|. &quot;&quot;&quot;
+
+    text = &quot;&quot;
+    for nodes_named in top_node.getElementsByTagName(name):
+        text += &quot;&quot;.join([node.data for node in nodes_named.childNodes
+                         if node.nodeType == node.TEXT_NODE])
+    return text
+
+
+def get_CDATA_of(top_node, name):
+    &quot;&quot;&quot; Returns all CDATA in all DOM nodes with a certain |name| that are children of |top_node|. &quot;&quot;&quot;
+
+    text = &quot;&quot;
+    for nodes_named in top_node.getElementsByTagName(name):
+        text += &quot;&quot;.join([node.data for node in nodes_named.childNodes
+                         if node.nodeType == node.CDATA_SECTION_NODE])
+    if (text == &quot;&quot;):
+        return None
+    return text
+
+
+# Constants that give real names to the abbreviations in valgrind XML output.
+INSTRUCTION_POINTER = &quot;ip&quot;
+OBJECT_FILE = &quot;obj&quot;
+FUNCTION_NAME = &quot;fn&quot;
+SRC_FILE_DIR = &quot;dir&quot;
+SRC_FILE_NAME = &quot;file&quot;
+SRC_LINE = &quot;line&quot;
+
+
+def gather_frames(node, source_dir):
+    frame_dict = lambda frame: {
+        INSTRUCTION_POINTER: get_text_of(frame, INSTRUCTION_POINTER),
+        OBJECT_FILE: get_text_of(frame, OBJECT_FILE),
+        FUNCTION_NAME: get_text_of(frame, FUNCTION_NAME),
+        SRC_FILE_DIR: get_text_of(frame, SRC_FILE_DIR),
+        SRC_FILE_NAME: get_text_of(frame, SRC_FILE_NAME),
+        SRC_LINE: get_text_of(frame, SRC_LINE)}
+
+    return [frame_dict(frame) for frame in node.getElementsByTagName(&quot;frame&quot;)]
+
+
+class ValgrindError:
+
+    def __init__(self, source_dir, error_node):
+        self._kind = get_text_of(error_node, &quot;kind&quot;)
+        self._backtraces = []
+        self._suppression = None
+        self._additional = []
+
+        # Iterate through the nodes, parsing &lt;what|auxwhat&gt;&lt;stack&gt; pairs.
+        description = None
+        for node in error_node.childNodes:
+            if node.localName == &quot;what&quot; or node.localName == &quot;auxwhat&quot;:
+                description = &quot;&quot;.join([n.data for n in node.childNodes
+                                       if n.nodeType == n.TEXT_NODE])
+            elif node.localName == &quot;xwhat&quot;:
+                description = get_text_of(node, &quot;text&quot;)
+            elif node.localName == &quot;stack&quot;:
+                assert description
+                self._backtraces.append([description, gather_frames(node, source_dir)])
+                description = None
+            elif node.localName == &quot;origin&quot;:
+                description = get_text_of(node, &quot;what&quot;)
+                stack = node.getElementsByTagName(&quot;stack&quot;)[0]
+                frames = gather_frames(stack, source_dir)
+                self._backtraces.append([description, frames])
+                description = None
+                stack = None
+                frames = None
+            elif description and node.localName != None:
+                # The lastest description has no stack, e.g. &quot;Address 0x28 is unknown&quot;.
+                self._additional.append(description)
+                description = None
+
+            if node.localName == &quot;suppression&quot;:
+                self._suppression = get_CDATA_of(node, &quot;rawtext&quot;)
+
+    def __str__(self):
+        output = self._kind + &quot;\n&quot;
+        for backtrace in self._backtraces:
+            output += backtrace[0] + &quot;\n&quot;
+            filter = subprocess.Popen(&quot;c++filt -n&quot;, stdin=subprocess.PIPE,
+                                      stdout=subprocess.PIPE,
+                                      stderr=subprocess.STDOUT,
+                                      shell=True,
+                                       close_fds=True)
+            buf = &quot;&quot;
+            for frame in backtrace[1]:
+                buf += (frame[FUNCTION_NAME] or frame[INSTRUCTION_POINTER]) + &quot;\n&quot;
+            (stdoutbuf, stderrbuf) = filter.communicate(buf.encode('latin-1'))
+            demangled_names = stdoutbuf.split(&quot;\n&quot;)
+
+            i = 0
+            for frame in backtrace[1]:
+                output += (&quot;  &quot; + demangled_names[i])
+                i = i + 1
+
+                if frame[SRC_FILE_DIR] != &quot;&quot;:
+                    output += (&quot; (&quot; + frame[SRC_FILE_DIR] + &quot;/&quot; + frame[SRC_FILE_NAME] +
+                               &quot;:&quot; + frame[SRC_LINE] + &quot;)&quot;)
+                else:
+                    output += &quot; (&quot; + frame[OBJECT_FILE] + &quot;)&quot;
+                output += &quot;\n&quot;
+
+        for additional in self._additional:
+            output += additional + &quot;\n&quot;
+
+        assert self._suppression != None, &quot;Your Valgrind doesn't generate &quot; \
+                                           &quot;suppressions - is it too old?&quot;
+
+        output += &quot;Suppression (error hash=#%016X#):\n&quot; % self.error_hash()
+
+        # Widen the suppressions slightly.
+        supp = self._suppression
+        supp = supp.replace(&quot;fun:_Znwj&quot;, &quot;fun:_Znw*&quot;)
+        supp = supp.replace(&quot;fun:_Znwm&quot;, &quot;fun:_Znw*&quot;)
+        supp = supp.replace(&quot;fun:_Znaj&quot;, &quot;fun:_Zna*&quot;)
+        supp = supp.replace(&quot;fun:_Znam&quot;, &quot;fun:_Zna*&quot;)
+
+        # Split into lines so we can enforce length limits.
+        supplines = supp.split(&quot;\n&quot;)
+        supp = None  # to avoid re-use
+
+        # Truncate at line 26 (VG_MAX_SUPP_CALLERS plus 2 for name and type)
+        # (https://bugs.kde.org/show_bug.cgi?id=199468 proposes raising
+        # VG_MAX_SUPP_CALLERS, but we're probably fine with it as is.)
+        newlen = min(26, len(supplines))
+
+        if (len(supplines) &gt; newlen):
+            supplines = supplines[0:newlen]
+            supplines.append(&quot;}&quot;)
+
+        for frame in range(len(supplines)):
+            # Replace the always-changing anonymous namespace prefix with &quot;*&quot;.
+            m = re.match(&quot;( +fun:)_ZN.*_GLOBAL__N_.*\.cc_&quot; +
+                         &quot;[0-9a-fA-F]{8}_[0-9a-fA-F]{8}(.*)&quot;,
+                         supplines[frame])
+            if m:
+                supplines[frame] = &quot;*&quot;.join(m.groups())
+
+        return output + &quot;\n&quot;.join(supplines) + &quot;\n&quot;
+
+    def unique_string(self):
+        rep = self._kind + &quot; &quot;
+        for backtrace in self._backtraces:
+            for frame in backtrace[1]:
+                rep += frame[FUNCTION_NAME]
+
+                if frame[SRC_FILE_DIR] != &quot;&quot;:
+                    rep += frame[SRC_FILE_DIR] + &quot;/&quot; + frame[SRC_FILE_NAME]
+                else:
+                    rep += frame[OBJECT_FILE]
+        return rep
+
+    def error_hash(self):
+        # This is a device-independent hash identifying the suppression.
+        # By printing out this hash we can find duplicate reports between tests and
+        # different shards running on multiple buildbots
+        return int(hashlib.md5(self.unique_string()).hexdigest()[:16], 16)
+
+    def __hash__(self):
+        return hash(self.unique_string())
+
+    def __eq__(self, rhs):
+        return self.unique_string() == rhs
+
+
+class LeakDetectorValgrind(object):
+
+    def __init__(self, filesystem, source_dir):
+        self._filesystem = filesystem
+        self._source_dir = source_dir
+
+        # Contains the set of unique errors.
+        self._errors = set()
+        # Contains all suppressions used.
+        self._suppressions = defaultdict(int)
+
+    def _parse_leaks_output(self, leaks_output):
+        try:
+            parsed_string = parseString(leaks_output)
+        except ExpatError, e:
+            parse_failed = True
+            _log.error(&quot;could not parse %s: %s&quot; % (leaks_output, e))
+            return
+
+        cur_report_errors = set()
+
+        commandline = None
+        preamble = parsed_string.getElementsByTagName(&quot;preamble&quot;)[0]
+        for node in preamble.getElementsByTagName(&quot;line&quot;):
+            if node.localName == &quot;line&quot;:
+                for x in node.childNodes:
+                    if x.nodeType == node.TEXT_NODE and &quot;Command&quot; in x.data:
+                        commandline = x.data
+                        break
+
+        raw_errors = parsed_string.getElementsByTagName(&quot;error&quot;)
+        for raw_error in raw_errors:
+            # Ignore &quot;possible&quot; leaks and InvalidRead/Write by default.
+            if (get_text_of(raw_error, &quot;kind&quot;) != &quot;Leak_PossiblyLost&quot;) and \
+                (get_text_of(raw_error, &quot;kind&quot;) != &quot;Leak_StillReachable&quot;) and \
+                (get_text_of(raw_error, &quot;kind&quot;) != &quot;InvalidWrite&quot;) and \
+                (get_text_of(raw_error, &quot;kind&quot;) != &quot;InvalidRead&quot;):
+                error = ValgrindError(self._source_dir, raw_error)
+                if error not in cur_report_errors:
+                    # We haven't seen such errors doing this report yet...
+                    if error in self._errors:
+                        # ... but we saw it in earlier reports, e.g. previous UI test
+                        cur_report_errors.add(&quot;This error was already printed in &quot;
+                                              &quot;some other test, see 'hash=#%016X#'&quot; % \
+                            error.error_hash())
+                    else:
+                        # ... and we haven't seen it in other tests as well
+                        self._errors.add(error)
+                        cur_report_errors.add(error)
+
+        suppcountlist = parsed_string.getElementsByTagName(&quot;suppcounts&quot;)
+        if len(suppcountlist) &gt; 0:
+            suppcountlist = suppcountlist[0]
+            for node in suppcountlist.getElementsByTagName(&quot;pair&quot;):
+                count = get_text_of(node, &quot;count&quot;)
+                name = get_text_of(node, &quot;name&quot;)
+                self._suppressions[name] += int(count)
+
+        return cur_report_errors
+
+    def leaks_files_in_results_directory(self):
+        return self._filesystem.glob(self._filesystem.join(self._source_dir, &quot;drt-*-leaks.xml&quot;))
+
+    def clean_leaks_files_from_results_directory(self):
+        # Remove old Valgrind xml files before starting this run.
+        leaks_files = self.leaks_files_in_results_directory()
+        for f in leaks_files:
+            self._filesystem.remove(f)
+
+    def parse_and_print_leaks_detail(self, leaks_files):
+        for f in leaks_files:
+            leaks_output = self._filesystem.read_binary_file(f)
+            detected_leaks = self._parse_leaks_output(leaks_output)
+
+        _log.info(&quot;-----------------------------------------------------&quot;)
+        _log.info(&quot;Suppressions used:&quot;)
+        _log.info(&quot;  count name&quot;)
+        for (name, count) in sorted(self._suppressions.items(), key=lambda (k, v): (v, k)):
+            _log.info(&quot;%7d %s&quot; % (count, name))
+        _log.info(&quot;-----------------------------------------------------&quot;)
+
+        if self._errors:
+            _log.info(&quot;Valgrind detected %s leaks:&quot; % len(self._errors))
+            for leak in self._errors:
+                _log.info(leak)
</ins></span></pre></div>
<a id="trunkToolsScriptswebkitpyportleakdetector_valgrind_unittestpy"></a>
<div class="addfile"><h4>Added: trunk/Tools/Scripts/webkitpy/port/leakdetector_valgrind_unittest.py (0 => 161512)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/leakdetector_valgrind_unittest.py                                (rev 0)
+++ trunk/Tools/Scripts/webkitpy/port/leakdetector_valgrind_unittest.py        2014-01-08 18:30:12 UTC (rev 161512)
</span><span class="lines">@@ -0,0 +1,812 @@
</span><ins>+# Copyright (C) 2013 Samsung Electronics. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#    * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#    * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import logging
+import unittest2 as unittest
+
+from webkitpy.common.system.filesystem_mock import MockFileSystem
+from webkitpy.common.system.outputcapture import OutputCapture
+from webkitpy.port.leakdetector_valgrind import LeakDetectorValgrind
+
+
+def make_mock_valgrind_output(process_name, pid, uuid):
+    return &quot;&quot;&quot;&lt;?xml version=&quot;1.0&quot;?&gt;
+
+&lt;valgrindoutput&gt;
+
+&lt;protocolversion&gt;4&lt;/protocolversion&gt;
+&lt;protocoltool&gt;memcheck&lt;/protocoltool&gt;
+
+&lt;preamble&gt;
+  &lt;line&gt;Memcheck, a memory error detector&lt;/line&gt;
+  &lt;line&gt;Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.&lt;/line&gt;
+  &lt;line&gt;Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info&lt;/line&gt;
+  &lt;line&gt;Command: /home/user/WebKit/WebKitBuild/Release/Programs/{process_name} -&lt;/line&gt;
+&lt;/preamble&gt;
+
+&lt;pid&gt;{pid}&lt;/pid&gt;
+&lt;ppid&gt;18577&lt;/ppid&gt;
+&lt;tool&gt;memcheck&lt;/tool&gt;
+
+&lt;args&gt;
+  &lt;vargv&gt;
+    &lt;exe&gt;/usr/bin/valgrind.bin&lt;/exe&gt;
+    &lt;arg&gt;--tool=memcheck&lt;/arg&gt;
+    &lt;arg&gt;--num-callers=40&lt;/arg&gt;
+    &lt;arg&gt;--demangle=no&lt;/arg&gt;
+    &lt;arg&gt;--trace-children=no&lt;/arg&gt;
+    &lt;arg&gt;--smc-check=all-non-file&lt;/arg&gt;
+    &lt;arg&gt;--leak-check=yes&lt;/arg&gt;
+    &lt;arg&gt;--leak-resolution=high&lt;/arg&gt;
+    &lt;arg&gt;--show-possibly-lost=no&lt;/arg&gt;
+    &lt;arg&gt;--show-reachable=no&lt;/arg&gt;
+    &lt;arg&gt;--leak-check=full&lt;/arg&gt;
+    &lt;arg&gt;--undef-value-errors=no&lt;/arg&gt;
+    &lt;arg&gt;--gen-suppressions=all&lt;/arg&gt;
+    &lt;arg&gt;--xml=yes&lt;/arg&gt;
+    &lt;arg&gt;--xml-file=/home/user/WebKit/WebKitBuild/Release/layout-test-results/drt-{pid}-{uuid}-leaks.xml&lt;/arg&gt;
+    &lt;arg&gt;--suppressions=/home/user/WebKit/Tools/Scripts/valgrind/suppressions.txt&lt;/arg&gt;
+    &lt;arg&gt;--suppressions=/usr/lib/valgrind/debian-libc6-dbg.supp&lt;/arg&gt;
+  &lt;/vargv&gt;
+  &lt;argv&gt;
+    &lt;exe&gt;/home/user/WebKit/WebKitBuild/Release/Programs/{process_name}&lt;/exe&gt;
+    &lt;arg&gt;-&lt;/arg&gt;
+  &lt;/argv&gt;
+&lt;/args&gt;
+
+&lt;status&gt;
+  &lt;state&gt;RUNNING&lt;/state&gt;
+  &lt;time&gt;00:00:00:00.024 &lt;/time&gt;
+&lt;/status&gt;
+
+
+&lt;status&gt;
+  &lt;state&gt;FINISHED&lt;/state&gt;
+  &lt;time&gt;00:00:00:54.186 &lt;/time&gt;
+&lt;/status&gt;
+
+&lt;error&gt;
+  &lt;unique&gt;0x1a4&lt;/unique&gt;
+  &lt;tid&gt;1&lt;/tid&gt;
+  &lt;kind&gt;Leak_DefinitelyLost&lt;/kind&gt;
+  &lt;xwhat&gt;
+    &lt;text&gt;8 bytes in 1 blocks are definitely lost in loss record 421 of 7,972&lt;/text&gt;
+    &lt;leakedbytes&gt;8&lt;/leakedbytes&gt;
+    &lt;leakedblocks&gt;1&lt;/leakedblocks&gt;
+  &lt;/xwhat&gt;
+  &lt;stack&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x4C2AF8E&lt;/ip&gt;
+      &lt;obj&gt;/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so&lt;/obj&gt;
+      &lt;fn&gt;_Znwm&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x6839DEC&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;_ZNSt14_Function_base13_Base_managerIZN7WebCore13PolicyChecker21checkNavigationPolicyERKNS1_15ResourceRequestEPNS1_14DocumentLoaderEN3WTF10PassRefPtrINS1_9FormStateEEEPFvPvS5_SB_bESC_EUlNS1_12PolicyActionEE_E10_M_managerERSt9_Any_dataRKSI_St18_Manager_operation&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x61E7B03&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;webkit_web_policy_decision_new&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x61CBA6D&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;_ZN6WebKit17FrameLoaderClient39dispatchDecidePolicyForNavigationActionERKN7WebCore16NavigationActionERKNS1_15ResourceRequestEN3WTF10PassRefPtrINS1_9FormStateEEESt8functionIFvNS1_12PolicyActionEEE&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x683DF52&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;_ZN7WebCore13PolicyChecker21checkNavigationPolicyERKNS_15ResourceRequestEPNS_14DocumentLoaderEN3WTF10PassRefPtrINS_9FormStateEEEPFvPvS3_S9_bESA_&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x6817EFC&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;_ZN7WebCore11FrameLoader22loadWithDocumentLoaderEPNS_14DocumentLoaderENS_13FrameLoadTypeEN3WTF10PassRefPtrINS_9FormStateEEE&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x6818729&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;_ZN7WebCore11FrameLoader4loadEPNS_14DocumentLoaderE&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x6818A3A&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;_ZN7WebCore11FrameLoader4loadERKNS_16FrameLoadRequestE&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x61E3148&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;webkit_web_frame_load_uri&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x44CBC9&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/Programs/DumpRenderTree&lt;/obj&gt;
+      &lt;fn&gt;_ZL7runTestRKSs&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x44CED6&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/Programs/DumpRenderTree&lt;/obj&gt;
+      &lt;fn&gt;_ZL20runTestingServerLoopv&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x43A2D3&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/Programs/DumpRenderTree&lt;/obj&gt;
+      &lt;fn&gt;main&lt;/fn&gt;
+    &lt;/frame&gt;
+  &lt;/stack&gt;
+  &lt;suppression&gt;
+    &lt;sname&gt;insert_a_suppression_name_here&lt;/sname&gt;
+    &lt;skind&gt;Memcheck:Leak&lt;/skind&gt;
+    &lt;sframe&gt; &lt;fun&gt;_Znwm&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZNSt14_Function_base13_Base_managerIZN7WebCore13PolicyChecker21checkNavigationPolicyERKNS1_15ResourceRequestEPNS1_14DocumentLoaderEN3WTF10PassRefPtrINS1_9FormStateEEEPFvPvS5_SB_bESC_EUlNS1_12PolicyActionEE_E10_M_managerERSt9_Any_dataRKSI_St18_Manager_operation&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;webkit_web_policy_decision_new&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZN6WebKit17FrameLoaderClient39dispatchDecidePolicyForNavigationActionERKN7WebCore16NavigationActionERKNS1_15ResourceRequestEN3WTF10PassRefPtrINS1_9FormStateEEESt8functionIFvNS1_12PolicyActionEEE&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZN7WebCore13PolicyChecker21checkNavigationPolicyERKNS_15ResourceRequestEPNS_14DocumentLoaderEN3WTF10PassRefPtrINS_9FormStateEEEPFvPvS3_S9_bESA_&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZN7WebCore11FrameLoader22loadWithDocumentLoaderEPNS_14DocumentLoaderENS_13FrameLoadTypeEN3WTF10PassRefPtrINS_9FormStateEEE&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZN7WebCore11FrameLoader4loadEPNS_14DocumentLoaderE&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZN7WebCore11FrameLoader4loadERKNS_16FrameLoadRequestE&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;webkit_web_frame_load_uri&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZL7runTestRKSs&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZL20runTestingServerLoopv&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;main&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;rawtext&gt;
+&lt;![CDATA[
+{{
+   &lt;insert_a_suppression_name_here&gt;
+   Memcheck:Leak
+   fun:_Znwm
+   fun:_ZNSt14_Function_base13_Base_managerIZN7WebCore13PolicyChecker21checkNavigationPolicyERKNS1_15ResourceRequestEPNS1_14DocumentLoaderEN3WTF10PassRefPtrINS1_9FormStateEEEPFvPvS5_SB_bESC_EUlNS1_12PolicyActionEE_E10_M_managerERSt9_Any_dataRKSI_St18_Manager_operation
+   fun:webkit_web_policy_decision_new
+   fun:_ZN6WebKit17FrameLoaderClient39dispatchDecidePolicyForNavigationActionERKN7WebCore16NavigationActionERKNS1_15ResourceRequestEN3WTF10PassRefPtrINS1_9FormStateEEESt8functionIFvNS1_12PolicyActionEEE
+   fun:_ZN7WebCore13PolicyChecker21checkNavigationPolicyERKNS_15ResourceRequestEPNS_14DocumentLoaderEN3WTF10PassRefPtrINS_9FormStateEEEPFvPvS3_S9_bESA_
+   fun:_ZN7WebCore11FrameLoader22loadWithDocumentLoaderEPNS_14DocumentLoaderENS_13FrameLoadTypeEN3WTF10PassRefPtrINS_9FormStateEEE
+   fun:_ZN7WebCore11FrameLoader4loadEPNS_14DocumentLoaderE
+   fun:_ZN7WebCore11FrameLoader4loadERKNS_16FrameLoadRequestE
+   fun:webkit_web_frame_load_uri
+   fun:_ZL7runTestRKSs
+   fun:_ZL20runTestingServerLoopv
+   fun:main
+}}
+]]&gt;
+    &lt;/rawtext&gt;
+  &lt;/suppression&gt;
+&lt;/error&gt;
+
+&lt;error&gt;
+  &lt;unique&gt;0x1a5&lt;/unique&gt;
+  &lt;tid&gt;1&lt;/tid&gt;
+  &lt;kind&gt;Leak_DefinitelyLost&lt;/kind&gt;
+  &lt;xwhat&gt;
+    &lt;text&gt;8 bytes in 1 blocks are definitely lost in loss record 422 of 7,972&lt;/text&gt;
+    &lt;leakedbytes&gt;8&lt;/leakedbytes&gt;
+    &lt;leakedblocks&gt;1&lt;/leakedblocks&gt;
+  &lt;/xwhat&gt;
+  &lt;stack&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x4C2AF8E&lt;/ip&gt;
+      &lt;obj&gt;/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so&lt;/obj&gt;
+      &lt;fn&gt;_Znwm&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x6839D0C&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;_ZNSt14_Function_base13_Base_managerIZN7WebCore13PolicyChecker18checkContentPolicyERKNS1_16ResourceResponseEPFvPvNS1_12PolicyActionEES6_EUlS7_E_E10_M_managerERSt9_Any_dataRKSC_St18_Manager_operation&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x61E7B03&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;webkit_web_policy_decision_new&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x61CB527&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;_ZN6WebKit17FrameLoaderClient31dispatchDecidePolicyForResponseERKN7WebCore16ResourceResponseERKNS1_15ResourceRequestESt8functionIFvNS1_12PolicyActionEEE&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x6839EC0&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;_ZN7WebCore13PolicyChecker18checkContentPolicyERKNS_16ResourceResponseEPFvPvNS_12PolicyActionEES4_&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x6802F6E&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;_ZN7WebCore14DocumentLoader16responseReceivedEPNS_14CachedResourceERKNS_16ResourceResponseE&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x67E59E0&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;_ZN7WebCore17CachedRawResource16responseReceivedERKNS_16ResourceResponseE&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x684C237&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;_ZN7WebCore17SubresourceLoader18didReceiveResponseERKNS_16ResourceResponseE&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x6F95848&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;_ZN7WebCoreL19sendRequestCallbackEP8_GObjectP13_GAsyncResultPv&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x8E2D6CA&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Dependencies/Root/lib64/libgio-2.0.so.0.3800.0&lt;/obj&gt;
+      &lt;fn&gt;g_task_return_now&lt;/fn&gt;
+      &lt;dir&gt;/home/user/WebKit/WebKitBuild/Dependencies/Source/glib-2.38.0/gio&lt;/dir&gt;
+      &lt;file&gt;gtask.c&lt;/file&gt;
+      &lt;line&gt;1108&lt;/line&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x8E2D6E8&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Dependencies/Root/lib64/libgio-2.0.so.0.3800.0&lt;/obj&gt;
+      &lt;fn&gt;complete_in_idle_cb&lt;/fn&gt;
+      &lt;dir&gt;/home/user/WebKit/WebKitBuild/Dependencies/Source/glib-2.38.0/gio&lt;/dir&gt;
+      &lt;file&gt;gtask.c&lt;/file&gt;
+      &lt;line&gt;1117&lt;/line&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x93A62F4&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Dependencies/Root/lib64/libglib-2.0.so.0.3800.0&lt;/obj&gt;
+      &lt;fn&gt;g_main_context_dispatch&lt;/fn&gt;
+      &lt;dir&gt;/home/user/WebKit/WebKitBuild/Dependencies/Source/glib-2.38.0/glib&lt;/dir&gt;
+      &lt;file&gt;gmain.c&lt;/file&gt;
+      &lt;line&gt;3065&lt;/line&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x93A6637&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Dependencies/Root/lib64/libglib-2.0.so.0.3800.0&lt;/obj&gt;
+      &lt;fn&gt;g_main_context_iterate.isra.23&lt;/fn&gt;
+      &lt;dir&gt;/home/user/WebKit/WebKitBuild/Dependencies/Source/glib-2.38.0/glib&lt;/dir&gt;
+      &lt;file&gt;gmain.c&lt;/file&gt;
+      &lt;line&gt;3712&lt;/line&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x93A6A99&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Dependencies/Root/lib64/libglib-2.0.so.0.3800.0&lt;/obj&gt;
+      &lt;fn&gt;g_main_loop_run&lt;/fn&gt;
+      &lt;dir&gt;/home/user/WebKit/WebKitBuild/Dependencies/Source/glib-2.38.0/glib&lt;/dir&gt;
+      &lt;file&gt;gmain.c&lt;/file&gt;
+      &lt;line&gt;3906&lt;/line&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x8121204&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Dependencies/Root/lib64/libgtk-3.so.0.600.0&lt;/obj&gt;
+      &lt;fn&gt;gtk_main&lt;/fn&gt;
+      &lt;dir&gt;/home/user/WebKit/WebKitBuild/Dependencies/Source/gtk+-3.6.0/gtk&lt;/dir&gt;
+      &lt;file&gt;gtkmain.c&lt;/file&gt;
+      &lt;line&gt;1162&lt;/line&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x44CBCE&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/Programs/DumpRenderTree&lt;/obj&gt;
+      &lt;fn&gt;_ZL7runTestRKSs&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x44CED6&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/Programs/DumpRenderTree&lt;/obj&gt;
+      &lt;fn&gt;_ZL20runTestingServerLoopv&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x43A2D3&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/Programs/DumpRenderTree&lt;/obj&gt;
+      &lt;fn&gt;main&lt;/fn&gt;
+    &lt;/frame&gt;
+  &lt;/stack&gt;
+  &lt;suppression&gt;
+    &lt;sname&gt;insert_a_suppression_name_here&lt;/sname&gt;
+    &lt;skind&gt;Memcheck:Leak&lt;/skind&gt;
+    &lt;sframe&gt; &lt;fun&gt;_Znwm&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZNSt14_Function_base13_Base_managerIZN7WebCore13PolicyChecker18checkContentPolicyERKNS1_16ResourceResponseEPFvPvNS1_12PolicyActionEES6_EUlS7_E_E10_M_managerERSt9_Any_dataRKSC_St18_Manager_operation&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;webkit_web_policy_decision_new&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZN6WebKit17FrameLoaderClient31dispatchDecidePolicyForResponseERKN7WebCore16ResourceResponseERKNS1_15ResourceRequestESt8functionIFvNS1_12PolicyActionEEE&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZN7WebCore13PolicyChecker18checkContentPolicyERKNS_16ResourceResponseEPFvPvNS_12PolicyActionEES4_&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZN7WebCore14DocumentLoader16responseReceivedEPNS_14CachedResourceERKNS_16ResourceResponseE&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZN7WebCore17CachedRawResource16responseReceivedERKNS_16ResourceResponseE&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZN7WebCore17SubresourceLoader18didReceiveResponseERKNS_16ResourceResponseE&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZN7WebCoreL19sendRequestCallbackEP8_GObjectP13_GAsyncResultPv&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;g_task_return_now&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;complete_in_idle_cb&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;g_main_context_dispatch&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;g_main_context_iterate.isra.23&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;g_main_loop_run&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;gtk_main&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZL7runTestRKSs&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZL20runTestingServerLoopv&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;main&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;rawtext&gt;
+&lt;![CDATA[
+{{
+   &lt;insert_a_suppression_name_here&gt;
+   Memcheck:Leak
+   fun:_Znwm
+   fun:_ZNSt14_Function_base13_Base_managerIZN7WebCore13PolicyChecker18checkContentPolicyERKNS1_16ResourceResponseEPFvPvNS1_12PolicyActionEES6_EUlS7_E_E10_M_managerERSt9_Any_dataRKSC_St18_Manager_operation
+   fun:webkit_web_policy_decision_new
+   fun:_ZN6WebKit17FrameLoaderClient31dispatchDecidePolicyForResponseERKN7WebCore16ResourceResponseERKNS1_15ResourceRequestESt8functionIFvNS1_12PolicyActionEEE
+   fun:_ZN7WebCore13PolicyChecker18checkContentPolicyERKNS_16ResourceResponseEPFvPvNS_12PolicyActionEES4_
+   fun:_ZN7WebCore14DocumentLoader16responseReceivedEPNS_14CachedResourceERKNS_16ResourceResponseE
+   fun:_ZN7WebCore17CachedRawResource16responseReceivedERKNS_16ResourceResponseE
+   fun:_ZN7WebCore17SubresourceLoader18didReceiveResponseERKNS_16ResourceResponseE
+   fun:_ZN7WebCoreL19sendRequestCallbackEP8_GObjectP13_GAsyncResultPv
+   fun:g_task_return_now
+   fun:complete_in_idle_cb
+   fun:g_main_context_dispatch
+   fun:g_main_context_iterate.isra.23
+   fun:g_main_loop_run
+   fun:gtk_main
+   fun:_ZL7runTestRKSs
+   fun:_ZL20runTestingServerLoopv
+   fun:main
+}}
+]]&gt;
+    &lt;/rawtext&gt;
+  &lt;/suppression&gt;
+&lt;/error&gt;
+
+&lt;error&gt;
+  &lt;unique&gt;0x1a6&lt;/unique&gt;
+  &lt;tid&gt;1&lt;/tid&gt;
+  &lt;kind&gt;Leak_DefinitelyLost&lt;/kind&gt;
+  &lt;xwhat&gt;
+    &lt;text&gt;8 bytes in 1 blocks are definitely lost in loss record 423 of 7,972&lt;/text&gt;
+    &lt;leakedbytes&gt;8&lt;/leakedbytes&gt;
+    &lt;leakedblocks&gt;1&lt;/leakedblocks&gt;
+  &lt;/xwhat&gt;
+  &lt;stack&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x4C2AF8E&lt;/ip&gt;
+      &lt;obj&gt;/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so&lt;/obj&gt;
+      &lt;fn&gt;_Znwm&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x6839DEC&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;_ZNSt14_Function_base13_Base_managerIZN7WebCore13PolicyChecker21checkNavigationPolicyERKNS1_15ResourceRequestEPNS1_14DocumentLoaderEN3WTF10PassRefPtrINS1_9FormStateEEEPFvPvS5_SB_bESC_EUlNS1_12PolicyActionEE_E10_M_managerERSt9_Any_dataRKSI_St18_Manager_operation&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x61E7B03&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;webkit_web_policy_decision_new&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x61CBA6D&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;_ZN6WebKit17FrameLoaderClient39dispatchDecidePolicyForNavigationActionERKN7WebCore16NavigationActionERKNS1_15ResourceRequestEN3WTF10PassRefPtrINS1_9FormStateEEESt8functionIFvNS1_12PolicyActionEEE&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x683DF52&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;_ZN7WebCore13PolicyChecker21checkNavigationPolicyERKNS_15ResourceRequestEPNS_14DocumentLoaderEN3WTF10PassRefPtrINS_9FormStateEEEPFvPvS3_S9_bESA_&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x6817EFC&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;_ZN7WebCore11FrameLoader22loadWithDocumentLoaderEPNS_14DocumentLoaderENS_13FrameLoadTypeEN3WTF10PassRefPtrINS_9FormStateEEE&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x6818729&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;_ZN7WebCore11FrameLoader4loadEPNS_14DocumentLoaderE&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x6818A3A&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;_ZN7WebCore11FrameLoader4loadERKNS_16FrameLoadRequestE&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x61E3148&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3&lt;/obj&gt;
+      &lt;fn&gt;webkit_web_frame_load_uri&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x44CC50&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/Programs/DumpRenderTree&lt;/obj&gt;
+      &lt;fn&gt;_ZL7runTestRKSs&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x44CED6&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/Programs/DumpRenderTree&lt;/obj&gt;
+      &lt;fn&gt;_ZL20runTestingServerLoopv&lt;/fn&gt;
+    &lt;/frame&gt;
+    &lt;frame&gt;
+      &lt;ip&gt;0x43A2D3&lt;/ip&gt;
+      &lt;obj&gt;/home/user/WebKit/WebKitBuild/Release/Programs/DumpRenderTree&lt;/obj&gt;
+      &lt;fn&gt;main&lt;/fn&gt;
+    &lt;/frame&gt;
+  &lt;/stack&gt;
+  &lt;suppression&gt;
+    &lt;sname&gt;insert_a_suppression_name_here&lt;/sname&gt;
+    &lt;skind&gt;Memcheck:Leak&lt;/skind&gt;
+    &lt;sframe&gt; &lt;fun&gt;_Znwm&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZNSt14_Function_base13_Base_managerIZN7WebCore13PolicyChecker21checkNavigationPolicyERKNS1_15ResourceRequestEPNS1_14DocumentLoaderEN3WTF10PassRefPtrINS1_9FormStateEEEPFvPvS5_SB_bESC_EUlNS1_12PolicyActionEE_E10_M_managerERSt9_Any_dataRKSI_St18_Manager_operation&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;webkit_web_policy_decision_new&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZN6WebKit17FrameLoaderClient39dispatchDecidePolicyForNavigationActionERKN7WebCore16NavigationActionERKNS1_15ResourceRequestEN3WTF10PassRefPtrINS1_9FormStateEEESt8functionIFvNS1_12PolicyActionEEE&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZN7WebCore13PolicyChecker21checkNavigationPolicyERKNS_15ResourceRequestEPNS_14DocumentLoaderEN3WTF10PassRefPtrINS_9FormStateEEEPFvPvS3_S9_bESA_&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZN7WebCore11FrameLoader22loadWithDocumentLoaderEPNS_14DocumentLoaderENS_13FrameLoadTypeEN3WTF10PassRefPtrINS_9FormStateEEE&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZN7WebCore11FrameLoader4loadEPNS_14DocumentLoaderE&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZN7WebCore11FrameLoader4loadERKNS_16FrameLoadRequestE&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;webkit_web_frame_load_uri&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZL7runTestRKSs&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;_ZL20runTestingServerLoopv&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;sframe&gt; &lt;fun&gt;main&lt;/fun&gt; &lt;/sframe&gt;
+    &lt;rawtext&gt;
+&lt;![CDATA[
+{{
+   &lt;insert_a_suppression_name_here&gt;
+   Memcheck:Leak
+   fun:_Znwm
+   fun:_ZNSt14_Function_base13_Base_managerIZN7WebCore13PolicyChecker21checkNavigationPolicyERKNS1_15ResourceRequestEPNS1_14DocumentLoaderEN3WTF10PassRefPtrINS1_9FormStateEEEPFvPvS5_SB_bESC_EUlNS1_12PolicyActionEE_E10_M_managerERSt9_Any_dataRKSI_St18_Manager_operation
+   fun:webkit_web_policy_decision_new
+   fun:_ZN6WebKit17FrameLoaderClient39dispatchDecidePolicyForNavigationActionERKN7WebCore16NavigationActionERKNS1_15ResourceRequestEN3WTF10PassRefPtrINS1_9FormStateEEESt8functionIFvNS1_12PolicyActionEEE
+   fun:_ZN7WebCore13PolicyChecker21checkNavigationPolicyERKNS_15ResourceRequestEPNS_14DocumentLoaderEN3WTF10PassRefPtrINS_9FormStateEEEPFvPvS3_S9_bESA_
+   fun:_ZN7WebCore11FrameLoader22loadWithDocumentLoaderEPNS_14DocumentLoaderENS_13FrameLoadTypeEN3WTF10PassRefPtrINS_9FormStateEEE
+   fun:_ZN7WebCore11FrameLoader4loadEPNS_14DocumentLoaderE
+   fun:_ZN7WebCore11FrameLoader4loadERKNS_16FrameLoadRequestE
+   fun:webkit_web_frame_load_uri
+   fun:_ZL7runTestRKSs
+   fun:_ZL20runTestingServerLoopv
+   fun:main
+}}
+]]&gt;
+    &lt;/rawtext&gt;
+  &lt;/suppression&gt;
+&lt;/error&gt;
+
+&lt;errorcounts&gt;
+&lt;/errorcounts&gt;
+
+&lt;suppcounts&gt;
+  &lt;pair&gt;
+    &lt;count&gt;107&lt;/count&gt;
+    &lt;name&gt;FcConfigAppFontAddFile (Third Party)&lt;/name&gt;
+  &lt;/pair&gt;
+  &lt;pair&gt;
+    &lt;count&gt;2098&lt;/count&gt;
+    &lt;name&gt;gtk_init_check (Third Party)&lt;/name&gt;
+  &lt;/pair&gt;
+  &lt;pair&gt;
+    &lt;count&gt;1&lt;/count&gt;
+    &lt;name&gt;g_quark_from_static_string (Third party)&lt;/name&gt;
+  &lt;/pair&gt;
+  &lt;pair&gt;
+    &lt;count&gt;27&lt;/count&gt;
+    &lt;name&gt;FcConfigParseAndLoad (Third Party)&lt;/name&gt;
+  &lt;/pair&gt;
+  &lt;pair&gt;
+    &lt;count&gt;80&lt;/count&gt;
+    &lt;name&gt;webkitAccessibleNew&lt;/name&gt;
+  &lt;/pair&gt;
+  &lt;pair&gt;
+    &lt;count&gt;177&lt;/count&gt;
+    &lt;name&gt;g_thread_proxy (Third Party)&lt;/name&gt;
+  &lt;/pair&gt;
+  &lt;pair&gt;
+    &lt;count&gt;9&lt;/count&gt;
+    &lt;name&gt;FcPatternObjectInsertElt 2 (Third Party)&lt;/name&gt;
+  &lt;/pair&gt;
+  &lt;pair&gt;
+    &lt;count&gt;1&lt;/count&gt;
+    &lt;name&gt;gtk_window_realize (Third Party)&lt;/name&gt;
+  &lt;/pair&gt;
+  &lt;pair&gt;
+    &lt;count&gt;1&lt;/count&gt;
+    &lt;name&gt;__nss_database_lookup (Third Party)&lt;/name&gt;
+  &lt;/pair&gt;
+  &lt;pair&gt;
+    &lt;count&gt;1&lt;/count&gt;
+    &lt;name&gt;cairo_set_source_surface (Third Party)&lt;/name&gt;
+  &lt;/pair&gt;
+  &lt;pair&gt;
+    &lt;count&gt;2&lt;/count&gt;
+    &lt;name&gt;libGL.so (Third party)&lt;/name&gt;
+  &lt;/pair&gt;
+  &lt;pair&gt;
+    &lt;count&gt;1&lt;/count&gt;
+    &lt;name&gt;g_task_run_in_thread (Third Party)&lt;/name&gt;
+  &lt;/pair&gt;
+  &lt;pair&gt;
+    &lt;count&gt;2&lt;/count&gt;
+    &lt;name&gt;WTF::ThreadIdentifierData::initialize() (Intentional)&lt;/name&gt;
+  &lt;/pair&gt;
+  &lt;pair&gt;
+    &lt;count&gt;1&lt;/count&gt;
+    &lt;name&gt;gtk_css_provider_load_from_data (Third Party)&lt;/name&gt;
+  &lt;/pair&gt;
+  &lt;pair&gt;
+    &lt;count&gt;1&lt;/count&gt;
+    &lt;name&gt;libenchant.so new (Third party)&lt;/name&gt;
+  &lt;/pair&gt;
+&lt;/suppcounts&gt;
+
+&lt;/valgrindoutput&gt;
+&quot;&quot;&quot;.format(process_name=process_name, pid=pid, uuid=uuid)
+
+
+def make_mock_incomplete_valgrind_output(process_name, pid, uuid):
+    return &quot;&quot;&quot;&lt;?xml version=&quot;1.0&quot;?&gt;
+
+&lt;valgrindoutput&gt;
+
+&lt;protocolversion&gt;4&lt;/protocolversion&gt;
+&lt;protocoltool&gt;memcheck&lt;/protocoltool&gt;
+
+&lt;preamble&gt;
+  &lt;line&gt;Memcheck, a memory error detector&lt;/line&gt;
+  &lt;line&gt;Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.&lt;/line&gt;
+  &lt;line&gt;Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info&lt;/line&gt;
+  &lt;line&gt;Command: /home/user/WebKit/WebKitBuild/Release/Programs/{process_name} -&lt;/line&gt;
+&lt;/preamble&gt;
+
+&lt;pid&gt;{pid}&lt;/pid&gt;
+&lt;ppid&gt;18577&lt;/ppid&gt;
+&lt;tool&gt;memcheck&lt;/tool&gt;
+
+&lt;args&gt;
+  &lt;vargv&gt;
+    &lt;exe&gt;/usr/bin/valgrind.bin&lt;/exe&gt;
+    &lt;arg&gt;--tool=memcheck&lt;/arg&gt;
+    &lt;arg&gt;--num-callers=40&lt;/arg&gt;
+    &lt;arg&gt;--demangle=no&lt;/arg&gt;
+    &lt;arg&gt;--trace-children=no&lt;/arg&gt;
+    &lt;arg&gt;--smc-check=all-non-file&lt;/arg&gt;
+    &lt;arg&gt;--leak-check=yes&lt;/arg&gt;
+    &lt;arg&gt;--leak-resolution=high&lt;/arg&gt;
+    &lt;arg&gt;--show-possibly-lost=no&lt;/arg&gt;
+    &lt;arg&gt;--show-reachable=no&lt;/arg&gt;
+    &lt;arg&gt;--leak-check=full&lt;/arg&gt;
+    &lt;arg&gt;--undef-value-errors=no&lt;/arg&gt;
+    &lt;arg&gt;--gen-suppressions=all&lt;/arg&gt;
+    &lt;arg&gt;--xml=yes&lt;/arg&gt;
+    &lt;arg&gt;--xml-file=/home/user/WebKit/WebKitBuild/Release/layout-test-results/drt-{pid}-{uuid}-leaks.xml&lt;/arg&gt;
+    &lt;arg&gt;--suppressions=/home/user/WebKit/Tools/Scripts/valgrind/suppressions.txt&lt;/arg&gt;
+    &lt;arg&gt;--suppressions=/usr/lib/valgrind/debian-libc6-dbg.supp&lt;/arg&gt;
+  &lt;/vargv&gt;
+  &lt;argv&gt;
+    &lt;exe&gt;/home/user/WebKit/WebKitBuild/Release/Programs/{process_name}&lt;/exe&gt;
+    &lt;arg&gt;-&lt;/arg&gt;
+  &lt;/argv&gt;
+&lt;/args&gt;
+
+&lt;status&gt;
+  &lt;state&gt;RUNNING&lt;/state&gt;
+  &lt;time&gt;00:00:00:00.024 &lt;/time&gt;
+&lt;/status&gt;
+&quot;&quot;&quot;.format(process_name=process_name, pid=pid, uuid=uuid)
+
+
+def make_mock_valgrind_results():
+    return &quot;&quot;&quot;-----------------------------------------------------
+Suppressions used:
+  count name
+      2 __nss_database_lookup (Third Party)
+      2 cairo_set_source_surface (Third Party)
+      2 g_quark_from_static_string (Third party)
+      2 g_task_run_in_thread (Third Party)
+      2 gtk_css_provider_load_from_data (Third Party)
+      2 gtk_window_realize (Third Party)
+      2 libenchant.so new (Third party)
+      4 WTF::ThreadIdentifierData::initialize() (Intentional)
+      4 libGL.so (Third party)
+     18 FcPatternObjectInsertElt 2 (Third Party)
+     54 FcConfigParseAndLoad (Third Party)
+    160 webkitAccessibleNew
+    214 FcConfigAppFontAddFile (Third Party)
+    354 g_thread_proxy (Third Party)
+   4196 gtk_init_check (Third Party)
+-----------------------------------------------------
+Valgrind detected 2 leaks:
+Leak_DefinitelyLost
+8 bytes in 1 blocks are definitely lost in loss record 421 of 7,972
+  operator new(unsigned long) (/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
+  std::_Function_base::_Base_manager&lt;WebCore::PolicyChecker::checkNavigationPolicy(WebCore::ResourceRequest const&amp;, WebCore::DocumentLoader*, WTF::PassRefPtr&lt;WebCore::FormState&gt;, void (*)(void*, WebCore::ResourceRequest const&amp;, WTF::PassRefPtr&lt;WebCore::FormState&gt;, bool), void*)::{lambda(WebCore::PolicyAction)#1}&gt;::_M_manager(std::_Any_data&amp;, std::_Function_base::_Base_manager&lt;WebCore::PolicyChecker::checkNavigationPolicy(WebCore::ResourceRequest const&amp;, WebCore::DocumentLoader*, WTF::PassRefPtr&lt;WebCore::FormState&gt;, void (*)(void*, WebCore::ResourceRequest const&amp;, WTF::PassRefPtr&lt;WebCore::FormState&gt;, bool), void*)::{lambda(WebCore::PolicyAction)#1}&gt; const&amp;, std::_Manager_operation) (/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3)
+  webkit_web_policy_decision_new (/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3)
+  WebKit::FrameLoaderClient::dispatchDecidePolicyForNavigationAction(WebCore::NavigationAction const&amp;, WebCore::ResourceRequest const&amp;, WTF::PassRefPtr&lt;WebCore::FormState&gt;, std::function&lt;void (WebCore::PolicyAction)&gt;) (/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3)
+  WebCore::PolicyChecker::checkNavigationPolicy(WebCore::ResourceRequest const&amp;, WebCore::DocumentLoader*, WTF::PassRefPtr&lt;WebCore::FormState&gt;, void (*)(void*, WebCore::ResourceRequest const&amp;, WTF::PassRefPtr&lt;WebCore::FormState&gt;, bool), void*) (/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3)
+  WebCore::FrameLoader::loadWithDocumentLoader(WebCore::DocumentLoader*, WebCore::FrameLoadType, WTF::PassRefPtr&lt;WebCore::FormState&gt;) (/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3)
+  WebCore::FrameLoader::load(WebCore::DocumentLoader*) (/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3)
+  WebCore::FrameLoader::load(WebCore::FrameLoadRequest const&amp;) (/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3)
+  webkit_web_frame_load_uri (/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3)
+  runTest(std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;) (/home/user/WebKit/WebKitBuild/Release/Programs/DumpRenderTree)
+  runTestingServerLoop() (/home/user/WebKit/WebKitBuild/Release/Programs/DumpRenderTree)
+  main (/home/user/WebKit/WebKitBuild/Release/Programs/DumpRenderTree)
+Suppression (error hash=#0449D3ED253FE1F9#):
+
+{
+   &lt;insert_a_suppression_name_here&gt;
+   Memcheck:Leak
+   fun:_Znw*
+   fun:_ZNSt14_Function_base13_Base_managerIZN7WebCore13PolicyChecker21checkNavigationPolicyERKNS1_15ResourceRequestEPNS1_14DocumentLoaderEN3WTF10PassRefPtrINS1_9FormStateEEEPFvPvS5_SB_bESC_EUlNS1_12PolicyActionEE_E10_M_managerERSt9_Any_dataRKSI_St18_Manager_operation
+   fun:webkit_web_policy_decision_new
+   fun:_ZN6WebKit17FrameLoaderClient39dispatchDecidePolicyForNavigationActionERKN7WebCore16NavigationActionERKNS1_15ResourceRequestEN3WTF10PassRefPtrINS1_9FormStateEEESt8functionIFvNS1_12PolicyActionEEE
+   fun:_ZN7WebCore13PolicyChecker21checkNavigationPolicyERKNS_15ResourceRequestEPNS_14DocumentLoaderEN3WTF10PassRefPtrINS_9FormStateEEEPFvPvS3_S9_bESA_
+   fun:_ZN7WebCore11FrameLoader22loadWithDocumentLoaderEPNS_14DocumentLoaderENS_13FrameLoadTypeEN3WTF10PassRefPtrINS_9FormStateEEE
+   fun:_ZN7WebCore11FrameLoader4loadEPNS_14DocumentLoaderE
+   fun:_ZN7WebCore11FrameLoader4loadERKNS_16FrameLoadRequestE
+   fun:webkit_web_frame_load_uri
+   fun:_ZL7runTestRKSs
+   fun:_ZL20runTestingServerLoopv
+   fun:main
+}
+
+
+Leak_DefinitelyLost
+8 bytes in 1 blocks are definitely lost in loss record 422 of 7,972
+  operator new(unsigned long) (/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
+  std::_Function_base::_Base_manager&lt;WebCore::PolicyChecker::checkContentPolicy(WebCore::ResourceResponse const&amp;, void (*)(void*, WebCore::PolicyAction), void*)::{lambda(WebCore::PolicyAction)#1}&gt;::_M_manager(std::_Any_data&amp;, std::_Function_base::_Base_manager&lt;WebCore::PolicyChecker::checkContentPolicy(WebCore::ResourceResponse const&amp;, void (*)(void*, WebCore::PolicyAction), void*)::{lambda(WebCore::PolicyAction)#1}&gt; const&amp;, std::_Manager_operation) (/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3)
+  webkit_web_policy_decision_new (/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3)
+  WebKit::FrameLoaderClient::dispatchDecidePolicyForResponse(WebCore::ResourceResponse const&amp;, WebCore::ResourceRequest const&amp;, std::function&lt;void (WebCore::PolicyAction)&gt;) (/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3)
+  WebCore::PolicyChecker::checkContentPolicy(WebCore::ResourceResponse const&amp;, void (*)(void*, WebCore::PolicyAction), void*) (/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3)
+  WebCore::DocumentLoader::responseReceived(WebCore::CachedResource*, WebCore::ResourceResponse const&amp;) (/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3)
+  WebCore::CachedRawResource::responseReceived(WebCore::ResourceResponse const&amp;) (/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3)
+  WebCore::SubresourceLoader::didReceiveResponse(WebCore::ResourceResponse const&amp;) (/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3)
+  WebCore::sendRequestCallback(_GObject*, _GAsyncResult*, void*) (/home/user/WebKit/WebKitBuild/Release/.libs/libwebkitgtk-3.0.so.0.19.3)
+  g_task_return_now (/home/user/WebKit/WebKitBuild/Dependencies/Source/glib-2.38.0/gio/gtask.c:1108)
+  complete_in_idle_cb (/home/user/WebKit/WebKitBuild/Dependencies/Source/glib-2.38.0/gio/gtask.c:1117)
+  g_main_context_dispatch (/home/user/WebKit/WebKitBuild/Dependencies/Source/glib-2.38.0/glib/gmain.c:3065)
+  g_main_context_iterate.isra.23 (/home/user/WebKit/WebKitBuild/Dependencies/Source/glib-2.38.0/glib/gmain.c:3712)
+  g_main_loop_run (/home/user/WebKit/WebKitBuild/Dependencies/Source/glib-2.38.0/glib/gmain.c:3906)
+  gtk_main (/home/user/WebKit/WebKitBuild/Dependencies/Source/gtk+-3.6.0/gtk/gtkmain.c:1162)
+  runTest(std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;) (/home/user/WebKit/WebKitBuild/Release/Programs/DumpRenderTree)
+  runTestingServerLoop() (/home/user/WebKit/WebKitBuild/Release/Programs/DumpRenderTree)
+  main (/home/user/WebKit/WebKitBuild/Release/Programs/DumpRenderTree)
+Suppression (error hash=#8313DEB16B069438#):
+
+{
+   &lt;insert_a_suppression_name_here&gt;
+   Memcheck:Leak
+   fun:_Znw*
+   fun:_ZNSt14_Function_base13_Base_managerIZN7WebCore13PolicyChecker18checkContentPolicyERKNS1_16ResourceResponseEPFvPvNS1_12PolicyActionEES6_EUlS7_E_E10_M_managerERSt9_Any_dataRKSC_St18_Manager_operation
+   fun:webkit_web_policy_decision_new
+   fun:_ZN6WebKit17FrameLoaderClient31dispatchDecidePolicyForResponseERKN7WebCore16ResourceResponseERKNS1_15ResourceRequestESt8functionIFvNS1_12PolicyActionEEE
+   fun:_ZN7WebCore13PolicyChecker18checkContentPolicyERKNS_16ResourceResponseEPFvPvNS_12PolicyActionEES4_
+   fun:_ZN7WebCore14DocumentLoader16responseReceivedEPNS_14CachedResourceERKNS_16ResourceResponseE
+   fun:_ZN7WebCore17CachedRawResource16responseReceivedERKNS_16ResourceResponseE
+   fun:_ZN7WebCore17SubresourceLoader18didReceiveResponseERKNS_16ResourceResponseE
+   fun:_ZN7WebCoreL19sendRequestCallbackEP8_GObjectP13_GAsyncResultPv
+   fun:g_task_return_now
+   fun:complete_in_idle_cb
+   fun:g_main_context_dispatch
+   fun:g_main_context_iterate.isra.23
+   fun:g_main_loop_run
+   fun:gtk_main
+   fun:_ZL7runTestRKSs
+   fun:_ZL20runTestingServerLoopv
+   fun:main
+}
+
+
+&quot;&quot;&quot;
+
+
+def make_mock_valgrind_results_incomplete():
+    return &quot;&quot;&quot;could not parse &lt;?xml version=&quot;1.0&quot;?&gt;
+
+&lt;valgrindoutput&gt;
+
+&lt;protocolversion&gt;4&lt;/protocolversion&gt;
+&lt;protocoltool&gt;memcheck&lt;/protocoltool&gt;
+
+&lt;preamble&gt;
+  &lt;line&gt;Memcheck, a memory error detector&lt;/line&gt;
+  &lt;line&gt;Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.&lt;/line&gt;
+  &lt;line&gt;Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info&lt;/line&gt;
+  &lt;line&gt;Command: /home/user/WebKit/WebKitBuild/Release/Programs/DumpRenderTree -&lt;/line&gt;
+&lt;/preamble&gt;
+
+&lt;pid&gt;28531&lt;/pid&gt;
+&lt;ppid&gt;18577&lt;/ppid&gt;
+&lt;tool&gt;memcheck&lt;/tool&gt;
+
+&lt;args&gt;
+  &lt;vargv&gt;
+    &lt;exe&gt;/usr/bin/valgrind.bin&lt;/exe&gt;
+    &lt;arg&gt;--tool=memcheck&lt;/arg&gt;
+    &lt;arg&gt;--num-callers=40&lt;/arg&gt;
+    &lt;arg&gt;--demangle=no&lt;/arg&gt;
+    &lt;arg&gt;--trace-children=no&lt;/arg&gt;
+    &lt;arg&gt;--smc-check=all-non-file&lt;/arg&gt;
+    &lt;arg&gt;--leak-check=yes&lt;/arg&gt;
+    &lt;arg&gt;--leak-resolution=high&lt;/arg&gt;
+    &lt;arg&gt;--show-possibly-lost=no&lt;/arg&gt;
+    &lt;arg&gt;--show-reachable=no&lt;/arg&gt;
+    &lt;arg&gt;--leak-check=full&lt;/arg&gt;
+    &lt;arg&gt;--undef-value-errors=no&lt;/arg&gt;
+    &lt;arg&gt;--gen-suppressions=all&lt;/arg&gt;
+    &lt;arg&gt;--xml=yes&lt;/arg&gt;
+    &lt;arg&gt;--xml-file=/home/user/WebKit/WebKitBuild/Release/layout-test-results/drt-28531-e8c7d7b83be411e390c9d43d7e01ba08-leaks.xml&lt;/arg&gt;
+    &lt;arg&gt;--suppressions=/home/user/WebKit/Tools/Scripts/valgrind/suppressions.txt&lt;/arg&gt;
+    &lt;arg&gt;--suppressions=/usr/lib/valgrind/debian-libc6-dbg.supp&lt;/arg&gt;
+  &lt;/vargv&gt;
+  &lt;argv&gt;
+    &lt;exe&gt;/home/user/WebKit/WebKitBuild/Release/Programs/DumpRenderTree&lt;/exe&gt;
+    &lt;arg&gt;-&lt;/arg&gt;
+  &lt;/argv&gt;
+&lt;/args&gt;
+
+&lt;status&gt;
+  &lt;state&gt;RUNNING&lt;/state&gt;
+  &lt;time&gt;00:00:00:00.024 &lt;/time&gt;
+&lt;/status&gt;
+: no element found: line 49, column 0
+-----------------------------------------------------
+Suppressions used:
+  count name
+-----------------------------------------------------
+&quot;&quot;&quot;
+
+
+def make_mock_valgrind_results_empty():
+    return &quot;&quot;&quot;could not parse : no element found: line 1, column 0
+-----------------------------------------------------
+Suppressions used:
+  count name
+-----------------------------------------------------
+&quot;&quot;&quot;
+
+
+def make_mock_valgrind_results_misformatted():
+    return &quot;&quot;&quot;could not parse Junk that should not appear in a valgrind xml file&lt;?xml version=&quot;1.0&quot;?: syntax error: line 1, column 0
+-----------------------------------------------------
+Suppressions used:
+  count name
+-----------------------------------------------------
+&quot;&quot;&quot;
+
+
+class LeakDetectorValgrindTest(unittest.TestCase):
+
+    def test_parse_and_print_leaks_detail_pass(self):
+        mock_valgrind_output1 = make_mock_valgrind_output('DumpRenderTree', 28529, 'db92e4843be411e3bae1d43d7e01ba08')
+        mock_valgrind_output2 = make_mock_valgrind_output('DumpRenderTree', 28530, 'dd7213423be411e3aa7fd43d7e01ba08')
+        files = {}
+        files['/tmp/layout-test-results/drt-28529-db92e4843be411e3bae1d43d7e01ba08-leaks.xml'] = mock_valgrind_output1
+        files['/tmp/layout-test-results/drt-28530-dd7213423be411e3aa7fd43d7e01ba08-leaks.xml'] = mock_valgrind_output2
+        leakdetector_valgrind = LeakDetectorValgrind(MockFileSystem(files), '/tmp/layout-test-results/')
+
+        OutputCapture().assert_outputs(self, leakdetector_valgrind.parse_and_print_leaks_detail, [files], expected_logs=make_mock_valgrind_results())
+
+    def test_parse_and_print_leaks_detail_incomplete(self):
+        mock_incomplete_valgrind_output = make_mock_incomplete_valgrind_output('DumpRenderTree', 28531, 'e8c7d7b83be411e390c9d43d7e01ba08')
+        files = {}
+        files['/tmp/layout-test-results/drt-28531-e8c7d7b83be411e390c9d43d7e01ba08-leaks.xml'] = mock_incomplete_valgrind_output
+        leakdetector_valgrind = LeakDetectorValgrind(MockFileSystem(files), '/tmp/layout-test-results/')
+
+        OutputCapture().assert_outputs(self, leakdetector_valgrind.parse_and_print_leaks_detail, [files], expected_logs=make_mock_valgrind_results_incomplete())
+
+    def test_parse_and_print_leaks_detail_empty(self):
+        files = {}
+        files['/tmp/Logs/layout-test-results/drt-28532-ebc9a6c63be411e399d4d43d7e01ba08-leaks.xml'] = &quot;&quot;
+        leakdetector_valgrind = LeakDetectorValgrind(MockFileSystem(files), '/tmp/layout-test-results/')
+
+        OutputCapture().assert_outputs(self, leakdetector_valgrind.parse_and_print_leaks_detail, [files], expected_logs=make_mock_valgrind_results_empty())
+
+    def test_parse_and_print_leaks_detail_misformatted(self):
+        self.maxDiff = None
+        misformatted_mock_valgrind_output = 'Junk that should not appear in a valgrind xml file' + make_mock_valgrind_output('DumpRenderTree', 28533, 'fa6d0cd63be411e39c72d43d7e01ba08')[:20]
+        files = {}
+        files['/tmp/layout-test-results/drt-28533-fa6d0cd63be411e39c72d43d7e01ba08-leaks.xml'] = misformatted_mock_valgrind_output
+        leakdetector_valgrind = LeakDetectorValgrind(MockFileSystem(files), '/tmp/layout-test-results/')
+
+        OutputCapture().assert_outputs(self, leakdetector_valgrind.parse_and_print_leaks_detail, [files], expected_logs=make_mock_valgrind_results_misformatted())
</ins></span></pre>
</div>
</div>

</body>
</html>