mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
Backed out 2 changesets (bug 1310967) for failures in messageEvent tests a=backou
Backed out changeset dac69b2b8d26 (bug 1310967) Backed out changeset 133feae49330 (bug 1310967)
This commit is contained in:
parent
d97edc1016
commit
8f8236ba1e
@ -1081,8 +1081,7 @@ EventSource::DispatchAllMessageEvents()
|
||||
RefPtr<MessageEvent> event = new MessageEvent(this, nullptr, nullptr);
|
||||
|
||||
event->InitMessageEvent(nullptr, message->mEventName, false, false, jsData,
|
||||
mOrigin, message->mLastEventID, nullptr,
|
||||
Sequence<OwningNonNull<MessagePort>>());
|
||||
mOrigin, message->mLastEventID, nullptr, nullptr);
|
||||
event->SetTrusted(true);
|
||||
|
||||
rv = DispatchDOMEvent(nullptr, static_cast<Event*>(event), nullptr,
|
||||
|
@ -147,8 +147,7 @@ PostMessageEvent::Run()
|
||||
event->InitMessageEvent(nullptr, NS_LITERAL_STRING("message"),
|
||||
false /*non-bubbling */, false /*cancelable */,
|
||||
messageData, mCallerOrigin,
|
||||
EmptyString(), source,
|
||||
Sequence<OwningNonNull<MessagePort>>());
|
||||
EmptyString(), source, nullptr);
|
||||
|
||||
nsTArray<RefPtr<MessagePort>> ports = TakeTransferredPorts();
|
||||
event->SetPorts(Move(ports));
|
||||
|
@ -2009,7 +2009,7 @@ WebSocket::CreateAndDispatchMessageEvent(const nsACString& aData,
|
||||
|
||||
event->InitMessageEvent(nullptr, NS_LITERAL_STRING("message"), false, false,
|
||||
jsData, mImpl->mUTF16Origin, EmptyString(), nullptr,
|
||||
Sequence<OwningNonNull<MessagePort>>());
|
||||
nullptr);
|
||||
event->SetTrusted(true);
|
||||
|
||||
return DispatchDOMEvent(nullptr, static_cast<Event*>(event), nullptr,
|
||||
|
@ -405,8 +405,7 @@ nsDOMDataChannel::DoOnMessageAvailable(const nsACString& aData,
|
||||
RefPtr<MessageEvent> event = new MessageEvent(this, nullptr, nullptr);
|
||||
|
||||
event->InitMessageEvent(nullptr, NS_LITERAL_STRING("message"), false, false,
|
||||
jsData, mOrigin, EmptyString(), nullptr,
|
||||
Sequence<OwningNonNull<MessagePort>>());
|
||||
jsData, mOrigin, EmptyString(), nullptr, nullptr);
|
||||
event->SetTrusted(true);
|
||||
|
||||
LOG(("%p(%p): %s - Dispatching\n",this,(void*)mDataChannel,__FUNCTION__));
|
||||
|
@ -106,7 +106,7 @@ BroadcastChannelChild::RecvNotify(const ClonedMessageData& aData)
|
||||
RootedDictionary<MessageEventInit> init(cx);
|
||||
init.mBubbles = false;
|
||||
init.mCancelable = false;
|
||||
init.mOrigin = mOrigin;
|
||||
init.mOrigin.Construct(mOrigin);
|
||||
init.mData = value;
|
||||
|
||||
ErrorResult rv;
|
||||
|
@ -46,6 +46,7 @@ MessageEvent::MessageEvent(EventTarget* aOwner,
|
||||
WidgetEvent* aEvent)
|
||||
: Event(aOwner, aPresContext, aEvent)
|
||||
, mData(JS::UndefinedValue())
|
||||
, mPortsSet(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -119,8 +120,13 @@ MessageEvent::Constructor(EventTarget* aEventTarget,
|
||||
|
||||
mozilla::HoldJSObjects(event.get());
|
||||
|
||||
event->mOrigin = aParam.mOrigin;
|
||||
event->mLastEventId = aParam.mLastEventId;
|
||||
if (aParam.mOrigin.WasPassed()) {
|
||||
event->mOrigin = aParam.mOrigin.Value();
|
||||
}
|
||||
|
||||
if (aParam.mLastEventId.WasPassed()) {
|
||||
event->mLastEventId = aParam.mLastEventId.Value();
|
||||
}
|
||||
|
||||
if (!aParam.mSource.IsNull()) {
|
||||
if (aParam.mSource.Value().IsWindow()) {
|
||||
@ -132,7 +138,10 @@ MessageEvent::Constructor(EventTarget* aEventTarget,
|
||||
MOZ_ASSERT(event->mWindowSource || event->mPortSource);
|
||||
}
|
||||
|
||||
event->mPorts.AppendElements(aParam.mPorts);
|
||||
if (aParam.mPorts.WasPassed() && !aParam.mPorts.Value().IsNull()) {
|
||||
event->mPorts.AppendElements(aParam.mPorts.Value().Value());
|
||||
event->mPortsSet = true;
|
||||
}
|
||||
|
||||
return event.forget();
|
||||
}
|
||||
@ -144,7 +153,7 @@ MessageEvent::InitMessageEvent(JSContext* aCx, const nsAString& aType,
|
||||
const nsAString& aOrigin,
|
||||
const nsAString& aLastEventId,
|
||||
const Nullable<WindowProxyOrMessagePort>& aSource,
|
||||
const Sequence<OwningNonNull<MessagePort>>& aPorts)
|
||||
const Nullable<Sequence<OwningNonNull<MessagePort>>>& aPorts)
|
||||
{
|
||||
Event::InitEvent(aType, aCanBubble, aCancelable);
|
||||
mData = aData;
|
||||
@ -165,21 +174,33 @@ MessageEvent::InitMessageEvent(JSContext* aCx, const nsAString& aType,
|
||||
}
|
||||
|
||||
mPorts.Clear();
|
||||
mPorts.AppendElements(aPorts);
|
||||
mPortsSet = false;
|
||||
|
||||
if (!aPorts.IsNull()) {
|
||||
mPorts.AppendElements(aPorts.Value());
|
||||
mPortsSet = true;
|
||||
}
|
||||
|
||||
MessageEventBinding::ClearCachedPortsValue(this);
|
||||
}
|
||||
|
||||
void
|
||||
MessageEvent::GetPorts(nsTArray<RefPtr<MessagePort>>& aPorts)
|
||||
MessageEvent::GetPorts(Nullable<nsTArray<RefPtr<MessagePort>>>& aPorts)
|
||||
{
|
||||
aPorts = mPorts;
|
||||
if (!mPortsSet) {
|
||||
aPorts.SetNull();
|
||||
return;
|
||||
}
|
||||
|
||||
aPorts.SetValue(mPorts);
|
||||
}
|
||||
|
||||
void
|
||||
MessageEvent::SetPorts(nsTArray<RefPtr<MessagePort>>&& aPorts)
|
||||
{
|
||||
MOZ_ASSERT(mPorts.IsEmpty());
|
||||
MOZ_ASSERT(mPorts.IsEmpty() && !mPortsSet);
|
||||
mPorts = Move(aPorts);
|
||||
mPortsSet = true;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
void GetLastEventId(nsAString&) const;
|
||||
void GetSource(Nullable<OwningWindowProxyOrMessagePort>& aValue) const;
|
||||
|
||||
void GetPorts(nsTArray<RefPtr<MessagePort>>& aPorts);
|
||||
void GetPorts(Nullable<nsTArray<RefPtr<MessagePort>>>& aPorts);
|
||||
|
||||
void SetPorts(nsTArray<RefPtr<MessagePort>>&& aPorts);
|
||||
|
||||
@ -75,7 +75,7 @@ public:
|
||||
bool aCancelable, JS::Handle<JS::Value> aData,
|
||||
const nsAString& aOrigin, const nsAString& aLastEventId,
|
||||
const Nullable<WindowProxyOrMessagePort>& aSource,
|
||||
const Sequence<OwningNonNull<MessagePort>>& aPorts);
|
||||
const Nullable<Sequence<OwningNonNull<MessagePort>>>& aPorts);
|
||||
|
||||
protected:
|
||||
~MessageEvent();
|
||||
@ -88,6 +88,7 @@ private:
|
||||
RefPtr<MessagePort> mPortSource;
|
||||
|
||||
nsTArray<RefPtr<MessagePort>> mPorts;
|
||||
bool mPortsSet;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -17,7 +17,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=848294
|
||||
ok(e, "MessageEvent created");
|
||||
is(e.type, 'message', 'MessageEvent.type is right');
|
||||
|
||||
is(e.data, 'data' in test ? test.data : null, 'MessageEvent.data is ok');
|
||||
is(e.data, 'data' in test ? test.data : undefined, 'MessageEvent.data is ok');
|
||||
is(e.origin, 'origin' in test ? test.origin : '', 'MessageEvent.origin is ok');
|
||||
is(e.lastEventId, 'lastEventId' in test ? test.lastEventId : '', 'MessageEvent.lastEventId is ok');
|
||||
is(e.source, 'source' in test ? test.source : null, 'MessageEvent.source is ok');
|
||||
@ -43,7 +43,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=848294
|
||||
{ data: window, source: window },
|
||||
{ data: window, source: channel.port1 },
|
||||
{ data: window, source: channel.port1, ports: [ channel.port1, channel.port2 ] },
|
||||
{ data: null, ports: [] },
|
||||
{ data: null, ports: null },
|
||||
];
|
||||
|
||||
while (tests.length) {
|
||||
@ -54,11 +54,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=848294
|
||||
|
||||
e = new MessageEvent('message');
|
||||
e.initMessageEvent('message', true, true,
|
||||
'data' in test ? test.data : null,
|
||||
'data' in test ? test.data : undefined,
|
||||
'origin' in test ? test.origin : '',
|
||||
'lastEventId' in test ? test.lastEventId : '',
|
||||
'source' in test ? test.source : null,
|
||||
'ports' in test ? test.ports : []);
|
||||
'ports' in test ? test.ports : null);
|
||||
testMessageEvent(e, test);
|
||||
}
|
||||
|
||||
|
@ -137,8 +137,7 @@ private:
|
||||
event->InitMessageEvent(nullptr, NS_LITERAL_STRING("message"),
|
||||
false /* non-bubbling */,
|
||||
false /* cancelable */, value, EmptyString(),
|
||||
EmptyString(), nullptr,
|
||||
Sequence<OwningNonNull<MessagePort>>());
|
||||
EmptyString(), nullptr, nullptr);
|
||||
event->SetTrusted(true);
|
||||
event->SetSource(mPort);
|
||||
|
||||
|
@ -580,8 +580,7 @@ PresentationConnection::DispatchMessageEvent(JS::Handle<JS::Value> aData)
|
||||
messageEvent->InitMessageEvent(nullptr,
|
||||
NS_LITERAL_STRING("message"),
|
||||
false, false, aData, origin,
|
||||
EmptyString(), nullptr,
|
||||
Sequence<OwningNonNull<MessagePort>>());
|
||||
EmptyString(), nullptr, nullptr);
|
||||
messageEvent->SetTrusted(true);
|
||||
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
|
@ -41,18 +41,18 @@ interface MessageEvent : Event {
|
||||
* data, origin, source, and lastEventId attributes of this appropriately.
|
||||
*/
|
||||
[Pure, Cached, Frozen]
|
||||
readonly attribute sequence<MessagePort> ports;
|
||||
readonly attribute sequence<MessagePort>? ports;
|
||||
|
||||
void initMessageEvent(DOMString type, boolean bubbles, boolean cancelable,
|
||||
any data, DOMString origin, DOMString lastEventId,
|
||||
(WindowProxy or MessagePort)? source,
|
||||
sequence<MessagePort> ports);
|
||||
sequence<MessagePort>? ports);
|
||||
};
|
||||
|
||||
dictionary MessageEventInit : EventInit {
|
||||
any data = null;
|
||||
DOMString origin = "";
|
||||
DOMString lastEventId = "";
|
||||
any data;
|
||||
DOMString origin;
|
||||
DOMString lastEventId;
|
||||
(Window or MessagePort)? source = null;
|
||||
sequence<MessagePort> ports = [];
|
||||
sequence<MessagePort>? ports;
|
||||
};
|
||||
|
@ -723,7 +723,7 @@ public:
|
||||
EmptyString(),
|
||||
EmptyString(),
|
||||
nullptr,
|
||||
Sequence<OwningNonNull<MessagePort>>());
|
||||
nullptr);
|
||||
event->SetPorts(Move(ports));
|
||||
domEvent = do_QueryObject(event);
|
||||
}
|
||||
@ -815,7 +815,7 @@ private:
|
||||
EmptyString(),
|
||||
EmptyString(),
|
||||
nullptr,
|
||||
Sequence<OwningNonNull<MessagePort>>());
|
||||
nullptr);
|
||||
event->SetTrusted(true);
|
||||
|
||||
nsCOMPtr<nsIDOMEvent> domEvent = do_QueryObject(event);
|
||||
|
Loading…
Reference in New Issue
Block a user