image/test/mochitest/test_net_failedtoprocess.html

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 Test that a image decoding error producs a net:failed-to-process-uri-content
     5 observer event with the nsIURI of the failed image as the subject
     6 -->
     7 <head>
     8   <title>Test for image net:failed-to-process-uri-content</title>
     9   <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
    10   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    11   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    12 </head>
    13 <body>
    14 <p id="display"></p>
    15 <pre id="test">
    16 <script type="application/javascript">
    18 SimpleTest.waitForExplicitFinish();
    20 const Ci = Components.interfaces;
    21 const Cc = Components.classes;
    22 var obs = Cc["@mozilla.org/observer-service;1"].getService();
    23 obs = obs.QueryInterface(Ci.nsIObserverService);
    25 var observer = {
    26   QueryInterface: function (aIID) {
    27     if (aIID.equals(Ci.nsISupports) ||
    28         aIID.equals(Ci.nsIObserver))
    29       return this;
    30     throw Cr.NS_ERROR_NO_INTERFACE;
    31   },
    33   observe: function(subject, topic, data) {
    34     ok(topic == "net:failed-to-process-uri-content", "wrong topic");
    35     subject = subject.QueryInterface(Ci.nsIURI);
    36     ok(subject.asciiSpec == "chrome://mochitests/content/chrome/image/test/mochitest/invalid.jpg", "wrong subject");
    38     obs.removeObserver(this, "net:failed-to-process-uri-content");
    40     SimpleTest.finish();
    41   }
    42 };
    44 obs.addObserver(observer, "net:failed-to-process-uri-content", false);
    46 </script>
    47 </pre>
    48 <img src="damon.jpg">
    49 <img src="invalid.jpg">
    50 </body>
    51 </html>

mercurial