mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 7ce1d1bada46 (bug 949376) for wpt orange
This commit is contained in:
parent
278e259cd9
commit
92e94d115b
@ -199,49 +199,6 @@ MessageEvent::InitMessageEvent(const nsAString& aType,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
MessageEvent::InitMessageEvent(JSContext* aCx, const nsAString& aType,
|
||||
bool aCanBubble, bool aCancelable,
|
||||
JS::Handle<JS::Value> aData,
|
||||
const nsAString& aOrigin,
|
||||
const nsAString& aLastEventId,
|
||||
const Nullable<WindowProxyOrMessagePort>& aSource,
|
||||
const Nullable<Sequence<OwningNonNull<MessagePort>>>& aPorts,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
aRv = Event::InitEvent(aType, aCanBubble, aCancelable);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
mData = aData;
|
||||
mozilla::HoldJSObjects(this);
|
||||
mOrigin = aOrigin;
|
||||
mLastEventId = aLastEventId;
|
||||
|
||||
mWindowSource = nullptr;
|
||||
mPortSource = nullptr;
|
||||
|
||||
if (!aSource.IsNull()) {
|
||||
if (aSource.Value().IsWindowProxy()) {
|
||||
mWindowSource = aSource.Value().GetAsWindowProxy();
|
||||
} else {
|
||||
mPortSource = &aSource.Value().GetAsMessagePort();
|
||||
}
|
||||
}
|
||||
|
||||
mPorts = nullptr;
|
||||
|
||||
if (!aPorts.IsNull()) {
|
||||
nsTArray<nsRefPtr<MessagePort>> ports;
|
||||
for (uint32_t i = 0, len = aPorts.Value().Length(); i < len; ++i) {
|
||||
ports.AppendElement(aPorts.Value()[i]);
|
||||
}
|
||||
|
||||
mPorts = new MessagePortList(static_cast<Event*>(this), ports);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MessageEvent::SetPorts(MessagePortList* aPorts)
|
||||
{
|
||||
@ -270,7 +227,7 @@ using namespace mozilla::dom;
|
||||
already_AddRefed<MessageEvent>
|
||||
NS_NewDOMMessageEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent)
|
||||
WidgetEvent* aEvent)
|
||||
{
|
||||
nsRefPtr<MessageEvent> it = new MessageEvent(aOwner, aPresContext, aEvent);
|
||||
return it.forget();
|
||||
|
@ -8,10 +8,9 @@
|
||||
#define mozilla_dom_MessageEvent_h_
|
||||
|
||||
#include "mozilla/dom/Event.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/MessagePortList.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIDOMMessageEvent.h"
|
||||
#include "mozilla/dom/MessagePortList.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -20,7 +19,6 @@ struct MessageEventInit;
|
||||
class MessagePort;
|
||||
class MessagePortList;
|
||||
class OwningWindowProxyOrMessagePortOrClient;
|
||||
class WindowProxyOrMessagePort;
|
||||
|
||||
namespace workers {
|
||||
|
||||
@ -87,13 +85,6 @@ public:
|
||||
const MessageEventInit& aEventInit,
|
||||
ErrorResult& aRv);
|
||||
|
||||
void InitMessageEvent(JSContext* aCx, const nsAString& aType, bool aCanBubble,
|
||||
bool aCancelable, JS::Handle<JS::Value> aData,
|
||||
const nsAString& aOrigin, const nsAString& aLastEventId,
|
||||
const Nullable<WindowProxyOrMessagePort>& aSource,
|
||||
const Nullable<Sequence<OwningNonNull<MessagePort>>>& aPorts,
|
||||
ErrorResult& aRv);
|
||||
|
||||
protected:
|
||||
~MessageEvent();
|
||||
|
||||
|
@ -13,23 +13,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=848294
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript">
|
||||
function testMessageEvent(e, test) {
|
||||
ok(e, "MessageEvent created");
|
||||
is(e.type, 'message', 'MessageEvent.type is right');
|
||||
|
||||
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');
|
||||
|
||||
if (test.ports != undefined) {
|
||||
is(e.ports.length, test.ports.length, 'MessageEvent.ports is ok');
|
||||
is(e.ports, e.ports, 'MessageEvent.ports is ok');
|
||||
} else {
|
||||
ok(!('ports' in test) || test.ports == null, 'MessageEvent.ports is ok');
|
||||
}
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
var channel = new MessageChannel();
|
||||
|
||||
@ -50,16 +33,20 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=848294
|
||||
var test = tests.shift();
|
||||
|
||||
var e = new MessageEvent('message', test);
|
||||
testMessageEvent(e, test);
|
||||
ok(e, "MessageEvent created");
|
||||
is(e.type, 'message', 'MessageEvent.type is right');
|
||||
|
||||
e = new MessageEvent('message');
|
||||
e.initMessageEvent('message', true, true,
|
||||
'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 : null);
|
||||
testMessageEvent(e, test);
|
||||
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');
|
||||
|
||||
if (test.ports != undefined) {
|
||||
is(e.ports.length, test.ports.length, 'MessageEvent.ports is ok');
|
||||
is(e.ports, e.ports, 'MessageEvent.ports is ok');
|
||||
} else {
|
||||
ok(!('ports' in test) || test.ports == null, 'MessageEvent.ports is ok');
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
return mPorts[aIndex];
|
||||
}
|
||||
|
||||
private:
|
||||
public:
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
nsTArray<nsRefPtr<MessagePort>> mPorts;
|
||||
};
|
||||
|
@ -44,12 +44,6 @@ interface MessageEvent : Event {
|
||||
* data, origin, source, and lastEventId attributes of this appropriately.
|
||||
*/
|
||||
readonly attribute MessagePortList? ports;
|
||||
|
||||
[Throws]
|
||||
void initMessageEvent(DOMString type, boolean bubbles, boolean cancelable,
|
||||
any data, DOMString origin, DOMString lastEventId,
|
||||
(WindowProxy or MessagePort)? source,
|
||||
sequence<MessagePort>? ports);
|
||||
};
|
||||
|
||||
dictionary MessageEventInit : EventInit {
|
||||
|
Loading…
Reference in New Issue
Block a user