Encode URLs when passing to JS: issues #12216 and #11035.

 * Use QUrl::toEncoded() instead of QUrl::toString() to compute
   WebPage.url, WebPage.frameUrl, the first argument to an
   onNavigationRequested hook, and the 'url' property of the object
   passed to an onResourceError hook.  This makes them consistent with
   the data passed to the onResourceRequested, onResourceReceived,
   and onResourceTimeout hooks, and with the semantics of WebPage.open(),
   WebPage.openUrl(), and the cookie jar.  (Issue #12216.)

 * Use m_currentFrame->baseUrl() instead of m_currentFrame->url() for
   WebPage.frameUrl; this is a partial workaround for a bug in QtWebKit
   which is the root cause of issue #11035.  Noticed while attempting to
   test the above changes.

 * Take care not to mangle the encoding of the url passed to the
   WebServer.listen callback function.  Necessary in order to test the
   above changes: not only should JS receive %-encoded URLs, the server's
   encoding of non-ASCII characters in URLs should be preserved; to test
   this thoroughly, a heinously non-Unicode-compatible encoding (Shift_JIS)
   is deliberately used for the URLs in all the new tests.
Add phantom.resolveRelativeUrl and phantom.fullyDecodeUrl.

These utility functions make it easier to work with encoded URLs.
See issues #12216 and #11035.
Have QHttpNetworkReply try to interpret the HTTP reason phrase as UTF-8 first.

Nowadays, despite what the RFCs say, HTTP reason phrases that aren't ASCII
are far more likely to be UTF-8 than ISO-8859-1.  Qt blindly interprets
them as ISO-8859-1, which causes them to get double-coded in logs and such.
Unfortunately, this can only be fixed deep in the guts of Qt.

https://github.com/ariya/phantomjs/issues/12758
Add a command-line option --local-urls={true,false}

The default is 'true'.  When set 'false', file: and qrc: URLs are
treated as invalid (unknown scheme) rather than opening local files,
as requested in issue #12752.

In order to test this, I added a mechanism to test/run-tests.py
allowing individual tests to be annotated with command-line
options to pass to phantomjs or the script.
Merge branch 'dont-double-encode-http-response-line'
Merge branch 'encode-all-the-urls'