toolkit/components/aboutmemory/tests/test_sqliteMultiReporter.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <?xml version="1.0"?>
     2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
     3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
     4 <window title="about:memory"
     5         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
     6   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
     7   <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
     9   <!-- test results are displayed in the html:body -->
    10   <body xmlns="http://www.w3.org/1999/xhtml"></body>
    12   <!-- test code goes here -->
    13   <script type="application/javascript">
    14   <![CDATA[
    16   // Test for bug 708248, where the SQLite memory multi-reporter was
    17   // crashing when a DB was closed.
    19   // Nb: this test is all JS and so should be done with an xpcshell test,
    20   // but bug 671753 is preventing the memory-reporter-manager from being
    21   // accessed from xpcshell.
    23   const Cc = Components.classes;
    24   const Ci = Components.interfaces;
    25   const Cu = Components.utils;
    27   // Make a fake DB file.
    28   let file = Cc["@mozilla.org/file/directory_service;1"].
    29              getService(Ci.nsIProperties).
    30              get("ProfD", Ci.nsIFile);
    31   file.append("test_sqliteMultiReporter-fake-DB-tmp.sqlite");
    33   // Open and close the DB.
    34   let storage = Cc["@mozilla.org/storage/service;1"].
    35                 getService(Ci.mozIStorageService);
    36   let db = storage.openDatabase(file);
    37   db.close();
    39   // Invoke all the reporters.  The SQLite multi-reporter is among
    40   // them.  It shouldn't crash.
    41   let mgr = Cc["@mozilla.org/memory-reporter-manager;1"].
    42             getService(Ci.nsIMemoryReporterManager);
    43   mgr.getReportsForThisProcess(function(){}, null);
    45   // If we haven't crashed, we've passed, but the test harness requires that
    46   // we explicitly check something.
    47   ok(true, "didn't crash");
    49   ]]>
    50   </script>
    51 </window>

mercurial