Bug 530013: Fennec should take steps to auto-connect network connections [r=gavin.sharp]
--- a/mobile/app/mobile.js
+++ b/mobile/app/mobile.js
@@ -95,16 +95,19 @@ pref("network.http.pipelining", true);
pref("network.http.pipelining.ssl", true);
pref("network.http.proxy.pipelining", true);
pref("network.http.pipelining.maxrequests" , 6);
pref("network.http.keep-alive.timeout", 600);
pref("network.http.max-connections", 6);
pref("network.http.max-connections-per-server", 4);
pref("network.http.max-persistent-connections-per-server", 4);
pref("network.http.max-persistent-connections-per-proxy", 4);
+#ifdef MOZ_PLATFORM_HILDON
+pref("network.autodial-helper.enabled", true);
+#endif
/* session history */
pref("browser.sessionhistory.max_total_viewers", 1);
pref("browser.sessionhistory.max_entries", 50);
/* these should help performance */
pref("mozilla.widget.force-24bpp", true);
pref("mozilla.widget.use-buffer-pixmap", true);
--- a/mobile/chrome/content/Util.js
+++ b/mobile/chrome/content/Util.js
@@ -160,16 +160,24 @@ let Util = {
if (ourmstone != savedmstone) {
gPrefService.setCharPref("browser.startup.homepage_override.mstone", ourmstone);
return (savedmstone ? "new version" : "new profile");
}
return "none";
+ },
+
+ // Put the Mozilla networking code into a state that will kick the auto-connection
+ // process.
+ forceOnline: function forceOnline() {
+#ifdef MOZ_PLATFORM_HILDON
+ gIOService.offline = false;
+#endif
}
};
let Elements = {};
[
["browserBundle", "bundle_browser"],
["contentShowing", "bcast_contentShowing"],
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -490,16 +490,19 @@ var BrowserUI = {
this._setURI(urlString);
},
goToURI : function(aURI) {
aURI = aURI || this._edit.value;
if (!aURI)
return;
+ // Make sure we're online before attempting to load
+ Util.forceOnline();
+
// Give the new page lots of room
Browser.hideSidebars();
this._edit.popup.close();
this._edit.value = aURI;
var flags = Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
getBrowser().loadURIWithFlags(aURI, flags, null, null);
@@ -525,16 +528,19 @@ var BrowserUI = {
// We don't want the button to look pressed for now
button.parentNode.selectedItem = null;
// Give the new page lots of room
Browser.hideSidebars();
this._edit.popup.closePopup();
+ // Make sure we're online before attempting to load
+ Util.forceOnline();
+
var submission = button.engine.getSubmission(this._edit.value, null);
getBrowser().loadURI(submission.uri.spec, null, submission.postData, false);
},
updateStar : function() {
if (PlacesUtils.getMostRecentBookmarkForURI(Browser.selectedBrowser.currentURI) != -1)
this.starButton.setAttribute("starred", "true");
else
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -470,36 +470,39 @@ var Browser = {
os.addObserver(MemoryObserver, "memory-pressure", false);
// search engine changes
os.addObserver(BrowserSearch, "browser-search-engine-modified", false);
window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow = new nsBrowserAccess();
let browsers = document.getElementById("browsers");
- browsers.addEventListener("command", this._handleContentCommand, false);
+ browsers.addEventListener("command", this._handleContentCommand, true);
browsers.addEventListener("MozApplicationManifest", OfflineApps, false);
browsers.addEventListener("DOMUpdatePageReport", gPopupBlockerObserver.onUpdatePageReport, false);
- /* Initialize Spatial Navigation */
+ // Initialize Spatial Navigation
function panCallback(aElement) {
if (!aElement)
return;
// XXX We need to add this back
//canvasBrowser.ensureElementIsVisible(aElement);
}
// Init it with the "browsers" element, which will receive keypress events
// for all of our <browser>s
SpatialNavigation.init(browsers, panCallback);
- /* Login Manager */
+ // Login Manager
Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
- /* Command line arguments/initial homepage */
+ // Make sure we're online before attempting to load
+ Util.forceOnline();
+
+ // Command line arguments/initial homepage
let whereURI = "about:blank";
switch (Util.needHomepageOverride()) {
case "new profile":
whereURI = "about:firstrun";
break;
case "new version":
case "none":
whereURI = "about:blank";
@@ -889,16 +892,22 @@ var Browser = {
url = defaultPrefs.getCharPref("browser.startup.homepage");
// If url is a pipe-delimited set of pages, just take the first one.
if (url.indexOf("|") != -1)
url = url.split("|")[0];
} catch (e) { /* Fall back on about blank */ }
Browser.selectedBrowser.loadURI(url, null, null, false);
}
+ }
+ else if (/^about:neterror\?e=netOffline/.test(errorDoc.documentURI)) {
+ if (ot == errorDoc.getElementById("errorTryAgain") {
+ // Make sure we're online before attempting to load
+ Util.forceOnline();
+ }
}
},
/**
* Compute the sidebar percentage visibility.
*
* @param [optional] dx
* @param [optional] dy an offset distance at which to perform the visibility
--- a/mobile/chrome/content/extensions.js
+++ b/mobile/chrome/content/extensions.js
@@ -502,16 +502,19 @@ var ExtensionsView = {
this._list.insertBefore(item, this._repoItem);
return item;
},
getAddonsFromRepo: function ev_getAddonsFromRepo(aTerms, aSelectFirstResult) {
this.clearSection("repo");
+ // Make sure we're online before attempting to load
+ Util.forceOnline();
+
if (this._repo.isSearching)
this._repo.cancelSearch();
let strings = Elements.browserBundle;
if (aTerms) {
AddonSearchResults.selectFirstResult = aSelectFirstResult;
this.displaySectionMessage("repo", strings.getString("addonsSearchStart.label"),
strings.getString("addonsSearchStart.button"), false);
@@ -602,17 +605,20 @@ var ExtensionsView = {
resetSearch: function ev_resetSearch() {
this.searchBox.value = "";
this.getAddonsFromRepo("");
},
updateAll: function ev_updateAll() {
if (!this._isXPInstallEnabled())
return;
-
+
+ // Make sure we're online before attempting to load
+ Util.forceOnline();
+
// To support custom views we check the add-ons displayed in the list
let items = [];
let start = this._localItem.nextSibling;
let end = this._repoItem;
while (start != end) {
if (start.getAttribute("updateable") == "true")
items.push(this._extmgr.getItemForID(start.getAttribute("addonID")));