From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../components.exception/index.html | 35 ++++ .../liaisons_de_langage/components.id/index.html | 26 +++ files/fr/xpcom/liaisons_de_langage/index.html | 108 ++++++++++++ .../objet_components/index.html | 181 +++++++++++++++++++++ 4 files changed, 350 insertions(+) create mode 100644 files/fr/xpcom/liaisons_de_langage/components.exception/index.html create mode 100644 files/fr/xpcom/liaisons_de_langage/components.id/index.html create mode 100644 files/fr/xpcom/liaisons_de_langage/index.html create mode 100644 files/fr/xpcom/liaisons_de_langage/objet_components/index.html (limited to 'files/fr/xpcom/liaisons_de_langage') diff --git a/files/fr/xpcom/liaisons_de_langage/components.exception/index.html b/files/fr/xpcom/liaisons_de_langage/components.exception/index.html new file mode 100644 index 0000000000..e50af52389 --- /dev/null +++ b/files/fr/xpcom/liaisons_de_langage/components.exception/index.html @@ -0,0 +1,35 @@ +--- +title: Components.Exception +slug: XPCOM/Liaisons_de_langage/Components.Exception +translation_of: Mozilla/Tech/XPCOM/Language_Bindings/Components.Exception +--- +

Résumé

+ +

Components.Exception est un constructeur JavaScript pour créer des objets nsIXPCException. Ces objets exceptions peuvent être émis lors de l'implémentation des interfaces XPCOM en JavaScript, et ils peuvent fournir de meilleurs diagnostics dans la console d'erreur que la simplement valeur nsresult.

+ +

Voir aussi nsIXPCException.

+ +

Syntaxe

+ +
var exception = [ new ] Components.Exception([ message [, result [, stack [, data ] ] ] ]);
+
+ +

Paramètres

+ +
+
message
+
Une chaîne qui peut être affiché dans la console d'erreur lorsque votre exception.
+
result 
+
La valeur nsresult de l'exception, qui par défaut est Components.results.NS_ERROR_FAILURE.
+
stack 
+
Une pile XPCOM réglée sur l'exception (par défaut à la chaîne de la pile en cours).
+
data 
+
toutes les données supplémentaires que vous pouvez stocker, par défaut null.
+
+ +

Exemple

+ +
throw Components.Exception("I am throwing an Exception from a Javascript XPCOM component.");
+
+ +

diff --git a/files/fr/xpcom/liaisons_de_langage/components.id/index.html b/files/fr/xpcom/liaisons_de_langage/components.id/index.html new file mode 100644 index 0000000000..6b9fd7c7cb --- /dev/null +++ b/files/fr/xpcom/liaisons_de_langage/components.id/index.html @@ -0,0 +1,26 @@ +--- +title: Components.ID +slug: XPCOM/Liaisons_de_langage/Components.ID +translation_of: Mozilla/Tech/XPCOM/Language_Bindings/Components.ID +--- +

Résumé

+ +

Components.ID est un constructeur qui crée des objets natifs qui sont conformes à l'interface nsIJSID.

+ +

Syntaxe

+ +
var interfaceID = [ new ] Components.ID(iid);
+
+ +

Paramètres

+ +
+
iid
+
Une chaîne de format '{00000000-0000-0000-0000-000000000000}' donnant l'ID de l'interface
+
+ +

Description

+ +

Components.ID crée des interfaceID pour une utilisation dans la mise en œuvre des méthodes telles que QueryInterface, getInterfaces, et d'autres méthodes qui prennent des ID d'interface en tant que paramètres.Components.classes , Components.classes, Components.classesByID fournissent à peu près tous les nsIDs qu'a besoin JavaScript. L'exception à cette règle est le cas où un composant est écrit en JavaScript et doit s'inscrire lui-même avec le gestionnaire de composant en utilisant son propre nsID - ID qui ne soit pas déjà enregistré et donc ne figure pas dans Components.classes.

+ +

diff --git a/files/fr/xpcom/liaisons_de_langage/index.html b/files/fr/xpcom/liaisons_de_langage/index.html new file mode 100644 index 0000000000..71537a6b7c --- /dev/null +++ b/files/fr/xpcom/liaisons_de_langage/index.html @@ -0,0 +1,108 @@ +--- +title: Liaisons de langage +slug: XPCOM/Liaisons_de_langage +tags: + - XPCOM + - 'XPCOM:Liaisons_de_langage' +translation_of: Mozilla/Tech/XPCOM/Language_Bindings +--- +
+

Une Liaison de langage XPCOM est une passerelle entre un langage donné et XPCOM en vue d'atteindre deux objectifs :  

+ + + +

Puisque la couche XPCOM est écrite en C/C++, son API peut être employée sans intermédiaire avec les langages C et C++. Pour tous les autres langages désirant accéder à l'API XPCOM, l'utilisation d'une passerelle est nécessaire.

+ +

 De telles passerelles existent pour différents langages :

+ +

+
Components.classes
Components.classes est un objet en lecture seule dont les propriétés sont des classes indexées par ContractID. Sespropriétés mettre en œuvre l'interface nsIJSCID. Chaque objet représente l'une des classes de XPCOM qui peuvent être construits ou accessibles en tant que service XPCOM.
Components.Constructor
Crée une fonction JavaScript qui peut être utilisé pour construire de nouvelles instances de composants XPCOM.
Components.Exception
Components.Exception est un constructeur JavaScript pour créer des objets nsIXPCException. Ces objets exceptions peuvent être émis lors de l'implémentation des interfaces XPCOM en JavaScript, et ils peuvent fournir de meilleurs diagnostics dans la console d'erreur que la simplement valeur nsresult.
Components.ID
Components.ID est un constructeur qui crée des objets natifs qui sont conformes à l'interface nsIJSID.
Components.utils
Components.utils est une collection de diverses fonctionnalités utiles à XPConnect. Son interface est définie dans js/xpconnect/idl/xpccomponents.idl. Cet objet a actuellement les membres suivants :
Components.utils.evalInSandbox
Il peut arriver que vous vouliez exécuter du code JavaScript avec des droits restreints. Depuis Firefox 1.5 (Gecko 1.8) vous pouvez faire cela en utilisant une API qui permet la création de "bacs à sables" à l'intérieur desquels le code sera interprété avec des droits restreints, comme le code exécuté dans une page web.
+
Components.utils.import
Components.utils.reportError
JavaXPCOM
Objet Components
L'objet Components est l'objet au travers duquel les fonctionnalités XPConnect sont reflétées en JavaScript. Il s'agit en réalité d'une instance native de l'interface nsIXPCComponents qui est reflétée en JavaScript comme un objet de niveau global à l'aide d'XPConnect.
Objet Components
L'objet Components est l'objet au travers duquel les fonctionnalités XPConnect sont reflétées en JavaScript. Il s'agit en réalité d'une instance native de l'interface nsIXPCComponents qui est reflétée en JavaScript comme un objet de niveau global à l'aide d'XPConnect.
PyXPCOM
PyXPCOM permet la communication entre Python et XPCOM de telle façon qu'une application Python puisse accéder à des objets XPCOM, et que XPCOM puisse accéder à des classes Python qui implémentent une interface XPCOM. PyXPCOM est utilisé dans ActiveState Komodo, par exemple.
+

+ +
+
+
+
Components.classesByID
+
Components.classesByID is a read-only object whose properties are classes indexed by CID.
+
Components.interfaces
+
Components.interfaces is a read-only object whose properties are interfaces indexed by their names.
+
Components.interfacesByID
+
Components.interfacesByID is a read-only array of classes indexed by IID.
+
Components.isSuccessCode
+
Determines whether a given XPCOM return code (that is, an nsresult value) indicates the success or failure of an operation, returning true or false respectively.
+
Components.lastResult
+
 
+
Components.manager
+
 
+
Components.results
+
Components.results is a read-only object whose properties are the names listed as the first parameters of the macros in js/xpconnect/src/xpc.msg (also at Table Of Errors), with the value of each corresponding to that constant's value.
+
Components.returnCode
+
 
