Add tests for #11887

I wrote some tests of https://github.com/ariya/phantomjs/pull/11887.
The master branch build were passed to these tests.

I sent a patch (https://github.com/Eltiech/phantomjs/pull/1) to @Eltiech's pull request branch(#11887).
But I was not able to get a comment from Eltiech.
Because he does not act from 2 months ago at github.

Eltiech's patch is also included in this pull request.