diff --git a/mozilla/xpcom/sample/Makefile.in b/mozilla/xpcom/sample/Makefile.in
index c650559907e..7057ae13129 100644
--- a/mozilla/xpcom/sample/Makefile.in
+++ b/mozilla/xpcom/sample/Makefile.in
@@ -39,4 +39,5 @@ include $(topsrcdir)/config/rules.mk
install:: $(TARGETS)
$(INSTALL) $(srcdir)/xpconnect-sample.html $(DIST)/bin/res/samples
+ $(INSTALL) $(srcdir)/nsSample.js $(DIST)/bin/components
diff --git a/mozilla/xpcom/sample/makefile.win b/mozilla/xpcom/sample/makefile.win
index a8e251ffb40..cb3d9d05877 100644
--- a/mozilla/xpcom/sample/makefile.win
+++ b/mozilla/xpcom/sample/makefile.win
@@ -45,5 +45,6 @@ include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) $(DLL) $(DIST)\bin\components
+ $(MAKE_INSTALL) nsSample.js $(DIST)\bin\components
$(MAKE_INSTALL) xpconnect-sample.html $(DIST)\bin\res\samples
diff --git a/mozilla/xpcom/sample/nsSampleFactory.cpp b/mozilla/xpcom/sample/nsSampleFactory.cpp
index 88e37678d9d..643ccfed06f 100644
--- a/mozilla/xpcom/sample/nsSampleFactory.cpp
+++ b/mozilla/xpcom/sample/nsSampleFactory.cpp
@@ -297,7 +297,7 @@ NSRegisterSelf(nsISupports* aServMgr , const char* aPath)
rv = compMgr->RegisterComponent(kSampleCID,
"Sample World Component",
- "component://netscape/sample/sample-world",
+ "component://mozilla/sample/sample-world",
aPath, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
diff --git a/mozilla/xpcom/sample/xpconnect-sample.html b/mozilla/xpcom/sample/xpconnect-sample.html
index e9fd9ed90a1..687537dd5f3 100644
--- a/mozilla/xpcom/sample/xpconnect-sample.html
+++ b/mozilla/xpcom/sample/xpconnect-sample.html
@@ -30,7 +30,7 @@ using the Components object, then accesses it through
the nsISample interface by calling QueryInterface:
-var sample = Components.classes["component://netscape/sample/sample-world"].createInstance(); +var sample = Components.classes["component://mozilla/sample/sample-world"].createInstance(); sample = sample.QueryInterface(Components.interfaces.nsISample);@@ -39,26 +39,30 @@ The buttons on the form are connected to JavaScript event handlers which call the methods defined in C++. -
nsISample.idl +
This is the interface declaration for the XPCOM object. It defines
two functions, their parameters, and one attribute. It also defines
the interface's id. The idl file is compiled by the xpidl compiler
into a C++ header, nsISample.h and a .xpt file which is a binary representation
of the interface used at runtime.
-
attribute string Value;
-
void WriteValue(in string aPrefix);
-
void Poke(in string aValue);
-
nsSample.cpp
+
attribute string value;
+
void writeValue(in string aPrefix);
+
void poke(in string aValue);
+
This contains the implementation of nsISample.idl. SampleImpl
inherits from nsISample.h, the header dynamically created by the xpidl
compiler. The attribute Value has been expanded into a get and set
and the return values have been modified to NS_IMETHOD, a success status
-for the method. The macro NS_DECL_ISUPPORTS, defined in mozilla/xpcom/public/nsISupportsUtils.h
+for the method. The macro NS_DECL_ISUPPORTS, defined in mozilla/xpcom/public/nsISupportsUtils.h
defines the inherited methods from nsISupports.h.
NS_IMPL_ISUPPORTS(SampleImpl, nsISample::GetIID());
In the constructor, the macro NS_INIT_REFCNT is called which sets the
-reference count to 0.
-
nsSampleFactory.cpp +reference count to 0.
+Note that the methods in the C++ bindings use InterCaps style, while the IDL +and JavaScript versions should use interCaps naming. The JavaScript binding +matches the case of the IDL, except QueryInterface. +
This is the class which builds the instance of the nsSample class. The COM framework uses factories to create instance of implementations rather than having the implementations instatiate themselves in order to @@ -67,6 +71,9 @@ which is also an XPCOM object. To gain more knowledge of factories see the generic factory document or the Modularization techniques document. +
This file implements the nsISample interface, and associated factory glue, +in JavaScript.