[Gambas-user] [Gambas Bug Tracker] Bug #823: Strange Eval Behavior in gb.qt4.webkit

bugtracker at ...3416... bugtracker at ...3416...
Tue Oct 20 03:17:43 CEST 2015


http://gambaswiki.org/bugtracker/edit?object=BUG.823&from=L21haW4-

Jonathan LEE reported a new bug.

Summary
-------

Strange Eval Behavior in gb.qt4.webkit

Type             : Bug
Priority         : Low
Gambas version   : 3.8
Product          : QT4 component


Description
-----------

So with the example WebBrowser I have the following assigned to the ZoomIn control's Click event:

Public Sub btnZoomIn_Click()
  GetView().Eval("var oDoc; if(document.getElementById(\"gsft_main\")) { oDoc = document.getElementById(\"gsft_main\").contentWindow.document; }")
End

This is run against a Service-Now website, and upon clicking the Zoom button, the program freezes for about 10 seconds while this simple script finishes being parsed.

If I change the code to this...

Public Sub btnZoomIn_Click()
  GetView().Eval("var oDoc; if(document.getElementById(\"gsft_main\")) { oDoc = document.getElementById(\"gsft_main\").contentWindow.document; } 1 = 1;")
End

...the script finishes immediately.

I tried to make this example as simple as possible to make it easier to duplicate, but this is actually originally concerning a much larger project.

Running this same javascript in the console of Chrome or Firefox executes immediately, so it seems to be something specific to GAMBAS' implementation of WebKit in this component. The problem can be replicated on the public sandbox of Service-Now.

The problem can also be duplicated on this site with some tweaking --> http://www.angelfire.com/super/badwebs/

Just for quick comparison if you have this for Zoom In...

Public Sub btnZoomIn_Click()
  
  GetView().Eval("var oDoc; if(document.getElementsByName(\"main\")[0]) { oDoc = document.getElementsByName(\"main\")[0].contentWindow.document; }")
  GetView().Eval("alert('Done');")
  
End

...and this for Zoom Out...

Public Sub btnZoomOut_Click()

  GetView().Eval("var oDoc; if(document.getElementsByName(\"main\")[0]) { oDoc = document.getElementsByName(\"main\")[0].contentWindow.document; } 1 = 1;")
  GetView().Eval("alert('Done');")

End

...you'll notice that on "The World's Worst Website" when you click the Zoom In button it takes a good 10 seconds to get the "Done" alert, while it pops up immediately if you click Zoom Out instead.

Seems odd that adding an arbitrary assignment statement (like "1 = 1") would overcome the performance issue, but that's what seems to happen.


System information
------------------

[System]
Gambas=3.8.2
OperatingSystem=Linux
Kernel=3.13.0-24-generic
Architecture=x86_64
Distribution=Linux Mint 17.2 Rafaela
Desktop=GNOME
Theme=Plastique
Language=en_US.UTF-8
Memory=7984M

[Libraries]
Cairo=libcairo.so.2.11301.0
Curl=libcurl.so.4.3.0
DBus=libdbus-1.so.3.7.6
GStreamer=libgstreamer-0.10.so.0.30.0
GStreamer=libgstreamer-1.0.so.0.204.0
GTK+2=libgtk-x11-2.0.so.0.2400.23
GTK+3=libgtk-3.so.0.1000.8
OpenGL=libGL.so.1.2.0
Poppler=libpoppler.so.44.0.0
QT4=libQtCore.so.4.8.6
QT5=libQt5Core.so.5.2.1
SDL=libSDL-1.2.so.0.11.4

[Environment]
CINNAMON_VERSION=2.6.13
CLUTTER_BACKEND=x11
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-eUd0Qo1FQP,guid=7559ca448d3849821b3ada8e562550e7
DEFAULTS_PATH=/usr/share/gconf/cinnamon.default.path
DESKTOP_SESSION=cinnamon
DISPLAY=:0
GB_GUI=gb.qt4
GDMSESSION=cinnamon
GDM_XSERVER_LOCATION=local
GIO_LAUNCHED_DESKTOP_FILE=/usr/share/applications/gambas3.desktop
GIO_LAUNCHED_DESKTOP_FILE_PID=20400
GJS_DEBUG_OUTPUT=stderr
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
GNOME_KEYRING_CONTROL=/run/user/1000/keyring-yH21vu
GPG_AGENT_INFO=/run/user/1000/keyring-yH21vu/gpg:0:1
HOME=<home>
JAVA_HOME=/usr/lib/jvm/default-java
LANG=en_US.UTF-8
LOGNAME=<user>
MANDATORY_PATH=/usr/share/gconf/cinnamon.mandatory.path
MDMSESSION=cinnamon
MDM_LANG=en_US.UTF-8
MDM_XSERVER_LOCATION=local
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
PWD=<home>
SESSION_MANAGER=local/<hostname>:@/tmp/.ICE-unix/1435,unix/<hostname>:/tmp/.ICE-unix/1435
SHELL=/bin/bash
SSH_AGENT_PID=1777
SSH_AUTH_SOCK=/run/user/1000/keyring-yH21vu/ssh
TEXTDOMAIN=im-config
TEXTDOMAINDIR=/usr/share/locale/
TZ=:/etc/localtime
USER=<user>
USERNAME=<user>
WINDOWPATH=8
XAUTHORITY=<home>/.Xauthority
XDG_CONFIG_DIRS=/etc/xdg/xdg-cinnamon:/etc/xdg
XDG_CURRENT_DESKTOP=X-Cinnamon
XDG_DATA_DIRS=/usr/share/cinnamon:/usr/share/gnome:/usr/local/share/:/usr/share/:/usr/share/mdm/
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SESSION_COOKIE=db14662cac502ddc972d861753a16b0d-1445286116.905481-1424729098
XDG_SESSION_DESKTOP=cinnamon
XDG_SESSION_ID=c2
XDG_VTNR=8






More information about the User mailing list