Backout a9f4c0795560 (bug 715673), 05dfaf51fa83 (bug 715388) & af32a0da45c9 (bug 697858) for native Android test failures

This commit is contained in:
Ed Morley 2012-01-09 22:45:30 +00:00
parent 7787c56627
commit 03ac2b686a
5 changed files with 39 additions and 89 deletions

View File

@ -102,7 +102,6 @@ abstract public class GeckoApp
public static final String SAVED_STATE_TITLE = "title";
public static final String SAVED_STATE_VIEWPORT = "viewport";
public static final String SAVED_STATE_SCREEN = "screen";
public static final String SAVED_STATE_SESSION = "session";
private LinearLayout mMainLayout;
private RelativeLayout mGeckoLayout;
@ -142,7 +141,6 @@ abstract public class GeckoApp
public String mLastViewport;
public byte[] mLastScreen;
public int mOwnActivityDepth = 0;
private boolean mRestoreSession = false;
private Vector<View> mPluginViews = new Vector<View>();
@ -577,7 +575,6 @@ abstract public class GeckoApp
outState.putString(SAVED_STATE_TITLE, mLastTitle);
outState.putString(SAVED_STATE_VIEWPORT, mLastViewport);
outState.putByteArray(SAVED_STATE_SCREEN, mLastScreen);
outState.putBoolean(SAVED_STATE_SESSION, true);
}
public class SessionSnapshotRunnable implements Runnable {
@ -1428,7 +1425,6 @@ abstract public class GeckoApp
mLastTitle = savedInstanceState.getString(SAVED_STATE_TITLE);
mLastViewport = savedInstanceState.getString(SAVED_STATE_VIEWPORT);
mLastScreen = savedInstanceState.getByteArray(SAVED_STATE_SCREEN);
mRestoreSession = savedInstanceState.getBoolean(SAVED_STATE_SESSION);
}
Intent intent = getIntent();
@ -1464,7 +1460,7 @@ abstract public class GeckoApp
prefetchDNS(intent.getData());
sGeckoThread = new GeckoThread(intent, mLastUri, mLastTitle, mRestoreSession);
sGeckoThread = new GeckoThread(intent, mLastUri, mLastTitle);
if (!ACTION_DEBUG.equals(intent.getAction()) &&
checkAndSetLaunchState(LaunchState.Launching, LaunchState.Launched))
sGeckoThread.start();

View File

