nsSidebar - /@line 43

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
//@line 43 "e:\builds\moz2_slave\win32_build\build\browser\components\sidebar\src\nsSidebar.js " /* * No magic constructor behaviour, as is de rigeur for XPCOM. * If you must perform some initialization, and it could possibly fail (even * due to an out-of-memory condition), you should use an Init method, which * can convey failure appropriately (thrown exception in JS, * NS_FAILED(nsresult) return in C++). * * In JS, you can actually cheat, because a thrown exception will cause the * CreateInstance call to fail in turn, but not all languages are so lucky. * (Though ANSI C++ provides exceptions, they are verboten in Mozilla code * for portability reasons -- and even when you're building completely * platform-specific code, you can't throw across an XPCOM method boundary.) */ const DEBUG = false; /* set to false to suppress debug messages */ const SIDEBAR_CONTRACTID = "@mozilla.org/sidebar;1"; const SIDEBAR_CID = Components.ID("{22117140-9c6e-11d3-aaf1- 00805f8a4905}"); const nsISupports = Components.interfaces.nsISupports; const nsIFactory = Components.interfaces.nsIFactory; const nsISidebar = Components.interfaces.nsISidebar; const nsISidebarExternal = Components.interfaces.nsISidebarExternal; const nsIClassInfo = Components.interfaces.nsIClassInfo; // File extension for Sherlock search plugin description files const SHERLOCK_FILE_EXT_REGEXP = /\.src$/i; function nsSidebar() { const PROMPTSERVICE_CONTRACTID = "@mozilla.org/embedcomp/prompt-service;1"; const nsIPromptService = Components.interfaces.nsIPromptService; this.promptService = Components.classes[PROMPTSERVICE_CONTRACTID].getService(nsIPromptService); const SEARCHSERVICE_CONTRACTID = "@mozilla.org/browser/search-service;1"; const nsIBrowserSearchService = Components.interfaces.nsIBrowserSearchService; this.searchService = Components.classes[SEARCHSERVICE_CONTRACTID].getService(nsIBrowserSearchServi ce); } nsSidebar.prototype.nc = "http://home.netscape.com/NC-rdf#"; function sidebarURLSecurityCheck(url) { if (!/^(https?:|ftp:)/i.test(url)) { Components.utils.reportError("Invalid argument passed to window.sidebar.addPanel: Unsupported panel URL." ); return false; } return true; } /* decorate prototype to provide ``class'' methods and property accessors */
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
nsSidebar.prototype.addPanel = function (aTitle, aContentURL, aCustomizeURL) { debug("addPanel(" + aTitle + ", " + aContentURL + ", " + aCustomizeURL + ")"); return this.addPanelInternal(aTitle, aContentURL, aCustomizeURL, false); } nsSidebar.prototype.addPersistentPanel = function(aTitle, aContentURL, aCustomizeURL) { debug("addPersistentPanel(" + aTitle + ", " + aContentURL + ", " + aCustomizeURL + ")\n"); return this.addPanelInternal(aTitle, aContentURL, aCustomizeURL, true);
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

nsSidebar - /@line 43

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online