This fixes issue #11162.
`File` constructor takes a `QTextCodec *`, codec; but, if codec is
`NULL`, then it assumes "binary" mode, which causes non-ASCII
characters to be converted to NUL (`\0`) in `File::write`.
This change passes the codec for UTF-8 to the `File` constructor for
the `std{in,out,err}` instances, thus opening them in *text mode*.
If the wrapped `QFile` was opened with `QIODevice::Unbuffered`, any
writes should be unbuffered. However, as currently implemented,
using `QTextStream` when the `File` is in "text" mode causes all
reads/writes to be buffered.
This modification forces a flush in `File::write` if the wrapped
`QFile` was opened with `QIODevice::Unbuffered`.
Necessary to fix issue #11162https://github.com/ariya/phantomjs/issues/11162.
require.stub() can now accept a factory function instead of an object
so that stubbed modules are initialized lazily:
require.stub('zlib', function() {
// initialized once, when zlib first required
return {
createGzip: function() { ... }
};
});
http://code.google.com/p/phantomjs/issues/detail?id=1044
In some cases, setupFrame() has not been invoked (due to the queued
signal-slot connection) after the frame is destroyed and thus leads
to the crash. We prevent this from happening by making sure it is a
direct connection instead and therefore setupFrame() will be executed
as soon as possible.
Investigation + patch by Vitaliy Slobodin <vitaliy.slobodin@gmail.com>.
http://code.google.com/p/phantomjs/issues/detail?id=947
This feature renders PDF, GIF and other format supported by Qt to
stdout or stderr.
*NOTE*
"/dev/stdout" and "/dev/stderr" are converted to System::stdout and
System::stderr on Windows.
Issue: https://code.google.com/p/phantomjs/issues/detail?id=973
All invokable methods, slots, signals, and properties visible from
JavaScript, but which do not start with an underscore, are lazily
(only when necessary) added to the completion list through dynamic
reflection.
This leverages `QMetaObject` for reflection of `QObject`s. As such,
there is now no need to inherit `REPLCompletable` and it has been
removed.
http://code.google.com/p/phantomjs/issues/detail?id=943
This is just a workaround. We simply avoid removing the custom font
(intentionally leak it, a small price to pay) because otherwise it will
invalidate Qt's font cache, which in turns trigger the crash at
CoreText's CTFontCopyGraphicsFont.
http://code.google.com/p/phantomjs/issues/detail?id=690
The [IO/A spec][1] for `read` is as follows:
> Read up to n bytes from the stream, or until the end of the stream
> has been reached. [If] n is null, reads up to the block size of the
> underlying device, or up to 1024 bytes if the block size is not
> discernible. If n is not specified, this method always reads the
> full stream until its end is reached. ...
Since discovering the block size of the underlying device is
non-trivial, we will just default to 1024.
**NOTE**
The initial implementation of `File::read()` saves the current
(original) position, seeks to the beginning of the stream,
`readAll`s to the end, and then resets to the original position.
I think that this behavior is unexpected and should be changed--it
should read from the current position to the end of the stream and
stay there. The user should explicitly `seek` to the beginning of
the stream when necessary.
With the current implementation, the user should note that the
position *will not change* after calling `read()` with no arguments.
[1]: http://wiki.commonjs.org/wiki/IO/A#Instance_Methodshttp://code.google.com/p/phantomjs/issues/detail?id=938
For our QPA/Lighthouse platform screen, apparently we need to specify the
physical screen size because otherwise the default 100 dpi will be used.
This also brings font rendering on headless Linux to 72 dpi.
http://code.google.com/p/phantomjs/issues/detail?id=659