Bug 789889 - Speculatively connect to links if you put your finger down on it. r=mfinkle

This commit is contained in:
Kartikaya Gupta 2012-09-13 15:37:59 -04:00
parent 9d7ced3202
commit fcc03d6c72

View File

@ -3505,8 +3505,24 @@ var BrowserEventHandler = {
if (!closest)
closest = aEvent.target;
if (closest)
if (closest) {
let uri = this._getLinkURI(closest);
if (uri) {
Services.io.QueryInterface(Ci.nsISpeculativeConnect).speculativeConnect(uri, null, null);
}
this._doTapHighlight(closest);
}
},
_getLinkURI: function(aElement) {
if (aElement.nodeType == Ci.nsIDOMNode.ELEMENT_NODE &&
((aElement instanceof Ci.nsIDOMHTMLAnchorElement && aElement.href) ||
(aElement instanceof Ci.nsIDOMHTMLAreaElement && aElement.href))) {
try {
return Services.io.newURI(aElement.href, null, null);
} catch (e) {}
}
return null;
},
observe: function(aSubject, aTopic, aData) {