Issue #2721 - Create special case exception for <A>.Click() outside of DOM

This removes the requirement for there to be a non-null PresShell to
dispatch `Click()` events on `<A>` elements (only), since the exception
to the rule has propagated to the spec.

With these changes it should now be possible do create an anchor and
`Click()` on it from JS without actually first attaching it to the DOM
of the presented document, as abused by scripted downloads in pages
(instead of using the A attribute to custom-name downloads).
This commit is contained in:
Moonchild 2025-06-09 23:45:31 +02:00 • committed by roytam1
commit 37de431ac0
15 changed files with 79 additions and 94 deletions

View file

@ -457,13 +457,9 @@ public:
nsIDocShell* GetDocShell() const;
// XXX this are going to be replaced with set/get container
void SetLinkHandler(nsILinkHandler* aHandler) { mLinkHandler = aHandler; }
nsILinkHandler* GetLinkHandler() { return mLinkHandler; }
/**
* Detach this pres context - i.e. cancel relevant timers,
* SetLinkHandler(null), SetContainer(null) etc.
* SetContainer(null) etc.
* Only to be used by the DocumentViewer.
*/
virtual void Detach();
@ -1245,10 +1241,6 @@ protected:
nsIAtom* MOZ_UNSAFE_REF("always a static atom") mMedium; // initialized by subclass ctors
nsCOMPtr<nsIAtom> mMediaEmulated;
// This pointer is nulled out through SetLinkHandler() in the destructors of
// the classes which set it. (using SetLinkHandler() again).
nsILinkHandler* MOZ_NON_OWNING_REF mLinkHandler;
// Formerly mLangGroup; moving from charset-oriented langGroup to
// maintaining actual language settings everywhere (see bug 524107).
// This may in fact hold a langGroup such as x-western rather than