content/xml/document/test/test_bug392338.html

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 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=392338
     5 -->
     6 <head>
     7   <title>Test for Bug 392338</title>
     8   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    10 </head>
    11 <body>
    12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=392338">Mozilla Bug 392338</a>
    13 <p id="display"></p>
    14 <div id="content" style="display: none">
    16 </div>
    17 <pre id="test">
    18 <script class="testbody" type="text/javascript">
    20 /** Test for Bug 392338 **/
    21 function obs () {
    22   SpecialPowers.addObserver(this, "http-on-modify-request", false);
    23   this.window = window;
    24 }
    26 obs.prototype = {
    27   observe: function obs_observe (theSubject, theTopic, theData)
    28   {
    29     this.timeToFinish = true;
    30     try{
    31       var ir = theSubject.QueryInterface(this.window.SpecialPowers.Ci
    32                                              .nsIChannel).notificationCallbacks;
    33       if (!ir) {
    34         this.timeToFinish = false;
    35         return;
    36       }
    37       this.window.ok(true, "No exception thrown");
    39       this.window.is(ir.toString().indexOf(this.window.SpecialPowers.Ci.nsIInterfaceRequestor) != -1,
    40                      true, "Must be an interface requestor");
    42       if (ir instanceof this.window.SpecialPowers.Ci.nsIClassInfo) {
    43         var count = {};
    44         var interfaces = ir.
    45                      QueryInterface(this.window.SpecialPowers.Ci.nsIClassInfo).
    46                      getInterfaces(count).
    47                      map(function(id) {
    48                                 return this.window.SpecialPowers.CiByID[id].toString();
    49                          });
    50         this.window.isnot(interfaces.indexOf("nsIInterfaceRequestor"), -1,
    51                           "Must have interface requestor classinfo");
    52       }
    53     } catch(ex) {
    54       this.window.is(true, false, "Exception thrown " + ex);
    55     } finally {
    56       if (this.timeToFinish) {
    57         this.remove();
    58         this.window.SimpleTest.finish();
    59         this.window = null;
    60       }
    61     }
    62   },
    64   remove: function obs_remove()
    65   {
    66     SpecialPowers.removeObserver(this, "http-on-modify-request");
    67   }
    68 }
    70 var o;
    72 SimpleTest.waitForExplicitFinish();
    73 addLoadEvent(function() {
    74   var doc = document.implementation.createDocument("", "", null);
    75   o = new obs();
    76   doc.load(window.location.href);
    77 });
    79 </script>
    80 </pre>
    81 </body>
    82 </html>

mercurial