mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backout 823a6f7499f8 (bug 894313) for possibly breaking Android tests on a CLOSED TREE
This commit is contained in:
parent
6a8223adf9
commit
08a9b670dd
@ -176,6 +176,7 @@ abstract public class GeckoApp
|
||||
private static GeckoApp sAppContext;
|
||||
protected MenuPanel mMenuPanel;
|
||||
protected Menu mMenu;
|
||||
private static GeckoThread sGeckoThread;
|
||||
protected GeckoProfile mProfile;
|
||||
public static int mOrientation;
|
||||
protected boolean mIsRestoringActivity;
|
||||
@ -1278,7 +1279,7 @@ abstract public class GeckoApp
|
||||
return;
|
||||
}
|
||||
|
||||
if (GeckoThread.isCreated()) {
|
||||
if (sGeckoThread != null) {
|
||||
// This happens when the GeckoApp activity is destroyed by Android
|
||||
// without killing the entire application (see Bug 769269).
|
||||
mIsRestoringActivity = true;
|
||||
@ -1428,12 +1429,9 @@ abstract public class GeckoApp
|
||||
String passedUri = null;
|
||||
String uri = getURIFromIntent(intent);
|
||||
if (uri != null && uri.length() > 0) {
|
||||
GeckoThread.setUri(uri);
|
||||
passedUri = uri;
|
||||
}
|
||||
|
||||
GeckoThread.setArgs(intent.getStringExtra("args"));
|
||||
GeckoThread.setAction(action);
|
||||
|
||||
final boolean isExternalURL = passedUri != null && !passedUri.equals("about:home");
|
||||
StartupAction startupAction;
|
||||
if (isExternalURL) {
|
||||
@ -1495,16 +1493,19 @@ abstract public class GeckoApp
|
||||
|
||||
Telemetry.HistogramAdd("FENNEC_STARTUP_GECKOAPP_ACTION", startupAction.ordinal());
|
||||
|
||||
if (!mIsRestoringActivity) {
|
||||
sGeckoThread = new GeckoThread(intent, passedUri);
|
||||
}
|
||||
if (!ACTION_DEBUG.equals(action) &&
|
||||
GeckoThread.checkAndSetLaunchState(GeckoThread.LaunchState.Launching, GeckoThread.LaunchState.Launched)) {
|
||||
GeckoThread.getInstance().start();
|
||||
sGeckoThread.start();
|
||||
} else if (ACTION_DEBUG.equals(action) &&
|
||||
GeckoThread.checkAndSetLaunchState(GeckoThread.LaunchState.Launching, GeckoThread.LaunchState.WaitForDebugger)) {
|
||||
ThreadUtils.getUiHandler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GeckoThread.setLaunchState(GeckoThread.LaunchState.Launching);
|
||||
GeckoThread.getInstance().start();
|
||||
sGeckoThread.start();
|
||||
}
|
||||
}, 1000 * 5 /* 5 seconds */);
|
||||
}
|
||||
|
@ -38,35 +38,12 @@ public class GeckoThread extends Thread implements GeckoEventListener {
|
||||
|
||||
private static LaunchState sLaunchState = LaunchState.Launching;
|
||||
|
||||
private static GeckoThread sGeckoThread;
|
||||
private static String sUri;
|
||||
private static String sArgs;
|
||||
private static String sAction;
|
||||
private Intent mIntent;
|
||||
private final String mUri;
|
||||
|
||||
static void setUri(String uri) {
|
||||
sUri = uri;
|
||||
}
|
||||
|
||||
static void setArgs(String args) {
|
||||
sArgs = args;
|
||||
}
|
||||
|
||||
static void setAction(String action) {
|
||||
sAction = action;
|
||||
}
|
||||
|
||||
static boolean isCreated() {
|
||||
return null != sGeckoThread;
|
||||
}
|
||||
|
||||
static GeckoThread getInstance() {
|
||||
if (sGeckoThread == null) {
|
||||
sGeckoThread = new GeckoThread();
|
||||
}
|
||||
return sGeckoThread;
|
||||
}
|
||||
|
||||
private GeckoThread() {
|
||||
GeckoThread(Intent intent, String uri) {
|
||||
mIntent = intent;
|
||||
mUri = uri;
|
||||
setName("Gecko");
|
||||
GeckoAppShell.getEventDispatcher().registerEventListener("Gecko:Ready", this);
|
||||
}
|
||||
@ -144,13 +121,13 @@ public class GeckoThread extends Thread implements GeckoEventListener {
|
||||
|
||||
Log.w(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - runGecko");
|
||||
|
||||
String args = addCustomProfileArg(sArgs);
|
||||
String type = getTypeFromAction(sAction != null ? sAction :
|
||||
sUri != null ? Intent.ACTION_VIEW : Intent.ACTION_MAIN);
|
||||
String args = addCustomProfileArg(mIntent.getStringExtra("args"));
|
||||
String type = getTypeFromAction(mIntent.getAction());
|
||||
mIntent = null;
|
||||
|
||||
// and then fire us up
|
||||
Log.i(LOGTAG, "RunGecko - args = " + args);
|
||||
GeckoAppShell.runGecko(path, args, sUri, type);
|
||||
GeckoAppShell.runGecko(path, args, mUri, type);
|
||||
}
|
||||
|
||||
private static Object sLock = new Object();
|
||||
|
@ -28,6 +28,8 @@ import android.os.Handler;
|
||||
|
||||
public class GeckoView extends LayerView
|
||||
implements GeckoEventListener, ContextGetter {
|
||||
static GeckoThread sGeckoThread;
|
||||
|
||||
public GeckoView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
@ -35,9 +37,12 @@ public class GeckoView extends LayerView
|
||||
String url = a.getString(R.styleable.GeckoView_url);
|
||||
a.recycle();
|
||||
|
||||
if (url != null) {
|
||||
GeckoThread.setUri(url);
|
||||
GeckoThread.setAction(Intent.ACTION_VIEW);
|
||||
Intent intent;
|
||||
if (url == null) {
|
||||
intent = new Intent(Intent.ACTION_MAIN);
|
||||
} else {
|
||||
intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
GeckoAppShell.sendEventToGecko(GeckoEvent.createURILoadEvent(url));
|
||||
}
|
||||
GeckoAppShell.setContextGetter(this);
|
||||
if (context instanceof Activity) {
|
||||
@ -48,11 +53,12 @@ public class GeckoView extends LayerView
|
||||
BrowserDB.initialize(profile.getName());
|
||||
GeckoAppShell.registerEventListener("Gecko:Ready", this);
|
||||
|
||||
sGeckoThread = new GeckoThread(intent, url);
|
||||
ThreadUtils.setUiThread(Thread.currentThread(), new Handler());
|
||||
initializeView(GeckoAppShell.getEventDispatcher());
|
||||
if (GeckoThread.checkAndSetLaunchState(GeckoThread.LaunchState.Launching, GeckoThread.LaunchState.Launched)) {
|
||||
GeckoAppShell.setLayerView(this);
|
||||
GeckoThread.getInstance().start();
|
||||
sGeckoThread.start();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user