Last Comment Bug 392166 - Enable canvas in Thunderbird, for extension developers
: Enable canvas in Thunderbird, for extension developers
Status: VERIFIED FIXED
:
Product: Thunderbird
Classification: Client Software
Component: Build Config (show other bugs)
: Trunk
: All All
: -- enhancement with 1 vote (vote)
: ---
Assigned To: Phil Ringnalda (:philor)
: build
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-08-14 03:40 PDT by Florian Jenett
Modified: 2008-02-26 20:37 PST (History)
7 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Turn it on (1.61 KB, patch)
2007-08-20 23:54 PDT, Phil Ringnalda (:philor)
mscott: review+
Details | Diff | Splinter Review
super simple canvas enabled extension for thunderbird (6.85 KB, application/octet-stream)
2007-08-23 13:10 PDT, Florian Jenett
no flags Details
canvas test extension, nicer. (7.67 KB, application/octet-stream)
2007-08-24 12:17 PDT, Florian Jenett
no flags Details

Description Florian Jenett 2007-08-14 03:40:44 PDT
User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3
Build Identifier: Thunderbird 2.x

working on an extension that needs to use canvas i realized that it's disabled in the standard distributions. after lot's of searching it turns out the only way to enable the canvas seems to have "enable-canvas" in the build options. building tbird yourself is not an option to most "normal" tbird users (my target group), so i suggest to add a way (code & preference) for developers and/or users to enable the canvas (and maybe even SVG) elements (XUL, html:canvas) on the fly.

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Comment 1 Phil Ringnalda (:philor) 2007-08-20 19:43:37 PDT
Doing it as a run-time pref wouldn't make any sense: we'd have to build and ship it, when the only reason I know of that it's disabled is to save the code bloat. But unless I failed to actually get it enabled when I was testing, for a Windows installer that code bloat looks like 11,472 bytes, which is insanely tiny for something that enables so much extension fun. I'll test again, and see how big it is in Mac and Linux, but that seems like a wonderful bargain for the size to me.
Comment 2 Phil Ringnalda (:philor) 2007-08-20 23:54:34 PDT
Created attachment 277501 [details] [diff] [review]
Turn it on

Well, I don't have a convenient test to be sure it's enabled, but I certainly think this should do, and it bloats the Win exe by around 11KB, the Linux tar.bz2 by around 15KB, and the poor Mac dmg by around 25KB. Still quite cheap.
Comment 3 Scott MacGregor 2007-08-21 14:00:24 PDT
When this gets turned on for Thunderbird, I think it would be really cool to prove that it works, by having someone copy what Firefox does when you visit a phishing site (http://www.mozilla.org/projects/bonecho/anti-phishing/its-a-trap.html) with a canvas element that dims the content area. In Firefox, that code happens roughly in here: 

http://mxr.mozilla.org/seamonkey/source/browser/components/safebrowsing/content/phishing-afterload-displayer.js#564

we can skip the warning overlay part and focus on just dimming the content pane... 

Comment 4 Phil Ringnalda (:philor) 2007-08-22 21:01:31 PDT
mail/confvars.sh 1.4
mail/installer/windows/packages-static 1.74

Florian, if you happen to feel like doing a super-simple extension that just verifies that canvas is enabled and working, that would be fantastic, since a canvas overlay dimming the content area in Thunderbird probably won't work on the trunk, just like Firefox trunk is stuck with their phishing overlay hiding behind their content browser right now.
Comment 5 Philip Chee 2007-08-23 08:14:45 PDT
I installed Thunderbrowse <http://thunderbrowse.com/> into version 3.0a1pre (2007082304) and then tried several SVG demos including <http://www.december.com/html/demo/hellosvg.html> but none of the <svg> elements were displayed.
Comment 6 Phil Ringnalda (:philor) 2007-08-23 11:27:17 PDT
Was there some reason you expected enabling canvas to enable SVG?

But, if I were inclined to verify my own bugs, I'd be tempted to verify it based on installing Thunderbrowse, enabling script, and seeing that http://developer.mozilla.org/samples/raycaster/RayCaster.html runs, since I doubt it'd be possible to have it working in content but not chrome.
Comment 7 Florian Jenett 2007-08-23 13:10:40 PDT
Created attachment 277942 [details]
super simple canvas enabled extension for thunderbird
Comment 8 Florian Jenett 2007-08-23 13:16:15 PDT
(In reply to comment #4)
> 
> Florian, if you happen to feel like doing a super-simple extension that just
> verifies that canvas is enabled and working, that would be fantastic, since a
> canvas overlay dimming the content area in Thunderbird probably won't work on
> the trunk, just like Firefox trunk is stuck with their phishing overlay hiding
> behind their content browser right now.
> 

since the bug got closed can i assume canvas is gonna be enabled by default in the future? if yes that's super great news to me!

simple canvas check extension attached. adds a status message: "html:canvas [enabled]" .. or ".. [not enabled]". if canvas is enabled it adds a html:canvas to the messageviewer showing a little green animation. let me know if it works for you ..

dimming? i never said anything about dimming ...
Comment 9 Joe Sabash [:JoeS1] 2007-08-23 16:30:22 PDT
(In reply to comment #6)
> Was there some reason you expected enabling canvas to enable SVG?
> 
> But, if I were inclined to verify my own bugs, I'd be tempted to verify it
> based on installing Thunderbrowse, enabling script, and seeing that
> http://developer.mozilla.org/samples/raycaster/RayCaster.html runs, since I
> doubt it'd be possible to have it working in content but not chrome.
> 
I don't think Thunderbrowse offers anything more than the method I choose.
Compose a message with:
iframe style="margin-left: 5%;" marginheight="0" marginwidth="0"
 src="http://developer.mozilla.org/samples/raycaster/RayCaster.html"
 width="800" frameborder="0" height="600"></iframe>

The canvas appears but the keys do not function.
Error console:
Warning: Key event not available on GTK2: key="a" modifiers="accel, shift"
Source File: chrome://messenger/content/messageWindow.xul
Line: 0

Comment 10 Phil Ringnalda (:philor) 2007-08-23 16:55:47 PDT
Keys WFM that way, too, for as long as I was willing to have javascript.allow.mailnews on, once I managed to click in a part of the iframe that gave it focus, or tabbed into the iframe, not just the message body.

But since my real goal was enabling canvas in chrome for extensions, rather than in how good a browser we could make our email client, I'll take Florian's extension, which works beautifully, thank you, as verification enough.
Comment 11 Florian Jenett 2007-08-24 12:17:30 PDT
Created attachment 278100 [details]
canvas test extension, nicer.

added a new version of my "super simple" test extension. it's a little nicer and has better mouse / key / resize event handling.
Comment 12 Ben Lerner 2007-10-20 12:30:01 PDT
Forgive me for sounding naive, but will this bug's fix land in TB2.0.0.8?  I'm working on an extension that would very happily use this ability of canvas-in-chrome, if it were there.  I'm trying to add a "thread arcs" visualization to the expandedHeaderView (see http://www.visophyte.org/examples/visterity/20071008-clicky/conv876.xml for an example, and http://www.research.ibm.com/remail/threadarcs.html for the source).  Could be fun, certainly a fun use of the drawing elements...  (BTW -- I wouldn't mind using SVG elements either -- and SVG might actually make the visualization work better, since it could be more easily interactive.)
Comment 13 Philip Chee 2007-10-20 12:41:49 PDT
> Forgive me for sounding naive, but will this bug's fix land in TB2.0.0.8?

No.

Note You need to log in before you can comment on or make changes to this bug.