Closed Bug 856413 Opened 12 years ago Closed 12 years ago

Once UIEvent#view property is read, value of UIEvent#view property will be `null`

Categories

(Core :: DOM: Events, defect)

22 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla23
Tracking Status
firefox21 --- unaffected
firefox22 + fixed
firefox23 --- fixed

People

(Reporter: nobuoka+001, Assigned: smaug)

References

Details

(Keywords: regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:22.0) Gecko/20130330 Firefox/22.0 Build ID: 20130330030828 Steps to reproduce: 1. add an event listener for UI event (for example: "click" event) to an element by using `addEventListener` 2. emit event (for example: clicking the element) 3. remove the element (`evt.currentTarget`) from DOM tree in the event listener 4. check the `evt.view` property in the event listener (`evt` is an argument of event listener) please see: http://jsfiddle.net/nobuoka/qvJfH/ (sample code) Actual results: The value of `evt.view` is `null` (on Firefox 22 nightly 2013-03-30) Expected results: The value of `evt.view` is defaultView (window object) see: http://www.w3.org/TR/DOM-Level-3-Events/#events-UIEvent-view It says "The view attribute identifies the AbstractView from which the event was generated.", so I think it must not changed even when the eventTarget is removed from DOM tree.
Summary: UIEvent#view property is changed when event target is removed from DOM tree in event listener → Once UIEvent#view property is read, value of UIEvent#view property will be `null`
Sorry, comment #0 is wrong. Instead, see below. Steps to reproduce: 1. add an event listener for UI event (for example: "click" event) to an element by using `addEventListener` 2. emit event (for example: clicking the element) 3. read the `evt.view` property in the event listener (it should be correct value) 4. read the `evt.view` property again (`evt` is an argument of event listener) please see: http://jsfiddle.net/nobuoka/qvJfH/ (sample code) Actual results: The value of `evt.view` is `null` (on Firefox 22 nightly 2013-03-30) Expected results: The value of `evt.view` is defaultView (window object) see: http://www.w3.org/TR/DOM-Level-3-Events/#events-UIEvent-view
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 8 → All
Hardware: x86_64 → All
100 already_AddRefed<nsIDOMWindow> GetView() 101 { 102 nsCOMPtr<nsIDOMWindow> view = mView; 103 return mView.forget(); 104 }
Assignee: nobody → bugs
Blocks: 847585
Component: Untriaged → DOM: Events
Product: Firefox → Core
uh, sorry. Patch coming.
Attached patch patch (deleted) — Splinter Review
Attachment #732378 - Flags: review?(Ms2ger)
Comment on attachment 732378 [details] [diff] [review] patch Review of attachment 732378 [details] [diff] [review]: ----------------------------------------------------------------- I don't know why this needs to return already_AddRefed, but this works.
Attachment #732378 - Flags: review?(Ms2ger) → review+
Comment on attachment 732378 [details] [diff] [review] patch [Approval Request Comment] Bug caused by (feature/regressing bug #): bug 847585 User impact if declined: wrong behavior Testing completed (on m-c, etc.): landed to m-i Risk to taking this patch (and alternatives if risky): super-safe String or IDL/UUID changes made by this patch: NA
Attachment #732378 - Flags: approval-mozilla-aurora?
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
Attachment #732378 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: