Skip to content

Commit abe88bb

Browse files
Mike Perrypde
authored andcommitted
Manually merge slightly less of HTTPS.js.
1 parent 27a2629 commit abe88bb

File tree

1 file changed

+6
-32
lines changed

1 file changed

+6
-32
lines changed

src/chrome/content/code/HTTPS.js

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ const PolicyState = {
2121
};
2222

2323
const HTTPS = {
24+
ready: false,
25+
2426
secureCookies: true,
2527
secureCookiesExceptions: null,
2628
secureCookiesForced: null,
@@ -57,7 +59,7 @@ const HTTPS = {
5759
}
5860
if (ChannelReplacement.supported) {
5961
HTTPS.log(INFO,"Scheduling channel replacement for "+channel.URI.spec);
60-
IOUtil.runWhenPending(channel, function() {
62+
ChannelReplacement.runWhenPending(channel, function() {
6163
var cr = new ChannelReplacement(channel, uri);
6264
cr.replace(true,null);
6365
cr.open();
@@ -302,7 +304,7 @@ const HTTPS = {
302304
}
303305

304306
if (cs) {
305-
Array.prototype.push.apply(
307+
dcookies.push.apply(
306308
dcookies, cs.split(/\s*;\s*/).map(function(cs) { var nv = cs.split("="); return { name: nv.shift(), value: nv.join("=") } })
307309
.filter(function(c) { return dcookies.every(function(x) { return x.name != c.name }) })
308310
);
@@ -360,33 +362,6 @@ const HTTPS = {
360362
: this._globalUnsafeCookies = value;
361363
},
362364

363-
shouldForbid: function(site) {
364-
switch(this.allowHttpsOnly) {
365-
case 0:
366-
return false;
367-
case 1:
368-
return /^(?:ht|f)tp:\/\//.test(site) && this.isProxied(site);
369-
case 2:
370-
return /^(?:ht|f)tp:\/\//.test(site);
371-
}
372-
return false;
373-
},
374-
375-
isProxied: function(u) {
376-
var ps = CC["@mozilla.org/network/protocol-proxy-service;1"].getService(CI.nsIProtocolProxyService);
377-
378-
this.isProxied = function(u) {
379-
try {
380-
if (!(u instanceof CI.nsIURI)) {
381-
u = IOS.newURI(u, null, null);
382-
}
383-
return ps.resolve(u, 0).type != "direct";
384-
} catch(e) {
385-
return false;
386-
}
387-
}
388-
},
389-
390365
_getParent: function(req, w) {
391366
return w && w.frameElement || DOM.findBrowserForNode(w || IOUtil.findWindow(req));
392367
}
@@ -402,11 +377,10 @@ const HTTPS = {
402377
});
403378
HTTPS.__defineSetter__(p, function(n) {
404379
v = n;
405-
HTTPS.cookiesCleanup();
380+
if (HTTPS.ready) HTTPS.cookiesCleanup();
406381
return v;
407382
});
408383
});
409384
})();
410385

411-
412-
386+
HTTPS.ready = true;

0 commit comments

Comments
 (0)