Ticket #5477: 0002-2nd-take-to-NoScript-2.3.7-merge-use-CC-CI-oops.patch

File 0002-2nd-take-to-NoScript-2.3.7-merge-use-CC-CI-oops.patch, 7.2 KB (added by ma1, 7 years ago)

Patch: Merges NoScript 2.3.7's ChannelReplacement and seems to fix this issue, 2nd take with legacy CC and CI constants convention

  • src/chrome/content/code/IOUtil.js

    From c228692e82eef296ca15f97620cc0cb475c0d419 Mon Sep 17 00:00:00 2001
    From: Giorgio Maone <g.maone@informaction.com>
    Date: Wed, 18 Apr 2012 01:21:40 +0200
    Subject: [PATCH 2/2] 2nd take to NoScript 2.3.7 merge, use CC & CI (oops)
    
    
    Signed-off-by: Giorgio Maone <g.maone@informaction.com>
    ---
     src/chrome/content/code/IOUtil.js |   42 ++++++++++++++++++------------------
     1 files changed, 21 insertions(+), 21 deletions(-)
    
    diff --git a/src/chrome/content/code/IOUtil.js b/src/chrome/content/code/IOUtil.js
    index 9ef4453..0b1e9e2 100644
    a b CtxCapturingListener.prototype = { 
    273273  },
    274274  onDataAvailable: function(request, ctx, inputStream, offset, count) {},
    275275  onStopRequest: function(request, ctx, statusCode) {},
    276   QueryInterface: xpcom_generateQI([Ci.nsIStreamListener])
     276  QueryInterface: xpcom_generateQI([CI.nsIStreamListener])
    277277}
    278278
    279279function ChannelReplacement(chan, newURI, newMethod) {
    280280  return this._init(chan, newURI, newMethod);
    281281}
    282282
    283 ChannelReplacement.supported = "nsITraceableChannel" in Ci;
     283ChannelReplacement.supported = "nsITraceableChannel" in CI;
    284284
    285285ChannelReplacement.runWhenPending = function(channel, callback) {
    286286  if (channel.isPending()) {
    ChannelReplacement.prototype = { 
    307307 
    308308  get _classifierClass() {
    309309    delete this.__proto__._classifierClass;
    310     return this.__proto__._classifierClass = Cc["@mozilla.org/channelclassifier"];
     310    return this.__proto__._classifierClass = CC["@mozilla.org/channelclassifier"];
    311311  },
    312312 
    313313  _autoHeadersRx: /^(?:Host|Cookie|Authorization)$|Cache|^If-/,
    ChannelReplacement.prototype = { 
    321321  },
    322322 
    323323  _init: function(chan, newURI, newMethod) {
    324     if (!(ChannelReplacement.supported && chan instanceof Ci.nsITraceableChannel))
     324    if (!(ChannelReplacement.supported && chan instanceof CI.nsITraceableChannel))
    325325      throw this._unsupportedError;
    326326 
    327327    newURI = newURI || chan.URI;
    ChannelReplacement.prototype = { 
    343343    newChan.notificationCallbacks = chan.notificationCallbacks;
    344344    newChan.loadFlags = loadFlags | newChan.LOAD_REPLACE;
    345345   
    346     if (!(newChan instanceof Ci.nsIHttpChannel))
     346    if (!(newChan instanceof CI.nsIHttpChannel))
    347347      return this;
    348348   
    349349    // copy headers
    350350    chan.visitRequestHeaders(this);
    351351
    352352    if (!newMethod || newMethod === chan.requestMethod) {
    353       if (newChan instanceof Ci.nsIUploadChannel && chan instanceof Ci.nsIUploadChannel && chan.uploadStream ) {
     353      if (newChan instanceof CI.nsIUploadChannel && chan instanceof Ci.nsIUploadChannel && chan.uploadStream ) {
    354354        var stream = chan.uploadStream;
    355         if (stream instanceof Ci.nsISeekableStream) {
     355        if (stream instanceof CI.nsISeekableStream) {
    356356          stream.seek(stream.NS_SEEK_SET, 0);
    357357        }
    358358       
    ChannelReplacement.prototype = { 
    375375    if (chan.referrer) newChan.referrer = chan.referrer;
    376376    newChan.allowPipelining = chan.allowPipelining;
    377377    newChan.redirectionLimit = chan.redirectionLimit - 1;
    378     if (chan instanceof Ci.nsIHttpChannelInternal && newChan instanceof Ci.nsIHttpChannelInternal) {
     378    if (chan instanceof CI.nsIHttpChannelInternal && newChan instanceof Ci.nsIHttpChannelInternal) {
    379379      if (chan.URI == chan.documentURI) {
    380380        newChan.documentURI = newURI;
    381381      } else {
    ChannelReplacement.prototype = { 
    383383      }
    384384    }
    385385   
    386     if (chan instanceof Ci.nsIEncodedChannel && newChan instanceof Ci.nsIEncodedChannel) {
     386    if (chan instanceof CI.nsIEncodedChannel && newChan instanceof Ci.nsIEncodedChannel) {
    387387      newChan.applyConversion = chan.applyConversion;
    388388    }
    389389   
    390390    // we can't transfer resume information because we can't access mStartPos and mEntityID :(
    391391    // http://mxr.mozilla.org/mozilla-central/source/netwerk/protocol/http/src/nsHttpChannel.cpp#2826
    392392   
    393     if ("nsIApplicationCacheChannel" in Ci &&
    394       chan instanceof Ci.nsIApplicationCacheChannel && newChan instanceof Ci.nsIApplicationCacheChannel) {
     393    if ("nsIApplicationCacheChannel" in CI &&
     394      chan instanceof CI.nsIApplicationCacheChannel && newChan instanceof Ci.nsIApplicationCacheChannel) {
    395395      newChan.applicationCache = chan.applicationCache;
    396396      newChan.inheritApplicationCache = chan.inheritApplicationCache;
    397397    }
    398398   
    399     if (chan instanceof Ci.nsIPropertyBag && newChan instanceof Ci.nsIWritablePropertyBag)
     399    if (chan instanceof CI.nsIPropertyBag && newChan instanceof Ci.nsIWritablePropertyBag)
    400400      for (var properties = chan.enumerator, p; properties.hasMoreElements();)
    401         if ((p = properties.getNext()) instanceof Ci.nsIProperty)
     401        if ((p = properties.getNext()) instanceof CI.nsIProperty)
    402402          newChan.setProperty(p.name, p.value);
    403403
    404404    if (chan.loadFlags & chan.LOAD_DOCUMENT_URI) {
    ChannelReplacement.prototype = { 
    423423   
    424424    // nsHttpHandler::OnChannelRedirect()
    425425
    426     const CES = Ci.nsIChannelEventSink;
     426    const CES = CI.nsIChannelEventSink;
    427427    const flags = CES.REDIRECT_INTERNAL;
    428428    this._callSink(
    429       Cc["@mozilla.org/netwerk/global-channel-event-sink;1"].getService(CES),
     429      CC["@mozilla.org/netwerk/global-channel-event-sink;1"].getService(CES),
    430430      oldChan, newChan, flags);
    431431    var sink;
    432432   
    ChannelReplacement.prototype = { 
    444444   
    445445    newChan.originalURI = oldChan.originalURI;
    446446   
    447     sink = IOUtil.queryNotificationCallbacks(oldChan, Ci.nsIHttpEventSink);
     447    sink = IOUtil.queryNotificationCallbacks(oldChan, CI.nsIHttpEventSink);
    448448    if (sink) sink.onRedirect(oldChan, newChan);
    449449  },
    450450 
    ChannelReplacement.prototype = { 
    467467    }
    468468  },
    469469 
    470   _redirectCallback: ("nsIAsyncVerifyRedirectCallback" in Ci)
     470  _redirectCallback: ("nsIAsyncVerifyRedirectCallback" in CI)
    471471    ? {
    472         QueryInterface: xpcom_generateQI([Ci.nsIAsyncVerifyRedirectCallback]),
     472        QueryInterface: xpcom_generateQI([CI.nsIAsyncVerifyRedirectCallback]),
    473473        onRedirectVerifyCallback: function(result) {}
    474474      }
    475475    : null
    ChannelReplacement.prototype = { 
    542542        } else {
    543543          // safe browsing hook
    544544          if (this._classifierClass)
    545             this._classifierClass.createInstance(Ci.nsIChannelClassifier).start(newChan, true);
     545            this._classifierClass.createInstance(CI.nsIChannelClassifier).start(newChan, true);
    546546        }
    547547      } catch (e) {
    548548        ABE.log(e);
    function LoadGroupWrapper(channel, callback) { 
    590590  channel.loadGroup = this;
    591591}
    592592LoadGroupWrapper.prototype = {
    593   QueryInterface: xpcom_generateQI([Ci.nsILoadGroup]),
     593  QueryInterface: xpcom_generateQI([CI.nsILoadGroup]),
    594594 
    595595  get activeCount() {
    596596    return this._inner ? this._inner.activeCount : 0;
    LoadGroupWrapper.prototype = { 
    638638    if (this._channel.loadGroup) this._channel.loadGroup = this._inner;
    639639  },
    640640  _emptyEnum: {
    641     QueryInterface: xpcom_generateQI([Ci.nsISimpleEnumerator]),
     641    QueryInterface: xpcom_generateQI([CI.nsISimpleEnumerator]),
    642642    getNext: function() null,
    643643    hasMoreElements: function() false
    644644  }