Bug 1487295 - Add defaults to PaymentMethodChangeEventInit's members. r=baku

--HG--
extra : amend_source : 160b5a164fff0faf5a137b0dd0c50c6d5d859740
This commit is contained in:
Marcos Cáceres 2018-09-06 23:53:00 +03:00
Родитель dc4c75c15a
Коммит a4a6a91838
7 изменённых файлов: 32 добавлений и 10 удалений

Просмотреть файл

@ -72,9 +72,7 @@ PaymentMethodChangeEvent::init(
const PaymentMethodChangeEventInit& aEventInitDict)
{
mMethodName.Assign(aEventInitDict.mMethodName);
if (aEventInitDict.mMethodDetails.WasPassed()) {
mMethodDetails = aEventInitDict.mMethodDetails.Value();
}
mMethodDetails = aEventInitDict.mMethodDetails;
}
void

Просмотреть файл

@ -14,6 +14,7 @@
namespace mozilla {
namespace dom {
class PaymentRequestUpdateEvent;
struct PaymentMethodChangeEventInit;
class PaymentMethodChangeEvent final : public PaymentRequestUpdateEvent
{
public:

Просмотреть файл

@ -8,6 +8,6 @@ interface PaymentMethodChangeEvent : PaymentRequestUpdateEvent {
};
dictionary PaymentMethodChangeEventInit : PaymentRequestUpdateEventInit {
required DOMString methodName;
object? methodDetails;
DOMString methodName = "";
object? methodDetails = null;
};

Просмотреть файл

@ -625005,11 +625005,11 @@
"testharness"
],
"payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https.html": [
"a478c559d497e8dea9d471ce1e36427bfb741aa7",
"ec0aa96dddb46b26617064ab54e9d02e2a588cbb",
"testharness"
],
"payment-request/PaymentMethodChangeEvent/methodName-attribute.https.html": [
"e6e0bf9a91971b3a20acf59cf27097281f0d2085",
"176638c7852f6f0f8fd7a8c3dfefdf439a829d22",
"testharness"
],
"payment-request/PaymentRequestUpdateEvent/constructor.http.html": [
@ -651101,7 +651101,7 @@
"support"
],
"tools/wptrunner/wptrunner/update/update.py": [
"69c3f88ec6851760081474f0f08126f3a1942660",
"240e9279db2fe6a4c444ba80ad9d4704551997fa",
"support"
],
"tools/wptrunner/wptrunner/vcs.py": [
@ -651113,7 +651113,7 @@
"support"
],
"tools/wptrunner/wptrunner/wptcommandline.py": [
"81561f159a319e4a5cbe9b1d51868909649a1643",
"5ea75483d6c2ac36fccb5e8373f0b962481dbc71",
"support"
],
"tools/wptrunner/wptrunner/wptlogging.py": [
@ -653933,7 +653933,7 @@
"support"
],
"web-animations/animation-model/animation-types/property-types.js": [
"5bafb20dfcfafb34464fe387457f06c434c7c188",
"232a508e07cb3db2eb9d9094a6e9fd8a1e63e4a0",
"support"
],
"web-animations/animation-model/animation-types/visibility.html": [

Просмотреть файл

@ -0,0 +1 @@
prefs: [dom.payments.request.enabled:true]

Просмотреть файл

@ -19,4 +19,15 @@ test(() => {
assert_equals(test, "pass");
assert_equals(event.methodDetails, methodDetails);
}, "Must have a methodDetails IDL attribute, which is initialized with to the methodName dictionary value");
test(() => {
const event = new PaymentMethodChangeEvent("test");
assert_equals(event.methodDetails, null, "methodDetails attribute must initialize to null");
const event2 = new PaymentMethodChangeEvent("test", { methodName: "basic-card" });
assert_equals(event2.methodDetails, null, "methodDetails attribute must initialize to null");
const event3 = new PaymentMethodChangeEvent("test", {});
assert_equals(event2.methodDetails, null, "methodDetails attribute must initialize to null");
}, "The methodDetails member defaults to null");
</script>

Просмотреть файл

@ -14,4 +14,15 @@ test(() => {
const { methodName } = event;
assert_equals(methodName, "wpt-test");
}, "Must have a methodName IDL attribute, which is initialized with to the methodName dictionary value");
test(() => {
const event = new PaymentMethodChangeEvent("test");
assert_equals(event.methodName, "", "methodName attribute must initialize to empty string");
const event2 = new PaymentMethodChangeEvent("test", { methodDetails: {} });
assert_equals(event2.methodName, "", "methodName attribute must initialize to empty string");
const event3 = new PaymentMethodChangeEvent("test", {});
assert_equals(event3.methodName, "", "methodName attribute must initialize to empty string");
}, "When no dictionary is passed, the methodName member defaults to the empty string");
</script>