зеркало из https://github.com/mozilla/pluotsorbet.git
Merge pull request #838 from marco-c/fix_url_opening
Fix opening URLs with dispatchPlatformRequest
This commit is contained in:
Коммит
08ac88adbd
4
index.js
4
index.js
|
@ -511,3 +511,7 @@ DumbPipe.registerOpener("JARDownloader", function(message, sender) {
|
|||
sender({ type: "fail" });
|
||||
});
|
||||
});
|
||||
|
||||
DumbPipe.registerOpener("windowOpen", function(message, sender) {
|
||||
window.open(message);
|
||||
});
|
||||
|
|
|
@ -227,7 +227,7 @@ Native.create("com/sun/midp/security/Permissions.loadGroupPermissions.(Ljava/lan
|
|||
Native.create("com/sun/midp/main/CldcPlatformRequest.dispatchPlatformRequest.(Ljava/lang/String;)Z", function(request) {
|
||||
request = util.fromJavaString(request);
|
||||
if (request.startsWith("http://") || request.startsWith("https://")) {
|
||||
window.open(request);
|
||||
DumbPipe.close(DumbPipe.open("windowOpen", request));
|
||||
} else if (request.startsWith("x-contacts:add?number=")) {
|
||||
new MozActivity({
|
||||
name: "new",
|
||||
|
|
|
@ -95,7 +95,7 @@ function syncFS() {
|
|||
});
|
||||
}
|
||||
|
||||
casper.test.begin("unit tests", 10 + gfxTests.length, function(test) {
|
||||
casper.test.begin("unit tests", 12 + gfxTests.length, function(test) {
|
||||
// Run the Init midlet, which does nothing by itself but ensures that any
|
||||
// initialization code gets run before we start a test that depends on it.
|
||||
casper
|
||||
|
@ -328,6 +328,13 @@ casper.test.begin("unit tests", 10 + gfxTests.length, function(test) {
|
|||
});
|
||||
});
|
||||
|
||||
casper
|
||||
.thenOpen("http://localhost:8000/index.html?midletClassName=com.sun.midp.midlet.TestMIDletPeer&jars=tests/tests.jar&logConsole=web,page")
|
||||
.waitForPopup("test.html", function() {
|
||||
test.assertEquals(this.popups.length, 1);
|
||||
test.assertTextDoesntExist("FAIL");
|
||||
});
|
||||
|
||||
casper
|
||||
.run(function() {
|
||||
test.done();
|
||||
|
|
|
@ -8,7 +8,7 @@ import javax.microedition.io.*;
|
|||
public class TestHttpConnection implements Testlet {
|
||||
public void test(TestHarness th) {
|
||||
try {
|
||||
HttpConnection hc = (HttpConnection)Connector.open("http://localhost:8000/");
|
||||
HttpConnection hc = (HttpConnection)Connector.open("http://localhost:8000/tests/test.html");
|
||||
|
||||
long len = hc.getLength();
|
||||
th.todo(len > 0, "length is > 0");
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/* vim: set filetype=java shiftwidth=4 tabstop=4 autoindent cindent expandtab : */
|
||||
|
||||
package com.sun.midp.midlet;
|
||||
|
||||
import javax.microedition.midlet.MIDlet;
|
||||
import javax.microedition.io.ConnectionNotFoundException;
|
||||
|
||||
public class TestMIDletPeer extends MIDlet {
|
||||
public void startApp() {
|
||||
try {
|
||||
platformRequest("http://localhost:8000/tests/test.html");
|
||||
} catch (ConnectionNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("FAIL");
|
||||
}
|
||||
}
|
||||
|
||||
public void pauseApp() {
|
||||
}
|
||||
|
||||
public void destroyApp(boolean unconditional) {
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче