Search completed in 1.23 seconds.
JavaScript modules - JavaScript
<< Previous This guide gives you all you need to get started with JavaScript
module syntax. A background on
modules JavaScript programs started off pretty small -- most of its usage in the early days was to do isolated scripting tasks, providing a bit of interactivity to your web pages where needed, so large scripts were generally not needed. Fast forward a few years and we now have complete applications being run in browsers with a lot of JavaScript, as well as JavaScript being used in other contexts (Node.js, for example). It has therefore made sense in recent years to start thinking about providing mechanisms for splitting JavaScript programs up into separate
modules that can be imported when needed. Node.js has had this ability for a long time, and there are a number of Jav...
... a lot of JavaScript, as well as JavaScript being used in other contexts (Node.js, for example). It has therefore made sense in recent years to start thinking about providing mechanisms for splitting JavaScript programs up into separate
modules that can be imported when needed. Node.js has had this ability for a long time, and there are a number of JavaScript libraries and frameworks that enable
module usage (for example, other CommonJS and AMD-based
module systems like RequireJS, and more recently Webpack and Babel). ...
...or splitting JavaScript programs up into separate
modules that can be imported when needed. Node.js has had this ability for a long time, and there are a number of JavaScript libraries and frameworks that enable
module usage (for example, other CommonJS and AMD-based
module systems like RequireJS, and more recently Webpack and Babel). The good news is that modern browsers have started to support
module functionality natively, and this is what this article is all about. This can only be a good thing -- browsers can optimize loading of
modules, making it more efficient than having to use a library and do all of that extra client-side processing and extra round trips. ...
...And 88 more matches
Using JavaScript code modules
JavaScript code
modules are a concept introduced in Gecko 1.9 and can be used for sharing code between different privileged scopes.
Modules can also be used to create global JavaScript singletons that previously required using JavaScript XPCOM objects. A JavaScript code
module is simply some JavaScript code located in a registered location. The
module is loaded into a specific JavaScript scope, such as XUL script or JavaScript XPCOM script, using Components.utils.import() or Components.utils["import"](). ...
...s can also be used to create global JavaScript singletons that previously required using JavaScript XPCOM objects. A JavaScript code
module is simply some JavaScript code located in a registered location. The
module is loaded into a specific JavaScript scope, such as XUL script or JavaScript XPCOM script, using Components.utils.import() or Components.utils["import"](). Creating a JavaScript code
module A very simple JavaScript
module looks like this: var EXPORTED_SYMBOLS = ["foo", "bar"]; function foo() { return "foo"; } var bar = { name : "bar", size : 3 }; var dummy = "dummy"; Notice that the
module uses normal JavaScript to create functions, objects, constants, and any other JavaScript type. The
module also defines a special Array named EXPORTED_SYMBOLS. Any JavaScript item name...
...s: var EXPORTED_SYMBOLS = ["foo", "bar"]; function foo() { return "foo"; } var bar = { name : "bar", size : 3 }; var dummy = "dummy"; Notice that the
module uses normal JavaScript to create functions, objects, constants, and any other JavaScript type. The
module also defines a special Array named EXPORTED_SYMBOLS. Any JavaScript item named in EXPORTED_SYMBOLS will be exported from the
module and injected into the importing scope. ...
...And 26 more matches
Modules - Archive of obsolete content
This is made possible by the use of sandboxes. ...
...This is made possible by the use of sandboxes. ...
...This is made possible by the use of sandboxes. ...
...And 17 more matches
Module structure of the SDK - Archive of obsolete content
CommonJS is the underlying infrastructure for both the SDK and the add-ons you build using the SDK. A CommonJS
module is a piece of reusable JavaScript: it exports certain objects which are thus made available to dependent code. CommonJS defines: an object called exports which contains all the objects which a CommonJS
module wants to make available to other
modules a function called require which a
module can use to import the exports object of another
module. ...
... defines: an object called exports which contains all the objects which a CommonJS
module wants to make available to other
modules a function called require which a
module can use to import the exports object of another
module. Except for scripts that interact directly with web content, all the JavaScript code you'll write or use when developing add-ons using the SDK is part of a CommonJS
module, including: SDK
modules: the JavaScript
modules which the SDK provides, such as panel and page-mod. Local
modules: each of the JavaScript files under your add-on's "lib" directory. External
modules: reusable
modules developed and maintained outside the SDK, but usable by SDK-based add-ons. ...
...cript code you'll write or use when developing add-ons using the SDK is part of a CommonJS
module, including: SDK
modules: the JavaScript
modules which the SDK provides, such as panel and page-mod. Local
modules: each of the JavaScript files under your add-on's "lib" directory. External
modules: reusable
modules developed and maintained outside the SDK, but usable by SDK-based add-ons. SDK
Modules The
modules supplied by the SDK are divided into two sorts: High-level
modules like panel and page-mod provide relatively simple, stable APIs for the most common add-on development tasks. Low-level
modules like heritage and namespace provide more powerful functionality, and are typically less stable and more complex. To use SDK
modules, you can pass require() a complete path, starting wit...
...And 17 more matches
Caching compiled WebAssembly modules - WebAssembly
Warning: Experimental WebAssembly.
Module IndexedDB serialization support is being removed from browsers; see bug 1469395 and this spec issue. Caching is useful for improving the performance of an app -- we can store compiled WebAssembly
modules on the client so they don't have to be downloaded and compiled every time. This article explains the best practices around this. Caching via IndexedDB IndexedDB is a transactional database system that allows you to store and retrieve structured data on the client-side. It is ideal for persisting assets locally for the saved state of an application, including text, blobs, and any other type of cloneable object. This includes compiled wasm
modules (WebAssembly.
Module JavaScript objects). Setting up a caching library Because IndexedDB is a somewhat ...
...his includes compiled wasm
modules (WebAssembly.
Module JavaScript objects). Setting up a caching library Because IndexedDB is a somewhat old-fashioned API, we wanted to provide a library function to speed up writing caching code, and make it work better along with today's more modern APIs. In our wasm-utils.js library script, you'll find instantiateCachedURL() -- this function fetches the wasm
module at url with a version of dbVersion, instantiates it with the given importObject, and returns a promise resolving to the finished wasm Instance. Additionally, it handles creating a database to cache the compiled wasm
modules in, attempts to store new
modules in the database, and retrieves previously cached
modules from the database, saving you from having to download them again. Note: The entire...
...inished wasm Instance. Additionally, it handles creating a database to cache the compiled wasm
modules in, attempts to store new
modules in the database, and retrieves previously cached
modules from the database, saving you from having to download them again. Note: The entire site's wasm cache (not just the given URL) is versioned by the specified dbVersion passed into the function. If the wasm
module code is updated, or its URL changes, you will need to update dbVersion. Any subsequent call to instantiateCachedURL() will then clear out the entire cache, allowing you to avoid using out-of-date
modules. The function starts off by defining some necessary constants: function instantiateCachedURL(dbVersion, url, importObject) { const dbName = 'wasm-cache'; const storeName = 'wasm-cache'; S...
...And 14 more matches
Chrome Worker Modules
The preferred way to define and load
modules for Chrome Workers is to use the Chrome Worker
Module Loader. This
module loader should not surprise developers familiar with CommonJS, as it implements a minimal CommonJS require(). Loading
modules Loading a
module is simple. Start by importing the
module loader. You only need to do it once for each worker, from within the chrome worker itself: importScripts("resource://gre/
modules/workers/require.js"); Note: Although you only need to do this once for each worker, it doesn't hurt if you do it more than once. ...
... a
module is simple. Start by importing the
module loader. You only need to do it once for each worker, from within the chrome worker itself: importScripts("resource://gre/
modules/workers/require.js"); Note: Although you only need to do this once for each worker, it doesn't hurt if you do it more than once. This defines a global value require(), that you may now use as follows: // Import the
module // (here, we import the core of OS.File) let Core = require("resource://gre/
modules/osfile/osfile_shared_allthreads.jsm"); // We may now use
module Core. Core.declareFFI(...) Note that, for the moment, require() only accepts absolute URIs. If the your
module URI ends with ".js", you can omit the extension. Creating
modules Creating a
module is just as simple. ...
...Any value you define in that file is private by default. ...
...And 7 more matches
PKCS #11 Module Specs
NSS currently implements this proposal internally. The file format consists of name/value pairs of the form name=value. Each name/value pair is separated by a blank value. A single line, terminated by a '\n', '\r\n', or '\r' represents a single pkcs #11 library. Names can be any alpha/numeric combination, and are parsed case-insensitive. Values can contain any printable ASCII value, including UTF8 characters. Values can contain embedded blanks either through quoting the entire value, or by escaping the embedded blanks with '\'. The value is considered quoted if the first character after the '=' is ', ", {, [, or <. ...
...nsidered quoted if the first character after the '=' is ', ", {, [, or <. If the value is quoted, then the value is terminated with and ending quote of the form ', ", ), ], }, or > matching the respective starting quote. Ending quotes can be escaped. Embedded '\' charaters are considered escape characters for the next character in the stream. Note that case must be preserved in the values. These
modules specs can be passed by the application directly to NSS via the SECMOD_LoadUser
Module() call. To initialize a PKCS #11
module 'on-the-fly'. Recognized Names All applications/libraries must be able recognize the following name values: library This specifies the path to the pkcs #11 library. name This specifies the name of the pkcs #11 library. parameter This specifies a pkcs #11 libra...
...e/value pairs are optional. If the library is not specified, the line represents some application specific meta configuration data. Other applications and libraries can safely ignore this line. If the name is not specified, the application can use the library path to describe the PKCS #11 library in any UI it may have. If the parameter is not specified, no parameters are passed to the PKCS #11
module. If the application/library does not find its application/library specific data, it should use it's defaults for this pkcs #11 library. Parameter Passing If the parameter is specified, the application/library will strip the value out, processing any outter quotes and escapes appropriately, and pass the parameter to the pkcs #11 library when it calls C_Initialize(). A new CK_C_INITIALIZE_ARGS ...
...And 6 more matches
Using third-party modules (jpm) - Archive of obsolete content
The Add-on SDK includes a command-line tool that you use to initialize, run, test, and package add-ons. The current tool is called jpm, and is based on Node.js. It replaces the old cfx tool. You can use jpm from Firefox 38 onwards. This article describes how you can use third-party
modules with jpm. To follow this tutorial you'll need to have installed jpm and learned the basic jpm commands. To install menuitem you'll need to have git command. If you have error related to git, check you have latest git command installed. The Add-on SDK is extensible by design: you can use the
modules that ship inside Firefox, but you can also create your own
modules and make them available for anyone else to use. Before the jpm tool was available, there wasn't any package manager for these community-...
...menuitem you'll need to have git command. If you have error related to git, check you have latest git command installed. The Add-on SDK is extensible by design: you can use the
modules that ship inside Firefox, but you can also create your own
modules and make them available for anyone else to use. Before the jpm tool was available, there wasn't any package manager for these community-developed
modules, so it wasn't obvious where to find community-developed
modules, or how to install and update them. With jpm, we use npm as the package manager for SDK
modules that don't ship inside Firefox. ...
...de Firefox, but you can also create your own
modules and make them available for anyone else to use. Before the jpm tool was available, there wasn't any package manager for these community-developed
modules, so it wasn't obvious where to find community-developed
modules, or how to install and update them. With jpm, we use npm as the package manager for SDK
modules that don't ship inside Firefox.
Module developers can publish SDK
modules to npm, and add-on developers can install them from npm and build them into their add-ons. This article explains how to use npm-hosted third-party SDK
modules with jpm. We'll use the menuitem package to add a new menu item to Firefox. Summary First, while in the root of your add-on, install the package that contains the
modules you want to use: npm install m...
...And 5 more matches
WebAssembly.Module - JavaScript
A WebAssembly.
Module object contains stateless WebAssembly code that has already been compiled by the browser -- this can be efficiently shared with Workers, and instantiated multiple times. Constructor WebAssembly.
Module() Creates a new
Module object. Static properties WebAssembly.
Module.customSections() Given a
Module and string, returns a copy of the contents of all custom sections in the
module with the given string name. WebAssembly.
Module.exports() Given a
Module, returns an array containing descriptions of all the declared exports. WebAssembly.
Module.imports() Given a
Module, returns an array containing descriptions of all the declared imports. Examples Sending a compiled
module to a worker The following example (see our index-compile.html demo on GitHub, and view it ...
... var worker = new Worker("wasm_worker.js"); WebAssembly.compileStreaming(fetch('simple.wasm')) .then(mod => worker.postMessage(mod) ); In the worker (see wasm_worker.js) we define an import object for the
module to use, then set up an event handler to receive the
module from the main thread. ...
...and view it live also) compiles the loaded simple.wasm byte code using the WebAssembly.compileStreaming() method and then sends the resulting
Module instance to a worker using postMessage(). ...
...And 5 more matches
nsGetModuleProc
May be null. aResult [out] The nsI
Module instance. ...
... Summary This function prototype provides the XPCOM entry-point into a
module. #include "nsXPCOM.h" typedef nsresult (PR_CALLBACK *nsGet
ModuleProc)( nsIComponentManager *aCompMgr, nsIFile* aLocation, nsI
Module** aResult ); Parameters aCompMgr [in] The XPCOM Component Manager. ...
...May be null. aResult [out] The nsI
Module instance. ...
...And 4 more matches
Worklet.addModule() - Web APIs
options Optional An object with any of the following options: credentials: A RequestCredentials value that indicates whether to send credentials (e.g. cookies and HTTP authentification) when loading the
module. Can be one of "omit", "same-origin", or "include". Defaults to "same-origin". See also Request.credentials. Return value A Promise that resolves once the
module from the given URL has been added. ...
...The promise doesn't return any value. Exceptions If add
Module() fails, it rejects the promise, delivering one of the following errors to the rejection handler. ...
...th the
module to add. options Optional An object with any of the following options: credentials: A RequestCredentials value that indicates whether to send credentials (e.g. cookies and HTTP authentification) when loading the
module. Can be one of "omit", "same-origin", or "include". Defaults to "same-origin". See also Request.credentials. Return value A Promise that resolves once the
module from the given URL has been added. The promise doesn't return any value. Exceptions If add
Module() fails, it rejects the promise, delivering one of the following errors to the rejection handler. AbortError The specified script is invalid or could not be loaded. SyntaxError The specified
moduleURL is invalid. Examples AudioWorklet example const audioCtx = new AudioContext(); const audi...
...And 4 more matches
nsIModule
It is the main entry point by which the system accesses an XPCOM component. ...
...It is very important to ensure that n...
...gisterSelf(in nsIComponentManager aCompMgr, in nsIFile aLocation, in string aLoaderStr); Methods canUnload() This method may be queried to determine whether or not the component
module can be unloaded by XPCOM. boolean canUnload( in nsIComponentManager aCompMgr ); Parameters aCompMgr The global component manager. Return value Indicates to the caller whether or not the component
module can be unloaded. Returning true is not a guarantee that the
module will be unloaded. It constitues only willingness of the
module to be unloaded. ...
...And 3 more matches
WebAssembly.Module() constructor - JavaScript
A WebAssembly.
Module() constructor creates a new
Module object containing stateless WebAssembly code that has already been compiled by the browser and can be efficiently shared with Workers, and instantiated multiple times. The WebAssembly.
Module() constructor function can be called to synchronously compile given WebAssembly binary code. However, the primary way to get a
Module is through an asynchronous compilation function like WebAssembly.compile(). Syntax Important: Since compilation for large
modules can be expensive, developers should only use the
Module() constructor when synchronous compilation is absolutely required; the asynchronous WebAssembly.compileStreaming() method should be used at all other times. ...
...er, the primary way to get a
Module is through an asynchronous compilation function like WebAssembly.compile(). Syntax Important: Since compilation for large
modules can be expensive, developers should only use the
Module() constructor when synchronous compilation is absolutely required; the asynchronous WebAssembly.compileStreaming() method should be used at all other times. new WebAssembly.
Module(bufferSource); Parameters bufferSource A typed array or ArrayBuffer containing the binary code of the .wasm
module you want to compile. ...
...should only use the
Module() constructor when synchronous compilation is absolutely required; the asynchronous WebAssembly.compileStreaming() method should be used at all other times. new WebAssembly.
Module(bufferSource); Parameters bufferSource A typed array or ArrayBuffer containing the binary code of the .wasm
module you want to compile. ...
...And 3 more matches
Creating Reusable Modules - Archive of obsolete content
To follow this tutorial you'll need to have learned the basics of jpm. With the SDK you don't have to keep all your add-on in a single "index.js" file. You can split your code into separate
modules with clearly defined interfaces between them. You then import and use these
modules from other parts of your add-on using the require() statement, in exactly that same way that you import core SDK
modules like page-mod or panel. It can often make sense to structure a larger or more complex add-on as a collection of
modules. ...
...erfaces between them. You then import and use these
modules from other parts of your add-on using the require() statement, in exactly that same way that you import core SDK
modules like page-mod or panel. It can often make sense to structure a larger or more complex add-on as a collection of
modules. This makes the design of the add-on easier to understand and provides some encapsulation as each
module will export only what it chooses to, so you can change the internals of the
module without breaking its users. Once you've done this, you can package the
modules and distribute them independently of your add-on, making them available to other add-on developers and effectively extending the SDK itself. In this tutorial we'll do exactly that with a
module that calculates file hashes. A hashing a...
...turned nsILocalFile... } return path; } require("sdk/ui/button/action").ActionButton({ id: "show-panel", label: "Show Panel", icon: { "16": "./icon-16.png" }, onClick: function() { console.log(md5File(promptForFile())); } }); This works , but index.js is now getting longer and its logic is harder to understand. Let's factor the file picker and hashing code into separate
modules. Creating separate
modules filepicker.js First create a new file in "lib" called "filepicker.js". Copy the file picker code into this new file, and add the following line at the end: exports.promptForFile = promptForFile; This defines the public interface of the new
module. So "filepicker.js" should look like this: var {Cc, Ci} = require("chrome"); function promptForFile() { var windo...
...And 2 more matches
Why RSS Content Module is Popular - Including HTML Contents - Archive of obsolete content
CDATA section. Including "<" and ">" without having to escape them. Using the example above we'd have: <description><![CDATA[This is <b>bold</b>.]]></description> This helps reduce the bloat. However, the <description> is NOT suppose to be used for any of this. It is only suppose to be used to includeplain text. But RSS still leaves us without a way to include HTML contents. The RSS Content
Module fills this gap. NOTE: Do not put anything butplain text into the RSS <description> element. Although it has become common practice to use the RSS <description> element and put non-plain text data in it. It is not actually allowed. The RSS 2.0 specification clearly states that "entity-encoded HTML is allowed" and even provides examples showing exactly the syntax above (using CDATA and unencoded ...
...ommon practice to use the RSS <description> element and put non-plain text data in it. It is not actually allowed. The RSS 2.0 specification clearly states that "entity-encoded HTML is allowed" and even provides examples showing exactly the syntax above (using CDATA and unencoded HTML). The wording of this note should be reconsidered. ...
...RSS 2.0 specification clearly states that "entity-encoded HTML is allowed" and even provides examples showing exactly the syntax above (using CDATA and unencoded HTML). The wording of this note should be reconsidered. ...
...And 2 more matches
PRLogModuleInfo
The PRLog
ModuleInfo structure controls logging from within your application. To log your program's activity, create a PRLog
ModuleInfo structure using PR_NewLog
Module . ...
... The PRLog
ModuleInfo structure controls logging from within your application. To log your program's activity, create a PRLog
ModuleInfo structure using PR_NewLog
Module . ...
... The PRLog
ModuleInfo structure controls logging from within your application. To log your program's activity, create a PRLog
ModuleInfo structure using PR_NewLog
Module . ...
...And 2 more matches
WebAssembly.Module.customSections() - JavaScript
The WebAssembly.customSections() function returns a copy of the contents of all custom sections in the given
module with the given string name. Syntax WebAssembly.
Module.customSections(
module, sectionName); Parameters
module The WebAssembly.
Module object whose custom sections are being considered. sectionName The string name of the desired custom section. Return value A (possibly empty) array containing ArrayBuffer copies of the contents of all custom sections matching sectionName. Exceptions If
module is not a WebAssembly.
Module object instance, a TypeError is thrown. Description A wasm
module is comprised of a sequence of sections. ...
...f the desired custom section. Return value A (possibly empty) array containing ArrayBuffer copies of the contents of all custom sections matching sectionName. Exceptions If
module is not a WebAssembly.
Module object instance, a TypeError is thrown. Description A wasm
module is comprised of a sequence of sections. Most of these sections are fully specified and validated by the wasm spec, but
modules can also contain custom sections that are ignored and skipped over during validation. ...
...ions. Most of these sections are fully specified and validated by the wasm spec, but
modules can also contain custom sections that are ignored and skipped over during validation. (Read High level structure for information on section structures, and how normal sections ("known sections") and custom sections are distinguished.) This provides developers with a way to include custom data inside wasm
modules for other purposes, for example the name custom section, which allows developers to provide names for all the functions and locals in the
module (like "symbols" in a native build). Note that the WebAssembly text format currently doesn't have a syntax specified for adding new custom sections; you can however add a name section to your wasm during conversion from text format over to .wasm. The wa...
...And 2 more matches
WebAssembly.Module.exports() - JavaScript
Examples Using exports The following example (see our index-compile.html demo on GitHub, and view it live also) compiles the loaded simple.wasm byte code using the WebAssembly.compileStreaming() method and then sends it to a worker using postMessage(). ...
... The WebAssembly.
Module.exports() function returns an array containing descriptions of all the declared exports of the given
Module. Syntax WebAssembly.
Module.exports(
module); Parameters
module A WebAssembly.
Module object. Return value An array containing objects representing the exported functions of the given
module. Exceptions If
module is not a WebAssembly.
Module object instance, a TypeError is thrown. Examples Using exports The following example (see our index-compile.html demo on GitHub, and view it live also) compiles the loaded simple.wasm byte code using the WebAssembly.compileStreaming() method and then sends it to a worker using postMessage(). var worker = new Worker("wasm_worker.js"); WebAssembly.compileStreaming(fetch('simple.wasm')) .then(mod => worker.postMessag...
...mpile.html demo on GitHub, and view it live also) compiles the loaded simple.wasm byte code using the WebAssembly.compileStreaming() method and then sends it to a worker using postMessage(). var worker = new Worker("wasm_worker.js"); WebAssembly.compileStreaming(fetch('simple.wasm')) .then(mod => worker.postMessage(mod) ); In the worker (see wasm_worker.js) we define an import object for the
module to use, then set up an event handler to receive the
module from the main thread. when the
module is received, we create an instance from it using the WebAssembly.Instantiate() method, invoke an exported function from inside it, then show how we can return information on the available exports on a
module using WebAssembly.
Module.exports. var importObject = { imports: { imported_func: functi...
...And 2 more matches
NSPR LOG MODULES
This environment variable specifies which log
modules have logging enabled. Syntax
moduleName:level[,
moduleName:level]*
moduleName is the name specified in a PR_NewLog
Module call or one of the handy magic names listed below. level is a numeric value between 0 and 5, with the values having the following meanings: 0 = PR_LOG_NONE: nothing should be logged 1 = PR_LOG_ALWAYS: important; intended to always be logged 2 = PR_LOG_ERROR: errors 3 = PR_LOG_WARNING: warnings 4 = PR_LOG_DEBUG: debug messages, notices 5: everything! ...
..._NewLog
Module call or one of the handy magic names listed below. level is a numeric value between 0 and 5, with the values having the following meanings: 0 = PR_LOG_NONE: nothing should be logged 1 = PR_LOG_ALWAYS: important; intended to always be logged 2 = PR_LOG_ERROR: errors 3 = PR_LOG_WARNING: warnings 4 = PR_LOG_DEBUG: debug messages, notices 5: everything! Description Specify a
moduleName that is associated with the name argument in a call to PR_NewLog
Module and a non-zero level value to enable logging for the named
moduleName. Special log
module names are provided for controlling NSPR's log service at execution time. These controls should be set in the NSPR_LOG_
MODULES environment variable at execution time to affect NSPR's log service for your application. all The name...
...ed with the name argument in a call to PR_NewLog
Module and a non-zero level value to enable logging for the named
moduleName. Special log
module names are provided for controlling NSPR's log service at execution time. These controls should be set in the NSPR_LOG_
MODULES environment variable at execution time to affect NSPR's log service for your application. all The name all enables all log
modules. To enable all log
module calls to PR_LOG, set the variable as follows: set NSPR_LOG_
MODULES=all:5 timestamp Including timestamp results in a timestamp of the form "2015-01-15 21:24:26.049906 UTC - " prefixing every logged line. append Including append results in log entries being appended to the existing contents of the file referenced by NSPR_LOG_FILE. If not specified, the existing c...
...l log messages are flushed to the operating system as they are written, but may slow the program down. bufsize:size The name bufsize:size sets the log buffer to size. Examples Log everything from the Toolkit::Storage component that happens, prefixing each line with the timestamp when it was logged to the file /tmp/foo.log (which will be replaced each time the executable is run). set NSPR_LOG_
MODULES=timestamp,mozStorage:5 set NSPR_LOG_FILE=/tmp/foo.log Logging with Try Server For mochitest, edit variable NSPR_LOG_
MODULES in testing/mochitest/runtests.py before pushing to try. You would be able to download the log file as an artifact from the Log viewer. (other tests?) ...
NSS cryptographic module
The FIPS mode is an Approved mode of operation compliant to FIPS 140-2. Both modes of operation use the same data types but are implemented by different functions. ...
...The FIPS mode is an Approved mode of operation compliant to FIPS 140-2. Both modes of operation use the same data types but are implemented by different functions. ...
...The FIPS mode is an Approved mode of operation compliant to FIPS 140-2. Both modes of operation use the same data types but are implemented by different functions. ...
...e implemented by different functions. The standard PKCS #11 function C_GetFunctionList or the equivalent NSC_GetFunctionList function returns pointers to the functions that implement the default mode of operation. To enable the FIPS mode of operation, use the function FC_GetFunctionList instead to get pointers to the functions that implement the FIPS mode of operation. The NSS cryptographic
module also exports the function NSC_
ModuleDBFunc for managing the NSS
module database secmod.db. The following sections document the data types and functions. PKCS #11 data types PKCS #11 functions in the non-FIPS (default) mode of operation PKCS #11 functions in the FIPS mode of operation NSC_
ModuleDBFunc ...
Compiling a New C/C++ Module to WebAssembly - WebAssembly
Let's look at how it works. Emscripten Environment Setup First, let's set up the required development environment. Prerequisites Get the Emscripten SDK, using these instructions: https://emscripten.org/docs/getting_started/downloads.html Compiling an example With the environment set up, let's look at how to use it to compile a C example to Emscripten. There are a number of options available when compiling with Emscripten, but the main two scenarios we'll cover are: Compiling to wasm and creating HTML to run our code in, plus all the JavaScript "glue" code needed to run the wasm in the web environment. ...
...ollowing command: emcc hello.c -s WASM=1 -o hello.html The options we've passed in with the command are as follows: -s WASM=1 -- Specifies that we want wasm output. If we don't specify this, Emscripten will just output asm.js, as it does by default. ...
... this, Emscripten will just output asm.js, as it does by default. -o hello.html -- Specifies that we want Emscripten to generate an HTML page to run our code in (and a filename to use), as well as the wasm
module and the JavaScript "glue" code to compile and instantiate the wasm so it can be used in the web environment. At this point in your source directory you should have: The binary wasm
module code (hello.wasm) A JavaScript file containing glue code to translate between the native C functions, and JavaScript/wasm (hello.js) An HTML file to load, compile, and instantiate your wasm code, and display its output in the browser (hello.html) Running your example Now all that remains is for you to load the resulting hello.html in a browser that supports WebAssembly. It is enabled by defa...
...ml file in a text editor. Add a <button> element as shown below, just above the first opening <script type='text/javascript'> tag. <button class="mybutton">Run myFunction</button> Now add the following code at the end of the first <script> element: document.querySelector('.mybutton') .addEventListener('click', function() { alert('check console'); var result =
Module.ccall( 'myFunction', // name of C function null, // return type null, // argument types null // arguments ); }); This illustrates how ccall() is used to call the exported function. ...
Why Well-Formed Web RSS Module is Popular - Syndicating Your Comments - Archive of obsolete content
There aren't many blogs out there that don't allow commenting of blog posts. However, RSS does not provide sufficient facilities for dealing with them. Sure RSS has the <comments> element, but it points to a HTML page that isn't machine readable. It is desirable to be able to deal with comments in the same way one deals with RSS feeds; through syndication. ...
... RSS does not provide sufficient facilities for dealing with them. Sure RSS has the <comments> element, but it points to a HTML page that isn't machine readable. It is desirable to be able to deal with comments in the same way one deals with RSS feeds; through syndication. The RSS Well-Formed Web
Module exists to fill this gap. ...
...This element lets you syndicate your comments. The URI in the <wfw:commentRss> element must point to an RSS feed containing the comments for the <item> it is contained in. ...
Creating a Login Manager storage module
nsole set signon.debug to true using about:config. Sample JavaScript implementation The following code snippet is a JavaScript component that implements a dummy nsILoginManagerStorage interface. See How_to_Build_an_XPCOM_Component_in_Javascript for more details about JavaScript components. ...
...The category registration looks like this: nsCOMPtr<nsICategoryManager> cat = do_GetService(NS_CATEGORYMANAGER_CONTRACTID); NS_ENSURE_STATE(cat); cat->AddCategoryEntry("login-manager-storage", "nsILoginManagerStorage", ...
...The category registration looks like this: nsCOMPtr<nsICategoryManager> cat = do_GetService(NS_CATEGORYMANAGER_CONTRACTID); NS_ENSURE_STATE(cat); cat->AddCategoryEntry("login-manager-storage", "nsILoginManagerStorage", kYourContractID, PR_TRUE, PR_TRUE, nsnull)...
Measuring performance using the PerfMeasurement.jsm code module
You give the constructor a bit-mask of events you're interested in; see Note: At present, PerfMeasurement.jsm is only functional on Linux, but it is planned to add support for Windows (bug 583322) and OSX (bug 583323) as well, and we welcome patches for other operating systems. ...
...You give the constructor a bit-mask of events you're interested in; see Note: At present, PerfMeasurement.jsm is only functional on Linux, but it is planned to add support for Windows (bug 583322) and OSX (bug 583323) as well, and we welcome patches for other operating systems. ...
...You give the constructor a bit-mask of events you're interested in; see Note: At present, PerfMeasurement.jsm is only functional on Linux, but it is planned to add support for Windows (bug 583322) and OSX (bug 583323) as well, and we welcome patches for other operating systems. ...
PRLogModuleLevel
The enumerated type PRLog
ModuleLevel defines levels of logging available to application programs. ...
... The enumerated type PRLog
ModuleLevel defines levels of logging available to application programs. ...
... The enumerated type PRLog
ModuleLevel defines levels of logging available to application programs. ...
PR_NewLogModule
Syntax #include <prlog.h> PRLog
ModuleInfo* PR_NewLog
Module(const char *name); Parameters The function has this parameter: name The name to be assigned to the PRLog
ModuleInfo structure. Returns A pointer to a PRLog
ModuleInfo structure. Description This function allocates and initializes a new PRLog
ModuleInfo structure with the specified name. ...
... ...
...to be assigned to the PRLog
ModuleInfo structure. Returns A pointer to a PRLog
ModuleInfo structure. Description This function allocates and initializes a new PRLog
ModuleInfo structure with the specified name. If the environment variable NSPR_LOG_
MODULES contains the specified name, then the associated level value from the variable is associated with the new PRLog
ModuleInfo structure. ...
PKCS11 module installation
PKCS #11
modules are external
modules which add to Firefox support for smartcard readers, biometric security devices, and external certificate stores. This article covers the two methods for installing PKCS #11
modules into Firefox. Users can use the preferences dialog to install or remove PKCS #11
module. Extensions can programmatically manage PKCS #11
modules using the nsIPKCS11 programming interface. Note: The information in this article is specific to Firefox 3.5 and newer. Older versions of Firefox may support the window.pkcs11 property for installing PKCS #11
modules. Using the Firefox preferences to install PKCS #11
modules Save the PKCS #11
module to a permanent location on your local computer Open the Firefox preferences dialog. Choose "Advanced" > "Encryption" > "Security...
...fic to Firefox 3.5 and newer. Older versions of Firefox may support the window.pkcs11 property for installing PKCS #11
modules. Using the Firefox preferences to install PKCS #11
modules Save the PKCS #11
module to a permanent location on your local computer Open the Firefox preferences dialog. Choose "Advanced" > "Encryption" > "Security Devices" Choose "Load" Enter a name for the security
module, such as "My Client Database". NOTE: there is currently a bug in Firefox where international characters may cause problems. Choose "Browse..." to find the location of the PKCS #11
module on your local computer, and choose "OK" when done. ...
...e Firefox preferences dialog. Choose "Advanced" > "Encryption" > "Security Devices" Choose "Load" Enter a name for the security
module, such as "My Client Database". NOTE: there is currently a bug in Firefox where international characters may cause problems. Choose "Browse..." to find the location of the PKCS #11
module on your local computer, and choose "OK" when done. Provisioning PKCS #11
modules using the pkcs11 API Starting with Firefox 58, extensions can use the pkcs11 browser extension API to enumerate PKCS #11
modules and make them accessible to the browser as sources of keys and certificates. ...
Compiling an Existing C Module to WebAssembly - WebAssembly
c,dsp,demux,enc,mux,utils}/*.c Note: This strategy will not work with every C project. Many projects rely on autoconf/automake to generate system-specific code before compilation. Emscripten provides emconfigure and emmake to wrap these commands and inject the appropriate parameters. You can find more in the Emscripten documentation. Now you only need some HTML and JavaScript to load your new
module: <script src="./a.out.js"></script> <script>
Module.onRuntimeInitialized = async _ => { const api = { version:
Module.cwrap('version', 'number', []), }; console.log(api.version()); }; </script> And you will see the correct version number in the output: Note: libwebp returns the current version a.b.c as a hexadecimal number 0xabc. For example, v0.6.1 is encoded as 0x000...
...n allocates a buffer for the RGBA image -- hence 4 bytes per pixel. The pointer returned by malloc() is the address of the first memory cell of that buffer. When the pointer is returned to JavaScript land, it is treated as just a number. After exposing the function to JavaScript using cwrap, you can use that number to find the start of our buffer and copy the image data: const api = { version:
Module.cwrap('version', 'number', []), create_buffer:
Module.cwrap('create_buffer', 'number', ['number', 'number']), destroy_buffer:
Module.cwrap('destroy_buffer', '', ['number']), }; const image = await loadImage('./image.jpg'); const p = api.create_buffer(image.width, image.height);
Module.HEAP8.set(image.data, p); // ... call encoder ... api.destroy_buffer(p); Encode the Image The image is now...
... Depending on the size of your image, you might run into an error where wasm can't grow the memory enough to accommodate both the input an...
Modules - Archive of obsolete content
Some simple code to turn a JavaScript
module into non-Mozilla-specific code (e.g., if porting to the browser). The use of eval() will probably not be of concern because it is only being used on the EXPORTED_SYMBOLS array which should not depend on user input. function import
Module (thatObj) { thatObj = thatObj || window; var EXPORTED_SYMBOLS = [ // Put the symbols here ]; // Your code here... ...
...ut. function import
Module (thatObj) { thatObj = thatObj || window; var EXPORTED_SYMBOLS = [ // Put the symbols here ]; // Your code here... // At the end of your code: (assuming neither 'i' nor 'thatObj' is being exported!) for (var i=0; i < EXPORTED_SYMBOLS.length; i++) {thatObj[EXPORTED_SYMBOLS[i]] = eval(EXPORTED_SYMBOLS[i]);} } or for one-time-only usage of a
module: (function (thatObj) { thatObj = thatObj || window; var EXPORTED_SYMBOLS = [ // Put the symbols here ]; // Your code here... // At the end of your code: (assuming neither 'i' nor 'thatObj' is being exported!) for (var i=0; i < EXPORTED_SYMBOLS.length; i++) {thatObj[EXPORTED_SYMBOLS[i]] = eval(EXPORTED_SYMBOLS[i]);} })(); // Can put an object argument here ...
Module - Archive of obsolete content
They are ways of extending RSS. Below is a list of the popular RSS
modules. ...
... RSS
Module List RSS
Modules are microformats injected into an RSS document through the use of XML namespaces. They are ways of extending RSS. Below is a list of the popular RSS
modules. Name Common Prefix Status Release Date Author Atomic RSS atom July 27, 2005 Tim Bray blogChannel September 17, 2002 Dave Winer Content content creativeCommons cc December 16, 2002 Dave Winer Dublin Core dc Slash slash Well-Formed Web wfw Joe Gregorio and Chris Se...
JavaScript code modules
Note: These are not the same thing as standard JavaScript
modules. See export and import to learn more about how to use standard
modules. JavaScript code
modules let multiple privileged JavaScript scopes share code. For example, a
module could be used by Firefox itself as well as by extensions, in order to avoid code duplication. General topics Using JavaScript code
modules An introduction to how to use JavaScript code
modules. Components.utils.import How to import a JavaScript code
module. Components.utils.unload How to unload a JavaScript code
module. Code snippets:
Modules Examples of how to use code
modules. ...
...Firefox itself as well as by extensions, in order to avoid code duplication. General topics Using JavaScript code
modules An introduction to how to use JavaScript code
modules. Components.utils.import How to import a JavaScript code
module. Components.utils.unload How to unload a JavaScript code
module. Code snippets:
Modules Examples of how to use code
modules. Mozilla Labs JS
Modules This page features a list of JavaScript
modules, along with download links and documentation, that extension developers can use in their code. Standard code
modules AddonManager.jsm An interface to install, manage, and uninstall add-ons. AddonRepository.jsm Provides a search of add-ons in the repository. Assert.jsm Implements the CommonJS Unit Testing specification version 1.1, wh...
nsIAboutModule
The contract id ends with a parameter that corresponds to the name of the about page. Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Method overview unsigned long getURIFlags(in nsIURI aURI); nsIChannel newChannel(in nsIURI aURI); Constants Constant Value Description URI_SAFE_FOR_UNTRUSTED_CONTENT (1 << 0) A flag that indicates whether a URI is safe for untrusted content. If it is, web pages and so forth will be allowed to link to this about: URI. Otherwise, only chrome will be able to link to it. ...
...for the given about: URI even if it's disabled in general. HIDE_FROM_ABOUTABOUT (1 << 2) A flag that indicates whether this about: URI doesn't want to be listed in about:about, especially if it's not useful without a query string. Methods getURIFlags() A method to get the flags that apply to a given about: URI. The URI passed in is guaranteed to be one of the URIs that this
module registered to deal with. unsigned long getURIFlags( in nsIURI aURI ); Parameters aURI Return value A combination of the flags above corresponding to the appropriate flags for this about URI. newChannel() Constructs a new channel for the about protocol
module. nsIChannel newChannel( in nsIURI aURI ); Parameters aURI The uri of the new channel. Return value A fully cons...
nsIAuthModule
netwerk/base/public/nsIAuth
Module.idlScriptable This interface is intended to be used as server and client authentication service. Inherits from: nsISupports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) Method overview void getNextToken([const] in voidPtr aInToken, in unsigned long aInTokenLength, out voidPtr aOutToken, out unsigned long aOutTokenLength); void init(in string aServiceName, in unsigned long aServiceFlags, in wstring aDomain, in wstring aUsername, in wstring aPassword); void unwrap([const] in voidPtr aInToken, in unsigned long aInTokenLength, out voidPtr aOutToken, out unsigned long aOutTokenLength); void wrap([const] in voidPtr aInToken, in unsigned long aInTokenLength, in boolean confidential, out voidPtr aOutToken, out unsign...
...utToken will point to a buffer to be sent in response to the server challenge. The length of this buffer is given by aOutTokenLength. The buffer at aOutToken must be recycled with a call to nsIMemory.free(). aOutTokenLength If getNextToken succeeds, then aOutTokenLength contains the length of the buffer (number of bytes) pointed to by aOutToken. init() This method is called to initialize an auth
module. The other methods cannot be called unless this method succeeds. void init( in string aServiceName, in unsigned long aServiceFlags, in wstring aDomain, in wstring aUsername, in wstring aPassword ); Parameters aServiceName The service name, which may be null if not applicable (For example, for NTLM, this parameter should be null). aServiceFlags A bitwise-or of the REQ_ constants (pass ...
The libmime module
One of the methods provided by this parser is the ability to emit an HTML representation of the data stream. The parser is object-oriented. There is a class for each MIME type, and each class is responsible for parsing itself, and/or handing the input data off to one of its child objects. ...
...le, the MimeInlineText class is defined in "mimetext.h" and "mimetext.c".) Each header file follows the following boiler-plate form: typedefs These come first to avoid circular dependencies. typedef struct FoobarClass FoobarClass; typedef struct Foobar Foobar; Class Declaration Theis structure defines the callback routines and other per-class data of the class defined in this
module. struct FoobarClass { ParentClass superclass; ...any callbacks or class-variables... }; Class Definition This variable holds an instance of the one-and-only class record; the various instances of this class point to this object. (One interrogates the type of an instance by comparing the value of its class pointer with the address of this variable.) extern FoobarCla...
WebAssembly.Module.imports() - JavaScript
The WebAssembly.imports() function returns an array containing descriptions of all the declared imports of the given
Module. Syntax WebAssembly.
Module.imports(
module); Parameters
module A WebAssembly.
Module object. Return value An array containing objects representing the imported functions of the given
module. Exceptions If
module is not a WebAssembly.
Module object instance, a TypeError is thrown. Examples Using imports The following example (see imports.html source code; see it live also) compiles the loaded simple.wasm
module. This
module is then queried for its imports. ...
...ns of the given
module. Exceptions If
module is not a WebAssembly.
Module object instance, a TypeError is thrown. Examples Using imports The following example (see imports.html source code; see it live also) compiles the loaded simple.wasm
module. This
module is then queried for its imports. WebAssembly.compileStreaming(fetch('simple.wasm')) .then(function(mod) { var imports = WebAssembly.
Module.imports(mod); console.log(imports[0]); }); The output looks like this: {
module: "imports", name: "imported_func", kind: "function" } Specifications Specification WebAssembly JavaScript InterfaceThe definition of 'imports()' in that specification. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to co...
XForms Switch Module - Archive of obsolete content
The
module defines for this switch, case and toggle elements. Switch Element The element (see the spec) is used in conjunction with case and toggle elements. The switch element contains case elements which in turn contain markup. Only the contents of a single case may be displayed at one time. The toggle element is an action that when triggered will make a case selected and visible and thereby hiding all other case elements contained by the same switch. Attributes Single-Node Binding Type restrictions The switch element can be bound to a node containing data of any type. ...
Using workers in JavaScript code modules
nce Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Note: As of Gecko 8.0, the nsIWorkerFactory interface has been removed Starting in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1), you can use workers in JavaScript code
modules (JSMs). This lets you run code in a separate thread from your JSM. To create a ChromeWorker for this purpose, you need to use the nsIWorkerFactory interface: var workerFactory = Components.classes['@mozilla.org/threads/workerfactory;1'] .createInstance(Components.interfaces.nsIWorkerFactory); var worker = workerFactory.newChromeWorker('script_url.js'); This will...
The Necko HTTP module
It's meant as a guide to developers wishing to extend the HTTP implementation. Transaction Model This document describes the lifetime of a HTTP transaction, the threads involved, and the relevant objects. ...
nsStaticModuleInfo
Summary This data structure is used by NS_InitXPCOM3 to specify static XPCOM
modules. #include "nsXPCOM.h" struct nsStatic
ModuleInfo { const char* name; nsGet
ModuleProc get
Module; }; Members name This member provides the name of the
module as a null-terminated, ASCII-valued character array. get
Module This member provides a function pointer of type nsGet
ModuleProc that returns a nsI
Module instance. ...
Link types: modulepreload - HTML: Hypertext Markup Language
The
modulepreload keyword for the rel attribute of the <link> element provides a declarative way to preemptively fetch a
module script and its dependencies, and store them in the document's
module map for later evaluation. Specifications Specification Status Comment HTML Living StandardThe definition of '
modulepreload' in that specification. Living Standard ...
Index
to support multiple operating systems (OS), it is based on a cross platform portability layer, called the Netscape Portable Runtime (NSPR), which provides cross platform application programming interfaces (APIs) for OS specific APIs like file system access, memory management, network communication, and multithreaded programming. ...
...ough the list of
modules, design principles, and important relevant standards. In order to allow interoperability between software and devices that perform cryptographic operations, NSS conforms to a standard called PKCS#11. (Note that it's important to look at the number 11, as there are other PKCS standards with different numbers that define quite different topics.) A software or hardware
module conforming to the PKCS#11 standard implements an interface of C calls, which allow querying the characteristics and offered services of the
module. Multiple elements of NSS's own
modules have been implemented with this interface, and NSS makes use of this interface when talking to those
modules. This strategy allows NSS to work with many hardware devices (e.g., to speed up the calculations requir...
...istics and offered services of the
module. Multiple elements of NSS's own
modules have been implemented with this interface, and NSS makes use of this interface when talking to those
modules. This strategy allows NSS to work with many hardware devices (e.g., to speed up the calculations required for cryptographic operations, or to access smartcards that securely protect a secret key) and software
modules (e.g., to allow to load such
modules as a plugin that provides additional algorithms or stores key or trust information) that implement the PKCS#11 interface. A core element of NSS is FreeBL, a base library providing hash functions, big number calculations, and cryptographic algorithms. Softoken is an NSS
module that exposes most FreeBL functionality as a PKCS#11
module. Some cryptograp...
...And 96 more matches
NSS Tools modutil
You can use the tool to add and delete PKCS #11
modules, change passwords, set defaults, list
module contents, enable or disable slots, enable or disable FIPS 140-2 compliance, and assign default providers for cryptographic operations. This tool can also create key3.db, cert8.db, and secmod.db security database files. The tasks associated with security
module database management are part of a process that typically also involves managing key databases (key3.db files) and certificate databases (cert8.db files). ...
...secmod.db files or within hardware tokens. You can use the tool to add and delete PKCS #11
modules, change passwords, set defaults, list
module contents, enable or disable slots, enable or disable FIPS 140-2 compliance, and assign default providers for cryptographic operations. This tool can also create key3.db, cert8.db, and secmod.db security database files. The tasks associated with security
module database management are part of a process that typically also involves managing key databases (key3.db files) and certificate databases (cert8.db files). ...
... FIPS 140-2 compliance, and assign default providers for cryptographic operations. This tool can also create key3.db, cert8.db, and secmod.db security database files. The tasks associated with security
module database management are part of a process that typically also involves managing key databases (key3.db files) and certificate databases (cert8.db files). The key, certificate, and PKCS #11
module management process generally begins with creating the keys and key database necessary to generate and manage certificates and the certificate database. This document discusses security
module database management. For information on certificate database and key database management, see Using the Certificate Database Tool. Availability This tool is known to build on Solaris 2.5.1 (SunOS 5.5.
...And 54 more matches
CSS3 - Archive of obsolete content
d aims at extending CSS2.1. It brings a lot of long-awaited novelties, like rounded corners, shadows, gradients, transitions or animations, as well as new layouts like multi-columns, flexible box or grid layouts. Experimental parts are vendor-prefixed and should either be avoided in production environments, or used with extreme caution as both their syntax and semantics can change in the future.
Modules and the standardization process CSS Level 2 needed 9 years, from August 2002 to June 2011 to reach the Recommendation status. This was due to the fact that a few secondary features held back the whole specification. In order to accelerate the standardization of non-problematic features, the CSS Working Group of the W3C, in a decision referred as the Beijing doctrine, divided CSS in smaller comp...
...dardization process CSS Level 2 needed 9 years, from August 2002 to June 2011 to reach the Recommendation status. This was due to the fact that a few secondary features held back the whole specification. ...
... Level 2 needed 9 years, from August 2002 to June 2011 to reach the Recommendation status. This was due to the fact that a few secondary features held back the whole specification. In order to accelerate the standardization of non-problematic features, the CSS Working Group of the W3C, in a decision referred as the Beijing doctrine, divided CSS in smaller components called
modules . ...
...And 50 more matches
/loader - Archive of obsolete content
Create CommonJS
module loaders. Usage The code is intentionally authored so that it can be loaded in several ways. It can be loaded as a regular script tag in documents that have system principals (note: this does not appear to work as of 02.2016 due to "use strict" being added to the file): <script type='application/javascript' src='resource://gre/
modules/commonjs/toolkit/loader.js'></script> This will expose a single loader object containing all of the API functions described in this document. ...
...tag in documents that have system principals (note: this does not appear to work as of 02.2016 due to "use strict" being added to the file): <script type='application/javascript' src='resource://gre/
modules/commonjs/toolkit/loader.js'></script> This will expose a single loader object containing all of the API functions described in this document. It can be loaded as a JavaScript code
module: let { Loader, Require, unload } = Components.utils.import('resource://gre/
modules/commonjs/toolkit/loader.js'); It can be required as a CommonJS
module from a
module loaded in the loader itself: let { Loader, Require, unload } = require('toolkit/loader'); What is it good for ? Create somewhat standardized JS environments that people doing non-browser JS are familiar with. Pro...
... Provide unload hooks that may be used to undo changes made by anything loaded into it. ...
...And 49 more matches
NSS tools : modutil
Name modutil -- Manage PKCS #11
module information within the security
module database. Synopsis modutil [options] arguments Description The Security
Module Database Tool, modutil, is a command-line utility for managing PKCS #11
module information both within secmod.db files and within hardware tokens. modutil can add and delete PKCS #11
modules, change passwords on security databases, set defaults, list
module contents, enable or disable slots, enable or disable FIPS 140-2 compliance, and assign default providers for cryptographic operations. This tool can also create certificate, key, and
module security database files. ...
...in hardware tokens. modutil can add and delete PKCS #11
modules, change passwords on security databases, set defaults, list
module contents, enable or disable slots, enable or disable FIPS 140-2 compliance, and assign default providers for cryptographic operations. This tool can also create certificate, key, and
module security database files. The tasks associated with security
module database management are part of a process that typically also involves managing key databases and certificate databases. Options Running modutil always requires one (and only one) option to specify the type of
module operation. Each option may take arguments, anywhere from none to multiple arguments. ...
...Use this option with the -libfile, -ciphers, and -mechanisms arguments. -changepw tokenname Change the password on the named token. If the token has not been initialized, this option initializes the password. ...
...And 49 more matches
NSS tools : modutil
Name modutil - Manage PKCS #11
module information within the security
module database. Synopsis modutil [options] [[arguments]] STATUS This documentation is still work in progress. Please contribute to the initial review in Mozilla NSS bug 836477[1] Description The Security
Module Database Tool, modutil, is a command-line utility for managing PKCS #11
module information both within secmod.db files and within hardware tokens. modutil can add and delete PKCS #11
modules, change passwords on security databases, set defaults, list
module contents, enable or disable slots, enable or disable FIPS 140-2 compliance, and assign default providers for cryptographic operations. This tool can also create certificate, key, and
module security database files. The tasks associated with s...
...les and within hardware tokens. modutil can add and delete PKCS #11
modules, change passwords on security databases, set defaults, list
module contents, enable or disable slots, enable or disable FIPS 140-2 compliance, and assign default providers for cryptographic operations. This tool can also create certificate, key, and
module security database files. The tasks associated with security
module database management are part of a process that typically also involves managing key databases and certificate databases. Options Running modutil always requires one (and only one) option to specify the type of
module operation. Each option may take arguments, anywhere from none to multiple arguments. Options -add
modulename Add the named PKCS #11
module to the database. Use this option ...
...#11
module to the database. Use this option with the -libfile, -ciphers, and -mechanisms arguments. -changepw tokenname Change the password on the named token. If the token has not been initialized, this option initializes the password. Use this option with the -pwfile and -newpwfile arguments. A password is equivalent to a personal identification number (PIN). -chkfips Verify whether the
module is in the given FIPS mode. true means to verify that the
module is in FIPS mode, while false means to verify that the
module is not in FIPS mode. -create Create new certificate, key, and
module databases. Use the -dbdir directory argument to specify a directory. If any of these databases already exist in a specified directory, modutil returns an error message. ...
...And 45 more matches
Index - Learn web development
nd summary 1 Learn web development Beginner, CSS, HTML, Index, Intro, Landing, Learn, Web Welcome to the MDN learning area. This set of articles aims to provide complete beginners to web development with all that they need to start coding websites. 2 Accessibility ARIA, Accessibility, Articles, Beginner, CSS, CodingScripting, HTML, JavaScript, Landing, Learn,
Module Learning some HTML, CSS, and JavaScript is useful if you want to become a web developer. Beyond mechanical use, it's important to learn how to use these technologies responsibly so that all readers might use your creations on the web. To help you achieve this, this
module will cover general best practices (which are demonstrated throughout the HTML, CSS, and JavaScript topics), cross browse...
... HTML, Images, JavaScript, Learn, Multimedia, Video, captions, subtitles, text tracks This chapter has provided a summary of accessibility concerns for multimedia content, along with some practical solutions. 4 Assessment: Accessibility troubleshooting Accessibility, Assessment, Beginner, CSS, CodingScripting, HTML, JavaScript, Learn, WAI-ARIA In the assessment for this
module, we present to you a simple site with a number of accessibility issues that you need to diagnose and fix. 5 CSS and JavaScript accessibility best practices Accessibility, Article, CSS, CodingScripting, Guide, JavaScript, Learn, color, contrast, hiding, unobtrusive We hope this article has given you a good amount of detail and understanding about the accessibility issues surro...
...hing you need to start helping improve MDN's learning content. There are many things you can do, depending on how much time you have and whether you are a beginner, a web developer, or a teacher. 47 Index Index, Learn, MDN Meta Found 348 pages: 48 JavaScript -- Dynamic client-side scripting Beginner, CodingScripting, JavaScript, JavaScripting beginner, Landing,
Module, Topic, l10n:priority JavaScript is a programming language that allows you to implement complex things on web pages. Every time a web page does more than just sit there and display static information for you to look at--displaying timely content updates, interactive maps, animated 2D/3D graphics, scrolling video jukeboxes, or more--you can bet that JavaScript is probably involved. 49...
...And 34 more matches
Understanding WebAssembly text format - WebAssembly
rmat. This is an intermediate form designed to be exposed in text editors, browser developer tools, etc. This article explains how that text format works, in terms of the raw syntax, and how it is related to the underlying bytecode it represents -- and the wrapper objects representing wasm in JavaScript. ...
...works, in terms of the raw syntax, and how it is related to the underlying bytecode it represents -- and the wrapper objects representing wasm in JavaScript. Note: This is potentially overkill if you are a web developer who just wants to load a wasm
module into a page and use it in your code (see Using the WebAssembly JavaScript API), but it is more useful if for example, you want to write wasm
modules to optimize the performance of your JavaScript library, or build your own WebAssembly compiler. ...
...b developer who just wants to load a wasm
module into a page and use it in your code (see Using the WebAssembly JavaScript API), but it is more useful if for example, you want to write wasm
modules to optimize the performance of your JavaScript library, or build your own WebAssembly compiler. S-expressions In both the binary and textual formats, the fundamental unit of code in WebAssembly is a
module. In the text format, a
module is represented as one big S-expression. S-expressions are a very old and very simple textual format for representing trees, and thus we can think of a
module as a tree of nodes that describe the
module's structure and its code. Unlike the Abstract Syntax Tree of a programming language, though, WebAssembly's tree is pretty flat, mostly consisting of lists of instru...
...And 32 more matches
Creating the Component Code
e embedded Gecko clients, Mozilla, Netscape 7, Compuserve, or any other software that uses XPCOM. Registration provides the information that applications need in order to use components properly. The WebLock component must do a number of things to register itself. Specifically, the component library has to contain implementations for the component-related interfaces described in this chapter: nsI
Module and nsIFactory, which are entry points for your implementation code. Once your component implements these interfaces, the rest of the registration process itself is simple. Applications typically use regxpcom, described in the next section. The regxpcom Program An explicit way to register a component is to run the application regxpcom. Without any arguments passed to regxpcom, the program regi...
...dding application may provide other ways to register XPCOM components. XPInstall, the cross-platform installation technology that Mozilla uses to install the browser and other components, is one such alternative. It is described further in Packaging WebLock. You should consult with the authors of the application you wish to extend to see if there are other supported ways. Overview of the WebLock
Module Source As we mentioned in the previous section, components have layers. There are three main parts to every XPCOM component. From the innermost and moving outward, the first object is the XPCOM object. This is the object that contains the business logic, that implements functionality such as starting a network download, implementing interfaces that listen to the download progress, or providing a...
...XPCOM object. This is the object that contains the business logic, that implements functionality such as starting a network download, implementing interfaces that listen to the download progress, or providing a new content type handler. In Weblock, this is the part that brings together various Gecko services and prevents users from leaving the list of acceptable domains. In a way, the factory and
module layers are glue to plug the XPCOM object into the larger XPCOM system. One layer above the object itself is the nsIFactory object. This object provides basic abstraction of the XPCOM object itself. As you can see in Onion Peel View of XPCOM Component Creation, the main accessor for the XPCOM object is CreateInstance, which is expected to return the object that matches a given CID and IID pair. ...
...And 30 more matches
Index - Archive of obsolete content
article documents the self object that is available as a global in content scripts. self provides: 23 Contributor's Guide No summary! 24 Classes and Inheritance Add-on SDK No summary! 25 Content Processes Add-on SDK No summary! 26 Getting Started Add-on SDK Learn how to contribute to the Add-on SDK. 27
Modules Add-ons, Extensions A
module is a self-contained unit of code, which is usually stored in a file, and has a well defined interface. The use of
modules greatly improves the maintainability of code, by splitting it up into independent components, and enforcing logical boundaries between them. Unfortunately, JavaScript does not yet have native support for
modules: it has to rely on the ho...
...Components object provided by Xulrunner application such as Firefox and Thunderbird. 28 Private Properties People have come up with several ways to emulate private properties using existing language features. This article discusses two common techniques: one using prefixes, the other closures. ...
...d-on SDK Construct, validate, and parse URLs. 66 widget Add-on SDK Create a simple user interface for an add-on in Firefox's add-on bar. 67 windows Add-on SDK Enumerate and examine open browser windows, open new windows, and listen for window events. 68 Low-Level APIs No summary! 69 /loader Create CommonJS
module loaders. 70 chrome The chrome
module gives an Add-on SDK add-on access to the Components object, which in turn gives it access to a large set of privileged low-level Firefox APIs. 71 console/plain-text Constructor for a console instance. 72 console/traceback Functionality similar to Python's traceback
module. 73 content/...
...And 29 more matches
import - JavaScript
The static import statement is used to import read only live bindings which are exported by another
module. Imported
modules are in strict mode whether you declare them as such or not. The import statement cannot be used in embedded scripts unless such script has a type="
module". Bindings imported are called live bindings because they are updated by the
module that exported the binding. There is also a function-like dynamic import(), which does not require scripts of type="
module". Backward compatibility can be ensured using attribute no
module on the <script> tag. ...
...not be used in embedded scripts unless such script has a type="
module". Bindings imported are called live bindings because they are updated by the
module that exported the binding. There is also a function-like dynamic import(), which does not require scripts of type="
module". Backward compatibility can be ensured using attribute no
module on the <script> tag. ...
...s such script has a type="
module". Bindings imported are called live bindings because they are updated by the
module that exported the binding. There is also a function-like dynamic import(), which does not require scripts of type="
module". Backward compatibility can be ensured using attribute no
module on the <script> tag. ...
...And 26 more matches
export - JavaScript
The export statement is used when creating JavaScript
modules to export live bindings to functions, objects, or primitive values from the
module so they can be used by other programs with the import statement. Bindings that are exported can still be modified locally; when imported, although they can only be read by the importing
module the value updates whenever it is updated by the exporting
module. Exported
modules are in strict mode whether you declare them as such or not. The export statement cannot be used in embedded scripts. ...
... are exported can still be modified locally; when imported, although they can only be read by the importing
module the value updates whenever it is updated by the exporting
module. Exported
modules are in strict mode whether you declare them as such or not. The export statement cannot be used in embedded scripts. ...
...d locally; when imported, although they can only be read by the importing
module the value updates whenever it is updated by the exporting
module. Exported
modules are in strict mode whether you declare them as such or not. The export statement cannot be used in embedded scripts. ...
...And 19 more matches
Using the WebAssembly JavaScript API - WebAssembly
If you have already compiled a
module from another language using tools like Emscripten, or loaded and run the code yourself, the next step is to learn more about using the other features of the WebAssembly JavaScript API. This article teaches you what you'll need to know. Note: If you are unfamiliar with the basic concepts mentioned in this article and need more explanation, read WebAssembly concepts first, then come back. Some simple examples Let's run through some examples that explain how to use the WebAssembly JavaScript API, and how to use it to load a wasm
module in a web page. Note: You can find the sample code in our webassembly-examples GitHub repo. ...
...Grab our simple.wasm file and save a copy in a new directory on your local machine. ...
...ng the example First we need a wasm
module! Grab our simple.wasm file and save a copy in a new directory on your local machine. Next, let's create a simple HTML file called index.html in the same directory as your wasm file (can use our simple template if you haven't got one easily available). Now, to help us understand what is going on here, let's look at the text representation of our wasm
module (which we also meet in Converting WebAssembly format to wasm): (
module (func $i (import "imports" "imported_func") (param i32)) (func (export "exported_func") i32.const 42 call $i)) In the second line, you will see that the import has a two-level namespace -- the internal function $i is imported from imports.imported_func. We need to reflect this two-level namespace in JavaScript...
...And 19 more matches
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
irectly into Firefox's binary directory. The main advantage of using an extension is that it is easy to package everything up and install it on another machine. So here's your basic, plain-vanilla top-level makefile (Makefile.in in the main extension directory): DEPTH = ../.. ...
...INSTALL_EXTENSION_ID is the unique ID of your extension. ...
...homepageURL>http://www.allpeers.com/blog/</em:homepageURL> </Description> </RDF> There's a detailed description of the format of the install.rdf file. Use the DIST_FILES variable in the makefile to tell make to copy the file into the extension directory and (optional) XPI file. Public Interfaces The public/ directory contains any interfaces that need to be accessed by other
modules. These can be IDL files describing XPCOM interfaces, which are used to generate normal C++ header files for inclusion in your source files. They can also be normal C++ header files that are to be used directly by other
modules. The easiest way to accomplish the latter is to use inline implementations for all methods so you don't have any additional linking dependencies. Otherwise you will have t...
...And 18 more matches
Python binding for NSS
se letter and are then followed by a mix of lower and upper case letters, a upper case letter is used to separate words. Acronyms always appear as a contiguous string of upper case letters. Method, function and property names are always lower case with words seperated by underscores. Constants are all upper case with words seperated by underscores, they match the NSS/NSPR C API. Every
module, class, function, and method has associated documentation and is exposed via the standard Python methodology. This documentation is available via the numerous Python documentation extraction tools. Also see the generated HTML documentation provided with each release. NSS/NSPR structs are exposed as Python objects. NSS/NSPR functions which operate on a NSS/NSPR object (i.e. struct) become method...
...sary. Error codes are never returned from methods/functions. python-nss follows the existing Python exception mechanism. Any error reported by NSS/NSPR is converted into a Python exception and raised. The exact error code, error description, and often contextual error information will be present in the exception object. Enumerated constants used in the NSS/NSPR API's are available in the Python
module under the exact same name as they appear in the C header files of NSS/NSPR. Convenience functions are provided to translate between the numeric value of an enumerated constant and it's string representation and visa versa. python-nss internally supports UTF-8. Strings may be Python str objects or Python unicode objects. If a Python unicode object is passed to a NSS/NSPR function it will be enco...
...t if you need more control, such as when building GUI elments you can access a list of "lines", each line is paired with an indentation level value. The (indent, text) pairs allow you to insert the item into a GUI tree structure or simply change the indentation formatting. Deprecated elements of the python-nss API are marked with Python deprecation warnings as well as being documented in the nss
module documentation. As of Python 2.7 deprecation warnings are no longer reported by default. It is suggested Python developers using python-nss periodically run their code with deprecation warnings enabled. Depercated elements will persist for a least two releases before being removed from the API entirely. Project History Red Hat utilizes both NSS and Python in many of it's projects, however it wa...
...And 17 more matches
remote/parent - Archive of obsolete content
Enables you to load
modules, and privileged parts of your add-on in general, into child processes. Usage In multiprocess Firefox: the browser UI runs in one process, sometimes called the chrome process or the parent process web content runs in one or more other processes, sometimes called content processes or remote processes or child processes. By default, add-ons run in the chrome process and can't directly access web content. In the SDK, content scripts run in the child process, and, of course, can access web content. But content scripts don't have many more capabilities than untrusted web content. The sdk/remote/parent
module enables you to load SDK
modules into the child process to give them direct access to content frames. ...
... default, add-ons run in the chrome process and can't directly access web content. In the SDK, content scripts run in the child process, and, of course, can access web content. But content scripts don't have many more capabilities than untrusted web content. The sdk/remote/parent
module enables you to load SDK
modules into the child process to give them direct access to content frames. These SDK
modules have higher privileges than content scripts, and have their own
module loader so they can load other SDK
modules. Its primary purpose is to help build APIs. If you just need to access a web page, use sdk/page-mod to load a content script instead. Terms Process Every application has at least one process running, the main process that displays the UI. Multiprocess applications can have other...
... can contain many frames. Frame Every DOM page loaded as a part of the application is loaded in a content frame. This includes the content of every tab in an application like Firefox and also some other UI elements. Each frame loads in a process but sometimes the application may choose to switch from loading a tab in one process to another. In this case the frame for that tab changes. Loading
modules into the child process To load a
module into the child process, use remoteRequire(): const { remoteRequire } = require("sdk/remote/parent"); remoteRequire("./my-
module.js",
module); Inter-process communication A
module loaded into a different process cannot directly communicate or share state with the
module that loaded it. Instead, the two sides communicate using port objects like those use...
...And 14 more matches
XPCOMUtils.jsm
Declare the class (or multiple classes) implementing the component(s). Create an array of component constructors. Define the NSGetFactory() or NSGet
Module() entry point. ...
... Declare the class (or multiple classes) implementing the component(s). Create an array of component constructors. Define the NSGetFactory() or NSGet
Module() entry point. ...
... Declare the class (or multiple classes) implementing the component(s). Create an array of component constructors. Define the NSGetFactory() or NSGet
Module() entry point. ...
...And 14 more matches
Index - Web APIs
defines the audio file being tested when calling MediaCapabilities.encodingInfo() or MediaCapabilities.decodingInfo() to query whether a specific audio configuration is supported, smooth, and/or power efficient. ...
...ents an audio-processing graph built from audio
modules linked together, each represented by an AudioNode. 123 AudioContext() Audio, Audio Context, Audio Graph, AudioContext, Constructor, Context, Media, Media Graph, Reference, Web Audio, Web Audio API The AudioContext() constructor creates a new AudioContext object which represents an audio-processing graph, built from audio
modules linked together, each represented by an AudioNode. 124 AudioContext.baseLatency API, Audio, AudioContext, Experimental, Media, Property, Web Audio API, baseLatency The baseLatency read-only property of the AudioContext interface returns a double that represents the number of seconds of processing latency incurred by the AudioContext passing the audio from the AudioDestinatio...
...er, Property, Reference, Web Audio API, upZ The upZ read-only property of the AudioListener interface is an AudioParam representing the z value of the direction vector defining the up direction the listener is pointing in. 156 AudioNode API, AudioNode, Interface, Reference, Web Audio API The AudioNode interface is a generic interface for representing an audio processing
module. Examples include: 157 AudioNode.channelCount API, AudioNode, Property, Reference, Web Audio API, channelCount The channelCount property of the AudioNode interface represents an integer used to determine how many channels are used when up-mixing and down-mixing connections to any inputs to the node. 158 AudioNode.channelCountMode API, AudioNode, Property, Refer...
...And 13 more matches
Index
uction to XPCOM for the DOM Developing Mozilla Warning: this document has not yet been reviewed by the DOM gurus, it might contain some errors. 15 Language bindings Embedding, Landing, Mozilla, XPCOM, XPCOM:Language Bindings An XPCOM Language Binding is a bridge between a particular language and XPCOM 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. 16 Components object DOM, Gecko, XPCOM:Language Bindings, XPConnect The Components object is the object through which XPConnect functionality is reflected into JavaScript. The Components object is actually a native instance of the nsIXPCComponents interface which is r...
...is running to ensure that in-use memory isn't inadvertently collected. 46 Components.utils.setGCZeal NeedsTechnicalReview, XPCOM, XPCOM:Language Bindings, XPConnect 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: 47 Components.utils.unload
Modules 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. 48 Components.utils.unwaiveXrays Undo a previous call to Components.utils.waiveXrays(), restor...
...shell is an XPConnect-enabled JavaScript Shell. It is a console application that lets you run JavaScript code. Unlike the ordinary JS shell (js), xpcshell lets the scripts running in it access XPCOM functionality. 66 HOWTO Problem 67 Profiling XPCShell Sometimes, you might want to get a performance profile of a certain piece of JavaScript (like an XPCOM
module), to see which part takes the most time. You could use Venkman for that. But sometimes, Venkman gives too much noise (because it also profiles chrome code). Or you might want to have a more reproducible testcase. In those cases, an xpcshell script can help. You can just call the code you want to test. But then, you can't use the Venkman UI. 68 WithJS
ModulesAndChrome Moved to...
...And 12 more matches
PKCS11 FAQ
PKCS11 FAQ QUESTIONS AND ANSWERS GENERAL QUESTIONS After plugging in an external PKCS #11
module, how do you use the certificate available on the token? Does the certificate need to be imported into NSS's internal certificate database? If so, is there a way to get the certificate from an external token into NSS's internal certificate database? NSS searches all the installed PKCS #11
modules when looking for certificates. Once you've installed the
module, the
module's certificates simply appear in the list of certificates displayed in the Certificate window. What version of PKCS #11 does NSS support? NSS requires at least PKCS #11 version 2.0, but can support some features of later versions of NSS, including NSS 2.20. NSS does not use all the features of later versions of PKCS #11. What a...
...eatures of PKCS #11? Only if you identify your token as the default random number generator. If you do, your token must be able to generate random numbers even when it is not logged in. NSS uses installed random number generators if PKCS11_MECH_RANDOM_FLAG is set in the installer script. For information on how to do this, see Using the JAR Installation Manager to Install a PKCS #11 Cryptographic
Module. Can Mozilla provide a list of all PKCS #11 functions that NSS will use? Your token should expect to implement all the PKCS #11 functions that make sense for your token. NSS continues to evolve, and periodically enhances it's functionality by using a more complete list of PKCS #11 functions. You should have implementations for all the functions specified in the version of the PKCS #11 spec your...
...FUNCTION_NOT_SUPPORTED. Will NSS get the user's CA certificate via PKCS #11 and push it into the CA certificate database or is the CA certificate database expected to obtain the CA certificate by some other means? PKCS #11 certificates that have private keys associated with them are are loaded into the temporary database (in memory) and marked as user certificates. All other certificates in the
module are loaded into the temporary database with no special trust bits associated with them. NSS is perfectly capable of using token certificates in place. Which function does NSS use to get login state information? NSS calls C_GetSessionInfo to get the login/logout state. NSS never attempts to cache this information, because login state can change instantly without NSS knowing about it (for example...
...And 11 more matches
Using XPCOM Utilities to Make Things Easier
bLock1.cpp. Much of the code created to get the software recognized and registered as a component can be reduced to a small data structure and a single macro. XPCOM Macros The XPCOM framework includes a number of macros for making C++ development easier. Though they overlap somewhat (e.g., high-level macros expand to other macros), they fall into the following general categories. Generic XPCOM
Module Macros The work in the previous chapter was useful in setting up the generic component code. But there are only a few places in that code that are unique to the WebLock component, and it was a lot of typing. To write a different component library, you could copy the listing at the end of the chapter, change very little, and paste it into a new project. To avoid these kinds of redundancies, to re...
...ponent code. But there are only a few places in that code that are unique to the WebLock component, and it was a lot of typing. To write a different component library, you could copy the listing at the end of the chapter, change very little, and paste it into a new project. To avoid these kinds of redundancies, to regulate the way generic code is written, and to save typing, XPCOM providesgeneric
module macros that expand into the
module code you've already seen. Since these macros expand into "generic" implementations, they may not offer as much flexibility as you have when you are writing your own implementation. But they have the advantage of allowing much more rapid development. To get an idea about how much can be handled with the macros described in this section, compare the code listing ...
...nto "generic" implementations, they may not offer as much flexibility as you have when you are writing your own implementation. But they have the advantage of allowing much more rapid development. To get an idea about how much can be handled with the macros described in this section, compare the code listing in weblock2.cpp at the end of the chapter with webLock1.cpp in the previous chapter. The
module macros include one set of macros that define the exported NSGet
Module entry point, the required nsI
Module implementation code and another that creates a generic factory for your implementation class. Used together, these macros can take care of a lot of the component implementation code and leave you working on the actual logic for your component. Note that all of the macros described in this s...
...And 11 more matches
Appendix D: Loading Scripts - Archive of obsolete content
ute JavaScript files. Each of these means has its own advantages and disadvantages, as well as its own quirks which may trap the unwary. Below is an overview of the more common means of loading scripts, along with some of their primary advantages, disadvantages, quirks, and use cases. The examples below which make use of the Services global assume that you're previously imported the Services.jsm
module. As this
module only exists on Firefox 4 and other Gecko 2-based platforms, the services in question will have to be manually loaded on other platforms. <script> tags XUL script tags are traditionally the primary means of loading scripts for extension developers. These tags are generally inserted into XUL overlay files or other XUL documents, after which they are automatically loaded into t...
...ly.xul"> <script type="application/javascript;version=1.8" src="overlay.js"/> </overlay> evalInSandbox The Components.utils.evalInSandbox method may be used to load arbitrary code into Components.utils.Sandbox objects. JavaScript files or URLs may be loaded in this manner by first retrieving their contents into memory using an XMLHttpRequest. This is the method used by Jetpack's securable
module system to load nearly all executable code. Advantages Namespacing: Since scripts executed via evalInSandbox run in a defined namespace, global namespace contamination and the resultant extension compatibility issues are not usually a problem. Flexibility: The evalInSandbox method accepts several parameters, including the URL, line number, and JavaScript version of the file from which the cod...
...to sandboxes from a cache. This means that code must be compiled and executed anew each time it is loaded, which has a significant overhead for large code bases. In addition to compile time, reading files synchronously from disk has its own overhead, and XMLHttpRequests have significantly more overhead than native loading methods. Although wary authors can choose to cache instances of their
modules so that
modules are loaded only once globally, this method can be easily misused to re-load scripts for each new window where they would be better loaded only once globally per session. Because Sandbox objects are evaluated in their own javascript compartment, they are separated by a membrane from other JavaScript code. This means that any and all JavaScript objects passed in our out of them ...
...And 10 more matches
JavaScript Object Management - Archive of obsolete content
he second parameter. In this case we set the delay to 0, which means the function should be executed as soon as possible. Firefox has a minimum delay of 10-15ms (taken from this blog post), so it won't really run instantly. It is more than enough to let the window finish its load. Use window.setTimeout and window.setInterval to control timed code execution. In case you're using JavaScript Code
Modules or XPCOM objects, where a window object is not readily available, use an nsITimer instead. This post suggests a way to achieve a true zero ms timeout, as a simple way to achieve parallelism in JS code. Notice the way we send callback functions as parameters, and the use of an alternate reference for this which we always name that. This is all necessary due to a JavaScript feature (quirk wou...
...u test your extension with multiple windows open; never assume everything will work the same as with a single window. Now, in most cases you'll need to coordinate data in a way that it is consistent for all open Firefox windows. There are several ways in which you can do this. Preferences is one of them, and they are covered in another section of this tutorial. Two other ways are JavaScript Code
Modules (Firefox 3 and above), and XPCOM. JavaScript Code
Modules JavaScript Code
Modules (also known as JSM) are new to Firefox 3, and they're the best tool for keeping everything in sync between windows. They're very simple to set up. The first thing you need to do is add an entry in the chrome.manifest file: resource xulschoolhello
modules/ Javascript code
modules are accessed with the ...
...en windows. They're very simple to set up. The first thing you need to do is add an entry in the chrome.manifest file: resource xulschoolhello
modules/ Javascript code
modules are accessed with the resource protocol, which is very similar to the chrome protocol. Just like with the chrome, we define the package name and then a path. To keep things simple, just locate the JSM files in a
modules directory under the root of our project. In order to access a file messageCount.js in this directory, the URL would be: resource://xulschoolhello/messageCount.js Code
modules are regular JS files, so there's nothing new in regards to naming or file types. Mozilla has adopted a standard of using the extension .jsm for these files, but they say .js is fine as well. To keep things simple, sp...
...And 10 more matches
NSS PKCS11 Functions
PKCS #11 Functions This chapter describes the core PKCS #11 functions that an application needs for communicating with cryptographic
modules. In particular, these functions are used for obtaining certificates, keys, and passwords. This was converted from "Chapter 7: PKCS #11 Functions". Back to the NSS reference main page. SECMOD_LoadUser
Module SECMOD_UnloadUser
Module SECMOD_OpenUserDB SECMOD_CloseUserDB PK11_FindCertFromNickname PK11_FindKeyByAnyCert PK11_GetSlotName PK11_GetTokenName PK11_IsHW PK11_IsPresent PK11_IsReadOnly PK11_SetPasswordFunc SECMOD_LoadUser
Module Load a new PKCS #11
module based on a
moduleSpec. ...
...parent is the
moduleDB that presented this
module spec. For applications this value should be NULL. ...
...parent is the
moduleDB that presented this
module spec. For applications this value should be NULL. ...
...And 10 more matches
Handling Mozilla Security Bugs
ecurity vulnerability can and should report it by sending email to address security@mozilla.org. For more information read the rest of this document. Introduction In order to improve the Mozilla project's approach to resolving Mozilla security vulnerabilities, mozilla.org is creating more formal arrangements for handling Mozilla security-related bugs. First, mozilla.org is appointing a security
module owner charged with primary responsibility for coordinating the investigation and resolution of reported Mozilla security vulnerabilities. The security
module owner will have one or more peers to assist in this task. At the same time, mozilla.org is also creating a larger "Mozilla security bug group" by which Mozilla contributors and others can participate in addressing security vulnerabilities in...
...pen the bug report for public scrutiny. The remaining sections of this document describe in more detail how these general policies have been implemented in practice. Organizational Structure for Handling Security Bugs We are organizing the investigation and fixing of Mozilla security vulnerabilities similar to the way Mozilla project activities are handled in general: There will be a security
module owner, a small core of active contributors who can act as peers to the
module owner, a larger group of less active participants, and other people who may become involved from time to time. As with other parts of the Mozilla project, participation in the Mozilla security-related activities will be open to both independent volunteers and to employees of the various corporations and other organizati...
...an act as peers to the
module owner, a larger group of less active participants, and other people who may become involved from time to time. As with other parts of the Mozilla project, participation in the Mozilla security-related activities will be open to both independent volunteers and to employees of the various corporations and other organizations involved with Mozilla. The Mozilla Security
Module Owner and Peers The Mozilla security
module owner will have a similar level of power and responsibility as other Mozilla
module owners. Also, as with other Mozilla
module owners, mozilla.org staff will oversee the work of the security
module owner and select a new security
module owner should that ever be necessary for any reason. The Mozilla security
module owner will work with mozilla.org sta...
...And 10 more matches
Component Internals
XPCOM components are written in C++. The most common type of component is one that is written in C++ and compiled into a shared library (a DLL on a Windows system or a DSO on Unix). The illustration below shows the basic relationship between the shared library containing the component implementation code you write and the XPCOM framework itself. In this diagram, the outer boundary is that of the
module, the shared library in which a component is defined. A Component in the XPCOM Framework When you build a component or
module and compile it into a library, it must export a single method named NSGet
Module. This NSGet
Module function is the entry point for accessing the library. It gets called during registration and unregistration of the component, and when XPCOM wants to discover what interfa...
...In this chapter we will outline this entire process. ...
...These latter supply ease-of-development utilities like smart pointers, generic
modules support, and simple string implementations. ...
...And 10 more matches
Examples
How to throw reject If you have a function that is a promise, and want to end it and throw a reject, you can throw an Error. Components.utils.import("resource://gre/
modules/osfile.jsm") let path = OS.Path.join(OS.Constants.Path.tmpDir, "file.txt"); let promise = OS.File.exists(path); let newPromise = promise.then(function onFulfill(aExists) { if (aExists) { console.log("You have file.txt in your temporary directory."); } else { throw new Error("You don't have file.txt in your temporary directory."); } }); // Unexpected errors should always be reported at the end of a promise chain. let lastPromise = newPromise.then(function onFulfill(){ }) .catch(function onReject(aRejectReason) { console.warn('newPromise failed with reason: ', aRejectReason); }); Using a promi...
...rors should always be reported at the end of a promise chain. let lastPromise = newPromise.then(function onFulfill(){ }) .catch(function onReject(aRejectReason) { console.warn('newPromise failed with reason: ', aRejectReason); }); Using a promise returned by a function (verbose) This example uses a verbose syntax, showing all the involved promises. ...
...or example because access is denied, promise is rejected with an OS.File.Error instance. This state will propagate to newPomise, and Components.utils.reportError will report all the details of the exception to the console. ...
...And 9 more matches
WebRequest.jsm
The event listener receives detailed information about the request, and can modify or cancel the request. You can use this API to implement a content policy in an add-on (for example, an ad or script blocker), as you could using nsIContentPolicy. More generally, you can also use this API instead of HTTP request observers. You can use WebRequest.jsm in either the chrome or content processes. The WebRequest API is modeled on Chrome's webRequest extension API, which makes it easier to write cross-browser add-on code. ...
...You can use WebRequest.jsm in either the chrome or content processes. The WebRequest API is modeled on Chrome's webRequest extension API, which makes it easier to write cross-browser add-on code. There are some differences between this API and Chrome's, though: see Chrome incompatibilities for the details. ...
...tain up to two properties: urls and types. Name Type Description urls MatchPattern Only invoke the listener for URLs that match one of the patterns. types Array of Strings. An array of resource types. Only invoke the listener for resource types that match one of the types given. ...
...And 9 more matches
NSS tools : signtool
he -i option uses the equivalent of this line: + Install-Script: script.js This example associates a MIME type with a file: movie.qt MIME-Type: video/quicktime For information about the way installer script information appears in the manifest file for a JAR archive, see The JAR Format on Netscape DevEdge. -M Lists the PKCS #11
modules available to signtool, including smart cards. The -M option is available in Netscape Signing Tool 1.0 and later versions only. For information on using Netscape Signing Tool with smart cards, see "Using Netscape Signing Tool with Smart Cards". For information on using the -M option to verify FIPS-140-1 validated mode, see "Netscape Signing T...
... Same as -J option. certname Nickname of certificate, as with -k and -l -k options. signdir The directory to be signed, as with -k option. list Same as -l option. Value is ignored, but = sign must be present. listall Same as -L option. Value is ignored, but = sign must be present. metafile Same as -m option.
modules Same as -M option. Value is ignored, but = sign must be present. optimize Same as -o option. Value is ignored, but = sign must be present. password Same as -p option. keysize Same as -s option. token Same as -t option. verify Same as -v option. who Same as -w option. exclude ...
... input redirected from your file as follows: signtool -G MyTestCert inputfile The prompts show up on the screen, but the responses will be automatically read from the file. The password will still be read from the console unless you use the -p option to give the password on the command line. ...
...And 9 more matches
How to build an XPCOM component in JavaScript
This is a "Hello World" tutorial for creating an XPCOM component in JavaScript. This tutorial does not describe how and why XPCOM works the way it does, or what every bit of the example code does. That's been detailed elsewhere. This tutorial will show you what you need to do to get a component working in as few and as simple steps as possible. Implementation This example component will expose a single method, which returns the string "Hello World!". ...
...and the build system will automatically generate the typelib. A sample Makefile.in # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. ...
... to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. ...
...And 9 more matches
Setting up the Gecko SDK
enient location. In this appendix, we set up the Windows Gecko SDK in c:\gecko-sdk\. If you choose some other location, remember to adjust the settings described here (e.g., in the Building a Microsoft Visual Cpp Project section below) to point to this new location. When you extract the SDK, it should have the layout seen below: Layout of the Extracted SDK The directories represent different
modules in the SDK. For example, the headers for networking are all located in the necko directory, and the headers that XPCOM requires are in the XPCOM directory. This directory structure makes build scripts slightly more complicated (since there will be many different include paths), but it helps to organize the parts of the SDK meaningfully. The two top level header files are special. The file mozil...
...he parts of the SDK meaningfully. The two top level header files are special. The file mozilla-config.h lists all of the defines used in the SDK. Including this header file in your project ensures that the component you create uses the same defines as the Gecko libraries themselves. Note that mozilla-config.h may be need to be included before other includes in your component's source code. Each
module directory is divided into three subdirectories:
Module Subdirectories The bin directory contains static libraries, dynamic libraries, and in some cases tools that may be useful in development. The idl directory contains the public IDL files exported by the
module. The includes directory contains C++ header files used by your component. XPCOM exports a number of binaries that should be mentio...
...evelopment. The WebLock component needs to link against the appropriate libraries to uses XPCOM Glue. To add these libraries, select the Link tab, then choose the Input category. In this panel, instead of linking to the include subdirectories of the nspr, embedstring, and xpcom directories, add the paths to the bin subdirectories. ...
...And 9 more matches
SDK API Lifecycle - Archive of obsolete content
t change in future releases. At the same time, developers maintaining and extending the SDK's APIs need to be able to introduce new APIs that aren't yet fully proven, and to retire old APIs when they're no longer optimal or supported by the underlying platform. The API lifecycle aims to balance these competing demands. It has two main components: a stability index that defines how stable each
module is a deprecation process that defines when and how stable SDK APIs can be changed or removed from future versions of the SDK while giving developers enough time to update their code. Stability Index The stability index is adopted from node.js. The SDK uses only four of the six values defined by node.js: Experimental The
module is not yet stabilized. You can try it out and provide...
...ovide feedback, but we may change or remove it in future versions without having to pass through a formal deprecation process. Unstable The API is in the process of settling, but has not yet had sufficient real-world testing to be considered stable. Backwards-compatibility will be maintained if reasonable. ...
...ng to pass through a formal deprecation process. Unstable The API is in the process of settling, but has not yet had sufficient real-world testing to be considered stable. Backwards-compatibility will be maintained if reasonable. If we do have to make backwards-incompatible changes, we will not guarantee the
module will go through the formal deprecation process. Stable The
module is a fully-supported part of the SDK. ...
...And 8 more matches
cfx to jpm - Archive of obsolete content
e with jpm. However, there are a few differences you have to know about. Add-on ID The add-on ID is a unique identifier for your add-on. In a built XPI, it's the ID field in the add-on's Install Manifest (install.rdf) file. The ID is used for a variety of purposes. For example: addons.mozilla.org uses it to distinguish between new add-ons and updates to existing add-ons, and the simple-storage
module uses it to figure out which stored data belongs to which add-on. ID handling with cfx When you use cfx, the ID is taken from the id field in the add-on's package.json file. You can edit this file to create your own ID, but if you don't, cfx will generate one for you, which will look something like "jid1-F3BoogbjQJE67A". Add-on IDs need to be one of two types: a GUID or a string that includes a...
... installed, enabled, or upgraded. With cfx, this defaults to "lib/main.js", although it can be set to a different file using the main field in package.json. In jpm, the entry point defaults to "index.js". So when switching over to jpm: either rename your "main.js" to "index.js" and move it from "lib" to the top level or add a main field to package.json with the value "lib/main.js". ...
...to "index.js" and move it from "lib" to the top level or add a main field to package.json with the value "lib/main.js". Loading
modules The jpm tool uses the same logic as Node.js to determine how to resolve the argument to require(). In most respects this is the same as the old cfx logic. However there are a few differences, because old compatibility shims have been removed. ...
...And 8 more matches
PKCS11 Implement
Implementing PKCS #11 for NSS NOTE: This document was originally for the Netscape Security Library that came with Netscape Communicator 4.0. This note will be removed once the document is updated for the current version of NSS. ...
... Future versions of Netscape server products will also support of PKCS #11 version 2.0. ...
...c
modules who want their products to work with Mozilla client software: How NSS Calls PKCS #11 Functions. Function-specific information organized in the same categories as the PKCS #11 specification. Functions for Different Kinds of Tokens. Summarizes the support NSS expects from different kinds of tokens. Installation. Installing
modules and informing the user of changes in the Cryptographic
Modules settings. Semantics Unique to NSS. Miscellaneous NSS semantics that affect
module implementation. Future versions of Netscape server products will also support of PKCS #11 version 2.0. How NSS Calls PKCS #11 Functions This section is organized according to the categories used in PKCS #11: Cryptographic Token Interface Standard, version 2.0. To understand this section, you should be familiar wi...
...And 8 more matches
Background audio processing using AudioWorklet - Web APIs
e: it ran on the main thread, thus blocking everything else going on until it completed execution. This was far less than ideal, especially for something that can be as computationally expensive as audio processing. Enter AudioWorklet. An audio context's audio worklet is a Worklet which runs off the main thread, executing audio processing code added to it by calling the context's audioWorklet.add
Module() method. Calling add
Module() loads the specified JavaScript file, which should contain the implementation of the audio processor. With the processor registered, you can create a new AudioWorkletNode which passes the audio through the processor's code when the node is linked into the chain of audio nodes along with any other audio nodes. The process of creating an audio processor using JavaScrip...
...ssor may benefit greatly from being built using WebAssembly, which brings near-native or fully native performance to web apps. Implementing your audio processing algorithm using WebAssembly can make it perform markedly better. High level overview Before we start looking at the use of AudioWorklet on a step-by-step basis, let's start with a brief high-level overview of what's involved. Create
module that defines a audio worklet processor class, based on AudioWorkletProcessor which takes audio from one or more incoming sources, performs its operation on the data, and outputs the resulting audio data. Access the audio context's AudioWorklet through its audioWorklet property, and call the audio worklet's domxref("Worklet.add
Module", "add
Module()")}} method to install the audio worklet processo...
...hat defines a audio worklet processor class, based on AudioWorkletProcessor which takes audio from one or more incoming sources, performs its operation on the data, and outputs the resulting audio data. Access the audio context's AudioWorklet through its audioWorklet property, and call the audio worklet's domxref("Worklet.add
Module", "add
Module()")}} method to install the audio worklet processor
module. As needed, create audio processing nodes by passing the processor's name (which is defined by the
module) to the AudioWorkletNode() constructor. Set up any audio parameters the AudioWorkletNode needs, or that you wish to configure. These are defined in the audio worklet processor
module. Connect the created AudioWorkletNodes into your audio processing pipeline as you would any other node, the...
...And 8 more matches
SVG 1.1 Support in Firefox - SVG: Scalable Vector Graphics
of Gecko 2.0, Gecko supports SVG animation using SMIL. See SVG animation with SMIL for a brief overview. Full documentation for SVG is forthcoming. Someday. There is also a description of the Mozilla support of the changes in SVG 2. Element implementation status A quick overview of the SVG 1.1 elements and the current status of the native support. Element Notes Structure
Module svg Implemented. currentScale and currentTranslate DOM attributes are implemented, but there is no pan and zoom user interface. SVGSVGElement Unimplemented attributes: contentScriptType, contentStyleType, viewport, currentView Unimplemented bindings: getIntersectionList, getEnclosureList, checkIntersection, checkEnclosure ...
...e SVG object. metadata Implemented. Only stored in the DOM, no user interface. symbol Implemented. use Implemented. Doesn't completely follow <svg:use> cascading rules (bug 265894). Doesn't deliver events to a SVGElementInstance tree (bug 265895). Conditional Processing
Module switch Implemented. Image
Module image Implemented. Style
Module style Implemented. Shape
Module path Implemented. SVGPathElement Interface Unimplemented attributes: normalizedPathSegList, animatedNormalizedPathSegList ...
...ormalizedPathSegList, animatedNormalizedPathSegList rect Implemented. circle Implemented. line Implemented. ellipse Implemented. polyline Implemented. polygon Implemented. Text
Module text Implemented. Various presentation attributes don't work (alignment-baseline, baseline-shift, dominant-baseline, kerning, letter-spacing, word-spacing, writing-mode, glyph-orientation-horizontal, glyph-orientation-vertical) Recently implemented presentation attributes: direction, unicode-bidi, font-variant, text-decoration SVGTextElement Re...
...And 8 more matches
Tutorials
through an open content license such as Creative Commons. For complete beginners to the Web Getting started with the Web Getting started with the Web is a concise series introducing you to the practicalities of web development. You'll set up the tools you need to construct a simple webpage and publish your own simple code. HTML Tutorials Introductory level Introduction to HTML This
module sets the stage, getting you used to important concepts and syntax, looking at applying HTML to text, how to create hyperlinks, and how to use HTML to structure a webpage. MDN HTML element reference A comprehensive reference for HTML elements, and how the different browsers support them. Creating a Simple Web Page with HTML An HTML guide for beginners that includes explanations of common...
... HTML guide for beginners that includes explanations of common tags, including HTML5 tags. Also includes a step-by-step guide to creating a basic web page with code examples. HTML Challenges Use these challenges to hone your HTML skills (for example, "Should I use an <h2> element or a <strong> element?"), focusing on meaningful markup. ...
...sing on meaningful markup. Intermediate level Multimedia and embedding This
module explores how to use HTML to include multimedia in your web pages, including the different ways that images can be included, and how to embed video, audio, and even entire other webpages. HTML tables Representing tabular data on a webpage in an understandable, accessible way can be a challenge. This
module covers basic table markup, along with more complex features such as implementing captions and summaries. Advanced level HTML forms Forms are a very important part of the Web -- these provide much of the functionality you need for interacting with websites, e.g. ...
...And 8 more matches
XUL Migration Guide - Archive of obsolete content
n to the SDK. First we'll outline how to decide whether your add-on is a good candidate for migration via a comparison of the benefits and limitations of the SDK versus XUL development. Next, we'll look at some of the main tasks involved in migrating: working with content scripts using the SDK's supported APIs how to go beyond the supported APIs when necessary, by: using third party
modules using the SDK's low-level APIs getting direct access to XPCOM Finally, we'll walk through a simple example. Should You Migrate? See this comparison of the benefits and limitations of SDK development and XUL development. Whether you should migrate a particular add-on is largely a matter of how well the SDK's supported APIs meet its needs. If your add-on can accomplish ever...
...indows such as the main browser window. In this way an extension can integrate its user interface into the browser: for example, adding menu items, buttons, and toolbars. Because SDK-based extensions are restartless, they can't use XUL overlays. To add user interface components to the browser, there are a few different options. In order of complexity, the main options are: the SDK includes
modules that implement some basic user interface components including buttons, dialogs, and context menu items. there is a collection of community-developed
modules that includes various user interface components. by using the SDK's low-level APIs you can directly modify the browser chrome. XUL Windows XUL windows are used to define completely new windows to host user interface elements...
...ges to their user interfaces if they are to use only the SDK's supported APIs, and add-ons which make drastic changes to the browser chrome will very probably need more than the SDK's supported APIs can offer. Similarly, the supported APIs expose only a small fraction of the full range of XPCOM functionality. Using Third Party Packages The SDK is extensible by design: developers can create new
modules filling gaps in the SDK, and package them for distribution and reuse. Add-on developers can install these packages and use the new
modules. If you can find a third party package that does what you want, this is a great way to use features not supported in the SDK without having to use the low-level APIs. See the guide to adding Firefox menu items. Some useful third party packages are collected...
...And 7 more matches
dev/panel - Archive of obsolete content
This
module is new in Firefox 34. Note that at the moment you can't debug remote targets (for example, Firefox OS, the Firefox OS Simulator, or Firefox for Android) using tools developed with this API. We're working on removing this restriction. Enables you to extend the Firefox Developer Tools. Most of the Firefox Developer Tools are hosted in a UI component called the Toolbox. Individual built-in tools, such as the JavaScript Debugger or the Web Console, occupy "panels" in the toolbox. With the dev/panel
module, you can create your own panels in the Toolbox: The panel gets a tab in the Toolbox toolbar which enables the user to open it: You specify the panel's content and behavior using HTML, CSS, and JavaScript. When the panel's created, the framework passes it a debuggee: th...
...hrough of using the dev/panel API to add a new tool, see Adding a panel to the toolbox. Basic usage Defining the panel constructor To add a new tool you first need to define a constructor that inherits from the Panel class, and in that constructor you need to supply values for various properties . You can set the constructor up manually if you like, or you can use the Add-on SDK core/heritage
module to simplify the mechanics of inheriting from Panel. You can use the Class utility function: const { Panel } = require("dev/panel"); const { Class } = require("sdk/core/heritage"); const MyPanel = Class({ extends: Panel, label: "My Panel", tooltip: "My new devtool", icon: "./my-devtool.png", url: "./my-devtool.html", setup: function(options) { // my setup goes here }, dispose...
...cument messages. Optional onLoad Function An event handler that will be called after the document in the panel is fully loaded. It's equivalent to document.readyState === "complete". Optional Once you've defined the panel's constructor you have to export it so it can be called by the framework. ...
...And 7 more matches
Finding window handles - Archive of obsolete content
he Scratchpad in Environment > Browser. ...
...tor) .getInterface(Ci.nsIWebNavigation) .QueryInterface(Ci.nsIDocShellTreeItem) .treeOwner .QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIBaseWindow); var hwndString = baseWindow.nativeHandle; Components.utils.import('resource://gre/
modules/ctypes.jsm'); var user32 = ctypes.open('user32.dll'); /* http://msdn.microsoft.com/en-us/library/ms633539%28v=vs.85%29.aspx * BOOL WINAPI SetForegroundWindow( * __in_ HWND hWnd * ); */ var SetForegroundWindow = user32.declare('SetForegroundWindow', ctypes.winapi_abi, ctypes.bool, // return BOOL ctypes.voidptr_t // HWND ); var hwnd = ctypes.voidptr_t(ctypes.UInt64(hwndString)); v...
...ForegroundWindow', ctypes.winapi_abi, ctypes.bool, // return BOOL ctypes.voidptr_t // HWND ); var hwnd = ctypes.voidptr_t(ctypes.UInt64(hwndString)); var rez_SetForegroundWindow = SetForegroundWindow(hwnd); console.log('rez_SetForegroundWindow:', rez_SetForegroundWindow, rez_SetForegroundWindow.toString()); user32.close(); Mac OS X Objective-C Components.utils.import('resource://gre/
modules/Services.jsm'); var browserWindow = Services.wm.getMostRecentWindow('navigator:browser'); if (!browserWindow) { throw new Error('No browser window found'); } var baseWindow = browserWindow.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIWebNavigation) .QueryInterface(Ci.nsIDocShellTreeItem) ...
...And 7 more matches
JavaScript Daemons Management - Archive of obsolete content
For a fast overview on the code proposed here you can git clone https://github.com/madmurphy/daemon.js.git. or, at your choice, directly download this .zip file. About the "callback arguments" polyfill In order to make this framework compatible with Internet Explorer (which doesn't support ...
... For a fast overview on the code proposed here you can git clone https://github.com/madmurphy/daemon.js.git. or, at your choice, directly download this .zip file. About the "callback arguments" polyfill In order to make this framework compatible with Internet Explorer (which doesn't support sending additional parameters to timers' call...
...) modularity The code The code of this framework is split into three files: daemon.js (the core) daemon-safe.js (an extension of the core which adds a replacement of setInterval with a recursive invocation of setTimeout) daemon-methods.js (a wide and highly scalable collection of methods) The only independent
module is daemon.js: both the daemon-safe.js
module and the daemon-methods.js
module require daemon.js to work. For a fast overview on the code proposed here you can git clone https://github.com/madmurphy/daemon.js.git. or, at your choice, directly download this .zip file. About the "callback arguments" polyfill In order to make this framework compatible with Internet Explorer (which doesn't support sending additional parameters to timers' callback function, neither with setTi...
...And 7 more matches
Common causes of memory leaks in extensions - Extensions
h(contentWindow); } This will keep the content window compartments alive until the browser window is closed. Users often only open a single browser window per session and use tabs, in which case the leaked compartments will live for the whole life of the session. A similar problem is holding onto window objects or DOM nodes (such as window.document) for too long by storing them in a JavaScript
module. For example: var windows = []; function inJavascriptCode
Module(window) { // forgetting or failing to pop the window again windows.push(window); } Both of these cases can happen if you forget to declare local variables with var or let, which means they end up belonging to the global scope. For example: function implicitDeclarationLeak(window) { // Implicit variable declaration in the j...
...wback with this idea: If the user disables JavaScript globally or locally (such as by using an add-on like NoScript), then using the content window functions won't work. Problems in bootstrapped (restartless) add-ons Bootstrapped extensions use a bootstrap.js compartment. If you put a reference to anything within this compartment into a long-lived window object (such as browser.xul), JavaScript
module or XPCOM component, the bootstrap.js compartment will become a zombie. For example, the following code snippets -- part of a bootstrap.js -- will leak: function leakref() {} function modifyDocument(document) { var a = document.createElement("a"); document.body.appendChild(a); // The new DOM node holding a reference to leakref will prevent // that function object from being garbage coll...
...s an external function which can be added in your add-on to easily provide a way to undo changes upon unloading of your add-on or a specific part/object. It is part of Edward Lee's restartless boilerplate. Causes of other kinds of leaks Other than JavaScript compartments, add-ons may also leak entities that do not get a dedicated compartment, most commonly chrome DOM windows and JavaScript code
modules. Forgetting to unregister observers Holding onto event observers for too long is another problem. Observers that use strong references are a common cause of leaking whole chrome windows or JavaScript code
modules; it is possible to leak content windows, too, but that is less common. Consider the following example: var myObserver = { observe: function(subject, topic, data) { window.doc...
...And 7 more matches
Getting started with React - Learn web development
bugs that occur when developers are building UIs. It does this through the use of components -- self-contained, logical pieces of code that describe a portion of the user interface. These components can be composed together to create a full UI, and React abstracts away much of the rendering work, leaving you to concentrate on the UI design. Use cases Unlike the other frameworks covered in this
module, React does not enforce strict rules around code conventions or file organization. This allows teams to set conventions that work best for them, and to adopt React in any way they would like to. React can handle a single button, a few pieces of an interface, or an app's entire user interface. While React can be used for small pieces of an interface, it's not as easy to "drop into" an application...
...n the command npm start. The scripts installed by create-react-app will start being served at a local server at localhost:3000, and open the app in a new browser tab. Your browser will display something like this: Application structure create-react-app gives us everything we need to develop a React application. Its initial file structure looks like this: moz-todo-react +-- README.md +-- node_
modules +-- package.json +-- package-lock.json +-- .gitignore +-- public | +-- favicon.ico | +-- index.html | +-- manifest.json +-- src +-- App.css +-- App.js +-- App.test.js +-- index.css +-- index.js +-- logo.svg +-- serviceWorker.js The src directory is where we'll spend most of our time, as it's where the source code for our application lives. The public directory...
...t unique to React applications; create-react-app merely populates it. You don't need to understand this file at all to complete this tutorial, however, if you'd like to learn more about it, you can read What is the file `package.json`? on NodeJS.org; we also talk about it in our Package management basics tutorial. Exploring our first React component -- <App/> In React, a component is a reusable
module that renders a part of our app. These parts can be big or small, but they are usually clearly defined: they serve a single, obvious purpose. Let's open src/App.js, since our browser is prompting us to edit it. This file contains our first component, App, and a few other lines of code: import React from 'react'; import logo from './logo.svg'; import './App.css'; function App() { return ( ...
...And 7 more matches
Gecko Logging
A minimal C++ logging framework is provided for use in core Gecko code. It is enabled for all builds, thread-safe, and the preferred alternative to NSPR logging. Some other mostly-useless information on logging can be found on the NSPR logging page. Logging framework Declaring a log
module LazyLog
Module defers the creation the backing Log
Module in a thread-safe manner and is the preferred method to declare a log
module. ...
...r use in core Gecko code. It is enabled for all builds, thread-safe, and the preferred alternative to NSPR logging. Some other mostly-useless information on logging can be found on the NSPR logging page. Logging framework Declaring a log
module LazyLog
Module defers the creation the backing Log
Module in a thread-safe manner and is the preferred method to declare a log
module. Multiple LazyLog
Modules with the same name can be declared, all will share the same backing Log
Module. This makes it much simpler to share a log
module across multiple translation units. LazyLogLodule provides a conversion operator to Log
Module* and is suitable for passing into the logging macros detailed below. Note: Log
module names can only contain specific characters. The first character must be a lowercase or upp...
... Mozilla Logging Macros MOZ_LOG(
module, level, message) Outputs the given message if the
module has the given log level enabled.
module - The log
module to use. level - The log level of the message. ...
...And 7 more matches
mach
Mach (German for to make) is a program via the "command-line interface" to help developers perform installation tasks such as installing Firefox from its C++ source code. Requirements Mach requires a current version of /mozilla-central/ (or a tree derived from there). Mach was committed on 2012-SEP-26. Mach also requires Python 2.7. Mach itself is Python 3 compliant, but
modules used by mach likely are not Python 3 compliant - so stick to Python 2.7. Running From the root of the source tree checkout, you should just be able to type: $ ./mach If all is well, you should see a help message. Of course, in a random dir you just get a cryptic error message to improve the experience. For full help: $ ./mach help Try building the tree: $ ./mach build If you get error messages, make ...
...compiling) the tree. This includes things related to testing and packaging. These weigh down make files and add to the burden of maintaining the build system. Instead, you are encouraged to implement ancillary functionality in not make (preferably Python). If you do implement something in Python, hooking it up to mach is often trivial (just a few lines of proxy code). ...
... related to testing and packaging. These weigh down make files and add to the burden of maintaining the build system. Instead, you are encouraged to implement ancillary functionality in not make (preferably Python). If you do implement something in Python, hooking it up to mach is often trivial (just a few lines of proxy code). How does mach fit into the
modules system? Mozilla operates with a
modules governance system where there are different components with different owners. There is not currently a mach
module. There may or may never be one. Mach is just a generic tool. The mach core is the only thing that could fall under perview of a
module and an owner. Even if a mach
module were established, mach command
modules (see below) would likely never belong to it. Instead, mach command modul...
...And 7 more matches
An overview of NSS Internals
to support multiple operating systems (OS), it is based on a cross platform portability layer, called the Netscape Portable Runtime (NSPR), which provides cross platform application programming interfaces (APIs) for OS specific APIs like file system access, memory management, network communication, and multithreaded programming. ...
...ough the list of
modules, design principles, and important relevant standards. In order to allow interoperability between software and devices that perform cryptographic operations, NSS conforms to a standard called PKCS#11. (Note that it's important to look at the number 11, as there are other PKCS standards with different numbers that define quite different topics.) A software or hardware
module conforming to the PKCS#11 standard implements an interface of C calls, which allow querying the characteristics and offered services of the
module. Multiple elements of NSS's own
modules have been implemented with this interface, and NSS makes use of this interface when talking to those
modules. This strategy allows NSS to work with many hardware devices (e.g., to speed up the calculations requir...
...istics and offered services of the
module. Multiple elements of NSS's own
modules have been implemented with this interface, and NSS makes use of this interface when talking to those
modules. This strategy allows NSS to work with many hardware devices (e.g., to speed up the calculations required for cryptographic operations, or to access smartcards that securely protect a secret key) and software
modules (e.g., to allow to load such
modules as a plugin that provides additional algorithms or stores key or trust information) that implement the PKCS#11 interface. A core element of NSS is FreeBL, a base library providing hash functions, big number calculations, and cryptographic algorithms. Softoken is an NSS
module that exposes most FreeBL functionality as a PKCS#11
module. Some cryptograp...
...And 7 more matches
WebAssembly.instantiate() - JavaScript
The WebAssembly.instantiate() function allows you to compile and instantiate WebAssembly code. This function has two overloads: The primary overload takes the WebAssembly binary code, in the form of a typed array or ArrayBuffer, and performs both compilation and instantiation in one step. The returned Promise resolves to both a compiled WebAssembly.
Module and its first WebAssembly.Instance. The secondary overload takes an already-compiled WebAssembly.
Module and returns a Promise that resolves to an Instance of that
Module. This overload is useful if the
Module has already been compiled. Important: This method is not the most efficient way of fetching and instantiating wasm
modules. If at all possible, you should use the newer WebAssembly.instantiateStreaming() method instead, which fetch...
...compiled WebAssembly.
Module and returns a Promise that resolves to an Instance of that
Module. This overload is useful if the
Module has already been compiled. Important: This method is not the most efficient way of fetching and instantiating wasm
modules. If at all possible, you should use the newer WebAssembly.instantiateStreaming() method instead, which fetches, compiles, and instantiates a
module all in one step, directly from the raw bytecode, so doesn't require conversion to an ArrayBuffer. Syntax Primary overload -- taking wasm binary code Promise<ResultObject> WebAssembly.instantiate(bufferSource, importObject); Parameters bufferSource A typed array or ArrayBuffer containing the binary code of the .wasm
module you want to compile. importObject Optional An object containing...
...y.instantiate(bufferSource, importObject); Parameters bufferSource A typed array or ArrayBuffer containing the binary code of the .wasm
module you want to compile. importObject Optional An object containing the values to be imported into the newly-created Instance, such as functions or WebAssembly.Memory objects. There must be one matching property for each declared import of the compiled
module or else a WebAssembly.LinkError is thrown. Return value A Promise that resolves to a ResultObject which contains two fields:
module: A WebAssembly.
Module object representing the compiled WebAssembly
module. This
Module can be instantiated again, shared via postMessage() or cached in IndexedDB. instance: A WebAssembly.Instance object that contains all the Exported WebAssembly functions. E...
...And 7 more matches
Creating Event Targets - Archive of obsolete content
This tutorial describes the use of low-level APIs. These APIs are still in active development, and we expect to make incompatible changes to them in future releases. The guide to event-driven programming with the SDK describes how to consume events: that is, how to listen to events generated by event targets. For example, you can listen to the tabs
module's ready event or the Panel object's show event. With the SDK, it's also simple to implement your own event targets. This is especially useful if you want to build your own
modules, either to organize your add-on better or to enable other developers to reuse your code. If you use the SDK's event framework for your event targets, users of your
module can listen for events using the SDK's standard event API. In this tutorial we'll create part ...
...th the SDK, it's also simple to implement your own event targets. This is especially useful if you want to build your own
modules, either to organize your add-on better or to enable other developers to reuse your code. If you use the SDK's event framework for your event targets, users of your
module can listen for events using the SDK's standard event API. In this tutorial we'll create part of a
module to access the browser's Places API. It will emit events when the user adds and visits bookmarks, enabling users of the
module to listen for these events using the SDK's standard event API. Using the Places API First, let's write some code using Places API that logs the URIs of bookmarks the user adds. Create a new directory called "bookmarks", navigate to it, and run jpm init, accepting all th...
...these events using the SDK's standard event API. Using the Places API First, let's write some code using Places API that logs the URIs of bookmarks the user adds. Create a new directory called "bookmarks", navigate to it, and run jpm init, accepting all the defaults. ...
...And 6 more matches
File I/O - Archive of obsolete content
the examples in this article. Only use these legacy interfaces if OS.File is not available to you. This article describes local file input/output in chrome JavaScript. You access the file system using Mozilla XPCOM components. Note: File objects are nsIFile. For legacy reasons, there is also an nsILocalFile interface. Creating an nsIFile object Components.utils.import("resource://gre/
modules/FileUtils.jsm"); var file = new FileUtils.File("/home"); Or the same without using FileUtils.jsm: var file = Components.classes["@mozilla.org/file/local;1"]. createInstance(Components.interfaces.nsILocalFile); file.initWithPath("/home"); Note: The path should be in the "native" form (for example"C:\\Windows"). If you need to use file:// URIs as initializers, see discussion of n...
...eed to use file:// URIs as initializers, see discussion of nsIIOService below. Note: You can still get a file object even if the specified file does not exist, and no exception will be thrown. An exception is thrown only when methods that require the file to exist are called, e.g., isDirectory(), moveTo(), and so on. Getting files in special directories Components.utils.import("resource://gre/
modules/FileUtils.jsm"); // get the "data.txt" file in the profile directory var file = FileUtils.getFile("ProfD", ["data.txt"]); Or the same without using FileUtils.jsm: // Get profile directory. var file = Components.classes["@mozilla.org/file/directory_service;1"]. getService(Components.interfaces.nsIProperties). get("ProfD", Components.interfaces.nsIFile); // Or using Servi...
....h, xpcom/io/nsDirectoryServiceDefs.h. Other such keys as the "ProfD" key are available; check the known locations. Enumerating drives on Windows While you can use initWithPath("/") on UNIX-like systems (Linux, Mac) to get the root of the file system, there's no such root on Windows. ...
...And 6 more matches
How to convert an overlay extension to restartless - Archive of obsolete content
option, but some users take forever to upgrade. There will be no usage of the Add-on SDK or any other external libraries here. Everything will use APIs available in Firefox 17+ or code provided here. Step 1: Use Services.jsm If you load one of Mozilla's internal JSM files, for example Services.jsm, you'll do so via privileged JavaScript code like this: Components.utils.import("resource://gre/
modules/Services.jsm"); From here on out, it is assumed you've imported Services.jsm somewhere at the top of whatever file you're in and will be using it in all code examples. The examples will also assume that you know how to properly add instructions to your add-on's chrome.manifest to add and remove resource, chrome, locale, & etc. mappings, so that you can access your files with custom paths such a...
... of the bootstrap data structure passed to the startup(), shutdown(), install(), and uninstall() functions in what will be your bootstrap.js file (see below). ...
...rtunately, the built in APIs for dealing with preferences are missing this basic stuff, and its plain text handling doesn't work with Unicode properly. Step 4a: Another way to handle default preferences If you want to keep your preference file in defaults/preferences/, the approach above only works as long as your extension is unpacked. For packed extensions (the default), you can either load a
module similar to Firebug's prefLoader.js or load this workaround
module (N.B. As of May 29, 2017, that
module does not work with packed extensions; I'm preserving the link in case the author updates the gist to fix this issue). Step 5: No more internal JAR files You know how I've been mentioning extractionless add-ons every once in a while thus far? Well, you should probably consider switching to be ...
...And 6 more matches
XPJS Components Proposal - Archive of obsolete content
s, and components in JavaScript. It will support service and factory registration. These components will be independent of web content and browser windows. They will run from the user's disk just like native components. How will it work? The overriding principle is to make this work as much like native components as possible. XJS Components will 'live' in.js files. Just as with native component
modules each of these .js files will be expected to have the functions: NSRegisterSelf NSGetFactory NSUnregisterSelf (optional) NSCanUnload (optional) Each .js file might implement one or more components. We will have one native
module - called the XPJSManager - which holds this system together. The XPJSManager is in charge of loading these .js files, helping them register themselves, and actin...
...The standard (non-DOM) JS classes will be available. The xpconnectComponents object will be available. And some additional yet to be defined objects may be available. ...
...sitory of native and JS xpcom components, so this is not as isolated an environment as it might at first sound. A 'load' or 'import' function will also be provided to let the JS code import other .js files where libraries of code might be stored. This is akin to 'static' libraries. Accessing other components/services via xpcom/xpconnect is more akin to 'dynamic' libraries. ...
...And 6 more matches
NSS 3.21 release notes
in ssl.h SSL_GetPreliminaryChannelInfo - obtains informat...
... in ssl.h SSL_GetPreliminaryChannelInfo - obtains information about a TLS channel prior ...
...The difference with SECMOD_Create
Module is the new function handles NSS configuration parameter strings. in ssl.h SSL_GetPreliminaryChannelInfo - obtains information about a TLS channel prior to the handshake being...
...And 6 more matches
gtstd.html
ult Security Databases Setting Up the Certificate and Key Databases Building NSS Programs SSL, PKCS #11, and the Default Security Databases The basic relationships among the NSS libraries are described in Introduction to Network Security Services. Before running the sample programs, it's important to understand the relationships between the SSL interface, the PKCS #11 interface, PKCS #11
modules, and the default Netscape security databases. A PKCS #11
module (also called a cryptographic
module) manages cryptographic services such as encryption and decryption via the PKCS #11 interface. PKCS #11
modules can be thought of as drivers for cryptographic devices that can be implemented in either hardware or software. Netscape provides a built-in PKCS #11
module with NSS. Other kinds of PKCS ...
...nd the default Netscape security databases. A PKCS #11
module (also called a cryptographic
module) manages cryptographic services such as encryption and decryption via the PKCS #11 interface. PKCS #11
modules can be thought of as drivers for cryptographic devices that can be implemented in either hardware or software. Netscape provides a built-in PKCS #11
module with NSS. Other kinds of PKCS #11
modules include the Netscape FORTEZZA
module, used by the government, and the Litronic PKCS #11
module for smart card readers. Figure 2.1 illustrates the relationships between NSPR, SSL, PKCS #11, and the available cryptographic
modules. SSL is built on top of NSPR, which handles sockets, threads, and related low-level OS operations. ...
...f PKCS #11
modules include the Netscape FORTEZZA
module, used by the government, and the Litronic PKCS #11
module for smart card readers. Figure 2.1 illustrates the relationships between NSPR, SSL, PKCS #11, and the available cryptographic
modules. SSL is built on top of NSPR, which handles sockets, threads, and related low-level OS operations. On any given server or client, one or more PKCS #11
modules may be available. Figure 2.1 Relationships among NSS libraries, cryptographic
modules, slots, and tokens As shown in the figure, SSL communicates with PKCS #11
modules through the PKCS #11 interface. Any PKCS #11
module that supports PKCS #11 can be used with the NSS libraries. Netscape software uses a file called secmod.db to keep track of the
modules available. ...
...And 6 more matches
Content Scripts - Archive of obsolete content
-ons need to factor the code that gets access to web content into separate scripts that are called content scripts. This page describes how to develop and implement content scripts. Content scripts can be one of the more confusing aspects of working with the SDK, but you're very likely to have to use them. ...
...en stored as separate files under the add-on's "data" directory. jpm doesn't make a "data" directory by default, so you must add it and put your content scripts in there. a message-passing API allows the main code and content scripts to communicate with each other This complete add-on illustrates all of these principles. Its "main.js" attaches a content script to the current tab using the tabs
module. ...
... tabs: exports a Tab object for working with a browser tab. The Tab object includes an attach() function to attach a content script to the tab. page-worker: lets you retrieve a web page without displaying it. ...
...And 5 more matches
Low-Level APIs - Archive of obsolete content
These
modules fall roughly into three categories: fundamental utilities such as collection. Many add-ons are likely to want to use
modules from this category. building blocks for higher level
modules, such as events and worker. You're more likely to use these if you are building your own
modules that implement new APIs, thus extending the SDK itself. privileged
modules that expose powerful low-level capabilities such as window/utils and net/xhr. You can use these
modules in your add-on if you need to, but should be aware that the cost of privileged access is the need to take more elaborate security precautions. ...
...y to use these if you are building your own
modules that implement new APIs, thus extending the SDK itself. privileged
modules that expose powerful low-level capabilities such as window/utils and net/xhr. You can use these
modules in your add-on if you need to, but should be aware that the cost of privileged access is the need to take more elaborate security precautions. In many cases these
modules have simpler, more restricted analogs among the "High-Level APIs" (for example, windows or request). These
modules are still in active development, and we expect to make incompatible changes to them in future releases. /loader Create CommonJS
module loaders. ...
...st of privileged access is the need to take more elaborate security precautions. In many cases these
modules have simpler, more restricted analogs among the "High-Level APIs" (for example, windows or request). These
modules are still in active development, and we expect to make incompatible changes to them in future releases. /loader Create CommonJS
module loaders. chrome The chrome
module gives an Add-on SDK add-on access to the Components object, which in turn gives it access to a large set of privileged low-level Firefox APIs. console/plain-text Constructor for a console instance. console/traceback Functionality similar to Python's traceback
module. content/content Re-exports three objects from three other
modules: Loader, Worker, and Symbiont. content/loader Provides on...
...And 5 more matches
cfx - Archive of obsolete content
if you type: cfx run ---no-run you will see something like: To launch the application, enter the following command: /path/to/firefox/firefox-bin -profile /path/to/profile/tmpJDNlP6.mozrunner -foreground -no-remote This enables you to run the add-on without going through cfx, which might be useful if you want to run it inside a debugger like GDB. -o, --overload-
modules In early versions of the SDK, the SDK
modules used by an add-on were themselves included in the add-on. The SDK
modules now ship as part of Firefox. From Firefox 21 onwards, SDK add-ons built with SDK 1.14 or higher will use the SDK
modules that are built into Firefox, even if the add-on includes its own copies of the SDK
modules. Use this flag to reverse that behavior: if this flag...
...ed by an add-on were themselves included in the add-on. The SDK
modules now ship as part of Firefox. From Firefox 21 onwards, SDK add-ons built with SDK 1.14 or higher will use the SDK
modules that are built into Firefox, even if the add-on includes its own copies of the SDK
modules. Use this flag to reverse that behavior: if this flag is set and the add-on includes its own copies of the SDK
modules, then the add-on will use the SDK
modules in the add-on, not the ones built into Firefox. This flag is particularly useful for SDK developers or people working with the development version of the SDK, who may want to run an add-on using newer versions of the
modules than than those shipping in Firefox. --templatedir=TEMPLATEDIR The cfx run command constructs the add-on using...
...sole output to the file specified by LOGFILE. LOGFILE may be specified as a full path or as a path relative to the current directory. cfx test Run available tests for the specified package. Called with no options this command will look for a file called package.json in the current directory. If package.json exists, cfx will load the corresponding add-on, load from the tests directory any
modules that start with the word test- and run the unit tests they contain. Note the hyphen after "test" in the
module name. cfx test will include a
module called "test-myCode.js", but will exclude
modules called "test_myCode.js" or "testMyCode.js". See the tutorial on unit testing and the reference documentation for the assert
module for details. Supported Options As with cfx run you can use option...
...And 5 more matches
Chrome Authority - Archive of obsolete content
The API used to gain Chrome access is currently an experimental feature of the SDK, and may change in future releases. Using Chrome Authority The most powerful low-level
modules are run with "chrome privileges", which gives them access to the infamous Components object, which grants unfettered access to the host system. From this, the
module can do pretty much anything the browser is capable of. To obtain these privileges, the
module must declare its intent with a statement like the following: var {Cc, Ci} = require("chrome"); The "chrome" built-in pseudo
module is provided by the "toolkit/loader"
module. The object returned by require("chrome"), when unpacked with the destructuring assignment feature available in the Mozilla JS environment, will provide the usual Components.* aliases: ...
...s for Components.results. Cm An alias for Components.manager. components An alias for Components itself (note the lower-case). From this you can access less-frequently-used properties like Components.stack and Components.isSuccessCode. Note: the require("chrome") statement is the only way to access chrome functionality and the Components API. The Components object should not be accessed from
modules. The SDK tools will emit a warning if it sees
module code which references Components directly. Your
modules should refrain from using chrome privileges unless they are absolutely necessary. Chrome-authority-using
modules must receive extra security review, and most bugs in these
modules are security-critical. Manifest Generation The manifest is a list, included in the generated XPI, which sp...
...ls will emit a warning if it sees
module code which references Components directly. Your
modules should refrain from using chrome privileges unless they are absolutely necessary. Chrome-authority-using
modules must receive extra security review, and most bugs in these
modules are security-critical. Manifest Generation The manifest is a list, included in the generated XPI, which specifies which
modules have requested require() access to which other
modules. It also records which
modules have requested chrome access. This list is generated by scanning all included
modules for require(XYZ) statements and recording the particular "XYZ" strings that they reference. ...
...And 5 more matches
Unit Testing - Archive of obsolete content
To follow this tutorial you'll need to have learned the basics of jpm and followed the tutorial on writing reusable
modules. If you're migrating test code from cfx to jpm, see the guide to migrating from cfx, in particular the section on loading
modules from test code. The SDK provides a framework to help create and run unit tests for your code. To demonstrate how it works we'll write some unit tests for a simple Base64 encoding
module. A Simple Base64
Module In a web page, you can perform Base64 encoding and decoding using the btoa() and atob() functions. ...
...ate how it works we'll write some unit tests for a simple Base64 encoding
module. A Simple Base64
Module In a web page, you can perform Base64 encoding and decoding using the btoa() and atob() functions. Unfortunately these functions are attached to the window object: since this object is not available in your main add-on code, atob() and btoa() aren't available either. So we'll create a base64
module to expose these functions from the platform (see Creating Reusable
Modules). To begin with, create a new directory, navigate to it, and run jpm init. ...
...ject is not available in your main add-on code, atob() and btoa() aren't available either. So we'll create a base64
module to expose these functions from the platform (see Creating Reusable
Modules). To begin with, create a new directory, navigate to it, and run jpm init. Now create a new file called "base64.js", and give it the following contents: const { atob, btoa } = require("resource://gre/
modules/Services.jsm"); exports.atob = a => atob(a); exports.btoa = b => btoa(b); This code exports two functions, which just call the platform's btoa() and atob() functions. ...
...And 5 more matches
How Mozilla's build system works
perform a limited set of operations. moz.build files are limited to performing the following actions: Calling functions that are explicitly made available to the moz.build environment. Assigning to a well-defined set of variables whose name is UPPERCASE. Creating new variables whose name is not UPPERCASE (this includes defining functions). moz.build files cannot do the following: Import
modules. Open files. Use the print statement or function. Reference many of Python's built-in or global functions (they are not made available to the execution environment). The most important actions of moz.build files are #1 and #2 from the above list. These are how the execution of a moz.build file tells the build system what to do. For example, you can assign to the DIRS list to define which di...
...tly assigned to and the special variables indirectly assigned to by calling functions exported to the execution environment. This is what we were referring to when we said you can think of moz.build files as data structures. moz.build UPPERCASE Variables and Functions The set of special symbols available to moz.build files is centrally defined and is under the purview of the build configuration
module. To view the variables and functions available in your checkout of the tree, run the following: mach mozbuild-reference Or, you can view the raw file at /python/mozbuild/mozbuild/frontend/context.py. How moz.build Processing Works For most developers, knowing that moz.build files are Python scripts that are executed and emit Python dictionaries describing the build configuration is enough. If...
...mmon code that several components need to share and sharing it through XPCOM is not appropriate or not possible. As an example, below is a portion of the makefile for libmsgbaseutil, which is linked against by all of the main news components: DEPTH = ../../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk
MODULE = msgbaseutil LIBRARY_NAME = msgbaseutil EXPORT_LIBRARY = 1 SHORT_LIBNAME = msgbsutl Notice that the only change from the component example above is that IS_COMPONENT is not set. When this is not set, a shared library will be created and installed to dist/bin. Static libraries As mentioned above, static libraries are most commonly used as intermediate steps to building a larg...
...And 5 more matches
Downloads.jsm
The Downloads.jsm JavaScript code
module provides a single entry point to interact with the downloading capabilities of the platform, including starting new downloads, controlling ongoing downloads, and retrieving download-related configuration. To use it, you first need to import the code
module into your JavaScript scope: Components.utils.import("resource://gre/
modules/Downloads.jsm"); Method overview Promise<Download> createDownload(Object aProperties); Promise<void> fetch(aSource, aTarget, [optional] Object aOptions); Promise<DownloadList> getList(aType); Promise<DownloadSummary> getSummary(aType); Constants Constant Description PUBLIC Work on downloads that were not started from a private browsing window. PRIV...
...etList() method is called. Promise<DownloadSummary> getSummary(aType); Parameters aType This can be Downloads.PUBLIC, Downloads.PRIVATE, or Downloads.ALL. Promise resolves to The requested DownloadSummary object. Examples Downloading to a local file This example downloads an HTML file without showing progress, handling errors programmatically. ...
...Type); Parameters aType This can be Downloads.PUBLIC, Downloads.PRIVATE, or Downloads.ALL. Promise resolves to The requested DownloadSummary object. Examples Downloading to a local file This example downloads an HTML file without showing progress, handling errors programmatically. ...
...And 5 more matches
Localization and Plurals
This
module provides a couple methods for localizing to the browser's current locale as well as getting methods to localize to a desired plural rule. The latter ability of specifying a plural rule is useful for extensions because the extension doesn't necessarily have to be localized to the browser's locale. Loading PluralForm.jsm Loading the PluralForm
module from JavaScript i...
...ms() to get the number of forms instead of figuring out locally to better support future rules - Requires build from 2007/01/27 or later 0.3: Generate a list of what numbers fall into which plural form to minimize the sample output to at most 3 of each form Developing with PluralForm The functionality for getting the correct plural forms is provided by a JavaScript
Module, PluralForm.jsm. ...
...d by a JavaScript
Module, PluralForm.jsm. This
module provides a couple methods for localizing to the browser's current locale as well as getting methods to localize to a desired plural rule. The latter ability of specifying a plural rule is useful for extensions because the extension doesn't necessarily have to be localized to the browser's locale. Loading PluralForm.jsm Loading the PluralForm
module from JavaScript is simple with Components.utils.import. Just put the following line somewhere that will be evaluated before you want to use PluralForm. At the top of your JavaScript file is fine. ...
...And 5 more matches
Starting WebLock
registration). This chapter will focus on the functionality that actually handles the web locking. Getting Called at Startup No person is an island to himself, and neither are components. The sample component you've built up so far doesn't do anything. After having its registration procedure called, the component does nothing. ...
...c name could be something like "xpcom-startup", for instance, and the name-value pair could contain the contract IDs required to create the components requesting startup. In fact, this is exactly how categories are used to handle registration with XPCOM for startup notification. You will see the code which does this in the next section. Getting Access to the Category Manager Two fields in the ns
ModuleComponentInfo structure introduced in the last section are addresses for registration and unregistration callbacks. The first callback is called when the component's nsI
Module::RegisterSelf method is called. This callback allows the component to execute any one-time registration code it may need. The inverse of this function is the unregistration callback, where it's a good idea to undo whatever t...
...ed. The inverse of this function is the unregistration callback, where it's a good idea to undo whatever the registration function did. The two functions look like this: static NS_METHOD WebLockRegistration(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *registryLocation, const char *componentType, const ns
ModuleComponentInfo *info); static NS_METHOD WebLockUnregistration(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *registryLocation, const ns
ModuleComponentInfo *info); The names of the functions can be anything you wish. Both functions are passed the Component Manager and the path to the component, including the opaque regi...
...And 5 more matches
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. See Using JavaScript code
modules for more details. Note: Prior to Gecko 2.0, JavaScript code
modules could only be loaded using file: or resource: URLs. Gecko 2.0 adds support for loading
modules from chrome: URLs, even those inside JAR archives. Syntax Components.utils.import(url [, scope]); // Or, if you use a tool such as jslint which reports compiler errors for the above, Components.utils["import"](url [, scope]); Parameters url A string of the URL of the script to be loaded. The URL must point to a file on the disk, possibly in a ...
...url A string of the URL of the script to be loaded. The URL must point to a file on the disk, possibly in a JAR. scope An optional object to import onto; if omitted, the global object is used. Under Boot2Gecko, the scope is not optional. If your code is meant to work on all platforms, you should always provide a scope. In case of doubt, this is generally a good scope. ...
... possibly in a JAR. scope An optional object to import onto; if omitted, the global object is used. Under Boot2Gecko, the scope is not optional. If your code is meant to work on all platforms, you should always provide a scope. In case of doubt, this is generally a good scope. return value the
module's global object. use of the return value is discouraged since it grants access to the
module's internal properties which are not part of its public API. ...
...And 5 more matches
nsIErrorService
xpcom/base/nsIErrorService.idlScriptable This is a service that allows nsresult codes to be mapped to string bundles that can be used to look up error messages. String bundle keys can also be mapped. ...
...at can be used to look up error messages. String bundle keys can also be mapped. Inherits from: nsISupports Last changed in Gecko 1.7 Implemented by: @mozilla.org/xpcom/error-service;1 Method overview string getErrorStringBundle(in short error
Module); string getErrorStringBundleKey(in nsresult error); void registerErrorStringBundle(in short error
Module, in string stringBundleURL); void registerErrorStringBundleKey(in nsresult error, in string stringBundleKey); void unregisterErrorStringBundle(in short error
Module); void unregisterErrorStringBundleKey(in nsresult error); Methods getErrorStringBundle() Retrieves a string bundle URL for an error
module. string getErrorStringBundle( in shor...
...Error
modules are obtained from nsresult code with NS_ERROR_GET_
MODULE. ...
...And 5 more matches
Standard OS Libraries
tener, as this is a high overhead event listener. So I went to the MSDN WinAPI Index page and then went to the "Cursors" category and came across GetCursorPos. I then searched it on MSDN and saw that it needed the user32.dll. (MSDN - GetCursorPos) This example was created on Windows XP SP2. It is a full working example; just copy & paste it to try it out. ...
...K 3 Reference Manual. Because GNOME is in the name of the websites don't get confused and think this only works on GNOME. It is true though that GDK was developed by the GNOME team. Example: gdk_window_get_pointer This example is fot the GDK 2.0 library. In GDK 3.0 the gdk_window_get_device_position function was deprecated, see below for GDK 3.0 example. ...
....toString()); console.info('y:', y, y.toString()); console.info('mask:', mask, mask.toString()); gdk.close(); Example: gdk_window_get_device_position This example works only for GDK3, as the function gdk_window_get_device_position was not available in GDK2, for GDK2 equivalent see above WARNING THIS EXAMPLE DOES NOT WORK YET IT NEEDS SOME BUG FIXING Components.utils.import('resource://gre/
modules/ctypes.jsm'); var gdk = ctypes.open('libgdk-x11-2.0.so.0'); var gdk3 = ctypes.open('libgdk-3.so.0'); // types var gint = ctypes.int; var GdkDevice = ctypes.StructType('GdkDevice'); var GdkDeviceManager = ctypes.StructType('GdkDeviceManager'); var GdkDisplay = ctypes.StructType('GdkDisplay'); var GdkModifierType = ctypes.int; var GdkWindow = ctypes.StructType('GdkWindow'); // https://developer.
...And 5 more matches
Using the CSS Painting API - Web APIs
nd-position properties to re-size or relocate this background image, but this is the default size and placement of the yellow box we created in our paint worklet. We tried to keep the example simple. For more options, look at the canvas documentation. We also add a little bit of complexity later in this tutorial. ...
...plexity later in this tutorial. Using the paint worklet To use the paint worklet, we need to register it using add
Module() and include it in our CSS, ensuring the CSS selector matches a DOM node in our HTML Registering the worklet The setup and design of our paint worklet took place in the external script shown above. We need to register that worklet from our main script. CSS.paintWorklet.add
Module('nameOfPaintWorkletFile.js'); This can be done using the paint worklet's add
Module() method in a <script> within the main HTML or in an external JavaScript file linked to from the document. In our example, the paintworklet is stored on Github. ...
...t took place in the external script shown above. We need to register that worklet from our main script. CSS.paintWorklet.add
Module('nameOfPaintWorkletFile.js'); This can be done using the paint worklet's add
Module() method in a <script> within the main HTML or in an external JavaScript file linked to from the document. In our example, the paintworklet is stored on Github. CSS.paintWorklet.add
Module('https://mdn.github.io/houdini-examples/cssPaint/intro/01partOne/header-highlight.js'); Reference the paint worklet in CSS Once we have a registered paint worklet, we can use it in CSS. Employ the CSS paint() function like we would any other <image> type, using the same string identifier we used in the paintworklet's registerPaint() function. .fancy { background-image: paint(headerHighlight)...
...And 5 more matches
Web Audio API - Web APIs
Web Audio API interfaces The Web Audio API has a number of interfaces and associated events, which we have split up into nine categories of functionality. General audio graph definition General containers and definitions that shape audio graphs in Web Audio API usage. AudioContext The AudioContext interface represents an audio-processing graph built from audio ...
... for a great place to begin. Web Audio API interfaces The Web Audio API has a number of interfaces and associated events, which we have split up into nine categories of functionality. General audio graph definition General containers and definitions that shape audio graphs in Web Audio API usage. AudioContext The AudioContext interface represents an audio-processing graph built from audio
modules linked together, each represented by an AudioNode. An audio context controls the creation of the nodes it contains and the execution of the audio processing, or decoding. You need to create an AudioContext before you do anything else, as everything happens inside a context. AudioContextOptions The AudioContextOptions dictionary is used to provide options when instantiating a new AudioContext. ...
...xt controls the creation of the nodes it contains and the execution of the audio processing, or decoding. You need to create an AudioContext before you do anything else, as everything happens inside a context. AudioContextOptions The AudioContextOptions dictionary is used to provide options when instantiating a new AudioContext. AudioNode The AudioNode interface represents an audio-processing
module like an audio source (e.g. an HTML <audio> or <video> element), audio destination, intermediate processing
module (e.g. a filter like BiquadFilterNode, or volume control like GainNode). AudioParam The AudioParam interface represents an audio-related parameter, like one of an AudioNode. It can be set to a specific value or a change in value, and can be scheduled to happen at a specific time and ...
...And 5 more matches
Loading and running WebAssembly code - WebAssembly
To use WebAssembly in JavaScript, you first need to pull your
module into memory before compilation/instantiation. This article provides a reference for the different mechanisms that can be used to fetch WebAssembly bytecode, as well as how to compile/instantiate then run it. What are the options? WebAssembly is not yet integrated with <script type='
module'> or ES2015 import statements, thus there is not a path to have the browser fetch
modules for you using imports. The older WebAssembly.compile/WebAssembly.instantiate methods require you to create an ArrayBuffer containing your WebAssembly
module binary after fetching the raw bytes, and then compile/instantiate it. This is analogous to new Function(string), except that we are substituting a string of characters (JavaScript source code) wit...
...g methods are a lot more efficient -- they perform their actions directly on the raw stream of bytes coming from the network, cutting out the need for the ArrayBuffer step. So how do we get those bytes into an array buffer and compiled? The following sections explain. Using Fetch Fetch is a convenient, modern API for fetching network resources. ...
...do we get those bytes into an array buffer and compiled? The following sections explain. Using Fetch Fetch is a convenient, modern API for fetching network resources. ...
...And 5 more matches
simple-storage - Archive of obsolete content
It's a normal JavaScript object, and you can treat it as you would any other. ...
...It's a normal JavaScript object, and you can treat it as you would any other. ...
...l = null; ss.storage.myNumber = 3.1337; ss.storage.myObject = { a: "foo", b: { c: true }, d: null }; ss.storage.myString = "O frabjous day!"; You can store array, boolean, number, object, null, and string values. If you'd like to store other types of values, you'll first have to convert them to strings or another one of these types. Be careful to set properties on the storage object and not the
module itself, as demonstrated below: // This is not good! var ss = require("sdk/simple-storage"); ss.foo = "I will not be saved! :("; Simple storage and "jpm run" The simple storage
module stores its data in your profile. Because jpm run by default uses a fresh profile each time it runs, simple storage won't work with add-ons executed using jpm run - that is, stored data will not persist from one ru...
...And 4 more matches
platform/xpcom - Archive of obsolete content
Implement XPCOM objects, factories, and services. Usage The xpcom
module makes it simpler to perform three main tasks: Implement XPCOM object interfaces Implement and register XPCOM factories Implement and register XPCOM services If all you need to do is use XPCOM objects that someone else has implemented, then you don't need to use this
module. You can just use require("chrome") to get direct access to the Components object, and access XPCOM objects from there. Implementing XPCOM Interfaces This
module exports a class called Unknown which implements the fundamental XPCOM interface nsISupports. By subclassing Unknown, either using standard JavaScript inheritance or using the SDK's heritage
module, you can provide your own implementations of XPCOM interfaces. "Unknown" is named aft...
...You can use this class to register factories for XPCOM components you have defined. For example, this add-on defines a subclass of Unknown called HelloWorld that implements a function called hello. By creating a Factory and passing it the contract ID for the HelloWorld component and the HelloWorld constructor, we enable XP...
...isting one. However, the Components.classes object commonly used to look up factories by contract ID will not be updated at run time. To access the replacement factory you need to do something like this: var id = Components.manager.QueryInterface(Ci.nsIComponentRegistrar). ...
...And 4 more matches
jpm - Archive of obsolete content
Installing jpm globally npm install jpm --global Depending on your setup, you might need to run this as an administrator: sudo npm install jpm --global Installing jpm locally If you do not wish to, or are unable to, install jpm globally, you may instead install it locally: cd $HOME && npm install jpm To run jpm from a terminal when installed locally, you must add the directory "$HOME/node_
modules/.bin/" to your terminal's PATH first. Add the following line to the end of the file $HOME/.profile to add it to your PATH permanently (as the file .profile is executed every time a new terminal is opened): export PATH="$HOME/node_
modules/.bin/:$PATH" Installing jpm from git Alternatively, you can also get the latest version of jpm using git: git clone https://github.com/mozilla-jetpack/jpm.g...
...ample, to pass the -jsconsole argument to Firefox and launch the Browser Console, try the following: jpm run --binary-args -jsconsole To pass multiple arguments, or arguments containing spaces, quote them: jpm run --binary-args '-url mzl.la -jsconsole' --debug Run the Add-on Debugger attached to the add-on. -o --overload PATH Rather than use the SDK
modules built into Firefox, use the
modules found at PATH. If -o is specified and PATH is omitted, jpm looks for the JETPACK_ROOT environment variable and use its value as the path. See Overloading the built-in
modules for more information. -p --profile= PROFILE By default, jpm uses a clean temporary Firefox profile each time you call jpm run. Use the --profile option to instru...
.... Opens every file in there whose name starts with "test-". Make note of the hyphen after "test" in the filename. jpm test include a file called "test-myCode.js", but will exclude files called "test_myCode.js" or "testMyCode.js") call every function exported from that file whose name starts with "test". jpm test See the tutorial on unit testing and the reference documentation for the assert
module for more details on this. jpm test accepts the following options: -b --binary BINARY Use the version of Firefox specified in BINARY. BINARY may be specified as a full path or as a path relative to the current directory. jpm test -b /path/to/Firefox/Nightly See Selecting a browser version. --binary-args CMDARGS Pass extra arguments to Firefox. ...
...And 4 more matches
Using Dependent Libraries In Extension Components - Archive of obsolete content
ent2.dll extension-directory/libraries/component.dll extension-directory/components/interface1.xpt extension-directory/components/interface2.xpt extension-directory/components/bsmedberg_stub.dll extensions/stub/Makefile.in # Copyright (c) 2005 Benjamin Smedberg <benjamin@smedbergs.us> DEPTH = ../.. ...
... string \ $(NULL) CPPSRCS = bdsStubLoader.cpp EXTRA_DSO_LDOPTS += \ $(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \ $(XPCOM_FROZEN_LDOPTS) \ $(NSPR_LIBS) \ $(NULL) include $(topsrcdir)/config/rules.mk DEFINES += -DMOZ_DLL_PREFIX=\"$(DLL_PREFIX)\" extensions/stub/bdsStubLoader.cpp // Copyright (c) 2005 Benjamin Smedberg <benjamin@smedbergs.us> #include "nscore.h" #include "ns
Module.h" #include "prlink.h" #include "nsILocalFile.h" #include "nsStringAPI.h" #include "nsCOMPtr.h" static char const *const kDependentLibraries[] = { // dependent1.dll on windows, libdependent1.so on linux MOZ_DLL_PREFIX "dependent1" MOZ_DLL_SUFFIX, MOZ_DLL_PREFIX "dependent2" MOZ_DLL_SUFFIX, nsnull // NOTE: if the dependent libs themselves depend on other libs, the subdependencies //...
...windows, libdependent1.so on linux MOZ_DLL_PREFIX "dependent1" MOZ_DLL_SUFFIX, MOZ_DLL_PREFIX "dependent2" MOZ_DLL_SUFFIX, nsnull // NOTE: if the dependent libs themselves depend on other libs, the subdependencies // should be listed first. }; // component.dll on windows, libcomponent.so on linux static char kRealComponent[] = MOZ_DLL_PREFIX "component" MOZ_DLL_SUFFIX; nsresult NSGet
Module(nsIComponentManager* aCompMgr, nsIFile* aLocation, nsI
Module* *aResult) { nsresult rv; // This is not the real component. We want to load the dependent libraries // of the real component, then the component itself, and call NSGet
Module on // the component. // Assume that we're in <extensiondir>/components, and we want to find // <extensiondir>/libraries ns...
...And 4 more matches
JavaScript crypto - Archive of obsolete content
nickname= "MyCertNickname"; var cert = "Mkjflakdjfiwjflaksufklasf ..."; var forceBackup = false; function LoadCertificate() { window.crypto.importUserCertificates(nickname, cert, forceBackup); return false; } document.forms[0].onsubmit = LoadCertificate; </script> Signing text DOMString signText(DOMString stringToSign, DOMString caOption /* ... */); Loading PKCS #11
modules long delete
module(DOMString
moduleName); long add
module(DOMString
moduleName, DOMString libraryFullPath, long cryptoMechanismFlags, long cipherFlags); Loads or removes a new PKCS #11
module. In the add case, the
module will be placed in the NSS secmod.db database and will be loaded automatically on application restart. In the delete case, the modul...
...Flags, long cipherFlags); Loads or removes a new PKCS #11
module. In the add case, the
module will be placed in the NSS secmod.db database and will be loaded automatically on application restart. In the delete case, the
module is removed from the NSS secmod.db. This function will issue a user prompt to confirm the operation before the add or delete actually occurs. Parameters
moduleName Name of the
module. libraryFullPath The filename of the library prepended with its full path. cryptoMechanismFlags A bit vector indicating all cryptographic mechanisms should be turned on by default (see below). cipherFlags A bit vector indicating all SSL or S/MIME cipher functions supported by the
module (see below). Mechanism flag definitions In general, most tokens should not set...
...chanisms should be turned on by default (see below). cipherFlags A bit vector indicating all SSL or S/MIME cipher functions supported by the
module (see below). Mechanism flag definitions In general, most tokens should not set any of the cipher flags. Setting these flags means you want your token to supply the default implementation for these functions. Normally Mozilla uses its own internal
module to supply these functions. These flags override that preference. ...
...And 4 more matches
Front-end web developer - Learn web development
CSS section. Prerequisites You don't need any previous knowledge to start this course. All you need is a computer that can run modern web browsers, an internet connection, and a willingness to learn. If you are not sure if front-end web development is for you, and/or you want a gentle introduction before starting a longer and more complete course, work through our Getting started with the web
module first. Getting help We have tried to make learning front-end web development as comfortable as possible, but you will probably still get stuck because you don't understand something, or some code is just not working. Don't panic. We all get stuck, whether we are beginner or professional web developers. The Learning and getting help article provides you with a series of tips for looking up info...
...rse. Guides Installing basic software -- basic tool setup (15 min read) Background on the web and web standards (45 min read) Learning and getting help (45 min read) Semantics and structure with HTML Time to complete: 35-50 hours Prerequisites Nothing except basic computer literacy, and a basic web development environment. How will I know I'm ready to move on? The assessments in each
module are designed to test your knowledge of the subject matter. Completing the assessments confirms that you are ready to move on to the next
module.
Modules Introduction to HTML (15-20 hour read/exercises) Multimedia and embedding (15-20 hour read/exercises) HTML tables (5-10 hour read/exercises) Styling and layout with CSS Time to complete: 90-120 hours Prerequisites It is recommended th...
...15-20 hour read/exercises) Multimedia and embedding (15-20 hour read/exercises) HTML tables (5-10 hour read/exercises) Styling and layout with CSS Time to complete: 90-120 hours Prerequisites It is recommended that you have basic HTML knowledge before starting to learn CSS. You should at least study Introduction to HTML first. How will I know I'm ready to move on? The assessments in each
module are designed to test your knowledge of the subject matter. Completing the assessments confirms that you are ready to move on to the next
module.
Modules CSS first steps (10-15 hour read/exercises) CSS building blocks (35-45 hour read/exercises) Styling text (15-20 hour read/exercises) CSS layout (30-40 hour read/exercises) Additional resources CSS layout cookbook Interactivity with...
...And 4 more matches
Package management basics - Learn web development
le installing and uninstalling packages. If you didn't use one, you'd have to manually handle: Finding all the correct package JavaScript files. Checking them to make sure they don't have any known vulnerabilities. Downloading them and putting them in the correct locations in your project. Writing the code to include the package(s) in your application (this tends to be done using JavaScript
modules, another subject that is worth reading up on and understanding). Doing the same thing for all of the packages' sub-dependencies, of which there could be tens, or hundreds. Removing all the files again if you want to remove the packages. In addition, package managers handle duplicate dependencies (something that becomes important and common in front-end development). In the case of npm (and ...
...e Microsoft Azure allow you to create proxies to the npm registry (so you can override or lock certain packages), GitHub also offers a package registry service, and there will be likely more options appearing as time goes on. What is important is that you ensure you've chosen the best registry for you. Many projects will use npm, and we'll stick to this in our examples throughout the rest of the
module. Using the package ecosystem Let's run through an example to get you started with using a package manager and registry to install a command line utility. Parcel is a(nother) tool that developers commonly use in their development process. Parcel is clever in that it can watch the contents of our code for calls to dependencies and automatically installs any dependencies it sees that our code nee...
...const date = '1996-09-13 10:00:00'; document.body.textContent = formatDistanceToNow(new Date(date)) + ' ago'; Go back to http://localhost:1234 and you'll see how long ago it is since the author turned 18. What's particularly special about the code above is that it is using the formatDistanceToNow() function from the date-fns package, which we didn't install! Parcel has spotted that you need the
module, searched for it in the npmjs.com package registry, and installed it locally for us, automatically. You can prove this by looking in our package.json file again -- you'll see that the dependencies field have been updated for us: "dependencies": { "date-fns": "^2.12.0", "parcel-bundler": "^1.12.4" } Parcel has also added the files required for someone else to pick up this project and install...
...And 4 more matches
What to do and what not to do in Bugzilla
the bug is long, when enough info is provided a new bug should be filed and the original bug marked as a duplicate of it. Resolving bugs as INVALID You should resolve a bug as INVALID if the issue described in the bug is clearly not a Mozilla bug or if the issue is intended behavior. ...
...ug marked as a duplicate of it. Resolving bugs as INVALID You should resolve a bug as INVALID if the issue described in the bug is clearly not a Mozilla bug or if the issue is intended behavior. The exceptions are bugs in other software which we have to work around and bugs that involve certain core Gecko
modules. ...
...uplicate of it. Resolving bugs as INVALID You should resolve a bug as INVALID if the issue described in the bug is clearly not a Mozilla bug or if the issue is intended behavior. The exceptions are bugs in other software which we have to work around and bugs that involve certain core Gecko
modules. ...
...And 4 more matches
PromiseWorker.jsm
PCOM access, similar to ChromeWorker. This answers the question "When should I use a PromiseWorker?", and the answer is, whenever you would normally use a ChromeWorker, but want postMessage to return promises. The PromiseWorker object is used to deliver all of the OS.File functionality to the main thread. Here is the test case from Firefox codebase: Mozilla DXR :: test_Promise.js. ...
...henever you would normally use a ChromeWorker, but want postMessage to return promises. The PromiseWorker object is used to deliver all of the OS.File functionality to the main thread. Here is the test case from Firefox codebase: Mozilla DXR :: test_Promise.js. PromiseWorker
module consists of two JavaScript files, PromiseWorker.jsm and PromiseWorker.js. PromiseWorker.jsm Path: resource://gre/
modules/PromiseWorker.jsm A JavaScript code
module used by the main thread to create a worker thread and communicate with it. PromiseWorker.jsm provides BasePromiseWorker. PromiseWorker.js Path: resource://gre/
modules/workers/PromiseWorker.js A JavaScript file used by the worker thread, which is created by PromiseWorker.jsm in main thread, to communicate with the main thread. PromiseWorker.js provid...
...cts. Worker file There is some standard templating that must be dropped into the worker file by the developer. The require.js file must be imported with WorkerGlobalScope/importScripts(). Next, the PromiseWorker.js file should be brought in with the require() method. Finally, the template code should be added in. The code below is what should be copied and pasted: importScripts('resource://gre/
modules/workers/require.js'); let PromiseWorker = require('resource://gre/
modules/workers/PromiseWorker.js'); // Instantiate AbstractWorker (see below). let worker = new PromiseWorker.AbstractWorker() worker.dispatch = function(method, args = []) { // Dispatch a call to method `method` with args `args` return self[method](...args); }; worker.postMessage = function(...args) { // Post a message to...
...And 4 more matches
NSS_Initialize
Name NSS_Initialize - initialize NSS. Syntax SECStatus NSS_Initialize(const char *configdir, const char *certPrefix, const char *keyPrefix, const char *secmodName, PRUint32 flags); Parameters NSS_Initialize has five parameters: configdir [in] the directory where the certificate, key, and
module databases live. To-do: document the "sql:" prefix. certPrefix [in] prefix added to the beginning of the certificate database, for example, "https-server1-". keyPrefix [in] prefix added to the beginning of the key database, for example, "https-server1-". secmodName [in] name of the security
module database, usually "secmod.db". flags [in] bit flags that specify how NSS should be initialized. Descr...
...e than NSS_Init, NSS_InitReadWrite, and NSS_NoDB_Init. If any of those simpler NSS initialization functions suffices for your needs, call that instead. The flags parameter is a bitwise OR of the following flags: NSS_INIT_READONLY - Open the databases read only. NSS_INIT_NOCERTDB - Don't open the cert DB and key DB's, just initialize the volatile certdb. ...
...SS_NoDB_Init. If any of those simpler NSS initialization functions suffices for your needs, call that instead. The flags parameter is a bitwise OR of the following flags: NSS_INIT_READONLY - Open the databases read only. NSS_INIT_NOCERTDB - Don't open the cert DB and key DB's, just initialize the volatile certdb. NSS_INIT_NOMODDB - Don't open the security
module DB, just initialize the PKCS #11
module. ...
...And 4 more matches
WebAssembly Concepts - WebAssembly
ilation target for low-level source languages like C, C++, Rust, etc. This has huge implications for the web platform -- it provides a way to run code written in multiple languages on the web at near-native speed, with client apps running on the web that previously couldn't have done so. What's more, you don't even have to know how to create WebAssembly code to take advantage of it. WebAssembly
modules can be imported into a web (or Node.js) app, exposing WebAssembly functions for use via JavaScript. JavaScript frameworks could make use of WebAssembly to confer massive performance advantages and new features while still making functionality easily available to web developers. WebAssembly goals WebAssembly is being created as an open standard inside the W3C WebAssembly Community Group with th...
...t earlier will now load and run two types of code -- JavaScript AND WebAssembly. The different code types can call each other as required -- the WebAssembly JavaScript API wraps exported WebAssembly code with JavaScript functions that can be called normally, and WebAssembly code can import and synchronously call normal JavaScript functions. In fact, the basic unit of WebAssembly code is called a
module and WebAssembly
modules are symmetric in many ways to ES2015
modules. WebAssembly key concepts There are several key concepts needed to understand how WebAssembly runs in the browser. All of these concepts are reflected 1:1 in the WebAssembly JavaScript API.
Module: Represents a WebAssembly binary that has been compiled by the browser into executable machine code. A
Module is stateless and t...
...ts There are several key concepts needed to understand how WebAssembly runs in the browser. All of these concepts are reflected 1:1 in the WebAssembly JavaScript API.
Module: Represents a WebAssembly binary that has been compiled by the browser into executable machine code. A
Module is stateless and thus, like a Blob, can be explicitly shared between windows and workers (via postMessage()). A
Module declares imports and exports just like an ES2015
module. Memory: A resizable ArrayBuffer that contains the linear array of bytes read and written by WebAssembly's low-level memory access instructions. ...
...And 4 more matches
WebAssembly
both to work together. In a Nutshell WebAssembly has huge implications for the web platform -- it provides a way to run code written in multiple languages on the web at near native speed, with client apps running on the web that previously couldn't have done so. WebAssembly is designed to complement and run alongside JavaScript -- using the WebAssembly JavaScript APIs, you can load WebAssembly
modules into a JavaScript app and share functionality between the two. This allows you to take advantage of WebAssembly's performance and power and JavaScript's expressiveness and flexibility in the same apps, even if you don't know how to write WebAssembly code. And what's even better is that it is being developed as a web standard via the W3C WebAssembly Working Group and Community Group with active ...
...n better is that it is being developed as a web standard via the W3C WebAssembly Working Group and Community Group with active participation from all major browser vendors. Guides WebAssembly concepts Get started by reading the high-level concepts behind WebAssembly -- what it is, why it is so useful, how it fits into the web platform (and beyond), and how to use it. Compiling a New C/C++
Module to WebAssembly When you've written code in C/C++, you can then compile it into .wasm using a tool like Emscripten. Let's look at how it works. Compiling an Existing C
Module to WebAssembly A core use-case for WebAssembly is to take the existing ecosystem of C libraries and allow developers to use them on the web. Compiling from Rust to WebAssembly If you've written some Rust code, you can co...
...into WebAssembly! This tutorial takes you through all you need to know to compile a Rust project to wasm and use it in an existing web app. Loading and running WebAssembly code After you have a .wasm, this article covers how to fetch, compile and instantiate it, combining the WebAssembly JavaScript API with the Fetch or XHR APIs. Using the WebAssembly JavaScript API Once you've loaded a .wasm
module, you'll want to use it. In this article we show you how to use WebAssembly via the WebAssembly JavaScript API. Exported WebAssembly functions Exported WebAssembly functions are the JavaScript reflections of WebAssembly functions which allow calling WebAssembly code from JavaScript. This article describes what they are. Understanding WebAssembly text format This article explains the wasm text ...
...And 4 more matches
Promises - Archive of obsolete content
asynchronous operation to be achieved with a coding style similar to synchronous variants. The following examples make use of the Task API, which harnesses generator functions to remove some of the syntactic clutter of raw Promises, such that asynchronous promise code more closely resembles synchronous, procedural code. ...
... failed", e); }); File IO File IO in add-ons should be done via the OS.File API, which provides a simple, but powerful, interface for reading, writing, and manipulating both text and binary files. It is also available for use off-main-thread in Workers as a synchronous API. This interface replaces the previous, complicated XPCOM nsIFile and streams APIs, and their related JavaScript helper
modules. These older interfaces should be avoided, even in their asynchronous forms, due to their performance penalties and needless complexity. Representative Example Usage Components.utils.import("resource://gre/
modules/osfile.jsm"); Task.spawn(function* () { // Retrieve file metadata to check modification time. let info = yield OS.File.stat(configPath); if (info.lastModificationDate <...
... = new FormData; form.append("id", data.id); form.append("content", data.content); // Make the second request. xhr = yield Request(updateURL, { data: form }); // Use the response of the second request. notifyUser(xhr.responseText); }); Downloading Remote Files Nearly all previous methods of downloading remote files have been superseded by the much simpler Downloads.jsm
module. The Downloads object provides a Promise-based API for downloading remote files, with full support for progress tracking, pause and resume, and, optionally, integration with the download manager UI. Representative Example Usage Components.utils.import("resource://gre/
modules/Downloads.jsm"); Task.spawn(function* () { // Fetch a file in the background. let download_1 = Downloads.fetch(UR...
...And 3 more matches
Index of archived content - Archive of obsolete content
omain Content Scripts Interacting with page scripts Loading Content Scripts Reddit Example port self Contributor's Guide Classes and Inheritance Content Processes Getting Started
Modules Private Properties Firefox Compatibility
Module structure of the SDK Porting the Library Detector Program ID SDK API Lifecycle SDK and XUL Comparison Testing the Add-on SDK Two Types of Scripts Working with Events ...
... Adding a Button to the Toolbar Annotator Creating annotations Displaying annotations Implementing the widget Overview Storing annotations Chrome Authority Creating Event Targets Creating Reusable
Modules Developing for Firefox Mobile Display a Popup Getting Started (jpm) Getting started (cfx) List Open Tabs Listen for Page Load Listening for Load and Unload Localization Logging Modifying Web Pages Based on URL Modifying the Page Hosted by a Tab...
... List Open Tabs Listen for Page Load Listening for Load and Unload Localization Logging Modifying Web Pages Based on URL Modifying the Page Hosted by a Tab Open a Web Page Troubleshooting Unit Testing Using XPCOM without chrome Using third-party
modules (jpm) Bootstrapped extensions Code snippets Alerts and Notifications Autocomplete Bookmarks Boxes Canvas code snippets Cookies Customizing the download progress bar Delayed Execution Dialogs and P...
...And 3 more matches
Source code directories overview - Archive of obsolete content
to changes in the Mozilla source tree. See also similar information in Mozilla Source Code Directory Structure, and also see the more detailed overview of how the parts of Gecko fit together. Introduction: Common Subdirectories A common naming scheme is used throughout the Mozilla source trees. At the top level is the name of the product (e.g. seamonkey). ...
...s the name of the product (e.g. seamonkey). At the second level is the name of the
module (e.g. the editor directory in seamonkey). The third level is where the common naming scheme usually takes over. Many third level directories contain the base, the public and the idl directories. Although not required, these common names are typically used for a common purpose. If files can be grouped into sub
modules, they are usually put in their own third level directory and given a unique name (e.g. txmgr in the editor directory in seamonkey). Beneath this third level directory, there may be fourth level base, public and idl directories. Thus, the scheme is recursive; it can apply to sub
modules, sub-sub
modules and so on. base contains the basic (core) functionality for the
module. Base contains all the...
...irectory and given a unique name (e.g. txmgr in the editor directory in seamonkey). Beneath this third level directory, there may be fourth level base, public and idl directories. Thus, the scheme is recursive; it can apply to sub
modules, sub-sub
modules and so on. base contains the basic (core) functionality for the
module. Base contains all the source code that cannot be categorized into a sub
module. build contains any special makefiles for building the particular
module. doc contains any documentation associated with this
module. idl contains the XPIDL (Cross Platform Interface Definition Language) interface files. Interfaces are used so functionality can be available to both Javascript scripts and C code with as little effort as possible. XPIDL files have their own mini-language and pro...
...And 3 more matches
The First Install Problem - Archive of obsolete content
his document proposes a meta-information model in the Win32 Registry similar to the one used by Microsoft's HKEY_CLASSES_ROOT\CLSID\ where a new ActiveX control (OCX) on the system presents its UUID as a registry key (identifying the ActiveX control) as well as information about where to find the OCX (e.g. under the InprocServer32 subkey). For Mozilla-based browsers, this system would be on a per-
module basis, and instead of a UUID, we'll use a URI nomenclature that gives us the desired uniqueness. This URI nomenclature is called a Plugin Identifier (PLID) and is described on a separate page. The following write-up describes how a plugin installer can write keys to the Win32 System Registry to enable Gecko-based browsers to discover the plugin at runtime. Write a key under HKEY_LOCAL_MACHINE\...
...e page. The following write-up describes how a plugin installer can write keys to the Win32 System Registry to enable Gecko-based browsers to discover the plugin at runtime. Write a key under HKEY_LOCAL_MACHINE\Software\MozillaPlugins\ which is a vendor-determined PLID. If the HKEY_LOCAL_MACHINE\Software\MozillaPlugins key doesn't exist, create it, and write the vendor-determined PLID for each
module that the vendor wishes to install. Example: A piece of software called MyApplication might create HKEY_LOCAL_MACHINE\Software\MozillaPlugins\@mycompany.com/MyApplication,version=5.0.1/ where the PLID is something the corporation that makes MyApplication (MyCompany Inc.) determines. Note that MyApplication consists of one DLL (which is an NPAPI plugin handling a given mimetype -- say application/x...
...ee are ignored by Firefox (bug 293062) but this is fixed in trunk builds (bug 293062). Add the following Values to the newly created key -- some are String Values (REG_SZ), and some are actually subkeys. String Values take the form StringValue=ValueData, and subkeys contain their own String Values and Value data. "Path" -- String Value -- this would be the absolute path to the plugin
module. ...
...And 3 more matches
Introduction to client-side frameworks - Learn web development
amework; it's a library for rendering UI components. React is used in combination with other libraries to make applications -- React and React Native enable developers to make mobile applications; React and ReactDOM enable them to make web applications, etc. Because React and ReactDOM are so often used together, React is colloquially understood as a JavaScript framework. As you read through this
module, we will be working with that colloquial understanding. React extends JavaScript with HTML-like syntax, known as JSX. Start learning React Why do frameworks exist? We've discussed the environment that inspired the creation of frameworks, but not really why developers felt the need to make them. Exploring the why requires first examining the challenges of software development. Consider a comm...
... to describe our list of tasks: <ul> <li v-for="task in tasks" v-bind:key="task.id"> <span>{{task.name}}</span> <button type="button">Delete</button> </li> </ul> That's it. This snippet reduces approximately thirty-two lines of code down to six lines. If the curly braces and v- attributes here are unfamiliar to you, that's okay; you'll learn about Vue-specific syntax later on in the
module. The thing to take away here is that this code looks like the UI it represents, whereas the vanilla JavaScript code does not. Thanks to Vue, we didn't have to write our own functions for building the UI; the framework will handle that for us in an optimized, efficient way. Our only role here was to describe to Vue what each item should look like. Developers who are familiar with Vue can join our...
... many unique elements in a user interface. Other things frameworks give us Let's look at some of the other advantages conferred upon us by frameworks. As we've alluded to before, the advantages of frameworks are achievable in vanilla JavaScript, but using a framework takes away all of the cognitive load of having to solve these problems yourself. Tooling Because each of the frameworks in this
module have a large, active community, each framework's ecosystem provides tooling that Improves the developer experience. These tools make it easy to add things like testing (to ensure that your application behaves as it should) or linting (to ensure that your code is error-free and stylistically consistent). Note: If you want to find out more details about web tooling concepts, have a read of our Cl...
...And 3 more matches
Framework main features - Learn web development
s article will explore the main features of "the big 4" frameworks, looking at how frameworks tend to work from a high level, and the differences between them. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages. Objective: To understand the main code features of frameworks. Domain-specific languages All of the frameworks discussed in this
module are powered by JavaScript, and all allow you to use domain-specific languages (DSLs) in order to build your applications. In particular, React has popularized the use of JSX for writing its components, while Ember utilizes Handlebars. Unlike HTML, these languages know how to read data variables, and this data can be used to streamline the process of writing your UI. Angular apps often make heavy...
... of count. We call this function on line 4, and set count to whatever its current value is, plus one. Styling components Each framework offers a way to define styles for your components -- or for the application as a whole. Although each framework's approach to defining the styles of a component is slightly different, all of them give you multiple ways to do so. With the addition of some helper
modules, you can style your framework apps in Sass or Less, or transpile your CSS stylesheets with PostCSS. Handling dependencies All major frameworks provide mechanisms for handling dependencies -- using components inside other components, sometimes with multiple hierarchy levels. As with other features, the exact mechanism will differ between frameworks, but the end result is the same. Components te...
...stylesheets with PostCSS. Handling dependencies All major frameworks provide mechanisms for handling dependencies -- using components inside other components, sometimes with multiple hierarchy levels. As with other features, the exact mechanism will differ between frameworks, but the end result is the same. Components tend to import components into other components using the standard JavaScript
module syntax, or at least something similar. Components in components One key benefit of component-based UI architecture is that components can be composed together. Just like you can write HTML tags inside each other to build a website, you can use components inside other components to build a web application. Each framework allows you to write components that utilize (and thus depend on) other comp...
...And 3 more matches
Mozilla accessibility architecture
This page is maintained by Aaron Leventhal and by the Mozilla Accessibility Community. Feedback and constructive suggestions are encouraged. 1. Intro This document is for people who wish to understand the architecture of Mozilla's accessibility API
module, which provides support for platform accessibility APIs. Accessibility APIs are used by 3rd party software like screen readers, screen magnifiers, and voice dictation software, which need information about document content and UI controls, as well as important events like changes of focus. Mozilla supports two accessibility APIs: Microsoft Active Accessibility (MSAA) on Windows and Accessibility Tool Kit (ATK) on Linux and Unix. We do not currently support the Carbon accessibility model for Apple's OS X. Please note, the documentation f...
...to provide information and support for pieces of text smaller than a text node (i.e. a word), and Mozilla supports ISimpleDOMText for this purpose. On ATK there is no such interface to get actual DOM information. Sun Microsystems, the maintainers of Mozilla's ATK support, believe the ATK is rich enough to provide everything the assistive technologies on their platform will need. Accessibility API
Module Directory Structure General rules for the directory structure: Interfaces, both internally-used cross-platform and toolkit-specific interfaces exist in accessible/public. The implementations for each kind of object (document, text, table, edit box, button, etc.) exist in accessible/src. Code and interfaces for specific toolkits should go in the appropriate directoy. Toolkit specific implem...
...o an integer, and then negate it. When the MSAA client calls back for the accessible node using AccessibleObjectFromEvent(), Windows asks our doc accessible for a child with that child ID. This is handled in in nsDocAccessibleWrap::get_accChild(), where we check for a negative child number and then use the accessibility cache to return the correct object. 5. Accessibility Cache The accessibility
module maintains a cache implemented as a series of hash tables -- one per document. The hash keys are the pointers to the DOM node for each accessible. In this way no accessible object should ever need to be created twice for any DOM node. Why We Need Accessibility Cache The accessibility cache has a number of purposes: Stability: because the Gecko DOM and layout teams want to avoid memory bloat whe...
...And 3 more matches
A bird's-eye view of the Mozilla framework
re 1. User Interface (UI) Widgets and Services The X Window System Toolkit defines the termwidget as a pre-defined object that encapsulates both the command actions and data associated with a graphical user interface (GUI) control. The various X Toolkit implementations provide a set of widgets for UI controls such as menus, command buttons, dialog boxes and scroll bars. The Mozilla XPToolkit
module provides a similar set of facilities for building cross-platform UI controls implemented as XML User Interface Language (XUL) packages. A XUL package consists of a XUL description of the UI widget Cascading Style Sheets customizing appearance JavaScript services implementing the UI behavior A package (also known as chrome) is really just a bundling of a set of UI widgets and associated ser...
...cation such as the browser may have one or more open documents accessible via DOM APIs. When an HTML, XML, SVG or other type of document is loaded, the NGLayout engine (also known as Gecko) parses the contents into a DOM tree, and handles the layout and rendering of the document pages. The NGLayout engine also parses XUL UI controls into a DOM tree and handles rendering of the UI. Core Services
Modules such as the NGLayout engine comprise the core application services available to other core
modules, and XUL packages Core application
modules are implemented as a set of one or more XPCOM (Cross-Platform COM) objects. XPCOM Object Model Before getting into the details of the UI example, it's helpful to have a basic understanding of the XPCOM object model. Mozilla architectural
modules ar...
...s. XPCOM Object Model Before getting into the details of the UI example, it's helpful to have a basic understanding of the XPCOM object model. Mozilla architectural
modules are comprised of groups of related XPCOM objects that provide services to and access services from each other through dynamically queryable interfaces. Object Model At a Glance Mozilla dynamically loads and integrates core
modules and XUL packages into the runtime environment on startup. Once loaded, a
module or package has full access to the XPCOM objects of all the other
modules in the runtime environment. The ability to dynamically integrate
modules and packages at startup is a powerful benefit of the object model, which defines a
module as a set of one or more XPCOM objects calledcomponents. These objects provide serv...
...And 3 more matches
Makefile - variables
NAMESPACES Exported package include directory: dist/include/${namespace} EXPORTS_${namespace} A list of exports/headers that should be copied into the exported namespace directory. EXTRA_COMPONENTS nsDefaultCLH.manifest, JavaScript XPCOMM files EXTRA_DSO_LIBS EXTRA_DSO_LDOPTS EXTRA_JS_
MODULES EXTRA_PP_COMPONENTS XPCOMM files to pre-process before installation. GARBAGE A "clean target" macro containing a list of files to remove. GARBAGE_DIRS A "clean target" macro containing a list of directories to remove. GLOBAL_DEPS A list of common dependencies (Makefile.in, autoconf.mk) that will force...
...ng a list of directories to remove. GLOBAL_DEPS A list of common dependencies (Makefile.in, autoconf.mk) that will force rebuilding. LIBOBJS HAVE_DTRACE Sun Microsystem's dynamic tracing environment is available. LOCAL_INCLUDES Allow use of MOZ_OBJDIR in .mozconfig with older GNU gcc on BeOS. ...
...ove. GLOBAL_DEPS A list of common dependencies (Makefile.in, autoconf.mk) that will force rebuilding. LIBOBJS HAVE_DTRACE Sun Microsystem's dynamic tracing environment is available. LOCAL_INCLUDES Allow use of MOZ_OBJDIR in .mozconfig with older GNU gcc on BeOS.
MODULE MODULE_NAME NO_DIST_INSTALL Inhibit generating and copying exports/install targets into $(MOZ_OBJDIR)/dist/install. .NS_PRINTING OBJS OBJ_SUFFIX Filename suffix to use when writing object files.
MODULE Instructs the build system where to install exported headers. SIMP...
...And 3 more matches
Task.jsm
Tasks are built upon generator functions and promises. The Task.spawn() function takes a generator function and starts running it as a task. Every time the task yields a promise, it waits until the promise is resolved. ...
... Tasks are built upon generator functions and promises. The Task.spawn() function takes a generator function and starts running it as a task. Every time the task yields a promise, it waits until the promise is resolved. ...
... Tasks are built upon generator functions and promises. The Task.spawn() function takes a generator function and starts running it as a task. Every time the task yields a promise, it waits until the promise is resolved. ...
...And 3 more matches
Logging
This chapter describes the global functions you use to perform logging. NSPR provides a set of logging functions that conditionally write printf() style strings to the console or to a log file. NSPR uses this facility itself for its own development debugging purposes. You can select events to be logged by
module or level. A
module is a user-defined class of log events. A level is a numeric value that indicates the seriousness of the event to be logged. You can combine
module and level criteria to get highly selective logging. NSPR also provides "assert"-style macros and functions to aid in application debugging. Conditional Compilation and Execution Log Types and Variables Logging Functions and Macros Use Example Conditional Compilation and Execution NSPR's logging facility is condit...
...The compile time #define values DEBUG or FORCE_PR_LOG enable NSPR logging for application programs. To enable NSPR logging and/or the debugging aids in your application, compile using the NSPR debug build headers and runtime. Set one of the compile-time defines when you build your application. Execution-time control of NSPR's logging uses two environment variables. These variables control which
modules and levels are logged as well as the file name of the log file. By default, no logging is enabled at execution time. Log Types and Variables Two types supporting NSPR logging are exposed in the API: PRLog
ModuleInfo PRLog
ModuleLevel Two environment variables control the behavior of logging at execution time: NSPR_LOG_
MODULES NSPR_LOG_FILE Logging Functions and Macros The functions ...
...ile name of the log file. By default, no logging is enabled at execution time. Log Types and Variables Two types supporting NSPR logging are exposed in the API: PRLog
ModuleInfo PRLog
ModuleLevel Two environment variables control the behavior of logging at execution time: NSPR_LOG_
MODULES NSPR_LOG_FILE Logging Functions and Macros The functions and macros for logging are: PR_NewLog
Module PR_SetLogFile PR_SetLogBuffering PR_LogPrint PR_LogFlush PR_LOG_TEST PR_LOG PR_Assert PR_ASSERT PR_STATIC_ASSERT (new in NSPR 4.6.6XXX this hasn't been released yet; the number is a logical guess) PR_NOT_REACHED Use Example The following sample code fragment demonstrates use of the logging and debugging aids. Compile the program with DEBUG defined. Before running the compiled pro...
...And 3 more matches
NSS tools : certutil
password, generate new public and private key pairs, display the contents of the key database, or delete key pairs within the key database. Certificate issuance, part of the key and certificate management process, requires that keys and certificates be created in the key database. This document discusses certificate and key database management. For information on the security
module database management, see the modutil manpage. Options and Arguments Running certutil always requires one and only one command option to specify the type of certificate operation. Each option may take arguments, anywhere from none to multiple arguments. The command option -H will list all the command options available and their relevant arguments. Command Options ...
...hority (CA) for processing into a finished certificate. Output defaults to standard out unless you use -o output-file argument. Use the -a argument to specify ASCII output. -S Create an individual certificate and add it to a certificate database. -T Reset the key database or token. -U List all available
modules or print a single named
module. -V Check the validity of a certificate and its attributes. -W Change the password to a key database. --merge Merge two databases into one. --upgrade-merge Upgrade an old database and merge it into a new database. This is used to migrate legacy NSS databases (cert8.
...Usage and Examples Most of the command options in the examples listed here have more arguments available. The arguments included in these examples are the most common ones or are used to illustrate a specific scenario. Use the -H option to show the complete list of arguments for each command option. Creating New Security Databases Certificates, keys, and security
modules related to managing certificates are stored in three related databases: * cert8.db or cert9.db * key3.db or key4.db * secmod.db or pkcs11.txt These databases must be created before certificates or keys can be generated. certutil -N -d [sql:]directory Creating a Certificate Request A certificate request contains most or all of the information that ...
...And 3 more matches
sslerr.html
SEC_ERROR_EXTENSION_NOT_FOUND -8157 Certificate extension not found. SEC_ERROR_CA_CERT_INVALID -8156 Issuer certificate is invalid. SEC_ERROR_PATH_LEN_CONSTRAINT_INVALID -8155 Certificate path length constraint is invalid. SEC_ERROR_CERT_USAGES_INVALID -8154 Certificate usages field is invalid. SEC_INTERNAL_ONLY -8153 Internal-only
module. SEC_ERROR_INVALID_KEY -8152 The key does not support the requested operation. SEC_ERROR_UNKNOWN_CRITICAL_EXTENSION -8151 Certificate contains unknown critical extension. SEC_ERROR_OLD_CRL -8150 New CRL is not later than the current one. SEC_ERROR_NO_EMAIL_CERT -8149 Not encrypted or signed: you do not yet have an email certificate. ...
...ate has expired. SEC_ERROR_KRL_BAD_SIGNATURE -8132 The KRL for this site's certificate has an invalid signature. SEC_ERROR_REVOKED_KEY -8131 The key for this site's certificate has been revoked. SEC_ERROR_KRL_INVALID -8130 New KRL has an invalid format. SEC_ERROR_NEED_RANDOM -8129 Security library: need random data. SEC_ERROR_NO_
MODULE -8128 Security library: no security
module can perform the requested operation. SEC_ERROR_NO_TOKEN -8127 The security card or token does not exist, needs to be initialized, or has been removed. SEC_ERROR_READ_ONLY -8126 Security library: read-only database. SEC_ERROR_NO_SLOT_SELECTED -8125 No slot or token was selected. SEC_ERROR_CERT_N...
...TRY_OLD_PASSWORD -8090 Old password entered incorrectly. SEC_ERROR_BAD_NICKNAME -8089 Certificate nickname already in use. SEC_ERROR_NOT_FORTEZZA_ISSUER -8088 Peer FORTEZZA chain has a non-FORTEZZA Certificate. SEC_ERROR_CANNOT_MOVE_SENSITIVE_KEY -8087 "A sensitive key cannot be moved to the slot where it is needed." SEC_ERROR_JS_INVALID_
MODULE_NAME -8086 Invalid
module name. SEC_ERROR_JS_INVALID_DLL -8085 Invalid
module path/filename. SEC_ERROR_JS_ADD_MOD_FAILURE -8084 Unable to add
module. SEC_ERROR_JS_DEL_MOD_FAILURE -8083 Unable to delete
module. SEC_ERROR_OLD_KRL -8082 New KRL is not later than the current one. SEC_ERROR_CKL_CONFLICT -8081 New CKL has ...
...And 3 more matches
sslfnc.html
s up configuration files and performs other tasks required to run Network Security Services. Database files are opened read-only. Syntax #include "nss.h" SECStatus NSS_Init(char *configdir); Parameter This function has the following parameter: configdir A pointer to a string containing the pathname of the directory where the certificate, key, and security
module databases reside. Returns The function returns one of these values: If successful, SECSuccess. If unsuccessful, SECFailure. Use PR_GetError to retrieve the error code. Description NSS_Init opens the certN.db, keyN.db, and secmod.db files (whereN is a numeric digit) in the specified directory. NSS_Init isnot idempotent, so call it only once. NSS_Init opens the datab...
...run Network Security Services. Unlike NSS_Init, NSS_InitReadWrite provides both read and write access to database files. Syntax #include "nss.h" SECStatus NSS_InitReadWrite(char *configdir); Parameter This function has the following parameter: configdir A pointer to a string containing the pathname of the directory where the certificate, key, and security
module databases reside. Returns The function returns one of these values: If successful, SECSuccess. If unsuccessful, SECFailure. Use PR_GetError to retrieve the error code. Description NSS_InitReadWrite opens the certN.db, keyN.db, and secmod.db files (whereN is a numeric digit) with both read and write permission in the specified directory. NSS_InitReadWrite isnot idempot...
...it(char *reserved); Parameter This function has the following parameter: reserved Should be NULL.. Returns The function returns one of these values: If successful, SECSuccess. If unsuccessful, SECFailure. Use PR_GetError to retrieve the error code. Description NSS_NoDB_Init opens only the temporary database and the internal PKCS #112
module. Unlike NSS_Init, NSS_NoDB_Init allows applications that do not have access to storage for databases to run raw crypto, hashing, and certificate functions. NSS_NoDB_Init isnot idempotent, so call it only once. Before calling NSS_NoDB_Init, your program must call PR_Init. The policy flags for all cipher suites are turned off by default, disallowing all cipher suites. Therefore, an applicati...
...And 3 more matches
certutil
ew public and private key pairs, display the contents of the key database, or delete key pairs within the key database. The key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database. This document discusses certificate and key database management. For information security
module database management, see the modutil manpages. Options and Arguments Running certutil always requires one (and only one) option to specify the type of certificate operation. Each option may take arguments, anywhere from none to multiple arguments. Run the command option and -H to see the arguments available for each command option. Options Options specify an action and ar...
...ertificate Authority (CA) for processing into a finished certificate. Output defaults to standard out unless you use -o output-file argument. Use the -a argument to specify ASCII output. -S Create an individual certificate and add it to a certificate database. -T Reset the key database or token. -U List all available
modules or print a single named
module. -V Check the validity of a certificate and its attributes. -W Change the password to a key database. --merge Merge a source database into the target database. This is used to merge legacy NSS databases (cert8.db and key3.db) into the newer SQLite databases (cert9.db and key4.db). --upgrade-m...
... upgraded. Usage and Examples Most of the command options in the examples listed here have more arguments available. The arguments included in these examples are the most common ones or are used to illustrate a specific scenario. Use the -H option to show the complete list of arguments for each command option. Creating New Security Databases Certificates, keys, and security
modules related to managing certificates are stored in three related databases: o cert8.db or cert9.db o key3.db or key4.db o secmod.db or pkcs11.txt These databases must be created before certificates or keys can be generated. certutil -N -d [sql:]directory Creating a Certificate Request A certificate request contains most or all of the information that is used ...
...And 3 more matches
Shell global objects
implementation detail). groupOf(obj) Get the group of obj (an implementation detail). unwrappedObjectsHaveSameShape(obj1, obj2) Returns true iff obj1 and obj2 have the same shape, false otherwise. Both objects are unwrapped first, so this can be used on objects from different globals. sleep(dt) Sleep for dt seconds. compile(code) Compiles a string to bytecode, potentially throwing. parse
Module(code) Parses source text as a
module and returns a
Module object. set
ModuleResolveHook(function(
module, specifier) {}) Set the HostResolveImported
Module hook to function. This hook is used to look up a previously loaded
module object. It should be implemented by the
module loader. get
ModuleLoadPath() Return any --
module-load-path argument passed to the shell. Used by the
module loader. pars...
...he source to any DOM element. elementAttributeName if present and not undefined, the name of property of element that holds this code. This is what Debugger.Source.prototype.elementAttributeName returns. runOffThreadScript() Wait for off-thread compilation to complete. If an error occurred, throw the appropriate exception; otherwise, run the script and return its value. offThreadCompile
Module(code) Compile code on a helper thread. To wait for the compilation to finish and get the
module object, call finishOffThread
Module. finishOffThread
Module() Wait for off-thread compilation to complete. If an error occurred, throw the appropriate exception; otherwise, return the
module object timeout([seconds], [func]) Get/Set the limit in seconds for the execution time for the current context...
...prototype semantics. Note: This is not fuzzing safe because it can be used to construct deeply nested wrapper chains that cannot exist in the wild. trackedOpts(fun) Returns an object describing the tracked optimizations of fun, if any. If fun is not a scripted function or has not been compiled by Ion, null is returned. dumpScopeChain(obj) Prints the scope chain of an interpreted function or a
module. crash([message]) Crashes the process with a MOZ_CRASH. setARMHwCapFlags("flag1,flag2 flag3") On non-ARM, no-op. On ARM, set the hardware capabilities. The list of flags is available by calling this function with help as the flag's name wasmLoop(filename, imports) Performs an AFL-style persistent loop reading data from the given file and passing it to thewasmEval function together with the ...
...And 3 more matches
XPCOM changes in Gecko 2.0
nly when the XPCOM component manager needs to create a component. chrome.manifest: # The {classID} here must match the classID in mycomponent.js component {e6b866e3-41b2-4f05-a4d2-3d4bde0f7ef8} components/mycomponent.js contract @foobar/mycomponent;1 {e6b866e3-41b2-4f05-a4d2-3d4bde0f7ef8} category profile-after-change MyComponent @foobar/mycomponent;1 The JavaScript code no longer exports a NSGet
Module() function. It now must export a NSGetFactory() function, which accepts a class ID (CID) as a parameter. For example, in your component's JavaScript code : Components.utils.import("resource://gre/
modules/XPCOMUtils.jsm"); function myComponent() { } myComponent.prototype = { // this must match whatever is in chrome.manifest! classID: Components.ID("{e6b866e3-41b2-4f05-a4d2-3d4bde0f7ef8}"), ...
....classID which is used to create it. const NSGetFactory = XPCOMUtils.generateNSGetFactory([myComponent]); A component may implement backwards compatibility with Gecko 1.9.2 by dynamically detecting which symbols are exported by XPCOMUtils.jsm and exporting the correct function: /** * XPCOMUtils.generateNSGetFactory was introduced in Mozilla 2 (Firefox 4, SeaMonkey 2.1). ...
...mically detecting which symbols are exported by XPCOMUtils.jsm and exporting the correct function: /** * XPCOMUtils.generateNSGetFactory was introduced in Mozilla 2 (Firefox 4, SeaMonkey 2.1). * XPCOMUtils.generateNSGet
Module was introduced in Mozilla 1.9 (Firefox 3.0). */ if (XPCOMUtils.generateNSGetFactory) var NSGetFactory = XPCOMUtils.generateNSGetFactory([myComponent]); else var NSGet
Module = XPCOMUtils.generateNSGet
Module([myComponent]); Binary components Binary components must be listed explicitly in a manifest using a binary-component directive: binary-component components/mycomponent.dll C++ in the component must be changed: a binary component no longer exports a NSGet
Module() function. Instead, it exports an NS
Module data symbol which points to a mozilla::
Module structure. For...
...And 3 more matches
Mailnews and Mail code review requirements
ui-review on an attachment, set ui-review to '?' and enter :bwinton (for Blake Winton) as the requestee. Mike Conley (:mconley) can also provide useful feedback, but Blake is the current ultimate decider for UI choices in Thunderbird. Rules for all patches affecting mailnews/ and mail/ Wherever possible, significant patches in a certain area should be reviewed by one of the listed sub-
module owner/reviewers. Peers may grant review in any area covered by mailnews/, provided they feel confident in their knowledge of the code being changed. Sub-
module peers may only grant review in the listed sub-
module. If a reviewer feels that the patch would benefit from additional reviews, they should request a second review from an appropriate person. Super-review is required in certain situati...
...See the full super-review policy for more details. Unit test rules Patches are required to include automated tests which are run during make check or via MozMill in Thunderbird, but submitters are encouraged to request exceptions from reviewers in cases where the cost is believed to outweigh the benefit. ...
...nt orange test failure. The patch is a change exclusively to test logic. The patch has identified a likely problem and fixes it; no commenting out tests/changing what a test tests/adding huge timeouts. ...
...And 3 more matches
<color> - CSS: Cascading Style Sheets
red #ff0000 purple #800080 fuchsia #ff00ff green #008000 lime #00ff00 olive #808000 yellow #ffff00 navy #000080 blue #0000ff teal #008080 aqua #00ffff CSS Level 2 (Revision 1) orange #ffa500 CSS Color
Module Level 3 aliceblue #f0f8ff antiquewhite #faebd7 aquamarine #7fffd4 azure #f0ffff beige #f5f5dc bisque #ffe4c4 blanchedalmond #ffebcd blueviolet #8a2be2 brown #a52a2a burlywood #deb887 cadetblue #5f9ea0 chartreuse #7fff...
...This makes the background behind the colored item completely visible. Technically, transparent is a shortcut for rgba(0,0,0,0). Compatibility note: To prevent unexpected behavior, such as in a <gradient>, the current CSS spec states that transparent should be calcula...
...hue). Syntax HSL colors are expressed through the functional hsl() and hsla() notations. Note: As of CSS Colors Level 4, hsla() is an alias for hsl(). In browsers that implement the Level 4 standard, they accept the same parameters and behave the same way. Functional notation: hsl[a](H, S, L[, A]) H (hue) is an <angle> of the color circle given in degs, rads, grads, or turns in CSS Color
Module Level 4. When written as a unitless <number>, it is interpreted as degrees, as specified in CSS Color
Module Level 3. By definition, red=0deg=360deg, with the other colors spread around the circle, so green=120deg, blue=240deg, etc. As an <angle>, it implicitly wraps around such that -120deg=240deg, 480deg=120deg, -1turn=1turn, etc. S (saturation) and L (lightness) are percentages. 100% saturati...
...And 3 more matches
CSS: Cascading Style Sheets
zed across Web browsers according to the W3C specification. Previously development of various parts of CSS specification was done synchronously, which allowed versioning of the latest recommendation. You might have heard about CSS1, CSS2.1, CSS3. However, CSS4 has never become an official version. From CSS3, the scope of the specification increased significantly and the progress on different CSS
modules started to differ so much, that it became more effective to develop and release recommendations separately per
module. Instead of versioning the CSS specification, W3C now periodically takes a snapshot of the latest stable state of the CSS specification. CSS Introduction If you're new to web development, be sure to read our CSS basics article to learn what CSS is and how to use it. CSS...
...el to proficiency, covering all the fundamentals. CSS Reference Our exhaustive CSS reference for seasoned Web developers describes every property and concept of CSS. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. ...
...oal. Get started Tutorials Our CSS Learning Area features multiple
modules that teach CSS from the ground up -- no previous knowledge required. CSS first steps CSS (Cascading Style Sheets) is used to style and layout web pages -- for example, to alter the font, color, size, and spacing of your content, split it into multiple columns, or add animations and other decorative features. This
module provides a gentle beginning to your path towards CSS mastery with the basics of how it works, what the syntax looks like, and how you can start using it to add styling to HTML. CSS building blocks This
module carries on where CSS first steps left off -- now you've gained familiarity with the language and its syntax, and got some basic experience with using it, its time to dive a bit deeper. T...
...And 3 more matches
<script>: The Script element - HTML: Hypertext Markup Language
nt. Implicit ARIA role No corresponding role Permitted ARIA roles No role permitted DOM interface HTMLScriptElement Attributes This element includes the global attributes. asyncHTML5 For classic scripts, if the async attribute is present, then the classic script will be fetched in parallel to parsing and evaluated as soon as it is available. For
module scripts, if the async attribute is present then the scripts and all their dependencies will be executed in the defer queue, therefore they will get fetched in parallel to parsing and evaluated as soon as they are available. This attribute allows the elimination of parser-blocking JavaScript where the browser would have to load and evaluate scripts before continuing to parse. defer has a similar...
...t to be executed after the document has been parsed, but before firing DOMContentLoaded. Scripts with the defer attribute will prevent the DOMContentLoaded event from firing until the script has loaded and finished evaluating. This attribute must not be used if the src attribute is absent (i.e. for inline scripts), in this case it would have no effect. The defer attribute has no effect on
module scripts -- they defer by default. Scripts with the defer attribute will execute in the order in which they appear in the document. This attribute allows the elimination of parser-blocking JavaScript where the browser would have to load and evaluate scripts before continuing to parse. async has a similar effect in this case. integrity This attribute contains inline metadata that a user a...
...ument. This attribute allows the elimination of parser-blocking JavaScript where the browser would have to load and evaluate scripts before continuing to parse. async has a similar effect in this case. integrity This attribute contains inline metadata that a user agent can use to verify that a fetched resource has been delivered free of unexpected manipulation. See Subresource Integrity. no
module This Boolean attribute is set to indicate that the script should not be executed in browsers that support ES2015
modules -- in effect, this can be used to serve fallback scripts to older browsers that do not support modular JavaScript code. nonce A cryptographic nonce (number used once) to whitelist scripts in a script-src Content-Security-Policy. The server must generate a unique nonce value ...
...And 3 more matches
WebAssembly.compile() - JavaScript
Exceptions If bufferSource is not a typed array, a TypeError is thrown. ...
... Exceptions If bufferSource is not a typed array, a TypeError is thrown. ...
... Exceptions If bufferSource is not a typed array, a TypeError is thrown. ...
...And 3 more matches
WebAssembly - JavaScript
rors that occur in WebAssembly via the WebAssembly.CompileError()/WebAssembly.LinkError()/WebAssembly.RuntimeError() constructors. Constructor properties WebAssembly.CompileError() Indicates an error during WebAssembly decoding or validation. WebAssembly.Global() Represents a global variable instance, accessible from both JavaScript and importable/exportable across one or more WebAssembly.
Module instances. This allows dynamic linking of multiple
modules. WebAssembly.Instance() Is a stateful, executable instance of a WebAssembly.
Module WebAssembly.LinkError() Indicates an error during
module instantiation (besides traps from the start function). WebAssembly.Memory() An object whose buffer property is a resizable ArrayBuffer that holds the raw bytes of memory accessed by a WebAssembl...
... WebAssembly.RuntimeError() Error type that is thrown whenever WebAssembly specifies a trap. ...
...ciently shared with Workers, and instantiated multiple times. WebAssembly.RuntimeError() Error type that is thrown whenever WebAssembly specifies a trap. WebAssembly.Table() An array-like structure representing a WebAssembly Table, which stores function references. ...
...And 3 more matches
page-mod - Archive of obsolete content
</h1>";' }); You can supply the content script(s) in one of two ways: as a string literal, or an array of string literals, assigned to the contentScript option, as above as separate files supplied in your add-on's "data" directory. ...
... use this icon: . Private Windows If your add-on has not opted into private browsing, then your page-mods will not attach content scripts to documents loaded into private windows, even if their URLs match the pattern you have specified. To learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing
module. Globals Constructors PageMod(options) Creates a page-mod. Parameters options : object Required options: Name: include Type: string, RegExp, or array of (String or RegExp) A match pattern string or an array of match pattern strings. These define the documents to which the page-mod applies. At least one match pattern must be supplied. You can specify a URL exactly: var pageMod = requ...
...d multiline disabled. var pageMod = require("sdk/page-mod"); pageMod.PageMod({ include: /.*developer.*/, contentScript: 'window.alert("Matched!");' }); To specify multiple patterns, pass an array of match patterns: var pageMod = require("sdk/page-mod"); pageMod.PageMod({ include: ["*.foo.org", "*.bar.com"], contentScript: 'window.alert("Matched!");' }); See the match-pattern
module for a detailed description of match pattern syntax. Optional options: Name: contentScriptFile Type: string,array This option specifies one or more content scripts to attach to targeted documents. Each script is supplied as a separate file under your add-on's "data" directory, and is specified by a URL typically constructed using the url() method of the self
module's data object. var data = ...
...And 2 more matches
private-browsing - Archive of obsolete content
they do this, any existing non-private windows are kept open, so the user will typically have both private and non-private windows open at the same time. ...
...ows open at the same time. ...
...on file: "permissions": {"private-browsing": true} If an add-on has not opted in, then the high-level SDK
modules will not expose private windows, or objects (such as tabs) that are associated with private windows: the windows
module will not list any private browser windows, generate any events for private browser windows, or let the add-on open any private browser windows the tabs
module will not list any tabs that belong to private browser windows, and the add-on won't receive any events for such tabs any ui components will not be displayed in private browser windows any menus or menu items created using the context-menu will not be shown in context menus that belong to private browser windows the page-mod
module will not attach content scripts to documents bel...
...And 2 more matches
package.json - Archive of obsolete content
first time you run jpm init. It looks like this (assuming the add-on's directory is "my-addon"): { "name": "my-addon", "title": "my-addon", "id": "jid1-1FERGV45e4f4f@jetpack", "description": "a basic add-on", "author": "", "license": "MPL-2.0", "version": "0.1" } If you are using the new jpm tool, you can easily access manifest data from package.json by requiring it like any other
module: var title = require("./package.json").title; Key reference package.json may contain the following keys: author The name of the package's original author; this could be the name of a person or a company. Defaults to an empty string. It may include a optional URL in parentheses and an email address in angle brackets. This value will be used as the add-on's em:creator elem...
...icon will be used. This value will be used as the add-on's em:icon64URL element in its install.rdf. The icon may be up to 64x64 pixels in size. id A globally unique identifier for the add-on. This value will be used as the add-on's em:id element in its install.rdf. See the Program ID documentation. lib String representing the top-level
module directory provided in this add-on. Defaults to "lib". Note: This is deprecated along with cfx and is not available when using jpm. license The name of the license under which the add-on is distributed, with an optional URL in parentheses. Defaults to "MPL-2.0". Note: It is recommended that you use an SPDX license ID. locales ...
... locales An object holding JSON objects referenced by a locale name that use the following keys: title, description and homepage. These JSON objects will be used to localizations for the add-on's meta data shown within the Add-ons Manager. See the documentation for how to localize the add-on's meta data. main A string representing the name of a program
module that is located in one of the top-level
module directories specified by lib. Defaults to "index.js". name The add-on's name. This name cannot contain spaces or periods, and defaults to the name of the parent directory. When the add-on is built as an XPI, if the fullName and title keys are not present, name is used as the add-on's em:name element in its install.rdf. ...
...And 2 more matches
Getting started (cfx) - Archive of obsolete content
g icon-64.png Back at the command prompt, type: cfx run This is the SDK command to run a new instance of Firefox with your add-on installed. When Firefox launches, in the top-right corner of the browser you'll see an icon with the Firefox logo. Click the icon, and a new tab will open with https://www.mozilla.org/ loaded into it. That's all this add-on does. It uses two SDK
modules: the action button
module, which enables you to add buttons to the browser, and the tabs
module, which enables you to perform basic operations with tabs. In this case, we've created a button whose icon is the Firefox icon, and added a click handler that loads the Mozilla home page in a new tab. Try editing this file. For example, we could change the page that gets loaded: var buttons = require...
... add-on template cfx run to run a new instance of Firefox with the add-on installed, so we can try it out cfx xpi to package the add-on into an XPI file for distribution These are the three main commands you'll use when developing SDK add-ons. There's comprehensive reference documentation covering all the commands you can use and all the options they take. The add-on code itself uses two SDK
modules, action button and tabs. There's reference documentation for all the high-level and low-level APIs in the SDK. What's next? To get a feel for some of the things you can do with the SDK APIs, try working through some of the tutorials. Advanced techniques Overriding the built-in
modules The SDK
modules you use to implement your add-on are built into Firefox. When you run or package an add-on ...
... the high-level and low-level APIs in the SDK. What's next? To get a feel for some of the things you can do with the SDK APIs, try working through some of the tutorials. Advanced techniques Overriding the built-in
modules The SDK
modules you use to implement your add-on are built into Firefox. When you run or package an add-on using cfx run or cfx xpi, the add-on will use the versions of the
modules in the version of Firefox that hosts it. As an add-on developer, this is usually what you want. But if you're developing the SDK
modules themselves, of course, it isn't. In this case it's assumed that you have checked out the SDK from its GitHub repo and will have run the bin/activate script from the root of your checkout. Then when you invoke cfx run or cfx xpi, you pass the "-o" option: cfx...
...And 2 more matches
Localization - Archive of obsolete content
riaMozHint Using localized strings in JavaScript To reference localized strings from your main add-on code, you do this: var _ = require("sdk/l10n").get; console.log(_("hello_id")); Assigning to "_" in particular is not required, but is a convention from the gettext tools and will make it possible to work with existing tools that expect "_" to indicate localizable strings. ...
...Different languages have different rules for the formation of plurals. ...
...Different languages have different rules for the formation of plurals. ...
...And 2 more matches
Miscellaneous - Archive of obsolete content
" on Mac OS X. ...
...llow those steps: First, put the certificates you want to ship into the content/certs folder of your application. Then create a XPCOM service that adds the certificates inside that directory to the certs database on application startup. ...
...See How to Build an XPCOM Component in Javascript for details. Now are your certificates installed on every application startup. Unfortunately that seems to be the only working solution, apart from modifying the Mozilla source code and r...
...And 2 more matches
Search Extension Tutorial (Draft) - Archive of obsolete content
hey have not been changed in the meantime. While changes to default preference values will not persist across sessions, restartless extensions must nevertheless restore them for the balance of the session after they have been disabled. The following example bootstrap.js file illustrates the method: const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; // Import the Services
module. Cu.import("resource://gre/
modules/Services.jsm"); // Keep track of whether this is the first run. var firstRun = false; // Get the root user preference branch. var userPrefs = Services.prefs.getBranch(""); // Get the root default preference branch. var defaultPrefs = Services.prefs.getDefaultBranch(""); // Save the original values. var savedPrefs = {} // Change the default value of the prefe...
...riptions containing suggestion URLs or separate keyword search URLs. Note: Example uninstall code is only provided for restartless extensions. A separate tutorial exists for running code at uninstall in non-restartless extensions. An example bootstrap.js file illustrating the simple method follows: const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; // Import the Services
module. ...
...s or separate keyword search URLs. Note: Example uninstall code is only provided for restartless extensions. A separate tutorial exists for running code at uninstall in non-restartless extensions. An example bootstrap.js file illustrating the simple method follows: const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; // Import the Services
module. Cu.import("resource://gre/
modules/Services.jsm"); // The details of the engine to add const ENGINE_DETAILS = { name: "Example Engine", iconURL: "data:image/png;base64,...", alias: "example-engine", description: "An example search engine", method: "GET", // The HTTP request method url: "https://www.example.com/?q=_searchTerms_" }; // Keep track of whether this is the first run. var firstRun = false; // D...
...And 2 more matches
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
aultPref("mail.accountmanager.defaultaccount", "account1" ); defaultPref("mail.smtp.defaultserver", "smtp1" ); defaultPref("mail.smtpservers", "smtp1" ); // Close the try, and call the catch() } catch(e) { displayError("lockedPref", e); } Test AutoConfig Debug To check that our AutoConfig works fine, we just set to env variable to check the read of thunderbird.cfg file: $ export NSPR_LOG_
MODULES=MCD:5 $ export NSPR_LOG_FILE=/tmp/thunderbird-log.txt When Thunderbird has started, you should read: $ cat /tmp/thunderbird-log.txt -1209403040[808a788]: general.config.filename = thunderbird.cfg -1209403040[808a788]: evaluating .cfg file thunderbird.cfg with obscureValue 0 Clean Then, to be sure to start with a fresh Thunderbird account, don't do this if you already have one and want to...
...to appear , it's very useful in debuging context ... The displayError() function does not work properly in Thunderbird 3.1: See https://bugzilla.mozilla.org/show_bu...?id=502597#c34 A usable workaround is placing the following code at the top of your autoconfig script: // Enable logging. pref("MCD.logging.console", "All"); pref("MCD.logging.dump", "All"); Components.utils.import("resource:///
modules/gloda/log4moz.js"); var log = Log4Moz.getConfiguredLogger("MCD"); // Enable alerts. var alerts = Components.classes["@mozilla.org/alerts-service;1"] .getService(Components.interfaces.nsIAlertsService); // displayError() is broken. Let's override it. function displayError(title, msg) { log.debug(title + ": " + msg); alerts.showAlertNotification("chrome://branding/content/ic...
...2 10:45 components drwxr-xr-x 6 root root 4096 juil. 1 10:24 defaults drwxr-xr-x 2 root root 4096 juil. 2 10:45 dictionaries drwxr-xr-x 3 root root 4096 juil. 1 10:24 extensions drwxr-xr-x 2 root root 4096 juil. 2 10:27 greprefs drwxr-xr-x 2 root root 4096 juil. 1 10:18 icons drwxr-xr-x 3 root root 4096 juil. 2 10:45 isp drwxr-xr-x 4 root root 4096 juil. 2 10:45
modules drwxr-xr-x 2 root root 4096 juil. 2 10:45 OutTestData drwxr-xr-x 6 root root 4096 juil. 2 10:45 res [root@b008-02 commsrc]# ls -l /usr/local/thunderbirdDebug/bin/ total 4 lrwxrwxrwx 1 root root 64 juil. 2 10:45 thunderbird -> /usr/local/thunderbirdDebugLibs/thunderbird-3.0b3pre/thunderbird [root@b008-02 thunderbirdDebugLibs]# find /usr/local/thunderbirdDebugLibs/ -name prefcalls.js /...
...And 2 more matches
JavaScript Client API - Archive of obsolete content
/Sync for their contact information. To create a custom Sync engine to synchronize a new data you, you'll need to define an engine object that extends the base SyncEngine object. This involves writing types that extend the Store, Tracker, and Record types as well. It will be very helpful to look at an existing sync engine for guidance. Have a look at one of the following files: services/sync/
modules/engines/bookmarks.js services/sync/
modules/engines/history.js Setting up a JS
Module The code for your custom sync engine should live in a JS
module. First off we're going to import the files mentioned above at the top the file. We're also going to import ''util.js'' as it contains many useful helpers. const Cu = Components.utils; Cu.import("resource://services-sync/engines.js"); Cu.import(...
...ou are syncing -- a single bookmark, history URL, password or form data entry. For some sync engines, it makes sense to bundle all data into one record. The tabs and preferences engines work that way. For other engines, it makes sense to have multiple records per sync. It all depends on the data model. If in doubt, consult the Sync developers. The base record objects are defined in services/sync/
modules/record.js. There's a base Record object, which defines the basic record API. But, you want to use a derived class, CryptoWrapper, which seamlessly encrypts and decrypts records on the client. This makes your synchronized data more secure and unreadable by the server operators. All you have to do is write an object that extends CryptoWrapper and maintains a property called cleartext. cleartext mu...
... The store must also make updates to the underlying data itself based on incoming Record objects. The majority of the code you write for syncing a new data type will most likely be in the Store implementation. Each Record that the Store keeps track of must be identified by a unique ID (unique a...
...And 2 more matches
Why RSS Slash is Popular - Counting Your Comments - Archive of obsolete content
y and culture, it's responsible for the "First Post!" phenomena, the Anonymous Coward, and the recognition of the Slashdot Effect, a phenomena that adorns its name. One of the quirks of Slashdot is that it includes a comments count, a humorous department, a hit parade, and a section with every blog post. ...
... recognition of the Slashdot Effect, a phenomena that adorns its name. One of the quirks of Slashdot is that it includes a comments count, a humorous department, a hit parade, and a section with every blog post. RSS does not have any facilites for including this information in an <item>, so the RSS Slash
Module exists to fill in this gap. ...
...ludes a comments count, a humorous department, a hit parade, and a section with every blog post. RSS does not have any facilites for including this information in an <item>, so the RSS Slash
Module exists to fill in this gap. ...
...And 2 more matches
Introduction to CSS layout - Learn web development
Prerequisites: The basics of HTML (study Introduction to HTML), and an idea of How CSS works (study Introduction to CSS.) Objective: To give you an overview of CSS page layout techniques. Each technique can be learned in greater detail in subsequent tutorials. ...
...chnique can be learned in greater detail in subsequent tutorials. CSS page layout techniques allow us to take elements contained in a web page and control where they are positioned relative to their default position in normal layout flow, the other elements around them, their parent container, or the main viewport/window. The page layout techniques we'll be covering in more detail in this
module are Normal flow The display property Flexbox Grid Floats Positioning Table layout Multiple-column layout Each technique has its uses, advantages, and disadvantages, and no technique is designed to be used in isolation. By understanding what each method is designed for you will be in a good place to understand which is the best layout tool for each task. Normal flow Normal flow is ho...
... presentation by turning an item from block to inline and vice versa, there are some bigger layout methods that start out as a value of display. However, when using these, you will generally need to invoke additional properties. The two values most important for our purposes when discussing layout are display: flex and display: grid. Flexbox Flexbox is the short name for the Flexible Box Layout
Module, designed to make it easy for us to lay things out in one dimension -- either as a row or as a column. To use flexbox, you apply display: flex to the parent element of the elements you want to lay out; all its direct children then become flex items. We can see this in a simple example. The HTML markup below gives us a containing element, with a class of wrapper, inside which are three <div> elem...
...And 2 more matches
Fundamental text and font styling - Learn web development
f web safe fonts available on Windows and macOS operating systems, which can help you make your decision about what you consider safe for your usage. Note: There is a way to download a custom font along with a webpage, to allow you to customize your font usage in any way you want: web fonts. This is a little bit more complex, and we will be discussing this in a separate article later on in the
module. Default fonts CSS defines five generic names for fonts: serif, sans-serif, monospace, cursive and fantasy. Those are very generic and the exact font face used when using those generic names is up to each browser and can vary for each operating system they are running on. It represents a worst case scenario where the browser will try to do its best to provide at least a font that looks approp...
...e reeled back to clear whatever foreign matter may have nestled its way into his mighty throat. Many a fat alley rat had met its demise while staring point blank down the cavernous barrel of this awesome prowling machine. Truly a wonder of nature this urban predator -- Tommy the cat had many a story to tell. But it was a rare occasion such as this that he did.</p> Font size In our previous
module's CSS values and units article, we reviewed length and size units. Font size (set with the font-size property) can take values measured in most of these units (and others, such as percentages), however the most common units you'll use to size text are: px (pixels): The number of pixels high you want the text to be. This is an absolute unit -- it results in the same final computed value for the...
...", drawOutput); cssInput.addEventListener("input", drawOutput); window.addEventListener("load", drawOutput); Test your skills! ...
...And 2 more matches
Learn to style HTML using CSS - Learn web development
ontent, split it into multiple columns, or add animations and other decorative features. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites You should learn the basics of HTML before attempting any CSS. We recommend that you work through our Introduction to HTML
module first. In that
module, you will learn about: CSS, starting with the Introduction to CSS
module More advanced HTML
modules JavaScript, and how to use it to add dynamic functionality to web pages Once you understand the fundamentals of HTML, we recommend that you learn HTML and CSS at the same time, moving back and forth between the two topics. This is because HTML is far more interesting an...
...arting this topic, you should also be familiar with using computers and using the web passively (i.e., just looking at it, consuming the content). You should have a basic work environment set up as detailed in Installing basic software and understand how to create and manage files, as detailed in Dealing with files -- both of which are parts of our Getting started with the web complete beginner's
module. It is recommended that you work through Getting started with the web before proceeding with this topic. However, doing so isn't absolutely necessary as much of what is covered in the CSS basics article is also covered in our CSS first steps
module, albeit in a lot more detail.
Modules This topic contains the following
modules, in a suggested order for working through them. You should definite...
...
Modules This topic contains the following
modules, in a suggested order for working through them. You should definitely start with the first one. CSS first steps CSS (Cascading Style Sheets) is used to style and lay out web pages -- for example, to alter the font, color, size, and spacing of your content, split it into multiple columns, or add animations and other decorative features. This
module provides a gentle beginning to your path towards CSS mastery with the basics of how it works, what the syntax looks like, and how you can start using it to add styling to HTML. CSS building blocks This
module carries on where CSS first steps left off -- now you've gained familiarity with the language and its syntax, and got some basic experience with using it, its time to dive a bit deeper. T...
...And 2 more matches
Multimedia and Embedding - Learn web development
We've looked at a lot of text so far in this course, but the web would be really boring only using text. Let's start looking at how to make the web come alive with more interesting content! ...
...is
module explores how to use HTML to include multimedia in your web pages, including the different ways that images can be included, and how to embed video, audio, and even entire webpages. Looking to become a front-end web developer? ...
...o, audio, and even entire webpages. Looking to become a front-end web developer? ...
...And 2 more matches
JavaScript — Dynamic client-side scripting - Learn web development
rse that includes all the essential information you need to work towards your goal. Get started Prerequisites JavaScript is arguably more difficult to learn than related technologies such as HTML and CSS. Before attempting to learn JavaScript, you are strongly advised to get familiar with at least these two technologies first, and perhaps others as well. Start by working through the following
modules: Getting started with the Web Introduction to HTML Introduction to CSS Having previous experience with other programming languages might also help. After getting familiar with the basics of JavaScript, you should be in a position to learn about more advanced topics, for example: JavaScript in depth, as taught in our JavaScript guide Web APIs
Modules This topic contains the followi...
... Getting started with the Web Introduction to HTML Introduction to CSS Having previous experience with other programming languages might also help. After getting familiar with the basics of JavaScript, you should be in a position to learn about more advanced topics, for example: JavaScript in depth, as taught in our JavaScript guide Web APIs
Modules This topic contains the following
modules, in a suggested order for working through them. JavaScript first steps In our first JavaScript
module, we first answer some fundamental questions such as "what is JavaScript?", "what does it look like?", and "what can it do?", before moving on to taking you through your first practical experience of writing JavaScript. After that, we discuss some key JavaScript features in detail, such as va...
...You've seen this stuff already in the course, but only in passing -- here we'll discuss it all explicitly. ...
...And 2 more matches
Working with Svelte stores - Learn web development
cases we were dealing with communication between parent and child components. But not all application state belongs inside your application's component hierarchy. For example, information about the logged in user, or whether the dark theme is selected or not. Sometimes, your app state will need to be accessed by multiple components that are not hierarchically related, or by a regular JavaScript
module. Moreover, when your app becomes complicated and your component hierarchy gets complex, it might become too difficult for components to relay data between each other. In that case, moving to a global data store might be a good option. If you've already worked with Redux or Vuex, then you'll be familiar with how this kind of store works. Svelte stores offer similar features for state management. ...
...similar features for state management. A store is simply an object with a subscribe() method that allows interested parties to be notified whenever the store value changes, and an optional set() method that allows you to set new values for the store. This minimal API is known as the store contract. Svelte provides functions for creating readable, writable, and derived stores in the svelte/store
module. Svelte also provides a very intuitive way to integrate stores into its reactivity system using the reactive $store syntax. If you create your own stores honoring the store contract, you get this reactivity syntactic sugar for free. Creating the Alert component To show how to work with stores, we will create an Alert component. These kind of widgets might also be known as popup notifications, ...
...the $store auto-subscription syntax that allows us to work with stores in the same way as local variables. Because stores has a minimal API, it's very simple to create our custom stores to abstract away the inner workings of the store itself. Bonus track: Transitions Let's change the subject now, and do something fun and different -- let's add an animation to our alerts. Svelte provides a whole
module to define transitions and animations so we can make our user interfaces more appealing. A transition is applied with the transition:fn directive, and is triggered by an element entering or leaving the DOM as a result of a state change. The svelte/transition
module exports seven functions: fade, blur, fly, slide, scale, draw, and crossfade. Let's give our Alert component a fly transition. We'll ...
...And 2 more matches
Deploying our app - Learn web development
tree-shaking applied, and that versions are "cache busted". Running tests: These can range from "is this code formatted properly?" to "does this thing do what I expect?", and ensuring failing tests prevent deployment. Actually deploying the updated code to a live URL: Or potentially a staging URL so it can be reviewed first. Note: Cache busting is a new term that we haven't met before in the
module. This is the strategy of breaking a browser's own caching mechanism, which forces the browser to download a new copy of your code. Parcel (and indeed many other tools) will generate filenames that are unique to each new build. This unique filename "busts" your browser's cache, thereby making sure the browser downloads the fresh code each time an update is made to the deployed code. The above ta...
... problem: End-to-end testing, which involves your visitor clicking a thing and some other thing happening. Integration testing, which basically says "does one block of code still work when connected to another block?" Unit testing, where small and specific bits of functionality are tested to see if they do what they are supposed to do. And many more types. Also see our cross browser testing
module for a bunch of useful testing information Remember also that tests are not limited to JavaScript; tests can be run against the rendered DOM, user interactions, CSS, and even how a page looks. However, for this project we're going to create a small test that will check the third-party NASA data feed and ensure it's in the correct format. If not, the test will fail and will prevent the project f...
...are not limited to JavaScript; tests can be run against the rendered DOM, user interactions, CSS, and even how a page looks. However, for this project we're going to create a small test that will check the third-party NASA data feed and ensure it's in the correct format. If not, the test will fail and will prevent the project from going live. To do anything else would be beyond the scope of this
module -- testing is a huge subject that really requires its own separate
module. We are hoping that this section will at least make you aware of the need for testing, and will plant the seed that inspires you to go and learn more. Although the test for this project does not include a test framework, as with all things in the front-end development world, there are a slew of framework options. The test...
...And 2 more matches
Introducing a complete toolchain - Learn web development
der browsers). You can find more about configuring Prettier in its documentation. Next up, we'll configure eslint -- create another file in the root of your will-it-miss directory called .eslintrc.json, and give it the following contents: { "env": { "es6": true, "browser": true }, "extends": "eslint:recommended", "parserOptions": { "ecmaVersion": 6, "sourceType": "
module" }, "rules": { "no-console": 0 } } The above eslint configuration says that we want to use the "recommended" eslint settings, that we're going to allow usage of ES6 features (such as map() or Set()), that we can use
module import statements, and that using console.log() is allowed. However, in the project's source files we are using React JSX syntax (for your real projects you ...
...urrent configuration, so we'll need to add a little more configuration to the eslint settings to get it to accept JSX features. The final config file should look like this -- add in the bolded parts and save it: { "env": { "es6": true, "browser": true }, "extends": ["eslint:recommended", "plugin:react/recommended"], "parserOptions": { "ecmaVersion": 6, "sourceType": "
module", "ecmaFeatures": { "jsx": true } }, "plugins": ["react"], "rules": { "semi": "error", "no-console": 0, "react/jsx-uses-vars": "error" } } As the configuration now uses a plugin called "React", this development dependency also needs to be installed, so that the code is there to actually run that part of the linting process. Run the following terminal com...
...es: { "plugins": { "postcss-preset-env": { "stage": 0 } } } That's all we need to do -- remember that Parcel installs the dependencies for us by default! Although this stage of our toolchain can be quite painful, because we've chosen a tool that purposely tries to reduce configuration and complexity, there's really nothing more we need to do during the development phase.
Modules are correctly imported, nested CSS is correctly transformed to "regular CSS", and our development is unimpeded by the build process. Now our software is ready to be written! Running the transformation To start working with our project, we'll run the Parcel server on the command line. In its default mode it will watch for changes in your code and automatically install your dependencies. This i...
...And 2 more matches
Installing headers using EXPORTS
For normal headers that are to be exported, you should set EXPORTS to the list of headers to be exported. ...
...For normal headers that are to be exported, you should set EXPORTS to the list of headers to be exported. ...
... Public headers and IDL files are copied during the export phase of the build. This is accomplished by setting make variables telling the build system which
module the headers are for (since headers are organized by
module under <tt>dist/include</tt>), and which headers need to be created from IDL files by xpidl. For all <tt>Makefile.in</tt>s which export public headers, you should set
MODULE to the
module name where the files should be copied to in <tt>dist/include</tt>. For normal headers that are to be exported, you should set EXPORTS to the list of headers to be exported. They will be copied to <tt>dist/include/$(
MODULE)</tt>. For XPIDL-generated headers, you should set XPIDLSRCS to the list of IDL files to export. These IDL files will be copied to <tt>dist/idl</tt>, and the gener...
...And 2 more matches
How to add a build-time test
a non-zero status and/or print the string "FAIL" to stdout If the test passes, exit with a zero status and don't print the string "FAIL" (bonus points for printing "PASS" :) ) Write the test so that you expect it to pass on all platforms, since if the test fails, the tree will go orange (once we've set this up - see bug 352240 for status). ...
...it with a zero status and don't print the string "FAIL" (bonus points for printing "PASS" :) ) Write the test so that you expect it to pass on all platforms, since if the test fails, the tree will go orange (once we've set this up - see bug 352240 for status). For example, to add an xpcshell test to a
module, do the following: Copy tools/test-harness/xpcshell-simple/example to your
moduledir/tests_type, wheretests_type is something that describes your tests. You can of course use unit or test if you're not feeling creative. In <tt>your
moduledir/tests_type/Makefile.in</tt> change DEPTH,
MODULE, and XPCSHELL_TESTS appropriately: DEPTH should be a relative path pointing to <tt>mozilla/</tt>, e.g. if you're in <tt>netwerk/test</tt>, set DEPTH = ../..
MODULE should be defined...
...e, wheretests_type is something that describes your tests. You can of course use unit or test if you're not feeling creative. In <tt>your
moduledir/tests_type/Makefile.in</tt> change DEPTH,
MODULE, and XPCSHELL_TESTS appropriately: DEPTH should be a relative path pointing to <tt>mozilla/</tt>, e.g. if you're in <tt>netwerk/test</tt>, set DEPTH = ../..
MODULE should be defined to test_your
module or just your
module -- either will work fine. XPCSHELL_TESTS be a list of subdirectories of the current directory which contain xpcshell tests. ...
...And 2 more matches
Code Samples
Getting the directory where your add-on is located If you need to determine the directory in which your add-on is installed, code like the following will do the trick. Simply replace YOUREXTENSIONID with your add-on's ID. ...
... will do the trick. Simply replace YOUREXTENSIONID with your add-on's ID. ...
...getAddonByID("my-addon@foo.com", function(addon) { alert("My extension's version is " + addon.version); alert("Did I remember to include that file.txt file in my XPI? " + addon.hasResource("file.txt") ? ...
...And 2 more matches
CustomizableUI.jsm
Manage the areas in which these widgets are shown. Note that it is expressly not really aware about the specific UI used by users to make customizations. ...
... Manage the areas in which these widgets are shown. Note that it is expressly not really aware about the specific UI used by users to make customizations. ...
... Manage the areas in which these widgets are shown. Note that it is expressly not really aware about the specific UI used by users to make customizations. This is handled by CustomizeMode.jsm, which interacts with CustomizableUI through a listener mechanism. ...
...And 2 more matches
PerfMeasurement.jsm
Note: At present, PerfMeasurement.jsm is only functional on Linux, but it is planned to add support for Windows (bug 583322) and OSX (bug 583323) as well, and we welcome patches for other operating systems. ...
...Note: At present, PerfMeasurement.jsm is only functional on Linux, but it is planned to add support for Windows (bug 583322) and OSX (bug 583323) as well, and we welcome patches for other operating systems. ...
...Note: At present, PerfMeasurement.jsm is only functional on Linux, but it is planned to add support for Windows (bug 583322) and OSX (bug 583323) as well, and we welcome patches for other operating systems. ...
...And 2 more matches
Promise.jsm
The Promise.jsm JavaScript code
module implements the Promises/A+ proposal as known in April 2013. This
module was used before DOM Promises were made globally available in Gecko 29. Its usage is not suggested for new code. If you just need a Promise, consider using a DOM Promise instead. If you need a Deferred, because you want to create a Promise and manually resolve or reject it, consider using PromiseUtils.jsm instead. ...
... known in April 2013. This
module was used before DOM Promises were made globally available in Gecko 29. Its usage is not suggested for new code. If you just need a Promise, consider using a DOM Promise instead. If you need a Deferred, because you want to create a Promise and manually resolve or reject it, consider using PromiseUtils.jsm instead. ...
...lobally available in Gecko 29. Its usage is not suggested for new code. If you just need a Promise, consider using a DOM Promise instead. If you need a Deferred, because you want to create a Promise and manually resolve or reject it, consider using PromiseUtils.jsm instead. ...
...And 2 more matches
NSS API Guidelines
#11, wraps Crypto lib/freebl blapi.h, blapit.h jar Provides support for reading and writing data in Java Archive (jar) format, including zlib compression. Port lib/jar jar-ds.h, jar.h, jarfile.h nss Provides high-level initialiazation and shutdown of security services. Specifically, this library provides NSS_Init() for establishing default certificate, key,
module databases, and initializing a default random number generator. NSS_Shutdown() closes these databases, to prevent further access by an application. Above High Cert, High Key lib/nss nss.h pk11wrap Provides access to PKCS #11
modules, through a unified interface. The pkcs11wrap library provides functions for selecting/finding PKCS #11
modules and slots. It also provides functio...
... random number generator. NSS_Shutdown() closes these databases, to prevent further access by an application. Above High Cert, High Key lib/nss nss.h pk11wrap Provides access to PKCS #11
modules, through a unified interface. The pkcs11wrap library provides functions for selecting/finding PKCS #11
modules and slots. It also provides functions that invoke operations in selected
modules and slots, such as key selection and generation, signing, encryption and decryption, etc. Crypto Wrapper lib/pk11wrap pk11func.h, secmod.h, secmodt.h pkcs12 Provides functions and types for encoding and decoding PKCS #12 data. PKCS #12 can be used to to encode keys, and certificates, for export or import into other applications. PKCS #12 lib/pkcs12 pkcs12t.h, pkcs12...
...h, pkcs12.h, p12plcy.h, p12.h, p12t.h pkcs7 Provides functions and types for encoding and decoding encrypted data in PKCS #7 format. For example, PKCS #7 is used to encrypt certificate data to exchange between applications, or to encrypt S/MIME message data. PKCS #7 lib/pkcs7 secmime.h, secpkcs7.h, pkcs7t.h softoken Provides a software implementation of a PKCS #11
module. PKCS #11: implementation lib/softoken keydbt.h, keylow.h, keytboth.h, keytlow.h, secpkcs5.h, pkcs11.h, pkcs11f.h, pkcs11p.h, pkcs11t.h, pkcs11u.h ssl Provides an implementation of the SSL protocol using NSS and NSPR. SSL lib/ssl ssl.h, sslerr.h, sslproto.h, preenc.h secutil Provides utility functions and data types used by other libraries. The library su...
...And 2 more matches
NSS functions
PK11_GetKeyGen MXR 3.4 and later PK11_GetKeyLength MXR 3.2 and later PK11_GetKeyStrength MXR 3.2 and later PK11_GetMechanism MXR 3.2 and later PK11_GetMinimumPwdLength MXR 3.4 and later PK11_GetModInfo MXR 3.6 and later PK11_Get
Module MXR 3.3 and later PK11_Get
ModuleID MXR 3.2 and later PK11_GetNextGenericObject MXR 3.9.2 and later PK11_GetNextSafe MXR 3.4 and later PK11_GetNextSymKey MXR 3.4 and later PK11_GetPadMechanism MXR 3.4 and later PK11_GetPBECryptoMech...
...ter SECKEY_DestroyEncryptedPrivateKeyInfo MXR 3.2 and later SECKEY_DestroyPrivateKeyInfo MXR 3.2 and later SECKEY_DestroyPublicKey MXR 3.2 and later SECKEY_PublicKeyStrength MXR 3.2 and later SECKEY_UpdateCertPQG MXR 3.2 and later SECMOD_AddNew
Module MXR 3.3 and later SECMOD_AddNew
ModuleEx MXR 3.4 and later SECMOD_Delete
ModuleEx MXR 3.12 and later SECMOD_CancelWait MXR 3.9.3 and later SECMOD_CanDeleteInternal
Module MXR 3.5 and later SECMOD_Create
Module MXR 3.4 and later SECMOD_...
... MXR 3.3 and later SECMOD_AddNew
ModuleEx MXR 3.4 and later SECMOD_Delete
ModuleEx MXR 3.12 and later SECMOD_CancelWait MXR 3.9.3 and later SECMOD_CanDeleteInternal
Module MXR 3.5 and later SECMOD_Create
Module MXR 3.4 and later SECMOD_Delete
Module MXR 3.4 and later SECMOD_Find
Module MXR 3.4 and later SECMOD_FindSlot MXR 3.4 and later SECMOD_Free
ModuleSpecList MXR 3.4 and later SECMOD_GetDB
ModuleList MXR 3.9 and later SECMOD_GetDead
ModuleList MXR 3.9 and later SECMOD_GetModul...
...And 2 more matches
An Overview of XPCOM
quick tour of XPCOM - an introduction to the basic concepts and technologies in XPCOM and component development. The brief sections in this chapter introduce the concepts at a very high level, so that we can discuss and use them with more familiarity in the tutorial itself, which describes the creation of a Mozilla component called WebLock. The XPCOM Solution The Cross Platform Component Object
Module (XPCOM) is a framework which allows developers to break up monolithic software projects into smaller modularized pieces. These pieces, known as components, are then assembled back together at runtime. The goal of XPCOM is to allow different pieces of software to be developed and built independently of one another. In order to allow interoperability between components within an application, XPCOM...
...and most notably Mozilla Firefox. Components XPCOM allows you to break up large software projects into smaller pieces known as components. They are usually contained in reusable binary libraries (a DLL on Windows, for example, or a DSO on Unix), which can include one or more components. When two or more related components are grouped together in a binary library, the library is referred to as a
module. ...
... Maintenance Even when you are not updating a component, designing your application in a modular way can make it easier for you to find and maintain the parts of the application that you are interested in. ...
...And 2 more matches
nsIPushService
be(in DOMString scope, in nsIPrincipal principal, in nsIUnsubscribeResultCallback callback); Methods subscribe() Creates a push subscription. void subscribe( in DOMString scope, in nsIPrincipal principal, in nsIPushSubscriptionCallback callback ); Parameters scope The ServiceWorkerRegistration.scope for a service worker subscription, or a unique URL (for example, chrome://my-
module/push) for a system subscription. principal The nsIPrincipal to associate with the subscription. Privileged code should pass the system principal. callback The callback to call when the nsIPushSubscription is created. Passing the system principal exempts the subscription from permission checks and background messages quotas, which are enforced for service worker subscriptions. Example co...
... service worker subscriptions. Example const { classes: Cc, interfaces: Ci, utils: Cu } = Components; const scriptSecurityManager = Cc["@mozilla.org/scriptsecuritymanager;1"] .getService(Ci.nsIScriptSecurityManager); const pushService = Cc["@mozilla.org/push/Service;1"] .getService(Ci.nsIPushService); pushService.subscribe( "chrome://my-
module/push", scriptSecurityManager.getSystemPrincipal(), (code, subscription) => { if (!Components.isSuccessCode(code)) { Cu.reportError("Error creating subscription: " + code); return; } // `subscription` implements `nsIPushSubscription`. subscription.endpoint; subscription.getKey("p256dh"); subscription.getKey("auth"); } ); getSubscription() Fetches an exi...
...ription( in DOMString scope, in nsIPrincipal principal, in nsIPushSubscriptionCallback callback ); Parameters scope The unique scope URL, as passed to nsIPushService.subscribe(). principal The subscription nsIPrincipal, as passed to nsIPushService.subscribe(). callback The callback to call with the fetched nsIPushSubscription. Example pushService.getSubscription( "chrome://my-
module/push", scriptSecurityManager.getSystemPrincipal(), (code, subscription) => { if (!Components.isSuccessCode(code)) { Cu.reportError("Error fetching subscription: " + code); return; } // `subscription == null` if the `(scope, principal)` pair doesn't have a // push subscription. Otherwise, it's an instance of `nsIPushSubscription`. } ); unsubscribe() Drops an ex...
...And 2 more matches
Mail client architecture overview
It manages individual account...
...This includes management of accounts, folders and messages. The base
module consists of the following basic building blocks Account Management - The Account Manager is the root object of the server/folder/message hierarchy. It manages individual accounts on mail servers and the identity of use...
...It manages individual accounts on mail servers and the identity of users as used to send ...
...And 2 more matches
Using js-ctypes
Before you can use js-ctypes, you need to import the ctypes.jsm code
module. This is as simple as including the following line of code in the desired JavaScript scope: Components.utils.import("resource://gre/
modules/ctypes.jsm") Loading a native library Once you've imported the code
module, you can call the ctypes.open() method to load each native library you wish to use. On Windows, for example, you might load the system user32 library like this: var lib = ctypes.open("user32.dll"); On Mac OS X, you can load the Core Foundation library from the Core Foundation framework like this: var coreFoundation = ctypes.open("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation"); The returned object is a Library object that you use to declare functions and data types for use with ...
...antiating C data objects and referencing them is covered in the article Working with data. Memory management moved to Memory Management page. Examples These examples offer a quick look at how js-ctypes is used. See js-ctypes examples for more intricate examples. Calling Windows routines This example demonstrates how to use ctypes to call a Win32 API. ...
...lling Carbon routines on Mac OS X This example demonstrates how to use ctypes to call a Carbon function on Mac OS X. ...
...And 2 more matches
Web Accessibility: Understanding Colors and Luminance - Accessibility
. The "L" in the HSL color space is sometimes referred to as "luminosity," other times as "lightness." Even something seemingly simple like naming common colors can be open to debate. For example, the color "crimson red" may be described in hex values as #990000 by some and #DC143C by others. For the purposes of this document, we'll use terminlogy as it is defined in the W3C, in the CSS Color
Module Level 3 When working with color, it's important to know which "color space" you are working in, as different color spaces map to different measurement systems. Currently, the RGB color space predominates as the space web developers work in. HEX, RGB and HSL color spaces all are measured differently. Conversions between the color spaces are usually needed. Because of the current domination of t...
...g, and new methods for measuring color involve measurements using other color spaces, but color measurements in the RGB color space still predominates, and this includes video production. The RGB color model is extended to include "alpha" -- RGBA -- to allow specification of the opacity of a color. There's movement towards adopting the use of HSL color values rather than RGB values is CSS Color
Module 3 (see section 4.2.4), the rationale being that RGB is hardware-oriented, reflecting the use of CRTs, and that RGB is non-intuitive. That said, HSL colors incorporate lightness, not luminance, and this is a significant consideration. Note that in that same section of the CSS Color
Module 3, there are algorigthms available to translate the HSL to RGB. Newer technologies, such as OpenGL and Dire...
...n speaking specifically to relative luminance, WCAG's definition of relative luminance notes: "Note 2: Almost all systems used today to view Web content assume sRGB encoding. Unless it is known that another color space will be used to process and display the content, authors should evaluate using sRGB colorspace. If using other color spaces, see Understanding Success Criterion 1.4.3." CSS Color
Module Level 4 will likely change the domination of the sRGB color space in the future. Conversions It's important to know that there are variations even within one color space, such as the RGB color space. For example, variations of the RGB color space include RGB, sRGB, Adobe RGB, Adobe Wide Gamut RGB, and RGBA, among others And, one color within the same color space may be expressed in different ...
...And 2 more matches
HTML: Hypertext Markup Language
ck out our HTML Learning Area. HTML Reference In our extensive HTML reference section, you'll find the details about every element and attribute in HTML. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. ...
...details about every element and attribute in HTML. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Beginner's tutorials Our HTML Learning Area features multiple
modules that teach HTML from the ground up -- no previous knowledge required. ...
...tarted Beginner's tutorials Our HTML Learning Area features multiple
modules that teach HTML from the ground up -- no previous knowledge required. Introduction to HTML This
module sets the stage, getting you used to important concepts and syntax such as looking at applying HTML to text, how to create hyperlinks, and how to use HTML to structure a web page. Multimedia and embedding This
module explores how to use HTML to include multimedia in your web pages, including the different ways that images can be included, and how to embed video, audio, and even entire other webpages. HTML tables Representing tabular data on a webpage in an understandable, accessible way can be a challenge. ...
...And 2 more matches
Function.prototype.bind() - JavaScript
n object, then to later call that function and expect it to use the original object as its this (e.g., by using the method in callback-based code). Without special care, however, the original object is usually lost. ...
...e the original object as its this (e.g., by using the method in callback-based code). Without special care, however, the original object is usually lost. ...
... the method in callback-based code). Without special care, however, the original object is usually lost. ...
...And 2 more matches
WebAssembly.compileStreaming() - JavaScript
Exceptions If bufferSource is not a typed array, a TypeError is thrown. ...
... The WebAssembly.compileStreaming() function compiles a WebAssembly.
Module directly from a streamed underlying source. This function is useful if it is necessary to a compile a
module before it can be instantiated (otherwise, the WebAssembly.instantiateStreaming() function should be used). Syntax Promise<WebAssembly.
Module> WebAssembly.compileStreaming(source); Parameters source A Response object or a promise that will fulfill with one, representing the underlying source of a .wasm
module you want to stream and compile. Return value A Promise that resolves to a WebAssembly.
Module object representing the compiled
module. Exceptions If bufferSource is not a typed array, a TypeError is thrown. If compilation fails, the promise rejects with a WebAssembly.CompileError. Examples Com...
...Because the compileStreaming() function accepts a promise for a Response object, you can directly pass it a WindowOrWorkerGlobalScope.fetch() call, and it will pass the response into the function when it fulfills. ...
...And 2 more matches
Index - WebAssembly
ssembly is a new type of code that can be run in modern web browsers -- it is a low-level assembly-like language with a compact binary format that runs with near-native performance and provides languages such as C/C++ with a compilation target so that they can run on the web. It is also designed to run alongside JavaScript, allowing both to work together. 2 Caching compiled WebAssembly
modules Caching, IndexedDB, JavaScript,
Module, WebAssembly, compile, wasm Caching is useful for improving the performance of an app -- we can store compiled WebAssembly
modules on the client so they don't have to be downloaded and compiled every time. This article explains the best practices around this. 3 Compiling a New C/C++
Module to WebAssembly C, C++, Compiling, Emscripte...
...Let's look at how it works. ...
...ownloaded and compiled every time. This article explains the best practices around this. 3 Compiling a New C/C++
Module to WebAssembly C, C++, Compiling, Emscripten, WebAssembly, wasm When you've written a new code
module in a language like C/C++, you can compile it into WebAssembly using a tool like Emscripten. Let's look at how it works. 4 Compiling an Existing C
Module to WebAssembly C++, Compiling, Emscripten, WebAssembly, wasm A core use-case for WebAssembly is to take the existing ecosystem of C libraries and allow developers to use them on the web. 5 Compiling from Rust to WebAssembly Compiling, WebAssembly, rust, wasm If you've written some Rust code, you can compile it into WebAssembly! This tutorial takes you through all yo...
...And 2 more matches
Compiling from Rust to WebAssembly - WebAssembly
online book The Rust Programming Language. Using wasm-bindgen to communicate between Rust and JavaScript The first part looks like this: use wasm_bindgen::prelude::*; Libraries are called "crates" in Rust. Get it? Cargo ships crates. The third line contains a use command, which imports code from a library into your code. In this case, we're importing everything in the wasm_bindgen::prelude
module. We use these features in the next section. Before we move on to the next section, we should talk a bit more about wasm-bindgen. wasm-pack uses wasm-bindgen, another tool, to provide a bridge between the types of JavaScript and Rust. It allows JavaScript to call a Rust API with a string, or a Rust function to catch a JavaScript exception. We use wasm-bindgen's functionality in our package. In ...
...nto your terminal: $ wasm-pack build This does a number of things (and they take a lot of time, especially the first time you run wasm-pack). To learn about them in detail, check out this blog post on Mozilla Hacks. In short, wasm-pack build: Compiles your Rust code to WebAssembly. Runs wasm-bindgen on that WebAssembly, generating a JavaScript file that wraps up that WebAssembly file into a
module npm can understand. Creates a pkg directory and move that JavaScript file and your WebAssembly code into it. Reads your Cargo.toml and produces an equivalent package.json. Copies your README.md (if you have one) into the package. The end result? You have an npm package inside of the pkg directory. A digression about code size If you check out the generated WebAssembly code size, it may be ...
...-server" }, "dependencies": { "hello-wasm": "^0.1.0" }, "devDependencies": { "webpack": "^4.25.1", "webpack-cli": "^3.1.2", "webpack-dev-server": "^3.1.10" } } Note that you need to fill in your own username, after the @, in the dependencies section. Next, we need to configure Webpack. ...
...And 2 more matches
Communicating using "port" - Archive of obsolete content
om the add-on"); }); tabs.open("http://www.mozilla.org"); In total, the port object defines four functions: emit(): emit a message. on(): listen to a message. removeListener(): stop listening to a message. once(): listen to only the first occurrence of a message. Accessing port Accessing port in the Content Script Note that the global self object is completely different from the self
module, which provides an API for an add-on to access its data files and ID. In the content script the port object is available as a property of the global self object. Thus, to emit a message from a content script: self.port.emit("myContentScriptMessage", myContentScriptMessagePayload); To receive a message from the add-on code: self.port.on("myAddonMessage", function(myAddonMessagePayload) { //...
...r user-defined messages. Accessing port in the Add-on Script In the add-on code, the channel of communication between the add-on and a particular content script context is encapsulated by the worker object. Thus the port object for communicating with a content script is a property of the corresponding worker object. However, the worker is not exposed to add-on code in quite the same way in all
modules. The panel and page-worker objects integrate the worker API directly. So to receive messages from a content script associated with a panel you use panel.port.on(): var panel = require("sdk/panel").Panel({ contentScript: "self.port.emit('showing', 'panel is showing');" }); panel.port.on("showing", function(text) { console.log(text); }); panel.show(); Conversely, to emit user-defined mess...
... = require("sdk/panel").Panel({ contentScript: "self.port.on('alert', function(text) {" + " console.log(text);" + "});" }); panel.show(); panel.port.emit("alert", "panel is showing"); The panel and page-worker objects only host a single page at a time, so each distinct page object only needs a single channel of communication to its content scripts. But some
modules, such as page-mod, might need to handle multiple pages, each with its own context in which the content scripts are executing, so it needs a separate channel (worker) for each page. So page-mod does not integrate the worker API directly: instead, each time a content script is attached to a page, the worker associated with the page is supplied to the page-mod in its onAttach function. By supplyin...
... It may be called with any number of parameters, but is most likely to be called with a name for the message and an optional payload. The payload can be any value that is serializable to JSON. From the content script to the main add-on code: var myMessagePayload = "some data"; self.port.emit("myMessage", myMessagePayload); From the main add-on code (in thi...
Content Processes - Archive of obsolete content
g the property on window.wrappedObject, the property is defined on the underlying object, rather than the wrapper itself. This feature should only be used when you really need it, however. A few Notes on Security As we stated earlier, the SDK was designed with multiprocess support in mind, despite the fact that work on implementing this in Firefox has currently been suspended. ...
... When two sandboxes have the same privileges, a wrapper in one sandbox provides transparent access to an object in the other sandbox. ...
...are currently loaded in sandboxes rather than separate processes, and sandboxes can communicate with each other directly (using imports/exports), you might be wondering why we have to go through all the trouble of passing messages between add-on and content scripts. The reason for this extra complexity is that the code for add-on
modules and content scripts have different privileges. Every add-on
module can get chrome privileges simply by asking for them, whereas content scripts have the same privileges as the page it is running on. When two sandboxes have the same privileges, a wrapper in one sandbox provides transparent access to an object in the other sandbox. When the two sandboxes have different privileges, things become more complicated, however. Code with content privileges should not be...
... ...
Working with Events - Archive of obsolete content
e list of valid event types is specific to an event emitter and is included with its documentation. listener: the listener itself. This is a function which will be called whenever the event occurs. The arguments that will be passed to the listener are specific to an event type and are documented with the event emitter. For example, the following add-on registers a listener with the tabs
module to listen for the ready event, and logs a string to the console reporting the event: var tabs = require("sdk/tabs"); tabs.on("ready", function () { console.log("tab loaded"); }); It is not possible to enumerate the set of listeners for a given event. The value of this in the listener function is the object that emitted the event. Listening to all events You can pass the wildcard "*" as t...
... In the latter case the options object passed to the constructor typically defines properties whose names are the names of supported event types prefixed with "on": for example, "onOpen", "onReady" and so on. Then in the constructor you can...
..."*", function(e) { console.log("event " + e + " was emitted"); }); var button = ui.ActionButton({ id: "my-button", label: "my button", icon: "./icon-16.png", onClick: handleClick }); function handleClick(state) { panel.show({ position: button }); } This wildcard feature does not yet work for the tabs or windows
modules. Adding Listeners in Constructors Event emitters may be
modules, as is the case for the ready event above, or they may be objects returned by constructors. In the latter case the options object passed to the constructor typically defines properties whose names are the names of supported event types prefixed with "on": for example, "onOpen", "onReady" and so on. Then in the constructor you can assign a listener function to this property as an alternative to ...
...n("click", function() { require("sdk/tabs").open("https://developer.mozilla.org/"); }); Removing Event Listeners Event listeners can be removed by calling removeListener(type, listener), supplying the type of event and the listener to remove. The listener must have been previously been added using one of the methods described above. In the following add-on, we add two listeners to the tabs
module's ready event. One of the handler functions removes the listener again. Then we open two tabs. var tabs = require("sdk/tabs"); function listener1() { console.log("Listener 1"); tabs.removeListener("ready", listener1); } function listener2() { console.log("Listener 2"); } tabs.on("ready", listener1); tabs.on("ready", listener2); tabs.open("https://www.mozilla.org"); tabs.open("https://...
page-worker - Archive of obsolete content
Create a permanent, invisible page and access its DOM. Usage The
module exports a constructor function Page, which constructs a new page worker. A page worker may be destroyed, after which its memory is freed, and you must create a new instance to load another page. You specify the page to load using the contentURL option to the Page() constructor. This can point to a remote file: pageWorker = require("sdk/page-worker").Page({ contentScript: "console.log(document.body.innerHTML);", contentURL: "http://en.wikipedia.org/wiki/Internet" }); It can also point to an HTML file which you've packaged with your add-on. ...
...nstructor. This can point to a remote file: pageWorker = require("sdk/page-worker").Page({ contentScript: "console.log(document.body.innerHTML);", contentURL: "http://en.wikipedia.org/wiki/Internet" }); It can also point to an HTML file which you've packaged with your add-on. To do this, save the file in your add-on's data directory and create the URL using the data.url() method of the self
module: pageWorker = require("sdk/page-worker").Page({ contentScript: "console.log(document.body.innerHTML);", contentURL: require("sdk/self").data.url("myFile.html") }); From Firefox 34, you can use "./myFile.html" as an alias for self.data.url("myFile.html"). So you can rewrite the above code like this: pageWorker = require("sdk/page-worker").Page({ contentScript: "console.log(document.body.
...ontent. You can specify one or more content scripts to load into the page using the contentScript or contentScriptFile options to the Page() constructor. With contentScript you pass the script as a string, as in the examples above. With contentScriptFile you pass a URL which points to a script saved under your add-on's data directory. You construct the URL using the data.url() method of the self
module. While content scripts can access DOM content, they can't access any of the SDK APIs, so in many cases you'll need to exchange messages between the content script and your main add-on code for a complete solution. For example, the content script might read some content and send it back to the main add-on, which could store it using the simple-storage API. You can communicate with the script usi...
... include string, RegExp, array of (String or RegExp) This is useful when your page worker loads a page which will redirect to other pages. A match pattern string or an array of match pattern strings. These define the documents to which the page-worker's content worker applies. At least one match pattern must be supplied. See the match-pattern
module for a detailed description of match pattern syntax. contentScriptFile string,array A local file URL or an array of local file URLs of content scripts to load. Content scripts specified by this option are loaded before those specified by the contentScript option. See Working with Content Scripts for help on setting this property. contentScript string,array ...
self - Archive of obsolete content
id This property is a printable string that is unique for each add-on. It comes from the id property set in the package.json file in the main package (i.e. the package in which you run jpm xpi). ...
... id This property is a printable string that is unique for each add-on. It comes from the id property set in the package.json file in the main package (i.e. the package in which you run jpm xpi). ...
...thod returns the contents of an embedded data file, as a string. It is most useful for data that will be modified or parsed in some way, such as JSON, XML, plain text, or perhaps an HTML template. For data that can be displayed directly in a content frame, use data.url(). Parameters name : string The filename to be read, relative to the package's data directory. Each package that uses the self
module will see its own data directory. Returns string : the file contents. data.url(name) The data.url() method returns a resource:// url that points at an embedded data file. It is most useful for data that can be displayed directly in a content frame. The url can be passed to a content frame constructor, such as the Panel: var self = require("sdk/self"); var myPanel = require("sdk/panel").Panel...
...l("myFile.html") }); myPanel.show(); From Firefox 34, you can use "./myFile.html" as an alias for self.data.url("myFile.html"). So you can rewrite the above code like this: var myPanel = require("sdk/panel").Panel({ contentURL: "./myFile.html" }); myPanel.show(); Parameters name : string The filename to be read, relative to the package's data directory. Each package that uses the self
module will see its own data directory. Returns String : resource:// URL pointing to the given location under data. ...
tabs - Archive of obsolete content
ou can register event listeners to be notified when tabs open, close, finish loading DOM content, or are made active or inactive: var tabs = require("sdk/tabs"); // Listen for tab openings. tabs.on('open', function onOpen(tab) { myOpenTabs.push(tab); }); // Listen for tab content loads. tabs.on('ready', function(tab) { console.log('tab is loaded', tab.title, tab.url); }); Access tabs The
module itself can be used as a list of all opened tabs across all windows. In particular, you can enumerate it: var tabs = require('sdk/tabs'); for (let tab of tabs) console.log(tab.title); You can also access individual tabs by index: var tabs = require('sdk/tabs'); tabs.on('ready', function () { console.log('first: ' + tabs[0].title); console.log('last: ' + tabs[tabs.length-1].title); }); Y...
... "./icon-16.png", onChange: function(state) { if (state.checked) { attach(style, tabs.activeTab); } else { detach(style, tabs.activeTab); } } }); Private windows If your add-on has not opted into private browsing, then you won't see any tabs that are hosted by private browser windows. Tabs hosted by private browser windows won't be seen if you enumerate the tabs
module itself, and you won't receive any events for them. To learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing
module. Converting to XUL tabs To convert from the high-level Tab objects used in this API to the low-level XUL tab objects used in the tabs/utils API and by traditional add-ons, use th...
... them. To learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing
module. Converting to XUL tabs To convert from the high-level Tab objects used in this API to the low-level XUL tab objects used in the tabs/utils API and by traditional add-ons, use the viewFor() function exported by the viewFor
module. To convert back the other way, from a XUL tab to a high-level Tab object, use the modelFor() function, exported by the modelFor
module. Here's an example converting from a high-level Tab to a XUL tab and then back the other way: var { modelFor } = require("sdk/model/core"); var { viewFor } = require("sdk/view/core"); var tabs = require("sdk/tabs"); var tab_utils = require("sdk/tabs/utils"); ...
...e tab (usually the title of the page currently loaded in the tab) This property can be set to change the tab title. url The URL of the page currently loaded in the tab. This property can be set to load a different URL in the tab. favicon The URL of the favicon for the page currently loaded in the tab. This property is read-only. This property is deprecated. From version 1.15, use the favicon
module's getFavicon() function instead. contentType This is currently an experimental API, so we might change it in future releases. Returns the MIME type that the document currently loaded in the tab is being rendered as. This may come from HTTP headers or other sources of MIME information, and might be affected by automatic type conversions performed by either the browser or extensions. This prope...
core/heritage - Archive of obsolete content
Object.freeze(Dog.prototype); Object.freeze(Pet.prototype); Note: Also, this is not quite enough as Object.prototype stays mutable & in fact we do little bit more in SDK to address that, but it's not in the scope of this documentation. Doing all of this manually is both tedious and error prone task. That is why SDK provides utility functions to make it more declarative and less verbose. ...
...It's very similar to Object.create, only difference is that second argument is an object containing properties to be defined, instead of property descriptor map. Also, keep in mind that returned object will be frozen. var { extend } = require('sdk/core/heritage'); var...
...econd argument is an object containing properties to be defined, instead of property descriptor map. Also, keep in mind that returned object will be frozen. var { extend } = require('sdk/core/heritage'); var base = { a: 1 }; var derived = extend(base, { b: 2 }); derived.a // => 1 derived.b // => 2 base.isPrototypeOf(derived) // => true mix
Module exports mix utility function that is useful for mixing properties of multiple objects into a single one. Function takes arbitrary number of source objects and returns a fresh object that inherits from the same prototype as a first one and implements all own properties of all given objects. If two or more argument objects have own properties with the same name, the property is overridden, with pre...
...have own properties with the same name, the property is overridden, with precedence from right to left, implying, that properties of the object on the left are overridden by a same named property of the object on the right. var { mix } = require('sdk/core/heritage'); var object = mix({ a: 1, b: 1 }, { b: 2 }, { c: 3 }); JSON.stringify(object) // => { "a": 1, "b": 2, "c": 3 } obscure
Module exports obscure utility function that is useful for defining non-enumerable properties. Function takes an object and returns a new one in return that inherits from the same object as given one and implements all own properties of given object but as non-enumerable ones: var { obscure } = require('api-utils/heritage'); var object = mix({ a: 1 }, obscure({ b: 2 })); Object.getOwnPropertyNames(foo)...
core/promise - Archive of obsolete content
our error handler: readAsync(url). then(parse). then(null, function handleParseError(error) { // handle here both `readAsync` and `parse` errors. }); Consuming promises In general, the whole purpose of promises is to avoid the so-called callback spaghetti. As a matter of fact it would be great if we could convert any synchronous functions to asynchronous by making it aware of promises.
Module exports promised function to do exactly that: const { promised } = require('sdk/core/promise'); function sum(x, y) { return x + y }; var asyncSum = promised(sum); var c = sum(a, b); var cAsync = asyncSum(aAsync(), bAsync()); promised takes normal function and composes new promise-aware version of it. The composed function may take both normal values and promises as arguments and returns promis...
...cess function will not be called return result; }, function (reason) { // rejection handler called because `failAsync` promise // was rejected with its reason propagated return reason; }); Making promises Everything above assumes you get a promise from somewhere else. This is the common case, but every once in a while, you will need to create a promise from scratch. Add-on SDK's promise
module provides an API for doing that. defer
Module exports defer function, which is where all promises ultimately come from. Lets see the implementation of readAsync that we used in several of the examples above: const { defer } = require('sdk/core/promise'); function readAsync(url) { var deferred = defer(); let xhr = new XMLHttpRequest(); xhr.open("GET", url, true); xhr.onload = function()...
... prototype: let { promise, resolve } = defer({ get: function get(name) { return this.then(function(value) { return value[name]; }); } }); promise.get('foo').get('bar').then(console.log); resolve({ foo: { bar: 'taram !!' } }); // => 'taram !!' Also promised function maybe be passed a second optional prototype argument to achieve the same effect. Treat all values as promises
Module provides a simple function for wrapping values into promises: const { resolve } = require('sdk/core/promise'); var a = resolve(5).then(function(value) { return value + 2; }); a.then(console.log); // => 7 Also resolve not only takes values, but also promises. If you pass it a promise it will return a new identical one: const { resolve } = require('sdk/core/promise'); resolve(resolve(resolv...
... could not use promised function here, as they reject returned promise if any of the given arguments is rejected. If you need to customize your promises even further you may pass resolve a second optional prototype argument that will have same effect as with defer. Treat errors as promises Now that we can create all kinds of eventual values, it's useful to have a way to create eventual errors.
Module exports reject to do exactly that. It takes anything as an argument and returns a promise that is rejected with it. const { reject } = require('sdk/core/promise'); var boom = reject(Error('boom!')); future(function() { return Math.random() < 0.5 ? boom : value }) As with the rest of the APIs a reject may be given a second optional prototype argument to customize resulting promise to your ne...
Displaying annotations - Archive of obsolete content
In particular, for a simple button, try the action button or toggle button APIs, and for a more complex widget try the toolbar or sidebar APIs. In this chapter we'll use a page-mod to locate elements of web pages that have annotations associated with them, and a panel to display the annotations. ...
...nel to display the annotations. Matcher page-mod Matcher Content Script The content script for the matcher page-mod is initialized with a list of all the annotations that the user has created. When a page is loaded the matcher searches the DOM for elements that match annotations. If it finds any it binds functions to that element's mouseenter and mouseleave events to send messages to the main
module, asking it to show or hide the annotation. Like the selector, the matcher also listens for the window's unload event and on unload sends a detach message to the main
module, so the add-on can clean it up. The complete content script is here: self.on('message', function onMessage(annotations) { annotations.forEach( function(annotation) { if(annotation.url == document.location.toStri...
...); When a new page is loaded the function assigned to onAttach is called. This function: initializes the content script instance with the current set of annotations provides a handler for messages from that content script, handling the three messages - show, hide and detach - that the content script might send adds the worker to an array, so we it can send messages back later. ...
... ...
Overview - Archive of obsolete content
Deprecated in Firefox 29 and removed in Firefox 38. Warning: this tutorial relies on the since-removed Widget API and no longer works with Firefox. The widget API is deprecated from Firefox 29 onwards. Please see the ui
module for replacements. In particular, for a simple button, try the action button or toggle button APIs, and for a more complex widget try the toolbar or sidebar APIs. The annotator uses content scripts to build user interfaces, get user input, and examine the DOM of pages loaded by the user. ...
... Firefox. The widget API is deprecated from Firefox 29 onwards. Please see the ui
module for replacements. In particular, for a simple button, try the action button or toggle button APIs, and for a more complex widget try the toolbar or sidebar APIs. The annotator uses content scripts to build user interfaces, get user input, and examine the DOM of pages loaded by the user. Meanwhile the main
module contains the application logic and mediates interactions between the different SDK objects. We could represent the basic interactions between the main
module and the various content scripts like this: User Interface The annotator's main user interface consists of a widget and three panels. The widget is used to switch the annotator on and off, and to display a list of all the stored annot...
...n user interface consists of a widget and three panels. The widget is used to switch the annotator on and off, and to display a list of all the stored annotations. The annotation-editor panel enables the user to enter a new annotation. The annotation-list panel shows a list of all stored annotations. The annotation panel displays a single annotation. Additionally, we use the notifications
module to notify the user when the add-on's storage quota is full. Working with the DOM We'll use two page-mods to interact with the DOMs of pages that the user has opened. The selector enables the user to choose an element to annotate. It identifies page elements which are eligible for annotation, highlights them on mouseover, and tells the main add-on code when the user clicks a highlighted el...
...r is responsible for finding annotated elements: it is initialized with the list of annotations and searches web pages for the elements they are associated with. It highlights any annotated elements that are found. When the user moves the mouse over an annotated element the matcher tells the main add-on code, which displays the annotation panel. Working with Data We'll use the simple-storage
module to store annotations. Because we are recording potentially sensitive information, we want to prevent the user creating annotations when in private browsing mode. The simplest way to do this is to omit the "private-browsing" key from the add-on's "package.json" file. If we do this, then the add-on won't see any private windows, and the annotator's widget will not appear in any private windows. G...
Storing annotations - Archive of obsolete content
Deprecated in Firefox 29 and removed in Firefox 38. Warning: this tutorial relies on the since-removed Widget API and no longer works with Firefox. The widget API is deprecated from Firefox 29 onwards. Please see the ui
module for replacements. In particular, for a simple button, try the action button or toggle button APIs, and for a more complex widget try the toolbar or sidebar APIs. Now we are able to create annotations, let's store them using the simple-storage
module. In this chapter we will cover three topics relating to persistent storage: using simple-storage to persist objects handling exhaustion of the storage quota allocated to you respecting Private Browsing Storing New Annotations In this section we are only touching the main.js file. First, import the simple-storage ...
...able to create annotations, let's store them using the simple-storage
module. In this chapter we will cover three topics relating to persistent storage: using simple-storage to persist objects handling exhaustion of the storage quota allocated to you respecting Private Browsing Storing New Annotations In this section we are only touching the main.js file. First, import the simple-storage
module with a declaration like: var simpleStorage = require('sdk/simple-storage'); In the
module scope, initialize an array which will contain the stored annotations: if (!simpleStorage.storage.annotations) simpleStorage.storage.annotations = []; Now we'll add a function to the
module scope which deals with a new annotation. The annotation is composed of the text the user entered and the "annotati...
....postMessage(simpleStorage.storage.annotations); }, onMessage: function(message) { require('sdk/tabs').open(message); } }); Since this panel's content script uses jQuery we will pass that in too: again, make sure the name of it matches the version of jQuery you downloaded. When the panel is shown we send it the array of stored annotations. When the panel sends us a URL we use the tabs
module to open it in a new tab. Finally we need to connect this to the widget's right-click message: var widget = widgets.Widget({ id: 'toggle-switch', label: 'Annotator', contentURL: data.url('widget/pencil-off.png'), contentScriptWhen: 'ready', contentScriptFile: data.url('widget/widget.js') }); widget.port.on('left-click', function() { console.log('activate/deactivate'); widget.conte...
...torage and respond to it. Add the following to your add-on's main function: simpleStorage.on("OverQuota", function () { notifications.notify({ title: 'Storage space exceeded', text: 'Removing recent annotations'}); while (simpleStorage.quotaUsage > 1) simpleStorage.storage.annotations.pop(); }); Because we use a notification to alert the user, we need to import the notifications
module: var notifications = require("sdk/notifications"); (It should be obvious that this is an incredibly unhelpful way to deal with the problem. A real add-on should give the user a chance to choose which data to keep, and prevent the user from adding any more data until the add-on is back under quota.) Respecting Private Browsing Since annotations record the user's browsing history we should avoi...
Using XPCOM without chrome - Archive of obsolete content
We can then create an object from it and add it as an observer to the bookmarks service. ...
...We can then create an object from it and add it as an observer to the bookmarks service. ...
...ls in some cases. Below is an example for the XPCOM bookmark observer. Examples Bookmarks Observer Normally, a bookmark observer would require Chrome Components and XPCOMUtils as described in the following links: (Observing changes to bookmarks and tags) , (Creating Event Targets). However, with the sdk
module , we can remove this need. Below is an example, where we extend the xpcom
module's Unknown class with an nsINavBookmarkObserverinterface and one of its optional interface methods (onItemchanged). We can then create an object from it and add it as an observer to the bookmarks service. // This removes the need to import Ci and the XPCOMUtils const { Class } = require("sdk/core/heritage"); const { Unknown } = require('sdk/platform/xpcom'); const { PlacesUtils } = requ...
...h an nsINavBookmarkObserverinterface and one of its optional interface methods (onItemchanged). We can then create an object from it and add it as an observer to the bookmarks service. ...
JS XPCOM - Archive of obsolete content
nceof is the same as QueryInterface except that it returns false instead of throwing an exception when |c| doesn't support interface |i|. Another difference is that QueryInterface returns an object, where as instanceof returns a boolean. XPCOMUtils - About protocol handler This example implements a quick about protocol handler in JS using XPCOMUtils.jsm. ...
... instead of throwing an exception when |c| doesn't support interface |i|. Another difference is that QueryInterface returns an object, where as instanceof returns a boolean. XPCOMUtils - About protocol handler This example implements a quick about protocol handler in JS using XPCOMUtils.jsm. ...
...OMUtils.jsm"); const Cc = Components.classes; const Ci = Components.interfaces; function AboutHandler() {} AboutHandler.prototype = { newChannel: function(uri) { var channel = Services.io.newChannel("chrome://mystuff/content/mystuff.xul", null, null); channel.originalURI = uri; return channel; }, getURIFlags: function(uri) { // Do NOT return Ci.nsIAbout
Module.URI_SAFE_FOR_UNTRUSTED_CONTENT unless // you make sure to set a non-system principal in newChannel. return 0; }, classDescription: "About MyStuff Page", classID: Components.ID("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"), contractID: "@mozilla.org/network/protocol/about;1?what=mystuff", QueryInterface: XPCOMUtils.generateQI([Ci.nsIAbout
Module]) } var NSGet
Module =...
...ONTENT unless // you make sure to set a non-system principal in newChannel. ...
Performance best practices in extensions - Archive of obsolete content
rance of the user's desired content. Load only what you need, when you need it Don't load things during startup that are only needed if the user clicks a button, or if a given preference is enabled when it's not. If your extension has features that only work when the user has logged into a service, don't load the resources for those features until the user actually logs in. ...
...hat you need, when you need it Don't load things during startup that are only needed if the user clicks a button, or if a given preference is enabled when it's not. If your extension has features that only work when the user has logged into a service, don't load the resources for those features until the user actually logs in. ...
... has logged into a service, don't load the resources for those features until the user actually logs in. Use JavaScript code
modules You can create your own JavaScript code
modules incorporating sets of features that are only needed under specific circumstances. This makes it easy to load chunks of your extension on the fly as needed, instead of loading everything all at once. While JavaScript
modules can be extremely useful, and provide significant performance benefits, they should be used wisely. Loading
modules incurs a small cost, so breaking code up to an unnecessary degree can be counter-productive. Code should be modularized to the extent that doing so increases clarity, and loading of large or expensive chunks of code fragments can be significantly deferred. Defer everything that you...
...t or stop matching. Avoid unqualified ":hover" like the plague. Avoid DOM mutation event listeners DOM mutation event listeners are extremely expensive and, once added to a document even briefly, significantly harm its performance. As mutation events are officially deprecated, and there are many alternatives, they should be avoided at all costs. Lazily load services The XPCOMUtils JavaScript
module provides two methods for lazily loading things: defineLazyGetter() defines a function on a specified object that acts as a getter which will be created the first time it's used. See examples. defineLazyServiceGetter() defines a function on a specified object which acts as a getter for a service. The service isn't obtained until the first time it's used. Look through the source for examples. ...
The new nsString class implementation (1999) - Archive of obsolete content
I absolutely hate string classes. No one has ever devised one that more than 2 programmers can agree on. So, why then am I proposing this? Well, nsString has served us well so far, but it's in need of a facelift. And XPCOM has really taken off, so nsString needs to be brought into alignment. Justification The nsString class is a wide character string class used throughout all of Gecko (and other
modules) as the default implementation. However, it suffers from a few implementation details which need to be addressed and that are the subject of this document. The deficiencies of the current implementation are: Class based -- making it unsuitable for cross-dll usage due to fragility Little intrinsic i18n support Few efficiencies, notably a lack of support for narrow (1-byte) character strings ...
...statement (in XPCOM terms) of the nsString interface. Usage Patterns How To Use These Classes To increase the portability, thread and process safety of Gecko, I suggest the following rules regarding the use of each of our string class derivatives: <center> String Class</center> <center> Where To Use</center> nsStrImpl Use to pass strings between
modules who have linked the nsStrImpl function library. nsString Use these locally in objects who span of control is known to live within your own process. These should typically not be exposed to objects in other
modules. nsAutoString Use these locally in cases where you don't want to incur heap allocation unless absolutely necessary. nsCString Same as nsString, but ...
...This is the most generic approach, but offers reference counted strings. There are implications regarding this implementation, notably dealing with API changes throughout Gecko. ...
...lementation. This is the most generic approach, but offers reference counted strings. There are implications regarding this implementation, notably dealing with API changes throughout Gecko. Notably, nsStrings in API's will be discouraged in public API's. These API's will need to be rewritten using nsStrImpl references instead. As an alternative, programmers can pass nsIStrings between
modules. I18n Issues Another concern (mainly of the i18n team) has to do with the use of a 1-byte (ASCII) nsCString at all. The i18n team correctly points out that that anarchy will prevail if judicious control over their use is not mandated. The problem stems from assumptions that programmers make regarding ASCII strings; the typical assumption being that they will never need to interoperate with ...
Mac stub installer - Archive of obsolete content
Build the mac installer (debug or non-debug target) using MIW.mcp Grab a nightly build, say from <http://ftp.mozilla.org/pub/mozilla/n...taller.sea.bin> Drop in the installer binary next to the "Mozilla Installer" in the "Mozilla Installer" folder created by unstuffing the opt build. Run the installer from the opt "Mozilla Installer" folder. Alternative to steps 3 and 4 copy the "Installer
Modules" folder from the "Mozilla Installer" folder into the "macbuild" folder that contains the build debug or non-debug installer binary next to MIW.mcp. Copy the License and Readme from the "Mozilla Installer" folder" to the "macbuild" folder itself. Now run the built installer from the "macbuild" itself or by running it from the MIW.mcp CodeWarrior project. How we get setup to debug the XPInstall ...
...() in the mac installer code and step into xpistub and eventually the XPInstall engine will load including symbols so you can set a break point in the XPInstall engine itself. How do I add an installer package to the Mac installer? Adding a package involves a few steps: Add a section named for your <component> to the packages-mac manifest that describes which files from dist belong to which
module. For example, see the xpcom section that lists all the shared libraries as seen in dist. These are eventually zipped with the directory structure preserved. Read the top of the packages-mac file for it's simple syntax and semantics. Add an <component>.jst install script template file (the jst extension stands for javascript template indicating this is a template for the final install.js for the ...
... packages time with the browser version. $SpaceRequired$ which is replaced at package time with the amount of space in KB required for the package when it is fully extracted. Add a [ComponentX] section to the config.ini template file named config.ini_tmpl found at: <http://lxr.mozilla.org/seamonkey/sou...onfig.ini_tmpl>. ...
...ntX] section to the config.ini template file named config.ini_tmpl found at: <http://lxr.mozilla.org/seamonkey/sou...onfig.ini_tmpl>. Then add the ComponentX into the appropriate Setup Types so the installer
module installs when users select the Setup Types you choose it to be in. Once you add the section to the packages-mac file the release automation will automatically generate an xpi for your
module with a dummy install.js. If it finds your
module's jst file it will substitute that for the install.js. And finally it will do the copying of files from dist per the directives in packages-mac if your
module's section has some file entries. Unfortunately, at the time of this writing there is no convenient way to test an installer build like there is on unix (deliver.pl) and windows (build.pl). ...
Using LDAP XPCOM with XULRunner - Archive of obsolete content
ary and all its dependencies, so as all the needed libraries are loaded. Create a subdirectory extensions/ldapstub in the mozilla source code directory, containing two files, Makefile.in and LDAPStubLoader.cpp: Makefile.in: # Copyright (c) 2005 Benjamin Smedberg <benjamin@smedbergs.us> DEPTH = ../.. ...
...= \ xpcom \ string \ $(NULL) CPPSRCS = LDAPStubLoader.cpp EXTRA_DSO_LDOPTS += \ $(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \ $(XPCOM_FROZEN_LDOPTS) \ $(NSPR_LIBS) \ $(NULL) include $(topsrcdir)/config/rules.mk DEFINES += -DMOZ_DLL_PREFIX=\"$(DLL_PREFIX)\" LDAPStubLoader.cpp: // Copyright (c) 2005 Benjamin Smedberg <benjamin@smedbergs.us> #include "nscore.h" #include "ns
Module.h" #include "prlink.h" #include "nsILocalFile.h" #include "nsStringAPI.h" #include "nsCOMPtr.h" static char const *const kDependentLibraries[] = { #ifdef NS_WIN32 MOZ_DLL_PREFIX "nsldap32v50" MOZ_DLL_SUFFIX, MOZ_DLL_PREFIX "nsldappr32v50" MOZ_DLL_SUFFIX, #endif //NS_WIN32 #ifdef NS_UNIX MOZ_DLL_PREFIX "ldap50" MOZ_DLL_SUFFIX, MOZ_DLL_PREFIX "prldap50" MOZ_DLL_SUFFIX, #endif //NS_UNIX n...
...def NS_WIN32 MOZ_DLL_PREFIX "nsldap32v50" MOZ_DLL_SUFFIX, MOZ_DLL_PREFIX "nsldappr32v50" MOZ_DLL_SUFFIX, #endif //NS_WIN32 #ifdef NS_UNIX MOZ_DLL_PREFIX "ldap50" MOZ_DLL_SUFFIX, MOZ_DLL_PREFIX "prldap50" MOZ_DLL_SUFFIX, #endif //NS_UNIX nsnull }; // component.dll on windows, libcomponent.dll on linux static char kRealComponent[] = MOZ_DLL_PREFIX "mozldap" MOZ_DLL_SUFFIX; nsresult NSGet
Module(nsIComponentManager* aCompMgr, nsIFile* aLocation, nsI
Module* *aResult) { nsresult rv; nsCOMPtr<nsIFile> libraries; rv = aLocation->GetParent(getter_AddRefs(libraries)); if (NS_FAILED(rv)) return rv; nsCOMPtr<nsILocalFile> library(do_QueryInterface(libraries)); if (!library) return NS_ERROR_UNEXPECTED; library->SetNativeLeafName(NS_LITERAL_CSTRING(...
...pendent) { library->SetNativeLeafName(nsDependentCString(*dependent)); PRLibrary *lib; library->Load(&lib); // 1) We don't care if this failed! // 2) We are going to leak this library. We don't care about that either. } library->SetNativeLeafName(NS_LITERAL_CSTRING(kRealComponent)); PRLibrary *lib; rv = library->Load(&lib); if (NS_FAILED(rv)) return rv; nsGet
ModuleProc get
moduleproc = (nsGet
ModuleProc) PR_FindFunctionSymbol(lib, NS_GET_
MODULE_SYMBOL); if (!get
moduleproc) return NS_ERROR_FAILURE; return get
moduleproc(aCompMgr, aLocation, aResult); } Then change your .mozconfig to add this line: ac_add_options --enable-extensions=ldapstub Rebuild XULRunner. This will create a new file in the components subdirectory of the built package, mozld...
Content - Archive of obsolete content
"Getting Started" box, if there is no "Getting Started" article yet written, should be populated with another feature article or tutorial, should one exist. Otherwise, just comment it out Getting Started A guided tutorial that will help you get started with the RSS Content
Module. The RSS Content
Module provides facilities to include content for an <item>. But doing this in more efficient ways. ...
...re article or tutorial, should one exist. Otherwise, just comment it out Getting Started A guided tutorial that will help you get started with the RSS Content
Module. The RSS Content
Module provides facilities to include content for an <item>. But doing this in more efficient ways. Documentation Selected Articles Why RSS Content
Module is Popular - Including HTML Contents Charles Iliya Krempeaux talks about the RSS Content
Module, why it is popular among some, and how it is used to include HTML contents. ...
...is in more efficient ways. Documentation Selected Articles Why RSS Content
Module is Popular - Including HTML Contents Charles Iliya Krempeaux talks about the RSS Content
Module, why it is popular among some, and how it is used to include HTML contents. ...
...to include HTML contents. ...
Element - Archive of obsolete content
RSS Slash
Module Elements NOTE: In the list of elements below the slash XML Namespace prefix is used (since it is a popular choice). However, use of slash as the XML Namespace prefix is NOT necessary. You are free to to choose your own prefix for this. ...
... RSS Slash
Module Elements NOTE: In the list of elements below the slash XML Namespace prefix is used (since it is a popular choice). However, use of slash as the XML Namespace prefix is NOT necessary. You are free to to choose your own prefix for this. ...
... RSS Slash
Module Elements NOTE: In the list of elements below the slash XML Namespace prefix is used (since it is a popular choice). However, use of slash as the XML Namespace prefix is NOT necessary. You are free to to choose your own prefix for this. ...
...choice). However, use of slash as the XML Namespace prefix is NOT necessary. You are free to to choose your own prefix for this. ...
Implementation Status - Archive of obsolete content
instance partial instance element with two child element does not trigger exception 337302; 3.3.3 submission partial No support for @indent and complex schema validation 278761; 278762; 3.3.4 bind partial Using the index() function in binds does not work. 292333; 3.4 Extension
Module unsupported 300760; 3.5 MustUnderstand
Module unsupported 300757; 4. Processing Model (Events) Section Title Status Notes Bugs 4 Processing Model (Events) partial The xforms-recalculate, xforms-revalidate, and xforms-refresh events are not as separated as...
...oose() unsupported 7.11.2 event() supported 7.12 Extension Functions unsupported not a compliance requirement for an XForms processor 8. ...
... 9. ...
... does not work for html:tr, html:td, or xf:group elements 340515; 350617; 9.3.6 itemset supported performance problem with large itemsets 372197; 9.3.7 copy supported 10. XForms Actions Section Title Status Notes Bugs 10 XForms Action
Module n/a 10.1 action supported 10.2 setvalue supported 10.3 insert partial We need to better handle when @at evaluates to NaN, and we do not generate unique values for xsd:ID nodes. 303198; 339217; 10.4 delete partial We...
Index - MDN Web Docs Glossary: Definitions of Web-related terms
gned as a value to a variable. 153 Flex CSS, Flex, Glossary, flexbox flex is a new value added to the CSS display property. Along with inline-flex it causes the element that it applies to to become a flex container, and the element's children to each become a flex item. The items then participate in flex layout, and all of the properties defined in the CSS Flexible Box Layout
Module may be applied. 154 Flex Container CSS, Glossary, flex container, flexbox A flexbox layout is defined using the flex or inline-flex values of the display property on the parent item. This element then becomes a flex container, and each one of its children becomes a flex item. 155 Flex Item CSS, Glossary, flex item, flexbox The direct children of a Flex Co...
... becomes a flex container, and each one of its children becomes a flex item. 155 Flex Item CSS, Glossary, flex item, flexbox The direct children of a Flex Container (elements with display: flex or display: inline-flex set on them) become flex items. 156 Flexbox CSS, Glossary, Intro, flexbox Flexbox is the commonly-used name for the CSS Flexible Box Layout
Module, a layout model for displaying items in a single dimension -- as a row or as a column. 157 Forbidden header name Fetch, Glossary, HTTP, Headers, forbidden A forbidden header name is the name of any HTTP header that cannot be modified programmatically; specifically, an HTTP request header name (in contrast with a Forbidden response header name). 158 Forbidden respon...
...bject to which a given property or method belongs. 317 Parse Browser, CSS, CodingScripting, Glossary, HTML, JavaScript, Web Performance Parsing means analyzing and converting a program into an internal format that a runtime environment can actually run, for example the JavaScript engine inside browsers. 318 Parser CodingScripting, Glossary A parser is the
module of a compiler or interpreter that parses a source code file. 319 Perceived performance Glossary, Perceived Performance, Reference, Web Performance Perceived performance is a subjective measure of how fast a website seems to a user based on load time and site responsiveness. This measure relies on human perception, not an objective metric like time to interactive. 320 ...
...ering with and eavesdropping on email, web browsing, messaging, and other protocols. Both SSL and TLS are client / server protocols that ensure communication privacy by using cryptographic protocols to provide security over a network. When a server and client communicate using TLS, it ensures that no third party can eavesdrop or tamper with any message. 462 Tree shaking JavaScript,
Modules, Statement, Web Performance, export, import, tree shaking Tree shaking is a term commonly used within a JavaScript context to describe the removal of dead code. 463 Trident Browser, Glossary, Infrastructure, Trident Trident (or MSHTML) was a layout engine that powered Internet Explorer. A Trident fork called EdgeHTML replaced Trident in Internet Explorer's successor, E...
Accessibility - Learn web development
We'll cover accessibility in special detail. ...
...b is accessed. The Firefox Accessibility Inspector is a very useful tool for checking out accessibility issues on web pages. The following video provides a nice introduction to it: Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites To get the most out of this
module, it would be a good idea to either work through at least the first two
modules of the HTML, CSS, and JavaScript topics, or perhaps even better, work through the relevant parts of the accessibility
module as you work through the related technology topics. Note: If you are working on a computer/tablet/other devices where you don't have the ability to create your own files, you can try out most of...
... better, work through the relevant parts of the accessibility
module as you work through the related technology topics. Note: If you are working on a computer/tablet/other devices where you don't have the ability to create your own files, you can try out most of the code examples in an online coding program such as JSBin or Glitch. Guides What is accessibility? This article starts off the
module with a good look at what accessibility is -- this includes what groups of people we need to consider and why, what tools different people use to interact with the web, and how we can make accessibility part of our web development workflow. HTML: A good basis for accessibility A great deal of web content can be made accessible just by making sure the correct HTML elements are always used for the...
... how. Mobile accessibility With web access on mobile devices being so popular, and popular platforms such as iOS and Android having fully-fledged accessibility tools, it is important to consider the accessibility of your web content on these platforms. This article looks at mobile-specific accessibility considerations. Assessments Accessibility troubleshooting In the assessment for this
module, we present to you a simple site with several accessibility issues that you need to diagnose and fix. ...
Using your new knowledge - Learn web development
Previous Overview: First steps With the things you have learned in the last few lessons you should find that you can format simple text documents using CSS, to add your own style to them. This assessment gives you a chance to do that. Prerequisites: Before attempting this assessment you should have worked through the rest of the CSS basics
module, and also have an understanding of HTML basics (study Introduction to HTML). Objective: To have a play with some CSS and test your new-found knowledge. Starting point You can work in the live editor below, or you can download the starting point to work with in your own editor. This is a single page with the HTML, plus the starting point CSS in the head of the document. If you prefer you could move this CSS...
...A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. What's next? Congratulations on finishing this first
module. ...
...o get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. What's next? Congratulations on finishing this first
module. You should now have a good general understanding of CSS, and be able to understand much of what is happening in a stylesheet. ...
...sment page, so we can find the question you want help with. What's next? ...
What is CSS? - Learn web development
s, but how does it work under the hood? This article explains what CSS is, with a simple syntax example, and also covers some key terms about the language. Prerequisites: Basic computer literacy, basic software installed, basic knowledge of working with files, and HTML basics (study Introduction to HTML.) Objective: To learn what CSS is. In the Introduction to HTML
module we covered what HTML is, and how it is used to mark up documents. These documents will be readable in a web browser. Headings will look larger than regular text, paragraphs break onto a new line and have space between them. Links are colored and underlined to distinguish them from the rest of the text. What you are seeing is the browser's default styles -- very basic styles that the browser appli...
...hat else you can use as a value. Note: You can find links to all the CSS property pages (along with other CSS features) listed on the MDN CSS reference. Alternatively, you should get used to searching for "mdn css-feature-name" in your favourite search engine whenever you need to find out more information about a CSS feature. For example, try searching for "mdn color" and "mdn font-size"! CSS
Modules As there are so many things that you could style using CSS, the language is broken down into
modules. You'll see reference to these
modules as you explore MDN and many of the documentation pages are organized around a particular
module. For example, you could take a look at the MDN reference to the Backgrounds and Borders
module to find out what its purpose is, and what different properties and...
...on that defines the technology (see below). At this stage you don't need to worry too much about how CSS is structured, however it can make it easier to find information if, for example, you are aware that a certain property is likely to be found among other similar things and are therefore probably in the same specification. For a specific example, let's go back to the Backgrounds and Borders
module -- you might think that it makes logical sense for the background-color and border-color properties to be defined in this
module. And you'd be right. CSS Specifications All web standards technologies (HTML, CSS, JavaScript, etc.) are defined in giant documents called specifications (or simply "specs"), which are published by standards organizations (such as the W3C, WHATWG, ECMA, or Khronos) an...
... Getting started with CSS How CSS is structured How CSS works Using your new knowledge ...
Styling links - Learn web development
find more information about this problem (and solutions) at Fighting the space between inline block elements. ...
...est your skills! ...
...sment to verify that you've retained this information at the end of the
module -- see Typesetting a community school homepage. This assessment tests all the knowledge discussed in this
module, so you might want to read the next article before moving on to it. Summary We hope this article has provided you with all you'll need to know about links -- for now! ...
...ll the knowledge discussed in this
module, so you might want to read the next article before moving on to it. Summary We hope this article has provided you with all you'll need to know about links -- for now! ...
Web fonts - Learn web development
In this article we will go further, exploring web fonts in detail -- these allow you to download custom fonts along with your web page, to allow for more varied, custom text styling. Prerequisites: Basic computer literacy, HTML basics (study Introduction to HTML), CSS basics (study Introduction to CSS), CSS text and font fundamentals. Objective: To learn how to apply web fonts to a web page, using either a third party service, or by writing your own code. ...
...r beginner's course, but if you fancy stretching yourself and looking into them, read our Variable fonts guide. ...
...in our Active Learning sections, but can you remember the most important information going forward? ...
...can find an assessment to verify that you've retained this information at the end of the
module -- see Typesetting a community school homepage. Summary Now that you have worked through our articles on text styling fundamentals, it is time to test your comprehension with our assessment for the
module, Typesetting a community school homepage. ...
Your first form - Learn web development
Overview: Forms Next The first article in our series provides you with your very first experience of creating a web form, including designing a simple form, implementing it using the right HTML form controls and other HTML elements, adding some very simple styling via CSS, and describing how data is sent to a server. We'll expand on each of these subtopics in more detail later on in the
module. Prerequisites: Basic computer literacy, and a basic understanding of HTML. Objective: To gain familiarity with what web forms are, what they are used for, how to think about designing them, and the basic HTML elements you'll need for simple cases. What are web forms? Web forms are one of the main points of interaction between a user and a web site or application.
... what web forms are, what they are used for, how to think about designing them, and the basic HTML elements you'll need for simple cases. What are web forms? Web forms are one of the main points of interaction between a user and a web site or application. Forms allow users to enter data, which is generally sent to a web server for processing and storage (see Sending form data later in the
module), or used on the client-side to immediately update the interface in some way (for example, add another item to a list, or show or hide a UI feature). A web form's HTML is made up of one or more form controls (sometimes called widgets), plus some additional elements to help structure the overall form -- they are often referred to as HTML forms. The controls can be single or multi-line text fields...
... scope of this guide to go deeply into that subject, but if you want to know more, we have provided some examples in our Sending form data article later on. Summary Congratulations, you've built your first web form. It looks like this live: That's only the beginning, however -- now it's time to take a deeper look. ...
...re, we have provided some examples in our Sending form data article later on. Summary Congratulations, you've built your first web form. It looks like this live: That's only the beginning, however -- now it's time to take a deeper look. Forms have way more power than what we saw here and the other articles in this
module will help you to master the rest. ...
Structuring the web with HTML - Learn web development
this topic, you should have at least basic familiarity with using computers and using the web passively (i.e. just looking at it, consuming the content). You should have a basic work environment set up as detailed in Installing basic software, and understand how to create and manage files, as detailed in Dealing with files -- both are parts of our Getting started with the web complete beginner's
module. It is recommended that you work through Getting started with the web before attempting this topic, however, it isn't absolutely necessary; much of what is covered in the HTML basics article is also covered in our Introduction to HTML
module, albeit in a lot more detail. After learning HTML, you can then move on to learning about more advanced topics such as: CSS, and how to use it to style ...
...You should definitely start with the first one. Introduction to HTML This
module sets the stage, getting you used to important concepts and syntax, looking at applying HTML to text, how to create hyperlinks, and how to use HTML to structure a webpage. Multimedia and embedding This
module explores how...
...s and drop shadows, layout your page with multiple columns, add animations and other visual effects.) JavaScript, and how to use it to add dynamic functionality to web pages (for example find your location and plot it on a map, make UI elements appear/disappear when you toggle a button, save users' data locally on their computers, and much much more.)
Modules This topic contains the following
modules, in a suggested order for working through them. You should definitely start with the first one. Introduction to HTML This
module sets the stage, getting you used to important concepts and syntax, looking at applying HTML to text, how to create hyperlinks, and how to use HTML to structure a webpage. Multimedia and embedding This
module explores how to use HTML to include multimedia in your ...
...te hyperlinks, and how to use HTML to structure a webpage. Multimedia and embedding This
module explores how to use HTML to include multimedia in your web pages, including the different ways that images can be included, and how to embed video, audio, and even entire other webpages. HTML tables Representing tabular data on a webpage in an understandable, accessible way can be a challenge. This
module covers basic table markup, along with more complex features such as implementing captions and summaries. Solving common HTML problems Use HTML to solve common problems provides links to sections of content explaining how to use HTML to solve very common problems when creating a webpage: dealing with titles, adding images or videos, emphasizing content, creating a basic form, etc. ...
Introducing asynchronous JavaScript - Learn web development
ipt is, how it differs from synchronous JavaScript, and what use cases it has. Synchronous JavaScript To allow us to understand what asynchronous JavaScript is, we ought to start off by making sure we understand what synchronous JavaScript is. This section recaps some of the information we saw in the previous article. A lot of the functionality we have looked at in previous learning area
modules is synchronous -- you run some code, and the result is returned as soon as the browser can do so. Let's look at a simple example (see it live here, and see the source): const btn = document.querySelector('button'); btn.addEventListener('click', () => { alert('You clicked me!'); let pElem = document.createElement('p'); pElem.textContent = 'This is a newly-added paragraph.'; document.bod...
... of the .then() blocks fail -- in a similar way to synchronous try...catch blocks, an error object is made available inside the catch(), which can be used to report the kind of error that has occurred. Note however that synchronous try...catch won't work with promises, although it will work with async/await, as you'll learn later on. Note: You'll learn a lot more about promises later on in the
module, so don't worry if you don't understand them fully yet. The event queue Async operations like promises are put into an event queue, which runs after the main thread has finished processing so that they do not block subsequent JavaScript code from running. The queued operations will complete as soon as possible then return their results to the JavaScript environment. Promises versus callbacks ...
...nc as well. This can be done by moving it inside another .then() block chained onto the end of the second one, or by simply moving it inside the second then() block. Try fixing this now. Note: If you get stuck, you can find an answer here (see it running live also). You can also find a lot more information on promises in our Graceful asynchronous programming with Promises guide, later on in the
module. Conclusion In its most basic form, JavaScript is a synchronous, blocking, single-threaded language, in which only one operation can be in progress at a time. But web browsers define functions and APIs that allow us to register functions that should not be executed synchronously, and should instead be invoked asynchronously when some kind of event occurs (the passage of time, the user's intera...
...d as soon as possible. If we're running an operation that takes time however, like querying a database and using the results to populate templates, it is better to push this off the main thread and complete the task asynchronously. ...
Asynchronous JavaScript - Learn web development
In this
module we take a look at asynchronous JavaScript, why it is important, and how it can be used to effectively handle potential blocking operations such as fetching resources from a server. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites Asynchronous JavaScript is a fairly advanced topic, and you are advised to work through JavaScript first steps and JavaScript building blocks
modules before attempting this. If you are not familiar with the concept of asynchronous programming, you should definitely start with the General asynchronous programming concepts article in this
module. If you are, then you can probably skip to the Introducing asynchronous Ja...
... Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you can try out (most of) the code examples in an online coding program such as JSBin or Glitch. ...
...iles, you can try out (most of) the code examples in an online coding program such as JSBin or Glitch. Guides General asynchronous programming concepts In this article we'll run through a number of important concepts relating to asynchronous programming, and how this looks in web browsers and JavaScript. You should understand these concepts before working through the other articles in the
module. Introducing asynchronous JavaScript In this article we briefly recap the problems associated with sychronous JavaScript, and take a first look at some of the different asynchronous JavaScript techniques you'll encounter, showing how they can help us solve such problems. Cooperative asynchronous JavaScript: Timeouts and intervals Here we look at the traditional methods JavaScript has availa...
... set up and understand, and so modern browsers have implemented async functions and the await operator. The former allows standard functions to implicitly behave asynchronously with promises, whereas the latter can be used inside async functions to wait for promises before the function continues. This makes chaining promises simpler and easier to read. Choosing the right approach To finish this
module off, we'll consider the different coding techniques and features we've discussed throughout, looking at which ones you should use when, with recommendations and reminders of common pitfalls where appropriate. ...
JavaScript First Steps - Learn web development
In our first JavaScript
module, we first answer some fundamental questions such as "what is JavaScript?", "what does it look like?", and "what can it do?", before moving on to taking you through your first practical experience of writing JavaScript. After that, we discuss some key building blocks in detail, such as variables, strings, numbers and arrays. Looking to become a front-end web developer? ...
...ng on to taking you through your first practical experience of writing JavaScript. After that, we discuss some key building blocks in detail, such as variables, strings, numbers and arrays. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites Before starting this
module, you don't need any previous JavaScript knowledge, but you should have some familiarity with HTML and CSS. You are advised to work through the following
modules before starting on JavaScript: Getting started with the Web (which includes a really basic JavaScript introduction). Introduction to HTML. Introduction to CSS. Note: If you are working on a computer/tablet/other device where you d...
... in string, and joining them together. Useful string methods Now we've looked at the very basics of strings, let's move up a gear and start thinking about what useful operations we can do on strings with built-in methods, such as finding the length of a text string, joining and splitting strings, substituting one character in a string for another, and more. Arrays In the final article of this
module, we'll look at arrays -- a neat way of storing a list of data items under a single variable name. Here we look at why this is useful, then explore how to create an array, retrieve, add, and remove items stored in an array, and more besides. Assessments The following assessment will test your understanding of the JavaScript basics covered in the guides above. Silly story generator In this a...
...riable name. Here we look at why this is useful, then explore how to create an array, retrieve, add, and remove items stored in an array, and more besides. Assessments The following assessment will test your understanding of the JavaScript basics covered in the guides above. Silly story generator In this assessment you'll be tasked with taking some of the knowledge you've picked up in this
module's articles and applying it to creating a fun app that generates random silly stories. Have fun! ...
Web performance - Learn web development
Building websites requires HTML, CSS, and JavaScript. To build websites and applications people want to use, which attract and retain users, you need to create a good user experience. Part of good user experience is ensuring the content is quick to load and responsive to user interaction. This is known as web performance, and in this
module you'll focus on the fundamentals of how to create performant websites. The rest of our beginner's learning material tried to stick to web best practices such as performance and accessibility as much as possible, however, it is good to focus specifically on such topics too, and make sure you are familiar with them. Learning pathway While knowing HTML, CSS, and JavaScript is needed for implementing many web performance improvement recommendations, knowing h...
... good to focus specifically on such topics too, and make sure you are familiar with them. Learning pathway While knowing HTML, CSS, and JavaScript is needed for implementing many web performance improvement recommendations, knowing how to build applications is not a necessary pre-condition for understanding and measuring web performance. ...
...While knowing HTML, CSS, and JavaScript is needed for implementing many web performance improvement recommendations, knowing how to build applications is not a necessary pre-condition for understanding and measuring web performance. We do however recommend that before you work through this
module, you at least get a basic idea of web development by working through our Getting started with the web
module. ...
...erformance improvement recommendations, knowing how to build applications is not a necessary pre-condition for understanding and measuring web performance. We do however recommend that before you work through this
module, you at least get a basic idea of web development by working through our Getting started with the web
module. It would also be helpful to go a bit deeper into these topics, with
modules such as: Introduction to HTML CSS first steps JavaScript first steps Once you've worked through this
module, you'll probably be excited to go deeper into web performance -- you can find a lot of further teachings in our main MDN Web performance section, including overviews of performance APIs, testing and analysis tools, and performance bottleneck gotchas. Guides This topic contains the...
Learning area release notes - Learn web development
our Discourse forum. June 2020 Our Front-end web developer learning pathway is officially launched! Check it out for an opinionated pathway to follow for learning front-end development! Also see our hacks post -- Introducing the MDN Web Docs Front-end developer learning pathway -- for more information about the rationale behind it. ...
...ript frameworks
module is now available. Learn why frameworks exist, when you should use one (and when you shouldn't), what kinds of features are common to all frameworks, and how they relate to the vanilla JavaScript you may already know. Once you have a general understanding of frameworks, move on to tutorial series covering popular frameworks like React, Ember, and Vue. Our Web Forms learning
module now has "Test your skills" assessments accompanying the articles. April 2020 Our new Understanding client-side web development tools
module has been released! Learn the essentials of web development tooling, including what kind of tools exist, the command line, package managers, and how to assemble your own functioning tool chain. March 2020 You'll now find "Test your skills" assessments acco...
... accompanying the articles. April 2020 Our new Understanding client-side web development tools
module has been released! Learn the essentials of web development tooling, including what kind of tools exist, the command line, package managers, and how to assemble your own functioning tool chain. March 2020 You'll now find "Test your skills" assessments accompanying the articles in the following
modules: CSS building blocks JavaScript first steps JavaScript building blocks Introducing JavaScript objects January 2020 The HTML forms
module has been significantly updated: It has been retitled Web forms, and moved out of the HTML topic area to recognise that it covers more than just HTML form elements -- it also covers styling, validation, the basics of how to send data and process it o...
...ed. You can see these on: CSS layout: Flexbox CSS layout: Grids CSS layout: Floats December 2019 We are adding a new type of assessment article to the learning area -- "Test your skills" -- which will offer several short questions aimed at rapidly testing whether you understood what is going on. This is in addition to the longer Assessment articles that you'll find in some of the learning
modules already. You will find these new articles linked in "Test your skills" sections at the bottom of relevant articles. You can see these on: HTML text fundamentals Creating hyperlinks Advanced text formatting Images in HTML Video and audio content From object to iframe -- other embedding technologies ...
Server-side web frameworks - Learn web development
To understand how web frameworks can simplify development/maintenance of server-side code and to get readers thinking about selecting a framework for their own development. The following sections illustrate some points using code fragments taken from real web frameworks. Don't be concerned if it doesn't all make sense now; we'll be working you through the code in our framework-specific
modules. Overview Server-side web frameworks (a.k.a. "web application frameworks") are software frameworks that make it easier to write, maintain and scale web applications. They provide tools and libraries that simplify common web development tasks, including routing URLs to appropriate handlers, interacting with databases, supporting sessions and user authorization, formatting output (e.g. HTML, JSO...
...t. Deno is powered by Tokio -- a Rust-based asynchronous runtime which lets it serve web pages faster. It also has internal support for WebAssembly, which enables the compilation of binary code for use on the client-side. Deno aims to fill in some of the loop-holes in Node.js by providing a mechanism that naturally maintains better security. Deno's features include: Security by default. Deno
modules restrict permissions to file, network, or environment access unless explicitly allowed. TypeScript support out-of-the-box. First-class await mechanism. Built-in testing facility and code formatter (deno fmt) (JavaScript) Browser compatibility: Deno programs that are written completely in JavaScript excluding the Deno namespace (or feature test for it), should work directly in any modern brow...
...popular frameworks, and discussed criteria for choosing a web application framework. You should now have at least an idea of how to choose a web framework for your own server-side development. ...
...a of how to choose a web framework for your own server-side development. If not, then don't worry -- later on in the course we'll give you detailed tutorials on Django and Express to give you some experience of actually working with a web framework. ...
Server-side website programming first steps - Learn web development
However, you do need to understand how the web works. ...
...ming -- "What is it?", "How does it differ from client-side programming?", and "Why is it so useful?". We then provide an overview of some of the most popular server-side web frameworks, along with guidance on how to select the most suitable framework for creating your first site. Finally, we provide a high-level introductory article about web server security. Prerequisites Before starting this
module, you don't need to have any knowledge of server-side website programming, or indeed any other type of programming. However, you do need to understand how the web works. We recommend that you first read the following topics: What is a web server? What software do I need to build a website? How do you upload files to a web server? With that basic understanding, you'll be ready to work your...
...to have any knowledge of server-side website programming, or indeed any other type of programming. However, you do need to understand how the web works. We recommend that you first read the following topics: What is a web server? What software do I need to build a website? How do you upload files to a web server? With that basic understanding, you'll be ready to work your way through the
modules in this section. Guides Introduction to the server side Welcome to the MDN beginner's server-side programming course! In this first article, we look at server-side programming from a high level, answering questions such as "What is it?", "How does it differ from client-side programming?", and "Why it is so useful?". After reading this article, you'll understand the additional power availab...
...t make you a website security guru, but it will help you understand the first important steps you can take to protect your web application against the most common threats. Note: This topic deals with server-side frameworks, and how to use them to create websites. If you are looking for information on client-side JavaScript frameworks, consult our Understanding client-side JavaScript frameworks
module. Assessments This "first steps"
module doesn't have any assessment because we haven't yet shown you any code. We do hope that at this point you have a good understanding of what sorts of functionality you can deliver using server-side programming, and that you have made a decision about what server-side web framework you will use to create your first website. ...
Server-side website programming - Learn web development
Most major websites use some kind of server-side technology to dynamically display data as required. For example, imagine how many products are available on Amazon, and imagine how many posts have been written on Facebook. ...
... basic knowledge will help you work better with the developers creating your client-side web "front end". You will need to understand "how the web works". ...
...you work better with the developers creating your client-side web "front end". You will need to understand "how the web works". We recommend that you first read the following topics: What is a web server What software do I need to build a website? How do you upload files to a web server? With that basic understanding, you'll be ready to work your way through the
modules in this section.
Modules This topic contains the following
modules. You should start with the first
module, then go on to one of the following
modules, which show how to work with two very popular server-side languages using appropriate web frameworks. Server-side website programming first steps This
module provides technology-agnostic information about server-side website programming such as "what is it?", "how d...
...Lastly, an introduction to web server security is provided. ...
Getting started with Svelte - Learn web development
'll need a terminal with node + npm installed to compile and build your app. Objective: To setup a local Svelte development environment, create and build a starter app, and understand the basics of how it works. Svelte: A new approach to building rich user interfaces Svelte provides a different approach to building web apps than some of the other frameworks covered in this
module. While frameworks like React and Vue do the bulk of their work in the user's browser while the app is running, Svelte shifts that work into a compile step that happens only when you build your app, producing highly-optimized vanilla JavaScript. The outcome of this approach is not only smaller application bundles and better performance, but also a developer experience that is more approachable fo...
... at localhost:5000. Svelte will watch for file updates, and automatically recompile and refresh the app for you when changes are made to the source files. Your browser will display something like this: Application structure The starter template comes with the following structure: moz-todo-svelte +-- readme.md +-- package.json +-- package-lock.json +-- rollup.config.js +-- .gitignore +-- node_
modules +-- public | +-- favicon.ico | +-- index.html | +-- global.css | +-- build | +-- bundle.css | +-- bundle.css.map | +-- bundle.js | +-- bundle.js.map +-- src +-- App.svelte +-- main.js The contents are as follows: package.json and package-lock.json: Contains information about the project that Node.js/npm uses to keep it organized. You don't need to unde...
...he contents are as follows: package.json and package-lock.json: Contains information about the project that Node.js/npm uses to keep it organized. You don't need to understand this file at all to complete this tutorial, however, if you'd like to learn more about it, you can read What is the file package.json? on NodeJS.org; we also talk about it in our Package management basics tutorial. node_
modules: This is where node saves the project dependencies. These dependencies won't be sent to production, they are just used for development purposes. .gitignore: Tells git which files or folder to ignore from the project -- useful if you decide to include your app in a git repo. rollup.config.js: Svelte uses rollup.js as a
module bundler. This configuration file tells rollup how to compile and buil...
...te file. Components styles are scoped, keeping them from clashing with each other. In the markup section you can include any JavaScript expression by putting it between curly braces. The top-level variables of a component constitute its state. Reactivity is fired just by assigning a new value to a top level variable. ...
Introduction to automated testing - Learn web development
Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages; an idea of the high level principles of cross-browser testing. Objective: To provide an understanding of what automated testing entails, how it can make your life easier, and how to make use of some of the commercial products that make things easier. Automation makes things easy Throughout this
module we have detailed loads of different ways in which you can test your websites and apps, and explained the sort of scope your cross-browser testing efforts should have in terms of what browsers to test, accessibility considerations, and more. Sounds like a lot of work, doesn't it? We agree -- testing all the things we've looked at in previous articles manually can be a real pain. Fortunately, ther...
...fforts should have in terms of what browsers to test, accessibility considerations, and more. Sounds like a lot of work, doesn't it? We agree -- testing all the things we've looked at in previous articles manually can be a real pain. Fortunately, there are tools to help us automate some of this pain away. There are two main ways in which we can automate the tests we've been talking about in this
module: Use a task runner such as Grunt or Gulp, or npm scripts to run tests and clean up code during your build process. This is a great way to perform tasks like linting and minifying code, adding in CSS prefixes or transpiling nascent JavaScript features for maximum cross-browser reach, and so on. Use a browser automation system like Selenium to run specific tests on installed browsers and return...
...side your npm project directory root to set up gulp as a dependency of your project: npm install --save-dev gulp Now create a new file inside your project directory called gulpfile.js. This is the file that will run all our tasks. Inside this file, put the following: const gulp = require('gulp'); gulp.task('default', function() { console.log('Gulp running'); }); This requires the gulp
module we installed earlier, and then runs a basic task that does nothing except for printing a message to the terminal -- this is useful for letting us know that Gulp is working. Each gulp task is written in the same basic format -- gulp's task() method is run, and given two parameters -- the name of the task, and a callback function containing the actual code to run to complete the task. You can run ...
...ary This was quite a ride, but I'm sure you can start to see the benefits of using automation tools to do some of the heavy lifting in terms of testing. In the next article, we'll look at setting up our own local automation system using Selenium, and how to combine that with services such as Sauce Labs, BrowserStack and TestingBot. ...
Introduction to cross browser testing - Learn web development
Objective: To gain an understanding of the high-level concepts involved in cross browser testing. ...
... can't guarantee everything. As a web developer, you need to agree on a range of browsers and devices that the code definitely needs to work on with the site owner, but beyond that, you need to code defensively to give other browsers the best chance possible of being able to use your content. This is one of the great challenges of web development. Note: We'll cover defensive coding later in the
module too. Why do cross browser issues occur? There are many different reasons why cross browser issues occur, and note that here we are talking about issues where things behave different across different browsers / devices / browsing preferences. Before you even get to cross browser issues, you should have already fixed out bugs in your code (see Debugging HTML, Debugging CSS, and What went wrong? ...
...te: You can find browser support information for technologies by looking up the different features on MDN -- the site you're on! You should also consult caniuse.com, for some further useful details. Once you've agreed on these details, you can go ahead and start developing the site. Development Now on to the development of the site. You should split the different parts of the development into
modules, for example you might split the different site areas up -- home page, product page, shopping cart, payment workflow, etc. You might then further subdivide these -- implement common site header and footer, implement product page detail view, implement persistent shopping cart widget, etc. There are multiple general strategies to cross browser development, for example: Get all the functionali...
... report them: Firefox Bugzilla EdgeHTML issue tracker Safari Chrome Opera Summary This article should have given you a high-level understanding of the most important concepts you need to know about cross browser testing. ...
Setting up your own test automation environment - Learn web development
webdriver syntax. For more complete details, you should consult the selenium-webdriver JavaScript API reference for a detailed reference, and the Selenium main documentation's Selenium WebDriver and WebDriver: Advanced Usage pages, which contain multiple examples to learn from written in different languages. Starting a new test To start up a new test, you need to include the selenium-webdriver
module like this: const webdriver = require('selenium-webdriver'), By = webdriver.By, until = webdriver.until; Next, you need to create a new instance of a driver, using the new webdriver.Builder() constructor. This needs to have the forBrowser() method chained onto it to specify what browser you want to test with this builder, and the build() method to actually build it (see the Builder class...
...k test details programmatically You can use the BrowserStack REST API and some other capabilities to annotate your test with more details, such as whether it passed, why it passed, what project the test is part of, etc. BrowserStack doesn't know these details by default! Let's update our bstack_google_test.js demo, to show how these features work: First, we'll need to import the node request
module, so we can use it to send requests to the REST API. Add the following line at the very top of your code: const request = require("request"); Now we'll update our capabilities object to include a project name -- add the following line before the closing curly brace, remembering to add a comma at the end of the previous line (you can vary the build and project names to organize the tests in di...
...tion with web tools like GitHub and Node. To get started, see for example: Travis CI for complete beginners Building a Node.js project (with Travis) Using LambdaTest with Travis CI Using LambdTest with CircleCI Using LambdaTest with Jenkins Using Sauce Labs with Travis CI Note: If you wish to perform continuous testing with codeless automation then you can use Endtest. ...
...with Jenkins Using Sauce Labs with Travis CI Note: If you wish to perform continuous testing with codeless automation then you can use Endtest. Summary This
module should have proven fun, and should have given you enough of an insight into writing and running automated tests for you to get going with writing your own automated tests. ...
Client-side tooling overview - Learn web development
verwriting each other's work all the time. Git is the source code control system that most people use these days. It is primarily accessed via the command line but can be accessed via friendly user interfaces. With your code in a git repository, you can push it to your own server instance, or use a hosted source control website such as GitHub, GitLab, or BitBucket. We'll be using GitHub in this
module. You can find more information about it at Git and GitHub. Code formatters Code formatters are somewhat related to linters, except that rather than point out errors in your code, they usually tend to make sure your code is formatted correctly, according to your style rules, ideally automatically fixing errors that they find. Prettier is a very popular example of a code formatter, which we'll m...
...tion about it at Git and GitHub. Code formatters Code formatters are somewhat related to linters, except that rather than point out errors in your code, they usually tend to make sure your code is formatted correctly, according to your style rules, ideally automatically fixing errors that they find. Prettier is a very popular example of a code formatter, which we'll make use of later on in the
module. Bundlers/packagers These are tools that get your code ready for production, for example by "tree-shaking" to make sure only the parts of your code libraries that you are actually using are put into your final production code, or "minifying" to remove all the whitespace in your production code, making it as small as possible before it is uploaded to a server. Parcel is a particularly clever to...
...ated. Also click through to the tool pages to find out how many monthly downloads a package has, and whether it has good documentation that you can use to figure out whether it does what you need it to do. Based on these criteria, the date-fns library looks like a good date formatting tool to use. You'll see this tool in action and learn more about package managers in general in Chapter 3 of this
module. If you are looking for a plugin to integrate tool functionality into your code editor, look at the code editor's plugins/extensions page -- see Atom packages and VSCode extensions, for example. Have a look at the featured extensions on the front page, and again, try searching for the kind of extension you want (or the tool name, for example search for "eslint" on the VSCode extensions page). ...
... experience. Summary That rounds off our gentle introduction to the topic of client-side web tooling, from a high level. ...
HTTP logging
eresting" part of the browser's behavior (i.e. your bug), which makes the HTTP log much smaller and easier to analyze. Launch the browser and get it into whatever state you need to be in just before your bug occurs. Open a new tab and type in "about:networking" into the URL bar. Go to the "Logging section" Adjust the location of the log file if you don't like the default Adjust the list of
modules that you want to log: this list has the exact same format as the MOZ_LOG environment variable (see below). Generally the default list is OK, unless a Mozilla developer has told you to modify it. Click on Start Logging. Reproduce the bug (i.e. go to the web site that is broken for you and make the bug happen in the browser) Make a note of the value of "Current Log File". Click on Stop Loggin...
... size of log file(s), and they capture the logging throughout the time Firefox runs, from start to finish. These files can get quite large (gigabytes)! So we have added a 'rotate:SIZE_IN_MB' option to MOZ_LOG (we use it in the examples above). If you are using Firefox >= 51, setting this option saves only the last N megabytes of logging data, which helps keep them manageable in size. (Unknown
modules are ignored, so it's OK to use 'rotate' in your environment even if you're running Firefox <= 50: it will do nothing). This is accomplished by splitting the log into up to 4 separate files (their filenames have a numbered extension, .0, .1, .2, .3) The logging back end cycles the files it writes to, while ensuring that the sum of these files' sizes will never go over the specified limit. Not...
...y splitting the log into up to 4 separate files (their filenames have a numbered extension, .0, .1, .2, .3) The logging back end cycles the files it writes to, while ensuring that the sum of these files' sizes will never go over the specified limit. Note 1: the file with the largest number is not guarantied to be the last file written! We don't move the files, we only cycle. Using the rotate
module automatically adds timestamps to the log, so it's always easy to recognize which file keeps the most recent data. Note 2: rotate doesn't support append. When you specify rotate, on every start all the files (including any previous non-rotated log file) are deleted to avoid any mixture of information. The append
module specified is then ignored. Use 'sync' if your browser crashes or hangs By ...
... This will cause each log message to be immediately written (and fflush()'d), which is likely to give us more information about your crash. Logging only HTTP request and response headers There are two ways to do this: Replace MOZ_LOG=nsHttp:5 with MOZ_LOG=nsHttp:3 in the commands above. ...
Performance
me scripts get evaluated for each tab this means new function objects get instantiated, new constants get computed, block scopes must be set up etc. While it may seem fairly innocencous in this toy example, real scripts often have a lot more functions and initialize some fairly heavyweight objects. BETTER: addon.js as above // framescript.js Components.utils.import("resource://my-addon/process
Module.jsm", {}).addFrame(this) // process
Module.jsm const EXPORTED_SYMBOLS = ['addFrame']; const precomputedConstants = // ... function helper(window, action) { // ... do some work on the window } function doSomething(message) { frameGlobal = message.target result = helper(frameGlobal.content, message.data) frameGlobal.sendAsyncMessage("my-addon:response-from-child", {something: result}) ...
...nction helper(window, action) { // ... do some work on the window } function doSomething(message) { frameGlobal = message.target result = helper(frameGlobal.content, message.data) frameGlobal.sendAsyncMessage("my-addon:response-from-child", {something: result}) } function addFrame(frameGlobal) { frameGlobal.addMessageListener("my-addon:request-from-parent", doSomething) } Javascript
modules are per-process singletons and thus all their objects are only initialized once, which makes them suitable for stateless callbacks. But care must be taken to not leak references to the frame script global when it is passed into a JSM. Alternatively the frame's unload event or weak maps can be used to ensure that frames can be cleaned up when their respective tab is closed. Store heavyweight ...
...ject is kept for each tab. Not only does that increase memory footprint but the deserialization also has to be executed seperately for each tab, thus requiring more CPU time. ...
...cMessage("my-addon:update-configuration", {newConfig: main.serialize()}) } // process
Module.jsm const EXPORTED_SYMBOLS = ['getMainCopy']; var mainCopy; Services.cpmm.addMessageListener("my-addon:update-configuration", function(message) { mainCopy = message.data.newConfig; }) funtion getMainCopy() { return mainCopy; } // framescript.js Components.utils.import("resource://my-addon/process
Module.jsm") // getMainCopy() used by other functions Don't register observers (and other callbacks to global services) in a frame script BAD: //framescript.js Services.obs.addObserver("document-element-inserted", { observe: function(doc, topic, data) { if(doc.ownerGlobal.top != content) return; // bail out if this is for another tab decorateDocument(doc); } }) Observer no...
How to implement a custom autocomplete search component
h interface. Make sure the contract ID of your XPCOM component follows the following form: "@mozilla.org/autocomplete/search;1?name=xxx", where "xxx" is the name of your autocomplete source. Implement the list of matched strings using the nsIAutoCompleteResult interface. The simplest way to make an XPCOM component is to build an XPCOM JavaScript Component (this cannot be done with a JavaScript
module). How to Build an XPCOM Component in Javascript will step you through the process. Because creating an XPCOM component in order to build a custom autocomplete source can be enough to discourage some developers, below is an example JavaScript XPCOM component called "simple-autocomplete" that implements the necessary interfaces. Note: When copying the examples below, change the UUID that uniquely...
...ity with older Gecko versions First copy the following JavaScript code into a file named basic_autocomplete.js into the components directory (or whatever components folder is appropriate in your case): Warning: The UUID used below in chrome.manifest and assigned to CLASS_ID must be changed before use. ...
...nts.results.NS_ERROR_NO_INTERFACE; return this; } }; // Factory var SimpleAutoCompleteSearchFactory = { singleton: null, createInstance: function (aOuter, aIID) { if (aOuter != null) throw Components.results.NS_ERROR_NO_AGGREGATION; if (this.singleton == null) this.singleton = new SimpleAutoCompleteSearch(); return this.singleton.QueryInterface(aIID); } }; //
Module var SimpleAutoCompleteSearch
Module = { registerSelf: function(aCompMgr, aFileSpec, aLocation, aType) { aCompMgr = aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar); aCompMgr.registerFactoryLocation(CLASS_ID, CLASS_NAME, CONTRACT_ID, aFileSpec, aLocation, aType); }, unregisterSelf: function(aCompMgr, aLocation, aType) { aCompMgr = aCompMgr.QueryInterface(Compo...
...actoryLocation(CLASS_ID, aLocation); }, getClassObject: function(aCompMgr, aCID, aIID) { if (!aIID.equals(Components.interfaces.nsIFactory)) throw Components.results.NS_ERROR_NOT_IMPLEMENTED; if (aCID.equals(CLASS_ID)) return SimpleAutoCompleteSearchFactory; throw Components.results.NS_ERROR_NO_INTERFACE; }, canUnload: function(aCompMgr) { return true; } }; //
Module initialization function NSGet
Module(aCompMgr, aFileSpec) { return SimpleAutoCompleteSearch
Module; } Starting in Gecko 2.0, component registration has been changed, so you need to make the following changes: Add an NSGetFactory() function: function NSGetFactory(cid) { if (cid.toString().toUpperCase() != CLASS_ID.toString().toUpperCase()) { throw Components.results.NS_ER...
Sqlite.jsm
Sqlite.jsm offers some compelling advantages over the low-level Storage XPCOM interfaces: Automatic statement management. Sqlite.jsm will create, manage, and destroy statement instances for you. You don't need to worry about caching created statement instances, destroying them when you are done, etc. This translates to fewer lines of code to talk to SQLite. All operations are asynchronous. Use of synchronous Storage APIs is discouraged because they block the main thread. All the functionality in Sqlite.jsm is asynchronous. Easier memory management. ...
... automatically. Simpler transactions. Sqlite.jsm exposes a transaction API built on top of Task.jsm that allows transactions to be written as procedural JavaScript functions (as opposed to a series of callback driven operations). If the function throws, the transaction is automatically rolled back. This makes code easy to write and read. JavaScript-y API. Sqlite.jsm feels like a pure JavaScript
module. ...
...tions (as opposed to a series of callback driven operations). If the function throws, the transaction is automatically rolled back. This makes code easy to write and read. JavaScript-y API. Sqlite.jsm feels like a pure JavaScript
module. The complexities of XPCOM are mostly hidden from view. JavaScript programmers should feel right at home using Sqlite.jsm. Note: The Sqlite.jsm JavaScript code
module can only be used from chrome -- that is, from within the application itself or an add-on. Before you can use this
module, you need to import it into your scope: Components.utils.import("resource://gre/
modules/Sqlite.jsm") Obtaining a Connection Sqlite.jsm exports the Sqlite symbol. This symbol is an object with a single function: openConnection. This function takes an object defining connecti...
...o default value which means no automatic memory minimization will occur. Please note that this is not a timer on the idle service and this could fire while the application is active. openConnection(options) returns a promise that resolves to an opened connection instance or is rejected if an error occurred while opening the database. Here is an example: Components.utils.import("resource://gre/
modules/Sqlite.jsm"); try { const conn = await Sqlite.openConnection({ path: "myDatabase.sqlite", sharedMemoryCache: false }); // connection is the opened SQLite connection (see below for API). } catch (error) { // The connection could not be opened. error is an Error describing what went wrong. } Working with Opened Connections Opened connections are what you will interface most with in Sqlit...
JSS
nologies supported by NSS. JSS also provides a pure Java interface for ASN.1 types and BER/DER encoding. JSS offers a implementation of Java SSL sockets that uses NSS's SSL/TLS implementation rather than Sun's JSSE implementation. You might want to use JSS's own SSL classes if you want to use some of the capabilities found in NSS's SSL/TLS library but not found in JSSE. NSS is the cryptographic
module where all cryptographic operations are performed. JSS essentially provides a Java JNI bridge to NSS C shared libraries. When NSS is put in FIPS mode, JSS ensures FIPS compliance by ensuring that all cryptographic operations are performed by the NSS cryptographic
module. JSS offers a JCE provider, "Mozilla-JSS" JCA Provider notes. JSS, jss4.jar, is still built with JDK 1.4.2. While JDK 1.4.2 is ...
...an continue to add NSS/JSS security fixes/enhancements. JSS is used by Red Hat and Sun products that do crypto in Java. JSS is available under the Mozilla Public License, the GNU General Public License, and the GNU Lesser General Public License. JSS requires NSPR and NSS. ...
...ailable under the Mozilla Public License, the GNU General Public License, and the GNU Lesser General Public License. JSS requires NSPR and NSS. Java provides a JCE provider called SunPKCS11 (see Java PKCS#11 Reference Guide.) SunPKCS11 can be configured to use the NSS
module as the crytographic provider. If you are planning to just use JSS JCE provider as a bridge to NSS's FIPS validated PKCS#11
module, then the SunPKCS11 JCE provider may do all that you need. Note that Java 1.5 claimed no FIPS compliance, and Java 1.6 or higher needs to be used. A current limitation to the configured SunPKCS11-NSS bridge configuration is if you add a PKCS#11
module to the NSS database such as for a smartcard, you won't be able to access that smartcard through the SunPKCS11-NSS bridge. If you use JSS, you can e...
...1 JCE provider may do all that you need. Note that Java 1.5 claimed no FIPS compliance, and Java 1.6 or higher needs to be used. A current limitation to the configured SunPKCS11-NSS bridge configuration is if you add a PKCS#11
module to the NSS database such as for a smartcard, you won't be able to access that smartcard through the SunPKCS11-NSS bridge. If you use JSS, you can easily get lists of
modules and tokens that are configured in the NSS DB and freely access all of it. Documentation Before you use JSS, you should have a good understanding of the crypto technologies it uses. You might want to read these documents: Introduction to Public-Key Cryptography. Explains the basic concepts of public-key cryptography that underlie NSS and JSS. Introduction to SS...
NSS 3.12.4 release notes
ped: \ ( | ) [ ~ except when they occur inside a bracketed expression, where only \ and ] require escaping. New functions in the nss shared library: PK11_IsInternalKeySlot (see pk11pub.h) SECMOD_OpenNewSlot (see pk11pub.h) New error codes (see secerr.h): SEC_ERROR_BAD_INFO_ACCESS_METHOD SEC_ERROR_CRL_IMPORT_FAILED New OIDs (see secoidt.h) SEC_OID_X509_ANY_POLICY The nssckbi PKCS #11
module's version changed to 1.75. Obsolete code for Win16 has been removed. Support for OpenVMS has been removed. Bugs Fixed The following bugs have been fixed in NSS 3.12.4. Bug 321755: implement crlDistributionPoint extension in libPKIX Bug 391434: avoid multiple encoding/decoding of PKIX_PL_OID to and from ascii string Bug 405297: Problems building nss/lib/ckfw/capi/ with MingW GCC Bug 420991: l...
...nly in fips mode. Bug 488396: DBM needs to be FIPS certifiable. ...
...ble to compile nss/cmd/certutil/keystuff.c on WinCE Bug 496961: provide truncated HMAC support for testing tool fipstest Bug 497002: Lab required nspr-free freebl changes. Bug 497217: The first random value ever generated by the RNG should be discarded Bug 498163: assert if profile path contains cyrillic chars. ...
...on alloc success because of a missing ! Bug 504408: pkix_pl_CrlDp_Create will always fail if dp->distPointType != generalName Bug 504456: Exploitable heap overflow in NSS shell expression (filename globbing) parsing Bug 505559: Need function to identify the one and only default internal private key slot. Bug 505561: Need a generic function a la SECMOD_OpenUserDB() that can be used on non-softoken
modules. Bug 505858: NSS_RegisterShutdown can return without unlocking nssShutdownList.lock Bug 507041: Invalid build options for VC6 Bug 507228: coreconf.dep doesn't need to contain the NSS version number Bug 507422: crash [[@ PORT_FreeArena - lg_mkSecretKeyRep] when PORT_NewArena fails Bug 507482: NSS 3.12.3 (and later) doesn't build on AIX 5.1 Bug 507937: pwdecrypt program problems Bug 508259: Pk11mo...
Utilities for nss samples
Extract the password from a text file. Print data as hexadecimal. util.h /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. ...
... * This function supports password extraction from files with * multipe passwords, one for each token. ...
...extraction from files with * multipe passwords, one for each token. ...
...kenName) break; if (PORT_Strncmp(phrase, tokenName, tokenLen)) continue; phraseLen = PORT_Strlen(phrase); if (phraseLen < (tokenLen+1)) continue; if (phrase[tokenLen] != ':') continue; phrase = &phrase[tokenLen+1]; break; } while (i<nb); phrase = PORT_Strdup((char*)phrase); PORT_Free(phrases); return phrase; } /* * Get
ModulePassword */ char* Get
ModulePassword(PK11SlotInfo *slot, int retry, void *arg) { char prompt[255]; secuPWData *pwdata = (secuPWData *)arg; char *pw; if (pwdata == NULL) { return NULL; } if (retry && pwdata->source != PW_NONE) { PR_fprintf(PR_STDERR, "Incorrect password/PIN entered.\n"); return NULL; } switch (pwdata->source) { case PW_...
nss tech note2
Using the PKCS #11
Module Logger NSS Technical Note: 2 Modes of Operation Extracting Output from Log files The logger displays all activity between NSS and a specified PKCS #11
module. It works by inserting a special set of entry points between NSS and the
module. To enable the
module logger, you must set the environment variable NSS_DEBUG_PKCS11_
MODULE to the name of the target
module. For example, to log the softoken, use: NSS_DEBUG_PKCS11_
MODULE="NSS Internal PKCS #11
Module" Note: In the Command Prompt on Windows, do not quote the name of the target
module, otherwise the quotes are considered part of the name. For example, to log the softoken on Windows, use: set NSS_DEBUG_PKCS11_
MODULE=NSS Internal PKCS #11
Module The logger is available by default in debug builds. For o...
...of the name. For example, to log the softoken on Windows, use: set NSS_DEBUG_PKCS11_
MODULE=NSS Internal PKCS #11
Module The logger is available by default in debug builds. For optimized builds, NSS must be built with the variable DEBUG_PKCS11 set. Modes of Operation The logger has several modes of operation: 1. Only display the sequence of PKCS #11 calls. To enable this mode, set: NSPR_LOG_
MODULES=nss_mod_log:1 NSPR_LOG_FILE=<logfile> The output format is: OSThreadID[NSPRThreadID]: C_XXX OSThreadID[NSPRThreadID]: rv = 0xYYYYYYYY For example, 1024[805ef10]: C_Initialize 1024[805ef10]: rv = 0x0 1024[805ef10]: C_GetInfo 1024[805ef10]: rv = 0x0 1024[805ef10]: C_GetSlotList 1024[805ef10]: rv = 0x0 2. Display the sequence of PKCS #11 calls, and the parameters given to them. To enable...
...ILE=<logfile> The output format is: OSThreadID[NSPRThreadID]: C_XXX OSThreadID[NSPRThreadID]: rv = 0xYYYYYYYY For example, 1024[805ef10]: C_Initialize 1024[805ef10]: rv = 0x0 1024[805ef10]: C_GetInfo 1024[805ef10]: rv = 0x0 1024[805ef10]: C_GetSlotList 1024[805ef10]: rv = 0x0 2. Display the sequence of PKCS #11 calls, and the parameters given to them. To enable this mode, set: NSPR_LOG_
MODULES=nss_mod_log:3 NSPR_LOG_FILE=<logfile> The output format is: OSThreadID[NSPRThreadID]: C_XXX OSThreadID[NSPRThreadID]: arg1 = 0xAAAAAAAA ... OSThreadID[NSPRThreadID]: argN = 0xAAAAAAAA OSThreadID[NSPRThreadID]: rv = 0xYYYYYYYY For example, 1024[805ef10]: C_Initialize 1024[805ef10]: pInitArgs = 0x4010c938 1024[805ef10]: rv = 0x0 1024[805ef10]: C_GetInfo 1024[805ef10]: pInfo = 0xbffff...
...[805ef10]: pSlotList = 0x0 1024[805ef10]: pulCount = 0xbffff33c 1024[805ef10]: *pulCount = 0x2 1024[805ef10]: rv = 0x0 Note that when a PKCS #11 function takes a pointer argument for which it will set a value (C_GetSlotList above), this mode will display the value upon return. 3. Display verbose information, including template values, array values, etc. To enable this mode, set: NSPR_LOG_
MODULES=nss_mod_log:4 NSPR_LOG_FILE=<logfile> The output format is the same as above, but with more information. For example, 1024[805ef10]: C_FindObjectsInit 1024[805ef10]: hSession = 0x1000001 1024[805ef10]: pTemplate = 0xbffff410 1024[805ef10]: ulCount = 3 1024[805ef10]: CKA_LABEL = localhost.nyc.rr.com [20] 1024[805ef10]: CKA_TOKEN = CK_TRUE [1] 1024[805ef10]: CKA_CLASS = CKO_CERT...
FC_Initialize
In addition to creating the internal data structures, it performs the FIPS software integrity test and power-up self-tests. ...
...Return value FC_Initialize returns the following return codes. CKR_OK: library initialization succeeded. CKR_ARGUMENTS_BAD pInitArgs is NULL. pInitArgs->LibraryParameters is NULL. only some of the lock functions were provided by the application. CKR_CANT_LOCK: the CKF_OS_LOCKING_OK flag is not set in pInitArgs...
...on of the library parameters string. Return value FC_Initialize returns the following return codes. CKR_OK: library initialization succeeded. CKR_ARGUMENTS_BAD pInitArgs is NULL. pInitArgs->LibraryParameters is NULL. only some of the lock functions were provided by the application. CKR_CANT_LOCK: the CKF_OS_LOCKING_OK flag is not set in pInitArgs->flags. The NSS cryptographic
module always uses OS locking and doesn't know how to use the lock functions provided by the application. CKR_CRYPTOKI_ALREADY_INITIALIZED: the library is already initialized. CKR_DEVICE_ERROR We failed to create the OID tables, random number generator, or internal locks. (Note: we probably should return CKR_HOST_MEMORY instead.) The software integrity test or power-up self-tests failed. The ...
...cking and doesn't know how to use the lock functions provided by the application. CKR_CRYPTOKI_ALREADY_INITIALIZED: the library is already initialized. CKR_DEVICE_ERROR We failed to create the OID tables, random number generator, or internal locks. (Note: we probably should return CKR_HOST_MEMORY instead.) The software integrity test or power-up self-tests failed. The NSS cryptographic
module is in a fatal error state. CKR_HOST_MEMORY: we ran out of memory. Examples #include <assert.h> CK_FUNCTION_LIST_PTR pFunctionList; CK_RV crv; CK_C_INITIALIZE_ARGS initArgs; crv = FC_GetFunctionList(&pFunctionList); assert(crv == CKR_OK); initArgs.CreateMutex = NULL; initArgs.DestroyMutex = NULL; initArgs.LockMutex = NULL; initArgs.UnlockMutex = NULL; initArgs.flags = CKF_OS_LOCKING_OK; ...
NSS environment variables
). Makes NSRANDFILE usable with /dev/urandom. 3.12.3 NSRANDFILE String (file name) Uses this file to seed the Pseudo Random Number Generator. Before 3.0 NSS_ALLOW_WEAK_SIGNATURE_ALG Boolean (any non-empty value to enable) Enables the use of MD2 and MD4 inside signatures. This was allowed by default before NSS 3.12.3. 3.12.3 NSS_DEBUG_PKCS11_
MODULE String (
module name) Name the PKCS#11
module to be traced. PKCS #11
Module Logger 3.6 NSS_DEFAULT_DB_TYPE String ("dbm", "sql", or "extern") Determines the default Database type to open if the app does not specify. NSS_Shared_DB 3.12 NSS_DISABLE_ARENA_FREE_LIST String (any non-empty value) Define this variable to get accurate leak allocation ...
...oftware. NSS_Memory_allocation 3.4 NSS_DISABLE_UNLOAD String (any non-empty value) Disable unloading of dynamically loaded NSS shared libraries during shutdown. Necessary on some platforms to get correct function names when using leak reporting software. 3.11.8 NSS_ENABLE_AUDIT Boolean (1 to enable) Enable auditing of activities of the NSS cryptographic
module in FIPS mode. Audit Data 3.11.2 NSS_ENABLE_PKIX_VERIFY Boolean (any non-empty value to enable) Use libPKIX, rather than the old cert library, to verify certificates. 3.12 NSS_FIPS String ("fips","true","on","1") Will start NSS in FIPS mode. 3.12.5 NSS_HASH_ALG_SUPPORT String Specifies agorithms allowed to be used in certain application...
...es. 3.12 NSS_FIPS String ("fips","true","on","1") Will start NSS in FIPS mode. 3.12.5 NSS_HASH_ALG_SUPPORT String Specifies agorithms allowed to be used in certain applications, such as in signatures on certificates and CRLs. See documentation at this link. 3.12.3 NSS_OUTPUT_FILE String (filename) Output file path name for the PKCS #11
Module Logger. Default is stdout. 3.7 NSS_SDB_USE_CACHE String ("no","yes","auto") Controls whether NSS uses a local cache of SQL database contents. Default is "auto". See the source for more information. 3.12 NSS_SSL_CBC_RANDOM_IV String ("0", "1") Controls the workaround for the BEAST attack on SSL 3.0 and TLS 1.0. "0" disables it, "1" enables it. It is also kno...
...rt safe renegotiation. The default setting for this option is FALSE. 3.12.5 NSS_SSL_SERVER_CACHE_MUTEX_TIMEOUT Integer (seconds) Timeout time to detect dead or hung process in multi-process SSL server. Default is 30 seconds. 3.4 NSS_STRICT_NOFORK String ("1", "DISABLED", or any other non-empty value) It is an error to try to use a PKCS#11 crypto
module in a process before it has been initialized in that process, even if the
module was initialized in the parent process. Beginning in NSS 3.12.3, Softoken will detect this error. This environment variable controls Softoken's response to that error. If set to to "1" or unset, Softoken will trigger an assertion failure in debug builds, and will report an error in non-DEBUG builds. If s...
NSS tools : pk12util
NSS Database Types NSS originally used BerkeleyDB databases to store security...
...nd 2KEY Triple DES-cbc o PKCS12 V2 PBE with SHA1 and 128 Bit RC2 CBC o PKCS12 V2 PBE with SHA1 and 40 Bit RC2 CBC PKCS#5 PBE ciphers o PKCS #5 Password Based Encryption with MD2 and DES CBC o PKCS #5 Password Based Encryption with MD5 and DES CBC o PKCS #5 Password Based Encryption with SHA1 and DES CBC With PKCS#12, the crypto provider may be the soft token
module or an external hardware
module. If the cryptographic
module does not support the requested algorithm, then the next best fit will be selected (usually the default). If no suitable replacement for the desired algorithm can be found, the tool returns the error no security
module can perform the requested operation. NSS Database Types NSS originally used BerkeleyDB databases to store security information. The last versions...
...ected (usually the default). If no suitable replacement for the desired algorithm can be found, the tool returns the error no security
module can perform the requested operation. NSS Database Types NSS originally used BerkeleyDB databases to store security information. The last versions of these legacy databases are: o cert8.db for certificates o key3.db for keys o secmod.db for PKCS #11
module information BerkeleyDB has performance limitations, though, which prevent it from being easily used by multiple applications simultaneously. NSS has some flexibility that allows applications to use their own, independent database engine while keeping a shared database and working around the access issues. Still, NSS requires more flexibility to provide a truly shared security database. In ...
...d database and working around the access issues. Still, NSS requires more flexibility to provide a truly shared security database. In 2009, NSS introduced a new set of databases that are SQLite databases rather than BerkleyDB. These new databases provide more accessibility and performance: o cert9.db for certificates o key4.db for keys o pkcs11.txt, which is listing of all of the PKCS #11
modules contained in a new subdirectory in the security databases directory Because the SQLite databases are designed to be shared, these are the shared database type. The shared database type is preferred; the legacy format is included for backward compatibility. By default, the tools (certutil, pk12util, modutil) assume that the given security databases follow the more common legacy type. Using ...
Utility functions
ter SECKEY_DestroyEncryptedPrivateKeyInfo MXR 3.2 and later SECKEY_DestroyPrivateKeyInfo MXR 3.2 and later SECKEY_DestroyPublicKey MXR 3.2 and later SECKEY_PublicKeyStrength MXR 3.2 and later SECKEY_UpdateCertPQG MXR 3.2 and later SECMOD_AddNew
Module MXR 3.3 and later SECMOD_AddNew
ModuleEx MXR 3.4 and later SECMOD_Delete
ModuleEx MXR 3.12 and later SECMOD_CancelWait MXR 3.9.3 and later SECMOD_CanDeleteInternal
Module MXR 3.5 and later SECMOD_Create
Module MXR 3.4 and later SECMOD_...
... MXR 3.3 and later SECMOD_AddNew
ModuleEx MXR 3.4 and later SECMOD_Delete
ModuleEx MXR 3.12 and later SECMOD_CancelWait MXR 3.9.3 and later SECMOD_CanDeleteInternal
Module MXR 3.5 and later SECMOD_Create
Module MXR 3.4 and later SECMOD_Delete
Module MXR 3.4 and later SECMOD_Find
Module MXR 3.4 and later SECMOD_FindSlot MXR 3.4 and later SECMOD_Free
ModuleSpecList MXR 3.4 and later SECMOD_GetDB
ModuleList MXR 3.9 and later SECMOD_GetDead
ModuleList MXR 3.9 and later SECMOD_GetModul...
... 3.4 and later SECMOD_Free
ModuleSpecList MXR 3.4 and later SECMOD_GetDB
ModuleList MXR 3.9 and later SECMOD_GetDead
ModuleList MXR 3.9 and later SECMOD_Get
ModuleSpecList MXR 3.4 and later SECMOD_HasRemovableSlots MXR 3.9.3 and later SECMOD_Is
ModulePresent MXR 3.2 and later SECMOD_Load
Module MXR 3.4 and later SECMOD_LoadUser
Module MXR 3.4 and later SECMOD_LookupSlot MXR 3.2 and later SECMOD_PubCipherFlagstoInternal MXR 3.4 and later SECMOD_PubMechFlagstoInternal MXR 3.4 and later ...
... 3.2 and later SECMOD_Load
Module MXR 3.4 and later SECMOD_LoadUser
Module MXR 3.4 and later SECMOD_LookupSlot MXR 3.2 and later SECMOD_PubCipherFlagstoInternal MXR 3.4 and later SECMOD_PubMechFlagstoInternal MXR 3.4 and later SECMOD_UnloadUser
Module MXR 3.4 and later SECMOD_Update
Module MXR 3.4 and later SECMOD_UpdateSlotList MXR 3.9.3 and later SECMOD_WaitForAnyTokenEvent MXR 3.9.3 and later SECOID_AddEntry MXR 3.10 and later SECOID_CompareAlgorithmID MXR 3.2 and later SECOID...
NSS tools : pk12util
NSS Database Types NSS originally used BerkeleyDB databases to s...
...it RC2 CBC o PKCS12 V2 PBE with SHA1 and 40 Bit RC2 CBC PKCS#5 PBE ciphers PKCS #5 Password Based Encryption with MD2 and DES CBC o PKCS #5 Password Based Encryption with MD5 and DES CBC o PKCS #5 Password Based Encryption with SHA1 and DES CBC With PKCS#12, the crypto provider may be the soft token
module or an external hardware
module. If the cryptographic
module does not support the requested algorithm, then the next best fit will be selected (usually the default). If no suitable replacement for the desired algorithm can be found, the tool returns the error no security
module can perform the requested operation. NSS Database Types NSS originally used BerkeleyDB databases to store security information. The ...
...ult). If no suitable replacement for the desired algorithm can be found, the tool returns the error no security
module can perform the requested operation. NSS Database Types NSS originally used BerkeleyDB databases to store security information. The last versions of these legacy databases are: o cert8.db for certificates o key3.db for keys o secmod.db for PKCS #11
module information BerkeleyDB has performance limitations, though, which prevent it from being easily used by multiple applications simultaneously. NSS has some flexibility that allows applications to use their own, independent database engine while keeping a shared database and working around the access issues. Still, NSS requires more flexibility to provide a truly shared security d...
...und the access issues. Still, NSS requires more flexibility to provide a truly shared security database. In 2009, NSS introduced a new set of databases that are SQLite databases rather than BerkleyDB. These new databases provide more accessibility and performance: o cert9.db for certificates o key4.db for keys o pkcs11.txt, which is listing of all of the PKCS #11
modules contained in a new subdirectory in the security databases directory Because the SQLite databases are designed to be shared, these are the shared database type. The shared database type is preferred; the legacy format is included for backward compatibility. By default, the tools (certutil, pk12util, modutil) assume that the given security databases follow the more common l...
How to build a binary XPCOM component using Visual Studio
at comes with the gecko-sdk crashes with the DLL's from moztools. Recap: Use the right Gecko SDK for your XULRunner release Use a Microsoft compiler Use pre-built glib-1.2.dll & libIDL-0.6.dll libraries from wintools.zip Download the sample project Here is what the folder structure looks like: Create a VC++ Project Visual Studio project and file templates (or wizards) for creating XPCOM
modules and components do not currently exist. For now, you can use the included XPCOM project that contains a simple XPCOM component. You can use the project as a starting point and modify the component files to add your own functionality. To make the project, you start with a standard multi-thread DLL project. Then make the following tweaks: Add "..\gecko-sdk\include" to Additional Include Directori...
...utorial for more information on the world of XPCOM. Ok then, on with the basic, oversimplified example. Your XPCOM component is made up of 3 parts: Component interface described using IDL. The interface defines the methods, including arguments and return types, of the component. Component implementation using C++. The implementation is where the methods actually do the work. Component factory
module, also in C++. The factory is in charge of creating instances of the implementations. Let's specify a simple interface: #include "nsISupports.idl" [scriptable, uuid(263ed1ba-5cc1-11db-9673-00e08161165f)] interface ISpecialThing : nsISupports { attribute AString name; long add(in long a, in long b); }; Remember to generate your own GUID. The next step is to compile the IDL into a type-libr...
...I put this together from some samples I found on the MDC site: #include "nsIGenericFactory.h" #include "comp-impl.h" NS_GENERIC_FACTORY_CONSTRUCTOR(CSpecialThing) static ns
ModuleComponentInfo components[] = { { SPECIALTHING_CLASSNAME, SPECIALTHING_CID, SPECIALTHING_CONTRACTID, CSpecialThingConstructor, } }; NS_IMPL_NSGET
MODULE("SpecialThings...
...); return NS_OK; } /* long add (in long a, in long b); */ NS_IMETHODIMP CSpecialThing::Add(PRInt32 a, PRInt32 b, PRInt32 *_retval) { *_retval = a + b; return NS_OK; } Lastly, we need to create the
module implementation. I put this together from some samples I found on the MDC site: #include "nsIGenericFactory.h" #include "comp-impl.h" NS_GENERIC_FACTORY_CONSTRUCTOR(CSpecialThing) static ns
ModuleComponentInfo components[] = { { SPECIALTHING_CLASSNAME, SPECIALTHING_CID, SPECIALTHING_CONTRACTID, CSpecialThingConstructor, } }; NS_IMPL_NSGET
MODULE("SpecialThings
Module", components) Assuming you have the right SDK and setup the include and LIB folders correctly, the project should build your XPCOM component. Test Component in a XULRunner Application In ...
nsIPlacesImportExportService
lacesImportExportService.idlScriptable Provides methods for exporting Places data. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISupports Last changed in Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11) In the past, this interface also offered methods for importing Places data, but those methods are now part of the BookmarkHTMLUtils.jsm JavaScript code
module. The interface name has been kept for compatibility reasons for code using the export service. Implemented by: @mozilla.org/import-export-service;1 as a service: var placesImportExportService = Components.classes["@mozilla.org/import-export-service;1"] .getService(Components.interfaces.nsIPlacesImportExportService); Method overview void backupBookmark...
... bookmarks hierarchy to a bookmarks.html file. void exportHTMLToFile( in nsILocalFile aFile ); Parameters aFile An nsILocalFile indicating where to save the new bookmarks.html file. importHTMLFromFile() Obsolete since Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11) Note: This method has been removed; use the BookmarkHTMLUtils.jsm JavaScript code
module instead. Loads the given bookmarks.html file and replaces it with the current bookmarks hierarchy (if aIsInitialImport is true) or appends it (if aIsInitialImport is false). Three nsIObserverService notifications are fired as a result of the import. "bookmarks-restore-begin" is fired just before the import is started. "bookmarks-restore-success" is fired right after the bookmarks are successful...
...le( in nsILocalFile aFile, in boolean aIsInitialImport ); Parameters aFile The HTML file to import into Places. aIsInitialImport Whether this is an initial import or not. importHTMLFromFileToFolder() Obsolete since Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11) Note: This method has been removed; use the BookmarkHTMLUtils.jsm JavaScript code
module instead.Loads the given bookmarks.html file and puts it in the given folder. Three nsIObserverService notifications are fired as a result of the import. "bookmarks-restore-begin" is fired just before the import is started. "bookmarks-restore-success" is fired right after the bookmarks are successfully imported. "bookmarks-restore-failed" is fired right after a failure occurs when importing the b...
...aIsInitialImport Whether or not this is an initial import. importHTMLFromURI() Obsolete since Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Note: This method has been removed; use the BookmarkHTMLUtils.jsm JavaScript code
module instead. Same thing as importHTMLFromFile(), but takes a URI instead. void importHTMLFromURI( in nsIURI aURI, in boolean aIsInitialImport ); Parameters aURI The URI from which to import bookmarks. aIsInitialImport Whether or not this is an initial import. See also BookmarkHTMLUtils.jsm ...
XPCOM reference
This reference describes the interfaces and functions provided by the XPCOM library. In addition, it details the various helper classes and functions, as well as the components, provided by the XPCOM glue library. The contents herein are oriented primarily toward extension developers and people embedding XPCOM in other projects. If you're working on a
module in the Mozilla codebase that's compiled with the MOZILLA_INTERNAL_API flag set, some of these APIs -- the string functions and classes in particular -- are not the ones you should be using. See the XPCOM internal string guide for documentation of the internal string API used within the Mozilla codebase. Core XPCOM functionsXPCOM provides a number of global functions which are used to initialize and shut down the XPCOM librar...
...s was removed in bug 1127201NS_ADDREFMacroNS_ASSERTIONMacroNS_ENSURE_ARG_POINTERMacroNS_ERRORThrows a assertion (NS_ASSERTION) with the text "Error: (error text)", so writes this text to console (stderr) and to debug logs (NSPR logging). This macro is meant for critical errors; like assertions, NS_ERRORs should not be reachable.NS_IF_ADDREFMacroNS_IF_RELEASEMacroNS_RELEASEMacroNS_WARNINGMacronsGet
ModuleProcThis function prototype provides the XPCOM entry-point into a
module.nsIAbCard/Thunderbird3The nsIAbCard interface is used to represent and manipulate cards in the address book. In a big change from the original nsIAbCard, properties are now stored in a hash table instead of as attributes on the interface, allowing it to be more flexible.nsICookie2 MOZILLA 1 8 BRANCHnsIMsgSearchValueDefined in...
...rbird threadpane. This interface isn't ever implemented. It is only used to store constants. For example to sort by date you would pass a function the value:nsMsgViewTypeThe nsMsgViewType interface contains constants used for views in Thunderbird. This interface isn't ever implemented. It is only used to store constants. ...
...re constants. For example to sort by date you would pass a function the value:nsMsgViewTypeThe nsMsgViewType interface contains constants used for views in Thunderbird. This interface isn't ever implemented. It is only used to store constants. ...
Troubleshooting XPCOM components registration
ed and this is the wrong page. Load Failure of Binary Components On the Mozilla trunk (Firefox 3, XULRunner 1.9), components that fail to load will print an error to the Error Console. Chrome errors must be enabled. If the error appears, you can use NSPR logging to see additional information about the failure by running Firefox from a command prompt: rem Close all Firefox windows! set NSPR_LOG_
MODULES=nsNative
ModuleLoader:5 set NSPR_LOG_FILE=C:\Path\to\logfile "C:\Program Files\Mozilla Firefox\firefox.exe" Examining this log for warning and errors may provide valuable clues why the component failed to load. If using Firefox 4 / XULRunner 2.0, make sure that your extension is unpacked and you declared the binary component in your chrome.manifest. See XPCOM changes in Gecko 2.0 Parsing Erro...
...t. See XPCOM changes in Gecko 2.0 Parsing Errors in JavaScript Components The most common reason for components written in JavaScript to fail is that there are parsing errors. These parsing errors should show up in the Error Console if chrome errors are enabled. To learn more about enabling chrome errors, see "How can I see errors in my code" in the Extension FAQs. Registration Failure If the
module is loading correctly but doesn't register its components, try adding calls to Components.utils.reportError("Debug me!"); in NSGet
Module() and other functions to try and find any errors. General hints You may need to delete compreg.dat in your profile folder to force re-registration. This should not occur if you uninstalled/installed your extension via the Extension Manager. When adding a com...
...eck that the directory the component is in is named correctly i.e. $profile/extensions/$plugindirectory/components! Double check your GUIDs in your install.rdf with your sourcecode, and then check them again. Windows-specific hints Use Dependency Walker to check that your dependent libraries are loaded correctly. In Dependency Walker, open the Options menu and select Configure
Module Search Order.... In the bottom right corner of the new dialog, click Browse... and select the directory firefox.exe (or equivalent) is in. In the bottom left corner, click Add Directory. Do not add any other directories; in particular, do not add your extension's (or XULRunner application's) components directory. After clicking OK in the top right, check for any missing dependencies u...
...the directory firefox.exe (or equivalent) is in. In the bottom left corner, click Add Directory. Do not add any other directories; in particular, do not add your extension's (or XULRunner application's) components directory. After clicking OK in the top right, check for any missing dependencies using File -> Open -> firefox.exe (or equivalent). Also check that the function NSGet
Module is exported. You can also use the Profiling feature of Dependency Walker to view failed
module loads while running your application. Open the Profile menu and select Start Profiling.... In the dialog that appears, you can provide command line parameters and click OK to start the application. You will see any
modules that failed to load in the
module list. Note: You should delete compr...
Mozilla
e necessary. Some of them are simply the ones I use because I like them, while others are scripts that I've created to speed up the work. You can in every case choose the program you prefer to do some operations, and you can also decide not to use any of my scripts and manually enter all of the commands by hand. It's your choice! Creating a Login Manager storage
module The Login Manager manages and stores user passwords. Extensions can replace the built-in password storage with their own implementation. This can be useful if you want to integrate a gecko application's password management with an existing password management system, or use your own password storage format or database. So for example, on KDE is is desirable to ...
...Definition Language (IPDL) IPDL, short for "IPC (Inter-process communication) Protocol Definition Language", is a Mozilla-specific language allowing C++ code to pass messages between processes or threads in an organized and secure way. All messages for multi-process plugins and tabs in Firefox are declared in the IPDL language. JavaScript code
modules JavaScript code
modules let multiple privileged JavaScript scopes share code. For example, a
module could be used by Firefox itself as well as by extensions, in order to avoid code duplication. JavaScript libraries from Mozilla projects In addition to Firefox and other applications, Mozilla developers have created a number of useful JavaScript libraries you can use ...
...for getting started with Mozilla code on GitHub. It also lists some interesting GitHub repositories containing Mozilla project code. Mozilla Quirks Mode Behavior The following is a rough list of the differences that exist between Mozilla's standards mode and quirks mode behavior. Mozilla Style System The Style System is the
module of Mozilla's code responsible for the loading and parsing of CSS style sheets, and the computation of computed values for all CSS properties. The handling of those computed values is the responsibility of other parts of the code. Mozilla Style System Documentation See also the style techtalk for more complete although less detailed documentation. ...
...ecko1.8 This document describes some of the changes that have been made to Gecko's XMLHttpRequest implementation since version 1.7 (i.e., the version of Gecko that shipped with Firefox 1.0). These changes only apply to XUL extensions and XUL applications. They do not apply to web applications. XPI Cross-Platform Installer
Module (XPI) is a ZIP file used to install packages, utilizing the XPInstall technology. XPI
modules (so called " Bundles") are employed to install a wide variety of software, including Plugins, Extensions, Themes, and Thunderbird dictionaries. Zombie compartments This page tells you how to detect and avoid zombie compartments, which are a ...
WebAssembly.Instance() constructor - JavaScript
The WebAssembly.Instance() constructor creates a new Instance object which is a stateful, executable instance of a WebAssembly.
Module. Syntax Important: Since instantiation for large
modules can be expensive, developers should only use the Instance() constructor when synchronous instantiation is absolutely required; the asynchronous WebAssembly.instantiateStreaming() method should be used at all other times. new WebAssembly.Instance(
module, importObject); Parameters
module The WebAssembly.
Module object to be instantiated. importObject Optional An object containing the values to be imported into the newly-created Instance, such as functions or WebAssembly.Memory objects. There must be one matching property for each declared import of
module or else a WebAssembly.LinkError is thrown. ...
...ect); Parameters
module The WebAssembly.
Module object to be instantiated. importObject Optional An object containing the values to be imported into the newly-created Instance, such as functions or WebAssembly.Memory objects. There must be one matching property for each declared import of
module or else a WebAssembly.LinkError is thrown. ...
...ning the values to be imported into the newly-created Instance, such as functions or WebAssembly.Memory objects. There must be one matching property for each declared import of
module or else a WebAssembly.LinkError is thrown. ...
...ously instantiating a WebAssembly
module The WebAssembly.Instance() constructor function can be called to synchronously instantiate a given WebAssembly.
Module object, for example: const importObject = { imports: { imported_func: function(arg) { console.log(arg); } } }; fetch('simple.wasm').then(response => response.arrayBuffer() ).then(bytes => { let mod = new WebAssembly.
Module(bytes); let instance = new WebAssembly.Instance(mod, importObject); instance.exports.exported_func(); }) However, the preferred way to get an Instance is through the asynchronous WebAssembly.instantiateStreaming() function, for example like this: const importObject = { imports: { imported_func: function(arg) { console.log(arg); } } }; WebAssembly.instantiateStreaming(fetc...
WebAssembly.Instance - JavaScript
A WebAssembly.Instance object is a stateful, executable instance of a WebAssembly.
Module. Instance objects contain all the Exported WebAssembly functions that allow calling into WebAssembly code from JavaScript. Constructor WebAssembly.Instance() Creates a new Instance object. Instance properties Instance.prototype.exports Returns an object containing as its members all the functions exported from the WebAssembly
module instance, to allow them to be accessed and used by JavaScript. Read-only. ...
...w calling into WebAssembly code from JavaScript. Constructor WebAssembly.Instance() Creates a new Instance object. Instance properties Instance.prototype.exports Returns an object containing as its members all the functions exported from the WebAssembly
module instance, to allow them to be accessed and used by JavaScript. Read-only. ...
... Instance properties Instance.prototype.exports Returns an object containing as its members all the functions exported from the WebAssembly
module instance, to allow them to be accessed and used by JavaScript. Read-only. ...
...ously instantiating a WebAssembly
module The WebAssembly.Instance() constructor function can be called to synchronously instantiate a given WebAssembly.
Module object, for example: const importObject = { imports: { imported_func: function(arg) { console.log(arg); } } }; fetch('simple.wasm').then(response => response.arrayBuffer() ).then(bytes => { let mod = new WebAssembly.
Module(bytes); let instance = new WebAssembly.Instance(mod, importObject); instance.exports.exported_func(); }) The preferred way to get an Instance is asynchronously, for example using the WebAssembly.instantiateStreaming() function like this: const importObject = { imports: { imported_func: function(arg) { console.log(arg); } } }; WebAssembly.instantiateStreaming(fetch('simple...
Lexical grammar - JavaScript
's inside a comment. Any number of lines of code can be disabled this way. Hashbang comments A specialized third comment syntax, the hashbang comment, is in the process of being standardized in ECMAScript (see the Hashbang Grammar proposal). A hashbang comment behaves exactly like a single line-only (//) comment. Instead, it begins with #! and is only valid at the absolute start of a script or
module. Note also that no whitespace of any kind is permitted before the #!. The comment consists of all the characters after #! up to the end of the first line; only one such comment is permitted. The hashbang comment specifies the path to a specific JavaScript interpreter that you want to use to execute the script. An example is as follows: #!/usr/bin/env node console.log("Hello world"); Note: H...
...s by the ECMAScript specification. They have no special functionality at present, but they might at some future time, so they cannot be used as identifiers. These are always reserved: enum The following are only reserved when they are found in strict mode code: implements interface let package private protected public static The following are only reserved when they are found in
module code: await Future reserved keywords in older standards The following are reserved as future keywords by older ECMAScript specifications (ECMAScript 1 till 3). abstract boolean byte char double final float goto int long native short synchronized throws transient volatile Additionally, the literals null, true, and false cannot be used as identifiers in ECMAScript. Reserv...
...rings for more information. `string text` `string text line 1 string text line 2` `string text ${expression} string text` tag `string text ${expression} string text` Automatic semicolon insertion Some JavaScript statements must be terminated with semicolons and are therefore affected by automatic semicolon insertion (ASI): Empty statement let, const, variable statement import, export,
module declaration Expression statement debugger continue, break, throw return The ECMAScript specification mentions three rules of semicolon insertion. 1. A semicolon is inserted before, when a Line terminator or "}" is encountered that is not allowed by the grammar. { 1 2 } 3 // is transformed by ASI into { 1 2 ;} 3; 2. A semicolon is inserted at the end, when the end of the input stream of...
... applying to variable b, because a line terminator occurs between b and ++. a = b ++c // is transformend by ASI into a = b; ++c; 3. A semicolon is inserted at the end, when a statement with restricted productions in the grammar is followed by a line terminator. These statements with "no LineTerminator here" rules are: PostfixExpressions (++ and --) continue break return yield, yield*
module return a + b // is transformed by ASI into return; a + b; Specifications Specification ECMAScript (ECMA-262)The definition of 'Lexical Grammar' in that specification. ...
import.meta - JavaScript
The import.meta object exposes context-specific metadata to a JavaScript
module. It contains information about the
module, like the
module's URL. Syntax import.meta Description The syntax consists of the keyword import, a dot, and the identifier meta. Normally the left-hand side of the dot is the object on which property access is performed, but here import is not really an object. The import.meta object is created by the ECMAScript implementation, with a null prototype. The object is extensible, and its properties are writable, configurable, and enumerable. Examples Using import.meta Given a
module my-
module.js <script type="
module" src="my-
module.js"></script> you can access meta information about the
module using the import.meta object. console.log(import.meta); // { url: "file:/...
...ted by the ECMAScript implementation, with a null prototype. The object is extensible, and its properties are writable, configurable, and enumerable. Examples Using import.meta Given a
module my-
module.js <script type="
module" src="my-
module.js"></script> you can access meta information about the
module using the import.meta object. console.log(import.meta); // { url: "file:///home/user/my-
module.js" } It returns an object with a url property indicating the base URL of the
module. ...
...r/my-
module.js" } It returns an object with a url property indicating the base URL of the
module. This will either be the URL from which the script was obtained, for external scripts, or the document base URL of the containing document, for inline scripts. Note that this will include query parameters and/or hash (i.e., following the ? or #). For example, with the following HTML: <script type="
module"> import './index.mjs?someURLInfo=5'; </script> ..the following JavaScript file will log the `someURLInfo parameter: // index.mjs new URL(import.meta.url).searchParams.get('someURLInfo'); // 5 The same applies when a file imports another: // index.mjs import './index2.mjs?someURLInfo=5'; // index2.mjs new URL(import.meta.url).searchParams.get('someURLInfo'); // 5 Note that while Node.js wil...
... Such file-specific argument passing may be complementary to that used in the application-wide location.href (with query strings or hash added after the HTML file path) (or on Node.js, through process.argv). Specifications Specification import.meta proposal HTML Living StandardThe de...
Testing the Add-on SDK - Archive of obsolete content
then runs these example add-on's test code. cfx testaddons --filter <addon_folder_name>: a suite of tests which run add-ons, which are themseleves tests. This suite builds add-ons which are tests (ie: their main.js script's merely run tests and close firefox when their tests are done), and runs them as cfx run would. cfx testpkgs --filter <file_name>:<test_name>: a suite of tests which run sdk
module unit tests. This suite builds the entire addon-sdk repo as an add-on, like cfx xpi would, then runs the add-on like cfx test would. The majority of the tests run here are
module unit tests, but there are various other tests included here as well. Note: You must remember to run source bin/activate in order to enable cfx first. With JPM JPM tests all use the new toolkit/loader. With jpm (whi...
...y) things more difficult without the Gulp commands provided by the gulpscript.js file in the addon-sdk repo. With gulp installed, and after installing the addon-sdk's npm dependencies, we can run the latter three test suites mentioned for cfx with jpm using the following commands: gulp test:examples --filter <addon_example_folder_name> gulp test:addons --filter <addon_folder_name> gulp test:
modules --filter <file_name>:<test_name> or run all of the tests with gulp test. With Travis If you merely make a pull request for the mozilla/addon-sdk then all of the jpm tests mentioned above will be run on Travis-CI automatically and you will see the pass/fail results with a link to the log in the github pull request. Only on a linux machine at the moment. From Mozilla-Central repository Wi...
...couple of mach commands available, and ofcourse there is the try server if you have access to that. With Mach There are two commands: ./mach mochitest -f jetpack-addon <optional_addon_path>: This runs the test add-ons mentioned for cfx testaddons and gulp test:addons with the older sdk/loader/cuddlefish used with cfx. ./mach mochitest -f jetpack-package <optional_file_path>: This runs the
module unit tests mentioned for cfx testpkgs and gulp test:
modules but in this case with the newer toolkit/loader used with jpm. With Try Server ...
Two Types of Scripts - Archive of obsolete content
a content script. So there are two distinct sorts of JavaScript scripts you might include in your add-on and they have access to different sets of APIs. In the SDK documentation we call one sort "add-on code" and the other sort "content scripts". Add-on Code This is the place where the main logic of your add-on is implemented. Your add-on is implemented as a collection of one or more CommonJS
modules. Each
module is supplied as a script stored under the lib directory under your add-on's root directory. Minimally you'll have a single
module implemented by a script called "main.js", but you can include additional
modules in lib, and import them using the require() function. To learn how to implement and import your own
modules, see the tutorial on Implementing Reusable
Modules. Content Scrip...
... the lib directory under your add-on's root directory. Minimally you'll have a single
module implemented by a script called "main.js", but you can include additional
modules in lib, and import them using the require() function. To learn how to implement and import your own
modules, see the tutorial on Implementing Reusable
Modules. Content Scripts While your add-on will always have a "main.js"
module, you will only need to write content scripts if your add-on needs to manipulate web content. Content scripts are injected into web pages using APIs defined by some of the SDK's
modules such as page-mod and panel. Content scripts may be supplied as literal strings or maintained in separate files and referenced by filename. If they are stored in separate files you should store them under the data ...
... for Add-on Code and Content Scripts The table below summarizes the APIs that are available to each type of script. API Add-on code Content script The global objects defined in the core JavaScript language, such as Math, Array, and JSON. See the reference at MDN. ? ? The require() and exports globals defined by version 1.0 of the CommonJS
Module Specification. You use require() to import functionality from another
module, and exports to export functionality from your
module. If require() is available, then so are the
modules supplied in the SDK. ? ? The console global supplied by the SDK. ? ? Globals defined by the HTML5 specification, such as window, document, and localStorage. ? ? The se...
notifications - Archive of obsolete content
ole. var notifications = require("sdk/notifications"); notifications.notify({ title: "Jabberwocky", text: "'Twas brillig, and the slithy toves", data: "did gyre and gimble in the wabe", onClick: function (data) { console.log(data); // console.log(this.data) would produce the same result. } }); This one displays an icon that's stored in the add-on's data directory. See the self
module documentation for more information. var notifications = require("sdk/notifications"); var self = require("sdk/self"); var myIconURL = self.data.url("myIcon.png"); notifications.notify({ text: "I have an icon!", iconURL: myIconURL }); From Firefox 34, you can use "./myIcon.png" as an alias for self.data.url("myIcon.png"). So you can rewrite the above code like this: var notifications = re...
...ta.url("myIcon.png"); notifications.notify({ text: "I have an icon!", iconURL: myIconURL }); From Firefox 34, you can use "./myIcon.png" as an alias for self.data.url("myIcon.png"). So you can rewrite the above code like this: var notifications = require("sdk/notifications"); var myIconURL = "./myIcon.png"; notifications.notify({ text: "I have an icon!", iconURL: myIconURL }); This
module depends on the underlying system's notification service. If the user's system does not support desktop notifications or if its notifications service is not running: if Firefox was started normally, notifications are logged to Firefox's error console if the user launched Firefox from the command line, notifications are logged to the terminal. Globals Functions notify(options) Displays a t...
...r. Parameters options : object Optional options: Name Type title string A string to display as the message's title. text string A string to display as the body of the message. iconURL string The URL of an icon to display inside the message. It may be a remote URL, a data URI, or a URL returned by the self
module. onClick function A function to be called when the user clicks the message. It will be passed the value of data. data string A string that will be passed to onClick. ...
widget - Archive of obsolete content
In particular, for a simple button, try the action button or toggle button APIs, and for a more complex widget try the toolbar or sidebar APIs. Create a simple user interface for an add-on in Firefox's add-on bar. Usage "Widgets" are small pieces of content that live in the Firefox 4 add-on bar. They can be simple icons or complex web pages. You can attach panels to them that open when they're clicked, or you can define a custom click handler to perform some other action, like opening a web page in a tab. ...
...t contains an image, so it looks like a simple icon: require("sdk/widget").Widget({ id: "mozilla-icon", label: "My Mozilla Widget", contentURL: "http://www.mozilla.org/favicon.ico" }); You can make contentURL point to an HTML or icon file which you have packaged inside your add-on. ...
...el, onClick: function() { // Will not be anchored this.panel.show(); } }); See bug 638142. Private windows If your add-on has not opted into private browsing, then your widget will not appear in any private browser windows. To learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing
module. Examples For conciseness, these examples create their content scripts as strings and use the contentScript property. In your own add-ons, you will probably want to create your content scripts in separate files and pass their URLs using the contentScriptFile property. See Working with Content Scripts for more information. var widgets = require("sdk/widget"); // A basic click-able image widget...
windows - Archive of obsolete content
Enumerate and examine open browser windows, open new windows, and listen for window events. Usage The windows
module provides basic functions for working with browser windows. With this
module, you can: enumerate the currently opened browser windows open new browser windows listen for common window events such as open and close Private windows If your add-on has not opted into private browsing, then you won't see any private browser windows. Private browser windows won't appear in the browserWindows property, you won't receive any window events, and you won't be able to open private windows. To learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing
module. Converting to chrome win...
... able to open private windows. To learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing
module. Converting to chrome windows To convert from the BrowserWindow objects used in this API to the chrome window objects used in the window/utils API, use the viewFor() function exported by the viewFor
module. To convert back the other way, from a chrome window to a BrowserWindow object, use the modelFor() function, exported by the modelFor
module. Here's an example converting from a high-level BrowserWindow to a chrome window, and then back the other way: var { modelFor } = require("sdk/model/core"); var { viewFor } = require("sdk/view/core"); var browserWindows = require("sdk/windows").browserWi...
...is made active. Arguments Window : Listeners are passed the window object that has become active. deactivate Event emitted when the active window is made inactive. Arguments Window : Listeners are passed the window object that has become inactive. BrowserWindow A BrowserWindow instance represents a single open window. They can be retrieved from the browserWindows property exported by this
module. var windows = require("sdk/windows").browserWindows; //Print how many tabs the current window has console.log("The active window has " + windows.activeWindow.tabs.length + " tabs."); // Print the title of all browser windows for (let window of windows) { console.log(window.title); } // close the active window windows.activeWindow.close(function() { console.log("Th...
event/target - Archive of obsolete content
Create objects that broadcast events. Users of the object can listen to the events using the standard on() and once() functions. Usage Many objects in the SDK can broadcast events. For example, a panel instance emits an show event when the panel is shown. With this
module you can create your own objects that emit events. This
module provides an exemplar EventTarget object, that implements an interface for adding and removing event listeners of a specific type. EventTarget is the base class for all objects in SDK on which events are emitted. Also see the tutorial on implementing event targets to get started with this API. Instantiation It's easy to create event target objects, no special arguments are required. const { EventTarget } = require("sdk/event/target"); let target = EventTarge...
...moving listeners EventTarget interface defines API for unregistering event listeners, via removeListener method: target.removeListener('message', onMessage); Emitting events EventTarget interface intentionally does not define an API for emitting events. In majority of cases party emitting events is different from party registering listeners. In order to emit events one needs to use event/core
module instead: let { emit } = require('sdk/event/core'); target.on('hi', function(person) { console.log(person + ' says hi'); }); emit(target, 'hi', 'Mark'); // info: 'Mark says hi' For more details see event/core documentation. More details Listeners registered during the event propagation (by one of the listeners) won't be triggered until next emit of the matching type: let { emit } = require('...
... then such exceptions are logged into a console. Chaining Emitters can also have their methods chained: target.on('message', handleMessage) .on('data', parseData) .on('error', handleError); EventTarget EventTarget is an exemplar for creating an objects that can be used to add / remove event listeners on them. Events on these objects may be emitted via emit function exported by event/core
module. Methods initialize() Method initializes this event source. It goes through properties of a given options and registers listeners for the ones that look like event listeners. on(type, listener) Registers an event listener that is called every time events of specified type are emitted. worker.on('message', function (data) { console.log('data received: ' + data) }); Parameters type : Stri...
frame/hidden-frame - Archive of obsolete content
Experimental Creates Firefox frames (i.e. XUL <iframe> elements) that are not displayed to the user. This is useful in the construction of APIs that load web content not intended to be directly seen or accessed by users, like page-worker. It is also useful in the construction of APIs that load web content for intermittent display, such as panel. Usage The
module exports a constructor function, HiddenFrame, and two other functions, add and remove. HiddenFrame constructs a new hidden frame. add registers a hidden frame, preparing it to load content. remove unregisters a frame, unloading any content that was loaded in it. The following code creates a hidden frame, loads a web page into it, and then logs its title: var hiddenFrames = require("sdk/frame/hidden-frame"); let hiddenFrame = hidd...
... Globals Constructors HiddenFrame(options) Creates a hidden frame. Parameters options : object Required options: Name Type onReady function,array Functions to call when the frame is ready to load content. You must specify an onReady callback and refrain from using the hidden frame until the callback ...
...frame"); let hiddenFrame = hiddenFrames.add(hiddenFrames.HiddenFrame({ onReady: function() { this.element.contentWindow.location = "http://www.mozilla.org/"; let self = this; this.element.addEventListener("DOMContentLoaded", function() { console.log(self.element.contentDocument.title); }, true, true); } })); See the panel
module for a real-world example of usage of this
module. Globals Constructors HiddenFrame(options) Creates a hidden frame. Parameters options : object Required options: Name Type onReady function,array Functions to call when the frame is ready to load content. You must specify an onReady callback and refrain from using the hidden frame until the callback gets called, because hidden frames are not always...
places/bookmarks - Archive of obsolete content
Create, modify, and retrieve bookmarks. Usage This
module exports: three constructors: Bookmark, Group, and Separator, corresponding to the types of objects, referred to as bookmark items, in the Bookmarks database in Firefox two additional functions, save() to create, update, and remove bookmark items, and search() to retrieve the bookmark items that match a particular set of criteria. save() and search() are both asynchronous functions: they synchronously return a PlacesEmitter object, which then asynchronously emits events as the operation progresses and completes. Each retrieved bookmark item represents only a snapshot of state at a specific time. ...
...e, update, and remove bookmark items, and search() to retrieve the bookmark items that match a particular set of criteria. save() and search() are both asynchronous functions: they synchronously return a PlacesEmitter object, which then asynchronously emits events as the operation progresses and completes. Each retrieved bookmark item represents only a snapshot of state at a specific time. The
module does not automatically sync up a Bookmark instance with ongoing changes to that item in the database from the same add-on, other add-ons, or the user. Examples Creating a new bookmark let { Bookmark, save } = require("sdk/places/bookmarks"); // Create a new bookmark instance, unsaved let bookmark = Bookmark({ title: "Mozilla", url: "http://mozilla.org" }); // Attempt to save the bookmark ins...
...thin its group. updated A Unix timestamp indicating when the bookmark was last updated on the platform. Separator Properties group The group instance that the bookmark group lives under. index The index of the bookmark group within its group. updated A Unix timestamp indicating when the bookmark was last updated on the platform. PlacesEmitter The PlacesEmitter is not exported from the
module, but returned from the save and search functions. The PlacesEmitter inherits from event/target, and emits data, error, and end. data events are emitted for every individual operation (such as: each item saved, or each item found by a search query), whereas end events are emitted as the aggregate of an operation, passing an array of objects into the handler. Events data The data event is emitt...
system/child_process - Archive of obsolete content
The SDK versions don't: so when you specify a command you must pass in a complete path to the command or use the env option to set up the child process environment. ...
...The SDK versions don't: so when you specify a command you must pass in a complete path to the command or use the env option to set up the child process environment. ...
...oes not include a write() method for child processes, you must use the "raw" emit event. ...
Add a Context Menu Item - Archive of obsolete content
Here's an add-on that adds a new context menu item. The item is displayed whenever something in the page is selected. ...
...s to construct a context menu item. You don't need to add it: once you have constructed the item, it is automatically added in the correct context. The constructor in this case takes four options: label, context, contentScript, and onMessage. label The label is just the string that's displayed. context The context describes the circumstances in which the item should be shown. The context-menu
module provides a number of simple built-in contexts, including this SelectionContext(), which means: display the item when something on the page is selected. If these simple contexts aren't enough, you can define more sophisticated contexts using scripts. contentScript This attaches a script to the item. In this case the script listens for the user to click on the item, then sends a message to the a...
... ...
Creating annotations - Archive of obsolete content
In particular, for a simple button, try the action button or toggle button APIs, and for a more complex widget try the toolbar or sidebar APIs. We'll use two objects to create annotations: a page-mod to find page elements that the user can annotate, and a panel for the user to enter the annotation text itself. ...
... send the content script a message with the current activation status add the worker to an array called selectors so we can send it messages later on assign a message handler for messages from this worker. If the message is show we will just log the content for the time being. If the message is detach we remove the worker from the selectors array. ...
...vent.keyCode == 13) { self.postMessage(textArea.value); textArea.value = ''; } }; self.on('message', function() { var textArea = document.getElementById('annotation-box'); textArea.value = ''; textArea.focus(); }); Save this inside data/editor as annotation-editor.js. Updating main.js Again Now we'll update main.js again to create the editor and use it. ...
Developing for Firefox Mobile - Archive of obsolete content
to have learned the basics of jpm. Firefox for Android implements its UI using native Android widgets instead of XUL. With the add-on SDK you can develop add-ons that run on this new version of Firefox Mobile as well as on the desktop version of Firefox. You can use the same code to target both desktop Firefox and Firefox Mobile, and use jpm-mobile instead of the normal jpm. Right now not all
modules are fully functional, but we're working on adding support for more
modules. The tables at the end of this guide list the
modules that are currently supported on Firefox Mobile. This tutorial explains how to run SDK add-ons on an Android device connected via USB to your development machine. We'll use the Android Debug Bridge (adb) to communicate between the Add-on SDK and the device. It's pos...
...SDK. Make sure the "platform-tools" directory is in your path. Then type: adb devices You should see some output like: List of devices attached 51800F220F01564 device (The long hex string will be different.) If you do, then adb has found your device and you can get started. Running Add-ons on Android You can develop your add-on as normal, as long as you restrict yourself to the supported
modules. When you need to run the add-on, first ensure that Firefox is not running on the device. Then execute jpm-mobile run with some extra options: jpm-mobile run --adb /path/to/adb In the command shell, you should see something like: Launching mobile application with intent name org.mozilla.fennec Pushing the addon to your device Starting: Intent { act=android.activity.MAIN cmp=org.mozilla.fenn...
...vice is a little tricky. The easiest way is probably to copy the signed XPI somewhere on the device: adb push my-addon.xpi /mnt/sdcard/ Then open Firefox Mobile and type this into the address bar: file:///mnt/sdcard/my-addon.xpi The browser should open the XPI and ask if you want to install it. Afterwards you can delete it using adb as follows: adb shell cd /mnt/sdcard rm my-addon.xpi
Module Compatibility
Modules not supported in Firefox Mobile are marked in the tables below. High-Level APIs addon-page Not supported base64 Supported clipboard Not supported context-menu Not supported hotkeys Supported indexed-db Supported l10n Supported notifications Supported page-mod Suppor...
Tutorials - Archive of obsolete content
Add a toolbar button Attach a button to the Firefox Add-on toolbar. Add a menu item to Firefox Add items to Firefox's main menus. Display a popup Display a popup dialog implemented with HTML and JavaScript. Add a context menu item Add items to Firefox's context menu. Interact with the browser Open a web page Open a web page in a new browser tab or window using the tabs
module, and access its content. Listen for page load Use the tabs
module to get notified when new web pages are loaded, and access their content. Get the list of open tabs Use the tabs
module to iterate through the currently open tabs, and access their content. Modify web pages Modify web pages based on URL Create filters for web pages based on their URL: whenever a web page whose...
...b pages Modify web pages based on URL Create filters for web pages based on their URL: whenever a web page whose URL matches the filter is loaded, execute a specified script in it. Modify the active web page Dynamically load a script into the currently active web page. Development techniques Logging Log messages to the console for diagnostic purposes. Creating reusable
modules Structure your add-on in separate
modules to make it easier to develop, debug, and maintain. Create reusable packages containing your
modules, so other add-on developers can use them too. Unit testing Writing and running unit tests using the SDK's test framework. Chrome authority Get access to the Components object, enabling your add-on to load and use any XPCOM object. Creating event t...
...e SDK's test framework. Chrome authority Get access to the Components object, enabling your add-on to load and use any XPCOM object. Creating event targets Enable the objects you define to emit their own events. Listen for load and unload Get notifications when your add-on is loaded or unloaded by Firefox, and pass arguments into your add-on from the command line. Using third-party
modules (jpm) Install and use additional
modules which don't ship with the SDK itself. Localization Writing localizable code. Mobile development Develop add-ons for Firefox Mobile on Android. Add-on Debugger Debug your add-on's JavaScript. Putting it together Annotator add-on A walkthrough of a relatively complex add-on. ...
Downloading Files - Archive of obsolete content
ding files may not work as expected after Firefox 26, and should no longer be used. Please use Downloads.jsm instead. Downloading files To download a file, create an instance of nsIWebBrowserPersist and call its nsIWebBrowserPersist.saveURI() method, passing it a URL to download and an nsIFile instance representing the local file name/path. ...
..._FLAGS_FROM_CACHE | persist.PERSIST_FLAGS_REPLACE_EXISTING_FILES; persist.saveURI(uriToSave, null, null, null, "", targetFile, privacy); If you don't need detailed progress information, you might be happier with nsIDownloader. ...
...ce to an object that implements nsIAuthPrompt. Normally, nsIAuthPrompt expects a prompt to be displayed so the user can enter credentials, but you can return a username and password credentials directly without prompting the user. If you want to open a login prompt, you can use the default prompt by calling the window watcher's getNewAuthPrompter() method. Components.utils.import("resource://gre/
modules/PrivateBrowsingUtils.jsm"); const WebBrowserPersist = Components.Constructor("@mozilla.org/embedding/browser/nsWebBrowserPersist;1", "nsIWebBrowserPersist"); var persist = WebBrowserPersist(); // Obtain the privacy context of the browser window that the URL // we are downloading comes from. If, and only if, the URL is not // related to a window...
Preferences - Archive of obsolete content
var prefService = Components.classes["@mozilla.org/preferences-service;1"] .getService(Compon...
...icate default values in various parts of your code. The code for reading preferences is simplified, since you don't need to worry about the get methods throwing exceptions. ...
... FIXME: ...
Appendix: What you should know about open-source software licenses - Archive of obsolete content
d Eclipse Public License (EPL) are similar in substance. Because the CPL is written in such a way that it does not mention any software or company by name, you can use the CPL if you plan to use this kind of licensing. License characteristics If you modify source code that was published under this license, you are obliged to release it under the same license. However, if you develop an original
module as an addition to it, that restriction does not apply. So plug-ins and the like can be released under different licenses. Also, because source code released under this license may include patented code, that fact must be disclosed. Pros and cons I consider the MPL to be an extremely well balanced OSS license. It makes explicit that any modifications of code released under it must also be relea...
... are using OSS source code, and participating in open-source projects. Circumstances of application First I'll explain what kind of license to use depending on whether you are modifying existing OSS source code or writing original software. Check the license If you are working from existing code, first check its license. If you have the source code at hand, open it and take a look. Almost all
module files will give the license text or license declaration at the top. Source code using Modified BSD or MPL will give the text of the license at the top; if it's GPL or LGPL, there will be a license declaration. The full text of the license should also appear packaged in the same archive as the source code. If you've modified existing source code If you are modifying existing source code, you nee...
...u the freedom to duplicate, distribute, and modify source code, but if you want to contribute those modifications back to the core project, the project's acceptance is an entirely different matter. Developers who contribute to the free office suite OpenOffice.org are requested to enter into a joint copyright assignment with Sun Microsystems, the initial developer. Despite the fact that different
modules have different copyright holders, and overall license management is complicated, by taking this contract as a kind of proxy letter, Sun is able to make changes to the OpenOffice.org license by itself. Trademarks and patents Software is treated as a copyrighted work under copyright law, but the rights that attend software are not limited to copyright: software is also covered by patent and trad...
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
ods containing tests that start with testhoge are recognized as tests. MozUnit uses the same kind of notation, but you can also make the string the method name, making the test self-documenting. Pretty clever. ...
...g tests that start with testhoge are recognized as tests. MozUnit uses the same kind of notation, but you can also make the string the method name, making the test self-documenting. Pretty clever. ...
...e are recognized as tests. MozUnit uses the same kind of notation, but you can also make the string the method name, making the test self-documenting. Pretty clever. ...
XPCOM Objects - Archive of obsolete content
nent: the IDL interface file, and the implementation JS file. In your final extension XPI you'll need to include the JS implementation file, and the XPT file, which is a compiled version of your IDL file. You won't need the IDL or XPT files if your components only use pre-existing Firefox interfaces. In this case you may also find it easier to implement your component using JSM and the XPCOMUtils
module. Download this version of the Hello World project with XPCOM to see how XPCOM files are structured in the project and built. (Your build will probably break, we'll cover this later on.) In the components directory, the file xsIHelloCounter.idl has the following contents: #include "nsISupports.idl" /** * Counter for the Hello World extension. Keeps track of how many times the * hello world...
... the code looks long and complicated, but it is pretty much the same for all components, so you shouldn't worry too much about it. All you have to do to use it in other components is copy it and change some names. The purpose of this code is to register the component so that you can get references to it just like all other Firefox components. It is better read from bottom to top. function NSGet
Module(aCompMgr, aFileSpec) { return Counter
Module; } This piece of code is the first one that Firefox looks for in all implementation files in the components directory. It simply returns the object that precedes it. var Counter
Module = { // registerSelf, unregisterSelf, getClassObject, canUnload }; The only thing you may need to change here is when you need to use the Category Manager. The...
... are included in the section Setting up a Development Environment. C++ XPCOM Components C++ XPCOM components are no longer supported in Firefox extensions. They are only available to code built into Firefox itself. If you are writing an extension and need to interact with 3rd-party binary code, the best way to do that is to use the system/child_process IPC layer from the Addon SDK. The c-types
module is also available as a bridge to load and use shared libraries from extension code. << PreviousNext >> This tutorial was kindly donated to Mozilla by Appcoast. ...
Tabbed browser - Archive of obsolete content
m, but will work equally well for other XUL elements. This will only work in an overlay of browser.xul. XUL: <menuitem oncommand="myExtension.foo(event)" onclick="checkForMiddleClick(this, event)" label="Click me"/> JS: var myExtension = { foo: function(event) { openUILink("http://www.example.com", event, false, true); } } Opening a URL in an on demand tab Cu.import("resource://gre/
modules/XPCOMUtils.jsm"); XPCOMUtils.defineLazyServiceGetter(this, "gSessionStore", "@mozilla.org/browser/sessionstore;1", "nsISessionStore"); // Create new tab, but don't load the content. var url = "https://developer.mozilla.org"; var tab = gBrowser.addTab(null, {relatedToCurrent: true}); gSessionStore.setTabState(tab, JSON.string...
...rowser.getBrowserForDocument(domWin.top.document); } catch (e) { dump(e + "\n"); return null; } } Getting the browser that fires the http-on-modify-request notification (example code updated for loadContext) Here an example of the previous section is shown. The previous section was left intact so people can see the old way of doing things. ...
... stuff } else { Components.utils.reportError('EXCEPTION: Load Context Not Found!!'); //this is likely no big deal as the channel proably has no associated window, ie: the channel was loading some resource. ...
Modularization techniques - Archive of obsolete content
The mechanism we're using is based on the principles laid down by COM, so pretty much anything you know about COM can be applied here, and any reference on COM can provide you with more interesting and complex examples than the ones provided here. The Basics Interfaces The basic building blocks of
modules are C++ pure virtual interfaces. ...
...all the information you need to create a new Mozilla
Module or break existing code into a
module. The mechanism we're using is based on the principles laid down by COM, so pretty much anything you know about COM can be applied here, and any reference on COM can provide you with more interesting and complex examples than the ones provided here. The Basics Interfaces The basic building blocks of
modules are C++ pure virtual interfaces. A pure virtual interface is simply a class where every method is defined as pure virtual, that is: virtual int foo(int bar) = 0; Pure virtual interfaces provide an easy mechanism for passing function tables between
modules that may reside in separate, possibly dynamically loaded, libraries. Each interface is assigned a unique Interface Identifier, or IID. nsI...
...tion and creation details of an object, an extremely important step for allowing maximum flexibility in the implementation of a class and reducing compile time dependencies. It can even be used to eliminate all link time dependencies on the class and its factory entirely. The Component Manager One of the major goals of our modularization is to remove link time dependencies. So how do you find a
module if you've never linked with it? We've created something called the nsComponentManager. The nsComponentManager is simply a mapping of class IDs to factories and their containing libraries. class nsComponentManager { public: // Finds a factory for a specific class ID static nsresult FindFactory(const nsCID &aClass, nsIFactory **aFactory); // Creates a class inst...
Mozilla Application Framework in Detail - Archive of obsolete content
applications that look and run as intended across a variety of platforms and devices. This saves developers time and money while allowing them to deliver state-of-the-art content and web applications. Gecko features full support for open Internet standards such as CSS1, HTML 4.0, DOM1, RDF, XML and JavaScript. Modular, Embeddable: Gecko's modular architecture enables developers to add or remove
modules with little effort, fitting the software to the available hardware and adjusting functionality to match product requirements. Gecko is implemented as a collection of XPCOM components that can be easily added or removed. Flexible programming interfaces such as the Web Shell API, the Java wrapper API and the Gecko ActiveX Control make Gecko easily embeddable into applications and devices. Full Br...
... complete access to the modular source code and freedom to freely license the source, make changes and build customized versions to accommodate their individual needs. Free: Gecko is free of charge. There is no charge for using the Gecko browser engine or Gecko Technologies, including distributing Gecko inside another product. Furthermore, when embedding Gecko, developers are free to choose what
modules to include. There is no requirement for distribution of any other software. The Necko Network Library Mozilla's Network library (aka Necko) provides an extensible, platform-independent API for several layers of networking from transport to presentation layers. Its provides a generic and extensible framework for fetching URLs with support for common protocols (http, ftp, file, etc.) and a way to...
...r WSDL... Mozilla engineers have written and are in the process of refining a new security model for web services that will ease the deployment of applications using web services while maintaining the security of sites inside the user's firewall. More Information Using the Mozilla SOAP API (an article written for the Apple Developer Connection) XML Extras (the home page for the XML Extras code
module, which contains Mozilla's web services support) SOAP Scripts in Mozilla (documentation on SOAP in Mozilla from the engineer who implemented it) XPInstall, Mozilla's Cross Platform Installation Technology One of the many things that makes the Mozilla platform easy for both users and developers is that applications can be installed, extended, or upgraded with simple web page links. The technology...
Mozilla Crypto FAQ - Archive of obsolete content
be directed to the netscape.public.mozilla.license newsgroup or the associated mozilla-license mailing list. Will mozilla.org accept new contributions of crypto code? Yes, as long as patent or other legal issues do not prevent such code from being used by the general community of Mozilla developers. New contributions of crypto code should also be reviewed and approved by the appropriate Mozilla
module owners, just as with any other Mozilla contributions. For more information about patents related to cryptographic algorithms and implementation techniques, see the questions relating to patents on cryptography in RSA Laboratories' cryptography FAQ. See the Mozilla open source PKI projects pages for the names and email addresses of the Mozilla
module owners for crypto-related code. What about Mo...
...opers creating products for commercial sale and distribution). Also note that Mozilla support for PGP and other security schemes may also be made available by commercial security vendors or by independent developers, using the various public APIs already present in Mozilla. Based on statements made in various Internet forums it appears that the developers of GNU Privacy Guard may create a plugin
module to support invocation of GnuPG functionality from Mozilla; Network Associates may also create a commercial PGP plugin for Mozilla. You should contact those vendors or developers directly for more information concerning their plans. See the Open Directory references for general PGP information, including contact information for companies and independent developers producing PGP implementations. ...
...al PKI source code from iPlanet E-Commerce Solutions includes some documentation on the format of the key and certificate database. As with Mozilla documentation in general, mozilla.org will be glad to host any other documentation contributed to describe database formats, APIs, and other technical aspects of the released SSL, S/MIME, and PKI source code. However, as with APIs internal to Mozilla
modules, mozilla.org cannot guarantee that the format of the key and certificate database will remain unchanged over time; in particular, changes may be introduced at some point that break compatibility with existing applications. Also, changing the database directly from an application risks causing database corruption and subsequent problems in PSM and applications like Mozilla using PSM. For these re...
How to implement a custom XUL query processor component - Archive of obsolete content
a dummy value. An empty string would be ok too. The querytype is important. It is used to create an instance of our XPCOM object. The contract id of our XPCOM component should be of the form "@mozilla.org/xul/xul-query-processor;1?name=xxx", where the xxx is the querytype used in the XUL template block. ...
...A few explanatory notes: We are using a the getBindingFor rather than getBindingObjectFor to simplify the code. The variable passed into getBindingFor still has the "?" prepended to it, so be sure to handle it appropriately. We are not handling any datasources, but instead hard ...
...A few explanatory notes: We are using a the getBindingFor rather than getBindingObjectFor to simplify the code. The variable passed into getBindingFor still has the "?" prepended to it, so be sure to handle it appropriately. We are not handling any datasources, but instead hard code the datasource in the component. You could easily e...
Building XULRunner with Python - Archive of obsolete content
ension on Windows and while generally useful it is written based on experiences with accessibility projects. See also XULRunner. Or, if you are interested in working with XULRunner with Python on Linux, see Mark Lise's Post With the Python extensions enabled XULRunner provides python script access to the DOM and XPCOM in addition to the usual Java Script. This gives access to Python features and
modules and builds on Mark Hammond's pyXPCOM work from Active State. XPCOM components can also be created in Python. Currently (Mar 07) Python is not enabled by default so a custom build of Mozilla is needed. This page provides instructions in the hope of eliminating much trial and error. You should also read the the developer documentation on source code and building as wells as PyXPCOM XULRunner wit...
... is used withtype="application/x-python" attribute. DOM scripting is pretty much as with Java Script. For example def onLoad(): btnTest = document.getElementById("btnTest") btnTest.addEventListener('command', onTest, False) def onTest(): window.alert('Button activated') window.addEventListener('load', onLoad, False) One possible gotcha is that the default python path used to find
modules that areimported explicitly includes the xulrunner executable directory and the directory that is current when XULRunner launches. However it does not include any path related to the XUL application being run. Some work around will need to be found. Unhandled exceptions are displayed in the JavaScript Error Console which can be opened usingxulrunner -jsconsole. One solution is to puttry .... ex...
...bie will keep old code open and cause confusion when you make changes and run xulrunner again. Deploying Python must be installed on the target machine. Perhaps eventually a XULRunner with a minimal Python installation can be generated with something like py2exe or pyInstaller. Untill then simply deploy thedist\bin folder and the XUL application. Don't copy any.pyo files that exist for python
modules in the application or errors will occur on the target machine. It is possible to test for python in a batch file using something like rem Check Python 2.5 installed reg query "HKLM\SOFTWARE\Python\PythonCore\2.5" > nul 2>&1 || reg query "HKCU\SOFTWARE\Python\PythonCore\2.5" > nul 2>&1 if errorlevel 1 ( echo Python 2.5 was not found. Please install it. echo Exiting... pause exit...
CommandLine - Archive of obsolete content
erfaces.nsISupports; const nsICategoryManager = Components.interfaces.nsICategoryManager; const nsIComponentRegistrar = Components.interfaces.nsIComponentRegistrar; const nsICommandLine = Components.interfaces.nsICommandLine; const nsICommandLineHandler = Components.interfaces.nsICommandLineHandler; const nsIFactory = Components.interfaces.nsIFactory; const nsI
Module = Components.interfaces.nsI
Module; const CLASS_ID = Components.ID("178cfbb6-503c-11dc-8314-0800200c9a66"); const CLASS_NAME = "ApplicationNameCLH"; const CONTRACT_ID = "@example.com/applicationname/clh;1"; const CLD_CATEGORY = "m-applicationname"; var appHandler = { /* nsISupports */ QueryInterface : function clh_QI(aIID) { if (aIID.equals(nsICommandLineHandler) || ...
...s(aCmdLine, "commandline-args-changed", null); }, helpInfo : " -test <value> A test attribute\n", /* nsIFactory */ createInstance : function mdh_CI(aOuter, aIID) { if (aOuter != null) { throw Components.results.NS_ERROR_NO_AGGREGATION; } return this.QueryInterface(aIID); }, lockFactory : function mdh_lock(aLock) { /* no-op */ } }; var appHandler
Module = { /* nsISupports */ QueryInterface : function mod_QI(aIID) { if (aIID.equals(nsI
Module) || aIID.equals(nsISupports)) return this; throw Components.results.NS_ERROR_NO_INTERFACE; }, /* nsI
Module */ getClassObject : function mod_gch(aCompMgr, aCID, aIID) { if (aCID.equals(CLASS_ID)) return appHandler.QueryInterface(aIID); throw components.resul...
...mpReg = aCompMgr.QueryInterface(nsIComponentRegistrar); compReg.unregisterFactoryLocation(CLASS_ID, aLocation); var catMan = Components.classes["@mozilla.org/categorymanager;1"] .getService(nsICategoryManager); catMan.deleteCategoryEntry("command-line-handler", CLD_CATEGORY); }, canUnload : function (aCompMgr) { return true; } }; function NSGet
Module(aCompMgr, aFileSpec) { return appHandler
Module; } Create an observer that will get notified when arguments change: chrome/content/cmdline.js function CommandLineObserver() { this.register(); } CommandLineObserver.prototype = { observe: function(aSubject, aTopic, aData) { var cmdLine = aSubject.QueryInterface(Components.interfaces.nsICommandLine); var test = cmdLine.handleFlagWi...
Slash - Archive of obsolete content
Getting Started A guided tutorial that will help you get started with the RSS Slash
Module. The RSS Slash
Module is popular among Slash based blogs and blogs imitating the feel for Slashdot. Slash is the engine behind the famous Slashdot. Documentation Selected Articles UP TO 10 Why RSS Slash is Popular: Counting Your Comments Charles Iliya Krempeaux talks about the RSS Slash
Module, why it is popular among some, and how it is used to give a count for your comments (2005-08-22). ...
...feel for Slashdot. Slash is the engine behind the famous Slashdot. Documentation Selected Articles UP TO 10 Why RSS Slash is Popular: Counting Your Comments Charles Iliya Krempeaux talks about the RSS Slash
Module, why it is popular among some, and how it is used to give a count for your comments (2005-08-22). ...
...ule, why it is popular among some, and how it is used to give a count for your comments (2005-08-22). ...
Element - Archive of obsolete content
RSS Well-Formed Web
Module Elements NOTE: In the list of elements below the wfw XML Namespace prefix is used (since it is a popular choice). However, use of wfw as the XML Namespace prefix is NOT necessary. You are free to to choose your own prefix for this. ...
... RSS Well-Formed Web
Module Elements NOTE: In the list of elements below the wfw XML Namespace prefix is used (since it is a popular choice). However, use of wfw as the XML Namespace prefix is NOT necessary. You are free to to choose your own prefix for this. ...
... RSS Well-Formed Web
Module Elements NOTE: In the list of elements below the wfw XML Namespace prefix is used (since it is a popular choice). However, use of wfw as the XML Namespace prefix is NOT necessary. You are free to to choose your own prefix for this. ...
Tree shaking - MDN Web Docs Glossary: Definitions of Web-related terms
This is important for preparing code that is production ready, for example with clean structures and minimal file size. ...
...This is important for preparing code that is production ready, for example with clean structures and minimal file size. ...
...ations, we use
module bundlers (e.g., webpack or Rollup) to automatically remove dead code when bundling multiple JavaScript files into single files. This is important for preparing code that is production ready, for example with clean structures and minimal file size. Learn more General knowledge "Benefits of dead code elimination during bundling" in Axel Rauschmayer's book: "Exploring JS:
Modules" Technical reference Tree shaking implementation with webpack ...
Accessible multimedia - Learn web development
so they can be understood by assistive technologies and their users. This article shows how. Prerequisites: Basic computer literacy, a basic understanding of HTML, CSS, and JavaScript, an understanding of what accessibility is. Objective: To understand the accessibility issues behind multimedia, and how to overcome them. Multimedia and accessibility So far in this
module we have looked at a variety of content and what needs to be done to ensure its accessibility, ranging from simple text content to data tables, images, native controls such as form elements and buttons, and even more complex markup structures (with WAI-ARIA attributes). This article on the other hand looks at another general class of content that arguably isn't as easy to ensure accessibility for...
... that accessibility is about doing as much as you can, rather than striving for 100% accessibility all the time, which is often impossible. ...
...bedding
module that test your knowledge of the information presented here. If you haven't already, go and try out the assessments at Test your skills: HTML images and Test your skills: Multimedia and embedding. Summary This chapter has provided a summary of accessibility concerns for multimedia content, along with some practical solutions. ...
What is accessibility? - Learn web development
Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS. Objective: To gain familiarity with accessibility, including what it is, and how it affects you as a web developer. So what is accessibility? Accessibility is the practice of making your websites usable by as many people as possible. ...
...to interact with computers. This kind of disability can also be a result of old age, rather than any specific trauma or condition, and it could also result from hardware limitations -- some users might not have a mouse. The way this usually affects web development work is the requirement that controls be accessible by the keyboard -- we'll discuss keyboard accessibility in later articles in the
module, but it is a good idea to try out some websites using just the keyboard to see how you get on. Can you use the tab key to move between the different controls of a web form, for example? You can find more details about keyboard controls in our Cross browser testing Using native keyboard accessibility section. In terms of statistics, a significant number of people have mobility impairments. The U.
... have given you a useful high-level overview of accessibility, shown you why it's important, and looked at how you can fit it into your workflow. ...
CSS building blocks - Learn web development
This
module carries on where CSS first steps left off -- now you've gained familiarity with the language and its syntax, and got some basic experience with using it, its time to dive a bit deeper. This
module looks at the cascade and inheritance, all the selector types we have available, units, sizing, styling backgrounds and borders, debugging, and lots more. The aim here is to provide you with a toolkit for writing competent CSS and help you understand all the essential theory, before moving on to more specific disciplines like text styling and CSS layout. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites Before starting this
module, you should have: B...
...re starting this
module, you should have: Basic familiarity with using computers, and using the Web passively (i.e. just looking at it, consuming the content.) A basic work environment set up as detailed in Installing basic software, and an understanding of how to create and manage files, as detailed in Dealing with files. Basic familiarity with HTML, as discussed in the Introduction to HTML
module. An understanding of the basics of CSS, as discussed in the CSS first steps
module. Note: If you are working on a computer/tablet/another device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin or Glitch. ...
...Along the way you'll come across plenty of exercises to allow you to test your understanding. ...
Supporting older browsers - Learn web development
However, there will be visitors to your site who use older browsers, or browsers which do not support the methods you have used. This will always be the case on the web -- as new features are developed, different browsers will prioritise different things. This article explains how to use modern web techniques without locking out users of older technology. ...
...ss you have a very high number of visitors in older IE versions, you may find it better to focus on creating a fallback that works for all non-supporting browsers. Testing older browsers With the majority of browsers supporting Flexbox and Grid, it can be reasonably hard to test older browsers. One way is to use an online testing tool such as Sauce Labs, as detailed in the Cross browser testing
module. You can also download and install Virtual Machines, and run older versions of browsers in a contained environment on your own computer. Having access to older versions of Internet Explorer is particularly useful, and for that purpose, Microsoft has made a range of Virtual Machines available for free download. These are available for Mac, Windows and Linux operating systems and so are a great wa...
...g Feature Queries in CSS Backwards Compatibility of Flexbox CSS Grid Layout and Progressive Enhancement Using CSS Grid: Supporting Browsers Without Grid A tutorial which uses the IE10 and 11 version of Grid Should I try to use the IE10 implementation of Grid Layout? ...
CSS layout - Learn web development
eep into CSS layout, looking at different display settings, modern layout tools like flexbox, CSS grid, and positioning, and some of the legacy techniques you might still want to know about. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites Before starting this
module, you should already: Have basic familiarity with HTML, as discussed in the Introduction to HTML
module. Be comfortable with CSS fundamentals, as discussed in Introduction to CSS. Understand how to style boxes. Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online codi...
...g program such as JSBin or Glitch. Guides These articles will provide instruction on the fundamental layout tools and techniques available in CSS. At the end of the lessons is an assessment to help you check your understanding of layout methods, by laying out a webpage. Introduction to CSS layout This article will recap some of the CSS layout features we've already touched upon in previous
modules -- such as different display values -- and introduce some of the concepts we'll be covering throughout this
module. Normal flow Elements on webpages lay themselves out according to normal flow - until we do something to change that. This article explains the basics of normal flow as a grounding for learning how to change it. Flexbox Flexbox is a one-dimensional layout method for laying out i...
...SS Grid Layout they tended to be implemented using floats or other layout features. You imagine your layout as a set number of columns (e.g. 4, 6, or 12), and then fit your content columns inside these imaginary columns. In this article we'll explore how these older methods work, in order that you understand how they were used if you work on an older project. Supporting older browsers In this
module we recommend using Flexbox and Grid as the main layout methods for your designs. However there will be visitors to your site who use older browsers, or browsers which do not support the methods you have used. This will always be the case on the web -- as new features are developed, different browsers will prioritise different things. This article explains how to use modern web techniques without ...
How CSS is structured - Learn web development
or elements the rules should apply to. All the examples below are valid selectors, or lists of selectors. h1 a:link .manythings #onething * .box p .box p:first-child h1, h2, .intro Try creating some CSS rules that use the selectors above. Add HTML to be styled by the selectors. If any of the syntax above is not familiar, try searching MDN. Note: You will learn more about selectors in the next
module: CSS selectors. Specificity You may encounter scenarios where two selectors select the same HTML element. Consider the stylesheet below, with a p selector that sets paragraph text to blue. However, there is also a class that sets the text of selected elements to red. .special { color: red; } p { color: blue; } Suppose that in our HTML document, we have a paragraph with a class of specia...
...cting style declaration. Try this experiment for yourself! Add HTML, then add the two p { ... } rules to your stylesheet. Next, change the first p selector to .special to see how it changes the styling. The rules of specificity and the cascade can seem complicated at first. These rules are easier to understand as you become more familiar with CSS. The Cascade and inheritance section in the next
module explains this in detail, including how to calculate specificity. For now, remember that specificity exists. Sometimes, CSS might not apply as you expected because something else in the stylesheet has more specificity. Recognizing that more than one rule could apply to an element, is the first step in fixing these kinds of issues. Properties and values At its most basic level, CSS consists of t...
...nother by at least one space. Keep property names and property values together as single unbroken strings. ...
How CSS works - Learn web development
lime; } The browser will parse the HTML and create a DOM from it, then parse the CSS. Since the only rule available in the CSS has a span selector, the browser will be able to sort the CSS very quickly! It will apply that rule to each one of the three <span>s, then paint the final visual representation to the screen. The updated output is as follows: In our Debugging CSS article in the next
module we will be using browser DevTools to debug CSS problems, and will learn more about how the browser interprets CSS. What happens if a browser encounters CSS it doesn't understand? In an earlier lesson I mentioned that browsers do not all implement new CSS at the same time. In addition, many people are not using the latest version of a browser. Given that CSS is being developed all the time, and ...
... use the pixel version, ignoring the line about calc() as they don't understand it. New browsers will interpret the line using pixels, but then override it with the line using calc() as that line appears later in the cascade. ...
...er in the cascade. .box { width: 500px; width: calc(100% - 50px); } We will look at many more ways to support varying browsers in later lessons. And finally You've nearly finished this
module; we only have one more thing to do. ...
Typesetting a community school homepage - Learn web development
Objective: To test comprehension of CSS text styling techniques. Starting point To get this assessment started, you should: Go and grab the HTML and CSS files for the exercise, and the provided external link icon. ...
... Objective: To test comprehension of CSS text styling techniques. Starting point To get this assessment started, you should: Go and grab the HTML and CSS files for the exercise, and the provided external link icon. ...
...nt. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). ...
Styling text - Learn web development
With the basics of the CSS language covered, the next CSS topic for you to concentrate on is styling text -- one of the most common things you'll do with CSS. Here we look at text styling fundamentals including setting font, boldness, italics, line and letter spacing, drop shadows, and other text features. We round off the
module by looking at applying custom fonts to your page, and styling lists and links. ...
...ont, boldness, italics, line and letter spacing, drop shadows, and other text features. We round off the
module by looking at applying custom fonts to your page, and styling lists and links. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites Before starting this
module, you should already have basic familiarity with HTML, as discussed in the Introduction to HTML
module, and be comfortable with CSS fundamentals, as discussed in Introduction to CSS. Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin, CodePen ...
...basic familiarity with HTML, as discussed in the Introduction to HTML
module, and be comfortable with CSS fundamentals, as discussed in Introduction to CSS. Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin, CodePen or Glitch. Guides This
module contains the following articles, which will teach you all of the essentials behind styling HTML text content. Fundamental text and font styling In this article we go through all the basics of text/font styling in detail, including setting font weight, family and style, font shorthand, text alignment and other effects, and line and letter spacing. Styling lists Lists behave like any other te...
Client-side form validation - Learn web development
ve security measure! Your apps should always perform security checks on any form-submitted data on the server-side as well as the client-side, because client-side validation is too easy to bypass, so malicious users can still easily send bad data through to your server. Read Website security for an idea of what could happen; implementing server-side validation is somewhat beyond the scope of this
module, but you should bear it in mind. What is form validation? Go to any popular site with a registration form, and you will notice that they provide feedback when you don't enter your data in the format they are expecting. You'll get messages such as: "This field is required" (You can't leave this field blank). "Please enter your phone number in the format xxx-xxxx" (A specific data format is r...
...ven if your form is validating correctly and preventing malformed input on the client-side, a malicious user can still alter the network request. Different types of client-side validation There are two different types of client-side validation that you'll encounter on the web: Built-in form validation uses HTML5 form validation features, which we've discussed in many places throughout this
module. This validation generally doesn't require much JavaScript. Built-in form validation has better performance than JavaScript, but it is not as customizable as JavaScript validation. JavaScript validation is coded using JavaScript. This validation is completely customizable, but you need to create it all (or use a library). Using built-in form validation One of the most significant features of ...
...ember to help your users correct the data they provide. To that end, be sure to: Display explicit error messages. Be permissive about the input format. Point out exactly where the error occurs, especially on large forms. Once you have checked that the form is filled out correctly, the form can be submitted. We'll cover sending form data next. ...
Introduction to HTML - Learn web development
At its heart, HTML is a fairly simple language made up of elements, which can be applied to pieces of text to give them different meaning in a document (Is it a paragraph? Is it a bulleted list? Is it part of a table?), structure a document into logical sections (Does it have a header? Three columns of content? A navigation menu?), and embed content such as images and videos into a page. ...
... and embed content such as images and videos into a page. This
module will introduce the first two of these and introduce fundamental concepts and syntax you need to know to understand HTML. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites Before starting this
module, you don't need any previous HTML knowledge, but you should have at least basic familiarity with using computers and using the web passively (i.e., just looking at it and consuming content). You should have a basic work environment set up (as detailed in Installing basic software), and understand how to create and manage files (as detailed in Dealing with files). Both are parts of our Getting sta...
...wledge, but you should have at least basic familiarity with using computers and using the web passively (i.e., just looking at it and consuming content). You should have a basic work environment set up (as detailed in Installing basic software), and understand how to create and manage files (as detailed in Dealing with files). Both are parts of our Getting started with the web complete beginner's
module. Note: If you are working on a computer/tablet/other devices that doesn't let you create your own files, you can try out (most of) the code examples in an online coding program such as JSBin or Glitch. Guides This
module contains the following articles, which will take you through all the basic theory of HTML and provide ample opportunity for you to test out some skills. Getting started w...
Mozilla splash page - Learn web development
Objective: To test knowledge around embedding images and video in web pages, frames, and HTML responsive image techniques. ...
... Objective: To test knowledge around embedding images and video in web pages, frames, and HTML responsive image techniques. ...
...if you are stuck and need help,. A link to the example you want assessed or need help with, in an online editor. ...
From object to iframe — other embedding technologies - Learn web development
bedding other web pages, and the other two allow you to embed PDFs, SVG, and even Flash -- a technology that is on the way out, but which you'll still see semi-regularly. Prerequisites: Basic computer literacy, basic software installed, basic knowledge of working with files, familiarity with HTML fundamentals (as covered in Getting started with HTML) and the previous articles in this
module. Objective: To learn how to embed items into web pages using <object>, <embed>, and <iframe>, like Flash movies and other webpages. A short history of embedding A long time ago on the Web, it was popular to use frames to create websites -- small parts of a website stored in individual HTML pages. These were embedded in a master document called a frameset, which allowed you to ...
...to start finding more uses for them. There are many other technologies that involve embedding external content besides the ones we discussed here. ...
...t involve embedding external content besides the ones we discussed here. We saw some in earlier articles, such as <video>, <audio>, and <img>, but there are others to discover, such as <canvas> for JavaScript-generated 2D and 3D graphics, and <svg> for embedding vector graphics. ...
Responsive images - Learn web development
w to solve them using HTML's responsive image features. You should note that we will be focusing on the HTML <img>s for this section, as seen in the content area of the example above -- the image in the site header is only for decoration, and therefore implemented using CSS background images. CSS arguably has better tools for responsive design than HTML, and we'll talk about those in a future CSS
module. Resolution switching: Different sizes So, what is the problem that we want to solve with resolution switching? We want to display identical image content, just larger or smaller depending on the device -- this is the situation we have with the second content image in our example. The standard <img> element traditionally only lets you point the browser to a single source file: <img src="elva-f...
...s, each showing the same picture. Use srcset/size to create a resolution switcher example, either to serve the same size image at different resolutions, or different image sizes at different viewport widths. Test your skills! You've reached the end of this article, but can you remember the most important information? You can find a detailed assessment that tests these skills at the end of the
module; see Mozilla splash page. Summary That's a wrap for responsive images -- we hope you enjoyed playing with these new techniques. As a recap, there are two distinct problems we've been discussing here: Art direction: The problem whereby you want to serve cropped images for different layouts -- for example a landscape image showing a full scene for a desktop layout, and a portrait image showing...
...Have fun! ...
HTML table advanced features and accessibility - Learn web development
Prerequisites: The basics of HTML (see Introduction to HTML). Objective: To learn about more advanced HTML table features, and the accessibility of tables. Adding a caption to your table with <caption> You can give your table a caption by putting it inside a <caption> element and nesting that inside the <table> element. You should put it just below the opening <table> tag. ...
... tbody { font-size: 95%; font-style: italic; } tfoot { font-weight: bold; } Save and refresh, and have a look at the result. If the <tbody> and <tfoot> elements weren't in place, you'd have to write much more complicated selectors/rules to apply the same styling. Note: We don't expect you to fully understand the CSS right now. You'll learn more about this when you go through our CSS
modules (Introduction to CSS is a good place to start; we also have an article specifically on styling tables). Your finished table should look something like the following: Hidden example <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>My spending record</title> <style> html { font-family: sans-serif; } table { border-collap...
...ed examples -- see items-sold-scope.html (also see this live) and items-sold-headers.html (see this live too). ...
HTML table basics - Learn web development
mple on GitHub! One thing you'll notice is that the table does look a bit more readable there -- this is because the table you see above on this page has minimal styling, whereas the GitHub version has more significant CSS applied. Be under no illusion; for tables to be effective on the web, you need to provide some styling information with CSS, as well as good solid structure with HTML. In this
module we are focusing on the HTML part; to find out about the CSS part you should visit our Styling tables article after you've finished here. We won't focus on CSS in this
module, but we have provided a minimal CSS stylesheet for you to use that will make your tables more readable than the default you get without any styling. You can find the stylesheet here, and you can also find an HTML template th...
.... When should you NOT use HTML tables? HTML tables should be used for tabular data -- this is what they are designed for. Unfortunately, a lot of people used to use HTML tables to lay out web pages, e.g. one row to contain the header, one row to contain the content columns, one row to contain the footer, etc. You can find more details and an example at Page Layouts in our Accessibility Learning
Module. This was commonly used because CSS support across browsers used to be terrible; table layouts are much less common nowadays, but you might still see them in some corners of the web. In short, using tables for layout rather than CSS layout techniques is a bad idea. The main reasons are as follows: Layout tables reduce accessibility for visually impaired users: Screenreaders, used by blind peo...
...n with the example. ...
HTML Tables - Learn web development
A very common task in HTML is structuring tabular data, and it has a number of elements and attributes for just this purpose. Coupled with a little CSS for styling, HTML makes it easy to display tables of information on the web such as your school lesson plan, the timetable at your local swimming pool, or statistics about your favorite dinosaurs or football team. This
module takes you through all you need to know about structuring tabular data using HTML. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites Before starting this
module, you should already have covered the basics of HTML -- see Introduction to HTML. Note: If you are working on a computer/tablet/...
...to work towards your goal. Get started Prerequisites Before starting this
module, you should already have covered the basics of HTML -- see Introduction to HTML. Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin or Glitch. Guides This
module contains the following articles: HTML table basics This article gets you started with HTML tables, covering the very basics such as rows and cells, headings, making cells span multiple columns and rows, and how to group together all the cells in a column for styling purposes. ...
...ne coding program such as JSBin or Glitch. Guides This
module contains the following articles: HTML table basics This article gets you started with HTML tables, covering the very basics such as rows and cells, headings, making cells span multiple columns and rows, and how to group together all the cells in a column for styling purposes. HTML table advanced features and accessibility This
module looks at some more advanced features of HTML tables -- such as captions/summaries and grouping your rows into table head, body and footer sections -- as well as looking at the accessibility of tables for visually impaired users. Assessments Structuring planet data In our table assessment, we provide you with some data on the planets in our solar system, and get you to structure it into an H...
General asynchronous programming concepts - Learn web development
Prerequisites: Basic computer literacy, a reasonable understanding of JavaScript fundamentals. ...
...ng! Conclusion Modern software design increasingly revolves around using asynchronous programming, to allow programs to do more than one thing at a time. As you use newer and more powerful APIs, you'll find more cases where the only way to do things is asynchronously. It used to be hard to write asynchronous code. It still takes getting used to, but it's gotten a lot easier. ...
...ng at a time. As you use newer and more powerful APIs, you'll find more cases where the only way to do things is asynchronously. It used to be hard to write asynchronous code. It still takes getting used to, but it's gotten a lot easier. In the rest of this
module, we'll explore further why asynchronous code matters and how to design code that avoids some of the problems described above. ...
Introduction to web APIs - Learn web development
ework, the control is inverted: the framework calls the developer's code. What can APIs do? There are a huge number of APIs available in modern browsers that allow you to do a wide variety of things in your code. You can see this by taking a look at the MDN APIs index page. Common browser APIs In particular, the most common categories of browser APIs you'll use (and which we'll cover in this
module in greater detail) are: APIs for manipulating documents loaded into the browser. The most obvious example is the DOM (Document Object Model) API, which allows you to manipulate HTML and CSS -- creating, removing and changing HTML, dynamically applying new styles to your page, etc. Every time you see a popup window appear on a page or some new content displayed, for example, that's the DOM in a...
... to how they work. They are based on objects Your code interacts with APIs using one or more JavaScript objects, which serve as containers for the data the API uses (contained in object properties), and the functionality the API makes available (contained in object methods). Note: If you are not already familiar with how objects work, you should go back and work through our JavaScript objects
module before continuing. Let's return to the example of the Web Audio API -- this is a fairly complex API, which consists of a number of objects. The most obvious ones are: AudioContext, which represents an audio graph that can be used to manipulate audio playing inside the browser, and has a number of methods and properties available to manipulate that audio. MediaElementAudioSourceNode, which r...
... before it would work. Summary At this point, you should have a good idea of what APIs are, how they work, and what you can do with them in your JavaScript code. ...
Silly story generator - Learn web development
Objective: To test comprehension of JavaScript fundamentals, such as variables, numbers, operators, strings, and arrays. ...
... Objective: To test comprehension of JavaScript fundamentals, such as variables, numbers, operators, strings, and arrays. ...
...ent. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. ...
What is JavaScript? - Learn web development
, and you generally have to grab their code and information from somewhere on the Web. For example: The Twitter API allows you to do things like displaying your latest tweets on your website. The Google Maps API and OpenStreetMap API allows you to embed custom maps into your website, and other such functionality. Note: These APIs are advanced, and we'll not be covering any of these in this
module. You can find out much more about these in our Client-side web APIs
module. There's a lot more available, too! However, don't get over excited just yet. You won't be able to build the next Facebook, Google Maps, or Instagram after studying JavaScript for 24 hours -- there are a lot of basics to cover first. And that's why you're here -- let's move on! What is JavaScript doing on your page? He...
...antages to both types of language, but we won't discuss them right now. Server-side versus client-side code You might also hear the terms server-side and client-side code, especially in the context of web development. Client-side code is code that is run on the user's computer -- when a web page is viewed, the page's client-side code is downloaded, then run and displayed by the browser. In this
module we are explicitly talking about client-side JavaScript. Server-side code on the other hand is run on the server, then its results are downloaded and displayed in the browser. Examples of popular server-side web languages include PHP, Python, Ruby, ASP.NET and... JavaScript! JavaScript can also be used as a server-side language, for example in the popular Node.js environment -- you can find out m...
...st of the code on your website, amongst other things. JavaScript may seem a bit daunting right now, but don't worry -- in this course, we will take you through it in simple steps that will make sense going forward. ...
Client-Server Overview - Learn web development
efits in terms of maintenance, because you can change the URL used to deliver a particular feature in one place, without having to change the handler function. For example, consider the following Django (Python) code that maps two URL patterns to two view functions. The first pattern ensures that an HTTP request with a resource URL of /best will be passed to a function named index() in the views
module. A request that has the pattern "/best/junior", will instead be passed to the junior() view function. # file: best/urls.py # from django.conf.urls import url from . import views urlpatterns = [ # example: /best/ url(r'^$', views.index), # example: /best/junior/ url(r'^junior/$', views.junior), ] Note: The first parameters in the url() functions may look a bit odd (e.g. r'^ju...
...it in an HttpResponse object. Obviously web frameworks can help you with a lot of other tasks. We discuss a lot more benefits and some popular web framework choices in the next article. ...
...d some popular web framework choices in the next article. Summary At this point you should have a good overview of the operations that server-side code has to perform, and know some of the ways in which a server-side web framework can make this easier. ...
Getting started with Ember - Learn web development
it's useful for, install the Ember toolchain locally, create a sample app, and then do some initial setup to get it ready for development. Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. A deeper understanding of modern JavaScript features (such as classes,
modules, etc), will be extremely beneficial, as Ember makes heavy use of them. Objective: To learn how to install Ember, and create a starter app. Introducing Ember Ember is a component-service framework that focuses on the overall web application development experience, minimizing the trivial differences between applications -- all while being a modern and light layer on top of ...
...f our build without having to explicitly @import them into the app.css file (this would require URL rewrites at build time and therefore be less efficient and more complicated to set up). In ember-cli-build.js, find the following code: let app = new EmberApp(defaults, { // Add options here }); Add the following lines underneath it before saving the file: app.import('node_
modules/todomvc-common/base.css'); app.import('node_
modules/todomvc-app-css/index.css'); For more information on what ember-cli-build.js does, and for other ways in which you can customize your build / pipeline, the Ember Guides have a page on Addons and Dependencies. Finally, find app.css, located at app/styles/app.css, and paste in the following: :focus, .view label:focus, .todo-list li ...
...SL), you will experience slower build-times overall compared to macOS, Linux, and Windows with WSL. Summary So far so good. We've got to the point where we can start build up our sample TodoMVC app in Ember. In the next article we'll look at building up the markup structure of our app, as a group of logical components. ...
Ember interactivity: Events, classes and state - Learn web development
t classes to contain JavaScript code to control interactive features, and setting up a service to keep track of the data state of our app. Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. A deeper understanding of modern JavaScript features (such as classes,
modules, etc), will be extremely beneficial, as Ember makes heavy use of them. Objective: To learn how to create component classes and use events to control interactivity, and keep track of app state using a service. Adding Interactivity Now we've got a refactored componentized version of our todo app, lets walk through how we can add the interactivity we need to make the app fun...
...The @action decorator declares that the function is an "action", meaning it's a type of function that will be invoked from an event that occurred in the template. @action also binds the this of the function to the class instance. Note: A decorator is basically a wrapper function, which wraps and calls othe...
...ow add todo items to our app, and the state of the data is tracked using our service. Next we'll move on to getting our footer functionality working, including the todo counter, and look at conditional rendering, including correctly styling todos when they've been checked. We'll also wire up our "Clear completed" button. ...
Routing in Ember - Learn web development
as it is sometimes referred to. We'll use it to provide a unique URL for each of the three todo views -- "All", "Active", and "Completed". Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. A deeper understanding of modern JavaScript features (such as classes,
modules, etc), will be extremely beneficial, as Ember makes heavy use of them. Objective: To learn about implementing routing in Ember. URL-based filtering Ember comes with a routing system that has a tight integration with the browser URL. Typically, when writing web applications, you want the page to be represented by the URL so that if (for any reason), the page needs to refre...
...oading arbitrary data, handling errors while loading that data, or interpreting dynamic segments of the URL. Since our data is static, we won't get to any of those fancy features, but we'll still make sure that the route provides the minimally required data to view a page. Creating the "Index" route did not add a route definition line to router.js, because like with URL navigation and JavaScript
module loading, "Index" is a special word that indicates the default route to render, load, etc. To adjust our old way of rendering the TodoList app, we'll first need to replace the TodoList component invocation from the application template with an {{outlet}} call, which means "any sub-route will be rendered in place here". Go to the todomvc/app/templates/application.hbs file and replace <TodoList /...
... reloads. To see our finished Ember implementation, checkout the finished app folder in the repository for the code of this tutorial or see the live deployed version here. Study the code to learn more about Ember, and also check out the next article, which provides links to more resources and some troubleshooting advice. ...
React resources - Learn web development
, knowledge of the terminal/command line. Objective: To provide further resources for learning more about React. Component-level styles Although this tutorial doesn't use this approach, many React applications define their styles on a per-component basis, rather than in a single, monolithic stylesheet. ...
...ponent basis, rather than in a single, monolithic stylesheet. create-react-app makes it possible to import CSS files into JavaScript
modules, so that CSS is only sent to your user when the corresponding component is rendered. For this app, we could have for example written a dedicated Form.css file to house the styles of those respective components, then imported the styles into their respective
modules like this: import Form from './Form'; import './Form.css' This approach makes it easy to identify and manage the CSS that belongs to a specific component. However, it also fragments your stylesheet across your codebase, and this fragmentation might not be worthwhile. For larger applications with hundreds of unique views and lots of moving parts, it makes sense to limit the amount of irrelevant...
...at they have moved to a new page. Because Reach Router is better for accessibility, it's a good place to start. There's one caveat, however: these projects will be merging in the near future. When this merge happens, React Router will be the surviving project (with the addition of the focus management features of Reach). ...
Deployment and next steps - Learn web development
hole app is now just 21 KB -- 8.3 KB when gzipped. There are no additional runtimes or dependencies to download, parse, execute, and keep running in memory. Svelte analyzed our components and compiled the code to vanilla JavaScript. A look behind the Svelte compilation process By default, when you create a new app with npx degit sveltejs/template my-svelte-project, Svelte will use rollup as the
module bundler. Note: There is also an official template for using webpack and also many community-maintained plugins for other bundlers. In the file package.json you can see that the dev and start scripts are just calling rollup: "scripts": { "build": "rollup -c", "dev": "rollup -c -w", "start": "sirv public" }, In the dev script we are passing the -w argument, which tells rollup to watch f...
...ject a short, easy name like "mdn-svelte-todo". You will have a remote url that points to your new GitLab git repository, like git@gitlab.com:[your-user]/[your-project].git. Before you start to upload content to your git repository, it is a good practice to add a .gitignore file to tell git which files to exclude from source control. In our case we will tell git to exclude files in the node_
modules directory by creating a .gitignore file in the root folder of your local project, with the following content: node_
modules/ Now let's go back to GitLab. After creating a new repo GitLab will greet you with a message explaining different options to upload your existing files. Follow the steps listed under the Push an existing folder heading: cd your_root_directory # Go into your proje...
...w to setup a basic pipeline to deploy our app to GitLab on every commit. Then we provided you with a list of Svelte resources to go further with your Svelte learning. Congratulations! After completing this series of tutorials you should have a strong base from which to start developing professional web applications with Svelte. ...
Handling common accessibility problems - Learn web development
ites/apps usable by as many people in as many contexts as possible, not just those users using high-powered desktop computers. Some examples might include: Users on mobile devices. Users on alternative browsing devices such as TVs, watches, etc. Users of older devices that might not have the latest browsers. Users of lower spec devices that might have slow processors. In a way, this whole
module is about accessibility -- cross browser testing makes sure that your sites can be used by as many people as possible. What is accessibility? defines accessibility more completely and thoroughly than this article does. That said, this article will cover cross browser and testing issues surrounding people with disabilities, and how they use the Web. We've already talked about other spheres such as...
...e that your sites can be used by as many people as possible. What is accessibility? defines accessibility more completely and thoroughly than this article does. That said, this article will cover cross browser and testing issues surrounding people with disabilities, and how they use the Web. We've already talked about other spheres such as responsive design and performance in other places in the
module. Note: Like many things in web development, accessibility isn't about 100% success or not; 100% accessibility is pretty much impossible to achieve for all content, especially as sites get more complex. Instead, it is more about making a reasonable effort to make as much of your content accessible to as many people as possible via defensive coding and sticking to best practices. Common accessi...
... is how to find answers online. Consult the HTML and CSS article's Finding help section for some good pointers. Summary Hopefully this article has given you a good grounding in the main accessibility problems you might encounter, and how to test and overcome them. In the next article we'll look at feature detection in more detail. ...
Handling common JavaScript problems - Learn web development
iffing (detecting what specific browser is accessing the site) -- this is a terrible practice that should be discouraged at all costs. See Using bad browser sniffing code, later on, for more details. Note: Some features are known to be undetectable -- see Modernizr's list of Undetectables. Note: Feature detection will be covered in a lot more detail in its own dedicated article, later in the
module. Libraries JavaScript libraries are essentially third party units of code that you can attach to your page, providing you with a wealth of ready-made functionality that can be used straight away, saving you a lot of time in the process. A lot of JavaScript libraries probably came into existence because their developer was writing a set of common utility functions to save them time when writing...
...aries for specific purposes. Library usage at a basic level tends to consist of downloading the library's files (JavaScript, possibly some CSS or other dependencies too) and attaching them to your page (e.g. via a <script> element), although there are normally many other usage options for such libraries, like installing them as Bower components, or including them as dependencies via the Webpack
module bundler. You will have to read the libraries' individual install pages for more information. Note: You will also come across JavaScript frameworks in your travels around the Web, like Ember and Angular. Whereas libraries are often usable for solving individual problems and dropping into existing sites, frameworks tend to be more along the lines of complete solutions for developing complex web a...
...tant thing to know really is how to find answers online. Consult the HTML and CSS article's Finding help section for our best advice. Summary So that's JavaScript. Simple huh? Maybe not so simple, but this article should at least give you a start, and some ideas on how to tackle the JavaScript-related problems you will come across. ...
Strategies for carrying out testing - Learn web development
Objective: To gain an understanding of the high-level concepts involved in cross-browser testing. ...
...ery rewarding when you get it worked out. There are also commercial tools available such as Sauce Labs, Browser Stack and LambdaTest that do this kind of thing for you, without you having to worry about the setup, if you wish to invest some money in your testing. Another alternative is to use no-code test automation tools such as Endtest. We will look at how to use such tools later on in the
module. User testing Before we move on, we'll finish this article off by talking a bit about user testing -- this can be a good option if you have a willing user group to test your new functionality on. Bear in mind that this can be as lo-fi or as sophisticated as you like -- your user group could be a group of friends, a group of colleagues, or a group of unpaid or paid volunteers, depending on wheth...
...affle Flags. Summary After reading this article you should now have a good idea of what you can do to identify your target audience/target browser list, and then effectively carry out cross-browser testing on that list. Next we'll turn our attention to the actual code issues your testing might uncover, starting with HTML and CSS. ...
Tools and testing - Learn web development
of the core HTML, CSS, and JavaScript languages first before attempting to use many the tools detailed here. For example, you'll need to know the fundamentals of these languages before you start debugging problems in complex web code, making effective use of JavaScript frameworks, or writing tests and running them against your code using test runners. In addition, you should start with the first
module in this topic, which gives a useful overview of the general area.
Modules Understanding client-side web development tools Client-side tooling can be intimidating, but this series of articles aims to illustrate the purpose of some of the most common client-side tool types, explain the tools you can chain together, how to install them using package managers, and control them using the command ...
...to get productive. Understanding client-side JavaScript frameworks JavaScript frameworks are an essential part of modern front-end web development, providing developers with tried and tested tools for building scalable, interactive web applications. Many modern companies use frameworks as a standard part of their tooling, so many front-end development jobs now require framework experience. This
module gives you some fundamental background knowledge about how client-side frameworks work and how they fit into your toolset, before moving on to tutorial series covering some of today's most popular ones. Git and GitHub All developers will use some kind of version control system (VCS), a tool to allow them to collaborate with other developers on a project without danger of them overwriting each ot...
...m (VCS), a tool to allow them to collaborate with other developers on a project without danger of them overwriting each other's work, and roll back to previous versions of the code base if a problem is discovered later on. The most popular VCS (at least among web developers) is Git, along with GitHub, a site that provides hosting for your repositories and several tools for working with them. This
module aims to teach you what you need to know about both of them. Cross browser testing This
module looks specifically at the area of testing web projects across different browsers. Here we look at identifying your target audience (e.g. what users, browsers and devices do you most need to worry about?), how to go about testing, the main issues that you'll face with different types of code and how to ...
Debugging JavaScript
eloper tool settings. Activate it through with the menu Tools > Web Developer > Browser Console. You can also start the Browser Console when you launch Firefox, by launching Firefox from the command line and passing --jsconsole as a flag: /path/to/firefox --jsconsole Log to the Browser Console using the standard console API after importing Console.jsm: let console = (Cu.import("resource://gre/
modules/Console.jsm", {})).console; console.log("Hello from Firefox code"); Error Console This is obsolete and is no longer enabled in Firefox by default. Use the Web Console or the Browser Console instead. Browser Debugger (Built-in) On Firefox 19 or later, it's possible to use the built-in JS debugger on the browser itself. Go to about:config and set the following two prefs: devtools.chrome.enab...
...ore types of warnings on the Error Console, most of which hint at code bugs that are easy to oversee or even bad syntax. (The pref also warns on common JavaScript idioms that are not errors). Console.log in Browser Console You can dump variables in the Browser Console from addon code, by adding this line to import the console utility: const { console } = Components.utils.import("resource://gre/
modules/devtools/Console.jsm", {}); This has an advantage over dump in that you can list out properties of an object logged with console.log. dump() The dump() function allows you to print text on the native console. Use \n to output a newline at the end. To see anything, you need to set the pref browser.dom.window.dump.enabled to true, e.g. in about:config (add new pref, it doesn't exist per defaul...
...ditionally need to start Firefox via the following command to have a native console : firefox.exe -console Using normal JavaScript object inspection, you can write a function that dumps a whole object, similar to this ddumpObject(). Log.jsm (formerly log4moz) This is a partial implementation of the Log4* interfaces (for example, see log4j or log4net). Components.utils.import("resource://gre/
modules/Log.jsm"); "debugger" keyword You can halt Venkman or Chromebug at a line using the keyword debugger. In debug builds this also dumps a stack trace to the console, even when the debugger is not running. In extensions you can print the callstack using Components.stack like this: function getStackDump() { var lines = []; for (var frame = Components.stack; frame; frame = frame.caller) { ...
ESLint
details. Editor Integration It is highly recommended that you integrate eslint into your editor. This lets you see errors in real time, and can help you fix issues before you compile or run tests, reducing the time to develop patches. See the ESLint user guide for which plugins to install in your editor. Prior to Firefox 55 the location for the eslint binary used to be tools/lint/eslint/node_
modules/.bin, since Bug 1305023, node_
modules is now located in the top-level directory, and should need no special set-up. Understanding Rules and Errors Not all files are linted Currently ESLint runs on: .js .jsx .jsm .xml .html .xhtml Additionally, some directories and files are ignored, see the .eslintignore file Handling Errors If your code fails an ESLint rule, you'll get an error ...
...ic Rules There are some rules that are specific for the Mozilla code-base. These have the prefix mozilla/. More information: Outline details of the rules Rule Source Code Common issues and how to solve them My editor says that "mozilla/whatever" is unknown Run ./mach eslint --setup Restart your editor If that doesn't work, check that you have your editor pointing to the correct node_
modules folder. Node.js is not recognized Add it to your PATH environment variable by running PATH="$PATH:/path/to/node.js/". For Example: In Windows 10, if you have installed Node.js on "C:\nodejs", then the command should look like: export PATH=$PATH:/c/nodejs Enabling ESLint for a new directory Remove the directory from .eslintignore (in the base directory of the repository) Fix errors th...
...* eslint-env mozilla/chrome-worker */ My file uses Chrome/XBL specific globals Either, specify the global at the top of the file: /* globals MyChromeGlobal */ or, add to the global section toolkit/.eslintrc.js if it is widely used. Foo.jsm exports a symbol, but that is not recognised by ESlint Check it is listed correctly in tools/lint/eslint/
modules.json Using Services.scriptloader.loadSubScript? You'll need to include the following just above it: /* import-globals-from relative/path/to/file.js */ do_check_eq, add_task not defined in a test directory. Ensure there is a .eslintrc.js file that extends one of: "plugin:mozilla/browser-test" "plugin:mozilla/chrome-test" "plugin:mozil...
Add-on Manager
n the requested data becomes available. Accessing installed add-ons Information about installed add-ons can be retrieved through the main AddonManager API. All of its functions are asynchronous, meaning that a callback function must be passed to receive the Addon instances. The callback may well only be called after the API function returns. For example: Components.utils.import("resource://gre/
modules/AddonManager.jsm"); AddonManager.getAllAddons(function(aAddons) { // Here aAddons is an array of Addon objects }); // This code will execute before the code inside the callback Notifications about changes to installed add-ons are dispatched to any registered AddonListeners. They must be registered through the addAddonListener() method. Installing new add-ons New add-ons can be installed b...
...e dispatched to any registered AddonListeners. They must be registered through the addAddonListener() method. Installing new add-ons New add-ons can be installed by using the getInstallForFile() or getInstallForURL() methods on the AddonManager object. These will pass an AddonInstall instance to the callback, which can then be used to install the add-on: Components.utils.import("resource://gre/
modules/AddonManager.jsm"); AddonManager.getInstallForURL("http://www.foo.com/test.xpi", function(aInstall) { // aInstall is an instance of AddonInstall aInstall.install(); }, "application/x-xpinstall"); The progress of AddonInstalls can be monitored using an InstallListener. A listener can be registered either for a specific install using the addListener() method or for all installs using the ad...
... Gecko 7.0(Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4) You can also get lists of add-ons that, at startup, were changed in various ways. The getStartupChanges() method lets you find out which add-ons were installed, removed, updated, enabled, or disabled at application startup. ...
FileUtils.jsm
The FileUtils.jsm JavaScript code
module offers utility routines dealing with files. ...
... The FileUtils.jsm JavaScript code
module offers utility routines dealing with files. ...
... The FileUtils.jsm JavaScript code
module offers utility routines dealing with files. ...
JNI.jsm
The JNI.jsm JavaScript code
module abstracts all of the js-ctypes required for writing JNI code. To use it, you first need to import the code
module into your JavaScript scope: Components.utils.import("resource://gre/
modules/JNI.jsm"); This
module was available in Firefox since version 17. If you would like to support versions before that, you can copy and paste the contents of the JSM file int JNI stands for Java Native Interface; this library allows calling Java code running in Java Virtual Machines (JVMs), etc. The most common use for this
module is in add-ons and other works on Firefox for Android (Fennec). With this
module, all of the Android SDK functions that Firefox has permissions for are at your fingertips. A note about Firefox for Android, this JSM file is already globally impor...
...// aClass is a string with L and ; arround it return aClass.substr(1, aClass - 2); } Examples Read Java strings This example shows how to read Java strings as Javascript strings. We will get paths to special folders on Fennec (Firefox for Android) into a Javascript variable with ReadString(). ...
...lass.substr(1, aClass - 2); } Examples Read Java strings This example shows how to read Java strings as Javascript strings. We will get paths to special folders on Fennec (Firefox for Android) into a Javascript variable with ReadString(). ...
Creating a Cookie Log
re from a bug report. Please follow the instructions below to run Firefox with cookie logging enabled. Enabling Cookie Logging Windows Open a command prompt (this is under Programs or Programs/Accessories in normal installations of Windows). ...
... Run Firefox by typing "./firefox" and pressing Enter Mac OS X Open Terminal.app, which is located in the /Applications/Utilities folder (these instructions are for bash, the default shell in Mac OS X 10.3 and higher; if you use something else, you probably know how to modify these instructions already). ...
...s folder (these instructions are for bash, the default shell in Mac OS X 10.3 and higher; if you use something else, you probably know how to modify these instructions already). Change to the installation directory for Firefox, e.g. type "cd /Applications/Firefox.app/Contents/MacOS" and press Return. Type "export NSPR_LOG_FILE=~/Desktop/cookie-log.txt" and press Return. Type "export NSPR_LOG_
MODULES=cookie:4" and press Return. Run Firefox by typing "./firefox-bin" and pressing Return (note that Firefox will launch behind windows for other applications). Creating the Log Now that you have Firefox running with logging enabled, please try to replicate the bug using the steps to reproduce from the bug report. Once you have reproduced the bug, shut down Firefox. Close out of the command prom...
NSS_3.12_release_notes.html
bject (see pk11pub.h) PK11_CreatePBEV2AlgorithmID (see pk11pub.h) PK11_DestroyMergeLog (see pk11pub.h) PK11_GenerateKeyPairWithOpFlags (see pk11pub.h) PK11_GetPBECryptoMechanism (see pk11pub.h) PK11_IsRemovable (see pk11pub.h) PK11_MergeTokens (see pk11pub.h) PK11_WriteRawAttribute (see pk11pub.h) SECKEY_ECParamsToBasePointOrderLen (see keyhi.h) SECKEY_ECParamsToKeySize (see keyhi.h) SECMOD_Delete
ModuleEx (see secmod.h) SEC_GetRegisteredHttpClient (see ocsp.h) SEC_PKCS5IsAlgorithmPBEAlgTag (see secpkcs5.h) VFY_CreateContextDirect (see cryptohi.h) VFY_CreateContextWithAlgorithmID (see cryptohi.h) VFY_VerifyDataDirect (see cryptohi.h) VFY_VerifyDataWithAlgorithmID (see cryptohi.h) VFY_VerifyDigestDirect (see cryptohi.h) VFY_VerifyDigestWithAlgorithmID (see cryptohi.h) New macros for Camellia sup...
... In pkcs11n.h, all the _NETSCAPE_ macros are renamed with _NSS_ For example, CKO_NETSCAPE_CRL becomes CKO_NSS_CRL. New for PKCS #11 (see pkcs11t.h for details): CKK: Keys CKK_CAMELLIA CKM: Mechanisms CKM_SHA224_RSA_PKCS CKM_SHA224_RSA_PKCS_PSS CKM_SHA224 CKM_SHA224_HMAC CKM_SHA224_HMAC_GENERAL CKM_SHA224_KEY_DERIVATION CKM_CAMELLIA_KEY_GEN CKM_CAMELLIA_ECB CKM_CA...
...New ...
Overview of NSS
, Red Hat, Google, and other companies in a variety of products, including the following: Mozilla products, including Firefox, Thunderbird, SeaMonkey, and Firefox OS. AOL Instant Messenger (AIM) Open source client applications such as Evolution, Pidgin, Apache OpenOffice, and LibreOffice. Server products from Red Hat: Red Hat Directory Server, Red Hat Certificate System, and the mod_nss SSL
module for the Apache web server. Server products from Oracle (formerly Sun Java Enterprise System), including Oracle Communications Messaging Server and Oracle Directory Server Enterprise Edition. SUSE Linux Enterprise Server supports NSS and the mod_nss SSL
module for the Apache web server. NSS includes a framework to which developers and OEMs can contribute patches, such as assembler code, to opt...
...ure for the Internet. RSA, DSA, ECDSA, Diffie-Hellman, EC Diffie-Hellman, AES, Triple DES, DES, RC2, RC4, SHA-1, SHA-256, SHA-384, SHA-512, MD2, MD5, HMAC: Common cryptographic algorithms used in public-key and symmetric-key cryptography. FIPS 186-2 pseudorandom number generator. For complete details, see Encryption Technologies. FIPS 140 Validation and NISCC Testing The NSS software crypto
module has been validated three times for conformance to FIPS 140 at Security Levels 1 and 2. For more information, see the NSS FIPS page (Or this one). The NSS libraries passed the NISCC TLS/SSL and S/MIME test suites (1.6 million test cases of invalid input data). Complete Software Development Kit In addition to libraries and APIs, NSS provides security tools required for debugging, diagnostics, ce...
...ance to FIPS 140 at Security Levels 1 and 2. For more information, see the NSS FIPS page (Or this one). The NSS libraries passed the NISCC TLS/SSL and S/MIME test suites (1.6 million test cases of invalid input data). Complete Software Development Kit In addition to libraries and APIs, NSS provides security tools required for debugging, diagnostics, certificate and key management, cryptography
module management, and other development tasks. NSS comes with an extensive and growing set of documentation, including introductory material, API references, man pages for command-line tools, and sample code. NSS is available as source and shared (dynamic) libraries. Every NSS release is backward compatible with previous releases, allowing NSS users to upgrade to the new NSS shared libraries without ...
Network Security Services
eleases. Encryption Technologies Available in NSS 3.11 Archived version. Lists the cryptographic algorithms used by NSS 3.11. NSS 3.1 Loadable Root Certificates Archived version. Describes the scheme for loading root CA certificates. cert7.db Archived version. General format of the cert7.db database. ...
...ts the cryptographic algorithms used by NSS 3.11. NSS 3.1 Loadable Root Certificates Archived version. Describes the scheme for loading root CA certificates. cert7.db Archived version. General format of the cert7.db database. ...
...d version. Describes the scheme for loading root CA certificates. cert7.db Archived version. General format of the cert7.db database. PKCS #11 information Documentation on PKCS #11
modules Implementing PKCS #11 for NSS The strings NSS uses to load PKCS #11
modules PKCS #11 FAQ Using the JAR Installation Manager to Install a PKCS #11 Cryptographic
Module PKCS #11 Conformance Testing - Archived version CA certificates pre-loaded into NSS Mozilla CA certificate policy List of pre-loaded CA certificates Consumers of this list must consider the trust bit setting for each included root certificate. More Information, Extracting roots and their trust bits NSS is bu...
Places Developer Guide
in Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11). Exporting: exportHTMLToFile (nsILocalFile aFile) - This exports all bookmarks in the toolbar, menu and unfiled bookmarks folders into the specified file. Backup/Restore The new bookmarks system uses the JSON format for storing backups of users' bookmarks. The APIs are available via the PlacesUtils API in the utils.js Javascript
module. ...
...s in the toolbar, menu and unfiled bookmarks folders into the specified file. Backup/Restore The new bookmarks system uses the JSON format for storing backups of users' bookmarks. The APIs are available via the PlacesUtils API in the utils.js Javascript
module. ...
...into the specified file. Backup/Restore The new bookmarks system uses the JSON format for storing backups of users' bookmarks. The APIs are available via the PlacesUtils API in the utils.js Javascript
module. ...
XML Extras
Feature Status Feature Status XMLSerializer Available XMLHttpRequest Available DOMParser (string and stream input source) Available Web Services with SOAP and WSDL No longer available from Gecko 1.9/Firefox 3. ...
... Feature Status Feature Status XMLSerializer Available XMLHttpRequest Available DOMParser (string and stream input source) Available Web Services with SOAP and WSDL No longer available from Gecko 1.9/Firefox 3. ...
...e JavaDoc-style comments in the IDL files. nsIDOMSerializer (Currently, the JavaScript constructor is XMLSerializer()) nsIDOMParser (Currently, the JavaScript constructor is DOMParser()) nsIXMLHttpRequest Please see the XML Linking and Pointing section in XML in Mozilla document for FIXptr and XPointer documentation. How can I help? Help with testing the components contained within the
module. Contribute Documentation to the
module. Help at the code level, contributing code patches for bug fixes or feature completion. ...
Finishing the Component
llection (GCC), version 3.2 changed the C++ ABI, and this caused problems between libraries compiled with GCC 3.2 and applications compiled with an earlier version and vice versa. Similar problems occurred with GCC 4.0, which underwent similar ABI changes. Before attempting to use unfrozen interfaces, you should contact the developers who are responsible for the code you're trying to use (i.e.,
module owners) and ask them how best to do what you are trying to do. Be as precise you possibly can. They may be able to suggest a supported alternative, or they may be able to notify you about pending changes. The interface that we need for this project is something called nsIContentPolicy. At the time this book was written, this interface was under review. An interface reaches this state when a grou...
...rs) and ask them how best to do what you are trying to do. Be as precise you possibly can. They may be able to suggest a supported alternative, or they may be able to notify you about pending changes. The interface that we need for this project is something called nsIContentPolicy. At the time this book was written, this interface was under review. An interface reaches this state when a group of
module owners and peers are actively engaged in discussion about how best to expose it. Usually there are only minor changes to interfaces marked with such a tag. Even with interfaces marked "under review," however, it's still a good idea to contact the
module owners responsible for the interfaces you are interested in using. Copying Interfaces into Your Build Environment To get and implement interfac...
...ponent to this category, modify the WebLockRegistration callback function so that it looks like this: static NS_METHOD WebLockRegistration(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *registryLocation, const char *componentType, const ns
ModuleComponentInfo *info) { nsresult rv; nsCOMPtr<nsIServiceManager> servman = do_QueryInterface((nsISupports*)aCompMgr, &rv); if (NS_FAILED(rv)) return rv; nsCOMPtr<nsICategoryManager> catman; servman->GetServiceByContractID(NS_CATEGORYMANAGER_CONTRACTID, NS_GET_IID(nsICategoryManager), getter_AddRefs(catman)); if (NS...
XPCOM Stream Guide
255, you risk losing data using nsStringStream, for example. To get an input stream for JavaScript strings safely, try this. var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"] .createInstance(Components.interfaces.nsIScriptableUnicodeConverter); converter.charset = "UTF-8"; var stream = converter.convertToInputStream(string); JavaScript
modules are your friends There are several useful JavaScript
modules at your disposal. For streams, the most obvious are NetUtil.jsm and FileUtils.jsm. NetUtil.jsm provides APIs for copying an input stream to an output stream (the asyncCopy() method), getting an input stream from another source (the asyncFetch() method), and reading an input stream into a string (the readInputStreamToString() method).
... APIs for getting output streams for files, with the .openFileOutputStream(file, modeFlags) and .openSafeFileOutputStream(file, modeFlags) methods, and for closing those output streams with the .closeSafeFileOutputStream(inputStream) method. As we mentioned earlier, you can use the IO service to get any channel, and from there an input stream. The IO service is available through the Services.jsm
module as the .io property. Stream Listeners A stream listener is an object you build to let you know when there is data in a stream ready for you to consume. Most streams are asynchronous: they make no assumptions that all the data a resource provides is available immediately. (This is particularly true of streams that reach out over a network connection, like HTTP and FTP channels.) Stream listener...
... The first argument, * which represents capacity per segment, is...
Components.utils.importGlobalProperties
ct in table without a minimum firefox version, it is not exactly known since when it was available, however it is guranteed available from Firefox 28 and up. Syntax void Components.utils.importGlobalProperties([string1, string2, ...]); Parameters [string1, string2, ...] An array of strings. Each string is the name of an object to import. Example Components.utils.import("resource://gre/
modules/devtools/Console.jsm"); Components.utils.importGlobalProperties(["atob", "btoa"]); var encoded = btoa("Hello"); console.log(encoded); // "SGVsbG8=" console.log(atob(encoded)); // "Hello" Alternative Methods If importGlobalProperties does not support the targeted Firefox version, here are some alternative methods to import these objects. Import from JSM This method work...
...lobalProperties(["atob", "btoa"]); var encoded = btoa("Hello"); console.log(encoded); // "SGVsbG8=" console.log(atob(encoded)); // "Hello" Alternative Methods If importGlobalProperties does not support the targeted Firefox version, here are some alternative methods to import these objects. ...
...llo" Alternative Methods If importGlobalProperties does not support the targeted Firefox version, here are some alternative methods to import these objects. Import from JSM This method worked until Blob and File were no longer apart of JSM
modules. It is suspected this works up till Firefox 35. This imports Blob, File, along with the regular Services. The reason this works is because JS Code
Modules actually have Blob and File. Cu.import() will return the full global of a code
module. Knowing that, we can just get a valid Blob by importing a known
module that has the objects, such as Services.jsm const {Blob, File, Services} = Cu.import("resource://gre/
modules/Services.jsm", {}); Reference: Stackoverflow :: Use Blob on firefox add-on hiddenDOMWindow The hidden DOMWindow has all of these...
Language bindings
An XPCOM Language Binding is a bridge between a particular language and XPCOM 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. More specifically, an XPCOM language binding: Enables access to XPCOM objects from that language (where access means reading/writing/creating XPCOM objects as well as calling methods on them). Exposes
modules written in the bound language as XPCOM objects, thereby enabling all other languages for which XPCOM bindings exist to access these
modules. Since the XPCOM layer itself is written in C/C++, its API can be accessed out-of-the-box using C or C++. In order to allow any other language to use the XPCOM API, a bridging layer...
...hen JavaScript code is running to ensure that in-use memory isn't inadvertently collected.Components.utils.setGCZealThis method lets scripts set the zeal level for garbage collection. You can get details on what this method does in JS_SetGCZeal. ...
...s 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.unloadComponents.utils.unload was introduced in Firefox 7 and is used to unload JavaScript code
modules. ...
NS_InitXPCOM3
#include "nsXPCOM.h" nsresult NS_InitXPCOM3( nsIServiceManager** aResult, nsIFile* aBinDirectory, nsIDirectoryServiceProvider* aAppFileLocationProvider, nsStatic
ModuleInfo const* aStatic
Modules, PRUint32 aStatic
ModuleCount ); Parameters aResult [out] The resulting XPCOM service manager. You may pass null if you are not interested in this return value. The service manager may alternatively be accessed by calling NS_GetServiceManager. ...
...s finished with XPCOM. aBinDirectory [in] The directory containing the component registry and runtime libraries. Pass null to specify that the current working directory should be used. aAppFileLocationProvider [in] The object to be used by XPCOM to locate application specific directories and files (e.g., the user profile, the component registry, etc.). This parameter may be nsnull. aStatic
Modules [in] An array of nsStatic
ModuleInfo objects. Passing null causes the default (built-in) static
modules to be registered, if present. aStatic
ModuleCount [in] The number of elements in aStatic
Modules. Return Values The NS_InitXPCOM3 function returns NS_OK if successful. Otherwise, it returns an error code. Some of the possible errors are documented below: NS_ERROR_NOT_INITIALIZED Indicat...
...3 (or NS_InitXPCOM2) before proceeding to use XPCOM in a process. The one exception is that you may call NS_NewLocalFile or NS_NewNativeLocalFile to create a nsIFile needed for the aBinDirectory parameter to NS_InitXPCOM3. Many of the XPCOM glue functions and classes are also available prior to XPCOM initialization, including for example nsEmbedCString and nsCOMPtr. Initializing XPCOM with static
modules allows the application to easily define
modules that are linked into the application's executable. This can be a performance improvement over dynamically loaded XPCOM
modules. History This function was finalized for Mozilla 1.8. See bug 296561 for details. See Also NS_InitXPCOM2, NS_ShutdownXPCOM ...
nsILoginManagerStorage
toolkit/components/passwordmgr/public/nsILoginManagerStorage.idlScriptable This interface is implemented by
modules that wish to provide storage mechanisms for the Login Manager. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) For example, if you wish to provide operating system integration with a native password manager system, implementing and registering a storage
module for the Login Manager is how you do it. See Creating a Login Manager storage
module for details. Note: Extensions that simply want to access/store logins should use the Login Manager service and nsILoginManager interface instead. The Login Manager will handle selecting and using the correct nsILoginManangerSt...
...ith a native password manager system, implementing and registering a storage
module for the Login Manager is how you do it. See Creating a Login Manager storage
module for details. Note: Extensions that simply want to access/store logins should use the Login Manager service and nsILoginManager interface instead. The Login Manager will handle selecting and using the correct nsILoginManangerStorage
module. Method overview void addLogin(in nsILoginInfo aLogin); unsigned long countLogins(in AString aHostname, in AString aActionURL, in AString aHttpRealm); void findLogins(out unsigned long count, in AString aHostname, in AString aActionURL, in AString aHttpRealm, [retval, array, size_is(count)] out nsILoginInfo logins); void getAllDisabledHosts([optional] out unsigned long count, [retval, ar...
... isEnabled true if logins should be enabled for the host, or false if they should be disabled. Remarks For methods returning count, JavaScript callers can simply use the length property on the returned array to find out how many logins were returned in the array, for example: var logins = pwmgr.searchLogins({}, matchData); var numLogins = logins.length; See also Creating a Login Manager storage
module nsILoginManager ...
nsIZipReader
Inherits from: nsISupports Last changed in Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7) Implemented by: @mozilla.org/libjar/zip-reader;1. To create an instance, use: var zipReader = Components.classes["@mozilla.org/libjar/zip-reader;1"] .createInstance(Components.interfaces.nsIZipReader); About character sets and code pages Note: nsIZipReader has a code page problem; that is, in the ZIP specification, filenames are supposed to use 7-bit ASCII; however, most modern filesystems use 8 bit code pages, such as UTF-8. This can mismatch characters in the nsIZipReader API. ...
...ableInputStream to read the stream returned by getInputStream. XPI files are ZIP files, just Firefox needs the extension to be XPI. Change "PortableTester@jetpack.xpi" to the name of a XPI file in your extensions folder. Then you can copy and paste this code in scratchpad to run it. ...
...putStream. XPI files are ZIP files, just Firefox needs the extension to be XPI. Change "PortableTester@jetpack.xpi" to the name of a XPI file in your extensions folder. Then you can copy and paste this code in scratchpad to run it. ...
nsIZipWriter
Operations on the archive can be performed one by one, or queued for later execution. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3) Once all the operations you wish to perform are added to the queue, a call to processQueue() will perform the operations in the order they were added to the queue. Operations performed on the queue throw any errors that occur out to the observer. Attempting to perform a synchronous operation on the interface while the background queue is in progress will throw an NS_ERROR_IN_PROGRESS exception. ...
...p as "hi and no extension". var {Cc: classes, Ci: interfaces, Cu: utils} = Components; var zw = Cc['@mozilla.org/zipwriter;1'].createInstance(Ci.nsIZipWriter); var pr = {PR_RDONLY: 0x01, PR_WRONLY: 0x02, PR_RDWR: 0x04, PR_CREATE_FILE: 0x08, PR_APPEND: 0x10, PR_TRUNCATE: 0x20, PR_SYNC: 0x40, PR_EXCL: 0x80}; //https://developer.mozilla.org/docs/PR_Open#Parameters var fu = Cu.import('resource://gre/
modules/FileUtils.jsm').FileUtils; var fp = Cc['@mozilla.org/filepicker;1'].createInstance(Ci.nsIFilePicker); fp.init(window, 'Select Directory to Compile', Ci.nsIFilePicker.modeGetFolder); fp.appendFilters(Ci.nsIFilePicker.filterAll | Ci.nsIFilePicker.filterText); var rv = fp.show(); if (rv == Ci.nsIFilePicker.returnOK) { var dir = fp.file; //dir must exist, as the user selected it. but note ...
... every file added in a folder of its own. ...
XPCOM Interface Reference
orageFunctionmozIStoragePendingStatementmozIStorageProgressHandlermozIStorageResultSetmozIStorageRowmozIStorageServicemozIStorageStatementmozIStorageStatementCallbackmozIStorageStatementParamsmozIStorageStatementRowmozIStorageStatementWrappermozIStorageVacuumParticipantmozIStorageValueArraymozITXTToHTMLConvmozIThirdPartyUtilmozIVisitInfomozIVisitInfoCallbackmozIVisitStatusCallbacknsIAbCardnsIAbout
ModulensIAbstractWorkernsIAccelerometerUpdatensIAccessNodensIAccessibilityServicensIAccessiblensIAccessibleCaretMoveEventnsIAccessibleCoordinateTypensIAccessibleDocumentnsIAccessibleEditableTextnsIAccessibleEventnsIAccessibleHyperLinknsIAccessibleHyperTextnsIAccessibleImagensIAccessibleProvidernsIAccessibleRelationnsIAccessibleRetrievalnsIAccessibleRolensIAccessibleScrollTypensIAccessibleSelectablensIAc...
...nsIAlertsServicensIAnnotationObservernsIAnnotationServicensIAppShellnsIAppShellServicensIAppStartupnsIAppStartup_MOZILLA_2_0nsIApplicationCachensIApplicationCacheChannelnsIApplicationCacheContainernsIApplicationCacheNamespacensIApplicationCacheServicensIApplicationUpdateServicensIArraynsIAsyncInputStreamnsIAsyncOutputStreamnsIAsyncStreamCopiernsIAsyncVerifyRedirectCallbacknsIAuthInformationnsIAuth
ModulensIAuthPromptnsIAuthPrompt2nsIAuthPromptAdapterFactorynsIAuthPromptCallbacknsIAuthPromptProvidernsIAuthPromptWrappernsIAutoCompleteControllernsIAutoCompleteInputnsIAutoCompleteItemnsIAutoCompleteListenernsIAutoCompleteObservernsIAutoCompleteResultnsIAutoCompleteSearchnsIBadCertListener2nsIBidiKeyboardnsIBinaryInputStreamnsIBinaryOutputStreamnsIBlocklistPromptnsIBlocklistServicensIBoxObjectnsIBrows...
...ckSupportnsIMarkupDocumentViewernsIMemorynsIMemoryMultiReporternsIMemoryMultiReporterCallbacknsIMemoryReporternsIMemoryReporterManagernsIMenuBoxObjectnsIMessageBroadcasternsIMessageListenernsIMessageListenerManagernsIMessageSendernsIMessageWakeupServicensIMessengernsIMicrosummarynsIMicrosummaryGeneratornsIMicrosummaryObservernsIMicrosummaryServicensIMicrosummarySetnsIMimeConverternsIMimeHeadersnsI
ModulensIMsgAccountnsIMsgAccountManagerExtensionnsIMsgCompFieldsnsIMsgCustomColumnHandlernsIMsgDBHdrnsIMsgDBViewnsIMsgDBViewCommandUpdaternsIMsgDatabasensIMsgFilternsIMsgFilterCustomActionnsIMsgFilterListnsIMsgFoldernsIMsgHeaderParsernsIMsgIdentitynsIMsgIncomingServernsIMsgMessageServicensIMsgProtocolInfonsIMsgRuleActionnsIMsgSearchCustomTermnsIMsgSearchNotifynsIMsgSearchScopeTermnsIMsgSearchSessionnsIM...
Setting HTTP request headers
ervice); os.addObserver(this, "http-on-modify-request", false); return; } }, QueryInterface: function (iid) { if (iid.equals(Components.interfaces.nsIObserver) || iid.equals(Components.interfaces.nsISupports)) return this; Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE; return null; }, }; var my
Module = { registerSelf: function (compMgr, fileSpec, location, type) { var compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar); compMgr.registerFactoryLocation(this.myCID, this.myName, this.myProgID, fileSpec, ...
...The good practice is not to have this specific HTTP header (for example "X-site.net-extension") sent all the time but only when doing requests with this specific ...
...The good practice is not to have this specific HTTP header (for example "X-site.net-extension") sent all the time but only when doing requests with this specific web sites. By not advertising to all site...
XPCOM
collection. ...
...om the clipboard.Using the Gecko SDKWeak referenceIn XPCOM, a weak reference is a special object that contains a pointer to an XPCOM object, but doesnot keep that object alive. If the referent object is destroyed before the weak reference, the pointer inside the weak reference is set to nsnull.Working with Multiple Versions of InterfacesIn 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.Working with out parameterswrappedJSObjectwrappedJSObject is a property sometimes available on XPConnect wrappers. When available, it lets you access the JavaScript object hidden by the wrapper.XPCOM ABIXPCOM ABI is the binary interface of XPCOM components. While XPCOM components written in...
... it until you give ownership away.XPCOM referenceThis reference describes the interfaces and functions provided by the XPCOM library. In addition, it details the various helper classes and functions, as well as the components, provided by the XPCOM glue library. The contents herein are oriented primarily toward extension developers and people embedding XPCOM in other projects.XPCOM tasksThe 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 u...
libmime content type handlers
Warning: The content of this article may be out of date. It was imported from mozilla.org and last updated in 2001. by Richard H. Pizzarro <rhp@netscape.com> Contents Overview API's Plugin Location/Installation Sample Content Type Handler Plugin Overview The libmime
module implements a general-purpose MIME parser and one of the primary methods provided by the parser is the ability to emit an HTML representation of an input stream. The primary use of libmime is to parse and render RFC822 messages for use by the Messenger component of Seamonkey. A necessary capability of this
module is to dynamically add the ability to decode and render various content types. This functionality will be accomplished via Content Type Handler Plugins for libmime. libmime has a homegrown ...
... API's Content Type Handler Plugins are dynamically loaded and need to access internal pointers, functions that are part of the C based object system. ...
...the components directory for the bin directory). Sample Content Type Handler Plugin To see an example of a Content Type Handler Plugin, the source for the handler of the content type "text/calendar" can be viewed at the following link: Calendar plugin Note: This plugin simply creates a blue table in the output stream to identify the fact...
Using popup notifications
clicking anywhere outside the notification, then clicking on the notification icon to bring it back again. A popup notification can include a text message, a button action, and zero or more additional actions provided in a drop-down menu accessed through the notification's button. Creating a popup notification Popup notifications can be created using the PopupNotifications.jsm JavaScript code
module. This code
module is imported by the browser, so you don't need to do it explicitly yourself. Then you can create the popup notification at the appropriate time like this: PopupNotifications.show(gBrowser.selectedBrowser, "sample-popup", "This is a sample popup notification.", null, /* anchor ID */ { label: "Do Something", accessKey: "D", ca...
.../* secondary action */ ); In this case, we aren't providing any secondary actions; that is, actions provided to the user through the drop-down menu. This notification looks like this: That's not very pretty; where's the icon? Adding an icon to your notification Adding an icon to a notification is simple. You just need to provide the appropriate CSS. The PopupNotifications.jsm code
module adds a popupid attribute to the notification object's icon element. You can use this to style the icon, like this: .popup-notification-icon[popupid="sample-popup"] { list-style-image: url("chrome://popupnotifications/skin/mozlogo.png"); } With this CSS in place, the result is the look we want: Adding secondary options To provide options in the drop-down menu, add an array of notification...
...ing callback is invoked. Choosing the "Not Now" option dismisses the notification; it can be brought back by clicking on the notification icon again. Implementing a timeout function for the popup notification You can use a timeout to make your notification automatically disappear after some amount of time, by calling notification.remove() as shown below. ...
Working with windows in chrome code
is specified using XUL. The third, and optional, parameter is a list of special window features the window should have. The window.openDialog function works similarly, but lets you specify optional arguments that can be referenced from the JavaScript code. It also handles window features a little differently, including always assuming the dialog feature is specified. From XPCOM components and
modules If the Window object is unavailable (for example, when opening a window from XPCOM component code), you might want to use nsIWindowWatcher interface. Its parameters are similar to window.open; in fact, window.open's implementation calls nsIWindowWatcher's methods. var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"] .getService(Components.interfaces.nsIWin...
...l variable in each window along with corresponding setter functions to keep the "instances" of the variable in sync across windows, but fortunately, there's a better way. To declare a shared variable, we need to find a place that exists while the application is running and is easily accessible from the code in different chrome windows. There are actually a few such places. Using JavaScript code
modules JavaScript code
modules is a simple method for creating shared global singleton objects that can be imported into any other JavaScript scope. The importing scope will have access to the objects and data in the code
module. Since the code
module is cached, all scopes get the same instance of the code
module and can share the data in the
module. See Components.utils.import for more information. ...
... You can't use the window object, its members, like alert and open, and many other objects available from inside a window. The functionality isn't lost, however -- you just have to use the XPCOM components directly instead of using convenient shortcuts. ...
Debugging Tips
Printing CData and CType Currently console.log doesn't show type information of CData. Running the following code shows only partial value information. ...
...e.log(i); let Point = ctypes.StructType("Point", [{ x: ctypes.int32_t }, { y: ctypes.int32_t }]) let p = Point(10, 20); console.log(p); let pp = p.address(); console.log(pp); The result will be as following: CData { value: 10 } CData { x: 10, y: 20 } CData { contents: CData } To see more descriptive information, you can use .toSource(). ...
...pes.int32_t }, { y: ctypes.int32_t }]) let p = Point(10, 20); console.log(p.toSource()); let pp = p.address(); console.log(pp.toSource()); The result will be : ctypes.int32_t(10) Point(10, 20) Point.ptr(ctypes.UInt64("0x15fdafb08")) To see the complete type information, you can use .constructor.toSource(), to print the source of CType. ...
ctypes
ew Error("wut?!"); } console.log(struct_TBButton.size); // 20 on 32-bit, 32 on 64-bit if I'm not mistaken There is another way to do this, we can use ArrayType, but example for this I don't know at this time. ...
...it, 32 on 64-bit if I'm not mistaken There is another way to do this, we can use ArrayType, but example for this I don't know at this time. ...
...verflow :: Getting TB_BUTTON is crashing and not working) Example of cast and FunctionType on Windows Components.utils.import("resource://gre/
modules/ctypes.jsm"); var kernel = ctypes.open("kernel32.dll"); var H
MODULE = ctypes.uint32_t; var HWND = ctypes.uint32_t; var LPCTSTR = ctypes.jschar.ptr; var LPCSTR = ctypes.char.ptr; var LoadLibrary = kernel.declare("LoadLibraryW", ctypes.winapi_abi, H
MODULE, LPCTSTR); var GetProcAddress = kernel.declare("GetProcAddress", ctypes.winapi_abi, ctypes.void_t.ptr, H
MODULE, LPCSTR); var hUser = LoadLibrary("user32"); var funcPtr = GetProcAddress(hUser, "MessageBoxW"); // Now we have a pointer to a function, let's cast it to the right type var MessageBoxType = ctypes.FunctionType(ctypes.winapi_abi, ctypes.int32_t, [HWND, LPCTSTR, LPCTSTR, ctypes.uint32_t]...
Plug-in Basics - Plugins
nd helper applications fill different application needs. For more information about helper applications, refer to the Netscape online help. How plug-ins work The life cycle of a plug-in, unlike that of an application, is completely controlled by the web page that calls it. This section gives you an overview of the way that plug-ins operate in the browser. When Gecko starts, it looks for plugin
modules in particular places on the system. For more information about where Gecko looks for plugin
modules on different systems, see How Gecko Finds Plug-ins. When the user opens a page that contains embedded data of a media type that invokes a plug-in, the browser responds with the following sequence of actions: check for a plug-in with a matching MIME type load the plug-in code into memory init...
...en the user leaves the page or closes the window, the plug-in instance is deleted. When the last instance of a plug-in is deleted, the plug-in code is unloaded from memory. A plug-in consumes no resources other than disk space when it is not loaded. The next section, Understanding the Runtime Model, describes these stages in more detail. Understanding the runtime model Plug-ins are dynamic code
modules that are associated with one or more MIME types. When the browser starts, it enumerates the available plug-ins (this step varies according to platform), reads resources from each plug-in file to determine the MIME types for that plug-in, and registers each plug-in library for its MIME types. The following stages outline the life of a plug-in from loading to deletion: When Gecko encounters da...
... types defined for use in the Plug-in API. The names of structures begin with NP, for example, NPWindow. All plug-in names in the API start with NP. In general, the operation of all API functions is the same on all platforms. Where this varies, the reference entry for the function in the reference section describes the difference. Plug-ins and platform independence A plug-in is a dynamic code
module that is native to the specific platform on which the browser is running. It is a code library, rather than an application or an applet, and runs only from the browser. Although plug-ins are platform-specific, the Plug-in API is designed to provide the maximum degree of flexibility and to be functionally consistent across all platforms. This guide notes platform-specific differences in coding for ...
Debugger.Script - Firefox Developer Tools
bugger.Script instances for equivalent functions or evaluated code--that is, scripts representing the same source code, at the same position in the same source file, evaluated in the same lexical environment. Debugger.Script for WebAssembly For Debugger.Script instances referring to a block of WebAssembly code, they are distinguished by their format property being "wasm". Currently only entire
modules evaluated via new WebAssembly.
Module are represented. Debugger.Script objects for WebAssembly are uncovered via onNewScript when a new WebAssembly
module is instantiated and via the findScripts method on Debugger instances. SpiderMonkey constructs exactly one Debugger.Script for each underlying WebAssembly
module per Debugger instance. A Debugger.Script instance is a strong reference to the un...
... Please note at the time of this writing, support for WebAssembly is very preliminary. Many properties and methods below throw. ...
... Please note at the time of this writing, support for WebAssembly is very preliminary. Many properties and methods below throw. ...
Debugger.Source - Firefox Developer Tools
n metadata, the JavaScript implementation may generate a fresh Debugger.Source instance to represent each presentation, or it may use a single Debugger.Source instance to represent them all. Debugger.Source for WebAssembly For a Debugger.Source instance representing the serialized text of a block of WebAssembly code, its properties provide the serialized text as a string. Currently only entire
modules evaluated via new WebAssembly.
Module are represented. SpiderMonkey constructs exactly one Debugger.Source for each underlying WebAssembly
module per Debugger instance. Please note at the time of this writing, support for WebAssembly is very preliminary. Many properties below return placeholder values. Convention For descriptions of properties and methods below, if the behavior of the property...
...ystem; the entire string is not a valid URL. For Function.prototype's script, this is null. Source may be loaded from a URL in the following ways: The URL may appear as the src attribute of a <script> element in markup text. The URL may be passed to the Worker web worker constructor, or the web worker importScripts function. The URL may be the name of a XPCOM JavaScript
module or subscript. (Note that code passed to eval, the Function constructor, or a similar function isnot considered to be loaded from a URL; the url accessor on Debugger.Source instances for such sources should return undefined.) If the instance refers to WebAssembly code, the URL of the script that called new WebAssembly.
Module with the string "> wasm" appended. sourceMapURL If the ins...
...read, it is guaranteed not to be a debuggee of the Debugger instance that owns this source; and thus the creating call is never "in debuggee code". Relating a worker to its creator, and other multi-threaded debugging concerns, are out of scope for Debugger. If the instance refers to WebAssembly code, introductionScript is the Debugger.Script instance referring to the same underlying WebAssembly
module. introductionOffset is undefined. Source Metadata Generated from file: js/src/doc/Debugger/Debugger.Source.md Watermark: sha256:5ca245813db96628aab1c78b803355eb2aa8c575839c67eb7d7bde177898df88 Changeset: e91b2c85aacd ...
Event - Web APIs
HTML elements (such as <button>, <div>, <span>, etc.) using EventTarget.addEventListener(), and this generally replaces using the old HTML event handler attributes. Further, when properly added, such handlers can also be disconnected if needed using removeEventListener(). ...
...nerally replaces using the old HTML event handler attributes. Further, when properly added, such handlers can also be disconnected if needed using removeEventListener(). Note: One element can have several such handlers, even for the exact same event--particularly if separate, independent code
modules attach them, each for its own independent purposes. ...
... the old HTML event handler attributes. Further, when properly added, such handlers can also be disconnected if needed using removeEventListener(). Note: One element can have several such handlers, even for the exact same event--particularly if separate, independent code
modules attach them, each for its own independent purposes. ...
MouseEvent.pageX - Web APIs
the document as it is, this property takes into account any horizontal scrolling of the page. For example, if the page is scrolled such that 200 pixels of the left side of the document are scrolled out of view, and the mouse is clicked 100 pixels inward from the left edge of the view, the value returned by pageX will be 300. Originally, this property was defined as a long integer. The CSSOM View
Module redefined it as a double float. See the Browser compatibility section for details. See Page in Coordinate systems for some additional information about coordinates specified in this fashion. Syntax var pageX = MouseEvent.pageX; Value A floating-point number of pixels from the left edge of the document at which the mouse was clicked, regardless of any scrolling or viewport positioning that ma...
...on about coordinates specified in this fashion. Syntax var pageX = MouseEvent.pageX; Value A floating-point number of pixels from the left edge of the document at which the mouse was clicked, regardless of any scrolling or viewport positioning that may be in effect. This property was originally specified in the Touch Events specification as a long integer, but was redefined in the CSSOM View
Module to be a double-precision floating-point number to allow for subpixel precision. Even though numeric types both are represented by Number in JavaScript, they may be handled differently internally in the browser's code, resulting in potential behavior differences. See Browser compatibility to learn which browsers have been updated to use the revised data type. Example More examples You can also ...
...rdinates relative to the page. CSS The CSS used for this example is shown below. .box { width: 400px; height: 250px; border: 2px solid darkblue; background-color: blue; color: white; font: 16px "Zilla", "Open Sans", "Helvetica", "Arial", sans-serif; } Result Try this out here: Specifications Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'pageX' in that specification. Working Draft Redefined from long to double. Touch EventsThe definition of 'pageX' in that specification. Unknown Initial definition. Prior to being added to the CSSOM View specification, pageX and pageY were available on the UIEvent interface in a limited subset of browsers for a short time. ...
CSS Basic User Interface - CSS: Cascading Style Sheets
Reference Properties appearance box-sizing cursor ime-mode nav-down nav-left nav-right nav-up outline outline-width outline-style outline-color outline-offset resize text-overflow user-select Guides Using URL values for the cursor property Explains how a URL can be used with the cursor property to produce custom cursors. ...
... ...
... ...
CSS Color - CSS: Cascading Style Sheets
Reference Properties color color-adjust opacity Data types <color> Guides Applying color to HTML elements using CSS A guide to using CSS to apply color to a variety of types of content. All color-related CSS properties are touched upon. Tools Color picker tool This tool makes it easy to create, adjust, and experiment with custom colors. ...
...ity Data types <color> Guides Applying color to HTML elements using CSS A guide to using CSS to apply color to a variety of types of content. All color-related CSS properties are touched upon. ...
...or to HTML elements using CSS A guide to using CSS to apply color to a variety of types of content. All color-related CSS properties are touched upon. ...
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
In this article we will take a look at how Flexbox fits in with all the other CSS
modules. We'll find out which specifications you also need to take notice of if you want to learn flexbox, and find out why flexbox is different to some other
modules. Note: CSS versions 1 and 2 were a single monolithic specification where all of CSS was defined in one large document. As CSS became a more feature rich language, maintaining one huge specification became problematic, with different parts of CSS moving on at different speeds. CSS was therefore modularised, and the various CSS Specifications are different
modules that make up CSS today. These
modules relate to each other, and are at different stages of development. ...
...efined in one large document. As CSS became a more feature rich language, maintaining one huge specification became problematic, with different parts of CSS moving on at different speeds. CSS was therefore modularised, and the various CSS Specifications are different
modules that make up CSS today. These
modules relate to each other, and are at different stages of development. The box alignment
module For many people the first reason they start to look at flexbox is because of the ability to properly align flex items inside a flex container. Flexbox provides access to properties that allow the alignment of items on their cross axis and justification of items on the main axis. These properties started life in the flexbox specification, but are now also part of the Box Alignment Specification.
...e defined in CSS Box Alignment [CSS-ALIGN-3], Flexible Box Layout reproduces the definitions of the relevant ones here so as to not create a normative dependency that may slow down advancement of the spec. These properties apply only to flex layout until CSS Box Alignment Level 3 is finished and defines their effect for other layout modes. Additionally, any new values defined in the Box Alignment
module will apply to Flexible Box Layout; in otherwords, the Box Alignment
module, once completed, will supercede the definitions here." In a later article in this series -- Aligning items in a flex container -- we will take a thorough look at how the Box Alignment properties apply to flex items. The gap properties A recent addition to the Box Alignment specification has been the row-gap and column-...
CSS Fonts - CSS: Cascading Style Sheets
It lets you define the style of a font, such as its family, size and weight, line height, and the glyph variants to use when multiple are available for a single character. Basic example The following example shows a simple use of basic font properties to style a paragraph of text. ...
... fonts are an evolution of the OpenType font specification that enables many different variations of a typeface to be incorporated into a single file, rather than having a separate font file for every width, weight, or style. This article will give you all you need to know to get you started using variable fonts. ...
...ile, rather than having a separate font file for every width, weight, or style. This article will give you all you need to know to get you started using variable fonts. Specifications Specification Status Comment CSS Fonts
Module Level 4 Working Draft Adds font-variation-settings (and related higher-level properties) and font-optical-sizing. ...
CSS Images - CSS: Cascading Style Sheets
Reference Properties image-orientation image-rendering image-resolution object-fit object-position Functions linear-gradient() radial-gradient() repeating-linear-gradient() repeating-radial-gradient() conic-gradient() repeating-conic-gradient() url() element() image() cross-fade() Data types <gradient> <image> Guides Using CSS gradients Presents a specific type of CSS images, gradients, and how to create and use these. ...
...ient> <image> Guides Using CSS gradients Presents a specific type of CSS images, gradients, and how to create and use these. Implementing image sprites in CSS Describes the common technique grouping several images in one single document to save download requests and speed up the availability of a page. Specifications Specification Status Comment CSS Images
Module Level 4 Working Draft Added image-resolution, conic-gradient(), and image() CSS Images
Module Level 3 Candidate Recommendation Added image-orientation, image-rendering, object-fit and object-position Compatibility StandardThe definition of 'CSS Gradients' in that specification. Living Standard Standardizes the -webkit prefixed gradient value functions ...
... Candidate Recommendation CSS Level 2 (Revision 1)The definition of '<uri>' in that specification. ...
CSS Scroll Snap - CSS: Cascading Style Sheets
CSS Scroll Snap is the current implementation. ...
...CSS Scroll Snap is the current implementation. ...
...l-margin-top scroll-margin-right scroll-margin-bottom scroll-margin-left scroll-margin-inline scroll-margin-inline-start scroll-margin-inline-end scroll-margin-block scroll-margin-block-start scroll-margin-block-end Guides Basic concepts of CSS Scroll Snap Browser Compatibility and Scroll Snap Specification Specification Status Comment CSS Scroll Snap
Module Level 1 Candidate Recommendation Initial definition ...
CSS values and units - CSS: Cascading Style Sheets
is detailed in the specification as a combination unit, e.g. <length-percentage>. Other possible combinations are as follows: <frequency-percentage> <angle-percentage> <time-percentage> Special data types (defined in other specs) <color> <image> <position> Color The <color> value specifies the color of an element feature (e.g. it's background color), and is defined in the CSS Color
Module. Image The <image> value specifies all the different types of image that can be used in CSS, and is defined in the CSS Image Values and Replaced Content
Module. Position The <position> type defines 2D positioning of an object inside a positioning area, for example a background image inside a container. This type is interpreted as a background-position and therefore specified in the CSS Backg...
... see notes regarding whitespace within pages for min(), max() and clamp() functions.) Some legacy functional notations such as rgba() use commas, but generally commas are only used to separate items in a list. If a comma is used to separate arguments, white space is optional before and after the comma. Specifications Specification Status Comment CSS Values and Units
Module Level 4 Editor's Draft Adds the vi, vb, ic, cap, lh and rlh units. Adds the min(), max() and clamp() functional notation Adds toggle() CSS Values and Units
Module Level 3 Candidate Recommendation Adds calc(), ch, rem, vw, vw, vmin, vmax, Q CSS Color
Module Level 4 Working Draft Adds commaless syntaxes for the rgb(), rgba(), hsl(), and hsla() functions. ...
...Working Draft Adds commaless syntaxes for the rgb(), rgba(), hsl(), and hsla() functions. Allows alpha values in rgb() and hsl(), turning rgba() and hsla() into (deprecated) aliases for them. Adds color keyword rebeccapurple. Adds 4- and 8-digit hex color values, where the last digit(s) represents the alpha value. Adds hwb(), device-cmyk(), and color() functions. CSS Color
Module Level 3 Recommendation Deprecates system-colors. Adds SVG colors. Adds the rgba(), hsl(), and hsla() functions. CSS Images
Module Level 4 Working Draft Adds element(), image(), image-set(), conic-gradient() CSS Images
Module Level 3 Candidate Recommendation Initial definition of image. CSS Level 2 (Revision 1) Recommendation CS...
<custom-ident> - CSS: Cascading Style Sheets
st not start with a dash followed by a decimal digit. bili.bob Only alphanumeric characters, _, and - needn't be escaped. --toto It must not start with two dashes. This would be a custom property. 'bilibob' This would be a <string>. "bilibob" This would be a <string>. Specifications Specification Status Comment CSS Values and Units
Module Level 4The definition of '<custom-ident>' in that specification. Editor's Draft CSS Will Change
Module Level 1The definition of '<custom-ident> for will-change' in that specification. Candidate Recommendation Defines which values are excluded for will-change. CSS Counter Styles Level 3The definition of '<custom-ident> for list-style-type' in that specification. C...
...in that specification. Candidate Recommendation Defines which values are excluded for will-change. CSS Counter Styles Level 3The definition of '<custom-ident> for list-style-type' in that specification. Candidate Recommendation Uses <custom-ident> instead of a finite list of keywords. Defines which values are excluded for list-style-type and @counter-style. ...
... Candidate Recommendation Renames <identifier> to <custom-ident>. Makes it a pseudo-type and forbids the use of excluded values. CSS Level 2 (Revision 1)The definition of '<identifier>' in that specification. Recommendation Initial definition. ...
HTML attribute: rel - HTML: Hypertext Markup Language
ve help. Link Link Link icon Icon representing the current document. External Resource Not allowed Not allowed license Indicates that the main content of the current document is covered by the copyright license described by the referenced document. Link Link Link manifest Web app manifest Link Not allowed Not allowed
modulepreload Tells to browser to preemptively fetch the script and store it in the document's
module map for later evaluation. Optionally, the
module's dependencies can be fetched as well. External Resource Not allowed Not allowed next Indicates that the current document is a part of a series, and that the next document in the series is the referenced document. Link Link ...
...ment, the standard doesn't distinguish between a hyperlink applying to a specific part of the document or to the document as a whole. Only the data on the page can indicate this. <link rel="license" href="#license"> Note: Although recognized, the synonym copyright is incorrect and must be avoided. manifest Web app manifest. Requires the use of the CORS protocol for cross-origin fetching. ...
...ocument as a whole. Only the data on the page can indicate this. <link rel="license" href="#license"> Note: Although recognized, the synonym copyright is incorrect and must be avoided. manifest Web app manifest. Requires the use of the CORS protocol for cross-origin fetching.
modulepreload Useful for improved performance, and relevant to the <link> anywhere in the document, setting rel="
modulepreload" tells the browser to preemptively fetch the script (and dependencies) and store it in the document's
module map for later evaluation.
modulepreload links can ensure network fetching is done with the
module ready (but not evaluated) in the
module map before it is necessarily needed. See also link types:
modulepreload. next Relevant to <form>, <link>, <a>, and <area>, the next values indi...
Allowing cross-origin use of images and canvas - HTML: Hypertext Markup Language
rver as well as writing code for the web site itself. Web server configuration The first thing we need is a server that's configured to host images with the Access-Control-Allow-Origin header configured to permit cross-origin access to image files. Let's assume we're serving our site using Apache. ...
... for the web site itself. Web server configuration The first thing we need is a server that's configured to host images with the Access-Control-Allow-Origin header configured to permit cross-origin access to image files. Let's assume we're serving our site using Apache. ...
...cess to image files. Let's assume we're serving our site using Apache. Consider the HTML5 Boilerplate Apache server configuration file for CORS images, shown below: <If
Module mod_setenvif.c> <If
Module mod_headers.c> <FilesMatch "\.(bmp|cur|gif|ico|jpe?g|png|svgz?|webp)$"> SetEnvIf Origin ":" IS_CORS Header set Access-Control-Allow-Origin "*" env=IS_CORS </FilesMatch> </If
Module> </If
Module> In short, this configures the server to allow graphic files (those with the extensions ".bmp", ".cur", ".gif", ".ico", ".jpg", ".jpeg", ".png", ".svg", ".svgz", and ".webp") to be accessed cross-origin from anywhere on the internet. Implementing the save feature Now that the server has been configured to allow retrieval of the images cross-origin, we can write the code that allows...
WebAssembly.Instance.prototype.exports - JavaScript
We then call an Exported WebAssembly function that is exported by the Instance. ...
...We then call an Exported WebAssembly function that is exported by the Instance. ...
...s an object containing as its members all the functions exported from the WebAssembly
module instance, to allow them to be accessed and used by JavaScript. instance.exports Examples Using exports After fetching some WebAssembly bytecode using fetch, we compile and instantiate the
module using the WebAssembly.instantiateStreaming() function, importing a JavaScript function into the WebAssembly
Module in the process. We then call an Exported WebAssembly function that is exported by the Instance. var importObject = { imports: { imported_func: function(arg) { console.log(arg); } } }; WebAssembly.instantiateStreaming(fetch('simple.wasm'), importObject) .then(obj => obj.instance.exports.exported_func()); Note: You can also find this example as instantiate-streaming.html on Gi...
WebAssembly.instantiateStreaming() - JavaScript
The WebAssembly.instantiateStreaming() function compiles and instantiates a WebAssembly
module directly from a streamed underlying source. This is the most efficient, optimized way to load wasm code. Syntax Promise<ResultObject> WebAssembly.instantiateStreaming(source, importObject); Parameters source A Response object or a promise that will fulfill with one, representing the underlying source of a .wasm
module you want to stream, compile, and instantiate. importObject Optional An object containing the values to be imported into the newly-created Instance, such as functions or WebAssembly.Memory objects. There must be one matching property for each declared import of the compiled
module or else a WebAssembly.LinkError is thrown. Return value A Promise that resolves to a ResultObject...
...ream, compile, and instantiate. importObject Optional An object containing the values to be imported into the newly-created Instance, such as functions or WebAssembly.Memory objects. There must be one matching property for each declared import of the compiled
module or else a WebAssembly.LinkError is thrown. Return value A Promise that resolves to a ResultObject which contains two fields:
module: A WebAssembly.
Module object representing the compiled WebAssembly
module. This
Module can be instantiated again or shared via postMessage(). instance: A WebAssembly.Instance object that contains all the Exported WebAssembly functions. Exceptions If either of the parameters are not of the correct type or structure, a TypeError is thrown. If the operation fails, the promise rejects with a W...
...meters are not of the correct type or structure, a TypeError is thrown. If the operation fails, the promise rejects with a WebAssembly.CompileError, WebAssembly.LinkError, or WebAssembly.RuntimeError, depending on the cause of the failure. Examples Instantiating streaming The following example (see our instantiate-streaming.html demo on GitHub, and view it live also) directly streams a .wasm
module from an underlying source then compiles and instantiates it, the promise fulfilling with a ResultObject. Because the instantiateStreaming() function accepts a promise for a Response object, you can directly pass it a WindowOrWorkerGlobalScope.fetch() call, and it will pass the response into the function when it fulfills. var importObject = { imports: { imported_func: arg => console.log(arg) } }...
JavaScript
end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Tutorials Learn how to program in JavaScript with guides and tutorials. For complete beginners Head over to our Learning Area JavaScript topic if you want to learn JavaScript but have no previous experience of JavaScript or programming. The complete
modules available there are as follows: JavaScript first steps Answers some fundamental questions such as "what is JavaScript?", "what does it look like?", and "what can it do?", along with discussing key JavaScript features such as variables, strings, numbers, and arrays. JavaScript building blocks Continues our coverage of JavaScript's key fundamental features, turning our attention to commonly-...
...rage of JavaScript's key fundamental features, turning our attention to commonly-encountered types of code blocks such as conditional statements, loops, functions, and events. Introducing JavaScript objects The object-oriented nature of JavaScript is important to understand if you want to go further with your knowledge of the language and write more efficient code, therefore we've provided this
module to help you. Asynchronous JavaScript Discusses asynchronous JavaScript, why it is important, and how it can be used to effectively handle potential blocking operations such as fetching resources from a server. Client-side web APIs Explores what APIs are, and how to use some of the most common APIs you'll come across often in your development work. JavaScript guide JavaScript Guide A muc...
...uide A much more detailed guide to the JavaScript language, aimed at those with previous programming experience either in JavaScript or another language. Intermediate Understanding client-side JavaScript frameworks JavaScript frameworks are an essential part of modern front-end web development, providing developers with proven tools for building scalable, interactive web applications. This
module gives you some fundamental background knowledge about how client-side frameworks work and how they fit into your toolset, before moving on to tutorial series covering some of today's most popular ones. A re-introduction to JavaScript An overview for those who think they know about JavaScript. JavaScript data structures Overview of available data structures in JavaScript. Equality comparis...
How to make PWAs re-engageable using Notifications and Push - Progressive web apps (PWAs)
e shown, and ttl is the time-to-live setting that keeps the notification available on the server for a specified amount of time, also defined in seconds. Now, onto the next JavaScript file. server.js The server part is written in Node.js and needs to be hosted somewhere suitable, which is a subject for an entirely separate article. We will only provide a high-level overview here. The web-push
module is used to set the VAPID keys, and optionally generate them if they are not available yet. const webPush = require('web-push'); if (!process.env.VAPID_PUBLIC_KEY || !process.env.VAPID_PRIVATE_KEY) { console.log("You must set the VAPID_PUBLIC_KEY and VAPID_PRIVATE_KEY "+ "environment variables. You can use the following ones:"); console.log(webPush.generateVAPIDKeys()); return; } webP...
...; if (!process.env.VAPID_PUBLIC_KEY || !process.env.VAPID_PRIVATE_KEY) { console.log("You must set the VAPID_PUBLIC_KEY and VAPID_PRIVATE_KEY "+ "environment variables. ...
...bPush.generateVAPIDKeys()); return; } webPush.setVapidDetails( 'https://serviceworke.rs/', process.env.VAPID_PUBLIC_KEY, process.env.VAPID_PRIVATE_KEY ); Next, a
module defines and exports all the routes an app needs to handle: getting the VAPID public key, registering, and then sending notifications. You can see the variables from the index.js file being used: payload, delay and ttl. ...
x - SVG: Scalable Vector Graphics
defines the x coordinate of the uper left corner of the referenced element. Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, x is a Geometry Property meaning this attribute can also be used as a CSS property for used elements. ...
... Default value 0 Animatable Yes Note: Starting with SVG2, x is a Geometry Property meaning this attribute can also be used as a CSS property for used elements. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'x' in that specification. Working Draft Definition for <filter> Filter Effects
Module Level 1The definition of 'x' in that specification. ...
...n also be used as a CSS property for used elements. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'x' in that specification. Working Draft Definition for <filter> Filter Effects
Module Level 1The definition of 'x' in that specification. Working Draft Definition for <feSpotLight> Filter Effects
Module Level 1The definition of 'x' in that specification. Working Draft Definition for <fePointLight> Filter Effects
Module Level 1The definition of 'x' in that specification. Working Draft Definition for filter primitives CSS Masking
Module Level 1The definition of 'x' in that specification. Candidate Recommendation Definition for <mask> Scalable Vector Gra...
y - SVG: Scalable Vector Graphics
y defines the y coordinate of the uper left corner of the referenced element. Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, y is a Geometry Property meaning this attribute can also be used as a CSS property for used elements. ...
... Default value 0 Animatable Yes Note: Starting with SVG2, y is a Geometry Property meaning this attribute can also be used as a CSS property for used elements. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'y' in that specification. Working Draft Definition for <filter> Filter Effects
Module Level 1The definition of 'y' in that specification. ...
...n also be used as a CSS property for used elements. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'y' in that specification. Working Draft Definition for <filter> Filter Effects
Module Level 1The definition of 'y' in that specification. Working Draft Definition for <feSpotLight> Filter Effects
Module Level 1The definition of 'y' in that specification. Working Draft Definition for <fePointLight> Filter Effects
Module Level 1The definition of 'y' in that specification. Working Draft Definition for filter primitives CSS Masking
Module Level 1The definition of 'y' in that specification. Candidate Recommendation Definition for <mask> Scalable Vector Gra...
Exported WebAssembly functions - WebAssembly
in a little more detail. Exported... what? Exported WebAssembly functions are basically just JavaScript wrappers that represent WebAssembly functions in JavaScript. When you call them, you get some activity in the background to convert the arguments into types that wasm can work with (for example converting JavaScript numbers to Int32), the arguments are passed to the function inside your wasm
module, the function is invoked, and the result is converted and passed back to JavaScript. You can retrieve exported WebAssembly functions in two ways: By calling Table.prototype.get() on an existing table. By accessing a function exported from a wasm
module instance via Instance.exports. Either way, you get the same kind of wrapper for the underlying function. From a JavaScript point of view, ...
...sole.log(tbl.get(1)()); // 42 otherTable.set(0,tbl.get(0)); otherTable.set(1,tbl.get(1)); console.log(otherTable.get(0)()); console.log(otherTable.get(1)()); }); Here we create a table (otherTable) from JavaScript using the WebAssembly.Table constructor, then we load table.wasm into our page using the WebAssembly.instantiateStreaming() method. We then get the function exported from the
module, retrieve the functions it references via tbl.get() and log the result of invoking each one to the console. Next, we use set() to make the otherTable table contain references to the same functions as the tbl table. To prove this, we then retrieve these references back from otherTable and print their results to console too, which gives the same results. They are real functions In the previous e...
.... testFunc.toString() returns an interesting result: function 0() { [native code] } This gives you more of an idea of its wrapper-type nature. Some other particulars to be aware of with exported WebAssembly functions: Their length property is the number of declared arguments in the wasm function signature. Their name property is the toString() result of the function's index in the wasm
module. If you try to call a exported wasm function that takes or returns an i64 type value, it currently throws an error because JavaScript currently has no precise way to represent an i64. This may well change in the future though -- a new int64 type is being considered for future standards, which could then be used by wasm. ...
self - Archive of obsolete content
This article documents the self object that is available as a global in content scripts. self provides: access to the options object access to the port object access to a mostly deprecated messaging API For an overview of content scripts, see the main article. Note that the self object in content scripts is completely different from the self
module, which provides an API for an add-on to access its data files and ID. self Properties options Content-scripting APIs such as tab.attach(), page-mod, and page-worker let you pass read-only data to the content script as a JSON object via the contentScriptOptions option. If you do this, the data is available to the content script in the options property of self: // main.js const tabs = require("sdk/tabs"); tabs.open({ url: "./page.htm...
...use port to receive messages from, and send messages to, the main add-on code. See the documentation for port. Methods The self object has four methods, which enable the content script to send messages to, and receive messages from, the main add-on code. This is an older API than the API provided by port, and for most purposes the port API is a better choice. The exception is the context-menu
module, which still uses postMessage. postMessage() Send a message from a content script to a listener in the main add-on code: self.postMessage(contentScriptMessage); This takes a single parameter, the message payload, which may be any JSON-serializable value. on() Start listening to messages from the main add-on code: self.on("message", function(addonMessage) { // Handle the message }); Thi...
Communicating using "postMessage" - Archive of obsolete content
Handling Message Events in the Content Script To send a message from a content script, you use the postMessage function of the global self object: self.postMessage(contentScriptMessage); This takes a single parameter, the message payload, which may be any JSON-serializable value. ...
...essage); However, for page-mod objects you need to listen to the onAttach event and use the worker supplied to that: var pageMod = require('sdk/page-mod').PageMod({ include: ['*'], contentScript: pageModScript, onAttach: function(worker) { worker.postMessage(addonMessage); } }); To receive messages from a content script, use the worker's on function. ...
Porting the Library Detector - Archive of obsolete content
(worker.tab); } }); } }); The content script is executed once for every window.onload event, so it will run multiple times when a single page containing multiple iframes is loaded. So main.js needs to filter out any duplicates, in case a page contains more than one iframe, and those iframes use the same library. Implementing the User Interface Showing the Library Array The widget
module is a natural fit for displaying the library list. We'll specify its content using HTML, so we can display an array of icons. The widget must be able to display different content for different windows, so we'll use the WidgetView object. main.js will create an array of icons corresponding to the array of library names, and use that to build the widget's HTML content dynamically: function buildWi...
...e + "<br>Version: " + library.version); }); widgetContent += htmlContentPostamble; return widgetContent; } function updateWidgetView(tab) { var widgetView = widget.getView(tab.window); if (!tab.libraries) { tab.libraries = []; } widgetView.content = buildWidgetViewContent(tab.libraries); widgetView.width = tab.libraries.length * ICON_WIDTH; } main.js will use the tabs
module to update the widget's content when necessary (for example, when the user switches between tabs): tabs.on('activate', function(tab) { updateWidgetView(tab); }); tabs.on('ready', function(tab) { tab.libraries = []; }); Showing the Library Detail The XUL library detector displayed the detailed information about each library on mouseover in a tooltip: we can't do this using a widget, so ins...
Guides - Archive of obsolete content
This page lists more theoretical in-depth articles about the SDK. Contributor's guide Getting Started Learn how to contribute to the SDK: getting the code, opening/taking a bug, filing a patch, getting reviews, and getting help.
Modules Learn about the
module system used by the SDK (which is based on the CommonJS specification), how sandboxes and compartments can be used to improve security, and about the built-in SDK
module loader, known as Cuddlefish. Classes and Inheritance Learn how classes and inheritance can be implemented in JavaScript, using constructors and prototypes, and about the helper functions provided by the SDK to simplify this. Private Properties Learn how private properties can be implemented in JavaScript using prefixes, closures, and WeakMaps, and how the...
...rivate properties by using namespaces (which are a generalization of WeakMaps). Content Processes The SDK was designed to work in an environment where the code to manipulate web content runs in a different process from the main add-on code. This article highlights the main features of that design. Testing the Add-on SDK Learn how to run the Add-on SDK test suites. SDK infrastructure
Module structure of the SDK The SDK, and add-ons built using it, are of composed from reusable JavaScript
modules. This explains what these
modules are, how to load
modules, and how the SDK's
module tree is structured. SDK API lifecycle Definition of the lifecycle for the SDK's APIs, including the stability ratings for APIs. Program ID The Program ID is a unique identifier for your add-on. Thi...
context-menu - Archive of obsolete content
ntScript, reference the selected text as selection.text Private windows If your add-on has not opted into private browsing, then any menus or menu items that you add will not appear in context menus belonging to private browser windows. To learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing
module. More examples For conciseness, these examples create their content scripts as strings and use the contentScript property. In your own add-on, you will probably want to create your content scripts in separate files and pass their URLs using the contentScriptFile property. See Working with Content Scripts for more information. Warning: Unless your content script is extremely simple and consist...
...searchURL = data + node.textContent;' + ' window.location.href = searchURL;' + '});', items: [googleItem, wikipediaItem, moreMenu] }); If you need a tooltip: First you need a dummy menu item that will serve as a trigger and subsequently will add the tooltips to the actual menu items. It is easy to find out which menu items are constructed by the addon-sdk
module because they have the class addon-context-menu-item. The difficult part it to identify those that belong to your extension. One way to achieve this it to utilize the data attribute of Item class constructor, which conveniently maps to the value attribute of the underlying xul element. So if data consists of unique prefix and the desired tooltip text, it is just a matter of kicking in the right ...
indexed-db - Archive of obsolete content
ple: window.indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.msIndexedDB; var request = window.indexedDB.open("MyDatabase"); request.onerror = function(event) { console.log("failure"); }; request.onsuccess = function(event) { console.log("success"); }; Because your main add-on code can't access the DOM, you can't do this. ...
...action, IDBOpenDBRequest, and IDBObjectStore, are accessible through the indexedDB object itself. The API exposed by indexed-db is almost identical to the DOM IndexedDB API, so we haven't repeated its documentation here, but refer you to the IndexedDB API documentation for all the details. The database created will be unique and private per add-on, and is not linked to any website database. The
module cannot be used to interact with a given website database. See bug 778197 and bug 786688. Example This example uses the action button API, which is only available from Firefox 29 onwards. Here's a complete add-on that adds two buttons to the browser: the button labeled "Add" adds the title of the current tab to a database, while the button labeled "List" lists all the titles in the database. ...
panel - Archive of obsolete content
A panel is a dialog. Its content is specified as HTML and you can execute scripts in it, so the appearance and behavior of the panel is limited only by what you can do using HTML, CSS, and JavaScript. ...
...quire("sdk/panel").Panel({ width: 180, height: 180, contentURL: "https://en.wikipedia.org/w/index.php?title=Jetpack&useformat=mobile" }); myPanel.show(); You can also load HTML that's been packaged with your add-on, and this is most probably how you will create dialogs. To do this, save the HTML in your add-on's data directory and load it using the data.url() method exported by the self
module, like this: var myPanel = require("sdk/panel").Panel({ contentURL: require("sdk/self").data.url("myFile.html") }); myPanel.show(); From Firefox 34, you can use "./myFile.html" as an alias for self.data.url("myFile.html"). So you can rewrite the above code like this: var myPanel = require("sdk/panel").Panel({ contentURL: "./myFile.html" }); myPanel.show(); Panel positioning By defaul...
passwords - Archive of obsolete content
You can then use the credentials to access their related service (for example, by logging into a web site). Store credentials in the Password Manager. ...
...The password. url For an add-on credential, this property is of the form: addon:<addon-id>, where <addon-id> is the add-on's Program ID. You don't supply this value when storing an add-on credential: it is automatically generated for you. However, you can use it to work out which stored credentials belong to your add-on by comparing it with the uri property of the self
module. realm You can use this as a name for the credential, to distinguish it from any other credentials you've stored. The realm is displayed in Firefox's Password Manager, under "Site", in brackets after the URL. For example, if the realm for a credential is "User Registration", then its "Site" field will look something like: addon:jid0-01mBBFyu0ZAXCFuB1JYKooSTKIc (User ...
selection - Archive of obsolete content
h listener will be called after a selection is made. function myListener() { console.log("A selection has been made."); } var selection = require("sdk/selection"); selection.on('select', myListener); // You can remove listeners too. selection.removeListener('select', myListener); Iterating Over Discontiguous Selections Discontiguous selections can be accessed by iterating over the selection
module itself. Each iteration yields a Selection object from which text, html, and isContiguous properties can be accessed. Private Windows If your add-on has not opted into private browsing, then you won't see any selections made in tabs that are hosted by private browser windows. To learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the...
...on object from which text, html, and isContiguous properties can be accessed. Private Windows If your add-on has not opted into private browsing, then you won't see any selections made in tabs that are hosted by private browser windows. To learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing
module. Examples Log the current contiguous selection as text: var selection = require("sdk/selection"); if (selection.text) console.log(selection.text); Log the current discontiguous selections as HTML: var selection = require("sdk/selection"); if (!selection.isContiguous) { for (var subselection in selection) { console.log(subselection.html); } } Surround HTML selections with delimite...
console/traceback - Archive of obsolete content
See nsIException for more information. ...
... element thus represents a stack frame and has the following keys: filename The name of the file that the stack frame takes place in. lineNo The line number is being executed at the stack frame. funcName The name of the function being executed at the stack frame, or null if the function is anonymous or the stack frame is being executed in a top-level script or
module. See nsIException for more information. Globals Functions fromException(exception) Attempts to extract the traceback from exception. Parameters exception : exception exception where exception is an nsIException. Returns traceback : JSON representation of the traceback or null if not found. get() Returns JSON : Returns the JSON representation of the stack at the point that this ...
content/loader - Archive of obsolete content
Provides one of the building blocks for those
modules that use content scripts to interact with web content, such as panel and page-mod. Usage The
module exports a constructor for the Loader object, which inherits on(), once(), and removeListener() functions that enable its users to listen to events. Loader adds code to initialize and validate a set of properties for managing content scripts: contentURL contentScript contentScriptFile contentScriptWhen contentScriptOptions allow When certain of these properties are set, the Loader emits a propertyChange event, enabling its users to take the appropriate action. The Loader is used by
modules that use content scripts but don't themselves load content, such as page-mod.
Modules that load their own content, such as panel and page-wo...
...Symbiont inherits from Loader but contains its own frame into which it loads content supplied as the contentURL option. ...
content/symbiont - Archive of obsolete content
Usage A Symbiont loads the specified contentURL and content scripts into a frame, and sets up an asynchronous channel between the content scripts and the add-on code, enabling them to exchange messages using the port or postMessage APIs. You map optionally pass a frame into the Symbiont's constructor: if you don't, then a new hidden frame will be created to host the content. This trait is composed from the Loader and Worker traits. It inherits functions to load and configure content scripts from the Loader, and functions to exchange messages between content scripts and the main add-on code from the Worker. ...
...sages between content scripts and the main add-on code from the Worker. var { Symbiont } = require('sdk/content/content'); var Thing = Symbiont.resolve({ constructor: '_init' }).compose({ constructor: function Thing(options) { // `getMyFrame` returns the host application frame in which // the page is loaded. this._frame = getMyFrame(); this._init(options) } }); See the panel
module for a real-world example of usage of this
module. Globals Constructors Symbiont(options) Creates a content symbiont. Parameters options : object Optional options: Name Type frame object The host application frame in which the page is loaded. If frame is not provided hidden one will be created. contentScriptWhen string When t...
loader/sandbox - Archive of obsolete content
n which case the sandbox will get the same privileges as a script loaded from that URL a DOM window object, to inherit privileges from the window being passed. omitted or null: then the sandbox will have chrome privileges giving it access to all the XPCOM components. Optionally the sandbox function can be passed a second argument (See sandbox documentation on MDN for details). Evaluate code
Module provides evaluate function that lets you execute code in the given sandbox: evaluate(scope, 'var a = 5;'); evaluate(scope, 'a + 2;'); //=> 7 More details about evaluated script may be passed via optional arguments that may improve exception reporting: // Evaluate code as if it was loaded from 'http://foo.com/bar.js' and // start from 2nd line. evaluate(scope, 'a ++', 'http://foo.com/bar.js', 2...
...via optional arguments that may improve exception reporting: // Evaluate code as if it was loaded from 'http://foo.com/bar.js' and // start from 2nd line. evaluate(scope, 'a ++', 'http://foo.com/bar.js', 2); Version of JavaScript can be also specified via an optional argument: evaluate(scope, 'let b = 2;', 'bar.js', 1, '1.5'); // throws cause `let` is not defined in JS 1.5. Load scripts This
module provides a limited API for loading scripts from local URLs. data: URLs are supported. load(scope, 'resource://path/to/my/script.js'); load(scope, 'file:///path/to/script.js'); load(scope, 'data:,var a = 5;'); Globals Functions sandbox(source) Make a new sandbox that inherits principals from source. Parameters source : string|window|null An object that determines the privileges that will b...
places/history - Archive of obsolete content
Access the user's browsing history. Usage This
module exports a single function, search(), which synchronously returns a PlacesEmitter object which then asynchronously emits data and end or error events that contain information about the state of the operation. Example let { search } = require("sdk/places/history"); // Simple query search( { url: "https://developers.mozilla.org/*" }, { sort: "visitCount" } ).on("end", function (results) { // results is an array of objects containing // data about visits to any site on developers.mozilla.org // ordered by visit count }); // Complex query // The query objects are OR'd together // Let's say we want to retrieve all visits from before a week ago // with the query of 'ruby', but from last week onwards, we want // all results with 'j...
... string A string specifying how the results should be sorted. Possible options are 'title', 'date', 'url', 'visitCount', 'keyword', 'dateAdded' and 'lastModified'. descending boolean A boolean specifying whether the results should be in descending order. By default, results are in ascending order. PlacesEmitter The PlacesEmitter is not exposed in the
module, but returned from the search functions. The PlacesEmitter inherits from event/target, and emits data, error, and end. data events are emitted for every individual search result found, whereas end events are emitted as an aggregate of an entire search, passing in an array of all results into the handler. Events data The data event is emitted for every item returned from a search. Arguments O...
system/unload - Archive of obsolete content
Therefore, when you register an object with ensure(), you can call its destructor method yourself, you can let it happen for you, or you can do both. The destructor will be called with a single argument describing the reason for the unload; see when(). If object does not have the expected destructor method, then an exception is thrown when ensure() is called. ...
...e called with a single argument describing the reason for the unload; see when(). If object does not have the expected destructor method, then an exception is thrown when ensure() is called. Parameters object : object An object that defines a destructor method. name : string Optional name of the destructor method. Default is unload. when(callback) Registers a function to be called when the
module is unloaded. Parameters callback : function A function that will be called when the
module is unloaded. It is called with a single argument, one of the following strings describing the reason for unload: "uninstall", "disable", "shutdown", "upgrade", or "downgrade". If a reason could not be determined, undefined will be passed instead. Note that if an add-on is unloaded with reason "disable", ...
jpmignore - Archive of obsolete content
m the xpi generated by jpm xpi. Using .jpmignore to allow files Everything in your add-on directory will be included in the xpi file you make with jpm xpi. If your project folder contains a lot of files that aren't necessary for the xpi to run, like documentation, jshint, etc., you can use .jpmignore as a whitelist instead of a blacklist. ...
...ad of a blacklist. For example: .* * !/data/** !/lib/** !/locale/** !/node_
modules/** !/package.json !/icon.png !/icon64.png !/COPYING !/bootstrap.js !/install.rdf This would include all editor backup files and similar in the whitelisted subdirectories, to avoid that you can append another blacklist after the whitelist. ...
Display a Popup - Archive of obsolete content
A panel's content is defined using HTML. You can run content scripts in the panel: although the script running in the panel can't directly access your main add-on code, you can exchange messages between the panel script and the add-on code. In this tutorial we'll create an add-on that adds an action button to the toolbar that displays a panel when clicked. The panel just contains a <textarea> element: when the user presses the return key, the contents of the <textarea> is sent to the main add-on code. The main add-on code logs the message to the console. ...
... To learn more about buttons, see the action button and toggle button API reference. ...
Getting Started (jpm) - Archive of obsolete content
ated, or you have installed Firefox Developer as an alternate browser, you may need to provide the path to it. For example, in Ubuntu: jpm run -b /usr/bin/firefox When Firefox launches, in the top-right corner of the browser you'll see an icon with the Firefox logo. Click the icon, and a new tab will open with http://www.mozilla.org/ loaded into it. That's all this add-on does. It uses two SDK
modules: the action button
module, which enables you to add buttons to the browser, and the tabs
module, which enables you to perform basic operations with tabs. In this case, we've created a button whose icon is the Firefox icon, and added a click handler that loads the Mozilla home page in a new tab. Try editing this file. For example, we could change the page that gets loaded: var buttons = require...
... add-on template jpm run to run a new instance of Firefox with the add-on installed, so we can try it out jpm xpi to package the add-on into an XPI file for distribution These are the three main commands you'll use when developing SDK add-ons. There's comprehensive reference documentation covering all the commands you can use and all the options they take. The add-on code itself uses two SDK
modules, action button and tabs. There's reference documentation for all the high-level and low-level APIs in the SDK. What's next? To get a feel for some of the things you can do with the SDK APIs, try working through some of the tutorials. ...
Add-on SDK - Archive of obsolete content
te add-ons and tools for creating, running, testing, and packaging add-ons. Tutorials Getting started How to install the SDK and use the jpm tool to develop, test, and package add-ons. Interact with the browser Open web pages, listen for pages loading and list open pages. Development techniques Learn about common development techniques, such as unit testing, logging, creating reusable
modules, localization, and mobile development. Create user interface components Create user interface components such as toolbar buttons, context menus, menu items, and dialogs. Modify web pages Modify pages matching a URL pattern or dynamically modify a particular tab. Putting it together Walkthrough of the Annotator example add-on. Guides Contributor's guide Learn how to start co...
... user interface components such as toolbar buttons, context menus, menu items, and dialogs. Modify web pages Modify pages matching a URL pattern or dynamically modify a particular tab. Putting it together Walkthrough of the Annotator example add-on. Guides Contributor's guide Learn how to start contributing to the SDK and about the most important idioms used in the SDK code such as
modules, classes and inheritance, private properties, and content processes. SDK infrastructure Aspects of the SDK's underlying technology:
modules, the Program ID and the rules defining Firefox compatibility. Content scripts A detailed guide to working with content scripts. SDK idioms The SDK's event framework and the distinction between add-on scripts and content scripts. XUL migration A ...
Custom about: URLs - Archive of obsolete content
ox 48 and up. Services.io.newChannel was deprecated, and the signature of the newChannel method changed. This change is reflected in the code below. This code will work for all versions of Firefox 4 and up. ...
... // const ABOUTPAGE_URI = 'chrome://myaboutaddon/content/index.html'; class AboutPage { static get classID() { return Components.ID(`{${ABOUTPAGE_ID}}`); } static get classDescription() { return ABOUTPAGE_DESCRIPTION; } static get contractID() { return `@mozilla.org/network/protocol/about;1?what=${ABOUTPAGE_WORD}`; } static get QueryInterface() { return XPCOMUtils.generateQI([Ci.nsIAbout
Module]); } constructor() { Object.freeze(this); } getURIFlags(aURI) { return Ci.nsIAbout
Module.ALLOW_SCRIPT; } newChannel(aURI, aSecurity_or_aLoadInfo) { let channel; if (Services.vc.compare(Services.appinfo.version, '47.*') > 0) { const uri = Services.io.newURI(ABOUTPAGE_URI, null, null); // greater than or equal to firefox48 so aSecurity_or_aLoadInfo is aL...
Custom XUL Elements with XBL - Archive of obsolete content
[CDATA[ this.parentNode.removeChild(this); ]]></body> </method> As you can see, it's very easy to define a method and the parameters it takes. You can also have a return value using the return keyword, just like on regular JS code. The method uses the parent node to remove the Person node. Simple enough. You can do almost anything from XBL code, including using XPCOM components, JS Code
Modules and available chrome scripts. The main setback is that you can't have script tags defined in a binding, so you depend on the scripts that have been included in the XUL files that use the binding. Also unlike scripts, you can include stylesheets using the stylesheet XBL element. DTD and properties files can be handled just like in regular XUL. There are two conflicting patterns that you should...
...mind: encapsulation and separation of presentation and logic. Encapsulation mandates that you try to keep your XBL free of outside dependencies. That is, you shouldn't assume that script X will be included somewhere, because not including it will cause the binding to fail. This suggests that you should keep everything inside your binding. On the other hand, a binding is really just a presentation
module. Most XUL elements have basic presentation logic, and any other functionality is processed elsewhere. Plus, XBL files are significantly harder to manage than regular JS files. We prefer to err on the side of simplicity and keep the XBL as simple as possible. If that means having outside dependencies, so be it. But you can still keep some separation and versatility by using custom events to commun...
Overlay extensions - Archive of obsolete content
Prior to Firefox 4, and the Gecko 2 engine that powers it, this was the only way to develop extensions. This methodology has largely been superseded by restartless extensions, and the Add-on SDK, which is built on top of them. ...
...tension development. XUL Tutorials and reference for the user interface language used by XUL extensions. Code snippets Sample code for many of the things you'll want to do. Installing extensions How to install an extension by copying the extension files into the application's install directory. Firefox add-ons developer guide A guide to developing overlay extensions. JavaScript code
modules JavaScript
modules available to extension developers. Extension preferences How to specify the preferences for your extension that will appear in the Add-ons Manager. Extension packaging How extensions are packaged and installed. Binary Firefox extensions Creating binary extensions for Firefox. ...
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
ecame a master at manipulating and troubleshooting tables, nesting them in intricate ways to produce any layout or effect that could be imagined. I remember one project for Lycos where we had nested tables 10 levels deep. I counted them myself. It wasn't that every level was absolutely necessary to reproduce the intended design effects. But each table ensured the flexibility we needed if certain
modules and pieces of content appeared or disappeared. When you get to that point, the amount of markup you have to sift through to find anything becomes ridiculous. Until this redesign, Wired News wasn't even using CSS to style the content inside tables. The sheer amount [sic] of redundant <font> tags inside every cell was probably enough to double file size. My initial attempts at the markup and CSS ...
...I'm having a tough time thinking of any advantages... What disadvantages did you encounter? Honestly, there were several challenges and glitches we ran into along the way. First of al...
Using microformats - Archive of obsolete content
the document itself. Firefox 3 implements a global Microformats object that provides access to microformats. This object and its API make finding and reading microformats easy to do. Loading the microformats API The Microformats object is created using the new JavaScript script loader added to Firefox 3. To use the API, you need to first load the object: Components.utils.import("resource://gre/
modules/Microformats.js"); Once you've loaded the microformats API, you can manage microformats using the methods listed here; for information about parsing microformats, see Parsing microformats in JavaScript. Predefined microformats Firefox 3 provides definitions implementing several common microformats: adr Represents an address (such as a street or mailing address). geo Represents a geogra...
...tions implementing several common microformats: adr Represents an address (such as a street or mailing address). geo Represents a geographical location using latitude and longitude. hCard Represents contact information for a person. hCalendar Represents a calendar appointment entry. tag Used to add tags to other microformats. Methods add() Adds a new microformat to the microformat
module. Note: If a microformat by the specified name already exists, it is replaced by the new one. add(name, definition); Parameters name The name of the microformat to add to the microformat
module. definition A JavaScript structure describing the microformat. See Describing microformats in JavaScript for details. count() Counts the number of microformats in a document that match specifie...
JavaScript OS.Shared - Archive of obsolete content
All these tools are designed to be used with js-ctypes. For the moment,
module OS.Shared is accessible only from chrome workers. ...
...
Module OS.Shared contains tools to interact with the operating system (and, more generally, in C) in JavaScript. All these tools are designed to be used with js-ctypes. For the moment,
module OS.Shared is accessible only from chrome workers. Global object OS.Shared.Type Properties void_t voidptr_t char jschar int unsigned_int int32_t uint32_t int64_t uint64_t long bool off_t size_t ssize_t fd (Unix only) negativeone_or_fd (Unix only) negativeone_or_nothing (Unix only) string (Unix only) null_or_string (Unix only) HANDLE (Windows only) maybe_HANDLE (Windows only) DWORD (Windows only) negative_or_DWORD (Windows only) zero_or_DWORD (Windows only) zero_or_nothing (Windows only) declareFFI() intn_t() uintn_t()Instances of OS.Shared.Type convert_from_c() releaseWith() Attrib...
Space Manager Detailed Design - Archive of obsolete content
space to support the CSS notion of floated elements. There are three important parts to the Space Manager API: the parts that deal with the coordinate space of the Space Manager, the parts that deal with the regions managed by the Space Manager, and the parts that manage float impact intervals. The class nsSpaceManager is declared in the file nsSpaceManger.h. The class is only used in the layout
module and cannot be exported outside of that
module (nor does it need to be). It is not a general purpose class, and is not intended to be subclasses . Here is the class declaration, taken from the source file as of 01.08.02 /** * Class for dealing with bands of available space. The space manager * defines a coordinate space with an origin at (0, 0) that grows down * and to the right. */ class nsS...
...currently 4. If more than NS_SPACE_MANAGER_CACHE_SIZE are allocated at a time,then standard allocation is used. void* operator new(size_t aSize); void operator delete(void* aPtr, size_t aSize); A Static method is used to shutdown the Space Manager recycling. This method deletes all of the Space Mangers in the recycler,and prevents further recycling. It is meant to be called only when the layout
module is being terminated. static void Shutdown(); Origin / Coordinate Space Translation /** * Translate the current origin by the specified (dx, dy). This * creates a new local coordinate space relative to the current * coordinate space. */ void Translate(nscoord aDx, nscoord aDy) { mX += aDx; mY += aDy; } /** * Returns the current translation from local coordinate space to * world coordina...
Standalone XPCOM - Archive of obsolete content
1: XPCOM APIs are not frozen yet. By XPCOM 1.0 release they will be. NOTE 2: XPCOM Standalone differs from the XPCOM built with Mozilla. Hence cannot be used with the Mozilla browser. Building Standalone XPCOM Here are the instructions for building the Standalone XPCOM on Unix or Windows: Step 1 : Pull the sources cvs -z 3 co mozilla/client.mk cd mozilla gmake -f client.mk pull_all BUILD_
MODULES=xpcom Step 2 : Build XPCOM Standalone ./configure --enable-standalone-
modules=xpcom --enable-application=standalone gmake Testing Standalone XPCOM xpcom/sample contains a sample application and a component. This should get built by default. nsTestSample is the sample application. This should have been installed in your bin/ directory. libsample.so (unix) is the sample component impl...
...error messsages and possible ways of fixing them. ./nsTestSample: error in loading shared libraries: libxpcom.so: cannot open shared object file: No such file or directory LD_LIBRARY_PATH not set. To fix, setenv LD_LIBRARY_PATH . (note the dot). Link errors when building XPCOM standalone This is usually due to XPCOM not being built standalone. Make sure you did configure --enable-standalone-
modules=xpcom. What's the difference between Standalone and non-Standalone XPCOM? There is no binary difference between standalone XPCOM and the XPCOM that ships with the Mozilla browser. The one functional difference is that XPT files cannot be read from .zip files in standalone XPCOM. TODO for v 1.0 Optional exclusion of specific features into standalone XPCOM like registry, xpconnect. Tweeking...
Supporting per-window private browsing - Archive of obsolete content
Firefox 20 introduced per-window private browsing mode, in which private user data is stored and accessed concurrently with public user data from another window. Detecting private browsing mode Determining whether or not a given DOM window is private is simple: import resource://gre/
modules/PrivateBrowsingUtils.jsm and use PrivateBrowsingUtils.isWindowPrivate(window). You can then take action based on this value, as any data or actions originating from this window should be considered private. try { // Firefox 20+ Components.utils.import("resource://gre/
modules/PrivateBrowsingUtils.jsm"); if (!PrivateBrowsingUtils.isWindowPrivate(window)) { ... } } catch(e) { // pre Firefox 20 (if you do not have access to a do...
... return; } } Obtaining an nsILoadContext for privacy-sensitive APIs Some APIs (such as nsITransferable and nsIWebBrowserPersist) take nsILoadContext arguments that are used to determine whether they should be classed as private or not (for example, whether the URI being persisted by saveURI should be added to the permanent download history). To do this, import resource://gre/
modules/PrivateBrowsingUtils.jsm and use PrivateBrowsingUtils.getPrivacyContextFromWindow(win), passing a Window object that is related to the content in question. As an example, if an add-on adds a context menu item that accesses an API that requires an nsILoadContext, the most relevant window is the one that owns the element being targeted by the context menu (element.ownerDocument.defaultView). If so...
Venkman Introduction - Archive of obsolete content
nix, it is alone in offering this degree of flexibility, depth, and power in a visual debugging environment. Starting the Debugger The JavaScript Debugger is automatically pre-installed in Mozilla 1.x but must be installed separately in Firefox and other Gecko-based products, such as Thunderbird and Netscape 7.x. Fortunately, the XPInstall technology makes it possible to install new application
modules in Firefox by just clicking a hyperlink. If you don't already have Venkman or would like to upgrade, you can easily get the latest version from Firefox Add-ons. The installation process is two steps. First, from within the browser you want to host the debugger application, visit the Firefox Add-ons page and click on the "install" link for the most recent version. When the download is complete, ...
...wice to see possible completions. If only one command matches, it will be auto-completed on the first tab. View Customization Venkman offers nearly complete control over the arrangement and display of views within the application. The debugger is built on top of an application framework that allows you to drag and drop, resize, and toggle all the available views, and even to create new views or
modules for the debugger if you choose--though this latter is an advanced topic and a subject for a future article. To remove a view from Venkman, simply click the Close button at the top right of that view. When the view again becomes necessary--for example, when you open a source file from the Loaded Scripts view and want to view the source--the view reappears where it was last positioned. To make a ...
XML in Mozilla - Archive of obsolete content
We treat XHTML documents differently depending on the mime type (or file suffix if files are loaded from local discs). Files that go through the HTML code path are not checked for well-formedness. You will also notice not all XHTML features are supported when you exercise the HTML code path. ...
... also study. Lastly, there is a pref you might want to try (especially useful with FIXptr) that will select the link target when you traverse it. There is no UI for setting this pref yet, so you will need to manually edit the preferences file. Add this line: pref("layout.selectanchor", true); DOM Load and Save Methods document.load() is a part of an old version of the W3C DOM Level 3 Load & Save
module. Mozilla currently implements only the load() method and the document.async property. Outside Supported XML W3C Recommendations Specification or Technology Documentation Mozilla Project XSLT W3C Recommendation XSLT XPath W3C Recommendation XSLT XMLHttpRequest W3C Recommendation XML Extra...
Unix stub installer - Archive of obsolete content
raw. Debug using "gdb mozilla-installer-bin" and set a breakpoint at XPI_Init(). You can step into the XPInstall engine through the xpistub once the xpistub dll is loaded. How do I add an installer package to the unix installer? Adding a package involves a few steps: Add a section named for your <component> to the packages-unix manifest that describes which files from dist belong to which
module. For example, see the xpcom section that lists all the shared libraries as seen in dist. These are eventually zipped with the directory structure preserved. Read the top of the packages-unix file for it's simple syntax and semantics. Add an <component>.jst install script template file (the jst extension stands for javascript template indicating this is a template for the final install.js for the...
...ced at packages time with the browser version. $SpaceRequired$ which is replaced at package time with the amount of space in KB required for the package when it is fully extracted. Add a [ComponentX] section to the config.ini template file named config.it found at: <http://lxr.mozilla.org/seamonkey/sou...unix/config.it>. Then add the ComponentX into the appropriate Setup Types so the installer
module installs it when users select the Setup Types you choose it to be in. Finally add a call to generate the xpi at package time by adding a MakeXpiFile("<component>"); call at: <http://lxr.mozilla.org/seamonkey/sou.../makeall.pl#75> You can test it by changing your current working directory to mozilla/xpinstall/packager/unix and running "perl deliver.pl" on the shell prompt. The resulting stub and...
Windows stub installer - Archive of obsolete content
t/WIND32_D.OBJ/install Press F10 to step into the code How we get setup to debug the XPInstall engine from the Windows stub installer? This section needs to be added How do I add an installer package to the Windows installer? Adding a package involves a few steps: Add a section named for your <component> to the packages-win manifest that describes which files from dist belong to which
module. For example, see the xpcom section that lists all the shared libraries as seen in dist. These are eventually zipped with the directory structure preserved. Read the top of the packages-win file for it's simple syntax and semantics. Add an <component>.jst install script template file. The jst extension stands for javascript template indicating this is a template for the final install.js for the ...
...macro strings are grouped in this section. As with "Version", the macro name will be the first string in the substitution statement on each line. Add a [Component <component>]</component> section to the config.ini template file named config.it found at: <http://lxr.mozilla.org/seamonkey/sou...dows/config.it>. Then add the Component <component> into the appropriate Setup Types so the installer
module installs it when users select the Setup Types you choose it to be in. Finally add <component> to the component list array @gComponentList at: <http://lxr.mozilla.org/seamonkey/sou...makeall.pl#125> You can test it by changing your current working directory to mozilla/xpinstall/wizard/windows/builder and running "perl build.pl" on the shell prompt. The resulting stub installer and packages will ...
XPInstall - Archive of obsolete content
xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <Description about="urn:mozilla:install-manifest"> <!-- properties --> </Description> </RDF> Cross-Platform Install (XPInstall) is a technology used by Mozilla Application Suite, Mozilla Firefox, Mozilla Thunderbird and other XUL-based applications for installing extensions. An XPI (pronounced "zippy" and derived from XPInstall) installer
module is a ZIP file that contains an install script or manifest (entitled install.js or install.rdf) at the root of the file. Documentation XPInstall API Reference XPInstall API Reference. Learn XPI Installer Scripting by Example This article uses the installer script from browser.xpi install package as the basis for discussing XPI installations in general. ...
...ains an install script or manifest (entitled install.js or install.rdf) at the root of the file. Documentation XPInstall API Reference XPInstall API Reference. Learn XPI Installer Scripting by Example This article uses the installer script from browser.xpi install package as the basis for discussing XPI installations in general. Creating XPI Installer
Modules This article describes the packaging scheme of the Mozilla and offers a tutorial for creating a new package that can then be redistributed, installed, and made available to users. Install Wizards (aka: Stub Installers) View All... Community View Mozilla forums... Mailing list Newsgroup RSS feed Tools XPInstall trigger page...
Providing Command-Line Options - Archive of obsolete content
* @param aChromeURISpec a string specifying the URI of the window to open. * @param aArgument an argument to pass to the window (may be null) ...
... * @param aChromeURISpec a string specifying the URI of the window to open. * @param aArgument an argument to pass to the window (may be null) */ function openWindow(aChromeURISpec, aArgument) { Services.ww...
Debugging a XULRunner Application - Archive of obsolete content
more information about the error console see the Error Console and Browser Console article. Browser Debugger As of Gecko 44, it is no longer possible to start the DevTools server from XUL apps. See bug 1244163. Starting with XULRunner 24, you should use the Firefox Browser Debugger to debug your XULRunner apps. Add the following code to your XUL app: Components.utils.import('resource://gre/
modules/devtools/dbg-server.jsm'); if (!DebuggerServer.initialized) { DebuggerServer.init(); // Don't specify a window type parameter below if "navigator:browser" // is suitable for your app. DebuggerServer.addBrowserActors("myXULRunnerAppWindowType"); } DebuggerServer.openListener(6000); For XULRunner version 37+ the code to enable the debugger has changed: Components.utils.import('resource...
...ols/dbg-server.jsm'); if (!DebuggerServer.initialized) { DebuggerServer.init(); // Don't specify a window type parameter below if "navigator:browser" // is suitable for your app. ...
XULRunner tips - Archive of obsolete content
Useful Chrome URLs Most of these require branding. Window URL Window Type Extension Manager chrome://mozapps/content/extensions/extensions.xul?type=extensions Extension:Manager-extensions Theme Manager chrome://mozapps/content/extensions/extensions.xul?typ...
...king Windows display correct application name and icon when buttons are grouped By default, the task bar on Windows might group windows belonging to the same process into one button to save space. This button is usually called "xulrunner.exe" and has XULRunner's icon. There are two approaches to display the branding of your application instead: When compiling XULRunner yourself: create a file
module.ver in the directory mozilla/xulrunner/app with the contents: WIN32_
MODULE_DESCRIPTION=MyApplication MyApplication should be replaced by whatever you want to see as title of the button. You can also replace xulrunner.ico in the same directory to change XULRunner's icon to the icon of your application. With a precompiled XULRunner: use xulrunner-stub.exe to start your application but renam...
Mozilla release FAQ - Archive of obsolete content
ity. On what is Mozilla based? The Mozilla project started near the end of life of the 4.x line of Netscape Communicator. Originally, the plan was just to re-stabilize the code and release 5.0, but it was decided within the community that the more ambitious changes that were planned for later integration were close to being ready. The old layout engine, networking engine, and several of the older
modules were gutted, and much later, the sources reached the point where Netscape was comfortable making a release, and so Netscape 6.0 was released. Netscape 6.0 and above are based off of the Mozilla source. Mozilla 1.0 (Mozilla uses a different versioning system than Netscape) is due for release soon. When was Mozilla released? The source to Mozilla was first released on 31 March 1998. The code has b...
...doesn't already have the feature you wish to add. There have been changes since Communicator 4.0. Check out section 3 for details. Assured that it's not already there, you should post to the Mozilla usenet groups, asking for help. Finally, you should make sure that someone is not already working on the code you would need to modify to implement your feature. On www.mozilla.org, there is a list of
module 'owners'. This system ensures that 2 people are not working on the same part at the same time. Check for for the
module owner, and contact him/her. The specific area that you can find this is on the Mozilla Owners Document. How do I embed Mozilla's rendering engine into my application? Check out GTKmozilla in your tree at webshell/embed/gtk for an example of how to do this Common Topics of Discus...
Logging Multi-Process Plugins - Archive of obsolete content
om environment to enable this special logging mode. Make sure you have write permissions to wherever you wish to save the log. Your safest bet is your home directory (C:\Users\username on Windows Vista and above, C:\Documents and Settings\username on Windows XP, and ~ (home directory) on Mac OS X and Linux). Windows Make sure Firefox is not running. ...
...y) on Mac OS X and Linux). Windows Make sure Firefox is not running. From within a command prompt: C:\> set NSPR_LOG_
MODULES=IPCPlugins:5 C:\> set NSPR_LOG_FILE=c:\plugins.log C:\> cd C:\Program Files\Mozilla Firefox C:\> firefox.exe The log file will be saved to C:\plugins.log (or wherever NSPR_LOG_FILE is set). Linux Make sure Firefox is not running. From within a bash shell: $ export NSPR_LOG_
MODULES=IPCPlugins:5 $ export NSPR_LOG_FILE=~/plugins.log $ /usr/bin/firefox The file will be saved to ~/plugins.log (or wherever NSPR_LOG_FILE is set). ...
Atomic RSS - Archive of obsolete content
It brings in Atom elements into RSS, adding the advantages of Atom to RSS while maintaining backwards compatibility. ...
...at will help you get started with Atomic RSS. Atomic RSS uses Atom as an RSS
Module. It brings in Atom elements into RSS, adding the advantages of Atom to RSS while maintaining backwards compatibility. Documentation Selected Articles Atomic RSS Tim Bray talks about using Atom 1.0 as a micro format and extension
module for RSS 2.0; keeping RSS 2.0 as your sydication format but bringing in and using selected Atom 1.0 elements. References Atomic RSS Element List Examples none available at this time Community none available at this time Tools none available a...
Well-Formed Web - Archive of obsolete content
Getting Started A guided tutorial that will help you get started with the Well-Formed Web RSS
Module. The Well-Formed Web RSS
Module provides facilities for <item> level commenting: for linking to comments contained in an external RSS Feed, and for posting new comments. Documentation Selected Articles Why Well-Formed Web RSS
Module is Popular - Syndicating Your Comments Charles Iliya Krempeaux talks about the RSS Well-Formed Web
Module, why it is popular among some, and how it is used to link to your comments (2005-08-22). ...
...n an external RSS Feed, and for posting new comments. Documentation Selected Articles Why Well-Formed Web RSS
Module is Popular - Syndicating Your Comments Charles Iliya Krempeaux talks about the RSS Well-Formed Web
Module, why it is popular among some, and how it is used to link to your comments (2005-08-22). ...
Proposal - Archive of obsolete content
led with "Draft Exists" can be implemented, but be warned that they could radically change. Name Description Status Easy News Topics Easy News Topics (ENT) is intended to be a very simple standard for describing how topic information can be introduced into an RSS2.0 news feed. Draft Exists ICBM Let's you add latitude and longitude info to an item. Spec Exists iTunes RSS iTunes Extension
Modules used for IPradio/podcasting. Spec Exists Media RSS RSS Extension
Module used for IPTV and IPradio/podcasting. Spec Exists Newsgator Feed Extension Created to make RSS feeds work better with Newsgator software. Lets you specify an image, up to 277x78 pixels. And lets you specifies a specific rendering transform (XSLT) to be used when rendering the feed in NewsGator for Outlook. The transform ...
...Outlook. The transform must already exist on the machine running NewsGator; stylesheets will not be downloaded or installed automatically. Spec Exists RSS Disposition Hinting A proposal to make it so IPTV and IPradio/podcasting works better with RSS. Uses an HTTP "Content-Type" parameter to hint at an RSS feeds disposition type -- to hint at what is being syndicated. In Development rssHints A
module that adds elements to a feed that help an aggregator process them. Draft Exists Source GUID When an RSS item is posted in response to a previous item (called the source item) RSS 2.0 offers the source element which allows the item to refer to the RSS feed which contains the source item. The SGUID specification provides a more granular approach by offering an sourceRef element which can referenc...
XUL Parser in Python - Archive of obsolete content
u want to use it you have to go in and changes some of the stuff like CHROME_DIR and which information you want out. It also, I'm afraid, only works on the win32 platform, where the <tt>dir</tt> command it depends on gets you your XUL files. Again, you can easily use <tt>ls</tt> instead, as I should have done, and pick up some extra support. I will make these adjustments and change it into a real
module when I get a second, so that someone can instantiate the parser from their own scripts and use it more flexibly: >>> import XULTool >>> myXP = XULParser() >>> CHROME_DIR = 'D:\src\mozilla\xpfe' >>> res = myXP.parseXUL(CHROME_DIR, 'window', 'id') Where something like the above would write out all the XUL window ids in the build. Something like that, anyway. Results The results from the script...
...is just a very basic demonstration of using Python's XML parser with XUL. But Mozilla's upcoming support for languages like Perl and Python will really open up the Mozilla platform to tools and approaches of this kind--and make now a good time to start thinking about how these various technologies will be put together. The first level of support for Python in Mozilla will apparently be for Python
modules made available as XPCOM objects. Extending on the approach in this script, then, you could imagine a kind of introspective XUL chrome that could modify and replicate itself by calling services from the XULParser and XULWriter XPCOM objects. Please feel free to suggest changes, change the format of the results output, or adapt this script in any way you want. I have probably made some errors a...
Visual JS GE - Game development
sed game engine with GUI source editor only for Windows. The server is based on Node.js vs MySql, the client made in four variant on a JavaScript frameworks for 2d canvas JS , three.js , webGL2 vs glmatrix and 2d canvas with matter.js in typescript to complete the stack. Installation and setup First of all download Visual-js from bitbucket. Extract the package into your root folder. Installing
modules Navigate to server_instance/, then in the Node.js command prompt or console enter the following installation commands: npm install mysql npm install delivery npm install express npm install mkdirp npm install socket.io npm install nodemailer@0.7.0 Setting up config.js You will find config.js in the server_instance folder: All Node.js applications use the same folder -- server_instance. Some ...
... install mkdirp npm install socket.io npm install nodemailer@0.7.0 Setting up config.js You will find config.js in the server_instance folder: All Node.js applications use the same folder -- server_instance. Some apps might need to have local storage, for instance, editor.js. ...
Flex - MDN Web Docs Glossary: Definitions of Web-related terms
flex is a new value added to the CSS display property. Along with inline-flex it causes the element that it applies to to become a flex container, and the element's children to each become a flex item. The items then participate in flex layout, and all of the properties defined in the CSS Flexible Box Layout
Module may be applied. The flex property is a shorthand for the flexbox properties flex-grow, flex-shrink and flex-basis. ...
...ed. The flex property is a shorthand for the flexbox properties flex-grow, flex-shrink and flex-basis. In addition <flex> can refer to a flexible length in CSS Grid Layout. ...
Flexbox - MDN Web Docs Glossary: Definitions of Web-related terms
In the specification, Flexbox is described as a layout model for user interface design. The key feature of Flexbox is the fact that items in a flex layout can grow and shrink. Space can be assigned to the items themselves, or distributed between or around the items. Flexbox also enables alignment of items on the main or cross axis, thus providing a high level of control over the size and alignment of a group of items. ...
... around the items. Flexbox also enables alignment of items on the main or cross axis, thus providing a high level of control over the size and alignment of a group of items. ...
Assessment: Accessibility troubleshooting - Learn web development
Prerequisites: Basic computer literacy, a basic understanding of HTML, CSS, and JavaScript, an understanding of the previous articles in the course. Objective: To test basic knowledge of accessibility fundamentals. Starting point To get this assessment started, you should go and grab the ZIP containing the files that comprise the example. Decompress the contents into a new directory somewhere on your local computer. Alternatively, you could use a site like JSBin or Glitch to do your assessment. ...
...t. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). ...
Cascade and inheritance - Learn web development
s when you come across it in other people's code. However, we strongly recommend that you never use it unless you absolutely have to. !important changes the way the cascade normally works, so it can make debugging CSS problems really hard to work out, especially in a large stylesheet. One situation in which you may have to use it is when you are working on a CMS where you can't edit the core CSS
modules, and you really want to override a style that can't be overridden in any other way. But really, don't use it if you can avoid it. The effect of CSS location Finally, it is also useful to note that the importance of a CSS declaration depends on what stylesheet it is specified in -- it is possible for users to set custom stylesheets to override the developer's styles, for example the user might ...
... so far in the course, and is something that even professional web developers sometimes find tricky. We'd advise that you return to this article a few times as you continue through the course, and keep thinking about it. Refer back here if you start to come across strange issues with styles not applying as expected. It could be a specificity issue. ...
Fundamental CSS comprehension - Learn web development
Objective: To test comprehension of fundamental CSS theory, syntax and mechanics. Starting point To get this assessment started, you should: Go and grab the HTML file for the exercise, and the associated image file, and save them in a new directory on your local computer. ...
... Objective: To test comprehension of fundamental CSS theory, syntax and mechanics. ...
Handling different text directions - Learn web development
on -- see Test your skills: writing modes. Summary The concepts explained in this lesson are becoming increasingly important in CSS. An understanding of the block and inline direction -- and how text flow changes with a change in writing mode -- will be very useful going forward. It will help you in understanding CSS even if you never use a writing mode other than a horizontal one. ...
...singly important in CSS. An understanding of the block and inline direction -- and how text flow changes with a change in writing mode -- will be very useful going forward. It will help you in understanding CSS even if you never use a writing mode other than a horizontal one. In the next
module we will take a good look at overflow in CSS. ...
Images, media, and form elements - Learn web development
, essentially to avoid them being stretched strangely by the layout. To force the image to stretch to fill the grid cell it is in, you'd have to do something like following: img { width: 100%; height: 100%; } This would however stretch the image, so probably isn't what you'd want to do. Form elements Form elements can be a tricky issue when it comes to styling with CSS, and the Web Forms
module contains detailed guides to the trickier aspects of styling form elements, which I will not fully reproduce here. There are a few key basics worth highlighting in this section of the article. Many form controls are added to your page by way of the <input> element -- this defines simple form fields such as text inputs, through to more complex fields added in HTML5 such as color and date pickers. ...
...ned this information before you move on -- see Test your skills: Images and form elements. Summary This lesson has highlighted some of the differences you will encounter when working with images, media, and other unusual elements in CSS. In the next article we'll look over a few tips you'll find useful when you have to style HTML tables. ...
Flexbox - Learn web development
is still acceptable in as many browsers as possible. Flexbox is a bit trickier than some CSS features. For example, if a browser is missing a CSS drop shadow, then the site will likely still be usable. Not supporting flexbox features however will probably break a layout completely, making it unusable. We discuss strategies for overcoming cross browser support issues in our Cross browser testing
module. Test your skills! We have covered a lot in this article, but can you remember the most important information? You can find some further tests to verify that you've retained this information before you move on -- see Test your skills: Flexbox. Summary That concludes our tour of the basics of flexbox. We hope you had fun, and will have a good play around with it as you travel forward with your...
... to verify that you've retained this information before you move on -- see Test your skills: Flexbox. Summary That concludes our tour of the basics of flexbox. We hope you had fun, and will have a good play around with it as you travel forward with your learning. ...
Test Your Skills: Fundamental layout comprehension - Learn web development
This task will test some of your knowledge by way of developing a simple webpage layout using a variety of techniques. Note: You can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
...tuck and need help, or want an assessment. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). ...
Normal Flow - Learn web development
or a device such as a screen reader that reads out the content of the page. In addition, as normal flow is designed to make a readable document, by starting in this way you are working with the document rather than fighting against it as you make changes to the layout. Before digging deeper into different layout methods, it is worth revisiting some of the things you will have studied in previous
modules with regard to normal document flow. How are elements laid out by default? First of all, individual element boxes are laid out by taking the elements' content, then adding any padding, border and margin around them -- it's that box model thing again, which we've looked at earlier. By default, a block level element's content is 100% of the width of its parent element, and as tall as its conten...
...(255,84,104,0.3); border: 2px solid rgb(255,84,104); padding: 10px; margin: 10px; } span { background: white; border: 1px solid black; } Summary Now that you understand normal flow, and how the browser lays things out by default, move on to understand how to change this default display to create the layout needed by your design. Previous Overview: CSS layout Next In this
module Introduction to CSS layout Normal flow Flexbox Grid Floats Positioning Multiple-column layout Responsive design Beginner's guide to media queries Legacy layout methods Supporting older browsers Fundamental layout comprehension assessment ...
CSS first steps - Learn web development
CSS (Cascading Style Sheets) is used to style and lay out web pages -- for example, to alter the font, color, size, and spacing of your content, split it into multiple columns, or add animations and other decorative features. This
module provides a gentle beginning to your path towards CSS mastery with the basics of how it works, what the syntax looks like, and how you can start using it to add styling to HTML. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites Before starting this
module, you should have: Basic familiarity with using computers, and using the Web passively (i.e. looking at it, consuming the content.) A basic work environment set up as det...
... Before starting this
module, you should have: Basic familiarity with using computers, and using the Web passively (i.e. looking at it, consuming the content.) A basic work environment set up as detailed in Installing basic software, and an understanding of how to create and manage files, as detailed in Dealing with files. Basic familiarity with HTML, as discussed in the Introduction to HTML
module. Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin or Glitch. Guides This
module contains the following articles, which will take you through all the basic theory of CSS, and provide opportunities for you to test out some skills. What...
Advanced form styling - Learn web development
icle first before attempting it. Summary While there are still difficulties using CSS with HTML forms, there are ways to get around many of the problems. There are no clean, universal solutions, but modern browsers offer new possibilities. For now, the best solution is to learn more about the way the different browsers support CSS when applied to HTML form controls. ...
...iversal solutions, but modern browsers offer new possibilities. For now, the best solution is to learn more about the way the different browsers support CSS when applied to HTML form controls. In the next article of this
module, we will explore the different UI pseudo-classes available to us in modern browsers for styling forms in different states. ...
The HTML5 input types - Learn web development
security measure! Your apps should always perform security checks on any form-submitted data on the server-side as well as the client-side, because client-side validation is too easy to turn off, so malicious users can still easily send bad data through to your server. Read Website security for an idea of what could happen; implementing server-side validation is somewhat beyond the scope of this
module, but you should bear it in mind. Note that a@b is a valid email address according to the default provided constraints. This is because the email input type allows intranet email addresses by default. To implement different validation behavior, you can use the pattern attribute, and you can also custom the error messages; we'll talk how to use these features in the Client-side form validation art...
...d this information before you move on -- see Test your skills: HTML5 controls. Summary That brings us to the end of our tour of the HTML5 form input types. There are a few other control types that cannot be easily grouped together due to their very specific behaviors, but which are still essential to know about. We cover those in the next article. ...
Styling web forms - Learn web development
s, such as ::-moz-range-track, but these are not consistent across browsers, so can't be relied upon. We will mention these later as well. The good To style form controls that are easy to style with CSS, you shouldn't face much if any difficulties, since they mostly behave like any other HTML element. We already looked at some simple form styling in Your first form, and the CSS building blocks
module contains some useful form styling essentials too. As well as the basic CSS tools covered above, we've also been provided with several selectors -- UI pseudo-classes -- that enable styling based on the current state of the UI. We cover these in detail in the next article, UI pseudo-classes. We'll walk through an example at the end of this article to give you some more ideas on basic form control...
...ests to verify that you've retained this information before you move on -- see Test your skills: Styling basics. Summary As you can see, as long as we want to build forms with just text fields and buttons, it's easy to style them using CSS. In the next article, we will see how to handle form widgets which fall into the "bad" and "ugly" categories. ...
UI pseudo-classes - Learn web development
do-classes with a prefix up to version 78; at which point it started to support the unprefixed version. The full example looks like so: Note: :enabled and :read-write are two more pseudo-classes that you'll probably rarely use, given that they describe the default states of input elements. Radio and checkbox states -- checked, default, indeterminate As we've seen in earlier articles in the
module, radio buttons and checkboxes can be checked or unchecked. But there are a couple of other states to consider too: :default: Matches radios/checkboxes that are checked by default, on page load (i.e. by setting the checked attribute on them) These match the :default pseudo-class, even if the user unchecks them. :indeterminate: When radios/checkboxes are neither checked nor unchecked, they are ...
...find some further tests to verify that you've retained this information before you move on -- see Test your skills: Advanced styling. Summary This completes our look at UI pseudo-classes that relate to form inputs. Keep playing with them, and create some fun form styles! Next up, we'll move on to something different -- client-side form validation. ...
Web forms — Working with user data - Learn web development
This
module provides a series of articles that will help you master the essentials of web forms. Web forms are a very powerful tool for interacting with users -- most commonly they are used for collecting data from users, or allowing them to control a user interface. However, for historical and technical reasons it's not always obvious how to use them to their full potential. In the articles listed below, we'll cover all the essential aspects of Web forms including marking up their HTML structure, styling form controls, validating form data, and submitting data to the server. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites Before starting this
module, you ...
...so need to learn some specific techniques to style form controls, and some scripting knowledge is required to handle things like validation and creating custom form controls. Therefore, before you look at the other sections listed below we'd recommend that you go away and learn some CSS and JavaScript first. The above text is a good indicator as to why we've put web forms into its own standalone
module, rather than trying to mix bits of it into the HTML, CSS, and JavaScript topic areas -- form elements are more complex than most other HTML elements, and they also require a close marriage of related CSS and JavaScript techniques to get the most out of them. Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (m...
HTML basics - Learn web development
ovide the reader with enough information to have a good idea of what the image conveys. In this example, our current text of "My test image" is no good at all. A much better alternative for our Firefox logo would be "The Firefox logo: a flaming fox surrounding the Earth." Try coming up with some better alt text for your image now. Find out more about accessibility in our accessibility learning
module. Marking up text This section will cover some of the essential HTML elements you'll use for marking up the text. Headings Heading elements allow you to specify that certain parts of your content are headings -- or subheadings. In the same way that a book has the main title, chapter titles and subtitles, an HTML document can too. HTML contains 6 heading levels, <h1>-<h6>, although you'll comm...
... Dealing with files HTML basics CSS basics JavaScript basics Publishing your website How the web works ...
Debugging HTML - Learn web development
y a single problem, in a domino effect. You will know when all your errors are fixed when you see the following banner in your output: Summary So there we have it, an introduction to debugging HTML, which should give you some useful skills to count on when you start to debug CSS, JavaScript, and other types of code later on in your career. ...
...ion to debugging HTML, which should give you some useful skills to count on when you start to debug CSS, JavaScript, and other types of code later on in your career. This also marks the end of the Introduction to HTML
module learning articles -- now you can go on to testing yourself with our assessments: the first one is linked below. ...
Choosing the right approach - Learn web development
We'll probably add to this resource as time goes on. Prerequisites: Basic computer literacy, a reasonable understanding of JavaScript fundamentals. Objective: To be able to make a sound choice of when to use different asynchronous programming techniques. ...
... Full support No support No supportUser must explicitly enable this feature.User must explicitly enable this feature. ...
Image gallery - Learn web development
lding blocks Now that we've looked at the fundamental building blocks of JavaScript, we'll test your knowledge of loops, functions, conditionals and events by getting you to build a fairly common item you'll see on a lot of websites -- a JavaScript-powered image gallery. Prerequisites: Before attempting this assessment you should have already worked through all the articles in this
module. Objective: To test comprehension of JavaScript loops, functions, conditionals, and events. Starting point To get this assessment started, you should go and grab the ZIP file for the example, unzip it somewhere on your computer, and do the exercise locally to begin with. Alternatively, you could use a site like JSBin or Glitch to do your assessment. You could paste the HTML, ...
... A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). ...
Drawing graphics - Learn web development
cle provides an introduction to canvas, and further resources to allow you to learn more. Prerequisites: JavaScript basics (see first steps, building blocks, JavaScript objects), the basics of Client-side APIs Objective: To learn the basics of drawing on <canvas> elements using JavaScript. Graphics on the Web As we talked about in our HTML Multimedia and embedding
module, the Web was originally just text, which was very boring, so images were introduced -- first via the <img> element and later via CSS properties such as background-image, and SVG. This however was still not enough. While you could use CSS and JavaScript to animate (and otherwise manipulate) SVG vector images -- as they are represented by markup -- there was still no way to do the same for bitmap ...
...d by implementing it in the years that followed. As you'll see below, canvas provides many useful tools for creating 2D animations, games, data visualizations, and other types of app, especially when combined with some of the other APIs the web platform provides. The below example shows a simple 2D canvas-based bouncing balls animation that we originally met in our Introducing JavaScript objects
module: Around 2006-2007, Mozilla started work on an experimental 3D canvas implementation. This became WebGL, which gained traction among browser vendors, and was standardized around 2009-2010. WebGL allows you to create real 3D graphics inside your web browser; the below example shows a simple rotating WebGL cube: This article will focus mainly on 2D canvas, as raw WebGL code is very complex. We...
Client-side web APIs - Learn web development
When writing client-side JavaScript for web sites or applications, you will quickly encounter Application Programming Interfaces (APIs). APIs are programming features for manipulating different aspects of the browser and operating system the site is running on, or manipulating data from other web sites or services. In this
module, we will explore what APIs are, and how to use some of the most common APIs you'll come across often in your development work. ...
... data from other web sites or services. In this
module, we will explore what APIs are, and how to use some of the most common APIs you'll come across often in your development work. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites To get the most out of this
module, you should have worked your way through the previous JavaScript
modules in the series (First steps, Building blocks, and JavaScript objects). Those
modules typically involve simple API usage, as it is often difficult to write client-side JavaScript examples without them. For this tutorial, we will assume that you are knowledgable about the core JavaScript language, and we will explore common Web...
Arrays - Learn web development
Here we look at why this is useful, then explore how to create an array, retrieve, add, and remove items stored in an array, and more besides. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, an understanding of what JavaScript is. Objective: To understand what arrays are and how to manipulate them in JavaScript. What is an array? Arrays are generally described as "list-like objects"; they are basically single objects that contain multiple values stored in a list. ...
...formation before you move on -- see Test your skills: Arrays. Conclusion After reading through this article, we are sure you will agree that arrays seem pretty darn useful; you'll see them crop up everywhere in JavaScript, often in association with loops in order to do the same thing to every item in an array. We'll be teaching you all the useful basics there are to know about loops in the next
module, but for now you should give yourself a clap and take a well-deserved break; you've worked through all the articles in this
module! The only thing left to do is work through this
module's assessment, which will test your understanding of the articles that came before it. ...
Basic math in JavaScript — numbers and operators - Learn web development
ew! Useful Number methods The Number object, an instance of which represents all standard numbers you'll use in your JavaScript, has a number of useful methods available on it for you to manipulate numbers. We don't cover these in detail in this article because we wanted to keep it as a simple introduction and only cover the real basic essentials for now; however, once you've read through this
module a couple of times it is worth going to the object reference pages and learning more about what's available. For example, to round your number to a fixed number of decimal places, use the toFixed() method. Type the following lines into your browser's console: let lotsOfDecimal = 1.766584958675746364; lotsOfDecimal; let twoDecimalPlaces = lotsOfDecimal.toFixed(2); twoDecimalPlaces; Converting to...
...ty short. In the next article, we'll explore text and how JavaScript allows us to manipulate it. Note: If you do enjoy math and want to read more about how it is implemented in JavaScript, you can find a lot more detail in MDN's main JavaScript section. ...
Storing the information you need — Variables - Learn web development
tains data about their name, height, weight, what language they speak, how to say hello to them, and more. Try entering the following line into your console: let dog = { name : 'Spot', breed : 'Dalmatian' }; To retrieve the information stored in the object, you can use the following syntax: dog.name We won't be looking at objects any more for now -- you can learn more about those in a future
module. Dynamic typing JavaScript is a "dynamically typed language", which means that, unlike some other languages, you don't need to specify what data type a variable will contain (numbers, strings, arrays, etc). For example, if you declare a variable and give it a value enclosed in quotes, the browser treats the variable as a string: let myString = 'Hello'; Even if the value contains numbers, it ...
...You can find some further tests to verify that you've retained this information before you move on -- see Test your skills: variables. Summary By now you should know a reasonable amount about JavaScript variables and how to create them. ...
Adding features to our bouncing balls demo - Learn web development
Previous Overview: Objects In this assessment, you are expected to use the bouncing balls demo from the previous article as a starting point, and add some new and interesting features to it. Prerequisites: Before attempting this assessment you should have already worked through all the articles in this
module. Objective: To test comprehension of JavaScript objects and object-oriented constructs Starting point To get this assessment started, make a local copy of index-finished.html, style.css, and main-finished.js from our last article in a new directory in your local computer. Alternatively, you could use a site like JSBin or Glitch to do your assessment. You could paste the HTML, CSS and JavaScript into one of these online editors. If the online editor ...
...essment. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). ...
Introducing JavaScript objects - Learn web development
objects, from core JavaScript features like arrays to the browser APIs built on top of JavaScript. You can even create your own objects to encapsulate related functions and variables into efficient packages and act as handy data containers. The object-based nature of JavaScript is important to understand if you want to go further with your knowledge of the language, therefore we've provided this
module to help you. Here we teach object theory and syntax in detail, then look at how to create your own objects. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites Before starting this
module, you should have some familiarity with HTML and CSS. You are advised to wor...
...ail, then look at how to create your own objects. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites Before starting this
module, you should have some familiarity with HTML and CSS. You are advised to work through the Introduction to HTML and Introduction to CSS
modules before starting on JavaScript. You should also have some familiarity with JavaScript basics before looking at JavaScript objects in detail. Before attempting this
module, work through JavaScript first steps and JavaScript building blocks. Note: If you are working on a computer/tablet/other devices where you don't have the ability to create your own files, you could try out (most of) the code ...
HTML performance features - Learn web development
Previous Overview: Performance Next HTML is by default fast and accessible. It is our job, as developers, to ensure that we preserve these two properties when creating or editing HTML code. Complications can occur when, for example, the file size of a <video> embed is too large, or when a webpage is not optimized for mobile devices. This
module intends to walk you through the key HTML performance features that can drastically improve the quality of your webpage. Prerequisites: Basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. Objective: To learn about the impact of HTML elements and attributes on web performance optimization. Elements & attributes impacting performance The <picture> Element The <...
...imization. Elements & attributes impacting performance The <picture> Element The <video> Element The <source> Element The <img> srcset attribute Responsive images Preloading content with rel="preload" - (https://w3c.github.io/preload/ ) async / defer attributes <iframe> <object> <script> rel attribute Conclusion Previous Overview: Performance Next In this
module The "why" of web performance What is web performance? How do users perceive performance? Measuring performance Multimedia: images Multimedia: video JavaScript performance best practices. HTML performance features CSS performance features Fonts and performance Mobile performance Focusing on performance See Also The <picture> Element The <video> Element The <source> Element Th...
What is web performance? - Learn web development
Performance measurements: Web performance involves measuring the actual and perceived speeds of an application, optimizing where possible, and then monitoring the performance, to ensure that what you've optimized stays optimized. This involves a number of metrics (measurable indicators that can indicate success or failure) and tools to meaure those metrics, which we will discuss throughout this
module. To summarize, many features impact performance including latency, application size, the number of DOM nodes, the number of resource requests made, JavaScript performance, CPU load, and more. It is important to minimize the loading and response times, and add additional features to conceal latency by making the experience as available and interactive as possible, as soon as possible, while asyn...
...it for now; we hope our brief overview of the web performance topic helped you to get an idea of what it is all about, and made you excited to learn more. Next up we'll look at perceived performance, and how you can use some clever techniques to make some unavoidable performance hits appear less severe to the user, or disguise them completely. Previous Overview: Performance Next In this
module The "why" of web performance What is web performance? How do users perceive performance? Measuring performance Multimedia: images Multimedia: video JavaScript performance best practices. HTML performance features CSS performance features Fonts and performance Mobile performance Focusing on performance ...
JavaScript performance - Learn web development
ry for other features may improve developer experience, but is all that JavaScript required? Is there a lighter weight or home spun solutions? Some features may not be necessary, and though they may add some bling, is the cost of the feature in terms of performance worth it? Remove unused code Split the JavaScript into smaller files Code-split JavaScript into critical and non-critical parts.
Module bundlers like webpack support code-splitting. Optimize these smaller files Minification reduces the number of characters in your file, thereby reducing the number of bytes or weight of your JavaScript. Gzipping compresses the file further, and should be used even if you don't minify. Brotli is similar to Gzip, generally outperforming Gzip's compression. Render impact Web applications ...
...ct Conclusion While optimizing your media files and scripts will get you very far along in terms of web performance optimization, everything that touches a web pages impacts performance. In the next article we take a look at some HTML features that can impact performance, including some attributes specifically created to improve performance. Previous Overview: Performance Next In this
module The "why" of web performance What is web performance? How do users perceive performance? Measuring performance Multimedia: images Multimedia: video JavaScript performance best practices. HTML performance features CSS performance features Fonts and performance Mobile performance Focusing on performance ...
Website security - Learn web development
ticle has explained the concept of web security and some of the more common threats against which your website should attempt to protect. Most importantly, you should understand that a web application cannot trust any data from the web browser. All user data should be sanitized before it is displayed, or used in SQL queries and file system calls. ...
...l user data should be sanitized before it is displayed, or used in SQL queries and file system calls. With this article, you've come to the end of this
module, covering your first steps in server-side website programming. We hope you've enjoyed learning these fundamental concepts, and you're now ready to select a Web Framework and start programming. ...
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
checked). We'll also wire up our "Clear completed" button. Along the way, we'll learn about using conditional rendering in our templates. Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. A deeper understanding of modern JavaScript features (such as classes,
modules, etc), will be extremely beneficial, as Ember makes heavy use of them. Objective: To continue our learning about components classes, start looking at conditional rendering, and wire up some of our footer functionality. Connecting the behavior in the footer To get the footer working, we need to implement the following thre areas of functionality: A pending todo counter...
...e-changing operations be in the same place. Summary That's enough for now. At this point, not only can we mark todos as complete, but we can clear them as well. Now the only thing left to wire up the footer are the three filtering links: "All", "Active", and "Completed". We'll do that in the next article, using Routing. ...
Ember resources and troubleshooting - Learn web development
ides you with a list of resources that you can use to go further in your learning, plus some useful troubleshooting and other information. Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. A deeper understanding of modern JavaScript features (such as classes,
modules, etc), will be extremely beneficial, as Ember makes heavy use of them. Objective: To provide further resource links and troubleshooting information. Further resources Ember.JS Guides Tutorial: Super Rentals Ember.JS API Documentation Ember.JS Discord Server -- a forum/chat server where you can meet the Ember community, ask for help, and help others! Gen...
...n the model hook is loading. error -- what to do when an error is thrown from model. Both loading and error can render default templates as well as customized templates defined elsewhere in the application, unifying loading/error states. More information on everything a Route can do is found in the API documentation. ...
Ember app structure and componentization - Learn web development
ith planning out the structure of our TodoMVC Ember app, adding in the HTML for it, and then breaking that HTML structure into components. Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. A deeper understanding of modern JavaScript features (such as classes,
modules, etc), will be extremely beneficial, as Ember makes heavy use of them. Objective: To learn how to structure an Ember app, and then break that structure into components. Planning out the layout of the TodoMVC app In the last article we set up a new Ember project, then added and configured our CSS styles. At this point we add some HTML, planning out the structure and semant...
... being invoked twice, and the todo text is hardcoded into it. We'll look at showing different todo items in the next article! Summary Great! Everything looks as it should. We have successfully refactored our HTML into components! In the next article we'll start looking into adding interactivity to our Ember application. ...
React interactivity: Events and state - Learn web development
s not possible to update the props a component receives; only to read them. React provides a variety of special functions that allow us to provide new capabilities to components, like state. These functions are called hooks, and the useState hook, as its name implies, is precisely the one we need in order to give our component some state. To use a React hook, we need to import it from the react
module. In Form.js, change your very first line so that it reads like this: import React, { useState } from "react"; This allows us to import the useState() function by itself, and utilize it anywhere in this file. useState() creates a piece of state for a component, and its only parameter determines the initial value of that state. It returns two things: the state, and a function that can be used to...
...dles state, and implemented functionality to add tasks, delete tasks, and toggle tasks as completed. We are nearly there. In the next article we'll implement functionality to edit existing tasks and filter the list of tasks between all, completed, and incomplete tasks. We'll look at conditional UI rendering along the way. ...
Dynamic behavior in Svelte: working with variables and props - Learn web development
omponent to pass in the list of todos to edit. This would allow us to save them to a web service or local storage and later retrieve them for update. So let's turn the array into a prop. In Todos.svelte, replace the existing let todos = ... block with export let todos = []. export let todos = [] This may feel a little weird at first. That's not how export normally works in JavaScript
modules! This is how Svelte 'extends' JavaScript by taking valid syntax and giving it a new purpose. In this case Svelte is using the export keyword to mark a variable declaration as a property or prop, which means it becomes accessible to consumers of the component. You can also specify a default initial value for a prop. This will be used if the component's consumer doesn't specify the prop on the ...
...console.log() and reactive statements. Binding HTML properties with the bind:property directive. Triggering reactivity with assignments. Using reactive expressions to filter data Explicitly defining our reactive dependencies In the next article we will add further functionality, which will allow users to edit todos. ...
Handling common HTML and CSS problems - Learn web development
an element: The first one has a -moz- prefix, and shows a slightly older version of the syntax (Firefox) The second one has a -webkit- prefix, and shows an even older, proprietary version of the syntax (this is actually from a really old version of the WebKit engine). The third one has no prefix, and shows the final version of the syntax (included in the CSS Image Values and Replaced Content
Module Level 3 spec, which defines this feature). Prefixed features were never supposed to be used in production websites -- they are subject to change or removal without warning, and cause cross browser issues. This is particularly a problem when developers decide to only use say, the -webkit- version of a property -- meaning that the site won't work in other browsers. This actually happens so much t...
...nswer to your problem. It is often useful to search for specific error messages if you have them -- other developers will be likely to have had the same problems as you. Summary Now you should be familiar with the main types of cross browser HTML and CSS problems that you'll meet in web development, and how to go about fixing them. ...
Cross browser testing - Learn web development
We look at identifying your target audience (e.g. what users, browsers, and devices do you most need to worry about?), how to go about doing testing, the main issues that you'll face with different types of code and how to mitigate them, what tools are most useful in helping you test and fix problems, and how to use automation to speed up testing. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites You should really learn the basics of the core HTML, CSS, and JavaScript languages first before attempting to use the tools detailed here. ...
... Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites You should really learn the basics of the core HTML, CSS, and JavaScript languages first before attempting to use the tools detailed here. ...
Git and GitHub - Learn web development
m (VCS), a tool to allow them to collaborate with other developers on a project without danger of them overwriting each other's work, and roll back to previous versions of the code base if a problem is discovered later on. The most popular VCS (at least among web developers) is Git, along with GitHub, a site that provides hosting for your repositories and several tools for working with them. This
module aims to teach you what you need to know about both of them. Overview VCSes are essential for software development: It is rare that you will work on a project completely on your own, and as soon as you start working with other people you start to run the risk of conflicting with each other's work -- this is when both of you try to update the same piece of code at the same time. You need to ha...
...t Kraken) or just stick to using a terminal window. In fact, it is probably useful for you to get to know at least the basics of git terminal commands, even if you intend to use a GUI. A GitHub account. If you haven't already got one, sign up now using the provided link. In terms of prerequisite knowledge, you don't need to know anything about web development, Git/GitHub or VCSes to start this
module. However, it is recommended that you know some coding so that you have reasonable computer literacy, and some code to store in your repositories! It is also preferrable that you have some basic terminal knowledge, so for example moving between directories, creating files, and modifying the system PATH. Note: Github is not the only site/toolset you can use with Git. There are other alternatives...
Command line crash course - Learn web development
cally. Help newcomers to web development format their code in best-practice fashion. Be installed on any operating system and even as a direct part of project tooling, ensuring that colleagues and friends who work on your code use the code style you're using. Be configured to run upon save, as you type, or even before publishing your code (with additional tooling that we'll see later on in the
module). Once you've installed node, open up the terminal and run the following command to install Prettier: npm install --global prettier Once the command has finished running, the Prettier tool is now available in your terminal, at any location in your file system. Running the command without any arguments, as with many other commands, will offer up usage and help information. Try this now: pret...
...his chapter, but available as a command line tool. Note that some of the above suggestions may need installing using npm, like we did with Prettier. ...
Learn web development
l are missing, drop us a message on our Discourse forum. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Where to start Complete beginner: If you are a complete beginner to web development, we'd recommend that you start by working through our Getting started with the web
module, which provides a practical introduction to web development. Beyond the basics: If you have a bit of knowledge already, the next step is to learn HTML and CSS in detail: start with our Introduction to HTML
module and move on to our CSS first steps
module. Moving onto scripting: If you are comfortable with HTML and CSS already, or you are mainly interested in coding, you'll want to move on to Ja...
... Frameworks and tooling: After mastering the essentials of vanilla HTML, CSS, and JavaScript, you should learn about client-side web development tools, and then consider digging into client-side JavaScript frameworks, and server-side website programming. ...
ChromeWorkers and the Chrome worker loader
To complement the open Web Worker functionality, Mozilla has introduced the ChromeWorker interface, which provides this capability within application chrome. That makes it available not only to the application itself, but also to add-ons. This documentation covers chrome Workers and the chrome worker
module loader. Note: If you're contributing content to this section, create subpages using the "New sub-page" option in the "This page" menu. ...
...elf, but also to add-ons. This documentation covers chrome Workers and the chrome worker
module loader. Note: If you're contributing content to this section, create subpages using the "New sub-page" option in the "This page" menu. Once you've saved your new page, come back to this one and force-refresh this page. That will regenerate the table of contents below for all readers. Chrome Worker
ModulesThe preferred way to define and load
modules for Chrome Workers is to use the Chrome Worker
Module Loader. This
module loader should not surprise developers familiar with CommonJS, as it implements a minimal CommonJS require(). ...
Accessibility/LiveRegionDevGuide
technology (AT) developers can use in developing live region support. This guide was written from an ATK/AT-SPI point of view as part of the Orca Live Region Support project. However, many of the concepts were also used during the development of FireVox, an AT using IAccessible2. Sometimes the very best guide for some developers is the code itself. Please refer to the liveregions and Gecko Python
modules in Orca for a real world example. For more information about Live Regions, please read the ARIA properties spec or the live region report to learn about ARIA Live Region markup and the Live Region API Support document for the latest Firefox API with regards to Live Regions. As always, we're open to questions and suggestions for changes in community forums. Priority Queue The heart of any liv...
...eal world example. For more information about Live Regions, please read the ARIA properties spec or the live region report to learn about ARIA Live Region markup and the Live Region API Support document for the latest Firefox API with regards to Live Regions. As always, we're open to questions and suggestions for changes in community forums. Priority Queue The heart of any live region support
module is the priority queue. It is responsible for queuing messages derived from live region events, where priority is determined by chronological order and the live politeness properties. In addition to the standard priority queue methods, additional methods will need to be implemented that purge the queue based on one of the priority criterion. The "purge by timestamp" method will be used to remove ...
The Firefox codebase: CSS Guidelines
Generally, when specifying -moz-appearance: foo; you're giving hints as to how something should act, however -moz-appearance: none; is probably saying 'ignore browser preconceptions - I want a blank sheet', so that's more visual. However -moz-appearance values ar...
...hat way the theme values get to override the content values (which is probably what you want), and you're going to want them both after the global values, so your imports will look like this: <?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?> <?xml-stylesheet href="chrome://browser/content/path/
module.css" type="text/css"?> <?xml-stylesheet href="chrome://browser/skin/path/
module.css" type="text/css"?> [1] -moz-appearance is tricky. Generally, when specifying -moz-appearance: foo; you're giving hints as to how something should act, however -moz-appearance: none; is probably saying 'ignore browser preconceptions - I want a blank sheet', so that's more visual. However -moz-appearance values aren't implemented and don't behave consistently across platforms, so idealism asi...
Limitations of chrome scripts
the content process. Sandboxes are often used as a safe way to manipulate web content, and if that's your goal, create the sandbox in the content process. There is a shim for sandboxes: if you make a sandbox in the chrome process and give it content principals (by passing a CPOW as the first argument to Components.utils.Sandbox) then we'll actually make it in the content process. nsIAbout
Module By default, custom about: pages registered using nsIAbout
Module are loaded in the chrome process. This means that you can't access their content from the content process (via XHR, for example). You can change this default in the code you use to register the about: URI. See about: and chrome: URIs. JavaScript code
modules (JSMs) In single-process Firefox, you can use JavaScript code
modules (...
... ...
Limitations of frame scripts
, that cannot be converted to an nsIDOMWindow, so the second getInterface call here will fail. If you want a chrome window: send a message from the content process using the message manager. The target property of the object passed into the message handler in the chrome process is the XUL <browser> receiving the message, and you can get the chrome window from that (I'm not sure how). nsIAbout
Module By default, custom about: pages registered using nsIAbout
Module are loaded in the chrome process. This means that you can't access their content from the content process (via XHR, for example). There is a shim for this that makes the content of about: pages registered by the add-on transparently available in the content process. To avoid the shim: If you need to access the content of your abou...
...are loaded in the chrome process. This means that you can't access their content from the content process (via XHR, for example). There is a shim for this that makes the content of about: pages registered by the add-on transparently available in the content process. To avoid the shim: If you need to access the content of your about page from the content process, you need to register the nsIAbout
Module in the content process as well as the chrome process. By default, about: pages (except for a small whitelist) are loaded in the chrome process when browsed to from the AwesomeBar. JavaScript code
modules (JSMs) In multiprocess Firefox, a JSM loaded into the content process does not share any state with the same JSM loaded into the chrome process. See the entry in the Limitations on chrome scrip...
Message manager overview
The JSM can then use the child process message manager to exchange messages with the parent process message manager. This can be useful for addons to register categories, observers and components in child processes. ...
...e implements nsIMessageListenerManager nsIMessageBroadcaster Child process message manager implements nsIMessageListenerManager nsIMessageSender Loading scripts per child process Since the process message managers do not support script loading the only way to implement per-child process code is to use a frame script which imports a custom javascript
module (JSM). Since javascript
modules are singletons they will only be executed once per process even when they are loaded in multiple frame scripts. The JSM can then use the child process message manager to exchange messages with the parent process message manager. This can be useful for addons to register categories, observers and components in child processes. ...
HTTP Cache
Two storage objects created with in any way different nsILoadContextInfo arguments are strictly and completely distinct and cache entries in them do not overlap even when having the same URIs. nsICacheStorage ...
... Two storage objects created with in any way different nsILoadContextInfo arguments are strictly and completely distinct and cache entries in them do not overlap even when having the same URIs. nsICacheStorage //github.com/RealityRi...
How to get a stacktrace with WinDbg
. This may take some time depending on your connection speed; the total size of the Mozilla and Microsoft symbols download is around 1.4GB. WinDbg will show "Busy" at the bottom of the application window until the download is complete. Once the download is complete, you need to configure WinDbg to examine child processes, ignore a specific event caused by Flash Player, and record a log of loaded
modules. You will also want to open a log file to save data you collect. To do this, enter these four commands, pressing enter after each one. .logopen /t c:\temp\firefox-debug.log .childdbg 1 .tlist sxn gp lm If you see firefox.exe listed in the output from .tlist more than once, then you are already running the application and need to close the running instance first before you start debugging, oth...
... hangs and there is no command prompt available in the debugger, open the Debug menu and choose Break. Once the browser has crashed or been stopped, continue with the steps below. After the crash or hang You need to capture the debug information to include in a bug comment or support request. Enter these three commands, one at a time, to get the stacktrace, crash/hang analysis and log of loaded
modules. (Again, press Enter after each command.) ~* kp !analyze -v -f lm After these steps are completed, find the file c:\temp\firefox-debug-(Today's Date).txt on your hard drive. To provide the information to the development community, submit this file with a support request or attach it to a related bug on Bugzilla. Producing a minidump Sometimes the stacktrace alone is not enough information fo...
AddonManager
th any kind (type) of add-on in a generic manner. To do so many methods of the AddonManager take the add-on types as parameters. The existing add-on types are defined in XPIProvider.jsm and are, at this time, the following: extension, theme, locale, multipackage, dictionary and experiment. ...
...eters. The existing add-on types are defined in XPIProvider.jsm and are, at this time, the following: extension, theme, locale, multipackage, dictionary and experiment. ...
Add-on Repository
e search is completed. Results passed to the SearchCallback object only include add-ons that are compatible with the current application and are not already installed or in the process of being installed. AddonRepository can only process one search at a time. A new search will immediately fail if the AddonRepository is already handling another search request. ...
...lback object only include add-ons that are compatible with the current application and are not already installed or in the process of being installed. AddonRepository can only process one search at a time. A new search will immediately fail if the AddonRepository is already handling another search request. ...
Assert.jsm
The Assert.jsm JavaScript code
module implements the CommonJS Unit Testing specification version 1.1, which provides a basic, standardized interface for performing in-code logical assertions with optional, customizable error reporting. To use it, you first need to import the code
module into your JavaScript scope: Components.utils.import("resource://testing-common/Assert.jsm"); The Assert class offers methods for performing common logical assertions. Method overview undefined ok(value, message); undefined equal(actual, expected, message); undefined notEqual(actual, expected, message); undefined deepEqual(actual, expected, message); undefined notDeepEqual(actual, expected, message); undefined strictEqual(actual, expected, message); ...
... function. report() All of the aforementioned functions must throw an AssertionError when a corresponding condition is not met, with a message that may be undefined if not provided. All assertion methods provide both the actual and expected values to the assertion error for display purposes. This report method only throws errors on assertion failures, as per spec, but consumers of this
module (think: xpcshell-test, mochitest) may want to override this default implementation. undefined report( failed, actual, expected, message, operator ); Parameters failed Indicates if the assertion failed or not actual The result of evaluating the assertion expected Expected result from the test author message Short explanation of the expected result operator Operation qualif...
AsyncShutdown.jsm
cking the completion of the phase. This must be the same condition as was passed to addBlocker prior. Return Value Returns true if a blocker has been removed, or false otherwise. Note that a result of false may mean either that the blocker has never been installed or that the phase has completed and the blocker has already been resolved. Examples AsyncShutdown.profileBeforeChange.addBlocker("
Module: just a promise", promise); // profileBeforeChange will not complete until // promise is resolved or rejected AsyncShutdown.profileBeforeChange.addBlocker("
Module: a callback", function condition() { // ... // Execute this code during profileBeforeChange return promise; // profileBeforeChange will not complete until promise // is resolved or ...
...l not complete until // promise is resolved or rejected AsyncShutdown.profileBeforeChange.addBlocker("
Module: a callback", function condition() { // ... // Execute this code during profileBeforeChange return promise; // profileBeforeChange will not complete until promise // is resolved or rejected }); AsyncShutdown.profileBeforeChange.addBlocker("
Module: trivial callback", function condition() { // ... // Execute this code during profileBeforeChange // No specific guarantee about completion of profileBeforeChange }); If the promise returned by condition is not resolved/rejected within one minute, the process will crash to avoid blocking system shutdown, preventing the user from restarting Firefox or burning through batte...
NetUtil.jsm
The NetUtil.jsm JavaScript code
module provides easy-to-use APIs for performing common network related tasks. To use these utilities, you first need to import the code
module into your JavaScript scope: Components.utils.import("resource://gre/
modules/NetUtil.jsm"); Once you've imported the
module, you can then use its methods. Method overview nsIAsyncStreamCopier asyncCopy(nsIInputStream aSource, nsIOutputStream aSink, [optional] aCallback) void asyncFetch(aSource, aCallback) nsIChannel newChannel(aWhatToLoad, [optional] aOriginCharset, [optional] nsIURI aBaseURI) nsIURI newURI(aTarget, [optional] aOriginCharset, [optional] nsIURI aBaseURI) String readInputStreamToString(aInputStream, aCount, aOptions) Attributes Attribu...
...llback receives a single parameter: the nsresult status code for the copy operation. Return value Returns the nsIAsyncStreamCopier object that is handling the copy. Exceptions thrown This method throws an exception with the message "Must have a source and a sink" if either aSource or aSink is null. Example This example writes a string to a file; it comes from the test suite for the NetUtil
module. var file = Cc["@mozilla.org/file/directory_service;1"]. getService(Ci.nsIProperties). get("TmpD", Ci.nsIFile); file.append("test-file.tmp"); file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666); // Then, we need an output stream to our output file. var ostream = Cc["@mozilla.org/network/file-output-stream;1"]. createInstance(Ci.nsIFileOutputStream); ostream.
PopupNotifications.jsm
The PopupNotifications.jsm JavaScript code
module provides a popup notification box service. This service is used, for example, to display Geolocation related notifications. To use this, you first need to import the code
module into your JavaScript scope: Components.utils.import("resource://gre/
modules/PopupNotifications.jsm"); Once you've imported the
module, you can then use the PopupNotifications object it exports; this object provides methods for creating and displaying popup notification panels. Note: This code
module is imported by Firefox chrome windows, so you don't have to do it yourself in most extensions. Method overview void locationChange(); Notification getNotification(id, browser); void remove(notification); Notification show(browser, ...
...oid remove(notification); Notification show(browser, id, message, anchorID, mainAction, secondaryActions, options); Properties Attribute Type Description isPanelOpen Boolean Returns true if the notification panel is currently visible, false if it is not. Methods locationChange() The consumer can call this method to let the popup notification
module know that the current browser's location has changed. This lets the notification service update the active notifications as appropriate. Note: You shouldn't need to call this when using the PopupNotifications object in Firefox windows; Firefox code takes care of this automatically. void locationChange(); Parameters None. getNotification() Retrieve a Notification object associated with the ...
PromiseUtils.jsm
This method was previously implemented as Promise.defer(), which is obsolete since Gecko 30. And PromiseUtils.defer uses DOM Promise instead of Promise.jsm's Promise. Deferred defer(); Parameters None. ...
... This method was previously implemented as Promise.defer(), which is obsolete since Gecko 30. And PromiseUtils.defer uses DOM Promise instead of Promise.jsm's Promise. Deferred defer(); Parameters None. ...
Timer.jsm
The Timer.jsm JavaScript code
module contains pure-JavaScript implementations of setTimeout, clearTimeout, setInterval, and clearInterval that are compatible with the DOM window functions, but that can be used by code that does not have access to a DOM window (for example, JavaScript code
modules or content frame scripts). ...
...e Timer.jsm JavaScript code
module contains pure-JavaScript implementations of setTimeout, clearTimeout, setInterval, and clearInterval that are compatible with the DOM window functions, but that can be used by code that does not have access to a DOM window (for example, JavaScript code
modules or content frame scripts). ...
WebChannel.jsm
WebChannel(String webChannelId, string originOrPermission); 2nd argument is a permission for which the permission manager will be checked to determine if the request is allowed. ...
... WebChannel(String webChannelId, string originOrPermission); 2nd argument is a permission for which the permission manager will be checked to determine if the request is allowed. ...
Webapps.jsm
The Webapps.jsm
modules exposes the DOMApplicationRegistry, which is responsible for managing all of the Open Web Apps. ...
... The Webapps.jsm
modules exposes the DOMApplicationRegistry, which is responsible for managing all of the Open Web Apps. ...
source-editor.jsm
This component has been removed from the platform in Firefox 28. The source-editor.jsm JavaScript code
module implements an editor specifically tailored for editing source code; its primary purpose is to provide support for web developer tools to display and edit web site code. The editor provided is Eclipse Orion. To use it, you first need to import the code
module into your JavaScript scope: Components.utils.import("resource:///
modules/source-editor.jsm"); Warning: Much of the functionality of the source editor is implemented by a secondary code
module (by default, source-editor-orion.jsm). You must not directly import that code
module; it is essentially an implementation detail. Its functionality is all exposed through source-editor.jsm. Method overview Initialization and des...
...aking changes. Set it to false to allow editing. Constants Preference name constants These constants define the names of preferences used by the source editor. Constant Value Description SourceEditor.PREFS.COMPONENT "devtools.editor.component" A string indicating the name of the source editor engine to use; this is "orion" by default. The source editor code
module loads a
module by the name "source-editor-<component>.jsm" and exposes its API as part of the SourceEditor object. SourceEditor.PREFS.EXPAND_TAB "devtools.editor.expandtab" A Boolean value that indicates whether or not to automatically expand tabs out to a series of spaces. SourceEditor.PREFS.TAB_SIZE "devtools.editor.tabsize" An integer value that specifies the numb...
Profiling with Xperf
in use. However, even despite this, it's a useful way to track allocations/deallocations. Capturing Heap Data The "-heap" option is used to set up heap tracing. Firefox generates lots of events, so you may want to play with the BufferSize/MinBuffers/MaxBuffers options as well to ensure that you don't get dropped events. Also, when recording the stack, I've found that a heap trace is often missing
module information (I believe this is a bug in xperf). It's possible to get around that by doing a simultaneous capture of non-heap data. To start a trace session, launching a new Firefox instance: xperf -on base xperf -start heapsession -heap -PidNewProcess "./firefox.exe -P test -no-remote" -stackwalk HeapAlloc+HeapRealloc -BufferSize 512 -MinBuffers 128 -MaxBuffers 512 To stop a session and merge th...
...side", "Allocated Outside, Freed Inside". These refer to the time range that was selected for the summary graph; for example, something that's in the AOFI category was allocated before the start of the selected time range, but the free event happened inside. Tips In the summary views, the yellow bar can be dragged left and right to change the grouping -- for example, drag it to the left of the
Module column to have grouping happen only by process (stuff that's to the left), so that you get symbols in order of weight, regardless of what
module they're in. Dragging the columns around will change grouping in various ways; experiment to get the data that you're looking for. Also experiment with turning columns on and off; removing a column will allow data to be aggregated without considering tha...
NSPR Contributor Guide
We reject contributions for a variety of reasons. Some of these reasons are not obvious to an outside observer. NSPR wishes to document some guidelines for those who would contribute to NSPR. These guidelines should help the contributor in crafting his contribution, increasing its likelihood for acceptance. ...
...PIs you are adding. See: [#TestCases Test Cases] New Libraries All the guidelines applicable to [#NewFeatures New Features] applies to new libraries. For purposes of this paper, a "new library" is defined as a libary under the mozilla/nsprpub/lib directory tree and built as a separate library. These libraries exist, for the most part, as "legacy" code from NSPR 1.0. [Note that the current NSPR
module owners do not now nor never have been involved with NSPR 1.0.]. Such is life. That said: There are some libraries that implement functions intended for use with applications using NSPR, such as ...nsprpub/lib/libc/plgetopt.*. generally useful platform abstractions you agree to sustain, bug fix May rely on the NSPR API May NOT rely on any other library API New Platform Ports all NSPR API...
PR_LOG
_args); Parameters The macro has these parameters: _
module A pointer to a log
module structure. _level A level value. Possible values are: PR_LOG_NONE = 0 PR_LOG_ALWAYS = 1 PR_LOG_ERROR = 2 PR_LOG_WARNING = 3 PR_LOG_DEBUG = 4 PR_LOG_NOTICE = PR_LOG_DEBUG PR_LOG_WARN = PR_LOG_WARNING PR_LOG_MIN = PR_LOG_DEBUG PR_LOG_MAX = PR_LOG_DEBUG _args A variable length argument list, as if to printf. ...
... = 3 PR_LOG_DEBUG = 4 PR_LOG_NOTICE = PR_LOG_DEBUG PR_LOG_WARN = PR_LOG_WARNING PR_LOG_MIN = PR_LOG_DEBUG PR_LOG_MAX = PR_LOG_DEBUG _args A variable length argument list, as if to printf. Returns Nothing Description This macro formats the specified arguments and writes the output to the log file, if logging is enabled for the specified
module and level. For a description of formatting and format strings, see "Formatted Printing". For an example of using conditional logging, see Use Example. This macro compiles to nothing if compile-time options are not specified to enable logging. ...
PR_LOG_TEST
Determines if logging is enabled for a
module and level. Syntax #include <prlog.h> PRBool PR_LOG_TEST ( PRLog
ModuleInfo *_
module, PRLog
ModuleLevel _level); Parameters The macro has these parameters: _
module A pointer to a log
module structure. _level A level value. Possible values are: PR_LOG_NONE = 0 PR_LOG_ALWAYS = 1 PR_LOG_ERROR = 2 PR_LOG_WARNING = 3 PR_LOG_DEBUG = 4 PR_LOG_NOTICE = PR_LOG_DEBUG PR_LOG_WARN = PR_LOG_WARNING PR_LOG_MIN = PR_LOG_DEBUG PR_LOG_MAX = PR_LOG_DEBUG Returns PR_TRUE when logging is enabled for the given
module and level, otherwise PR_FALSE. ...
...Use it as an expression in a conditional execution statement to control logging. See also PR_LOG. ...
Process Initialization
Implicit initialization should suffice unless a program has specific sequencing requirements or needs to characterize the primordial thread. Explicit initialization is rarely necessary. ...
...s to characterize the primordial thread. Explicit initialization is rarely necessary. Implicit initialization assumes that the initiator is the primordial thread and that the thread is a user thread of normal priority. PR_Init PR_Initialize PR_Initialized PR_Cleanup PR_DisableClockInterrupts PR_BlockClockInterrupts PR_UnblockClockInterrupts PR_SetConcurrency PR_ProcessExit PR_Abort
Module Initialization Initialization can be tricky in a threaded environment, especially initialization that must happen exactly once. PR_CallOnce ensures that such initialization code is called only once. This facility is recommended in situations where complicated global initialization is required. PRCallOnceType PRCallOnceFN PR_CallOnce ...
NSPR API Reference
reads Threading Types and Constants Threading Functions Creating, Joining, and Identifying Threads Controlling Thread Priorities Controlling Per-Thread Private Data Interrupting and Yielding Setting Global Thread Concurrency Getting a Thread's Scope Process Initialization Identity and Versioning Name and Version Constants Initialization and Cleanup
Module Initialization Locks Lock Type Lock Functions Condition Variables Condition Variable Type Condition Variable Functions Monitors Monitor Type Monitor Functions Cached Monitors Cached Monitor Functions I/O Types Directory Type File Descriptor Types File Info Types Network Address Types Types Used with Socket Options Functions Type Used with Memory-Mapped I/O Offset...
... Process Management and Interprocess Communication Process Management Types and Constants PRProcess PRProcessAttr Process Management Functions Setting the Attributes of a New Process Creating and Managing Processes Multiwait Receive System Information and Environment Variables Logging Conditional Compilation and Execution Log Types and Variables PRLog
ModuleInfo PRLog
ModuleLevel NSPR_LOG_
MODULES NSPR_LOG_FILE Logging Functions and Macros PR_NewLog
Module PR_SetLogFile PR_SetLogBuffering PR_LogPrint PR_LogFlush PR_LOG_TEST PR_LOG PR_Assert PR_ASSERT PR_NOT_REACHED Use Example Instrumentation Counters Named Shared Memory Shared Memory Protocol Named Shared Memory Functions Anonymous Shared M...
Encrypt Decrypt MAC Keys As Session Objects
t */ if (PR_Access(encryptedFileName, PR_ACCESS_EXISTS) == PR_SUCCESS) { PR_Delete(encryptedFileName); } /* Open DB for read/write and authenticate to it. ...
...File(slot, dbdir, inFileName, headerFileName, encryptedFileName, noiseFileName, &pwdata, ascii); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "EncryptFile : Failed\n"); return SECFailure; } break; case DECRYPT: /* Open DB read only, authenticate to it */ PK11_SetPasswordFunc(Get
ModulePassword); rv = NSS_Init(dbdir); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "NSS_Init Failed\n"); return SECFailure; } slot = PK11_GetInternalKeySlot(); if (PK11_NeedLogin(slot)) { rv = PK11_Authenticate(slot, PR_TRUE, &pwdata); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Could not authe...
Encrypt and decrypt MAC using token
t */ if (PR_Access(encryptedFileName, PR_ACCESS_EXISTS) == PR_SUCCESS) { PR_Delete(encryptedFileName); } /* Open DB for read/write and authenticate to it. ...
...File(slot, dbdir, inFileName, headerFileName, encryptedFileName, noiseFileName, &pwdata, ascii); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "EncryptFile : Failed\n"); return SECFailure; } break; case DECRYPT: /* Open DB read only, authenticate to it */ PK11_SetPasswordFunc(Get
ModulePassword); rv = NSS_Init(dbdir); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "NSS_Init Failed\n"); return SECFailure; } slot = PK11_GetInternalKeySlot(); if (PK11_NeedLogin(slot)) { rv = PK11_Authenticate(slot, PR_TRUE, &pwdata); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Could not authe...
JSS FAQ
When will JSS have JSSE support? What versions of JDK and JRE do you suggest? JSS 3.x works with JDK versions 1.2 or higher, except version 1.3.0. Most attention for future development and bug fixing will go to JDK 1.4 and later, so use that if you can. If you are using JDK 1.3.x, you will ...
...Before JSS 3.2 you would use CryptoManager to obtain the CryptoToken you want to use, then call CryptoToken.getCipherContext() to get an encryption engine. But as of JSS 3.2 you would use the JSS JCA provider. Can you explain token names and keys with regards to JSS? The token name is different depending on which application you are running. In JSS, the token is called "In...
Using JSS
Optional. If you built JSS from source, you have these libraries ...
...Optional. If you built JSS from source, you have these libraries in the mozilla/dist/<platform>/lib directory of your build tree. If you are downloading binaries, get them from the binary release locations in the above table. ...
NSS 3.19.2 release notes
ozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_19_2_RTM/src/ New in NSS 3.19.2 New Functionality No new functionality is introduced in this release. Notable Changes in NSS 3.19.2 Bug 1172128 - In NSS 3.19.1, the minimum key sizes that the freebl cryptographic implementation (part of the softoken cryptographic
module used by default by NSS) was willing to generate or use was increased - for RSA keys, to 512 bits, and for DH keys, 1023 bits. This was done as part of a security fix for Bug 1138554 / CVE-2015-4000. Applications that requested or attempted to use keys smaller then the minimum size would fail. However, this change in behaviour unintentionally broke existing NSS applications that need to generate o...
...ations that need to generate or use such keys, via APIs such as SECKEY_CreateRSAPrivateKey or SECKEY_CreateDHPrivateKey. In NSS 3.19.2, this change in freebl behaviour has been reverted. The fix for Bug 1138554 has been moved to libssl, and will now only affect the minimum keystrengths used in SSL/TLS. Note: Future versions of NSS may increase the minimum keysizes required by the freebl
module. Consumers of NSS are strongly encouraged to migrate to stronger cryptographic strengths as soon as possible. Bugs fixed in NSS 3.19.2 This Bugzilla query returns all the bugs fixed in NSS 3.19.2: https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&classification=Components&query_format=advanced&product=NSS&target_milestone=3.19.2 Compatibility NSS 3.19.2 shared libraries are backward...
Encrypt Decrypt_MAC_Using Token
. */ if (PR_Access(encryptedFileName, PR_ACCESS_EXISTS) == PR_SUCCESS) { PR_Delete(encryptedFileName); } /* Open DB for read/write and authenticate to it. ...
...ile(slot, dbdir, inFileName, headerFileName, encryptedFileName, noiseFileName, &pwdata, ascii); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "EncryptFile : Failed\n"); return SECFailure; } break; case DECRYPT: /* Open DB read only, authenticate to it. ...
NSS Sample Code Sample_3_Basic Encryption and MACing
t */ if (PR_Access(encryptedFileName, PR_ACCESS_EXISTS) == PR_SUCCESS) { PR_Delete(encryptedFileName); } /* Open DB for read/write and authenticate to it. ...
...File(slot, dbdir, inFileName, headerFileName, encryptedFileName, noiseFileName, &pwdata, ascii); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "EncryptFile : Failed\n"); return SECFailure; } break; case DECRYPT: /* Open DB read only, authenticate to it */ PK11_SetPasswordFunc(Get
ModulePassword); rv = NSS_Init(dbdir); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "NSS_Init Failed\n"); return SECFailure; } slot = PK11_GetInternalKeySlot(); if (PK11_NeedLogin(slot)) { rv = PK11_Authenticate(slot, PR_TRUE, &pwdata); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Could not authe...
NSS Sample Code Utilities_1
NSS Sample Code Common: Utilities This is a library of utilities used by many of the samples. This code shows the following: Extract seed from noise file Read DER encoding from a file Extract the password from a text file Get the
module password Print as ascii or hexadecimal Sample Code #include <prlog.h> #include <termios.h> #include <base64.h> #include <unistd.h> #include <sys/stat.h> #include <prprf.h> #include "util.h" /* * These utility functions are adapted from those found in * the sectool library used by the NSS security tools and * other NSS test applications. */ /* * Newline */ static void Newline(PRFileDesc* out) { PR_fprintf(out, "\n"); } /* * PrintAsAscii */ void PrintAsAscii(PRFileDesc* out, const unsigned char *data, unsigned int len) { char...
...me); } } i = 0; do { int startphrase = i; int phraseLen; /* handle the Windows EOL case */ while (phrases[i] != '\r' && phrases[i] != '\n' && i < nb) i++; /* terminate passphrase */ phrases[i++] = '\0'; /* clean up any EOL before the start of the next passphrase */ while ( (i<nb) analyze="" char="" current="" get
modulepassword="" if="" int="" now="" passphrase="" phrase="&phrases[startphrase];" phraselen="" pk11slotinfo="" pwdata="=" pwdata-="" retry="" return="" secupwdata="" the="" void="" while="">source != PW_NONE) { PR_fprintf(PR_STDERR, "Incorrect password/PIN entered.\n"); return NULL; } switch (pwdata->source) { case PW_NONE: sprintf(prompt, "Enter Password or Pi...
EncDecMAC using token object - sample 3
CESS) { PR_Delete(headerFileName); } /* If the intermediate encrypted already exists, delete it */ if (PR_Access(encryptedFileName, PR_ACCESS_EXISTS) == PR_SUCCESS) { PR_Delete(encryptedFileName); } /* Open DB for read/write and authenticate to it. ...
... PR_fprintf(PR_STDERR, "Could not authenticate to token %s.\n", PK11_GetTokenName(slot)); goto cleanup; } } rv = EncryptFile(slot, dbdir, inFileName, headerFileName, encryptedFileName, noiseFileName, &pwdata, ascii); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "EncryptFile : Failed\n"); return SECFailure; } break; case DECRYPT: /* Open DB read only, authenticate to it */ PK11_SetPasswordFunc(Get
ModulePassword); rv = NSS_Init(dbdir); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "NSS_Init Failed\n"); return SECFailure; } slot = PK11_GetInternalKeySlot(); if (PK11_NeedLogin(slot)) { rv = PK11_Authenticate(slot, PR_TRUE, &pwdata); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Could not authenticate to token %s.\n", PK11_GetTokenName(slot)); goto cleanup; } } rv = DecryptFile(slot, dbdir, outFile...
NSS reference
number generation This API consists of the two routines used for pseudorandom number generation -- PK11_GenerateRandomOnSlot and PK11_GenerateRandom -- and the two routines used for seeding pseudorandom number generation -- PK11_SeedRandom and PK11_RandomUpdate. PKCS #11 functions Based on PKCS #11 Functions in the SSL Reference and "Crypto Functions" in NSS Public Functions. SECMOD_LoadUser
Module SECMOD_UnloadUser
Module SECMOD_CloseUserDB SECMOD_OpenUserDB PK11_FindCertFromNickname PK11_FindKeyByAnyCert PK11_GetSlotName PK11_GetTokenName PK11_IsHW PK11_IsPresent PK11_IsReadOnly PK11_SetPasswordFunc SSL Functions Based on "SSL Functions" in the SSL Reference and "SSL Functions" and "Deprecated SSL Functions" in NSS Public Functions. SSL_ConfigServerSessionIDCache SSL_Clea...
... Based on NSS Tools Man Pages : work in progress ...
sslcrt.html
The PIN argument value to pass to PK11 functions. See description below for more information. Returns The function returns one of these values: If successful, SECSuccess. If unsuccessful, SECFailure. Use PR_GetError to obtain the error code. Description The CERT_VerifyCertNow function must call one or more PK11 functions to obtain the services of a PKCS #11
module. Some of the PK11 functions require a PIN argument (see SSL_SetPKCS11PinArg for details), which must be specified in the wincx parameter. To obtain the value to pass in the wincx parameter, call SSL_RevealPinArg. CERT_VerifyCertName Compares the common name specified in the subject DN for a certificate with a specified hostname. Syntax #include <cert.h> SECStatus CERT_VerifyCertName( ...
...CKNAMES_CA wincx The PIN argument value to pass to PK11 functions. See description below for more information. Returns The function returns a CERTCertNicknames object containing the requested nicknames. Description CERT_GetCertNicknames must call one or more PK11 functions to obtain the services of a PKCS #11
module. Some of the PK11 functions require a PIN argument (see SSL_SetPKCS11PinArg for details), which must be specified in the wincx parameter. To obtain the value to pass in the wincx parameter, call SSL_RevealPinArg. CERT_FreeNicknames Frees a CERTCertNicknames structure. This structure is returned by CERT_GetCertNicknames. Syntax #include <cert.h> void CERT_FreeNicknames(CERTCertNicknames *n...
NSS Tools certutil
e format was upgraded to support SQLite as described in this document. It means that cert9.db and key4.db files may be targeted instead. The key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database. This document discusses certificate and key database management. For information security
module database management, see Using the Security
Module Database Tool. Availability See the release notes for the platforms this tool is available on. Syntax To run the Certificate Database Tool, type the command certutil option [arguments ] where options and arguments are combinations of the options and arguments listed in the following section. Each command takes one option. Each option may ta...
...the validity of a certificate and its attributes. -M Modify a certificate's trust attributes using the values of the -t argument. -H Display a list of the options and arguments used by the Certificate Database Tool. -W Change the password to a key database. -U List all available
modules or print a single named
module. Arguments -a Use ASCII format or allow the use of ASCII format for input or output. This formatting follows RFC 1113. For certificate requests, ASCII output defaults to standard output unless redirected. -b validity-time Specify a time at which a certificate is required to be valid. ...
NSS Tools pk12util
Error Codes pk12util can return the following values:...
...ES-cbc" "PKCS12 V2 PBE With SHA1 And 128 Bit RC2 CBC" "PKCS12 V2 PBE With SHA1 And 40 Bit RC2 CBC" PKCS #5 PBE Ciphers: "PKCS #5 Password Based Encryption with MD2 and DES CBC" "PKCS #5 Password Based Encryption with MD5 and DES CBC" "PKCS #5 Password Based Encryption with SHA1 and DES CBC" It should be noted that the the crypto provider may be the softtoken
module or an external hardware
module. It may be the case that the cryptographic
module does not support the requested algorithm and a best fit will be selected, likely to be the default. If no suitable replacement for the desired algorithm can be found a "no security
module can perform the requested operation" will appear on the error message. Error Codes pk12util can return the following values: 0 - No error 1 - User Cancelle...
NSS tools : signver
file. Using the -o option prints the signature file information to the given output file rather than stdout. signver -A -s signature_file -o output_file NSS Database Types NSS originally used BerkeleyDB databases to store security information. The last versions of these legacy databases are: o cert8.db for certificates o key3.db for keys o secmod.db for PKCS #11
module information BerkeleyDB has performance limitations, though, which prevent it from being easily used by multiple applications simultaneously. NSS has some flexibility that allows applications to use their own, independent database engine while keeping a shared database and working around the access issues. Still, NSS requires more flexibility to provide a truly shared security d...
...und the access issues. Still, NSS requires more flexibility to provide a truly shared security database. In 2009, NSS introduced a new set of databases that are SQLite databases rather than BerkleyDB. These new databases provide more accessibility and performance: o cert9.db for certificates o key4.db for keys o pkcs11.txt, which is listing of all of the PKCS #11
modules contained in a new subdirectory in the security databases directory Because the SQLite databases are designed to be shared, these are the shared database type. The shared database type is preferred; the legacy format is included for backward compatibility. By default, the tools (certutil, pk12util, modutil) assume that the given security databases follow the more common l...
FOSS
Rust mozjs - Rust bindings used by Servo GNOME gjs - JavaScript bindings to GNOME (broadly, to any library using the GObject introspection mechanism) Objective Caml http://alain.frisch.fr/soft.html#spider - bindings to embed SpiderMonkey in OCaml applications Perl http://jspl.msg.mx/ - bindings to cross-embed SpiderMonkey and Perl. Includes a JS shell that allows you to use CPAN
modules from JavaScript. Python http://pypi.python.org/pypi/python-spidermonkey wxWidgets GLUEscript (formerly wxJavaScript) Code generators jsapigen - generates bindings for embedding SpiderMonkey in C applications Extensions http://code.google.com/p/jslibs/ - zlib, SQLite, NSPR, ode, libpng, libjpeg, libffi, (...) libraries for SpiderMonkey http://www.jsdb.org/ - a JS Shel...
...igen - generates bindings for embedding SpiderMonkey in C applications Extensions http://code.google.com/p/jslibs/ - zlib, SQLite, NSPR, ode, libpng, libjpeg, libffi, (...) libraries for SpiderMonkey http://www.jsdb.org/ - a JS Shell with native objects for files, networks, databases, compression, email, etc. http://code.google.com/p/gpsee/ - commonJS platform, native-language
module interoperability methods,
modules, etc. for SpiderMonkey. Designed to supplement existing embeddings, GPSEE ships with a sample trivial embedding, a scripting host, and an augmented version of Mozilla's JS Shell. Bundled
modules include support for ByteArray, ByteString, CGI, POSIX Signals, FFI, and more. http://javalikescript.free.fr/ - a general-purpose JavaScript platform that aims to pr...
Bytecode Descriptions
lobal. This must be used only in scopes where this refers to the global this. NewTarget Stack: => new.target Push the value of new.target. The result is a constructor or undefined. This must be used only in scripts where new.target is allowed: non-arrow function scripts and other scripts that have a non-arrow function script on the scope chain. Implements: GetNewTarget. DynamicImport Stack:
moduleId => promise Dynamic import of the
module specified by the string value on the top of the stack. Implements: Import Calls. ImportMeta Stack: => import.meta Push the import.meta object. This must be used only in
module code. Objects Creating objects NewInit Stack: => obj Create and push a new object with no properties. Format: JOF_IC NewObject, NewObjectWithGroup Operands: (uint32_t bas...
...ctions has operands hops and slot that encode an EnvironmentCoordinate, directions to the binding from the current environment object. Aliased instructions can't be used when there's a dynamic scope (due to non-strict eval or with) that might shadow the aliased binding. Format: JOF_ENVCOORD, JOF_NAME, JOF_TYPESET, JOF_IC GetImport Operands: (uint32_t nameIndex) Stack: => val Get the value of a
module import by name and pushes it onto the stack. Format: JOF_ATOM, JOF_NAME, JOF_TYPESET, JOF_IC GetBoundName Operands: (uint32_t nameIndex) Stack: env => v Get the value of a binding from the environment env. If the name is not bound in env, throw a ReferenceError. env must be an environment currently on the environment chain, pushed by JSOp::BindName or JSOp::BindVar. Note: JSOp::BindName and JS...
Parser API
piderMonkey format. Example: > var expr = Reflect.parse("obj.foo + 42").body[0].expression > expr.left.property ({loc:null, type:"Identifier", name:"foo"}) > expr.right ({loc:{source:null, start:{line:1, column:10}, end:{line:1, column:12}}, type:"Literal", value:42}) It is also available since Firefox 7; it can be imported into the global object via: Components.utils.import("resource://gre/
modules/reflect.jsm") or into a specified object via: Components.utils.import("resource://gre/
modules/reflect.jsm", obj) Built-in objects Whether in SpiderMonkey shell or Firefox (after importing), the global singleton object Reflect currently contains just the parse method. Properties of the Reflect object The Reflect object currently consists of a single method. Reflect.parse(src[, options]) ...
... 1 The initial line number to use for source location information. builder Builder Default: null A builder object, which can be used to produce AST nodes in custom data formats. The expected callback methods are described under Builder Objects. target String Default: script A type of the parsing target, can be either script or
module. If parsing fails due to a syntax error, an instance of SyntaxError is thrown. The syntax error object thrown by Reflect.parse() has the same message property as the syntax error that would be thrown by eval(src). The lineNumber and fileName properties of the syntax error object indicate the source location of the syntax error. Node objects By default, Reflect.parse() produces Node o...
Gecko object attributes
ive A hint as to whether changes within the current region or subtree should be automatically presented. Possible values are "off" which is the same as not being set -- this means the region is not live. Other possible values are "polite", "assertive", and "rude", which is a suggestion for the policy when interrupting the user for changes to this region. Please see the ARIA States and Properties
module for more information. Additional information may be provide by the object attributes atomic and relevant. Applied to: any role Exposed in ARIA: aria-live relevant Space delimited string with keywords describing what kinds of changes in the subtree are informational, as opposed to presentational. If not specified, the default should be considered "additions text", which indicates that newly cr...
...limited string with keywords describing what kinds of changes in the subtree are informational, as opposed to presentational. If not specified, the default should be considered "additions text", which indicates that newly created objects and changes to text and text equivalents should be considered relevant, and that the hiding or removal of items is not. Please see the ARIA States and Properties
module for more information. Exposed in ARIA: aria-relevant container-atomic Is this change inside a region that should always be presented at once. If yes, member-of relation will point to the root of the region. See the Live Region Support for more information. container-busy The current changes are not yet complete. A state change event for the A11y API's BUSY state will be fired on the containe...
XForms Accessibility
XForms elements behavior is implemented in accordance with accessible toolkit checklist. ...
...s Redefines datatype ARIA attribute. Its value is XML Schema builit-in datatype of instance node that XForms element is bound to. children Mozilla XForms implementation allows form control elements to have child elements. Therefore accessible children are formed from any accessible child elements of form control element and from elements that are introduced by its presentation. Forms Controls
Module Some of form control elements may be represented in few ways by different widgets. This section lists accessible presentations for form control elements. input A key xforms element to show and change the instance data to which it is bound (see the spec, the docs). The follwoing representations input element are accessible: text field - see the docs. checkbox - see the docs datepicker - se...
Creating a Python XPCOM component
need. If you wish to use PyXPCOM from a normal Python executable, you will need to tell Python where it can find the PyXPCOM library. This is probably best done by setting a PYTHONPATH variable pointing at the 'bin/python' directory in the application. This is not necessary when your components are loaded by Mozilla as the Python loader modifies sys.path. Then you can import xpcom in any Python
module (mostly, in your component). Defining the interface Make a file named "nsIPySimple.idl" to define the interface: #include "nsISupports.idl" [scriptable, uuid(2b324e9d-a322-44a7-bd6e-0d8c83d94883)] interface nsIPySimple : nsISupports { attribute string yourName; void write( ); void change(in string aValue); }; This is the same as the nsISimple interface used here. Theoretically, becau...
...ts weren't enabled. To register the component, touch the .autoreg (a hidden file) in the bin directory, or delete xpti.dat. Then, the next time Mozilla starts, it will rebuild the index of components, including any new one in the 'components' directory. It is helpful to then start Mozilla from the command line to see if new components register successfully. Generating implementation templates The
module xpcom.xpt is used internally to process type information, but it has a nice feature - it can spit out a template for a Python implementation of any interface. Just execute this file as a script with the interface name as a param. For example: % cd c:\mozilla\bin\python\xpcom % python xpt.py nsISample class nsISample: _com_interfaces_ = xpcom.components.interfaces.nsISample # If this objec...
XPCOM glue
OM 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. Compiling or linking against XPCOM headers There are three ways to compile/link against XPCOM headers/libraries: Frozen linkage: dependent glue (dependent on xpcom.dll) XPCOM
modules, i.e. extension or XULRunner application components, should use the dependent glue. Code which wishes to use only frozen symbols but can tolerate a load-time dependency on xpcom.dll should link against xpcomglue_s.lib and xpcom.lib. It should not link against xpcom_core.lib. This is the case for XPCOM components, because they are loaded into Mozilla which already has full XPCOM loaded and initi...
...you must define MOZILLA_STRICT_API when using any form of the glue. Linux and Mac: Make sure the Gecko libraries are listed after your object (.o) files on the link line. Linux and Mac: Write the linker options exactly as stated (just replacing the /path/to/sdk/), otherwise you get an undefined symbol: ...NS_TableDrivenQI...QITableEntry... at runtime (not compile time) (in debug builds) or your
module just won't load (in optimized builds). In principle, #include "mozilla-config.h" should also work, if it's the first #include in .cpp, but preprocessor option is how it's usually included. For XULRunner 2.0, you also need to link against mozalloc. This is not a backwards-compatible change with 1.9.x and earlier. On Linux and Mac, add "-lmozalloc" exactly after "-lnspr4" in your linker invoca...
Preface
y, the book is arranged so that you can follow along and create your own components or learn about different XPCOM topics individually, as in a reference work. For example, the introduction includes a discussion of components and what they are, and the first chapter - in which you compile the basic code and register it with Mozilla - prompts a discussion of the relationship between components and
modules, of XPCOM interfaces, and of the registration process in general. The top of each chapter provides a list of the major topics covered. Sidebar sections are included to highlight technical details. By the end of the book, if we've done our job, you will have learned how to build a component and you will know something about the framework for these components in Gecko, which is XPCOM. Who Should...
...criptability is supported, see Scripting plugins. Organization of the Tutorial The following list provides an overview of the steps that we will take to build an XPCOM component called WebLock, which provides site blocking functionality to Gecko-based browsers. Each one of these steps has its own chapter, in which a number of topics associated with the step are discussed. Create the generic
module code for the component. Use C++ macros, special string classes and smart pointers to optimize your code. Define the functionality for the component; create an XPIDL interface for that functionality; create the implementation code specific to the custom WebLock component interface. Finish implementing the WebLock component: nsIContentPolicy, file I/O, locking, etc. Creating the user interface ...
Creating XPCOM components
y, the book is arranged so that you can follow along and create your own components or learn about different XPCOM topics individually, as in a reference work. For example, the introduction includes a discussion of components and what they are, and the first chapter - in which you compile the basic code and register it with Mozilla - prompts a discussion of the relationship between components and
modules, of XPCOM interfaces, and of the registration process in general. Note: In general, you should try to avoid having to create XPCOM components. Add-ons should try to use the new Add-on SDK as much as possible; however, there may be cases when it's unavoidable. Note:This article describes a method that uses xpidl but you should use webidl instead. Preface Who Should Read This Book Organ...
...Cpp XPCOM Initialization XPCOM Registry Manifests Registration Methods in XPCOM Autoregistration The Shutdown Process Three Parts of a XPCOM Component Library XPCOM Glue The Glue Library XPCOM String Classes Creating the Component Code What We'll Be Working On Component Registration The regxpcom Program Registration Alternatives Overview of the WebLock
Module Source Digging In: Required Includes and Constants Identifiers in XPCOM Coding for the Registration Process The Registration Methods Creating an Instance of Your Component webLock1.cpp Using XPCOM Utilities to Make Things Easier XPCOM Macros Generic XPCOM
Module Macros Common Implementation Macros Declaration Macros webLock2.cpp String Classes in XPCOM Usin...
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. Once this method has been called, references to the
module will continue to work but any subsequent import of the
module will reload it and give a new reference. If the JavaScript code
module has not yet been imported then this method will do nothing. You should not unload
modules that are part of the application (anything under resource://gre/ or resource:/// or resource://app/) as these may be in use by other extensions and the application. Only unload
modules you include as part of your extension. Syntax Components.utils...
...application (anything under resource://gre/ or resource:/// or resource://app/) as these may be in use by other extensions and the application. Only unload
modules you include as part of your extension. Syntax Components.utils.unload( url ); Parameters url The "resource://" URL of the script to unload. This must be the same URL that was used to load the script. Example You can unload a
module called My
Module.jsm using the following line of code: Components.utils.unload("resource://myaddon/
modules/My
Module.jsm"); Note: Currently Components.utils.unload clears the global object of an unloaded
module. This may cause
modules to misbehave after unloading even if you have a reference to them. See bug 769253 See also bug 481603 The documentation in xpccomponents.idl The tests in js/xp...
IJSDebugger
js/ductwork/debugger/IJSDebugger.idlScriptable Provides the JavaScript Debugger service. You should usually interface with this using the JavaScript code
module instead of directly. See the JavaScript Debugger API Guide for details. 1.0 66 Introduced Gecko 9.0 Inherits from: nsISupports Last changed in Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6) Implemented by: @mozilla.org/jsdebugger;1 as a service: var jsDebugger = Components.classes["@mozilla.org/jsdebugger;1"] .createInstance(Components.interfaces.IJSDebugger); Note: You should almost never directly use this service; instead, you should use the JavaScript code
module that does this for you. The only time you should directly use this interface to create the Debugger object i...
...See the JavaScript Debugger API Guide for details on using the Debugger API. ...
nsIComponentRegistrar
(.manifest) file or all component files in a directory. Registration lasts for this run only, and is not cached. Note: Formerly this method would register component files directly. This is no longer supported. Component files must have an associated loader and export the required symbols which this loader defines. For example, if the given file is a native library, it must export the symbol NSGet
Module. Other loaders may have different semantics. This method may only be called from the main thread. void autoRegister( in nsIFile aSpec ); Parameters aSpec This parameter indicates either a component file to be registered or a directory containing component files to be registered. XPCOM <= 1.8: If aSpec is null, then the application component's directory as defined by NS_XPCOM_COMPONENT_DIR wi...
...sName The name of the class being registered. This value is intended as a human-readable name for the class and need not be globally unique. aContractID The ContractID of the class being registered. aFile A component file. This file must have an associated loader and export the required symbols, which the loader specifies. aLoaderStr Opaque loader specific string. This value is passed into the nsI
Module.registerSelf() callback and must be forwarded unmodified when registering factories via their location. aType Component Type of aClass. This value is passed into thensI
Module.registerSelf() callback and must be forwarded unmodified when registering factories via their location. unregisterFactory() Unregister a factory associated with a particular class identified by ClassID. void unregisterFacto...
nsICookieManager2
The nsICookieManager2 interface contains additional methods that expand upon the nsICookieManager interface. netwerk/cookie/nsICookieManager2.idlScriptable Please add a summary to this article. Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) Inherits from: nsICookieManager This interface is included in The Services.jsm JavaScript code
module. ...
...upon the nsICookieManager interface. netwerk/cookie/nsICookieManager2.idlScriptable Please add a summary to this article. Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) Inherits from: nsICookieManager This interface is included in The Services.jsm JavaScript code
module. ...
nsIDOMParser
se refer to the DOMParser documentation instead. Creating a DOMParser To create a DOMParser object from a web page or a chrome script running in a window, simply use new DOMParser(). When you create a DOMParser from a privileged script, you can pass parameters to the constructor, more on that below. To create a DOMParser when the constructor is not available (e.g., from a JS XPCOM component, a JS
module, or an xpcshell test), use: var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"] .createInstance(Components.interfaces.nsIDOMParser); // optionally, call parser.init(principal, documentURI, baseURI); Principals, document and base URI Note: This section covers changes introduced to DOMParser in Gecko 1.9. (This section is only relevant to Firefox extensions--not to W...
...e able to access (see discussion in bug 565480). Parsing a string Once you've created a DOMParser object, you can use its parseFromString method to parse XML or HTML as described in the Web platform documentation. ...
Building an Account Manager Extension
Step 1: Implementing nsIAccountManagerExtension As first step we have to implement the nsIAccountManagerExtension. We name the Extension "devmo-account" and state that it is located in the Chrome Package "example@mozilla.org". Furthermore we show the new panel only for IMAP accounts... Components.utils.import("resource://gre/
modules/XPCOMUtils.jsm"); //class constructor function DevmoAccountManagerExtension() {}; // class definition DevmoAccountManagerExtension.prototype = { name : "devmo-account", chromePackageName : "example@mozilla.org", showPanel: function(server) { //this panel is only shown for imap accounts... if (server.type == \"imap\") return true; return false; }, QueryInterface: XPCOMUtils.generateQI([ Co...
...unique identifier or rendez-vous point in the category manager. DevmoAccountManagerExtension.prototype.contractID = "@mozilla.org/accountmanager/extension;1?name=example@mozilla.org"; // Add the component to the mailnews-accountmanager-extensions category DevmoAccountManagerExtension.prototype._xpcom_categories: [{ category: "mailnews-accountmanager-extensions" }], // Create entry point for the
module if (XPCOMUtils.generateNSGetFactory) var NSGetFactory = XPCOMUtils.generateNSGetFactory([DevmoAccountManagerExtension]); else var NSGet
Module = XPCOMUtils.generateNSGet
Module([DevmoAccountManagerExtension]); Step3: Create the new panel As next Step we create the XUL and the property file for your new panel. We defined in Step 1 "devmo-account" as name and "example@mozilla.org" as chrome p...
nsIWebContentHandlerRegistrar
rmission error. Can bypass this by opening about:config and setting preference of gecko.handlerService.allowRegisterFromDifferentHost to true. Examples Register a webmail service as mailto handler The following code aims to add "Outlook.com Live Mail" to list of webservice handlers. In the image below "Gmail" and "Yahoo! Mail" already exist as webservice handlers. ...
...tocol handler' when calling method: [nsIWebContentHandlerRegistrar::registerProtocolHandler] If the host names do match then a confirmation like this will be seen: This domain check can be bypassed by setting the preference of gecko.handlerService.allowRegisterFromDifferentHost to true as in this code here: var {classes: Cc, interfaces: Ci, utils: Cu} = Components; Cu.import("resource://gre/
modules/Services.jsm"); var nsiwchr = Cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"] .getService(Ci.nsIWebContentHandlerRegistrar); var allowRegisterFromDifferentHost = Services.prefs.getBoolPref('gecko.handlerService.allowRegisterFromDifferentHost'); if (!allowRegisterFromDifferentHost) { Services.prefs.setBoolPref('gecko.handlerService.allowRegisterFromDiffe...
XPCOM Interface Reference by grouping
upportsPRUint64 nsISupportsPRUint8 nsISupportsString nsISupportsVoid nsISupportsWeakReference nsIVariant DO NOT USE nsIEnumerator nsIInProcessContentFrameMessageManager nsIScriptableIO nsIXPCScriptable Future nsIXMLHttpRequestUpload Obsolete nsIXmlRpcClient nsIXmlRpcFault Security Auth nsIAuth
Module nsIAuthPrompt nsIAuthPromptProvider nsIAuthPromptWrapper nsIAsyncVerifyRedirectCallback Content nsIContentPolicy Credentials nsILoginInfo nsILoginManager Using nsILoginManager nsILoginManagerStorage nsILoginMetaInfo History nsIGlobalHistory ns...
... nsIThreadInternal nsIThreadManager nsIThreadObserver nsIThreadPool nsIThreadPoolListener nsIToolkit Util nsIVersionComparator nsIWeakReference nsIFactory nsIInterfaceRequestor nsIJSCID nsIJSID nsIJSIID nsI
Module nsIObserver nsIObserverService nsIProperties nsIProperty nsIPropertyBag nsIPropertyBag2 nsIPropertyElement nsIServerSocket nsIServerSocketListener nsIServiceManager nsISocketProvider nsISocketProviderService nsISocketTransport nsISocketTransportService nsISupports nsIUUI...
Storage
pen a connection to the database of your choice - mozIStorageConnection. Create statements to execute on the connection - mozIStorageStatement. Bind parameters to a statement as necessary. Execute the statement. Check for errors. Reset the statement. ...
...nection. Create statements to execute on the connection - mozIStorageStatement. Bind parameters to a statement as necessary. Execute the statement. Check for errors. Reset the statement. ...
Using the clipboard
reak down the steps needed to copy data to the clipboard. First, we need to create an XPCOM object to wrap what we want to copy. We'll assume that we want to copy some text. We will use the interface nsISupportsString which can be used to represent strings (specifically, Unicode strings). The following boilerplate utility functions will be used in all later code examples. // Import the Services
module for future use, if we're not in // a browser window where it's already loaded. Components.utils.import('resource://gre/
modules/Services.jsm'); // Create a constructor for the built-in supports-string class. const nsSupportsString = Components.Constructor("@mozilla.org/supports-string;1", "nsISupportsString"); function SupportsString(str) { // Create an instance of the supports-string class ...
...to construct an nsITransferable instance and set its source to the given window, when necessary function Transferable(source) { var res = nsTransferable(); if ('init' in res) { // When passed a Window object, find a suitable privacy context for it. if (source instanceof Ci.nsIDOMWindow) // Note: in Gecko versions >16, you can import the PrivateBrowsingUtils.jsm
module // and use PrivateBrowsingUtils.privacyContextFromWindow(sourceWindow) instead source = source.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIWebNavigation); res.init(source); } return res; } Here, the string "Text to copy" will be copied but you can replace this with the text string that you want to copy. Now tha...
XPCOM tasks
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. ...
...5.1 Fix the shutdown issues that complicate life for embedding applications. Things we need to evangelize We need to keep up-to-date documentation, samples, and have brown-bags to keep people informed. We've been doing this, but it should be in the plan. General XPCOM guidelines. See, e.g., XPCOM Code FAQ, IDL Author's Guide, and Implementing QueryInterface. Writing and using components and
modules. Building ownership models that work (see XPCOM ownership guidelines), using raw pointers, nsCOMPtr (see The nsCOMPtr User's Manual), nsIWeakReference (see nsIWeakReference), nsCWeakReference, and (across threads) proxies (see nsISupports proxies). Original Document Information Author(s): unknown Last Updated Date: May 8, 2003 Copyright Information: Portions of this content are (C) 1998-...
Mozilla technologies
Mozilla Toolkit is a set of programming interfaces (APIs) built on top of Gecko which provide advanced services to XUL applications. ...
...lications. These services include:Viewing and searching Mozilla source code onlineSource code for all Mozilla projects hosted in the Mercurial repositories can be searched and viewed online using Searchfox, a fast indexed search engine that runs on AWS.XML ExtrasThe XML Extras
module contains several features that allow developers to treat XML as data i.e. not as just another document format. The
module is structured as a drop-in component and exposes its XML-as-data features both to JavaScript and C++/XPCOM users. The XML Extras
module is built by default on all platforms, and is included in the browser installers so it is available in the nightly builds.XPCOMXPCOM is a cross platform component object model, similar to Microsoft COM. It has multiple language bindings, allowing XPCOM components ...
Index
uld be noted that all of this information applies to both Thunderbird and the SeaMonkey application suite. 34 Mail and RDF Mozilla Mail exposes many of it's data structures to RDF through a few datasources. This allows exposure of mailnews-specific data to user interface using RDF Templates. 35 Mail client architecture overview Sections in grey refer to
modules outside of mail/news 36 Mail composition back end by Richard H. Pizzarro <rhp@netscape.com> Contents 37 Mail event system Mozilla mail requires an event system to notify different subsystems that data has changed. This document describes the system that events are passed amongst the mail objects. 38 MailNews Filters MailNews, thunderbird...
...s, but before spam detection the purge code is implemented as a search of the "Junk" folder, looking for "old" message that have the proper junk status. when does purging happens? elaborate on the mime changes that were made for spam currently, spam filtering is does not work for news, but it would be possible to add support for this. (there is a bug on it.) 51 The libmime
module by Richard H. Pizzarro <rhp@netscape.com> 52 Thunderbird API documentation These pages have been moved from mozilla.org, and may or may not be relevant. 55 Thunderbird Binaries Branch, Trunk, comm-central, thunderbird Described below are three types of generally available Thunderbird packages - Releases, Early Preview Releases, and Nightly Bui...
Virtualenv
The virtualenv is created in ${OBJDIR}/_virtualenv and should be recreated as part of the configure step. The populate_virtualenv.py script, when invoked, installs a list of packages, http://mxr.mozilla.org/mozilla-c...
... recreated as part of the configure step. The populate_virtualenv.py script, when invoked, installs a list of packages, http://mxr.mozilla.org/mozilla-central/source/build/virtualenv/packages.txt , into the virtualenv via one of various methods. The Mozilla build system mostly uses .pth files instead of the more typically used python setup.py develop or python setup.py install to install python
modules in to the virtualenv's python path due to performance concerns (although such functionality is available via the setup.py keyword in a packages.txt file). When using this method, be aware that the parts of package installation invoked via setup.py, such as console-script creation and dependency resolution, will not be invoked. The virtualenv software, mirrored from a canonical version, lives in...
XPI
XPI
modules (so called "Bundles") are employed to install a wide variety of software, including Plugins, Extensions, Themes, and Thunderbird dictionaries. An XPI contains installation instructions (install.js or install.rdf) as well as the actual software to install, which is often itself packaged as a JAR file. When downloaded or dropped into an extension manager, XPInstall automatically interacts with the installation instructions contained in the XPI, and installs the contained software. XPI archives only support files stored uncompressed or compressed using the "deflate" method. ...
...es are no longer unpacked when extensions are installed. Instead, the XPI itself is placed in the extensions directory, and files are loaded directly out of the package. See Updating extensions for Firefox 4 for details. When XPI files are served via HTTP, the application/x-xpinstall MIME type should be matched with the xpi file extension. See Also Bundles XPInstall Creating XPI Installer
Modules ...
Using Objective-C from js-ctypes
); Converted js-ctypes code Finally, we have our converted code. This can run with a copy-and-paste into a JavaScript shell. This example uses a busy loop, and thus, Firefox won't respond until the speaking is done. If this code were to be used in a production add-on, then to avoid Firefox locking up, run this code from a ChromeWorker. ...
...eserved: ctypes.int32_t }, { invoke: ctypes.voidptr_t }, { descriptor: Block_descriptor_1.ptr } ]); var BLOCK_CONST = { BLOCK_HAS_COPY_DISPOSE: 1 << 25, BLOCK_HAS_CTOR: 1 << 26, BLOCK_IS_GLOBAL: 1 << 28, BLOCK_HAS_STRET: 1 << 29, BLOCK_HAS_SIGNATURE: 1 << 30 }; // based on work from here: https://github.com/trueinteractions/tint2/blob/f6ce18b16ada165b98b07869314dad1d7bee0252/
modules/Bridge/core.js#L370-L394 var bl = Block_literal_1(); // Set the class of the instance bl.isa = _NSConcreteGlobalBlock; // Global flags bl.flags = BLOCK_CONST.BLOCK_HAS_STRET; bl.reserved = 0; bl.invoke = aFuncTypePtr; // create descriptor var desc = Block_descriptor_1(); desc.reserved = 0; desc.size = Block_literal_1.size; // set descriptor into block literal bl.descriptor = des...
js-ctypes reference
The ctypes object also provides numerous predefined types that correspond to primitives and common typedefs in C. Working with libraries To load a Library, use ctypes.open(). The Library object is used mostly to declare native functions provided by the library so that js-ctypes knows how to call them. ...
...s used mostly to declare native functions provided by the library so that js-ctypes knows how to call them. See Library.declare() for instructions on how to declare these functions. Once you have finished working with a Library, call Library.close(). Calling conventions See ABI. Types and data To use js-ctypes effectively, it is important to understand the different kinds of objects that the
module provides. There are three major categories: Types These represent a type in C, and are thus represented by CType objects. These objects have two main purposes. First, they provide a concrete representation of different data types, allowing the programmer to describe the arguments and return type of a native function (see Library.declare()). Second, they serve as constructors to create concrete...
Browser Console - Firefox Developer Tools
mmands send to the browser via the command line, and the result of executing them. However, it displays such messages from: web content hosted by all browser tabs the browser's own code add-ons. Messages from add-ons The Browser Console displays messages logged by all Firefox add-ons. Console.jsm To use the console API from a traditional or bootstrapped add-on, get it from the Console
module. ...
...code add-ons. Messages from add-ons The Browser Console displays messages logged by all Firefox add-ons. Console.jsm To use the console API from a traditional or bootstrapped add-on, get it from the Console
module. One exported symbol from Console.jsm is "console". Below is an example of how to access it, which adds a message to the Browser Console. Components.utils.import("resource://gre/
modules/Console.jsm"); console.log("Hello from Firefox code"); //output messages to the console Learn more: console API reference Console.jsm source code in the Mozilla DXR HUDService There is also the HUDService which allows access to the Browse Console. The
module is available at Mozilla DXR. We see we can not only access the Browser Console but also Web Console. Here is an example on how to ...
DevTools API - Firefox Developer Tools
oy" a ToolPanel. The only way to close a toolPanel is to close its containing toolbox. All these objects implement the EventEmitter interface. API gDevTools The gDevTools API can be used to register new tools, themes and handle toolboxes for different tabs and windows. To use the gDevTools API from an add-on, it can be imported with following snippet const { gDevTools } = require("resource:///
modules/devtools/gDevTools.jsm"); Methods registerTool(toolDefinition) Registers a new tool and adds a tab to each existing toolbox. Parameters: toolDefinition {ToolDefinition} - An object that contains information about the tool. See ToolDefinition for details. unregisterTool(tool) Unregisters the given tool and removes it from all toolboxes. Parameters: tool {ToolDefinition|String} ...
...get); }, }; EventEmitter EventEmitter is an interface many Developer Tool classes and objects implement and use to notify others about changes in their internal state. When an event is emitted on the EventEmitter, the listeners will be called with the event name as the first argument and the extra arguments are spread as the remaining parameters. Note: Some components use Add-on SDK event
module instead of the DevTools EventEmitter. Unfortunately, their API's are a bit different and it's not always evident which one a certain component is using. The main differences between the two
modules are that the first parameter for Add-on SDK events is the first payload argument instead of the event name and the once method does not return a Promise. The work for unifying the event paradigms is on...
AudioWorkletProcessor - Web APIs
pe the node output accordingly. Processing audio An example algorithm of creating a custom audio processing mechanism is: Create a separate file; In the file: Extend the AudioWorkletProcessor class (see "Deriving classes" section) and supply your own process() method in it; Register the processor using AudioWorkletGlobalScope.registerProcessor() method; Load the file using add
Module() method on your audio context's audioWorklet property; Create an AudioWorkletNode based on the processor. The processor will be instantiated internally by the AudioWorkletNode constructor. Connect the node to the other nodes. Examples In the example below we create a custom AudioWorkletNode that outputs white noise. First, we need to define a custom AudioWorkletProcessor, which will output...
...{ channel[i] = Math.random() * 2 - 1 } }) return true } } registerProcessor('white-noise-processor', WhiteNoiseProcessor) Next, in our main script file we'll load the processor, create an instance of AudioWorkletNode, passing it the name of the processor, then connect the node to an audio graph. const audioContext = new AudioContext() await audioContext.audioWorklet.add
Module('white-noise-processor.js') const whiteNoiseNode = new AudioWorkletNode(audioContext, 'white-noise-processor') whiteNoiseNode.connect(audioContext.destination) Specifications Specification Status Comment Web Audio APIThe definition of 'AudioWorkletProcessor' in that specification. Working Draft ...
CSS Object Model (CSSOM) - Web APIs
rmining the dimensions of elements (it needs some updating as it was made in the DHTML/Ajax era). Managing screen orientation Specifications Specification Status Comment CSS Typed OM Level 1 Working Draft CSS Painting API Level 1 Working Draft Extended the CSS interface with the paintWorklet static property. ...
... CSS Object Model (CSSOM) View
Module Working Draft Defined the Screen and MediaQueryList interfaces and the MediaQueryListEvent event and MediaQueryListListener event listener. CSS Object Model (CSSOM) Working Draft Extended the CSS interface and provides the base for the modern CSSOM specification. Screen Orientation API Working Draft CSS Fonts
Module Level 3 Candidate Recommendation CSS Animations Working Draft CSS Transitions Working Draft CSS Custom Properties for Cascading Variables
Module Level 1 Candidate Recommendation CSS Conditional Rules
Module Level 3 Candidate Recommendation Defined the CSS interface. CSS Device Adaptation Working Draft ...
CSS Painting API - Web APIs
the read-only values of the output bitmap's width and height. Dictionaries PaintRenderingContext2DSettings A dictionary providing a subset of CanvasRenderingContext2D settings. Examples To draw directly into an element's background using JavaScript in our CSS, we define a paint worklet using the registerPaint() function, tell the document to include the worklet using the paintWorklet add
Module() method, then include the image we created using the CSS paint() function. We create our PaintWorklet called 'hollowHighlights' using the registerPaint() function: registerPaint('hollowHighlights', class { static get inputProperties() { return ['--boxColor']; } static get inputArguments() { return ['*','<length>']; } static get contextOptions() { return {alpha: true}; } paint(ctx,...
... <li>item 3</li> <li>item 4</li> <li>item 5</li> <li>item 6</li> <li>item 7</li> <li>item 8</li> <li>item 9</li> <li>item 10</li> <li>item 11</li> <li>item 12</li> <li>item 13</li> <li>item 14</li> <li>item 15</li> <li>item 16</li> <li>item 17</li> <li>item 18</li> <li>item 19</li> <li>item 20</li> </ul> CSS.paintWorklet.add
Module('https://mdn.github.io/houdini-examples/cssPaint/intro/worklets/hilite.js'); Then we can use the <image> with the CSS paint() function: li { --boxColor: hsla(55, 90%, 60%, 1.0); background-image: paint(hollowHighlights, stroke, 2px); } li:nth-of-type(3n) { --boxColor: hsla(155, 90%, 60%, 1.0); background-image: paint(hollowHighlights, filled, 3px); } li:nth-of-type(3n+1) { --...
HTMLElement - Web APIs
LElement.itemId Is a DOMString representing the item ID. HTMLElement.itemRef Read only Returns a DOMSettableTokenList... HTMLElement.itemProp Read only Returns a DOMSettableTokenList... HTMLElement.itemValue Returns a Object representing the item value. HTMLElement.lang Is a DOMString representing the language of an element's attributes, text, and element contents. HTMLElement.no
Module Is a Boolean indicating whether an import script can be executed in user agents that support
module scripts. HTMLOrForeignElement.nonce Returns the cryptographic number used once that is used by Content Security Policy to determine whether a given fetch will be allowed to proceed. HTMLElement.offsetHeight Read only Returns a double containing the height of an element, relative to the layou...
...s completed. Also available via the ontransitionend property. transitionrun Fired when a CSS transition is first created. Also available via the ontransitionrun property. transitionstart Fired when a CSS transition has actually started. Also available via the ontransitionstart property. Specifications Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'HTMLElement' in that specification. Working Draft Added the following properties: offsetParent, offsetTop, offsetLeft, offsetWidth, and offsetHeight. HTML Living StandardThe definition of 'HTMLElement' in that specification. Living Standard Added the following properties: translate, itemScope, itemType, itemId, itemRef, itemProp, properties, and itemValue. ...
MediaKeyMessageEvent - Web APIs
The MediaKeyMessageEvent interface of the EncryptedMediaExtensions API contains the content and related data when the content decryption
module generates a message for the session. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</tex...
...r="middle" alignment-baseline="middle">MediaKeyMessageEvent</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor MediaKeyMessageEvent() Creates a new instance of MediaKeyMessageEvent. Properties Inherits properties from its parent, Event. MediaKeyMessageEvent.message Read only Returns an ArrayBuffer with a message from the content decryption
module. Messages vary by key system. MediaKeyMessageEvent.messageType Read only Indicates the type of message. May be one of license-request, license-renewal, license-release, or individualization-request. Methods Inherits methods from its parent, Event. Examples // TBD Specifications Specification Status Comment Encrypted Media ExtensionsThe definition of 'MediaKeyMess...
MediaKeySession - Web APIs
Properties MediaKeySession.closed Read only Returns a Promise signaling when a MediaKeySession closes. This promise can only be fulfilled and is never rejected. Closing a session means that licenses and keys associated with it are no longer valid for decrypting media data. MediaKeySession.expiration Read only The time after which the keys in the current session can no longer be used to decrypt media data, or NaN if no such time exists. ...
...ses. MediaKeySession.sessionId Read only Contains a unique string generated by the CDM for the current media object and its associated keys or licenses. Event handlers MediaKeySession.onkeystatuseschange Sets the EventHandler called when there has been a change in the keys in a session or their statuses. MediaKeySession.onmessage Sets the EventHandler called when the content decryption
module has generated a message for the session. Methods MediaKeySession.close() Returns a Promise after notifying the current media session is no longer needed and that the CDM should release any resources associated with this object and close it. MediaKeySession.generateRequest() Returns a Promise after generating a media request based on initialization data. MediaKeySession.load() Return...
MouseEvent.clientX - Web APIs
cation's client area at which the event occurred (as opposed to the coordinate within the page). For example, clicking on the left edge of the client area will always result in a mouse event with a clientX value of 0, regardless of whether the page is scrolled horizontally. Syntax var x = instanceOfMouseEvent.clientX Return value A double floating point value, as redefined by the CSSOM View
Module. Originally, this property was defined as a long integer. See the "Browser compatibility" section for details. Example This example displays your mouse's coordinates whenever you trigger the mousemove event. HTML <p>Move your mouse to see its position.</p> <p id="screen-log"></p> JavaScript let screenLog = document.querySelector('#screen-log'); document.addEventListener('mousemove', logKey)...
... Working Draft Redefines MouseEvent from long to double. Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'MouseEvent.clientX' in that specification. Obsolete No change from Document Object Model (DOM) Level 2 Events Specification. Document Object Model (DOM) Level 2 Events SpecificationThe def...
MouseEvent.clientY - Web APIs
plication's client area at which the event occurred (as opposed to the coordinate within the page). For example, clicking on the top edge of the client area will always result in a mouse event with a clientY value of 0, regardless of whether the page is scrolled vertically. Syntax var y = instanceOfMouseEvent.clientY Return value A double floating point value, as redefined by the CSSOM View
Module. Originally, this property was defined as a long integer. See the "Browser compatibility" section for details. Example This example displays your mouse's coordinates whenever you trigger the mousemove event. HTML <p>Move your mouse to see its position.</p> <p id="screen-log"></p> JavaScript let screenLog = document.querySelector('#screen-log'); document.addEventListener('mousemove', logKey)...
... Working Draft Redefines MouseEvent from long to double. Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'MouseEvent.clientY' in that specification. Obsolete No change from Document Object Model (DOM) Level 2 Events Specification. Document Object Model (DOM) Level 2 Events SpecificationThe def...
MouseEvent - Web APIs
Working Draft Redefines MouseEvent from long to double. This means that a PointerEvent whose pointerType is mouse will be a double. Pointer LockThe definition of 'MouseEvent' in that specification. Candidate Recommendation From Document Object Model (DOM) Level 3 Events Specification, added movementX and movementY propertie...
...cification. Working Draft Redefines MouseEvent from long to double. This means that a PointerEvent whose pointerType is mouse will be a double. Pointer LockThe definition of 'MouseEvent' in that specification. Candidate Recommendation From Document Object Model (DOM) Level 3 Events Specification, added movementX and movementY properties. CSS Object Model (CSSOM) View
ModuleThe definition of 'MouseEvent' in that specification. Working Draft From Document Object Model (DOM) Level 3 Events Specification, added offsetX and offsetY, pageX and pageY, x, and y properties. Redefined screen, page, client, and coordinate (x and y) properties as double from long. UI EventsThe definition of 'MouseEvent' in that specification. Working Draft Documen...
PaintWorklet.registerPaint - Web APIs
, class); Parameters name The name of the worklet class to register. class A reference to the class that implements the worklet. Return value undefined Exceptions TypeError Thrown when one of the arguments is invalid or missing. InvalidModificationError Thrown when the a worklet already exists with the specified name. Examples The following shows registering an example worklet
module. This should be in a separate js file. Note that registerPaint() is called without a reference to PaintWorklet. The file itself is loaded through CSS.paintWorklet.add
Module() (documented here on the parent class of PaintWorklet, at Worklet.add
Module(). /* checkboardWorklet.js */ class CheckerboardPainter { paint(ctx, geom, properties) { // Use `ctx` as if it was a normal canvas const ...
...th(); ctx.fillStyle = color; ctx.rect(x * size, y * size, size, size); ctx.fill(); } } } } // Register our class under a specific name registerPaint('checkerboard', CheckerboardPainter); The first step in using a paintworket is defining the paint worklet using the registerPaint() function, as done above. To use it, you register it with the CSS.paintWorklet.add
Module() method: <script> CSS.paintWorklet.add
Module('checkboardWorklet.js'); </script> You can then use the paint() CSS function in your CSS anywhere an <image> value is valid. li { background-image: paint(checkerboard); } Specifications Specification Status Comment CSS Painting API Level 1The definition of 'PaintWorklet.registerPaint' in that specification. Workin...
PaintWorklet - Web APIs
a file. Access this interface through CSS.paintWorklet. Properties PaintWorklet.devicePixelRatio Returns the current device's ratio of physical pixels to logical pixels. Event handlers None. Methods This interface inherits methods from Worklet. PaintWorklet.registerPaint() Registers a class programmatically generate an image where a CSS property expects a file. CSS.PaintWorklet.add
Module() The add
Module() method, inhertied from the Worklet interface loads the
module in the given JavaScript file and adds it to the current PaintWorklet. Examples The following three examples go together to show creating, loading, and using a PaintWorklet. Create a PaintWorklet The following shows an example worklet
module. This should be in a separate js file. Note that registerPaint() is call...
...tyle = color; ctx.rect(x * size, y * size, size, size); ctx.fill(); } } } } // Register our class under a specific name registerPaint('checkerboard', CheckerboardPainter); Load a PaintWorklet The following example demonstrates loading the above worklet from its js file and does so by feature detection. <script> if ('paintWorklet' in CSS) { CSS.paintWorklet.add
Module('checkerboard.js'); } </script> Use a PaintWorklet This example shows how to use a PaintWorklet in a stylesheet, including the simplest way to provide a fallback if PaintWorklet isn't supported. <style> textarea { background-image: url(checkerboard); background-image: paint(checkerboard); } </style> <textarea></textarea> You can also use the @supports at-rule. @supports (backg...
PromiseRejectionEvent.promise - Web APIs
ript Promise which was rejected. You can examine the event's PromiseRejectionEvent.reason property to learn why the promise was rejected. Syntax promise = PromiseRejectionEvent.promise Value The JavaScript Promise which was rejected, and whose rejection went unhandled. ...
... example listens for unhandled promises and, if the reason is an object with a code field containing the text "
Module not ready", it sets up an idle callback that will retry the task that failed to execute correctly. event.preventDefault() is called to indicate that the promise has now been handled. window.onunhandledrejection = function(event) { if (event.reason.code && event.reason.code == "
Module not ready") { window.requestIdleCallback(function(deadline) { load
Module(event.reason.
moduleName) .then(performStartup); }); event.preventDefault(); } } Specifications Specification Status Comment HTML Living StandardThe definition of 'PromiseRejectionEvent.promise' in that specification. Living Standard Initial definition. ...
Window.open() - Web APIs
re using the SDK, tabs are handled a bit differently K-meleon 1.1, a Mozilla-based browser, gives complete control and power to the user regarding how links are opened. Only the user can set his advanced preferences to do that. Some advanced extensions also give Mozilla and Firefox a lot of power over how referenced resources are loaded. In a few years, the target property of the CSS3 hyperlink
module may be implemented (if CSS3 Hyperlink
module as it is right now is approved). And even if and when this happens, you can expect developers of browsers with tab-browsing to give the user entire veto power and full control over how links can open web pages. How to open a link should always be entirely under the control of the user. How do I know whether a window I opened is still open? You can te...
... to describe or to identify the same window. It is the new window that was created. Unrequested popup windows Script-initiated windows opening automatically without the user's consent. Specification Specification Status Comment HTML Living StandardThe definition of 'Window.open()' in that specification. Living Standard CSS Object Model (CSSOM) View
ModuleThe definition of 'The features argument to the open() method' in that specification. Working Draft Defines the effect of the features argument ...
Window.window - Web APIs
d have to do a manual var window = this; assignment at the top of your script. Another reason, is that without this property you wouldn't be able to write, for example, "window.open('http://google.com/')". You'd have to use "open('http://google.com/')" instead. Yet another reason to use this property, is for libraries which wish to offer OOP-versions, and non-OOP versions (especially JavaScript
modules). For example, if we refer to "this.window.location.href", a JavaScript
module could define a property called "window" inside of a class it defined (since no global "window" variable exists for it by default) which could be created after passing in a window object to the
module class' constructor. Thus, "this.window" inside of its functions would refer to that window object. In the non-namespac...
...The default in the class could still be set as the current window object. ...
XMLDocument.load() - Web APIs
Can be used with document.async to indicate whether the request is synchronous or asynchronous (the default). As of at least Gecko 1.9, this no longer supports cross-site loading of documents (Use XMLHttpRequest or fetch() instead). Examples var xmlDoc = document.implementation.createDocument("", "test", null); function documentLoaded (e) { alert(new XMLSerializer().serializeToString(e.target)); // Gives querydata.xml contents as string } xmlDoc.addEventListener("load", documentLoaded, false); xmlDoc.load('querydata.xml'); See also the load sample in the XML tests directory. ...
...dEventListener("load", documentLoaded, false); xmlDoc.load('querydata.xml'); See also the load sample in the XML tests directory. (To test this functionality, create the files on your local disk or on a webserver rather than loading the load.html file from the LXR-generated page, which will serve the text.xml file as HTML.) Specifications Old W3C Working Draft of the DOM Level 3 Load & Save
module ...
XRSession.environmentBlendMode - Web APIs
agery is overlaid atop the real world. This is used to differentiate between fully-immersive VR sessions and AR sessions which render over a pass-through image of the real world, possibly partially transparently. The value is a DOMString which contains one of the values defined by the XREnvironmentBlendMode enumerated type. Important: environmentBlendMode is part of the WebXR Augmented Reality
Module, which has not yet reached a stable state. You should use caution when using its features. Syntax blendMode = xrSession.environmentBlendMode; Value A DOMString whose value is one of the strings found in the enumerated type XREnvironmentBlendMode, defining if--and if so, how--virtual, rendered content is overlaid atop the image of the real world. Permitted values are: opaque The rendered...
...ayer property provides relative weights of the artificial layer during the compositing process. Pixels whose alpha value is 1.0 are rendered fully opaque, totally obscuring the real world, while pixels with an alpha of 1.0 are totally transparent, leaving the surrounding environment to pass through. Specifications Specification Status Comment WebXR Augmented Reality
ModuleThe definition of 'XRSession.environmentBlendMode' in that specification. Working Draft Initial definition. ...
XRSessionMode - Web APIs
le kinds of session mode that can be used. Values immersive-ar The session's output will be given exclusive access to the immersive device, but the rendered content will be blended with the real-world environment. The session's environmentBlendMode indicates the method to be used to blend the content together. Important: The immersive-ar mode is defined by the WebXR Augmented Reality
Module, which is not yet stable and should not be used other than for testing and experimentation. immersive-vr Indicates that the rendered session will be displayed using an immersive XR device in VR mode; it is not intended to be overlaid or integrated into the surrounding environment. The environmentBlendMode is expected to be opaque if possible, but might be additive if the hardware requires i...
...aces that immersive-vr does, since both are immersive sessions. Browsers may support either or both of these modes, but if WebXR is available, the inline mode is always supported. Specifications Specification Status Comment WebXR Device APIThe definition of 'XRSessionMode' in that specification. Working Draft Initial definition. WebXR Augmented Reality
ModuleThe definition of 'XRSessionMode: immersive-ar' in that specification. Editor's Draft The immersive-ar value added ...
-webkit-line-clamp - CSS: Cascading Style Sheets
so want to set overflow to hidden, otherwise the contents won't be clipped but an ellipsis will still be shown after the specified number of lines. When applied to anchor elements, the truncating can happen in the middle of the text, not necessarily at the end. Note: This property was originally implemented in WebKit and has some issues. It got standardized for legacy support. The CSS Overflow
Module Level 3 specification also defines a line-clamp property, which is meant to replace this property and avoid its issues. Syntax /* Keyword value */ -webkit-line-clamp: none; /* <integer> values */ -webkit-line-clamp: 3; -webkit-line-clamp: 10; /* Global values */ -webkit-line-clamp: inherit; -webkit-line-clamp: initial; -webkit-line-clamp: unset; none This value specifies that the conten...
...e-clamp</code> property is set to <code>3</code>, which means the text is clamped after three lines. An ellipsis will be shown at the point where the text is clamped. </p> CSS p { width: 300px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; } Result Specifications Specification Status Comment CSS Overflow
Module Level 3The definition of '-webkit-line-clamp' in that specification. Working Draft Initial definition ...
CSSOM View - CSS: Cascading Style Sheets
Reference Properties scroll-behavior Guides Coordinate systems A guide to the coordinate systems used to specify the position of a location in a display context, whether that context is a window on a monitor, a viewport on a mobile device, or a position on a sheet of paper when printing. ...
... ...
CSS Box Alignment - CSS: Cascading Style Sheets
The CSS Box Alignment
module specifies CSS features that relate to the alignment of boxes in the various CSS box layout models: block layout, table layout, flex layout, and grid layout. The
module aims to create a consistent method of alignment across all of CSS. This document details the general concepts found in the specification. Note: The documentation for each layout method will detail how Box Alignment is applied there. Older alignment methods CSS traditionally had very limited alignment capabilities. We were able to align text using text-align, center blocks using auto margins, and in table or inline-block layouts using the vertical-align property. ...
... Note: The documentation for each layout method will detail how Box Alignment is applied there. Older alignment methods CSS traditionally had very limited alignment capabilities. We were able to align text using text-align, center blocks using auto margins, and in table or inline-block layouts using the vertical-align property. Alignment of text is now covered by the Inline Layout and CSS Text
modules, and for the first time in Box Alignment we have full horizontal and vertical alignment capabilities. If you initially learned Flexbox then you may consider these properties to be part of the Flexbox specification, and some of the properties are indeed listed in Level 1 of Flexbox. However the specification notes that the Box Alignment specification should be referred to as it may add additiona...
CSS Multi-column Layout - CSS: Cascading Style Sheets
Support is included for establishing the number of columns in a layout, as well as how content should flow from column to column, gap sizes between columns, and column dividing lines (known as column rules) along with their appearance. Basic example In the following example the column-count property has been applied to the element with a class of container. As the value of column-count is 3, the content is arranged into 3 columns of equal size. Relationship to Fragmentation Multiple-column Layout is closely related to Paged Media, in that each column box becomes a fragment, much like a printed page becomes a fragment of an overall document. ...
...re filled. ...
CSS Display - CSS: Cascading Style Sheets
CSS Display is a
module of CSS that defines how the CSS formatting box tree is generated from the document element tree and defines properties controlling it. Reference CSS properties display CSS data types <display-outside> <display-inside> <display-listitem> <display-box> <display-internal> <display-legacy> Guides CSS Flow Layout (display: block, display: inline) Block and Inline Layout in Normal Flow Flow Layout and Overflow Flow Layout and Writing Modes Formatting Contexts Explained In Flow and Out of Flow display: flex Basic concepts of flexbox Aligning Items in a Flex Container Controlling Ratios of Flex Items Along the Main Axis Cross-browser Flexbox mixins Mastering Wrapping of Flex Items Ordering Flex Items Relationship of flexbox to other layout...
... Candidate Recommendation Added run-in, flow, flow-root, contents and multi-keyword values. CSS Level 2 (Revision 1)The definition of 'display' in that specification. Recommendation Added the table model values and inline-block. CSS Level 1The definition of 'display' in that specification. Recommendation ...
CSS Flexible Box Layout - CSS: Cascading Style Sheets
In the flex layout model, the children of a flex container can be laid out in any direction, and can "flex" their sizes, either growing to fill unused space or shrinking to avoid overflowing the parent. Both horizontal and vertical alignment of the children can be easily manipulated. Basic Example In the following example a container has been set to display: flex, which means that the three child items become flex items. The value of justify-content has been set to space-between in order to space the items out evenly on the main axis. ...
... ...
CSS Fragmentation - CSS: Cascading Style Sheets
Fragmentation occurs when an inline box wraps onto multiple lines. It also occurs when a block spans more than one column inside a column layout container, or spans a page break when printed. Each piece of the rendering for the element is called a fragment. Reference box-decoration-break break-after break-before break-inside orphans widows Specifications Specification Status Comment CSS Fragmentation
Module Level 3 Candidate Recommendation Initial definition. ...
...onto multiple lines. It also occurs when a block spans more than one column inside a column layout container, or spans a page break when printed. Each piece of the rendering for the element is called a fragment. Reference box-decoration-break break-after break-before break-inside orphans widows Specifications Specification Status Comment CSS Fragmentation
Module Level 3 Candidate Recommendation Initial definition. ...
CSS Generated Content - CSS: Cascading Style Sheets
Generated content can be used to add content to anonymous replaced elements or replace the content of a DOM node in very limited circumstances with a generated value. See the how to guide for generated content to learn more, and the content and quotes properties for implementation information. ...
...content to anonymous replaced elements or replace the content of a DOM node in very limited circumstances with a generated value. See the how to guide for generated content to learn more, and the content and quotes properties for implementation information. Reference Properties content quotes Specifications Specification Status Comment CSS Generated Content
Module Level 3 Working Draft CSS Level 2 (Revision 1) Recommendation Initial definition ...
CSS Lists - CSS: Cascading Style Sheets
Reference Properties list-style-image list-style-type list-style-position list-style Guides Consistent list indentation Explains how to achieve consistent list indentation across different browsers. Using CSS Counters Explains how to use the CSS counter properties to control list counters. ...
...yled. ...
CSS Motion Path - CSS: Cascading Style Sheets
The idea is that when you want to animate an element moving along a path, you previously only had animating translation, position, etc. at your disposal, which wasn't ideal and only allowed for simple movements. With offset-path you can define a specific path of any shape you want. You then animate it along that path by animating offset-distance, and can choose to rotate it at any point using offset-rotate. ...
... ...
CSS Overflow - CSS: Cascading Style Sheets
In CSS overflow happens when the content of a box extends past one or more of the box's edges. Ink overflow and scrollable overflow There are two types of overflow that you might encounter in CSS. The first is described as ink overflow. This is the overflow of painting effects which do not affect layout or otherwise extend the scrollable overflow region, such as box shadows, border images, text decoration, overhanging glyphs, outlines, etc. The overflow that we sometimes need to manage in CSS is described as scrollable overflow. This is the content appearing outside of the box for which scrolling mechanisms need to be provided. ...
...ect, please clone https://github.com/mdn/interactive-examples and send us a pull request. Reference CSS properties overflow overflow-block overflow-inline overflow-x overflow-y text-overflow block-overflow line-clamp max-lines continue Non-standard properties -webkit-line-clamp Specifications Specification Status Comment CSS Overflow
Module Level 3The definition of 'overflow' in that specification. Working Draft Changed syntax to allow one or two keywords instead of only one CSS Level 2 (Revision 1)The definition of 'overflow' in that specification. Recommendation Initial definition. ...
CSS Positioned Layout - CSS: Cascading Style Sheets
Reference CSS properties bottom clear float left position right top z-index Guides Understanding CSS z-index Presents the notion of stacking context and explains how z-ordering works, with several examples. ...
...ayout is a
module of CSS that defines how to position elements on the page. ...
CSS Ruby Layout - CSS: Cascading Style Sheets
Ruby annotation is a form of interlinear annotation, consisting of short runs of text alongside the base text. They are typically used in East Asian documents to indicate pronunciation or to provide a short annotation. ...
... to the display of ruby annotation. ...
CSS Text - CSS: Cascading Style Sheets
Reference Properties hanging-punctuation hyphens letter-spacing line-break overflow-wrap tab-size text-align text-align-last text-indent text-justify text-size-adjust text-transform white-space word-break word-spacing Specifications Specification Status Comment CSS Logical Properties and Values Level 1 Editor's Draft Updates some properties to be independent of the directionality of the text. ...
... line-break overflow-wrap tab-size text-align text-align-last text-indent text-justify text-size-adjust text-transform white-space word-break word-spacing Specifications Specification Status Comment CSS Logical Properties and Values Level 1 Editor's Draft Updates some properties to be independent of the directionality of the text. CSS Text
Module Level 3 Working Draft CSS Level 2 (Revision 1) Recommendation CSS Level 1 Recommendation Initial definition ...
CSS Text Decoration - CSS: Cascading Style Sheets
Reference Properties letter-spacing text-align text-decoration text-decoration-color text-decoration-line text-decoration-offset text-decoration-skip-ink text-decoration-style text-decoration-thickness text-emphasis text-emphasis-color text-emphasis-position text-emphasis-style text-indent text-rendering text-shadow text-transform white-space word-spacing Guides None. ...
... on the underline to denote hyperlinks.</p> <p class="underover">This text has lines above <em>and</em> below it.</p> <p class="thick">This text has a really thick purple underline in supporting browsers.</p> <p class="blink">This text might blink for you, depending on the browser you use.</p> Specifications Specification Status Comment CSS Text Decoration
Module Level 4 Working Draft CSS Text Decoration
Module Level 3 Candidate Recommendation CSS Level 2 (Revision 1) Recommendation CSS Level 1 Recommendation Initial definition ...
CSS Writing Modes - CSS: Cascading Style Sheets
used by Latin and Indic scripts), right-to-left (e.g. used by Hebrew or Arabic scripts), bidirectional (used when mixing left-to-right and right-to-left scripts) and vertical (e.g. used by some Asian scripts). ...
...-to-left (e.g. used by Hebrew or Arabic scripts), bidirectional (used when mixing left-to-right and right-to-left scripts) and vertical (e.g. used by some Asian scripts). ...
Filter Effects - CSS: Cascading Style Sheets
Reference Properties backdrop-filter filter Data types <filter-function> Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'filter' in that specification. ...
... Working Draft Initial definition. ...
align-content - CSS: Cascading Style Sheets
Candidate Recommendation Initial definition Initial valuenormalApplies tomulti-line flex containersInheritednoComputed val...
...dEventListener('change', function (evt) { container.className = evt.target.value; }); Result Specifications Specification Status Comment CSS Box Alignment
Module Level 3The definition of 'align-content' in that specification. Working Draft Adds the [ first | last ]? baseline, start, end, left, right, unsafe | safe values. CSS Flexible Box Layout
ModuleThe definition of 'align-content' in that specification. Candidate Recommendation Initial definition Initial valuenormalApplies tomulti-line flex containersInheritednoComputed valueas specifiedAnimation typediscrete ...
<alpha-value> - CSS: Cascading Style Sheets
Recommendation Introduces <alpha-value> along with rgba() and hsla() functional notations. ...
... Recommendation Introduces <alpha-value> along with rgba() and hsla() functional notations. ...
appearance (-moz-appearance, -webkit-appearance) - CSS: Cascading Style Sheets
sh to use this property on websites, you should test it very carefully. Although it is supported in most modern browsers, its implementation varies widely. In older browsers, even the keyword none does not have the same effect on all form elements across different browsers, and some do not support it at all. The differences are smaller in the newest browsers. ...
... Working Draft Initial definition. ...
attr() - CSS: Cascading Style Sheets
Candidate Recommendation Added two optional param...
... Candidate Recommendation Added two optional parameters; can be used on all properties; may return values other than <string>. ...
break-after - CSS: Cascading Style Sheets
Working Draft Extends the property to handle regio...
...; gap: 20px; } Result Specifications Specification Status Comment CSS Fragmentation
Module Level 3The definition of 'break-after' in that specification. Candidate Recommendation Adds the recto and verso keywords. Changes the media type of this property from paged to visual. Defines the breaking algorithm with different kinds of breaks. CSS Regions
Module Level 1The definition of 'break-after' in that specification. Working Draft Extends the property to handle region breaks. Adds the avoid-region and region keywords. CSS Multi-column Layout
ModuleThe definition of 'break-after' in that specification. Working Draft Initial definition. Extends the CSS 2.1 page-break-after property to handle both page and column breaks. Br...
break-before - CSS: Cascading Style Sheets
Working Draft Extends the property to handle reg...
... gap: 20px; } Result Specifications Specification Status Comment CSS Fragmentation
Module Level 3The definition of 'break-before' in that specification. Candidate Recommendation Adds the recto and verso keywords. Changes the media type of this property from paged to visual. Defines the breaking algorithm with different kinds of breaks. CSS Regions
Module Level 1The definition of 'break-before' in that specification. Working Draft Extends the property to handle region breaks. Adds the avoid-region and region keywords. CSS Multi-column Layout
ModuleThe definition of 'break-before' in that specification. Working Draft Initial definition. Extends the CSS 2.1 page-break-before property to handle both page and column breaks. ...
break-inside - CSS: Cascading Style Sheets
Working Draft Initial definition. ...
...70%; display: block; margin: 0 auto; } figcaption { font-style: italic; font-size: 0.8rem; width: 70%; } article { column-width: 200px; gap: 20px; } Result Specifications Specification Status Comment CSS Fragmentation
Module Level 3The definition of 'break-inside' in that specification. Candidate Recommendation No change. CSS Regions
Module Level 1The definition of 'break-inside' in that specification. Working Draft Extends the property to handle region breaks. CSS Multi-column Layout
ModuleThe definition of 'break-inside' in that specification. Working Draft Initial definition. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to th...
clip-path - CSS: Cascading Style Sheets
Candidate Recommendation Extends its application to HTML elements. The clip-path property replaces the deprecated clip property. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'clip-path' in that specification. Recommendation Initial definition (applies to SVG elements only). CSS Shapes...
...Level 1The definition of 'clip-path' in that specification. Candidate Recommendation Extends its application to HTML elements. The clip-path property replaces the deprecated clip property. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'clip-path' in that specification. Recommendation Initial definition (applies to SVG elements only). CSS Shapes
Module Level 2The definition of 'path' in that specification. Editor's Draft Defines path(). ...
color - CSS: Cascading Style Sheets
Working Draft Adds commaless syntaxes for the rgb(), rgba(), hsl(), and hsla() functions. Allows alpha values in rgb() and hsl(), turning rgba() and hsla() into (deprecated) aliases for them. Adds color keyword rebeccapurple. Adds 4- and 8-digit hex color values, where the last digit(s) represents the alpha value. Adds hwb(...
...Working Draft Adds commaless syntaxes for the rgb(), rgba(), hsl(), and hsla() functions. Allows alpha values in rgb() and hsl(), turning rgba() and hsla() into (deprecated) aliases for them. Adds color keyword rebeccapurple. Adds 4- and 8-digit hex color values, where the last digit(s) represents the alpha value. Adds hwb(), device-cmyk(), and color() functions. CSS Color
Module Level 3The definition of 'color' in that specification. Recommendation Deprecates system-colors. Adds SVG colors. Adds the rgba(), hsl(), and hsla() functions. CSS Level 2 (Revision 1)The definition of 'color' in that specification. Recommendation Adds the orange color and the system colors. CSS Level 1The definition of 'color' in that specification. Recommendatio...
display - CSS: Cascading Style Sheets
erySelector('select'); function updateDisplay() { articles.forEach((article) => { article.style.display = select.value; }); } select.addEventListener('change', updateDisplay); updateDisplay(); Result Note: You can find more examples in the pages for each separate display data type, linked above. Specifications Specification Status Comment CSS Display
Module Level 3The definition of 'display' in that specification. Candidate Recommendation Added run-in, flow, flow-root, contents, and multi-keyword values. CSS Ruby Layout
Module Level 1The definition of 'display' in that specification. Working Draft Added ruby, ruby-base, ruby-text, ruby-base-container, and ruby-text-container. CSS Grid LayoutThe definition of 'display' i...
... Candidate Recommendation Added the flexible box model values. CSS Level 2 (Revision 1)The definition of 'display' in that specification. Recommendation Added the table model values and inline-block. ...
font-size - CSS: Cascading Style Sheets
Candidate Recommendation No change. CSS Level 2 (Revision 1)The definition of 'font-size' in that specification. Recommendation No change. CSS Level 1The definition of 'font-size'...
...} .percent { font-size: 200%; } HTML <h1 class="small">Small H1</h1> <h1 class="larger">Larger H1</h1> <h1 class="point">24 point H1</h1> <h1 class="percent">200% H1</h1> Result Specifications Specification Status Comment CSS Fonts
Module Level 4The definition of 'font-size' in that specification. Working Draft Adds xxx-large keyword. CSS Fonts
Module Level 3The definition of 'font-size' in that specification. Candidate Recommendation No change. CSS Level 2 (Revision 1)The definition of 'font-size' in that specification. Recommendation No change. CSS Level 1The definition of 'font-size' in that specification. Recommendation Initial definition. ...
font-stretch - CSS: Cascading Style Sheets
Candidate Recommendation Initial definition. Note: The font-stretch property was initially defined in CSS 2, but dropped in CSS 2.1 due to the lack of browser imple...
... 'LeagueMonoVariable', sans-serif; } .condensed { font-stretch: 50%; } .normal { font-stretch: 100%; } .expanded { font-stretch: 200%; } Result Specifications Specification Status Comment CSS Fonts
Module Level 4The definition of 'font-stretch' in that specification. Working Draft Adds the <percentage> syntax for variable fonts. CSS Fonts
Module Level 3The definition of 'font-stretch' in that specification. Candidate Recommendation Initial definition. Note: The font-stretch property was initially defined in CSS 2, but dropped in CSS 2.1 due to the lack of browser implementation. It was brought back in CSS 3. ...
font-style - CSS: Cascading Style Sheets
Candidate Recommendation No change CSS Level 2 (Revision 1)The definition of 'font-style' in that specification. Recommendation No change CSS Level 1T...
...lass="oblique">This paragraph is oblique.</p> .normal { font-style: normal; } .italic { font-style: italic; } .oblique { font-style: oblique; } Specifications Specification Status Comment CSS Fonts
Module Level 4The definition of 'font-style' in that specification. Working Draft Adds the ability to specify an angle after oblique CSS Fonts
Module Level 3The definition of 'font-style' in that specification. Candidate Recommendation No change CSS Level 2 (Revision 1)The definition of 'font-style' in that specification. Recommendation No change CSS Level 1The definition of 'font-style' in that specification. Recommendation Initial definition ...
font-variant - CSS: Cascading Style Sheets
Candidate Recommendation Made it a shorthand of the new font-variant-* properties. CSS Level 2 (Revision 1)The definition of 'font-variant' in that specification. Recommendation No change CSS Level 1The definition of 'font-variant' in that specification. Recommendation Initial definition Brow...
... 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 11Safari iOS Full support 1Samsung Internet Android Full support 1.0CSS Fonts
Module Level 3 shorthandChrome Full support 52Edge Full support 79Firefox Full support 34 Full support 34 No support 33 -- 34Disabled Disabled From version 33 until version 34 (exclusive): this featur...
justify-content - CSS: Cascading Style Sheets
Candidate Recommendation Initial definition ...
..."container").style.justifyContent = evt.target.value; }); Result Specifications Specification Status Comment CSS Box Alignment
Module Level 3The definition of 'justify-content' in that specification. Working Draft Adds the [ first | last ]? baseline, self-start, self-end, start, end, left, right, unsafe | safe values. CSS Flexible Box Layout
ModuleThe definition of 'justify-content' in that specification. Candidate Recommendation Initial definition ...
<length> - CSS: Cascading Style Sheets
Candidate Recommendation Adds the ch, rem, vw, vh, vmin, vmax, and Q units. CSS Level 2 (Revision 1)The definition of '<length>' in that specification. Recommendatio...
... Candidate Recommendation Adds the ch, rem, vw, vh, vmin, vmax, and Q units. ...
max-height - CSS: Cascading Style Sheets
Working Draft Adds the max-content, min-content, fit-content keywords. CSS Level 2 (Revision 1)The definition of 'max-height' in that specification. Recommendation Initial definition. Browser comp...
...(<length-percentage>)where <length-percentage> = <length> | <percentage> Examples Setting max-height using percentage and keyword values table { max-height: 75%; } form { max-height: none; } Specifications Specification Status Comment CSS Box Sizing
Module Level 4The definition of 'max-height' in that specification. Editor's Draft CSS Box Sizing
Module Level 3The definition of 'max-height' in that specification. Working Draft Adds the max-content, min-content, fit-content keywords. CSS Level 2 (Revision 1)The definition of 'max-height' in that specification. Recommendation Initial definition. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to ...
min-height - CSS: Cascading Style Sheets
Working Draft Adds the max-content, min-content, fit-content keywords. CSS Level 2 (Revision 1)The definition of 'min-height' in that specification. Recommendation Initial definition. ...
... min-content | max-content | fit-content(<length-percentage>)where <length-percentage> = <length> | <percentage> Examples Setting min-height table { min-height: 75%; } form { min-height: 0; } Specifications Specification Status Comment CSS Box Sizing
Module Level 4The definition of 'min-height' in that specification. Editor's Draft CSS Box Sizing
Module Level 3The definition of 'min-height' in that specification. Working Draft Adds the max-content, min-content, fit-content keywords. CSS Level 2 (Revision 1)The definition of 'min-height' in that specification. Recommendation Initial definition. ...
min-width - CSS: Cascading Style Sheets
Candidate Recommendation Adds the auto keyword and ...
...tent | max-content | fit-content(<length-percentage>)where <length-percentage> = <length> | <percentage> Examples Setting minimum element width table { min-width: 75%; } form { min-width: 0; } Specifications Specification Status Comment CSS Box Sizing
Module Level 4The definition of 'min-width' in that specification. Editor's Draft CSS Box Sizing
Module Level 3The definition of 'min-width' in that specification. Working Draft Adds the max-content, min-content, fit-content keywords. CSS Flexible Box Layout
ModuleThe definition of 'min-width' in that specification. Candidate Recommendation Adds the auto keyword and uses it as the initial value. CSS Level 2 (Revision 1)The definition of 'min-width' in that specificatio...
object-fit - CSS: Cascading Style Sheets
Candidate Recommendation Initial definition Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/...
...margin-top: 10px; } .fill { object-fit: fill; } .contain { object-fit: contain; } .cover { object-fit: cover; } .none { object-fit: none; } .scale-down { object-fit: scale-down; } Result Specifications Specification Status Comment CSS Images
Module Level 4The definition of 'object-fit' in that specification. Working Draft CSS Images
Module Level 3The definition of 'object-fit' in that specification. Candidate Recommendation Initial definition Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafa...
order - CSS: Cascading Style Sheets
Criterion 1.3.2 | W3C Understanding WCAG 2.0 Formal definition Initial value0Applies toflex items and absolutely-positioned flex container childrenInheritednoComputed valueas specifiedAnimation typean integer Formal syntax <integer> Examples Ordering items in a flex container This example uses CSS to create a classic two-sidebar layout surrounding a content block. The Flexible Box Layout
Module automatically creates blocks of equal vertical size and uses as much horizontal space as available. HTML <header>...</header> <main> <article>Article</article> <nav>Nav</nav> <aside>Aside</aside> </main> <footer>...</footer> CSS main { display: flex; text-align:center; } main > article { flex:1; order: 2; } main > nav { width: 200px; order: 1; } main > aside { width: 200p...
... Candidate Recommendation Initial definition Initial value0Applies toflex items and absolutely-positioned flex container childrenInheritednoComputed valueas specifiedAnimation typean integer ...
<percentage> - CSS: Cascading Style Sheets
Candidate Recommendation No significant change from CSS Level 2 (Revision 1). CSS Level 2 (Revision 1)The definition of '<percentage>' in that specification. Recommendation ...
...8px)</p> <p><span style="font-size:50%;">50% (9px)</span></p> <p><span style="font-size:200%;">200% (36px)</span></p> </div> The above HTML will output: Specifications Specification Status Comment CSS Values and Units
Module Level 4The definition of '<percentage>' in that specification. Editor's Draft No significant change. CSS Values and Units
Module Level 3The definition of '<percentage>' in that specification. Candidate Recommendation No significant change from CSS Level 2 (Revision 1). CSS Level 2 (Revision 1)The definition of '<percentage>' in that specification. Recommendation No change from CSS Level 1. CSS Level 1The definition of '<percentage>' in that specification. Recommendation Initial definitio...
text-decoration - CSS: Cascading Style Sheets
Candidate Recommendation Transformed into a shorthand property. Added support for the value of text-decoration-style. CSS Level 2 (Re...
... Candidate Recommendation Transformed into a shorthand property. ...
text-shadow - CSS: Cascading Style Sheets
...
...m accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore.</p> Specifications Specification Status Comment CSS Text Decoration
Module Level 3The definition of 'text-shadow' in that specification. Candidate Recommendation The CSS property text-shadow was improperly defined in CSS2 and dropped in CSS2 (Level 1). The CSS Text
Module Level 3 spec refined the syntax. Later it was moved to CSS Text Decoration
Module Level 3. ...
url() - CSS: Cascading Style Sheets
Candidate Recommendation No significant change from CSS Level 2 (Revision 1). CSS Level 2 (Revision 1)The definition of 'uri()' in that specification. Recommendation No significant change from CSS Level 1. ...
...%3Cpath d='M10 10h60' stroke='%2300F' stroke-width='5'/%3E%3Cpath d='M10 20h60' stroke='%230F0' stroke-width='5'/%3E%3Cpath d='M10 30h60' stroke='red' stroke-width='5'/%3E%3C/svg%3E"); } Specifications Specification Status Comment CSS Values and Units
Module Level 4The definition of 'url()' in that specification. Editor's Draft CSS Values and Units
Module Level 3The definition of 'url()' in that specification. Candidate Recommendation No significant change from CSS Level 2 (Revision 1). CSS Level 2 (Revision 1)The definition of 'uri()' in that specification. Recommendation No significant change from CSS Level 1. CSS Level 1The definition of 'url()' in that specification. Recommendation Initial definition. ...
<url> - CSS: Cascading Style Sheets
Candidate Recommendation No significant change from CSS Level 2 (Revision 1). CSS Level 2 (Revision 1)The definition of '<uri>' in that specification. Recommendation No significant change from CSS Level 1. ...
.../mysite.example.com/mycursor.png) Examples .topbanner { background: url("topbanner.png") #00D no-repeat fixed; } ul { list-style: square url(http://www.example.com/redball.png); } Specifications Specification Status Comment CSS Values and Units
Module Level 4The definition of '<url>' in that specification. Editor's Draft CSS Values and Units
Module Level 3The definition of '<url>' in that specification. Candidate Recommendation No significant change from CSS Level 2 (Revision 1). CSS Level 2 (Revision 1)The definition of '<uri>' in that specification. Recommendation No significant change from CSS Level 1. CSS Level 1The definition of '<url>' in that specification. Recommendation Initial definition. ...
width - CSS: Cascading Style Sheets
Working Draft Added the max-content, min-content, fit-content keywords. CSS Level 2 (Revision 1)The definition of 'width' in that specification. Recommendation Precises on which element it applies to. CSS...
...ghtblue; width: -moz-min-content; /* Firefox */ width: -webkit-min-content; /* Chrome */ width: min-content; } <p class="minblue">The Mozilla community produces a lot of great software.</p> Specifications Specification Status Comment CSS Box Sizing
Module Level 4The definition of 'width' in that specification. Editor's Draft CSS Box Sizing
Module Level 3The definition of 'width' in that specification. Working Draft Added the max-content, min-content, fit-content keywords. CSS Level 2 (Revision 1)The definition of 'width' in that specification. Recommendation Precises on which element it applies to. CSS Level 1The definition of 'width' in that specification. Recommendation Initial definition. ...
HTTP Public Key Pinning (HPKP) - HTTP
he following to your webserver's config will enable HPKP on your Apache. This requires mod_headers enabled. Header always set Public-Key-Pins "pin-sha256=\"base64+primary==\"; pin-sha256=\"base64+backup==\"; max-age=5184000; includeSubDomains" Nginx Adding the following line and inserting the appropriate pin-sha256="..." values will enable HPKP on your nginx. This requires the ngx_http_headers_
module. add_header Public-Key-Pins 'pin-sha256="base64+primary=="; pin-sha256="base64+backup=="; max-age=5184000; includeSubDomains' always; Lighttpd The following line with your relevant key information (pin-sha256="..." fields) will enable HPKP on lighttpd. setenv.add-response-header = ( "Public-Key-Pins" => "pin-sha256=\"base64+primary==\"; pin-sha256=\"base64+backup==\"; max-age=5184000; includ...
...=="; pin-sha256="base64+backup=="; max-age=5184000; includeSubDomains' always; Lighttpd The following line with your relevant key information (pin-sha256="..." fields) will enable HPKP on lighttpd. setenv.add-response-header = ( "Public-Key-Pins" => "pin-sha256=\"base64+primary==\"; pin-sha256=\"base64+backup==\"; max-age=5184000; includeSubDomains") Note: This requires the mod_setenv server.
module loaded which can be included by the following if not already loaded. server.
modules += ( "mod_setenv" ) IIS Add the following line to the Web.config file to send the Public-Key-Pins header: <system.webServer> ... <httpProtocol> <customHeaders> <add name="Public-Key-Pins" value="pin-sha256="base64+primary=="; pin-sha256="base64+backup=="; max-age=5184000; inc...
Redirections in HTTP - HTTP
requests that are scheduled for later processing. In this case, the response is a 303 (See Other) redirect that links to a page indicating that the action has been scheduled, and eventually informs about its progress, or allows to cancel it. Configuring redirects in common servers Apache Redirects can be set either in the server config file or in the .htaccess of each directory. ...
... https://images.example.com/$1 All documents in the images/ directory will redirect to a different domain. If you don't want a temporary redirect, an extra parameter (either the HTTP status code to use or the permanent keyword) can be used to set up a different redirect: Redirect permanent / https://www.example.com # ...acts the same as: Redirect 301 / https://www.example.com The mod_rewrite
module can also create redirects. It is more flexible, but a bit more complex. Nginx In Nginx, you create a specific server block for the content you want to redirect: server { listen 80; server_name example.com; return 301 $scheme://www.example.com$request_uri; } To apply a redirect to a directory or only certain pages, use the rewrite directive: rewrite ^/images/(.*)$ https://images.example.co...
WebAssembly.Global() constructor - JavaScript
This allows dynamic linking of multiple
modules. Syntax new WebAssembly.Global(descriptor, value); Parameters descriptor A GlobalDescriptor dictionary object, which contains two properties: value: A USVString representing the data type of the global. This can be one of i32, i64, f32, and f64. mutable: A boolean value that determines whether the global is mutable or not. ...
...alue algorithm. Examples Creating a new Global instance The following example shows a new global instance being created using the WebAssembly.Global() constructor. It is being defined as a mutable i32 type, with a value of 0. The value of the global is then changed, first to 42 using the Global.value property, and then to 43 using the incGlobal() function exported out of the global.wasm
module (this adds 1 to whatever value is given to it and then returns the new value). const output = document.getElementById('output'); function assertEq(msg, got, expected) { output.innerHTML += `Testing ${msg}: `; if (got !== expected) output.innerHTML += `FAIL!<br>Got: ${got}<br>Expected: ${expected}<br>`; else output.innerHTML += `SUCCESS! Got: ${got}<br>`; } assertEq(...
WebAssembly.Global - JavaScript
This allows dynamic linking of multiple
modules. Constructor WebAssembly.Global() Creates a new Global object. Global instances All Global instances inherit from the Global() constructor's prototype object -- this can be modified to affect all Global instances. Instance properties Global.prototype.constructor Returns the function that created this object's instance. By default this is the WebAssembly.Global() constructor. ...
...the global variable. Examples Creating a new Global instance The following example shows a new global instance being created using the WebAssembly.Global() constructor. It is being defined as a mutable i32 type, with a value of 0. The value of the global is then changed, first to 42 using the Global.value property, and then to 43 using the incGlobal() function exported out of the global.wasm
module (this adds 1 to whatever value is given to it and then returns the new value). const output = document.getElementById('output'); function assertEq(msg, got, expected) { output.innerHTML += `Testing ${msg}: `; if (got !== expected) output.innerHTML += `FAIL!<br>Got: ${got}<br>Expected: ${expected}<br>`; else output.innerHTML += `SUCCESS! Got: ${got}<br>`; } assertEq(...
WebAssembly.Table.prototype.set() - JavaScript
gth is two, and the indexes currently contain no function references (they currently return null). ...
...l.length); console.log(tbl.get(0)); console.log(tbl.get(1)); We then create an import object that contains a reference to the table: var importObj = { js: { tbl:tbl } }; Finally, we load and instantiate a wasm
module (table2.wasm) using the WebAssembly.instantiateStreaming(), log the table length, and invoke the two referenced functions that are now stored in the table (the table2.wasm
module (see text representation) adds two function references to the table, both of which print out a simple value): WebAssembly.instantiateStreaming(fetch('table2.wasm'), importObject) .then(function(obj) { console.log(tbl.length); console.log(tbl.get(0)()); console.log(tbl.get(1)()); }); Note how you've got to include a second function invocation operator at the end of the accessor to actually...
WebAssembly.validate() - JavaScript
The WebAssembly.validate() function validates a given typed array of WebAssembly binary code, returning whether the bytes form a valid wasm
module (true) or not (false). Syntax WebAssembly.validate(bufferSource); Parameters bufferSource A typed array or ArrayBuffer containing WebAssembly binary code to be validated. Return value A boolean that specifies whether bufferSource is valid wasm code (true) or not (false). Exceptions If bufferSource is not a typed array or ArrayBuffer, a TypeError is thrown. Examples Using validate The following example (see the validate.html source code, and see it live too) fetches a .wasm
module and converts it into a typed array. The validate() method is then used to check whether the
module is valid. fetch('simple.wasm').then(response => response...
... Browser compatibility The compatibility table on this page is generated from structured data. ...
Web Performance
oaded later or link target a user tries to follow. Beginner's tutorials The MDN Web Performance Learning Area contains modern, up-to-date tutorials covering Performance essentials. Start here if you are a newcomer to performance: Web performance: brief overview Overview of the web performance learning path. Start your journey here. What is web performance? This article starts the
module off with a good look at what performance actually is -- this includes the tools, metrics, APIs, networks, and groups of people we need to consider when thinking about performance, and how we can make performance part of our web development workflow. How do users perceive performance? More important than how fast your website is in milliseconds, is how fast your users perceive your site to be.
...ose assets are actually needed. Lazy-loading JavaScript with dynamic imports When developers hear the term "lazy loading", they immediately think of below-the-fold imagery that loads when it scrolls into the viewport. But did you know you can lazy load JavaScript as well? In this guide we'll talk about the dynamic import() statement, which is a feature in modern browsers that loads a JavaScript
module on demand. Of course, since this feature isn't available everywhere, we'll also show you how you can configure your tooling to use this feature in a widely compatible fashion. Controlling resource delivery with resource hints Browsers often know better than we do when it comes to resource prioritization and delivery however they're far from clairyovant. Native browser features enable us to hint...
font-stretch - SVG: Scalable Vector Graphics
Candidate Recommendation Initial definition of font-stretch in CSS Fonts Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'font-stretch' in tha...
... semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | <percentage> Default value normal Animatable Yes Specifications Specification Status Comment CSS Fonts
Module Level 4The definition of 'font-stretch' in that specification. Working Draft Adds the <percentage> syntax for variable fonts. CSS Fonts
Module Level 3The definition of 'font-stretch' in that specification. Candidate Recommendation Initial definition of font-stretch in CSS Fonts Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'font-stretch' in that specification. Recommendation Initial definition ...
kernelUnitLength - SVG: Scalable Vector Graphics
ge offscreen bitmap, which is a pixel-based coordinate system, and thus potentially not scalable. If a negative or zero value is specified the default value will be used instead. ...
... Value <number-optional-number> Default value Pixel in offscreen bitmap Animatable Yes Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'kernelUnitLength for <feSpecularLighting>' in that specification. Working Draft Marked the attribute as deprecated. Filter Effects
Module Level 1The definition of 'kernelUnitLength for <feDiffuseLighting>' in that specification. Working Draft Marked the attribute as deprecated. Filter Effects
Module Level 1The definition of 'kernelUnitLength for <feConvolveMatrix>' in that specification. Working Draft Marked the attribute as deprecated. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition ...
Content type - SVG: Scalable Vector Graphics
RGB color space. <color> applies to SVG's use of the color attribute and is a component of the definitions of attributes fill, stroke, stop-color, flood-color, and lighting-color, which also offer optional ICC-based color specifications. SVG supports all of the syntax alternatives for <color> defined in CSS2 syntax and basic data types, and (depend on the implementation) in the future CSS Color
Module Level 3. A <color> is either a keyword or a numerical RGB specification. In addition to these color keywords, users may specify keywords that correspond to the colors used by objects in the user's environment. The normative definition of these keywords is found in User preferences for colors (CSS2, section 18.2). The format of an RGB value in hexadecimal notation is a "#" immediately follow...
...f the color, which can be related to international standards. color ::= "#" hexdigit hexdigit hexdigit (hexdigit hexdigit hexdigit)? | "rgb("integer, integer, integer")" | "rgb("integer "%", integer "%", integer "%)" | color-keyword hexdigit ::= [0-9A-Fa-f] where color-keyword matches (case insensitively) one of the color keywords listed in CSS Color
Module Level 3, or one of the system color keywords listed in User preferences for colors (CSS2, section 18.2). The corresponding SVG DOM interface definitions for <color> are defined the one defined by CSS. SVG's extension to color, including the ability to specify ICC-based colors, are represented using DOM interface SVGColor. Coordinate <coordinate> A <coordinate> is a length in the user ...
2015 MDN Fellowship Program - Archive of obsolete content
ol new features in 2015 with the standardization efforts around the WebGL 2.0 spec being published. Activities and Deliverables Help us develop a curriculum on MDN for teaching developers new to graphics programming the WebGL APIs. Required skills and experience Computer graphics experience with programmable shaders and the OpenGL, OpenGL ES, WebGL, or Direct3D APIs. Command of JavaScript and
module systems preferred. Mentor information Nick Desaulniers, Sleeps at Desk. GitHub: nickdesaulniers Twitter: @LostOracle Web App Performance Brief Project Description Web performance is a feature that needs to be considered from serving content to rendering to interactivity. Finding and addressing performance bottlenecks depends on tooling the browser networking and rendering but also, ofte...
Communicating With Other Scripts - Archive of obsolete content
This page is now obsolete, and its content has been incorporated into the main page on content scripts. This section of the guide explains how content scripts can communicate with: your main.js file, or any other
modules in your add-on other content scripts loaded by your add-on page scripts (that is, scripts embedded in the web page or included using <script> tags) main.js Your content scripts can communicate with your add-on's "main.js" (or any other
modules you're written for your add-on) by sending it messages, using either the port.emit() API or the postMessage() API. See the articles on using postMessage() and using port for details. Content Scripts Content scripts loaded into the same document at the same time using the same method can interact with each other directly as we...
Loading Content Scripts - Archive of obsolete content
f as a string literal. This version of the API avoids the need to maintain a separate file for the content script. The contentScriptFile option enables you to pass in the local file URL from which the content script will be loaded. To supply the file "my-content-script.js", located in the /data subdirectory under your add-on's root directory, use a line like: // "data" is supplied by the "self"
module var data = require("sdk/self").data; ... contentScriptFile: data.url("my-content-script.js") Both contentScript and contentScriptFile accept an array of strings, so you can load multiple scripts, which can also interact directly with each other in the content process: // "data" is supplied by the "self"
module var data = require("sdk/self").data; ... contentScriptFile: [data.url("jquery-1.
Reddit Example - Archive of obsolete content
.url("panel.js")] }); reddit_panel.port.on("click", function(url) { require("sdk/tabs").open(url); }); This code supplies two content scripts to the panel's constructor in the contentScriptFile option: the jQuery library and the script that intercepts link clicks. Finally, it registers a listener to the user-defined click event which in turn passes the URL into the open function of the tabs
module. This is the panel.js content script that intercepts link clicks: $(window).click(function (event) { var t = event.target; // Don't intercept the click if it isn't on a link. if (t.nodeName != "A") return; // Don't intercept the click if it was on one of the links in the header // or next/previous footer, since those links should load in the panel itself. if ($(t).parents('#he...
port - Archive of obsolete content
he port object, which is used to communicate between a content script and the main add-on code. The port object provides message sending and receiving API enabling conversations between a content script and the main add-on code. Each end of the conversation has access to a port: the content script via the global self property, and the main add-on code via a worker object associated with the SDK
module you've used to attach the content script, such as page-mod or page-worker. For an overview of content scripts, see the main article. port Methods emit() The port.emit() function sends a message from one side to the other. It may be called with any number of parameters, but is most likely to be called with a name for the message and an optional payload. The payload can be any value that is s...
Classes and Inheritance - Archive of obsolete content
sses in the Add-on SDK We have shown how to emulate classical inheritance in JavaScript using constructors and prototypes. However, as we have seen, this takes a significant amount of boilerplate code. The Add-on SDK team consists of highly trained professionals, but they are also lazy: that is why the SDK contains a helper function that handles this boilerplate code for us. It is defined in the
module "core/heritage": const { Class } = require('sdk/core/heritage'); The function Class is a meta-constructor: it creates constructors that behave properly with respect to inheritance. It takes a single argument, which is an object which properties will be defined on the prototype of the resulting constructor. The semantics of Class are based on what we've learned earlier. For instance, to define ...
Private Properties - Archive of obsolete content
the interface between JavaScript and C++ code. Since XPCOM allows the user to do virtually anything, security is very important. Among other things, add-ons should not be able to access variables that are supposed to be private. The SDK uses namespaces internally to ensure this. As always with code that is heavily reused, the SDK defines a helper function to create namespaces. It's defined in the
module "core/namespace", and it's use is straightforward. To illustrate this, the following reimplements the class Point using namespaces: const { ns } = require("sdk/core/namespace"); var internal = ns(); function Point(x, y) { internal(this).x = x; internal(this).y = y; } Point.prototype.getX = function () { return internal(this).x; }; Point.prototype.setX = function (x) { interna...
Contributor's Guide - Archive of obsolete content
ss was supposed to run all the code associated with a single add-on. Neither content or add-on proceses were ever actually implemented, but by the time they were cancelled, the SDK was already designed with them in mind. To understand this article, it's probably best to read it as if content and add-on processes actually exist. Getting Started Learn how to contribute to the Add-on SDK.
Modules A
module is a self-contained unit of code, which is usually stored in a file, and has a well defined interface. The use of
modules greatly improves the maintainability of code, by splitting it up into independent components, and enforcing logical boundaries between them. Unfortunately, JavaScript does not yet have native support for
modules: it has to rely on the host application to provide it ...
Program ID - Archive of obsolete content
The Program ID is a unique identifier for your add-on. When you package your add-on for distribution using jpm xpi, it will become the ID field in the add-on's Install Manifest. The ID is used for a variety of purposes. For example: addons.mozilla.org uses it to distinguish between new add-ons and updates to existing add-ons, and the simple-storage
module uses it to figure out which stored data belongs to which add-on. When you create an XPI with jpm xpi: if the package.json does not include an id field, then the ID written into the install.rdf is the value of the name field prepended with "@". if the package.json does include an id field, and it contains "@", then this is written into the install.rdf as the add-on ID. if the package.json does include an id field, and it does not contain...
SDK and XUL Comparison - Archive of obsolete content
ffer a great deal of options for building a UI and integrating it into the browser. Using only the SDK's supported APIs you have much more limited options for your UI. XPCOM Traditional add-ons have access to a vast amount of Firefox functionality via XPCOM. The SDK's supported APIs expose a relatively small set of this functionality. Low-level APIs and Third-party
Modules That's not the whole story. If you need more flexibility than the SDK's High-Level APIs provide, you can use its Low-level APIs to load XPCOM objects directly or to manipulate the DOM directly as in a traditional bootstrapped extension. Alternatively, you can load third-party
modules, which extend the SDK's core APIs. Note that by doing this you lose some of the benefits of programming with t...
addon-page - Archive of obsolete content
Create a page that does not contain navigational elements. Usage With the Add-on SDK you can present information to the user, such as a guide to using your add-on, in a browser tab. You can supply the content in an HTML file in your add-on's "data" directory. Note: This
module has no effect on Fennec. For pages like this, navigational elements such as the Awesome Bar, Search Bar, or Bookmarks Toolbar are not usually relevant and distract from the content you are presenting. The addon-page
module provides a simple way to have a page which excludes these elements. To use the
module import it using require(). After this, the page loaded from "data/index.html" will not contain navigational elements: var addontab = require("sdk/addon-page"); var data = require("sdk/self").data; require("sdk...
l10n - Archive of obsolete content
Note that you can't currently use localize strings appearing in content scripts or HTML files, but you can share the localized strings you want by assigning it's values to a JSON serializable object. Globals Functions get(identifier, count, placeholder1...n) This function takes a string parameter which it uses as an identifier to look up and return a localized string in the locale currently set for Firefox. Localized strings are supplied by the add-on developer in .properties files stored in the add-ons "locale" directory. ...
request - Archive of obsolete content
Globals Constructors Request(options) This constructor creates a request object that can be used to make network requests. The constructor takes a single parameter options which is used to set several properties on the resulting Request. ...
simple-prefs - Archive of obsolete content
can also see them and change them programmatically using the prefs property, and listen for changes to a preference using on(). Simple-prefs in the preferences system Preferences defined using simple-prefs are stored in the Firefox preferences system alongside all the other preferences. This means that they're visible in about:config, and they can be accessed using the global simple-preferences
module. By default, simple preferences are stored in a preference like: extensions.<addon-id>.<preference-name> For example, if you had a simple-pref named "somePreference" then you could get its value like so: require('sdk/preferences/service').get(['extensions', require('sdk/self').id, 'somePreference'].join('.')) This would give you the same value as: require('sdk/simple-prefs').prefs['somePrefe...
system - Archive of obsolete content
Query the add-on's environment and access arguments passed to it. Usage Querying Your Environment Using the system
module you can access environment variables (such as PATH), find out which operating system your add-on is running on and get information about the host application (for example, Firefox or Fennec), such as its version. var system = require("sdk/system"); // PATH environment variable console.log(system.env.PATH); // operating system console.log("platform = " + system.platform); // processor architecture console.log("architecture = " + system.architecture); // compiler used to build host application console.log("compiler = " + system.compiler); // host application build identifier console.log("build = " + system.build); // host application UUID console.log("id = " + system.id)...
High-Level APIs - Archive of obsolete content
Unless the documentation explicitly says otherwise, all these
modules are "Stable": we'll avoid making incompatible changes to them. addon-page Create a page that does not contain navigational elements. base64 Data encoding and decoding using Base64 algorithms. clipboard Interact with the system clipboard, setting and getting its contents. context-menu Adds items, submenus, and menu separators to the page's context menu. hotkeys Assign hotkey combinations to functions in your add-on. indexed-db Exposes the IndexedDB API to add-ons. l10n Localize strings appearing in the add-on's JavaScript code. ...
chrome - Archive of obsolete content
You should avoid using the API if at all possible. We intend to deprecate it in future releases. If you use this API you can expect your add-on to get an extra security review by addons.mozilla.org. This
module should not be confused with the "chrome" global variable that WebExtensions can use to access APIs. The chrome
module gives an Add-on SDK add-on access to the Components object, which in turn gives it access to a large set of privileged low-level Firefox APIs. chrome is a built-in pseudo
module of the toolkit loader. See the chrome authority tutorial for more details. You can see an example of using this API in the XUL Migration Guide. ...
console/plain-text - Archive of obsolete content
nsole object to be used for traditional logging purposes. It's implemented using Console.jsm, and is prefixed with the addon's name, and log levels set based off of startup instruction. An instance of the console is injected globally into addon's contexts. Globals Constructors PlainTextConsole(print) Creates a console instance. All of its methods are inherited from Console.jsm (resource://gre/
modules/devtools/Console.jsm). Parameters print : Function An optional function to process the arguments passed in before printing to stdout. ...
content/content - Archive of obsolete content
Deprecated in Firefox 32. Re-exports three objects from three other
modules: Loader, Worker, and Symbiont. These objects are used in the internal implementations of SDK
modules which use content scripts to interact with web content, such as the panel or page-mod
modules. ...
content/worker - Archive of obsolete content
It exports the Worker trait, which enables content scripts and the add-on code to exchange messages using the port or postMessage APIs. The Worker is similar to the web worker interface defined by the W3C. But unlike "web workers," these workers run in the same process as web content and browser chrome, so code within workers can block the UI. Globals Constructors Worker(options) Creates a content worker. Parameters options : object Required options: Name Type window object The content window to create JavaScript sandbox for communication with. ...
event/core - Archive of obsolete content
Also see the tutorial on implementing event targets to get started with this API. An event listener may be registered to any event target using the on function: var { on, once, off, emit } = require('sdk/event/core'); var target = { name: 'target' }; on(target, 'message', function listener(event) { console.log('hello ' + event); }); on(target, 'data', console.log); An event of a specific type may be emitted on any event target object using the emit function. ...
frame/utils - Archive of obsolete content
Experimental Provides helper functions for working with platform internals like frames and browsers. Usage
Module exports create function that takes the nsIDOMDocument of a privileged document and creates a browser element in its documentElement: let { open } = require('sdk/window/utils'); let { create } = require('sdk/frame/utils'); let window = open('data:text/html,Foo'); let frame = create(window.document); Optionally create can be passed set of options to configure created frame even further. Execution of scripts may easily be enabled: let { open } = require('sdk/window/utils'); let { create } = require('sdk/frame/utils'); let window = open('data:text/html,top'); let frame = create(window.document, { uri: 'data:text/html,<script>console.log("running");</script>', allowJavascrip...
fs/path - Archive of obsolete content
Experimental Provides access to the local filesystem with the NodeJS path
module API. Usage This
module attempts to implement the NodeJS path
module API. Please refer the NodeJS path
module API documentation for this
module. ...
io/file - Archive of obsolete content
te that if you do decide to hardcode Windows-style paths, be sure to escape backslashes in strings. For example, to specify the file at C:\Users\Myk, you need to use the string "C:\\Users\\Myk", not "C:\Users\Myk". Read more about escaping characters in strings. Globals Functions basename(path) The path parameter must be an absolute path, relative paths will cause an error. Use the fs/path
module for relative path support. Returns the last component of the given path. For example, basename("/foo/bar/baz") returns "baz". If the path has no components, the empty string is returned. Parameters path : string The path of a file. Returns string : The last component of the given path. dirname(path) Returns the path of the directory containing the given file. If the file is at the top of...
lang/functional - Archive of obsolete content
Some of these functions implement APIs from Jeremy Ashkenas's underscore.js and all credits go to him and his contributors. Globals Functions method(lambda) Takes a function and returns a method associated with an object. When the method is invoked on an instance of the object, the original function is called. It is passed the object instance (i.e. this) as the first parameter, followed by any parameters passed into the method. ...
lang/type - Archive of obsolete content
turns boolean : Boolean indicating if value is an Array/flat Object containing only atomic values and other flat objects. instanceOf(value, Type) Returns true if value is an instance of a given Type. This is similar to the instanceof operator. The difference is that the Type constructor can be from a scope that has a different top level object: for example, it could be from a different iframe,
module or sandbox. let { instanceOf } = require('sdk/lang/type'); instanceOf(new Class(), Class); // true function Class() {} Parameters value : object The variable to check. Type : object The constructor to compare to value Returns boolean : Boolean indicating if value is an instance of Type. source(value, indent, limit) Returns the textual representation of value, containing property descri...
preferences/event-target - Archive of obsolete content
Listen to changes to the Preferences system in Firefox. This enables add-ons to listen to change events to the system-wide settings. These are the same preferences that are exposed to users in the about:config page. preferences/service gives you full access to the preferences system. You can also use the simple-prefs
module to access just the preferences for your own add-on and expose them to the user in the Add-on Manager. Globals Constructor PrefsTarget(options) Parameters options : object Required options: Name Type branchName string By default this is "", the root. Example var { PrefsTarget } = require("sdk/preferences/event-target"); // listen to the same branch which reqire("sdk/simple-prefs") does var target = PrefsTarget...
remote/child - Archive of obsolete content
Enables an SDK
module loaded into a child process to access web content in the child process and communicate with
modules in the main process. Usage The sdk/remote/parent
module enables SDK code to load
modules into child processes. The sdk/remote/child
module is for these "child process
modules". It provides two main things: access to web content loaded into this child process port mechanisms to communicate with the main process Interacting with web content To interact with web content, the sdk/remote/child
module provides a frames property that's a list of all content frames loaded into this child process. Each frame then has a content property that's the top-level DOM window for the frame, and addEventListener/removeEventListener functions that enable you to listen to DOM events ...
stylesheet/style - Archive of obsolete content
uctors Style(options) The Style constructor creates an object that represents style modifications via stylesheet file(s) or/and CSS rules. Stylesheet file URL(s) are verified to be local to an add-on, while CSS rules are verified to be a string or array of strings. The style created can be applied to a content by calling attach, and removed using detach. Those functions are part of content/mod
module. Parameters options : object Required options: Name Type uri string,array A string, or an array of strings, that represents local URI to stylesheet. source string,array A string, or an array of strings, that contains CSS rules. Those rules are applied after the rules in the stylesheet specified with uri options, if provided. ...
system/events - Archive of obsolete content
You can find a list of events dispatched by the Firefox codebase here. var events = require("sdk/system/events"); var { Ci } = require("chrome"); function listener(event) { var channel = event.subject.QueryInterface(Ci.nsIHttpChannel); channel.setRequestHeader("User-Agent", "MyBrowser/1.0", false); } events.on("http-on-modify-request", listener); Globals Functions emit(type, event) Send an event to observer service Parameters type : string The event type. ...
tabs/utils - Archive of obsolete content
window. If you omit window, this function will return tabs across all the browser's windows. However, if your add-on has not opted into private browsing, then the function will exclude all tabs that are hosted by private browser windows. To learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing
module. Parameters window : nsIWindow Optional. Returns Array : An array of tab elements. getActiveTab(window) Given a browser window, get the active, or selected, tab. Parameters window : window A browser window. Returns tab : The currently selected tab. getOwnerWindow(tab) Get the browser window that owns the specified tab. Parameters tab : tab A browser tab. Returns window : A brow...
test/assert - Archive of obsolete content
Each test will be passed an Assert object when you run the tests using jpm test. You can use this object to make assertions about your program's state. For example: var a = 1; exports["test value of a"] = function(assert) { assert.ok(a == 1, "test that a is 1"); } require("sdk/test").run(exports); Globals Constructors Assert(logger) Create a new Assert object. This function is only called by the unit test framework, and not by unit tests themselves. ...
test/httpd - Archive of obsolete content
An HTTP server for the Mozilla platform, which can be used in unit tests. Usage The most basic usage is: var { startServerAsync } = require("sdk/test/httpd"); var srv = startServerAsync(port, basePath); require("sdk/system/unload").when(function cleanup() { srv.stop(function() { // you should continue execution from this point. }) }); This starts a server in background (assuming you're running this code in an application that has an event loop, such as Firefox). The server listens at http://localhost:port/ and serves files from the specified directory. You can serve static content or use SJS scripts, as described in documentation on developer.mozilla.org. ...
test/runner - Archive of obsolete content
Experimental Sets up unit tests. This
module contains the package's main program, which does a bit of high-level setup and then delegates test finding and running to the harness
module. For more information on testing in the Add-on SDK, see the Unit Testing tutorial. ...
ui/button/action - Archive of obsolete content
Experimental Add a button to the Firefox user interface. With this
module you can create buttons that display icons and can respond to click events. Usage Creating buttons To create a button you must give it an ID, an icon, and a label: var { ActionButton } = require("sdk/ui/button/action"); var button = ActionButton({ id: "my-button", label: "my button", icon: { "16": "./firefox-16.png", "32": "./firefox-32.png" }, onClick: function(state) { console.log("button '" + state.label + "' was clicked"); } }); By default, the button appears in the Firefox toolbar: However, users can move it to the Firefox menu panel using the toolbar customization feature: Badged buttons New in Firefox 36. You can add a "badge" to a button using its badge...
ui/button/toggle - Archive of obsolete content
Toggle buttons have all the same features as action buttons: they can display icons and respond to click events. Like action buttons, you can control their state on a per-window or per-tab basis as well as globally. Toggle buttons have two extra features: they emit a change event when clicked, as well as a click event. they have an extra attribute checked that is automatically toggled when the button is clicked. ...
ui/frame - Archive of obsolete content
Right now it can be used in conjunction with a Toolbar: you create a Frame, then supply it to the Toolbar's constructor, and the content is then displayed inside the toolbar. ...
ui/sidebar - Archive of obsolete content
den. Once you've finished using the sidebar you can destroy it by calling its dispose() method. To show what a sidebar looks like, here's a sidebar that displays the results of running the W3C Validator on the current page: Specifying sidebar content The content of a sidebar is specified using HTML, which is loaded from the URL supplied in the url option to the sidebar's constructor. Unlike
modules such as panel, the content must be local, typically loaded from the add-on's data directory via a URL constructed using self.data.url(): var sidebar = require("sdk/ui/sidebar").Sidebar({ id: 'my-sidebar', title: 'My sidebar', url: require("sdk/self").data.url("sidebar.html") }); From Firefox 34, you can use "./sidebar.html" as an alias for self.data.url("sidebar.html"). So you can rewri...
window/utils - Archive of obsolete content
Functions for working with browser windows. Usage Private windows With this
module your add-on will see private browser windows even if it has not explicitly opted into private browsing, so you need to take care not to store any user data derived from private browser windows. The exception is the windows() function which returns an array of currently opened windows. Private windows will not be included in this list if your add-on has not opted into private browsing. To learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing
module. Globals Functions getMostRecentBrowserWindow() Get the topmost browser window, as an nsIDOMWindow instance. Returns nsIDOMWindow: the topmost browser...
Release notes - Archive of obsolete content
() and debounce() functions added to lang/functional. getTabForId() function added to tabs/utils. Details GitHub commits made between Firefox 29 and Firefox 30. This will not include any uplifts made after this release entered Aurora. Bugs fixed between Firefox 29 and Firefox 30. This will not include any uplifts made after this release entered Aurora. Firefox 29 Highlights Added new UI
modules for Australis: ActionButton, ToggleButton, Frame and Toolbar. Made the preferences branch for simple-prefs configurable. Added PredicateContext to sdk/context-menu. Deprecated widget in favor of the new UI
modules. Removed tab-browser, app-strings and api-utils.publicConstructor Details GitHub commits made between Firefox 28 and Firefox 29. This will not include any uplifts made after thi...
jpm-mobile - Archive of obsolete content
jpm-mobile run -b fennec You can get the package name by following command. $ adb shell pm list packages | grep org.mozilla package:org.mozilla.firefox $ jpm-mobile run -b firefox # the package name is firefox -v --verbose Verbose operation. jpm-mobile test jpm-mobile test See the tutorial on unit testing and the reference documentation for the assert
module for more details on this. jpm-mobile test accepts the following options: --adb /path/to/adb Provides the path to adb. -b --binary BINARY Use the package name of Firefox specified in BINARY. jpm-mobile test -b fennec You can get the package name by following command. $ adb shell pm list packages | grep org.mozilla package:org.mozilla.firefox $ jpm-mobi...
Add a Menu Item to Firefox - Archive of obsolete content
The SDK doesn't provide a built-in API to add new menu items to Firefox. But it's extensible by design, so anyone can build and publish
modules for add-on developers to use. To see how to use third-party
modules to add a new menu item, see the tutorial on using third-party
modules with jpm. ...
Implementing the widget - Archive of obsolete content
In particular, for a simple button, try the action button or toggle button APIs, and for a more complex widget try the toolbar or sidebar APIs. We want the widget to do two things: On a left-click, the widget should activate or deactivate the annotator. ...
Annotator - Archive of obsolete content
In particular, for a simple button, try the action button or toggle button APIs, and for a more complex widget try the toolbar or sidebar APIs. In this tutorial we'll build an add-on that uses many of the SDK's high-level APIs. ...
Listen for Page Load - Archive of obsolete content
The following add-on listens to the tab's built-in ready event and just logs the URL of each tab as the user loads it: require("sdk/tabs").on("ready", logURL); function logURL(tab) { console.log(tab.url); } You will find this console output in the Browser Console, not the Web Console. You don't get direct access to any content hosted in the tab. To access tab content you need to attach a script to the tab using tab.attach(). This add-on attaches a script to all open tabs. ...
Listening for Load and Unload - Archive of obsolete content
reason or arguments. exports.main() Your add-on's main.js code is executed as soon as it is loaded. It is loaded when it is installed, when it is enabled, or when Firefox starts. If your add-on exports a function called main(), that function will be called immediately after the overall main.js is evaluated, and after all top-level require() statements have run (so generally after all dependent
modules have been loaded). exports.main = function (options, callbacks) {}; options is an object describing the parameters with which your add-on was loaded. options.loadReason options.loadReason is one of the following strings describing the reason your add-on was loaded: install enable startup upgrade downgrade exports.onUnload() If your add-on exports a function called onUnload(), that fu...
Open a Web Page - Archive of obsolete content
To do this, pass a callback function into open(). The callback is assigned to the onReady property, and will be passed the tab as an argument: var tabs = require("sdk/tabs"); tabs.open({ url: "http://www.example.com", onReady: function onReady(tab) { console.log(tab.title); } }); Even then, you don't get direct access to any content hosted in the tab. ...
JavaScript Debugger Service - Archive of obsolete content
r.FLAG_ENABLED | jsdIFilter.FLAG_PASS) : jsdIFilter.FLAG_ENABLED, urlPattern: pattern, startLine: 0, endLine: 0 }; return filter; }, We then add the filters we want. jsd.clearFilters(); // clear the list of filters // we exclude the scripts with the following filenames from being tracked jsd.appendFilter(createFilter("*/firefox/components/*")); jsd.appendFilter(createFilter("*/firefox/
modules/*")); jsd.appendFilter(createFilter("XStringBundle")); jsd.appendFilter(createFilter("chrome://*")); jsd.appendFilter(createFilter("x-jsd:ppbuffer*")); jsd.appendFilter(createFilter("XPCSafeJSObjectWrapper.cpp")); jsd.appendFilter(createFilter("file://*")); Note that appendFilter adds the filter to the end of the list. You can use insertFilter (jsdIFilter filter, jsdIFilter after) to insert th...
JavaScript timers - Archive of obsolete content
SON etc), there are a variety of functions available from the DOM to workers. This article provides a list of those. Basic animations Since we're using script to control canvas elements it's also very easy to make (interactive) animations. Unfortunately the canvas element was never designed to be used in this way (unlike Flash) so there are limitations. Timer.jsm The Timer.jsm JavaScript code
module contains pure-JavaScript implementations of setTimeout and clearTimeout that are compatible with the DOM window functions, but that can be used by code that does not have access to a DOM window (for example, JavaScript code
modules or content frame scripts). ...
Downloading JSON and JavaScript in extensions - Archive of obsolete content
d not using eval() at all. JSON is about state and does not allow functions to be decoded. The JSON decoding methods available to extension developers protect the extension from malicious JSON and JavaScript. Downloading state from a remote webserver using JSON is becoming extremely popular. Use the JSON decoders, not eval()! Downloading JavaScript Of course there are times when JavaScript code
modules are downloaded and injected into the extension. This usually happens because the extension is trying to keep some of its code fresh and dynamic, and the developers don't want to create a new version of the extension for each script change. In this case, JavaScript sandboxing should be used to isolate the downloaded JavaScript from the rest of the extension, and host application. Sandboxing is d...
Extension Etiquette - Archive of obsolete content
examples of namespaces in which conflicts can occur, there are many others. In general, care must be taken whenever defining a name anywhere that other code might do likewise. Strategies to avoid such conflicts include: Avoid shared namespaces where possible Many naming conflicts are best avoided by simply not sharing namespaces. Scripts can be loaded into their own globals, such as CommonJS
modules, JavaScript
modules, or Sandboxes, to avoid most global variable and prototype conflicts. Expando properties are best avoided using tools such as WeakMaps. Prefix names in shared namespaces When shared namespaces can't be avoided, the simplest solution to prevent conflicts is to use a distinct prefix for all of your names. Class names for HTML elements created by the Cool Beans extension, fo...
Inline options - Archive of obsolete content
ubject; var control = doc.getElementById("myaddon-pref-control"); control.value = "test"; } } }; Services.obs.addObserver(observer, "addon-options-displayed", false); // Don't forget to remove your observer when your add-on is shut down. This code should be in bootstrap.js (within the startup() function) for restartless extensions or in an XPCOM component or a JavaScript code
module (not an overlay!) for traditional extensions. Note: Starting in Gecko 13.0, you can also listen for the addon-options-hidden notification, which has the same subject and data as above, to find out when the UI is about to be removed. Use this notification to remove event listeners, or any other references that might otherwise be leaked. Locating the options file There are two ways to let the ...
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
1.9.1." For the current development trunk of Firefox, choose "Mozilla Central" and for Thunderbird, choose "Comm. Central". Calling XPCOM from XPConnect Use the XPConnect technology to use XPCOM in JavaScript. Listing 1 shows how you can use XPConnect to acquire references to XPCOM services and create new XPCOM objects. Each component is identified with a contract ID in the form @domain_name/
module_name/component_name;version_number, and implements one or more interfaces that determine what functions can be called on these components. Interfaces names usually have the forms nsIxxx. In order to have access to the corresponding functions, it is necessary to use the component with the interface you want to use. Some XPCOM components are services, that means only one instance in memory. For ins...
Appendix A: Add-on Performance - Archive of obsolete content
al add-ons will do. Luckily, minimizing your startup time is easy, if you follow these guidelines: Do not load or run code before it's needed. Add-ons can have extra features that are only available depending on user preferences. Other add-ons have most of their features depend on a user being logged in to a service. Don't load at startup something you won't need at the time. JavaScript Code
Modules. Use them. JSM provide the cleanest way to separate JS into
modules that can be loaded on request, unlike chrome scripts which are generally loaded with the overlay at startup. Keep as much of your code in JSM, make it as modular as you can, and only load
modules as you require them. If your add-on is too simple for JSM, don't worry about it. There's still one more thing you can do. Do as littl...
Intercepting Page Loads - Archive of obsolete content
before the user sees anything in the tab. HTTP Observers Another common way of detecting and intercepting loads is using HTTP observer topics. This is how the Tamper Data extension and others do it. HTTP notifications are fired for all HTTP requests originating from Firefox. They are window-independent, so it is better to keep your observer code in non-chrome objects (your XPCOM service or jsm
module). Otherwise you have to make sure to avoid duplicated work if you have 2 or more windows open. There are 2 HTTP topics you can listen to, as specified in the Observer Notifications page: Topic Description http-on-modify-request Called as an http request is made. The channel is available to allow you to modify headers and such. http-on-examine-response Called ...
Local Storage - Archive of obsolete content
sion that is more complex than a Hello World needs some way to log errors and trace execution without having to fire up a debugger. It used to be the case that custom logging solutions were necessary, but Mozilla Labs have come up with a JavaScript implementation of a logger similar to the Log4J logger used in Java projects. The logger is called Log4Moz and it is implemented as a JavaScript Code
Module, so it only works on Firefox 3 and above. To use this logger, you need to copy the log4moz.js file to your
modules directory. In the initialization method of your one of your "common" or startup objects, add the following code: let formatter = new Log4Moz.BasicFormatter(); let root = Log4Moz.repository.rootLogger; let logFile = this.getLocalDirectory(); // remember this? let appender; logFile.
Mozilla Documentation Roadmap - Archive of obsolete content
delines, accessibility, usability, best practices... The list goes on. It's incredibly comprehensive, and its underlying Wiki technology makes it easy to expand and evolve with the help of the community. Having said that, there are a few problems with it. First of all, the in-site search is not reliable, so we recommend using a search engine like Google, with queries such as "MDC Javascript Code
Modules" or "Javascript code
modules site:developer.mozilla.org". Secondly, there are several important articles that are very lacking in information, like the Preferences System page. And finally, what we mentioned in our XPCOM section: almost no documentation on XPCOM components. The documentation on interfaces is very complete, but it isn't nearly as useful as the documentation that existed at XULPla...
Observer Notifications - Archive of obsolete content
to those observers (can be null), the second parameter is the notification topic and the last parameter is an additional string to pass to those observers (can be null). observerService.notifyObservers(null, "xulschoolhello-test-topic", "hello"); Non-chrome to chrome communication Non-chrome to chrome communication is one of the main uses of observers. By non-chrome we mean JavaScript Code
Modules or XPCOM. As we saw in previous sections, you can use JavaScript Code
Module and XPCOM objects very easily from the chrome. But given that chrome is window-dependent and non-chrome objects are not, it's tricky to send a message to the chrome. You would have to invoke a method for the chrome objects in all windows. It's much easier to use observers in this case. Let's see the following example c...
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
ibes a stock ticker application based on the inner-browsing model. The stock ticker is a web page with a stock ticker element that displays updated stock symbol information. The web page receives updates to its contents but only redraws the stock ticker element information. The code includes the DHTML element. We've separated this sample in two main components following the model. The Data Loader
module and the Data Binder
module. The Data Loader
module is responsible for the requests and retrieves the stock data information from the web. It also sends an event to the Data Binder
module. The Data Binder
module is responsible for the binding of the data with the HTML interface. In addition to these components, you will also find the piece of code that is responsible for the DHTML ticker. Note tha...
List of Mozilla-Based Applications - Archive of obsolete content
AICPCU/IIA exam app exam delivery software Aliwal Geocoder geocoding & data on a map Amarok XUL remote remote control for AmaroK music player Ample SDK Javascript GUI-framework AOL Instant Messenger IM client Uses NSS Apache web server Doesn't use NSS by default, but can be configured to use NSS with mod_nss SSL
module ApicaWatch site performance monitoring tool Uses Firefox as part of its monitoring package Astyle CSS editor editing tool Atmail webmail client Aviva for Java mainframe connectivity product Uses Mozilla Rhino Babelgum Internet TV service Basilisk pre-Servo XUL-based web browser Uses most of the Firefox 55...
How Mozilla finds its configuration files - Archive of obsolete content
alues by using this template file prefs.js.tmpl N.B. Mozilla includes a profile manager, but unfortunately this always include a random part (salt) into the profile's filename, and thus cannot be used to point Mozilla to a profile of the our chosing. N.B. The above scripts have been tested with perl-5.8.0, XML-Parser-2.34, XML-SAX-0.13 and XML-Simple-2.14. Different versions of perl, or of these
modules may lead to bugs. If you have trouble gettings these scripts to work on your system, there is also an online version available. ...
Building TransforMiiX standalone - Archive of obsolete content
This document is out of date. We support building a standalone version of TransforMiiX on Windows, Unix and OS X. Read the build instructions for your platform to get the requirements, which are the same as for Mozilla. You need to get the source from CVS. Add TX_EXE=1 mk_add_options BUILD_
MODULES="xpcom transformiix" ac_add_options --enable-standalone-
modules="xpcom transformiix" to your .mozconfig, and use client.mk to pull as usual. This will pull the necessary subtree with mozilla/client.mk mozilla/build/unix/
modules.mk mozilla/build mozilla/config mozilla/expat mozilla/extensions/transformiix mozilla/include mozilla/allmakefiles.sh mozilla/client.mk mozilla/aclocal.m4 mozilla/configure mozilla/configure.in mozilla/Makefile.in plus nspr and xpcom from the cvs repository. Building fr...
Compiling The npruntime Sample Plugin in Visual Studio - Archive of obsolete content
nfigurations)|C++|Preprocessor|Preprocessor Definitions: WIN32;_WINDOWS;XP_WIN32;XP_WIN;_X86_;NPSIMPLE_EXPORTS Disable precompiled headers using Project Properties|(all configurations)|C++|Precompiled headers|Create/Use precompiled header. They may be already disabled. Define the function exports by adding the .def filename (e.g. nprt.def) to Project Properties|(all configurations)|Linker|Input|
Module Definition File. It could be either the full path or the path relative to the project directory. Optional: Open the above .def file and change "NPRT" to the filename of your dll as VS sees it (without "np", if you decided to rename later) Optional: Edit the .rc file and and the top of npp_gate.cpp for the description, mimetype, file extension etc. to reflect your plugin Remove the function NPP...
Creating a hybrid CD - Archive of obsolete content
'TEXT' "text file" INSTALL Ascii 'MOSS' 'TEXT' "text file" LICENSE Ascii 'MOSS' 'TEXT' "text file" .gif Raw 'ogle' 'GIFf' "GIF file" .png Raw 'ogle' 'PNG ' "PNG file" .jpg Raw 'ogle' 'JPEG' "JPEG file" .jpeg Raw 'ogle' 'JPEG' "JPEG file" .pl Ascii 'McPL' 'TEXT' "Perl file" .pm Ascii 'McPL' 'TEXT' "Perl
module file" .xml Ascii 'R*ch' 'TEXT' "XML file" .xul Ascii 'R*ch' 'TEXT' "XUL file" .xbl Ascii 'R*ch' 'TEXT' "XBL file" .css Ascii 'R*ch' 'TEXT' "CSS file" .dtd Ascii 'R*ch' 'TEXT' "DTD file" .js Ascii 'R*ch' 'TEXT' "JavaScript file" .mp3 Raw 'TVOD' 'MPG3' "MPEG file" .mpg Raw 'TVOD' 'MPEG' "MPEG file" .mpeg ...
Getting Started - Archive of obsolete content
one you use to browse the web, but if you mess it up, it is possible that you will be unable to access your browser without uninstalling and reinstalling Mozilla. For this reason we suggest that you install a second copy into a second directory (Make sure that you use a different profile as stated in the release notes) Extract the chrome The chrome is stored in \mozilla\chrome and the individual
modules are stored in Jar files. Jar files are zip files with a different extension. You can open them up in your zip program the same way you open up zip files. Mozilla currently comes with two skins, Classic and Modern. Looking in the directory you'll also notice that there are classic.jar and modern.jar files. For this tutorial we are going to use the Classic skin as a base. Extract classic.jar into ...
External CVS snapshots in mozilla-central - Archive of obsolete content
The following list of directories (incomplete) contain them. Those directories shall be considered read-only, changes shall be delivered to the upstream software projects. Eventually we'd like to have ACLs, but as of today there is no protection for accidental commits to those directories. Such changes will get overwritten without warning on importing the next updated version. NSPR nsprpub NSS dbm security/dbm security/coreconf security/nss Special procedures must be used to update these to newer snapshots of the upstream software projects. ...
Layout System Overview - Archive of obsolete content
where the display type is needed, the layout system must determine that display type by using the Style System. A content element is passed to the Style System and a request is made to resolve the style for that element. This causes the Style System to apply all style rules that correspond to the element and results in a resolved Style Context - the style data specific to that element. The Layout
module looks at the 'display' field of the style context to determine what kind of frame to create (block, inline, table, etc.). The style context is associated with the frame via a reference because it is needed for many other computations during the formatting of the frames. Once a frame is created for a content element, it must be formatted. We refer to this as 'laying out' the frame, or as 'reflowin...
Enabling Experimental Jetpack Features - Archive of obsolete content
Note: This page documents the Jetpack Prototype, which is no longer under active development. Read the experiment report for what we learned from it and the blog post announcing the first SDK release for what we're up to next! The proposed method for accessing Jetpack features that are still in development and may be added in the future is inspired by python's future
module. In Python, you can call from __future__ import foo which adds the functionality that foo yields to the script. In Jetpack, we propse adding a new function to the base namespace called importFromFuture. Methods import(stringMountPath string)Imports the requested experimental feature into the script. stringMountPathString that enumerates where, starting from the jetpack base, the feature will be mounted. To get a lis...
Enabling - Archive of obsolete content
In Python, you can call from __future__ import foo which adds the functionality that foo yields to the script. In Jetpack, we propse adding a new function to the base namespace called importFromFuture. Methods import(stringMountPath string)Imports the requested experimental feature into the script. stringMountPathString that enumerates where, starting from the jetpack base, the feature will be mounted. To get a list of mount paths that are available, see the method below. ...
Enabling Experimental Jetpack Features - Archive of obsolete content
In Python, you can call from __future__ import foo which adds the functionality that foo yields to the script. In Jetpack, we propse adding a new function to the base namespace called importFromFuture. Methods import(stringMountPath string)Imports the requested experimental feature into the script. stringMountPathString that enumerates where, starting from the jetpack base, the feature will be mounted. To get a list of mount paths that are available, see the method below. ...
Plugin Architecture - Archive of obsolete content
Classes There are some classes involved in plugins: nsObjectLoadingContent embed, object and applet nodes inherit from that class, which provides services for loading various kinds of objects. It takes care of most of the work involved in loading the data and instantiating plugins. nsObjectFrame The frame responsible for displaying plugins nsPluginInstanceOwner Glue between plugin code (
modules/plugin) and layout code (layout/generic). A refcounted object, contrary to nsObjectFrame. Note that while nsObjectLoadingContent also deals with images and documents, this document concentrates on plugins. Sequence of events In content A content node for a plugin DOM element gets created In BindToTree (usually) or another function, it calls LoadObject LoadObject either notices directly...
PyDOM - Archive of obsolete content
Introduction This is the documentation for the binding of Python and the Mozilla DOM. This allows you to use Python code (almost) anywhere you can use JavaScript. Globals and namespaces This is taken from a mail to the pyxpcom list - it should be expanded, but a copy-paste will do for now Normal
module semantics don't exist here. The globals are 'bound' to the global object (i.e., the window), instead of to a
module's __dict__ as you expect in the Python world. Note that we don't actually 'import' anything here - the scripts and event handlers do not exist in a Python
module. The intent is to provide similar semantics to JS. For example, when a top-level window has something like: <window ... script="foo = 1" ... An event handler like: <button onclick="print foo"/> Should be able to refe...
Safely loading URIs - Archive of obsolete content
Finally, some URIs (e.g. chrome: give the loaded page expanded privileges. If a web page gets access to a window with such expanded privileges, it may be able to abuse it to gain access to those privileges itself. To solve this problem, Gecko provides methods that allow the caller to check whether it's safe to load a particular URI. ...
Install Wizards (aka: Stub Installers) - Archive of obsolete content
by downloading the XPInstall engine along with the selected software packages. It then proceeds to extract the XPInstall engine and feed it the downloaded software packages to install.) The stub installer code includes: the logic to display the install wizard widgets and dialogs the code that reads in the configuration file (config.ini) and dynamically installs from the net or from local xpi
modules found next to the installer binary the code that processes user selections the code that calls the XPInstall engine through xpistub the libxpnet code that is statically linked in The stub installers are written in code native to the platform using native widget toolkits including the windows API for windows, the mac toolbox for the mac, and gtk for the unix version. To learn more about the t...
Namespaces - Archive of obsolete content
tes element and attribute names can occur when an XML document contains elements and attributes from two or more different XML schemas (or DTDs). To quote Wikipedia: "In general, a namespace is an abstract container providing context for the items ... it holds and allows disambiguation of items having the same name." If you are familiar with C++ namespaces, Java packages, perl packages, or Python
module importing, you are already familiar with the namespace concept. An XML namespace is identified by an unique name (called a URI, not a URL, even though it can look like a URL). An URI is any string, although most people choose a URL-based URI because URLs are an easy way to hope for uniqueness. Although there's nothing preventing someone else from using the namespace http://www.mozilla.org/keymast...
XPCOM Interfaces - Archive of obsolete content
all the components that are available in its own registry. A particular user can install new components as needed. It works much like plug-ins. Mozilla provides a file component, that is, a component that implements nsILocalFile. This component can be referred to using the string '@mozilla.org/file/local;1'. This string is called a contract ID. The syntax of a contract ID is: @<internetdomain>/
module[/sub
module[...]];<version>[?<name>=<value>[&<name>=<value>[...]]] Other components can be referred to in a similar way. The contract ID of the component can be used to get the component. You can get a component using JavaScript code like that below: var aFile = Components.classes["@mozilla.org/file/local;1"].createInstance(); The file component is retrieved and stored in the aFile variable.
Using Remote XUL - Archive of obsolete content
//www.mozilla.org/newsbot/" /> </menupopup> </menu> <menu label="Developer Docs"> <menupopup> <menuitem label="Roadmap" value="https://www.mozilla.org/roadmap.html" /> <menuitem label="Projects" value="https://www.mozilla.org/projects/" /> <menuitem label="Ports" value="https://www.mozilla.org/ports/" /> <menuitem label="
Module Owners" value="https://www.mozilla.org/owners.html" /> <menuitem label="Hacking" value="https://www.mozilla.org/hacking/" /> <menuitem label="Get the Source" value="https://www.mozilla.org/source.html" /> <menuitem label="Build It" value="https://www.mozilla.org/build/" /> </menupopup> </menu> <menu label="Testing"> <menupopup> ...
Using nsIXULAppInfo - Archive of obsolete content
dealing with XULRunner-based applications. Obtaining platform version information is done like this: var appInfo = Components.classes["@mozilla.org/xre/app-info;1"] .getService(Components.interfaces.nsIXULAppInfo); var platformVer = appInfo.platformVersion; var platformBuildID = appInfo.platformBuildID; Getting nsIXULAppInfo in xpcshell tests In Firefox 21, a testing
module was added that provides access to app info during the execution of xpcshell tests. See Bug 809920, and in summary: // Work around the fact that xpcshell doesn't have a proper app-info XPCOM object. Cu.import("resource://testing-common/AppInfo.jsm"); updateAppInfo(); Older versions As stated above, older Mozilla 1.7-based applications do not support nsIXULAppInfo. You'll have to write additiona...
Application Update - Archive of obsolete content
method that Firefox, Thunderbird, Songbird, and ChatZilla use. Getting Started You will need the following utility scripts from http://lxr.mozilla.org/mozilla/sourc...ate-packaging/ (or local source of XulRunner) common.sh make_full_update.sh You will need mar / mar.exe to build a complete update patch. You will need to compile a unix/linux executable mar from mozilla/
modules/libmar. As far as I can tell enabling the options --enable-updater and --enable-update-packaging on your configure will build you mar. Compiled versions of mar are available in the Gecko SDK under the folder /host/bin for your OS. In order to generate SHA1 hashes I installed shash. Application Settings You will need to configure the following settings in your application: Branding The...
2006-10-06 - Archive of obsolete content
et Applications) roadmap--a set of guidelines for developers to make accessible web content. This set of documents tackles some of the difficulties that AJAX has been causing with regards to accessibility. Read more... Other links of interest: Roadmap for Accessible Rich Internet Applications (WAI-ARIA Roadmap) Roles for Accessible Rich Internet Applications (WAI-ARIA Roles) States and Properties
Module for Accessible Rich Internet Applications (WAI-ARIA States and Properties) Making Ajax Work with Screen Readers Meetings Accessibility Hackfest 2006 - October 10-12 in Cambridge, MA (more details) Participants include the Mozilla Foundation, IBM, Sun and Novell to name a few. Authors Dean Woodside Sherman Fernandes ...
2006-11-22 - Archive of obsolete content
itch Access to Firefox". He expressed his gratitude and thanks everyone for being supportive during and after the Summit. Click here for more details. IDispatch support for JAWS scripting needed Aaron Leventhal stated that currently there is no IDispatch support for IAccessible's in Mozilla. If anyone has experience with these issues, and is comfortable helping out in the mozilla/accessible
module, would you please take a look at https://bugzilla.mozilla.org/show_bug.cgi?id=166994 He stated that he almost had it working a couple of years ago. The bug has a very old patch which will no longer be easy to apply but may provide clues as to where they are going wrong. For more information click here. Discussions Image Labelling for Blind Help Machines Frank Hecker brought up a valid discuss...
2006-11-24 - Archive of obsolete content
Summary: mozilla.dev.quality - November 18-November 24, 2006 Announcements None Discussions Firefox 1.5.0.7 on Linux x86_64 - Someone is having a problem with XHTTPRequest. He needs someone to verify or debunk the problem, or point him to a similar problem that would be helpful.
Module owner for mozilla/testing - Tim needs suggestions on who to promote as a moderator (to replace davel). robcee, rhelmer, and bsmedberg are the possible candidates. Champion for fixing ENABLE_TEST - A champion is needed to replace davel for cleaning up the ENABLE_TEST build target Meetings None Authors Mark D'Souza (mdsouza) Mohamed Attar (mojo) ...
2006-10-06 - Archive of obsolete content
webcal: & swebcal: Should also be allowed as the security manager doesn't differentiate between access types. Other This is for allowing protocol handlers to define a custom security model (see bug 120373). There is no consensus in the posts as to if this should be allowed. Problem Looping C_OpenSession Problem In Thunderbird Christian Bongiorno has run into a problem developing a PKCS11
module for a new card. Thunderbird is continuously repeating 7 functions including C_OpenSession which accesses the card that he is developing. Meetings None during this week. ...
2006-12-01 - Archive of obsolete content
Announcements Introducing RhinoLoader A byproduct of Helma that extends Java applications with Rhino/JS. It is basically a Java classloader that creates classes from JavaScript files. Server Side SpiderMonkey JuiceScript is an open source version of a Server Side JavaScript. It supports a Apache2
module and stand alone version. http://www.juicescript.org/ Discussions Deleting Objects in SpiderMonkey A user asks if there's a method of manually deleting an object in SpiderMonkey before garbage collector deletes it. Peter Wilson's reply was to add a method that does the deleting with a native implementation that releases the resources held by the object as seen in this database interface: var myDbase = new PgsqlConnection; myDbase.connect("database"); myDbase.exec("SELECT * FROM...
NP_GetMIMEDescription - Archive of obsolete content
a supported MIME Type list for your plugin. It works on Unix (Linux) and MacOS. On Windows you have to define supported mimetypes in the dll resource file. Each MIME type description should be separated by a semicolon (;). Each MIME type description contains the MIME Type, an extensions list and a short description. ...
Samples and Test Cases - Archive of obsolete content
The samples may not build any more on all platforms. There are plans to clean up the sample plugin situation - better organization, updated build systems, get them building on all platforms. However, even if one cannot build the samples they can still be very valuable as code references. There is a guide to compiling the npruntime sample in Visual Studio. In addition to those samples, there are 2 more plugins in the tree that might be helpful. ...
Adobe Flash - Archive of obsolete content
stall not just the tab it's running in, but the entire browser and even the entire computer it's being used on. Avoiding poorly-written or unnecessary Flash content is crucial to ensuring the user has a positive experience on not just your site, but the entire Web. As part of Mozilla's effort to improve the user experience, a feature was added in Firefox 49 that automatically blocks certain Flash
modules that have little or no user-noticeable impact from being used. These block-listed
modules include various fingerprinting and HTTP_cookie#Supercookie
modules. In the future, other
modules may be blocked as well. And, of course, eventually Flash support will be removed from Firefox entirely. Most of its functions can be reproduced using modern Web APIs. Using the right HTML The object element OR...
RSS - Archive of obsolete content
ude of different incompatible RSS versions. (Some being based on RDF, but most only being based on XML.) Nonetheless, RSS is an extremely popular format that is used for syndicating news, blog posts, IPradio, and IPTV, with an amazing amount of momentum. Documentation Why RSS Slash is Popular - Counting Your Comments Charles Iliya Krempeaux talks about the RSS Slash
Module, why it is popular among some, and how it is used to give a count for your comments. Why Well-Formed Web RSS
Module is Popular - Syndicating Your Comments Charles Iliya Krempeaux talks about the RSS Well-Formed Web
Module, why it is popular among some, and how it is used to link to your comments. Atomic RSS Tim Bray talks about using Atom 1.0 as a micro format and extension mo...
Building a Theme - Archive of obsolete content
omewhere. Copy your Firefox installation's omni.ja into this directory. The location differs by operating system: Linux: /usr/lib/MozillaFirefox/chrome/classic.ja or /usr/lib/firefox-*.*.*/omni.ja Windows: \Program Files\Mozilla Firefox\omni.ja Mac OS X: /Applications/Firefox.app/Contents/MacOS/omni.ja Now, open (or unzip) this file into the directory you created. It contains several folders,
modules, jssubloader and others. The files we will be needing are located under the chrome\toolkit\skin\classic folder. Create a folder called chrome in your theme's folder. Next, the contents of the following directories to their respective folders into the folder. global to chrome/global mozapps to chrome/mozapps Now that you've copied the global and mozapps folders, a handful of other folders ...
-ms-block-progression - Archive of obsolete content
e rotated 90? clockwise. Images are not rotated, but tables are. Box layout in vertical orientations is exactly analogous to layout in the horizontal orientation: width, height, top, bottom, right, and left do not rotate with the text. Only one block progression is active at a time; these values cannot be combined. This property is based on the block-progression property of the CSS3 Text Layout
module. ...
-ms-wrap-through - Archive of obsolete content
ame exclusion element. The wrapping context of a box is a collection of exclusion areas contributed by its associated exclusion boxes. The inline flow content of a box is placed in the area that corresponds to the subtraction of its wrapping context from its own content area. For more information about exclusion elements' impact on content flow, see the Terminology section of the CSS Exclusions
Module Level 1 specification. ...
display-inside - Archive of obsolete content
s contents using block layout. table The element lays out its contents using table layout. flex The element lays out its contents using flex layout. grid The element lays out its contents using grid layout. ruby The element lays out its contents using ruby layout. Formal syntax Syntax not found in DB! Specifications Specification Status Comment CSS Display
Module Level 3The definition of 'display-inside' in that specification. Candidate Recommendation Initial specification Browser compatibility Not supported in any browser. ...
Developing Mozilla XForms - Archive of obsolete content
was built together with Firefox should be already installed. Then open your form that causes problems and have a look on the console. Often you'll find the first starting points here or in the Error Console. Schema validation problems The schema-validation extension contains a logging facility that can show some internals on the schema processing. To activate this logging output, set the NSPR_LOG_
MODULES environment variable: export NSPR_LOG_
MODULES=schemaValidation:5 This only works on a debug build as described above. ...
XForms Repeat Element - Archive of obsolete content
is placed vertically. compact layout Each generated control set is placed horizontally. Occurs when the repeat element's appearance attribute has a value of compact. Behaviour Focusing a generated control may change the current index of the containing repeat element. The index is equal to the index of the control set that the focused control belongs to. Actions You can use XForms Action
Module elements to modify the nodeset that the repeat element is bound to. The most useful actions for altering the contents of a repeat are the insert (see the spec), delete (see the spec) and setindex (see the spec) elements. Example <model> <instance> <my:lines> <my:line name="a"> <my:price>3.00</my:price> </my:line> <my:line name="b"> <my:price>32.25</my:pr...
XForms Trigger Element - Archive of obsolete content
Attributes UI Common appearance - the value of this attribute gives a hint to the XForms processor as to which type of widget(s) to use to represent this control accesskey - used to specify the keyboard shortcut for focusing this control Single-Node Binding Type restrictions The trigger element can be bound to a node containing data of any type. Actually, the trigger element doesn't interact with the data in the bound node. However, relevant model item property on the bound node has an effect on a trigger. ...
Mozilla XForms User Interface - Archive of obsolete content
. The XForms specification offers suggestions for some of the representations, but some of the widgets we use are only available in the Mozilla XForms processor. The choice of widget that we use is often determined by the data type of the instance node that the xforms element is bound to. The form author can also influence the widget by using the appearance attribute on the element. Form Controls
Module This section contains a short description for each form control element. input A key xforms element to show and change the instance data to which it is bound. Usually bound to data that can be well-represented by a string (see the spec). It can have the following representations: text field - default representation. Used for most data types, especially text data. checkbox - used for boolean ...
Obsolete: XPCOM-based scripting for NPAPI plugins - Archive of obsolete content
le nsITestPlugin.idl with the idl compiler. This will generate nsITestPlugin.h and nsITestPlugin.xpt files. Put nsITestPlugin.xpt to the Components folder. Build nptestplugin.dll with nsITestPlugin.h included for compiling scriptable instance class implementaion. Put nptestplugin.dll to the Plugins folder. Related sources The full sample plugin code can be found in the Mozilla source tree under
modules/plugin/samples/4x-scriptable/ IBM Developer Works has published a good article on XPCOM. Examples Example 1. Sample .idl file #include "nsISupports.idl" [scriptable, uuid(bedb0778-2ee0-11d5-9cf8-0060b0fbd8ac)] interface nsITestPlugin : nsISupports { void nativeMethod(); }; Example 2. Scriptable instance class #include "nsITestPlugin.h" #include "nsIClassInfo.h" // We must implement nsI...
Gecko FAQ - Gecko Redirect 1
l also be painting the scrollbars, toolbars, and menus on the screen as well. For more information see XUL. How is a layout engine like Gecko different from a Web browser? Gecko provides the foundation needed to display content on the screen, including a layout engine and a complementary set of browser components. However, Gecko does not package all of these components alongside other interface
modules in a coherent, user-friendly application (including menus, toolbars, etc.), such as Firefox. mozilla.org assembles the necessary components into its applications, such as Firefox, Thunderbird, SeaMonkey, which are available for free download from mozilla.org. Netscape released its own version of the browser branded as Netscape Navigator. Other companies release their own software and hardware p...
Plug-in Development Overview - Gecko Plugin API Reference
erences a file of that type), from a separate non-HTML file of that MIME type, or from the server. The server looks for the MIME type registered by a plug-in, based on the file extension, and starts sending the file to the browser. The browser looks up the media type, and if it finds a plug-in registered to that type, loads the plug-in software. When it starts up, the browser checks for plug-in
modules for the platform and registers them. It determines which plug-ins are installed and which types they support through a combination of user preferences that are private to the browser, the contents of the plug-ins directory, or the registry on Windows. A MIME type is made up of a major type (such as application or image) and a minor type, for example, image/jpeg. If you define a new MIME type fo...
CSS pixel - MDN Web Docs Glossary: Definitions of Web-related terms
t px is used, the goal is to try to have the distance 96px equal about 1 inch on the screen, regardless of the actual pixel density of the screen. In other words, if the user is on a phone with a pixel density of 266 DPI, and an element is placed on the screen with a width of 96px, the actual width of the element would be 266 device pixels. Learn more Technical reference CSS Values and Units
Module, section 5.2: Absolute Lengths Learn about it CSS Length Explained on the MDN Hacks Blog ...
Routers - MDN Web Docs Glossary: Definitions of Web-related terms
There are two definitions for routers on the web: For the network layer, the router is a networking device that decides data Packets directions. They are distributed by retailers allowing user interaction to the internet. For SPA in application layer, router is a library that decides what web page is presented by a given URL. This middleware
module is used for all URL functions, as these are given a path to a file that is rendered to open the next page. Learn More General knowledge For network layer context: Router (computing) on Wikipedia For SPA in application layer context, most of the popular SPA frameworks has its routing library: Angular router React router Vue router ...
WAI-ARIA basics - Learn web development
omic unit, not just the bits that were updated. Note: You can see the finished example at aria-live.html (see it running live). Note: The aria-relevant property is also quite useful for controlling what gets read out when a live region is updated. You can for example only get content additions or removals read out. Enhancing keyboard accessibility As discussed in a few other places in the
module, one of the key strengths of HTML with respect to accessibility is the built-in keyboard accessibility of features such as buttons, form controls, and links. Generally, you are able to use the tab key to move between controls, the Enter/Return key to select or activate controls, and occasionally other controls as needed (for example the up and down cursor to move between options in a <select> box...
Advanced styling effects - Learn web development
y-mix { mix-blend-mode: multiply; } This gives us the following results: You can see here that the multiply mix blend has blended together not only the two background images, but also the color from the <div> below it too. Note: Don't worry if you don't understand some of the layout properties above, like position, top, bottom, z-index, etc. We will cover these in detail in our CSS Layout
module. CSS shapes While it is true that everything in CSS is a rectangular box, and images are a physical rectangular box, we can make it look as if our content flows around non-rectangular things by using CSS Shapes. The CSS Shapes specification enables the wrapping of text around a non-rectangular shape. It's especially useful when working with an image which has some white-space you might want t...
Backgrounds and borders - Learn web development
operty pages if you want to find out more about any of the features we have discussed. Each page on MDN has more examples of usage for you to play with and enhance your knowledge. In the next lesson, we will find out how the Writing Mode of your document interacts with your CSS. ...
pymake
Prerequisites If running Windows, you need to have a Windows build environment installed for using pymake to build Mozilla. On other operating systems (Linux, OS X, etc), pymake itself only requires Python 2.6 or higher (but not Python 3). Please note that Python 2.7 is strongly recommended. Usage If you use mach for everything, you don't have to worry about gmake and pymake: mach will run whatever is best for the current machine. ...
Interface Compatibility
es should not be taken lightly, however: especially if a change is likely to affect many extensions, the change should try to maintain backwards compatibility by using optional/default parameters or other JavaScript techniques. Where appropriate, new APIs should be designed so that they are compatible with future plans, and clients do not need XPCOM boilerplate. This may involve using JavaScript
modules, passing named parameters using objects, or other similar techniques. Binary Interfaces Traditionally, Mozilla has maintained a set of XPCOM interfaces and functions with the @status FROZEN marking. Using these interfaces, and using dynamic calls to QueryInterface, it has been possible to write binary XPCOM components which were compatible with multiple versions of Firefox. Beginning with Mozil...
Contributing to the Mozilla code base
lame on the file and look for the people who have touched the functions you're working on. They too are good candidates. Running hg log and looking for regular reviewers might be a solution too. The bug itself may contain a clear indication of the best person to ask for a review Are there related bugs on similar topics? The reviewer in those bugs might be another good choice We have a list of
modules, which lists peers and owners for the
module. Some of these will be good reviewers. In a worst case scenario, set the
module owner as the reviewer, asking them in the comments to pick someone more suitable Please select only one reviewer. Step 4b: Follow it up Once you've asked for a review, a reviewer will often respond within a day or two, reviewing the patch, or saying when they will be a...
Reviewer Checklist
doesn't create any unused code (e.g., remove strings when removing a feature) All caught exceptions should be logged at the appropriate level, bearing in mind personally identifiable information, but also considering the expense of computing and recording log output. [Fennec: Checking for log levels is expensive unless you're using Logger.] Style Follow the style guide for the language and
module in question. Follow local style for the surrounding code, even if that local style isn't formally documented. New files have license declarations and modelines. New JS files should use strict mode. Trailing whitespace (git diff and splinter view both highlight this, as does hg with the color extension enabled). Whitespace can be fixed easily in Mercurial using the CheckFiles extension. In git...
Developer guide
tions. Development process overview An overview of the entire Mozilla development process. Managing multiple profiles When working with prerelease versions of Firefox, it's often helpful to have multiple Firefox profiles, such as one for each channel, or for different kinds of testing. Getting documentation updated How to ensure that documentation is kept up to date as you develop. Mozilla
modules and
module ownership This article provides information about Mozilla's
modules, what the role of a
module owner is, and how
module owners are selected. Code snippets Useful code samples for a wide variety of things you might need to figure out how to do. Mozilla development strategies Tips for how to make the most of your time working on the Mozilla project. Debugging Find helpful tips an...
Limitations of frame scripts
converted to an nsIDOMWindow, so the second getInterface call here will fail. If you want a chrome window: send a message from the content process using the message manager. The target property of the object passed into the message handler in the chrome process is the XUL <browser> receiving the message, and you can get the chrome window from that (Note: I'm not really sure how...). nsIAbout
Module By default, custom about: pages registered using nsIAbout
Module are loaded in the chrome process. This means that you can't access their content from the content process (via XHR, for example). You can change this default in the code you use to register the about: URI. See about: and chrome: URIs. JavaScript code
modules (JSMs) In multiprocess Firefox, a JSM loaded into the content process do...
Process scripts
When you need to run code in the content process in order to access web content, then you should use frame scripts. However, a problem with frame scripts is that they can be loaded multiple times in the content process, in multiple scopes that are insulated from each other. For example, if you call the global frame message manager's loadFrameScript() function, then the script will be loaded separately into all open tabs. This can then cause a problem the frame scripts are interacting with a global service in the content process. ...
Firefox and the "about" protocol
refox is installed about:welcomeback Information page displayed after Firefox is reset These URLs are defined in docshell/base/nsAboutRedirector.cpp within the kRedirMap array. The array maps most of the URLs, like config to URLs in the chrome: pseudo protocol, such as chrome://global/content/config.xul. The about location information is duplicated in docshell/build/nsDocShell
Module.cpp. Note: You must access about: protocol pages by typing them into the address bar. Attempts to navigate through window.location will throw -- Error: Access to 'about:addons' from script denied. ...
ChromeWorker
first register a resource replacement path, using code like this: var fileuri = Services.io.newFileURI(file); Services.io.getProtocolHandler('resource'). QueryInterface(Ci.nsIResProtocolHandler). setSubstitution('my-cool-addon', fileuri); var worker = new Worker('resource://my-cool-addon/worker.js'); More references: You can use ChromeWorker from JavaScript code
modules. See Using workers in JavaScript code
modules for details. You can use ChromeWorker
modules in ChromeWorkers. See Using web workers for examples and details. See Also Using web workers Using workers in JavaScript code
modules Worker SharedWorker Web Workers specification WorkerGlobalScope GitHub :: ChromeWorker - A fully working demo addon using js-ctypes from a chrome worker. Uses ...
Roll your own browser: An embedding how-to
velopment/desktop environment. Part of the GNOME effort. ActiveState's Komodo: Development environment, based on Mozilla's XUL. (Screenshot) Light: Very simple non-bloated GTK+ interface, familiar Netscape 4.x keyboard shortcuts, context menus, etc. (Screenshot) XParts: KDE extension that allows Mozilla to be embedded into the Konqueror browser. Uses GtkMozEmbed widget, part of the kdebindings
module and available from http://websvn.kde.org/trunk/KDE/kdebindings/xparts/. (News release, screenshot) Mozilla Examples GtkMozEmbed widget: Gtk widget wrapper for the Mozilla Gecko Engine. TestGtkEmbed: Basic browser built with the GtkMozEmbed widget. URL location field, menu bar, html area, supports SSL. Windows External projects K-Meleon browser: the Windows answer to Galeon. Fast IE-lo...
IME handling guide
Selected clause by the user or IME and also converted by IME SELECTION_IME_SELECTEDCONVERTEDTEXT eIMESelectedClause eSelectedClause Note that typically, "Selected clause of raw text typed by the user" isn't used because when composition string is already separated to multiple clauses, that means that the composition string has already been converted by IME at least once.
Modules handling IME composition widget Each widget handles native IME events and dispatches WidgetCompositionEvent with mozilla::widget::TextEventDispatcher to represent the behavior of IME in the focused editor. This is the only
module that depends on the users platform. See also Native IME handlers section for the detail of each platform's implementation. Android widget still does not use TextEv...
Creating a New Protocol
be in the mozilla namespace or a sub-namespace. To hook up the file to the build, you need to add your IPDL file to IPDL_SOURCES in the nearest moz.build file. See dom/ipc/moz.build for an example. The Protocol Hierarchy Unless you are working on some special project, your protocol will fit into the protocol hierarchy for multi-process plugins or tabs. The toplevel protocol for plugins is PPlugin
Module. The toplevel protocol for tabs is PContent. You should know what protocol will manage the new protocol and what lifetime issues that creates. If there is any doubt, ask on IRC in the #content channel. Building the New Protocol To build the new protocol declaration and generate headers, make in ipc/ipdl: make -C objdir/ipc/ipdl If there are any protocol-level errors, the IPDL compiler will print...
IPDL Tutorial
eal-world situation would have a single protocol in isolation. Instead, protocols are arranged in a managed hierarchy of subprotocols. A sub-protocol is bound to a "manager" which tracks its lifetime and acts as a factory. A protocol hierarchy begins with a single top-level protocol from which all subprotocol actors are eventually created. In Mozilla there are two main top-level protocols: PPlugin
Module for remote plugins, and PContent for remote tabs. The following example extends the toplevel plugin protocol to manage plugin instances. // ----- file PPlugin.ipdl include protocol PPluginInstance; rpc protocol PPlugin { manages PPluginInstance; child: rpc Init(nsCString pluginPath) returns (bool ok); // This part creates constructor messages rpc PPluginInstance(nsCString type...
IPDL Type Serialization
Iter, &(aResult->k[i]))) return false; return true; } }; } // namespace IPC Once you have a serializer for a type, you can serialize a collection of it (ex: an nsTArray<ExampleStruct>) by simply declaring "using nsTArray<ExampleStruct>;' in your IPDL file, then using it in a IPC method. Serializers and deserializers are security-sensitive and must always receive two reviews from
module owners who understand IPC serialization well. If in doubt, please ask for help! It is never acceptable to serialize/deserialize raw pointer values; if you are tempted, you probably should create a subprotocol for that data, so that IPDL can check the values and lifetime. ...
AddonUpdateChecker
The AddonUpdateChecker is used to download and parse update information for an add-on's update manifest. If all you care about is finding the newest version for an Addon then you probably want to use findUpdates() instead. ...
DeferredTask.jsm
Firefox 28 note Interface was changed in Firefox 28, and old methods were removed. The DeferredTask.jsm JavaScript code
module offers utility routines for a task that will run after a delay. Multiple attempts to run the same task before the delay will be coalesced. To use it, you first need to import the code
module into your JavaScript scope: Components.utils.import("resource://gre/
modules/DeferredTask.jsm"); Use this, for instance, if you write data to a file and you expect that you may have to rewrite data very soon afterwards. With DeferredTask, the task is delayed by a few milliseconds and, should a new change to the data occur during this period, only the final version of the data is actually written; a further grace delay is added to take into account other chang...
Dict.jsm
Introduced in Firefox 5, this is now obsolete and has been removed in Firefox 40: use ES2015 Map. The Dict.jsm JavaScript code
module offers routines for managing dictionaries of key/value pairs. To use it, you first need to import the code
module into your JavaScript scope: Components.utils.import("resource://gre/
modules/Dict.jsm"); Creating a dictionary You can create a new, empty dictionary by simply calling the Dict() constructor: var newDict = new Dict(); If you wish, you may also pass in an object literal of key/value pairs with which to initialize the dictionary: var someObj = {}; var newDict = new Dict({key1: "foo", key2: someObj}); Note that values may be any JavaScript object type. Note: You can actually specify non-strings as keys; these are converted to strings ...
DownloadLastDir.jsm
The DownloadLastDir.jsm JavaScript code
module lets you retrieve the path of the last directory into which a download occurred. To use this, you first need to import the code
module into your JavaScript scope: Components.utils.import("resource://gre/
modules/DownloadLastDir.jsm"); If you are using Addon SDK, you can import the code
module as: let { Cu } = require("chrome"); let DownloadLastDir = Cu.import("resource://gre/
modules/DownloadLastDir.jsm").DownloadLastDir; Once you've imported the
module, you can then use the DownloadLastDir object it exports. Using the DownloadLastDir object To determine or set the path into which the last download occurred: // file is an nsIFile var file = DownloadLastDir.file; DownloadLastDir.file = file; You can also set and retrieve this information o...
FxAccountsOAuthClient.jsm
onComplete Function Gets called when the Firefox Accounts OAuth flow successfully completes. First and only argument is an Object that has "state" and "code" properties. ...
FxAccountsProfileClient.jsm
token String Bearer token. Constructor FxAccountsProfileClient() Creates and returns a new FxAccountsProfileClient object. FxAccountsProfileClient FxAccountsProfileClient( Object options String serverURL, String token ); Parameters serverURL - Firefox Profile server url. ...
Geometry.jsm
The Geometry.jsm JavaScript code
module provides routines for performing common geometry operations on points and rectangles. It exports two classes: Point and Rect. To use these routines, you first need to import the code
module into your JavaScript scope: Components.utils.import("resource://gre/
modules/Geometry.jsm"); Once you've imported the
module, you can then use the Point and Rect classes. Note: Although this
module is usable from mobile, and is present in Firefox 4, it's currently not used in Firefox 4 and attempting to use it may produce unreliable results there. ...
ISO8601DateUtils.jsm
The ISO8601DateUtils.jsm JavaScript code
module provides methods that make it easy to convert JavaScript Date objects into ISO 8601 format date strings and back. To use this, you first need to import the code
module into your JavaScript scope: Components.utils.import("resource://gre/
modules/ISO8601DateUtils.jsm"); Once you've imported the
module, you can then use the ISO8601DateUtils object it exports. Using the ISO 8601 date utilities To convert a date string into a Date object, simply use: dateObj = ISO8601DateUtils.parse(dateString); To convert a Date object into a date string: dateString = ISO8601DateUtils.create(dateObj); Method overview String create(aDate); Date parse(aDateString); Methods create Creates an ISO 8601 format date string, e.g. "2010-05-15T13:45:00Z", from a JavaS...
Interfacing with the Add-on Repository
The Add-on Repository JavaScript code
module makes it easy for your extension to interface with the AMO repository. You an use the code
module to get lists of add-ons and even install new add-ons. This article provides some sample code that queries the recommended add-ons list on AMO and lets the user click a button to install an add-on from the list. Importing the repository code
module Before you can use the Add-on Repository API, you need to import the code
module: Components.utils.import("resource://gre/
modules/AddonRepository.jsm"); Having done this, you can then access the API through the resulting AddonRepository object. Enabling the recommendation feature In current builds of Firefox 4, the recommendation API doesn't work because the preference for the URL to query to get recomme...
Following the Android Toasts Tutorial from a JNI Perspective
This article teaches developers how to port Java code to JNI by reading the Java and Android documentation. Toast description A toast provides simple feedback about an operation in a small popup. It only fills the amount of space required for the message, and the current activity remains visible and interactive. ...
JavaScript OS.Constants
Using OS.Constants From the main thread To initialize OS.Constants for use in the main thread, add the following snippet to your code: Components.classes["@mozilla.org/net/osfileconstantsservice;1"]. getService(Components.interfaces.nsIOSFileConstantsService). init(); From a chrome worker No initialization is required.
Module OS.Constants is always available for chrome workers. OS.Constants.Sys Constants related to system configuration. Name The name of the operating system (e.g. "Darwin"). DEBUG Set to true on debug build configurations, non-existent otherwise. ...
JavaScript OS
OS.Constants OS-related constants, including errors, file opening modes, system configuration, etc. OS.File Access to the native file system. OS.Shared Utilities for defining functions that interact with the operating system. ...
Log.jsm
This
module is still under development. Until stabilized, expect frequent updates, including different interfaces and behavior in different versions of the platform. Progress is tracked in Bugzilla using dependencies of bug 451283. The Log.jsm JavaScript code
module (formerly named log4moz.js) provides a log4j style API for logging log messages to various endpoints, such as the Browser Console or a file on disk. To use it, you first need to import the code
module into your JavaScript scope: Components.utils.import("resource://gre/
modules/Log.jsm"); Basic usage Components.utils.import("resource://gre/
modules/Log.jsm"); // Get a logger, give it a name unique to this chunk of code. // Use dots to create a hierarchy, this way you can later change // the log level of sets of loggers under...
OSFile.jsm
F.A.Q. What is OS.File? OS.File is a new API designed for efficient, off-main thread, manipulation of files by privileged JavaScript code. This API is intended to replace, in time, most XPCOM-based manipulation of files (nsIFile, subsets of nsIIOService, etc.) by JavaScript code. What are the relationships with the HTML5 File API? None, really. The File API is designed for high-level, highly-restricted manipulation of files by web applications. OS.File is designed for efficient, unrestricted, manipulation of files by Firefox itself and by add-ons. ...
Deferred
ected promise itself, and not its rejection reason. Backwards and forwards compatible helper This Deferred function can be used for backwards and forwards compatibility, due to a change that took place in Firefox 30. function Deferred() { // update 062115 for typeof if (typeof(Promise) != 'undefined' && Promise.defer) { //need import of Promise.jsm for example: Cu.import('resource:/gree/
modules/Promise.jsm'); return Promise.defer(); } else if (typeof(PromiseUtils) != 'undefined' && PromiseUtils.defer) { //need import of PromiseUtils.jsm for example: Cu.import('resource:/gree/
modules/PromiseUtils.jsm'); return PromiseUtils.defer(); } else { /* A method to resolve the associated Promise with the value passed. * If the promise is already settled it does nothing. * * @p...
Promise
A reference to an existing promise may be received by different means, for example as the return value of a call into an asynchronous API. Once you have a reference to a promise, you can call its then() method to execute an action when the value becomes available, or when an error occurs. Promises may also be created using the new Promise() constructor. You don't need to import the Promise.jsm
module to use a Promise object to which you already have a reference. Internally, a promise can be in one of three states: Pending, when the final value is not available yet. This is the only state that may transition to one of the other two states. Fulfilled, when and if the final value becomes available. A fulfillment value becomes permanently associated with the promise. This may be any value, i...
Services.jsm
The Services.jsm JavaScript code
module offers a wide assortment of lazy getters that simplify the process of obtaining references to commonly used services. To use it, you first need to import the code
module into your JavaScript scope: const {Services} = ChromeUtils.import("resource://gre/
modules/Services.jsm"); Then you can obtain references to services by simply accessing them from the Services object exported by the code
module. For example, to obtain a reference to the preferences service: var prefsService = Services.prefs; Provided service getters Service accessor Service interface Service name androidBridge nsIAndroidBridge 1 appinfo nsIXULAppInfo nsIXULRuntime Application information service appShell nsIAppShellServic...
SourceMap.jsm
new SourceMapConsumer(rawSourceMap) The only parameter is the raw source map (either as a string which can be JSON.parse'd, or an object). According to the spec, source maps have the following attributes: version: Which version of the source map spec this map is following. sources: An array of URLs to the original source files. names: An array of identifiers that can be referenced by individual mappings. ...
openLocationLastURL.jsm
This component has been removed from the platform in Firefox 29. (bug 953124) The openLocationLastURL.jsm JavaScript code
module lets you set and retrieve the URL most recently opened using the "Open Location" option in the File menu. To use this, you first need to import the code
module into your JavaScript scope: Components.utils.import("resource:///
modules/openLocationLastURL.jsm"); Once you've imported the
module, you can then use the OpenLocationLastURL object it exports. This object lets you fetch and change the URL that is placed in the "Open Location" dialog box when it opens. If the user is not in private browsing mode, this automatically updates the value of the general.open_location.last_url preference. Note: This
module automatically handles private browsing mode for you. The ...
Writing localizable code
transformed. If you want to add build processing to localized files, be sure to request feedback from l10n@. In most cases, you can just as well put the processing into the content code and reference different key-value pairs in l10n. Use a good source directory structure Be sure to put the localizable files in the right place. The addition of new top-level directories is a compromise between
module ownership in the cvsroot repository and the ease of localization. Use a good chrome directory structure For a particular
module mod, a target path jar:ab-CD.jar!/locale/ab-CD/mod/foo.dtd has been widely tested and is a good place for your files referenced as chrome://mod/locale/foo.dtd. Using a directory structure like this eases the localization process without the source code and is especci...
MathML Accessibility in Mozilla
nts to MathML accessibility in VoiceOver. Linux: MathML support is provided by the development version of Orca. We try to keep in sync with WebKit/ATK/Orca developments. At the moment, it is recommended to use a Nightly build to ensure that the accessible tree expected by Orca is correctly exposed. AccessFu: MathML support in Android and Firefox OS is currently being implemented in our AccessFu
module and a patch is available on bug 1163374. The table gives the output in mode "utterance" and description spoken last. Note that this is still very experimental. MathML Windows Mac Linux AccessFu Diagonal of a regular pentagon Video Video Video / x+2 __________ x plus 2 __________ x+2 x plus 2 x + y a...
Mozilla DOM Hacking Guide
d register class names and class prototypes. Finally it sets sIsInitialized to true. The actions that concern the DOM are described below. First, the call to CallGetService() initializes sXPConnect. Then the Script Security Manager (sSecMan) is initialized. GetSafeJSContext() grabs us a cool JS context to run our JavaScript code in. The part about ComponentRegistrar is designed to allow external
modules (in this case XPath) to be included in DOMClassInfo and as such benefit from the JavaScript benefits it provides. After that, we fill the blanks in the sClassInfoData array. If you remember the discussion in the introduction to Class Info, there is the main array, sClassInfoData, filled with objects of type nsDOMClassInfoData. However when the array is created, three data members of the structu...
Mozilla Style System
The handling of those computed values is the responsibility of other parts of the code. Architecture The style system is split in half rather neatly. In one half (the backend) are the sources of specified style data, and in the other half (the frontend) is the code that turns the specified values into computed values. ...
Investigating leaks using DMD heap scan mode
ntries until this was the most suspicious looking entry: 0x7f0892f29630 size = 392 bytes at byte offset 56 mozilla::dom::ScriptLoader::ProcessExternalScript[...] [...] I went to that line of ScriptLoader::ProcessExternalScript(), and it contained a call to ScriptLoader::CreateLoadRequest(). Fortunately, this method mostly just contains two calls to new, one for ScriptLoadRequest and one for
ModuleLoadRequest. (This is where an unoptimized build comes in handy, as it would have pointed out the exact line. Unfortunately, in this particular case, the unoptimized build was so slow I wasn't getting any logs.) I then looked through the list of leaked objects generated by XPCOM_MEM_BLOAT_LOG and saw that we were leaking a ScriptLoadRequest, so I went and looked at its class definition, where I no...
Leak Gauge
Leak Gauge is a tool that can be used to detect certain kinds of leaks in Gecko, including those involving documents, window objects, and docshells. It has two parts: (a) instrumentation in Gecko that produces a log file, and (b) a script to post-process the log file. Getting a log file To get a log file, run the browser with the following environment variables set. NSPR_LOG_
MODULES=DOMLeak:5,DocumentLeak:5,nsDocShellLeak:5,NodeInfoManagerLeak:5 NSPR_LOG_FILE=nspr.log # or any other filename of your choice This will overwrite any existing file called nspr.log. The browser will run with negligible slowdown. You must exit the browser before post-processing the log file or the results will be unreliable. Post-processing a log file Post-process the log file with tools/leak-gauge/l...
TimerFirings logging
irings are a major cause of wakeups, which can cause high power consumption. Note: The power profiling overview is worth reading at this point if you haven't already. It may make parts of this document easier to understand. Invocation TimerFirings logging uses Gecko's own logging mechanism, and so is able to be used in any build. Set the following environment variable to enable it. NSPR_LOG_
MODULES=TimerFirings:4 Output Once enabled, TimerFirings will print one line of logging output per timer fired. It's best to redirect this output to a file. The following sample shows the basics of this output. -991946880[7f46c365ba00]: [6775] fn timer (SLACK 100 ms): LayerActivityTracker -991946880[7f46c365ba00]: [6775] fn timer (ONE_SHOT 250 ms): PresShell::sPaintSuppressionCallback -...
about:memory
identified, as the following example shows. ...
dtrace
ay make parts of this document easier to understand. Invocation dtrace must be invoked as the super-user. A good starting command for profiling wakeups is the following. sudo dtrace -n 'mach_kernel::wakeup { @[ustack()] = count(); }' -p $FIREFOX_PID > $OUTPUT_FILE Let's break that down further. The -n option combined with the mach_kernel::wakeup selects a probe point. mach_kernel is the
module name and wakeup is the probe name. You can see a complete list of probes by running sudo dtrace -l. The code between the braces is run when the probe point is hit. The above code counts unique stack traces when wakeups occur; ustack is short for "user stack", i.e. the stack of the userspace program executing. Run that command for a few seconds and then hit Ctrl + C to interrupt it. dtrace wi...
Performance
l to profile Mozilla code. Profiling with Xperf How to use Microsoft's Xperf tool to profile Mozilla code. Profiling with Concurrency Visualizer How to use Visual Studio's Concurrency Visualizer tool to profile Mozilla code. Profiling with Zoom Zoom is a profiler for Linux done by the people who made Shark Measuring performance using the PerfMeasurement.jsm code
module Using PerfMeasurement.jsm to measure performance data in your JavaScript code. Adding a new Telemetry probe Information on how to add a new measurement to the Telemetry performance-reporting system Profiling JavaScript with Shark (obsolete - replaced by Instruments) How to use the Mac OS X Shark profiler to profile JavaScript code in Firefox 3.5 or later. Profiling ...
A brief guide to Mozilla preferences
ing sticky_pref() - these preference will be written whenever the preference has a user value even when it is the same as the default. Modifying preferences Advanced users can set named preferences via the advanced preferences editor, by typing about:config in the Location Bar. This UI is not recommended for most users. Programmatic changes to preferences can be made using the Preferences.jsm
module from JS code, or the mozilla::Preferences static class methods from C++ code. Changing defaults A systems administrator can modify the default preferences in two ways: The administrator may add an all-companyname.js preference file (install_directory/browser/defaults/preferences/all-companyname.js). This will be parsed last during the preference loading process. The administrator may al...
MailNews automated testing
for developers and testers. Functional testing xpcshell-tests and make check These are core test harnesses to which MailNews adds its own tests. These tests are run against almost every changeset that gets committed to the Thunderbird and SeaMonkey code bases. xpcshell-tests are run in JavaScript without any chrome present. This makes them especially useful for testing at the component /
module level. xpcshell-tests are the quickest tests to run. MailNews provides additional facilities as described on the MailNews automated testing page (see below). "make check" is used to run compiled code tests. These tests can go beyond the limitations of xpcshell-tests (for example, access c++ code) and other testing options that don't test at the right level. Testing frameworks The AsyncTestUti...
Cryptography functions
PK11_GetKeyGen MXR 3.4 and later PK11_GetKeyLength MXR 3.2 and later PK11_GetKeyStrength MXR 3.2 and later PK11_GetMechanism MXR 3.2 and later PK11_GetMinimumPwdLength MXR 3.4 and later PK11_GetModInfo MXR 3.6 and later PK11_Get
Module MXR 3.3 and later PK11_Get
ModuleID MXR 3.2 and later PK11_GetNextGenericObject MXR 3.9.2 and later PK11_GetNextSafe MXR 3.4 and later PK11_GetNextSymKey MXR 3.4 and later PK11_GetPadMechanism MXR 3.4 and later PK11_GetPBECryptoMech...
NSS FAQ
PKCS #7, PKCS #11, PKCS #12, S/MIME, and X.509 v3 certificates. For complete details, see Encryption Technologies Available in NSS 3.11 What is the relationship between NSS and PSM? Personal Security Manager (PSM) is built on top of NSS. It consists of libraries and a daemon designed to support cross-platform development of security-enabled client applications. The PSM binary provides a client
module that performs cryptographic operations on behalf of applications. Netscape Personal Security Manager ships with Netscape 6 and the Gateway Connected Touch Pad with Instant AOL, and is also available for use with Communicator 4.7x. Where can I get the source? For instructions on how to check out and build the NSS source code, see Build Instructions for NSS. How much does it cost? NSS source co...
Introduction to Network Security Services
- Windows import library binding to nss3.dll nss.lib - Windows static library NSS, SSL, and S/MIME have all of the above forms. The following static libaries aren't included in any shared libraries libcrmf.a/crmf.lib provides an API for CRMF operations. libjar.a/jar.lib provides an API for creating JAR files. The following static libaries are included only in external loadable PKCS #11
modules: libnssckfw.a/nssckfw.lib provides an API for writing PKCS #11
modules. libswfci.a/swfci.lib provides support for software FORTEZZA. The following shared libraries are standalone loadable
modules, not meant to be linked with directly: libfort.so/libfort.sl/fort32.dll provides support for hardware FORTEZZA. libswft.so/libswft.sl/swft32.dll provides support for software FORTEZZA. libnss...
JSS Provider Notes
The current implementation is almost useless. Since these problems lie deep in the NSS design and implementation, there is no clear timeframe for fixing them. Meanwhile, the org.mozilla.jss.crypto.CryptoStore class can be used for some of this functionality. Cipher Supported Algorithms Notes AES DES ...
Mozilla-JSS JCA Provider notes
thDSA) SHA-1/RSA (SHA1/RSA, SHA1withRSA) MD5/RSA (MD5withRSA) MD2/RSA The SecureRandom argument passed to initSign() and initVerify() is ignored, because NSS does not support specifying an external source of randomness. What's Not Supported The following classes don't work very well: KeyStore: There are many serious problems mapping the JCA keystore interface onto NSS's model of PKCS #11
modules. The current implementation is almost useless. Since these problems lie deep in the NSS design and implementation, there is no clear timeframe for fixing them. Meanwhile, the org.mozilla.jss.crypto.CryptoStore class can be used for some of this functionality. ...
NSS_3.11.10_release_notes.html
oad the NSPR 4.7.1 binary distributions to get the NSPR 4.7.1 header files and shared libraries, which NSS 3.11.10 requires. NSPR 4.7.1 binary distributions are in https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v4.7.1/. Bugs Fixed The following bugs have been fixed in NSS 3.11.10. Bug 291384: certutil -K behavior doesn't match usage Bug 374247: modutil -disable command not disabling
modules' slots Bug 384459: Certification path validation fails when Authority Key Identifier extension contains key identifier Bug 385946: Can't import certificate into cert database in FIPS mode (certutil). Bug 387892: Add Entrust root CA certificate(s) to NSS Bug 396999: PK11_Authenticate Bug 397478: Lock from ssl_InitSymWrapKeysLock not freed on selfserv shutdown. Bug 397486: Session cach...
NSS_3.12.2_release_notes.html
ns to underscores in DEBUG_$(shell whoami). Bug 455424: nssilckt.h defines the enumeration constant 'Lock' Bug 456036: Stubs for deprecated functions in lib/certdb/stanpcertdb.c should set the PR_NOT_IMPLEMENTED_ERROR error. Bug 456854: CERT_DecodeCertPackage does not set NSPR error code upon error Bug 457980: hundreds of kilobytes of useless strings in libPKIX Bug 457984: Enable PKCS11
module logging in optimized builds Bug 458905: Memory leaks in PKIX bridge certificates. Bug 459231: Memory leak in cert fetching - AIA extension. Bug 459248: Support Intel AES extensions. Bug 459359: ForwardBuilderState object is leaked when AIA path incorrect Bug 459481: NSS build problem with GCC 3.4.6 on OS/2 Documentation For a list of the primary NSS documentation pages on mozilla.org...
NSS 3.14.1 release notes
n internal lock to be acquired twice, causing a hang. This hang has been fixed in NSS 3.14.1. Bug 802429 - In previous versions of NSS, the "cipherOrder" slot configuration flag was not respected, causing the most recently added slot that supported the requested PKCS#11 mechanism to be used instead. NSS now correctly respects the supplied cipherOrder. Applications which use multiple PKCS#11
modules, which do not indicate which tokens should be used by default for particular algorithms, and which do make use of cipherOrder may now find that cryptographic operations occur on a different PKCS#11 token. Bug 802429 - The NSS softoken is now the default token for SHA-256 and SHA-512. In previous versions of NSS, these algorithms would be handled by the most recently added PKCS#11 token that su...
NSS 3.14.3 release notes
ploit timing differences in MAC processing. The details of their research and the attack can be found at http://www.isg.rhul.ac.uk/tls/, and has been referred to as "Lucky Thirteen". NSS 3.14.3 includes changes to the softoken and ssl libraries to address and mitigate these attacks, contributed by Adam Langley of Google. This attack is mitigated when using NSS 3.14.3 with an NSS Cryptographic
Module ("softoken") version 3.14.3 or later. However, this attack is only partially mitigated if NSS 3.14.3 is used with the current FIPS validated NSS Cryptographic
Module, version 3.12.9.1. Bug 840714 - "certutil -a" was not correctly producing ASCII output as requested. Bug 837799 - NSS 3.14.2 broke compilation with older versions of sqlite that lacked the SQLITE_FCNTL_TEMPFILENAME file contro...
NSS 3.14 release notes
s feature should be considered "experimental" and may contain bugs. The following functions have been added to the libssl library included in NSS 3.14: DTLS_ImportFD (in ssl.h) DTLS_GetHandshakeTimeout (in ssl.h) SSL_GetSRTPCipher (in ssl.h) SSL_SetRTPCiphers (in ssl.h) Support for AES-GCM Support for AES-GCM has been added to the NSS PKCS #11
module (softoken), based upon the draft 7 of PKCS #11 v2.30. WARNING: Because of ambiguity in the current draft text, applications should ONLY use GCM in single-part mode (C_Encrypt/C_Decrypt). They should NOT use multi-part APIs (C_EncryptUpdate/C_DecryptUpdate). Support for application-defined certificate chain validation callback when using libpkix To better support per-app...
NSS 3.15 release notes
SECITEM_ReallocItem is now deprecated. Please consider using SECITEM_ReallocItemV2 in all future code. NSS has migrated from CVS to the Mercurial source control management system. Updated build instructions are available at Migration to HG As part of this migration, the source code directory layout has been re-organized. The list of root CA certificates in the nssckbi
module has been updated. The default implementation of SSL_AuthCertificate has been updated to add certificate status responses stapled by the TLS server to the OCSP cache. Applications that use SSL_AuthCertificateHook to override the default handler should add appropriate calls to SSL_PeerStapledOCSPResponse and CERT_CacheOCSPResponseFromSideChannel. Bug 554369: Fixed correctness of ...
NSS 3.16.1 release notes
Fixed" section below. Distribution Information The HG tag is NSS_3_16_1_RTM. NSS 3.16.1 requires NSPR 4.10.5 or newer. NSS 3.16.1 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_16_1_RTM/src/ New in NSS 3.16.1 New Functionality Added the "ECC" flag for modutil to select the
module used for elliptic curve cryptography (ECC) operations. New Functions in pk11pub.h PK11_ExportDERPrivateKeyInfo and PK11_ExportPrivKeyInfo - exports a private key in a DER-encoded ASN.1 PrivateKeyInfo type or a SECKEYPrivateKeyInfo structure. Only RSA private keys are supported now. in secmod.h SECMOD_InternalToPubMechFlags - converts from NSS-internal to public representation...
NSS 3.16 release notes
FC 6125, Section 7.2. Bug 962760: libpkix should not include the common name of CA as DNS names when evaluating name constraints. Bug 981170: AESKeyWrap_Decrypt should not return SECSuccess for invalid keys. Bug 974693: Fix a memory corruption in sec_pkcs12_new_asafe. Bug 956082: If the NSS_SDB_USE_CACHE environment variable is set, skip the runtime test sdb_measureAccess. The built-in roots
module has been updated to version 1.97, which adds, removes, and distrusts several certificates. The atob utility has been improved to automatically ignore lines of text that aren't in base64 format. The certutil utility has been improved to support creation of version 1 and version 2 certificates, in addition to the existing version 3 support. Bugs fixed in NSS 3.16 This Bugzilla query returns all ...
NSS 3.17.4 release notes
t have any common protocol version enabled, NSS has been changed to report error code SSL_ERROR_UNSUPPORTED_VERSION (instead of reporting SSL_ERROR_NO_CYPHER_OVERLAP). Bug 1112461: libpkix was fixed to prefer the newest certificate, if multiple certificates match. Bug 1094492: fixed a memory corruption issue during failure of keypair generation. Bug 1113632: fixed a failure to reload a PKCS#11
module in FIPS mode. Bug 1119983: fixed interoperability of NSS server code with a LibreSSL client. Bugs fixed in NSS 3.17.4 This Bugzilla query returns all the bugs fixed in NSS 3.17.4: https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&classification=Components&query_format=advanced&product=NSS&target_milestone=3.17.4 Compatibility NSS 3.17.4 shared libraries are backward compatible with...
NSS 3.30 release notes
is a minor release. Distribution information The hg tag is NSS_3_30_RTM. NSS 3.30 requires Netscape Portable Runtime (NSPR); 4.13.1 or newer. NSS 3.30 source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_30_RTM/src/ New in NSS 3.30 New Functionality In the PKCS#11 root CA
module (nssckbi), CAs with positive trust are marked with a new boolean attribute, CKA_NSS_MOZILLA_CA_POLICY, set to true. Applications that need to distinguish them from other other root CAs, may use the exported function PK11_HasAttributeSet. Support for callback functions that can be used to monitor SSL/TLS alerts that are sent or received. New Functions in cert.h CERT_CompareAVA - perfo...
NSS 3.31 release notes
rtIsPerm - retrieve the permanent storage status attribute of a certificate in a thread safe way. CERT_GetCertIsTemp - retrieve the temporary storage status attribute of a certificate in a thread safe way. in pk11pub.h PK11_FindCertFromURI - find a certificate identified by the given URI. PK11_FindCertsFromURI - find a list of certificates identified by the given URI. PK11_Get
ModuleURI - retrieve the URI of the given
module. PK11_GetTokenURI - retrieve the URI of a token based on the given slot information. in pkcs11uri.h PK11URI_CreateURI - create a new PK11URI object from a set of attributes. PK11URI_DestroyURI - destroy a PK11URI object. PK11URI_FormatURI - format a PK11URI object to a string. PK11URI_GetPathAttribute - retrieve a path attribute wi...
NSS 3.39 release notes
to delete an orphan private key from an NSS key database. Added the nss-policy-check utility, which can be used to check an NSS policy configuration for problems. A PKCS#11 URI can be used as an identifier for a PKCS#11 token. New Functions in cert.h CERT_GetCertKeyType - Query the Key Type associated with the given certificate. utilpars.h NSSUTIL_AddNSSFlagTo
ModuleSpec - A helper function for modifying the PKCS#11
module configuration. It can be used to add a single flag to the Flags= section inside the spec's NSS= section. Notable Changes in NSS 3.39 The TLS 1.3 implementation uses the final version number from RFC 8446. Previous versions of NSS accepted an RSA PKCS#1 v1.5 signature where the DigestInfo structure was missing the NULL parameter. ...
NSS 3.45 release notes
09432 - De-duplicate code between mp_set_long and mp_set_ulong Bug 1515011 - Fix a mistake with ChaCha20-Poly1305 test code where tags could be faked. ...
NSS 3.52 release notes
variable 'getauxval' error on iOS compilation. Bug 1630721 - Add Softoken functions for FIPS. Bug 1630458 - Fix problem of GYP MSVC builds not producing debug symbol files. Bug 1629663 - Add IKEv1 Quick Mode KDF. Bug 1629661 - MPConfig calls in SSL initialize policy before NSS is initialized. Bug 1629655 - Support temporary session objects in ckfw. Bug 1629105 - Add PKCS11 v3.0 functions to
module debug logger. Bug 1626751 - Fix error in generation of fuzz32 docker image after updates. Bug 1625133 - Fix implicit declaration of function 'getopt' error. Bug 1624864 - Allow building of gcm-arm32-neon on non-armv7 architectures. Bug 1624402 - Fix compilation error in Firefox Android. Bug 1624130 - Require CK_FUNCTION_LIST structs to be packed. Bug 1624377 - Fix clang warning for unknown ...
Enc Dec MAC Output Public Key as CSR
with extension ".enc" */ strcpy(encryptedFileName, progName); strcat(encryptedFileName, ".enc"); PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); /* Open DB for read/write and authenticate to it. ...
Enc Dec MAC Using Key Wrap CertReq PKCS10 CSR
ate(optstate); if (cmd == UNKNOWN || !dbdir) Usage(progName); /* Open DB for read/write and authenticate to it */ PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); initialized = PR_TRUE; rv = NSS_InitReadWrite(dbdir); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "NSS_InitReadWrite Failed\n"); goto cleanup; } PK11_SetPasswordFunc(Get
ModulePassword); slot = PK11_GetInternalKeySlot(); if (PK11_NeedLogin(slot)) { rv = PK11_Authenticate(slot, PR_TRUE, &pwdata); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Could not authenticate to token %s.\n", PK11_GetTokenName(slot)); goto cleanup; } } switch (cmd) { case GENERATE_CSR: Val...
sample2
R_TRUE; break; default: Usage(progName); break; } } PL_DestroyOptState(optstate); if (cmd == UNKNOWN || !dbdir) Usage(progName); /* Open DB for read/write and authenticate to it */ PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); initialized = PR_TRUE; rv = NSS_InitReadWrite(dbdir); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "NSS_InitReadWrite Failed\n"); goto cleanup; } PK11_SetPasswordFunc(Get
ModulePassword); slot = PK11_GetInternalKeySlot(); if (PK11_NeedLogin(slot)) { rv = PK11_Authenticate(slot, PR_TRUE, &pwdata); if (rv != SECSuccess) { PR_fprintf(PR_STDERR, "Could not authenticate to token %s.\n", PK11_GetTokenName(slot)); goto cleanup; } } switch (cmd) { case GENERATE_CSR: ValidateGenerateCSRCommand(progName, dbdir, subject, subjectStr, certReqFileName); /* Generate a CSR */ rv = Creat...
nss tech note6
ifies NSS binaries for any reason after they were built, then : The FIPS 140 mode of operation will no longer work, because the chk files will no longer match the softoken and freebl shared libraries . The softoken and freebl binaries won't match any NSS binaries that may have been submitted to NIST for validation, and thus may not be verified as being the actual FIPS 140 validated cryptographic
module . The only way to meet this requirement is for your application never to modify the NSS binaries. Any offer of binary support that may have been previously made to you by NSS developers is null and void. If your build process modifies NSS libraries in any way (for example, to strip the symbols), it should consider not doing so for the reasons cited above. If you still decide to make unsupported...
nss tech note7
nent, the best known algorithm for computing the private exponent is to factor the modulus. At present 1024 bit and 2048 bit RSA keys are the most common and recommended. To prevent denial-of-service attacks with huge public keys, NSS disallows modulus size greater than 8192 bits. How are these keys created in NSS? There are a few possibilities. RSA key pairs may be generated inside a crypto
module (also known as a token). Use PK11_GenerateKeyPair() to generate a key pair in a crypto
module. Key pairs may be generated elsewhere, exported in encrypted form, and imported into a crypto
module. Public keys may be imported into NSS. Call SECKEY_ImportDERPublicKey() with type=CKK_RSA to import a DER-encoded RSA public key. If you have the modulus and public exponent, you need to first encode th...
PKCS11
PKCS #11 information for implementors of cryptographic
modules: Implementing PKCS11 for NSS PKCS11 FAQ Using the JAR Installation Manager to Install a PKCS #11 Cryptographic
Module PKCS #11 Conformance Testing ...
FC_CloseAllSessions
Name FC_CloseAllSessions - close all sessions between an application and a token. Syntax CK_RV FC_CloseAllSessions( CK_SLOT_ID slotID ); Parameters slotID [in] the ID of the token's slot. Description FC_CloseAllSessions closes all sessions between an application and the token in the slot with the ID slotID. The NSS cryptographic
module currently doesn't call the surrender callback function Notify. (See PKCS #11 v2.20 section 11.17.1.) A user may call FC_CloseAllSessions without logging into the token (to assume the NSS User role). Return value Examples See also FC_CloseSession, NSC_CloseAllSessions ...
FC_Finalize
If the library is not initialized, it does nothing. The pReserved argument is not used and must be NULL. Return value FC_Finalize always returns CKR_OK. ...
FC_GetFunctionList
r to the list of function pointers in the FIPS mode of operation. Syntax CK_RV FC_GetFunctionList(CK_FUNCTION_LIST_PTR *ppFunctionList); Parameters FC_GetFunctionList has one parameter: ppFunctionList [Output] The address of a variable that will receive a pointer to the list of function pointers. Description FC_GetFunctionList stores in *ppFunctionList a pointer to the NSS cryptographic
module's list of function pointers in the FIPS mode of operation. A user may call FC_GetFunctionList without logging into the token (to assume the NSS User role). Return value FC_GetFunctionList always returns CKR_OK. Examples #include <assert.h> CK_FUNCTION_LIST_PTR pFunctionList; CK_RV crv; crv = FC_GetFunctionList(&pFunctionList); assert(crv == CKR_OK); /* invoke the FC_XXX function as pFunc...
FC_GetSessionInfo
CK_RV FC_GetSessionInfo( CK_SESSION_HANDLE hSession, CK_SESSION_INFO_PTR pInfo ); Parameters hSession [in] the open session handle. pInfo [out] pointer to the CK_SESSION_INFO structure to be returned. Description FC_GetSessionInfo obtains information about a session. A user may call FC_GetSessionInfo without logging into the token (to assume the NSS User role). If the NSS cryptographic
module is in the error state, FC_GetSessionInfo returns CKR_DEVICE_ERROR. Otherwise, it fills in the CK_SESSION_INFO structure with the following information: state: the state of the session, i.e., no role is assumed, the User role is assumed, or the Crypto Officer role is assumed flags: bit flags that define the type of session CKF_RW_SESSION (0x00000002): true if the session is read/write; false i...
FC_GetTokenInfo
ample, 8.3 (major=0x08, minor=0x03), which are the version numbers of the certificate and key databases, respectively. firmwareVersion: firmware version number, 0.0 (major=0x00, minor=0x00). A user may call FC_GetTokenInfo without logging into the token (to assume the NSS User role). Return value CKR_OK Token information was successfully copied. CKR_CRYPTOKI_NOT_INITIALIZED The PKCS #11
module library is not initialized. CKR_SLOT_ID_INVALID The specified slot number is out of the defined range of values. FC_GetTokenInfo should return CKR_ARGUMENTS_BAD if pInfo is NULL. Examples Note the use of the %.32s format string to print the label and manufacturerID members of the CK_TOKEN_INFO structure. See also FC_GetSlotInfo, NSC_GetTokenInfo ...
FC_InitPIN
the PIN. Description FC_InitPIN() initializes the normal user's PIN. FC_InitPIN() must be called when the PKCS #11 Security Officer (SO) is logged into the token and the session is read/write, that is, the session must be in the "R/W SO Functions" state (CKS_RW_SO_FUNCTIONS). The role of the PKCS #11 SO is to initialize a token and to initialize the normal user's PIN. In the NSS cryptographic
module, one uses the empty string password ("") to log in as the PKCS #11 SO. The
module only allows the PKCS #11 SO to log in if the normal user's PIN has not yet been set or has been reset. Return value FC_InitPIN() returns the following return codes. CKR_OK: normal user's PIN initialization succeeded. CKR_SESSION_HANDLE_INVALID: the session handle is invalid. CKR_USER_NOT_LOGGED_IN: the sessio...
FC_Login
s FC_Login() takes four parameters: hSession [in] a session handle userType [in] the user type (CKU_SO or CKU_USER) pPin [in] a pointer that points to the user's PIN ulPinLen [in] the length of the PIN Description FC_Login() logs a user into a token. The Security Officer (CKU_SO) only logs in to initialize the normal user's PIN. The SO PIN is the empty string. The NSS cryptographic
module doesn't allow the SO to log in if the normal user's PIN is already initialized. Return value FC_Login() returns the following return codes. CKR_OK: the user logged in successfully. CKR_DEVICE_ERROR: the token is in the Error state. CKR_HOST_MEMORY: memory allocation failed. CKR_PIN_INCORRECT: the PIN is incorrect. CKR_PIN_LEN_RANGE: the PIN is too long (ulPinLen is greater than 255). T...
FC_OpenSession
hSession ); Parameters FC_OpenSession has the following parameters: slotID [in] the ID of the token's slot. flags [in] pApplication Notify [in] pointer to a notification callback function. Not currently supported. phSession [out] pointer to a session handle. Description FC_OpenSession opens a session between an application and the token in the slot with the ID slotID. The NSS cryptographic
module currently doesn't call the surrender callback function Notify. (See PKCS #11 v2.20 section 11.17.1.) A user may call FC_OpenSession without logging into the token (to assume the NSS User role). Return value Examples See also FC_CloseSession, NSC_OpenSession ...
FC_SeedRandom
ameters hSession [in] session handle. pSeed [in] pointer to the seed material usSeedLen [in] length of the seed material in bytes. Description FC_SeedRandom() mixes additional seed material into the token's random number generator. Note that FC_SeedRandom() doesn't provide the initial seed material for the random number generator. The initial seed material is provided by the NSS cryptographic
module itself. A user may call FC_SeedRandom() without logging into the token (to assume the NSS User role). Return value Examples See also NSC_SeedRandom ...
FC_WaitForSlotEvent
Name FC_WaitForSlotEvent - waits for a slot event, such as token insertion or token removal, to occur. Syntax CK_RV FC_WaitForSlotEvent(CK_FLAGS flags, CK_SLOT_ID_PTR pSlot CK_VOID_PTR pReserved); Parameters FC_WaitForSlotEvent takes three parameters: [Input] flags [Input] pSlot. pReserved. Description This function is not supported by the NSS cryptographic
module. Return value FC_WaitForSlotEvent always returns CKR_FUNCTION_NOT_SUPPORTED. Examples See also FC_WaitForSlotEvent ...
NSC_Login
arameters NSC_Login() takes four parameters: hSession [in] a session handle userType [in] the user type (CKU_SO or CKU_USER) pPin [in] a pointer that points to the user's PIN ulPinLen [in] the length of the PIN Description NSC_Login() logs a user into a token. The Security Officer (CKU_SO) only logs in to initialize the normal user's PIN. The SO PIN is the empty string. The NSS cryptographic
module doesn't allow the SO to log in if the normal user's PIN is already initialized. Return value NSC_Login() returns the following return codes. CKR_OK: the user logged in successfully. CKR_DEVICE_ERROR: the token is in the Error state. CKR_HOST_MEMORY: memory allocation failed. CKR_PIN_INCORRECT: the PIN is incorrect. CKR_PIN_LEN_RANGE: the PIN is too long (ulPinLen is greater than 255).The...
NSS Key Functions
ack to the NSS reference main page. SECKEY_GetDefaultKeyDB SECKEY_DestroyPrivateKey SECKEY_GetDefaultKeyDB Returns a handle to the default key database opened by NSS_Init. Syntax include <key.h> include <keyt.h> SECKEYKeyDBHandle *SECKEY_GetDefaultKeyDB(void); Returns The function returns a handle of type SECKEYKeyDBHandle. Description NSS_Init opens the certificate, key, and security
module databases that you specify for use with NSS. SECKEYKeyDBHandle returns a handle to the key database opened by NSS_Init. SECKEY_DestroyPrivateKey Destroys a private key structure. Syntax include <key.h> include <keyt.h> void SECKEY_DestroyPrivateKey(SECKEYPrivateKey *key); Parameter This function has the following parameter: key A pointer to the private key structure to destroy. Description...
NSS tools : crlutil
y or delete certificates entries in a particular CRL. The key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database(see certutil tool) and continues with certificates expiration or revocation. This document discusses certificate revocation list management. For information on security
module database management, see Using the Security
Module Database Tool. For information on certificate and key database management, see Using the Certificate Database Tool. To run the Certificate Revocation List Management Tool, type the command crlutil option [arguments] where options and arguments are combinations of the options and arguments listed in the following section. Each command takes ...
NSS tools : vfychain
Name vfychain -- vfychain [options] [revocation options] certfile [[options] certfile] ... Synopsis vfychain Description The verification Tool, vfychain, verifies certificate chains. modutil can add and delete PKCS #11
modules, change passwords on security databases, set defaults, list
module contents, enable or disable slots, enable or disable FIPS 140-2 compliance, and assign default providers for cryptographic operations. This tool can also create certificate, key, and
module security database files. The tasks associated with security
module database management are part of a process that typically also involves managing key databases and certificate databases. Options -a the following certfile is base64 encoded -b YYMMDDHHMMZ Validate date (default: now) -d directory database director...
OLD SSL Reference
hapter 6 Key Functions This chapter describes two functions used to manipulate private keys and key databases such as the key3.db database provided with Communicator. SECKEY_GetDefaultKeyDB SECKEY_DestroyPrivateKey Chapter 7 PKCS #11 Functions This chapter describes the core PKCS #11 functions that an application needs for communicating with cryptographic
modules. In particular, these functions are used for obtaining certificates, keys, and passwords. PK11_FindCertFromNickname PK11_FindKeyByAnyCert PK11_GetSlotName PK11_GetTokenName PK11_IsHW PK11_IsPresent PK11_IsReadOnly PK11_SetPasswordFunc Chapter 8 NSS and SSL Error Codes NSS error codes are retrieved using th...
pkfnc.html
ing into the format described in the MDN Style Guide. If you are inclined to help with this migration, your help would be very much appreciated. Upgraded documentation may be found in the Current NSS Reference PKCS #11 Functions Chapter 7 PKCS #11 Functions This chapter describes the core PKCS #11 functions that an application needs for communicating with cryptographic
modules. In particular, these functions are used for obtaining certificates, keys, and passwords. PK11_FindCertFromNickname PK11_FindKeyByAnyCert PK11_GetSlotName PK11_GetTokenName PK11_IsHW PK11_IsPresent PK11_IsReadOnly PK11_SetPasswordFunc PK11_FindCertFromNickname Finds a certificate from its nickname. Syntax #include <pk11func.h> #include <certt.h> CERTCertificate *PK11_Find...
sslintro.html
use. Initialization Initialization includes setting up configuration files, setting global defaults, and setting up callback functions. Functions used in the initialization part of an application can include the following: PR_Init. Initializes NSPR. Must be called before any other NSS functions. PK11_SetPasswordFunc. Sets the global callback function to obtain passwords for PKCS #11
modules. Required. NSS_Init. Sets up configuration files and performs other tasks required to run Network Security Services. NSS_Init is not idempotent, so call it only once. Required. SSL_OptionSetDefault. Changes default values for all subsequently opened sockets as long as the application is running (compare with SSL_SetURL which only configures the socket that is currently open). This function...
sslkey.html
rovided with Communicator. SECKEY_GetDefaultKeyDB SECKEY_DestroyPrivateKey SECKEY_GetDefaultKeyDB Returns a handle to the default key database opened by NSS_Init. Syntax #include <key.h> #include <keyt.h> SECKEYKeyDBHandle *SECKEY_GetDefaultKeyDB(void); Returns The function returns a handle of type SECKEYKeyDBHandle. Description NSS_Init opens the certificate, key, and security
module databases that you specify for use with NSS. SECKEYKeyDBHandle returns a handle to the key database opened by NSS_Init. SECKEY_DestroyPrivateKey Destroys a private key structure. Syntax #include <key.h> #include <keyt.h> void SECKEY_DestroyPrivateKey(SECKEYPrivateKey *key); Parameter This function has the following parameter: key A point...
NSS Tools
ks/Plans cmsutil 1.0 Performs basic CMS operations such as encrypting, decrypting, and signing messages. Source, Documentation crlutil Manage certificate revocation lists (CRLs). Source, Documentation, dbck 1.0 Analyze and repair certificate databases (not working in NSS 3.2) Source, Tasks/Plans modutil 1.1 Manage the database of PKCS11
modules (secmod.db). Add
modules and modify the properties of existing
modules (such as whether a
module is the default provider of some crypto service). Source, Documentation, Tasks/Plans pk12util 1.0 Import and export keys and certificates between the cert/key databases and files in PKCS12 format. Source, Documentation, Tasks/Plans signtool 1.3 Create digitally-signed j...
NSS_3.12.3_release_notes.html
NSS_HASH_ALG_SUPPORT String Specifies algorithms allowed to be used in certain applications, such as in signatures on certificates and CRLs. See documentation at this link. NSS_STRICT_NOFORK String ("1", "DISABLED", or any other non-empty value) It is an error to try to use a PKCS#11 crypto
module in a process before it has been initialized in that process, even if the
module was initialized in the parent process. Beginning in NSS 3.12.3, Softoken will detect this error. This environment variable controls Softoken's response to that error. If set to to "1" or unset, Softoken will trigger an assertion failure in debug builds, and will report an error in non-DEBUG ...
NSS Tools crlutil
dify or delete certificates entries in a particular CRL. The key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database(see certutil tool) and continues with certificates expiration or revocation. This document discusses certificate revocation list management. For information on security
module database management, see Using the Security
Module Database Tool. For information on certificate and key database management, see Using the Certificate Database Tool. Availability See the release notes for the platforms this tool is available on. Syntax To run the Certificate Revocation List Management Tool, type the command crlutil option [arguments] where options and arguments are...
NSS tools : crlutil
ertificates entries in a particular CRL. The key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database(see certutil tool) and continues with certificates expiration or revocation. This document discusses certificate revocation list management. For information on security
module database management, see Using the Security
Module Database Tool. For information on certificate and key database management, see Using the Certificate Database Tool. To run the Certificate Revocation List Management Tool, type the command crlutil option [arguments] where options and arguments are combinations of the options and arguments listed in the following section. Each...
NSS tools : vfychain
Name vfychain -- vfychain [options] [revocation options] certfile [[options] certfile] ... Synopsis vfychain Description The verification Tool, vfychain, verifies certificate chains. modutil can add and delete PKCS #11
modules, change passwords on security databases, set defaults, list
module contents, enable or disable slots, enable or disable FIPS 140-2 compliance, and assign default providers for cryptographic operations. This tool can also create certificate, key, and
module security database files. The tasks associated with security
module database management are part of a process that typically also involves managing key databases and certificate databases. Options -a the following certfile is base64 encoded -b YYMMDDHHM...
Necko
d in the Build Documentation. Eventually we'd like to move to a binary distribution mechanism for the networking library so that you can build your application that uses this library without having to build Mozilla. Browse our code in its latest state at netwerk/ Documents A necko code walkthrough Necko Architecture Necko multithreading Necko FAQ Necko Interfaces overview The Necko HTTP
module Proxies in Necko PAC files Community View Mozilla forums... Mailing list Newsgroup RSS feed ...
Statistics API
stats messages to the developer console. The browser preference javascript.options.mem.notify controls emission of JSON encoded GC stats to an observer interface. JSON API Addons can obtain the complete data in JSON format via an observer. The following adds an observer using the JetPack framework. var prefs = require("api-utils/preferences-service"); Components.utils.import('resource://gre/
modules/Services.jsm'); function observer(subject, topic, json) { var data = JSON.parse(json); // process the data } prefs.set("javascript.options.mem.notify", true); Services.obs.addObserver(observer, "garbage-collection-statistics", false); The toplevel JSON object contains these fields: timestamp: integer (microseconds) - Time at which the GC ended, measured from epoch. total_time: num...
SpiderMonkey Internals
structor and destructor are factored out into jscntxt.cpp for minimal linking when the compiler part of JS is split from the interpreter part into a separate program. jsinvoke.cpp is a build hack used on some platforms to build js_Interpret under different compiler options from the rest of jsinterp.cpp. jsemit.*, jsopcode.tbl, jsopcode.*, jsparse.*, jsscan.*, jsscript.* Compiler and decompiler
modules. The jsopcode.tbl file is a C preprocessor source that defines almost everything there is to know about JS bytecodes. See its major comment for how to use it. For now, a debugger will use it and its dependents such as jsopcode.h directly, but over time we intend to extend jsdbgapi.h to hide uninteresting details and provide conveniences. The code generator is split across paragraphs of code in j...
JS_AddExternalStringFinalizer
d from this function, and that understands how to free or release the memory pointed at by JS_GetStringChars(str). Returns a nonnegative type index if there is room for finalizer in the global GC finalizers table, else returns -1. In a JS_THREADSAFE build, this function must be invoked on the primordial thread only, at startup--or else the entire program must single-thread itself while loading a
module that calls this function. To remove an external string finalizer, use JS_RemoveExternalStringFinalizer. See Also JS_RemoveExternalStringFinalizer bug 724810 ...
Profiling SpiderMonkey
uctions 1.) Get yourself an optimized libxul build of Firefox, with debugger info. For the Mac, you'll want to read up on Profiling JavaScript with Shark. Here's a sample mozconfig: mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/ff-opt-libxul mk_add_options MOZ_MAKE_FLAGS=-j3 ac_add_options --enable-optimize ac_add_options --enable-libxul ac_add_options --enable-shark ac_add_options --enable-debugger-info-
modules ac_add_options --enable-application=browser 2.) You'll want to run Shark on both the browser and [xpcshell], since the host environments differ. Here are some instrumented tests to work from: media:Profiling-ammo.zip 3.) Once you have some changes you'd like to try, you can just rebuild the js/src directory, since it produces its own shared library, even in libxul and static builds. make -C my-...
TPS Tests
e logging in all engines. Check the tps.log file written out after TPS runs. It will include log output written by the python driver, which includes information about where the temporary profiles it uses are stored. run test_sync.js. This test generally validates your tps setup and does a light test of a few engines. Comment out the goQuitApplication() calls in services/sync/tps/extensions/tps/
modules/tps.jsm (remember to undo this later!). You will have to manually quit the browser at each phase, but you will be able to inspect the browser state manually. Using this technique in conjunction with aboutsync is helpful. (Note that the python testrunner will generally still kill firefox after a TPS test runs for 5 or so minutes, so it's often helpful to kill the python testrunner outrig...
Mozinfo
the windows platform. API Usage MozInfo is a python package. Downloading the software and running python setup.py develop will allow you to do import mozinfo from python. mozinfo.py is the only file contained is this package, so if you need a single-file solution, you can just download or call this file through the web. The top level attributes (os, version, bits, processor) are available as
module globals: if mozinfo.os == 'win': ... In addition, mozinfo exports a dictionary, mozinfo.info, that contain these values. mozinfo also exports: choices: a dictionary of possible values for os, bits, and processor main: the console_script entry point for mozinfo unknown: a singleton denoting a value that cannot be determined unknown has the string representation "UNKNOWN". unknown will ev...
Redis Tips
nel doesn't have to be created in any way. The subscriber tells you the name of the channel as well as the message it received. I like pie. The return value from publish tells you how many subscribers received your message! So if that's 0, you know nobody's listening. You might use PSUBSCRIBE in a case where you have message channels named according to application namespaces, as different
modules or logging systems might do. In that case, just check the name of the channel on the received message. Subscribe with one client: redis1> psubscribe log.* 1) "psubscribe" 2) "log.*" 3) (integer) 1 Publish with another client: redis2> publish log.bacon yes publish log.bacon yes (integer) 1 See message received in first client: redis1> 1) "pmessage" 2) "log.*" 3) "log.bacon" 4) "yes" Pu...
Setting up an update server
7.0.0.1:8000/update.xml and make sure that you get the XML file you created earlier. Installing the update You may want to start by deleting any pending updates to ensure that no previously found updates interfere with installing the desired update. You can use this command with Firefox's browser console to determine the update directory: const {FileUtils} = ChromeUtils.import("resource://gre/
modules/FileUtils.jsm"); FileUtils.getDir("UpdRootD", [], false).path Once you have determined the update directory, close Firefox, browse to the directory and remove the subdirectory called updates. Next, you need to change the update URL to point to the local XML file. This can be done most reliably with an enterprise policy. The policy file location depends on the operating system you are using. W...
Querying Places
tory service: nsINavHistoryService, executes the query The first first step is to create the query and options, and fill them with the parameters you want. Use nsINavHistoryService.getNewQuery() and nsINavHistoryService.getNewQueryOptions() to retrieve empty objects. The defaults for these objects will result in a query that returns all of your browser history in a flat list: ChromeUtils.define
ModuleGetter(this, "PlacesUtils", "resource://gre/
modules/PlacesUtils.jsm"); // No query options set will get all history, sorted in database order, // which is nsINavHistoryQueryOptions.SORT_BY_NONE. let options = PlacesUtils.history.getNewQueryOptions(); // No query parameters will return everything let query = PlacesUtils.history.getNewQuery(); // execute the query l...
Using the Places keywords API
iffer. Keywords in Firefox are currently created through the Add Keyword For this search contextual menu option in form text fields. Note this is the same feature previously known as Bookmark keywords, the key difference is that keywords are not bound to a specific bookmark, but to a specific URL. Using the keywords API The keywords API is a promise-based API available through the PlacesUtils
module: Components.utils.import("resource://gre/
modules/XPCOMUtils.jsm"); XPCOMUtils.defineLazy
ModuleGetter(this, "PlacesUtils", "resource://gre/
modules/PlacesUtils.jsm"); Setting a keyword for an URL The insert() method accepts a keyword entry object describing the keyword to insert. It has the following properties: keyword: string representing the keyword url: either a URL or spec represeting ...
Making cross-thread calls using runnables
se of failure, call back immediately with an empty string which indicates failure callback(EmptyCString()); return; } nsCOMPtr<nsIRunnable> r = new PiCalculateTask(callback, digits); mythread->Dispatch(r, nsIEventTarget::DISPATCH_NORMAL); // The result callback will shut down the worker thread, we can let it go here... } See also ChromeWorker Using workers in JavaScript code
modules The Thread Manager ...
Mozilla internal string guide
will flag this as an error at build time. For example: void nsFoo::ReverseCharacters(nsAString& str) { ... str.Assign(reversedStr); // modifies the string } This should not compile, because you're assigning to a const class: void nsFoo::ReverseCharacters(const nsAString& str) { ... str.Assign(reversedStr); } As function parameters For methods which are exposed across
modules, use nsAString references to pass strings. For example: // when passing a string to a method, use const nsAString& nsFoo::PrintString(const nsAString &str); // when getting a string from a method, use nsAString& nsFoo::GetString(nsAString &result); The abstract classes are also sometimes used to store temporary references to objects. You can see both of these uses in Common Patterns, below. ...
XPCOM guide
That's not inherently multiple inheritance, though, because you only mix in interfaces (i.e. the problem would not exist with ...
Components.utils
ponents. getGlobalForObject() Returns the global object with which a given object is associated (through its prototype chain at birth, for example). getJSTestingFunctions() getObjectPrincipal() Gets the nsIPrincipal for the given JavaScript object. getWeakReference() Gets a weak reference for the object passed in. import() Loads a JS
module into the current script, without sharing a scope. importGlobalProperties() Specify a list of constructors to import into the scope. isXrayWrapper() Test whether a given object is an Xray or not. unload() Unloads a JS
module loaded with import(). isDeadWrapper() Determines whether this object is backed by a DeadObjectProxy. lookupMethod(...
Components object
un 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 Java...
HOWTO
callbacks where your script is finished, i.e. both success and error callbacks, put: gScriptDone = true; If you forget some condition where your script should exit but you don't add this statement, your script will hang (busy wait). This is of course a massive, ugly hack prone to error, but this is what the xpcshell test harness does. There should really be a better solution in xpcshell. Using JS
modules and non-UI JavaScript chrome files Problem You want to write a JavaScript file, and run it in xpcshell. The file uses JS
modules. Maybe it even uses JavaScript files from chrome:// URLs. E.g., you use: Components.utils.import("resource://app/
modules/gloda/log4moz.js"); However, you get (for that particular line, which is the first import): uncaught exception: [Exception... "Component returned f...
Profiling XPCShell
You could use Venkman for that. But sometimes, Venkman gives too much noise (because it also profiles chrome code). Or you might want to have a more reproducible testcase. In those cases, an xpcshell script can help. You can just call the code you want to test. But then, you can't use the Venkman UI. XPCTools There is profiler in the tree that can profile xpcshell scripts. ...
xpcshell
et statement introduced in JavaScript 1.7, are not available. To rectify this, run xpcshell with the -v 180 command-line option, which tells xpcshell to use JavaScript 1.8. Example You can input JavaScript, straight to Mozilla. js> 5+7 12 js> print("Hello, world!") Hello, world! js> See also HOWTO for common problems in writing xpcshell scripts, e.g., doing async network calls or using JS
modules. Pretty much all Mozilla programs use XPCOM components via XPConnect. Read XPConnect:Using components to get started with that. See the XPCShell Reference for information on command line arguments and extension functions. Learn how to write xpcshell-based unit tests. Read XPCShell:Profiling for information on how to profile scripts. ...
Observer Notifications
ontaining two properties: event The event that triggered the context menu. addonInfo An empty object that add-ons can use to send data to the main process. null This notification is sent when the context menu is displayed. It is sent, and received, in the content process: you can't listen to it in the chrome process. It's used by the context-menu
module in the Add-on SDK, to help send information to the context-menu code running in the chrome process when a context menu is displayed. ...
Core XPCOM functions
NS_NewLocalFileThe NS_NewLocalFile function creates an instance of nsILocalFile that provides a platform independent representation of a file path.NS_NewNativeLocalFileThe NS_NewNativeLocalFile function creates an instance of nsILocalFile that provides a platform independent representation of a file path.NS_ReallocReallocates a block of memory using the XPCOM memory manager.NS_ShutdownXPCOM...
imgIDecoder
Inherits from: nsISupports Last changed in Gecko 1.7 This interface is the base class for decoders for specific image formats. Method overview void close(); void flush(); void init(in imgILoad aLoad); unsigned long writeFrom(in nsIInputStream inStr, in unsigned long count); Methods close() Closes the stream. void close(); Parameters None. flush() Flushes the stream. void flush(); Parameters None. init() Initializes an image decoder. void init( in imgILoad aLoad ); Parameters aLoad An imgILoad object to receive the decoded image data. ...
imgIEncoder
modules/libpr0n/public/imgIEncoder.idlScriptable Please add a summary to this article. 1.0 66 Introduced Gecko 1.8 Inherits from: nsIAsyncInputStream Last changed in Gecko 1.9 (Firefox 3) Method overview void addImageFrame( [array, size_is(length), const] in PRUint8 data, in unsigned long length, in PRUint32 width, in PRUint32 height, in PRUint32 stride, in PRUint32 frameFormat, in AString frameOptions); void encodeClipboardImage(in nsIClipboardImage aClipboardImage, out nsIFile aImageFile); Obsolete since Gecko 1.9 void endImageEncode(); void initFromData([array, size_is(length), const] in PRUint8 data, in unsigned long length, in PRUint32 width, in PRUint32 height, in PRUint32 stride, in PRUint32 inputFormat, in AString outputOptions); void...
imgILoader
modules/libpr0n/public/imgILoader.idlScriptable Please add a summary to this article. Inherits from: nsISupports Last changed in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5) Implemented by @mozilla.org/image/loader;1 as a service: var imgILoader = Components.classes["@mozilla.org/image/loader;1"] .getService(Components.interfaces.imgILoader); Method overview imgIRequest loadImage(in nsIURI aURI, in nsIURI aInitialDocumentURL, in nsIURI aReferrerURI, in nsIPrincipal aLoadingPrincipal, in nsILoadGroup aLoadGroup, in imgIDecoderObserver aObserver, in nsISupports aCX, in nsLoadFlags aLoadFlags, in nsISupports cacheKey, in imgIRequest aRequest, in nsIChannelPolicy channelPolicy); imgIRequest loadImageWithChannel(in nsIChannel aChannel, in imgIDecoder...
imgIRequest
Inherits from: nsIRequest Last changed in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5) Method overview void cancelAndForgetObserver(in nsresult aStatus); imgIRequest clone(in imgIDecoderObserver aObserver); void decrementAnimationConsumers(); imgIRequest getStaticRequest(); void incrementAnimationConsumers(); void lockImage(); void requestDecode(); void unlockImage(); Attributes Attribute Type Description CORSMode long The CORS mode that this image was loaded with. Read only. decoderObserver imgIDecoderObserver Read only. image imgIContainer The image container. Read only. ...
mozIRegistry
ision such services to be based on the mozIRegistry interface. In other words, they will implement, as Rick suggested last week, _protocol_ on top of the registry and repository. I think it might be useful to refactor the nsRepository code so that it is structured the same way as the Service Manager. One could then make the nsRepository itself a service and permit full (?!) de-coupling of XPCOM
modules from the XPCOM implementation. mozIRegistry This is the new interface that will surface essentially the same function as is currently provided by libreg (aka "netscape registry") as declared in mozilla/
modules/libreg/include/NSReg.h. Clients will obtain this interface via the service manager (see mozilla/xpcom/public/nsIServiceManager.h). mozRegistry This is the simplistic implementation o...
nsIAccessibleSelectable
Inherits from: nsISupports Last changed in Gecko 1.7 Method overview void addChildToSelection(in long index); void clearSelection(); nsIArray GetSelectedChildren(); boolean isChildSelected(in long index); nsIAccessible refSelection(in long index); void removeChildFromSelection(in long index); boolean selectAllSelection(); Attributes Attribute Type Description selectionCount long The number of accessible children currently selected. Read only. ...
nsIClassInfo
fies that this class implements nsIContent. Note: This flag is private and is for use by the Mozilla codebase only. RESERVED 1 << 31 The high order bit is RESERVED for consumers of these flags. No implementor of this interface should ever return flags with this bit set. EAGER_CLASSINFO 1 << 5 This flag is designed for use with nsGenericFactory and can be set in ns
ModuleComponentInfo::mFlags. It has no meaning when returned from the flags attribute of a nsIClassInfo implementation. Obsolete since Gecko 2.0 Methods getHelperForLanguage() Get a language mapping specific helper object that may assist in using objects of this class in a specific lanaguage. For example, if asked for the helper for nsIProgrammingLanguage::JAVASCRIPT this might return an objec...
nsICookieStorage
Obsolete since Gecko 2 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. This interface represents the storage repository for cookies.
modules/plugin/base/public/nsICookieStorage.idlNot scriptable Please add a summary to this article. Last changed in Gecko 1.7 Inherits from: nsISupports Method overview void getCookie(in string aCookieURL, in voidPtr aCookieBuffer, in PRUint32Ref aCookieSize); void setCookie(in string aCookieURL, in constVoidPtr aCookieBuffer, in unsigned long aCookieSize); Methods getCookie() Retrieves a cookie from the browser's persistent cookie store. void getCookie( in string aCookieURL, in ...
nsIDOMClientRect
of the rectangle box. Read only. width float Width of the rectangle box (This is identical to right minus left). Read only. x float X-coordinate, relative to the viewport origin, of the left of the rectangle box. Read only. y float Y-coordinate, relative to the viewport origin, of the top of the rectangle box. Read only. See also CSSOM View
Module : The ClientRect InterfaceWD This object was renamed a few times: initial name was TextRectangle, then ClientRect, then DOMRect. Initially it had just the top/left/right/bottom attributes, then width/height/x/y were added. ...
nsIFile
the native form limits the ability of your code to deal with the full Unicode support on Windows 2000 or later where the OS itself does not have such a limitation. Therefore, you must not use the native form unless it is guaranteed that the path passed to a native form function is always ASCII. To create an nsIFile from a path you can use FileUtils.jsm: var FileUtils = Cu.import("resource://gre/
modules/FileUtils.jsm").FileUtils var nsifile = new FileUtils.File( fileName ) Note: nsILocalFile was merged with this interface in Gecko 14. Much of the documentation has not been updated to reflect this change. Method overview void append(in AString node); void appendNative(in ACString node); Native code only! void appendRelativeNativePath(in ACString relativeFilePath)...
nsITraceableChannel
rticular, listeners typically should not be replaced after onStartRequest has been called. Example This example can be copied and pasted into a JavaScript interpreter and run. This example uses Promise syntax that is available in Firefox 30 and onwards. ...
nsIVersionComparator
ns(a,b) { var x = Services.vc.compare(a,b); if(x == 0) return a + "==" + b; else if(x > 0) return a + ">" + b; return a + "<" + b; } dump(compareVersions("1.0pre", "1.0")); Example - Compare current browser version This example here uses nsIXULAppInfo component to get the version of the browser that the code is running in. ...
nsIWebProgressListener
s using the WebProgress, use // the outerWindowID. This can be communicated back down to the content // in order to do send a command to a particular DOM Window. ...
nsIXMLHttpRequest
ning a simple HTTP request from a xul application (like a Mozilla extension) without using observers: var req = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(); req.open('POST', "http://www.foo.bar:8080/nietzsche.do", true); req.send('your=data&and=more&stuff=here'); Example 2 var {Cu: utils, Cc: classes, Ci: instances} = Components; Cu.import('resource://gre/
modules/Services.jsm'); function xhr(url, cb) { let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest); let handler = ev => { evf(m => xhr.removeEventListener(m, handler, !1)); switch (ev.type) { case 'load': if (xhr.status == 200) { cb(xhr.response); break; ...
nsIZipReaderCache
Inherits from: nsISupports Last changed in Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7) Implemented by: @mozilla.org/libjar/zip-reader-cache;1. ...
Using the Gecko SDK
rozen by default and are not marked as such in the respective header files.) The glue library exists to make common tasks easier. For example, the nsCOMPtr class is defined in the XPCOM glue library. If your component does not use any of the glue classes or functions, then you do not need to link against the glue library. Work in progress... Linking (Link line, version script to only expose NSGet
Module, etc.) ...
Working with Multiple Versions of Interfaces
In the extension that prompted this note, I needed to obtain the HWND of the document (yes its on Windows) in order to identify each particular extension instance. To do this I used the accessibility framework: HWND getHwnd(nsIDOMNode *node){ HWND self = NULL; nsresult rv; nsCOMPtr<nsIAccessibleRetrieval> refp; refp = do_CreateInstance( "@mozilla.org/accessibleRetrieval;1", &rv); if (NS_FAILED(rv)){ return self; } //line 6. ...
XPIDL Syntax
rens = "(" 1*(any char except ")") ")" Functionality not used in xpidl The libIDL parser we use is more powerful than xpidl itself can understand. The following is a list of potential features which are parseable but may not result in expected code: Struct, union, and enumerated types Array declarators (appears to be supported in xpidl_header.c but not xpidl_typelib.c) Exception declarations
Module declarations Variable arguments (that makes the ABNF get more wonky) Sequence types Max-length strings Fixed-point numbers "any" and "long double" types. Pyxpidl syntax idlfile = *(CDATA / INCLUDE / interface / typedef / native) typedef = "typedef" IDENTIFER IDENTIFIER ";" native = [attributes] "native" IDENTIFIER "(" NATIVEID ")" interface = [attributes] "interface" IDENTIFIER" [iface...
XSLT 2.0
refox's own XSLT 1.0 processor). For developers Saxon-CE A JavaScript API is provided for initiating an XSLT 2.0 transform from a web page. Error and diagnostics output from Saxon-CE can be reviewed in the Firefox developer console or in Firebug. Saxon-B The extension demonstrates how one can use LiveConnect code to communicate with the Saxon-B library, but one might find the JavaScript code
module approach used inside the extension XqUSEme as a more reusable approach. The code does not currently work on the Mac (except for server edition supporting Java 1.6) due to its lagging Java support (and thus LiveConnect support). ...
Creating a gloda message query
loda, Thunderbird's global database. See the gloda page for background on the component. See Gloda examples for more code samples. Creating your first message query... Import gloda Gloda's API is exposed in the "Gloda" object that is contributed to your namespace. You can find the file, which includes doxygen markup of sorts, here: https://hg.mozilla.org/comm-central/file/tip/mailnews/db/gloda/
modules/gloda.js Components.utils.import("resource:///
modules/gloda/public.js"); Create the query let query = Gloda.newQuery(Gloda.NOUN_MESSAGE); Add constraints to the query Each constraint function takes one or more arguments which are "OR"ed together. So if we had a "color" constraint such as query.color("red", "green", "blue") would mean any of red, green, or blue is okay. Constraints are "AND...
Demo Addon
vered in this article are in the content folder. The toolbar button and its functionality are defined in overlay.xul and overlay.js. We make use of fixIterator(). It is a handy library that keeps your code cleaner and simpler. It lets you iterate over any collection and transforms your collection elements in the given objects, To use fixIterator, you have to import it with Cu.import("resource:///
modules/iteratorUtils.jsm");. Demo 1 - Iterate over all the accounts This demo is implemented in demo1.html in the content folder. It lists all your email accounts with their account type - either pop3 or imap - and the associated email addresses. let data = []; for each (let account in fixIterator(MailServices.accounts.accounts, Ci.nsIMsgAccount)) { let info = { server: null, typ...
Folders and message lists
ot be possible for large selections). gFolderDisplay.clearSelection(): Clears the list of selected messages. Listing Messages in a Folder If you have a message folder, and would like to list all the messages in that folder, you can use the .messages attribute, which returns an nsISimpleEnumerator. It's used like this: // Import the fixIterator() function. Components.utils.import("resource:///
modules/iteratorUtils.jsm"); for (let msgHdr in fixIterator(myFolder.messages, Components.interfaces.nsIMsgDBHdr)) { // Do something with msgHdr... } ...
Using Mozilla code in other projects
There are several ways you can use Mozilla code in your own project. Mozilla provides a development platform for desktop applications, called XUL, atop which you can build applications. Various components of the platform, such as the SpiderMonkey JavaScript engine, can be used in your own projects without the rest of the platform. There are also
modules that aren't used in Firefox but are available for use by other applications; an example of this is Rhino, the JavaScript engine written in Java. You can embed Gecko, the layout engine used by Firefox to process web pages, as a browser within your own application. Building XUL applications The Joy of XUL An introduction to XUL; a must read for new developers. XUL Reference The complete refere...
WebIDL bindings
ionChecker is a function implemented in C++ that returns true if the interface should be enabled. This function can do whatever checking is needed. One example of this is PushManager. Example Here's an example JS implementation of the above interface. The invisibleValue field will not be accessible to web content, but is usable by the doNothing() method. ...
Zombie compartments
o zones, compartments, DOM etc. When are compartments created? Any compartments with the following forms are created by Firefox for its own internal use, and can usually be ignored when looking for zombie compartments. js-compartment([System Principal], 0x7f10f1250000) compartment(atoms) js-compartment(about:home) js-compartment(about:blank) compartment([System Principal], resource://gre/
modules/addons/XPIProvider.jsm) When looking at user compartments there are a couple of things to be aware of. First, many sites utilize scripts from other sites to provide advertisements, "like" and "+1" buttons, Twitter feeds, etc. So it's common for multiple compartments to be created for a single web page. For example, if I open www.techcrunch.com the following compartments are created. comp...
Using COM from js-ctypes
functions Needs COM types (GUID) and functions (CoInitialize etc) description here. Converted js-ctypes code Here's converted code. This example uses busy loop and thus Firefox won't respond until the speaking is done. If this code were used in a production add-on, then to avoid Firefox locking up, run this code from a ChromeWorker. ...
ctypes.open
(jar:). If the addon is an unpacked addon, such as bootstrap or Add-on SDK addons, the JAR path must be used. Therefore, the path has to be converted and then the converted path is used for loading with ctypes.open. ...
Constants - Plugins
program definitions are found in npapi.h. Error Codes Code Value Description NPERR_NO_ERROR 0 No errors occurred. NPERR_GENERIC_ERROR 1 Error with no specific error code occurred. NPERR_INVALID_INSTANCE_ERROR 2 Invalid instance passed to the plug-in. NPERR_INVALID_FUNCTABLE_ERROR 3 Function table invalid. NPERR_
MODULE_LOAD_FAILED_ERROR 4 Loading of plug-in failed. NPERR_OUT_OF_MEMORY_ERROR 5 Memory allocation failed. NPERR_INVALID_PLUGIN_ERROR 6 Plug-in missing or invalid. NPERR_INVALID_PLUGIN_DIR_ERROR 7 Plug-in directory missing or invalid. NPERR_INCOMPATIBLE_VERSION_ERROR 8 Versions of plug-in and Communicator do not match. NPERR_INV...
Plug-in Development Overview - Plugins
erences a file of that type), from a separate non-HTML file of that MIME type, or from the server. The server looks for the MIME type registered by a plug-in, based on the file extension, and starts sending the file to the browser. The browser looks up the media type, and if it finds a plug-in registered to that type, loads the plug-in software. When it starts up, the browser checks for plug-in
modules for the platform and registers them. It determines which plug-ins are installed and which types they support through a combination of user preferences that are private to the browser, the contents of the plug-ins directory, or the registry on Windows. A MIME type is made up of a major type (such as application or image) and a minor type, for example, image/jpeg. If you define a new MIME type fo...
Debugger.Frame - Firefox Developer Tools
e instance inherits the following accessor properties from its prototype: type A string describing what sort of frame this is: "call": a frame running a function call. (We may not be able to obtain frames for calls to host functions.) "eval": a frame running code passed to eval. "global": a frame running global code (JavaScript that is neither of the above). "
module": a frame running code at the top level of a
module. "wasmcall": a frame running a WebAssembly function call. "debugger": a frame for a call to user code invoked by the debugger (see the eval method below). implementation A string describing which tier of the JavaScript engine this frame is executing in: "interpreter": a frame running in the interpreter. ...
Tutorial: Show Allocations Per Call Path - Firefox Developer Tools
Browser" from the "Environment" menu. (This menu will not be present unless you have changed the preference as explained above.) Selecting the 'browser' context in the Scratchpad Enter the following code in the Scratchpad: // This simply defines the 'Debugger' constructor in this // Scratchpad; it doesn't actually start debugging anything. Components.utils.import('resource://gre/
modules/jsdebugger.jsm'); addDebuggerToGlobal(window); (function () { // The debugger we'll use to observe a tab's allocation. var dbg; // Start measuring the selected tab's main window's memory // consumption. This function is available in the browser // console. window.demoTrackAllocations = function() { dbg = new Debugger; // This makes hacking on the demo *much* more // pl...
Tutorial: Set a breakpoint - Firefox Developer Tools
it, click on the options gear at the upper right of the Browser Content Toolbox, and make sure the "Scratchpad" box in the "Default Developer Tools" section the left is checked. The Scratchpad panel should appear at the top of the Toolbox alongside the Console, Debugger, and Memory panels. Click on the Scratchpad panel and enter the following code: Components.utils.import("resource://gre/
modules/jsdebugger.jsm"); Components.utils.import("resource://gre/
modules/Console.jsm"); // This simply defines 'Debugger' in this Scratchpad; // it doesn't actually start debugging anything. addDebuggerToGlobal(this); // Create a 'Debugger' instance. var dbg = new Debugger; // Make the tab's top window a debuggee, and get a // Debugger.Object referring to the window. var windowDO = dbg.addDebuggee(t...
Debugger.Object - Firefox Developer Tools
istinguish top-level windows, iframes, and internal JavaScript scopes. By convention, host annotation objects have a string-valued "type" property that, taken together with the object's class, indicate what sort of thing the referent is. The host annotation object's other properties provide further details, as appropriate for the type. For example, in Firefox, a metadata object for a JavaScript
Module's global object might look like this: { "type":"jsm", "uri":"resource:://gre/
modules/XPCOMUtils.jsm" } Firefox provides [DebuggerHostAnnotationsForFirefox annotations] for its host objects. Function Properties of the Debugger.Object prototype The functions described below may only be called with a this value referring to a Debugger.Object instance; they may not be used as methods of othe...
Index - Firefox Developer Tools
he main sections of the JavaScript Debugger's user interface. The UI is split vertically into three panels 139 Using the Debugger map scopes feature This feature is useful when debugging source-mapped code. It enables you to see the variables from the original source. It's also possible to inspect variables from the generated scopes (e.g., a bundle file with all concatenated
module files). 140 The Web Developer Menu Add-ons, Debugging, Tools, Web Developer The Web Developer menu is the main way to access the developer tools that are built into Firefox. On OS X and Linux, it's under the "Tools" menu: 141 Tips Dev Tools, Tools, Web Development Screenshots: 142 Toolbox The Toolbox provides a single home for most o...
AudioContext() - Web APIs
Syntax var audioCtx = new AudioContext(); var audioCtx = new AudioContext(options); Parameters options Optional An object based on the AudioContextOptions dictionary that contains zero or more optional properties to configure the new context. ...
AudioContext - Web APIs
An audio context controls both the creation of the nodes it contains and the execution of the audio processing, or decoding. You need to create an AudioContext before you do anything else, as everything happens inside a context. It's recommended to create one AudioContext and reuse it instead of initializing a new one each time, and it's OK to use a single AudioContext for several different audio source and pipeline concurrently. ...
AudioNode - Web APIs
The AudioNode interface is a generic interface for representing an audio processing
module. Examples include: an audio source (e.g. an HTML <audio> or <video> element, an OscillatorNode, etc.), the audio destination, intermediate processing
module (e.g. a filter like BiquadFilterNode or ConvolverNode), or volume control (like GainNode) <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><tex...
DOMPoint.y - Web APIs
alue of y increases downward and decreases upward. Syntax var yPos = DOMPoint.y; Value A double-precision floating-point value indicating the y coordinate's value for the point. This value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be NaN or +-Infinity). Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'y' in that specification. Candidate Recommendation Initial definition ...
DOMPoint.z - Web APIs
lues receding into the distance behind the screen. Syntax var zPos = DOMPoint.z; Value A double-precision floating-point value indicating the z coordinate's value for the point. This value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be NaN or +-Infinity). Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'z' in that specification. Candidate Recommendation Initial definition ...
DOMPointInit.w - Web APIs
mPoint(). The DOMPointReadOnly.toJSON() method returns a DOMPointInit object that describes the same point as the original point. By inheritance, this method is also available as DOMPoint.toJSON(). This value is assumed to be 1 by default if not included in the DOMPointInit object passed into fromPoint(). Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'w' in that specification. Candidate Recommendation Initial definition ...
DOMPointInit.y - Web APIs
rspective value of the new point to be created. This method is, by inheritance, also available as DOMPoint.fromPoint(). The DOMPointReadOnly.toJSON() method returns a DOMPointInit object that describes the same point as the original point. By inheritance, this method is also available as DOMPoint.toJSON(). Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'y' in that specification. Candidate Recommendation Initial definition ...
DOMPointInit.z - Web APIs
MPointReadOnly.toJSON() method returns a DOMPointInit object that describes the same point as the original point. By inheritance, this method is also available as DOMPoint.toJSON(). If this property is missing when the DOMPointInit object is passed into fromPoint(), the value is assumed to be 0 by default. Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'z' in that specification. Candidate Recommendation Initial definition ...
DOMPointInit - Web APIs
nt window, with a z component added to move the point closer to the user. This same code will work to create a DOMPointReadOnly object; just change the interface name in the code. const pointDesc = { x: window.screenX, y: window.screenY, z: 5.0 }; const windTopLeft = DOMPoint.fromPoint(pointDesc) Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'DOMPointReadOnly.fromPoint()' in that specification. Candidate Recommendation Initial definition ...
DOMPointReadOnly() - Web APIs
e A new DOMPointReadOnly object representing the specified location in space. Examples The following code demonstrates creating both 2D and 3D points. var point2D = new DOMPointReadOnly(50, 25); var point3D = new DOMPointReadOnly(50, 0, 10); var perspectivePoint3D = new DOMPointReadOnly(50, 50, 25, 0.5); Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'DOMPointReadOnly' in that specification. Candidate Recommendation Initial definition ...
DOMPointReadOnly.fromPoint() - Web APIs
D point using an existing point This example creates a point, origPoint, of type DOMPoint, using new DOMPoint(). That point is then used as the input for fromPoint() to create a new point, newPoint. const origPoint = new DOMPoint(25, 25, 100, 0.5) const newPoint = DOMPointReadOnly.fromPoint(origPoint) Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'fromPoint()' in that specification. Candidate Recommendation Initial definition ...
DOMPointReadOnly.toJSON() - Web APIs
Point or DOMPointReadOnly on which the method was called. Example This example creates a DOMPoint object representing the top-left corner of the current window, in screen coordinates, then converts that to JSON. var topLeft = new DOMPoint(window.screenX, window.screenY); var pointJSON = topLeft.toJSON(); Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'DOMPointReadOnly.toJSON()' in that specification. Candidate Recommendation Initial definition ...
DOMPointReadOnly.w - Web APIs
object. Syntax const perspective = someDOMPointReadOnly.w Value A double-precision floating-point value indicating the w perspective value for the point. This value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be NaN or +-Infinity). The default is 1.0. Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'w' in that specification. Candidate Recommendation Initial definition ...
DOMPointReadOnly.x - Web APIs
rms have resulted in a reversal. Syntax const xPos = someDOMPointReadOnly.x; Value A double-precision floating-point value indicating the x coordinate's value for the point. This value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be NaN or +-Infinity). Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'x' in that specification. Candidate Recommendation Initial definition ...
DOMPointReadOnly.y - Web APIs
rms have resulted in a reversal. Syntax const yPos = someDOMPointReadOnly.y; Value A double-precision floating-point value indicating the y coordinate's value for the point. This value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be NaN or +-Infinity). Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'y' in that specification. Candidate Recommendation Initial definition ...
DOMPointReadOnly.z - Web APIs
rms have resulted in a reversal. Syntax const zPos = someDOMPointReadOnly.z; Value A double-precision floating-point value indicating the z coordinate's value for the point. This value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be NaN or +-Infinity). Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'z' in that specification. Candidate Recommendation Initial definition ...
DOMPointReadOnly - Web APIs
es a new DOMPointReadOnly object given the coordinates provided in the specified DOMPointInit object. Methods matrixTransform() Applies a matrix transform specified as a DOMMatrixInit object to the DOMPointReadOnly object. toJSON() Returns a JSON representation of the DOMPointReadOnly object. Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'DOMPoint' in that specification. Candidate Recommendation Latest spec version is an ED. ...
DOMQuad - Web APIs
based on the passed set of coordinates. DOMQuad.fromQuad() Returns a new DOMQuad object based on the passed set of coordinates. DOMQuad.getBounds() Returns a DOMRect object with the coordinates and dimensions of the DOMQuad object. DOMQuad.toJSON() Returns a JSON representation of the DOMQuad object. Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'DOMQuad' in that specification. Candidate Recommendation Initial definition. ...
DOMRect.DOMRect() - Web APIs
DOMRect. height The height of the DOMRect. Examples To create a new DOMRect, you could run a line of code like so: myDOMRect = new DOMRect(0,0,100,100); // running 'myDOMRect' in the console would then return // DOMRect { x: 0, y: 0, width: 100, height: 100, top: 0, right: 100, bottom: 100, left: 0 } Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'DOMRect()' in that specification. Candidate Recommendation Initial definition. ...
DOMRectReadOnly() - Web APIs
of the DOMRectReadOnly. Examples To create a new DOMPoint, you could run a line of code like so: const myDOMRect = new DOMRectReadOnly(0, 0, 100, 100) // running 'myDOMRect' in the console would then return // DOMRect { x: 0, y: 0, width: 100, height: 100, top: 0, right: 100, bottom: 100, left: 0 } Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'DOMRectReadOnly()' in that specification. Candidate Recommendation Initial definition. ...
DOMRectReadOnly.bottom - Web APIs
The bottom read-only property of the DOMRectReadOnly interface returns the bottom coordinate value of the DOMRect. (Has the same value as y + height, or y if height is negative.) Syntax var recBottom = DOMRect.bottom; Value A double. Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'bottom' in that specification. Candidate Recommendation Latest spec version is an ED. ...
DOMRectReadOnly.fromRect() - Web APIs
dimensions of a rectangle. All properties default to 0. The properties are: x: The coordinate of the left side of the rectangle. y: The coordinate of the top side of the rectangle. width: The width of the rectangle. height: The height of the rectangle. Return value An instance of DOMRect. Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'fromRect()' in that specification. Candidate Recommendation Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSa...
DOMRectReadOnly.height - Web APIs
The height read-only property of the DOMRectReadOnly interface represents the height of the DOMRect. Syntax var recHeight = DOMRect.height; Value A double. Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'height' in that specification. Candidate Recommendation Latest spec version is an ED. ...
DOMRectReadOnly.left - Web APIs
The left read-only property of the DOMRectReadOnly interface returns the left coordinate value of the DOMRect. (Has the same value as x, or x + width if width is negative.) Syntax var recLeft = DOMRect.left; Value A double. Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'left' in that specification. Candidate Recommendation Latest spec version is an ED. ...
DOMRectReadOnly.right - Web APIs
The right read-only property of the DOMRectReadOnly interface returns the right coordinate value of the DOMRect. (Has the same value as x + width, or x if width is negative.) Syntax var recRight = DOMRect.right; Value A double. Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'right' in that specification. Candidate Recommendation Latest spec version is an ED. ...
DOMRectReadOnly.top - Web APIs
The top read-only property of the DOMRectReadOnly interface returns the top coordinate value of the DOMRect. (Has the same value as y, or y + height if height is negative.) Syntax var recTop = DOMRect.top; Value A double. Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'top' in that specification. Candidate Recommendation Latest spec version is an ED. ...
DOMRectReadOnly.width - Web APIs
The width read-only property of the DOMRectReadOnly interface represents the width of the DOMRect. Syntax var recWidth = DOMRect.width; Value A double. Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'width' in that specification. Candidate Recommendation Latest spec version is an ED. ...
DOMRectReadOnly.x - Web APIs
The x read-only property of the DOMRectReadOnly interface represents the x coordinate of the DOMRect's origin. Syntax var recX = DOMRect.x; Value A double. Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'x' in that specification. Candidate Recommendation Latest spec version is an ED. ...
DOMRectReadOnly.y - Web APIs
The y read-only property of the DOMRectReadOnly interface represents the y coordinate of the DOMRect's origin. Syntax var recY = DOMRect.y; Value A double. Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'y' in that specification. Candidate Recommendation Latest spec version is an ED. ...
DOMRectReadOnly - Web APIs
urns the bottom coordinate value of the DOMRect (usually the same as y + height). DOMRectReadOnly.left Read only Returns the left coordinate value of the DOMRect (usually the same as x). Static methods DOMRectReadOnly.fromRect() Creates a new DOMRect object with a given location and dimensions. Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'DOMRectReadOnly' in that specification. Candidate Recommendation Initial definition. ...
Element.clientTop - Web APIs
e eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. padding-bottom Left Top Right Bottom margin-top margin-bottom border-top border-bottom Notes clientTop was first introduced in the MS IE DHTML object model. Specifications Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'clientTop' in that specification. Working Draft ...
Element.clientWidth - Web APIs
l round the value to an integer. If you need a fractional value, use element.getBoundingClientRect(). Syntax var intElemClientWidth = element.clientWidth; intElemClientWidth is an integer corresponding to the clientWidth of element in pixels. The clientWidth property is read-only. Example Specification Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'clientWidth' in that specification. Working Draft Notes clientWidth was first introduced in the MS IE DHTML object model. ...
Element.getBoundingClientRect() - Web APIs
t.body.appendChild(para); } } Notice how the width/height are equal to the equal to its width/height + padding. Also note how the values of x/left, y/top, right, and bottom are equal to the absolute distance from the relevant edge of the viewport to that side of the element, in each case. Specifications Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'Element.getBoundingClientRect()' in that specification. Working Draft Initial definition Notes The returned DOMRect object can be modified in modern browsers. This was not true with older versions which effectively returned DOMRectReadOnly. With IE and Edge, not being able to add missing properties to their returned ClientRect, object prevents backfilling x and y. ...
Element.scroll() - Web APIs
element that you want displayed in the upper left. Calling with options options A ScrollToOptions dictionary. Examples // Put the 1000th vertical pixel at the top of the element element.scroll(0, 1000); Using options: element.scroll({ top: 100, left: 100, behavior: 'smooth' }); Specification Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'element.scroll()' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAn...
Element.scrollBy() - Web APIs
ue that you want to scroll by. y-coord is the vertical pixel value that you want to scroll by. - or - options is a ScrollToOptions dictionary. Examples // scroll an element element.scrollBy(300, 300); Using options: element.scrollBy({ top: 100, left: 100, behavior: 'smooth' }); Specification Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'element.scrollBy()' in that specification. Working Draft Initial definition. ...
Element.scrollTo() - Web APIs
upper left. y-coord is the pixel along the vertical axis of the element that you want displayed in the upper left. - or - options is a ScrollToOptions dictionary. Examples element.scrollTo(0, 1000); Using options: element.scrollTo({ top: 100, left: 100, behavior: 'smooth' }); Specifications Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'element.scrollTo()' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid ...
Element.scrollTop - Web APIs
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. If you can see this, scrollTop is maxed-out padding-bottom Left Top Right Bottom margin-top margin-bottom border-top border-bottom Specifications Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'scrollTop' in that specification. Working Draft ...
Element: scroll event - Web APIs
tener('scroll', function(e) { last_known_scroll_position = window.scrollY; if (!ticking) { window.requestAnimationFrame(function() { doSomething(last_known_scroll_position); ticking = false; }); ticking = true; } }); Note: You can find more examples on the resize event page. Specifications Specification Status CSS Object Model (CSSOM) View
Module Working Draft ...
Element - Web APIs
thod. Fullscreen APIThe definition of 'Element' in that specification. Living Standard Added the requestFullscreen() method. DOM Parsing and SerializationThe definition of 'Element' in that specification. Working Draft Added the following properties: innerHTML, and outerHTML. Added the following method: insertAdjacentHTML(). CSS Object Model (CSSOM) View
ModuleThe definition of 'Element' in that specification. Working Draft Added the following properties: scrollTop, scrollLeft, scrollWidth, scrollHeight, clientTop, clientLeft, clientWidth, and clientHeight. Added the following methods: getClientRects(), getBoundingClientRect(), scroll(), scrollBy(), scrollTo() and scrollIntoView(). Element Traversal SpecificationThe definition of 'Ele...
Encrypted Media Extensions API - Web APIs
The Encrypted Media Extensions API provides interfaces for controlling the playback of content which is subject to a digital restrictions management scheme. Interfaces MediaKeyMessageEvent Contains the content and related data when the content decryption
module (CDM) generates a message for the session. MediaKeys Represents a set of keys that an associated HTMLMediaElement can use for decryption of media data during playback. MediaKeySession Represents a context for message exchange with a content decryption
module (CDM). MediaKeyStatusMap Is a read-only map of media key statuses by key IDs. MediaKeySystemAccess Provides access to a Key System for decryption and/or a content protection provider. MediaKeySystemConfiguration Provides configuration information about the m...
MouseEvent.y - Web APIs
The MouseEvent.y property is an alias for the MouseEvent.clientY property. Specifications Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'MouseEvent.y' in that specification. Working Draft Initial definition. ...
Node.isSupported() - Web APIs
are listed on the DOM Level 2 Conformance Section. version Is a DOMString containing the version number of the feature to test. In DOM Level 2, version 1, this is the string 2.0. If the version is not specified, supporting any version of the feature will cause the method to return true. Example <div id="doc"> </div> <script> // Get an element and check to see if its supports the DOM2 HTML
Module. var main = document.getElementById('doc'); var output = main.isSupported('HTML', '2.0'); </script> Specifications Specification Status Comment Document Object Model (DOM) Level 3 Core SpecificationThe definition of 'Node.isSupported()' in that specification. Obsolete No change from Document Object Model (DOM) Level 2 Core Specification. Document Ob...
OscillatorNode - Web APIs
An OscillatorNode is created using the BaseAudioContext.createOscillator() method. It always has exactly one output and no inputs. ...
PannerNode - Web APIs
The PannerNode interface represents the position and behavior of an audio source signal in space. It is an AudioNode audio-processing
module describing its position with right-hand Cartesian coordinates, its movement using a velocity vector and its directionality using a directionality cone. A PannerNode always has exactly one input and one output: the input can be mono or stereo but the output is always stereo (2 channels); you can't have panning effects without at least two audio channels! Number of inputs 1 Number of outputs 1 Channel count mode "clamped-max" Channel count 2 Channel interpretation "speakers" Constructor PannerNode.PannerNode Creates a new PannerNode object instance. Properties Inherits properties...
Point - Web APIs
Point is an interface, which existed only briefly in the CSS Transforms Level 1 specification, which represents a point in 2-dimensional space. It is non-standard, not broadly compatible, and should not be used. Although it is not directly related to this defunct interface, you are probably looking for DOMPoint, which is part of the Geometry Interfaces
Module Level 1 specification. Properties x A floating-point value specifying the point's position with respect to the X (horizontal) axis. y A floating-point value specifying the point's position with respect to the Y (vertical) axis. Specifications This class was specified in the defunct 20 March 2009 Working Draft of CSS 2D Transforms
Module Level 3. It is not present in the current working draft of the CSS Transforms Lev...
PointerEvent.pointerType - Web APIs
e ${event.pointerType} is not suported`); } }, false); Specifications Specification Status Comment Pointer EventsThe definition of 'pointerType' in that specification. Obsolete Initial definition. Pointer Events - Level 2The definition of 'pointerType' in that specification. Recommendation Non-stable version. CSS Object Model (CSSOM) View
ModuleThe definition of 'MouseEvent' in that specification. Working Draft Redefines MouseEvent from long to double. This means that a PointerEvent whose pointerType is mouse will be a double. ...
Range.getClientRects() - Web APIs
This is created by aggregating the results of calls to Element.getClientRects() for all the elements in the range. Syntax rectList = range.getClientRects() Example range = document.createRange(); range.selectNode(document.getElementsByTagName("div").item(0)); rectList = range.getClientRects(); Specification Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'Range.getClientRects()' in that specification. Working Draft Initial specification. ...
Range - Web APIs
, use DOMException instead. Made the second parameter of collapse() optional. Added the methods isPointInRange(), comparePoint(), and intersectsNode(). Added the constructor Range(). DOM Parsing and SerializationThe definition of 'Extensions to Range' in that specification. Working Draft Added the method createContextualFragment(). CSS Object Model (CSSOM) View
ModuleThe definition of 'Extensions to Range' in that specification. Working Draft Added the methods getClientRects() and getBoundingClientRect(). Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'Range' in that specification. Obsolete Initial specification. ...
Request.mode - Web APIs
that Request is set to cors. However, for requests created other than by the Request.Request constructor, no-cors is typically used as the mode; for example, for embedded resources where the request is initiated from markup, unless the crossorigin attribute is present, the request is in most cases made using the no-cors mode -- that is, for the <link> or <script> elements (except when used with
modules), or <img>, <audio>, <video>, <object>, <embed>, or <iframe> elements. Example In the following snippet, we create a new request using the Request.Request() constructor (for an image file in the same directory as the script), then save the request mode in a variable: var myRequest = new Request('flowers.jpg'); var myMode = myRequest.mode; // returns "cors" by default Specifications ...
SVGClipPathElement - Web APIs
SVGClipPathElement.clipPathUnits Read only An SVGAnimatedEnumeration corresponding to the clipPathUnits attribute of the given <clipPath> element. Takes one of the constants defined in SVGUnitTypes. Methods This interface doesn't implement any specific methods, but inherits methods from its parent, SVGElement. Specifications Specification Status Comment CSS Masking
Module Level 1The definition of 'SVGClipPathElement' in that specification. Candidate Recommendation Removed the inheritance from SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGStylable, SVGTransformable, and SVGUnitTypes Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGClipPathElement' in that specification. Recommendation Initial definition ...
SVGComponentTransferFunctionElement - Web APIs
er corresponding to the exponent attribute of the given element. SVGComponentTransferFunctionElement.offset Read only An SVGAnimatedNumber corresponding to the offset attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGComponentTransferFunctionElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGComponentTransferFunctionElement' in that specification. Recommendation Initial definition ...
SVGFEBlendElement - Web APIs
ion corresponding to the mode attribute of the given element. It takes one of the SVG_FEBLEND_MODE_* constants defined on this interface. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement, and implements methods of SVGFilterPrimitiveStandardAttributes. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEBlendElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFEBlendElement' in that specification. Recommendation Initial definition ...
SVGFEColorMatrixElement - Web APIs
e. SVGFEColorMatrixElement.values Read only An SVGAnimatedNumberList corresponding to the values attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement , and also implements methods of SVGFilterPrimitiveStandardAttributes. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEColorMatrixElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFEColorMatrixElement' in that specification. Recommendation Initial definition ...
SVGFEComponentTransferElement - Web APIs
Attributes. SVGFEComponentTransferElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement, and implements methods of SVGFilterPrimitiveStandardAttributes. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEComponentTransferElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFEComponentTransferElement' in that specification. Recommendation Initial definition ...
SVGFECompositeElement - Web APIs
face. SVGFECompositeElement.values Read only An SVGAnimatedNumberList corresponding to the values attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement, and also implements methods of SVGFilterPrimitiveStandardAttributes. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFECompositeElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFECompositeElement' in that specification. Recommendation Initial definition ...
SVGFEConvolveMatrixElement - Web APIs
olveMatrixElement.preserveAlpha Read only An SVGAnimatedBoolean corresponding to the preserveAlpha attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement, and also implements methods of SVGFilterPrimitiveStandardAttributes. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEConvolveMatrixElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFEConvolveMatrixElement' in that specification. Recommendation Initial definition ...
SVGFEDiffuseLightingElement - Web APIs
nitLengthY Read only An SVGAnimatedNumber corresponding to the Y component of the kernelUnitLength attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement, and also implements methods of SVGFilterPrimitiveStandardAttributes. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEDiffuseLightingElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFEDiffuseLightingElement' in that specification. Recommendation Initial definition ...
SVGFEDisplacementMapElement - Web APIs
ponding to the yChannelSelect attribute of the given element. It takes one of the SVG_CHANNEL_* constants defined on this interface. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement, and also implements methods of SVGFilterPrimitiveStandardAttributes. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEDisplacementMapElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFEDisplacementMapElement' in that specification. Recommendation Initial definition ...
SVGFEDistantLightElement - Web APIs
edNumber corresponding to the azimuth attribute of the given element. SVGFEDistantLightElement.elevation Read only An SVGAnimatedNumber corresponding to the elevation attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEDistantLightElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFEDistantLightElement' in that specification. Recommendation Initial definition ...
SVGFEDropShadowElement - Web APIs
y computed) Y component of the stdDeviationY attribute of the given element. Methods This interface also inherits methods of its parent, SVGElement, and also implements methods of SVGFilterPrimitiveStandardAttributes. SVGFEDropShadowElement.setStdDeviation() Sets the values for the stdDeviation attribute. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEDropShadowElement' in that specification. Working Draft Initial definition ...
SVGFEFloodElement - Web APIs
rits properties from its parent interface, SVGElement, and implements properties from SVGFilterPrimitiveStandardAttributes. Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGElement, and implements methods from SVGFilterPrimitiveStandardAttributes. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEFloodElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFEFloodElement' in that specification. Recommendation Initial definition ...
SVGFEFuncAElement - Web APIs
inter-events: all;} Properties This interface not provide any specific properties, but inherits properties from its parent interface, SVGComponentTransferFunctionElement. Methods This interface does not provide any specific methods, but implements those of its parent, SVGComponentTransferFunctionElement. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEFuncAElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFEFuncAElement' in that specification. Recommendation Initial definition ...
SVGFEFuncBElement - Web APIs
inter-events: all;} Properties This interface not provide any specific properties, but inherits properties from its parent interface, SVGComponentTransferFunctionElement. Methods This interface does not provide any specific methods, but implements those of its parent, SVGComponentTransferFunctionElement. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEFuncBElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFEFuncBElement' in that specification. Recommendation Initial definition ...
SVGFEFuncGElement - Web APIs
inter-events: all;} Properties This interface not provide any specific properties, but inherits properties from its parent interface, SVGComponentTransferFunctionElement. Methods This interface does not provide any specific methods, but implements those of its parent, SVGComponentTransferFunctionElement. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEFuncGElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFEFuncGElement' in that specification. Recommendation Initial definition ...
SVGFEFuncRElement - Web APIs
inter-events: all;} Properties This interface not provide any specific properties, but inherits properties from its parent interface, SVGComponentTransferFunctionElement. Methods This interface does not provide any specific methods, but implements those of its parent, SVGComponentTransferFunctionElement. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEFuncRElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFEFuncRElement' in that specification. Recommendation Initial definition ...
SVGFEGaussianBlurElement - Web APIs
ment. Takes one of the SVG_EDGEMODE_* constants defined on this interface. Methods This interface also inherits methods of its parent, SVGElement, and also implements methods of SVGFilterPrimitiveStandardAttributes. SVGFEGaussianBlurElement.setStdDeviation() Sets the values for the stdDeviation attribute. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEGaussianBlurElement' in that specification. Working Draft Added edgeMode property. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFEGaussianBlurElement' in that specification. Recommendation Initial definition ...
SVGFEImageElement - Web APIs
ead only An SVGAnimatedString reflects the crossorigin attribute of the given element, limited to only known values. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement, and implements methods of SVGFilterPrimitiveStandardAttributesand SVGURIReference. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEImageElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFEImageElement' in that specification. Recommendation Initial definition ...
SVGFEMergeElement - Web APIs
ut inherits properties from its parent interface, SVGElement, and also implements properties of SVGFilterPrimitiveStandardAttributes. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement, and also implements methods of SVGFilterPrimitiveStandardAttributes. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEMergeElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFEMergeElement' in that specification. Recommendation Initial definition ...
SVGFEMergeNodeElement - Web APIs
ies This interface also inherits properties from its parent interface, SVGElement. SVGFEMergeNodeElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEMergeNodeElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFEMergeNodeElement' in that specification. Recommendation Initial definition ...
SVGFEMorphologyElement - Web APIs
ologyElement.radiusY Read only An SVGAnimatedNumber corresponding to the Y component of the radius attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement, and also implements methods of SVGFilterPrimitiveStandardAttributes. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEMorphologyElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFEMorphologyElement' in that specification. Recommendation Initial definition ...
SVGFEOffsetElement - Web APIs
f the given element. SVGFEOffsetElement.dy Read only An SVGAnimatedNumber corresponding to the dy attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement, and also implements methods of SVGFilterPrimitiveStandardAttributes. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEOffsetElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFEOffsetElement' in that specification. Recommendation Initial definition ...
SVGFEPointLightElement - Web APIs
Read only An SVGAnimatedNumber corresponding to the y attribute of the given element. SVGFEPointLightElement.z Read only An SVGAnimatedNumber corresponding to the z attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFEPointLightElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFEPointLightElement' in that specification. Recommendation Initial definition ...
SVGFESpecularLightingElement - Web APIs
nitLengthY Read only An SVGAnimatedNumber corresponding to the Y component of the kernelUnitLength attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement, and also implements methods of SVGFilterPrimitiveStandardAttributes. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFESpecularLightingElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFESpecularLightingElement' in that specification. Recommendation Initial definition ...
SVGFESpotLightElement - Web APIs
to the specularExponent attribute of the given element. SVGFESpotLightElement.limitingConeAngle Read only An SVGAnimatedNumber corresponding to the limitingConeAngle attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFESpotLightElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFESpotLightElement' in that specification. Recommendation Initial definition ...
SVGFETileElement - Web APIs
StandardAttributes. SVGFETileElement.in1 Read only An SVGAnimatedString corresponding to the in attribute of the given element. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement, and also implements methods of SVGFilterPrimitiveStandardAttributes. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFETileElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFETileElement' in that specification. Recommendation Initial definition ...
SVGFETurbulenceElement - Web APIs
esponding to the type attribute of the given element. It takes one of the SVG_TURBULENCE_TYPE_* constants defined on this interface. Methods This interface does not provide any specific methods, but implements those of its parent, SVGElement, and also implements methods of SVGFilterPrimitiveStandardAttributes. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFETurbulenceElement' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFETurbulenceElement' in that specification. Recommendation Initial definition ...
SVGFilterElement - Web APIs
component of the filterRes attribute of the given <filter> element. SVGFilterElement.filterResY Read only An SVGAnimatedInteger that contains the Y component of the filterRes attribute of the given <filter> element. Methods SVGFilterElement.setFilterRes() Sets the values of the filterRes attribute. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFilterElement' in that specification. Working Draft Removed the inheritance from SVGLangSpace, SVGExternalResourcesRequired, SVGStylable, and SVGUnitTypes and removed the setFilterRes() function Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFilterElement' in that specification. Recommendation Initial definition ...
SVGFilterPrimitiveStandardAttributes - Web APIs
dAttributes.height Read only An SVGAnimatedLength corresponding to the height attribute of the given element. SVGFilterPrimitiveStandardAttributes.result Read only An SVGAnimatedString corresponding to the result attribute of the given element. Methods This interface does not provide any specific methods. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'SVGFilterPrimitiveStandardAttributes' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGFilterPrimitiveStandardAttributes' in that specification. Recommendation Initial definition ...
SVGMaskElement - Web APIs
th corresponding to the width attribute of the given <mask> element. SVGMaskElement.height Read only An SVGAnimatedLength corresponding to the height attribute of the given <mask> element. Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGElement. Specifications Specification Status Comment CSS Masking
Module Level 1The definition of 'SVGMaskElement' in that specification. Candidate Recommendation Removed the implemented interfaces SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGStylable, and SVGTransformable. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGMaskElement' in that specification. Recommendation Initial definition ...
SVGRect - Web APIs
ults to an error. A value of zero disables rendering of the element SVGRect.height This represents the height of the rectangle.A value that is negative results to an error.A value of zero disables rendering of the element. Methods This interface also inherits properties from its parent, DOMRectReadOnly. Specifications Specification Status Comment Geometry Interfaces
Module Level 1The definition of 'DOMRect' in that specification. Candidate Recommendation Changed SVGRect as a legacy alias of DOMRect. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'SVGRect' in that specification. Recommendation Initial definition ...
Screen.availHeight - Web APIs
window filling all available vertical space at the left of the screen. On a Windows system, this would function similarly, by opening the window and sizing it vertically so it uses all available vertical space, leaving room for the taskbar and any other interface elements that reserve space. Specifications Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'Screen.availHeight' in that specification. Working Draft Initial definition. ...
Screen.availWidth - Web APIs
The Screen.availWidth property returns the amount of horizontal space (in pixels) available to the window. Syntax var width = window.screen.availWidth Example var screenAvailWidth = window.screen.availWidth; console.log(screenAvailWidth); Specifications Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'Screen.availWidth' in that specification. Working Draft Initial definition ...
Screen.colorDepth - Web APIs
or compatibility reasons. See the browser compatibility section for those that don't. Syntax bitDepth = window.screen.colorDepth; Example // Check the color depth of the screen if ( window.screen.colorDepth < 8) { // Use low-color version of page } else { // Use regular, colorful page } Specification Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'Screen.colorDepth' in that specification. Working Draft ...
WebXR Device API - Web APIs
to the WebXR device to be presented to the user through their headset or other appropriate display device. WebXR Device API concepts and usage Example WebXR hardware setup While the older WebVR API was designed solely to support Virtual Reality (VR), WebXR provides support for both VR and Augmented Reality (AR) on the web. Support for AR functionality is added by the WebXR Augmented Reality
Module. A typical XR device can have either 3 or 6 degrees of freedom and might or might not have an external positional sensor. The equipment may also include an accelerometer, barometer, or other sensors which are used to sense when the user moves through space, rotates their head, or the like. Accessing the WebXR API To gain access to the WebXR API within the context of a given window, use the na...
Attestation and Assertion - Web APIs
l field used in attestation. It is not included when used in the AuthenticatorAssertionResponse.) Different devices have different attestation formats. The pre-defined attestation formats in WebAuthn are: Packed - a generic attestation format that is commonly used by devices whose sole function is as a WebAuthn authenticator, such as security keys. TPM - the Trusted Platform
Module (TPM) is a set of specifications from the Trusted Platform Group (TPG). This attestation format is commonly found in desktop computers and is used by Windows Hello as its preferred attestation format. Android Key Attestation - one of the features added in Android O was Android Key Attestation, which enables the Android operating system to attest to keys. Android SafetyNet -prior to An...
Window.convertPointFromNodeToPage() - Web APIs
n whose coordinate system the Point specified by nodePoint is described. nodePoint A Point object describing a point in node's coordinate system; this point will be converted to the page's coordinate system. Return value A Point object specifying a point in the page's coordinate system. Specifications This method was specified in the defunct 20 March 2009 Working Draft of CSS 2D Transforms
Module Level 3. It is not present in the current CSS Transforms
Module Level 1 Working Draft. ...
Window.convertPointFromPageToNode - Web APIs
se coordinate system the point is to be converted. pagePoint A Point object specifying a point in the coordinate system of the page, which is to be converted into the node's coordinate system. Return value A Point object describing the specified location in the node's coordinate system. Specifications This method was specified in the defunct 20 March 2009 Working Draft of CSS 2D Transforms
Module Level 3. It is not present in the current CSS Transforms
Module Level 1 Working Draft. ...
Window.devicePixelRatio - Web APIs
Working Draft Initial definition Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndr...
Window.innerHeight - Web APIs
demo here To change the size of a window, see window.resizeBy() and window.resizeTo(). To get the outer height of a window, i.e. the height of the whole browser window, see window.outerHeight. Graphical example The following figure shows the difference between outerHeight and innerHeight. Specification Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'window.innerHeight' in that specification. Working Draft Initial definition ...
Window.matchMedia() - Web APIs
HTML <span class="mq-value"></span> A simple <span> to receive the output. CSS .mq-value { font: 18px arial, sans-serif; font-weight: bold; color: #88f; padding: 0.4em; border: 1px solid #dde; } Result See Testing media queries programmatically for additional code examples. Specifications Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'Window.matchMedia()' in that specification. Working Draft Initial definition ...
Window.moveBy() - Web APIs
e to the right, while negative values are to the left. deltaY is the amount of pixels to move the window vertically. Positive values are down, while negative values are up. Example This example moves the window 10 pixels to the right and 10 pixels up. function budge() { moveBy(10, -10); } Specification Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'window.moveBy()' in that specification. Working Draft ...
Window.moveTo() - Web APIs
tive to its current location. Syntax window.moveTo(x, y) Parameters x is the horizontal coordinate to be moved to. y is the vertical coordinate to be moved to. Example This example moves the window to the top-left corner of the screen. function origin() { window.moveTo(0, 0); } Specification Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'window.moveTo()' in that specification. Working Draft Initial definition ...
Window.outerHeight - Web APIs
es. Notes To change the size of a window, see window.resizeBy() and window.resizeTo(). To get the inner height of a window, i.e. the height of the page being displayed, see window.innerHeight. Graphical example The following figure shows the difference between outerHeight and innerHeight. Specification Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'Window.outerHeight' in that specification. Working Draft ...
Window.outerWidth - Web APIs
he whole browser window including sidebar (if expanded), window chrome and window resizing borders/handles. Notes To change the size of a window, see window.resizeBy() and window.resizeTo(). To get the inner width of a window, i.e. the width of the page being displayed, see window.innerWidth. Specification Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'Window.outerWidth' in that specification. Working Draft Initial definition. ...
Window.pageXOffset - Web APIs
The read-only Window property pageXOffset is an alias for scrollX. Specification Specification Status Comment CSS Object Model (CSSOM) View
ModuleThe definition of 'window.pageXOffset' in that specification. Working Draft ...
Window.pkcs11 - Web APIs
ummary Returns the pkcs11 object, which is used to install drivers and other software associated with the pkcs11 protocol. If pkcs11 isn't supported, this property returns null. Note: This property has been returned null since Gecko 1.9.0.14 (Firefox 3.0.14) and removed in Gecko 29.0 (Firefox 29 / Thunderbird 29 / SeaMonkey 2.26)) for security reasons. For more information on installing PKCS11
modules, see installing PKCS11
modules. See bug 326628 for details on why the property was removed. Syntax objRef = window.pkcs11 Example window.pkcs11.add
Module(sMod, secPath, 0, 0); Notes See nsIDOMPkcs11 for more information about how to manipulate pkcs11 objects. Specification Not part of specification. ...
Worklet - Web APIs
orklet API LayoutWorklet For defining the positioning and dimensions of custom elements. CSS Layout API For 3D rendering with WebGL, you don't use Worklets. Instead, you write Vertex Shaders and Fragment Shaders using GLSL code, and those shaders will then run on the graphics card. Properties The Worklet interface does not define any properties. Methods Worklet.add
Module() Adds the script
module at the given URL to the current worklet. Specifications Specification Status Comment Worklets Level 1The definition of 'Worklet' in that specification. Working Draft ...
How to check the security state of an XMLHTTPRequest over SSL - Web APIs
can create your own alert dialog to handle SSL exceptions in your Firefox extension or XULRunner application. // Adapted from the patch for mozTCPSocket error reporting (bug 861196). const {Cc,Ci} = require("chrome"); function createTCPErrorFromFailedXHR(xhr) { let status = xhr.channel.QueryInterface(Ci.nsIRequest).status; let errType; if ((status & 0xff0000) === 0x5a0000) { // Security
module const nsINSSErrorsService = Ci.nsINSSErrorsService; let nssErrorsService = Cc['@mozilla.org/nss_errors_service;1'].getService(nsINSSErrorsService); let errorClass; // getErrorClass will throw a generic NS_ERROR_FAILURE if the error code is // somehow not in the set of covered errors. try { errorClass = nssErrorsService.getErrorClass(status); } catch (ex) { ...
XREnvironmentBlendMode - Web APIs
ayer property provides relative weights of the artificial layer during the compositing process. Pixels whose alpha value is 1.0 are rendered fully opaque, totally obscuring the real world, while pixels with an alpha of 1.0 are totally transparent, leaving the surrounding environment to pass through. Specifications Specification Status Comment WebXR Augmented Reality
ModuleThe definition of 'XREnvironmentBlendMode' in that specification. Editor's Draft Initial definition. ...
XRPermissionDescriptor.mode - Web APIs
trings found in the XRSessionMode enumerated type: immersive-ar The session's output will be given exclusive access to the immersive device, but the rendered content will be blended with the real-world environment. The session's environmentBlendMode indicates the method to be used to blend the content together. Important: The immersive-ar mode is defined by the WebXR Augmented Reality
Module, which is not yet stable and should not be used other than for testing and experimentation. immersive-vr Indicates that the rendered session will be displayed using an immersive XR device in VR mode; it is not intended to be overlaid or integrated into the surrounding environment. The environmentBlendMode is expected to be opaque if possible, but might be additive if the hardware requires i...
XRSession - Web APIs
ddition to the properties listed below, XRSession inherits properties from its parent interface, EventTarget. environmentBlendMode Read only Returns this session's blend mode which denotes how much of the real-world environment is visible through the XR device and how the device will blend the device imagery with it. Note: environmentBlendMode() is part of the WebXR Augmented Reality
Module, which has not been completed. inputSources Read only Returns a list of this session's XRInputSources, each representing an input device used to control the camera and/or scene. renderState Read only An XRRenderState object which contains options affecting how the imagery is rendered. This includes things such as the near and far clipping planes (distances defining how close and how f...
XRSystem: requestSession() - Web APIs
n the XRSessionMode enum. The supported modes are: immersive-ar The session's output will be given exclusive access to the immersive device, but the rendered content will be blended with the real-world environment. The session's environmentBlendMode indicates the method to be used to blend the content together. Important: The immersive-ar mode is defined by the WebXR Augmented Reality
Module, which is not yet stable and should not be used other than for testing and experimentation. immersive-vr Indicates that the rendered session will be displayed using an immersive XR device in VR mode; it is not intended to be overlaid or integrated into the surrounding environment. The environmentBlendMode is expected to be opaque if possible, but might be additive if the hardware requires i...
Alerts - Accessibility
function is simple: It looks for an element with id "alert", and if found, removes that from the document object model. Next, the function creates a div element to hold the alert text. It gets an ID of "alert". And it gets a role set of "alert". This is actually ARIA-inspired, even though it doesn't say "aria" in the attribute name. This is because that role is based on the XHTML Role Attribute
Module that was simply ported to HTML for simplicity. The text is added to the div element, and the div element is added to the document. The moment this happens, Firefox will fire an "alert" event to assistive technologies when this div appears. Most screen readers will pick this one up automatically and speak it. This is similar to the Notification Bar in Firefox that prompts you whether you want to...
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
Realize that it's about both pride and revenue for these companies, and that they need to sell a lot of copies of their software to make up the work they put in to support your app. Remember that no matter how small they are, you need them more than they need you, unless your application's accessibility is being demanded by end-users. Example: How Gecko and Mozilla Implement MSAA The Accessible
module is where the Mozilla MSAA implementation lives. Feel free to peruse the source code in the accessible
module whenever you want to see how something can be implemented. The accessible
module is also where support for Sun's ATK accessibility API for Linux and UNIX is implemented. Creation of IAccessible Objects The first thing that happens when an assistive technology wants to watch our applicat...
Web accessibility for seizures and physical reactions - Accessibility
Working Draft Personalization Tools 1.0 Working Draft Three Flashes or Below Threshhold Understanding SC 2.3.1 Understanding WCAG 2.0 (Older, but contains some explanations of references made in the WCAG 2.1 criteria) Three Flashes or Below Threshold Understanding Success Criterion 2.3.1 Understanding WCAG 2.1 Understanding Success Criteria 1.
Accessibility
are, language, culture, location, or physical or mental ability. When the Web meets this goal, it is accessible to people with a diverse range of hearing, movement, sight, and cognitive ability." (W3C - Accessibility) Key tutorials The MDN Accessibility Learning Area contains modern, up-to-date tutorials covering accessibility essentials: What is accessibility? This article starts off the
module with a good look at what accessibility actually is -- this includes what groups of people we need to consider and why, what tools different people use to interact with the Web, and how we can make accessibility part of our web development workflow. HTML: A good basis for accessibility A great deal of web content can be made accessible just by making sure the correct HTML elements are used for t...
::first-letter (:first-letter) - CSS: Cascading Style Sheets
???</p> CSS p::first-letter { color: red; font-size: 150%; } Result Specifications Specification Status Comment CSS Pseudo-Elements Level 4The definition of '::first-letter' in that specification. Working Draft Generalizes allowed properties to typesetting, text decoration, inline layout properties, opacity, and box-shadow. CSS Text Decoration
Module Level 3The definition of 'text-shadow with ::first-letter' in that specification. Candidate Recommendation Allows the use of text-shadow with ::first-letter. Selectors Level 3The definition of '::first-letter' in that specification. Recommendation Introduction of the two-colon syntax. Definition of edge-case behavior, such as in list items or with specific languages (e.g., th...
::first-line (:first-line) - CSS: Cascading Style Sheets
Specification Status Comment CSS Pseudo-Elements Level 4The definition of '::first-line' in that specification. Working Draft Defines more strictly where ::first-letter can occur. Generalizes allowed properties to typesetting, text decoration, and inline layout properties and opacity. Defines the inheritance of ::first-letter. CSS Text Decoration
Module Level 3The definition of 'text-shadow with ::first-line' in that specification. Candidate Recommendation Allows the use of text-shadow with ::first-letter. Selectors Level 3The definition of '::first-line' in that specification. Recommendation Introduction of the two-colon syntax. CSS Level 2 (Revision 1)The definition of '::first-line' in that specification. Reco...
::marker - CSS: Cascading Style Sheets
rted in future. Syntax ::marker Examples HTML <ul> <li>Peaches</li> <li>Apples</li> <li>Plums</li> </ul> CSS ul li::marker { color: red; font-size: 1.5em; } Result Specifications Specification Status Comment CSS Pseudo-Elements Level 4The definition of '::marker' in that specification. Working Draft No significant change. CSS Lists
Module Level 3The definition of '::marker' in that specification. Working Draft Initial definition. ...
::slotted() - CSS: Cascading Style Sheets
llows them to stand out better next to the slots that haven't been successfully filled. The element looks like this when inserted into the page: <person-details> <p slot="person-name">Dr. Shazaam</p> <span slot="person-age">Immortal</span> <span slot="person-occupation">Superhero</span> </person-details> Specifications Specification Status Comment CSS Scoping
Module Level 1The definition of '::slotted' in that specification. Working Draft Initial definition. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid w...
:first - CSS: Cascading Style Sheets
: always; } JavaScript document.querySelector("button").addEventListener('click', () => { window.print(); }); Result Press the "Print!" button to print the example. The words on the first page should be somewhere around the center, while other pages will have their contents at the default position. Specifications Specification Status Comment CSS Paged Media
Module Level 3The definition of ':first' in that specification. Working Draft No change. CSS Level 2 (Revision 1)The definition of ':first' in that specification. Recommendation Initial definition. ...
:host() - CSS: Cascading Style Sheets
und: rgba(0,0,0,0.1); padding: 2px 5px; }'; The :host(.footer) { color : red; } rule styles all instances of the <context-span> element (the shadow host in this instance) in the document that have the footer class set on them -- we've used it to give instances of the element inside the <footer> a special color. Specifications Specification Status Comment CSS Scoping
Module Level 1The definition of ':host()' in that specification. Working Draft Initial definition. Browser compatibility DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet:host()Chrome Full support 54Edge Full support ...
:host-context() - CSS: Cascading Style Sheets
-context(h1) { font-style: italic; } and :host-context(h1):after { content: " - no links in headers!" } rules style the instance of the <context-span> element (the shadow host in this instance) inside the <h1>. We've used it to make it clear that the custom element shouldn't appear inside the <h1> in our design. Specifications Specification Status Comment CSS Scoping
Module Level 1The definition of ':host-context()' in that specification. Working Draft Initial definition. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAnd...
:host - CSS: Cascading Style Sheets
y; }' + ':host(.footer) { color : red; }' + ':host { background: rgba(0,0,0,0.1); padding: 2px 5px; }'; The :host { background: rgba(0,0,0,0.1); padding: 2px 5px; } rule styles all instances of the <context-span> element (the shadow host in this instance) in the document. Specifications Specification Status Comment CSS Scoping
Module Level 1The definition of ':host' in that specification. Working Draft Initial definition. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webv...
:left - CSS: Cascading Style Sheets
used to change only the margin, padding, border, and background properties of the page box. All other properties will be ignored, and only the page box, not the document content on the page, will be affected. Syntax :left Examples Setting a margin for left-hand pages @page :left { margin: 2in 3in; } Specifications Specification Status Comment CSS Paged Media
Module Level 3The definition of ':left' in that specification. Working Draft No change. CSS Level 2 (Revision 1)The definition of ':left' in that specification. Recommendation Initial definition. ...
:right - CSS: Cascading Style Sheets
ed to change only the margin, padding, border, and background properties of the page box. All other properties will be ignored, and only the page box, not the document content on the page, will be affected. Syntax :right Examples Setting margins for right-hand pages @page :right { margin: 2in 3in; } Specifications Specification Status Comment CSS Paged Media
Module Level 3The definition of ':right' in that specification. Working Draft No change. CSS Level 2 (Revision 1)The definition of ':right' in that specification. Recommendation Initial definition. ...
font-family - CSS: Cascading Style Sheets
e of the font family. Formal definition Related at-rule@font-faceInitial valuen/a (required)Computed valueas specified Formal syntax <family-name>where <family-name> = <string> | <custom-ident>+ Examples Setting the font family name @font-face { font-family: examplefont; src: url('examplefont.ttf'); } Specifications Specification Status Comment CSS Fonts
Module Level 3The definition of 'font-family' in that specification. Candidate Recommendation Initial definition ...
font-stretch - CSS: Cascading Style Sheets
following find a local Open Sans font or import it, and allow using the font for normal, semi-condensed and semi-expanded states. @font-face { font-family: "Open Sans"; src: local("Open Sans") format("woff2"), url("/fonts/OpenSans-Regular-webfont.woff") format("woff"); font-stretch: 87.5% 112.5%; } Specifications Specification Status Comment CSS Fonts
Module Level 4The definition of 'font-stretch' in that specification. Working Draft CSS Fonts
Module Level 3The definition of 'font-stretch' in that specification. Candidate Recommendation ...
font-style - CSS: Cascading Style Sheets
bit different from their upright counterparts, having some unique features and generally have a rounded and calligraphic quality. These fonts are specially created by font designers and are not artificially sloped. @font-face { font-family: garamond; src: url('garamond-italic.ttf'); font-style: italic; } Specifications Specification Status Comment CSS Fonts
Module Level 4The definition of 'font-style' in that specification. Working Draft Adds oblique keyword with angle value CSS Fonts
Module Level 3The definition of 'font-style' in that specification. Candidate Recommendation Initial definition ...
font-weight - CSS: Cascading Style Sheets
font weight in a @font-face rule The following finds a local Open Sans font or import it, and allows using the font for normal font weights. @font-face { font-family: "Open Sans"; src: local("Open Sans") format("woff2"), url("/fonts/OpenSans-Regular-webfont.woff") format("woff"); font-weight: 400; } Specifications Specification Status Comment CSS Fonts
Module Level 4The definition of 'font-weight' in that specification. Working Draft CSS Fonts
Module Level 3The definition of 'font-weight' in that specification. Candidate Recommendation ...
unicode-range - CSS: Cascading Style Sheets
span> and applying a different font just to that, but that is an extra element and rule set. HTML <div>Me & You = Us</div> CSS @font-face { font-family: 'Ampersand'; src: local('Times New Roman'); unicode-range: U+26; } div { font-size: 4em; font-family: Ampersand, Helvetica, sans-serif; } Result Specifications Specification Status Comment CSS Fonts
Module Level 3The definition of 'unicode-range' in that specification. Candidate Recommendation Initial definition ...
@font-feature-values - CSS: Cascading Style Sheets
One */ @font-feature-values Font One { @styleset { nice-style: 12; } } /* At-rule for "nice-style" in Font Two */ @font-feature-values Font Two { @styleset { nice-style: 4; } } ... /* Apply the at-rules with a single declaration */ .nice-look { font-variant-alternates: styleset(nice-style); } Specifications Specification Status Comment CSS Fonts
Module Level 4The definition of '@font-feature-values' in that specification. Working Draft Initial definition. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSaf...
@media - CSS: Cascading Style Sheets
edback Media Queries Level 5The definition of '@media descriptors' in that specification. Reinstates light-level, inverted-colors and Custom Media Queries, which were removed from Level 4. Adds prefers-reduced-motion, prefers-reduced-transparency, prefers-contrast, and prefers-color-scheme media features. CSS Working Group drafts GitHub issues CSS Conditional Rules
Module Level 3The definition of '@media' in that specification. Defines the basic syntax of the @media rule. CSS Working Group drafts GitHub issues Media Queries Level 4The definition of '@media' in that specification. Adds scripting, pointer, hover, update, overflow-block, and overflow-inline media features. Deprecates all media types except for screen, print, speech, and al...
bleed - CSS: Cascading Style Sheets
h direction, the bleed area extends past the page box. Values may be negative, but there may be implementation-specific limits. Formal definition Related at-rule@pageInitial valueautoComputed valueas specified Formal syntax auto | <length> Examples Setting a page bleed of 1cm @page { bleed: 1cm; } Specifications Specification Status Comment CSS Paged Media
Module Level 3The definition of 'bleed' in that specification. Working Draft Initial definition ...
marks - CSS: Cascading Style Sheets
crop Crop marks will be displayed. cross Cross marks will be displayed. none No marks will be displayed. Formal definition Related at-rule@pageInitial valuenoneComputed valueas specified Formal syntax none | [ crop | cross ] Examples Adding crop and cross marks @page { marks: crop cross; } Specifications Specification Status Comment CSS Paged Media
Module Level 3The definition of 'marks' in that specification. Working Draft Initial definition This CSS property was initially proposed in CSS Level 2, but was dropped from CSS Level 2 (Revision 1). ...
@page - CSS: Cascading Style Sheets
class examples Please refer to the various pseudo-classes of @page for examples. :blank :first :left :right :recto :verso Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of ':recto and :verso' in that specification. Editor's Draft Adds the :recto and :verso page selectors CSS Paged Media
Module Level 3The definition of '@page' in that specification. Working Draft No change from CSS Level 2 (Revision 1), though more CSS at-rules can be used inside a @page. CSS Level 2 (Revision 1)The definition of '@page' in that specification. Recommendation Initial definition ...
@supports - CSS: Cascading Style Sheets
t will be partially applied in browsers which don't support the `of` argument of :nth-child(...) is supported */ :is(:nth-child(1n of ul, ol) a, details > summary) { ... /* CSS applied when the :is(...) selector and the `of` argument of :nth-child(...) are both supported */ } } Specifications Specification Status Comment CSS Conditional Rules
Module Level 4The definition of '@supports' in that specification. Editor's Draft Adds the selector() function. CSS Conditional Rules
Module Level 3The definition of '@supports' in that specification. Candidate Recommendation Initial definition. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the da...
At-rules - CSS: Cascading Style Sheets
the statements within the group will be applied. Conditional group rules are defined in CSS Conditionals Level 3 and are: @media, @supports, @document. (deferred to Level 4 of CSS Spec) Since each conditional group may also contain nested statements, there may be an unspecified amount of nesting. Specifications Specification Status Comment CSS Conditional Rules
Module Level 3 Candidate Recommendation Initial definition Compatibility StandardThe definition of 'CSS At-rules' in that specification. Living Standard Standardizes @-webkit-keyframes. ...
CSS Animations - CSS: Cascading Style Sheets
The behavior of these keyframe animations can be controlled by specifying their timing function, duration, their number of repetitions, and other attributes. Reference CSS Properties animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function CSS At-rules @keyframes Guides Detecting CSS animation support Describes a technique for detecting if a browser supports CSS animations. Using CSS animations Step-by-step tutorial about how to create animations using CSS. ...
CSS Basic Box Model - CSS: Cascading Style Sheets
CSS Basic Box Model is a
module of CSS that defines the rectangular boxes--including their padding and margin--that are generated for elements and laid out according to the visual formatting model. Reference Properties Properties controlling the flow of content in a box overflow overflow-x overflow-y Properties controlling the size of a box height width max-height max-width min-height min-width Properties controlling the margins of a box margin margin-bottom margin-left margin-right margin-top margin-trim Properties controlling the paddings of a box padding padding-bottom padding-left padding-right padding-top Other properties visibility Guides Introduction to the CSS box model Explains one of the fundamental concept of CSS: the box mo...
Using multi-column layouts - CSS: Cascading Style Sheets
People have trouble reading text if lines are too long; if it takes too long for the eyes to move from the end of the one line to the beginning of the next, they lose track of which line they were on. Therefore, to make maximum use of a large screen, authors should have limited-width columns of text placed side by side, just as newspapers do. Unfortunately this is impossible to do with CSS and HTML without forcing column breaks at fixed positions, or severely restricting the markup allowed in the text, or using heroic scripting. This limitation is solved by adding new CSS properties to extend the traditional block layout mode. ...
Using feature queries - CSS: Cascading Style Sheets
queries are created using the CSS at-rule @supports, and are useful as they give web developers a way to test to see if a browser has support for a certain feature, and then provide CSS that will only run based on the result of that test. In this guide you will learn how to implement progressive enhancement using feature queries. Syntax CSS feature queries are part of the CSS Conditional Rules
module, which also contains the media query @media rule; when you use feature queries, you will find they behave in a similar way to media queries. The difference is that with a media query you are testing something about the environment in which the web page is running, whereas with feature queries you are testing browser support for CSS features. A feature query consists of the @supports rule, follow...
CSS Shapes - CSS: Cascading Style Sheets
per Tools External Resources A list of CSS Shapes resources CSS Shapes 101 Creating non-rectangular layouts with CSS Shapes How To Use CSS Shapes In Your Web Design How To Get Started With CSS Shapes What I Learned In One Weekend With CSS Shapes CSS vs. SVG: Shapes and Arbitrarily-Shaped UI Components Specifications Specification Status Comment CSS Shapes
Module Level 1 Candidate Recommendation Initial definition ...
CSS Table - CSS: Cascading Style Sheets
CSS Table is a CSS
module that defines how to lay out table data. Reference Properties border-collapse border-spacing caption-side empty-cells table-layout vertical-align Specifications Specification Status Comment CSS Level 2 (Revision 1) Recommendation Initial definition ...
CSS Transforms - CSS: Cascading Style Sheets
Reference Properties backface-visibility perspective perspective-origin rotate scale transform transform-box transform-origin transform-style translate Data types <transform-function> Guides Using CSS transforms Step-by-step tutorial about how to transform elements styled with CSS. Specifications Specification Status Comment CSS Transforms Level 1 Working Draft Initial definition. CSS Transforms Level 2 Editor's Draft Adds individual transforms. ...
CSS Transitions - CSS: Cascading Style Sheets
The behavior of these transitions can be controlled by specifying their timing function, duration, and other attributes. Reference Properties transition transition-delay transition-duration transition-property transition-timing-function Guides Using CSS transitions Step-by-step tutorial about how to create transitions using CSS. This article describes each relevant CSS property and explains how they interact with each other. ...
CSS Custom Properties for Cascading Variables - CSS: Cascading Style Sheets
CSS Custom Properties for Cascading Variables is a CSS
module that allows for the creation of custom properties that can be used over and over. CSS properties --* Specifications Specification Status Comment CSS Custom Properties for Cascading Variables
Module Level 1 Candidate Recommendation Initial definition ...
Compositing and Blending - CSS: Cascading Style Sheets
Compositing and Blending is a CSS
module that defines how shapes of different elements are combined into a single image. Reference Properties background-blend-mode isolation mix-blend-mode Data types <blend-mode> Specifications Specification Status Comment Compositing and Blending Level 1 Candidate Recommendation Initial definition ...
CSS Layout cookbook - CSS: Cascading Style Sheets
r recipes for common layout patterns, things you might need to implement in your own sites. In addition to providing code you can use as a starting point in your projects, these recipes highlight the different ways layout specifications can be used, and the choices you can make as a developer. Note: If you are new to CSS layout then you might first like to take a look at our CSS layout learning
module, as this will give you the basic grounding you need to make use of the recipes here. The Recipes Recipe Description Layout Methods Media objects A two-column box with an image on one side and descriptive text on the other, e.g. a facebook post or tweet. CSS Grid, float fallback, fit-content() sizing Columns When to choose multi-column layout, flexb...
Pseudo-classes - CSS: Cascading Style Sheets
-shown, :user-invalid, :nth-col(), :nth-last-col(), :is() and :where(). Changed :empty to behave like :-moz-only-whitespace . No significant change for other pseudo-classes defined in Selectors Level 3 and HTML5 (though semantic meaning not taken over). HTML5 Recommendation Copies the relevant section from the canonical (WHATWG) HTML spec. CSS Basic User Interface
Module Level 3 Recommendation Defined :default, :valid, :invalid, :in-range, :out-of-range, :required, :optional, :read-only and :read-write, but without the associated semantic meaning. Selectors Level 3 Recommendation Defined :target, :root, :nth-child(), :nth-last-of-child(), :nth-of-type(), :nth-last-of-type(), :last-child, :first-of-type, :last-of-type, :only-child, :only-of-ty...
Replaced elements - CSS: Cascading Style Sheets
nsic dimensions or a defined baseline, which is used by some CSS properties, such as vertical-align. Only replaced elements can ever have intrinsic dimensions. Controlling object position within the content box Certain CSS properties can be used to specify how the object contained within the replaced element should be positioned within the element's box area. These are defined by the CSS Images
Module Level 3 and CSS Images
Module Level 4 specifications: object-fit Specifies how the replaced element's content object should be fitted to the containing element's box. object-position Specifies the alignment of the replaced element's content object within the element's box. ...
Value definition syntax - CSS: Cascading Style Sheets
Candidate Recommendation Adds the hash mark multiplier. CSS Level 2 (Revision 1)The definition of 'Value definition syntax' in that specification. Recommendation Adds the double ampersand combinator. CSS Level 1The definition of 'Value definition syntax' in that specification. Recommendation...
Visual formatting model - CSS: Cascading Style Sheets
ling in the inline dimension too. Box generation Box generation is the part of the CSS visual formatting model that creates boxes from the document's elements. Generated boxes are of different types, which affect their visual formatting. The type of the box generated depends on the value of the CSS display property. Initially defined in CSS2, the display property is extended in the CSS Display
Module Level 3. In addition, some of the terminologies around the display have been updated and clarified in the years since CSS2. CSS takes your source document and renders it onto a canvas. To do this, it generates an intermediary structure, the box tree, which represents the formatting structure of the rendered document. Each box in the box tree represents its corresponding element (or pseudo-elemen...
<angle-percentage> - CSS: Cascading Style Sheets
yntax Refer to the documentation for <angle> and <percentage> for details of the individual syntaxes allowed by this type. Use in calc() Where an <angle-percentage> is specified as an allowable type, this means that the percentage resolves to an angle and therefore can be used in a calc() expression. Specifications Specification Status Comment CSS Values and Units
Module Level 4The definition of '<angle-percentage>' in that specification. Editor's Draft CSS Values and Units
Module Level 3The definition of '<angle-percentage>' in that specification. Candidate Recommendation Defines <angle-percentage>. Adds calc() ...
aspect-ratio - CSS: Cascading Style Sheets
at accept width and height attributes. This appears in the browser's internal UA stylesheet. Chrome is also shipping this feature. In Firefox, the internal stylesheet rule looks like this: img, input[type="image"], video, embed, iframe, marquee, object, table { aspect-ratio: attr(width) / attr(height); } Specifications Specification Status Comment CSS Box Sizing
Module Level 4The definition of 'aspect-ratio' in that specification. Editor's Draft Initial definition Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroi...
text-overflow - CSS: Cascading Style Sheets
34567890 text-overflow: ',' clip ,3456 1234567890 ,4321 1234567890 text-overflow: ',' ellipsis ,34... 1234567890 ,43... 1234567890 text-overflow: ',' '.' ,34. 1234567890 ,43. 1234567890 Specifications Specification Status Comment CSS Overflow
Module Level 4 Added the values <string> and fade and the fade() function CSS Overflow
Module Level 3The definition of 'text-overflow' in that specification. Working Draft Initial definition A previous version of this interface reached the Candidate Recommendation status. As some not-listed-at-risk features needed to be removed, the spec was demoted to the Working Draft leve...
text-transform - CSS: Cascading Style Sheets
code points, the body of letter and dakuten. The full-width combines these into a single code point when converting these characters into full-width. full-size-kana <p>???? ???? ???? ???? ???? ???? ????</p> <p>???? ???? ???? ???? ???? ???? ????</p> </p> p:nth-of-type(2) { text-transform: full-size-kana; } Specifications Specification Status Comment CSS Text
Module Level 3The definition of 'text-transform' in that specification. Working Draft From CSS Level 2 (Revision 1)The definition of 'text-transform' in that specification., extends letters to any Unicode character in the Number or Letter general category. Modifies the behavior of capitalize to apply to the first letter of the word, ignoring initial punctuations or symbols. Adds the full-width and...
text-underline-offset - CSS: Cascading Style Sheets
offset wavy red underline!</p> <br> <p class="twolines">This text has lines both above and below it. Only the bottom one is offset.</p> p { text-decoration: underline wavy red; text-underline-offset: 1em; } .twolines { text-decoration-color: purple; text-decoration-line: underline overline; } Specifications Specification Status Comment CSS Text Decoration
Module Level 4The definition of 'text-underline-offset' in that specification. Working Draft Initial definition. ...
text-underline-position - CSS: Cascading Style Sheets
not reset by the text-decoration shorthand property, it may be appropriate to set its value at a global level. For example, the under value may be appropriate for a document with lots of chemical and mathematical formulas, which make a large use of subscripts. :root { text-underline-position: under; } Specifications Specification Status Comment CSS Text Decoration
Module Level 3The definition of 'text-underline-position' in that specification. Candidate Recommendation Initial definition ...
<time-percentage> - CSS: Cascading Style Sheets
g + and a unit -0ms Zero with a leading - and a unit Invalid times 0 Although unitless zero is allowed for <length>s, it's invalid for <time>s. 12.0 This is a <number>, not a <time>, because it's missing a unit. 7 ms No space is allowed between the number and the unit. Specifications Specification Status Comment CSS Values and Units
Module Level 4The definition of '<time-percentage>' in that specification. Editor's Draft CSS Values and Units
Module Level 3The definition of '<time-percentage>' in that specification. Candidate Recommendation Defines <time-percentage>. Adds calc() ...
<time> - CSS: Cascading Style Sheets
g + and a unit -0ms Zero with a leading - and a unit Invalid times 0 Although unitless zero is allowed for <length>s, it's invalid for <time>s. 12.0 This is a <number>, not a <time>, because it's missing a unit. 7 ms No space is allowed between the number and the unit. Specifications Specification Status Comment CSS Values and Units
Module Level 4The definition of '<time>' in that specification. Editor's Draft CSS Values and Units
Module Level 3The definition of '<time>' in that specification. Candidate Recommendation Normative definition of s and ms. CSS Level 2 (Revision 1)The definition of '<time>' in that specification. Recommendation Informal definition of s and ms. ...
top - CSS: Cascading Style Sheets
Working Draft Adds behavior for sticky positioning. CSS Level 2 (Revision 1)The definition of 'top' in that specification. Recommendation Initial definition. ...
unicode-bidi - CSS: Cascading Style Sheets
Proposed Recommendation Added plaintext, isolate, and isolate-override keywords. CSS Level 2 (Revision 1)The definition of 'unicode-bidi' in that specification. Recommendation Initial definition. ...
visibility - CSS: Cascading Style Sheets
Candidate Recommendation Defines the collapse value as it applies to flex items. CSS Level 2 (Revision 1)The definition of 'visibility' in that specification. Recommendation Initial definition. ...
white-space - CSS: Cascading Style Sheets
iam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> Result Specifications Specification Status Comment CSS Text
Module Level 3The definition of 'white-space' in that specification. Working Draft Precisely defines the breaking algorithms. CSS Level 2 (Revision 1)The definition of 'white-space' in that specification. Recommendation Initial definition. ...
widows - CSS: Cascading Style Sheets
first one. It is used to demonstrate how widows work.</p> <p>This is the third paragraph. It has a little bit more text than the first one.</p> </div> CSS div { background-color: #8cffa0; columns: 3; widows: 2; } p { background-color: #8ca0ff; } p:first-child { margin-top: 0; } Result Specifications Specification Status Comment CSS Fragmentation
Module Level 3The definition of 'widows' in that specification. Candidate Recommendation Extends widows to apply to any type of fragment, including pages, regions, or columns. CSS Multi-column Layout
ModuleThe definition of 'widows' in that specification. Working Draft Recommendations to consider widows in relation to columns. CSS Level 2 (Revision 1)The definition of 'wido...
word-spacing - CSS: Cascading Style Sheets
Working Draft Replaces the previous values with a <spacing-limit> value that defines the same thing, plus the <percentage> value. Allows up to three values describing the optimum, minimum, and maximum value. CSS Level 2 (Revision 1)The definition of 'word-spacing' in that specification. Recommendation No change. ...
EXSLT
XSLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes EXSLT is a set of extensions to XSLT. There are a number of
modules; those that are supported by Firefox are listed below: Common (exsl)The EXSLT Common package provides basic functions that expand upon the capabilities of XSLT.Math (math)The EXSLT Math package provides functions for working with numeric values and comparing nodes.Regular expressions (regexp)The EXSLT Regular Expressions package provides functions that allow testing, matching, and replacing text using JavaScript style regular expressions.Sets (set)The EXSLT Sets package offers functions that let you perform set manipulation.Strings (str)The EXSLT Strings package provides functions that allow the manipulation of strings. EXSLT modul...
Live streaming web audio and video - Developer guides
mer provides support for more than a hundred codecs (including MPEG-1, MPEG-2, MPEG-4, H.261, H.263, H.264, RealVideo, MP3, WMV, and FLV.) GStreamer plugins such as souphttpclientsink and shout2send exist to stream media over HTTP. You can also integrate with Python's Twisted framework or use something like Flumotion (open source streaming software). For RTMP transfer you can use the Nginx RTMP
Module. SHOUTcast SHOUTcast is a cross-platform proprietary technology for streaming media. Developed by Nullsoft, it allows digital audio content in MP3 or AAC format to be broadcast. For web use, SHOUTcast streams are transmitted over HTTP. Note: SHOUTcast URLs may require a semi-colon to be appended to them. Icecast The Icecast server is an open source technology for streaming media. Maintained ...
Block formatting context - Developer guides
Candidate Recommendation define BFC(abbr) etc. CSS Level 2 (Revision 1)The definition of 'Block Formatting Context' in that specification. Recommendation Initial definition. See also float, clear CSS Key Concepts: CSS syntax, at-rule, comments, specificity and inheritance, the box, la...
HTML5 - Developer guides
orientation of the screen (portrait or landscape). Pointer Lock API Allows locking the pointer to the content, so games and similar application don't lose focus when the pointer reaches the window limit. StylIng CSS has been extended to be able to style elements in a much more complex way. This is often referred as CSS3, though CSS is not a monolithic specification any more and the different
modules are not all at level 3: some are at level 1 and others at level 4, with all the intermediate levels covered. New background styling features It is now possible to put shadows on elements using box-shadow, multiple backgrounds, and CSS filters. You can learn more about these by reading Advanced box effects. More fancy borders Not only it is now possible to use images to style borders, using...
Standard metadata names - HTML: Hypertext Markup Language
aviour is undefined and may vary between them. Some crawler robots, like Google, Yahoo and Bing, support the same values for the HTTP header X-Robots-Tag; this allows non-HTML documents like images to use these rules. Specifications Specification HTML Living StandardThe definition of 'standard metadata names' in that specification. CSS Color Adjustment
Module Level 1The definition of 'the "color-scheme" metadata name' in that specification. CSS Device AdaptationThe definition of 'the "viewport" metadata name' in that specification. Referrer PolicyThe definition of 'the "referrer" metadata name' in that specification. ...
HTML documentation index - HTML: Hypertext Markup Language
resource's origin, and therefore the browser can likely improve the user experience by preemptively performing DNS resolution for that origin. 225 Link types: manifest App, Attribute, HTML, Link, Link types, Manifest, Reference The manifest keyword for the rel attribute of the <link> element indicates that the target resource is a Web app manifest. 226 Link types:
modulepreload Attribute, HTML, Link, Link types, Reference The
modulepreload keyword for the rel attribute of the <link> element provides a declarative way to preemptively fetch a
module script and its dependencies, and store them in the document's
module map for later evaluation. 227 Link types: noopener Attribute, HTML, Link types, Reference The noopener keyword for the ...
Link types - HTML: Hypertext Markup Language
istinguish between a hyperlink applying to a specific part of the document or to the document as a whole. Only the data on the page can indicate this. Note: Although recognized, the synonym copyright is incorrect and must be avoided. <a>, <area>, <form>, <link> None. manifest Indicates that the linked file is a Web App Manifest. <link> <a>, <area>, <form>
modulepreload Initiates early (and high-priority) loading of
module scripts. <link> <a>, <area>, <form> next Indicates that the hyperlink leads to the next resource of the sequence the current page is in. Note: Other link types related to linking resources in the same sequence are first, prev, last. <a>, <area>, <form>, <link> None. nofollow Indicates that...
Common MIME types - HTTP
guages https://html.spec.whatwg.org/multipage/#dependencies:willful-violation https://datatracker.ietf.org/doc/draft-ietf-dispatch-javascript-mjs/ .json JSON format application/json .jsonld JSON-LD format application/ld+json .mid .midi Musical Instrument Digital Interface (MIDI) audio/midi audio/x-midi .mjs JavaScript
module text/javascript .mp3 MP3 audio audio/mpeg .mpeg MPEG Video video/mpeg .mpkg Apple Installer Package application/vnd.apple.installer+xml .odp OpenDocument presentation document application/vnd.oasis.opendocument.presentation .ods OpenDocument spreadsheet document application/vnd.oasis.opendocument.spreadsheet .o...
Compression in HTTP - HTTP
ccept-Encoding alongside this header in the response; that way, caches will be able to cache the different representations of the resource. As compression brings significant performance improvements, it is recommended to activate it for all files, but already compressed ones like images, audio files and videos. Apache supports compression and uses mod_deflate; for nginx there is ngx_http_gzip_
module; for IIS, the <httpCompression> element. Hop-by-hop compression Hop-by-hop compression, though similar to end-to-end compression, differs by one fundamental element: the compression doesn't happen on the resource in the server, creating a specific representation that is then transmitted, but on the body of the message between any two nodes on the path between the client and the server. Connecti...
Content-Encoding - HTTP
emes that will be sent along in an HTTP request. The Accept-Encoding header is used for negotiating content encoding. Accept-Encoding: gzip, deflate The server responds with the scheme used, indicated by the Content-Encoding response header. Content-Encoding: gzip Note that the server is not obligated to use any compression method. Compression highly depends on server settings and used server
modules. Specifications Specification Title RFC 7932: Brotli Compressed Data Format Brotli Compressed Data Format RFC 7231, section 3.1.2.2: Content-Encoding Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content RFC 2616, section 14.11: Content-Encoding Content-Encoding ...
CSP: base-uri - HTTP
ts loaded by that root script. At the same time, any allow-list or source expressions such as 'self' or 'unsafe-inline' are ignored. See script-src for an example. 'report-sample' Requires a sample of the violating code to be included in the violation report. Examples Meta tag configuration <meta http-equiv="Content-Security-Policy" content="base-uri 'self'"> Apache configuration <If
Module mod_headers.c> Header set Content-Security-Policy "base-uri 'self'"; </If
Module> Nginx configuration add_header Content-Security-Policy "base-uri 'self';" Violation case Since your domain isn't example.com, a <base> element with its href set to https://example.com will result in a CSP violation. <meta http-equiv="Content-Security-Policy" content="base-uri 'self'"> <base href="https://example...
CSP: form-action - HTTP
loaded by that root script. At the same time, any allow-list or source expressions such as 'self' or 'unsafe-inline' are ignored. See script-src for an example. 'report-sample' Requires a sample of the violating code to be included in the violation report. Examples Meta tag configuration <meta http-equiv="Content-Security-Policy" content="form-action 'none'"> Apache configuration <If
Module mod_headers.c> Header set Content-Security-Policy "form-action 'none'; </If
Module> Nginx configuration add_header Content-Security-Policy "form-action 'none';" Violation case Using a <form> element with an action set to inline JavaScript will result in a CSP violation. <meta http-equiv="Content-Security-Policy" content="form-action 'none'"> <form action="javascript:alert('Foo')" id="form1" ...
X-XSS-Protection - HTTP
um only) Enables XSS filtering. If a cross-site scripting attack is detected, the browser will sanitize the page and report the violation. This uses the functionality of the CSP report-uri directive to send a report. Example Block pages from loading when they detect reflected XSS attacks: X-XSS-Protection: 1; mode=block PHP header("X-XSS-Protection: 1; mode=block"); Apache (.htaccess) <If
Module mod_headers.c> Header set X-XSS-Protection "1; mode=block" </If
Module> Nginx add_header "X-XSS-Protection" "1; mode=block"; Specifications Not part of any specifications or drafts. ...
CSS Houdini
ring based HTMLElement.style manipulations. Every element and style sheet rule has a style map which is accessible via its StylePropertyMap. A feature of CSS Houdini is the Worklet. With worklets, you can create modular CSS, requiring a single line of JavaScript to import configureable components: no pre-processors, post-processors or JavaScript frameworks needed. <script> CSS.paintWorklet.add
Module('csscomponent.js'); </script> This added
module contains registerPaint() functions, which register completely configurable worklets. The CSS paint() function parameters include the name of the worklet, along with optional parameters. The worklet also has access to the element's custom properties: they don't need to be passed as function arguments. li { background-image: paint(myComponent, st...
Closures - JavaScript
ot provide a native way of doing this, but it is possible to emulate private methods using closures. Private methods aren't just useful for restricting access to code. They also provide a powerful way of managing your global namespace. The following code illustrates how to use closures to define public functions that can access private functions and variables. Note that these closures follow the
Module Design Pattern. var counter = (function() { var privateCounter = 0; function changeBy(val) { privateCounter += val; } return { increment: function() { changeBy(1); }, decrement: function() { changeBy(-1); }, value: function() { return privateCounter; } }; })(); console.log(counter.value()); // 0. counter.increment(); counter.increment...
Keyed collections - JavaScript
implementation details. The following example is from Nick Fitzgerald's blog post "Hiding Implementation Details with ECMAScript 6 WeakMaps". The private data and methods belong inside the object and are stored in the privates WeakMap object. Everything exposed on the instance and prototype is public; everything else is inaccessible from the outside world because privates is not exported from the
module. const privates = new WeakMap(); function Public() { const me = { // Private data goes here }; privates.set(this, me); } Public.prototype.method = function () { const me = privates.get(this); // Do stuff with private data in `me`... };
module.exports = Public; Sets Set object Set objects are collections of values. You can iterate its elements in insertion order. A value in a ...
Using Promises - JavaScript
on property that provides the reason given for the promise to be rejected. These make it possible to offer fallback error handling for promises, as well as to help debug issues with your promise management. These handlers are global per context, so all errors will go to the same event handlers, regardless of source. One case of special usefulness: when writing code for Node.js, it's common that
modules you include in your project may have unhandled rejected promises. These get logged to the console by the Node runtime. You can capture these for analysis and handling by your code--or just to avoid having them cluttering up your output--by adding a handler for the unhandledrejection event, like this: window.addEventListener("unhandledrejection", event => { /* You might start here by adding co...
JavaScript Guide - JavaScript
ing objects Defining methods Getter and setter Details of the object model Prototype-based OOP Creating object hierarchies Inheritance Promises Guarantees Chaining Error propagation Composition Timing Iterators and generators Iterators Iterables Generators Meta programming Proxy Handlers and traps Revocable Proxy Reflect JavaScript
modules Exporting Importing Default exports Renaming features Aggregating
modules Dynamic
module loading Next >> ...
TypeError: "x" is not a function - JavaScript
multiplication In math, you can write 2 x (3 + 5) as 2*(3 + 5) or just 2(3 + 5). Using the latter will throw an error: const sixteen = 2(3 + 5); alert('2 x (3 + 5) is ' + String(sixteen)); //Uncaught TypeError: 2 is not a function You can correct the code by adding a * operator: const sixteen = 2 * (3 + 5); alert('2 x (3 + 5) is ' + String(sixteen)); //2 x (3 + 5) is 16 Import the exported
module correctly Ensure you are importing the
module correctly. An example helpers library (helpers.js) let helpers = function () { }; helpers.groupBy = function (objectArray, property) { return objectArray.reduce(function (acc, obj) { var key = obj[property]; if (!acc[key]) { acc[key] = []; } acc[key].push(obj); return acc; }, {}); } export default helpers; The corr...
getter - JavaScript
lowing example, the object has a getter as its own property. On getting the property, the property is removed from the object and re-added, but implicitly as a data property this time. Finally, the value gets returned. get notifier() { delete this.notifier; return this.notifier = document.getElementById('bookmarked-notification-anchor'); }, For Firefox code, see also the XPCOMUtils.jsm code
module, which defines the defineLazyGetter() function. get vs. defineProperty While using the get keyword and Object.defineProperty() have similar results, there is a subtle difference between the two when used on classes. When using get the property will be defined on the instance's prototype, while using Object.defineProperty() the property will be defined on the instance it is applied to. class E...
Atomics - JavaScript
Unlike the other global objects, Atomics is not a constructor. You cannot use it with a new operator or invoke the Atomics object as a function. All properties and methods of Atomics are static (as is the case with the Math object, for example). Atomic operations When memory is shared, multiple threads can read and write the same data in memory. ...
Function - JavaScript
Specifications Specification ECMAScript (ECMA-262)The definition of 'Function' in that specification. ...
Math.clz32() - JavaScript
er bits after the first zero integer &= (integer << 16) | 0xffff; integer &= (integer << 8 ) | 0x00ff; integer &= (integer << 4 ) | 0x000f; integer &= (integer << 2 ) | 0x0003; integer &= (integer << 1 ) | 0x0001; // 2. Now, inversing the bits reveals the lowest zeros return 32 - clon(~integer) |0; */ } Make these helper functions into ASM.JS
module; then, you have a true performance masterpiece. Situations like these are exactly what ASM.JS was designed for. var countTrailsMethods = (function(stdlib, foreign, heap) { "use asm"; var clz = stdlib.Math.clz32; function ctrz(integer) { // count trailing zeros integer = integer | 0; // coerce to an integer // 1. fill in all the higher bits after the first one ...
WebAssembly.LinkError() constructor - JavaScript
Syntax new WebAssembly.LinkError(message, fileName, lineNumber) Parameters message Optional Human-readable description of the error. fileName Optional The name of the file containing the code that caused the exception. lineNumber Optional The line number of the code that caused the exception. ...
WebAssembly.LinkError - JavaScript
Constructor WebAssembly.LinkError() Creates a new WebAssembly.LinkError object. Instance properties WebAssembly.LinkError.prototype.message Error message. Although ECMA-262 specifies that URIError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. WebAssembly.LinkError.prototype.name Error name. Inherited from Error. WebAssembly.LinkError.prototype.fileName Path to file that raised this error. Inherited from Error. WebAssembly.LinkError.prototype.lineNumber Line number in file that raised this error. Inherited from Error. ...
WebAssembly.Memory() constructor - JavaScript
first way is to construct it from JavaScript. The following example creates a new WebAssembly Memory instance with an initial size of 10 pages (640KiB), and a maximum size of 100 pages (6.4MiB). Its buffer property will return an ArrayBuffer. var memory = new WebAssembly.Memory({initial:10, maximum:100}); The second way to get a WebAssembly.Memory object is to have it exported by a WebAssembly
module. The following example (see memory.html on GitHub, and view it live also) fetches and instantiates the loaded memory.wasm byte code using the WebAssembly.instantiateStreaming() method, while importing the memory created in the line above. It then stores some values in that memory, then exports a function and uses it to sum some values. WebAssembly.instantiateStreaming(fetch('memory.wasm'), { js:...
WebAssembly.Memory - JavaScript
first way is to construct it from JavaScript. The following example creates a new WebAssembly Memory instance with an initial size of 10 pages (640KiB), and a maximum size of 100 pages (6.4MiB). Its buffer property will return an ArrayBuffer. var memory = new WebAssembly.Memory({initial:10, maximum:100}); The second way to get a WebAssembly.Memory object is to have it exported by a WebAssembly
module. The following example (see memory.html on GitHub, and view it live also) fetches and instantiates the loaded memory.wasm byte code using the WebAssembly.instantiateStreaming() method, while importing the memory created in the line above. It then stores some values in that memory, then exports a function and uses it to sum some values. WebAssembly.instantiateStreaming(fetch('memory.wasm'), { js...
WebAssembly.Table() constructor - JavaScript
ia Table.prototype.get() to show that the length is two and both elements are null. var tbl = new WebAssembly.Table({initial:2, element:"anyfunc"}); console.log(tbl.length); // "2" console.log(tbl.get(0)); // "null" console.log(tbl.get(1)); // "null" We then create an import object that contains the table: var importObj = { js: { tbl:tbl } }; Finally, we load and instantiate a wasm
module (table2.wasm) using the WebAssembly.instantiateStreaming() method. The table2.wasm
module contains two functions (one that returns 42 and another that returns 83) and stores both into elements 0 and 1 of the imported table (see text representation). So after instantiation, the table still has length 2, but the elements now contain callable Exported WebAssembly Functions which we can call from J...
WebAssembly.Table - JavaScript
ia Table.prototype.get() to show that the length is two and both elements are null. var tbl = new WebAssembly.Table({initial:2, element:"anyfunc"}); console.log(tbl.length); // "2" console.log(tbl.get(0)); // "null" console.log(tbl.get(1)); // "null" We then create an import object that contains the table: var importObj = { js: { tbl:tbl } }; Finally, we load and instantiate a wasm
module (table2.wasm) using the WebAssembly.instantiateStreaming() method. The table2.wasm
module contains two functions (one that returns 42 and another that returns 83) and stores both into elements 0 and 1 of the imported table (see text representation). So after instantiation, the table still has length 2, but the elements now contain callable Exported WebAssembly Functions which we can call from J...
globalThis - JavaScript
yes Description Historically, accessing the global object has required different syntax in different JavaScript environments. On the web you can use window, self, or frames - but in Web Workers only self will work. In Node.js none of these work, and you must instead use global. The this keyword could be used inside functions running in non-strict mode, but this will be undefined in
Modules and inside functions running in strict mode. You can also use Function('return this')(), but environments that disable eval(), like CSP in browsers, prevent use of Function in this way. The globalThis property provides a standard way of accessing the global this value (and hence the global object itself) across environments. Unlike similar properties such as window and self, it's guaranteed to ...
let - JavaScript
Redeclarations Redeclaring the same variable within the same function or block scope raises a SyntaxError. if (x) { let foo; let foo; // SyntaxError thrown. } You may encounter errors in switch statements because there is only one block. let x = 1; switch(x) { case 0: let foo; break; case 1: let foo; // S...
var - JavaScript
of the global object. JavaScript has automatic memory management, and it would make no sense to be able to use the delete operator on a global variable. 'use strict'; var x = 1; globalThis.hasOwnProperty('x'); // true delete globalThis.x; // TypeError in strict mode. Fails silently otherwise. delete x; // SyntaxError in strict mode. Fails silently otherwise. Note that in both NodeJS CommonJS
modules and native ECMAScript
modules, top-level variable declarations are scoped to the
module, and are not, therefore added as properties to the global object. Unqualified identifier assignments The global object sits at the top of the scope chain. When attempting to resolve a name to a value, the scope chain is searched. This means that properties on the global object are conveniently visible from ...
Statements and declarations - JavaScript
roperty. while Creates a loop that executes a specified statement as long as the test condition evaluates to true. The condition is evaluated before executing the statement. Others debugger Invokes any available debugging functionality. If no debugging functionality is available, this statement has no effect. export Used to export functions to make them available for imports in external
modules, and other scripts. import Used to import functions exported from an external
module, another script. import.meta An object exposing context-specific metadata to a JavaScript
module. label Provides a statement with an identifier that you can refer to using a break or continue statement. with Extends the scope chain for a statement. Specifications Specification EC...
Strict mode - JavaScript
to invoke strict mode for a function, put the exact statement "use strict"; (or 'use strict';) in the function's body before any other statements. function strict() { // Function-level strict mode syntax 'use strict'; function nested() { return 'And so am I!'; } return "Hi! I'm a strict mode function! " + nested(); } function notStrict() { return "I'm not strict."; } Strict mode for
modules ECMAScript 2015 introduced JavaScript
modules and therefore a 3rd way to enter strict mode. The entire contents of JavaScript
modules are automatically in strict mode, with no statement needed to initiate it. function strict() { // because this is a
module, I'm strict by default } export default strict; Changes in strict mode Strict mode changes both syntax and runtime behavior. Change...
JavaScript reference - JavaScript
rayBuffer Atomics DataView JSON Control abstraction Promise Generator GeneratorFunction AsyncFunction Reflection Reflect Proxy Internationalization Intl Intl.Collator Intl.DateTimeFormat Intl.DisplayNames Intl.ListFormat Intl.Locale Intl.NumberFormat Intl.PluralRules Intl.RelativeTimeFormat WebAssembly WebAssembly WebAssembly.
Module WebAssembly.Instance WebAssembly.Memory WebAssembly.Table WebAssembly.CompileError WebAssembly.LinkError WebAssembly.RuntimeError Statements JavaScript statements and declarations Control flowBlock break continue Empty if...else switch throw try...catch Declarations var let const Functions and classes function function* async function ...
JavaScript shells - JavaScript
, with compiled binaries for Windows, Mac, and Linux. JavaLikeScript - A standalone, extensible JavaScript shell including both native and JavaScript libraries. GLUEscript - A standalone JavaScript shell for writing cross-platform JavaScript applications. It can use wxWidgets for GUI apps and was formerly called wxJavaScript. jspl - A standalone JavaScript shell enhanced by Perl. Can use Perl
modules directly from JavaScript: DBI for database integration, GTK2 for GUI apps, POSIX for system programming, etc. The best of CPAN now for JavaScript programmers. ShellJS - Portable Unix shell commands for Node.js List of JavaScript shells The following JavaScript shells work with Mozilla. Firefox has a built-in JavaScript console, which support multi-line editing. JavaScript Shell (js) - A ...
Lazy loading - Web Performance
ral Code splitting JavaScript, CSS and HTML can be split into smaller chunks. This enables sending the minimal code required to provide value upfront, improving page-load times. The rest can be loaded on demand. Entry point splitting: separates code by entry point(s) in the app Dynamic splitting: separates code where dynamic import() statements are used JavaScript Script type
module Any script tag with type="
module" is treated like a JavaScript
module and is deferred by default. CSS By default, CSS is treated as a render blocking resource, so the browser won't render any processed content until the CSSOM is constructed. CSS must be thin, delivered as quickly as possible, and the usage media types and queries are advised to unblock rendering. <link href="style.css" ...
Performance budgets - Web Performance
mate value of a Performance Budget is to correlate the impact of Performance on business or product goals. When defining metrics, you should focus on User Experience, which will dictate not only the bounce or conversion rate but how likely is that user to return. How do I implement a performance budget? During development, there are a few tools to run checks against new or modified assets: A
module bundler (e.g. webpack), has performance features that will notify you when assets exceed specified limits. Bundlesize, allows you to define and run file size checks in your CI pipeline. File size checks are the first line of defense against regressions but translating size back into time metrics can be difficult since development environments could be missing 3rd party scripts, and optimizatio...
Progressive loading - Progressive web apps (PWAs)
t only the images, but the complete items consisting of full descriptions and links. It would work like an infinite scroll -- loading the items on the list only when the user scrolls the page down. That way the initial HTML structure would be minimal, loading time even smaller, and we would have even greater performance benefits. Conclusion Less files to load initially, smaller files split into
modules, use of placeholders, and loading more content on demand -- this will help achieve faster initial load times, which brings benefits to the app creator and offers a smoother experience to the user. Remember about the progressive enhancement approach -- offer a usable product no matter the device or platform, but be sure to enrich the experience to those using modern browsers. Final thoughts Th...
Progressive web apps (PWAs)
. Tools localForage -- A nice simple JavaScript library for making client-side data storage really simple; it uses IndexedDB by default and falls back to Web SQL/Web Storage if necessary. ServiceWorkerWare -- An Express-like microframework for easy Service Worker development. oghliner -- Not only a template but a tool for deploying Offline Web Apps to GitHub Pages. sw-precache -- A node
module to generate service worker code that will precache specific resources. workbox -- Spiritual successor to sw-precache with more advanced caching strategies and easy precaching. upup -- A tiny script that makes sure your site is always there for your users. The service worker cookbook -- A series of excellent service worker/push recipes, showing how to implement an offline app, but also much mor...
amplitude - SVG: Scalable Vector Graphics
attribute controls the amplitude of the gamma function of a component transfer element when its type attribute is gamma. Four elements are using this attribute: <feFuncA>, <feFuncB>, <feFuncG>, and <feFuncR> Usage notes Value <number> Default value 1 Animatable Yes Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'amplitude' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'amplitude' in that specification. Recommendation Initial definition ...
azimuth - SVG: Scalable Vector Graphics
Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'azimuth' in that specification. Recommendation Initial definition ...
bias - SVG: Scalable Vector Graphics
d to each component. This allows representation of values that would otherwise be clamped to 0 or 1. Usage notes Value <number> Default value 0 Animatable Yes One application of bias is when it is desirable to have 0.5 gray value be the zero response of the filter. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'bias' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'bias' in that specification. Recommendation Initial definition ...
clip-path - SVG: Scalable Vector Graphics
Candidate Recommendation Extends its application to HTML elements. The clip-path property replaces the deprecated clip property. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'clip-path' in that specification. Recommendation Initial definition (applies to SVG elements only). ...
clip - SVG: Scalable Vector Graphics
element.The value rect() defines a clipping rectangle following the following syntax: rect(<top>, <right>, <bottom>, <left>). The <top> and <bottom> values specify offsets from the top border edge of the element viewport, while <right> and <left> specify offsets from the left border edge of the element viewport. Specifications Specification Status Comment CSS Masking
Module Level 1The definition of 'clip' in that specification. Candidate Recommendation Deprecates clip property, suggests clip-path as replacement. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'clip' in that specification. Recommendation Initial definition ...
clipPathUnits - SVG: Scalable Vector Graphics
inside the <clipPath> element are relative to the bounding box of the element the clipping path is applied to. It means that the origin of the coordinate system is the top left corner of the object bounding box and the width and height of the object bounding box are considered to have a length of 1 unit value. Specifications Specification Status Comment CSS Masking
Module Level 1The definition of 'clipPathUnits' in that specification. Candidate Recommendation Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'clipPathUnits' in that specification. Recommendation Initial definition ...
color-interpolation-filters - SVG: Scalable Vector Graphics
that the author doesn't require that color interpolation occur in a particular color space. sRGB Indicates that color interpolation should occur in the sRGB color space. linearRGB Indicates that color interpolation should occur in the linearized RGB color space as described in the sRGB specification. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'color-interpolation' in that specification. Working Draft No significant change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'color-interpolation-filters' in that specification. Recommendation Initial definition Browser compatibility The compatibility table on this page is generated from structured data. If you'd like ...
direction - SVG: Scalable Vector Graphics
Proposed Recommendation Definition in CSS Scalable Vector Graphics (SVG) 2The definition of 'direction' in that specification. Candidate Recommendation Refers to the CSS Writing Modes specification of the direction property. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'direction' in ...
divisor - SVG: Scalable Vector Graphics
nsform:translateX(220px);"/> </svg> Usage notes Value <number> Default value Sum of all values in kernelMatrix or 1 if sum is 0 Animatable Yes <number> This value defines the divisor. If the specified divisor is 0 then the default value will be used instead. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'divisor' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'divisor' in that specification. Recommendation Initial definition ...
dx - SVG: Scalable Vector Graphics
the x-axis for each individual glyph relative to the preceding glyph. If there are less values than glyphs, the remaining glyphs use a value of 0. If there are more values than glyphs, extra values are ignored. Value List of <length> Default value none Animatable Yes Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'dx' in that specification. Working Draft Initial definition for <feDropShadow> Filter Effects
Module Level 1The definition of 'dx' in that specification. Working Draft Definition for <feOffset> Scalable Vector Graphics (SVG) 2The definition of 'dx' in that specification. Candidate Recommendation Definition for <text> and <tspan> ...
dy - SVG: Scalable Vector Graphics
y-axis for each individual glyph relative to the preceding glyph. If there are less values than glyphes, the remaining glyphes use a value of 0. If there are more values than glyphes, extra values are ignored. Value List of <length> Default value none Animatable Yes Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'dy' in that specification. Working Draft Initial definition for <feDropShadow> Filter Effects
Module Level 1The definition of 'dy' in that specification. Working Draft Definition for <feOffset> Scalable Vector Graphics (SVG) 2The definition of 'dy' in that specification. Candidate Recommendation Definition for <text> and <tspan> ...
edgeMode - SVG: Scalable Vector Graphics
ecessary by duplicating the color values at the given edge of the input image. wrap This value indicates that the input image is extended by taking the color values from the opposite edge of the image. none This value indicates that the input image is extended with pixel values of zero for R, G, B and A. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'edgeMode for <feGaussianBlur>' in that specification. Working Draft Initial definition for <feGaussianBlur> Filter Effects
Module Level 1The definition of 'edgeMode for <feConvolveMatrix>' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'edgeMode for <feConvolveMatrix>' in t...
elevation - SVG: Scalable Vector Graphics
Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'elevation' in that specification. Recommendation Initial definition ...
exponent - SVG: Scalable Vector Graphics
Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'exponent' in that specification. Recommendation Initial definition ...
filter - SVG: Scalable Vector Graphics
aussianBlur stdDeviation="2" /> </filter> <rect x="10" y="10" width="80" height="80" filter="url(#blur)" /> </svg> Usage notes Value none | <filter-function-list> Default value none Animatable Yes For a description of the values see the css filter property. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'filter' in that specification. Working Draft Extended the values by several special filter functions. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'filter' in that specification. Recommendation Initial definition Browser compatibility The compatibility table on this page is generated from structured data. If you'd like...
filterUnits - SVG: Scalable Vector Graphics
place at the time when the <filter> element is referenced (i.e., the user coordinate system for the element referencing the <filter> element via a filter attribute). objectBoundingBox In that case, x, y, width and height represent fractions or percentages of the bounding box on the referencing element. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'filterUnits' in that specification. Working Draft Initial definition Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'filterUnits' in that specification. Recommendation Initial definition ...
flood-color - SVG: Scalable Vector Graphics
Working Draft Removed the <icccolor> value and aligned the value to the CSS color value. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'flood-color' in that specification. Recommendation Initial definition ...
flood-opacity - SVG: Scalable Vector Graphics
alue> Initial value 1 Animatable Yes <alpha-value> A number or percentage indicating the opacity value to use across the current filter primitive subregion. A number of 0 or a percentage of 0% represents a fully transparent color, 1 or 100% represents a fully opaque color. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'flood-opacity' in that specification. Working Draft Aligned the value to the CSS <alpha-value> value. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'flood-opacity' in that specification. Recommendation Initial definition ...
font-family - SVG: Scalable Vector Graphics
[ <family-name> | <generic-family> ]#where <family-name> = <string> | <custom-ident>+<generic-family> = serif | sans-serif | cursive | fantasy | monospace Default value Depends on user agent Animatable Yes For a description of the values, please refer to the CSS font-family property. Specifications Specification Status Comment CSS Fonts
Module Level 4The definition of 'generic font families' in that specification. Working Draft Adds new generic font families, specifically: system-ui, emoji, math, and fangsong. CSS Fonts
Module Level 3The definition of 'font-family' in that specification. Candidate Recommendation No significant change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'fon...
font-size-adjust - SVG: Scalable Vector Graphics
The number specified should generally be the aspect ratio (ratio of x-height to font size) of the first choice font-family. This means that the first-choice font, when available, will appear the same size in browsers, whether or not they support font-size-adjust. 0 yields text of zero height (hidden text). Specifications Specification Status Comment CSS Fonts
Module Level 3The definition of 'font-size-adjust' in that specification. Candidate Recommendation No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'font-size-adjust' in that specification. Recommendation Initial definition ...
font-size - SVG: Scalable Vector Graphics
Candidate Recommendation No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'font-size' in that specification. Recommendation Initial definition ...
font-style - SVG: Scalable Vector Graphics
="normal">Normal font style</text> <text x="150" y="20" font-style="italic">Italic font style</text> </svg> Usage notes Value normal | italic | oblique Default value normal Animatable Yes For a description of the values, please refer to the CSS font-style property. Specifications Specification Status Comment CSS Fonts
Module Level 4The definition of 'font-style' in that specification. Working Draft No change CSS Fonts
Module Level 3The definition of 'font-style' in that specification. Candidate Recommendation No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'font-style' in that specification. Recommendation Initial definition Browser compatibili...
font-variant - SVG: Scalable Vector Graphics
re-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero || <east-asian-variant-values> || <east-asian-width-values> || ruby ] Default value normal Animatable Yes For a description of the values, please refer to the CSS font-variant property. Specifications Specification Status Comment CSS Fonts
Module Level 4The definition of 'font-variant' in that specification. Working Draft No change CSS Fonts
Module Level 3The definition of 'font-variant' in that specification. Candidate Recommendation Added many more keywords for different types of variations. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'font-variant' in that specification. Recomme...
font-weight - SVG: Scalable Vector Graphics
rmal">Normal text</text> <text x="100" y="20" font-weight="bold">Bold text</text> </svg> Usage notes Value normal | bold | bolder | lighter | <number> Default value normal Animatable Yes For a description of the values, please refer to the CSS font-weight property. Specifications Specification Status Comment CSS Fonts
Module Level 4The definition of 'font-weight' in that specification. Working Draft Defines font-weight to accept any numbers between 1 and 1000. CSS Fonts
Module Level 3The definition of 'font-weight' in that specification. Candidate Recommendation No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'font-weight' in that specification. Recommen...
height - SVG: Scalable Vector Graphics
the vertical length for the referenced element. Value auto | <length> | <percentage> Default value auto (treated as 0) Animatable Yes Note: Starting with SVG2, height is a Geometry Property meaning this attribute can also be used as a CSS property for used elements. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'height' in that specification. Working Draft Definition for <filter> Filter Effects
Module Level 1The definition of 'height' in that specification. Working Draft Definition for filter primitives CSS Masking
Module Level 1The definition of 'height' in that specification. Candidate Recommendation Definition for <mask> Scalable V...
href - SVG: Scalable Vector Graphics
f for the <a> element. SVG Animations Level 2The definition of 'href for <animate>, <animateMotion>, <animateTransform>, and <set>' in that specification. Editor's Draft Defines href for animation elements. SVG Animations Level 2The definition of 'href for <discard>' in that specification. Editor's Draft Defines href for the <discard> element. Filter Effects
Module Level 1The definition of 'href for <feImage>' in that specification. Candidate Recommendation Defines href for the <feImage> element. Scalable Vector Graphics (SVG) 2The definition of 'href for <image>' in that specification. Candidate Recommendation Defines href for the <image> element. Scalable Vector Graphics (SVG) 2The definition of 'href for <linearGradient>' in...
image-rendering - SVG: Scalable Vector Graphics
ser agent shall make appropriate tradeoffs to balance speed and quality, but quality shall be given more importance than speed. optimizeSpeed Indicates that the user agent shall emphasize rendering speed over quality. optimizeQuality Indicates that the user agent shall emphasize quality over rendering speed. Specifications Specification Status Comment CSS Images
Module Level 3The definition of 'image-rendering' in that specification. Candidate Recommendation Definition in CSS Scalable Vector Graphics (SVG) 2The definition of 'image-rendering' in that specification. Candidate Recommendation No significant change, only added a reference to CSS Images 3 Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'image-render...
in - SVG: Scalable Vector Graphics
Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'in' in that specification. Recommendation Initial definition ...
opacity - SVG: Scalable Vector Graphics
Usage notes Default value 1 Value <alpha-value> Animatable Yes <alpha-value> The uniform opacity setting to be applied across an entire object, as a <number>. Any values outside the range 0.0 (fully transparent) to 1.0 (fully opaque) will be clamped to this range. Specifications Specification Status Comment CSS Color
Module Level 4The definition of 'opacity' in that specification. Working Draft Defines in more detail what this attribute applies to. CSS Color
Module Level 3The definition of 'opacity' in that specification. Recommendation Defines in more detail what this attribute applies to. Scalable Vector Graphics (SVG) 2The definition of 'opacity' in that specification. Candidate R...
operator - SVG: Scalable Vector Graphics
o erode (i.e., thin) or dilate (fatten) the source graphic. Value erode | dilate Default value erode Animatable Yes erode This value thins the source graphic defined in the in attribute. dilate This value fattens the source graphic defined in the in attribute. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'operator for <feMorphology>' in that specification. Working Draft No change Filter Effects
Module Level 1The definition of 'operator for <feComposite>' in that specification. Working Draft Refers to CSS Compositing and Blending specification for the values and added the lighter value. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The de...
order - SVG: Scalable Vector Graphics
r, indicates the number of rows in the matrix. If no second number is not provided, it defaults to the first number. It is recommended that only small values (e.g., 3) be used; higher values may result in very high CPU overhead and usually do not produce results that justify the impact on performance. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'order' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'order' in that specification. Recommendation Initial definition ...
pointsAtX - SVG: Scalable Vector Graphics
Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'pointsAtX' in that specification. Recommendation Initial definition ...
pointsAtY - SVG: Scalable Vector Graphics
Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'pointsAtY' in that specification. Recommendation Initial definition ...
pointsAtZ - SVG: Scalable Vector Graphics
Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'pointsAtZ' in that specification. Recommendation Initial definition ...
preserveAlpha - SVG: Scalable Vector Graphics
s true This value indicates that the convolution will only apply to the color channels. In this case, the filter will temporarily unpremultiply the color component values and apply the kernel. false This value indicates that the convolution will apply to all channels, including the alpha channel. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'preserveAlpha' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'preserveAlpha' in that specification. Recommendation Initial definition ...
preserveAspectRatio - SVG: Scalable Vector Graphics
lice>? Default value xMidYMid meet Animatable Yes view For <view>, preserveAspectRatio indicates if a uniform scaling must be performed to fit the element viewport. Value <align> <meetOrSlice>? Default value xMidYMid meet Animatable Yes Specification Specification Status Comment Filter Effects
Module Level 1The definition of 'preserveAspectRatio' in that specification. Working Draft Scalable Vector Graphics (SVG) 2The definition of 'preserveAspectRatio' in that specification. Candidate Recommendation Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'preserveAspectRatio' in that specification. Recommendation Initial definition ...
primitiveUnits - SVG: Scalable Vector Graphics
r> element is referenced (i.e., the user coordinate system for the element referencing the <filter> element via a filter attribute). objectBoundingBox This value indicates that any length values within the filter definitions represent fractions or percentages of the bounding box on the referencing element. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'primitiveUnits' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'primitiveUnits' in that specification. Recommendation Initial definition ...
radius - SVG: Scalable Vector Graphics
m established by the primitiveUnits attribute on the <filter> element. A negative or zero value disables the effect of the given filter primitive (i.e., the result is the filter input image). Usage notes Value <number-optional-number> Default value 0 Animatable Yes Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'radius' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'radius' in that specification. Recommendation Initial definition ...
result - SVG: Scalable Vector Graphics
r primitive. It is only meaningful within a given <filter> element and thus has only local scope. It is legal for the same <filter-primitive-reference> to appear multiple times within the same <filter> element. When referenced, this value will use the closest preceding filter primitive with the given result. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'result' in that specification. Working Draft Clarifies that the value is a <custom-ident>. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'result' in that specification. Recommendation Initial definition ...
scale - SVG: Scalable Vector Graphics
form: translateX(240px);""/> </svg> Usage notes Value <number> Default value None Animatable Yes <number> This value defines the scale factor for the displacement. When the value of this attribute is 0, this operation has no effect on the source image. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'scale' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'scale' in that specification. Recommendation Initial definition ...
seed - SVG: Scalable Vector Graphics
Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'seed' in that specification. Recommendation Initial definition ...
specularExponent - SVG: Scalable Vector Graphics
cular term. Value <number> Default value 1 Animatable Yes feSpotLight For <feSpotLight>, specularExponent defines the exponent value controlling the focus for the light source. Value <number> Default value 1 Animatable Yes Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'specularExponent for <feSpecularLighting>' in that specification. Working Draft No change Filter Effects
Module Level 1The definition of 'specularExponent for <feSpotLight>' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'specularExponent for <feSpecularLighting>' in that s...
stdDeviation - SVG: Scalable Vector Graphics
is used for both X and Y. A negative value is forbidden. A value of zero disables the effect of the given filter primitive (i.e., the result is the filter input image). If stdDeviation is 0 in only one of X or Y, then the effect is that the blur is only applied in the direction that has a non-zero value. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'stdDeviation' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'stdDeviation' in that specification. Recommendation Initial definition ...
stitchTiles - SVG: Scalable Vector Graphics
orders. stitch This value indicates that the user agent will automatically adjust the x and y values of the base frequency such that the <feTurbulence> node's width and height (i.e., the width and height of the current subregion) contain an integral number of the tile width and height for the first octave. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'stitchTiles' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'stitchTiles' in that specification. Recommendation Initial definition ...
surfaceScale - SVG: Scalable Vector Graphics
cale defines the height of the surface. Value <number> Default value 1 Animatable Yes feDiffuseLighting For <feDiffuseLighting>, surfaceScale defines the height of the surface. Value <number> Default value 1 Animatable Yes Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'surfaceScale for <feDiffuseLighting>' in that specification. Working Draft No change Filter Effects
Module Level 1The definition of 'surfaceScale for <feSpecularLighting>' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'surfaceScale for <feDiffuseLighting>' in that specific...
tableValues - SVG: Scalable Vector Graphics
g in identity transfer Animatable Yes <list-of-numbers> This value holds a comma- and/or space-separated list of <number>s, which define a lookup table for the color component transfer function. Each number can be between 0 and 1. An empty list results in an identity transfer function. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'tableValues' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'tableValues' in that specification. Recommendation Initial definition ...
targetX - SVG: Scalable Vector Graphics
Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'targetX' in that specification. Recommendation Initial definition ...
targetY - SVG: Scalable Vector Graphics
Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'targetY' in that specification. Recommendation Initial definition ...
text-decoration - SVG: Scalable Vector Graphics
text</text> </svg> Usage notes Value <'text-decoration-line'> || <'text-decoration-style'> || <'text-decoration-color'> Default value See individual properties Animatable Yes For a description of the values, please refer to the CSS text-decoration property. Specifications Specification Status Comment CSS Text Decoration
Module Level 3The definition of 'text-decoration' in that specification. Candidate Recommendation Defines the property as a shorthand for text-decoration-line, text-decoration-style, and text-decoration-color. Scalable Vector Graphics (SVG) 2The definition of 'text-decoration' in that specification. Candidate Recommendation Mainly refers to the definition in CSS Text Decoration 3 tu...
unicode-bidi - SVG: Scalable Vector Graphics
ts: <altGlyph>, <textPath>, <text>, <tref>, and <tspan> Context notes Value normal | embed | isolate | bidi-override | isolate-override | plaintext Default value normal Animatable No For a description of the values, please refer to the CSS unicode-bidi property. Specifications Specification Status Comment CSS Writing Modes
Module Level 3The definition of 'unicode-bidi' in that specification. Proposed Recommendation SVG 2 only refers to CSS Writing Modes. Introduced isolate, isolate-override, and plaintext keywords. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'unicode-bidi' in that specification. Recommendation Initial definition ...
values - SVG: Scalable Vector Graphics
ist of 20 matrix values (a00 a01 a02 a03 a04 a10 a11 ... a34), separated by whitespace and/or a comma. For type="saturate", values is a single real number value (0 to 1). For type="hueRotate", values is a single one real number value (degrees). For type="luminanceToAlpha", values is not applicable. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'values for <feColorMatrix>' in that specification. Working Draft No change SVG Animations Level 2The definition of 'values for <animate>, <animateColor>, <animateMotion>, and <animateTransform>' in that specification. Editor's Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'values for <feColorMatrix>' in...
width - SVG: Scalable Vector Graphics
he horizontal length for the referenced element. Value auto | <length> | <percentage> Default value auto (treated as 0) Animatable Yes Note: Starting with SVG2, width is a Geometry Property meaning this attribute can also be used as a CSS property for used elements. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'width' in that specification. Working Draft Definition for <filter> Filter Effects
Module Level 1The definition of 'width' in that specification. Working Draft Definition for filter primitives CSS Masking
Module Level 1The definition of 'width' in that specification. Candidate Recommendation Definition for <mask> Scalable Vect...
word-spacing - SVG: Scalable Vector Graphics
pacing between words</text> </svg> Usage notes Value normal | <length> Animatable Yes Default values normal For a description of the values, please refer to the CSS letter-spacing property. Prior to Firefox 72 Firefox ignored word-spacing and renders text without. Specifications Specification Status Comment CSS Text
Module Level 3The definition of 'word-spacing' in that specification. Working Draft SVG 2 just refers to the definition in CSS Text 3. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'word-spacing' in that specification. Recommendation Initial definition ...
writing-mode - SVG: Scalable Vector Graphics
e and the typographic mode are horizontal. vertical-rl This value defines a right-to-left block flow direction. Both the writing mode and the typographic mode are vertical. vertical-lr This value defines a left-to-right block flow direction. Both the writing mode and the typographic mode are vertical. Specifications Specification Status Comment CSS Writing Modes
Module Level 3The definition of 'writing-mode' in that specification. Proposed Recommendation Definition in CSS Writing Modes 3 Scalable Vector Graphics (SVG) 2The definition of 'writing-mode' in that specification. Candidate Recommendation Mainly refers to the definition in CSS Writing Modes 3 and defines a mapping between the deprecated SVG 1.1 values and the new values. ...
xChannelSelector - SVG: Scalable Vector Graphics
lue color channel of the input image defined in in2 will be used to displace the pixels of the input image defined in in along the x-axis. A This keyword specifies that the alpha channel of the input image defined in in2 will be used to displace the pixels of the input image defined in in along the x-axis. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'xChannelSelector' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'xChannelSelector' in that specification. Recommendation Initial definition ...
yChannelSelector - SVG: Scalable Vector Graphics
lue color channel of the input image defined in in2 will be used to displace the pixels of the input image defined in in along the y-axis. A This keyword specifies that the alpha channel of the input image defined in in2 will be used to displace the pixels of the input image defined in in along the y-axis. Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'yChannelSelector' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'yChannelSelector' in that specification. Recommendation Initial definition ...
z - SVG: Scalable Vector Graphics
Animatable Yes feSpotLight For <feSpotLight>, z defines the location along the z-axis for the light source in the coordinate system established by the primitiveUnits attribute on the <filter> element. Value <number> Default value 1 Animatable Yes Specifications Specification Status Comment Filter Effects
Module Level 1The definition of 'z for <fePointLight>' in that specification. Working Draft No change Filter Effects
Module Level 1The definition of 'z for <feSpotLight>' in that specification. Working Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'z for <fePointLight>' in that specification. Recommendation Initial definition for...