Mozilla/mozilla/xpfe/components/sample/resources/nsSampleAppShellComponent.html
rayw%netscape.com d9228441a4 Bug 37275, Changing value of all progids, and changing everywhere a progid
is mentioned to mention a contractid, including in identifiers.

r=warren


git-svn-id: svn://10.0.0.236/trunk@79036 18797224-902f-48f8-a5cc-f745e15eee43
2000-09-13 23:57:52 +00:00

64 lines
2.2 KiB
HTML

<html>
<head>
<script>
var title = "Sample Application Shell Component Test";
var contractid = "@mozilla.org/appshell/component/sample;1";
var iid = Components.interfaces.nsISampleAppShellComponent;
var observer = {
Observe: function( subject, topic, data ) {
dump( "observe called; subject=[" + subject + "] topic=[" + topic +
"] data=[" + data + "]\n" );
}
}
function RunTest() {
var sampleComponent = Components.classes[contractid].getService();
if ( sampleComponent ) {
dump("sampleComponent is " + sampleComponent + "\n" );
sampleComponent = sampleComponent.QueryInterface( iid );
if ( sampleComponent ) {
dump("sampleComponent is " + sampleComponent + "\n" );
sampleComponent.DoDialogTests( window, observer );
} else {
alert( "QueryInterface failed for " + contractid + "\n" );
}
} else {
alert( "getService failed for " + contractid + "\n" );
}
}
</script>
<title>
<script>document.write(title);</script>
</title>
</head>
<body>
<h1><center>
<script>document.write(title);</script>
</center></h1>
<p/>
This page provides a test of a sample "app shell component."
<p/>
Clicking on the button below will:
<ol>
<p/><li>Execute a JavaScript function that will use XPConnect to dynamically
access that sample component (as a "service" in the nsIServiceManager sense).
Specifically, it will invoke the "DoDialogTests()" member on that service.</li>
<p/><li>That will trigger display of a sequence of dialogs. The first will open
a dialog from C++. You enter some text on that dialog and press a button.</li>
<p/><li>That triggers display of a similar dialog from JavaScript. You enter
some text there and press another button.</li>
<p/><li>Finally, you return here and the results are displayed, demonstrating
that input was passed along to each dialog in turn and that the results
were passed back!</li>
</ol>
<p/>
This sample also demonstrates how to implement an interface in JavaScript and
how to use that interface to communicate with other code using the
nsIObserverService (that's how the results show up back here).
<center>
<button onclick="RunTest()">Click here to test</button>
</center>
<hr/>
</body>
</html>