Implement nsIClassInfo on nsCommandLine

RESOLVED FIXED in mozilla1.9alpha3

Status

()

Toolkit
Startup and Profile System
RESOLVED FIXED
11 years ago
10 years ago

People

(Reporter: WeirdAl, Assigned: WeirdAl)

Tracking

unspecified
mozilla1.9alpha3
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

11 years ago
<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.

Comment 1

11 years ago
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.
(Assignee)

Comment 2

11 years ago
hm, actually a xpcshell test does work.
(Assignee)

Comment 3

11 years ago
Created attachment 255833 [details] [diff] [review]
patch, v1 (includes xpcshell test)
Attachment #255833 - Flags: first-review?
(Assignee)

Updated

11 years ago
Attachment #255833 - Flags: first-review? → first-review?(benjamin)
(Assignee)

Updated

11 years ago
Status: NEW → ASSIGNED
Flags: in-testsuite?
+  var commandLine = clClass.createInstance(Components.interfaces.nsISupports);

I wouldn't mention an interface there...

Comment 5

11 years ago
(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 6

11 years ago
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+
(Assignee)

Comment 7

11 years ago
Created attachment 256928 [details] [diff] [review]
patch revised for review comments

carrying over r+ from bsmedberg.
Attachment #255833 - Attachment is obsolete: true
Attachment #256928 - Flags: first-review+
(Assignee)

Updated

11 years ago
Whiteboard: [checkin needed]

Comment 8

11 years ago
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
Last Resolved: 11 years ago
Flags: in-testsuite? → in-testsuite+
Resolution: --- → FIXED
Whiteboard: [checkin needed]

Updated

11 years ago
Target Milestone: --- → mozilla1.9alpha3

Updated

10 years ago
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.