Advertisement
Guest User

Untitled

a guest
Sep 26th, 2011
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   forceURI: function(uri, fallback, ctx) {
  2.     if (this.mustForce(uri)) {
  3.       try {
  4.        
  5.         uri.scheme = "https";
  6.        
  7.         this.log("Forced URI " + uri.spec);
  8.         return true;
  9.        
  10.       } catch(e) {
  11.        
  12.         if (ctx && ctx instanceof CI.nsIDOMHTMLImageElement || ctx instanceof CI.nsIDOMHTMLInputElement ||
  13.             ctx instanceof CI.nsIObjectLoadingContent) {
  14.           uri = uri.clone();
  15.           uri.scheme = "https";
  16.          
  17.           var type, attr;
  18.           if (ctx instanceof CI.nsIObjectLoadingContent) {
  19.             type = "Object";
  20.             attr = "data";
  21.           } else {
  22.             type = "Image";
  23.             attr = "src";
  24.           }
  25.           Thread.asap(function() { ctx.setAttribute(attr, uri.spec); });
  26.          
  27.           var msg = type + " HTTP->HTTPS redirection to " + uri.spec;
  28.           this.log(msg);  
  29.           throw msg;
  30.         }
  31.        
  32.         if (fallback && fallback()) {
  33.            this.log("Channel redirection fallback on " + uri.spec);
  34.            return true;
  35.         }
  36.        
  37.         this.log("Error trying to force https on " + uri.spec + ": " + e);
  38.       }
  39.     }
  40.     return false;
  41.   },
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement