May 28, 2008

Patch management between repositories?

Gecko 1.9 is nearly here, and I'm looking forward to it. But there's a catch... I have to make some fairly extensive changes to it, changes that will not live in the 1.9 repo on any branch. So I'm hoping a few people can point me to some nice freebie tools for applying patches in one repository to another repo's code, and keeping the patches up to date. Or for handling cross-repository (and for that matter, cross-repository-platform) patches in general.

(The concept I have is that, following the new XULRunner build system, my app's source would live in mozilla/verbosio - from a separate repository than the 1.9 code base.)

From my brief research, Mercurial Queues seems perfect for this - within Mercurial repositories anyway. Apparently, the 1.9 CVS stable branch will not be tracked in parallel on hg.mozilla.org after RC1 (grumble, grumble), so I'm not sure how MQ could be used in this scenario. Or I'd have to host the whole Moz code plus my project in hg, and do catch-up merges from CVS as new point releases come up. (If I go that route, I'll have to be super-nice to the mozdev folks and bribe them to set up and host a clone...)

Believe me, it's very little fun to try making two repo systems work together. The equivalents of CVS ignore are just the beginning of the pain.

Another question that comes to mind is: how do you make comments inside a GNU diff file? Do they support, like Perl does, a hash-begins-a-comment-line form of commenting, at least between files? That would make it easier for me to document these patches I'd keep.

I'm also hoping someone will take the time to publish a Mercurial guide in hardcopy. I really appreciate William Nagel's "Subversion Version Control" -- it's much easier to understand than http://svnbook.red-bean.com/.

I can probably write some simple Perl code to apply the patches as I just mentioned, but maintenance is another issue. Please advise.

Posted by WeirdAl at 5:33 PM | Comments (5)

March 20, 2008

Verbosio: Coming out of hibernation

Over the last several weeks, I've been having this gnawing urge to restart work on Verbosio. It's been getting stronger, to the point where I just can't keep quiet about it: I'm getting back into it, and looking forward to completing my work on an 0.1 "proof-of-concept" XML editor.

Since I put Verbosio to sleep several months ago, I've had a number of thoughts:

  • I want to use the new Songbird-provided build system. I've played around with it a few times since it first arrived, and I'm pleased. This makes it much easier to compile a specific XULRunner-based application, using Mozilla's own build system.
  • I've gotten much more comfortable working with C++ code. When I started work on Verbosio, I had a goal that said "no compiling necessary." That was because I didn't want to muck around too much. The new build system - and a couple years experience - obsoletes that requirement, in my opinion. Besides, I still anticipate that I might have to customize Gecko a little bit. Hopefully not that much.
  • CVS would make me pay dearly for my earlier decisions. Because of the above two points, I want to rearrange Verbosio's source code to take advantage of the build infrastructure Mozilla already provides. That means a lot of files and directories moving. In CVS, that means you lose all revision history. No thanks. Fortunately, SVN is coming, and supposedly soon. I am looking forward to it.
  • Writing to ZIP files changes the game. nsIZipWriter means that Verbosio, in its XUL demo work, could start working with jarred chrome for real. Fun times.
  • Bit rot has been surprisingly minimal. Code that I wrote many moons ago still works, at least in Gecko 1.9 beta 5. There was a regression in 1.9b4 that has since been fixed.
  • Waiting for OpenKomodo was a bit of a mistake. I figured by now they would be on the 1.9 code base, which Verbosio requires. Also, I haven't reached "proof-of-concept", that working model that lays the foundation for any possible merging or sharing of code. I need to move forward without them, for the time being.
  • I still have ideas to explore. In addition to this list, I've had a couple more ideas that might be useful. For instance, I've seen myself working with DOM TreeWalkers, where the NodeFilter is wholly implemented in JavaScript. Wouldn't it be nicer, perf-wise, if you could have the first half of the filter implemented as a common C++ object (running ten times faster than JS code, thanks)?
  • I hope I can find the time and the motivation, again. It's been hard, yes, but I've learned a bit about myself. These days, I can usually find the drive to work on side projects one, maybe two days a week. Yet these side projects are what keep my skills and ability to create, to innovate, at the sharpest levels. That's when this business of software development is most fun: creating something new, useful, and radical. It also fires me up when it comes to my day job - I've noticed that my biggest ideas for work come to me either during or soon after a bit of heavy-duty cogitation on something Mozilla, but not Skyfire. I can't explain it, but it works.

Ultimately, I'm still not sure of where this Verbosio project will take me - or where I'll take it. But I take heart in the fact that I still don't see anyone doing anything remotely like what I have in mind for Verbosio. Sure, it's hard to do (as I've said before), but I have a vision, and that makes the years of effort worthwhile.

Thanks for reading!

Posted by WeirdAl at 8:04 PM | Comments (1)

September 6, 2007

Verbosio goes on hiatus

With OpenKomodo coming, I think I should really put Verbosio on hold for the moment. Komodo's capabilities bring so much to the table that I'd be a fool not to look at moving much of Verbosio's infrastructure over to Komodo instead of XULRunner. This means learning another platform (not as much fun as you might think), seeing what API's I can benefit from, and what I can contribute back. Making sure OpenKomodo works on trunk XULRunner will probably be one of my main goals (since Verbosio uses several trunk features).

I am really quite pleased to hear this. It's the kind of thing I'd want to throw a party for. I've been a big fan of ActiveState's Komodo work ever since I was introduced to it at OSCON 2002. I kept thinking, "I want that!" Now, ActiveState is saying, "Here you go." You just can't beat that.

Verbosio's on de facto hold anyway, as I've (once again) bitten off more than I can chew. If I could find a couple days uninterrupted, I'd be able to finish off the next piece of UI for it...

Nine days to Mozilla 24! Too bad we only get nine hours at the Stanford hall... anyone interested in hosting and/or joining me during the other fifteen for a hackathon?

Posted by WeirdAl at 6:24 PM | Comments (1)

August 16, 2007

Innocence (of scripting) lost

For the last few months, I've been doing Verbosio development based on Mozilla milestones (as opposed to the trunk). Each of the last few milestones has brought a change which impacted Verbosio. I didn't spot any for 1.9a7, and I thought the migration would be nearly painless.

There was a change impacting Verbosio - and depending on the point of view, the result is either trivial or damaging.

Several months ago, I blogged about XPCOM class invariants for JavaScript - using the nsIScriptableInterfaceInfo interface. The code for this interface lives in extensions/webservices... which was shut off with SOAP. Oops.

I filed bug 392004 to resurrect it, but even as I do this, I realize there's not much use for having it on by default. (Otherwise, people would have complained about it much, much sooner.) Sure, it benefits me, but between one developer's convenience and millions of users's Firefox installs, a few extra kilobytes are expendable. Even for XULRunner 1.9, I expect it would be a tough sell.

The simplest solution, of course, is to disable the invariant contracts when they can't be built. I should've done that in the first place. Invariants, though, add valuable sanity checks. So to get them back, I have to compile the scriptable interface info code as part of Verbosio.

There, I said it: "compile". With that one word, I have overshadowed one of those little goals I had for Verbosio from the beginning: that you could take an unmodified XULRunner and run Verbosio. It's ironic, considering Benjamin Smedberg quietly taught Firefox how to run XULRunner apps like Verbosio - and thus expanded the potential user base by a factor of five thousand. (I meant to blog about that in particular.)

Naturally, I can ship the necessary .dll, .so or .dylib files with Verbosio - just pre-compile them. By all rights, I should. I'm not sure if I can ship a DLL file compiled from Visual C++ Express, though - which means spending a few bucks getting Visual Studio.

I have only myself to blame for all this - not just for relying on an extension, but for not planning for C++ code to enter the picture. Sure, it sounds like a lot, considering this is for debug-only code. As a developer, though, I like having as much debug code on as I can get while I'm crafting the app. Live and learn...

Posted by WeirdAl at 7:25 PM | Comments (5)

July 19, 2007

QAFound: Reducing testcases (follow-up)

I figured out the cause of my major woes tonight: bug 388267. I have a workaround, so I'm back to hacking on Verbosio's trunk.

Also, our good friend Boris Zbarsky lent a hand debugging bug 388254, which is really very noisy in Verbosio. We believe that bug 388255 is a direct result of it, too. As for bug 388264, that is likely a duplicate bug, but no one's checked that yet.

That accounts for all the bugs I filed as a result of my Verbosio snapshot a few days ago. I'm a happy coder.

Though also a bit lazy:

WeirdAl		is not at all excited about hacking layout...
		"you touch it, you own it" and all that, you know
		WeirdAl: the other side is "you don't touch it, it stays broken" :)
		hehe
ajschult	typically prefers not-broken
Posted by WeirdAl at 8:46 PM

July 15, 2007

Verbosio: First Look

There's an old saying in the open-source community: "Release early, release often." I confess now that with Verbosio, my prototype for an extensible XML editor, I've done neither. I have put two years into it, and I have little to show for it - just some nice screenshots.

Until today.

A few days ago, I asked for help reducing testcases. Jesse Ruderman pointed out that I hadn't given anybody a real testcase to reduce. Neil Rashbrook pointed out in response that Verbosio was too big for Bugzilla. In essence, both were right.

So I spent the last two days re-arranging the Verbosio repository, in order to provide a "snapshot" of Verbosio which people could reference in Bugzilla. It goes beyond that, however: it's also a snapshot of the Verbosio code base which anyone with a XULRunner build (1.9a6 or trunk) can experiment with. It's not just for filing bugs against Gecko, in other words.

It's a chance to look inside my head, and see a piece of the vision I've been dreaming up for two years. It's a chance to actually play with Verbosio, and see where it's going.

Right now, it sucks, bad enough for me to say on the installation page:

This "snapshot" is specifically for Mozilla developers in order to debug several problems which the author believes are not the fault of his application (NS_ASSERTION failures, weird XUL deck behaviors, etc.). If you are using Verbosio for any other purpose, be aware that it can do nasty things to edited files, computer performance, and your grandparents. Use this snapshot with extreme caution. You have been warned.

However, I suppose that as software projects go with initial source package releases, I'm in pretty good company. Netscape, I remember hearing, had a really ugly package for their Communicator 5.0 initial source release. Lots of other projects put out code that's nowhere near ready for general use, with lots of incomplete features just waiting to shock users.

So, to get you started in Verbosio (if you're daring enough), try the following steps.

  1. Get a XULRunner package (trunk or 1.9a6).
  2. Download the gzipped tarball (approx. 1 MB) from Verbosio's installation page. (Note: it may not be on all the mirrors yet - it should be there in less than 24 hours.)
  3. Unzip and untar the tarball (after a virus and spyware scan - you don't trust me that much, do you?)
  4. Run the application. Use the "default" application, not the "testing" application.
  5. When it's running, go to Verbosio -> Open testing verbosio.xul. Watch Verbosio load a copy of itself (from the "testing" subdirectory) into its tabbed editing space. (Note: There's a bug I haven't figured out yet with Verbosio on the Mac platform, involving symlinks, which prevents you from doing this. Sorry.)
  6. Play with it to your heart's content. As long as you don't try to edit (opening up is okay) any other XULRunner applications or Firefox/Gecko-based XUL extensions with Verbosio, you should be pretty safe. The "testing" subdirectory application is disposable - you can get a fresh copy from the tarball at any time.

Several of the features:

These are just what's visible to the user. There's a lot of infrastructure too (ECMAScript design by contract, automated tests, support for extensions without conflicts of variable names, virtual files, a markup language for XML templates, DTD and entity management, undo/redo support including DOM operations, base URI mappings for starters).

Finally, the snapshot you see is on a branch (0.1a1pre.0.*), while the trunk is on a different line (0.1a1pre.1.* right now). That way, the branch itself can remain relatively static, and be a good reference for others. Also, the branch will work with any XULRunner build 1.9a6 or later (meaning 1.9a7, 1.9b1, 1.9, 1.9.1, etc.), while the trunk will remain based on a single milestone at a time (1.9a6 currently), so that I can work with an unchanging XR base. (In other words, the stable branch will tie to an evolving XULRunner, and the evolving trunk will tie to a stable XULRunner.)

This tarball and its contents are available under MPL 1.1 / GPL 2.0+ / LGPL 2.1+. Change log in the extended entry.

2007-07-15 23:10  ajvincent

	* verbosio/src/core/content/appOverlay.js: Merge from
	  SNAPSHOT_20070713_BRANCH: The app.* fields in
	  chrome://verbosio/content/app.properties has been removed; update
	  chrome://verbosio/content/appOverlay.js to cope.

2007-07-15 21:56  ajvincent

	* verbosio/www/installation.html: Point users to 0.1a1pre.0.6
	  tarball.

2007-07-15 19:35  ajvincent

	* verbosio/: README,
	  downloads/snapshots/branch_20070713_tag_006.tar.gz: Add
	  SNAPSHOT_20070713_TAG_006 object directory tarball to Verbosio
	  downloads.

2007-07-15 19:33  ajvincent

	* verbosio/src/core/VER_LAST: Bump version for
	  SNAPSHOT_20070713_BRANCH to 0.1a1pre.0.7.

2007-07-15 19:31  ajvincent

	* verbosio/src/core/VER_LAST: Move Verbosio version to 0.1a1pre.0.6
	  for SNAPSHOT_20070713_TAG_006 tag.  Branch will leap ahead to
	  0.1a1pre.0.7.  This will keep future tags in synch with their
	  version numbers.

2007-07-15 19:25  ajvincent

	* verbosio/src/core/content/templateFrame.xul: Simplify
	  templateFrame.xul in order to show deck layout bug more clearly.

2007-07-15 18:20  ajvincent

	* verbosio/README: Fix version numbers inside README for the
	  Verbosio project.

2007-07-15 18:19  ajvincent

	* verbosio/README: Update README file for the Verbosio project to
	  reflect the SNAPSHOT_20070713_TAG_005 tag.

2007-07-15 18:14  ajvincent

	* verbosio/src/core/VER_LAST: Bump version for
	  SNAPSHOT_20070713_BRANCH to 0.1a1pre.0.5.

2007-07-15 18:12  ajvincent

	* verbosio/downloads/snapshots/branch_20070713_tag_005.tar.gz: Add
	  SNAPSHOT_20070713_TAG_005 object directory tarball to Verbosio
	  downloads.

2007-07-15 18:01  ajvincent

	* verbosio/src/core/content/appOverlay.js: The app.* fields in
	  chrome://verbosio/content/app.properties has been removed; update
	  chrome://verbosio/content/appOverlay.js to cope.

2007-07-15 17:28  ajvincent

	* verbosio/src/: make-project.pl, core/components/xeTestEngine.js:
	  Landing from SNAPSHOT_20070713_BRANCH branch:  Remove the need
	  for filesystem-specific directories in
	  chrome://verbosio/content/app.properties bundle.  (Dated Mon Jul
	  16 00:08:26 2007 UTC.)

2007-07-15 17:22  ajvincent

	* verbosio/README: Fix the date on the README file.

2007-07-15 17:19  ajvincent

	* verbosio/README: Update README file for the Verbosio project to
	  reflect the SNAPSHOT_20070713_TAG_004 tag.

2007-07-15 17:16  ajvincent

	* verbosio/downloads/snapshots/branch_20070713_tag_004.tar.gz: Add
	  SNAPSHOT_20070713_TAG_004 object directory tarball to Verbosio
	  downloads.

2007-07-15 17:14  ajvincent

	* verbosio/src/core/VER_LAST: Bump version for
	  SNAPSHOT_20070713_BRANCH to 0.1a1pre.0.4.

2007-07-15 17:08  ajvincent

	* verbosio/src/: make-project.pl, core/components/xeTestEngine.js:
	  Remove the need for filesystem-specific directories in
	  chrome://verbosio/content/app.properties bundle.

2007-07-13 20:50  ajvincent

	* verbosio/www/installation.html: Emphasize in installation page
	  that currently XULRunner is not packaged with the snapshot
	  tarball.

2007-07-13 20:36  ajvincent

	* verbosio/README: Update README file for the Verbosio project to
	  reflect the actual SNAPSHOT_20070713_BRANCH,
	  SNAPSHOT_20070713_TAG_003 tags.

2007-07-13 20:35  ajvincent

	* verbosio/www/installation.html: Post a link to
	  SNAPSHOT_20070713_TAG_003 gzipped tarball on installation page.

2007-07-13 20:25  ajvincent

	* verbosio/src/core/VER_LAST: Bump version for
	  SNAPSHOT_20070713_BRANCH to 0.1a1pre.0.3.

2007-07-13 20:19  ajvincent

	* verbosio/downloads/snapshots/branch_20070713_tag_003.tar.gz: Add
	  SNAPSHOT_20070713_TAG_003 object directory tarball to Verbosio
	  downloads.

2007-07-13 20:06  ajvincent

	* verbosio/src/make-project.pl: Another change to 20070713 snapshot
	  branch:  Remove compileIDL.pl, backport.pl, run_verbosio.sh from
	  the build process.

2007-07-13 19:49  ajvincent

	* verbosio/src/core/VER_LAST: Bump version for
	  SNAPSHOT_20070713_BRANCH to 0.1a1pre.0.2.

2007-07-13 19:40  ajvincent

	* verbosio/src/core/application.ini.in: Bump MaxVersion for
	  applicatio.ini.in to 1.9.*, so that others on trunk XULRunner can
	  examine the branch.

2007-07-13 19:38  ajvincent

	* verbosio/src/core/VER_LAST: Bump VER_LAST for Verbosio
	  application to 0.1a1pre.1.0.

2007-07-13 19:14  ajvincent

	* verbosio/src/core/VER_LAST: Bump version for
	  SNAPSHOT_20070713_BRANCH to 0.1a1pre.0.1.

2007-07-13 18:34  ajvincent

	* verbosio/: README, src/code-languages/css/install.rdf.in,
	  src/code-languages/javascript/install.rdf.in,
	  src/document-packs/xul-application/install.rdf.in,
	  src/generic-viewers/inspector/install.rdf.in,
	  src/generic-viewers/preview-edit/install.rdf.in,
	  src/generic-viewers/source-edit/install.rdf.in,
	  src/markup-languages/xul/install.rdf.in,
	  src/pack-viewers/chrome-contents/install.rdf.in,
	  src/pack-viewers/dir-contents/install.rdf.in,
	  src/xpathgen/install.rdf.in, src/core/VER_LAST: Move Verbosio
	  executable to version 0.1a1pre.0.0, in preparation for snapshot
	  branch.

2007-07-10 07:48  ajvincent

	* verbosio/src/core/application.ini.in: Move Verbosio's required
	  XULRunner to version 1.9a6.

2007-07-10 07:48  ajvincent

	* verbosio/src/core/content/verbosio.js: Fix error with closing
	  Verbosio and not having opened a document pack.

2007-07-10 07:47  ajvincent

	* verbosio/src/core/: components/documentFile.js,
	  components/entityManager.js, components/nodePositionService.js,
	  components/templateXTF.js, components/textDocumentWrapper.js,
	  components/verbosio-utils.js, components/virtualProtocol.js,
	  components/xeBaseURIMap.js, components/xeFileSearch.js,
	  components/xeTestEngine.js, content/templateWizard.js: Gecko
	  1.9a6 prep:  load components from resource://app/modules/,
	  resource://gre/modules/.  Update calls on XPCOMUtils.

2007-07-10 07:43  ajvincent

	* verbosio/src/core/modules/ArrayConverter.jsm: Gecko 1.9a6 prep:
	  Update ArrayConverter.jsm docs to reflect the new world order.

2007-07-10 07:42  ajvincent

	* verbosio/src/core/modules/XPCOMUtils.jsm: Gecko 1.9a6 prep:  Add
	  modification for XPCOMUtils.jsm module, which will wrap a
	  singleton component object for XPCOMUtils.

2007-07-10 07:41  ajvincent

	* verbosio/src/make-project.pl: Gecko 1.9a6 prep:  Stop copying
	  modules into the components directory.

2007-06-17 20:00  ajvincent

	* verbosio/src/core/: content/templateWizard.js,
	  content/templateWizard.xul,
	  locale/en-US/verbosio/templateWizard.dtd: Not part of the build
	  (yet) for template creation wizard.  Add user-interface for
	  disabling text inputs, setting markup:xpath attributes as needed,
	  and keeping everything synchronized.	Note this check-in requires
	  mozilla.org bug 209555 be patched.

2007-06-17 19:52  ajvincent

	* verbosio/src/core/: components/verbosio-utils.js,
	  idl/xeIVerbosioUtilsService.idl: Break up
	  xeIVerbosioUtilsService.getSupportingTemplates() into two
	  functions; the first becomes
	  xeIVerbosioUtilsService.getTemplateDocument().

2007-06-17 19:48  ajvincent

	* verbosio/src/core/: components/templateXTF.js,
	  idl/xeIMarkupLanguage.idl: Add method for 
	  elements to publicly match a UI node to the corresponding output
	  node.

2007-06-17 01:31  ajvincent

	* verbosio/src/core/: content/template.css,
	  content/templateFrame.css, content/templateWizard.js,
	  content/templateWizard.xul, content/bindings/template.xml,
	  locale/en-US/verbosio/templateWizard.dtd,
	  skin/verbosio/templateFrame.css: Check in mockup of template
	  builder wizard UI.  Note this is not yet functional, and not part
	  of the app.  It also needs a lot more comments and a thorough
	  code review.
Posted by WeirdAl at 10:15 PM | Comments (2)

July 12, 2007

QAWanted: Reducing testcases

I've gotten myself in a real pickle now. In writing this XULRunner app, Verbosio, I've ignored assertions, worked around oddities, but now I'm essentially blocked due to an obscure layout bug.

Essentially, I have a XUL deck, and what that deck is reporting as its selected panel is in fact not what the user sees.

Obviously, I should report it to Bugzilla. Except that I have no idea how to produce a testcase that will show the same results in Firefox 3.0 alpha 6 (the equivalent milestone). A bug that cannot be reproduced by a separate person is essentially INVALID, WONTFIX, and INCOMPLETE.

There are exceptions, but they require an exceptionally dedicated hacker (thanks, bz!!!).

So I am putting out a call for help. I need a few people who are willing to spend volunteer hours taking a look at these weird behaviors and trying to reduce them to manageable testcases which can be reproduced in Firefox 3 or XULRunner, either trunk or alpha 6. Once you've got such a testcase, please file a bug on it and cc me. If the bug is in Verbosio's code, use Mozdev's Bugzilla - otherwise, use mozilla.org's Bugzilla. (You may find that both are doing something wrong in the same area, which wouldn't surprise me.) I'm available weeknights and weekends, Pacific time zone.

If you are willing to do so, please leave a comment on this blog entry. I'll gladly walk you through the process of reproducing these bugs in Verbosio (including building and running Verbosio). You'll need a XULRunner build, 1.9a6 or trunk, probably a debug build - and that means compiling your own. You'll also be getting your hands dirty with delta debugging in XUL.

I think the only reward you'll get for reducing the testcases and filing the bugs is an "attaboy" from various people in the Mozilla community. That, and having your testcase added to Mozilla's regression test harnesses, probably as a reftest. (For those near San Jose, California, it'll probably also mean a free meal.)

UPDATE: I'm going to work tonight on putting out a "snapshot" nightly so that no one will have to run Verbosio's make process. Then all you'll need is a XULRunner debug build. News at eleven.

UPDATE 2: I've posted a gzipped tarball snapshot to Verbosio's downloads directory. It'll take a few hours for the tarball to propagate to the mirrors, but the instructions for grabbing it are here.

Posted by WeirdAl at 10:50 PM | Comments (2)

June 29, 2007

Ah, licensing...

So, the big news of the day for the open-source world (and largely cast to the side by Mozillians from my reading) is the release of the General Public License, version 3. One of the unanswered questions I have been thinking about is: "Should I upgrade Verbosio's boilerplates to reflect a minimum GPL version of 3? Or should I leave it at 2 or later?" The consensus from the mozilla.org community so far has been this isn't necessary. (Largely lost in the news was the release of the Lesser General Public License, version 3.)

This has some implications to think about, though.

The standard boilerplate for MPL/LGPL/GPL multi-licensed code says, and I quote:

Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or the GNU Lesser General Public License Version 2.1 or later (the "LGPL")...

This essentially means there are now at least five different license versions which Verbosio (and by implication, most of Mozilla) code is available under: MPL 1.1, GPL 2.0, LGPL 2.1, GPL 3.0, LGPL 3.0. I'm not entirely sure what that leads to for my project.

There's another point that I should mention here. One of my ideas for Verbosio is to include the GNU diffutils and Subversion software, integrated into Verbosio natively as XPCOM components. However, with licensing issues, I'm not sure I can do that.

The diffutils package is GPL only, version 2+. As timeless pointed out to me recently, the MPL license itself is not compatible with GPL (but does allow GPL as a parallel license). As for Subversion, well, it's under a Collabnet license which - since I'm not a lawyer and I don't want to think about it - I don't know if it's GPL-compatible. (Subversion's Wikipedia article currently claims it's under the Apache license in the sidebar.)

So the way I read it, I could release Verbosio with diffutils under GPL - but not under MPL or LGPL (with diffutils under LGPL). With Subversion thrown in, I just don't know.

This could be a problem later on down the road, if someone wants to build a non-GPL application based on Verbosio. But that's an old story, isn't it?

Please, no holy wars over which license is better. I'd be happy if someone could analyze Subversion's license and tell me if it's compatible. Similarly I'd like to know if someone knew of a MPL- or LGPL-compatible diff / patch utilities package. I very much doubt everyone contributing to diffutils would willingly reclassify it under LGPL or MPL just for me.

UPDATE: I think I figured out a workaround for license incompatibilities. Namely, a license applies to what you ship in a single package. Extensions can come in their own packages, and thus with their own licenses. So for incompatible licenses, if I offer the new functionality as extensions (but not part of the main download), I can still comply with the licenses for everyone. (A key distinction is that the extension shouldn't be something the main package or other packages with incompatible licenses depend on. Otherwise, it's not really an extension or an external package, and the licenses are forced to work together where they can't.)

I'll have to be a little careful about how I arrange my repository, but this could be a workable solution. Please offer your professional opinions on this.

Posted by WeirdAl at 3:30 PM | Comments (4)

June 17, 2007

Verbosio progress, 06/17/2007

A few days ago, Benjamin Smedberg astutely summarized his thoughts on a XUL IDE: "I like this dialog, steal it". Now, that wasn't the point of his blog entry, but it did leap out at me.

You see, I've been talking for over two years now about Verbosio. In particular, I've been talking about this markup template system, and how you could build markup templates for Verbosio in Verbosio, etc., etc., etc. But I never found a nice, short way to describe what my intent was, until Benjamin (accidentally, and without his knowledge) did it for me.

Verbosio's markup template system is all about "stealing" code.

Now, I want to be clear: I don't mean stealing code in the sense of taking someone's copyrighted works without their permission. You should never use any editing tool to plagiarize someone else's work. For XML documents under an open-source license, however (MPL/LGPL/GPL, anyone?), it's fair game. Besides, by the time you're done creating a template, it's highly unlikely the template will more closely resemble the original than it would resemble any other similar piece of code.

Below are a couple of screenshots of a wizard I'm building. This wizard will let you take a fragment of XML written in a given XML language (in this case, XUL), and transform it into a Verbosio markup template. The template (specifically, its user interface) appears in the upper-right corner of the wizard. The upper-left corner lets you select nodes to edit for the template. The bottom panel is where you would set up the attributes and text contents of the template.

createWizard-pt1.PNG

createWizard-pt2.PNG

You can accuse me of building a really bad user-interface in this wizard, and I would accept that criticism without shame. My goal here is to build something that works, for a proof-of-concept release. I'm still working on this wizard, to be honest. But here I've accomplished the hard part: taking a minimalist XUL element (<xul:button/>), and building a template for that XUL element. A few dump() statements in the background show the template even works - you can change the button within the template. (Don't knock me on the attribute name column - it's a placeholder for real namespace-aware attributes.)

Now I have to integrate the above functionality (which took me at least two days of code on this alone, and several weeks of design speculation) into Verbosio's core, and create a complete path from unknown element to new element template. That's coming, hopefully by the end of the week.

Posted by WeirdAl at 7:07 PM

June 10, 2007

Verbosio progress, 06/10/2007

I keep telling myself I'm two to three weeks away from a proof-of-concept release. Unfortunately, finding those weeks is proving very difficult. Hence, not much outward progress on Verbosio lately.

Just a way you can edit DTD entities with the XML you're also editing!

It also is a little dynamic:

Finally, the changes you're making don't apply until you hit the "OK" button. If you then open up the DTD document, you'll see the DTD itself also has the new value:

I had originally written this so the DTD entity would be exposed beneath the attribute value, so you could change the DTD name and value by independent textboxes. One glance at that user interface told me it wasn't going to work - it was going to be non-obvious. So I redesigned it from scratch. The "goalposts" you see in these images are actually SVG markup, living anonymously within a XBL binding on a <markup:entity-box/> element inside a XUL document. That's four different XML languages, plus JavaScript - one of those languages being a graphics language - all working together to give an unique look and feel which I hope is intuitive. XULRunner 1.9a5 just smiles at this and says, "More, please."

The effects aren't perfect, and neither is the implementation. For instance, if you type into the textbox something larger than the textbox's visual size, the goalposts move outside the textbox's horizontal boundaries. Also, actually committing the changes (clicking "Ok") does far more DOM operations than are strictly necessary. Here, all that Verbosio should need to do is a few attribute modifications, but in reality it also does node insertions and removals. So the code, while functional, needs some optimization.

The change log, as usual, is in the extended entry.

2007-06-10 08:19  ajvincent

	* verbosio/www/screenshots.html: Add images for June 10, 2007 to
	  screenshots page.

2007-06-10 08:15  ajvincent

	* verbosio/www/images/Jun10_2007/: showDTDEntity.png,
	  showDTDEntity_thumb.png: Fix screenshots showing the DTD entity
	  for the first time.

2007-06-10 08:07  ajvincent

	* verbosio/www/screenshots.html: Switch screenshots.html to using
	  thumbnails for April 26, 2007.

2007-06-10 08:05  ajvincent

	* verbosio/www/images/: Apr26_2007/menuitemEdit_thumb.png,
	  Apr26_2007/previewPanel_thumb.png, Jun10_2007/dtdUpdated.png,
	  Jun10_2007/dtdUpdated_thumb.png, Jun10_2007/editDTDEntity.png,
	  Jun10_2007/editDTDEntity_thumb.png, Jun10_2007/itemEdit.png,
	  Jun10_2007/itemEdit_thumb.png, Jun10_2007/showDTDEntity.png,
	  Jun10_2007/showDTDEntity_thumb.png: Add new screenshots and
	  thumbnails for June 10, 2007.  Add thumbnails for April 26, 2007.

2007-06-10 02:00  ajvincent

	*
	  verbosio/src/generic-viewers/preview-edit/content/preview-edit.js:
	  Teach preview document viewer how to react to mutation DOM events
	  from the master document.

2007-06-10 01:52  ajvincent

	* verbosio/src/core/content/verbosio.js: Register added wrappers
	  with the mutation event registry.

2007-06-10 01:51  ajvincent

	* verbosio/src/xpathgen/components/nsXPathGenerator.js: Post new
	  XPathGenerator component (from bug 319768 @
	  bugzilla.mozilla.org).  Not an exact copy, but close enough.

2007-06-10 01:49  ajvincent

	* verbosio/src/core/components/entityManager.js: Convert assertion
	  (possibly bogus) to warning; editing DTD entities seems to work
	  without the assertion.

2007-06-10 01:47  ajvincent

	* verbosio/src/core/content/tools/mutationEvents.js: Remove unused
	  eventSubtreeModifiedDispatcher for mutationEventRegistry.  Update
	  mutationEventRegistry to reflect current API (gDocumentPack
	  instead of unused documentRegistry).	Add new
	  mutationEventNotifier to notify document viewers of mutation
	  events.

2007-06-10 01:44  ajvincent

	* verbosio/src/core/content/bindings/verbosio.xml: Remove some
	  excessively noisy dump statements.

2007-06-09 18:35  ajvincent

	* verbosio/src/core/components/templateXTF.js: Update the template
	  when the user types something into a textbox.

2007-06-09 18:27  ajvincent

	* verbosio/src/core/content/verbosio.js: Fix API change on
	  txnDispatcher.executeListeners:  gDocumentPack owns the
	  transaction manager, not individual document wrappers.

2007-06-09 18:25  ajvincent

	* verbosio/src/core/content/templateFrame.xul: Fix assertions for
	  scope not having a Components property.'

2007-06-09 18:23  ajvincent

	* verbosio/src/core/components/documentFile.js: Back out part of
	  documentFile.js rev 1.14, as it broke support for Windows.

2007-06-09 16:57  ajvincent

	* verbosio/src/core/app-resources/ecma-debug.js: Fix minor
	  regression with warn() calls.

2007-06-09 16:47  ajvincent

	* verbosio/src/core/content/templateFrame.xul: Add commands for
	  accepting and canceling a template's changes.

2007-06-09 16:46  ajvincent

	* verbosio/src/core/content/tools/xeTransactionCommon.js: Add an
	  entity change action for recorded transactions.

2007-06-09 16:45  ajvincent

	* verbosio/src/core/components/entityManager.js: Track the owner
	  node of an entity through clones.  Also, update each attribute
	  only once.

2007-06-09 16:43  ajvincent

	* verbosio/src/core/: components/templateXTF.js,
	  idl/xeIMarkupLanguage.idl: Implement exporting of document
	  fragments from an edited markup template.  These fragments will
	  replace the original node they edit.

2007-06-09 16:42  ajvincent

	* verbosio/src/core/content/verbosio.js: The verbosio.advanceTxn()
	  call should not need a xeIDocumentWrapper argument.

2007-06-03 22:58  ajvincent

	* verbosio/src/core/components/xeBaseURIMap.js: Kill Windows
	  newline characters.

2007-06-03 22:57  ajvincent

	* verbosio/src/backport.pl.in: As module files currently live in
	  the components directory, copy them to the modules directory
	  before backporting to srcdir.

2007-06-03 22:52  ajvincent

	* verbosio/src/core/components/: nodePositionService.js,
	  templateXTF.js, textDocumentWrapper.js, verbosio-utils.js,
	  virtualProtocol.js, xeBaseURIMap.js, xeFileSearch.js,
	  xeTestEngine.js: Code redux:	Use XPCOMUtils.jsm,
	  ArrayConverter.jsm, ecma-debug.jsm, XMLValidator.jsm modules, and
	  drop a lot of redundant code as a result.

2007-06-03 22:48  ajvincent

	* verbosio/src/core/components/xblLanguagePack.js: Strict warning
	  fix:	lose a trailing comma.

2007-06-03 21:32  ajvincent

	* verbosio/src/core/components/verbosioEditor.js: Kill
	  verbosioEditor.js - the transaction that originally needed it
	  turned out to be unnecessary.

2007-06-03 17:27  ajvincent

	* verbosio/src/core/components/entityManager.js: Code redux:  Use
	  XPCOMUtils.jsm, ArrayConverter.jsm, ecma-debug.jsm,
	  XMLValidate.jsm modules for entityManager.js.

2007-06-03 17:26  ajvincent

	* verbosio/src/core/modules/ecma-debug.jsm: ECMA Debug module
	  clean-up.

2007-06-03 17:25  ajvincent

	* verbosio/src/core/modules/XMLValidator.jsm: Don't dump the
	  JavaScript stack for XMLValidator.validate() failures.

2007-06-03 16:47  ajvincent

	* verbosio/src/core/: components/documentFile.js,
	  modules/XMLValidator.jsm: Code redux:  Add XMLValidator
	  JavaScript module.  Use XMLValidator.jsm for documentFile.js.

2007-06-03 16:26  ajvincent

	* verbosio/src/core/modules/ArrayConverter.jsm: Add
	  ArrayConverter.jsm (from
	  https://bugzilla.mozilla.org/show_bug.cgi?id=380839 patch v1.1)

2007-06-03 16:18  ajvincent

	* verbosio/src/core/components/documentFile.js: Code redux:  use
	  ecma-debug.jsm for documentFile.js

2007-06-03 16:11  ajvincent

	* verbosio/src/: backport.pl.in, make-project.pl: Add support for
	  Verbosio JS modules to the build process.

2007-06-03 15:47  ajvincent

	* verbosio/src/core/modules/: ecma-debug.js, ecma-debug.jsm: Copy
	  verbosio/src/core/app-resources/ecma-debug.js rev 1.3 to
	  verbosio/src/core/modules/ecma-debug.jsm rev 1.1.

2007-06-03 15:46  ajvincent

	* verbosio/src/core/modules/ecma-debug.js: Copy
	  verbosio/src/core/app-resources/ecma-debug.js rev 1.3 to
	  verbosio/src/core/modules/ecma-debug.js rev 1.1.

2007-06-03 15:43  ajvincent

	* verbosio/src/core/app-resources/ecma-debug.js: Adjust
	  ecma-debug.js script in preparation for module import.

2007-06-03 15:30  ajvincent

	* verbosio/src/core/components/documentFile.js: Code redux:  use
	  XPCOMUtils.jsm for module code, documentFile.js

2007-06-02 23:27  ajvincent

	* verbosio/src/core/application.ini.in: Move Verbosio requirements
	  for base platform to XULRunner 1.9a5.

2007-06-01 22:07  ajvincent

	* verbosio/src/core/components/templateXTF.js: Remove
	  handleDefault() from templateXTF, as a result of mozilla.org bug
	  378247 being fixed.

2007-06-01 22:06  ajvincent

	* verbosio/src/core/idl/xeIDTDWrapper.idl: Code style change:
	  arguments for methods should be on different lines.

2007-06-01 22:06  ajvincent

	* verbosio/src/code-languages/css/components/css-document.js:
	  Factor out a couple more interfaces we know the CSS document
	  wrapper does not support.

2007-06-01 22:04  ajvincent

	* verbosio/src/: core/components/DTDDocumentWrapper.js,
	  core/components/entityManager.js,
	  core/components/xeTestEngine.js, core/idl/xeIEntityManager.idl,
	  document-packs/xul-application/components/xul-application.js: Add
	  support for changing the value of a DTD entity, and updating the
	  XML documents that entity affects.

2007-06-01 21:45  ajvincent

	* verbosio/src/core/idl/xeITransaction.idl: Drop
	  getAffectedWrappers() method; we're not doing validation work in
	  0.1a1.

2007-05-28 14:32  ajvincent

	* verbosio/src/core/content/verbosio.js: Remove the transaction
	  control object from verbosio.js.

2007-05-28 08:59  ajvincent

	* verbosio/src/core/components/xeTestEngine.js: Remove dead
	  testcase, and check caught errors a little more carefully.

2007-05-28 08:58  ajvincent

	* verbosio/src/: core/content/template.css,
	  generic-viewers/preview-edit/content/preview-edit.js: Move some
	  styling of markup template UI's around - most notably
	  overflow:scroll should belong to the  element.

2007-05-28 08:56  ajvincent

	* verbosio/src/core/components/documentFile.js: Add some
	  assertions, and bail out if we try to load a jarred file.

2007-05-28 08:55  ajvincent

	* verbosio/src/core/components/DTDDocumentWrapper.js: Update
	  DTDDocumentWrapper.js file to reflect minor changes (transaction
	  managers belonging to the doc pack, base wrappers for each DTD
	  wrapper, etc.

2007-05-28 08:50  ajvincent

	* verbosio/src/core/idl/: xeIDocumentWrapper.idl,
	  xeIPrecondition.idl: Forward-declare interfaces instead of
	  importing them.  This helps to isolate IDL syntax errors to a
	  specific file.

2007-05-28 08:48  ajvincent

	* verbosio/src/: core/components/entityManager.js,
	  document-packs/xul-application/components/xul-application.js,
	  generic-viewers/source-edit/content/source-edit.js,
	  generic-viewers/source-edit/content/bindings/source-editor.xml,
	  markup-languages/xul/components/xul-document.js: Document packs
	  should own entity managers, not XML document wrappers.  Also,
	  lose the xeITransactionControl implementation.

2007-05-28 08:45  ajvincent

	* verbosio/src/core/idl/: xeIDocumentPack.idl,
	  xeIEntityManager.idl, xeIXMLDocumentWrapper.idl: Document packs
	  should own entity managers, not XML document wrappers.

2007-05-28 08:43  ajvincent

	* verbosio/src/core/idl/xeIDTDWrapper.idl: JavaDoc fixes for
	  xeIDTDWrapper.idl.

2007-05-28 08:41  ajvincent

	* verbosio/src/core/: components/xeTransactionControl.js,
	  idl/xeITransactionControl.idl: Remove xeITransactionControl.idl,
	  xeTransactionControl.js.  They were not scalable (imagine doing
	  an action, opening a new document, undoing the action).

2007-05-11 20:39  ajvincent

	* verbosio/src/core/content/template.css: CSS error fix from
	  previous checkin.

2007-05-11 20:31  ajvincent

	* verbosio/src/core/content/verbosio.js: Update verbosio.js
	  transaction handling to reflect API changes at shutdown.

2007-05-11 20:29  ajvincent

	* verbosio/src/core/content/: template.css, bindings/template.xml:
	  Add 'goalposts' user interface indicators for DTD entity editing.
	  Work in progress.

2007-05-08 20:58  ajvincent

	* verbosio/src/: core/components/xeTestEngine.js,
	  document-packs/xul-application/components/xul-application.js,
	  document-packs/xul-application/content/xul-application.js:
	  Implement application pack component for XUL-based extensions.

2007-05-08 20:49  ajvincent

	* verbosio/src/core/content/tools/packTypesRegistry.js: Add XXX
	  comment for pack types registry.  It should use the native
	  category manager, but currently doesn't.

2007-05-08 20:46  ajvincent

	* verbosio/src/: core/components/xeTransactionControl.js,
	  misc/uuid.txt: Mark uuid's reserved, and use a new one for
	  xeTransactionControl's TransactionListener.

2007-05-07 22:32  ajvincent

	* verbosio/src/: core/components/entityManager.js,
	  core/components/templateXTF.js, core/components/xeTestEngine.js,
	  core/idl/xeIEntityManager.idl,
	  core/content/bindings/template.xml, misc/uuid.txt: Convert entity
	  references for attributes into xeIEntity objects - lose the
	  wrappedJSObject hacks.

2007-05-07 22:11  ajvincent

	* verbosio/src/core/components/virtualProtocol.js: Silence lots of
	  virtual protocol, virtual channel QI warnings.

2007-05-02 23:16  ajvincent

	* verbosio/src/core/content/verbosio.js: Bustage fix for previous
	  checkin.

2007-05-02 23:11  ajvincent

	* verbosio/src/core/content/verbosio.js: Transaction handling
	  rewrite, phase 1:  Rewrite xeITransaction to list document
	  wrappers it affects, and add xeTransactionControl.js, which
	  requires transactions implement xeITransaction and only modify
	  documents under their control.

2007-05-02 23:07  ajvincent

	* verbosio/src/core/: components/xeTestEngine.js,
	  components/xeTransactionControl.js, idl/xeIDocumentWrapper.idl,
	  idl/xeITransaction.idl, idl/xeITransactionControl.idl:
	  Transaction handling rewrite, phase 1:  Rewrite xeITransaction to
	  list document wrappers it affects, and add
	  xeTransactionControl.js, which requires transactions implement
	  xeITransaction and only modify documents under their control.

2007-05-01 21:55  ajvincent

	* verbosio/src/core/components/xeTestEngine.js: Automated test
	  regression fix (believed to be 1.9a4 tweak) - typeof
	  entityData['XUL_NS'] == 'object'.

2007-04-28 19:58  ajvincent

	* verbosio/src/markup-languages/xul/content/templates.xml: Show
	  entities to the user for the menuitem template.

2007-04-28 19:57  ajvincent

	* verbosio/src/core/: components/templateXTF.js,
	  content/template.css, content/templateFrame.xul,
	  content/bindings/template.xml: Add support for showing DTD
	  entities to the user.  Implement a  binding
	  for this.

2007-04-28 19:53  ajvincent

	* verbosio/src/core/components/entityManager.js: Adjust stored
	  entity maps to include the value of the entity (for text
	  entities), and the document wrapper it came from.

2007-04-28 19:51  ajvincent

	* verbosio/src/core/: components/DTDDocumentWrapper.js,
	  idl/xeIDTDWrapper.idl: Add baseWrapper property to xeIDTDWrapper.

2007-04-28 19:48  ajvincent

	* verbosio/src/core/idl/xeIVirtualFileService.idl: Remove dump
	  method from xeIVirtualFileService.

2007-04-28 15:01  ajvincent

	* verbosio/src/core/components/: virtualProtocol.js,
	  xeTestEngine.js: Bug 16934, clean up and review virtual://
	  protocol handler.  Also add testcase for protocol handler.
	  r=biesi

2007-04-27 20:26  ajvincent

	* verbosio/src/core/application.ini.in: Move Verbosio requirement
	  for XULRunner to a minimum version of 1.9a5pre.
Posted by WeirdAl at 7:22 AM

May 8, 2007

Editing Firefox extensions with Verbosio?

Well, why not?

I've been thinking for a while that Verbosio could bring a lot to the table if you could use it to work on Firefox extensions. Fundamentally, it would be trivial to add support for that to Verbosio.

Verbosio is a XUL application I'm building for editing XML. That's its fundamental goal. For the 0.1 release, Verbosio's first requirement is the ability to reliably edit Verbosio. That means Verbosio needs to understand XUL, XBL, a little JS and a little CSS, DTD... all things that you need for a Firefox extension editor too.

I really do think I could add support for Firefox extension development in a day. It'd be as simple as creating a single component implementing xeIDocumentPack. That same component would mean support for editing Thunderbird extensions, NVu extensions, Sunbird extensions, Songbird extensions, Flock extensions... you name it, if it's a XUL-based application extension, Verbosio could probably start editing it with that single component.

So I'm thinking I should add a second requirement to Verbosio 0.1: "Verbosio should be able to edit Firefox extensions reliably." With that one requirement met, Verbosio would be significantly more useful to the Mozilla community at large, and it would invite people to look at Verbosio more. That might be enough eyeballs to make my bugs shallow.

UPDATE: Done! Now you can open extensions in Verbosio for editing.

Posted by WeirdAl at 3:42 PM | Comments (1)

April 26, 2007

Verbosio progress, 04/26/2007

It's meat and potatoes time.

As I've mentioned in earlier posts, I've spent some time creating a "preview" or rendered view of a XML document the user is editing:

Of course, seeing the document alone is no fun. You want to be able to edit it. That's what Verbosio is for.

So let's say you hit Ctrl+E (right now you have to click) on the selected menu item. What do you get? How about, oh, an interface for changing that menu item's properties?

This is what I've been dreaming of for the last year and a half: a way to edit XUL on the fly, visually. (Of course, it's not just XUL - not in the long run. XUL's simply what I chose to work with first.)

It's also supporting my vision for Verbosio: having extensions drive most of the work, while Verbosio handles the common tasks. The preview viewer is provided by a Verbosio extension. The yellow box is provided by Verbosio's core, while its contents (the "XML markup template") come from another Verbosio extension. Support for the document you see comes from the same Verbosio extension as the markup template, a XUL language extension. The XUL language extension also provides some metadata about the XUL language in another component (including some basics about how to handle whitespace). Another extension told Verbosio how to open the chrome application the user is editing.

This is a starting point. I'm going to expand it soon, so that you can:

  • Work with sets of elements (like radio buttons inside a radio group, or cells in a table)
  • Build your own templates within Verbosio, using documents you have open in Verbosio
  • Edit DTD localization entities underneath the labels you see
  • Create templates for creating new documents in supported XML languages from scratch

Sometime after that - once I fix other API issues and some pretty important regressions - I'll release Verbosio 0.1 alpha 1. My changelog is in the extended entry.

In the meantime, I'm also very aware of the need to get other eyes on the code behind Verbosio. Just recently, Paul Rouget borrowed my chrome registry viewer code for his CodeEditor tool. That to me is a solid vindication of what I've been trying to do.

At the same time, the entire Verbosio code base is unreviewed and only partially documented. Sooner or later, I'm going to need volunteers who are willing to work with Verbosio - and me - and improve the hackety-hack code I'm crafting from scratch. Very little of this code, as it now stands, would pass any realistic peer review. So I will start asking, as of now, if other people want to directly involve themselves in the Verbosio project over the next few months.

I just want fellow developers to start thinking about it. I couldn't really do that before, because it's so hard to put into words what Verbosio is all about. Now, hopefully with the screenshots above, the vision can become clearer.

For now, though... the steak's on the barbecue.

2007-04-26 21:42  ajvincent

        * verbosio/www/screenshots.html: Add screenshots for April 26, 2007
          to Verbosio's screenshots page.

2007-04-26 20:41  ajvincent

	* verbosio/www/images/Apr26_2007/: menuitemEdit.png,
	  previewPanel.png: Add screenshots of the preview view of the
	  document, and a first look at the XUL menuitem editing template.

2007-04-26 17:05  ajvincent

	* verbosio/src/: core/components/templateXTF.js,
	  core/content/template.css,
	  generic-viewers/preview-edit/content/preview-edit.js,
	  generic-viewers/preview-edit/content/preview-edit.xul,
	  markup-languages/xul/content/templates.xml: More samples of a XML
	  markup template at work.  More!  (Also remove an assert that
	  proved inappropriate.)

2007-04-26 16:34  ajvincent

	* verbosio/src/: core/components/templateXTF.js,
	  core/content/templateFrame.xul,
	  core/content/bindings/template.xml,
	  core/idl/xeIMarkupLanguage.idl, misc/uuid.txt: More XML markup
	  template commits:  Implement setting of template UI fields from a
	  source node.	Implement  element for read-only
	  templates. Also add basic code (unsupported as yet) for
	  ,  elements.

2007-04-26 16:12  ajvincent

	* verbosio/src/core/app-resources/ecma-debug.js: Add stack dumping
	  to the assert function.

2007-04-25 20:40  ajvincent

	* verbosio/src/core/content/: appOverlay.js, appOverlay.xul: Add
	  code to open testing app's chrome://verbosio/content/verbosio.xul
	  for faster testing.

2007-04-25 20:37  ajvincent

	* verbosio/src/core/: chrome.manifest.in,
	  content/bindings/menudeck.xml: Override the XUL Widgets menudeck
	  widget to wallpaper over a trunk regression.	Expect this change
	  to be backed out in the future.

2007-04-24 22:21  ajvincent

	*
	  verbosio/src/generic-viewers/preview-edit/content/preview-edit.js:
	  Drop debugging dump statements.

2007-04-24 22:16  ajvincent

	*
	  verbosio/src/generic-viewers/preview-edit/content/preview-edit.js:
	  Fix Mac bustage, where floatBox doesn't appear onscreen close to
	  the target element.

2007-04-24 00:15  ajvincent

	*
	  verbosio/src/generic-viewers/preview-edit/content/preview-edit.js:
	  Hide floating templates frame when the preview editor loses
	  focus.

2007-04-24 00:06  ajvincent

	* verbosio/src/:
	  generic-viewers/preview-edit/content/preview-edit.js,
	  core/content/templateFrame.xul: Add API for viewing markup
	  templates, based on the wrapped document the user wishes to edit.

2007-04-24 00:04  ajvincent

	* verbosio/src/core/content/template.css: Remove some currently
	  dead XBL bindings.

2007-04-24 00:04  ajvincent

	*
	  verbosio/src/generic-viewers/preview-edit/content/preview-edit.xul:
	  Give the template iframe some style (height, width).

2007-04-24 00:03  ajvincent

	* verbosio/src/markup-languages/xul/content/templates.xml: Markup
	  template elements should have a menulabel element, in order to
	  fit with  widget.

2007-04-24 00:02  ajvincent

	* verbosio/src/core/components/templateXTF.js: Implement
	  nsIXTFElement.cloneState for .

2007-04-23 18:35  ajvincent

	* verbosio/src/core/components/xeTestEngine.js: Add XUL doc test 2
	  to xeITestEngine.runAllTests().

2007-04-23 18:28  ajvincent

	* verbosio/src/: core/components/templateXTF.js,
	  core/idl/xeIXMLLanguagePackService.idl,
	  markup-languages/xul/components/xul-language.js, misc/uuid.txt:
	  Add Verbosio markup template language pack.  Add routines to
	  xeIMarkupTemplate.rateSupport for initial checking of a node
	  against its equivalent template.  This includes a whitespaceMap
	  object which caches results from various
	  xeIXMLLanguagePackService.handleWhitespace() calls.

2007-04-23 18:00  ajvincent

	* verbosio/src/misc/component.js.in: Multi-component JavaScript
	  module template:  Support service factories a little easier, by
	  removing the need for Service.prototype; just use a global
	  service object, and Module.addService().

2007-04-23 13:33  ajvincent

	* verbosio/src/: code-languages/css/components/css-document.js,
	  code-languages/css/components/css-language.js,
	  code-languages/javascript/components/js-document.js,
	  code-languages/javascript/components/jsLanguagePack.js,
	  code-languages/javascript/components/jsSourceMap.js,
	  code-languages/xul-application/components/application-ini.js,
	  core/components/DTDDocumentWrapper.js,
	  core/components/XMLDocumentWrapper.js,
	  core/components/documentFile.js,
	  core/components/entityManager.js,
	  core/components/nodePositionService.js,
	  core/components/templateXTF.js,
	  core/components/textDocumentWrapper.js,
	  core/components/verbosio-utils.js,
	  core/components/verbosioEditor.js,
	  core/components/virtualProtocol.js,
	  core/components/xblLanguagePack.js,
	  core/components/xeBaseURIMap.js, core/components/xeFileSearch.js,
	  core/components/xeTestEngine.js,
	  core/components/xmlLanguagePack.js,
	  core/content/bindings/valuepanel.xml,
	  core/content/tools/xeTransactionCommon.js,
	  document-packs/verbosio-app/components/verbosio-app.js,
	  document-packs/xul-application/components/xul-application.js,
	  generic-viewers/inspector/content/inspectorOverlay.js,
	  generic-viewers/source-edit/content/bindings/source-editor.xml,
	  markup-languages/xul/components/xul-document.js,
	  markup-languages/xul/components/xul-language.js,
	  misc/component.js.in, xpathgen/components/nsXPathGenerator.js:
	  QueryInterface cleanup.

2007-04-22 14:29  ajvincent

	* verbosio/src/core/components/xeTestEngine.js: Add initial test
	  code framework for markup templates.

2007-04-21 14:32  ajvincent

	*
	  verbosio/src/generic-viewers/preview-edit/content/preview-edit.js:
	  Get templates corresponding to a DOM node the user selects.

2007-04-21 14:31  ajvincent

	* verbosio/src/: core/components/templateXTF.js,
	  core/components/verbosio-utils.js,
	  core/idl/xeIMarkupLanguage.idl,
	  core/idl/xeIVerbosioUtilsService.idl, misc/uuid.txt: Add initial
	  support for searching Verbosio's markup language templates
	  against a selected DOM node.

2007-04-21 14:21  ajvincent

	* verbosio/src/core/content/: verbosio.js,
	  tools/namespaceRegistry.js: Rewrite namespace registry to reflect
	  more recent API, and use Verbosio utilities service.

2007-04-21 14:19  ajvincent

	* verbosio/src/markup-languages/xul/content/templates.xml: Reduce
	  cruft in templates.xml to immediately testable levels.  I'm
	  moving the markup language bindings to XTF and almost starting
	  over.

2007-04-21 14:17  ajvincent

	* verbosio/src/markup-languages/xul/verbosio-data.xml: Minor bugs
	  in verbosio-data.xml for XUL language extension.

2007-04-21 14:15  ajvincent

	* verbosio/src/core/components/entityManager.js: Entity manager was
	  calling for Verbosio utilities a little too soon.

2007-04-21 10:03  ajvincent

	*
	  verbosio/src/generic-viewers/preview-edit/content/preview-edit.js:
	  Minor adjustments to floatBox:  use click events instead of
	  mousemove (we should really make this selection-dependent), and
	  bail out if the target node hasn't changed from the last such
	  event.

2007-04-21 09:55  ajvincent

	* verbosio/src/: core/components/templateXTF.js, misc/uuid.txt:
	  Initial check-in of XTF binding for XML elements in the markup
	  namespace.

2007-04-17 23:24  ajvincent

	* verbosio/src/: core/content/templateFrame.xul,
	  generic-viewers/preview-edit/content/preview-edit.js,
	  generic-viewers/preview-edit/content/preview-edit.xul,
	  generic-viewers/preview-edit/skin/preview-edit/preview-edit.css:
	  Lay groundwork for positioned editing templates.  Thanks to
	  bzbarsky for suggesting iframe inside box.
Posted by WeirdAl at 7:24 PM | Comments (1)

April 11, 2007

Verbosio progress, 04/11/2007

The goal is in sight... literally.

A few days ago, I checked in another viewing extension to Verbosio, one that shows you what the document would really look like. It's not editable yet - it's just an iframe - but at least now you can see what your changes do to your document. (No screenshots yet - what's so pretty about an iframe?)

It also means I'm finally done writing mostly component code and now I can get back to writing mostly chrome code. I can finally make Verbosio into an editing application instead of a clunky DOM Inspector clone. :-)

I'm working now on integrating my markup template system with the visual rendering. Just this evening I landed sample code from the experimental branch to mark a starting point. I'm also beginning to figure out a little more clearly what Verbosio and its extensions need from each other.

Already I'm thinking about a Verbosio 0.1 alpha 1 release in the near future (read: within a few weeks). I will have a very tough time deciding what makes 0.1a1 and what should come later, though.

The changelog since March 7, 2007 is in the extended entry.

2007-04-11 19:12  ajvincent

	* verbosio/src/: core/content/template.css,
	  core/content/verbosio.dtd, core/content/bindings/template.xml,
	  markup-languages/xul/content/templates.xml,
	  markup-languages/xul/content/xul-language.dtd,
	  markup-languages/xul/locale/en-US/xul-language/templates.dtd,
	  markup-languages/xul/skin/xul-language/xul-language.css: Initial
	  landing of main templates code from verbosio/experimental.

2007-04-11 19:09  ajvincent

	* verbosio/src/core/content/verbosio.css: Add license boilerplate
	  to verbosio.css.

2007-04-11 18:12  ajvincent

	* verbosio/src/core/: components/verbosio-utils.js,
	  content/verbosio.js, idl/xeIVerbosioUtilsService.idl: Add code
	  for reading Verbosio extension metadata documents.  Interpreting
	  them will come later.

2007-04-11 17:17  ajvincent

	* verbosio/src/backport.pl.in: Adjust backport.pl.in to include
	  verbosio-data.xml.

2007-04-11 17:15  ajvincent

	* verbosio/src/: make-project.pl,
	  markup-languages/xul/verbosio-data.xml: Add sample data file for
	  Verbosio extensions, so Verbosio can identify a language an
	  extension provides.  Also adjust make-project.pl to generate
	  slightly cleaner objdirs.

2007-04-11 12:42  ajvincent

	*
	  verbosio/src/generic-viewers/preview-edit/content/preview-edit.js:
	  Add an error event listener on the preview iframe to silence most
	  errors from content.

2007-04-11 11:15  ajvincent

	* verbosio/src/core/content/bindings/verbosio.xml: Add support for
	  changing documents via Ctrl+PGUP, Ctrl+PGDN.	Also add support
	  for changing viewers via Alt+PGUP, Alt+PGDN.	Finally, shave a
	  few lines of inefficiency off the command event handler for tabs.

2007-04-11 03:56  ajvincent

	*
	  verbosio/src/generic-viewers/preview-edit/content/preview-edit.js:
	  Show the document the user is editing in a preview panel.

2007-04-11 03:54  ajvincent

	* verbosio/src/core/components/xeTestEngine.js: Adjust baseURIMap
	  automated test to account for ../ cases.

2007-04-11 03:53  ajvincent

	*
	  verbosio/src/document-packs/xul-application/components/xul-application.js:
	  Clean up file paths with ../ in them, and resolve file:// URI's
	  to local file paths.

2007-04-11 03:50  ajvincent

	* verbosio/src/core/components/documentFile.js: Minor adjustment to
	  documentFile component for URL handling.

2007-04-11 03:49  ajvincent

	* verbosio/src/core/components/xeBaseURIMap.js: Fix typo in base
	  URI map:  XPCOM error code was incorrectly named.

2007-04-09 12:40  ajvincent

	* verbosio/src/core/content/bindings/verbosio.xml: Viewer tabs for
	  the document viewer binding should start out disabled.

2007-04-08 22:56  ajvincent

	* verbosio/src/make-project.pl: Add preview / WYSIWYG document
	  viewer to the Verbosio build process.

2007-04-08 22:55  ajvincent

	* verbosio/src/generic-viewers/preview-edit/: VER_LAST,
	  chrome.manifest.in, install.rdf.in, content/preview-edit.dtd,
	  content/preview-edit.js, content/preview-edit.xul,
	  locale/en-US/preview-edit/.cvsignore,
	  locale/en-US/preview-edit/preview-edit.properties,
	  skin/preview-edit/preview-edit.css: Initial landing of the
	  preview-edit extension.  Note this is just a framework; there is
	  no actual support for previewing documents yet.

2007-04-08 21:31  ajvincent

	* verbosio/src/generic-viewers/source-edit/content/:
	  source-edit.js, bindings/source-editor.xml: Use sanitized content
	  from entity manager for XML documents.  Fix subtle dataloss bug
	  in re-parsing of XML documents.  Source edit transactions should
	  be managed by notifyEvent(), not the input event handler.

2007-04-08 21:26  ajvincent

	* verbosio/src/markup-languages/xul/components/xul-document.js: XUL
	  documents shouldn't lose an existing doctype.  Also, remove more
	  noisy dump statements for XUL document wrapper invariants.

2007-04-08 21:20  ajvincent

	* verbosio/src/core/components/entityManager.js: Entity manager
	  doesn't implement nsISecurityCheckedComponent.

2007-04-08 21:18  ajvincent

	* verbosio/src/core/components/documentFile.js: Add a few useful
	  dump statements, fix strict warnings in documentFile.js.

2007-04-08 21:15  ajvincent

	* verbosio/src/code-languages/css/components/css-document.js:
	  Remove some noisy dump statements in css-document.js component.

2007-04-08 20:11  ajvincent

	* verbosio/src/markup-languages/xul/components/xul-document.js: Use
	  the entity manager's getSanitizedContent() method to handle
	  DTD's, entities.

2007-04-08 19:59  ajvincent

	* verbosio/src/generic-viewers/source-edit/VER_LAST: Back out rev
	  1.2 to VER_LAST.  It's too soon to update this.

2007-04-08 19:57  ajvincent

	* verbosio/src/generic-viewers/source-edit/: VER_LAST,
	  content/bindings/source-editor.xml: Get source code through a
	  document wrapper's entity manager, and remove the
	  findEndOfDoctype code, which Verbosio utilities already takes
	  care of.

2007-04-08 19:54  ajvincent

	* verbosio/src/core/components/entityManager.js: Implement code for
	  sanitizing the source code contents of a XML document.

2007-04-08 19:50  ajvincent

	* verbosio/src/core/content/verbosio.dtd: Add MARKUP_NS namespace.

2007-04-08 17:47  ajvincent

	* verbosio/src/core/content/tools/domTreeViewMaker.js: DOM tree
	  view maker should display entity reference nodes when it hits a
	   element.

2007-04-08 17:31  ajvincent

	* verbosio/src/core/components/: entityManager.js, xeTestEngine.js:
	  Add parsing of text entities to the entity manager.

2007-04-08 16:42  ajvincent

	* verbosio/src/core/components/entityManager.js: Fix some minor
	  bugs in entity manager:  don't check node value, exclude children
	  of markup:entity-ref elements, and make sure all entity ref
	  fragments have their own DTD's, so entities referencing entities
	  can still be parsed.

2007-04-08 16:38  ajvincent

	* verbosio/src/core/components/documentFile.js: Normalize XML
	  documents.

2007-04-07 17:01  ajvincent

	* verbosio/src/core/: components/entityManager.js,
	  components/xeTestEngine.js, content/entityTest.xul: Fix minor
	  bustages in entity handling, and create a baseline testcase for
	  the entity manager.

2007-04-06 21:49  ajvincent

	* verbosio/src/core/content/tasksOverlay.xul: Well-formedness error
	  fix, for a missing quote.

2007-04-06 19:32  ajvincent

	* verbosio/src/core/components/entityManager.js: XML entity
	  manager:  implement most of the mapping functionality.  Still
	  non-functional (it should be surrounding nodes in entity refs,
	  but isn't for some reason).

2007-04-04 09:44  ajvincent

	* verbosio/src/: core/components/entityManager.js,
	  markup-languages/xul/components/xul-document.js, misc/uuid.txt:
	  Add framework for XML entity manager code.  Not yet fully
	  implemented.

2007-03-29 16:38  ajvincent

	* verbosio/src/core/content/tools/domTreeViewContext.dtd: Fix
	  regression with key bindings:  overlays only apply to one element
	  per ID-type attribute.

2007-03-29 11:37  ajvincent

	* verbosio/src/core/content/: verbosio.xul,
	  tools/domTreeViewContext.dtd: Add native-app key bindings for
	  cut, copy, paste, delete edit commands.  Note there is no
	  equivalent to insert commands.

2007-03-28 23:06  ajvincent

	* verbosio/src/core/content/: verbosio.js, verbosio.xul,
	  tools/xeTransactionCommon.js: Initial check-in of Verbosio cut,
	  copy, paste commands and code to call on them.

2007-03-28 23:02  ajvincent

	*
	  verbosio/src/document-packs/xul-application/components/xul-application.js:
	  Add transaction listener for XUL application pack.

2007-03-28 23:01  ajvincent

	* verbosio/src/markup-languages/xul/components/xul-language.js:
	  Clarify QueryInterface calls.

2007-03-26 11:16  ajvincent

	* verbosio/src/: code-languages/css/components/css-document.js,
	  misc/uuid.txt: Forgot to mark a couple UUID's for a given
	  component.

2007-03-19 19:25  ajvincent

	* verbosio/src/code-languages/css/components/css-document.js: Add
	  an initial class invariant on CSS document packs.

2007-03-19 19:23  ajvincent

	* verbosio/src/core/components/xeTestEngine.js: Test engine needs
	  to set the correct length for data (bypass mozilla.org bug
	  374562).

2007-03-19 17:10  ajvincent

	* verbosio/src/core/content/tools/ecma-debug.js: Remove
	  chrome://verbosio/content/tools/ecma-debug.js; replaced by
	  resource://app/res/ecma-debug.js
	  (verbosio/src/core/app-resources/ecma-debug.js).

2007-03-19 17:06  ajvincent

	* verbosio/src/:
	  code-languages/xul-application/components/application-ini.js,
	  document-packs/verbosio-app/components/verbosio-app.js,
	  misc/component.js.in: Replace remaining references to
	  chrome://verbosio/content/tools/ecma-debug.js with
	  resource://app/res/ecma-debug.js.

2007-03-19 16:59  ajvincent

	* verbosio/src/: core/components/DTDDocumentWrapper.js,
	  core/components/XMLDocumentWrapper.js,
	  core/components/documentFile.js,
	  core/components/nodePositionService.js,
	  code-languages/css/components/css-document.js,
	  code-languages/css/components/css-language.js,
	  code-languages/javascript/components/js-document.js,
	  code-languages/javascript/components/jsLanguagePack.js,
	  core/components/textDocumentWrapper.js,
	  core/components/verbosio-utils.js,
	  core/components/xblLanguagePack.js,
	  core/components/xeFileSearch.js, core/components/xeTestEngine.js,
	  core/components/xmlLanguagePack.js, core/content/verbosio.xul,
	  document-packs/xul-application/components/xul-application.js,
	  markup-languages/xul/components/xul-language.js: Replace
	  remaining references to
	  chrome://verbosio/content/tools/ecma-debug.js with
	  resource://app/res/ecma-debug.js.

2007-03-19 16:40  ajvincent

	* verbosio/src/markup-languages/xul/components/xul-document.js:
	  Convert XUL document wrapper to use ECMA Debugging functions from
	  resource://app/res/ecma-debug.js.

2007-03-19 16:35  ajvincent

	* verbosio/src/core/app-resources/ecma-debug.js: Copy
	  verbosio/src/core/content/tools/ecma-debug.js rev 1.9 to
	  verbosio/src/core/app-resources/ecma-debug.js rev 1.1.

2007-03-19 16:32  ajvincent

	* verbosio/src/core/content/tools/ecma-debug.js: Bug fixes for
	  invariant class contracts.

2007-03-19 16:30  ajvincent

	* verbosio/src/: backport.pl.in, make-project.pl: Add support for
	  resource://app/res/ building.

2007-03-19 15:49  ajvincent

	* verbosio/src/core/content/tools/ecma-debug.js: Allow
	  InvariantContract's _generateContract method to look for an
	  existing contract function and adopt it.  Also, prepare to move
	  ecma-debug.js to resource://app/res/ecma-debug.js.

2007-03-18 14:34  ajvincent

	* verbosio/src/core/: components/verbosio-utils.js,
	  components/xeTestEngine.js, idl/xeIVerbosioUtilsService.idl: Add
	  initial support for Verbosio clipboard manipulation, including
	  caching an object closely related to the clipboard contents.

2007-03-17 19:26  ajvincent

	* verbosio/src/: core/content/tools/ecma-debug.js,
	  markup-languages/xul/components/xul-document.js: Add class
	  invariant support for JS-based XPCOM components.

2007-03-14 20:32  ajvincent

	* verbosio/src/: misc/uuid.txt, core/idl/xeIEntityManager.idl,
	  core/idl/xeIXMLDocumentWrapper.idl: Add interface for managing
	  XML entity references in a document.	Not implemented yet; this
	  is a sketch.

2007-03-09 20:18  ajvincent

	* verbosio/src/: core/components/DTDDocumentWrapper.js,
	  core/components/documentFile.js,
	  document-packs/xul-application/components/xul-application.js:
	  Replace  href pseudo-attributes with
	  virtual:// equivalents.  Note this messes up a few things
	  downstream (like source code editing), but this should fix most
	  of bug 16341.

2007-03-09 14:54  ajvincent

	* verbosio/src/: make-project.pl, core/components/xeTestEngine.js,
	  code-languages/css/VER_LAST, code-languages/css/install.rdf.in,
	  code-languages/css/components/css-document.js,
	  code-languages/css/components/css-language.js: Initial
	  implementation of CSS language pack extension (including document
	  wrapper).
Posted by WeirdAl at 6:33 PM | Comments (1)

April 7, 2007

Verbosio progress, 04/07/2007

When a XML editor finishes messing with DTD's, the next thing which comes to mind is entity references (&foo;). In the case of Mozilla code, these entity references don't exist: the XML parsing code replaces the entity ref with the appropriate source code from the DTD. So the DOM in Mozilla never actually sees entity references.

This is a major problem for Verbosio. As a XML editor, it must know where a XML document uses entity references. With that knowledge, Verbosio can then provide a user-interface which guides people to editing the DTD entity underneath the entity ref.

What makes it more interesting is that Mozilla really has no effective code for entity references in DOM. Try var foo = document.createEntityReference("bar");. You'll find out that, even if there is no declared <!ENTITY bar "...">, no error will be thrown; instead, foo is null.

How can Verbosio work around this? At present, I have an imperfect solution, a XML "entity manager". Read on if you have any interest.

I've already checked in a first-draft entity manager component (with XPIDL interface). Currently it's only minimally functional, with several bugs I need to track down.

Entities contain fragments of XML markup, which (in many, but not all) cases comprise full DOM nodes which could fit into a document fragment or a XML element "wrapper". So what I have been doing is taking the contents of each entity and parsing them into little XML documents inside a specially constructed wrapper. Then I compare the nodes in each entity's DOM fragment against the nodes of the document.

Note I cannot use isEqualNode() on any of these, because in the entity fragments I have no way of knowing which namespaces to associate with each element and attribute in the entity declaration.

The problem is a little more complex, because some entities are for attributes-only, and others are for XML fragments. So there are really two different types of entity references: those inside an attribute's value, and those which could span several (non-attribute!) nodes. The first type can only contain CharacterData nodes; the second can contain almost any types of nodes.

When the entity manager finds a match of the second type, it currently surrounds the matching DOM nodes in the document with a <markup:entity-ref/> element. This is a really hackish way to take care of business, but in theory it should work. In practice, it means document viewers (like the Inspector view and the source code view) will have to work a little harder than is nice.

I also tried to move the new contents of this entity-ref element into the element's anonymous content. (The idea is that all the user sees in the source code is the entity ref itself, and not its contents - but in a rendered view, the contents are visible.) Unfortunately, to do so you need to add a binding to the entity-ref element, and that doesn't work for DOMParser-created documents. So that's a dead end.

It's also worth noting that currently, attribute nodes in Mozilla can't have entity references for children. (If you can't create them, you can't insert them.)

Ultimately, it's enough of a quagmire that, even once I get all the algorithms for my entity manager fixed and operational, I'll still think it's not right. It would be far better to actually implement entity reference classes natively in Gecko, and to use them to simplify the DOM of the document. Verbosio's entity manager would take care of inserting the entity references, but the references themselves would belong to the core DOM. That would make the proposed <markup:entity-ref/> element obsolete and (fortunately) easy to replace.

Oh, by the way, Mozilla's doctypes return null when you ask for their entities property. Another nice quirk of the Mozilla DOM.

Personally, I don't think we'll see native entity references or entity nodes in Mozilla DOM anytime soon. It's a lot of work for admittedly little gain. Sure, Verbosio would benefit... but not Firefox, Thunderbird, or Songbird, I'd think. That's why these not-so-little hacks are (for now) necessary.

Posted by WeirdAl at 6:46 PM | Comments (1)

March 28, 2007

Copying objects to an application's clipboard

The system clipboards Mozilla offers to XULRunner apps restricts us to primitive values: strings, numbers, etc. (I haven't yet figured out how they store images, but that's another discussion.) If you're trying to copy a DOM node to the operating system's clipboard, you quickly find out it's not that easy.

Since Verbosio's a XML editor, heavily reliant on the DOM, what am I supposed to do? Well... I cheated. Read on for more details.

UPDATE: A few commenters have suggested I have erred. I'd really appreciate someone coming up with some sample code to demonstrate a better way, using the native clipboard. (I may or may not use it, but it's nice to know.)

Reading the fine print

Neil Deakin wrote a guide to using the clipboard. Too bad I had a really hard time understanding it. Eventually, I figured I could set my DOM node (which implements nsISupports) as the second argument of nsITransferable's setTransferData() method. Said argument takes a nsISupports value. No problem, right?

Wrong. Read the inline JavaDoc comments, and it says nsISupportsPrimitives or nsIFlavorDataProvider (in nsITransferable.idl). A closer look at nsIFlavorDataProvider suggests again nsISupports is fine... but the JavaDoc says nsISupportsPrimitives.

DOM nodes don't implement nsISupportsPrimitives.

(Note: I consider this lousy interface design. If you have a IDL method that can only take two different types of arguments, and you try to combine them through a commonly supported interface, you're better off breaking it up into two different IDL methods with the more specific types of arguments.)

Storing objects in the application

What did I do to cheat? I added code to a XPCOM service for Verbosio which stores the object I want as a private global variable.

I already have a xeIVerbosioUtilsService.idl interface, and it now has a few new methods: copySelection(), clipboardType, and getClipboardContents().

These methods handle the system clipboard. The copySelection() method copies from the current document wrapper whatever selection it is, whether text or a DOM node. In the latter case, it serializes the node first, and stores the string in the system clipboard. The method also stores the retrieved node (usually a DocumentFragment) in the component's JavaScript context.

What if someone else (say, Microsoft Word) copies data into the clipboard? How does the utility component know when to forget the DOM node? That's where nsIClipboardOwner comes in to play. By setting a custom clipboard owner from the utility service, the utility can find out when the content it copied to the system clipboard is going away from the system clipboard. When that happens, the utility service can clear its own private object storage.

The clipboardType property simply defines what the content-type of the object stored in the application "clipboard" is. For DOM nodes, I chose an arbitrary "application/x-vnd.verbosio.dom-node" content-type.

I then use getClipboardContents if I have an actual object there, and can then retrieve the object that way.

Use case: Copying and pasting DOM nodes

Steps to reproduce in Verbosio:

  1. Verbosio > Edit testing app
  2. Open chrome://verbosio/content/verbosio.xul
  3. Switch to the Inspector view of the opened document.
  4. Select the first three children of the window element.
  5. Context menu, select "Copy".
  6. Open chrome://verbosio/content/verbosioOverlay.xul
  7. In the Inspector view for verbosioOverlay.xul, select a child of the overlay element.
  8. Context menu, select "Paste".
  9. Edit > Undo
  10. Edit > Redo

That much works. What works and doesn't work beyond that, I don't know yet. :-)

Help! Chrome macros?

This was ten steps that a user has to perform manually to test a simple feature. Sure, the key part of it takes maybe two steps.

Why does this aggravate me so much? Well, the edge of my MacBook, where the wrist comes off the keyboard / mousepad, is pretty sharp... I haven't cut myself yet (or broken the skin), but I do fear I could hurt myself if I get any kind of pound-the-computer-in-frustration moments.

What I need is some sort of record / playback mechanism for chrome apps. I'd do it myself, except for legal reasons relating to a previous employer, I'm not sure I can. Recording user actions for later playback could be very useful, especially for testing. Rumor has it someone I know is working on that, with no active input from me. I'd really love it if it wasn't rumor, and if it was soon. :-)

Posted by WeirdAl at 10:23 PM | Comments (3)

March 10, 2007

Verbosio progress, 03/10/2007

I wouldn't normally post again so soon, except that I have finally fixed Verbosio bug 16341. A little string replacement, and I'm finally able to generate a clean DOM.

Thanks to Ben Bucksch, who was willing to give up a bit of sleep to help me decide what to work on next. That would be clipboard operations - copying being the more difficult one, because that would mean copying nodes. It's not as glamourous as other ideas I have to work on, but it is necessary.

Posted by WeirdAl at 7:55 AM

March 7, 2007

Verbosio progress, 03/07/2007

Robert Sayre recently told me DTD's are just about useless. I disagree: they're worse than useless - at least, the way Mozilla deals with them. :-)

Specifically, the only thing Mozilla code really uses DTD's for is chrome localizations of labels, accesskeys, etc. But if you're dealing with chrome:// URL's in the XUL application you're editing, you really don't want cross-contamination from the editor's own chrome files. Factor in DTD's calling on and loading other DTD's, and you have the beginnings of a royal mess.

It's a mess of my own making, though, because I want a complete object model for the XML documents I edit, not just the source code. Also, Mozilla's use of DTD's is appropriate for 99% of current uses; I just happen to require a bit more careful handling. It's the price I pay, although hacking around it required two whole weeks for me to figure out...

More in the extended entry.

The first thing I realized is I needed a DTD document wrapper - basically, a container for DTD documents. However, XML documents also have inline DTD's - in the form of internal subsets. Basically, every XML document can have a DOCTYPE declaration:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
              "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Mozilla handles extra DTD code in a DOCTYPE tag by placing it in the internal subset:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
              "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
  <!ENTITY hello.world "Hello World! This is an entity declaration in the internal subset.">
]>

Localization DTD's load into a XUL document via a SYSTEM entity:

<!DOCTYPE window [
  <!ENTITY % verbosioLocale SYSTEM "chrome://verbosio/locale/verbosio.dtd">
  %verbosioLocale;
]>

DTD files themselves have the same constraint. So for Verbosio, I needed not only a DTD document wrapper (for DTD files), but also a DTD subset wrapper (for DTD entity declarations within a XML document). This meant yet another new interface, xeIDTDWrapper, and a pair of new components - one implementing xeIDTDWrapper and xeITextDocumentWrapper for the DTD files, and another implementing just xeIDTDWrapper for the internal subset. Throw in a reference to the subset wrapper on xeIXMLDocumentWrapper, and we're halfway home.

Next, I cleaned up the virtual:// protocol implementation, moving all three JavaScript components into a common file. I also rewrote the interface for the virtual file service, simplifying and modernizing it.

Then Benjamin Smedberg set us up the bomb and dropped the bomb on us. The new MozillaBuild system works beautifully... for building Mozilla's source code. My Verbosio project? Not so much. An ancient bug in CVS (unfixed in MSYS's packages, but fixed years ago in CVS itself) broke Verbosio's build process. My reliance on cygpath (which CygWin has but MSYS doesn't) was another build regression, which I've only partially fixed. (I still need to fix launching the test Verbosio from the default Verbosio.)

Back on DTD handling, I spent several hours teaching Verbosio how to get DTD's from its own sources and include them via a virtual:// protocol (replacing chrome://foo/locale/foo.dtd with virtual://chrome//foo/locale/dtd). Unfortunately, that didn't work. Mozilla (wisely, in my opinion) only loads DTD files in its internal subset from a chrome:// protocol. (Well, it might allow more, but it wouldn't allow virtual://). The result is a ton of missing DTD entities.

Next step: forego trying to load these external DTD's, and just copy them from the various DTD wrappers into the internal subset. It's a dirty, rotten thing to do, but ultimately necessary. Besides, it happens to be exactly what Mozilla does natively with chrome-based DTD's.

Once I fixed that, my test code for this was still failing. The cause of that failure, though, pleased me greatly: Verbosio was trying to look up chrome://global/locale/textcontext.dtd in the XUL application it was editing. The global and toolkit chrome packages come from native XULRunner code, and not from an individual XUL application. In other words, Verbosio was parsing everything from the target application that the target application knew about (that's what made me happy). The XUL application wouldn't have the details on these packages. But Verbosio - being based on the same XULRunner code - would have the details, and could safely load DTDs in these chrome packages from its own chrome repository. A few special exclusions for global and toolkit chrome, and everything finally worked!

Except for one little detail: I was still calling on the native Verbosio application for its own chrome files (not just XULRunner's). That was why I filed Verbosio bug 16341 in the first place. It's not something detectable from JavaScript, really - it all happens within the chrome protocol handler, which is not obligated to tell JavaScript anything. After re-reading the xeIDTDWrapper interface, I figured out how to remove the offending %entityName; declarations before parsing the XML document. Finally, I can say definitively I get a clean XML document without borrowing from Verbosio's own chrome DTD files.

However, I know for a fact there are a ton of bugs in my DTD handling. <!ELEMENT> and <!ATTLIST> declarations would break my DTD wrapper code completely. So would any other valid DTD tag, except <!ENTITY> and comments. I still haven't implemented DTD editing. There's still potential for cross-package locale confusion. Most significantly, I have not yet figured out how to tie XML entity references to the matching DTD entity and file. I have some ideas, but nothing solid.

My biggest disappointment over the last two weeks is that the virtual:// protocol code is still untested. I still think it should work, but the initial implementation - working with DTD's - proved impossible. I believe its first active testing will come when I adjust URL's in the rest of an editable XML document (the part before and after the doctype tag) to refer to virtual files.

Changelog:

2007-03-07 09:41  ajvincent

	* src/core/components/documentFile.js: Bug 16341, part one:
	  complete DTD fix-up for parsing of chrome:// DTD's.  Remove
	  entity declarations from the external source.

2007-03-07 01:06  ajvincent

	* src/:
	  document-packs/xul-application/components/xul-application.js,
	  markup-languages/xul/components/xul-document.js: Lose some very
	  annoying dump statements.

2007-03-07 01:04  ajvincent

	* src/core/components/: DTDDocumentWrapper.js, documentFile.js:
	  Fall back on getting DTD sources from stored wrappers.

2007-03-06 22:34  ajvincent

	* src/: core/components/DTDDocumentWrapper.js,
	  core/components/documentFile.js,
	  core/components/virtualProtocol.js, core/idl/xeIDTDWrapper.idl,
	  core/idl/xeIDocumentFile.idl, core/idl/xeIVirtualFile.idl,
	  core/idl/xeIVirtualFileService.idl,
	  markup-languages/xul/components/xul-document.js: Update virtual
	  protocol code for a cleaner API, and attempt (unsuccessfully, so
	  far) tying it into DTD handling for XUL documents.

2007-03-06 12:57  ajvincent

	* src/: core/components/DTDDocumentWrapper.js,
	  document-packs/xul-application/components/xul-application.js: Add
	  handling for global, toolkit chrome into DTD wrappers.

2007-03-06 12:55  ajvincent

	* src/core/components/documentFile.js: For files that don't exist,
	  throw an exception.

2007-03-06 12:54  ajvincent

	* src/core/components/xeBaseURIMap.js: Fix up local path for
	  Windows when pathToDocument has forward slashes.

2007-03-06 00:06  ajvincent

	* src/make-project.pl: Yet another regression:	need to create the
	  directory the XULWidgets, JSLib libraries will go into.

2007-03-05 23:47  ajvincent

	* src/make-project.pl: Build process regression:  XULWidgets, JSLib
	  weren't copied properly.

2007-03-05 23:28  ajvincent

	* src/: core/components/DTDDocumentWrapper.js,
	  core/components/xeTestEngine.js, core/idl/xeIDTDWrapper.idl,
	  document-packs/xul-application/components/xul-application.js,
	  markup-languages/xul/components/xul-document.js: Add DTD internal
	  subset parsing to XUL document wrapper, and clean up DTDWrapper
	  code.  Test engine almost passes, but dies trying to get a global
	  chrome file.

2007-03-05 23:09  ajvincent

	* src/core/: components/verbosio-utils.js,
	  idl/xeIVerbosioUtilsService.idl: getDTDFragment should not need
	  the index where the doctype tag begins.

2007-03-05 16:58  ajvincent

	* src/make-project.pl: Fix app.properties to refer to the Win32
	  file system under MSYS.  Not fixed yet:  Setting BIN_PATH.

2007-03-05 16:00  ajvincent

	* src/make-project.pl: Branched JSLib, XUL Widgets into Verbosio
	  project; use them instead of checking them out while building.

2007-03-05 13:50  ajvincent

	* src/externals/: jslib_current.xpi, xulwidgets_current_trunk.xpi:
	  Add jslib, XULWidgets packages as of March 5, 2007 to Verbosio's
	  source; stop trying to check them out for now.  (Workaround for
	  bug with CVS 1.11, included with MozillaBuild for Windows.)

2007-03-01 21:47  ajvincent

	* src/core/: components/DTDDocumentWrapper.js,
	  idl/xeIDTDWrapper.idl, idl/xeIXMLDocumentWrapper.idl: Make
	  xeIDTDWrapper a standalone interface, and allow XML documents to
	  have a DTD wrapper for the doctype's internal subset as a
	  property.

2007-03-01 19:04  ajvincent

	* src/misc/uuid.txt: Missed checkin for uuid reservations.

2007-03-01 16:49  ajvincent

	* src/core/: components/DTDDocumentWrapper.js,
	  idl/xeIDTDWrapper.idl, idl/xeIXMLDocumentWrapper.idl: Initial
	  landing of DTD document wrapper, xeIDTDWrapper interface.

2007-03-01 16:41  ajvincent

	* src/core/content/tools/ecma-debug.js: ECMA Debug:  Check the
	  debug preference only once per script load.  assertWithStack
	  should use dumpJSStack.

2007-03-01 10:42  ajvincent

	* src/core/components/: virtual-fileService.js,
	  virtual-nsIChannel.js, virtual-protocol.js, virtualProtocol.js:
	  Consolidate virtual protocol handler, channel, and file service
	  into one JavaScript file.
Posted by WeirdAl at 10:47 AM

February 24, 2007

Verbosio progress, 02/24/2007

The logjam has officially broken. This week, I spent most of my time adding little usability features (like opening a file when you double-click on it in a directory tree) and doing some behind-the-scenes clean-up of the code.

I also added a new feature which any XUL developer should find interesting: a chrome directory viewer. This is different than Gijs Kruitbosch's Chrome List extension, in that mine examines the chrome registry of an outside application, and lists alternate locales & skins as well. (Not that there's anything wrong with Chrome List; Firefox extension developers should take a good look at it.)

To do this, I added yet another Verbosio interface, for xeIChromeDocumentPack. Whether I needed this interface or not isn't entirely clear; I didn't find any other interface on mozilla.org which matched the needs.

As I'm still waiting for bonsai.mozdev.org (they've planned it for 2nd Quarter 2007), I really lost track of all the changes I'd done this week. The list, harvested from cvs log and in the extended entry, is rather impressive, even to me.

Coming up: support for editing DTD's, virtual:// revisited, and a fix for a Verbosio data loss bug.

In no particular order, here are my commit messages from 02/19/2007 (the last blog entry) to 02/24/2007:

  • Initial landing of chrome registry viewer for XUL application document packs.
  • Include a method to get all chrome package names from a chrome document pack.
  • Add chrome document pack interface, and implementation in XUL application document pack.
  • Add JavaScript language pack extension to the build process.
  • Initial landing of XUL language pack code.
  • Base URI maps will no longer be responsible for handling wrappers; that responsibility goes to the document packs.
  • Silence dump warnings for nsIClassInfo.
  • Add base URI lookup test with reversed order for install.rdf base URI lookup versus chrome URI lookup.
  • Add initial test harness for component-driven tests.
  • Actually open the testing app in Verbosio, instead of just preparing to launch it.
  • If a file is already open, don't open a new document wrapper for it; just focus on the file's wrapper tab.
  • Fix thrown errors for closing a document, reopening it.
  • Move openDocumentPack, openDocument, closeDocument, saveDocument into the verbosio object. Also, if a Verbosio window already has a document pack, open a new window for the new document pack.
  • Add support for opening a document pack as the first argument on the command line, or as window.arguments[0] via nsIDOMJSWindow.openDialog().
  • Follow-up to mozilla.org bug 370742, which fixed many bugs in tab bindings; this patch fixes a regression caused therein.
  • Use document pack to open document wrappers, and restrict it to wrappers for which we have an established component class.
  • Remove the need for language packs to implement nsITransactionListener. Transactions shouldn't be changed by a transaction listener anyway.
  • Localization fixes.
  • removeDocTab should consider unsupported viewers for a wrapper, and go back to the first document pack tab.
  • Document wrappers, when initializing by a file, should take a document pack. The document pack will provide the base URI for the document, and for other documents the wrapper requires.
  • Minor adjustments to XUL application base URI look-up, per test results.
  • Use a more standard scope id for the XML inspector's JavaScript scope.
  • Show the user the original doctype of the document.
  • Store a reference to the document pack (we'll need it for DOCTYPE fix-ups), and get the transaction manager from the document pack.
  • Add JavaDoc and interface references for methods in component.js.in.
  • Add category manager registration code to Module.
  • Make opening a document in the directory contents viewer the default action of a user double-clicking on a tree item. Also bold the open files item in the context menu.
  • Add new screenshots for file system, chrome directories.
Posted by WeirdAl at 7:07 PM | Comments (2)

February 18, 2007

Verbosio progress, 02/18/2007

Gradual progress lately. I'm still building pieces I need to make Verbosio a relatively smart editor.

First, as Myk Melez talked about Komodo Edit, and Robert Accettura followed suit, I decided to get Komodo Edit 4.0. It just came out of beta. Like it did for Myk and Robert, it has replaced my standard text editing environment(s). I won't reiterate the features they pointed out; suffice it to say I'm pretty pleased with it so far.

However, it's not enough to make me stop working on Verbosio. I have several features in Verbosio's design plan that I don't see Komodo Edit doing. Komodo Edit is a vast improvement on what I have had at my disposal until now, and in some ways will still be better than what I alone can put out. By no means has Komodo Edit missed the boat; what they've done is fantastic, especially for a free product. I simply think that when I put Verbosio 0.1 out, it's going to open a few eyes too.

Enough about Komodo Edit. What else have I been doing?

Today I implemented a components test engine for Verbosio. Testing should be the first aspect of any software development, and also the last (albiet not the only). Alas, I found myself repeating the same steps over and over again in the user-interface, which could be automated into a script. So I wrote that script.

The nice thing about test engines is they make finding bugs a bit easier. I ended up fixing a few bugs that I didn't know I had. More importantly, I have a way to check for components-based regressions with a simple menu item.

I would have liked to make these tests xpcshell-based, but there's a little problem with that right now. (Actually two, since my test component relies on chrome code; I'm not particularly pleased about that, but for the moment it'll do.)

Oh, and I finally have my base URI map functionality worked out, at least for XUL applications. To explain, if I have two locations for a file:

  • chrome://verbosio/content/tools/ecma-debug.js
  • /home/ajvincent/verbosio/objdir/testing/chrome/content/verbosio/tools/ecma-debugs.js

Then they share a common path (tools/ecma-debug). The prefixes for these paths are "base URI's". The base URI's which this file maps to are:

  • "chrome": chrome://verbosio/content/
  • "local": /home/ajvincent/verbosio/objdir/testing/chrome/content/verbosio/

When a XUL file references chrome://verbosio/content/verbosio.dtd, I then know to get /home/ajvincent/verbosio/objdir/testing/chrome/content/verbosio/verbosio.dtd instead.

There could be other base URI's in a map, as well. Think of a website; a base URI could be http://foo.mozdev.org/ for a /home/ajvincent/foo/htdocs/ directory.

Posted by WeirdAl at 8:59 PM | Comments (3)

February 12, 2007

Searching a local directory from Gecko

Earlier today, I realized I need to search the local file system from Verbosio. There's really no such capabilities in native mozilla.org code. So, I built a basic file search capability on my own, and checked it in to Verbosio.

See the Full Article section for more details. (I also introduce a new way to implement multiple XPCOM components in a single JavaScript file.)

Local file system searches in Verbosio (patch) (requires JSLib, and my ECMA debug script).

Here's some sample code using the file search service:

testFileSearch.js

Simply put, you can search for properties of files and directories (which JSLib's File and Dir classes implement), as well as the contents of files for a specific string.

You can specify more than one set of criteria. Everything within a set of criteria must match for the file search to accept a file. However, if a file passes one or more sets of criteria on the file search, the file search accepts the file. (Logical AND tests within a criteria set, logical OR tests between criteria sets.) So you can do different searches simultaneously.

The first argument of searchDirectory is the local path of the file you want to search. The second argument is true if you want to search sub-directories as well, or false if you don't.

The filterProperty method of a search criteria set lets you define a property name and the value it must have (as a string). The filterContents method requires that any matching file have the first argument (a string) in its contents.

Whenever a contents match is included, you can get the lines where the match happens. Each result has a getLineNumbers() method, which returns an object with line numbers you can feed into getLine(aLineNumber).

Finally, because there may be multiple criteria sets, each result also has a criteriaIndex property, indicating which criteria the result matched first (in order of their being added to the search service).

As for the new JavaScript component structure: I really have gotten tired of having a bunch of related JavaScript components duplicate the same boilerplate code over and over again, when they can all share the same space. So I created a new JavaScript component template, and organized it so the module code comes first. Then I added a special addConstructor() method to the module code, so individual components could just call that one line, and the module would recognize them. Since Gecko parses the entire component file before trying to call NSGetModule, everything still works. Best of all, I now have a simple template to drop new JavaScript components into the file.

Feedback, including suggestions for improvement, is welcome!

Posted by WeirdAl at 11:26 PM | Comments (2)

February 9, 2007

Editable UI for XUL?

Textbox demo

I had an idea late last night: what if I could position UI for configuring a XUL element without moving or resizing that element? This would give a decidedly WYSIWYG feel to editing XUL interfaces.

The above link is a demo of one way this might work. In essence, I'm emulating the <xul:popup/> element, but with XUL controls included and working. I'd like your feedback on it, including good practices for opening and closing the "context" box, and accessibility support.

There's also some strange happenings with shift+tab which I'd like help figuring out.

UPDATE: The shift-tab issues are bug 306058.

Posted by WeirdAl at 1:07 PM

February 8, 2007

Verbosio progress, 02/08/2007

While I tried to clean up source code editing in Verbosio, I ran into a serious problem: mozdev bug 16341. Basically, the XML document I was editing was pulling in DTD entities from the Verbosio application, not from the document's intended chrome URL's. In other words, Verbosio was getting confused about where to get source code from.

This little mistake is not easy to fix, unless Verbosio knows something about the context it's working in. This goes back to the question of "stand-alone" editing versus "repository" editing (which I tried, and failed, to define in a prior blog entry). Stand-alone editing means a bunch of files which are not related to each other. Repository editing refers to files which reference one another and/or link to one another, so edits to one affect other files as well.

For XML files which refer to other files (like localization DTD files), stand-alone editing cannot work. The entities in external files must load, or the XML document is not well-formed.

(Yes, I know Mozilla does strange things with external entities, that don't follow the XML spec. Deal with it. I have to.)

I had gone for stand-alone editing first, figuring that was going to be very simple. Now it's a stand-alone complex (pun intended) and a major (pun again intended) design flaw.

The solution, for now, is to implement a whole bunch of features I didn't want to implement this early. More importantly, I have to break stuff to fix stuff, again. This will give me basic support for one type of repository editing: XUL applications and extensions.

I had hoped to have Verbosio 0.1 ready in time for OSCON 2007 in Portland, OR. I seriously doubt that's going to happen now, but it might be halfway usable by then.

It's not all gloom and doom. Today I checked in the first big piece of the new approach: a file-system tree viewer. I'm almost certain I could have used a RDF datasource for this (rdf:files), but I needed this in a hurry, and RDF in XUL is something I still don't fully get. So I went with what I knew. If anyone wants to base this on RDF, I'll take patches.

Posted by WeirdAl at 10:15 PM

January 27, 2007

Verbosio progress, 01/27/2007

Lots of little things since my last update:

  • Source code editing (with some serious bugs for XML)
  • Minimal support for editing text documents
  • Saving documents Verbosio is editing
  • Using Verbosio to launch another copy of Verbosio

What does the last item mean? Think of software applications as objects (like fruits). Verbosio is an application (let's say a pear). Currently, when you run make-project.pl for Verbosio, you don't get one copy of Verbosio; you get two. (Cloning digital pears is cheap.) The first copy is the "default" copy, and uses the "default" profile. The second copy is a "testing" copy, using a "testing" profile. The default copy can open the testing copy.

Why would I want you to do this?

Verbosio's design is for a very scalable XML editor. Verbosio itself is mostly written in XUL (a XML language), XBL (another XML language), and JavaScript. So out of the box, Verbosio has strong potential to edit two of its three major language components. The third, JavaScript, Verbosio will also support editing. JavaScript is an integral technology for the WWW and for Gecko-based products and extensions in particular. Editing JS in Verbosio would eliminate another barrier for using Verbosio in the real (virtual) world - and move Verbosio closer to a "dogfood" status.

Alas, I'm not there yet. I knew instinctively that mozilla.org's XMLSerializer (which I do use a bit) wouldn't produce exactly the same document as what the user put in.

Case in point, these days I usually write my XML markup like this:

<vbox>
  <textbox id="myTextBox"
           multiline="true"
           rows="20"
           cols="15"
          />
</vbox>

Your way of writing XML will probably differ greatly. However, Verbosio currently treats this as:

<vbox>
  <textbox id="myTextBox" multiline="true" rows="20" cols="15"/>
</vbox>

It might be technically accurate, but it enforces its own code style on the user. That's really annoying, especially when you have to deal with a version control system like CVS or Subversion. I also have issues with expanded entities in <!DOCTYPE > tags.

So I'm going to make a special request now. I'd like people to comment to this blog entry with different examples of XML source code conventions. I need test documents, so I can write a "preserve source formatting" functionality for Verbosio. Please paste links to the examples; don't put the examples in-line. Please also make sure for longer examples that they are internally consistent (and as different from other posted examples as feasible). I'd really appreciate some basic "litmus tests" for this.

In the meantime, I'm going to work on other easy-fix items for Verbosio, such as closing a document, and on some larger-scale items, like opening a chrome CSS stylesheet by clicking on a link in a XUL document.

Posted by WeirdAl at 1:36 PM | Comments (2)

January 14, 2007

Verbosio progress, 01/14/2006

The second major piece of Verbosio 0.1, its XML Inspector extension module, is now in a semi-stable, "alpha" state.

The first major piece, the core architecture, isn't there yet. I have much more work to do, including implementing the other ten major pieces, before I can declare victory on that.

Recently, someone commented that they thought Verbosio was "just a fancy DOM inspector-type thing". Given what I've been talking about for months now, this is a very understandable assumption. Indeed, the XML Inspector module takes its inspiration directly from DOM Inspector (thank yous go out to hewitt, timeless, caillon, sdwilsh, and all the other contributors to DOM-I...), but actually is a completely new code base. Most of the features you find in DOM-I you won't find in this module. Many of the features are too much for Verbosio's needs, and a couple things Verbosio needed that are unlikely to return to DOM-I.

What will you find? Well, I've preserved the DOM Nodes view (that's your tree representation of the DOM). On the right hand panel, you'll be able to edit attributes, comments, processing instructions, text and character data nodes. You'll also be able to add attributes to elements. So far, nothing new.

Oh, and you'll also be able to create new elements from scratch. That's something DOM-I doesn't let you do right now.

Screenshots? You want screenshots? Okay. I'll give you screenshots. Bear in mind the whole UI is in a very early state; better editing capabilities than ordinary textboxes are on the schedule.

The biggest thing to note, though, is that I've developed 90% of the code the XML Inspector module uses for another major piece of Verbosio entirely. It's for the Verbosio markup template system I blogged about three months ago.

Posted by WeirdAl at 4:03 AM | Comments (1)

January 12, 2007

Verbosio Developer's Manual, initial draft

Although I've not yet marked any bugs fixed, I realized I needed to write down some of the core concepts in Verbosio, at a high level (not just code documentation). So I started writing the Verbosio Developer's Manual, first unofficial draft.

So if you have any interest in how it's supposed to wor