Commit 4a413bdc authored by Tim van der Lippe's avatar Tim van der Lippe Committed by Commit Bot

Add module bindings for PushSubscriptionChangeEvent

This CL introduces the interfaces as defined in
https://w3c.github.io/push-api/#pushsubscriptionchangeevent-interface

TBR=haraken for gni and json5 configuration files

Bug: 646721
Change-Id: I68645a6f7e2bb63011b93c8a471504f7f628bd38
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1635611
Commit-Queue: Tim van der Lippe <tvanderlippe@google.com>
Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#665133}
parent 39d06e60
......@@ -280,6 +280,7 @@ modules_idl_files =
"push_messaging/push_manager.idl",
"push_messaging/push_message_data.idl",
"push_messaging/push_subscription.idl",
"push_messaging/push_subscription_change_event.idl",
"push_messaging/push_subscription_options.idl",
"quota/deprecated_storage_info.idl",
"quota/deprecated_storage_quota.idl",
......@@ -735,6 +736,7 @@ modules_dictionary_idl_files =
"presentation/presentation_connection_available_event_init.idl",
"presentation/presentation_connection_close_event_init.idl",
"push_messaging/push_event_init.idl",
"push_messaging/push_subscription_change_init.idl",
"push_messaging/push_subscription_options_init.idl",
"quota/storage_estimate.idl",
"quota/storage_usage_details.idl",
......
......@@ -28,6 +28,8 @@ blink_modules_sources("push_messaging") {
"push_subscription.h",
"push_subscription_callbacks.cc",
"push_subscription_callbacks.h",
"push_subscription_change_event.cc",
"push_subscription_change_event.h",
"push_subscription_options.cc",
"push_subscription_options.h",
"service_worker_global_scope_push.h",
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://w3c.github.io/push-api/#idl-def-PushEvent
// https://w3c.github.io/push-api/#pushevent-interface
[
Constructor(DOMString type, optional PushEventInit eventInitDict),
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://w3c.github.io/push-api/#idl-def-PushEvent
// https://w3c.github.io/push-api/#pushevent-interface
// TODO(peter): Use BufferSource when union types can refer to other union types.
typedef (ArrayBuffer or ArrayBufferView or USVString) PushMessageDataInit;
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/modules/push_messaging/push_subscription_change_event.h"
#include "third_party/blink/renderer/modules/push_messaging/push_subscription_change_init.h"
namespace blink {
PushSubscriptionChangeEvent::PushSubscriptionChangeEvent(
const AtomicString& type,
PushSubscription* new_subscription,
PushSubscription* old_subscription,
WaitUntilObserver* observer)
: ExtendableEvent(type, ExtendableEventInit::Create(), observer),
new_subscription_(new_subscription),
old_subscription_(old_subscription) {}
PushSubscriptionChangeEvent::PushSubscriptionChangeEvent(
const AtomicString& type,
PushSubscriptionChangeInit* initializer)
: ExtendableEvent(type, initializer) {
if (initializer->hasNewSubscription())
new_subscription_ = initializer->newSubscription();
if (initializer->hasOldSubscription())
old_subscription_ = initializer->oldSubscription();
}
PushSubscriptionChangeEvent::~PushSubscriptionChangeEvent() = default;
PushSubscription* PushSubscriptionChangeEvent::newSubscription() const {
return new_subscription_;
}
PushSubscription* PushSubscriptionChangeEvent::oldSubscription() const {
return old_subscription_;
}
void PushSubscriptionChangeEvent::Trace(blink::Visitor* visitor) {
visitor->Trace(new_subscription_);
visitor->Trace(old_subscription_);
ExtendableEvent::Trace(visitor);
}
} // namespace blink
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_PUSH_MESSAGING_PUSH_SUBSCRIPTION_CHANGE_EVENT_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_PUSH_MESSAGING_PUSH_SUBSCRIPTION_CHANGE_EVENT_H_
#include "third_party/blink/renderer/modules/event_modules.h"
#include "third_party/blink/renderer/modules/modules_export.h"
#include "third_party/blink/renderer/modules/push_messaging/push_subscription.h"
#include "third_party/blink/renderer/modules/service_worker/extendable_event.h"
#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
class PushSubscriptionChangeInit;
class MODULES_EXPORT PushSubscriptionChangeEvent final
: public ExtendableEvent {
DEFINE_WRAPPERTYPEINFO();
public:
static PushSubscriptionChangeEvent* Create(const AtomicString& type,
PushSubscription* new_subscription,
PushSubscription* old_subscription,
WaitUntilObserver* observer) {
return MakeGarbageCollected<PushSubscriptionChangeEvent>(
type, new_subscription, old_subscription, observer);
}
static PushSubscriptionChangeEvent* Create(
const AtomicString& type,
PushSubscriptionChangeInit* initializer) {
return MakeGarbageCollected<PushSubscriptionChangeEvent>(type, initializer);
}
PushSubscriptionChangeEvent(const AtomicString& type,
PushSubscription* new_subscription,
PushSubscription* old_subscription,
WaitUntilObserver* observer);
PushSubscriptionChangeEvent(const AtomicString& type,
PushSubscriptionChangeInit* initializer);
~PushSubscriptionChangeEvent() override;
PushSubscription* newSubscription() const;
PushSubscription* oldSubscription() const;
void Trace(blink::Visitor* visitor) override;
private:
Member<PushSubscription> new_subscription_;
Member<PushSubscription> old_subscription_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_PUSH_MESSAGING_PUSH_SUBSCRIPTION_CHANGE_EVENT_H_
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://w3c.github.io/push-api/#pushsubscriptionchangeevent-interface
[
Constructor(DOMString type, optional PushSubscriptionChangeInit eventInitDict),
Exposed=ServiceWorker,
RuntimeEnabled=PushMessagingSubscriptionChange
] interface PushSubscriptionChangeEvent : ExtendableEvent {
readonly attribute PushSubscription? newSubscription;
readonly attribute PushSubscription? oldSubscription;
};
\ No newline at end of file
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://w3c.github.io/push-api/#pushsubscriptionchangeevent-interface
dictionary PushSubscriptionChangeInit : ExtendableEventInit {
PushSubscription newSubscription = null;
PushSubscription oldSubscription = null;
};
......@@ -1226,6 +1226,10 @@
name: "PushMessaging",
status: "stable",
},
{
name: "PushMessagingSubscriptionChange",
status: "experimental",
},
{
name: "RasterInducingScroll",
status: "experimental",
......
This is a testharness.js-based test.
Found 80 tests; 66 PASS, 14 FAIL, 0 TIMEOUT, 0 NOTRUN.
Found 80 tests; 78 PASS, 2 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS idl_test setup
PASS Partial interface ServiceWorkerRegistration: original interface defined
PASS Partial interface ServiceWorkerGlobalScope: original interface defined
......@@ -62,18 +62,18 @@ PASS PushEvent interface: attribute data
PASS PushEvent must be primary interface of new PushEvent("type")
PASS Stringification of new PushEvent("type")
PASS PushEvent interface: new PushEvent("type") must inherit property "data" with the proper type
FAIL PushSubscriptionChangeEvent interface: existence and properties of interface object assert_own_property: self does not have own property "PushSubscriptionChangeEvent" expected property "PushSubscriptionChangeEvent" missing
FAIL PushSubscriptionChangeEvent interface object length assert_own_property: self does not have own property "PushSubscriptionChangeEvent" expected property "PushSubscriptionChangeEvent" missing
FAIL PushSubscriptionChangeEvent interface object name assert_own_property: self does not have own property "PushSubscriptionChangeEvent" expected property "PushSubscriptionChangeEvent" missing
FAIL PushSubscriptionChangeEvent interface: existence and properties of interface prototype object assert_own_property: self does not have own property "PushSubscriptionChangeEvent" expected property "PushSubscriptionChangeEvent" missing
FAIL PushSubscriptionChangeEvent interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "PushSubscriptionChangeEvent" expected property "PushSubscriptionChangeEvent" missing
FAIL PushSubscriptionChangeEvent interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "PushSubscriptionChangeEvent" expected property "PushSubscriptionChangeEvent" missing
FAIL PushSubscriptionChangeEvent interface: attribute newSubscription assert_own_property: self does not have own property "PushSubscriptionChangeEvent" expected property "PushSubscriptionChangeEvent" missing
FAIL PushSubscriptionChangeEvent interface: attribute oldSubscription assert_own_property: self does not have own property "PushSubscriptionChangeEvent" expected property "PushSubscriptionChangeEvent" missing
FAIL PushSubscriptionChangeEvent must be primary interface of new PushSubscriptionChangeEvent("pushsubscriptionchange") assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: PushSubscriptionChangeEvent is not defined"
FAIL Stringification of new PushSubscriptionChangeEvent("pushsubscriptionchange") assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: PushSubscriptionChangeEvent is not defined"
FAIL PushSubscriptionChangeEvent interface: new PushSubscriptionChangeEvent("pushsubscriptionchange") must inherit property "newSubscription" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: PushSubscriptionChangeEvent is not defined"
FAIL PushSubscriptionChangeEvent interface: new PushSubscriptionChangeEvent("pushsubscriptionchange") must inherit property "oldSubscription" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: PushSubscriptionChangeEvent is not defined"
PASS PushSubscriptionChangeEvent interface: existence and properties of interface object
PASS PushSubscriptionChangeEvent interface object length
PASS PushSubscriptionChangeEvent interface object name
PASS PushSubscriptionChangeEvent interface: existence and properties of interface prototype object
PASS PushSubscriptionChangeEvent interface: existence and properties of interface prototype object's "constructor" property
PASS PushSubscriptionChangeEvent interface: existence and properties of interface prototype object's @@unscopables property
PASS PushSubscriptionChangeEvent interface: attribute newSubscription
PASS PushSubscriptionChangeEvent interface: attribute oldSubscription
PASS PushSubscriptionChangeEvent must be primary interface of new PushSubscriptionChangeEvent("pushsubscriptionchange")
PASS Stringification of new PushSubscriptionChangeEvent("pushsubscriptionchange")
PASS PushSubscriptionChangeEvent interface: new PushSubscriptionChangeEvent("pushsubscriptionchange") must inherit property "newSubscription" with the proper type
PASS PushSubscriptionChangeEvent interface: new PushSubscriptionChangeEvent("pushsubscriptionchange") must inherit property "oldSubscription" with the proper type
PASS ServiceWorkerRegistration interface: attribute pushManager
PASS ServiceWorkerRegistration interface: registration must inherit property "pushManager" with the proper type
PASS ServiceWorkerGlobalScope interface: attribute onpush
......
......@@ -1126,6 +1126,11 @@ interface PushSubscription
method getKey
method toJSON
method unsubscribe
interface PushSubscriptionChangeEvent : ExtendableEvent
attribute @@toStringTag
getter newSubscription
getter oldSubscription
method constructor
interface PushSubscriptionOptions
attribute @@toStringTag
getter applicationServerKey
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment