home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 September / 09_02.iso / software / netscape / N6SetupB.exe / bin / chrome / comm.jar / content / communicator / securityUI.js < prev   
Text File  |  2001-05-08  |  2KB  |  58 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Mozilla Public
  4.  * License Version 1.1 (the "License"); you may not use this file
  5.  * except in compliance with the License. You may obtain a copy of
  6.  * the License at http://www.mozilla.org/MPL/
  7.  *
  8.  * Software distributed under the License is distributed on an "AS
  9.  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  10.  * implied. See the License for the specific language governing
  11.  * rights and limitations under the License.
  12.  *
  13.  * The Original Code is mozilla.org code.
  14.  *
  15.  * The Initial Developer of the Original Code is Netscape
  16.  * Communications Corporation.  Portions created by Netscape are
  17.  * Copyright (C) 1998 Netscape Communications Corporation. All
  18.  * Rights Reserved.
  19.  *
  20.  * Contributor(s):
  21. */
  22.  
  23. window.addEventListener("load", SetSecurityButton, false);
  24. window.addEventListener("unload", DestroySecurity, false);
  25.  
  26. var securityUI;
  27.  
  28. function SetSecurityButton()
  29. {
  30.     const ui = Components.classes["@mozilla.org/secure_browser_ui;1"];
  31.     if (ui) {
  32.         var securityUI = ui.createInstance(Components.interfaces.nsISecureBrowserUI);
  33.  
  34.         if ("gBrowser" in window) { // XXXjag see bug 68662
  35.             gBrowser.boxObject.setPropertyAsSupports("xulwindow", window);
  36.             gBrowser.boxObject.setPropertyAsSupports("secureBrowserUI", securityUI);
  37.         }
  38.  
  39.         var button = document.getElementById("security-button");
  40.         if (button && _content)
  41.             securityUI.init(_content, button);
  42.     }
  43. }
  44.  
  45. function displayPageInfo()
  46. {
  47.    window.openDialog("chrome://navigator/content/pageInfo.xul", "_blank",
  48.                      "dialog=no", null, "securityTab");
  49. }
  50.  
  51. function DestroySecurity()
  52. {
  53.     if ("gBrowser" in window) { // XXXjag see bug 68662
  54.         gBrowser.boxObject.removeProperty("xulwindow");
  55.         gBrowser.boxObject.removeProperty("secureBrowserUI");
  56.     }
  57. }
  58.