--- books/www/corrections.html 2003/02/10 17:43:32 1.74 +++ books/www/corrections.html 2003/04/01 16:24:25 1.113 @@ -1,9 +1,9 @@ - -

Corrections +

Corrections

This page contains a list of corrections to be made in the next printing of the book. If you have suggestions for changes or find errors in the text, @@ -12,30 +12,46 @@ section on the chapter pages, or send a href="mailto:reviewers@mozdev.org">reviewers@mozdev.org mailing list.

Note: All errors in the text and examples are shown in red and all corrections are shown in green. +class="fixed">blue. - +

Preface

- +

Chapter 1

- +

Chapter 2

- +

Chapter 3

- +

Chapter 4

    @@ -125,13 +184,13 @@ changed to '<descrip
  • On page 88: 'these are selectors are identical' has been changed to 'these selectors are identical'

    -
  • On page 109: 'The chome URL that the -moz-binding property points to' has been changed to 'The chrome URL that the -moz-binding property points to'

    +
  • On page 109: 'The chome URL that the -moz-binding property points to' has been changed to 'The chrome URL that the -moz-binding property points to'

- +

Chapter 5

    @@ -147,9 +206,25 @@ class="fixed">The chrome URL that the -m
  • On page 120: 'dump(l+'\n');' has been changed to 'dump(len+'\n');'

  • +
  • On page 123: Example 5-3 + +for (var i=0; i<chex.length; i++) + chex[i].setAttributte("checked", "false"); +for (var i=0; i<unchex.length; i++) + unchex[i].setAttributte("checked", "true"); + +has been changed to + +for (var i=0; i<chex.length; i++) + chex[i].setAttribute("disabled", "false"); +for (var i=0; i<unchex.length; i++) + unchex[i].setAttribute("disabled", "true"); + +
    +
  • +
  • On page 135: Example 5-11 has been changed to -<html> <head> <title>Sound Service Play Example</title> <script> @@ -158,24 +233,22 @@ class="fixed">The chrome URL that the -m var sample = Components.classes["@mozilla.org/sound;1"].createInstance(); sample = sample.QueryInterface(Components.interfaces.nsISound); const SND_NETWORK_STD_CID = "@mozilla.org/network/standard-url;1"; - const SND_I_URL = "nsIURL"; - const SND_URL = new C.Constructor(SND_NETWORK_STD_CID, SND_I_URL); - var url = new SND_URL(); - url.spec = 'http://jslib.mozdev.org/test.wav'; + const SND_I_URL = "nsIURL"; + const SND_URL = new C.Constructor(SND_NETWORK_STD_CID, SND_I_URL); + var url = new SND_URL(); + url.spec = 'http://jslib.mozdev.org/test.wav'; sample.play(url); } </script> </head> - <body> + <form name="form"> <input type="button" value="Play Sound" onclick="play();"> </form> - </body> -</html> -
  • -
  • On page 137: 'var connection = Components.classes ["@mozilla.org/network/ldap-connection;1";' has been changed to +
  • On page 137: 'var connection = Components.classes ["@mozilla.org/network/ldap-connection;1";' + has been changed to 'var connection = Components.classes ["@mozilla.org/network/ldap-connection;1"];'

  • @@ -185,44 +258,156 @@ load('chrome/jslib/jslib.js');
    '
    <
- + +

Chapter 6 + +

    + +
  • On page 145: Example 6-1 has been changed to + + +var myFile = "xFly.jar"; +initInstall( // initialize the installation + "Install xFly", // display name of installation + "xFly", // package name + "0.0.1", // version of install + 1); // flags - an optional argument, + // reserved for future use +f = getFolder("Chrome"); // specify a target directory +setPackageFolder(f); +addFile(myFile); // add software to the installation +registerChrome( + PACKAGE | DELAYED_CHROME, // chrome switch (i.e., type) + getFolder("Chrome","xFly.jar"), // destination of package + "content/xFly/"); // location of manifest in package +if (0 == getLastError( )) // if there have been no errors: + performInstall( ); // install "xfly.jar" +else // otherwise + cancelInstall( ); // cancel the installation. + + +
+ + +

Chapter 7 + +

    + +
  • On page 181: There are 3 errors in Figure 7-2 ...

    + +1) In the XUL box, 'klabel="Input Field"' should be 'label="Input Field"'

    + +2) In the XBL box, '<binding id+"inputfield">' should be '<binding id="inputfield">'

    + +3) In the XBL box, '<xul:label xbl:inherits="value+label"?>' should be '<xul:label xbl:inherits="value=label"/>'

    + +Here is a correct image (Click for bigger version):

    + +New Figure 7-2 + +
  • + +
