we are using buff.js from http://bluff.jcoglan.com/.
while using webtest to test our portal we get an JavaScript-Error.
JavaScript error loading page https://fachportal.key-work-asp.de/ags_demo/ofbiz/articleProjection/control/EditArticleSizeAllocation?apnDispoDatasetId=205&articleId=ART_10020: TypeError: Cannot find function getContext in object [object]. (https://fachportal.key-work-asp.de/ags_demo/js/bluff/bluff-src.js#2101)
caused by this JavaScript-snippet:
Bluff.Renderer = new JS.Class({
extend: {
WRAPPER_CLASS: 'bluff-wrapper',
TEXT_CLASS: 'bluff-text'
},
font: 'Arial, Helvetica, Verdana, sans-serif',
gravity: 'north',
initialize: function(canvasId) {
this._canvas = document.getElementById(canvasId);
this._ctx = this._canvas.getContext('2d');
},
scale: function(sx, sy) {
this._sx = sx;
this._sy = sy || sx;
},
........
Thanks for your gorgeous work!
related JavaScript Source file.
In fact here the problem is the lack of support for Canvas.
title changed
Reference: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html
@Michael: would an empty implementation help, or you need to get the image after the 'drawing'?
Hi Ahmed
Thanks, but an empty implementation would be fine for now.
I guess all methods are now implemetned (using naked-eye examination) :-)
Advise if you still have an issue
Canvas support is still problematic. Apparently the only BrowserVersion that supports it in HtmlUnit 2.9 is old FIREFOX_3_6 that has other issues. In the current version there are also FIREFOX_10 and CHROME_16 but they are marked as experimental. Manually adding BrowserVersionFeatures.CANVAS to INTERNET_EXPLORER doesn't work and it seems that the support is partially enabled by BrowserVersion's applicationName that has to be equal to "Netscape".
Is there a recommended way to use modern browser features like canvas in the most recent stable version of HtmlUnit (2.9)?