@ -417,7 +417,7 @@ public class GeckoAppShell
}
}
public static void runGecko(String apkPath, String args, String url, boolean restoreSession) {
public static void runGecko(String apkPath, String args, String url) {
// run gecko -- it will spawn its own thread
GeckoAppShell.nativeInit();
@ -442,8 +442,6 @@ public class GeckoAppShell
combinedArgs += " " + args;
if (url != null)
combinedArgs += " -remote " + url;
if (restoreSession)
combinedArgs += " -restoresession";
GeckoApp.mAppContext.runOnUiThread(new Runnable() {
public void run() {

View File

@ -55,13 +55,11 @@ public class GeckoThread extends Thread {
Intent mIntent;
String mUri;
String mTitle;
boolean mRestoreSession;
GeckoThread (Intent intent, String uri, String title, boolean restoreSession) {
GeckoThread (Intent intent, String uri, String title) {
mIntent = intent;
mUri = uri;
mTitle = title;
mRestoreSession = restoreSession;
}
public void run() {
@ -108,8 +106,7 @@ public class GeckoThread extends Thread {
GeckoAppShell.runGecko(app.getApplication().getPackageResourcePath(),
mIntent.getStringExtra("args"),
mUri,
mRestoreSession);
mUri);
} catch (Exception e) {
Log.e(LOGTAG, "top level exception", e);
StringWriter sw = new StringWriter();

View File

@ -262,13 +262,8 @@ var BrowserApp = {
Cc["@mozilla.org/satchel/form-history;1"].getService(Ci.nsIFormHistory2);
let url = "about:home";
let restoreSession = false;
if ("arguments" in window) {
if (window.arguments[0])
uri = window.arguments[0];
if (window.arguments[1])
restoreSession = window.arguments[1];
}
if ("arguments" in window && window.arguments[0])
url = window.arguments[0];
// XXX maybe we don't do this if the launch was kicked off from external
Services.io.offline = false;
@ -280,7 +275,7 @@ var BrowserApp = {
// restore the previous session
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
if (restoreSession || ss.shouldRestore()) {
if (ss.shouldRestore()) {
// A restored tab should not be active if we are loading a URL
let restoreToFront = false;
@ -306,9 +301,6 @@ var BrowserApp = {
ss.restoreLastSession(restoreToFront);
} else {
this.addTab(url);
// show telemetry door hanger if we aren't restoring a session
this._showTelemetryPrompt();
}
// notify java that gecko has loaded
@ -317,35 +309,35 @@ var BrowserApp = {
type: "Gecko:Ready"
}
});
},
_showTelemetryPrompt: function _showTelemetryPrompt() {
let telemetryPrompted = false;
try {
telemetryPrompted = Services.prefs.getBoolPref("toolkit.telemetry.prompted");
} catch (e) { /* Optional */ }
if (telemetryPrompted)
return;
} catch (e) {
// optional
}
let buttons = [
{
label: Strings.browser.GetStringFromName("telemetry.optin.yes"),
callback: function () {
Services.prefs.setBoolPref("toolkit.telemetry.prompted", true);
Services.prefs.setBoolPref("toolkit.telemetry.enabled", true);
if (!telemetryPrompted) {
let buttons = [
{
label: Strings.browser.GetStringFromName("telemetry.optin.yes"),
callback: function () {
Services.prefs.setBoolPref("toolkit.telemetry.prompted", true);
Services.prefs.setBoolPref("toolkit.telemetry.enabled", true);
}
},
{
label: Strings.browser.GetStringFromName("telemetry.optin.no"),
callback: function () {
Services.prefs.setBoolPref("toolkit.telemetry.prompted", true);
Services.prefs.setBoolPref("toolkit.telemetry.enabled", false);
}
}
},
{
label: Strings.browser.GetStringFromName("telemetry.optin.no"),
callback: function () {
Services.prefs.setBoolPref("toolkit.telemetry.prompted", true);
Services.prefs.setBoolPref("toolkit.telemetry.enabled", false);
}
}
];
let brandShortName = Strings.brand.GetStringFromName("brandShortName");
let message = Strings.browser.formatStringFromName("telemetry.optin.message", [brandShortName], 1);
NativeWindow.doorhanger.show(message, "telemetry-optin", buttons);
];
let brandShortName = Strings.brand.GetStringFromName("brandShortName");
let message = Strings.browser.formatStringFromName("telemetry.optin.message", [brandShortName], 1);
NativeWindow.doorhanger.show(message, "telemetry-optin", buttons);
}
},
shutdown: function shutdown() {
@ -494,27 +486,8 @@ var BrowserApp = {
},
quit: function quit() {
// Figure out if there's at least one other browser window around.
let lastBrowser = true;
let e = Services.wm.getEnumerator("navigator:browser");
while (e.hasMoreElements() && lastBrowser) {
let win = e.getNext();
if (win != window)
lastBrowser = false;
}
if (lastBrowser) {
// Let everyone know we are closing the last browser window
let closingCanceled = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(closingCanceled, "browser-lastwindow-close-requested", null);
if (closingCanceled.data)
return;
Services.obs.notifyObservers(null, "browser-lastwindow-close-granted", null);
}
window.QueryInterface(Ci.nsIDOMChromeWindow).minimize();
window.close();
window.QueryInterface(Ci.nsIDOMChromeWindow).minimize();
window.close();
},
saveAsPDF: function saveAsPDF(aBrowser) {

View File

@ -11,19 +11,13 @@ function dump(a) {
}
function openWindow(aParent, aURL, aTarget, aFeatures, aArgs) {
let argsArray = Cc["@mozilla.org/supports-array;1"].createInstance(Ci.nsISupportsArray);
let urlString = null;
let restoreSessionBool = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool);
if ("url" in aArgs) {
urlString = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
urlString.data = aArgs.url;
let argString = null;
if (aArgs && !(aArgs instanceof Ci.nsISupportsArray)) {
argString = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
argString.data = aArgs;
}
restoreSessionBool.data = "restoreSession" in aArgs ? aArgs.restoreSession : false;
argsArray.AppendElement(urlString, false);
argsArray.AppendElement(restoreSessionBool, false);
return Services.ww.openWindow(aParent, aURL, aTarget, aFeatures, argsArray);
return Services.ww.openWindow(aParent, aURL, aTarget, aFeatures, argString || aArgs);
}
@ -47,12 +41,8 @@ function BrowserCLH() {}
BrowserCLH.prototype = {
handle: function fs_handle(aCmdLine) {
let urlParam = "about:home";
let restoreSession = false;
try {
urlParam = aCmdLine.handleFlagWithParam("remote", false);
} catch (e) { /* Optional */ }
try {
restoreSession = aCmdLine.handleFlag("restoresession", false);
urlParam = aCmdLine.handleFlagWithParam("remote", false);
} catch (e) { /* Optional */ }
try {
@ -64,11 +54,7 @@ BrowserCLH.prototype = {
if (browserWin) {
browserWin.browserDOMWindow.openURI(uri, null, Ci.nsIBrowserDOMWindow.OPEN_NEWTAB, Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
} else {
let args = {
url: urlParam,
restoreSession: restoreSession
};
browserWin = openWindow(null, "chrome://browser/content/browser.xul", "_blank", "chrome,dialog=no,all", args);
browserWin = openWindow(null, "chrome://browser/content/browser.xul", "_blank", "chrome,dialog=no,all", urlParam);
}
aCmdLine.preventDefault = true;