ariya/phantomjs — comment on commit 1531595d2e2a44c3b9ef425d78fa38614e3ab493
File:  line 0
By detro:

I still don't understand what this stuff has to do with WebKit.

Anyway, would be cool to actually find the root cause: the change I made here was just in the way I set the HTML for the frame.

I can only assume that the frame requires a "physical" file on the filesystem, so your use of temporary file was fulfilling that need.
In my patch I set the script directly as a buffer.