Search completed in 0.96 seconds.
Selection.containsNode() - Web APIs
the selection.
containsnode() method indicates whether a specfied node is part of the selection. syntax sel.
containsnode(node, partialcontainment) parameters node the node that is being looked for in the selection. partialcontainment optional when true,
containsnode() returns true when a part of the node is part of the selection. when false,
containsnode() only returns true when the entire node is part of the selection. if not specified, the default value false is used. example check for selection this snippet checks whether anything inside the body element is selected. console.log(window.getselection().
containsnode(document.body, true)); find the hidden word in this example, a message appears when you select the secret word. it uses addeventlistener() to check for selec...
... working draft current ...
... working draft current ...
DOMTokenList.contains() - Web APIs
the
contains() method of the domtokenlist interface returns a boolean — true if the underlying list
contains the given token, otherwise false. syntax tokenlist.
contains(token); parameters token a domstring representing the token you want to check for the existance of in the list. return value a boolean, which is true if the calling list
contains token, otherwise false. examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. we then test for the existence of "c" in the list, and write the result into the <span>'s node.textcontent. ...
...les in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist. we then test for the existence of "c" in the list, and write the result into the <span>'s node.textcontent. first, the html: <span class="a b c"></span> now the javascript: let span = document.queryselector("span"); let classes = span.classlist; let result = classes.
contains("c"); if (result) { span.textcontent = "the classlist
contains 'c'"; } else { span.textcontent = "the classlist does not contain 'c'"; } the output looks like this: specifications specification status comment domthe definition of '
contains()' in that specification. living standard initial definition ...
Node.contains() - Web APIs
the node.
contains() method returns a boolean value indicating whether a node is a descendant of a given node, i.e. the node itself, one of its direct children (childnodes), one of the children's direct children, and so on. syntax node.
contains( othernode ) example this function checks to see if an element is in the page's body. as
contains is inclusive and determining if the body
contains itself isn't the intention of isinpage this case explicitly returns false. function isinpage(node) { return (node === document.body) ? false : document.body.
contains(node); } specifications specification status comment domthe definition of 'node.
contains()' in that specification. living standard initial definition ...
contains - XPath
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the
contains function determines whether the first argument string
contains the second argument string and returns boolean true or false. syntax
contains(haystack, needle) arguments haystack the string to be searched needle the string to look for as a substring of haystack returns true if haystack
contains needle. otherwise, false. defined xpath 1.0 4.2 gecko support supported. ...
Index - Web APIs
bled, mute, track the audiotrack property enabled specifies whether or not the described audio track is currently enabled for use. if the track is disabled by setting enabled to false, the track is muted and does not produce audio. 188 audiotrack.id api, audio, audio track, audiotrack, html dom, interface, media, property, read-only, reference, id, track the id property
contains a string which uniquely identifies the track represented by the audiotrack. 189 audiotrack.kind api, audio, audio track, audiotrack, html dom, media, property, read-only, reference, id, track the kind property
contains a string indicating the category of audio contained in the audiotrack. 190 audiotrack.label api, audio, audio track, audiotrack, html dom, media...
...ject-structure that can be used in the payment request api. the properties of basiccardrequest are defined in the basic card payment spec). 254 basiccardrequest.supportednetworks api, basic card payment, basiccardrequest, experimental, payment request, payment request api, property, reference, supportednetworks the supportednetworks property of the basiccardrequest dictionary
contains an array of domstrings representing the card networks that the retailer supports (e.g. amex, mastercard). 255 basiccardrequest.supportedtypes api, basic card payment, basiccardrequest, commerce, credit, debit, payment method, payment request, payment request api, property, reference, payment, supportedtypes the obsolete supportedtypes property of the basiccardrequest dictiona...
...es an object structure for payment response details such as the number/expiry date of the card used to make the payment, and the billing address. 257 basiccardresponse.billingaddress api, basic card payment, basiccardresponse, experimental, payment request, payment request api, property, reference, billingaddress the billingaddress property of the basiccardresponse dictionary
contains the billing address of the card used to make the payment. 258 basiccardresponse.cardnumber api, basic card request, basiccardresponse, experimental, payment request, payment request api, property, reference, cardnumber the cardnumber property of the basiccardresponse dictionary
contains the number of the card used to make the payment. 259 basiccardresponse.cardsecu...
...And 131 more matches
Index - Archive of obsolete content
nables you to test, run, and package add-ons. 138 jpm-mobile adb, add-ons, jpm, mobile, testing, travis-ci the node-based replacement for cfx --force-mobile. enables you to run and test add-ons for firefox mobile (aka fennec). 139 jpmignore jpm no summary! 140 package.json commonjs, jpm, sdk, add-on, package.json the package.json file
contains manifest data for your add-on, providing not only descriptive information about the add-on for presentation in the add-ons manager, but other metadata required of add-ons. 141 tutorials add-on sdk no summary! 142 add a context menu item add-on sdk, firefox, guide no summary! 143 add a menu item to firefox add-on sdk no summary! ...
...pen a web page add-on sdk no summary! 166 troubleshooting no summary! 167 unit testing add-on sdk, jpm no summary! 168 using xpcom without chrome bookmarks, chrome, sdk, xpcom no summary! 169 using third-party modules (jpm) addon-sdk, jpm first, while in the root of your add-on, install the package that
contains the modules you want to use: 170 bootstrapped extensions add-ons, extensions, firefox 4, gecko 2.0, guide, localization no summary! 171 code snippets add-ons, code snippets, extensions no summary! 172 alerts and notifications code snippets non-modal notification and further interaction with users 173 autocomplete code s...
...os, guide, preferences system no summary! 245 inline options add-ons, extensions, xul no summary! 246 install manifests add-ons, archive, extensions, manifests, toolkit api an install manifest is the file an add-on manager-enabled xul application (e.g. firefox or thunderbird) uses to determine information about an add-on as it is being installed. it
contains metadata identifying the add-on, providing information about who created it, where more information can be found about it, which versions of what applications it is compatible with, how it should be updated, and so on. 247 installing extensions and themes from web pages add-ons, extensions, obsolete, themes there are a variety of ways you can install extensions and themes fro...
...And 36 more matches
Source code directories overview - Archive of obsolete content
this document is a guide for developers to the directory structure of the mozilla source code tree. it gives a bird's eye view of the source code so a developer can get a good idea what is in mozilla and where to find things. it is a good document for a new mozilla developer to start learning about the mozilla code base. this document
contains material for seamonkey, firefox, and toolkit. it is a living document which is (supposed to be) updated monthly according to changes in the mozilla source tree. see also similar information in mozilla source code directory structure, and also see the more detailed overview of how the parts of gecko fit together. introduction: common subdirectories a common naming scheme is used throughout the mozilla source trees. at the top level is the name of the pr...
...e typically used for a common purpose. if files can be grouped into submodules, they are usually put in their own third level directory and given a unique name (e.g. txmgr in the editor directory in seamonkey). beneath this third level directory, there may be fourth level base, public and idl directories. thus, the scheme is recursive; it can apply to submodules, sub-submodules and so on. base
contains the basic (core) functionality for the module. base
contains all the source code that cannot be categorized into a submodule. build
contains any special makefiles for building the particular module. doc
contains any documentation associated with this module. idl
contains the xpidl (cross platform interface definition language) interface files. interfaces are used so functionality can be availa...
...pecial makefiles for building the particular module. doc
contains any documentation associated with this module. idl
contains the xpidl (cross platform interface definition language) interface files. interfaces are used so functionality can be available to both javascript scripts and c code with as little effort as possible. xpidl files have their own mini-language and processing tools. public
contains source code that will be exported to the dist/include directory. they are not all necessarily public in the general sense; some are only meant for internal use in a certain module. as more code is written with or converted to xpidl interfaces, the value of the public directory diminishes. src
contains the bulk of the source code. ...
...And 33 more matches
Index
xchange signed/encrypted data with communication partners, using public key encryption simplifies the key management. the environment that describes how to use public key encryption is called public key infrastructure (pki). the public keys that are exchanged between parties are transported using a container; the container is called a certificate, following standard x.509 version 3. a certificate
contains lots of other details; for example, it
contains a signature by a third party that expresses trust in the ownership relationship for the certificate. the trust assigned by the third party might be restricted to certain uses, which are listed in certificate extensions that are contained in the certificate. many (if not most) of the operations performed by nss involve the use of x.509 certificate...
... the rest. it will detect and open an existing database, or it can create a new one. alternatively, should you decide that you don't want to work with any persistent recording of certificates, you may initialize nss in a no-database mode. usually, nss will flush all data to disk as soon as new data has been added to permanent storage. ...
...n create a new one. alternatively, should you decide that you don't want to work with any persistent recording of certificates, you may initialize nss in a no-database mode. usually, nss will flush all data to disk as soon as new data has been added to permanent storage. storage consists of multiple files: a key database file, which
contains your secret keys, and a certificate database file which
contains the public portion of your own certificates, the certificates of peers or cas, and a list of trust decisions (such as to not trust a built-in ca, or to explicitly trust other cas). examples for the database files are key3.db and cert8.db, where the numbers are file version numbers. a third file
contains the list of external pkcs#11 modules that have been registered to be used by nss. the file cou...
...And 19 more matches
Index - Archive of obsolete content
learresults needscontent, needshelp, xul methods, xul reference no summary! 461 clearselection xul methods, xul reference no summary! 462 click xul methods, xul reference no summary! 463 close xul methods, xul reference no summary! 464 collapsetoolbar xul methods, xul reference no summary! 465
contains xul methods, xul reference no summary! 466 decrease xul methods, xul reference no summary! 467 decreasepage xul methods, xul reference no summary! 468 docommand xul methods, xul reference no summary! 469 ensureelementisvisible xul methods, xul reference no summary! 470 ensureindexisvisible ...
...enerated element. here is the content that was generated after one iteration:</vbox> 937 result generation xul, xul_template_guide in this section, we'll look at generating template output using rdf datasources. first, however, some background. 938 rule compilation xul, xul_template_guide a xul template is made up of a query and a series of rules. ...
...a query is declared with the query tag (new to ff3; ff2 only worked with rdf datasources and had no query tag), which you would place directly inside the <template>. the job of the query is to generate a set of output results. ...
...And 13 more matches
Index
using the gecko sdk add-ons, developing mozilla, extensions, gecko, needscontent no summary! 89 using the clipboard add-ons, clipboard, extensions, guide, mozilla, xpcom this section provides information about cutting, copying, and pasting to and from the clipboard. 90 weak reference xpcom in xpcom, a weak reference is a special object that
contains a pointer to an xpcom object, but doesnot keep that object alive. if the referent object is destroyed before the weak reference, the pointer inside the weak reference is set to nsnull. 91 working with multiple versions of interfaces add-ons, extensions, xpcom in this short note we illustrate how one can update an xpcom module in order for it to work in both firefox 2 and fire...
...ilityservice accessibility, interfaces, interfaces:scriptable, needscontent, xpcom api reference, xpcom interface reference no summary! 249 nsiaccessible accessibility, interfaces, interfaces:scriptable, needsmarkupwork, xpcom api reference the nsiaccessible interface is a cross-platform interface that supports platform-specific accessibility apis like msaa and atk.
contains the sum of what's needed to support iaccessible as well as atk's generic accessibility objects. 250 attributes attributes of accessible. 251 childcount number of accessible children. 252 children array of all this node's children. 253 defaultkeybinding provides localized string of global keyboard accelerator f...
...name of the accessible action at the given zero-based index. 266 getbounds this method returns accessible's (x and y) coordinates relative to the screen and accessible's width and height. 267 getchildat this method returns nth accessible child using zero-based index. 268 getchildatpoint this method returns an accessible child which
contains the coordinate at (x, y) in screen pixels. 269 getkeybindings this method provides array of localized string of global keyboard accelerator for the given action index supported by accessible. 270 getrelation this method returns accessible relation for this accessible object by index. 271 getrelations this method returns multiple ac...
...And 11 more matches
HTTP Index - HTTP
er the access-control-request-method request header is used by browsers when issuing a preflight request, to let the server know which http method will be used when the actual request is made. this header is necessary as the preflight request is always an options and doesn't use the same method as the actual request. 63 age caching, http, response, header the age header
contains the time in seconds the object has been in a proxy cache. 64 allow entity header, http, http header, reference, header the allow header lists the set of methods support by a resource. 65 alt-svc draft, http, http header, needscompattable, needscontent, needsexample, reference the alt-svc header is used to list alternate ways to reach this website. ...
...ence, header the allow header lists the set of methods support by a resource. 65 alt-svc draft, http, http header, needscompattable, needscontent, needsexample, reference the alt-svc header is used to list alternate ways to reach this website. 66 authorization http, http header, reference, request header, header the http authorization request header
contains the credentials to authenticate a user agent with a server, usually after the server has responded with a 401 unauthorized status and the www-authenticate header. 67 cache-control cache-control, general header, http, http header, reference the cache-control general-header field is used to specify directives for caching mechanisms in both requests and responses. caching direct...
...ng) their effects. these violation reports consist of json documents sent via an http post request to the specified uri. 108 content-type content-type, entity header, http, reference, header the content-type entity header is used to indicate the media type of the resource. 109 cookie cookies, http, reference, header, request the cookie http request header
contains stored http cookies previously sent by the server with the set-cookie header. 110 cookie2 http, obsolete, reference, header, request the obsolete cookie2 http request header used to advise the server that the user agent understands "new-style" cookies, but nowadays user agents will use the cookie header instead, not this one. 111 cross-origin-resource-policy ht...
...And 10 more matches
jspage - Archive of obsolete content
ll(e,this[b],b,this);}return c;},some:function(c,d){for(var b=0,a=this.length;b<a;b++){if(c.call(d,this[b],b,this)){return true; }}return false;},associate:function(c){var d={},b=math.min(this.length,c.length);for(var a=0;a<b;a++){d[c[a]]=this[a];}return d;},link:function(c){var a={}; for(var e=0,b=this.length;e<b;e++){for(var d in c){if(c[d](this[e])){a[d]=this[e];delete c[d];break;}}}return a;},
contains:function(a,b){return this.indexof(a,b)!=-1; },extend:function(c){for(var b=0,a=c.length;b<a;b++){this.push(c[b]);}return this;},getlast:function(){return(this.length)?this[this.length-1]:null;},getrandom:function(){return(this.length)?this[$random(0,this.length-1)]:null; },include:function(a){if(!this.
contains(a)){this.push(a);}return this;},combine:function(c){for(var b=0,a=c.length;b<a;b++){thi...
...);}});number.alias("times","each"); (function(b){var a={};b.each(function(c){if(!number[c]){a[c]=function(){return math[c].apply(null,[this].concat($a(arguments)));};}});number.implement(a); })(["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","max","min","pow","sin","sqrt","tan"]);string.implement({test:function(a,b){return((typeof a=="string")?new regexp(a,b):a).test(this); },
contains:function(a,b){return(b)?(b+this+b).indexof(b+a+b)>-1:this.indexof(a)>-1;},trim:function(){return this.replace(/^\s+|\s+$/g,"");},clean:function(){return this.replace(/\s+/g," ").trim(); },camelcase:function(){return this.replace(/-\d/g,function(a){return a.charat(1).touppercase();});},hyphenate:function(){return this.replace(/[a-z]/g,function(a){return("-"+a.charat(0).tolowercase()); });},capital...
...on(b){a.push(b);});return a;},toquerystring:function(a){var b=[]; hash.each(this,function(f,e){if(a){e=a+"["+e+"]";}var d;switch($type(f)){case"object":d=hash.toquerystring(f,e);break;case"array":var c={};f.each(function(h,g){c[g]=h; });d=hash.toquerystring(c,e);break;default:d=e+"="+encodeuricomponent(f);}if(f!=undefined){b.push(d);}});return b.join("&");}});hash.alias({keyof:"indexof",hasvalue:"
contains"}); var event=new native({name:"event",initialize:function(a,f){f=f||window;var k=f.document;a=a||f.event;if(a.$extended){return a;}this.$extended=true;var j=a.type; var g=a.target||a.srcelement;while(g&&g.nodetype==3){g=g.parentnode;}if(j.test(/key/)){var b=a.which||a.keycode;var m=event.keys.keyof(b);if(j=="keydown"){var d=b-111; if(d>0&&d<13){m="f"+d;}}m=m||string.fromcharcode(b).tolowercase()...
...And 9 more matches
nsIPromptService
in wstring atext, in wstring acheckmsg, inout boolean acheckstate ); parameters aparent the parent window for the dialog. if set to null the parent window will be nsiwindowwatcher.activewindow. adialogtitle text to appear in the title of the dialog. atext text to appear in the body of the dialog. acheckmsg text to appear with the checkbox. acheckstate
contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns. if you call this method from javascript you need to wrap this argument in an object with its 'value' property set to a boolean (or use an empty object). see also the alertcheck_example. confirm() shows a dialog with ok and cancel buttons. boolean confirm( in nsidomwindow ...
...in wstring atext, in wstring acheckmsg, inout boolean acheckstate ); parameters aparent the parent window for the dialog. if set to null the parent window will be nsiwindowwatcher.activewindow. adialogtitle text to appear in the title of the dialog. atext text to appear in the body of the dialog. acheckmsg text to appear with the checkbox. acheckstate
contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns. if you call this method from javascript you need to wrap this argument in an object with its 'value' property set to a boolean (or use an empty object). return value true for ok, false for cancel confirmex() puts up a dialog with up to 3 buttons and an optional, label...
...os_0) flags are set in abuttonflags abutton1title caption displayed for button 1 if(button_title_is_string*button_title_pos_1) flags are set in abuttonflags abutton2title caption displayed for button 2 if(button_title_is_string*button_title_pos_2) flags are set in abuttonflags acheckmsg text to appear with the checkbox. null if no checkbox is displayed. acheckstate
contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns. if you call this method from javascript you need to wrap this argument in an object with its 'value' property set to a boolean (or use an empty object). return value index of the button pressed prompt() shows a dialog with an edit field and an optional, labeled checkb...
...And 9 more matches
Index - HTTP
ference, header the access-control-request-method request header is used when issuing a preflight request to let the server know which http method will be used when the actual request is made. this header is necessary as the preflight request is always an options and doesn't use the same method as the actual request. 15 age caching, http, response, header the age header
contains the time in seconds the object has been in a proxy cache. 16 allow entity header, http, http header, reference, header the allow header lists the set of methods support by a resource. 17 alt-svc draft, http, http header, needscompattable, needscontent, needsexample, reference the alt-svc header is used to list alternate ways to reach this website. ...
...ence, header the allow header lists the set of methods support by a resource. 17 alt-svc draft, http, http header, needscompattable, needscontent, needsexample, reference the alt-svc header is used to list alternate ways to reach this website. 18 authorization http, http header, reference, request header, header the http authorization request header
contains the credentials to authenticate a user agent with a server, usually after the server has responded with a 401 unauthorized status and the www-authenticate header. 19 cache-control general header, http, http header, reference the cache-control general-header field is used to specify directives for caching mechanisms in both requests and responses. caching directives are unidir...
...ing) their effects. these violation reports consist of json documents sent via an http post request to the specified uri. 53 content-type content-type, http, reference, request header, header the content-type entity header is used to indicate the media type of the resource. 54 cookie cookies, http, reference, header, request the cookie http request header
contains stored http cookies previously sent by the server with the set-cookie header. 55 cookie2 http, obsolete, reference, header, request the obsolete cookie2 http request header used to advise the server that the user agent understands "new-style" cookies, but nowadays user agents will use the cookie header instead, not this one. 56 dnt dnt, http, reference, header ...
...And 9 more matches
HTML documentation index - HTML: Hypertext Markup Language
type specifies the url of the vocabulary that will be used to define itemprop's (item properties) in the data structure. 26 lang global attributes, html, reference the lang global attribute helps define the language of an element: the language that non-editable elements are written in, or the language that the editable elements should be written in by the user. the attribute
contains a single “language tag” in the format defined in tags for identifying languages (bcp47). 27 part global attributes, html, reference, part the part global attribute
contains a space-separated list of the part names of the element. part names allows css to select and style specific elements in a shadow tree via the ::part pseudo-element. 28 slot global attrib...
...signed to the slot created by the <slot> element whose name attribute's value matches that slot attribute's value. 29 spellcheck global attributes, html, reference the spellcheck global attribute is an enumerated attribute defines whether the element may be checked for spelling errors. 30 style global attributes, html, reference the style global attribute
contains css styling declarations to be applied to the element. note that it is recommended for styles to be defined in a separate file or files. this attribute and the <style> element have mainly the purpose of allowing for quick styling, for example for testing purposes. 31 tabindex global attributes, html, reference the tabindex global attribute indicates that its element can be fo...
...ng for quick styling, for example for testing purposes. 31 tabindex global attributes, html, reference the tabindex global attribute indicates that its element can be focused, and where it participates in sequential keyboard navigation (usually with the tab key, hence the name). 32 title global attributes, html, reference, title the title global attribute
contains text representing advisory information related to the element it belongs to. 33 translate experimental, global attributes, html, reference the translate global attribute is an enumerated attribute that is used to specify whether an element's translateable attribute values and its text node children should be translated when the page is localized, or whether to leave them unch...
...And 8 more matches
Working with JSON - Learn web development
s data further down the hierarchy, you simply have to chain the required property names and array indexes together. for example, to access the third superpower of the second hero listed in the members list, you'd do this: superheroes['members'][1]['powers'][2] first we have the variable name — superheroes. inside that we want to access the members property, so we use ["members"]. members
contains an array populated by objects. we want to access the second object inside the array, so we use [1]. inside this object, we want to access the powers property, so we use ["powers"]. inside the powers property is an array containing the selected hero's superpowers. we want the third one, so we use [2]. note: we've made the json seen above available inside a variable in our jsontest.html exampl...
...e": "madame uppercut", "age": 39, "secretidentity": "jane wilson", "powers": [ "million tonne punch", "damage resistance", "superhuman reflexes" ] } ] the above is perfectly valid json. you'd just have to access array items (in its parsed version) by starting with an array index, for example [0]["powers"][0]. other notes json is purely a data format — it
contains only properties, no methods. json requires double quotes to be used around strings and property names. single quotes are not valid. even a single misplaced comma or colon can cause a json file to go wrong, and not work. you should be careful to validate any data you are attempting to use (although computer-generated json is less likely to include errors, as long as the generator program is work...
... be a valid json object. unlike in javascript code in which object properties may be unquoted, in json only quoted strings may be used as properties. active learning: working through a json example so, let's work through an example to show how we could make use of some json data on a website. getting started to begin with, make local copies of our heroes.html and style.css files. ...
...And 7 more matches
XUL Structure - Archive of obsolete content
s of the appearance of a window. they are stored separately from xul files to facilitate modifying the skin (theme) of an application. any images used are stored here also. locale - locale specific files all the text that is displayed within a window is stored separately. this way, a user can have a set for their own language. ...
...ecific files all the text that is displayed within a window is stored separately. this way, a user can have a set for their own language. content packages the name of the jar file might describe what it
contains, but you can't be sure unless you view its contents. let's use the browser package included with firefox as an example. if you extract the files in browser.jar, you will find that it
contains a directory structure much like the following: content browser browser.xul browser.js -- other browser xul and js files goes here -- bookmarks -- bookmarks files go here -- preferences -- preferences files go here -- . . . this is easily recognizable as a content package, as the top-level directory is called content. for skins, this directory ...
...ctory will usually be called skin and for locales, it will usually be called locale. this naming scheme isn't necessary, but this is a common convention to make the parts of a package clearer. some packages may include a content section, a skin, and a locale. in this case, you will find a subdirectory for each type. for example, chatzilla is distributed in this way. the content/browser directory
contains a number of files with .xul and .js extensions. the xul files are the ones with the .xul extension. the files with .js extensions are javascript files containing scripts that handle the functionality of a window. many xul files have a script file associated with them, and some may have more than one. in the listing above, two files have been shown. there are of course others, but for simplicity ...
...And 6 more matches
HTML elements reference - HTML: Hypertext Markup Language
basics of html elements and attributes, see the section on elements in the introduction to html article. main root element description <html> the html <html> element represents the root (top-level element) of an html document, so it is also referred to as the root element. all other elements must be descendants of this element. document metadata metadata
contains information about the page. this includes information about styles, scripts and data to help software (search engines, browsers, etc.) use and render the page. metadata for styles and scripts may be defined in the page or link to another file that has the information. element description <base> the html <base> element specifies the base url to use for all relative...
...s, scripts and data to help software (search engines, browsers, etc.) use and render the page. metadata for styles and scripts may be defined in the page or link to another file that has the information. element description <base> the html <base> element specifies the base url to use for all relative urls in a document. <head> the html <head> element
contains machine-readable information (metadata) about the document, like its title, scripts, and style sheets. <link> the html external resource link element (<link>) specifies relationships between the current document and an external resource. this element is most commonly used to link to stylesheets, but is also used to establish site icons (both "favicon" style icons and icons for the h...
...d to link to stylesheets, but is also used to establish site icons (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things. <meta> the html <meta> element represents metadata that cannot be represented by other html meta-related elements, like <base>, <link>, <script>, <style> or <title>. <style> the html <style> element
contains style information for a document, or part of a document. <title> the html title element (<title>) defines the document's title that is shown in a browser's title bar or a page's tab. sectioning root element description <body> the html <body> element represents the content of an html document. there can be only one <body> element in a document.
...And 6 more matches
browser - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a xul <browser> element represents a frame which is expected to contain a view of a web document. it is similar to an iframe except that it holds a page history and
contains additional methods to manipulate the currently displayed page. are you here looking for information about the firefox web browser, or because you'd like to download the latest version of firefox? get firefox most of the properties and methods of the browser will rarely be used and can only be called from chrome urls. other urls will need to use the document and history objects to change the displayed document. attributes autocompleteenabled, autocompletepopup, autoscroll, disablehistory, disableglobalhistory, disablese...
... type: boolean this read-only property is true if there is a page to go back to in the session history and the back button should be enabled. cangoforward type: boolean this read-only property is true if there is a page to go forward to in the session history and the forward button should be enabled. contentdocument type: document this read-only property
contains the document object in the element. contentprincipal type: nsiprincipal this read-only property
contains the principal for the content loaded in the browser, which provides security context information. contenttitle type: string this read-only property
contains the title of the document object in the browser. contentvieweredit type: nsicontentviewer...
... contentprincipal type: nsiprincipal this read-only property
contains the principal for the content loaded in the browser, which provides security context information. contenttitle type: string this read-only property
contains the title of the document object in the browser. contentvieweredit type: nsicontentvieweredit this read-only property
contains the nsicontentvieweredit which handles clipboard operations on the document. contentviewerfile type: nsicontentviewerfile reference to the nsicontentviewerfile interface for the document. ...
...And 5 more matches
tabbrowser - Archive of obsolete content
type: boolean this read-only property is true if there is a page to go back to in the session history and the back button should be enabled. cangoforward type: boolean this read-only property is true if there is a page to go forward to in the session history and the forward button should be enabled. contentdocument type: document this read-only property
contains the document object in the element. contenttitle type: string this read-only property
contains the title of the document object in the browser. contentvieweredit type: nsicontentvieweredit this read-only property
contains the nsicontentvieweredit which handles clipboard operations on the document. contentviewerfile type: nsicontentview...
...roperty
contains the nsicontentvieweredit which handles clipboard operations on the document. contentviewerfile type: nsicontentviewerfile reference to the nsicontentviewerfile interface for the document. contentwindow type: todo use the contentwindow.wrappedjsobject to obtain a dom(html) window object currenturi type: nsiuri this read-only property
contains the currently loaded url. to change the url, use the loaduri method. docshell type: nsidocshell this read-only property
contains the nsidocshell object for the document. ...
...the properties of the nsidocumentcharsetinfo object were merged into the docshell in gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9). ...
...And 5 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
ary web accessibility (a11y) refers to best practices for keeping a website usable despite physical and technical restrictions. web accessibility is formally defined and discussed at the w3c through the web accessibility initiative (wai). 12 accessibility tree (aom) aom, accessibility, dom, glossary, reference the accessibility tree, or accessibility object model (aom),
contains accessibility-related information for most html elements. 13 adobe flash adobe, codingscripting, flash, glossary, infrastructure flash is an obsolescent technology developed by adobe for viewing expressive web applications, multimedia content, and streaming media. adobe flash can run from supporting web browsers via a browser plug-in. 14 ajax ajax, codingscript...
...local development machine, without having to change the master repository or even having write access to it. 172 global object codingscripting, glossary, needscontent a global object is an object that always exists in the global scope. 173 global scope codingscripting, glossary, needscontent in a programming environment, the global scope is the scope that
contains, and is visible in, all other scopes. 174 global variable codingscripting, glossary a global variable is a variable that is declared in the global scope in other words, a variable that is visible from all other scopes. 175 glyph glossary, svg, typography a glyph is a term used in typography for the visual representation of one or more characters. 1...
...roduces a fixed-length hash output. it is commonly in the form of a 128-bit "fingerprint" or "message digest". hashes are very useful for cryptography — they insure the integrity of transmitted data. this provides the basis for hmac's, which provide message authentication. 202 head codingscripting, glossary, html, head, metadata the head is the part of an html document that
contains metadata about that document, such as author, description, and links to css or javascript files that should be applied to the html. 203 high-level programming language codingscripting, glossary a high-level programming language has a significant abstraction from the details of computer operation. it is designed to be easily understood by humans and for this reason they must b...
...And 5 more matches
Client-Server Overview - Learn web development
urces, the data for which is encoded within the request body. client-side cookies. cookies contain session data about the client, including keys that the server can use to determine their login status and permissions/accesses to resources. web servers wait for client request messages, process them when they arrive, and reply to the web browser with an http response message. the response
contains an http response status code indicating whether or not the request succeeded (e.g. "200 ok" for success, "404 not found" if the resource cannot be found, "403 forbidden" if the user isn't authorised to see the resource, etc). the body of a successful response to a get request would contain the requested resource. when an html page is returned it is rendered by the web browser. as part of process...
... perform a search on mdn for the term "client server overview" will look a lot like the text shown below (it will not be identical because parts of the message depend on your browser/setup). the format of http messages is defined in a "web standard" (rfc7230). ...
... a lot like the text shown below (it will not be identical because parts of the message depend on your browser/setup). the format of http messages is defined in a "web standard" (rfc7230). you don't need to know this level of detail, but at least now you know where this all came from! the request each line of the request
contains information about it. ...
...And 5 more matches
Drawing and Event Handling - Plugins
-ins. note: windowless plug-ins were not supported on the x window system platform prior to gecko 1.9 alpha 7 (bug 137189). the npwindow structure when a plug-in is loaded, it is drawn into a target area. this target is either the windowed plug-in's native window, or the drawable of a windowless plug-in. the npwindow structure represents either the native window or a drawable. this structure
contains information about coordinate position, size, the state of the plug-in (windowed or windowless), and some platform-specific information. note: when a plug-in is drawn to a window, the plug-in is responsible for preserving state information and ensuring that the original state is restored. for windowless plug-ins, the browser calls the npp_setwindow method with an npwindow structure that repres...
...it. in this case, before the browser displays any print dialog boxes, npp_print is called with printinfo->mode equal to np_full. on mac os, full-page printing requires that the field printinfo contain a standard mac os thprint (see printing.h). of course, npp_print is also called with printinfo->mode equal to np_embed when the instance is embedded. in this case, platformprint->embedprint.window
contains the window in which the plug-in should print. on ms windows, note that the coordinates for the window rectangle are in twips format. for this reason, you need to convert the x - and y - coordinates using the windows api call dptolp when you output text. setting the window the browser calls the npp_setwindow function to set the window in which a plug-in draws or returns an error code. this wind...
...-in. unix and ms windows the queried information is returned in the variable parameter. this parameter is valid only for the unix and ms windows platforms. for unix, the values are either the current display (npnvxdisplay) or the application's context (npnvxtappcontext). for ms windows, the value is the native window on which the plug-in drawing occurs (npnvnetscapewindow). the value parameter
contains the name of the plug-in. you can also use npn_getvalue to help create a menu or dialog box for a windowless plug-in. windowed plug-ins the browser gives each windowed plug-in its own native window, often a child window of the the browser window itself, to draw into. the plug-in has complete control over drawing and event handling within that window. on mac os, the browser does not give a wind...
...And 5 more matches
HTTP headers - HTTP
unmodified and caches must store them. hop-by-hop headers these headers are meaningful only for a single transport-level connection, and must not be retransmitted by proxies or cached. note that only hop-by-hop headers may be set using the connection general header. authentication www-authenticate defines the authentication method that should be used to access a resource. authorization
contains the credentials to authenticate a user-agent with a server. proxy-authenticate defines the authentication method that should be used to access a resource behind a proxy server. proxy-authorization
contains the credentials to authenticate a user agent with a proxy server. caching age the time, in seconds, that the object has been in a proxy cache. cache-control directives for caching m...
...man language the server is expected to send back. this is a hint and is not necessarily under the full control of the user: the server should always pay attention not to override an explicit user choice (like selecting a language from a dropdown). controls expect indicates expectations that need to be fulfilled by the server to properly handle the request. max-forwards cookies cookie
contains stored http cookies previously sent by the server with the set-cookie header. set-cookie send cookies from the server to the user-agent. cookie2
contains an http cookie previously sent by the server with the set-cookie2 header, but has been obsoleted. use cookie instead. set-cookie2 sends cookies from the server to the user-agent, but has been obsoleted. use set-cookie instead. cors ...
...mber of bytes. content-type indicates the media type of the resource. content-encoding used to specify the compression algorithm. content-language describes the human language(s) intended for the audience, so that it allows a user to differentiate according to the users' own preferred language. content-location indicates an alternate location for the returned data. proxies forwarded
contains information from the client-facing side of proxy servers that is altered or lost when a proxy is involved in the path of the request. x-forwarded-for identifies the originating ip addresses of a client connecting to a web server through an http proxy or a load balancer. x-forwarded-host identifies the original host requested that a client used to connect to your proxy or load balancer. x...
...And 5 more matches
Install Manifests - Archive of obsolete content
the format of the install manifest is rdf/xml. the file must be called install.rdf and live at the top level of an add-on's xpi file. ...
...one short line of text. examples <em:description>advanced foo tools.</em:description> developer the name(s) of co-developers. you may specify more than one of this value to specify multiple developers. examples <em:developer>jane doe</em:developer> <em:developer>koos van der merwe</em:developer> hasembeddedwebextension if present and given the value "true", this indicates that this add-on
contains an embedded webextension. <em:hasembeddedwebextension>true</em:hasembeddedwebextension> homepageurl a link to the add-on's home page - intended for display in the user interface. examples <em:homepageurl>https://www.example.com/</em:homepageurl> iconurl a chrome:// url to an icon to display in the add-ons list. the icon will be displayed at 32x32 in firefox 3.6 and lower. in firefox 4.0 an...
...tall.rdf or 2 if there is no optionsurl and the file options.xul exists in the root of the add-on. <em:optionstype>2</em:optionstype> options can be opened in a new tab since firefox 7.0a1. to do so, set optionstype to 3 and set optionsurl to a the path of a page to open. <em:optionstype>3</em:optionstype> <em:optionsurl>chrome://myaddon/content/options.html</em:optionsurl> this section here
contains an example of localized html page as an option panel in a new tab: bootstrapped extensions :: localization (l10n) (example linked to is: github :: l10n-html-options). optionsurl the chrome:// url of the extension's options dialog box. this is only useful to extensions. if this property is specified, when the extension is selected in the extensions list, the options button is enabled and will sh...
...And 4 more matches
A first splash into JavaScript - Learn web development
gameover(), which we'll discuss later. now we've chained another test onto the end of the last one using an else if(){ } structure. this one checks whether this turn is the user's last turn. if it is, the program does the same thing as in the previous block, except with a game over message instead of a congratulations message. the final block chained onto the end of this code (the else { })
contains code that is only run if neither of the other two tests returns true (i.e. the player didn't guess right, but they have more guesses left). in this case we tell them they are wrong, then we perform another conditional test to check whether the guess was higher or lower than the answer, displaying a further message as appropriate to tell them higher or lower. the last three lines in the func...
...ze what's going on here in a bit more detail. in javascript, most of the items you will manipulate in your code are objects. an object is a collection of related functionality stored in a single grouping. you can create your own objects, but that is quite advanced and we won't be covering it until much later in the course. for now, we'll just briefly discuss the built-in objects that your browser
contains, which allow you to do lots of useful things. in this particular case, we first created a guessfield constant that stores a reference to the text input form field in our html — the following line can be found amongst our declarations near the top of the code: const guessfield = document.queryselector('.guessfield'); to get this reference, we used the queryselector() method of the document ob...
...t input form field in our html — the following line can be found amongst our declarations near the top of the code: const guessfield = document.queryselector('.guessfield'); to get this reference, we used the queryselector() method of the document object. queryselector() takes one piece of information — a css selector that selects the element you want a reference to. because guessfield now
contains a reference to an <input> element, it now has access to a number of properties (basically variables stored inside objects, some of which can't have their values changed) and methods (basically functions stored inside objects). one method available to input elements is focus(), so we can now use this line to focus the text input: guessfield.focus(); variables that don't contain references to for...
...And 4 more matches
The Firefox codebase: CSS Guidelines
avoid magic numbers; prefer automatic sizing or alignment methods. some examples to avoid: absolutely positioned elements hardcoded values such as: vertical-align: -2px; . the reason you should avoid such "hardcoded" values is that, they don't necessarily work for all font-size configurations. avoid setting styles in javascript. ...
... avoid magic numbers; prefer automatic sizing or alignment methods. some examples to avoid: absolutely positioned elements hardcoded values such as: vertical-align: -2px; . the reason you should avoid such "hardcoded" values is that, they don't necessarily work for all font-size configurations. avoid setting styles in javascript. ...
...ndant selectors is good practice for performance when possible: for example: .autocomplete-item[selected] > .autocomplete-item-title would be more efficient than .autocomplete-item[selected] .autocomplete-item-title overriding css before overriding any css rules, check whether overriding is really needed. sometimes, when copy-pasting older code, it happens that the code in question
contains unnecessary overrides. this could be because the css that it was overriding got removed in the meantime. in this case, simply dropping the override should work. it is also good practice to look at whether the rule you are overriding is still needed: maybe the ux spec for the component has changed and that rule can actually be updated or removed. when this is the case, don't be afraid to remove o...
...And 4 more matches
nss tech note5
using nss to perform miscellaneous cryptographic operations nss technical note: 5 nss project info is at http://www.mozilla.org/projects/security/pki/nss/ you can browse the nss source online at http://lxr.mozilla.org/mozilla/source/security/nss/ and http://lxr.mozilla.org/security/ be sure to look for sample code first for things you need to do. note: this document
contains code snippets that focus on essential aspects of the task and often do not illustrate all the cleanup that needs to be done. also, this document does not attempt to be an exhaustive survey of all possible ways to do a certain task; it merely tries to show a certain way. encrypt/decrypt include headers #include "nss.h" #include "pk11pub.h" make sure nss is initialized.the simplest init function,...
...lgorithm identifiers are (without the sec_oid_ prefix) : md2, md5, sha1, sha256, sha384, sha512. ...
...ut the sec_oid_ prefix) : md2, md5, sha1, sha256, sha384, sha512. ...
...And 4 more matches
nsIMsgHeaderParser
if any of the addresses doesn't have a mailbox, then the user name is used instead. autf8string extractheaderaddressmailboxes( in string line ); parameters line the header line to parse. return value a comma-separated list of just the mailbox parts of the addresses. exceptions thrown missing...
...of the addresses doesn't have a mailbox, then the user name is used instead. autf8string extractheaderaddressmailboxes( in string line ); parameters line the header line to parse. return value a comma-separated list of just the mailbox parts of the addresses. exceptions thrown missing exception missing description native code only!extractheaderaddressnames given a string which
contains a list of header addresses, returns a comma-separated list of just the 'user name' portions. if any of the addresses doesn't have a name, then the mailbox is used instead. autf8string extractheaderaddressnames( in string line ); parameters line the header line to parse. return value a comma-separated list of just the name parts of the addresses. exceptions thrown missing exceptio...
...(firefox 3) wstring makefulladdresswstring( in wstring name, in wstring addr ); parameters name the name of the sender. this should be in utf-8. addr the address of the sender. this should be in utf-8. return value a string of the form name <address>. exceptions thrown missing exception missing description native code only!parseheaderaddresses given a string which
contains a list of header addresses, parses it into their component names and mailboxes. the returned value is the number of addresses, or a negative error code; the names and addresses are returned into the provided pointers as consecutive null-terminated strings. it is up to the caller to free them. note that some of the strings may be zero-length. the caller may pass nsnull for charset and it wi...
...And 4 more matches
widget - Archive of obsolete content
u can include this content inline as a string by using the content property, or point to content using a url with the contenturl property. upon creation, the widget is automatically added to the add-on bar. you can set the width of a widget, but the height is fixed so as to fit in the add-on bar. if the content is an image, it is automatically scaled to be 16x16 pixels. for example, this widget
contains an image, so it looks like a simple icon: require("sdk/widget").widget({ id: "mozilla-icon", label: "my mozilla widget", contenturl: "http://www.mozilla.org/favicon.ico" }); you can make contenturl point to an html or icon file which you have packaged inside your add-on. just save the file in your add-on's data directory, and reference it using the data.url() method of the self module: v...
...icon.ico" }); you can make contenturl point to an html or icon file which you have packaged inside your add-on. just save the file in your add-on's data directory, and reference it using the data.url() method of the self module: var data = require("sdk/self").data; require("sdk/widget").widget({ id: "my-widget", label: "my widget", contenturl: data.url("my-content.html") }); this widget
contains an entire web page: require("sdk/widget").widget({ id: "hello-display", label: "my hello widget", content: "hello!", width: 50 }); widgets are quite small by default, so this example used the width property to grow it in order to show all the text. scripting widget content to interact with the widget's content you need to load a separate script into the panel. in the sdk these scripts...
...oint to local content loaded from your add-on's "data" directory or remote content, an image or web content. setting it updates the widget's appearance immediately. however, if the widget was created using content, then this property is meaningless, and setting it has no effect. setting the contenturl property will break the channel of communication between this widget and any content scripts it
contains. messages sent from the content script will no longer be received by the main add-on code, and vice versa. this issue is currently tracked as bug 825434. panel a panel to open when the user clicks on the widget. width the widget's width in pixels. setting it updates the widget's appearance immediately. tooltip the text of the tooltip that appears when the user hovers over the widget. allow...
...And 3 more matches
ui/frame - Archive of obsolete content
pong(e) { if (e.data == "ping") { // message only the sender, and not any frames attached to other browser windows e.source.postmessage("pong", "*"); } } parameters event : string the name of the event to listen to. frame supports the following events: attach, detach, load, ready, and message. listener : function the listener function. this is passed an event object which always
contains a source property, which has a postmessage() function modeled after window.postmessage(). you can use this to communicate only with the specific frame instance that generated the event, and not to any frame instance attached to other browser windows. once(event, listener) assign a listener to the first occurrence only of an event emitted by the frame. frame supports the following events: attac...
... pong(e) { if (e.data == "ping") { // message only the sender, and not any frames attached to other browser windows e.source.postmessage("pong", "*"); } } parameters event : string the name of the event to listen to. frame supports the following events: attach, detach, load, ready, and message. listener : function the listener function. this is passed an event object which always
contains a source property, which has a postmessage() function modeled after window.postmessage(). you can use this to communicate only with the specific frame instance that generated the event, and not to any frame instance attached to other browser windows. removelistener(event, listener) removes an event listener. for example, this code is equivalent to once(): var { frame } = require("sdk/ui/frame...
...d its document: for example, when the user opens a new browser window, if that window has a toolbar containing this frame. since the event is dispatched asynchronously, the document may already be loaded by the time the event is received. at this point, you should not try to send messages to scripts hosted in the frame, because the frame scripts may not have been loaded. arguments event : this
contains two properties: source, which defines a postmessage() function which you can use to send messages back to this particular frame instance. but note that at this point you should not try to send messages to scripts hosted in the frame, because the frame scripts may not have been loaded. origin, which you can use as the targetorigin argument to postmessage() if you want to communicate with this ...
...And 3 more matches
Elements - Archive of obsolete content
lease do not edit only on the basis of another xbl specification. <!element bindings ( binding* ) > hierarchy: root element may contain: <binding> the bindings element is the root element of any xbl document. it should usually declare xbl as the default namespace (unless an xbl namespace prefix is used) and it may additionally declare other namespace prefixes used in your binding. bindings
contains zero or more binding elements as children. each binding child element defines a unique binding that can be attached to elements in other documents. an element can have only one binding attached (explicitly or inherited) at one moment. from several bindings only the last in the sequence will be used (like with any css rule). helloworld.html: <!doctype html public "-//w3c//dtd html 4.01//en"> <h...
...la.org/xbl" xmlns:html="http://www.w3.org/1999/xhtml"> <binding id="default"> <content><html:b>hello world! </html:b><children/></content> </binding> <binding id="hello2"> <content><html:b>hello from my binding! </html:b><children/></content> </binding> </bindings> you can view the result by opening helloworld.html in firefox. hello.xml should reside in the same directory which
contains helloworld.html. next: bindings > binding element. notes in the current stable releases of mozilla products (e.g. firefox 2) it is impossible to attach bindings to table sub-elements (rows, cells etc.) you can attach binding only to the table element itself. this has been fixed for future versions of mozilla products. see bug 83830 for more information and for workarounds. default encoding ...
...implied includes cdata #implied > specifies the location where any child elements of the bound element are placed in the generated content. normally, if the element bound to has its own content, the anonymous content is not generated. however, with a children element, you can merge the content from the html/xml element and the xbl content. if the children tag
contains content itself, that content will become the default content. if the element the binding is attached to
contains content, the default content will be ignored. if the element does not contain content, the default content will be added. id - the id attribute is a document-unique identifier. includes - the includes attribute can be used to indicate that only certain content should be placed at t...
...And 3 more matches
Multiple Rules - Archive of obsolete content
the second rule does not contain a where element, so it matches results unconditionally, or any result that wasn'...
...the second rule does not contain a where element, so it matches results unconditionally, or any result that wasn't matched by a previous rule. ...
...an anothermatch only negative values with one rule, positive values with another greatermatch if a number is greater than anotherdisplay values greater than 1000 differently beforematch if a value comes before another alphabetically aftermatch if a value comes after another alphabetically startswithmatch if a value starts with a specific string endswithmatch if a value ends with a specific string
containsmatch if a value
contains a substringto highlight results that contain a search term here is an example using the '
contains' operator: <vbox datasources="people.xml" ref="*" querytype="xml"> <template> <query expr="person"> <assign var="?letters" expr="string-length(@name) - 1"/> </query> <rule> <where subject="?name" rel="
contains" value=" "/> <action> <l...
...And 3 more matches
Mozilla XForms User Interface - Archive of obsolete content
hen it means the control is available when xforms is hosted in either xhtml or xul. similarly, if you see xhtml only or xul only, then it means the control is available only in that host language. attribute sets this section describes attributes that are often used on xforms elements. these attributes are combined into following logical groups. ui common the ui common attribute set (see the spec)
contains the attributes that are available for the xforms elements that are used to build the user interface presentation in a form. appearance - the value provided by the form author gives a hint to the processor as to which widget to use to represent the xforms control. three possible values are available to the author: minimal, compact and full. generally speaking, the main purpose for these values ...
...between controls. accesskey - keyboard shortcut for moving focus to an xforms element. binding attributes single-node (see the spec) and node-set (see the spec) attributes are used to bind xforms elements to instance nodes. these attributes are: ref, nodeset, model and bind. xforms elements almost every xforms element can be presented as one of serveral different kinds of widgets. this section
contains a short description of each xforms element and its representation. the xforms specification offers suggestions for some of the representations, but some of the widgets we use are only available in the mozilla xforms processor. the choice of widget that we use is often determined by the data type of the instance node that the xforms element is bound to. the form author can also influence the widge...
...cation offers suggestions for some of the representations, but some of the widgets we use are only available in the mozilla xforms processor. the choice of widget that we use is often determined by the data type of the instance node that the xforms element is bound to. the form author can also influence the widget by using the appearance attribute on the element. form controls module this section
contains a short description for each form control element. input a key xforms element to show and change the instance data to which it is bound. usually bound to data that can be well-represented by a string (see the spec). it can have the following representations: text field - default representation. used for most data types, especially text data. checkbox - used for boolean instance data datepi...
...And 3 more matches
Client-side storage - Learn web development
alue to your own name, if you wish!): localstorage.setitem('name','chris'); the storage.getitem() method takes one parameter — the name of a data item you want to retrieve — and returns the item's value. now type these lines into your javascript console: let myname = localstorage.getitem('name'); myname upon typing in the second line, you should see that the myname variable now
contains the value of the name data item. the storage.removeitem() method takes one parameter — the name of a data item you want to remove — and removes that item out of web storage. type the following lines into your javascript console: localstorage.removeitem('name'); let myname = localstorage.getitem('name'); myname the third line should now return null — the name item no longer exist...
...'s apply this new-found knowledge by writing a simple working example to give you an idea of how web storage can be used. our example will allow you enter a name, after which the page will update to give you a personalized greeting. this state will also persist across page/browser reloads, because the name is stored in web storage. you can find the example html at personal-greeting.html — this
contains a simple website with a header, content, and footer, and a form for entering your name. let's build up the example, so you can understand how it works. first, make a local copy of our personal-greeting.html file in a new directory on your computer. next, note how our html references a javascript file called index.js (see line 40). we need to create this and write our javascript cod...
... the javascript code we'll go through below has detailed comments to help you understand what's going on. getting started first of all, make local copies of our index.html, style.css, and index-start.js files into a new directory on your local machine. have a look at the files. you'll see that the html is pretty simple: a web site with a header and footer, as well as a main content area that
contains a place to display notes, and a form for entering new notes into the database. the css provides some simple styling to make it clearer what is going on. the javascript file
contains five declared constants containing references to the <ul> element the notes will be displayed in, the title and body <input> elements, the <form> itself, and the <button>. rename your javascript file to index.js. you...
...And 3 more matches
NSS tools : certutil
if this option is not used, the validity check defaults to the current system time. -c issuer identify the certificate of the ca from which a new certificate will derive its authenticity. use the exact nickname or alias of the ca certificate, or use the ca's email address. bracket the issuer string with quotation marks if it
contains spaces. -d [prefix]directory specify the database directory containing the certificate and key database files. certutil supports two types of databases: the legacy security databases (cert8.db, key3.db, and secmod.db) and new sqlite databases (cert9.db, key4.db, and pkcs11.txt). nss recognizes the following pref...
...s operation should be performed by a ca. if no serial number is provided a default serial number is made from the current time. serial numbers are limited to integers. -n nickname specify the nickname of a certificate or key to list, create, add to a database, modify, or validate. bracket the nickname string with quotation marks if it
contains spaces. -o output-file specify the output file name for new certificates or binary certificate requests. bracket the output-file string with quotation marks if it
contains spaces. if this argument is not used the output destination defaults to standard output. -p dbprefix specify the prefix used on the certif...
... -p dbprefix specify the prefix used on the certificate and key database file. this argument is provided to support legacy servers. most applications do not use a database prefix. -p phone specify a contact telephone number to include in new certificates or certificate requests. bracket this string with quotation marks if it
contains spaces. -q pqgfile or curve-name read an alternate pqg value from the specified file when generating dsa key pairs. if this argument is not used,certutil generates its own pqg value. pqg files are created with a separate dsa utility. elliptic curve name is one of the ones from suite b: nistp256, nistp384, nistp521 if nss has been compiled with...
...And 3 more matches
NSS tools : modutil
isms are specified with the -mechanisms argument. arguments module give the security module to access. modulespec give the security module spec to load into the security database. -ciphers cipher-enable-list enable specific ciphers in a module that is being added to the database. the cipher-enable-list is a colon-delimited list of cipher names. enclose this list in quotation marks if it
contains spaces. -dbdir [sql:]directory specify the database directory in which to access or create security module database files. modutil supports two types of databases: the legacy security databases (cert8.db, key3.db, and secmod.db) and new sqlite databases (cert9.db, key4.db, and pkcs11.txt). if the prefix sql: is not used, then the tool assumes that the given databases are in the old forma...
... -libfile library-file specify a path to a library file containing the implementation of the pkcs #11 interface module that is being added to the database. -mechanisms mechanism-list specify the security mechanisms for which a particular module will be flagged as a default provider. the mechanism-list is a colon-delimited list of mechanism names. enclose this list in quotation marks if it
contains spaces. the module becomes a default provider for the listed mechanisms when those mechanisms are enabled. if more than one module claims to be a particular mechanism's default provider, that mechanism's default provider is undefined. modutil supports several mechanisms: rsa, dsa, rc2, rc4, rc5, aes, des, dh, sha1, sha256, sha512, ssl, tls, md5, md2, random (for random number generation), ...
...le [-ciphers cipher-enable-list] [-mechanisms mechanism-list] for example: modutil -dbdir sql:/home/my/sharednssdb -add "example pkcs #11 module" -libfile "/tmp/crypto.so" -mechanisms rsa:dsa:rc2:random using database directory ... module "example pkcs #11 module" added to database. installing a cryptographic module from a jar file pkcs #11 modules can also be loaded using a jar file, which
contains all of the required libraries and an installation script that describes how to install the module. the jar install script is described in more detail in [1]the section called “jar installation file format”. the jar installation script defines the setup information for each platform that the module can be installed on. for example: platforms { linux:5.4.08:x86 { modulename { "example p...
...And 3 more matches
certutil
if this option is not used, the validity check defaults to the current system time. -c issuer identify the certificate of the ca from which a new certificate will derive its authenticity. use the exact nickname or alias of the ca certificate, or use the ca's email address. bracket the issuer string with quotation marks if it
contains spaces. -d [sql:]directory specify the database directory containing the certificate and key database files. certutil supports two types of databases: the legacy security databases (cert8.db, key3.db, and secmod.db) and new sqlite databases (cert9.db, key4.db, and pkcs11.txt). if the prefix sql: is not used, then the tool ass...
...e serial number to a certificate being created. this operation should be performed by a ca. the default serial number is 0 (zero). serial numbers are limited to integers. -n nickname specify the nickname of a certificate or key to list, create, add to a database, modify, or validate. bracket the nickname string with quotation marks if it
contains spaces. -o output-file specify the output file name for new certificates or binary certificate requests. bracket the output-file string with quotation marks if it
contains spaces. if this argument is not used the output destination defaults to standard output. -p dbprefix specify the prefix used on the certificate and key database f...
... specify the prefix used on the certificate and key database file. this option is provided as a special case. changing the names of the certificate and key databases is not recommended. -p phone specify a contact telephone number to include in new certificates or certificate requests. bracket this string with quotation marks if it
contains spaces. -q pqgfile read an alternate pqg value from the specified file when generating dsa key pairs. if this argument is not used, certutil generates its own pqg value. pqg files are created with a separate dsa utility. -q curve-name set the elliptic curve name to use when generating ecc key pairs. a complete list of ecc...
...And 3 more matches
NSS tools : modutil
module give the security module to access. modulespec give the security module spec to load into the security database. -ciphers cipher-enable-list enable specific ciphers in a module that is being added to the database. the cipher-enable-list is a colon-delimited list of cipher names. enclose this list in quotation marks if it
contains spaces. -dbdir [sql:]directory specify the database directory in which to access or create security module database files. modutil supports two types of databases: the legacy security databases (cert8.db, key3.db, and secmod.db) and new sqlite databases (cert9.db, key4.db, and pkcs11.txt). if the prefix sql: is not...
...ile containing the implementation of the pkcs #11 interface module that is being added to the database. -mechanisms mechanism-list specify the security mechanisms for which a particular module will be flagged as a default provider. the mechanism-list is a colon-delimited list of mechanism names. enclose this list in quotation marks if it
contains spaces. the module becomes a default provider for the listed mechanisms when those mechanisms are enabled. if more than one module claims to be a particular mechanism's default provider, that mechanism's default provider is undefined. modutil supports several mechanisms: rsa, dsa, rc2, rc4, rc5, aes, des, dh, sha1, sha256, sha512...
...s cipher-enable-list] [-mechanisms mechanism-list] for example: modutil -dbdir sql:/home/my/sharednssdb -add "example pkcs #11 module" -libfile "/tmp/crypto.so" -mechanisms rsa:dsa:rc2:random using database directory ... module "example pkcs #11 module" added to database. installing a cryptographic module from a jar file pkcs #11 modules can also be loaded using a jar file, which
contains all of the required libraries and an installation script that describes how to install the module. the jar install script is described in more detail in [1]the section called “jar installation file format”. the jar installation script defines the setup information for each platform that the module can be installed on. for example: platforms { linux:5.4.08:x86 { mo...
...And 3 more matches
Rhino Debugger
he debugger provides the following facilities for you to control the execution of scripts you are debugging: step into to single step entering any function calls, you may do any of the following: select the debug->step into menu item on the menu bar press the step into button on the toolbar press the f11 key on the keyboard execution will resume. if the current line in the script
contains a function call control will return to the debugger upon entry into the function. otherwise control will return to the debugger at the next line in the current function. step over to single step to the next line in the current function, you may do any of the following: select the debug->step over menu item on the menu bar press the step over button on the toolbar press the f7 key on...
... selecting debug->break on function enter will give control to the debugger whenever the execution is entered into a function or script. break on function exit selecting debug->break on function return will give control to the debugger whenever the execution is about to return from a function or script. ...
...you may set a breakpoint in a script by doing one of the following: place the cursor on the line at which you want to set a breakpoint and right-click with the mouse. this action will display a pop-up menu. select the set breakpoint menu item. ...
...And 3 more matches
Index
lete, spidermonkey jsobjectops is used by js_newobject's internals to discover the set of high-level object operations to use for new objects of the given class. all native objects have a jsclass, which is stored as a private (int-tagged) pointer in object slots. in contrast, all native and host objects have a jsobjectmap at obj->map, which may be shared among a number of objects, and which
contains the jsobjectops *ops pointer used to dispatch object operations from api calls. 112 jshasinstanceop jsapi reference, reference, référence(2), spidermonkey jshasinstanceop is called to check whether v is an instance of obj. return false on error or exception, true on success with true in *bp if v is an instance of obj, false in *bp otherwise. 113 jsid_empty js...
...is to js_convertarguments as vprintf is to printf. see js_convertarguments for further information. 221 js_convertvalue jsapi reference, obsolete, spidermonkey js_convertvalue converts a javascript value, v, to the specified type. on success, the converted value is stored in *vp. typically users of this function set vp to point to v, so that if conversion is successful, v now
contains the converted value. 222 js_decompilefunction jsapi reference, spidermonkey js_decompilefunction generates the complete source code of a function declaration from a function's compiled form, fun. 223 js_decompilefunctionbody jsapi reference, spidermonkey js_decompilefunctionbody generates the source code of a function's body, minus the function keyword, n...
... zero or more functions and makes them properties (methods) of a specified object, obj, as if by calling js_definefunction repeatedly. 232 js_defineobject jsapi reference, spidermonkey js_defineobject creates a new object of the class clasp and assigns it to a new property of an existing object, obj. name is the property name to assign to obj to hold the new object, and flags
contains the property attributes to set for the newly created property. 233 js_defineownproperty jsapi reference, obsolete, spidermonkey js_defineownproperty implements the ecmascript defined function object.defineproperty. so the same restrictions apply as for that function (e.g. it is not possible to change a non-configurable property). 234 js_defineproperties jsapi r...
...And 3 more matches
Bytecode Descriptions
nd can exit only by executing a jsop::enditer or by exception unwinding. (a jsop::enditer is always emitted at the end of the loop, and extra copies are emitted on "exit slides", where a break, continue, or return statement exits the loop.) typically a single try note entry marks the contiguous chunk of bytecode from the instruction after jsop::iter to jsop::enditer (inclusive); but if that range
contains any instructions on exit slides, after a jsop::enditer, then those must be correctly noted as outside the loop. format: jof_ic moreiter stack: iter ⇒ iter, name get the next property name for a for-in loop. iter must be a propertyiteratorobject produced by jsop::iter. this pushes the property name for the next loop iteration, or magicvalue(js_no_iter_value) if there are no more enumerable p...
...ement is defined, but the array length and the stack value index are still incremented. this never calls setters or proxy traps. array must be an array object created by jsop::newarray and never used except by jsop::initelemarray and jsop::initeleminc. index must be an integer, 0 <= index <= int32_max. if index is int32_max, this throws a rangeerror. this instruction is used when an array literal
contains a spreadelement. in [a, ...b, c], initelemarray 0 is used to put a into the array, but initeleminc is used for the elements of b and for c. implements: several steps in arrayaccumulation that call createdataproperty, set the array length, and/or increment nextindex. format: jof_elem, jof_propinit, jof_ic hole stack: ⇒ hole push magicvalue(js_elements_hole), representing an elision in an arra...
... the implicit this value for an unqualified function call, like foo(). nameindex gives the name of the function we're calling. the result is always undefined except when the name refers to a with binding. for example, in with (date) { getfullyear(); }, the implicit this passed to getfullyear is date, not undefined. this walks the run-time environment chain looking for the environment record that
contains the function. if the function call is not inside a with statement, use jsop::gimplicitthis instead. if the function call definitely refers to a local binding, use jsop::undefined. implements: evaluatecall step 1.b. but not entirely correctly. see bug 1166408. format: jof_atom gimplicitthis operands: (uint32_t nameindex) stack: ⇒ this like jsop::implicitthis, but the name must not be bound in...
...And 3 more matches
Garbage collection
ry compartment belongs to exactly one zone every js heap object belongs to exactly one zone. objects from the same zone but different compartments can share an arena. objects from different zones cannot be stored in the same arena. a zone remains alive as long as any js heap objects in the zone are alive. chunk a chunk is the largest internal unit of memory allocation. a chunk is 1mb and
contains arenas, padding, the mark bitmap (chunkbitmap), a bitmap of decommitted arenas, and a chunk header (chunkinfo). the chunkinfo
contains a list of unallocated arenas, starting at chunkinfo::freearenashead and linked through arenaheader::next. the chunkinfo also
contains some basic stats, such as the number of free arenas. arena an arena is an internal unit of memory allocation. an arena is one ...
...all elements in an arena have the same allocation kind and size. every arena maintains a list of free spans, starting at arenaheader::firstfreespanoffets. ...
...then an array of aligned elements. all elements in an arena have the same allocation kind and size. every arena maintains a list of free spans, starting at arenaheader::firstfreespanoffets. the last cell in each free span (except the last one) holds a freespan for the next free span. free span struct freespan represents a contiguous sequence of free cells [first,last] within an arena. freespan
contains functions to allocate from the free span. mark bitmap the mark bitmap is represented by chunkbitmap. the mark bitmap has two bits per gc cell, so that it can represent both regular liveness marking ("marked black") as well as reachability from cycle-collected objects ("marked gray"). mark bits are allocated based on the minimum cell size, thus an object comprised of larger cells consumes multi...
...And 3 more matches
SpiderMonkey Internals
this document is talking about partially obsolete things. design walk-through at heart, spidermonkey is a fast interpreter that runs an untyped bytecode and operates on values of type js::value—type-tagged values that represent the full range of javascript values. in addition to the interpreter, spidermonkey
contains a just-in-time (jit) compiler, a garbage collector, code implementing the basic behavior of javascript values, a standard library implementing ecma 262-5.1 §15 with various extensions, and a few public apis. interpreter like many portable interpreters, spidermonkey's interpreter is mainly a single, tremendously long function that steps through the bytecode one instruction at a time, using a switch statement (or faster alternative, depending on the compiler) to jump to the ap...
...ause from firefox users). all state associated with an interpreter instance is passed through formal parameters to the interpreter entry point; most implicit state is collected in a type named jscontext. therefore, almost all functions in spidermonkey, api or not, take a jscontext pointer as their first argument. compiler the compiler consumes javascript source code and produces a script which
contains bytecode, source annotations, and a pool of string, number, and identifier literals. the script also
contains objects, including any functions defined in the source code, each of which has its own, nested script. the compiler consists of: a random-logic rather than table-driven lexical scanner, a recursive-descent parser that produces an ast, and a tree-walking code generator. semantic and lexic...
...alled the jsapi, is in most places a thin (but source-compatible across versions) layer over the implementation. see the jsapi user guide. there is an additional public api for javascript debuggers, jsdbgapi, but js/jsd/jsdebug.h might be a better api for debuggers. another api, jsxdrapi, provides serialization for javascript scripts. (xul fastload uses this.) just-in-time compiler spidermonkey
contains a baseline compiler as first tier. a second tier jit, code-named ionmonkey was enabled in firefox 18. ionmonkey is an optimizing compiler. self-hosting of built-in functions in js starting with firefox 17, spidermonkey has the ability to implement built-in functions in self-hosted js code. this code is compiled in a special compilation mode that gives it access to functionality that's not norma...
...And 3 more matches
JIT Optimization Strategies
note: this page is an in-progress documentation of jit optimization strategies planned to support the "jit coach" feature intended for inclusion in firefox developer tools. this page has two intended uses: 1. provide a repository of jit optimization strategy information which the jit coach tool can parse to display in its ui. 2. provide a user-browsable documentation of optimization strategies, how they work, how they are defeated, and options for how to re-enable them. spidermonkey's optimizing jit, ionmonkey, uses various strategies to optimize operations. ...
...ays without disabling this optimization: access arguments.length access arguments.callee access individual args using arguments[i] save arguments into variables, as long as those variables cannot be accessed by any nested function, and as long as there exists no eval anywhere within the function or nested function definitions. call a function using f.apply(obj, arguments) if the function
contains any use of the arguments object that falls out of the cases defined above, this optimization will be suppressed. in particular, arguments cannot be returned from the function, or passed as an argument into calls (except for the apply case above). getprop_argumentscallee attempts to optimize an arguments.callee property access. this optimization only works if the arguments object is used in well...
...ays without disabling this optimization: access arguments.length access arguments.callee access individual args using arguments[i] save arguments into variables, as long as those variables cannot be accessed by any nested function, and as long as there exists no eval anywhere within the function or nested function definitions. call a function using f.apply(obj, arguments) if the function
contains any use of the arguments object that falls out of the cases defined above, this optimization will be suppressed. in particular, arguments cannot be returned from the function, or passed as an argument into calls (except for the apply example listed above). getprop_inferredconstant attempts to optimize an access to a property that seems to be a constant. it applies to property accesses on object...
...And 3 more matches
nsIAccessibleRole
pported for caret. role_alert 8 represents an alert or a condition that a user should be notified about. assistive technologies typically respond to the role by reading the entire on screen contents of containers advertising this role. should be used for warning dialogs, etc. the role is used by xul:browsermessage, role="alert", xforms:message. role_window 9 represents the window frame, which
contains child objects such as a title bar, client, and other objects contained in a window. the role is supported automatically by ms windows. role_internal_frame 10 a sub-document or iframe. role_menupopup 11 represents a menu, which presents a list of options from which the user can make a selection to perform an action. it is used for role="menu". role_menuitem 12 represents a menu item, which i...
...used for the first child of a or iframe. role_chart 17 represents a graphical image used to represent data. role_dialog 18 represents a dialog box or message box. it is used for xul:dialog, role="dialog". role_border 19 represents a window border. role_grouping 20 logically groups other objects. there is not always a parent-child relationship between the grouping object and the objects it
contains. it is used for html:textfield, xul:groupbox, role="group". role_separator 21 used to visually divide a space into two regions, such as a separator menu item or a bar that divides split panes within a window. it is used for xul:separator, html:hr, role="separator". role_toolbar 22 represents a toolbar, which is a grouping of controls (push buttons or toggle buttons) that provides easy access ...
...used features. it is used for xul:toolbar, role="toolbar". role_statusbar 23 represents a status bar, which is an area at the bottom of a window that displays information about the current operation, state of the application, or selected object. the status bar has multiple fields, which display different kinds of information. it is used for xul:statusbar. role_table 24 represents a table that
contains rows and columns of cells, and optionally, row headers and column headers. it is used for html:table, role="grid". also refer to the following roles: role_columnheader, role_rowheader, role_column, role_row, role_cell. role_columnheader 25 represents a column header, providing a visual label for a column in a table. it is used for xul tree column headers, html:th, role="colheader". also refer t...
...And 3 more matches
DevTools API - Firefox Developer Tools
he devtools api provides a way to register and access developer tools in firefox. in terms of user interface, each registered tool lives in its own tab (we call one tab a panel). these tabs are located in a box we call a toolbox. a toolbox can be hosted within a browser tab (at the bottom or on the side), or in its own window (we say that the toolbox is undocked). a toolbox (and all the tools it
contains) is linked to a target, which is the object the tools are debugging. a target is usually a web page (a tab), but can be other things (a chrome window, a remote tab,…). in terms of code, each tool has to provide a tooldefinition object. a definition is a js light object that exposes different information about the tool (like its name and its icon), and a build method that will be used later-on ...
... tools, themes and handle toolboxes for different tabs and windows. to use the gdevtools api from an add-on, it can be imported with following snippet const { gdevtools } = require("resource:///modules/devtools/gdevtools.jsm"); methods registertool(tooldefinition) registers a new tool and adds a tab to each existing toolbox. ...
... unregistertheme(theme) unregisters the given theme. parameters: theme {themedefinition|string} - the theme definition object or the theme identifier. showtoolbox(target [, toolid [, hosttype [, hostoptions]]]) opens a toolbox for given target either by creating a new one or activating an existing one. ...
...And 3 more matches
CSSCounterStyleRule - Web APIs
2px" /><text x="211" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">csscounterstylerule</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent cssrule. ...
...baseline="middle">csscounterstylerule</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits properties from its parent cssrule. csscounterstylerule.name is a domstring object that
contains the serialization of the <counter-style-name> defined for the associated rule. csscounterstylerule.system is a domstring object that
contains the serialization of the system descriptor defined for the associated rule. if the descriptor was not specified in the associated rule, the attribute returns an empty string. csscounterstylerule.symbols is a domstring object that
contains the serialization of the symbols descriptor defined for the associated rule. if the descriptor was not specified in the associated rule, the attribute returns...
... descriptor was not specified in the associated rule, the attribute returns an empty string. csscounterstylerule.symbols is a domstring object that
contains the serialization of the symbols descriptor defined for the associated rule. if the descriptor was not specified in the associated rule, the attribute returns an empty string. csscounterstylerule.additivesymbols is a domstring object that
contains the serialization of the additive-symbols descriptor defined for the associated rule. if the descriptor was not specified in the associated rule, the attribute returns an empty string. csscounterstylerule.negative is a domstring object that
contains the serialization of the negative descriptor defined for the associated rule. if the descriptor was not specified in the associated rule, the attri...
...And 3 more matches
Content categories - Developer guides
<h4>, <h5>, <h6> and <hgroup>. though likely to contain heading content, the <header> is not heading content itself. note: the <hgroup> element was removed from the w3c html specification prior to html 5 being finalized, but is still part of the whatwg specification and is at least partially supported by most browsers. phrasing content phrasing content defines the text and the mark-up it
contains. runs of phrasing content make up paragraphs. elements belonging to this category are <abbr>, <audio>, <b>, <bdo>, <br>, <button>, <canvas>, <cite>, <code>, <command>, <data>, <datalist>, <dfn>, <em>, <embed>, <i>, <iframe>, <img>, <input>, <kbd>, <keygen>, <label>, <mark>, <math>, <meter>, <noscript>, <object>, <output>, <picture>, <progress>, <q>, <ruby>, <samp>, <script>, <select>, <small>,...
...ygen>, <label>, <mark>, <math>, <meter>, <noscript>, <object>, <output>, <picture>, <progress>, <q>, <ruby>, <samp>, <script>, <select>, <small>, <span>, <strong>, <sub>, <sup>, <svg>, <textarea>, <time>, <var>, <video>, <wbr> and plain text (not only consisting of white spaces characters). ...
... <q>, <ruby>, <samp>, <script>, <select>, <small>, <span>, <strong>, <sub>, <sup>, <svg>, <textarea>, <time>, <var>, <video>, <wbr> and plain text (not only consisting of white spaces characters). a few other elements belong to this category, but only if a specific condition is fulfilled: <a>, if it
contains only phrasing content <area>, if it is a descendant of a <map> element <del>, if it
contains only phrasing content <ins>, if it
contains only phrasing content <link>, if the itemprop attribute is present <map>, if it
contains only phrasing content <meta>, if the itemprop attribute is present embedded content embedded content imports another resource or inserts content from another mark-up language or namespace into the document. elements that belong to this category include: <audi...
...And 3 more matches
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
iption> <em:creator>allpeers.com</em:creator> <em:homepageurl>http://www.allpeers.com/blog/</em:homepageurl> </description> </rdf> there's a detailed description of the format of the install.rdf file. use the dist_files variable in the makefile to tell make to copy the file into the extension directory and (optional) xpi file. public interfaces the public/ directory
contains any interfaces that need to be accessed by other modules. these can be idl files describing xpcom interfaces, which are used to generate normal c++ header files for inclusion in your source files. they can also be normal c++ header files that are to be used directly by other modules. the easiest way to accomplish the latter is to use inline implementations for all methods so you don't have any ad...
...if you have multiple modules, make absolutely sure that you use a different value for xpidl_module for each one. otherwise the first module's xpt file will be overwritten by the second and you'll get ns_error_xpc_bad_iid errors when you try to access its idl interfaces from your code. the files under exports are copied directly to the /mozilla/$(moz_obj...
... now it's time to create the makefile and source files in the src/ subdirectory. if you're implementing interfaces that you've described using idl, the easiest way to do this is to leave the src/ directory empty and run make on the public/ directory only; this will be explained shortly. then open the generated header file for your interface from /mozilla/$(moz_objdir)/dist/include/. it
contains stubs for the component .h and .cpp files that you can copy and paste into your implementation files. all you have to do is fill in the implementation stubs in the c++ file and you're good to go. here's an example of the makefile you need to place into your src directory: depth = ../../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ vpath = @srcdir@ include $(depth)/config...
...And 2 more matches
Enhanced Extension Installation - Archive of obsolete content
tasource - new items are installed, old items uninstalled, enabled or disabled, a .autoreg file is written to the profile directory as well, which tells the startup code that the system has been modified, so that it destroys the component registries, finishes pending transactions and regenerates metadata appropriately. datasource structure the extension manager implements a rdf datasource which
contains a composite of the two xml/rdf datasources at the two install locations. the composite datasource handles all read-only information requests, and when data must be written the extension manager determines the appropriate datasource to write and flush to. the model looks something like this: nsextensionsdatasource.prototype = { _composite // the composite that manages the two...
...t in one or other of the two containers. in situations where an item is not yet a member of one of the containers, type is inelegantly determined by checking for presence of a theme-only property on the item's install manifest rdf file. installation initiation when an item is installed from the web, xpinstall is invoked and it calls into the extension system when it discovers that the xpi file
contains an install.rdf manifest. the extension manager extracts that file and checks to see if the item is compatible with the running version of the application. if it is, a small set of metadata about it is written to the appropriate datasource (name, version, a flag to tell the system to properly install it on the next startup), and it is added to the appropriate type container. the system also writes...
...eralized the concept of an install location, we can make this set configurable by applications and extensions. to this end, we scan the category extension-install-locations as the extension system is started (after profile initialization) and add these to our internal set. extension metadata the following files are now used to hold metadata: <profile>/extensions.ini -active items this file
contains a list of active extension directories (i.e. directories to extensions that are enabled only), to be used by the xredirprovider during startup to locate components, preferences and chrome manifests. the format here is similar to firefox 1.0 except there is no longer a count value that needs to be kept in sync with the number of lines... the file is written simply as extension#=<absolute path to i...
...And 2 more matches
MMgc - Archive of obsolete content
calling gc::alloc. unmanaged memory is everything else. this is c++ memory management as you're accustomed to it. memory can be allocated with the new operator, and must be explicitly deleted in your c++ code at some later time using the delete operator. another way to think about it: unmanaged memory is c++ operators new and delete managed memory is c++ operator new, with optional delete mmgc
contains a page allocator called gcheap, which allocates large blocks (megabytes) of memory from the system and doles out 4kb pages to the unmanaged memory allocator (fixedmalloc) and the managed memory allocator (gc). mmgc namespace the mmgc library is in the c++ namespace mmgc. you can qualify references to classes in the library; for example: mmgc::gc, mmgc::gcfinalizedobject. alternately, you can open...
...although it can be freed with free if it is known that there are no other references to it. alloc is often used to allocate arrays and other objects of variable size that contain gc pointers or are otherwise desirable to have in managed memory. these flags may be passed to alloc to control the allocation type. /** * flags to be passed as second argument to alloc */ enum allocflags { kzero=1, k
containspointers=2, kfinalize=4, krcobject=8 }; kzero zeros out the memory. otherwise, the memory
contains undefined values. k
containspointers indicates to the gc that the memory will contain pointers to other gc objects, and thus needs to be scanned by the gc's mark phase. if you know for certain that the objects will not contain gc pointers, leave this flag off; it will make the mark phase faster b...
... pointer to a gcobject from an object in unmanaged memory, the unmanaged object must be a subclass of gcroot. gcroot must be subclassed by any unmanaged memory class that holds gc pointers. class mygcobject : public mmgc::gcobject { ... }; class mygcroot : public mmgc::gcroot { mygcobject* mygcobject; }; note that a gcroot is not a garbage-collected object. it is an unmanaged memory object that
contains gc pointers. mmgc keeps a list of all gcroots in the system and makes sure that it marks them. gcroots are generally expected to be allocated using mmgc's unmanaged memory allocators, so that mmgc can figure out how big the gcroot object is. use of gcroot is required to have gc pointers from unmanaged memory, since without gcroot, those pointers won't be marked by the mark phase of the gc. note t...
...And 2 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
hite spaces, even though that is against the w3c specification. the browser will not parse a   if it is directly followed by more characters, for example:  12345 this code does not work in mozilla, since it goes against the w3c web standards. always use the correct form ( ) to avoid browser discrepancies. dom differences the document object model (dom) is the tree structure that
contains the document elements. you can manipulate it through javascript apis, which the w3c has standardized. however, prior to w3c standardization, netscape 4 and internet explorer 4 implemented the apis similarly. mozilla only implements legacy apis if they are unachievable with w3c web standards. accessing elements to retrieve an element reference using the cross-browser approach, you use document.g...
...ow has finished. you can deal with this by having an onload handler in the new window and then call back into the opener window (using window.opener). differences in javascript-generating html javascript can, through document.write, generate html on the fly from a string. the main issue here is when javascript, embedded inside an html document (thus, inside an <script> tag), generates html that
contains a <script> tag. if the document is in strict rendering mode, it will parse the </script> inside the string as the closing tag for the enclosing <script>. the following code illustrates this best: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> ... <script> document.write("<script type='text/javascript'>alert('hello');</...
...quest. how to handle xml as with standard html, mozilla supports the w3c xml dom specification, which allows you to manipulate almost any aspect of an xml document. differences between internet explorer's xml dom and mozilla are usually caused by internet explorer's nonstandard behaviors. probably the most common difference is how they handle white space text nodes. often when xml generates, it
contains white spaces between xml nodes. internet explorer, when using node.childnodes, will 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 li...
...And 2 more matches
Complete - Archive of obsolete content
it implements languages and themes. overall structure this extension's internal name is allcustom. it uses this name as the default file name throughout. where you see a url in the code with no file name, the application uses this default file name and an extension appropriate for the type of file expected. the extension is supplied as a xpi, which is compressed to reduce download times. the xpi
contains: install.rdf information about the extension chrome.manifest registration data for firefox etc. install.js installation script for seamonkey chrome directory containing the extension code chrome/allcustom.jar the extension jar defaults/preferences directory containing...
...allcustom. you can see the registration details in chrome.manifest (firefox, etc.) or in installed-chrome.txt and chrome.rdf (seamonkey). when the xul file, allcustom.xul is loaded, the doctype declaration near the top loads a dtd from chrome://allcustom/locale/. the application's chrome registry converts this url to the correct dtd file for the locale you are using. the xul toolbarbutton tag
contains an entity &allcustom.alert.1;. the dtd resolves this into a text string in the appropriate language. when you press the button, the code in the xul element sends the text string to the extension's javascript code in allcustom.js. the extension's javascript code displays the text. file structure in the new file structure, there is a locale directory for all the locales. each locale has its own ...
...plays the text. file structure in the new file structure, there is a locale directory for all the locales. each locale has its own directory there. in each locale's directory, there is an allcustom directory. this is useful when files from various components and extensions and all unpacked in the same place—it keeps each set of files separate. in the allcustom directory, the file allcustom.dtd
contains the translated strings. the file contents.rdf
contains registration data used by seamonkey. localizing the description firefox etc. display a description of the extension in the extensions window. the description in install.rdf is the default. for each supported locale, a description in install.properties overrides the default. a preference setting in defaults/preferences/allcustom.js makes the c...
...And 2 more matches
NPAPI plugin reference - Archive of obsolete content
nted by the browser and called by the plug-in. np_getmimedescription np_getmimedescription returns a supported mime type list for your plugin. it works on unix (linux) and macos. on windows you have to define supported mimetypes in the dll resource file. np_getvalue allows the browser to query the plug-in for information. np_initialize provides global initialization for a plug-in. np_port
contains information required by the window field of an npwindow structure. np_shutdown provides global deinitialization for a plug-in. npanycallbackstruct
contains information required during embedded mode printing. npapi plug-in side api this chapter describes methods in the plug-in api that are available from the plug-in object; these allow plug-ins to interact with the browser. the names of all ...
...rowser. the names of all of these methods begin with npp_ to indicate that they are implemented by the plug-in and called by the browser. npbyterange represents a particular range of bytes from a stream. npclass npclass is a structure that holds a set of pointers to functions that make up the behavior of an instance of an npclass (i.e. an npobject). npembedprint substructure of npprint that
contains platform-specific information used during embedded mode printing. npevent represents an event passed by npp_handleevent() to a windowless plug-in. npfullprint substructure of npprint that
contains platform-specific information used during full-page mode printing. npidentifier npidentifier is an opaque type used for method and property identifiers, such as strings or integers. npidentifiers ...
...sized, or destroyed. npp_streamasfile provides a local file name for the data from a stream. npp_urlnotify notifies the plug-in instance of the completion of a url request. npp_write delivers data to a plug-in instance. (remark: hence the name "npp_write" is misleading - just think of:"data_arrived") npp_writeready determines maximum number of bytes that the plug-in can consume. npprint
contains information the plug-in needs to print itself in full-page or embedded mode. npprintcallbackstruct
contains information required by the platformprint field of the npembedprint structure during embedded mode printing on unix systems. nppvariable see npn_setvalue. nprect represents a rectangular area of a plug-in's content area. npregion represents a platform-defined region of a page. npsa...
...And 2 more matches
Examples - Archive of obsolete content
please refer to the article to learn more about these examples. if you wish to test these examples by yourself, please read the important notes. important notes if you plan to test these examples by yourself, you must use the right filename extension (it is written at the beginning of the code). ideally, upload the file to a web server and you're done. please note that the examples 4, 5 and 6 require a file named style.css to exist in the same directory as the example. you can get the contents of style.css at the bottom of this page. ...
...: blue; color: yellow; } --> </style> <script type="text/javascript"> <!-- var i = 0; var sum = 0; for (i = 0; i < 10; ++i) { sum += i; } alert('sum = ' + sum); // --> </script> </head> <body> <h1>problem 2 - comments in xhtml</h1> <p> this document is valid xhtml 1.0 strict served as <code>application/xhtml+xml</code>. </p> <p> this document
contains inline css rules contained in a <code>style</code> element and surrounded by a comment and javascript contained in a <code>script</code> element and surrounded by a comment. </p> <dl> <dt>mozilla 1.1+/opera 7</dt> <dd>do not apply css or execute the javascript.</dd> <dt>netscape 7.0x/mozilla 1.0.x</dt> <dd>do not apply css but does execute the javascript.</dd> <dt>internet ex...
...text/html; charset=iso-8859-1" /> <style type="text/css"> <!-- body { padding-top: 8em; } html { color: #fff; background: #000 no-repeat fixed;} p {width: 30em; font-weight: bold;} --> </style> </head> <body> <h1>example 1 - xhtml 1.0 strict as text/html</h1> <p> this document is valid xhtml 1.0 strict served as <code>text/html</code>. </p> <p> this document
contains inline css rules contained in a <code>style</code> element and surrounded by a sgml comment. </p> <p> note how the css rules for the background are applied in netscape 7.x, mozilla, opera 7 and internet explorer 5.5+. </p> <p> <a href="http://validator.w3.org/check/referer"><img src="https://udn.realityripple.com/samples/8a/9e64asf935.png" alt="valid xhtml 1.0!
...And 2 more matches
Creating hyperlinks - Learn web development
documents, video and audio files, or anything else that lives on the web. if the web browser doesn't know how to display or handle the file, it will ask you if you want to open the file (in which case the duty of opening or handling the file is passed to a suitable native app on the device) or download the file (in which case you can try to deal with it later on). ...
...page
contains a many links that point not only to multiple news stories, but also different areas of the site (navigation functionality), login/registration pages (user tools), and more. anatomy of a link a basic link is created by wrapping the text or other content, see block level links, inside an <a> element and using the href attribute, also known as a hypertext reference, or target, that
contains the web address. <p>i'm creating a link to <a href="https://www.mozilla.org/">the mozilla homepage</a>. </p> this gives us the following result: i'm creating a link to the mozilla homepage. adding supporting information with the title attribute another attribute you may want to add to your links is title. ...
... <p>i'm creating a link to <a href="https://www.mozilla.org/" title="the best place to find more information about mozilla's mission and how to contribute">the mozilla homepage</a>. ...
...And 2 more matches
Document and website structure - Learn web development
your website will just lead to confused, frustrated users. many web designers consider the navigation bar to be part of the header rather than an individual component, but that's not a requirement; in fact, some also argue that having the two separate is better for accessibility, as screen readers can read the two features better if they are separate. main content: a big area in the center that
contains most of the unique content of a given webpage, for example, the video you want to watch, or the main story you're reading, or the map you want to view, or the news headlines, etc. this is the one part of the website that definitely will vary from page to page! sidebar: some peripheral info, links, quotes, ads, etc. usually, this is contextual to what is contained in the main content (for exampl...
...ebar: some peripheral info, links, quotes, ads, etc. usually, this is contextual to what is contained in the main content (for example on a news article page, the sidebar might contain the author's bio, or links to related articles) but there are also cases where you'll find some recurring elements like a secondary navigation system. footer: a strip across the bottom of the page that generally
contains fine print, copyright notices, or contact info. it's a place to put common information (like the header) but usually, that information is not critical or secondary to the website itself. the footer is also sometimes used for seo purposes, by providing links for quick access to popular content. a "typical website" could be structured something like this: html for structuring content the simp...
...href="#">projects</a></li> <li><a href="#">contact</a></li> </ul> <!-- a search form is another commmon non-linear way to navigate through a website. --> <form> <input type="search" name="q" placeholder="search query"> <input type="submit" value="go!"> </form> </nav> <!-- here is our page's main content --> <main> <!-- it
contains an article --> <article> <h2>article heading</h2> <p>lorem ipsum dolor sit amet, consectetur adipisicing elit. donec a diam lectus. set sit amet ipsum mauris. maecenas congue ligula as quam viverra nec consectetur ant hendrerit. donec et mollis dolor. praesent et diam eget libero egestas mattis sit amet vitae augue. nam tincidunt congue enim, ut porta lorem lacinia consecte...
...And 2 more matches
Test your skills: Conditionals - Learn web development
e the assessment or further help section at the bottom of this page. note: in the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's javascript console, in the case of the downloadable version). conditionals 1 in this task you are provided with two variables: season —
contains a string that says what the current season is. response — begins uninitialized, but is later used to store a reponse that will be printed to the output panel. we want you to create a conditional that checks whether season
contains the string "summer", and if so assigns a string to response that gives the user an appropriate message about the season. if not, it should assign a generic string ...
... to the output panel. we want you to create a conditional that checks whether season
contains the string "summer", and if so assigns a string to response that gives the user an appropriate message about the season. if not, it should assign a generic string to response that tells the user we don't know what season it is. to finish off, you should then add another test that checks whether season
contains the string "winter", and again assigns an appropriate string to response. try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. ...
...this score is fed into the answer machine, which provides a response to indicate how well you did. ...
...And 2 more matches
Getting started with Svelte - Learn web development
you don't need to understand this file at all to complete this tutorial, however, if you'd like to learn more about it, you can read what is the file package.json? on nodejs.org; we also talk about it in our package management basics tutorial. node_modules: this is where node saves the project dependencies. these dependenc...
...ses. .gitignore: tells git which files or folder to ignore from the project — useful if you decide to include your app in a git repo. rollup.config.js: svelte uses rollup.js as a module bundler. this configuration file tells rollup how to compile and build your app. if you prefer webpack you can create your starter project with npx degit sveltejs/template-webpack svelte-app instead. scripts:
contains setup scripts as required. currently should only contain setuptypescript.js, a script that sets up typescript support in svelte. we'll talk about this more in the last article. src: this directory is where the source code for your application lives — where you'll be creating the code for your app. app.svelte: this is the top-level component of your app. so far it just renders the 'hello ...
.... src: this directory is where the source code for your application lives — where you'll be creating the code for your app. app.svelte: this is the top-level component of your app. so far it just renders the 'hello world!' message. main.js: the entry point to our application. it just instantiates the app component and binds it to the body of our html page. public: this directory
contains all the files that will be published in production. favicon.png: this is the favicon for your app. currently, it's the svelte logo. index.html: this is the main page of your app. initially it's just an empty html5 page that loads the css files and js bundles generated by svelte. global.css: this file
contains unscoped styles. it's a regular css file that will be applied to the whole a...
...And 2 more matches
Accessibility API cross-reference
e, or site. article <article> <part> or <art> object representing entire app. aria role denotes interactive (not browsable) content operable in ways that differ from any of the other interactive aria roles, and may be only a part of the main document. application frame n/a application see <div> and <nonstruct> a region that
contains mostly site-oriented content, rather than page-specific content. banner a portion of quoted content which is 'too long' to appear 'inline' n/a blockquote <blockquote> entire window border as 1 object border n/a n/a n/a specific kind of button that drops down a list of items, msaa onl...
...n content at a similar level in the dom hierarchy, but remains meaningful when separated from the main content. complementary <aside> n/a but <div> or even <p> have been suggested for this purpose a widget that may contain navigable descendants or owned children. composite (abstract role) a large perceivable region that
contains information about the parent document such as copyright, authors' names etc. contentinfo <footer> page footers are often tagged as an artifact (not "real" content) with the 'contentinfo' provided as document level xmp metadata instead the mouse pointer - when and how is this used? cursor n/a n/a n/a a definition of a term ...
... document a drop down list, different from combobox droplist n/a n/a listbox for math & chemistry equation n/a n/a math a scrollable list of articles where scrolling may cause articles to be added to or removed from either end of the list. feed a landmark region that
contains a collection of items and objects that, as a whole, combine to create a form. form <form> presumably msaa's graphic is aria's and html's img? graphic n/a n/a img <img> a cell in a grid or treegrid. grid a composite widget containing a collection of one or more rows with one or more c...
...And 2 more matches
Gecko info for Windows accessibility vendors
subset of readonly methods in the dom needed for assistive technology vendors. events such as focus changes must be tracked through msaa events, rather than dom events. xul: extensible user-interface language the xml-based language used by firefox and mozilla to develop the ui. similar to html in that it can be combined with css and javascript to make powerful applications.
contains more desktop-style widgets than html and follows a box layout model, rather than being text-flow based. ajax: asynchronous javascript and xml ajax is a method of building interactive web applications that process user requests, user actions immediately in real time, unlike an http request, during which users must wait for a whole page to reload or for a new page to load. dat...
...ultra-fast and more advanced (fully configurable) gecko-based web browser available on the windows platform xul-based clients (support msaa) xul-based clients make full use of the gecko architecture, not only for html content, as well as for menus, dialogs and the entire user interface via an xml language called xul (extensible user-interface language). none of the user interface
contains standard windows controls -- not even the menus! this is done to ensure a common look and feel across all supported platforms, and to allow for different skins (appearances). firefox (please use version 1.1 alpha builds or later) thunderbird (please use version 1.1 alpha builds or later) mozilla seamonkey (please use 1.8 alpha builds or later) how to find the conte...
...the field does not currently have a legal value const unsigned long state_??? = state_alert_medium; // reserved for future use. document structure exposed in msaa tree bstr roles are used for important roles that have not been defined by microsoft. when the role is retrieved in a variant returned from get_accrole, check to see if variant.vt == vt_bstr. if it is, than variant.bstrval
contains the role string. the role string may be an html tag name followed by comma, space and the namespace of the current element. in most current cases the namespace can be ignored, but it may become important in the future. the following html tags are exposed as bstr's: abbr, acronym, blockquote, dd, dl, dt, form, frame, h1, h2, h3, h4, h5, h6, iframe, q, tbody, tfoot, thead in addition, ...
...And 2 more matches
Multiprocess on Windows
are registered; register any outparams that consist of arrays of interfaces. we will now further detail each of these items: generating typelibs for all com interfaces you first need to include a library statement in your idl. when midl processes your idl, it generates c code for building a proxy dll, containing the oicf metadata. it also will output a file with the .tlb extension. this file
contains the typelib metadata. both metadata types must be shipped with firefox. the oicf metadata is shipped via the proxy dll. to include the typelib metadata, embed it in the proxy dll's resources. both types of metadata are then made available from within the same dll. this is achieved by specifying rcinclude in the dll's moz.build, and then specifying the resources in an .rc file. you should always e...
...ray of arraydata structs. you should statically define this array in your code, as const. for example: static const mozilla::mscom::arraydata kmyarraydata[] { { // first arraydata definition }, { // second arraydata definition } }; mozilla::mscom::registerarraydata(kmyarraydata); each arraydata struct corresponds to one function; with length_is and/or size_is annotations. if your interface
contains two functions with those annotations, then you will need to add two arraydata entries. arraydata
contains seven fields: iid miid; ulong mmethodindex; ulong marrayparamindex; vartype marrayparamtype; iid marrayparamiid; ulong mlengthparamindex; flag mflag; miid is the uuid of the interface owning the function. mmethodindex is the vtable index of the function within its inte...
...n. mmethodindex is the vtable index of the function within its interface. this index must take into account the vtable(s) of parent interfaces. for example, if interface ifoo inherits from iunknown, the lowest possible mmethodindex for ifoo could be 3, because indices 0, 1, and 2 are occupied by the functions that ifoo inherited from iunknown. marrayparamindex is the index of the parameter that
contains the array (excluding the this pointer). marrayparamtype is the expected variant type of the outparam. this should usually be set to vt_unknown | vt_byref, which is telling the interceptor that the outparam is an iunknown**. marrayparamiid is the uuid of the interface that the outparam array uses. this should be the iid that we want the interceptor to actually use when wrapping the array element...
...And 2 more matches
How Mozilla's build system works
who have worked with autoconf before. however, mozilla's config.status is different from many other config.status files, as it's written in python! instead of our configure script producing a shell script, it generates a python script. python 2 is prevalent in a mozilla build system. if we need to write code for the build system, we do it in python 2 instead of editing a makefile. config.status
contains 2 parts: data structures representing the output of configure and a command-line interface for preparing, configuring, or generating an appropriate build backend. a build backend is merely a tool used to build the tree — like gnu make or tup. these data structures describe the current state of the system and what the existing build configuration looks like. for example, a data structure d...
...). the most important actions of moz.build files are #1 and #2 from the above list. these are how the execution of a moz.build file tells the build system what to do. for example, you can assign to the dirs list to define which directories to traverse into looking for additional moz.build files. the output of the execution of an individual moz.build file is a python dictionary. this dictionary
contains the uppercase variables directly assigned to and the special variables indirectly assigned to by calling functions exported to the execution environment. this is what we were referring to when we said you can think of moz.build files as data structures. moz.build uppercase variables and functions the set of special symbols available to moz.build files is centrally defined and is under the purvi...
...ntext.py. how moz.build processing works for most developers, knowing that moz.build files are python scripts that are executed and emit python dictionaries describing the build configuration is enough. if you insist on knowing more, this section is for you. all the code for reading moz.build files lives under /python/mozbuild/mozbuild/frontend/. ...
...And 2 more matches
Investigating leaks using DMD heap scan mode
ss of the leaking object, usually a window. conveniently, you can usually do both at once using the cycle collector log. if you are investigating a leak of www.example.com, then from $logdir you can do "grep nsglobalwindow cc-edges* | grep example.com". this looks through all of the windows in all of the cc logs (which may leaked, this late in shutdown), and then filters out windows where the url
contains example.com. the result of that grep will contain output that looks something like this: cc-edges.15873.log:0x7f0897082c00 [rc=1285] nsglobalwindowinner # 2147483662 inner https://www.example.com/ * cc-edges.15873.log: the first part is the file name where it was found. 15873 is the pid of the process that leaked. you'll want to write down the name of the file and the pid. let's call the file ...
...https://www.example.com] root 0x7f0882fe3230 is a ref counted object with 1 unknown edge(s). known edges: 0x7f08975a24c0 [fragmentorelement (xhtml) head https://www.example.com] --[mattrsandchildren[i]]--> 0x7f0882fe3230 0x7f08967e7b20 [js object (htmlscriptelement)] --[unwrapdomobject(obj)]--> 0x7f0882fe3230 the first two lines mean that the script element 0x7f0882fe3230
contains a strong reference to the eventlistenermanager 0x7f0899b4e550. "[via hash] mlistenermanager" is a description of that strong reference. together, these lines show a chain of strong references from an object the cycle collector thinks needs to be kept alive, 0x7f0899b4e550, to the object 0x7f0897082c00 that you asked about. most of the time, the actual chain is not important, because the cycle col...
...bolification, but you only need to run it once on a log file. after that is done, we can finally find out which objects (possibly) point to other objects, using the block_analyzer script: python $srcdir/memory/replace/dmd/block_analyzer.py dmd-$pid.log.gz $leakaddr this will look through every block of memory in the log, and give some basic information about any block of memory that (possibly)
contains a pointer to that object. you can pass some additional options to affect how the results are displayed. “-sfl 10000 -a” is useful. the -sfl 10000 tells it to not truncate stack frames, and -a tells it to not display generic frames related to the allocator. caveat: i think block_analyzer.py does not attempt to clamp the address you pass into it, so if it is an offset from the start of the blo...
...And 2 more matches
Hacking Tips
2 2 [ 2] colspan 9 getting the bytecode of a function (from gdb) in jsopcode.cpp, a function named js::disassembleatpc can print the bytecode of a script. some variants of this function such as js::dumpscript etc are convenient for debugging. printing the js stack (from gdb) in jsobj.cpp, a function named js::dumpbacktrace prints a backtrace à la gdb for the js stack. the backtrace
contains in the following order, the stack depth, the interpreter frame pointer (see js/src/vm/stack.h, stackframe class) or (nil) if compiled with ionmonkey, the file and line number of the call location and under parentheses, the jsscript pointer and the jsbytecode pointer (pc) executed. $ gdb --args js […] (gdb) b js::reportoverrecursed (gdb) r js> function f(i) { if (i % 2) f(i + 1); else f(i +...
...en be use with kcachegrind which provides a graphical view of the call graph. using ionmonkey spew (js shell) ionmonkey spew is extremely verbose (not as much as the infer spew), but you can filter it to focus on the list of compiled scripts or channels, ionmonkey spew channels can be selected with the ionflags environment variable, and compilation spew can be filtered with ionfilter. ionflags
contains the names of each channel separated by commas. the logs channel produces 2 files in /tmp/, one (/tmp/ion.json) made to be used with iongraph (made by sean stangl) and another one (/tmp/ion.cfg) made to be used with c1visualizer. these tools will show the mir & lir steps done by ionmonkey during the compilation. if you would like to use iongraph, you must install graphviz. compilation logs and sp...
...produces 2 files in /tmp/, one (/tmp/ion.json) made to be used with iongraph (made by sean stangl) and another one (/tmp/ion.cfg) made to be used with c1visualizer. these tools will show the mir & lir steps done by ionmonkey during the compilation. if you would like to use iongraph, you must install graphviz. compilation logs and spew can be filtered with the ionfilter environment variable which
contains locations as output in other spew channels. multiple locations can be separated with comma as a separator of locations. $ ionfilter=pdfjs.js:16934 ionflags=logs,scripts,osi,bailouts ./js --ion-offthread-compile=off ./run.js 2>&1 | less the bailouts channel is likely to be the first thing you should focus on, because this means that something does not stay in ionmonkey and fallback to the interp...
...And 2 more matches
Property cache
perty cache to forward its work to the interpreter.) for speed, the cache is a fixed-size hash table with no chaining. collisions simply cause old entries to be overwritten. the hash table entries are key-value pairs. the keys describe the context in which a property lookup occurs. the values consist of two word-sized members. entry->vcap caches the results of part 1 above, telling which object
contains the desired property. entry->vword is described in the section entry value words below. it caches the results of part 2, if the property is simple enough for optimized access, or a pointer to the js::shape if not. the opcodes that take advantage of the property cache, as of june 2009, are: getprop, get{x,this,arg,local}prop, and length; name; setprop, bindname, and setname; callprop and callname...
...ug 440834. property cache entries each entry in the property cache hash table is either populated or not; unpopulated entries have .kpc == null. if an entry is populated, the .kpc field points to the bytecode instruction at which it was populated. the entry is valid only for subsequent lookups that occur at the same instruction, for several reasons: the script, not the property cache entry,
contains the id of the property being accessed. a property cache entry could be valid for a getprop but not a setprop, e.g. because the property has a setter and not a getter; or vice versa. lookups for jof_name instructions are quite different from ordinary property lookups: name lookups follow the scope chain and the prototype chain, whereas the others only follow the prototype chain. there are two ...
... of entry is created for all instructions that use the property cache. when the operand to the instruction at pc is an object obj with shape kshape, let pobj = the object found by walking scopeindex steps up the parent chain and then protoindex steps up the prototype chain. if pobj exists (that is, both the parent chain and the prototype chain are long enough) and it has the shape vshape, then it
contains the desired property. furthermore, the .vword field describes the property in detail, as described in the next section. if a property with the same name is ever added to an object anywhere along the search path, then this cache entry becomes invalid: the property described by this property cache entry has been shadowed. the two shadowing guarantees ensure that if this happens, the shape of pobj ...
...And 2 more matches
JSAPI User Guide
spidermonkey, the mozilla javascript engine, in your c++ program. javascript is widely used for client-side scripts that run in the browser. but mozilla's javascript engine is a library that can be linked into any c++ program, not just a browser. many applications can benefit from scripting. these programs can execute javascript code from c++ using the spidermonkey api. note: the foss wiki page
contains a few links to other libraries and programs that can make life easier when using spidermonkey and jsapi. what spidermonkey does the javascript engine compiles and executes scripts containing javascript statements and functions. the engine handles memory allocation for the objects needed to execute scripts, and it cleans up—garbage collects—objects it no longer needs. the word javascript ma...
...at can do many things involving javascript code and objects. it can compile and execute scripts, get and set object properties, call javascript functions, convert javascript data from one type to another, create objects, and so on. almost all jsapi functions require a jscontext * as the first argument, just like most <stdio.h> functions require a file *. global objects. lastly, the global object
contains all the classes, functions, and variables that are available for javascript code to use. whenever javascript code does something like window.open("http://www.mozilla.org/"), it is accessing a global property, in this case window. jsapi applications have full control over what global properties scripts can see. the application starts out by creating an object and populating it with the standard ja...
...t of pieces for a simple application. it amounts to about 80 lines of code, as shown below. but the jsapi is designed to scale to applications that need many global objects. it is a fine-grained api, supporting many different combinations of the parts, and giving applications precise control over how spidermonkey behaves. here is the boilerplate code necessary for a minimal jsapi application. it
contains everything described above. #include "jsapi.h" using namespace js; // the class of the global object. static jsclass globalclass = { "global", jsclass_global_flags, js_propertystub, js_deletepropertystub, js_propertystub, js_strictpropertystub, js_enumeratestub, js_resolvestub, js_convertstub, nullptr, nullptr, nullptr, nullptr, js_globalobjecttraceh...
...And 2 more matches
Gecko Roles
resents the system mouse pointer. role_caret represents the system caret. role_alert represents an alert or a condition that a user should be notified about. assistive technologies typically respond to the role by reading the entire onscreen contents of containers advertising this role. should be used for warning dialogs, etc. role_window represents the window frame, which
contains child objects such as a title bar, client, and other objects contained in a window. the role is supported automatically by microsoft windows. role_internal_frame a sub-document. role_menupopup represents a menu, which presents a list of options from which the user can make a selection to perform an action. role_menuitem represents a menu item, which is an entry in a menu t...
... buttons or toggle buttons) that provides easy access to frequently used features. role_statusbar represents a status bar, which is an area at the bottom of a window that displays information about the current operation, state of the application, or selected object. the status bar has multiple fields, which display different kinds of information. role_table represents a table that
contains rows and columns of cells, and optionally, row headers and column headers. role_columnheader represents a column header, providing a visual label for a column in a table. role_rowheader represents a row header, which provides a visual label for a table row. role_column represents a column of cells within a table. role_row represents a row of cells within a table. ...
...adjust a setting in given increments between minimum and maximum values. role_spinbutton represents a spin box, which is a control that allows the user to increment or decrement the value displayed in a separate "buddy" control associated with the spin box. role_diagram represents a graphical image used to diagram data. role_animation represents an animation control, which
contains content that changes over time, such as a control that displays a series of bitmap frames. role_equation represents a mathematical equation. it is used by mathml. role_buttondropdown represents a button that drops down a list of items. role_buttonmenu represents a button that drops down a menu. role_buttondropdowngrid represents a button that drops down a grid. ...
...And 2 more matches
nsIAccessibleRetrieval
hell() return an nsiaccessible for a dom node in the given pres shell. create a new accessible of the appropriate type if necessary, or use one from the accessibility cache if it already exists. nsiaccessible getaccessibleinshell( in nsidomnode anode, in nsipresshell apresshell ); parameters anode the dom node to get an accessible for. apresshell the presentation shell which
contains layout info for the dom node. return value the nsiaccessible for the given dom node. getaccessibleinweakshell() obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) return an nsiaccessible for a dom node in the given weak shell. create a new accessible of the appropriate type if necessary, or use one from the accessibility cache if it already exists. n...
...eturn an nsiaccessible for a dom node in the given weak shell. create a new accessible of the appropriate type if necessary, or use one from the accessibility cache if it already exists. nsiaccessible getaccessibleinweakshell( in nsidomnode anode, in nsiweakreference apresshell ); parameters anode the dom node to get an accessible for. apresshell the presentation shell which
contains layout info for the dom node. return value the nsiaccessible for the given dom node. getaccessibleinwindow() obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) return an nsiaccessible for a dom node in present shell for this dom window. create a new accessible of the appropriate type if necessary, or use one from the accessibility cache if it already...
...0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) return an nsiaccessible for an already created dom node in the given weak shell. does not create a new one -- only returns cached accessibles. nsiaccessible getcachedaccessible( in nsidomnode anode, in nsiweakreference ashell ); parameters anode the dom node to get an accessible for. ashell the presentation shell which
contains layout info for the dom node. return value the nsiaccessible for the given dom node or null if an accessible does not already exist for this dom node. getcachedaccessnode() obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) return an nsiaccessnode for an already created dom node in the given weak shell. does not create a new one -- only returns cache...
...And 2 more matches
nsIFile
preferred form operates on utf-16 encoded characters strings. an alternate form operates on characters strings encoded in the "native" charset. a string containing characters encoded in the native charset cannot be safely passed to javascript via xpconnect. therefore, the utf-16 forms are scriptable, but the "native methods" are not. in addition, the native form cannot deal with files whose name
contains characters outside the default system code page on windows. using the native form limits the ability of your code to deal with the full unicode support on windows 2000 or later where the os itself does not have such a limitation. therefore, you must not use the native form unless it is guaranteed that the path passed to a native form function is always ascii. to create an nsifile from a path you...
...ith this interface in gecko 14. much of the documentation has not been updated to reflect this change. ...
...is method does not return a new nsifile; it modifies the object it was called on. if the old nsifile should be retained, use clone(). void append( in astring node ); parameters node a string which is intended to be a child node of the nsifile. this string must not contain a path separator character. exceptions thrown ns_error_file_unrecognized_path indicates that anode incorrectly
contains a path separator character. native code only! appendnative this method is used for constructing a descendant of the current nsifile. [native character encoding variant] void appendnative( in acstring node ); parameters node a string that is intended to be a child node of the current nsifile. this string must not contain a path separator character. this string must be encoded usi...
...And 2 more matches
nsILocalFile
nativepath( in acstring relativefilepath ); parameters relativefilepath a native relative path. for security reasons, this cannot contain '..' or cannot start with a directory separator '/'. must be in the native file system character set. exceptions thrown ns_error_file_unrecognized_path indicates that relativefilepath incorrectly begins with a path separator character or otherwise
contains invalid characters. appendrelativepath() appends a relative native path to the current path of the nsilocalfile object. void appendrelativepath( in astring relativefilepath ); parameters relativefilepath a native relative path. for security reasons, this cannot contain '..' or cannot start with a directory separator '/' . exceptions thrown ns_error_file_unrecognized_path indicat...
...t path of the nsilocalfile object. void appendrelativepath( in astring relativefilepath ); parameters relativefilepath a native relative path. for security reasons, this cannot contain '..' or cannot start with a directory separator '/' . exceptions thrown ns_error_file_unrecognized_path indicates that relativefilepath incorrectly begins with a path separator character or otherwise
contains invalid characters. getrelativedescriptor() returns a relative file path in an opaque, cross platform format. it is therefore not a native path. acstring getrelativedescriptor( in nsilocalfile fromfile ); parameters fromfile the file from which the descriptor is relative. there is no defined result if this parameter is null. return value an opaque string value with undefined charac...
...th that this nsilocalfile references. all current settings will be reset. void initwithnativepath( in acstring filepath ); parameters filepath a string that specifies a platform-specific, full path to a file or directory. must be in the native file system character set. exceptions thrown ns_error_file_unrecognized_path indicates that filepath is not an absolute file path or that it
contains characters that are invalid for the filesystem. initwithpath() used to set the full path that this nsilocalfile references. all current settings will be reset. void initwithpath( in astring filepath ); parameters filepath a string that specifies a platform-specific, full path to a file or directory. exceptions thrown ns_error_file_unrecognized_path indicates that filepath is not...
...And 2 more matches
XPCOM reference
tead of as attributes on the interface, allowing it to be more flexible.nsicookie2 mozilla 1 8 branchnsimsgsearchvaluedefined in comm-central/ mailnews/ base/ search/ public/ nsimsgsearchvalue.idl nsmsgmessageflagsthe nsmsgmessageflags interface describes possible flags for messages. equivalent flags are also defined in nsmsgmessageflags.h. nsmsgnavigationtypethe nsmsgnavigationtype interface
contains constants used for message navigation in thunderbird. for example to move forward a message, you would call:nsmsgsearchopvaluedefined in comm-central/ mailnews/ base/ search/ public/ nsmsgsearchcore.idl nsmsgviewcommandcheckstatethe nsmsgviewcommandcheckstate interface
contains constants used for command status in thunderbird. it is (as far as i can tell) not currently used anywhere in thunderbir...
...r example to move forward a message, you would call:nsmsgsearchopvaluedefined in comm-central/ mailnews/ base/ search/ public/ nsmsgsearchcore.idl nsmsgviewcommandcheckstatethe nsmsgviewcommandcheckstate interface
contains constants used for command status in thunderbird. it is (as far as i can tell) not currently used anywhere in thunderbird.nsmsgviewcommandtypethe nsmsgviewcommandtype interface
contains constants used for commands in thunderbird. ...
...this interface isn't ever implemented. ...
...And 2 more matches
Structures - Plugins
« previousnext » this chapter describes the data structures that are used to represent the various objects in the plug-in api. structure summary npanycallbackstruct
contains information required during embedded mode printing. npbyterange represents a particular range of bytes from a stream. npembedprint substructure of npprint that
contains platform-specific information used during embedded mode printing. npevent represents an event passed by npp_handleevent to a windowless plug-in. ...
...ormation required during embedded mode printing. npbyterange represents a particular range of bytes from a stream. npembedprint substructure of npprint that
contains platform-specific information used during embedded mode printing. npevent represents an event passed by npp_handleevent to a windowless plug-in. npfullprint substructure of npprint that
contains platform-specific information used during full-page mode printing. npp represents a single instance of a plug-in. ...
... nprect represents a rectangular area of a page. ...
...And 2 more matches
Index - Firefox Developer Tools
s, xul, xul:tools the dom inspector (also known as domi) is a developer tool used to inspect, browse, and edit the document object model of documents - usually web pages or xul windows. the dom hierarchy can be navigated using a two-paned window that allows a variety of different views on the document and all nodes within. 7 dom inspector faq dom_inspector the file menu
contains approaches which will allow you to inspect a document. 8 dom inspector internals code, tools, internals, organisation, source there are three main facets to dom inspector. the one you are likely to be most familiar with is its inspector.xul-based primary ui. this is the two-pane inspector that appears when ctrl+shift+i (or cmd+shift+i) is pressed from one of the applications ...
...pes the shape path editor is a tool that helps you see and edit shapes created using clip-path and also the css shape-outside property and <basic-shape> values. this guide walks you through all of the available options. 60 edit fonts fonts, guide, inspector, tools, variable fonts this article provides a tour of the font tools available in the firefox devtools. this tool
contains several useful features for viewing and manipulating fonts applied to any document loaded in the browser including inspection of all fonts applied to the page, and precise adjustment of variable font axis values. 61 examine event listeners guide, inspector, tools the inspector shows the word "event" next to elements in the html pane, that have event listeners bound to them: ...
...la, tools you can examine and edit the page's html in the html pane. 64 examine and edit the box model guide, tools with the select element button pressed, if you hover over an element in the page, the box model for the element is shown overlaid on the page: 65 inspect and select colors guide, inspector, tools in the css pane's rules view, if a rule
contains a color value, you'll see a sample of the color next to the value: 66 open the inspector guide, inspector, tools there are two main ways to open the inspector: 67 reposition elements in the page starting in firefox 48 you can move absolutely positioned elements by dragging them around the page. 68 select an element guide, inspector, tools ...
...And 2 more matches
Timing element visibility with the Intersection Observer API - Web APIs
the site header. the rows are sized the same way as the columns: the first one is automatically sized and the one uses the remaining space, but at least enough space to provide room for all elements within it. the wrapper's width is fixed at 700px so that it will fit in the available space when presented inline on mdn below. the header the header is fairly simple, since for this example all it
contains is some text. its style looks like this: header { grid-column: 1 / -1; grid-row: 1; background-color: aliceblue; } grid-row is set to 1, since we want the header to be placed in the top row of the site's grid. more interesting is our use of grid-column here; here we specify that we want the column to start in the first column and ends in the first column past the last grid line—in other...
...us sem, vitae mattis ipsum ullamcorper" + " eu. donec nec imperdiet nibh, nec vehicula libero. phasellus vel" + " malesuada nulla. aliquam sed magna aliquam, vestibulum nisi at," + " cursus nunc.</p>"; function buildcontents() { for (let i=0; i<5; i++) { contentbox.appendchild(createarticle(loremipsum)); if (!(i % 2)) { loadrandomad(); } } } the variable loremipsum
contains the text we'll use for the body of all of our articles. obviously in the real world, you'd have some code to pull articles from a database or the like, but this does the job for our purposes. every article uses the same text; you could of course change that easily enough. buildcontents() creates a page with five articles. following every odd-numbered article, an ad is "loaded" and inserted into ...
...ou'd have some code to pull articles from a database or the like, but this does the job for our purposes. every article uses the same text; you could of course change that easily enough. buildcontents() creates a page with five articles. following every odd-numbered article, an ad is "loaded" and inserted into the page. articles are inserted into the content box (that is, the <main> element that
contains all the site content) after being created using a method called createarticle(), which we'll look at next. the ads are created using a function called loadrandomad(), which both creates the ad and inserts it into the page. we'll see later that this same function can also replace an existing ad, but for now, we're simply appending ads to the existing content. creating an article to create the <...
...And 2 more matches
RTCStatsReport - Web APIs
calling getstats() on an rtcpeerconnection lets you specify whether you wish to obtain statistics for outbound, inbound, or all streams on the connection. ...
...: the timestamp, the statistic type string, and an id uniquely identifying the source of the data: id a domstring which uniquely identifies the object which was inspected to produce this object based on rtcstats. timestamp a domhighrestimestamp object indicating the time at which the sample was taken for this statistics object. type a domstring indicating the type of statistics the object
contains, taken from the enum type rtcstatstype. the statistic categories the type gives the name of the statistic category represented by the object, and is how you locate the specific type of data you need. the statistic category names are members of the enumerated type rtcstatstype, as follows: candidate-pair an rtcicecandidatepairstats object providing statistics related to an rtcicetransport. ...
...s to another candidate pair; this change cannot be detected otherwise. certificate an rtccertificatestats object providing statistics related to a certificate being used by an rtcicetransport. codec an rtccodecstats object containing statistics about a codec currently being used by rtp streams to send or receive data for the rtcpeerconnection. csrc an rtccontributingsourcestats object which
contains statistics related to a contributing source (csrc) that contributed to an inbound rtp stream. data-channel an rtcdatachannelstats object which
contains statistics about each rtcdatachannel on the connection. inbound-rtp an rtcinboundrtpstreamstats object providing statistics about inbound data being received from remote peers. since this only provides statistics related to inbound data, witho...
...And 2 more matches
ARIA: grid role - Accessibility
the position of each cell is significant and can be focused using keyboard input. ...
...while it does not imply a specific visual presentation, it implies a relationship among elements. uses fall into two categories: presenting tabular information (data grids) and grouping other widgets (layout grids). even though both data grids and layout grids employ the same aria roles, states, and properties, d...
...ne of the first visible rows. if focus is in the last row of the grid, focus does not move. page up moves focus up an author-determined number of rows, typically scrolling so the top row in the currently visible set of rows becomes one of the last visible rows. if focus is in the first row of the grid, focus does not move. home moves focus to the first cell in the row that
contains focus. end moves focus to the last cell in the row that
contains focus. ctrl + home moves focus to the first cell in the first row. ctrl + end moves focus to the last cell in the last row. if cells, rows, or columns can be selected, the following key combination are commonly used: key combination action ctrl + space select th...
...And 2 more matches
<input type="email"> - HTML: Hypertext Markup Language
rd text input. value a domstring representing an e-mail address, or empty events change and input supported common attributes autocomplete, list, maxlength, minlength, multiple, name,pattern, placeholder, readonly, required, size, and type idl attributes list and value methods select() value the <input> element's value attribute
contains a domstring which is automatically validated as conforming to e-mail syntax. more specifically, there are three possible value formats that will pass validation: an empty string ("") indicating that the user did not enter a value or that the value was removed. a single properly-formed e-mail address. this doesn't necessarily mean the e-mail address exists, but it is at least formatted correct...
... from each address in the list. see validation for details on how e-mail addresses are validated to ensure that they're formatted properly. ...
...e.com"> offering suggested values taking it a step farther, you can provide a list of default options from which the user can select by specifying the list attribute. this doesn't limit the user to those options, but does allow them to select commonly-used e-mail addresses more quickly. this also offers hints to autocomplete. the list attribute specifies the id of a <datalist>, which in turn
contains one <option> element per suggested value; each option's value is the corresponding suggested value for the email entry box. <input type="email" size="40" list="defaultemails"> <datalist id="defaultemails"> <option value="jbond007@mi6.defence.gov.uk"> <option value="jbourne@unknown.net"> <option value="nfury@shield.org"> <option value="tony@starkindustries.com"> <option value="hulk@grr...
...And 2 more matches
<td>: The Table Data Cell element - HTML: Hypertext Markup Language
it participates in the table model. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories sectioning root. permitted content flow content. tag omission the start tag is mandatory. the end tag may be omitted, if it is immediately followed by a <th> or <td> element or if there are no more data in its parent element. permitted parents a <tr> element. ...
...is immediately followed by a <th> or <td> element or if there are no more data in its parent element. permitted parents a <tr> element. implicit aria role cell if a descendant of a <table> element permitted aria roles any dom interface htmltabledatacellelement attributes this element includes the global attributes. ...
... aria roles any dom interface htmltabledatacellelement attributes this element includes the global attributes. colspan this attribute
contains a non-negative integer value that indicates for how many columns the cell extends. its default value is 1. values higher than 1000 will be considered as incorrect and will be set to the default value (1). headers this attribute
contains a list of space-separated strings, each corresponding to the id attribute of the <th> elements that apply to this element. rowspan this attribute
contains a non-negative integer value that indicates for how many rows the cell extends. its default value is 1; if its value is set to 0, it extends until the end of the table section (<thead>, <tbody>, <tfoot>, even if implicitly defined), that the ...
...And 2 more matches
A typical HTTP session - HTTP
formed any number of times. establishing a connection in client-server protocols, it is the client which establishes the connection. opening a connection in http means initiating a connection in the underlying transport layer, usually this is tcp. with tcp the default port, for an http server on a computer, is port 80. other ports can also be used, like 8000 or 8080. the url of a page to fetch
contains both the domain name, and the port number, though the latter can be omitted if it is 80. see identifying resources on the web for more details. note: the client-server model does not allow the server to send data to the client without an explicit request for it. to work around this problem, web developers use several techniques: ping the server periodically via the xmlhttprequest, fetch apis, us...
...ch apis, using the websockets api, or similar protocols. sending a client request once the connection is established, the user-agent can send the request (a user-agent is typically a web browser, but can be anything else, a crawler, for example). a client request consists of text directives, separated by crlf (carriage return, followed by line feed), divided into three blocks: the first line
contains a request method followed by its parameters: the path of the document, i.e. an absolute url without the protocol or domain name the http protocol version subsequent lines represent an http header, giving the server information about what type of data is appropriate (e.g., what language, what mime types), or other data altering its behavior (e.g., not sending an answer if it is alre...
... a status request (and its brief meaning in human-readable text). subsequent lines represent specific http headers, giving the client information about the data sent (e.g. type, data size, compression algorithm used, hints about caching). similarly to the block of http headers for a client request, these http headers form a block ending with an empty line. the final block is a data block, which
contains the optional data. example responses successful web page response: http/1.1 200 ok content-type: text/html; charset=utf-8 content-length: 55743 connection: keep-alive cache-control: s-maxage=300, public, max-age=0 content-language: en-us date: thu, 06 dec 2018 17:37:18 gmt etag: "2e77ad1dc6ab0b53a2996dfd4653c1c3" server: meinheld/0.6.1 strict-transport-security: max-age=63072000 x-content-typ...
...And 2 more matches
Date.parse() - JavaScript
2015-02-31). it is not recommended to use date.parse as until es5, parsing of strings was entirely implementation dependent. there are still many differences in how different hosts parse date strings, therefore date strings should be manually parsed (a library can help if many different formats are to be accommodated). ...
...s are used during date string parsing to interpret the argument, the value returned is always the number of milliseconds between january 1, 1970 00:00:00 utc and the point in time represented by the argument or nan. because parse() is a static method of date, it is called as date.parse() rather than as a method of a date instance. fall-back to implementation-specific date formats this section
contains implementation-specific behavior that can be inconsistent across implementations. the ecmascript specification states: if the string does not conform to the standard format the function may fall back to any implementation–specific heuristics or implementation–specific parsing algorithm. unrecognizable strings or dates containing illegal element values in iso formatted strings shall cause da...
...in date strings not recognized as simplified iso format as defined by ecma-262 may or may not result in nan, depending on the browser and values provided, e.g.: // non-iso string with invalid date values new date('23/25/2014'); will be treated as a local date of 25 november, 2015 in firefox 30 and an invalid date in safari 7. however, if the string is recognized as an iso format string and it
contains invalid values, it will return nan in all browsers compliant with es5 and later: // iso string with invalid values new date('2014-25-23').toisostring(); // throws "rangeerror: invalid date" in all es5-compliant browsers spidermonkey's implementation-specific heuristic can be found in jsdate.cpp. the string "10 06 2014" is an example of a non-conforming iso format and thus falls back to a custo...
...And 2 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
sion> </description> </em:targetapplication> </description> </rdf> create the chrome manifest fill in the chrome.manifest file as shown in listing 2. listing 2: content for chrome.manifest content helloworld content/ overlay chrome://browser/content/browser.xul chrome://helloworld/content/overlay.xul register the content package (content instruction) line 1, beginning content,
contains the code used to register the chrome’s content package. here, helloworld is a package name, and content/ is a relative path to the folder where the source file is stored. registering the content package makes it so that the overlay.xul file in the content folder can be accessed using the chrome url, chrome://helloworld/content/overlay.xul. xul cross-package overlay (overlay instruction) line ...
...ster the chrome’s content package. here, helloworld is a package name, and content/ is a relative path to the folder where the source file is stored. registering the content package makes it so that the overlay.xul file in the content folder can be accessed using the chrome url, chrome://helloworld/content/overlay.xul. xul cross-package overlay (overlay instruction) line 2, beginning overlay,
contains the code used to invoke the cross-package overlay, overlaying the firefox browser window, at chrome://browser/content/browser.xul with chrome://helloworld/content/overlay.xul. finding overlay merge points the next step is to find the “merge points” where the overlay document will insert its content into the base document. there are a number of ways to go about this; here, we’ll use the do...
... menu item. type chrome://browser/content/browser.xul into the url input field at the top, then click the inspect button. a browser pane will appear in the lower part of the window. click the spots numbered 1 and 2 in figure 5, in that order; the menu element (3) will then be selected. expand spot 3; this will disclose the area numbered 4, with several menuitem elements. the menupop element 4
contains the merge point where you’re going to be adding a new menu item; you can see that it has the id menu_toolspopup. look through the menuitem elements within this menupop element and determine where you want to add your new element. for the time being, let’s locate it in the spot numbered fixme: figure 5: finding merge points for overlays using the dom inspector putting overlays on the brows...
...al extensions: a session-management extension in this section, we will create an extension that uses a new feature: the session store api. this will allow the user to save and restore session snapshots (browser window states) at any time. phase 1: test install figure 12 shows what the interface for the session-management extension will look like. under the tool menu, the session store submenu
contains two items—save session and clear sessions; in between them is a list of previously saved sessions that you can restore, most recent first. fixme: figure 12: session-management extension interface: the menu as discussed in the part “the session store api”, sessions are represented as json character strings. sessions are stored in a subdirectory of the profile directory (called “sessionst...
Getting Started - Archive of obsolete content
ations linux: folder_with_seamonkey/chrome/classic.jar windows: folder_with_seamonkey\chrome\classic.jar for mac os x: folder_with_seamonkey/chrome/classic.jar copy classic.jar to another easily accessible folder -- classic is recommended -- extract the contents of that folder, being sure to maintain the directory structure. directories inside classic.jar is one directory, skin. ...
...ome\classic.jar for mac os x: folder_with_seamonkey/chrome/classic.jar copy classic.jar to another easily accessible folder -- classic is recommended -- extract the contents of that folder, being sure to maintain the directory structure. directories inside classic.jar is one directory, skin. skin skin simply
contains another directory, classic which holds all the good stuff. skin\classic classic
contains the following directories. skin\classic\communicator communicator
contains all the toolbar icons, as well as the icons for the bookmark manager and the preferences window. skin\classic\editor editor
contains files of composer. skin\classic\global global
contains almost all of the important css files that define the appearance of the suite. this is the most critical directory in a theme. skin\clas...
... directories. skin\classic\communicator communicator
contains all the toolbar icons, as well as the icons for the bookmark manager and the preferences window. skin\classic\editor editor
contains files of composer. skin\classic\global global
contains almost all of the important css files that define the appearance of the suite. this is the most critical directory in a theme. skin\classic\help help
contains all the files for theming the help dialog window. skin\classic\messenger messenger
contains styles of the mail client. skin\classic\messenger-newsblog messenger-newsblog
contains the only css file. skin\classic\mozapps mozapps
contains all the styles and icons for the browser peripherals, such as the extension manager or update wizard. ...
... install your new theme before you can see the changes you make to a seamonkey theme (since live edits are restrictively difficult to set up) you must first learn how to repackage the classic theme to make it installable. for the sake of this discussion we will call your theme "my_theme", though you can replace that with any name. ...
Creating a Microsummary - Archive of obsolete content
the easiest way to get an xpath expression that points to the node in question is to use the xpath checker extension. install the extension (restarting firefox to complete installation)...
..."> </template> </transform> </template> </generator> including the download count to include the download count in the output of the xslt transform sheet, we need to add an xslt <value-of> element to the template whose select attribute
contains an xpath expression that points to the node containing the count. xpath is a language for identifying nodes in html/xml documents. it also
contains basic functions for manipulating those nodes and their content. the easiest way to get an xpath expression that points to the node in question is to use the xpath checker extension. install the extension (restarting firefox to complete installation) then go to the spread firefox home page, find the firefox download count (a large number at the bottom of the right-hand column), context click on t...
... is to use the xpath checker extension. install the extension (restarting firefox to complete installation) then go to the spread firefox home page, find the firefox download count (a large number at the bottom of the right-hand column), context click on the number, and select view xpath from the context menu. xpath checker will open a new window. ...
...nload count (a large number at the bottom of the right-hand column), context click on the number, and select view xpath from the context menu. xpath checker will open a new window. the new window will include an xpath field that
contains this xpath expression pointing to the download count node: id('download-count'). ...
Creating a Skin for Firefox/Getting Started - Archive of obsolete content
x installation directory. a .jar file is in reality a renamed zip archive. opening the .jar files in your archive manager of choice should result in the file being automatically detected as being a zip archive. however, if your application doesn't detect classic.jar as a standard zip archive, rename the file classic.zip and continue extraction. note: starting in gecko 2.0, the new omni.jar file
contains the skin, among other resources. see theme changes in firefox 4 for details on how to extract skin files from firefox 4 or later. classic.jar locations linux: /usr/lib/mozillafirefox/chrome/classic.jar or /usr/lib/firefox-*.*.*/chrome/classic.jar windows: \program files\mozilla firefox\chrome\classic.jar for mac os x: go to your applications folder control click application icon(firefox ...
...k application icon(firefox icon), choose show package contents. go to contents/macos/chrome/classic.jar copy classic.jar to another easily accessible folder -- classic is recommended -- extract the contents of that folder, being sure to maintain the directory structure. directories inside classic.jar is one directory, skin, as well as two files, preview.png and icon.png. ...
...e/classic.jar copy classic.jar to another easily accessible folder -- classic is recommended -- extract the contents of that folder, being sure to maintain the directory structure. directories inside classic.jar is one directory, skin, as well as two files, preview.png and icon.png. skin skin simply
contains another directory, classic which holds all the good stuff. skin\classic classic
contains the following directories. skin\classic\browser browser
contains all the toolbar icons, as well as the icons for the bookmark manager and the preferences window. skin\classic\communicator doesn't do a whole lot and can typically be forgotten about promptly. skin\classic\global global
contains almost all of the important css files that define the appearance of the browser. this is the most c...
...ser
contains all the toolbar icons, as well as the icons for the bookmark manager and the preferences window. skin\classic\communicator doesn't do a whole lot and can typically be forgotten about promptly. skin\classic\global global
contains almost all of the important css files that define the appearance of the browser. this is the most critical directory in a theme. skin\classic\help help
contains all the files for theming the help dialog window. skin\classic\mozapps mozapps
contains all the styles and icons for the browser peripherals, such as the extension manager or update wizard. install your new theme before you can see the changes you make to a firefox theme (since live edits are restrictively difficult to set up) you must first learn how to repackage the classic theme to make i...
Block and Line Layout Cheat Sheet - Archive of obsolete content
mes, table cell inner frames, absolutely positioned wrapper frames, and floated frames when the frame is created. nslinebox a block consists of lines and other blocks, stacked vertically. a block frame has one nslinebox for each line, and one nslinebox for each block child. these are stored as a doubly-linked list in the mlines member of nsblockframe. nsinlineframe mflags ns_inline_frame_
contains_percent_aware_child this flag is set if the inline frame has any children that have a percentage value set (via the style context) for the width or height of the content area, padding, border, or margin. nshtmlreflowstate the current state of reflow, built up as reflow recursively descends the frame tree. this is "passed in" to a child frame from its parent, and provides the constraints in wh...
... nshtmlreflowstate. if set, ns_unconstrainedsize is passed to nslinelayout as the available height. brs_shrinkwrapwidth brs_needresizereflow related to brs_shrinkwrapwidth. set if we need to force a resize reflow when computing the final size. e.g., because...why? brs_isinlineincrreflow this flag is set in nsblockframe::reflow() if we detect that we're incrementally reflowing a linebox that
contains inline frames. in this case, we can avoid some of the work that occurs during reflow. brs_nowrap this flag is set in the nsblockreflowstate constructor when the "white-space" style of the block frame is pre or nowrap. it is cleared, otherwise. brs_istopmarginroot this flag is set in the nsblockreflowstate constructor when reflowing a "block margin root" frame (i.e., a frame with the ns_block_...
...inroot this flag is set in the nsblockreflowstate constructor when reflowing a "block margin root" frame (i.e., a frame with the ns_block_margin_root flag set, for which margins apply by default). the flag is also set when reflowing a frame whose computed bottom border padding is zero. (why?) brs_applytopmargin this flag is set if the top margin should be considered when placing a linebox that
contains a block frame. it may be set as a side-effect of calling nsblockframe::shouldapplytopmargin(); once set, shouldapplytopmargin() uses it as a fast-path way to return whether the top margin should apply. if the flag hasn't been set in the block reflow state, then shouldapplytopmargin() will crawl the line list to see if a block frame precedes the specified frame. if so, the top margin should be app...
...htmlreflowmetrics object has been provided by (the parent frame?). brs_computemaxwidth this flag is set if reflow should recompute a frame's maximum width; for example, during first-pass table reflow. when this is set, nsblockframe::reflowline will flow the first line and each unwrapped line in the block twice. nsblockreflowcontext encapsulates the transient reflow state for a nslinebox that
contains a block frame. mnextrcframe during an incremental reflow, this member holds current frame in the reflow chain. nslinelayout encapsulates the transient reflow state for a nslinebox that
contains inline frames. a new nslinelayout object is created for each inline linebox that is flowed. mflags ll_endsinwhitespace set to true by default when starting line layout. ll_understandsnwhitespac...
Venkman Introduction - Archive of obsolete content
iews has a label, a float button that lets you display the view in its own window, and a close button that puts the view away until you want to display it again, as seen in figure 2. the following section describes these views and their use within the interface as a whole. getting acquainted with venkman's user interface toolbar the toolbar is located at the top of the debugger. the toolbar
contains icons for stop, continue, step over, step into, step out, profile, and pretty print commands. these commands should be self explanatory, with the possible exception of stop, which causes the debugger to stop when the next line of javascript is executed, and the profile button, which can be used to measure execution times for your scripts. when you enable profiling by clicking this button, a green...
... icon data type icon data type void (undefined) value null value boolean value string value integer value double value object value function value figure 9. type icons the column picker for this view (the box on the top right) can be used to display type and flags columns. the type column
contains a textual description of the type of the object. flags lists one or more applicable flags for this object. flags are shown enumerated in figure 8. if an item visible in the local variables view is modified via the interactive session view the modification will be immediately reflected in the local variable view. at the time of this writing, the local variables view's default sort order and grou...
...ntain executable code, such as blank and comment lines. for these lines, the interactive session view will display an error message explaining why the breakpoint could not be set. breakpoints can also be set and cleared from the interactive session view, with the break and fbreak commands. the break command takes a file pattern and line number. any loaded file which matches the file pattern, and
contains an executable line at the requested line number will have a breakpoint set. if no loaded files match the file pattern or line number, an error message is printed to the console and the command fails. the fbreak command is identical, with the exception that if no files match the pattern or line, a "future breakpoint" is recorded. the next time a file is loaded that matches the pattern and line, a ...
...oing to debug. this limitation is fixed, and now the javascript compiler makes all the scripts you access via the browser available to the debugger. see loading scripts into the debugger for more information about finding and loading scripts in venkman. launch a browser window and go to http://wp.netscape.com/fishcam/dhtmltank.html. note that in mozilla 1.x and netscape 7.x, the debugger
contains a window menu like other major components in the application suite. from this menu, you can access the browser, mail, and other applications. type /break animator-0.03 121 in the debugger. the console command /break is used to set and list breakpoints. the first parameter is the file name that
contains the javascript you want to break at. the second parameter is the line number. you don'...
Custom toolbar button - Archive of obsolete content
lready exist. you will add the other directories and files that are shown in the diagram. (other directories and files also exist, but the diagram does not show them.) 1. go to the profile directory that you use for the application, then go to the extensions directory there. note: for information about how to find the profile directory, see: profile folder explanation: the profile directory
contains information specific to a user, keeping it separate from the application. if the application is reinstalled or upgraded, information in the profile is not affected. 2. in the extensions directory, create a new directory with the following name. copy the name from here and paste it, to avoid typing errors: custom-toolbar-button@example.com perform the following steps in this new directory, ...
... about="urn:mozilla:extension:custombutton" em:package="content/custombutton/" /> </em:file> </description> </rdf> optionally customize the file by changing the name, description and creator. change the text between double-quote characters on these three lines. optionally remove the sections for target applications that you do not want. save the file. explanation: this file
contains information used by the application's extension manager. sections for target applications specify the versions where the extension works. the last section in the file specifies that this extension adds content to the application. 4. create a plain text file named chrome.manifest. copy the following content, and paste it into the new file: content custombutton chrome/ style chrome://global/cont...
....xul optionally remove the sections for toolbars that you do not need. save the file. explanation: this file defines the extension's content. it adds a stylesheet to the toolbar customization window. then it specifies an overlay for each toolbar. 5. create a directory named chrome. perform the following steps in that directory, creating five files there. explanation: the chrome directory
contains files that specify what the extension does. 6. create a plain text file named button.xul. copy the following content, making sure that you scroll to get all of it. paste it into the new file: <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/css" href="chrome://custombutton/content/button.css"?> <!doctype overlay > <overlay id="custombutton-overlay" xmlns="http://www.mozi...
...eet specifies how the button is displayed. it links to the button image, specifying the dimensions of the four parts of the image. 8. create a plain text file named button.js. copy the following content, and paste it into the new file: custombutton = { 1: function () { alert("just testing") }, } there is nothing to customize for now. save the file. the next section in this tutorial
contains examples of code that you can use to make your button do something useful. explanation: this file specifies what happens when you press the button. it uses the javascript programming language, together with features provided by the application. 9. download the button image. get a context menu for the image that you see here (for example, by right-clicking it). choose save image as... from the...
Trees - Archive of obsolete content
pe of content, whereas trees may only contain text and images. (using advanced features, progress meters or checkboxes also can be added to the tree) a tree consists of two parts, the set of columns, and the tree body. the set of columns is defined by a number of treecol elements, one for each column. each column will appear as a header at the top of the tree. the second part, the tree body,
contains the data to appear in the tree and is created with a treechildren tag. the tree is unique in that the body of the tree consists only of a single widget which draws all of the data in the tree. this contrasts with the listbox, where individual listitem and listcell tags are used to specify the rows in the listbox. in a tree, all of the data to be displayed is supplied by a separate object, calle...
...ayed content. for instance, a tree might have thousands of rows, yet most of them will be scrolled off the border of the tree, hidden from view. this means that the tree is scalable to any number of rows without any performance problems. of course, this is independant of the performance of the view object itself. a tree view is an object which implements the nsitreeview interface. this interface
contains thirty properties and functions which you may implement. these functions will be called by the tree as necessary to retrieve data and state about the tree. for instance, the getcelltext() function will be called to get the label for a particular cell in the tree. an advantage of using a tree view is that it allows the view to store the data in a manner which is more suitable for the data, or to ...
...ng this element, you can specify additional information about how the data in the columns are sorted and if the user can resize the columns. you should always place an id attribute on a column, as mozilla uses the ids to identify the columns when rearranging and hiding them. this is no longer required in mozilla 1.8 and later, but it is still a good idea to use ids on columns. treechildren this
contains the main body of the tree where the individual rows of data will be displayed. example tree with two columns example 1 : source view <tree flex="1"> <treecols> <treecol id="namecolumn" label="name" flex="1"/> <treecol id="addresscolumn" label="address" flex="2"/> </treecols> <treechildren/> </tree> first, the entire table is surrounded with a tree element. this declares a...
...content tree view having said that the data to be displayed in a tree comes from a view and not from xul tags, there happens to be a built-in tree view which gets its data from xul tags. this may be a bit confusing, but essentially, one of the built-in tree views uses a set of tags which can be used to specify information about the data in the tree. the following tags are used: treeitem this
contains a single parent row and all its descendants. this element also serves as the item which can be selected by the user. the treeitem tag would go around the entire row so that it is selectable as a whole. treerow a single row in the tree, which should be placed inside a treeitem tag. treecell a single cell in a tree. this element would go inside a treerow element. conveniently, these tags may ...
Using Remote XUL - Archive of obsolete content
ting entries of type "allowxulxbl", like this: components.classes["@mozilla.org/permissionmanager;1"] .getservice(components.interfaces.nsipermissionmanager) .add(uri, 'allowxulxbl', components.interfaces.nsipermissionmanager.allow_action); xul (pronounced like "zool"), which is short for xml-based user interface language, is an xml-based language for describing application interfaces. it
contains elements for all common ui widgets (menus, buttons, toolbars, etc.) and many sophisticated ones (trees, browsers, color pickers). xul is often used by desktop applications like mozilla but can also be loaded from a web server and rendered inside the content pane of a compatible browser. xul loaded and rendered in this way is called remote xul and can be used for basic functions like web site nav...
... way to display pages from the mozilla.org web site. for that we'll use a xul iframe element. <?xml version="1.0"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <iframe src="https://www.mozilla.org/" flex="1" /> </window> the xul iframe element is just like its html counterpart: it defines an area within which web content can be displayed. its src attribute
contains the url of the page being displayed in the iframe. we set this value to the mozilla.org home page by default so that page loads into the iframe when we first load the xul document. the iframe's flex attribute tells the browser to stretch the iframe to fill the space available to it. without it, the iframe's size would be a fixed default and wouldn't change when the user resized their window. [o...
...g the document with your browser's "reload" function, just as with a typical html page. source | rendered step 3: menus and buttons the mozilla.org web site uses an html navigation bar on the left-hand side of its pages to provide site navigation. the bar consists of a set of links organized into four main categories: the mozilla organization, developer docs, testing, and tools. the bar also
contains two links that are independent of any category: faq and search. the categorized links are analogous to menu items organized into menus, where clicking the link/selecting the menu item performs some function, so we'll use xul menu elements to implement them in our document. the independent links, on the other hand, are similar to xul buttons, which perform a function when pressed, so we'll use th...
...rg/faq.html" /> <button label="search" value="https://www.mozilla.org/search.html" /> </menubar> <iframe src="https://www.mozilla.org/" flex="1" /> </window> the menupopup element is a container for menu items. it represents the rectangular box that appears when you click a menu title. the menuitem element represents a selectable item within the popup. its label attribute
contains the text to display in the item. its value attribute, while defined in the xul specification, has no specific function in xul; it can store any data associated with the item. in our case we use it to store the url of the page to load when the user selects the item from the menu. source | rendered step 5: appearance there's an obvious problem with the menus: their labels look plain. this make...
editor - Archive of obsolete content
ary content can be retrieved more conveniently using window.content. properties accessibletype type: integer a value indicating the type of accessibility object for the element. commandmanager type: nsicommandmanager the command manager handles operations on the editor. contentdocument type: document this read-only property
contains the document object in the element. contentwindow type: todo use the contentwindow.wrappedjsobject to obtain a dom(html) window object docshell type: nsidocshell this read-only property
contains the nsidocshell object for the document. editingsession type: nsieditingsession the editing session for the editor which is used to initialize the editor. y...
...to use this. editortype type: one of the values below the type of editor to use. this value will be overridden depending on the content type of the document in the editor. html an html editor. text a plaintext editor. webbrowserfind type: nsiwebbrowserfind this read-only property
contains an nsiwebbrowserfind object which can be used to search for text in the document. webnavigation type: nsiwebnavigation this read-only property
contains the nsiwebnavigation object for the document. most of its methods are callable directly on the element itself, such as goback and goforward. it also
contains the load constants used by reloadwithflags and loaduriwithflags. ...
...pass the editor's contentwindow as the argument. ...
...pass the editor's contentwindow as the argument. makeeditable( editortype, waitforload ) return type: no return value this function enables editing for an editor. specify text or html as the editortype. ...
Creating XULRunner Apps with the Mozilla Build System - Archive of obsolete content
this case, we are building both xulrunner and mccoy and placing the build in the directory mccoybase, located at the same level as the current (i.e. source) directory. to build just one of the projects, remove the name of the other from moz_build_projects. for example, you might want to set it to "xulrunner" now and run make to ensure that everything is set up correctly so far. ...
...make sure you change the application name (following ac_add_app_options to that of your app. ...
...make sure you change the application name (following ac_add_app_options to that of your app. do the same with the name that follows --enable-application. you shouldn't have to change the value of --with-libxul-sdk if you are building your own xulrunner. ...
... makefiles and stuff. oh, and actually develop the application itself. the first part, at least, should be fairly straightforward since you just have to copy and adapt the files from the mccoy repository. you'll learn a lot more by looking at the project files than you will from reading this drivel, but just to be safe let's run through the files one by one: makefile.in - the top-level makefile.
contains the names of the subdirectories that need to be built, which at very least will include chrome and app. build.mk - maybe you thought that the --enable-application option told mozilla which directory your app is located in. wrong! it tells mozilla where to look for the build.mk file, which is what tells it where to start building your app. don't think to hard about this, just copy mccoy's file and...
XForms Custom Controls - Archive of obsolete content
a listbox widget. here is a snippet from our .css file to show the type of css rule we would use to make such a determination. xf|select1[appearance="compact"] { -moz-binding: url('chrome://xforms/content/select-xhtml.xml#xformswidget-select1-compact'); } the mediatype attribute can be used by the form author to align the type of presentation with the type of data that the bound instance node
contains. for example, if mediatype='image/*' then the user should see the image that the bytes represent rather than just the byte sequence. xf|output[mediatype^="image"] { -moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-output-mediatype-anyuri'); } custom data types if you define a new schema data type or you use a built-in data type and find the current xforms control for th...
...a types if you define a new schema data type or you use a built-in data type and find the current xforms control for this type to be insufficient, then you should write a new custom control. for example, if you have an instance node of type xsd:date and you'd like to see the date displayed in a local format. in mozilla, every bound xforms control has a typelist attribute of moztype namespace that
contains the inheritance chain of data types that we detected. the moztype namespace is introduced by mozilla xforms implementation and its uri is http://www.mozilla.org/projects/xforms/2005/type. for example, if a control is bound to a node of type xsd:integer then the typelist attribute will be "http://www.w3.org/2001/xmlschema#integer http://www.w3.org/2001/xmlschema#decimal". this is because xsd:integ...
...the host-language specific representation of the xforms control. an example of the latter is the binding that uses a html:input as the anonymous content of an xforms:input element when this element is hosted in a xhtml document. our xforms extension uses the following format for file names. the name of the file where base bindings for a control are placed is controlfile.xml. controlfile-xhtml.xml
contains the xhtml implementation bindings for the control and controlfile-xul.xml
contains the implementation bindings for when this control is hosted in a xul document. the following list shows where the base bindings for our xforms controls are defined: xforms.xml -
contains the base bindings for output, label, trigger, submit, case, message, hint, help, alert, upload and repeat xforms controls. input...
...tml implementation bindings for the control and controlfile-xul.xml
contains the implementation bindings for when this control is hosted in a xul document. the following list shows where the base bindings for our xforms controls are defined: xforms.xml -
contains the base bindings for output, label, trigger, submit, case, message, hint, help, alert, upload and repeat xforms controls. input.xml -
contains the base bindings for input, secret and textarea xforms controls. select.xml -
contains the base bindings for select and select1 xforms controls (except minimal/default select1 that is hosted in select1.xml file) range.xml -
contains the base bindings for the range xforms control. xforms.xml also defines the few base bindings that are common for all xforms controls. these are: xformswidget-gene...
Sizing items in CSS - Learn web development
der on the element — there is no content to hold it open. in our example below, that border stretches to the width of the container, because it is a block level element, a behavior that should be starting to become familiar to you. it has no height (or size in the block dimension) because there is no content. in the example above, try adding some text inside the empty element. the border now
contains that text because the height of the element is defined by the content. therefore the size of this <div> in the block dimension comes from the size of the content. again, this is the intrinsic size of the element — its size is defined by its content. setting a specific size we can of course give elements in our design a specific size. when a size is given to an element (and the content of whic...
... able to become smaller than its intrinsic size, but will stop at 100% of its size. in the example below, we have used the same image three times. the first image has been given width: 100% and is in a container which is larger than it, therefore it stretches to the container width. the second image has max-width: 100% set on it and therefore does not stretch to fill the container. the third box
contains the same image again, also with max-width: 100% set; in this case you can see how it has scaled down to fit into the box. this technique is used to make images responsive, so that when viewed on a smaller device they scale down appropriately. you should, however, not use this technique to load really large images and then scale them down in the browser. images should be appropriately sized to ...
...h relate to the size of the viewport — the vw unit for viewport width, and vh for viewport height. using these units you can size something relative to the viewport of the user. 1vh is equal to 1% of the viewport height, and 1vw is equal to 1% of the viewport width. you can use these units to size boxes, but also text. in the example below we have a box which is sized as 20vh and 20vw. the box
contains a letter a, which has been given a font-size of 10vh. if you change the vh and vw values this will change the size of the box or font; changing the viewport size will also change their sizes because they are sized relative to the viewport. to see the example change when you change the viewport size you will need to load the example in a new browser window that you can resize (as the embedded <...
...which has been given a font-size of 10vh. if you change the vh and vw values this will change the size of the box or font; changing the viewport size will also change their sizes because they are sized relative to the viewport. to see the example change when you change the viewport size you will need to load the example in a new browser window that you can resize (as the embedded <iframe> that
contains the example shown above is its viewport). open the example, resize the browser window, and observe what happens to the size of the box and text. sizing things according to the viewport can be useful in your designs. for example, if you want a full-page hero section to show before the rest of your content, making that part of your page 100vh high will push the rest of the content below the viewpo...
HTML basics - Learn web development
or outside one another. if they overlap as shown above, then your web browser will try to make the best guess at what you were trying to say, which can lead to unexpected results. so don't do it! empty elements some elements have no content and are called empty elements. take the <img> element that we already have in our html page: <img src="images/firefox-icon.png" alt="my test image"> this
contains two attributes, but there is no closing </img> tag and no inner content. this is because an image element doesn't wrap content to affect it. its purpose is to embed an image in the html page in the place it appears. anatomy of an html document that wraps up the basics of individual html elements, but they aren't handy on their own. now we'll look at how individual elements are combined to form ...
...can now handle any textual content you might put on it. there is no reason not to set this and it can help avoid some problems later on. <title></title> — the <title> element. this sets the title of your page, which is the title that appears in the browser tab the page is loaded in. it is also used to describe the page when you bookmark/favourite it. <body></body> — the <body> element. this
contains all the content that you want to show to web users when they visit your page, whether that's text, images, videos, games, playable audio tracks or whatever else. images let's turn our attention to the <img> element again: <img src="images/firefox-icon.png" alt="my test image"> as we said before, it embeds an image into our page in the position it appears. it does this via the src (source) at...
...t that you want to show to web users when they visit your page, whether that's text, images, videos, games, playable audio tracks or whatever else. images let's turn our attention to the <img> element again: <img src="images/firefox-icon.png" alt="my test image"> as we said before, it embeds an image into our page in the position it appears. it does this via the src (source) attribute, which
contains the path to our image file. we have also included an alt (alternative) attribute. in this attribute, you specify descriptive text for users who cannot see the image, possibly because of the following reasons: they are visually impaired. users with significant visual impairments often use tools called screen readers to read out the alt text to them. something has gone wrong causing the image ...
... about accessibility in our accessibility learning module. marking up text this section will cover some of the essential html elements you'll use for marking up the text. headings heading elements allow you to specify that certain parts of your content are headings — or subheadings. in the same way that a book has the main title, chapter titles and subtitles, an html document can too. html
contains 6 heading levels, <h1>–<h6>, although you'll commonly only use 3 to 4 at most: <h1>my main title</h1> <h2>my top level heading</h2> <h3>my subheading</h3> <h4>my sub-subheading</h4> now try adding a suitable title to your html page just above your <img> element. note: you'll see that your heading level 1 has an implicit style. don't use heading elements to make text bigger or bold, because ...
JavaScript basics - Learn web development
ming. if values couldn't change, then you couldn't do anything dynamic, like personalize a greeting message or change an image displayed in an image gallery. comments comments are snippets of text that can be added along with code. the browser ignores text marked as comments. you can write comments in javascript just as you can in css: /* everything in between is a comment. */ if your comment
contains no line breaks, it's an option to put it behind two slashes like this: // this is a comment operators an operator is a mathematical symbol which produces a result based on two values (or variables). in the following table you can see some of the simplest operators, along with some examples to try in the javascript console. operator explanation symbol(s) example ...
...thing with your mouse. to demonstrate this, enter the following into your console, then click on the current webpage: document.queryselector('html').onclick = function() { alert('ouch! stop poking me!'); } there are many ways to attach an event handler to an element. here we select the <html> element, setting its onclick handler property equal to an anonymous (i.e. nameless) function, which
contains the code we want the click event to run. note that document.queryselector('html').onclick = function() {}; is equivalent to let myhtml = document.queryselector('html'); myhtml.onclick = function() {}; it's just shorter. supercharging our example website with this review of javascript basics completed (above), let's add some new features to our example site. adding an image changer in thi...
... document.queryselector('button'); let myheading = document.queryselector('h1'); add the function below to set the personalized greeting. this won't do anything yet, but this will change soon. function setusername() { let myname = prompt('please enter your name.'); localstorage.setitem('name', myname); myheading.textcontent = 'mozilla is cool, ' + myname; } the setusername() function
contains a prompt() function, which displays a dialog box, similar to alert(). this prompt() function does more than alert(), asking the user to enter data, and storing it in a variable after the user clicks ok. in this case, we are asking the user to enter a name. next, the code calls on an api localstorage, which allows us to store data in the browser and retrieve it later. we use localstorage's setitem...
...an alert(), asking the user to enter data, and storing it in a variable after the user clicks ok. in this case, we are asking the user to enter a name. next, the code calls on an api localstorage, which allows us to store data in the browser and retrieve it later. we use localstorage's setitem() function to create and store a data item called 'name', setting its value to the myname variable which
contains the user's entry for the name. finally, we set the textcontent of the heading to a string, plus the user's newly stored name. add the if ... else block (below). we could call this initialization code, as it structures the app when it first loads. if(!localstorage.getitem('name')) { setusername(); } else { let storedname = localstorage.getitem('name'); myheading.textcontent = 'mozilla is ...
HTML table basics - Learn web development
nd cell. i'm your third cell. i'm your fourth cell. second row, first cell. cell 2. cell 3. cell 4. note: you can also find this on github as simple-table.html (see it live also). adding headers with <th> elements now let's turn our attention to table headers — special cells that go at the start of a row or column and define the type of data that row or column
contains (as an example, see the "person" and "age" cells in the first example shown in this article). to illustrate why they are useful, have a look at the following table example. first the source code: <table> <tr> <td> </td> <td>knocky</td> <td>flor</td> <td>ella</td> <td>juan</td> </tr> <tr> <td>breed</td> <td>jack russell</td> <td>poodle</td> <td>stree...
...e is that, while you can kind of make out what's going on, it is not as easy to cross reference data as it could be. if the column and row headings stood out in some way, it would be much better. active learning: table headers let's have a go at improving this table. first, make a local copy of our dogs-table.html and minimal-table.css files in a new directory on your local machine. the html
contains the same dogs example as you saw above. to recognize the table headers as headers, both visually and semantically, you can use the <th> element ('th' stands for 'table header'). this works in exactly the same way as a <td>, except that it denotes a header, not a normal cell. go into your html, and change all the <td> elements surrounding the table headers into <th> elements. save your html and ...
...owspan attributes, which allow us to do just those things. both accept a unitless number value, which equals the number of rows or columns you want spanned. for example, colspan="2" makes a cell span two columns. let's use colspan and rowspan to improve this table. first, make a local copy of our animals-table.html and minimal-table.css files in a new directory on your local machine. the html
contains the same animals example as you saw above. next, use colspan to make "animals", "hippopotamus", and "crocodile" span across two columns. finally, use rowspan to make "horse" and "chicken" span across two rows. save and open your code in a browser to see the improvement. note: you can find our finished example at animals-table-fixed.html on github (see it live also). providing common st...
...n see the timetable of a languages teacher. on friday she has a new class teaching dutch all day, but she also teaches german for a few periods on tuesday and thursdays. she wants to highlight the columns containing the days she is teaching. recreate the table by following the steps below. first, make a local copy of our timetable.html file in a new directory on your local machine. the html
contains the same table you saw above, minus the column styling information. add a <colgroup> element at the top of the table, just underneath the <table> tag, in which you can add your <col> elements (see the remaining steps below). the first two columns need to be left unstyled. add a background color to the third column. the value for your style attribute is background-color:#97db9a; set a separate...
Drawing graphics - Learn web development
this article provides an introduction to canvas, and further resources to allow you to learn more. prerequisites: javascript basics (see first steps, building blocks, javascript objects), the basics of client-side apis objective: to learn the basics of drawing on <canvas> elements using javascript. ...
...t to retrieve. in this case we want a 2d canvas, so add the following javascript line below the others inside the <script> element: const ctx = canvas.getcontext('2d'); note: other context values you could choose include webgl for webgl, webgl2 for webgl 2, etc., but we won't need those in this article. so that's it — our canvas is now primed and ready for drawing on! the ctx variable now
contains a canvasrenderingcontext2d object, and all drawing operations on the canvas will involve manipulating this object. let's do one last thing before we move on. we'll color the canvas background black to give you a first taste of the canvas api. add the following lines at the bottom of your javascript: ctx.fillstyle = 'rgb(0, 0, 0)'; ctx.fillrect(0, 0, width, height); here we are setting a fill c...
...yourself all the work. creating a loop playing with loops in canvas is rather fun — you can run canvas commands inside a for (or other type of) loop just like any other javascript code. let's build a simple example. make another fresh copy of our canvas template (1_canvas_template.html) and open it in your code editor. add the following line to the bottom of your javascript. this
contains a new method, translate(), which moves the origin point of the canvas: ctx.translate(width/2, height/2); this causes the coordinate origin (0, 0) to be moved to the center of the canvas, rather than being at the top left corner. this is very useful in many situations, like this one, where we want our design to be drawn relative to the center of the canvas. now add the following code t...
...right.png'; image.onload = draw; now we'll add some variables to keep track of the position the sprite is to be drawn on the screen, and the sprite number we want to display. let sprite = 0; let posx = 0; let's explain the spritesheet image (which we have respectfully borrowed from mike thomas' create a sprite sheet walk cycle using css animation). the image looks like this: it
contains six sprites that make up the whole walking sequence — each one is 102 pixels wide and 148 pixels high. to display each sprite cleanly we will have to use drawimage() to chop out a single sprite image from the spritesheet and display only that part, like we did above with the firefox logo. the x coordinate of the slice will have to be a multiple of 102, and the y coordinate will always be 0. the...
Video and Audio APIs - Learn web development
a-label="stop"></button> <div class="timer"> <div></div> <span aria-label="timer">00:00</span> </div> <button class="rwd" data-icon="b" aria-label="rewind"></button> <button class="fwd" data-icon="f" aria-label="fast forward"></button> </div> </div> the whole player is wrapped in a <div> element, so it can all be styled as one unit if needed. the <video> element
contains two <source> elements so that different formats can be loaded depending on the browser viewing the site. the controls html is probably the most interesting: we have four <button>s — play/pause, stop, rewind, and fast forward. each <button> has a class name, a data-icon attribute for defining what icon should be shown on each button (we'll show how this works in the below section), and...
... alphabet equate to common icons you might want to use in an application. next we use generated content to display an icon on each button: we use the ::before selector to display the content before each <button> element. we use the content property to set the content to be displayed in each case to be equal to the contents of the data-icon attribute. in the case of our play button, data-icon
contains a capital "p". we apply the custom web font to our buttons using font-family. in this font, "p" is actually a "play" icon, so therefore the play button has a "play" icon displayed on it. icon fonts are very cool for many reasons — cutting down on http requests because you don't need to download those icons as image files, great scalability, and the fact that you can use text properties to st...
...us ones: rwd.addeventlistener('click', mediabackward); fwd.addeventlistener('click', mediaforward); now on to the event handler functions — add the following code below your previous functions to define mediabackward() and mediaforward(): let intervalfwd; let intervalrwd; function mediabackward() { clearinterval(intervalfwd); fwd.classlist.remove('active'); if(rwd.classlist.
contains('active')) { rwd.classlist.remove('active'); clearinterval(intervalrwd); media.play(); } else { rwd.classlist.add('active'); media.pause(); intervalrwd = setinterval(windbackward, 200); } } function mediaforward() { clearinterval(intervalrwd); rwd.classlist.remove('active'); if(fwd.classlist.
contains('active')) { fwd.classlist.remove('active'); clearint...
...tton after pressing the fwd button, we want to cancel any fast forward functionality and replace it with the rewind functionality. if we tried to do both at one, the player would break. we use an if statement to check whether the active class has been set on the rwd button, indicating that it has already been pressed. the classlist is a rather handy property that exists on every element — it
contains a list of all the classes set on the element, as well as methods for adding/removing classes, etc. we use the classlist.
contains() method to check whether the list
contains the active class. this returns a boolean true/false result. if active has been set on the rwd button, we remove it using classlist.remove(), clear the interval that has been set when the button was first pressed (see below ...
Storing the information you need — Variables - Learn web development
iate. so for example, a simple case would be: let iamalive = true; whereas in reality it would be used more like this: let test = 6 < 3; this is using the "less than" operator (<) to test whether 6 is less than 3. as you might expect, it returns false, because 6 is not less than 3! you will learn a lot more about such operators later on in the course. arrays an array is a single object that
contains multiple values enclosed in square brackets and separated by commas. try entering the following lines into your console: let mynamearray = ['chris', 'bob', 'jim']; let mynumberarray = [10, 15, 40]; once these arrays are defined, you can access each value by their location within the array. try these lines: mynamearray[0]; // should return 'chris' mynumberarray[2]; // should return 40 the squa...
... brackets specify an index value corresponding to the position of the value you want returned. you might have noticed that arrays in javascript are zero-indexed: the first element is at index 0. you'll learn a lot more about arrays in a future article. objects in programming, an object is a structure of code that models a real-life object. you can have a simple object that represents a box and
contains information about its width, length, and height, or you could have an object that represents a person, and
contains data about their name, height, weight, what language they speak, how to say hello to them, and more. try entering the following line into your console: let dog = { name : 'spot', breed : 'dalmatian' }; to retrieve the information stored in the object, you can use the following sy...
...se in a future module. dynamic typing javascript is a "dynamically typed language", which means that, unlike some other languages, you don't need to specify what data type a variable will contain (numbers, strings, arrays, etc). for example, if you declare a variable and give it a value enclosed in quotes, the browser treats the variable as a string: let mystring = 'hello'; even if the value
contains numbers, it is still a string, so be careful: let mynumber = '500'; // oops, this is still a string typeof mynumber; mynumber = 500; // much better — now this is a number typeof mynumber; try entering the four lines above into your console one by one, and see what the results are. you'll notice that we are using a special operator called typeof — this returns the data type of the variable y...
...number; mynumber = 500; // much better — now this is a number typeof mynumber; try entering the four lines above into your console one by one, and see what the results are. you'll notice that we are using a special operator called typeof — this returns the data type of the variable you type after it. the first time it is called, it should return string, as at that point the mynumber variable
contains a string, '500'. have a look and see what it returns the second time you call it. constants in javascript many programming languages have the concept of a constant — a value that once declared can't be changed. there are many reasons why you'd want to do this, from security (if a third party script changed such values it could cause problems) to debugging and code comprehension (it is harder ...
Getting started with Vue - Learn web development
onfig.js: this is the config file for babel, which transforms modern javascript features being used in development code into older syntax that is more cross-browser compatible in production code. you can register additional babel plugins in this file. .browserslistrc: this is a config for browserslist. you can use this to control which browsers your tooling optimizes for. public: this directory
contains static assets that are published, but not processed by webpack during build (with one exception; index.html gets some processing). favicon.ico: this is the favicon for your app. currently, it's the vue logo. index.html: this is the template for your app. your vue app is run from this html page, and you can use lodash template syntax to interpolate values into it. note: this is not th...
... this is the template for your app. your vue app is run from this html page, and you can use lodash template syntax to interpolate values into it. note: this is not the template for managing the layout of your application — this template is for managing static html that sits outside of your vue app. editing this file typically only occurs in advanced use cases. src: this directory
contains the core of your vue app. main.js: this is the entry point to your application. currently, this file initializes your vue application and signifies which html element in the index.html file your app should be attached to. this file is often where you register global components or additional vue libraries. app.vue: this is the top-level component in your vue app. see below for more explan...
...f you look inside the src folder in the project we created with the cli, you'll see your first .vue file: app.vue. let's explore this now. app.vue open your app.vue file — you’ll see that it has three parts: <template>, <script>, and <style>, which contain the component’s template, scripting, and styling information. all single file components share this same basic structure. <template>
contains all the markup structure and display logic of your component. your template can contain any valid html, as well as some vue-specific syntax that we'll cover later. note: by setting the lang attribute on the <template> tag, you can use pug template syntax instead of standard html — <template lang="pug">. we'll stick to standard html through this tutorial, but it is worth knowing that this is p...
...cture and display logic of your component. your template can contain any valid html, as well as some vue-specific syntax that we'll cover later. note: by setting the lang attribute on the <template> tag, you can use pug template syntax instead of standard html — <template lang="pug">. we'll stick to standard html through this tutorial, but it is worth knowing that this is possible. <script>
contains all of the non-display logic of your component. most importantly, your <script> tag needs to have a default exported js object. this object is where you locally register components, define component inputs (props), handle local state, define methods, and more. your build step will process this object and transform it (with your template) into a vue component with a render() function. in the case...
Localizing without a specialized tool
missinginfiles: 6117 missing: 13 0% of entries changed the beauty of the compare-locales output is that it tells you all the missing files and which files you need to add and localize. this will be your guide to localize firefox. localizing step-by-step dtd files in order to provide an example that can be viewed quickly in your ui, we'll start by translating a dtd file named searchbar.dtd that
contains the string "manage search engines...". (strings in the dtd files are called "entities".) "manage search engines..." can easily be found in the firefox browser ui by clicking on the drop-down arrow in the search box in the upper-right corner of your browser. at the bottom of the list of search engines that appears, you'll see, "manage search engines...". to start, make sure you are in /path/to/y...
...er ui by clicking on the drop-down arrow in the search box in the upper-right corner of your browser. at the bottom of the list of search engines that appears, you'll see, "manage search engines...". to start, make sure you are in /path/to/your/working/directory/l10n-mozilla-1.9.2/x-testing and then, type the command mkdir /browser/chrome/browser now, step back out to the broader directory that
contains both your l10n base (l10n-mozilla-1.9.2) and the en-us source code (mozilla-1.9.2). you can do this by typing: cd ../../ where each ".." represents the prior sub directory before the main directory where you want to be. you can always check the path by typing pwd once you are in the root working directory with both en-us source and the l10n base, copy the searchbar.dtd file by typing cp moz...
...inside the quotation marks. be sure to only translate what is in the quotation marks. for the purposes of this tutorial, we will just convert all letters to uppercase, so that the change is visible in the ui. <!entity cmd_enginemanager.label "manage search engines..."> <!entity searchendcap.label "search"> save the file. .properties files the property file "search.properties"
contains the string "add %s". this string can easily be found in the browser ui by visiting a website that provides a search plugin (like http://developer.mozilla.org/) and clicking on the drop-down arrow in the search box in the upper-right corner of your browser. at the second to bottom of the list of search engines that appears, you'll see, "add %s", where %s is replaced by the name of the site. aga...
...r.mozilla.org/) and clicking on the drop-down arrow in the search box in the upper-right corner of your browser. at the second to bottom of the list of search engines that appears, you'll see, "add %s", where %s is replaced by the name of the site. again, to start, make sure you are in /path/to/your/working/directory/l10n-mozilla-1.9.2/x-testing now, step back out to the broader directory that
contains both your l10n base (l10n-mozilla-1.9.2) and the en-us source code (mozilla-1.9.2). you can do this by typing: cd ../../ where each ".." represents the prior sub directory before the main directory where you want to be. you can always check the path by typing pwd once you are in the root working directory with both en-us source and the l10n base, copy the searchbar.dtd file by typing cp moz...
about:memory
irefox instance. if you are using a communication channel where only text can be sent, such as a comment thread on a website, click on the "measure..." button. this will cause a tree-like structure to be generated text within about:memory. this structure is just text, so you can copy and paste some or all of this text into any kind of text buffer. ...
...if you do not wish to share this information, you can select the "anonymize" checkbox before clicking on "measure and save..." or "measure...". ...
... by clicking on them. if you find any particular tree overwhelming, it can be helpful to collapse all the sub-trees immediately below the root, and then gradually expand the sub-trees of interest. sections memory reports are displayed on a per-process basis, with one process per section. within each process's measurements, there are the following subsections. explicit allocations this section
contains a single tree, called "explicit", that measures all the memory allocated via explicit calls to heap allocation functions (such as malloc and new) and to non-heap allocations functions (such as mmap and virtualalloc). here is an example for a browser session where tabs were open to cnn.com, techcrunch.com, and arstechnica.com. various sub-trees have been expanded and others collapsed for the sake...
...ub-tree. for add-ons that use separate windows, such as chatzilla, the memory usage of those windows will show up in this sub-tree. for add-ons that use xul overlays, such as adblock plus, the memory usage of those overlays will not show up in this sub-tree; it will instead be in the non-add-on sub-trees and won't be identifiable as being caused by the add-on. other measurements this section
contains multiple trees, includes many that cross-cut the measurements in the "explicit" tree. for example, in the "explicit" tree all dom and layout measurements are broken down by window by window, but in "other measurements" those measurements are aggregated into totals for the whole browser, as the following example shows. 26.77 mb (100.0%) -- window-objects ├──14.59 mb (54.52%) -- layout │ ...
An overview of NSS Internals
xchange signed/encrypted data with communication partners, using public key encryption simplifies the key management. the environment that describes how to use public key encryption is called public key infrastructure (pki). the public keys that are exchanged between parties are transported using a container; the container is called a certificate, following standard x.509 version 3. a certificate
contains lots of other details; for example, it
contains a signature by a third party that expresses trust in the ownership relationship for the certificate. the trust assigned by the third party might be restricted to certain uses, which are listed in certificate extensions that are contained in the certificate. many (if not most) of the operations performed by nss involve the use of x.509 certificate...
... the rest. it will detect and open an existing database, or it can create a new one. alternatively, should you decide that you don't want to work with any persistent recording of certificates, you may initialize nss in a no-database mode. usually, nss will flush all data to disk as soon as new data has been added to permanent storage. ...
...n create a new one. alternatively, should you decide that you don't want to work with any persistent recording of certificates, you may initialize nss in a no-database mode. usually, nss will flush all data to disk as soon as new data has been added to permanent storage. storage consists of multiple files: a key database file, which
contains your secret keys, and a certificate database file which
contains the public portion of your own certificates, the certificates of peers or cas, and a list of trust decisions (such as to not trust a built-in ca, or to explicitly trust other cas). examples for the database files are key3.db and cert8.db, where the numbers are file version numbers. a third file
contains the list of external pkcs#11 modules that have been registered to be used by nss. the file cou...
...specially when importing data from files. a recent development adds support for loading external pem files that contain private keys, in a software library called nss-pem, which is separately available, but should eventually become a core part of nss. looking at the code level, nss deals with blocks of raw data all the time. the common structure to store such an untyped block is secitem, which
contains a size and an untyped c pointer variable. when dealing with memory, nss makes use of arenas, which are an attempt to simplify management with the limited offerings of c (because there are no destructors). the idea is to group multiple memory allocations in order to simplify cleanup. performing an operation often involves allocating many individual data items, and the code might be required to ...
NSS sources building testing
because nss depends on the base library nspr, you should download the archive that combines both nss and nspr. ...
...torical information: nspr and nss source code have recently been re-organized into a new directory structure. in past versions, all files were located in a directory hierarchy that started with the "mozilla" prefix. the nspr base library was located in directory mozilla/nsprpub. the subdirectories dbm, security/dbm, security/coreconf, security/nss were part of the nss sources.) the nss directory
contains the following important subdirectories: nss/coreconf
contains knowledge for cross platform building. nss/lib
contains all the library code that is used to create the runtime libraries used by applications. nss/cmd
contains a set of various tool programs that are built using nss. several tools are general purpose and can be used to inspect and manipulate the storage files that software ...
... nss/gtests code for nss unit tests running in googletest. it is important to mention the difference between internal nss code and exported interfaces. software that would like to use the nss library must use only the exported interfaces. ...
... test suite has completed, a summary will be printed that shows the number of failures. you can find the test suite results in directory nss/../tests_results (i.e. the results directory ends up next to the nss directory, not within it). each test suite execution will create a new subdirectory; you should clean them up from time to time. inside the directory you'll find text file output.log, which
contains a detailed report of all tests being executed. in order to learn about the details of test failures, search the file for the uppercase test failed. if desired, it's possible to run only subsets of the tests. read the contents of file all.sh to learn how that works. ...
nss tech note1
this was written to be a generic decoder, that includes both der (distinguished encoding rules) and ber (basic encoding rules).† it handles both streaming and non-streaming input. the "quickder" decoder, written by julien pierre for nss 3.6 . this decoder was written when performance issues were discovered with the classic decoder. ...
...endent on the content of the decoder templates.† this typically points to a struct that is described (or partially described) by the templates. prarenapool* arena is a pointer to an nspr arena pool. this is the arena pool from which the decoder will allocate memory as needed. decoder templates : the sec_asn1template structure tells the decoder what to do with the input data. this structure
contains four fields : kind . this 32-bit field tells the decoder what to do with a particular component within the input data. it is made of two parts : the lower byte, which can contain asn.1 tags, and the upper 3 bytes, which can contain decoder modifiers. if only an asn.1 tag is specified without a modifier, then the decoder will enforce the presence of a component of that type, and fail if it do...
...some modifiers where noted.when needed, it tells the decoder where in the target data to save the current component. it is normally relative to the dest argument passed to the decoder. if templates are nested, the offset applies to the location of the current component within the target component, typically the decoded sequence. sub† . this field does not apply to all template types. if kind
contains the sec_asn1_inline or sec_asn1_pointer modifiers, then it must point to the required subtemplate. if kind
contains the sec_asn1_xtrn or sec_asn1_dynamic modifiers, this is a pointer to a callback function that will dynamically return the required subtemplate. size† . this field does not apply to all template types. it is only required for dynamically allocating memory for the structure if t...
... is typically used for sec_asn1_sequence or sec_asn1_choice definitions, which always need to be the first template in a template array of their own. sec_asn1_pointer: similar to sec_asn1_inline, except that the memory in the target will be allocated dynamically and a pointer to the dynamically allocated memory will be stored in the dest struct at the offset. this requires that the subtemplate
contains a non-zero size field. sec_asn1_group: can only be used in conjunction with a sec_asn1_set or sec_asn1_sequence. it tells the decoder that the component is an asn.1 set of or sequence of respectively. you can also use the macros sec_asn1_set_of and sec_asn1_sequence_of which define both the tag number and this modifier (but still need the method type, this may be a bug). sec_asn1_dynamic or...
NSS Tools certutil
"yymmddhhmmss+hhmm" or "yymmddhhmmss-hhmm". if this option is not used, the validity check defaults to the current system time. -c issuer identify the certificate of the ca from which a new certificate will derive its authenticity. use the exact nickname or alias of the ca certificate, or use the ca's email address. bracket theissuer string with quotation marks if it
contains spaces. -d directory specify the database directory containing the certificate and key database files. on unix the certificate database tool defaults to $home/.netscape (that is, ~/.netscape). on windows nt the default is the current directory. the cert8.db and key3.db database files must reside in the same directory. -p dbprefix sp...
...ber assign a unique serial number to a certificate being created. this operation should be performed by a ca. the default serial number is 0 (zero). serial numbers are limited to integers. -n nickname specify the nickname of a certificate or key to list, create, add to a database, modify, or validate. bracket the nickname string with quotation marks if it
contains spaces. -o output-file specify the output file name for new certificates or binary certificate requests. bracket theoutput-file string with quotation marks if it
contains spaces. if this argument is not used the output destination defaults to standard output. -p phone specify a contact telephone number to include in new certificates or c...
... -q pqgfile read an alternate pqg value from the specified file when generating dsa key pairs. if this argument is not used, the key database tool generates its own pqg value. pqg files are created with a separate dsa utility. ...
... generates its own pqg value. pqg files are created with a separate dsa utility. -r display a certificate's binary der encoding when listing information about that certificate with the -l option. -s subject identify a particular certificate owner for new certificates or certificate requests. bracket this string with quotation marks if it
contains spaces. the subject identification format follows rfc 1485. -t trustargs specify the trust attributes to modify in an existing certificate or to apply to a certificate when creating it or adding it to a database. there are three available trust categories for each certificate, expressed in this order: "ssl ,email ,object signing ". in each category position use ...
NSS Tools modutil
ot recommended. -libfile library-file specify a path to the dll or other library file containing the implementation of the pkcs #11 interface module that is being added to the database. -ciphers cipher-enable-list enable specific ciphers in a module that is being added to the database. the cipher-enable-list is a colon-delimited list of cipher names. enclose this list in quotation marks if it
contains spaces. the following cipher is currently available: fortezza. -mechanisms mechanism-list specify the security mechanisms for which a particular module will be flagged as a default provider. the mechanism-list is a colon-delimited list of mechanism names. enclose this list in quotation marks if it
contains spaces. the module becomes a default provider for the listed mechanisms when those mechan...
... module: -fips [true | false] disabling interactive prompts for the security module database tool, to support scripted operation: -force jar installation file when a jar file is run by a server, by the security module database tool, or by any program that does not interpret javascript, a special information file must be included in the format described below. this information file
contains special scripting and must be declared in the jar archive's manifest file. the script can have any name. the metainfo tag for this is pkcs11_install_script. to declare meta-information in the manifest file, put it in a file that is passed to the netscape signing tool. sample script for example, the pkcs #11 installer script could be in the file pk11install. if so, the metainfo file for th...
...cannot be found in the list of supported platforms, then the forwardcompatible list is checked for any platforms that have the same os and architecture in an earlier version. if one is found, its attributes are used for the current platform. platforms (required) gives a list of platforms. each entry in the list is itself a key-value pair: the key is the name of the platform and the value list
contains various attributes of the platform. the modulename, modulefile, and files attributes must be specified for each platform unless an equivalentplatform attribute is specified. the platform string is in the following format: system name:os release:architecture. the installer obtains these values from nspr. os release is an empty string on non-unix operating systems. the following system names and pl...
... netscape security module database. modulefile (required) names the pkcs #11 module file (dll or .so) for this platform. the name is given as the relative path of the file within the jar archive. files (required) lists the files that need to be installed for this module. each entry in the file list is a key-value pair: the key is the path of the file in the jar archive, and the value list
contains attributes of the file. at least relativepath or absolutepath must be specified for each file. defaultmechanismflags specifies mechanisms for which this module will be a default provider. this key-value pair is a bitstring specified in hexadecimal (0x) format. it is constructed as a bitwise or of the following constants. if the defaultmechanismflags entry is omitted, the value defaults to 0x0...
JSPropertyOp
s_defineproperty or js_defineproperties) it can specify getter and setter callbacks for the new property. getters. the getter callback is called each time javascript code accesses the property's value using the syntax obj.prop or obj[propname]. it is also called when the property's value is accessed via jsapi functions such as js_getproperty or (less obviously) js_callfunctionname. on entry, *vp
contains the property's stored value or undefined if the property doesn't have a stored value. the callback may modify *vp. on success, the callback returns true and the value left in *vp is returned to the script or jsapi caller. setters. the setter callback is called each time javascript code assigns to the property using any assignment operator (=, +=, etc.) or the ++ or -- operators. it is also calle...
.... the callback may modify *vp. on success, the callback returns true and the value left in *vp is returned to the script or jsapi caller. setters. the setter callback is called each time javascript code assigns to the property using any assignment operator (=, +=, etc.) or the ++ or -- operators. it is also called when the property is set via jsapi functions such as js_setproperty. on entry, *vp
contains the value being assigned to the property. the callback may modify *vp. on success, the callback returns true. if the property has a stored value, it is then updated to the value left in *vp after the callback. as of spidermonkey 1.7, the value of a property assignment expression, like (a.length = x), is the value of *vp after the setter is called. this is typically the value of the left-hand sid...
...operty is being accessed, not the object on which the property was defined. jsclass hooks jsclass offers following hooks: jspropertyop jsclass.addproperty is called just after a new property is added to an object. this happens when a program sets a property that isn't already an own property of the target object. it also happens in jsapi functions such as js_defineproperty. on entry, *vp
contains the value provided by the code defining or setting the property. the callback may modify *vp. on success, the post-callback value of *vp becomes the initial stored value of the new property. in js_threadsafe builds, this callback is called with obj locked. it is therefore dangerous for the callback to call jsapi functions, particularly if obj may have been visible to more than one thread. ...
... locked. it is therefore dangerous for the callback to call jsapi functions, particularly if obj may have been visible to more than one thread. jsclass.getproperty is the default getter for new properties. see the section on getters and setters above. jsclass.getproperty is also called when a program attempts to get a property that does not exist on obj or any prototype. on entry, *vp
contains the property's stored value, or undefined if the property doesn't exist or doesn't have a stored value. the callback may modify *vp. on success, the post-callback value of *vp is returned to the caller. this value also becomes the property's new stored value, if the property exists and has a stored value. jsstrictpropertyop jsclass.setproperty is the default setter for new properties. s...
Parser API
properties of the reflect object the reflect object currently consists of a single method. reflect.parse(src[, options]) coerces src to a string and parses the result as a javascript program. by default, the parsing returns a program object (see below) representing the parsed abstract syntax tree (ast). additional options may be provided via the options object, which c...
... ]; rest: identifier | null; body: blockstatement | expression; generator: boolean; expression: boolean; } a function declaration or expression. the body of the function may be a block statement, or in the case of an expression closure, an expression. note: expression closures are spidermonkey-specific. if the generator flag is true, the function is a generator function, i.e.,
contains a yield expression in its body (other than in a nested function). note: generators are spidermonkey-specific. if the expression flag is true, the function is an expression closure and the body field is an expression. statements interface statement <: node { } any statement. interface emptystatement <: statement { type: "emptystatement"; } an empty statement, i.e., a solitary semicolo...
... a continue statement. interface withstatement <: statement { type: "withstatement"; object: expression; body: statement; } a with statement. interface switchstatement <: statement { type: "switchstatement"; discriminant: expression; cases: [ switchcase ]; lexical: boolean; } a switch statement. the lexical flag is metadata indicating whether the switch statement
contains any unnested let declarations (and therefore introduces a new lexical scope). interface returnstatement <: statement { type: "returnstatement"; argument: expression | null; } a return statement. interface throwstatement <: statement { type: "throwstatement"; argument: expression; } a throw statement. interface trystatement <: statement { type: "trystatement"; block:...
...tement | null loc: sourcelocation returns: customstatement callback to produce a custom if statement node. switchstatement(disc, cases, islexical[, loc]) disc: customexpression cases: [ customswitchcase ] islexical: boolean loc: sourcelocation returns: customstatement callback to produce a custom switch statement node. the islexical flag is metadata indicating whether the switch statement
contains any unnested let declarations (and therefore introduces a new lexical scope). whilestatement(test, body[, loc]) test: customexpression body: customstatement loc: sourcelocation returns: customstatement callback to produce a custom while statement node. dowhilestatement(body, test[, loc]) body: customstatement test: customexpression loc: sourcelocation returns: customstatement callback t...
The Places database
by the history service (see also history service design). any time a places component wants to reference a url, whether visited or not, it refers to this table. each entry has an optional reference to the moz_favicon table to identify the favicon of the page. no two entries may have the same value in the url column. moz_hosts: one entry in this table is created each time you visit a new host. it
contains the host url, frequency of access, if typed or not, and it's prefix (https://, ftp://, etc). history tables moz_historyvisits: one entry in this table is created each time you visit a page. it
contains the date, referrer, and other information specific to that visit. it
contains a reference to the moz_places table which
contains the url and other global statistics. see history service desi...
...the hierarchy is defined via the parent column, which points to the moz_bookmarks record which is the parent. ...
... table. bookmarks, folders and separators are descendants of the bookmarks root, while tags and tagged uris are descendants of the tag root. moz_keywords: this table is a unique list of keywords. the moz_bookmarks table has a keyword_id column that maps to a record in moz_keywords table. see manipulating bookmarks using places for more information. annotation tables moz_anno_attributes:
contains the names of all the annotations in the system and a name id. there should be relatively few unique names. moz_annos:
contains the values of page annotations. it maps a page (reference to moz_places) and an annotation name (reference to moz_anno_attributes) to the value of the annotation. moz_items_annos:
contains the values of bookmark item annotations. it maps a bookmark, folder or sepa...
...one or more pages in moz_places refer to each entry. when no pages reference a favicon, the icon entry will be deleted. ...
nsAutoString
class declaration nstautostring_chart subclass of nststring_chart that adds support for stack-based string allocation. it is normally not a good idea to use this class on the heap, because it will allocate space which may be wasted if the string it
contains is significantly smaller or any larger than 64 characters. names: nsautostring for wide characters nscautostring for narrow characters method overview constructors operator= get find rfind rfindchar findcharinset rfindcharinset equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat b...
...onst - source parameters prunichar* astring print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar achar print32 aoffset print32 acount findcharinset print32 findcharinset(const char*, print32) const - source this method searches this string for the first character found in the given string. ...
...rinset(const nsstring&, print32) const - source parameters nsstring& astring print32 aoffset print32 findcharinset(const prunichar*, print32) const - source parameters prunichar* astring print32 aoffset rfindcharinset print32 rfindcharinset(const prunichar*, print32) const - source this method searches this string for the last character found in the given string. ...
...ing(const nsstring&, const nsstring&) - source parameters nsstring& atarget nsstring& anewvalue void replacesubstring(const prunichar*, const prunichar*) - source parameters prunichar* atarget prunichar* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset --
contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes surrounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string. you c...
nsCAutoString
class declaration nstautostring_chart subclass of nststring_chart that adds support for stack-based string allocation. it is normally not a good idea to use this class on the heap, because it will allocate space which may be wasted if the string it
contains is significantly smaller or any larger than 64 characters. names: nsautostring for wide characters nscautostring for narrow characters method overview constructors operator= get find rfind rfindchar findcharinset rfindcharinset compare equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring ...
...ing prbool aignorecase print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar achar print32 aoffset print32 acount findcharinset print32 findcharinset(const char*, print32) const - source this method searches this string for the first character found in the given string. ...
...eturn offset in string, or knotfound parameters char* astring print32 aoffset print32 findcharinset(const nscstring&, print32) const - source parameters nscstring& astring print32 aoffset rfindcharinset print32 rfindcharinset(const char*, print32) const - source this method searches this string for the last character found in the given string. ...
...onst nscstring&, const nscstring&) - source parameters nscstring& atarget nscstring& anewvalue void replacesubstring(const char*, const char*) - source parameters char* atarget char* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. ...
nsIEffectiveTLDService
wn if the hostname in auri is empty. ns_error_insufficient_domain_levels this exception is thrown if there were insufficient subdomain levels in the hostname to satisfy the requested aadditionalparts value. ns_error_host_is_ip_address this exception is thrown if auri is a numeric ipv4 or ipv6 address. ns_error_unexpected or other error returned by nsiidnservice.normalize() when the hostname
contains characters disallowed in uris. getbasedomainfromhost() returns the base domain of a host string. otherwise identical to getbasedomain(). note: it is strongly recommended that you use getbasedomain() if a suitable nsiuri is available. only use this method if this is not the case. acstring getbasedomainfromhost( in autf8string ahost, in pruint32 aadditionalparts optional ); parameters ...
... number of domain name parts to be returned in addition to the public suffix. return value an acstring containing the base domain (public suffix plus the requested number of additional parts). exceptions thrown ns_error_invalid_arg this exception is thrown if ahost is empty. ns_error_unexpected this exception originates in the normalize() method in nsiidnservice and is thrown when ahost
contains characters disallowed in uris. ns_error_insufficient_domain_levels this exception is thrown if there were insufficient subdomain levels in the hostname to satisfy the requested aadditionalparts value. ns_error_host_is_ip_address this exception is thrown if ahost is a numeric ipv4 or ipv6 address. remarks note: prior to gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1), this method w...
...; parameters auri the uri to be analyzed. return value an acstring containing the public suffix. exceptions thrown ns_error_invalid_arg this exception is thrown if the hostname in auri is empty. ns_error_host_is_ip_address this exception is thrown if auri is a numeric ipv4 or ipv6 address. ns_error_unexpected or other error returned by nsiidnservice.normalize() when the hostname
contains characters disallowed in uris. getpublicsuffixfromhost() returns the public suffix of a host string. otherwise identical to getpublicsuffix(). note: it is strongly recommended to use getbasedomain() if a suitable nsiuri is available. only use this method if this is not the case. acstring getpublicsuffixfromhost( in autf8string ahost ); parameters ahost the host string to be analyzed.
...this is not the case. acstring getpublicsuffixfromhost( in autf8string ahost ); parameters ahost the host string to be analyzed. return value an acstring containing the public suffix. exceptions thrown ns_error_invalid_arg this exception is thrown if ahost is empty. ns_error_unexpected this exception originates in the normalize() method in nsiidnservice and is thrown when ahost
contains characters disallowed in uris. ns_error_host_is_ip_address this exception is thrown if ahost is a numeric ipv4 or ipv6 address. remarks all returned strings are encoded in ascii/ace and normalized according to rfc 3454. ...
Index
rd this article provides examples on accessing and manipulating thunderbird accounts. account interfaces provides an overview of the related interfaces. see an overview of thunderbird components for a general description of the thunderbird user interface and related programmatic interfaces. 4 account interfaces code snippets, extension development, thunderbird this page
contains a list of the interfaces that you'll will most likely use when writing extensions that work with email or other accounts. see account examples for examples and code snippets. 5 activity manager thunderbird 3, thunderbird the activity manager is a simple component that understands how to display a combination of user activity and history. the activity manager works in conjunct...
...his page describes the programmatic interfaces behind the activity manager component. the functionality of the component is described on the activity manager page, and the activity manager examples page has code snippets. see nsiactivitymanager.idl and nsiactivity.idl files for source documentation. 7 address book interfaces mailnews, mozilla, seamonkey, thunderbird this page
contains a list of the interfaces that you'll will most likely hit when writing patches for the address book or writing extensions. the complete list of interfaces for the address book can be found here. address book examples show how to perform various tasks and provide code snippets. 8 address book examples mailnews, seamonkey, thunderbird this article provides examples on accessing...
...them. 25 filelink providers thunderbird filelink is a thunderbird feature that makes it easy for users to upload large attachments to web-based storage services such as hightail. 26 nsimsgcloudfileprovider nsimsgcloudfileprovider is the interface that must be implemented by new filelink providers. 27 folder pane interfaces this page
contains a list of the interfaces that you'll will most likely use when writing extensions that affect the folder pane. see working with the folder pane for examples and code snippets. 28 gloda thunderbird 3, thunderbird thunderbird includes a new message indexing and search system (gloda) that improves search performance, provides sophisticated full-text search capabilities and cate...
...n be enhanced and customized via extensions. 75 building a thunderbird extension 2: extension file layout extensions, thunderbird extensions are packaged and distributed in archive files (also known as bundles), with the xpi (pronounced “zippy”) file extension. at a minimum, they contain an install.rdf, the chrome.manifest and a chrome/ folder. a content/ folder sometimes
contains the actual content files. these files contain the code that makes your extension actually do something. when this tutorial is finished, our extension will look like this: 76 building a thunderbird extension 3: install manifest extensions, thunderbird the install.rdf file is an xml file that provides general information about the extension. 77 building a thunderbir...
Working with windows in chrome code
opening windows from a <script> in a window or an overlay to open a new window, we usually use a window.open or window.opendialog dom call, like this: var win = window.open("chrome://myextension/content/about.xul", "aboutmyextension", "chrome,centerscreen"); the first parameter to window.open is the uri of the xul file that describes the window and its contents. ...
...bject note the win variable in the above section, which is assigned the return value of window.open. it can be used to access the opened window. the return value of window.open (and similar methods) is a window object (usually chromewindow) – the same type as the window variable. technically speaking, it implements a number of interfaces, including nsidomjswindow and nsidomwindow, but it also
contains the user-defined properties for global variables and functions of the window. so, for example, to access the dom document corresponding to the window, you can use win.document. note however, that the open() call returns before the window is fully loaded, so some calls, like win.document.getelementbyid() will fail. to overcome this difficulty, you can move the initialization code to a load handle...
...ever, that the open() call returns before the window is fully loaded, so some calls, like win.document.getelementbyid() will fail. to overcome this difficulty, you can move the initialization code to a load handler of the window being opened or pass a callback function, as described below. you can get a window object from a document using document.defaultview. content windows when a xul window
contains a widget capable of displaying a page, such as <browser> or <iframe>, the document in that widget is, naturally, separate from the document of the chrome window itself. there also is a window object for each sub-document, although there's no window in a common sense for the sub-document. the same holds for chrome windows opened inside a tab of <tabbrowser>. the elements above the chrome document...
... when you're sure that your window was opened from one of a few well-known places. in more complicated cases you need to use the nsiwindowmediator interface, introduced above. one case in which you might want to use nsiwindowmediator is in an extension's options window. suppose you're developing a browser extension that consists of a browser.xul overlay and an options window. suppose the overlay
contains a button to open the extension's options window which needs to read some data from the browser window. as you may remember, firefox's extension manager can also be used to open your options dialog. this means the value of window.opener in your options dialog is not necessarily the browser window -- instead, it might be the extension manager window. you could check the location property of the op...
URLs - Plugins
npp_urlnotify. without this notification, the plug-in cannot tell whether a request with a null target failed or a request with a non-null target was completed. nperror npn_geturlnotify(npp instance, const char* url, const char* target, void* notifydata); the instance, url, and target parameters have the same definitions as those of npn_geturl. the notifydata parameter
contains private plug-in data that can be used to associate the request with the subsequent npp_urlnotify call (which returns this value) and/or to pass a pointer to some request-related payload. if a request is not completed successfully (for example, because the url is invalid or an http server is down), the browser should call npp_urlnotify as soon as possible. if a request completes successfully, and...
...plug-in of the result of a request. both functions pass the notifydata value to npp_urlnotify, which tells the plug-in that the url request was completed and the reason for completion. void npp_urlnotify(npp instance, const char* url, npreason reason, void* notifydata); the instance and url parameters have the same definitions as those of npn_geturl. the notifydata parameter
contains the private plug-in data passed to the corresponding call to npn_geturlnotify and npn_posturlnotify. warning: in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1), npn_geturlnotify() does not notify the plug-in if notifydata is null. see bug 638367 for details. getting the url and displaying the page to retrieve a url and display it on a specified target page, you use the npn_geturl and ...
...it returns immediately and only later handles the request and calls npp_notify (which, in turn, calls npp_urlnotify). nperror npn_posturl(npp instance, const char *url, const char *target, uint32 len, const char *buf, npbool file); the instance, url, and target parameters have the same definitions as those of npn_geturl. the buf parameter identifies a local temporary file or data buffer that
contains the data to post. windows and mac if a file is posted with any protocol other than ftp, the file must be text with unix-style line breaks ('\n' separators only). npn_posturl works identically with buffers and files. to post data from a memory buffer, set the flag file to false, the buffer buf to the data to post, and len to the length of the buffer. possible url types include http (similar to...
...he request. npn_posturlnotify is typically asynchronous: it returns immediately and only later handles the request and calls npp_urlnotify. nperror npn_posturlnotify( npp instance, const char *url, const char *target, uint32 len, const char *buf, npbool file, void* notifydata ); the parameters of this function have the same definitions as those of npn_posturl. the notifydata parameter
contains plug-in-private data passed by npp_urlnotify and may be used for tracking multiple posts. posting data to an http server the following code posts two name-value pairs to a cgi script through http. the response from the server is displayed in a new window. char* ppostdata = "content-type:\tapplication/x-www-form-urlencoded\ncontent-length:\t17\n\nname=aaashun@gmail.com\n"; uint32 npostdata...
DOM Inspector internals - Firefox Developer Tools
other top-level inspectors which differ slightly (the object inspector and dom inspector sidebar used in seamonkey). initially, we will begin by focusing on inspector.xul and its entry point, and then expand our focus later to explain how these other inspectors differ. dom inspector from a high-level perspective the dom inspector primary ui consists of some toolbars and a panelset. the panelset
contains two panels. one panel reacts to changes to the inspected document, and the other panel reacts to changes to the selection in the first panel. these are the document panel and the object panel, respectively. (internally, a panel may be loosely referred to as a "pane", but a panelset is always referred to as a "panelset".) a panel's purpose is to manage available viewers. at the top of each panel ...
...nel reacts to changes to the inspected document, and the other panel reacts to changes to the selection in the first panel. these are the document panel and the object panel, respectively. (internally, a panel may be loosely referred to as a "pane", but a panelset is always referred to as a "panelset".) a panel's purpose is to manage available viewers. at the top of each panel is a toolbar which
contains a menu button allowing you to choose which viewer to display from the viewer list, a label displaying the name of the currently active viewer, and another menu button allowing you to issue viewer-specific commands. viewers are dynamically loaded; when the panel is made to switch from one viewer to another, the old viewer is destroyed, and the new viewer is loaded in its place. in this way, the p...
...tly active viewer, and another menu button allowing you to issue viewer-specific commands. viewers are dynamically loaded; when the panel is made to switch from one viewer to another, the old viewer is destroyed, and the new viewer is loaded in its place. in this way, the panelset and panels function like a frameset and frames. this comparison turns out to be quite apt, since each panel actually
contains an anonymous browser, and individual viewers exist in separate documents loaded in the browser. this separation allows for viewers to be self-contained, with a viewer's xul defined in its own document and loaded in its own scope, without fear of collisions in the xul, css, or js. another convenient consequence of this is that if you use a properly set up development profile, then for the most par...
... host application. (above, seamonkey and firefox, respectively.) there are several overlays from the resources/contents/ directory that do not fall into the category of host-integration overlays. that's because dom inspector also uses shared overlays to build up its own ui. shared structure overlays taking a look at the contents of inspector.xul, dom inspector's primary ui, will reveal that it
contains almost no visible elements. as of this writing, there's a toolbox containing an empty menubar and an empty toolbar, as well as an empty vbox: <toolbox id="tbxinstoolbox"> <menubar id="mbrinspectormain"/> <toolbar id="tbinspectorprimary"/> </toolbox> <vbox id="bxinspectormain" flex="1"/> there are no menus, toolbar items, et cetera defined here. even most of the elements that are...
Debugger.Object - Firefox Developer Tools
ee function, or not a function at all, this is undefined. boundthis if the referent is a bound debuggee function, this is the this value it was bound to. if the referent is either not a bound function, not a debuggee function, or not a function at all, this is undefined. boundarguments if the referent is a bound debuggee function, this is an array (in the debugger object’s compartment) that
contains the debuggee values of the arguments object it was bound to. if the referent is either not a bound function, not a debuggee function, or not a function at all, this is undefined. isproxy if the referent is a (scripted) proxy, either revoked or not, return true. if the referent is not a (scripted) proxy, return false. proxytarget if the referent is a non-revoked (scripted) proxy, return a debu...
...values of then() calls on the promise. return values of promise.all() if the referent promise was passed in as one of the arguments. return values of promise.race() if the referent promise was passed in as one of the arguments. once a promise is settled, it will generally notify its dependent promises and forget about them, so this is most useful on pending promises. note that the array only
contains the promises that directly depend on the referent promise. it does not contain promises that depend on promises that depend on the referent promise. if the referent is not a promise, throw a typeerror exception. promiselifetime if the referent is a promise, this is the number of milliseconds elapsed since the promise was created. if the referent is not a promise, throw a typeerror exception.
...ent is a global object, evaluatecode in that global environment, and return a completion value describing how it completed.code is a string. all extant handler methods, breakpoints, and so on remain active during the call. this function follows the invocation function conventions. if the referent is not a global object, throw a typeerror exception. codeis interpreted as strict mode code when it
contains a use strict directive. this evaluation is semantically equivalent to executing statements at the global level, not an indirect eval. regardless ofcode being strict mode code, variable declarations incode affect the referent global object. theoptions argument is as for debugger.frame.prototype.eval. executeinglobalwithbindings(code,bindings, [options]) like executeinglobal, but evaluate...
...tatement:code may access, assign to, and delete the introduced bindings without having any effect on thebindings object.) this method allows debugger code to introduce temporary bindings that are visible to the given debuggee code and which refer to debugger-held debuggee values, and do so without mutating any existing debuggee environment. note that, like executeinglobal, any declarations it
contains affect the referent global object, even ascode is evaluated in an environment extended according tobindings. (in the terms used by the ecmascript specification, the variableenvironment of the execution context forcode is the referent, and thebindings appear in a new declarative environment, which is the eval code’s lexicalenvironment.) theoptions argument is as for debugger.frame.prototype.ev...
CharacterData - Web APIs
this is an abstract interface, meaning there aren't any object of type characterdata: it is implemented by other interfaces, like text, comment, or processinginstruction which aren't abstract. ...
... returns the element immediately prior to the specified one in its parent's children list, or null if the specified element is the first one in the list. methods inherits methods from its parent, node, and implements the childnode and nondocumenttypechildnode interface. ...
...implements the childnode and nondocumenttypechildnode interface. characterdata.appenddata() appends the given domstring to the characterdata.data string; when this method returns, data
contains the concatenated domstring. characterdata.deletedata() removes the specified amount of characters, starting at the specified offset, from the characterdata.data string; when this method returns, data
contains the shortened domstring. characterdata.insertdata() inserts the specified characters, at the specified offset, in the characterdata.data string; when this method returns, data
contains the modified domstring. childnode.remove() removes the object from its parent children list. characterdata.replacedata() replaces the specified amount of characters, starting at the specified offset, with t...
... characterdata.substringdata() returns a domstring containing the part of characterdata.data of the specified length and starting at the specified offset. ...
HTMLMediaElement - Web APIs
nly returns a unsigned short (enumeration) indicating the current state of fetching the media over the network. htmlmediaelement.paused read only returns a boolean that indicates whether the media element is paused. htmlmediaelement.playbackrate is a double that indicates the rate at which the media is being played back. htmlmediaelement.played read only returns a timeranges object that
contains the ranges of the media source that the browser has played, if any. htmlmediaelement.preload is a domstring that reflects the preload html attribute, indicating what data should be preloaded, if any. possible values are: none, metadata, auto. htmlmediaelement.preservespitch is a boolean that determines if the pitch of the sound will be preserved. if set to false, the pitch will adjust to th...
...itch of the sound will be preserved. if set to false, the pitch will adjust to the speed of the audio. this is implemented with prefixes in firefox (mozpreservespitch) and webkit (webkitpreservespitch). htmlmediaelement.readystate read only returns a unsigned short (enumeration) indicating the readiness state of the media. htmlmediaelement.seekable read only returns a timeranges object that
contains the time ranges that the user is able to seek to, if any. htmlmediaelement.seeking read only returns a boolean that indicates whether the media is in the process of seeking to a new position. htmlmediaelement.sinkid read only returns a domstring that is the unique id of the audio device delivering output, or an empty string if it is using the user agent default. this id should be one of t...
...mediaelement.sinkid read only returns a domstring that is the unique id of the audio device delivering output, or an empty string if it is using the user agent default. this id should be one of the mediadeviceinfo.deviceid values returned from mediadevices.enumeratedevices(), id-multimedia, or id-communications. htmlmediaelement.src is a domstring that reflects the src html attribute, which
contains the url of a media resource to use. htmlmediaelement.srcobject is a mediastream representing the media to play or that has played in the current htmlmediaelement, or null if not assigned. htmlmediaelement.texttracks read only returns the list of texttrack objects contained in the element. htmlmediaelement.videotracks read only returns the list of videotrack objects contained in the elemen...
...) directly seeks to the given time. htmlmediaelement.load() resets the media to the beginning and selects the best available source from the sources provided using the src attribute or the <source> element. htmlmediaelement.mozcapturestream() [enter description] htmlmediaelement.mozcapturestreamuntilended() [enter description] htmlmediaelement.mozgetmetadata() returns object, which
contains properties that represent metadata from the playing media resource as {key: value} pairs. a separate copy of the data is returned each time the method is called. this method must be called after the loadedmetadata event fires. htmlmediaelement.pause() pauses the media playback. htmlmediaelement.play() begins playback of the media. htmlmediaelement.seektonextframe() seeks to the next fra...
PaymentRequest.PaymentRequest() - Web APIs
the paymentrequest() constructor creates a new paymentrequest object which will be used to handle the process of generating, validating, and submitting a payment request. syntax var paymentrequest = new paymentrequest(methoddata, details, [options]); parameters methoddata
contains an array of identifiers for the payment methods the merchant web site accepts and any associated payment method specific data. each item in the array
contains the following fields: supportedmethods for early implementations of the spec, this was a sequence of identifiers for payment methods that the merchant website accepts. starting with more recent browsers, this parameter is more generic than credit cards, it is a single domstring, and the meaning of the data parameter changes with the supportedmethods...
...e. data a json-serializable object that provides optional information that might be needed by the supported payment methods. this has to conform to the type expected by the payment handler indicated by supportedmethods. for basic credit card services, this structure should match the basiccardrequest dictionary. details provides information about the requested transaction. this parameter
contains the following fields: total the total amount of the payment request. id optional a free-form identifier for this payment request. if a value is not supplied, the browser will construct one. displayitems an array of optional line items for the payment request that the user agent may display, such as product details, tax, and shipping. shippingoptions the shipping options the user...
...oduct details, tax, and shipping. shippingoptions the shipping options the user may choose from. if this sequence is blank, it indicates the merchant cannot ship to the current shipping address. the default shipping option may be indicated in this sequence. modifiers modifiers for specific payment methods; for example, adjusting the total amount based on the payment method. this parameter
contains the following fields: additionaldisplayitems an array of items to be appended to the details.displayitems property. this property is commonly used to add a discount or surcharge line item indicating the different amount in details.modifiers.total. data a json-serializable object that provides optional information that might be needed by the supported payment methods. this has to co...
...t methods. this has to conform to the structure defined in the basiccardrequest dictionary. total a total amount for the payment request that overrides value in details.total. this is typically used when details.modifiers.additionalitems adds a discount or a surchase to the request. options optional lets you set options that control the behavior of the user agent. this parameter
contains the following fields: requestpayername a boolean indicating whether the user agent should collect the payer's name and submit it with the payment request. the default is false. requestpayeremail a boolean indicating whether the user agent should collect the payer's email address and submit it with the payment request. the default is false. requestpayerphone a boolean indicating wh...
Request - Web APIs
the request interface of the fetch api represents a resource request. you can create a new request object using the request() constructor, but you are more likely to encounter a request object being returned as the result of another api operation, such as a service worker fetchevent.request. constructor request() creates a new request object. properties request.cache read only
contains the cache mode of the request (e.g., default, reload, no-cache). request.context read only
contains the context of the request (e.g., audio, image, iframe, etc.) request.credentials read only
contains the credentials of the request (e.g., omit, same-origin, include). the default is same-origin. request.destination read only returns a string from the requestdestination enum describing the req...
... the request (e.g., audio, image, iframe, etc.) request.credentials read only
contains the credentials of the request (e.g., omit, same-origin, include). the default is same-origin. request.destination read only returns a string from the requestdestination enum describing the request's destination. this is a string indicating the type of content being requested. request.headers read only
contains the associated headers object of the request. request.integrity read only
contains the subresource integrity value of the request (e.g., sha256-bpfbw7ivv8q2jlit13fxdyae2tjllusrsz273h2nfse=). ...
...ing from the requestdestination enum describing the request's destination. this is a string indicating the type of content being requested. request.headers read only
contains the associated headers object of the request. request.integrity read only
contains the subresource integrity value of the request (e.g., sha256-bpfbw7ivv8q2jlit13fxdyae2tjllusrsz273h2nfse=). request.method read only
contains the request's method (get, post, etc.) request.mode read only
contains the mode of the request (e.g., cors, no-cors, same-origin, navigate.) request.redirect read only
contains the mode for how redirects are handled. ...
...quest (e.g., sha256-bpfbw7ivv8q2jlit13fxdyae2tjllusrsz273h2nfse=). request.method read only
contains the request's method (get, post, etc.) request.mode read only
contains the mode of the request (e.g., cors, no-cors, same-origin, navigate.) request.redirect read only
contains the mode for how redirects are handled. it may be one of follow, error, or manual. request.referrer read only
contains the referrer of the request (e.g., client). request.referrerpolicy read only
contains the referrer policy of the request (e.g., no-referrer). request.url read only
contains the url of the request. request implements body, so it also inherits the following properties: body read only a simple getter used to expose a readablestream of the body contents. bodyused read only stores a bo...
Web Speech API - Web APIs
er interface for the recognition service; this also handles the speechrecognitionevent sent from the recognition service. speechrecognitionalternative represents a single word that has been recognised by the speech recognition service. speechrecognitionerror represents error messages from the recognition service. speechrecognitionevent the event object for the result and nomatch events, and
contains all the data associated with an interim or final speech recognition result. speechgrammar the words or patterns of words that we want the recognition service to recognize. speechgrammarlist represents a list of speechgrammar objects. speechrecognitionresult represents a single recognition match, which may contain multiple speechrecognitionalternative objects. speechrecognitionresultlist r...
...gnitionresultlist represents a list of speechrecognitionresult objects, or a single one if results are being captured in continuous mode. speech synthesis speechsynthesis the controller interface for the speech service; this can be used to retrieve information about the synthesis voices available on the device, start and pause speech, and other commands besides. ...
...ch synthesis speechsynthesis the controller interface for the speech service; this can be used to retrieve information about the synthesis voices available on the device, start and pause speech, and other commands besides. speechsynthesiserrorevent
contains information about any errors that occur while processing speechsynthesisutterance objects in the speech service. speechsynthesisevent
contains information about the current state of speechsynthesisutterance objects that have been processed in the speech service. speechsynthesisutterance represents a speech request. it
contains the content the speech service should read and information about how to read it (e.g. language, pitch and volume.) speechsynthesisvoice represents a voice that the system supports. every speechsynthesisvoic...
... service including information about language, name and uri. window.speechsynthesis specced out as part of a [nointerfaceobject] interface called speechsynthesisgetter, and implemented by the window object, the speechsynthesis property provides access to the speechsynthesis controller, and therefore the entry point to speech synthesis functionality. examples the web speech api repo on github
contains demos to illustrate speech recognition and synthesis. specifications specification status comment web speech api draft initial definition ...
XMLHttpRequestEventTarget - Web APIs
" y="1" width="250" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="276" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">xmlhttprequesteventtarget</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties xmlhttprequesteventtarget.onabort
contains the function to call when a request is aborted and the abort event is received by this object. xmlhttprequesteventtarget.onerror
contains the function to call when a request encounters an error and the error event is received by this object. xmlhttprequesteventtarget.onload
contains the function to call when an http request returns after successfully fetching content and the load event is rec...
...event is received by this object. xmlhttprequesteventtarget.onerror
contains the function to call when a request encounters an error and the error event is received by this object. xmlhttprequesteventtarget.onload
contains the function to call when an http request returns after successfully fetching content and the load event is received by this object. xmlhttprequesteventtarget.onloadstart
contains the function that gets called when the http request first begins loading data and the loadstart event is received by this object. xmlhttprequesteventtarget.onprogress
contains the function that is called periodically with information about the progress of the request and the progress event is received by this object. ...
...requesteventtarget.onloadstart
contains the function that gets called when the http request first begins loading data and the loadstart event is received by this object. xmlhttprequesteventtarget.onprogress
contains the function that is called periodically with information about the progress of the request and the progress event is received by this object. xmlhttprequesteventtarget.ontimeout
contains the function that is called if the event times out and the timeout event is received by this object; this only happens if a timeout has been previously established by setting the value of the xmlhttprequest object's timeout attribute. ...
... the progress of the request and the progress event is received by this object. xmlhttprequesteventtarget.ontimeout
contains the function that is called if the event times out and the timeout event is received by this object; this only happens if a timeout has been previously established by setting the value of the xmlhttprequest object's timeout attribute. xmlhttprequesteventtarget.onloadend
contains the function that is called when the load is completed, even if the request failed, and the loadend event is received by this object. specifications specification status comment xmlhttprequest living standard whatwg living standard ...
Adding captions and subtitles to HTML5 video - Developer guides
hearing people who have difficulty understanding the language of the film, rather than deaf or hard-of-hearing people. the <track> element html5 allows us to specify subtitles for a video using the <track> element. the various attributes of this element allow us to specify such things as the type of content that we're adding, the language it's in, and of course a reference to the text file that
contains the actual subtitle information. webvtt the files that contain the actual subtitle data are simple text files that follow a specified format, in this case the web video text tracks (webvtt) format. the webvtt specification is still being worked on, but major parts of it are stable so we can use it today. video providers (such as the blender foundation) provide captions and subtitles in a text ...
...we loop through each one and set its mode to hidden. note: the webvtt api gives us access to all the text tracks that are defined for an html5 video using the <track> element. building a caption menu our aim is to use the subtitles button we added earlier to display a menu that allows users to choose which language they want the subtitles ...
...n. internet explorer internet explorer 10+ subtitles are enabled by default, and the default controls contain a button and a menu that offers the same functionality as the menu we just built. the default attribute is also supported. note: ie will completely ignore webvtt files unless you define the mime type. ...
...chrome and opera ignore the default attribute on the <track> element and will instead try to match the browser's language to the subtitle's language. ...
<input type="number"> - HTML: Hypertext Markup Language
er, or empty. ...
...ears and reappears as you manipulate the contents of the edit field. <input type="number" placeholder="multiple of 10"> controlling step size by default, the up and down buttons provided for you to step the number up and down will step the value up and down by 1. you can change this by providing a step attribute, which takes as its value a number specifying the step amount. our above example
contains a placeholder saying that the value should be a multiple of 10, so it makes sense to add a step value of 10: <input type="number" placeholder="multiple of 10" step="10"> in this example, you should find that the up and down step arrows will increase and decrease the value by 10 each time, not 1. you can still manually enter a number that's not a multiple of 10, but it will be considered inval...
...each option's value is the corresponding suggested value for the number entry box. <input id="ticketnum" type="number" name="ticketnum" list="defaultnumbers"> <span class="validity"></span> <datalist id="defaultnumbers"> <option value="10045678"> <option value="103421"> <option value="111...
...holder="x10" step="10" min="0" max="100" id="number"> then we add some css to narrow the width of the element with the id selector #number: #number { width: 3em; } the result looks like this: offering suggested values you can provide a list of default options from which the user can select by specifying the list attribute, which
contains as its value the id of a <datalist>, which in turn
contains one <option> element per suggested value. each option's value is the corresponding suggested value for the number entry box. <input id="ticketnum" type="number" name="ticketnum" list="defaultnumbers"> <span class="validity"></span> <datalist id="defaultnumbers"> <option value="10045678"> <option value="103421"> <option value="11111111"> <option value="12345678"> <option value="1299992...
<link>: The External Resource Link element - HTML: Hypertext Markup Language
u'll come across. for example, a link to the site's favicon: <link rel="icon" href="favicon.ico"> there are a number of other icon rel values, mainly used to indicate special icon types for use on various mobile platforms, e.g.: <link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-icon-114.png" type="image/png"> the sizes attribute indicates the icon size, while the type
contains the mime type of the resource being linked. these provide useful hints to allow the browser to choose the most appropriate icon available. you can also provide a media type or query inside a media attribute; this resource will then only be loaded if the media condition is true. for example: <link href="print.css" rel="stylesheet" media="print"> <link href="mobile.css" rel="stylesheet" media="sc...
...ues: auto: indicates no preference. the browser may use its own heuristics to decide the priority of the resource. high: indicates to the browser that the resource is of high priority. low: indicates to the browser that the resource is of low priority. note: the importance attribute may only be used for the <link> element if rel="preload" or rel="prefetch" is present. integrity
contains inline metadata — a base64-encoded cryptographic hash of the resource (file) you’re telling the browser to fetch. the browser can use this to verify that the fetched resource has been delivered free of unexpected manipulation. see subresource integrity. media this attribute specifies the media that the linked resource applies to. its value must be a media type / media query. this attribute ...
...his case is unsafe because it can leak origins and paths from tls-protected resources to insecure origins. rel this attribute names a relationship of the linked document to the current document. the attribute must be a space-separated list of link type values. sizes this attribute defines the sizes of the icons for visual media contained in the resource. it must be present only if the rel
contains a value of icon or a non-standard type such as apple's apple-touch-icon. it may have the following values: any, meaning that the icon can be scaled to any size as it is in a vector format, like image/svg+xml. a white-space separated list of sizes, each in the format <width in pixels>x<height in pixels> or <width in pixels>x<height in pixels>. each of these sizes must be contained in the res...
... that the icon can be scaled to any size as it is in a vector format, like image/svg+xml. a white-space separated list of sizes, each in the format <width in pixels>x<height in pixels> or <width in pixels>x<height in pixels>. each of these sizes must be contained in the resource. note: most icon formats are only able to store one single icon; therefore most of the time the sizes attribute
contains only one entry. ms's ico format does, as well as apple's icns. ico is more ubiquitous, so you should use this format if cross-browser support is a concern (especially for old ie versions). title the title attribute has special semantics on the <link> element. when used on a <link rel="stylesheet"> it defines a preferred or an alternate stylesheet. incorrectly using it may cause the styleshe...
JavaScript modules - JavaScript
run them through a local web server. basic example structure in our first example (see basic-modules) we have a file structure as follows: index.html main.js modules/ canvas.js square.js note: all of the examples in this guide have basically the same structure; the above should start getting pretty familiar. the modules directory's two modules are described below: canvas.js —
contains functions related to setting up the canvas: create() — creates a canvas with a specified width and height inside a wrapper <div> with a specified id, which is itself appended inside a specified parent element. returns an object containing the canvas's 2d context and the wrapper's id. createreportlist() — creates an unordered list appended inside a specified wrapper element, which ca...
... with a specified width and height inside a wrapper <div> with a specified id, which is itself appended inside a specified parent element. returns an object containing the canvas's 2d context and the wrapper's id. createreportlist() — creates an unordered list appended inside a specified wrapper element, which can be used to output report data into. returns the list's id. square.js —
contains: name — a constant containing the string 'square'. draw() — draws a square on a specified canvas, with a specified size, position, and color. returns an object containing the square's size, position, and color. reportarea() — writes a square's area to a specific report list, given its length. reportperimeter() — writes a square's perimeter to a specific report list, given i...
.... it makes it clear which files are modules, and which are regular javascript. it ensures that your module files are parsed as a module by runtimes such as node.js, and build tools such as babel. however, we decided to keep to using .js, at least for the moment. to get modules to work correctly in a browser, you need to make sure that your server is serving them with a content-type header that
contains a javascript mime type such as text/javascript. if you don't, you'll get a strict mime type checking error along the lines of "the server responded with a non-javascript mime type" and the browser won't run your javascript. most servers already set the correct type for .js files, but not yet for .mjs files. servers that already serve .mjs files correctly include github pages and http-server for n...
...h neater. modules and classes as we hinted at earlier, you can also export and import classes; this is another option for avoiding conflicts in your code, and is especially useful if you've already got your module code written in an object-oriented style. you can see an example of our shape drawing module rewritten with es classes in our classes directory. as an example, the square.js file now
contains all its functionality in a single class: class square { constructor(ctx, listid, length, x, y, color) { ... } draw() { ... } ... } which we then export: export { square }; over in main.js, we import it like this: import { square } from './modules/square.js'; and then use the class to draw our square: let square1 = new square(mycanvas.ctx, mycanvas.listid, 50, 50, 100, '...
BigInt64Array - JavaScript
ime and thus read only. bigint64array.prototype.length returns the number of elements hold in the bigint64array. this is fixed at construction time and thus read only. instance methods bigint64array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). bigint64array.prototype.entries() returns a new array iterator object that
contains the key/value pairs for each index in the array. see also array.prototype.entries(). bigint64array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). bigint64array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). bigint64ar...
...lso array.prototype.includes(). bigint64array.prototype.indexof() returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.indexof(). bigint64array.prototype.join() joins all elements of an array into a string. see also array.prototype.join(). bigint64array.prototype.keys() returns a new array iterator that
contains the keys for each index in the array. see also array.prototype.keys(). bigint64array.prototype.lastindexof() returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.lastindexof(). bigint64array.prototype.map() creates a new array with the results of calling a provided function on every element in this arra...
...this array satisfies the provided testing function. see also array.prototype.some(). bigint64array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). bigint64array.prototype.subarray() returns a new biguint64array from the given start and end element index. bigint64array.prototype.values() returns a new array iterator object that
contains the values for each index in the array. see also array.prototype.values(). bigint64array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). bigint64array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). bigint64array.prototype[@@iterator]()...
...e also array.prototype.values(). bigint64array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). bigint64array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). bigint64array.prototype[@@iterator]() returns a new array iterator object that
contains the values for each index in the array. examples different ways to create a bigint64array // from a length var bigint64 = new bigint64array(2); bigint64[0] = 42n; console.log(bigint64[0]); // 42n console.log(bigint64.length); // 2 console.log(bigint64.bytes_per_element); // 8 // from an array var arr = new bigint64array([21n,31n]); console.log(arr[1]); // 31n // from another typedarray var ...
BigUint64Array - JavaScript
and thus read only. biguint64array.prototype.length returns the number of elements hold in the biguint64array. this is fixed at construction time and thus read only. instance methods biguint64array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). biguint64array.prototype.entries() returns a new array iterator object that
contains the key/value pairs for each index in the array. see also array.prototype.entries(). biguint64array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). biguint64array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). biguint6...
... array.prototype.includes(). biguint64array.prototype.indexof() returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.indexof(). biguint64array.prototype.join() joins all elements of an array into a string. see also array.prototype.join(). biguint64array.prototype.keys() returns a new array iterator that
contains the keys for each index in the array. see also array.prototype.keys(). biguint64array.prototype.lastindexof() returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.lastindexof(). biguint64array.prototype.map() creates a new array with the results of calling a provided function on every element in this ar...
...s array satisfies the provided testing function. see also array.prototype.some(). biguint64array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). biguint64array.prototype.subarray() returns a new biguint64array from the given start and end element index. biguint64array.prototype.values() returns a new array iterator object that
contains the values for each index in the array. see also array.prototype.values(). biguint64array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). biguint64array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). biguint64array.prototype[@@iterator...
...lso array.prototype.values(). biguint64array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). biguint64array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). biguint64array.prototype[@@iterator]() returns a new array iterator object that
contains the values for each index in the array. examples different ways to create a biguint64array // from a length var biguint64 = new biguint64array(2); biguint64[0] = 42n; console.log(biguint64[0]); // 42n console.log(biguint64.length); // 2 console.log(biguint64.bytes_per_element); // 8 // from an array var arr = new biguint64array([21n,31n]); console.log(arr[1]); // 31n // from another typedar...
Float32Array - JavaScript
nstruction time and thus read only. float32array.prototype.length returns the number of elements hold in the float32array. fixed at construction time and thus read only. instance methods float32array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). float32array.prototype.entries() returns a new array iterator object that
contains the key/value pairs for each index in the array. see also array.prototype.entries(). float32array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). float32array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). float32array...
...e also array.prototype.includes(). float32array.prototype.indexof() returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.indexof(). float32array.prototype.join() joins all elements of an array into a string. see also array.prototype.join(). float32array.prototype.keys() returns a new array iterator that
contains the keys for each index in the array. see also array.prototype.keys(). float32array.prototype.lastindexof() returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.lastindexof(). float32array.prototype.map() creates a new array with the results of calling a provided function on every element in this array.
...t in this array satisfies the provided testing function. see also array.prototype.some(). float32array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). float32array.prototype.subarray() returns a new float32array from the given start and end element index. float32array.prototype.values() returns a new array iterator object that
contains the values for each index in the array. see also array.prototype.values(). float32array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). float32array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). float32array.prototype[@@iterator]() r...
... see also array.prototype.values(). float32array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). float32array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). float32array.prototype[@@iterator]() returns a new array iterator object that
contains the values for each index in the array. examples different ways to create a float32array // from a length var float32 = new float32array(2); float32[0] = 42; console.log(float32[0]); // 42 console.log(float32.length); // 2 console.log(float32.bytes_per_element); // 4 // from an array var arr = new float32array([21,31]); console.log(arr[1]); // 31 // from another typedarray var x = new float...
Float64Array - JavaScript
nstruction time and thus read only. float64array.prototype.length returns the number of elements hold in the float64array. fixed at construction time and thus read only. instance methods float64array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). float64array.prototype.entries() returns a new array iterator object that
contains the key/value pairs for each index in the array. see also array.prototype.entries(). float64array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). float64array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). float64array...
...e also array.prototype.includes(). float64array.prototype.indexof() returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.indexof(). float64array.prototype.join() joins all elements of an array into a string. see also array.prototype.join(). float64array.prototype.keys() returns a new array iterator that
contains the keys for each index in the array. see also array.prototype.keys(). float64array.prototype.lastindexof() returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.lastindexof(). float64array.prototype.map() creates a new array with the results of calling a provided function on every element in this array.
...t in this array satisfies the provided testing function. see also array.prototype.some(). float64array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). float64array.prototype.subarray() returns a new float64array from the given start and end element index. float64array.prototype.values() returns a new array iterator object that
contains the values for each index in the array. see also array.prototype.values(). float64array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). float64array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). float64array.prototype[@@iterator]() r...
... see also array.prototype.values(). float64array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). float64array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). float64array.prototype[@@iterator]() returns a new array iterator object that
contains the values for each index in the array. examples different ways to create a float64array // from a length var float64 = new float64array(2); float64[0] = 42; console.log(float64[0]); // 42 console.log(float64.length); // 2 console.log(float64.bytes_per_element); // 8 // from an array var arr = new float64array([21,31]); console.log(arr[1]); // 31 // from another typedarray var x = new float...
Int16Array - JavaScript
ed at construction time and thus read only. int16array.prototype.length returns the number of elements hold in the int16array. fixed at construction time and thus read only. instance methods int16array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). int16array.prototype.entries() returns a new array iterator object that
contains the key/value pairs for each index in the array. see also array.prototype.entries(). int16array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). int16array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). int16array.proto...
...te. see also array.prototype.includes(). int16array.prototype.indexof() returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.indexof(). int16array.prototype.join() joins all elements of an array into a string. see also array.prototype.join(). int16array.prototype.keys() returns a new array iterator that
contains the keys for each index in the array. see also array.prototype.keys(). int16array.prototype.lastindexof() returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.lastindexof(). int16array.prototype.map() creates a new array with the results of calling a provided function on every element in this array. see...
...e element in this array satisfies the provided testing function. see also array.prototype.some(). int16array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). int16array.prototype.subarray() returns a new int16array from the given start and end element index. int16array.prototype.values() returns a new array iterator object that
contains the values for each index in the array. see also array.prototype.values(). int16array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). int16array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). int16array.prototype[@@iterator]() returns...
...array. see also array.prototype.values(). int16array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). int16array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). int16array.prototype[@@iterator]() returns a new array iterator object that
contains the values for each index in the array. examples different ways to create an int16array // from a length var int16 = new int16array(2); int16[0] = 42; console.log(int16[0]); // 42 console.log(int16.length); // 2 console.log(int16.bytes_per_element); // 2 // from an array var arr = new int16array([21,31]); console.log(arr[1]); // 31 // from another typedarray var x = new int16array([21, 31])...
Int32Array - JavaScript
ed at construction time and thus read only. int32array.prototype.length returns the number of elements hold in the int32array. fixed at construction time and thus read only. instance methods int32array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). int32array.prototype.entries() returns a new array iterator object that
contains the key/value pairs for each index in the array. see also array.prototype.entries(). int32array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). int32array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). int32array.proto...
...te. see also array.prototype.includes(). int32array.prototype.indexof() returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.indexof(). int32array.prototype.join() joins all elements of an array into a string. see also array.prototype.join(). int32array.prototype.keys() returns a new array iterator that
contains the keys for each index in the array. see also array.prototype.keys(). int32array.prototype.lastindexof() returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.lastindexof(). int32array.prototype.map() creates a new array with the results of calling a provided function on every element in this array. see...
...e element in this array satisfies the provided testing function. see also array.prototype.some(). int32array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). int32array.prototype.subarray() returns a new int32array from the given start and end element index. int32array.prototype.values() returns a new array iterator object that
contains the values for each index in the array. see also array.prototype.values(). int32array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). int32array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). int32array.prototype[@@iterator]() returns...
...array. see also array.prototype.values(). int32array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). int32array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). int32array.prototype[@@iterator]() returns a new array iterator object that
contains the values for each index in the array. examples different ways to create an int32array // from a length var int32 = new int32array(2); int32[0] = 42; console.log(int32[0]); // 42 console.log(int32.length); // 2 console.log(int32.bytes_per_element); // 4 // from an array var arr = new int32array([21,31]); console.log(arr[1]); // 31 // from another typedarray var x = new int32array([21, 31])...
Int8Array - JavaScript
fixed at construction time and thus read only. int8array.prototype.length returns the number of elements hold in the int8array. fixed at construction time and thus read only. instance methods int8array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). int8array.prototype.entries() returns a new array iterator object that
contains the key/value pairs for each index in the array. see also array.prototype.entries(). int8array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). int8array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). int8array.prototyp...
...riate. see also array.prototype.includes(). int8array.prototype.indexof() returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.indexof(). int8array.prototype.join() joins all elements of an array into a string. see also array.prototype.join(). int8array.prototype.keys() returns a new array iterator that
contains the keys for each index in the array. see also array.prototype.keys(). int8array.prototype.lastindexof() returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.lastindexof(). int8array.prototype.map() creates a new array with the results of calling a provided function on every element in this array. see a...
...t one element in this array satisfies the provided testing function. see also array.prototype.some(). int8array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). int8array.prototype.subarray() returns a new int8array from the given start and end element index. int8array.prototype.values() returns a new array iterator object that
contains the values for each index in the array. see also array.prototype.values(). int8array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). int8array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). int8array.prototype[@@iterator]() returns a ...
...he array. see also array.prototype.values(). int8array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). int8array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). int8array.prototype[@@iterator]() returns a new array iterator object that
contains the values for each index in the array. examples different ways to create an int8array // from a length var int8 = new int8array(2); int8[0] = 42; console.log(int8[0]); // 42 console.log(int8.length); // 2 console.log(int8.bytes_per_element); // 1 // from an array var arr = new int8array([21,31]); console.log(arr[1]); // 31 // from another typedarray var x = new int8array([21, 31]); var y =...
Math.hypot() - JavaScript
inity. if any of the arguments is nan (unless another argument is ±infinity), the result is nan. if at least one of the arguments cannot be converted to a number, the result is nan. with one argument, math.hypot() is equivalent to math.abs(). ...
...guments cannot be converted to a number, the result is nan. with one argument, math.hypot() is equivalent to math.abs(). ...
...n. with one argument, math.hypot() is equivalent to math.abs(). ...
...ction() { var y = 0, i = arguments.length,
containsinfinity = false; while (i--) { var arg = arguments[i]; if (arg === infinity || arg === -infinity)
containsinfinity = true y += arg * arg } return
containsinfinity ? infinity : math.sqrt(y) } a polyfill that avoids underflows and overflows: if (!math.hypot) math.hypot = function () { var max = 0; var s = 0; var
containsinfinity = false; for (var i = 0; i < arguments.length; ++i) { var arg = math.abs(number(arguments[i])); if (arg === infinity)
containsinfinity = true if (arg > max) { s *= (max / arg) * (max / arg); max = arg; } s += arg === 0 && max === 0 ? 0 : (arg / max) * (arg / max); } return
containsinfinity ? infinity : (max === 1 / 0 ? 1 / 0 : max * math.sqrt(s)...
Promise.all() - JavaScript
it rejects immediately upon any of the input promises rejecting or non-promises throwing an error, and will reject with this first rejection message / error. the source for this interactive demo is stored in a github repository. ...
... a github repository. if you'd like to contribute to the interactive demo project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax promise.all(iterable); parameters iterable an iterable object such as an array. return value an already resolved promise if the iterable passed is empty. an asynchronously resolved promise if the iterable passed
contains no promises. note, google chrome 58 returns an already resolved promise in this case. a pending promise in all other cases. this returned promise is then resolved/rejected asynchronously (as soon as the stack is empty) when all the promises in the given iterable have resolved, or if any of the promises reject. see the example about "asynchronicity or synchronicity of promise.all" below. returned...
...d, whether or not the other promises have resolved. examples using promise.all promise.all waits for all fulfillments (or the first rejection). ...
...se.all([p1, p2, p3]).then(values => { console.log(values); // [3, 1337, "foo"] }); if the iterable
contains non-promise values, they will be ignored, but still counted in the returned promise array value (if the promise is fulfilled): // this will be counted as if the iterable passed is empty, so it gets fulfilled var p = promise.all([1,2,3]); // this will be counted as if the iterable passed
contains only the resolved promise with value "444", so it gets fulfilled var p2 = promise.all([1,2,3, promise.resolve(444)]); // this will be counted as if the iterable passed
contains only the rejected promise with value "555", so it gets rejected var p3 = promise.all([1,2,3, promise.reject(555)]); // using settimeout we can execute code after the stack is empty settimeout(function() { console.log(...
TypedArray - JavaScript
d at construction time and thus read only. typedarray.prototype.length returns the number of elements held in the typed array. fixed at construction time and thus read only. instance methods typedarray.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). typedarray.prototype.entries() returns a new array iterator object that
contains the key/value pairs for each index in the array. see also array.prototype.entries(). typedarray.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). typedarray.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). typedarray.proto...
...te. see also array.prototype.includes(). typedarray.prototype.indexof() returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.indexof(). typedarray.prototype.join() joins all elements of an array into a string. see also array.prototype.join(). typedarray.prototype.keys() returns a new array iterator that
contains the keys for each index in the array. see also array.prototype.keys(). typedarray.prototype.lastindexof() returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.lastindexof(). typedarray.prototype.map() creates a new array with the results of calling a provided function on every element in this array. see...
...e element in this array satisfies the provided testing function. see also array.prototype.some(). typedarray.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). typedarray.prototype.subarray() returns a new typedarray from the given start and end element index. typedarray.prototype.values() returns a new array iterator object that
contains the values for each index in the array. see also array.prototype.values(). typedarray.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). typedarray.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). typedarray.prototype[@@iterator]() returns...
...array. see also array.prototype.values(). typedarray.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). typedarray.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). typedarray.prototype[@@iterator]() returns a new array iterator object that
contains the values for each index in the array. examples new is required starting with ecmascript 2015, typedarray constructors must be constructed with the new operator. calling a typedarray constructor as a function without new will throw a typeerror. var dv = int8array([1, 2, 3]); // typeerror: calling a builtin int8array constructor // without new is forbidden var dv = new int8array([1, 2, 3]);...
Uint16Array - JavaScript
t construction time and thus read only. uint16array.prototype.length returns the number of elements hold in the uint16array. fixed at construction time and thus read only. instance methods uint16array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). uint16array.prototype.entries() returns a new array iterator object that
contains the key/value pairs for each index in the array. see also array.prototype.entries(). uint16array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). uint16array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). uint16array.pr...
... see also array.prototype.includes(). uint16array.prototype.indexof() returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.indexof(). uint16array.prototype.join() joins all elements of an array into a string. see also array.prototype.join(). uint16array.prototype.keys() returns a new array iterator that
contains the keys for each index in the array. see also array.prototype.keys(). uint16array.prototype.lastindexof() returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.lastindexof(). uint16array.prototype.map() creates a new array with the results of calling a provided function on every element in this array. s...
...ement in this array satisfies the provided testing function. see also array.prototype.some(). uint16array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). uint16array.prototype.subarray() returns a new uint16array from the given start and end element index. uint16array.prototype.values() returns a new array iterator object that
contains the values for each index in the array. see also array.prototype.values(). uint16array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). uint16array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). uint16array.prototype[@@iterator]() retu...
...ay. see also array.prototype.values(). uint16array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). uint16array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). uint16array.prototype[@@iterator]() returns a new array iterator object that
contains the values for each index in the array. examples different ways to create a uint16array // from a length var uint16 = new uint16array(2); uint16[0] = 42; console.log(uint16[0]); // 42 console.log(uint16.length); // 2 console.log(uint16.bytes_per_element); // 2 // from an array var arr = new uint16array([21,31]); console.log(arr[1]); // 31 // from another typedarray var x = new uint16array([...
Uint32Array - JavaScript
t construction time and thus read only. uint32array.prototype.length returns the number of elements hold in the uint32array. fixed at construction time and thus read only. instance methods uint32array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). uint32array.prototype.entries() returns a new array iterator object that
contains the key/value pairs for each index in the array. see also array.prototype.entries(). uint32array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). uint32array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). uint32array.pr...
... see also array.prototype.includes(). uint32array.prototype.indexof() returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.indexof(). uint32array.prototype.join() joins all elements of an array into a string. see also array.prototype.join(). uint32array.prototype.keys() returns a new array iterator that
contains the keys for each index in the array. see also array.prototype.keys(). uint32array.prototype.lastindexof() returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.lastindexof(). uint32array.prototype.map() creates a new array with the results of calling a provided function on every element in this array. s...
...ement in this array satisfies the provided testing function. see also array.prototype.some(). uint32array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). uint32array.prototype.subarray() returns a new uint32array from the given start and end element index. uint32array.prototype.values() returns a new array iterator object that
contains the values for each index in the array. see also array.prototype.values(). uint32array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). uint32array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). uint32array.prototype[@@iterator]() retu...
...ay. see also array.prototype.values(). uint32array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). uint32array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). uint32array.prototype[@@iterator]() returns a new array iterator object that
contains the values for each index in the array. examples different ways to create a uint32array // from a length var uint32 = new uint32array(2); uint32[0] = 42; console.log(uint32[0]); // 42 console.log(uint32.length); // 2 console.log(uint32.bytes_per_element); // 4 // from an array var arr = new uint32array([21,31]); console.log(arr[1]); // 31 // from another typedarray var x = new uint32array([...
Uint8Array - JavaScript
ed at construction time and thus read only. uint8array.prototype.length returns the number of elements held in the uint8array. fixed at construction time and thus read only. instance methods uint8array.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). uint8array.prototype.entries() returns a new array iterator object that
contains the key/value pairs for each index in the array. see also array.prototype.entries(). uint8array.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). uint8array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). uint8array.proto...
...te. see also array.prototype.includes(). uint8array.prototype.indexof() returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.indexof(). uint8array.prototype.join() joins all elements of an array into a string. see also array.prototype.join(). uint8array.prototype.keys() returns a new array iterator that
contains the keys for each index in the array. see also array.prototype.keys(). uint8array.prototype.lastindexof() returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.lastindexof(). uint8array.prototype.map() creates a new array with the results of calling a provided function on every element in this array. see...
...e element in this array satisfies the provided testing function. see also array.prototype.some(). uint8array.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). uint8array.prototype.subarray() returns a new uint8array from the given start and end element index. uint8array.prototype.values() returns a new array iterator object that
contains the values for each index in the array. see also array.prototype.values(). uint8array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). uint8array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). uint8array.prototype[@@iterator]() returns...
...array. see also array.prototype.values(). uint8array.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). uint8array.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). uint8array.prototype[@@iterator]() returns a new array iterator object that
contains the values for each index in the array. examples different ways to create a uint8array // from a length var uint8 = new uint8array(2); uint8[0] = 42; console.log(uint8[0]); // 42 console.log(uint8.length); // 2 console.log(uint8.bytes_per_element); // 1 // from an array var arr = new uint8array([21,31]); console.log(arr[1]); // 31 // from another typedarray var x = new uint8array([21, 31]);...
Uint8ClampedArray - JavaScript
thus read only. uint8clampedarray.prototype.length returns the number of elements hold in the uintclamped8array. fixed at construction time and thus read only. instance methods uint8clampedarray.prototype.copywithin() copies a sequence of array elements within the array. see also array.prototype.copywithin(). uint8clampedarray.prototype.entries() returns a new array iterator object that
contains the key/value pairs for each index in the array. see also array.prototype.entries(). uint8clampedarray.prototype.every() tests whether all elements in the array pass the test provided by a function. see also array.prototype.every(). uint8clampedarray.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. see also array.prototype.fill(). ui...
...ototype.includes(). uint8clampedarray.prototype.indexof() returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.indexof(). uint8clampedarray.prototype.join() joins all elements of an array into a string. see also array.prototype.join(). uint8clampedarray.prototype.keys() returns a new array iterator that
contains the keys for each index in the array. see also array.prototype.keys(). uint8clampedarray.prototype.lastindexof() returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found. see also array.prototype.lastindexof(). uint8clampedarray.prototype.map() creates a new array with the results of calling a provided function on every element in t...
...sfies the provided testing function. see also array.prototype.some(). uint8clampedarray.prototype.sort() sorts the elements of an array in place and returns the array. see also array.prototype.sort(). uint8clampedarray.prototype.subarray() returns a new uint8clampedarray from the given start and end element index. uint8clampedarray.prototype.values() returns a new array iterator object that
contains the values for each index in the array. see also array.prototype.values(). uint8clampedarray.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). uint8clampedarray.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). uint8clampedarray.prototype[@...
....prototype.values(). uint8clampedarray.prototype.tolocalestring() returns a localized string representing the array and its elements. see also array.prototype.tolocalestring(). uint8clampedarray.prototype.tostring() returns a string representing the array and its elements. see also array.prototype.tostring(). uint8clampedarray.prototype[@@iterator]() returns a new array iterator object that
contains the values for each index in the array. examples different ways to create a uint8clampedarray // from a length var uintc8 = new uint8clampedarray(2); uintc8[0] = 42; uintc8[1] = 1337; console.log(uintc8[0]); // 42 console.log(uintc8[1]); // 255 (clamped) console.log(uintc8.length); // 2 console.log(uintc8.bytes_per_element); // 1 // from an array var arr = new uint8clampedarray([21,31]); con...
dx - SVG: Scalable Vector Graphics
"60%" x2="60%" y1="0" y2="100%" /> <!-- some reference text --> <text x="10%" y="50%" fill="grey">svg</text> <!-- the same text with a shift along the x-axis --> <text dx="50%" x="10%" y="50%">svg</text> </svg> line { stroke: red; stroke-width: .5px; stroke-dasharray: 3px; } altglyph warning: as of svg2 <altglyph> is deprecated and shouldn't be used. for <altglyph>, if it
contains a single value, dx defines a shift along the x-axis for all alternate glyph. if there are multiple values, dx defines a shift along the x-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphs, the remaining glyphs use a value of 0. if there are more values than glyphs, extra values are ignored. value list of <length> default va...
... attribute of the <filter> element. value <number> default value 0 animatable yes glyphref warning: as of svg2 <glyphref> is deprecated and shouldn't be used. for <glyphref>, dx defines the x offset of the glyph, in the font metric system. value <number> default value 0 animatable yes text for <text>, if it
contains a single value, dx defines a shift along the x-axis for all glyphs. if there are multiple values, dx defines a shift along the x-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphs, the remaining glyphs use a value of 0. if there are more values than glyphs, extra values are ignored. value list of <length> default value no...
...-- behaviors change based on the number of values in the attributes --> <text dx="20%" x="10%" y="25%">svg</text> <text dx="0 10%" x="10%" y="50%">svg</text> <text dx="0 10% 20%" x="10%" y="75%">svg</text> </svg> line { stroke: red; stroke-width: .5px; stroke-dasharray: 3px; } tref warning: as of svg2 <tref> is deprecated and shouldn't be used. for <tref>, if it
contains a single value, dx defines a shift along the x-axis for all glyphs. if there are multiple values, dx defines a shift along the x-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphes, the remaining glyphes use a value of 0. if there are more values than glyphes, extra values are ignored. value list of <length> default value ...
...s. if there are multiple values, dx defines a shift along the x-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphes, the remaining glyphes use a value of 0. if there are more values than glyphes, extra values are ignored. value list of <length> default value none animatable yes tspan for <tspan>, if it
contains a single value, dx defines a shift along the x-axis for all alternate glyph. if there are multiple values, dx defines a shift along the x-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphs, the remaining glyphs use a value of 0. if there are more values than glyphs, extra values are ignored. value list of <length> default va...
dy - SVG: Scalable Vector Graphics
0" x2="100%" y1="80%" y2="80%" /> <!-- some reference text --> <text x="10%" y="30%" fill="grey">svg</text> <!-- the same text with a shift along the y-axis --> <text dy="50%" x="10%" y="30%">svg</text> </svg> line { stroke: red; stroke-width: .5px; stroke-dasharray: 3px; } altglyph warning: as of svg2 <altglyph> is deprecated and shouldn't be used. for <altglyph>, if it
contains a single value, dy defines a shift along the y-axis for all alternate glyph. if there are multiple values, dy defines a shift along the y-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphes, the remaining glyphes use a value of 0. if there are more values than glyphes, extra values are ignored. value list of <length> default...
... attribute of the <filter> element. value <number> default value 0 animatable yes glyphref warning: as of svg2 <glyphref> is deprecated and shouldn't be used. for <glyphref>, dy defines the y offset of the glyph, in the font metric system. value <number> default value 0 animatable yes text for <text>, if it
contains a single value, dy defines a shift along the y-axis for all glyphs. if there are multiple values, dy defines a shift along the y-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphes, the remaining glyphes use a value of 0. if there are more values than glyphes, extra values are ignored. value list of <length> default value ...
... y2="100%" /> <!-- behaviors change based on the number of values in the attributes --> <text dy="20" x="10" y="30">svg</text> <text dy="0 10" x="50" y="30">svg</text> <text dy="0 10 20" x="90" y="30">svg</text> </svg> line { stroke: red; stroke-width: .5px; stroke-dasharray: 3px; } tref warning: as of svg2 <tref> is deprecated and shouldn't be used. for <tref>, if it
contains a single value, dy defines a shift along the y-axis for all glyphs. if there are multiple values, dy defines a shift along the y-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphes, the remaining glyphes use a value of 0. if there are more values than glyphes, extra values are ignored. value list of <length> default value ...
...s. if there are multiple values, dy defines a shift along the y-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphes, the remaining glyphes use a value of 0. if there are more values than glyphes, extra values are ignored. value list of <length> default value none animatable yes tspan for <tspan>, if it
contains a single value, dy defines a shift along the y-axis for all alternate glyph. if there are multiple values, dy defines a shift along the y-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphes, the remaining glyphes use a value of 0. if there are more values than glyphes, extra values are ignored. value list of <length> default...
Introduction to using XPath in JavaScript - XPath
ables conversion between the prefixes used in the xpath expressions and the possibly different prefixes used in the document. the function can be either: created by using the creatensresolver method of a xpathevaluator object. you should use this virtually all of the time. null, which can be used for html documents or when no namespace prefixes are used. note that, if the xpathexpression
contains a namespace prefix, this will result in a domexception being thrown with the code namespace_err. a custom user-defined function. see the using a user defined namespace resolver section in the appendix for details. resulttype: a constant that specifies the desired result type to be returned as a result of the evaluation. the most commonly passed constant is xpathresult.any_type which will...
...ser-defined function. see the using a user defined namespace resolver section in the appendix for details. resulttype: a constant that specifies the desired result type to be returned as a result of the evaluation. the most commonly passed constant is xpathresult.any_type which will return the results of the xpath expression as the most natural type. there is a section in the appendix which
contains a full list of the available constants. they are explained below in the section "specifying the return type." result: if an existing xpathresult object is specified, it will be reused to return the results. specifying null will create a new xpathresult object. return value returns xpathresult, which is an xpathresult object of the type specified in the resulttype parameter. the xpathresult in...
...he returned value of the expression by accessing the following properties respectively of the xpathresult object. ...
... node-set types the xpathresult object allows node-sets to be returned in 3 principal different types: iterators snapshots first nodes iterators when the specified result type in the resulttype parameter is either: unordered_node_iterator_type ordered_node...
Understanding WebAssembly text format - WebAssembly
previous two values pushed onto the stack), computes their sum (modulo 2^32) and pushes the resulting i32 value. when a function is called, it starts with an empty stack which is gradually filled up and emptied as the body’s instructions are executed. so for example, after executing the following function: (func (param $p i32) (result i32) local.get $p local.get $p i32.add) the stack
contains exactly one i32 value — the result of the expression ($p + $p), which is handled by i32.add. the return value of a function is just the final value left on the stack. the webassembly validation rules ensure the stack matches exactly: if you declare a (result f32), then the stack must contain exactly one f32 at the end. if there is no result type, the stack must be empty. our first function b...
...ml (see it live also). also see webassembly.instantiatestreaming() for more details about the instantiate function. exploring fundamentals now we’ve covered the real basics, let’s move on to look at some more advanced features. calling functions from other functions in the same module the call instruction calls a single function, given its index or name. for example, the following module
contains two functions — one just returns the value 42, the other returns the result of calling the first plus one: (module (func $getanswer (result i32) i32.const 42) (func (export "getanswerplus1") (result i32) call $getanswer i32.const 1 i32.add)) note: i32.const just defines a 32-bit integer and pushes it onto the stack. you could swap out the i32 for any of the other availabl...
...ry the above example is a pretty terrible logging function: it only prints a single integer! what if we wanted to log a text string? to deal with strings and other more complex data types, webassembly provides memory (although we also have reference types in newer implementation of webassembly). according to webassembly, memory is just a large array of bytes that can grow over time. webassembly
contains instructions like i32.load and i32.store for reading and writing from linear memory. from javascript’s point of view, it’s as though memory is all inside one big (resizable) arraybuffer. that’s literally all that asm.js has to play with (except that it isn't resizable; see the asm.js programming model). so a string is just a sequence of bytes somewhere inside this linear memory. let's ass...
...allowing wasm modules to call javascript functions, dom apis, etc., and generally to pave the way for easier interoperability with the host environment. externref can be used for value types and table elements. a number of new instructions that allow wasm modules to directly manipulate webassembly tables, rather than having to do it via the javascript api. note: the wasm-bindgen documentation
contains some useful information on how to take advantage of externref from rust. multi-value webassembly another more recent addition to the language (for example, in firefox 78) is webassembly multi-value, meaning that webassembly functions can now return multiple values, and instruction sequences can consume and produce multiple stack values. at the time of writing (june 2020) this is at an early s...
Porting the Library Detector - Archive of obsolete content
ich javascript frameworks the current web page is using. it does this by checking whether particular objects that those libraries add to the global window object are defined. for example, if window.jquery is defined, then the page has loaded jquery. for each library that it finds, the library detector adds an icon representing that library to the status bar. it adds a tooltip to each icon, which
contains the library name and version. you can browse and run the ported version in the sdk's examples directory. how the library detector works all the work is done inside a single file, librarydetector.xul this
contains: a xul overlay a script the xul overlay adds a box element to the browser's status bar: the script does everything else. the bulk of the script is an array of test objects, on...
...an browse and run the ported version in the sdk's examples directory. how the library detector works all the work is done inside a single file, librarydetector.xul this
contains: a xul overlay a script the xul overlay adds a box element to the browser's status bar: the script does everything else. the bulk of the script is an array of test objects, one for each library. each test object
contains a function called test(): if the function finds the library, it defines various additional properties for the test object, such as a version property containing the library version. each test also
contains a chrome:// url pointing to the icon associated with its library. the script listens to gbrowser's domcontentloaded event. when this is triggered, the testlibraries() function builds an array ...
...) == -1) { worker.tab.libraries.push(library); } }); if (worker.tab == tabs.activetab) { updatewidgetview(worker.tab); } }); } }); the content script is executed once for every window.onload event, so it will run multiple times when a single page containing multiple iframes is loaded. so main.js needs to filter out any duplicates, in case a page
contains more than one iframe, and those iframes use the same library. implementing the user interface showing the library array the widget module is a natural fit for displaying the library list. we'll specify its content using html, so we can display an array of icons. the widget must be able to display different content for different windows, so we'll use the widgetview object. main.js will create ...
clipboard - Archive of obsolete content
he image type doesn't support transparency on windows. examples set and get the contents of the clipboard. var clipboard = require("sdk/clipboard"); clipboard.set("lorem ipsum dolor sit amet"); var contents = clipboard.get(); set the clipboard contents to some html. var clipboard = require("sdk/clipboard"); clipboard.set("<blink>lorem ipsum dolor sit amet</blink>", "html"); if the clipboard
contains html content, open it in a new tab. var clipboard = require("sdk/clipboard"); if (clipboard.currentflavors.indexof("html") != -1) require("sdk/tabs").open("data:text/html;charset=utf-8," + clipboard.get("html")); set the clipboard contents to an image. var clipboard = require("sdk/clipboard"); clipboard.set("data:image/png;base64,ivborw0kggoaaaansuheugaaacaaaaagcaya" + "aabzenr...
...board.get("html")); set the clipboard contents to an image. var clipboard = require("sdk/clipboard"); clipboard.set("data:image/png;base64,ivborw0kggoaaaansuheugaaacaaaaagcaya" + "aabzenr0aaaasuleqvryhe3o0qkaiawd0eyqe3q993aq3cbsukpygfsnty" + "n5ugbqpk0baadgp0brdwxwlweaaaaagpsa3rzdaaaaahgpcgrpganzq2fg" + "bwrr9aaaaabjru5erkjggg%3d%3d"); if the clipboard
contains an image, open it in a new tab. var clipboard = require("sdk/clipboard"); if (clipboard.currentflavors.indexof("image") != -1) require("sdk/tabs").open(clipboard.get()); as noted before, data type can be easily omitted for images. if the intention is set the clipboard to a data url as string and not as image, it can be done by specifying a different flavor, like text. var clipboard = require...
... clipboard contents only if matching this type (optional). the function will return null if the contents of the clipboard do not match the supplied type. properties currentflavors data on the clipboard is sometimes available in multiple types. for example, html data might be available as both a string of html (the html type) and a string of plain text (the text type). this property is an array
contains all types in which the data currently on the clipboard is available. ...
context-menu - Archive of obsolete content
level context menu can have a content script. a special event named "context" is emitted in your content scripts whenever the context menu is about to be shown. if you register a listener function for this event and it returns true, the menu item associated with the listener's content script is shown in the menu. for example, this item appears whenever the context menu is invoked on a page that
contains at least one image: require("sdk/context-menu").item({ label: "this page has images", contentscript: 'self.on("context", function (node) {' + ' return !!document.queryselector("img");' + '});' }); note that the listener function has a parameter called node. this is the node in the page that the user context-clicked to invoke the menu. you can use it to det...
... context: cm.pagecontext(), contentscript: 'self.on("context", function (node) {' + ' var pagehasimgs = !!document.queryselector("img");' + ' return pagehasimgs;' + '});' + ...
...age function if the menu is contained in the top-level context menu, this function will be called when the content script calls self.postmessage. it will be passed the data that was passed to postmessage. separator() creates a menu separator. pagecontext() creates a page context. see specifying contexts above. selectioncontext() creates a context that occurs when a page
contains a selection. see specifying contexts above. selectorcontext(selector) creates a context that matches a given css selector. see specifying contexts above. parameters selector : string a css selector. urlcontext(matchpattern) creates a context that matches pages with particular urls. see specifying contexts above. parameters matchpattern : string,array a match pattern string, regexp or an...
passwords - Archive of obsolete content
refox's password manager, under "site", in brackets after the url. for example, if the realm for a credential is "user registration", then its "site" field will look something like: addon:jid0-01mbbfyu0zaxcfub1jykoostkic (user registration) html form credential if a web service uses html forms to authenticate its users, then the corresponding credential is an html form credential. it
contains the following properties: username the username. password the password. url the url for the web service which requires the credential. you should omit anything after the hostname and (optional) port. formsubmiturl the value of the form's "action" attribute. you should omit anything after the hostname and (optional) port. if the form doesn't ...
...e following properties: username the username. password the password. url the url for the web service which requires the credential. you should omit anything after the hostname and (optional) port. realm the www-authenticate response header sent by the server may include a "realm" field as detailed in rfc 2617. if it does, this property
contains the value for the "realm" field. otherwise, it is omitted. the realm is displayed in firefox's password manager, under "site", in brackets after the url. so: if a web server at http://www.example.com requested authentication with a response code like this: http/1.0 401 authorization required server: apache/1.3.27 www-authenticate: basic realm="exampleco login" the corresponding...
...name attribute for the password input field in a form. onerror function the callback function that is called if the function failed. the callback is passed an error containing a reason of a failure: this is an nsiexception object. store(options) this function is used to store a credential in the password manager. it takes an options object as an argument: this
contains all the properties for the new credential. as different sorts of credentials contain different properties, the appropriate options differ depending on the sort of credential being stored. to store an add-on credential: require("sdk/passwords").store({ realm: "user registration", username: "joe", password: "secret123", }); to store an html form credential: require("sdk/passwords").store...
util/array - Archive of obsolete content
helper functions for working with arrays. globals functions has(array, element) returns true if the given array
contains the element or false otherwise. a simplified version of array.indexof(element) >= 0. let { has } = require('sdk/util/array'); let a = ['rock', 'roll', 100]; has(a, 'rock'); // true has(a, 'rush'); // false has(a, 100); // true parameters array : array the array to search. element : * the element to search for in the array. returns boolean : a boolean indicating whether or not the element was found in the array. hasany(array, elements) returns true if the given array
contains any of the elements in the elements array, or false otherwise. let { hasany } = require('sdk/util/array'); let a = ['rock', 'roll', 100]; hasany(a, ['rock', 'bright', 'light']); // true h...
...y'); let a = ['alice', 'bob', 'carol']; add(a, 'dave'); // true add(a, 'dave'); // false add(a, 'alice'); // false console.log(a); // ['alice', 'bob', 'carol', 'dave'] parameters array : array the array to add the element to. element : * the element to add returns boolean : a boolean indicating whether or not the element was added to the array. remove(array, element) if the given array
contains the given element, this function removes the element from the array and returns true. otherwise, this function does not alter the array and returns false. let { remove } = require('sdk/util/array'); let a = ['alice', 'bob', 'carol']; remove(a, 'dave'); // false remove(a, 'bob'); // true remove(a, 'bob'); // false console.log(a); // ['alice', 'carol'] parameters array : array the array to r...
...true. otherwise, this function does not alter the array and returns false. let { remove } = require('sdk/util/array'); let a = ['alice', 'bob', 'carol']; remove(a, 'dave'); // false remove(a, 'bob'); // true remove(a, 'bob'); // false console.log(a); // ['alice', 'carol'] parameters array : array the array to remove the element from. element : * the element to remove from the array if it
contains it. returns boolean : a boolean indicating whether or not the element was removed from the array. unique(array) produces a duplicate-free version of the given array. let { unique } = require('sdk/util/array'); let a = [1, 1, 1, 1, 3, 4, 7, 7, 10, 10, 10, 10]; let b = unique(a); console.log(a); // [1, 1, 1, 1, 3, 4, 7, 7, 10, 10, 10, 10]; console.log(b); // [1, 3, 4, 7, 10]; parameters ar...
package.json - Archive of obsolete content
some of its entries, such as icon, name, and description, have direct analogues in the install manifest format, and entries from package.json are written into the install manifest when the add-on is built using jpm xpi. others, such as lib, permissions, and preferences, represent instructions to the jpm tool itself to generate and include particular code and data structures in your add-on. creating a manifest the package.json file is initially generated in your add-on's root directory the first time you run jpm init. ...
...lement in its install.rdf. harnessclassid note: this is deprecated along with cfx; it's not available when using jpm. string in the guid format. this is used as a classid of the "harness service" xpcom component. defaults to a random guid generated by cfx. hasembeddedwebextension new in jpm 1.2.0. boolean value: true if the add-on
contains an embedded webextension. homepage the url of the add-on's website. this value will be used as the add-on's em:homepageurl element in its install.rdf. icon the path to an image file containing the icon for the add-on. optional: you can have no icon field in package.json and put your icon named "icon.png" in the root directory of your add-on. if no ic...
...s em:name element in its install.rdf. translators an array of strings listing the people who contributed to the localization of this add-on. these values will be used as the add-on's em:translator elements in its install.rdf. note: jpm supports nodejs people fields. unpack same as the unpack in an install.rdf file. useful when the extension
contains binaries. updatekey same as the updatekey in an install.rdf file. see supporting updates for self-hosted add-ons. note: this key is only available with jpm. updatelink same as the updatelink for an update.rdf file. previously was --update-link in cfx. see supporting updates for self-hosted add-ons. note: this key is only...
Localization - Archive of obsolete content
now whenever your java...
...t bom encoding lines starting with "#" (after optional whitespace) are comments suppose your add-on
contains a single localizable string, represented in english as "hello!", and you want to supply us english and french french localizations. you'd add two files to the "locale" directory: my-addon/ data lib locale/ en-us.properties fr.properties "en-us.properties"
contains this: hello_id= hello! "fr.properties"
contains this: hello_id= bonjour ! now whenever your javascript or html asks the localization system for the translation of the hello_id identifier, it will get the correct translation for the current locale. using localized strings in html this example uses the action button api, which is only available from firefox 29 onwards. to reference local...
...ce you've installed it, open the add-on manager, and you'll see a new button labeled "update l10n" next to each add-on you've installed: click the button and you'll be prompted for a new .properties file for that add-on. if you provide a new file, the add-on's locale data will be updated with the new file. limitations the current localization support is a first step towards full support, and
contains a number of limitations. there's no support for content scripts or css files: at the moment, you can only localize strings appearing in javascript files that can require() sdk modules and in html. see bug 787351. the set of locale files is global across an add-on. this means that a module isn't able to override a more general translation: so a module informal.js can't specify that "he...
Add-ons - Archive of obsolete content
ined with this new syntax appears in the extension's detail view in the add-on manager. this functionality originally appeared in firefox mobile and is now available in firefox on the desktop as well. install manifests an install manifest is the file an add-on manager-enabled xul application (e.g. firefox or thunderbird) uses to determine information about an add-on as it is being installed. it
contains metadata identifying the add-on, providing information about who created it, where more information can be found about it, which versions of what applications it is compatible with, how it should be updated, and so on. interaction between privileged and non-privileged pages an easy way to send data from a web page to an extension is by using custom dom events. in your extension's browser.xul ov...
...ch versions of what applications it is compatible with, how it should be updated, and so on. interaction between privileged and non-privileged pages an easy way to send data from a web page to an extension is by using custom dom events. in your extension's browser.xul overlay, write code which listens for a custom dom event. here we call the event myextensionevent. ...
...extensions can do almost anything. ...
Creating reusable content with CSS and XBL - Archive of obsolete content
new html document, doc6.html. copy and paste the content from here: <!doctype html public "-//w3c//dtd html 4.0//en"> <html> <head> <title>mozilla css getting started - xbl demonstration</title> <link rel="stylesheet" type="text/css" href="style6.css"> </head> <body> <h1>xbl demonstration</h1> <div id="square">click me</div> </body> </html> make a new css file, style6.css. this stylesheet
contains the document style. copy and paste the content from here: /*** xbl demonstration ***/ #square { -moz-binding: url("square.xbl#square"); } make a new text file, square.xbl. this file
contains the xbl binding. copy and paste the content from here: <?xml version="1.0"?> <!doctype bindings> <bindings xmlns="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/ga...
...ransparent" me.square.style.marginleft = "0" me.button.removeattribute("disabled") ]]></body> </method> </implementation> <handlers> <handler event="click" button="0"><![cdata[ if (event.originaltarget == this.button) this.dodemo() ]]></handler> </handlers> </binding> </bindings> make a new css file, bind6.css. this separate stylesheet
contains style for the binding. copy and paste the content from here: /*** xbl demonstration ***/ [anonid="square"] { width: 20em; height: 20em; border: 2px inset gray; } [anonid="button"] { margin-top: 1em; padding: .5em 2em; } open the document in your browser and press the button. this wiki does not support javascript in pages, so it is not possible to show the demonstration here. it...
... and press the button. this wiki does not support javascript in pages, so it is not possible to show the demonstration here. it looks something like this, before and after you press the button: notes about this demonstration: the html document links the document stylesheet as usual, but it does not link any javascript code. the document does not contain any buttons. it only
contains the text of the button's label. the button is added by the binding. the document stylesheet links the binding. the binding links its own stylesheet, and it supplies its own content and javascript code. so the binding is self-contained. challenges change the xbl file so that the square doubles in width when it changes color, instead of jumping to the right. use the dom inspec...
Drag and Drop JavaScript Wrapper - Archive of obsolete content
ul file. you can look at the contents of these files to see how drag and drop is done at a lower level. note that you can only use these libraries from within xul loaded via a chrome url. <script src="chrome://global/content/nsdraganddrop.js" /> <script src="chrome://global/content/nstransferable.js" /> this drag and drop library creates an object stored in the variable nsdraganddrop. the object
contains a series of functions, one for each event handler (except for dragenter where it has nothing special to do). each of the functions takes two parameters, the first is the event object and the second is an observer object that you create. more on that in a moment. the following is an example of calling the nsdraganddrop object. <button label="drag me" ondraggesture="nsdraganddrop.startdrag(event,bu...
...ropping. a file system directory view might accept files and perhaps text, but wouldn't accept html text. below, we'll define a getsupportedflavours function. we'll allow only one flavour here, that for a string. var textobserver = { getsupportedflavours : function () { var flavours = new flavourset(); flavours.appendflavour("text/unicode"); return flavours; } } the flavours list
contains only one flavour, which is 'text/unicode'. the flavourset object can be used to hold a list of flavours. in some cases, you must provide the xpcom interface as well. for example, for files: var textobserver = { getsupportedflavours : function () { var flavours = new flavourset(); flavours.appendflavour("application/x-moz-file","nsifile"); flavours.appendflavour("text/unicode"); ...
...ng dragged over. in many cases the function can do nothing. it must be defined for elements that accept dragged data however. next, the ondrop function should be created. its second argument is the transfer data object that holds the data being dragged. by the time ondrop is called, the wrapper has called getsupportedflavours to determine the best flavour for the drop, so the transfer object only
contains the data for the best matching flavour. the transfer object has two properties, data which holds the data and flavour which holds the flavour of the data. once you have the data, you can add it to the element is some way. for example, you might set the value of a textbox. var textobserver = { ondrop : function (event, transferdata, session) { event.target.setattribute("value",transferdata.d...
Repackaging Firefox - Archive of obsolete content
ozilla developer center), here is a basic tutorial to get you started, and some tips specific for creating a dex. if you already have an extension that you want to bundle with firefox, and don't want to bundle an extra extension solely to set a few defaults, you can do everything you need to do in your existing extension. however, it's still recommended that you look through this tutorial, as it
contains tips specific for creating extensions of this type, and there are a few options that you will need to set to ensure a smooth upgrade path for users. at the very least, don't skip the "important extension preferences" section below. sample dex the best way to get started is probably to look at a simple dex and modify it for your own purposes. download the sample. xpi files are specially crafte...
... components/partnerbookmarks.js from the cck extension, and it allows us to drop in default bookmarks at profile creation. you should not need to edit this file. defaults/preferences/partner.js default preferences for this dex. install.rdf meta-information about your extension, such as the creator (your organization), a unique id, and which v...
...overwriting it. the "additional xpi" section lets you select a second extension to bundle into your customized installer. if you don't wish to install a second extension, you can leave this blank. the "repackaging" section is where you configure the actual repackaging job itself. first, set the source directory by clicking its "choose" button. the source directory is a directory that
contains the windows installer, mac disk image (.dmg), and/or linux tarball of the standard firefox that you wish to customize. second, set the destination directory to the directory into which you wish to save the customized installers. the "platforms" section lets you select the platforms for which you wish to generate customized installers. check the boxes next to each one you want to generate...
Creating a Help Content Pack - Archive of obsolete content
help window. this attribute is required. nc:defaulttopic will hold the rdf:id of the topic you want displayed when the viewer first loads if none has been specified. this attribute also specifies what topic is loaded when the user hits the home button in the viewer. we'll get to exactly how to fill in this attribute later. this attribute is optional, with fallback to the value welcome. nc:base
contains the base url relative to which the help content referenced in the descriptor file is located. for example, if your glossary, index, and table of contents rdf files are all located at chrome://myapp/locale/help/*, then you could put chrome://myapp/locale/help/ here and use only the actual file names without path when needed later. you don't actually need this attribute if you don't want it, but it...
...e is omitted, the information in the data sources applies to all platforms. the attribute is a space-separated list of platform strings. strings recognized from 1.8 onward are win, mac, os2, and unix; more will be added as required. unrecognized strings are ignored during parsing. an example of how to use this attribute follows: <!-- assumptions: win-toc.rdf
contains windows- and os/2-specific info, unix-toc.rdf
contains linux- and mac-specific info. --> <rdf:li> <rdf:description nc:panelid="toc" nc:platform="win os2" nc:datasources="win-toc.rdf"/> </rdf:li> <rdf:li> <rdf:descrip...
... <rdf:li> <rdf:description nc:name="" nc:link=""/> </rdf:li> the rdf:li element serves purely to contain each separate entry. the rdf:description element describes the glossary entry. it has two required attributes: nc:name and nc:link. nc:name is the name for the entry - it's what's currently displayed in the glossary as the entry's title. nc:link
contains a uri referencing what will be displayed in the viewer when the entry is accessed. the index file one important note on the index file is that there is no automatically generated set of top-level letters (e.g., a for accessibility and automation or b for book and border). help documentation may be written in any language, so such automatic splitting is not desirable. you must implement such sp...
Modularization techniques - Archive of obsolete content
g 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 class, and the declaration and implementation of our class factory. #include "nsisample.h" #include "nssample.h" static ns_define_iid(kisupportsiid, ns_isupports_iid); static ns_define_iid(kifactoryiid, ns_ifactory_iid); static ns_define_iid(kisampleiid, ns_isample_iid); static ns_define_cid(kisamplecid, ns_isample_cid); /* * nssampleclass...
...factory(&factory); nsisample *sample; nsresult res = factory->createinstance(null, kisampleiid, (void **) &sample); if (res == ns_ok) { sample->hello(); ns_release(sample); } return 0; } moving to a dynamically linked library implementing a dll once you've set a factory, moving it to a dll is a relatively trivial thing. a dll that
contains a factory need to define one or two exported functions: // returns the factory associated with the given class id extern "c" ns_export nsresult nsgetfactory(const nscid &acid, nsifactory **afactory); // returns whether the dll can be unloaded now. extern "c" ns_export prbool nscanunload(); the implementation of nsgetfactory() in the simplest case is ...
... nsifactory **afactory); // returns whether the dll can be unloaded now. extern "c" ns_export prbool nscanunload(); the implementation of nsgetfactory() in the simplest case is nearly identical to that of getsamplefactory() in our previous example. you only need to verify that the class id passed in is the correct one for the factory you implement. if your dll
contains multiple factories, you'll need to add conditional code to determine which one to return. nscanunload() is an optional, but useful function. if implemented, it allows the nsrepository to free up memory by unloading dlls it is no longer using when freelibraries() is called. the implementation takes into consideration two things when deciding whether or not a dll can be unloaded: whether any of it...
URIs and URLs - Archive of obsolete content
efinition: nsiuri and nsiurl. nsiuri represents access to a very simple, very generic form of an url. simply speaking it's scheme and non-scheme, separated by a colon, like "about". nsiurl inherits from nsiuri and represents access to typical urls with schemes like "http", "ftp", ... nssimpleuri one implementation of nsiuri is nssimpleuri which is the basis for protocols like "about". nssimpleuri
contains setters and getters for the uri and the components of an uri: scheme and path (non-scheme). there are no pre written urlparsers for simple uris, because of it's simple structure. nsstandardurl the most important implementation of nsiurl is nsstandardurl which is the basis for protocols like http, ftp, ... these schemes support a hierarchical naming system, where the hierarchy of the name is denot...
...non-scheme). there are no pre written urlparsers for simple uris, because of it's simple structure. nsstandardurl the most important implementation of nsiurl is nsstandardurl which is the basis for protocols like http, ftp, ... these schemes support a hierarchical naming system, where the hierarchy of the name is denoted by a "/" delimiter separating the components in the path. nsstandardurl also
contains the facilities to parse these typ of urls, to break the specification of the url "spec" down into the most basic segments. the spec consists of prepath and path. the prepath consists of scheme and authority. the authority consists of prehost, host and port. the prehost consists of username and password. the path consists of directory, filename, param, query and ref. the filename consists of fileb...
...be used if it is known that a string is not escaped. parsing urls rfc 2396 defines an url parser that can deal with the syntax that is common to most url schemes that are currently in existence. sometimes scheme specific parsing is required. also to be somewhat tolerant to syntax errors the parser has to know more about the specific syntax of the urls for that scheme. to stay almost generic necko
contains three parsers for the main classes of standard urls. which one has to be used is defined by the implementation of nsiprotocolhandler for the scheme in question. the three main classes are: authority the urls have an authority segment, like "http". noauthority these urls have no or a degenerated authority segment, like the "file" scheme. also this parser can identify drives if pos...
Multiple Queries - Archive of obsolete content
gle query, even for recursive content. however, it is possible to use multiple queries. this may be used to combine the results from several queries together, or may be used to generate different types of results when recursive iterations. to use multiple queries, place each query element along with its rules inside a queryset element. the queryset element is a bit of a misnomer, it actually only
contains one query each. the following is the basic structure of a template with multiple queries: <listbox datasources="..." ref="..."> <queryset> <query> ... </query> <rule> ... </rule> </queryset> <queryset> <query> ... </query> <rule> ... </rule> </queryset> </listbox> each queryset holds a query and its set of rules. if there is only r...
...the second query doesn't contain such a triple and will match all three of the photos. it the first query was used by itself, only one result would match. if the second query was used by itself, three results would match. when used together in this example, the results are combined and only three resu...
...the second query doesn't contain such a triple and will match all three of the photos. it the first query was used by itself, only one result would match. if the second query was used by itself, three results would match. when used together in this example, the results are combined and only three results are shown. however, you will...
Rule Compilation - Archive of obsolete content
« previousnext » query a xul template is made up of a query and a series of rules. a query
contains instructions for how to retrieve a set of data from the datasource. the exact syntax is dependent on the type of datasource used in the template. for instance, for an sqlite datasource, an sql statement is used as the query. this will return a table of result records which are then used to generate output. for rdf and xml, the query
contains a set of instructions for navigating through the rdf graph or xml document tree. ...
...an attribute substitution syntax, explained later, is used to modify the attributes of elements generated from the template, to correspond with the data for each result. each rule is declared with a rule tag, and you may have more than one. ...
...until the user presses the twisty to open the container or when a script opens a row. lazy generation comes in handy for menus and trees especially when dealing with recursive items. it would be rather time consuming to generate output for every item in a tree, even for those not displayed, so the template builder doesn't do so. the template builder is even lazier. if the generated content itself
contains hidden elements, those child elements will not be generated until necessary. when building content, the builder iterates down the node tree, copying and building only when needed. « previousnext » ...
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
components.classes["@mozilla.org/file/directory_service;1"].getservice( components.interfaces.nsiproperties).get("achrom", components.interfaces.nsifile).path in the javascript console window, paste the code in the field near the top. presss the return or enter key, or the evaluate button. the console displays the location of seamonkey's chrome directory. explanation: the chrome directory
contains program files that are part of seamonkey itself, together with other files that are provided by extensions. your toolbar button will be an extension. 2. delete these two files: chrome.rdf overlays.rdf explanation: seamonkey automatically rebuilds these files the next time it starts. when it rebuilds them, it will include your new extension. 3. edit the ...
...chrome://custombutton/content/button.xul</rdf:li> </rdf:seq> </rdf:li> </rdf:seq> </rdf:rdf> optionally customize the file by changing the displayname, description and author attributes. change the text between double-quote characters on those three lines. optionally remove the sections for toolbars where you do not want your button. save the file. explanation: this file
contains details of your extension, and specifies how it modifies seamonkey. 6. create a plain text file named button.xul. copy the following content, making sure that you scroll to get all of it. paste it into the new file: <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/css" href="chrome://custombutton/content/button.css"?> <!doctype overlay > <overlay id="customb...
... the button is diaplayed. it links to the button image, specifying the dimensions of the six parts of the image. 8. create a plain text file named button.js. copy the following content, and paste it into the new file: custombutton = { 1: function () { alert("just testing") }, } there is nothing to customize for now. save the file. the next section in this tutorial
contains examples of code that you can use to make your button do something useful. explanation: this file specifies what happens when you press the button. it uses the javascript programming language, together with features provided by the application. 9. download the button image. get a context menu for the image that you see here (for example, by right-clicking it). choose save image as..
Adding Style Sheets - Archive of obsolete content
mozilla applies a default style sheet to each xul window. in many cases, it will suffice to leave the defaults as is. ...
...mozilla applies a default style sheet to each xul window. in many cases, it will suffice to leave the defaults as is. ...
...e style sheet file will be stored in chrome://findfile/skin/findfile.css. all the xul examples so far have actually been using a style sheet already. the second line has always been: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> this line indicates that we want to use the style provided by chrome://global/skin/. in mozilla, this will be translated as the file global.css, which
contains default style information for xul elements. you could leave the line out and the elements will still work, however they will look fairly plain. the style sheet applies various fonts, colors and borders to make the elements look more suitable. changing the styles however, there will be times when the default look of elements will not give the look that is desired. for this, we will need to add a s...
Creating a Window - Archive of obsolete content
n/" type="text/css"?> this line is used to specify the style sheets to use for the file. this is the syntax that xml files use to import style sheets. in this case, we import the styles found in the global part of a skin package. we didn't specify a specific file so mozilla will determine which files in the directory to use. in this case, the all-important global.css file is selected. this file
contains all the default declarations for all of the xul elements. because xml does not have any knowledge of how elements should be displayed, the file indicates how. generally, you will put this line at the top of every xul file. you can also import other style sheets using a similar syntax. note that you would normally import the global style sheet from within your own style sheet file. <window this...
...necessary as you can use the window.open() function as one can do for html documents. however, one additional flag, called 'chrome' is necessary to indicate to the browser that this is a chrome document to open. this will open the window without the toolbars and menus and so forth that a normal browser window has. the syntax is described below: window.open(url,windowname,flags); where the flags
contains the flag "chrome" as in this example window.open("chrome://navigator/content/navigator.xul", "bmarks", "chrome,width=600,height=300"); if you are using firefox, try below: window.open("chrome://browser/content/places/places.xul", "bmarks", "chrome,width=600,height=300"); you can test lines of javascript like these in the error console. choose tools – error console, type a line of javascr...
...arksmanager.xul if you are using firefox, try below. firefox -chrome chrome://browser/content/places/places.xul the '-chrome' argument doesn't give the file any additional privileges. instead, it causes the specified file to open as a top-level window without any browser chrome, such as the address field or menu. only chrome urls have additional privileges. the extension developer's extension
contains an xul editor that allows you to type in xul code and see the results in real-time from within mozilla! troubleshooting if the xul window fails to show up on the desktop but has an icon on the desktop tool bar, check the xml-stylesheet declaration. make sure that you have included the stylesheet correctly: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> in the next sectio...
Grids - Archive of obsolete content
« previousnext » xul has a set of elements for creating tabular grids. xul tabular layout xul has a set of elements for doing layout of elements in a grid-like manner using the grid element. it has some similarities to the html table tag. the grid does not display anything itself; it is used only to position elements in a tabular form with rows and columns. a grid
contains elements that are aligned in rows just like tables. inside a grid, you declare two things, the columns that are used and the rows that are used. just like html tables, you put content such as labels and buttons inside the rows. however, the grid allows either row or column based organization so you may put content in either rows or in columns. it is most common to use rows, as with a table. however, you can ...
...mn flex="2"/> <column flex="1"/> </columns> <rows> <row> <button label="rabbit"/> <button label="elephant"/> </row> <row> <button label="koala"/> <button label="gorilla"/> </row> </rows> </grid> two rows and two columns have been added to a grid. each column is declared with the column tag. each column has been given a flex attribute. each row
contains two elements, both buttons. the first element in each row element is placed in the first column of the grid and the second element is each row is placed in the second column. note that you do not need an element to declare a cell -- there is no equivalent of the html td element. instead, you put the contents of cells directly in the row elements. grid with more elements you can use any element ...
...nt title:"/> <textbox id="doctitle" flex="1"/> </row> <row> <label control="docpath" value="path:"/> <hbox flex="1"> <textbox id="docpath" flex="1"/> <button label="browse..."/> </hbox> </row> </rows> </grid> notice in the image how the first column of elements containing the labels has only a single element in each row. the second column
contains a box in its second row, which in turn
contains two elements, a textbox and a button. you could add additional nested boxes or even another grid inside a single cell. if you resize the window of the last example, you will see that the textboxes resize, but no other elements do. this is because of the flex attributes added to the textboxes and the second column. the first column does not need to ...
Introduction to RDF - Archive of obsolete content
ther formats can be used and code written that will read the file and create rdf data from it. this is how mozilla works when it reads data such as bookmarks, the history or mail messages. mozilla provides datasources for this common data so that you can easily use them. you can use any of the provided rdf datasources to populate trees with data or you can point to an rdf file stored in xml which
contains the data. this makes it very convenient to display trees with lots of rows in them. rdf can also populate other xul elements as well such as listboxes and menus. we'll see this in the next section. a very brief overview of rdf will be provided here. for more information about rdf, see the rdf specification. rdf/xml rdf consists of a model, which is a graph representation of data. rdf/xml is an x...
...s with lots of rows in them. rdf can also populate other xul elements as well such as listboxes and menus. we'll see this in the next section. a very brief overview of rdf will be provided here. for more information about rdf, see the rdf specification. rdf/xml rdf consists of a model, which is a graph representation of data. rdf/xml is an xml language which can be used to represent rdf data. it
contains a fairly simple set of elements. the sample below shows a simple rdf template. <?xml version="1.0"?> <rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> ... </rdf:rdf> this has some similarities to the xul header. instead of the window element, the rdf element is used. you can see the namespace for rdf was declared so that the rdf elements are recognized properly. inside, the r...
...r. instead of the window element, the rdf element is used. you can see the namespace for rdf was declared so that the rdf elements are recognized properly. inside, the rdf element, you will place the data. to see some example rdf/xml files, look at those provided with mozilla. they have the extension rdf. rdf database let's take the example of a bookmarks list generated from rdf. a bookmarks list
contains a set of records, each with a set of data associated with it, such as a url, a bookmark title and a visited date. think of the bookmarks as a database, which is stored as a large table with numerous fields. in the case of rdf however, the lists may be hierarchical as well. this is necessary so that we can have folders or categories of bookmarks. each of the fields in an rdf database is a resource...
Property Files - Archive of obsolete content
in a script, entities cannot be used. property files are used instead. properties dtd files are suitable when you have text in a xul file. however, a script does not get parsed for entities. in addition, you may wish to display a message which is generated from a script, if, for example, you do not know the exact text to be displayed. for this purpose, property files can be used. ...
...these would be read by a script and displayed to the user. a property file can also include comments. ...
...ctory. you will notice the formatting codes %1$s and %2$s is used, and replaced different order in the array. formatting code %n$s is specify the position of corresponding parameter directly. although the word order is not the same in all the languages, by using getformattedstring() the specification of the order can be put out the property files. in case you need to format a string that already
contains the percentage character in it (to get something like "50% off" returned), escape the percentage character with another percentage character, like this: my.percentage.string = %s%% off not escaping the percentage character will generate an incorrect string that strips the space character between the percentage character and the next word of the string ("50%off"). non-ascii characters, utf-8 and ...
Tabboxes - Archive of obsolete content
application in the preferences window. a series of tabs appears across the top of a window. the user can click each tab to see a different set of options. it is useful in cases when you have more options than will fit in one screen. xul provides a method to create such dialogs. it involves five new elements, which are described briefly here and in more detail below. tabbox the outer box that
contains the tabs along the top and the tab pages themselves. tabs the inner box that
contains the individual tabs. in other words, this is the row of tabs. tab a specific tab. clicking on the tab brings the tab page to the front. tabpanels the container for the pages. tabpanel the body of a single page. you would place the content for a page within this element. the first tabpanel corresponds to ...
...ecific tab. clicking on the tab brings the tab page to the front. tabpanels the container for the pages. tabpanel the body of a single page. you would place the content for a page within this element. the first tabpanel corresponds to the first tab, the second tabpanel corresponds to the second tab and so on. the tabbox is the outer element. it consists of two children, a tabs element which
contains the row of tabs and a tabpanels elements which
contains the tabbed pages. shown below is the general syntax of a tabbox: <tabbox id="tablist"> <tabs> <!-- tab elements go here --> </tabs> <tabpanels> <!-- tabpanel elements go here --> </tabpanels> </tabbox> the tab elements are placed inside a tabs element, which is much like a regular box. the tabs element itself has been pla...
... there is really nothing special about the tab elements that make them different than boxes. like boxes, tabs can contain any element. the difference is that the tabs render slightly differently and only one tab panel's contents are visible at once, much like a deck. ...
Toolbars - Archive of obsolete content
toolbars may be placed on any side of the window, either horizontally or vertically. of course you wouldn't normally put a textbox in a vertical toolbar. ...
...toolbars may be placed on any side of the window, either horizontally or vertically. of course you wouldn't normally put a textbox in a vertical toolbar. actually, because toolbars are just boxes they can actually go anywhere you want, even in the middle of a window. ...
...inside a toolbox source view <toolbox> <toolbar id="nav-toolbar"> <toolbarbutton label="back"/> <toolbarbutton label="forward"/> </toolbar> </toolbox> this has created a toolbar containing two buttons, a back button and a forward button. the one toolbar has been placed inside the toolbox. this has involved four new tags, which are described here. toolbox a box that
contains toolbars. toolbar a single toolbar that
contains toolbar items such as buttons. toolbarbutton a button on a toolbar, which has all the same features of a regular button but is usually drawn differently. the toolbar is the main element that creates the actual toolbar. inside it are placed the individual toolbar items, usually buttons, but they can be other elements...
The Implementation of the Application Object Model - Archive of obsolete content
and then the user would pick them up. however, in order for this to work, the local bookmarks have to be merged in with the remote bookmarks specified by the site. the second reason to have local/remote merging is to save state and/or to record customizations that the user has made to his or her user interface. imagine a remote file that describes the user's personal toolbar. the downloaded file
contains an aol instant messenger button, and the user really doesn't want that on the toolbar. now since the aol bookmark was specified by the remote file, the user has no way of going off to the site and changing that file just to get rid of the button (even though the user might wish that he or she could!). what the user needs to be able to do is make a local annotation to the remote file, e.g., to sav...
... or an xml language like xul. forget xul! let's just extend html! still i say forget xul! let's just extend html and use it to represent the ui! that would also be an unwise decision for a variety of reasons. html is designed to handle documents and not to handle applications. it makes sense to maintain a clean separation between the web application and the web documents that the application
contains. by keeping the dom tree in a sandbox (safely insulated from the containing aom tree in which it might occur), you have an easy means of distinguishing the two trees and preventing scripts in the dom tree from manipulating the aom tree. in other words, it makes sense to have two parallel languages, one for describing applications, and the other for describing documents that can be used by those a...
...s be the same kind of object, and that those objects communicate with their pluggable content through this new streamlined interface we talked about earlier. we'll call this new interface a pluggable data source. just in case you still aren't convinced that all content nodes should be the same kind of element, consider another problem: how to implement aggregation. suppose that a bookmarks folder
contains a mailbox folder, a composer page template, and a bookmark. in order to achieve aggregation of data, a content node implementation cannot make any assumptions about what kind of children it holds. it can only refer to its child nodes through the various content tree interfaces. what we run into now is the problem of how one local content node knows how to instantiate other kinds of content nodes.
Monitoring plugins - Archive of obsolete content
further. you can find more information on the observer service here and here. ...
...ents.classes["@mozilla.org/observer-service;1"] .getservice (components.interfaces.nsiobserverservice); observerservice.addobserver(this, "experimental-notify-plugin-call", false); observing as discussed above, to specify what you want done when a notification arrives your class must have an observe method, receiving 3 parameters (subject, topic and data). the topic
contains the notification's topic - experimental-notify-plugin-call in this case, the data is the runtime in milliseconds and the subject is always null and should not be used. here is an example that shows the runtime in an alert box to the user if the runtime exceeds half a second in length: observe: function(subject, topic, data) { if (topic == "experimental-notify-plugin-call" ) { if (da...
...tatement first checks to see that the arriving notification's topic is the correct one. this is useful in cases where your class is registered to receive notifications for more than one topic with the observer service. ...
NPSetWindowCallbackStruct - Archive of obsolete content
display standard x toolkit attribute. pointer to the display structure that represents the browser-server connection. visual standard x toolkit attribute. ...
... display standard x toolkit attribute. pointer to the display structure that represents the browser-server connection. visual standard x toolkit attribute. x visual for the plug-in window or drawable. colormap standard x toolkit attribute. ...
...tandard x toolkit attribute. x visual for the plug-in window or drawable. colormap standard x toolkit attribute. colormap for the plug-in window or drawable. depth standard x toolkit attribute. depth of the plug-in window or drawable. description callback structures are used to pass platform-specific information. the npsetwindowcallbackstruct object, allocated by the browser,
contains information required for the ws_info field of an npwindow. the npp_setwindow() function passes a pointer to this structure to the plug-in. the structure is valid for the lifetime of the npwindow, that is, until npp_setwindow() is called again or the instance is destroyed. the type field of this structure always
contains np_setwindow. the remaining fields are standard x toolkit attributes of the t...
NPWindow - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary
contains information about the target into which the plug-in instance can draw. syntax typedef struct _npwindow { void* window; /* platform specific handle */ uint32_t x; /* coordinates of top left corner */ uint32_t y; /* relative to a netscape page */ uint32_t width; /* maximum window size */ uint32_t height; nprect cliprect; /* clipping rectangle coordinates */ #ifdef xp_unix void * ws_info; /* platform-dependent additional data */ #endif /* xp_unix */ npwindowtype type; /* window or drawable target */ } npwindow; fields the data structure has the following fields: window platform-specific handle to a native window element in the netscap...
...y the plug-in. cliprect clipping rectangle of the plug-in; the origin is the top left corner of the drawable or window. clipping to the cliprect prevents the plug-in from overwriting the status bar, scroll bars, and other page elements when partially scrolled off the screen. mac os: cliprect is the rectangle in port coordinates to which the plug-in should clip its drawing. ws_info unix:
contains information about the plug-in's unix window environment; points to an npsetwindowcallbackstruct. type npwindowtype value that specifies whether the npwindow instance represents a window or a drawable. values: npwindowtypewindow: indicates that the window field holds a platform-specific handle to a window (as in navigator 2.0 and navigator 3.0). the plug-in is considered windowed. npwin...
...s that the plugin is windowless. the window field holds a platform-specific handle to a drawable or an off-screen pixmap, as follows: windows: hdc mac os: pointer to np_port structure unix/x11: not used. (the drawable is provided in a graphicsexpose event, when the paint is requested.) description the npwindow structure represents the native window or a drawable, and
contains information about coordinate position, size, whether the plug-in is windowed or windowless, and some platform-specific information. the plug-in area is a native window element on windows and unix, or a rectangle within a native window on mac os. the x, y, height, and width coordinates of npwindow specify the position and size of this area. the browser calls npp_setvalue whenever the drawable cha...
Introduction to Public-Key Cryptography - Archive of obsolete content
ate that identifies some entity through two subordinate ca certificates to the ca certificate for the root ca (based on the ca hierarchy shown in figure 6). a certificate chain traces a path of certificates from a branch in the hierarchy to the root of the hierarchy. in a certificate chain, the following occur: each certificate is followed by the certificate of its issuer. each certificate
contains the name (dn) of that certificate's issuer, which is the same as the subject name of the next certificate in the chain. in figure 7, the engineering ca certificate
contains the dn of the ca (that is, usa ca), that issued that certificate. usa ca's dn is also the subject name of the next certificate in the chain. each certificate is signed with the private key of its issuer. the signature can...
...on that client or server) or the certificate chain provided by the subject (for example, over an ssl connection). the certificate signature is verified using the public key in the issuer's certificate. if the issuer's certificate is trusted by the verifier in the verifier's certificate database, verification stops successfully here. otherwise, the issuer's certificate is checked to make sure it
contains the appropriate subordinate ca indication in the red hat certificate type extension, and chain verification returns to step 1 to start again, but with this new certificate. figure 8 presents an example of this process. figure 8 shows what happens when only root ca is included in the verifier's local database. if a certificate for one of the intermediate cas shown in figure 8, such as engineer...
...ates to control access to various network resources by different users or groups. issuing certificates and other certificate management tasks can thus be an integral part of user and group management. in general, high-performance directory services are an essential ingredient of any enterprise certificate management strategy. key management before a certificate can be issued, the public key it
contains and the corresponding private key must be generated. sometimes it may be useful to issue a single person one certificate and key pair for signing operations, and another certificate and key pair for encryption operations. separate signing and encryption certificates make it possible to keep the private signing key on the local machine only, thus providing maximum nonrepudiation, and to back up th...
Introduction to SSL - Archive of obsolete content
protocol called transport layer security (tls) is based on ssl. the details of the protocol are available in request for comments (rfc): 2246,the tls protocol version 1.0. some red hat products already support tls. most other red hat products plan to support the protocol in future versions. this document is primarily intended for administrators of red hat server products, but the information it
contains may also be useful for developers of applications that support ssl. the document assumes that you are familiar with the basic concepts of public-key cryptography, as summarized in "introduction to public-key cryptography." the ssl protocol the transmission control protocol/internet protocol (tcp/ip) governs the transport and routing of data over the internet. other protocols, such as the hypert...
...hentication, or cryptographic validation by a client of the server's identity. as explained in step 2 of "the ssl handshake", the server sends the client a certificate to authenticate itself. the client uses the certificate in step 3 to authenticate the identity the certificate claims to represent. to authenticate the binding between a public key and the server identified by the certificate that
contains the public key, an ssl-enabled client must receive a "yes" answer to the four questions shown in figure 2. although the fourth question is not technically part of the ssl protocol, it is the client's responsibility to support this requirement, which provides some assurance of the server's identity and thus helps protect against a form of security attack known as "man in the middle." an ssl-ena...
... digital signature by creating a one-way hash from data generated randomly during the handshake and known only to the client and server. the hash of the data is then encrypted with the private key that corresponds to the public key in the certificate being presented to the server. to authenticate the binding between the public key and the person or other entity identified by the certificate that
contains the public key, an ssl-enabled server must receive a "yes" answer to the first four questions shown in figure 3. although the fifth question is not part of the ssl protocol, red hat servers can be configured to support this requirement to take advantage of the user's entry in an ldap directory as part of the authentication process. an ssl-enabled server goes through these steps to authenticate...
XForms Output Element - Archive of obsolete content
ining simple content of any data type. representations the xforms output element can be represented by the following widgets for the specified data types (or types derived from these data types): text - default representation for instance data of most types, especially static text (xhtml/xul). calendar - used to represent instance data of type date (xhtml/xul). image - if the instance node
contains an image, then an output element can be used in combination with the mediatype element to display the image (fx 3.0 only, xhtml/xul). text displaying the data as text is the default presentation. xforms output is most often used when a form author needs to render simple text of an instance node (xhtml/xul). characteristics text is presented to the user when there is no type given for the bou...
...y a calendar widget in the mozilla xforms processor if the control meets the following criteria (xhtml/xul). characteristics the bound instance node is of type xsd:date or a type derived from it in addition, the appearance attribute must also contain the value "full" firefox 2.0 doesn't currently have any similar widgets available for use with xhtml or xul. ...
...y similar widgets available for use with xhtml or xul. image if the bound instance node
contains an image then you are free to use this representation to show the image instead of the byte sequence of the image data (fx 3.0 only, xhtml/xul). characteristics the bound instance node is of type xsd:anyuri, xsd:base64binary or a type derived from it either the mediatype attribute is present and
contains the image's mimetype or the output element
contains a mediatype element which specifies the image's mimetype (for example, image/*). ...
Desktop gamepad controls - Game development
ng the buttons. phaser approach let's move on to the final gamepad api implementation in the captain rogers: battle at andromeda game we created with phaser. this is pure javascript code however too, so can be used in any other project no matter what framework was used. first off, we'll create a small library that will take care of handling the input for us. ...
...ct() and disconnect() functions are bound to the following events: window.addeventlistener("gamepadconnected", gamepadapi.connect); window.addeventlistener("gamepaddisconnected", gamepadapi.disconnect); they are fired when the gamepad is connected and disconnected respectively. the next function is update(), which updates the information about the pressed buttons and axes. the buttons variable
contains the layout of a given controller (for example which buttons are where, because an xbox 360 layout may be different to a generic one), the cache containing the information about the buttons from the previous frame and the status containing the information from the current frame. the pressed() function gets the input data and sets the information about it in our object, and the axes property store...
...ut the controller is stored in the object: connect: function(event) { gamepadapi.controller = event.gamepad; gamepadapi.active = true; }, the disconnect function removes the information from the object: disconnect: function(event) { delete gamepadapi.controller; gamepadapi.active = false; }, the update() function is executed in the update loop of the game on every frame, so it
contains the latest information on the pressed buttons: update: function() { gamepadapi.buttons.cache = []; for(var k=0; k<gamepadapi.buttons.status.length; k++) { gamepadapi.buttons.cache[k] = gamepadapi.buttons.status[k]; } gamepadapi.buttons.status = []; var c = gamepadapi.controller || {}; var pressed = []; if(c.buttons) { for(var b=0,t=c.buttons.length; b<t; b++) { if(c.b...
Accessibility tree (AOM) - MDN Web Docs Glossary: Definitions of Web-related terms
browsers then create an accessibility tree based on the dom tree, which is used by platform-specific accessibility apis for assistive technologies, such as screen readers. ...
...browsers then create an accessibility tree based on the dom tree, which is used by platform-specific accessibility apis for assistive technologies, such as screen readers. ...
... ...
Images, media, and form elements - Learn web development
from following these lessons, everything in css generates a box. if you place an image inside a box that is smaller or larger than the intrinsic dimensions of the image file in either direction, it will either appear smaller than the box, or overflow the box. you need to make a decision about what happens with the overflow. in the example below we have two boxes, both 200 pixels in size: one
contains an image which is smaller than 200 pixels — it is smaller than the box and doesn't stretch to fill it. the other is larger than 200 pixels and overflows the box. so what can we do about the overflowing issue? as we learned in our previous lesson, a common technique is to make the max-width of an image 100%. this will enable the image to become smaller in size than the box but not larger. ...
...tially to avoid them being stretched strangely by the layout. to force the image to stretch to fill the grid cell it is in, you'd have to do something like following: img { width: 100%; height: 100%; } this would however stretch the image, so probably isn't what you'd want to do. form elements form elements can be a tricky issue when it comes to styling with css, and the web forms module
contains detailed guides to the trickier aspects of styling form elements, which i will not fully reproduce here. there are a few key basics worth highlighting in this section of the article. many form controls are added to your page by way of the <input> element — this defines simple form fields such as text inputs, through to more complex fields added in html5 such as color and date pickers. there ar...
...ticle. many form controls are added to your page by way of the <input> element — this defines simple form fields such as text inputs, through to more complex fields added in html5 such as color and date pickers. there are some additional elements, such as <textarea> for multiline text input, and also elements used to contain and label parts of forms such as <fieldset> and <legend>. html5 also
contains attributes that enable web developers to indicate which fields are required, and even the type of content that needs to be entered. if the user enters something unexpected, or leaves a required field blank, the browser can show an error message. different browsers are inconsistent in how much styling and customization they allow for such items. styling text input elements elements that allow fo...
Attribute selectors - Learn web development
ttr] a[title] matches elements with an attr attribute (whose name is the value in square brackets). [attr=value] a[href="https://example.com"] matches elements with an attr attribute whose value is exactly value — the string inside the quotes. [attr~=value] p[class~="special"] matches elements with an attr attribute whose value is exactly value, or
contains value in its (space separated) list of values. [attr|=value] div[lang|="zh"] matches elements with an attr attribute whose value is exactly value or begins with value immediately followed by a hyphen. in the example below you can see these selectors being used. by using li[class] we can match any selector with a class attribute. this matches all of the list items exce...
... these selectors being used. by using li[class] we can match any selector with a class attribute. this matches all of the list items except the first one. li[class="a"] matches a selector with a class of a, but not a selector with a class of a with another space-separated class as part of the value. it selects the second list item. li[class~="a"] will match a class of a but also a value that
contains the class of a as part of a whitespace-separated list. it selects the second and third list items. substring matching selectors these selectors allow for more advanced matching of substrings inside the value of your attribute. for example, if you had classes of box-warning and box-error and wanted to match everything that started with the string "box-", you could use [class^="box-"] to selec...
...le description [attr^=value] li[class^="box-"] matches elements with an attr attribute (whose name is the value in square brackets), whose value begins with value. [attr$=value] li[class$="-box"] matches elements with an attr attribute whose value ends with value. [attr*=value] li[class*="box"] matches elements with an attr attribute whose value
contains value anywhere within the string. (aside: it may help to note that ^ and $ have long been used as anchors in so-called regular expressions to mean begins with and ends with.) the next example shows usage of these selectors: li[class^="a"] matches any attribute value which starts with a, so matches the first two list items. li[class$="a"] matches any attribute value that ends with a, s...
Client-side form validation - Learn web development
k in an accessible manner and let them edit their content down to size. an example of this is the character limit seen on twitter when tweeting. javascript, including solutions using maxlength, can be used to provide this constraining the values of your entries for number fields (i.e. <input type="number">), the min and max attributes can be used to provide a range of valid values. if the field
contains a value outside this range, it will be invalid. let's look at another example. create a new copy of the fruit-start.html file. now delete the contents of the <body> element, and replace it with the following: <form> <div> <label for="choose">would you prefer a banana or a cherry?</label> <input type="text" id="choose" name="i_like" required minlength="6" maxlength="6"> </div> <di...
...roperties available on the above elements. validationmessage: returns a localized message describing the validation constraints that the control doesn't satisfy (if any). if the control is not a candidate for constraint validation (willvalidate is false) or the element's value satisfies its constraints (is valid), this will return an empty string. validity: returns a validitystate object that
contains several properties describing the validity state of the element. you can find full details of all the available properties in the validitystate reference page; below is listed a few of the more common ones: patternmismatch: returns true if the value does not match the specified pattern, and false if it does match. if true, the element matches the :invalid css pseudo-class. toolong: retur...
...he data is too short // display the following error message. emailerror.textcontent = `email should be at least ${ email.minlength } characters; you entered ${ email.value.length }.`; } // set the styling appropriately emailerror.classname = 'error active'; } the comments explain things pretty well, but briefly: every time we change the value of the input, we check to see if it
contains valid data. if it has then we remove any error message being shown. if the data is not valid, we run showerror() to show the appropriate error. every time we try to submit the form, we again check to see if the data is valid. if so, we let the form submit. if not, we run showerror() to show the appropriate error, and stop the form submitting with preventdefault(). the showerror() function uses ...
How to build custom form controls - Learn web development
t it's better to set it through javascript. --> <div class="select" tabindex="0"> <!-- this container will be used to display the current value of the control --> <span class="value">cherry</span> <!-- this container will contain all the options available for our control. because it's a list, it makes sense to use the ul element. ...
...e. we can now start to define all the functions that will be used each time the user interacts with our control. ...
... selectlist.foreach(deactivateselect); // and we turn on the active state for this specific control select.classlist.add('...
Sending form data - Learn web development
ral ways to perform a request; html form data can be transmitted via a number of different methods, the most common being the get method and the post method to understand the difference between those two methods, let's step back and examine how http works. each time you want to reach a resource on the web, the browser sends a request to a url. an http request consists of two parts: a header that
contains a set of global metadata about the browser's capabilities, and a body that can contain information necessary for the server to process the specific request. the get method the get method is the method used by the browser to ask the server to send back a given resource: "hey server, i want to get this resource." in this case, the browser sends an empty body. because the body is empty, if a form ...
...// the global $_post variable allows you to access the data sent with the post method by name // to access the data sent with the get method, you can use $_get $say = htmlspecialchars($_post['say']); $to = htmlspecialchars($_post['to']); echo $say, ' ', $to; ?> this example displays a page with the data we sent. you can see this in action in our example php-example.html file — which
contains the same example form as we saw before, with a method of post and an action of php-example.php. when it is submitted, it sends the form data to php-example.php, which
contains the php code seen in the above block. when this code is executed, the output in the browser is hi mom. note: this example won't work when you load it into a browser locally — browsers cannnot interpret php code, so wh...
...): form.html: the same form as we saw above in the the post method section but with the action set to {{ url_for('hello') }}. this is a jinja2 template, which is basically html but can contain calls to the python code that is running the web server contained in curly braces. url_for('hello') is basically saying "redirect to /hello when the form is submitted". greeting.html: this template just
contains a line that renders the two bits of data passed to it when it is rendered. this is done via the hello() function seen above, which runs when the /hello url is navigated to. note: again, this code won't work if you just try to load it into a browser directly. python works a bit differently to php — to run this code locally you'll need to install python/pip, then install flask using pip3 insta...
What’s in the head? Metadata in HTML - Learn web development
prerequisites: basic html familiarity, as covered in getting started with html. ...
...ained in the previous section on <title> (the title-example.html page), try changing the meta charset value to iso-8859-1, and add the japanese to your page. this is the code we used: <p>japanese example: ご飯が熱い。</p> adding an author and description many <meta> elements include name and content attributes: name specifies the type of meta element it is; what type of information it
contains. content specifies the actual meta content. two such meta elements that are useful to include on your page define the author of the page, and provide a concise description of the page. let's look at an example: <meta name="author" content="chris mills"> <meta name="description" content="the mdn web docs learning area aims to provide complete beginners to the web with all they need to know to ...
... and javascript to power interactive functionality, such as video players, maps, games, and more. these are most commonly applied to a web page using the <link> element and the <script> element, respectively. the <link> element should always go inside the head of your document. this takes two attributes, rel="stylesheet", which indicates that it is the document's stylesheet, and href, which
contains the path to the stylesheet file: <link rel="stylesheet" href="my-css-file.css"> the <script> element should also go into the head, and should include a src attribute containing the path to the javascript you want to load, and defer, which basically instructs the browser to load the javascript at the same time as the page's html. this is useful as it makes sure that the html is all loaded...
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
r with the l key. when the start button is pressed, a spinner like the one we saw earlier is displayed for a random amount of time between 5 and 10 seconds. after that time, a message will appear saying "players go!!" — once this happens, the first player to press their control button will win the game. let's work through this: first of all, download the starter file for the app. this
contains the finished html structure and css styling, giving us a game board that shows the two players' information (as seen above), but with the spinner and results paragraph displayed on top of one another. you just have to write the javascript code. inside the empty <script> element on your page, start by adding the following lines of code that define some constants and variables you'll need in ...
... the code: const spinner = document.queryselector('.spinner p'); const spinnercontainer = document.queryselector('.spinner'); let rotatecount = 0; let starttime = null; let raf; const btn = document.queryselector('button'); const result = document.queryselector('.result'); in order, these are: a reference to the spinner, so you can animate it. a reference to the <div> element that
contains the spinner, used for showing and hiding it. a rotate count. this determines how much you want to show the spinner rotated on each frame of the animation. a null start time. this will be populated with a start time when the spinner starts spinning. an uninitialized variable to later store the requestanimationframe() call that animates the spinner. a reference to the start button. a...
...ner container. next, display the results paragraph and set its text content to "players go!!" to signal to the players that they can now press their button to win. attach a keydown event listener to the document. when any button is pressed down, the keyhandler() function is run. inside keyhandler(), the code includes the event object as a parameter (represented by e) — its key property
contains the key that was just pressed, and you can use this to respond to specific key presses with specific actions. set the variable isover to false, so we can track whether the correct keys were pressed for player 1 or 2 to win. we don't want the game ending when a wrong key was pressed. log e.key to the console, which is a useful way of finding out the key value of different keys you are pressi...
Third-party APIs - Learn web development
ue, size: 'md', symbol: 'a' }) }) .bindpopup('this is manchester!') .addto(map); as you can see, this at its simplest takes two parameters, an array containing the coordinates at which to display the marker, and an options object containing an icon property that defines the icon to display at that point. the icon is defined using an mapquest.icons.marker() method, which as you can see
contains information such as color and size of marker. onto the end of the first method call we chain .bindpopup('this is manchester!'), which defines content to display when the marker is clicked. finally, we chain .addto(map) to the end of the chain to actually add the marker to the map. have a play with the other options shown in the documentation and see what you can come up with! mapquest provides...
... and then click "create"). get the api key from the resulting page. now, to start the example off, make copies of nytimes_start.html and nytimes.css in a new directory on your computer. if you've already cloned the examples repository, you'll already have a copy of these files, which you can find in the javascript/apis/third-party-apis/nytimes directory. initially the <script> element
contains a number of variables needed for the setup of the example; below we'll fill in the required functionality. the app will end up allowing you to type in a search term and optional start and end dates, which it will then use to query the article search api and display the search results. connect the api to your app first, you'll need to make a connection between the api and your app. in the ...
...on> no longer has any children. next, we set the articles variable to equal json.response.docs — this is the array holding all the objects that represent the articles returned by the search. this is done purely to make the following code a bit simpler. the first if() block checks to see if 10 articles are returned (the api returns up to 10 articles at a time.) if so, we display the <nav> that
contains the previous 10/next 10 pagination buttons. if less than 10 articles are returned, they will all fit on one page, so we don't need to show the pagination buttons. we will wire up the pagination functionality in the next section. the next if() block checks to see if no articles are returned. if so, we don't try to display any — we create a <p> containing the text "no results returned." and inse...
Basic math in JavaScript — numbers and operators - Learn web development
e value — by putting the operator at the start of the variable instead of the end. try the above examples again, but this time use ++num1 and --num2. assignment operators assignment operators are operators that assign a value to a variable. we have already used the most basic one, =, loads of times — it simply assigns the variable on the left the value stated on the right: let x = 3; // x
contains the value 3 let y = 4; // y
contains the value 4 x = y; // x now
contains the same value y
contains, 4 but there are some more complex types, which provide useful shortcuts to keep your code neater and more efficient. the most common are listed below: operator name purpose example shortcut for += addition assignment adds the value on the right to the vari...
... by the value on the right, and returns the new variable value x /= 5; x = x / 5; try typing some of the above examples into your console, to get an idea of how they work. in each case, see if you can guess what the value is before you type in the second line. note that you can quite happily use other variables on the right hand side of each expression, for example: let x = 3; // x
contains the value 3 let y = 4; // y
contains the value 4 x *= y; // x now
contains the value 12 note: there are lots of other assignment operators available, but these are the basic ones you should learn now. active learning: sizing a canvas box in this exercise, you will manipulate some numbers and operators to change the size of a box. the box is drawn using a browser api called the canvas api. th...
... txt.textcontent = 'the machine has started!'; } else { btn.textcontent = 'start machine'; txt.textcontent = 'the machine is stopped.'; } } open in new window you can see the equality operator being used just inside the updatebtn() function. in this case, we are not testing if two mathematical expressions have the same value — we are testing whether the text content of a button
contains a certain string — but it is still the same principle at work. if the button is currently saying "start machine" when it is pressed, we change its label to "stop machine", and update the label as appropriate. if the button is currently saying "stop machine" when it is pressed, we swap the display back again. note: such a control that swaps between two states is generally referred to as a tog...
Object prototypes - Learn web development
note: before ecmascript 2015, there wasn't officially a way to access an object's prototype directly — the "links" between the items in the chain are defined in an internal property, referred to as [[prototype]] in the specification for the javascript language (see ecmascript). most modern browsers, however, do offer property available called __proto__ (that's 2 underscores either side), which
contains the object's constructor's prototype object. for example, try person1.__proto__ and person1.__proto__.__proto__ to see what the chain looks like in code! since ecmascript 2015, you can access an object's prototype object indirectly via object.getprototypeof(obj). the prototype property: where inherited members are defined so, where are the inherited properties and methods defined? if you look...
...prototype property, which is an object, as mentioned in the above section) become available to all the instance objects created using the person() constructor. hence, the constructor property is also available to both person1 and person2 objects. for example, try these commands in the console: person1.constructor person2.constructor these should both return the person() constructor, as it
contains the original definition of these instances. a clever trick is that you can put parentheses onto the end of the constructor property (containing any required parameters) to create another object instance from that constructor. the constructor is a function after all, so can be invoked using parentheses; you just need to include the new keyword to specify that you want to use the function as a c...
...ject instance scope. so you might define constant properties on the prototype (i.e. ones that never need to change), but generally it works better to define properties inside the constructor. in fact, a fairly common pattern for more object definitions is to define the properties inside the constructor, and the methods on the prototype. this makes the code easier to read, as the constructor only
contains the property definitions, and the methods are split off into separate blocks. for example: // constructor with property definitions function test(a, b, c, d) { // property definitions } // first method definition test.prototype.x = function() { ... }; // second method definition test.prototype.y = function() { ... }; // etc. this pattern can be seen in action in piotr zalewa's school pl...
Getting started with React - Learn web development
├── favicon.ico │ ├── index.html │ └── manifest.json └── src ├── app.css ├── app.js ├── app.test.js ├── index.css ├── index.js ├── logo.svg └── serviceworker.js the src directory is where we'll spend most of our time, as it's where the source code for our application lives. the public directory
contains files that will be read by your browser while you're developing the app; the most important of these is index.html. react injects your code into this file so that your browser can run it. there's some other markup that helps create-react-app function, so take care not to edit it unless you know what you're doing. you very much should change the text inside the <title> element in this file to refl...
...title> element in this file to reflect the title of your application. accurate page titles are important for accessibility! the public directory will also be published when you build and deploy a production version of your app. we won’t cover deployment in this tutorial, but you should be able to use a similar solution to that described in our deploying our app tutorial. the package.json file
contains information about our project that node.js/npm uses to keep it organized. this file is not unique to react applications; create-react-app merely populates it. you don't need to understand this file at all to complete this tutorial, however, if you'd like to learn more about it, you can read what is the file `package.json`? on nodejs.org; we also talk about it in our package management basics tuto...
...json`? on nodejs.org; we also talk about it in our package management basics tutorial. exploring our first react component — <app/> in react, a component is a reusable module that renders a part of our app. these parts can be big or small, but they are usually clearly defined: they serve a single, obvious purpose. let's open src/app.js, since our browser is prompting us to edit it. this file
contains our first component, app, and a few other lines of code: import react from 'react'; import logo from './logo.svg'; import './app.css'; function app() { return ( <div classname="app"> <header classname="app-header"> <img src={logo} classname="app-logo" alt="logo" /> <p> edit <code>src/app.js</code> and save to reload. </p> <a classn...
Deploying our app - Learn web development
d of running the server with npx parcel src/index.html, we can run it with npx parcel build src/index.html and parcel will build everything ready for production instead of just running it for development and testing purposes. this includes doing minification and tree-shaking of code, and cache-busting on filenames. the newly-created production code is placed in a new directory called dist, which
contains all the files required to run the website, ready for you to upload to a server. however, doing this step manually isn't our final aim — what we want is for the build to happen automatically and the result of the dist directory to be deployed live on our website. this is where our code, github, and netlify need to be set up to talk to one another, so that each time we update our github code re...
...it can find. select your project repository and proceed to the next step. since we've connected netlify to our github account and given it access to deploy the project repository, netlify will ask how to prepare the project for deployment and what to deploy. you should enter the command npm run build for the build command, and specify the dist directory for the publish directory — this
contains the code that we want to make public. to finish up, click deploy site. after a short wait for the deployment to occur, you should get a url that you can go to, to see your published site — try it out! and even better, whenever we make a change and push the change to our remote git repository (on github), this will trigger a notification to netlify which will then run our s...
...itlab, etc., all support running tests against individual commits. as this project is deploying to netlify, and netlify only asks about the build command, we will have to make the tests part of the build. if the test fails, the build fails, and netlify won’t deploy. let’s get started. go to your package.json file and open it up. ...
Displaying Places information using views
w must import the stylesheet browser/components/places/content/places.css and overlay the file browser/components/places/content/placesoverlay.xul: <?xml-stylesheet href="chrome://browser/content/places/places.css" ?> <?xul-overlay href="chrome://browser/content/places/placesoverlay.xul" ?> it's this stylesheet that binds elements with the special type attribute to one of the views. the overlay
contains javascript required by the views. it also
contains the built-in places context menu and commands, which you may want to take advantage of in your own uses of the views. connecting a view to its data to hook up a built-in view to its data, use the view's special place attribute. note: starting in gecko 2.0, you can't use the place attribute with menus. see menu view for details. you may spec...
... the built-in tree view is backed by an instance of placestreeview, a prototype defined in browser/components/places/content/treeview.js. placestreeview performs doubl...
...neral way to interact with views. your view should also either implement or own an instance of nsinavhistoryresultobserver. to hook up your view to a nsinavhistoryresult object, you call addobserver() on the result, passing the viewer object which is an instance of nsinavhistoryresultobserver. if your view implements nsinavhistoryresultobserver, then you can pass your viewer object. if your view
contains an internal instance of nsinavhistoryresultobserver, you would pass it instead. (the three built-in views take this approach.) the results object then communicates to your view via this instance, notifying it about changes in the underlying data so it can update its display. var bmserv = components.classes["@mozilla.org/browser/nav-bookmarks-service;1"]. getservice(components.interfaces.
Message manager overview
load a frame script using the global frame message manager, the script gets loaded separately into every open tab: three times, in the diagram above. similarly, if you send a message using the global frame message manager, it's received by all content tabs, and is then delivered to any frame scripts that are listening for it. ...
...window: two, in the diagram above. it operates on all content tabs in a given window. if you load a frame script using the window message manager it gets loaded separately into each tab open in that particular window. if you send a message using the window message manager, it gets sent to all content tabs in that window. ...
...cess global parent process message manager description the global parent process message manager (gppmm) is global to the parent process. messages sent using the gppmm get sent to all cpmms in all child processes. process scripts loaded using the gppmm get loaded in all child processes. ...
Gecko SDK
the gecko sdk, also known as the xulrunner sdk, is a set of xpidl files, headers and tools to develop xpcom components which can then in turn e.g. be accessed from xul using javascript. note that in order to develop such components, you do not need the full sources of e.g. firefox, since you do not access parts of the front end from within a component. furthermore, since a component
contains basic functionality, it is intended to run with every product of the mozilla platform. therefore it makes no sense to use a particular product to build general functionality. that's the reason why the gecko sdk was devised. do not confuse the gecko/xulrunner sdk with xulrunner itself. the gecko sdk is a collection of header files and tools used to develop general xpcom components which add functional...
...that's the reason why the gecko sdk was devised. do not confuse the gecko/xulrunner sdk with xulrunner itself. the gecko sdk is a collection of header files and tools used to develop general xpcom components which add functionality to the existing platform, whereas xulrunner is a framework which can be used to run standalone or embedded applications based on the mozilla framework. the gecko sdk
contains all of the necessary tools and headers for making scriptable npapi plugins including the xpidl compiler/linker and the latest npapi.h. get the sdk updates there is no need to download or rebuild the gecko sdk corresponding to security updates of mozilla (e.g., mozilla 1.7.3) since the headers and glue libs in the gecko sdk are usually not changed as a result of security updates. you do have to...
...the problem. building the sdk to build the sdk, you should build xulrunner (the gecko sdk is built as part of the xulrunner build process, which is why it's sometimes called the xulrunner sdk). see the build documentation for complete details. after the xulrunner build is complete running make sdk from your object directory will create a package of the sdk in dist. contents of the sdk the sdk
contains the following: 1.9.2 idl files for frozen interfaces (under idl/) header files for frozen interfaces, xpcom functions, and nspr functions (under include/) import libraries or shared libraries (under lib/) static utility libraries (under lib/) various tools (under bin/) for more information about safely linking xpcom components using the xpcom "glue" library, see xpcom glue. using the m...
HTML parser threading
html parser threading the html parser parses data received from the network off the main thread. (there's currently one parser thread serving all parser instances.) data received from document.write() is parsed on the main thread. main objects nshtml5parser
contains the code for dealing with data from document.write(). (for historical reasons, it also
contains unrelated fragment parsing code that should be refactored into a separate class in due course.) nshtml5streamparser
contains the code for dealing with data from the network. nshtml5parser owns nshtml5streamparser. script-created parsers (i.e. parsers created using document.open()) don't have an nshtml5streamparser instance. nshtml5parser has one tokenizer/tree builder pair for parsing data from document.write(). it also has another l...
...he main thread, marks the nshtml5streamparser as being in a speculating state and sets the newly created speculation object as the tree op sink (instead of the tree op stage described earlier) of the tree builder. ...
...html5owningutf16buffer that
contains the starting point of the speculation, an index into the nshtml5owningutf16buffer defining the exact starting point within the buffer, the line number of the tokenizer at that point and a snapshot of the tree op state. the line number and the snapshot are also added to the tree op that attempts to execute scripts (before flushing it). the tree builder snapshot
contains a copy of the tree builder stack, a copy of the list of open formatting elements and copies of various fields that define the tree builder state. it
contains all the information that is necessary to load back into the tree builder to restore it into a behaviorally equivalent state. the flush timer is disengaged, because it's not useful to make the tree builder flush ops into the queue of the spec...
Internationalized Domain Names (IDN) Support in Mozilla Browsers
s is then used to connect to the web server in question. idn allows host/domain names with non-ascii characters for user input into a browser's location bar or url's embedded in web pages. at the network protocol level, there is no change in the restriction that only a subset of ascii characters be used in url/uri. if end users input non-ascii characters as part of a domain name or if a web page
contains a link using a non-ascii domain name, the application must convert such input into a special encoded format using only the usual ascii subset characters. rfc 3490 (internationalizing domain names in applications (idna)) defines characters used in idn to be drawn from unicode standard 3.2. it also defines how an application should process non-ascii characters in such a way to conform to existing h...
...s only restricted ascii characters and numbers (a-z0-9) and a hyphen (-). it was shown to be language independent, superior in compression, compact in code size, round-trip safe, and superior for encoding chinese/japanese/korean characters. the final step of the process is the affixing of the ace prefix to the output string from the nameprep/stringprep and punycode processing. since the punycode
contains only ascii characters, it is possible that an output may, though unlikely, coincide with existing domain names. to avoid such a complication, rfc 3490 defines a special prefix "xn--" for the ace (punycode) output. other encodings used different prefixes. e.g. "bq--" for race, but all except the standard ace prefix "xn--" are now disallowed in idn. as an example, an output string to be sent to a ...
...issue was for domain name registrars to agree on an international guideline on the use of idn characters. this was accomplished by the publication of the icann guideline for idn in june of 2003. (cf. icann = internet corporation for assigned names and numbers.) the guideline allows domain name registrars in each country to limit the use of characters for domain names. since the unicode repertoire
contains characters no longer used in any living languages and there are also living characters in most languages that are not suitable for uri/url creation, the icann guideline allows the governing body of each country's domain registrars to set appropriate limitations on the use of characters. with this last piece of obstacle for standardization out of the way, domain name registrars are expected to mo...
MathML Demo: <mo> - operator, fence, separator, or accent
the symbols occur in the context of a simple expression. in general, the lspace and rspace around the relation should be greater than that around the operation. operator and relations center vertically on the math axis. ...
...the symbols occur in the context of a simple expression. in general, the lspace and rspace around arrows should be similar to the spacing around relations. there is an issue with the markup of "long" latex arrows in mathml. there are entities from these arrows, ⟵ ⟵ ⟶ etc. but they have no standard unicodes. they can be viewe...
...the symbols occur in the context of a simple expression. in general, the lspace and rspace around negated relations should be similar to the spacing around relations. a + b ≠ c ⋅ d a + b = c ⋅ d a - b ∉ c * d a - b ∈ c * d a + b ≨︀ c × d...
BloatView
it finds leaks, you can use refcount tracing and balancing to discover the root cause. how to build with bloatview build with --enable-debug or --enable-logrefcnt. how to run with bloatview the are two environment variables that can be used. xpcom_mem_bloat_log if set, this causes a bloat log to be printed on program exit, and each time nstracerefcnt::dumpstatistics is called. ...
...here's a sample of the bloatview output. ...
...e a global variable or service. usually this will have a large number of refcounts. if you find leaks, you can use refcount tracing and balancing to discover the root cause. combining and sorting bloat logs you can view one or more bloat logs in your browser by running the following program. perl tools/bloatview/bloattable.pl log1 log2 ... logn > htmlfile this will produce an html file that
contains a table similar to the following (but with added javascript so you can sort the data by column). byte bloats name file date blank blank.txt tue aug 29 14:17:40 2000 mozilla mozilla.txt tue aug 29 14:18:42 2000 yahoo yahoo.txt tue aug 29 14:19:32 2000 netscape netscape.txt tue aug 29 14:20:14 2000 the numbers do n...
A guide to searching crash reports
days. the first group has over 100,000 crash reports, which accounts for 7.77% of all matching crashes. this indicates there are over 1.3 million crash reports matching this search. you can reorder the groups in various ways by clicking on the column headers. the links within the results do the following things. the first link in each "signature" column cell links to a signature report, which
contains additional details about crash reports with that signature. the "add term" link in each "signature" column cell lets you perform a narrower subsequent search among crash reports with that signature. the links in each "bugs" column cell link to bug reports in bugzilla. the default search: crash reports if you switch to the "crash reports" tab you will see results like the ones in the followin...
...licking on "search" we get results like those in the following screenshot. the number of crash reports matching this search is in the thousands, i.e. much smaller than the previous search. proto signature the "proto signature" field is just the raw unprocessed crash stack concatenated together. you can do things like: search for crashes where the signature is foo, and the proto signature
contains bar. this is helpful if you have a fairly generic signature and you want to see how many of them are a particular case of it that you've come across. or instead of a signature foo, a moz crash reason or something else. use it as a facet. this lets you skim the full signatures of crashes at a glance, bucketed together a bit. note that because the proto signature includes the entire signature, thi...
...arch form to do a search with non-signature grouping first click on the "more options..." text, which reveals the additional fields shown in the following screenshot. (the "show columns" and "sort by" fields are straightforward. they apply to the "crash reports" tab of any search results, and are not related to grouping.) the "facet on" field is the one that controls grouping. by default, it
contains the value "signature", which explains why we saw a "signature facet" tab in the earlier search results. but we can change the values in this field and get different facet tabs in the search results. grouping by platform for example, if we start with a default search for all firefox crashes in the past week, but then replace the "signature" facet with "platform" and "moz crash reason", we get se...
Python binding for NSS
tation for the current release can be viewed at python-nss api documentation. the api documentation is generated from the python-nss source code and compiled modules. you can build it yourself via ./setup.py build_doc. most distributions include the python-nss api documentation in the python-nss packaging. consult your distribution for more information. ...
...it yourself via ./setup.py build_doc. most distributions include the python-nss api documentation in the python-nss packaging. consult your distribution for more information. example code the doc/examples directory
contains numerous examples of python-nss programs and libraries you may wish to consult. they illustrate suggested usage and best practice. test code in addition the test directory
contains unit tests that also illustrate python-nss usage, however unlike the examples the unit tests are geared towards testing rather than expository illustration. other documentation the doc directory
contains other files you may wish to review. how to report a bug python-nss bugs are currently being tracked in the red hat bugzilla system for fedora. you can enter a bug report here. source downloa...
...the beast cve fix in nss causes only one octet to be sent in the first socket packet and then the remaining data is sent normally, this is known as 1/n-1 record splitting. the example a...
sslerr.html
_path_len_constraint_invalid -8155 certificate path length constraint is invalid. sec_error_cert_usages_invalid -8154 certificate usages field is invalid. sec_internal_only -8153 internal-only module. sec_error_invalid_key -8152 the key does not support the requested operation. sec_error_unknown_critical_extension -8151 certificate
contains unknown critical extension. sec_error_old_crl -8150 new crl is not later than the current one. sec_error_no_email_cert -8149 not encrypted or signed: you do not yet have an email certificate. sec_error_no_recipient_certs_query -8148 not encrypted: you do not have certificates for each of the recipients. sec_error_not_a_recipient -8147 ca...
...r before performing this operation." sec_error_ocsp_malformed_response -8063 "the response from the ocsp server was corrupted or improperly formed." sec_error_ocsp_unauthorized_response -8062 "the signer of the ocsp response is not authorized to give status for this certificate." sec_error_ocsp_future_response -8061 "the ocsp response is not yet valid (
contains a date in the future)." sec_error_ocsp_old_response -8060 "the ocsp response
contains out-of-date information." sec_error_digest_not_found -8059 "the cms or pkcs #7 digest was not found in signed message." sec_error_unsupported_message_type -8058 "the cms or pkcs #7 message type is unsupported." sec_error_module_stuck -8057 "pkcs #11 mod...
...gged in." sec_error_ocsp_responder_cert_invalid -8036 "the configured ocsp responder's certificate is invalid." sec_error_ocsp_bad_signature -8035 "ocsp response has an invalid signature." sec_error_out_of_search_limits -8034 "certification validation search is out of search limits." sec_error_invalid_policy_mapping -8033 "policy mapping
contains any-policy." sec_error_policy_validation_failed -8032 "certificate chain fails policy validation." sec_error_unknown_aia_location_type -8031 "unknown location type in certificate aia extension." sec_error_bad_http_response -8030 "server returned a bad http response." sec_error_bad_ldap_response -8029 "server returned a bad ldap response.
NSS tools : signtool
the string not present. -k key ... directory specifies the nickname (key) of the certificate you want to sign with and signs the files in the specified directory. the directory to sign is always specified as the last command-line argument. thus, it is possible to write signtool -k mycert -d . signdir you may have trouble if the nickname
contains a single quotation mark. to avoid problems, escape the quotation mark using the escape conventions for your platform. it's also possible to use the -k option without signing any files or specifying a directory. for example, you can use it with the -l option to get detailed information about a particular signing certificate. -g nickname ...
...he temporary directories can be an aid to debugging. -m metafile specifies the name of a metadata control file. metadata is signed information attached either to the jar archive itself or to files within the archive. this metadata can be any ascii string, but is used mainly for specifying an installer script. ...
...-g option only. -t token specifies which available token should generate the key and receive the certificate. use the -m option to find out what tokens are available. the -t option can be used with the -g option only. -v archive displays the contents of an archive and verifies the cryptographic integrity of the digital signatures it
contains and the files with which they are associated. this includes checking that the certificate for the issuer of the object-signing certificate is listed in the certificate database, that the ca's digital signature on the object-signing certificate is valid, that the relevant certificates have not expired, and so on. --verbosity value ...
Rhino overview
introduction most people who have used javascript before have done so by adding scripts to their html web pages. however, rhino is an implementation of the core language only and doesn't contain objects or methods for manipulating html documents. rhino
contains all the features of javascript 1.7 allows direct scripting of java a javascript shell for executing javascript scripts a javascript compiler to transform javascript source files into java class files a javascript debugger for scripts executed with rhino language the javascript language itself is standardized by standard ecma-262 ecmascript: a general purpose, cross-platform programming language. rhino 1.3 and greater conform to edition 3 of the standard. rhino 1.6 and greater implement ecma-357 ecmascript for xml (e4x).
...d, and rhino version 1.6r1 release notes for details on the implementation in rhino. in addition, rhino has implemented javaadapters, which allows javascript to implement any java interface or extend any java class with a javascript object. see the enum.js example for more information. numerous books and tutorials on javascript are available. javascript: the definitive guide is recommended, and
contains a chapter on rhino. deprecated language features several language features introduced in javascript 1.2 are now deprecated. these features allow "computational reflection": that is, the ability for a script to determine and influence aspects of the way it is evaluated. these features are generally not broadly useful, yet they impose significant constraints on implementations that hamper or prev...
...ined at runtime by calling the issecuritydomainrequired method of context. setting this property to true requires that any calls that compile or evaluate javascript must supply a security domain object of any object type that will be used to identify javascript code. in a typical client embedding, this object might be a string with the url of the server that supplied the script, or an object that
contains a representation of the signers of a piece of code for certificate-based security policies. when javascript code attempts a restricted action, the security domain can be retrieved in the following manner. the class context should be obtained from the security manager (see java.lang.securitymanager.getclasscontext()). then, the class of the code that called to request the restricted action can be...
Tracing JIT
the jstracer component consists of a monitor and a recorder. ...
... existing fragments of native code, by rewriting native jump instructions to jump to new locations. in this way the assembler can "patch together" multiple fragments, so that program control can flow from one fragment into another, or back out of generated code and into the interpreter. an assembler is the only component of the tracing jit that reads or writes native code. therefore an assembler
contains several machine-specific methods which are implemented in the accompanying nanojit/native*.* files. an assembler runs in a single pass over its input, transforming one lins value to zero or more nins values. it is important to keep in mind that this pass runs backwards from the last lins in the input lir code to the first, generating native code in reverse. running backwards sometimes makes the ...
...t bytecode interpreted. the compiled fragment of code returned to the monitor on successful loop-close is called a trace. if the recorder is asked to record a bytecode that implies a call to a native function elsewhere in spidermonkey -- some helper function written in c -- and that native happens to re-enter the interpreter to interpret yet more bytecode, and furthermore if that bytecode itself
contains a hot pc that has not yet been traced, the trace monitor may be asked to begin nested recording. this is the same as normal recording mode, except that the outermost recorder is placed on a deferred-abort stack. when the innermost recorder completes -- successfully or otherwise -- every recorder on the deferred abort stack is aborted. this process is called deep aborting the suspended recorders. ...
TPS Tests
priate value) to about:config. additionally, note that the config file must parse as valid json, and so you can't have comments in it (sorry, i know this is annoying). one alternative is to put underscores before the "disabled" preferences, e.g. "_identity.fxaccounts.autoconfig.uri": "...". writing tps tests each tps test is run as a series of "phases". a phase runs in some firefox profile, and
contains some set of actions to perform or check on that profile. phases have an n to m relationship with profiles, where n >= m (there can never be more phases than profiles). typically there are two profiles used, but any number of profiles could be used in theory (other than 0). after the phases run, two additional "cleanup" phases are run, to unregister the devices with fxa. this is an implementation...
...ase. asset lists a test file will contain one or more asset lists, which are lists of bookmarks, passwords, or other types of browser data that are relevant to sync. the format of these asset lists vary somwhat depending on asset type. bookmarks passwords history tabs form data prefs test phases the phase blocks are where the action happens! they tell tps what to do. each phase block
contains the name of a phase, and a list of actions. tps iterates through the phase blocks in alphanumeric order, and for each phase, it does the following: launches firefox with the profile from the phases object that corresponds to this test phase. performs the specified actions in sequence. determines if the phase passed or failed; if it passed, it continues to the next phase block and repeats the...
... [ [sync], [bookmarks.verify, bookmarks_after_first_modify] ]); the effects of this test file will be: firefox is launched with profile1, the tps extension adds the two bookmarks specified in the bookmarks_initial array, then they are synced to the sync server. the sync_wipe_server argument causes tps to set the firstsync="wipeserver" pref before syncing, in case the sync account already
contains data (this is typically unnecessary, and done largely as an example). firefox closes. firefox is launched with profile2, and all data is synced from the sync server. the tps extension verifies that all bookmarks in the bookmarks_initial list are present. then it modifies those bookmarks by applying the "changes" property to each of them. e.g., the title of the first bookmark is changed from "goo...
Feed content access API
ner a base class subclassed by several of the feed-related interfaces. nsifeedelementbase a base class subclassed by several of the other feed-related interfaces. nsifeedentry represents a single entry in an rss or atom feed. nsifeedgenerator describes the software that generated an rss or atom feed. nsifeedperson represents a person.
contains the person's name, email address, and their home page address. nsifeedprocessor parses rss and atom feeds. nsifeedprogresslistener implemented by the program that wants to parse an rss or atom feed to receive messages during the parsing process. nsifeedresult describes the result of parsing a feed. nsifeedresultlistener implemented by the pr...
...to get the title of the feed, you look at the feed.title property. the title is an nsifeedtextconstruct that can represent the text in various formats; we get its text property to fetch the feed's title as html-encoded text. we could, alternatively, use its plaintext() method to get a copy of the title translated into plain text. we then scan the array of items in the feed by l...
...ed, you look at the feed.title property. the title is an nsifeedtextconstruct that can represent the text in various formats; we get its text property to fetch the feed's title as html-encoded text. we could, alternatively, use its plaintext() method to get a copy of the title translated into plain text. we then scan the array of items in the feed by looking at the feed.items nsiarray. this array
contains nsifeedentry objects that describe each feed item. we build the contents of the document by looking at the title, link, summary, and content properties for each item. the full url of the link is retrieved using the link's resolve() method. to initialize a fetch of the feed, we simply call fetch(url). this opens a new window containing the feed contents, with each item's title a clickable link tha...
Querying Places
ead of displaying them. note: be careful when accessing nodes and do not keep references to them around. notifications sent to the result from the history and bookmarks system, as well as commands executed by the programmer such as sorting may cause the structure to change and nodes may be inserted, removed, or replaced. the nsinavhistoryresult object returned by executequery()/executequeries()
contains the list of matches to the given history or bookmarks query. these results are contained in a tree structure made up of nodes. a node's type can be retrieved using its type attribute. this type tells you what interface you can queryinterface the node to in order to get at more detailed information: nsinavhistoryresultnode: base class for all nodes.
contains uri, title, and other general info. ...
...esults are contained in a tree structure made up of nodes. a node's type can be retrieved using its type attribute. this type tells you what interface you can queryinterface the node to in order to get at more detailed information: nsinavhistoryresultnode: base class for all nodes.
contains uri, title, and other general info. nsinavhistoryvisitresultnode: derived from nsinavhistoryresultnode,
contains session information. nsinavhistoryfullvisitresultnode: derived from nsinavhistoryvisitresultnode,
contains information about how the user navigated to this page. note: currently unimplemented, see bug 320831. nsinavhistorycontainerresultnode: general container node giving access to its children. derived from nsinavhistoryresultnode. bookmark folders are of this type. nsinavhistoryqueryresultno...
...uri, title, time, icon...) // see : https://developer.mozilla.org/en/nsinavhistoryresultnode dump(node.title+ "\n"); } // close container when done // see : https://developer.mozilla.org/en/nsinavhistorycontainerresultnode cont.containeropen = false; see also places query uris displaying places information using views ...
Starting WebLock
lated data comes in handy. this service, the nsicategoryservice, is what xpcom and gecko embedding applications use to persist lists of nsiobserver components that want to have startup notification. the nsicategoryservice maintains sets of name-value pairs like the one below. the category manager every category is identified by a string that represents the name of the category. each category
contains a set of name-value pairs. for example, you might have a category named "important people" in which the name-value pairs would be names and phone numbers. the format of the name-value pair is left up to you. this data structure is more than enough to support the persisting of components that want to be started up. the category name also maps nicely onto the notion of a notification "topic." the ...
...someone could write an nsifile implementation that represented ftp files on some server. the existing code would need to change very little for a weblock implementation to take advantage of files that do not actually exist on disk. this kind of implementation does not exist, but this expandability shows some of the flexibility that interface-based programming can provide. the xpcom api reference
contains detailed information on nsifile and other xpcom interfaces. the directory service the file interfaces are most useful when you can use them to find and manipulate files that are relative to the application. the directory service provides directory and file locations in a cross platform uniform way to make this easier. this service, available as nsidirectoryservice, stores the location of vario...
...ich is published in the file nsdirectoryservicedefs.h that comes with the gecko sdk (for a listing of these locations, see the xpcom api reference). the string key for the directory containing the application executable is ns_xpcom_current_process_dir. given this key, you can acquire the directory service, call get(), and pass the key. in the example below, appdir will point to the directory that
contains the executable. nscomptr<nsiservicemanager> servman; nsresult rv = ns_getservicemanager(getter_addrefs(servman)); if (ns_failed(rv)) return -1; nscomptr<nsiproperties> directoryservice; rv = servman->getservicebycontractid(ns_directory_service_contractid, ns_get_iid(nsiproperties), getter_addrefs(directoryservice)); if (...
Mozilla internal string guide
there are a number of additional string classes: classes...
...ng(const nsastring& str) { const nsastring& firstfive = substring(str, 0, 5); // from index 0, length 5 // firstfive is now a string representing the first 5 characters } unicode conversion ns*cstring vs. ns*string strings can be stored in two basic formats: 8-bit code unit (byte/char) strings, or 16-bit code unit (char16_t) strings. any string class with a capital "c" in the classname
contains 8-bit bytes. these classes include nscstring, nsdependentcstring, and so forth. any string class without the "c"
contains 16-bit code units. a 8-bit string can be in one of many character encodings while a 16-bit string is always in potentially-invalid utf-16. (you can make a 16-bit string guaranteed-valid utf-16 by passing it to ensureutf16validity().) the most common encodings are: ascii - ...
...sacstring) - a nsautostring which holds a temporary buffer containing the value of the latin1 to utf-16 conversion. copyasciitoutf16(nsacstring, nsastring) - does an in-place conversion from latin1 to utf-16. appendasciitoutf16(nsacstring, nsastring) - appends a latin1 string to a utf-16 string. tonewunicode(nsacstring) - (avoid if possible) creates a new zero-terminated char16_t* string which
contains the value of the latin1 to utf-16 conversion. comparing ns*strings with c strings you can compare ns*strings with c strings by converting the ns*string to a c string, or by comparing directly against a c string. promiseflatcstring(nsacstring).get() - creates a temporary char * out of a nsacstring. this can be compared to a c string using c functions. ns*string.equalsascii(const char *) - c...
Introduction to XPCOM for the DOM
the xpidl compiler turns the idl methods and attributes into c++ functions according to the following rules: the methods of the interface keep the same name in c++ . however in idl we have to use the so-called "intercaps" model. that means that the first letter is lower-cased, and the other letters that begin a new word ...
...es necessary to build "distclean" before it works. interface implementation let's take a closer look at how interfaces are implemented. we already know that an interface has to be implemented by a concrete c++ class. this class can implement multiple interfaces, directly or through inheritance (see the next section for a discussion of inheritance). we also saw that an interface defined in xpidl
contains methods and attributes, which are transformed into c++ functions by the xpidl compiler. the class that implements the interface has to explicitly implement each method and implement the setter and the getter of each attribute defined on the interface. if the attribute is read-only, only a getter is necessary, of course. i have chosen to implement nsidomfabian in the nshtmldocument class, which i...
...rding is described in section 1.e.d. these rules are pretty simple, and are widely used in the dom code. it gets trickier with a lot of classes and interfaces, but you can always reduce the problem to the above situation. example let's take a look at a simple example, the html anchor element. first, let's illustrate the interface inheritance rules. if we look at nsidomhtmlanchorelement (which
contains the methods and properties defined by the w3c for this element), we can see that it inherits from another interface, nsidomhtmlelement: interface nsidomhtmlanchorelement : nsidomhtmlelement this means that whatever class implements the nsidomhtmlanchorelement interface will also have to implement the nsidomhtmlelement interface. if we look at nsidomhtmlelement, we can see that it inherits from...
NS_ConvertASCIItoUTF16
onst - source parameters prunichar* astring print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar achar print32 aoffset print32 acount findcharinset print32 findcharinset(const char*, print32) const - source this method searches this string for the first character found in the given string. ...
...rinset(const nsstring&, print32) const - source parameters nsstring& astring print32 aoffset print32 findcharinset(const prunichar*, print32) const - source parameters prunichar* astring print32 aoffset rfindcharinset print32 rfindcharinset(const prunichar*, print32) const - source this method searches this string for the last character found in the given string. ...
...ing(const nsstring&, const nsstring&) - source parameters nsstring& atarget nsstring& anewvalue void replacesubstring(const prunichar*, const prunichar*) - source parameters prunichar* atarget prunichar* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset --
contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes surrounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string. you c...
NS_ConvertUTF16toUTF8
parameters char* acstring prbool aignorecase print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar achar print32 aoffset print32 acount findcharinset print32 findcharinset(const char*, print32) const - source this method searches this string for the first character found in the given string. ...
...counting from left) @return offset in string, or knotfound parameters char* astring print32 aoffset print32 findcharinset(const nscstring&, print32) const - source parameters nscstring& astring print32 aoffset rfindcharinset print32 rfindcharinset(const char*, print32) const - source this method searches this string for the last character found in the given string. ...
...id replacesubstring(const nscstring&, const nscstring&) - source parameters nscstring& atarget nscstring& anewvalue void replacesubstring(const char*, const char*) - source parameters char* atarget char* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset --
contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes surrounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string. you c...
NS_ConvertUTF8toUTF16
onst - source parameters prunichar* astring print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar achar print32 aoffset print32 acount findcharinset print32 findcharinset(const char*, print32) const - source this method searches this string for the first character found in the given string. ...
...rinset(const nsstring&, print32) const - source parameters nsstring& astring print32 aoffset print32 findcharinset(const prunichar*, print32) const - source parameters prunichar* astring print32 aoffset rfindcharinset print32 rfindcharinset(const prunichar*, print32) const - source this method searches this string for the last character found in the given string. ...
...ing(const nsstring&, const nsstring&) - source parameters nsstring& atarget nsstring& anewvalue void replacesubstring(const prunichar*, const prunichar*) - source parameters prunichar* atarget prunichar* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset --
contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes surrounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string. you c...
NS_LossyConvertUTF16toASCII
parameters char* acstring prbool aignorecase print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar achar print32 aoffset print32 acount findcharinset print32 findcharinset(const char*, print32) const - source this method searches this string for the first character found in the given string. ...
...counting from left) @return offset in string, or knotfound parameters char* astring print32 aoffset print32 findcharinset(const nscstring&, print32) const - source parameters nscstring& astring print32 aoffset rfindcharinset print32 rfindcharinset(const char*, print32) const - source this method searches this string for the last character found in the given string. ...
...id replacesubstring(const nscstring&, const nscstring&) - source parameters nscstring& atarget nscstring& anewvalue void replacesubstring(const char*, const char*) - source parameters char* atarget char* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset --
contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes surrounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string. you c...
nsAdoptingCString
parameters char* acstring prbool aignorecase print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar achar print32 aoffset print32 acount findcharinset print32 findcharinset(const char*, print32) const - source this method searches this string for the first character found in the given string. ...
...counting from left) @return offset in string, or knotfound parameters char* astring print32 aoffset print32 findcharinset(const nscstring&, print32) const - source parameters nscstring& astring print32 aoffset rfindcharinset print32 rfindcharinset(const char*, print32) const - source this method searches this string for the last character found in the given string. ...
...id replacesubstring(const nscstring&, const nscstring&) - source parameters nscstring& atarget nscstring& anewvalue void replacesubstring(const char*, const char*) - source parameters char* atarget char* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset --
contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes surrounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string. you c...
nsAdoptingString
onst - source parameters prunichar* astring print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar achar print32 aoffset print32 acount findcharinset print32 findcharinset(const char*, print32) const - source this method searches this string for the first character found in the given string. ...
...rinset(const nsstring&, print32) const - source parameters nsstring& astring print32 aoffset print32 findcharinset(const prunichar*, print32) const - source parameters prunichar* astring print32 aoffset rfindcharinset print32 rfindcharinset(const prunichar*, print32) const - source this method searches this string for the last character found in the given string. ...
...ing(const nsstring&, const nsstring&) - source parameters nsstring& atarget nsstring& anewvalue void replacesubstring(const prunichar*, const prunichar*) - source parameters prunichar* atarget prunichar* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset --
contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes surrounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string. you c...
nsCString
parameters char* acstring prbool aignorecase print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar achar print32 aoffset print32 acount findcharinset print32 findcharinset(const char*, print32) const - source this method searches this string for the first character found in the given string. ...
...counting from left) @return offset in string, or knotfound parameters char* astring print32 aoffset print32 findcharinset(const nscstring&, print32) const - source parameters nscstring& astring print32 aoffset rfindcharinset print32 rfindcharinset(const char*, print32) const - source this method searches this string for the last character found in the given string. ...
...id replacesubstring(const nscstring&, const nscstring&) - source parameters nscstring& atarget nscstring& anewvalue void replacesubstring(const char*, const char*) - source parameters char* atarget char* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset --
contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes surrounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string. you c...
nsDependentCString
parameters char* acstring prbool aignorecase print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar achar print32 aoffset print32 acount findcharinset print32 findcharinset(const char*, print32) const - source this method searches this string for the first character found in the given string. ...
...counting from left) @return offset in string, or knotfound parameters char* astring print32 aoffset print32 findcharinset(const nscstring&, print32) const - source parameters nscstring& astring print32 aoffset rfindcharinset print32 rfindcharinset(const char*, print32) const - source this method searches this string for the last character found in the given string. ...
...id replacesubstring(const nscstring&, const nscstring&) - source parameters nscstring& atarget nscstring& anewvalue void replacesubstring(const char*, const char*) - source parameters char* atarget char* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset --
contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes surrounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string. you c...
nsDependentString
onst - source parameters prunichar* astring print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar achar print32 aoffset print32 acount findcharinset print32 findcharinset(const char*, print32) const - source this method searches this string for the first character found in the given string. ...
...rinset(const nsstring&, print32) const - source parameters nsstring& astring print32 aoffset print32 findcharinset(const prunichar*, print32) const - source parameters prunichar* astring print32 aoffset rfindcharinset print32 rfindcharinset(const prunichar*, print32) const - source this method searches this string for the last character found in the given string. ...
...ing(const nsstring&, const nsstring&) - source parameters nsstring& atarget nsstring& anewvalue void replacesubstring(const prunichar*, const prunichar*) - source parameters prunichar* atarget prunichar* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset --
contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes surrounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string. you c...
nsFixedCString
parameters char* acstring prbool aignorecase print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar achar print32 aoffset print32 acount findcharinset print32 findcharinset(const char*, print32) const - source this method searches this string for the first character found in the given string. ...
...counting from left) @return offset in string, or knotfound parameters char* astring print32 aoffset print32 findcharinset(const nscstring&, print32) const - source parameters nscstring& astring print32 aoffset rfindcharinset print32 rfindcharinset(const char*, print32) const - source this method searches this string for the last character found in the given string. ...
...id replacesubstring(const nscstring&, const nscstring&) - source parameters nscstring& atarget nscstring& anewvalue void replacesubstring(const char*, const char*) - source parameters char* atarget char* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset --
contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes surrounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string. you c...
nsFixedString
onst - source parameters prunichar* astring print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar achar print32 aoffset print32 acount findcharinset print32 findcharinset(const char*, print32) const - source this method searches this string for the first character found in the given string. ...
...rinset(const nsstring&, print32) const - source parameters nsstring& astring print32 aoffset print32 findcharinset(const prunichar*, print32) const - source parameters prunichar* astring print32 aoffset rfindcharinset print32 rfindcharinset(const prunichar*, print32) const - source this method searches this string for the last character found in the given string. ...
...ing(const nsstring&, const nsstring&) - source parameters nsstring& atarget nsstring& anewvalue void replacesubstring(const prunichar*, const prunichar*) - source parameters prunichar* atarget prunichar* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset --
contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes surrounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string. you c...
nsPromiseFlatCString
parameters char* acstring prbool aignorecase print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar achar print32 aoffset print32 acount findcharinset print32 findcharinset(const char*, print32) const - source this method searches this string for the first character found in the given string. ...
...counting from left) @return offset in string, or knotfound parameters char* astring print32 aoffset print32 findcharinset(const nscstring&, print32) const - source parameters nscstring& astring print32 aoffset rfindcharinset print32 rfindcharinset(const char*, print32) const - source this method searches this string for the last character found in the given string. ...
...id replacesubstring(const nscstring&, const nscstring&) - source parameters nscstring& atarget nscstring& anewvalue void replacesubstring(const char*, const char*) - source parameters char* atarget char* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset --
contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes surrounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string. you c...
nsPromiseFlatString
onst - source parameters prunichar* astring print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar achar print32 aoffset print32 acount findcharinset print32 findcharinset(const char*, print32) const - source this method searches this string for the first character found in the given string. ...
...rinset(const nsstring&, print32) const - source parameters nsstring& astring print32 aoffset print32 findcharinset(const prunichar*, print32) const - source parameters prunichar* astring print32 aoffset rfindcharinset print32 rfindcharinset(const prunichar*, print32) const - source this method searches this string for the last character found in the given string. ...
...ing(const nsstring&, const nsstring&) - source parameters nsstring& atarget nsstring& anewvalue void replacesubstring(const prunichar*, const prunichar*) - source parameters prunichar* atarget prunichar* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset --
contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes surrounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string. you c...
nsString
onst - source parameters prunichar* astring print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar achar print32 aoffset print32 acount findcharinset print32 findcharinset(const char*, print32) const - source this method searches this string for the first character found in the given string. ...
...rinset(const nsstring&, print32) const - source parameters nsstring& astring print32 aoffset print32 findcharinset(const prunichar*, print32) const - source parameters prunichar* astring print32 aoffset rfindcharinset print32 rfindcharinset(const prunichar*, print32) const - source this method searches this string for the last character found in the given string. ...
...ing(const nsstring&, const nsstring&) - source parameters nsstring& atarget nsstring& anewvalue void replacesubstring(const prunichar*, const prunichar*) - source parameters prunichar* atarget prunichar* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset --
contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes surrounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string. you c...
nsXPIDLCString
parameters char* acstring prbool aignorecase print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar achar print32 aoffset print32 acount findcharinset print32 findcharinset(const char*, print32) const - source this method searches this string for the first character found in the given string. ...
...counting from left) @return offset in string, or knotfound parameters char* astring print32 aoffset print32 findcharinset(const nscstring&, print32) const - source parameters nscstring& astring print32 aoffset rfindcharinset print32 rfindcharinset(const char*, print32) const - source this method searches this string for the last character found in the given string. ...
...id replacesubstring(const nscstring&, const nscstring&) - source parameters nscstring& atarget nscstring& anewvalue void replacesubstring(const char*, const char*) - source parameters char* atarget char* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset --
contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes surrounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string. you c...
nsXPIDLString
onst - source parameters prunichar* astring print32 aoffset print32 acount rfindchar print32 rfindchar(prunichar, print32, print32) const - source parameters prunichar achar print32 aoffset print32 acount findcharinset print32 findcharinset(const char*, print32) const - source this method searches this string for the first character found in the given string. ...
...rinset(const nsstring&, print32) const - source parameters nsstring& astring print32 aoffset print32 findcharinset(const prunichar*, print32) const - source parameters prunichar* astring print32 aoffset rfindcharinset print32 rfindcharinset(const prunichar*, print32) const - source this method searches this string for the last character found in the given string. ...
...ing(const nsstring&, const nsstring&) - source parameters nsstring& atarget nsstring& anewvalue void replacesubstring(const prunichar*, const prunichar*) - source parameters prunichar* atarget prunichar* anewvalue trim void trim(const char*, prbool, prbool, prbool) - source this method trims characters found in atrimset from either end of the underlying string. @param aset --
contains chars to be trimmed from both ends @param aeliminateleading @param aeliminatetrailing @param aignorequotes -- if true, causes surrounding quotes to be ignored @return this parameters char* aset prbool aeliminateleading prbool aeliminatetrailing prbool aignorequotes compresswhitespace void compresswhitespace(prbool, prbool) - source this method strips whitespace from string. you c...
imgIContainer
imagelength missing description exceptions thrown missing exception missing description native code only!extractcurrentframe obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. create a new imgcontainer that
contains only a single frame, which itself
contains a subregion of the current frame. imgicontainer extractcurrentframe( [const] in nsintrect arect ); parameters arect the area of the current frame to be duplicated in the returned imgcontainer's frame. return value missing description exceptions thrown missing exception missing description native code only!extractframe create a new...
...imgicontainer extractframe( in pruint32 awhichframe, [const] in nsintrect arect, in pruint32 aflags ); parameters awhichframe frame specifier of the frame_* variety. arect the area of the current frame to be duplicated in the returned imgcontainer's frame. ...
... current frame. imgicontainer extractcurrentframe( [const] in nsintrect arect ); parameters arect the area of the current frame to be duplicated in the returned imgcontainer's frame. return value missing description exceptions thrown missing exception missing description native code only!extractframe create a new imgcontainer that
contains only a single frame, which itself
contains a subregion of the given frame. imgicontainer extractframe( in pruint32 awhichframe, [const] in nsintrect arect, in pruint32 aflags ); parameters awhichframe frame specifier of the frame_* variety. arect the area of the current frame to be duplicated in the returned imgcontainer's frame. aflags flags of the flag_* variety. return value missing description exceptio...
mozIStorageService
base can be opened again with the mozistorageservice.opendatabase() method. warning: if you have more than one connection to a file, you must use the exact same name for the file each time, including case. the sqlite code uses a simple string comparison to see if there is already a connection. opening a connection to "foo.sqlite" and "foo.sqlite" will corrupt your database. if your database
contains virtual tables (for example, for full-text indexes), you must use mozistorageservice.openunshareddatabase() to open it, since those tables are not compatible with a shared cache. if you use this method to open a database containing virtual tables, it will think the database is corrupted and throw ns_error_file_corrupted. note: the connection object returned by this function is not threadsafe. you...
...ndatabase( in nsifile adatabasefile ); parameters adatabasefile an nsifile indicating the database file to open. return value a mozistorageconnection representing the connection to the opened database file. exceptions thrown ns_error_failure an error occurred attempting to open the database. ns_error_file_corrupted the database file is corrupted, or
contains virtual tables and is not compatible with this method. ns_error_out_of_memory allocating a new storage object failed. openspecialdatabase() opens a connection to a named special database storage that identifies the type of storage requested. note: you should only access the profile database from the main thread since other callers may also be using it. mozistorageconnection openspe...
...ddatabase( in nsifile adatabasefile ); parameters adatabasefile an nsifile indicating the database file to open. return value a mozistorageconnection representing the connection to the opened database file. exceptions thrown ns_error_failure an error occurred attempting to open the database. ns_error_file_corrupted the database file is corrupted, or
contains virtual tables and is not compatible with this method. ns_error_out_of_memory allocating a new storage object failed. see also storage mozistorageconnection ...
nsICryptoHash
the hash algorithms supported are md2, md5, sha-1, sha-256, sha-384, and sha-512. ...
...ffffff; ch.updatefromstream(istream, pr_uint32_max); // pass false here to get binary data back var hash = ch.finish(false); // return the two-digit hexadecimal code for a byte function tohexstring(charcode) { return ("0" + charcode.tostring(16)).slice(-2); } // convert the binary hash data to a hex string. var s = array.from(hash, (c, i) => tohexstring(hash.charcodeat(i))).join(""); // s now
contains your hash in hex this gives 5eb63bbbe01eeed093cb22bb8f5acdc3 for the hash value. this example, while simple, shows most of the functionality of the interface. the first thing to note is that when you call the init() method you must specify the hash algorithm to use. all of the available algorithms are specified as constants on the interface. also note that when you call the updatefromstream()...
...nstance(components.interfaces.nsicryptohash); ch.init(ch.sha256); ch.update(data, data.length); var hash = ch.finish(false); // return the two-digit hexadecimal code for a byte function tohexstring(charcode) { return ("0" + charcode.tostring(16)).slice(-2); } // convert the binary hash data to a hex string. var s = array.from(hash, (c, i) => tohexstring(hash.charcodeat(i))).join(""); // s now
contains your hash in hex: should be // 5eb63bbbe01eeed093cb22bb8f5acdc3 see also firefox 1.5 ...
nsIIOService
rincipal is the principal of the resource that caused this particular url to be loaded. most likely the triggeringprincipal and the loadingprincipal are identical, in which case the triggeringprincipal can be left out. in some cases the loadingprincipal and the triggeringprincipal are different however, e.g. a stylesheet may import a subresource. in that case the principal of the stylesheet which
contains the import command is the triggeringprincipal, and the principal of the document whose rendering is affected is the loadingprincipal. asecurityflags the securityflags of the channel. any of the securityflags defined in nsiloadinfo. acontentpolicytype the contentpolicytype of the channel. any of the content types defined in nsicontentpolicybase.idl. return value returns an nsichannel based ...
...rincipal is the principal of the resource that caused this particular url to be loaded. most likely the triggeringprincipal and the loadingprincipal are identical, in which case the triggeringprincipal can be left out. in some cases the loadingprincipal and the triggeringprincipal are different however, e.g. a stylesheet may import a subresource. in that case the principal of the stylesheet which
contains the import command is the triggeringprincipal, and the principal of the document whose rendering is affected is the loadingprincipal. asecurityflags the securityflags of the channel. any of the securityflags defined in nsiloadinfo.idl acontentpolicytype the contentpolicytype of the ...
...rincipal is the principal of the resource that caused this particular url to be loaded. most likely the triggeringprincipal and the loadingprincipal are identical, in which case the triggeringprincipal can be left out. in some cases the loadingprincipal and the triggeringprincipal are different however, e.g. a stylesheet may import a subresource. in that case the principal of the stylesheet which
contains the import command is the triggeringprincipal, and the principal of the document whose rendering is affected is the loadingprincipal. asecurityflags the securityflags of the channel. any of the securityflags defined in nsiloadinfo. acontentpolicytype the contentpolicytype of the channel. any of the content types defined in nsicontentpolicy. return value an nsichannel for the uri. newfileu...
nsISelection
(components.interfaces.nsiselection); method overview void addrange(in nsidomrange range); void collapse(in nsidomnode parentnode, in long offset); [noscript,notxpcom,nostdcall] boolean collapsed(); void collapsenative(in nsidomnode parentnode, in long offset); native code only! void collapsetoend(); void collapsetostart(); boolean
containsnode(in nsidomnode node, in boolean partlycontained); void deletefromdocument(); void extend(in nsidomnode parentnode, in long offset); void extendnative(in nsidomnode parentnode, in long offset); native code only! nsidomrange getrangeat(in long index); void modify(in domstring alter, in domstring direction, in domstring granularity); void re...
... single point at the end of the current selection (regardless of direction). if content is focused and editable, the caret will blink there. void collapsetoend(); parameters none collapsetostart() collapses the whole selection to a single point at the start of the current selection (regardless of direction). if content is focused and editable, the caret will blink there. ...
...ntent is focused and editable, the caret will blink there. void collapsetostart();
containsnode() indicates whether the nsidomnode is part of the selection. if partlycontained is set to pr_true, the function returns true when some part of the node is part of the selection. if partlycontained is set to pr_false, the function only returns true when the entire node is part of the selection. boolean
containsnode( in nsidomnode node, in boolean partlycontained ); parameters node the nsidomnode to look for partlycontained if partlycontained is set to pr_false, the function only returns true when the entire node is part of the selection. return value whether or not the range
contains the requested noe. deletefromdocument() deletes this selection from the document the nodes belong ...
nsITransferable
t intended for private use only. knativeimagemime application/x-moz-nativeimage an image in gecko's native internal image storage format. knativehtmlmime application/x-moz-nativehtml html in gecko's native internal storage format. khtmlcontext text/_moz_htmlcontext along with khtmlinfo, this is used to provide the context for a fragment of html source.
contains the serialized ancestor elements. khtmlinfo text/_moz_htmlinfo along with khtmlcontext, this is used to provide the context for a fragment of html source.
contains numbers identifying where in the context the fragment came from. kfilepromiseurlmime application/x-moz-file-promise-url the source url for a file promise. kfilepromisedestfilename application/x...
...r input data converters. nsisupportsarray flavorstransferablecanimport(); parameters none. return value missing description getanytransferdata() returns the best flavor in the transferable, given those that have been added to it with adddataflavor(). void getanytransferdata( out string aflavor, out nsisupports adata, out unsigned long adatalen ); parameters aflavor on return,
contains the flavor of data that was retrieved. adata on return, this is the data itself, which is an instance of a class based upon nsisupportsprimitives. adatalen on return, this value
contains the size of the returned data. gettransferdata() returns the transfer data for a given flavor. void gettransferdata( in string aflavor, out nsisupports adata, out unsigned long adatalen ); paramet...
... the size of the returned data. gettransferdata() returns the transfer data for a given flavor. void gettransferdata( in string aflavor, out nsisupports adata, out unsigned long adatalen ); parameters aflavor the flavor of data to retrieve. adata on return, this is the data itself, which is an instance of a class based upon nsisupportsprimitives. adatalen on return, this value
contains the size of the returned data. init() initializes a transferable object. this should be called on all transferable objects. failure to do so will result in fatal assertions in debug builds. void init( in nsiloadcontext acontext ); parameters acontext the load context associated with the transferable object. this can be set to null if a load context is not available. remarks the load...
XPCOM Interface Reference by grouping
ms by alphabetical sorting, this page attempts to group them by function. grouping and category names were made by somewhat arbitrary decision by the author. ...
...that this will be a great point of discussion and probably will end in tears, but since i'm the first person to apparently take a swing at this, i get first dibs.) the primary sections consist of: browser this section
contains elements associated with the view pane or the content of the "browser window" proper. it is wrapped by system, but displayed for convenience. data this section
contains data wrappers and core object definitions. ...
...t since i'm the first person to apparently take a swing at this, i get first dibs.) the primary sections consist of: browser this section
contains elements associated with the view pane or the content of the "browser window" proper. it is wrapped by system, but displayed for convenience. data this section
contains data wrappers and core object definitions. security this section
contains apis for secure channel communications system this section
contains application level interfaces including calls to external support elements (such as device calls). this is the root element and may contain some functions defined in other groups. user this section
contains elements specific to a given user's data storage. browser autocomplete nsiautocompletecontroller ...
XPIDL
use a plain `nsresult' instead. another property, infallible, is attribute-only. when present, it causes an infallible c++ getter function definition to be generated for the attribute alongside the normal fallible c++ getter declaration. it should only be used if the fallible getter will be infallible in practice (i.e. always return ns_ok) for all possible implementations. this infallible getter
contains code that calls the fallible getter, asserts success, and returns the gotten value directly. the point of using this property is to make c++ code nicer -- a call to the infallible getter is more concise and readable than a call to the fallible getter. this property can only be used for attributes having built-in or interface types, and within classes that are marked with builtinclass. the latter ...
...turn value, although these are moderately cumbersome to use from script contexts and should therefore be avoided if reasonable. an inout parameter is an in parameter whose value may be changed as a result of the method; these parameters are rather annoying to use and should generally be avoided if at all possible. out and inout parameters are reflected as objects having the .value property which
contains the real value of the parameter; it is not initialized in the case of out parameters and is initialized to the passed-in-value for inout parameters. the script code would need to set this property to assign a value to the parameter. regular in parameters are reflected more or less normally, with numeric types all representing numbers, booleans as true or false, the various strings (including astr...
... array parameter. the shared property also makes its corresponding argument const. the retval property indicates that the parameter is actually acting as the return value, and it is only the need to assign properties to the parameter that is causing it to be specified as a parameter. it has no effect on native code, but script code uses it like a regular return value. naturally, a method which
contains a retval parameter must be declared void, and the parameter itself must be an out parameter and the last parameter. other properties are the optional and iid_is property. the optional property indicates that script code may omit the property without problems; all subsequent parameters must either by optional themselves or the retval parameter. note that optional out parameters still pass in a va...
Building a Thunderbird extension 1: introduction
ons of thunderbird. much of it may no longer be relevant. see developer.thunderbird.net for newer information. this tutorial will introduce you to the components of a thunderbird extension and will show you how to build your own. ...
...all thunderbird builds are available from the ftp site. references and resources tools and helper extensions there are many tools available that help with developing thunderbird extensions. at a minimum you will need: text editor: any editor...
...at are useful for testing and debugging thunderbird extensions, such as javascript consoles and xpcom inspectors. these are described on the page "setting up an extension development environment". documentation thunderbird extensions (documentation overview) firefox addons developer guide (many topics are applicable to thunderbird) mozilla cross-reference source code browser ("comm-central"
contains the thunderbird code repository) community the thunderbird development community has a mailing list with an extensive searchable archive with an extensive searchable archive. you can also talk with the community on the #maildev irc channel. next » ...
Initialization and Destruction - Plugins
of the functions np_initialize and np_shutdown, which are not in the function tables. however, because np_initialize is called at the end of the initialization process, you can call other methods, such as npn_memalloc and npn_status, from np_initialize. instance creation after initialization, the plug-in instance is created. more than one instance of the same plug-in can exist if a single page
contains multiple embedded plug-ins, or if several browser windows are open and display the same data type. at this point, a plug-in can call the npn_setvalue function to specify whether it is windowed (the default) or windowless. plug-in instances are created with npp_new and destroyed with npp_destroy. npp_new informs the plug-in of the creation of a new instance with the specified mime type. you can a...
...hree parameters pass parameters from the embed element that called the plug-in. the argc parameter is the number of html arguments in the element. it determines the number of attributes in the arrays specified by the argn and argv parameters. the arguments in the embed element are name-value pairs made up of the attribute name (for example, align) and its value (for example, top). the argn array
contains the attribute names; the argv array
contains the attribute values. the browser ignores any nonstandard attributes in an embed element, so the web page author can use the arg parameters to specify private attributes defined for a particular plug-in. for example, the following embed element has the standard attributes src, height, and width and the private attribute loop: <embed src="movie.avi" h...
...he npsaveddata structure passes from the plug-in to the browser when npp_destroy returns. the example in this section sets up a buffer and allocates memory for it. you can use this type of buffer to handle data saved from one instance of a plug-in to another. the example shows the use of the optional save parameter of npp_destroy and saved parameter of npp_new. in npp_new, the saved parameter
contains previously saved data for this instance of the plug-in (saved by npp_destroy). the plug-in must free the memory for npsaveddata and the buffer it
contains. in npp_destroy, the save parameter specifies state or other information to save for reuse by a new instance with the same url. to ensure that the browser does not crash or leak memory when the saved data is discarded, the buf field should b...
Debugger.Script - Firefox Developer Tools
ipt, return an array describing the relationship between bytecode instruction offsets and source code positions in this script. unlike getalloffsets(), which returns all offsets that are entry points for each line, getallcolumnoffsets() returns all offsets that are entry points for each (line, column) pair. the elements of the array are objects, each of which describes a single entry point, and
contains the following properties: linenumber: the line number for which offset is an entry point columnnumber: the column number for which offset is an entry point offset: the bytecode instruction offset of the entry point for example, suppose we have a script for the following source code: a=[] for (i=1; i < 10; i++) // it's hip to be square. a[i] = i*i; cal...
...offset: 0 }, { linenumber: 1, columnnumber: 5, offset: 5 }, { linenumber: 1, columnnumber: 10, offset: 20 }, { linenumber: 3, columnnumber: 4, offset: 10 }] if the instance refers to webassembly code, throw a typeerror. getlineoffsets(line) if the instance refers to a jsscript, return an array of bytecode instruction offsets representing the entry points to source lineline. if the script
contains no executable code at that line, the array returned is empty. getoffsetlocation(offset) if the instance refers to a jsscript, return an object describing the source code location responsible for the bytecode atoffset in this script. the object has the following properties: linenumber: the line number for which offset is an entry point columnnumber: the column number for whic...
...llowing properties: linenumber: the line number for which offset is an entry point columnnumber: the column number for which offset is an entry point isentrypoint: true if the offset is a column entry point, as would be reported by getallcolumnoffsets(); otherwise false. getoffsetscoverage(): if the instance refers to a jsscript, return null or an array which
contains informations about the coverage of all opcodes. the elements of the array are objects, each of which describes a single opcode, and
contains the following properties: linenumber: the line number of the current opcode. columnnumber: the column number of the current opcode. offset: the bytecode instruction offset of the current opcode. count: the number of times ...
Network request list - Firefox Developer Tools
blocking enabled. timeline the request list also displays a timeline for the different parts of each request. each timeline is given a horizontal position in its row relative to the other network requests, so you can see the total time taken to load the page. for more details on the color-coding used here, see the section on the timings page. starting in firefox 45, the timeline also
contains two vertical lines: the blue line marks the point at which the page's domcontentloaded event is triggered. the red line marks the point at which the page's load event is triggered. blocking specific urls if you want to view your page as it would look without a resource (e.g., if it were blocked by the browser or an extension), you can block requests matching patterns you specify. click ...
...ou want to view your page as it would look without a resource (e.g., if it were blocked by the browser or an extension), you can block requests matching patterns you specify. click the request blocking icon in the toolbar. this opens the blocking sidebar. (click the icon again when you want to close the sidebar.) enter a string in the field with the placeholder text block resource when url
contains. reload the page to test it with the specified url blocked. other actions you can take with request blocking: to turn all request blocking off or on: toggle the checkbox next to enable request blocking. to turn a specific block off or on: toggle the checkbox next to that item. to delete a blocked item, click the x icon that appears when you focus the item. (starting with firefox 77) righ...
..., or by request properties. filter type how to apply content type use the buttons in the toolbar (html, css, js). xhr requests use the xhr button in the toolbar. websocket connections use the ws button in the toolbar. you can filter by plain text (in which case the text is used to find partial matches; entering "for" will match any message that
contains the word "for") or—as of firefox 75—using regular expressions (by writing the regexp bracketed within slashes; "/.+corp.*/" will look for any occurrence of "corp" which has at least one character before it and may or may not have any characters after it, for example). the third-party add-on websocket sniffer may be helpful as well. url use the filter urls box in the t...
BasicCardResponse - Web APIs
the basiccardresponse dictionary (related to the payment request api, although defined in the basic card payment spec) defines an object structure for payment response details such as the number/expiry date of the card used to make the payment, and the billing address. properties basiccardresponse.cardnumber read only secure context
contains the number of the card used to make the payment. basiccardresponse.cardholdername read only secure context optional
contains the cardholder name of the card used to make the payment. basiccardresponse.cardsecuritycode read only secure context optional
contains the security code of the card used to make the payment. basiccardresponse.expirymonth read only secure context optional
contains the expiry month of the card used to make the payment. ...
...ontains the cardholder name of the card used to make the payment. basiccardresponse.cardsecuritycode read only secure context optional
contains the security code of the card used to make the payment. basiccardresponse.expirymonth read only secure context optional
contains the expiry month of the card used to make the payment. basiccardresponse.expiryyear read only secure context optional
contains the expiry year of the card used to make the payment. basiccardresponse.billingaddress read only secure context optional
contains the billing address of the card used to make the payment. examples in the following example, the paymentrequest() constructor is used to create a new payment request, which takes three objects as parameters — one containing details of the payment methods that c...
...mentrequest() constructor is used to create a new payment request, which takes three objects as parameters — one containing details of the payment methods that can be used for the payment, one containing details of the actual order (such as items bought and shipping options), and an optional object containing further options. the first of these three (supportedinstruments in the example below)
contains a data property that has to conform to the structure defined by the basiccardrequest dictionary. var supportedinstruments = [{ supportedmethods: 'basic-card', data: { supportednetworks: ['visa', 'mastercard', 'amex', 'jcb', 'diners', 'discover', 'mir', 'unionpay'], supportedtypes: ['credit', 'debit'] } }]; var details = { total: {label: 'donation', amount...
Blob - Web APIs
into a readablestream so its methods can be used for processing the data. blobs can 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. using blobs to construct a blob from other non-blob objects and data, use the blob() constructor. to create a blob that
contains a subset of another blob's data, use the slice() method. to obtain a blob object for a file on the user's file system, see the file documentation. the apis accepting blob objects are also listed in the file documentation. constructor blob() returns a newly created blob object which
contains a concatenation of all of the data in the array passed into the constructor. instance properties ...
...eated. click the link to see the decoded object url.</p> javascript the main piece of this code for example purposes is the typedarraytourl() function, which creates a blob from the given typed array and returns an object url for it. having converted the data into an object url, it can be used in a number of ways, including as the value of the <img> element's src attribute (assuming the data
contains an image, of course). function typedarraytourl(typedarray, mimetype) { return url.createobjecturl(new blob([typedarray.buffer], {type: mimetype})) } const bytes = new uint8array(59); for(let i = 0; i < 59; i++) { bytes[i] = 32 + i; } const url = typedarraytourl(bytes, 'text/plain'); const link = document.createelement('a'); link.href = url; link.innertext = 'open the array url'; documen...
...ertext = 'open the array url'; document.body.appendchild(link); result click the link in the example to see the browser decode the object url. extracting data from a blob one way to read content from a blob is to use a filereader. the following code reads the content of a blob as a typed array: const reader = new filereader(); reader.addeventlistener('loadend', () => { // reader.result
contains the contents of blob as a typed array }); reader.readasarraybuffer(blob); another way to read content from a blob is to use a response. the following code reads the content of a blob as text: const text = await (new response(blob)).text(); or by using blob.prototype.text(): const text = await blob.text(); by using other methods of filereader, it is possible to read the contents of a blob as...
Pixel manipulation with canvas - Web APIs
...
...four one-byte values (red, green, blue, and alpha, in that order; that is, "rgba" format). each color component is represented by an integer between 0 and 255. each component is assigned a consecutive index within the array, with the top left pixel's red component being at index 0 within the array. pixels then proceed from left to right, then downward, throughout the array. the uint8clampedarray
contains height × width × 4 bytes of data, with index values ranging from 0 to (height×width×4)-1. for example, to read the blue component's value from the pixel at column 200, row 50 in the image, you would do the following: bluecomponent = imagedata.data[((50 * (imagedata.width * 4)) + (200 * 4)) + 2]; if given a set of coordinates (x and y), you may end up doing something like this: var xcoord ...
... 200, 200); }; canvas.addeventlistener('mousemove', zoom); } saving images the htmlcanvaselement provides a todataurl() method, which is useful when saving images. it returns a data uri containing a representation of the image in the format specified by the type parameter (defaults to png). the returned image is in a resolution of 96 dpi. note: be aware that if the canvas
contains any pixels that were obtained from another origin without using cors, the canvas is tainted and its contents can no longer be read and saved. see security and tainted canvases in allowing cross-origin use of images and canvas canvas.todataurl('image/png') default setting. creates a png image. canvas.todataurl('image/jpeg', quality) creates a jpg image. optionally, you can provide a quality ...
DOMException - Web APIs
ing a method or accessing a property of a web api. this is basically how error conditions are described in web apis. each exception has a name, which is a short "camelcase" style string identifying the error or abnormal condition. constructor domexception() returns a domexception object with a specified message and name. ...
... error names common error names are listed here. some apis define their own sets of names, so this is not necessarily a complete list. ...
...this can be thrown by the range object. (legacy code value: 1 and legacy constant name: index_size_err) hierarchyrequesterror the node tree hierarchy is not correct. (legacy code value: 3 and legacy constant name: hierarchy_request_err) wrongdocumenterror the object is in the wrong document. (legacy code value: 4 and legacy constant name: wrong_document_err) invalidcharactererror the string
contains invalid characters. (legacy code value: 5 and legacy constant name: invalid_character_err) nomodificationallowederror the object cannot be modified. (legacy code value: 7 and legacy constant name: no_modification_allowed_err) notfounderror the object cannot be found here. (legacy code value: 8 and legacy constant name: not_found_err) notsupportederror the operation is not supported. (legacy...
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
roduction build step to reduce code download sizes. html largely ignores whitespace? in the case of html, whitespace is largely ignored — whitespace in between words is treated as a single character, and whitespace at the start and end of elements and outside elements is ignored. take the following minimal example: <!doctype html> <h1> hello world! </h1> this source code
contains a couple of line feeds after the doctype and a bunch of space characters before, after, and inside the <h1> element, but the browser doesn’t seem to care at all and just shows the words "hello world!" as if these characters didn’t exist at all: this is so that whitespace characters don't impact the layout of your page. creating space around and inside elements is the job of css. what doe...
...fer an easier explanation below. let’s take another really simple example. to make it easier, we’ve illustrated all spaces with ◦, all tabs with ⇥ , and all line breaks with ⏎: this example: <h1>◦◦◦hello◦⏎ ⇥⇥⇥⇥<span>◦world!</span>⇥◦◦</h1> is rendered in the browser like so: hidden example <h1> hello <span> world!</span> </h1> the <h1> element
contains only inline elements. in fact it
contains: a text node (consisting of some spaces, the word "hello" and some tabs). an inline element (the <span>, which
contains a space, and the word "world!"). another text node (consisting only of tabs and spaces). because of this, it establishes what is called an inline formatting context. this is one of the possible layout rendering contexts that brows...
...e line below that. note: firefox devtools have supported highlighting text nodes since version 52, making it easier to see exactly what nodes whitespace characters are contained within. pure whitespace nodes are marked with a "whitespace" label. whitespace in block formatting contexts above we just looked at elements that contain inline elements, and inline formatting contexts. if an element
contains at least one block element, then it instead establishes what is called a block formatting context. within this context, whitespace is treated very differently. let’s take a look at an example to explain how. we've marked the whitespace characters as before. <body>⏎ ⇥<div>◦◦hello◦◦</div>⏎ ⏎ ◦◦◦<div>◦◦world!◦◦</div>◦◦⏎ </body> we have 3 text nodes that conta...
Element.classList - Web APIs
use the classlist api to remove and add classes div.classlist.remove("foo"); div.classlist.add("anotherclass"); // <div class="anotherclass"></div> console.log(div.outerhtml); // if visible is set remove it, otherwise add it div.classlist.toggle("visible"); // add/remove visible, depending on test conditional, i less than 10 div.classlist.toggle("visible", i < 10 ); console.log(div.classlist.
contains("foo")); // add or remove multiple classes div.classlist.add("foo", "bar", "baz"); div.classlist.remove("foo", "bar", "baz"); // add or remove multiple classes using spread syntax const cls = ["foo", "bar"]; div.classlist.add(...cls); div.classlist.remove(...cls); // replace class "foo" with class "bar" div.classlist.replace("foo", "bar"); versions of firefox before 26 do not implement the u...
...implement the barebones domtokenlist livelyness polyfill if (typeof domtokenlist !== "function") (function(window){ var document = window.document, object = window.object, hasownprop = object.prototype.hasownproperty; var defineproperty = object.defineproperty, allowtokenlistconstruction = 0, skippropchange = 0; function...
...peof testclass.replace("a", "b") !== "boolean") domtokenlistproto.replace = function(oldtoken, newtoken){ checkifvalidclasslistentry("replace", oldtoken), checkifvalidclasslistentry("replace", newtoken); var oldvalue = this.value; return (this.remove(oldtoken), this.value !== oldvalue && (this.add(newtoken), true)); }; if (!domtokenlistproto.
contains) domtokenlistproto.
contains = function(value){ for (var i=0,len=this.length; i !== len; ++i) if (this[i] === value) return true; return false; }; if (!domtokenlistproto.foreach) domtokenlistproto.foreach = function(f){ if (arguments.length === 1) for (var i = 0, len = this.length; i !== len; ++i) f( this[i], i, this); else for (var i=0,len=this.length,targ=...
HTMLCanvasElement.getContext() - Web APIs
cs drivers on the platform are not yet stable. the khronos group certifies webgl implementations under certain conformance rules. contextattributes you can use several context attributes when creating your rendering context, for example: const gl = canvas.getcontext('webgl', { antialias: false, depth: false }); 2d context attributes: alpha: boolean that indicates if the canvas
contains an alpha channel. if set to false, the browser now knows that the backdrop is always opaque, which can speed up drawing of transparent content and images. desynchronized: boolean that hints the user agent to reduce the latency by desynchronizing the canvas paint cycle from the event loop (gecko only) willreadfrequently: boolean that indicates whether or not a lot of read-back operations ar...
...) 2d canvas and can save memory when calling getimagedata() frequently. this option is only available, if the flag gfx.canvas.willreadfrequently.enable is set to true (which, by default, is only the case for b2g/firefox os). (blink only) storage: string that indicates which storage is used ("persistent" by default). webgl context attributes: alpha: boolean that indicates if the canvas
contains an alpha buffer. desynchronized: boolean that hints the user agent to reduce the latency by desynchronizing the canvas paint cycle from the event loop antialias: boolean that indicates whether or not to perform anti-aliasing. depth: boolean that indicates that the drawing buffer has a depth buffer of at least 16 bits. failifmajorperformancecaveat: boolean that indicates if a context will...
...ext. possible values are: "default": let the user agent decide which gpu configuration is most suitable. this is the default value. "high-performance": prioritizes rendering performance over power consumption. "low-power": prioritizes power saving over rendering performance. premultipliedalpha: boolean that indicates that the page compositor will assume the drawing buffer
contains colors with pre-multiplied alpha. preservedrawingbuffer: if the value is true the buffers will not be cleared and will preserve their values until cleared or overwritten by the author. stencil: boolean that indicates that the drawing buffer has a stencil buffer of at least 8 bits. return value a renderingcontext which is either a canvasrenderingcontext2d for "2d", webglrenderingcon...
HTMLImageElement - Web APIs
alues. htmlimageelement.height an integer value that reflects the height html attribute, indicating the rendered height of the image in css pixels. htmlimageelement.ismap a boolean that reflects the ismap html attribute, indicating that the image is part of a server-side image map. this is different from a client-side image map, specified using an <img> element and a corresponding <map> which
contains <area> elements indicating the clickable areas in the image. the image must be contained within an <a> element; see the ismap page for details. htmlimageelement.loading a domstring providing a hint to the browser used to optimize loading the document by determining whether to load the image immediately (eager) or on an as-needed basis (lazy). htmlimageelement.naturalheight read only returns ...
...string. htmlimageelement.sizes a domstring reflecting the sizes html attribute. this string specifies a list of comma-separated conditional sizes for the image; that is, for a given viewport size, a particular image size is to be used. read the documentation on the sizes page for details on the format of this string. htmlimageelement.src a usvstring that reflects the src html attribute, which
contains the full url of the image including base uri. you can load a different image into the element by changing the url in the src attribute. htmlimageelement.srcset a usvstring reflecting the srcset html attribute. this specifies a list of candidate images, separated by commas (',', u+002c comma). each candidate image is a url followed by a space, followed by a specially-formatted string indicating ...
...ither the width or a size multiple. read the srcset page for specifics on the format of the size substring. htmlimageelement.usemap a domstring reflecting the usemap html attribute, containing the page-local url of the <map> element describing the image map to use. the page-local url is a pound (hash) symbol (#) followed by the id of the <map> element, such as #my-map-element. the <map> in turn
contains <area> elements indicating the clickable areas in the image. htmlimageelement.width an integer value that reflects the width html attribute, indicating the rendered width of the image in css pixels. htmlimageelement.x read only an integer indicating the horizontal offset of the left border edge of the image's css layout box relative to the origin of the <html> element's containing block. ht...
Recommended Drag Types - Web APIs
s, separate each link inside the text/uri-list data with a crlf linebreak. lines that begin with a number 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 o...
...ng a drop as multiple items in the data transfer. see dragging and dropping multiple items for more details about this. the following example shows how to create an area for receiving dropped files: <listbox ondragenter="return checkdrag(event)" ondragover="return checkdrag(event)" ondrop="dodrop(event)"/> <script> function checkdrag(event) { return event.datatransfer.types.
contains("application/x-moz-file"); } function dodrop(event) { var file = event.datatransfer.mozgetdataat("application/x-moz-file", 0); if (file instanceof components.interfaces.nsifile) { event.currenttarget.appenditem(file.leafname); } } </script> in this example, the event returns false only if the data transfer
contains the application/x-moz-file type. during the drop event, the data asso...
...od will return an nsisupports that needs to be checked and converted into an nsifile. this is also a good extra check in case someone made a mistake and added a non-file for this type. updates to datatransfer.types the latest spec dictates that datatransfer.types should return a frozen array of domstrings rather than a domstringlist (this is supported in firefox 52 and above). as a result, the
contains method no longer works; the includes method should be used instead to check if a specific type of data is provided, using code like the following: if ([...event.datatransfer.types].includes('text/html')) { // do something } you could use feature detection to determine which method is supported on types, then run code as appropriate. dragging images direct image dragging is not common. in fa...
Keyboard API - Web APIs
entify that key to a user. 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. keyboard api concepts and usage keyboard mapping on physical keyboards, the code attribute
contains the physical location of the key that was pressed, and the key attribute
contains the string generated by pressing the key at that physical location on the keyboard. the key value takes into account the keyboard's locale (for example, 'en-us'), layout (for example, 'qwerty'), and modifier-key state (shift, control, etc.). historically there has been no way to retrieve that information. the keybo...
...as been no way to retrieve that information. the keyboard map api provides a way to retrieve the string generated by a particular key press, through the keyboard interface and the keyboardlayoutmap interface. the keyboard interface is accessed through navigator.keyboard. keyboard provides the keyboard.getlayoutmap method, which returns a promise that resolves with a keyboardlayoutmap object that
contains members for converting codes to keys. a list of valid code values is found in the writing system keys section of the ui events keyboardevent code values spec. the following example demonstrates how to get the location-specific or layout-specific string associated with the key labeled w on an english qwerty keyboard. if (navigator.keyboard) { var keyboard = navigator.keyboard; keyboard.getla...
...g experiences often require access to special keys and keyboard shortcuts while in full-screen mode. examples of such key/key combinations include escape, alt+tab, and ctrl+n. those keys and key combinations are typically captured by the user agent or the underlying operating system, as illustrated in the following example. to capture the "w", "a", "s", and "d" keys, call lock() with a list that
contains the key code attribute value for each of these keys: navigator.keyboard.lock(["keyw", "keya", "keys", "keyd"]); this captures these keys regardless of which modifiers are used with the key press. assuming a standard united states qwerty layout, registering keyw ensures that "w", shift+"w", control+"w", control+shift+"w", and all other key modifier combinations with "w" are sent to the app. the ...
MediaTrackSettings - Web APIs
se is always visible in the video content of the {domxref("mediastream"), unless the mouse has moved outside the area of the content. motion the mouse cursor is always included in the video if it's moving, and for a short time after it stops moving. never the mouse cursor is never included in the shared video. ...
... {domxref("mediastream"), unless the mouse has moved outside the area of the content. motion the mouse cursor is always included in the video if it's moving, and for a short time after it stops moving. never the mouse cursor is never included in the shared video. displaysurface a domstring which specifies the type of source the track
contains; one of: application the stream
contains all of the windows of the application chosen by the user rendered into the one video track. browser the stream
contains the contents of a single browser tab selected by the user. monitor the stream's video track
contains the entire contents of one or more of the user's screens. window the stream
contains a single window selected by the user for sharing. logicalsurface a boolean ...
...this is false if the video being captured is coming from a foreground (user-visible) source. specifications specification status comment screen capturethe definition of 'mediatracksettings' in that specification. ...
OffscreenCanvas.getContext() - Web APIs
tform is not yet stable. the khronos group certifies webgl implementations under certain conformance rules. contextattributes you can use several context attributes when creating your rendering context, for example: offscreen.getcontext("webgl", { antialias: false, depth: false }); 2d context attributes: alpha: boolean that indicates if the canvas
contains an alpha channel. if set to false, the browser now knows that the backdrop is always opaque, which can speed up drawing of transparent content and images then. (gecko only) willreadfrequently: boolean that indicates whether or not a lot of read-back operations are planned. this will force the use of a software (instead of hardware accelerated) 2d canvas and can save memory when calling getima...
...) 2d canvas and can save memory when calling getimagedata() frequently. this option is only available, if the flag gfx.canvas.willreadfrequently.enable is set to true (which, by default, is only the case for b2g/firefox os). (blink only) storage: string that indicates which storage is used ("persistent" by default). ...
... preservedrawingbuffer: if the value is true the buffers will not be cleared and will preserve their values until cleared or overwritten by the author. failifmajorperformancecaveat: boolean that indicates if a context will be created if the system performance is low. ...
Pointer events - Web APIs
scenarios when device-specific handling is desired, pointer events defines a pointertype property to inspect the device type which produced the event. the events needed to handle generic pointer input are analogous to mouse events (mousedown/pointerdown, mousemove/pointermove, etc.). consequently, pointer event types are intentionally similar to mouse event types. additionally, a pointer event
contains the usual properties present in mouse events (client coordinates, target element, button states, etc.) in addition to new properties for other forms of input: pressure, contact geometry, tilt, etc. in fact, the pointerevent interface inherits all of the mouseevent properties, thus facilitating the migration of content from mouse events to pointer events. terminology active buttons state the ...
...nates a specific element as the capture target of future pointer events. releasepointercapture() this method releases (stops) pointer capture that was previously set for a specific pointer event. navigator extension the navigator.maxtouchpoints property is used to determine the maximum number of simultaneous touch points that are supported at any single point in time. examples this section
contains examples of basic usage of using the pointer events interfaces. registering event handlers this example registers a handler for every event type for the given element. <html> <script> function over_handler(event) { } function enter_handler(event) { } function down_handler(event) { } function move_handler(event) { } function up_handler(event) { } function cancel_handle...
...ently, even if a browser supports pointer events, the browser must still process mouse events so content that assumes mouse-only input will work as is without direct modification. ideally, a pointer enabled application does not need to explicitly handle mouse input. however, because the browser must process mouse events, there may be some compatibility issues that need to be handled. this section
contains information about pointer event and mouse event interaction and the ramifications for application developers. the browser may map generic pointer input to mouse events for compatibility with mouse-based content. this mapping of events is called compatibility mouse events. authors can prevent the production of certain compatibility mouse events by canceling the pointerdown event but note that: ...
RTCStats - Web APIs
, statistics about a received rtp stream are represented by rtcreceivedrtpstreamstats. properties id a domstring which uniquely identifies the object which was inspected to produce this object based on rtcstats. timestamp a domhighrestimestamp object indicating the time at which the sample was taken for this statistics object. type a domstring indicating the type of statistics the object
contains, taken from the enum type rtcstatstype. the statistics type hierarchy the various dictionaries that are used to define the contents of the objects that contain each of the various types of statistics for webrtc are structured in such a way that they build upon the core rtcstats dictionary, each layer adding more relevant information. rtcstats is the foundation of all webrtc statistics objec...
...cs objects rtcrtpstreamstats adds to rtcstats information that applies to all rtp endpoints (that is, both local and remote endpoints, and regardless of whether the endpoint is a sender or a receiver) rtcreceivedrtpstreamstats further adds statistics measured at the receiving end of an rtp stream, regardless of whether it's local or remote. ...
...oints, and regardless of whether the endpoint is a sender or a receiver) rtcreceivedrtpstreamstats further adds statistics measured at the receiving end of an rtp stream, regardless of whether it's local or remote. rtcinboundrtpstreamstats
contains statistics that can only be measured on a receiver at the local end of the rtp connection. rtcoutboundrtpstreamstats
contains statistics related to the receiver at the remote end of the rtp stream. rtcsentrtpstreamstats offers statistics related to the sending end of an rtp stream. rtcoutboundrtpstreamstats
contains statistics about the local sending endpoint of an rtp stream. rtcremoteoutboundrtpstreamstats holds statistics related to the remote sending end an rtp stream. ...
RTCStatsType - Web APIs
s to another candidate pair; this change cannot be detected otherwise. certificate an rtccertificatestats object providing statistics related to a certificate being used by an rtcicetransport. codec an rtccodecstats object containing statistics about a codec currently being used by rtp streams to send or receive data for the rtcpeerconnection. csrc an rtccontributingsourcestats object which
contains statistics related to a contributing source (csrc) that contributed to an inbound rtp stream. data-channel an rtcdatachannelstats object which
contains statistics about each rtcdatachannel on the connection. inbound-rtp an rtcinboundrtpstreamstats object providing statistics about inbound data being received from remote peers. since this only provides statistics related to inbound data, witho...
... statistics about your outbound rtp data stream, but from the perspective of the remote peer. that is, this information is about your outbound-rtp stream, but as seen by the remote device that's handling the stream. you can use this information to do things like determine how well the remote peer is receiving data. remote-outbound-rtp the report is an rtcremoteoutboundrtpstreamstats object that
contains statistics about your inbound rtp (inbound-rtp) stream, but from the perspective of the remote peer. sender an object containing statistics about the rtcrtpsender for a stream on the rtcpeerconnection. if kind is "audio", this object is of type rtcaudiosenderstats; if kind is "video", this is an rtcvideosenderstats object. stream an object of type rtcmediastreamstats, providing statistics and...
...ject is one of the types based on rtcmediahandlerstats: for audio tracks, the type is rtcsenderaudiotrackattachmentstats and for video tracks, the type is rtcsendervideotrackattachmentstats. the data within provides statistics related to a particular mediastreamtrack's attachment to an rtcrtpsender; also included are the media level metrics that go along with the track. transport an object that
contains statistics related to a transport for an rtcpeerconnection. the object is of type rtctransportstats. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcstatstype' in that specification. candidate recommendation initial definition. ...
TextRange - Web APIs
ote that this interface is not supported in non ie browsers. alternative selection and range interfaces can be used. properties textrange.boundingheightread only returns the height of the rectangle bound to the textrange object. textrange.boundingleftread only returns the distance between the left edge of the rectangle that binds the textrange object and the left edge that completely
contains the textrange object. textrange.boundingtopread only returns the distance between the top edge of the rectangle that binds the textrange object and the top edge that completely
contains the textrange object. textrange.boundingwidthread only returns the width of the rectangle bound to the textrange object. textrange.htmltext gets or sets the html content within the textrange. textrang...
... the range to include the full range of specified units. for example, expanding a "word" means that the words at both ends of the range will completely included in the range. xpand to wor may become expand to words, etc. textrange.findtext() searches the specified text in the original range and adjusts the range to include the first match. textrange.inrange() returns whether the current range
contains the specified range. textrange.isequal() returns whether the current range is equal to the specified range. textrange.move() collapses the range and moves the blank range by a specified number of units. such as, move("character",-1) means to move one character to the left. textrange.moveend() moves the end of the range by a specified number of units. textrange.movestart() moves the start ...
...extrange.moveend() moves the end of the range by a specified number of units. textrange.movestart() moves the start of the range by a specified number of units. textrange.movetoelementtext() causes the range to contain the text of the specified element. can only be used on element objects. textrange.parentelement() returns the parent element of the range, which is the smallest element that
contains the range completely. if the selection
contains more than one element, when you modify the contents of the selection, the contents will be placed in the corresponding position of the parent element instead of the child element. textrange.pastehtml() paste the html content into the given range and replace any previous text and html elements in the range. textrange.querycommandenabled() returns...
Signaling and video calling - Web APIs
note: obviously, it would be more efficient to update the list by adding and removing individual users instead of rebuilding the whole list every time it changes, but this is good enough for the purposes of this example. then we iterate over the array of user names using foreach(). for...
...ng foreach(). for each name, we create a new <li> element, then create a new text node containing the user name using createtextnode(). that text node is added as a child of the <li> element. next, we set a handler for the click event on the list item, that clicking on a user name calls our invite() method, which we'll look at in the next section. finally, we append the new item to the <ul> that
contains all of the user names. starting a call when the user clicks on a username they want to call, the invite() function is invoked as the event handler for that click event: var mediaconstraints = { audio: true, // we want an audio track video: true // ...and we want a video track }; function invite(evt) { if (mypeerconnection) { alert("you can't start a call because you already have one...
...aller and the callee. these servers are used to determine the best route and protocols to use when communicating between the peers, even if they're behind a firewall or using nat. note: you should always use stun/turn servers which you own, or which you have specific authorization to use. this example is using a known public stun server but abusing these is bad form. each object in iceservers
contains at least a urls field providing urls at which the specified server can be reached. it may also provide username and credential values to allow authentication to take place, if needed. after creating the rtcpeerconnection, we set up handlers for the events that matter to us. the first three of these event handlers are required; you have to handle them to do anything involving streamed media with...
Web Video Text Tracks Format (WebVTT) - Web APIs
urpose of webvtt files is to add text overlays to a <video>. webvtt is a text based format, which must be encoded using utf-8. where you can use spaces you can also use tabs. there is also a small api available to represent and manage these tracks and the data needed to perform the playback of the text at the correct times. webvtt files the mime type of webvtt is text/vtt. a webvtt file (.vtt)
contains cues, which can be either a single line or multiple lines, as shown below: webvtt 00:01.000 --> 00:04.000 - never drink liquid nitrogen. 00:05.000 --> 00:09.000 - it will perforate your stomach. - you could die. webvtt body the structure of a webvtt consists of the following components, some of them optional, in this order: an optional byte order mark (bom). the string "webvtt". an opt...
... indicates when the cue is shown. it has a start and end time which are represented by timestamps. the end time must be greater than the start time, and the start time must be greater than or equal to all previous start times. cues may have overlapping timings. if the webvtt file is being used for chapters (<track> kind is chapters) then the file cannot have overlapping timings. each cue timing
contains five components: timestamp for start time. at least one space. the string "-->". at least one space. timestamp for end time. which must be greater than the start time. the timestamps must be in one of two formats: mm:ss.ttt hh:mm:ss.ttt where the components are defined as follows: hh is hours. must be at least two digits. hours can be greater than two digits...
...d for a title. the last line might be used for an asian language. 00:00:05.000 --> 00:00:10.000 00:00:05.000 --> 00:00:10.000 line:63% position:72% align:start 00:00:05.000 --> 00:00:10.000 line:0 position:20% size:60% align:start 00:00:05.000 --> 00:00:10.000 vertical:rt line:-1 align:end cue payload the payload is where the main information or content is located. in normal usage the payload
contains the subtitles to be displayed. the payload text may contain newlines but it cannot contain a blank line, which is equivalent to two consecutive newlines. a blank line signifies the end of a cue. a cue text payload cannot contain the string "-->", the ampersand character (&), or the less-than sign (<). instead use the escape sequence "&" for ampersand and "<" for less-than. it is also reco...
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
keep in mind that most webgl and webxr programming is done using third-party libraries which expand upon the basic functionality of webgl by adding routines that make it much easier to perform not only core matrix and other operations, but often also to simulate these standard cinematography techniques. you...
...1} & a_{5} & a_{9} & a_{13} \\ a_{2} & a_{6} & a_{10} & a_{14} \\ a_{3} & a_{7} & a_{11} & a_{15} \\ a_{4} & a_{8} & a_{12} & a_{16} \end{matrix} \right ] is represented in array form like this: let matrixarray = [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16]; in this array, the leftmost column
contains the entries a1, a2, a3, and a4. the topmost row
contains the entries a1, a5, a9, and a13. keep in mind that most webgl and webxr programming is done using third-party libraries which expand upon the basic functionality of webgl by adding routines that make it much easier to perform not only core matrix and other operations, but often also to simulate these standard cinematography techniques. you should strongly consider using one instead of directly u...
...y draw into the portion of the framebuffer that represents the image seen by the eye identified by view.eye. with the constraints so established and everything else we need ready, we call a custom function, myrenderscene(), to actually perform the computations and webgl rendering to render the frame. in this case, we're passing in the webgl context, gl, the xrview view, a scenedata object (which
contains things like the vertex and fragment shaders, vertex lists, textures, and so forth), and deltatime, which indicates how much time has passed since the previous frame, so that we know how far to advance the animation. when this function returns, the webgl framebuffer being used by webxr now has in it two copies of the scene, each occupying half the frame: one for the left eye, and one for the righ...
Attestation and Assertion - Web APIs
rtificate. the attestation certificate is built into the authenticator during manufacturing time and is specific to a device model. that is, all "samsung galaxy s8" phones, manufactured at a specific time or particular manufacturing run, have the same attestation certificate. the attestation is returned through the webauthn api as the authenticatorattestationresponse. the attestation format
contains two basic arraybuffers: clientdatajson - an arraybuffer that
contains a json representation of what the browser saw when being asked to authenticate. attestationobject - cryptographic attestation that a newly generated keypair was created by that authenticator.
contains authenticator data and an attestation statement. the authenticator data
contains an attestedcredentialdata field. th...
...(the authenticator data is the same structure that is used in the authenticatorassertionresponse. the attestedcredentialdata is an optional field used in attestation. it is not included when used in the authenticatorassertionresponse.) different devices have different attestation formats. ...
... service, the server sends a challenge and the authenticator signs over it with a key pair previously registered to that service. this creates an assertion. unlike the attestation, the format of the assertion is always the same regardless of the device being used. the assertion is returned through the webauthn api as the authenticatorassertionresponse. the assertion format is fairly simple as it
contains four basic arraybuffers: clientdatajson - the same as in attestation. an arraybuffer that
contains a json representation of what the browser saw when being asked to authenticate. authenticatordata - data created and/or used by the authenticator signature - a signature over the clientdatajson and authenticatordata that can be verified with the public key that was created during r...
ARIA: application role - Accessibility
tional html interpretation techniques should be used. this role should only be used to define very dynamic and desktop-like web applications. <div role="application">...</div> this defines this div element and all of its descendants to be treated like they are part of a desktop application. description the application role indicates to assistive technologies that this part of the web content
contains elements that do not conform to any other known html element or wai-aria widget. any sort of special interpretation of html structures and widgets should be suspended, and control should be completely handed over to the browser and web application to handle mouse, keyboard, or touch interaction. in this mode, the web author is completely responsible for handling any and all keyboard input, focus...
...ntrol should be completely handed over to the browser and web application to handle mouse, keyboard, or touch interaction. in this mode, the web author is completely responsible for handling any and all keyboard input, focus management, and other interactions and cannot assume assistive technologies would do any processing on their end. if the web application encompassed by the application role
contains parts that should be treated like normal web content, a role of document or article should be used. background for historic reasons, especially on windows, screen readers and some other assistive technologies (at) have traditionally grabbed the whole web content from the browser at once after it had finished loading. the ats build their own representation of it that makes the most sense for a b...
... associated wai-aria roles, states, and properties document, article used to indicate parts of the application that should be treated as normal web content aria-activedescendant used to manage focus inside the application. aria-label used to provide the name of the application or purpose of the widget that is being exposed. aria-describedby used to indicate the idref of an element that
contains additional instructions for navigating or operating this element. aria-roledescription used to give the application a more descriptive role text for screen readers to speak. this should be localized. keyboard interactions keyboard interaction is completely under the web author's control and can be anything associated with the particular widget being implemented. in a slides application, for ...
ARIA: rowgroup role - Accessibility
an element with role="rowgroup" is a group of rows within a tabular structure. a rowgroup
contains one or more rows of cells, grid cells, column headers, or row headers within a grid, table or treegrid. <div role="table" aria-label="populations" aria-describedby="country_population_desc"> <div id="country_population_desc">world populations by country</div> <div role="rowgroup"> <div role="row"> <span role="columnheader" aria-sort="descending">country</span> <span role="columnheader"aria-sort="none">population</span> </div> </div> <div role="rowgroup"> <div role="row"> <span role="cell">finland</span> <span role="cell">5.5 million</span> </div> <div role="row"> <span role="cell">france</span> <span role=...
...ontained in, or owned by, elements with either the table or grid role. using the native <thead>, <tfoot> , and <tbody> html elements, whenever possible, is strongly encouraged. to create an aria table header, table footer or table body, add role="rowgroup" to the element. that rowgroup should be nested within a grid, table or treegrid, encompassing a group of one or more rows. each row, in turn,
contains child cells. these cells can be of different types, depending on whether they are column or row headers, or plain or grid cells. note: using the native html table element (<table>) along with the table header (<thead>), footer (<tfoot>), and body (<tbody>) elements whenever possible is strongly encouraged. associated wai-aria roles, states, and properties context roles role="table" one ...
...grid) in which you'll find a row. it identifies the row as being part of a non-interactive table structure containing data arranged in rows and columns, similar to the native <table> html element. role="treegrid" similar to a grid, but with rows that can be expanded and collapsed in the same manner as for a tree. descendant roles role="row" a row of cells within a tabular structure. a row
contains one or more cells, gridcell, or column headers, and sometimes a row header. keyboard interactions none required javascript features none. the first rule of aria use is if you can use a native feature with the semantics and behavior you require already built in, instead of re-purposing an element and adding an aria role, state or property to make it accessible, then do so. employ the html ...
WAI-ARIA Roles - Accessibility
priate semantics do not already exist. a figure is generally considered to be one or more images, code snippets, or other content that puts across information in a different way to a regular flow of text.aria: form rolethe form landmark role can be used to identify a group of elements on a page that provide equivalent functionality to an html form.aria: grid rolethe grid role is for a widget that
contains one or more rows of cells. the position of each cell is significant and can be focused using keyboard input.aria: gridcell rolethe gridcell role is used to make a cell in a grid or treegrid. it is intended to mimic the functionality of the html td element for table-style grouping of information.aria: heading rolethe heading role defines this element as a heading to a page or section. to give the ...
... through a website or page content.aria: region rolethe region landmark role is used to identify an area in the document that the author has identified as significant. it is used to provide a generic landmark for people to be able to navigate to easily when none of the other landmark roles are appropriate.aria: row rolean element with role="row" is a row of cells within a tabular structure. ...
... of the other landmark roles are appropriate.aria: row rolean element with role="row" is a row of cells within a tabular structure. a row
contains one or more cells, grid cells or column headers, and possibly a row header, within a grid, table or treegrid, and optionally within a rowgroup.aria: rowgroup rolean element with role="rowgroup" is a group of rows within a tabular structure. a rowgroup
contains one or more rows of cells, grid cells, column headers, or row headers within a grid, table or treegrid.aria: search rolethe search landmark role is used to identify a section of the page used to search the page, site, or collection of sites.aria: suggestion rolethe suggestion landmark role semantically denotes a single proposed change to an editable document. this should be used on an element th...
Accessibility documentation index - Accessibility
hat puts across information in a different way to a regular flow of text. 63 aria: form role aria, aria role, aria figure, accessibility, reference, rôle, form the form landmark role can be used to identify a group of elements on a page that provide equivalent functionality to an html form. 64 aria: grid role aria, html the grid role is for a widget that
contains one or more rows of cells. the position of each cell is significant and can be focused using keyboard input. 65 aria: gridcell role aria, html the gridcell role is used to make a cell in a grid or treegrid. it is intended to mimic the functionality of the html td element for table-style grouping of information. 66 aria: heading role aria, aria role, aria headin...
... role aria, accessibility, needscontent the listbox role is used for lists from which a user may select one or more items which are static and, unlike html <select> elements, may contain images. 69 aria: row role aria, aria role, aria row, aria row role, accessibility, reference, row role an element with role="row" is a row of cells within a tabular structure. ...
... 71 aria: search role aria, aria role, reference, role-search the search landmark role is used to identify a section of the page used to search the page, site, or collection of sites. ...
Text labels and names - Accessibility
ccount section.</p> <button>close</button> </div> see also role="dialog" role="alertdialog" aria-label aria-labelledby wai-aria: dialog role dialog authoring practices documents must have a title it is important on each html document to include a <title> that describes the page's purpose. a common navigation technique for users of assistive technology is to infer what content a page
contains by reading its title. if the title is not available, they have to navigate the page to determine its content, which can be a time consuming and potentially confusing process. examples the title for the reference article about the <title> element is as follows: <title><title>: the document title element - html: hypertext markup language</title> another example might look like so: <title...
...t rely on placeholder text, because it disappears as soon as the user starts typing. frame elements must be labeled frame elements, both <iframe> and the older, obsolete <frame>, must have a title to describe the contents of the frame. use the title attribute to label a frame element. without a title, users of assistive technologies have to navigate into the frame in order to understand what it
contains, which can be difficult and confusing. the <frame> element is no longer part of the html specification as of html5. support for it may be dropped by browsers in the future. in addition, it is difficult for screen readers to navigate pages with <frame> elements. for best accessibility and future maintenance, redesign any pages that use frames to use css to achieve a similar layout. as a best pr...
... on headings to understand the structure and content of a document. do not use heading elements to mark up images or other graphical content. use title attribute to describe <iframe> content make sure that <iframe> elements have a title attribute to describe the contents of the frame. without a title, users of assistive technologies have to navigate into the frame in order to understand what it
contains, which can be difficult and confusing. as a best practice, also provide a <title> for the document that is enclosed in the frame, with content identical to the frame's title attribute. (this assumes that the enclosed document is under your control; if not, try to match the frame's title attribute to the document's title.) some screen readers replace the contents of the title attribute with the ...
Understandable - Accessibility
r it. you don't need to set a different language for words or phrases that are the same regardless of language (for example proper names, technical terms that aren't part of a specific language). 3.1.3 unusual words (aaa) where technical terms, jargon, or idioms/slang are used, definitions should be provided for such phrases/words. your site should provide a glossary that
contains definitions of such words/terms that you can then link to when they appear, or at the very least provide definitions somewhere in the surrounding text, or in a description list at the bottom of the page. 3.1.4 abbreviations (aaa) where abbreviations are used, you should provide an expansion of them, or a definition as required. the <abbr> element is often thought of as t...
... provide definitions somewhere in the surrounding text, or in a description list at the bottom of the page. 3.1.4 abbreviations (aaa) where abbreviations are used, you should provide an expansion of them, or a definition as required. the <abbr> element is often thought of as the preferred way to provide an expansion for an abbreviation — it takes a title attribute that
contains the expansion, and this appears when the acronym is moused over. however, the title contents are not accessible via keyboard, nor are they reliably read out by screenreaders. a better way to handle this is to again provide links to glossary pages containing the acronym expansion and explanation, or at the very least include them in the surrounding text in context. see abbreviations. ...
...d not change the context in a way that may confuse or disorientate the user. this is a matter of sensible design — people don't want interfaces to surprise them; they want things to be intuitive and behave as expected. for example, focusing a navigation menu option should not change the displayed page — it should be activated before the display changes. globaleventhandlers.onfocus
contains some useful information. also see building keyboard accessibility back in for some useful implementation ideas. 3.2.2 on input (a) when data is inputted into a control, or a setting is changed, context should not be changed unexpectedly. the user should be warned/advised of the impending change before it occurs. again, sensible design should be implemented. for example, if p...
:where() - CSS: Cascading Style Sheets
ty, whereas :is() takes on the specificity of the most specific selector in its arguments. examples comparing :where() and :is() this example shows how :where() works, and also illustrates the difference between :where() and :is(). take the following html: <article> <h2>:is()-styled links</h2> <section class="is-styling"> <p>here is my main content. this <a href="https://mozilla.org">
contains a link</a>. </section> <aside class="is-styling"> <p>here is my aside content. this <a href="https://developer.mozilla.org">also
contains a link</a>. </aside> <footer class="is-styling"> <p>this is my footer, also containing <a href="https://github.com/mdn">a link</a>. </footer> </article> <article> <h2>:where()-styled links</h2> <section class="where-styling"> <p>her...
... </aside> <footer class="where-styling"> <p>this is my footer, also containing <a href="https://github.com/mdn">a link</a>. ...
... </aside> <footer class="where-styling"> <p>this is my footer, also containing <a href="https://github.com/mdn">a link</a>. ...
Visual formatting model - CSS: Cascading Style Sheets
s are often referred to by their display type — e.g. a box generated by an element with display: block is called a "block box" or just a "block". note however that block boxes, block-level boxes and box containers are all subtly different; see the block boxes section below for more details. the principal box when an element generates one or more boxes, one of them is the principal box, which
contains its descendant boxes and generated content in the box tree, and is also the box involved in any positioning scheme. some elements may generate additional boxes in addition to the principal box, for example display: list-item generates more than one box (e.g. a principal block box and a child marker box). and some values (such as none or contents) cause the element and/or its descendants to not g...
...rder to gain the useful effects of this, without any unwanted issues caused by changing the value of overflow. block boxes in specifications, block boxes, block-level boxes, and block containers are all referred to as block boxes in certain places. these things are somewhat different and the term block box should only be used if there is no ambiguity. ...
... inline-level and block-level boxes these are the boxes contained inside the block container that are participating in inline or block layout, respectively. block boxes a block box is a block-level box that is also a block container. ...
Using HTML sections and outlines - Developer guides
t. it is important for developers to use these semantic elements in line with their intended purposes. many accessibility tools as well as reader views provided by some browsers rely on semantic sectioning elements. so don't simply swap out an existing tangle of <div> elements for a bunch of <section> elements. section elements in html5 html navigational element (<nav>) defines a section that
contains navigation links that appear often on a site. you can have primary and secondary menus, but you cannot nest a <nav> element inside another <nav> element. html article element (<article>) defines a piece of self-contained content. it does not refer to the main content alone and can be used for comments and widgets. html section element (<section>) defines a section of a document to indicate a re...
...ra context for the parent element. html aside element (<aside>) defines a section that, though related to the main element, doesn't belong to the main flow, like an explanation box or an advertisement. the aside element has its own outline, but doesn't belong to the main one. other semantic html elements used in sectioning html body element (<body>) defines all the content of a document. it
contains all the content and html tags. html header element (<header>) defines a page area that typically
contains a logo, title, and navigation. the header can also be used inside other semantic elements such as <article> or <section>. a section header might contain the section's heading, author name, etc. <article>, <section>, <aside>, and <nav> can have their own <header>. despite its name, the header...
...e header can also be used inside other semantic elements such as <article> or <section>. a section header might contain the section's heading, author name, etc. <article>, <section>, <aside>, and <nav> can have their own <header>. despite its name, the header is not necessarily positioned at the beginning of a page or section. html footer element (<footer>) defines a page footer, which typically
contains copyright or legal notices and sometimes some links. in the context of a section, a footer might contain the sectioned content's publication date, license information, etc. <article>, <section>, <aside>, and <nav> can have their own <footer>. despite its name, the footer is not necessarily positioned at the end of a page or section. how do sectional elements work? <body> <header> <n...
<input type="file"> - HTML: Hypertext Markup Language
if the user selected multiple files, the value represents the first file in the list of files they selected. the other files can be identified using the input's htmlinputelement.files property. note: if multiple files are selected, the string represents the first selected file. javascript can access the other files through the inpu...
...u only want the user to choose a single file per <input>, omit the multiple attribute. getting information on selected files the selected files' are returned by the element's htmlinputelement.files property, which is a filelist object containing a list of file objects. the filelist behaves like an array, so you can check its length property to get the number of selected files. each file object
contains the following information: name the file's name. lastmodified a number specifying the date and time at which the file was last modified, in milliseconds since the unix epoch (january 1, 1970 at midnight). lastmodifieddate a date object representing the date and time at which the file was last modified. this is deprecated and should not be used. use lastmodified instead. size the size ...
...tener to the input to listen for changes to its selected value changes (in this case, when files are selected). the event listener invokes our custom updateimagedisplay() function. input.addeventlistener('change', updateimagedisplay); whenever the updateimagedisplay() function is invoked, we: use a while loop to empty the previous contents of the preview <div>. grab the filelist object that
contains the information on all the selected files, and store it in a variable called curfiles. check to see if no files were selected, by checking if curfiles.length is equal to 0. if so, print a message into the preview <div> stating that no files have been selected. if files have been selected, we loop through each one, printing information about it into the preview <div>. things to note here: we us...
<input type="tel"> - HTML: Hypertext Markup Language
a telephone number, or empty events change and input supported common attributes autocomplete, list, maxlength, minlength, pattern, placeholder, readonly, and size idl attributes list, selectionstart, selectionend, selectiondirection, and value methods select(), setrangetext(), setselectionrange() value the <input> element's value attribute
contains a domstring that either represents a telephone number or is an empty string (""). additional attributes in addition to the attributes that operate on all <input> elements regardless of their type, telephone number inputs support the following attributes: attribute description list the id of the <datalist> element that
contains the optional pre-defined autocomplete o...
...gested values taking it a step farther, you can provide a list of default phone number values from which the user can select. to do this, use the list attribute. this doesn't limit the user to those options, but does allow them to select commonly-used telephone numbers more quickly. this also offers hints to autocomplete. the list attribute specifies the id of a <datalist> element, which in turn
contains one <option> element per suggested value; each option's value is the corresponding suggested value for the telephone number entry box. <label for="telno">phone number: </label> <input id="telno" name="telno" type="tel" list="defaulttels"> <datalist id="defaulttels"> <option value="111-1111-1111"> <option value="122-2222-2222"> <option value="333-3333-3333"> <option value="344-4444-4444"...
... var selectelem = document.queryselector("select"); var inputelems = document.queryselectorall("input"); selectelem.onchange = function() { for(var i = 0; i < inputelems.length; i++) { input...
<input type="url"> - HTML: Hypertext Markup Language
mstring representing a url, or empty events change and input supported common attributes autocomplete, list, maxlength, minlength, pattern, placeholder, readonly, required and size idl attributes list, value, selectionend, selectiondirection methods select(), setrangetext() and setselectionrange(). value the <input> element's value attribute
contains a domstring which is automatically validated as conforming to url syntax. more specifically, there are two possible value formats that will pass validation: an empty string ("") indicating that the user did not enter a value or that the value was removed. a single properly-formed absolute url. this doesn't necessarily mean the url address exists, but it is at least formatted correctly. in sim...
...mple terms, this means urlscheme://restofurl. see validation for details on how urls are validated to ensure that they're formatted properly. ...
...//www.example.com"> offering suggested values taking it a step farther, you can provide a list of default options from which the user can select by specifying the list attribute. this doesn't limit the user to those options, but does allow them to select commonly-used urls more quickly. this also offers hints to autocomplete. the list attribute specifies the id of a <datalist>, which in turn
contains one <option> element per suggested value; each option's value is the corresponding suggested value for the url entry box. <input id="myurl" name="myurl" type="url" list="defaulturls"> <datalist id="defaulturls"> <option value="https://developer.mozilla.org/"> <option value="http://www.google.com/"> <option value="http://www.microsoft.com/"> <option value="https://www.mozilla.org/...
<th> - HTML: Hypertext Markup Language
e omitted, if it is immediately followed by a <th> or <td> element or if there are no more data in its parent element. permitted parents a <tr> element. implicit aria role columnheader or rowheader permitted aria roles any dom interface htmltableheadercellelement attributes this element includes the global attributes. abbr this attribute
contains a short abbreviated description of the cell's content. some user-agents, such as speech readers, may present this description before the content itself. colspan this attribute
contains a non-negative integer value that indicates for how many columns the cell extends. its default value is 1. values higher than 1000 will be considered as incorrect and will be set to the default value (1). header...
...ed description of the cell's content. some user-agents, such as speech readers, may present this description before the content itself. colspan this attribute
contains a non-negative integer value that indicates for how many columns the cell extends. its default value is 1. values higher than 1000 will be considered as incorrect and will be set to the default value (1). headers this attribute
contains a list of space-separated strings, each corresponding to the id attribute of the <th> elements that apply to this element. rowspan this attribute
contains a non-negative integer value that indicates for how many rows the cell extends. its default value is 1; if its value is set to 0, it extends until the end of the table section (<thead>, <tbody>, <tfoot>, even if implicitly defined), that the ...
...ft. note: do not use this attribute as it is obsolete in the latest standard. to achieve the same effect as the left, center, right or justify values, apply the css text-align property to the element. to achieve the same effect as the char value, give the text-align property the same value you would use for the char. unimplemented in css3. axis obsolete since html5 this attribute
contains a list of space-separated strings. each string is the id of a group of cells that this header applies to. note: do not use this attribute as it is obsolete in the latest standard: use the scope attribute instead. bgcolor this attribute defines the background color of each cell in a column. it consists of a 6-digit hexadecimal code as defined in srgb and is prefixed by '#'. this attribute m...
Global attributes - HTML: Hypertext Markup Language
he url of the vocabulary that will be used to define itemprops (item properties) in the data structure. itemscope is used to set the scope of where in the data structure the vocabulary set by itemtype will be active. lang helps define the language of an element: the language that non-editable elements are in, or the language that editable elements should be written in by the user. the attribute
contains one “language tag” (made of hyphen-separated “language subtags”) in the format defined in tags for identifying languages (bcp47). xml:lang has priority over it. part a space-separated list of the part names of the element. part names allows css to select and style specific elements in a shadow tree via the ::part pseudo-element. slot assigns a slot in a shadow dom shadow tree to an el...
...ement whose name attribute's value matches that slot attribute's value. spellcheck an enumerated attribute defines whether the element may be checked for spelling errors. it may have the following values: true, which indicates that the element should be, if possible, checked for spelling errors; false, which indicates that the element should not be checked for spelling errors. style
contains css styling declarations to be applied to the element. note that it is recommended for styles to be defined in a separate file or files. this attribute and the <style> element have mainly the purpose of allowing for quick styling, for example for testing purposes. tabindex an integer attribute indicating if the element can take input focus (is focusable), if it should participate to sequential ...
... navigation, but its relative order is defined by the platform convention; a positive value means that the element should be focusable and reachable via sequential keyboard navigation; the order in which the elements are focused is the increasing value of the tabindex. if several elements share the same tabindex, their relative order follows their relative positions in the document. title
contains a text representing advisory information related to the element it belongs to. such information can typically, but not necessarily, be presented to the user as a tooltip. translate an enumerated attribute that is used to specify whether an element's attribute values and the values of its text node children are to be translated when the page is localized, or whether to leave them unchanged. it...
A re-introduction to JavaScript (JS tutorial) - JavaScript
you wish to ensure that the body of the loop is executed at least once: while (true) { // an infinite loop! } var input; do { input = get_input(); } while (inputisnotvalid(input)); javascript's for loop is the same as that in c and java: it lets you provide the control information for your loop on a single line. for (var i = 0; i < 5; i++) { // will execute 5 times } javascript also
contains two other prominent for loops: for...of for (let value of array) { // do something with value } and for...in: for (let property in object) { // do something with object property } the && and || operators use short-circuit logic, which means whether they will execute their second operand is dependent on the first. this is useful for checking for null objects before accessing their attrib...
......
...structor, ...args) { var o = {}; // create an object constructor.apply(o, args); return o; } this isn't an exact replica of new as it doesn't set up the prototype chain (it would be difficult to illustrate). this is not something you use very often, but it's useful to know about. in this snippet, ...args (including the ellipsis) is called the "rest arguments" — as the name implies, this
contains the rest of the arguments. calling var bill = trivialnew(person, 'william', 'orange'); is therefore almost equivalent to var bill = new person('william', 'orange'); apply() has a sister function named call, which again lets you set this but takes an expanded argument list as opposed to an array. function lastnamecaps() { return this.last.touppercase(); } var s = new person('simon', 'willi...
Control flow and error handling - JavaScript
the semicolon (;) character is used to separate statements in javascript code. any javascript expression is also a statement. ...
...e}: "${this.message}"`; } // create an instance of the object type and throw it throw new userexception('value too high'); try...catch statement the try...catch statement marks a block of statements to try, and specifies one or more responses should an exception be thrown. if an exception is thrown, the try...catch statement catches it. the try...catch statement consists of a try block, which
contains one or more statements, and a catch block, containing statements that specify what to do if an exception is thrown in the try block. in other words, you want the try block to succeed—but if it does not, you want control to pass to the catch block. if any statement within the try block (or in a function called from within the try block) throws an exception, control immediately shifts to the cat...
...{ // statements to handle any exceptions logmyerrors(err); // pass exception object to error handler } best practice: when logging errors to the console inside a catch block, using console.error() rather than console.log() is advised for debugging. it formats the message as an error, and adds it to the list of error messages generated by the page. the finally block the finally block
contains statements to be executed after the try and catch blocks execute. additionally, the finally block executes before the code that follows the try…catch…finally statement. it is also important to note that the finally block will execute whether or not an exception is thrown. if an exception is thrown, however, the statements in the finally block execute even if no catch block handles the except...
Warning: String.x is deprecated; use String.prototype.x instead - JavaScript
fox versions prior to 68. string generics have been removed starting with firefox 68. ...
...moved starting with firefox 68. ...
...lready present // (one may use shims for these if not available) (function() { 'use strict'; var i, // we could also build the array of methods with the following, but the // getownpropertynames() method is non-shimable: // object.getownpropertynames(string).filter(function(methodname) { // return typeof string[methodname] === 'function'; // }); methods = [ '
contains', 'substring', 'tolowercase', 'touppercase', 'charat', 'charcodeat', 'indexof', 'lastindexof', 'startswith', 'endswith', 'trim', 'trimleft', 'trimright', 'tolocalelowercase', 'normalize', 'tolocaleuppercase', 'localecompare', 'match', 'search', 'slice', 'replace', 'split', 'substr', 'concat', 'localecompare' ], methodcount = methods.length, assignstringgeneric ...
Array - JavaScript
n array. array.prototype[@@unscopables] a symbol containing property names to exclude from a with binding scope. instance methods array.prototype.concat() returns a new array that is this array joined with other array(s) and/or value(s). array.prototype.copywithin() copies a sequence of array elements within the array. array.prototype.entries() returns a new array iterator object that
contains the key/value pairs for each index in the array. array.prototype.every() returns true if every element in this array satisfies the testing function. array.prototype.fill() fills all the elements of an array from a start index to an end index with a static value. array.prototype.filter() returns a new array containing all elements of the calling array for which the provided filtering functio...
...he found element in the array, if some element in the array satisfies the testing function, or undefined if not found. array.prototype.findindex() returns the found index in the array, if an element in the array satisfies the testing function, or -1 if not found. array.prototype.foreach() calls a function for each element in the array. array.prototype.includes() determines whether the array
contains a value, returning true or false as appropriate. array.prototype.indexof() returns the first (least) index of an element within the array equal to an element, or -1 if none is found. array.prototype.join() joins all elements of an array into a string. array.prototype.keys() returns a new array iterator that
contains the keys for each index in the array. array.prototype.lastindexof() retur...
...and its elements. overrides the object.prototype.tolocalestring() method. array.prototype.tostring() returns a string representing the array and its elements. overrides the object.prototype.tostring() method. array.prototype.unshift() adds one or more elements to the front of an array, and returns the new length of the array. array.prototype.values() returns a new array iterator object that
contains the values for each index in the array. array.prototype[@@iterator]() returns a new array iterator object that
contains the values for each index in the array. examples creating an array the following example creates an array, msgarray, with a length of 0, then assigns values to msgarray[0] and msgarray[99], changing the length of the array to 100. let msgarray = [] msgarray[0] = 'hello' m...
Map - JavaScript
lues, retrieve those values, delete keys, and detect whether something is stored at a key. for this reason (and because there were no built-in alternatives), objects have been used as maps historically. however, there are important differences that make map preferable in certain cases: map object accidental keys a map does not contain any keys by default. it only
contains what is explicitly put into it. an object has a prototype, so it
contains default keys that could collide with your own keys if you're not careful. note: as of es5, this can be bypassed by using object.create(null), but this is seldom done. key types a map's keys can be any value (including functions, objects, or any primitive). the keys of an object must...
...pe.get(key) returns the value associated to the key, or undefined if there is none. map.prototype.has(key) returns a boolean asserting whether a value has been associated to the key in the map object or not. map.prototype.set(key, value) sets the value for the key in the map object. returns the map object. iteration methods map.prototype[@@iterator]() returns a new iterator object that
contains an array of [key, value] for each element in the map object in insertion order. map.prototype.keys() returns a new iterator object that
contains the keys for each element in the map object in insertion order. map.prototype.values() returns a new iterator object that
contains the values for each element in the map object in insertion order. map.prototype.entries() returns a new iterator obje...
... map.prototype.foreach(callbackfn[, thisarg]) calls callbackfn once for each key-value pair present in the map object, in insertion order. ...
String.prototype.split() - JavaScript
ern describing where each split should occur. the separator can be a simple string or it can be a regular expression. the simplest case is when separator is just a single character; this is used to split a delimited string. for example, a string containing tab separated values (tsv) could be parsed by passing a tab character as the separator, like this: mystring.split("\t"). if separator
contains multiple characters, that entire character sequence must be found in order to split. if separator is omitted or does not occur in str, the returned array
contains one element consisting of the entire string. if separator appears at the beginning (or end) of the string, it still has the effect of splitting. the result is an empty (i.e. zero length) string, which appears at the first (or last)...
...the following example, split() looks for spaces in a string and returns the first 3 splits that it finds. const mystring = 'hello world. how are you doing?' const splits = mystring.split(' ', 3) console.log(splits) this script displays the following: ["hello", "world.", "how"] splitting with a regexp to include parts of the separator in the result if separator is a regular expression that
contains capturing parentheses (), matched results are included in the array. const mystring = 'hello 1 word. sentence number 2.' const splits = mystring.split(/(\d)/) console.log(splits) this script displays the following: [ "hello ", "1", " word. sentence number ", "2", "." ] note: \d matches the character class for digits between 0 and 9. reversing a string using split() this is not a robus...
...ello ", "1", " word. sentence number ", "2", "." ] note: \d matches the character class for digits between 0 and 9. reversing a string using split() this is not a robust way to reverse a string: const str = 'asdfghjkl' const strreverse = str.split('').reverse().join('') // 'lkjhgfdsa' // split() returns an array on which reverse() and join() can be applied it doesn't work if the string
contains grapheme clusters, even when using a unicode-aware split. (use, for example, esrever instead.) const str = 'résumé' const strreverse = str.split(/(?:)/u).reverse().join('') // => "́emuśer" bonus: use === operator to test if the original string was a palindrome. specifications specification ecmascript (ecma-262)the definition of 'string.prototype.split' in that spec...
Digital audio concepts - Web media technologies
ample, but others use 32-bit floating-point values or 24-bit or 32-bit integers. some older audio file formats—which you won't find in use on the web—used 8-bit integer samples. in addition, samples may use signed or unsigned values, as well. the size of an individual sample is called the sample size. the position of each audio source within the audio signal is called a channel. each channel
contains a sample indicating the amplitude of the audio being produced by that source at a given moment in time. for instance, in stereo sound, there are two audio sources: one speaker on the left, and one on the right. each of these is represented by one channel, and the number of channels contained in the audio signal is called the channel count. while recording or generating multi-channel audio files,...
...e the signal for special speakers designed to produce the low frequency sounds and vibration to create a visceral sensation when listening to the audio. the lfe channels typically drive subwoofers and similar devices. monophonic audio has one channel, stereo sound has two channels, 5.1 surround sound has 6 channels (five standard and one lfe), and so forth. each audio frame is a data record that
contains the samples for all of the channels available in an audio signal. the size of an audio frame is calculated by multiplying the sample size in bytes by the number of channels, so a single frame of stereo 16-bit audio is 4 bytes long and a single frame of 5.1 floating-point audio is 24 (4 bytes per sample multiplied by 6 channels). note: it's worth noting that some codecs will actually separate th...
...h has more consistency and is therefore easier to compress. restricting the audio bandwidth to include only the frequencies most important to how the human ear will interpret the decoded sound can also improve compression factors. the type of content being encoded can affect the choice of codec. in particular, the waveform for music is almost always more complex than that of an audio sample that
contains only human voices. in addition, the human voice uses a small portion of the range of audio frequencies the human ear can detect. telephone networks, which were originally designed specifically to transmit human voices, can only carry audio (or any other kind of signal) in the frequency band from 300 hz to 3,000 hz. this doesn't quite cover the entire range of human speech at the low end, but eno...
Image file type and format guide - Web media technologies
files in many years, but when dealing with older content, you may find some still around. xbm uses a snippet of c code to represent the contents of the image as an array of bytes. each image consists of 2 to 4 #define directives, providing the width and height of the bitmap (and optionally the hotspot, if the image is designed as a cursor), followed by an array of unsigned char, where each value
contains 8 1-bit monochrome pixels. the image must be a multiple of 8 pixels wide. for example, the following code represents an xbm image which is 8 pixels by 8 pixels, with those pixels in a black-and-white checkerboard pattern: #define square8_width 8 #define square8_height 8 static unsigned char square8_bits[] = { 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55 }; mime type image/xbm,...
... true color n/a n/a indexed color n/a n/a greyscale with alpha n/a n/a true color with alpha n/a n/a compression lossless licensing open source choosing an image format picking the best ...
...second. otherwise, jpeg is the safe choice for compatibility. best choice fallback webp or jpeg jpeg icons for smaller images such as icons, use a lossless format to avoid loss of detail in a size-constrained image. while lossless webp is ideal for this purpose, support is not widespread yet, so png is a better choice unless you offer a fallback. if your image
contains fewer than 256 colors, gif is an option, although png often compresses even smaller with its indexed compression option (png-8). if the icon can be represented using vector graphics, consider svg, since it scales across various resolutions and sizes, so it's perfect for responsive design. although svg support is good, it may be worth offering a png fallback for older browsers. best cho...
Module structure of the SDK - Archive of obsolete content
commonjs is the underlying infrastructure for both the sdk and the add-ons you build using the sdk. a commonjs module is a piece of reusable javascript: it exports certain objects which are thus made available to dependent code. commonjs defines: an object called exports which
contains all the objects which a commonjs module wants to make available to other modules a function called require which a module can use to import the exports object of another module. except for scripts that interact directly with web content, all the javascript code you'll write or use when developing add-ons using the sdk is part of a commonjs module, including: sdk modules: the javascript modules which the sdk provides, such as panel and page-mod. local modules: each of the javascript files under your add-...
...our add-on's code into a collection of separate commonjs modules. each module is a separate file stored under your add-on's "lib" directory, and exports the objects you want to make available to other modules in your add-on. see the tutorial on creating reusable modules for more details. to import a local module, specify a path relative to the importing module. ...
panel - Archive of obsolete content
blems getting your add-on approved on amo. instead, keep the script in a separate file and load it using contentscriptfile. this makes your code easier to maintain, secure, debug and review. getting user input note: this example uses the action button api, which is only available from firefox 29 onwards. the following add-on adds a button which displays a panel when clicked. the panel just
contains a <textarea> element: when the user presses the return key, the contents of the <textarea> is sent to the main add-on code. the add-on consists of six files: main.js: the main add-on code, that creates the button and panel get-text.js: the content script that interacts with the panel content text-entry.html: the panel content itself, specified as html icon-16.png, icon-32.png, and icon-6...
...h the width of the panel in pixels. focus whether or not focus will be taken away when the panel is shown. this property is read-only. contenturl the url of content loaded into the panel. this can point to local content loaded from your add-on's "data" directory or remote content. setting it updates the panel's content immediately. allow an object describing permissions for the content. it
contains a single key named script whose value is a boolean that indicates whether or not to execute script in the content. contentscriptfile a local file url or an array of local file urls of content scripts to load. content scripts specified by this property are loaded before those specified by the contentscript property. contentscript a string or an array of strings containing the texts of content ...
self - Archive of obsolete content
ule. id this property is a printable string that is unique for each add-on. it comes from the id property set in the package.json file in the main package (i.e. the package in which you run jpm xpi). while not generally of use to add-on code directly, it can be used by internal api code to index local storage and other resources that are associated with a particular add-on. ...
... file in the main package (i.e. the package in which you run jpm xpi). while not generally of use to add-on code directly, it can be used by internal api code to index local storage and other resources that are associated with a particular add-on. name this property
contains the add-on's short name. it comes from the name property in the main package's package.json file. version this property
contains the add-on's version string. it comes from the version property set in the package.json file in the main package. loadreason this property
contains of the following strings describing the reason your add-on was loaded: install enable startup upgrade downgrade isprivatebrowsingsupported this property indicates whether or not the add-on supports private browsing. it comes from the private-bro...
url - Archive of obsolete content
; // https userpass the username:password part of the url, null if not present. host the host of the url, null if not present. for example: var url = require("sdk/url").url("https://developer.mozilla.org/add-ons?example=true&visible=yes#top"); console.log(url.host); // developer.mozilla.org port the port number of the url, null if none was specified. path the path component of the url.
contains everything after the host of the url. compare with pathname. for example: var url = require("sdk/url").url("https://developer.mozilla.org/add-ons?example=true&visible=yes#top"); console.log(url.path); // /add-ons?example=true&visible=yes#top hostname the domain of the url, as a string. mirrors window.location.hostname. for example: var url = require("sdk/url").url("https://developer.mozilla.
...rg/add-ons?example=true&visible=yes#top"); console.log(url.search); // ?example=true&visible=yes dataurl methods tostring() returns a string representation of the data url. if base64 is true, the data property is encoded using base-64 encoding. returns string : the url as a string. properties mimetype the mime type of the data. by default is an empty string. parameters an hashmap that
contains the parameters of the data url. by default is an empty object. base64 defines the encoding for the value in data property. data the string that
contains the data in the data url. if the uri given to the constructor
contains base64 parameter, this string is decoded. ...
dev/panel - Archive of obsolete content
the icon to display in the toolbox toolbar, specified as a resource:// url pointing to an icon file, typically in your add-on's "data" directory. you can use the notation "./my-icon.png" as an alias for the url pointing to "data/my-icon.png". mandatory url string a resource:// url pointing to an html file, typically in your add-on's "data" directory. this file
contains the specification of the panel's user interface. you can use the notation "./my-file.html" as an alias for the url pointing to "data/my-file.html". you can't directly manipulate the panel's content from main.js, but you can exchange messages with scripts running in the panel. mandatory tooltip string a string that will be used as a tooltip in the toolbox toolbar. ...
...thod listtabs and the stylesheet actor object has a method getstylesheets. any additional parameters sent in the message become arguments to the method. if a message is expected to get a reply, then the method returns a promise which is fulfilled with the reply. if the message reply in the remote debugging protocol would contain an actor id, then in volcan.js the object that fulfills the promise
contains that actor instance. if the message reply
contains some json object, then in volcan.js the object that fulfills the promise includes a corresponding json object. if an actor can send notifications, as in the request/reply/notify pattern, then the corresponding volcan.js object emits an event, which you can listen for using addeventlistener. any data sent with the notification is available to the...
io/file - Archive of obsolete content
do not exist are also created. mkpath can be called multiple times on the same path. parameters path : string the path to create. open(path, mode) returns a stream providing access to the contents of a file. parameters path : string the path of the file to open. mode : string an optional string, each character of which describes a characteristic of the returned stream. if the string
contains "r", the file is opened in read-only mode. "w" opens the file in write-only mode. "b" opens the file in binary mode. if "b" is not present, the file is opened in text mode, and its contents are assumed to be utf-8. if mode is not given, "r" is assumed, and the file is opened in read-only text mode. apart from these options, this api always passes the following options: create_file, truncate...
...e information on these byte stream objects. opened files should always be closed after use by calling close on the returned stream. read(path, mode) opens a file and returns a string containing its entire contents. parameters path : string the path of the file to read. mode : string an optional string, each character of which describes a characteristic of the returned stream. if the string
contains "b", the contents will be returned in binary mode. if "b" is not present or mode is not given, the file contents will be returned in text mode. returns string : a string containing the file's entire contents. remove(path) removes a file from the file system. to remove directories, use rmdir. parameters path : string the path of the file to remove. rmdir(path) removes a directory from the...
stylesheet/style - Archive of obsolete content
ed can be applied to a content by calling attach, and removed using detach. those functions are part of content/mod module. parameters options : object required options: name type uri string,array a string, or an array of strings, that represents local uri to stylesheet. source string,array a string, or an array of strings, that
contains css rules. those rules are applied after the rules in the stylesheet specified with uri options, if provided. optional options: name type type string the type of the sheet. it accepts the following values: "agent", "user" and "author". if not provided, the default value is "author". style properties source an array of strings that...
...css rules. those rules are applied after the rules in the stylesheet specified with uri options, if provided. optional options: name type type string the type of the sheet. it accepts the following values: "agent", "user" and "author". if not provided, the default value is "author". style properties source an array of strings that
contains the css rule(s) specified in the constructor's option; null if no source option was given to the constructor. this property is read-only. uri an array of strings that
contains the stylesheet local uri(s) specified in the constructor's option; null if no uri option was given to the constructor. this property is read-only. type the type of the sheet. if no type is provided in constructor's opti...
ui/button/action - Archive of obsolete content
you can generate click events programmatically with the button's click() method. disabling buttons you can disable a button by setting its disabled property to true. a disabled button will not generate click events and its icon will appear disabled: updating state you can update all the button's properties except for its id. by default, the button has global s...
... badge. may be a number or a string. the badge can contain as many characters (or digits) as you like, but only the first four will be displayed. badgecolor new in firefox 36. color for the badge, specified as a css <color> value. events click this event is emitted when a user clicks the button or your add-on calls the button's click() method. arguments state : the button's state. this
contains all the button's properties. ...
Bootstrapped extensions - Archive of obsolete content
or disabling an extension requires an application restart. gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) introduces bootstrapped extensions. these are special extensions that, instead of using overlays to apply their user interface to the application, programmatically insert themselves into the application. this is done using a special script file that's included in the extension that
contains functions the browser calls to command the extension to install, uninstall, start up, and shut down. all the application does is call into this script file; the extension is responsible for adding and removing its user interface and handling any other setup and shutdown tasks it requires. this article discusses how bootstrapped extensions work. see this tutorial on converting from an overlay ex...
...r example, you can get access to the menu bar in firefox with document.getelementbyid("main-menubar"). be sure that at shutdown time, you remove any user interface you've added. creating a bootstrapped extension to mark an extension as bootstrappable, you need to add the following element to its install manifest: <em:bootstrap>true</em:bootstrap> then you need to add a bootstrap.js file that
contains the required functions; this should be alongside the install.rdf file in the extension's package. backward compatibility because older versions of firefox don't know about the bootstrap property or bootstrap.js file, it's not overly difficult to create an xpi that will work on both as a bootstrappable extension and as a traditional extension. create your extension as a bootstrappable extension,...
Bookmarks - Archive of obsolete content
ookmarks that link to it, you can use the nsinavbookmarksservice.getbookmarkidsforuri() method. var ios = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); var uri = ios.newuri("http://google.com/", null, null); var bookmarksarray = bmsvc.getbookmarkidsforuri(uri, {}); after executing this code, the array bookmarksarray
contains the ids of all bookmarks that refer to the specified uri (in this case, "http://google.com"). manipulating existing items there are a number of convenient methods you can use to make changes to existing bookmarks and bookmark folders. this section covers some of them. the item title to change the title of a bookmark or bookmark folder, you use the nsinavbookmarksservice.setitemtitle() method.
... uri = ios.newuri("http://mozilla.com/", null, null); if (!bmsvc.isbookmarked(uri)) { bmsvc.insertbookmark(bmsvc.toolbarfolder, uri, bmsvc.default_index, "mozilla"); } this example looks to see if the user already has a bookmark for the mozilla web site, and, if not, creates one, adding it to the user's bookmarks toolbar. finding the folder containing an item if you need to know what folder
contains an item (this can be especially handy after using nsinavbookmarksservice.getbookmarkidsforuri() to find bookmarks for a given uri), you can use the nsinavbookmarksservice.getfolderidforitem() method. var parentfolderid = bmsvc.getfolderidforitem(newbkmkid); observing changes to bookmarks and tags to set up an observer to listen for changes related to bookmarks, you will need to create an nsin...
Miscellaneous - Archive of obsolete content
system info operating system detection // returns "winnt" on windows vista, xp, 2000, and nt systems; // "linux" on gnu/linux; and "darwin" on mac os x. ...
...http://mxr.mozilla.org/mozilla1.8/so...pdates.js#1631 bug 338039 tracks improving this situation by providing a simple method to restart the application. example for firefox: services.startup.quit(services.startup.eforcequit|services.startup.erestart); mouse and keyboard detecting mouse wheel events when scrolling the mouse wheel on an element, the dommousescroll event fires. event.detail
contains the number of lines to scroll. this event is mozilla-only; other browsers may support window.onmousewheel. <div id="scrollarea" style="overflow: scroll; height: 6em; width: 10em;"> this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this is the scrolling area. this ...
Extension Versioning, Update and Compatibility - Archive of obsolete content
an entry must exist with an id matching the id of the application. additionally the minversion and maxversion of this entry must be a range that includes the version of the running application. if the application has a targetapplication entry but it is for an incompatible version then the application will retrieve updated compatibility information from the add-on's updateurl. if the install.rdf
contains any targetplatform entries then the platform of the currently running application must be listed or the installation will be rejected. firefox 3 note in applications based on gecko 1.9 you can also use a targetapplication entry with an id toolkit@mozilla.org and minversion and maxversion that match the toolkit version of the running application. this allows you to say that your add-on will i...
...-on's guid changes by uninstalling the old version and then installing the new one. previously, it was possible to wind up with two copies of the same add-on installed. compatibility updates during the automatic update checks, applications look for both new versions and updated compatibility information about the currently installed version of an add-on. this means that if your update manifest
contains an entry for the currently installed version of the add-on, and the entry's targetapplication entry specifies a larger maxversion then the application will use this value instead of that specified in the add-on's install.rdf. this can cause add-ons that are disabled for being incompatible to become enabled and add-ons that would normally not install to be installed. update rdf format if you hos...
Listening to events in Firefox extensions - Archive of obsolete content
fires. some pages include a fourth step. if a page uses an unload or beforeunload handler, it fires when the user navigates away from the page. if an unload handler is present, the page will not be cached. when a user navigates to a cached page, inline scripts and the onload handler do not run (steps 2 and 3), since in most cases, the effects of these scripts have been preserved. if the page
contains scripts or other behaviors that fire during loading that you want to continue to execute every time the user navigates to the page, or if you want to know when a user has navigated to a cached page, use the new pageshow event. if you have behaviors that fire when a user navigates away from the page, but you want to take advantage of this new caching feature, and therefore don't want to use the u...
...to false if the page is not cached by the browser and set to true if the page is cached by the browser. when this property is set to false, the unload handler, if present, fires immediately after the pagehide event. firefox 1.5 tries to simulate load events in the same order they would occur when the page is initially loaded. frames are treated the same way as the top-level document. if the page
contains frames, then when the cached page is loaded: pageshow events from each frame fire before the pageshow event in the main document fires. when the user navigates away from the cached page, the pagehide event from each frame fires before the pagehide event in the main document. for navigation that occurs inside a single frame, events fire only in the affected frame. web progress listeners fo...
Connecting to Remote Content - Archive of obsolete content
eate this instance using xpcom instead of the usual way (new xmlhttprequest()) because this way works both in chrome and non-chrome code. following initialization, onload and onerror handlers are registered to a callback function to handle the response returned from the remote server. in both cases aevent.target is an nsixmlhttprequest. in the onload callback function, the responsetext parameter
contains the server response as text. if the response is an xml document, the responsexml property will hold an xmldocument object that can be manipulated using dom methods. sometimes the server doesn't specify an xml content-type header, which is necessary for the xml parsing to happen automatically. you can use overridemimetype to force the response to be parsed as xml. request.overridemimetype("text/...
...them into other forms of text output, such as html, xul, and so on. we can not cover all transformations to various output formats, so we'll just look into converting an xml document to xul. first you need to create an xslt stylesheet that acts as a template. this template will transform the xml you receive (in our case, the example xml document above) and convert it into xul. the xslt tutorial
contains details for building these templates. <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <xsl:template match="/data"> <xul:vbox> <xsl:for-each select="shops/name"> <xul:hbox> <xul:label value="name:" /> <xul:labe...
Signing an XPI - Archive of obsolete content
contents of the archive file to a local folder. in my case it's c:\apps\nspr-4.6\ add path add the nss tools bin/ and lib/, and the nspr lib/ directories to the system path. you can either set this permanently via control panel->system properties->advanced->environment variables->system variables or do it each time you run the tools from the command-line (preferably using a batch file). windows
contains its own version of some of these files (e.g. certutil.exe) in the system directory (\windows\system32\) so ensure the new paths are first in the path search list. c:\> set path=c:\apps\nss-3.11.4\bin\;c:\apps\nss-3.11.4\lib\;c:\apps\nspr-4.6\lib\;%path% an easier way is to copy everything from your new directories c:\apps\nss-3.11.4\ and c:\apps\nspr-4.6\ including sub directories to the same ...
... the certificate database. your browser will generate a new private key and code signing request (csr) in the background without you necessarily realising it. the csr will be uploaded to the issuer. later, you must use the same browser when installing the new certificate because the key and certificate pair must be together. hint: when applying for a certificate ensure that the organisation (o)
contains your name and not the issuer's default text, because this is what is displayed to users. for this guide i applied for a free certificate from unizeto certum. after completing the application process where i entered my details into the online application, i received an automated email requesting documentary evidence of my id in the form of a photo-id or similar. i have hi-resolution scanned image...
Adding preferences to an extension - Archive of obsolete content
dialog. please note that if you are using code from this tutorial to add to an existing extension, you must uninstall and reinstall your extension to enable the preferences button for your extension in the add-ons list. establish the defaults in order to set a default preference for the stock to monitor, we need to add a new folder to our extension's package, called "defaults", which in turn
contains another folder called "preferences". inside that, we create a file, defaults.js, that describes the default value of our preferences: pref("extensions.stockwatcher2.symbol", "goog"); the standard for third-party preferences, such as those used in extensions, is to use the string "extensions", a period, the name of the extension, another period, then a preference name, as seen in the example a...
....getcharpref("symbol").touppercase(); this.refreshinformation(); break; } }, the topic parameter indicates what type of event occurred. if it's not nspref:changed, we simply ignore the event, since all we're interested in is changes to the values of our preferences. once we've established that the event is in fact a preference change, we look at the data parameter, which
contains the name of the preference that changed. in our example, we only have one preference, but you can monitor as many preferences as you wish here. if the changed preference is "symbol", we grab the updated value of the preference by calling the nsiprefbranch.getcharpref() method, and stash it in our tickersymbol variable. once we've gotten the updated preference, we call refreshinformation() to im...
Localizing an extension - Archive of obsolete content
hemselves. the preference dialog, whose xul file is options.xul, has a corresponding options.dtd file that looks like this: <!entity options_window_title "stockwatcher 2 preferences"> <!entity options_symbol.label "stock to watch: "> the "options_window_title" entity maps to the string "stockwatcher 2 preferences", which is used as the title of the preference window. the stockwatcher2.dtd file
contains the mappings for the stockwatcher2.xul file: <!entity panel_loading "loading..."> <!entity menu_refresh_now.label "refresh now"> <!entity menu_apple.label "apple (aapl)"> <!entity menu_google.label "google (goog)"> <!entity menu_microsoft.label "microsoft (msft)"> <!entity menu_yahoo.label "yahoo (yhoo)"> update the xul files each xul file needs to reference its corresponding locale file. ...
...ring used in each xul file. update the chrome manifest to let firefox know about the locale files, we need to make a revision to our chrome.manifest file, adding one line for each localization: locale stockwatcher2 en-us chrome/locale/ this instructs firefox that the en-us localization is located in the chrome/locale/en-us directory. localizing strings in javascript code if your javascript code
contains literal strings that need to be localized, as does our stock watcher sample, we need to make those localizable as well. we can do this by moving the strings into a string bundle. string bundles are created by establishing a property file that maps keys to string values. for a detailed explanation of how this works, see xul tutorial:property files. create a properties file the first thing we do is...
Images, Tables, and Mysterious Gaps - Archive of obsolete content
of a line box within a table cell. first a basic line box containing text, shown in figure 3. the most crucial part of figure 3 is the baseline (represented by the blue line), and its placement within the line box. the baseline's exact placement is dependent on the "default" font for the line box (represented by the red box), which is determined by the value of font-family for the element that
contains the line box. it isn't possible for an author to change the baseline's position directly, so wherever it ends up is where it will be. the space below the baseline is referred to as "descender space" since that's where the descenders in lowercase letters like "j", "y", and "q" are drawn. figure 4 shows what happens when we add an image to the mix. note where the image sits by default: its botto...
... the mix. note where the image sits by default: its bottom edge is aligned with the baseline of the line box. this placement can be changed with vertical-align-- we'll talk about that in a bit-- but almost nobody ever changes the value from its default. let's take away the text, and leave only the image, as was done in figure 5. so we have an image sitting on the baseline of a line box that
contains only the image. now consider what happens when we put that line in a table cell (figure 6). and there you have it-- spaces opening up where none have ever been seen before. it gets even worse with small images, like ones that are one pixel tall, as illustrated in figure 7. now there's all kinds of space unexpectedly opening up. it's enough to drive a designer mad. how about a fix? there i...
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
in/ total 4 lrwxrwxrwx 1 root root 64 juil. 2 10:45 thunderbird -> /usr/local/thunderbirddebuglibs/thunderbird-3.0b3pre/thunderbird [root@b008-02 thunderbirddebuglibs]# find /usr/local/thunderbirddebuglibs/ -name prefcalls.js /usr/local/thunderbirddebuglibs/thunderbird-3.0b3pre/defaults/autoconfig/prefcalls.js old mozilla 1.x, possibly netscape 6/7 the following is for the record... it also
contains an interesting feature that i did not use anymore -> autoconfig from a web server! changes between 2002 and 2003, we needed to upgrade the old netscape 4.x (4.79) version to mozilla 1.x (1.4), and now (2004-2005) mozilla 1.7. the autoconfiguration subsystem is quite the same as described the section on 'old' netscape 4.x, but also slightly different. mozilla new features in regard to netscape ...
...()) // unlockpref(name) unlock previously "lockpref"-ed name // config(name, value) usually for menus... // value = getpref(name) gets current setting // getldapattributes(host, base, filter, attributes) // getldapvalue(values, attribute) // .mime.type, .begin_mime_def, .end_mime_def.. // .plat // alert(message); // var = prompt(message); // var = getplatform() returns win32,... // getplatform().
contains("unix")... // var = getenv(envvar) // var = putenv(envvar) // // objects/functions you *can't* use because they aren't defined // navigator.* (argh, this *really* bites) //========================================================================= // preferences configuration //========================================================================= with (prefconfig) { var values = getldapattribut...
Notes on HTML Reflow - Archive of obsolete content
he layout engine's formatting objects are computed. the html formatting objects are called frames : a frame corresponds to the geometric information for (roughly) a single element in the content model; the frames are arranged into a hierarchy that parallels the containment hierarchy in the content model. a frame is rectangular, with width, height, and an offset from the parent frame that
contains it. more than one frame may be needed to represent a single element from the content model; for example, text that wraps is broken into several frames, one per wrapped line. in this case, the primary frame is the frame containing the first line of text, with continuing frames (or continuations ) created for subsequent lines. html uses a flow based layout model,...
...alesced intelligently. a frame that decides it needs a dirty reflow sets the ns_frame_is_dirty state bit on itself, and then calls the reflowdirtychild method on its parent frame. in reflowdirtychild, the parent frame sets the ns_frame_has_dirty_child state bit on itself, and does any bookkeeping necessary to remember which child is dirty (for example, the block frame marks the linebox dirty that
contains the child frame). the parent frame can then either decide to schedule a reflowdirty incremental reflow targeted at itself, or to delegate that responsibility to its parent. if it decides to delegate, then it sets the ns_frame_is_dirty state bit on itself and recursively calls reflowdirtychild. eventually, the reflowdirty incremental reflow is dispatched, and arrives at the container fram...
Using XML Data Islands in Mozilla - Archive of obsolete content
the price of the first line item is " + firstprice + "."; } </script> </head> <body onload="rundemo()";> demo did not run </body> </html> the xml source text can be parsed into a dom tree using the domparser api: var parser = new domparser(); var doc = parser.parsefromstring(ordersource, "application/xml"); the html5 data block-based way shown here works in f...
...the price of the first line item is " + firstprice + "."; } </script> </head> <body onload="rundemo()";> <object id="purchase-order" data="purchase_order.xml" type="text/xml" style="display: none;"></object> <div id="output-box">demo did not run</div> </body> </html> ...
ActiveX Control for Hosting Netscape Plug-ins in IE - Archive of obsolete content
ug-ins. now you can use your plug-ins in any recent version of ie or in any other activex container for that matter. the control itself is implemented in a dll called pluginhostctrl.dll which is standalone from the rest of the mozilla project. if you're wondering how microsoft used to support the np api, look for a file called plugin.ocx in your windows system directory. this 100k activex control
contains the entire np api implementation and probably worked much like pluginhostctrl.dll does now. the sections below tell you how to fetch, build and use the pluginhostctrl.dll . get the source you need cvs to get the source code. assuming you have cvs somewhere in your path, type this from a command prompt: c:\> set cvsroot=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot c:\> set home=\temp c:\> ...
...is is necessary so that your control may coexist with the generic version and any other versions that other plug-ins vendors may have installed. it is advisable to rename the control and not to install somewhere like the windows directory where it is likely to be overridden. use a tool such as guidgen.exe or uuidgen.exe to create the new guids. package it there is a subdirectory named cab/ which
contains a script and a readme.txt for producing your own signed cab files. manual installation assuming you have the precompiled pluginhostctrl.dll and wish to install it on a machine, you must register it either through an install script or manually: regsvr32 pluginhostctrl.dll you must have administrator privileges to install a new control on operating systems such as windows nt, 2000 & xp. usage in...
Making it into a dynamic overlay and packaging it up for distribution - Archive of obsolete content
contents.rdf goes in the content sub-subdirectory: <?xml version="1.0"?> <rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:chrome="http://www.mozilla.org/rdf/chrome#"> <rdf:seq about="urn:mozilla:package:root"> <rdf:l...
... list-style-image: url("chrome://tinderstatus/content/tb-testfailed.png"); } statusbarpanel#tinderbox-status[status="busted"] { list-style-image: url("chrome://tinderstatus/content/tb-busted.png"); } then we need to create two files in the directory, one called contents.rdf which
contains information for the chrome registry about the component being installed and one called install.js that
contains the code to install the component. contents.rdf goes in the content sub-subdirectory: <?xml version="1.0"?> <rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:chrome="http://www.mozilla.org/rdf/chrome#"> <rdf:seq about="urn:mozilla:package:root"> <rdf:li resource="urn:mozilla:package:tinderstatus"/> </rdf:seq> <rdf:description about="urn:mozilla:package:tinderst...
Style System Overview - Archive of obsolete content
the declarations (properties & values) are stored in data structs (nscss*). the data format of the structs and selectors is mostly clear from the code and not worth going into (although the implementation of :not() is confusing). css style rule representation h1, h2...
...s="emph" para: d ↓ ↓ quote: a quote: a ↓ span: e class="emph" the rule tree and style data all of the style structs that can be obtained through a style context add up to around 900 bytes. this is big, and slow to fill in. the rule tree allows sharing. to allow for optimizations, each style struct
contains only inherited properties or only “reset” properties. (thus these structs can be called inherited structs or reset structs.) in the normal case, a style rule has a small number of declarations (hitting only a small number of structs). the rule tree and style data we optimize for the structs for which the rules have no declarations. in this case: inherited structs: same value as parent ...
Using microformats - Archive of obsolete content
er of microformats in a document that match specified criteria. var nummicroformats = microformats.count(name, rootelement, options); parameters name the name of the microformat to count. rootelement required. the dom element at which to begin the search. if you want to search the entire document, specify content.document. options optional. if provided, this is a javascript object that
contains zero or more of the following flags: recurseexternalframes if true, child frames are included in the search. the default is true. showhidden if true, hidden microformats are added; otherwise they're left out. the default is false. debug specify true if debug mode is in use; otherwise, specify false. the default is false. return value an integer value indicating the number of microfo...
...e microformats found that match specified criteria. var microformatsarray = microformats.get(name, rootelement, options, targetarray); parameters name the name of the microformat to find. rootelement required. the dom element at which to begin the search. if you want to search the entire document, specify content.document. options optional. if provided, this is a javascript object that
contains zero or more of the following flags: recurseexternalframes if true, child frames that reference external content are included in the search. the default is true. showhidden if true, hidden microformats are added; otherwise they're left out. the default is false. debug specify true if debug mode is in use; otherwise, specify false. the default is false. targetarray optional. if pro...
JavaScript Client API - Archive of obsolete content
pful to look at an existing sync engine for guidance. have a look at one of the following files: services/sync/modules/engines/bookmarks.js services/sync/modules/engines/history.js setting up a js module the code for your custom sync engine should live in a js module. first off we're going to import the files mentioned above at the top the file. we're also going to import ''util.js'' as it
contains many useful helpers. const cu = components.utils; cu.import("resource://services-sync/engines.js"); cu.import("resource://services-sync/record.js"); cu.import("resource://services-sync/util.js"); the record object the record object is a wrapper around a single instance of whatever data it is that you are syncing -- a single bookmark, history url, password or form data entry. for some sync eng...
...ur engine class serves to tie together your store, tracker, and record classes into a bundle that the sync service can instantiate and use. you're probably sick of writing subclasses by this point, but don't worry: this one is very easy. i saved it for last because it requires the least code. your class must derive from the syncengine class, defined in services-sync/modules/engines.js. syncengine
contains a lot of code which handles logic for the core sync algorithm, but your subclass won't need to call any of this directly, unless you are overriding part of the sync algorithm to provide custom sync behavior (an advanced technique outside the scope of this article). a sample engine class: function fooengine() { weave.syncengine.call(this, "foo"); } fooengine.prototype = { __proto__: weave.sy...
Hidden prefs - Archive of obsolete content
e. the default (defined in mailnews.js) is: pref("mail.addr_book.mapit_url.format", "http://www.mapquest.com/maps/map.adp...st&zipcode=@zi"); addressbook quick search query pref ("mail.addr_book.quicksearchquery.format" ) the format for this pref is: @v == the escaped value typed in the quick search bar in the addressbook every occurance of @v will be replaced. note, the ui has "name or email
contains:". this entity (searchnameoremail.label) is defined in messenger.dtd. so if you change the quick search query to match based on phone number, the ui will not match the query. the default (defined in mailnews.js) is: pref("mail.addr_book.quicksearchquery.format","?(or(primaryemail,c,@v)(displayname,c,@v)(firstname,c,@v)(lastname,c,@v))"); "and", "or" and "not" are valid. see http://lxr.mozilla.o...
... if you change the quick search query to match based on phone number, the ui will not match the query. the default (defined in mailnews.js) is: pref("mail.addr_book.quicksearchquery.format","?(or(primaryemail,c,@v)(displayname,c,@v)(firstname,c,@v)(lastname,c,@v))"); "and", "or" and "not" are valid. see http://lxr.mozilla.org/mozilla/sourc...drdatabase.idl for the list of valid attributes "c" ==
contains. see nsabquerystringtoexpression::createbooleanconditionstring() for other operators. mail composition "other header" pref ("mail.compose.other.header") the format for this a comma delimited list of mail headers, like "approved,x-no-archive" an example for your prefs.js would be: user_pref("mail.compose.other.header", "approved"); this will cause "approved" to show up in the compose window add...
Introducing the Audio API extension - Archive of obsolete content
o-element'); audio.addeventlistener('loadedmetadata', loadedmetadata, false); </script> </body> </html> the mozaudioavailable event as the audio is played, sample data is made available to the audio layer and the audio buffer (size defined in mozframebufferlength) gets filled with those samples. once the buffer is full, the event mozaudioavailable is triggered. this event therefore
contains the raw samples of a period of time. those samples may or may not have been played yet at the time of the event and have not been adjusted for mute or volume settings on the media element. playing, pausing, and seeking the audio also affect the streaming of this raw audio data. the mozaudioavailable event has 2 attributes: framebuffer: framebuffer (i.e., an array) containing decoded audio sam...
... and have not been adjusted for mute or volume settings on the media element. playing, pausing, and seeking the audio also affect the streaming of this raw audio data. the mozaudioavailable event has 2 attributes: framebuffer: framebuffer (i.e., an array) containing decoded audio sample data (i.e., floats) time: timestamp for these samples measured from the start in seconds the framebuffer
contains an array of audio samples. it's important to note that the samples are not separated by channels; they are all delivered together. for example, for a two-channel signal: channel1-sample1 channel2-sample1 channel1-sample2 channel2-sample2 channel1-sample3 channel2-sample3. we can extend the previous example to visualize the timestamp and the first two samples in a <div> element: <!doctype html>...
Microsummary XML grammar reference - Archive of obsolete content
the value of this attribute for them. child elements: <template> (required) defines how to transform pages into their microsummaries. <pages> (required) identifies the set of pages that the generator is able to summarize. <update> (optional) specifies how frequently firefox should update the microsummaries. the <template> element the <template> element
contains the xslt stylesheet which transforms web pages into their microsummaries. attributes: none. child elements: <stylesheet> or <transform> (required) the xslt stylesheet which performs the transformation. per xslt, you may specify the stylesheet child element using either the <stylesheet> or the <transform> tag, which are interchangeable. note: although the <template> element must...
... the <condition> element the optional <condition> element specifies an xpath boolean expression along with a conditional interval of time, in minutes, that must elapse between updates if the expression evaluates to true when evaluated against the page being summarized. it must be a child of the <update> element. attributes: expression (required) an xpath b...
Mozilla Application Framework in Detail - Archive of obsolete content
organization. in addition, if the organization maintains sophisticated, interactive websites, it will already possess a wealth of technical expertise that will be relevant for creating xul applications. in addition to the technologies already mentioned, we go even further by allowing you to even create your own custom interface widgets. don't feel limited by the widgets that the framework already
contains! xbl (extensible binding language) allows you to expand your library of interface elements, and even construct your own xml language for defining your ui. for instance imagine that you wanted to create a chess style game. you could easily create xml elements such as <chessboard> or <chesspiece> and via xbl map these to images and application logic. this is very powerful since you could make impro...
...lla engineers have written and are in the process of refining a new security model for web services that will ease the deployment of applications using web services while maintaining the security of sites inside the user's firewall. more information using the mozilla soap api (an article written for the apple developer connection) xml extras (the home page for the xml extras code module, which
contains mozilla's web services support) soap scripts in mozilla (documentation on soap in mozilla from the engineer who implemented it) xpinstall, mozilla's cross platform installation technology one of the many things that makes the mozilla platform easy for both users and developers is that applications can be installed, extended, or upgraded with simple web page links. the technology that makes this...
Mozilla Crypto FAQ - Archive of obsolete content
president of the united states has periodically issued orders to continue the eaa and ear, exercising authority under the international emergency economic powers act, also known as 50 usc 1701-1706. for more information see 15 cfr part 730, section 730.2 (concerning statutory authority for the ear), and the document "principal statutory authority for the export administration regulations", which
contains copies of the export administration act of 1979 (as amended), the international emergency economic powers act (as amended), and related legislation and executive orders. i thought export of encryption software from the u.s. was governed by the international traffic in arms regulations. what happened to the itar? the itar still exist, but are no longer used in the context of export control of en...
...6, for regulation under the export administration regulations (ear), along with all other export-controlled commercial products. at that time encryption hardware, software, and technology was transferred from the u.s. munitions list to the commerce control list (ccl) of the ear. for more information see the document "principal statutory authority for the export administration regulations", which
contains a copy of executive order 13026. haven't u.s. export controls on encryption software already been ruled unconstitutional? yes in a specific case, but the decision may yet be overruled. also, the case itself may be declared moot in light of the new u.s. encryption export regulations. for several years professor daniel bernstein (currently at the university of illinois at chicago) has pursued a ...
Table Cellmap - Archive of obsolete content
structural data store of the border collapse data the cellmap code is contained in nscellmap.cpp and nscellmap.h this document does currently describe only the quick lookup part of the game, border collapse is still far away cellmap data - overview the entries in the cellmap contain information about the table cell frame corresponding to a given row and column number (celldata.h). further it
contains info whether this entry is a row- or colspan. 79 // this union relies on the assumption that an object (not primitive type) does 80 // not start on an odd bit boundary. if mspan is 0 then morigcell is in effect 81 // and the data does not represent a span. if mspan is 1, then mbits is in 82 // effect and the data represents a span. 83 union { 84 nstablecellframe* morigcell; 85 ...
...roduces overhead as one can not mark in advance the corresponding cells as spanned by the zero spans. the current solution is to use nscellmap::getdataat with a special argument aupdatezerospan to repair the cellmap if it encounters a empty cell (nsnull), by looking for a origin of a zero row- or colspan that spans the queried place in the cellmap. this can produce enormous costs once the cellmap
contains large holes that are not caused by zero spans, this is at least a o2(n) algorithm. the following routines seem to be hot spots performance wise: nscellmap::colhasspanningcells nscellmap::rowhasspanningcells nscellmap::rowisspannedinto users of nscellmap::getdataat outside nscellmap.cpp the border collapse code relies on the cellmap. the collapsing of rows and columns uses the cellmap. a...
Tamarin Build System Documentation - Archive of obsolete content
h slave is shown as a box with a red,green, or yellow color: red means failed, green passed, and yellow has warnings. the phase state is idle or active click on the phase (e.g. ...
... expectedfail or skip expectedfail means the test is run and the assertion is the test fails, if the test passes and is marked expectedfail the test result is unexpectedpass ...
Anonymous Content - Archive of obsolete content
the concept of scope to nodes within a document. because anonymous content elements can also have bindings attached that generate their own anonymous content, this scoping can be taken to an arbitrary level of nesting. explicit content is said to be at the document-level scope. anonymous content nodes are in their own binding-level scopes. binding scopes are determined by the bound element that
contains the binding responsible for the generation of the anonymous nodes. the scope of an element can be determined using the getbindingparent method on the documentxbl interface. see section 3 for more information. this method returns the bound element in the enclosing scope that is responsible for the anonymous node. if invoked on an element at the document-level scope, it returns null. dom methods ...
...d child, then the binding is no longer a fit for the bound element, and all anonymous content will be destroyed. whenever an element is removed, it simply disappears from its insertion point along with all anonymous content that was generated by the element. it is possible to manipulate the 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? perha...
Creating XPI Installer Modules - Archive of obsolete content
mozilla suite and seamonkey (until it gets converted to toolkit). addons for various toolkit applications, such as firefox or thunderbird, should be packaged in a different way. mozilla has introduced major changes to the way that themes and all the other parts of the ui are packaged. this new packaging scheme is called xpi (pronounced "zippy"), and interacts with xpinstall. a xpi file typically
contains the resources to be installed (in this case the barley.jar we want to have installed in the mozilla/bin/chrome/ directory) and an install script that guides the installation process. under the chrome/ directory, you'll notice that in addition to the package subdirectories, there are now also a handful of jar files, or java archives (see figure below). jar is a file format based on the zip file fo...
...er"> <button label="barley corn" /> <button label="show aphids" oncommand="bar();" /> </box> </window> the other files that the window imports are defined in dark blue. note that the stylesheet processing instruction at the top of the xul file does not refer to any new skin, but imports communicator.css to make use of that skin's basic widget styles. the javascript file barley.js
contains a single function, bar(), defined as follows: function bar() { alert("aphids"); } if you want to use the same gif image that is used in the barley package, it can be grabbed from here. while you are developing these resources and before you have made them a package of their own, you can test the basic layout and functionality by opening barley.xul from within mozilla by using file -> open. t...
Using XPInstall to Install Plugins - Archive of obsolete content
messages to feed to the user. you can create an xpinstall file by first zipping all the items you want installed with winzip (create a zip archive) and then renaming it with the xpi file extension instead of the zip file extension. unlike native code installers (for example, files called setup.exe), the programming language for install operations in xpi is javascript. since the file format that
contains the software and the install.js javascript file is a cross-platform file (zip) and since javascript is understood by mozilla browsers on all platforms, often one single xpi package can be deployed on all platforms. this is, in fact, how skins and themes are installed to mozilla browsers, changing their look and feel. this article focuses on how to install plugins. which browsers support xpinsta...
...s failed, and then invoke it again without the "=" string. here is an example: var plid = "myplugin.plug/version=6.5"; err = initinstall(software_name, plid, version); if (err != 0) { // install may have failed because of n6 and = // replace plid with a simple string err = initinstall(software_name, "mypluginstring", version); if (err != 0) cancelinstall(err); } note that above, the plid
contains an "=" and in case the xpi package is running on browsers that treat "=" as an illegal token, the workaround is to handle the error and invoke initinstall again. using xpinstall to run an exe (native code) installer if you wish to run a native installer (exe) to install plugin software, but wish to make the delivery of this native installer streamlined and within the browser's process, then yo...
A XUL Bestiary - Archive of obsolete content
and access chromes independent of the mozilla browser and begins to suggest some possibilities for xul-as-platform beyond the simple restyling of the browser. package a package is in some ways like a chrome, but it is specific to the mozilla architecture. a package is a chunk of interface code that sits in a particular place within mozilla's package hierarchy. like a chrome, that chunk usually
contains xul content, css and graphic skin information, localization strings, and maybe some platform-specific code. the navigator is a package defined in mozilla/bin/chrome/navigator, the mail/news component is a package in mozilla/bin/chrome/mailnews/, and so on. each package directory typically has three subdirectories, content, skin, and locale, in which the xul, css, and localization information are ...
...ss newgifs.gif ... locale/ us-en/ navigator.dtd to load chrome information stored in a new package directory like this, you can use the following chrome url, chrome://navigator/skin/mynewskin/newskin.css which in turn loads the graphics in that subdirectory as needed. skin the skin is the css and graphics that makes up the look or presentation of xul. xul itself
contains very little provision for how widgets are to be presented in the interface. even prior to the skinning that takes place with the global skin, which is loaded in almost every xul file you see in mozilla (and whose absence from your own xul files can make your work look strange, senseless, or invisible altogether), a xul.css file is loaded which provides some very basic presentational information f...
Introduction to XUL - Archive of obsolete content
certain why we have both. "xul" already introduced, is an application of xml used to describe the layout of most windows in the mozilla browser, including and especially the main, browser window. scope this paper makes no attempt to explain requirements. we don't have a current "requirements" document. xptoolkit architecture is a better place to gain an understanding of such things. this paper
contains a short introduction to mozilla front-end architecture, concentrating on the task of building uis. it is, as always, incomplete. mozilla applications will be built of "small" components like dialog buttons and mail inbox folders, which we collectively term "widgets." within a widget, drawing and user interactions are completely under control of the individual widget, and set when the widget was ...
...ied to individual elements in xul using the same # syntax that is possible for html elements. #main-window { display: block; width: 100%; height: 100%; } for example, the above style rule would apply to the main window and dictates that the window should consume the full width and height available to it in a content area. the next element in the example declares the menubar. the menubar
contains a single menu called "file". this menu
contains a single menu item that has a simple javascript onclick handler attached to it. this handler fires when the menu is selected by the user, and it dumps the text "hello world!" to the debug console. (see menu bars and menus for details.) finally there is an html iframe. note that the frame is qualified with the prefix html:, since it is an html objec...
Namespaces - Archive of obsolete content
to quote wikipedia: "in general, a namespace is an abstract container providing context for the items ... ...
...xtbox/> instead of <xul:textbox/> in xul (although the latter is just as correct when not using http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul as the default namespace) -- the xul namespace is defined as the default on the topmost element. in other words, a default namespace permits a kind of short-hand to be used for all descendants of an element. here's a question: what namespace
contains the element foo in the xml document below? <foo/> the answer is that it's in no namespace, or alternately, it's in the namespace denoted by the empty string: <foo xmlns=""/> this second example is semantically equivalent to the first. now, a second question: what namespaces are the bar, baz, and quux attributes in? <foo bar="value"> <element xmlns="namespace!" baz="value"> <elem...
Using Recursive Templates - Archive of obsolete content
nt"><label value="cleopatra"/></vbox> <vbox id="row8" class="indent"><label value="laura secord"/></vbox> </vbox> </groupbox> note how similar content corresponding to the action body is created for both the groups as well as the people. the template builder has also added container and empty attributes to the groups. this is done with all nodes that have children to indicate that the node
contains generated children as well as whether the node is empty. these hints are used for trees, but they can also be used in a stylesheet to provide a different appearance for containers with children, empty containers, as well as non-containers. in this example, both the parent groups and child people are displayed the same. you could use multiple rules as well, in order to generate different output fo...
...as the type is bound to the local name of the result node, this will match only the first level of results from the xml data, that is, those with the group tag. the second rule has no where conditions, so this matches all remaining results. the output for groups is a groupbox with a caption containing the name. the output ...
Adding Methods to XBL-defined Elements - Archive of obsolete content
the general syntax of methods is as follows: <implementation> <method name="method-name"> <parameter name="parameter-name1"/> <parameter name="parameter-name2"/> . . . <body> <-- method script goes here --> </body> </method> </implementation> a method declaration goes inside the implementation element, like the fields and properties do. the method element
contains two type of child elements, parameter elements which describe the parameters to the method and body which
contains the script for the method. the value of the name attribute becomes the name of the method. similarly, the name attributes on the parameter elements become the names of each parameter. each parameter element is used to declare one parameter for the method. for example, if the method ...
...tribute becomes the name of the method. similarly, the name attributes on the parameter elements become the names of each parameter. each parameter element is used to declare one parameter for the method. for example, if the method had three parameters, there would be three parameter elements. you do not need to have any though, in which case the method would take no parameters. the body element
contains the script that is executed when the method is called. the names of the parameters are defined as variables in the script as if they had been passed as parameters. for example, the following javascript function would be written as an xbl method like so: function getmaximum(num1,num2) { if (num1 <= num2) return num2; else return num1; } xbl: <method name="getmaximum"> <parameter name="num...
Creating a Wizard - Archive of obsolete content
after the last page, the operation is carried out. xul provides a wizard element which can be used to create wizards. ...
...after the last page, the operation is carried out. xul provides a wizard element which can be used to create wizards. ...
Creating an Installer - Archive of obsolete content
all install functions which will indicate which files from the archive should be installed. once the script is complete, the new package has been installed. if multiple packages are being installed, their scripts will run in sequence. install triggers as indicated above, the install process is started by an install trigger. this involves the use of the special global object installtrigger. it
contains a number of methods which can be used to start an installation. you can use this object in local or remote content, meaning that it is suitable for a download from a web site. let's create an example install trigger. this involves the use of the function installtrigger.install(). this function takes two arguments, the first is a list of packages to install, and the second is a callback function ...
... a javascript file which is executed during the installation. the remaining files are the files to be installed. these files will typically be placed inside a directory in the archive but they do not have to be. for chrome files, they might be structured like the chrome directory. often, the only files placed in an xpi archive will be the install script (install.js) and a jar file. this jar file
contains all of the files used by your application. the components provided with mozilla are stored in this manner. because the xpi file is just a special zip file, you can create it and add files to it using a zip utility. our find files example for the find files dialog, we'll create a structure in the archive much like the following: install.js findfile content contents.rdf findfile.xul ...
Element Positioning - Archive of obsolete content
ents, and no larger. some elements, such as textboxes have a default size, which will be used. a box will be large enough to hold the elements inside the box. a horizontal box with three buttons in it will be as wide as the three buttons, plus a small amount of padding. in the image, the first two buttons have been given a suitable size to hold their text. the third button is larger because it
contains more content. the width of the box containing the buttons is the total width of the buttons plus the padding between them. the height of the buttons is a suitable size to hold the text. width and height attributes you may need to have more control over the size of an element in a window. there are a number of features that allow you to control the size of an element. the quick way is to simply ...
...l="no"/> </hbox> <hbox align="center"> <button label="maybe"/> <button label="perhaps"/> </hbox> </window> you can also use the style properties -moz-box-pack and -moz-box-align instead of specifying attributes. you may find the box alignment example useful for trying out the various box properties. cropping text and buttons you could potentially create a button element that
contains a label that is larger than the maximum width of the button. of course, a solution would be to increase the size of the button. however, buttons (and other elements with a label) have a special attribute called crop that allows you to specify how the text may be cropped if it is too big. if the text is cropped, an ellipsis (...) will appear on the button where the text was taken out. four possib...
Groupboxes - Archive of obsolete content
however, there are several differences between groupboxes and regular boxes: the groupbox can be labeled using the caption element. ...
...> <checkbox label="enable backups"/> </caption> <hbox> <label control="dir" value="directory:"/> <textbox id="dir" flex="1"/> </hbox> <checkbox label="compress archived files"/> </groupbox> in this example, a checkbox has been used as a caption. we might use a script to enable and disable the contents of the groupbox when the checkbox is checked and unchecked. the groupbox
contains a horizontal box with a label and textbox. both the textbox and groupbox have been made flexible so the textbox expands when the window is expanded. the additional checkbox appears below the textbox because of the vertical orientation of the groupbox. we'll add a groupbox to the find files dialog in the next section. radio groups you can use the radiogroup element to group radio elements together...
Install Scripts - Archive of obsolete content
pt code which calls a number of install functions. in an html document, or a xul document, the window object is the root global object. that means that you can call the methods of the window object with the qualifier before it, which means that window.open() can simply be written open(). in an install script, there is no associated window, however the global object will be an install object which
contains a number of functions to customize the install process. some of the install object's functions will be described below. the install script should take the following steps: initialize the installation by specifying what package and version is being installed. use the install functions to indicate what files and directories need to be installed. you can also set files to be moved and deleted. ...
...s multiple times to install other files. next, we'll want to register the find files in the chrome system so that it can be used with a chrome url. this can be done with the registerchrome() function. it takes two arguments, the first is the type of chrome to register (content, skin or locale). the second is the directory containing the contents.rdf file to register. because the find files dialog
contains content, a skin file and a locale file, registerchrome() will need to be called three times. registerchrome(install.content | install.delayed_chrome, getfolder(finddir, "content")); registerchrome(install.skin | install.delayed_chrome, getfolder(finddir, "skin")); registerchrome(install.locale | install.delayed_chrome, getfolder(finddir, "locale")); the delayed_chrome flag is used to indicate th...
Introduction to XBL - Archive of obsolete content
he styles. the basic appearance of all elements, such as scroll bars and check boxes may be modified by adjusting the style or by setting attributes on the element. however, xul provides no means in which you can change how an element works (or add a new element which can be reused). for example, you might want to change how the pieces of a scroll bar function. for this, you need xbl. an xbl file
contains a set of bindings. each binding describes the behavior of a xul widget. for example, a binding might be attached to a scroll bar. the behavior describes the properties and methods of the scroll bar in addition to describing the xul elements that make up a scroll bar. like xul, xbl is an xml language, so it has similar syntax rules. the following example shows the basic skeleton of an xbl file: <?
...each binding element declares a single binding. the id attribute can be used to identify the binding, as in the example above. the template has two bindings, one called binding1 and the other called binding2. one might be attached to a scroll bar and the other to a menu. a binding can be attached to any xul element. if you use css classes, you can use as many differe...
XUL FAQ - Archive of obsolete content
other faqs you may be interested in: extension faq, ... if your question is not answered here, you can try looking for the answer in the xul documentation or ask in the xul newsgroup. are there decent visual editors for laying out xul applications? there are no production-quality visual editors available for xul. the recommended way is to edit xul by hand, possibly with the help of a good text or xml editor. ted mielczarek's live xul editor (also part of extension developer's extension) often proves useful. a list of projects (dead and active) aiming to create a xul ide/editor is at wikimo:xul:ide. ...
...ons windows this ought to be on a separate page, preferences system troubleshooting. it is a faq. some things to check when you have issues with your prefwindow-based options window: does each prefpane have a unique id? are there any elements inside the <prefwindow>, before the <prefpane>s? (putting any elements there triggers bug 296418.) are prefpanes nested correctly? does each prefpane
contains a <preferences></preferences> block, even if empty? are script tags in prefpanes closed properly? does script outside <prefpane> refer to any element in <prefpane>? (the animation effect when you open the preference window will not stop, if a script outside <prefpane> refers any element inside <prefpane>, while initializing the window. if you want to access elements inside <prefpane>, you shoul...
XUL element attributes - Archive of obsolete content
the order they appear in the xul code. reverse for scales, the scale's values are ordered from right to left (for horizontal scales) or from bottom to top (for vertical scales). for other elements, they are placed right to left or bottom to top. this is reverse of the order in which they appear in the xul code. empty type: boolean set to true if the element is a container that
contains no children. this will be set by the template builder as needed. equalsize type: one of the values below this attribute can be used to make the children of the element equal in size. always for a horizontally oriented element, this will make all of its children have the width of the widest child. for a vertically oriented element, this will make its children all have the height of ...
...t for a moment. the tooltip will automatically disappear when the mouse is moved. if this attribute is set to '_child', the first tooltip child element inside the element is used. tooltiptext type: string used to set the text which appears in the tooltip when the user moves the mouse over the element. this can be used instead of setting the tooltip to a popup for the common case where it
contains only text. the tooltip is displayed in a default tooltip which displays only a label, however the default tooltip may be changed by setting the default attribute on a tooltip element. top type: string (representing an integer) for elements placed directly within a stack, specifies the pixel position of the top edge of the element relative to the top edge of the stack. uri type: s...
iframe - Archive of obsolete content
tion, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties accessibletype type: integer a value indicating the type of accessibility object for the element. ...
...ype type: integer a value indicating the type of accessibility object for the element. contentdocument type: document this read-only property
contains the document object in the element. contentwindow type: todo use the contentwindow.wrappedjsobject to obtain a dom(html) window object docshell type: nsidocshell this read-only property
contains the nsidocshell object for the document. webnavigation type: nsiwebnavigation this read-only property
contains the nsiwebnavigation object for the document. most of its methods are callable directly on the element itself, such as goback and goforward. it also
contains the load constants used by reloadwithflags and loaduriwithflags. methods inherited methods addeventl...
menulist - Archive of obsolete content
attributes accesskey, crop, disableautoselect, disabled, editable, focused, image, label, oncommand, open, preference, readonly, sizetopopup, tabindex, value properties accessibletype, crop, description, disableautoselect, disabled, editable, editor, image, inputfield, itemcount, label, menuboxobject, menupopup, open, selectedindex, selecteditem, tabindex, value methods appenditem,
contains, getindexofitem, getitematindex, insertitemat, removeallitems, removeitemat, select examples <menulist> <menupopup> <menuitem label="option 1" value="1"/> <menuitem label="option 2" value="2"/> <menuitem label="option 3" value="3"/> <menuitem label="option 4" value="4"/> </menupopup> </menulist> attributes accesskey type: character this should be set to a char...
...butenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata appenditem( label, value, description ) return type: element creates a new menuitem element and adds it to the end of the menulist. you may optionally set a value and description. the function returns the new item.
contains( item ) return type: boolean returns true if the menulist
contains the specified menuitem as one of its items. getindexofitem( item ) return type: integer returns the zero-based position of the specified item. items are numbered starting at the first item displayed in the list. getitematindex( index ) return type: element returns the element that is at the specified index. inse...
stringbundle - Archive of obsolete content
ame %s is already being used by another account. more information is available in the xul tutorial. the "src" attribute accepts only absolute chrome:// urls (see bugs 133698, 26291) attributes src properties applocale , src, stringbundle, strings methods getformattedstring, getstring examples (example needed) attributes src type: uri the uri of the property file that
contains the localized strings. inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, pop...
...bject which holds information about the user's locale. this is an object which implements nsilocale. src type: url gets and sets the value of the src attribute. stringbundle type: nsistringbundle returns the xpcom string bundle object which implements nsistringbundle. strings type: nsisimpleenumerator an enumeration of all of the strings in the string bundle. the enumeration
contains nsipropertyelement objects. methods getformattedstring( key, strarray ) return type: string looks up the format string for the given key name in the string bundle and returns a formatted copy where each occurrence of %s (uppercase) is replaced by each successive element in the supplied array. alternatively, numbered indices of the format %n$s (e.g. %1$s, %2$s, etc.) can be used to specify ...
toolbar - Archive of obsolete content
it is a type of box that defaults to horizontal orientation. it can be collapsed with a grippy when the toolbar is placed inside a toolbox. the toolbar should always have an id attribute. note: gecko 2.0 adds support for external toolbars. these are toolbars that are not children of a toolbox element. you can associate an external toolbar with a toolbox for the purpose of managing your toolbars by setting the toolboxid property on the toolbar. ...
...ed and the specified resource is loaded into its browsing context.">window.open() method. more information is available in the xul tutorial. note: starting in gecko 1.9.1, toolbar items are moved from the toolbarpalette and added to the toolbar when a toolbar is first displayed. in earlier versions, a copy of each item was created and placed on the toolbar. this means that the palette now only
contains items not already in the toolbar. this introduces a potential compatibility problem for extensions that depend on being able to identify all possible toolbar items by looking in the toolbarpalette. attributes autohide, currentset, customindex, customizable, defaultset, grippyhidden, grippytooltiptext, height, iconsize, mode, toolbarname properties accessibletype, currentset, firstperman...
tree - Archive of obsolete content
onselect type: script code this event is sent to a tree when a row is selected, or whenever the selection changes. the user can select multiple rows by holding down shift or control and clicking on a row. the onselect event will be sent for each item added to or removed from the selection. rows type: integer the number of rows to display in the element. if the element
contains more than this number of rows, a scrollbar will appear which the user can use to scroll to the other rows. to get the actual number of rows in the element, use the getrowcount method. seltype type: one of the values below used to indicate whether multiple selection is allowed. single only one row may be selected at a time. (default in listbox and richlistbox.) multiple multipl...
... row will be highlighted. 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 tr...
treeitem - Archive of obsolete content
in a template condition, you should use a treeitem instead of a content element when the dont-build-content flag is specified. ...
...s available in the xul tutorial. attributes container, empty, label, open, uri examples (example needed) attributes container type: boolean set to true if the element is to act as a container which can have child elements. this would be used for folders. this will be set by the template builder as needed. empty type: boolean set to true if the element is a container that
contains no children. this will be set by the template builder as needed. label tipo: string (concatenación de caracteres) para un árbol tree con columnas simples, la etiqueta puede ser colocada directamnete sobre el elemeto "treeitem" sin la necesidad de una fila "row" y un elemento "treeitem" dentro. open type: boolean for the menu type buttons, the open attribute is set to true...
where - Archive of obsolete content
e elements. attributes ignorecase, multiple, negate, rel, subject, value examples (example needed) attributes ignorecase type: boolean set to true to indicate that the case does not matter when making comparisons. otherwise, the default value is false, to indicate that the value should match with the same case. multiple type: boolean set to true to indicate that the value
contains multiple values separated by commas. any of the values may match. otherwise, the entire value string is compared. negate type: boolean set to true to indicate that the comparison should be reversed. the where clause matches if the condition is false, and does not match if the condition is true. rel type: one of the values below the type of comparison to perform. equals t...
... value type: string the value to compare. inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, heigh...
Application Update - Archive of obsolete content
ered timers should be checked (in milliseconds) // default=5 seconds pref("app.update.timer", 600000); // whether or not we show a dialog box informing the user that the update was // successfully applied. this is off in firefox by default since we show a // upgrade start page instead! other apps may wish to show this ui, and supply // a whatsnewurl field in their brand.properties that
contains a link to a page // which tells users what's new in this new update. pref("app.update.showinstalledui", false); // 0 = suppress prompting for incompatibilities if there are updates available // to newer versions of installed addons that resolve them. // 1 = suppress prompting for incompatibilities only if there are versioninfo // updates available to installed addons that resolve them, n...
... required (yet). update.xml the format is outlined here process as best i can tell here's how the update process works. at the scheduled interval the application checks the update server for update.xml, search for the correct one using the software name, versions, build id's, channels, and other information like locales. if the update.xml file doesn't exist there is no update. update.xml
contains only information about the update. it points to the update mar file (a mozilla archive) which
contains all files which are going to be updates it also
contains a sha1 hash and file size used for verification of the update. if an update file is found that correctly describes an update your application, or rather xulrunner, will download the update, verify it with the hash and filesi...
XULRunner tips - Archive of obsolete content
extension manager to be able to install any extensions, you first need to enable the extension manager in application.ini. xulrunner 1.8.0 does not load extensions from the application directory; only the xulrunner directory and the user profile directory are checked. however, it seems that with xulrunner 1.9 the xulrunner directory is ignored, while the profile and application directories are checked. ...
...ok in your application window to start dom inspector, like this one: <button label="start inpector" oncommand="startdomi()"/> start your application and dom inspector will be installed. note: i use this method of installing extensions into all of my mozilla applications. this way i have one directory where i keep all my mozilla extensions, and each application (firefox, thunderbird) simply
contains a few small, one line files pointing to the location of the extensions. (i keep them in source control to be sure i can maintain compatibility) component viewer need custom build, first of all. what else? extension developer's extension extension developer's extension is a useful tool, featuring live xul editor and javascript shell. to install the extension into your application you'll need t...
Archived Mozilla and build documentation - Archive of obsolete content
rojects. activex control for hosting netscape plug-ins in ie microsoft has removed support for netscape plug-ins from ie 5.5 sp 2 and beyond. if you are a plug-in author, you may find this project saves you a lot of work! ant script to assemble an extension this ant script helps to package an extension archived spidermonkey docs this section
contains old spidermonkey documentation. autodial for windows nt this document is intended to explain how the autodial helper feature implemented for bug 93002 works and why it works that way. automated testing tips and tricks automatic mozilla configurator ankh8 automatically handle failed asserts in debug builds as of 20...
...for testing. if you go to your user preferences, you can change the skin to "devmo". this is currently just a preview, but we would appreciate help with testing. plug-n-hack plug-n-hack (pnh) is a proposed standard from the mozilla security team for defining how security tools can interact with browsers in a more useful and usable way. plugin architecture this page
contains some notes on how plugins work internally in gecko. it is mainly of interest to gecko developers. porting nspr to unix platforms last modified 16 july 1998 priority content update: i've removed documents from this list that have been migrated into the wiki. the list of completed documents is available through the devedge page. prism prism ...
NPP_New - Archive of obsolete content
in api summary creates a new instance of a plug-in. syntax #include <npapi.h> nperror npp_new(npmimetype plugintype, npp instance, uint16 mode, int16 argc, char *argn[], char *argv[], npsaveddata *saved); parameters the function has the following parameters: plugintype pointer to the mime type for new plug-in instance. instance
contains instance-specific private data for the plug-in and the browser. this data is stored in instance->pdata. mode display mode of plug-in. values: np_embed: (1) instance was created by an embed tag and shares the browser window with other content. np_full: (2) instance was created by a separate file and is the primary content in the window. argc number of html arguments in the embe...
...ed to the plug-in from the embed tag. argv[] array of attribute values passed to the plug-in from the embed tag. saved pointer to data saved by npp_destroy for a previous instance of this plug-in at the same url. if non-null, the browser passes ownership of the npsaveddata object back to the plug-in. the plug-in is responsible for freeing the memory for the npsaveddata and the buffer it
contains. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. description npp_new creates a new instance of a plug-in. it is called after np_initialize and is passed the mime type, embedded or full-screen display mode, and, for embedded plug-ins, information about html embed arguments. a new instan...
NPP_SetWindow - Archive of obsolete content
api summary tells the plug-in when a window is created, moved, sized, or destroyed. syntax #include <npapi.h> nperror npp_setwindow(npp instance, npwindow *window); parameters the function has the following parameters: instance pointer to the current plug-in instance. must be embedded or full-screen. window pointer to the window into which the instance draws. the window structure
contains a window handle and values for top left corner, width, height, and clipping rectangle (see note on unix below). returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. description the browser calls npp_setwindow after creating the instance to allow drawing to begin...
...pp_setwindow indicate changes in size or position; these calls pass the same npwindow object each time, but with different values. if the window handle is set to null, the window is destroyed. in this case, the plug-in must not perform any additional graphics operations on the window and should free any associated resources. the data structure passed in npp_setwindow is an npwindow object, which
contains the coordinates of the instance's area and various platform-specific data. this window is valid for the life of the instance, or until npp_setwindow is called again with a different value. for windowed plug-ins on windows and unix, the window parameter
contains a handle to a subwindow of the browser window hierarchy. on mac os, this field points to an np_port structure. for windowless plug-ins, ...
NPSavedData - Archive of obsolete content
ata { int32 len; void* buf; } npsaveddata; fields the data structure has the following fields: len length in bytes of the buffer pointed to by buf; set by the plug-in. buf pointer to a memory buffer allocated by the plug-in with npn_memalloc(). can be any reasonable size; its contents are private to the plug-in and are not modified by the browser. description the npsaveddata object
contains a block of per-instance information that the browser saves after the instance is deleted. this information can be returned to another instance of the same plug-in if the user returns to the web page that
contains it. you can use the plug-in's npp_destroy() function to allocate an npsaveddata object using the npn_memalloc() function, fill in the fields, and return it to the browser as an output pa...
...o another instance of the same plug-in if the user returns to the web page that
contains it. you can use the plug-in's npp_destroy() function to allocate an npsaveddata object using the npn_memalloc() function, fill in the fields, and return it to the browser as an output parameter. see instance destruction for a code example that shows how to use npsaveddata. if the user revisits a web page that
contains a plug-in, the browser returns the npsaveddata to the new instance of the plug-in in a call to npp_new(). after this, the plug-in is responsible for keeping or deleting the objects as necessary. see also npp_new() npp_destroy() ...
Adobe Flash - Archive of obsolete content
machine (see bug 32048 and bug 233533). in example 2, a javascript function first obtained a handle to the html that spawned the plugin (the object element or the embed element) and then called a published method of the flash plugin on the reference to the html element. with fscommands, developers may choose to use macromedia's actionscript language to make a call back into the environment that
contains the flash animation -- in this case, the html page. the example below shows both types of communication in action: example 3: javascript to flash communication and fscommands -- flash to javascript communication the example is missing. in example 3, clicking the html button causes a ball to move in the flash animation. this exemplifies javascript to flash communication. by clicking the html b...
...mplifies javascript to flash communication. by clicking the html button, you trigger a javascript event that further triggers actions within the flash animation. below that, you can change the color of the entire html page by clicking a colored tab. this shows communication flowing in the other direction -- namely, an action taken within the flash animation affects something in the html page that
contains the flash animation. example 3 shows fscommands in action. if you are embedding a flash animation and wish to use fscommands in netscape gecko browsers, currently you must use the embed element and not the object element. you can always nest the embed element within the object element that you serve to ie. future flash versions may support the object element for use with fscommands in netscape g...
Shipping a plugin as a Toolkit bundle - Archive of obsolete content
supported and plugins must either be shipped as an executable installer or in a bundle as described here. bundle structure toolkit bundles can be used for all add-ons including extensions, themes and plugins. plugin packages should only need to package a small set of files in the following structure in the xpi file: install.rdf plugins/ pluginlib.dll plugintypes.xpt the install.rdf file
contains an install manifest that describes the plugin to the user. the library and scripting interfaces are held in the plugins directory. platform-specific files gecko 1.9.2 (firefox 3.6) and earlier prior to gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1), it was possible to package multiple plugin libraries for different operating systems into a single xpi bundle. in the xpi you can use the fo...
... every add-on must have a unique id. this can be in a guid form but the simpler email form is preferred now. you should aim to use a domain-name that you own and then your own unique short-name for the plugin before the @. the plugin must have a name to identify the plugin to the user in the list of add-ons. the version is fairly self-descriptive, it must be a...
Vulnerabilities - Archive of obsolete content
vulnerabilities are caused by the software designer making trust assumptions that permit the software to provide beneficial features, while also introducing the possibility of someone violating the trust assumptions to compromise security. for example, email client software may contain a feature that renders html content in email messages. an attacker could craft a fraudulent email message that
contains hyperlinks that, when rendered in html, appear to the recipient to be benign but actually take the recipient to a malicious web site when they are clicked on. one of the trust assumptions in the design of the html content rendering feature was that users would not receive malicious hyperlinks and click on them. software feature misuse vulnerabilities are introduced during the design of the softw...
...ing aware of a security weakness and determining that a separate security control would compensate for it. however, trust assumptions are often implicit, such as creating a feature without first evaluating the risks it would introduce. threats may also change over the lifetime of software or a protocol used in software. for example, the address resolution protocol (arp) trusts that an arp reply
contains the correct mapping between media access control (mac) and internet protocol (ip) addresses. the arp cache uses that information to provide a useful service—to enable sending data between devices within a local network. however, an attacker could generate false arp messages to poison a system’s arp table and thereby launch a denial-of-service or a man-in-the-middle attack. the arp protocol w...
Table Reflow Internals - Archive of obsolete content
the initial chunk of an xml doc is loaded. the initial chunk of an html doc (or a subsequent chunk of an xml doc) is loaded. the container posts a dirty reflow command with itself as the target. content is inserted, appended, or deleted through the dom. the container posts a dirty reflow command with itself as the target. ...
... when the pres shell processes its queue of reflow commands. the reflower positions reflowee (if it can) before actually reflowing in case views are involved (e.g. absolutely positioned elements) reflows reflowee and passes a reflow state (in) and a reflow metrics (in/out) review of reflow the reflow state: is a node in a tree structurally equivalent to the frame tree of reflow participants
contains: reflow type, avail size, various computed values, resolved style structs possible request for preferred size and more. review of reflow the reflow metrics
contains: max element size (if requested) - the minimum size it can be preferred size (if requested) - the size it would like to be given no size constraints. desired size - the size it would like to be given the avail size. this is eq...
Theme changes in Firefox 2 - Archive of obsolete content
firefox 2 add-ons manager. mozapps/extensions/itemdisabledfader.png new file; a translucent png used as an overlay on top of items that are disabled in the add-ons manager. mozapps/extensions/itemenabledfader.png new file; a translucent png used as an overlay on top of items that are enabled in the add-ons manager. mozapps/extensions/notifybadges.png new file;
contains the icons used ito badge the icons for add-ons in the add-on manager window to indicate their status. these look like this in the default theme: the first icon (green here) indicates that an add-on has an update available. the second icon (yellow here)appears to be used for blocklisted items; trying to confirm. the third icon (red here) indicates that an add-on is disabl...
...file; used in the add-ons manager when you check for updates. if no updates are found, this icon is displayed at the left side of the message strip that appears across the top of the window. mozapps/extensions/update.css this file, which skins the firefox update wizard, has fewer styles in it due to the redesigned update wizard. mozapps/extensions/viewbuttons.png new file;
contains icons for each of the views that may be available in the add-ons manager. in the default theme, these look something like this: the top row
contains dimmed versions of the icons below them. the first icon is for the extensions view. the second is for themes. the third is for locales, the fourth is for plugins, the fifth is for updates, and the sixth is for installs. mozapps...
-ms-filter - Archive of obsolete content
ilter or collection of filters applied to an object. warning: not to be confused with the standard filter property, as the two are fundamentally incompatible with each other. important: as of windows internet explorer 9 this feature was deprecated. as of internet explorer 10 this feature was removed and should no longer be used. ...
...refer to the filters and transitions reference for details. examples the following example shows how to use the -ms-filter attribute in internet explorer 8. code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/filter_8.htm -ms-filter: 'progid:dximagetransform.microsoft.motionblur(strength=50), progid:dxim...
JavaPackage - Archive of obsolete content
t reference to a java package. created by a reference to the package name used with the packages keyword: packages.javapackage javapackageis the name of the object's java package. if the package is in the java, netscape, or sun packages, the packages keyword is optional. description in java, a package is a collection of java classes or other java packages. for example, the netscape package
contains the package netscape.javascript; the netscape.javascript package
contains the classes jsobject and jsexception. in javascript, a javapackage is a reference to a java package. for example, a reference to netscape is a javapackage. netscape.javascript is both a javapackage and a property of the netscape javapackage. a javaclass object is a reference to one of the classes in a package, such as net...
...cript.jsobject. the javapackage and javaclass hierarchy reflect the java package and class hierarchy. although the packages and classes contained in a javapackage are its properties, you cannot use a for...in statement to enumerate them as you can enumerate the properties of other objects. properties the properties of a javapackage are the javaclass objects and any other javapackage objects it
contains. examples suppose the redwood corporation uses the java redwood package to contain various java classes that it implements. the following code creates the javapackage red: var red = packages.redwood; see also javaarray, javaclass, javaobject, packages ...
Writing JavaScript for XHTML - Archive of obsolete content
ally no point to commenting out your scripts -- no browser written in the last ten years will display your code on the page. the easy solution is to do away with the commenting entirely: <script type="text/javascript"> window.alert("hello world!"); </script> this will work so long as your code doesn't contain characters which are "special" in xml, which usually means < and &. if your code
contains either of these, you can work around this with cdata sections: <script type="text/javascript"> <![cdata[ // is the variable a non-negative integer less than 10? if (variable < 10 && variable >= 0) action(); ]]> </script> note that the cdata section is only necessary because of the < in the code; otherwise you could have ignored it. a third solution is to use only external script...
... into e4x. finally: content negotiation now, how do we decide, when to serve xhtml as xml? we can do this on server side by evaluating the http request header. every browser sends with its request a list of mime types it understands, as part of the http content negotiation mechanism. so if the browser tells our server, that it can handle xhtml as xml, that is, the accept: field in the http head
contains application/xhtml+xml somewhere, we are safe to send the content as xml. in php, for example, you would write something like this: if( strpos( $_server['http_accept'], "application/xhtml+xml" ) ) { header( "content-type: application/xhtml+xml" ); echo '<?xml version="1.0" ?>'."\n"; } else { header( "content-type: text/html" ); } this distinction also sends the xml declaration, which is ...
Troubleshooting XForms Forms - Archive of obsolete content
r file directly from the filesystem, make sure that has .xhtml or .xml as the file ending. if you are loading the form from a server, make sure that it serves the files as either application/xhtml+xml or text/xml. check the xhtml 1.0 namespace declaration mozilla xforms is built upon the xhtml 1.0 specification, which is located at http://www.w3.org/1999/xhtml . ensure that your <html> element
contains the supported namespace declaration: xmlns="http://www.w3.org/1999/xhtml" (instead of the newer, unratified version, xhtml 2.0, located at http://www.w3.org/2002/06/xhtml2 ) inline instance, no controls get bound have you remembered to use the correct namespace for the instance nodes? for an inline instance you most probably need to have <xf:instance xmlns=""> .... any instance, no controls...
...ance is not in the empty namespace (xmlns=""), then all binding expressions must use a prefix bound to the namespace. xpath 1.0 expressions do not have a default namespace, so a prefix must always be specified if the namespace is not the empty namespace. if your binding expression starts with a /, make sure the first thing is the name of the root node of the instance. if your binding expression
contains a /, look for any containing xf:group, xf:repeat, xf:input or other elements that set the context node. instance(...) not working be aware that the instance(...) returns an element node, and not the document node. so with an instance like this: <xf:instance id="ins2" xmlns=""> <data> <value>42</value> </data> </xf:instance> you should use <output ref="instance('ins2')/value...
Requests For Enhancement - Archive of obsolete content
team's attention to an enhancement request you are promoting is to vote for the bug that is related with the feature request (if there is no bug yet then please feel free to file it). then you can give a vote by clicking on the 'vote' link on the bug page. the xforms team looks at votes to help determine which bug is more important for our xforms users. rfe categories xforms api this section
contains rfe to the xforms api. custom controls i think that xforms is a great way to show that 14 year old html hacks can build really powerful web apps and reduce the need for javascript by 90%. now we need to start teaching xforms to web newcomers before they are brainwashed into believing that the only way to build cool web apps is to do dom surgery with javascript! dan mccreary. one of the outsta...
...s are reachable by using our custom controls interfaces. our custom control interfaces allows for the exchange of data between any xml element and and an xforms model. this means that an author can write powerful mozilla-based applications by using xforms. if previously you was forced to use ajax for this then now xforms makes this for you automatically. custom controls interfaces this section
contains rfe to the custom control interfaces. if you find that you can't create a custom control due to limitations in our interfaces or the functionality of our controls, then this is the right place to pass along your requirements. custom controls if you have a custom control that you believe will help fulfill the needs of form authors or other custom controls authors, please file it here. this sect...
XForms Repeat Element - Archive of obsolete content
for each node in the nodeset, the contents of the repeat element will be displayed in the form. that node will serve as the context node for any relative xpath expressions in that set of repeated markup. attributes ui common appearance - the value of this attribute gives a hint to the xforms processor as to which type of widget(s) to use to represent this control. node set binding special startindex - optional 1-based initial value of the repeat index. the default value is 1. number - isn't supported type restrictions the repeat element can be bound to a nodeset. ...
...esn't (and probably never will) allow xforms:repeat elements as children, another syntax is needed. to accommodate this, xforms 1.0 defines an alternative syntax that is functionally equivalent to the repeat element, using the following attributes: repeat-model repeat-bind repeat-nodeset repeat-startindex repeat-number additionally, when using xforms action setindex, its repeat attribute (which
contains an idref) can point to any element carrying these repeat attributes. similarly, the index function can be used with the repeating structures created via these repeat-attributes. the id of the element that
contains the repeat attributes can be used as the argument to index. note, we don't fully support attribute-based repeats. there are a number of errors that may occur, especially when these attr...
Bounding volume collision detection with THREE.js - Game development
knot.geometry.boundingsphere.radius); unfortunately, there is no equivalent of box3.setfromobject for sphere instances. so if we apply transformations or change the position of the mesh, we need to manually update the bounding sphere. for instance: knot.scale.set(2, 2, 2); knotbsphere.radius = knot.geometry.radius * 2; intersection tests point vs. box3 / sphere both box3 and sphere have a
containspoint method to do this test. var point = new three.vector3(2, 4, 7); knotbbox.
containspoint(point); box3 vs. box3 the box3.intersectsbox method is available for performing this test. knotbbox.intersectsbox(otherbox); note: this is different from the box3.
containsbox method, which checks whether the box3 fully wraps another one. sphere vs. sphere in a similar fashion as before, there is a...
...e mesh. knot.position.set(-3, 2, 1); knot.rotation.x = -math.pi / 4; // update the bounding box so it stills wraps the knot knotboxhelper.update(); box3.setfromobject(knotboxhelper); performing collision tests is done in the same way as explained in the above section — we use our box3 object in the same way as described above. // box vs box box3.intersectsbox(otherbox3); // box vs point box3.
containspoint(point.position); demos there are two demos you can take a look at on our live demos page. the first one showcases point vs. box collisions using boxhelper. the second one performs box vs. box tests. ...
Building up a basic demo with A-Frame - Game development
e tab — it is useful to refer to. html structure the first step is to create an html document — inside your project directory, create a new index.html file, and save the follow html inside it: <!doctype html> <html> <head> <meta charset="utf-8"> <title>mdn games: a-frame demo</title> <script src="aframe.min.js"></script> </head> <body> <!-- html goes here --> </body> </html> this
contains some basic information like the document charset and <title>. the <script> element includes the a-frame framework in the page; we will write our example code inside the <body> element. initializing the scene a scene is the place where everything happens. when creating new objects in the demo, we will be adding them all to the scene to make them visible on the screen. in a-frame, the scene is re...
... like a box, cylinder or cone, but it can also be a camera, light or sound source. let's create the scene by adding an <a-scene> element inside the <body> element: <a-scene> </a-scene> adding a cube adding the cube to the scene is done by adding a simple <a-box> element inside the <a-scene> element. add it now: <a-box color="#0095dd" position="0 1 0" rotation="20 40 0"> </a-box> it
contains a few parameters already defined: color, position and rotation — these are fairly obvious, and define the base color of the cube, the position inside the 3d scene, and the rotation of the cube. note: the distance values (e.g. for the cube y position) are unitless, and can basically be anything you deem suitable for your scene — milimeters, meters, feet, or miles — it's up to you. adding...
Building up a basic demo with Babylon.js - Game development
the first <script> element includes the babylon.js library in the page; we will write our example code in the second one. there is one helper variable already included, which will store ...
...opy this code to a new text file and save it in your working directory as index.html. initialising the babylon.js engine we have to create a babylon.js engine instance first (passing it the <canvas> element to render on) before we start developing our game. add the following code to the bottom of your second <script> element: var engine = new babylon.engine(canvas); the babylon global object
contains all the babylon.js functions available in the engine. creating a scene a scene is the place where all the game content is displayed. while creating new objects in the demo, we will be adding them all to the scene to make them visible on the screen. let's create a scene by adding the following lines just below our previous code: var scene = new babylon.scene(engine); scene.clearcolor = new baby...
Building up a basic demo with PlayCanvas editor - Game development
ur scene animating 3d models might be considered an advanced thing to do, but all we want to do is to control a few properties of a given object — we can use a script component to do that. click on the plus button in the assets panel, select the script option, and name your new script file boxanimation.js. if you double click on it, you'll be moved to a code editor. ...
...turn boxanimation; }); the most interesting part is the update() function, which is where we can put any code that we want repeated on every frame. add the following line inside this function, to rotate the cube on every frame: this.entity.rotate(dt*10, dt*20, dt*30); in the line above this.entity refers to the object to which the script will be attached (the box); using the dt variable, which
contains the delta time passed since the previous frame, we can rotate the box by a different amount around all three axes. save the changes using the save button in the top right of the code editor, then return to the main editor tab. here, follow these steps: be sure you have the box selected on the scene. click on add component, then script in the entity inspector. at the bottom of the screen you...
Building up a basic demo with the PlayCanvas engine - Game development
the first <script> element includes the playcanvas library in the page; we will write our example code in the second one. there is one helper variable already included, which will store a refer...
...this code to a new text file and save it in your working directory as index.html. playcanvas application to begin developing our game we have to create the playcanvas application first (using the given <canvas> element), and then start the update loop. add the following code to the bottom of your second <script> element: var app = new pc.application(canvas); app.start(); the pc global object
contains all the playcanvas functions available in the engine. next, we'll set the canvas to fill the window, and automatically change its resolution to be the same as the canvas size. again, add the following lines at the bottom of your script. app.setcanvasfillmode(pc.fillmode_fill_window); app.setcanvasresolution(pc.resolution_auto); camera now when the setup code is in place we need to think abou...
Building up a basic demo with Three.js - Game development
three.js, as with any other 3d library, provides built-in helper functions to help you implement common 3d functionality more quickly. in this article we'll take you through the real basics of using three, including setting up a development environment, structuring the necessary html, the fundamental objects of three, and how to build up a basic demo. note: we chose three because it is one of the most popular webgl libraries, and it is easy to get started with. ...
...the first <script> element includes the three.js library in the page, and we will write our example code inside the second. there are two helper variables already included, which store the win...
WAI-ARIA basics - Learn web development
mation exposed by the browser's accessibility apis (where screenreaders get their information from). wai-aria doesn't affect webpage structure, the dom, etc., although the attributes can be useful for selecting elements by css. note: you can find a useful list of all the aria roles and their uses, with links to futher information, in the wai-aria spec — see definition of roles. the spec also
contains a list of all the properties and states, with links to further information — see definitions of states and properties (all aria-* attributes). where is wai-aria supported? this is not an easy question to answer. it is difficult to find a conclusive resource that states what features of wai-aria are supported, and where, because: there are a lot of features in the wai-aria spec. there are...
...1> <nav> <ul>...</ul> <form> <!-- search form --> </form> </nav> </header> <main> <article>...</article> <aside>...</aside> </main> <footer>...</footer> if you try testing the example with a screenreader in a modern browser, you'll already get some useful information. for example, voiceover gives you the following: on the <header> element — "banner, 2 items" (it
contains a heading and the <nav>). on the <nav> element — "navigation 2 items" (it
contains a list and a form). on the <main> element — "main 2 items" (it
contains an article and an aside). on the <aside> element — "complementary 2 items" (it
contains a heading and a list). on the search form input — "search query, insertion at beginning of text". on the <footer> element — "footer 1 item". ...
Legacy layout methods - Learn web development
them. in the next sections we will look at how to create both. we will create a 12 column grid — a very common choice that is seen to be very adaptable to different situations given that 12 is nicely divisible by 6, 4, 3, and 2. a simple fixed width grid lets first create a grid system that uses fixed width columns. start out by making a local copy of our sample simple-grid.html file, which
contains the following markup in its body. <div class="wrapper"> <div class="row"> <div class="col">1</div> <div class="col">2</div> <div class="col">3</div> <div class="col">4</div> <div class="col">5</div> <div class="col">6</div> <div class="col">7</div> <div class="col">8</div> <div class="col">9</div> <div class="col">10</div> <div class="col">11</div> ...
... and normalize.css files into a new directory. make a copy of our html-skeleton.html file and save it in the same directory as the skeleton and normalize css. include the skeleton and normalize css in the html page, by adding the following to its head: <link href="normalize.css" rel="stylesheet"> <link href="skeleton.css" rel="stylesheet"> skeleton includes more than a grid system — it also
contains css for typography and other page elements that you can use as a starting point. we’ll leave these at the defaults for now, however — it’s the grid we are really interested in here. note: normalize is a really useful little css library written by nicolas gallagher, which automatically does some useful basic layout fixes and makes default element styling more consistent across browsers. ...
How CSS is structured - Learn web development
dge of working with files, html basics (study introduction to html), and an idea of how css works. objective: to learn css's fundamental syntax structures in detail. applying css to html first, let's examine three methods of applying css to a document: with an external stylesheet, with an internal stylesheet, and with inline styles. external stylesheet an external stylesheet
contains css in a separate file with a .css extension. this is the most common and useful method of bringing css to a document. you can link a single css file to multiple web pages, styling all of them with the same css stylesheet. in the getting started with css, we linked an external stylesheet to our web page. you reference an external css stylesheet from an html <link> element: <!doctype html> <html...
...ty and value. the property name is color and the value is blue. when a property is paired with a value, this pairing is called a css declaration. css declarations are found within css declaration blocks. in the example below, highlighting identifies the css declaration block.. finally, css declaration blocks are paired with selectors to produce css rulesets (or css rules). the example below
contains two rules: one for the h1 selector and one for the p selector. the colored highlighting identifies the h1 rule. setting css properties to specific values is the primary way of defining layout and styling for a document. the css engine calculates which declarations apply to every single element of a page. important: css properties and values are case-sensitive. the property and value in each ...
What do common web layouts contain? - Learn web development
d you can take it so many directions. and if you don't have much experience, starting out with a blank page might be a bit scary. we have over 25 years' experience and we'll give you some common rules of thumb to help you design your site. even now with the new focus on mobile web, almost all mainstream webpages are built from these parts: header visible at the top of every page on the site.
contains information relevant to all pages (like site name or logo) and an easy-to-use navigation system. main content the biggest region, containing content unique to the current page. stuff on the side 1) information complementing the main content; 2) information shared among a subset of pages; 3) alternative navigation system. in fact, everything not absolutely required by the page's main content. ...
...use navigation system. main content the biggest region, containing content unique to the current page. stuff on the side 1) information complementing the main content; 2) information shared among a subset of pages; 3) alternative navigation system. in fact, everything not absolutely required by the page's main content. footer visible at the bottom of every page on the site. like the header,
contains less prominent global information like legal notices or contact info. these elements are quite common in all form factors, but they can be laid out different ways. here are some examples (1 represents header, 2 footer; a main content; b1, b2 things on the side): 1-column layout. especially important for mobile browsers so you don't clutter the small screen up. 2-column layout. often used to...
UI pseudo-classes - Learn web development
e've also given the inputs a thick red border when invalid. note: we've used ::before to add these labels, as we were already using ::after for the "required" labels. you can try it below: notice how the required text inputs are invalid when empty, but valid when they have something filled in. the email input on the other hand is valid when empty, as it is not required, but invalid when it
contains something that is not a proper email address. in-range and out-of-range data as we hinted at above, there are two other related pseudo-classes to consider — :in-range and :out-of-range. these match numeric inputs where range limits are specified by the min and max, when their data is inside or outside the specified range, respectvely. note: numeric input types are date, month, week, time, d...
...e <input type="checkbox"> reference page. more pseudo-classes there are a number of other pseudo-classes of interest, and we don't have space to write about them all in detail here. let's talk about a few more that you should take the time to investigate. the following are fairly well-supported in modern browsers: the :focus-within pseudo-class matches an element that has received focus or
contains an element that has received focus. this is useful if you want a whole form to highlight in some way when an input inside it is focused. the :focus-visible pseudo-class matches focused elements that received focus via keyboard interaction (rather than touch or mouse) — useful if you want to show a different style for keyboard focus compared to mouse (or other) focus. the :placeholder-shown ps...
Introduction to HTML - Learn web development
c software), and understand how to create and manage files (as detailed in dealing with files). both are parts of our getting started with the web complete beginner's module. note: if you are working on a computer/tablet/other devices that doesn't let you create your own files, you can try out (most of) the code examples in an online coding program such as jsbin or glitch. guides this module
contains the following articles, which will take you through all the basic theory of html and provide ample opportunity for you to test out some skills. getting started with html covers the absolute basics of html, to get you started — we define elements, attributes, and other important terms, and show where they fit in the language. we also show how a typical html page is structured and how an html...
... and show where they fit in the language. we also show how a typical html page is structured and how an html element is structured, and explain other important basic language features. along the way, we'll play with some html to get you interested! what’s in the head? metadata in html the head of an html document is the part that is not displayed in the web browser when the page is loaded. it
contains information such as the page <title>, links to css (if you want to style your html content with css), links to custom favicons, and metadata (data about the html, such as who wrote it, and important keywords that describe the document). html text fundamentals one of html's main jobs is to give text meaning (also known as semantics), so that the browser knows how to display it correctly. this ar...
Adding vector graphics to the Web - Learn web development
into your document. objective: learn how to embed an svg (vector) image into a webpage. note: this article doesn't intend to teach you svg; just what it is, and how to add it to web pages. what are vector graphics? on the web, you'll work with two types of image — raster images, and vector images: raster images are defined using a grid of pixels — a raster image file
contains information showing exactly where each pixel is to be placed, and exactly what color it should be. popular web raster formats include bitmap (.bmp), png (.png), jpeg (.jpg), and gif (.gif.) vector images are defined using algorithms — a vector image file
contains shape and path definitions that the computer can use to work out what the image should look like when rendered on the screen. the sv...
...ook at an example. you can find this example live on our github repo as vector-versus-raster.html — it shows two seemingly identical images side by side, of a red star with a black drop shadow. the difference is that the left one is a png, and the right one is an svg image. the difference becomes apparent when you zoom in the page — the png image becomes pixellated as you zoom in because it
contains information on where each pixel should be (and what color). when it is zoomed, each pixel is simply increased in size to fill multiple pixels on screen, so the image starts to look blocky. the vector image however continues to look nice and crisp, because no matter what size it is, the algorithms are used to work out the shapes in the image, with the values simply being scaled as it gets bigger. ...
Images in HTML - Learn web development
notate them with captions, and how html images relate to css background images. how do we put an image on a webpage? in order to put a simple image on a webpage, we use the <img> element. this is an empty element (meaning that it has no text content or closing tag) that requires a minimum of one attribute to be useful — src (sometimes spoken as its full title, source). the src attribute
contains a path pointing to the image you want to embed in the page, which can be a relative or absolute url, in the same way as href attribute values in <a> elements. note: you should read a quick primer on urls and paths to refresh your memory on relative and absolute urls before continuing. so for example, if your image is called dinosaur.jpg, and it sits in the same directory as your html page, yo...
...uld add a caption to go with your image. for example, there would be nothing to stop you from doing this: <div class="figure"> <img src="images/dinosaur.jpg" alt="the head and torso of a dinosaur skeleton; it has a large head with long sharp teeth" width="400" height="341"> <p>a t-rex on display in the manchester university museum.</p> </div> this is ok. it
contains the content you need, and is nicely stylable using css. but there is a problem here: there is nothing that semantically links the image to its caption, which can cause problems for screen readers. for example, when you have 50 images and captions, which caption goes with which image? a better solution, is to use the html5 <figure> and <figcaption> elements. these are created for exactly this pur...
Responsive images - Learn web development
: <img srcset="elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w" sizes="(max-width: 600px) 480px, 800px" src="elva-fairy-800w.jpg" alt="elva dressed as a fairy"> the srcset and sizes attributes look complicated, but they're not too hard to understand if you format them as shown above, with a different part of the attribute value on each line. each value
contains a comma-separated list, and each part of those lists is made up of three sub-parts. let's run through the contents of each now: srcset defines the set of images we will allow the browser to choose between, and what size each image is. each set of image information is separated from the previous one by a comma. for each one, we write: an image filename (elva-fairy-480w.jpg) a space the image...
...r to choose from, followed by the all-important <img> element. the code in responsive.html looks like so: <picture> <source media="(max-width: 799px)" srcset="elva-480w-close-portrait.jpg"> <source media="(min-width: 800px)" srcset="elva-800w.jpg"> <img src="elva-800w.jpg" alt="chris standing up holding his daughter elva"> </picture> the <source> elements include a media attribute that
contains a media condition — as with the first srcset example, these conditions are tests that decide which image is shown — the first one that returns true will be displayed. in this case, if the viewport width is 799px wide or less, the first <source> element's image will be displayed. if the viewport width is 800px or more, it'll be the second one. the srcset attributes contain the path to the ima...
Video and audio content - Learn web development
icle. the <video> element the <video> element allows you to embed a video very easily. a really simple example looks like this: <video src="rabbit320.webm" controls> <p>your browser doesn't support html5 video. here is a <a href="rabbit320.webm">link to the video</a> instead.</p> </video> the features of note are: src in the same way as for the <img> element, the src (source) attribute
contains a path to the video you want to embed. it works in exactly the same way. controls users must be able to control video and audio playback (it's especially critical for people who have epilepsy.) you must either use the controls attribute to include the browser's own control interface, or build your interface using the appropriate javascript api. at a minimum, the interface must include a way to ...
...> elements that point to their own sources. in this case the browser will go through the <source> elements and play the first one that it has the codec to support. including webm and mp4 sources should be enough to play your video on most platforms and browsers these days. each <source> element also has a type attribute. this is optional, but it is advised that you include it. the type attribute
contains the mime type of the file specified by the <source>, and browsers can use the type to immediately skip videos they don't understand. iftype isn't included, browsers will load and try to play each file until they find one that works, which obviously takes time and is an unnecessary use of resources. refer to our guide to media types and formats for help selecting the best containers and codecs fo...
Build your own function - Learn web development
to begin with, let's put together a basic function. note: for function naming conventions, you should follow the same rules as variable naming conventions. this is fine, as you can tell them apart — function names appear with parentheses after them, and variables don't. start by accessing the function-start.html file and making a local copy. you'll see that the html is simple — the body
contains just a single button. we've also provided some basic css to style the custom message box, and an empty <script> element to put our javascript in. next, add the following inside the <script> element: function displaymessage() { } we start off with the keyword function, which means we are defining a function. this is followed by the name we want to give to our function, a set of parentheses, ...
... to delete the whole panel from the page — to close the message box. briefly, the onclick handler is a property available on the button (or in fact, any element on the page) that can be set to a function to specify what code to run when the button is clicked. you'll learn a lot more about these in our later events article. we are making the onclick handler equal to an anonymous function, which
contains the code to run when the button is clicked. the line inside the function uses the node.removechild() dom api function to specify that we want to remove a specific child element of the html element — in this case the panel <div>. closebtn.onclick = function() { panel.parentnode.removechild(panel); } basically, this whole block of code is generating a block of html that looks like so, and ins...
Test your skills: Loops - Learn web development
you to write a simple program that, given a name, searches an array of objects containing names and phone numbers (phonebook) and, if it finds the name, outputs the name and phone number into the paragraph (para) and then exits the loop before it has run its course. you are given three variables to begin with: i — starts off with a value of 0; intended to be used as an iterator. name —
contains a name to search for para —
contains a reference to a paragraph, which will be used to report the results. you should use a type of loop that you've not used in the previous task. download the starting point for this task to work in your own editor or in an online editor. loops 3 in this final task, you are provided with the following: i — starts off with a value of 500; intended t...
...ains a reference to a paragraph, which will be used to report the results. you should use a type of loop that you've not used in the previous task. download the starting point for this task to work in your own editor or in an online editor. loops 3 in this final task, you are provided with the following: i — starts off with a value of 500; intended to be used as an iterator. para —
contains a reference to a paragraph, which will be used to report the results. isprime() — a function that, when passed a number, returns true if the number is a prime number, and false if not. you need to use a loop to go through the numbers 2 to 500 backwards (1 is not counted as a prime number), and run the provided isprime() function on them. for each number that isn't a prime number, continue on...
Handling text — strings in JavaScript - Learn web development
vascript. the power of words words are very important to humans — they are a large part of how we communicate. since the web is a largely text-based medium designed to allow humans to communicate and share information, it is useful for us to have control over the words that appear on it. html provides structure and meaning to our text, css allows us to precisely style it, and javascript
contains a number of features for manipulating strings, creating custom welcome messages and prompts, showing the right text labels when needed, sorting terms into the desired order, and much more. pretty much all of the programs we've shown you so far in the course have involved some string manipulation. strings — the basics strings are dealt with similarly to numbers at first glance, but when you d...
...catenate is a fancy programming word that means "join together". joining together strings in javascript uses the plus (+) operator, the same one we use to add numbers together, but in this context it does something different. let's try an example in our console. let one = 'hello, '; let two = 'how are you?'; let joined = one + two; joined; the result of this is a variable called joined, which
contains the value "hello, how are you?". in the last instance, we joined only two strings, but you can join as many as you like, as long as you include a + between each pair. try this: let multiple = one + one + one + one + two; multiple; you can also use a mix of variables and actual strings. try this: let response = one + 'i am fine — ' + two; response; note: when you enter an actual str...
Measuring performance - Learn web development
aller. we'll talk about both categories in this course. and as well as talking about performance metrics we will of course talk about the metrics that you'll use to measure whether your site's performance is improving. general performance reporting tools tools like pagespeed insights can measure a website’s performance. you can enter a url and get a performance report in seconds. ...
...it also lets you know it the measured values are considered good or bad. ...
Properly configuring server MIME types - Learn web development
rver. how to determine the correct mime type for your content there are several steps which you can take to determine the correct mime type value to be used for your content. if your content was created using a vendor's software application, read the vendor's documentation to see what mime types should be reported for different media types. look in the iana | mime media types registry which
contains all registered mime types. if the media type is displayed using a plug-in in netscape gecko, install the plug-in and then look in the help->about plug-ins menu to see what mime types are associated with the media type. search for the file extension in filext or file extensions reference to see what mime types are associated with that extension. how to set up your server to send the correct mi...
...ch for the file extension in filext or file extensions reference to see what mime types are associated with that extension. how to set up your server to send the correct mime types the fundamental idea is to configure your server to send the correct content-type http header for each document. if you're using the apache web server, simply copy this sample .htaccess file to the directory that
contains the files that you want to send with the correct mime types. if you have an entire subdirectory of files, just place the file in the parent directory; you need not place it in each subdirectory. if you're using a server-side script to generate content, you can generally add one line near the top of your script. you can serve content other than html from perl, php, asp, or java — just change th...
Server-side web frameworks - Learn web development
date a resource on the server will instead include the update information as "post data" within the body of the request. the http request may also include information about the current session or user in a client-side cookie. web frameworks provide programming-language-appropriate mechanisms to access this information. for example, the httprequest object that django passes to every view function
contains methods and properties for accessing the target url, the type of request (e.g. an http get), get or post parameters, cookie and session data, etc. django can also pass information encoded in the structure of the url by defining "capture patterns" in the url mapper (see the last code fragment in the section above). abstract and simplify database access websites use databases to store information...
...e. being based on python, django code is easy to read and to maintain. popular sites using django (from django home page) include: disqus, instagram, knight foundation, macarthur foundation, mozilla, national geographic, open knowledge foundation, pinterest, open stack. flask (python) flask is a microframework for python. while minimalist, flask can create serious websites out of the box. it
contains a development server and debugger, and includes support for jinja2 templating, secure cookies, unit testing, and restful request dispatching. it has good documentation and an active community. flask has become extremely popular, particularly for developers who need to provide web services on small, resource-constrained systems (e.g. running a web server on a raspberry pi, drone controllers, etc...
Ember interactivity: Events, classes and state - Learn web development
we know that we want to track both the text of a todo, and whether or not it is is completed. add the following import statement below the existing one: import { tracked } from '@glimmer/tracking'; now add the...
... to track both the text of a todo, and whether or not it is is completed. add the following import statement below the existing one: import { tracked } from '@glimmer/tracking'; now add the following class below the previous line you added: class todo { @tracked text = ''; @tracked iscompleted = false; constructor(text) { this.text = text; } } this class represents a todo — it
contains a @tracked text property containing the text of the todo, and a @tracked iscompleted property that specifies whether the todo has been completed or not. when instantiated, a todo object will have an initial text value equal to the text given to it when created (see below), and an iscompleted value of false. the only ember-specific part of this class is the @tracked decorator — this hooks in to ...
Routing in Ember - Learn web development
start by creating three new routes: "index", "active" and "completed". to do this you’ll need to enter the following commands into your terminal, inside the root directory of your app: ember generate route index ember generate route completed ember generate route active the second and third commands should have not only generated new files, but also updated an existing file, app/router.js. it
contains the following contents: import emberrouter from '@ember/routing/router'; import config from './config/environment'; export default class router extends emberrouter { location = config.locationtype; rooturl = config.rooturl; } router.map(function() { this.route('completed'); this.route('active'); }); the highlighted lines were added when the 2nd and 3rd commands above were run. router...
...ist /> component. the location in the page where <todolist /> is rendered is determined by the {{ outlet }} inside the parent route, which in this case is application.hbs. so we have our routes in place. great! but now we need a way to differentiate between each of these routes, so that they show what they are supposed to show. first of all, return once more to our todo-data.js file. it already
contains a getter that returns all todos, and a getter that returns incomplete todos. the getter we are missing is one to return just the completed todos. add the following below the existing getters: get completed() { return this.todos.filter(todo => todo.iscompleted); } models now we need to add models to our route javascript files to allow us to easily return specific data sets to display in those...
Vue resources - Learn web development
. for installation, and to use some of the more advanced features of vue (like single file components or render functions), you'll need a terminal with node + npm installed. objective: to learn where to go to find further information on vue, to continue your learning. further resources here’s where you should go to learn more about vue: vue docs — the main vue site.
contains comprehensive documentation, including examples, cookbooks, and reference material. this is the best place to start learning vue in depth. vue github repo — the vue code itself. this is where you can report issues and/or contribute directly to the vue codebase. studying the vue source code can help you better understand how the framework works, and write better code. vue forum — the officia...
... is the best place to start learning vue in depth. vue github repo — the vue code itself. this is where you can report issues and/or contribute directly to the vue codebase. studying the vue source code can help you better understand how the framework works, and write better code. vue forum — the official forum for getting help with vue. vue cli docs — documentation for the vue cli. this
contains information on customizing and extending the output you are generating via the cli. nuxtjs — nuxtjs is a server-side vue framework, with some architectural opinions that can be useful to creating maintainable applications, even if you don’t use any of the server side rendering features it provides. this site provides detailed documentation on using nuxtjs. vue mastery — a paid education p...
Implementing feature detection - Learn web development
at this point, try loading your page, and you'll get an idea of how modernizr works for css features. if you look at the dom inspector of your browser's developer tools, you'll see that modernizr has updated your <html> class value like so: <html class="js no-htmlimports sizes flash transferables applicationcache blobconstructor blob-constructor cookies cors ...and loads more values!> it now
contains a large number of classes that indicate the support status of different technology features. as an example, if the browser didn't support flexbox at all, <html> would be given a class name of no-flexbox. if it did support modern flexbox, it would get a class name of flexbox. if you search through the class list, you'll also see others relating to flexbox, like: flexboxlegacy for the old flexbo...
...rts html or javascript features, if needed. note: if you have trouble getting this to work, check your code against our modernizr-css.html and modernizr-css.css files (see this running live also). javascript modernizr is also equally well-prepared for implementing javascript feature detects too. it does this by making the global modernizr object available to the page it is applied to, which
contains results of the feature detects as true/false properties. for example, load up our modernizr-css.html example in your browser, then try going to your javascript console and typing in modernizr. followed by some of those class names (they are the same here too). for example: modernizr.flexbox modernizr.websqldatabase modernizr.xhr2 modernizr.fetch the console will return true/false values to ind...
Handling common HTML and CSS problems - Learn web development
tion, etc.) work. if you want to use these in your css and you need to support older ie versions, a good move is to use keith clark's selectivizr library — this is a small javascript library that works on top of an existing javascript library like jquery or mootools. to try this example, make a local copy of selectivizr-example-start.html. if you look at this running live, you'll see that it
contains two paragraphs, one of which is styled. we've selected the paragraph with p:first-child, which won't work in old versions of ie. now download mootools and selectivizr, and save them in the same directory as your sample html. put the following code into the head of your html document, just before the opening <style> tag: <script type="text/javascript" src="mootools-core-1.6.0.js"></script> ...
...king knowledge of how to find answers online invaluable. among the best sources of support information are the mozilla developer network (that's where you are now!), stackoverflow.com, and caniuse.com. to use the mozilla developer network (mdn), most people do a search engine search of the technology they are trying to find information on, plus the term "mdn", for example "mdn html5 video". mdn
contains several useful types of content: reference material with browser support information for client-side web technologies, e.g. the <video> reference page. other supporting reference material, e.g. the guide to media types and formats on the web, useful tutorials that solve specific problems, for example, creating a cross-browser video player. caniuse.com provides support information, along wi...
Setting up your own test automation environment - Learn web development
llowing command inside your project directory: npm install --save-dev mocha you can now run the test (and any others you put inside your test directory) using the following command: mocha --no-timeouts you should include the --no-timeouts flag to make sure your tests don't end up failing because of mocha's arbitrary timeout (which is 3 seconds). note: saucelabs-sample-test-frameworks
contains several useful examples showing how to set up different combinations of test/assertion tools. running remote tests it turns out that running tests on remote servers isn't that much more difficult than running them locally. you just need to create your driver instance, but with a few more features specified, including the capabilities of the browser you want to test on, the address of the serve...
...kind of result reporting mechanism! now if you go back to the browserstack automation dashboard page, you'll see your test listed: if you click on the link for your test, you'll get to a new screen where you will be able to see a video recording of the test, and multiple detailed logs of information pertaining to it. note: the resources menu option on the browserstack automation dashboard
contains a wealth of useful information on using it to run automated tests. see node js documentation for writing automate test scripts in node js for the node-specific information. explore the docs to find out all the useful things browserstack can do. note: if you don't want to write out the capabilities objects for your tests by hand, you can generate them using the generators embedded in the docs. ...
Command line crash course - Learn web development
urrent directory you are in, with the name you provide after the command name. for example, mkdir my-awesome-website will make a new directory called my-awesome-website. rmdir — removes the named directory, but only if it’s empty. for example rmdir my-awesome-website will remove the directory we created above. if you want to remove a directory that is not empty (and also remove everything it
contains), then you can use the -r option (recursive), but this is dangerous. make sure there is nothing you might need inside the directory later on, as it will be gone forever. touch — creates a new empty file, inside the current directory. for example, touch mdn-example.md creates a new empty file called mdn-example.md. mv — moves a file from the first specified file location to the second specif...
.... the pipe operator can connect these inputs and outputs together, allowing us to build up increasingly more complex operations to suit our needs — the output from one command can become the input to the next command. in this case, ls would normally print its output to stdout, but instead ls’s output is being piped into wc, which takes that output as an input, counting the number of lines it
contains, and prints that count to stdout instead. a slightly more complex example let’s go through something a bit more complicated. we will first try to fetch the contents of mdn's "fetch" page using the curl command (which can be used to request content from urls), from /docs/web/api/fetch. however, this url is the old location of the page. if you enter it in a new browser tab, you’ll (eventuall...
Package management basics - Learn web development
ious articles. without modern build tools, dependencies like this might be included in your project using a simple <script> element, but this might not work right out of the box and you will likely need some modern tooling to bundle your code and dependencies together when they are released on the web. a bundle is the term that’s generally used to refer to a single file on your web server that
contains all the javascript for your software — typically compressed as much as possible to help reduce the time it takes to get your software downloaded and displayed in your visitors’ browser. in addition, what happens if you find a better tool that you want to use instead of the current one, or a new version of your dependency is released that you want to update to? this is not too painful for a c...
... format as npm, and can install any package from the npm and other package registries. let’s review the common actions you’ll want to perform with package managers. initialise a new project npm init yarn init as shown above, this will prompt and walk you through a series of questions to describe your project (name, license, description and so on) then generate a package.json for you that
contains meta information about your project and its dependencies. installing dependencies npm install date-fns yarn add date-fns we also saw install in action above. this would directly add the date-fns package to the working directory in a sub-directory called node_modules, along with date-fns’s own dependencies. by default this command will install the latest version of date-fns, but you can cont...
Mozilla accessibility architecture
make any necessary changes, and then expose the information using microsoft com on windows, or through gtk2's atk api's on linux and unix. the assistive technology can then use this information in a number of ways. it can read in an entire document at once, look only pieces of a document related to recent events, or traverse the accessibility object model based on screen position. accessible tree
contains only a subset of nodes from the dom tree not all dom nodes are exposed through accessibility api toolkits -- only those objects deemed important by the developers of the toolkit. mozilla keeps around its own tree of accessibility objects, which parallels the dom tree, but is not a full representation. above: a diagram showing that the msaa tree is a subset of the dom tree. the situation for othe...
..., even dom nodes that are not "accessible", it may or may not also be an nsaccessible. in other words, the lowest common denominator for objects we must cache is nsaccessnode. nsaccessnode::init() when nsaccessibilityservice::getaccessible() gets a newly created accessible, it calls nsiaccessnode::init() on the new object, which will add this to the cache for the doc accessible. each nsaccessnode
contains the dom node and weak pres shell for the object. the weak pres shell is used to create a hash key to get the doc accessible from gglobaldocaccessiblecache. the dom node pointer is used to create the new hash key and add the nsiaccessnode* into the document accessible's maccessnodecache. the init() method is also virtual, and many accessibles override it to do their own special initialization. if ...
Mozilla's Section 508 Compliance
here is a detailed list of section 508 bugs in mozilla's seamonkey application suite. some of them are fairly minor. ...
...ally mozilla uses a color change to indicate when a link has been visited. however, the visited link appearance can be altered via a user style sheet. (j) when a product permits a user to adjust color and contrast settings, a variety of color selections capable of producing a range of contrast levels shall be provided. complete. mozilla's appearance preferences panel
contains a large number of color possibilities. (k) software shall not use flashing or blinking text, objects, or other elements having a flash or blink frequency greater than 2 hz and lower than 55 hz. complete. mozilla supports of <blink> and text-decoration: blink in web pages. in these situations mozilla blinks 1 hz, which is within the allowable range and follows the str...
Creating a Language Pack
// add and localize this file ... // lots of notifications about missing entities ... x-testing: changed: 6 missinginfiles: 6124 missing: 5 0% of entries changed this step is not necessary anymore to create the language pack, because it is included in the next command. it is only useful if you want to preview the contents of the mergedir. you'll see that it
contains the files which in your localization were missing some entities. all other files will be taken from x-testing directly. it's now time to create a langpack with: $ make langpack-x-testing locale_mergedir=$(pwd)/mergedir each time you need to generate a new langpack, you need to run this command. remember that you need to be in the directory obj-firefox-build/browser/locales. $ make langpack-x-t...
...l10n.ini /users/your_id/mozilla/vc/l10n-central x-testing x-testing: browser chrome browser aboutcerterror.dtd // add and localize this file ... // lots of notifications about missing entities ... x-testing: changed: 6 missinginfiles: 6124 missing: 5 0% of entries changed if you now preview the contents of the mergedir, you'll see that it
contains the files which in your localization were missing some entities. all other files will be taken from en-us directly. it's now time to repackage the en-us binary with $ make installers-x-testing locale_mergedir=$(pwd)/mergedir again, for 64-bit mac, append moz_pkg_platform=mac to this command. each time you want to generate a new binary (often called a "repack"), you need to run these two comma...
Creating a spell check dictionary add-on
one, please make sure that there is not already a dictionary available for your locale. if there already is one, try contacting the author to get it updated, or contact amo editors if the author does not respond. packaging a firefox add-on is a zip file renamed to use an .xpi file extension instead of the normal .zip file extension. ...
...in addition to these required files, you may add optional files, for example to give your add-on an icon or to describe the license of the dictionary. here is an example of the install.rdf file. you can create and edit it with a plain text editor such as notepad. ...
mozbrowsercontextmenu
andard menu(s) that will be shown. for example, if the user clicked on an image nested in an <a> tag, two menus are available — one with information related to the image, and one for the link. contextmenu a menu object (see the menu object, below) representing a custom menu defined via <menu> / <menuitem> elements and pointed to via a contextmenu attribute on the dom element clicked on, which
contains the menu's id. contextmenuitemselected an anonymous function that fires when a menu item is selected. the menusystem object an object defining a standard context menu that will be displayed. its properties are as follows: documenturi a domstring representing the url of the document the menu is associated with. uri a domstring. in the case of an image or video context menu, this is the ...
... form, in the case of a form context menu. method a domstring representing the method of a form, in the case of a form context menu. name a domstring representing the name of a form, in the case of a form context menu. the menu object an object representing a custom menu defined via <menu> / <menuitem> elements and pointed to via a contextmenu attribute on the dom element clicked on, which
contains the menu's id. its properties are as follows: type a domstring representing the type of context menu displayed. it can be menu (a full menu) or menuitem (a single menu item.) label a domstring equal to the label attribute of the dom node the context menu is accessed on. icon the menu item's icon, if the context menu being accessed is a menu item. id the menu item's id, if the context me...
JNI.jsm
this module, all of the android sdk functions that firefox has permissions for are at your fingertips. a note about firefox for android, this jsm file is already globally imported and is available from the privileged window scope as window.jni. there also exists a jenv variable in the window scope, so if you need to run jni from the global scope, use a different variable name then jenv. jni.jsm
contains all the js-ctypes needed to communicate with the jni libraries. the js-ctypes is abstracted away while all the underlying data is all ctype data. functions are declared similar to js-ctypes but in a very different syntax. unlike c from js-ctypes, defining constants is not a manual magic number method in jni, it is declared the same way we define functions, except in jni they are called fields. m...
...therefore, it is always recommended to use slash notation. so for geckoappshell we would pass here "org/mozilla/gecko/geckoappshell" and for geckointerface we would use "org/mozilla/gecko/geckoappshell$geckointerface". adeclares optional if this is omitted, then afullyqualifiedname must be an array type. if this is provided, then afullyqualifiedname must be a class name. a required object that
contains up to five fields of key names: constructors, fields, static_fields, methods, and static_methods. return value blah blah newstring() blah blah cdata newstring( ajenv, astr ); parameters ajenv the return value of getforthread(). astr a javascript string, use any encoding desired. return value blah blah readstring() blah blah string readstring( ajenv, ajavastring ); parame...
OS.File for the main thread
var writepath = os.path.join(os.constants.path.desktopdir, 'savedimage.png'); var promise = os.file.writeatomic(writepath, new uint8array(r.result), { tmppath: writepath + '.tmp' }); promise.then( function(aval) { console.log('successfully saved image to disk'); }, function(are...
...tional additional options for file opening. this implementation interprets the following fields: humanreadable if true, create a new filename appending a decimal number, e.g., filename-1.ext, filename-2.ext. if false use hex numbers, e.g., filename-a65bc0.ext. maxattempts used to limit the amount of tries after a failed file creation. default is 99. promise resolves to an object
contains a file object{file} and the path{path}. promise can be rejected with os.file.error if the file could not be opened. os.file.copy() copy a file. void copy( in string sourcepath, in string destpath [optional] in object options) throws os.file.error arguments sourcepath the full path of the file to copy. at the time of this writing, this function does not copy directories. dest...
Localization technical reviews
lease, this first revision requires a very detailed and comprehensive form of review. that being the case, there are some criteria in a technical review that will only ever be considered once, as all reviews after this only evaluate the changes you're adding on top of this revision from release to release. ...
... localizers can specify the team responsible for the work by listing the name just after the moz_langpack_creator. the team can also wrap contributors with <em:contributor> tags just after the moz_langpack_contributors section. ...
Fonts for Mozilla 2.0's MathML engine
may mean installing some fonts. note that some web sites may provide the required mathematical fonts as web fonts. in that case, you will see the correct rendering on these pages if you use gecko 15.0 (firefox 15.0 / thunderbird 15.0 / seamonkey 2.12) or greater. recommended fonts the stix fonts project has been developing a comprehensive set of fonts that cover all the symbols in mathml and also
contains glyphs to stretch mathematical operators. they are available under the sil open font license and should be installed for best mathml rendering. note that currently, only the fonts in /fonts/stix-general/ are used for stretching mathematical operators with stix fonts. asana math is also freely available under the sil open font license and has good support for mathematical characters. starting in g...
...the above fonts are installed, but are worth noting because of their unicode support for many mathematical characters. dejavu serif and dejavu sans are freely available and installed with many linux distributions. they contain support for many mathematical characters, and mozilla will display some mathml reasonably on systems with these fonts installed, even without stix fonts. the font only
contains glyphs for stretchy operators that have unicode assignments. cambria math is preinstalled on microsoft windows vista, and also comes with miscrosoft office 2007 or microsoft powerpoint viewer 2007. the font has good support for mathematical characters, and so, with any of these products installed, mozilla will be able to display some mathml reasonably even without stix fonts. the font conta...
Mozilla DOM Hacking Guide
mation. the nsdomclassinfo class the heart of class info is the nsdomclassinfo class, defined in nsdomclassinfo.h. it implements two interfaces besides nsisupports: nsixpcscriptable and nsiclassinfo. we already know what nsixpcscriptable is used for (see the previous section). nsiclassinfo is an xpcom interface, very well described by mike shaver in this overview of nsiclassinfo. basically it
contains convenient methods to find out about the interfaces an object promises to support. in our case, this list of interfaces will be populated by "class info". see also section 1.5 on the init() function and section 1.2 on interface flattening. we saw in section 1.3 that nsdomclassinfo is the base class for all the helper classes. let's see what it's made of. let's begin with the public interface. ...
...menttype() and createdocument() (dom2). what there is to do implement your object in c++. this is not in the scope of this document. the best thing you can do is probably to copy existing code. a dom object is a simple xpcom object with domclassinfo. in our example, the implementation class is nsdomimplementation (in nsdocument.cpp). it implements the nsidomdomimplementation interface (which
contains the three methods mentionned above). modify the queryinterface implementation of your xpcom object to include domclassinfo data. add the following line at the end of the queryinterface implementation: ns_interface_map_entry_content_classinfo(dom_object_name) for the domimplementation object, the line would be: ns_interface_map_entry_content_classinfo(domimplementation) what does it do? i...
Mozilla Style System Documentation
dealing with dynamic style changes are also tricky because the style contexts don't have pointers to their frames, but instead, we have the reverse and is probably the biggest flaw in the design of this part of the system. getting style data from a style context to get style data from a style context, use the getstyledata method to fill in a pointer to a style struct. each of the style structs
contains a group of properties. the structs are listed in, nsstylestruct.hand the many of the values are in nsstyleconsts.h. each of the structs includes either only features that are inherited by default or single properties that are set to the initial value by default (see css26.1.1), which is essential for the ruletree. the fundamental way to get a style struct from a style context looks like this: c...
... ,------------' | `-----------. [title: c] [para: f] [para: d] | | [quote: a] [quote: a] | [span: e] the reason the rule tree shares style data naturally is that most style rules specify properties in very few structs. as stated above, each style struct
contains only features that are inherited by default or those that are set to their initial value ("reset") by default. this leads to (or perhaps three, depending on how you count) two types of sharing. for those structs where all the values are inherited by default, a style context can often (when none of the rules matched by the style context specifies any properties in the struct, or when explicit inhe...
TraceMalloc
emalloclogtimestamp(caption) - log a timestamp event to the current log file, annotating the log even with the caption string. tracemallocdumpallocations(pathname) - dump a human-readable listing of all traced, live allocations. see nstracemalloc.h for detailed comments on the log file format. analyzing the shutdown log the shutdown log is a basic tool for finding memory leaks. the shutdown log
contains the stack trace of every allocation that has not been deallocated by shutdown. some of these are false positives, allocations that are truly needed until shutdown. ideally, these would be freed explicitly, to make it easier to find real leaks using the shutdown log. here is a how-to for analyzing the shutdown log, taken from the tinderbox leak builds. this example is for macos; small modification...
... then lists all the non-root allocations. the roots are either listed as single objects or as strongly connected components (minimal sets of nodes in the graph in which any node is reachable from all other nodes). (a strongly connected component with only one node is listed as a single object.) any single object listed as a root is really a leak root, and any component listed as a root either (a)
contains an object that is a root or (b)
contains objects that form an ownership cycle that is a root. other documentation some older documentation about tracemalloc is here. ...
NSS 3.28 release notes
sending a clienthello. ssl_signatureschemeprefset allows an application to set which signature schemes should be supported in tls and to specify the preference order of those schemes. ssl_signatureschemeprefget allows an application to learn the currently supported and enabled signature schemes for a socket. request to test and prepare for tls 1.3 this release
contains improved support for tls 1.3, however, the code that supports tls 1.3 is still disabled by default (not built). for the future nss 3.29 release, it is planned that standard builds of nss will support the tls 1.3 protocol (although the maximum tls protocol version enabled by default will remain at tls 1.2). we know that some applications which use nss, query nss for the supported range of ssl/tl...
...et. the old ssl_signatureprefset and ssl_signatureprefset functions are now deprecated. nss will now no longer assume that default signature schemes are supported by a peer if there was no commonly supported signature scheme. nss will now check if rsa-pss signing is supported by the token that holds the private key prior to using it for tls (bug 1311950). the certificate validation code
contains checks to no longer trust certificates that are issued by old wosign and startcom cas, after october 21, 2016. this is equivalent to the behavior that mozilla will release with firefox 51. background information can be found in mozilla's blog post. bugs fixed in nss 3.28 this bugzilla query returns all the bugs fixed in nss 3.28: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&class...
nss tech note4
also, this document does not attempt to be an exhaustive survey of all possible ways to do a certain task; it merely tries to show a certain way. ...
...t extensions an extension has the following attributes object id (oid) : a unique oid represents an algorithm, a mechanism, a piece of information, etc. examples: x500 rsa encryption, certificate basic constraints, pkcs#7 digested data, etc. there is a long list of pre-defined oids, and new ones can be added dynamically by an application. the oid data structure
contains an array of identifier bytes (each byte is a "level" in a hierarchical namespace), a text description, and some other things. critical : indicates whether the extension is critical value : the value of the extension looping through all extensions certcertextension** extensions =cert->extensions; if (extensions) { while (*ex...
NSS tools : crlutil
d, crlutil will read script data from standard input. -d directory specify the database directory containing the certificate and key database files. on unix the certificate database tool defaults to $home/.netscape (that is, ~/.netscape). on windows nt the default is the current directory. the nss database files must reside in the same directory. -i crl-import-file specify the file which
contains the crl to import -f password-file specify a file that will automatically supply the password to include in a certificate or to access a certificate database. this is a plain-text file containing one password. be sure to prevent unauthorized access to this file. -l algorithm-name specify a specific signature algorithm. list of possible algorithms: md2 | md4 | md5 | sha1 | sha256 | sha384 ...
...xt file containing one password. be sure to prevent unauthorized access to this file. -l algorithm-name specify a specific signature algorithm. list of possible algorithms: md2 | md4 | md5 | sha1 | sha256 | sha384 | sha512 -n nickname specify the nickname of a certificate or key to list, create, add to a database, modify, or validate. bracket the nickname string with quotation marks if it
contains spaces. -o output-file specify the output file name for new crl. bracket the output-file string with quotation marks if it
contains spaces. if this argument is not used the output destination defaults to standard output. -t crl-type specify type of crl. possible types are: 0 - sec_krl_type, 1 - sec_crl_type. this option is obsolete -u url specify the url. crl generation script syntax ...
NSS Tools crlutil
specify the database directory containing the certificate and key database files. on unix the certificate database tool defaults to $home/.netscape (that is, ~/.netscape). on windows nt the default is the current directory. the nss database files must reside in the same directory. -i crl-import-file specify the file which
contains the crl to import -f password-file specify a file that will automatically supply the password to include in a certificate or to access a certificate database. this is a plain-text file containing one password. be sure to prevent unauthorized access to this file. -l algorithm-name speci...
... -l algorithm-name specify a specific signature algorithm. list of possible algorithms: md2 | md4 | md5 | sha1 | sha256 | sha384 | sha512 -n nickname specify the nickname of a certificate or key to list, create, add to a database, modify, or validate. bracket the nickname string with quotation marks if it
contains spaces. -o output-file specify the output file name for new crl. bracket the output-file string with quotation marks if it
contains spaces. if this argument is not used the output destination defaults to standard output. -t crl-type specify type of crl. possible types are: 0 - sec_krl...
NSS tools : crlutil
ry specify the database directory containing the certificate and key database files. on unix the certificate database tool defaults to $home/.netscape (that is, ~/.netscape). on windows nt the default is the current directory. the nss database files must reside in the same directory. -i crl-import-file specify the file which
contains the crl to import -f password-file specify a file that will automatically supply the password to include in a certificate or to access a certificate database. this is a plain-text file containing one password. be sure to prevent unauthorized access to this file. -l algorithm-name specify a specific signature algorithm. list of possi...
...horized access to this file. -l algorithm-name specify a specific signature algorithm. list of possible algorithms: md2 | md4 | md5 | sha1 | sha256 | sha384 | sha512 -n nickname specify the nickname of a certificate or key to list, create, add to a database, modify, or validate. bracket the nickname string with quotation marks if it
contains spaces. -o output-file specify the output file name for new crl. bracket the output-file string with quotation marks if it
contains spaces. if this argument is not used the output destination defaults to standard output. -t crl-type specify type of crl. possible types are: 0 - sec_krl_type, 1 - sec_crl_type. this option i...
GC Rooting Guide
ays that contain them, you must follow the rules set out in this guide. if you do not your program will not work correctly - if it works at all. gc things on the stack js::rooted<t> all gc thing pointers stored on the stack (i.e., local variables and parameters to functions) must use the js::rooted<t> class. this is a template class where the template parameter is the type of the gc thing it
contains. from the user perspective, a js::rooted<t> instance behaves exactly as if it were the underlying pointer. js::rooted must be constructed with a jscontext*, and optionally an initial value. there are typedefs available for the main types. within spidermonkey, it is suggested that these are used in preference to the template class (gecko uses the template versions): template class ...
...s::value msomevalue; }; you should write: struct heapstruct { js::heap<jsobject*> msomeobject; js::heap<js::value> msomevalue; }; tracing js::nativeobject all gc pointers stored on the heap must be traced. for regular js::nativeobjects, this is normally done by storing them in slots, which are automatically traced by the gc. other jsobjects when defining a jsobject subclass that
contains heap<t> fields, set the trace hook to invoke a function that traces those fields. general classes/structures for a regular struct or class, tracing must be triggered manually. the usual way is to define a void trace(jstracer* trc, const char* name) method on the class -- which is already enough be able to create a js::rooted<yourstruct> on the stack -- and then arrange for it to be called durin...
JS_CompileUTF8FileHandle
cx jscontext * the context in which to compile the script. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object with which the script is associated. filename const char * filename to associate with the compiled script. this filename is used for error messages. it should be the name of the file that
contains the script, if available. file file * the file handle containing the script to compile. principals jsprincipals * (only in js_compileutf8filehandleforprincipals) the security principals to associate with the new script, or null. description js_compileutf8filehandle reads a script from a stdio file handle and compiles the script for execution by the javascript...
...ctions it creates. on success, js_compileutf8filehandle reads file to eof and returns an object representing the newly compiled script. if an error occurs during compilation, js_compileutf8filehandle stops reading from the file and returns null. js_compileutf8filehandle and js_compileutf8filehandleforprincipals are deprecated, use file, use js::compile instead. see also the jsapi user guide
contains example code using compiled scripts. mxr id search for js_compileutf8filehandle js::compile js_decompilescript js::evaluate js_executescript bug 805080 ...
JS_DefineProperty
y has an own property with the given name or id, the existing property is replaced. these functions can currently replace jsprop_permanent properties, but such usage is deprecated. the javascript engine will call the getter or setter callback each time the property is read or written, whether from javascript code or via jsapi functions like js_getproperty and js_setproperty. (exception: if attrs
contains the jsprop_readonly flag, the setter will never be called, as property assignment will fail before it gets that far. also note that certain jsapi functions, including js_lookupproperty, js_hasproperty, and property_attributes, can detect or examine a property without calling its getter.) if getter (or setter) is null, the new property will use the jsclass.getproperty (or jsclass.setproperty) call...
...tter will never be called, as property assignment will fail before it gets that far. also note that certain jsapi functions, including js_lookupproperty, js_hasproperty, and property_attributes, can detect or examine a property without calling its getter.) if getter (or setter) is null, the new property will use the jsclass.getproperty (or jsclass.setproperty) callback from obj's class. if attrs
contains the jsprop_getter (or jsprop_setter) flag, then getter (or setter) must point to a javascript function, not a c/c++ function. that is, it must be a jsobject * that points to a javascript function, cast to type jspropertyop. for more about javascript getters and setters, see defining getters and setters. on success, js_defineproperty returns true. on error or exception, it returns false. see als...
JSAPI reference
a note on versioning: up until the release of firefox 4, spidermonkey, and thus the jsapi, was versioned in an ad-hoc way, with releases happening at times that roughly, but not really, corresponded to firefox releases. in the fall of 2012, the spidermonkey team decided to align releases with those of firefox. ...
...ocal root scopes were another way of protecting objects from the garbage collector. they have been removed in js 1.8.5, though js_enterlocalrootscope obsolete since javascript 1.8.5 js_leavelocalrootscope obsolete since javascript 1.8.5 js_leavelocalrootscopewithresult obsolete since javascript 1.8.5 js_forgetlocalroot obsolete since javascript 1.8.5 added in spidermonkey 1.8 if an object
contains references to other gc things that are not stored in spidermonkey data structures ("slots"), it must implement the jstraceop hook to enable the garbage collector to traverse those references. otherwise the garbage collector will not find all reachable objects and may collect objects that are still reachable, leading to a crash. (in spidermonkey 1.7 and earlier, the jsmarkop hook was used instead.
SpiderMonkey 1.8.8
ey 1.8.8. you can download full source code here: insert-actual-link-when-the-release-happens (md5 checksum: insert-actual-hash-here). spidermonkey 1.8.8 is the javascript engine that shipped in firefox 10.0. it continues to improve performance over previous spidermonkey releases, with ongoing jit compilation work and with the introduction of type inference to enable faster jitted code. it also
contains new language and api features described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: javascript engine. —insert-actual-release-date-here platform support spidermonkey 1.8.8 is supported on all the platforms where firefox insert-actual-fi...
...ovided but not supported. on all other platforms the jit is simply disabled; javascript code runs in an interpreter, as in previous versions. it's the same language, just not as fast. migrating to spidermonkey 1.8.8 the following features in earlier versions of spidermonkey have been dropped. the jsresolve_classname and jsresolve_with resolve flags (passed to jsclass.resolve when jsclass.flags
contains jsclass_new_resolve) have been removed. spidermonkey 1.8.8 is not binary-compatible with previous releases, nor is it source-code compatible. many jsapi types, functions, and callback signatures have changed, though most of them still have the same names and do the same things. applications will need significant changes, but most of those changes will be detected by the c/c++ compiler, so they a...
SpiderMonkey 17
nload full source code here: http://ftp.mozilla.org/pub/mozilla.org/js/mozjs17.0.0.tar.gz (md5 checksum: 20b6f8f1140ef6e47daa3b16965c9202). spidermonkey 17 is the javascript engine that shipped in firefox 17. it continues to improve performance over previous spidermonkey releases, with ongoing jit compilation work and with the introduction of type inference to enable faster jitted code. it also
contains new language and api features described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: javascript engine. — 25 march 2013 platform support spidermonkey 17 is supported on all the platforms where firefox 17 runs. spidermonkey 17 includes a ...
... provided but not supported. on all other platforms the jit is simply disabled; javascript code runs in an interpreter, as in previous versions. it's the same language, just not as fast. migrating to spidermonkey 17 the following features in earlier versions of spidermonkey have been dropped. the jsresolve_classname and jsresolve_with resolve flags (passed to jsclass.resolve when jsclass.flags
contains jsclass_new_resolve) have been removed. spidermonkey 17 is not binary-compatible with previous releases, nor is it source-code compatible. many jsapi types, functions, and callback signatures have changed, though most of them still have the same names and do the same things. applications will need significant changes, but most of those changes will be detected by the c/c++ compiler, so they are ...
SpiderMonkey 38
please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: javascript engine. ...
... please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: javascript engine. ...
SpiderMonkey 45
please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. ...
...pidermonkey 45. you can download full source code from https://ftp.mozilla.org/pub/spidermonkey/releases/45.0.2/mozjs-45.0.2.tar.bz2 sha256: 570530b1e551bf4a459d7cae875f33f99d5ef0c29ccc7742a1b6f588e5eadbee md5: 2ca34f998d8b5ea79d8616dd26b5fbab spidermonkey 45 is the javascript engine that shipped in firefox 45. it continues to improve performance over previous spidermonkey releases. it also
contains new language and api features described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: javascript engine. you may wish to make the bugs block bug 837921 (aliased as "sm.embedding"). — apr 14, 2016 platform support spidermonkey 45 is supp...
Secure Development Guidelines
takes and how they affect a product how to avoid making them how to mitigate them everything is oriented toward c/c++ introduction: gaining control specifics about the underlying architecture, using x86 as an example 6 basic registers (eax, ebx, ecx, edx, edi, esi) 2 stack-related registers (esp, ebp) mark top and bottom of current stack frame status register (eflags)
contains various state information instruction pointer (eip) points to register being executed; can’t be modified directly introduction: gaining control (2) eip is modified using call or jump instructions attacks usually rely on obtaining control over the eip otherwise the attacker can try to control memory pointed to by an existing function pointer a vulnerability is required t...
...rgv) { char *file = argv[1]; int fd; struct stat statbuf; stat(file, &statbuf); if (s_islink(statbuf.st_mode)) { bailout(“symbolic link”); } else if (statbuf.st_uid != getuid) { bailout(“you don’t own the file”); } fd = open(file, o_rdwr); write(fd, argv[2], strlen(argv[2])); } file i/o: race conditions previous example
contains a race condition the file may change between the call top stat() and open() this opens the possibility of writing arbitrary content to any file race conditions occur when two separate execution flows share a resource and its access is not synchronized properly race condition types include file (previously covered) thread (two threads share a resource but don’t lock it) signa...
AT APIs Support
we provide for them the support of these products on windows, linux/unix and os x platforms. accessible gecko gecko is a rendering engine that firefox, seamonkey, netscape and yelp use. gecko can render a variety of content, not just html and supports key web standards such as cascading style sheets, javascript and the w3c dom. ...
...rs of the gnome desktop. on mac platform camino - web browser for os x xul applications xul applications make full use of the gecko architecture, not only for html content, but also for the entire user interface. widgets such as menus, tab panels, tree views and dialogs are provided via an xml language called xul (extensible user-interface language). none of the user interface
contains standard os controls. this is done to ensure a common look and feel across all supported platforms, and to allow for different skins (appearances). developing a xul window is not that different from developing a web page, but the elements available to add widgets are more powerful and designed to be similar to desktop widgets. examples of xul applications: firefox - web-browser thunderbird -...
Mork
arting at 0x80, because the values less than 0x80 are theoretically their representative ascii values. tables a table is set of rows, potentially with a meta-row. the table id is specified using the mid at the beginning of the table. furthermore, the scope of the mid also serves as the default scope of rows defined within the table. the meta-row of the table (different from the meta-row of a row)
contains a few things you might care about. the first is the kind column (k), where the mid is typically column-scoped (:c). next is the status column (s), which is defined as a single digit that is the priority (which appears to be unused), a 'u' if it is unique (i.e., the only table of its kind), and a 'v' if it is verbose (which also appears to be unused). the presence of a row or rowreference in the m...
...), where the mid is typically column-scoped (:c). next is the status column (s), which is defined as a single digit that is the priority (which appears to be unused), a 'u' if it is unique (i.e., the only table of its kind), and a 'v' if it is verbose (which also appears to be unused). the presence of a row or rowreference in the meta-table indicates that said row is the meta-row of the table: it
contains arbitrary properties for the entire table just like a normal row. for example, the message summary format files use a table for each thread, where the meta-rows represent information about the thread in general. the last important point about tables is the meaning of the minuses. a minus before the table id indicates that all the rows currently stored in the table should be removed before addin...
Manipulating bookmarks using Places
ookmarks that link to it, you can use the nsinavbookmarksservice.getbookmarkidsforuri() method. var ios = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); var uri = ios.newuri("http://google.com/", null, null); var bookmarksarray = bmsvc.getbookmarkidsforuri(uri, {}); after executing this code, the array bookmarksarray
contains the ids of all bookmarks that refer to the specified uri (in this case, "http://google.com"). manipulating existing items there are a number of convenient methods you can use to make changes to existing bookmarks and bookmark folders. this section covers some of them. the item title to change the title of a bookmark or bookmark folder, you use the nsinavbookmarksservice.setitemtitle() method.
... uri = ios.newuri("http://mozilla.com/", null, null); if (!bmsvc.isbookmarked(uri)) { bmsvc.insertbookmark(bmsvc.toolbarfolder, uri, bmsvc.default_index, "mozilla"); } this example looks to see if the user already has a bookmark for the mozilla web site, and, if not, creates one, adding it to the user's bookmarks toolbar. finding the folder containing an item if you need to know what folder
contains an item (this can be especially handy after using nsinavbookmarksservice.getbookmarkidsforuri() to find bookmarks for a given uri), you can use the nsinavbookmarksservice.getfolderidforitem() method. var parentfolderid = bmsvc.getfolderidforitem(newbkmkid); observing changes to bookmarks and tags to set up an observer to listen for changes related to bookmarks, you will need to create an nsin...
Using the Places history service
typed, hidden, and gecko flags (gecko flags is trunk only). the navhistory service has broken this into two tables (see history service design). the main url table stores the information about the page: url, host name, title, visit count, hidden, and typed. stored separately is the information specific to each visit. this information is called a "visit" in this document and in the code. a visit
contains a reference to the url table for the page, the visit date, the transition type (typed, click, redirect, bookmark, etc.), a reference to the referring visit, and the session id. this separation of the global page information and the visit allows us to store information about each time the page was visited instead of just the last time. using the referrer information in each visit, the browsing pa...
... basic querying of the history system nsiglobalhistory2.isvisited: called by gecko when rendering links. when isvisited returns true, the link gets the "visited" style. otherwise, the link is colored as unvisited. nsiglobalhistory3.getgeckoflags: retrieves information previously set using setgeckoflags. it is not yet implemented in the places history system. nsibrowserhistory.lastpagevisited:
contains the uri of the last page visited. this is used when the preference is set that causes the last page in new windows. nsibrowserhistory.count: the number of pages in history. this is used by the "clear history" button to determine if there are any pages in history. because actually counting all the pages in history is expensive,navhistory will always return the value 0 or 1. 0 is returned when the...
Creating the Component Code
er in packaging weblock. you should consult with the authors of the application you wish to extend to see if there are other supported ways. overview of the weblock module source as we mentioned in the previous section, components have layers. there are three main parts to every xpcom component. from the innermost and moving outward, the first object is the xpcom object. this is the object that
contains the business logic, that implements functionality such as starting a network download, implementing interfaces that listen to the download progress, or providing a new content type handler. in weblock, this is the part that brings together various gecko services and prevents users from leaving the list of acceptable domains. in a way, the factory and module layers are glue to plug the xpcom objec...
...r constructing an xpcom object. onion peel view of xpcom component creation before we begin looking at the various parts of the component and how they'll be implemented in the source, let's look at the module in weblock.cpp to see where we're going. the source we're referring to is listed in its entirety at the end of this chapter (see weblock1.cpp). the source file for the weblock component
contains three classes. in order to make the weblock component work in mozilla, you have to implement a new interface to the weblock component, iweblock, where the actual work specific to the the web locking features happens. you also have to create weblockmodule to implement the necessary nsimodule interface, and you have to create weblockfactory to implement nsifactory and create a factory that hands in...
Detailed XPCOM hashtable guide
ble are very large (larger than 12 words). pldhash does not handle large entry structures efficiently. nsthashtable nsthashtable is a c++ template that wraps pldhash. it hides many of the complexities of pldhash (callback functions, the ops structure, etc). you should read xpcom/glue/nsthashtable.h. to use nsthashtable, you must declare an entry-class in a pre-defined format. this entry class
contains the key and the data that you are hashing (just like pldhash, above). it also declares functions that manipulate the key. in most cases, the functions of this entry class can be entirely inline. for examples of entry classes, see the declarations at xpcom/glue/nshashkeys.h. the template parameter is the entry class. you must use the init() function to initalize the table properly. at this point,...
...are getentry and putentry. future plans nsisimpleenumerator support the (obsolete) nshashtable has a wrapper that exposes an nsisimpleenumerator on its items. i will add this support to the various nsbasehashtable classes as well, as needed. hash functions all of the above hashtables need a hash function. this function converts the key into a semi-unique integer. ...
Components.utils.cloneInto
if you do pass this flag, then functions in the object are cloned using the same mechanism as that used in components.utils.exportfunction: // add-on script var addonscriptobject = { greetme: function() { alert("hello from add-on"); } }; contentwindow.addonscriptobject = cloneinto(addonscriptobject, ...
...if you pass the {wrapreflectors:true} flag, then the object you clone is allowed to contain these objects: // add-on script var addonscriptobject = { body: contentwindow.document.body }; contentwindow.addonscriptobject = cloneinto(addonscriptobject, ...
nsIAccessible
can also be used by in-process accessibility clients to get information about objects in the accessible tree. the accessible tree is a subset of nodes in the dom tree -- such as documents, focusable elements and text. mozilla creates the implementations of nsiaccessible on demand. ...
...by accessible. getstate provides a bit fields of accessible states which describe boolean properties of accessible. groupposition this method returns grouping information. used for tree items, list items, tab panel labels, radio buttons, etc. also used for collectons of non-text objects. getchildatpoint this method returns an accessible child which
contains the coordinate at (x, y) in screen pixels. getchildat this method returns nth accessible child using zero-based index or last child if index than less than zero. getaccessibletoright this method returns an accessible node geometrically to the right of this one. getaccessibletoleft this method returns an accessible node geometrically to the left of t...
nsICookieManager2
netwerk/cookie/nsicookiemanager2.idlscriptable please add a summary to this article. last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) inherits from: nsicookiemanager this interface is included in the services.jsm javascript code module. ...
...ing to look for, such as "google.com". this should consist only of the host portion of the uri and should not contain a leading dot, port number, or other information. return value an nsisimpleenumerator of nsicookie2 objects representing the matching cookies. importcookies() imports an old-style cookie file. the imported cookies will be added to the existing cookie database. if the database
contains any cookies that are the same as those being imported (that is, they have the same domain, name, and path), they are replaced with the ones being imported. void importcookies( in nsifile acookiefile ); parameters acookiefile the file to import. this is usually cookies.txt. see also nsicookie nsicookie2 nsicookiemanager nsicookiepermission ...
nsIDOMWindowUtils
e window's current document has been forced by the user. cannot be accessed from unprivileged context (not content-accessible) read only. elementsrestyled read only unsigned long long the number of elements which have been restyled for the current document. keep in mind that during a restyle operation, an element may be restyled multiple times (for example, when an inline element
contains blocks). this number also counts restyling of pseudo-elements and anonymous boxes. throws ns_error_not_available if the count can't be provided. focusedinputtype string the type of the currently-focused html <input> element, if one is focused. imageanimationmode unsigned short returns the image animation mode of the window. the attribute's value must be one of the a...
...oardlayout, in long anativekeycode, in long amodifierflags, in astring acharacters, in astring aunmodifiedcharacters ); parameters anativekeyboardlayout anativekeycode the key code to send. amodifierflags the modifier flags to send. acharacters aunmodifiedcharacters sendnativemouseevent() see nsiwidget.synthesizenativemouseevent(). will be called on the widget that
contains aelement. cannot be accessed from unprivileged context (not content-accessible) will throw a dom security error if called without universalxpconnect privileges. void sendnativemouseevent( in long ascreenx, in long ascreeny, in long anativemessage, in long amodifierflags, in nsidomelement aelement ); parameters ascreenx ascreeny anativemessage amodifierflags aelemen...
nsIFeedTextConstruct
rious other feed-related interfaces, such as nsifeed, nsifeedentry, and nsifeedcontainer have attributes that return objects implementing nsifeedtextconstruct. method overview nsidomdocumentfragment createdocumentfragment(in nsidomelement element); astring plaintext(); attributes attribute type description base nsiuri if the text construct
contains html or xhtml, relative references in the content should be resolved against this base uri. lang astring the language of the text (such as "en-us" for u.s. english). text astring the actual text content. this string may contain markup if the type is either "html" or "xhtml". type astring the type of content described; one of "text", "html", or "xhtml".
...(such as "en-us" for u.s. english). text astring the actual text content. this string may contain markup if the type is either "html" or "xhtml". type astring the type of content described; one of "text", "html", or "xhtml". methods createdocumentfragment() creates a new document fragment on a given dom element, containing the text and (if the text construct
contains html or xhtml) its markup. nsidomdocumentfragment createdocumentfragment( in nsidomelement element ); parameters element the element in which to create the new document fragment. return value an nsidocumentfragment containing the text and markup. plaintext() returns the text as plain text with all markup stripped and all entities decoded. astring plaintext(); parameters none. r...
nsIHttpActivityObserver
available with this activity. see interpreting activity data below. interpreting activity data depending on the values of the aactivitytype and aactivitysubtype fields, the aextrasizedata and aextrastringdata parameters take on different meanings. socket transport activity when the activity type is activity_type_socket_transport and the subtype is status_sending_to, the aextrasizedata parameter
contains the number of bytes sent. because a single http transaction may consist of multiple chunks of data transmitted through separate socket writes, each socket activity notification will only reflect the number of bytes transmitted in that chunk. http transaction activity for activity notifications of type activity_type_http_transaction, there are three activities that include extra data: activity_su...
...ingle http transaction may consist of multiple chunks of data transmitted through separate socket writes, each socket activity notification will only reflect the number of bytes transmitted in that chunk. http transaction activity for activity notifications of type activity_type_http_transaction, there are three activities that include extra data: activity_subtype_request_header aextrastringdata
contains the text of the header. activity_subtype_response_header aextrastringdata
contains the text of the response header. activity_subtype_response_complete aextrasizedata
contains the total number of bytes received. see also http monitoring http activity nsihttpactivitydistributor ...
nsIIdleService
erver to be notified when the user idles for some period of time, and when they get back from that. the subject of the notification the observer will get is always the nsiidleservice itself. when the user goes idle, the observer topic is 'idle' and when they get back, the observer topic is 'back' in gecko 15 and earlier or 'active' in gecko 16 and later. the data parameter for the notification
contains the current user idle time in gecko 15 and earlier or 0 in gecko 16 and later. you can add the same observer twice. most implementations need to poll the os for idle info themselves, meaning your notifications could arrive with a delay up to the length of the polling interval in that implementation. current implementations use a delay of 5 seconds. gecko 1.9.2 note starting in gecko 1.9.
...ll the os for idle info themselves, meaning your notifications could arrive with a delay up to the length of the polling interval in that implementation. current implementations use a delay of 5 seconds. gecko 1.9.2 note starting in gecko 1.9.2, there is a once a day notification sent out if the user remains idle for an extended period: 'idle-daily'. the data parameter for the notification
contains the current user idle time. void addidleobserver( in nsiobserver observer, in unsigned long time ); parameters observer the nsiobserver to be notified. time the amount of time in seconds the user should be idle before the observer should be notified. removeidleobserver() remove an observer registered with addidleobserver(). note: removing an observer will remove it once, for the...
nsIInputStream
returns true. example consume all data from an input stream using read(). nsresult consumestream(nsiinputstream* astream) { nsresult rv; uint32_t numread; char buf[512]; while (1) { rv = astream->read(buf, sizeof(buf), &numread); if (ns_failed(rv)) { printf("### error reading stream: %x\n", rv); break; } if (numread == 0) break; // buf now
contains numread bytes of data } return rv; } consume all data from an input stream using readsegments(). static ns_method appendsegment(nsiinputstream* astream, void* aclosure, const char* afromsegment, uint32_t atooffset, uint32_t acount, uint...
... consume all data from an input stream using readsegments(). static ns_method appendsegment(nsiinputstream* astream, void* aclosure, const char* afromsegment, uint32_t atooffset, uint32_t acount, uint32_t* awritecount) { // afromsegment now
contains acount bytes of data. nsacstring* pbuf = (nsacstring*) aclosure; pbuf->append(afromsegment, acount); // indicate that we have consumed all of afromsegment *awritecount = acount; return ns_ok; } // copy the contents of astream into aresultbuf as one contiguous // buffer. use readsegments to avoid an intermediate buffer copy. nsresult copystream(nsiinputstream* astream, nsacstring& are...
nsIMsgDatabase
nsisimpleenumerator enumeratemessages(); nsisimpleenumerator enumeratethreads(); void s...
...can do without it. in 4.x, it was mainly used to remove corrupted databases. void forceclosed(); clearcachedhdrs() void clearcachedhdrs(); resethdrcachesize() void resethdrcachesize(in unsigned long size); getmsghdrforkey() nsimsgdbhdr getmsghdrforkey(in nsmsgkey key); parameters key getmsghdrformessageid() nsimsgdbhdr getmsghdrformessageid(in string messageid); parameters messageid
containskey() returns whether or not this database
contains the given key. boolean
containskey(in nsmsgkey key); parameters key createnewhdr() must call addnewhdrtodb after creating. the idea is that you create a new header, fill in its properties, and then call addnewhdrtodb. addnewhdrtodb will send notifications to any listeners. nsimsgdbhdr createnewhdr(in nsmsgkey key); addnewhdrtodb() void add...
nsIMsgFolder
sortkeys(in nsimsgfolder msgfolder); [noscript] void getsortkey(out octet_ptr key, out unsigned long length); boolean callfilterplugins(in nsimsgwindow amsgwindow); acstring getstringproperty(in string propertyname); void setstringproperty(in string propertyname, in acstring propertyvalue); boolean isancestorof(in nsimsgfolder folder); boolean
containschildnamed(in astring name); nsimsgfolder getchildnamed(in astring aname); nsimsgfolder findsubfolder(in acstring escapedsubfoldername); void addfolderlistener(in nsifolderlistener listener); void removefolderlistener(in nsifolderlistener listener); void notifypropertychanged(in nsiatom property, in acstring oldvalue, in acstring newvalue); voi...
...rplugins() boolean callfilterplugins(in nsimsgwindow amsgwindow); getstringproperty() acstring getstringproperty(in string propertyname); setstringproperty() void setstringproperty(in string propertyname, in acstring propertyvalue); isancestorof() determines if this folder is an ancestor of the supplied folder. boolean isancestorof(in nsimsgfolder folder);
containschildnamed() looks in immediate children of this folder for the given name. boolean
containschildnamed(in astring name); getchildnamed() return the child folder which the specified name. nsimsgfolder getchildnamed(in astring aname); findsubfolder() finds the sub folder with the specified name. note: even if the folder doesn't currently exist, a nsimsgfolder may be returned. nsimsgfol...
nsINavBookmarksService
void setkeywordforuri(in nsiuri uri, in astring keyword); obsolete since gecko 1.9 obsolete since gecko 40.0 attributes attribute type description bookmarksmenufolder long long the item id of the bookmarks menu folder. read only. note: renamed from bookmarksroot in gecko 1.9 placesroot long long the item id of the top-level folder that
contains bookmarks, tags and all other places data. this
contains administrative data as well as user data, and is therefore not recommended for use in queries. read only. tagsfolder long long the item id of the top-level folder that
contains the tag "folders". read only. note: renamed from tagroot in gecko 1.9 toolbarfolder long long the item id of the personal toolbar folde...
...thod removes a bookmark observer. void removeobserver( in nsinavbookmarkobserver observer ); parameters observer the bookmark observer to be removed. replaceitem() obsolete since gecko 1.9 (firefox 3) replace an item with a different item. void replaceitem( in print64 folder, in nsiuri item, in nsiuri newitem ); parameters folder the folder which
contains the item to replace. item the item which should be replaced. newitem the new item. runinbatchmode() this method runs the passed callback in batch mode (inside a database transaction). use this when a lot of things are about to change, for example adding or deleting a large number of bookmark items. calls can be nested. observers are notified when batches begin and end, via nsinavbookmarkob...
nsISound
event_alert_dialog_open 1 an alert dialog is opened. event_confirm_dialog_open 2 a confirm dialog is opened. event_prompt_dialog_open 3 a prompt dialog (one that allows the user to enter data, such as an authentication dialog) is opened. event_select_dialog_open 4 a select dialog (one that
contains a list box) is opened. event_menu_execute 5 a menu item is executed. event_menu_popup 6 a popup menu is shown. event_editor_max_len 7 more characters than the maximum allowed are typed into a text field. methods beep() plays a beep sound. void beep(); parameters none. init() not strictly necessary, b...
...en an alert dialog is opened. _moz_confirmdialog the system sound when a confirm dialog is opened. _moz_promptdialog the system sound when a prompt dialog (one that allows the user to enter data, such as an authentication dialog) is opened. _moz_selectdialog the system sound when a select dialog (one that
contains a list box) is opened. _moz_menucommand the system sound when a menu item is executed. _moz_menupopup the system sound when a popup menu is shown. ...
nsIUpdate
interface that describes an object representing an available update to the current application - this update may have several available patches from which one must be selected to download and install, for example we might select a binary difference patch first and attempt to apply that, then if the application process fails fall back to downloading a complete file-replace patch. this object also
contains information about the update that the front end and other application services can use to learn more about what is going on. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview nsiupdatepatch getpatchat(in unsigned long index); nsidomelement serialize(in nsidomdocument upda...
... replacement of the existing installation; false if the update is a patch representing the difference between the new version and the existing version. issecurityupdate boolean true if the update is a security update. if the update is a security update, a more seriously-worded user interface message is used to present the update to the user. licenseurl astring the url to an html fragment that
contains a license for the update. if this is specified, the user is shown the license file after they choose to install the update, and they must agree to it before the download begins. name astring the name of the update, in the form "application_name update_version" patchcount unsigned long the number of patches supplied by this update. read only. platformversion astring the toolkit version of th...
nsIVariant
6 then the high bits are lost. if the value was utf8 then it is converted to utf16 and the high bits are discarded. arrays and interface pointers cannot be converted to a string. native code only!getasstringwithsize void getasstringwithsize( out pruint32 size, [size_is(size), retval] out string str ); parameters size the length of the returned string. useful in case the string
contains embedded null characters. str the value is converted to an 8-bit string in the iso-8859-1 character set. if the value was utf16 then the high bits are lost. if the value was utf8 then it is converted to utf16 and the high bits are discarded. arrays and interface pointers cannot be converted to a string. native code only!getasuint16 pruint16 getasuint16(); parameters none. return v...
...string wstring getaswstring(); parameters none. return value the internal value is converted to a utf16 string. arrays and interface pointers cannot be converted to a string. native code only!getaswstringwithsize void getaswstringwithsize( out pruint32 size, [size_is(size), retval] out wstring str ); parameters size the length of the returned string. useful in case the string
contains embedded null characters. str the internal value is converted to a utf16 string. arrays and interface pointers cannot be converted to a string. ...
XUL Overlays
e no ambiguities relating to scoping of style sheets or scripts. style sheets and scripts loaded by the overlay simply apply to the entire master document. loading overlays dynamically the chrome registry makes it possible to load xul overlays dynamically -- or only when necessary. the chrome registry, which is a special rdf datasource into which user-specific information is persisted, or stored,
contains information about the components or additional packages that have been installed with the browser. when a component such as the "super stream player" from the examples above is registered there, overlays associated with that component are loaded automatically. when the component is not present, only the base files are loaded. loading overlays at runtime firefox 1.5 and other gecko 1.8-based appli...
...ent. in the base file, the html image element points to a netscape gif icon: <html:img id="foo" src="netscapeimage.gif"/> in the overlay, an element with the same id attribute specifies a different image, and that image is superimposed on top of the original netscape image as part of the merge process: <html:img id="foo" src="mozillaimage.gif"/> when the base file references an overlay file which
contains the html image element above, the new src attribute is superimposed over the original, and the mozilla icon replaces the netscape icon. overlay positioning xul overlays also support positioning of nodes. you can specify a position attribute on a node in the overlay to provide a hint for insertion into the master document. in the following example, the last menu item, example four, will be placed ...
Main Windows
overlay that only adds a few “new message” and “new card” commands to the menus, along with their associated javascript. msghdrviewoverlay.xul shown in blue above (where?), this overlay consists of three boxes. two are stacked showing either a brief or expanded view of the headers. the third is the attachment box which can be toggled into a slim or an expanded view basemenuoverlay.xul
contains the contents of most of the menus (i.e. file, edit, view, etc). osx only: macmenuoverlay.xul a special overlay for osx that adds a few items to the window menu. messagewindow.xul messagewindow.xul is shown when a message is opened. its almost exactly the same as messenger.xul in terms of overlays, but just lacks the folder and threadpanes normally shown. menus, toolbar buttons, and headers a...
...nd the status bar.it also includes most of the commands, keysets, and context menus of thunderbird, along with a whole lot of javascript. msghdrviewoverlay.xul shown in blue above, this overlay consists of three boxes. two are stacked showing either a brief or expanded view of the headers. the third is the attachment box which can be toggled into a slim or an expanded view basemenuoverlay.xul
contains the contents of most of the menus (i.e. file, edit, view, etc). osx only: macmenuoverlay.xul a special overlay for osx that adds a few items to the window menu. customizetoolbar.xul and customizetoolbarsheet.xul these are two old files from when the original customizable toolbars were ported from firefox (phoenix at the time) to thunderbird (minotaur at the time). customizetoolbar.xul looks ...
WebIDL bindings
ag a method or an attribute that needs to know the subject principal. this principal will be passed as argument. if the interface is not exposed on any worker global, the argument will be a nsiprincipal& because a subject principal is always available in mainthread globals. if the interface is exposed on some worker global, the argument will be a const maybe<nsiprincipal*>&. this maybe<> object
contains the principal only on the main thread; when the method is called on a worker thread, the value of the object will be nothing(). note that, in workers, it is always possible to retrieve the correct subject principal from the workerprivate object, though it cannot be used on the worker thread. [needssubjectprincipal] applies to both methods and attributes; for attributes it means both the getter ...
...//bugzilla.mozilla.org/show_bug.cgi?id=1333117 for details. static members static attributes and methods are not supported on js-implemented webidl (see bug 863952). however, with the changes in bug 1172785 you can route static methods to a c++ implementation on another object using a staticclassoverride annotation. this annotation includes the full, namespace-qualified name of the class that
contains an implementation of the named method. the include for that class must be found in a directory based on its name. [jsimplementation="@mozilla.org/dom/foo;1"] interface foo { [staticclassoverride="mozilla::dom::otherclass"] static promise<void> dosomething(); }; rather than calling into a method on the js implementation; calling foo.dosomething() will result in calling mozilla::dom::otherc...
PKCS #11 Netscape Trust Objects - Network Security Services
explicit level of trust to a certificate. examples of trust assertions are certificate authority root certificates. this document outlines the way in which nss stores trust objects via pkcs#11. this is not a new design, but documentation of the method already in use. trust objects a trust object describes a level of trust in a certificate for a given usage or purpose. conceptually a trust object
contains the following: certificate reference purpose + level of trust (multiple) purpose + level of trust a trust object ultimately denotes a level of trust in a certificate. the trust is expressed for a specific purpose (or usage). a trust object
contains multiple purposes and the level of trust for each one. examples of purposes are: email, code signing, authenticating a server. the levels of trust...
...uthenticating a server. the levels of trust are: untrusted: the certificate is explicitly untrusted. unknown: the trust is not known and should be determined elsewhere. trusted: the certificate itself is explicitly trusted. trusted delegator: the certificate is trusted as a certificate authority trust root, and confers its trust to other certificates. certificate reference each trust object
contains a reference to a certificate. there are two ways to refer to a certificate depending on whether that certificate is self-signed (like a certificate authority) or signed by another trusted certificate. certificates used as a root of trust are referred to by the complete hash of the der value of the certificate. certificates in a trust chain whose issuer is trusted are referred to by the der val...
Plug-in Basics - Plugins
ke that of an application, is completely controlled by the web page that calls it. this section gives you an overview of the way that plug-ins operate in the browser. when gecko starts, it looks for plugin modules in particular places on the system. for more information about where gecko looks for plugin modules on different systems, see how gecko finds plug-ins. when the user opens a page that
contains embedded data of a media type that invokes a plug-in, the browser responds with the following sequence of actions: check for a plug-in with a matching mime type load the plug-in code into memory initialize the plug-in create a new instance of the plug-in gecko can load multiple instances of the same plug-in on a single page, or in several open windows at the same time. if you are browsing...
... invoke plug-ins (see using the object element for plug-in display), the embed element can be used for backward compatibility with netscape 4.x browsers, and in cases where you specifically want to prompt the user to install a plug-in, because the default plug-in is only automatically invoked when you use the embed element. gecko loads an embedded plug-in when the user displays an html page that
contains an embedded object whose mime type is registered by a plug-in. plug-ins are embedded in much the same way as gif or jpeg images are, except that a plug-in can be live and respond to user events, such as mouse clicks. the embed element has the following syntax and attributes: <embed src="location" type="mimetype" pluginspage="instrurl" pluginurl="pluginurl" align="left"|"right"|"top"|"...
Debugger.Source - Firefox Developer Tools
about particular pieces of source code. debugger.source for javascript for a debugger.source instance representing a piece of javascript source code, its properties provide the source code itself as a string, and describe where it came from. each debugger.script instance refers to the debugger.source instance holding the source code from which it was produced. if a single piece of source code
contains both top-level code and function definitions, perhaps with nested functions, then the debugger.script instances for those all refer to the same debugger.source instance. each script indicates the substring of the overall source to which it corresponds. a debugger.source instance may represent only a portion of a larger source document. for example, an html document can contain javascript in mult...
...ntation. the format is yet to be specified in the webassembly standard. currently, the text is an s-expression based syntax. the text generation is disabled if the debugger has the allowwasmbinarysource property set, the "[wasm]" value will be returned in this case. binary if the instance refers to webassembly code and the debugger has the allowwasmbinarysource property set, a uint8array that
contains the webassembly bytecode. url if the instance refers to javascript source, the filename or url from which this script’s code was loaded. for scripts created by eval or the function constructor, this may be a synthesized filename, starting with a valid url and followed by information tracking how the code was introduced into the system; the entire string is not a valid url. for function.prot...
Debugger.Object - Firefox Developer Tools
al object, evaluatecode in that global environment, and return a completion value describing how it completed.code is a string. all extant handler methods, breakpoints, watchpoints, and so on remain active during the call. this function follows the invocation function conventions. if the referent is not a global object, throw a typeerror exception. codeis interpreted as strict mode code when it
contains a use strict directive. ifcode is not strict mode code, then variable declarations incode affect the referent global object. (in the terms used by the ecmascript specification, the variableenvironment of the execution context for the eval code is the referent.) theoptions argument is as for debugger.frame.prototype.eval. evalinglobalwithbindings(code,bindings, [options]) like evalinglob...
...thout having any effect on thebindings object.) this method allows debugger code to introduce temporary bindings that are visible to the given debuggee code and which refer to debugger-held debuggee values, and do so without mutating any existing debuggee environment. note that, like evalinglobal, if the code passed to evalinglobalwithbindings is not strict mode code, then any declarations it
contains affect the referent global object, even ascode is evaluated in an environment extended according tobindings. (in the terms used by the ecmascript specification, the variableenvironment of the execution context for non-strict eval code is the referent, and thebindings appear in a new declarative environment, which is the eval code's lexicalenvironment.) theoptions argument is as for debugger.fra...
Examine and edit HTML - Firefox Developer Tools
page in the same manner as the regular dom. the shadow root is signified by a node named #shadow-root — you can click its expansion arrow to see the full contents of the shadow dom, and then manipulate the contained nodes in a similar way to other part of the page's dom (although with a limited featureset — you can't, for example, drag and drop or delete shadow dom nodes). if a shadow dom
contains a "slotted" element (an element with a slot attribute after it has been inserted inside a <slot> element — see adding flexibility with slots for an explanation of how these are used), the "slotted" element will be shown inside its corresponding <slot> element, with a "reveal" link alongside it. clicking the "reveal" link will highlight the element with the slot attribute as it exists outside th...
...nt and you can't find the source of its content. note: shadow dom inspection was implemented in firefox 61, but was hidden behind the dom.webcomponents.shadowdom.enabled pref until firefox 63. it is now turned on by default. element popup context menu you can perform certain common tasks on a specific node using a popup context menu. to activate this menu, context-click the element. the menu
contains the following items — click on the links to find the description of each command in the context menu reference: edit as html create new node duplicate node delete node attributes add attribute copy attribute value edit attribute remove attribute break on ... subtree modification attribute modification node removal use in console show dom properties...
CSS Grid Inspector: Examine grid layouts - Firefox Developer Tools
hose grids. you can find out more about those in the section below. note: the layout view can be found underneath the layout tab on the right-hand pane of the page inspector. the above and below screenshots should give you further hints on how to get to this. grid options the grid section of the layout view looks like this: you'll see a number of options contained within: overlay grid:
contains a checkbox for each grid present on the page, along with various options. allows overlay views to be toggled on and off. grid display settings: display line numbers: turn the line numbers shown for each grid overlay on and off (on by default). display area names: turn area names on and off, in the case of grids with named grid areas (on by default, where relevant). extend lines infin...
... to it. clicking this also toggles the grid overlay on and off. a target icon that when clicked immediately selects the html element that this grid entry relates to, inside the html pane. a color picker icon that allows you to change the primary color of the grid overlay. this is useful for selecting different colors so you can easily tell your grids apart. inspecting a subgrid when the page
contains a grid with a subgrid, the entry for the subgrid is indented under its parent in the overlay grid section. when you select the checkbox for the subgrid, the lines for the parent grid are displayed also displayed; if the checkbox for the parent grid is unselected, then its lines are translucent. display line numbers by default, the line numbers are displayed on the grid overlay. unchecking ...
Work with animations - Firefox Developer Tools
ized along a timeline, with a draggable widget you can use to move to any point in the timeline and see the page at that point. it displays animations created using css transitions, css @keyframes rules, or the web animations api. starting in firefox 48, it will show animations applied to the ::before and ::after pseudo-elements. to see how it works, we'll walk through an example. the box below
contains a grayscale icon, representing firefox developer edition. if you click the icon, it enlarges and changes to color, and the name of the browser appears. click the icon again to reverse the effect. these animations are made using the web animations api. let's use the animation inspector to see what's going on in this example. right-click in the box and select "inspect element" make sure the...
...st animation, and is labeled with markers every 250 milliseconds (this depends on the time scale of the animations currently displayed). animation bars each animation or transition is shown as a horizontal bar laid across the timeline. the bar is: blue if a transition was used to animate a property orange if a @keyframes animation was used green if the web animations api was used the bar
contains a lightning bolt icon if the property was animated using the compositor thread (see more about the cost of animating different css properties). the bar is shaped to reflect the easing effect used for the animation. in the example above you can see that the first bar is concave, representing ease-in, and the second is convex, representing ease-out. if the animation used css transitions, there i...
UI Tour - Firefox Developer Tools
note that if you do this, you lose any recordings you have not saved. filter the markers that are displayed in the waterfall view switch the active tool in the details pane. ...
...luding any you have made in this session and any you have imported. at any given time, one recording is selected, and that recording is displayed in the rest of the tool. to select a different recording, click its entry in the pane. to save the recording as a json file click "save". recording overview this displays an overview of the entire recording, with the x-axis representing time. it
contains two elements: an overview of the waterfall and a frame rate graph. waterfall overview this presents a compressed view of the waterfall: recorded operations are color-coded using the same scheme as in the main waterfall view. frame rate graph the frame rate gives you an overview of the browser's responsiveness during the recording: see the separate article on frame rate. correlating eve...
Style Editor - Firefox Developer Tools
sheets that it detects, without affecting the original. this makes it much easier to work on pages that have been optimized. the style editor supports autocomplete. just start typing, and it will offer you a list of suggestions. you can switch autocomplete off in the style editor settings. the media sidebar the style editor displays a sidebar on the right-hand side whenever the current sheet
contains any @media rules. the sidebar lists the rules and provides a link to the line of the sheet where the rule is defined. click an item to jump to that rule in the sheet. the condition text of the rule is greyed-out if the media query doesn’t currently apply. the media sidebar works especially well with responsive design view for creating and debugging responsive layouts: from firefox 46 onward...
...e sidebar lists the rules and provides a link to the line of the sheet where the rule is defined. click an item to jump to that rule in the sheet. the condition text of the rule is greyed-out if the media query doesn’t currently apply. the media sidebar works especially well with responsive design view for creating and debugging responsive layouts: from firefox 46 onwards, if an @media rule
contains a screen size in a condition, then it is made clickable: clicking it then resizes the screen to that size using the responsive design view: creating and importing style sheets you can create a new style sheet by clicking the new button in the toolbar. then you can just start entering css into the new editor and watch as the new styles are applied in real time just like changes to the other sh...
Firefox Developer Tools
if you have any feedback on devtools, or want to contribute to the project, you can join the devtools community. ...
...ll help you — see getting started with the web and what are browser developer tools? for good starting points. the core tools you can open the firefox developer tools from the menu by selecting tools > web developer > toggle tools or use the keyboard shortcut ctrl + shift + i or f12 on windows and linux, or cmd + opt + i on macos. the ellipsis menu on the right-hand side of developer tools
contains several commands that let you perform actions or change tool settings. this button only appears when there are multiple iframes on a page. click it to display a list of the iframes on the current page and select the one with which you want to work. click this button to take a screenshot of the current page. (note: this feature is not turned on by default and must be e...
AesGcmParams - Web APIs
nist sp800-38d, in particular section 5.2.1.1 on input data. properties name a domstring. this should be set to aes-gcm. iv a buffersource — the initialization vector. this must be unique for every encryption operation carried out with a given key. put another way: never reuse an iv with the same key. ...
... the aes-gcm specification recommends that the iv should be 96 bits long, and typically
contains bits from a random number generator. section 8.2 of the specification outlines methods for constructing ivs. note that the iv does not have to be secret, just unique: so it is ok, for example, to transmit it in the clear alongside the encrypted message. additionaldata optional a buffersource. this
contains additional data that will not be encrypted but will be authenticated along with the encrypted data. if additionaldata is given here then the same data must be given in the corresponding call to decrypt(): if the data given to the decrypt() call does not match the original data, the decryption will throw an exception. this gives you a way to authenticate associated data without having to encrypt ...
AudioBuffer - Web APIs
ing the audiocontext.decodeaudiodata() method, or from raw data using audiocontext.createbuffer(). once put into an audiobuffer, the audio can then be played by being passed into an audiobuffersourcenode. objects of these types are designed to hold small audio snippets, typically less than 45 s. for longer sounds, objects implementing the mediaelementaudiosourcenode are more suitable. the buffer
contains data in the following format: non-interleaved ieee754 32-bit linear pcm with a nominal range between -1 and +1, that is, 32bits floating point buffer, with each samples between -1.0 and 1.0. if the audiobuffer has multiple channels, they are stored in separate buffer. constructor audiobuffer() creates and returns a new audiobuffer object instance. properties audiobuffer.samplerate read ...
...// this is the audionode to use when we want to play an audiobuffer var source = audioctx.createbuffersource(); // se...
AudioBufferSourceNode.buffer - Web APIs
the buffer property of the audiobuffersourcenode interface provides the ability to play back audio using an audiobuffer as the source of the sound data. if the buffer property is set to the value null, the node generates a single channel containing silence (that is, every sample is 0). syntax audiobuffersourcenode.buffer = soundbuffer; value an audiobuffer which
contains the data representing the sound which the node will play. example for a full working example, see this code running live, or view the source. var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.samplerate); button.onclick = function() { // fill the buffer with white noise; //just random values between -1.0 and 1.0 for (var channel = 0; channel < channels; channel++) { // this gives us the actual...
...e will play. example for a full working example, see this code running live, or view the source. var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.samplerate); button.onclick = function() { // fill the buffer with white noise; //just random values between -1.0 and 1.0 for (var channel = 0; channel < channels; channel++) { // this gives us the actual arraybuffer that
contains the data var nowbuffering = myarraybuffer.getchanneldata(channel); for (var i = 0; i < framecount; i++) { // math.random() is in [0; 1.0] // audio needs to be in [-1.0; 1.0] nowbuffering[i] = math.random() * 2 - 1; } } // get an audiobuffersourcenode. // this is the audionode to use when we want to play an audiobuffer var source = audioctx.createbuffersource(); ...
AudioBufferSourceNode - Web APIs
ospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">audiobuffersourcenode</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} an audiobuffersourcenode has no inputs and exactly one output, which has the same number of channels as the audiobuffer indicated by its buffer property. if there's no buffer set—that is, if buffer is null—the output
contains a single channel of silence (every sample is 0). an audiobuffersourcenode can only be played once; after each call to start(), you have to create a new node if you want to play the same sound again. fortunately, these nodes are very inexpensive to create, and the actual audiobuffers can be reused for multiple plays of the sound. indeed, you can use these nodes in a "fire and forget" manner: crea...
...// this is the audionode to use when we want to play an audiobuffer var source = audioctx.createbuffersource(); // set...
CredentialsContainer.create() - Web APIs
ce returns a promise that resolves with a new credential instance based on the provided options, or null if no credential object can be created. this method is restricted to top-level contexts. calls to it within an <iframe> element will resolve without effect. syntax var promise = credentialscontainer.create([options]) parameters options an object of type credentialcreationoptions that
contains options for the requested new credentials object. it must include one of the options "password", "federated", or "publickey". the options are: password: optional either an htmlformelement, or a passwordcredentialdata object. tbd id: (required) usvstring inherited from credentialdata. name: optional usvstring tbd iconurl: optional usvstring tbd password: (required) usvstrin...
... of the options "password", "federated", or "publickey". the options are: password: optional either an htmlformelement, or a passwordcredentialdata object. tbd id: (required) usvstring inherited from credentialdata. name: optional usvstring tbd iconurl: optional usvstring tbd password: (required) usvstring tbd federated: optional an federatedcredentialinit object.
contains requirements for creating/obtaining federated credentials. the available options are: id: (required) usvstring inherited from credentialdata. name: optional usvstring tbd iconurl: optional usvstring tbd provider: (required) usvstring tbd protocol: optional usvstring tbd publickey: optional an publickeycredentialcreationoptions object that describes the options for...
DOMMatrixReadOnly - Web APIs
stored into the array as double-precision floating-point numbers in column-major (colexographical access access or "colex") order. (in other words, down the first column from top to bottom, then the second column, and so forth.) dommatrixreadonly.tojson() returns a json representation of the dommatrixreadonly object. ...
...see the css matrix3d() function for details on the 3d notation's syntax. ...
DataTransfer - Web APIs
roperties standard properties datatransfer.dropeffect gets the type of drag-and-drop operation currently selected or sets the operation to a new type. the value must be none, copy, link or move. datatransfer.effectallowed provides all of the types of operations that are possible. must be one of none, copy, copylink, copymove, link, linkmove, move, all or uninitialized. datatransfer.files
contains a list of all the local files available on the data transfer. if the drag operation doesn't involve dragging files, this property is an empty list. datatransfer.items read only gives a datatransferitemlist object which is a list of all of the drag data. datatransfer.types read only an array of strings giving the formats that were set in the dragstart event. gecko properties note: all ...
...datatransfer.mozitemcount read only gives the number of items in the drag operation. removed in firefox 71. methods standard methods datatransfer.cleardata() remove the data associated with a given type. the type argument is optional. if the type is empty or not specified, the data associated with all types is removed. if data for the specified type does not exist, or the data transfer
contains no data, this method will have no effect. datatransfer.getdata() retrieves the data for a given type, or an empty string if data for that type does not exist or the data transfer
contains no data. datatransfer.setdata() set the data for a given type. if data for the type does not exist, it is added at the end, such that the last item in the types list will be the new format. if data for the t...
Detecting device orientation - Web APIs
ata on mobile devices. this is useful for overcoming some of the differences in device support for device orientation. window.addeventlistener("deviceorientation", handleorientation, true); after registering your event listener (in this case, a javascript function called handleorientation()), your listener function periodically gets called with updated orientation data. ...
...the direction are reversed. processing motion events motion events are handled the same way as the orientation events except that they have their own event's name: devicemotion window.addeventlistener("devicemotion", handlemotion, true); what's really changed are the information provided within the devicemotionevent object passed as a parameter of the handlemotion function. the motion event
contains four properties: devicemotionevent.acceleration devicemotionevent.accelerationincludinggravity devicemotionevent.rotationrate devicemotionevent.interval motion values explained the devicemotionevent objects provide web developers with information about the speed of changes for the device's position and orientation. the changes are provided along three axis (see orientation and motion dat...
Document.title - Web APIs
document.title = newtitle; newtitle is the new title of the document. the assignment affects the return value of document.title, the title displayed for the document (e.g. ...
... document.title = newtitle; newtitle is the new title of the document. the assignment affects the return value of document.title, the title displayed for the document (e.g. ...
EventTarget.addEventListener() - Web APIs
break; case 6: // some code he...
...d is suitable when you don't need to know which html element the event listener fired on programmatically from within the event listener. the primary benefit to doing this is that the event listener receives the data in much the same way that it would if you were to actually pass it through its argument list. getting data into an event listener using the outer scope property when an outer scope
contains a variable declaration (with const, let), all the inner functions declared in that scope have access to that variable (look here for information on outer/inner functions, and here for information on variable scope). therefore, one of the simplest ways to access data from outside of an event listener is to make it accessible to the scope in which the event listener is declared. const mybutton = d...
FileReader - Web APIs
his event is triggered while reading a blob content. as filereader inherits from eventtarget, all those events can also be listened for by using the addeventlistener method. methods filereader.abort() aborts the read operation. upon return, the readystate will be done. filereader.readasarraybuffer() starts reading the contents of the specified blob, once finished, the result attribute
contains an arraybuffer representing the file's data. filereader.readasbinarystring() starts reading the contents of the specified blob, once finished, the result attribute
contains the raw binary data from the file as a string. filereader.readasdataurl() starts reading the contents of the specified blob, once finished, the result attribute
contains a data: url representing the file's data. filereade...
...an optional encoding name can be specified. events listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface. abort fired when a read has been aborted, for example because the program called filereader.abort(). ...
GeolocationPosition.coords - Web APIs
syntax let coord = geolocationpositioninstance.coords value a geolocationcoordinates object instance. ...
... syntax let coord = geolocationpositioninstance.coords value a geolocationcoordinates object instance. ...
Using the Geolocation API - Web APIs
sition.coords.latitude, position.coords.longitude); } function error() { alert('sorry, no position available.'); } const options = { enablehighaccuracy: true, maximumage: 30000, timeout: 27000 }; const watchid = navigator.geolocation.watchposition(success, error, options); describing a position the user's location is described using a geolocationposition object instance, which itself
contains a geolocationcoordinates object instance. the geolocationposition instance
contains only two things, a coords property that
contains the geolocationcoordinates instance, and a timestamp property that
contains a domtimestamp instance representing the time at which the position data was retrieved. the geolocationcoordinates instance
contains a number of properties, but the two you'll use most com...
...r bits of information from a geolocationcoordinates object, including altitude, speed, what direction the device is facing, and an accuracy measure of the altitude, longitude, and latitude data. handling errors the error callback function, if provided when calling getcurrentposition() or watchposition(), expects a geolocationpositionerror object instance as its first parameter. this object type
contains two properties, a code indicating what type of error has been returned, and a human-readable message that describes what the error code means. you could use it like so: function errorcallback(error) { alert(`error(${error.code}): ${error.message}`); }; examples in the following example the geolocation api is used to retrieve the user's latitude and longitude. if sucessful, the available hy...
Geolocation API - Web APIs
tion retrieval is unsuccessful, the callback executes with a geolocationpositionerror object as its only parameter, providing access information on what went wrong. an optional positionoptions object, which provides options for retrieval of the position data. for further information on geolocation usage, read using the geolocation api. interfaces geolocation the main class of this api —
contains methods to retrieve the user's current position, watch for changes in their position, and clear a previously-set watch. geolocationposition represents the position of a user. a geolocationposition instance is returned by a successful call to one of the methods contained inside geolocation, inside a success callback, and
contains a timestamp plus a geolocationcoordinates object instance. geoloc...
...eviously-set watch. geolocationposition represents the position of a user. a geolocationposition instance is returned by a successful call to one of the methods contained inside geolocation, inside a success callback, and
contains a timestamp plus a geolocationcoordinates object instance. geolocationcoordinates represents the coordinates of a user's position; a geolocationcoordinates instance
contains latitude, longitude, and other important related information. geolocationpositionerror a geolocationpositionerror is returned by an unsuccessful call to one of the methods contained inside geolocation, inside an error callback, and
contains an error code and message. navigator.geolocation the entry point into the api. returns a geolocation object instance, from which all other functionality c...
HTMLImageElement.alt - Web APIs
ages, imagine what you would say when reading the page to someone over the phone without mentioning that there's an image on the page. the alternate text is displayed in the space the image would occupy and should be able to take the place of the image without altering the meaning of the page. syntax htmlimageelement.alt = alttext; let alttext = htmlimageelement.alt; value a domstring which
contains the alternate text to display when the image is not loaded or for use by assistive devices. the alt attribute is officially mandatory; it's meant to always be specified. if the image doesn't require a fallback (such as for an image which is simply decorative or an advisory icon of minimal importance), you may specify an empty string (""). for compatibility reasons, browsers generally will accept...
...this is true whether the /me image is in a bitmapped format such as png or jpeg or in a vector format like svg. for a map, the alt text could be directions to the place indicated by the map, similarly to how you would explain it verbally. for a chart, the text ...
HTMLOptionElement - Web APIs
4" stroke-width="2px" /><text x="406" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmloptionelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmloptionelement.defaultselected is a boolean that
contains the initial value of the selected html attribute, indicating whether the option is selected by default or not. htmloptionelement.disabled is a boolean representing the value of the disabled html attribute, which indicates that the option is unavailable to be selected. an option can also be disabled if it is a child of an <optgroup> element that is disabled. htmloptionelement.form read only ...
...ent, the value is 0. htmloptionelement.label read only is a domstring that reflects the value of the label html attribute, which provides a label for the option. if this attribute isn't specifically set, reading it returns the element's text content. htmloptionelement.selected is a boolean that indicates whether the option is currently selected. htmloptionelement.text is a domstring that
contains the text content of the element. htmloptionelement.value is a domstring that reflects the value of the value html attribute, if it exists; otherwise reflects value of the node.textcontent property. methods inherits methods from its parent, htmlelement. option() is a constructor creating an htmloptionelement object. it has four values: the text to display, text, the value associated, valu...
HTMLTextAreaElement - Web APIs
selectiondirection string: returns / sets the direction in which selection occurred. this is "forward" if selection was performed in the start-to-end direction of the current locale, or "backward" for the opposite direction. this can also be "none" if the direction is unknown. selectionend unsigned long: returns / sets the index of the end of selected text. ...
...on being set, the control behaves as if setselectionrange() had been called with this as the first argument, and selectionend as the second argument. tabindex long: returns / sets the position of the element in the tabbing navigation order for the current document. ...
In depth: Microtasks and the JavaScript runtime environment - Web APIs
as each context is created, it is placed on the execution context stack. when it exits, the context is removed from the context stack. upon starting the program, the global context is created. when greetuser("mike") is reached, a context is created for the greetuser...
... web content runs within," including an actual window, a tab, or a frame. there are specific circumstances in which this sharing of an event loop among windows with a common origin is possible, such as: if one window opened the other window, they are likely to be sharing an event loop. if a window is actually a container within an <iframe>, it likely shares an event loop with the window that
contains it. the windows happen to share the same process in a multi-process web browser implementation. the specifics may vary from browser to browser, depending on how they're implemented. tasks vs microtasks a task is any javascript scheduled to be run by the standard mechanisms such as initially starting to execute a program, an event triggering a callback, and so forth. other than by using event...
Drag Operations - Web APIs
ansfer which holds the drag data (datatransfer is a datatransfer object). when a drag occurs, data must be associated with the drag which identifies what is being dragged. for example, when dragging the selected text within a textbox, the data associated with the drag data item is the text itself. similarly, when dragging a link on a web page, the drag data item is the link's url. the drag data
contains two pieces of information, the type (or format) of the data, and the data's value. the format is a type string (such as text/plain for text data), and the value is a string of text. when the drag begins, you add data by providing a type and the data. during the drag, in an event listener for the dragenter and dragover events, you use the data types of the data being dragged to check whether a dro...
...ll replace the old data, but in the same position within the list of types as the old data. you can clear the data using the cleardata() method, which takes one argument: the type of the data to remove. event.datatransfer.cleardata("text/uri-list"); the type argument to the cleardata() method is optional. if the type is not specified, the data associated with all types is removed. if the drag
contains no drag data items, or all of the items have been subsequently cleared, then no drag will occur. setting the drag feedback image when a drag occurs, a translucent image is generated from the drag target (the element the "dragstart" event is fired at), and follows the user's pointer during the drag. this image is created automatically, so you do not need to create it yourself. however, you can u...
Working with the History API - Web APIs
ate() takes three parameters: a state object; a title (currently ignored); and (optionally), a url. let's examine each of these three parameters in more detail. state object the state object is a javascript object which is associated with the new history entry created by pushstate(). whenever the user navigates to the new state, a popstate event is fired, and the state property of the event
contains a copy of the history entry's state object. the state object can be anything that can be serialized. because firefox saves state objects to the user's disk so they can be restored after the user restarts the browser, we impose a size limit of 640k characters on the serialized representation of a state object. if you pass a state object whose serialized representation is larger than this to pushs...
.../mozilla.org/bar2.html. if the user now clicks back again, the url bar will display http://mozilla.org/foo.html, and totally bypass bar.html. the popstate event a popstate event is dispatched to the window every time the active history entry changes. if the history entry being activated was created by a call to pushstate or affected by a call to replacestate, the popstate event's state property
contains a copy of the history entry's state object. see window.onpopstate for sample usage. reading the current state when your page loads, it might have a non-null state object. this can happen, for example, if the page sets a state object (using pushstate() or replacestate()) and then the user restarts their browser. when the page reloads, the page will receive an onload event, but no popstate even...
IDBDatabase - Web APIs
methods inherits from: eventtarget ...
...y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">idbdatabase</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties idbdatabase.name read only a domstring that
contains the name of the connected database. idbdatabase.version read only a 64-bit integer that
contains the version of the connected database. when a database is first created, this attribute is an empty string. idbdatabase.objectstorenames read only a domstringlist that
contains a list of the names of the object stores currently in the connected database. methods inherits from: eventtarget idbdatabase.close() returns immediately and closes the connection to a database in a separate threa...
MediaCapabilitiesInfo - Web APIs
e of the media capabilities api is made available when the promise returned by the mediacapabilities.encodinginfo() or mediacapabilities.decodinginfo() methods of the mediacapabilities interface fulfills, providing information as to whether the media type is supported, and whether encoding or decoding such media would be smooth and power efficient. properties the mediacapabilitiesinfo interface
contains three boolean attribues: supported: given the properties defined in the mediaconfiguration, can the specified piece of media content be encoded (if mediaencodingconfiguration is set) or decode (if mediadecodingconfiguration is set) at all? if yes, supported is true. otherwise, it is false. smooth: given the properties defined in the mediaconfiguration, will the playback of the specified piece...
.... all supported audio codecs are reported to be power efficient. ...
MediaStreamAudioSourceNode.mediaStream - Web APIs
the user agent uses the first audio track it finds on the specified stream as the audio source for this node. ...
... the user agent uses the first audio track it finds on the specified stream as the audio source for this node. however, there is no way to be certain which track that will be on multi-track streams. ...
Media Source API - Web APIs
ng it for use with dash, dash file servers, and dash client libraries written in javascript. interfaces mediasource represents a media source to be played via an htmlmediaelement object. sourcebuffer represents a chunk of media to be passed into an htmlmediaelement via a mediasource object. sourcebufferlist a simple container list for multiple sourcebuffer objects. videoplaybackquality
contains information about the quality of video being played by a <video> element, such as number of dropped or corrupted frames. returned by the htmlvideoelement.getvideoplaybackquality() method. trackdefault provides a sourcebuffer with kind, label, and language information for tracks that do not contain this information in the initialization segments of a media chunk. trackdefaultlist a simple cont...
...e container list for multiple trackdefault objects. extensions to other interfaces url.createobjecturl() creates an object url pointing to a mediasource object that can then be specified as the src value of an html media element to play a media stream. htmlmediaelement.seekable when a mediasource object is played by an html media element, this property will return a timeranges object that
contains the time ranges that the user is able to seek to. htmlvideoelement.getvideoplaybackquality() returns a videoplaybackquality object for the currently played video. audiotrack.sourcebuffer, videotrack.sourcebuffer, texttrack.sourcebuffer returns the sourcebuffer that created the track in question. specifications specification status comment media source extensions ...
Node.compareDocumentPosition() - Web APIs
node.comparedocumentposition() method reports the position of the given node relative to another node in any document — not just the given node’s document. the return value is a bitmask of the following values: name value document_position_disconnected 1 document_position_preceding 2 document_position_following 4 document_position_
contains 8 document_position_contained_by 16 document_position_implementation_specific 32 syntax comparemask = node.comparedocumentposition(othernode) parameters othernode the other node with which to compare the first node’s document position. return value an integer value whose bits represent the othernode's relationship to the calling node. more than one b...
... 32 syntax comparemask = node.comparedocumentposition(othernode) parameters othernode the other node with which to compare the first node’s document position. return value an integer value whose bits represent the othernode's relationship to the calling node. more than one bit is set if multiple scenarios apply. for example, if othernode is located earlier in the document and
contains the node on which comparedocumentposition() was called, then both the document_position_
contains and document_position_preceding bits would be set, producing a value of 10 (0x0a). example const head = document.head; const body = document.body; if (head.comparedocumentposition(body) & node.document_position_following) { console.log('well-formed document'); } else { console.error('<head> is ...
Node - Web APIs
ent node. if the argument referenced an existing node on the dom tree, the node will be detached from its current position and attached at the new position. node.clonenode() clone a node, and optionally, all of its contents. by default, it clones the content of the node. node.comparedocumentposition() compares the position of the current node against another node in any other document. node.
contains() returns a boolean value indicating whether or not a node is a descendant of the calling node. node.getboxquads() returns a list of the node's css boxes relative to another node. node.getrootnode() returns the context object's root which optionally includes the shadow root if it is available. node.haschildnodes() returns a boolean indicating whether or not the element has any child nod...
...s()) { const nodes = rootnode.childnodes for (let i = 0, l = nodes.length; i < l; ++i) { if (false === eachnode(nodes[i], callback)) { return } } } } syntax eachnode(rootnode, callback) description recursively calls a function for each descendant node of rootnode (including the root itself). if callback is omitted, the function returns an array instead, which
contains rootnode and all nodes contained within. if callback is provided, and it returns boolean false when called, the current recursion level is aborted, and the function resumes execution at the last parent's level. this can be used to abort loops once a node has been found (such as searching for a text node which
contains a certain string). parameters rootnode the node object whose descendants ...
PaymentAddress.country - Web APIs
the country read-only property of the paymentaddress interface is a string identifying the address's country using the iso 3166-1 alpha-2 standard. the string is always in its canonical upper-case form. some examples of valid country values: "us", "gb", "cn", or "jp". syntax var paymentcountry = paymentaddress.country; value a domstring which
contains the iso3166-1 alpha-2 code identifying the country in which the address is located, or an empty string if no country is available, which frequently can be assumed to mean "same country as the site owner." usage notes if the payment handler validates the address and determines that the value of country is invalid, a call to paymentrequestupdateevent.updatewith() will be made with a details object containing a shippingaddresserrors field. that ...
... specifications specification status comment payment request apithe definition of 'paymentaddress.country' in that specification. candidate recommendation initial definition. ...
PaymentAddress - Web APIs
r, rural delivery route, descriptive instructions, or post office box number. paymentaddress.country read only a domstring specifying the country in which the address is located, using the iso-3166-1 alpha-2 standard. the string is always given in its canonical upper-case form. some examples of valid country values: "us", "gb", "cn", or "jp". paymentaddress.city read only a domstring which
contains the city or town portion of the address. paymentaddress.dependentlocality read only a domstring giving the dependent locality or sublocality within a city, for example, a neighborhood, borough, district, or uk dependent locality. paymentaddress.organization read only a domstring specifying the name of the organization, firm, company, or institution at the payment address. paymentaddress.ph...
...mentrequest() constructor is used to create a new payment request, which takes three objects as parameters — one containing details of the payment methods that can be used for the payment, one containing details of the actual order (such as items bought and shipping options), and an optional object containing further options. the first of these three (supportedinstruments in the example below)
contains a data property that has to conform to the structure defined by the basiccardrequest dictionary. const supportedinstruments = [ { supportedmethods: "basic-card", }, ]; const details = { total: { label: "donation", amount: { currency: "usd", value: "65.00" } }, displayitems: [ { label: "original donation amount", amount: { currency: "usd", value: "65.00" }, }, ]...
PaymentDetailsUpdate.shippingAddressErrors - Web APIs
for each property in paymentaddress, a property by the same name is found in shippingaddresserrors if and only if a validation error occurred for that property. ...
...for each property in paymentaddress, a property by the same name is found in shippingaddresserrors if and only if a validation error occurred for that property. ...
PaymentRequest.show() - Web APIs
the validateresponse() method, below, is called once show() returns, in order to look at the returned response and either submit the payment or reject the payment as failed: async function validateresponse(response) { try { if (await checkallvalues(response)) { await response.complete("success"); } else { ...
... = async function handlepurchase() { // initialization of paymentrequest arguments are excerpted for the sake of // brevity. const payment = new paymentrequest(methods, details, options); try { const response = await payment.show(); // process response here, including sending payment instrument // (e.g., credit card) information to the server. // paymentresponse.methodname
contains the selected payment method // paymentresponse.details
contains a payment method specific response await response.complete("success"); } catch (err) { console.error("uh oh, something bad happened", err.message); } } the following example shows how to update the payment sheet as it's being presented to the end-user. async function requestpayment() { // we start with au$0 as th...
Using the Permissions API - Web APIs
just be walking through the permissions api-related code, so check the code yourself if you want to study any of the other parts. accessing the permissions api the navigator.permissions property has been added to the browser to allow access to the global permissions object. this object will eventually include methods for querying, requesting, and revoking permissions, although currently it only
contains permissions.query(); see below. querying permission state in our example, the permissions functionality is handled by one function — handlepermission(). this starts off by querying the permission status using permissions.query(). depending on the value of the state property of the permissionstatus object returned when the promise resolves, it reacts differently: "granted" the "enable geo...
...some apis have more complex permissiondescriptors containing additional information, which inherit from the default permissiondescriptor. for example, the pushpermissiondescriptor should also contain a boolean that specifies if uservisibleonly is true or false. revoking permissions starting in firefox 47, you can now revoke existing permissions, using ...
Pointer Lock API - Web APIs
lock = document.exitpointerlock || document.mozexitpointerlock; // attempt to unlock document.exitpointerlock(); pointerlockchange event when the pointer lock state changes—for example, when calling requestpointerlock(), exitpointerlock(), the user pressing the esc key, etc.—the pointerlockchange event is dispatched to the document. this is a simple event and
contains no extra data. if ("onpointerlockchange" in document) { document.addeventlistener('pointerlockchange', lockchangealert, false); } else if ("onmozpointerlockchange" in document) { document.addeventlistener('mozpointerlockchange', lockchangealert, false); } function lockchangealert() { if(document.pointerlockelement === canvas || document.mozpointerlockelement === canvas) { console.lo...
...sole.log('the pointer lock status is now locked'); // do something useful in response } else { console.log('the pointer lock status is now unlocked'); // do something useful in response } } pointerlockerror event when there is an error caused by calling requestpointerlock() or exitpointerlock(), the pointerlockerror event is dispatched to the document. this is a simple event and
contains no extra data. document.addeventlistener('pointerlockerror', lockerror, false); document.addeventlistener('mozpointerlockerror', lockerror, false); function lockerror(e) { alert("pointer lock failed"); } note: until firefox 50 the above events were prefixed with moz in firefox. extensions to mouse events the pointer lock api extends the normal mouseevent interface with movement attributes.
PublicKeyCredential.getClientExtensionResults() - Web APIs
during the creation or fetching of a publickeycredential (respectively via navigator.credentials.create() and navigator.credentials.get()), it is possible to have "custom" processing by the client for different extensions which are respectively given by publickeycredentialcreationoptions.extensions and publickeycredentialrequestoptions.extensions. note: extensions are optional and different browsers may recognize different extensions. ...
...es not know of a given extension, that will not cause any failure. note: this method may only be used in top-level contexts and will not be available in an <iframe> for example. syntax maparraybuffer = publickeycredential.getclientextensionresults() parameters none. return value an arraybuffer containing the result of the processing of the different extensions by the client. this object
contains a map between the extensions' identifiers and their results from the processing. warning! as of march 2019, only appid (used during creation with publickeycredentialrequestoptions.extensions) is supported by chrome and edge. firefox does not seem to support any extension. examples var publickey = { // here are the extensions (as "inputs") extensions: { "loc": true, // this extension ...
Push API - Web APIs
fication. note: chrome versions earlier than 52 require you to set up a project on google cloud messaging to send push messages, and use the associated project number and api key when sending push notifications. it also requires an app manifest, with some special parameters to use this service. interfaces pushevent represents a push action, sent to the global scope of a serviceworker. it
contains information sent from an application to a pushsubscription. pushmanager provides a way to receive notifications from third-party servers, as well as request urls for push notifications. this interface has replaced the functionality offered by the obsolete pushregistrationmanager interface. pushmessagedata provides access to push data sent by a server, and includes methods to manipulate the re...
... fired whenever a push event occurs; that is, whenever a server push message is received. serviceworkerglobalscope.onpushsubscriptionchange an event handler fired whenever a pushsubscriptionchange event occurs; for example, when a push subscription has been invalidated, or is about to be invalidated (e.g. when a push service sets an expiration time.) examples mozilla's serviceworker cookbook
contains many useful push examples. specifications specification status comment push api working draft initial definition ...
RTCPeerConnection.createAnswer() - Web APIs
the createanswer() method on the rtcpeerconnection interface creates an sdp answer to an offer received from a remote peer during the offer/answer negotiation of a webrtc connection. the answer
contains information about any media already attached to the session, codecs and options supported by the browser, and any ice candidates already gathered. the answer is delivered to the returned promise, and should then be sent to the source of the offer to continue the negotiation process. syntax apromise = rtcpeerconnection.createanswer([options]); rtcpeerconnection.createanswer(successcallback, failurecallback[, options]); parameters options optional an object which
contains options which customize the answer; this is based on the rtcansweroptions dictionary. deprecated parameters in older...
...bject providing options requested for the answer. exceptions notreadableerror the identity provider wasn't able to provide an identity assertion. operationerror generation of the sdp failed for some reason; this is a general failure catch-all exception. return value a promise whose fulfillment handler is called with an object conforming to the rtcsessiondescriptioninit dictionary which
contains the sdp answer to be delivered to the other peer. example here is a segment of code taken from the code that goes with the article signaling and video calling. this code comes from the handler for the message sent to carry an offer to another peer across the signaling channel. keep in mind that this is part of the signaling process, the transport layer for which is an implementation detail th...
RTCPeerConnection - Web APIs
e candidates has finished.localdescription read only the read-only property rtcpeerconnection.localdescription returns an rtcsessiondescription describing the session for the local end of the connection. if it has not yet been set, this is null.peeridentity read only the read-only rtcpeerconnection property peeridentity returns a javascript promise that resolves to an rtcidentityassertion which
contains a domstring identifying the remote peer.pendinglocaldescription read only the read-only property rtcpeerconnection.pendinglocaldescription returns an rtcsessiondescription object describing a pending configuration change for the local end of the connection. this does not describe the connection as it currently stands, but as it may exist in the near future. use rtcpeerconnection.currentlocaldescr...
...on method addtrack() adds a new media track to the set of tracks which will be transmitted to the other peer.close() the rtcpeerconnection.close() method closes the current peer connection.createanswer() the createanswer() method on the rtcpeerconnection interface creates an sdp answer to an offer received from a remote peer during the offer/answer negotiation of a webrtc connection. the answer
contains information about any media already attached to the session, codecs and options supported by the browser, and any ice candidates already gathered. the answer is delivered to the returned promise, and should then be sent to the source of the offer to continue the negotiation process.createdatachannel() the createdatachannel() method on the rtcpeerconnection interface creates a new channel linked ...
RTCRemoteOutboundRtpStreamStats.localId - Web APIs
ing data to the local peer) has a corresponding record of type inbound-rtp which describes the local peer's perspective on the same data being moved between the two peers. let's create a utility function to help us look up the value of a key in the paired statistics object. the findreportentry() function shown below examines an rtcstatsreport, returning the rtcstats-based statistics record which
contains the specified key — and for which the key has the specified value. if no match is found (or the statistics report has no record corresponding to the statistics category indicated by key. function findreportentry(report, key, value) { for (const stats of report.values()) { if (stats[key] === value) { return stats; } } return null; } since the rtcstatsreport is a javascript ...
...networkteststop() function constructs the html used to display the output of the collected and computed results to the user, then append it to the element statsbox, which we're using to show the status updates to the user. the output log, given the styles used by the example, looks like this: in the screenshot, we see a heading followed by the scrollable <div> we refer to as statsbox. the box
contains a number of log entries, the last handful of which are visible. each one represents approximately one second of time (since that's much time we're waiting between calling networkteststart() and networkteststop()). try it and fork it this example is available on glitch for you to try out, examine, or remix. you can also access it directly using glitch's git server. specifications ...
RTCRtpCapabilities - Web APIs
the rtcrtpcapabilities dictionary is a data type used to describe the capabilities of an rtcrtpsender or rtcrtpreceiver in response to a call to the rtcrtpsender.getcapabilities() or rtcrtpreceiver.getcapabilities() static functions, both of which return an array of rtcrtpcapabilities objects. an rtcrtpcapabilities object
contains an array of objects conforming to rtcrtpcodeccapability (each describing the capabilities of one codec) and an array of the supported rtp header extensions for that codec. properties codecs an array of rtcrtpcodeccapability objects, each describing one of the codecs supported by the rtcrtpsender or rtcrtpreceiver. there are some special entries in this array, described below in the section the codecs array. headerextensions an array of objects conforming to the ...
...rted rtp header extensions for that codec. properties codecs an array of rtcrtpcodeccapability objects, each describing one of the codecs supported by the rtcrtpsender or rtcrtpreceiver. there are some special entries in this array, described below in the section the codecs array. headerextensions an array of objects conforming to the rtcrtpheaderextensioncapability dictionary. each object
contains a single domstring, uri, specifying the uri of the header extension, as described in rfc 5285. description the codecs array the codecs array is an array of objects conforming to the dictionary rtcrtpcodeccapability. each of these objects describes a single codec and its basic capabilities. its properties are: the browser will only report distinct capability combinations separately. if two ...
Range.setStart() - Web APIs
ode where the range should start. startoffset an integer greater than or equal to zero representing the offset for the start of the range from the start of startnode. examples highlight part of an element this example uses the range.setstart() and range.setend() methods to add part of an address to a range. the selected range is then highlighted using range.surroundcontents(). the address
contains nine nodes: five text nodes, and four <br> elements. html <p id="address">wyatt earp<br> 101 e. main st.<br> dodge city, ks<br> 67801<br> usa</p> <hr> <p>nodes in the original address:</p> <ol id="log"></ol> javascript const address = document.getelementbyid('address'); const log = document.getelementbyid('log'); // log info address.childnodes.foreach(node => { const li = document.createe...
...set = 5; // end at fifth node: dodge city, ks const range = document.createrange(); range.setstart(address, startoffset); range.setend(address, endoffset); const mark = document.createelement('mark'); range.surroundcontents(mark); result get characters from a text node this example uses the range.setstart() and range.setend() methods to define the contents of a range. the resulting range
contains the first through fifth characters within a text node. html <p id="content">0123456789</p> <p id="log"></p> javascript const element = document.getelementbyid('content'); const textnode = element.childnodes[0]; const range = document.createrange(); range.setstart(textnode, 0); // start at first character range.setend(textnode, 5); // end at fifth character document.getelementbyid('log').t...
Report - Web APIs
he report interface of the reporting api represents a single report. reports can be accessed in a number of ways: via the reportingobserver.takerecords() method — this returns all reports in an observer's report queue, and then empties the queue. via the reports parameter of the callback function passed into the reportingobserver() constructor upon creation of a new observer instance. this
contains the list of reports currently contained in the observer's report queue. by sending requests to the endpoints defined via the report-to http header. properties report.body read only the body of the report, which is a reportbody object containing the detailed report information. report.type read only the type of report generated, e.g. deprecation or intervention. report.url read only ...
...we loop over each report using a basic for loop, then iterate over each entry of in the report's body using a for...in structure, displaying each key/value pair inside a list item. specifications specification status comment reporting apithe definition of 'report' in that specification. editor's draft ...
Using the Screen Capture API - Web APIs
is always optional, and even when web content requests a stream with both audio and video, the returned mediastream may still have only one video track, with no audio. note: some properties are not widely implemented and might not be used by the engine. cursor, for example, has limited support. using the captured stream the promise returned by getdisplaymedia() resolves to a mediastream that
contains at least one video stream that
contains the screen or screen area, and which is adjusted or filtered based upon the constraints specifed when getdisplaymedia() was called. security as is always the case when sharing content over a network, it's important to consider the privacy and safety implications of screen sharing. potential risks privacy and security issues surrounding screen sharing ar...
...a camera, you'll find getdisplaymedia() to be very familiar. setup first, some constants are set up to reference the elements on the page to which we'll need access: the <video> into which the captured screen contents will be streamed, a box into which logged output will be drawn, and the start and stop buttons that will turn on and off capture of screen imagery. the object displaymediaoptions
contains the mediastreamconstraints to pass into getdisplaymedia(); here, the cursor property is set to always, indicating that the mouse cursor should always be included in the captured media. note: some properties are not widely implemented and might not be used by the engine. cursor, for example, has limited support. finally, event listeners are established to detect user clicks on the start and st...
ScriptProcessorNode - Web APIs
his feature has been marked as deprecated, and was replaced by audioworklet (see audioworkletnode). the scriptprocessornode interface is an audionode audio-processing module that is linked to two buffers, one containing the input audio data, one containing the processed output audio data. an event, implementing the audioprocessingevent interface, is sent to the object each time the input buffer
contains new data, and the event handler terminates when it has filled the output buffer with data. the size of the input and output buffer are defined at the creation time, when the audiocontext.createscriptprocessor() method is called (both are defined by audiocontext.createscriptprocessor()'s buffersize parameter). the buffer size must be a power of 2 between 256 and 16384, that is 256, 512, 1024, 2...
...ion(buffer) { mybuffer = buffer; source.buffer = mybuffer; }, function(e){"error with decoding audio data" + e.err}); } request.send(); } // give the node a function to process audio events scriptnode.onaudioprocess = function(audioprocessingevent) { // the input buffer is the song we loaded earlier var inputbuffer = audioprocessingevent.inputbuffer; // the output buffer
contains the samples that will be modified and played var outputbuffer = audioprocessingevent.outputbuffer; // loop through the output channels (in this case there is only one) for (var channel = 0; channel < outputbuffer.numberofchannels; channel++) { var inputdata = inputbuffer.getchanneldata(channel); var outputdata = outputbuffer.getchanneldata(channel); // loop through the 4096 sa...
ServiceWorkerGlobalScope - Web APIs
events activate occurs when a serviceworkerregistration acquires a new servi...
...font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">serviceworkerglobalscope</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties serviceworkerglobalscope.clients read only
contains the clients object associated with the service worker. serviceworkerglobalscope.registration read only
contains the serviceworkerregistration object that represents the service worker's registration. serviceworkerglobalscope.caches read only
contains the cachestorage object associated with the service worker. events activate occurs when a serviceworkerregistration acquires a new serviceworkerregistration.active worker. also available via the serviceworkerglobalscope.onactivate property. contentd...
SpeechRecognitionEvent - Web APIs
properties speechrecognitionevent also inherits properties from its parent interface, event. speechrecognitionevent.emma read only returns an extensible multimodal annotation markup language (emma) — xml — representation of the result. speechrecognitionevent.interpretation read only returns the semantic meaning of what the user said. ...
...onevent.results read only returns a speechrecognitionresultlist object representing all the speech recognition results for the current session. examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object
contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object
contains speechrecognitionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalte...
StaticRange - Web APIs
the staticrangeinit dictionary specifying the default values for its properties. properties the properties below are inherited from its parent interface, abstractrange. staticrange.collapsed read only returns a boolean value which is true if the range's start and end positions are the same, resulting in a range of length 0. ...
... staticrange.startoffset read only returns an integer value indicating the offset into the node specified by startcontainer at which the first character of the range is located. ...
Using writable streams - Web APIs
this is called when each chunk is actually written (see the next section). the close() method is called automatically when writing has finished — it prints the entire decoded result to the ui in one string. the abort() method simply prints an error to the console if the stream is aborted. w...
...n this ready check fulfills, we invoke writablestreamdefaultwriter.close() to close the stream. this also triggers the close() method specified inside the writablestream() constructor, as discussed above. controllers as you'll have noticed when studying the writablestream() syntax skeleton, the start(), write(), and close() methods can optionally have a controller parameter passed to them. this
contains an instance of the writablestreamdefaultcontroller interface, which can be used by the developer to further control the stream as required. this currently only has one method available on it — writablestreamdefaultcontroller.error(), which when invoked causes future interactions with the stream to error. this is useful when another part of an app goes wrong, and you want to propagate the error...
Text.splitText() - Web APIs
the newly created node is returned to the caller. if the original node had a parent, the new node is inserted as the next sibling of the original node. if the offset is equal to the length of the original node, the newly created node has no data. separated text nodes can be concatenated using the node.normalize() method. ...
...d as the next sibling of the original node. if the offset is equal to the length of the original node, the newly created node has no data. separated text nodes can be concatenated using the node.normalize() method. syntax newnode = textnode.splittext(offset) parameters offset the index immediately before which to break the text node. return value returns a newly created text node that
contains the text after the specified offset point. exceptions thrown a domexception with a value of index_size_err is thrown if the specified offset is negative or is greater than the number of 16-bit units in the node's text; a domexception with a value of no_modification_allowed_err is thrown if the node is read-only. example in this example, the text of a <p> is split into two text nodes, and a <u...
Text - Web APIs
new documents have a single text node for each block of text. over time, more text nodes may be created as the document's content changes. the node.normalize() method merges adjacent text objects back into a single node for each block of text. ...
...nchor="middle" alignment-baseline="middle">text</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constructor text() returns a text node with the parameter as its textual content. properties inherits properties from its parent, characterdata. text.iselementcontentwhitespace read only returns a boolean flag indicating whether or not the text node
contains only whitespace. text.wholetext read only returns a domstring containing the text of all text nodes logically adjacent to this node, concatenated in document order. text.assignedslot read only returns the htmlslotelement object associated with the element. properties included from slotable the text interface includes the following property, defined on the slotable mixin. slotable.as...
TextEncoder.prototype.encodeInto() - Web APIs
tentially more performant than the older encode() method especially when the target buffer is a view into a wasm heap. syntax b1 = encoder.encodeinto(string, uint8array); parameters string is a usvstring containing the text to encode. uint8array is a uint8array object instance to place the resulting utf-8 encoded text into. return value a textencoderencodeintoresult dictionary, which
contains two members: read the number of utf-16 units of code from the source that has been converted over to utf-8. this may be less than string.length if uint8array did not have enough space. written the number of bytes modified in the destination uint8array. the bytes written are guaranteed to form complete utf-8 byte sequences. encode into a specific position encoder.encodeinto always puts it...
...e for a zero terminator. that is, on the wasm side you are working with rust strings or a non-zero-terminating c++ class. if you are working with c++ std::string, even though the logical length is shown to you, you need to take the extra terminator byte into account when computing rounding up to allocator bucket size. see the next section about c strings. no zero-termination if the input string
contains the character u+0000 in the input, encodeinto() will write a 0x00 byte in the output. encodeinto() does not write a c-style 0x00 sentinel byte after the logical output. if your wasm program uses c strings, it's your responsibility to write the 0x00 sentinel and you can't prevent your wasm program from seeing a logically truncated string if the javascript string contained u+0000. observe: var en...
TextTrack - Web APIs
from eventtarget. texttrack.activecues read only a texttrackcuelist object listing the currently active set of text track cues. track cues are active if the current playback position of the media is between the cues' start and end times. thus, for displayed cues such as captions or subtitles, the active cues are currently being displayed. texttrack.cues read only a texttrackcuelist which
contains all of the track's cues. texttrack.id read only a domstring which identifies the track, if it has one. if it doesn't have an id, then this value is an empty string (""). if the texttrack is associated with a <track> element, then the track's id matches the element's id. texttrack.inbandmetadatatrackdispatchtype read only returns a domstring which indicates the track's in-band metadata track...
...he element's id. texttrack.inbandmetadatatrackdispatchtype read only returns a domstring which indicates the track's in-band metadata track dispatch type. needs details texttrack.kind read only returns a domstring indicating what kind of text track the texttrack describes. the value must be one of those in the texttrackkind enum. texttrack.label read only a human-readable domstring which
contains the text track's label, if one is present; otherwise, this is an empty string (""), in which case a custom label may need to be generated by your code using other attributes of the track, if the track's label needs to be exposed to the user. texttrack.language read only a domstring which specifies the text language in which the text track's contents is written. the value must adhere to the for...
WebGLRenderingContext.getFramebufferAttachmentParameter() - Web APIs
xt.color_attachment8_webgl ext.color_attachment9_webgl ext.color_attachment10_webgl ext.color_attachment11_webgl ext.color_attachment12_webgl ext.color_attachment13_webgl ext.color_attachment14_webgl ext.color_attachment15_webgl pname a glenum specifying information to query. possible values: gl.framebuffer_attachment_object_type: the type which
contains the attached image. gl.framebuffer_attachment_object_name: the texture or renderbuffer of the attached image (webglrenderbuffer or webgltexture). gl.framebuffer_attachment_texture_level: mipmap level. default value: 0. gl.framebuffer_attachment_texture_cube_map_face: the name of cube-map face of the texture. when using the ext_srgb extension: ext.framebuffer_attachment_color_encod...
...een component of the attachment. gl.framebuffer_attachment_red_size a glint indicating the number of bits in the red component of the attachment. gl.framebuffer_attachment_stencil_size a glint indicating the number of bits in the stencil component of the attachment. gl.framebuffer_attachment_texture_layer a glint indicating the number of the texture layer which
contains the attached image. ext.framebuffer_attachment_color_encoding_ext a glenum indicating the framebuffer color encoding. either gl.linear or ext.srgb_ext. ext.framebuffer_attachment_texture_num_views_ovr a glsizei indicating the number of views of the framebuffer object attachment. ext.framebuffer_attachment_texture_base_view_index_ovr a glint indicating the base ...
WebGLRenderingContext.getProgramInfoLog() - Web APIs
when a webglprogram object is initially created, its information log will be a string of length 0. ...
...when a webglprogram object is initially created, its information log will be a string of length 0. ...
WebGLRenderingContext.getShaderInfoLog() - Web APIs
when a webglshader object is initially created, its information log will be a string of length 0. examples checking compilation messages /* load shader source code. */ gl.shadersource(shader, shadercode); /* compile shader source code. ...
...when a webglshader object is initially created, its information log will be a string of length 0. examples checking compilation messages /* load shader source code. */ gl.shadersource(shader, shadercode); /* compile shader source code. ...
WebRTC connectivity - Web APIs
signaling unfortunately, webrtc can’t create connections without some sort of server in the middle. we call this the signal channel or signaling service. it’s any sort of channel of communication to exchange information before setting up a connection, whether by email, post card or a carrier pigeon... it’s up to you. the information we need to exchange is the offer and answer which just
contains the sdp mentioned below. peer a who will be the initiator of the connection, will create an offer. they will then send this offer to peer b using the chosen signal channel. peer b will receive the offer from the signal channel and create an answer. they will then send this back to peer a along the signal channel. session descriptions the configuration of an endpoint on a webrtc connection is c...
...ption is set as the pending description, and the webrtc layer begins to evaluate whether or not it's acceptable. once the proposed description has been agreed upon, the value of currentlocaldescription or currentremotedescription is changed to the pending description, and the pending description is set to null again, indicating that there isn't a pending description. the pendinglocaldescription
contains not just the offer or answer under consideration, but any local ice candidates which have already been gathered since the offer or answer was created. similarly, pendingremotedescription includes any remote ice candidates which have been provided by calls to rtcpeerconnection.addicecandidate(). see the individual articles on these properties and methods for more specifics, and codecs used by we...
Taking still photos with WebRTC - Web APIs
upport and take a photo with it. try this sample then read on to learn how it works. you can also jump straight to the code on github if you like. the html markup our html interface has two main operational sections: the stream and capture panel and the presentation panel. each of these is presented side-by-side in its own <div> to facilitate styling and control. the first panel on the left
contains two components: a <video> element, which will receive the stream from webrtc, and a <button> the user clicks to capture a video frame. <div class="camera"> <video id="video">video stream not available.</video> <button id="startbutton">take photo</button> </div> this is straightforward, and we'll see how it ties together when we get into the javascript code. next, we have a <canvas>...
... the captured frame, then call drawimage() to draw the current frame of the video into the context, filling the entire canvas with the frame image. note: this takes advantage of the fact that the htmlvideoelement interface looks like an htmlimageelement to any api that accepts an htmlimageelement as a parameter, with the video's current frame presented as the image's contents. once the canvas
contains the captured image, we convert it to png format by calling htmlcanvaselement.todataurl() on it; finally, we call photo.setattribute() to make our captured still box display the image. if there isn't a valid image available (that is, the width and height are both 0), we clear the contents of the captured frame box by calling clearphoto(). fun with filters since we're capturing images from the u...
WebRTC Statistics API - Web APIs
bject.keys(report).foreach(statname => { statsoutput += `<strong>${statname}:</strong> ${report[statname]}<br>\n`; }); } }); document.queryselector(".stats-box").innerhtml = statsoutput; }); } when the promise returned by getstats() is fulfilled, the resolution handler receives as input an rtcstatsreport object containing the statistics information. ...
...upon looking up a statistic category by name, you get an object containing the corresponding data. ...
Writing WebSocket servers - Web APIs
erstood or has an incorrect value, the server should send a 400 ("bad request")} response and immediately close the socket. as usual, it may also give the reason why the handshake failed in the http response body, but the message may never be displayed (browsers do not display it). if the server doesn't understand that version of websockets, it should send a sec-websocket-version header back that
contains the version(s) it does understand. in the example above, it indicates version 13 of the websocket protocol. the most interesting header here is sec-websocket-key. let's look at that next. note: regular http status codes can be used only before the handshake. after the handshake succeeds, you have to use a different set of codes (defined in section 7.4 of the spec). server handshake response...
...pcode=0x1, msg="hello" server: (process complete message immediately) hi. client: fin=0, opcode=0x1, msg="and a" server: (listening, new message containing text started) client: fin=0, opcode=0x0, msg="happy new" server: (listening, payload concatenated to previous message) client: fin=1, opcode=0x0, msg="year!" server: (process complete message) happy new year to you too! notice the first frame
contains an entire message (has fin=1 and opcode!=0x0), so the server can process or respond as it sees fit. the second frame sent by the client has a text payload (opcode=0x1), but the entire message has not arrived yet (fin=0). all remaining parts of that message are sent with continuation frames (opcode=0x0), and the final frame of the message is marked by fin=1. section 5.4 of the spec describes messa...
Web Audio API - Web APIs
d events, which we have split up into nine categories of functionality. general audio graph definition general containers and definitions that shape audio graphs in web audio api usage. audiocontext the audiocontext interface represents an audio-processing graph built from audio modules linked together, each represented by an audionode. an audio context controls the creation of the nodes it
contains and the execution of the audio processing, or decoding. you need to create an audiocontext before you do anything else, as everything happens inside a context. audiocontextoptions the audiocontextoptions dictionary is used to provide options when instantiating a new audiocontext. audionode the audionode interface represents an audio-processing module like an audio source (e.g. an html <audio>...
...of the specification. scriptprocessornode the scriptprocessornode interface allows the generation, processing, or analyzing of audio using javascript. it is an audionode audio-processing module that is linked to two buffers, one containing the current input, one containing the output. an event, implementing the audioprocessingevent interface, is sent to the object each time the input buffer
contains new data, and the event handler terminates when it has filled the output buffer with data. audioprocess (event) the audioprocess event is fired when an input buffer of a web audio api scriptprocessornode is ready to be processed. audioprocessingevent the web audio api audioprocessingevent represents events that occur when a scriptprocessornode input buffer is ready to be processed. offl...
Using the Web Speech API - Web APIs
lts[0][0].confidence); } the second line here is a bit complex-looking, so let's explain it step by step. the speechrecognitionevent.results property returns a speechrecognitionresultlist object containing speechrecognitionresult objects. it has a getter so it can be accessed like an array — so the first [0] returns the speechrecognitionresult at position 0. each speechrecognitionresult object
contains speechrecognitionalternative objects that contain individual recognised words. these also have getters so they can be accessed like arrays — the second [0] therefore returns the speechrecognitionalternative at position 0. we then return its transcript property to get a string containing the individual recognised result as a string, set the background color to that color, and report the color re...
... the web speech api has a main controller inter...
Using Web Workers - Web APIs
d channel attributes are always null). once created, a worker can send messages to the javascript code that created it by posting messages to an event handler specified by that code (and vice versa). this article provides a detailed introduction to using web workers. web workers api a worker is an object created using a constructor (e.g. worker()) that runs a named javascript file — this file
contains the code that will run in the worker thread; workers run in another global context that is different from the current window. thus, using the window shortcut to get the current global scope (instead of self) within a worker will return an error. the worker context is represented by a dedicatedworkerglobalscope object in the case of dedicated workers (standard workers that are utilized by a singl...
...mal(stype, nage) { this.type = stype; this.age = nage; } var example5 = new animal('cat', 3); alert(example5.constructor); // animal alert(emulatemessage(example5).constructor); // object a value that is cloned and not shared is called message. as you will probably know by now, messages can be sent to and from the main thread by using postmessage(), and the message event's data attribute
contains data passed back from the worker. example.html: (the main page): var myworker = new worker('my_task.js'); myworker.onmessage = function(oevent) { console.log('worker said : ' + oevent.data); }; myworker.postmessage('ali'); my_task.js (the worker): postmessage("i\'m working before postmessage(\'ali\')."); onmessage = function(oevent) { postmessage('hi ' + oevent.data); }; the structure...
Window.pageYOffset - Web APIs
ument .body.innerhtml = contenthtml; in this example, an <iframe> is created and filled with content, then a specific element within the document is scrolled into view in the frame. once that's done, the vertical scroll position is checked by looking at the value of pageyoffset in the frame's contentwindow. html the html is extremely simple and has just two elements: an <iframe> that
contains the document we're going to scroll, and a <div> into which we'll output the value of pageyoffset when we've finished the scroll. <iframe id="frame"> </iframe> <div id="info"> </div> javascript var frame = document.getelementbyid("frame"); var framedoc = frame.contentdocument; var info = document.getelementbyid("info"); var target = framedoc.getelementbyid("overview"); framedoc.scrollingeleme...
...it then gets a reference to the element we want to scroll into view calling getelementbyid() on the frame's htmliframeelement.contentdocument. with the target element in hand, we set the scrolltop of the frame's scrollingelement to the offsettop of the target element. by doing so, we set the...
Window.sidebar - Web APIs
methods the sidebar object returned has the following methods: method description (seamonkey) description (firefox) addpanel(title, contenturl, "") adds a sidebar panel. obsolete since firefox 23 (only present in seamonkey). end users can use the "load this bookmark in the sidebar" option instead. also see creating a firefox sidebar. addpersistentpanel(title, contenturl, "") adds a sidebar panel, which is able to work in the background. addsearchprovider(descriptionurl) dummy function; does nothing. see autodiscovery of search plugins. ...
...ddpersistentpanel(title, contenturl, "") adds a sidebar panel, which is able to work in the background. addsearchprovider(descriptionurl) dummy function; does nothing. see autodiscovery of search plugins. addsearchengine(engineurl, iconurl, suggestedtitle, suggestedcategory) obsolete since gecko 44 installs a search engine (sherlock). adding sherlock search engines
contains more details. note: this was made obsolete in firefox 44, and has been removed completely in firefox 59. issearchproviderinstalled(descriptionurl) indicates if a specific search provider (opensearch) is installed. specification mozilla-specific. not part of any standard. ...
Window - Web APIs
lobally available. many of these are documented in the javascript reference and the dom reference. in a tabbed browser, each tab is represented by its own window object; the global window seen by javascript code running within a given tab always represents the tab in which the code is running. that said, even in a tabbed browser, some properties and methods still apply to the overall window that
contains the tab, such as resizeto() and innerheight. generally, anything that can't reasonably pertain to a tab pertains to the window instead. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 ...
... object, which can be used to register new custom elements and get information about previously registered custom elements. window.crypto read only returns the browser crypto object. window.devicepixelratio read only returns the ratio between physical pixels and device independent pixels in the current display. window.document read only returns a reference to the document that the window
contains. window.dommatrix read only returns a reference to a dommatrix object, which represents 4x4 matrices, suitable for 2d and 3d operations. window.dommatrixreadonly read only returns a reference to a dommatrixreadonly object, which represents 4x4 matrices, suitable for 2d and 3d operations. window.dompoint read only returns a reference to a dompoint object, which represents a 2d or 3d...
ARIA Test Cases - Accessibility
(leopard) n/a n/a - fail window-eyes - - - - nvda - n/a - - zoom (leopard) pass n/a pass pass zoomtext - - - - orca - - - - textbox dojo nightly build expected at behavior: (mz) when focus first lands on the textbox, its label and role should be indicated. if it also
contains content, an indication should be given as for regular textboxes. if the text is automatically selected on focus, this should be indicated. arrow keys should read by character or line as usual. (al) i think we need more here. for example, what about reading the line number if the user requests that info? markup used: notes: results: at firefox ie opera safari j...
... jaws - jaws announces tooltips as they appear. this is dependent on the user's jaws configuration setting. zoomtext - (al) should ensure that tooltip is visible (not scrolled off) when it appears, and should read it aloud markup used: role="tooltip" ar...
ARIA annotations - Accessibility
d be used on an element that wraps a single insertion and deletion (see role="insertion" and role="deletion" above). role="comment" — semantically denotes a comment/reaction to some content on the page, or to a previous comment. to provide a semantic association between the document content being annotated and the annotation, an aria-details attribute can be set on the annotated content that
contains the id of the annotated element. aria-details has been updated so that it can support multiple ids — this makes sense, for example you can easily envisage having multiple comments relating to the same bit of text. aria annotation roles and objects are currently exposed in: firefox from version 75 onwards, on windows and linux (on macos, we are first waiting for apple to define what safari w...
...hen to use each. you’ll see examples of most of these later on in the article, but briefly: aria-label="" can be set on an element to provide a brief descriptive label when it isn't appropriate to have the label actually appearing in the ui, for example a search input in a horizontal nav bar. aria-labelledby="" can be set on an element and given a value the same as the id of an element that
contains a label for the element. this is useful when the element’s label is available in the ui, but for some reason a conventional <label> won’t work. aria-description="" works the same as aria-label="", but is used when you want to give an element a more detailed description, rather than a short label. aria-describedby="" works the same as aria-labelledby="", but is used when you want to associat...
ARIA: cell role - Accessibility
optionally within a rowgroup, within a grid, table or treegrid within a static tabular structure. using native html <td> elements, whenever possible, is strongly encouraged. each element with role="cell" must be nested in a container element with role="row". that row, in turn, can be nested within an element with role="rowgroup", and should be nested within a grid, table or treegrid. if a cell
contains column or row header information, use the colheader or rowheader roles, respecitively. if the cell does not contain header information and is nested in a grid or treegrid, the role of gridcell may be more appropriate. a cell can contain a number of property attributes clarifying the cell's position within the tabular data structure, including aria-colindex, aria-colspan, aria-rowindex, and aria...
...ture, including aria-colindex, aria-colspan, aria-rowindex, and aria-rowspan. using the native html table element (<table>) along with the table row element (<tr>) and table cell element (<td>) whenever possible is strongly encouraged. associated wai-aria roles, states, and properties context roles role="row" an element with role="row" is a row of cells within a tabular structure. a row
contains one or more cells, grid cells, column headers, or row headers within a grid, table or treegrid, and optionally within a rowgroup. role="rowgroup" row is a required cell parent. rowgroup is an optional contextual row parent. it establishes a relationship between descendant rows. it is a structural equivalent to the thead, tfoot, and tbody elements in an html table element. role="table" one of...
ARIA: row role - Accessibility
an element with role="row" is a row of cells within a tabular structure. a row
contains one or more cells, grid cells or column headers, and possibly a row header, within a grid, table or treegrid, and optionally within a rowgroup. <div role="table" aria-label="populations" aria-describedby="country_population_desc"> <div id="country_population_desc">world populations by country</div> <div role="rowgroup"> <div role="row"> <span role="columnheader" aria-sort="descending">country</span> <span role="columnheader"aria-sort="none">population</span> </div> </div> <div role="rowgroup"> <div role="row"> <span role="cell">finland</span> <span role="cell">5.5 million</span> </div> <div role="row"> <span role="cell">fran...
...ls, columnheaders, or rowheaders within a static tabular structure. using native html <tr> elements, whenever possible, is strongly encouraged. to create an aria row, add role="row" to the container element. that row should be nested within a grid, table or treegrid. a group of rows can be nested within a grid, table or treegrid directly, or within a rowgroup in one of those containers. each row
contains child cells. these cells can be of different types, depending on whether they are column or row headers, or grid or regular cells. a row can contain a number of attributes clarifying the row's role, including aria-colindex, aria-level, aria-rowindex, and aria-selected. if the row is within a treegrid, rows can include the aria-expanded attribute, using the attribute to indicate the present stat...
ARIA: textbox role - Accessibility
list: predicted text is presented as a collection of values. both: predicted text is presented as a collection of values, with the text needed to complete one value inserted after the caret. none (default): predicted text is not offered. if list or both is set, the aria-controls and aria-haspopup attributes should also be included. the value of aria-controls is the id of the element that
contains the list of suggested values. additionally, either the textbox or a containing element with role combobox has a value for aria-haspopup that matches the role of the element that
contains the list of suggested values. aria-multiline attribute if aria-multiline="true" is set, the at informs the user that the textbox supports multi-line input, with the expectation that enter or return will crea...
...ollowing: expose the element as having a textbox role in the operating system's accessibility api. fire an accessible textbox event using the operating system's accessibility api if it supports it. assistive technology products should listen for such an event and notify the user accordingly: screen readers should announce its label and role when focus first lands on a textbox. if it also
contains content, this should be announced as with a regular textbox. screen magnifiers may enlarge the textbox. note: opinions may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: adding the role in the html code for single line input the snippet below shows how the textbox role ...
Web accessibility for seizures and physical reactions - Accessibility
nsitivity, one of epilepsy's most complex conditions" talks about static images and patterns. "static or moving patterns of discernable light and dark stripes have the same effect as flashing lights because of the alternation of dark and bright areas." the epilepsy foundation of america working group is able to "quantify" the problem a little. "a pattern with the potential for provoking seizures
contains clearly discernible stripes, numbering more than five light-dark pairs of stripes in any orientation" in addition to stripes, checkered patterns have also been known to cause photosensitive seizures, according to cedars-sinai. although static images are possible as triggers, they are less consistent. the trigger that is well established and strong is flashing/strobe lights. dr. selim benbadis of...
...l, is generaly recognized to be one of the two "gold standards" for analyzing flashes trace research and development center using peat to create seizureless web animations w3c css color module level 3 personalization semantics explainer 1.0. ...
Attribute selectors - CSS: Cascading Style Sheets
[attr=value] represents elements with an attribute name of attr whose value is exactly value. [attr~=value] represents elements with an attribute name of attr whose value is a whitespace-separated list of words, one of which is exactly value. [attr|=value] represen...
...lue immediately followed by a hyphen, - (u+002d). it is often used for language subcode matches. [attr^=value] represents elements with an attribute name of attr whose value is prefixed (preceded) by value. [attr$=value] represents elements with an attribute name of attr whose value is suffixed (followed) by value. [attr*=value] represents elements with an attribute name of attr whose value
contains at least one occurrence of value within the string. [attr operator value i] adding an i (or i) before the closing bracket causes the value to be compared case-insensitively (for characters within the ascii range). [attr operator value s] adding an s (or s) before the closing bracket causes the value to be compared case-sensitively (for characters within the ascii range). examples links ...
Coordinate systems - CSS: Cascading Style Sheets
x, listing out the current mouse coordinates in each of the four available coordinate systems. javascript let's look at the script in two sections. first, the code that logs the coordinates to the screen. this code will be called by the event handler for the various mouse events we watch. displaying the coordinates as we'll see in the html, the inner box (the one we're watching for events on)
contains several paragraphs; one for each of the four coordinate systems we'll be reporting on. let inner = document.queryselector(".inner"); let log = document.queryselector(".log"); function setcoords(e, type) { let idx = type + "x"; let idy = type + "y"; document.getelementbyid(idx).innertext = e[idx]; document.getelementbyid(idy).innertext = e[idy]; } a reference to the <div> inside the i...
...aphs; one for each of the four coordinate systems we'll be reporting on. let inner = document.queryselector(".inner"); let log = document.queryselector(".log"); function setcoords(e, type) { let idx = type + "x"; let idy = type + "y"; document.getelementbyid(idx).innertext = e[idx]; document.getelementbyid(idy).innertext = e[idy]; } a reference to the <div> inside the inner box which
contains the paragraphs that will show the coordinate information is fetched into log. the setcoords() function is designed to accept as input a mouseevent and the name of the origin to use when obtaining the coordinates. the implementation is then quite simple. the variables idx and idy are set to strings with the names of the properties corresponding to the coordinates in the given coordinate system. f...
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
you can see auto-placement in action in the simplest of ways by creating a grid on a set of items. if you give the items no placement information they will position themselves on the grid, one in each grid cell. ...
...iv> <div>seven</div> <div>eight</div> </div> the order of auto placed items a grid can contain a mixture of items. some of the items may have a position on the grid, but others may be auto-placed. this can be helpful, if you have a document order that reflects the order in which items sit on the grid you may not need to write css rules to place absolutely everything. the specification
contains a long section detailing the grid item placement algorithm, however for most of us we just need to remember a few simple rules for our items. order modified document order grid places items that have not been given a grid position in what is described in the specification as “order modified document order”. this means that if you have used the order property at all, the items will be placed...
Basic Concepts of grid layout - CSS: Cascading Style Sheets
grid with fixed track sizes – using pixels for example. this sets the grid to the specified pixel which fits to the layout you desire. you can also create a grid using flexible sizes with percentages or with the new fr unit designed for this purpose. item placement you can place items into a precise location on the grid using line numbers, names or by targeting an area of the grid. grid also
contains an algorithm to control the placement of items not given an explicit position on the grid. creation of additional tracks to hold content you can define an explicit grid with grid layout. the grid layout specification is flexible enough to add additional rows and columns when needed. features such as adding “as many columns that will fit into a container” are included. alignment control gr...
... algorithm to control the placement of items not given an explicit position on the grid. creation of additional tracks to hold content you can define an explicit grid with grid layout. the grid layout specification is flexible enough to add additional rows and columns when needed. features such as adding “as many columns that will fit into a container” are included. alignment control grid
contains alignment features so we can control how the items align once placed into a grid area, and how the entire grid is aligned. control of overlapping content more than one item can be placed into a grid cell or area and, they can partially overlap each other. this layering may then be controlled with the z-index property. grid is a powerful specification that, when combined with other parts of cs...
animation - CSS: Cascading Style Sheets
'play' : 'pause'); anim.style.animationpla...
...'play' : 'pause'); anim.style.animationplaystate = ''; anim.classlist.add('a' + (i + 1)); }, 100) } } animation.foreach(function (node, index) { no...
Getting Started - Developer guides
id only if you used an asynchronous request (the third parameter of open() was unspecified or set to true). if you used a synchronous request you don't need to specify a function, but this is highly discouraged as it makes for an awful user experience. step 3 – a simple example let's put it all together with a simple http request. our javascript will request an html document, test.html, which
contains the text "i'm a test." then we'll alert() the contents of the response. note that this example uses vanilla javascript — no jquery is involved. also, the html, xml and php files should be placed in the same directory. <button id="ajaxbutton" type="button">make a request</button> <script> (function() { var httprequest; document.getelementbyid("ajaxbutton").addeventlistener('click', makereq...
... exception: ' + e.description); } } step 4 – working with the xml response in the previous example, after receiving the response to the http request we used the request object's responsetext property , which contained the contents of the test.html file. now let's try the responsexml property. first off, let's create a valid xml document that we'll request later on. the document (test.xml)
contains the following: <?xml version="1.0" ?> <root> i'm a test. </root> in the script we only need to change the request line to: ... onclick="makerequest('test.xml')"> ... then in alertcontents(), we need to replace the line alert(httprequest.responsetext); with: var xmldoc = httprequest.responsexml; var root_node = xmldoc.getelementsbytagname('root').item(0); alert(root_node.firstchild.data...
Setting up adaptive streaming media sources - Developer guides
mse files are often grabbed using xhr, keep same origin rules in mind. note: if you use webm you can use the methods shown in this tutorial dash adaptive streaming for html 5 video. once encoded your file structure may look something like this: play list -> /segments/news.mp4.mpd main segment folder -> /segments/main/ 100 kbps segment folder -> /segments/main/news100
contains (1.m4s, 2.m4s, 3.m4s ... ) 200 kbps segment folder -> /segments/main/news200
contains (1.m4s, 2.m4s, 3.m4s ... ) 300 kbps segment folder -> /segments/main/news300
contains (1.m4s, 2.m4s, 3.m4s ... ) 400 kbps segment folder -> /segments/main/news400
contains (1.m4s, 2.m4s, 3.m4s ... ) the playlist or .mpd file
contains xml that explicitly lists where all the various bitrate files reside. <...
...dia into equally sized media files together with an index file. apple also provides a file segmenter for mac — which takes a suitably encoded file, splits it up and produces a index file, in a similar fashion to the stream segmenter. note: you can find more details about these tools at using http live streaming. index files (playlists) the hls index file (much like mpeg-dash's .mpd file)
contains the information on where all the media segments reside, as well as other meta data such as bandwidth application. apple uses the .m3u8 format (an extension of its .m3u playlist format) for index files — see below for an example: #ext-x-version:3 #extm3u #ext-x-targetduration:10 #ext-x-media-sequence:1 # old-style integer duration; avoid for newer clients. #extinf:10, http://media.example.com/...
Media events - Developer guides
emptied the media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called to reload it. encrypted the user agent has encountered initialization data in the media data. ended sent when playback completes. error sent when an error occurs. the element's error attribute
contains more information. see htmlmediaelement.error for details. loadeddata the first frame of the media has finished loading. loadedmetadata the media's metadata has finished loading; all attributes now contain as much useful information as they're going to. loadstart sent when loading of the media begins. mozaudioavailable sent when an audio buffer is pr...
...ails. loadeddata the first frame of the media has finished loading. loadedmetadata the media's metadata has finished loading; all attributes now contain as much useful information as they're going to. loadstart sent when loading of the media begins. mozaudioavailable sent when an audio buffer is provided to the audio layer for processing; the buffer
contains raw audio samples that may or may not already have been played by the time you receive the event. pause sent when the playback state is changed to paused (paused property is true). play sent when the playback state is no longer paused, as a result of the play method, or the autoplay attribute. playing sent when the media has enough data to start playing, after ...
HTML attribute reference - HTML: Hypertext Markup Language
<table>, <tbody>, <tfoot>, <td>, <th>, <tr> background color of the element. note: this is a legacy attribute. please use the css background-color property instead. border <img>, <object>, <table> the border width. note: this is a legacy attribute. please use the css border property instead. buffered <audio>, <video>
contains the time range of already buffered media. capture <input> from the html media capturethe definition of 'media capture' in that specification.spec, specifies a new file can be captured. challenge <keygen> a challenge string that is submitted along with the public key. charset <meta>, <script> declares the character encoding of the page or script. ...
...cation.spec, specifies a new file can be captured. challenge <keygen> a challenge string that is submitted along with the public key. charset <meta>, <script> declares the character encoding of the page or script. checked <command>, <input> indicates whether the element should be checked on page load. cite <blockquote>, <del>, <ins>, <q>
contains a uri which points to the source of the quote or change. class global attribute often used with css to style elements with common properties. code <applet> specifies the url of the applet's class file to be loaded and executed. codebase <applet> this attribute gives the absolute or relative url of the directory where applets' .class files referenced by...
<img>: The Image Embed element - HTML: Hypertext Markup Language
the html <img> element embeds an image into the document. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the above example shows usage of the <img> element: the src attribute is required, and
contains the path to the image you want to embed. the alt attribute holds a text description of the image, which isn't mandatory but is incredibly useful for accessibility — screen readers read this description out to their users so they know what the image means. alt text is also displayed on the page if the image can't be loaded for some reason: for example, network errors, content blocking, or linkrot. there are many o...
...px. source size values specify the intended display size of the image. user agents use the current source size to select one of the sources supplied by the srcset attribute, when those sources are described using width (w) descriptors. the selected source size affects the intrinsic size of the image (the image’s display size if no css styling is applied). if the srcset attribute is absent, or
contains no values with a width descriptor, then the sizes attribute has no effect. src the image url. mandatory for the <img> element. on browsers supporting srcset, src is treated like a candidate image with a pixel density descriptor 1x, unless an image with this pixel density descriptor is already defined in srcset, or unless srcset
contains w descriptors. srcset one or more strings separated by...
<input type="color"> - HTML: Hypertext Markup Language
active-examples and send us a pull request. value a 7-character domstring specifying a <color> in lower-case hexadecimal notation events change and input supported common attributes autocomplete and list idl attributes list and value methods select() value the value of an <input> element of type color is always a domstring which
contains a 7-character string specifying an rgb color in hexadecimal format. while you can input the color in either upper- or lower-case, it will be stored in lower-case form. the value is never in any other form, and is never empty. note: setting the value to anything that isn't a valid, fully-opaque, rgb color in hexadecimal notation will result in the value being set to #000000. in particular, you c...
... picker. as you make changes in the color picker, the first paragraph's color changes, as a preview (this uses the <code>input</code> event). when you close the color picker, the <code>change</code> event fires, and we detect that to change every paragraph to the selected color.</p> javascript first, there's some setup. here we establish some variables, setting up a variable that
contains the color we'll set the color well to when we first load up, and then setting up a load handler to do the main startup work once the page is fully loaded. var colorwell; var defaultcolor = "#0000ff"; window.addeventlistener("load", startup, false); initialization once the page is loaded, our load event handler, startup(), is called: function startup() { colorwell = document.queryselector(...
<input type="image"> - HTML: Hypertext Markup Language
form. the string must be the name of a browsing context (that is, a tab, window, or <iframe>. a value specified here overrides any target given by the target attribute on the <form> that owns this input. in addition to the actual names of tabs, windows, or inline frames, there are a few special keywords that can be used: _self loads the response into the same browsing context as the one that
contains the form. this will replace the current document with the received data. this is the default value used if none is specified. _blank loads the response into a new, unnamed, browsing context. this is typically a new tab in the same window as the current document, but may differ depending on the configuration of the user agent. _parent loads the response into the parent browsing context of the ...
... formmethod html5 specifies the http method that the browser uses to submit the form. possible values are: post: the data from the form is included in the body of the form and is sent to the server. get: the data from the form is appended to the form attribute uri, with a '?' as a separator, and the resulting uri is sent to the server. use this method when the form has no side-effects and
contains only ascii characters. if specified, this attribute overrides the method attribute of the element's form owner. formnovalidate html5 a boolean attribute specifying that the form is not to be validated when it is submitted. if this attribute is specified, it overrides the novalidate attribute of the element's form owner. formtarget html5 a name or keyword indicating where to display the ...
<input type="range"> - HTML: Hypertext Markup Language
of automatic validation are performed: if the value is set to something which can't be converted into a valid floating-point number, validation fails because the input is suffering from a bad input. the value won't be less than min. the default is 0. the value won't be greater than max. the default is 100. the value will be a multiple of step. the default is 1. value the value attribute
contains a domstring which
contains a string representation of the selected number. the value is never an empty string (""). the default value is halfway between the specified minimum and maximum—unless the maximum is actually less than the minimum, in which case the default is set to the value of the min attribute. the algorithm for determining the default value is: defaultvalue = (rangeelem.max < ran...
...made to set the value lower than the minimum, it is set to the minimum. similarly, an attempt to set the value higher than the maximum results in it being set to the maximum. additional attributes in addition to the attributes shared by all <input> elements, range inputs offer the following attributes: attribute description list the id of the <datalist> element that
contains optional pre-defined options max the maximum permitted value min the minimum permitted value step the stepping interval, used both for user interface and validation purposes list the values of the list attribute is the id of a <datalist> element located in the same document. the <datalist> provides a list of predefined values to suggest to the user for ...
<input type="search"> - HTML: Hypertext Markup Language
send us a pull request. value a domstring representing the value contained in the search field. events change and input supported common attributes autocomplete, list, maxlength, minlength, pattern, placeholder, required, size. idl attributes value methods select(), setrangetext(), setselectionrange(). value the value attribute
contains a domstring representing the value contained in the search field. you can retrieve this using the htmlinputelement.value property in javascript. searchterms = mysearch.value; if no validation constraints are in place for the input (see validation for more details), the value can be any text string or an empty string (""). additional attributes in addition to the attributes that operate on al...
...on constraints are in place for the input (see validation for more details), the value can be any text string or an empty string (""). ...
<input type="submit"> - HTML: Hypertext Markup Language
se the user clicked the button), the user agent attempts to submit the form to the server. <input type="submit" value="send request"> value a domstring used as the button's label events click supported common attributes type and value idl attributes value methods none value an <input type="submit"> element's value attribute
contains a domstring which is displayed as the button's label. buttons do not have a true value otherwise. <input type="submit" value="send request"> if you don't specify a value, the button will have a default label, chosen by the user agent. this label is likely to be something along the lines of "submit" or "submit query." here's an example of a submit button with a default label in your browser:...
...form. the string must be the name of a browsing context (that is, a tab, window, or <iframe>. a value specified here overrides any target given by the target attribute on the <form> that owns this input. in addition to the actual names of tabs, windows, or inline frames, there are a few special keywords that can be used: _self loads the response into the same browsing context as the one that
contains the form. this will replace the current document with the received data. this is the default value used if none is specified. _blank loads the response into a new, unnamed, browsing context. this is typically a new tab in the same window as the current document, but may differ depending on the configuration of the user agent. _parent loads the response into the parent browsing context of the ...
<input type="text"> - HTML: Hypertext Markup Language
ue a domstring representing the text contained in the text field. events change and input supported common attributes autocomplete, list, maxlength, minlength, pattern, placeholder, readonly, required and size idl attributes list, value methods select(), setrangetext() and setselectionrange(). value the value attribute is a domstring that
contains the current value of the text entered into the text field. you can retrieve this using the value property in javascript. let thetext = mytextinput.value; if no validation constraints are in place for the input (see validation for more details), the value may be an empty string (""). additional attributes in addition to the attributes that operate on all <input> elements regardless of their t...
...put.value; if no validation constraints are in place for the input (see validation for more details), the value may be an empty string (""). ...
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
, is not invalid. even if the above attributes are present, with the exception of required, and empty string will not lead to an error. we can set limits on what values we accept, and supporting browsers will natively validate these form values and alert the user if there is a mistake when the form is submitted. in addition to the errors described in the table above, the validitystate interface
contains the badinput, valid, and customerror boolean readonly properties. the validity object includes: validitystate.valuemissing validitystate.typemismatch validitystate.patternmismatch validitystate.toolong validitystate.tooshort validitystate.rangeunderflow validitystate.rangeoverflow validitystate.stepmismatch validitystate.badinput validitystate.valid validitystate.customerror for ea...
...ed, one of the custom error messages will be shown. if it is valid, it will submit as you'd expect. for this to happen, the custom validity has to be cancelled, by invoking setcustomvalidity() with an empty string value. we therefore do this every time the input event is raised. if you don't do this, and a custom validity was previously set, the input will register as invalid, even if it current
contains a valid value on submission. note: always validate input constraints both client side and server side. constraint validation doesn't remove the need for validation on the server side. invalid values can still be sent by older browsers or by bad actors. note: firefox supported a proprietary error attribute — x-moz-errormessage — for many versions, which allowed you set custom error messa...
<menu> - HTML: Hypertext Markup Language
sisting of a series of commands for user interaction. this might be in the form of an unordered list of <li> elements, or, if the element has no <li> element children, flow content describing available commands. this value is the default if the attribute is missing. usage notes the <menu> and <ul> elements both represent an unordered list of items. ...
...s missing. usage notes the <menu> and <ul> elements both represent an unordered list of items. the key difference is that <ul> primarily
contains items for display, whilst <menu> is intended for interactive items, to act on. an html menu can be used to create context menus (typically activated by right-clicking another element) or toolbars. context menus consist of a <menu> element which
contains <menuitem> elements for each selectable option in the menu, <menu> elements for submenus within the menu, and <hr> elements for separator lines to break up the menu's content into sections. context menus are then attached to the element they're activated from using either the associated element's contextmenu attribute or, for button-activated menus attached to <button> elements, the menu attribut...
Standard metadata names - HTML: Hypertext Markup Language
s: dynamically inserting <meta name="referrer"> (with document.write() or appendchild()) makes the referrer behaviour unpredictable. when several conflicting policies are defined, the no-referrer policy is applied. theme-color: indicates a suggested color that user agents should use to customize the display of the page or of the surrounding user interface. the content attribute
contains a valid css <color>. standard metadata names defined in other specifications the css color adjustment specification defines the following metadata name: color-scheme: specifies one or more color schemes with which the document is compatible. the browser will use this information in tandem with the user's browser or device settings to determine what colors to use for everything from ba...
...oming capabilities by setting user-scalable to a value of no prevents people experiencing low vision conditions from being able to read and understand page content. mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.4 | w3c understanding wcag 2.0 see also the @viewport css at-rule. other metadata names the whatwg wiki metaextensions page
contains a large set of non-standard metadata names that have not been formally accepted yet; however, some of the names included there are already used quite commonly in practice — including the following: creator: the name of the creator of the document, such as an organization or institution. if there are more than one, several <meta> elements should be used. googlebot, a synonym of robots, is on...
<meta>: The Document-level Metadata element - HTML: Hypertext Markup Language
: the attribute name has a specific meaning for the <meta> element, and the itemprop attribute must not be set on the same <meta> element that has any existing name, http-equiv or charset attributes. charset this attribute declares the document's character encoding. if the attribute is present, its value must be an ascii case-insensitive match for the string "utf-8". content this attribute
contains the value for the http-equiv or name attribute, depending on which is used. http-equiv defines a pragma directive. the attribute is named http-equiv(alent) because all the allowed values are names of particular http headers: content-security-policy allows page authors to define a content policy for the current page. content policies mostly specify allowed server origins and script en...
... not in documents served with an xml mime type. default-style sets the name of the default css style sheet set. x-ua-compatible if specified, the content attribute must have the value "ie=edge". user agents are required to ignore this pragma. refresh this instruction specifies: the number of seconds until the page should be reloaded - only if the content attribute
contains a positive integer. the number of seconds until the page should redirect to another - only if the content attribute
contains a positive integer followed by the string ';url=', and a valid url. accessibility concerns pages set with a refresh value run the risk of having the time interval being too short. people navigating with the aid of assistive technology such as a screen reader...
<title>: The Document Title element - HTML: Hypertext Markup Language
the html title element (<title>) defines the document's title that is shown in a browser's title bar or a page's tab. it only
contains text; tags within the element are ignored. <title>grandma's heavy metal festival journal</title> content categories metadata content. permitted content text that is not inter-element whitespace. tag omission both opening and closing tags are required. note that leaving off </title> should cause the browser to ignore the rest of the page. permitted parents a <head> element that
contains no other <title> element. implicit aria role no corresponding role permitted aria roles no role permitted. dom interface htmltitleelement attributes this element only includes the global at...
...>awesome interesting stuff</title> this example establishes a page whose title (as displayed at the top of the window or in the window's tab) as "awesome interesting stuff". accessibility concerns it is important to provide a title value that describes the page's purpose. a common navigation technique for users of assistive technology is to read the page title and infer the content the page
contains. this is because navigating into a page to determine its content can be a time consuming and potentially confusing process. example <title>menu - blue house chinese food - foodyum: online takeout today!</title> to help the user, update the page title value to reflect significant page state changes (such as form validation problems). example <title>2 errors - your order - blue house chinese ...
<video>: The Video Embed element - HTML: Hypertext Markup Language
0) autoplay doesn't work if no muted attribute is present. autopictureinpicture a boolean attribute which if true indicates that the element should automatically toggle picture-in-picture mode when the user switches back and forth between this document and another document or application. buffered an attribute you can read to determine the time ranges of the buffered media. this attribute
contains a timeranges object. controls if this attribute is present, the browser will offer controls to allow the user to control video playback, including volume, seeking, and pause/resume playback. controlslist the controlslist attribute, when specified, helps the browser select what controls to show on the media element whenever the browser shows its own set of controls (e.g. when the controls at...
...tanding wcag 2.0 understanding success criterion 1.2.2 | w3c understanding wcag 2.0 technical summary content categories flow content, phrasing content, embedded content. if it has a controls attribute: interactive content and palpable content. permitted content if the element has a src attribute: zero or more <track> elements, followed by transparent content that
contains no media elements–that is no <audio> or <video> else: zero or more <source> elements, followed by zero or more <track> elements, followed by transparent content that
contains no media elements–that is no <audio> or <video>. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts embedded content. i...
Link types - HTML: Hypertext Markup Language
in html, link types indicate the relationship between two documents, in which one links to the other using an <a>, <area>, <form>, or <link> element. list of the defined link types and their significance in html link type description allowed in these elements not allowed in these elements alternate if the element is <link> and the rel attribute also
contains the stylesheet type, the link defines an alternative style sheet; in that case the title attribute must be present and not be the empty string. if the type is set to application/rss+xml or application/atom+xml, the link defines a syndication feed. the first one defined on the page is the default. otherwise, the link defines an alternative page, of one of these types: for a...
...for example, a blog entry could link to a monthly index page this way. note: although recognized, the singular archive is incorrect and must be avoided. <a>, <area>, <link> <form> author defines a hyperlink to a page describing the author or providing a way to contact the author. note: this may be a mailto: hyperlink, but this is no...
Expressions and operators - JavaScript
« previousnext » this chapter describes javascript's expressions and operators, including assignment, comparison, arithmetic, bitwise, logical, string, ternary and more. a complete and detailed list of operators and expressions is also available in the reference. operators javascript has the following types of operators. this section describes the operators and
contains information about operator precedence. assignment operators comparison operators arithmetic operators bitwise operators logical operators string operators conditional (ternary) operator comma operator unary operators relational operators javascript has both binary and unary operators, and one special ternary operator, the conditional operator. a binary operator requires two operands, one before t...
...d" for the keywords true and null, the typeof operator returns the following results: typeof true; // returns "boolean" typeof null; // returns "object" for a number or string, the typeof operator returns the following results: typeof 62; // returns "number" typeof 'hello world'; // returns "string" for property values, the typeof operator returns the type of value the property
contains: typeof document.lastmodified; // returns "string" typeof window.length; // returns "number" typeof math.ln2; // returns "number" for methods and functions, the typeof operator returns results as follows: typeof blur; // returns "function" typeof eval; // returns "function" typeof parseint; // returns "function" typeof shape.split; // returns "function" ...
Functions - JavaScript
ining (outer) function. it also forms a closure. a closure is an expression (most commonly, a function) that can have free variables together with an environment that binds those variables (that "closes" the expression). since a nested function is a closure, this means that a nested function can "inherit" the arguments and variables of its containing function. in other words, the inner function
contains the scope of the outer function. to summarize: the inner function can be accessed only from statements in the outer function. the inner function forms a closure: the inner function can use the arguments and variables of the outer function, while the outer function cannot use the arguments and variables of the inner function. the following example shows nested functions: function addsqu...
...arguments, a new closure is created for each call to outside. the memory can be freed only when the returned inside is no longer accessible. this is not different from storing references in other objects, but is often less obvious because one does not set the references directly and cannot inspect them. multiply-nested functions functions can be multiply-nested. for example: a function (a)
contains a function (b), which itself
contains a function (c). both functions b and c form closures here. so, b can access a, and c can access b. in addition, since c can access b which can access a, c can also access a. thus, the closures can contain multiple scopes; they recursively contain the scope of the functions containing it. this is called scope chaining. (the reason it is called "chaining" i...
Indexed collections - JavaScript
« previousnext » this chapter introduces collections of data which are ordered by an index value. this includes arrays and array-like constructs such as array objects and typedarray objects. array object an array is an ordered list of values that you refer to with a name and an index. for example, consider an array called emp, which
contains employees' names indexed by their numerical employee number. so emp[0] would be employee number zero, emp[1] employee number one, and so on. javascript does not have an explicit array data type. however, you can use the predefined array object and its methods to work with arrays in your applications. the array object has methods for manipulating arrays in various ways, such as joining, reversing, and sorting them. it has a property for d...
...let arr = array(9.3) // rangeerror: invalid array length if your code needs to create arrays with single elements of an arbitrary data type, it is safer to use array literals. alternatively, create an empty array first before adding the single element to it. in es2015, you can use the array.of static method to create arrays with single element. let wisenarray = array.of(9.3) // wisenarray
contains only one element 9.3 referring to array elements because elements are also properties, you can access the using property accessors. suppose you define the following array: let myarray = ['wind', 'rain', 'fire'] you can refer to the first element of the array as myarray[0], the second element of the array as myarray[1], etc… the index of the elements begins with zero. note: you can also u...
Loops and iteration - JavaScript
value of condition is false, the for loop terminates. (if the condition expression is omitted entirely, the condition is assumed to be true.) the statement executes. to execute multiple statements, use a block statement ({ ... }) to group those statements. if present, the update expression incrementexpression is executed. control returns to step 2. example in the example below, the function
contains a for statement that counts the number of selected options in a scrolling list (a <select> element that allows multiple selections). the for statement declares the variable i and initializes it to 0. it checks that i is less than the number of options in the <select> element, performs the succeeding if statement, and increments i by after each pass through the loop. <form name="selectform"> <p...
...ontinue statement that executes when the value of i is 3. thus, n takes on the values 1, 3, 7, and 12. let i = 0; let n = 0; while (i < 5) { i++; if (i === 3) { continue; } n += i; console.log(n); } //1,3,7,12 let i = 0; let n = 0; while (i < 5) { i++; if (i === 3) { // continue; } n += i; console.log(n); } // 1,3,6,10,15 example 2 a statement labeled checkiandj
contains a statement labeled checkj. if continue is encountered, the program terminates the current iteration of checkj and begins the next iteration. each time continue is encountered, checkj reiterates until its condition returns false. when false is returned, the remainder of the checkiandj statement is completed, and checkiandj reiterates until its condition returns false. when false is returned, the ...
The arguments object - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. description note: if you're writing es6 compatible code, then rest parameters should be preferred. note: “array-like” means that arguments has a length property and properties indexed from zero, but it doesn't have array's built-in methods like foreach() or map(). see §description for details. ...
...ents can be determined by indexing arguments: console.log(typeof arguments[0]); // returns the type of the first argument properties arguments.callee reference to the currently executing function that the arguments belong to. forbidden in strict mode. arguments.length the number of arguments that were passed to the function. arguments[@@iterator] returns a new array iterator object that
contains the values for each index in arguments. examples defining a function that concatenates several strings this example defines a function that concatenates several strings. the function's only formal argument is a string containing the characters that separate the items to concatenate. function myconcat(separator) { let args = array.prototype.slice.call(arguments, 1); return args.join(separ...
Rest parameters - JavaScript
ur", "five", "six") // console output: // a, one // b, two // manymoreargs, [three, four, five, six] difference between rest parameters and the arguments object there are three main differences between rest parameters and the arguments object: rest parameters are only the ones that haven't been given a separate name (i.e. formally defined in function expression), while the arguments object
contains all arguments passed to the function; the arguments object is not a real array, while rest parameters are array instances, meaning methods like sort, map, foreach or pop can be applied on it directly; the arguments object has additional functionality specific to itself (like the callee property). from arguments to an array rest parameters have been introduced to reduce the boilerplate code t...
...u can easily gain access to a normal array using a rest parameter function f(...args) { let normalarray = args let first = normalarray.shift() // ok, gives the first argument } examples using rest parameters in this example, the first argument is mapped to a and the second to b, so these named arguments are used as normal. however, the third argument, manymoreargs, will be an array that
contains the 3rd, 4th, 5th, 6th ... nth — as many arguments that the user includes. function myfun(a, b, ...manymoreargs) { console.log("a", a) console.log("b", b) console.log("manymoreargs", manymoreargs) } myfun("one", "two", "three", "four", "five", "six") // a, one // b, two // manymoreargs, [three, four, five, six] below... even though there is just one value, the last argument still get...
Error.prototype.fileName - JavaScript
if called from a debugger context, the firefox developer tools for example, "debugger eval code" is returned. ...
...if called from a debugger context, the firefox developer tools for example, "debugger eval code" is returned. ...
Promise.any() - JavaScript
e.all(). warning! the promise.any() method is experimental and not fully supported by all browsers and platforms. it is currently in stage 4 of the tc39 process. syntax promise.any(iterable); parameters iterable an iterable object, such as an array. return value an already resolved promise if the iterable passed is empty. an asynchronously resolved promise if the iterable passed
contains no promises. a pending promise in all other cases. this returned promise is then resolved/rejected asynchronously (as soon as the stack is empty) when any of the promises in the given iterable resolve, or if all the promises have rejected. description this method is useful for returning the first promise that fulfils. it short-circuits after a promise fulfils, so it does not wait for the othe...
...ulfilled or rejected. if an empty iterable is passed, then this method returns (synchronously) an already resolved promise. if any of the passed-in promises fulfill or are not promises, the promise returned by promise.any is fulfilled asynchronously. rejection if all of the passed-in promises reject, promise.any asynchronously rejects with an aggregateerror object, which extends error, and
contains an errors property with an array of rejection values. examples first to fulfil promise.any() resolves with the first promise to fulfil, even if a promise rejects first. this is in contrast to promise.race(), which resolves or rejects with the first promise to settle. const perr = new promise((resolve, reject) => { reject("always fails"); }); const pslow = new promise((resolve, reject) => {...
Promise.race() - JavaScript
that asynchronously yields the value of the first promise in the given iterable to fulfill or reject. description the race function returns a promise that is settled the same way (and takes the same value) as the first promise that settles amongst the promises of the iterable passed as an argument. if the iterable passed is empty, the promise returned will be forever pending. if the iterable
contains one or more non-promise value and/or an already settled promise, then promise.race will resolve to the first of these values found in the iterable. examples asynchronicity of promise.race this following example demonstrates the asynchronicity of promise.race: // we are passing as argument an array of promises that are already resolved, // to trigger promise.race as soon as possible var resolv...
...33 } an empty iterable causes the returned promise to be forever pending: var foreverpendingpromise = promise.race([]); console.log(foreverpendingpromise); settimeout(function(){ console.log('the stack is now empty'); console.log(foreverpendingpromise); }); // logs, in order: // promise { <state>: "pending" } // the stack is now empty // promise { <state>: "pending" } if the iterable
contains one or more non-promise value and/or an already settled promise, then promise.race will resolve to the first of these values found in the array: var foreverpendingpromise = promise.race([]); var alreadyfulfilledprom = promise.resolve(100); var arr = [foreverpendingpromise, alreadyfulfilledprom, "non-promise value"]; var arr2 = [foreverpendingpromise, "non-promise value", promise.resolve(100)]; ...
Reflect - JavaScript
n that is true if the update was successful. reflect.set(target, propertykey, value[, receiver]) a function that assigns values to properties. returns a boolean that is true if the update was successful. reflect.setprototypeof(target, prototype) a function that sets the prototype of an object. returns a boolean that is true if the update was successful. ...
... ...
WebAssembly.Module.customSections() - JavaScript
get a .wasm with a names custom section, for example: wast2wasm simple-name-section.was -o simple-name-section.wasm --debug-names examples using customsections the following example (see the custom-section.html source and live example) compiles the loaded simple-name-section.wasm byte code. ...
... browser compatibility the compatibility table on this page is generated from structured data. ...
try...catch - JavaScript
try-block. exception_var_1, exception_var_2 an identifier to hold an exception object for the associated catch-block. condition_1 a conditional expression. finally_statements statements that are executed after the try statement completes. these statements execute regardless of whether an exception was thrown or caught. description the try statement consists of a try-block, which
contains one or more statements. {} must always be used, even for single statements. at least one catch-block, or a finally-block, must be present. this gives us three forms for the try statement: try...catch try...finally try...catch...finally a catch-block
contains statements that specify what to do if an exception is thrown in the try-block. if any statement within the try-block (or in a functio...
...ption is thrown in the try-block, exception_var (i.e., the e in catch (e)) holds the exception value. you can use this identifier to get information about the exception that was thrown. this identifier is only available in the catch-block's scope. function isvalidjson(text) { try { json.parse(text); return true; } catch { return false; } } the finally-block the finally-block
contains statements to execute after the try-block and catch-block(s) execute, but before the statements following the try...catch...finally-block. note that the finally-block executes regardless of whether an exception is thrown. also, if an exception is thrown, the statements in the finally-block execute even if no catch-block handles the exception. the following example shows one use case for the fina...
Authoring MathML - MathML
mathematical notations are even more complex with structures like fractions, square roots or matrices that are likely to require their own tags. as a consequence, good mathml authoring tools are more important and we describe some tools below. ...
...orm server-side latex-to-mathml conversion. instiki and mediawiki are two wiki engines that support latex-to-mathml conversion. graphical interface input box texzilla has several interfaces, including a ckeditor plugin used on mdn, an online demo, a firefox add-on or a firefoxos webapp. it has also been integrated into seamonkey since version 2.28 and into thunderbird since version 31. abiword
contains a small equation editor, based on itex2mml. finally, bluegriffon has an add-on to insert mathml formulas in your document, using ascii/latex-like syntax. wysiywg editors firemath is an extension for firefox that provides a wysiwyg mathml editor. a preview of the formula is displayed using the rendering engine of mozilla. the generated mathml code is available at the bottom. use the text field...
<semantics> - MathML
ntent markup and to provide both, layout information and semantic meaning of mathematical expressions. the <semantics> element acts as a container element associating annotations and must have child elements (it will raise an invalid markup error otherwise). the <annotation> element is the container element containing semantic information in a non-xml format, whereas the <annotation-xml> element
contains content in an xml format, e.g. content mathml or openmath. the rules of determining the visible child in a <semantics> element are the following: if no rule other rule applies: by default only the first child is rendered, which is supposed to be presentation markup. if the first child is a presentation mathml element other than <annotation> or <annotation-xml>, render the first child. if no...
...oes not distinguish between content or presentation mathml. attributes the following attributes can be set on <annotation> and <annotation-xml>: definitionurl the location of the annotation key symbol. encoding the encoding of the semantic information in the annotation (e.g. "mathml-content", "mathml-presentation", "application/openmath+xml", "image/png") cd the content dictionary that
contains the annotation key symbol. name the name of the annotation key symbol. src the location of an external source for semantic information. example <math> <semantics> <!-- presentation mathml --> <mrow> <msup> <mi>x</mi> <mn>2</mn> </msup> <mo>+</mo> <mi>y</mi> </mrow> <!-- content mathml --> <annotation-xml encoding="mathml-conte...
Digital video concepts - Web media technologies
was originally used specifically for analog coding of color, while ycbcr was used for digital color. however, today both terms are used for digital color. the prime symbol, ', indicates that gamma compression is being used. contemplating human vision we're able to represent an image this way because the human eye sees far more detail in greyscale than in color, thanks to biology. the human eye
contains two kinds of photoreceptor (light-sensing) cells. the rods are highly-sensitive light intensity sensors. the cones are less sensitive but are able to detect color. because the eye has vastly more rods than cones (about 120 million rods to around 6 or 7 million cones), we see detail in greyscale, with color being far less detailed. in essence, our eyes are like a camera with two image sensor chip...
...detail in greyscale than in color, the values of y', u, and v are not typically stored together, one sample per pixel, the way rgb images are stored in memory. each frame of video is represented by a matrix of luma values, y, with each pixel's color computed using the values in the u and v matrices. for example, in the av1 codec, a record stores the encoded luma for a tile, and a second record
contains the chroma data in the form of the u and v values. in broadcast television, the luma signal is the primary signal, while the chrominance data is sent on a subcarrier. the jpeg file type's compression works by first converting the image to the y'uv color system, then compressing that data. each of y', cb, and cr are able to have values from 0 to 255. ...
Web Performance
o optimizer for users with lousy connections. this article explains what latency is, how it impacts performance, how to measure latency, and how to reduce it.using dns-prefetchdns-prefetch is an attempt to resolve domain names before resources get requested. this could be a file loaded later or link target a user tries to follow. beginner's tutorials the mdn web performance learning area
contains modern, up-to-date tutorials covering performance essentials. start here if you are a newcomer to performance: web performance: brief overview overview of the web performance learning path. start your journey here. what is web performance? this article starts the module off with a good look at what performance actually is — this includes the tools, metrics, apis, networks, and groups of...
...sting assets to them. analyzing javascript bundles no doubt, javascript is a big part of modern web development. while you should always strive to reduce the amount of javascript you use in your applications, it can be difficult to know where to start. in this guide, we'll show you how to analyze your application's script bundles, so you know what you're using, as well how to detect if your app
contains duplicated scripts between bundles. lazy loading it isn't always necessary to load all of a web applications assets on initial page load. lazy loading is deferring the loading of assets on a page, such as scripts, images, etc., on a page to a later point in time i.e when those assets are actually needed. lazy-loading javascript with dynamic imports when developers hear the term "lazy loading"...
Add to Home screen - Progressive web apps (PWAs)
ate icon available for displaying on the home screen. chrome additionally requires the app to have a service worker registered (e.g., so it can function when offline). manifest the web manifest is written in standard json format and should be placed somewhere inside your app directory (in the root is probably best) with the name somefilename.webmanifest (we've chosen manifest.webmanifest). it
contains multiple fields that define certain information about the web app and how it should behave. note: the .webmanifest extension is specified in the media type registration section of the specification, but generally browsers will support manifests with other appropriate extensions, e.g. .json. the fields needed for a2hs are as follows: background_color: specifies a background color to be used...
... call event.preventdefault() to stop chrome 67 and earlier from calling the install prompt automatically (this behavior changed in chrome 68). store the event object in the deferredprompt variable so it can be used later on to perform the actual installation. set the button to display: block so it appears in the ui for the user to click. set a click handler for the button. the click handler
contains the following steps: hide the button again with display: none — it is no longer needed once the app is installed. use the prompt() method available on the beforeinstallprompt event object (stored in deferredprompt) to trigger showing the install prompt. respond to the user's interaction with the prompt using the userchoice property, again available on the beforeinstallprompt event object. ...
How to make PWAs re-engageable using Notifications and Push - Progressive web apps (PWAs)
the user about something, or let them know about new content being available in the app. push example push needs the server part to work, so we're not able to include it in the js13kpwa example hosted on github pages, as it offers hosting of static files only. it is all explained in the service worker cookbook — see the push payload demo. this demo consists of three files: index.js, which
contains the source code of our app server.js, which
contains the server part (written in node.js) service-worker.js, which
contains the service worker-specific code. let's explore all of these index.js the index.js file starts by registering the service worker: navigator.serviceworker.register('service-worker.js') .then(function(registration) { return registration.pushmanager.getsubscription() ...
...an read the sending vapid identified webpush notifications via mozilla’s push service blog post. the app can now use the pushmanager to subscribe the new user. there are two options passed to the pushmanager.subscribe() method — the first is uservisibleonly: true, which means all the notifications sent to the user will be visible to them, and the second one is the applicationserverkey, which
contains our successfully acquired and converted vapid key. return registration.pushmanager.subscribe({ uservisibleonly: true, applicationserverkey: convertedvapidkey }); now let's move to the subscription part — the app first sends the subscription details as json to the server using fetch. fetch('./register', { method: 'post', headers: { 'content-type': 'application/json' ...
SVG Core Attributes - SVG: Scalable Vector Graphics
er (id) which must be unique in the whole document. its purpose is to identify the element when linking (using a fragment identifier), scripting, or styling (with css). value: any valid id string; animatable: no lang participates in defining the language of the element, the language that non-editable elements are written in or the language that editable elements should be written in. the tag
contains one single entry value in the format defined in the tags for identifying languages (bcp47) ietf document. svg 2 introduce the new lang attributes. if both lang and xml:lang attribute are used, xml:lang has priority over lang. value: any valid language id; animatable: no tabindex the tabindex svg attribute allows you to control whether an element is focusable and to define the relative...
... whether an element is focusable and to define the relative order of the element for the purposes of sequential focus navigation. value type: <integer>; animatable: no xml:base specifies a base iri other than the base iri of the document. value type: <iri>; animatable: no xml:lang it is a universal attribute allowed in all xml dialects to mark up the natural human language that an element
contains. it's almost identical in usage to html's lang, but in conforming xml 1.0 documents, it does not allow the use of a null attribute value (xml:lang="") to indicate an unknown language. instead, use xml:lang="und". svg 2 introduce the new lang attributes. if both lang and xml:lang attribute are used, xml:lang has priority over lang. value: any valid language id; animatable: no xml:space ...
SVG documentation index - SVG: Scalable Vector Graphics
yph-orientation-vertical attribute affects the amount that hte current text position advances as each glyph is rendered. 96 glyphref deprecated, svg, svg attribute the glyphref attribute represents the glyph identifier, the format of which is dependent on the format of the given font. 97 gradienttransform svg, svg attribute the gradienttransform attribute
contains the definition of an optional additional transformation from the gradient coordinate system onto the target coordinate system (i.e., userspaceonuse or objectboundingbox). this allows for things such as skewing the gradient. this additional transformation matrix is post-multiplied to (i.e., inserted to the right of) any previously defined transformations, including the implicit transformation nece...
...vents svg, svg attribute the pointer-events attribute is a presentation attribute that allows defining whether or when an element may be the target of a mouse event. 163 points svg, svg attribute the points attribute defines a list of points. each point is defined by a pair of number representing a x and a y coordinate in the user coordinate system. if the attribute
contains an odd number of coordinates, the last one will be ignored. 164 pointsatx filters, svg, svg attribute the pointsatx attribute represents the x location in the coordinate system established by attribute primitiveunits on the <filter> element of the point at which the light source is pointing. 165 pointsaty filters, svg, svg attribute the pointsaty attribut...
Using shadow DOM - Web Components
e is that none of the code inside a shadow dom can affect anything outside it, allowing for handy encapsulation. note that the shadow dom is not a new thing by any means — browsers have used it for a long time to encapsulate the inner structure of an element. think for example of a <video> element, with the default browser controls exposed. ...
.... all you see in the dom is the <video> element, but it
contains a series of buttons and other controls inside its shadow dom. the shadow dom spec has made it so that you are allowed to actually manipulate the shadow dom of your own custom elements. basic usage you can attach a shadow root to any element using the element.attachshadow() method. ...
Web Components
s. using shadow dom a guide that looks at shadow dom fundamentals, showing how to attach a shadow dom to an element, add to the shadow dom tree, style it, and more. using templates and slots a guide showing how to define a reusable html structure using <template> and <slot> elements, and then use that structure inside your web components. reference custom elements customelementregistry
contains functionality related to custom elements, most notably the customelementregistry.define() method used to register new custom elements so they can then be used in your document. window.customelements returns a reference to the customelementregistry object. life cycle callbacks special callback functions defined inside the custom element's class definition, which affect its behavior: connec...
... event.composed: returns a boolean which indicates whether the event will propagate across the shadow dom boundary into the standard dom (true), or not (false). event.composedpath: returns the event’s path (objects on which listeners will be invoked). this does not include nodes in shadow trees if the shadow root was created with shadowroot.mode closed. html templates <template>
contains an html fragment that is not rendered when a containing document is initially loaded, but can be displayed at runtime using javascript, mainly used as the basis of custom element structures. the associated dom interface is htmltemplateelement. <slot> a placeholder inside a web component that you can fill with your own markup, which lets you create separate dom trees and present them together. t...
Index - XSLT: Extensible Stylesheet Language Transformations
cessor in the web api documentation section. 9 introduction gecko, intro, javascript, xslt with modern browsers supporting xslt, developers can now use javascript to access the power that xslt provides. javascript can enable a web application to load xml data, process it via xslt into a presentable form and then add it into an existing document. since the xml data loaded only
contains the raw information without any presentation data, it can load quickly even on dialup. 10 javascript/xslt bindings dom, javascript, xml, xslt javascript can run xslt transformations through the xsltprocessor object. once instantiated, an xsltprocessor has an xsltprocessor.importstylesheet() method that takes as an argument the xslt stylesheet to be used in the transformation.
... element selects a set of nodes and processes each of them in the same way. it is often used to iterate through a set of nodes or to change the current node. if one or more <xsl:sort> elements appear as the children of this element, sorting occurs before processing. otherwise, nodes are processed in document order. 33 <xsl:if> element, reference, xslt, if the <xsl:if> element
contains a test attribute and a template. if the test evaluates to true, the template is processed. in this it is similar to an if statement in other languages. to achieve the functionality of an if-then-else statement, however, use the <xsl:choose> element with one <xsl:when> and one <xsl:otherwise> children. 34 <xsl:import> element, reference, xslt, import the <xsl:import> element i...
Caching compiled WebAssembly modules - WebAssembly
to the new database. ...
... if opening the database failed (for example due to permissions or quota), we fall back to simply fetching and compiling the module and don't try to store the results (since there is no database to store them into). errmsg => { console.log(errmsg); return webassembly.instantiatestreaming(fetch(url)).then(results ...
WebAssembly Concepts - WebAssembly
hese concepts are reflected 1:1 in the webassembly javascript api. module: represents a webassembly binary that has been compiled by the browser into executable machine code. a module is stateless and thus, like a blob, can be explicitly shared between windows and workers (via postmessage()). a module declares imports and exports just like an es2015module. memory: a resizable arraybuffer that
contains the linear array of bytes read and written by webassembly’s low-level memory access instructions. table: a resizable typed array of references (e.g. to functions) that could not otherwise be stored as raw bytes in memory (for safety and portability reasons). instance: a module paired with all the state it uses at runtime including a memory, table, and set of imported values. an instance is li...
...imagine. for a start, emscripten implements popular c/c++ libraries like sdl, opengl, openal, and parts of posix. these libraries are implemented in terms of web apis and thus each one requires some javascript glue code to connect webassembly to the underlying web api. so part of the glue code is implementing the functionality of each respective library used by the c/c++ code. the glue code also
contains the logic for calling the above-mentioned webassembly javascript apis to fetch, load and run the .wasm file. the generated html document loads the javascript glue file and writes stdout to a <textarea>. if the application uses opengl, the html also
contains a <canvas> element that is used as the rendering target. it’s very easy to modify the emscripten output and turn it into whatever web app ...
Compiling from Rust to WebAssembly - WebAssembly
t's talk about them in turn. we give a high-level explanation here, and gloss over some details; to learn more about rust, please check the free online book the rust programming language. using wasm-bindgen to communicate between rust and javascript the first part looks like this: use wasm_bindgen::prelude::*; libraries are called "crates" in rust. get it? cargo ships crates. the third line
contains a use command, which imports code from a library into your code. in this case, we're importing everything in the wasm_bindgen::prelude module. we use these features in the next section. before we move on to the next section, we should talk a bit more about wasm-bindgen. wasm-pack uses wasm-bindgen, another tool, to provide a bridge between the types of javascript and rust. it allows javascript ...
...ing out to the world. this function is named greet, and takes one argument, a string (written &str), name. it then calls the alert function we asked for in the extern block above. it passes a call to the format! macro, which lets us concatenate strings. the format! macro takes two arguments in this case, a format string, and a variable to put in it. the format string is the "hello, {}!" bit. it
contains {}s, where variables will be interpolated. the variable we're passing is name, the argument to the function, so if we call greet("steve") we should see "hello, steve!". this is passed to alert(), so when we call this function we will see an alert box with "hello, steve!" in it. now that our library is written, let's build it. compiling our code to webassembly to compile our code correctly, we...
port - Archive of obsolete content
eived their payloads are automatically deserialized, so you don't need to worry about serialization. however, you do have to ensure that the payload can be serialized to json. this means that it needs to be a string, number, boolean, null, array of json-serializable values, or an object whose property values are themselves json-serializable. this means you can't send functions, and if the object
contains methods they won't be encoded. you also can't include circular references. for example, to include an array of strings in the payload: // main.js var pagemods = require("sdk/page-mod"); var self = require("sdk/self"); var pagemod = pagemods.pagemod({ include: ['*'], contentscriptfile: self.data.url("content-script.js"), onattach: setuplistener }); function setuplistener(worker) { wor...
Communicating using "port" - Archive of obsolete content
eived their payloads are automatically deserialized, so you don't need to worry about serialization. however, you do have to ensure that the payload can be serialized to json. this means that it needs to be a string, number, boolean, null, array of json-serializable values, or an object whose property values are themselves json-serializable. this means you can't send functions, and if the object
contains methods they won't be encoded. for example, to include an array of strings in the payload: var pagemodscript = "self.port.emit('loaded'," + " [" + " document.location.tostring()," + " document.title" + " ]" + ");" var pagemod = require('page-mod').pagemod({ include: ['*'], contentscript:...
Classes and Inheritance - Archive of obsolete content
e.draw(); // typeerror: ctx is not defined which is the behavior we were aiming for. classes in the add-on sdk we have shown how to emulate classical inheritance in javascript using constructors and prototypes. however, as we have seen, this takes a significant amount of boilerplate code. the add-on sdk team consists of highly trained professionals, but they are also lazy: that is why the sdk
contains a helper function that handles this boilerplate code for us. it is defined in the module “core/heritage”: const { class } = require('sdk/core/heritage'); the function class is a meta-constructor: it creates constructors that behave properly with respect to inheritance. it takes a single argument, which is an object which properties will be defined on the prototype of the resulting construc...
Program ID - Archive of obsolete content
to distinguish between new add-ons and updates to existing add-ons, and the simple-storage module uses it to figure out which stored data belongs to which add-on. when you create an xpi with jpm xpi: if the package.json does not include an id field, then the id written into the install.rdf is the value of the name field prepended with "@". if the package.json does include an id field, and it
contains "@", then this is written into the install.rdf as the add-on id. if the package.json does include an id field, and it does not contain "@", then jpm xpi raises an error and the xpi will not be built. ...
XUL Migration Guide - Archive of obsolete content
forward button", icon: "./icon-16.png", onclick: removeforwardbutton }); there are more useful examples of this technique in the jetpack wiki's collection of third party modules. accessing tabbrowser this example uses the action button api, which is only available from firefox 29 onwards. the tabs/utils module gives you direct access to the tabbrowser object and the xul tab objects it
contains. this simple example modifies the selected tab's css to enable the user to highlight the selected tab: function highlightactivetab() { var window = require("sdk/window/utils").getmostrecentbrowserwindow(); var tab = require("sdk/tabs/utils").getactivetab(window); if (tab.style.getpropertyvalue('background-color')) { tab.style.setproperty('background-color','','important'); } else {...
page-mod - Archive of obsolete content
options.showoptions) { window.alert(self.options.greeting); var sum = self.options.numbers[0] + self.options.numbers[1]; window.alert(sum); } the values can be any json-serializable value: a string, number, boolean, null, array of json-serializable values, or an object whose property values are themselves json-serializable. this means you can't send functions, and if the object
contains methods they won't be usable. you also can't pass cyclic values. name: contentstylefile type: string,array use this option to load one or more stylesheets into the targeted documents as user stylesheets. each stylesheet is supplied as a separate file under your add-on's "data" directory, and is specified by a url typically constructed using the url() method of the self module's data o...
page-worker - Archive of obsolete content
t script using the port.emit function receive events from the content script using the port.on function see the guide to communicating using port for details. contenturl the url of content to load. this can point to local content loaded from your add-on's "data" directory or remote content. setting it loads the content immediately. allow a object describing permissions for the content. it
contains a single key named script whose value is a boolean that indicates whether or not to execute script in the content. script defaults to true. include a set of match patterns to define the urls which the page-worker's content script will be applied. this is useful when using pages which redirect to other pages in your page-worker. contentscriptfile a local file url or an array of local file urls...
request - Archive of obsolete content
t() make a post request. put() make a put request. delete() make a delete request. properties url headers content contenttype response events complete the request object emits this event when the request has completed and a response has been received. arguments response : listener functions are passed the response to the request as a response object. response the response object
contains the response to a network request issued using a request object. it is returned by the get(), head(), post(), put() or delete() method of a request object. all members of a response object are read-only. properties url the url of the response content. text the content of the response as plain text. json the content of the response as a javascript object. the value will be null if the docu...
tabs - Archive of obsolete content
s are passed the tab object that has loaded. activate this event is emitted when an inactive tab is made active. arguments tab : listeners are passed the tab object that has become active. deactivate this event is emitted when the active tab is made inactive. arguments tab : listeners are passed the tab object that has become inactive. tab a tab instance represents a single open tab. it
contains various tab properties, several methods for manipulation, as well as per-tab event registration. tabs emit all the events described in the events section. listeners are passed the tab object that triggered the event. methods pin() pins this tab as an app tab. unpin() unpins this tab. close(callback) closes this tab. parameters callback : function a function to be called when the tab fi...
windows - Archive of obsolete content
close the window. parameters callback : function a function to be called when the window finishes its closing process. this is an optional argument. properties title the current title of the window. usually the title of the active tab, plus an app identifier. this property is read-only. tabs a live list of tabs in this window. this object has the same interface as the tabs api, except it
contains only the tabs in this window, not all tabs in all windows. this property is read-only. ...
/loader - Archive of obsolete content
if arguments have properties with conflicting names the property from the second argument overrides that from the first. this function is helpful for combining default and passed properties: override({ a: 1, b: 1 }, { b: 2, c: 2 }) // => { a: 1, b: 2, c: 2 } descriptor() this utility function takes an object and as an argument and returns property desc...
content/loader - Archive of obsolete content
riptoptions allow when certain of these properties are set, the loader emits a propertychange event, enabling its users to take the appropriate action. the loader is used by modules that use content scripts but don't themselves load content, such as page-mod. modules that load their own content, such as panel and page-worker, use the symbiont module instead. symbiont inherits from loader but
contains its own frame into which it loads content supplied as the contenturl option. example: the following code creates a wrapper on a hidden frame that reloads a web page in the frame every time the contenturl property is changed: var hiddenframes = require("sdk/frame/hidden-frame"); var { loader } = require("sdk/content/content"); var pageloader = loader.compose({ constructor: function pageloader...
core/promise - Archive of obsolete content
note: a promise can be rejected or resolved only once. all subsequent attempts to either reject it or resolve it will be ignored. another simple example may be a delay function that returns a promise which is fulfilled with a given value after a given time ms -- kind of promise based alternative to set...
net/xhr - Archive of obsolete content
er data, though this may be inconsequential if the client can't access the network. if access to local area networks isn't prevented, malicious code could access sensitive data. if transmission of cookies isn't prevented, malicious code could access sensitive data. attenuating access based on a regular expression may be ineffective if it's easy to write a regular expression that looks safe but
contains a special character or two that makes it far less secure than it seems at first glance. possible attenuations before being exposed to unprivileged code, this object needs to be attenuated in such a way that, at the very least, it can't access the user's filesystem. this can probably be done most securely by white-listing the protocols that can be used in the url passed to the open() method, and...
places/history - Archive of obsolete content
ter inherits from event/target, and emits data, error, and end. data events are emitted for every individual search result found, whereas end events are emitted as an aggregate of an entire search, passing in an array of all results into the handler. events data the data event is emitted for every item returned from a search. arguments object : this is an object representing a history entry.
contains url, time, accesscount and title of the entry. error the error event is emitted whenever a search could not be completed. arguments string : a string indicating the error that occurred. end the end event is called when all search results have returned. arguments array : the value passed into the handler is an array of all entries found in the history search. each entry is an object contai...
remote/parent - Archive of obsolete content
child processes. the module loads asynchronously but you can start sending messages to the module immediately. you can use an absolute path to the module or a relative path. if you use a relative path, you must use the module parameter. const { remoterequire } = require("sdk/remote/parent"); remoterequire("./my-module.js", module); note that even single-process applications have a process that
contains content frames. for consistency and to make writing multiprocess compatible code easier, remoterequire() will also create a new module loader and load modules in the main process. parameters id : string the module to load. to use a relative path you must pass the module parameter. module : object the module to resolve the relative module id against. to resolve relative to the loading module,...
test/assert - Archive of obsolete content
providing extra information about the test. throws(block, error, message) assert that a block of code throws the expected exception. this method takes an optional error argument: to check that the exception thrown is of the expected type, pass a constructor function: the exception thrown must be an instance of the object returned by that function. ...
test/runner - Archive of obsolete content
experimental sets up unit tests. this module
contains the package's main program, which does a bit of high-level setup and then delegates test finding and running to the harness module. for more information on testing in the add-on sdk, see the unit testing tutorial. ...
ui/button/toggle - Archive of obsolete content
you can generate click and change events programmatically with the button's click() method. attaching panels to buttons you can attach panels to buttons by passing the button as the position option to the panel's show() method or the panel's constructor: var { togglebutton } = require('sdk/ui/button/toggle'); var panels = require("sdk/panel"); var self = require("...
ui/sidebar - Archive of obsolete content
ent by setting the sidebar's url property. this will change the sidebar's content across all windows. communicating with sidebar scripts you can't directly access your sidebar's content from your main add-on code, but you can send messages between your main add-on code and scripts loaded into your sidebar. on the sidebar end of the conversation, sidebar scripts get a global variable addon that
contains a port for sending and receiving messages. on the add-on side, you need to get a worker object for the sidebar before you can send or receive messages. there are two events emitted by the sidebar which will give you a worker: attach and ready. listen to attach if the first message in your add-on goes from the sidebar scripts to the main add-on code, and listen to ready if the first message goes ...
util/object - Archive of obsolete content
); merge(c, d); var props = object.getownpropertydescriptor(c, "name"); console.log(props.configurable); // true parameters source : object the object that other properties are merged into. arguments : object n amount of additional objects that are merged into source object. returns object : the source object. extend(arguments) returns an object that inherits from the first argument and
contains all of the properties from all following arguments, with precedence from right to left. extend(source1, source2, source3) is the equivalent of merge(object.create(source1), source2, source3). let { extend } = require("sdk/util/object"); var a = { alpha: "a" }; var b = { beta: "b" }; var g = { gamma: "g", alpha: null }; var x = extend(a, b, g); console.log(a); // { alpha: "a" } console.log(b); ...
cfx to jpm - Archive of obsolete content
ackage.json will be something like "jid1-f3boogbjqje67a", and the corresponding id in the install.rdf will be "jid1-f3boogbjqje67a@jetpack". id handling with jpm when you create an xpi with jpm xpi: if the package.json does not include an id field, then the id written into the install.rdf is the value of the name field prepended with "@". if the package.json does include an id field, and it
contains "@", then this is written into the install.rdf as the add-on id. if the package.json does include an id field, and it does not contain "@", then jpm xpi raises an error and the xpi will not be built. what you need to do all this means that: if your package.json
contains an id field, and its value does not contain "@", then you must append "@jetpack" to it when switching to jpm. if you do thi...
jpm - Archive of obsolete content
u can stop reading this section. if you do not list your add-on on addons.mozilla.org, you need to generate a mozilla-signed xpi and tell firefox where it can find new versions of your add-on. the way this works is: you run jpm sign anytime you need to create a new version you host the signed add-on xpi and update it when you need to you host an "update manifest", which, among other things,
contains a url pointing to the xpi your add-on tells firefox where it can find the update manifest to do this, include two extra keys in package.json: updateurl: this url is included in the install manifest of the xpi file that jpm xpi builds. it points to your update manifest. the updateurl value may be https. if it is not, then you'll also need to sign the update manifest, and then include the pub...
jpmignore - Archive of obsolete content
to avoid recursivity. # you can end patterns with a forward slash (/) to specify a directory. /sample/ a .jpmignore file with the above contents would ignore all zip files and .ds_store files and sample directory from the xpi generated by jpm xpi. using .jpmignore to allow files everything in your add-on directory will be included in the xpi file you make with jpm xpi. if your project folder
contains a lot of files that aren't necessary for the xpi to run, like documentation, jshint, etc., you can use .jpmignore as a whitelist instead of a blacklist. for example: .* * !/data/** !/lib/** !/locale/** !/node_modules/** !/package.json !/icon.png !/icon64.png !/copying !/bootstrap.js !/install.rdf this would include all editor backup files and similar in the whitelisted subdirectories, to avoid ...
Tools - Archive of obsolete content
add-on to log error, warning or informational messages. jpm jpm is a command-line tool that enables you to test, run, and package add-ons. jpm-mobile the node-based replacement for cfx --force-mobile. enables you to run and test add-ons for firefox mobile (aka fennec). jpmignore use .jpmignore to ignore files from your xpi builds created via jpm. package.json the package.json file
contains manifest data for your add-on, providing not only descriptive information about the add-on for presentation in the add-ons manager, but other metadata required of add-ons. ...
Creating annotations - Archive of obsolete content
its ancestors in the dom tree, has an attribute named "id". the idea here is to make it more likely that the annotator will be able to identify annotated elements correctly later on. if the page element is eligible for annotation, then the selector highlights that element and binds a click handler to it. the click handler sends a message called show back to the main add-on code. the show message
contains: the url for the page, the id attribute value, and the text content of the page element. $('*').mouseenter(function() { if (!active || $(this).hasclass('annotated')) { return; } resetmatchedelement(); ancestor = $(this).closest("[id]"); matchedelement = $(this).first(); originalbgcolor = $(matchedelement).css('background-color'); $(matchedelement).css('background-color', 'yello...
Overview - Archive of obsolete content
x. the widget api is deprecated from firefox 29 onwards. please see the ui module for replacements. in particular, for a simple button, try the action button or toggle button apis, and for a more complex widget try the toolbar or sidebar apis. the annotator uses content scripts to build user interfaces, get user input, and examine the dom of pages loaded by the user. meanwhile the main module
contains the application logic and mediates interactions between the different sdk objects. we could represent the basic interactions between the main module and the various content scripts like this: user interface the annotator's main user interface consists of a widget and three panels. the widget is used to switch the annotator on and off, and to display a list of all the stored annotations. ...
Display a Popup - Archive of obsolete content
g, use the panel module. a panel's content is defined using html. you can run content scripts in the panel: although the script running in the panel can't directly access your main add-on code, you can exchange messages between the panel script and the add-on code. in this tutorial we'll create an add-on that adds an action button to the toolbar that displays a panel when clicked. the panel just
contains a <textarea> element: when the user presses the return key, the contents of the <textarea> is sent to the main add-on code. the main add-on code logs the message to the console. the add-on consists of seven files: package.json: created when you run jpm init index.js: the main add-on code, that creates the button and panel get-text.js: the content script that interacts with the panel content...
Modifying Web Pages Based on URL - Archive of obsolete content
s can't directly access each other's variables or call each other's functions, but they can send each other messages. to send a message from one side to the other, sender calls port.emit() and receiver listens using port.on(). in the content script, port is a property of the global self object. in the add-on script, you need to listen for the onattach event to get passed a worker object that
contains port. let's rewrite the example above to pass a message from the add-on to the content script. the message will contain the new content to insert into the document. the content script now needs to look like this: // "self" is a global object in content scripts // listen for a message, and replace the document's // contents with the message payload. self.port.on("replacepage", function(message...
Using third-party modules (jpm) - Archive of obsolete content
r sdk modules that don't ship inside firefox. module developers can publish sdk modules to npm, and add-on developers can install them from npm and build them into their add-ons. this article explains how to use npm-hosted third-party sdk modules with jpm. we'll use the menuitem package to add a new menu item to firefox. summary first, while in the root of your add-on, install the package that
contains the modules you want to use: npm install menuitem --save now you'll see a new directory in your add-on root called "node_modules" that
contains a directory "menuitem". in your add-on code, you can require() modules by passing a path to the module starting from, but not including "node_modules": var menuitems = require("menuitem"); details create a new directory called, for example, "my-menui...
Customizing the download progress bar - Archive of obsolete content
reference the new stylesheet: <?xml version="1.0"?> <?xml-stylesheet href="chrome://myextension/skin/myextension.css" type="text/css"?> <overlay id="mydownloadoverlay" xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul"> </overlay> in jar.mn, make sure that there is an asterisk in front of the entry for myextension.css so that it will be preprocessed. this is required since it
contains platform-specific directives, as we will see. the myextension.css file will look something like this: richlistitem progressmeter { %ifdef xp_win min-height: 17px !important; %else %ifdef xp_macosx -moz-appearance: none !important; background-image: url(chrome://myextension/skin/progress_bg_osx.png) !important; %endif %endif } richlistitem .progress-bar { %ifdef xp_win -moz...
HTML in XUL for rich tooltips - Archive of obsolete content
rvice(components.interfaces.nsiscriptableunescapehtml) .parsefragment(txt, false, null, div); //attach the dom object to the html div element div.appendchild(injecthtml); } } window.addeventlistener('load', htmltip.onload, false); in the xul overlay, xmlns:html is used to enable html tags to be used inside the xul. our enhanced xul tooltip is an element that is written ahead of time, and it
contains an html div element whose type attribute lowers its privileges to being that content element, although it is an element of chrome. this is recommended for security reasons, especially if remote html is to be inserted. a number of menuitems have a tooltip attribute pointing to the same tooltip. that tooltip is empty now, but we will use the mouseover event to dynamically populate the tooltip (whi...
Sidebar - Archive of obsolete content
the good practice to determine which sidebar is open at a time is by testing in location property, which is a chrome url: var sidebarwindow = document.getelementbyid("sidebar").contentwindow; if (sidebarwindow.location.href == "chrome://yourextension/content/whatever.xul") { // act on the sidebar content } for example to test if the web panel from firefox is open: var side...
StringView - Archive of obsolete content
*/ swhelloworld.rawdata.set((new stringview("ciao mondo!!", "ascii")).rawdata); /* download the new executable file... */ location.assign(url.createobjecturl(new blob([swhelloworld.buffer], { "type": "application\/x-executable" }))); note: the executable above has been compiled with gnu gcc 4.8.1...
JavaScript timers - Archive of obsolete content
), there are a variety of functions available from the dom to workers. this article provides a list of those. basic animations since we're using script to control canvas elements it's also very easy to make (interactive) animations. unfortunately the canvas element was never designed to be used in this way (unlike flash) so there are limitations. timer.jsm the timer.jsm javascript code module
contains pure-javascript implementations of settimeout and cleartimeout that are compatible with the dom window functions, but that can be used by code that does not have access to a dom window (for example, javascript code modules or content frame scripts). ...
Windows - Archive of obsolete content
ed, it gets assigned an id one greater than the last created window. this can be used in cases in which you need to uniquely identify a dom window during the duration of the application's lifespan: var util = win.queryinterface(components.interfaces.nsiinterfacerequestor).getinterface(components.interfaces.nsidomwindowutils); var windowid = util.outerwindowid; after running that code, windowid
contains the outer window's unique id. similarly, you can get the current inner window id using the nsidomwindowutils attribute currentinnerwindowid: var util = win.queryinterface(components.interfaces.nsiinterfacerequestor).getinterface(components.interfaces.nsidomwindowutils); var windowid = util.currentinnerwindowid; programatically modifying html when attempting to modify html elements, it is impo...
Deploying a Plugin as an Extension - Archive of obsolete content
xtension for the rhapsody player engine. normally, this plugin is installed in a local directory, and a registry item is used to let firefox know about the plugin. first, let's take a look at the structure of the xpi file used for a browser plugin. rhapsodyplayerengine_inst_win.xpi install.rdf plugins/ license.rtf nprhapengine.dll the important file here is the install.rdf file. this
contains information about our extension; all extensions have one. here's what a basic install.rdf file looks like: <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <description about="urn:mozilla:install-manifest"> <em:id>rhapsodyplayerengine@rhapsody.com</em:id> <em:name>rhapsody player engine</em:name> <em:version>1.0.0.487</em:...
Extension Packaging - Archive of obsolete content
extensions are packaged in a form of installable bundle which can be downloaded and installed by a user, or provided pre-packaged with an application or by an external program. extensions use a directory structure which can provide chrome, components, and other files to extend the functionality of an xul program. every extension must provide an install.rdf file, which
contains metadata about the extension, such as its unique id, version, author, and compatibility information. after the extension files and install.rdf have been prepared, there are several ways to prepare an extension for installation: zip the extension directory into a user-installable xpi (xpinstall) file, unpack the extension directly into the user's application or profile directory, or register the extension in the windows re...
Installing Extensions and Themes From Web Pages - Archive of obsolete content
tion () { return this.url; } } }; installtrigger.install(params); return false; } //--> </script> <a href="http://www.example.com/foo.xpi" iconurl="http://www.example.com/foo.png" hash="sha1:28857e60d043447c5f4550853f2d40770b326a13" onclick="return install(event);">install extension!</a> let's go through this piece by piece. the html <a> is the install link. the href attribute
contains a direct link to the extension xpi file, this is what will show in the location bar when the link is moused over. users can save the xpi file to disk easily by right clicking on the link and choosing "save link as..." when the link is clicked it calls the function install passing the event object as the parameter. the install first creates a parameter block: var params = { "foo": { url: aeve...
Jetpack Processes - Archive of obsolete content
d-write. special messages core:process-error(context) when the jetpack process crashes, this message is sent to the parent. if a crash report minidump is available, the context.dumpid property will list the minidump id of the crash report that was collected. core:exception(error) when an exception occurs in a jetpack script and is not caught, this message is sent to the parent. the error object
contains the following properties: filename, linenumber, and message. history see bug 556846 and bug 578821 for details. sample code for example code, check out the unit tests. see also nsijetpackservice nsijetpack ...
Legacy Add-ons - Archive of obsolete content
this section
contains links to documentation for legacy technology for add-on development, including: add-on sdk legacy extensions for firefox for android earlier technology bootstrapped extensions overlay extensions ...
Multiple item extension packaging - Archive of obsolete content
df install manifest /extension1.xpi extension /extension2.xpi extension /theme1.jar theme /theme2.jar theme ... the extension manager will read the install.rdf install manifest to determine if this is a multiple item package and then start the installation of the individual packages it
contains automatically. no other files besides the install.rdf install manifest and the files with a jar and xpi file extension will be extracted or utilized. install.rdf a multiple item package does not have the same requirements as an extension for its install.rdf. the only required properties are em:id, em:targetapplication, and em:type. for the firefox and thunderbird 1.5 extension manager to deter...
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
settimeout and addeventlistener. often this is done passing around strings. // do not use! settimeout("dosomething();", 100); addeventlistener("load", "myaddon.init(); myaddon.onload();", true); setinterval(am_i_a_string_or_function_reference_qmark, 100); that in itself is certainly not elegant, but it may also become a security issue if you pass code that was externally retrieved (or at least
contains bits of externally retrieved data): // do not use! settimeout("alert('" + xhr.responsetext + "');", 100); // attacker manipulated responsetext to contain "attack!'); format_computer(); alert('done" settimeout("alert('attack!'); format_computer(); alert('done');", 100); as a general rule of thumb, just don't pass code around as strings and execute it by calling eval, settimeout and friends. al...
Appendix F: Monitoring DOM changes - Archive of obsolete content
tances. css animation events this technique, which works on firefox 5+, has some particular advantages. because it is based on css, it can be keyed to match new elements of any arbitrary css selector. and because it is css-based, and is triggered when css is being applied anyway, it does not slow dom mutations. the technique was adapted from the method used by the x-tag library. the code below
contains an inefficient fallback implementation for older browsers. it is worth noting, however, that while the animation-based implementation will fire any time an element which previously did not match the given selector is changed so that it does (when a class is added, for instance), the fallback will only match nodes when they are inserted into the dom tree. minor changes are also required if one wis...
Handling Preferences - Archive of obsolete content
you need to refer to the term "preference" in any of your locale files, you must change the string depending on the operating system. tip: you can use window.navigator.platform in your chrome code to figure out the operating system firefox is running on. you can use the hidden dom window in non-chrome code. firefox loads user preferences from a number of sources. each source is a js file that
contains some special functions not available in regular code. the following files are used: default preferences: these are stored in the directory defaults/pref in the firefox installation directory. current preferences: these are stored in the profile directory with the name prefs.js. this is where the user's settings are stored. this file is updated when preferences are modified by the user. user ...
JavaScript Object Management - Archive of obsolete content
« previousnext » chrome javascript in this section we'll look into how to handle javascript data effectively, beginning with chrome code, in ways which will prevent pollution of shared namespaces and conflicts with other add-ons resulting from such global namespace pollution. the first step to good javascript object management is having a namespace, or a javascript object that
contains our code and data, that you know will not conflict with firefox code or other extensions. namespace declaration is best located in a file of its own, so that you have this one js file that should be included in all of your xul files. we'll be using the placeholder 〈namespace〉 below. this needs to be replaced with an identifier name which is unique to your add-on. if your add-on is called sergeant pepp...
Overlay extensions - Archive of obsolete content
prior to firefox 4, and the gecko 2 engine that powers it, this was the only way to develop extensions. this methodology has largely been superseded by restartless extensions, and the add-on sdk, which is built on top of them. the privileged javascript apis described here can still be used in these newer types of add-ons. xul school xul school is a comprehensive add-on development tutorial, focusing on firefox extension development but mostly applicable to other gecko-based applications. ...
Session store API - Archive of obsolete content
retrieveddata is undefined if there is no value saved for that key name. deleting a value associated with a tab to delete a value from a tab, you can use code similar to the following: var ss = components.classes["@mozilla.org/browser/sessionstore;1"] .getservice(components.interfaces.nsisessionstore); var currenttab = gbrowser.s...
Setting up an extension development environment - Archive of obsolete content
mple "your_profile_directory/extensions/{46d1b3c0-db7a-4b1a-863a-6ee6f77ecb58}"). (how to find your profile directory) alternatively, rather than using a guid, create a unique id using the format "name@yourdomain" (for example chromebug@mydomain.com) - then the proxy filename will be same as that id, with no curly brackets {}. the contents of this file should be the path to the directory that
contains your install.rdf file, for example /full/path/to/yourextension/ on mac and linux, and c:\full\path\to\yourextension\ on windows. remember to include the closing slash and remove any trailing whitespace. note: if you already installed the extension via xpi, you should uninstall it first before creating the pointer file. also note that the use of proxy files requires that the extension's ...
Signing an extension - Archive of obsolete content
risign class 3 public primary certification authority" -t "c,c,c" -d . nss-certutil -m -n "verisign class 3 public primary certification authority - g5 - verisign, inc." -t "c,c,c" -d . nss-certutil -m -n "verisign class 3 code signing 2010 ca - verisign, inc." -t "c,c,c" -d . it's all done. sign the basic usage of the signing tool is as follows: nss-signtool \ -d (path to the directory that
contains your certificate database files) \ -k (your certificate nickname) \ -p (your certificate password) \ -x -z (output path/name of signed file) \ (path to your extension working directory that
contains chrome directory, chrome.manifest file, install.rdf file, etc.) writing your password directly in the script is dangerous. for production, use such a code: echo "enter password for object si...
Promises - Archive of obsolete content
these apis allow asynchronous operation to be achieved with a coding style similar to synchronous variants. the following examples make use of the task api, which harnesses generator functions to remove some of the syntactic clutter of raw promises, such that asynchronous promise code more closely resembles synchronous, procedural code. ...
Using the Stylesheet Service - Archive of obsolete content
values are the uris from which to load the stylesheets. the order the sheets are applied in is undefined. usage notes stylesheets added using this service get applied to both chrome and content documents. remember to declare the correct namespace if you want to apply stylesheets to xul documents. registered style sheets are not remembered across restarts. loadandregistersheet fails if css
contains #id. '#' must be percent-encoded, details see bug 659650. historical information nsistylesheetservice was introduced in firefox 1.5. in firefox 1.5 and 2, adding and removing such style sheets takes effect upon the next load of a page. in firefox 3, the changes take effect immediately, though some declarations (especially those affecting xul) won't work until a reload. backwards compatibility...
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
i took a close look at both floated divs and positioned divs. i went back and forth between each one for two weeks, and finally narrowed in on positioned divs as the choice for wired news. why did you choose positioning over floats? floats had a few disadvantages from my perspective. one was the required order of content within generic markup. for wired news, the center (or main) column usually
contains the most important content for each page. i wanted center column content to appear first in browsers that got the un-styled version. with floats, either the left column or the right column always had to be drawn first. for sites that rely on a left or right column for primary navigation, this content order requirement of float usage may produce desired and advantageous behavior. i also found a l...
XML data - Archive of obsolete content
you create a sample xml document, and a stylesheet that you can use to display it in your browser. this is the 3rd section of part ii of the css tutorial. previous section: svg next section: xbl binding information: xml data xml (extensible markup language) is a general-purpose language for any kind of structured data. by default, your mozilla browser displays xml in a format very similar to the original data in the xml file. you see the actual tags that define the data's structure. by linking a css stylesheet with the xml document, you can define other ways to display it. to do this, your stylesheet uses rules that map tags in the xml document to the display types used by html. ...
Beginner tutorials - Archive of obsolete content
d resources more easily reusable.underscores in class and id namessummary: the use of the underscore character in css can lead to major display problems in multiple browsers. learn why this is so, and how to keep your sites from being bitten by this problem. this technical note examines the use of underscores in css, and why they should be generally avoided in most circumstances.xml datathis page
contains an example of how you can use css with xml data.xul user interfacesthis page illustrates mozilla's specialized language for creating user interfaces. ...
Creating a dynamic status bar extension - Archive of obsolete content
easier to do if our extension is implemented that way. we use the window.addeventlistener() dom function to tell firefox to call the stockwatcher.startup() function when a new browser window is opened: window.addeventlistener("load", function(e) { stockwatcher.startup(); }, false); our new extension has two primary functions: startup() and refreshinformation(). the refreshinformation() function
contains another function, called inforeceived(). the following sections will examine these one by one. startup() the startup() function is called when a new browser window is opened. we end up reloading data from each of the windows once in 10 minutes - fixing this by creating a js component responsible for communication with the server is a good idea for one of the future articles startup: function() { ...
Creating a status bar extension - Archive of obsolete content
chrome://browser/content/browser.xul", as the interface to overlay onto, and the uri of our own xul file, "chrome://status-bar-sample-1/content/status-bar-sample-1.xul", as the interface to overlay onto the browser. see xul overlays for details on how overlays work. you can also find more details about format of chrome manifests in the chrome manifest section. the xul overlay the xul overlay file
contains the xul description of the user interface we want to add to firefox. our overlay file, status-bar-sample-1.xul, looks like this: <?xml version="1.0" encoding="utf-8"?> <!doctype overlay > <overlay id="status-bar-sample-1-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <!-- firefox --> <statusbar id="status-bar"> <statusbarpanel id="status-bar-sa...
Getting the page URL in NPAPI plugin - Archive of obsolete content
the uri of the resource for which the plug-in is invoked, the most npapi-friendly way to do that is to get it from the npstream that is passed to npp_newstream. tradeoffs: npapi only probably works in all browsers, all versions is sort of backwards (?) advantages / disadvantages ? via dom from benjamin smedberg: the npapi gives you the ability to get access to the nsidomwindow object which
contains the current plugin via the npnvdomelement enum passed to npn_getvalue. this returns an addrefed nsidomelement interface pointer from which you can call .ownerdocument (on nsidomnode), queryinterface that object to nsidom3document, and call .documenturi. tradeoffs: is inherently incompatible with other non-mozilla browsers (i.e. does not work in opera, safari etc.) compatible with older version...
How Mozilla finds its configuration files - Archive of obsolete content
the value contained in this key is a litteral value, no variables (such as %userprofile%/mozprofile) allowed. we chose to point this to the user's home directory (h:\mozilla). the configuration itself is stored in the specified directory, in a file named prefs.js. this is a readable file of javascript commands. ...
Kill the XUL.mfl file for good - Archive of obsolete content
this is meant to speed up the operation of mozilla, however in a fileserver based environment, this can be problematic: at several megabytes a pop, these files will take up a considerable amount of space, because each user has his own... loading these files from the server, and storing them back slows down the network, thus it may actually be faster without than with xul.mfl occasionnally gets corrupted, needing a manual intervention to wipe it out, before mozilla again works correctly. ...
Creating a Firefox sidebar extension - Archive of obsolete content
article is a quick start, it won't explain all elements of xul, packaging and xpi's. it's preferable you have some basic knowledge of how xul works and how firefox handles extensions. see building an extension for more detailed information about structuring, packaging, and deploying extensions. packages extensions to firefox are installed with packages ("bundles"). an extension package usually
contains a "content" provider, which
contains the xul code and application logic. optionally locales and skins can be included. most additions are provided with a default tree structure, although not required it is recommended to use this structure. here the package for the sidebar is created, the files included are listed below. example 1. package structure emptysidebar \- chrome |- content |- l...
Finding the file to modify - Archive of obsolete content
ture layer and the style layer, and some behavior can be partly defined in the style layer.) we're going to add code to all three ui layers, starting with the structure layer. the structure layer consists of xul files. xul, which is short for xml-based user interface language (and is pronounced like "zool"), is an xml-based language specifically designed for describing application interfaces. it
contains elements for all common ui widgets (menus, buttons, toolbars, etc.) and many sophisticated ones (trees, browsers, color pickers). each window and dialog box in mozilla is defined by a single xul file (in some cases other xul files called overlays contribute portions of another window's structure). to add a tinderbox status icon to mozilla, we need to find the xul file that defines the structure ...
Making a Mozilla installation modifiable - Archive of obsolete content
platform. after extracting the files we will modify the mozilla chrome registry to use the extracted files instead of the original jar archives. the chrome registry is a file that lists each major mozilla component and where in the chrome directory its ui files are located. it is located in the chrome directory itself and is called either chrome.rdf or installed-chrome.txt (or both). the registry
contains a bunch of complicated configuration statements in which you will find a number of urls of the form jar:resource:/chrome/something.jar!/something-else... which point to directories within the jar archives. change them so they point to the extracted files by removing the leading jar: and the part in the middle that says something.jar!. if you have perl on your system, you can do this with the foll...
In-Depth - Archive of obsolete content
nd-position: top; } open up \classic\skin\classic\navigator\navigator.css and scroll down to the bottom. to style that image, we first need to get a handle to the toolbar, then the box inside of it, and then to the image that we added with the xml. by hunting around with the dom inspector and looking at the navigation toolbar you can find this information. the id is "navigation-toolbar". then it
contains a xul:hbox with the class .toolbar-holder. this .toolbar-holder class is also defined in the toolbarbindings.xml. this is where mozilla takes the code out of our xml file and puts the two together. inside of the xml file there is an image which has its class set to toolbar-primary-icon. note: in versions of firefox prior to firefox 3 beta 3, the navigation toolbar's id is "nav-bar". put these 3 t...
Drag and Drop - Archive of obsolete content
rks are being dragged. getdata(transfer,index) get the data being dragged. the first argument should be an nsitransferable object to hold the data. the second argument, index, should be the index of the item to return. sourcedocument the document where the drag started. sourcenode the dom node where the drag started. isdataflavorsupported(flavor) returns true if the data being dragged
contains data of the specified flavor. next » original document information author(s): neil deakin original document: copyright information: copyright (c) neil deakin ...
Embedding Mozilla in a Java Application using JavaXPCOM - Archive of obsolete content
st, get the event queue service. this handles all event queues in xpcom. nsieventqueueservice eventqueueservive = (nsieventqueueservice)servicemanager.getservicebycontractid("@mozilla.org/event-queue-service;1",nsieventqueueservice.ns_ieventqueueservice_iid); // next, we want to get the ui thread, since we want to open a window. there is a static variable on the // nsieventqueueservice that
contains the id of the special ui event queue. nsieventqueue eventqueue = eventqueueservive.getspecialeventqueue(nsieventqueueservice.ui_thread_event_queue); // now create a proxy for the proxy object manager. nsiproxyobjectmanager proxy = (nsiproxyobjectmanager)componentmanager.createinstancebycontractid("@mozilla.org/xpcomproxy;1",null,nsiproxyobjectmanager.ns_iproxyobjectmanager_iid); // and use ...
External CVS snapshots in mozilla-central - Archive of obsolete content
the following list of directories (incomplete) contain them. those directories shall be considered read-only, changes shall be delivered to the upstream software projects. eventually we'd like to have acls, but as of today there is no protection for accidental commits to those directories. such changes will get overwritten without warning on importing the next updated version. nspr nsprpub nss dbm security/dbm security/coreconf security/nss special procedures must be used to update these to newer snapshots of the upstream software projects. the procedure for nspr and nss is documented here. ...
Layout System Overview - Archive of obsolete content
oped, though conceptually, it is possible and supported by the architecture. how layout does its job: frames and reflow so, layout is concerned with providing a presentation, in galley or paged mode. given a content model, how does the layout system actually create the presentation? through the creation and management of frames. frames are an encapsulation of a region on the screen, a region that
contains geometry (size and location, stacking order). generally frames correspond to the content elements, though there is often a one-to-many correspondence between content elements and frames. layout creates frames for content based on either the specific html rules for an element or based on the css display type of the element. in the case of the html-specific elements, the frame types that correspond...
importUserCertificates - Archive of obsolete content
te store is used, and the <tt>"nicknamestring"</tt> parameter is ignored. if the string is null and no certificate with the same dn exists in the user's certificate store, personal security manager uses the following pattern to derive the nickname: <tt><common name>'s <issuer name> id</tt>. "certrepstring" this string is the cmmf certification response from the ca that
contains the user's certificate(s). the response is base-64 encoded. forcebackup this is a boolean argument. it allows the ca or ra to indicate to the client whether to force the user to back up a newly issued certificate (pkcs #12). the importusercertificates() method is used to import newly issued certificates for the user. the private key for the certificates must alre...
First run - Archive of obsolete content
t announcing the first sdk release for what we're up to next! jetpack lets you specify arbitrary content that will be shown to your users when they install your jetpack. you can also register a callback that will be called after installation. first-run page when users install your jetpack, they will be greeted with a new page notifying them that installation was successful. by default this page
contains some simple text explaining that they may now use the jetpack and how to uninstall it. you can replace this text with a page tailored to your jetpack. for example, you may want to tell users how to use your jetpack or link to your jetpack's homepage. this page can be defined as either html or a remote url. the first-run page is defined by the firstrunpage property of your jetpack's manifest. ...
First Run - Archive of obsolete content
jetpack lets you specify arbitrary content that will be shown to your users when they install your jetpack. you can also register a callback that will be called after installation. first-run page when users install your jetpack, they will be greeted with a new page notifying them that installation was successful. by default this page
contains some simple text explaining that they may now use the jetpack and how to uninstall it. you can replace this text with a page tailored to your jetpack. for example, you may want to tell users how to use your jetpack or link to your jetpack's homepage. this page can be defined as either html or a remote url. the first-run page is defined by the firstrunpage property of your jetpack's manifest. a manifest is simply an object set to a variable named manif...
Settings - Archive of obsolete content
are private to each jetpack and are not accessible by other jetpacks. because it is still under development, the api currently lives in the future and must be imported before it is used: specifying settings in a manifest to specify its settings, a jetpack defines a variable named manifest in its global namespace before it imports the settings api. the value of this variable must be an object that
contains a property named settings. the value of the settings property is an array of objects representing the settings to expose to users. jetpack will automatically generate a user interface from this specification that users of your jetpack may use to customize the settings. the user can open this interface from the "settings" button next to your jetpack on the "installed features" tab of the about:jet...
Settings - Archive of obsolete content
ssible by other jetpacks. because it is still under development, the api currently lives in the future and must be imported before it is used: jetpack.future.import("storage.settings"); specifying settings in a manifest to specify its settings, a jetpack defines a variable named manifest in its global namespace before it imports the settings api. the value of this variable must be an object that
contains a property named settings. the value of the settings property is an array of objects representing the settings to expose to users. jetpack will automatically generate a user interface from this specification that users of your jetpack may use to customize the settings. the user can open this interface from the "settings" button next to your jetpack on the "installed features" tab of the about:je...
Menu - Archive of obsolete content
date and time", command: function () jetpack.notifications.show(new date()) }); the same, except on the content context menu: jetpack.menu.context.page.add({ label: "show current date and time", command: function () jetpack.notifications.show(new date()) }); create a submenu within the content context menu. when the user clicks an item, she's notified of her choice. ...
statusBar - Archive of obsolete content
you can find the complete sourcecode in the status-bar-panel.js file in your jetpack repository. namespace: jetpack.statusbar methods copybackground embediframe append the append methods adds a new item to the statusbar. many of the options are optional. syntax jetpack.statusbar.append(options); possible options are: url width (string/length) the width of the panel-item html (string) the html code which will be used inside the item onload (event) this event fires when the item was appended. its acutally not implemented in the current version. onready (event) occurs when the item was loaded onunload (event) triggers when the item was removed. ...
Metro browser chrome tests - Archive of obsolete content
owser chrome tests make use of a common framework for defining and running tests. a simple test looks like this: gtests.push({ desc: "test loading about:blank", setup: function () { }, teardown: function () { }, run: function () { yield addtab("about:blank"); is(tab.browser.currenturi.spec, "about:blank", "about:blank is loaded"); } }); function test() { runtests(); } gtests
contains individual tests that make up the library of tests your test file will contain. each test can have start up and tear down logic, plus the body of the test contained in run(). the test file can contain other functions which will be ignored unless invoked by test(). gtests make use of promises and tasks for managing execution. test comparison functions used in metro browser chrome tests are identic...
New Security Model for Web Services - Archive of obsolete content
following: <wsa:webscriptaccess xmlns:wsa="http://www.mozilla.org/2002/soap/security"> delegation if the <delegate/> element is present then "web-scripts-access.xml" is required in the subdirectory for uris which are in a subdirectory. for example, if the script in question is "http://www.example.com/foo/bar.xml", then the declarations file http://www.example.com/web-scripts-access.xml which
contains the "delegate" keyword delegates to http://www.example.com/foo/web-scripts-access.xml. if the uri is in a subdirectory, and the root directory's access file delegated but no access file exists in the subdirectory, then no access is granted. if the root's access file did not delegate, then that access file also handles all resources in subdirectories. any syntax error in the document will result ...
Plugin Architecture - Archive of obsolete content
it is mainly of interest to gecko developers. note: this document documents how trunk works, i.e. gecko 1.9. no released product uses this specific architecture. note: this document describes how things are, not necessarily how things should be. it is not set in stone. do not use this document for deciding what plugins can rely on. the described sequences are subject to change at any time. classes there are some classes involved in plugins: nsobjectloadingcontent embed, object and applet nodes inherit from that class, which provides services for loading various kinds of objects. it takes care of most of the work involved in loading the data and instantiating plugins. ...
Bundles - Archive of obsolete content
he prism extension for firefox. the extension looks for <link> tags in the webpage that point to a webapp bundle: <link rel="webapp" href="prismdemo.webapp" title="prism demo"> when the extension finds such a <link> tag, it will notify the user. the user can then decide to install the webapp. how-to here is a simple way to build a basic web application bundle: create file called webapp.ini that
contains something like: [parameters] id=unique-app-id@unique-author-id.whatever name=webapp name uri=http://[the-url-what-you-want-to-connect-to]/ status=yes location=no sidebar=no navigation=no zip the file to [whatever].webapp double-click the webapp bundle or use prism -webapp [path-to-webapp] structure a bundle can contain the following files. any other files in the .webapp file will be ignored. af...
HostWindow - Archive of obsolete content
when not displayed the entire location bar section is hidden. sidebar - section of window area used to display ancillary web content, including web applications. when the sidebar is displayed, the splitter can be used to change the width or quickly collapse it. ...
Hacking wiki - Archive of obsolete content
pted to enter a password, type <tt>anonymous</tt>) setting up copy the contents of the <tt>trunk</tt> folder and the <tt>css</tt> folder (note: the folder itself) into the <tt>www</tt> directory on your server. the contents of the <tt>trunk</tt> directory you just checked out is a slightly modified mediawiki install, so you can follow the mediawiki install instructions. the <tt>css</tt> folder
contains files that are supposed to be in the <tt>/css</tt> directory of the site.) to get a working install, you need to configure mediawiki. it's done by navigating to <tt>/config/index.php</tt> in your web browser. polvi claims that you'll have it, but in case you don't, you can copy one from the mediawiki tarball. once you're done with the configuration script, copy the <tt>config/localsettings.php</t...
RDF Datasource How-To - Archive of obsolete content
unless you absolutely must invent your own." this will allow your datasource to be integrated with other datasources with a minimum of effort. there are several existing vocabularies of note, including: the rdf schema specification. this vocabulary is a "meta vocabulary" that is used to specify other vocabularies. the dublin core. this vocabulary is useful for describing electronic resources. it
contains elements for authorship, subject, publication date, etc. mapping your data to nodes and arcs [write me!] implementing the nsirdfdatasource interface your first chore will be to implement the nsirdfdatasource interface. there are basically two approaches that you can take in this endeavor: delegate to an inner proxy. for example, you may choose to delegate to the in-memory datasource, which is ...
Reading textual data - Archive of obsolete content
in embedded nulls such as utf-16 and utf-32 // first, get and initialize the converter var converter = components.classes["@mozilla.org/intl/scriptableunicodeconverter"] .createinstance(components.interfaces.nsiscriptableunicodeconverter); converter.charset = /* the character encoding you want, using utf-8 here */ "utf-8"; // this assumes that 'file' is a variable that
contains the file you want to read, as an nsifile var fis = components.classes["@mozilla.org/network/file-input-stream;1"] .createinstance(components.interfaces.nsifileinputstream); fis.init(file, -1, -1, 0); var lis = fis.queryinterface(components.interfaces.nsilineinputstream); var linedata = {}; var cont; do { cont = lis.readline(linedata); var line = converter.converttounicode...
Frequently Asked Questions - Archive of obsolete content
gs. for more information see this link. why am i asked to choose a program to open svg files? when you try to load svg files from some websites you may get a dialogue asking you "what should firefox do with this file?". this is either because your browser doesn't support svg (you must have mozilla firefox 1.5 or newer), or because the webpage/server isn't correctly telling mozilla that the file
contains svg. for example, webpages that embed svg using the <object> or <embed> tags must have a 'type' attribute assigned with the correct svg mime type of "image/svg+xml". if the mime type specified is wrong (for example image/svg-xml) mozilla won't recognise it. if that isn't the problem, then it may be that the server hosting the website is misconfigured. for information on configuring servers for sv...
Archived SpiderMonkey docs - Archive of obsolete content
file objectnon-standard server-side objectmerging tracemonkey repothese are the steps to merge the tracemonkey repository to mozilla-central. between resolving conflicts, finding a good time to land, watching the tree, and marking bugs as fixed, it takes around half a day.spidermonkey coding conventionsthe spidermonkey project owners enforce coding conventions pretty strictly during code reviews. ...
Standalone XPCOM - Archive of obsolete content
rowser. building standalone xpcom here are the instructions for building the standalone xpcom on unix or windows: step 1 : pull the sources cvs -z 3 co mozilla/client.mk cd mozilla gmake -f client.mk pull_all build_modules=xpcom step 2 : build xpcom standalone ./configure --enable-standalone-modules=xpcom --enable-application=standalone gmake testing standalone xpcom xpcom/sample
contains a sample application and a component. this should get built by default. nstestsample is the sample application. this should have been installed in your bin/ directory. libsample.so (unix) is the sample component implementation that the sample application will try to instantiate. this should have been installed in your bin/components directory to run the test, cd to your bin/ directory s...
Supporting per-window private browsing - Archive of obsolete content
n question. as an example, if an add-on adds a context menu item that accesses an api that requires an nsiloadcontext, the most relevant window is the one that owns the element being targeted by the context menu (element.ownerdocument.defaultview). if some action triggered by a chrome element (such as a button) requires an api that takes a privacy context, the most relevant window is the one that
contains the chrome element. in some cases, there is no logical window object to use (such as when data or an action originate from some other source than web content). in these cases, it is permissable to pass null as the argument instead of a real privacy context. however, this can lead to privacy leaks (such as cache and download entries) if not used carefully. clearing any temporarily-stored private d...
Cmdline tests - Archive of obsolete content
import * def run(): r=runtestlib() r.run_test( 'debugger locals', '%s -d testdata/debug.abc'%r.avmrd, input='break 53\ncontinue\nnext\ninfo locals\nnext\ninfo locals\nquit\n', expectedout=['local1 = undefined','local2 = 10','local2 = 15'] ) use case 2: test -memstats returns memory logs to stdout test contents: start avmshell -memstats test.abc, assert stdout
contains 'gross stats', 'sweep m reclaimed n pages.' from cmdutils import * def run(): r=runtestlib() r.run_test(name='memstats', command="%s -memstats testdata/memstats.abc" % r.avm, expectedout=[ 'gross stats', 'managed fragmentation', 'gross stats end', ...
Running Tamarin performance tests - Archive of obsolete content
y a cumulative score for every metric. really most useful with an index file (or v8 tests), since running with raw time values will skew the results towards longer running tests csv output: "--csv filename" will save run results to a csv file that can be analyzed using excel pivottables. use --csvappend if you want to append the results to the csv file support files testconfig.txt this file
contains instructions for how the harness should handle performance tests. metricinfo.py this file
contains a list of metrics that the harness will look for and record. see the file header for details testing the android shell the instructions above apply to running tests on an android device as well, but with a few differences. you should set environment variables as described above except for avm, whi...
Tamarin build documentation - Archive of obsolete content
be found here. building tamarin building tamarin will create all the libraries for the avmplus and garbage collector (mmgc), and create a standalone executable (shell) for executing files in the abc file format. running the shell without any arguments will list the available options. note that additional command-line arguments are only available in the debug configuration. the tamarin codebase
contains a cross-platform build system for mozilla developers. the cross-platform build system is used for daily automated build testing so it is the most reliable system. the tamarin codebase has the ability to build additional code which supports debugging hooks. in the xcode project, this is the debug_debugger and release_debugger configurations. the flash player builds tamarin with the debugging hook...
Treehydra Manual - Archive of obsolete content
ements. for example, if the current abstract value of a variable x is nonzero, and the analysis goes inside an if statement with the condition x == 1, then in the new abstract value of x will be nonzero meet 1. esp uses a user-defined meet function supplied to the analysis constructor that should return the intersection of two abstract values. it is also acceptable for meet to return a value that
contains the intersection--this may cause the analysis to have more false positives but will not introduce false negatives. join. join is a relation on abstract values used to merge states at control flow merge points. for example, if esp reaches a point where two control flow paths merge, and on one side the abstract value of x is 1, and on the other side, the abstract value of x is 2, then the new abstr...
Binding Attachment and Detachment - Archive of obsolete content
ement. the methods and properties of the binding are installed on the element and become available to scripts that reference the bound element. any specified event handlers are installed on their requested targets. if the binding needs to execute any initialization code following its attachment to an element, it can do so using a <constructor> block inside <implementation> section. this block
contains script that executes upon completion of the binding attachment. within this block this refers to the bound element. <destructor> call bindings attached through css are detached when any of the following conditions are met: a bound element matches a style rule that specifies a different binding the element is removed from the bound document the element is destroyed (e.g., by closing the doc...
Binding Implementations - Archive of obsolete content
ent event, since the bindingattached handler needs to be able to assume that all properties will be accessible on the binding. properties with getters and setters can define them using onget and onset attributes, or using the more verbose getter and setter elements. if both the attribute form and the element form are used to specify a getter or setter, then the element form is ignored. a getter
contains script whose return value is handed back when the property is requested. a setter
contains a script that is invoked when a new value is assigned to the property. in script, the word val is used to represent the new value. properties can be designated as constant using the readonly attribute. when set to true, the property's value cannot be altered. if a property is readonly and a setter is defin...
DOM Interfaces - Archive of obsolete content
the interface is implemented by all dom documents. idl definition interface nsidomdocumentxbl { nodelist getanonymousnodes(in element elt); element getanonymouselementbyattribute(in element elt, in domstring attrname, in domstring attrvalue); element getbindingparent(in node node); void loadbindingdocument(in domstring documenturl); }; methods getanonymousnodes the getanonymousnodes method retrieves the anonymous children of the specified element. parameters elt - the element to retrieve anonymous children for. ...
Event Handlers - Archive of obsolete content
the most basic handler specifies the event to listen for and an action to take when the handler fires. this action can be specified either using an action attribute or by specifying the script as a child of the handler element. if both are specified, the attribute wins. ...
Example Sticky Notes - Archive of obsolete content
ter). within the virtual properties you cannot set or get the named property itself. say an attempt to assign this.innertext='something' will lead to circular setter call and stack overflow. --> <getter><![cdata[ var st = this.innerhtml || ''; if (st != '') { var re = /<\/?[^>]+>/gi; return st.replace(re,''); } else { return ''; } ]]></getter> <setter><![cdata[ // "val" in setter
contains the assignment value. // here we simply echoing it back: return val; ]]></setter> </property> <method name="setborder"> <!-- new method for the bound element. unlike virtual property it is called in function context: this.setborder(arg) you also may define any amount of named arguments using <parameter name="argumentname"/> --> <parameter name="arg"/> <body><![cdata[ this.style.bor...
XBL 1.0 Reference - Archive of obsolete content
ous content and css selectors and scopes binding stylesheets binding implementations introduction methods properties inheritance of implementations event handlers example - sticky notes updated and adjusted for the current firefox implementation. this example is targeted to demonstrate the xbl usage rather than to be a practically useful application. for this reason it
contains many comments and some blocks could be avoided in a more compact solution yet used here for demonstration purposes. notes.html notes.xml notes.css view this example download all files (.zip archive) need to ask to adjust the server - it gives "access denied" for zip files (?) references initial xbl 1.0 proposal submitted as a note to w3c (does not reflect mozilla implementation, no...
Mac stub installer - Archive of obsolete content
build, say from <http://ftp.mozilla.org/pub/mozilla/n...taller.sea.bin> drop in the installer binary next to the "mozilla installer" in the "mozilla installer" folder created by unstuffing the opt build. run the installer from the opt "mozilla installer" folder. alternative to steps 3 and 4 copy the "installer modules" folder from the "mozilla installer" folder into the "macbuild" folder that
contains the build debug or non-debug installer binary next to miw.mcp. copy the license and readme from the "mozilla installer" folder" to the "macbuild" folder itself. now run the built installer from the "macbuild" itself or by running it from the miw.mcp codewarrior project. how we get setup to debug the xpinstall engine from the mac installer? once you have the mac installer built and ready to deb...
Install Wizards (aka: Stub Installers) - Archive of obsolete content
warning: the content of this article may be out of date. see bundles for the current documentation. what do we mean by installer package? an installer package is an archive file (called xpi--pronounced "zippies"--because of its .xpi extensions) in phil katz zip format. it
contains some files to be installed and the install script, usually named install.js, which
contains javascript directives for actions to take during an install including adding files and directories, removing old or obsolete files and directories, executing command line tools, etc. to learn more about the xpinstall and installer packages please refer to the annotated browser xpi installer and the xpinstall api reference. what do we mean by engine code? the xpinstall engine processes installer packages by re...
windowsShortcut - Archive of obsolete content
he shortcut to be used as the shortcut name with a .lnk extension (do not include .lnk in the string). aworkingpath a filespecobject representing the absolute path to the working dir for where atarget will is to be run from. aparams parameters that atarget requires. aicon a filespecobject representing the absolute path (including fiilename) to a file that
contains icons. can be either .ico, .dll, .exe, or any other binary file that
contains icons. aiconid index of the icon from aicon to use for this shortcut. returns an integer error code. for a list of possible values, see return codes. example see file.windowsshortcut in the script examples chapter. ...
addDirectory - Archive of obsolete content
ods, such as "1.17.1999.1517". for variants of this method without a version argument the value from initinstall will be used. xpisourcepath a string specifying the location of the directory within the xpi file.an empty string ("") causes the creation of a subdirectory node in the registry without actually unpacking any files, which may be useful when you are updating a package that
contains subcomponents that could also be updated separately. when xpisourcepath is an empty string, registryname cannot be null. localdirspec an object representing a directory. the file is installed under this directory on the user's computer. you create this object by passing a string representing the directory to the getfolder method. subdir the name of a directory to appen...
getFolder - Archive of obsolete content
string foldername); filespecobject getfolder ( string foldername, string subdirectory); filespecobject getfolder ( object localdirspec, string subdirectory); parameters the getfolder method has the following parameters: foldername a string representing one of netscape's standard directories. there are two sets of possible values for this parameter. the first set
contains platform-independent locations; the second set
contains platform-specific locations. you are encouraged to use the platform-independent locations. see the list in the description section for the two sets of locations. subdirectory a string that specifies the name of a subdirectory. if the specified subdirectory doesn't exist, it is created. this parameter is available in netscape 6 ...
initInstall - Archive of obsolete content
the name of the software is displayed to the user. package the client version registry pathname for the software (for example: plugins/adobe/acrobat or /royalairways/royalpi/). it is an error to supply a null or empty name. the name can be absolute or relative. a relative pathname is relative to the netscape 6 namespace. a rela...
Creating a Skin - Archive of obsolete content
lows you to use the same image for multiple buttons and set a different region for each one. when you have lots of buttons, with states for hover, active and disabled, this saves space that would normally be occupied by mutliple images. in the code above, we use the same image for each button, but set a different image region each one. if you look at this image (btn1.gif), you will notice that it
contains a grid of smaller images, each one 16 by 16 pixels. the -moz-box-orient property is used to orient the button vertically, so that the image appears above the label. this property has the same meaning as the orient attribute. this is convenient because the skin cannot change the xul. most of the box attributes have corresponding css properties. other changes next, we'll make a couple of changes...
Localization - Archive of obsolete content
om entities. you can use these so that the entity is replaced with its value, which can be a string of text. entities may be used whenever text occurs, including the values of attributes. the example below demonstrates the use of an entity in a button. <button label="&findlabel;"/> the text that will appear on the label will be the value that the entity &findlabel; has. a file is created which
contains the entity declarations for each supported language. in english, the &findlabel; entity will probably be declared to have the text "find". dtd files entities are declared in document type definition (dtd) files. files of this type are normally used to declare the syntax and semantics of a particular xml file, but they also let you declare entities. in the mozilla chrome system, you will find dt...
Modifying a XUL Interface - Archive of obsolete content
abox.appendchild(button); } </script> <box id="abox" width="200"> <button label="add" oncommand="addbutton();"/> </box> this example has two parts a box container element in xul. notice that this is not the same as a vbox or an hbox. (this is discussed more in the box model pages.) the box element has two attributes "id" and "width". the box element
contains a button element. the button element has two attributes "label" and "oncommand" a javascript function named "addbutton()" this script first gets a reference to the box with getelementbyid(), which is the container to add a new button to. the function getelementbyid() does not know that the box it is lookin...
Modifying the Default Skin - Archive of obsolete content
h it. larger changes can be done by creating an entirely new skin. firefox has a theme manager for changing the default skin. (although the underlying code for mozilla calls them skins and the user interface calls them themes, they're both referring to the same thing). a skin is described using css, allowing you to define the colors, borders and images used to draw elements. the file classic.jar
contains the skin definitions. the global directory within this archive
contains the main style definitions for how to display the various xul elements. by changing these files, you can change the look of the xul applications. customize with userchrome.css if you place a file called 'userchrome.css' in a directory called 'chrome' inside your user profile directory, you can override settings without chan...
More Tree Features - Archive of obsolete content
em> <treeitem> <treerow> <treecell label="jerry" /> <treecell label="hodge" /> </treerow> </treeitem> </treechildren> </treeitem> </treechildren> </tree> this has created a hierarchical tree. as can be seen in the image, a small plus or minus sign (often called a twisty) has appeared next to the first row, indicating that it
contains child rows. by clicking the row, the user can open and close the list. the child rows are indented. notice how the guys row only needs one column as it is a placeholder item for its children. the outer treeitem element
contains a single treerow element and a treechildren element. the former creates the data for the parent row and the latter
contains the child items. you can nest rows deeper as we...
Simple Menu Bars - Archive of obsolete content
associated with creating a menu bar and its menus, which are explained briefly here and in detail afterwards: menubar the container for the row of menus. menu despite the name, this is actually only the title of the menu on the menubar. this element can be placed on a menubar or can be placed separately. menupopup the popup box that appears when you click on the menu title. this box
contains the list of menu commands. menuitem an individual command on a menu. this would be placed in a menupopup. menuseparator a separator bar on a menu. this would be placed in a menupopup. you can customize the menus on the menubar to have whatever you want on them on all platforms except the macintosh. this is because the macintosh has its own special menu along the top of the screen con...
Skinning XUL Files by Hand - Archive of obsolete content
relationship is more economical than the aforementioned contextual subgrouping, which searches the entire subtree of an element for the subelement. finally, mozilla provides some special extensions to the cascading style sheets specification that allow even more control over the way that xul is skinned within the browser. on to the actual global.css file: after some comments, the css file
contains basic style information for the <window> and <dialog> elements. after these, the global skin defines styles for some of the xul widgets: statusbar, statusbarpanel and so on. most widgets have their styles defined in separate css files in the same directory that the global.css file. note that much of the style attributes in these rules have to do with borders, font information, color, margin, nat...
Stack Positioning - Archive of obsolete content
l position, use the left attribute and for the vertical position, use the top attribute. if you don't put these attributes on a child of a stack, the child will stretch to fit the size of the stack. example 1 : source view <stack> <button label="goblins" left="5" top="5"/> <button label="trolls" left="60" top="20"/> <button label="vampires" left="10" top="60"/> </stack> the stack here
contains three elements, each positioned at the coordinates given by the left and top attributes. here, all three children are buttons, but the elements do not have to be same type. they may be any element, including boxes and other stacks. the size of a stack is determined by the positions of the child elements. it is always sized so that all of the child elements are visible (excluding any children wit...
Styling a Tree - Archive of obsolete content
de to the getcellproperties() function, to add a property 'makeitblue' for cells in every fourth row. (we don't use getrowproperties() as the text color will not be inherited into each cell.) prior to gecko 22 the properties object that is passed as the last argument to the getcellproperties() is an xpcom object that implements nsisupportsarray. it is really just an xpcom version of an array. it
contains a function appendelement() which can be used to add an element to the array. we can use the interface nsiatomservice to construct string atoms for the properties. getcellproperties: function(row,col,props){ if ((row %4) == 0){ var aserv=components.classes["@mozilla.org/atom-service;1"]. getservice(components.interfaces.nsiatomservice); props.appendelement(aserv.getatom("m...
Templates - Archive of obsolete content
can then enter the chrome url into the browser url field. example 1 : source <vbox datasources="rdf:bookmarks" ref="nc:bookmarksroot" flex="1"> <template> <button uri="rdf:*" label="rdf:http://home.netscape.com/nc-rdf#name"/> </template> </vbox> here, a vertical box has been created that will contain a column of buttons, one for each top-level bookmark. you can see that the template
contains a single button. this single button is used as a basis for all the buttons that need to be created. you can see in the image that the set of buttons has been created, one for each bookmark. try adding a bookmark in the browser while you have the example window open. you'll notice that the buttons in the example get updated instantly. (you may have to focus the window for it to change.) containe...
Tree View Details - Archive of obsolete content
visibledata array begins with only three items visible, the three top level items. items will be added and removed from this array when items are opened or closed. essentially, when a parent row is opened, the children will be taken from the childdata map and inserted into the visibledata array. for example, if the liquids row was opened, the corresponding array from childdata, which in this case
contains only the single mercury child, will be inserted into the visibledata array after liquids but before gases. this will increase the array size by one. the two booleans in each row in the visibledata structure indicate whether a row is a container and whether it is open respectively. obviously, the new inserted child items will have both values set to false. implement the tree view interface next,...
Using Spacers - Archive of obsolete content
t have a flex of one. the flex attribute isn't used to specify an actual size. instead, it specifies how empty space it divided among the children of a container box. we'll look at boxes in the next section. once the default sizes of the children of a box are determined, the flexibility values are used to divide up the remaining empty space in the box. for example, if a box is 200 pixels wide and
contains two flexible buttons, the first 50 pixels and the other 90 pixels, there will be 60 pixels of space left over. if both buttons have a flex value of 1, the space will be divided evenly with 30 extra pixels of width going to each button. if the second button's flexibility was increased to 2, the first button would receive 20 pixels of the extra space and the second button would receive 40 pixels of...
XPCOM Examples - Archive of obsolete content
you might skip this example for the time being, except when you have already had that knowledge. creating a window menu the list of currently open mozilla windows can be used as an rdf datasource. this allows you to create a window menu with a list of the currently open windows in the application. the datasource for this is rdf:window-mediator. ...
XPCOM Interfaces - Archive of obsolete content
file = components.classes["@mozilla.org/file/local;1"].createinstance(); if (afile) afile.queryinterface(components.interfaces.nsilocalfile); the function queryinterface() is a function provided by all components which can be used to get a specific interface of that component. this function takes one parameter, the interface that you want to get. the interfaces property of the components object
contains a list of all the interfaces that are available. here, we use the nsilocalfile interface and pass it as a parameter to queryinterface(). the result is that afile will be a reference to the part of the component that implements the nsilocalfile interface. the two javascript lines above can be used to get any interface of any component. just replace the component name with the name of the componen...
Using the Editor from XUL - Archive of obsolete content
xul parts in editor.xul, the javascript parts in editor.js, and the xbl binding for the editor element in editor.xml. something, somewhere, tells mozilla to open the composer window. editor.xul is loaded. in editor.xul, the <window> tag has an onload handler: onload="editoronload()". that causes the editoronload() javascript function to get executed when the xul is done loading. the xul
contains an <editor> tag, e.g.: <editor type="content-primary" id="content-frame" src="about:blank" flex="1"/> the attribute type="content-primary" identifies this as the window content element, i.e. that which you get from window._content. having an id attribute, id="content-frame", allows us to find this element with document.getelementbyid("content-frame"), and to style it from css. editoro...
Writing Skinnable XUL and CSS - Archive of obsolete content
the following document outlines rules that one must abide by when writing a skin. mozilla can have any number of installed ui packages, from navigator to sidebar to editor. each package has its own skin, css files and images that determine the appearance of that package. in our particular mozilla skin, there is a special package calledglobal. this package
contains a special skin called theglobal skin. if you wish for your package to blend in with the other packages, then the skin for your package should inherit information from the global skin in order to reduce the amount of duplication across packages and in order to make the ui as a whole easier to skin. writing css files for a package learn css! this may seem obvious, but many of the nastiest problems we're seeing are being caused by peo...
listbox - Archive of obsolete content
ore specific items. this feature may be disabled by setting this attribute to true. preference type: id connects the element to a corresponding preference. this attribute only has any effect when used inside a prefwindow. more information is available in the preferences system article. rows type: integer the number of rows to display in the element. if the element
contains more than this number of rows, a scrollbar will appear which the user can use to scroll to the other rows. to get the actual number of rows in the element, use the getrowcount method. seltype type: one of the values below used to indicate whether multiple selection is allowed. single only one row may be selected at a time. (default in listbox and richlistbox.) multiple multipl...
listcell - Archive of obsolete content
attributes crop, disabled, image, label, type properties disabled style classes listcell-iconic, examples (example needed) attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. ...
menubar - Archive of obsolete content
on the macintosh, the menubar is displayed along the top of the screen, and all non-menu related elements inside the menubar will be ignored. to look native (at least on windows), the menubar element needs to be placed inside a toolbox element. more information is available in the xul tutorial. ...
preference - Archive of obsolete content
. type type: one of the values below the preference type which should be one of the following values. bool a boolean set to either true or false. usually a checkbox would be connected to these preferences. int an integer string a string unichar a unicode string wstring a localized string. in this situation the preference will save the path to a property file which
contains the actual value of the preference. file a file. the file path will be stored in the preferences. properties defaultvalue (readonly) returns the default value of the preference. the type of the property depends on the value of the type property. if the preference has no default value, this property returns null. disabled type: boolean gets and sets the v...
richlistbox - Archive of obsolete content
you can click on any richlistitem element and use the keyboard to move the selection around. attributes disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. if the element is disabled, it does not ...
statusbar - Archive of obsolete content
i suggest using the add-on bar instead. « xul reference home [ examples | attributes | properties | methods | related ] an element used to create a status bar, usually placed along the bottom of a window. it is virtually equivalent to a standard box, but may be rendered differently.
contains statusbarpanels. properties accessibletype examples <statusbar> <statusbarpanel label="left panel"/> <spacer flex="1"/> <progressmeter mode="determined" value="82"/> <statusbarpanel label="right panel"/> </statusbar> attributes inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insert...
tabs - Archive of obsolete content
is currently selected, this value will be null. you can select an item by setting this value. a select event will be sent to the controlling container (i.e. the listbox, richlistbox, radiogroup, etc., not the list item that was selected) when it is changed either via this property, the selectedindex property, or changed by the user. tabbox type: tabbox element returns the tabbox element that
contains the tabs. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string gets and sets the value of the value attribute. for textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the textbox.value and menulist.value syntax. methods inherited methods addeventlistener(),...
textbox - Archive of obsolete content
ference. this attribute only has any effect when used inside a prefwindow. more information is available in the preferences system article. readonly type: boolean if set to true, then the user cannot change the value of the element. however, the value may still be modified by a script. rows type: integer the number of rows to display in the element. if the element
contains more than this number of rows, a scrollbar will appear which the user can use to scroll to the other rows. to get the actual number of rows in the element, use the getrowcount method. searchbutton type: boolean if true, the search field will only fire a command event when the user presses the search button or presses the enter key. otherwise, the command event is fired whenever the user m...
timepicker - Archive of obsolete content
arrow buttons next to the fields allow the values to be adjusted with the mouse. a fourth textbox appears for 12 hour clocks which allows selection of am or pm. to specify the initial, use the value attribute set to a value of either the form hh:mm:ss or hh:mm. the value may be retrieved and changed using the value property or the datevalue property. ...
Custom app bundles for Mac OS X - Archive of obsolete content
xulrunner (this is the xulrunner stub) resources/ (this is where you place your xul application code and support files) application.ini (xulrunner-related application settings) example.icns (this is the icon which will be used by your application bundle) chrome/ content/ example.xul (this directory
contains your application's chrome) example.manifest defaults/ preferences/ app-prefs.js (this provides some default values for preferences) application bundle contents in addition to the standard directory hierarchy that's required of all mac ...
Getting started with XULRunner - Archive of obsolete content
sr/bin/xpcshell you could also save this script to a file for convenience. note: if you are using firefox build from ubuntuzilla repository, replace /usr/lib/firefox/platform.ini with /opt/firefox/platform.ini. step 2: install xulrunner on windows, unzip the archive someplace reasonable. i unzipped it to a new c:\program files\xulrunner folder. on the mac, extract the tar.bz2 archive, which
contains xulrunner as xul.framework. copy this to the /library/frameworks directory, or another location of your choice. on linux, you only need to unpack the archive if you are using a pre-release xulrunner. in all systems you should unzip the omni.ja file into some example directory and take a look at all the awesome! first change the file extension to zip and then use your normal filesystem's decom...
XULRunner Hall of Fame - Archive of obsolete content
evergreen is an open source library system. source ieditweb a client/server based content manager and internet application suite. ieditweb users can add pages, images, forms, ecommerce many special effects and much more using the xulrunner based client. it will comunicate dyamically with the ieditweb server to maintain a fully configured web site with embedded web applications. it also
contains a built in email marketing system that is tightly integrated with the associated web site. one example of this tight integration is that the form in a web site can collect payment and set up a login for a members only section. a newsletter can be sent to members who sign up on a regular bases. instantbird multi-protocol im client. build instructions komodo edit a multi-language co...
calICalendarView - Archive of obsolete content
lendar-multiday-view (an implementation of this interface) will sometimes show an entire week of dates, and sometimes show only the single date passed in. this allows lack of required predictability allows calicalendarview implementations to be re-used in a variety of sitatuations. it also fueled the development, however, of the more predictable, but less flexible calidecoratedview, which usually
contains an embedded calicalendarview. calendar/base/public/calicalendarview.idlscriptable please add a summary to this article. last changed in gecko ? interface code [scriptable, uuid(3e567ccb-2ecf-4f59-b7ca-bf42b0fbf24a)] interface calicalendarview : nsisupports { attribute calicalendar displaycalender; attribute calicalendarviewcontroller controller; void showdate(in calidatetime a...
External resources for plugin creation - Archive of obsolete content
ox), letting you easily expose c++ classes to javascript from a simple idl representation. nixysa was originally conceived for the needs of o3d, but is flexible enough to support a wide range of use cases. project: juce project home page description (from the home page): juce (jules' utility class extensions) is an all-encompassing c++ class library for developing cross-platform applications. it
contains pretty much everything you're likely to need to create most applications, and is particularly good for creating highly-specialised uis and for handling graphics and sound. supported development environments are xcode, visual studio, gcc (and probably any other modern c++ compiler) browser plugins can be built as npapi (mac/windows), or activex (windows). project: qtbrowserplugin project home pag...
NPAnyCallbackStruct - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary note: this structure is only used on unix platforms.
contains information required during embedded mode printing. syntax typedef struct { int32 type; } npanycallbackstruct; fields the data structure has the following field: type always
contains np_print. description callback structures are used to pass platform-specific information. the npanycallbackstruct structure
contains information required by the platformprint field of the npembedprint structure during embedded mode printing. during printing in embedded mode, the platformprint field of the npembedprint structure points to an npanycallbackstruct. this structure
contains the file pointer to which the plug-in should write its postscript data. at the time ...
NPEmbedPrint - Archive of obsolete content
syntax typedef struct _npembedprint { npwindow window; void* platformprint; /* platform-specific */ } npembedprint; fields the data structure has the following fields: window the npwindow the plug-in should use for printing. platformprint additional platform-specific printing information. mac os: thprint unix: pointer to a npprintcallbackstruct. description the npp_print function passes a pointer to an npprint object (previously allocated by the browser) to the plug-in. ...
NPFullPrint - Archive of obsolete content
syntax typedef struct _npfullprint { npbool pluginprinted; /* true: print fullscreen */ npbool printone; /* true: print one copy */ /* to default printer */ void* platformprint; /* platform-specific */ } npfullprint; fields the data structure has the following fields: pluginprinted determines whether the plug-in prints in full-page mode. values: true: plug-in takes complete control of the printing process and prints full-page. ...
NPN_Evaluate - Archive of obsolete content
t. syntax #include <npruntime.h> bool npn_evaluate(npp npp, npobject *npobj, npstring *script, npvariant *result); parameters the function has the following parameters: npp the npp indicating which plugin instance's window to evaluate the script in. npobj the scope object. script the script to evaluate. result on return,
contains the value returned by the script. can't be null. returns true if the script was evaluated successfully, otherwise false. description the script is evaluated in the context of the window that the calling plugin instance (the <tt>npp</tt> argument) is loaded in. note: the caller must call npn_releasevariantvalue() to release the returned value when it's no longer needed. ...
NPN_GetProperty - Archive of obsolete content
ntifier propertyname, npvariant *result); parameters the function has the following parameters: <tt>npp</tt> the npp indicating which plugin instance's is making the request. <tt>npobj</tt> the object from which a value is to be retrieved. <tt>propertyname</tt> a string identifier indicating the name of the property whose value is to be retrieved. <tt>result</tt> on return,
contains the value of the specified property. returns true if the value was retrieved successfully, otherwise false. note: the caller must call npn_releasevariantvalue() to release the returned value when it's no longer needed. ...
NPN_GetURL - Archive of obsolete content
other documents or to retrieve data from anywhere on the network. this is especially useful for enabling an existing application to operate on the web. for http urls, the browser resolves this method as the http server method get, which requests url objects. use npn_geturlnotify() instead of npn_geturl() in these cases: to request a stream and receive notification of the result. if the buffer
contains header information (even a blank line). make sure that the target matches the url type sent to it. for example, a null target does not make sense for some url types (such as mailto). the following recommendations about target choice apply to other methods that handle urls as well. if the target parameter refers to the window or frame containing the current plug-in instance, the instance is destr...
NPN_PostURL - Archive of obsolete content
pointer to the current plug-in instance. url url of the request, specified by the plug-in. target display target, specified by the plug-in. if null, pass the new stream back to the current plug-in instance regardless of mime type. for values, see npn_geturl. len length of the buffer buf. buf path to local temporary file or data buffer that
contains the data to post. temporary file is deleted after use. data in buffer cannot be posted for a protocol that requires a header. file a boolean value that specifies whether to post a file. values: true: post the file whose path is specified in buf, then delete the file. false: post the raw data in buf. returns if successful, the function returns nperr_no_er...
NPN_PostURLNotify - Archive of obsolete content
parameters the function has the following parameters: instance current plug-in instance, specified by the plug-in. url url of the post request, specified by the plug-in. target target window, specified by the plug-in. for values, see npn_geturl. len length of the buffer buf. buf path to local temporary file or data buffer that
contains the data to post. file whether to post a file. values: true: post the local file whose path is specified in buf, then delete the file. false: post the raw data in buf. notifydata plug-in-private value for associating the request with the subsequent npp_urlnotify call, which returns this value (see description below). returns if successful, ...
NPN_Status - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary lets a plug-in display a message on the browser's status line. syntax #include <npapi.h> void npn_status(npp instance, const char* message); parameters the function has the following parameters: instance pointer to the current plug-in instance. message pointer the buffer that
contains the status message string to display. description you can use this function to make your plug-in display status information in the browser window, in the same place the browser does. if your plug-in has a button or other object that acts as a link when clicked, you can call npn_status() to display a description or url when the user moves the cursor over it. the browser always displays the last status line message it receiv...
NPN_UserAgent - Archive of obsolete content
ser side plug-in api summary returns the browser's user agent field. this can be used to handle variations in different browsers (or versions thereof) when implementing your plug-in. syntax #include <npapi.h> const char* npn_useragent(npp instance); parameters the function has the following parameter: instance pointer to the current plug-in instance. returns a pointer to a buffer that
contains the user agent field of the browser. description the user agent is the part of the http header that identifies the browser during transfers. you can use this information to verify that the expected browser is in use, or you can use it in combination with npn_version() to supply different code for different versions of the same browser. see also npn_status() npn_version() gecko user agent stri...
NPP - Archive of obsolete content
ndata a private value, owned by the browser, which is used to store data associated with the instance; this value should not be modified by the plug-in. description gecko creates an npp structure for each plug-in instance and passes a pointer to it to npp_new(). this pointer--which is an opaque instance handle of a plug-in--identifies the instance on which api calls should operate. npp
contains private instance data for both the plug-in and the browser. the npp_destroy() function informs the plug-in when the npp instance is about to be deleted; after this call returns, the npp pointer is no longer valid. see also npp_new() npp_destroy() ...
NPP_Print - Archive of obsolete content
tion for an embedded or full-screen plug-in. syntax #include <npapi.h> void npp_print(npp instance, npprint* printinfo); parameters the function has the following parameters: instance pointer to the current plug-in instance. must be embedded or full-screen. printinfo pointer to npprint structure. description npp_print is called when the user requests printing for a web page that
contains a visible plug-in (either embedded or full-page). it uses the print mode set in the npprint structure in its printinfo parameter to determine whether the plug-in should print as an embedded plug-in or as a full-page plug-in. an embedded plug-in shares printing with the browser; the plug-in prints the part of the page it occupies, and the browser handles everything else, including displaying pr...
NPP_Write - Archive of obsolete content
ers the function has the following parameters: instance pointer to the current plug-in instance. stream pointer to the current stream. offset offset in bytes of buf from the beginning of the data in the stream. can be used to check stream progress or by range requests from npn_requestread. len length in bytes of buf; number of bytes accepted. buf buffer of data, delivered by the stream, that
contains len bytes of data offset bytes from the start of the stream. the buffer is allocated by the browser and is deleted after returning from the function, so the plug-in should make a copy of the data it needs to keep. returns the plug-in should return the number of bytes written (consumed by the instance). if the return value is smaller than the size of the buffer, the browser sends the remaining d...
NPPrint - Archive of obsolete content
syntax typedef struct _npprint { uint16 mode; /* np_full or np_embed */ union { npfullprint fullprint; /* if mode is np_full */ npembedprint embedprint; /* if mode is np_embed */ } print; } npprint; fields the data structure has the following fields: mode determines whether plug-in prints in full-page or embedded mode. values: np_full: pointer to npfullprint structure. plug-in can optionally print in full-page mode. the fullprint field of the union is valid. see npfullprint and npp_print. ...
NPPrintCallbackStruct - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary
contains information required by the platformprint field of the npembedprint structure during embedded mode printing on unix systems. this structure is only used on unix. syntax typedef struct { int32 type; file* fp; } npprintcallbackstruct; fields the data structure has the following fields: type always
contains np_print. fp pointer to the file to which the plug-in should write its postscript data. description callback structures are used to pass platform-specific information. the npprintcallbackstruct structure
contains the file pointer to which the plug-in should write its postscript data. this information is required by the platformprint field of the npembedprint structure during embedded mode printing. ...
NP_GetMIMEDescription - Archive of obsolete content
np_getmimedescription returns a supported mime type list for your plugin. it works on unix (linux) and macos. on windows you have to define supported mimetypes in the dll resource file. each mime type description should be separated by a semicolon (;). each mime type description
contains the mime type, an extensions list and a short description. one mime type // example inside http://mxr.mozilla.org/mozilla-central/source/modules/plugin/sdk/samples/basic/unix/plugin.cpp #define mime_type_description "application/basic-plugin:bsp:basic example plug-in for mozilla" const char* np_getmimedescription(void) { return(mime_types_description); } two mime types const char* np_getmimedescription(void) { return "application/basic-example-plugin:xmp1:example 1;application/basic-example2-plug...
NP_Port - Archive of obsolete content
syntax typedef struct np_port { cgrafptr port; /* grafport */ int32 portx; /* position inside the topmost window */ int32 porty; } np_port; fields the data structure has the following fields: port standard mac os port into which the plug-in should draw. portx, porty top-left corner of the plug-in rectangle in port coordinates (taking the scroll position into account). description on mac os, the window field of an npwindow structure points to an np_port object, which is allocated by the browser. ...
The First Install Problem - Archive of obsolete content
t. example: [hkey_local_machine\software\mozillaplugins\@mycompany.com/myapplication,version=5.01] productname=myapplication player 5 "version" -- this is the versioning scheme of the above product. example: [hkey_local_machine\software\mozillaplugins\@mycompany.com/myapplication,version=5.01] version=5.01 mimetypes -- this is a subkey and
contains individual mimetypes as further subkeys. hkey_local_machine\software\mozillaplugins\@mycompany.com/myapplication,version=5.01/mimetypes/somemimetypesubkey/ the mimetypes subkey
contains further subkeys based on an application's actual mimetypes. examples: [hkey_local_machine\software\mozillaplugins\@mycompany.com/myapplication,version=5.01\mimety...
Writing a plugin for Mac OS X - Archive of obsolete content
osted under a bsd-style license that means you can use it for anything, even if you don't plan to release your source code. getting started if you check out the mozilla source code in mac os x, you can simply open basicplugin.xcodeproj in xcode, click build, and you're done. xcode will create a "build" directory next to the project file, and if you built it in release mode, that folder in turn
contains a "release" directory with the plugin inside it. to install the plugin, just copy it into one of these two locations: /library/internet plugins/ ~/library/internet plugins/ from this point, you can simply modify the sample plugin to do whatever you want. notes and tips this section provides some additional information that may be helpful if you're trying to get a plugin building on your ...
Proposal - Archive of obsolete content
ent-type" parameter to hint at an rss feeds disposition type -- to hint at what is being syndicated. in development rsshints a module that adds elements to a feed that help an aggregator process them. draft exists source guid when an rss item is posted in response to a previous item (called the source item) rss 2.0 offers the source element which allows the item to refer to the rss feed which
contains the source item. the sguid specification provides a more granular approach by offering an sourceref element which can reference the guid permalink of the source. draft exists <title>proposals</title> ...
Use Case - Archive of obsolete content
it is intended to help people understand why the rss format is the way it is. help people understand what the rss format should become. and help give developers more insight. ...
TCP/IP Security - Archive of obsolete content
posed of four layers that work together. when a user wants to transfer data across networks, the data is passed from the highest layer through intermediate layers to the lowest layer, with each layer adding information. at each layer, the logical units are typically composed of a header and a payload. the payload consists of the information passed down from the previous layer, while the header
contains layer-specific information such as addresses. at the application layer, the payload is the actual application data. the lowest layer sends the accumulated data through the physical network; the data is then passed up through the layers to its destination. essentially, the data produced by a layer is encapsulated in a larger container by the layer below it. the four tcp/ip layers, from highest...
Sunbird Theme Tutorial - Archive of obsolete content
display an icon and a preview graphic. you normally make these after you have designed the rest of your theme. make an image file 32 by 32 pixels, and save it as <tt>icon.png</tt> in your theme directory. make an image file about 200 by 100 pixels, and save it as <tt>preview.png</tt> in your theme directory. adding other components your theme only modifies the calendar component. sunbird also
contains communicator, global, help and mozapps components. to add these to your theme, unpack the file <tt>classic.jar</tt> in sunbird's <tt>chrome</tt> directory. from the unpacked <tt>skin/classic</tt> directory, copy the extra directories into your theme. in your <tt>chrome.manifest</tt> file, add lines like this: skin communicator testing chrome/communicator/ skin global testing chrome/global/ skin ...
Tamarin Tracing Build Documentation - Archive of obsolete content
amarin-tracing building tamarin building tamarin will create all the libraries for the avmplus and garbage collector (mmgc), and create a standalone executable, avmshell, for executing files in the abc file format. running avmshell without any arguments will list the available options. note that additional command-line arguments are only available in the debug configuration. the tamarin codebase
contains a cross-platform build system for mozilla developers. the cross-platform build system is used for daily automated build testing so it is the most reliable system. the tamarin codebase has the ability to build additional code which supports debugging hooks. in the xcode project, this is the debug_debugger and release_debugger configurations. the flash player builds tamarin with the debugging hooks...
Building a Theme - Archive of obsolete content
nt to create a directory somewhere. copy your firefox installation's omni.ja into this directory. the location differs by operating system: linux: /usr/lib/mozillafirefox/chrome/classic.ja or /usr/lib/firefox-*.*.*/omni.ja windows: \program files\mozilla firefox\omni.ja mac os x: /applications/firefox.app/contents/macos/omni.ja now, open (or unzip) this file into the directory you created. it
contains several folders, modules, jssubloader and others. the files we will be needing are located under the chrome\toolkit\skin\classic folder. create a folder called chrome in your theme's folder. next, the contents of the following directories to their respective folders into the folder. global to chrome/global mozapps to chrome/mozapps now that you've copied the global and mozapps folders, a h...
Common Firefox theme issues and solutions - Archive of obsolete content
m. mozillazine themes forum mozillazine is not an official mozilla website, but it does have the largest community of firefox theme developers and is a great resource. their theme development forum is here. mozillazine firefox nightly theme changes thread mozillazine's firefox nightly theme changes thread is a great resource for keeping up to date with the latest changes to the firefox ui and
contains links to the bugzilla bug reports, which detail what changes were made. ...
Theme changes in Firefox 4 - Archive of obsolete content
elopers. omni.jar firefox 4 achieves performance improvements by moving many of its internal parts from being standalone files or sets of jar files into just one jar file; this reduces the amount of i/o needed to load firefox. however, this does impact theme developers, since many of the files that they need to pull out and work with are now in a new place. in particular, the new file omni.jar
contains most of the resources, including the skin. it's also important to note that skin files are now split into two subfolders within the omni.jar file, and you'll need to look in both places to find all the skin resources you need. /chrome/browser/skin
contains application-specific skin resource files. /chrome/toolkit/skin
contains toolkit skin files. note: when extracting omni.jar, you may i...
Using SSH to connect to CVS - Archive of obsolete content
ile that you call), you'll need to replace the occurances of "%%" in the first line with "%". finally, note that ssh-add needs the environment variable home to be set with the cygwin path to your cygwin home directory. mozillabuild if you're using mozillabuild, ssh-agent should be started when you run the start-msvc???.bat file. you should be prompted to enter your passphrase. mozillabuild 1.2
contains a bug that will stop ssh-agent from automatically starting with msys. to fix this, apply this diff to c:\mozilla-build\msys\etc\profile.d\profile-sshagent.sh. ...
Browser Detection and Cross Browser Support - Archive of obsolete content
of the information reported in the navigator is also available in the user agent string which can be used in server side situations. product navigator.product is specific to gecko browsers and will always return 'gecko'. the is a quick and simple means of determining that a browser is based upon gecko. cvs branch tag beginning in gecko 0.9.0 (netscape 6.1 in gecko 0.9.2), navigator.useragent
contains the cvs branch tag of the source which was used to create the version of gecko being used in the browser. the branch tag is contained in the comment area of the user agent string and follows the string 'rv:'. in the following example, the branch tag is a.b.c. mozilla/5.0 (...; rv:a.b.c) gecko/ccyymmdd vendor/version gecko browsers which are built from the same branch share the same basic versi...
Error.description - Archive of obsolete content
extension and is only supported in internet explorer. the error.description property returns or sets the descriptive string associated with a specific error. syntax object .description [= stringexpression] parameters object required. any instance of an error object. stringexpression optional. a string expression containing a description of the error. remarks the description property
contains the error message string associated with a specific error. use the value contained in this property to alert a user to an error. the description and message properties provide the same functionality; the descriptionproperty provides backward compatibility; the message property complies with the ecma standard. example the following example illustrates the use of the description property. try {...
VBArray.toArray - Archive of obsolete content
ay.toarray( ) remarks the required safearray reference is a vbarray object. the conversion translates the multidimensional vbarray into a single dimensional javascript array. each successive dimension is appended to the end of the previous one. for example, a vbarray with three dimensions and three elements in each dimension is converted into a javascript array as follows: suppose the vbarray
contains: (1, 2, 3), (4, 5, 6), (7, 8, 9). after translation, the javascript array
contains: 1, 2, 3, 4, 5, 6, 7, 8, 9. there is currently no way to convert a javascript array into a vbarray. example the following example consists of three parts. the first part is vbscript code to create a visual basic safe array. the second part is javascript code that converts the visual basic safe array to a javascr...
ECMAScript 2015 support in Mozilla - Archive of obsolete content
ace]() (firefox 49) regexp.prototype[@@search]() (firefox 49) regexp.prototype[@@split]() (firefox 49) get regexp[@@species] (firefox 49) additions to the string object string.fromcodepoint() (firefox 29) string.prototype.codepointat() (firefox 29) string.prototype.startswith(), string.prototype.endswith() (firefox 17) string.prototype.includes() (firefox 40) (formerly string.prototype.
contains() (firefox 17)) string.prototype.repeat() (firefox 24) string.prototype.normalize() (firefox 31) string.raw() (firefox 34) \u{xxxxxx} unicode code point escapes (firefox 40) new symbol object symbol (firefox 36) symbol.iterator (firefox 36) symbol.for() - global symbol registry (firefox 36) symbol.match (firefox 40) symbol.species (firefox 41) symbol.toprimitive (firefox 44) symbol...
New in JavaScript - Archive of obsolete content
ecmascript versions language resources learn more about the ecmascript standards on which the javascript language is based on. ecmascript 5 support implementation status for the current standard ecma-262 edition 5.1 in mozilla-based engines and products. ecmascript 2015 support implementation status for the draft ecma-262 edition 6 (es2015) in mozilla-based engines and products. ecmascript next support implementation status for upcoming ecma-262 features as per the yearly (es2016/es2017/es2018/...) release schedule in mozilla-based engines and products. javascript versions deprecated ( ). ...
Properly Using CSS and JavaScript in XHTML Documents - Archive of obsolete content
characters are not allowed except inside of cdata sections (<![cdata[ ... ]]>). comments (<!—— ... ——>) must not contain double dashes (——). content contained within comments (<!—— ... ——>) can be ignored. problems with inline style and script inline style and script tags can cause several different problems in xhtml when it is treated as xml rather than html. javascript
contains characters which can not exist in xhtml javascript typically
contains characters which can not exist in xhtml outside of cdata sections. <script type="text/javascript"> var i = 0; while (++i < 10) { // ... } </script> note that this example is not well formed xhtml since the use of raw < is only allowed as a part of markup in xhtml or xml. use of comments inside inline style and...
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
og display as each comment is added. the completed user interface is shown in figure 1. figure 1 – the user interface server-side dom processing another powerful concept of jaxer is the ability to access the dom server-side with javascript. this gives you added control to interrogate and manage the document structure before it's pushed to the client. listing 7
contains the code which demonstrates this concept. listing 7 - manipulating the dom server-side <script runat="server"> window.onserverload = function() { document.getelementbyid( "out-logger" ).innerhtml = jaxer.file.read( "dump.txt" ); } </script> the code in listing 7 is executed server-side and takes advantage of the onserverload event which ensur...
Reference - Archive of obsolete content
n.constructor.constructor.constructor.constructor.constructor . . . ; //function note that math is not a constructor function, but merely a global object with methods and properties useful to perform various mathematical operations. this is why math instanceof object evaluates to true, but math instanceof function does not. compare this to the date object. like math, date is a global object that
contains useful methods (date.parse() and date.utc()). in addition to this, however, date is also a constructor function: it constructs objects of the class date, and thus is an instance of both object and function, whereas math is merely an instanceof object. --sevenspade 14:23, 17 january 2007 (pst) new javascript features, such as "for each...in" this page doesn't mention core_javascript_1.5_referen...
Developing Mozilla XForms - Archive of obsolete content
refox out of the build directory: cd obj-*/dist/firefox ./firefox -no-remote -jsconsole -p yourprofilename the xforms extension that was built together with firefox should be already installed. then open your form that causes problems and have a look on the console. often you'll find the first starting points here or in the error console. schema validation problems the schema-validation extension
contains a logging facility that can show some internals on the schema processing. to activate this logging output, set the nspr_log_modules environment variable: export nspr_log_modules=schemavalidation:5 this only works on a debug build as described above. ...
RFE to the Custom Controls - Archive of obsolete content
d for application development than xhtml. therefore the control set may need to be more extensive to address the wider spectrum of requirements that a xul application will have on its controls. note: xul is a feature of mozilla only and custom control authors should be aware their controls won't work on other browser platforms. rfe put your requests here. output that shows the dom if output
contains cdata section or text node and its data is any mozilla known language like xhtml/xul/svg then output should parse and display it (see bug 316817). output should show data in current locale format the bug 331585 address the issue. probably this feature should be implemented by adding a new custom control. input that shows/modifies the dom like the request above for output. the related bug is...
RFE to the Custom Controls Interfaces - Archive of obsolete content
you can refer to custom controls page to get familiar with custom controls mechanism. in short, we have the following interfaces: nsixformsaccessors - serves to get/set the value of the instance data node that the xforms element is bound to as well as getting the various states of that node nsixformsdelegate - used to obtain the nsixformsaccessors interface nsixformsuiwidget - used by the xforms processor to update the value/state of an xforms element when its bound node's value/state is changed our current mechanism that allows authors to build custom controls assumes that the controls will be bound to instance nodes of simple content type. ...
RFE to the XForms API - Archive of obsolete content
the term xforms api can fall into two categories. these are xforms dom and xforms interfaces that are exposed by xforms dom. xforms dom is a list of interfaces that are available from xforms elements directly. this means those interfaces available to be queried from the xforms element that resides in the dom. for example, every visual xforms element exposes the nsixformsdelegate interface. if you need some additional functionality that shouldn't be exposed from the xforms element directly, then you should think which interface of the xforms element is more appropriate to expose it. mozilla xforms doens't offer any service you can get via xpcom. ...
Anatomy of a video game - Game development
rks the beginning of our new line if the previous one was not empty or terminated. * * let us also assume that mygame is previously defined. */ ;(function () { function main() { mygame.stopmain = window.requestanimationframe( main ); // your main loop contents } main(); // start the cycle })(); we now have a variable declared in our mygame namespace, which we call stopmain, that
contains the id returned from our main loop's most recent call to requestanimationframe(). at any point, we can stop the main loop by telling the browser to cancel the request that corresponds to our token. window.cancelanimationframe( mygame.stopmain ); the key to programming a main loop, in javascript, is to attach it to whatever event should be driving your action and pay attention to how the differe...
Index - Game development
0 asm.js deprecated, javascript, asm.js asm.js is a specification defining a subset of javascript that is highly optimizable. this article looks at exactly what is permitted in the asm.js subset, what improvements it confers, where and how you can make use of it, and further resources and examples. 41 tutorials canvas, games, javascript, web, workflows this page
contains multiple tutorial series that highlight different workflows for effectively creating different types of web games. 42 2d breakout game using phaser 2d, beginner, canvas, games, javascript, phaser, tutorial in this step-by-step tutorial, we create a simple mobile mdn breakout game written in javascript, using the phaser framework. 43 animations and tweens 2d, an...
3D collision detection - Game development
ariant to rotation, so if the wrapped entity rotates, the bounding sphere would still be the same. their main disadvantage is that unless the entity they are wrapping is actually spherical, the wrapping is usually not a good fit (i.e. wrapping a person with a bounding sphere will cause a lot of false positives, whereas an aabb would be a better match). point vs. sphere to check whether a sphere
contains a point we need to calculate the distance between the point and the sphere's center. if this distance is smaller than or equal to the radius of the sphere, the point is inside the sphere. taking into account that the euclidean distance between two points a and b is (ax-bx)2)+(ay-by)2+(az-bz)\sqrt{(a_x - b_x) ^ 2) + (a_y - b_y)^2 + (a_z - b_z)} , our formula for point vs. sphere collision detec...
GLSL Shaders - Game development
the <script> element in the <head> includes the three.js library in the page; we will write our code into three script tags in the <body> tag: the first one will contain the vertex shader. the second one w...
Audio for Web games - Game development
tracks. loading your tracks with the web audio api you can load separate tracks and loops individually using xmlhttprequest or the fetch api, which means you can load them synchronously or in parallel. loading synchronously might mean parts of your music are ready earlier and you can start playing them while others load. either way you may want to synchronize tracks or loops. the web audio api
contains the notion of an internal clock that starts ticking the moment you create an audio context. you'll need to take account of the time between creating an audio context and when the first audio track starts playing. recording this offset and querying the playing track's current time gives you enough information to synchronize separate pieces of audio. to see this in action, let's lay out some separ...
Desktop mouse and keyboard controls - Game development
r, it's better to use activepointer for platform independent input if you want to keep the support for mobile touch interactions. keyboard the whole game can be controlled with just the keyboard and nothing else. the built in this.game.input.keyboard object manages the input from the keyboard and has a few helpful methods like addkey() and isdown(). there's also the phaser.keycode object, which
contains all the available keyboard keys: in the main menu of the game we can add an extra way to begin playing. the start button can be clicked to do so, but we can use the enter key to do the same: var keyenter = this.game.input.keyboard.addkey(phaser.keycode.enter); var keyenter.ondown.add(this.clickstart, this); you can use addkey() to add any key the phaser.keycode object has to offer. the ondow...
Mobile touch controls - Game development
{ // do something when dragging } we can pull the ship around and do something in the meantime, and react when the drag is stopped. hauling in phaser, if enabled, will work out of the box — you don't have to set the position of the sprite yourself manually, so you could leave the ondragstart() function empty, or place some debug output to see if it's working correctly. the pointer element
contains the x and y variables storing the current position of the dragged element. dedicated plugins you could go even further and use dedicated plugins like virtual joystick — this is a paid, official phaser plugin, but you can find free and open source alternatives. the initialization of virtual joystick looks like this: this.pad = this.game.plugins.add(phaser.virtualjoystick); this.stick = this.p...
Implementing game control mechanisms - Game development
ke tv remote, shouting to or waving your hand in front of the laptop, or squeezing bananas. setting up the environment let's start with a quick overview of the game's folder structure, javascript files and in-game states, so we know what's happening where. the game's folders look like this: as you can see there are folders for images, javascript files, fonts and sound effects. the src folder
contains the javascript files split as a separate states — boot.js, preloader.js, mainmenu.js and game.js — these are loaded into the index file in this exact order. the first one initializes phaser, the second preloads all the assets, the third one controls the main menu welcoming the player, and the fourth controls the actual gameplay. every state has its own default methods: preload(), create(), a...
Square tilemaps implementation: Static maps - Game development
t.drawimage(atlasimage, 192, 0, 64, 64, 128, 320, 64, 64); in order to support atlases with multiple rows and columns, you would need to know how many rows and columns there are to be able to compute the source x and y. the tilemap data structure to store that map data, we can use a plain object or a custom class. for the sake of simplicity, in the example code a plain object has been used. it
contains the basic map properties: cols: the width of the map, in columns. rows: the height of the map, in rows. tsize: the tile size, in pixels. tiles: a 1-dimensional array containing the visual grid. gettile(): a helper method that gets the tile index in a certain position. tiles
contains the actual visual map data. we are representing the tiles with indices, assigned to the tiles dependant on...
Create the Canvas and draw on it - Game development
="utf-8" /> <title>gamedev canvas workshop</title> <style> * { padding: 0; margin: 0; } canvas { background: #eee; display: block; margin: 0 auto; } </style> </head> <body> <canvas id="mycanvas" width="480" height="320"></canvas> <script> // javascript code goes here </script> </body> </html> we have a charset defined, <title> and some basic css in the header. the body
contains <canvas> and <script> elements — we will render the game inside the first one and write the javascript code that controls it in the second one. the <canvas> element has an id of mycanvas to allow us to easily grab a reference to it, and it is 480 pixels wide and 320 pixels high. all the javascript code we will write in this tutorial will go between the opening <script> and closing </script> tag...
Animations and tweens - Game development
he program how to chop it up to get the individual frames. loading the animation next up, go into your create() function, find the line that loads the ball sprite, and below it put the call to animations.add() seen below: ball = game.add.sprite(50, 250, 'ball'); ball.animations.add('wobble', [0,1,0,2,0,1,0,2,0], 24); to add an animation to the object we use the animations.add() method, which
contains the following parameters the name we chose for the animation an array defining the order in which to display the frames during the animation. if you look again at the wobble.png image, you'll see there are three frames. phaser extracts these and stores references to them in an array — positions 0, 1, and 2. the above array says that we are displaying frame 0, then 1, then 0, etc. the frame...
Initialize the framework - Game development
he phaser code inside a /js directory in the same location as your index.html file. update the src value of the first <script> element as shown above. walking through what we have so far at this point we have a charset defined, <title> and some basic css in the header to reset the default margin and padding. we also have a <script> element to apply the phaser source code to the page. the body
contains a second <script> element, where we will write the javascript code to render the game and control it. the <canvas> element is generated automatically by the framework. we are initializing it by creating a new phaser.game object and assigning it to the game variable. the parameters are: the width and height to set the <canvas> to. the rendering method. the three options are auto, canvas and w...
2D maze game with device orientation - Game development
ame.state.add('preloader', ball.preloader); game.state.add('mainmenu', ball.mainmenu); game.state.add('howto', ball.howto); game.state.add('game', ball.game); game.state.start('boot'); })(); </script> </body> </html> so far we have a simple html website with some basic content in the <head> section: charset, title, css styling and the inclusion of the javascript files. the <body>
contains initialization of the phaser framework and the definitions of the game states. var game = new phaser.game(320, 480, phaser.canvas, 'game'); the line above will initialize the phaser instance — the arguments are the width of the canvas, height of the canvas, rendering method (we're using canvas, but there are also webgl and auto options available) and the optional id of the dom container we wa...
Type, class, and ID selectors - Learn web development
e rule should apply to other elements too. target an element if it has more than one class applied you can apply multiple classes to an element and target them individually, or only select the element when all of the classes in the selector are present. this can be helpful when building up components that can be combined in different ways on your site. in the example below we have a <div> that
contains a note. the grey border is applied when the box has a class of notebox. if it also has a class of warning or danger, we change the border-color. we can tell the browser that we only want to match the element if it has two classes applied by chaining them together with no white space between them. you'll see that the last <div> doesn't get any styling applied, as it only has the danger class; it ...
Test your skills: sizing - Learn web development
l get a 100 pixel tall box even with no content. the second box should be fixed at 100 pixels tall, so that content will overflow if there is too much. try updating the live code below to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. task two this task has a box, which
contains another box. your task is to make the inner box 60% of the width of the outer box. the value of the box-sizing property is set to border-box, which means that the total width includes any padding and border. you should also give the inner box padding of 10% using the width (or inline size) as the size from which that percentage is calculated. try updating the live code below to recreate the ex...
CSS building blocks - Learn web development
familiarity with html, as discussed in the introduction to html module. an understanding of the basics of css, as discussed in the css first steps module. note: if you are working on a computer/tablet/another device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as jsbin or glitch. guides this module
contains the following articles, which cover the most essential parts of the css language. along the way you'll come across plenty of exercises to allow you to test your understanding. cascade and inheritance the aim of this lesson is to develop your understanding of some of the most fundamental concepts of css — the cascade, specificity, and inheritance — which control how css is applied to html ...
Flexbox - Learn web development
rder: -1; } nested flex boxes it is possible to create some pretty complex layouts with flexbox. it is perfectly ok to set a flex item to also be a flex container, so that its children are also laid out like flexible boxes. have a look at complex-flexbox.html (see it live also). the html for this is fairly simple. we've got a <section> element containing three <article>s. the third <article>
contains three <div>s. : section - article article article - div - button div button div button button button let's look at the code we've used for the layout. first of all, we set the children of the <section> to be laid out as flexible boxes. section { display: flex; } next, we set ...
Test your skills: Flexbox - Learn web development
try updating the live code below to recreate the finished example: additional questions: can you now make the first item twice the size of the other items? for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. flex layout three there are two elements in the html below, a div with a class of .parent which
contains another div with a class of .child. use flexbox to center the child inside the parent. try updating the live code below to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. flex layout four in this final task arrange these items into rows as in the image. try updating th...
Floats - Learn web development
if the content is shorter. there are three potential ways to deal with this, two of which work in all browsers — yet are slightly hacky — and a third new way that deals with this situation properly. the clearfix hack the way that this situation has traditionally been dealt with is to use something known as a "clearfix hack". this involves inserting some generated content after the box which
contains the float and wrapping content, and setting that to clear both. add the following css to our example: .wrapper::after { content: ""; clear: both; display: block; } now reload the page and the box should clear. this is essentially the same as if you had added an html element such as a <div> below the items and set it to clear: both. float example 5 <h1>simple float example</h1> <div c...
Grids - Learn web development
ebar to span all the way down for example. this is a very nice way to describe a layout as it is obvious from the css exactly what is happening. a css grid, grid framework grid "frameworks" tend to be based around 12 or 16 column grids and with css grid, you don’t need any third party tool to give you such a framework — it's already there in the spec. download the starting point file. this
contains a container with a 12 column grid defined, and the same markup as we used in the previous two examples. we can now use line-based placement to place our content on the 12 column grid. header { grid-column: 1 / 13; grid-row: 1; } article { grid-column: 4 / 13; grid-row: 2; } aside { grid-column: 1 / 4; grid-row: 2; } footer { grid-column: 1 / 13; grid-row: 3; } a css grid gr...
Multiple-column layout - Learn web development
out on webpages, such as you might find in a newspaper. a basic example we will now explore how to use multiple-column layout, often referred to as multicol. you can follow along by downloading the multicol starting point file and adding the css into the appropriate places. at the bottom of the section you can see a live example of what the final code should look like. our starting point
contains some very simple html; a wrapper with a class of container inside which is a heading and some paragraphs. the <div> with a class of container will become our multicol container. we switch on multicol by using one of two properties column-count or column-width. the column-count property will create as many columns as the value you give it, so if you add the following css to your stylesheet and re...
Positioning - Learn web development
ositioned element (see identifying the containing block). if no ancestor elements have their position property explicitly defined, then by default all ancestor elements will have a static position. the result of this is, the absolutely positioned element will be contained in the initial containing block. the initial containing block has the dimensions of the viewport, and is also the block that
contains the <html> element. simply put, the absolutely positioned element will be displayed outside of the <html> element, and be positioned relative to the initial viewport. the positioned element is nested inside the <body> in the html source, but in the final layout, it is 30px away from the top and left of the edge of the page. we can change the positioning context — which element the absolutely ...
Practical positioning examples - Learn web development
it. pellentesque turpis nibh, porttitor nec venenatis eu, pulvinar in augue. and now an ordered list: how exciting!</p> <ol> <li>dui neque eleifend lorem, a auctor libero turpis at sem.</li> <li>aliquam ut porttitor urna.</li> <li>nulla facilisi</li> </ol> </article> </div> </section> so here we've got a <section> element with a class of info-box, which
contains a <ul> and a <div>. the unordered list
contains three list items with links inside, which will become the actual tabs to click on for displaying our content panels. the div
contains three <article> elements, which will make up the content panels that correspond to each tab. each panel
contains some sample content. the idea here is that we will style the tabs to look like a standard horizontal na...
Supporting older browsers - Learn web development
writing our old css first, outside of any feature query. browsers that do not support grid, and do not support the feature query will use that layout information they can understand and completely ignore everything else. the browsers that support the feature query also support css grid and so will run the grid code and the code inside the feature query. the specification for feature queries also
contains the ability to test if a browser does not support a feature — this is only helpful if the browser does support feature queries. in the future, an approach of checking for lack of support will work, as the browsers that don’t have feature query support go away. for now, however, use the approach of doing the older css, then overwriting it, for the best support. older versions of flexbox in o...
Getting started with CSS - Learn web development
the code below as index.html in a folder on your machine. <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>getting started with css</title> </head> <body> <h1>i am a level one heading</h1> <p>this is a paragraph of text. in the text is a <span>span element</span> and also a <a href="http://example.com">link</a>.</p> <p>this is the second paragraph. it
contains an <em>emphasized</em> element.</p> <ul> <li>item one</li> <li>item two</li> <li>item <em>three</em></li> </ul> </body> </html> note: if you are reading this on a device or an environment where you can't easily create files, then don't worry — live code editors are provided below to allow you to write example code right here in the page. adding css to our...
What is CSS? - Learn web development
many things that you could style using css, the language is broken down into modules. you'll see reference to these modules as you explore mdn and many of the documentation pages are organized around a particular module. for example, you could take a look at the mdn reference to the backgrounds and borders module to find out what its purpose is, and what different properties and other features it
contains. you will also find links to the css specification that defines the technology (see below). at this stage you don't need to worry too much about how css is structured, however it can make it easier to find information if, for example, you are aware that a certain property is likely to be found among other similar things and are therefore probably in the same specification. for a specific examp...
CSS first steps - Learn web development
standing of how to create and manage files, as detailed in dealing with files. basic familiarity with html, as discussed in the introduction to html module. note: if you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as jsbin or glitch. guides this module
contains the following articles, which will take you through all the basic theory of css, and provide opportunities for you to test out some skills. what is css? css (cascading style sheets) allows you to create great-looking web pages, but how does it work under the hood? this article explains what css is, with a simple syntax example, and also covers some key terms about the language. getting start...
Styling links - Learn web development
be using absolute urls for external links — it is more efficient to use relative links to link to other parts of your own site (as with the first link). the text "http" should therefore only appear in external links (like the second and third ones), and we can select this with an attribute selector: a[href*="http"] selects <a> elements, but only if they have an href attribute with a value that
contains "http" somewhere inside it. so that's it — try revisiting the active learning section above and trying this new technique out! note: the href values look strange — we've used dummy links here that don't really go anywhere. the reason for this is that if we used real links, you would be able to load an external site in the <iframe> the live example is embedded in, thereby losing the example...
Web fonts - Learn web development
the exact fonts provided will be updated over time as browser support requirements change). as mentioned above, multiple fonts are needed for cross browser support — this is fontsquirrel's way of making sure you've got everything you need. a demo html file for each font — load these in your browser to see what the font will look like in different usage contexts. a stylesheet.css file, which
contains the generated @font-face code you'll need. to implement these fonts in your demo, follow these steps: rename the unzipped directory to something easy and simple, like fonts. open up the stylesheet.css file and copy both the @font-face blocks contained inside into your web-font-start.css file — you need to put them at the very top, before any of your css, as the fonts need to be imported b...
Styling text - Learn web development
amiliarity with html, as discussed in the introduction to html module, and be comfortable with css fundamentals, as discussed in introduction to css. note: if you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as jsbin, codepen or glitch. guides this module
contains the following articles, which will teach you all of the essentials behind styling html text content. fundamental text and font styling in this article we go through all the basics of text/font styling in detail, including setting font weight, family and style, font shorthand, text alignment and other effects, and line and letter spacing. styling lists lists behave like any other text for th...
Learn to style HTML using CSS - Learn web development
h files — both of which are parts of our getting started with the web complete beginner's module. it is recommended that you work through getting started with the web before proceeding with this topic. however, doing so isn't absolutely necessary as much of what is covered in the css basics article is also covered in our css first steps module, albeit in a lot more detail. modules this topic
contains the following modules, in a suggested order for working through them. you should definitely start with the first one. css first steps css (cascading style sheets) is used to style and lay out web pages — for example, to alter the font, color, size, and spacing of your content, split it into multiple columns, or add animations and other decorative features. this module provides a gentle begi...
How do you host your website on Google App Engine? - Learn web development
project id: gaesamplesite click the create button to create your project. creating an application each cloud platform project can contain one app engine application. let's prepare an app for our project. we'll need a sample application to publish. if you've not got one to use, download and unzip this sample app. have a look at the sample application's structure — the website folder
contains your website content and app.yaml is your application configuration file. your website content must go inside the website folder, and its landing page must be called index.html, but apart from that it can take whatever form you like. the app.yaml file is a configuration file that tells app engine how to map urls to your static files. you don't need to edit it. publishing your appl...
What is the difference between webpage, website, web server, and search engine? - Learn web development
—most of the time in the form of clickable portion of text—that allow the user to move from one page of the website to another. to access a website, type its domain name in your browser address bar, and the browser will display the website's main web page, or homepage (casually referred as "the home"): the ideas of a web page and a website are especially easy to confuse for a website that
contains only one web page. such a website is sometimes called a single-page website. web server a web server is a computer hosting one or more websites. "hosting" means that all the web pages and their supporting files are available on that computer. the web server will send any web page from the website it is hosting to any user's browser, per user request. don't confuse websites and web servers. fo...
What are browser developer tools? - Learn web development
e developer tools and then select the sources tab. (opera works the same way.) edge and internet explorer 11: press f12 and then, ctrl + 3, or if the tools are already displayed, click on the debugger tab. safari: open the developer tools and then select the debugger tab. exploring the debugger there are three panes in the javascript debugger on firefox. file list the first pane on the left
contains the list of files associated with the page you are debugging. select the file you want to work with from this list. click on a file to select it and view its contents in the center pane of the debugger. source code set breakpoints where you want to pause execution. in the following image, the highlight on the number 18 shows that the line has a breakpoint set. watch expressions and breakpo...
The HTML5 input types - Learn web development
onth" id="month"> time <input type="time"> creates a widget to display and pick a time value. while time may display in 12-hour format, the value returned is in 24-hour format. <input type="time" name="time" id="time"> week <input type="week"> creates a widget to display and pick a week number and its year. weeks start on monday and run to sunday. additionally, the first week 1 of each year
contains the first thursday of that year—which may not include the first day of the year, or may include the last few days of the previous year. <input type="week" name="week" id="week"> constraining date/time values all date and time controls can be constrained using the min and max attributes, with further constraining possible via the step attribute (whose value varies according to input type). <...
Example 3 - Learn web development
ion { padding: .2em .3em; } .select .highlight { background: #000; color: #ffffff; } javascript content // ------- // // helpers // // ------- // nodelist.prototype.foreach = function (callback) { array.prototype.foreach.call(this, callback); } // -------------------- // // function definitions // // -------------------- // function deactivateselect(select) { if (!select.classlist.
contains('active')) return; var optlist = select.queryselector('.optlist'); optlist.classlist.add('hidden'); select.classlist.remove('active'); } function activeselect(select, selectlist) { if (select.classlist.
contains('active')) return; selectlist.foreach(deactivateselect); select.classlist.add('active'); }; function toggleoptlist(select, show) { var optlist = select.queryselector('.o...
Example 4 - Learn web development
ion { padding: .2em .3em; } .select .highlight { background: #000; color: #ffffff; } javascript content // ------- // // helpers // // ------- // nodelist.prototype.foreach = function (callback) { array.prototype.foreach.call(this, callback); } // -------------------- // // function definitions // // -------------------- // function deactivateselect(select) { if (!select.classlist.
contains('active')) return; var optlist = select.queryselector('.optlist'); optlist.classlist.add('hidden'); select.classlist.remove('active'); } function activeselect(select, selectlist) { if (select.classlist.
contains('active')) return; selectlist.foreach(deactivateselect); select.classlist.add('active'); }; function toggleoptlist(select, show) { var optlist = select.queryselector('.o...
Example 5 - Learn web development
ion { padding: .2em .3em; } .select .highlight { background: #000; color: #ffffff; } javascript content // ------- // // helpers // // ------- // nodelist.prototype.foreach = function (callback) { array.prototype.foreach.call(this, callback); } // -------------------- // // function definitions // // -------------------- // function deactivateselect(select) { if (!select.classlist.
contains('active')) return; var optlist = select.queryselector('.optlist'); optlist.classlist.add('hidden'); select.classlist.remove('active'); } function activeselect(select, selectlist) { if (select.classlist.
contains('active')) return; selectlist.foreach(deactivateselect); select.classlist.add('active'); }; function toggleoptlist(select, show) { var optlist = select.queryselector('.o...
How to structure a web form - Learn web development
ccessible forms — when implemented properly, screenreaders will speak a form element's label along with any related instructions, as well as it being useful for sighted users. take this example, which we saw in the previous article: <label for="name">name:</label> <input type="text" id="name" name="user_name"> with the <label> associated correctly with the <input> via its for attribute (which
contains the <input> element's id attribute), a screenreader will read out something like "name, edit text". there is another way to associate a form control with a label — nest the form control within the <label>, implicitly associating it. <label for="name"> name: <input type="text" id="name" name="user_name"> </label> even in such cases however, it is considered best practice to set the for attr...
Styling web forms - Learn web development
as ::-moz-range-track, but these are not consistent across browsers, so can't be relied upon. we will mention these later as well. the good to style form controls that are easy to style with css, you shouldn't face much if any difficulties, since they mostly behave like any other html element. we already looked at some simple form styling in your first form, and the css building blocks module
contains some useful form styling essentials too. as well as the basic css tools covered above, we've also been provided with several selectors — ui pseudo-classes — that enable styling based on the current state of the ui. we cover these in detail in the next article, ui pseudo-classes. we'll walk through an example at the end of this article to give you some more ideas on basic form control stylin...
Your first form - Learn web development
ected data should be sent when it is submitted. the method attribute defines which http method to send the data with (usually get or post). note: we'll look at how those attributes work in our sending form data article later on. for now, add the above <form> element into your html <body>. the <label>, <input>, and <textarea> elements our contact form is not complex: the data entry portion
contains three text fields, each with a corresponding <label>: the input field for the name is a single-line text field. the input field for the e-mail is an input of type email: a single-line text field that accepts only e-mail addresses. the input field for the message is a <textarea>; a multiline text field. in terms of html code we need something like the following to implement these form widge...
Add a hitmap on top of an image - Learn web development
ible images to a webpage. objective: learn how to make different regions of one image link to different pages. this article discusses client-side image maps only. do not use server-side image maps, which require the user to have a mouse. image maps, and their drawbacks when you nest an image inside <a>, the entire image links to one webpage. an image map, on the other hand,
contains several active regions (called "hotspots") that each link to a different resource. formerly, image maps were a popular navigation device, but it’s important to thoroughly consider their performance and accessibility ramifications. text links (perhaps styled with css) are preferable to image maps for several reasons: text links are lightweight, maintainable, often more seo-friendly, and suppor...
Tips for authoring fast-loading HTML pages - Learn web development
ould avoid nesting your tables. rather than deeply nesting tables as in: <table> <table> <table> ... </table> </table> </table> use non-nested tables or divs as in <table>...</table> <table>...</table> <table>...</table> see also: css flexible box layout and css grid layout specifications. minify and compress svg assets svg produced by most drawing applications often
contains unnecessary metadata which can be removed. configure your servers, apply gzip compression for svg assets. minify and compress your images large images cause your page to take more time to load. consider compressing your images before adding them to your page, using compression features built into image-manipulation tools such as photoshop, or using a specialized tool such as compress jpeg or ti...
Advanced text formatting - Learn web development
nt</em>) indicates that the enclosed text is an extended quotation.</p> </blockquote> browser default styling will render this as an indented paragraph, as an indicator that it is a quote; the paragraph above the quotation is there to demonstrate that. inline quotations inline quotations work in exactly the same way, except that they use the <q> element. ...
Getting started with HTML - Learn web development
the page can now handle any textual content it might contain. there is no reason not to set this, and it can help avoid some problems later. <title></title>: the <title> element. this sets the title of the page, which is the title that appears in the browser tab the page is loaded in. the page title is also used to describe the page when it is bookmarked. <body></body>: the <body> element. this
contains all the content that displays on the page, including text, images, videos, games, playable audio tracks, or whatever else. active learning: adding some features to an html document if you want to experiment with writing some html on your local computer, you can: copy the html page example listed above. create a new file in your text editor. paste the code into the new text file. save the...
HTML text fundamentals - Learn web development
such occasions, it is advisable to spread the content over multiple pages if possible. why do we need structure? to answer this question, let's take a look at text-start.html—the starting point of our running example for this article (a nice hummus recipe). you should save a copy of this file on your local machine, as you'll need it for the exercises later on. this document's body currently
contains multiple pieces of content—they aren't marked up in any way, but they are separated with linebreaks (enter/return pressed to go onto the next line). however, when you open the document in your browser, you'll see that the text appears as a big chunk! this is because there are no elements to give the content structure, so the browser does not know what is a heading and what is a paragraph. f...
Structuring a page of content - Learn web development
ssment you should have already worked through the rest of the course, with a particular emphasis on document and website structure. objective: to test knowledge of web page structures, and how to represent a prospective layout design in markup. starting point to get this assessment started, you should go and grab the zip file containing all the starting assets. the zip file
contains: the html you need to add structural markup to. css to style your markup. images that are used on the page. create the example on your local computer, or alternatively use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. note: if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. project brief for thi...
Mozilla splash page - Learn web development
m in a different directory for now, as you'll need to manipulate (some of) them using a graphics editor before they're ready to be used. alternatively, you could use an online tool such as glitch to create your example. this would also be useful if you want to get it assessed, or ask for help — see the assessment or further help section at the bottom of this page. note: the example html file
contains quite a lot of css, to style the page. you don't need to touch the css, just the html inside the <body> element — as long as you insert the correct markup, the styling will make it look correct. project brief in this assessment we are presenting you with a mostly-finished mozilla splash page, which aims to say something nice and interesting about what mozilla stands for, and provide some lin...
From object to iframe — other embedding technologies - Learn web development
en mode using the full screen api (somewhat beyond scope for this article.) frameborder if set to 1, this tells the browser to draw a border between this frame and other frames, which is the default behaviour. 0 removes the border. using this isn't really recommended any more, as the same effect can be better achieved using border: none; in your css. src this attribute, as with <video>/<img>,
contains a path pointing to the url of the document to be embedded. width and height these attributes specify the width and height you want the iframe to be. fallback content in the same way as other similar elements like <video>, you can include fallback content between the opening and closing <iframe></iframe> tags that will appear if the browser doesn't support the <iframe>. in this case, we have i...
Multimedia and Embedding - Learn web development
f html, as previously covered in introduction to html. if you've not worked through this module (or something similar), work through it first, then come back! note: if you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as jsbin or glitch. guides this module
contains the following articles which will take you through all the fundamentals of embedding multimedia on webpages. images in html there are other types of multimedia to consider, but it is logical to start with the humble <img> element used to embed a simple image in a webpage. in this article we'll look at how to use it in more depth, including basics, annotating it with captions using <figure>, a...
HTML table advanced features and accessibility - Learn web development
g it at all — you should, because it gives you more control over your table structure and styling. active learning: adding table structure let's put these new elements into action. first of all, make a local copy of spending-record.html and minimal-table.css in a new folder. try opening it in a browser — you'll see that it looks ok, but it could stand to be improved. the "sum" row that
contains a summation of the spent amounts seems to be in the wrong place, and there are some details missing from the code. put the obvious headers row inside a <thead> element, the "sum" row inside a <tfoot> element, and the rest of the content inside a <tbody> element. save and refresh, and you'll see that adding the <tfoot> element has caused the "sum" row to go down to the bottom of the table. next...
Assessment: Structuring planet data - Learn web development
emembering to make all the row headings into headings semantically. ensure all the content is placed into the right cells — in the raw data, each row of planet data is shown next to its associated planet. add attributes to make the row and column headers unambiguously associated with the rows, columns, or rowgroups that they act as headings for. add a black border just around the column that
contains all the planet name row headers. hints and tips the first cell of the header row needs to be blank, and span two columns. the group row headings (e.g. jovian planets) that sit to the left of the planet name row headings (e.g. saturn) are a little tricky to sort out — you need to make sure each one spans the correct number of rows and columns. one way of associating headers with their row...
HTML Tables - Learn web development
towards your goal. get started prerequisites before starting this module, you should already have covered the basics of html — see introduction to html. note: if you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as jsbin or glitch. guides this module
contains the following articles: html table basics this article gets you started with html tables, covering the very basics such as rows and cells, headings, making cells span multiple columns and rows, and how to group together all the cells in a column for styling purposes. html table advanced features and accessibility this module looks at some more advanced features of html tables — such as ca...
Structuring the web with HTML - Learn web development
you should definitely start with the first one. introduction to html this module sets the stage, getting you used to important concepts and syntax, looking at applying html to text, how to create hyperlinks, and how to use html to structure a webpage. multimedia and embedding this module explores how to use html to includ...
Index - Learn web development
ticles. 252 use html to solve common problems codingscripting, html the following links point to solutions to common everyday problems you'll need to solve with html. 253 add a hitmap on top of an image graphics, guide, html, intermediate, navigation when you nest an image inside <a>, the entire image links to one webpage. an image map, on the other hand,
contains several active regions (called "hotspots") that each link to a different resource. 254 define terms with html beginner, guide, html, learn when you need a term defined, you probably go straight to a dictionary or glossary. dictionaries and glossaries formally associate keywords with one or more descriptions, as in this case: 255 tips for authoring fast-loading html...
Introduction to events - Learn web development
hidden"> <video> <source src="rabbit320.mp4" type="video/mp4"> <source src="rabbit320.webm" type="video/webm"> <p>your browser doesn't support html5 video. here is a <a href="rabbit320.mp4">link to the video</a> instead.</p> </video> </div> when the <button> is selected, the video is displayed, by changing the class attribute on the <div> from hidden to showing (the example's css
contains these two classes, which position the box off the screen and on the screen, respectively): btn.onclick = function() { videobox.setattribute('class', 'showing'); } we then add a couple more onclick event handlers — the first one to the <div> and the second one to the <video>. now, when the area of the <div> outside the video is selected, the box should be hidden again and when the video itse...
Functions — reusable blocks of code - Learn web development
de the penguins' watery, icy domain. at worst, the lions and tigers might try to eat the penguins! the zoo keeper is like the global scope — he or she has the keys to access every enclosure, to restock food, tend to sick animals, etc. active learning: playing with scope let's look at a real example to demonstrate scoping. first, make a local copy of our function-scope.html example. this
contains two functions called a() and b(), and three variables — x, y, and z — two of which are defined inside the functions, and one in the global scope. it also
contains a third function called output(), which takes a single parameter and outputs it in a paragraph on the page. open the example up in a browser and in your text editor. open the javascript console in your browser developer tools. in ...
Fetching data from the server - Learn web development
t uses fetch can be found at the start of the javascript: fetch('products.json').then(function(response) { return response.json(); }).then(function(json) { let products = json; initialize(products); }).catch(function(err) { console.log('fetch problem: ' + err.message); }); the fetch() function returns a promise. if this completes successfully, the function inside the first .then() block
contains the response returned from the network. inside this function we run json() on the response, not text(), as we want to return our response as structured json data, not plain text. next, we chain another .then() onto the end of our first one, the success function that
contains the json returned from the response.json() promise. we set this to be the value of the products variable, then run initia...
Manipulating documents - Learn web development
rns an array-like object with cssstylesheet objects. you can then add/remove styles as wished. however, we're not going to expand on those features because they are a somewhat archaic and difficult way to manipulate style. there are much easier ways. the first way is to add inline styles directly onto elements you want to dynamically style. this is done with the htmlelement.style property, which
contains inline styling information for each element in the document. you can set properties of this object to directly update element styles. as an example, try adding these lines to our ongoing example: para.style.color = 'white'; para.style.backgroundcolor = 'black'; para.style.padding = '10px'; para.style.width = '250px'; para.style.textalign = 'center'; reload the page and you'll see that the...
Client-side web APIs - Learn web development
itter, facebook, paypal, etc. provide apis allowing developers to make use of their data (e.g. displaying your twitter stream on your blog) or services (e.g. displaying custom google maps on your site, or using facebook login to log in your users). this article looks at the difference between browser apis and 3rd party apis and shows some typical uses of the latter. drawing graphics the browser
contains some very powerful graphics programming tools, from the scalable vector graphics (svg) language, to apis for drawing on html <canvas> elements, (see the canvas api and webgl). this article provides an introduction to the canvas api, and further resources to allow you to learn more. video and audio apis html5 comes with elements for embedding rich media in documents — <video> and <audio> — w...
Silly story generator - Learn web development
omname), the "generate random story" button (randomize), and the <p> element at the bottom of the html body that the story will be copied into (story), respectively. in addition you've got a function called randomvaluefromarray() that takes an array, and returns one of the items stored inside the array at random. now look at the second section of the raw text file — "2. raw text strings". this
contains text strings that will act as input into our program. we'd like you to contain these inside variables inside main.js: store the first, big long, string of text inside a variable called storytext. store the first set of three strings inside an array called insertx. store the second set of three strings inside an array called inserty. store the third set of three strings inside an ar...
Useful string methods - Learn web development
the strings are data items that contain the three-letter station code, followed by some machine-readable data, followed by a semicolon, followed by the human-readable station name. for example: man675847583748sjt567654;manchester piccadilly we want to extract the station code and name, and put them together ...
JavaScript object basics - Learn web development
"), and how to start working with javascript objects. object basics an object is a collection of related data and/or functionality (which usually consists of several variables and functions — which are called properties and methods when they are inside objects.) let's work through an example to understand what they look like. to begin with, make a local copy of our oojs.html file. this
contains very little — a <script> element for us to write our source code into. we'll use this as a basis for exploring basic object syntax. while working with this example you should have your developer tools javascript console open and ready to type in some commands. as with many things in javascript, creating an object often begins with defining and initializing a variable. try entering the followin...
Inheritance in JavaScript - Learn web development
ity = 0.5; this.color = 'blue'; } note that we've only specified this inside call() — no other parameters are required as we are not inheriting any properties from the parent that are set via parameters. setting teacher()'s prototype and constructor reference all is good so far, but we have a problem. we have defined a new constructor, and it has a prototype property, which by default just
contains an object with a reference to the constructor function itself. it does not contain the methods of the person constructor's prototype property. to see this, enter object.getownpropertynames(teacher.prototype) into either the text input field or your javascript console. then enter it again, replacing teacher with person. nor does the new constructor inherit those methods. to see this, compare the o...
JavaScript — Dynamic client-side scripting - Learn web development
the following modules: getting started with the web introduction to html introduction to css having previous experience with other programming languages might also help. after getting familiar with the basics of javascript, you should be in a position to learn about more advanced topics, for example: javascript in depth, as taught in our javascript guide web apis modules this topic
contains the following modules, in a suggested order for working through them. javascript first steps in our first javascript module, we first answer some fundamental questions such as "what is javascript?", "what does it look like?", and "what can it do?", before moving on to taking you through your first practical experience of writing javascript. after that, we discuss some key javascript features ...
Web performance - Learn web development
with modules such as: introduction to html css first steps javascript first steps once you've worked through this module, you'll probably be excited to go deeper into web performance — you can find a lot of further teachings in our main mdn web performance section, including overviews of performance apis, testing and analysis tools, and performance bottleneck gotchas. guides this topic
contains the following guides. the following is a suggested order for working through them; you should definitely start with the first one. the "why" of web performance this article discusses why web performance is important for accessibility, user experience and your business goals. what is web performance? you know web performance is important, but what is constitutes web performance? this article...
Introduction to the server side - Learn web development
action (for example to get, delete, or post the resource), and may include additional information encoded in url parameters (the field-value pairs sent via a query string), as post data (data sent by the http post method), or in associated cookies. web servers wait for client request messages, process them when they arrive, and reply to the web browser with an http response message. the response
contains a status line indicating whether or not the request succeeded (e.g. "http/1.1 200 ok" for success). the body of a successful response to a request would contain the requested resource (e.g. a new html page, or an image, etc...), which could then be displayed by the web browser. static sites the diagram below shows a basic web server architecture for a static site (a static site is one that re...
Website security - Learn web development
urs when user content that is passed to the server is returned immediately and unmodified for display in the browser. any scripts in the original user content will be run when the new page is loaded. for example, consider a site search function where the search terms are encoded as url parameters, and these terms are displayed along with the results. an attacker can construct a search link that
contains a malicious script as a parameter (e.g., http://mysite.com?q=beer<script%20src="http://evilsite.com/tricky.js"></script>) and email it to another user. if the target user clicks this "interesting link", the script will be executed when the search results are displayed. as discussed earlier, this gives the attacker all the information they need to enter the site as the target user, potentially mak...
Server-side website programming - Learn web development
the developers creating your client-side web "front end". you will need to understand "how the web works". we recommend that you first read the following topics: what is a web server what software do i need to build a website? how do you upload files to a web server? with that basic understanding, you'll be ready to work your way through the modules in this section. modules this topic
contains the following modules. you should start with the first module, then go on to one of the following modules, which show how to work with two very popular server-side languages using appropriate web frameworks. server-side website programming first steps this module provides technology-agnostic information about server-side website programming such as "what is it?", "how does it differ from cli...
Componentizing our React app - Learn web development
, so good? we’re making good use of react so far, but we could do better! our code is repetitive. the three lines that render our <todo /> component are almost identical, with only one difference: the value of each prop. we can clean up our code with one of javascript's core abilities: iteration. to use iteration, we should first re-think our tasks. tasks as data each of our tasks currently
contains three pieces of information: its name, whether it has been checked, and its unique id. this data translates nicely to an object. since we have more than one task, an array of objects would work well in representing this data. in src/index.js, make a new const beneath the final import, but above reactdom.render(): const data = [ { id: "todo-0", name: "eat", completed: true }, { id: "todo-1",...
React interactivity: Events and state - Learn web development
n add new tasks, you may notice a problem: our heading reads 3 tasks remaining, no matter how many tasks we have! we can fix this by counting the length of tasklist and changing the text of our heading accordingly. add this inside your app() definition, before the return statement: const headingtext = `${tasklist.length} tasks remaining`; hrm. this is almost right, except that if our list ever
contains a single task, the heading will still use the word “tasks”. we can make this a variable, too. update the code you just added as follows: const tasksnoun = tasklist.length !== 1 ? 'tasks' : 'task'; const headingtext = `${tasklist.length} ${tasksnoun} remaining`; now you can replace the list heading's text content with the headingtext variable. update your <h2> like so: <h2 id="list-heading"...
React interactivity: Editing, filtering, conditional rendering - Learn web development
ssname="btn btn__danger" onclick={() => props.deletetask(props.id)} > delete <span classname="visually-hidden">{props.name}</span> </button> </div> </div> ); we've now got the two different template structures — "edit" and "view" — defined inside two separate constants. this means that the return statement of <todo /> is now repetitious — it also
contains a definition of the "view" template. we can clean this up by using conditional rendering to determine which template the component returns, and is therefore rendered in the ui. conditional rendering in jsx, we can use a condition to change what is rendered by the browser. to write a condition in jsx, we can use a ternary operator. in the case of our <todo /> component, our condition is "is thi...
TypeScript support in Svelte - Learn web development
the lang='ts' attribute. let's import the todotype, and set the type of the todo prop. replace the export let todo line with the following: import type { todotype } from '../types/todo.type' export let todo: todotype the first warning we get is typescript telling us to define the type of the update() function's updatedtodo variable. this can be a little tricky because updatedtodo
contains only the attributes of the todo that have been updated. that means it's not a complete todo — it only has a subset of a todo's properties. for these kinds of cases, typescript provides several utility types to make it easier to apply these common transformations. what we need right now is the partial<t> utility, which allows us to represent all subsets of a given type. the partial utility re...
Working with Svelte stores - Learn web development
ved from the page. while visually evident to users who can see the page, they may not be so obvious to users of assistive technologies, like screen readers. to handle those situations, we can take advantage of aria live regions, which provide a way to programmatically expose dynamic content changes so that they can be detected and announced by assistive technologies. we can declare a region that
contains dynamic content that should be announced by assistive technologies with the aria-live property followed by the politeness setting, which is used to set the priority with which screen readers should handle updates to that regions. the possible settings are off, polite, or assertive. for common situations, you also have several predefined specialized role values that can be used, like log, status ...
Creating our first Vue component - Learn web development
in development mode, so you can't strictly rely on it in production. additionally, prop validation functions are invoked before the component instance is created, so they do not have access to the component state (or other props). for this component, we’ll use the object registration method. go back to your todoitem.vue file. add a props property inside the export default {} object, which
contains an empty object. inside this object, add two properties with the keys label and done. the label key's value should be an object with 2 properties (or props, as they are called in the context of being available to the components). the first is a required property, which will have a value of true. this will tell vue that we expect every instance of this component to have a label field. vue ...
Adding a new todo form: Vue events, methods, and models - Learn web development
. if the label value is empty, let's not emit the todo-added event. onsubmit() { if(this.label === "") { return; } this.$emit('todo-added', this.label); } try your form again. now you will not be able to add empty items to the to-do list. using v-model to update an input value there's one more thing to fix in our todoform component — after submitting, the <input> still
contains the old value. but this is easy to fix — because we're using v-model to bind the data to the <input> in todoform, if we set the name parameter to equal an empty string, the input will update as well. update your todoform component’s onsubmit() method to this: onsubmit() { if(this.label === "") { return; } this.$emit('todo-added', this.label); this.label = ""; } now when you cli...
Handling common accessibility problems - Learn web development
ll be given a welcome screen where you can choose to start vo or not, and run through a rather useful tutorial to learn how to use it. to turn it off again, press cmd + f5 again. note: you should go through the tutorial at least once — it is a really useful way to learn vo. when vo is on, the display will look mostly the same, but you'll see a black box at the bottom left of the screen that
contains information on what vo currently has selected. the current selection will also be highlighted, with a black border — this highlight is known as the vo cursor. to use vo, you will make a lot of use of the "vo modifier" — this is a key or key combination that you need to press in addition to the actual vo keyboard shortcuts to get them to work. using a modifier like this is common with scree...
Handling common JavaScript problems - Learn web development
tions via native browser features like css animations (or the nascent web animations api) than javascript. read brian birtles' animating like you just don’t care with element.animate for some really useful theory on why animation is expensive, tips on how to improve animation performance, and information on the web animations api. note: addy osmani's writing fast, memory-efficient javascript
contains a lot of detail and some excellent tips for boosting javascript performance. cross-browser javascript problems in this section, we'll look at some of the more common cross-browser javascript problems. we'll break this down into: using modern core javascript features using modern web api features using bad browser sniffing code performance problems using modern javascript/api features ...
omni.ja (formerly omni.jar)
may break firefox if you do not use the right options when packing the extracted files. the correct command to pack omni.ja is: zip -0dxqr omni.ja * the working directory must be at the root directory of the files from the omni.ja file. zip -0dxqr omni.ja path/to/omni/* will not work. note: prior to firefox 10 and thunderbird 10, omni.ja was called omni.jar. omni.ja contents the omni.ja file
contains assorted application resources: chrome.manifest the chrome manifest file. /chrome/ user interface files for the application /chrome/localized.manifest manifest of localized content; referenced by the main chrome manifest file. /chrome/nonlocalized.manifest manifest of non-localized content; referenced by the main chrome manifest file. /components/ xpcom components the application reli...
Accessibility Features in Firefox
fonts. text files used in configuration (techies only): configuration files are easily edited with any text editor. for example, prefs.js gives access to a large number of configuration options not available in the preferences window. also, usercontent.css allows users knowledgeable about cascading style sheets to customize the appearance of all pages that are displayed. finally, bookmarks.html
contains all your bookmarks, and is easy to move around from computer to computer. view selection source (techies only): when you select some text and right click or press shift+f10, you can "view selection source". this will show the html source for only the selected text, which is useful for understanding accessibility problems in some web sites. customize your experience! many users are finding the...
Accessibility Information for Core Gecko Developers
ent shows several interactive desktop-style widgets that are accessible by keyboards and assistive technologies, and outlines a plan being developed by ibm, mozilla, and the wai protocols and formats working group (pfwg) to address the issue of dhtml accessibility. mozilla accessibility architecture this document explains how we implement the cross-platform accessibility layer in mozilla. it
contains a class hierararchy and an explanation of the accessibility cache. unix accessibility project this document describes the sun accessibility project. join the mozilla accessibility community live chat both end users and developers are invited for discussion on the live irc channel at irc.mozilla.org/#accessibility. since this is a worldwide effort, there is always a good chance to find ...
Information for External Developers Dealing with Accessibility
ument for developers who need to support microsoft active accessibility (msaa) in a desktop application, in order to make it accessible with 3rd party assistive technologies, containing practical tips and the details of mozilla's implementation. accessibility api cross reference should be helpful at anyone looking at implementing accessibility api support for a product on multiple platforms.
contains info on accessible roles, states and events. accessible toolkit checklist a list of what needs to be done for accessibility when building new toolkits, widget by widget. in addition, here is a list of official keyboard ui guidelines for each desktop: windows keys: guidelines on keyboard ui design and on implementing keyboard shortcuts: an excellent resource from microsoft. ...
Mozilla’s UAAG evaluation report
software that renders web content. the uaag is not the basis for any government accessibility regulations at this time. this document is based on the september 12, 2001 candidate recommendation of uaag 1.0. this may be different from the most recent version, check for updates on the user agent working group home page. look to the "techniques" document for real-world implementation examples of each checkpoint. this uaag evaluation report covers nightly builds of the mozilla web browser itself, running on windows 2000, as of february 20, 2002. we are claiming to support html 4, css 2, png, jpg and gif. ...
Accessibility and Mozilla
cessibility architecturethis page is maintained by aaron leventhal and by the mozilla accessibility community. feedback and constructive suggestions are encouraged.mozilla plugin accessibilityplugins in gecko-based browsers have a lot of accessibility issues. here is a rundown of problems and the planned solutions:mozilla's section 508 compliancemozilla’s uaag evaluation reportthe uaag document
contains a very rich set of accessibility guidelines, that broadly define how accessibility should be implemented by any user agent, i.e. software that renders web content. the uaag is not the basis for any government accessibility regulations at this time.multiprocess on windowsa high-level overview of the ideas behind the a11y+e10s design is available on the wiki.software accessibility: where are we tod...
Index
ructions for building that source code, where build processes render your extension’s code hard to read. 684 themes add-ons, look & feel, themes themes allow you to change the look and feel of the user interface and personalize it to your tastes. learn how to create and share themes! 685 obsolete add-ons, archive, look & feel, obsolete, themes this page
contains theme documents and resources that we don't expect will ever be updated, but which we're keeping for the time being as potential source material for updated docs. 686 theme concepts theme, add-on themes developed using the webextensions api in firefox enable you to change the look of the browser by adding images to the header area of the firefox browser; this is the area behi...
Obsolete
this page
contains theme documents and resources that we don't expect will ever be updated, but which we're keeping for the time being as potential source material for updated docs. creating a skin for firefox uuid contents.rdf install.rdf theme changes in firefox 2 theme changes in firefox 3 theme changes in firefox 3.5 theme changes in firefox 4 building a theme common theme issues and their solutions making sure your theme works with rtl locales creating a skin for seamonkey 2 dom inspector inspectorwidget force rtl yet another theme tutorial ...
Adding a new CSS property
e mochitests in layout/style/test, which can be run with the command "./mach mochitest -f plain layout/style/". then, unless you're implementing a shorthand property, you need to decide which style struct the computed value of the property should go in. (again, see the gecko overview for more information.) it should generally be grouped with related properties. remember that each style struct
contains only properties that inherit by default or only properties that do not. (which set the property is in is given in the specification, which says "inherited: yes" or "inherited: no" in the property's definition.) also note that some of the style structs intentionally contain only properties set/reset by a particular common shorthand property; this improves the effectiveness of some of the perform...
What to do and what not to do in Bugzilla
es. resolving bugs some general rules: when you resolve a bug, cc yourself so that you are informed when new facts come up. the conditions for not resolving a bug always overrule the conditions for resolving a bug. when in doubt about resolving a bug, leave it alone! resolving bugs as duplicate in general newer bugs should be marked as duplicates of older bugs, except when the newer bug
contains more information (bug description clearer, patch already attached, lots of people already cc'ed, etc.). resolving bugs as worksforme you can resolve a bug as worksforme (wfm) if it can't be reproduced on the reported hardware/os. you should not resolve a bug as wfm if: the bug reporter uses a different hardware/operating system (e.g. bug appears on linux and you can't reproduce it on window...
Command line options
le message options by comma (,), for example: "to=foo@nowhere.net,subject=cool page" . comma separators must not follow or precede spaces ( ). to assign multiple values to a field, enclose the values in single quotes ('), for example: "to='foo@nowhere.net,foo@foo.de',subject=cool page" . using command line options command line options follow the command to start the application. if the option
contains arguments, enter the argument after the option. some options have abbreviations, for example, "-editor" can be abbreviated as "-edit" (available abbreviations are described in the text below). in some cases, option arguments must be enclosed in quotation marks (this is noted in the option descriptions below). multiple command line options can be specified. in general, the syntax is as follows: a...
Continuous Integration
ecute several suites for desktop firefox and firefox for android; these suites are denoted using lower-case letters, e.g., t(c d g1 o s tp). the talos indicators in treeherder appear green if the job successfully completed; to see the performance data generated by the jobs, click on the performance tab of the job details panel that pops up when you click on a job in treeherder. each talos suite
contains a set of tests or pages, some of these in turn have sub-tests. each test is executed multiple times to produce a number of data replicates. the talos harness produces a single number per test (typically the median of all the replicates excluding the first 1-5), which are stored in treeherder's database, and are accessible via the perfherder interface. other performance systems autophone (and...
Creating a Login Manager storage module
the category registration looks like this: nscomptr<nsicategorymanager> cat = do_getservice(ns_categorymanager_contractid); ns_ensure_state(cat); cat->addcategoryentry("login-manager-storage", "nsiloginmanagerstorage", kyourcontractid, pr_true, pr_true, nsnull); don't forget to unregister the category on unload. ...
Debugging a hang on OS X (Archived)
see how to report a hung firefox instead. if you find a hang in an application, it is very useful for the developer to know where in the code this hang happens, especially if he or she can't reproduce it. below are steps you can use to attach so-called "samples" to bug reports. creating the sample on mac os x 10.5 (xcode < 4.2) when the application is still hung, open up spin control.app (it’s in your <tt>/developer/applications/performance tools/</tt> folder; if it is missing, install the latest computer hardware understanding development (chud) tools from apple). ...
Debugging
illa with gdb gdb is our primary debugger on mac and linux. debugging mozilla with lldb lldb is the new debugger on mac. advanced debugging techniques understanding crash reports how to read crash reports, which are full of information yet often not easy to interpret and act on. debugging a minidump windows crash reports include a minidump, which
contains a lot of information about the application when it crashed. debugging mozilla with valgrind valgrind is a memory debugger for mac and linux. it is slow, but good for tracking down difficult memory safety bugs. replay debugging firefox with vmware workstation how to setup record and replay debugging on firefox, to help debug intermittent mochitest failures. detecting defec...
Configuring Build Options
he mozconfig path: export mozconfig=$home/mozilla/mozconfig-firefox calling the file .mozconfig (with a leading dot) is also supported, but this is not recommended because it may make the file harder to find. this will also help when troubleshooting because people will want to know which build options you have selected and will assume that you have put them in your mozconfig file. mozconfig
contains two types of options: options prefixed with mk_add_options are passed to client.mk. the most important of these is moz_objdir, which controls where your application gets built (also known as the object directory). options prefixed with ac_add_options are passed to configure, and affect the build process. building with an objdir this means that the source code and object files are not inte...
Old Thunderbird build
ntral. (make sure the unbundled folder's name is now "mozilla" and not "mozilla-central"). then run "python client.py checkout" to ensure you are up-to-date. the source code requires 3.6gb of free space or more and additionally 5gb or more for default build. build configuration to build thunderbird, you need to add a file named mozconfig to the root directory of the comm-central checkout that
contains the following line: ac_add_options --enable-application=mail you can create a file with this line by doing this: cd comm-central echo 'ac_add_options --enable-application=mail' > mozconfig if you omit this line, the build system will build firefox instead. other build configuration options can be added to this file, although it's strongly recommended that you only use options that you fully ...
Simple SeaMonkey build
ly static builds which require even more memory to link. the support for libxul builds is still experimental but it should work if you --disable-mailnews. on windows, the above commands will create the comm-central directory in %userprofile% which may be some subfolder of c:\documents and settings\ on systems upgraded from xp or below. the space in this directory name, or in your user name if it
contains one, will cause the configure script to break. to (possibly) fix this, cd to a dir without spaces before doing the "hg clone" command above. running seamonkey the seamonkey executable can be found in obj-sm-release/dist/bin/ (used to be obj-sm-release/mozilla/dist/bin/) on windows and linux and in obj-sm-release/dist/seamonkey.app/contents/macos/ on mac. how to build again later in your com...
Simple Sunbird build
should be well.) open a shell window by running: c:\mozilla-build\start-msvcx.bat (where x is 8 for vs 2005, and 9 for vs 2008). problems? see windows build prerequisites. building sunbird building sunbird requires at least 2.5 gb of disk space, 500 mb of ram, and lots of available swap space. on windows, if you open the command prompt you are usually in your user profile folder which often
contains spaces ( c:\documents and settings\...). this causes problems while building. to avoid this issue, change to a directory without spaces (i.e. c:\ ) before doing the following steps. you can use the "cd" command to do so. # get the source hg clone http://hg.mozilla.org/comm-central/ cd comm-central python client.py checkout # setup a basic .mozconfig file echo 'ac_add_options --enable-applicatio...
Simple Thunderbird build
e from thunderbird 59 and earlier): hg clone https://hg.mozilla.org/mozilla-central source/ cd source/ hg clone https://hg.mozilla.org/comm-central comm/ the source code requires 3.6gb of free space or more and additionally 5gb or more for default build. build configuration to build thunderbird, you need to add a file named mozconfig to the root directory of the mozilla-central checkout that
contains the following line: ac_add_options --enable-application=comm/mail you can create a file with this line by doing this in the source/ directory: echo 'ac_add_options --enable-application=comm/mail' > mozconfig if you omit this line, the build system will build firefox instead. other build configuration options can be added to this file, although it's strongly recommended that you only use opti...
Creating Custom Events That Can Pass Data
foo). you'll want to add an entry to it which looks like this: domci_class({truncated name}) here's the fun part: above i mentioned that you must name your events as nsdom. however, here you want to put the other part of the name (e.g. if you have an event named nsdommyfirstevent your nsdomclassinfoclasses entry would be domci_class(myfirstevent)). mozilla/dom/src/base/nsdomclassinfo.cpp mozilla
contains many convenience macros to make changes like the one you're making easier. your modification of this file is basically just two macro calls. try to make sure of two things: keep your stuff at the back. you know never know what depends on that enum you modified keep your stuff organized. same reason as above. you need to make the following two modifications: around line 1000: ns_define_classin...
Eclipse CDT
ource directory (and not filtered out by a resource filter), then eclipse's "allow heuristic resolution of includes" option (enabled by default) will generally allow the included headers to be found when eclipse processes source files, that don't have any build output parser data. however, when the object directory is outside the source directory, eclipse doesn't know about it - or the headers it
contains - unless the user takes extra steps to tell it. this is the reason that the instructions in the initial project properties section above instruct users that have their object directory outside their source directory to explicitly add {objdir}/dist/include to the project's "cdt user setting entries". fixing eclipse bug 381601 would considerably reduce the impact of the "unresolved inclusion" issu...
Eclipse CDT Manual Setup
there is valuable information here that should be integrated back into that page, but a large amount of it is now taken care of by the mach project generation code. for now it's stored here until that integration happens in order that the eclipse cdt page isn't hugely cluttered with mostly redundant information, make setting up eclipse look much more complicated than it is nowadays. ...
Inner and outer windows
er window, which is contained in the "physical" browser window. here's the trick, though: the inner window in essence pretends to be the outer window. if the document currently being displayed asks "what window am i in?", it gets the outer window as the answer. that lets the document interact with the "physical" window, while the outer window can keep track of all the documents (inner windows) it
contains. in other words, window always returns the outer window. nested windows things become slightly more complex when you consider that documents can contain other documents. this happens, for example, when a document
contains a <frame> or <iframe>. not only can the outermost document be navigated, but if the user clicks a link in one of the frames, that frame can navigate. this means there needs to b...
Working with Mozilla source code
it. navigating the mozilla source code learn about the various folders in the mozilla source tree, and how to find what you're looking for. bugs for newcomers if you are new to the project and want something to work on, look here. interface development guide guidelines and documentation for how to create and update xpcom interfaces. the firefox codebase: css guidelines this document
contains guidelines defining how css inside the firefox codebase should be written, it is notably relevant for firefox front-end engineers. svg cleanup guide guidelines and best practices for shipping new svgs. try servers mozilla products build on at least three platforms. if you don't have access to them all, you can use the try servers to test your patches and make sure the tests pass. creating a ...
mach
ption='run it!') @commandargument('--debug', '-d', action='store_true', help='do it in debug mode.') def doit(self, debug=false): print('i did it!') from mach.decorators we import some python decorators which are used to define what python code corresponds to mach commands. the decorators are: @commandprovider this is a class decorator that tells mach that this class
contains methods that implement mach commands. without this decorator, mach will not know about any commands defined within, even if they have decorators. @command this is a method decorator that tells mach that this method implements a mach command. the arguments to the decorator are those that can be passed to the argparse.argumentparser constructor by way of sub-commands. @commandargument this is a...
Multiple Firefox profiles
r channels, each at a different level of stability and development. the four channels are release, beta, developer edition, and nightly. the release channel is recommended for most users, as it is the "official release" channel. however, for those more adventurous, you can try one of the other three channels to see what is coming in firefox and play around with emerging features. the beta channel
contains the features that are expected to be in the next release of firefox and are in final stages of testing. aurora
contains experimental features, which are not yet at beta quality. nightly
contains the latest code from firefox developers and is the least stable channel. third-party tools in addition to the built-in profile manager and the external profile manager, there are a few third-party tools...
Communicating with frame scripts
istener("my-addon@me.org:my-e10s-extension-message", listener); function listener(message) { return "value from chrome"; } this value is then presented to the frame script in the return value of sendsyncmessage(). ...
Process scripts
ons 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 traversing the docshell tree up to the top window and then retrieving its content message manager, as follows: functio...
Storage access policy: Block cookies from trackers
y network will not have access to their third-party storage, they will not recognize the user as the same user that saw the advertisements on their website and the conversion will not be tracked. we expect that this version of click-through conversion will no longer work. you run an ad that appears on a social media website. a user clicks on your advertisement and is taken to a landing page that
contains a conversion tracking tag from the third-party network. on the social media website, the network annotates the advertisement landing page url with a query parameter that signals that the visit was the result of a click on an advertisement. on your website, the display network’s tag checks the url query parameters and saves any ad tracking parameters to first-party storage. if a user later compl...
Using the Browser API
t from an untrusted/unknown origin. if you don't use it, you run the risk of your application being compromised by a malicious web site. it is implied for webextensions, which always run in a separate content process from web content. aside from the iframe, there are some basic controls: <button> elements, a simple <form> to implement the browser controls, and a search bar. the search bar also
contains buttons, as well as a form to type search requests into. you can see the full html listing here. the javascript implementation to wire up the functionality required by our simple browser, we've written some basic javascript (see the full javascript listing.) wiring up the back and forward buttons early on in the code we implement two simple event listeners to move the browser back and forward...
Gecko Chrome
chrome-only api referencethis page lists apis that only run in gecko chrome code (and sometimes in other privileged circumstances.)chrome-only css referencethis page lists css properties that are only available in gecko chrome code (and sometimes in other privileged circumstances, eg. ua stylesheets.) chrome-only events referencethis page lists events that are only available in gecko chrome code (and sometimes in other privileged circumstances, eg. ua widgets). ...
Overview of Mozilla embedding APIs
rv = basewindow->initwindow(nativewindow, // native window nsnull, // always nsnull. x, y, cx, cy); // initial dimensions... if (ns_failed(rv)) return rv; // create the child window for the webbrowser. rv = basewindow->create(); if (ns_failed(rv)) return rv; // at this point webbrowser
contains the new initialized instance // of the nswebbrowser component... // save webbrowser before it goes out of scope :-) web navigation the nsiwebnavigation interface is used to load uris into the webbrowser and provide access to session history capabilities - such as back and forward. clipboard the webbrowser exposes access to the system clipboard via the nsiclipboardcommands interface.
Gecko Keypress Event
or fixing the many key handling bugs. charcode of dom keypress event if a keypress event is fired without any modifier keys (ctrl/alt(option)/meta(win/command)), then the properties of the event are the same as they were in gecko1.8.1. that is, when the currently selected keyboard layout produces a unicode character (according to the current state of capslock and numlock), the charcode property
contains that character. when the keypress event includes modifier keys, sometimes the charcode value is replaced with an ascii character according to the following rules. the accel key depends on the platform. ctrl is the accel key on windows and linux, while meta (i.e. command) is the accel key on mac. when the accel key is down, the charcode of a keypress event may be replaced with a character from ...
Script security
nt principal subsumes only other content principals with the same origin. it is subsumed by the system principal, any expanded principals that include its origin, and any other content principals with the same origin. expanded principal an expanded principal is specified as an array of origins: ["http://mozilla.org", "http://moz.org"] the expanded principal subsumes every content principal it
contains. the content principals do not subsume the expanded principal, even if the expanded principal only
contains a single content principal. thus ["http://moz.org"] subsumes "http://moz.org" but not vice versa. the expanded principal gets full access to the content principals it
contains, with xray vision by default, and the content principals get no access to the expanded principal. this also enabl...
Gecko
rint it. in xul-based applications gecko also renders the application's user interface. gecko is used in many applications, including a few browsers such as firefox and seamonkey (for a complete list, please refer to wikipedia's article on gecko). products using the same version of gecko have identical support for web standards. documentation chrome this page
contains information specific to browser chrome (not google chrome) code running in gecko. gecko faq frequently asked questions about gecko. gecko dom reference reference to the dom. gecko event reference reference to events used within gecko and mozilla applications; for web-standard dom events, see the dom event reference. introduction to layout in mozilla t...
Gecko's "Almost Standards" Mode
in discussions of doctypes, many people will refer to a doctype as being "with uri" or "without uri." the uri is the system identifier. for example, consider the following doctype: <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> the parts are as follows: public identifier: "-//w3c//dtd html...
HTTP Cache
the cache api is completely thread-safe and non-blocking. there is no ipc support. it's only accessible on the default chrome process. when there is no profile the new http cache works, but everything is stored only in memory not obeying any particular limits. ...
How to get a process dump with Windows Task Manager
process is experiencing a hang. this article describes how to get a process dump with task manager on windows. (to get a process dump for thunderbird or some other product, substitute the product name where ever you see firefox in these instructions.) caution the memory dump that will be created through this process is a complete snapshot of the state of firefox when you create the file, so it
contains urls of active tabs, history information, and possibly even passwords depending on what you are doing when the snapshot is taken. it is advisable to create a new, blank profile to use when reproducing the hang and capturing the memory dump. please ask for help doing this! requirements windows to get a process dump, you need to be using windows vista or above. a firefox nightly or releas...
How to get a stacktrace for a bug report
ashes" as above. accessing crash report ids outside of firefox if you cannot load firefox at all you can find the crash report files at this location depending on your operating system: windows : %appdata%\mozilla\firefox\crash reports\submitted\ os x : ~/library/application support/firefox/crash reports/submitted/ linux : ~/.mozilla/firefox/crash reports/submitted/ each file in this folder
contains one submitted crash report id. you can check the modified or creation time for each file to discern which crash reports are relevant to your bug report. alternative ways to get a stacktrace if the mozilla crash reporter doesn't come up or isn't available you will need to obtain a stacktrace manually: windows see the article create a stacktrace with windbg for information on how to do this. f...
UpdateInfo
the version of the update. updateurl string the updateurl that the update can be downloaded from. updatehash string a hash for the update's file. updateinfourl string a url containing simple release notes for the update. targetapplications object[] information about what applications the update is compatible with. each item in the array
contains "id", "minversion", and "maxversion" properties. ...
DownloadList
promise remove(download adownload); promise addview(object aview); promise removeview(object aview); void removefinished([optional] function afilterfn); methods getall() retrieves a snapshot of the downloads that are currently in the list. the returned array does not change when downloads are added or removed, though the download objects it
contains are still updated in real time. promise<array<download>> getall(); parameters none. promise resolves to an array of download objects. add() adds a new download to the end of the items list. note: when a download is added to the list, its onchange event is registered by the list, thus it cannot be used to monitor the download. to receive change notifications for downloads that are added to the...
DownloadTarget
s refresh() updates the state of a finished, failed, or canceled download based on the current state as indicated by the file system. if the download is in progress or has been finalized, this method does nothing and returns a resolved promise. calling this method lets the download object's properties be updated if the user moves or deletes the target file or its associated ".part" file, which
contains a partially-downloaded file's contents. promise refresh(); parameters none. promise resolves to undefined when the state of the download has been updated. promise can be rejected with never. ...
JavaScript OS.Constants
this module is largely a companion to js-ctypes. using os.constants from the main thread to initialize os.constants for use in the main thread, add the following snippet to your code: components.classes["@mozilla.org/net/osfileconstantsservice;1"]. getservice(components.interfaces.nsiosfileconstantsservice). init(); from a chrome worker no initialization is required. module os.constants is always available for chrome workers. os.constants.sys constants related to system configuration. name the name of the operating system (e.g. "darwin"). debug set to true on debug build configurations, non-existent otherwise. ...
JavaScript OS
platform and add-ons) to interact with the host operating system. at the time of this writing, some of the features of this module are available only to chrome workers. os.constants os-related constants, including errors, file opening modes, system configuration, etc. os.file access to the native file system. os.shared utilities for defining functions that interact with the operating system. ...
Log.jsm
outputstream reset(); structuredformatter(); length: 0 keys of prototype: format(); method overview enumerateinterfaces(); length: 0 enumerateproperties(); length: 2 member fields variable type description level object
contains the following fields: field name value all 0 config 30 debug 20 desc { 0: "all", 10: "trace", 20: "debug", 30: "config", 40: "info", 50: "warn", 60: "error", 70: "fatal" } error 30 fatal 70 ...
OSFile.jsm
f.a.q. what is os.file? os.file is a new api designed for efficient, off-main thread, manipulation of files by privileged javascript code. this api is intended to replace, in time, most xpcom-based manipulation of files (nsifile, subsets of nsiioservice, etc.) by javascript code. what are the relationships with the html5 file api? none, really. the file api is designed for high-level, highly-restricted manipulation of files by web applications. os.file is designed for efficient, unrestricted, manipulation of files by firefox itself and by add-ons. ...
PopupNotifications.jsm
ed to a new location. "showing" the notification is about to be shown. the callback code can modify the notification message/actions if necessary during this notification. "shown" the notification has become visible. this can be fired multiple times as notifications are dismissed and redisplayed. the notification object each notification is represented by a notification object. this object
contains all the data necessary to present and manage the notification, and has one method. the anchorelement property returns the notification's anchor element. the remove()method removes the notification. ...
SourceMap.jsm
lace. replacement: the thing to replace the pattern with. sourcenode.prototype.tostring() return the string representation of this source node. walks over the tree and concatenates all the various snippets together to one string. sourcenode.prototype.tostringwithsourcemap(startofsourcemap) returns the string representation of this tree of source nodes, plus a sourcemapgenerator which
contains all the mappings between the generated and original sources. the arguments are the same as those to new sourcemapgenerator. ...
Task.jsm
returned promise. if you specify anything else, you get a promise that is already fulfilled with the specified value. return value a promise that is fulfills when the task returns or rejects when the task throws an exception. examples general example cu.import("resource://gre/modules/task.jsm"); task.spawn(function* () { // this is our task. it is a generator function because it
contains the // "yield" operator at least once. let's create a promise object, wait on // it and capture its resolution value. let mypromise = getpromiseresolvedontimeoutwithvalue(1000, "value"); let result = yield mypromise; // this part is executed only after the promise above is resolved (after // one second, in this imaginary example). we can easily loop while // calling asynchronous ...
Timer.jsm
the timer.jsm javascript code module
contains pure-javascript implementations of settimeout, cleartimeout, setinterval, and clearinterval that are compatible with the dom window functions, but that can be used by code that does not have access to a dom window (for example, javascript code modules or content frame scripts). to use timer.jsm, first import it: components.utils.import("resource://gre/modules/timer.jsm"); then call settimeout and cleartimeout just as you would in a dom window, for example: let timeoutid = settimeout(function() { console.log("hello!"); }, 500); cleartimeout(timeoutid); similarly, you can use setinterval and clearinterval like so: let intervalid = setinterval(function() { console.log("happening every 500ms!"); }, 500); clearinterval(intervalid); ...
WebRequest.jsm
iously doesn't make sense to cancel a network request after it has completed. the general approach to modifying and canceling requests is this: first, pass an array containing the string "blocking" as the third argument to your addlistener() call. this tells the browser to wait for your event listener to return before continuing with the request. next, return an object from the listener that
contains instructions for what the browser should do with this request. there are four things you can do with a request: cancel it redirect it modify request headers modify response headers. to perform one of these operations, include a property with the appropriate name in the object returned from the listener, and assign it the desired value, as detailed in the table below: operation...
source-editor.jsm
) are considered to be a single operation on the undo stack. void startcompoundchange(); parameters none. undo() undoes the most recent change made in the editor. boolean undo(); parameters none. return value true if a change was undone or false if there were no changes to undo. the editor configuration object when you call init() to initialize the editor, you pass in an object that
contains properties configuring the editor's features. that object may contain any combination of the following properties: constant type description contextmenu string | element a reference to the context menu to display when the user right-clicks in the editor. this may be either a string providing the id of a xul <xul:menupopup> or an element object of type <xul:menupopup...
JavaScript code modules
e, using the power of javascript's yield operator. timer.jsm a pure js implementation of window.settimeout. webapps.jsm provides an interface to manage open web apps. webrequest.jsm provides an api to add event listeners for the various stages of making an http request. the event listener receives detailed information about the request, and can modify or cancel the request. xpcomutils.jsm
contains utilities for javascript components loaded by the js component loader. ...
Index
ora guide, localization, mozilla localizers who are working on l10n-central are responsible for getting their work onto the aurora repository. 34 web localizability internationalization, localizability, localization, web development localizability (or l12y for short) is a characteristic found in an application or content that enables localization. the following list
contains links to pages that highlight steps that can be taken to make web content localizable. the documentation is divided into 4 parts: 35 creating localizable web applications internationalization, localizability, localization, web development an important step of developing a web application or creating web content is making sure that it can be localized. listed below are good p...
Localization and Plurals
plurals in mind. for all other properties files that link to this page, you'll need to provide enough plural forms of the desired word, and separate them with semi-colons (;). if you don't know how many plural forms you need, check the pluralrule number in chrome/global/intl.properties, and look up the corresponding entry in the following list of plural rules. list of plural rules this section
contains a list of plural rules ordered by their plural rule number. each entry indicates how many plural forms are needed when localizing a word. for each entry, there is a list of families and languages in those families, to help you figure out if it's the rule you should pick for pluralrule. additionally, there is a brief description of each plural form, followed by some sample numbers that fall into t...
Localizing with Koala
ect from template... choose "koala" in the categories list. choose "koala" in the templates list. choose a name for your project (e.g. l10n.kpf). choose the directory in which the project will live in (e.g. c:\mozilla\l10n on windows, /home/user/mozilla/l10n on linux or /users/user/mozilla/l10n on mac os x). due to a bug in koala (bug 21930), it is recommended that you don't choose a path that
contains spaces (like c:\documents and settings\user\...). click "open" to create the project. koala will check for mercurial. make sure that your mercurial installation is in your system's $path. setup wizard will open. configure the application choose "firefox" as the application. version: 3.6. appname: browser. included locale: en-us (this is the original locale you're translating from). leave l...
Localizing with Mercurial
or mercurial.ini (windows) and save it in either $home/ or c:\mozilla-build\hg\ or c:\program files\mercurial\. now that you've installed and configured mercurial, here are a few tasks you can do without hg commit access priviledges. cloning and updating repositories there are a couple of repostiories that contain en-us source files that most locales will want to deal with. mozilla-central
contains the files for firefox nightly. comm-central
contains the files for seamonkey and thunderbird which are not already part of firefox. l10n-central
contains all of the l10n repos for firefox nightly. when you get the comm-central repository, this will include the mozilla-central repository as well. you can therefore use the one set up for developing firefox, seamonkey and thunderbird without ha...
Localizing with Mozilla Translator
ing an en-us only mercurial repository comprising both mozilla-central and comm-central. if you are happy with a non-official solution (it's not like if they were third-party, they are your french equals!) ;-) you have a pretty easy and comfortable solution. if you are using a filesystem with symbolic links support (i.e., linux or mac), you can create symbolic links in a separate directory so it
contains just the locale part. thanks to alexandru szasz, from narro, [http://groups.google.com/group/mozil...bbffa5402ec819 for this inspiration]. see this example for browser. for the last two options, you should be able to adjust your current mt product paths so you can keep using it just like with cvs. keep in mind that mt doesn't really know if you are using cvs, svn, or mercurial. it is just inst...
Patching a Localization
. navigate to your working localization directory. cd ~/localization-workdir/gl create a patch (also known as a diff) using the diff command. hg diff this command creates a patch and lists your modifications through displaying the differences in a unified patch's files. these modifications are printed to stdout (standard output). visually inspect your modifications. a good patch only
contains those changes that you intended to make. if it
contains more, you'll likely regress something else. alternatively, you can select specific files for diff to evaluate and print (see below). the command will only print the differences found in the selected files. hg diff browser/chrome/browser/browser.dtd attach the patch to an existing bug for reference or review or create a new one if o...
QA phase
gate to your working directory from your command-line terminal (i.e., where you created the folder structure described above). enter the following commands: mkdir -p l10n-central/x-testing/toolkit/ cp mozilla-aurora/toolkit/locales/defines.inc l10n-central/x-testing/toolkit/defines.inc tah-dah! copied! finally, you will need a file called .mozconfig to proceed with manual builds. this file
contains the necessary build instructions. to create and configure this file, follow these instructions: until the fix for bug 1063880 lands on mozilla-aurora and mozilla-beta when building language packs against those two trees you should: remove ac_add_options --disable-compile-environment from .mozconfig in step 3 use ./mach build config after step 4 update the mozilla source code...
Web Localizability
the documentation is divided into 4 parts: how to create localizable content. how to choose the right localization format. how to create localizable web applications. how to set up the infrastructure for localization. why localizability is important there are many reasons why you should start thinking about making your web app localizable as soon as possible. you will make localizer's life easier, for which they will be grateful. ...
MathML Torture Test
{ var mathfont = document.getelementbyid("mathfont").value; if (mathfont == "default") { document.body.removeattribute("class"); } else { document.body.setattribute("class", mathfont); } } function load() { document.getelementbyid("mathfont"). addeventlistener("change", updatemathfont, false) } window.addeventlistener("load", load, false); the following test
contains sample tex formulas from knuth's tex book and equivalent mathml representations. it compares the rendering by the xetex engine using the default latin modern math font against the mathml rendering by your browser using the default math font, or an alternative opentype math fonts. to get the best rendering, be sure to have appropriate mathematical fonts installed on your system and to use a browse...
Using the viewport meta tag to control layout on mobile browsers
detective work to figure out exactly how to implement it in fennec. for example, safari's documentation says the content is a "comma-delimited list," but existing browsers and web pages use any mix of commas, semicolons, and spaces as separators. learn more about viewports in different mobile browsers in a tale of two viewports at quirksmode.org. viewport basics a typical mobile-optimized site
contains something like the following: <meta name="viewport" content="width=device-width, initial-scale=1"> the width property controls the size of the viewport. it can be set to a specific number of pixels like width=600 or to the special value device-width, which is the width of the screen in css pixels at a scale of 100%. (there are corresponding height and device-height values, which may be useful f...
Mozilla Web Services Security Model
ements must be in the same namespace as the parent, and must be empty. the delegate element a delegate element means that the browser should delegate the access control to a web-scripts-access.xml file in the directory that the service is in. for example, when accessing a web service at http://www.example.com/dir1/dir2/service, if the access file at http://www.example.com/web-scripts-access.xml
contains a delegate element, mozilla will instead use http://www.example.com/dir1/dir2/web...ipt-access.xml to determine whether access is permitted. if no such file exists, then access will be denied. the allow element if no delegate elements are present or if the web service is in the same directory as the web-script-access.xml file, then the allow elements will be processed. if the file exists but co...
Mozilla Style System
o the rest of mozilla consists of a single nsstyleset object and many nsstylecontext objects, each of which holds the computed style for an element, pseudo-element, or text node. the style set provides the api managing the rule processors and for creating style contexts. the style contexts then provide the api for computed style data by allowing retrieval of a set of style structs, each of which
contains the computed values of a set of css properties. style structs the style structs are a set of structs, each of which holds computed values a group of properties. they all have names beginning with nsstyle*, and they should not be confused with the css structs (nscss*), which hold specified values. the grouping of properties into structs follows two rules: any properties in the same style str...
DMD
ted/0/download/memory-reports/unified-memory-report-default-20731.json.gz the path is where the memory reports and dmd reports get dumped to. you can pull them like so: adb pull /sdcard/download/memory-reports/dmd-default-20731.json.gz adb pull /sdcard/download/memory-reports/unified-memory-report-default-20731.json.gz processing the output dmd outputs one gzipped json file per process that
contains a description of that process's heap. you can analyze these files (either gzipped or not) using dmd.py. on nightly firefox, dmd.py is included in the distribution. for instance on os x, it is located in the directory /applications/firefox nightly.app/contents/resources/. for nightly, symbolication will fail, but you can at least get some information. in a local build, dmd.py will be located in th...
Gecko Profiler FAQ
ile. you can make your own talos pageload test which has just the one page that you’re interested in in its manifest. what actually means the percentage of the running time? the percentage of samples with stacks under this stack. how you identify a user action in the main thread we’re missing ui for this at the moment. the profile
contains markers for dom events, and those include user-generated events like mouse clicks, but these markers are only exposed as a huge unsearchable list in the markers tab. if you have a rough idea of what the user was doing, try searching for functions that you’d expect in the call tree and see where they are in the thread timeline. what is a suggested comprehensive performan...
Power profiling overview
am (from the intel power governor documentation) shows how machines using recent intel processors are constructed. the important points are as follows. the processor has one or more packages. these are part of the actual processor that you buy from intel. client processors (e.g. core i3/i5/i7) have one package. server processors (e.g. xeon) typically have two or more packages. each package
contains multiple cores. each core typically has hyper-threading, which means it
contains two logical cpus. the part of the package outside the cores is called the uncore or system agent. it includes various components including the l3 cache, memory controller, and, for processors that have one, the integrated gpu. ram is separate from the processor. c-states intel processors have aggressive power-s...
Profiling with the Firefox Profiler
n having gotten a profile this way, the layer tree for a composite can be seen by clicking on a composite in the "frames" section of cleopatra (you may need to a sub-range of samples to make individual composites large enough to be clicked). this will activate the "layertree" tab: in this screenshot, composite #143 has been selected. the layer tree structure can be seen in the left panel. it
contains, for each layer, the type of the layer, and various metrics about the layer, such as the visible region and any transforms. in the right panel, a visualization of the layer tree (based entirely on the aforementioned metrics) is shown. hovering over a layer in the left panel highlights the layer in the right panel. this is useful for identifying what content each layer corresponds to. here, i'm ho...
Refcount tracing and balancing
ions. to aid in this process, you can create an "excludes file", that lists the name of functions that you want to exclude from the tree building process (presumably because you've matched them). make-tree.pl has an option --exclude [file], where [file] is a newline-separated list of function names that will be excluded from consideration while building the tree. specifically, any call stack that
contains that call site will not contribute to the computation of balance factors in the tree. how to instrument your objects for refcount tracing and balancing the process is the same as instrumenting them for bloatview, because bloatview and refcount tracing share underlying infrastructure. ...
Reporting a Performance Problem
ppears before sharing the profile. there will be a button in the top right labeled 'publish' which will allow you to upload this profile and once completed will write out a link. before uploading, the publish button asks you what data you'd like to publish to our servers. note that while it's possible to strip profiles of potentially privacy sensitive information, the less information a profile
contains, the harder it is to analyze and turn into actionable data. once uploaded, copy permalink url to your clipboard by right clicking and add the profile url to a bug for your performance problem and/or send it to the appropriate person. try to give some context about what you were doing when the performance problem arose such as the url you were viewing and what actions were you doing (ex. scrollin...
browser.urlbar.trimURLs
t value: true exists by default: yes application support:firefox 7.0 status: active; last updated 2012-04-03 introduction: pushed to nightly on 2011-06-23 bugs: bug 665580 values true (default) if the active url is exactly the domain name, the trailing slash (/) behind the top level domain will be hidden. if the address starts with http:// and neither starts with a ftp. subdomain nor
contains @ (usually for ftp login information), the http:// prefix will be hidden. examples: https://www.example.org/ becomes https://www.example.org, http://www.example.org/foobar becomes www.example.org/foobar and http://ftp.example.org/foobar remains unchanged. false all parts of the url are shown. ...
Emscripten techniques
debugging out-of-memory problems a common bug to diagnose with emscripten is where a big game fails due to an out of memory error (oom) somewhere during load time. by the time about:memory is loaded in a new tab and you have clicked the "measure" button to diagnose what's happened, the memory usage causing the spike has gone away, making temporary memory spikes difficult to diagnose. this article explains how to debug such problems. ...
Emscripten
load and process files, through to application frameworks like qt. emscripten generates fast code — its default output format is asm.js , a highly optimizable subset of javascript that can execute at close to native speed in many cases. note: sound interesting? read more about emscripten and try some demos, then get started with using it. other articles of interest on mdn our games zone
contains some useful content related to games development, which is a common area of use for emscripten. our emscripten techniques page is a place to store useful emscripten-related ideas that haven't made it onto the emscripten wiki. ...
AsyncTestUtils extended framework
{subject: "", body: "", from: "", to: "", cc: "", recipient: "", involves: ""}, aandtermstogether, aoptionalname); this is a convenience function to help you create a new virtual folder. the first argument is the list of folders we should search. the second argument defines the search query; each attribute defines a "
contains" string constraint. if you include the attribute, the constraint is created. so if you want no constraints, pass an empty object, but if you just want a subject constraint, pass {subject: "foo"}. the third argument decides whether to "and" together multiple constraints (if there are multiple constraints); true for and, false for or. mark an imap folder as offline and bring the messages offline ...
Midas
emoved. otherwise, all selected characters will become underlined. undo this command will undo the previous action. if no action has occurred in the document, then this command will have no effect. note: the shortcut key will automatically trigger this command (typically accel-z) unlink if the insertion point is within a link or if the current selection
contains a link, the link will be removed and the text will remain. readonly this command has been replaced with contentreadonly. it takes the same values as contentreadonly, but the meaning of true and false are inversed. usecss this command has been replaced with stylewithcss. it takes the same values as stylewithcss, but the meaning of true and false are ...
NSPR Poll Method
to the poll method, one with pr_poll_read as in_flags and the other with pr_poll_write as in_flags, so that you know what events at the network transport layer pr_poll_read and pr_poll_write are mapped to, respectively. on return, if (new_flags & out_flags) is nonzero, you can try pr_recv or pr_send immediately. otherwise ((new_flags & out_flags) is 0), you should do the following. if new_flags
contains pr_poll_read, you should try pr_recv or pr_send when the underlying network transport is readable if new_flags
contains pr_poll_write, you should try pr_recv or pr_send when the underlying network transport is writable important do not use out_flags in any way other than testing if (new_flags & out_flags) is 0. this is how pr_poll (the primary user and hence the de facto specification of the po...
PL_strcpy
copies a string, up to and including the trailing '\0', into a destination buffer. syntax char * pl_strcpy(char *dest, const char *src); parameters the function has these parameters: dest pointer to a buffer. on output, the buffer
contains a copy of the string passed in src. src pointer to the string to be copied. returns the function returns a pointer to the buffer specified by the dest parameter. description if the string specified by src is longer than the buffer specified by dest, the buffer will not be null-terminated. ...
PR_Accept
specified socket. syntax #include <prio.h> prfiledesc* pr_accept( prfiledesc *fd, prnetaddr *addr, printervaltime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing the rendezvous socket on which the caller is willing to accept new connections. addr a pointer to a structure of type prnetaddr. on output, this structure
contains the address of the connecting entity. timeout a value of type printervaltime specifying the time limit for completion of the accept operation. returns the function returns one of the following values: upon successful acceptance of a connection, a pointer to a new prfiledesc structure representing the newly accepted connection. if unsuccessful, null. further information can be obtained by...
PR_CreateIOLayerStub
iomethods const *methods); parameters the function has the following parameters: ident the identity to be associated with the new layer. methods a pointer to the priomethods structure specifying the functions for the new layer. returns a new file descriptor for the specified layer. description a new layer may be allocated by calling pr_createiolayerstub. the file descriptor returned
contains the pointer to the i/o methods table provided. the runtime neither modifies the table nor tests its correctness. the caller should override appropriate contents of the file descriptor returned before pushing it onto the protocol stack. ...
PR_CreatePipe
creates an anonymous pipe and retrieves file descriptors for the read and write ends of the pipe. syntax #include <prio.h> prstatus pr_createpipe( prfiledesc **readpipe, prfiledesc **writepipe); parameters the function has the following parameters: readpipe a pointer to a prfiledesc pointer. on return, this parameter
contains the file descriptor for the read end of the pipe. writepipe a pointer to a prfiledesc pointer. on return, this parameter
contains the file descriptor for the write end of the pipe. returns the function returns one of these values: if the pipe is successfully created, pr_success. if the pipe is not successfully created, pr_failure. the error code can be retrieved via pr_geterror. description pr_createpipe creates an anonymous pipe. data written into ...
PR_ExplodeTime
tion. exploded a pointer to a location where the converted time can be stored. this location must be preallocated by the caller. returns nothing; the buffer pointed to by exploded is filled with the exploded time. description this function converts the specified absolute time to a clock/calendar time in the specified time zone. upon return, the location pointed to by the exploded parameter
contains the converted time value. ...
PR_FindSymbolAndLibrary
if successful, returns a non-null pointer to the found symbol, and stores a pointer to the library in which it was found at the location pointed to by lib. if the symbol could not be found, returns null. description this function finds the specified symbol in one of the currently loaded libraries. it returns the address of the symbol. upon return, the location pointed to by the parameter lib
contains a pointer to the library that
contains that symbol. the location must be pre-allocated by the caller. the function returns null if no such function can be found. the order in which the known libraries are searched in not specified. this function is equivalent to calling first pr_loadlibrary, then pr_findsymbol. the identity returned from this function must be the target of a pr_unloadlibrary in...
PR_GetErrorText
copies the current thread's current error text without altering the text as stored in the thread's context. syntax #include <prerror.h> print32 pr_geterrortext(char *text); parameters the function has one parameter: text on output, the array pointed to
contains the thread's current error text. returns the actual number of bytes copied. if the result is zero, text is unaffected. ...
PR_GetSocketOption
*data); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing the socket whose options are to be retrieved. data a pointer to a structure of type prsocketoptiondata. on input, the option field of this structure must be set to indicate which socket option to retrieve for the socket represented by the fd parameter. on output, this structure
contains the requested socket option data. returns if successful, pr_success. if unsuccessful, pr_failure. the reason for the failure can be obtained by calling pr_geterror. ...
PR_Read
amount the size of buf (in bytes). ...
PR_SetLibraryPath
the syntax of the pathname is not defined, nor whether that pathname should be absolute or relative. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. ...
PR_dtoa
s past the decimal point. this gives a return value similar to that from fcvt, except that trailing zeros are suppressed, and ndigits can be negative. 4,5,8,9 same as modes 2 and 3, but usingleft to right digit generation. 6-9 same as modes 2 and 3, but do not try fast floating-point estimate (if applicable). all others treated as mode 2. upon return, the buffer specified by buf and bufsz
contains the converted string. trailing zeros are suppressed. sufficient space is allocated to the return value to hold the suppressed trailing zeros. if the input parameter d is+infinity,-infinity ornan, *decpt is set to 9999. ...
Function_Name
what the function does (more than just what it returns). syntax #include <headers.h> returntype function_name( paramtype paramname, paramtype paramname, ); parameters paramname sample: in pointer to a certcertdbhandle representing the certificate database to look in paramname sample: in pointer to an secitem whose type must be sidercertbuffer and whose data
contains a der-encoded certificate description long description of this function, what it does, and why you would use it. describe all side-effects on "out" parameters. avoid describing the return until the next section, for example: this function looks in the nsscryptocontext and the nsstrustdomain to find the certificate that matches the der-encoded certificate. a match is found when the issuer and s...
Building NSS
g (non-optimized) version of nss. this is the default. 1 build an optimized (non-debug) version of nss. use_64 0 build for a 32-bit environment/abi. this is the default. 1 build for a 64-bit environment/abi. this is recommended. use_asan 0 do not create an addresssanitizer build. this is the default. 1 create an addresssanitizer build. unit testing nss
contains extensive unit tests. scripts to run these are found in the tests directory. run the standard suite by: host=localhost domsuf=localdomain use_64=1 nss/tests/all.sh unit test configuration nss tests are configured using environment variables. the scripts will attempt to infer values for host and domsuf, but can fail. replace localhost and localdomain with the hostname and domain suffix for yo...
CERT_FindCertByDERCert
certificate in the database that matches a der-encoded certificate. syntax #include <cert.h> certcertificate *cert_findcertbydercert( certcertdbhandle *handle, secitem *dercert ); parameters handle in pointer to a certcertdbhandle representing the certificate database to look in dercert in pointer to an secitem whose type must be sidercertbuffer and whose data
contains a der-encoded certificate description this function looks in the ?nsscryptocontext? and the ?nsstrustdomain? to find the certificate that matches the der-encoded certificate. a match is found when the issuer and serial number of the der-encoded certificate are found on a certificate in the certificate database. returns a pointer to a certcertificate representing the certificate in the datab...
NSS FAQ
im j. hudson. openssl is widely used in apache servers and is licensed under an apache-style licence. nss supports both server and client applications as well as pkcs #11 and s/mime. to permit its use in as many contexts as possible, nss is licensed under the mozilla public license, version 2. how does nss compare to sslref? sslref was an early reference implementation of the ssl protocol. it
contains bugs that were never fixed, doesn't support tls or or the new 56-bit export cipher suites, and does not contain the fix to the bleichenbacher attack on pkcs#1. netscape no longer maintains sslref or makes it available. it was built as an example of an ssl implementation, not for creating production applications. nss was designed from the ground up for use by commercial developers. it provides a...
FIPS Mode - an explanation
t application must do all of its cryptography in a fips-140 certified "device". whether it is hardware or software, that device will have all the cryptographic engines in it, and also will stores keys and perhaps certificates inside. the device must have a way for users to authenticate to it (to "login" to it), to prove to it that they are authorized to use the cryptographic engines and keys it
contains. it may not do any cryptographic operations that involve the use of cryptographic keys, nor allow any of the keys or certificates it holds to be seen or used, except when a user has successfully authenticated to it. if users authenticate to it with a password, it must ensure that their passwords are strong passwords. it must implement the us government standard algorithms (also specified in ot...
Using JSS
from http://ftp.mozilla.org/pub/mozilla.org/security/jss/releases/. setup your runtime environment you need to set some environment variables before building and running java applications with jss. classpath include the path containing the jss classes you built, or the path to jss42.jar. (the path to jss34.jar ends with the string "/jss42.jar". it is not just the directory that
contains jss42.jar.) ld_library_path (unix) / path (windows) include the path to the nspr, nss, and jss shared libraries. initialize jss in your application before calling any jss methods, you must initialize jss by calling one of the cryptomanager.initialize methods. see the javadoc for more details. ...
NSS_3.11.10_release_notes.html
s 3.11.10 requires. nspr 4.7.1 binary distributions are in https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v4.7.1/. bugs fixed the following bugs have been fixed in nss 3.11.10. bug 291384: certutil -k behavior doesn't match usage bug 374247: modutil -disable command not disabling modules' slots bug 384459: certification path validation fails when authority key identifier extension
contains key identifier bug 385946: can't import certificate into cert database in fips mode (certutil). bug 387892: add entrust root ca certificate(s) to nss bug 396999: pk11_authenticate bug 397478: lock from ssl_initsymwrapkeyslock not freed on selfserv shutdown. bug 397486: session cache locks not freed on strsclnt shutdown. bug 398680: assertion botch in ssl3_registerserverhelloextensions...
NSS_3.12.1_release_notes.html
linux x86) fails pairwise consistency test bug 330622: certutil's usage messages incorrectly document certain options bug 330628: coreconf/linux.mk should _not_ default to x86 but result in an error if host is not recognized bug 359302: remove the sslsample code from nss source tree bug 372241: need more versatile form of cert_nametoascii bug 390296: nss ignores subject cn even when san
contains no dnsname bug 401928: support generalized pkcs#5 v2 pbes bug 403543: pkix: need a way to enable/disable aia cert fetching bug 408847: pkix_ocspchecker_check does not support specified responder (and given signercert) bug 414003: crash [[@ cert_decodecertpackage] sometimes with this testcase bug 415167: memory leak in certutil bug 417399: arena allocation results are not checked in pk...
NSS 3.12.4 release notes
itreadwrite(sql:<configdir>) leaves behind a pkcs11.txu file if libnssckbi.so is in <configdir>. bug 495717: unable to compile nss/cmd/certutil/keystuff.c on wince bug 496961: provide truncated hmac support for testing tool fipstest bug 497002: lab required nspr-free freebl changes. bug 497217: the first random value ever generated by the rng should be discarded bug 498163: assert if profile path
contains cyrillic chars. [[@isspace - secmod_argisblank - secmod_arghasblanks - secmod_formatpair - secmod_mknewmodulespec] bug 498509: produce debuggable optimized builds for mozilla on macosx bug 498511: produce debuggable optimized nss builds for mozilla on linux bug 499385: drbg reseed function needs to be tested on post bug 499825: utilrename.h is missing from solaris packages bug 502961: allocator m...
NSS 3.15.1 release notes
the certificate_status handshake message correctly. bug 882829 - on windows, nss initialization fails if nss cannot call the rtlgenrandom function. bug 875601 - secmod_closeuserdb/secmod_openuserdb fails to reset the token delay, leading to spurious failures. bug 884072 - fix a typo in the header include guard macro of secmod.h. bug 876352 - certutil now warns if importing a pem file that
contains a private key. bug 565296 - fix the bug that shlibsign exited with status 0 even though it failed. the nss_survive_double_bypass_failure build option is removed. bugs fixed in nss 3.15.1 https://bugzilla.mozilla.org/buglist.cgi?list_id=5689256;resolution=fixed;classification=components;query_format=advanced;target_milestone=3.15.1;product=nss compatibility nss 3.15.1 shared libraries are...
NSS 3.16.2.3 release notes
ed in the "bugs fixed" section below. distribution information the hg tag is nss_3_16_2_3_rtm. nss 3.16.2.3 requires nspr 4.10.6 or newer. nss 3.16.2.3 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_16_2_3_rtm/src/ new in nss 3.16.2.3 this patch release fixes a bug and
contains a backport of the tls_fallback_scsv feature, which was originally made available in nss 3.17.1. new functionality tls_fallback_scsv is a signaling cipher suite value that indicates a handshake is the result of tls version fallback. new macros in ssl.h ssl_enable_fallback_scsv - an ssl socket option that enables tls_fallback_scsv. off by default. in sslerr.h ssl_error_i...
NSS 3.18 release notes
icknames. the tstclnt test utility program has new command-line options -c, -d, -b and -r. use -c one, two or three times to print information about the certificates received from a server, and information about the locally found and trusted issuer certificates, to diagnose server side configuration issues. it is possible to run tstclnt without providing a database (-d). a pkcs#11 library that
contains root ca certificates can be loaded by tstclnt, which may either be the nssckbi library provided by nss (-b) or another compatible library (-r). new functions in certdb.h sec_checkcrltimes - check the validity of a crl at the given time. sec_getcrltimes - extract the validity times from a crl. in p12.h sec_pkcs12decoderrenamecertnicknames - call an application provided c...
NSS 3.19 release notes
ok for the sqlite library. new functions in cert.h cert_getimposednameconstraints - check if any imposed constraints exist for the given certificate, and if found, return the constraints as encoded certificate extensions. notable changes in nss 3.19 the ssl 3 protocol has been disabled by default. nss now more strictly validates tls extensions and will fail a handshake that
contains malformed extensions (bug 753136). in tls 1.2 handshakes, nss advertises support for the sha512 hash algorithm in order to be compatible with tls servers that use certificates with a sha512 signature (bug 1155922). bugs fixed in nss 3.19 this bugzilla query returns all the bugs fixed in nss 3.19: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format...
NSS 3.24 release notes
te, private key, and other information. in secport.h port_initcheaparena - initializes an arena that was created on the stack. (see portcheaparenapool.) port_destroycheaparena - destroys an arena that was created on the stack. (see portcheaparenapool.) new types in sslt.h sslextraservercertdata - optionally passed as an argument to ssl_configservercert. this struct
contains supplementary information about a certificate, such as the intended type of the certificate, stapled ocsp responses, or signed certificate timestamps (used for certificate transparency). in secport.h portcheaparenapool - a stack-allocated arena pool, to be used for temporary arena allocations. new macros in pkcs11t.h ckm_tls12_mac in secoidt.h sec_oid_tls_...
NSS 3.35 release notes
using nss may explicitly request to use a specific database format, by adding a type prefix to the database directory, provided at nss initialization time. without a prefix, the default database type will be used (dbm in versions prior to 3.35, and sql in version 3.35 and later.) when using the sql type (either explicitly, or because of the new default), with a database directory which already
contains a dbm type database, nss will automatically perform a one time migration of the information contained in the dbm files to the newer sql files. if a master password was set on the dbm database, then the initial migration may be partial, and migration of keys from dbm to sql will be delayed, until this master password is provided to nss. (conversely, nss will never synchronize data from sql to dbm ...
NSS 3.46 release notes
dassy mike kaganski xhimanshuz distribution information the hg tag is nss_3_46_rtm. nss 3.46 requires nspr 4.22 or newer. nss 3.46 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_46_rtm/src/ other releases are available in nss releases. new in nss 3.46 this release
contains no significant new functionality, but concentrates on providing improved performance, stability, and security. of particular note are significant improvements to aes-gcm performance on arm. notable changes in nss 3.46 certificate authority changes the following ca certificates were removed: bug 1574670 - remove expired class 2 primary root certificate sha-256 fingerprin...
NSS Sample Code Utilities_1
port_zalloc(maxpwdfilesize); if (!phrases) { return 0; /* out of memory */ } fd = pr_open(pwfile, pr_rdonly, 0); if (!fd) { fprintf(stderr, "no password file \"%s\" exists.\n", pwfile); port_free(phrases); return null; } nb = pr_read(fd, phrases, maxpwdfilesize); pr_close(fd); if (nb == 0) { fprintf(stderr,"password file
contains no data\n"); port_free(phrases); return null; } if (slot) { tokenname = pk11_gettokenname(slot); if (tokenname) { tokenlen = port_strlen(tokenname); } } i = 0; do { int startphrase = i; int phraselen; /* handle the windows eol case */ while (phrases[i] != '\r' && phrases[i] != '\n' && i < nb)...
Utilities for nss samples
port_zalloc(maxpwdfilesize); if (!phrases) { return 0; /* out of memory */ } fd = pr_open(pwfile, pr_rdonly, 0); if (!fd) { fprintf(stderr, "no password file \"%s\" exists.\n", pwfile); port_free(phrases); return null; } nb = pr_read(fd, phrases, maxpwdfilesize); pr_close(fd); if (nb == 0) { fprintf(stderr,"password file
contains no data\n"); port_free(phrases); return null; } if (slot) { tokenname = pk11_gettokenname(slot); if (tokenname) { tokenlen = port_strlen(tokenname); } } i = 0; do { int startphrase = i; int phraselen; /* handle the windows eol case */ while (phrases[i] != '\r' && phrases[i] != '\n' && i < nb)...
nss tech note3
recognizes various x.509 extensions. the x.509 key usage extension has oid { 2 5 29 0f } encoded in hex as 0x55, 0x1d, 0x0f. if present, this extension directly determines the values of the 8 key usages defined above. if absent, the cert is assumed to be valid for all key usages. the x.509v3 extended key usage extension as oid { 2 5 29 37 } encoded in hex as 0x55, 0x1d, 0x25. that extension
contains a sequence of oids, each of which signifies one or more cert types, depending on the presence or absence of of the true basic constraints extension; that is, the interpretation of the extended key usage extension is controlled by whether the cert is a ca cert, or not. the following table shows the oids recognized in the extended key usage extension, and how they map to cert types and key usages ...
nss tech note6
nss .chk files for the fips 140 mode nss technical note: 6 in nss 3.8, we added checksum files required for the nss softoken to operate in fips 140 mode. the new checksum file is called libsoftokn3.chk on unix/linux and softokn3.chk on windows. it must be put in the same directory as the nss libraries. the libsoftokn3.chk/softokn3.chk file
contains a checksum for the softoken. when in fips 140 mode, the softoken is required to compute its checksum and compare it with the value in libsoftokn3.chk/softokn3.chk. the following applies to nss 3.8 through 3.10 : on 32-bit solaris sparc (i.e., not x86, and not 64-bit sparc) and 32-bit hp-ux pa-risc (i.e., not itanium, and not 64-bit pa-risc), there are two more .chk files: libfreebl_pure32_3.chk and libfreebl_hybrid_3.chk. the following ap...
nss tech note8
the protocol code builds such a structure, and then asks the cache code (client or server) to save the info. the protocol code can also ask to remove a sid from the cache. ...
PKCS11 FAQ
bugs against softoken's non-compliance, but these bugs have lower priority than fixing nss's non-complient uses of pkcs #11 or adding new features to nss. if multiple pkcs #11 modules are loaded, how does nss determine which ones to use for the mechanisms required by ssl? nss uses the first slot it finds that can perform all the required operations. on servers, it's almost always the slot that
contains the server's private key. does nss support the use of pkcs #11 callbacks specified in the pnotify and papplication parameters for c_opensession? nss does not currently use any of the callbacks. nss applications detect card insertion and deletion by means of polling to determine whether the card is still in the slot and whether the open session associated with that card is still valid, or by wa...
PKCS 7 functions
erences. the nss version column indicates which versions of nss support the function. ...
FC_Initialize
tructures, it performs the fips software integrity test and power-up self-tests. the pinitargs argument must point to a ck_c_initialize_args structure whose members should have the following values: createmutex should be null. destroymutex should be null. lockmutex should be null. unlockmutex should be null. flags should be ckf_os_locking_ok. libraryparameters should point to a string that
contains the library parameters. preserved should be null. the library parameters string has this format: "configdir='dir' certprefix='prefix1' keyprefix='prefix2' secmod='file' flags= " here are some examples. nss_nodb_init(""), which initializes nss with no databases: "configdir='' certprefix='' keyprefix='' secmod='' flags=readonly,nocertdb,nomod db,forceopen,optimizespace " mozilla firefox initia...
FC_SetOperationState
phic operation state of a session. syntax ck_rv fc_setoperationstate( ck_session_handle hsession, ck_byte_ptr poperationstate, ck_ulong uloperationstatelen, ck_object_handle hencryptionkey, ck_object_handle hauthenticationkey ); parameters hsession [in] handle of the open session. poperationstate [in] pointer to a byte array containing the operation state. uloperationstatelen [in]
contains the total length (in bytes) of the operation state. hencryptionkey [in] handle of the encryption or decryption key to be used in in a stored session or zero if no key is needed. hauthenticationkey [in] handle of the authentication key to be used in the stored session or zero if none is needed. description fc_setoperationstate restores the cryptographic operations state of a session from an arr...
NSS functions
erences. the nss version column indicates which versions of nss support the function. ...
sslcrt.html
> secstatus nss_cmpcertchainwcanames( certcertificate *cert, certdistnames *canames); parameters this function has the following parameters: cert a pointer to the certificate structure for the certificate whose certificate chain is to be checked. canames a pointer to a structure that
contains a list of distinguished names (dns) against which to check the dns for the signers in the certificate chain. returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. use pr_geterror to obtain the error code. manipulating certificates cert_dupcertificate cert_destroycertificate cert_dupcertificate makes a shallo...
TLS Cipher Suite Discovery
, pruintn len); the application provides the cipher suite number for which it wants information, the address of a block of memory allocated to receive that information, and the size in bytes of that block of memory. ssl_getciphersuiteinfo fills that caller-supplied memory with information from the sslciphersuiteinfo structure for that cipher suite. ...
NSS tools : signver
oded pkcs#7 signed object and verifies the digital signature using standard cryptographic techniques. the signature verification tool can also display the contents of the signed object. options -a displays all of the information in the pkcs#7 signature. -v verifies the digital signature. -d [sql:]directory specify the database directory which
contains the certificates and keys. signver supports two types of databases: the legacy security databases (cert8.db, key3.db, and secmod.db) and new sqlite databases (cert9.db, key4.db, and pkcs11.txt). if the prefix sql: is not used, then the tool assumes that the given databases are in the old format. -a sets that the gi...
Network Security Services
answers basic questions about nss. introduction to public-key cryptography explains the basic concepts of public-key cryptography that underlie nss. introduction to ssl introduces the ssl protocol, including information about cryptographic ciphers supported by ssl and the steps involved in the ssl handshake. getting started nss releases this page
contains information about the current and past releases of nss. get the source code and build it instructions on how to build nss on the different supported platforms. nss apis introduction to network security services provides an overview of the nss libraries and what you need to know to use them. nss ssl public functions summarizes the ssl apis exported by ...
Scripting Java
ava interfaces now that we can access java classes, create java objects, and access fields, methods, and properties of those objects, we have a great deal of power at our fingertips. however, there are a few instances where that is not enough: many apis in java work by providing interfaces that clients must implement. one example of this is the thread class: its constructor takes a runnable that
contains a single method run that will be called when the new thread is started. to address this need, rhino provides the ability to create new java objects that implement interfaces. first we must define a javascript object with function properties whose names match the methods required by the java interface. to implement a runnable, we need only define a single method run with no parameters. if you rem...
SpiderMonkey Build Documentation
emory leaks and other memory-related problems. see js_setgczeal() for details. for a list of other available build options, type (assuming the current working directory is one of the above-created build directories): /bin/sh ../configure.in --help generating a compilation database some tools (like ides, static analyzers and refactoring tools) consume a file called compile_commands.json which
contains a description of all the pieces required to build a piece of software so that tools don't have to also understand a build system. to generate a compile_commands.json with the spidermonkey configure script, enable the compiledb backend, like this: /bin/sh ../configure.in <options> --enable-build-backends=compiledb,recursivemake (recursivemake is there as you'd likely also want to be able to bu...
GCIntegration - SpiderMonkey Redirect 1
r changed after it's initialized, then there's no need for a write barrier. initializing a pointer never requires a write barrier because there was nothing being destroyed that might have part of the initial snapshot. if a pointer is not traced via js_call_tracer or any similar mechanism, then there's no need for a write barrier (although see below about read barriers). the initial snapshot only
contains objects reachable via traced pointers, so there's no danger that overwriting an untraced pointer will disrupt the snapshot. some pointers are guaranteed to be marked in the first slice of the gc. therefore, it's not possible for code to modify them between when the initial snapshot is taken and when the pointer is marked, so no write barrier is needed. many pointers in gecko are traced via ns_de...
Getting SpiderMonkey source code
ory (js/src). hg clone https://hg.mozilla.org/mozilla-central/ cd js/src to avoid getting the full change history, click the zip or gz links at https://hg.mozilla.org/index.cgi/mozilla-central/file/tip. this fetches a snapshot of the current mozilla tree. if you have problems with the instructions above, you can read the full details of using mercurial to get mozilla code here. that page also
contains links to several bundles, which can be useful if you have a poor network connection. getting the latest spidermonkey source code from git the following command line downloads the entire mozilla repository, including the full change history and a lot of gecko and firefox source code that isn't part of spidermonkey. it also changes to the spidermonkey directory (js/src). git clone https://github...
64-bit Compatibility
::insimmf() instead. mucking with native integers in lir the following opcodes can be used to safely load, modify, and compare native integers. for such opcodes there are two forms, an "undecorated" form which is 32-bit, and a form decorated with a "q" or "qi" that is 64-bit. to make it easier to generate platform specific code, these opcodes have aliases decorated with a "p". ...
Statistics API
ng the jetpack framework. var prefs = require("api-utils/preferences-service"); components.utils.import('resource://gre/modules/services.jsm'); function observer(subject, topic, json) { var data = json.parse(json); // process the data } prefs.set("javascript.options.mem.notify", true); services.obs.addobserver(observer, "garbage-collection-statistics", false); the toplevel json object
contains these fields: timestamp: integer (microseconds) - time at which the gc ended, measured from epoch. total_time: number (milliseconds) - the amount of wall time that this gc consumed. note: this is the sum of all the slice durations, not end time - start time. compartments_collected: integer - the number of compartments that were collected by the gc. compartment_count: integer - the number o...
Invariants
d. javascript is only mostly lexically scoped. some nameexpressions might refer to a variable or global; or might at runtime turn out to reference another object property, due to with, or a variable that isn't in the source code at all but was injected into a local scope by eval. these cases can be detected statically by looking for with and eval "nearby" in the parse tree.) if a nested function
contains a nameexpression that refers to a variable in an enclosing scope which the function can outlive (i.e. the function can be called after control exits that enclosing scope) then upvar instructions cannot be used for that nameexpression. (wrong results or a potentially exploitable crash. the upvar ops depend on a per-context display of currently active stack frames. once the enclosing stack frame is...
Self-hosted builtins in SpiderMonkey
sage is specified in js.msg and can be localized. the makeconstructible function described above. the file utilities.js provides some additional, js-implemented helper functions. of note, it provides implementations of list and record, types defined in the ecmascript specifications that are similar to array and object, but can't be modified by application code. the selfhostingdefines.h header
contains adding self-hosted functions to host objects first, the code has to be embedded into spidermonkey. the easiest way to accomplish that is to add the code to a pre-existing .js file in builtin/. if it doesn't fit into any of those, create a new .js file in that directory and add it to the selfhosted.inputs list in moz.build. to add a self-hosted function as a method to a host object, add it to t...
JIT Optimization Outcomes
ion call. the interpreted callee function either has too many parameters or is called with too many arguments. these thresholds are subject to change. cantinlinerecursive unable to inline function call. the interpreted callee function recurs for more than one level. the first level of recursion is inlinable. cantinlineheavyweight unable to inline function call. the interpreted callee function
contains variables bindings that are closed over. for example, function f() { var x; return function () { x++; } } closes over x in f. cantinlineneedsargsobj unable to inline function call. the interpreted callee function requires an arguments object to be created. cantinlinedebuggee unable to inline function call. the interpreted callee function is being debugged by the debugger api. cantinlineunkno...
JSAPI Cookbook
basics working with values the basic, undifferentiated value type in the jsapi is js::value. ...
JS::Compile
ining the text of the script. filename is the name of the file (or url) containing the script. this information is included in error messages if an error occurs during compilation.. on success, js::compile stores an object representing the newly compiled script into script, and returns true. otherwise, it returns false and the value left in script is undefined. see also the jsapi user guide
contains example code using compiled scripts. mxr id search for js::compile js::evaluate js::compileoffthread js::compilefunction js_decompilescript bug 771705 bug 1143793 -- removed obj parameter ...
JS::CompileFunction
arguments specified in nargs. chars, bytes, or srcbuf is a string containing the source code of the function. length is the length of the source code in characters. on success, js::compilefunction stores an function object representing the newly compiled function into fun and and returns true. otherwise, it returns false and the value left in fun is undefined. see also the jsapi user guide
contains example code using compiled scripts. mxr id search for js::compilefunction js::evaluate js::compile js::compileoffthread js_executescript js_decompilescript bug 771705 ...
JS::CompileOffThread
s::finishoffthreadscript must be invoked on the main thread to get the result script or nullptr. if maybecx is not specified, the resources will be freed, but no script will be returned. the characters passed in to js::compileoffthread must remain live until the callback is invoked, and the resulting script will be rooted until the call to finishoffthreadscript. see also the jsapi user guide
contains example code using compiled scripts. mxr id search for js::compileoffthread js::evaluate js::compile js::compilefunction js_decompilescript bug 897655 ...
JSErrorReport
for cross-origin scripts, and it will be propagated appropriately to child scripts and passed back in jserrorreports. linebuf const char * text of the line that caused the error, minus the trailing newline character. tokenptr const char * pointer to the error token in *linebuf. uclinebuf const char16_t * unicode line buffer. this is the buffer that
contains the original data. uctokenptr const char16_t * pointer to the error token in *uclinebuf. flags unsigned the logical or of zero or more of the following flags: jsreport_warning this "error" is really only a warning. it will not cause the current operation to fail. jsreport_exception an exception is being raised...
JSExtendedClass
ityop equality; jsobjectop outerobject; jsobjectop innerobject; jsiteratorop iteratorobject;// added in spidermonkey 1.8 jsobjectop wrappedobject; // added in spidermonkey 1.8 ...and additional reserved fields. }; name type description base jsclass the basic class information and callbacks for this class. this
contains some required fields. equality jsequalityop optional. overrides the javascript == and != operators. outerobject jsobjectop optional. return the current outer object. this is used to implement split objects. innerobject jsobjectop optional. return the current inner object. this is used to implement split objects. iteratorobject jsiteratorop ...
JSExtendedClass.wrappedObject
objects of that class may be wrappers. in a few cases the javascript engine will pretend the wrapper isn't there, instead operating on the object it wraps. in these cases the engine calls the jsextendedclass.wrappedobject callback to get the wrapped object. most classes do not implement wrappedobject. the specific cases where this happens are: the default tostring method returns a string that
contains the name of the wrapped object's class rather than the wrapper's class. in typeof expressions and in js_typeofvalue, the type of the wrapped object is returned. (the result may be "object", "function", or "xml".) when assigning to __proto__ or __parent__ from script, the javascript engine checks to see if the assignment would produce a cycle. if so, it fails with an exception. when walkin...
JSFunction
de containing function declarations or function-expressions-the relationship between the jsfunction * and the jsobject * is not well-defined. different closures (function objects) generated from the same source code may share the same jsfunction. as a result, some apis (such as js_callfunction) that operate on jsfunctions do not work properly with closures. the documentation for each affected api
contains a warning about the problem. if the application can't be sure that a given function jsobject is either native or jsapi-compiled, it must not use the affected apis. instead of using js_callfunction, for example, it must call js_callfunctionvalue. function objects created by calling js_newfunction have two reserved slots for the application's use. see js_newfunction for details. see also mxr id s...
JSGetObjectOps
bject. description jsobjectops is used by js_newobject's internals to discover the set of high-level object operations to use for new objects of the given class. all native objects have a jsclass, which is stored as a private (int-tagged) pointer in object slots. in contrast, all native and host objects have a jsobjectmap at obj->map, which may be shared among a number of objects, and which
contains the jsobjectops *ops pointer used to dispatch object operations from api calls. thus jsclass (which pre-dates jsobjectops in the api) provides a low-level interface to class-specific code and data, while jsobjectops allows for a higher level of operation, which does not use the object's class except to find the class's jsobjectops struct, by calling clasp->getobjectops, and to finalize the object...
JSRuntime
untime is the top-level object that represents an instance of the javascript engine. a program typically has only one jsruntime, even if it has many threads. the jsruntime is the universe in which javascript objects live; they can't travel to other jsruntimes. all javascript code and most jsapi calls run within a jscontext. the jscontext is a child of the jsruntime. a context can run scripts. it
contains the global object and the execution stack. exception handling, error reporting, and some language options are per-jscontext. once created, a context can be used any number of times for different scripts or jsapi queries. for example, a browser might create a separate context for each html page; every script in the page could use the same context. objects may be shared among jscontexts within a j...
JSVAL_IS_NULL
determine if a given jsval is null. syntax jsval_is_null(v) description jsval_is_null(v) is true if v is jsval_null, which is the javascript null value. (note: jsval_is_object(jsval_null) is also true.) example the following code snippet illustrates how a javascript variable, myitem, is conditionally tested in an if statement to see if it
contains a null value. if (jsval_is_null(myitem)) { ... } see also bug 952650 ...
JS_CompileFunctionForPrincipals
eno unsigned int line number. used to report the offending line in the file or url if an error occurs. description js_compilefunctionforprincipals compiles a security-enabled function from a text string, bytes, and associates it with a js object, obj. js_compileucfunctionforprincipals is the unicode version of the function. principals is a pointer to the jsprincipals structure that
contains the security information to associate with this function. name is the name to assign to the newly created function. nargs is the number of arguments the function takes, and argnames is a pointer to the first element of an array of names to assign each argument. the number of argument names should match the number of arguments specified in nargs. body is the string containing the source code of ...
JS_CompileScript
pt is associated with a js object. ascii and chars are the string containing the text of the script. length indicates the size of the text version of the script in characters. on success, js_compilescript and js_compileucscript stores the newly compiled script to *script and returns true. otherwise, they report an error, stores null to *script, and return false. see also the jsapi user guide
contains example code using compiled scripts. mxr id search for js_compilescript mxr id search for js_compileucscript js::evaluate js::compileoffthread js::compilefunction js_executescript js_decompilescript bug 1143793 -- removed obj parameter ...
JS_CompileScriptForPrincipals
ending line in the file or url if an error occurs. version jsversion javascript version for the script. description js_compilescriptforprincipals compiles a security-enabled script, src, for execution. js_compileucscriptforprincipals is the unicode version of the function. the script is associated with a js object. principals is a pointer to the jsprincipals structure that
contains the security information to associate with this script. src is the string containing the text of the script. length indicates the length of the script, in characters. filename is the name of the file (or url) containing the script. this information is included in error messages if an error occurs during compilation. similarly, lineno is used to report the line number of the script or file where...
JS_CompileUTF8File
js_compileutf8file compiles the text of script in an external file location for execution by the js engine. filename is the name of the file containing the script to compile. on success, js_compileutf8file returns an object that represents the newly compiled script. otherwise it returns null. js_compileutf8file is deprecated, use file, use js::compile instead. see also the jsapi user guide
contains example code using compiled scripts. mxr id search for js_compilefile js::compile js_decompilescript js::evaluate js_executescript bug 805080 ...
JS_ConvertValue
stype_boolean. otherwise js_convertvalue reports an error. vp js::mutablehandlevalue out parameter. on success, *vp receives the converted value. description js_convertvalue converts a javascript value, v, to the specified type. on success, the converted value is stored in *vp. typically users of this function set vp to point to v, so that if conversion is successful, v now
contains the converted value. js_convertvalue calls other, type-specific conversion routines based on the type argument. converting any value to jstype_void always succeeds. the result is undefined value. converting to jstype_object works exactly like js::toobject if v.isnullorundefined() is false, otherwise the result is nullptr. converting to jstype_function works like js_valuetofunction, but bett...
JS_DecompileFunction
nction's compiled form, fun. if successful, js_decompilefunction returns a string containing the text of the function. otherwise, it returns null. if you decompile a function that does not make a native c call, then the text created by js_decompilefunction is a complete function declaration suitable for re-parsing. if you decompile a function that makes a native c call, the body of the function
contains the text "native code'" and cannot be re-parsed. see also mxr id search for js_decompilefunction js_decompilescript js_callfunction js_callfunctionname js_callfunctionvalue js_compilefunction js_decompilefunctionbody js_definefunction js_definefunctions js_getfunctionobject js_newfunction js_setbranchcallback js_valuetofunction ...
JS_DecompileFunctionBody
tion's compiled form, fun. if successful, js_decompilefunctionbody returns a string containing the source code of the function body. otherwise, it returns null. the source code generated by this function is accurate but unadorned and is not suitable for recompilation without providing the function's declaration. if you decompile a function that makes a native c call, the body of the function only
contains the text "[native code]". notes to decompile a complete function, including its body and declaration, call js_decompilefunction instead. see also mxr id search for js_decompilefunctionbody js_decompilescript js_callfunction js_callfunctionname js_callfunctionvalue js_compilefunction js_decompilefunction js_definefunction js_definefunctions js_getfunctionobject js_newfunction js_setbr...
JS_DefineConstDoubles
y set to jsprop_permanent | jsprop_readonly. cds and cis are pointers to the first element of an array of jsconstdoublespec/jsconstintegerspec structures. each array element defines a single property name and property value to create. the name field of the last element of the array must contain 0. js_defineconstdoubles/js_defineconstintegers create one property for each element in the array what
contains a non-zero name field. on success, js_defineconstdoubles/js_defineconstintegers returns true, indicating it has created all properties listed in the array. otherwise it returns false. see also mxr id search for js_defineconstdoubles mxr id search for js_defineconstintegers jsconstdoublespec jsconstintegerspec js_defineelement js_defineproperties js_defineproperty js_definepropertywithtin...
JS_DefineElement
t being defined. value is one of js::value, jsobject, jsstring, int32_t, uint32_t, or double that defines the property's initial value. getter and setter identify the getproperty and setproperty methods for the property, respectively. if you pass null values for these entries, js_defineelement assigns the default getproperty and setproperty methods to this element. obsolete since jsapi 32 flags
contains the property attributes to set for the new property. on success, js_defineelement returns true. otherwise it returns false. obsolete since jsapi 32. while you can assign a setproperty method to a property and set flags to jsprop_readonly, the setter method will not be called on this property. see also mxr id search for js_defineelement js_defineconstdoubles js_definefunction js_definefunc...
JS_DefineObject
js::handleobject prototype object to use for the new object, or null. obsolete since jsapi 38 flags unsigned property attributes for the new property being defined. description js_defineobject creates a new object of the class clasp and assigns it to a new property of an existing object, obj. name is the property name to assign to obj to hold the new object, and flags
contains the property attributes to set for the newly created property. the new object's parent is obj. js_defineobject does not call clasp->constructor. initialization of the new object is up to the caller. on success, js_defineobject returns a pointer to the new object. on error or exception (if the object cannot be created, the property already exists, or the property cannot be created), js_defineob...
JS_DumpHeap
key 1.8 debug only. dump the object graph of heap-allocated things. syntax bool js_dumpheap(jsruntime *rt, file *fp, void* startthing, jsgctracekind kind, void *thingtofind, size_t maxdepth, void *thingtoignore); name type description cx jscontext * pointer to a js context. every jscontext is permanently associated with a jsruntime; each jsruntime
contains a gc heap. fp file * file for the dump output. startthing void * null or a pointer to a gc thing (use js::value::togcthing() to obtain a pointer to pass here). when null, dump all things reachable from the runtime roots. when non-null, dump only things reachable from the object indicated. startkind jsgctracekind trace kind of startthing, if startthing ...
JS_EncodeCharacters
ted bytes for something. */ ... /* remember to free the bytes afterwards. */ js_free(cx, dst); return js_true; on success, js_encodecharacters sets *dstlenp to the real result length and returns js_true. otherwise it reports an error and returns js_false. this happens if the destination is too small for the resulting string or if the source buffer isn't proper utf-16 because it
contains unpaired surrogate values. the user is responsible for allocating and freeing the memory of the destination string. js_encodecharacters never adds a trailing null character. to obtain a null-terminated string, allocate an extra byte for the null character and set it manually. to convert bytes to jschars, the opposite conversion, use js_decodebytes. to convert a jsstring to a c char string, use js...
JS_EvaluateScriptForPrincipals
ss, *rval receives the value from the last-executed expression statement in the script. version jsversion javascript version for the script. description js_evaluatescriptforprincipals compiles and executes a script in the specified scope, obj. js_evaluateucscriptforprincipals is the unicode version of the function. principals is a pointer to the jsprincipals structure that
contains the security information to associate with this script. src is the string containing the text of the script. length is the length of the script, in characters. filename is the name of the file (or url) containing the script. this information is used in messages if an error occurs during compilation. similarly, lineno is used to report the line number of the script or file where an error occurre...
JS_ExecuteRegExp
handlevalue rval); name type description cx jscontext * the context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject a pointer to a global object. reobj js::handleobject a pointer to a regexp object. chars const char16_t * a pointer to the string
contains a input string. length size_t the length of bytes or chars, in characters. indexp size_t * in/out parameter. a pointer to the lastindex for the execution, and received the updated lastindex. test bool pass true to avoid creating match result array and store boolean value to rval. rval js::mutablehandlevalue out parameter. receives the re...
JS_ExecuteScript
tescript handles a cross-compartment script. if the script is cross-compartment, it is cloned into the current compartment before executing. if the script executes successfully, rval receives the value from the last executed expression statement processed in the script, and js_executescript returns true. otherwise it returns false, and the value left in rval is unspecified. the jsapi user guide
contains example code using compiled scripts. to execute a script that has not been compiled, use js::evaluate instead. see also mxr id search for js_executescript mxr id search for js::cloneandexecutescript js::compile js::evaluate bug 993438 bug 1145294 -- removed obj from js::cloneandexecutescript. bug 1097987 -- removed obj from js_executescript ...
JS_GetFunctionObject
o js_compilefunction or similar functions. in other cases, the object returned by js_getfunctionobject is not necessarily safe to call and should not be exposed to script. in the javascript language, functions are objects. but in the jsapi there are two separate concepts: a jsobject is what is exposed to scripts and has properties and can be stored in variables; and the corresponding jsfunction
contains the code of a function. for certain functions, the two have a strictly one-to-one relationship, and for those functions it is safe to call js_getfunctionobject to move from the jsfunction to the jsobject. however, for other functions, and particularly for javascript closures, many jsobjects may share the same jsfunction. in these cases, this function should not be called. calling the jsobject re...
JS_NewDependentString
aller must be in a request on this jscontext. str js::handlestring the string containing the characters for the new string. start size_t the start index of the substring. length size_t length of the substring, in characters. description js_newdependentstring creates a new string as a substring of an existing javascript string, str. the new string
contains the same characters as if it were created with the javascript method str.substr(start, length). the characters are not copied. instead, the new string shares str's existing character storage. (implementation note: because of this sharing, the garbage collector will not collect str as long as the new substring is reachable.) on success, js_newdependentstring returns a pointer to the new string. ot...
JS_NewRegExpObject
unsigned flags); name type description cx jscontext * the context in which to create the new object. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject a pointer to a global object. bytes or chars const char * or const char16_t * a pointer to the string that
contains a regular expression. length size_t the length of bytes or chars, in characters. flags unsigned regular expression flags. see below. flags name description regexp constructor flag jsreg_fold fold uppercase to lowercase. i jsreg_glob global execution, creates array of matches. g jsreg_multiline treat ^ a...
JS_NewScriptObject
turns null. (the name "js_newscriptobject" suggests that the script object is freshly allocated; this was the case in older versions of the api, but now the script object is allocated along with the jsscript itself.) (some temporary scripts used internally by spidermonkey do not have script objects allocated for them; such scripts are not accessible via jsapi.) see also the jsapi user guide
contains example code using compiled scripts. mxr id search for js_newscriptobject bug 630209 ...
JS_NewStringCopyN
allocates space for a javascript string and its underlying storage, and copies n characters from a c character array, s, into the new jsstring. js_newucstringcopyn is the unicode version of the function. the two functions differ only in the type of the character array s; both functions create ordinary javascript strings, and all javascript strings are made up of 16-bit characters. if the array s
contains more than n characters, the new string
contains a truncated version of the original string. the string may contain null characters ('\0'). they are copied into the new string like any other character. you can use js_newstringcopyn to copy binary data or to copy only a certain portion of a c string into a javascript string. on success, js_newstringcopyn and js_newucstringcopyn return a pointer to ...
JS_SetPrivate
rivate sets an object's private data field. obj must be an instance of a class that has the jsclass_has_private flag. only the pointer is stored. memory management of this field is the application's responsibility. the javascript engine never uses it. in particular: if you allocate memory for private data, you must free it, typically in a jsclass.finalize callback. if your class's private data
contains any jsvals or other references to javascript objects, implement the jsclass.mark callback to ensure they are not prematurely reclaimed by the garbage collector. use js_getinstanceprivate to safely extract the private data from an object. (see the warning at js_getprivate.) never use js_setprivate on an instance of a class you don't own. that object may already be using the private data field for...
SpiderMonkey 1.8.5
the mozilla javascript team is pleased to announce the release of spidermonkey 1.8.5. you can download full source code here: http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz (md5 checksum: a4574365938222adca0a6bd33329cb32). spidermonkey 1.8.5 is the javascript engine that shipped in firefox 4.0. it is much faster than spidermonkey 1.8, implements es-5 (ecma 262, 5th edition), and
contains many new language and api features, described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or, file bugs at bugzilla.mozilla.org under product: core, component: javascript engine. —22 march 2011 platform support spidermonkey 1.8.5 is supported on all the platforms where firefox 4 runs. spidermonkey 1.8.5 ...
SpiderMonkey 1.8.7
g the mozilla javascript team is pleased to announce the release of spidermonkey 1.8.5. you can download full source code here: http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz (md5 checksum: a4574365938222adca0a6bd33329cb32). spidermonkey 1.8.5 is the javascript engine that shipped in firefox 4.0. it is much faster than spidermonkey 1.8, implements es-5 (ecma 262, 5th edition), and
contains many new language and api features, described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or, file bugs at bugzilla.mozilla.org under product: core, component: javascript engine. —22 march 2011 platform support spidermonkey 1.8.7 is supported on all the platforms where firefox 10 runs. spidermonkey 1.8.7...
SpiderMonkey 1.8
the mozilla javascript team is pleased to announce the release of spidermonkey 1.8 release candidate 1. you can download full source code here: http://ftp.mozilla.org/pub/mozilla.org/js/js-1.8.0-rc1.tar.gz (md5 checksum: eaad8815dcc66a717ddb87e9724d964e). spidermonkey 1.8 is the javascript engine that shipped in firefox 3.0. it is much faster than spidermonkey 1.7 and
contains a few new language features and api features, described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or, file bugs at bugzilla.mozilla.org under product: core, component: javascript engine. —9 march 2009 known issues spidermonkey 1.8 has one known significant regression from 1.7. in js_threadsafe builds, some objects are not ...
SpiderMonkey 24
u can download full source code here: https://ftp.mozilla.org/pub/mozilla.org/js/mozjs-24.2.0.tar.bz2 (sha1: ce779081cc11bd0c871c6f303fc4a0091cf4fe66) spidermonkey 24 is the javascript engine that shipped in firefox 24. it continues to improve performance over previous spidermonkey releases, with a significantly improved garbage collector, a new jit compilation mode, and other features. it also
contains new language and api features described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: javascript engine. — dec 16, 2013 the download url still available, but spidermonkey not release alone! get it here mozilla-esr24 if the download url ...
SpiderMonkey 31
these release notes are incomplete. the mozilla javascript team is pleased to announce the release of spidermonkey 31. spidermonkey 31 is the javascript engine that shipped in firefox 31. it continues to improve performance over previous spidermonkey releases, with a significantly improved garbage collector and other features. it also
contains new language and api features described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: javascript engine. the download url is outdated and spidermonkey not release alone! get it here mozilla-esr31 you will find it in "firefox extended support release 31" package on hg release platform support ...
SpiderMonkey 52
you can download full source code from treeherder, by going to the mozilla-esr52 repository and clicking on the first sm(pkg) link you see. that will open a small window in the bottom left with a line like "artifact uploaded:mozjs-52.x.y.tar.bz2". spidermonkey 52 is the javascript engine that shipped in firefox 52. it continues to improve performance over previous spidermonkey releases. it also
contains new language and api features described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: javascript engine. you may wish to make the bugs block bug 837921 (aliased as "sm.embedding"). platform support migrating to spidermonkey 52 new javasc...
Shell global objects
list overlaps with "built-in functions" in introduction to the javascript shell and is probably not complete. see js/src/shell/js.cpp (around shell_functions) for more. this page lists variables and functions available on spidermonkey 53. there may be some difference between each versions. you can get the list of functions by help() function in js shell. variables scriptargs an array that
contains arguments passed to js shell. scriptpath a string that is a path of script. console an object that has following property: log evaluate and print expressions to stdout. this function is an alias of the print() function. timesaccessed returns a number that indicates how many times this variable is accessed perfmeasurement see perfmeasurement.jsm. shell only functions functions...
Redis Tips
rint(err, results) { console.log(json.stringify(results, null, 2)) } whenever someone logs into my site, i record them in my 'last-login' zset. i'll simulate some logins like so: > r.zadd('last-login', now(), 'lloyd'); > r.zadd('last-login', now(), 'jparsons'); > r.zadd('last-login', now(), 'zarter'); > r.zadd('last-login', now(), 'lloyd'); // he logged in again! w00t! here's what the zset
contains now: > r.zrange('last-login', 0, -1, print); // remember, i defined 'print' above ["jparsons", "zcarter", "lloyd"] since this is a set, lloyd only appears once, with updated login timestamp. zrange gives you everything in the zset, in order of score, from the beginning offset to the end offset. (0 from the front, -1 from the end.) as you can see, the scores are sorted smallest to bigges...
A Web PKI x509 certificate primer
-sign the certificate with a standardized certificate signing algorithm sec_error_invalid_time a time field in a certificate has an invalid value re-generate the certificate with valid encodings for time fields mozilla_pkix_error_key_pinning_failure sec_error_path_len_constraint_invalid sec_error_unknown_critical_extension a certificate
contains an extension marked as critical that is not handled by mozilla::pkix re-generate the certificate without the extension or with it not marked as critical sec_error_unknown_issuer either a missing intermediate or root certificate is necessary to verify the certificate import the root certificate into firefox or have the server send the intermediate sec_error_invalid_key ...
Setting up an update server
aded the mar you're using, you'll find the sha512 value in a file called sha512sums in the root of the release directory on archive.mozilla.org for a release or beta build (you'll have to search it for the file name of your mar, since it includes the sha512 for every file that's part of that release), and for a nightly build you'll find a file with a .checksums extension adjacent to your mar that
contains that information (for instance, for the mar file at https://archive.mozilla.org/pub/firefox/nightly/2019/09/2019-09-17-09-36-29-mozilla-central/firefox-71.0a1.en-us.win64.complete.mar, the file https://archive.mozilla.org/pub/firefox/nightly/2019/09/2019-09-17-09-36-29-mozilla-central/firefox-71.0a1.en-us.win64.checksums
contains the sha512 for that file as well as for all the other win64 files t...
Signing Mozilla apps for Mac OS X
signature to an application bundle. the man page for codesign is available online, or you can simply type "man codesign" in a terminal window. the main options of note are: -s your-signing-identity lets you specify the signing certificate you want to sign the application with your-signing-identity is the name of your certificate. --keychain /path/to/keychain lets you specify which keychain
contains the signing certificate specified by your-signing-identity, rather than allowing the codesign to search the keychain list. the path specified must be a full path; it's usually something similar to /users/username/library/keychains/keychain-name.keychain. --resource-rules /path/to/coderesources specifies a file to use when generating the rules to be applied to the code signing. when you're signi...
Animated PNG graphics
'fdat' for first frame ... ... decoders must treat out-of-order apng chunks as an error. apng-aware png editors should restore them to correct order using the sequence numbers. 'actl': the animation control chunk the 'actl' chunk is an ancillary chunk as defined in the png specification. it must appear before the first 'idat' chunk within a valid png stream. the 'actl' chunk
contains: byte offset field name field type description 0 num_frames unsigned int the number of frames in the apng. 4 num_plays unsigned int the number of times to loop this apng. 0 indicates infinite looping. num_frames indicates the total number of frames in the animation. this must equal the number of 'fctl' chunks. 0 is not a valid value. 1...
Gecko object attributes
er object currently marked as busy, once it is no longer busy. this is especially important in atomic regions. the entire atomic region should be presented once when it is finally no longer busy. see the live region support for more information. container-live interruption policy. see the live region support for more information. container-live-role indicates the role for the live region that
contains the current accessible object. container-relevant what types of mutations are possibly relevant? see the live region support for more information. event-from-input was the root cause of this event explicit user input? see the live region support for more information. member-of points to the root of the atomic container that this object is in. this will always be an ancestor of the current o...
ROLE_TABLE
also refer to the following roles: role_columnheader, role_rowheader, role_column, role_row, role_cell. ...
Places utilities for JavaScript
marks or items that should load in the sidebar automatically. description_anno - this annotation stores description information about a bookmark. post_data_anno - i need to clarify here, but i think this is the name of the annotation that stores information for keyword searches from a bookmark. lmanno_feeduri - need to clarify here too, but i think for each livemark, there is an bookmark which
contains an annotation storing the associated feed uri. lmanno_siteuri - need to clarify here, but i think for each livemark, there is an bookmark which
contains an annotation storing the associated site uri. organizer_folder_anno - this annotation is associated with a folder that should be shown in the library's left pane. organizer_query_anno - this annotation is used by the places organizer to decid...
Retrieving part of the bookmarks tree
lso get folder ids from a previous query. this example will get the id of the bookmarks toolbar: var bookmarksservice = components.classes["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(components.interfaces.nsinavbookmarksservice); var toolbarfolder = bookmarksservice.toolbarfolder; the placesroot is the root folder in the whole places hierarchy. it
contains administrative data as well as user data, and is therefore not recommended for use in querying. configure the query to get a hierarchical bookmarks result, pass the folder id to setfolders in your query object: query.setfolders([toolbarfolder], 1); run the query the executequery and executequeries functions will return an nsinavhistoryresult object containing the results of your query: var resul...
The Publicity Stream API
ts if the activity is successfully posted. onerror is an error callback that will be invoked if the publicity fails. possible error codes include: denied - if the user refuses to publicize the activity permissiondenied - if the publicizing site is not allowed to post to the publicity stream networkerror - if the publicity server is unreachable activityparseerror - if the activity
contains syntax errors (not proper json) invalidactivity - if the activity
contains semantic errors (i.e. missing required properties) finally, the publicizeactivity() function will throw an exception if required arguments are missing, or if unsupported arguments are present. getpublicitystream( onsuccess: <function>, { [ onerror: <function> ], [ for_apps: <list> ], [ since: <date> ], [ befo...
extIApplication
astring the id of the application. name readonly attribute astring the name of the application. version readonly attribute astring the version number of the application. console readonly attribute exticonsole the console object for the application. extensions readonly attribute extiextensions the extensions object for the application.
contains a list of all installed extensions. not available anymore on gecko 2.0 (see [1]), use getextensions() instead obsolete since gecko 2.0 prefs readonly attribute extipreferencebranch the preferences object for the application. defaults to an empty root branch. storage readonly attribute extisessionstorage the storage object for the application. events reado...
XML Extras
not as just another document format. the module is structured as a drop-in component and exposes its xml-as-data features both to javascript and c++/xpcom users. the xml extras module is built by default on all platforms, and is included in the browser installers so it is available in the nightly builds. feature status feature status xmlserializer available xmlhttprequest available domparser (string and stream input source) available web services with soap and wsdl no longer available from gecko 1.9/firefox 3. ...
How to build an XPCOM component in JavaScript
rces xpidlsrcs = \ helloworld.idl \ $(null) include $(topsrcdir)/config/rules.mk xpidl_flags += \ -i$(topsrcdir)/dom/interfaces/base \ -i$(topsrcdir)/dom/interfaces/events \ $(null) creating the component using xpcomutils in firefox 3 and later you can use import xpcomutils.jsm using components.utils.import to simplify the process of writing your component slightly. the imported library
contains functions for generating the module, factory, and the nsgetmodule and queryinterface functions for you. note: it doesn't do the work of creating your interface definition file or the type library for you, so you still have to go through those steps above if they haven't been done. the library provides a simple example of its use in the source code (js/xpconnect/loader/xpcomutils.jsm), but here's ...
Building the WebLock UI
in gecko, css is used to do virtually all of the presentation of the xul interface - its color, position, style, and to some extent its behavior as well. the web lock manager dialog does not deviate from the look of a standard dialog, so it can use a single declaration to import the "global" s...
Component Internals
he next section, we'll be writing the code that actually compiles into a component library, and you will see how each layer is implemented and how each interface is used. following this initial, verbose demonstration of the apis, we will introduce a faster more generic way of implementing the module and factory code using macros, which can make components much easier to create. xpcom glue xpcom
contains a lot of stuff. most xpcom interfaces are not frozen and are only meant to be used by the gecko internals and not by clients. xpcom provides many data structures from linked lists to avl trees. it's tempting to reuse nsvoidarray or another publicly available class instead of writing your own linked list, but this may prove to be a fatal mistake. the class can change at any time and give you unexp...
Packaging WebLock
hich the installable files appear and call registration methods that tell mozilla about the new component and the ui it uses to access the weblock component. weblock installation script is the completetrigger installation script, which can be launched from a web page. the files themselves are stored in the jar file weblock.jar, which is simple a zip file with the xpi extension that sometimes also
contains an internal installation file called install.js. once you have the component and the other resources for weblock packaged properly (see the following section, archiving resources), the installation script for weblock is a simple one (see the weblock installation script). archiving resources once you have compiled all the resources that make up the weblock component and the files that make up t...
Setting up the Gecko SDK
fig.h lists all of the defines used in the sdk. including this header file in your project ensures that the component you create uses the same defines as the gecko libraries themselves. note that mozilla-config.h may be need to be included before other includes in your component's source code. each module directory is divided into three subdirectories: module subdirectories the bin directory
contains static libraries, dynamic libraries, and in some cases tools that may be useful in development. the idl directory
contains the public idl files exported by the module. the includes directory
contains c++ header files used by your component. xpcom exports a number of binaries that should be mentioned at this point. the table below refers to the windows file names for the executables. ap...
How to build a binary XPCOM component using Visual Studio
or your xulrunner release use a microsoft compiler use pre-built glib-1.2.dll & libidl-0.6.dll libraries from wintools.zip download the sample project here is what the folder structure looks like: create a vc++ project visual studio project and file templates (or wizards) for creating xpcom modules and components do not currently exist. for now, you can use the included xpcom project that
contains a simple xpcom component. you can use the project as a starting point and modify the component files to add your own functionality. to make the project, you start with a standard multi-thread dll project. then make the following tweaks: add "..\gecko-sdk\include" to additional include directories add "..\gecko-sdk\lib" to additional library directories add "nspr4.lib xpcom.lib xpcomglue_s.lib...
Interfacing with the XPCOM cycle collector
_map_segue_cycle_collection(nsfoo) ns_interface_map_end change the line ns_impl_addref(nsfoo) to ns_impl_cycle_collecting_addref(nsfoo) in nsfoo.cpp, and similarly change the line ns_impl_release(nsfoo) to ns_impl_cycle_collecting_release(nsfoo) in nsfoo.cpp. add the appropriate ns_impl_cycle_collection_# macro, where # is the number of member variables in your class. for instance, if nsfoo
contains two member variables, mbar and mbaz, we'd add ns_impl_cycle_collection_2(nsfoo, mbar, mbaz) in nsfoo.cpp. it is possible that your class has more complicated structure than this picture. for example, your class may have multiple nsisupports base classes, which requires the use of some *_ambiguous macros that perform a disambiguating downcast. or your class may have a complicated ownership struc...
Components.lastResult
a local variable to test its value rather than doing multiple tests against components.lastresult. this is because many 'components' properties and methods are themselves implemented using xpconnect and subsequent calls to components.lastresult might reflect the result of 'implicit' xpconnect calls rather than the result of the target call. example in the following example, the local variable i
contains the actual result returned by bar() (assuming that bar() is called via xpconnect), and components.lastresult
contains the success code returned by bar(). // given that foo.bar is a method that might return // the success codes ns_ok, '5', and '6' or some error code... try { var i = foo.bar(); switch (components.lastresult) { case components.results.ns_ok: // ns_ok is good! ...
Components.utils.Sandbox
need to consider the security implications of the functions you import. this technique isn't limited to functions - it can be used to import objects or values. freeing the sandbox when you have finished using a sandbox, it should be freed to avoid memory leaks. generally the javascript garbage collector will take care of this when there are no remaining references to the sandbox or the code it
contains. however, in some cases it can be difficult to remove all references. for example, the code in the sandbox might be a third-party library that sets expando properties or adds event listeners to a window. in this case, components.utils.nukesandbox can be used to force the sandbox to be freed immediately. example executing in current tab scope more ways to load scripts into a sandbox can be foun...
Components.utils.evalInWindow
as well, of course: // add-on-script.js components.utils.evalinwindow("somelocalvariable.newprop = 42", contentwindow); // page-script.js console.log(window.somelocalvariable.newprop); // 42 but note that the add-on script must trust that the page script has not redefined the setter on somelocalvariable: unlike xraywrappers, evalinwindow() does not provide x-ray vision. if the returned object
contains a function, calls to evalinwindow() will throw an error: // page-script.js function bar() { } var somelocalvariablecontainingafunction = {name: "selection1", foo : bar}; // add-on-script.js components.utils.evalinwindow("somelocalvariablecontainingafunction", contentwindow); // error, function can't be cloned ...
PyXPCOM
ly used in activestate komodo products, for example. with pyxpcom, a developer can talk to xpcom or embed gecko from a python application. pyxpcom is similar to javaxpcom (java-xpcom bridge) or xpconnect (javascript-xpcom bridge). mozilla defines many external interfaces available to embeddors and component developers. pyxpcom provides access to these interfaces as python interfaces. pyxpcom also
contains several classes that provide access to functions for initializing and shutting down xpcom and gecko from python, as well as some xpcom helper functions. documentation building pyxpcom the instructions for building pyxpcom. creating a python xpcom component an example of how to create a simple xpcom component with python.
XPCshell Test Manifest Expressions
this is useful as the entire line will generally be reported whenever tests are reported as being skipped, meaning the comment as well as the expression itself will appear in any logs where this is reported. ...
nsScriptableInputStream
// do something with it! } } catch (e) { dump("error: failed reading from stream:\n" + e + "\n"); } } see also nsiscriptableinputstream ...
IAccessible2
rator and a reuse pool. the number generator would emit numbers starting at 1. each time an object's life cycle ended, its number would be saved into a reuse pool. the number generator would be used whenever the reuse pool was empty. [propget] hresult uniqueid( [out] long uniqueid ); parameters uniqueid return value s_ok. windowhandle() returns the window handle for the parent window which
contains this object. this is the same window handle which will be passed for any events that occur on the object, but is cached in the accessible object for use when it would be helpful to access the window handle in cases where an event isn't fired on this object. a use case is when a screen reader is grabbing an entire web page on a page load. without the availability of windowhandle, the at would have...
IAccessibleText
position of the caret. returns the 0-based offset of the caret within the text(). if the text() is implemented as a tree of text() objects with embed characters in higher levels representing substrings of child text() objects and the caret is in one of the child text() objects, then the offset in the higher level text() object would be at the embed character representing child text() object that
contains the caret. for example, if the string "one two three" is implemented as a two text() objects, with a top level text() object containing an embed character "one ? three" and a child text() object containing "two" and if the caret is in the descendant object just before the 'o' in "two", then: the caretoffset for the "one ? three" object would be 4, matching the embed character</li> the caretoffse...
imgICache
ticle. inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) as of firefox 18, there is no longer a single image cache. that means that using getservice in order to obtain it will yield incorrect results. ...
imgIRequest
have already been dispatched for this image load. imgirequest clone( in imgidecoderobserver aobserver ); parameters aobserver return value decrementanimationconsumers() tell the image it can forget about a request that the image animate. void decrementanimationconsumers(); parameters none. getstaticrequest() if this request is for an animated image, the method creates a new request which
contains the current frame of the image. otherwise returns the same request. imgirequest getstaticrequest(); parameters none. return value incrementanimationconsumers() requests that the image animate (if it has an animation). void incrementanimationconsumers(); parameters none. lockimage() locks an image. if the image does not exist yet, locks it once it becomes available. the lock persists for the li...
inIDOMUtils
returns a list of the fonts specified using @font-face in the specified portion of the document. nsidomfontfacelist getusedfontfaces( in nsidomrange arange ); parameters arange the dom range to retrieve the font faces of. return value an nsidomfontfacelist object listing all the font faces used by the text in the range. isignorablewhitespace() determines if the specified text node
contains only ignorable whitespace characters. boolean isignorablewhitespace( in nsidomcharacterdata adatanode ); parameters adatanode a dom characterdata node; that is, a text node. return value true if the node only
contains insignificant whitespace. in particular, this will be false if certain css white-space styles are in effect. isinheritedproperty() determines if the specified string n...
GetChildAtPoint
nsiaccessible getchildatpoint( in long ax, in long ay ); parameters ax[in] accessible's x-coordinate.ay[out] accessible's y-coordinate. return value returns an accessible child at given (x, y) coordinate. remarks if the point is in the current accessible but not in a child, the current accessible will be returned. ...
nsIAsyncStreamCopier
ation about the progress of the copy operation. init() initializes the stream copier. note: at least one of the streams must be buffered. void init( in nsiinputstream asource, in nsioutputstream asink, in nsieventtarget atarget, in boolean asourcebuffered, in boolean asinkbuffered, in unsigned long achunksize, in boolean aclosesource, in boolean aclosesink ); parameters asource
contains the data to be copied. asink specifies the destination for the data. atarget specifies the thread on which the copy will occur. a null value is permitted and causes the copy to occur on an unspecified background thread. asourcebuffered true if asource implements nsiinputstream.readsegments(). asinkbuffered true if asink implements nsiinputstream.writesegments() . achunksize specifies how many byt...
nsIAuthModule
lenge from a server). this may be null. aintokenlength the length of the input token. aouttoken if getnexttoken succeeds, then aouttoken will point to a buffer to be sent in response to the server challenge. the length of this buffer is given by aouttokenlength. the buffer at aouttoken must be recycled with a call to nsimemory.free(). aouttokenlength if getnexttoken succeeds, then aouttokenlength
contains the length of the buffer (number of bytes) pointed to by aouttoken. init() this method is called to initialize an auth module. the other methods cannot be called unless this method succeeds. void init( in string aservicename, in unsigned long aserviceflags, in wstring adomain, in wstring ausername, in wstring apassword ); parameters aservicename the service name, which may be null if...
nsICommandLineHandler
dline); attributes attribute type description helpinfo autf8string when the application is launched with the -help argument, this attribute is retrieved and displayed to the user (on stdout). the text should have embedded newlines which wrap at 76 columns, and should include a newline at the end. by convention, the right column which
contains flag descriptions begins at the 24th character. read only. methods handle() processes a command line. if this handler finds arguments that it understands, it should perform the appropriate actions (such as opening a window), and remove the arguments from the command-line array. void handle( in nsicommandline acommandline ); parameters acommandline command line to proces...
nsICrashReporter
for data is '\0'. ns_error_not_initialized if crash reporting not initialized. appendappnotestocrashreport() append some data to the "notes" field, to be submitted with a crash report. unlike annotatecrashreport(), this method will append to existing data. void appendappnotestocrashreport( in acstring data ); parameters data data to be added. exceptions thrown ns_error_invalid_arg if data
contains invalid characters. the only invalid character is '\0'. ns_error_not_initialized if crash reporting not initialized. native code only!appendobjcexceptioninfotoappnotes append note containing an obj-c exception's info. void appendobjcexceptioninfotoappnotes( in voidptr aexception ); parameters aexception nsexception object to append note for. native code only!writeminidumpforexception write...
nsIDOMFileList
gecko 1.9.2 note starting in gecko 1.9.2, this is also used by the datatransfer object to support dragging and dropping files into web applications. this interface implements the dom filelist object. please see that documentation for details. ...
nsIDOMMozNetworkStatsManager
types that used to be saved in the database. nsidomdomrequest getavailableservicetypes(); parameters none. return value an nsidomdomrequest object. if successful, the result field of the domrequest holds an array of the currently available service types. networkstatsalarmoptions networkstatsalarmoptions is a dictionary object used to filter an alarm request made when calling addalarm(). it
contains the following fields: starttime a date object representing the start time. data a date object representing the date of data. networkstatsgetoptions networkstatsgetoptions is a dictionary object used to filter a network statistics request made when calling getsamples(). it
contains the following fields: appmanifesturl a string used to filter network stats by app. servicetype a strin...
nsIDOMWindow
dom/interfaces/base/nsidomwindow.idlscriptable this interface is the primary interface for a window object. it represents a single window object that may contain child windows if the document in the window
contains an html frameset document, or if the document
contains iframe elements. 66 introduced gecko 1.0 deprecated gecko 44 inherits from: nsisupports last changed in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) starting with firefox 44, this file is empty as its features were either no longer used or are only available from c++ code; see dom/base/nspidomwindow.h for those. while this interface is not officially defined by any standard bodies, it originates from the de-facto dom level 0 standard. starting in firefox 3, dom windows ar...
nsIDOMWindow2
inherits from: nsidomwindow last changed in gecko 1.9 (firefox 3) because nsidomwindow is frozen, this interface was introduced in firefox 3 (gecko 1.9) to allow dom windows to take on new features. dom windows implement nsidomwindow2, which is a subclass of nsidomwindow. ...
nsIDOMWindowInternal
nsidomwindowinternal returns a reference to the window that opened this current window. status domstring sets the text in the status bar at the bottom of the browser or returns the previously set text. defaultstatus domstring gets/sets the status bar text for the given window. location nsidomlocation readonly: returns a nsidomlocation object, which
contains information about the url of the document. innerwidth long width of the browser window. innerheight long height of the browser window. outerwidth long gets the width of the outside of the browser window. outerheight long gets the height of the outside of the browser window. screenx long the horizontal distance of the left ...
nsIDownload
lue is set to null. read only. displayname astring a user-readable description of the transfer. read only. id unsigned long the id by which the download is identified uniquely in the database - not globally unique. for example, a private download and a public one might have identical ids. can only be safely used for direct database manipulation in the database that
contains this download. use the guid property instead for safe, database-agnostic searching and manipulation. read only. deprecated since gecko 19.0 guid astring the guid of the download that is stored in the database. has the form of twelve alphanumeric characters. read only. mimeinfo nsimimeinfo provides the targets relevant mime information, including its mime type, help...
nsIEditorSpellCheck
nguage code, such as "en-us". getdictionarylist() retrieves a list of the currently available dictionaries. the strings will typically be language ids, such as "en-us". void getdictionarylist( [array, size_is(count)] out wstring dictionarylist, out pruint32 count ); parameters dictionarylist an array into which the list of dictionary name strings are placed. count on return,
contains the number of entries in the dictionarylist array. getnextmisspelledword() when interactively spell checking the document, this will return the value of the next word that is misspelled. this also computes the suggestions which you can get by calling getsuggestedword(). wstring getnextmisspelledword(); parameters none. return value the next misspelled word in the document. getpersonaldictionary...
nsIEventListenerService
'load', may actually have a shorter event target chain than what this methods returns. void geteventtargetchainfor( in nsidomeventtarget aeventtarget, [optional] out unsigned long acount, [retval, array, size_is(acount)] out nsidomeventtarget aoutarray ); parameters aeventtarget the nsidomeventtarget for which to return the event target chain. acount on return,
contains the number of elements in the returned array. aoutarray the array into which to store the event targets. getlistenerinfofor() returns an array of nsieventlistenerinfo objects describing everyone listening to the specified event target. if aeventtarget doesn't have any listeners, this returns null. void getlistenerinfofor( in nsidomeventtarget aeventtarget, [optional] out unsign...
nsIFileView
reateinstance(components.interfaces.nsifileview); method overview void setdirectory(in nsifile directory); void setfilter(in astring filterstring); void sort(in short sorttype, in boolean reversesort); attributes attribute type description reversesort boolean if true results will be sorted in ascending order. read only. selectedfiles nsiarray an nsiarray of selected files, which
contains nsiarray instances. read only. showhiddenfiles boolean if true hidden files will be shown. showonlydirectories boolean if true only directory entries will be returned. sorttype short the current sort type in effect. read only. constants constant value description sortname 0 sort by file name. sortsize 1 sort by file size. sortdate 2 sort by the date of the last modification. ...
nsIHttpChannelInternal
_not_available exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsihttpactivityobserver.isactive attribute is false. see bug 534698 and bug 526207. read only. methods getrequestversion() gets the request's major and minor version numbers. void getrequestversion( out unsigned long major, out unsigned long minor ); parameters major on return,
contains the request's major version number. minor on return,
contains the request's minor version number. getresponseversion() gets the response's major and minor version numbers. void getresponseversion( out unsigned long major, out unsigned long minor ); parameters major on return,
contains the response's major version number. minor on return,
contains the response's minor version number. httpu...
nsIHttpServer
do * not match the production, such as for cgi functionality. * @note * implementations may treat type as a trusted argument; users who fail to * generate this string from trusted data risk security vulnerabilities. */ void registercontenttype(in string extension, in string type); /** * sets the handler used to display the contents of a directory if * the directory
contains no index page. * * @param handler * an object which will handle any requests for directories which * do not contain index pages, or null to reset to the default * index handler; if while the server is running the handler * throws an exception while responding to a request, an http 500 * response will be returned. an nsifile corresponding to the * directory is ...
nsIInstallLocation
tion specified. getitemfile() gets a nsifile object for a file within an item's directory structure. nsifile getitemfile( in astring id, in astring path ); parameters id the guid of the item. path the path to the file beneath an extension's directory. return value a file object at the requested location. the file does not necessarily have to exist. getitemlocation() gets the directory that
contains an item. nsifile getitemlocation( in astring id ); parameters id the guid of the item. return value the location of the item. getstagefile() returns the most recently staged package (for example the last xpi or jar in a directory) for an item and removes items that do not qualify. nsifile getstagefile( in astring id ); parameters id the id of the staged package. return value an nsifile ...
Using nsILoginManager
formation and nsilogininfo, which provides a way of storing login information. getting nsiloginmanager to get a component implementing nsiloginmanager, use the following: var passwordmanager = components.classes["@mozilla.org/login-manager;1"].getservice( components.interfaces.nsiloginmanager ); most login manager functions take an nsilogininfo object as a parameter. an nsilogininfo object
contains the following attributes: hostname, form submit url, http realm, username, username field, password, and password field. the hostname, username and password attributes are mandatory, while the other fields are set based on whether the login is for a web page form or an http/ftp authentication site login. see the nsilogininfo attribute definitions for more details. defining an nsilogininfo object ...
nsILoginManager
placing it with a new one. if newlogindata is a nsilogininfo, all of the old login's nsilogininfo properties are changed to the values from newlogindata (but the old login's nsiloginmetainfo properties are unmodified). if newlogindata is a nsipropertybag, only the specified properties will be changed. the nsiloginmetainfo properties of oldlogin can be changed in this manner. if the propertybag
contains an item named "timesusedincrement", the login's timesused property will be incremented by the item's value. void modifylogin( in nsilogininfo oldlogin, in nsisupports newlogindata ); parameters oldlogin the login to be modified. newlogindata the login information to replace the oldlogin with. this may be specified as either an nsilogininfo or an nsipropertybag2 object. removealllog...
nsILoginMetaInfo
this data can usually be ignored by most users of the login manager, which will create and maintain appropriate default values. 1.0 66 introduced gecko 1.9.1 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) you can specifically modify these values by passing changes into nsiloginmanager.modifylogin() using an nsipropertybag2 object as the input. metadata properties are ignored when comparing logins. ...
nsIMemoryReporter
2.4) the amount reported by a memory reporter may use one of the following units. constant value description units_bytes 0 the amount is specified as a number of bytes. units_count 1 the amount is an instantaneous count of things currently in existence. for example, the number of tabs currently open. units_count_cumulative 2 the amount
contains the number of times some event has occurred since the application started up. for example, the number of times the user has opened a new tab. the amount returned must never decrease over the lifetime of the application. units_percentage 3 the amount
contains a fraction that should be expressed as a percentage. note: the amount field should be given a value 100 times the ...
nsIMessageWakeupService
s is to add the appropriate entry to the chrome manifest that registers your component (see category in "chrome registration"). to indicate a wakeup request in a manifest file, add a line that looks something like this: category wakeup-request nscomponent @mozilla.org/myservice;1,nsimyinterface,getservice,mymessage1,mymessage2[,..] the category entry value consists of a comma separate string that
contains: the contract id for your component (e.g. "@mozilla.org/myservice;1"). the string name of interface to instantiate the component as (e.g. "nsimyinterface"). the method to call to instantiate the component (either "getservice" or "createinstance"). a comma-separated list of messages for which your component should be instantiated. alternatively, it is possible to register a wakeup entry ...
nsIMessenger
et() sets the character set for the displayed message. void setdisplaycharset(in acstring acharset); parameters acharset the character set to use. setwindow() sets the current window for a messenger session. void setwindow(in nsidomwindow awin, in nsimsgwindow amsgwindow); parameters awin the window to set as the window for the messaging session. if this window
contains a messagepane element (i think this may mean a xul:browser element with its id set to "messagepane"?), then the nsidocshell will be used for future nsimessenger operations. if there is no messagepane element, then the root xul nsidocshell will be used (so that openurl() will still work). if null is passed in then observers are removed in preparation for shutdown. amsgwindow the nsimsgwindow wit...
nsIMsgIdentity
each identity is identified by a key, which is the id string in the identity preferences, such as in mail.identity.<id>.replyto. ...
nsIMsgSearchCustomTerm
ned long length, [retval, array, size_is(length)] out nsmsgsearchopvalue operators); match /** * apply the custom search term to a message * * @param msghdr header database reference representing the message * @param searchvalue user-set value to use in the search * @param searchop search operator (
contains, ishigherthan, etc.) * * @return true if the term matches the message, else false */ boolean match(in nsimsgdbhdr msghdr, in autf8string searchvalue, in nsmsgsearchopvalue searchop); ...
nsIMsgSearchSession
booleanor 0 booleanand 1 methods addsearchterm() void addsearchterm(in nsmsgsearchattribvalue attrib, in nsmsgsearchopvalue op, in nsimsgsearchvalue value, in boolean booleanand, in string arbitraryheader); parameters attrib attribute for this term. op operator e.g. op
contains value value e.g. "dogbert" booleanand set to true if associated boolean operator is and. arbitraryheader user defined arbitrary header. ignored unless attrib = attribotherheader. createterm() nsimsgsearchterm createterm(); appendterm() void appendterm(in nsimsgsearchterm term); parameters term registerlistener() adds a listener to the search session. void registerlisten...
nsIOutputStream
nsacstring* pbuf = (nsacstring*) aclosure; const char* data; pruint32 len = ns_cstringgetdata(&data); data += afromoffset; len -= afromoffset; if (len > acount) len = acount; memcpy(atosegment, data, len); // indicate that we have copied len bytes to the segment *areadcount = len; return ns_ok; } // write the contents of asource int...
nsIPrincipal
ipals( in jscontext cx ); parameters cx missing description return value missing description getpreferences() returns the security preferences associated with this principal. void getpreferences( out string prefbranch, out string id, out string subjectname, out string grantedlist, out string deniedlist, out boolean istrusted ); parameters prefbranch on return,
contains the preference branch to which the preferences pertain. id a semi-unique id relating to either the fingerprint or the origin. subjectname a name identifying the entity the principal represents; this may be an empty string. grantedlist space-delineated list of capabilities which are explicitly granted by a preference. deniedlist space-delineated list of capabilities...
nsIProfile
he name of the profile to delete. candeletefiles if true, the profile manager will try to delete all of the profile's files and its directory. getprofilelist() returns an array of strings indicating the names of all the available profiles. void getprofilelist( out unsigned long length, [retval, array, size_is(length)] out wstring profilenames ); parameters length on return,
contains the number of profiles in the profilenames array. profilenames on return,
contains an array of all of the available profiles' names. profileexists() determine whether or not a profile with the specified name exists. boolean profileexists( in wstring profilename ); parameters profilename the name of the profile to look for. return value true if there is a profile with the spe...
nsIRequest
1 << 7 this flag prevents caching of any kind. it does not, however, prevent cached content from being used to satisfy this request. inhibit_persistent_caching 1 << 8 this flag prevents caching on disk (or other persistent media), which may be needed to preserve privacy. for https, this flag is set automatically. the following flags control what happens when the cache
contains data that could perhaps satisfy this request. they are listed in descending order of precedence. constant value description load_bypass_cache 1 << 9 force an end-to-end download of content data from the origin server. this flag is used for a shift-reload. load_from_cache 1 << 10 load from the cache, bypassing protocol specific validation logic. this f...
nsIScriptableInputStream
gnored. void close(); parameters none. init() wrap the given nsiinputstream with this nsiscriptableinputstream. note: the init method may be called more than once, allowing a nsiscriptableinputstream instance to be reused. void init( in nsiinputstream ainputstream ); parameters ainputstream the nsiinputstream to be wrapped. read() read data from the stream. warning: if the data
contains a null byte, then this method will return a truncated string. note: it is also important to consider how a language bindings may interpret the string data type. in particular, some bindings may convert the byte values into unicode code points, by assuming the byte values are encoded as iso-latin-1. this is the case for the javascript bindings. string read( in unsigned long acount ); parameter...
nsISearchEngine
etype 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. getsubmission() gets a nsisearchsubmission object that
contains information about what to send to the search engine, including the uri and postdata, if applicable. nsisearchsubmission getsubmission( in astring data, [optional] in astring responsetype, [optional] in astring purpose ); parameters data data to add to the submission object. that is the search terms. responsetype [optional] the mime type that we'd like to receiv...
nsISessionStore
ascript object) it can then be deserialized using json.parse cf. nsisessionstore.settabvalue(). getwindowstate() returns the current state of one specified window in the web browser. astring getwindowstate( in nsidomwindow awindow ); parameters awindow the browser window whose state is to be returned. see #note on windows. return value a json string representing a session state that
contains only the window specified by awindow. if the preference browser.sessionstate.enabled is false when this method is called, then you will get an exception about "awindows[i] has no properties". getwindowvalue() returns the string value associated with a given key for a window. astring getwindowvalue( in nsidomwindow awindow, in astring akey ); parameters awindow the window from which ...
nsIStreamListener
so, in all the three methods - ondataavailable(), nsirequestobserver.onstartrequest() and nsirequestobserver.onstoprequest() have to be implemented. ...
nsIStructuredCloneContainer
oded string. initfrombase64() initialize this structured clone container from a base-64-encoded byte stream. void initfrombase64( in astring adata, in unsigned long aformatversion ); parameters adata a base-64-encoded byte stream. aformatversion the version of the structured clone algorithm which was used to generate adata. initfromvariant() initialize this structured clone container so it
contains a clone of the given variant. void initfromvariant( in nsivariant adata ); parameters adata a nsivariant, must be backed by a jsval. ...
nsITaggingService
atag the tag name. return value returns array of uris tagged with atag. gettagsforuri() this method retrieves all tags set for the given uri. nsivariant gettagsforuri( in nsiuri auri, [optional] out unsigned long length, [retval, array, size_is(length)] out wstring atags ); parameters auri the uri for which to return the tags. length optional on return,
contains the number of tags returned in atags. this optional parameter was required prior to gecko 2.0. atags on return,
contains an array of tags for the specified uri. return value returns array of tags (sorted by name). see also places using the places tagging service ...
nsIToolkitProfile
the same as the root directory. see nsiprofilelock.localdirectory(). read only. name autf8string the profile's name. rootdir nsilocalfile the location of the profile directory. read only. methods lock() locks the profile using platform-specific locking methods. nsiprofilelock lock( out nsiprofileunlocker aunlocker ); parameters aunlocker on error,
contains an nsiprofileunlocker object you can use to unlock the profile. note: the unlocker object cannot be returned to javascript as the error causes an exception to be thrown. the unlocker object is only available in gecko 34 or later when running on windows vista or later. return value an nsiprofilelock object which holds a profile lock as long as you hold a reference to it. example: var prof...
nsITreeBoxObject
further information about trees is given in the xul tutorial. /layout/xul/base/src/tree/public/nsitreeboxobject.idlscriptable please add a summary to this article. ...
nsIUploadChannel2
tream to be uploaded by this channel. acontenttype this value will replace any existing content-type header on the http request, regardless of whether or not its empty. acontentlength a value of -1 indicates that the length of the stream should be determined by calling the stream's available method. amethod the http request method to set on the stream. astreamhasheaders true if the stream already
contains headers for the http request. ...
nsIXMLHttpRequest
till work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. nsixmlhttprequest along with nsijsxmlhttprequest and nsixmlhttprequesteventtarget are mozilla's implementation details of the dom xmlhttprequest object. note: if you're a web developer or a mozilla add-on developer, please refer to the xmlhttprequest documentation instead. this page
contains documentation, specific to mozilla application and add-on developers. the interface definition: //github.com/realityripple/uxp/blob/master/dom/xhr/nsixmlhttprequest.idl elevated privileges as mentioned in the "non-standard properties" the property of channel was read-only. when using the xpcom interface, as seen below in example 2, we can get access to this. the most obvious benefit is that we...
nsIXULAppInfo
bird 1.5 / seamonkey 1.0) in xulrunner applications nsixulappinfo obtains app-specific information from application.ini. implemented by: @mozilla.org/xre/app-info;1. to create an instance, use: var xulappinfo = components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.interfaces.nsixulappinfo); the nsixulruntime interface is also implemented by "xre/app-info". it
contains advanced information on the xul runtime. attributes attribute type description appbuildid acstring the application's build id/date, for example "2004051604". for xulrunner applications, this will be different than the build id of the platform. be careful about which one you want. read only. id acstring the xul application's uuid. can be an empty s...
nsIXULTemplateBuilder
> <query></query> <rule> <conditions>...</conditions> <bindings>...</bindings> <action>...</action> </rule> </queryset> </template> </rootnode> the datasources attribute on the root node is used to identify the source of data to be used. the ref attribute is used to specify the reference point for the query. the <queryset> element
contains a single query and one or more <rule> elements. there may be more than one <queryset> if multiple queries are desired, and this element is optional if only one query is needed -- in that case the <query> and <rule>s are allowed to be children of the <template> node. the contents of the query are processed by a separate component called a query processor. this query processor is expected to use th...
nsIXULTemplateResult
ithin the set of results produced from a query. the result may optionally be identified by an rdf resource. generally, the result and its id will be able to uniquely identify a node in the source data, such as an rdf or xml node. in other contexts, such as a database query, a result would represent a particular record. a result is expected to only be created by a query processor. each result also
contains a set of variable bindings. the value for a particular variable may be retrieved using the getbindingfor() and getbindingobjectfor() methods. method overview astring getbindingfor(in nsiatom avar); nsisupports getbindingobjectfor(in nsiatom avar); void hasbeenremoved(); void rulematched(in nsisupports aquery, in nsidomnode arulenode);...
nsIZipEntry
ssynthetic boolean use this attribute to determine whether this item is an actual zip entry or is one synthesized for part of a real entry's path. a synthesized entry represents a directory within the zip file which has no corresponding entry within the zip file. for example, the entry for the directory foo/ in a zip containing exactly one entry for foo/bar.txt is synthetic. if the zip file
contains an actual entry for a directory, this attribute will be false for the nsizipentry for that directory. it is impossible for a file to be synthetic. read only. lastmodifiedtime prtime the time at which this item was last modified. read only. name string read only. obsolete since gecko 1.9 realsize unsigned long the uncompressed size of the data in the ...
nsIZipReader
file entry is returned. nsiinputstream getinputstreamwithspec( in autf8string ajarspec, in autf8string zipentry ); parameters ajarspec the spec of the uri for the jar (only used for directory streams). zipentry the name of the entry to open() the stream from. return value the nsiinputstream containing the contents of the specified zip entry. hasentry() checks whether the zipfile
contains an entry specified by zipentry. boolean hasentry( in autf8string zipentry ); parameters zipentry the zip entry. return value boolean value, true if the zip entry exists, false is it does not exist. init() obsolete since gecko 1.9 (firefox 3) initializes a zip reader after construction. void init( in nsifile zipfile ); parameters zipfile zip file to...
Working with out parameters
adatalen are marked as out, meaning that they act as "return values" for this method, and are changed during the method call. these are so-called out parameters. usage in order to use such a method from javascript via xpconnect, you have to follow a specific rule. to get at the out parameters, you have to pass in an object. after the call, this object will have a new property called value, which
contains the out values. assuming you have an object called transferable, you would invoke gettransferdata() as follows: var adata = {}; var adatalen = {}; transferable.gettransferdata("text/unicode", adata, adatalen); var data = adata.value; var datalen = adatalen.value; as you can see, after the call to gettransferdata(), the out values are then contained in the value properties of adata and ad...
Xptcall Porting Status
pe.com> franz sirl <franz.sirl-kernel@lauterbach.com> <font color="red">?</font> jason y. sproul <jsproul@condor.fddi.wesleyan.edu> <font color="red">?</font> sean chitwood <darkmane@w-link.net> waterson said: mozilla runs on linux/ppc <font color="white">done</font> linux alpha glen nakamura <glen.nakamura@usa.net> dan morril <morrildl@nycap.rr.com> glen writes: i am attaching a patch which
contains my linux alpha xptcall code. it passes testxptcinvoke and testxpc on my machine which runs kernel 2.2.7, glibc 2.1.1, and egcs 1.1.2. i have not tested it with older gnu compilers such as gcc 2.8.x. from looking at the linux x86 code, i gather that the vtable layout is a little different for those compilers and the code will need minor modifications in order to work properly. i am not sure how mu...
XPCOM
mplements the nsiproperties interface. this implementation will allow you to get(), set(), define(), and undefine() nsifile.using nsipasswordmanagertechnical review completed.using nsisimpleenumeratorusing the clipboardthis section provides information about cutting, copying, and pasting to and from the clipboard.using the gecko sdkweak referencein xpcom, a weak reference is a special object that
contains a pointer to an xpcom object, but doesnot keep that object alive. if the referent object is destroyed before the weak reference, the pointer inside the weak reference is set to nsnull.working with multiple versions of interfacesin this short note we illustrate how one can update an xpcom module in order for it to work in both firefox 2 and firefox 3, even if the interfaces have changed in the int...
Mozilla technologies
toolkit is a set of programming interfaces (apis) built on top of gecko which provide advanced services to xul applications. these services include:viewing and searching mozilla source code onlinesource code for all mozilla projects hosted in the mercurial repositories can be searched and viewed online using searchfox, a fast indexed search engine that runs on aws.xml extrasthe xml extras module
contains several features that allow developers to treat xml as data i.e. not as just another document format. the module is structured as a drop-in component and exposes its xml-as-data features both to javascript and c++/xpcom users. the xml extras module is built by default on all platforms, and is included in the browser installers so it is available in the nightly builds.xpcomxpcom is a cross platfor...
Autoconfiguration in Thunderbird
entation and project details this document describes how autoconfiguration in thunderbird works, and what to do to allow mail servers to be autoconfigured. mechanisms thunderbird gets the server settings via different means, each of which is intended for different cases: ispdb the ispdb is a central database, currently hosted by the thunderbird project, but free to use for any client. it
contains settings for the world's largest isps. most isps with a market share of more than 0.1% are included. this allows to autoconfigure almost 50% of our user's email accounts. it was added because we cannot assume that all big isps (including microsoft) will set up a configuration server for thunderbird. configuration server at isp isps have the option to provide their configuration information t...
Filelink Providers
ils in order to connect to the service. hightail, for example, requires a username and password. other services may require the user to fill in a server string or port number. a provider implementation can choose what information it gets from the user from the setup dialog by pointing the settingsurl attribute of their nsimsgcloudfileprovider implementation to a chrome url for an xhtml page that
contains a form with the extra information. that url is then loaded into an iframe directly beneath the provider menulist. note: the setup dialog window should resize itself automatically in order to fit the content of the iframe without scrollbars. custom settings fields to handle custom settings, the settings xhtml page should contain a form with the id "provider-form", with its onsubmit attribute se...
Mail client architecture overview
modules outside of the mail client that are mail-oriented. most of these modules have little dependancy on the mail reader itself: compose - the mail compose module is responsible for anything that has to do with sending mail. this includes the mail compose window, creation of rfc822 messages from the data a user has entered, and sending the messages via smtp. address book - the address book
contains lists of people and all attributes associated with them such as their e-mail address, phone number, etc. ...
Mail composition back end
dmessage the quotemessage method is the primary interface for message quoting. ns_imethod quotemessage( const prunichar *msguri, - the uri of the message to be quoted nsioutputstream *outstream) = 0; - the consumer output stream for the quoted data sample programs the mozilla/mailnews/compose/tests/ directory
contains sample test programs for all of the above described interfaces. use at your own risk and beware of bitrot! compose - this program shows the use of the createandsendmessage interface (createandsendmessage) compose2 - this program shows the use of the createandsendmessage interface (sendmessagefile) sendlater - this program shows the use of the nsimsgsendlater interface sendpage - this progr...
Mail event system
n system has two duplicate methods which could be implemented with onitemevent/notifyitemevent: folderloaded , and deleteormovemessagescompleted . both of these could be done by making atoms for each of these events and just firing it with notifyitemevent. completed there are some of redundant methods between the nsimsgmailsession and the nsifolderlistener interfaces. nsimsgmailsession also
contains a number of other methods that are completely unrealted to folder notification. it would make sense to collapse the nsimsgmailsession simply into an object that implements the the nsifolderlistener interface to receive notifications from the folders. the notification functions should probably go to an nsifolderbroadcaster interface or something, since they need to know what folder is being modifi...
Thunderbird Binaries
the trunk is the central source code that is used for continuous and ongoing development. trunk builds contain the very latest bleeding-edge changes and updates. the trunk can be very unstable at times, so it's good to ask around before using trunk builds. what is a branch? branches are "forks" in the code, split from the trunk and destined to become end-user releases. at conception, a branch
contains everything that the trunk
contains, but from that point onwards, only certain fixes or changes will be accepted. therefore, over time, the branch becomes more stable. why branch? wouldn't it be better to have everyone working towards a release? many developers prefer to work on areas of the code which are too risky to change when approaching a release. some of their changes may also take months...
Building a Thunderbird extension 2: extension file layout
rning: this content is for older versions of thunderbird. much of it may no longer be relevant. see developer.thunderbird.net for newer information. extensions are packaged and distributed in archive files (also known as bundles), with the xpi (pronounced “zippy”) file extension. at a minimum, they contain an install.rdf, the chrome.manifest and a chrome/ folder. a content/ folder sometimes
contains the actual content files. these files contain the code that makes your extension actually do something. when this tutorial is finished, our extension will look like this: myfirstext.xpi: //created in step 8 /install.rdf //created in step 3 /chrome.manifest //created in step 4 /chrome/ ...
Building a Thunderbird extension 3: install manifest
:version>: this is the version number of your extension. it must be updated each time you release a new version of your extension. it is not the thunderbird version number (which is stored in the minversion and maxversion fields). <em:creator>jenzed</em:creator>: this optional value is used to store the extension author's name. <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>: this element
contains the version id of the application that this add on is developed for. it is defined by mozilla. a list of valid application ids can be found here. normally the id does not change and is always the same even for different versions of thunderbird. <em:minversion>1.5</em:minversion>: this element indicates the earliest version of thunderbird for which the extension is intended to work. do not use a ...
Building a Thunderbird extension 5: XUL
ge them with the original xul document's <statusbar> tag. in the example above we have defined a new <statusbarpanel> item (that can be referred to as my-panel) which will create a new instance of this widget type and add it at the end of the statusbar. in thunderbird it will appear as a label at the right side of thunderbird's statusbar and display "date". we have also added a <script> tag that
contains a reference to the javascript file overlay.js. in the next section you will learn how to use javascript to modify your label so that it shows the current date. the overlay.js file will be created in a later section and your add-on will still work if the file is missing. for now you can ignore this line, but remember that this is how you reference a javascript file. « previousnext » ...
Building a Thunderbird extension 6: Adding JavaScript
startup function which gets our <statusbarpanel>-element with the id my-panel from the document's dom tree. it then uses javascript's date class to get the current date, which it converts into a string that has the format of yyyy.mm.dd. because the month is zero-based we also need to add one to the month. finally the label of our panel is set to "date: " and concatenated with the date string that
contains the formatted date. we use the function window.setinterval to update the date in case thunderbird is left running for more than one day. this allows us to call the startup function repeatedly with an interval of 60000ms (every minute). further documentation more functions for the dom objects are listed on: dom/window (api reference for the window object) dom/document (api reference for the...
Demo Addon
.subject, date: items[i].date, author: items[i].from.value, }); // ... }; } // ... }; let collection = query.getcollection(mylistener); at first, a new gloda query for finding messages is created. the subject is assigned as search criterion. in the gloda query result listener the variable acollection is a glodacollections. it
contains a collection of glodaconversation objects which itself is a thread that
contains one or more glodamessages. for every gloda message subject, date and author is extracted. the last line of this example executes the gloda query. download demo addon download ...
Folders and message lists
interacting with the current folder the folderdisplaywidget for the current folder can be accessed via the global variable gfolderdisplay. this object provides many of the functions required for working with folder views. we'll look at some of them below. getting the current nsimsgfolder the nsimsgfolder interface
contains many methods and attributes for working with folders. to get the nsimsgfolder instance for the currently-displayed folder, just use gfolderdisplay.displayedfolder. getting the currently-selected message the folderdisplaywidget has several ways of getting the currently-selected message(s), depending on what exactly you're trying to do: gfolderdisplay.selectedcount: returns the number of messages currently selected. gfolderdisplay.selectedmessage: returns the first curre...
Thunderbird extensions
ce using a fancy interface; you can often find tests that demonstrate what you're trying to achieve. the gloda database thunderbird has a subsystem called gloda. gloda stands for « global database », and creates thunderbird-wide relations between objects. gloda provides concepts such as conversations, messages, identities, contacts. all these concepts are related : a conversation
contains messages which are linked to identities (from field, to field) which are themselves part of a contact: indeed, a contact has multiple identities. typical use cases for gloda: find all messages whose subject matches [search term], find all messages from [person], find all messages in the same thread as [a given message], find all messages involving [person], etc. etc. gloda is extremely ...
Using the Multiple Accounts API
ntities. an account is merely a container to bind incoming servers and identities together. incoming servers (nsimsgincomingserver): an incoming server represents a remote message store such as a pop, imap, or nntp server. it holds all the information necessary to retrieve mail from the remote server, such as hostname, user login name, and biff settings. identities (nsimsgidentity): an identity
contains all the information necessary to compose and outgoing mail message. it includes a user's full name and e-mail address. smtp servers (nsismtpserver): an smtp server is not tied to any of the above and can be retrieved from the smtp service (nsismtpservice). here's an example of a common setup. (you'll have to pardon the crude drawing for now) account manager +- account 1 | +- incomin...
XPI
cross-platform installer module (xpi) is a zip file used to install packages, utilizing the xpinstall technology. xpi modules (so called "bundles") are employed to install a wide variety of software, including plugins, extensions, themes, and thunderbird dictionaries. an xpi
contains installation instructions (install.js or install.rdf) as well as the actual software to install, which is often itself packaged as a jar file. when downloaded or dropped into an extension manager, xpinstall automatically interacts with the installation instructions contained in the xpi, and installs the contained software. xpi archives only support files stored uncompressed or compressed using the "deflate" method. note: starting in gecko 2.0, xpi files are no longer unpacked when extensions are installed.
Add to iPhoto
// input: object to release this.cfretain = this.lib.declare("cfretain", ctypes.default_abi, ctypes.void_t, ctypes.voidptr_t); // input: object to retain these methods are used to manage the reference counting for core foundation objects. cfstring a cfstring is an opaque data type that
contains a string. the string can be stored in any of a number of encodings, so you use assorted functions that know how to cope with different encodings to set and get values of cfstrings, as well as to perform typical string operations. the first declaration to be done here is to actually declare the cfstringref data type; this is an opaque pointer to a cfstring object. this.cfstringref = new ctypes.p...
Using C struct and pointers
{ "f": ctypes.float }, { "c": ctypes.char } ]); here we are using the structtype() factory method of the ctypes object to create a ctype object that represents the c struct named st_t. the first parameter of this method is the name of the type, which corresponds to the name of the c struct. the second parameter is an array of field descriptors. each field descriptor
contains the name and field type of the corresponding field of the c struct. the call to structtype() returns a ctype object, and we then apply the new operator to it to create a specific instance of this newly defined type - a javascript representation of the c struct. using c strings with js-ctypes a pointer to char in javascript is declared as follows: var str = ctypes.pointertype(ctypes.char); no...
Standard OS Libraries
d objective-c based api (cocoa). note: you cannot use carbon routines from your add-on; firefox is a 64-bit application, and you cannot use carbon from 64-bit code. core foundation to learn about all the mac os x apis and which library file you will need to call, go to the mac developer library website and find the function, then scroll down to "declared in" section, and find which framework
contains the header file. the coregraphics framework is based on corefoundation framework, including coregraphics etc. the release, string, etc. comes from corefoundation. example: cgeventgetlocation for example, cgeventgetlocation function is declared in cgevent.h header file, which is contained in coregraphics.framework. so /system/library/frameworks/coregraphics.framework/coregraphics is the library...
CData
tring(); parameters none. return value a string identifying the data. methods available on string objects these methods must be called on objects that are arrays or pointers to 8-bit or 16-bit character or integer types, terminated by a null character. readstring() converts a character array to a javascript string. 8-bit strings are assumed to be encoded as utf-8. if the 8-bit string
contains invalid encoded character, a typeerror exception is thrown. string readstring(); parameters none. return value a new string object that is a copy of the original string contents. readstringreplacemalformed() converts a character array to a javascript string. 8-bit strings are assumed to be encoded as utf-8. if the 8-bit string
contains invalid encoded character, no exception is thrown. ...
Int64
er value. you can therefore use a string to represent a 64-bit value that is too large to represent as a 32-bit javascript number. return value a new object representing the specified value. exceptions thrown typeerror the specified value cannot be converted into a 64-bit integer. either it's not a number, string, or 64-bit integer object, or it's a string that is incorrectly formatted or
contains a value outside the range that can be represented in 64 bits. this will also be thrown if the source value is a floating-point number that can't be precisely represented as a 64-bit integer. method overview number compare(a, b); number hi(a); int64 join(high, low); number lo(a); string tosource(); string tostring([radix]); methods c...
StructType
newly created struct data type. exceptions thrown typeerror the name is not a string, or one or more of the fields does not have a defined size. rangeerror the size of the structure, in bytes, cannot be represented both as a size_t and as a javascript number. describing fields the fields array is comprised of field descriptors, one for each field in the structure. each field descriptor
contains the field's name and its type, such as {'serialnumber': ctypes.int}. a complete field descriptor list might look like this: [ {'serialnumber': ctypes.int}, {'username': ctypes.char.ptr} ] properties property type description fields ctype[] a sealed array of field descriptors. read only. properties inherited from ctype these properties are available on all...
UInt64
er value. you can therefore use a string to represent a 64-bit value that is too large to represent as a 32-bit javascript number. return value a new object representing the specified value. exceptions thrown typeerror the specified value cannot be converted into a 64-bit integer. either it's not a number, string, or 64-bit integer object, or it's a string that is incorrectly formatted or
contains a value outside the range that can be represented in 64 bits. this will also be thrown if the source value is a floating-point number that can't be precisely represented as a 64-bit integer. method overview number compare(a, b); number hi(a); uint64 join(high, low); number lo(a); string tosource(); string tostring([radix]); methods ...
ctypes
method overview ctype arraytype(type[, length]); cdata cast(data, type); ctype functiontype(abi, returntype[, argtype1, ...]); cdata int64(n); string libraryname(name); library open(libspec); ctype pointertype(typespec); ctype structtype(name[, fields]); cdata uint64(n); properties property type description errno number the value of the latest system error. similar to errno in libc, available on all platforms. cannot be set. winlasterror number|undefined the value of the latest windows error. ...
Mozilla
ndings are generated at build time based on two things: the actual webidl file and a configuration file that lists some metadata about how the webidl should be reflected into gecko-internal code. working with windows in chrome code this article describes working with multiple windows in mozilla chrome code (xul applications and extensions). it
contains tips and example code on opening new windows, finding an already opened window, and passing data between different windows. xmlhttprequest changes for gecko1.8 this document describes some of the changes that have been made to gecko's xmlhttprequest implementation since version 1.7 (i.e., the version of gecko that shipped with firef...
Constants - Plugins
valid_plugin_dir_error 7 plug-in directory missing or invalid. nperr_incompatible_version_error 8 versions of plug-in and communicator do not match. nperr_invalid_param 9 parameter missing or invalid. nperr_invalid_url 10 url missing or invalid. nperr_file_not_found 11 file missing or invalid. nperr_no_data 12 stream
contains no data. nperr_stream_not_seekable 13 seekable stream expected. result codes constant value description npres_done 0 (most common): completed normally; all data was sent to the instance. npres_network_err 1 stream failed due to problems with network, disk i/o, lack of memory, or other problems. npres_user_break 2 u...
Version, UI, and Status Information - Plugins
system in a user_agent field. if you want to gather usage statistics or just find out the version of your plug-in's host browser, this information can help you. the plug-in calls the npn_useragent method to retrieve the contents of the user_agent field. const char* npn_useragent(npp instance); the instance parameter represents the current plug-in instance. this function returns a string that
contains the user_agent field of the browser. getting the current version your plug-in should make sure, possibly during initialization, that the version of the plug-in api it is using is compatible with the version the browser is using. to do so, it must find the major and minor version numbers, which are determined when the plug-in and navigator are compiled, and compare them. if the versions are not ...
Accessibility Inspector - Firefox Developer Tools
markup (e.g., <div>s) to build a complex custom control, and the control won't have a default role that reflects its purpose. in such a situation, you can use wai-aria role attributes to provide your own roles. roles and other information exposed by browser accessibility apis are presented in a hierarchical structure called the accessibility tree. this is a bit like the dom tree, except that it
contains a more limited set of elements and slightly different information about them. assistive technologies like screenreaders use this information to find out what's on a web page, tell their users what's there, and enable them to interact with the page. the accessibility inspector also uses this information to provide valuable accessibility debugging capabilities in the devtools. accessing the acces...
DOM Inspector FAQ - Firefox Developer Tools
inspect content document inspect content, e.g., unprivileged web pages loaded in a browser tab. inspect chrome document inspect application chrome, including open xul windows, e.g., the browser window. inspect a url this just focuses the dom inspector's address bar, which allow you to inspect arbitrary documents which can be accessed via a url. this causes the document to be loaded in the browser pane. ...
Set a breakpoint - Firefox Developer Tools
ways pause execution when it is reached. you can set an unconditional breakpoint using the context menu (see above), or by: clicking on the line number for the line you want to break at in the source pane. highlighting the line you want to break at in the source pane and pressing ctrl + b (windows/linux) or cmd + b (macos). the line number is highlighted in blue: in addition, if the line
contains multiple function calls, each one will be given a small blue arrow icon to the left of it. these are called column breakpoints, and allow you to set the breakpoint to happen exactly on any one of the function calls in the line (or multiple calls), by clicking on each relevant one. conditional breakpoints a conditional breakpoint is one where the code will pause execution when it is reached, onl...
Use a source map - Firefox Developer Tools
t in the transformed file, that points to the source map. the comment's syntax is like this: //# sourcemappingurl=http://example.com/path/to/your/sourcemap.map in the video above we load https://mdn.github.io/devtools-examples/sourcemaps-in-console/index.html. this page loads a source called "main.js" that was originally written in coffeescript and compiled to javascript. the compiled source
contains a comment like this, that points to a source map: //# sourcemappingurl=main.js.map in the debugger's source list pane, the original coffeescript source now appears as "main.coffee", and we can debug it just like any other source. ...
Set an XHR breakpoint - Firefox Developer Tools
those that include a specific url. to turn on the feature: open the debugger click on "pause on any url" which acts as a wild card, causing the code to pause on any call, or, click the plus sign next to the xhr breakpoints header, enter the url in which you are interested, and press enter. note: if you enter a key word instead of a url, code execution will pause on any call to a url that
contains that keyword. when your code breaks on an xhr request, the righthand pane will have two additional sections: call stack the list of functions that were executed in order ot get to the currently executing code. click on an item in the call stack to jump to the associated line in the code display. scopes a list of the values that are in scope in the function, method, or event handler wher...
UI Tour - Firefox Developer Tools
script is paused, either because you've paused it with this button or because you've hit a breakpoint. step over (f10): steps to the next line of javascript code. step in (f11): steps into the function call on the current line of javascript code. step out (shift-f11): runs the script until the current function exits. a button that deactivates all breakpoints. a settings menu that
contains: disable javascript: disables javascript for this tab. this option enables you to see how your web page looks if the user has disabled javascript via an extension or a configuration setting. the setting is reset when the developer tools are closed (except in firefox 77, see bug 1640318). inline variable preview: enabled by default, this option displays variable values within the source p...
Debugger.Frame - Firefox Developer Tools
the execution context of this frame, and return a completion value describing how it completed.code is a string. if this frame’s environment property is null or type property is wasmcall, throw a typeerror. all extant handler methods, breakpoints, and so on remain active during the call. this function follows the invocation function conventions. codeis interpreted as strict mode code when it
contains a use strict directive, or the code executing in this frame is strict mode code. ifcode is not strict mode code, then variable declarations incode affect the environment of this frame. (in the terms used by the ecmascript specification, the variableenvironment of the execution context for the eval code is the variableenvironment of the execution context that this frame represents.) if implement...
Eyedropper - Firefox Developer Tools
e eyedropper button in its toolbar as you move the mouse around the page you'll see the current color value in the eyedropper change. clicking copies the current color value to the clipboard. changing a color value in the rules view color values appearing in the inspector's rules view have color samples next to them: clicking the sample shows a color picker popup. from firefox 31, the popup
contains an eyedropper icon: click this icon to activate the eyedropper. now, when you click the eyedropper, the color in the rules view is set to the color you selected. keyboard shortcuts command windows macos linux select the current color enter return enter dismiss the eyedropper esc esc esc move by 1 pixel arrow keys arrow keys...
Aggregate view - Firefox Developer Tools
you the number of bytes occupied by objects in each category, and that number as a percentage of the whole heap size for that tab. the screenshots in this section are taken from a snapshot of the monster example page. for example, in the screenshot above, you can see that: there are four array objects that account for 15% of the total heap. next to the type's name, there's an icon that
contains three stars arranged in a triangle: click this to see every instance of that type. for example, the entry for array tells us that there are four array objects in the snapshot. if we click the star-triangle, we'll see all four array instances: for each instance, you can see the retained size and shallow size of that instance. in this case, you can see that the first three arrays have a fairl...
DOM allocation example - Firefox Developer Tools
this article describes a very simple web page that we'll use to illustrate some features of the memory tool. you can try out the site at https://mdn.github.io/performance-scenarios/dom-allocs/alloc.html. ...
Dominators view - Firefox Developer Tools
emory tool in the settings, if you haven't already open the memory tool check "record call stacks" press the button labeled "make monsters!" take a snapshot switch to the "dominators" view analyzing the dominators tree you'll see the three arrays as the top three gc roots, each retaining about 23% of the total memory usage: if you expand an array, you'll see the objects (monsters) it
contains. each monster has a relatively small shallow size of 160 bytes. this includes the integer eye- and tentacle-counts. each monster has a bigger retained size, which is accounted for by the string used for the monster's name: all this maps closely to the memory graph we were expecting to see. one thing you might be wondering, though, is: where's the top-level object that retains all three arrays?
Monster example - Firefox Developer Tools
specifically: the code creates an object with three properties, each an array: one for fierce monsters one for friendly monsters one for monsters who haven't decided yet. for each array, the code creates and appends 5000 randomly-initialized monsters. each monster has: a string, for the monster's name ...
Network request details - Firefox Developer Tools
he server timing section lists any information provided in the server-timing header — this is used to surface any backend server timing metrics you've recorded (e.g. database read/write, cpu time, file system access, etc.). the header takes a series of descriptions and durations, which can be anything you like. in the above screenshot for example, the highlighted request's server-timing header
contains 4 items — data, markup, total, and miss. security tab if the site is being served over https, you get an extra tab labeled "security". this
contains details about the secure connection used including the protocol, the cipher suite, and certificate details: the security tab shows a warning for security weaknesses. currently it warns you about two weaknesses: using sslv3 instead of tls u...
Network Monitor - Firefox Developer Tools
ctively monitoring activity, the network monitor records network requests any time the toolbox is open, even if the network monitor itself is not selected. this means you can start debugging a page in, for example, the web console, then switch to the network monitor to see network activity without having to reload the page. ...
Edit fonts - Firefox Developer Tools
note: the updated font tools as shown in this article are available in firefox 63 onwards; if you are using an older version of firefox the tools will not look or behave quite the same, but they will be similar (most notably the font editor will not be available). the fonts tab the fonts tab is located on the right-hand side of the page inspector when it is docked to the bottom of the screen. ...
Examine and edit CSS - Firefox Developer Tools
tracks. see examine grid layouts for more on this. to view user-agent styles (i.e., browser-default css rules), enable "inspector > show browser styles" under the developer tool settings panel. (note that this setting is independent of the "browser styles" checkbox in the computed view.) user-agent styles are displayed against a different background, and the link to the filename and line number
contains the prefix (user agent): element {} rule the element {} rule at the top of the rules list isn't actually a css rule. it represents the css properties assigned to the element via its style attribute. this also gets the target icon: , giving you a convenient way to highlight the currently selected element in the page. filtering rules there's a box at the top of the rules view labeled "filt...
Inspect and select colors - Firefox Developer Tools
if you click on the color sample, you'll see a color picker popup, enabling you to change the color: if the color is a foreground color, the color picker tells you whether its contrast with the background color meets accessibility guidelines. hovering the mouse over the contrast message gives a more detailed explanation. ...
Animation inspector example: CSS transitions - Firefox Developer Tools
-serif; overflow: hidden; white-space: nowrap; display: inline-block; opacity: 0; width: 0; transition: opacity 500ms 150ms, width 500ms 150ms; } .icon#selected { filter: grayscale(0%); transform: scale(1.5); } .icon#selected+span { opacity: 1; width: 300px; } javascript content function toggleselection(e) { if (e.button != 0) { return; } if (e.target.classlist.
contains("icon")) { var wasselected = (e.target.getattribute("id") == "selected"); clearselection(); if (!wasselected) { e.target.setattribute("id", "selected"); } } } function clearselection() { var selected = document.getelementbyid("selected"); if (selected) { selected.removeattribute("id"); } } document.addeventlistener("click", toggleselection); ...
Allocations - Firefox Developer Tools
decide when to do what sort of garbage collection. in general, though: allocation pressure - allocating a lot of memory, or allocating memory at a high rate - makes spidermonkey more likely to run garbage collection, and more likely to run full, non-incremental garbage collection. if a gc event was caused by allocation pressure, then the sidebar on the right of the marker in the waterfall view
contains a link labeled "show allocation triggers". if you click this link, the devtools switches to the allocations view, and selects the region of time from the end of the last gc cycle to the start of the one you clicked on. this shows you all the allocations that collectively triggered this gc event: if you're seeing these problems, consider whether you can reduce the number or size of the allocati...
Cache Storage - Firefox Developer Tools
under the cache storage type within the storage inspector you can see the contents of any dom caches created using the cache api. if you select a cache, you'll see a list of the resources it
contains. for each resource, you'll see: the url for the resource. the status code for the request that was made to fetch it. ...
Extension Storage - Firefox Developer Tools
this storage type is only shown when debugging extensions. when selecting an extension id in the storage tree of the storage inspector, a table lists the details of all the extension storage present for the extension. this table
contains the following columns: key — the name of the stored item. value — the value of the stored item. storage area — the name of the area where the item is stored. ...
Toolbox - Firefox Developer Tools
main pane underneath: note: since firefox 62, you can drag and drop tabs in the main toolbar of the toolbox to reorder your tools as you wish (bug 1226272). docking mode by default, the toolbox appears docked to the bottom of the browser window, but you can also dock it to the right-hand side of the window, or make it a standalone window, using buttons in the toolbar. toolbar the toolbar
contains controls to activate a particular tool, to dock/float the window, and to close the window. node picker on the far left there's a button to activate the node picker. this lets you select a page element for inspection. see "selecting elements". toolbox-hosted tools then there is an array of labeled buttons which enables you to switch between the different tools hosted by the toolbox. the arra...
Web Console Helpers - Firefox Developer Tools
element and returns an array of matching nodes. if unspecified, element defaults to document. the resulttype parameter specifies the type of result to return; it can be an xpathresult constant, or a corresponding string: "number", "string", "bool", "node", or "nodes"; if not provided, any_type is used. :block (starting in firefox 80) followed by an unquoted string, blocks requests where the url
contains that string. in the network monitor, the string now appears and is selected in the request blocking sidebar. unblock with :unblock. cd() switches javascript evaluation context to a different iframe in the page. this helper accepts multiple different ways of identifying the frame to switch to. you can supply any of the following: a selector string to be passed to document.queryselector t...
The JavaScript input interpreter - Firefox Developer Tools
inux ( ctrl+r on mac) cycles backwards through the matches. once you have initiated the reverse search, you can use shift + f9 on windows or linux ( ctrl+s on mac) to search forward in the list of matches. you can also use the ⋀ and ⋁ icons in the expression search bar. when you find the expression you want, press enter (return) to execute the statement. working with iframes if a page
contains embedded iframes, you can use the cd() function to change the console's scope to a specific iframe, and then you can execute functions defined in the document hosted by that iframe. there are three ways to select an iframe using cd(): you can pass the iframe dom element: var frame = document.getelementbyid("frame1"); cd(frame); you can pass a css selector that matches the iframe: cd("#frame1"...
Web Console UI Tour - Firefox Developer Tools
funnel: click this icon to filter the messages that are displayed in the console. filter categories: you can click a filter category (such as errors, warnings, css, or xhr) to display just those types of messages. ...
AbstractRange.endContainer - Web APIs
the endcontainer property of the abstractrange interface returns the node in which the end of the range is located. syntax var endnode = range.endcontainer value the dom node which
contains the final character of the range. specifications specification status comment domthe definition of 'endcontainer' in that specification. living standard static rangethe definition of 'endcontainer' in that specification. editor's draft initial definition. ...
AbstractRange - Web APIs
create a new range object by calling createrange() on the document itself. we set the starting position of the range to the sixth character of the text node's string, and the end position to the length of the text node's string minus one. this sets the range to encompass the word "paragraph". we then finish up by calling clonecontents() on the range to create a new documentfragment object which
contains the portion of the document encompassed by the range. after that, we use appendchild() to add that fragment at the end of the document's body, as obtained from document.body. the result looks like this: specifications specification status comment domthe definition of 'abstractrange' in that specification. living standard ...
AddressErrors.city - Web APIs
an object based on addresserrors includes a city property when validation of the address fails for the value given for the address's city property. the returned string explains the error and should offer suggestions for how to correct it. syntax var cityerror = addresserrors.city; value if the value specified in the paymentaddress object's city property could not be validated, this property
contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. if the city value was validated successfully, this property is not included in the addresserrors object. specifications specification status comment payment request apithe definition of 'addresserrors.city' in that specification. candidate recommendation...
AddressErrors.dependentLocality - Web APIs
ddresserrors includes a dependentlocality property when the address's dependentlocality property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. syntax var localityerror = addresserrors.dependentlocality; value if the value specified in the paymentaddress object's dependentlocality property could not be validated, this property
contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. if the dependentlocality value was validated successfully, this property is not included in the addresserrors object. specifications specification status comment payment request apithe definition of 'addresserrors.dependentlocality' in that specification. ...
AddressErrors.languageCode - Web APIs
an object based on addresserrors includes a languagecode property when the address's languagecode property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. syntax var languageerror = addresserrors.languagecode; value if the value specified in the paymentaddress object's languagecode property could not be validated, this property
contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. this validation might be as simple as ensuring the text of the string is compliant with the syntax defined in bcp-47, or as detailed as actually verifying that the specified string matches a value from a database. if the languagecode value was validated successfully, this property...
AddressErrors.organization - Web APIs
ject based on addresserrors includes an organization property when the address's organization property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. syntax var organizationerror = addresserrors.organization; value if the value specified in the paymentaddress object's organization property could not be validated, this property
contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. for example, if validation simply ensures that only permitted characters are included in the organization's name, this might return a string such as "the organization name may only contain the letters a-z, digits, spaces, and commas." if the organization value was validated succes...
AddressErrors.phone - Web APIs
an object based on addresserrors includes a phone property when the address's phone property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. syntax var phoneerror = addresserrors.phone; value if the value specified in the paymentaddress object's phone property could not be validated, this property
contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. if the phone value was validated successfully, this property is not included in the addresserrors object. specifications specification status comment payment request apithe definition of 'addresserrors.phone' in that specification. candidate recommendation initial definition. ...
AddressErrors.postalCode - Web APIs
an object based on addresserrors includes a postalcode property when the address's postalcode property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. syntax var postcodeerror = addresserrors.postcode; value if the value specified in the paymentaddress object's postalcode property could not be validated, this property
contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. if the postalcode value was validated successfully, this property is not included in the addresserrors object. specifications specification status comment payment request apithe definition of 'addresserrors.postalcode' in that specification. candidate recommenda...
AddressErrors.recipient - Web APIs
an object based on addresserrors includes a recipient property when the address's recipient property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. syntax var recipienterror = addresserrors.recipient; value if the value specified in the paymentaddress object's recipient property could not be validated, this property
contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. if the recipient value was validated successfully, this property is not included in the addresserrors object. specifications specification status comment payment request apithe definition of 'addresserrors.recipient' in that specification. candidate recommendatio...
AddressErrors.region - Web APIs
an object based on addresserrors includes a region property when the address's region property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. syntax var regionerror = addresserrors.region; value if the value specified in the paymentaddress object's region property could not be validated, this property
contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. if the region value was validated successfully, this property is not included in the addresserrors object. specifications specification status comment payment request apithe definition of 'addresserrors.region' in that specification. candidate recommendation initial definiti...
AddressErrors.regionCode - Web APIs
an object based on addresserrors includes a regioncode property when the address's regioncode property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. syntax var regioncodeerror = addresserrors.regioncode; value if the value specified in the paymentaddress object's regioncode property could not be validated, this property
contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. if the regioncode value was validated successfully, this property is not included in the addresserrors object. usage notes the region code is derived from the iso 3166-2 country subdivision name standard. specifications specification status comment payment re...
AddressErrors.sortingCode - Web APIs
an object based on addresserrors includes a sortingcode property when the address's sortingcode property couldn't be validated. the returned string explains the error and should offer suggestions for how to correct it. syntax var sortingcodeerror = addresserrors.sortingcode; value if the value specified in the paymentaddress object's sortingcode property could not be validated, this property
contains a domstring offering a human-readable explanation of the validation error and offers suggestions for correcting it. if the sortingcode value was validated successfully, this property is not included in the addresserrors object. specifications specification status comment payment request apithe definition of 'addresserrors.sortingcode' in that specification. candidate...
AddressErrors - Web APIs
ils); } the shippingaddresschange event doesn't receive the paymentrequest object directly, so we fetch it from the target property of the event. if the request's shippingaddress has a value for country which isn't in the array validcountries, we generate the error. that's done by removing all shipping options currently set on the request, then set up an object named shippingaddresserrors which
contains a country property which is an error message describing why the stated country isn't being permitted as a value. then a paymentdetailsupdate object is created with its error set to a generic message about address errors and with the reset of the object's values taken from shippingaddresserrors, and, using "...defaultpaymentdetails" as the final entry in the object, the remeainder of the properti...
AnimationEffect.getComputedTiming() - Web APIs
ration is the string auto, this attribute will return 0. fill the auto value is replaced with the appropriate effecttiming.fill value. these values are comparable to the computed styles of an element returned using window.getcomputedstyle(elem). syntax var currenttimevalues = animation.getcomputedtiming(); parameters none. return value a computedeffecttiming dictionary object, which
contains the following properties: endtime the end time of the animation in milliseconds from the animation's start (if the keyframeeffect is associated with an animation). (also includes effecttiming.enddelay in that calculation.) activeduration the length of time in milliseconds that the animation's effects will run. this is equal to the iteration duration multiplied by the iteration count. local...
AudioBuffer.duration - Web APIs
stereo buffer at the // sample rate of the audiocontext var framecount = audioctx.samplerate * 2.0; var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.samplerate); button.onclick = function() { // fill the buffer with white noise; // just random values between -1.0 and 1.0 for (var channel = 0; channel < channels; channel++) { // this gives us the actual arraybuffer that
contains the data var nowbuffering = myarraybuffer.getchanneldata(channel); for (var i = 0; i < framecount; i++) { // math.random() is in [0; 1.0] // audio needs to be in [-1.0; 1.0] nowbuffering[i] = math.random() * 2 - 1; } } console.log(myarraybuffer.duration); } specification specification status comment web audio apithe definition of 'dura...
AudioBuffer.length - Web APIs
stereo buffer at the // sample rate of the audiocontext var framecount = audioctx.samplerate * 2.0; var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.samplerate); button.onclick = function() { // fill the buffer with white noise; // just random values between -1.0 and 1.0 for (var channel = 0; channel < channels; channel++) { // this gives us the actual arraybuffer that
contains the data var nowbuffering = myarraybuffer.getchanneldata(channel); for (var i = 0; i < framecount; i++) { // math.random() is in [0; 1.0] // audio needs to be in [-1.0; 1.0] nowbuffering[i] = math.random() * 2 - 1; } } console.log(myarraybuffer.length); } specification specification status comment web audio apithe definition of 'length'...
AudioBuffer.numberOfChannels - Web APIs
stereo buffer at the // sample rate of the audiocontext var framecount = audioctx.samplerate * 2.0; var myarraybuffer = audioctx.createbuffer(2, framecount, audioctx.samplerate); button.onclick = function() { // fill the buffer with white noise; // just random values between -1.0 and 1.0 for (var channel = 0; channel < channels; channel++) { // this gives us the actual arraybuffer that
contains the data var nowbuffering = myarraybuffer.getchanneldata(channel); for (var i = 0; i < framecount; i++) { // math.random() is in [0; 1.0] // audio needs to be in [-1.0; 1.0] nowbuffering[i] = math.random() * 2 - 1; } } console.log(myarraybuffer.numberofchannels); } specification specification status comment web audio apithe definition o...
CSSUnparsedValue - Web APIs
n 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). cssunparsedvalue.foreach() executes a provided function once for each element of the cssunparsedvalue object. cssunparsedvalue.keys() returns a new array iterator object that
contains the keys for each index in the cssunparsedvalue object. cssunparsedvalue.values() returns a new array iterator object that
contains the values for each index in the cssunparsedvalue object. specifications specification status comment css typed om level 1the definition of 'cssunparsedvalue' in that specification. working draft initial definition. ...
CSSValue.cssValueType - Web APIs
only property of the cssvalue interface represents the type of the current computed css property value. syntax cssvaluetype = cssvalue.cssvaluetype; value an unsigned short representing a code defining the type of the value. possible values are: constant description css_custom the value is a custom value. css_inherit the value is inherited and the csstext
contains "inherit". css_primitive_value the value is a primitive value and an instance of the cssprimitivevalue interface can be obtained by using binding-specific casting methods on this instance of the cssvalue interface. css_value_list the value is a cssvalue list and an instance of the cssvaluelist interface can be obtained by using binding-specific casting methods on this inst...
CSSValue - Web APIs
nt computed value of a css property. properties cssvalue.csstext a domstring representing the current value. cssvalue.cssvaluetyperead only an unsigned short representing a code defining the type of the value. possible values are: constant description css_custom the value is a custom value. css_inherit the value is inherited and the csstext
contains "inherit". css_primitive_value the value is a primitive value and an instance of the cssprimitivevalue interface can be obtained by using binding-specific casting methods on this instance of the cssvalue interface. css_value_list the value is a cssvalue list and an instance of the cssvaluelist interface can be obtained by using binding-specific casting methods on t...
CSS Painting API - Web APIs
you can then apply these values to properties like background-image to set complex custom backgrounds on an element. ...
CSS Typed Object Model API - Web APIs
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). cssunparsedvalue.foreach() method executing a provided function once for each element of the cssunparsedvalue. cssunparsedvalue.keys() method returning a new array iterator object that
contains the keys for each index in the array. csskeywordvalue serialization the csskeywordvalue interface of the the css typed object model api creates an object to represent css keywords and other identifiers. csskeywordvalue.csskeywordvalue() constructor constructor creates a new csskeywordvalue.csskeywordvalue() object which represents css keywords and other identifiers. csskeywordvalue.value(...
CanvasRenderingContext2D.beginPath() - Web APIs
ingcontext2d.beginpath() method of the canvas 2d api starts a new path by emptying the list of sub-paths. call this method when you want to create a new path. note: to create a new sub-path, i.e., one matching the current canvas state, you can use canvasrenderingcontext2d.moveto(). syntax void ctx.beginpath(); examples creating distinct paths this example creates two paths, each of which
contains a single line. html <canvas id="canvas"></canvas> javascript the beginpath() method is called before beginning each line, so that they may be drawn with different colors. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // first path ctx.beginpath(); ctx.strokestyle = 'blue'; ctx.moveto(20, 20); ctx.lineto(200, 20); ctx.stroke(); // second path ctx.be...
CanvasRenderingContext2D.getImageData() - Web APIs
ta will be extracted. positive values are down, and negative are up. return value an imagedata object containing the image data for the rectangle of the canvas specified. the coordinates of the rectangle's top-left corner are (sx, sy), while the coordinates of the bottom corner are (sx + sw, sy + sh). exceptions indexsizeerror thrown if either sw or sh are zero. securityerror the canvas
contains or may contain pixels which were loaded from an origin other than the one from which the document itself was loaded. to avoid securityerror being thrown in this situation, configure cors to allow the source image to be used in this way. see allowing cross-origin use of images and canvas. example getting image data from a canvas this example draws a rectangle, and then uses getimagedata() to g...
CanvasRenderingContext2D.setTransform() - Web APIs
sults in no scaling. b (m12) vertical skewing. c (m21) horizontal skewing. d (m22) vertical scaling. a value of 1 results in no scaling. e (dx) horizontal translation (moving). f (dy) vertical translation (moving). the newer type consists of a single parameter, matrix, representing a 2d transformation matrix to set (technically, a dommatrixinit object; any object will do as long as it
contains the 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 ...
CanvasRenderingContext2D - Web APIs
if a dirty rectangle is provided, only the pixels from that rectangle are painted. image smoothing canvasrenderingcontext2d.imagesmoothingenabled image smoothing mode; if disabled, images will not be smoothed if scaled. canvasrenderingcontext2d.imagesmoothingquality allows you to set the quality of image smoothing. the canvas state the canvasrenderingcontext2d rendering context
contains a variety of drawing style states (attributes for line styles, fill styles, shadow styles, text styles). the following methods help you to work with that state: canvasrenderingcontext2d.save() saves the current drawing style state using a stack so you can revert any change you make to it using restore(). canvasrenderingcontext2d.restore() restores the drawing style state to the last element...
Advanced animations - Web APIs
t the motion itself and are going to add some physics to make our animations more advanced. drawing a ball we are going to use a ball for our animation studies, so let's first draw that ball onto the canvas. the following code will set us up. <canvas id="canvas" width="600" height="300"></canvas> as usual, we need a drawing context first. to draw the ball, we will create a ball object which
contains properties and a draw() method to paint it on the canvas. var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); var ball = { x: 100, y: 100, radius: 25, color: 'blue', draw: function() { ctx.beginpath(); ctx.arc(this.x, this.y, this.radius, 0, math.pi * 2, true); ctx.closepath(); ctx.fillstyle = this.color; ctx.fill(); } }; ball.draw...
Using channel messaging - Web APIs
e via the window.postmessage method, we run the initport function. this saves the transferred port and register an onmessage handler that will be called each time a message is passed through our messagechannel. when a message is received from the main page we create a list item and insert it in the unordered list, setting the textcontent of the list item equal to the event's data attribute (this
contains the actual message). next, we post a confirmation message back to the main page via the message channel by calling messageport.postmessage on messagechannel.port2 that was initially transferred to the iframe. receiving the confirmation in the main page returning to the main page, let's now look at the onmessage handler function. // handle messages received on port1 function onmessage(e) { ...
ChildNode - Web APIs
it's implemented by element, documenttype, and characterdata objects. properties there are neither inherited, nor specific properties. methods there are no inherited methods. childnode.remove() removes this childnode from the children list of its parent. childnode.before() inserts a set of node or domstring objects in the children list of this childnode's parent, just before this childnode. domstring objects are inserted as equivalent text nodes. childnode.after() inserts a set of node or domstring objects in the children list of this childnode's parent, just after this childnode. domstring objects are inserted as equivalent text nodes. ...
Clipboard.read() - Web APIs
ns.query({name: "clipboard-read"}).then(result => { // if permission to read the clipboard is granted or if the user will // be prompted to allow it, we proceed. if (result.state == "granted" || result.state == "prompt") { navigator.clipboard.read().then(data => { for (let i=0; i<data.items.length; i++) { if (data.items[i].type != "image/png") { alert("clipboard
contains non-image data. unable to access it."); } else { const blob = data.items[i].gettype("image/png"); imgelem.src = url.createobjecturl(blob); } } }); } }); note: at this time, while firefox does implement read(), it does not recognize the "clipboard-read" permission, so attempting to use the permissions api to manage access to the api will not work.
Console.table() - Web APIs
// an object whose properties are objects var family = {}; family.mother = new person("jane", "smith"); family.father = new person("john", "smith"); family.daughter = new person("emily", "smith"); console.table(family); restricting the columns displayed by default, console.table() lists all elements in each row. you can use t...
Console API - Web APIs
browsers eventually settled on implementing this behavior — although some implementations still have their own additional proprietary functions. find out about these at: google chrome devtools implementation safari devtools implementation usage is very simple — the console object — available via window.console, or workerglobalscope.console in workers; accessible using just console —
contains many methods that you can call to perform rudimentary debugging tasks, generally focused around logging various values to the browser's web console. by far the most commonly-used method is console.log, which is used to log the current value contained inside a specific variable. interfaces console provides rudimentary debugging functionality, including logging, stack traces, timers, and coun...
Constraint validation API - Web APIs
ed, one of the custom error messages will be shown. if it is valid, it will submit as you'd expect. for this to happen, the custom validity has to be cancelled, by invoking setcustomvalidity() with an empty string value. we therefore do this every time the input event is raised. if you don't do this, and a custom validity was previously set, the input will register as invalid, even if it current
contains a valid value on submission. note: firefox supported a proprietary error attribute — x-moz-errormessage — for many versions, which allowed you set custom error messages in a similar way. this has been removed as of version 66 (see bug 1513890). specifications specification status comment html living standardthe definition of 'constraint validation api' in that sp...
ContentIndexEvent - Web APIs
the contentdelete event is only fired when the deletion happens due to interaction with the browser's built-in user interface. it is not fired when the contentindex.delete method is called. constructor contentindexevent() creates and returns a new contentindexevent object whose type and other options are configured as specified. ...
Credential.type - Web APIs
the type property of the credential interface returns a domstring containing the credential's type. valid values are password, federated and public-key. syntax var credtype = credential.type; value a domstring
contains a credential's given name. example // tbd specifications specification status comment credential management level 1 working draft initial definition. ...
CredentialsContainer.get() - Web APIs
wed by the options argument. for example: if options.password exists, then the passwordcredential.[[collectfromcredentialstore]] is called. this method is restricted to top-level contexts. calls to it within an <iframe> element will resolve without effect. syntax var promise = credentialscontainer.get([options]) parameters options optional an object of type credentialrequestoptions that
contains options for the request. the options include criteria that the credentials are required or allowed to have, and options for interacting with the user. it can contain the following properties: password: a boolean indicating that returned credential instances should include user (as opposed to federated) credentials. federated: a federatedcredentialrequestoptions object containing requiremen...
CryptoKeyPair - Web APIs
the cryptokeypair dictionary of the web crypto api represents a key pair for an asymmetric cryptography algorithm, also known as a public-key algorithm. a cryptokeypair object can be obtained using subtlecrypto.generatekey(), when the selected algorithm is one of the asymmetric algorithms: rsassa-pkcs1-v1_5, rsa-pss, rsa-oaep, ecdsa, or ecdh. it
contains two properties, which are both cryptokey objects: a privatekey property containing the private key and a publickey property containing the public key. properties cryptokey.privatekey a cryptokey object representing the private key. for encryption and decryption algorithms, this key is used to decrypt. for signing and verification algorithms it is used to sign. cryptokey.publickey a cryptokey object representing the public key. for encryp...
CustomElementRegistry.define() - Web APIs
structor for the new custom element. options optional object that controls how the element is defined. one option is currently supported: extends: string specifying the name of a built-in element to extend. used to create a customized built-in element. return value void. exceptions exception description notsupportederror the customelementregistry already
contains an entry with the same name or the same constructor (or is otherwise already defined), or extends is specified and it is a valid custom element name, or extends is specified but the element it is trying to extend is an unknown element. syntaxerror the provided name is not a valid custom element name. typeerror the referenced constructor is not a constructor. note: ...
DOMError - Web APIs
the domerror interface describes an error object that
contains an error name. properties domerror.name read only returns a domstring representing one of the error type names (see below). domerror.message read only returns a domstring representing a message or description associated with the given error type name. error types type description indexsizeerror the index is not in the allowed range (e.g. thrown in a range object). hierarchyrequesterror the node tree hierarchy is not correct. wrongdocumenterror the object is in the wrong document. invalidcharactererror the string
contains invalid characters. nomodificationallowederror the object can not be modified. notfounderror the object can not be ...
DOMException() - Web APIs
the domexception() constructor returns a domexception object with a specified message and name. syntax var domexception = new domexception(); var domexception = new domexception(message); var domexception = new domexception(message, name); parameters message optional a description of the exception. if not present, the empty string '' is used. name optional returns a domstring that
contains one of the strings associated with an error constant. return value domexception a newly created domexception object. example tbd specifications specification status comment web idlthe definition of 'domexception()' in that specification. candidate recommendation adds the constructor for the domexception class. browser compatibility the compatibility ...
DOMException.code - Web APIs
this field is used for historical reasons. new dom exceptions don't use this anymore: they put this info in the domexception.name attribute. syntax var domexceptioncode = domexceptioninstance.code; value a short number. specifications specification status comment web idlthe definition of 'code' in that specification. candidate recommendation browser compatibility the compatibility table on this page is generated from structured data. ...
DOMMatrixReadOnly.flipX() - Web APIs
rixreadonly interface creates a new matrix being the result of the original matrix flipped about the x-axis. syntax dommatrix.flipx() return value returns a dommatrix containing a new matrix being the result of the original matrix flipped about the x-axis, which is equivalent to multiplying the matrix by dommatrix(-1, 0, 0, 1, 0, 0). the original matrix is not modified. examples this svg
contains two paths in the shape of a triangle, both drawn to the same position. note that the x co-ordinate of the viewbox attribute is negative, showing us content from both sides of the x-axis. <svg width="100" height="100" viewbox="-50 0 100 100"> <path fill="red" d="m 0 50 l 50 0 l 50 100 z" /> <path id="flipped" fill="blue" d="m 0 50 l 50 0 l 50 100 z" /> </svg> this javascript first creates a...
DOMMatrixReadOnly.scale() - Web APIs
is applied about the z-axis, the resulting matrix will be a 4x4 3d matrix. note: at time of writing, firefox still supports an older version of the specification that accepts either one or three values. dommatrix.scale(scale[, originx][, originy]) we'll show an example of how you can deal with the cross-browser support implications of this in the examples section, below. ...
DOMMatrixReadOnly.translate() - Web APIs
lating vector. if not supplied, this defaults to 0. if this is anything other than 0, the resulting matrix will be 3d. return value returns a dommatrix containing a new matrix being the result of the matrix being translated by the given vector. the original matrix is not modified. if a translation is applied about the z-axis, the resulting matrix will be a 4x4 3d matrix. ...
DOMPoint - Web APIs
e value of the dompoint. examples in the webxr device api, dompointreadonly values are used to represent positions and orientations. in the following snippet, the pose of the xr device (such as a vr headset or phone with ar capabilities) can be retrieved by calling using xrframe.getviewerpose() during an xrsession animation frame, then accessing the resulting xrpose's transform property, which
contains two dompointreadonly attributes: position as a vector and orientation as a quaternion. function onxrframe(time, xrframe) { let viewerpose = xrframe.getviewerpose(xrreferencespace); if (viewerpose) { let position = viewerpose.transform.position; let orientation = viewerpose.transform.orientation; console.log('xr viewer position: {x: ' + roundtotwo(position.x) ...
Binary strings - Web APIs
e size of the data so represented is twice as big as it would be in normal binary format, however this will not be visible to the final user, since the length of javascript strings is calculated using two bytes as the unit. binary strings are not part of the javascript language design. however at least one native function requires binary strings as its input, btoa(): invoking it on a string that
contains codepoints greater than 255 will cause a character out of range error. the reason that brought to use utf-16 code units as placeholders for uint8 numbers is that as web applications become more and more powerful (adding features such as audio and video manipulation, access to raw data using websockets, and so forth) it has become clear that there are times when it would be helpful for javascript...
DOMStringList - Web APIs
a type returned by some apis which
contains a list of domstring (strings). properties domstringlist.length read only returns the length of the list. methods domstringlist.item() returns a domstring. domstringlist.
contains() returns boolean indicating if the given string is in the list specifications specification status comment html living standardthe definition of 'domstringlist' in that specification. living standard initial specification ...
DOMTokenList.replace() - Web APIs
= classes; } else { span.textcontent = 'token not replaced successfully'; } the output looks like this: polyfill the following polyfill will add the replace method to the domtokenlist class. the following code will only work with ie10-11. to use with earlier versions of ie, refer to the polyfill at element.classlist#polyfill domtokenlist.prototype.replace = function (a, b) { if (this.
contains(a)) { this.add(b); this.remove(a); return true; } return false; } specifications specification status comment domthe definition of 'replace()' in that specification. living standard initial definition ...
DOMTokenList - Web APIs
lways case-sensitive. properties domtokenlist.length read only is an integer representing the number of objects stored in the object. domtokenlist.value a stringifier property that returns the value of the list as a domstring. methods domtokenlist.item(index) returns the item in the list by its index, or undefined if index is greater than or equal to the list's length. domtokenlist.
contains(token) returns true if the list
contains the given token, otherwise false. domtokenlist.add(token1[, token2[, ...tokenn]]) adds the specified token(s) to the list. domtokenlist.remove(token1[, token2[, ...tokenn]]) removes the specified token(s) from the list. domtokenlist.replace(oldtoken, newtoken) replaces token with newtoken. domtokenlist.supports(token) returns true if a given token...
DataTransferItem - Web APIs
each item in the list is a datatransferitem object. this interface has no constructor. properties datatransferitem.kind read only the kind of drag data item, string or file. datatransferitem.type read only the drag data item's type, typically a mime type. methods datatransferitem.getasfile() returns the file object associated with the drag data item (or null if the drag item is not a file). ...
DataTransferItemList.add() - Web APIs
some example types are text/html and text/plain. file a file object. no type needs to be given in this case. return value a datatransferitem containing the specified data. if the drag item couldn't be created (for example, if the associated datatransfer object has no data store), null is returned. exceptions notsupportederror a string data parameter was provided, and the list already
contains an item whose kind is "plain unicode string" and whose type is equal to the specified type parameter. example this example shows the use of the add() method. html <div> <p id="source" ondragstart="dragstart_handler(event);" ondragend="dragend_handler(event);" draggable="true"> select this element, drag it to the drop zone and then release the selection to move the element.</p> </div> <div ...
DeprecationReportBody - Web APIs
we loop over each report using a basic for loop, then iterate over each entry of in the report's body (a deprecationreportbody instance) using a for...in structure, displaying each key/value pair inside a list item. specifications specification status comment reporting apithe definition of 'deprecationreportbody...
Using light sensors - Web APIs
deventlistener('devicelight', function(event) { var bodybg= document.body.style; //event.value is the lux value returned by the sensor on the device if (event.value < 100) { alert('hey, you! you are working in a dark environment'); bodybg.backgroundcolor="lightgrey"; } else { bodybg.backgroundcolor="#fff"; } }); this example shows how the api can actually be used in the wild. if your app
contains a lot of white in the ui, it is usually beneficial to the user to change the ui to a darker color in a darker environment. the code alerts the user that they are working in a dark environment and then changes the page's background to a darker color. specifications specification status comment ambient light sensorthe definition of 'ambient light events' in that speci...
DirectoryEntrySync - Web APIs
exceed its storage quota. security_err the application does not have permission to access the element referred to by path. [ todo: explain why ] type_mismatch_err the path supplied exists, but it is not a directory. removerecursively() deletes a directory and all of its contents. you cannot delete the root directory of a file system. if you delete a directory that
contains a file that cannot be removed or if an error occurs while the deletion is in progress, some of the contents might not be deleted. catch these cases with error callbacks and retry the deletion. void removerecursively ( ) raises (fileexception); parameter none returns void exceptions this method can raise a fileexception with the following codes: exception description ...
DisplayMediaStreamConstraints.video - Web APIs
ded in the video if it's moving, and for a short time after it stops moving. never the mouse cursor is never included in the shared video. displaysurface a constraindomstring which specifies the types of display surface that may be selected by the user. this may be a single one of the following strings, or a list of them to allow multiple source surfaces: application the stream
contains all of the windows of the application chosen by the user rendered into the one video track. browser the stream
contains the contents of a single browser tab selected by the user. monitor the stream's video track
contains the entire contents of one or more of the user's screens. window the stream
contains a single window selected by the user for sharing. logicalsurface a constrai...
Document.all - Web APIs
the document interface's read-only all property returns an htmlallcollection rooted at the document node. in other words, it returns all of the document's elements, accessible by order (like an array) and by id (like a regular object). syntax var htmlallcollection = document.all; value an htmlallcollection which
contains every element in the document. conversion to boolean document.all is the only falsy object accessible to javascript, because it has the [[ishtmldda]] internal slot. this was done because of compatibility with older versions of internet explorer. more information about this can be found in this answer from stackoverflow. specifications specification status comment html living standardthe definition of 'all' in that specification. living sta...
Document.anchors - Web APIs
specifications specification status comment html living standardthe definition of 'document.anchors' in that specification. living standard obsoleted. document object model (dom) level 2 html specificationthe definition of 'document.anchors' in that specification. ...
Document.body - Web APIs
ent exists. syntax const objref = document.body document.body = objref example // given this html: <body id="oldbodyelement"></body> alert(document.body.id); // "oldbodyelement" const anewbodyelement = document.createelement("body"); anewbodyelement.id = "newbodyelement"; document.body = anewbodyelement; alert(document.body.id); // "newbodyelement" notes document.body is the element that
contains the content for the document. in documents with <body> contents, returns the <body> element, and in frameset documents, this returns the outermost <frameset> element. though the body property is settable, setting a new body on a document will effectively remove all the current children of the existing <body> element. specification specification status comment html l...
Document.createAttribute() - Web APIs
mplementing the attr interface. the dom does not enforce what sort of attributes can be added to a particular element in this manner. the string given in parameter is converted to lowercase. syntax attribute = document.createattribute(name) parameters name is a string containing the name of the attribute. return value a attr node. exceptions invalid_character_err if the parameter
contains invalid characters for xml attribute. example var node = document.getelementbyid("div1"); var a = document.createattribute("my_attrib"); a.value = "newval"; node.setattributenode(a); console.log(node.getattribute("my_attrib")); // "newval" specifications specification status comment domthe definition of 'document.createattribute()' in that specification. living st...
Document.getElementsByName() - Web APIs
le <!doctype html> <html lang="en"> <title>example: using document.getelementsbyname</title> <input type="hidden" name="up"> <input type="hidden" name="down"> <script> var up_names = document.getelementsbyname("up"); console.log(up_names[0].tagname); // displays "input" </script> </html> notes the name attribute can only be applied in (x)html documents. the returned nodelist collection
contains all elements with the given name, such as <meta>, <object>, and even elements which do not support the name attribute at all. the getelementsbyname method works differently in ie10 and below. there, getelementsbyname() also returns elements that have an id attribute with the specified value. be careful not to use the same string as both a name and an id. the getelementsbyname method works di...
Document.location - Web APIs
though document.location is a read-only location object, you can also assign a domstring to it. this means that you can work with document.location as if it were a string in most cases: document.location = 'http://www.example.com' is a synonym of document.location.href = 'http://www.example.com'. to retrieve just the url as a string, the read-only document.url property can also be used. if the current document is not in a browsing context, the returned value is null. ...
Document - Web APIs
ed in gecko 14 (firefox 14 / thunderbird 14 / seamonkey 2.11). internet explorer notes microsoft defines some non-standard properties: document.filesize* returns size in bytes of the document. starting with internet explorer 11, that property is no longer supported. see msdn. internet explorer does not support all methods from the node interface in the document interface: document.
contains as a work-around, document.body.
contains() can be used. specifications specification status comment domthe definition of 'document' in that specification. living standard intend to supersede dom 3 html living standardthe definition of 'document' in that specification. living standard turn the htmldocument interface into a document extension. ...
Locating DOM elements using selectors - Web APIs
to determine what element or elements should be returned. for example, to select all paragraph (p) elements in a document whose css class is either warning or note, you can do the following: var special = document.queryselectorall( "p.warning, p.note" ); you can also query by id. for example: var el = document.queryselector( "#main, #basic, #exclamation" ); after executing the above code, el
contains the first element in the document whose id is one of main, basic, or exclamation. you may use any css selectors with the queryselector() and queryselectorall() methods. ...
Document Object Model (DOM) - Web APIs
cts web pages to scripts or programming languages by representing the structure of a document—such as the html representing a web page—in memory. usually, that means javascript, although modeling html, svg, or xml documents as objects are not part of the core javascript language, as such. the dom represents a document with a logical tree. each branch of the tree ends in a node, and each node
contains objects. dom methods allow programmatic access to the tree. with them, you can change the document's structure, style, or content. nodes can also have event handlers attached to them. once an event is triggered, the event handlers get executed. to learn more about what the dom is and how it represents documents, see our article introduction to the dom. dom interfaces attr cdatasection ...
DragEvent.dataTransfer - Web APIs
example this example illustrates accessing the drag and drop data within the dragend event handler. function processdata(d) { // process the data ... ...
EXT_texture_compression_bptc - Web APIs
of 128 bits of rgba or image data. see also bc7 format. ext.compressed_srgb_alpha_bptc_unorm_ext compresses 8-bit fixed-point data. each 4x4 block of texels consists of 128 bits of srgb_alpha or image data. see also bc7 format. ext.compressed_rgb_bptc_signed_float_ext compresses high dynamic range signed floating point values. each 4x4 block of texels consists of 128 bits of rgb data. it only
contains rgb data, so the returned alpha value is 1.0. see also bc6h format. ext.compressed_rgb_bptc_unsigned_float_ext compresses high dynamic range unsigned floating point values. each 4x4 block of texels consists of 128 bits of rgb data. it only
contains rgb data, so the returned alpha value is 1.0. see also bc6h format. examples var ext = gl.getextension('ext_texture_compression_bptc'); var text...
Element: MozMousePixelScroll event - Web APIs
negative values indicating the scrolling movement is either toward the bottom or toward the right, and positive values indicating scrolling to the top or left. if the platform's native mouse wheel events indicate the scroll distance in terms of lines or pages, the value of detail is computed using that value and the line height or page width/height of the nearest ancestor scrollable element that
contains the target element. note: on macos, the scroll distance (and therefore the value of detail) is computed based on the accelerated scroll distance. the value of detail is never 0 if the events are legitimate. ...
Element: cut event - Web APIs
bubbles yes cancelable yes interface clipboardevent event handler property oncut the event's default action is to copy the current selection (if any) to the system clipboard and remove it from the document. ...
Element: fullscreenerror event - Web APIs
screenerror event is fired when the browser cannot switch to full-screen mode. bubbles yes cancelable no interface event event handler property onfullscreenerror as with the fullscreenchange event, two fullscreenerror events are fired; the first is sent to the element which failed to change modes, and the second is sent to the document which
contains that element. for some reasons that switching into full-screen mode might fail, see the guide to the fullscreen api. examples const requestor = document.queryselector('div'); requestor.addeventlistener('fullscreenerror', (event) => { console.error('an error occurred changing into fullscreen'); console.log(event); }); requestor.requestfullscreen(); specifications specification ...
Element.getBoundingClientRect() - Web APIs
the case that the standard box model is being used, or width/height only if box-sizing: border-box has been set on it. syntax domrect = element.getboundingclientrect(); value the returned value is a domrect object which is the union of the rectangles returned by getclientrects() for the element, i.e., the css border-boxes associated with the element. the result is the smallest rectangle which
contains the entire element, with read-only left, top, right, bottom, x, y, width, and height properties describing the overall border-box in pixels. properties other than width and height are relative to the top-left of the viewport. empty border-boxes are completely ignored. if all the element's border-boxes are empty, then a rectangle is returned with a width and height of zero and where the top and...
Element.getClientRects() - Web APIs
the getclientrects() method of the element interface returns a collection of domrect objects that indicate the bounding rectangles for each css border box in a client. syntax let rectcollection = object.getclientrects(); return value the returned value is a collection of domrect objects, one for each css border box associated with the element. each domrect object
contains read-only left, top, right and bottom properties describing the border box, in pixels, with the top-left relative to the top-left of the viewport. for tables with captions, the caption is included even though it's outside the border box of the table. when called on svg elements other than an outer-<svg>, the "viewport" that the resulting rectangles are relative to is the viewport that the element's outer-<svg> establishes (a...
Element.getElementsByClassName() - Web APIs
the method getelementsbyclassname() on the document interface works essentially the same way, except it acts on the entire document, starting at the document root. syntax var elements = element.getelementsbyclassname(names); parameters names a domstring containing one or more class names to match on, separated by whitespace. return value an htmlcollection providing a live-updating list of every element which is a member of every class in names. ...
Element.innerHTML - Web APIs
e box with the class "log". we add a second method that logs information about mouseevent based events (such as mousedown, click, and mouseenter): function logevent(event) { var msg = "event <strong>" + event.type + "</strong> at <em>" + event.clientx + ", " + event.clienty + "</em>"; log(msg); } then we use this as the event handler for a number of mouse events on the box that
contains our log: var boxelem = document.queryselector(".box"); boxelem.addeventlistener("mousedown", logevent); boxelem.addeventlistener("mouseup", logevent); boxelem.addeventlistener("click", logevent); boxelem.addeventlistener("mouseenter", logevent); boxelem.addeventlistener("mouseleave", logevent); html the html is quite simple for our example. <div class="box"> <div><strong>log:</strong></div...
Element.setAttribute() - Web APIs
ation. since the specified value gets converted into a string, specifying null doesn't necessarily do what you expect. instead of removing the attribute or setting its value to be null, it instead sets the attribute's value to the string "null". if you wish to remove an attribute, call removeattribute(). return value undefined. exceptions invalidcharactererror the specified attribute name
contains one or more characters which are not valid in attribute names. example in the following example, setattribute() is used to set attributes on a <button>. html <button>hello world</button> javascript var b = document.queryselector("button"); b.setattribute("name", "hellobutton"); b.setattribute("disabled", ""); this demonstrates two things: the first call to setattribute() above shows ...
HTMLSelectElement - Web APIs
ired to select a value before submitting the form. htmlselectelement.selectedindex a long reflecting the index of the first selected <option> element. the value -1 indicates no element is selected. htmlselectelement.selectedoptionsread only an htmlcollection representing the set of <option> elements that are selected. htmlselectelement.size a long reflecting the size html attribute, which
contains the number of visible items in the control. the default is 1, unless multiple is true, in which case it is 4. htmlselectelement.typeread only a domstring represeting the form control's type. when multiple is true, it returns "select-multiple"; otherwise, it returns "select-one". htmlselectelement.validationmessageread only a domstring representing a localized message that describes the vali...
HTMLStyleElement - Web APIs
to manipulate css, see using dynamic styling information for an overview of the objects used to manipulate specified css properties using the dom. ...
HTMLTableCellElement - Web APIs
html living standardthe definition of 'htmltablecellelement' in that specification. living standard no change from html5. html5the definition of 'htmltablecellelement' in that specification. recommendation the following properties have been obsoleted: align, axis, bgcolor, height, width, ch, choff, nowrap, and valign. the headers property is now read-only and
contains a domsettabletokenlist rather than a mere domstring. the colspan and rowspan properties are now unsigned long. document object model (dom) level 2 html specificationthe definition of 'htmltablecellelement' in that specification. obsolete the cellindex property is now read-only. document object model (dom) level 1 specificationthe definition of 'htmltablecellelement' in ...
HTMLTemplateElement - Web APIs
-width="2px" /><text x="396" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmltemplateelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface inherits the properties of htmlelement. content read only a read-only documentfragment which
contains the dom subtree representing the <template> element's template contents. methods this interface inherits the methods of htmlelement. specifications specification status comment html living standardthe definition of 'htmltemplateelement interface' in that specification. living standard html5the definition of 'htmltemplateelement interface' in that speci...
HTMLVideoElement - Web APIs
tem considers the loaded video source to be stereo 3-d or not. value set to true indicates source is stereo 3d. htmlvideoelement.mszoom controls whether the video frame is trimmed to fit the video display. methods inherits methods from its parent, htmlmediaelement, and from its ancestor htmlelement. htmlvideoelement.getvideoplaybackquality() returns a videoplaybackquality object that
contains the current playback metrics. this information includes things like the number of dropped or corrupted frames, as well as the total number of frames. events inherits methods from its parent, htmlmediaelement, and from its ancestor htmlelement. listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface. specifications ...
HTML Drag and Drop API - Web APIs
the mime type of each drag item. datatransfer objects also have methods to add or remove items to the drag's data. the dragevent and datatransfer interfaces should be the only ones needed to add html drag and drop capabilities to an application. (firefox supports some gecko-specific extensions to the datatransfer object, but those extensions will only work on firefox.) each datatransfer object
contains an items property, which is a list of datatransferitem objects. a datatransferitem object represents a single drag item, each with a kind property (either string or file) and a type property for the data item's mime type. the datatransferitem object also has methods to get the drag item's data. the datatransferitemlist object is a list of datatransferitem objects. the list object has methods to ...
Headers.has() - Web APIs
for security reasons, some headers can only be controlled by the user agent. these headers include the forbidden header names and forbidden response header names. syntax myheaders.has(name); parameters name the name of the http header you want to test for. if the given name is not a valid http header name, this method throws a typeerror. returns a boolean. ...
Headers - Web APIs
der from a headers object. headers.entries() returns an iterator allowing to go through all key/value pairs contained in this object. headers.foreach() executes a provided function once for each array element. headers.get() returns a bytestring sequence of all the values of a header within a headers object with a given name. headers.has() returns a boolean stating whether a headers object
contains a certain header. headers.keys() returns an iterator allowing you to go through all keys of the key/value pairs contained in this object. headers.set() sets a new value for an existing header inside a headers object, or adds the header if it does not already exist. headers.values() returns an iterator allowing you to go through all values of the key/value pairs contained in this object. ...
History.pushState() - Web APIs
in an html document, the history.pushstate() method adds a state to the browser's session history stack. syntax history.pushstate(state, title[, url]) parameters state the state object is a javascript object which is associated with the new history entry created by pushstate(). whenever the user navigates to the new state, a popstate event is fired, and the state property of the event
contains a copy of the history entry's state object. the state object can be anything that can be serialized. because firefox saves state objects to the user's disk so they can be restored after the user restarts the browser, we impose a size limit of 640k characters on the serialized representation of a state object. if you pass a state object whose serialized representation is larger than this to pushstate...
IDBDatabase.name - Web APIs
note: this feature is available in web workers. syntax var dbname = idbdatabase.name; value a domstring containing the name of the connected database. example this example shows a database connection being opened, the resulting idbdatabase object being stored in a db variable, and the name property then being logged. for a full example, see our to-do notifications app (view example live). ...
IDBDatabase.version - Web APIs
when a database is first created, this attribute is an empty string. note: this feature is available in web workers. syntax var myinteger = idbdatabase.version; value an integer containing the version of the connected database. ...
IDBEnvironment - Web APIs
important: the indexeddb property that was previously defined in this mixin is instead now windoworworkerglobalscope.indexeddb (that is, defined as a member of the windoworworkerglobalscope mixin). the idbenvironment helper of the indexeddb api
contains the indexeddb property, which provides access to indexeddb functionality. it is the top level indexeddb interface implemented by the window and worker objects. note: this feature is available in web workers. properties idbenvironment.indexeddb read only provides a mechanism for applications to asynchronously access capabilities of indexed databases;
contains an idbfactory object. example the following code creates a request for a database to be opened asychronously, after which the database is opened when the request's onsuccess han...
IDBFactory.open() - Web APIs
d the database exists, then a connection to the database will be opened without changing its version. if the version is not provided and the database does not exist, then it will be created with version 1. experimental gecko options object options (version and storage) optional in gecko, since version 26, you can include a non-standard options object as a parameter of idbfactory.open that
contains the version number of the database, plus a storage value that specifies whether you want to use persistent or temporary storage. warning: the storage attribute is deprecated and will soon be removed from gecko. you should use storagemanager.persist() to get persistent storage instead. note: you can find out more information on the different available storage types, and how firefox handles c...
IntersectionObserver.rootMargin - Web APIs
reat the target as partially hidden if an edge is too close to the edge of the root's bounding box. see the root element and root margin in intersection observer api for a more in-depth look at the root margin and how it works with the root's bounding box. syntax var marginstring = intersectionobserver.rootmargin; value a string, formatted similarly to the css margin property's value, which
contains offsets for one or more sides of the root's bounding box. these offsets are added to the corresponding values in the root's bounding box before the intersection between the resulting rectangle and the target element's bounds. the string returned by this property may not match the one specified when the intersectionobserver was instantiated. the browser is permitted to alter the values if rootma...
IntersectionObserverEntry.boundingClientRect - Web APIs
the intersectionobserverentry interface's read-only boundingclientrect property returns a domrectreadonly which in essence describes a rectangle describing the smallest rectangle that
contains the entire target element. syntax var boundsrect = intersectionobserverentry.boundingclientrect; value a domrectreadonly which describes the smallest rectangle that
contains every part of the target element whose intersection change is being described. this value is obtained using the same algorithm as element.getboundingclientrect(), so refer to that article for details on precisely what is done to obtain this rectangle and what is and is not included within its bounds. in the general case, however, it's safe to simply think of this as the bounds rectangle of the target element. specificat...
IntersectionObserverEntry.intersectionRect - Web APIs
syntax var intersectionrect = intersectionobserverentry.intersectionrect; value a domrectreadonly which describes the part of the target element that's currently visible within the root's intersection rectangle. ...
Intersection Observer API - Web APIs
oot element. how intersection is calculated all areas considered by the intersection observer api are rectangles; elements which are irregularly shaped are considered as occupying the smallest rectangle which encloses all of the element's parts. similarly, if the visible portion of an element is not rectangular, the element's intersection rectangle is construed to be the smallest rectangle that
contains all the visible portions of the element. it's useful to understand a bit about how the various properties provided by intersectionobserverentry describe an intersection. the intersection root and root margin before we can track the intersection of an element with a container, we need to know what that container is. that container is the intersection root, or root element. this can be either a ...
KeyboardEvent.code - Web APIs
version="1.1" class="world"> <polygon id="spaceship" points="15,0 0,30 30,30"/> </svg> <script>refresh();</script> css .world { margin: 0px; padding: 0px; background-color: black; width: 400px; height: 400px; } #spaceship { fill: orange; stroke: red; stroke-width: 2px; } javascript the first section of the javascript code establishes some variables we'll be using. shipsize
contains the size of the ship the player is moving around, for convenience. position is used to track the position of the ship within the play field. moverate and turnrate are the number of pixels forward and backward each keystroke moves the ship and how many degrees of rotation the left and right steering controls apply per keystroke. angle is the current amount of rotation applied to the ship, in degre...
KeyboardEvent - Web APIs
sn't have a printable representation, this is an empty string. note: if the key is used as a macro that inserts multiple characters, this attribute's value is the entire string, not just the first character. keyboardevent.charcode read only returns a number representing the unicode reference number of the key; this attribute is used only by the keypress event. for keys whose char attribute
contains multiple characters, this is the unicode value of the first character in that attribute. in firefox 26 this returns codes for printable characters. warning: this attribute is deprecated; you should use keyboardevent.key instead, if available. keyboardevent.keycode read only returns a number representing a system and implementation dependent numerical code identifying the unmodified value o...
KeyboardLayoutMap - Web APIs
devent 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. keyboardlayoutmap.size read only returns the number of elements in the keyboardlayoutmap object. keyboardlayoutmap.values read only returns a new array iterator object that
contains the values for each index in the keyboardlayoutmap object. methods keyboardlayoutmap.foreach() read only executes a provided function once for each element of k...
KeyframeEffect.setKeyframes() - Web APIs
ribed below) may be specified alongside the property values. element.animate({ opacity: [ 0, 0.9, 1 ], offset: [ 0, 0.8 ], // shorthand for [ 0, 0.8, 1 ] easing: [ 'ease-in', 'ease-out' ], }, 2000); after generating a suitable set of keyframes from the property value lists, each supplied offset is applied to the corresponding keyframe. if there are insufficient values, or if the list
contains null values, the keyframes without specified offsets will be evenly spaced as with the array format described above. if there are too few easing or composite values, the corresponding list will be repeated as needed. implicit to/from keyframes in newer browser versions, you are able to set a beginning or end state for an animation only (i.e. a single keyframe), and the browser will infer ...
Location: hash - Web APIs
the hash property of the location interface returns a usvstring containing a '#' followed by the fragment identifier of the url. the fragment is not percent-decoded. if the url does not have a fragment identifier, this property
contains an empty string, "". syntax string = object.hash; object.hash = string; examples <a id="myanchor" href="/docs/location.href#examples">examples</a> <script> var anchor = document.getelementbyid("myanchor"); console.log(anchor.hash); // returns '#examples' </script> specifications specification status comment html living standardthe definition of 'hash' in that specification. living standard initial definition ...
LockManager - Web APIs
e lockmanager interface of the the web locks api provides methods for requesting a new lock object and querying for an existing lock object. to get an instance of lockmanager, call navigator.locks. methods lockmanager.request() requests a lock object with parameters specifying its name and characteristics. lockmanager.query() returns a promise that resolves with a lockmanagersnapshot which
contains information about held and pending locks. specifications specification status comment web locks apithe definition of 'lockmanager' in that specification. draft initial definition. ...
MediaCapabilities.decodingInfo() - Web APIs
the mediacapabilities.decodinginfo() method, part of the media capabilities api, returns a promise with the tested media configuration's mediacapabilitiesinfo; this
contains the three boolean properties supported, smooth, and powerefficient, which describe whether decoding the media described would be supported, smooth, and powerefficient. syntax mediacapabilities.decodinginfo(mediadecodingconfiguration) parameters mediadecodingconfiguration a valid mediadecodingconfiguration dictionary containing a valid media decoding type of file or media-source and a valid media configuration: either an audioconfiguration or a videoconfiguration. return value a promise fulfilling with a mediacapabilitiesinfo interface containing three boolean attributes: supported smooth powerefficient except...
MediaCapabilities.encodingInfo() - Web APIs
the mediacapabilities.encodinginfo() method, part of the mediacapabilities interface of the media capabilities api, returns a promise with the tested media configuration's mediacapabilitiesinfo; this
contains the three boolean properties supported, smooth, and powerefficient, which describe how compatible the device is with the type of media. syntax mediacapabilities.encodinginfo(mediaencodingconfiguration) parameters mediaencodingconfiguration a valid mediaencodingconfiguration dictionary containing a valid media encoding type of record or transmission and a valid media configuration: either an audioconfiguration or videoconfiguration dictionary. return value a promise fulfilling with a mediacapabilitiesinfo interface containing three boolean attributes: supported smooth powereffi...
MediaDeviceInfo.groupId - Web APIs
be built. the function starts by initializing the result array, devlist, to be an empty array. then navigator.mediadevices.enumeratedevices() is called to get the list of all media devices. once the promise resolves, we walk the list using foreach(). for each device, if its groupid matches the main device's groupid, we push the mediadeviceinfo object onto the list. finally, the list, which now
contains a mediadeviceinfo object for each device in the same group, is returned to the caller. this could be altered easily to either leave out the passed-in device from the returned list, or to place it at the top of the list, by comparing the two objects' deviceid values, only pushing the device onto the result list if it doesn't match. this version of the example puts the passed-in device at the top...
MediaDeviceInfo - Web APIs
the list of devices obtained by calling navigator.mediadevices.enumeratedevices() is an array of mediadeviceinfo objects, one per media device. properties mediadeviceinfo.deviceidread only returns a domstring that is an identifier for the represented device that is persisted across sessions. it is un-guessable by other applications and unique to the origin of the calling application. it is reset when the user clears cookies (for private browsing, a different identifier is used that is not persisted across sessions). mediadeviceinfo.groupidread only returns a domstring that is a group identifier. ...
MediaDevices.getDisplayMedia() - Web APIs
urface from which video is to be captured. async function startcapture(displaymediaoptions) { let capturestream = null; try { capturestream = await navigator.mediadevices.getdisplaymedia(displaymediaoptions); } catch(err) { console.error("error: " + err); } return capturestream; } this uses await to asynchronously wait for getdisplaymedia() to resolve with a mediastream which
contains the display contents as requested by the specified options. the stream is then returned to the caller for use, perhaps for adding to a webrtc call using rtcpeerconnection.addtrack() to add the video track from the stream. specifications specification status comment screen capturethe definition of 'mediadevices.getdisplaymedia()' in that specification. working draft ...
MediaDevices.getUserMedia() - Web APIs
e general permission. here, indicate we need the ability to use both camera and microphone: <iframe src="https://mycode.example.net/etc" allow="camera;microphone"> </iframe> read our guide, using feature policy, to learn more about how it works. encryption based security the getusermedia() method is only available in secure contexts. a secure context is one the browser is reasonably confident
contains a document which was loaded securely, using https/tls, and has limited exposure to insecure contexts. if a document isn't loaded in a secure context, the navigator.mediadevices property is undefined, making access to getusermedia() impossible. attempting to access getusermedia() in this situation will result in a typeerror. document source security because of the obvious security concern assoc...
MediaElementAudioSourceNode.mediaElement - Web APIs
the mediaelementaudiosourcenode interface's read-only mediaelement property indicates the htmlmediaelement that
contains the audio track from which the node is receiving audio. this stream was specified when the node was first created, either using the mediaelementaudiosourcenode() constructor or the audiocontext.createmediaelementsource() method. syntax audiosourceelement = mediaelementaudiosourcenode.mediaelement; value an htmlmediaelement representing the element which
contains the source of audio for the node. examples const audioctx = new window.audiocontext(); const audioelem = document.queryselector('audio'); let options = { mediaelement: audioelem } let source = new mediaelementaudiosourcenode(audioctx, options); console.log(source.mediaelement); specifications specif...
MediaError.message - Web APIs
syntax var errormessage = mediaerror.message; value a domstring providing a detailed, specific explanation of what went wrong and possibly how it might be fixed. this is not simply a generic description of the mediaerror.code property's value, but instead goes deeper into the specifics of this particular error and its circumstances. if no specific details are available, this string is empty. ...
MediaKeyMessageEvent - Web APIs
the mediakeymessageevent interface of the encryptedmediaextensions api
contains the content and related data when the content decryption module generates a message for the session. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">event</text>...
sessionId - Web APIs
the mediakeysession.sessionid read-only property
contains a unique string generated by the cdm for the current media object and its associated keys or licenses. syntax var sessionid = mediakeysessionobj.sessionid; specifications specification status comment encrypted media extensionsthe definition of 'sessionid' in that specification. recommendation initial definition ...
MediaKeySession - Web APIs
eysession.expiration read only the time after which the keys in the current session can no longer be used to decrypt media data, or nan if no such time exists. this value is determined by the cdm and measured in milliseconds since january 1, 1970, utc. this value may change during a session lifetime, such as when an action triggers the start of a window. mediakeysession.keystatuses read only
contains a reference to a read-only mediakeystatusmap of the current session's keys and their statuses. mediakeysession.sessionid read only
contains a unique string generated by the cdm for the current media object and its associated keys or licenses. event handlers mediakeysession.onkeystatuseschange sets the eventhandler called when there has been a change in the keys in a session or their stat...
MediaRecorder.ondataavailable - Web APIs
the mediarecorder.ondataavailable event handler (part of the mediastream recording api) handles the dataavailable event, letting you run code in response to blob data being made available for use. the dataavailable event is fired when the mediarecorder delivers media data to your application for its use. the data is provided in a blob object that
contains the data. this occurs in four situations: when the media stream ends, any media data not already delivered to your ondataavailable handler is passed in a single blob. when mediarecorder.stop() is called, all media data which has been captured since recording began or the last time a dataavailable event occurred is delivered in a blob; after this, capturing ends. when mediarecorder.requestdata() is called, all media data which has been capt...
MediaRecorder.onerror - Web APIs
the mediarecorder interface's onerror event handler is called by the mediastream recording api when an error occurs. you can provide an event handler to deal with errors that occur while creating or using a media recorder. the error object is of type mediarecordererrorevent, and its error property
contains a domexception object that describes the error that occurred. syntax mediarecorder.onerror = errorhandlerfunction; value a function to be called whenever an error occurs during the recorder's lifetime. in addition to other general errors that might occur, the following errors are specifically possible when using the mediastream recording api; to determine which occurred, check the value of mediarecordererrorevent.error.name. invalidstateerror an attempt was made to stop or pause or an ...
MediaRecorder - Web APIs
h returns a boolean value indicating if the given mime media type is supported by the current user agent. event handlers mediarecorder.ondataavailable called to handle the dataavailable event, which is periodically triggered each time timeslice milliseconds of media have been recorded (or when the entire media has been recorded, if timeslice wasn't specified). the event, of type blobevent,
contains the recorded media in its data property. you can then collect and act upon that recorded media data using this event handler. mediarecorder.onerror an eventhandler called to handle the error event, including reporting errors that arise with media recording. these are fatal errors that stop recording. the received event is based on the mediarecordererrorevent interface, whose error property cont...
MediaSession.metadata - Web APIs
this metadata is provided by the browser to the device for presentation in any standard media control user interface the device might offer. syntax var mediametadata = navigator.mediasession.metadata; navigator.mediasession.metadata = mediametadata; value an instance of mediametadata containing information about the media currently being played. ...
MediaSession - Web APIs
ystem for presentation in standardized user interface elements. for example, a smartphone might have a standard panel in its lock screen that provides controls for media. a browser on that device might deliver the metadata provided by calling mediasession to the device in order to be controllable using the global user interface. properties metadata returns an instance of mediametadata which
contains rich media metadata, for display in a platform ui. playbackstate indicates whether the current media session is playing. valid values are none, paused, or playing. methods setactionhandler() sets an event handler for a media session action, such as play or pause. see the method page for a full list. setpositionstate() sets the current playback position and speed of the media currently b...
MediaStream.clone() - Web APIs
the clone() method of the mediastream interface creates a duplicate of the mediastream. this new mediastream object has a new unique id and
contains clones of every mediastreamtrack contained by the mediastream on which clone() was called. syntax var stream = mediastream.clone(); parameters none. return value a new mediastream instance which has a new unique id and
contains clones of every mediastreamtrack contained by the mediastream on which clone() was called. specifications specification status comment media capture and streamsthe definition of 'mediastream.clone()' in that specification. candidate recommendation initial definition. ...
MediaStream.getAudioTracks() - Web APIs
sequence that represents all the mediastreamtrack objects in this stream's track set where mediastreamtrack.kind is audio. syntax var mediastreamtracks = mediastream.getaudiotracks() parameters none. return value an array of mediastreamtrack objects, one for each audio track contained in the stream. audio tracks are those tracks whose kind property is audio. the array is empty if the stream
contains no audio tracks. note: the order of the returned tracks is not defined by the specification and may, in fact, change from one call to getaudiotracks() to the next. early versions of this api included a special audiostreamtrack interface which was used as the type for each entry in the list of audio streams; however, this has since been merged into the main mediastreamtrack interface. example...
MediaStream.getVideoTracks() - Web APIs
ediastream interface returns a sequence of mediastreamtrack objects representing the video tracks in this stream. syntax var mediastreamtracks[] = mediastream.getvideotracks(); parameters none. return value an array of mediastreamtrack objects, one for each video track contained in the media stream. video tracks are those tracks whose kind property is video. the array is empty if the stream
contains no video tracks. note: the order of the tracks is not defined by the specification, and may not be the same from one call to getvideotracks() to another. early versions of this api included a special videostreamtrack interface which was used as the type for each entry in the list of video streams; however, this has since been merged into the main mediastreamtrack interface. example the foll...
MediaStream - Web APIs
mediastream object either by using the constructor or by calling mediadevices.getusermedia(). some user agents subclass this interface to provide more precise information or functionality, like in canvascapturemediastream. constructor mediastream() creates and returns a new mediastream object. you can create an empty stream, a stream which is based upon an existing stream, or a stream that
contains a specified list of tracks (specified as an array of mediastreamtrack objects). properties this interface inherits properties from its parent, eventtarget. mediastream.active read only a boolean value that returns true if the mediastream is active, or false otherwise. mediastream.ended read only a boolean value set to true if the end of the stream has been reached. this has been remo...
MediaStreamTrack - Web APIs
can be set using applyconstraints() and accessed using getconstraints() and getsettings(). see capabilities, constraints, and settings to learn how to correctly work with constrainable properties. not doing so correctly will result in your code being unreliable. mediastreamtrack.contenthint a string that may be used by the web application to provide a hint as to what type of content the track
contains to guide how it should be treated by api consumers. mediastreamtrack.enabled a boolean whose value of true if the track is enabled, that is allowed to render the media source stream; or false if it is disabled, that is not rendering the media source stream but silence and blackness. if the track has been disconnected, this value can be changed but has no more effect. note: you can implement st...
Recording a media element - Web APIs
at time is reached, mediarecorder automatically stops recording as well. line 2 creates the mediarecorder that will handle recording the input stream. line 3 creates an empty array, data, which will be used to hold the blobs of media data provided to our ondataavailable event handler. line 5 sets up the handler for the dataavailable event. the received event's data property is a blob that
contains the media data. the event handler simply pushes the blob onto the data array. lines 6-7 starts the recording process by calling recorder.start(), and outputs a message to the log with the updated state of the recorder and the number of seconds it will be recording. lines 9-12 creates a new promise, named stopped, which is resolved when the mediarecorder's onstop event handler is called, and i...
Using the MediaStream Recording API - Web APIs
a calculation to determine the computed value of a css unit, mixing different units in the process. for example, in web dictaphone we have three main ui areas, stacked vertically. we wanted to give the first two (the header and the controls) fixed heights: header { height: 70px; } .main-controls { padding-bottom: 0.7rem; height: 170px; } however, we wanted to make the third area (which
contains the recorded samples you can play back) take up whatever space is left, regardless of the device height. flexbox could be the answer here, but it's a bit overkill for such a simple layout. instead, the problem was solved by making the third container's height equal to 100% of the parent height, minus the heights and padding of the other two: .sound-clips { box-shadow: inset 0 3px 4px rgba(0,0,...
MediaStream Recording API - Web APIs
er for the dataavailable event; this will be called whenever data is available for you. once the source media is playing and you've reached the point where you're ready to record video, call mediarecorder.start() to begin recording. your dataavailable event handler gets called every time there's data ready for you to do with as you will; the event has a data attribute whose value is a blob that
contains the media data. you can force a dataavailable event to occur, thereby delivering the latest sound to you so you can filter it, save it, or whatever. recording stops automatically when the source media stops playing. you can stop recording at any time by calling mediarecorder.stop(). note: individual blobs containing slices of the recorded media will not necessarily be individually playable. ...
MediaTrackConstraints - Web APIs
ded in the video if it's moving, and for a short time after it stops moving. never the mouse cursor is never included in the shared video. displaysurface a constraindomstring which specifies the types of display surface that may be selected by the user. this may be a single one of the following strings, or a list of them to allow multiple source surfaces: application the stream
contains all of the windows of the application chosen by the user rendered into the one video track. browser the stream
contains the contents of a single browser tab selected by the user. monitor the stream's video track
contains the entire contents of one or more of the user's screens. window the stream
contains a single window selected by the user for sharing. logicalsurface a constrai...
MediaTrackSettings.displaySurface - Web APIs
the mediatracksettings dictionary's displaysurface property indicates the type of display surface being captured. syntax displaysurface = mediatracksettings.displaysurface; value the value of displaysurface is a string that comes from the displaycapturesurfacetype enumerated type, and is one of the following: application the stream's video track
contains all of the windows belonging to the application chosen by the user. the windows are aggragated into a single video track, with any empty space filled with a backdrop; that backdrop is selected by the user agent. browser the stream's video track presents the entire contents of a single browser tab which the user selected during the getdisplaymedia() call. monitor the video track in the stream presents the complete contents of one or mo...
MediaTrackSettings.logicalSurface - Web APIs
part of the buffer is visible without scrolling the containing window) and offscreen rendering contexts. syntax islogicalsurface = mediatracksettings.logicalsurface; value a boolean value which is true if the video track in the stream of captured video is taken from a logical display surface. the most common scenario in which a display surface may be a logical one is if the selected surface
contains the entire content area of a window which is too large to display onscreen at once. since the window that
contains the surface has to be scrolled to show the rest of the contents, the surface is a logical one. a visible display surface (that is, a surface for which logicalsurface returns false) is the portion of a logical display surface which is currently visible onscreen. for example, a user ...
Media Session API - Web APIs
ion property. for example, to set the current state of the media session to playing: navigator.mediasession.playbackstate = "playing"; interfaces mediametadata allows a web page to provide rich media metadata, for display in a platform ui. mediasession allows a web page to provide custom behaviors, for standard media playback interactions. dictionaries mediaimage a mediaimage object
contains information describing an image associated with the media. this might be a cd or dvd cover, a movie poster, a poster frame, or the like. mediapositionstate used to contain information about the current playback position, playback speed, and overall media duration when calling the mediasession method setpositionstate() to establish the media's length, playback position, and playback speed. medi...
Capabilities, constraints, and settings - Web APIs
ateslider").disabled = !supported["framerate"]; in this example, the supported constraints are fetched, and a control that lets the user configure the frame rate is disabled if the framerate constraint isn't supported. how constraints are defined a single constraint is an object whose name matches the constrainable property whose desired value or range of values is being specified. this object
contains zero or more individual constraints, as well as an optional sub-object named advanced, which
contains another set of zero or more constraints which the user agent must satisfy if at all possible. the user agent attempts to satisfy constraints in the order specified in the constraint set. the most important thing to understand is that most constraints aren't requirements; instead, they're reques...
Microdata DOM API - Web APIs
ribute on the element with the itemscope attribute. methods document . getitems( [ types ] ) returns a nodelist of the elements in the document that create items, that are not part of other items, and that are of the types given in the argument, if any are listed. the types argument is interpreted as a space-separated list of types. the document.getitems(typenames) method takes a string that
contains an unordered set of unique space-separated tokens that are case-sensitive, representing types. when called, the method must return a live nodelist object containing all the elements in the document, in tree order, that are each top-level microdata items whose types include all the types specified in the method's argument, having obtained the types by splitting the string on spaces. if there are n...
MimeType - Web APIs
navigatorplugins.mimetypes returns an array of this object. properties mimetype.type returns the mime type of the associated plugin. mimetype.description returns a description of the associated plugin or an empty string if there is none. mimetype.suffixes a string containing valid file extensions for the data displayed by the plugin, or an empty string if an extension is not valid for the particular module. for example, a browser's content decryption module may appear in the plugin list but support more file extensions than can be anticipated. it might therefore return an empty string. ...
MimeTypeArray - Web APIs
this object is returned by navigatorplugins.mimetypes. properties mimetypearray.length the number of items in the array. methods mimetypearray.item() returns the mimetype object with the specified index. mimetypearray.nameditem() returns the mimetype object with the specified name. example the following example tests whether a plugin is available for the application/pdf mime type and if so, which plugin that is. ...
MutationObserverInit.characterData - Web APIs
e mutationobserverinit dictionary's optional characterdata property is used to specify whether or not to monitor the node or nodes being observed for changes to their textual contents. character data changes are detectable on any text node, including nodes based on the text, processinginstruction, and comment interfaces. note that this doesn't monitor content of an htmlelement, even if it only
contains text inside, as it only monitors text nodes themselves. so either pass directly a text node to the observe() method or you need to also set subtree: true. syntax var options = { characterdata: true | false } value a boolean value indicating whether or not to call the observer's callback function when textual nodes' values change. if true, the callback specified when observe() was used to...
NDEFRecord.data - Web APIs
the data property of the ndefrecord interface is dataview providing access to the payload data of the record. it provides access to a raw content of the record and thus data consumer might need to decode it. syntax ndefrecord.data value a dataview that
contains encoded payload data of the record. specifications specification status comment web nfc, ndefrecord.data draft initial definition. ...
NDEFRecord.encoding - Web APIs
syntax ndefrecord.encoding value a usvstring which can be one of the following: "utf-8", "utf-16", "utf-16le" or "utf-16be". ...
NameList - Web APIs
lemented in gecko, there was no way to actually create one. namelist has been removed, effective with gecko 10.0 the namelist interface provides an abstraction for an ordered collection of name and namespace value pairs. items can be accessed by a 0-based index. the dom spec does not specify how the collection is to be implemented. properties namelist.length read only methods namelist.
contains() returns a boolean. namelist.
containsns() returns a boolean. namelist.getname() returns a domstring. namelist.getnamespaceuri() returns a domstring. specifications specification status comment document object model (dom) level 3 core specificationthe definition of 'namelist' in that specification. obsolete initial definition ...
Navigation Timing API - Web APIs
rding the browser's document navigation events. for example, this interface can be used to determine how much time it takes to load or unload a document. performancetiming used as the type for the value of timing, objects of this type contain timing information that can provide insight into web page performance. performancenavigation the type used to return the value of navigation, which
contains information explaining the context of the load operation described by this performance instance. the navigation timing api can be used to gather performance data on the client side to be sent to a server via xhr as well as measure data that was very difficult to measure by other means such as time to unload a previous page, domain look up time, window.onload total time, etc. examples calculat...
Navigator.getUserMedia() - Web APIs
ing the types of media to request, along with any requirements for each type. for details, see the constraints section under the modern mediadevices.getusermedia() method, as well as the article capabilities, constraints, and settings. successcallback a function which is invoked when the request for media access is approved. the function is called with one parameter: the mediastream object that
contains the media stream. your callback can then assign the stream to the desired object (such as an <audio> or <video> element), as shown in the following example: function(stream) { var video = document.queryselector('video'); video.srcobject = stream; video.onloadedmetadata = function(e) { // do something with the video here. }; } errorcallback when the call fails, the function ...
Navigator.msLaunchUri() - Web APIs
not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the mslaunchuri() method is a microsoft extension to the navigator interface, which starts a service or app, such as an email client, that handles a given protocol. the uniform resource identifier (uri)
contains the protocol for the default service or app, such as mailto://test@contoso.com. this proprietary method is specific to internet explorer, and microsoft edge versions 18 and lower. syntax navigator.mslaunchuri(uri, successcallback, nohandlercallback); parameters uri a domstring specifying the url containing including the protocol of the document or resource to be displayed. successcall...
NavigatorID - Web APIs
there is no object of type navigatorid, but other interfaces, like navigator or workernavigator, implement it. properties the navigatorid interface doesn't inherit any properties. navigatorid.appcodename read only always returns "mozilla", in any browser. this property is kept only for compatibility purposes. navigatorid.appname read only always returns "netscape", in any browser. this property is kept only for compatibility purposes. navigatorid.appversion read only returns either "4.0" or a string representing version information about the browser. do not rely on this property to return a useful value. ...
NavigatorLanguage - Web APIs
there is no object of type navigatorlanguage, but other interfaces, like navigator or workernavigator, implement it. properties the navigatorlanguage interface doesn't inherit any property. navigatorlanguage.language read only returns a domstring representing the preferred language of the user, usually the language of the browser ui. the null value is returned when this is unknown. navigatorlanguage.languages read only returns an array of domstring representing the languages known to the user, by order of preference. methods the navigatorlanguage interface neither implements, nor inherit any method. ...
NavigatorOnLine - Web APIs
there is no object of type navigatoronline, but other interfaces, like navigator or workernavigator, implement it. properties the navigatoronline interface doesn't inherit any property. navigatoronline.online read only returns a boolean indicating whether the browser is working online. methods the navigatoronline interface neither implements, nor inherit any method. ...
NavigatorPlugins.mimeTypes - Web APIs
note: named properties of mimetypearray objects are no longer enumerable in the latest browser versions. syntax var mimetypes[] = navigator.mimetypes; mimetypes is a mimetypearray object which has a length property as well as item(index) and nameditem(name) methods. ...
NetworkInformation.onchange - Web APIs
syntax netinfo.onchange = function() { ... } examples // get the connection type. var type = navigator.connection.type; function changehandler(e) { // handle change of connection type here. ...
Node.baseURI - Web APIs
ls section of the html living standard for details. you can use document.baseuri to obtain the base url of a document. note that obtaining the base url for a document may return different urls over time if the <base> tags or the document's location change. the base url of an element the base url of an element in html normally equals the base url of the document the node is in. if the document
contains xml:base attributes (which you shouldn't do in html documents), the element.baseuri takes the xml:base attributes of element's parents into account when computing the base url. see xml:base for details. you can use element.baseuri to obtain the base url of an element. specifications specification status comment domthe definition of 'node: baseuri' in that specificat...
Node.cloneNode() - Web APIs
lone the new node, cloned from node. the newclone has no parent and is not part of the document, until it is added to another node that is part of the document (using node.appendchild() or a similar method). deep optional* if true, then node and its whole subtree—including text that may be in child text nodes—is also copied. if false, only node will be cloned. any text that node
contains is not cloned, either (since text is contained by one or more child text nodes). deep has no effect on empty elements (such as the <img> and <input> elements). *note: in the dom4 specification (since gecko 13.0 (firefox 13 / thunderbird 13 / seamonkey 2.10)), the optional deep argument defaults to true. this behavior has been changed in the latest spec! although deep it still optional, i...
NonDocumentTypeChildNode - Web APIs
nondocumenttypechildnode is a raw interface and no object of this type can be created; it is implemented by element, and characterdata objects. properties there are no inherited properties. nondocumenttypechildnode.previouselementsibling read only returns the element immediately prior to this node in its parent's children list, or null if there is no element in the list prior to this node. nondocumenttypechildnode.nextelementsibling read only returns the element immediately following this node in its parent's children list, or null if there is no element in the list following this node. ...
Notification.icon - Web APIs
syntax var icon = notification.icon; value a usvstring. examples in our to-do list app (view the app running live), we use the notification() constructor to fire a notification, passing it arguments to specify the body, icon and title we want. ...
OfflineAudioContext.startRendering() - Web APIs
renderedbuffer property. browsers currently support two versions of the startrendering() method — an older event-based version and a newer promise-based version. the former will eventually be removed, but currently both mechanisms are provided for legacy reasons. syntax event-based version: offlineaudioctx.startrendering(); offlineaudioctx.oncomplete = function(e) { // e.renderedbuffer
contains the output buffer } promise-based version: offlineaudioctx.startrendering().then(function(buffer) { // buffer
contains the output buffer }); parameters none. returns void. example in this simple example, we declare both an audiocontext and an offlineaudiocontext object. we use the audiocontext to load an audio track via xhr (audiocontext.decodeaudiodata), then the offlineaudiocontext t...
OscillatorNode.setPeriodicWave() - Web APIs
icwave(), recreating a sine wave from a periodic wave. var real = new float32array(2); var imag = new float32array(2); var ac = new audiocontext(); var osc = ac.createoscillator(); real[0] = 0; imag[0] = 0; real[1] = 1; imag[1] = 0; var wave = ac.createperiodicwave(real, imag); osc.setperiodicwave(wave); osc.connect(ac.destination); osc.start(); osc.stop(2); this works because a sound that
contains only a fundamental tone is by definition a sine wave. here, we create a periodicwave with two values. the first value is the dc offset, which is the value at which the oscillator starts. 0 is good here, because we want to start the curve at the middle of the [-1.0; 1.0] range. the second and subsequent values are sine and cosine components. you can think of it as the result of a fourier trans...
ParentNode.children - Web APIs
syntax let children = node.children; value an htmlcollection which is a live, ordered collection of the dom elements which are children of node. you can access the individual child nodes in the collection by using either the item() method on the collection, or by using javascript array-style notation. if the node has no element children, then children is an empty list with a length of 0. ...
ParentNode - Web APIs
it's implemented by element, document, and documentfragment objects. see locating dom elements using selectors to learn how to use css selectors to find nodes or elements of interest. properties parentnode.childelementcount read only returns the number of children of this parentnode which are elements. parentnode.children read only returns a live htmlcollection containing all of the element objects that are children of this parentnode, omitting all of its non-element nodes. parentnode.firstelementchild read only returns the first node which is both a child of this parentnode and is also an element, or null if there is none. ...
Path2D.addPath() - Web APIs
path [, transform]); parameters path a path2d path to add. transform optional a dommatrix to be used as the transformation matrix for the path that is added. (technically a dommatrixinit object). examples adding a path to an existing path this example adds one path to another. html <canvas id="canvas"></canvas> javascript first, we create two separate path2d objects, each of which
contains a rectangle made using the rect() method. we then create a matrix using document.createelementns() and createsvgmatrix(). we then add the second path to the first using addpath(), also applying the matrix to move the second path to the right. finally, we draw the first path (which now
contains both rectangles) using fill(). const canvas = document.getelementbyid('canvas'); const ctx = canvas.get...
PaymentAddress.postalCode - Web APIs
the postalcode read-only property of the paymentaddress interface returns a string containing a code used by a jurisdiction for mail routing, for example, the zip code in the united states or the postal index number (pin code) in india. syntax var paymentpostalcode = paymentaddress.postalcode; value a domstring which
contains the postal code portion of the address. a postal code is a string (either numeric or alphanumeric) which is used by a postal service to optimize mail routing and delivery. various countries use different terms for this. in most of the world, it's known as the "post code" or "postal code." in the united states, the zip code is used. india uses pin codes. specifications specification status comment payment request apithe definition of 'paymentadd...
PaymentMethodChangeEvent.methodDetails - Web APIs
y, in order to compute a discount if the user chooses to use a visa card as their payment method. request.onpaymentmethodchange = function(ev) { const { type: cardtype } = ev.methoddetails; const newstuff = {}; if (ev.methodname === "https://apple.com/apple-pay") { switch (cardtype) { case "visa": // do apple pay specific handling for visa card... // methoddetails
contains the card information const result = calculatediscount(ev.methoddetails); object.assign(newstuff, result); break; } } // finally... ev.updatewith(newstuff); }; const response = await request.show(); note that the methoddetails property is being used by the calculatediscount() function to compute any payment discount, then updatewith() is called to update the even...
PaymentMethodChangeEvent.methodName - Web APIs
y, in order to compute a discount if the user chooses to use a visa card as their payment method. request.onpaymentmethodchange = function(ev) { const { type: cardtype } = ev.methoddetails; const newstuff = {}; if (ev.methodname === "https://apple.com/apple-pay") { switch (cardtype) { case "visa": // do apple pay specific handling for visa card... // methoddetails
contains the card information const result = calculatediscount(ev.methoddetails); object.assign(newstuff, result); break; } } // finally... ev.updatewith(newstuff); }; const response = await request.show(); specifications specification status comment payment request apithe definition of 'paymentmethodchangeevent.methodname' in that specification.
PaymentRequest.onpaymentmethodchange - Web APIs
own below; this example handles changes made to the payment method when using apple pay, specifically: request.onpaymentmethodchange = ev => { const { type: cardtype } = ev.methoddetails; const newstuff = {}; if (ev.methodname === "https://apple.com/apple-pay") { switch (cardtype) { case "store": // do apple pay specific handling for store card... // methoddetails
contains the store card information const result = calculatediscount(ev.methoddetails); object.assign(newstuff, result); break; } } // finally... ev.updatewith(newstuff); }; const response = await request.show(); specifications specification status comment payment request apithe definition of 'onpaymentmethodchange' in that specification. cand...
PaymentRequest: shippingaddresschange event - Web APIs
bject when the user selects a shipping address or changes details of their shipping address. bubbles no cancelable no interface paymentrequestupdateevent event handler property onshippingaddresschange usage notes depending on the browser, the shipping address information may be redacted for privacy reasons. that is, the paymentaddress which
contains the shipping address may have some portions of its content altered, obscured, or left out entirely in order to prevent identifying the user without their consent (since if they choose to have you ship products to them, you'll need their address). example in this example, a handler for the shippingaddresschange event is set up to validate that the address meets requirements set by the web applic...
paymentRequestId - Web APIs
the paymentrequestid read-only property of the paymentrequestevent interface returns the id of the paymentrequest object. syntax var id = paymentrequestevent.paymentrequestid value a domstring
contains the id. specifications specification status comment payment handler apithe definition of 'paymentrequestid' in that specification. working draft initial definition. ...
PaymentResponse.retry() - Web APIs
r any of the fields describing the payer which failed validation. paymentmethod optional any payment method specific errors which may have occurred. this object's contents will vary depending on the payment used. for example, if the user chose to pay by credit card using the basic-card payment method, this is a basiccarderrors object. shippingaddress optional an addresserrors object which
contains error messages for any of the fields in the shipping address that failed validation. return value a promise which is resolved when the payment is successfully completed. the promise is rejected with an appropriate exception value if the payment fails again. typically you will use this by calling show(), then entering a loop or recursive function that checks the paymentresponse for errors o...
PaymentValidationErrors - Web APIs
r any of the fields describing the payer which failed validation. paymentmethod optional any payment method specific errors which may have occurred. this object's contents will vary depending on the payment used. for example, if the user chose to pay by credit card using the basic-card payment method, this is a basiccarderrors object. shippingaddress optional an addresserrors object which
contains error messages for any of the fields in the shipping address that failed validation. example specifications specification status comment payment request api candidate recommendation initial definition. basic card payment working draft defines basiccarderrors ...
Payment processing concepts - Web APIs
a credit card that isn't accepted by the payee, the payment can't be made. if merchant validation is supported by the payment handler, respond to merchant validation requests from the user agent. see merchant validation for details. verify that the information provided by the user results in a valid transaction. this results in the creation and returning of a payment method-specific object that
contains the information needed to handle the transaction. merchant validation some payment handlers use merchant validation, which is the process of validating the identity of a merchant in some way, usually using some form of cryptographic challenge. if the merchant doesn't successfully validate, it's not allowed to use the payment handler. the exact validation technology depends on the payment hand...
Payment Request API - Web APIs
" button. the paymentrequest allows the web page to exchange information with the user agent while the user provides input to complete the transaction. you can find a complete guide in using the payment request api. note: the api is available inside cross-origin <iframe> elements only if they have had the allowpaymentrequest attribute set on them. interfaces paymentaddress an object that
contains address information; used for billing and shipping addresses, for example. paymentrequest an object that provides the api for creating and managing the user agent's payment interface. paymentrequestevent an event delivered to a payment handler when a paymentrequest is made. paymentrequestupdateevent enables the web page to update the details of the payment request in response to a user acti...
PerformanceServerTiming.duration - Web APIs
the duration read-only property returns a double that
contains the server-specified metric duration, or value 0.0. syntax servertiming.duration; specifications specification status comment server timingthe definition of 'duration' in that specification. working draft initial definition. ...
PerformanceServerTiming - Web APIs
can use the timing-allow-origin header to specify the domains that are allowed to access the server metrics. note that this interface is only available in secure contexts (https) in some browsers. properties performanceservertiming.descriptionread only a domstring value of the server-specified metric description, or an empty string. performanceservertiming.durationread only a double that
contains the server-specified metric duration, or value 0.0. performanceservertiming.nameread only a domstring value of the server-specified metric name. methods performanceservertiming.tojson() returns a domstring that is the json representation of the performanceservertiming object. example given a server that sends the server-timing header, for example a node.js server like this: const htt...
PerformanceTiming - Web APIs
you get a performancetiming object describing your page using the window.performance.timing property. properties the performancetiming interface doesn't inherit any properties. ...
Using Performance Timeline - Web APIs
ver interfaces allow an application to register an observer for specific performance event types, and when one of those event types is recorded, the application is notified of the event via the observer's callback function that was specified at the time, the observer was created. when the observer (callback) is invoked the callback's parameters include a performance observer entry list that only
contains observed performance entries. that is, the list only
contains entries for the event types that were specified when the observer's observe() method was invoked. the following example shows how to register two observers: the first one registers for several event types and the second observer only registers for one event type. function performanceobservers() { // create observer for all performa...
Performance Timeline - Web APIs
rmance observer interfaces allow an application to register an observer for specific performance event types, and when one of those event types is recorded, the application is notified of the event via the observer's callback function that was specified when the observer was created. when the observer (callback) is invoked, the callback's parameters include a performance observer entry list that
contains only observed performance entries. that is, the list
contains entries only for the event types that were specified when the observer's observe() method was invoked. the performance observer entry list interface has the same three getentries*() methods as the performance interface. however, note there is one key difference with these methods; the performance observer entry list versions are used t...
PeriodicWave - Web APIs
ning a simple sine wave. var real = new float32array(2); var imag = new float32array(2); var ac = new audiocontext(); var osc = ac.createoscillator(); real[0] = 0; imag[0] = 0; real[1] = 1; imag[1] = 0; var wave = ac.createperiodicwave(real, imag, {disablenormalization: true}); osc.setperiodicwave(wave); osc.connect(ac.destination); osc.start(); osc.stop(2); this works because a sound that
contains only a fundamental tone is by definition a sine wave here, we create a periodicwave with two values. the first value is the dc offset, which is the value at which the oscillator starts. 0 is good here, because we want to start the curve at the middle of the [-1.0; 1.0] range. the second and subsequent values are sine and cosine components. you can think of it as the result of a fourier transfor...
PopStateEvent - Web APIs
popstateevent is an event handler for the popstate event on the window. a popstate event is dispatched to the window every time the active history entry changes between two history entries for the same document. if the history entry being activated was created by a call to history.pushstate() or was affected by a call to history.replacestate(), the popstate event's state property
contains a copy of the history entry's state object. note: just calling history.pushstate() or history.replacestate() won't trigger a popstate event. the popstate event is only triggered by doing a browser action such as a clicking on the back button (or calling history.back() in javascript). and the event is only triggered when the user navigates between two history entries for the same document. note: br...
PromiseRejectionEvent() - Web APIs
nt names of the possible (non-synthetic) promiserejectionevent events that user agents can actually fire). options an object specifying details about the rejection which occurred: promise the promise that was rejected. reason any value or object which represents the reason the promise was rejected. this can be anything from a numeric error code to an error domstring to an object which
contains detailed information describing the situation resulting in the promise being rejected. return value a new promiserejectionevent configured as specified by the parameters. examples this example creates a new unhandledrejection event for the promise mypromise with the reason being the string "my house is on fire". the reason could just as easily be a number, or even an object with detailed...
PublicKeyCredential.response - Web APIs
's server. note: this property may only be used in top-level contexts and will not be available in an <iframe> for example. syntax response = publickeycredential.response value an authenticatorresponse object containing the data a relying party's script will receive and which should be sent to the relying party's server in order to validate the demand for creation or fetching. this object
contains data from the client (authenticatorresponse/clientdatajson) and from the authenticator. examples var options = { challenge: new uint8array(16) /* from the server */, rp: { name: "example corp", id : "login.example.com" }, user: { id: new uint8array(16) /* from the server */, name: "jdoe@example.com", displayname: "john doe" }, pubkeycredparams: [ { typ...
PublicKeyCredentialCreationOptions.challenge - Web APIs
authenticatorattestationresponse.attestationobject. note: when the credential is retrieved with a navigator.credentials.get() call, the signature of the challenge is contained in authenticatorassertionresponse.signature. note: a challenge will be at least 16 bytes long. syntax challenge = publickeycredentialcreationoptions.challenge value a buffersource which is at least 16 bytes long.
contains a cryptographic challenge emitted from the relying party's server which must be signed by the authenticator's private key and sent back (within the response) to the relying party's server for verification. examples var publickey = { challenge: new uint8array(26) /* this actually is given from the server */, rp: { name: "example corp", id : "login.example.com" }, user: { id:...
PublicKeyCredentialCreationOptions.excludeCredentials - Web APIs
the authenticator. the value of the strings may be: "usb": the authenticator can be contacted via a removable usb link "nfc": the authenticator may be used over nfc (near field communication) "ble": the authenticator may be used over ble (bluetooth low energy) "internal": the authenticator is specifically bound to the client device (cannot be removed). if the authenticator already
contains one of such a public key credential, the client will throw a domexception or asks the user if they want to create a new credential. examples var publickey = { excludecredentials: [ { type: "public-key", // the id for john.doe@example.com id : new uint8array(26) /* this actually is given by the server */ }, { type: "public-key", // the id for john-doe...
PublicKeyCredentialCreationOptions.extensions - Web APIs
hich may be used. if no matching authenticator is available, the credential is still generated with another available authenticator. exts boolean supported extensions. if true, the client outputs an array of strings containing the extensions which are supported by the authenticator. uvi boolean user verification index. if true, the client outputs an arraybuffer which
contains a value uniquely identifying a user verification data record. in other words, this may be used server side to check if the current operation is based on the same biometric data that the previous authentication. loc boolean location. if true, the client outputs a coordinates object representing the geolocation of the authenticator. uvm boolean user verification method...
PublicKeyCredentialCreationOptions.pubKeyCredParams - Web APIs
the pubkeycredparams property of the publickeycredentialcreationoptions dictionary is an array whose elements are objects describing the desired features of the credential to be created. these objects define the type of public-key and the algorithm used for cryptographic signature operations. if this array
contains multiple elements, they are sorted by descending order of preference. syntax pubkeycredparams = publickeycredentialcreationoptions.pubkeycredparams value an array whose elements are objects with the following properties: type a string describing type of public-key credential to be created. as of this writing (march 2019), only "public-key" may be used. alg a numeric identifier for the algorithm to be used to generate the key pair. the links between identifier and algorithm...
PublicKeyCredentialRequestOptions.challenge - Web APIs
to the server as part of the response. note: when the credential is created with a navigator.credentials.create() call, the signature of the challenge is contained within authenticatorattestationresponse.attestationobject. note: a challenge will be at least 16 bytes long. syntax challenge = publickeycredentialrequestoptions.challenge value a buffersource which is at least 16 bytes long.
contains a cryptographic challenge emitted from the relying party's server which must be signed by the authenticator's private key and sent back (within the response) to the relying party's server for verification. examples var options = { challenge: new uint8array([/* bytes sent from the server */]) }; navigator.credentials.get({ "publickey": options }) .then(function (credentialinfoassertion) {...
PublicKeyCredentialRequestOptions.extensions - Web APIs
ticator before verifying the user or testing their presence. the contenttype gives the mime type of the resource to be displayed while content gives its actual content. the client outputs the hash of the content which was displayed (hashing with the same algorithm which is used for the signature). uvi boolean user verification index. if true, the client outputs an arraybuffer which
contains a value uniquely identifying a user verification data record. in other words, this may be used server side to check if the current operation is based on the same biometric data that the previous authentication. loc boolean location. if true, the client outputs a coordinates object representing the geolocation of the authenticator. uvm boolean user verification method...
PushEvent - Web APIs
constructor pushevent.pushevent() creates a new pushevent object. properties inherits properties from its parent, extendableevent. additional properties: pushevent.data read only returns a reference to a pushmessagedata object containing data sent to the pushsubscription. methods inherits methods from its parent, extendableevent. ...
PushSubscription.toJSON() - Web APIs
the tojson() method of the pushsubscription interface is a standard serializer: it returns a json representation of the subscription properties, providing a useful shortcut. syntax mysubscription = subscription.tojson() parameters none. returns a json object. it currently only
contains the subscription endpoint, as an endpoint member. example navigator.serviceworker.ready.then(function(reg) { reg.pushmanager.getsubscription().then(function(subscription) { var mysubscription = subscription.tojson(); // do something with subscription details }) }); specifications specification status comment push apithe definition of 'pushsubscription: tojson' in that specification. working draft ...
PushSubscription - Web APIs
on expiration time associated with the push subscription, if there is one, or null otherwise. pushsubscription.options read only an object containing the options used to create the subscription. pushsubscription.subscriptionid read only a domstring containing the subscription id associated with the push subscription. methods pushsubscription.getkey() returns an arraybuffer which
contains the client's public key, which can then be sent to a server and used in encrypting push message data. pushsubscription.tojson() standard serializer — returns a json representation of the subscription properties. pushsubscription.unsubscribe() starts the asynchronous process of unsubscribing from the push service, returning a promise that resolves to a boolean when the current subscription i...
RTCDTMFSender - Web APIs
see tonebuffer for details on the format of the tone buffer. methods rtcdtmfsender.insertdtmf() given a string describing a set of dtmf codes and, optionally, the duration of and inter-tone gap between the tones, insertdtmf() starts sending the specifi...
RTCDtlsTransport.iceTransport - Web APIs
syntax var icetransport = rtcdtlstransport.icetransport; value the underlying rtcicetransport instance. examples tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdtlstransport.icetransport' in that specification. ...
RTCDtlsTransport - Web APIs
description allocation of dtls transports rtcdtlstransport objects are created when an app calls either setlocaldescription() or setremot...
RTCErrorEvent.error - Web APIs
syntax let errorinfo = rtcerrorevent.error; value an rtcerror object whose properties provide details about the error which has occurred in the context of a webrtc operation. since rtcerror is based upon domexception, it includes those properties. additional properties defined by rtcerror are: errordetail read only a domstring specifying the webrtc-specific error code identifying the type of error that occurred. receivedalert read only an unsigned long integer value indicating the fatal dtls error which was received from the network. only valid if the errordetail string is dtls-failure. ...
RTCIceCandidate.port - Web APIs
as is the case with most of rtcicecandidate's properties, the value of port is extracted from the candidate a-line string specified when creating the rtcicecandidate. the a-line string is obtained either from the rtcicecandidateinit property candidate or from a-line string passed into the constructor upon using new rtcicecandidate(). syntax var port = rtcicecandidate.port; value a 16-bit number indicating the port number on the device at the address indicated by ip at which the candidate's peer can be reached. ...
RTCIceCandidate.relatedAddress - Web APIs
ine, if it's formatted properly, being taken from its rel-address field. the related address and port (relatedport) are not used at all by ice itself; they are provided for analysis and diagnostic purposes only, and their inclusion may be blocked by security systems, so do not rely on them having non-null values. syntax var reladdress = rtcicecandidate.relatedaddress; value a domstring which
contains the candidate's related address. for both peer and server reflexive candidates, the related address (and related port) are the base for that server or peer reflexive candidate. for relay candidates, the related address and port are set to the mapped address selected by the turn server. for host candidates, relatedaddress is null, meaning the field is not included in the candidate's a-line. usag...
RTCIceCandidate.usernameFragment - Web APIs
he signaling server that includes a candidate to be added to the rtcpeerconnection, you can (and generally should) simply call addicecandidate(). there's not typically a need to manually worry about filtering the candidates. however, let's imagine that we do need to minimize traffic. the function below, ssnewcandidate(), is called when a message, signalmsg, arrives from the signaling server that
contains an ice candidate to be added to the rtcpeerconnection. to avoid including candidates obsoleted by an ice restart, we can use code like this: const ssnewcandidate = signalmsg => { let candidate = new rtcicecandidate(signalmsg.candidate); let receivers = pc.getreceivers(); receivers.foreach(receiver => { let parameters = receiver.transport.getparameters(); if (parameters.usernamefr...
RTCPeerConnectionIceEvent - Web APIs
the rtcpeerconnectioniceevent interface represents events that occurs in relation to ice candidates with the target, usually an rtcpeerconnection. only one event is of this type: icecandidate. properties a rtcpeerconnectioniceevent being an event, this event also implements these properties. rtcpeerconnectioniceevent.candidate read only
contains the rtcicecandidate containing the candidate associated with the event, or null if this event indicates that there are no further candidates to come. constructors rtcpeerconnectioniceevent() returns a new rtcpeerconnectioniceevent. it takes two parameters, the first being a domstring representing the type of the event; the second a dictionary containing the rtcicecandidate it refers to. methods a rtcpeerconnectioniceevent being an event, t...
RTCRtpReceiver - Web APIs
d rtcp transports have been combined into a single transport. use the transport property instead. methods rtcrtpreceiver.getcontributingsources() returns an array of rtcrtpcontributingsource instances for each unique csrc (contributing source) identifier received by the current rtcrtpreceiver in the last ten seconds. rtcrtpreceiver.getparameters() returns an rtcrtpparameters object which
contains information about how the rtc data is to be decoded. rtcrtpreceiver.getstats() returns a promise whose fulfillment handler receives a rtcstatsreport which
contains statistics about the incoming streams and their dependencies. rtcrtpreceiver.getsynchronizationsources() returns an array including one rtcrtpsynchronizationsource instance for each unique ssrc (synchronization source) identifier ...
RTCRtpSendParameters.encodings - Web APIs
the rtcrtpsendparameters dictionary's encodings property is an rtcrtpencodingparameters object providing configuration settings for the encoder being used for the rtcrtpsender's track. syntax sendparameters.encodings = encodingparameterlist; encodingparameterlist = sendparameters.encodings; value an array of objects conforming to the rtcrtpencodingparameters dictionary, each of which
contains properties which provide settings and parameters that describe and configure a single codec that could be used to encode the track. each object's properties are: active if true, the described encoding is currently actively being used. that is, for rtp senders, the encoding is currently being used to send data, while for receivers, the encoding is being used to decode received data. the default valu...
RTCRtpStreamStats.kind - Web APIs
the kind property of the rtcrtpstreamstats dictionary is a string indicating whether the described rtp stream
contains audio or video media. its value is always either "audio" or "video". this property was previously called mediatype. the name was changed in the specification in february, 2018. see browser compatibility below to determine how this affects the browsers you're targeting. syntax mediakind = rtcrtpstreamstats.kind; value a domstring whose value is "audio" if the track whose statistics are given by the rtcrtpstreamstats object
contains audio, or "video" if the track
contains video media. this string will always be the same as the one provided by the associated mediastreamtrack object's kind property. it will also match the statistics object's rtccodecstats.codec property's media...
RTCRtpStreamStats.trackId - Web APIs
syntax var trackid = rtcrtpstreamstats.trackid; value a domstring which uniquely identifies the rtcmediastreamtrackstats object that provides statistics for the track for which statistics are being collected by this rtcstatsreport. note: this value is not the same as the value of mediastramtrack.id. ...
RTCRtpStreamStats - Web APIs
rits its properties. in addition, some or all of the following properties are available. standard fields included for all media types codecid a domstring which uniquely identifies the object which was inspected to produce the rtccodecstats object associated with this rtp stream. kind a domstring whose value is "audio" if the associated mediastreamtrack is audio-only or "video" if the track
contains video. this value will match that of the media type indicated by rtccodecstats.codec, as well as the track's kind property. previously called mediatype. ssrc the 32-bit integer which identifies the source of the rtp packets this rtcrtpstreamstats object covers. this value is generated per the rfc 3550 specification. trackid a domstring which uniquely identifies the rtcmediastreamtrackstats ob...
RTCRtpTransceiver.direction - Web APIs
stopped. if the new value of direction is in fact different from the existing value, renegotiation of the connection is required, so a negotiationneeded event is sent to the rtcpeerconnection. effect on offers and answers the value of direction is used by rtcpeerconnection.createoffer() or rtcpeerconnection.createanswer() in order to generate the sdp generated by each of those methods. the sdp
contains an a-line which specifies the directionality. for example, if the direction is specified as "sendrecv", the corresponding sdp a-line is: a=sendrecv specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtptransceiver.direction' in that specification. candidate recommendation ...
RTCSessionDescriptionCallback - Web APIs
answers. because this function type is part of the legacy webrtc api, you should avoid using it (and the callback-based forms of createoffer() and createanswer() that make use of it). syntax rtcsessiondescriptioncallback(description); parameters description an rtcsessiondescriptioninit (or rtcsessiondescription) object describing the session being offered or being accepted. this object
contains the type and sdp properties which are part of rtcsessiondescription. return value the callback doesn't need to return anything, so the return value is undefined. example var pc = new rtcpeerconnection(); var descriptioncallback = function(offer) { pc.setlocaldescription(offer); } pc.createoffer(descriptioncallback); specifications specification status comment web...
RadioNodeList.value - Web APIs
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. ...
RadioNodeList - Web APIs
"2px" /><text x="186" y="30" font-size="12px" font-family="consolas,monaco,andale 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 wh...
Range.commonAncestorContainer - Web APIs
this means that if range.startcontainer and range.endcontainer both refer to the same node, this node is the common ancestor container. since a range need not be continuous, and may also partially select nodes, this is a convenient way to find a node which encloses a range. this property is read-only. to change the ancestor container of a node, consider using the various methods available to set the start and end positions of the range, such as range.setstart() and range.setend(). ...
Range.createContextualFragment() - Web APIs
elected node) as the context node. the html fragment parsing algorithm is used if the range belongs to a document whose htmlness bit is set. in the html case, if the context node would be html, for historical reasons the fragment parsing algorithm is invoked with body as the context instead. syntax documentfragment = range.createcontextualfragment(tagstring) parameters tagstring text that
contains text and tags to be converted to a document fragment. example var tagstring = "<div>i am a div node</div>"; var range = document.createrange(); // make the parent of the first div in the document becomes the context node range.selectnode(document.getelementsbytagname("div").item(0)); var documentfragment = range.createcontextualfragment(tagstring); document.body.appendchild(documentfragment);...
Range.getBoundingClientRect() - Web APIs
sor or selection inside a text box. see element.getboundingclientrect() for details on the returned value. syntax boundingrect = range.getboundingclientrect() example html <div id="highlight"></div> <p>this example positions a "highlight" rectangle behind the contents of a range. the range's content <b>starts here</b> and continues on until it <b>ends here</b>. ...
Range - Web APIs
trangeat() method of the selection object or the caretrangefrompoint() method of the document object. there also is the range() constructor available. properties there are no inherited properties. range.collapsed read only returns a boolean indicating whether the range's start and end points are at the same position. range.commonancestorcontainer read only returns the deepest node that
contains the startcontainer and endcontainer nodes. range.endcontainer read only returns the node within which the range ends. range.endoffset read only returns a number representing where in the endcontainer the range ends. range.startcontainer read only returns the node within which the range starts. range.startoffset read only returns a number representing where in the startcontainer the ra...
ReadableStream.ReadableStream() - Web APIs
chunks are fetched. cancel(reason) optional this method, also defined by the developer, will be called if the app signals that the stream is to be cancelled (e.g. if readablestream.cancel() is called). the contents should do whatever is necessary to release access to the stream source. if this process is asynchronous, it can return a promise to signal success or failure. the reason parameter
contains a domstring describing why the stream was cancelled. type optional this property controls what type of readable stream is being dealt with. if it is included with a value set to "bytes", the passed controller object will be a readablebytestreamcontroller capable of handling a byob (bring your own buffer)/byte stream. if it is not included, the passed controller will be a readablestreamdefault...
Response.statusText - Web APIs
syntax var mystatustext = response.statustext; value a bytestring. the default value is "". example in our fetch response example (see fetch response live) we create a new request object using the request() constructor, passing it a jpg path. we then fetch this request using fetch(), extract a blob from the response using body.blob, create an object url out of it using url.createobjecturl, and display this in an <img>. note that at the top of the fetch() block we log the response statustext value to the console. ...
Response.type - Web APIs
it can be one of the following: basic: normal, same origin response, with all headers exposed except “set-cookie” and “set-cookie2″. cors: response was received from a valid cross-origin request. certain headers and the body may be accessed. error: network error. no useful information describing the error is available. the response’s status is 0, headers are empty and immutable. this is the type for a response obtained from response.error(). opaque: response for “no-cors” request to cross-origin resource. severely restricted. opaqueredirect: the fetch request was made with redirect: "manual". ...
Response.url - Web APIs
the value of the url property will be the final url obtained after any redirects. syntax var myurl = response.url; value a usvstring. example in our fetch response example (see fetch response live) we create a new request object using the request() constructor, passing it a jpg path. we then fetch this request using fetch(), extract a blob from the response using body.blob, create an object url out of it using url.createobjecturl, and display this in an <img>. note that at the top of the fetch() block we log the response url to the console. ...
Response.useFinalURL - Web APIs
this property applies only to serviceworkers. in other contexts it will return undefined. syntax var isfinalurl = response.usefinalurl; value a boolean indicating whether or not the url is final rather than a redirect. ...
SVGAnimatedBoolean - Web APIs
ne properties readonly boolean baseval readonly boolean animval normative document svg 1.1 (2nd edition) properties name type description baseval boolean the base value of the given attribute before applying any animations. animval boolean if the given attribute or property is being animated,
contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated,
contains the same value as baseval. methods the svganimatedboolean interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check ou...
SVGAnimatedEnumeration - Web APIs
ies unsigned short baseval readonly unsigned short animval normative document svg 1.1 (2nd edition) properties name type description baseval unsigned short the base value of the given attribute before applying any animations. animval unsigned short if the given attribute or property is being animated,
contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated,
contains the same value as baseval. methods the svganimatedenumeration interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please chec...
SVGAnimatedInteger - Web APIs
ethods none properties readonly long baseval readonly long animval normative document svg 1.1 (2nd edition) properties name type description baseval long the base value of the given attribute before applying any animations. animval long if the given attribute or property is being animated,
contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated,
contains the same value as baseval. methods the svganimatedinteger interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check o...
SVGAnimatedLength - Web APIs
properties readonly svglength baseval readonly svglength animval normative document svg 1.1 (2nd edition) properties name type description baseval svglength the base value of the given attribute before applying any animations. animval svglength if the given attribute or property is being animated,
contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated,
contains the same value as baseval. methods the svganimatedlength interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check ou...
SVGAnimatedNumber - Web APIs
methods none properties float baseval readonly float animval normative document svg 1.1 (2nd edition) properties name type description baseval float the base value of the given attribute before applying any animations. animval float if the given attribute or property is being animated,
contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated,
contains the same value as baseval. methods the svganimatednumber interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out...
SVGAnimatedPathData - Web APIs
pathseg types: svg_pathseg_moveto_abs (m), svg_pathseg_lineto_abs (l), svg_pathseg_curveto_cubic_abs (c) and svg_pathseg_closepath (z). animatedpathseglist svgpathseglist provides access to the current animated contents of the 'd' attribute in a form which matches one-for-one with svg's syntax. if the given attribute or property is being animated,
contains the current animated value of the attribute or property, and both the object itself and its contents are read only. normalizedpathseglist svgpathseglist provides access to the base (i.e., static) contents of the 'd' attribute in a form where all path data commands are expressed in terms of the following subset of svgpathseg types: svg_pathseg_move...
SVGAnimatedPoints - Web APIs
normative document svg 1.1 (2nd edition) properties name type description points svgpointlist provides access to the base (i.e., static) contents of the points attribute. animatedpoints svgpointlist provides access to the current animated contents of the points attribute. if the given attribute or property is being animated,
contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated,
contains the same value as points. methods the svganimatedpoints interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out ...
SVGAnimatedString.animVal - Web APIs
animval attribute or animval property
contains the same value as the baseval property.if the given attribute or property is being animated,
contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated, then it
contains the same value as baseval the animval property is a read only property. internet explorer 9 supports script-based svg animation but it does not support declarative-based svg animation. as a result, the animval property
contains the same value as the baseval property. syntax var = object.animval specifications specification status comment scalable vector graphics (svg) 1.1 (second edition) recommendation scalable vector graphics (svg) 2 candidate recommendation ...
SVGAnimatedString - Web APIs
the svganimatedstring interface represents string attributes which can be animated from each svg declaration. you need to create svg attribute before doing anything else, everything should be declared inside this. properties svganimatedstring.animval read only this is a domstring representing the animation value. if the given attribute or property is being animated it
contains the current animated value of the attribute or property. if the given attribute or property is not currently being animated, it
contains the same value as baseval. svganimatedstring.baseval this is a domstring representing the base value. the base value of the given attribute before applying any animations. setter throws domexception. methods the svganimatedstring interface do not provide any specific methods. ...
SVGFilterElement - Web APIs
ngth that corresponds to the y attribute of the given <filter> element. svgfilterelement.width read only an svganimatedlength that corresponds to the width attribute of the given <filter> element. svgfilterelement.height read only an svganimatedlength that corresponds to the height attribute of the given <filter> element. svgfilterelement.filterresx read only an svganimatedinteger that
contains the x component of the filterres attribute of the given <filter> element. svgfilterelement.filterresy read only an svganimatedinteger that
contains the y component of the filterres attribute of the given <filter> element. methods svgfilterelement.setfilterres() sets the values of the filterres attribute. specifications specification status comment filter ef...
SVGGraphicsElement: cut event - Web APIs
bubbles yes cancelable yes interface clipboardevent event handler property oncut the eventʼs default action is to copy the current selection (if any) to the system clipboard and remove it from the document. ...
SVGSVGElement - Web APIs
the svgsvgelement interface provides access to the properties of <svg> elements, as well as methods to manipulate them. this interface
contains also various miscellaneous commonly-used utility methods, such as matrix operations and the ability to control the time of redraw on visual rendering devices. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-famil...
SVGTransform - Web APIs
this transformation. the matrix object is live, meaning that any changes made to the svgtransform object are immediately reflected in the matrix object and vice versa. in case the matrix object is changed directly (i.e., without using the methods on the svgtransform interface itself) then the type of the svgtransform changes to svg_transform_matrix. for svg_transform_matrix, the matrix
contains the a, b, c, d, e, f values supplied by the user. for svg_transform_translate, e and f represent the translation amounts (a=1, b=0, c=0 and d=1). for svg_transform_scale, a and d represent the scale amounts (b=0, c=0, e=0 and f=0). for svg_transform_skewx and svg_transform_skewy, a, b, c and d represent the matrix which will result in the given skew (e=0 and f=0). for svg_tran...
SVGTransformable - Web APIs
interface overview also implement none methods none properties readonly svganimatedtransformlist transform normative document svg 1.1 (2nd edition) properties name type description transform svganimatedtransformlist corresponds to attribute transform on the given element. methods the svgtransformable interface do not provide any specific methods. browser compatibility the compatibility table on this page is generated from structured data. ...
ScriptProcessorNode: audioprocess event - Web APIs
no cancelable no default action none interface audioprocessingevent event handler property scriptprocessornode.onaudioprocess examples scriptnode.addeventlistener('audioprocess', function(audioprocessingevent) { // the input buffer is a song we loaded earlier var inputbuffer = audioprocessingevent.inputbuffer; // the output buffer
contains the samples that will be modified and played var outputbuffer = audioprocessingevent.outputbuffer; // loop through the output channels (in this case there is only one) for (var channel = 0; channel < outputbuffer.numberofchannels; channel++) { var inputdata = inputbuffer.getchanneldata(channel); var outputdata = outputbuffer.getchanneldata(channel); // loop through the 4096 sa...
ScriptProcessorNode.bufferSize - Web APIs
ion(buffer) { mybuffer = buffer; source.buffer = mybuffer; }, function(e){"error with decoding audio data" + e.err}); } request.send(); } // give the node a function to process audio events scriptnode.onaudioprocess = function(audioprocessingevent) { // the input buffer is the song we loaded earlier var inputbuffer = audioprocessingevent.inputbuffer; // the output buffer
contains the samples that will be modified and played var outputbuffer = audioprocessingevent.outputbuffer; // loop through the output channels (in this case there is only one) for (var channel = 0; channel < outputbuffer.numberofchannels; channel++) { var inputdata = inputbuffer.getchanneldata(channel); var outputdata = outputbuffer.getchanneldata(channel); // loop through the 4096 sa...
ScriptProcessorNode.onaudioprocess - Web APIs
(buffer) { mybuffer = buffer; source.buffer = mybuffer; }, function(e){"error with decoding audio data" + e.err}); } request.send(); } // give the node a function to process audio events scriptnode.onaudioprocess = function(audioprocessingevent) { // the input buffer is the song we loaded earlier var inputbuffer = audioprocessingevent.inputbuffer; // the output buffer
contains the samples that will be modified and played var outputbuffer = audioprocessingevent.outputbuffer; // loop through the output channels (in this case there is only one) for (var channel = 0; channel < outputbuffer.numberofchannels; channel++) { var inputdata = inputbuffer.getchanneldata(channel); var outputdata = outputbuffer.getchanneldata(channel); // loop through the 4096 sa...
ScrollToOptions - Web APIs
a scrolltooptions dictionary can be provided as a parameter for the following methods: window.scroll() window.scrollby() window.scrollto() element.scroll() element.scrollby() element.scrollto() properties scrolltooptions.top specifies the number of pixels along the y axis to scroll the window or element. scrolltooptions.left specifies the number of pixels along the x axis to scroll the window or element. scrolltooptions.behavior specifies whether the scrolling should animate smoothly, or happen instantly in a single jump. ...
Selection.addRange() - Web APIs
the selection.addrange() method adds a range to a selection. syntax selection.addrange(range); parameters range a range object that will be added to the selection. example currently only firefox supports multiple selection ranges, other browsers will not add new ranges to the selection if it already
contains one. html <p>i <strong>insist</strong> that you <strong>try</strong> selecting the <strong>strong words</strong>.</p> <button>select strong words</button> javascript let button = document.queryselector('button'); button.addeventlistener('click', function () { let selection = window.getselection(); let strongs = document.getelementsbytagname('strong'); if (selection.rangecount > 0) { selection.removeallranges(); } for (let i = 0; i < strongs.length; i...
Selection - Web APIs
f the current selection. methods selection.addrange() a range object that will be added to the selection. selection.collapse() collapses the current selection to a single point. selection.collapsetoend() collapses the selection to the end of the last range in the selection. selection.collapsetostart() collapses the selection to the start of the first range in the selection. selection.
containsnode() indicates if a certain node is part of the selection. selection.deletefromdocument() deletes the selection's content from the document. selection.empty() removes all ranges from the selection. this is an alias for removeallranges() — see selection.removeallranges() for more details. selection.extend() moves the focus of the selection to a specified point. selection.getrangeat() r...
Selection API - Web APIs
yeschrome android full support yesfirefox android full support yesopera android full support yessafari ios full support yessamsung internet android full support yes
containsnode experimentalchrome full support yesedge full support 12firefox full support 4notes full support 4notes notes before firefox 35, the method didn't throw if node was null.ie no support ...
Using server-sent events - Web APIs
te: if a line doesn't contain a colon, the entire line is treated as the field name with an empty value string. examples data-only messages in the following example, there are three messages sent. the first is just a comment, since it starts with a colon character. as mentioned previously, this can be useful as a keep-alive mechanism if messages might not be sent regularly. the second message
contains a data field with the value "some text". the third message
contains a data field with the value "another message\nwith two lines". note the newline special character in the value. : this is a test stream data: some text data: another message data: with two lines named events this example sends named events. each has an event name specified by the event field, and a data field whose value is...
ServiceWorkerGlobalScope.onpush - Web APIs
ived by a service worker via a push server. syntax serviceworkerglobalscope.onpush = function(pushevent) { ... } self.addeventlistener('push', function(pushevent) { ... }) example the following example takes data from a pushevent and displays it on all of the service worker's clients. ...
Using Service Workers - Web APIs
in the resolved case, we display the image inside myimage and append it to the body (its argument is the request.response contained inside the promise’s resolve method); in the rejected case we return an error to the console. this all happens asynchronously...
Service Worker API - Web APIs
event the event object of a message event fired on a service worker (when a channel message is received on the serviceworkerglobalscope from another context) — extends the lifetime of such events. fetchevent the parameter passed into the serviceworkerglobalscope.onfetch handler, fetchevent represents a fetch action that is dispatched on the serviceworkerglobalscope of a serviceworker. it
contains information about the request and resulting response, and provides the fetchevent.respondwith() method, which allows us to provide an arbitrary response back to the controlled page. installevent the parameter passed into the oninstall handler, the installevent interface represents an install action that is dispatched on the serviceworkerglobalscope of a serviceworker. as a child of extendable...
Slottable: assignedSlot - Web APIs
ent instance, or null if the element is not assigned to a slot, or if the associated shadow root was attached with its mode set to closed (see element.attachshadow for further details). examples in our simple-template example (see it live), we create a trivial custom element example called <my-paragraph> in which a shadow root is attached and then populated using the contents of a template that
contains a slot named my-text. when <my-paragraph> is used in the document, the slot is populated by a slottable element by including it inside the element with a slot attribute with the value my-text. here is one such example: <my-paragraph> <span slot="my-text">let's have some different text!</span> </my-paragraph> in our javascript file we get a reference to the <span> shown above, then log a refe...
SourceBuffer.appendBuffer() - Web APIs
the appendbuffer() method of the sourcebuffer interface appends media segment data from an arraybuffer or arraybufferview object to the sourcebuffer. syntax sourcebuffer.appendbuffer(source); parameters source a buffersource (that is, either an arraybufferview or arraybuffer) which
contains the media segment data you want to add to the sourcebuffer. return value undefined. exceptions none. example tbd. specifications specification status comment media source extensionsthe definition of 'appendbuffer()' in that specification. recommendation initial definition. ...
SourceBuffer.appendBufferAsync() - Web APIs
of the sourcebuffer interface begins the process of asynchronously appending media segment data from an arraybuffer or arraybufferview object to the sourcebuffer. it returns a promise which is fulfilled once the buffer has been appended. syntax appendpromise = sourcebuffer.appendbufferasync(source); parameters source a buffersource (that is, either an arraybufferview or arraybuffer) which
contains the media segment data you want to add to the sourcebuffer. return value a promise which is fulfilled when the buffer has been added successfully to the sourcebuffer, or null if the request could not be initiated. example this simplified example async function, fillsourcebuffer(), takes as input parameters buffersource, buffer, and a sourcebuffer to which to append the source media from the ...
SpeechRecognition.onresult - Web APIs
ognized and this has been communicated back to the app (when the result event fires.) syntax myspeechrecognition.onresult = function() { ... }; examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object
contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object
contains speechrecognitionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalte...
SpeechRecognitionAlternative.confidence - Web APIs
ent, it always seems to return 1. syntax var myconfidence = speechrecognitionalternativeinstance.confidence; returns a number betwen 0 and 1. examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object
contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object
contains speechrecognitionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalte...
SpeechRecognitionAlternative.transcript - Web APIs
s produces a proper transcript of the session. syntax var mytranscript = speechrecognitionalternativeinstance.transcript; returns a domstring. examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object
contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object
contains speechrecognitionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalte...
SpeechRecognitionAlternative - Web APIs
nalternative.confidence read only returns a numeric estimate of how confident the speech recognition system is that the recognition is correct. examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object
contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object
contains speechrecognitionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalte...
SpeechRecognitionEvent.results - Web APIs
ults on the other hand will not be overwritten or removed. syntax var myresults = event.results; value a speechrecognitionresultlist object. examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object
contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object
contains speechrecognitionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalte...
SpeechRecognitionResult.isFinal - Web APIs
s the final time this result will be returned; if not, then this result is an interim result, and may be updated later on. syntax var myisfinal = speechrecognitionresultinstance.isfinal; returns a boolean. examples recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object
contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object
contains speechrecognitionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalte...
SpeechRecognitionResult.item() - Web APIs
to be accessed via array syntax. syntax var myalternative = speechrecognitionresultinstance[0]; returns a speechrecognitionalternative object. examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object
contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object
contains speechrecognitionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalte...
SpeechRecognitionResult.length - Web APIs
ty was set to when the speech recognition was first initiated. syntax var mylength = speechrecognitionresultinstance.length; returns a number. examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object
contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object
contains speechrecognitionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalte...
SpeechRecognitionResult - Web APIs
eechrecognitionresult.item a standard getter that allows speechrecognitionalternative objects within the result to be accessed via array syntax. examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object
contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object
contains speechrecognitionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalte...
SpeechRecognitionResultList.item() - Web APIs
list to be accessed via array syntax. syntax var myresult = speechrecognitionresultlistinstance[0]; returns a speechrecognitionresult object. examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object
contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object
contains speechrecognitionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalte...
SpeechRecognitionResultList.length - Web APIs
the number of speechrecognitionresult objects in the list. syntax var mylength = speechrecognitionresultlistinstance.length; returns a number. examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object
contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object
contains speechrecognitionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalte...
SpeechRecognitionResultList - Web APIs
s speechrecognitionresultlist.item a standard getter that allows speechrecognitionresult objects in the list to be accessed via array syntax. examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object
contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object
contains speechrecognitionalternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognitionalte...
SpeechSynthesis - Web APIs
t the synthesis voices available on the device, start and pause speech, and other commands besides. properties speechsynthesis also inherits properties from its parent interface, eventtarget. speechsynthesis.paused read only a boolean that returns true if the speechsynthesis object is in a paused state. speechsynthesis.pending read only a boolean that returns true if the utterance queue
contains as-yet-unspoken utterances. speechsynthesis.speaking read only a boolean that returns true if an utterance is currently in the process of being spoken — even if speechsynthesis is in a paused state. methods speechsynthesis also inherits methods from its parent interface, eventtarget. speechsynthesis.cancel() removes all utterances from the utterance queue. speechsynthesis.getvoice...
SpeechSynthesisErrorEvent - Web APIs
properties speechsynthesiserrorevent extends the speechsynthesisevent interface, which inherits properties from its parent interface, event. speechsynthesiserrorevent.error read only returns an error code indicating what has gone wrong with a speech synthesis attempt. methods speechsynthesiserrorevent extends the speechsynthesisevent interface, which inherits methods from its parent interface, event. ...
SpeechSynthesisEvent - Web APIs
properties the speechsynthesisevent interface also inherits properties from its parent interface, event. speechsynthesisevent.charindex read only returns the index position of the character in the speechsynthesisutterance.text that was being spoken when the event was triggered. speechsynthesisevent.elapsedtime read only returns the elapsed time in milliseconds after the speechsynthesisutterance.text started being spoken that the event was triggered at. ...
SpeechSynthesisUtterance - Web APIs
language, pitch and volume.) constructor speechsynthesisutterance.speechsynthesisutterance() returns a new speechsynthesisutterance object instance. properties speechsynthesisutterance also inherits properties from its parent interface, eventtarget. speechsynthesisutterance.lang gets and sets the language of the utterance. speechsynthesisutterance.pitch gets and sets the pitch at which the utterance will be spoken at. ...
StaticRange.endContainer - Web APIs
the endcontainer property of the staticrange interface returns the end node for the range. syntax var node = staticnode.endcontainer staticnode.endcontainer = endcontainer value the dom node which
contains the final character of the range. specifications specification status comment domthe definition of 'endcontainer' in that specification. living standard static rangethe definition of 'endcontainer' in that specification. editor's draft initial definition. ...
Storage - Web APIs
rage.setitem() when passed a key name and value, will add that key to the storage, or update that key's value if it already exists. storage.removeitem() when passed a key name, will remove that key from the storage. storage.clear() when invoked, will empty all keys out of the storage. examples here we access a storage object by calling localstorage. we first test whether the local storage
contains data items using !localstorage.getitem('bgcolor'). if it does, we run a function called setstyles() that grabs the data items using storage.getitem() and uses those values to update page styles. if it doesn't, we run another function, populatestorage(), which uses storage.setitem() to set the item values, then runs setstyles(). if(!localstorage.getitem('bgcolor')) { populatestorage(); } setsty...
StorageManager.estimate() - Web APIs
operates asynchronously, so it returns a promise which resolves once the information is available. the promise's fulfillment handler is called with a storageestimate containing the usage and quota data. syntax const estimatepromise = storagemanager.estimate(); parameters none. return value a promise that resolves to an object which conforms to the storageestimate dictionary. this dictionary
contains estimates of how much space is available to the origin in storageestimate.quota, as well as how much is currently used in storageestimate.usage. the returned values are not exact; between compression, deduplication, and obfuscation for security reasons, they will be imprecise. you may find that the quota varies from origin to origin. this variance is based on factors such as: how often the...
Storage API - Web APIs
prevent overruns. user agents may use any method they choose to determine the size of origins' quotas, and are encouraged by the specification to provide popular or frequently-used sites with extra space. to determine the estimated quota and usage values for a given origin, use the navigator.storage.estimate() method, which returns a promise that, when resolved, receives a storageestimate that
contains these figures. for example: navigator.storage.estimate().then(estimate => { // estimate.quota is the estimated quota // estimate.usage is the estimated number of bytes used }); specifications specification status comment storage living standard initial definition. ...
SubtleCrypto.encrypt() - Web APIs
ption counter = window.crypto.getrandomvalues(new uint8array(16)); return window.crypto.subtle.encrypt( { name: "aes-ctr", counter, length: 64 }, key, encoded ); } let iv = new uint8array(16); let key = new uint8array(16); let data = new uint8array(12345); //crypto functions are wrapped in promises so we have to use await and make sure the function that //
contains this code is an async function //encrypt function wants a cryptokey object const key_encoded = await crypto.subtle.importkey( "raw", key.buffer, 'aes-ctr' , false, ["encrypt", "decrypt"]); const encrypted_content = await window.crypto.subtle.encrypt( { name: "aes-ctr", counter: iv, length: 128 }, key_encoded, data ); //uint8array console.log(encrypted...
TouchEvent.changedTouches - Web APIs
ts corresponding to fingers no longer touching the surface). syntax var changes = touchevent.changedtouches; return value changes a touchlist whose touch objects include all the touch points that contributed to this touch event. example this example illustrates the touchevent object's touchevent.changedtouches property. the touchevent.changedtouches property is a touchlist object that
contains one touch object for each touch point which contributed to the event. in following code snippet, the touchmove event handler iterates through the changedtouches list and prints the identifier of each touch point that changed since the last event. someelement.addeventlistener('touchmove', function(e) { // iterate through the list of touch points that changed // since the last event and pri...
Using Touch Events - Web APIs
single active touch point. multi-touch interactions involving two or more active touch points will usually only generate touch events. to prevent the emulated mouse events from being sent, use the preventdefault() method in the touch event handlers. for more information about the interaction between mouse and touch events, see supporting both touchevent and mouseevent. basic steps this section
contains a basic usage of using the above interfaces. see the touch events overview for a more detailed example. register an event handler for each touch event type. // register touch event handlers someelement.addeventlistener('touchstart', process_touchstart, false); someelement.addeventlistener('touchmove', process_touchmove, false); someelement.addeventlistener('touchcancel', process_touchcancel, fa...
UIEvent - Web APIs
the event relative to the whole document. uievent.pagey read only returns the vertical coordinate of the event relative to the whole document. uievent.sourcecapabilities read only returns an instance of the inputdevicecapabilities interface, which provides information about the physical device responsible for generating a touch event. uievent.viewread only returns a windowproxy that
contains the view that generated the event. uievent.which read only returns the numeric keycode of the key pressed, or the character code (charcode) for an alphanumeric key pressed. methods this interface also inherits methods of its parent, event. uievent.inituievent() initializes a uievent object. if the event has already being dispatched, this method does nothing. specifications ...
URL.hash - Web APIs
note: this feature is available in web workers. syntax const string = url.hash url.hash = newhash value a usvstring. ...
URL API - Web APIs
t myusername = "someguy"; let addr = new url("https://mysite.com/login"); addr.username = myusername; setting the value of username not only sets that property's value, but it updates the overall url. after executing the code snippet above, the value returned by addr.href is https://someguy@mysite.com/login. this is true for any of the writable properties. queries the search property on a url
contains the query string portion of the url. for example, if the url is https://mysite.com/login?user=someguy&page=news, then the value of the search property is ?user=someguy&page=news. you can also look up the values of individual parameters with the urlsearchparams object's get() method: let addr = new url("https://mysite.com/login?user=someguy&page=news"); try { loginuser(addr.searchparams.get("us...
USBConfiguration.USBConfiguration() - Web APIs
syntax var usbconfiguration = new usbconfiguration(device, configurationvalue) parameters device specifies the usbdevice you want to configure. configurationvalue specifies the configuration descriptor you want to read. this is an unsigned integer in the range 0 to 255. ...
USBConfiguration - Web APIs
properties usbconfiguration.configurationvalueread only returns the configuration value of this configuration. ...
VRStageParameters - Web APIs
the vrstageparameters interface of the webvr api represents the values describing the the stage area for devices that support room-scale experiences. this interface is accessible through the vrdisplay.stageparameters property. properties vrstageparameters.sittingtostandingtransform read only
contains a matrix that transforms the sitting-space view matrices of vrframedata to standing-space. vrstageparameters.sizex read only returns the width of the play-area bounds in meters. vrstageparameters.sizey read only returns the depth of the play-area bounds in meters. examples var info = document.queryselector('p'); var vrdisplay; navigator.getvrdisplays().then(function(displays) { vrdisplay = displays[0]; var stageparams = vrdisplay.stageparameters; // stageparams is a v...
VideoPlaybackQuality - Web APIs
properties the videoplaybackquality interface doesn't inherit properties from any other interfaces. creationtime read only a domhighrestimestamp containing the time in miliseconds between the start of the navigation and the creation of the object. droppedvideoframes read only an unsigned long giving the number of video frames dropped since the creation of the associated htmlvideoelement. ...
VideoTrack.id - Web APIs
this id can be used with the videotracklist.gettrackbyid() method to locate a specific track within the media associated with a media element. the track id can also be used as the fragment of a url that loads the specific track (if the media supports media fragments). syntax var trackid = videotrack.id; value a domstring which identifies the track, suitable for use when calling gettrackbyid() on an videotracklist such as the one specified by a media element's videotracks property. specifications specification status comment html living standardthe definition of 'videotrack: id' in that specification. ...
VideoTrack.kind - Web APIs
the kind can be used to determine the scenarios in which specific tracks should be enabled or disabled. see video track kind strings for a list of the kinds available for video tracks. syntax var trackkind = videotrack.kind; value a domstring specifying the type of content the media represents. the string is one of those found in video track kind strings below. video track kind strings the kinds available for video tracks are: "alternative" a potential alternative to the main track, such as a different video take or a version of the soundtrack with only the music and no dialogue. "captions" a version of the main video track with captions burnt in. ...
VideoTrack.label - Web APIs
ain track kinds through. function gettracklist(el) { var tracklist = []; const wantedkinds = [ "main", "alternative", "commentary" ]; el.videotracks.foreach(function(track) { if (wantedkinds.includes(track.kind)) { tracklist.push({ id: track.id, kind: track.kind, label: track.label }); } }); return tracklist; } the resulting tracklist
contains an array of video tracks whose kind is one of those in the array wantedkinds, with each entry providing the track's id, kind, and label. specifications specification status comment html living standardthe definition of 'videotrack: label' in that specification. living standard ...
Visual Viewport API - Web APIs
the visual viewport api provides an explicit mechanism for querying and modifying the properties of the window's visual viewport. the visual viewport is the visual portion of a screen excluding on-screen keyboards, areas outside of a pinch-zoom area, or any other on-screen artifact that doesn't scale with the dimensions of a page. visual viewport concepts and usage the mobile web
contains two viewports, the layout viewport and the visual viewport. the layout viewport covers all the elements on a page and the visual viewport is what is actually visible on the screen. when the user pinch-zooms into the page, the visual viewport shrinks but the layout viewport is unchanged. user-interface features like the on-screen keyboard (osk) can shrink the visual viewport without affecting the layout viewp...
WebGL2RenderingContext.drawBuffers() - Web APIs
ying the buffers into which fragment colors will be written. possible values are: gl.none: fragment shader output is not written into any color buffer. gl.back: fragment shader output is written into the back color buffer. gl.color_attachment{0-15}: fragment shader output is written in the nth color attachment of the current framebuffer. return value none. exceptions if buffers
contains not one of the accepted values, a gl.invalid_enum error is thrown. examples gl.drawbuffers([gl.none, gl.color_attachment1]); specifications specification status comment webgl 2.0the definition of 'drawbuffers' in that specification. editor's draft initial definition for webgl. opengl es 3.0the definition of 'gldrawbuffers' in that specification. sta...
WebGLContextEvent.statusMessage - Web APIs
examples the statusmessage property can contain a platform dependent string with details of an event. this can occur, for example, if the webglcontextcreationerror event is fired. ...
WebGLRenderingContext.getContextAttributes() - Web APIs
the webglrenderingcontext.getcontextattributes() method returns a webglcontextattributes object that
contains the actual context parameters. might return null, if the context is lost. syntax gl.getcontextattributes(); return value a webglcontextattributes object that
contains the actual context parameters, or null if the context is lost. examples given this <canvas> element <canvas id="canvas"></canvas> and given this webgl context var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); gl.getcontextattributes(); the getcontextattributes method returns an object that describes the attributes set on this context, for example: { alpha: true, antialias: true, depth: true, failifmajorperformancecaveat: false, powerpreference: "default", premultipl...
WebGLRenderingContext.makeXRCompatible() - Web APIs
box("unable to transfer the game to your xr headset.", "cancel"); break; case invalidstateerror: showsimplemessagebox("you don't appear to have a compatible xr headset available.", "cancel"); break; default: handlefatalerror(err); break; } xrsession.end(); } } async function handlestartbuttonclick(event) { if (event.target.classlist.
contains("use-webxr") && navigator.xr) { try { xrsession = await navigator.xr.requestsession("immersive-vr"); usingxr = true; } catch(err) { xrsession = null; usingxr = false; } } startgame(); } function startgame() { currentscene = "scene1"; loadsceneresources(currentscene); /* and so on */ } this works by having two buttons, one which starts the game nor...
WebGLRenderingContext - Web APIs
ferwidth the read-only width of the current drawing buffer. should match the width of the canvas element associated with this context. webglrenderingcontext.drawingbufferheight the read-only height of the current drawing buffer. should match the height of the canvas element associated with this context. webglrenderingcontext.getcontextattributes() returns a webglcontextattributes object that
contains the actual context parameters. might return null, if the context is lost. webglrenderingcontext.iscontextlost() returns true if the context is lost, otherwise returns false. webglrenderingcontext.makexrcompatible() ensures the context is compatible with the user's xr hardware, re-creating the context if necessary with a new configuration to do so. this can be used to start an application usin...
A basic 2D WebGL animation example - Web APIs
rdata(gl.array_buffer, vertexarray, gl.static_draw); vertexnumcomponents = 2; vertexcount = vertexarray.length/vertexnumcomponents; currentangle = 0.0; rotationrate = 6; animatescene(); } after getting the webgl context, gl, we need to begin by building the shader program. here, we're using code designed to let us add multiple shaders to our program quite easily. the array shaderset
contains a list of objects, each describing one shader function to be compiled into the program. each function has a type (one of gl.vertex_shader or gl.fragment_shader) and an id (the id of the <script> element containing the shader's code). the shader set is passed into the function buildshaderprogram(), which returns the compiled and linked shader program. we'll look at how this works next. once the...
Boilerplate 1 - Web APIs
o make webgl initialization easier. boilerplate code for setting up webgl rendering context by now you are quite used to seeing the same pieces of html, css, and javascript repeated again and again. so we are going to hide them from now on. this would allow us to focus on the interesting pieces of code that are most relevant for learning webgl. specifically, the html has a <p> element that
contains some descriptive text about the page and may also hold error messages; a <canvas> element; and optionally a <button>. the css
contains rules for body, canvas, and button. any additional non-trivial css and html will be displayed on the pages of specific examples. in following examples, we will use a javascript helper function, getrenderingcontext(), to initialize the webgl rendering context. by ...
Adding 2D content to a WebGL context - Web APIs
we'll do that using a function we call initbuffers(); as we explore more advanced webgl concepts, this routine will be augmented to create more -- and more complex -- 3d objects. function initbuffers(gl) { // create a buffer for the square's positions. const positionbuffer = gl.createbuffer(); // select the positionbuffer as the o...
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
tc to select an appropriate local configuration by calling the rtcpeerconnection method setlocaldescription() without parameters. this causes setlocaldescription() to automatically generate an appropriate answer in response to the received offer. then we send the answer through the signaling channel back to the first peer. on receiving an ice candidate on the other hand, if the received message
contains an ice candidate, we simply deliver it to the local ice layer by calling the rtcpeerconnection method addicecandidate(). if an error occurs and we've ignored the most recent offer, we also ignore any error that may occur when trying to add the candidate. making negotiation perfect if you're curious what makes perfect negotiation so... perfect... this section is for you. here, we'll look at each...
A simple RTCDataChannel sample - Web APIs
, let's take a quick look at the html that's needed. there's nothing incredibly complicated here. first, we have a couple of buttons for establishing and closing the connection: <button id="connectbutton" name="connectbutton" class="buttonleft"> connect </button> <button id="disconnectbutton" name="disconnectbutton" class="buttonright" disabled> disconnect </button> then there's a box which
contains the text input box into which the user can type a message to transmit, with a button to send the entered text. this <div> will be the first peer in the channel. <div class="messagebox"> <label for="message">enter a message: <input type="text" name="message" id="message" placeholder="message text" inputmode="latin" size=60 maxlength=120 disabled> </label> <button...
WebRTC API - Web APIs
s a way to access the underlying datagram transport layer security (dtls) transport over which sctp packets for all of an rtcpeerconnection's data channels are sent and received. dictionaries rtcconfiguration used to provide configuration options for an rtcpeerconnection. rtciceserver defines how to connect to a single ice server (such as a stun or turn server). rtcrtpcontributingsource
contains information about a given contributing source (csrc) including the most recent time a packet that the source contributed was played out. events bufferedamountlow the amount of data currently buffered by the data channel—as indicated by its bufferedamount property—has decreased to be at or below the channel's minimum buffered data size, as specified by bufferedamountlowthreshold. close ...
WebSocket.close() - Web APIs
is not specified, a default value of 1005 is assumed. see the list of status codes of closeevent for permitted values. reason optional a human-readable string explaining why the connection is closing. this string must be no longer than 123 bytes of utf-8 text (not characters). exceptions thrown invalid_access_err an invalid code was specified. syntax_err the reason string is too long or
contains unpaired surrogates. note: in gecko, this method didn't support any parameters prior to gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5). specifications specification status comment html living standard the definition of 'websocket.close()' in that specification. living standard initial definition ...
Using bounded reference spaces - Web APIs
s of the origin here, (0, 0), are indicative of the fact that the boundaries are defined at floor level and are essentially a 2d shape on the floor, like an invisible fence used to keep pets from getting away from home. the full coordinates here would be (0, 0, 0). this boundary is maintained in the xrboundedreferencespace in the the xrboundedreferencespace property boundsgeometry. this property
contains an array of dompointreadonly objects, each of which defines one of the points making up the space's border, moving around the room in clockwise order. each vertex in the array has a y coordinate of 0 since the entire boundary is defined at floor level, extending upward to the ceiling or indefinitely. each point's w is always 1 as well. the interior of the bounded area is always considered to be ...
Inputs and input sources - Web APIs
the xrsession for which the input sources have changed. added an array of zero or more xrinputsource objects indicating the input sources that have been newly added to the xr system. removed an array of zero or more xrinputsource objects indicating any input sources that have been removed from the xr system. identifying the input's profile each input source has a profiles property, which
contains a live list of the webxr input profiles which apply to the input source, in order of specificity from most-specific to least. in order to do anything meaningful involving scanning of profiles beyond basic identification of features, you may need to import the json profile database from the webxr input profiles registry. see input profiles for more specific details on working with input profiles...
Movement, orientation, and motion: A WebXR example - Web APIs
each entry is displayed with up to two decimal places. everything else the rest of the code is identical to that found in the earlier examples: initshaderprogram() initializes the glsl shader program, calling loadshader() to load and compile each shader's program, then attaching each one to the webgl context. once they're compiled, the program is linked and returned to the c...
Rendering and the WebXR frame animation callback - Web APIs
e time that has elapsed since the last frame was rendered: let lastframetime = 0; function drawframe(time, frame) { /* ... schedule next frame, prepare the buffer, etc ... */ const deltatime = (time - lastframetime) * 0.001; lastframetime = time; for (let view of pose.views) { /* render each view */ } } this maintains a global (or an object property) called lastframetime which
contains the previous frame's time of rendering. in this case, since the time values are stored in milliseconds, we multiply by 0.001 to convert the time into seconds. in some cases, this saves time later. in other situations, you need the time in milliseconds, so you wouldn't need to change anything. with the elapsed time in hand, your rendering code has the means to compute just how much every moving o...
Keyframe Formats - Web APIs
ribed below) may be specified alongside the property values. element.animate({ opacity: [ 0, 0.9, 1 ], offset: [ 0, 0.8 ], // shorthand for [ 0, 0.8, 1 ] easing: [ 'ease-in', 'ease-out' ], }, 2000); after generating a suitable set of keyframes from the property value lists, each supplied offset is applied to the corresponding keyframe. if there are insufficient values, or if the list
contains null values, the keyframes without specified offsets will be evenly spaced as with the array format described above. if there are too few easing or composite values, the corresponding list will be repeated as needed. implicit to/from keyframes in newer browser versions, you are able to set a beginning or end state for an animation only (i.e. a single keyframe), and the browser will infer ...
Using the Web Animations API - Web APIs
we can divide her duration in half to get the midpoint for her animation’s timeline, setting her to be normal height. now we can reverse and play her animation in either direction to make her grow smaller or larger! and we can do the same thing when setting the cake and bottle durations: var drinking = document.getelementbyid('liquid').animate( [ { height:...
Web Audio API best practices - Web APIs
'); button.addeventlistener('click', function() { // check if context is in suspended state (autoplay policy) if (audioctx.state === 'suspended') { audioctx.resume(); } }, false); you might instead be working with an offlineaudiocontext, in which case you can resume the suspended audio context with the startrendering() method. user control if your website or application
contains sound, you should allow the user control over it, otherwise again, it will become annoying. this can be achieved by play/stop and volume/mute controls. the using the web audio api tutorial goes over how to do this. if you have buttons that switch audio on and off, using the aria role="switch" attribute on them is a good option for signalling to assistive technology what the button's exact purpos...
Example and tutorial: Simple synth keyboard - Web APIs
waveform to use for the notes. volumecontrol is the <input> element (of type "range") used to control the master audio volume. let notefreq = null; let customwaveform = null; let sineterms = null; let cosineterms = null; finally, global variables that will be used when constructing waveforms are created: notefreq will be an array of arrays; each array represents one octave, each of which
contains one entry for each note in that octave. the value for each is the frequency, in hertz, of the note's tone. customwaveform will be set up as a periodicwave describing the waveform to use when the user selects "custom" from the waveform picker. sineterms and cosineterms will be used to store the data for generating the waveform; each will contain an array that's generated when the user chooses "c...
Background audio processing using AudioWorklet - Web APIs
using at first, even though they're actually very simple once you realize what's going on. let's start at the inside and work our way out. fundamentally, the audio for a single audio channel (such as the left speaker or the subwoofer, for example) is represented as a float32array whose values are the individual audio samples. by specification, each block of audio your process() function receives
contains 128 frames (that is, 128 samples for each channel), but it is planned that this value will change in the future, and may in fact vary depending on circumstances, so you should always check the array's length rather than assuming a particular size. it is, however, guaranteed that the inputs and outputs will have the same block length. each input can have a number of channels. a mono input has a s...
Web Authentication API - Web APIs
nd authenticatordata with the private key generated for this account during the registration call. authenticator returns data to browser - the authenticator returns the authenticatordata and assertion signature back to the browser. browser creates final data, application sends response to server - the browser resolves the promise to a publickeycredential with a publickeycredential.response that
contains the authenticatorassertionresponse. it is up to the javascript application to transmit this data back to the server using any protocol and format of its choice. server validates and finalizes authentication - upon receiving the result of the authentication request, the server performs validation of the response such as: using the public key that was stored during the registration request t...
Web Workers API - Web APIs
ackground thread separate from the main execution thread of a web application. the advantage of this is that laborious processing can be performed in a separate thread, allowing the main (usually the ui) thread to run without being blocked/slowed down. web workers concepts and usage a worker is an object created using a constructor (e.g. worker()) that runs a named javascript file — this file
contains the code that will run in the worker thread; workers run in another global context that is different from the current window. this context is represented by either a dedicatedworkerglobalscope object (in the case of dedicated workers - workers that are utilized by a single script), or a sharedworkerglobalscope (in the case of shared workers - workers that are shared between multiple scripts). yo...
Window.controllers - Web APIs
the controllers property of the window interface returns the xul controllers of the chrome window. syntax controllers = window.controllers controllers is an object of type xulcontrollers (nsicontrollers). specification xul-specific. not part of specification. by default, a window's controller
contains the code that supports the global window commands. chrome code can add controllers (to be used in conjunction with the godocommand and goupdatecommand functions in globaloverlay.js). however, the added controllers must be explicitly removed when the window is unloaded, as this is not done automatically. each missing removal can cause bug 415775: assertion: xpconnect is being called on a scope without a 'components' property! ...
Window.getComputedStyle() - Web APIs
, ::before, ::marker, ::line-marker — see the pseudo-element spec). <style> h3::after { content: ' rocks!'; } </style> <h3>generated content</h3> <script> var h3 = document.queryselector('h3'); var result = getcomputedstyle(h3, ':after').content; console.log('the generated content is: ', result); // returns ' rocks!' </script> notes the returned cssstyledeclaration object
contains active values for css property longhand names. for example, border-bottom-width instead of the border-width and border shorthand property names. it is safest to query values with only longhand names like font-size. shorthand names like font will not work with most browsers. css property values may be accessed using the getpropertyvalue(propname) api or by indexing directly into the object such a...
Window.open() - Web APIs
od creates a new secondary browser window, similar to choosing new window from the file menu. the url parameter specifies the url to be fetched and loaded in the new window. if url is an empty string, then a new blank, empty window (url about:blank) is created with the default toolbars of the main window. note that remote urls won't load immediately. when window.open() returns, the window always
contains about:blank. the actual fetching of the url is deferred and starts after the current script block finishes executing. the window creation and the loading of the referenced resource are done asynchronously. examples var windowobjectreference; var windowfeatures = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes"; function openrequestedpopup() { windowobjectreference = window.
Window.openDialog() - Web APIs
e of its different default assumptions. default behavior the chrome and dialog features are always assumed on, unless explicitly turned off ("chrome=no"). opendialog() treats the absence of the features parameter the same way window.open() does; that is, an empty string sets all features to off) except chrome and dialog, which default to on. if the features parameter is a zero-length string, or
contains only one or more of the behavior features (chrome, dependent, dialog and modal) the chrome features are assumed "os' choice." that is, window creation code is not given specific instructions, but is instead allowed to select the chrome that best fits a dialog on that operating system. passing extra parameters to the dialog to pass extra parameters into the dialog, you can simply supply them aft...
Window: popstate event - Web APIs
story entry to the history stack, that history entry is used instead. bubbles yes cancelable no interface popstateevent event handler property onpopstate the history stack if the history entry being activated was created by a call to history.pushstate() or was affected by a call to history.replacestate(), the popstate event's state property
contains a copy of the history entry's state object. these methods and their corresponding events can be used to add data to the history stack which can be used to reconstruct a dynamically generated page, or to otherwise alter the state of the content being presented while remaining on the same document. note that just calling history.pushstate() or history.replacestate() won't trigger a popstate event...
window.postMessage() - Web APIs
for idn host names only, the value of the origin property is not consistently unicode or punycode; for greatest compatibility check for both the idn and punycode values when using this property if you expect messages from idn sites. this value will eventually be consistently idn, but for now you should handle both idn and punycode forms. the value of the origin property when the sending window
contains a javascript: or data: url is the origin of the script that loaded the url. using window.postmessage in extensions window.postmessage is available to javascript running in chrome code (e.g., in extensions and privileged code), but the source property of the dispatched event is always null as a security restriction. (the other properties have their expected values.) it is not possible for con...
Window.prompt() - Web APIs
', 'sure'); // open the window with text "are you feeling lucky" and default value "sure" when the user clicks the ok button, text entered in the input field is returned. if the user clicks ok without entering any text, an empty string is returned. if the user clicks the cancel button, this function returns null. the above prompt appears as follows (in chrome on os x): notes a prompt dialog
contains a single-line textbox, a cancel button, and an ok button, and returns the (possibly empty) text the user entered into that textbox. the following text is shared between this article, dom:window.confirm and dom:window.alert dialog boxes are modal windows; they prevent the user from accessing the rest of the program's interface until the dialog box is closed. for this reason, you should not overus...
window.requestIdleCallback() - Web APIs
to cancel the callback by passing it into the window.cancelidlecallback() method. parameters callback a reference to a function that should be called in the near future, when the event loop is idle. the callback function is passed an idledeadline object describing the amount of time available and whether or not the callback has been run because the timeout period expired. options optional
contains optional configuration parameters. currently only one property is defined: timeout: if timeout is specified and has a positive value, and the callback has not already been called by the time timeout milliseconds have passed, the callback will be called during the next idle period, even if doing so risks causing a negative performance impact. example see our complete example in the arti...
Window.resizeBy() - Web APIs
shrink the window window.resizeby(-200, -200); notes this method resizes the window relative to its current size. to resize the window in absolute terms, use window.resizeto(). creating and resizing an external window for security reasons, it's no longer possible in firefox for a website to change the default size of a window in a browser if the window wasn’t created by window.open(), or
contains more than one tab. see the compatability table for details on the change. even if you create window by window.open() it is not resizable by default. to make the window resizable, you must open it with the "resizable" feature. // create resizable window myexternalwindow = window.open("http://myurl.domain", "mywindowname", "resizable"); // resize window to 500x500 myexternalwindow.resizeto(500...
WindowEventHandlers.onpopstate - Web APIs
e windoweventhandlers mixin is the eventhandler for processing popstate events on the window. a popstate event is dispatched to the window each time the active history entry changes between two history entries for the same document. if the activated history entry was created by a call to history.pushstate(), or was affected by a call to history.replacestate(), the popstate event's state property
contains a copy of the history entry's state object. note: calling history.pushstate() or history.replacestate() won't trigger a popstate event. the popstate event is only triggered by performing a browser action, such as clicking on the back button (or calling history.back() in javascript), when navigating between two history entries for the same document. syntax window.onpopstate = funcref; fun...
WindowOrWorkerGlobalScope.atob() - Web APIs
se cause communication problems, then transmit it and use the atob() method to decode the data again. for example, you can encode, transmit, and decode control characters such as ascii values 0 through 31. for use with unicode or utf-8 strings, see the note on "unicode strings" in the page for btoa(). syntax var decodeddata = scope.atob(encodeddata); parameters encodeddata a binary string
contains an base64 encoded data. return value an ascii string containing decoded data from encodeddata. exceptions domexception (name: invalidcharactererror) throws if encodeddata is not valid base64. example const encodeddata = window.btoa('hello, world'); // encode a string const decodeddata = window.atob(encodeddata); // decode the string polyfill you can use a polifill from https://github...
WindowOrWorkerGlobalScope.fetch() - Web APIs
ulted to manual). referrer a usvstring specifying the referrer of the request. this can be a same-origin url, about:client, or an empty string. referrerpolicy specifies the referrer policy to use for the request. may be one of no-referrer, no-referrer-when-downgrade, same-origin, origin, strict-origin, origin-when-cross-origin, strict-origin-when-cross-origin, or unsafe-url. integrity
contains the subresource integrity value of the request (e.g., sha256-bpfbw7ivv8q2jlit13fxdyae2tjllusrsz273h2nfse=). keepalive the keepalive option can be used to allow the request to outlive the page. fetch with the keepalive flag is a replacement for the navigator.sendbeacon() api. signal an abortsignal object instance; allows you to communicate with a fetch request and abort it if desired via a...
WorkerGlobalScope - Web APIs
each workerglobalscope has its own event loop. this interface is usually specialized by each worker type: dedicatedworkerglobalscope for dedicated workers, sharedworkerglobalscope for shared workers, and serviceworkerglobalscope for serviceworker. the self property returns the specialized scope for each context. ...
WritableStream.WritableStream() - Web APIs
, also defined by the developer, will be called if the app signals that it wishes to abruptly close the stream and put it in an errored state. it can clean up any held resources, much like close(), but abort() will be called even if writes are queued up — those chunks will be thrown away. if this process is asynchronous, it can return a promise to signal success or failure. the reason parameter
contains a domstring describing why the stream was aborted. queuingstrategy optional an object that optionally defines a queuing strategy for the stream. this takes two parameters: highwatermark a non-negative integer — this defines the total number of chunks that can be contained in the internal queue before backpressure is applied. size(chunk) a method containing a parameter chunk — ...
How to check the security state of an XMLHTTPRequest over SSL - Web APIs
r_net_interrupt, network(71) errname = 'networkinterrupterror'; break; default: errname = 'networkerror'; break; } } // xxx we have no tcperror implementation right now because it's really hard to // do on b2g18. on mozilla-central we want a proper tcperror that ideally // sub-classes domerror. bug 867872 has been filed to implement this and //
contains a documented tcperror.webidl that maps all the error codes we use in // this file to slightly more readable explanations. let error = cc["@mozilla.org/dom-error;1"].createinstance(ci.nsidomdomerror); error.wrappedjsobject.init(errname); return error; // xxx: errtype goes unused } function dumpsecurityinfo(xhr, error) { let channel = xhr.channel; try { dump("connection statu...
XMLHttpRequest.onreadystatechange - Web APIs
warning: this should not be used with synchronous requests and must not be used from native code. syntax xmlhttprequest.onreadystatechange = callback; values callback is the function to be executed when the readystate changes. ...
XMLHttpRequest.responseText - Web APIs
while handling an asynchronous request, the value of responsetext always has the current content received from the server, even if it's incomplete because the data has not been completely received yet. ...
XMLHttpRequest.responseType - Web APIs
value specifying the type of data contained in the response. it also lets the author change the response type. if an empty string is set as the value of responsetype, the default value of text is used. syntax var type = xmlhttprequest.responsetype; xmlhttprequest.responsetype = type; value a string taken from the xmlhttprequestresponsetype enum which specifies what type of data the response
contains. when setting responsetype to a particular value, the author should make sure that the server is actually sending a response compatible with that format. if the server returns data that is not compatible with the responsetype that was set, the value of response will be null. the values supported by responsetype are the following: "" an empty responsetype string is treated the same as "tex...
XMLHttpRequest.statusText - Web APIs
if the request's readystate is in unsent or opened state, the value of statustext will be an empty string. if the server response doesn't explicitly specify a status text, statustext will assume the default value "ok". ...
XMLHttpRequest - Web APIs
get and of eventtarget. xmlhttprequest.onreadystatechange an eventhandler that is called whenever the readystate attribute changes. xmlhttprequest.readystate read only returns an unsigned short, the state of the request. xmlhttprequest.response read only returns an arraybuffer, blob, document, javascript object, or a domstring, depending on the value of xmlhttprequest.responsetype, that
contains the response entity body. xmlhttprequest.responsetext read only returns a domstring that
contains the response to the request as text, or null if the request was unsuccessful or has not yet been sent. xmlhttprequest.responsetype is an enumerated value that defines the response type. xmlhttprequest.responseurl read only returns the serialized url of the response or the empty string if the ...
XPathEvaluator.createExpression() - Web APIs
xes, including the xml namespace prefix, within the xpath expression into appropriate namespace uris. return value a xpathexpression representing the compiled form of the xpath expression. exceptions invalid_expression_err if the expression is not legal according to the rules of the xpathevaluator, an xpathexception of type invalid_expression_err is raised. namespace_err if the expression
contains namespace prefixes which cannot be resolved by the specified xpathnsresolver, a domexception of type namespace_error is raised. example the following example shows the use of the evaluate() method. html <div>xpath example</div> <div>number of <div>s: <output></output></div> javascript var xpath = "//div"; var evaluator = new xpathevaluator(); var expression = evaluator.createexpressi...
XPathEvaluator.evaluate() - Web APIs
athresult object representing the result of evaluating the xpath expression. exceptions invalid_expression_err if the expression is not legal according to the rules of the xpathevaluator, an xpathexception of type invalid_expression_err is raised. type_err in case result cannot be converted to the specified type, an xpathexception of type type_err is raised. namespace_err if the expression
contains namespace prefixes which cannot be resolved by the specified xpathnsresolver, a domexception of type namespace_error is raised. wrong_document_err if the provided context node is from a document that is not supported by the xpathevaluator, a domexception of type wrong_document_err is raised. not_supported_err if the provided context node is not a type permitted as an xpath context node or the...
XPathException - Web APIs
in the dom xpath api the xpathexception interface represents exception conditions that can be encountered while performing xpath operations. properties xpathexception.code read only returns a short that
contains one of the error code constants. constants constant value description invalid_expression_err 51 if the expression has a syntax error or otherwise is not a legal expression according to the rules of the specific xpathevaluator or
contains specialized extension functions or variables not supported by this implementation. type_err 52 if the expression cannot be converted to return the specified type. specifications specification status comment document object model (dom) level 3 xpath specificationthe d...
XPathExpression.evaluate() - Web APIs
athresult object representing the result of evaluating the xpath expression. exceptions invalid_expression_err if the expression is not legal according to the rules of the xpathevaluator, an xpathexception of type invalid_expression_err is raised. type_err in case result cannot be converted to the specified type, an xpathexception of type type_err is raised. namespace_err if the expression
contains namespace prefixes which cannot be resolved by the specified xpathnsresolver, a domexception of type namespace_error is raised. wrong_document_err if the provided context node is from a document that is not supported by the xpathevaluator, a domexception of type wrong_document_err is raised. not_supported_err if the provided context node is not a type permitted as an xpath context node or the...
XRInputSourceEvent() - Web APIs
hich has occurred on a webxr user input device represented by an xrinputsource. syntax newinputsourceevent = new xrinputsourceevent(type, eventinitdict); parameters type a domstring indicating which of the input source events the new object will represent. permitted values are listed under event types below. eventinitdict an object based on the xrinputsourceeventinit dictionary which
contains the values to assign to the new event's properties. return value a new xrinputsourceevent object representing the event described by the given type and eventinitdict. event types select sent to an xrsession when the sending input source has fully completed a primary action. selectend sent to an xrsession when an ongoing primary action ends, or when an input source with an ongoing primar...
XRRenderState - Web APIs
these properties include the range of distances from the viewer within which content should be rendered, the vertical field of view (for inline presentations), and a reference to the xrwebgllayer being used as the target for rendering the scene prior to it being presented on the xr device's display or displays. when you apply changes using the xrsession method updaterenderstate(), the specified changes take effect after the current animation frame has completed, but before the next one begins. properties the followiing properties are available on xrrenderstate objects. ...
XRRigidTransform.inverse - Web APIs
the read-only inverse property of the xrrigidtransform interface returns another xrrigidtransform object which is the inverse of its owning transform. that is, you can always get the inverse of any xrrigidtransform using its inverse property, instead of having to explicitly generate it. syntax let transforminverse = xrrigidtransform.inverse; value an xrrigidtransform which
contains the inverse of the xrrigidtransform on which it's accessed. applying the inverse of a transform to any object previously transformed by the parent xrrigidtransform always undoes the transformation, resulting in the object returning to its previous pose. in other words, its position and orientation both return to their prior configurations. examples in this example, the model view matrix for an object is computed...
XRRigidTransform.orientation - Web APIs
orm property orientation is a dompointreadonly containing a normalized quaternion (also called a unit quaternion or versor) specifying the rotational component of the transform represented by the object. if you specify a quaternion whose length is not exactly 1.0 meters, it will be normalized for you. syntax let orientation = xrrigidtransform.orientation; value a dompointreadonly object which
contains a unit quaternion providing the orientation component of the transform. as a unit quaternion, the length of the returned quaternion is always 1.0 meters. examples to create a reference space which is oriented to look straight up, positioned 2 meters off of ground level: xrreferencespace = refspace.getoffsetreferencespace( new xrrigidtransform({y: -2}, {x: 0.0, y: 1.0, z: 0.0, w: 1.0}); ); ...
XRRigidTransform - Web APIs
s a new xrrigidtransform object which represents a transform that applies a specified position and/or orientation. attributes xrrigidtransform.position read only a dompointreadonly specifying a 3-dimensional point, expressed in meters, describing the translation component of the transform. the w attribute is always 1.0. xrrigidtransform.orientation read only a dompointreadonly which
contains a unit quaternion describing the rotational component of the transform. as a unit quaternion, its length is always normalized to 1.0. xrrigidtransform.matrix read only returns the transform matrix in the form of a 16-member float32array. see the section matrix format for how the array is used to represent a matrix. xrrigidtransform.inverse read only returns a xrrigidtransform which i...
XRSession.environmentBlendMode - Web APIs
the xrsession interface's read-only environmentblendmode property identifies if—and to what degree—the computer-generated imagery is overlaid atop the real world. this is used to differentiate between fully-immersive vr sessions and ar sessions which render over a pass-through image of the real world, possibly partially transparently. the value is a domstring which
contains one of the values defined by the xrenvironmentblendmode enumerated type. important: environmentblendmode is part of the webxr augmented reality module, which has not yet reached a stable state. you should use caution when using its features. syntax blendmode = xrsession.environmentblendmode; value a domstring whose value is one of the strings found in the enumerated type xrenvironmentblendmode, defining if—and i...
XRSession: inputsourceschange event - Web APIs
the inputsourceschange event is sent to an xrsession when the set of available webxr input devices changes. the received event, of type xrinputsourceschangeevent,
contains a list of any newly added and/or removed input devices. bubbles yes cancelable no interface xrinputsourceschangeevent event handler property oninputsourceschange the event object
contains lists of the newly-added and/or removed input devices in its added and removed properties. examples specifications specification status comment webxr device apithe definition of 'inputsourceschange event' in that specification. working draft initial definition. ...
XRSession.onsqueezeend - Web APIs
receives a squeezestart event, indicating the ending of a primary squeeze action. examples this snippet of code adds a simple handler for the squeezeend event, which responds only to events on the user's dominant hand. in response to the end of the squeeze operation, this code looks to see if there is an object currently being held by the user by checking to see if the variable user.heldobject
contains a reference to an object representing the held item. if heldobject has an object reference, that object is passed to a function called cancelobjectdrag(), which would be written to return the object to its original position. this takes care of the situation in which the drag is aborted or canceled. xrsession.onsqueezeend = event => { if (event.inputsource.handedness == user.handedness) { ...
XRSession - Web APIs
hrough the xr device and how the device will blend the device imagery with it. note: environmentblendmode() is part of the webxr augmented reality module, which has not been completed. inputsources read only returns a list of this session's xrinputsources, each representing an input device used to control the camera and/or scene. renderstate read only an xrrenderstate object which
contains options affecting how the imagery is rendered. this includes things such as the near and far clipping planes (distances defining how close and how far away objects can be and still get rendered), as well as field of view information. visibilitystate read only a domstring whose value is one of those found in the xrvisibilitystate enumerated type, indicating whether or not the session's imagery...
XRSessionEvent() - Web APIs
resenting an augmented or virtual reality session. syntax newxrsessionevent = new xrsessionevent(type, eventinitdict); parameters type a domstring indicating which of the events represented by objects of type xrsessionevent this particular object represents. see event types for a list of the permitted values. eventinitdict an object conforming to the xrsessioneventinit dictionary which
contains values to be applied to the newly-created event object. permitted values are: session the xrsession to which the event is to be delivered. return value a newly-created xrsessionevent object representing an object of the specfied type and configured as described by the eventinitdict parameter. event types the following events are represented using the xrsessionevent interface, and are...
XRViewerPose.views - Web APIs
important: there is no guarantee that the number of views will remain constant over the lifetime of an xrsession. for each frame, you should always use the current length of this array rather than caching the value. stereo views require two views to render properly, with the left eye's view having its eye set to the string left and the right eye's view a value of right. ...
XRWebGLLayerInit.stencil - Web APIs
when using the xrwebgllayer() constructor to create a new webgl rendering layer for webxr, providing as the layerinit parameter an object whose stencil property is false requests that the new layer be created without a stencil buffer. the stencil buffer is an optional buffer which, just like the depth buffer,
contains one entry for every pixel in the frame buffer. also just like the depth buffer, the value of an enter in the stencil buffer directly affects how (or if) the corresponding pixel is drawn during rendering. you can store values into each entry in the stencil bufer, then specify an operation that determines which stencil buffer values correspond to pixels which should be drawn to the screen during each frame. syntax let layerinit = { stencil: false }; let gllayer = new xrwebgllay...
XSLT Basic Example - Web APIs
basic example this first example demonstrates the basics of setting up an xslt transformation in a browser. the example will take an xml document that
contains information (title, list of authors and body text) about an article and present it in an human readable form. figure 1 shows the source of the basic xslt example. the xml document (example.xml)
contains the information about the article. using the ?xml-stylesheet? processing instruction, it links to the xslt stylesheet (example.xsl) via its href attribute. an xslt stylesheet starts with the xsl:stylesheet element, which
contains all the templates used to create the final output. the example in figure 1 has two templates - one that matches the root node and one that matches author nodes. the template that matches the root node outpu...
Generating HTML - Web APIs
generating html one common application of xslt in the browser is to transform xml into html on the client. the second example will transform the input document (example2.xml), which again
contains information about an article, into an html document. the <body> element of the article now
contains html elements (a <b> and <u> tag, see figure 2). the xml document
contains both html elements and xml elements, but only one namespace is needed, namely for the xml elements. since there is no html namespace, and using the xhtml namespace would force the xsl to create an xml document that would not behave like a html document, the xsl:output in the xsl stylesheet will make sure the resulting document will be handled as html. for the xml elements, our own namespace is needed, http://devedge.netscape.com/...
Using the alertdialog role - Accessibility
occurs. in other words, when a dialog's information and controls require the user's immediate attention alertdialog should be used instead of dialog. it is up to the developer to make this distinction though. because of its urgent nature, alert dialogs must always be modal. note: this role should only be used for alert messages that have associated interactive controls. if an alert dialog only
contains static content and has no interactive controls at all, alertdialog is likely not the right role to use here. the alert role should be used instead in that case (as the described in the using the alert role technique). possible effects on user agents and assistive technology when the alertdialog role is used, the user agent should do the following: expose the element as a dialog in the opera...
Using the aria-labelledby attribute - Accessibility
="mynameid">name</div> <input type="text" aria-labelledby="mybillingid mynameid"/> </div> <div> <div id="myaddressid">address</div> <input type="text" aria-labelledby="mybillingid myaddressid"/> </div> example 2: associating headings with regions in the example below, header elements are associated with the content they head. note that the region being referenced is the region that
contains the header. <div role="main" aria-labelledby="foo"> <h1 id="foo">wild fires spread across the san diego hills</h1> strong winds expand fires ignited by high temperatures ... </div> example 3: radio groups in the example below, the container of a radiogroup is associated with its label using the aria-labelledby attribute: <div id="radio_label">my radio label</div> <ul role="radiogroup" ...
Using the aria-relevant attribute - Accessibility
the aria-relevant attribute is an optional value used to describe what types of changes have occurred to an aria-live region, and which are relevant and should be announced. any change that is not relevant acts in the same manner it would if the aria-live attribute were set to off. aria-relevant is commonly used when a web page
contains content that may be updated while viewing the page. values a space-delimited list of one or more of the following values: additions element nodes added to the accessibility tree within the live region; should be considered relevant. removals are deletion of nodes in the accessiblity tree; should be considered relevant. text are changes to the textual content of existing nodes; should be considered relevant. all is equivalent to additions removals t...
ARIA: timer role - Accessibility
ot necessarily need to be machine parsable, it should continuously update at regular intervals unless the timer is paused or reaches its end-point. associated wai-aria roles, states, and properties aria-label used to provide the name of the timer. aria-live elements with the role timer have an implicit aria-live value of off. aria-describedby used to indicate the idref of an element that
contains additional instructions for navigating or operating this element. aria-roledescription used to give the timer a more descriptive role text for screen readers to speak. this should be localized. keyboard interactions keyboard interaction is xxx. focus is being managed via xxx. the tab , space and enter keys, as well as escape , must be handled by the application. the one exception is if focu...
ARIA: document role - Accessibility
quired by any attributes. for example, if the document is collapsible, then the state and the value of aria-expanded must be maintained. examples an example is gmail and the single conversation view. gmail is a web application. when in gmail, most user agent interactions are usurped by the application. however, when the keyboard focus is set on the starting heading on a single conversation that
contains the subject of the conversation, the screen reader user can use the reading mode commands to read through the messages, expand or collapse them, and manipulate them. once focus returns to the message list either by activating the back button or pressing an asociated keystroke, direct application interaction mode is invoked again, and the user can move to a different conversation in the list with ...
ARIA: feed role - Accessibility
cle to article and efficiently discern which articles they want to read. the feed pattern enables reliable assistive technology reading mode interaction by establishing the following interoperability agreement between the web page and assistive technologies: in the context of a feed, the web page code is responsible for: appropriate visual scrolling of the content based on which article
contains dom focus. loading or removing feed articles based on which article
contains dom focus. in the context of a feed, assistive technologies with a reading mode are responsible for: indicating which article
contains the reading cursor by ensuring the article element or one of its descendants has dom focus. providing reading mode keys that move dom focus to the next and previous arti...
ARIA: form role - Accessibility
<!-- form content --> </div> this is a form that collects and saves a user's contact information. important: use an html <form> element to contain your form controls, rather than the aria form role, unless you have a very good reason. the html <form> element is sufficient to tell assistive technologies that there is a form. description a form landmark identifies a region of content that
contains a collection of items and objects that, as a whole, combine to create a form when no other named landmark is appropriate (e.g. main or search). using the <form> element will automatically communicate a section of content as a form landmark, if it is provided an accessible name. developers should always prefer using the correct semantic html element over using aria. use the html <form...
ARIA: Main role - Accessibility
ify the relationship of the main to it's document or application ancestor. example <body> <!-- primary navigation --> <div role="main"> <h1>the the first indochina war</h1> <!-- article content --> </div> <!-- sidebar and footer --> </body> accessibility concerns use only one main role per document the main landmark role should only be used once per document. if a document
contains two main roles, say updating page content when triggered by javascript, the inactive main role's presence should be removed from assistive technology via techniques such as toggling the hidden attribute. <main> <h1>active <code>main</code> element</h1> <!-- content --> </main <main hidden> <h1>hidden <code>main</code> element</h1> <!-- content --> </main> best practices prefer html ...
ARIA: table role - Accessibility
n individual cells of the table can be interactive. using a native html table element whenever possible is strongly encouraged. if a table maintains a selection state, has two-dimensional navigation, or allows the user to rearrange cell order use grid or treegrid instead. to create an aria table, add role="table" to the container element. within that container, each row has role="row" set and
contains child cells. each cell has a role of either columnheader, rowheader, or simply cell. rows can be children of the table or within a rowgroup. the table caption can be defined via aria-labelledby or aria-label. all other semantic table elements, such as <tbody>, <thead>, <tr>, <th>, and <td> need to be added via associated roles, such as rowgroup, row, columnheader, and cell. if the table contai...
ARIA: dialog role - Accessibility
ts like a grouping label for the controls inside it (similar to how a <legend> element provides a grouping label for the controls inside a <fieldset> element). if a dialog already has a visible title bar, the text inside that bar can be used to label the dialog itself. the best way to achieve this is by using the aria-labelledby attribute to the role="dialog" element. additionally, if the dialog
contains additional descriptive text besides the dialog title, this text can be associated with the dialog using the aria-describedby attribute. this approach is shown in the code snippet below: <div role="dialog" aria-labelledby="dialog1title" aria-describedby="dialog1desc"> <h2 id="dialog1title">your personal details were successfully updated</h2> <p id="dialog1desc">you can change your details at ...
Alerts - Accessibility
value="send message"/> <input type="reset" name="reset" value="reset form"/> </form> checking for validity and notifying the user form validations consists of several steps: checking if the e-mail address or entered name are valid. each field has a set of criteria which must be met in order to pass validation. in order to simplify this example, we’ll check whether the e-mail address
contains the “@” symbol, and if the name entry
contains at least 1 character. if the above criteria is not met, the field’s aria-invalid attribute will be given a value of “true”. if the criteria was not met, the user will be notified via an alert. instead of using the javascript ‘alert’ function, we’ll use a simple wai-aria widget for notification. this notifies the user of the error, b...
Architecture - Accessibility
t exposes. the new system makes it easier to show caret positions etc., which will be an improvement in ia2 over msaa. example take the following html code: <div>hello<a href="http://www.mozilla.org/access">my link<img src="image.gif">is cool</a>bye</div> both the <a> and <img> are hyperlinks also, both the <div> and <a> are hypertexts so the <a> is both a hypertext and a hyperlink, because it
contains text and is contained within text. this means that we have an exact mirror to the dom, but text lives in the parents instead of in the leaves, which now don't really provide additional useful information. they are only provided under msaa/ia2 for backward compatibility. implementation classes here are some notes on the classes we use: nshypertextaccessible is for any container that may wrap both ...
Cognitive accessibility - Accessibility
nt this way. heading and labels include clear and descriptive headings so users can easily find information and understand relationships between different content sections. descriptive labels help users identify specific components within the content. people who read slowly and people with limited short-term memory benefit when section titles make it possible to predict what each section
contains. section headings headings help define overall organization of page content. they help facilitate navigation through page content sections, and provide a mechanism to aid comprehension. examples of headings include chapters, sections and subsections of content, and so on. headings are more obvious navigational aids compared to other methods to identify page content sections (borders, wh...
HTML To MSAA - Accessibility
te checkable state_system_ checked if checked property of dom element returns true n/a "select" event_object_ statechange when state is changed label role_system_ statictext from child nodes n/a n/a n/a n/a n/a legend role_system_ statictext n/a n/a n/a label_for (0x1002), points to caption element n/a n/a li and others role_system_ listitem n/a n/a state_system_ readonly n/a n/a n/a
contains child accessible for list bullet ol, ul and others role_system_ list n/a n/a state_system_ readonly n/a n/a n/a optgroup bstr role n/a n/a n/a n/a n/a n/a option role_system_ listitem from @label attribute, from child text nodes n/a state_system_ selected if option is selected n/a "select" event_object_ selectionwithin event_object_ selectionadd if selected event_object_ selectionremov...
Accessibility Information for Web Authors - Accessibility
w3c tidy and/or based on true sgml validation) but it can also report accessibility errors and warnings according to selectable accessibility guidelines (section 508, wcag priorities 1, 2 or 3). its accessibility report is viewable in the view source window (view > source code ctrl+u or right-click on the status bar). two panes are added at the bottom of the view source code window: the left pane
contains the errors and warnings (with their correspondent line number) and the right pane identifies the checkpoint along with an example and a clickable link to the reference/guideline. just wonderful! the html advanced validator may also be downloaded from firefox add-ons: html validator. color contrast analyzer by juicy studio "contrast is the perceived difference between two adjacent color...
Web Accessibility: Understanding Colors and Luminance - Accessibility
may be considered a "saturated" red. for example, in addition to the color #990000 described above, the color #8b0000 also has a saturation of 100%. not all saturated reds may be represented well in the rgb spectrum, or other spectrums commonly used in web development. according to wikipedia's page on "shades of red", the color "carmine" is a saturated red in which, in its pigment form, mostly
contains the red light with wavelengths longer than 600nm; the article makes the special note that "carmine" is close to the extreme spectrum. this places it far beyond standard gamuts (both rgb and cmyk), and its given rgb value is a poor approximation only." saturated red flashing: in addition to a red environment affecting the cognitive function of those with traumatic brain injury, color in the re...
Perceivable - Accessibility
o presented on the web (e.g., html5 video. this is for the benefit of people who can't see the visual part of the video, and don't get the full content from the audio alone. see audio transcripts for transcript information. no audio description tutorial is available yet. 1.2.4 provide captions for live audio (aa) you should provide synchronized captions for all live multimedia that
contains audio (e.g., video conferences, live audio broadcasts). 1.2.5 provide audio descriptions for prerecorded video (aa) audio descriptions should be provided for prerecorded video, but only where the existing audio does not convey the full meaning expressed by the video. 1.2.6 provide sign language equivalent to prerecorded audio (aaa) an equivalent sign language video...
Accessibility
nd no matter how they access the web. "the web is fundamentally designed to work for all people, whatever their hardware, software, language, culture, location, or physical or mental ability. when the web meets this goal, it is accessible to people with a diverse range of hearing, movement, sight, and cognitive ability." (w3c - accessibility) key tutorials the mdn accessibility learning area
contains modern, up-to-date tutorials covering accessibility essentials: what is accessibility? this article starts off the module with a good look at what accessibility actually is — this includes what groups of people we need to consider and why, what tools different people use to interact with the web, and how we can make accessibility part of our web development workflow. html: a good basis for...
-webkit-mask-attachment - CSS: Cascading Style Sheets
fixed if fixed is specified, the mask image does not scroll with its containing element, instead remaining stationary within the viewport. formal definition initial valuescrollapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <attachment>#where <attachment> = scroll | fixed | local examples fixing a mask image to the viewport ...
:-moz-only-whitespace - CSS: Cascading Style Sheets
note: in selectors level 4 the :empty selector was changed to act like :-moz-only-whitespace, but no browser currently supports this yet. the :-moz-only-whitespace css pseudo-class matches elements that only
contains text nodes that only contain whitespace. (this includes elements with empty text nodes and elements with no child nodes.) syntax syntax not found in db! examples html <div> </div> css :root { overflow: hidden; max-width: 100vw; max-height: 100vh; } div { background-color: #ccc; box-sizing: border-box; height: 100vh; min-height: 16px; min-height: 1rem; } div { border: 4px solid red; } :-moz-only-whitespace { border-color: lime; } result specifications briefly defined as :blank in selectors level 4, but then the functionality was merged into :...
::marker - CSS: Cascading Style Sheets
it works on any element or pseudo-element set to display: list-item, such as the <li> and <summary> elements. ::marker { color: blue; font-size: 1.2em; } allowable properties only certain css properties can be used in a rule with ::marker as a selector: all font properties the white-space property color text-combine-upright, unicode-bidi and direction properties the content property all animation and transition properties the specification states that additional css properties may be supported in future. ...
:active - CSS: Cascading Style Sheets
s appropriately, put the :active rule after all other link-related rules, as defined by the lvha-order: :link — :visited — :hover — :active. note: on systems with multi-button mice, css3 specifies that the :active pseudo-class must only apply to the primary button; on right-handed mice, this is typically the leftmost button. syntax :active examples active links html <p>this paragraph
contains a link: <a href="#">this link will turn red while you click on it.</a> the paragraph will get a gray background while you click on it or the link. </p> css a:link { color: blue; } /* unvisited links */ a:visited { color: purple; } /* visited links */ a:hover { background: yellow; } /* hovered links */ a:active { color: red; } /* active links */ p:active { background: ...
:empty - CSS: Cascading Style Sheets
do-class represents any element that has no children. children can be either element nodes or text (including whitespace). comments, processing instructions, and css content do not affect whether an element is considered empty. note: in selectors level 4 the :empty pseudo-class was changed to act like :-moz-only-whitespace, but no browser currently supports this yet. /* selects any <div> that
contains no content */ div:empty { background: lime; } syntax :empty examples html <div class="box"><!-- i will be lime. --></div> <div class="box">i will be pink.</div> <div class="box"> <!-- i will be pink in older browsers because of the whitespace around this comment. --> </div> <div class="box"> <p><!-- i will be pink in all browsers because of the non-collapsible whitespace and elements aro...
:focus-within - CSS: Cascading Style Sheets
in other words, it represents an element that is itself matched by the :focus pseudo-class or has a descendant that is matched by :focus. (this includes descendants in shadow trees.) /* selects a <div> when one of its descendants is focused */ div:focus-within { background: cyan; } this selector is useful, to take a common example, for highlighting an entire <form> container when the user focuses on one of its <input> fields. syntax :focus-within examples in this example, the form will receive special coloring styles when either text input receives focus. ...
:focus - CSS: Cascading Style Sheets
ocus css pseudo-class represents an element (such as a form input) that has received focus. it is generally triggered when the user clicks or taps on an element or selects it with the keyboard's tab key. /* selects any <input> when focused */ input:focus { color: red; } note: this pseudo-class applies only to the focused element itself. use :focus-within if you want to select an element that
contains a focused element. syntax :focus examples html <input class="red-input" value="i'll be red when focused."><br> <input class="blue-input" value="i'll be blue when focused."> css .red-input:focus { background: yellow; color: red; } .blue-input:focus { background: yellow; color: blue; } result accessibility concerns make sure the visual focus indicator can be seen by people wit...
:optional - CSS: Cascading Style Sheets
xtarea> element that does not have the required attribute set on it. /* selects any optional <input> */ input:optional { border: 1px dashed black; } this pseudo-class is useful for styling fields that are not required to submit a form. note: the :required pseudo-class selects required form fields. syntax :optional examples see :invalid for an example. accessibility concerns if a form
contains optional <input>s, required inputs should be indicated using the required attribute. this will ensure that people navigating with the aid of assistive technology such as a screen reader will be able to understand which inputs need valid content to ensure a successful form submission. required inputs should also be indicated visually, using a treatment that does not rely solely on color to convey...
:required - CSS: Cascading Style Sheets
selects optional form fields. syntax :required examples see :invalid for an example. accessibility concerns mandatory <input>s should have the required attribute applied to them. this will ensure that people navigating with the aid of assistive technology such as a screen reader will be able to understand which inputs need valid content to ensure a successful submission. if the form also
contains optional inputs, required inputs should be indicated visually using a treatment that does not rely solely on color to convey meaning. typically, descriptive text and/or an icon are used. mdn understanding wcag, guideline 3.3 explanations understanding success criterion 3.3.2 | w3c understanding wcag 2.0 specifications specification status comment html living st...
:valid - CSS: Cascading Style Sheets
e've also given the inputs a thick red border when invalid. note: we've used ::before to add these labels, as we were already using ::after for the "required" labels. you can try it below: notice how the required text inputs are invalid when empty, but valid when they have something filled in. the email input on the other hand is valid when empty, as it is not required, but invalid when it
contains something that is not a proper email address. accessibility concerns the color green is commonly used to indicate valid input. people who have certain types of color blindness will be unable to determine the input's state unless it is accompanied by an additional indicator that does not rely on color to convey meaning. typically, descriptive text and/or an icon are used. mdn understanding wc...
range - CSS: Cascading Style Sheets
nge is whatever auto would produce for the extended system; if extending a complex predefined style (§7 complex predefined counter styles), the range is the style’s defined range. [ [ | infinite ]{2} ]# defines a comma-separated list of ranges. for each individual range, the first value is the lower bound and the second value is the upper bound. a range is inclusive, that means it always
contains both, the lower and upper bound numbers. if infinite is used as the first value in a range, it represents negative infinity; if it is used as the second value, it represents positive infinity. the range of the counter style is the union of all the ranges defined in the list. if the lower bound of any range is higher than the upper bound, the entire descriptor is invalid and will be ignored. de...
font-variation-settings - CSS: Cascading Style Sheets
/ font-variation-settings: "xhgt" 0.7; values normal text is laid out using default settings. <string> <number> when rendering text, the list of opentype axis names is passed to the text layout engine to enable or disable font features. each setting is always a <string> of 4 ascii characters, followed by a <number> indicating the axis value. if the <string> has more or fewer characters or
contains characters outside the u+20 - u+7e codepoint range, the whole property is invalid. the <number> can be fractional or negative. formal definition related at-rule@font-faceinitial valuenormalcomputed valueas specified formal syntax normal | [ <string> <number> ]# examples setting font weight and stretch in a @font-face rule @font-face { font-family: 'opentypefont'; src: url('open_type_f...
src - CSS: Cascading Style Sheets
iple items */ src: local(font), url(path/to/font.svg) format("svg"), url(path/to/font.woff) format("woff"), url(path/to/font.otf) format("opentype"); values <url> [ format( <string># ) ]? specifies an external reference consisting of a <url>, followed by an optional hint using the format() function to describe the format of the font resource referenced by that url. the format hint
contains a comma-separated list of format strings that denote well-known font formats. if a user agent doesn't support the specified formats, it skips downloading the font resource. if no format hints are supplied, the font resource is always downloaded. <font-face-name> specifies the name of a locally-installed font face using the local() function, which uniquely identifies a single font face within a ...
@keyframes - CSS: Cascading Style Sheets
tage> a percentage of the time through the animation sequence at which the specified keyframe should occur. description javascript can access the @keyframes at-rule with the css object model interface csskeyframesrule. to use keyframes, create a @keyframes rule with a name that is then used by the animation-name property to match an animation to its keyframe declaration. each @keyframes rule
contains a style list of keyframe selectors, which specify percentages along the animation when the keyframe occurs, and a block containing the styles for that keyframe. you can list the keyframe percentages in any order; they will be handled in the order they should occur. valid keyframe lists if a keyframe rule doesn't specify the start or end states of the animation (that is, 0%/from and 100%/to), b...
@viewport - CSS: Cascading Style Sheets
a minus areas controlled by the operating system (such as a taskbar) or the application-available screen area (either the full screen or the screen minus any areas owned by the operating system or other applications). @viewport { width: 100vw; /*sets the width of the actual viewport to the device width*/ } note: the use of <meta name="viewport"> tag overrides @viewport syntax the at-rule
contains a set of nested descriptors in a css block that is delimited by curly braces. a zoom factor of 1.0 or 100% corresponds to no zooming. larger values zoom in. smaller values zoom out. descriptors browser support for @viewport is weak at this time, with support being largely available in internet explorer and edge. even in those browsers, only a small number of descriptors are available. browsers...
Detecting CSS animation support - CSS: Cascading Style Sheets
value in the style collection. however, adding keyframes is trickier, since they're not defined using traditional css syntax (which makes them more flexible, but harder to define from script). to define our keyframes using javascript, we need to write them out as a css string. all we do is set up a keyframes variable, prefixing each attribute as it's constructed. this variable, once constructed,
contains the complete description of all the keyframes needed by our animation sequence. the next task is to actually add the keyframes to the page's css. the first thing to do is look to see if there's already a style sheet on the document; if so, we simply insert the keyframe description into that stylesheet; this is done in lines 13-15. if there isn't already a style sheet, a new <style> element is c...
Introduction to the CSS basic box model - CSS: Cascading Style Sheets
engine represents each element as a rectangular box according to the standard css basic box model. css determines the size, position, and properties (color, background, border size, etc.) of these boxes. every box is composed of four parts (or areas), defined by their respective edges: the content edge, padding edge, border edge, and margin edge. the content area, bounded by the content edge,
contains the "real" content of the element, such as text, an image, or a video player. its dimensions are the content width (or content-box width) and the content height (or content-box height). it often has a background color or background image. if the box-sizing property is set to content-box (default) and if the element is a block element, the content area's size can be explicitly defined with the wi...
Using feature queries - CSS: Cascading Style Sheets
d using the css at-rule @supports, and are useful as they give web developers a way to test to see if a browser has support for a certain feature, and then provide css that will only run based on the result of that test. in this guide you will learn how to implement progressive enhancement using feature queries. syntax css feature queries are part of the css conditional rules module, which also
contains the media query @media rule; when you use feature queries, you will find they behave in a similar way to media queries. the difference is that with a media query you are testing something about the environment in which the web page is running, whereas with feature queries you are testing browser support for css features. a feature query consists of the @supports rule, followed by the property na...
Basic concepts of flexbox - CSS: Cascading Style Sheets
x items to wrap onto multiple lines. in doing so, you should consider each line as a new flex container. any space distribution will happen across that line, without reference to the lines either side. to cause wrapping behaviour add the property flex-wrap with a value of wrap. now, should your items be too large to all display in one line, they will wrap onto another line. the live sample below
contains items that have been given a width, the total width of the items being too wide for the flex container. as flex-wrap is set to wrap, the items wrap. set it to nowrap, which is also the initial value, and they will instead shrink to fit the container because they are using initial flexbox values that allows items to shrink. using nowrap would cause an overflow if the items were not able to shrink,...
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
uld not normally use css and the writing-mode property to change an entire document to another writing mode. this would be done via html, by adding a dir and lang attribute to the html element to indicate the document language and default text direction. this would mean that the document would display correctly even if css did not load. flexbox and other layout methods the flexbox specification
contains a definition of what happens if an item uses another layout method and then becomes a flex item. for example, if an item is floated and then its parent becomes a flex container. or, how a flex container behaves as part of layout. an element set to display: flex behaves in most ways like any other block level container that establishes a containing block. floats will not intrude, and the containe...
Block and inline layout in normal flow - CSS: Cascading Style Sheets
atting context: “in an inline formatting context, boxes are laid out horizontally, one after the other, beginning at the top of a containing block. horizontal margins, borders, and padding are respected between these boxes. the boxes may be aligned vertically in different ways: their bottoms or tops may be aligned, or the baselines of text within them may be aligned. the rectangular area that
contains the boxes that form a line is called a line box.” - 9.4.2 note that the css 2.1 specification describes documents as being in a horizontal, top to bottom writing mode. for example, by describing vertical distance between block boxes. the behavior on block and inline elements is the same when working in a vertical writing mode, and we will explore this in a future guide on flow layout and writ...
Flow Layout and Overflow - CSS: Cascading Style Sheets
subsequent content. the property that controls how overflow behaves is the overflow property which has an initial value of visible. this is why we can see the overflow content. controlling overflow there are other values that control how overflow content behaves. to hide overflowing content use a value of hidden. this may cause some of your content to not be visible. using a value of scroll
contains the content in its box and add scrollbars to enable viewing it. scrollbars will be added even if the content fits in the box. using a value of auto will display the content with no scrollbars if the content fits inside the box. if it doesn’t fit then scrollbars will be added. comparing the next example with the example for overflow: scroll you should see overflow scroll has horizontal and ve...
Flow Layout and Writing Modes - CSS: Cascading Style Sheets
nt when a nested box is assigned a different writing mode to its parent, then an inline level box will display as if it has display: inline-block. a block-level box will establish a new block formatting context, meaning that if its inner display type would be flow, it will get a computed display type of flow-root. this is shown in the next example where the box which displays as horizontal-tb
contains a float which is contained due to its parent establishing a new bfc. replaced elements replaced elements such as images will not change their orientation based on the writing-mode property. however, replaced elements such as form controls which include text, should match the writing mode in use. logical properties and values once you are working in writing modes other than horizontal-tb m...
In Flow and Out of Flow - CSS: Cascading Style Sheets
the heading and paragraphs are block level, the strong element inline. the list is displayed using flexbox to arrange the items into a row, however it too is participating in block and inline layout - the container has an outside display type of block. all of the elements can be said to be in flow. ...
Introduction to formatting contexts - CSS: Cascading Style Sheets
elements where overflow has a value other than visible elements with display: flow-root or display: flow-root list-item elements with contain: layout, content, or strict flex items grid items multicol containers elements with column-span set to all this is useful because a new bfc will behave much like the outermost document in that it becomes a mini-layout inside the main layout. a bfc
contains everything inside it, float and clear only apply to items inside the same formatting context, and margins only collapse between elements in the same formatting context. bfc creation examples let's have a look at a couple of these in order to see the effect creating a new bfc. in the example below, we have a floated element inside a <div> with a border applied. the content of that <div> has flo...
Variable fonts guide - CSS: Cascading Style Sheets
to/font/file/myvariablefont.woff2' format('woff2-variations'); font-weight: 125 950; font-stretch: 75% 125%; font-style: oblique 0deg 20deg; } note: there is no set specific value for the upper-end degree measurement in this case; they simply indicate that there is an axis so the browser can know to render upright or italic (remember that italics are only on or off) example for a font that
contains only italics and no upright characters: @font-face { font-family: 'myvariablefontname'; src: 'path/to/font/file/myvariablefont.woff2' format('woff2-variations'); font-weight: 125 950; font-stretch: 75% 125%; font-style: italic; } example for a font that
contains an oblique (slant) axis: @font-face { font-family: 'myvariablefontname'; src: 'path/to/font/file/myvariablefont.woff2' format(...
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
m1">item 1</div> <div class="item2">item 2</div> <div class="item3">item 3</div> </div> what this demonstrates, is that if you are switching the direction of your text, either for entire pages or for parts of pages, and are using lines: you may want to name your lines, if you do not want the layout to completely switch direction. for some things, for example, where a grid
contains text content, this switching may be exactly what you want. for other usage it may not. the strange order of values in the grid-area property you can use the grid-area property to specify all four lines of a grid area as one value. when people first encounter this, they are often surprised that the values do not follow the same order as the shorthand for margin – which runs clockwise: top, rig...
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
outs are essentially sets of “cards” – product listings, image galleries, and so on. a grid can make it very easy to create these listings in a way that is responsive without needing to add media queries to make it so. in this next example i’m combining css grid and flexbox layouts to make a simple product listing layout. the markup for my listing is an unordered list of items. each item
contains a heading, some text of varying height, and a call to action link. <ul class="listing"> <li> <h2>item one</h2> <div class="body"><p>the content of this listing item goes here.</p></div> <div class="cta"><a href="">call to action!</a></div> </li> <li> <h2>item two</h2> <div class="body"><p>the content of this listing item goes here.</p></div> <div class="cta"><a...
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
the document tree.” if you set an item to display: contents the box it would normally create disappears, and the boxes of the child elements appear as if they have risen up a level. this means that children of a grid item can become grid items. sound odd? here is a simple example. in the following markup, i have a grid and the first item on the grid is set to span all three column tracks. it
contains three nested items. as these items are not direct children, they don’t become part of the grid layout and so display using regular block layout. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .box { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } .ne...
CSS Overflow - CSS: Cascading Style Sheets
in css overflow happens when the content of a box extends past one or more of the box's edges. ink overflow and scrollable overflow there are two types of overflow that you might encounter in css. the first is described as ink overflow. this is the overflow of painting effects which do not affect layout or otherwise extend the scrollable overflow region, such as box shadows, border images, text decoration, overhanging glyphs, outlines, etc. the overflow that we sometimes need to manage in css is described as scrollable overflow. this is the content appearing outside of the box for which scrolling mechanisms need to be provided. ...
Using the :target pseudo-class in selectors - CSS: Cascading Style Sheets
c piece of a document, it can be difficult for the user to notice. find out how you can use some simple css to draw attention to the target of a url and improve the user's experience. picking a target the pseudo-class :target is used to style the target element of a url containing a fragment identifier. for example, the url http://developer.mozilla.org/en/docs/using_the_:target_selector#example
contains the fragment identifier #example. in html, identifiers are found as the values of either id or name attributes, since the two share the same namespace. thus, the example url would point to the heading "example" in this document. suppose you wish to style any h2 element that is the target of a url, but do not want any other kind of element to get a target style. this is simple enough: h2:target ...
Viewport concepts - CSS: Cascading Style Sheets
nd bottom of the layout viewport respectively. body > header { position: fixed; top: 0; } body > footer { position: fixed; bottom: 0; } we got the 800 x 533 measurement when we zoomed in using the keyboard. the header and footer stayed flush against the top and bottom of the window. but what if we had pinched-zoomed on a tablet? what if a dynamic keyboard pops open on a phone? the web
contains two viewports, the layout viewport and the visual viewport. the visual viewport is the part of the web page that is currently visible in the browser and can change. when the user pinch-zooms the page, pops open a dynamic keyboard, or when a previously hidden address bar becomes visible, the visual viewport shrinks but the layout viewport is unchanged. sticky headers or footers, as discussed abov...
attr() - CSS: Cascading Style Sheets
not a number or out of the range accepted by the css property, the default value is used. if the given value is used as a length, attr() computes it to an absolute length. leading and trailing spaces are stripped. 0%, or, if 0% is not a valid value for the property, the property's minimum value. <fallback> the value to be used if the associated attribute is missing or
contains an invalid value. if not set, css will use the default value defined for each <type-or-unit>. formal syntax attr( <attr-name> <type-or-unit>? [, <attr-fallback> ]? )where <type-or-unit> = string | color | url | integer | number | length | angle | time | frequency | cap | ch | em | ex | ic | lh | rlh | rem | vb | vi | vw | vh | vmin | vmax | mm | q | cm | in | pt | pc | px | deg | grad | rad | ...
background-image - CSS: Cascading Style Sheets
age> denoting the image to display. there can be several of them, separated by commas, as multiple backgrounds are supported. accessibility concerns browsers do not provide any special information on background images to assistive technology. this is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. if the image
contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. mdn understanding wcag, guideline 1.1 explanations understanding success criterion 1.1.1 | w3c understanding wcag 2.0 formal definition initial valuenoneapplies toall elements. it also applies to ::first-letter and ::first-line.inheritednocomputed valueas specified, b...
background - CSS: Cascading Style Sheets
background-image <position> see background-position <repeat-style> see background-repeat <bg-size> see background-size. accessibility concerns browsers do not provide any special information on background images to assistive technology. this is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. if the image
contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. mdn understanding wcag, guideline 1.1 explanations understanding success criterion 1.1.1 | w3c understanding wcag 2.0 formal definition initial valueas each of the properties of the shorthand:background-image: nonebackground-position: 0% 0%background-size: auto autoba...
border-image - CSS: Cascading Style Sheets
stance of the border image from the element's outside edge. up to four values may be specified. see border-image-outset. <'border-image-repeat'> defines how the edge regions of the source image are adjusted to fit the dimensions of the border image. up to two values may be specified. see border-image-repeat. accessibility concerns assistive technology cannot parse border images. if the image
contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. mdn understanding wcag, guideline 1.1 explanations understanding success criterion 1.1.1 | understanding wcag 2.0 formal definition initial valueas each of the properties of the shorthand:border-image-source: noneborder-image-slice: 100%border-image-width: 1border-im...
box-decoration-break - CSS: Cascading Style Sheets
gment independently. the background is also drawn independently for each fragment, which means that a background image with background-repeat: no-repeat may nevertheless repeat multiple times. formal definition initial valuesliceapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax slice | clone examples inline box fragments an inline element that
contains line breaks styled with: .example { background: linear-gradient(to bottom right, yellow, green); box-shadow: 8px 8px 10px 0px deeppink, -5px -5px 5px 0px blue, 5px 5px 15px 0px yellow; padding: 0em 1em; border-radius: 16px; border-style: solid; margin-left: 10px; font: 24px sans-serif; line-height: 2; } ... <span class="example">the<br>quick<br>orange fox</span> ...
box-flex - CSS: Cascading Style Sheets
parts of the xul box model. it does not match either the old css flexible box layout module drafts for 'box-flex' (which were based on this property) or the behavior of '-webkit-box-flex' (which is based on those drafts). see flexbox for information about the current standard. the -moz-box-flex and -webkit-box-flex css properties specify how a -moz-box or -webkit-box grows to fill the box that
contains it, in the direction of the containing box's layout. /* <number> values */ -moz-box-flex: 0; -moz-box-flex: 2; -moz-box-flex: 3.5; -webkit-box-flex: 0; -webkit-box-flex: 2; -webkit-box-flex: 3.5; /* global values */ -moz-box-flex: inherit; -moz-box-flex: initial; -moz-box-flex: unset; -webkit-box-flex: inherit; -webkit-box-flex: initial; -webkit-box-flex: unset; syntax the box-flex property ...
box-lines - CSS: Cascading Style Sheets
children on as few lines as possible by shrinking all elements down to their minimum widths or heights if necessary. if the children in a horizontal box still do not fit on a line after being reduced to their minimum widths, then children are moved one by one onto a new line, until the elements remaining on the previous line fit. this process can repeat to an arbitrary number of lines. if a line
contains only a single element that doesn't fit, then the element should stay on that line and overflow out of the box. the later lines are placed below the earlier lines in normal direction boxes and above in reverse direction boxes. the height of a line is the height of the largest child in that line. no additional space appears between the lines apart from the margins on the largest elements in each li...
break-after - CSS: Cascading Style Sheets
n the always value in the level 4 spec. formal definition initial valueautoapplies toblock-level elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | avoid | always | all | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region examples breaking into neat columns in the following example we have a container that
contains an <h1> spanning all columns (achieved using column-span: all) and a series of <h2>s and paragraphs laid out in multiple columns using column-width: 200px. by default, the subheadings and paragraphs were laid out rather messily because the headings were not in a uniform place. however, we used break-after: column on the <p> elements to force a column break after each one, meaning that you end up...
break-before - CSS: Cascading Style Sheets
n the always value in the level 4 spec. formal definition initial valueautoapplies toblock-level elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | avoid | always | all | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region examples breaking into neat columns in the following example we have a container that
contains an <h1> spanning all columns (achieved using column-span: all) and a series of <h2>s and paragraphs laid out in multiple columns using column-width: 200px. by default, the subheadings and paragraphs were laid out rather messily because the headings were not in a uniform place. however, we used break-before: column on the <h2> elements to force a column break before each one, meaning that you end...
break-inside - CSS: Cascading Style Sheets
we also have a <figure> containing an image and a caption. by default, it is possible for you to get a break between the image and its caption, which is not what we want. to avoid this, we have set break-inside: avoid on the <figure>, which causes them...
clear - CSS: Cascading Style Sheets
on the other hand will not collapse. when applied to floating elements, the margin edge of the bottom element is moved below the margin edge of all relevant floats. this affects the position of later floats, since later floats cannot be positioned higher than earlier ones. the floats that are relevant to be cleared are the earlier floats within the same block formatting context. if an element
contains only floated elements, its height collapses to nothing. if you want it to always be able to resize, so that it
contains floating elements inside it, you need to self-clear its children. this is called clearfix, and one way to do it is to add clear to a replaced ::after pseudo-element on it. #container::after { content: ""; display: block; clear: both; } syntax /* keyword values */ clea...
conic-gradient() - CSS: Cascading Style Sheets
primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. while it is possible to create pie charts, checkerboards, and other effects with conic gradients, css images provide no native way to assign alternative text, and therefore the image represented by the conic gradient will not be accessible to screen reader users. if the image
contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. mdn understanding wcag, guideline 1.1 explanations understanding success criterion 1.1.1 | w3c understanding wcag 2.0 examples gradient at 40-degrees div { width: 100px; height: 100px; } <div></div> div { background-image: conic-gradient(from 40deg, #...
cross-fade() - CSS: Cascading Style Sheets
he yellow/red/blue example (with three images) from the specification syntax section, are not possible in this implementation. accessibility concerns browsers do not provide any special information on background images to assistive technology. this is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. if the image
contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. when using background images, make sure the contrast in color is great enough that any text is legible over the image as well as if the images is missing. mdn understanding wcag, guideline 1.1 explanations understanding success criterion 1.1.1 | w3c understanding wcag 2.
Adapting to the new two-value syntax of display - CSS: Cascading Style Sheets
line-block. the value display: inline-block has been around since the early days of css. the reason we tend to use it is to allow padding to push inline items away from an element, when creating navigation items for example, or when wanting to add a background with padding to an inline element as in the example below. an element with display: inline-block however, will also contain floats. it
contains everything inside the inline-level box. therefore display: inline-block does exactly what display: flow-root does, but with an inline-level, rather than a block-level box. the new syntax accurately describes what is happening with this value. in the example above, you can change display: inline-block to display: inline flow-root in firefox and get the same result. what about the old values of di...
<display-inside> - CSS: Cascading Style Sheets
ue only, such as when display: flex or display: grid is specified, will set their outer value to block. this will result in expected behavior; for example if you specify an element to be display: grid, you would expect that the box created on the grid container would be a block level box. examples in this example the parent box has been given display: flow-root and so establishes a new bfc and
contains the floated item. html <div class="box"> <div class="float">i am a floated box!</div> <p>i am content inside the container.</p> </div> css .box { background-color: rgb(224, 206, 247); border: 5px solid rebeccapurple; display: flow-root; } .float { float: left; width: 200px; height: 150px; background-color: white; border:1px solid black; padding: 10px;...
<display-outside> - CSS: Cascading Style Sheets
n normal flow, the next element will be on the same line if there is space run-in the element generates a run-in box. if the adjacent sibling of the element defined as display: run-in box is a block box, the run-in box becomes the first inline box of the block box that follows it. run-in elements act like inlines or blocks, depending on the surrounding elements. that is: if the run-in box
contains a block box, same as block. if a block box follows the run-in box, the run-in box becomes the first inline box of the block box. if an inline box follows, the run-in box becomes a block box. note: browsers that support the two value syntax, on finding the outer value only, such as when display: block or display: inline is specified, will set the inner value to flow. this will result in expecte...
display - CSS: Cascading Style Sheets
n normal flow, the next element will be on the same line if there is space run-in the element generates a run-in box. if the adjacent sibling of the element defined as display: run-in box is a block box, the run-in box becomes the first inline box of the block box that follows it. run-in elements act like inlines or blocks, depending on the surrounding elements. that is: if the run-in box
contains a block box, same as block. if a block box follows the run-in box, the run-in box becomes the first inline box of the block box. if an inline box follows, the run-in box becomes a block box. note: browsers that support the two value syntax, on finding the outer value only, such as when display: block or display: inline is specified, will set the inner value to flow. this will result in expecte...
font-feature-settings - CSS: Cascading Style Sheets
ont feature. in particular, font-feature-settings shouldn't be used to enable small caps. values normal text is laid out using default settings. <feature-tag-value> when rendering text, the list of opentype feature tag value is passed to the text layout engine to enable or disable font features. the tag is always a <string> of 4 ascii characters. if it has more or less characters, or if it
contains characters outside the u+20 – u+7e codepoint range, the whole property is invalid. the value is a positive integer. the two keywords on and off are synonyms for 1 and 0 respectively. if no value is set, the default is 1. for non-boolean opentype features (e.g. stylistic alternates), the value implies a particular glyph to be selected; for boolean values, it is a switch. formal definition in...
font-variation-settings - CSS: Cascading Style Sheets
rms: normal text is laid out using default settings. <string> <number> when rendering text, the list of variable font axis names is passed to the text layout engine to enable or disable font features. each setting is always one or more pairs consisting of a <string> of 4 ascii characters followed by a <number> indicating the axis value to set. if the <string> has more or fewer characters or
contains characters outside the u+20 - u+7e codepoint range, the whole property is invalid. the <number> can be fractional or negative, depending on the value range available in your font, as defined by the font designer. description this property is a low-level mechanism designed to set variable font features where no other way to enable or access those features exist. you should only use it when no b...
image-set() - CSS: Cascading Style Sheets
ternative background-image options, chosen depending on the resolution needed: a normal version and a high-resolution version. accessibility concerns browsers do not provide any special information on background images to assistive technology. this is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. if the image
contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. mdn understanding wcag, guideline 1.1 explanations understanding success criterion 1.1.1 | w3c understanding wcag 2.0 specifications specification status comment css images module level 4the definition of 'the image-set() notation' in that ...
<image> - CSS: Cascading Style Sheets
ze. note: not all browsers support every type of image on every property. see the browser compatibility section for details. accessibility concerns browsers do not provide any special information on background images to assistive technology. this is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. if the image
contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. mdn understanding wcag, guideline 1.1 explanations understanding success criterion 1.1.1 | w3c understanding wcag 2.0 examples valid images url(test.jpg) /* a <url>, as long as test.jpg is an actual image */ linear-gradient(blue, red) /* a <gradient> *...
image() - CSS: Cascading Style Sheets
ment. both image(color) and background-color placements are impacted by the background-clip and background-origin properties. accessibility concerns browsers do not provide any special information on background images to assistive technology. this is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. if the image
contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. mdn understanding wcag, guideline 1.1 explanations understanding success criterion 1.1.1 | w3c understanding wcag 2.0 this feature can help improve accessibility by providing a fallback color when an image fails to load. while this can and should be done by including a...
page-break-inside - CSS: Cascading Style Sheets
it has a little bit more text than the third one.</p> </div> css .page { background-color: #8cffa0; height: 90px; width: 200px; columns: 1; column-width: 100px; } .list, ol, ul, p { break-inside: avoid; } p { background-color: #8ca0ff; } ol, ul, .list { margin: 0.5em 0; display: block; background-color: orange; } p:first-...
perspective - CSS: Cascading Style Sheets
than the value of the perspective css property — are not drawn. the vanishing point is by default placed at the center of the element, but its position can be changed using the perspective-origin property. using this property with a value different than 0 and none creates a new stacking context. also, in that case, the object will act as a containing block for position: fixed elements that it
contains. formal definition initial valuenoneapplies totransformable elementsinheritednocomputed valuethe absolute length or noneanimation typea lengthcreates stacking contextyes formal syntax none | <length> examples setting perspective this example shows a cube with the perspective set at different positions. how quick the cube shrinks is defined by the perspective property. the smaller its value...
repeating-conic-gradient() - CSS: Cascading Style Sheets
primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. while it is possible to create pie charts, checkerboards, and other effects with conic gradients, css images provide no native way to assign alternative text, and therefore the image represented by the conic gradient will not be accessible to screen reader users. if the image
contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. mdn understanding wcag, guideline 1.1 explanations understanding success criterion 1.1.1 | w3c understanding wcag 2.0 examples black and white starburst div { width: 200px; height: 200px; } <div></div> div { background-image: repeating-conic-gradient(...
resize - CSS: Cascading Style Sheets
f textareas in many browsers, <textarea> elements are resizable by default. you may override this behavior with the resize property. html <textarea>type some text here.</textarea> css textarea { resize: none; /* disables resizability */ } result using resize with arbitrary elements you can use the resize property to make any element resizable. in the example below, a resizable <div>
contains a resizable paragraph (<p> element). html <div class="resizable"> <p class="resizable"> this paragraph is resizable in all directions, because the css `resize` property is set to `both` on this element. </p> </div> css .resizable { resize: both; overflow: scroll; border: 1px solid black; } div { height: 300px; width: 300px; } p { height: 200px; width: 200px; } r...
<resolution> - CSS: Cascading Style Sheets
e, i.e., its resolution. on screens, the units are related to css inches, centimeters, or pixels, not physical values. syntax the <resolution> data type consists of a strictly positive <number> followed by one of the units listed below. as with all css dimensions, there is no space between the unit literal and the number. units dpi represents the number of dots per inch. screens typically
contains 72 or 96 dots per inch, but the dpi for printed documents is usually much greater. as 1 inch is 2.54 cm, 1dpi ≈ 0.39dpcm. dpcm represents the number of dots per centimeter. as 1 inch is 2.54 cm, 1dpcm ≈ 2.54dpi. dppx represents the number of dots per px unit. due to the 1:96 fixed ratio of css in to css px, 1dppx is equivalent to 96dpi, which corresponds to the default resolution of image...
text-transform - CSS: Cascading Style Sheets
calculated (firefox considered - and _ as letters, but other browsers did not. both webkit and gecko incorrectly considered letter-based symbols like ⓐ to be real letters. internet explorer 9 was the closest to the css 2 definition, but with some weird cases.) by precisely defining the correct behavior, css text level 3 cleans this mess up. the capitalize line in the browser compatibility table
contains the version the different engines started to support this now precisely-defined behavior. uppercase is a keyword that converts all characters to uppercase. lowercase is a keyword that converts all characters to lowercase. none is a keyword that prevents the case of all characters from being changed. full-width is a keyword that forces the writing of a character — mainly ideograms and ...
transform - CSS: Cascading Style Sheets
example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. if the property has a value different than none, a stacking context will be created. in that case, the element will act as a containing block for any position: fixed; or position: absolute; elements that it
contains. only transformable elements can be transformed. that is, all elements whose layout is governed by the css box model except for: non-replaced inline boxes, table-column boxes, and table-column-group boxes. syntax /* keyword values */ transform: none; /* function values */ transform: matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0); transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); tr...
unicode-bidi - CSS: Cascading Style Sheets
the unicode-bidi property overrides this algorithm and allows the developer to control the text embedding. the unicode-bidi and direction properties are the only properties that are not affected by the all shorthand. note: this property is intended for document type definition (dtd) designers. ...
CSS: Cascading Style Sheets
t became more effective to develop and release recommendations separately per module. instead of versioning the css specification, w3c now periodically takes a snapshot of the latest stable state of the css specification. css introduction if you're new to web development, be sure to read our css basics article to learn what css is and how to use it. css tutorials our css learning area
contains a wealth of tutorials to take you from beginner level to proficiency, covering all the fundamentals. css reference our exhaustive css reference for seasoned web developers describes every property and concept of css. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started ...
WAI ARIA Live Regions/API Support - Developer guides
these features will help screen reader developers improve the quality and performance of live region support, both for pages that are marked up with aria live region markup, and for pages where the author did not add any additional markup. please read the aria spec or the live region report to learn about aria live region markup. as always, we're open to questions and suggestions for changes in community forums. ...
Cross-browser audio basics - Developer guides
mp3 also support mp4 audio). here we define an <audio> element with multiple sources — we do this as not all browsers support the same audio formats. to ensure reasonable coverage, we should specify at least two different formats. the two formats that will give maximum coverage are mp3 and ogg vorbis. we do this using the <source> element, which takes the attributes src and type. src
contains the path to the audio file to be loaded (relative or absolute). type is used to inform the browser of the file type. if omitted, most browsers will attempt to guess this from the file extension. if the <audio> element is not supported then <audio> and <source> will be ignored. however any supported text or elements that you define within <audio> will be displayed or acted upon. so the i...
Live streaming web audio and video - Developer guides
vented by apple inc and supported on ios, safari and the latest versions of android browser / chrome. hls is also adaptive. hls can also be decoded using javascript, which means we can support the latest versions of firefox, chrome and internet explorer 10+. see this http live streaming javascript player. at the start of the streaming session, an extended m3u (m3u8) playlist is downloaded. this
contains the metadata for the various sub-streams that are provided. streaming file format support browser dash hls opus (audio) firefox 32 ✓ [1] ✓ [2] ✓ 14+ safari 6+ ✓ chrome 24+ ✓ [1] ✓ opera 20+ ✓ [1] internet explorer 10+ ✓ 11 ✓ [2] firefox mobile ...
Creating a cross-browser video player - Developer guides
rmine the correct result. if the browser is currently in fullscreen mode, then it must be exited and vice versa. support for the different prefixed versions of the relevant action are checked in order to call the correct one. interestingly document must be used for exiting/cancelling fullscreen mode, whereas any html element can request fullscreen mode, here the videocontainer is used as it also
contains the custom controls which should also appear with the video in fullscreen mode. the exception to this is safari 5.1, which will only allow webkitrequestfullscreen to be called on the <video> element. the custom controls will only appear on this browser in fullscreen mode with some webkit specific css: the default browser controls have to be hidden with video::-webkit-media-controls { display:...
DOM onevent handlers - Developer guides
ror, onfocus, onload, and onscroll.) event handler's parameters, this binding, and the return value when the event handler is specified as an html attribute, the specified code is wrapped into a function with the following parameters: event — for all event handlers except onerror. event, source, lineno, colno, and error for the onerror event handler. note that the event parameter actually
contains the error message as a string. when the event handler is invoked, the this keyword inside the handler is set to the dom element on which the handler is registered. for more details, see the this keyword documentation. the return value from the handler determines if the event is canceled. the specific handling of the return value depends on the kind of event; for details, see "the event handler...
Overview of events and handlers - Developer guides
r is on top of the dom node in the html page. the event object hierarchy the web browser defines many events of different kinds. each definition includes, as the data structure passed to the handler function, an object which inherits from the eventprototype object. a partial diagram of the class hierarchy of event objects is: note: this diagram is incomplete. the web api documentation
contains a page defining the event object which also includes the known dom event subclasses of the event object. documents three sources on the mdn (mozilla developer network) web site are particularly useful for programmers wanting to work with events: this event guide which is part of the web developers' guide, the event reference, the web api documentation for the event object. ...
Rich-Text Editing in Mozilla - Developer guides
the function executed the requested command using execcommand() and then sets focus back to the editable document, as clicking on a button will set focus on the button itself, which breaks the editing flow. figure 4 : executing rich editing commands html: <button onclick...
HTML5 Parser - Developer guides
but it's simpler to always use end tags for those elements than to make sure that the end tags are only omitted when they aren't necessary.) for example, the following code writes a balanced sub-tree: <script> document.write("<div>"); document.write("<p>some content goes here.</p>"); document.write("</div>"); </script> <!-- non-script html goes here. --> in contrast, the following code
contains two scripts with unbalanced sub-trees, which causes speculative parsing to fail and therefore the time to parse the document is longer. <script>document.write("<div>");</script> <p>some content goes here.</p> <script>document.write("</div>");</script> for more information, see optimizing your pages for speculative parsing. ...
Introduction to HTML5 - Developer guides
irefox, has very good support for html5, and work continues toward supporting more of its features. gecko began supporting some html5 features in version 1.8.1. you can find a list of all of the html5 features that gecko currently supports on the main html5 page. for detailed information about multiple browsers' support of html5 features, refer to the caniuse website. declaring that the document
contains html5 mark-up with the html5 doctype the doctype for html5 is very simple. to indicate that your html content uses html5, simply use: <!doctype html> doing so will cause even browsers that don't presently support html5 to enter into standards mode, which means that they'll interpret the long-established parts of html in an html5-compliant way while ignoring the new features of html5 they don'...
Index - Developer guides
mailing lists, newsgroups, forums, or other communities related to ajax, please link to them here. 4 getting started ajax, api, advanced, javascript, webmechanics, xmlhttprequest this article guides you through the ajax basics and gives you some simple hands-on examples to get you started. 5 wai aria live regions/api support ajax, accessibility firefox 3
contains important improvements to the way the mozilla engine exposes live changes in a document. 6 audio and video delivery audio, guide, html, html5, media, video whether we are dealing with pre-recorded audio files or live streams, the mechanism for making them available through the browser's <audio> and <video> elements remains pretty much the same. currently, to support all brows...
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
et's look at a simple example, in which the user can choose a color. as the user adjusts the color, the border around the example changes to reflect the new color. after finishing up and picking the final color, the color picker's value is displayed. on macos, you indicate that you've finalized selection of the color by closing the color picker window. html the html here creates a box that
contains a color picker control (with a label created using the <label> element) and an empty paragraph element (<p>) into which we'll output some text from our javascript code. <div id="box"> <label for="colorpicker">border color:</label> <input type="color" value="#8888ff" id="colorpicker"> <p id="output"></p> </div> css the css simply establishes a size for the box and some basic styling for a...
Block-level elements - HTML: Hypertext Markup Language
ription list term. <fieldset> field set label. <figcaption> figure caption. <figure> groups media content with a caption (see <figcaption>). <footer> section or page footer. <form> input form. <h1>, <h2>, <h3>, <h4>, <h5>, <h6> heading levels 1-6. <header> section or page header. <hgroup> groups header information. <hr> horizontal rule (dividing line). <li> list item. <main>
contains the central content unique to this document. <nav>
contains navigation links. <ol> ordered list. <p> paragraph. <pre> preformatted text. <section> section of a web page. <table> table. <ul> unordered list. see also inline elements display block and inline layout in normal flow ...
DASH Adaptive Streaming for HTML 5 Video - HTML: Hypertext Markup Language
_audio.webm \ -c copy \ -map 0 -map 1 -map 2 -map 3 -map 4 \ -f webm_dash_manifest \ -adaptation_sets "id=0,streams=0,1,2,3 id=1,streams=4" \ my_video_manifest.mpd the -map arguments correspond to the input files in the sequence they are given; you should have one for each file. the -adaptation_sets argument assigns them into adaptation sets; for example, this creates one set (0) that
contains the streams 0, 1, 2 and 3 (the videos), and another set (1) that
contains only stream 4, the audio stream. put the manifest and the associated video files on your web server or cdn. dash works via http, so as long as your http server supports byte range requests, and it's set up to serve .mpd files with mimetype="application/dash+xml", then you're all set. using dash - client side you'll want ...
Date and time formats used in HTML - HTML: Hypertext Markup Language
ify these values are described in this article. elements that use such formats include certain forms of the <input> element that let the user choose or specify a date, time, or both, as well as the <ins> and <del> elements, whose datetime attribute specifies the date or date and time at which the insertion or deletion of content occurred. for <input>, the values of type that return a value which
contains a string representing a date and/or time are: date datetime datetime-local month time week examples before getting into the intricacies of how date and time strings are written and parsed in html, here are some examples that should give you a good idea what the more commonly-used date and time string formats look like. example html date and time strings string date an...
<area> - HTML: Hypertext Markup Language
wnloading a resource. see <a> for a full description of the download attribute. href the hyperlink target for the area. its value is a valid url. this attribute may be omitted; if so, the <area> element does not represent a hyperlink. hreflang indicates the language of the linked resource. allowed values are determined by bcp47. use this attribute only if the href attribute is present. ping
contains a space-separated list of urls to which, when the hyperlink is followed, post requests with the body ping will be sent by the browser (in the background). typically used for tracking. referrerpolicy a string indicating which referrer to use when fetching the resource: "no-referrer" meaning that the referer: header will not be sent. "no-referrer-when-downgrade" meaning that no referer: h...
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
understanding wcag 2.0 understanding success criterion 1.2.2 | w3c understanding wcag 2.0 technical summary content categories flow content, phrasing content, embedded content. if it has a controls attribute: interactive content and palpable content. permitted content if the element has a src attribute: zero or more <track> elements followed by transparent content that
contains no <audio> or <video> media elements. else: zero or more <source> elements followed by zero or more <track> elements followed by transparent content that
contains no <audio> or <video> media elements. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts embedded content. implicit aria role no correspo...
<basefont> - HTML: Hypertext Markup Language
element; instead, you should use css properties such as font, font-family, font-size, and color to change the font configuration for an element and its contents. attributes like all other html elements, this element supports the global attributes. color this attribute sets the text color using either a named color or a color specified in the hexadecimal #rrggbb format. face this attribute
contains a list of one or more font names. the document text in the default style is rendered in the first font face that the client's browser supports. if no font listed is installed on the local system, the browser typically defaults to the proportional or fixed-width font for that system. size this attribute specifies the font size as either a numeric or relative value. numeric values range from 1 to...
<bdi>: The Bidirectional Isolate element - HTML: Hypertext Markup Language
it's particularly useful when a website dynamically inserts some text and doesn't know the directionality of the text being inserted. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
<button>: The Button element - HTML: Hypertext Markup Language
cified, it overrides the enctype attribute of the button's form owner. formmethod html5 if the button is a submit button (it's inside/associated with a <form> and doesn't have type="button"), this attribute specifies the http method used to submit the form. possible values: post: the data from the form are included in the body of the http request when sent to the server. use when the form
contains information that shouldn’t be public, like login credentials. get: the form data are appended to the form's action url, with a ? as a separator, and the resulting url is sent to the server. use this method when the form has no side effects, like search forms. if specified, this attribute overrides the method attribute of the button's form owner. formnovalidate html5 if the button is a...
<caption>: The Table Caption element - HTML: Hypertext Markup Language
ht the caption is displayed to the right of the table. bottom the caption is displayed below the table. usage note: do not use this attribute, as it has been deprecated. the <caption> element should be styled using the css properties caption-side and text-align. usage notes the <caption> element should be the first child of its parent <table> element. when the <table> element that
contains the <caption> is the only descendant of a <figure> element, you should use the <figcaption> element instead of <caption>. example this simple example presents a table that includes a caption. <table> <caption>example caption</caption> <tr> <th>login</th> <th>email</th> </tr> <tr> <td>user1</td> <td>user1@sample.com</td> </tr> <tr> <td>user2</td> <td>user2@sa...
<col> - HTML: Hypertext Markup Language
permitted parents <colgroup> only, though it can be implicitly defined as its start tag is not mandatory. the <colgroup> must not have a span attribute. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmltablecolelement attributes this element includes the global attributes. span this attribute
contains a positive integer indicating the number of consecutive columns the <col> element spans. if not present, its default value is 1. deprecated attributes the following attributes are deprecated and should not be used. they are documented below for reference when updating existing code and for historical interest only. align this enumerated attribute specifies how horizontal alignment of eac...
<colgroup> - HTML: Hypertext Markup Language
a <table> element. the <colgroup> must appear after any optional <caption> element but before any <thead>, <th>, <tbody>, <tfoot> and <tr> element. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmltablecolelement attributes this element's attributes include the global attributes. span this attribute
contains a positive integer indicating the number of consecutive columns the <colgroup> element spans. if not present, its default value is 1. note: this attribute is applied on the attributes of the column group, it has no effect on the css styling rules associated with it or, even more, to the cells of the column's members of the group. the span attribute is not permitted if there are one or more <...
<datalist>: The HTML Data List element - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content. permitted content either phrasing content or zero or more <option> elements. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. ...
<dfn>: The Definition element - HTML: Hypertext Markup Language
element. we examine those here. specifying the term being defined the term being defined is identified following these rules: if the <dfn> element has a title attribute, the value of the title attribute is considered to be the term being defined. the element must still have text within it, but that text may be an abbreviation (perhaps using <abbr>) or another form of the term. if the <dfn>
contains a single child element and does not have any text content of its own, and the child element is an <abbr> element with a title attribute itself, then the exact value of the <abbr> element's title is the term being defined. otherwise, the text content of the <dfn> element is the term being defined. this is shown in the first example below. if the <dfn> element has a title attribute, it must con...
<dialog>: The Dialog element - HTML: Hypertext Markup Language
tton that was used to submit the form. the ::backdrop css pseudo-element can be used to style behind a <dialog> element when the dialog is displayed with htmldialogelement.showmodal(). for example, to dim unreachable content behind the modal dialog. examples simple example <dialog open> <p>greetings, one and all!</p> </dialog> advanced example this example opens a pop-up dialog box that
contains a form, when the "update details" button is clicked. html <!-- simple pop-up dialog box containing a form --> <dialog id="favdialog"> <form method="dialog"> <p><label>favorite animal: <select> <option></option> <option>brine shrimp</option> <option>red panda</option> <option>spider monkey</option> </select> </label></p> <menu> <but...
<embed>: The Embed External Content element - HTML: Hypertext Markup Language
e, and the object-fit property to control how the object's size is adjusted to fit within the frame. examples <embed type="video/quicktime" src="movie.mov" width="640" height="480" title="title of my video"> accessibility concerns use the title attribute on an embed element to label its content so that people navigating with assistive technology such as a screen reader can understand what it
contains. the title's value should concisely describe the embedded content. without a title, they may not be able to determine what its embedded content is. this context shift can be confusing and time-consuming, especially if the embed element
contains interactive content like video or audio. specifications specification status comment html living standardthe definition of '...
<font> - HTML: Hypertext Markup Language
ing should be written using css only. the former behavior of the <font> element can be achieved, and even better controlled using the css fonts css properties. attributes like all other html elements, this element supports the global attributes. color this attribute sets the text color using either a named color or a color specified in the hexadecimal #rrggbb format. face this attribute
contains a comma-separated list of one or more font names. the document text in the default style is rendered in the first font face that the client's browser supports. if no font listed is installed on the local system, the browser typically defaults to the proportional or fixed-width font for that system. size this attribute specifies the font size as either a numeric or relative value. numeric values...
<footer> - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, palpable content. permitted content flow content, but with no <footer> or <header> descendants. ...
<form> - HTML: Hypertext Markup Language
tion the url that processes the form submission. this value can be overridden by a formaction attribute on a <button>, <input type="submit">, or <input type="image"> element. enctype if the value of the method attribute is post, enctype is the mime type of the form submission. possible values: application/x-www-form-urlencoded: the default value. multipart/form-data: use this if the form
contains <input> elements with type=file. text/plain: introduced by html5 for debugging purposes. this value can be overridden by formenctype attributes on <button>, <input type="submit">, or <input type="image"> elements. method the http method to submit the form with. possible (case insensitive) values: post: the post method; form data sent as the request body. get: the get method; form ...
<head>: The Document Metadata (Header) element - HTML: Hypertext Markup Language
note: <head> primarily holds information for machine processing, not human-readability. for human-visible information, like top-level headings and listed authors, see the <header> element. content categories none. permitted content if the document is an <iframe> srcdoc document, or if title information is available from a higher level protocol (like the subject line in html email), zero or more elements of metadata content. otherwise, one or more elements of metadata content where exactly one is a <title> element. ...
<input type="button"> - HTML: Hypertext Markup Language
. given that a <button>’s label text is inserted between the opening and closing tags, you can include html in the label, even images. value a domstring used as the button's label events click supported common attributes type, and value idl attributes value methods none value an <input type="button"> elements' value attribute
contains a domstring that is used as the button's label. <input type="button" value="click me"> if you don't specify a value, you get an empty button: <input type="button"> using buttons <input type="button"> elements have no default behavior (their cousins, <input type="submit"> and <input type="reset"> are used to submit and reset forms, respectively). to make buttons do anything, you have ...
<input type="hidden"> - HTML: Hypertext Markup Language
ou want to pass back to the server. events none. supported common attributes autocomplete idl attributes value methods none. note: the input and change events do not apply to this input type. hidden inputs cannot be focused even using javascript (e.g. hiddeninput.focus()). value the <input> element's value attribute holds a domstring that
contains the hidden data you want to include when the form is submitted to the server. this specifically can't be edited or seen by the user via the user interface, although you could edit the value via browser developer tools. important: while the value isn't displayed to the user in the page's content, it is visible—and can be edited—using any browser's developer tools or "view source" functionali...
<input type="month"> - HTML: Hypertext Markup Language
bel> <input id="bday-month" type="month" name="bday-month" value="2017-06"> var monthcontrol = document.queryselector('input[type="month"]'); monthcontrol.value = '1978-06'; additional attributes in addition to the attributes common to <input> elements, month inputs offer the following attributes: attribute description list the id of the <datalist> element that
contains the optional pre-defined autocomplete options max the latest year and month to accept as a valid input min the earliest year and month to accept as a valid input readonly a boolean which, if present, indicates that the input's value can't be edited step a stepping interval to use when incrementing and decrementing the value of the input field ...
<input type="password"> - HTML: Hypertext Markup Language
if the user hasn't entered anything yet, this value is an empty string (""). if the required property is specified, then the password edit box must contain a value other than an empty string to be valid. if the pattern attribute is specified, the content of a password control is only con...
<input type="reset"> - HTML: Hypertext Markup Language
e rarely useful, and are instead more likely to frustrate users who click them by mistake (often while trying to click the submit button). value a domstring used as the button's label events click supported common attributes type and value idl attributes value methods none value an <input type="reset"> element's value attribute
contains a domstring that is used as the button's label. buttons such as reset don't have a value otherwise. <input type="reset" value="reset the form"> if you don't specify a value, you get an button with the default label (typically "reset," but this will vary depending on the user agent): <input type="reset"> using reset buttons <input type="reset"> buttons are used to reset forms. if you ...
Preloading content with rel="preload" - HTML: Hypertext Markup Language
deo: video file, as typically used in <video>. note: there's more detail about these values and the web features they expect to be consumed by in the preload spec — see link element extensions. also note that the full list of values the as attribute can take is governed by the fetch spec — see request destinations. including a mime type <link> elements can accept a type attribute, which
contains the mime type of the resource the element points to. this is especially useful when preloading resources — the browser will use the type attribute value to work out if it supports that resource, and will only download it if so, ignoring it if not. you can see an example of this in our video example (see the full source code, and also the live version): <head> <meta charset="utf-8"> <title...
Microformats - HTML: Hypertext Markup Language
ts. there are open source parsing libraries for most languages for microformats2. how microformats work an author of a webpage can add microformats to their html. for example if they wanted to identify themselves they could use an h-card such as: html example <a class="h-card" href="http://alice.example.com">alice blogger</a> when a parser encounters this data, it will know that this page
contains a "card" which describes a person or organization named alice blogger with a url of http://alice.example.com/. the parser makes this data available via apis that can be used for different applications. as in this example, some markup patterns require only a single microformat root class name, which parsers use to find a few generic properties such as name, url, photo. microformats prefixes al...
HTTP authentication - HTTP
an https (tls) connection to be secure. proxy authentication the same challenge and response mechanism can be used for proxy authentication. as both resource authentication and proxy authentication can coexist, a different set of headers and status codes is needed. in the case of proxies, the challenging status code is 407 (proxy authentication required), the proxy-authenticate response header
contains at least one challenge applicable to the proxy, and the proxy-authorization request header is used for providing the credentials to the proxy server. access forbidden if a (proxy) server receives valid credentials that are inadequate to access a given resource, the server should respond with the 403 forbidden status code. unlike 401 unauthorized or 407 proxy authentication required, authenticat...
Resource URLs - HTTP
er still necessary for firefox to load resources in web content under certain circumstances. for example, if you open the view source page (view page source or view selection source), you will find it requires viewsource.css through a resource: uri. resources that have to be exposed to web content have been moved to a new location named resource://content-accessible/, which is isolated and only
contains non-sensitive resources. in this way we can keep essential resources exposed and have most threats eliminated. note: it is recommended that web and extension developers don’t try to use resource urls anymore. their usage was hacky at best, and most usage won’t work any more. specifications resource: is not defined in any specification. ...
Browser detection using the user agent - HTTP
browser name when people say they want "browser detection", often they actually want "rendering engine detection". do you actually want to detect firefox, as opposed to seamonkey, or chrome as opposed to chromium? or do you actually simply want to see if the b...
Cross-Origin Resource Sharing (CORS) - HTTP
credentialed requests and wildcards when responding to a credentialed request, the server must specify an origin in the value of the access-control-allow-origin header, instead of speci...
Content Security Policy (CSP) - HTTP
d to specify the report-uri policy directive, providing at least one uri to which to deliver the reports: content-security-policy: default-src 'self'; report-uri http://reportcollector.example.com/collector.cgi then you need to set up your server to receive the reports; it can store or process them in whatever manner you determine is appropriate. violation report syntax the report json object
contains the following data: blocked-uri the uri of the resource that was blocked from loading by the content security policy. if the blocked uri is from a different origin than the document-uri, then the blocked uri is truncated to contain just the scheme, host, and port. disposition either "enforce" or "report" depending on whether the content-security-policy-report-only header or the content-s...
Configuring servers for Ogg media - HTTP
eful if you encounter other media types your server isn't already configured to recognize. serve media with the correct mime type *.ogg and *.ogv files containing video (possibly with an audio track as well, of course), should be served with the video/ogg mime type. *.oga and *.ogg files containing only audio should be served with the audio/ogg mime type. if you don't know whether the ogg file
contains audio or video, you can serve it with the mime type application/ogg, and the browser will treat it as a video file. most servers don't by default serve ogg media with the correct mime types, so you'll likely need to add the appropriate configuration for this. for apache, you can add the following to your configuration: addtype audio/ogg .oga addtype video/ogg .ogv addtype application/ogg .ogg ...
Age - HTTP
the age header is usually close to zero. if it is age: 0, it was probably just fetched from the origin server; otherwise it is usually calculated as a difference between the proxy's current date and the date general header included in the http response. header type response header forbidden header name no syntax age: <delta-seconds> directives <delta-seconds> a non-negative integer, representing time in seconds the object has been in a proxy cache. ...
Authorization - HTTP
header type request header forbidden header name no syntax authorization: <type> <credentials> directives <type> authentication type. a common type is "basic". other types: iana registry of authentication schemes authentification for aws servers (aws4-hmac-sha256) <credentials> if the "basic" authentication scheme is used, the credentials are constructed like this: the username and the password are combined with a colon (aladdin:opensesame). ...
Connection - HTTP
transaction finishes. if the value sent is keep-alive, the connection is persistent and not closed, allowing for subsequent requests to the same server to be done. connection-specific header fields such as connection and keep-alive are prohibited in http/2. chrome and firefox ignore them in http/2 responses, but safari conforms to the http/2 spec requirements and won’t load any response which
contains them. except for the standard hop-by-hop headers (keep-alive, transfer-encoding, te, connection, trailer, upgrade, proxy-authorization and proxy-authenticate), any hop-by-hop headers used by the message must be listed in the connection header, so that the first proxy knows it has to consume them and not forward them further. standard hop-by-hop headers can be listed too (it is often the case of...
Content-Security-Policy-Report-Only - HTTP
policy header. content-security-policy-report-only: default-src https:; report-uri /csp-violation-report-endpoint/ if you still want to receive reporting, but also want to enforce a policy, use the content-security-policy header with the report-uri directive. content-security-policy: default-src https:; report-uri /csp-violation-report-endpoint/ violation report syntax the report json object
contains the following data: blocked-uri the uri of the resource that was blocked from loading by the content security policy. if the blocked uri is from a different origin than the document-uri, then the blocked uri is truncated to contain just the scheme, host, and port. disposition either "enforce" or "report" depending on whether the content-security-policy header or the content-security-policy-...
Content-Security-Policy - HTTP
sm allows multiple policies being specified for a resource, including via the content-security-policy header, the content-security-policy-report-only header and a <meta> element. you can use the content-security-policy header more than once, as in the example below. pay special attention to the connect-src directive here. even though the second policy would allow the connection, the first policy
contains connect-src 'none'. adding additional policies can only further restrict the capabilities of the protected resource, which means that there will be no connection allowed and, as the strictest policy, connect-src 'none' is enforced. content-security-policy: default-src 'self' http://example.com; connect-src 'none'; content-security-policy: connect-src http://example.com/;...
Cookie - HTTP
the cookie header is optional and may be omitted if, for example, the browser's privacy settings block cookies. header type request header forbidden header name yes syntax cookie: <cookie-list> cookie: name=value cookie: name=value; name2=value2; name3=value3 <cookie-list> a list of name-value pairs in the form of <cookie-name>=<cookie-value>. pairs in the list are separated by a semicolon and a space ('; '). ...
Date - HTTP
note that date is listed in the forbidden header names in the fetch spec - so this code will not send date header: fetch('https://httpbin.org/get', { 'headers': { 'date': (new date()).toutcstring() } }) header type general header forbidden header name yes syntax date: <day-name>, <day> <month> <year> <hour>:<minute>:<second> gmt directives <day-name> one of "mon", "tue", "wed", "thu", "fri", "sat", or "sun" (case-sensitive). <day> 2 digit day number, e.g. "04" or "23". <month> one of "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec" (case sensitive). ...
Expires - HTTP
invalid dates, like the value 0, represent a date in the past and mean that the resource is already expired. if there is a cache-control header with the max-age or s-maxage directive in the response, the expires header is ignored. header type response header forbidden header name no cors-safelisted response header yes syntax expires: <http-date> directives <http-date> an http-date timestamp. ...
Forwarded - HTTP
the alternative and de-facto standard versions of this header are the x-forwarded-for, x-forwarded-host and x-forwarded-proto headers. this header is used for debugging, statistics, and generating location-dependent content and by design it exposes privacy sensitive information, such as the ip address of the client. therefore the user's privacy must be kept in mind when deploying this header. ...
From - HTTP
if you are running a robotic user agent (e.g. a crawler), the from header should be sent, so you can be contacted if problems occur on servers, such as if the robot is sending excessive, unwanted, or invalid requests. you shouldn't use the from header for access control or authentication. header type request header forbidden header name no syntax from: <email> directives <email> a machine-usable email address. ...
Host - HTTP
pecifies the host and port number of the server to which the request is being sent. if no port is included, the default port for the service requested (e.g., 443 for an https url, and 80 for an http url) is implied. a host header field must be sent in all http/1.1 request messages. a 400 (bad request) status code may be sent to any http/1.1 request message that lacks a host header field or that
contains more than one. header type request header forbidden header name yes syntax host: <host>:<port> directives <host> the domain name of the server (for virtual hosting). <port> optional tcp port number on which the server is listening. examples host: developer.cdn.mozilla.net specifications specification title rfc 7230, section 5.
Keep-Alive - HTTP
ection may be used to set a timeout and a maximum amount of requests. the connection header needs to be set to "keep-alive" for this header to have any meaning. connection-specific header fields such as connection and keep-alive are prohibited in http/2. chrome and firefox ignore them in http/2 responses, but safari conforms to the http/2 spec requirements and won’t load any response which
contains them. header type general header forbidden header name yes syntax keep-alive: parameters directives parameters a comma-separated list of parameters, each consisting of an identifier and a value separated by the equal sign ('='). the following identifiers are possible: timeout: indicating the minimum amount of time an idle connection has to be kept opened...
Last-Modified - HTTP
it is used as a validator to determine if a resource received or stored is the same. less accurate than an etag header, it is a fallback mechanism. conditional requests containing if-modified-since or if-unmodified-since headers make use of this field. header type response header forbidden header name no cors-safelisted response header yes syntax last-modified: <day-name>, <day> <month> <year> <hour>:<minute>:<second> gmt directives <day-name> one of "mon", "tue", "wed", "thu", "fri", "sat", or "sun" (case-sensitive). <day> 2 digit day number, e.g. "04" or "23". ...
Link - HTTP
the http link entity-header field provides a means for serialising one or more links in http headers. it is semantically equivalent to the html <link> element. syntax link: < uri-reference >; param1=value1; param2="value2" <uri-reference> the uri reference, must be enclosed between < and >. parameters the link header
contains parameters, which are separated with ; and are equivalent to attributes of the <link> element. examples the uri (absolute or relative) must be enclosed between < and >: link: <https://example.com>; rel="preconnect" link: https://bad.example; rel="preconnect" specifying multiple links you can specify multiple links separated by commas, for example: link: <https://one.example.com>; rel="preconnect", <https://two.example.com>; rel="preconnect", <https://three.ex...
Proxy-Authorization - HTTP
header type request header forbidden header name no syntax proxy-authorization: <type> <credentials> directives <type> authentication type. a common type is "basic". see also the iana registry of authentication schemes. <credentials> the credentials are constructed like this: the username and the password are combined with a colon (aladdin:opensesame). the resulting string is base64 encoded (ywxhzgrpbjpvcgvuc2vzyw1l). ...
Referer - HTTP
the referer header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example. important: although this header has many innocent uses it can have undesirable consequences for user security and privacy. see referer header: privacy and security concerns for more information and mitigations. note that referer is actually a misspelling of the word "referrer". see http referer on wikipedia for more details. a referer header is not sent by browsers if: the referring resource is a local "file" or "data" uri. ...
User-Agent - HTTP
ersion>". examples mozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml, like gecko) chrome/51.0.2704.106 safari/537.36 opr/38.0.2220.41 older, presto-based opera releases used: opera/9.80 (macintosh; intel mac os x; u; en) presto/2.2.15 version/10.00 opera/9.60 (windows nt 6.0; u; en) presto/2.1.1 safari ua string in this example, the user agent string is mobile safari’s version. it
contains the word "mobile". examples mozilla/5.0 (iphone; cpu iphone os 13_5_1 like mac os x) applewebkit/605.1.15 (khtml, like gecko) version/13.1.1 mobile/15e148 safari/604.1 internet explorer ua string examples mozilla/5.0 (compatible; msie 9.0; windows phone os 7.5; trident/5.0; iemobile/9.0) crawler and bot ua strings examples googlebot/2.1 (+http://www.google.com/bot.html) specifications ...
WWW-Authenticate - HTTP
ealm> a description of the protected area. if no realm is specified, clients often display a formatted hostname instead. charset=<charset> tells the client the server's prefered encoding scheme when submitting a username and password. the only allowed value is the case insensitive string "utf-8". this does not relate to the encoding of the realm string. examples typically, a server response
contains a www-authenticate header that looks like these: www-authenticate: basic www-authenticate: basic realm="access to the staging site", charset="utf-8" see also http authentication for examples on how to configure apache or nginx servers to password protect your site with http basic authentication. specifications specification title rfc 7235, section 4.1: www-authentic...
Want-Digest - HTTP
the sender may use quality values to indicate its preference ordering among the choices it offers. ...
Warning - HTTP
more than one warning header may appear in a response. warning header fields can in general be applied to any message, however some warn-codes are specific to caches and can only be applied to response messages. ...
Link prefetching FAQ - HTTP
oplevel nsiwebprogress object ("@mozilla.org/docloaderservice;1"). from this, we receive document start & stop notifications, and we approximate idle time as the period between the last document stop and the next document start. the last document stop notification occurs roughly when the onload handler would fire for the toplevel document. this is when we kick off prefetch requests. if a subframe
contains prefetching hints, prefetching will not begin until the top-most frame and all its "child" frames finish loading. what happens if i click on a link while something is being prefetched? when the user clicks on a link, or initiates any kind of page load, link prefetching will stop and any prefetch hints will be discarded. if a prefetched document is partially downloaded, then the partial document...
HTTP Messages - HTTP
broadly divided into two categories: single-resource bodies, consisting of one single file, defined by the two headers: content-type and content-length. multiple-resource bodies, consisting of a multipart body, each containing a different bit of information. this is typically associated with html forms. http responses status line the start line of an http response, called the status line,
contains the following information: the protocol version, usually http/1.1. a status code, indicating success or failure of the request. common status codes are 200, 404, or 302 a status text. a brief, purely informational, textual description of the status code to help a human understand the http message. a typical status line looks like: http/1.1 404 not found. headers http headers for response...
Network Error Logging - HTTP
json payload. the reporting group referenced above is defined in the usual manner within the report-to header, for example: report-to: { "group": "nel", "max_age": 31556952, "endpoints": [ { "url": "https://example.com/csp-reports" } ] } error reports in these examples, the entire reporting api payload is shown. the top-level "body" key
contains the network error report. http 400 (bad request) response { "age": 20, "type": "network-error", "url": "https://example.com/previous-page", "body": { "elapsed_time": 338, "method": "post", "phase": "application", "protocol": "http/1.1", "referrer": "https://example.com/previous-page", "sampling_fraction": 1, "server_ip": "137.205.28.66", "status_code": 40...
Proxy servers and tunneling - HTTP
the proxy's ip address. this can be useful if a proxy is used to provide client anonymity, but in other cases information from the original request is lost. the ip address of the original client is often used for debugging, statistics, or generating location-dependent content. a common way to disclose this information is by using the following http headers: the standardized header: forwarded
contains information from the client-facing side of proxy servers that is altered or lost when a proxy is involved in the path of the request. or the de-facto standard versions: x-forwarded-for identifies the originating ip addresses of a client connecting to a web server through an http proxy or a load balancer. x-forwarded-host identifies the original host requested that a client used to con...
HTTP range requests - HTTP
s. multipart ranges the range header also allows you to get multiple ranges at once in a multipart document. the ranges are separated by a comma. curl http://www.example.com -i -h "range: bytes=0-50, 100-150" the server responses with the 206 partial content status and a content-type: multipart/byteranges; boundary=3d6b6a416f9b5 header, indicating that a multipart byterange follows. each part
contains its own content-type and content-range fields and the required boundary parameter specifies the boundary string used to separate each body-part. http/1.1 206 partial content content-type: multipart/byteranges; boundary=3d6b6a416f9b5 content-length: 282 --3d6b6a416f9b5 content-type: text/html content-range: bytes 0-50/1270 <!doctype html> <html> <head> <title>example do --3d6b6a416f9b5 cont...
200 OK - HTTP
onse code indicates that the request has succeeded. a 200 response is cacheable by default. the meaning of a success depends on the http request method: get: the resource has been fetched and is transmitted in the message body. head: the entity headers are in the message body. post: the resource describing the result of the action is transmitted in the message body. trace: the message body
contains the request message as received by the server. the successful result of a put or a delete is often not a 200 ok but a 204 no content (or a 201 created when the resource is uploaded for the first time). status 200 ok specifications specification title rfc 7231, section 6.3.1: 200 ok hypertext transfer protocol (http/1.1): semantics and content ...
206 Partial Content - HTTP
if there is only one range, the content-type of the whole response is set to the type of the document, and a content-range is provided. if several ranges are sent back, the content-type is set to multipart/byteranges and each fragment covers one range, with content-range and content-type describing it. ...
407 Proxy Authentication Required - HTTP
the http 407 proxy authentication required client error status response code indicates that the request has not been applied because it lacks valid authentication credentials for a proxy server that is between the browser and the server that can access the requested resource. this status is sent with a proxy-authenticate header that
contains information on how to authorize correctly. status 407 proxy authentication required example response http/1.1 407 proxy authentication required date: wed, 21 oct 2015 07:28:00 gmt proxy-authenticate: basic realm="access to internal site" specifications specification title rfc 7235, section 3.2: 407 proxy authentication required http/1.1: authentication ...
451 Unavailable For Legal Reasons - HTTP
the hypertext transfer protocol (http) 451 unavailable for legal reasons client error response code indicates that the user requested a resource that is not available due to legal reasons, such as a web page for which a legal action has been issued. status 451 unavailable for legal reasons example this example response is taken from the ietf rfc (see below) and
contains a reference to monty python's life of brian. note: the link header might also contain a rel="blocked-by" relation identifying the entity and implementing blockage, not any other entity mandating it. any attempt to identify the entity ultimately responsible for the resource being unavailable belongs in the response body, not in the rel="blocked-by" link. this includes the name of the person or organization that made a legal d...
510 Not Extended - HTTP
the hypertext transfer protocol (http) 510 not extended response status code is sent in the context of the http extension framework, defined in rfc 2774. in that specification a client may send a request that
contains an extension declaration, that describes the extension to be used. if the server receives such a request, but any described extensions are not supported for the request, then the server responds with the 510 status code. status 510 not extended specifications specification title rfc 2774, section 7: 510 not extended an http extension framework ...
HTTP response status codes - HTTP
erver prepares a response. successful responses 200 ok the request has succeeded. the meaning of the success depends on the http method: get: the resource has been fetched and is transmitted in the message body. head: the entity headers are in the message body. put or post: the resource describing the result of the action is transmitted in the message body. trace: the message body
contains the request message as received by the server 201 created the request has succeeded and a new resource has been created as a result. this is typically the response sent after post requests, or some put requests. 202 accepted the request has been received but not yet acted upon. it is noncommittal, since there is no way in http to later send an asynchronous response indicating the outcome ...
CSS Houdini
and style sheet rule has a style map which is accessible via its stylepropertymap. a feature of css houdini is the worklet. with worklets, you can create modular css, requiring a single line of javascript to import configureable components: no pre-processors, post-processors or javascript frameworks needed. <script> css.paintworklet.addmodule('csscomponent.js'); </script> this added module
contains registerpaint() functions, which register completely configurable worklets. the css paint() function parameters include the name of the worklet, along with optional parameters. the worklet also has access to the element's custom properties: they don't need to be passed as function arguments. li { background-image: paint(mycomponent, stroke, 10px); --highlights: blue; --lowlights: green...
Closures - JavaScript
1. in previous examples, each closure had its own lexical environment. here though, there is a single lexical environment that is shared by the three functions: counter.increment, counter.decrement, and counter.value. the shared lexical environment is created in the body of an anonymous function, which is executed as soon as it has been defined (also known as an iife). the lexical environment
contains two private items: a variable called privatecounter, and a function called changeby. you can't access either of these private members from outside the anonymous function. instead, you can access them using the three public functions that are returned from the anonymous wrapper. those three public functions are closures that share the same lexical environment. thanks to javascript's lexical scopi...
JavaScript data types and data structures - JavaScript
of an accessor property attribute type description default value [[get]] function object or undefined the function is called with an empty argument list and retrieves the property value whenever a get access to the value is performed. see also get. undefined [[set]] function object or undefined the function is called with an argument that
contains the assigned value and is executed whenever a specified property is attempted to be changed. see also set. undefined [[enumerable]] boolean if true, the property will be enumerated in for...in loops. false [[configurable]] boolean if false, the property can't be deleted and can't be changed to a data property. false "normal" objects, and functions...
Introduction - JavaScript
there are also more advanced server side versions of javascript such as node.js, which allow you to add more functionality to a website than simply downloading files (such as realtime collaboration between multiple computers). inside a host environment (for example, a web browser), javascript can be connected to the objects of its environment to provide programmatic control over them. javascript
contains a standard library of objects, such as array, date, and math, and a core set of language elements such as operators, control structures, and statements. core javascript can be extended for a variety of purposes by supplementing it with additional objects; for example: client-side javascript extends the core language by supplying objects to control a browser and its document object model (dom).
Meta programming - JavaScript
pty object here) and a handler object, in which a get trap is implemented. here, an object that is proxied will not return undefined when getting undefined properties, but will instead return the number 42. additional examples are available on the proxy reference page. terminology the following terms are used when talking about the functionality of proxies. handler placeholder object which
contains traps. traps the methods that provide property access. (this is analogous to the concept of traps in operating systems.) target object which the proxy virtualizes. it is often used as storage backend for the proxy. invariants (semantics that remain unchanged) regarding object non-extensibility or non-configurable properties are verified against the target. invariants semantics that remain u...
Numbers and dates - JavaScript
it then creates a date object named endyear and sets the year to the current year. then, using the number of milliseconds per day, it computes the number of days between today and endyear, using gettime and rounding to a whole number of days. the parse method is useful for assigning values from date strings to existing date objects. for example, the following code uses parse and se...
Assertions - JavaScript
negated or complemented character set: [^a] // that is, it matches anything that is not enclosed in the brackets. ...
Character classes - JavaScript
acter *from the latin alphabet*, multiple times console.table(aliceexcerpt.match(regexpwordstartingwitha)); // ['ada', 'and', 'at', 'all'] looking for a word (from unicode characters) instead of the latin alphabet, we can use a range of unicode characters to identify a word (thus being able to deal with text in other languages like russian or arabic). the "basic multilingual plane" of unicode
contains most of the characters used around the world and we can use character classes and ranges to match words written with those characters. var nonenglishtext = "Приключения Алисы в Стране чудес"; var regexpbmpword = /([\u0000-\u0019\u0021-\uffff])+/gu; // bmp goes through u+0000 to u+ffff but space is u+0020 console.table(nonenglishtext.match(regexpbmpword)); [ 'Прик...
Regular expressions - JavaScript
example, the pattern /abc/ matches character combinations in strings only when the exact sequence "abc" occurs (all characters together and in that order). such a match would succeed in the strings "hi, do you know your abc's?" and "the latest airplane designs evolved from slabcraft." in both cases the match is with the substring "abc". there is no match in the string "grab crab" because while it
contains the substring "ab c", it does not contain the exact substring "abc". using special characters when the search for a match requires something more than a direct match, such as finding one or more b's, or finding white space, you can include special characters in the pattern. for example, to match a single "a" followed by zero or more "b"s followed by "c", you'd use the pattern /ab*c/: the * afte...
Text formatting - JavaScript
tring method description charat, charcodeat, codepointat return the character or character code at the specified position in string. indexof, lastindexof return the position of specified substring in the string or last position of specified substring, respectively. startswith, endswith, includes returns whether or not the string starts, ends or
contains a specified string. concat combines the text of two strings and returns a new string. fromcharcode, fromcodepoint constructs a string from the specified sequence of unicode values. this is a method of the string class, not a string instance. split splits a string object into an array of strings by separating the string into substrings. slice extract...
Using Promises - JavaScript
to wrap old apis. in an ideal world, all asynchronous functions would already return promises. unfortunately, some apis still expect success and/or failure callbacks to be passed in the old way. the most obvious example is the settimeout() function: settimeout(() => saysomething("10 seconds passed"), 10*1000); mixing old-style callbacks and promises is problematic. if saysomething() fails or
contains a programming error, nothing catches it. settimeout is to blame for this. luckily we can wrap settimeout in a promise. best practice is to wrap problematic functions at the lowest possible level, and then never call them directly again: const wait = ms => new promise(resolve => settimeout(resolve, ms)); wait(10*1000).then(() => saysomething("10 seconds")).catch(failurecallback); basically, t...
Classes - JavaScript
t to stricter syntax for increased performance, some otherwise silent errors will be thrown, and certain keywords are reserved for future versions of ecmascript. constructor the constructor method is a special method for creating and initializing an object created with a class. there can only be one special method with the name "constructor" in a class. a syntaxerror will be thrown if the class
contains more than one occurrence of a constructor method. a constructor can use the super keyword to call the constructor of the super class. prototype methods see also method definitions. class rectangle { constructor(height, width) { this.height = height; this.width = width; } // getter get area() { return this.calcarea(); } // method calcarea() { return this.height * ...
SyntaxError: for-in loop head declarations may not have initializers - JavaScript
the javascript strict mode-only exception "for-in loop head declarations may not have initializers" occurs when the head of a for...in
contains an initializer expression, such as |for (var i = 0 in obj)|. this is not allowed in for-of loops in strict mode. message syntaxerror: for-in loop head declarations cannot have an initializer (edge) syntaxerror: for-in loop head declarations may not have initializers (firefox) syntaxerror: for-in loop variable declaration may not have an initializer. (chrome) error type syntaxerror in strict mode only. what went wrong? the head of a for...in loop
contains an initializer expression. that is, a variable is declared and assigned a value |for (var i = 0 in obj)|. in non-strict mode, this head declaration is silently ignored and behaves like |for (var i ...
SyntaxError: a declaration in the head of a for-of loop can't have an initializer - JavaScript
the javascript exception "a declaration in the head of a for-of loop can't have an initializer" occurs when the head of a for...of loop
contains an initializer expression such as |for (var i = 0 of iterable)|. this is not allowed in for-of loops. message syntaxerror: for-of loop head declarations cannot have an initializer (edge) syntaxerror: a declaration in the head of a for-of loop can't have an initializer (firefox) syntaxerror: for-of loop variable declaration may not have an initializer. (chrome) error type syntaxerror what went wrong? the head of a for...of loop
contains an initializer expression. that is, a variable is declared and assigned a value |for (var i = 0 of iterable)|. this is not allowed in for-of loops. you might want a for loop that does allow an initializer. examples...
URIError: malformed URI sequence - JavaScript
an argument given to either the decodeuri, encodeuri, encodeuricomponent, or decodeuricomponent function was not valid, so that the function was unable encode or decode properly. ...
arguments.callee - JavaScript
description callee is a property of the arguments object. it can be used to refer to the currently executing function inside the function body of that function. this is useful when the name of the function is unknown, such as within a function expression with no name (also called "anonymous functions"). warning: the 5th edition of ecmascript (es5) forbids use of arguments.callee() in strict mode. avoid using arguments.callee() by either giving function expressions a name or use a function declaration where a function must call itself. ...
arguments.length - JavaScript
description the arguments.length property provides the number of arguments actually passed to a function. this can be more or less than the defined parameter's count (see function.length). examples using arguments.length in this example we define a function that can add two or more numbers together. function adder(base /*, n2, ... ...
Array.prototype[@@unscopables] - JavaScript
these properties are excluded from with statement bindings. description the default array properties that are excluded from with bindings are: copywithin() entries() fill() find() findindex() includes() keys() values() see symbol.unscopables for how to set unscopables for your own objects. property attributes of array.prototype[@@unscopables] writable no enumerable no configurable yes examples use in with environments the following code works fine in es5 and below. ...
Array.prototype.concat() - JavaScript
array consisting of the elements in the object on which it is called, followed in order by, for each argument, the elements of that argument (if the argument is an array) or the argument itself (if the argument is not an array). it does not recurse into nested array arguments. the concat method does not alter this or any of the arrays provided as arguments but instead returns a shallow copy that
contains copies of the same elements combined from the original arrays. elements of the original arrays are copied into the new array as follows: object references (and not the actual object): concat copies object references into the new array. both the original and new array refer to the same object. that is, if a referenced object is modified, the changes are visible to both the new and original arra...
Array.prototype.entries() - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax array.entries() return value a new array iterator object. ...
Array.prototype.keys() - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.keys() return value a new array iterator object. ...
Array.prototype.length - JavaScript
ngth var namelistb = []; namelistb.length = math.pow(2,32)-1; //set array length less than 2 to the 32nd power console.log(namelistb.length); //4294967295 you can set the length property to truncate an array at any time. when you extend an array by changing its length property, the number of actual elements increases; for example, if you set length to 3 when it is currently 2, the array now
contains 3 elements, which causes the third element to be a non-iterable empty slot. const arr = [1, 2]; console.log(arr); // [ 1, 2 ] arr.length = 5; // set array length to 5 while currently 2. console.log(arr); // [ 1, 2, <3 empty items> ] arr.foreach(element => console.log(element)); // 1 // 2 as you can see, the length property does not necessarily indicate the number of defined values in the arr...
Array.prototype.map() - JavaScript
3e+300] // for comparison, if we use parseint() on the array above: ['1.1', '2.2e2', '3e300'].map( str => parseint(str) ) // [1, 2, 3] one alternative output of the map method being called with parseint as a parameter runs as follows: let xs = ['10', '10', '10'] xs = xs.map(parseint) console.log(xs) // actual result of 10,nan,2 may be unexpected based on the above description. mapped array
contains undefined when undefined or nothing is returned: let numbers = [1, 2, 3, 4] let filterednumbers = numbers.map(function(num, index) { if (index < 3) { return num } }) // index goes from 0, so the filternumbers are 1,2,3 and undefined. // filterednumbers is [1, 2, 3, undefined] // numbers is still [1, 2, 3, 4] specifications specification ecmascript (ecma-262)th...
Array.prototype.push() - JavaScript
existent, in which case length will also be created. although strings are native, array-like objects, they are not suitable in applications of this method, as strings are immutable. similarly for the native, array-like object arguments. examples adding elements to an array the following code creates the sports array containing two elements, then appends two elements to it. the total variable
contains the new length of the array. let sports = ['soccer', 'baseball'] let total = sports.push('football', 'swimming') console.log(sports) // ['soccer', 'baseball', 'football', 'swimming'] console.log(total) // 4 merging two arrays this example uses apply() to push all elements from a second array. do not use this method if the second array (morevegs in the example) is very large because the m...
Array.prototype.slice() - JavaScript
string, number and boolean objects), slice copies the values into the new array. changes to the string, number, or boolean in one array do not affect the other array. if a new element is added to either array, the other array is not affected. examples return a portion of an existing array let fruits = ['banana', 'orange', 'lemon', 'apple', 'mango'] let citrus = fruits.slice(1, 3) // fruits
contains ['banana', 'orange', 'lemon', 'apple', 'mango'] // citrus
contains ['orange','lemon'] using slice> in the following example, slice creates a new array, newcar, from mycar. both include a reference to the object myhonda. when the color of myhonda is changed to purple, both arrays reflect the change. // using slice, create newcar from mycar. let myhonda = { color: 'red', wheels: 4, engine: { cy...
Array.prototype.values() - JavaScript
syntax arr.values() return value a new array iterator object. examples iteration using for...of loop var arr = ['a', 'b', 'c', 'd', 'e']; var iterator = arr.values(); for (let letter of iterator) { console.log(letter); } //"a" "b" "c" "d" "e" array.prototype.values is default implementation of array.prototype[symbol.iterator]. ...
ArrayBuffer.prototype.slice() - JavaScript
le is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arraybuffer.slice(begin[, end]) parameters begin zero-based byte index at which to begin slicing. end optional byte index before which to end slicing. if end is unspecified, the new arraybuffer
contains all bytes from begin to the end of this arraybuffer. return value a new arraybuffer object. description the slice() method copies up to, but not including, the byte indicated by the end parameter. if either begin or end is negative, it refers to an index from the end of the array, as opposed to from the beginning. the range specified by the begin and end parameters is clamped to the valid i...
Atomics.wait() - JavaScript
it returns a string which is either "ok", "not-equal", or "timed-out". note: this operation only works with a shared int32array and may not be allowed on the main thread. syntax atomics.wait(typedarray, index, value[, timeout]) parameters typedarray a shared int32array. index the position in the typedarray to wait on. value the expected value to test. timeout optional time to wait in milliseconds. infinity, if no time is provided. return value a string which is either "ok", "not-equal", or "timed-out". ...
Atomics - JavaScript
computes a bitwise or on the value at the specified index of the array with the provided value. returns the old value at that index. atomics.store() stores a value at the specified index of the array. returns the value. atomics.sub() subtracts a value at the specified index of the array. returns the old value at that index. atomics.wait() verifies that the specified index of the array still
contains a value and sleeps awaiting or times out. returns either "ok", "not-equal", or "timed-out". if waiting is not allowed in the calling agent then it throws an error exception. (most browsers will not allow wait() on the browser's main thread.) atomics.xor() computes a bitwise xor on the value at the specified index of the array with the provided value. returns the old value at that index. examp...
Error.prototype.columnNumber - JavaScript
the columnnumber property
contains the column number in the line of the file that raised this error. examples using columnnumber var e = new error('could not parse input'); throw e; console.log(e.columnnumber) // 0 specifications not part of any standard. ...
Error.prototype.lineNumber - JavaScript
examples using linenumber var e = new error('could not parse input'); throw e; console.log(e.linenumber) // 2 alternative example using error event window.addeventlistener('error', function(e) { console.log(e.linenumber); // 5 }); var e = new error('could not parse input'); throw e; this is not a standard feature and lacks widespread support. see the browser compatability table below. ...
Error.prototype.message - JavaScript
spidermonkey makes extensive use of the message property for exceptions. the message property combined with the name property is used by the error.prototype.tostring() method to create a string representation of the error. by default, the message property is an empty string, but this behavior can be overridden for an instance by specifying a message as the first argument to the error constructor. ...
RegExp.lastParen ($+) - JavaScript
regexp.$+ is an alias for this property. description the lastparen property is static, it is not a property of an individual regular expression object. instead, you always use it as regexp.lastparen or regexp['$+']. the value of the lastparen property is read-only and modified whenever a successful match is made. you can not use the shorthand alias with the dot property accessor (regexp.$+), because the parser expects an expression with "+" in that case and a syntaxerror is thrown. ...
RegExp.leftContext ($`) - JavaScript
regexp.$` is an alias for this property. description the leftcontext property is static, it is not a property of an individual regular expression object. instead, you always use it as regexp.leftcontext or regexp['$`']. the value of the leftcontext property is read-only and modified whenever a successful match is made. you can not use the shorthand alias with the dot property accessor (regexp.$`), because the parser expects a starting template string in that case and a syntaxerror is thrown. ...
RegExp.rightContext ($') - JavaScript
regexp.$' is an alias for this property. description the rightcontext property is static, it is not a property of an individual regular expression object. instead, you always use it as regexp.rightcontext or regexp["$'"]. the value of the rightcontext property is read-only and modified whenever a successful match is made. you can not use the shorthand alias with the dot property accessor (regexp.$'), because the parser expects a starting string in that case and a syntaxerror is thrown. ...
RegExp.prototype.test() - JavaScript
examples using test() simple example that tests if "hello" is contained at the very beginning of a string, returning a boolean result. const str = 'hello world!'; const result = /^hello/.test(str); console.log(result); // true the following example logs a message which depends on the success of the test: function testinput(re, str) { let midstring; if (re.test(str)) { midstring = '
contains'; } else { midstring = 'does not contain'; } console.log(`${str} ${midstring} ${re.source}`); } using test() on a regex with the "global" flag when a regex has the global flag set, test() will advance the lastindex of the regex. (regexp.prototype.exec() also advances the lastindex property.) further calls to test(str) will resume searching str starting from lastindex. the lastindex ...
RegExp - JavaScript
ng language from which javascript modeled its regular expressions.). see also deprecated regexp properties. constructor regexp() creates a new regexp object. static properties get regexp[@@species] the constructor function that is used to create derived objects. regexp.lastindex the index at which to start the next match. instance properties regexp.prototype.flags a string that
contains the flags of the regexp object. regexp.prototype.dotall whether . matches newlines or not. regexp.prototype.global whether to test the regular expression against all possible matches in a string, or only against the first. regexp.prototype.ignorecase whether to ignore case while attempting a match in a string. regexp.prototype.multiline whether or not to search in strings across multiple ...
Set.prototype.entries() - JavaScript
the entries() method returns a new iterator object that
contains an array of [value, value] for each element in the set object, in insertion order. for set objects there is no key like in map objects. however, to keep the api similar to the map object, each entry has the same value for its key and value here, so that an array [value, value] is returned. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax myset.entries() return value a new iterator object that
contains an array of [value, value] for each element in the given set, in insertion order. examples using entries() var myset = new set(); myset.add('foob...
Set.prototype.has() - JavaScript
r the given element is found. examples using the has method var myset = new set(); myset.add('foo'); myset.has('foo'); // returns true myset.has('bar'); // returns false var set1 = new set(); var obj1 = {'key1': 1}; set1.add(obj1); set1.has(obj1); // returns true set1.has({'key1': 1}); // returns false because they are different object references set1.add({'key1': 1}); // now set1
contains 2 entries specifications specification ecmascript (ecma-262)the definition of 'set.prototype.has' in that specification. ...
Set.prototype.values() - JavaScript
the keys() method is an alias for this method (for similarity with map objects); it behaves exactly the same and returns values of set elements. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax myset.values(); return value a new iterator object containing the values for each element in the given set, in insertion order. ...
Set - JavaScript
a new iterator object that yields the values for each element in the set object in insertion order. (for sets, this is the same as the values() method.) set.prototype.values() returns a new iterator object that yields the values for each element in the set object in insertion order. (for sets, this is the same as the keys() method.) set.prototype.entries() returns a new iterator object that
contains an array of [value, value] for each element in the set object, in insertion order. this is similar to the map object, so that each entry's key is the same as its value for a set. set.prototype.foreach(callbackfn[, thisarg]) calls callbackfn once for each value present in the set object, in insertion order. if a thisarg parameter is provided, it will be used as the this value for each invoca...
String.prototype.charAt() - JavaScript
var str = 'a \ud87e\udc04 z'; // we could also use a non-bmp character directly for (var i = 0, chr; i < str.length; i++) { if ((chr = getwholechar(str, i)) === false) { continue; } // adapt this line at the top of each loop, passing in the whole string and // the current iteration and returning a variable to represent the /...
String.prototype.indexOf() - JavaScript
xof() to locate values in the string "brave new world". const str = 'brave new world' console.log('index of first w from start is ' + str.indexof('w')) // logs 8 console.log('index of "new" from start is ' + str.indexof('new')) // logs 6 indexof() and case-sensitivity the following example defines two string variables. the variables contain the same string, except that the second string
contains uppercase letters. the first console.log() method displays 19. but because the indexof() method is case sensitive, the string "cheddar" is not found in mycapstring, so the second console.log() method displays -1. const mystring = 'brie, pepper jack, cheddar' const mycapstring = 'brie, pepper jack, cheddar' console.log('mystring.indexof("cheddar") is ' + mystring.indexof('cheddar')) // logs 1...
String length - JavaScript
length is a read-only data property of string instances. description this property returns the number of code units in the string. utf-16, the string format used by javascript, uses a single 16-bit code unit to represent the most common characters, but needs to use two code units for less commonly-used characters, so it's possible for the value returned by length to not match the actual number of characters in the string. ecmascript 2016 (ed. 7) established a maximum length of 2^53 - 1 elements. previously, no maximum length was specified. in firefox, strings have a maximum length of 2**30 - 2 (~1gb). ...
String.prototype.match() - JavaScript
match() with no parameter const str = "nothing will come of nothing."; str.match(); // returns [""] a non-regexp object as the parameter when the regexp parameter is a string or a number, it is implicitly converted to a regexp by using new regexp(regexp). if it is a positive number with a positive sign, regexp() will ignore the positive sign. const str1 = "nan means not a number. infinity
contains -infinity and +infinity in javascript.", str2 = "my grandfather is 65 years old and my grandmother is 63 years old.", str3 = "the contract was declared null and void."; str1.match("number"); // "number" is a string. returns ["number"] str1.match(nan); // the type of nan is the number. returns ["nan"] str1.match(infinity); // the type of infinity is the number. returns ["infinit...
String.raw() - JavaScript
(but it is not identical; see explanations in this issue.) it's used to get the raw string form of template strings, that is, substitutions (e.g. ${foo}) are processed, but escapes (e.g. \n) are not. syntax string.raw(callsite, ...substitutions) string.raw`templatestring` parameters callsite well-formed template call site object, like { raw: ['foo', 'bar', 'baz'] }. ...substitutions
contains substitution values. templatestring a template string, optionally with substitutions (${...}). return value the raw string form of a given template string. exceptions typeerror a typeerror is thrown if the first argument is not a well-formed object. description in most cases, string.raw() is used with template strings. the first syntax mentioned above is only rarely used, because the...
String.prototype.repeat() - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.repeat(count) parameters count an integer between 0 and +infinity, indicating the number of times to repeat the string. return value a new string containing the specified number of copies of the given string. exceptions rangeerror: repeat count must be non-negative. ...
String - JavaScript
t value at the given index. string.prototype.codepointat(pos) returns a nonnegative integer number that is the code point value of the utf-16 encoded code point starting at the specified pos. string.prototype.concat(str [, ...strn ]) combines the text of two (or more) strings and returns a new string. string.prototype.includes(searchstring [, position]) determines whether the calling string
contains searchstring. string.prototype.endswith(searchstring [, length]) determines whether a string ends with the characters of the string searchstring. string.prototype.indexof(searchvalue [, fromindex]) returns the index within the calling string object of the first occurrence of searchvalue, or -1 if not found. string.prototype.lastindexof(searchvalue [, fromindex]) returns the index within the...
TypedArray.BYTES_PER_ELEMENT - JavaScript
ractive-examples and send us a pull request. property attributes of typedarray.bytes_per_element writable no enumerable no configurable no description typedarray objects differ from each other in the number of bytes per element and in the way the bytes are interpreted. the bytes_per_element constant
contains the number of bytes each element in the given typedarray has. examples using bytes_per_element int8array.bytes_per_element; // 1 uint8array.bytes_per_element; // 1 uint8clampedarray.bytes_per_element; // 1 int16array.bytes_per_element; // 2 uint16array.bytes_per_element; // 2 int32array.bytes_per_element; // 4 uint32array.bytes_per_element; // 4 float32...
TypedArray.prototype.entries() - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.entries() return value a new array iterator object. ...
TypedArray.prototype.keys() - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.keys() return value a new array iterator object. ...
TypedArray.prototype.values() - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.values() return value a new array iterator object. ...
WeakRef - JavaScript
a weak reference to an object is a reference that does not prevent the object from being reclaimed by the garbage collector. in contrast, a normal (or strong) reference keeps an object in memory. when an object no longer has any strong references to it, the javascript engine's garbage collector may destroy the object and reclaim its memory. ...
WebAssembly.Global() constructor - JavaScript
a webassembly.global() constructor creates a new global object representing a global variable instance, accessible from both javascript and importable/exportable across one or more webassembly.module instances. this allows dynamic linking of multiple modules. syntax new webassembly.global(descriptor, value); parameters descriptor a globaldescriptor dictionary object, which
contains two properties: value: a usvstring representing the data type of the global. this can be one of i32, i64, f32, and f64. mutable: a boolean value that determines whether the global is mutable or not. by default, this is false. value the value the variable
contains. this can be any value, as long as its type matches the variable's data type. if no value is specified, a typed 0 value is used, as specifi...
WebAssembly.Module - JavaScript
constructor webassembly.module() creates a new module object. static properties webassembly.module.customsections() given a module and string, returns a copy of the contents of all custom sections in the module with the given string name. webassembly.module.exports() given a module, returns an array containing descriptions of all the declared exports. webassembly.module.imports() given a module, returns an array containing descriptions of all the declared imports. ...
WebAssembly.Table() constructor - JavaScript
initial size of 2 elements. we then print out the table length and contents of the two indexes (retrieved via table.prototype.get() to show that the length is two and both elements are null. var tbl = new webassembly.table({initial:2, element:"anyfunc"}); console.log(tbl.length); // "2" console.log(tbl.get(0)); // "null" console.log(tbl.get(1)); // "null" we then create an import object that
contains the table: var importobj = { js: { tbl:tbl } }; finally, we load and instantiate a wasm module (table2.wasm) using the webassembly.instantiatestreaming() method. the table2.wasm module
contains two functions (one that returns 42 and another that returns 83) and stores both into elements 0 and 1 of the imported table (see text representation). so after instantiation, the table still ha...
WebAssembly.Table.prototype.set() - JavaScript
then print out the table length and contents of the two indexes (retrieved via table.prototype.get()) to show that the length is two, and the indexes currently contain no function references (they currently return null). ...
WebAssembly.Table - JavaScript
initial size of 2 elements. we then print out the table length and contents of the two indexes (retrieved via table.prototype.get() to show that the length is two and both elements are null. var tbl = new webassembly.table({initial:2, element:"anyfunc"}); console.log(tbl.length); // "2" console.log(tbl.get(0)); // "null" console.log(tbl.get(1)); // "null" we then create an import object that
contains the table: var importobj = { js: { tbl:tbl } }; finally, we load and instantiate a wasm module (table2.wasm) using the webassembly.instantiatestreaming() method. the table2.wasm module
contains two functions (one that returns 42 and another that returns 83) and stores both into elements 0 and 1 of the imported table (see text representation). so after instantiation, the table still ha...
WebAssembly.instantiate() - JavaScript
he binary code of the .wasm module you want to compile. importobject optional an object containing the values to be imported into the newly-created instance, such as functions or webassembly.memory objects. there must be one matching property for each declared import of the compiled module or else a webassembly.linkerror is thrown. return value a promise that resolves to a resultobject which
contains two fields: module: a webassembly.module object representing the compiled webassembly module. this module can be instantiated again, shared via postmessage() or cached in indexeddb. instance: a webassembly.instance object that
contains all the exported webassembly functions. exceptions if either of the parameters are not of the correct type or structure, a typeerror is thrown. if the op...
WebAssembly.instantiateStreaming() - JavaScript
sm module you want to stream, compile, and instantiate. importobject optional an object containing the values to be imported into the newly-created instance, such as functions or webassembly.memory objects. there must be one matching property for each declared import of the compiled module or else a webassembly.linkerror is thrown. return value a promise that resolves to a resultobject which
contains two fields: module: a webassembly.module object representing the compiled webassembly module. this module can be instantiated again or shared via postmessage(). instance: a webassembly.instance object that
contains all the exported webassembly functions. exceptions if either of the parameters are not of the correct type or structure, a typeerror is thrown. if the operation fails, the pr...
WebAssembly - JavaScript
king of multiple modules. webassembly.instance() is a stateful, executable instance of a webassembly.module webassembly.linkerror() indicates an error during module instantiation (besides traps from the start function). webassembly.memory() an object whose buffer property is a resizable arraybuffer that holds the raw bytes of memory accessed by a webassembly instance. webassembly.module()
contains stateless webassembly code that has already been compiled by the browser and can be efficiently shared with workers, and instantiated multiple times. webassembly.runtimeerror() error type that is thrown whenever webassembly specifies a trap. webassembly.table() an array-like structure representing a webassembly table, which stores function references. static methods webassembly.instantia...
decodeURI() - JavaScript
t, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax decodeuri(encodeduri) parameters encodeduri a complete, encoded uniform resource identifier. return value a new string representing the unencoded version of the given encoded uniform resource identifier (uri). exceptions throws an urierror ("malformed uri sequence") exception when encodeduri
contains invalid character sequences. description replaces each escape sequence in the encoded uri with the character that it represents, but does not decode escape sequences that could not have been introduced by encodeuri. the character “#” is not decoded from escape sequences. examples decoding a cyrillic url decodeuri('https://developer.mozilla.org/ru/docs/javascript_%d1%88%d0%b5%d0%bb%d0%bb%...
eval() - JavaScript
e: // instead of settimeout(" ... ", 1000) use: settimeout(function() { ... }, 1000); // instead of elt.setattribute("onclick", "...") use: elt.addeventlistener('click', function() { ... } , false); closures are also helpful as a way to create parameterized functions without concatenating strings. parsing json (converting strings to javascript objects) if the string you're calling eval() on
contains data (for example, an array: "[1, 2, 3]"), as opposed to code, you should consider switching to json, which allows the string to use a subset of javascript syntax to represent data. see also downloading json and javascript in extensions. note that since json syntax is limited compared to javascript syntax, many valid javascript literals will not parse as json. for example, trailing commas are no...
globalThis - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of globalthis writable yes enumerable no configurable yes description historically, accessing the global object has required different syntax in different javascript environments. on the web you can use window, self, or frames - but in web workers only self will work. ...
isNaN() - JavaScript
eturned value may be unexpected; the empty string, for example, is surely "not a number." the confusion stems from the fact that the term, "not a number", has a specific meaning for numbers represented as ieee-754 floating-point values. the function should be interpreted as answering the question, "is this value, when coerced to a numeric value, an ieee-754 'not a number' value?" ecmascript 2015
contains the number.isnan() function. number.isnan(x) is a reliable way to test whether x is nan or not. even with number.isnan, however, the meaning of nan remains the precise numeric meaning and not simply, "not a number". alternatively, in the absence of number.isnan, the expression (x != x) is a more reliable way to test whether variable x is nan or not, as the result is not subject to the false posit...
in operator - JavaScript
xample is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax prop in object parameters prop a string or symbol representing a property name or array index (non-symbols will be coerced to strings). object object to check if it (or its prototype chain)
contains the property with specified name (prop). examples basic usage the following examples show some uses of the in operator. // arrays let trees = ['redwood', 'bay', 'cedar', 'oak', 'maple'] 0 in trees // returns true 3 in trees // returns true 6 in trees // returns false 'bay' in trees // returns false (you must specify the index number, not the value at that index) 'leng...
yield - JavaScript
eves the optional value passed to the generator's next() method to resume its execution. description the yield keyword pauses generator function execution and the value of the expression following the yield keyword is returned to the generator's caller. it can be thought of as a generator-based version of the return keyword. yield can only be called directly from the generator function that
contains it. it cannot be called from nested functions or from callbacks. the yield keyword causes the call to the generator's next() method to return an iteratorresult object with two properties: value and done. the value property is the result of evaluating the yield expression, and done is false, indicating that the generator function has not fully completed. once paused on a yield expression, the ge...
continue - JavaScript
is labeled statement. examples using continue with while the following example shows a while loop that has a continue statement that executes when the value of i is 3. thus, n takes on the values 1, 3, 7, and 12. var i = 0; var n = 0; while (i < 5) { i++; if (i === 3) { continue; } n += i; } using continue with a label in the following example, a statement labeled checkiandj
contains a statement labeled checkj. if continue is encountered, the program continues at the top of the checkj statement. each time continue is encountered, checkj reiterates until its condition returns false. when false is returned, the remainder of the checkiandj statement is completed. if continue had a label of checkiandj, the program would continue at the top of the checkiandj statement. see also ...
import.meta - JavaScript
syntax import.meta description the syntax consists of the keyword import, a dot, and the identifier meta. normally the left-hand side of the dot is the object on which property access is performed, but here import is not really an object. the import.meta object is created by the ecmascript implementation, with a null prototype. the object is extensible, and its properties are writable, configurable, and enumerable. ...
Transitioning to strict mode - JavaScript
onger the case in ecmascript 2015 (bug 1041128). declaring two function parameters with the same name function f(a, b, b) {} these errors are good, because they reveal plain errors or bad practices. they occur before the code is running. new runtime errors javascript used to silently fail in contexts where what was done was an error. strict mode throws in such cases. if your code base
contains such cases, testing will be necessary to be sure nothing is broken. once again, it can happen at the function granularity level. setting a value to an undeclared variable function f(x) { 'use strict'; var a = 12; b = a + x * 35; // error! } f(42); this used to change a value on the global object which is rarely the expected effect. if you really want to set a value to the global object,...
Template literals (Template strings) - JavaScript
'' : (item.iscollapsed ? 'icon-expander' : 'icon-collapser') }`; in es2015 with nested template literals: const classes = `header ${ islargescreen() ? '' : `icon-${item.iscollapsed ? 'expander' : 'collapser'}` }`; tagged templates a more advanced form of template literals are tagged templates. tags allow you to parse template literals with a function. the first argument of a tag function
contains an array of string values. the remaining arguments are related to the expressions. the tag function can then perform whatever operations on these arguments you wish, and return the manipulated string. (alternatively, it can return something completely different, as described in one of the following examples.) the name of the function used for the tag can be whatever you want. let person = 'mik...
MathML documentation index - MathML
b, xml mathematical markup language (mathml) is a dialect of xml for describing mathematical notation and capturing both its structure and content. 2 authoring mathml beginner, mathml, mathml project this page explains how to write mathematics using the mathml language. just like html, mathml is described with tags and attributes. html becomes verbose when your document
contains advanced structures like lists or tables but fortunately there are many generators from simple notations, wysiwyg editors and other content management systems to help writing web pages. 3 examples beginner, example, guide, mathml, needsbeginnerupdate below you'll find some examples you can look at to help you to understand how to use mathml to display increasingly complex mat...
Web audio codec guide - Web media technologies
lie in the frequency range of 500 hz to 3,000 hz or so. that means voice-only codecs can throw away everything else. the voice-specific codecs are all inherently very lossy, however, and any sound with significant information in the frequency bands outside the vocal range captured will be entirely lost. this makes these codecs completely unsuitable for anything but spoken words. even audio that
contains only voices, but singing rather than simply speaking, will likely not be of acceptable quality in one of these formats. voice recording and playback usually needs to be low-latency in order to synchronize with video tracks, or in order to avoid cross-talk or other problems. fortunately, the characteristics that lead to speech codecs being so efficient storage space-wise also make them tend to be...
Media container formats (file types) - Web media technologies
upport older versions of firefox and chrome which don't yet support webm. for example, firefox 3.5 and 3.6 support ogg, but not webm. you can get more information about ogg and its codecs in the theora cookbook. base ogg media mime types audio video audio/ogg video/ogg the application/ogg mime type can be used when you don't necessarily know whether the media
contains audio or video. if at all possible, you should use one of the specific types, but fall back to application/ogg if you don't know the content format or formats. you can also add the codecs parameter to the mime type string to indicate which codecs are used for the audio and/or video tracks, and to optionally further describe the track media formats. video codecs supported by ogg codec ...
Handling media support issues in web content - Web media technologies
most broadly compatible experience possible. topics we will examine fallbacks, baseline media formats, and error handling practices that will let your content work in as many situations as possible. using poster frames a poster frame is a still image that's representative of the content of a video. this may be simply the first frame of video; however, in many cases, the first frame is blank, or
contains nothing but the logo of a business, or some other image that doesn't give the reader any context for the video's contents. a good poster frame is one which is either a representative of the video's contents, or is an image which isn't even from the video itself but
contains imagery and/or text which gives the reader a useful idea of the video's contents. in the case of an action movie, for examp...
Using images in HTML - Web media technologies
cover some of the html elements and css properties that are used to control how images are displayed on the web. html <img> the html <img> element is used to embed an image in a webpage. it supports a wide range of attributes that control how the image behaves and allows you to add important information like alt text for people who don't see the image. <picture> the html <picture> element
contains zero or more <source> elements and one <img> element which provides versions of an image for different display/device scenarios. the browser considers each child <source> element and chooses the best match among them. css object-fit the object-fit css property sets how the content of a replaced element, such as an <img> or <video>, should be resized to fit its container. object-position t...
Critical rendering path - Web Performance
erarchy. if another set of starttag and endtag tokens come between a set of starttag and endtags, you have a node inside a node, which is how we define the hierarchy of the dom tree. the greater the number of nodes, the longer the following events in the critical rendering path will take. measure! a few extra nodes won't make a difference, but divitis can lead to jank. css object model the dom
contains all the content of the page. the cssom
contains all the styles of the page; information on how to style that dom. cssom is similar to the dom, but different. while the dom construction is incremental, cssom is not. css is render blocking: the browser blocks page rendering until it receives and processes all of the css. css is render blocking because rules can be overwritten, so the content can't ...
Performance fundamentals - Web Performance
instead re-use elements that scroll off screen as new ones coming in. general application performance analysis firefox, chrome, and other browsers include built-in tools that can help you diagnose slow page rendering. in particular, firefox's network monitor will display a precise timeline of when each network request on your page happens, how large it is, and how long it takes. if your page
contains javascript code that is taking a long time to run, the javascript profiler will pinpoint the slowest lines of code: the built-in gecko profiler is a very useful tool that provides even more detailed information about which parts of the browser code are running slowly while the profiler runs. this is a bit more complex to use, but provides a lot of useful details. note: you can use these to...
Populating the page: how browsers work - Web Performance
time to first byte (ttfb) is the time between when the user made the request—say by clicking on a link—and the receipt of this first packet of html. the first chunk of content is usually 14kb of data. in our example above, the request is definitely less than 14kb, but the linked resources aren't requested until the browser encounters the links during parsing,...
Privacy, permissions, and information security
handling situations like this, browsers may offer different solutions to improve security even further or to try new features, or try to reduce complexity for users, among other possible reasons. <--- allow attribute, feature policy, and permissions api stuff ---> a specific user experience issue that often arises is a document that's loaded with permission to access a resource and the document
contains an <iframe> with the allow attribute to delegate that permission to the contents of the frame. in this case, it's possible for the user to wind up being prompted repeatedly for that same resource, first by the main page, then by the document in the frame. browsers may choose to provide ways around this. for example, in firefox 73, the user permission requests were revised so that when an <iframe...
Progressive web app structure - Progressive web apps (PWAs)
the <body> is split into the <header> (containing linked image), <main> page (with title, description and place for a content), and <footer> (copy and links). the app's only job is to list all the a-frame entries from the js13kgames...
How to make PWAs installable - Progressive web apps (PWAs)
ased browsers such as chrome, edge, and samsung internet require the service worker. if developing your app using firefox, be aware that you will need a service worker to be compatible with chromium-based browsers. the manifest file the key element is a web manifest file, which lists all the information about the website in a json format. it usually resides in the root folder of a web app. it
contains useful information, such as the app’s title, paths to different-sized icons that can be used to represent the app on an os (such as an icon on the home screen, an entry in the start menu, or an icon on the desktop), and a background color to use in loading or splash screens. this information is needed for the browser to present the web app properly during the installation process, as well as wi...
Progressive loading - Progressive web apps (PWAs)
ace and not cause the layout to repaint as the images load. loading via javascript the app.js file processes the data-src attributes like so: let imagestoload = document.queryselectorall('img[data-src]'); const loadimages = (image) => { image.setattribute('src', image.getattribute('data-src')); image.onload = () => { image.removeattribute('data-src'); }; }; the imagestoload variable
contains references to all the images, while the loadimages function moves the path from data-src to src. when each image is actually loaded, we remove its data-src attribute as it's not needed anymore. then we loop through each image and load it: imagestoload.foreach((img) => { loadimages(img); }); blur in css to make the whole process more visually appealing, the placeholder is blurred in css. w...
Media - Progressive web apps (PWAs)
t to a big screen for a large audience, or you might want to print it. these different media have different characteristics. css has the capacity to present content according to the media type. to specify rules that are specific to a type of media, use @media followed by the media type, followed by curly braces that enclose the rules. example a document on a website has a navigation area that
contains the primary site menu. in the markup language, the navigation area's parent element has the id nav-area. (in html5, this can be marked up with the <nav> element instead of <div> with an id attribute.) when printing the document, the navigation area has no purpose. this css (below) removes the navigation area when printing the document: @media print { #nav-area {display: none;} } some co...
gradientTransform - SVG: Scalable Vector Graphics
this allows for things such as skewing the gradient. this additional transformation matrix is post-multiplied to (i.e., inserted to the right of) any previously defined transformations, including the implicit transformation necessary to convert from object bounding box units to user space. ...
points - SVG: Scalable Vector Graphics
the points attribute defines a list of points. each point is defined by a pair of number representing a x and a y coordinate in the user coordinate system. if the attribute
contains an odd number of coordinates, the last one will be ignored. two elements are using this attribute: <polyline>, and <polygon> html,body,svg { height:100% } <svg viewbox="-10 -10 220 120" xmlns="http://www.w3.org/2000/svg"> <!-- polyline is an open shape --> <polyline stroke="black" fill="none" points="50,0 21,90 98,35 2,35 79,90"/> <!-- polygon is a closed shape --> <polygon stroke="black" fill="none" transform="translate(100,0)" points="50,0 21,90 98,35 2,35 79,90"/> <!-- it is usualy considered best practices to separate a x and y coordinate with a comma and a group of coordinates by a spa...
requiredExtensions - SVG: Scalable Vector Graphics
es in svg 2) which identify the required extensions, with the individual values separated by white space. determines whether all of the named extensions are supported by the user agent. if all of the given extensions are supported, then the attribute evaluates to true; otherwise, the current element and its children are skipped and thus will not be rendered. note: if a given extension reference
contains white space within itself, that white space must be escaped. requiredextensions is often used in conjunction with the <switch> element. if the attribute is used in other situations, then it represents a simple switch on the given element whether to render the element or not. note: if several extension reference objects are enclosed in a <switch> and none of them matches, this may lead to situat...
xml:lang - SVG: Scalable Vector Graphics
there is also a lang attribute (without namespace). if both of them are defined, the one with namespace is used and the one without is ignored. all elements are using this attribute. ...
Content type - SVG: Scalable Vector Graphics
non-local iri references, where the iri reference does contain an <absoluteiri> or <relativeiri>. for the full specification of iri references in svg, see svg 1.1 (2nd edition): iri references. length <length> a length is a distance measurement, given as a number along with a unit. lengths are specified in one...
<feSpecularLighting> - SVG: Scalable Vector Graphics
ed on the light color. the lighting calculation follows the standard specular component of the phong lighting model. the resulting image depends on the light color, light position and surface geometry of the input bump map. the result of the lighting calculation is added. the filter primitive assumes that the viewer is at infinity in the z direction. this filter primitive produces an image which
contains the specular reflection part of the lighting calculation. such a map is intended to be combined with a texture using the add term of the arithmetic <fecomposite> method. multiple light sources can be simulated by adding several of these light maps before applying it to the texture image. usage context categoriesfilter primitive elementpermitted contentexactly one light source element first and ...
<pattern> - SVG: Scalable Vector Graphics
attributes. value type: <url>; default value: none; animatable: yes patterncontentunits this attribute defines the coordinate system for the contents of the <pattern>. value type: userspaceonuse|objectboundingbox; default value: userspaceonuse; animatable: yes note: this attribute has no effect if a viewbox attribute is specified on the <pattern> element. patterntransform this attribute
contains the definition of an optional additional transformation from the pattern coordinate system onto the target coordinate system. value type: <transform-list>; default value: none; animatable: yes patternunits this attribute defines the coordinate system for attributes x, y, width , and height. value type: userspaceonuse|objectboundingbox; default value: objectboundingbox; animatable: yes preser...
Paths - SVG: Scalable Vector Graphics
s to simulate curves, and don't scale well to larger sizes. a good understanding of paths is important when drawing svgs. while creating complex paths using an xml editor or text editor is not recommended, understanding how they work will allow to identify and repair display issues in svgs. the shape of a <path> element is defined by one parameter: d. (see more in basic shapes.) the d attribute
contains a series of commands and parameters used by those commands. each of the commands is instantiated (for example, creating a class, naming and locating it) by a specific letter. for instance, let's move to the x and y coordinates (10, 10). the "move to" command is called with the letter m. when the parser runs into this letter, it knows it needs to move to a point. so, to move to (10,10) the comman...
SVG Filters Tutorial - SVG: Scalable Vector Graphics
ed the desired output. instead we need to add more filter primitives which will produce the desire rendering. by adding feoffset and result, the effect layer is defined <result> attribute is a reference that can be use later. it is quite different to an xml id and only can be referenced within the actual filter. <feoffset> primitive has the blur result from the gaussian blur. ...
SVG In HTML Introduction - SVG: Scalable Vector Graphics
gradient id="gradient"> <stop class="begin" offset="0%"/> <stop class="end" offset="100%"/> </lineargradient> <rect x="0" y="0" width="100" height="100" style="fill:url(#gradient)" /> <circle cx="50" cy="50" r="30" style="fill:url(#gradient)" /> </svg> </body> </html> discussion the page is mainly regular html, css and javascript. the only interesting part is the <svg> element it
contains. this element and its children are declared to be in the svg namespace. the element
contains a gradient and two shapes filled with the gradient. the gradient color stops have their colors set by css. when the user enters something incorrect into the form, the script sets the invalid attribute on the <body>, and a style rule changes the gradient end-stop color to red. (another style rule makes an ...
Same-origin policy - Web security
inherited origins scripts executed from pages with an about:blank or javascript: url inherit the origin of the document containing that url, since these types of urls do not contain information about an origin server. for example, about:blank is often used as a url of new, empty popup windows into which the parent script writes content (e.g. via the window.open() mechanism). if this popup also
contains javascript, that script would inherit the same origin as the script that created it. data: urls get a new, empty, security context. exceptions in internet explorer internet explorer has two major exceptions to the same-origin policy: trust zones if both domains are in the highly trusted zone (e.g. corporate intranet domains), then the same-origin limitations are not applied. port ie d...
Types of attacks - Web security
for endpoints that require a post request, it's possible to programmatically trigger a <form> submit (perhaps in an invisible <iframe>) when the page is loaded: <form action="https://bank.example.com/withdraw" method="post"> <input type="hidden" name="account" value="bob"> <input type="hidden" name="amount" value="1000000"> <input type="hidden" name="for" value="mallory"> </for...
Using custom elements - Web Components
s the text in a pop up information box to provide further in-context information. to begin with, the javascript file defines a class called popupinfo, which extends the generic htmlelement class. class popupinfo extends htmlelement { constructor() { // always call super first in constructor super(); // write element functionality in here ... } } the preceding code snippet
contains the constructor() definition for the class, which always starts by calling super() so that the correct prototype chain is established. inside the constructor, we define all the functionality the element will have when an instance of it is instantiated. in this case we attach a shadow root to the custom element, use some dom manipulation to create the element's internal shadow dom structure — w...
Using templates and slots - Web Components
can be filled with any markup fragment you want when the element is used in the markup. so, if we want to add a slot into our trivial example, we could update our template's paragraph element like this: <p><slot name="my-text">my default text</slot></p> if the slot's content isn't defined when the element is included in the markup, or if the browser doesn't support slots, <my-paragraph> just
contains the fallback content "my default text". to define the slot's content, we include an html structure inside the <my-paragraph> element with a slot attribute whose value is equal to the name of the slot we want it to fill. as before, this can be anything you like, for example: <my-paragraph> <span slot="my-text">let's have some different text!</span> </my-paragraph> or <my-paragraph> <ul slo...
XML introduction - XML: Extensible Markup Language
h are usually set in an xml schema or a dtd (document type definition). example <?xml version="1.0" encoding="utf-8"?> <message> <warning> hello world <!--missing </warning> --> </message> now let's look at a corrected version of that same document: <?xml version="1.0" encoding="utf-8"?> <message> <warning> hello world </warning> </message> a document that
contains an undefined tag is invalid. for example, if we never defined the <warning> tag, the document above wouldn't be valid. most browsers offer a debugger that can identify poorly-formed xml documents. entities like html, xml offers methods (called entities) for referring to some special reserved characters (such as a greater than sign which is used for tags). there are five of these characters t...
document - XPath
ocument, or multiple external documents, and returns the resulting node-set. syntax document(uri [,node-set] ) arguments uri an absolute or relative uri of the document to be retrieved. the uri may also include a fragment identifier. node-set (optional) an expression pointing to a node-set in the external document that should be returned. returns a node-set. notes if the uri
contains a fragment identifier and that fragment can be identified in the external document, that fragment will be treated as the root in the node-set argument's expression. if the node-set argument is omitted, the entire fragment will be returned. if the uri argument is a node-set, and the second argument is present, each node in the node-set will be evaluated as a separate uri, and the returned n...
translate - XPath
t="translate('the quick brown fox.', 'abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxyz')" /> output the quick brown fox. if abc is longer than xyz, then every occurrence of characters in abc that do not have a corresponding character in xyz will be removed. example <xsl:value-of select="translate('the quick brown fox.', 'brown', 'red')" /> output the quick red fdx. if xyz
contains more characters than abc, the extra characters are ignored. defined xpath 1.0 4.2 gecko support supported. ...
Functions - XPath
xpath axes the following is an annotated list of core xpath functions and xslt-specific additions to xpath, including a description, syntax, a list of arguments, result-type, source in the appropriate w3c recommendation, and degree of present gecko support. for further information on using xpath/xslt functions, please see the for further reading page. ...
Index - XPath
aluates a decimal number and returns the smallest integer greater than or equal to the decimal number. 20 choose function, xpath, xslt the choose function returns one of the specified objects based on a boolean parameter. 21 concat xslt, xslt_reference the concat function concatenates two or more strings and returns the resulting string. 22
contains xslt, xslt_reference the
contains function determines whether the first argument string
contains the second argument string and returns boolean true or false. 23 count xslt, xslt_reference the count function counts the number of nodes in a node-set and returns an integer. 24 current xslt, xslt_reference the current function can be used to ge...
XPath snippets - XPath
it avoids the more complex syntax of document.evaluate() for cases when it is not required as well as the need to use the special iterators on xpathresult (by returning ...