aboutsummaryrefslogtreecommitdiff
path: root/files/ru/mozilla/tech/xpcom
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
commit074785cea106179cb3305637055ab0a009ca74f2 (patch)
treee6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/ru/mozilla/tech/xpcom
parentda78a9e329e272dedb2400b79a3bdeebff387d47 (diff)
downloadtranslated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz
translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2
translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip
initial commit
Diffstat (limited to 'files/ru/mozilla/tech/xpcom')
-rw-r--r--files/ru/mozilla/tech/xpcom/index.html47
-rw-r--r--files/ru/mozilla/tech/xpcom/reference/index.html21
-rw-r--r--files/ru/mozilla/tech/xpcom/reference/interface/index.html17
-rw-r--r--files/ru/mozilla/tech/xpcom/reference/interface/nsidomhtmlmediaelement/index.html29
-rw-r--r--files/ru/mozilla/tech/xpcom/reference/interface/nsiloginmanager/index.html372
-rw-r--r--files/ru/mozilla/tech/xpcom/reference/interface/nsiloginmanager/using_nsiloginmanager/index.html169
6 files changed, 655 insertions, 0 deletions
diff --git a/files/ru/mozilla/tech/xpcom/index.html b/files/ru/mozilla/tech/xpcom/index.html
new file mode 100644
index 0000000000..07687c0f82
--- /dev/null
+++ b/files/ru/mozilla/tech/xpcom/index.html
@@ -0,0 +1,47 @@
+---
+title: XPCOM
+slug: Mozilla/Tech/XPCOM
+tags:
+ - Landing
+ - Mozilla
+ - NeedsTranslation
+ - TopicStub
+ - XPCOM
+translation_of: Mozilla/Tech/XPCOM
+---
+<p><span class="seoSummary"><strong>XPCOM</strong> is a cross platform component object model, similar to Microsoft COM. It has multiple <a href="/en-US/docs/XPCOM/Language_Bindings" title="XPCOM/Language_Bindings">language bindings</a>, allowing XPCOM components to be used and implemented in JavaScript, Java, and Python in addition to C++.</span> Interfaces in XPCOM are defined in a dialect of IDL called <a href="/en-US/docs/XPIDL" title="XPIDL">XPIDL</a>.</p>
+
+<div class="warning">
+<p><strong>XPCOM is no longer available for use by Firefox extensions. Use <a href="/en-US/Add-ons/WebExtensions">WebExtensions</a> instead.</strong></p>
+</div>
+
+<p>XPCOM itself provides a set of core components and classes, e.g. file and memory management, threads, basic data structures (strings, arrays, variants), etc. The majority of XPCOM components are not part of this core set and are provided by other parts of the platform (e.g. <a href="/en-US/docs/Gecko" title="Gecko">Gecko</a> or <a href="/en-US/docs/Necko" title="Necko">Necko</a>) or by an application or even by an extension.</p>
+
+<div class="row topicpage-table">
+ <div class="section"><dl><dl><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Accessing_the_Windows_Registry_Using_XPCOm">Accessing the Windows Registry Using XPCOM</a></dt><dd class="landingPageList">When implementing Windows-specific functionality, it is often useful to access the Windows registry for information about the environment or other installed programs. To this end, there exist <a href="/en/XPCOM" title="en/XPCOM">XPCOM</a> interfaces to read and write registry data. This article will show you how to use the available interfaces in several Mozilla products.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Aggregating_the_In-Memory_Datasource">Aggregating the In-Memory Datasource</a></dt><dd class="landingPageList"></dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/already_AddRefed">already_AddRefed</a></dt><dd class="landingPageList"><code>already_AddRefed</code> in association with <code><a href="/en-US/docs/NsCOMPtr">nsCOMPtr</a></code> allows you to assign in a pointer <strong>without</strong> <code>AddRef</code>ing it.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Binary_compatibility">Binary compatibility</a></dt><dd class="landingPageList">If Mozilla decides to upgrade to a compiler that does not have the same ABI as the current version, any built component may fail. It is a possiblity that is introduced when upgrading to a new compiler without recompiling everything. Effectively, it is a different platform.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Bundling_multiple_binary_components">Bundling multiple binary components</a></dt><dd class="landingPageList">Binary XPCOM components are sometimes required to implement low-level features for extensions. Since binary components are linked against a single Gecko SDK, a dependency to a particular version of Gecko is created. If the component uses only "frozen" XPCOM interfaces, there is a good chance the same binary component will work with different versions of Gecko (version 1.8 and 1.9, for example). The more likely case is that the component uses "unfrozen" interfaces and those interfaces can change between Gecko versions. This can create a difficult situation for extension developers trying to support multiple Gecko versions (Firefox 2 and 3, for example).</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Creating_a_Python_XPCOM_component">Creating a Python XPCOM component</a></dt><dd class="landingPageList"><a href="http://books.mozdev.org/html"><em>Creating Applications with Mozilla</em></a> already provides <a href="http://books.mozdev.org/html/mozilla-chp-8-sect-2.html">a tutorial</a> for making a simple JavaScript or C++ component (implementing the <code>nsISimple</code> interface). Here is how to make the same component in Python using <a href="/en-US/docs/PyXPCOM" title="PyXPCOM">PyXPCOM</a>.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Fun_with_XBL_and_XPConnect">Fun With XBL and XPConnect</a></dt><dd class="landingPageList"></dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Generating_GUIDs">Generating GUIDs</a></dt><dd class="landingPageList"><strong>GUID</strong>s are used in Mozilla programming for identifying several types of entities, including XPCOM <a href="/en-US/docs/Interfaces">Interfaces</a> (this type of GUIDs is callled IID), components (CID), and legacy add-ons—like <a href="/en-US/docs/Extensions">extensions</a> and <a href="/en-US/docs/Themes">themes</a>—that were created prior to Firefox 1.5. <a href="/en-US/docs/Install_Manifests#id">Add-ons can (and should) be identified with IDs of the form <code><var>extensionname</var>@<var>organization</var>.<var>tld</var></code></a> since <a href="/en-US/docs/Firefox_1.5_for_developers">Firefox 1.5</a>.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Generic_factory">Generic factory</a></dt><dd class="landingPageList">Most XPCOM factories can be very simple. Rick Potts wrote a templated-based generic factory (nsFactory&lt;t&gt;) that simplifies the factory creation process that just requires writing a CreateInstance() method. The new nsIGenericFactory interface takes this a step further, by providing a single interface that can be reused anytime a simple implementation of nsIFactory is needed. Here is the interface, and a description of its use.&lt;/t&gt;</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/How_to_build_a_binary_XPCOM_component_using_Visual_Studio">How to build a binary XPCOM component using Visual Studio</a></dt><dd class="landingPageList">This is a simple tutorial for building XPCOM objects in C++ using Visual Studio. XPCOM is Mozilla’s cross platform component object model, similar to Microsoft’s COM technology. XPCOM components can be implemented in C, C++, and JavaScript, and can be used from C, C++, and JavaScript. That means you can call JavaScript methods from C++ and vice versa. For more information on the workings of XPCOM look <a href="en/XPCOM">elsewhere</a>.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/How_to_pass_an_XPCOM_object_to_a_new_window">How To Pass an XPCOM Object to a New Window</a></dt><dd class="landingPageList">If you want to be able to call functions within an XPCOM object from a XUL window's code, you can do so if you pass the XPCOM object as one of the arguments to the window creation method.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Interfacing_with_the_XPCOM_cycle_collector">Interfacing with the XPCOM cycle collector</a></dt><dd class="landingPageList">This is a quick overview of the cycle collector introduced into XPCOM for Firefox 3, including a description of the steps involved in modifying an existing C++ class to participate in XPCOM cycle collection. If you have a class that you think is involved in a cyclical-ownership leak, this page is for you.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Introduction_to_XPCOM_for_the_DOM">Introduction to XPCOM for the DOM</a></dt><dd class="landingPageList">Warning: this document has not yet been reviewed by the DOM gurus, it might contain some errors.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Language_Bindings">Language bindings</a></dt><dd class="landingPageList">An <strong>XPCOM Language Binding</strong> is a bridge between a particular language and <a href="/en/XPCOM" title="en/XPCOM">XPCOM</a> to provide access to XPCOM objects from that language, and to let modules written in that language be used as XPCOM objects by all other languages for which there are XPCOM bindings.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Monitoring_HTTP_activity">Monitoring HTTP activity</a></dt><dd class="landingPageList">Gecko includes the <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIHttpActivityObserver" title="">nsIHttpActivityObserver</a></code> interface, which you can implement in your code to monitor <a href="/en/HTTP" title="en/HTTP">HTTP</a> transactions in real time, receiving a callback as the transactions take place.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/nsCOMPtr_versus_RefPtr">nsCOMPtr versus RefPtr</a></dt><dd class="landingPageList">Gecko code uses both <code>nsCOMPtr</code> and <code>RefPtr</code> as smart pointers. This guide provides some explanation and advice on how to choose between them.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Observer_Notifications">Observer Notifications</a></dt><dd class="landingPageList">The following are topics that you can observe during the course of an application. Unless otherwise noted you register for the topics using the <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIObserverService" title="">nsIObserverService</a></code>.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Setting_HTTP_request_headers">Setting HTTP request headers</a></dt><dd class="landingPageList"><a href="/en-US/docs/HTTP">HTTP</a> is one of the core technologies behind the Web. In addition to the actual content, <a href="/en-US/docs/HTTP/Headers">some important information</a> is passed with HTTP headers for both HTTP requests and responses.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Storage">Storage</a></dt><dd class="landingPageList"><strong>Storage</strong> is a <a class="external" href="http://www.sqlite.org/">SQLite</a> database API. It is available to trusted callers, meaning extensions and Firefox components only.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/The_Thread_Manager">The Thread Manager</a></dt><dd class="landingPageList">The Thread Manager, introduced in Firefox 3, offers an easy to use mechanism for creating threads and dispatching events to them for processing.</dd></dl></dl></div>
+ <div class="section"><dl><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Troubleshooting_XPCOM_components_registration">Troubleshooting XPCOM components registration</a></dt><dd class="landingPageList">Often the first time you create an XPCOM component, it may fail to register correctly.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Using_nsCOMPtr">Using nsCOMPtr</a></dt><dd class="landingPageList">This document is the sum total of everything written down about <code>nsCOMPtr</code>. If you have a question about <code>nsCOMPtr</code>, and this document doesn't answer it, there probably isn't a document that answers it. You'll have to turn to <a class="external" href="news:mozilla.dev.tech.xpcom">the XPCOM newsgroup</a> or another experienced <code>nsCOMPtr</code> user, or find the answer by experimentation.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Using_nsIClassInfo">Using nsIClassInfo</a></dt><dd class="landingPageList">If you use a C++ class which implements <code>nsIClassInfo</code> from JavaScript, then you don't have to explicitly call <code>QueryInterface</code> on the JavaScript object to access the object's interfaces.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Using_nsIDirectoryService">Using nsIDirectoryService</a></dt><dd class="landingPageList">nsDirectoryService implements the <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIProperties" title="">nsIProperties</a></code> interface. This implementation will allow you to <code>Get()</code>, <code>Set()</code>, <code>Define()</code>, and <code>Undefine()</code> <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIFile" title="">nsIFile</a></code>.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Using_nsIPasswordManager">Using nsIPasswordManager</a></dt><dd class="landingPageList">Technical review completed.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Using_nsISimpleEnumerator">Using nsISimpleEnumerator</a></dt><dd class="landingPageList"></dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Using_the_clipboard">Using the clipboard</a></dt><dd class="landingPageList">This section provides information about cutting, copying, and pasting to and from the clipboard.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Using_the_Gecko_SDK">Using the Gecko SDK</a></dt><dd class="landingPageList"></dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Weak_reference">Weak reference</a></dt><dd class="landingPageList">In <a href="/en-US/docs/XPCOM">XPCOM</a>, a <strong>weak reference</strong> is a special object that contains a pointer to an XPCOM object, but does<em>not</em> keep that object alive. If the referent object is destroyed before the weak reference, the pointer inside the weak reference is set to <code>nsnull</code>.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Working_with_multiple_versions_of_interfaces">Working with Multiple Versions of Interfaces</a></dt><dd class="landingPageList">In this short note we illustrate how one can update an XPCOM module in
+order for it to work in both Firefox 2 and Firefox 3, even if the interfaces have
+changed in the interim.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Working_with_out_parameters">Working with out parameters</a></dt><dd class="landingPageList"></dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/wrappedJSObject">wrappedJSObject</a></dt><dd class="landingPageList"><code>wrappedJSObject</code> is a property sometimes available on <a href="en/XPConnect">XPConnect</a> wrappers. When available, it lets you access the JavaScript object hidden by the wrapper.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/XPCOM_ABI">XPCOM ABI</a></dt><dd class="landingPageList"><a href="/en/XPCOM" title="en/XPCOM">XPCOM</a> <abbr title="Application Binary Interface">ABI</abbr> is the binary interface of XPCOM components. While XPCOM components written in a scripting language (such as <a href="/en/JavaScript" title="en/JavaScript">JavaScript</a>) can be moved across platforms (such as Windows and OS X) without adaptation, those written in a compiled language (such as C++) require recompilation when moving to a different platform. Often, compiled XPCOM components are called 'binary' or 'native'.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/XPCOM_category_image-sniffing-services">XPCOM category image-sniffing-services</a></dt><dd class="landingPageList">In versions of Firefox prior to Firefox 3, extensions could add decoders for new image types. However, such decoders relied on servers sending correct MIME types; images sent with incorrect MIME types would not be correctly displayed.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Glue">XPCOM glue</a></dt><dd class="landingPageList">The XPCOM Glue is a static library which component developers and embedders can link against. It allows developers to link only against the frozen XPCOM method symbols and maintain compatibility with multiple versions of XPCOM.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Guide">XPCOM guide</a></dt><dd class="landingPageList">These articles provide tutorials and usage documentation for XPCOM, including how to use it in your own projects and how to build XPCOM components for your Firefox add-ons and the like.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/XPCOM_ownership_guidelines">XPCOM ownership guidelines</a></dt><dd class="landingPageList">...naturally. If you create a temporary object, obviously it's up to you to destroy it. That's a sure sign of ownership. If you create an object with a longer lifespan, you will own it until you give ownership away.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference">XPCOM reference</a></dt><dd class="landingPageList">This reference describes the interfaces and functions provided by the <a href="/en-US/docs/Mozilla/Tech/XPCOM">XPCOM</a> library. In addition, it details the various helper classes and functions, as well as the components, provided by the <a href="/en-US/docs/Mozilla/Tech/XPCOM/Glue">XPCOM glue</a> library. The contents herein are oriented primarily toward extension developers and people embedding XPCOM in other projects.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/XPCOM_tasks">XPCOM tasks</a></dt><dd class="landingPageList">The XPCOM module roughly parallels the C/C++ standard libraries. It overlaps them significantly, but goes beyond them in capabilities. XPCOM sits above the standard libraries. Its role is to extend them with facilities tailored to XPCOM development in general, and specifically the needs of Mozilla. Like the standard libraries, XPCOM must be a fairly self-contained library, so as not to encumber clients with any unnecessary external dependencies.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/Thread_synchronization">XPCOM Thread Synchronization</a></dt><dd class="landingPageList">XPCOM thread synchronization primitives have the same semantics as those in NSPR, and each method of these synchronization objects (e.g. <code>Mutex::Lock()</code>) has a matching function in NSPR (<code>PR_Lock()</code>). This is no accident, as mozilla:: primitives are merely bare-minimum wrappers around NSPR's.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/xptcall_FAQ">xptcall FAQ</a></dt><dd class="landingPageList"><code>xptcall</code> is a small low level XPCOM method call library. It is implemented using platform specific C/C++ and assembly language code. It is used to facilitate cross language and cross thread method calls. Porting this code is required in order to make Mozilla run on any given platform.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/xptcall_porting_guide">Xptcall Porting Guide</a></dt><dd class="landingPageList">Original Author: John Bandhauer, 31 May 1999.</dd><dt class="landingPageList"><a href="/en-US/docs/Mozilla/Tech/XPCOM/xptcall_porting_status">Xptcall Porting Status</a></dt><dd class="landingPageList">This is a status page for the multiplatform porting of xptcall. xptcall has a <a href="/En/Xptcall_FAQ">FAQ</a> and a <a href="/En/Xptcall_Porting_Guide">Porting Guide</a>.</dd></dl></div>
+ </div>
+
+<div class="blockIndicator communitybox" dir="ltr">
+
+ <div class="column-container">
+ <h2 id="Join_the_XPCOM_community">Join the XPCOM community</h2>
+ <div class="column-half">
+ <div class="communitysubhead">Choose your preferred method for joining the discussion:</div>
+ <ul class="communitymailinglist">
+ <li><a href="https://lists.mozilla.org/listinfo/dev-tech-xpcom">Mailing list</a></li>
+
+
+ <li><a href="http://groups.google.com/group/mozilla.dev.tech.xpcom">Newsgroup</a></li>
+ <li><a href="http://groups.google.com/group/mozilla.dev.tech.xpcom/feeds">RSS feed</a></li>
+</ul>
+ </div>
+ <div class="column-half">
+ <ul class="communitycontact"><li><strong>IRC: </strong><a href="irc://irc.mozilla.org/developers">#developers</a> <span class="smaller">(<a href="https://wiki.mozilla.org/IRC">learn more</a>)</span></li><li><strong>Tools: </strong><a href="http://ted.mielczarek.org/code/mozilla/jscomponentwiz/">JavaScript Component Wizard</a>, <a href="http://www.mytools360.com-a.googlepages.com/home#XPComPro">Visual C++ Component Wizard</a>, <a href="http://www.yutools.com/wp/tools/yuxpcomwizard/?lang=en">Visual C++ Component Wizard for Visual Studio 2010</a>, <a href="https://addons.mozilla.org/en-US/firefox/addon/xpcomviewer/">XPCOMViewer addon: browse XPCOM interfaces easily</a></li></ul>
+ </div>
+ </div>
+</div>
+
+<section id="Quick_Links"><ol><li><a href="http://www.ibm.com/developerworks/library/os-xpcomfirefox/">Tutorial from IBM DeveloperWorks</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Creating_Custom_Firefox_Extensions_with_the_Mozilla_Build_System">Binary components tutorial</a></li><li><a href="http://www.iosart.com/firefox/xpcom/">Linux and Windows how-to guide</a></li><li><a href="http://starkravingfinkle.org/blog/2006/10/mozilla-platform-xpcom-in-c/">Windows example blog post</a></li><li><a href="http://wanderingstan.com/2007-11-16/geekout_how_to_make_a_c_xpcom_component">Another Windows example</a></li><li><a href="http://rcrowley.org/2007/07/17/cross-platform-xpcom-a-howto.html">Mac OS X example</a></li><li><a href="/en-US/docs/Web/JavaScript" title="JavaScript (JS) is a lightweight interpreted or JIT-compiled programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat.">JavaScript</a></li></ol></section>
diff --git a/files/ru/mozilla/tech/xpcom/reference/index.html b/files/ru/mozilla/tech/xpcom/reference/index.html
new file mode 100644
index 0000000000..7724292115
--- /dev/null
+++ b/files/ru/mozilla/tech/xpcom/reference/index.html
@@ -0,0 +1,21 @@
+---
+title: XPCOM reference
+slug: Mozilla/Tech/XPCOM/Reference
+tags:
+ - Landing
+ - Mozilla
+ - NeedsTranslation
+ - Reference
+ - TopicStub
+ - XPCOM
+translation_of: Mozilla/Tech/XPCOM/Reference
+---
+<p>This reference describes the interfaces and functions provided by the <a href="/en-US/docs/Mozilla/Tech/XPCOM">XPCOM</a> library. In addition, it details the various helper classes and functions, as well as the components, provided by the <a href="/en-US/docs/Mozilla/Tech/XPCOM/Glue">XPCOM glue</a> library. The contents herein are oriented primarily toward extension developers and people embedding XPCOM in other projects.</p>
+<div class="note">
+ <p><strong>Note:</strong> If you're working on a module in the Mozilla codebase that's compiled with the <code>MOZILLA_INTERNAL_API</code> flag set, some of these APIs -- the string functions and classes in particular -- are not the ones you should be using. See the <a href="/en-US/docs/Mozilla/Tech/XPCOM/Guide/Internal_strings">XPCOM internal string guide</a> for documentation of the internal string API used within the Mozilla codebase.</p>
+</div>
+<p></p><div class="row topicpage-table">
+ <div class="section"><dl><dl><dt></dt></dl></dl></div>
+ <div class="section"><dl><dt class="landingPageList"><a href="/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface">XPCOM Interface Reference</a></dt><dd class="landingPageList">This is a reference to the XPCOM interfaces provided by the Mozilla platform.</dd></dl></div>
+ </div><p></p>
+<p>Many XPCOM pages return an <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Core_functions/nsresult">nsresult</a></code>. Prior to Gecko 19 (Firefox 19 / Thunderbird 19 / SeaMonkey 2.16), this was an integer that simply returned an error code. It is now a strongly typed <code>enum</code> when XPCOM is built using a C++11 compiler. This causes compile-time errors to occur when improper values are returned as nsresult values, thereby making it easier to catch many bugs.</p>
diff --git a/files/ru/mozilla/tech/xpcom/reference/interface/index.html b/files/ru/mozilla/tech/xpcom/reference/interface/index.html
new file mode 100644
index 0000000000..61f0ae4fca
--- /dev/null
+++ b/files/ru/mozilla/tech/xpcom/reference/interface/index.html
@@ -0,0 +1,17 @@
+---
+title: XPCOM Interface Reference
+slug: Mozilla/Tech/XPCOM/Reference/Interface
+tags:
+ - NeedsTranslation
+ - TopicStub
+ - XPCOM
+ - XPCOM Interface Reference
+translation_of: Mozilla/Tech/XPCOM/Reference/Interface
+---
+<p>This is a reference to the XPCOM interfaces provided by the Mozilla platform.</p>
+<div class="cols-3">
+ <ul><li><a href="/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILoginManager">nsILoginManager</a></li><li><a href="/ru/docs/nsIObserver">nsIObserver</a></li><li><a href="/ru/docs/nsIOutputStream">nsIOutputStream</a></li></ul></div>
+<h2 id="See_also" name="See_also">See also</h2>
+<ul>
+ <li><a href="/en-US/docs/XPCOM_Interface_Reference_group" title="XPCOM_Interface_Reference_group">Interfaces grouped by function</a></li>
+</ul>
diff --git a/files/ru/mozilla/tech/xpcom/reference/interface/nsidomhtmlmediaelement/index.html b/files/ru/mozilla/tech/xpcom/reference/interface/nsidomhtmlmediaelement/index.html
new file mode 100644
index 0000000000..90109df203
--- /dev/null
+++ b/files/ru/mozilla/tech/xpcom/reference/interface/nsidomhtmlmediaelement/index.html
@@ -0,0 +1,29 @@
+---
+title: nsIDOMHTMLMediaElement
+slug: Mozilla/Tech/XPCOM/Reference/Interface/NsIDOMHTMLMediaElement
+translation_of: Web/API/DOMMatrixReadOnly/translate
+---
+<div>
+<div style="border: solid #ddd 2px; margin-bottom: 12px;">
+<div style="background: #eee; padding: 2px;"><code><a href="https://dxr.mozilla.org/mozilla-central/source/dom/interfaces/html/nsIDOMHTMLMediaElement.idl" rel="custom">dom/interfaces/html/nsIDOMHTMLMediaElement.idl</a></code><span style="float: right; text-align: right;"><a href="/en-US/docs/Interfaces/About_Scriptable_Interfaces" style="color: #00cc00; font-weight: 700;">Scriptable</a></span></div>
+<span style="padding: 4px 2px;">The basis for the <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDOMHTMLAudioElement" title="">nsIDOMHTMLAudioElement</a></code> and <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDOMHTMLVideoElement" title="">nsIDOMHTMLVideoElement</a></code> interfaces, which in turn implement the <a href="/en-US/docs/Web/HTML/Element/audio" title="The HTML &lt;audio> element is used to embed sound content in documents. It may contain one or more audio sources, represented using the src attribute or the &lt;source> element: the browser will choose the most suitable one. It can also be the destination for streamed media, using a MediaStream."><code>&lt;audio&gt;</code></a> and <a href="/en-US/docs/Web/HTML/Element/video" title="The HTML Video element (&lt;video>) embeds a media player which supports video playback into the document."><code>&lt;video&gt;</code></a> HTML5 elements. </span>
+
+<div style="height: 42px; position: relative; padding: 2px; width: auto;">
+<div style="top: 22px; font-size: 11px; position: absolute;">1.0</div>
+
+<div style="top: 22px; font-size: 11px; position: absolute; left: 0px; text-align: right; float: right; width: 100%;">67</div>
+
+<div style="height: 8px; top: 16px; background: #dd0000; left: 0px; position: absolute; width: 9.389671267605634%;"></div>
+
+<div style="height: 8px; top: 16px; left: 9.389671267605634%; background: #00dd00; position: absolute; width: 90.61032873239436%;" title="Introduced in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)"></div>
+
+<div style="top: 0px; font-size: 11px; position: absolute; left: 9.389671267605634%;">Introduced</div>
+
+<div style="top: 22px; font-size: 11px; position: absolute; left: 9.389671267605634%;">Gecko 1.9.1</div>
+</div>
+
+<div style="background: #eee; padding: 2px;">Inherits from: <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDOMHTMLElement" title="">nsIDOMHTMLElement</a></code> <span style="float: right; text-align: right;">Last changed in Gecko 1.1 </span></div>
+</div>
+</div>
+
+<div>The <code><a href="/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDOMHTMLMediaElement">nsIDOMHTMLMediaElement</a></code> interface implements the DOM <a href="/en-US/docs/Web/API/HTMLMediaElement"><code>HTMLMediaElement</code></a> interface. See that page for details.</div>
diff --git a/files/ru/mozilla/tech/xpcom/reference/interface/nsiloginmanager/index.html b/files/ru/mozilla/tech/xpcom/reference/interface/nsiloginmanager/index.html
new file mode 100644
index 0000000000..8fe801e95f
--- /dev/null
+++ b/files/ru/mozilla/tech/xpcom/reference/interface/nsiloginmanager/index.html
@@ -0,0 +1,372 @@
+---
+title: nsILoginManager
+slug: Mozilla/Tech/XPCOM/Reference/Interface/nsILoginManager
+tags:
+ - Firefox 3
+ - Interfaces
+ - 'Interfaces:Scriptable'
+ - Login Manager
+ - NeedsTranslation
+ - Thunderbird 3
+ - TopicStub
+ - XPCOM
+ - XPCOM API Reference
+ - thunderbird
+translation_of: Mozilla/Tech/XPCOM/Reference/Interface/nsILoginManager
+---
+<p></p><div style="border: solid #ddd 2px; margin-bottom: 12px;">
+<div style="background: #eee; padding: 2px;"><code><a href="https://dxr.mozilla.org/mozilla-central/source/toolkit/components/passwordmgr/public/nsILoginManager.idl" rel="custom">toolkit/components/passwordmgr/public/nsILoginManager.idl</a></code><span style="text-align: right; float: right;"><a href="/ru/docs/Interfaces/About_Scriptable_Interfaces" style="color: #00cc00; font-weight: 700;">Со скриптами</a></span></div>
+<span style="padding: 4px 2px;">
+
+Used to interface with the built-in Password Manager
+</span>
+
+ <div style="height: 42px; position: relative; padding: 2px; width: auto;">
+
+ <div style="top: 22px; font-size: 11px; position: absolute;">1.0</div>
+
+ <div style="top: 22px; font-size: 11px; position: absolute; left: 0px; text-align: right; float: right; width: 100%;">66</div>
+
+ <div style="height: 8px; top: 16px; background: #dd0000; left: 0px; position: absolute; width: 8.571428571428571%;"></div>
+
+<div style="height: 8px; top: 16px; left: 8.571428571428571%; background: #00dd00; position: absolute; width: 91.42857142857143%;" title="Introduced in Gecko 1.9 (Firefox 3)"></div>
+
+<div style="top: 0px; font-size: 11px; position: absolute; left: 8.571428571428571%;">Introduced</div>
+<div style="top: 22px; font-size: 11px; position: absolute; left: 8.571428571428571%;">Gecko 1.9</div>
+
+ <div style="height: 8px; top: 16px; left: 9.976190285714287%; background: #eeee00; position: absolute; width: 1%; border-radius: 4px; -webkit-border-radius: 4px;" title="Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0)"></div>
+
+</div>
+
+<div style="background: #eee; padding: 2px;">
+Наследуется из: <code><a href="/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsISupports" title="">nsISupports</a></code>
+<span style="text-align: right; float: right;">Последнее изменение в Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0)</span></div>
+</div><p></p>
+<p>Replaces <code><a href="/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIPasswordManager" title="">nsIPasswordManager</a></code> which was used in older versions of Gecko.</p>
+<p>Implemented by: <code>@mozilla.org/login-manager;1</code>. To create an instance, use:</p>
+<pre class="eval">var loginManager = Components.classes["@mozilla.org/login-manager;1"]
+ .getService(Components.interfaces.nsILoginManager);
+</pre>
+<h2 id="Method_overview" name="Method_overview">Method overview</h2>
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <td><code>void <a href="#addLogin()">addLogin</a>(in nsILoginInfo aLogin);</code></td>
+ </tr>
+ <tr>
+ <td><code>nsIAutoCompleteResult <a href="#autoCompleteSearch()">autoCompleteSearch</a>(in AString aSearchString, in nsIAutoCompleteResult aPreviousResult, in nsIDOMHTMLInputElement aElement);</code></td>
+ </tr>
+ <tr>
+ <td><code>unsigned long <a href="#countLogins()">countLogins</a>(in AString aHostname, in AString aActionURL, in AString aHttpRealm);</code></td>
+ </tr>
+ <tr>
+ <td><code>boolean <a href="#fillForm()">fillForm</a>(in nsIDOMHTMLFormElement aForm);</code> </td>
+ </tr>
+ <tr>
+ <td><code>void <a href="#findLogins()">findLogins</a>(out unsigned long count, in AString aHostname, in AString aActionURL, in AString aHttpRealm, [retval, array, size_is(count)] out nsILoginInfo logins);</code></td>
+ </tr>
+ <tr>
+ <td><code>void <a href="#getAllDisabledHosts()">getAllDisabledHosts</a>([optional] out unsigned long count, [retval, array, size_is(count)] out wstring hostnames);</code></td>
+ </tr>
+ <tr>
+ <td><code>void <a href="#getAllLogins()">getAllLogins</a>([optional] out unsigned long count, [retval, array, size_is(count)] out nsILoginInfo logins);</code></td>
+ </tr>
+ <tr>
+ <td><code>boolean <a href="#getLoginSavingEnabled()">getLoginSavingEnabled</a>(in AString aHost);</code></td>
+ </tr>
+ <tr>
+ <td><code>void <a href="#modifyLogin()">modifyLogin</a>(in nsILoginInfo oldLogin, in nsISupports newLoginData);</code></td>
+ </tr>
+ <tr>
+ <td><code>void <a href="#removeAllLogins()">removeAllLogins</a>();</code></td>
+ </tr>
+ <tr>
+ <td><code>void <a href="#removeLogin()">removeLogin</a>(in nsILoginInfo aLogin);</code></td>
+ </tr>
+ <tr>
+ <td><code>void <a href="#searchLogins()">searchLogins</a>(out unsigned long count, in nsIPropertyBag matchData, [retval, array, size_is(count)] out nsILoginInfo logins);</code> </td>
+ </tr>
+ <tr>
+ <td><code>void <a href="#setLoginSavingEnabled()">setLoginSavingEnabled</a>(in AString aHost, in boolean isEnabled);</code></td>
+ </tr>
+ </tbody>
+</table>
+<h2 id="Methods" name="Methods">Methods</h2>
+<h3 id="addLogin()" name="addLogin()">addLogin()</h3>
+<p>Stores a new login in the Login Manager.</p>
+<p></p><div class="blockIndicator note"><strong>Примечание:</strong> Default values for the <code><a href="/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILoginMetaInfo" title="">nsILoginMetaInfo</a></code> properties are created if the specified login doesn't explicitly specify them.</div><p></p>
+<pre class="eval">void addLogin(
+ in nsILoginInfo aLogin
+);
+</pre>
+<h6 id="Parameters" name="Parameters">Parameters</h6>
+<dl>
+ <dt>
+ <code>aLogin</code></dt>
+ <dd>
+ The login to store.</dd>
+</dl>
+<h6 id="Exceptions_thrown" name="Exceptions_thrown">Exceptions thrown</h6>
+<dl>
+ <dt>
+  </dt>
+ <dd>
+ An exception is thrown if the login information is already stored in the Login Manager. To change a login, you have to use <code><a href="https://developer.mozilla.org/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILoginManager#modifyLogin()">modifyLogin()</a></code>.</dd>
+</dl>
+<h3 id="autoCompleteSearch()" name="autoCompleteSearch()">autoCompleteSearch()</h3>
+<p>Generates results for a user field autocomplete menu.</p>
+<p></p><div class="blockIndicator note"><strong>Примечание:</strong> This method is provided for use only by the <code>FormFillController</code>, which calls it directly. It should not be used for any other purpose.</div><p></p>
+<pre class="eval">nsIAutoCompleteResult autoCompleteSearch(
+ in AString aSearchString,
+ in nsIAutoCompleteResult aPreviousResult,
+ in nsIDOMHTMLInputElement aElement
+);
+</pre>
+<h6 id="Parameters" name="Parameters">Parameters</h6>
+<dl>
+ <dt>
+ <code>aSearchString</code></dt>
+ <dd>
+ Missing Description</dd>
+ <dt>
+ <code>aPreviousResult</code></dt>
+ <dd>
+ Missing Description</dd>
+ <dt>
+ <code>aElement</code></dt>
+ <dd>
+ Missing Description</dd>
+</dl>
+<h6 id="Return_value" name="Return_value">Return value</h6>
+<p>Missing Description</p>
+<h3 id="countLogins()" name="countLogins()">countLogins()</h3>
+<p>Returns the number of logins matching the specified criteria. Called when only the number of logins is needed, and not the actual logins (which avoids prompting the user for a Master Password, as the logins don't need to be decrypted).</p>
+<pre class="eval">unsigned long countLogins(
+ in AString aHostname,
+ in AString aActionURL,
+ in AString aHttpRealm
+);
+</pre>
+<h6 id="Parameters" name="Parameters">Parameters</h6>
+<dl>
+ <dt>
+ <code>aHostname</code></dt>
+ <dd>
+ The hostname to which to restrict searches, formatted as a URL. For example, "<a class="external" href="http://www.bar.com" rel="freelink">http://www.bar.com</a>". To match all hostnames, specify <code>""</code> (empty string). A value of <code>null</code> will cause countLogins() to not match any logins.</dd>
+ <dt>
+ <code>aActionURL</code></dt>
+ <dd>
+ For form logins, this parameter should specify the URL to which the form will be submitted. To match any form login, specify <code>""</code> (empty string). To not match any form logins (For example when interested in protocol logins only), specify <code>null</code>.</dd>
+ <dt>
+ <code>aHttpRealm</code></dt>
+ <dd>
+ For protocol logins, specify the HTTP Realm for which the login applies; this is obtained from the WWW-Authenticate header (see <a class="external" href="http://tools.ietf.org/html/rfc2617" title="http://tools.ietf.org/html/rfc2617">RFC 2617</a>). To match any protocol login, specify <code>""</code> (empty string). To not match any protocol logins (For example when interested in form logins only), specify <code>null</code>.</dd>
+</dl>
+<h6 id="Return_value" name="Return_value">Return value</h6>
+<p>The number of logins matching the parameters passed.</p>
+<p></p><h3 id="fillForm()">fillForm()</h3><p></p>
+<p>Fills out a form with login information, if appropriate information is available.</p>
+<p></p><div class="blockIndicator note"><strong>Примечание:</strong> This method will attempt to fill out the form regardless of the setting of the <code>signon.autofillForms</code> preference.</div><p></p>
+<pre class="eval">boolean fillForm(
+ in nsIDOMHTMLFormElement aForm
+);
+</pre>
+<h6 id="Parameters" name="Parameters">Parameters</h6>
+<dl>
+ <dt>
+ <code>aForm</code></dt>
+ <dd>
+ The HTMLform to attempt to fill out.</dd>
+</dl>
+<h6 id="Return_value" name="Return_value">Return value</h6>
+<p><code>true</code> if the form was successfully filled out; otherwise <code>false</code>.</p>
+<h3 id="findLogins()" name="findLogins()">findLogins()</h3>
+<p>Searches for logins matching the specified criteria. Called when looking for logins that might be applicable to a given form or authentication request.</p>
+<pre class="eval">void findLogins(
+ out unsigned long count,
+ in AString aHostname,
+ in AString aActionURL,
+ in AString aHttpRealm,
+ [retval, array, size_is(count)] out nsILoginInfo logins
+);
+</pre>
+<h6 id="Parameters" name="Parameters">Parameters</h6>
+<dl>
+ <dt>
+ <code>count</code></dt>
+ <dd>
+ The number of elements in the returned array. JavaScript callers can simply use the array's <code>length</code> property and supply a dummy argument for this parameter.</dd>
+ <dt>
+ <code>aHostname</code></dt>
+ <dd>
+ The hostname to restrict searches to, formatted as a URL. For example, "<a class="external" href="http://www.bar.com" rel="freelink">http://www.bar.com</a>".</dd>
+ <dt>
+ <code>aActionURL</code></dt>
+ <dd>
+ For form logins, this parameter should specify the URL to which the form will be submitted. For protocol logins, specify <code>null</code>. An empty string ("") will match any value (except <code>null</code>).</dd>
+ <dt>
+ <code>aHttpRealm</code></dt>
+ <dd>
+ For protocol logins, specify the HTTP Realm for which the login applies; this is obtained from the WWW-Authenticate header (see <a class="external" href="http://tools.ietf.org/html/rfc2617" title="http://tools.ietf.org/html/rfc2617">RFC 2617</a>). For form logins, this parameter should be <code>null</code>. An empty string ("") will match any value (except <code>null</code>).</dd>
+ <dt>
+ <code>logins</code></dt>
+ <dd>
+ An array of <code><a href="/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILoginInfo" title="">nsILoginInfo</a></code> objects.</dd>
+</dl>
+<h6 id="Example" name="Example">Example</h6>
+<p>This method can be called from JavaScript like this:</p>
+<pre class="brush: js"> var logins = myLoginMgr.findLogins({}, hostname, ...);
+</pre>
+<h3 id="getAllDisabledHosts()" name="getAllDisabledHosts()">getAllDisabledHosts()</h3>
+<p>Returns a list of all hosts for which login saving is disabled.</p>
+<pre class="eval">void getAllDisabledHosts(
+ [optional] out unsigned long count,
+ [retval, array, size_is(count)] out wstring hostnames
+);
+</pre>
+<h6 id="Parameters" name="Parameters">Parameters</h6>
+<dl>
+ <dt>
+ <code>count</code></dt>
+ <dd>
+ The number of elements in the returned array. JavaScript callers can simply use the array's <code>length</code> property and supply a dummy argument for this parameter.</dd>
+ <dt>
+ <code>hostnames</code></dt>
+ <dd>
+ An array of hostname strings in URL format without a pathname. For example: <span class="nowiki">"https://www.site.com"</span>.</dd>
+</dl>
+<h6 id="Example" name="Example">Example</h6>
+<p>You can call this method from JavaScript like this:</p>
+<pre class="brush: js"> var disabledHosts = myLoginMgr.getAllDisabledHosts({});
+</pre>
+<h3 id="getAllLogins()" name="getAllLogins()">getAllLogins()</h3>
+<p>Returns an array containing all logins recorded by the Login Manager.</p>
+<p>If you just want to see if any logins are stored, use <code><a href="https://developer.mozilla.org/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILoginManager#countLogins()">countLogins()</a></code> instead. It's more efficient, and avoids the possibility of the user being prompted for their master password.</p>
+<pre class="eval">void getAllLogins(
+ [optional] out unsigned long count,
+ [retval, array, size_is(count)] out nsILoginInfo logins
+);
+</pre>
+<h6 id="Parameters" name="Parameters">Parameters</h6>
+<dl>
+ <dt>
+ <code>count</code></dt>
+ <dd>
+ The number of elements in the returned array. JavaScript callers can simply use the array's <code>length</code> property and supply a dummy argument for this parameter.</dd>
+ <dt>
+ <code>logins</code></dt>
+ <dd>
+ An array of <code><a href="/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILoginInfo" title="">nsILoginInfo</a></code> objects containing all the logins the Login Manager has on record.</dd>
+</dl>
+<h6 id="Example" name="Example">Example</h6>
+<p>You can call this method from JavaScript like this:</p>
+<pre class="brush: js"> var logins = myLoginMgr.getAllLogins({});
+</pre>
+<h3 id="getLoginSavingEnabled()" name="getLoginSavingEnabled()">getLoginSavingEnabled()</h3>
+<p>Reports whether or not saving login information is enabled for a host.</p>
+<pre class="eval">boolean getLoginSavingEnabled(
+ in AString aHost
+);
+</pre>
+<h6 id="Parameters" name="Parameters">Parameters</h6>
+<dl>
+ <dt>
+ <code>aHost</code></dt>
+ <dd>
+ The hostname to check. This argument should be in the origin URL format, with no pathname. For example: <span class="nowiki">"https://www.site.com"</span>.</dd>
+</dl>
+<h6 id="Return_value" name="Return_value">Return value</h6>
+<p><code>true</code> if login saving is enabled for the host, otherwise <code>false</code>.</p>
+<h3 id="modifyLogin()" name="modifyLogin()">modifyLogin()</h3>
+<p>Modifies an existing login by replacing it with a new one.</p>
+<p>If newLoginData is a <code><a href="/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILoginInfo" title="">nsILoginInfo</a></code>, all of the old login's <code><a href="/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILoginInfo" title="">nsILoginInfo</a></code> properties are changed to the values from newLoginData (but the old login's <code><a href="/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILoginMetaInfo" title="">nsILoginMetaInfo</a></code> properties are unmodified).</p>
+<p>If newLoginData is a <code><a href="/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIPropertyBag" title="">nsIPropertyBag</a></code>, only the specified properties will be changed. The <code><a href="/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILoginMetaInfo" title="">nsILoginMetaInfo</a></code> properties of oldLogin can be changed in this manner.</p>
+<p>If the propertybag contains an item named "timesUsedIncrement", the login's timesUsed property will be incremented by the item's value.</p>
+<pre class="eval">void modifyLogin(
+ in nsILoginInfo oldLogin,
+ in nsISupports newLoginData
+);
+</pre>
+<h6 id="Parameters" name="Parameters">Parameters</h6>
+<dl>
+ <dt>
+ <code>oldLogin</code></dt>
+ <dd>
+ The login to be modified.</dd>
+ <dt>
+ <code>newLoginData</code></dt>
+ <dd>
+ The login information to replace the <code>oldLogin</code> with. This may be specified as either an <code><a href="/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILoginInfo" title="">nsILoginInfo</a></code> or an <code><a href="/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIPropertyBag2" title="">nsIPropertyBag2</a></code> object.</dd>
+</dl>
+<h3 id="removeAllLogins()" name="removeAllLogins()">removeAllLogins()</h3>
+<p>Removes all logins known by the Login Manager. This works without a need for the master password, if one is set.</p>
+<pre class="eval">void removeAllLogins();
+</pre>
+<h6 id="Parameters" name="Parameters">Parameters</h6>
+<p>None.</p>
+<h3 id="removeLogin()" name="removeLogin()">removeLogin()</h3>
+<p>Removes a login from the Login Manager.</p>
+<p></p><div class="blockIndicator note"><strong>Примечание:</strong> The specified login must exactly match a stored login. However, the values of any <code><a href="/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILoginMetaInfo" title="">nsILoginMetaInfo</a></code> properties are ignored.</div><p></p>
+<pre class="eval">void removeLogin(
+ in nsILoginInfo aLogin
+);
+</pre>
+<h6 id="Parameters" name="Parameters">Parameters</h6>
+<dl>
+ <dt>
+ <code>aLogin</code></dt>
+ <dd>
+ The login to remove from the Login Manager. Only a login that is an exact match is deleted.</dd>
+</dl>
+<p></p><h3 id="searchLogins()">searchLogins()</h3><p></p>
+<p>Searches for logins in the login manager's data store, returning an array of matching logins. If there are no matching logins, an empty array is returned.</p>
+<pre class="eval">void searchLogins(
+ out unsigned long count,
+ in nsIPropertyBag matchData,
+ [retval, array, size_is(count)] out nsILoginInfo logins
+);
+</pre>
+<h6 id="Parameters" name="Parameters">Parameters</h6>
+<dl>
+ <dt>
+ <code>count</code></dt>
+ <dd>
+ The number of elements in the returned array.</dd>
+ <dt>
+ <code>matchData</code></dt>
+ <dd>
+ The data used for the search. This does not follow the same requirements as <code><a href="https://developer.mozilla.org/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILoginManager#findLogins()">findLogins()</a></code> for those fields; wildcard matches are not specified.</dd>
+ <dt>
+ <code>logins</code></dt>
+ <dd>
+ An array of matching <code><a href="/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILoginInfo" title="">nsILoginInfo</a></code> objects.</dd>
+</dl>
+<h6 id="Example" name="Example">Example</h6>
+<p>This method can be called from JavaScript like this:</p>
+<pre class="brush: js"> var logins = myLoginMgr.searchLogins({}, matchData);
+ var numLogins = logins.length;
+</pre>
+<h3 id="setLoginSavingEnabled()" name="setLoginSavingEnabled()">setLoginSavingEnabled()</h3>
+<p>Enables or disables storing logins for a specified host. When login storing is disabled, the Login Manager won't prompt the user to store logins for that host. Existing logins are not affected.</p>
+<pre class="eval">void setLoginSavingEnabled(
+ in AString aHost,
+ in boolean isEnabled
+);
+</pre>
+<h6 id="Parameters" name="Parameters">Parameters</h6>
+<dl>
+ <dt>
+ <code>aHost</code></dt>
+ <dd>
+ The hostname to adjust the setting for. This argument should be in the origin URL format, with no pathname. For example: <span class="nowiki">"https://www.site.com"</span>.</dd>
+ <dt>
+ <code>isEnabled</code></dt>
+ <dd>
+ If <code>true</code>, login saving is enabled for the specified host. If <code>false</code>, login saving is disabled.</dd>
+</dl>
+<h2 id="See_also" name="See_also">See also</h2>
+<ul>
+ <li><code><a href="/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILoginInfo" title="">nsILoginInfo</a></code></li>
+ <li><a href="/en/XPCOM_Interface_Reference/nsILoginManager/Using_nsILoginManager" title="en/Using_nsILoginManager">Using nsILoginManager</a></li>
+</ul>
+<p></p>
diff --git a/files/ru/mozilla/tech/xpcom/reference/interface/nsiloginmanager/using_nsiloginmanager/index.html b/files/ru/mozilla/tech/xpcom/reference/interface/nsiloginmanager/using_nsiloginmanager/index.html
new file mode 100644
index 0000000000..16c2c5a029
--- /dev/null
+++ b/files/ru/mozilla/tech/xpcom/reference/interface/nsiloginmanager/using_nsiloginmanager/index.html
@@ -0,0 +1,169 @@
+---
+title: Using nsILoginManager
+slug: Mozilla/Tech/XPCOM/Reference/Interface/nsILoginManager/Using_nsILoginManager
+translation_of: Mozilla/Tech/XPCOM/Reference/Interface/nsILoginManager/Using_nsILoginManager
+---
+<div>
+ </div>
+<h2 id="Working_with_the_Login_Manager" name="Working_with_the_Login_Manager">Working with the Login Manager</h2>
+<p>Extensions often need to securely store passwords to external sites, web applications, and so on. To do so securely, they can use <code><a href="/en-US/docs/XPCOM_Interface_Reference/nsILoginManager" title="en-US/docs/nsILoginManager">nsILoginManager</a></code>, which provides for secure storage of sensitive password information and <code><a href="/en-US/docs/XPCOM_Interface_Reference/nsILoginInfo" title="en-US/docs/nsILoginInfo">nsILoginInfo</a></code>, which provides a way of storing login information.</p>
+<h2 id="Getting_nsILoginManager" name="Getting_nsILoginManager">Getting <code>nsILoginManager</code></h2>
+<p>To get a component implementing <code>nsILoginManager</code>, use the following:</p>
+<div style="margin-right: 270px;">
+ <pre class="brush: js">var passwordManager = Components.classes["@mozilla.org/login-manager;1"].getService(
+ Components.interfaces.nsILoginManager
+);</pre>
+</div>
+<p>Most Login Manager functions take an <code><a href="/en-US/docs/XPCOM_Interface_Reference/nsILoginInfo" title="en-US/docs/nsILoginInfo">nsILoginInfo</a></code> object as a parameter. An <code><a href="/en-US/docs/XPCOM_Interface_Reference/nsILoginInfo" title="en-US/docs/nsILoginInfo">nsILoginInfo</a></code> object contains the following attributes: hostname, form submit URL, HTTP realm, username, username field, password, and password field. The hostname, username and password attributes are mandatory, while the other fields are set based on whether the login is for a web page form or an HTTP/FTP authentication site login. See the <code><a href="/en-US/docs/XPCOM_Interface_Reference/nsILoginInfo" title="en-US/docs/nsILoginInfo">nsILoginInfo</a></code> attribute definitions for more details. Defining an <code><a href="/en-US/docs/XPCOM_Interface_Reference/nsILoginInfo" title="en-US/docs/nsILoginInfo">nsILoginInfo</a></code> object is simple:</p>
+<div style="margin-right: 270px;">
+ <pre class="brush: js">var nsLoginInfo = new Components.Constructor(
+ "@mozilla.org/login-manager/loginInfo;1",
+ Components.interfaces.nsILoginInfo,
+ "init"
+);
+
+var loginInfo = new nsLoginInfo(
+ hostname, formSubmitURL, httprealm, username, password, usernameField, passwordField
+);
+</pre>
+</div>
+<h2 id="Examples" name="Examples">Examples</h2>
+<h3 id="Creating_a_login_for_a_web_page" name="Creating_a_login_for_a_web_page">Creating a login for a web page</h3>
+<pre class="brush: js">var formLoginInfo = new nsLoginInfo(
+ 'http://www.example.com',
+ 'http://login.example.com',
+ null,
+ 'joe',
+ 'SeCrEt123',
+ 'uname',
+ 'pword'
+);</pre>
+<p>This login would correspond to a HTML form such as:</p>
+<pre class="brush: html">&lt;form action="http://login.example.com/foo/authenticate.cgi"&gt;
+ &lt;div&gt;Please log in.&lt;/div&gt;
+ &lt;label&gt;Username:&lt;/label&gt; &lt;input type="text" name="uname"&gt;
+ &lt;label&gt;Password:&lt;/label&gt; &lt;input type="password" name="pword"&gt;
+&lt;/form&gt;
+</pre>
+<h3 id="Creating_a_site_authentication_login" name="Creating_a_site_authentication_login">Creating a site authentication login</h3>
+<pre class="brush: js">var authLoginInfo = new nsLoginInfo(
+ 'http://www.example.com',
+ null,
+ 'ExampleCo Login',
+ 'alice',
+ 'SeCrEt321',
+ "",
+ ""
+);
+</pre>
+<p>This would correspond to a login on <span class="nowiki">http://www.example.com</span> when the server sends a reply such as:</p>
+<pre class="eval"> HTTP/1.0 401 Authorization Required
+ Server: Apache/1.3.27
+ WWW-Authenticate: Basic realm="ExampleCo Login"
+
+</pre>
+<h3 id="Creating_a_local_extension_login" name="Creating_a_local_extension_login">Creating a local extension login</h3>
+<pre class="brush: js">var extLoginInfo = new nsLoginInfo(
+ 'chrome://firefoo',
+ null,
+ 'User Registration',
+ 'bob',
+ '123sEcReT',
+ "",
+ ""
+);</pre>
+<p>From a component creating a new info block is done slightly differently:</p>
+<pre>var nsLoginInfo = <span class="k"><span class="s0">new</span></span> <a class="r" title='Search for references of "Components"'>Components</a>.<a class="r" title='Search for references of "Constructor"'>Constructor</a>("@<a class="r" title='Search for references of "mozilla"'>mozilla</a>.<a class="r" title='Search for references of "org"'>org</a>/<a class="r" title='Search for references of "login"'>login</a>-<a class="r" title='Search for references of "manager"'>manager</a>/<a class="r" title='Search for references of "loginInfo"'>loginInfo</a>;1", <a class="r" title='Search for references of "Ci"'>Ci</a>.<a class="r" title='Search for references of "nsILoginInfo"'>nsILoginInfo</a>, "<a class="r" title='Search for references of "init"'>init</a>");
+<span class="k">var</span> extLoginInfo = <span class="k"><span class="s0">new</span></span> <a class="r" title='Search for references of "nsLoginInfo"'><span class="s1">nsLoginInfo</span></a>('<a class="r" title='Search for references of "chrome"'>chrome</a>:<span class="c">//firefoo',</span> null, 'User Registration', 'bob', '123sEcReT', '', '');
+//var extLoginInfo = new nsLoginInfo(<a class="r" title='Search for references of "aHostname"'>aHostname</a>, <a class="r" title='Search for references of "aFormSubmitURL"'>aFormSubmitURL</a>, <a class="r" title='Search for references of "aHttpRealm"'>aHttpRealm</a>, <a class="r" title='Search for references of "aUsername"'>aUsername</a>, <a class="r" title='Search for references of "aPassword"'>aPassword</a>, <a class="r" title='Search for references of "aUsernameField"'>aUsernameField</a>, <a class="r" title='Search for references of "aPasswordField"'>aPasswordField)</a>
+</pre>
+<p>The Login Manager treats this as if it was a web site login. You should use your extension's chrome:// URL to prevent conflicts with other extensions, and a realm string which briefly denotes the login's purpose.</p>
+<h2 id="Storing_a_password" name="Storing_a_password">Storing a password</h2>
+<p>To store a password in the Login Manager, you first need to create an <code><a href="/en-US/docs/XPCOM_Interface_Reference/nsILoginInfo" title="en-US/docs/nsILoginInfo">nsILoginInfo</a></code> object as defined above. Then you simply need to call the <code><a href="/en-US/docs/XPCOM_Interface_Reference/nsILoginManager" title="en-US/docs/nsILoginManager">nsILoginManager</a></code> method <code><a href="/en-US/docs/XPCOM_Interface_Reference/nsILoginManager#addLogin.28.29" title="en-US/docs/nsILoginManager#addLogin.28.29">addLogin()</a></code>.</p>
+<pre class="brush: js">myLoginManager.addLogin(loginInfo);
+</pre>
+<p></p><div class="blockIndicator note"><strong>Примечание:</strong> This will throw an exception if both the <code>httprealm</code> and <code>formSubmitURL</code> parameters are <code>NULL</code>. One must be specified when storing a password. The <code>hostname</code>, <code>username</code> and <code>password</code> parameters are also mandatory.</div><p></p>
+<h2 id="Retrieving_a_password" name="Retrieving_a_password">Retrieving a password</h2>
+<p>Retrieving a password from the Login Manager is slightly more difficult. In order to locate a password, the <code>hostname</code>, <code>formSubmitURL</code> and <code>httprealm</code> must <strong>match exactly</strong> what is stored for the password to be found. The only exception is that if the stored <code>formSubmitURL</code> is blank, in which case the <code>formSubmitURL</code> parameter is ignored. Note that the <code>hostname</code> and <code>formSubmitURL</code> arguments should not include the path from the full URL. The example below should serve as a starting point for matching form logins:</p>
+<pre class="brush: js">var hostname = 'http://www.example.com';
+var formSubmitURL = 'http://www.example.com'; // not http://www.example.com/foo/auth.cgi
+var httprealm = null;
+var username = 'user';
+var password;
+
+try {
+ // Get Login Manager
+ var myLoginManager = Components.classes["@mozilla.org/login-manager;1"].
+ getService(Components.interfaces.nsILoginManager);
+
+ // Find users for the given parameters
+ var logins = myLoginManager.findLogins({}, hostname, formSubmitURL, httprealm);
+
+ // Find user from returned array of nsILoginInfo objects
+ for (var i = 0; i &lt; logins.length; i++) {
+ if (logins[i].username == username) {
+ password = logins[i].password;
+ break;
+ }
+ }
+}
+
+catch(ex) {
+ // This will only happen if there is no nsILoginManager component class
+}</pre>
+<p>Note that the user will be prompted for their master password if they have chosen to set one to secure their passwords.</p>
+<h2 id="Removing_a_password" name="Removing_a_password">Removing a password</h2>
+<p>Removing a password is simple:</p>
+<pre class="brush: js">myLoginManager.removeLogin(loginInfo);
+</pre>
+<p>When removing a password the specified <code><a href="/en-US/docs/XPCOM_Interface_Reference/nsILoginInfo" title="en-US/docs/nsILoginInfo">nsILoginInfo</a></code> object must <strong>exactly match</strong> what was stored or an exception will be thrown. This includes the password attribute. Here's an example on how to remove the password without actually knowing what the password is:</p>
+<pre class="brush: js">// example values
+var hostname = 'http://www.example.com';
+var formSubmitURL = 'http://www.example.com';
+var httprealm = null;
+var username = 'user';
+
+try {
+ // Get Login Manager
+ var passwordManager = Components.classes["@mozilla.org/login-manager;1"].
+ getService(Components.interfaces.nsILoginManager);
+
+ // Find users for this extension
+ var logins = passwordManager.findLogins({}, hostname, formSubmitURL, httprealm);
+
+ for (var i = 0; i &lt; logins.length; i++) {
+ if (logins[i].username == username) {
+ passwordManager.removeLogin(logins[i]);
+ break;
+ }
+ }
+}
+catch(ex) {
+ // This will only happen if there is no nsILoginManager component class
+}</pre>
+<h2 id="Changing_stored_login_information" name="Changing_stored_login_information">Changing stored login information</h2>
+<p>Changing a password is rather simple. Since all this does is make a <code><a href="/en-US/docs/XPCOM_Interface_Reference/nsILoginManager#removeLogin.28.29" title="en-US/docs/nsILoginManager#removeLogin.28.29">removeLogin()</a></code> call followed by an <code><a href="/en-US/docs/XPCOM_Interface_Reference/nsILoginManager#addLogin.28.29" title="en-US/docs/nsILoginManager#addLogin.28.29">addLogin()</a></code> call, it has the same caveats as both of them: namely that the <code>oldLogin</code> must match an existing login exactly (see above) and that the <code>newLogin</code> attributes must be set correctly.:</p>
+<pre class="brush: js">myLoginManager.modifyLogin(oldLogin, newLogin);</pre>
+<h2 id="Debugging" name="Debugging">Login Manager notifications</h2>
+<p></p><div class="blockIndicator standardNote">
+ <p><a href="https://developer.mozilla.org/ru/docs/Mozilla/Firefox/Releases/3.5">Замечание по Firefox 3.5</a></p>
+ <p style="font-weight: 400;">The Login Manager notifications were added in Firefox 3.5.</p>
+</div><p></p>
+<p>Firefox 3.5 and later send assorted notifications when various Login Manager related events occur, including when form autofill does not occur for various reasons, as well as when changes are made to the Login Manager's database. See the <a class="internal" href="/en-US/docs/Observer_Notifications#Login_Manager" title="en-US/docs/Observer Notifications#Login Manager">Login Manager</a> section of the article on observer notifications for details.</p>
+<h2 id="Debugging" name="Debugging">Debugging</h2>
+<p>The login manager implementation has the ability to send debug messages to the Error Console, which can provide some visibility into what it's doing. To enable the debug logging, see <a class="external" href="http://wiki.mozilla.org/Firefox:Password_Manager_Debugging" rel="freelink">http://wiki.mozilla.org/Firefox:Pass...ager_Debugging</a>.</p>
+<h2 id="Supporting_older_versions_of_Firefox" name="Supporting_older_versions_of_Firefox">Supporting older versions of Gecko</h2>
+<p>If you want your extension to support both Gecko 1.9 (Firefox 3, Thunderbird 3, SeaMonkey 2) and older versions it will need to implement both the <code><a href="/en-US/docs/XPCOM_Interface_Reference/nsILoginManager" title="en-US/docs/nsILoginManager">nsILoginManager</a></code> and <code><a href="/en-US/docs/nsIPasswordManager" title="en-US/docs/nsIPasswordManager">nsIPasswordManager</a></code> components. A simple method to do this is as follows:</p>
+<pre class="brush: js">if ("@mozilla.org/passwordmanager;1" in Components.classes) {
+ // Password Manager exists so this is not Firefox 3 (could be Firefox 2, Netscape, SeaMonkey, etc).
+ // Password Manager code
+} else if ("@mozilla.org/login-manager;1" in Components.classes) {
+ // Login Manager exists so this is Firefox 3
+ // Login Manager code
+}</pre>
+<h2 id="See_also" name="See_also">See also</h2>
+<ul>
+ <li><code><a href="/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILoginManager" title="">nsILoginManager</a></code></li>
+ <li><code><a href="/ru/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILoginInfo" title="">nsILoginInfo</a></code></li>
+ <li><a href="/en-US/docs/Creating_a_Login_Manager_storage_module" title="en-US/docs/Creating_a_Login_Manager_storage_module">Creating a Login Manager storage module</a></li>
+</ul>