зеркало из https://github.com/mozilla/gecko-dev.git
Bug 806656 - Query records generated incorrectly. r=liuche, a=lsblakk
This commit is contained in:
Родитель
cc78e6431f
Коммит
0d2039a5db
|
@ -269,8 +269,9 @@ public class BookmarkRecord extends Record {
|
|||
|
||||
if (isQuery()) {
|
||||
Map<String, String> parts = Utils.extractURIComponents(PLACES_URI_PREFIX, this.bookmarkURI);
|
||||
putPayload(payload, "queryId", parts.get("queryId"));
|
||||
putPayload(payload, "folderName", parts.get("folderName"));
|
||||
putPayload(payload, "queryId", parts.get("queryId"), true);
|
||||
putPayload(payload, "folderName", parts.get("folderName"), true);
|
||||
putPayload(payload, "bmkUri", parts.get("uri"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -420,7 +421,7 @@ public class BookmarkRecord extends Record {
|
|||
b.append(encode(originalURI));
|
||||
previous = true;
|
||||
}
|
||||
if (p1 != null) {
|
||||
if (p1 != null && v1 != null) {
|
||||
if (previous) {
|
||||
b.append("&");
|
||||
}
|
||||
|
@ -429,7 +430,7 @@ public class BookmarkRecord extends Record {
|
|||
b.append(encode(v1));
|
||||
previous = true;
|
||||
}
|
||||
if (p2 != null) {
|
||||
if (p2 != null && v2 != null) {
|
||||
if (previous) {
|
||||
b.append("&");
|
||||
}
|
||||
|
|
|
@ -239,6 +239,7 @@ public abstract class Record {
|
|||
return rec;
|
||||
}
|
||||
|
||||
@SuppressWarnings("static-method")
|
||||
public String toJSONString() {
|
||||
throw new RuntimeException("Cannot JSONify non-CryptoRecord Records.");
|
||||
}
|
||||
|
@ -259,6 +260,7 @@ public abstract class Record {
|
|||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@SuppressWarnings("static-method")
|
||||
protected void putPayload(CryptoRecord rec, String key, String value) {
|
||||
if (value == null) {
|
||||
return;
|
||||
|
@ -267,9 +269,17 @@ public abstract class Record {
|
|||
}
|
||||
|
||||
protected void putPayload(ExtendedJSONObject payload, String key, String value) {
|
||||
this.putPayload(payload, key, value, false);
|
||||
}
|
||||
|
||||
@SuppressWarnings("static-method")
|
||||
protected void putPayload(ExtendedJSONObject payload, String key, String value, boolean excludeEmpty) {
|
||||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
if (excludeEmpty && value.equals("")) {
|
||||
return;
|
||||
}
|
||||
payload.put(key, value);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче