summaryrefslogtreecommitdiffstats
path: root/dom/xml/test/file_bug392338.js
blob: 1a433353b05d0ddec7414e8dc3bc98582c30505d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Components.utils.import("resource://gre/modules/Services.jsm");

var modifyObserver = {
  observe: function(subject, topic, data) {
    if (topic == 'http-on-modify-request') {
      var testOk = false;
      try {
        // We should be able to QI the request to an nsIChannel, then get
        // the notificationCallbacks without throwing an exception.
        var ir = subject.QueryInterface(Components.interfaces.nsIChannel).notificationCallbacks;

        // The notificationCallbacks should be an nsIInterfaceRequestor.
        testOk = ir.toString().indexOf(Components.interfaces.nsIInterfaceRequestor) != -1;
      } catch (e) {
      }
      sendAsyncMessage('modify-request-completed', testOk);
      Services.obs.removeObserver(modifyObserver, 'http-on-modify-request');
    }
  }
};

Services.obs.addObserver(modifyObserver, 'http-on-modify-request', false);