]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Fix Race Condition in Display#clear on IE10
authorSolly Ross <sross@redhat.com>
Tue, 23 Sep 2014 01:37:04 +0000 (21:37 -0400)
committerSolly Ross <sross@redhat.com>
Tue, 23 Sep 2014 01:37:04 +0000 (21:37 -0400)
There was a race condition in Display#clear on IE10
because we resize and then clear that causes the canvas
to not actually end up cleared.  Clearing the current
viewport first solves the issue.  It doesn't appear to
affect other platforms, so it's inside a engine check
(`Util.Engine.trident === 6`).  Once we stop supporting
IE10, we should just remove this, because it's not the best
to have Engine-specific code.

include/display.js

index d2876a76e3848d72be7b5d081c8aca070f93ae27..8763fa4ac6591629e4d0413ce91acba6735bd7c8 100644 (file)
@@ -312,6 +312,12 @@ var Display;
                 this.resize(this._logo.width, this._logo.height);
                 this.blitStringImage(this._logo.data, 0, 0);
             } else {
+                if (Util.Engine.trident === 6) {
+                    // NB(directxman12): there's a bug in IE10 where we can fail to actually
+                    //                   clear the canvas here because of the resize.
+                    //                   Clearing the current viewport first fixes the issue
+                    this._drawCtx.clearRect(0, 0, this._viewportLoc.w, this._viewportLoc.h);
+                }
                 this.resize(640, 20);
                 this._drawCtx.clearRect(0, 0, this._viewportLoc.w, this._viewportLoc.h);
             }