зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1312954
- Part 8: Update speculativeConnect to speculativeConnect2 for about:newtab. r=Gijs
This commit is contained in:
Родитель
a51aff22a7
Коммит
d2f929cacb
|
@ -311,10 +311,21 @@ Site.prototype = {
|
|||
_speculativeConnect: function Site_speculativeConnect() {
|
||||
let sc = Services.io.QueryInterface(Ci.nsISpeculativeConnect);
|
||||
let uri = Services.io.newURI(this.url);
|
||||
|
||||
if (!uri.schemeIs("http") && !uri.schemeIs("https")) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// This can throw for certain internal URLs, when they wind up in
|
||||
// about:newtab. Be sure not to propagate the error.
|
||||
sc.speculativeConnect(uri, null);
|
||||
|
||||
// We use the URI's codebase principal here to open its speculative
|
||||
// connection.
|
||||
let originAttributes = document.docShell.getOriginAttributes();
|
||||
let principal = Services.scriptSecurityManager
|
||||
.createCodebasePrincipal(uri, originAttributes);
|
||||
sc.speculativeConnect2(uri, principal, null);
|
||||
} catch (e) {}
|
||||
},
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче