mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-12 10:40:12 +00:00
Bug 863035 - WebSMS: use 'null' to reset SmsFilter::read and threadId. r=mounir,Ms2ger
This commit is contained in:
parent
b4b26e7e38
commit
5462048383
@ -23,11 +23,11 @@ interface nsIDOMMozSmsFilter : nsISupports
|
||||
[Null(Empty)]
|
||||
attribute DOMString delivery;
|
||||
|
||||
// A read flag that can be a boolean or undefined.
|
||||
// A read flag that can return and be set to a boolean or null.
|
||||
[implicit_jscontext]
|
||||
attribute jsval read;
|
||||
|
||||
// A thread id that can be a numeric value or undefined.
|
||||
// A thread id that can return and be set to a numeric value or null.
|
||||
[implicit_jscontext]
|
||||
attribute jsval threadId;
|
||||
};
|
||||
|
@ -234,7 +234,7 @@ NS_IMETHODIMP
|
||||
SmsFilter::GetRead(JSContext* aCx, JS::Value* aRead)
|
||||
{
|
||||
if (mData.read() == eReadState_Unknown) {
|
||||
*aRead = JSVAL_VOID;
|
||||
*aRead = JSVAL_NULL;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -246,7 +246,7 @@ SmsFilter::GetRead(JSContext* aCx, JS::Value* aRead)
|
||||
NS_IMETHODIMP
|
||||
SmsFilter::SetRead(JSContext* aCx, const JS::Value& aRead)
|
||||
{
|
||||
if (aRead == JSVAL_VOID) {
|
||||
if (aRead == JSVAL_NULL) {
|
||||
mData.read() = eReadState_Unknown;
|
||||
return NS_OK;
|
||||
}
|
||||
@ -263,7 +263,7 @@ NS_IMETHODIMP
|
||||
SmsFilter::GetThreadId(JSContext* aCx, JS::Value* aThreadId)
|
||||
{
|
||||
if (!mData.threadId()) {
|
||||
*aThreadId = JSVAL_VOID;
|
||||
*aThreadId = JSVAL_NULL;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ SmsFilter::GetThreadId(JSContext* aCx, JS::Value* aThreadId)
|
||||
NS_IMETHODIMP
|
||||
SmsFilter::SetThreadId(JSContext* aCx, const JS::Value& aThreadId)
|
||||
{
|
||||
if (aThreadId == JSVAL_VOID) {
|
||||
if (aThreadId == JSVAL_NULL) {
|
||||
mData.threadId() = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -73,15 +73,15 @@ filter.read = true;
|
||||
is(filter.read, true, "Setters and getters should work!");
|
||||
filter.read = false;
|
||||
is(filter.read, false, "Setters and getters should work!");
|
||||
filter.read = undefined;
|
||||
is(filter.read, undefined, "undefined should revert the value to default");
|
||||
throwingCheck(filter, 'read', [ "foo", 0, [1, 2], function () {}, new Date(), null ]);
|
||||
filter.read = null;
|
||||
is(filter.read, null, "'null' should revert the value to default");
|
||||
throwingCheck(filter, 'read', [ "foo", 0, [1, 2], function () {}, new Date(), undefined ]);
|
||||
|
||||
filter.threadId = 1;
|
||||
is(filter.threadId, 1, "Setters and getters should work!");
|
||||
filter.threadId = undefined;
|
||||
is(filter.threadId, undefined, "undefined should revert the value to default");
|
||||
throwingCheck(filter, 'threadId', [ "foo", 0, 1.5, [1, 2], function () {}, new Date(), null ]);
|
||||
filter.threadId = null;
|
||||
is(filter.threadId, null, "'null' should revert the value to default");
|
||||
throwingCheck(filter, 'threadId', [ "foo", 0, 1.5, [1, 2], function () {}, new Date(), undefined ]);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
Loading…
x
Reference in New Issue
Block a user