зеркало из https://github.com/mozilla/pluotsorbet.git
set midletClassName in config file
This commit is contained in:
Родитель
fafa530c42
Коммит
a7508c00cc
|
@ -15,6 +15,7 @@ var MIDlet = {
|
|||
};
|
||||
|
||||
var config = {
|
||||
midletClassName: "RunTests",
|
||||
};
|
||||
|
||||
// The base directory of the app, relative to the current page. Normally this
|
||||
|
|
|
@ -43,6 +43,10 @@
|
|||
|
||||
params.args = (params.args || "").split(",");
|
||||
|
||||
if ("midletClassName" in params) {
|
||||
params.midletClassName = params.midletClassName.replace(/\//g, '.');
|
||||
}
|
||||
|
||||
for (var name in params) {
|
||||
config[name] = params[name];
|
||||
}
|
||||
|
|
3
index.js
3
index.js
|
@ -7,9 +7,8 @@
|
|||
* Pre-load dependencies and then load the main page.
|
||||
*/
|
||||
(function() {
|
||||
var midletClassName = config.midletClassName ? config.midletClassName.replace(/\//g, '.') : "RunTests";
|
||||
var loadingPromises = [];
|
||||
if (midletClassName == "RunTests") {
|
||||
if (config.midletClassName == "RunTests") {
|
||||
loadingPromises.push(loadScript("tests/contacts.js"),
|
||||
loadScript("tests/index.js"));
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ var initialFiles = [
|
|||
var initFS = new Promise(function(resolve, reject) {
|
||||
fs.init(resolve);
|
||||
}).then(function() {
|
||||
if (typeof MIDP !== "undefined" && MIDP.midletClassName == "RunTests") {
|
||||
if (typeof config !== "undefined" && config.midletClassName == "RunTests") {
|
||||
initialDirs.push("/tcktestdir");
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ var initFS = new Promise(function(resolve, reject) {
|
|||
}).then(function() {
|
||||
var filePromises = [];
|
||||
|
||||
if (typeof MIDP !== "undefined" && MIDP.midletClassName == "RunTests") {
|
||||
if (typeof config !== "undefined" && config.midletClassName == "RunTests") {
|
||||
initialFiles.push({ sourcePath: "certs/_test.ks", targetPath: "/_test.ks" });
|
||||
}
|
||||
|
||||
|
|
4
main.js
4
main.js
|
@ -17,7 +17,7 @@ if ("gamepad" in config && !/no|0/.test(config.gamepad)) {
|
|||
|
||||
var jars = ["java/classes.jar"];
|
||||
|
||||
if (MIDP.midletClassName == "RunTests") {
|
||||
if (config.midletClassName == "RunTests") {
|
||||
jars.push("tests/tests.jar");
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ if (config.downloadJAD) {
|
|||
}));
|
||||
}
|
||||
|
||||
if (MIDP.midletClassName == "RunTests") {
|
||||
if (config.midletClassName == "RunTests") {
|
||||
loadingPromises.push(loadScript("tests/native.js"),
|
||||
loadScript("tests/override.js"),
|
||||
loadScript("tests/mozactivitymock.js"));
|
||||
|
|
|
@ -8,8 +8,6 @@ var MIDP = {
|
|||
|
||||
MIDP.manifest = {};
|
||||
|
||||
MIDP.midletClassName = config.midletClassName ? config.midletClassName.replace(/\//g, '.') : "RunTests";
|
||||
|
||||
Native["com/sun/midp/jarutil/JarReader.readJarEntry0.(Ljava/lang/String;Ljava/lang/String;)[B"] = function(jar, entryName) {
|
||||
var bytes = CLASSES.loadFileFromJar(util.fromJavaString(jar), util.fromJavaString(entryName));
|
||||
if (!bytes)
|
||||
|
@ -280,9 +278,9 @@ Native["com/sun/midp/main/CldcPlatformRequest.dispatchPlatformRequest.(Ljava/lan
|
|||
};
|
||||
|
||||
Native["com/sun/midp/main/CommandState.restoreCommandState.(Lcom/sun/midp/main/CommandState;)V"] = function(state) {
|
||||
var suiteId = (MIDP.midletClassName === "internal") ? -1 : 1;
|
||||
var suiteId = (config.midletClassName === "internal") ? -1 : 1;
|
||||
state.klass.classInfo.getField("I.suiteId.I").set(state, suiteId);
|
||||
state.klass.classInfo.getField("I.midletClassName.Ljava/lang/String;").set(state, J2ME.newString(MIDP.midletClassName));
|
||||
state.klass.classInfo.getField("I.midletClassName.Ljava/lang/String;").set(state, J2ME.newString(config.midletClassName));
|
||||
var args = config.args;
|
||||
state.klass.classInfo.getField("I.arg0.Ljava/lang/String;").set(state, J2ME.newString((args.length > 0) ? args[0] : ""));
|
||||
state.klass.classInfo.getField("I.arg1.Ljava/lang/String;").set(state, J2ME.newString((args.length > 1) ? args[1] : ""));
|
||||
|
@ -426,7 +424,7 @@ Native["com/sun/midp/main/Configuration.getProperty0.(Ljava/lang/String;)Ljava/l
|
|||
var value;
|
||||
switch (util.fromJavaString(key)) {
|
||||
case "com.sun.midp.publickeystore.WebPublicKeyStore":
|
||||
if (MIDP.midletClassName == "RunTests") {
|
||||
if (config.midletClassName == "RunTests") {
|
||||
value = "_test.ks";
|
||||
} else {
|
||||
value = "_main.ks";
|
||||
|
|
Загрузка…
Ссылка в новой задаче