My JavaScript book is out! Don't miss the opportunity to upgrade your beginner or average dev skills.

Thursday, August 21, 2008

How to crash FireFox 3 with 3 lines of code

Hi there, here I am back from holidays :geek:

Before I'll start to write more interesting stuff, here we have 3 lines of JavaScript that could cause problems to our favourite browser, in this case version 3.0.1

I discovered this problem, already part of the bugs report site, trying to emulate keyboards events using the UIEvents interface instead of KeyboardEvents


var e = document.createEvent("UIEvents");
e.initUIEvent("keypress", true, true, this, 1);
document.documentElement.dispatchEvent(e);


Nice one? See you soon ;)

3 comments:

Anonymous said...

what do i do with the code idiot

mrhazrd said...

Idiot?...heh eh...avoid it for now, obviously...

Now, Mr Idiot, and yes, i'm talking to you, Anon...go learn some grammar and punctuation.

Then we can have a nice break from you and when you are back, your posts will be significantly easier to read.

Anonymous said...

Try this:

<html><body>
<form><textarea name="results"></textarea></form>
<script type="text/javascript">
for (i=0;i<1500;i++) document.forms[0].results.value += "\nHello";
</script>
</body></html>