+ +

+ +

Chapter 8

    -
  • On page 211: In 2nd sentence of paragraph 'QueryInterace' has been changed to 'QueryInterface'

    +
  • On page 211: In 2nd sentence of paragraph 'QueryInterace' has been +changed to 'QueryInterface'

  • -
  • On page 222: In Example 8-4 'mName: "a default value"' has been changed to 'mName: "a default -value",'

    +
  • On page 222: In Example 8-4 has been changed to: -
  • On page 222: In Example 8-4 + +function SimpleComponent(){} - <xmp class="broken"> - this.myCID, - "My JS Component", - this.myProgID, fileSpec, - location, true, true, - type); - +SimpleComponent.prototype = { -has been changed to + get yourName() { return this.mName; }, + set yourName(aName) { return this.mName = aName; }, - - compMgr.registerComponentWithType( - this.myCID, - "My JS Component", - this.myProgID, fileSpec, - location, true, true, - type); - + write: function () { dump("Hello " + this.mName + "\n"); }, + change: function (aValue) { this.mName = aValue; }, + mName: "a default value", + + QueryInterface: function (iid) { + if (!iid.equals(Components.interfaces.nsISimple) + && !iid.equals(Components.interfaces.nsISupports)) + { + throw Components.results.NS_ERROR_NO_INTERFACE; + } + return this; + } +} + +var Module = { + firstTime: true, + + registerSelf: function (compMgr, fileSpec, location, type) { + if (this.firstTime) { + dump("*** Deferring registration of simple JS components\n"); + this.firstTime = false; + throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN; + } + debug("*** Registering sample JS components\n"); + compMgr = +compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar); + compMgr.registerFactoryLocation(this.myCID, + "Simple JS Component", + this.myProgID, + fileSpec, + location, + type); + }, + + getClassObject : function (compMgr, cid, iid) { + if (!cid.equals(this.myCID)) + throw Components.results.NS_ERROR_NO_INTERFACE + if (!iid.equals(Components.interfaces.nsIFactory)) + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + return this.myFactory; + }, + + myCID: Components.ID("{98aa9afd-8b08-415b-91ed-01916a130d16}"), + myProgID: "@mozilla.org/js_simple_component;1", + + myFactory: { + createInstance: function (outer, iid) { + dump("CI: " + iid + "\n"); + if (outer != null) + throw Components.results.NS_ERROR_NO_AGGREGATION; + return (new SimpleComponent()).QueryInterface(iid); + } + }, + + canUnload: function(compMgr) { + dump("****** Unloading: Simple JS component! ****** \n"); + return true; + } +}; // END Module -
  • On page 222: In Example 8-4 one of the duplicate 'dump(" ***** Registering: Simple JS component! -****\n");' lines has been removed

    +function NSGetModule(compMgr, fileSpec) { return Module; } + +
  • -
  • On page 223: In Example 8-4 one of the duplicate 'if (outer != null)' lines has been removed

    +
  • On page 237: Example 8-13, line 9 + + NS_INIT_REFCNT( ); // has been depricated use NS_INIT_ISUPPORTS() + mValue = PL_strdup("default value"); + +has been changed to + + // NS_INIT_REFCNT( ); // has been depricated use NS_INIT_ISUPPORTS() + NS_INIT_ISUPPORTS(); + mValue = PL_strdup("default value"); + +
    +
  • -
  • On page 239: Example 8-15 has been changed to
    +
  • On page 239: Example 8-15 has been changed to
  • DEPTH = ../../.. @@ -265,17 +450,155 @@ install:: $(TARGETS) </ul> +<a name="ch9"></a> +<p><b>Chapter 9</b> -<a name="ch10"> +<ul> + +On page 247: '<b class="broken">When it appears inside the &lt;template&gt;, the &lt;listbox&gt; tag has two special attributes.</b>' +has been changed to '<b class="fixed">The &lt;listbox&gt; gains two special attributes when it contains a &lt;template&gt;.</b>' +<br><br> + +On page 250 '<b class="broken">"Using Data for Style,"</b>' has been changed to '<b class="fixed">"Using Data for Style",</b>' +<br><br> + +On page 254, Example 9-5, + +<xmp class="broken"> +' <rdf:Description about="urn:root"> + <fly:list</td>> + <rdf:Seq> + <rdf:li> + <rdf:Description ID="House"> + <fly:label</td>>House</fly:label> + <fly:list</td>> + <rdf:Seq> + <rdf:li> + <rdf:Description about="musca_autumnalis" + fly:label</td>="Face Fly"/> + </rdf:li> + <rdf:Seq> + </fly:list> + </rdf:li> + </rdf:Seq> + </fly:list> + </rdf:Description>' + + +has been changed to + + +' <rdf:Description about="urn:root"> + <fly:list</td>> + <rdf:Seq> + <rdf:li> + <rdf:Description ID="House"> + <fly:label</td>>House</fly:label> + </rdf:Description> + <fly:list</td> + <rdf:Seq> + <rdf:li> + <rdf:Description about="musca_autumnalis" + fly:label</td>="Face Fly"/> + </rdf:li> + <rdf:Seq> + </fly:list> + </rdf:li> + </rdf:Seq> + </fly:list> + </rdf:Description>' + + +
  • On page 255, Example 9-6 + + + <treecols> + <treecol id="LabelCol" flex="1" sort="?label" label="Name" + primary="true" /> + <treecol id="LoCol" flex="1" sort="?location" label="Location"/> + <treecol id="ColCol" flex="1" sort="?color" label="Color"/> + </treecols> + + +has been changed to + + + <treecols> + <treecol id="LabelCol" flex="1" + sort="rdf:http://xfly.mozdev.org/fly-rdf#label" + class="sortDirectionIndicator" primary="true" label="Name"/> + <treecol id="LoCol" flex="1" + sort="rdf:http://xfly.mozdev.org/fly-rdf#location" + label="Location"/> + <treecol id="ColCol" flex="1" + sort="rdf:http://xfly.mozdev.org/fly-rdf#color" + label="Color"/> + </treecols> + + +
  • On page 257: In Example 9-7 + + + <triple subject="?listitem" + predicate=" http://xfly.mozdev.org/fly-rdf#location" + object="?location"/> + + +has been changed to + + + <triple subject="?listitem" + predicate="fly-location#location" + object="?location"/> + + +On page 258 'The most important additions to Example 9-7 are the +container="?uri" member="?listitem" attributes on the <template>' has been +changed to 'The most important inclusions to Example 9-7 are the +container="?uri" member="?listitem" attributes on the <template>' +

    + +
