Closed Bug 371052 Opened 17 years ago Closed 17 years ago

Implement nsIClassInfo on nsCommandLine

Categories

(Toolkit :: Startup and Profile System, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9alpha3

People

(Reporter: WeirdAl, Assigned: WeirdAl)

Details

Attachments

(1 file, 1 obsolete file)

<WeirdAl>	bsmedberg: when I open my XULRunner app, I'm passed a nsISupports for window.arguments[0]... what is it, what does it implement?
<bsmedberg>	WeirdAl: it's the nsICommandLine
WeirdAl: I guess we should make that implement classinfo, hrm?

I'm not sure how to write an automated test for this, though.  We don't yet have a test harness for XR apps.
mochitest could test this as chrome code:

cl = Cc["@mozilla.org/toolkit/command-line;1"].createInstance()

if ("length" in cl) {
  // TEST OK
}
else {
  // TEST FAILED
}

xpcshell currently doesn't use classinfo, so you couldn't do it in there.
hm, actually a xpcshell test does work.
Attachment #255833 - Flags: first-review?
Attachment #255833 - Flags: first-review? → first-review?(benjamin)
Status: NEW → ASSIGNED
Flags: in-testsuite?
+  var commandLine = clClass.createInstance(Components.interfaces.nsISupports);

I wouldn't mention an interface there...
(In reply to comment #0)
> <WeirdAl>       bsmedberg: when I open my XULRunner app, I'm passed a
> nsISupports for window.arguments[0]... what is it, what does it implement?
> <bsmedberg>     WeirdAl: it's the nsICommandLine
> WeirdAl: I guess we should make that implement classinfo, hrm?
Note that if all you want to do is to avoid having to call window.arguments[0].QueryInterface(Components.interfaces.nsICommandLine) then just wrap the nsICommandLineObject in an nsISupportsInterfacePointer with the right IID (see nsJSEnvironment.cpp nsJSContext::AddSupportsPrimitivesTojsvals)
Comment on attachment 255833 [details] [diff] [review]
patch, v1 (includes xpcshell test)

>Index: toolkit/components/commandlines/test/Makefile.in

>+#
>+# Makefile for installing and running xpcshell-based tests. You can use 
>+# this file as template when creating tests for a new module. Don't 
>+# forget to change the lines marked below. See 
>+# http://developer.mozilla.org/en/docs/Writing_xpcshell-based_unit_tests
>+# for detailed instructions.
>+#

Remove this and other comments that were part of the makefile template.

>+# Note: Invoke any additional (non-xpcshell) test programs here.
>+check::

Remove this empty and unnecessary rule entirely.

>Index: toolkit/components/commandlines/test/unit/test_classinfo.js

>+  var commandLine = clClass.createInstance(Components.interfaces.nsISupports);

As noted, this should just be createInstance(). No need to mention isupports explicitly.
Attachment #255833 - Flags: first-review?(benjamin) → first-review+
carrying over r+ from bsmedberg.
Attachment #255833 - Attachment is obsolete: true
Attachment #256928 - Flags: first-review+
Whiteboard: [checkin needed]
mozilla/toolkit/components/commandlines/Makefile.in                  1.3
mozilla/toolkit/components/commandlines/src/nsCommandLine.cpp        1.14
mozilla/toolkit/components/commandlines/test/Makefile.in             1.1
mozilla/toolkit/components/commandlines/test/unit/test_classinfo.js  1.1
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Flags: in-testsuite? → in-testsuite+
Resolution: --- → FIXED
Whiteboard: [checkin needed]
Target Milestone: --- → mozilla1.9alpha3
Component: XRE Startup → Startup and Profile System
QA Contact: xre.startup → startup
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: