Changeset 1044

Show
Ignore:
Timestamp:
2008-08-13 03:33:35 (5 months ago)
Author:
MaierMan
Message:

Fix: Channel redirects ceased working for some reason

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/chrome/content/common/overlayFunctions.js

    r1030 r1044  
    3939/** 
    4040 * include other chrome js files 
    41  * @param uri Relative URI to the dta content path 
    42  * @param many Optional. If set, then include that file more than once  
     41 *  
     42 * @param uri 
     43 *          Relative URI to the dta content path 
     44 * @param many 
     45 *          Optional. If set, then include that file more than once 
    4346 */ 
    4447var DTA_include = function() { 
     
    117120 
    118121function DTA_URL(url, preference) { 
    119         this.url = url; 
    120122        this.preference = preference ? preference : 100; 
    121 }; 
    122 DTA_URL.prototype = { 
    123         get url() { 
    124                 return this._url; 
    125         }, 
    126         set url(nv) { 
    127                 delete this.hash; 
    128                  
    129                 if (nv instanceof Components.interfaces.nsIURI) { 
    130                         nv = nv.QueryInterface(Components.interfaces.nsIURL); 
    131                 } 
    132                 if (!(nv instanceof Components.interfaces.nsIURL)) { 
     123 
     124        try { 
     125                if (url instanceof Components.interfaces.nsIURI) { 
     126                        url = url.QueryInterface(Components.interfaces.nsIURL); 
     127                } 
     128                if (!(url instanceof Components.interfaces.nsIURL)) { 
    133129                        throw new Components.Exception("you must pass an nsIURL"); 
    134130                } 
    135131 
    136                 this._url = nv.clone(); 
    137                 
     132                this._url = url.clone(); 
     133         
    138134                let hash = DTA_getLinkPrintHash(this._url); 
    139135                this._url.ref = '';              
     
    142138                } 
    143139                this._usable = DTA_URLhelpers.decodeCharset(this._url.spec, this._url.originCharset); 
     140        } 
     141        catch (ex) { 
     142                DTA_debug.log("failed to set URL", ex); 
     143                throw ex; 
     144        } 
     145}; 
     146DTA_URL.prototype = { 
     147        get url() { 
     148                return this._url; 
    144149        }, 
    145150        get usable() { 
     
    512517 
    513518/** 
    514  * Checks if a provided strip has the correct hash format 
    515  * Supported are: md5, sha1, sha256, sha384, sha512 
    516  * @param hash Hash to check 
     519 * Checks if a provided strip has the correct hash format Supported are: md5, 
     520 * sha1, sha256, sha384, sha512 
     521 *  
     522 * @param hash 
     523 *          Hash to check 
    517524 * @return hash type or null 
    518525 */ 
     
    550557/** 
    551558 * Get a link-fingerprint hash from an url (or just the hash component) 
    552  * @param url. Either String or nsIURI 
     559 *  
     560 * @param url. 
     561 *          Either String or nsIURI 
    553562 * @return Valid hash string or null 
    554563 */ 
     
    571580/** 
    572581 * Get a link-fingerprint metalink from an url (or just the hash component 
    573  * @param url. Either String or nsIURI 
    574  * @param charset. Optional. Charset of the orgin link and link to be created 
     582 *  
     583 * @param url. 
     584 *          Either String or nsIURI 
     585 * @param charset. 
     586 *          Optional. Charset of the orgin link and link to be created 
    575587 * @return Valid hash string or null 
    576588 */ 
     
    597609 
    598610/** 
    599  * Tiny helper to "convert" given object into a weak observer. Object must still implement .observe() 
     611 * Tiny helper to "convert" given object into a weak observer. Object must still 
     612 * implement .observe() 
     613 *  
    600614 * @author Nils 
    601  * @param obj Object to convert 
     615 * @param obj 
     616 *          Object to convert 
    602617 */ 
    603618function DTA_makeObserver(obj) { 
  • trunk/chrome/content/dta/manager.js

    r1043 r1044  
    627627                } 
    628628        }, 
     629        replace: function(url, newurl) { 
     630                this._urls = this._urls.map(function(u) u.url.spec == url.url.spec ? newurl : u); 
     631        }, 
    629632        markBad: function um_markBad(url) { 
    630633                if (this._urls.length > 1) { 
    631                         this._urls = this._urls.filter(function(u) { return u != url; }); 
     634                        this._urls = this._urls.filter(function(u) u != url); 
    632635                } 
    633636                else if (this._urls[0] == url) { 
     
    21672170                try { 
    21682171                        this._chan == newChannel; 
    2169                         this.url.url = newChannel.URI; 
     2172                        let newurl = new DTA_URL(newChannel.URI.QueryInterface(Ci.nsIURL), this.url.preference); 
     2173                        this.d.urlManager.replace(this.url, newurl); 
     2174                        this.url = newurl; 
    21702175                        this.d.fileName = this.url.usable.getUsableFileName(); 
    21712176                } 
  • trunk/chrome/content/integration/elements.js

    r1030 r1044  
    3838  
    3939var DTA_Prompts = {}; 
    40 Components.utils.import('resource://dta/prompts.jsm', DTA_Prompts);  
     40Components.utils.import('resource://dta/prompts.jsm', DTA_Prompts); 
    4141  
    4242// DTA context overlay 
     
    6565                } 
    6666                 
    67                 var ref = DTA_AddingFunctions.getRef(doc); 
     67                let ref = DTA_AddingFunctions.getRef(doc); 
    6868                 
    6969                for (var i = 0; i < lnks.length; ++i) {