Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

XULRunner: canvas.getContext('2d') failure!

149 views
Skip to first unread message

woute...@gmail.com

unread,
Sep 19, 2007, 5:03:26 AM9/19/07
to
Hello,

This is a code snippet from a HTML file:

var canvas = document.getElementById("main-canvas");
var ctx;
if (canvas.getContext){
canvas.getContext('2d');
}

I use this HTML file in a XUL file by means of the following lines:

<vbox id="startbox" flex="1">
<iframe name="centralpane" width="150" flex="1" src="file://x/
xxxxxxxxx/xxxxxx.html"/>
</vbox>

This XUL code works in Firefox. But it fails in a standalone XULRunner
application. The stops at the 'canvas.getContext('2d')' method. Is
there a workaround for this to get the thing working? Does someone has
any tips to solve this problem?

Thank you for your time,
Wouter

Sergey Yanovich

unread,
Sep 19, 2007, 6:49:27 AM9/19/07
to
woute...@gmail.com wrote:
> This XUL code works in Firefox. But it fails in a standalone XULRunner
> application. The stops at the 'canvas.getContext('2d')' method. Is
> there a workaround for this to get the thing working? Does someone has
> any tips to solve this problem?

Try to add ' type="content-primary"' to <iframe> attributes or try to
use <browser> instead.

--
Sergey Yanovich

woute...@gmail.com

unread,
Sep 19, 2007, 7:20:52 AM9/19/07
to
On Sep 19, 12:49 pm, Sergey Yanovich <ynv...@gmail.com> wrote:

Hello,

First of all. Thank you for your reply.

I've tried the two things you suggested but it still failed to work. I
think the problem is the javascript method '.getContext('2d')' (and
not the XUL code ) which doesn't do anything in the standalone
XULRunner application. A check on what this method returned gave
nothing (not even a 'null')! Could this be due to the version of
XULRunner (1.8)? My Firefox version is 2.0.0.6 and this works fine.

Thank you for your help and time!
Wouter

Gijs Kruitbosch

unread,
Sep 19, 2007, 7:46:31 AM9/19/07
to woute...@gmail.com


Have you checked what the error you're getting is (use the -jsconsole
flag to start your app)? That probably explains something. :-)

~ Gijs

Michael Vincent van Rantwijk, MultiZilla

unread,
Sep 19, 2007, 8:01:00 AM9/19/07
to

Did you compile XULRunner yourself (--disable-canvas???)?

--
Michael Vincent van Rantwijk
- MultiZilla Project Team Lead
- XUL Boot Camp Staff member (ActiveState Training Partner)
- iPhone Application Developer

woute...@gmail.com

unread,
Sep 19, 2007, 8:45:19 AM9/19/07
to
On Sep 19, 1:46 pm, Gijs Kruitbosch <gijskruitbo...@gmail.com> wrote:

Hello Gijs,

Thanks for your reply.

I've tried to debug the application with the command: xulrunner
application.ini -jconsole. (and set
pref("javascript.options.showInConsole",true)). Then I looked into the
Javascript Error console. This gave no error. (or I'm I doing
something wrong here?)

Do you have other suggestions?
Thank you,
Wouter

woute...@gmail.com

unread,
Sep 19, 2007, 8:47:07 AM9/19/07
to
On Sep 19, 2:01 pm, "Michael Vincent van Rantwijk, MultiZilla"
<mv_van_rantw...@yahoo.com> wrote:
> - iPhone Application Developerd

Hello Michael,

Thank you for your reply.

I didn't compile XULRunner for myself. But got it from
http://developer.mozilla.org/en/docs/XULRunner.
(I'm using a Windows machine)

Do you have any other ideas?
Thank you,
Wouter


woute...@gmail.com

unread,
Sep 19, 2007, 9:45:39 AM9/19/07
to
> I didn't compile XULRunner for myself. But got it fromhttp://developer.mozilla.org/en/docs/XULRunner.

> (I'm using a Windows machine)
>
> Do you have any other ideas?
> Thank you,
> Wouter

Hello,

@Gijs:

I managed to debug something: I get teh following error when I try to
execute the line canvas.getContext('2d');

[Exception..."Component returned failure code: 0x80070057
(NS_ERROR_ILLEGAL_VALUE)
[nsIDOMHTMLCanvasElement.getCOntext]" nsresult: "0x80070057
(NS_ERROR_ILLEGAL_VALUE)"
location: "JS frame::file:///C:/xxxxxxxxxxxx/
test.html::init::line15"data:no]

It seems like the function 'getContext' can't find any data? Does
anybody know how to solve this?

Thank you,
Wouter


woute...@gmail.com

unread,
Sep 19, 2007, 10:07:37 AM9/19/07
to

Hello,

After some 'googling', I came up with the following useful link:
http://canvex.lazyilluminati.com/tests/tests/spec.html#testrefs.context.empty
This is exactly the error I seem to get. Does anyone know a solution
for this?

Thank you,
Wouter

0 new messages