Closed Bug 545266 Opened 14 years ago Closed 14 years ago

Setup toolkit component scaffolding and xpcshell test harness

Categories

(DevTools :: General, defect)

x86
All
defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ddahl, Assigned: ddahl)

References

Details

Attachments

(1 file, 14 obsolete files)

37.12 KB, patch
Details | Diff | Splinter Review
Testing should be the first priority when constructing a tool for developers to use.

I would like to work on this code in a TDD fashion.
Trying to set this toolkit stuff up like other toolkit/mozapps components,  getting a build error around the idl file:

nsIHUDService.idl
usage: /home/ddahl/code/moz/mozilla-central/obj-i686-pc-linux-gnu-debug/config/nsinstall [-C cwd] [-L linkprefix] [-m mode] [-o owner] [-g group]
                                                                                         [-DdltR] file [file ...] directory
make[6]: *** [libs] Error 2
make[5]: *** [libs] Error 2
make[4]: *** [hudservice_libs] Error 2
make[3]: *** [libs_tier_toolkit] Error 2
make[2]: *** [tier_toolkit] Error 2
make[1]: *** [default] Error 2
make: *** [build] Error 2
Attached patch 0.1 WIP patch with build errors (obsolete) — Splinter Review
Patch with build errors
Summary: Setup xpcshell test harness for console work → Setup toolkit component scaffolding and xpcshell test harness
I think the error is from the empty DIRS definition in toolkit/components/hudservice/tests/Makefile.in. Just remove the DIRS definition until you need to add anything.

Also, HUD service? Really?
Attached patch 0.2 WIP - building OK (obsolete) — Splinter Review
Ok, it builds now, but the idl must not be registered correctly:

js> Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");

XPCOMUtils.defineLazyServiceGetter(this, "hud",
                                   "@mozilla.org/hud-service;1",
                                   "nsIHUDService");
[object BackstagePass @ 0x8b7e240 (native @ 0x8b52a7c)]
js>
js> hud
file:///home/ddahl/code/moz/mozilla-central/obj-i686-pc-linux-gnu-debug/dist/bin/modules/XPCOMUtils.jsm:272: TypeError: Cc[aContract] is undefined
Attachment #426786 - Attachment is obsolete: true
Your problem is that the component itself isn't getting built, in the makefile you need:

EXTRA_PP_COMPONENTS = hudservice.js
Ok, so no wit is being built, but is null. I looked up the exception being thrown:

js> Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");

XPCOMUtils.defineLazyServiceGetter(this, "hud",
                                   "@mozilla.org/hud-service;1",
                                   "nsIHUDService");
[object BackstagePass @ 0x8344308 (native @ 0x84262dc)]
js> js> js> hud
uncaught exception: [Exception... "Component returned failure code: 0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE) [nsIJSCID.getService]"  nsresult: "0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE)"  location: "JS frame :: file:///home/ddahl/code/moz/mozilla-central/obj-i686-pc-linux-gnu-debug/dist/bin/modules/XPCOMUtils.jsm :: XPCU_serviceLambda :: line 272"  data: no]
js> 

This appears to be the real error message:

"service manager returned success, but service is null!"

from: http://mxr.mozilla.org/mozilla-central/source/js/src/xpconnect/src/xpcjsid.cpp#897
Attachment #426835 - Attachment is obsolete: true
Your generateQI doesn't include any interfaces, you need to include at least
nsIHUDService or you won't be able to QI to that.
 QueryInterface: XPCOMUtils.generateQI([Ci.nsIHUDService]),

  getInterfaces: function(countRef) {
    var interfaces = [Ci.nsIHUDService];
    countRef.value = interfaces.length;
    return interfaces;
  },

not like this, i assume?? ^^ 

since that throws the same error
Just like that but you haven't declared Cc and Ci at the top of your js file.
Actually I added the Cc, Ci, Cu constants. weird.
ah ok, when building I get failure:

this madness started up above make[10000]:

make[12]: *** [export] Error 2
make[11]: *** [export] Error 2
make[10]: *** [export] Error 2
make[9]: *** [export] Error 2
make[8]: *** [export] Error 2
make[7]: *** [export] Error 2
make[6]: *** [export] Error 2
make[5]: *** [export] Error 2
make[4]: *** [hudservice_export] Error 2
make[3]: *** [export_tier_toolkit] Error 2
make[2]: *** [tier_toolkit] Error 2
make[1]: *** [default] Error 2
make: *** [build] Error 2
whatever I am doing is spawning hundreds of make processes like this:

2370 pts/2    S+     0:00 make -C ../hudservice export
 2373 pts/2    S+     0:00 make -C ../hudservice export
 2376 pts/2    S+     0:00 make -C ../hudservice export

its doing this about 20,000 times:

make: Entering directory `/home/ddahl/code/moz/mozilla-central/obj-i686-pc-linux-gnu-debug/toolkit/components/hudservice'
make export
make[1]: Entering directory `/home/ddahl/code/moz/mozilla-central/obj-i686-pc-linux-gnu-debug/toolkit/components/hudservice'
/home/ddahl/code/moz/mozilla-central/obj-i686-pc-linux-gnu-debug/config/nsinstall -D ../../../dist/idl
/home/ddahl/code/moz/mozilla-central/obj-i686-pc-linux-gnu-debug/config/nsinstall -D ../../../dist/idl
ok, figureed it out. I had a DIRS declaration in the makefile that was errant:

DIRS = ../hudservice \
  $(NULL)

i removed it. now I have a real service running. on to some tests.
just saving it in a working state before I move it up into toolkit/console as per mossop's advice.
Attachment #427170 - Attachment is obsolete: true
Moved into toolkit/console, builds, tests run.
Attachment #427228 - Attachment is obsolete: true
Summary: Setup toolkit component scaffolding and xpcshell test harness → Setup toolkit component scaffolding and xpcshell and chrome browser test harness
Summary: Setup toolkit component scaffolding and xpcshell and chrome browser test harness → Setup toolkit component scaffolding and xpcshell test harness
Attached patch v 0.4 WIP (obsolete) — Splinter Review
Attachment #427236 - Attachment is obsolete: true
exciting!
Assignee: nobody → ddahl
Attachment #427509 - Attachment is obsolete: true
Attached patch 0.5.1 WIP forgot to add jar.mn (obsolete) — Splinter Review
Attachment #429655 - Attachment is obsolete: true
Attached patch 0.6 WIP (obsolete) — Splinter Review
Attachment #429660 - Attachment is obsolete: true
Attached patch 0.6.1 WIP (obsolete) — Splinter Review
so far so good. the service needs a battery of tests now:)
Attachment #429903 - Attachment is obsolete: true
Attached patch 0.6.3 WIP (obsolete) — Splinter Review
I need to re-create about:hud for the logging documents. I attempted to just use "about:blank" to no avail.
Attachment #430781 - Attachment is obsolete: true
Attached patch 0.6.2 WIP (obsolete) — Splinter Review
Whoops - previous patch was browser not toolkit
Attachment #431793 - Attachment is obsolete: true
Attached patch WIP 0.6.4 (obsolete) — Splinter Review
Still have invisible nodes being appended. May have some kind of .cloneNode() bug.
Attachment #431794 - Attachment is obsolete: true
Attachment #432055 - Attachment is patch: true
Attachment #432055 - Attachment mime type: application/octet-stream → text/plain
Attached patch WIP 0.6.5 (obsolete) — Splinter Review
Attachment #432055 - Attachment is obsolete: true
Attached patch WIP 0.6.6Splinter Review
Attachment #432093 - Attachment is obsolete: true
This code has some critical Firefox-tabbrowser dependencies, especially for a toolkit service. What's the go-forward plan to work around this? Should we be looking at making a simple, app-side (not in toolkit) JS XPCOM component to act as a bridge?
(In reply to comment #28)
> This code has some critical Firefox-tabbrowser dependencies, especially for a
> toolkit service. What's the go-forward plan to work around this? Should we be
> looking at making a simple, app-side (not in toolkit) JS XPCOM component to act
> as a bridge?

It does, and I have been thinking about it all weekend. I think instead of passing in a aTab object to the constructor, you pass in the parent DOM node you want the HUD to attach to as well as the node you insertBefore. Any other dependencies like this should be removed with more agnostic approaches, as I would like the HeadsUpDisplay .jsm to reside in toolkit and be consumed into the service as a factory. 

Mark: thanks for taking a peek at this.
Closing this bug, moving beginning implementation and new patches to bug 534398
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: