Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- forceURI: function(uri, fallback, ctx) {
- if (this.mustForce(uri)) {
- try {
- uri.scheme = "https";
- this.log("Forced URI " + uri.spec);
- return true;
- } catch(e) {
- if (ctx && ctx instanceof CI.nsIDOMHTMLImageElement || ctx instanceof CI.nsIDOMHTMLInputElement ||
- ctx instanceof CI.nsIObjectLoadingContent) {
- uri = uri.clone();
- uri.scheme = "https";
- var type, attr;
- if (ctx instanceof CI.nsIObjectLoadingContent) {
- type = "Object";
- attr = "data";
- } else {
- type = "Image";
- attr = "src";
- }
- Thread.asap(function() { ctx.setAttribute(attr, uri.spec); });
- var msg = type + " HTTP->HTTPS redirection to " + uri.spec;
- this.log(msg);
- throw msg;
- }
- if (fallback && fallback()) {
- this.log("Channel redirection fallback on " + uri.spec);
- return true;
- }
- this.log("Error trying to force https on " + uri.spec + ": " + e);
- }
- }
- return false;
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement