home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2005 October / Gamestar_77_2005-10_dvd.iso / Programy / nsb-install-8-0.exe / chrome / toolkit.jar / content / global / bindings / browser.xml < prev    next >
Extensible Markup Language  |  2005-07-29  |  48KB  |  1,421 lines

  1. <?xml version="1.0"?>
  2.  
  3. <!--
  4.    - The contents of this file are subject to the Mozilla Public
  5.    - License Version 1.1 (the "License"); you may not use this file
  6.    - except in compliance with the License. You may obtain a copy of
  7.    - the License at http://www.mozilla.org/MPL/
  8.    -
  9.    - Software distributed under the License is distributed on an "AS
  10.    - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  11.    - implied. See the License for the specific language governing
  12.    - rights and limitations under the License.
  13.    -
  14.    - The Original Code is this file as it was released on
  15.    - March 28, 2001.
  16.    -
  17.    - The Initial Developer of the Original Code is Peter Annema.
  18.    - Portions created by Peter Annema are Copyright (C) 2001
  19.    - Peter Annema.  All Rights Reserved.
  20.    -
  21.    - Contributor(s):
  22.    -   Peter Annema <disttsc@bart.nl> (Original Author of <browser>)
  23.    -
  24.    - Alternatively, the contents of this file may be used under the
  25.    - terms of the GNU General Public License Version 2 or later (the
  26.    - "GPL"), in which case the provisions of the GPL are applicable
  27.    - instead of those above.  If you wish to allow use of your
  28.    - version of this file only under the terms of the GPL and not to
  29.    - allow others to use your version of this file under the MPL,
  30.    - indicate your decision by deleting the provisions above and
  31.    - replace them with the notice and other provisions required by
  32.    - the GPL.  If you do not delete the provisions above, a recipient
  33.    - may use your version of this file under either the MPL or the
  34.    - GPL.
  35.   -->
  36.  
  37. <!DOCTYPE window [
  38.   <!ENTITY % findBarDTD SYSTEM "chrome://global/locale/findBar.dtd" >
  39.   %findBarDTD;
  40. ]>
  41.  
  42. <bindings id="browserBindings"
  43.           xmlns="http://www.mozilla.org/xbl"
  44.           xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  45.  
  46.   <binding id="browser" extends="xul:browser">
  47.     <implementation type="application/x-javascript" implements="nsIAccessibleProvider, nsIObserver">
  48.       <property name="accessible">
  49.         <getter>
  50.           <![CDATA[
  51.             var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
  52.             return accService.createOuterDocAccessible(this);
  53.           ]]>
  54.         </getter>
  55.       </property>
  56.  
  57.       <property name="autoscrollEnabled">
  58.         <getter>
  59.           <![CDATA[
  60.             if (this.getAttribute("autoscroll") == "false")
  61.               return false;
  62.  
  63.             var enabled = true;
  64.             try {
  65.               enabled = this.mPrefs.getBoolPref("general.autoScroll");
  66.             }
  67.             catch(ex) {
  68.             }
  69.  
  70.             return enabled;
  71.           ]]>
  72.         </getter>
  73.       </property>
  74.  
  75.       <property name="canGoBack"
  76.                 onget="return this.webNavigation.canGoBack;"
  77.                 readonly="true"/>
  78.  
  79.       <property name="canGoForward"
  80.                 onget="return this.webNavigation.canGoForward;"
  81.                 readonly="true"/>
  82.  
  83.       <method name="goBack">
  84.         <body>
  85.           <![CDATA[
  86.             var webNavigation = this.webNavigation;
  87.             if (webNavigation.canGoBack)
  88.               webNavigation.goBack();
  89.           ]]>
  90.         </body>
  91.       </method>
  92.  
  93.       <method name="goForward">
  94.         <body>
  95.           <![CDATA[
  96.             var webNavigation = this.webNavigation;
  97.             if (webNavigation.canGoForward)
  98.               webNavigation.goForward();
  99.           ]]>
  100.         </body>
  101.       </method>
  102.  
  103.       <method name="reload">
  104.         <body>
  105.           <![CDATA[
  106.             const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
  107.             const flags = nsIWebNavigation.LOAD_FLAGS_NONE;
  108.             this.reloadWithFlags(flags);
  109.           ]]>
  110.         </body>
  111.       </method>
  112.  
  113.       <method name="reloadWithFlags">
  114.         <parameter name="aFlags"/>
  115.         <body>
  116.           <![CDATA[
  117.             this.webNavigation.reload(aFlags);
  118.           ]]>
  119.         </body>
  120.       </method>
  121.  
  122.       <method name="stop">
  123.         <body>
  124.           <![CDATA[
  125.             const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
  126.             const flags = nsIWebNavigation.STOP_ALL;
  127.             this.webNavigation.stop(flags);
  128.           ]]>
  129.         </body>
  130.       </method>
  131.  
  132.       <!-- throws exception for unknown schemes -->
  133.       <method name="loadURI">
  134.         <parameter name="aURI"/>
  135.         <parameter name="aReferrerURI"/>
  136.         <parameter name="aCharset"/>
  137.         <body>
  138.           <![CDATA[
  139.             const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
  140.             const flags = nsIWebNavigation.LOAD_FLAGS_NONE;
  141.             this.loadURIWithFlags(aURI, flags, aReferrerURI, aCharset);
  142.           ]]>
  143.         </body>
  144.       </method>
  145.  
  146.       <!-- throws exception for unknown schemes -->
  147.       <method name="loadURIWithFlags">
  148.         <parameter name="aURI"/>
  149.         <parameter name="aFlags"/>
  150.         <parameter name="aReferrerURI"/>
  151.         <parameter name="aCharset"/>
  152.         <parameter name="aPostData"/>
  153.         <body>
  154.           <![CDATA[
  155.               // autocomplete fix : JMC
  156.               if (this.webNavigation.browserEngine == 'Gecko' && !this.mFormFillAttached)
  157.               {
  158.                   this.attachFormFill();
  159.               }
  160.           
  161.             if (!aURI)
  162.               aURI = "about:blank";
  163.  
  164.             if (aCharset) {
  165.               try {
  166.                 this.documentCharsetInfo.parentCharset = this.mAtomService.getAtom(aCharset);
  167.               }
  168.               catch (e) {
  169.               }
  170.             }
  171.             this.mFavIconURL = null;
  172. //JA ff5->vulp
  173.  
  174.             var regex = /^about:/;
  175.             // if the URL is 'about:*'
  176.             if (regex.test(aURI)) {
  177.               // switch engine to Gecko for all except 'about:blank'
  178.               if (aURI != 'about:blank')
  179.                 this.webNavigation.browserEngine = 'Gecko';
  180.             }
  181.             else
  182.             {
  183.               //if (!gURIFixup) , not availabe in the scope when running Venkman
  184.               var uriFixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
  185.                                        .getService(Components.interfaces.nsIURIFixup);
  186.               var fixedUpURI = uriFixup.createFixupURI(aURI, 0);
  187.               // Don't allow anything without a "host" portion through here, or it crashes below.
  188.               if (fixedUpURI.scheme=="x-jsd" ||
  189.                   fixedUpURI.scheme=="about" ||
  190.                   fixedUpURI.scheme=="mailto" ||
  191.                   fixedUpURI.scheme=="javascript")
  192.               {
  193.                  this.webNavigation.browserEngine="Gecko";
  194.               } else {
  195.                  // Accommodate any garbage that makes it this far.
  196.                  var fixedUpHost = "";
  197.                  try {
  198.                     fixedUpHost = fixedUpURI.host;
  199.                  } catch( e ) {}
  200.  
  201.                  if (fixedUpHost == "") {
  202.                     this.webNavigation.browserEngine="Gecko";
  203.                  } else {
  204.                      var bControlled = sitecontrols.SCSVC.isControlledSite(fixedUpHost);
  205.                      if (bControlled) {
  206.                         this.webNavigation.browserEngine =
  207.                            sitecontrols.SCSVC.readSiteControl(fixedUpHost, "displayEngine");
  208.                      } else {
  209.                         this.webNavigation.browserEngine =
  210.                            sitecontrols.SCSVC.readSiteControl(sitecontrols.DEFAULT_SITE, "displayEngine");
  211.                      }
  212.                  }
  213.               }
  214.             }
  215. //JA end
  216.             this.webNavigation.loadURI(aURI, aFlags, aReferrerURI, aPostData, null);
  217.           ]]>
  218.         </body>
  219.       </method>
  220.  
  221.       <method name="goHome">
  222.         <body>
  223.           <![CDATA[
  224.             try {
  225.               this.loadURI(this.homePage);
  226.             }
  227.             catch (e) {
  228.             }
  229.           ]]>
  230.         </body>
  231.       </method>
  232.  
  233.       <property name="homePage">
  234.         <getter>
  235.           <![CDATA[
  236.             var uri;
  237.  
  238.             if (this.hasAttribute("homepage"))
  239.               uri = this.getAttribute("homepage");
  240.             else
  241.               uri = "http://www.netscape.com/"; // widget pride
  242.  
  243.             return uri;
  244.           ]]>
  245.         </getter>
  246.         <setter>
  247.           <![CDATA[
  248.             this.setAttribute("homepage", val);
  249.             return val;
  250.           ]]>
  251.         </setter>
  252.       </property>
  253.  
  254.       <method name="gotoIndex">
  255.         <parameter name="aIndex"/>
  256.         <body>
  257.           <![CDATA[
  258.             this.webNavigation.gotoIndex(aIndex);
  259.           ]]>
  260.         </body>
  261.       </method>
  262.  
  263.       <property name="currentURI"
  264.                 onget="return this.webNavigation.currentURI;"
  265.                 readonly="true"/>
  266.  
  267.       <property name="preferences"
  268.                 onget="return Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefService);"
  269.                 readonly="true"/>
  270.  
  271.       <property name="docShell"
  272.                 onget="return this.boxObject.QueryInterface(Components.interfaces.nsIBrowserBoxObject).docShell;"
  273.                 readonly="true"/>
  274.  
  275.       <property name="webNavigation"
  276.                 onget="return this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation);"
  277.                 readonly="true"/>
  278.  
  279.       <field name="_webBrowserFind">null</field>
  280.  
  281.       <property name="webBrowserFind"
  282.                 readonly="true">
  283.         <getter>
  284.         <![CDATA[
  285.           if (!this._webBrowserFind)
  286.             this._webBrowserFind = this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebBrowserFind);
  287.           return this._webBrowserFind;
  288.         ]]>
  289.         </getter>
  290.       </property>
  291.  
  292.       <field name="_fastFind">null</field>
  293.       <property name="fastFind"
  294.                 readonly="true">
  295.         <getter>
  296.         <![CDATA[
  297.           if (!this._fastFind) {
  298.             var n = this.parentNode;
  299.             while (n && n.localName != "tabbrowser")
  300.               n = n.parentNode;
  301.  
  302.             if (n && n.mCurrentBrowser == this)
  303.               return this._fastFind = n.fastFind
  304.  
  305.             this._fastFind = Components.classes["@mozilla.org/typeaheadfind;1"]
  306.                                        .createInstance(Components.interfaces.nsITypeAheadFind);
  307.             this._fastFind.init(this.docShell);
  308.           }
  309.           return this._fastFind;
  310.         ]]>
  311.         </getter>
  312.       </property>
  313.  
  314.       <property name="findString" readonly="true">
  315.         <getter>
  316.         <![CDATA[
  317.           return this.fastFind.searchString;
  318.         ]]>
  319.         </getter>
  320.       </property>
  321.  
  322.       <property name="webProgress"
  323.                 readonly="true"
  324.                 onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebProgress);"/>
  325.  
  326.       <property name="contentWindow"
  327.                 readonly="true"
  328.                 onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);"/>
  329.  
  330.       <property name="sessionHistory"
  331.                 onget="return this.webNavigation.sessionHistory;"
  332.                 readonly="true"/>
  333.  
  334.       <property name="markupDocumentViewer"
  335.                 onget="return this.docShell.contentViewer.QueryInterface(Components.interfaces.nsIMarkupDocumentViewer);"
  336.                 readonly="true"/>
  337.  
  338.       <property name="contentViewerEdit"
  339.                 onget="return this.docShell.contentViewer.QueryInterface(Components.interfaces.nsIContentViewerEdit);"
  340.                 readonly="true"/>
  341.  
  342.       <property name="contentViewerFile"
  343.                 onget="return this.docShell.contentViewer.QueryInterface(Components.interfaces.nsIContentViewerFile);"
  344.                 readonly="true"/>
  345.  
  346.       <property name="documentCharsetInfo"
  347.                 onget="return this.docShell.documentCharsetInfo;"
  348.                 readonly="true"/>
  349.  
  350.       <property name="contentDocument"
  351.                 onget="return this.webNavigation.document;"
  352.                 readonly="true"/>
  353.  
  354.       <property name="contentTitle"
  355.                 onget="return Components.lookupMethod(this.contentDocument, 'title').call(this.contentDocument);"
  356.                 readonly="true"/>
  357.  
  358.       <field name="mPrefs" readonly="true">
  359.         Components.classes['@mozilla.org/preferences-service;1']
  360.                   .getService(Components.interfaces.nsIPrefService)
  361.                   .getBranch(null);
  362.       </field>
  363.  
  364.       <field name="mAtomService" readonly="true">
  365.         Components.classes['@mozilla.org/atom-service;1']
  366.                   .getService(Components.interfaces.nsIAtomService);
  367.       </field>
  368.  
  369.       <field name="_mStrBundle">null</field>
  370.  
  371.       <property name="mStrBundle">
  372.         <getter>
  373.         <![CDATA[
  374.           if (!this._mStrBundle) {
  375.             // need to create string bundle manually instead of using <xul:stringbundle/>
  376.             // see bug 63370 for details
  377.             var localeService = Components.classes["@mozilla.org/intl/nslocaleservice;1"]
  378.                                   .getService(Components.interfaces.nsILocaleService);
  379.             var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
  380.                                   .getService(Components.interfaces.nsIStringBundleService);
  381.             var bundleURL = "chrome://global/locale/tabbrowser.properties";
  382.             this._mStrBundle = stringBundleService.createBundle(bundleURL, localeService.getApplicationLocale());
  383.           }
  384.           return this._mStrBundle;
  385.         ]]></getter>
  386.       </property>
  387.  
  388.       <method name="addProgressListener">
  389.         <parameter name="aListener"/>
  390.         <body>
  391.           <![CDATA[
  392.             this.webProgress.addProgressListener(aListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
  393.           ]]>
  394.         </body>
  395.       </method>
  396.  
  397.       <method name="removeProgressListener">
  398.         <parameter name="aListener"/>
  399.         <body>
  400.           <![CDATA[
  401.             this.webProgress.removeProgressListener(aListener);
  402.          ]]>
  403.         </body>
  404.       </method>
  405.  
  406.       <method name="attachFormFill">
  407.         <body>
  408.           <![CDATA[
  409.           if (!this.mFormFillAttached && this.hasAttribute("autocompletepopup") 
  410.           && (this.webNavigation.browserEngine == 'Gecko') && (this.docShell && this.docShell.contentViewer)) {
  411.             // hoop up the form fill autocomplete controller
  412.             var controller = Components.classes["@mozilla.org/satchel/form-fill-controller;1"].
  413.                                getService(Components.interfaces.nsIFormFillController);
  414.  
  415.             var popup = document.getElementById(this.getAttribute("autocompletepopup"));
  416.             if (popup)
  417.               controller.attachToBrowser(this.docShell, popup.QueryInterface(Components.interfaces.nsIAutoCompletePopup));
  418.  
  419.             this.mFormFillAttached = true;
  420.           }
  421.           ]]>
  422.         </body>
  423.       </method>
  424.  
  425.       <method name="detachFormFill">
  426.         <body>
  427.           <![CDATA[
  428.           if (this.mFormFillAttached) {
  429.             // hoop up the form fill autocomplete controller
  430.             var controller = Components.classes["@mozilla.org/satchel/form-fill-controller;1"].
  431.                                getService(Components.interfaces.nsIFormFillController);
  432.             controller.detachFromBrowser(this.docShell);
  433.  
  434.             this.mFormFillAttached = false;
  435.           }
  436.           ]]>
  437.         </body>
  438.       </method>
  439.  
  440.       <method name="findChildShell">
  441.         <parameter name="aDocShell"/>
  442.         <parameter name="aSoughtURI"/>
  443.         <body>
  444.           <![CDATA[
  445.             if (aDocShell.QueryInterface(Components.interfaces.nsIWebNavigation)
  446.                          .currentURI.spec == aSoughtURI.spec)
  447.               return aDocShell;
  448.             var node = aDocShell.QueryInterface(
  449.                                    Components.interfaces.nsIDocShellTreeNode);
  450.             for (var i = 0; i < node.childCount; ++i) {
  451.               var docShell = node.getChildAt(i);
  452.               docShell = this.findChildShell(docShell, aSoughtURI);
  453.               if (docShell)
  454.                 return docShell;
  455.             }
  456.             return null;
  457.           ]]>
  458.         </body>
  459.       </method>
  460.  
  461.       <method name="onLoad">
  462.         <parameter name="aEvent"/>
  463.         <body>
  464.           <![CDATA[
  465.             this.attachFormFill();
  466.  
  467.             /* MERC - JCH: this messes up the pageReport array
  468.             dump("\n --------------------------- BROWSER.XML  WE SHOULD NOT GET HERE ------------------\n");
  469.             if (this.pageReport) {
  470.               var i = 0;
  471.               while (i < this.pageReport.length) {
  472.                 if (this.findChildShell(this.docShell,
  473.                                         this.pageReport[i].requestingWindowURI))
  474.                   i++;
  475.                 else
  476.                   this.pageReport.splice(i, 1);
  477.               }
  478.               if (this.pageReport.length == 0) {
  479.                 this.pageReport = null;
  480.                 this.updatePageReport();
  481.               }
  482.             }
  483.             */
  484.          ]]>
  485.         </body>
  486.       </method>
  487.  
  488.       <method name="onUnload">
  489.         <parameter name="aEvent"/>
  490.         <body>
  491.           <![CDATA[
  492.  
  493.             if (this.pageReport) {
  494.               //this.pageReport = null;
  495.               // MERC - JCH: remove pageReport icon
  496.               this.showPageReportIcon = false;
  497.               this.updatePageReport();
  498.             }
  499.          ]]>
  500.         </body>
  501.       </method>
  502.  
  503.       <method name="updatePageReport">
  504.         <body>
  505.           <![CDATA[
  506.  
  507.             var n = this.parentNode;
  508.             while (n && n.localName != "tabbrowser")
  509.               n = n.parentNode;
  510.  
  511.             if (!n || n.mCurrentBrowser != this) return;
  512.  
  513.             var event = document.createEvent("Events");
  514.             event.initEvent("DOMUpdatePageReport", true, true);
  515.             n.dispatchEvent(event);
  516.  
  517.           ]]>
  518.         </body>
  519.       </method>
  520.  
  521.       <method name="onPopupBlocked">
  522.         <parameter name="evt"/>
  523.         <body>
  524.           <![CDATA[
  525.  
  526.             if (!this.pageReport) {
  527.               this.pageReport = new Array();
  528.  
  529.               // this.updatePageReport();
  530.             }
  531.  
  532.             var found = false;
  533.             var tmpStr = sitecontrols.SCSVC.getDomainString(evt.requestingWindowURI.spec, false);
  534.             for (var i = 0; i < this.pageReport.length; i++) {
  535.               if (this.pageReport[i] == tmpStr) {
  536.                 found = true;
  537.                 break;
  538.               }
  539.             }
  540.  
  541.             if (!found) {
  542.               // We don't use this object, but let's keep it around to show what
  543.               // the event contains
  544.               var obj = { requestingWindowURI: evt.requestingWindowURI,
  545.                           popupWindowURI: evt.popupWindowURI,
  546.                           popupWindowFeatures: evt.popupWindowFeatures };
  547.               this.pageReport.push(tmpStr);
  548.             }
  549.  
  550.  
  551.             this.showPageReportIcon = true;
  552.             this.updatePageReport();
  553.           ]]>
  554.         </body>
  555.       </method>
  556.  
  557.       <field name="pageReport">null</field>
  558.  
  559.       // MERC - JC : need for determining when to show pageReport
  560.       <field name="showPageReportIcon">false</field>
  561.  
  562.       <field name="mDragDropHandler">
  563.         null
  564.       </field>
  565.  
  566.       <field name="securityUI">
  567.         null
  568.       </field>
  569.  
  570.       <field name="userTypedClear">
  571.         true
  572.       </field>
  573.  
  574.       <field name="_userTypedValue">
  575.         null
  576.       </field>
  577.  
  578.       <property name="userTypedValue"
  579.                 onget="return this._userTypedValue;"
  580.                 onset="this.userTypedClear = false; return this._userTypedValue = val;"/>
  581.  
  582.       <field name="mFormFillAttached">
  583.         false
  584.       </field>
  585.  
  586.       <field name="focusedWindow">
  587.         null
  588.       </field>
  589.  
  590.       <field name="focusedElement">
  591.         null
  592.       </field>
  593.  
  594.       <field name="isShowingMessage">
  595.         false
  596.       </field>
  597.  
  598.       <field name="mFavIconURL">null</field>
  599.  
  600.       <constructor>
  601.         <![CDATA[
  602.           try {
  603.             if (!this.hasAttribute("disablehistory")) {
  604.               // wire up session history
  605.               this.webNavigation.sessionHistory = Components.classes["@mozilla.org/browser/shistory;1"].createInstance(Components.interfaces.nsISHistory);
  606.               var os = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
  607.               os.addObserver(this, "browser:purge-session-history", false);
  608.               // enable global history
  609.               this.docShell.QueryInterface(Components.interfaces.nsIDocShellHistory).useGlobalHistory = true;
  610.             }
  611.           }
  612.           catch (e) {
  613.           }
  614.           try {
  615.             this.mDragDropHandler = Components.classes["@mozilla.org:/content/content-area-dragdrop;1"].createInstance(Components.interfaces.nsIDragDropHandler);
  616.             this.mDragDropHandler.hookupTo(this, null);
  617.           }
  618.           catch (e) {
  619.           }
  620.           try {
  621.             const SECUREBROWSERUI_CONTRACTID = "@mozilla.org/secure_browser_ui;1";
  622.             if (!this.hasAttribute("disablesecurity") &&
  623.                 SECUREBROWSERUI_CONTRACTID in Components.classes) {
  624.               this.securityUI = Components.classes[SECUREBROWSERUI_CONTRACTID].createInstance(Components.interfaces.nsISecureBrowserUI);
  625.               this.securityUI.init(this.contentWindow);
  626.             }
  627.           }
  628.           catch (e) {
  629.           }
  630.  
  631.           // Listen for first load for lazy attachment to form fill controller
  632.           this.addEventListener("load", this.onLoad, true);
  633.           this.addEventListener("unload", this.onUnload, true);
  634.           this.addEventListener("DOMPopupBlocked", this.onPopupBlocked, false);
  635.         ]]>
  636.       </constructor>
  637.  
  638.       <destructor>
  639.         <![CDATA[
  640.           this.destroy();
  641.         ]]>
  642.       </destructor>
  643.  
  644.       <!-- This is necessary because the destructor doesn't always get called when
  645.            we are removed from a tabbrowser. This will be explicitly called by tabbrowser -->
  646.       <method name="destroy">
  647.         <body>
  648.           <![CDATA[
  649.           if (!this.hasAttribute("disablehistory")) {
  650.             var os = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
  651.             try {
  652.               os.removeObserver(this, "browser:purge-session-history", false);
  653.             } catch(e) {}
  654.           }
  655.  
  656.           if (this.mDragDropHandler)
  657.             this.mDragDropHandler.detach();
  658.           this.mDragDropHandler = null;
  659.  
  660.           this.detachFormFill();
  661.  
  662.           this.securityUI = null;
  663.           this._fastFind = null;
  664.  
  665.           this.removeEventListener("load", this.onLoad, true);
  666.           this.removeEventListener("unload", this.onUnload, true);
  667.           this.removeEventListener("DOMPopupBlocked", this.onPopupBlocked, true);
  668.           ]]>
  669.         </body>
  670.       </method>
  671.  
  672.       <method name="observe">
  673.         <parameter name="aSubject"/>
  674.         <parameter name="aTopic"/>
  675.         <parameter name="aState"/>
  676.         <body>
  677.           <![CDATA[
  678.             if (aTopic != "browser:purge-session-history")
  679.               return;
  680.  
  681.             var purge = this.sessionHistory.count;
  682.             if (this.currentURI != "about:blank")
  683.               --purge; // Don't remove the page the user's staring at from shistory
  684.  
  685.             <!-- JCH: Passing in zero causes exception -->
  686.             if (purge > 0)
  687.               this.sessionHistory.PurgeHistory(purge);
  688.           ]]>
  689.         </body>
  690.       </method>
  691.  
  692.       <field name="_AUTOSCROLL_SPEED">3</field>
  693.       <field name="_AUTOSCROLL_SNAP">10</field>
  694.       <field name="_clientFrameDoc">null</field>
  695.       <field name="_isScrolling">false</field>
  696.       <field name="_autoScrollMarkerImage">null</field>
  697.       <field name="_snapOn">false</field>
  698.       <field name="_scrollCount">0</field>
  699.       <field name="_startX">null</field>
  700.       <field name="_startY">null</field>
  701.       <field name="_clientX">null</field>
  702.       <field name="_clientY">null</field>
  703.  
  704.       <method name="stopScroll">
  705.         <body>
  706.           <![CDATA[
  707.             this._isScrolling = false;
  708.             if (this._autoScrollMarkerImage) {
  709.               this._autoScrollMarkerImage.style.display = 'none';  // seems to avoid blocking when autoscroll is initited during pageload
  710.               this._autoScrollMarkerImage.parentNode.removeChild(this._autoScrollMarkerImage);
  711.             }
  712.             this._autoScrollMarkerImage = null;
  713.          ]]>
  714.        </body>
  715.      </method>
  716.  
  717.      <method name="autoScrollLoop">
  718.        <body>
  719.          <![CDATA[
  720.            if (this._isScrolling) {
  721.              var x = (this._clientX - this._startX) / this._AUTOSCROLL_SPEED;
  722.              var y = (this._clientY - this._startY) / this._AUTOSCROLL_SPEED;
  723.  
  724.              if(Math.abs(x) > 0 && Math.abs(y) > 0)
  725.              {
  726.                if (this._scrollCount++ % 2)
  727.                  y = 0;
  728.                else
  729.                  x = 0;
  730.              }
  731.  
  732.              this._clientFrameDoc.defaultView.scrollBy(x, y);
  733.              setTimeout(function foo(a) { a.autoScrollLoop() }, 5, this);
  734.            }
  735.          ]]>
  736.        </body>
  737.      </method>
  738.      <method name="isAutoscrollBlocker">
  739.        <parameter name="node"/>
  740.        <body>
  741.          <![CDATA[
  742.            var mmPaste = false;
  743.            var mmScrollbarPosition = false;
  744.  
  745.            try {
  746.              mmPaste = this.mPrefs.getBoolPref("middlemouse.paste");
  747.            }
  748.            catch (ex) {
  749.            }
  750.  
  751.            try {
  752.              mmScrollbarPosition = this.mPrefs.getBoolPref("middlemouse.scrollbarPosition");
  753.            }
  754.            catch (ex) {
  755.            }
  756.  
  757.            while (node) {
  758.              if ((node instanceof HTMLAnchorElement || node instanceof HTMLAreaElement) && node.hasAttribute("href"))
  759.                return true;
  760.  
  761.              if (mmPaste && (node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement))
  762.                return true;
  763.  
  764.              if (node instanceof XULElement && mmScrollbarPosition
  765.                  && (node.localName == "scrollbar" || node.localName == "scrollcorner"))
  766.                return true;
  767.  
  768.              node = node.parentNode;
  769.            }
  770.            return false;
  771.          ]]>
  772.        </body>
  773.      </method>
  774.      <method name="showAutoscrollMarker">
  775.        <parameter name="evt"/>
  776.        <body>
  777.          <![CDATA[
  778.            var scrollCursor  = new Array("move", "n-resize", "e-resize");
  779.            var docBox = this._clientFrameDoc.getBoxObjectFor(this._clientFrameDoc.documentElement);
  780.            var left = evt.screenX - docBox.screenX;
  781.            var top = evt.screenY - docBox.screenY;
  782.  
  783.  
  784.            var documentWidth = docBox.width;
  785.            var documentHeight = docBox.height;
  786.            var windowWidth = window.innerWidth;
  787.            var windowHeight = window.innerHeight;
  788.            var scrollType = 0;
  789.            if (windowHeight < documentHeight && windowWidth >= documentWidth)
  790.              scrollType = 1;
  791.            else if (windowHeight >= documentHeight && windowWidth < documentWidth)
  792.              scrollType = 2;
  793.  
  794.            var imageWidth = 28;
  795.            var imageHeight = 28;
  796.  
  797.            // marker
  798.            var el = this._clientFrameDoc.createElementNS("http://www.w3.org/1999/xhtml", "img");
  799.  
  800.            var scrollImages  = new Array("chrome://global/content/bindings/autoscroll_all.png",
  801.                                          "chrome://global/content/bindings/autoscroll_v.png",
  802.                                          "chrome://global/content/bindings/autoscroll_h.png");
  803.  
  804.            el.src = scrollImages[scrollType];
  805.            el.style.position = "fixed";
  806.            el.style.left = left - imageWidth / 2 + "px";
  807.            el.style.top = top - imageHeight / 2 + "px";
  808.            el.style.width = imageWidth + "px";
  809.            el.style.height = imageHeight + "px";
  810.            el.style.cursor = scrollCursor[scrollType];
  811.            el.style.zIndex = 2147483647; //Max Int
  812.            el.style.borderStyle = "none";
  813.            el.style.padding = "0";
  814.            el.style.margin = "0";
  815.  
  816.            this._clientFrameDoc.documentElement.appendChild(el);
  817.  
  818.            this._autoScrollMarkerImage = el;
  819.          ]]>
  820.        </body>
  821.      </method>
  822.  
  823.      <field name="_findInstData">null</field>
  824.      <property name="findInstData" readonly="true">
  825.         <getter>
  826.           <![CDATA[
  827.             if (!this._findInstData) {
  828.               this._findInstData = new nsFindInstData();
  829.               this._findInstData.browser = this;
  830.               // defaults for rootSearchWindow and currentSearchWindow are fine here
  831.             }
  832.             return this._findInstData;
  833.           ]]>
  834.         </getter>
  835.      </property>
  836.  
  837.      <property name="canFindAgain" readonly="true" onget="return canFindAgainInPage();"/>
  838.  
  839.      <method name="find">
  840.        <body>
  841.          <![CDATA[
  842.            findInPage(this.findInstData)
  843.          ]]>
  844.        </body>
  845.      </method>
  846.  
  847.      <method name="findAgain">
  848.        <body>
  849.          <![CDATA[
  850.            findAgainInPage(this.findInstData, false)
  851.          ]]>
  852.        </body>
  853.      </method>
  854.  
  855.      <method name="findPrevious">
  856.        <body>
  857.          <![CDATA[
  858.            findAgainInPage(this.findInstData, true)
  859.          ]]>
  860.        </body>
  861.      </method>
  862.  
  863.     </implementation>
  864.  
  865.     <handlers>
  866.       <handler event="keypress" keycode="VK_F7">
  867.         <![CDATA[
  868.           if (!event.isTrusted)
  869.             return;
  870.  
  871.           // Toggle browse with caret mode
  872.           var browseWithCaretOn = false;
  873.           var warn = true;
  874.                     //MERC - JA tmp disable caret browsing for HTMLPlugin
  875.                     var hpDoc;
  876.                     try
  877.                     {
  878.                         hpDoc = this.contentDocument.QueryInterface(Components.interfaces.nsIHTMLPluginDocument);
  879.                     } catch(ex) { }
  880.                     if(hpDoc)
  881.                         return;
  882.                     //end JA
  883.  
  884.           try {
  885.             warn = this.mPrefs.getBoolPref("accessibility.warn_on_browsewithcaret");
  886.           } catch (ex) {
  887.           }
  888.  
  889.           try {
  890.             browseWithCaretOn = this.mPrefs.getBoolPref("accessibility.browsewithcaret");
  891.           } catch (ex) {
  892.           }
  893.           if (warn && !browseWithCaretOn) {
  894.             var checkValue = {value:false};
  895.             promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
  896.  
  897.             var buttonPressed = promptService.confirmEx(window,
  898.               this.mStrBundle.GetStringFromName('browsewithcaret.checkWindowTitle'),
  899.               this.mStrBundle.GetStringFromName('browsewithcaret.checkLabel'),
  900.               (promptService.BUTTON_TITLE_YES * promptService.BUTTON_POS_0) +
  901.               (promptService.BUTTON_TITLE_NO * promptService.BUTTON_POS_1),
  902.               null, null, null, this.mStrBundle.GetStringFromName('browsewithcaret.checkMsg'),
  903.               checkValue);
  904.             if (buttonPressed != 0)
  905.               return;
  906.             if (checkValue.value) {
  907.               try {
  908.                 this.mPrefs.setBoolPref("accessibility.warn_on_browsewithcaret", false);
  909.               }
  910.               catch (ex) {
  911.               }
  912.             }
  913.           }
  914.  
  915.           // Toggle the pref
  916.           try {
  917.             this.mPrefs.setBoolPref("accessibility.browsewithcaret",!browseWithCaretOn);
  918.           } catch (ex) {
  919.           }
  920.         ]]>
  921.       </handler>
  922.       <handler event="mouseup">
  923.         <![CDATA[
  924.           if (!this.autoscrollEnabled)
  925.             return;
  926.           if (!this._snapOn)
  927.             this.stopScroll();
  928.         ]]>
  929.       </handler>
  930.       <handler event="mousedown">
  931.         <![CDATA[
  932.           if (this._isScrolling) {
  933.             stopScroll();
  934.           } else if (event.button == 1) {
  935.           if (!this.autoscrollEnabled || this.isAutoscrollBlocker(event.originalTarget))
  936.             return;
  937.  
  938.               this._startX = event.clientX;
  939.               this._startY = event.clientY;
  940.               this._clientFrameDoc = event.originalTarget.ownerDocument;
  941.               this._isScrolling = true;
  942.               this._snapOn = true;
  943.               this.showAutoscrollMarker(event);
  944.               window.setTimeout(function foo(a) { a.autoScrollLoop() }, 5, this);
  945.             }
  946.         ]]>
  947.       </handler>
  948.       <handler event="mousemove">
  949.         <![CDATA[
  950.           this._clientX = event.clientX;
  951.           this._clientY = event.clientY;
  952.  
  953.           if (this._isScrolling) {
  954.             var x = this._clientX - this._startX;
  955.             var y = this._clientY - this._startY;
  956.  
  957.             if ((x > this._AUTOSCROLL_SNAP || x < -this._AUTOSCROLL_SNAP) || (y > this._AUTOSCROLL_SNAP || y < -this._AUTOSCROLL_SNAP))
  958.               this._snapOn = false;
  959.           }
  960.         ]]>
  961.       </handler>
  962.     </handlers>
  963.  
  964.   </binding>
  965.  
  966.   <binding id="browsermessage" extends="xul:hbox">
  967.     <content align="center">
  968.       <xul:deck anonid="browsermessageDeck" class="browsermessageDeck" flex="1" selectedIndex="0">
  969.  
  970.     <xul:hbox flex="1">
  971.         <!-- Default -->
  972.         <xul:hbox anonid="messagePopupContainer" align="center" flex="1">
  973.             <xul:image  anonid="messageImage"  class="messageImage"/>
  974.             <xul:description anonid="messageText" class="messageText" flex="1"/>
  975.         </xul:hbox>
  976.         <xul:button anonid="messageButton" class="messageButton"/>
  977.         <xul:spacer class="tabs-right"/>
  978.         <xul:hbox hidden="true" anonid="messageClose" class="tabs-closebutton-box"
  979.                   align="center" pack="end">
  980.             <xul:toolbarbutton ondblclick="event.preventBubble();"
  981.                                class="tabs-closebutton close-button"
  982.                                oncommand="this.parentNode.parentNode.parentNode.parentNode.hide();"/>
  983.         </xul:hbox>
  984.     </xul:hbox>
  985.  
  986.     <xul:hbox flex="1" align="center">
  987.         <!-- Passcard section -->
  988.         <xul:image class="passcardMessageIcon"/>
  989.         <xul:label anonid="messagePasscardText" flex="1" crop="end"
  990.                    value="AutoFill - You have a matching Passcard for this site."/>
  991.         <xul:menulist anonid="messagePasscardList" hidden="false"
  992.                       oncommand="SetAsPasscardDefault(this);">
  993.             <xul:menupopup/>
  994.         </xul:menulist>
  995.         <xul:button anonid="messagePasscardFillButton" class="messageButton"
  996.                     label="Fill"
  997.                     oncommand="ParameterizedDoPasscard(false);"/>
  998.         <xul:button anonid="messagePasscardFillSubmitButton" class="messageButton"
  999.                     label="Fill & Submit"
  1000.                     oncommand="ParameterizedDoPasscard(true);"/>
  1001.         <xul:button anonid="messagePasscardEditButton" class="messageButton"
  1002.                     label="Edit"
  1003.                     oncommand="openSelectedPasscard(this.previousSibling.previousSibling.previousSibling);"/>
  1004.         <xul:button anonid="messagePasscardCancelButton" class="messageButton"
  1005.                     label="Cancel"
  1006.                     oncommand="this.parentNode.parentNode.parentNode.hide();"/>
  1007.         <xul:checkbox anonid="messagePasscardCheckBox" label="Don't Show Again"
  1008.                     oncommand="ToggleShowPasscardMessageBar()"/>
  1009.     </xul:hbox>
  1010.  
  1011.     <xul:hbox flex="1" align="center">
  1012.         <!-- Datacard section -->
  1013.         <xul:image class="datacardMessageIcon"/>
  1014.         <xul:label flex="1" crop="end"
  1015.                    value="AutoFill - Use your Datacard to fill forms on this page."/>
  1016.         <xul:menulist anonid="datacardList">
  1017.             <xul:menupopup anonid="datacardMenupopup"/>
  1018.         </xul:menulist>
  1019.         <xul:button anonid="datacardFillForms" class="messageButton"
  1020.                     label="Fill"
  1021.                     oncommand="datacardUtils.DoAutoFill(undefined, this.previousSibling.value);"/>
  1022.         <xul:button anonid="datacardFillAndSubmit" class="messageButton"
  1023.                     label="Fill & Submit"
  1024.                     oncommand="datacardUtils.DoAutoFillAndSubmit(undefined, this.previousSibling.previousSibling.value);"/>
  1025.         <xul:button anonid="messagePasscardEditButton" class="messageButton"
  1026.                     label="Edit"
  1027.                     oncommand="openFormfillPrefs();"/>
  1028.         <xul:button anonid="datacardCancel" label="Cancel" class="messageButton"
  1029.                     oncommand="this.parentNode.parentNode.parentNode.hide();"/>
  1030.         <xul:checkbox anonid="datacardDoNotShow" label="Don't Show Again"
  1031.                     oncommand="gPrefService.setBoolPref('datacard.messagebar.enable','false');"/>
  1032.     </xul:hbox>
  1033.  
  1034.     <xul:hbox flex="1" align="center" class="blacklistedSite">
  1035.         <!-- Phishing site warning -->
  1036.         <xul:image class="blacklistedSite-warning"/>
  1037.         <xul:label class="blacklistedSite-warning" value="WARNING"/>
  1038.         <xul:vbox flex="1">
  1039.             <!-- This site has been found on a Trusted Third Party 'blacklist' of disreputable sites. -->
  1040.             <xul:label anonid="phishText" class="blacklistedSite-desc" flex="1" crop="right"/>
  1041.             <xul:label class="blacklistedSite-desc" flex="1" crop="right"
  1042.                        value="Please use caution in providing personal information to this site."/>
  1043.         </xul:vbox>
  1044.     <xul:hbox anonid="messageClose" class="tabs-closebutton-box"
  1045.                   align="center" pack="end">
  1046.             <xul:toolbarbutton ondblclick="event.preventBubble();"
  1047.                                class="tabs-closebutton close-button"
  1048.                                oncommand="this.parentNode.parentNode.parentNode.parentNode.hide();"/>
  1049.         </xul:hbox>
  1050.     </xul:hbox>
  1051.  
  1052.     <xul:hbox flex="1" align="center" class="blacklistedSite">
  1053.         <!-- Spyware site warning -->
  1054.         <xul:image class="blacklistedSite-warning"/>
  1055.         <xul:label class="blacklistedSite-warning" value="WARNING"/>
  1056.         <xul:vbox flex="1">
  1057.             <xul:label anonid="spywareText" class="blacklistedSite-desc" flex="1" crop="right"/>
  1058.             <xul:label class="blacklistedSite-desc" flex="1" crop="right"
  1059.                        value="Please use caution when downloading files from this site."/>
  1060.         </xul:vbox>
  1061.         <xul:hbox anonid="messageClose" class="tabs-closebutton-box"
  1062.                   align="center" pack="end">
  1063.             <xul:toolbarbutton ondblclick="event.preventBubble();"
  1064.                                class="tabs-closebutton close-button"
  1065.                                oncommand="this.parentNode.parentNode.parentNode.parentNode.hide();"/>
  1066.         </xul:hbox>
  1067.     </xul:hbox>
  1068.  
  1069.     <xul:hbox flex="1">
  1070.         <!-- Webmail section -->
  1071.         <xul:hbox align="center" flex="1">
  1072.             <xul:image anonid="webmailImage"/>
  1073.             <xul:description anonid="webmailText" flex="1"/>
  1074.         </xul:hbox>
  1075.  
  1076.         <xul:spacer class="tabs-right"/>
  1077.         <xul:hbox  class="tabs-closebutton-box" align="center" pack="end">
  1078.             <xul:toolbarbutton ondblclick="event.preventBubble();"
  1079.                                class="tabs-closebutton close-button"
  1080.                                oncommand="this.parentNode.parentNode.parentNode.parentNode.hide();"/>
  1081.         </xul:hbox>
  1082.     </xul:hbox>
  1083.  
  1084.     <xul:hbox flex="1">
  1085.         <!-- Popup blocker section -->
  1086.         <xul:hbox align="center" flex="1">
  1087.             <xul:image class="popupMessageIcon"/>
  1088.             <xul:description anonid="popupblockerText" flex="1"/>
  1089.         </xul:hbox>
  1090.         <xul:spacer class="tabs-right"/>
  1091.         <xul:checkbox anonid="" label="Don't Show Again"
  1092.                     oncommand="gPrefService.setBoolPref('popups.messagebar.enable','false');"/>
  1093.         <xul:hbox  class="tabs-closebutton-box" align="center" pack="end">
  1094.             <xul:toolbarbutton ondblclick="event.preventBubble();"
  1095.                                class="tabs-closebutton close-button"
  1096.                                oncommand="this.parentNode.parentNode.parentNode.parentNode.hide();"/>
  1097.         </xul:hbox>
  1098.     </xul:hbox>
  1099.  
  1100.       </xul:deck>
  1101.     </content>
  1102.     <implementation>
  1103.       <property name="type" onget="return this.getAttribute('type');"
  1104.                             onset="this.setAttribute('type', val); return val;"/>
  1105. <!-- *************************** -->
  1106.       <field name="_imageElement">
  1107.         document.getAnonymousElementByAttribute(this, "anonid", "messageImage");
  1108.       </field>
  1109.       <property name="image">
  1110.         <getter>
  1111.           <![CDATA[
  1112.             return this._imageElement.getAttribute("src");
  1113.           ]]>
  1114.         </getter>
  1115.         <setter>
  1116.           <![CDATA[
  1117.             this._imageElement.setAttribute("src", val);
  1118.             return val;
  1119.           ]]>
  1120.         </setter>
  1121.       </property>
  1122.  
  1123. <!-- *************************** -->
  1124.       <property name="webmailImage">
  1125.         <getter>
  1126.           <![CDATA[
  1127.             return document.getAnonymousElementByAttribute(this, "anonid", "webmailImage").getAttribute("src");
  1128.           ]]>
  1129.         </getter>
  1130.         <setter>
  1131.           <![CDATA[
  1132.             document.getAnonymousElementByAttribute(this, "anonid", "webmailImage").setAttribute("src", val);
  1133.             return val;
  1134.           ]]>
  1135.         </setter>
  1136.       </property>
  1137. <!-- *************************** -->
  1138.       <field name="_imagePasscardElement">
  1139.         document.getAnonymousElementByAttribute(this, "anonid", "messagePasscardImage");
  1140.       </field>
  1141.       <property name="passcardImage">
  1142.         <getter>
  1143.           <![CDATA[
  1144.             return this._imagePasscardElement.getAttribute("src");
  1145.           ]]>
  1146.         </getter>
  1147.         <setter>
  1148.           <![CDATA[
  1149.             this._imagePasscardElement.setAttribute("src", val);
  1150.             return val;
  1151.           ]]>
  1152.         </setter>
  1153.       </property>
  1154. <!-- *************************** -->
  1155.       <field name="_imageFormFillElement">
  1156.         document.getAnonymousElementByAttribute(this, "anonid", "messageFormFillImage");
  1157.       </field>
  1158.       <property name="formFillImage">
  1159.         <getter>
  1160.           <![CDATA[
  1161.             return this._imageFormFillElement.getAttribute("src");
  1162.           ]]>
  1163.         </getter>
  1164.         <setter>
  1165.           <![CDATA[
  1166.             this._imageFormFillElement.setAttribute("src", val);
  1167.             return val;
  1168.           ]]>
  1169.         </setter>
  1170.       </property>
  1171. <!-- *************************** -->
  1172.       <field name="docShell">
  1173.         null;
  1174.       </field>
  1175.       <field name="source">
  1176.         "";
  1177.       </field>
  1178.       <property name="popup">
  1179.         <setter>
  1180.           <![CDATA[
  1181.             if (val)
  1182.               document.getAnonymousElementByAttribute(this, "anonid", "messagePopupContainer").setAttribute("popup", val);
  1183.             else
  1184.               document.getAnonymousElementByAttribute(this, "anonid", "messagePopupContainer").removeAttribute("popup");
  1185.             return val;
  1186.           ]]>
  1187.         </setter>
  1188.         <getter>
  1189.           <![CDATA[
  1190.             return document.getAnonymousElementByAttribute(this, "anonid", "messagePopupContainer").getAttribute("popup");
  1191.           ]]>
  1192.         </getter>
  1193.       </property>
  1194.  
  1195. <!-- *************************** -->
  1196.  
  1197.       <field name="_textElement">
  1198.         document.getAnonymousElementByAttribute(this, "anonid", "messageText");
  1199.       </field>
  1200.       <field name="_text">
  1201.         "";
  1202.       </field>
  1203.  
  1204.             <field name="_labelElements">
  1205.                 document.getAnonymousNodes(this);
  1206.             </field>
  1207. <!-- *************************** -->
  1208.  
  1209.       <property name="text">
  1210.         <getter>
  1211.           <![CDATA[
  1212.             return this._text;
  1213.           ]]>
  1214.         </getter>
  1215.         <setter>
  1216.           <![CDATA[
  1217.             this._text = val;
  1218.  
  1219.             while (this._textElement.hasChildNodes())
  1220.               this._textElement.removeChild(this._textElement.firstChild);
  1221.             this._textElement.appendChild(document.createTextNode(val));
  1222.             return val;
  1223.           ]]>
  1224.         </setter>
  1225.       </property>
  1226.  
  1227. <!-- *************************** -->
  1228.  
  1229.       <property name="webmailText">
  1230.         <getter>
  1231.           <![CDATA[
  1232.             return document.getAnonymousElementByAttribute(this, "anonid", "webmailText").value;
  1233.           ]]>
  1234.         </getter>
  1235.         <setter>
  1236.           <![CDATA[
  1237.             document.getAnonymousElementByAttribute(this, "anonid", "webmailText").value = val;
  1238.             return val;
  1239.           ]]>
  1240.         </setter>
  1241.       </property>
  1242.  
  1243. <!-- *************************** -->
  1244.  
  1245.       <property name="phishText">
  1246.         <getter>
  1247.           <![CDATA[
  1248.             return document.getAnonymousElementByAttribute(this, "anonid", "phishText").value;
  1249.           ]]>
  1250.         </getter>
  1251.         <setter>
  1252.           <![CDATA[
  1253.             document.getAnonymousElementByAttribute(this, "anonid", "phishText").value = val;
  1254.             return val;
  1255.           ]]>
  1256.         </setter>
  1257.       </property>
  1258.  
  1259. <!-- *************************** -->
  1260.  
  1261.       <property name="spywareText">
  1262.         <getter>
  1263.           <![CDATA[
  1264.             return document.getAnonymousElementByAttribute(this, "anonid", "spywareText").value;
  1265.           ]]>
  1266.         </getter>
  1267.         <setter>
  1268.           <![CDATA[
  1269.             document.getAnonymousElementByAttribute(this, "anonid", "spywareText").value = val;
  1270.             return val;
  1271.           ]]>
  1272.         </setter>
  1273.       </property>
  1274.  
  1275. <!-- *************************** -->
  1276.  
  1277.       <property name="popupblockerText">
  1278.         <getter>
  1279.           <![CDATA[
  1280.             return document.getAnonymousElementByAttribute(this, "anonid", "popupblockerText").value;
  1281.           ]]>
  1282.         </getter>
  1283.         <setter>
  1284.           <![CDATA[
  1285.             document.getAnonymousElementByAttribute(this, "anonid", "popupblockerText").value = val;
  1286.             return val;
  1287.           ]]>
  1288.         </setter>
  1289.       </property>
  1290.  
  1291. <!-- *************************** -->
  1292.  
  1293.       <field name="_textPasscardElement">
  1294.         document.getAnonymousElementByAttribute(this, "anonid", "messagePasscardText");
  1295.       </field>
  1296.       <field name="_textPasscard">
  1297.         "";
  1298.       </field>
  1299.  
  1300. <!-- *************************** -->
  1301.  
  1302.       <property name="textPasscard">
  1303.         <getter>
  1304.           <![CDATA[
  1305.             return this._textPasscard;
  1306.           ]]>
  1307.         </getter>
  1308.         <setter>
  1309.           <![CDATA[
  1310.              this._textPasscard = val;
  1311.              while (this._textPasscardElement.hasChildNodes())
  1312.                this._textPasscardElement.removeChild(this._textPasscardElement.firstChild);
  1313.              this._textPasscardElement.appendChild(document.createTextNode(val));
  1314.              return val;
  1315.           ]]>
  1316.         </setter>
  1317.       </property>
  1318.  
  1319. <!-- *************************** -->
  1320.  
  1321.       <field name="_textFormFillElement">
  1322.         document.getAnonymousElementByAttribute(this, "anonid", "messageFormFillText");
  1323.       </field>
  1324.       <field name="_textFormFill">
  1325.         "";
  1326.       </field>
  1327.  
  1328. <!-- *************************** -->
  1329.  
  1330.       <property name="textFormFill">
  1331.         <getter>
  1332.           <![CDATA[
  1333.             return this._textFormFill;
  1334.           ]]>
  1335.         </getter>
  1336.         <setter>
  1337.           <![CDATA[
  1338.             this._textFormFil = val;
  1339.             while (this._textFormFillElement.hasChildNodes())
  1340.               this._textFormFillElement.removeChild(this._textFormFillElement.firstChild);
  1341.             this._textFormFillElement.appendChild(document.createTextNode(val));
  1342.             return val;
  1343.           ]]>
  1344.         </setter>
  1345.       </property>
  1346.  
  1347. <!-- *************************** -->
  1348.  
  1349.       <field name="_buttonElement">
  1350.         document.getAnonymousElementByAttribute(this, "anonid", "messageButton");
  1351.       </field>
  1352.       <property name="buttonText">
  1353.         <getter>
  1354.           <![CDATA[
  1355.             return this._buttonElement.getAttribute("label");
  1356.           ]]>
  1357.         </getter>
  1358.         <setter>
  1359.           <![CDATA[
  1360.             if (val != "") {
  1361.               this._buttonElement.removeAttribute("style");
  1362.               this._buttonElement.setAttribute("label", val);
  1363.             }
  1364.             else
  1365.               this._buttonElement.setAttribute("style", "max-width: 1px; visibility: hidden;");
  1366.             return val;
  1367.           ]]>
  1368.         </setter>
  1369.       </property>
  1370.  
  1371.  
  1372.       <property name="closeButton">
  1373.         <getter>
  1374.           <![CDATA[
  1375.             return document.getAnonymousElementByAttribute(this, "anonid", "messageClose");
  1376.           ]]>
  1377.         </getter>
  1378.         <setter>
  1379.           <![CDATA[
  1380.             var elm = document.getAnonymousElementByAttribute(this, "anonid", "messageClose");
  1381.             elm.hidden = !val;
  1382.             return val;
  1383.           ]]>
  1384.         </setter>
  1385.       </property>
  1386.  
  1387.  
  1388.       <method name="hide">
  1389.         <body>
  1390.           <![CDATA[
  1391.             this.hidden = true;
  1392.           ]]>
  1393.         </body>
  1394.       </method>
  1395.  
  1396.       <method name="ToggleShowPasscardMessageBar">
  1397.         <body>
  1398.           <![CDATA[
  1399.             var list     = document.getAnonymousElementByAttribute(this, "anonid", "messagePasscardList");
  1400.             var checkbox = document.getAnonymousElementByAttribute(this, "anonid", "messagePasscardCheckBox");
  1401.             SetDoNotShowPasscardMessageBar(list,checkbox);
  1402.           ]]>
  1403.         </body>
  1404.       </method>
  1405.  
  1406.  
  1407.     </implementation>
  1408.     <handlers>
  1409.       <handler event="click">
  1410.         if (event.originalTarget.getAttribute("anonid") == "messageButton") {
  1411.           var os = Components.classes["@mozilla.org/observer-service;1"]
  1412.                              .getService(Components.interfaces.nsIObserverService);
  1413.           var subject = this.docShell ? this.docShell : null;
  1414.           os.notifyObservers(subject, this.source, "");
  1415.         }
  1416.       </handler>
  1417.     </handlers>
  1418.   </binding>
  1419.  
  1420. </bindings>
  1421.