Closed Bug 481688 Opened 11 years ago Closed 11 years ago

[FIX]Stop firing DOMLinkAdded/Removed events to content listeners

Categories

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

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: bzbarsky, Assigned: bzbarsky)

Details

Attachments

(1 file)

We have these DOMLinkAdded/Removed events that we fire on <link> elements... Unfortunately, we fire them in ways content can see, while stomping on the DOM namespace and all.  Not much we can do about the latter now, I think, but we should fix the former.
So we want to fire the events to chrome event handler, but using <link>
as the target.
Attached patch Indeed, like soSplinter Review
Assignee: nobody → bzbarsky
Attachment #365707 - Flags: superreview?(Olli.Pettay)
Attachment #365707 - Flags: review?(Olli.Pettay)
Comment on attachment 365707 [details] [diff] [review]
Indeed, like so

>   nsEventStatus status = nsEventStatus_eIgnore;
>   rv = aDoc->GetWindow()->GetChromeEventHandler()->DispatchDOMEvent(nsnull,
>                                                                     event,
>                                                                     nsnull,
>                                                                     &status);
Some null checks needed here, especially now that this may get called async.
https://bugzilla.mozilla.org/show_bug.cgi?id=462856#c27

>+  nsCOMPtr<nsINode> node(do_QueryInterface(elt));
>+  NS_ENSURE_TRUE(node, NS_ERROR_UNEXPECTED);
Nit, NS_ENSURE_STATE(node);

r+sr=me, with null checks. I guess those are needed on branch too,
so perhaps a separate bug which blocks this one and this could land after
that one.
Attachment #365707 - Flags: superreview?(Olli.Pettay)
Attachment #365707 - Flags: superreview+
Attachment #365707 - Flags: review?(Olli.Pettay)
Attachment #365707 - Flags: review+
Comment on attachment 365707 [details] [diff] [review]
Indeed, like so


>+  NS_ASSERTION(aDoc, "GetEventAndTarget lied?");
>   NS_ENSURE_ARG_POINTER(aDoc->GetWindow());
>   NS_ENSURE_ARG_POINTER(aDoc->GetWindow()->GetChromeEventHandler());
...

>   rv = aDoc->GetWindow()->GetChromeEventHandler()->DispatchDOMEvent(nsnull,
>                                                                     event,
>                                                                     nsnull,
>                                                                     &status);
Bah, null checks are there.
Status: NEW → ASSIGNED
Summary: Stop firing DOMLinkAdded/Removed events to content listeners → [FIX]Stop firing DOMLinkAdded/Removed events to content listeners
Pushed http://hg.mozilla.org/mozilla-central/rev/5edc7cd0164d
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.