Bug 1190478 - Hide PushEvent.data until we ship message encryption. r=mt,jst

This commit is contained in:
Nikhil Marathe 2015-08-03 11:04:41 -07:00
parent b81906a10c
commit cb37e89c41
5 changed files with 19 additions and 25 deletions

View File

@ -6,13 +6,8 @@ this.onpush = handlePush;
function handlePush(event) {
self.clients.matchAll().then(function(result) {
if (event instanceof PushEvent &&
event.data instanceof PushMessageData &&
event.data.text === undefined &&
event.data.json === undefined &&
event.data.arrayBuffer === undefined &&
event.data.blob === undefined) {
// FIXME(nsm): Bug 1149195 will fix data exposure.
if (event instanceof PushEvent && !('data' in event)) {
result[0].postMessage({type: "finished", okay: "yes"});
return;
}

View File

@ -11,11 +11,13 @@
Func="nsContentUtils::PushEnabled",
Exposed=ServiceWorker]
interface PushEvent : ExtendableEvent {
readonly attribute PushMessageData data;
// FIXME(nsm): Bug 1149195.
// readonly attribute PushMessageData data;
};
typedef USVString PushMessageDataInit;
dictionary PushEventInit : ExtendableEventInit {
PushMessageDataInit data;
// FIXME(nsm): Bug 1149195.
// PushMessageDataInit data;
};

View File

@ -467,14 +467,6 @@ PushEvent::PushEvent(EventTarget* aOwner)
{
}
NS_IMPL_ADDREF_INHERITED(PushEvent, ExtendableEvent)
NS_IMPL_RELEASE_INHERITED(PushEvent, ExtendableEvent)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(PushEvent)
NS_INTERFACE_MAP_END_INHERITING(ExtendableEvent)
NS_IMPL_CYCLE_COLLECTION_INHERITED(PushEvent, ExtendableEvent, mData)
#endif /* ! MOZ_SIMPLEPUSH */
END_WORKERS_NAMESPACE

View File

@ -189,7 +189,8 @@ private:
class PushEvent final : public ExtendableEvent
{
nsRefPtr<PushMessageData> mData;
// FIXME(nsm): Bug 1149195.
// nsRefPtr<PushMessageData> mData;
nsMainThreadPtrHandle<ServiceWorker> mServiceWorker;
protected:
@ -197,8 +198,8 @@ protected:
~PushEvent() {}
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PushEvent, ExtendableEvent)
// FIXME(nsm): Bug 1149195.
// Add cycle collection macros once data is re-exposed.
NS_FORWARD_TO_EVENT
virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
@ -215,9 +216,10 @@ public:
bool trusted = e->Init(aOwner);
e->InitEvent(aType, aOptions.mBubbles, aOptions.mCancelable);
e->SetTrusted(trusted);
if(aOptions.mData.WasPassed()){
e->mData = new PushMessageData(aOptions.mData.Value());
}
// FIXME(nsm): Bug 1149195.
//if(aOptions.mData.WasPassed()){
// e->mData = new PushMessageData(aOptions.mData.Value());
//}
return e.forget();
}
@ -238,7 +240,9 @@ public:
PushMessageData* Data()
{
return mData;
// FIXME(nsm): Bug 1149195.
MOZ_CRASH("Should not be called!");
return nullptr;
}
};
#endif /* ! MOZ_SIMPLEPUSH */

View File

@ -2167,7 +2167,8 @@ public:
GlobalObject globalObj(aCx, aWorkerPrivate->GlobalScope()->GetWrapper());
PushEventInit pei;
pei.mData.Construct(mData);
// FIXME(nsm): Bug 1149195.
// pei.mData.Construct(mData);
pei.mBubbles = false;
pei.mCancelable = true;