[webkit-qt] Javascript inside pixeldata of QImage

Jocelyn Turcotte jocelyn.turcotte at digia.com
Tue Mar 19 08:32:21 PDT 2013

On Tue, Mar 19, 2013 at 04:08:45PM +0100, Youri Westerman wrote:
> Thanks for your quick reply.
> Actually I have extended the QWebPage class and overridden the
> javascriptConsoleMessage method. All the javascript code does is wait
> for a couple of seconds and then prints a console message. The thing
> is that it works with qt4.8 and does not in qt5.
> However I would very much like to use qt4.8 at the moment because
> there are no packages of qt5 available for ubuntu.
> Furthermore when I call the bits() method on a QImage painted through
> the render method of QWebPage and inspect the data which was returned
> there is javascript in there, while there should only be ARGB pixel
> data... Seems like a bug to me, but maybe I'm doing something wrong?


sorry, I misunderstood your issue.

I find it is quite unlikely that render is writing JavaScript to your image.
I think that QImage might not be initialized in your case, so that you are looking at uninitialized memory.

So something must be going wrong and render isn't actually writing to the memory you are seeing, but I can't say much more by looking at your code snippet.
Calling fill() on your QImage before render might help you investigate the issue at first.


More information about the webkit-qt mailing list