+ +

Chapter 10

    -
  • On page 297: 'http://www.jslib.mozdev.org' has been changed -to 'http://jslib.mozdev.org'

  • + +
  • One page 268, In Example 10-1 '<rdf:Description about="http://my.jar-of-flies.com">' has been +changed to '<rdf:Description about="urn:root">'

    + +
  • On page 279: 'The URI is also accessible as a datasource property:' has been +changed to 'The URI, such as rdf:someName, is also accessible as a datasource +property:'

    + +
  • On page 280: In Table 10-3 'Mostly used for retrieving, datasources, resources, and literals.' has been +changed to 'Mostly used for retrieving datasources, resources, and literals.'

    + +
  • On page 288: + + +'containerUtils = Components.classes['@mozilla.org/rdf/container-utils;1' +getService(Components.interfaces.nsIRDFContainerUtils);' + + +has been changed to: + + +'containerUtils = Components.classes['@mozilla.org/rdf/container-utils;1']. +getService(Components.interfaces.nsIRDFContainerUtils);' + + +
  • On page 297: 'http://www.jslib.mozdev.org' has been changed to 'http://jslib.mozdev.org'

    + +
  • On page 297, Example 10-14: '// if(del)gRDF.removeSeq('types',false);' has been deleted. Not +needed in this example.

    +
- +

Chapter 11

- +

Chapter 12

- +

Appendix A

+ +

Index + +

+ +

- - +