Fix JS Quick Edit for projects that have a function named "hasOwnProperty"

Fixes #3002 

If _any_ files in your project define a function named `hasOwnProperty`, JS Quick Edit would throw an exception. (modernizr.js, which is included in the test files for phantom.js, defines a `hasOwnProperty` function. This is the cause of bug #3002).

@peterflynn - since you've fixed several bugs in this area, would you mind taking a look?