event: Stricter type checking in trigger - Fixes #13360 - Closes gh-1153

Squashed commit of the following:

commit 5935a362c75ecef04d5ec9775cbcaf2165921e8d
Author: Andrew Plummer <plummer.andrew@gmail.com>
Date:   Fri Feb 1 02:40:42 2013 +0900

    Using "hasOwnProperty" to check for direct properties "type" and
    "namespace" on events before triggering.
(cherry picked from commit f005af54e4983658e3ae504111885921c4dca383)