Closed Bug 949376 Opened 11 years ago Closed 9 years ago

event.initMessageEvent is not a function

Categories

(Core :: DOM: Core & HTML, defect)

26 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: predrag, Assigned: baku)

Details

(Keywords: dev-doc-needed, site-compat)

Attachments

(2 files)

Attached 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.
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
https://bugzilla.mozilla.org/show_bug.cgi?id=848294
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
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: nobody → amarchesini
Attached 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: 11 years ago9 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.

Attachment

General

Creator:
Created:
Updated:
Size: