Dispatching click-event to an anchor does not execute url in href

RESOLVED DUPLICATE of bug 395917

Status

()

RESOLVED DUPLICATE of bug 395917
13 years ago
10 years ago

People

(Reporter: mattias.zetterberg, Unassigned)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b) Gecko/20050217
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b) Gecko/20050217

I simulate a click on an anchor with an url in href and a javascript alert in onclick. In previous versions (1.7.3 and earlier) it works, ie both the action in onclick and href executes. In version 1.7.5 and later the onclick is the only thing that executes.

WORKS WITH:Win XP Pro SP2, Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910
DONT WORK: Win XP Pro SP2, Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041217


Reproducible: Always

Steps to Reproduce:
1.Open testcase DispatchEvent.html
2.Use mouse to click the link named Activate
3.

Actual Results:  
The javascript alert declared in Targetlink appears.

Expected Results:  
The javascript alert declared in Targetlink appears. A new window opens with url to Mozilla homepage.
(Reporter)

Comment 1

13 years ago
Created attachment 215646 [details]
Simple testcase for dispatching a click-event
Probably it doesn't work because the dispatched event is untrusted.
(Reporter)

Comment 3

13 years ago
(In reply to comment #2)
> Probably it doesn't work because the dispatched event is untrusted.
> 
Why is the event now untrusted when this worked before? If this now is correct, is there a workaround to achieve the same effect?
(In reply to comment #3)
> Why is the event now untrusted when this worked before? If this now is correct,
> is there a workaround to achieve the same effect?
Because there are security concerns involved with it. Code from the browser could also be listening to those same click events and they need to be able to distinguish between user generated events and events generated by js.
There is no real workaround, afaik.

Updated

10 years ago
Status: UNCONFIRMED → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 395917
You need to log in before you can comment on or make changes to this bug.