mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1014965 - NativeJSObject.optString does the wrong thing on "key":null, r=jchen, f=nalexander
This commit is contained in:
parent
331f3d56a9
commit
bdb3beec4c
@ -294,5 +294,20 @@ public class testEventDispatcher extends UITest
|
||||
null, object.optStringArray("stringArray", null));
|
||||
fAssertSame("optStringArray returns fallback value if nonexistent",
|
||||
null, object.optStringArray("nonexistent_stringArray", null));
|
||||
|
||||
fAssertEquals("Native has(null) is false", false, object.has("null"));
|
||||
fAssertEquals("Native has(emptyString) is true", true, object.has("emptyString"));
|
||||
|
||||
fAssertEquals("Native optBoolean returns fallback value if null",
|
||||
true, object.optBoolean("null", true));
|
||||
fAssertEquals("Native optInt returns fallback value if null",
|
||||
42, object.optInt("null", 42));
|
||||
fAssertEquals("Native optDouble returns fallback value if null",
|
||||
-3.1415926535, object.optDouble("null", -3.1415926535));
|
||||
fAssertEquals("Native optString returns fallback value if null",
|
||||
"baz", object.optString("null", "baz"));
|
||||
|
||||
fAssertNotEquals("Native optString does not return fallback value if emptyString",
|
||||
"baz", object.optString("emptyString", "baz"));
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,8 @@ function send_test_message(type) {
|
||||
intArray: [2, 3],
|
||||
double: 0.5,
|
||||
doubleArray: [1.5, 2.5],
|
||||
null: null,
|
||||
emptyString: "",
|
||||
string: "foo",
|
||||
stringArray: ["bar", "baz"],
|
||||
}
|
||||
|
@ -668,7 +668,7 @@ GetProperty(JNIEnv* env, jobject instance, jstring name,
|
||||
JS_GetUCProperty(cx, object, strName, strName.Length(), &val))) {
|
||||
return typename Property::Type();
|
||||
}
|
||||
if (val.isUndefined()) {
|
||||
if (val.isUndefined() || val.isNull()) {
|
||||
if (option == FallbackOption::THROW) {
|
||||
AndroidBridge::ThrowException(env,
|
||||
"java/lang/IllegalArgumentException",
|
||||
|
Loading…
Reference in New Issue
Block a user