mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
bug 1027634 - crash in java.net.MalformedURLException: Unknown protocol: textstyle at java.net.URL.<init>(URL.java) r=snorp
This commit is contained in:
parent
782d1b99f9
commit
56e1db7e51
@ -2706,20 +2706,24 @@ public class GeckoAppShell
|
||||
}
|
||||
|
||||
@WrapElementForJNI(allowMultithread = true, narrowChars = true)
|
||||
static URLConnection getConnection(String url) throws MalformedURLException, IOException {
|
||||
String spec;
|
||||
if (url.startsWith("android://")) {
|
||||
spec = url.substring(10);
|
||||
} else {
|
||||
spec = url.substring(8);
|
||||
}
|
||||
static URLConnection getConnection(String url) {
|
||||
try {
|
||||
String spec;
|
||||
if (url.startsWith("android://")) {
|
||||
spec = url.substring(10);
|
||||
} else {
|
||||
spec = url.substring(8);
|
||||
}
|
||||
|
||||
// if the colon got stripped, put it back
|
||||
int colon = spec.indexOf(':');
|
||||
if (colon == -1 || colon > spec.indexOf('/')) {
|
||||
spec = spec.replaceFirst("/", ":/");
|
||||
// if the colon got stripped, put it back
|
||||
int colon = spec.indexOf(':');
|
||||
if (colon == -1 || colon > spec.indexOf('/')) {
|
||||
spec = spec.replaceFirst("/", ":/");
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
return null;
|
||||
}
|
||||
return new URL(spec).openConnection();
|
||||
return null;
|
||||
}
|
||||
|
||||
@WrapElementForJNI(allowMultithread = true, narrowChars = true)
|
||||
|
Loading…
Reference in New Issue
Block a user