Search completed in 1.03 seconds.
131 results for "retrieving":
Your results are loading. Please wait...
Enabling the behavior - retrieving tinderbox status - Archive of obsolete content
to write a function that queries the tinderbox server and retrieves the current status. var gxmlhttprequest; function loadtinderboxstatus() { gxmlhttprequest = new xmlhttprequest(); gxmlhttprequest.onload = updatetinderboxstatus; gxmlhttprequest.open("get", "http://tinderbox.mozilla.org/seamonkey/panel.html"); gxmlhttprequest.send(null); } xmlhttprequest is an interface in mozilla for retrieving documents via http. although it is designed to retrieve xml content and parse it into a dom, it can retrieve (but not parse) other kinds of content as well. in this case we use it to retrieve an html page containing a brief summary of the current tinderbox state. that document gets updated by the tinderbox server every time a build finishes. it displays a list of active tinderbox clients along wi...
Index - Web APIs
Web › API › Index
ribute is a boolean value which indicates whether or not the image has completely loaded. 1717 htmlimageelement.crossorigin api, cors, cross-origin, crossorigin, html dom, htmlimageelement, image, property, reference, security, origin the htmlimageelement interface's crossorigin attribute is a string which specifies the cross-origin resource sharing (cors) setting to use when retrieving the image. 1718 htmlimageelement.currentsrc api, htmlimageelement, image, property, reference, url, currentsrc, source the read-only htmlimageelement property currentsrc indicates the url of the image which is currently presented in the <img> element it represents. 1719 htmlimageelement.decode() api, decode, graphics, html dom, htmlimageelement, images, loading...
..., property, reference, web api the oldurl read-only property of the hashchangeevent interface returns the previous url from which the window was navigated. 1970 headers api, experimental, fetch, fetch api, headers, interface, reference the headers interface of the fetch api allows you to perform various actions on http request and response headers. these actions include retrieving, setting, adding to, and removing. a headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs. you can add to this using methods like append() (see examples.) in all methods of this interface, header names are matched by case-insensitive byte sequence. 1971 headers() api, constructor, experimental, fetch, reference ...
...ieve keyboard layout maps and toggle capturing of key presses from the physical keyboard. 2199 keyboard.getlayoutmap() api, keyboard api, keyboard lock, keyboard map, method, reference, getlayoutmap(), keyboard the getlayoutmap() method of the keyboard interface returns a promise that resolves with an instance of keyboardlayoutmap which is a map-like object with functions for retrieving the strings associated with specific physical keys. 2200 keyboard.lock() api, keyboard api, keyboard lock, method, reference, keyboard, lock() the lock() method of the keyboard interface returns a promise after enabling the capture of keypresses for any or all of the keys on the physical keyboard. this method can only capture keys that are granted access by the underlying op...
...And 3 more matches
Extension Versioning, Update and Compatibility - Archive of obsolete content
o do this with. do not mistakenly think that * in a version represents any version. the * actually represents an infinitely high number and so is really only sensibly used in the maxversion. using it in a minversion usually doesn't produce the effect you want. valid application versions automatic add-on update checking applications will periodically check for updates to installed add-ons by retrieving the updateurl. the information returned can be used to notify the user of an updated version to the add-on as well as inform the application of new application versions that the add-on is compatible with. note: starting in gecko 2.0, the automatic add-on update process properly supports cases in which the add-on's guid changes by uninstalling the old version and then installing the new one. pre...
...sh generation of xpi files to mccoy. and all popular (scripting) languages offer support, for examples: python, perl: cpan digest, php signing update manifests if you wish to serve your update rdf over regular http, gecko 1.9 based applications will require that you digitally sign the update manifest to ensure that it's information isn't tampered with between you creating it and applications retrieving it. the mccoy tool should be used to sign the update rdf. the technical details of the signing mechanism are beyond the scope of this document however the basics are as follows: step 1 - done once, before you publish your add-on the target: adding updatekey in install.rdf the add-on author creates a public/private rsa cryptographic key pair. the public part of the key is der encoded and then...
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
innerhtml method, which it can call on almost any node. it does not, however, support outerhtml (which adds markup around an element, and has no standard equivalent) and innertext (which sets the text value of the node, and which you can achieve in mozilla by using textcontent). internet explorer has several content manipulation methods that are nonstandard and unsupported in mozilla, including retrieving the value, inserting text and inserting elements adjacent to a node, such as getadjacentelement and insertadjacenthtml. table 3 shows how the w3c standard and mozilla manipulate content, all of which are methods of any dom node. table 3. methods mozilla uses to manipulate content method description appendchild( anode ) creates a new child node. returns a reference to the...
... not contain these white space nodes. in mozilla, those nodes will be in the array. xml: <?xml version="1.0"?> <myxmldoc xmlns:myns="http://myfoo.com"> <myns:foo>bar</myns:foo> </myxmldoc> javascript: var myxmldoc = getxmldocument().documentelement; alert(myxmldoc.childnodes.length); the first line of javascript loads the xml document and accesses the root element (myxmldoc) by retrieving the documentelement. the second line simply alerts the number of child nodes. per the w3c specification, the white spaces and new lines merge into one text node if they follow each other. for mozilla, the myxmldoc node has three children: a text node containing a new line and two spaces; the myns:foo node; and another text node with a new line. internet explorer, however, does not abide by this a...
Additional Navigation - Archive of obsolete content
however, a string value may be used instead. since the subject of an rdf arc is always a resource, the subject may be a resource uri. the object attribute may be a resource uri or a literal value. using a literal as the object of a triple is a common way to filter out specific items. for instance, if items were identified with a type, the data could be filtered to include only items of a particular type. ...
...er to get the right results. usually, however you will want to iterate only over the children of a node using a member tag and instead use a triple or binding for each predicate of each child that you wish to display. this is the way that the template system was originaly designed to be used and many of the datasources used by firefox and other mozilla products work with datasources in this way. retrieving parents a very uncommon form of navigation you can also do is to navigate upwards using a member tag, that is to get all the parents of a node, as in this example: <query> <content uri="?start"/> <member container="?parent" child="?start"/> </query> this might be used, for instance, to start at a particular photo and find all of the containers that it is inside. « previousnext » ...
Box Objects - Archive of obsolete content
element. the base box object, or the interface nsiboxobject, however, has a number of properties which are quite useful for xul development. the base box object has two useful features. first, you can retrieve the position and size of the xul element as displayed, and second, you can determine the order of the elements in the box as displayed, instead of their order as they are stored in the dom. retrieving position and size the box object provides six read only properties, x, y, screenx, screeny, width and height, for determining the currently displayed position and size of an element. all values returned are in pixels. x, y the x and y coordinates are referenced from the top left corner of the document in the window (that portion which excludes the window border and title bar) and refer to the to...
... or resized. for example, a flexible element will change in size and the box object dimensions will update accordingly. the following example shows this. example 1 : source view <button label="click me" oncommand="alert('the width is ' + this.boxobject.width);"/> you can use the width and height attributes of the element to specify the element's width and height, respectively. note that retrieving these values will return the size only if it was explicitly specified. these properties will return an empty string if the width or height attributes or properties were not set already. that is, you cannot get the current size with these properties; instead you must use the box object properties. this may be a bit confusing, but, the key is to remember that the width and height properties on an e...
NPP_StreamAsFile - Archive of obsolete content
he data from a stream. syntax #include <npapi.h> void npp_streamasfile(npp instance, npstream* stream, const char* fname); parameters the function has the following parameters: instance pointer to current plug-in instance. stream pointer to current stream. fname pointer to full path to a local file. ...
.... if an error occurs while retrieving the data or writing the file, fname may be null. description when the stream is complete, the browser calls npp_streamasfile to provide the instance with a full path name for a local file for the stream. npp_streamasfile is called for streams whose mode is set to np_asfileonly or np_asfile only in a previous call to npp_newstream. if an error occurs while retrieving the data or writing the file, the file name (fname) is null. see also npp_newstream, npp_write, npp_writeready, npstream, npp ...
Index - MDN Web Docs Glossary: Definitions of Web-related terms
single-page application) is a web app implemention that loads only a single web document, and then updates the body content of that single document via javascript apis such as xmlhttprequest and fetch when different content is to be shown. 392 sql codingscripting, database, glossary, sql sql (structured query language) is a descriptive computer language designed for updating, retrieving, and calculating data in table-based databases. 393 sql injection glossary, security, sql, sql injection, webapp sql injection takes advantage of web apps that fail to validate user input. hackers can maliciously pass sql commands through the web app for execution by a backend database. 394 sri csp, security subresource integrity (sri) is a security featu...
...guage specified by the w3c. the information technology (it) industry uses many languages based on xml as data-description languages. 512 xpath codingscripting, glossary, xml, xpath xpath is a query language that can access sections and content in an xml document. 513 xquery codingscripting, glossary, xml, xquery xquery is a computer language for updating, retrieving, and calculating data in xml databases. 514 xslt codingscripting, glossary, xml, xslt extensible stylesheet language transformations (xslt) is a declarative language used to convert xml documents into other xml documents, html, pdf, plain text, and so on. 515 beacon beacon, glossary, reference, web performance a web beacon is a small object, such as a 1 p...
Adding a new event
type of event is useful if the event isn't handled by c++ code. a dom event which represents a native event like a user action such as keyboard or mouse input. this type of event allows c++ code to handle it easier. it's not a dom event. however, c++ code may need to dispatch an event to dom tree and handle it with c++ event handler. this is useful for widget notifying dom tree of something or retrieving something from dom tree. how to implement an internal event class if you're in case 1 (a simple dom event), you can skip this section. add event messages you need to add event messages which are stored by widgetevent::message. all messages are defined by macro in "messages" section of basicevents.h. define event class name you need to add an event class name in eventclasslist.h. use ns_...
...focused content information. touchevents.h this header file should be used for defining input events from touch devices. miscevents.h if the new event class isn't proper any header files above, you should use this. each event class should implement following methods manually. virtual internalfooevent* asfooevent() moz_override this method should just return this. this method is used for retrieving sub class pointer avoiding to use static_cast. virtual widgetevent* duplicate() const moz_override this method should create a new instance with copying its members except widget. for copying the members, this should use assignfooeventdata() with true for acopytargets. and also, mflags should be just copied since assignfooeventdata() doesn't copy mflags. this method is basically used for duplic...
Process scripts
vileged, and have access to the components object. however, process scripts are subject to the same kinds of limitations as frame scripts (for example, no file system access). process scripts stay loaded until their host process is closed. the environment for process scripts is similar to that for frame scripts. however, you don't get access to web content or dom events from a process script. retrieving the content frame message manager for a content window when an observer notification in a process script contains a content document or window it can be useful to not use talk through the child/parent process message managers but through the window's content frame message manager, e.g. if responses should be processed by a frame script instead of the process script. this can be achieved by trav...
... when an observer notification in a process script contains a content document or window it can be useful to not use talk through the child/parent process message managers but through the window's content frame message manager, e.g. if responses should be processed by a frame script instead of the process script. ...
An overview of NSS Internals
decryption related to a data exchange, usually involves working with the x.509 certs of your communication partners (peer). it's also required that you safely keep your own secret keys that belong to your own certificates. you might want to protect the storage of your secret keys with pbe. you might decide to modify the default trust provided by nss. all of this requires storing, looking up, and retrieving data. nss simplifies performing these operations by offering storage and management apis. nss doesn't require the programmer to manage individual files containing individual certificates or keys. instead, nss offers to use its own database(s). once you have imported certificates and keys into the nss database, you can easily look them up and use them again. because of nss's expectation to oper...
... ssl network connection, you'll already have two layers, the basic nspr layer and an ssl library layer. the mozilla applications define a third layer where application specific processing is performed. you can find more details in the nspr reference documents. nss occassionally has to create outbound network connections, in addition to the connections requested by the application. examples are retrieving ocsp (online certificate status protocol) information or downloading a crl (certificate revocation list). however, nss doesn't have an implementation to work with network proxies. if you must support proxies in your application, you are able to register your own implementation of an http request callback interface, and nss can use your application code that supports proxies. when using hashing...
Index
decryption related to a data exchange, usually involves working with the x.509 certs of your communication partners (peer). it's also required that you safely keep your own secret keys that belong to your own certificates. you might want to protect the storage of your secret keys with pbe. you might decide to modify the default trust provided by nss. all of this requires storing, looking up, and retrieving data. nss simplifies performing these operations by offering storage and management apis. nss doesn't require the programmer to manage individual files containing individual certificates or keys. instead, nss offers to use its own database(s). once you have imported certificates and keys into the nss database, you can easily look them up and use them again. because of nss's expectation to oper...
... ssl network connection, you'll already have two layers, the basic nspr layer and an ssl library layer. the mozilla applications define a third layer where application specific processing is performed. you can find more details in the nspr reference documents. nss occassionally has to create outbound network connections, in addition to the connections requested by the application. examples are retrieving ocsp (online certificate status protocol) information or downloading a crl (certificate revocation list). however, nss doesn't have an implementation to work with network proxies. if you must support proxies in your application, you are able to register your own implementation of an http request callback interface, and nss can use your application code that supports proxies. when using hashing...
Using the Places annotation service
s to get all of "your" annotations matching a given namespace. you should not use any characters in your annotation names that are not valid as part of an html path. this includes colons, spaces, most punctuation, and non-ascii characters. you should try to have relatively few annotation names. the service stores these names in a separate table, and the fewer names there are, the more efficient retrieving names will be. you should not design your service so that you require hundreds of unique annotation names. setting an annotation the annotation provides a variety of scriptable and non-scriptable setters for annotations on both pages and on items in the places database (see nsiannotationservice.idl for the exact declarations). from c++ you must use the setter for the explicit data type being sa...
...ion time for the annotation (see "lifetime of annotations" below). ...
nsIDOMWindowUtils
nt atrusted return value boolean to show if the event was successful elementfrompoint() retrieve the element at point ax, ay in the window's document. nsidomelement elementfrompoint( in float ax, in float ay, in boolean aignorerootscrollframe, in boolean aflushlayout ); parameters ax ay aignorerootscrollframe whether or not to ignore the root scroll frame when retrieving the element. if false, this method returns null for coordinates outside of the viewport. aflushlayout flushes layout if true. otherwise, no flush occurs. return value entermodalstate() put the window into a state where scripts are frozen and events suppressed, for use when the window has launched a modal prompt. void entermodalstate(); parameters none. findelementwithviewid() given ...
...rd from the point (ax, ay). arightsize the number of css pixels to expand the rectangle to the right from the point (ax, ay). abottomsize the number of css pixels to expand the rectangle downward from the point (ax, ay). aleftsize the number of css pixels to expand the rectangle to the left from the point (ax, ay). aignorerootscrollframe whether or not to ignore the root scroll frame when retrieving the nodes. if this is false, this method will return null for coordinates outside the viewport. aflushlayout if true, layout is flushed before hit testing begins. this ensures that the node list is current. if you don't need an absolutely up to date node list, you can set this to false. return value an nsidomnodelist referencing all the nodes that intersect the specified rectangle. ...
Element.getAttribute() - Web APIs
string, and some dom implementations implement this behavior. the implementation of getattribute() in xul (gecko) actually follows the dom 3 core specification and returns an empty string. consequently, you should use element.hasattribute() to check for an attribute's existence prior to calling getattribute() if it is possible that the requested attribute does not exist on the specified element. ...
...ibute() to check for an attribute's existence prior to calling getattribute() if it is possible that the requested attribute does not exist on the specified element. retrieving nonce values for security reasons, csp nonces from non-script sources, such as css selectors, and .getattribute("nonce") calls are hidden. let nonce = script.getattribute('nonce'); // returns empty string instead of retrieving the nonce from the content attribute, use the nonce property: let nonce = script.nonce; specifications specification status comment domthe definition of 'getattribute()' in that specification. living standard ...
Using FormData Objects - Web APIs
send() to send the form's data. the field "webmasterfile" is a blob. a blob object represents a file-like object of immutable, raw data. blobs represent data that isn't necessarily in a javascript-native format. the file interface is based on blob, inheriting blob functionality and expanding it to support files on the user's system. in order to build a blob you can invoke the blob() constructor. retrieving a formdata object from an html form to construct a formdata object that contains the data from an existing <form>, specify that form element when creating the formdata object: note: formdata will only use input fields that use the name attribute. var formdata = new formdata(someformelement); for example: var formelement = document.queryselector("form"); var request = new xmlhttprequest();...
...ating the formdata object: note: formdata will only use input fields that use the name attribute. ...
Recommended Drag Types - Web APIs
er sign (#) are comments, and should not be considered urls. you can use comments to indicate the purpose of a url, the title associated with a url, or other data. the text/plain fallback for multiple links should include all urls, but no comments. for example, this sample text/uri-list data contains two links and a comment: http://www.mozilla.org #a second link http://www.example.com when retrieving a dropped link, ensure you handle when multiple links are dragged, including any comments. for convenience, the special type url may be used to refer to the first valid link within data for the text/uri-list type. do not add data with the url type — attempting to do so will set the value of the text/uri-list type instead. var url = event.datatransfer.getdata("url"); you may also see data ...
...l", "hello there, <strong>stranger</strong>"); dt.setdata("text/plain", "hello there, stranger"); dragging files a local file is dragged using the application/x-moz-file type with a data value that is an nsifile object. non-privileged web pages canot retrieve or modify data of this type. because a file is not a string, you must use the mozsetdataat() method to assign the data. similarly, when retrieving the data, you must use the mozgetdataat() method. event.datatransfer.mozsetdataat("application/x-moz-file", file, 0); if possible, include the file url of the file using both the text/uri-list and text/plain types. these types should be added afterward so that the more specific application/x-moz-file type has higher priority. multiple files will be received during a drop as multiple items in ...
IDBObjectStore.get() - Web APIs
if a value is successfully found, then a structured clone of it is created and set as the result of the request object. note: this method produces the same result for: a) a record that doesn't exist in the database and b) a record that has an undefined value. to tell these situations apart, call the opencursor() method with the same key. ...
...open("todolist", 4); dbopenrequest.onsuccess = function(event) { note.innerhtml += '<li>database initialised.</li>'; // store the result of opening the database in the db variable. ...
Using IndexedDB - Web APIs
nd its subpages. this article documents the types of objects used by indexeddb, as well as the methods of the asynchronous api (the synchronous api was removed from spec). basic pattern the basic pattern that indexeddb encourages is the following: open a database. create an object store in the database. start a transaction and make a request to do some database operation, like adding or retrieving data. wait for the operation to complete by listening to the right kind of dom event. do something with the results (which can be found on the request object). with these big concepts under our belts, we can get to more concrete stuff. creating and structuring the store using an experimental version of indexeddb in case you want to test your code in browsers that still use a pref...
...// because the "names" object store has the key generator, the key for the name value is generated automatically. // the added records would be like: // key : 1 => value : "bill" // key : 2 => value : "donna" customerdata.foreach(function(customer) { objstore.add(customer.name); }); }; for more details about the key generator, please see "w3c key generators". adding, retrieving, and removing data before you can do anything with your new database, you need to start a transaction. transactions come from the database object, and you have to specify which object stores you want the transaction to span. once you are inside the transaction, you can access the object stores that hold your data and make your requests. next, you need to decide if you're going to make changes to...
Keyboard API - Web APIs
keyboard locking enables a web page to capture keys that are normally reserved by the user agent or the underlying operating system. the intended use of the keyboard api is by web applications such as games or remote access apps that provide a full-screen immersive experience. ...
...hange meaning based on the current locale and keyboard layout. these keys are shown below. blue keys are present on all standard keyboards while green keys are only available on some keyboards. interfaces keyboard provides functions that retrieve keyboard layout maps and toggle capturing of key presses from the physical keyboard. keyboardlayoutmap a map-like object with functions for retrieving the string associated with specific physical keys. navigator.keyboard read only returns a keyboard object which provides access to functions that retrieve keyboard layout maps and toggle capturing of key presses from the physical keyboard. specifications specification status comment keyboard map editor's draft initial definition. keyboard lock edi...
MediaStream Image Capture API - Web APIs
hotographic device. in addition to capturing data, it also allows you to retrieve information about device capabilities such as image size, red-eye reduction and whether or not there is a flash and what they are currently set to. conversely, the api allows the capabilities to be configured within the constraints what the device allows. mediastream image capture concepts and usage the process of retrieving an image or video stream happens as described below. the example code is adapted from chrome's image capture examples. first, get a reference to a device by calling mediadevices.getusermedia(). the example below simply says give me whatever video device is available, though the getusermedia() method allows more specific capabilities to be requested. this method returns a promise that resolves wi...
.... let zoom = document.queryselector('#zoom'); const capabilities = track.getcapabilities(); // check whether zoom is supported or not. if(!capabilities.zoom) { return; } track.applyconstraints({ advanced : [{ zoom: zoom.value }] }); finally, pass the mediastreamtrack object to the imagecapture() constructor. though a mediastream holds several types of tracks and provides multiple methods for retrieving them, the imagecapture constructor will throw a domexception of type notsupportederror if mediastreamtrack.kind is not "video". let imagecapture = new imagecapture(track); interfaces imagecapture an interface for capturing images from a photographic device referenced through a valid mediastreamtrack. photocapabilities provides available configuration options for an attached photographic ...
Using the User Timing API - Web APIs
ot supported", 0); return; } else { log("create marks", 0); // create several performance marks including two with the same name performance.mark("mark-1"); do_work(50000); performance.mark("mark-2"); do_work(50000); performance.mark("mark-2"); var marks = ["mark-1", "mark-2", "mark-2"]; for (var i=0; i < marks.length; i++) log("... created mark = " + marks[i], 0); } retrieving performance marks the performance interface has three methods to retrieve marks. the following examples shows how to use each of these methods (performance.getentries(), performance.getentriesbytype(entrytype), and performance.getentriesbyname(name, entrytype) ) to retrieve one or more marks. function display_marks(ev) { if (performance.getentries === undefined) { log("display marks: perf...
...", "mark-a", "mark-b"); performance.measure("measure-2", "mark-c", "mark-d"); // log the marks and measures var marks = ["mark-a", "mark-b", "mark-c", "mark-d"]; for (var i=0; i < marks.length; i++) log("... created mark = " + marks[i], 1); var measures = ["measures-1", "measures-2"]; for (var i=0; i < measures.length; i++) log("... created measure = " + measures[i], 1); } retrieving performance measures the performance interface has three methods to retrieve measures. the following examples shows how to use each of these methods (performance.getentries(), performance.getentriesbytype(entrytype), and performance.getentriesbyname(name, entrytype)) to retrieve one or more measures. function display_measures(ev) { if (performance.getentries === undefined) { log("display ...
User Timing API - Web APIs
s used to create a performance mark. the method takes one argument, the name of the mark (for example performance.mark("mark-1")). the mark's performance entry will have the following property values: entrytype - set to "mark". name - set to the "name" given when the mark was created. starttime - set to the timestamp when mark() was called. duration - set to "0" (a mark has no duration). retrieving performance marks the performance interface has three methods that can be used to retrieve a mark: performance.getentries() returns all performance entries in the performance timeline. finding only mark entries requires checking each entry's entrytype for "mark". performance.getentriesbyname(name, entrytype) returns all performance entries in the performance timeline with the specified nam...
...performance timeline). the measure's performance entry will have the following property values: entrytype - set to "measure". name - set to the "name" given when the measure was created. starttime - set to the timestamp when measure() was called. duration - set to a domhighrestimestamp that is the duration of the measure (typically, the end mark timestamp minus the start mark timestamp). retrieving performance measures the performance interface has three methods that can be used to retrieve a measure: performance.getentries() returns all performance entries in the performance timeline. finding the measure entries requires checking each entry's entrytype for "measure". performance.getentriesbyname(name, entrytype) returns all performance entries in the performance timeline with the sp...
request - Archive of obsolete content
icitly sets the content-type header. the default value is application/x-www-form-urlencoded. overridemimetype string use this string to override the mime type returned by the server in the response's content-type header. you can use this to treat the content as a different mime type, or to force text to be interpreted using a specific character. for example, if you're retrieving text content which was encoded as iso-8859-1 (latin 1), it will be given a content type of "utf-8" and certain characters will not display correctly. to force the response to be interpreted as latin-1, use overridemimetype: var request = require("sdk/request").request; var quijote = request({ url: "http://www.latin1files.org/quijote.txt", overridemimetype: "text/plain; charset=latin1", ...
platform/xpcom - Archive of obsolete content
console.log('canceling...'); } }); this component definition: specifies that we support nsirequest using the interfaces property. initializes pending in initialize() adds our implementation of the nsirequest interface although request also implements nsisupports, there is no need to add it here, because the base class unknown declares support for nsisupports and this is accounted for when retrieving objects. we can register a factory for this component by using the factory class to associate its constructor with its contract id: var { factory } = require('sdk/platform/xpcom'); var { cc, ci } = require('chrome'); var contractid = '@me.org/request' // create and register the factory var factory = factory({ contract: contractid, component: request }); now xpcom users can access our impl...
Miscellaneous - Archive of obsolete content
rating system detection // returns "winnt" on windows vista, xp, 2000, and nt systems; // "linux" on gnu/linux; and "darwin" on mac os x. ...
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
t in javascript. you'll need an idl file for an interface that looks something like this: interface myilocation : nsisupports { readonly attribute nsifile locationfile; }; place the idl file in the public/ directory of your project or subproject. in the src/ directory, place the javascript file that implements the component. ...
Appendix D: Loading Scripts - Archive of obsolete content
overlay> <overlay id="script-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.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...
Index - Archive of obsolete content
extension on a fresh copy of mozilla by loading the file in your mozilla browser (this works whether you load it from the web or from your local hard drive via a file:/// url). mozilla will automatically detect that the file is an installer and ask you if you want to install the software. try installing the extension, restarting mozilla, and see if it works. 388 enabling the behavior - retrieving tinderbox status add-ons, extensions our mozilla extension now exists, but it doesn't do anything. to make it work we have to add javascript code that changes its status when the tinderbox status changes. the first step is to write a function that queries the tinderbox server and retrieves the current status. 389 enabling the behavior - updating the status bar panel add-o...
Index of archived content - Archive of obsolete content
bookmark keywords build building transformiix standalone chromeless compiling the npruntime sample plugin in visual studio creating a firefox sidebar extension creating a microsummary creating a mozilla extension adding the structure conclusion enabling the behavior - retrieving tinderbox status enabling the behavior - updating the status bar panel enabling the behavior - updating the status periodically finding the code to modify finding the file to modify making a mozilla installation modifiable making it into a dynamic overlay and packaging it up for distribution making it into a stati...
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
e-based implementation can be represented as follows: create a hidden iframe in the page; when a new content is required, ask for the content to the iframe; the iframe will load the content and callback a function in the main page; update the main page. of course, specific implementations may have different requirements, like the use of multiple iframe elements to make multiple requests retrieving different contents at the same time. example using iframes and javascript: stock ticker this section describes 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 ...
Using content preferences - Archive of obsolete content
tensions and the browser itself, not web sites) to locally save preferences on a per-site basis. this makes it possible to write an extension that lets the user customize the appearance of specific web sites (setting the font size larger on sites that use obnoxiously small fonts, for instance). the content preferences service, implemented by nsicontentprefservice, offers functions for setting and retrieving preferences for specific sites or in the global preference space; global preferences are used whenever a site-specific preference isn't available. site-specific content preferences are stored in the profile folder, in the database file "content-prefs.sqlite". example: setting and retrieving preferences this example demonstrates how to save a preference and then retrieve its value. var iosvc = com...
Creating a Mozilla Extension - Archive of obsolete content
ozilla modifiable, how to use mozilla's network library to load and parse web pages in javascript, and how to use dynamic overlays to package a mozilla extension for installation by others. ...
Embedding Mozilla in a Java Application using JavaXPCOM - Archive of obsolete content
he embedding process: try { mozilla.termembedding(); } catch (xpcomexception e) { // this exception is thrown if termembedding failed } working with xpcom objects now that mozilla is embedded, the java application can work with xpcom objects. the mozilla class provides several methods to facilitate this, such as getservicemanager, getcomponentmanager, and newlocalfile. in addition to retrieving and calling methods on xpcom objects, javaxpcom allows the java application to pass java class objects to xpcom methods. for example: mozilla mozilla = mozilla.getinstance(); windowcreator creator = new windowcreator(); // implements nsiwindowcreator nsiservicemanager servicemanager = mozilla.getservicemanager(); nsiwindowwatcher windowwatcher = (nsiwindowwatcher) servicemanager .gets...
Modularization techniques - Archive of obsolete content
80, 0x5f, 0x8a, 0x26, 0x76}} /* * nsisample interface declaration */ class nsisample: public nsisupports { public: ns_imethod hello() = 0; }; file nssample.h nssample.h defines the class id (cid) for our sample class. note that one interface can have a number of classes that implement it, so there is not necessarily a one-to-one mapping from iids to cids. it also defines the function for retrieving our class factory. notice it does not contain a class declaration. #include "nsifactory.h" // {d3944dd0-ae1a-11d1-b66c-00805f8a2676} #define ns_sample_cid \ {0xd3944dd0, 0xae1a, 0x11d1, \ {0xb6, 0x6c, 0x00, 0x80, 0x5f, 0x8a, 0x26, 0x76}} extern nsresult getsamplefactory(nsifactory **aresult); file nssample.cpp nssample.cpp contains both the declaration and implementation of our sample c...
Running Tamarin acceptance tests - Archive of obsolete content
d_runner.sh, if it doesn't already exist on the phone in /data/local/tamarin $ adb push tamarin-redux/platform/android/android_runner.sh /data/local/tamarin/android_runner.sh $ adb shell 'chmod 777 /data/loca/android_runner.sh' test it out with a simple .abc or no args for usage (should return exitcode=0) $ tamarin-redux/platform/android/android_shell.py hello.abc hello exitcode=0 test it out by retrieving the version information of the shell on the android device $ $avm -dversion shell 1.4 debug build 6299:455bca954565 features avmsystem_32bit;avmsystem_unaligned_int_access;avmsystem_little_endian;avmsystem_arm;avmsystem_unix; avmfeature_jit;avmfeature_abc_interp;avmfeature_selftest;avmfeature_eval;avmfeature_protect_jitmem; avmfeature_shared_gcheap;avmfeature_cache_gqcn;avmfeature_safepoints;avmf...
Anonymous Content - Archive of obsolete content
anonymous content contained underneath a bound element using standard dom apis. if anonymous content that contains an insertion point is removed, then any explicit children found underneath the insertion point are relocated to any other insertion points that match. again, if all the children cannot be relocated, then the anonymous content is destroyed. [editor's note: should there be an api for retrieving insertion points, for dynamically creating new insertion points, or for removing insertion points? perhaps on elementxbl?] event flow and targeting flow and targeting across scopes dom events can fire on anonymous targets just as they can on explicit targets. as long as the event flows within the same scope, it is no different from the behavior outlined in the dom level 2 events specification.
XUL Events - Archive of obsolete content
this event is sent when the value of the textbox is changed. the event is not sent until the focus is moved to another element. attribute: onchange click this event is sent when a mouse button is pressed and released. you can determine which mouse button was clicked by retrieving the button property of the event object. this event is also sent when the user double-clicks with the mouse. the detail property specifies how many clicks occurred. you can also check for triple-clicks in a similar manner. you should not use this event in xul to respond to user actions; the command event should be used instead. attribute: onclick ...
Accessing Files - Archive of obsolete content
e alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome! other documentation on files and i/o not using the unavailable nsiscriptableio apis: code snippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. accessing files this section describes how to create a file reference. retrieving a file when working with files, usage is always done via a file object and not via string paths. this allows files to used in a portable way. because string paths are not used, references to files in a file object are made relative to some starting directory. a number of starting directories may be used, for instance, the user's home directory, the desktop, the system's temporary folder, and so f...
Getting File Information - Archive of obsolete content
tation on files and i/o not using the unavailable nsiscriptableio apis: code snippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. the nsifile object has a number of useful attributes which may be used to retrieve information about a file. two useful attributes filesize and lastmodifiedtime (nsifile.attributes) provide a means of retrieving the size of a file and the time when the file was last changed. file size the filesize (nsifile.attributes) attribute holds the size of a file in bytes. if the file does not exist, a 'file not found' exception will occur. you can catch this exception with a try-catch block, but it is better to use nsifile.exists() to check first. this example will check if a file on the desktop exists and set t...
currentIndex - Archive of obsolete content
xample, because the tree has never been focused), the value will be -1. you cannot rely on this property to change or determine a tree selection, except for trees with seltype="single". (all trees have seltype="multiple" by default.) to reliably change or determine a selection, instead use the nsitreeselection interface methods available via tree.view.selection. example // one way of retrieving the text of a cell. <script language ="javascript"> function treerowclicked(){ var tree = document.getelementbyid("my-tree"); var selection = tree.view.selection; var celltext = tree.view.getcelltext(tree.currentindex, tree.columns.getcolumnat(0)); alert(celltext); } </script> <tree id="my-tree" seltype="single" onselect="treerowclicked()"> <treecols> <treecol label="title"...
treeBoxObject - Archive of obsolete content
« xul reference treeboxobject type: nsitreeboxobject the box object is responsible for rendering the tree on the window. this object implements the nsitreeboxobject interface and contains functions for retrieving the cells at certain coordinates, redrawing cells and scrolling the tree. this property is equivalent to the boxobject property. ...
Commands - Archive of obsolete content
an't use it on unprivileged web pages, but you may use it from, for example, a browser extension. if the window doesn't provide a controller capable of handling the command, nothing will happen. you can get the command dispatcher using the document's commanddispatcher property, or you can retrieve it from the controllers list on an element or a window. the command dispatcher contains methods for retrieving controllers for commands and for retrieving and modifying the focus. adding controllers you can implement your own controllers to respond to commands. you could even override the default handling of a command with careful placement of the controller. a controller is expected to implement four methods, which are listed below: supportscommand (command) this method should return true if the co...
Document Object Model - Archive of obsolete content
depending on the kind of document. the three main documents are htmldocument, xmldocument, and xuldocument, for html, xml and xul documents respectively. obviously, it is this latter type of document used for xul. the three document types are very similar, in fact they all share the same base implementation. however, there are a few functions that are specific to one document type or the other. retrieving elements the most common method to retrieve an element in a document is to give the element an id attribute and the use the document's getelementbyid() method. we've added the id attribute to a number of elements in the find file dialog. for example, we could get the state of a check box by using the code below: var state = document.getelementbyid('casecheck').checked; the value casecheck cor...
Tree View Details - Archive of obsolete content
/www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <tree id="elementlist" flex="1"> <treecols> <treecol id="element" label="element" primary="true" flex="1"/> </treecols> <treechildren/> </tree> </window> we use a simple tree here with no data in the treechildren. the 'init' function is called when the window is loaded to initialize the tree. it simply sets the custom view by retrieving the tree and setting its 'view' property. we will define 'treeview' next. function init() { document.getelementbyid("elementlist").view = treeview; } the custom tree view will need to implement a number of methods, of which the important ones will be examined individually. first we'll define two structures to hold the data for the tree, the first will hold a map between parents and the child...
tree - Archive of obsolete content
Archive › Mozilla › XUL › tree
d. to see the difference, compare the selection style in the folder list and the message list in mozilla mail. tabindex type: integer gets and sets the value of the tabindex attribute. treeboxobject type: nsitreeboxobject the box object is responsible for rendering the tree on the window. this object implements the nsitreeboxobject interface and contains functions for retrieving the cells at certain coordinates, redrawing cells and scrolling the tree. this property is equivalent to the boxobject property. view type: nsitreeview the view for the tree, which is the object which generates the data to be displayed. you can assign an object which implements nsitreeview to this property. trees built from rdf or those which use treeitems directly will alr...
2006-10-27 - Archive of obsolete content
summary: mozilla.dev.tech.layout - october 21 - october 27, 2006 announcements none this week. discussions removal of the nn4.6 table border color quirk discussion on removing the nn 4.6 table boarder color quirk, which currently causes a specific markup to produce a green boarder instead of a gray one. help for getting html element width info discussion on retrieving width information on html elements when using the gecko engine. it was determined that the offsetwidth property can be used to get this value. multiple presshells discussion on why current interfaces allow for multiple presshells and how the relationships work for the following objects: docshell, presshell, prescontext, document, domwindow, widget, docshell and contentviewer. boris zbarsky explains in detail the relati...
VBArray - Archive of obsolete content
ay object provides access to visual basic safe arrays. syntax varname = new vbarray(safearray) parameters varname the variable name to which the vbarray is assigned. safearray a vbarray value. remarks vbarrays are read-only, and cannot be created directly. the safearray argument must have obtained a vbarray value before being passed to the vbarray constructor. this can only be done by retrieving the value from an existing activex or other object. vbarrays can have multiple dimensions. the indices of each dimension can be different. the dimensions method retrieves the number of dimensions in the array; the lbound and ubound methods retrieve the range of indices used by each dimension. example the following example consists of three parts. the first part is vbscript code to create a vis...
SQL - MDN Web Docs Glossary: Definitions of Web-related terms
sql (structured query language) is a descriptive computer language designed for updating, retrieving, and calculating data in table-based databases. learn more general knowledge sql on wikipedia learn sql learn sql on sqlzoo.net tutorial point ...
XQuery - MDN Web Docs Glossary: Definitions of Web-related terms
xquery is a computer language for updating, retrieving, and calculating data in xml databases. learn more general knowledge official website xquery on wikipedia technical reference discussion about using xquery from firefox ...
Sending form data - Learn web development
tant for two reasons: if you need to send a password (or any other sensitive piece of data), never use the get method or you risk displaying it in the url bar, which would be very insecure. if you need to send a large amount of data, the post method is preferred because some browsers limit the sizes of urls. in addition, many servers limit the length of urls they accept. on the server side: retrieving the data whichever http method you choose, the server receives a string that will be parsed in order to get the data as a list of key/value pairs. the way you access this list depends on the development platform you use and on any specific frameworks you may be using with it. example: raw php php offers some global objects to access the data. assuming you've used the post method, the following...
Graceful asynchronous programming with Promises - Learn web development
settimeout(), although it does still show that promises are useful for creating a custom function with a sensible flow of operations, good error handling, etc. one example we'd like to invite you to study, which does show a useful async application of the promise() constructor, is jake archibald's idb library. this takes the indexeddb api, which is an old-style callback-based api for storing and retrieving data on the client-side, and allows you to use it with promises. in the code you'll see the same kind of techniques we discussed above being used there. the following block converts the basic request model used by many indexeddb methods to use promises (see this code, for example). conclusion promises are a good way to build asynchronous applications when we don’t know the return value of a f...
Client-side storage - Learn web development
ompletely useless on the modern-day web — they are still used commonly to store data related to user personalization and state, e.g. session ids and access tokens. for more information on cookies see our using http cookies article. new school: web storage and indexeddb the "easier" features we mentioned above are as follows: the web storage api provides a very simple syntax for storing and retrieving smaller, data items consisting of a name and a corresponding value. this is useful when you just need to store some simple data, like the user's name, whether they are logged in, what color to use for the background of the screen, etc. the indexeddb api provides the browser with a complete database system for storing complex data. this can be used for things from complete sets of customer record...
Fetching data from the server - Learn web development
this seemingly small detail has had a huge impact on the performance and behavior of sites, so in this article, we'll explain the concept and look at technologies that make it possible, such as xmlhttprequest and the fetch api. ...
Introduction to web APIs - Learn web development
reating custom ui controls for playing audio and video, displaying text tracks like captions and subtitles along with your videos, grabbing video from your web camera to be manipulated via a canvas (see above) or displayed on someone else's computer in a web conference, or adding effects to audio tracks (such as gain, distortion, panning, etc). device apis are basically apis for manipulating and retrieving data from modern device hardware in a way that is useful for web apps. examples include telling the user that a useful update is available on a web app via system notifications (see the notifications api) or vibration hardware (see the vibration api). client-side storage apis are becoming a lot more widespread in web browsers — the ability to store data on the client-side is very useful if you...
Client-side web APIs - Learn web development
done by using the document object model (dom), a set of apis for controlling html and styling information that makes heavy use of the document object. in this article, we'll look at how to use the dom in detail, along with some other interesting apis that can alter your environment in interesting ways. fetching data from the server another very common task in modern websites and applications is retrieving individual data items from the server to update sections of a webpage without having to load an entirely new page. this seemingly small detail has had a huge impact on the performance and behavior of sites. in this article, we'll explain the concept, and look at technologies that make it possible, such as xmlhttprequest and the fetch api. third party apis the apis we've covered so far are buil...
Arrays - Learn web development
chnically a string method, not an array method, but we've put it in with arrays as it goes well here. let's play with this, to see how it works. first, create a string in your console: let mydata = 'manchester,london,liverpool,birmingham,leeds,carlisle'; now let's split it at each comma: let myarray = mydata.split(','); myarray; finally, try finding the length of your new array, and retrieving some items from it: myarray.length; myarray[0]; // the first item in the array myarray[1]; // the second item in the array myarray[myarray.length-1]; // the last item in the array you can also go the opposite way using the join() method. try the following: let mynewstring = myarray.join(','); mynewstring; another way of converting an array to a string is to use the tostring() method. to...
Useful string methods - Learn web development
lowing lines: let browsertype = 'mozilla'; browsertype.length; this should return the number 7, because "mozilla" is 7 characters long. this is useful for many reasons; for example, you might want to find the lengths of a series of names so you can display them in order of length, or let a user know that a username they have entered into a form field is too long if it is over a certain length. retrieving a specific string character on a related note, you can return any character inside a string by using square bracket notation — this means you include square brackets ([]) on the end of your variable name. inside the square brackets you include the number of the character you want to return, so for example to retrieve the first letter you'd do this: browsertype[0]; remember: computers count f...
JavaScript object basics - Learn web development
lar to how you access the items in an array, and it is basically the same thing — instead of using an index number to select an item, you are using the name associated with each member's value. it is no wonder that objects are sometimes called associative arrays — they map strings to values in the same way that arrays map numbers to values. ...
Working with JSON - Learn web development
st = new xmlhttprequest(); now we need to open the request using the open() method. add the following line: request.open('get', requesturl); this takes at least two parameters — there are other optional parameters available. we only need the two mandatory ones for this simple example: the http method to use when making the network request. in this case get is fine, as we are just retrieving some simple data. the url to make the request to — this is the url of the json file that we stored earlier. next, add the following two lines — here we are setting the responsetype to json, so that xhr knows that the server will be returning json, and that this should be converted behind the scenes into a javascript object. then we send the request with the send() method: request.r...
Server-side website programming - Learn web development
ta displayed inside those templates when needed, such as when you want to view a different product on amazon. in the modern world of web development, learning about server-side development is highly recommended. learning pathway getting started with server-side programming is usually easier than client-side development, because dynamic websites tend to perform a lot of very similar operations (retrieving data from a database and displaying it in a page, validating user-entered data and saving it in a database, checking user permissions and logging users in, etc.), and are constructed using web frameworks that make these and other common web server operations easy. basic knowledge of programming concepts (or of a particular programming language) is useful, but not essential. similarly, expertise ...
Handling common JavaScript problems - Learn web development
ature. normalization libraries: give you a simple syntax that allows you to easily complete a task without having to worry about cross browser differences. the library will manipulate appropriate apis in the background so the functionality will work whatever the browser (in theory). for example, localforage is a library for client-side data storage, which provides a simple syntax for storing and retrieving data. in the background, it uses the best api the browser has available for storing the data, whether that is indexeddb, web storage, or even websql (which is now deprecated, but is still supported in some older versions of safari/ie). as another example, jquery when choosing a library to use, make sure that it works across the set of browsers you want to support, and test your implementation t...
Gecko info for Windows accessibility vendors
ally in html content. be prepared for new combinations of roles and states in content, such as role_slider, role_progressbar and state_required. in addition, check the state_focusable bit on tables, which indicates a traversable dhtml spreadsheet. please see the dhtml accessibility documentation page for more information on this topic. iaccessibles persist unless the document changes, retrieving the iaccessible more than once for the same object will return the same iaccessible*. the uniqueid will remain the same as well. if the document does change, event_reorder, event_hide and event_show are used to indicate where the changes will occur. because of the persistence, relations and events can be mapped within an assistive technology's internal model. page loading is tracked via stat...
Performance best practices for Firefox front-end engineers
us comments on that bug for more information. use indexeddb for storage appcache and localstorage are synchronous storage apis that will block the main thread when you use them. avoid them at all costs! indexeddb is preferable, as the api is asynchronous (all disk operations occur off of the main thread), and can be accessed from web workers. indexeddb is also arguably better than storing and retrieving json from a file—particularly if the json encoding or decoding is occurring on the main thread. indexeddb will do javascript object serialization and deserialization for you using the structured clone algorithm, meaning that you can stash things like maps, sets, dates, blobs, and more, without having to do conversions for json compatibility. a promise-based wrapper for indexeddb, indexeddb.jsm...
Storage access policy: Block cookies from trackers
blah.example.com example.com no a.b.example.com c.d.example.com no blah.example.com foo.blah.example.com yes what does the storage access policy block? the storage access policy blocks resources identified as trackers from accessing their cookies and other site storage when they are loaded in a third-party context. this prevents those resources from retrieving tracking identifiers stored in cookies or site storage and using them to identify users across visits to multiple first parties. specifically, firefox does this by imposing the following restrictions: cookies: block cookie request headers and ignore set-cookie response headers. return an empty string for calls to document.cookie and ignore requests to set cookies via document.cookie. dom s...
Overview of Mozilla embedding APIs
per class which converts an ascii string into a ucs2 string. typically, instances of this class are stack allocated, and wrap ascii arguments which must be converted into ucs2. do_queryinterface this is a helper class which works in conjunction with nscomptr to perform a simplified call to nsisupports::queryinterface(...) with a typesafe assignment. do_getinterface this function simplfies retrieving interfaces via the nsiinterfacerequestor::getinterface(...) method. using this function, one can use nsisupports instances and still easily access other interfaces via nsiinterfacerequestor. internally, this function tries to convert the nsisupports argument into an nsiinterfacerequestor and then calls getinterface(...) to retrieve the requested interface. do_queryreferent this function is th...
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. private ...
Sqlite.jsm
log(err); // error, oh noes! if (callback) { callback(err); } } // all accounts returned successfully, so do something with them. console.log(result); // it worked! if (callback) { callback(null, accounts); } note: the then parameters can be anonymous functions (i.e. function() ), and only are labeled as onstatementcomplete and onerror for readability. this example demonstrates retrieving a row without using the onrow function parameter, and instead, using the conn.execute result. this example also demonstrates retrieving the primary key row id of the last inserted row. async function () { try { conn = await sqlite.openconnection({ path: dbfile.path }); let statement = "insert into accounts (username, details) values (:username, :details)" let params = { username:"...
Initial setup
ng an application. install instructions are located here. autoconf 2.13 autoconf is a utility that is vital to manually creating mozilla application builds and language packs. we use version 2.13 and higher for these builds. you can find the source files and install instructions here. wget wget is a command-line utility that allows you to retrieve files using internet protocols. we use it for retrieving files from repositories. you can find the source files and install instructions here. perl perl is a programming language that will help you create mozilla application builds and language packs. you can find the source files and install instructions here. python python is a programming language in which many of our l10n testing scripts are written. you can find the source files and install in...
Mozilla DOM Hacking Guide
ct. an instance of a helper class is created the first time xpconnect needs access to the flattened set of interfaces of an object. the instance is then cached for further use. most of the helper classes implement one or more nsixpcscriptable methods. those methods are used by xpconnect when we require something from javascript that was not defined in idl. for example, getproperty() is used when retrieving an attribute that was not defined in idl, and newresolve() is used when resolving for the first time an attribute or method that was not previously resolved. please see the nsixpcscriptable interface for more information. the nsdomclassinfo class the heart of class info is the nsdomclassinfo class, defined in nsdomclassinfo.h. it implements two interfaces besides nsisupports: nsixpcscriptable a...
NSPR Error Handling
error type error functions error codes for information on naming conventions for nspr types, functions, and macros, see nspr naming conventions. error type prerrorcode error functions pr_seterror pr_seterrortext pr_geterror pr_getoserror pr_geterrortextlength pr_geterrortext error codes error codes defined in prerror.h: pr_out_of_memory_error insufficient memory to perform request. pr_bad_descriptor_error the file descriptor used as an argument in the preceding function is invalid. pr_would_block_error the operation would have blocked, which conflicts with the semantics that have been established. ...
NSS Sample Code sample4
y encrypts/decrypts a block * of length equal to modulus length of the public/private key. */ #include "nss.h" #include "pk11pub.h" /* this callback is responsible for returning the password to the nss * key database. for example purposes, this function hardcodes the password. ...
NSS Sample Code sample6
s.h" #include "pk11pub.h" /* the key id can be any sequence of bytes. this example happens to use an * integer */ void genkey(int id); /* this callback is responsible for returning the password to the nss * key database. for example purposes, this function hardcodes the password. * in a real app, this function should obtain the password using secure means * such as prompting an operator, or retrieving it over a secure communication * channel */ char *passwdcb(pk11slotinfo *info, prbool retry, void *arg); int main(int argc, char **argv) { secstatus rv; /* initialize nss */ pk11_setpasswordfunc(passwdcb); /* the nss db must be initialized read-write since we'll be creating * keys in it. once keys are generated, it can be opened without read-write * subsequently (nss_init). ...
JS_DefineElement
xt. obj js::handleobject or jsobject * the object on which to create the new property. index uint32_t the index of the property to define. value js::handlevalue or js::handleobject or js::handlestring or int32_t or uint32_t or double or jsval initial value to assign to the property. getter jsnative or jspropertyop getproperty method for retrieving the current property value. setter jsnative or jsstrictpropertyop setproperty method for specifying a new property value. flags unsigned property attributes. obsolete since jsapi 32 description js_defineelement defines a numeric property for a specified object, obj. index is the index of the element being defined. value is one of js::value, jsobject, jsstrin...
JS_DefinePropertyWithTinyId
to create. namelen size_t (only in js_defineucpropertywithtinyid) the length of name in characters; or (size_t) -1 to indicate that name is null-terminated. tinyid int8 8-bit id to aid in sharing getter and setter callbacks among properties. value jsval initial stored value for the new property. getter jspropertyop getproperty method for retrieving the current property value. setter jspropertyop setproperty method for specifying a new property value. attrs unsigned int property attributes. description js_definepropertywithtinyid defines an object property with a tiny id. js_defineucpropertywithtinyid is the unicode version of the function. except for the tinyid parameter, these functions behave exactly ...
Gecko object attributes
s is in contrast to text attributes, which apply only to substrings in a text object. object attributes list aria attributes all aria attributes used on dom element (i.e., any attribute prefixed by 'aria-') are exposed as object attributes; name is preserved except the 'aria-' prefix is cut. common attributes class the class name for an element from html, xul, svg, etc. this is useful for retrieving microformat semantics for an element. display similar with display css style. applied to: any visible accessible id any value, defined by ui/content developers. used to indicate a persistent identifier for any object; useful for scripting. applied to: any role which related dom node has id attribute tag the actual markup tag used to create this element (also used in xul). applied to: any...
Querying Places
arching doesn't work correctly across or queries. the current behavior does the normal query and then selects keywords from the first query and filters all the results. (in other words, the keywords from the first query are anded with all queries.) keywords from subsequent query objects are ignored. this is bug 320332. bookmark queries there is a quick-start for doing simple bookmark queries in retrieving part of the bookmarks tree. the contents of bookmark folders can be retrieved by setting the "folders" member in the query object. this item is an array of folder ids from the bookmark service. typically, you will only have one folder id in this list, which will given you the contents of that folder. you can set multiple folders and the result will be the intersection of all the folders. for so...
Places
how to manipulate favicons using the places api. using the places livemark service how to create and manage livemarks. using the places annotation service how to work with the annotation service. using the places keywords api how to manage places keywords querying places how to query the bookmarks and history system with specific parameters. retrieving part of the bookmarks tree how to fetch a section of the bookmarks tree using queries. displaying places information using views how to use places views to display places data in your own applications or extensions. places utilities for javascript a library of convenient routines that make it easier to work with places. places database troubleshooting how to dea...
Mozilla internal string guide
ick reference for what classes you should be using. context class notes local variables nsautostring nsautocstring class member variables nsstring nscstring method parameter types nsastring nsacstring use abstract classes for parameters. use const nsastring& for "in" parameters and nsastring& for "out" parameters. retrieving "out" string/wstrings nsstring nscstring use getter_copies(). similar to nsstring / nscstring. wrapping character buffers nsdependentstring nsdependentcstring wrap const char* / const char16_t* buffers. literal strings nsliteralstring nsliteralcstring similar to nsdependent[c]string, but pre-calculates length at build time. appendix b - nsast...
Index
Mozilla › Tech › XPCOM › Index
eives progress and state information about the update that is currently being downloaded. this information is most commonly used to update a user interface that informs the user as to the status of an update. 336 nsiarray interfaces, interfaces:scriptable, xpcom, xpcom api reference, xpcom interface reference an indexed collection of elements. provides basic functionality for retrieving elements at a specific position, searching for elements. indexes are zero-based, such that the last element in the array is stored at the index length-1. 337 nsiasyncinputstream interfaces, interfaces:scriptable, needscontent, streams, xpcom api reference, xpcom interface reference if an input stream is non-blocking, it may return ns_base_stream_would_block when read. the cal...
nsIArray
indexes are zero-based, such that the last element in the array is stored at the index length-1. for an array which can be modified, see nsimutablearray. neither interface makes any attempt to protect the individual elements from modification. the convention is that the elements of the array should not be modified. ...
nsICacheEntryDescriptor
quests to skip the cache. void doomandfailpendingrequests( in nsresult status ); parameters status the access status. getmetadataelement() this method retrieves the meta data. meta data is a table of key/value string pairs. the strings do not have to conform to any particular charset, but they must be null terminated. string getmetadataelement( in string key ); parameters key the key for retrieving the meta data. return value returns the string value containing the meta data for the provided key. markvalid() this method means that a writer must validate this cache object before any readers are given a descriptor to the object. void markvalid(); parameters none. openinputstream() this method opens blocking input stream to cache data. this will fail if the cache entry is not stream based. u...
nsIClipboard
widget/nsiclipboard.idlscriptable this interface supports basic clipboard operations such as: setting, retrieving, emptying, matching and supporting clipboard data. inherits from: nsisupports last changed in gecko 30.0 (firefox 30.0 / thunderbird 30.0 / seamonkey 2.27) method overview void emptyclipboard(in long awhichclipboard); void forcedatatoclipboard(in long awhichclipboard); obsolete since gecko 1.8 void getdata(in nsitransferable atransferable, in long awhichclipboard); boolean hasdatamatchingflavors([array, size_is(alength)] in string aflavorlist, in unsigned long alength, in long awhichclipboard); void setdata(in nsitransferable atransferable, in nsiclipboardowner anowner, in long awhichclipboard); boolean supportsselect...
nsIConsoleService
vacy reasons): void reset(); parameters none. note: console listeners expect you to log an empty string message before calling reset, so they too can clear their message buffers. (this also works before gecko 19.) unregisterlistener() deregisters a listener. void unregisterlistener( in nsiconsolelistener listener ); parameters listener the nsiconsolelistener to remove. ...
nsIDOMGeoGeolocation
getcurrentposition( in nsidomgeopositioncallback successcallback, [optional] in nsidomgeopositionerrorcallback errorcallback, [optional] in nsidomgeopositionoptions options ); parameters successcallback an nsidomgeopositioncallback to be called when the current position is available. errorcallback an nsidomgeopositionerrorcallback that is called if an error occurs while retrieving the position; this parameter is optional. options an nsidomgeopositionoptions object specifying options; this parameter is optional. watchposition() similar to getcurrentposition(), except it continues to call the callback with updated position information periodically until clearwatch() is called. unsigned short watchposition( in nsidomgeopositioncallback successcallback, [optiona...
nsIDocShell
annel where the server-returned content type is not a known jar type). read only. charset string the converter to use when reading the document's data. in mozilla code, all text is encoded as unicode. when reading a document, a converter is used to translate the text from its original format into unicode. this attribute lets you: see what converter was used when retrieving the document's data. override that character set for documents for which the specified fallback or auto-detected character set is incorrect. reading this value reports the encoding that was used when loading the data into the document. setting this attribute overrides the encoding; however, to update the dom or display of the content, you need have the data reparsed. overriding ...
nsIFocusManager
o awindow if adeep is false. this will be set even if no element is focused. return value the currently focused element within awindow. exceptions thrown ns_error_invalid_arg if awindow is null. getlastfocusmethod() pruint32 getlastfocusmethod( in nsidomwindow window ); parameters window if null, then the current focusedwindow will be used by default. this has the result of retrieving the method that was used to focus the currently focused element. return value the method that was used to focus the element in window. this will either be 0, flag_bymouse or flag_bykey. movecarettofocus() moves the selection caret within awindow to the current focus. void movecarettofocus( in nsidomwindow awindow ); parameters awindow elementisfocusable() check if given element is...
nsISearchEngine
rch engine's submission data. this should only be called on engines created via nsibrowsersearchservice.addenginewithdetails(). void addparam( in astring name, in astring value, in astring responsetype ); parameters name the name of the parameter to add. value the value to pass. if value is "{searchterms}", it will be substituted with the user-entered data when retrieving the submission. must not be null. responsetype since an engine can have several different request urls, differentiated by response types, this parameter selects a request to add parameters to. if null, will default to "text/html" exceptions thrown ns_error_invalid_arg if name or value are null. ns_error_failure if the search engine is read-only. getsub...
nsIStringBundle
inherits from: nsisupports last changed in gecko 1.7 this interface is used by xul:stringbundle to retrieve strings. it is recommended that you use the methods of xul:stringbundle to access these functions unless necessary. alternatively, a string bundle can be created within a javascript context with nsistringbundleservice. ...
nsIWindowWatcher
dow is closed. this attribute will be null if the active window is not an nsidomwindow; for example, if the active window is an alert. methods getchromeforwindow() retrieve the chrome window mapped to the given dom window. nsiwindowwatcher keeps a list of all top-level dom windows currently open, along with their corresponding chrome interfaces. since dom windows lack a (public) means of retrieving their corresponding chrome, this method will do that. nsiwebbrowserchrome getchromeforwindow( in nsidomwindow awindow ); parameters awindow the nsidomwindow whose chrome window the caller needs. return value an nsiwebbrowserchrome object for the corresponding chrome window getnewauthprompter() return a newly created nsiauthprompt implementation. nsiauthprompt getnewauthprompter( ...
Using nsIPasswordManager
password is the only data that will be stored securely. adding a password to the password manager is easy: passwordmanager.adduser('host', 'username', 'password'); since there's no provision to include names of html input fields, no password stored by this interface will be used to fill in passwords on web pages. nsiloginmanager, available in toolkit 1.9, does let you include input field names. retrieving a password retrieving a password from the password manager is more difficult. the example below should serve as a starting point: // the host name of the password we are looking for var querystring = 'http://www.example.com'; // ask the password manager for an enumerator: var e = passwordmanager.enumerator; // step through each password in the password manager until we find the one we want: while...
WebIDL bindings
myinterface. this will produce two files in dom/bindings in your objdir: myinterface-example.h and myinterface-example.cpp, which show a basic implementation of the interface using a class that inherits from nsisupports and has a wrapper cache. see this sample patch that migrates window.performance.* to webidl bindings. note: if your object can only be reflected into js by creating it, not by retrieving it from somewhere, you can skip steps 1 and 2 above and instead add 'wrappercache': false to your descriptor. you will need to flag the functions that return your object as [newobject] in the webidl. if your object is not refcounted then the return value of functions that return it should return an nsautoptr. c++ reflections of webidl constructs c++ reflections of webidl operations (methods) ...
Add to iPhoto
// get the url of the image if (src && src != "") { iphoto.addimagebyurl(src); } } } this fetches the node representing the image the user wants to add, and, if it's an image, fetches the image's url from its src attribute, then passes it into our addimagebyurl() method, which will do all the heavy lifting. adding the image to iphoto the addimagebyurl() method handles actually retrieving the image and adding it to iphoto. let's take a look at its code, then explore how it works. this is where all our js-ctypes usage occurs. addimagebyurl: function(src) { corefoundation.init(); carbon.init(); appservices.init(); // download the image var filepath = this.downloadimage(src); var mutablearray = corefoundation.cfarraycreatemutable(null, 1, corefoundation.kcftypearrayca...
URLs - Plugins
uniform resource locator (url) protocols provide a means for locating and accessing resources that are available on the internet and on intranets. plug-ins can request and receive the data associated with urls of any type that the browser can handle, including http, ftp, news, mailto, and gopher. the table below summarizes urls supported by gecko. in addition, gecko may support urls not listed on this table. url scheme description about locates browser information or "fun" pages. ...
CanvasRenderingContext2D.setTransform() - Web APIs
he above components as properties). examples skewing a shape this example skews a rectangle both vertically (.2) and horizontally (.8). scaling and translation remain unchanged. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.settransform(1, .2, .8, 1, 0, 0); ctx.fillrect(0, 0, 100, 100); result retrieving and passing a dommatrix object in the following example, we have two <canvas> elements. we apply a transform to the first one's context using the first type of settransform() and draw a square on it, then retrieve the matrix from it using canvasrenderingcontext2d.gettransform(). we then apply the retrieved matrix directly to the second canvas context by passing the dommatrix object directly to ...
ContentIndex - Web APIs
async function createreadinglist() { // access our service worker registration const registration = await navigator.serviceworker.ready; // get our index entries const entries = await registration.
Content Index API - Web APIs
async function createreadinglist() { // access our service worker registration const registration = await navigator.serviceworker.ready; // get our index entries const entries = await registration.
Using Fetch - Web APIs
content from the response, we use the json() method (defined on the body mixin, which is implemented by both the request and response objects.) note: the body mixin also has similar methods to extract other types of body content; see the body section for more. fetch requests are controlled by the connect-src directive of content security policy rather than the directive of the resources it's retrieving. supplying request options the fetch() method can optionally accept a second parameter, an init object that allows you to control a number of different settings: see fetch() for the full options available, and more details. // example post method implementation: async function postdata(url = '', data = {}) { // default options are marked with * const response = await fetch(url, { meth...
HTMLImageElement.crossOrigin - Web APIs
syntax htmlimageelement.crossorigin = crossoriginmode; let crossoriginmode = htmlimageelement.crossorigin; value a domstring of a keyword specifying the cors mode to use when fetching the image resource. if you don't specify crossorigin, the image is fetched without cors (the fetch no-cors mode). permitted values are: anonymous requests by the <img> element have their mode set to cors and their credentials mode set to same-origin. ...
HTMLOrForeignElement.nonce - Web APIs
the nonce property of the htmlorforeignelement interface returns the cryptographic number used once that is used by content security policy to determine whether a given fetch will be allowed to proceed. in later implementations, elements only expose their nonce attribute to scripts (and not to side-channels like css attribute selectors). examples retrieving a nonce value in the past, not all browsers supported the nonce idl attribute, so a workaround is to try to use getattribute as a fallback: let nonce = script['nonce'] || script.getattribute('nonce'); however, recent browsers version hide nonce values that are accessed this way (an empty string will be returned). the idl property (script['nonce']) will be the only way to access nonces. nonce hiding helps preventing that attackers exfiltra...
Dragging and Dropping Multiple Items - Web APIs
to an array. function ondrop(event) { var files = []; var dt = event.datatransfer; for (var i = 0; i < dt.mozitemcount; i++) files.push(dt.mozgetdataat("application/x-moz-file", i)); } you may also wish to check if the desired format exists using the moztypesat method. as with the types property, it returns a list of strings of the types for an item. types property is equivalent to retrieving the list of types for the item at index 0. var types = event.datatransfer.moztypesat(1); dragging non-string data the additional methods described above are also not restricted to string data; you can specify any type of data. for example, files are dragged using the application/x-moz-file type stored as nsifile objects. as the setdata() method only supports strings, it cannot be used to spec...
Headers - Web APIs
Web › API › Headers
a headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs. you can add to this using methods like append() (see examples.) in all methods of this interface, header names are matched by case-insensitive byte sequence. for security reasons, some headers can only be controlled by the user agent. ...
IDBObjectStore.getKey() - Web APIs
if a key is successfully found, then a structured clone of it is created and set as the result of the request object. note: this feature is available in web workers. syntax var request = objectstore.getkey(key); parameters key the key or key range that identifies the record to be retrieved. return value an idbrequest object on which subsequent events related to this operation are fired. ...
IDBObjectStore - Web APIs
thread, deletes the store object selected by the specified key. this is for deleting individual records out of an object store. idbobjectstore.deleteindex() destroys the specified index in the connected database, used during a version upgrade. idbobjectstore.get() returns an idbrequest object, and, in a separate thread, returns the store object store selected by the specified key. this is for retrieving specific records from an object store. idbobjectstore.getkey() returns an idbrequest object, and, in a separate thread retrieves and returns the record key for the object in the object stored matching the specified parameter. idbobjectstore.getall() returns an idbrequest object retrieves all objects in the object store matching the specified parameter or all objects in the store if no paramet...
IDBRequest.error - Web APIs
Web › API › IDBRequest › error
recommendation indexed database api draftthe definition of 'error' in that specification. recommendation browser compatibility the compatibility table on this page is gener...
IDBRequest.onerror - Web APIs
recommendation indexed database api draftthe definition of 'onerror' in that specification. reco...
IndexedDB API - Web APIs
w and worker objects. this interface isn't part of the 2.0 specification. idbfactory provides access to a database. this is the interface implemented by the global object indexeddb and is therefore the entry point for the api. idbopendbrequest represents a request to open a database. idbdatabase represents a connection to a database. it's the only way to get a transaction on the database. retrieving and modifying data idbtransaction represents a transaction. you create a transaction on a database, specify the scope (such as which object stores you want to access), and determine the kind of access (read only or readwrite) that you want. idbrequest generic interface that handles database requests and provides access to results. idbobjectstore represents an object store that allows acce...
Keyboard.getLayoutMap() - Web APIs
syntax var promise = keyboard.getlayoutmap() parameters none. return value a promise that resolves with an instance of keyboardlayoutmap. example the following example demonstrates how to get the location- or layout-specific string associated with the key that corresponds to the 'w' key on an english qwerty keyboard. ...
Keyboard - Web APIs
Web › API › Keyboard
the the keyboard api provides functions that retrieve keyboard layout maps and toggle capturing of key presses from the physical keyboard. a list of valid code values is found in the ui events keyboardevent code values spec. properties none. methods keyboard.getlayoutmap() returns a promise that resolves with an instance of keyboardlayoutmap which is a map-like object with functions for retrieving the strings associated with specific physical keys. keyboard.lock() returns a promise after enabling the capture of keypresses for any or all of the keys on the physical keyboard. keyboard.unlock() unlocks all keys captured by the lock() method and returns synchronously. example the following example demonstrates how to get the location- or layout-specific string associated with the ke...
KeyboardLayoutMap - Web APIs
a list of valid keys is found in the ui events keyboardevent code values specification. properties keyboardlayoutmap.entries read only returns an array of a given object's own enumerable property [key, value] pairs, in the same order as that provided by a for...in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well). keyboardlayoutmap.keys read only returns a new array iterator object that contains the keys for each index in the array. ...
MediaTrackConstraints.groupId - Web APIs
table as the source of media content. group ids are unique for a given origin for the duration of a single browsing session, and are shared by all media sources that come from the same physical device. for example, the microphone and speaker on the same headset would share a group id. this makes it possible to use the group id to ensure that the audio and input devices are on the same headset by retrieving the group id of the input device and specifying it when asking for an output device, perhaps. however, the value of the groupid is determined by the source of the track's content, and there's no particular format mandated by the specification (although some kind of guid is recommended). that means that a given track will only return one value for the groupid when you call getcapabilities(), and ...
Capabilities, constraints, and settings - Web APIs
mediastreamtrack on the fly, by calling the track's applyconstraints() method, passing into it an object representing the constraints you wish to apply to the track: videotrack.applyconstraints({ width: 1920, height: 1080 }); in this snippet, the video track referenced by videotrack is updated so that its resolution as closely as possible matches 1920x1080 pixels (1080p high definition). retrieving current constraints and settings it's important to remember the difference between constraints and settings. constraints are a way to specify what values you need, want, and are willing to accept for the various constrainable properties (as described in the documentation for mediatrackconstraints), while settings are the actual values of each constrainable property at the current time. getting ...
PaymentRequest.show() - Web APIs
if (checkallvalues(response) { response.complete("success"); } else { response.complete("fail"); } } see the article using promises for more information if you need more information about working with promises. examples in the following example, a paymentrequest object is instantiated before the show() method is called. this method triggers the user agent's built-in process for retrieving payment information from the user. the show() method returns a promise that resolves to a paymentresponse object when the user interaction is complete. the developer then uses the information in the paymentresponse object to format and send payment data to the server. you should send the payment information to the server asynchronously so that the final call to paymentresponse.complete() can indi...
Performance API - Web APIs
hods and properties to store and retrieve high resolution timestamps or metrics regarding the browser's document navigation events. performanceobserver provides methods and properties used to observe performance measurement events and be notified of new performance entries as they are recorded in the browser's performance timeline. performanceresourcetiming provides methods and properties for retrieving and analyzing detailed network timing data regarding the loading of an application's resources. specifications specification status comment high resolution time recommendation initial definition. high resolution time level 2 recommendation adds performance attribute on window and workerglobalscope. high resolution time level 3 editor's d...
Permissions.query() - Web APIs
Web › API › Permissions › query
e relevant permissions dialog), navigator.permissions.query() will return true for both notifications and push. note: the persistent-storage permission allows an origin to use a persistent box (i.e persistent storage) for its storage, as per the storage api. returns a promise that resolves to a permissionstatus object. exceptions exception explanation typeerror retrieving the permissiondescriptor information failed in some way, or the permission doesn't exist or is currently unsupported (e.g. midi, or push with uservisibleonly). example navigator.permissions.query({name:'geolocation'}).then(function(result) { if (result.state == 'granted') { showlocalnewswithgeolocation(); } else if (result.state == 'prompt') { showbuttontoenablelocalnews(); } //...
Permissions.revoke() - Web APIs
rmissions dialog), navigator.permissions.query() will return true for both notifications and push. note: the persistent-storage permission allows an origin to use a persistent box (i.e persistent storage) for its storage, as per the storage api. returns a promise that calls its fulfillment handler with a permissionstatus object indicating the result of the request. exceptions typeerror retrieving the permissiondescriptor information failed in some way, or the permission doesn't exist or is currently unsupported (e.g. midi, or push with uservisibleonly). example this function can be used by an app to request that its own geolocation api permission be revoked. function revokepermission() { navigator.permissions.revoke({name:'geolocation'}).then(function(result) { report(result.sta...
RadioNodeList.value - Web APIs
if the collection does not contain any radio buttons or none of the radio buttons in the collection is in checked state, the empty string is returned. on setting the value property, the first radio button input element whose value property is equal to the new value will be set to checked. ...
RadioNodeList - Web APIs
mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">radionodelist</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties the radionodelist interface inherits the properties of nodelist. radionodelist.value if the underlying element collection contains radio buttons, the value property represents the checked radio button. on retrieving the value property, the value of the currently checked radio button is returned as a string. if the collection does not contain any radio buttons or none of the radio buttons in the collection is in checked state, the empty string is returned. on setting the value property, the first radio button input element whose value property is equal to the new value will be set to checked. methods the r...
Reporting API - Web APIs
g down a web site and stop anything running, but a report could still be obtained to give the developer some clues as to why it happened. reporting observers reports can also be obtained via reportingobserver objects created via javascript inside the website you are aiming to get reports on. this method is not as failsafe as the report-to method described above — any page crash could stop you retrieving the reports — but it is easier to set up, and more flexible. a reportingobserver object is created using the reportingobserver() constructor, which is passed two parameters: a callback function that has available as parameters the reports available in the observer's report queue, and a copy of the same reportingobserver object, so observation can be controlled directly from inside the callb...
Resource Timing API - Web APIs
an application can use the timing metrics to determine, for example, the length of time it takes to load a specific resource, such as an xmlhttprequest, <svg>, image, or script. the interface's properties create a resource loading timeline with high-resolution timestamps for network events such as redirect start and end times, dns lookup start and end times, request start, response start and end times, etc. the interface also includes other properties that provide data about the size of the fetched resource as well as the type of resource that initiated the fetch. ...
WindowOrWorkerGlobalScope.fetch() - Web APIs
y rejects when a network error is encountered (which is usually when there’s a permissions issue or similar). a fetch() promise does not reject on http errors (404, etc.). instead, a then() handler must check the response.ok and/or response.status properties. the fetch() method is controlled by the connect-src directive of content security policy rather than the directive of the resources it's retrieving. note: the fetch() method's parameters are identical to those of the request() constructor. syntax const fetchresponsepromise = fetch(resource [, init]) parameters resource this defines the resource that you wish to fetch. this can either be: a usvstring containing the direct url of the resource you want to fetch. some browsers accept the blob: and data: schemes. a request object...
HTML in XMLHttpRequest - Web APIs
vailable if the responsetype property has been set to "document". this limitation avoids wasting time parsing html uselessly when legacy code uses xmlhttprequest in the default mode to retrieve responsetext for text/html resources. also, this limitation avoids problems with legacy code that assumes that responsexml is null for http error pages (which often have a text/html response body). usage retrieving an html resource as a dom using xmlhttprequest works just like retrieving an xml resource as a dom using xmlhttprequest, except you can't use the synchronous mode and you have to explicitly request a document by assigning the string "document" to the responsetype property of the xmlhttprequest object after calling open() but before calling send(). var xhr = new xmlhttprequest(); xhr.onload = fun...
@import - CSS: Cascading Style Sheets
Web › CSS › @import
defined in the linked url. if the browser does not support any these queries, it does not load the linked resource. supports-query is either a <supports-condition> or a <declaration>. description imported rules must precede all other types of rules, except @charset rules; as it is not a nested statement, @import cannot be used inside conditional group at-rules. so that user agents can avoid retrieving resources for unsupported media types, authors may specify media-dependent @import rules. these conditional imports specify comma-separated media queries after the url. in the absence of any media query, the import is unconditional. specifying all for the medium has the same effect. formal syntax @import [ <string> | <url> ] [ <media-query-list> ]?;where <media-query-list> = <media-query>#where...
WAI ARIA Live Regions/API Support - Developer guides
fsets and inserted text) text replaced text_changed::delete followed immediately by text_changed::insert ia2_event_text_removed followed immediately by ia2_event_text_inserted * we do not use msaa's create/destroy at the request of screen reader vendors, who avoid those events because they cause crashes on some important system -- show/hide are the equivalent of those events. ...
Overview of events and handlers - Developer guides
the theory of the dom, which shows the change in flow from the original browser flow to the event driven browser. the latter approach changes the last steps from a single flow into a perpetual loop, where waiting for and handling the incidence of new events follows painting. the innovation of the dynamic approach allows for a page to be partially rendered even when the browser has not finished retrieving all resources; this approach also allows for event driven actions, which javascript leverages. (the talk is available from several sources, including this one.) currently, all execution environments for javascript code use events and event handling. the event design pattern the event system, at its core, is simply a programming design pattern. the pattern starts with an agreement over a kind of...
Enumerability and ownership of properties - JavaScript
defineproperty and such default enumerable to false). enumerable properties show up in for...in loops unless the property's key is a symbol. ownership of properties is determined by whether the property belongs to the object directly and not to its prototype chain. properties of an object can also be retrieved in total. there are a number of built-in means of detecting, iterating/enumerating, and retrieving object properties, with the chart showing below which are available. some sample code follows which demonstrates how to obtain the missing categories. property enumerability and ownership - built-in methods of detection, retrieval, and iteration functionality own object own object and its prototype chain prototype chain only detection enu...
Grammar and types - JavaScript
esenting a number is in memory as a string, there are methods for conversion. parseint() parsefloat() parseint only returns whole numbers, so its use is diminished for decimals. additionally, a best practice for parseint is to always include the radix parameter. the radix parameter is used to specify which numerical system is to be used. parseint('101', 2) // 5 an alternative method of retrieving a number from a string is with the + (unary plus) operator: '1.1' + '1.1' // '1.11.1' (+'1.1') + (+'1.1') // 2.2 // note: the parentheses are added for clarity, not required. literals literals represent values in javascript. these are fixed values—not variables—that you literally provide in your script. this section describes the following types of literals: array literals boolean lite...
Numbers and dates - JavaScript
the passed value is a finite number. number.isinteger() determines whether the passed value is an integer. number.isnan() determines whether the passed value is nan. more robust version of the original global isnan(). number.issafeinteger() determines whether the provided value is a number that is a safe integer. the number prototype provides methods for retrieving information from number objects in various formats. the following table summarizes the methods of number.prototype. methods of number.prototype method description toexponential() returns a string representing the number in exponential notation. tofixed() returns a string representing the number in fixed-point notation. toprecision() returns a ...
Error.prototype.stack - JavaScript
arated by a newline, with the first part of the line being the function name (if not a call from the global scope), then by an at (@) sign, the file location (except when the function is the error constructor as the error is being thrown), a colon, and, if there is a file location, the line number. (note that the error object also possesses the filename, linenumber and columnnumber properties for retrieving these from the error thrown (but only the error, and not its trace).) note that this is the format used by firefox. there is no standard formatting. however, safari 6+ and opera 12- use a very similar format. browsers using the v8 javascript engine (such as chrome, opera 15+, android browser) and ie10+, on the other hand, uses a different format (see the archived msdn error.stack docs). argumen...
Populating the page: how browsers work - Web Performance
igate to https://example.com, the html page is located on the server with ip address of 93.184.216.34. if you’ve never visited this site, a dns lookup must happen. your browser requests a dns lookup, which is eventually fielded by a name server, which in turn responds with an ip address. after this initial request, the ip will likely be cached for a time, which speeds up subsequent requests by retrieving the ip address from the cache instead of contacting a name server again. dns lookups usually only need to be done once per hostname for a page load. however, dns lookups must be done for each unique hostname the requested page references. if your fonts, images, scripts, ads, and metrics all have different hostnames, a dns lookup will have to be made for each one. this can be problematic for p...