event.initMessageEvent is not a function

RESOLVED FIXED in Firefox 44

Status

()

defect
RESOLVED FIXED
6 years ago
4 months ago

People

(Reporter: predrag, Assigned: baku)

Tracking

({dev-doc-needed, site-compat})

26 Branch
mozilla44
x86_64
Windows 7
Points:
---

Firefox Tracking Flags

(firefox44 fixed)

Details

Attachments

(2 attachments)

Reporter

Description

6 years ago
Posted image initMessageEvent.png
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0 (Beta/Release)
Build ID: 20131205075310

Steps to reproduce:

From https://github.com/gimite/web-socket-js:
...
var event = document.createEvent("MessageEvent");
event.initMessageEvent("message", false, false, data, null, null, window, null);
return event;
...


Actual results:

Firefox 26 throws an error: TypeError: event.initMessageEvent is not a function
and crashes the web application.

Firefox 25 works just fine.


Expected results:

The event should have been created, like it is in Firefox 25.
Reporter

Updated

6 years ago
Attachment #8346444 - Attachment description: NVIDIA ALSIUS_2013-12-12_10-07-50.png → initMessageEvent.png
Attachment #8346444 - Attachment filename: NVIDIA ALSIUS_2013-12-12_10-07-50.png → initMessageEvent.png
Reporter

Comment 1

6 years ago
https://bugzilla.mozilla.org/show_bug.cgi?id=848294
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID
Reporter

Comment 2

6 years ago
fixed by replacing event.initMessageEvent with:
var event = new MessageEvent('message', {
	'view': window,
	'bubbles': false,
	'cancelable': false,
	'data': data
});
It's back.

https://www.w3.org/Bugs/Public/show_bug.cgi?id=25907
Status: RESOLVED → REOPENED
Component: Untriaged → DOM
Ever confirmed: true
Product: Firefox → Core
Resolution: INVALID → ---
Assignee

Updated

4 years ago
Assignee: nobody → amarchesini
Assignee

Comment 5

4 years ago
Posted patch ms.patchSplinter Review
Attachment #8669643 - Flags: review?(bugs)
Comment on attachment 8669643 [details] [diff] [review]
ms.patch

>+
>+    nsCOMPtr<nsIDOMMessageEvent> event = this;
>+    mPorts = new MessagePortList(event, ports);
This looks a bit ugly.
Why can't the first param be just
static_cast<Event*>(this) or so?
Attachment #8669643 - Flags: review?(bugs) → review+
https://hg.mozilla.org/mozilla-central/rev/e04c59fd01c4
Status: REOPENED → RESOLVED
Closed: 6 years ago4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.