+
Components.stack
+
Components.stack is a read only property of type nsIStackFrame (IDL definition) that represents a snapshot of the current JavaScript callstack. This can be used for various diagnostic purposes.
+
Components.utils
+
Components.utils is a collection of various useful XPConnect features. Its interface is defined at js/xpconnect/idl/xpccomponents.idl.
+
Components.utils.Sandbox
+
Components.utils.Sandbox is used to create a sandbox object for use with evalInSandbox().
+
Components.utils.cloneInto
+
This function provides a safe way to take an object defined in a privileged scope and create a structured clone of it in a less-privileged scope. It returns a reference to the clone:
+
Components.utils.createObjectIn
+
Components.utils.createObjectIn creates a new JavaScript object in the scope of the specified object's compartment.
+
Components.utils.evalInSandbox
+
The evalInSandbox() function enables you to evaluate JavaScript code inside a sandbox you've previously created using the Components.utils.Sandbox constructor.
+
Components.utils.evalInWindow
+
This function enables code running in a more-privileged JavaScript context to evaluate a string in a less-privileged JavaScript context. The result is structured cloned back to the original context, unless it is native (for example, if it returns a DOM node, this is not structured cloned, because the original context will see that through an XrayWrapper already), so it's guaranteed to behave predictably.
+
+ This is useful for privileged code, such as add-on code, to access variables and APIs defined in web content.
+
Components.utils.exportFunction
+
This function provides a safe way to expose a function from a privileged scope to a less-privileged scope. In this way privileged code, such as an add-on, can share code with less-privileged code like a normal web page script. A function exported from privileged to less-privileged code can be called from the less privileged code's context.
+
Components.utils.forceGC
+
Components.utils.forceGC lets scripts force a garbage collection cycle. The Mozilla JavaScript engine will perform garbage collection automatically when the JavaScript heap grows beyond a certain size. This mechanism doesn't account for any native (C++) XPCOM objects hanging off JavaScript objects though. In many cases a JavaScript application will have internal knowledge of JavaScript objects referencing large (trees of) XPCOM objects and know when they are no longer reachable. In this case it can be important to be able to force a garbage collection cycle from JavaScript.
+
+ +
+
+
+ +
+
+
Components.utils.getGlobalForObject
+
This method is used to determine the global object with which an object is associated. This is the global object in place at the time the object was created, which is to say the global object used when executing the script that created the object.
+
Components.utils.getWeakReference
+
This method was introduced in Firefox 3 and is used for obtaining a weak reference for an object. To obtain the object reference, you have to call get() on the resulting object.
+
Components.utils.import
+
Components.utils.import was introduced in Firefox 3 and is used for sharing code between different scopes easily. For example, you can import XPCOMUtils.jsm to avoid copy/pasting long XPCOM component registration boilerplate in your component files.
+
Components.utils.importGlobalProperties
+
Imports various objects into a system scope.
+
Components.utils.isXrayWrapper
+
When privileged JavaScript in Gecko accesses objects belonging to less-privileged code (such as untrusted web content), it does so, by default, with "Xray vision": a mechanism that filters out certain changes to the objects that could cause them to behave in unexpected ways. For example, privileged code using an Xray to a DOM object sees only  the original, native version of the DOM object. Any expando properties are not visible, and if any native properties have been redefined, this has no effect.
+
Components.utils.makeObjectPropsNormal
+
Ensures that the specified object's methods are all in the object's scope, and aren't cross-component wrappers.
+
Components.utils.reportError
+
Components.utils.reportError reports a JavaScript Error object to the Error Console, and returns. It is meant for use by extension developers who have exception handler blocks which want to "eat" an exception, but still want to report it to the console.
+
Components.utils.schedulePreciseGC
+
This method lets scripts schedule a garbage collection cycle. The garbage collection cycle will occur sometime in the future, when no JavaScript code is executing. This is useful particularly when testing for memory leaks, because normal garbage collection is conservative when JavaScript code is running to ensure that in-use memory isn't inadvertently collected.
+
Components.utils.setGCZeal
+
This method lets scripts set the zeal level for garbage collection. You can get details on what this method does in JS_SetGCZeal. This method calls through to that thusly:
+
Components.utils.unload
+
Components.utils.unload was introduced in Firefox 7 and is used to unload JavaScript code modules. This can be particularly handy with restartless (boostrapped) extensions, so that you can unload an old version of a code module when a new version of your add-on is installed.
+
Components.utils.unwaiveXrays
+
Undo a previous call to Components.utils.waiveXrays(), restoring Xray vision for the caller.
+
Components.utils.waiveXrays
+
Waives Xray vision for an object, giving the caller a transparent wrapper to the underlying object.
+
JavaXPCOM
+
JavaXPCOM allows for communication between Java and XPCOM, such that a Java application can access XPCOM objects, and XPCOM can access any Java class that implements an XPCOM interface. JavaXPCOM is not actively maintained.
+
PlXPCOM
+
plXPCOM (Perl XPCOM) provides language bindings letting you use XPCOM from Perl code. The resources here provide information about this language binding and how to use it.
+
RbXPCOM
+
RbXPCOM (Ruby Cross-Platform COM) provides bindings between the popular Ruby programming language and XPCOM. You can find additional information using the resource links below.
+
XPConnect
+
XPConnect is a bridge between JavaScript and XPCOM. With XPConnect, you can use XPCOM components from JavaScript code, and interact with JavaScript objects from within XPCOM components. XPConnect is part of Firefox and is actively used in XUL applications.
+
+
+
+
diff --git a/files/fr/xpcom/liaisons_de_langage/objet_components/index.html b/files/fr/xpcom/liaisons_de_langage/objet_components/index.html new file mode 100644 index 0000000000..6389b3393d --- /dev/null +++ b/files/fr/xpcom/liaisons_de_langage/objet_components/index.html @@ -0,0 +1,181 @@ +--- +title: Objet Components +slug: XPCOM/Liaisons_de_langage/Objet_Components +--- +

L'objet Components est l'objet au travers duquel les fonctionnalités XPConnect sont reflétées en JavaScript. Il s'agit en réalité d'une instance native de l'interface nsIXPCComponents qui est reflétée en JavaScript comme un objet de niveau global à l'aide d'XPConnect.

+ +

Certaines propriétés de Components ont besoin de privilèges élevés et peuvent ne pas fonctionner dans des pages Web.

+ +

L'objet Components dispose des membres suivants :

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MembreDescription
classestableau de classes par ContractID
classesByIDtableau de classes par CID
Constructorconstructeur de constructeur de composants
Exceptionconstructeur d'exception XPConnect
IDconstructeur de nsID XPCOM
interfacestableau d'interfaces par nom d'interface
interfacesByIDtableau d'interfaces par IID
isSuccessCodefonction pour déterminer si un résultat donné est un code de réussite
lastResultcode de résultat de l'appel XPConnect le plus récent
managerle gestionnaire global de composants XPCOM
resultstableau des codes de résultats connus par nom
returnCoderésultat en attente pour l'appel courant
stackpile d'appels JavaScript courante
utilsdonne accès à différentes fonctionnalités utiles
utils.evalInSandboxLance du code JavaScript dans une sandbox, généralement pour lancer du code à privilèges restreints.
utils.forceGC Force un cycle de garbage collection.
utils.getWeakReference Obtient une référence faible à l'objet passé.
utils.import Charge un module JS dans le script courant, sans partager de visibilité.
utils.lookupMethodExamine une méthode ou propriété native (c'est-à-dire déclaré dans l'interface) d'un objet XPCOM. Sert à la même chose que XPCNativeWrapper.
utils.reportErrorRapporte un objet d'erreur JavaScript dans la Console d'erreurs.
utils.Sandbox +

Crée des objets de sandbox pout utiliser avec evalInSandbox.

+
+ +

 

+ +
+
 
+
utils
+
provides access to several useful features
+
+
+
utils.atline
+
Provides access to the value of the atline property in the JavaScript environment.
+
utils.createObjectIn
+
Creates a new object in the scope of the specified object's compartment. May only be called from JavaScript code.
+
utils.evalInSandbox
+
Runs JavaScript code in a sandbox, usually used to run code with restricted privileges.
+
utils.forceGC
+
Forces a garbage collection cycle.
+
utils.getGlobalForObject
+
Returns the global object with which a given object is associated (through its prototype chain at birth, for example).
+
utils.getWeakReference
+
Gets a weak reference for the object passed in.
+
utils.import
+
Loads a JavaScript module into the current script, without sharing a scope.
+
utils.lookupMethod
+
Looks up a native (i.e. declared in the interface) method or property of an XPCOM object. Serves the same purpose as XPCNativeWrapper.
+
utils.makeObjectPropsNormal
+
Ensures that all functions come from the specified object's scope, and aren't cross-compartment wrappers. May only be called from JavaScript code.
+
+ +
+
utils.methodjit Obsolète depuis Gecko 24.0
+
Provides access to the value of the methodjit property in the JavaScript environment.
+
+ +
+
utils.methodjit_always Obsolète depuis Gecko 24.0
+
Provides access to the value of the methodjit_always property in the JavaScript environment.
+
+ +
+
utils.relimit
+
Provides access to the value of the relimit property in the JavaScript environment.
+
+ +
+
utils.reportError
+
Reports a JavaScript Error object to the Error Console.
+
utils.schedulePreciseGC
+
Requests that garbage collection occur sometime in the future when no JavaScript code is running; accepts a callback function to receive notification once collection is complete.
+
utils.setGCZeal()
+
Sets the GC zeal level for the context.
+
+ +
+
utils.strict
+
Provides access to the value of the strict property in the JavaScript environment.
+
+ +
+
utils.werror
+
Provides access to the value of the werror property in the JavaScript environment.
+
+ +
+
utils.Sandbox
+
Creates sandbox objects for use with evalInSandbox.
+
utils.xml
+
Provides access to the value of the xml property in the JavaScript environment.
+
+
+
+ +

 

+ +

 

+ +

Components object (en)

-- cgit v1.2.3-54-g00ecf