зеркало из https://github.com/mozilla/pjs.git
bug 708171 - XUL fennec hangs on start up r=mbrubeck
This commit is contained in:
Родитель
f7b12259d1
Коммит
9453ec7dd6
|
@ -73,6 +73,9 @@ import android.net.NetworkInfo;
|
|||
import android.graphics.drawable.*;
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class GeckoAppShell
|
||||
{
|
||||
private static final String LOG_FILE_NAME = "GeckoAppShell";
|
||||
|
@ -1629,10 +1632,6 @@ public class GeckoAppShell
|
|||
}
|
||||
}
|
||||
|
||||
// unused
|
||||
public static String handleGeckoMessage(String message) {
|
||||
return "";
|
||||
}
|
||||
// unused
|
||||
static void checkUriVisited(String uri) {}
|
||||
// unused
|
||||
|
@ -1645,6 +1644,27 @@ public class GeckoAppShell
|
|||
GeckoBatteryManager.enableNotifications();
|
||||
}
|
||||
|
||||
public static String handleGeckoMessage(String message) {
|
||||
//
|
||||
// {"gecko": {
|
||||
// "type": "value",
|
||||
// "event_specific": "value",
|
||||
// ....
|
||||
try {
|
||||
JSONObject json = new JSONObject(message);
|
||||
final JSONObject geckoObject = json.getJSONObject("gecko");
|
||||
String type = geckoObject.getString("type");
|
||||
|
||||
if (type.equals("Gecko:Ready")) {
|
||||
onAppShellReady();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.i(LOG_FILE_NAME, "handleGeckoMessage throws " + e);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public static void disableBatteryNotifications() {
|
||||
GeckoBatteryManager.disableNotifications();
|
||||
}
|
||||
|
|
|
@ -53,6 +53,16 @@ let Ci = Components.interfaces;
|
|||
let Cu = Components.utils;
|
||||
let Cr = Components.results;
|
||||
|
||||
|
||||
function getBridge() {
|
||||
return Cc["@mozilla.org/android/bridge;1"].getService(Ci.nsIAndroidBridge);
|
||||
}
|
||||
|
||||
function sendMessageToJava(aMessage) {
|
||||
return getBridge().handleGeckoMessage(JSON.stringify(aMessage));
|
||||
}
|
||||
|
||||
|
||||
function getBrowser() {
|
||||
return Browser.selectedBrowser;
|
||||
}
|
||||
|
@ -166,7 +176,16 @@ var Browser = {
|
|||
|
||||
startup: function startup() {
|
||||
var self = this;
|
||||
|
||||
|
||||
try {
|
||||
sendMessageToJava({
|
||||
gecko: {
|
||||
type: "Gecko:Ready"
|
||||
}
|
||||
});
|
||||
} catch(e) {
|
||||
Cu.reportError("error sending message: " + e);
|
||||
}
|
||||
try {
|
||||
messageManager.loadFrameScript("chrome://browser/content/Util.js", true);
|
||||
messageManager.loadFrameScript("chrome://browser/content/forms.js", true);
|
||||
|
|
|
@ -267,6 +267,9 @@
|
|||
#ifdef XP_MACOSX
|
||||
@BINPATH@/components/widget_cocoa.xpt
|
||||
#endif
|
||||
#ifdef ANDROID
|
||||
@BINPATH@/components/widget_android.xpt
|
||||
#endif
|
||||
@BINPATH@/components/windowds.xpt
|
||||
@BINPATH@/components/windowwatcher.xpt
|
||||
@BINPATH@/components/xpcom_base.xpt
|
||||
|
|
Загрузка…
Ссылка в новой задаче