Search completed in 1.05 seconds.
580 results for "continue":
Your results are loading. Please wait...
IDBCursor.continue() - Web APIs
exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbcursor's transaction is inactive. dataerror the key parameter may have any of the following conditions: the key is not a valid key. ...
... exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbcursor's transaction is inactive. dataerror the key parameter may have any of the following conditions: the key is not a valid key. ...
... recommendation browser compatibility the compa...
...And 2 more matches
IDBCursor.continuePrimaryKey() - Web APIs
this method is only valid for cursors coming from an index. using it for cursors coming from an object store will throw an error. note: this feature is available in web workers. ...
...of the idbcursor interface advances the cursor to the to the item whose key matches the key parameter as well as whose primary key matches the primary key parameter. a typical use case, is to resume the iteration where a previous cursor has been closed, without having to compare the keys one by one. ...
... primarykey the primary key to position the cursor at. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbcursor's transaction is inactive. ...
...And 2 more matches
continue - JavaScript
the continue statement terminates execution of the statements in the current iteration of the current or labeled loop, and continues execution of the loop with the next iteration. 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 continue [label]; label identifier associated with the label of the statement. description in contrast to the break statement, continue does not terminate the execution of the loop entirely: instead, in a while loop, it jumps back to the condition. in a for loop, it jumps to the update expression. ...
...https://github.com/mdn/interactive-examples and send us a pull request. syntax continue [label]; label identifier associated with the label of the statement. description in contrast to the break statement, continue does not terminate the execution of the loop entirely: instead, in a while loop, it jumps back to the condition. in a for loop, it jumps to the update expression. the continue statement can include an optional label that allows the program to jump to the next iteration of a labeled loop statement instead of the current loop. in this case, the continue statement needs to be nested within this 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 take...
...beled loop statement instead of the current loop. in this case, the continue statement needs to be nested within this 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. i...
...And 2 more matches
PR_ConnectContinue
syntax #include <prio.h> prstatus pr_connectcontinue( prfiledesc *fd, print16 out_flags); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket. out_flags the out_flags field of the poll descriptor returned by pr_poll(). returns if the nonblocking connect has successfully completed, pr_connectcontinue returns pr_success. if pr_connectcontinue() returns pr_failure, call pr_geterror(): - pr_in_progress_error: the nonblocking connect is still in progress and has not completed yet. the caller should poll the file descriptor for the in_flags pr_poll_write|pr_poll_except and retry pr_connectcontinue later when pr_poll() returns. - other errors: the nonblocking connect has failed with this error code. descri...
...ectcontinue() returns pr_failure, call pr_geterror(): - pr_in_progress_error: the nonblocking connect is still in progress and has not completed yet. the caller should poll the file descriptor for the in_flags pr_poll_write|pr_poll_except and retry pr_connectcontinue later when pr_poll() returns. - other errors: the nonblocking connect has failed with this error code. description continue a nonblocking connect. after a nonblocking connect is initiated with pr_connect() (which fails with pr_in_progress_error), one should call pr_poll() on the socket, with the in_flags pr_poll_write | pr_poll_except. when pr_poll() returns, one calls pr_connectcontinue() on the socket to determine whether the nonblocking connect has completed or is still in progress. repeat the pr_poll(), pr_connect...
... a nonblocking connect. after a nonblocking connect is initiated with pr_connect() (which fails with pr_in_progress_error), one should call pr_poll() on the socket, with the in_flags pr_poll_write | pr_poll_except. when pr_poll() returns, one calls pr_connectcontinue() on the socket to determine whether the nonblocking connect has completed or is still in progress. repeat the pr_poll(), pr_connectcontinue() sequence until the nonblocking connect has completed. ...
100 Continue - HTTP
Web › HTTP › Status › 100
the http 100 continue informational status response code indicates that everything so far is ok and that the client should continue with the request or ignore it if it is already finished. to have a server check the request's headers, a client must send expect: 100-continue as a header in its initial request and receive a 100 continue status code in response before sending the body. ...
...the http 100 continue informational status response code indicates that everything so far is ok and that the client should continue with the request or ignore it if it is already finished. to have a server check the request's headers, a client must send expect: 100-continue as a header in its initial request and receive a 100 continue status code in response before sending the body. ...
...and that the client should continue with the request or ignore it if it is already finished. to have a server check the request's headers, a client must send expect: 100-continue as a header in its initial request and receive a 100 continue status code in response before sending the body. ...
Using IndexedDB - Web APIs
to retrieve. if you want to step through all the values in your object store, then you can use a cursor. here's what it looks like: var objectstore = db.transaction("customers").objectstore("customers"); objectstore.opencursor().onsuccess = function(event) { var cursor = event.target.result; if (cursor) { console.log("name for ssn " + cursor.key + " is " + cursor.value.name); cursor.continue(); } else { console.log("no more entries!"); } }; the opencursor() function takes several arguments. first, you can limit the range of items that are retrieved by using a key range object that we'll get to in a minute. second, you can specify the direction that you want to iterate. in the above example, we're iterating over all objects in ascending order. the success callback for curso...
...erate. in the above example, we're iterating over all objects in ascending order. the success callback for cursors is a little special. the cursor object itself is the result of the request (above we're using the shorthand, so it's event.target.result). then the actual key and value can be found on the key and value properties of the cursor object. if you want to keep going, then you have to call continue() on the cursor. when you've reached the end of the data (or if there were no entries that matched your opencursor() request) you still get a success callback, but the result property is undefined. one common pattern with cursors is to retrieve all objects in an object store and add them to an array, like this: var customers = []; objectstore.opencursor().onsuccess = function(event) { var cu...
...at matched your opencursor() request) you still get a success callback, but the result property is undefined. one common pattern with cursors is to retrieve all objects in an object store and add them to an array, like this: var customers = []; objectstore.opencursor().onsuccess = function(event) { var cursor = event.target.result; if (cursor) { customers.push(cursor.value); cursor.continue(); } else { console.log("got all customers: " + customers); } }; note: alternatively, you can use getall() to handle this case (and getallkeys()) . the following code does precisely the same thing as above: objectstore.getall().onsuccess = function(event) { console.log("got all customers: " + event.target.result); }; there is a performance cost associated with looking at the value...
...And 7 more matches
Table Reflow Internals - Archive of obsolete content
s. desired size - the size it would like to be given the avail size. this is equivalent to preferred size if the avail size is not constrained. review of reflow the reflowee sets various sizes in the reflow metrics after (possibly) reflowing some or all of its children which reflows it children, etc. the reflowee returns a reflow status which indicates if it is complete, and thus not have to continue (split) breaking status (in the case of some inline frames) if there is truncation (it can't fit in the space and can't split). this is just a convience mechanism. kinds of reflows initial - reflowee's first reflow must be of this type (reflower's responsibility). resize - reflowee gets a change in available space only. similar to initial, except it can reoccur. incremental - has a reflow pat...
... where each node has a command with a target frame, reflow command types are: dirty - something changed inside a target (e.g. it gains, loses children) style changed - a target changed stylisticly (recall, size is a style property) content changed - a target's content changed (e.g. ...
...nd requests max elem width. the table figures out the column widths (balances) given the style width constraints on the table, col groups, cols, cells the preferred and max element sizes of the cells (from the pass 1 reflow), and considers colspans pass 2 - cell widths are constrained by the column widths (heights are only constrained in paginated mode). table reflow table reflows row groups (continued) the row group figures out the row heights given its style height constraints, its rows and cells, and the actual heights of its rows and cells from the pass 2 reflow. if the table has a style height, it allocates extra height to its row groups, rows and cells. in each pass, row groups reflow rows which reflow cells which reflow cell blocks. table reflow example <table width=300> <tr> ...
...And 6 more matches
Index - Web APIs
Web › API › Index
78 animation.reverse() api, animation, interface, method, reference, web animations, reverse, waapi, web animations api the animation.reverse() method of the animation interface reverses the playback direction, meaning the animation ends at its beginning. if called on an unplayed animation, the whole animation is played backwards. if called on a paused animation, the animation will continue in reverse. 79 animation.starttime api, animation, interface, property, reference, web animations, starttime, web animations api the animation.starttime property of the animation interface is a double-precision floating-point value which indicates the scheduled time when an animation's playback should begin. 80 animation.timeline api, animation, experimental, p...
...he pointing device (e.g., touches the touch surface with their finger, taps the touch surface with a pen device, clicks with a mouse). typically, it's preferable to listen for the click event instead. 1179 element: msinertiastart event event, non-standard, reference the msinertiastart event is fired when contact with the touch surface stops when a scroll has enough inertia to continue scrolling. this event may not be fired if the scroll is sufficiently slow. 1180 element: msmanipulationstatechanged event event, event:microsoft extensions, msmanipulationstatechanged, non-standard, reference msmanipulationstatechanged fires when the state of an element being manipulated has changed (ie. whenever you start or finish panning or zooming an element). 1181...
...ge the idbcursor interface of the indexeddb api represents a cursor for traversing or iterating over multiple records in a database. 1997 idbcursor.advance() api, database, idbcursor, indexeddb, method, reference, storage, advance the advance() method of the idbcursor interface sets the number of times a cursor should move its position forward. ...
...And 6 more matches
Loops and iteration - JavaScript
mes. (note that it's possible that number could be zero!) the various loop mechanisms offer different ways to determine the start and end points of the loop. there are various situations that are more easily served by one type of loop over the others. the statements for loops provided in javascript are: for statement do...while statement while statement labeled statement break statement continue statement for...in statement for...of statement for statement a for loop repeats until a specified condition evaluates to false. the javascript for loop is similar to the java and c for loop. a for statement looks as follows: for ([initialexpression]; [conditionexpression]; [incrementexpression]) statement when a for loop executes, the following occurs: the initializing expression i...
...ill never terminate! the statements in the following while loop execute forever because the condition never becomes false: // infinite loops are bad! while (true) { console.log('hello, world!'); } labeled statement a label provides a statement with an identifier that lets you refer to it elsewhere in your program. for example, you can use a label to identify a loop, and then use the break or continue statements to indicate whether a program should interrupt the loop or continue its execution. the syntax of the labeled statement looks like the following: label : statement the value of label may be any javascript identifier that is not a reserved word. the statement that you identify with a label may be any statement. example in this example, the label markloop identifies a while loop.
...t i = 0; i < a.length; i++) { if (a[i] === thevalue) { break; } } example 2: breaking to a label let x = 0; let z = 0; labelcancelloops: while (true) { console.log('outer loops: ' + x); x += 1; z = 1; while (true) { console.log('inner loops: ' + z); z += 1; if (z === 10 && x === 10) { break labelcancelloops; } else if (z === 10) { break; } } } continue statement the continue statement can be used to restart a while, do-while, for, or label statement. when you use continue without a label, it terminates the current iteration of the innermost enclosing while, do-while, or for statement and continues execution of the loop with the next iteration. in contrast to the break statement, continue does not terminate the execution of the loop entirely...
...And 6 more matches
jspage - Archive of obsolete content
.each(c,b,d);}function $empty(){}function $extend(c,a){for(var b in (a||{})){c[b]=a[b];}return c; }function $h(a){return new hash(a);}function $lambda(a){return($type(a)=="function")?a:function(){return a;};}function $merge(){var a=array.slice(arguments); a.unshift({});return $mixin.apply(null,a);}function $mixin(e){for(var d=1,a=arguments.length;d<a;d++){var b=arguments[d];if($type(b)!="object"){continue; }for(var c in b){var g=b[c],f=e[c];e[c]=(f&&$type(g)=="object"&&$type(f)=="object")?$mixin(f,g):$unlink(g);}}return e;}function $pick(){for(var b=0,a=arguments.length; b<a;b++){if(arguments[b]!=undefined){return arguments[b];}}return null;}function $random(b,a){return math.floor(math.random()*(a-b+1)+b);}function $splat(b){var a=$type(b); return(a)?((a!="array"&&a!="arguments")?[b]:b):[];}var $t...
...]: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++){this.include(c[b]);}return this; },erase:function(b){for(var a=this.length;a--;a){if(this[a]===b){this.splice(a,1);}}return this;},empty:function(){this.length=0;return this;},flatten:function(){var d=[]; for(var b=0,a=this.length;b<a;b++){var c=$type(this[b]);if(!c){continue;}d=d.concat((c=="array"||c=="collection"||c=="arguments")?array.flatten(this[b]):this[b]); }return d;},hextorgb:function(b){if(this.length!=3){return null;}var a=this.map(function(c){if(c.length==1){c+=c;}return c.toint(16);});return(b)?a:"rgb("+a+")"; },rgbtohex:function(d){if(this.length<3){return null;}if(this.length==4&&this[3]==0&&!d){return"transparent";}var b=[];for(var a=0;a<3;a++){var c=...
...ents[c].each(function(d){d.create({bind:this,delay:a,"arguments":b})();},this);return this;},removeevent:function(b,a){b=events.removeon(b); if(!this.$events[b]){return this;}if(!a.internal){this.$events[b].erase(a);}return this;},removeevents:function(c){var d;if($type(c)=="object"){for(d in c){this.removeevent(d,c[d]); }return this;}if(c){c=events.removeon(c);}for(d in this.$events){if(c&&c!=d){continue;}var b=this.$events[d];for(var a=b.length;a--;a){this.removeevent(d,b[a]); }}return this;}});events.removeon=function(a){return a.replace(/^on([a-z])/,function(b,c){return c.tolowercase();});};var options=new class({setoptions:function(){this.options=$merge.run([this.options].extend(arguments)); if(!this.addevent){return this;}for(var a in this.options){if($type(this.options[a])!="function"||!(/^...
...And 5 more matches
NSS Tools modutil
anagement database files in the specified directory: modutil -create -dbdir c:\databases the security module database tool displays a warning: warning: performing this operation while communicator is running couldcause corruption of your security databases. if communicator iscurrently running, you should exit communicator before continuing thisoperation. type 'q <enter>' to abort, or <enter> to continue: after you press enter, the tool displays the following: creating "c:\databases\key3.db"...done.creating "c:\databases\cert8.db"...done.creating "c:\databases\secmod.db"...done. displaying module information this example gives detailed information about the specified module: modutil -list "netscape internal pkcs #11 module" -dbdir c:\databases the security module database tool displays...
...ms: modutil -default "cryptographic module" -dbdir c:\databases -mechanisms rsa:dsa:rc2 the security module database tool displays a warning: warning: performing this operation while communicator is running couldcause corruption of your security databases. if communicator iscurrently running, you should exit communicator before continuing thisoperation. type 'q <enter>' to abort, or <enter> to continue: after you press enter, the tool displays the following: using database directory c:\databases...successfully changed defaults. enabling a slot this example enables a particular slot in the specified module: modutil -enable "cryptographic module" -slot "cryptographic reader" -dbdir c:\databases the security module database tool displays a warning: warning: performing this operation whi...
... modutil -enable "cryptographic module" -slot "cryptographic reader" -dbdir c:\databases the security module database tool displays a warning: warning: performing this operation while communicator is running couldcause corruption of your security databases. if communicator iscurrently running, you should exit communicator before continuing thisoperation. type 'q <enter>' to abort, or <enter> to continue: after you press enter, the tool displays the following: using database directory c:\databases...slot "cryptographic reader" enabled. enabling fips compliance this example enables fips 140-2 compliance in communicator's internal module: modutil -dbdir "c:\databases" -fips true the security module database tool displays a warning: warning: performing this operation while the browser is...
...And 5 more matches
label - JavaScript
the labeled statement can be used with break or continue statements. it is prefixing a statement with an identifier which you can refer to. 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. note: labeled loops or blocks are very uncommon. usually function calls can be used instead of loop jumps. syntax label : statement label any javascript identifier that is not a reserved word. statement a javascript statement. break can be used with any labeled statement, and continue can be used with looping labeled statements. ...
...ocks are very uncommon. usually function calls can be used instead of loop jumps. syntax label : statement label any javascript identifier that is not a reserved word. statement a javascript statement. break can be used with any labeled statement, and continue can be used with looping labeled statements. description you can use a label to identify a loop, and then use the break or continue statements to indicate whether a program should interrupt the loop or continue its execution. ...
...ent a javascript statement. break can be used with any labeled statement, and continue can be used with looping labeled statements. description you can use a label to identify a loop, and then use the break or continue statements to indicate whether a program should interrupt the loop or continue its execution. note that javascript has no goto statement, you can only use labels with break or continue. in strict mode code, you can't use "let" as a label name. it will throw a syntaxerror (let is a reserved identifier). ...
...And 5 more matches
Storage access policy: Block cookies from trackers
policy does not currently restrict third-party storage access for resources that are not classified as tracking resources. we may choose to apply additional restrictions to third-party storage access in the future. the restrictions applied by the policy will not prevent third-party scripts classified as tracking resources from accessing storage in the main context of the page. these scripts can continue to use storage scoped to the top-level origin. origins classified as trackers will have access to their own storage when they are loaded in a first-party context. cross-origin resources loaded from the same etld+1 as the top-level context will still have access to their storage. origins normally classified as trackers will not be blocked if the top-level page origin is determined to be from th...
...es switch to using the storage access api in order to guarantee their access to storage. automatic storage access upon interaction in order to improve web compatibility, firefox currently includes some heuristics to grant storage access automatically to third parties that receive user interaction. these heuristics are intended to allow some third-party integrations that are common on the web to continue to function. they are intended to be temporary and will be removed in a future version of firefox. they should not be relied upon for current and future web development. third-party storage access may be granted to resources that have been classified as tracking resources when a user gesture triggers a pop-up window that has opener access to the originating document. when that occurs, there are ...
...up window following a redirect, the origin of the content loaded in the pop-up window is given storage access on the opener document. when there is a top-level redirect from a tracking origin to a non-tracking origin, the tracking origin receives short-lived storage access on the non-tracking origin and any other non-tracking origins that appear further down the redirect chain (i.e., if the load continues to redirect). the tracking origin must have received user interaction as a first party within the past 30 days, and the storage access permission expires after 15 minutes. scope of storage access when storage access is granted, it is scoped to the origin of the opener document or subdomains of that origin. access that is granted on the subdomain of an origin does not extend to the top-level o...
...And 4 more matches
Anatomy of a video game - Game development
b is closed or refreshed. for the first issue, if you want the main loop to just run and you do not need easy (direct) access to it, you could create it as an immediately-invoked function expression (iife). /* * starting with the semicolon is in case whatever line of code above this example * relied on automatic semicolon insertion (asi). the browser could accidentally * think this whole example continues from the previous line. the leading semicolon * marks the beginning of our new line if the previous one was not empty or terminated. */ ;(function () { function main() { window.requestanimationframe( main ); // your main loop contents } main(); // start the cycle })(); when the browser comes across this iife, it will define your main loop and immediately queue it for the next f...
...imationframe() when it was last called. let us assume that your game's functions and variables are built on a namespace that you called mygame. expanding our last example, the main loop would now look like: /* * starting with the semicolon is in case whatever line of code above this example * relied on automatic semicolon insertion (asi). the browser could accidentally * think this whole example continues from the previous line. the leading semicolon * marks 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...
...because this is common, window.requestanimationframe() always provides a domhighrestimestamp to callbacks as an argument when they are executed. this leads to another enhancement to our previous main loops. /* * starting with the semicolon is in case whatever line of code above this example * relied on automatic semicolon insertion (asi). the browser could accidentally * think this whole example continues from the previous line. the leading semicolon * marks 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( tframe ) { mygame.stopmain = window.requestanimationframe( main ); // your main loop contents // tframe, from "function main ( tframe )", is now a domhighres...
...And 3 more matches
Utilities for nss samples
n = strlen((const char *)instring); int outlen = len+1/2; int truelen = 0; int digit1, digit2; outbuf->data = ishexdata ? ...
...igit2 = getdigit(*instring++); if ((digit1 == -1) || (digit2 == -1)) { port_free(outbuf->data); outbuf->data = null; return -1; } outbuf->data[truelen++] = digit1 << 4 | digit2; } } else { while (*instring) { if (*instring == '\n') { instring++; continue; } outbuf->data[truelen++] = *instring++; } outbuf->data[truelen] = '\0'; truelen = truelen-1; } outbuf->len = truelen; return 0; } /* * filetoitem */ secstatus filetoitem(secitem *dst, prfiledesc *src) { prfileinfo info; print32 numbytes; prstatus prstatus; prstatus = pr_getopenfileinfo(src, &info); if (prstatus...
... * * this function supports password extraction from files with * multipe passwords, one for ...
...And 3 more matches
Bytecode Descriptions
tions that begin executing with iter on the stack, starting with the next instruction (always jsop::loophead). code must not jump into or out of this region: control can enter only by executing jsop::iter and 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 ...
...n ⇒ resolved, gen, resumekind suspend the current frame for an await expression. this instruction must appear only in scripts for async functions and async generators. gen must be the internal generator object for the current frame. this returns promise to the caller. later, when this async call is resumed, resolved, gen and resumekind receive the values passed in by jsop::resume, and execution continues at the next instruction, which must be afteryield. this instruction is used in two subtly different ways. in async functions: ... # valuetoawait getaliasedvar ".generator" # valuetoawait gen asyncawait # resultpromise getaliasedvar ".generator" # resultpromise gen await # resolved gen resumekind afteryield asyncawait arrang...
...'false'. resumekind operands: (generatorresumekind resumekind (encoded as uint8_t)) stack: ⇒ resumekind pushes one of the generatorresumekind values as int32value. checkresumekind stack: rval, gen, resumekind ⇒ rval handle throw and return resumption. gen must be the generator object for the current frame. resumekind must be a generatorresumekind stored as an int32 value. if it is next, continue to the next instruction. if resumekind is throw or return, these completions are handled by throwing an exception. see generatorthroworreturn. resume stack: gen, val, resumekind ⇒ rval resume execution of a generator, async function, or async generator. this behaves something like a call instruction. it pushes a stack frame (the one saved when gen was suspended, rather than a fresh one) and ...
...And 3 more matches
Debugger - Firefox Developer Tools
akpoint handler, or similar function throws some exception, which we refer to asdebugger-exception here. exceptions thrown in the debugger are not propagated to debuggee code; instead, spidermonkey calls this function, passingdebugger-exception as its sole argument and the debugger instance as the this value. this function should return a resumption value, which determines how the debuggee should continue. if the uncaught exception hook itself throws an exception,uncaught-hook-exception, spidermonkey throws a new error object,confess-to-debuggee-exception, to the debuggee whose message blames the debugger, and includes textual descriptions ofuncaught-hook-exception and the originaldebugger-exception. if uncaughtexceptionhook’s value is null, spidermonkey throws an exception to the debuggee w...
...e promise, has been allocated in the scope of the debuggees. the promise’s allocation stack can be obtained using the promiseallocationstack accessor property of the debugger.object instance promise. this handler method should return a resumption value specifying how the debuggee’s execution should proceed. however, note that a { return:value } resumption value is treated like undefined (“continue normally”);value is ignored. onpromisesettled(promise) a promise object, referenced by the debugger.object instance promise that was allocated within a debuggee scope, has settled (either fulfilled or rejected). the promise’s state, fulfillment or rejection value, and the allocation and resolution stacks can be obtained using the promise-related accessor properties of the debugger.objec...
...). the promise’s state, fulfillment or rejection value, and the allocation and resolution stacks can be obtained using the promise-related accessor properties of the debugger.object instance promise. this handler method should return a resumption value specifying how the debuggee’s execution should proceed. however, note that a { return:value } resumption value is treated like undefined (“continue normally”);value is ignored. ondebuggerstatement(frame) debuggee code has executed adebugger statement inframe. this method should return a resumption value specifying how the debuggee’s execution should proceed. onenterframe(frame) the stack frameframe is about to begin executing code. (naturally,frame is currently the youngest visible frame.) this method should return a resumption v...
...And 3 more matches
Index - Archive of obsolete content
from within a firefox extension, you can make use of liveconnect. liveconnect gives your extension's javascript code (linked from or contained in xul code) access to 2 objects: java and packages (note that per this thread, although the new documentation for the liveconnect reimplementation states that these globals will be deprecated (in the context of applets), "firefox and the java plug-in will continue to support the global java/packages keywords, in particular in the context of firefox extensions."). these 2 objects let you make use of the standard jdk classes, e.g., 492 javascript os.shared module os.shared contains tools to interact with the operating system (and, more generally, in c) in javascript. all these tools are designed to be used with js-ctypes. 493 ...
...libraries. if you don't allow those libraries to be loaded then gdb will not be able to properly debug threads on linux. mozilla uses pthreads for its networking library so you need to be able to work in a threaded environment. the best way to do this is to set a breakpoint in main, let the program run until main and then turn off automatic library loading. from there you can allow the program to continue running. here's an example: 684 venkman extensions, extensions:tools, javascript, javascript:tools, tools, venkman, web development, web development:tools venkman is the code name for mozilla's javascript debugger. it aims to provide a powerful javascript debugging environment for mozilla based browsers namely firefox, netscape 7.x/9.x and seamonkey. note that it is not inclu...
...nment for mozilla based browsers namely firefox, netscape 7.x/9.x and seamonkey. note that it is not included in the gecko-based browsers such as k-meleon, galeon and netscape 8.x. venkman has been provided as part of the mozilla install distribution since october 2001, as well as an extension package in xpi format. 685 using breakpoints in venkman tools, venkman this article continues a series of articles on venkman that began with venkman introduction. 686 venkman internals developing mozilla, tools, venkman start with venkman information. 687 venkman introduction tools, venkman a powerful new tool is available for web developers for use in many mozilla-based products, including firefox, mozilla suite and netscape 7.x. the javascript...
...And 2 more matches
Extra lives - Game development
« previousnext » this is the 13th step out of 16 of the gamedev phaser tutorial. you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson13.html. we can make the game enjoyable for longer by adding lives. in this article we'll implement a lives system, so that the player can continue playing until they have lost three lives, not just one. new variables add the following new variables below the existing ones in your code: var lives = 3; var livestext; var lifelosttext; these respectively will store the number of lives, the text label that displays the number of lives that remain, and a text label that will be shown on screen when the player loses one of their lives. defining the new text labels defining the ...
...efining the texts look like something we already did in the score lesson. add the following lines below the existing scoretext definition inside your create() function: livestext = game.add.text(game.world.width-5, 5, 'lives: '+lives, { font: '18px arial', fill: '#0095dd' }); livestext.anchor.set(1,0); lifelosttext = game.add.text(game.world.width*0.5, game.world.height*0.5, 'life lost, click to continue', { font: '18px arial', fill: '#0095dd' }); lifelosttext.anchor.set(0.5); lifelosttext.visible = false; the livestext and lifelosttext objects look very similar to the scoretext one — they define a position on the screen, the actual text to display, and the font styling. the former is anchored on its top right edge to align properly with the screen, and the latter is centered, both using anch...
... the lives handling code to implement lives in our game, let's first change the ball's function bound to the onoutofbounds event. instead of executing an anonymous function and showing the alert right away : ball.events.onoutofb...
...And 2 more matches
Looping code - Learn web development
f a farmer that is making sure he has enough food to feed his family for the week. he might use the following loop to achieve this: a loop usually has one or more of the following features: a counter, which is initialized with a certain value — this is the starting point of the loop ("start: i have no food", above). a condition, which is a true/false test to determine whether the loop continues to run, or stops — usually when the counter reaches a certain value. this is illustrated by "have i got enough food?", above. let's say he needs 10 portions of food to feed his family. an iterator, which generally increments the counter by a small amount on each successive loop, until the condition is no longer true. we haven't explicitly illustrated this above, but we could think about the f...
...ther splitcontact[0] (the contact's name, again lower-cased with tolowercase()) is equal to the inputted searchname. if it is, we enter a string into the paragraph to report what the contact's number is, and use break to end the loop. after (contacts.length-1) iterations, if the contact name does not match the entered search the paragraph text is set to "contact not found.", and the loop continues looping until the condition is no longer true. note: you can view the full source code on github too (also see it running live). skipping iterations with continue the continue statement works in a similar manner to break, but instead of breaking out of the loop entirely, it skips to the next iteration of the loop. let's look at another example that takes a number as an input, and returns...
...nput, and returns only the numbers that are squares of integers (whole numbers). the html is basically the same as the last example — a simple text input, and a paragraph for output. ...
...And 2 more matches
Index
otes the nss team has released network security services (nss) 3.56 on 21 august 2020, which is a minor release. 159 nss api guidelines newsgroup: mozilla.dev.tech.crypto 160 nss certverify log nss all the nss verify functions except, the *verifynow() functions, take a parameter called 'certverifylog'. if you supply the log parameter, nss will continue chain validation after each error . the log tells you what the problem was with the chain and what certificate in the chain failed. 161 nss certificate download specification nss this document describes the data formats used by nss 3.x for installing certificates. this document is currently being revised and has not yet been reviewed for accuracy. 162 nss code cove...
... command-line utility that can list, generate, modify, or delete crls within the nss security database file(s) and list, create, modify or delete certificates entries in a particular crl. the key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database(see certutil tool) and continues with certificates expiration or revocation. this document discusses certificate revocation list management. for information on security module database management, see using the security module database tool. for information on certificate and key database management, see using the certificate database tool. to run the certificate revocation list management tool, type the com...
...corp.by ref . liability ltd.(c)97 verisign, ou=verisign object signing ca - class 3 organization, ou="verisign, inc.", o=verisign trust network **issuer name**, ou=www.verisign.com/cps incorp.by ref. liability ltd.(c)97 verisign, ou=verisign object signing ca - class 3 organization, ou="verisign, inc.", o=verisign trust network ---------------------------------------------- do you wish to continue this installation? (y/n) y using installer script "installer_script" successfully parsed installation script current platform is linux:5.4.08:x86 using installation parameters for platform linux:5.4.08:x86 installed file crypto.so to /tmp/crypto.so installed file setup.sh to ./pk11inst.dir/setup.sh executing "./pk11inst.dir/setup.sh"... "./pk11inst.dir/setup.sh" executed successfully ins...
...And 2 more matches
NSS Sample Code Utilities_1
) { int len = strlen(instring); int outlen = len+1/2; int truelen = 0; int digit1, digit2; outbuf->data = ishexdata ? ...
...igit2 = getdigit(*instring++); if ((digit1 == -1) || (digit2 == -1)) { port_free(outbuf->data); outbuf->data = null; return -1; } outbuf->data[truelen++] = digit1 << 4 | digit2; } } else { while (*instring) { if (*instring == '\n') { instring++; continue; } outbuf->data[truelen++] = *instring++; } outbuf->data[truelen] = '\0'; truelen = truelen-1; } outbuf->len = truelen; return 0; } /* * filetoitem */ secstatus filetoitem(secitem *dst, prfiledesc *src) { prfileinfo info; print32 numbytes; prstatus prstatus; prstatus = pr_getopenfileinfo(src, &info); if (prstatus...
... * * this function supports password extraction from files with * multiple passwords, one fo...
...And 2 more matches
Hacking Tips
itstart function. optionally, a condition on the ins->id() of the lir instruction can be added to select precisely the instruction you are looking for. once the breakpoint is on codegenerator function of the lir instruction, add a command to generate a static breakpoint in the generated code. $ gdb --args js […] (gdb) b js::ion::codegenerator::visitstart (gdb) command >call masm.breakpoint() >continue >end (gdb) r js> function f(a, b) { return a + b; } js> for (var i = 0; i < 100000; i++) f(i, i + 1); breakpoint 1, js::ion::codegenerator::visitstart (this=0x101ed20, lir=0x10234e0) at /home/nicolas/mozilla/ionmonkey/js/src/ion/codegenerator.cpp:609 609 } program received signal sigtrap, trace/breakpoint trap. 0x00007ffff7fb165a in ?? () (gdb) once you hit the generated breakpoint,...
...cestart_, iter.script()->sourceend_ dprintf 2 at 0x7fb4f6fe43dc: js::jit::bailoutiontobaseline. (2 locations) (gdb) dprintf ion.cpp:3196, "invalidate %s:%d:%d-%d\n", co->script_->scriptsource()->filename_.mtuple.mfirsta, co->script_->lineno_, co->script_->sourcestart_, co->script_->sourceend_ dprintf 3 at 0x7fb4f6a0b62a: file /home/nicolas/mozilla/contrib-push/js/src/jit/ion.cpp, line 3196. (gdb) continue compiling self-hosted:650:20470-21501 bailout from self-hosted:20:403-500 invalidate self-hosted:20:403-500 note: the line 3196, listed above, corresponds to the location of the jit spew inside jit::invalidate function. hacking tips benchmarking (shell) arewefastyet.com display the benchmark results of the javascript shell, and browser for b2g. these benchmarks are publicly recognized bench...
...(char*)<address of previous command> (note: if you set a watch on the previous expression gdb will watch the expression and run out of watchpoint) rr with emacs within emacs, do m-x gud-gdb and replace the command line with rr replay. when gdb comes up, enter set annot 1 to get it to emit file location information so that emacs will pop up the corresponding source. note that if you reverse-continue over a sigsegv and you're using the standard .gdbinit that sets a catchpoint for that signal, you'll get an additional stop at the catchpoint. just reverse-continue again to continue to your breakpoints or whatever. [hack] replacing one instruction to replace one specific instruction, you can use in visit function of each instruction the jsscript filename in lineno fields as well as the id() of...
...And 2 more matches
Element.classList - Web APIs
Web › API › Element › classList
prototype.tolocalestring = function(){return this.value}; domtokenlist.prototype.add = function(){ a: for(var v=0, arglen=arguments.length,val="",ele=this[" ucl"],proto=ele[" uclp"]; v!==arglen; ++v) { val = arguments[v] + "", checkifvalidclasslistentry("add", val); for (var i=0, len=proto.length, resstr=val; i !== len; ++i) if (this[i] === val) continue a; else resstr += " " + this[i]; this[len] = val, proto.length += 1, proto.value = resstr; } skippropchange = 1, ele.classname = proto.value, skippropchange = 0; }; domtokenlist.prototype.remove = function(){ for (var v=0, arglen=arguments.length,val="",ele=this[" ucl"],proto=ele[" uclp"]; v !== arglen; ++v) { val = arguments[v] + "", checki...
...){ for (var v=0, arglen=arguments.length,val="",ele=this[" ucl"],proto=ele[" uclp"]; v !== arglen; ++v) { val = arguments[v] + "", checkifvalidclasslistentry("remove", val); for (var i=0, len=proto.length, resstr="", is=0; i !== len; ++i) if(is){ this[i-1]=this[i] }else{ if(this[i] !== val){ resstr+=this[i]+" "; }else{ is=1; } } if (!is) continue; delete this[len], proto.length -= 1, proto.value = resstr; } skippropchange = 1, ele.classname = proto.value, skippropchange = 0; }; window.domtokenlist = domtokenlist; function whenpropchanges(){ var evt = window.event, prop = evt.propertyname; if ( !skippropchange && (prop==="classname" || (prop==="classlist" && !defineproperty)) ) { ...
...et[" uclp"], strval = "" + target[prop]; var tokens=strval.trim().split(wsre), restokenlist=target[prop==="classlist"?" ucl":"classlist"]; var oldlen = protoobjproto.length; a: for(var ci = 0, clen = protoobjproto.length = tokens.length, sub = 0; ci !== clen; ++ci){ for(var inneri=0; inneri!==ci; ++inneri) if(tokens[inneri]===tokens[ci]) {sub++; continue a;} restokenlist[ci-sub] = tokens[ci]; } for (var i=clen-sub; i < oldlen; ++i) delete restokenlist[i]; //remove trailing indexs if(prop !== "classlist") return; skippropchange = 1, target.classlist = restokenlist, target.classname = strval; skippropchange = 0, restokenlist.length = tokens.length - sub; } } ...
...And 2 more matches
switch - JavaScript
hat clause, executing the associated statements. (if multiple cases match the provided value, the first case that matches is selected, even if the cases are not equal to each other.) if no matching case clause is found, the program looks for the optional default clause, and if found, transfers control to that clause, executing the associated statements. ...
...l to that clause, executing the associated statements. if no default clause is found, the program continues execution at the statement following the end of switch. by convention, the default clause is the last clause, but it does not need to be so. the optional break statement associated with each case label ensures that the program breaks out of switch once the matched statement is executed and continues execution at the statement following switch. if break is omitted, the program continues execution at the next statement in the switch statement. examples using switch in the following example, if expr evaluates to bananas, the program matches the value with case case 'bananas' and executes the associated statement. when break is encountered, the program breaks out of switch and executes the s...
...ion was met. ...
...And 2 more matches
Using Breakpoints in Venkman - Archive of obsolete content
one of the basic tasks of debugging any language is setting breakpoints. breakpoints are places in code where execution is suspended. when you set a breakpoint in a debugging application such as venkman, you can take advantage of the suspension to examine variables, objects, and other featues of the execution. this article describes breakpoints in javascript and how to use venkman to set and examine breakpoints. basic breakpoints the stop button and debugger keyword are useful features of the javascript debugger, but when you are debugging deep in code—especially code you have authored yourself and are responsible for troubleshooting—you're going to need breakpoints. ...
...nt properties dialog, which you can access by right-clicking a breakpoint and selecting properties. once you've created a script that will be executed when the associated breakpoint is hit, you can select a number of different options from the future breakpoint properties dialog that determine how venkman will deal with the output of the associated script. the following options are available: continue regardless of result causes venkman to continue normal execution after running the breakpoint script. this can be useful to try out additional code, on the fly. stop regardless of result causes venkman to stop execution after executing the breakpoint script, allowing you to inspect program state. stop if result is true effectively makes this a conditional breakpoint. if the breakpoint script ...
...gardless of result causes venkman to stop execution after executing the breakpoint script, allowing you to inspect program state. stop if result is true effectively makes this a conditional breakpoint. if the breakpoint script returns a true value (it doesn't have to strictly be a boolean true, any non-null, non-empty string, non-zero, non-undefined, and non-false value will do), execution will continue normally. if, on the other hand, the script returns a false value, venkman will stop execution at that point. early return from caller with result will cause the function that the breakpoint is set in to return the value of the breakpoint script as its result, immediatley after the breakpoint script completes. the pass exceptions to caller checkbox allows you to pass exceptions thrown by the ...
...xception, venkman assumes you made a mistake and stops execution after displaying the exception. if you would like to see what your code does when exceptions are thrown at it, check "pass exceptions to caller", and thrown an exception from the breakpoint script. the log result checkbox tells venkman you want the result of the script to show up in the interactive session view. when used with the continue regardless of result option, the breakpoint can be used as a simple log message. the number of times the breakpoint has been hit is passed in as a parameter to the breakpoint script. to reset the count, enter a 0 in the "trigger count" field. meta comments you can also embed scripted breakpoints directly into the source code you are debugging by using a venkman facility called meta comments. m...
Browser Detection and Cross Browser Support - Archive of obsolete content
hich provide compatibility with internet explorer 5 and 6. unlike other browsers, gecko is truly cross platform and provides consistent behavior across all supported operating systems. the easiest way to support gecko is to create content which follows web standards. unfortunately, no other browser supports web standards as completely as gecko. this means web developers and authors are forced to continue to support other browsers which do not comply with the standards as fully. fortunately, other browsers such as opera (versions 7 & later) and to a lesser extent, internet explorer (versions 5.5 & later) also support the standards to a degree. these other browsers appear to be moving towards more complete support for the standards and there is hope that in the future web developers and authors wil...
...mpatible with a particular netscape version. since other browsers pretended to be netscape browsers and encoded their version information in a non-standard fashion in the user agent comment area, the task of determining which browser was being used became more complicated than it should have been. netscape navigator 2 introduced the ability to run javascript in web browsers. as browser evolution continued, differences in the implementation of scripting and the objects supported by browsers appeared. web authors were no longer limited to detecting browsers on their web servers, but could now execute scripts client side (in the browser itself) which could be used to distinguish browsers. one of the earliest approaches to client side browser detection involved testing whether the browser supported p...
...xecute scripts client side (in the browser itself) which could be used to distinguish browsers. one of the earliest approaches to client side browser detection involved testing whether the browser supported particular objects. an example of this approach involved testing for the existence of the document.images object. while object based detection was used in some circumstances, many web authors continued to use the vendor/version approach to distinguishing web browsers in their client side scripts. since the user agent string was exposed as a property of the navigator object (e.g. navigator.useragent), many web authors used the same logic in their client side scripts as they had used earlier in their server side browser detection. in addition to navigator.useragent other properties such as appna...
...s such as netscape navigator 4. you may say to yourself "if only all browsers were as good as gecko and internet explorer 6, then my job would be so much easier!". i would like to leave you with this thought. in the past, users did not have the choice of picking a browser which implemented the standards however today they do have a choice. there is no compelling reason for anyone in the world to continue to use a browser which does not support the standards. however, as long as web developers continue to code work arounds for these older browsers, users will not have a compelling reason to upgrade. by ceasing to support older browsers, you can provide a reason for users to upgrade. this will benefit not only them, but yourself as well. supporting only standards based browsers can reduce developme...
Key Values - Web APIs
y_dead_small_schwa (0xfe8a) ə gdk_key_dead_capital_schwa (0xfe8b) Ə gdk_key_dead_greek (0xfe8c) function keys while various platforms support different numbers of the general-purpose function keys, such as f1–f12 (or f1–f10, or f1–f15, etc.), the first few are specifically defined as follows. if more function keys are available, their names continue the pattern here by continuing to increment the numeric portion of each key's name, so that, for example, "f24" is a valid key value. keyboardevent.key value description virtual keycode windows mac linux android "f1" the first general-purpose function key, f1. vk_f1 (0x70) kvk_f1 (0x7a) gdk_key_f1 (0xffbe) gdk_key_kp_f1 (0xff91) qt::k...
... windows mac linux android "channeldown" switches to the previous channel. appcommand_media_channel_down qt::key_channeldown (0x01000119) keycode_channel_down (167) "channelup" switches to the next channel. appcommand_media_channel_up qt::key_channelup (0x01000118) keycode_channel_up (166) "mediafastforward" [2] starts, continues, or increases the speed of fast forwarding the media. appcommand_media_fast_forward gdk_key_audioforward (0x1008ff97) qt:key_audioforward (0x01000102) keycode_media_fast_forward (90) "mediapause" pauses the currently playing media. note: some older applications use simply "pause", but this is not correct. appcommand_media_pause gdk_k...
...f97) qt:key_audioforward (0x01000102) keycode_media_fast_forward (90) "mediapause" pauses the currently playing media. note: some older applications use simply "pause", but this is not correct. appcommand_media_pause gdk_key_audiopause (0x1008ff31) qt::key_mediapause (0x1000085) keycode_media_pause (127) "mediaplay" starts or continues playing media at normal speed, if not already doing so. has no effect otherwise. appcommand_media_play gdk_key_audioplay (0x1008ff14) keycode_media_play (126) "mediaplaypause" toggles between playing and pausing the current media. vk_media_play_pause (0xb3) appcommand_media_play_pause qt::key_mediatoggleplaypause (0x1000086) keycode_media_play_pause (85)...
... pausing the current media. vk_media_play_pause (0xb3) appcommand_media_play_pause qt::key_mediatoggleplaypause (0x1000086) keycode_media_play_pause (85) "mediarecord" starts or resumes recording media. appcommand_media_record gdk_key_audiorecord (0x1008ff1c) qt::key_mediarecord (0x01000084) keycode_media_record (130) "mediarewind" starts, continues, or increases the speed of rewinding the media. appcommand_media_rewind gdk_key_audiorewind (0x1008ff3e) qt::key_audiorewind (0x010000c5) keycode_media_rewind (89) "mediastop" stops the current media activity (such as playing, recording, pausing, forwarding, or rewinding). has no effect if the media is currently stopped already. vk_media_stop (0xb2) appcommand...
KeyboardEvent.key - Web APIs
Web › API › KeyboardEvent › key
if the key cannot be identified, the returned value is unidentified. keyboardevent sequence every keyboardevent is fired in a pre-determined sequence. for a given key press, the sequence of keyboardevents fired is as follows assuming that event.preventdefault is not called: a keydown event is first fired. if the key is held down further and the key produces a character key, then the event continues to be emitted in a platform implementation dependent interval and the keyboardevent.repeat read only property is set to true. if the key produces a character key that would result in a character being inserted into possibly an <input>, <textarea> or an element with htmlelement.contenteditable set to true, the beforeinput and input event types are fired in that order. note that some other implem...
...irstchild; } }); result note: on browsers that don't fully implement the inputevent interface which is used for the beforeinput and input events, you may get incorrect output on those lines of the log output. case 1 when the shift key is pressed, a keydown event is first fired, and the key property value is set to the string shift. as we keep holding this key, the keydown event does not continue to fire repeatedly because it does not produce a character key. when key 2 is pressed, another keydown event is fired for this new key press, and the key property value for the event is set to the string @ for the u.s keyboard type and " for the uk keyboard type, because of the active modifier shift key. the beforeinput and input events are fired next because a character key has been produced. ...
...operty will maintain the string values @ and " for the different keyboard layouts respectively. as we finally release the shift key, another keyup event is fired for it, and the key attribute value remains shift. case 2 when the shift key is pressed, a keydown event is first fired, and the key property value is set to be the string shift. as we keep holding this key, the keydown event does not continue to fire repeatedly because it produced no character key. when key 2 is pressed, another keydown event is fired for this new key press, and the key property value for the event is set to be the string @ for the u.s keyboard type and " for the uk keyboard type, because of the active modifier shift key. the beforeinput and inputbeforeinput and input events are fired next because a character key has...
...n key 2 is pressed, another keydown event is fired for this new key press, and the key property value for the event is set to be the string @ for the u.s keyboard type and " for the uk keyboard type, because of the active modifier shift key. the beforeinput and inputbeforeinput and input events are fired next because a character key has been produced. as we keep holding the key, the keydown event continues to fire repeatedly and the keyboardevent.repeat property is set to true. the beforeinput and input events are fired repeatedly as well. as we release the shift key, a keyup event is fired for it, and the key attribute value remains shift. at this point, notice that the key property value for the repeating keydown event of the key 2 key press is now "2" because the modifier shift key is no longe...
Pointer Lock API - Web APIs
ts, and change entries, for example allowing users to control the viewing angle simply by moving the mouse around without any button clicking. the buttons are then freed up for other actions. other examples include apps for viewing maps or satellite imagery. pointer lock lets you access mouse events even when the cursor goes past the boundary of the browser or screen. for example, your users can continue to rotate or manipulate a 3d model by moving the mouse without end. without pointer lock, the rotation or manipulation stops the moment the pointer reaches the edge of the browser or screen. game players can now click buttons and swipe the mouse cursor back and forth without worrying about leaving the game play area and accidentally clicking another application that would take mouse focus away fr...
...rotation or manipulation stops the moment the pointer reaches the edge of the browser or screen. game players can now click buttons and swipe the mouse cursor back and forth without worrying about leaving the game play area and accidentally clicking another application that would take mouse focus away from the game. basic concepts pointer lock is related to mouse capture. ...
... it hides the cursor. method/properties overview this section provides a brief description of each property and method related to the pointer lock specification. requestpointerlock() the pointer lock api, similar to the fullscreen api, extends dom elements by adding a new method, requestpointerlock(). ...
...perties, screenx and screeny, which are stored in two subsequent mousemove events, enow and eprevious. in other words, the pointer lock parameter movementx = enow.screenx - eprevious.screenx. locked state when pointer lock is enabled, the standard mouseevent properties clientx, clienty, screenx, and screeny are held constant, as if the mouse is not moving. the movementx and movementy properties continue to provide the mouse's change in position. there is no limit to movementx and movementy values if the mouse is continuously moving in a single direction. the concept of the mouse cursor does not exist and the cursor cannot move off the window or be clamped by a screen edge. unlocked state the parameters movementx and movementy are valid regardless of the mouse lock state, and are available even...
core/promise - Archive of obsolete content
asynchronous complementing its non-blocking nature. while this has a good reason and many advantages, it comes with a price. ...
...(a); return combine(b, c); } we're forced into continuation passing style, involving lots of machinery: function sphagetti(a, b, callback) { assemble(a, function continuewith(error, c) { if (error) callback(error); else combine(b, c, callback); }); } this style also makes doing things in sequence hard: widget.on('click', function onclick() { promptuserfortwitterhandle(function continuewith(error, handle) { if (error) return ui.displayerror(error); twitter.gettweetsfor(handle, funtion continuewith(error, tweets) { if (error) return ui.displayerror(error); ui.showtweets(tweets); }); }); }); doing things in parallel is even harder: var tweets, answers, checkins; twitter.gettweetsfor(user, function continuewith(result) { tweets = result; somethingfin...
...rror); twitter.gettweetsfor(handle, funtion continuewith(error, tweets) { if (error) return ui.displayerror(error); ui.showtweets(tweets); }); }); }); doing things in parallel is even harder: var tweets, answers, checkins; twitter.gettweetsfor(user, function continuewith(result) { tweets = result; somethingfinished(); }); stackoverflow.getanswersfor(question, function continuewith(result) { answers = result; somethingfinished(); }); foursquare.getcheckinsby(user, function continuewith(result) { checkins=result; somethingfinished(); }); var finished = 0; function somethingfinished() { if (++finished === 3) ui.show(tweets, answers, checkins); } this also makes error handling quite an adventure. promises consider another approach, instead of continuatio...
JavaScript Daemons Management - Archive of obsolete content
function () { return this.isatend() !== this.backw; }; daemon.prototype.getposition = function () { return this.index; }; /* instantaneous movement (synchronous). ...
...n this.index; }; /* instantaneous movement (synchronous). ...
... if (isnan(nhowmany)) { return false; } var nidx = 0, nlen = math.round(math.abs(nhowmany)), bcontinue = true, bbackw = nhowmany > 0 === boolean(breverse); this.backw = bbackw; for (nidx; nidx < nlen && bcontinue; nidx++) { if (this.backw === bbackw && this.isatend()) { if (this.reversals > 0) { this.backw = bbackw = !this.backw; } else { break; } } bcontinue = daemon.forcecall(this) || bforce; } return nidx === nlen; }; daemon.prototype.skipto = function (nidx, bforce) { /* warning: this method requires the daemon.prototype.makesteps() method */ if (nidx === this.index) { return; } if (isfinite(this.length) && nidx < 0 || nidx > this.length) { return; } var bdirection = (this.index !== 0 && this.index !== this.leng...
CSS basics - Learn web development
mewhere inside your index.html's head (anywhere between the <head> and </head> tags). it looks something like this: <link href="https://fonts.googleapis.com/css?family=open+sans" rel="stylesheet"> this code links your page to a style sheet that loads the open sans font family with your webpage. next, delete the existing rule you have in your style.css file. it was a good test, but let's not continue with lots of red text. add the following lines (shown below), replacing the font-family assignment with your font-family selection from what will your website look like?. the property font-family refers to the font(s) you want to use for text. this rule defines a global base font and font size for the whole page. since <html> is the parent element of the whole page, all elements inside it inheri...
...ide the padding. margin, the space around the outside of the border. in this section we also use: width (of an element). background-color, the color behind an element's content and padding. color, the color of an element's content (usually text). text-shadow sets a drop shadow on the text inside an element. display sets the display mode of an element. (keep reading to learn more) to continue, let's add more css. keep adding these new rules at the bottom of style.css. experiment with changing values to see what happens. changing the page color html { background-color: #00539f; } this rule sets a background color for the entire page. change the color code to the color you chose in what will my website look like?. styling the body body { width: 600px; margin: 0 auto; backgr...
...illing into the rest of the page. to fix this, you can either: 1) reduce the image width using a graphics editor, or 2) use css to size the image by setting the width property on the <img> element with a smaller value. note: don't be too concerned if you don't completely understand display: block; or the differences between a block element and an inline element. it will make more sense as you continue your study of css. you can find more information about different display values on mdn's display reference page. conclusion if you followed all the instructions in this article, you should have a page that looks similar to this one: (you can view our version here.) if you get stuck, you can always compare your work with our finished example code on github. in this exercise, we have just sc...
Index - Learn web development
least this will save you a few hours of sleep and allow you to progress a bit faster when things don't turn out right, especially in the earlier stages of your learning journey. 89 javascript building blocks article, assessment, beginner, codingscripting, conditionals, functions, guide, introduction, javascript, landing, loops, module, events, l10n:priority in this module, we continue our coverage of all javascript's key fundamental features, turning our attention to commonly-encountered types of code blocks such as conditional statements, loops, functions, and events. you've seen this stuff already in the course, but only in passing — here we'll discuss it all explicitly. 90 build your own function article, beginner, codingscripting, functions, guide, javascr...
...cts a button on a webpage, you might want to respond to that action by displaying an information box. in this article, we discuss some important concepts surrounding events, and look at how they work in browsers. this won't be an exhaustive study; just what you need to know at this stage. 95 looping code article, beginner, codingscripting, do, guide, javascript, learn, loop, break, continue, for, l10n:priority, while programming languages are very useful for rapidly completing repetitive tasks, from multiple basic calculations to just about any other situation where you've got a lot of similar items of work to complete. here we'll look at the loop structures available in javascript that handle such needs. 96 making decisions in your code — conditionals article...
...eployment and next steps beginner, deployment, frameworks, javascript, learn, svelte, client-side, resources in the previous article we learning about svelte's typescript support, and how to use it to make your application more robust. in this final article we will look at how to deploy your application and get it online, and also share some of the resources that you should go on to, to continue your svelte learning journey. 278 dynamic behavior in svelte: working with variables and props beginner, frameworks, javascript, learn, svelte, variables, client-side, props that will do for now! in this article we already implemented most of our desired functionality. our app can display, add, and delete todos, toggle their completed status, show how many of them are complet...
HTML parser threading
. the reflush causes a call to nshtml5parser::parseuntilblocked(). parseuntilblocked() parses data left by document.write() in the linked list of buffers, because the parser was blocked. this might cause more script execution tree ops to be generated and executed and document.write() to be called more times. when parseuntilblocked() exhausts the data available to it, it calls nshtml5streamparser::continueafterscripts to resume the consumption of data from the network. continuing to use network-originating data after scripts nshtml5streamparser::continueafterscripts runs on the main thread. it acquires mspeculationmutex in order to be able to touch the queue of speculations. the mutex acquisition only blocks if the parser thread happens to be setting up a new speculation object at the same moment. ...
...on matches the state of the document.write() tree builder, the speculation has succeeded. otherwise it has failed. if there is more than one speculation in the queue and if the speculation is successful, we can dequeue the first speculation while holding mspeculationmutex without bothering the parser thread. in this case, the tree ops from the speculation are flushed into the tree op executor and continueafterscripts() returns early. (nshtml5treeopexecutor::runflushloop is on the call stack already in this case and will loop around to start flushing the ops right away.) if there's only one speculation or the speculation failed, it's necessary to bother the parser thread. in that case, the main thread raises an interruption flag on the nshtml5streamparser object to make the parser thread release mt...
...rame), base or img or svg script, style or image elements, preload operations are appended to a speculative load queue. there speculative load operations are flushed to the main thread (via the staging area) whenever tree ops are flushed and also whenever nshtml5streamparser::parseavailabledata() is about to stop working. that is, when the parser thread is parsing speculatively, speculative loads continue to be flushed to the main thread even though tree ops accumulate into the speculations. on the main thread, the speculative tokenizer/tree builder pair used for parsing document.write() input that didn't get parsed by the main document.write() tokenizer/tree builder synchronously also sends speculative loads to the tree op executor. the executor acts on the speculative load queue when the runnabl...
sslfnc.html
arameter of ssl_configsecureserver. the server uses the specified key-exchange algorithm with the specified certificate and key. when the keatype is kt_rsa, this function generates a step-down key that is supplied as part of the handshake if needed. (a step-down key is needed when the server's public key is stronger than is allowed for export ciphers.) in this case, if the server is expected to continue running for a long time, you should call this function periodically (once a day, for example) to generate a new step-down key. ssl makes and keeps internal copies (or increments the reference counts, as appropriate) of certificate and key structures. the application should destroy its copies when it has no further use for them by calling cert_destroycertificate and seckey_destroyprivatekey. ...
...ameter this function has the following parameter: fd a pointer to the file descriptor for the ssl socket. returns the function returns one of these values: if successful, zero. if unsuccessful, -1. use pr_geterror to obtain the error code. description after you call ssl_invalidatesession, the existing connection using the session can continue, but no new connections can resume this ssl session. ssl_datapending returns the number of bytes waiting in internal ssl buffers to be read by the local application from the ssl socket. syntax #include "ssl.h" int ssl_datapending(prfiledesc *fd); parameter this function has the following parameter: fd a pointer to a file descriptor for a connected...
... the error code. description when you are forcing the initial handshake on a blocking socket, this function returns when the handshake is complete. for subsequent handshakes, the function can return either because the handshake is complete, or because application data has been received on the connection that must be processed (that is, the application must read it) before the handshake can continue. you can use ssl_forcehandshake when a handshake is desired but neither end has anything to say immediately. this occurs, for example, when an https server has received a request and determines that before it can answer the request, it needs to request an authentication certificate from the client. at the http protocol level, nothing more is being said (that is, no http request or response is b...
Necko walkthrough
cko http code (still on the main thread for now): nshttpchannel::asyncopen nshttpchannel::beginconnect() creates nshttpconnectioninfo object for the channel checks if we're proxying or not fires off the dns prefetch request (dispatched to dns thread pool) some other things nshttpchannel::connect might to a speculativeconnect (pre open tcp socket) nshttpchannel::continueconnect some cache stuff nshttpchannel::setuptransaction creates new nshttptransaction, and inits it with mrequesthead (the request headers) and muploadstream (which was created from the request data in channel setup) gets an nsiasyncinputstream (for the response; corresponds to the nspipeinputstream for the response stream pipe) passes it to nsinputstreampump nshttpc...
...shttphandler object, which adds the transaction to the nshttpconnectionmgr (one of these per nshttphandler). nshttpconnectionmgr::postevent creates an nsconnevent with params including the handler function, nshttpconnectionmgr::onmsgnewtransaction, and the recently created nshttptransaction. dispatches the nsconnevent to the socket thread back to the context of nshttpchannel::continueconnect: nsinputstreampump->asyncread this pump calls nsiasyncinputstream::asyncwait (the input for the response stream pipe created with the nshttptransaction, i.e. nspipeinputstream::asyncwait), with target thread set to the current thread, i.e. main. so, subsequent callbacks will be dispatched to the main thread. nspipeinputstream::asyncwait sets the callback to be used late...
...so, on the socket thread... the event queue works around to nshttpconnectionmgr::onmsgnewtransaction (with the nshttptransaction passed as a param - remember the event was posted earlier by initiatetransaction from the main thread). nshttpconnectionmgr::onmsgnewtransaction nshttpconnectionmgr::processnewtransaction (notice the check that we're on gsocketth...
Background Tasks API - Web APIs
ss you specify a timeout. there's no guarantee that every pass through the event loop (or even every screen update cycle) will include any idle callbacks being executed; if the event loop uses all available time, you're out of luck (again, unless you've used a timeout). idle callbacks should do their best not to overrun the time allotted. while the browser, your code, and the web in general will continue to run normally if you go over the specified time limit (even if you go way over it), the time restriction is intended to ensure that you leave the system enough time to finish the current pass through the event loop and get on to the next one without causing other code to stutter or animation effects to lag. currently, timeremaining() has an upper limit of 50 milliseconds, but in reality you wil...
... for each task in the queue that we have time to execute, we do the following: we remove the task object from the queue. we increment currenttasknumber to track how many ...
...e increment currenttasknumber to track how many tasks we've executed. we call the task's handler, task.handler, passing into it the task's data object (task.data). we call a function, schedulestatusrefresh(), to handle scheduling a screen update to reflect changes to our progress. when time runs out, if there are still tasks left in the list, we call requestidlecallback() again so that we can continue to process the tasks the next time there's idle time available. if the queue is empty, we set taskhandle to 0 to indicate that we don't have a callback scheduled. that way, we'll know to request a callback next time enqueuetask() is called. updating the status display one thing we want to be able to do is update our document with log output and progress information. however, you can't safely ch...
EffectTiming.fill - Web APIs
Web › API › EffectTiming › fill
n sequence is not actively running, such as before the time specified by iterationstart or after animation's end time. for example, setting fill to "none" means the animation's effects are not applied to the element if the current time is outside the range of times during which the animation is running, while "forwards" ensures that once the animation's end time has been passed, the element will continue to be drawn in the state it was in at its last rendered frame. note that authors are discouraged from using fill modes to persist the effect of an animation indefinitely. see the alternatives to fill modes section below for approaches that are simpler and more performant. element.animate(), and keyframeeffect() accept an object of timing properties including fill. the value of fill corresponds...
...n's effects are only visible while the animation is iterating or its playhead is positioned over an iteration. the animation's effects are not visible when its playstate is pending with a delay, when its playstate is finished, or during its enddelay or delay. in other words, if the animation isn't in its active interval, the affected element is not visible. "forwards" the affected element will continue to be rendered in the state of the final animation framecontinue to be applied to the after the animation has completed playing, in spite of and during any enddelay or when its playstate is finished. "backwards" the animation's effects should be reflected by the element(s) state prior to playing, in spite of and during any delay and pending playstate. "both" combining the effects of both for...
...w animation(rabbitdownkeyframes, document.timeline); alternatives to fill modes fill modes are primarily provided as a means of representing the animation-fill-mode feature of css animations. when used to persist the effect of an animation indefinitely, however, they have a number of drawbacks: the forwards fill of an animation (or backwards fill if the animation is playing in reverse) will continue to override any changes to specified style indefinitely which can lead to confusing behavior. this is because animations take priority in the css cascade over normal author styles. in order to avoid leaking memory when many filling animations overlap, the browser is required to remove overlapped animations which can lead to surprising results in some cases. rather than using fill modes to pers...
In depth: Microtasks and the JavaScript runtime environment - Web APIs
function returns and its context is removed from the stack and destroyed. when greetuser("teresa") is reached, a context is created for it and pushed onto the stack. when greetuser() calls localgreeting(), another context is created to run that function. when this function returns, the context for localgreeting() is removed from the execution stack and destroyed. greetuser() continues to execute where it left off. the greetuser() function returns and its context is removed from the stack and destroyed. when greetuser("veronica") is reached, a context is created for it and pushed onto the stack. when greetuser() calls localgreeting(), another context is created to run that function. when this function returns, the context for localgreeting() is remov...
... the task queue, the runtime executes each task that is in the queue at the moment a new iteration of the event loop begins. tasks added to the queue after the iteration begins will not run until the next iteration. each time a task exits, and the execution context stack is empty, each microtask in the microtask queue is executed, one after another. the difference is that execution of microtasks continues until the queue is empty—even if new ones are scheduled in the interim. in other words, microtasks can enqueue new microtasks and those new microtasks will execute before the next task begins to run, and before the end of the current event loop iteration. problems because your code runs in the same thread, using the same event loop, as the browser's user interface, if your code blocks or en...
...ain script to run other scripts in new threads, help to alleviate this problem. a well-designed web site or app uses workers to perform any complex or lengthy operations, leaving the main thread to do as little work as possible beyond updating, laying out, and rendering the web page. this is further alleviated by using asynchronous javascript techniques such as promises to allow the main code to continue to run while waiting for the results of a request. however, code running at a more fundamental level—such as code comprising a library or framework—may need a way to schedule code to be run at a safe time while still executing on the main thread, independent of the results of any single request or task. microtasks are another solution to this problem, providing a finer degree of access by ma...
MediaRecorder.start() - Web APIs
m the input stream. a blob is created and the data is collected in it until the time slice period elapses or the source media ends. each time a blob is filled up to that point (the timeslice duration or the end-of-media, if no slice duration was provided), a dataavailable event is sent to the mediarecorder with the recorded data. ...
..., a dataavailable event is sent to the mediarecorder with the recorded data. if the source is still playing, a new blob is created and recording continues into that, and so forth. when the source stream ends, state is set to inactive and data gathering stops. a final dataavailable event is sent to the mediarecorder, followed by a stop event. note: if the browser is unable to start recording or continue recording, it will raise a domerror event, followed by a mediarecorder.dataavailable event containing the blob it has gathered, followed by the mediarecorder.stop event. syntax mediarecorder.start(timeslice) parameters timeslice optional the number of milliseconds to record into each blob. if this parameter isn't included, the entire media duration is recorded into a single blob unless th...
...it has gathered, followed by the mediarecorder.stop event. syntax mediarecorder.start(timeslice) parameters timeslice optional the number of milliseconds to record into each blob. if this parameter isn't included, the entire media duration is recorded into a single blob unless the requestdata() method is called to obtain the blob and trigger the creation of a new blob into which the media continues to be recorded. return value undefined. exceptions errors that can be detected immediately are thrown as dom exceptions. all other errors are reported through error events sent to the mediarecorder object. you can implement the onerror event handler to respond to these errors. invalidmodificationerror the number of tracks on the stream being recorded has changed. you can't add or remove...
Spaces and reference spaces: Spatial tracking in WebXR - Web APIs
sometimes, while the user is actively using their xr hardware with your app, the flow of data containing updates as to the user's position and orientation might be lost for a period of time. not only does your app need to determine what to show the user during these periods, but it needs to cleanly recover when tracking resumes. once the xr hardware begins providing tracking information, it will continue to do so until the xr session is clsoed. this data is obtained during each frame by calling the xrframe method getviewerpose() to get the position and facing direction of the viewer (defining what the user should see), and getpose() to get any other poses, such as the positions of the hand controllers and any other parts of the xr system. detecting and functioning after tracking loss if trackin...
...werpose() to get the position and facing direction of the viewer (defining what the user should see), and getpose() to get any other poses, such as the positions of the hand controllers and any other parts of the xr system. detecting and functioning after tracking loss if tracking fails, such as due to a temporary loss of connectivity between the headset and the user's device, the xr layer will continue to return poses, but those poses' emulatedposition property will be true, indicating that the computation of the pose is based on a guess of the current position of the user. some xr hardware uses algorithms to compute the estimated position of the user based on the movement currently ongoing, while other hardware will report no movement at all, but with emulatedposition set to true. in either c...
...hen tracking has resumed after being lost when the user position jumps while at the same time the value of emulatedposition changes from true to false. how you handle this depends on your application. if your app provides a way for the user to move through the virtual world without physically moving in the real world (a so-called teleportation mechanic), you can simply accept the new position and continue, allowing the jump from your previously-assumed position to be immediately corrected with the new position. on the other hand, if your app involves the user physically moving in real space to move around through your virtual world, simply adopting the new tracking position and jumping there can be unsettling to the user, and should be avoided if possible. instead, use the difference between the ...
Expect - HTTP
Web › HTTP › Headers › Expect
the expect http request header indicates expectations that need to be fulfilled by the server in order to properly handle the request. the only expectation defined in the specification is expect: 100-continue, to which the server shall respond with: 100 if the information contained in the header is sufficient to cause an immediate success, 417 (expectation failed) if it cannot meet the expectation; or any other 4xx status otherwise. for example, the server may reject a request if its content-length is too large. ...
... (expectation failed) if it cannot meet the expectation; or any other 4xx status otherwise. for example, the server may reject a request if its content-length is too large. no common browsers send the expect header, but some other clients such as curl do so by default. header type request header forbidden header name yes syntax no other expectations except "100-continue" are specified currently. expect: 100-continue directives 100-continue informs recipients that the client is about to send a (presumably large) message body in this request and wishes to receive a 100 (continue) interim response. examples large message body a client sends a request with a expect header and waits for the server to respond before sending the message body. put /somewhere...
... client is about to send a (presumably large) message body in this request and wishes to receive a 100 (continue) interim response. examples large message body a client sends a request with a expect header and waits for the server to respond before sending the message body. put /somewhere/fun http/1.1 host: origin.example.com content-type: video/h264 content-length: 1234567890987 expect: 100-continue the server now checks the request headers and may respond with a 100 (continue) response to instruct the client to go ahead and send the message body, or it will send a 417 (expectation failed) status if any of the expectations cannot be met. specifications specification title rfc 7231, section 5.1.1: expect hypertext transfer protocol (http/1.1): semantics and con...
Lexical grammar - JavaScript
bom in a script with hasbang. bom will not work when you try to run the script in unix/linux. so use utf-8 without bom if you want to run scripts directly from shell. you must only use the #! comment style to specify a javascript interpreter. in all other cases just use a // comment (or mulitiline comment). keywords reserved keywords as of ecmascript 2015 break case catch class const continue debugger default delete do else export extends finally for function if import in instanceof new return super switch this throw try typeof var void while with yield future reserved keywords the following are reserved as future keywords by the ecmascript specification. they have no special functionality at present, but they might at some future time, so they cannot be ...
... 1. a semicolon is inserted before, when a line terminator or "}" is encountered that is not allowed by the grammar. { 1 2 } 3 // is transformed by asi into { 1 2 ;} 3; 2. a semicolon is inserted at the end, when the end of the input stream of tokens is detected and the parser is unable to parse ...
... ++ is not treated as a postfix operator applying to variable b, because a line terminator occurs between b and ++. a = b ++c // is transformend by asi into a = b; ++c; 3. a semicolon is inserted at the end, when a statement with restricted productions in the grammar is followed by a line terminator. these statements with "no lineterminator here" rules are: postfixexpressions (++ and --) continue break return yield, yield* module return a + b // is transformed by asi into return; a + b; specifications specification ecmascript (ecma-262)the definition of 'lexical grammar' in that specification. ...
Optimizing startup performance - Web Performance
our startup code in a single event handler on the app's main thread. instead, you should write your code so that your app creates a web worker that does as much as possible in a background thread (for example, fetching and processing data.) then, anything that must be done on the main thread (such as user events and rendering ui) should be broken up into small pieces so that the app's event loop continues to cycle while it starts up. this will prevent the app, browser, and/or device from appearing to have locked up. why is it important to be asynchronous? other than the reasons suggested above, consider the impact of a non-responsive page or user interface. the user is unable to cancel if they launched your app by mistake. if the app is being run in a browser, it's possible the user may get an "...
...run most or all of your startup code on the main thread. however, even code like that can be made asynchronous, with a little work. getting asynchronous here are some suggestions for how to build your startup process to be as asynchronous as possible (whether it's a new app or a port): use the defer or async attribute on script tags needed by the web application. this allows html parsers to continue processing the document, instead of having to wait until the scripts have been downloaded and executed before continuing. if you need to decode asset files (for example, decoding jpeg files and turning them into raw texture data for later use by webgl), that's great to do in workers. when dealing with data supported by the browser (for example, decoding image data), use the decoders built into ...
...startup process is to refactor the code into small pieces that can be done in chunks interspersed across multiple calls to your app's main loop, so that the main thread gets to handle input and the like. emscripten provides an api to help with this refactoring; for example, you can use emscripten_push_main_loop_blocker() to establish a function to be executed before the main thread is allowed to continue. by establishing a queue of functions to be called in sequence, you can more easily manage running bits of code without blocking the main thread. that leaves, though, the problem of having to refactor your existing code to actually work that way. that can take some time. how asynchronous should i get? it's worth keeping in mind that most browsers typically start complaining that your script is...
SDK API Lifecycle - Archive of obsolete content
velopers at a migration guide. migration the deprecation period defaults to 18 weeks (that is, three releases) although in some cases, generally those out of our control, it might be shorter than this. during this time, the module will be in the deprecated state. the sdk team will track usage of deprecated modules on addons.mozilla.org and support developers migrating their code. the sdk will continue to provide warnings: api documentation will inform users that the module is deprecated. attempts to use a deprecated module at runtime will log an error to the error console. the amo validator will throw errors when deprecated modules are used, and these add-ons will therefore fail amo review. all warnings should include links to further information about what to use instead of the depreca...
... ...
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
ith venkman, and start the debugger. the local variables screen should always display variables and objects during step-by-step execution. with functions that include a lot of variables, this will be hard to read, so you can point out specific variables that you want to watch (figure 4). watched variables appear under the watches tab, and are updated every time they are evaluated. you can then continue with stepwise execution and watch the changes in the program and variables. once you’ve finished your inspection, you can continue and let the halted program resume execution. the author has done almost no work developing extensions, but has used this to investigate how extensions were implemented. in the quicknote example, we first set one breakpoint and then stepped through it. use step ov...
...nsions were implemented. in the quicknote example, we first set one breakpoint and then stepped through it. use step over to avoid a function, and step into to always call it; once you are done investigating a function, use step out, and then you can step into the next function. set breakpoints in locations of interest where you’re not sure what’s going on, and the next time you run it, use continue to shift to that location and start investigating again. fixme: figure 4: adding a watch target mozunit mozunit is a tool for javascript that assists with unit testing. it provides an ui similar to that of eclipse’s junit test runner. it should be very easy for java programmers to get up to speed on it quickly. installing mozunit is a feature of mozlab. install mozlab from the following ur...
Adding windows and dialogs - Archive of obsolete content
not only the inner content area. you should always include it when opening a xul window or dialog. modal. modal windows block their parent window until action is taken on them. an alert window is an example of this. modal windows should be avoided when possible because they interrupt the user's browsing and can become annoying very quickly. this feature should only be used when there's no way to continue without having the user do something. never open modal windows at startup. resizable. indicates the user can resize the window or not. in general, windows should not be resizable unless they display dynamically generated content from a datasource, such as lists or trees that may need resizing to have a better view of the content. to open a new dialog, use the function window.opendialog, an ext...
...nfirm confirmation dialogs display a text with a yes / no question, and prompts the user to choose an answer. in html you can use the window.confirm function for this. the prompt service has a confirm method with similar behavior: let prompts = cc["@mozilla.org/embedcomp/prompt-service;1"]. getservice(ci.nsipromptservice); if (prompts.confirm(window, "confirm title", "would you like to continue?")) { // do something. } else { // do something else } the method returns a boolean value indicating the user's response. others unprivileged javascript can also use the window.prompt function to receive text input from the user. the prompt service has a very rich set of functions that allow different kinds of inputs, such as text, passwords, usernames and passwords, and checkboxes that ...
JXON - Archive of obsolete content
vvalue.togmtstring() : string(vvalue))); } } else if (sname === "keyattributes") { /* verbosity level is 3 */ for (var sattrib in vvalue) { oparentel.setattribute...
...vvalue.togmtstring() : string(vvalue))); } } else if (sname === sattrprop) { /* verbosity level is 3 */ for (var sattrib in vvalue) { oparentel.setattribute(sattrib, vvalue[sattrib]); } } else...
List of Former Mozilla-Based Applications - Archive of obsolete content
old article available about how borland embedded mozilla in kylix 2 mango im client last news item on site from january 2007 mobidvd dvd/vcd/cd ripping software site down mozilla suite internet application suite development shifted to firefox, thunderbird and seamonkey applications netscape navigator browser support for ne...
... last news item on site from january 2007 mobidvd dvd/vcd/cd ripping software site down mozilla suite internet application suite development shifted to firefox, thunderbird and seamonkey applications netscape navigator browser support for netscape ended on february 1, 2008 nvu web authoring tool development stopped in 2005 and is being continued as an unofficial bugfix release by the kompozer project pogo browser from at&t site no longer accessible as of may 2009 pyro desktop desktop environment last news item on site from july 2007 script editor editor inactive skipstone gtk+ browser last news item on site from february 2008 xabyl visual xbl editor inactive ...
Mozilla Crypto FAQ - Archive of obsolete content
nistration regulations were created by the bureau of export administration (bxa) and were designed primarily to implement the requirements of the export administration act of 1979 (as amended), also known as 50 usc appendices 2401-2420. ("usc" stands for "united states code.") the eaa was passed as temporary legislation; however the 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), th...
...ion. however this ruling did not settle the issue of the constitutionality of u.s. export control regulations. the u.s. department of justice has sought to appeal the decision, first to all eleven members of the 9th circuit court of appeals (referred to as the courten banc, or full court) and then possibly to the u.s. supreme court. until the appeals process is completed the u.s. government will continue to enforce current u.s. export regulations. in light of the new encryption export regulations it is also possible that the bernstein case may be declared moot on the basis that professor bernstein is now free to do what he originally requested to do, i.e., publish his encryption source code online. for more information see the archives on the bernstein case maintained by the electronic frontier...
Venkman Introduction - Archive of obsolete content
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 checkmark appears next t...
...gger will stop at the next instruction, but doesn't have anywhere to stop yet. this quick stop mode reflects a common scenario in javascript debugging, which is to inspect and debug scripts while they are running, as on a page where elements are moved around dynamically with dhtml. you can also use commands available in the debug menu and from the console to stop at errors or at exceptions. the continue button to the right of the stop button dismisses the stop mode and specifies that scripts should be executed normally, without pausing as each statement is executed. the pretty print button toggles pretty print mode. while in pretty print mode, the contents of the source view will contain the decompiled source text for the selected function. this is the same text you would get from the tosource ...
Anonymous Content - Archive of obsolete content
nserted. explicit insertion points are only used if they are found on the primary generating binding. explicit insertion points on other bindings are ignored. inherited insertion points are used to place the anonymous content generated by the next binding in the chain that contributes anonymous content. that binding can define inherited insertion points for its base binding as well. this pattern continues all the way up the binding chain. xpath selectors specified using the includes attribute determine which insertion point a given child should be placed under. [actually, only tag names may be specified; see the includes attribute description in <children> element reference, bug 174614 and bug 51527.] if no attribute is specified, an insertion point is considered generic and will match on all co...
...seover of the file control itself, the event is retargeted when it flows across scopes. if the user then moves the mouse from the textfield to the button, a mouseout is generated for the textfield, followed by a mouseover of the button. since neither of these events constitutes a mouseover or mouseout of the file control itself, the events are not allowed to flow to the file control. if the user continues moving to the right and leaves the button, then the mouseout generated will be retargeted, since the file control will also have been exited. anonymous content and css selectors and scopes bindings can interleave anonymous elements between the bound element and its explicit children. see insertion points for more information. in this situation, a new tree emerges that is different from the ex...
Windows and menus in XULRunner - Archive of obsolete content
last time i installed xulrunner and built a very simple, bare-bones test application. this time i want to add some of the things common to a desktop application user interface: windows and dialogs menus and toolbars os common dialogs controls or widgets windows each window or dialog should be created in its own xul file. the xul file may also contain other top-level declarations for css and dtd, which i will discuss in a moment. <window> is the basic windowing element in xul. it has attributes to set the title/caption as well as to control its width and height. ...
...---- */ #open { list-style-image: url(chrome://basicapp/skin/open.png); -moz-box-orient: vertical; } #save { list-style-image: url(chrome://basicapp/skin/save.png); -moz-box-orient: vertical; } of course, you need to make sure the png files are included in the application. there are quite a few things xul offers for application ui. more than i can fit into a single article, so we will continue looking at building ui in xulrunner in the next article. see also xul:windows xul tutorial:creating a window commandset command xul tutorial:commands xul tutorial:simple menu bars xul tutorial:toolbars « previousnext » original document information author: mark finkle last updated date: october 2, 2006 ...
Gecko Compatibility Handbook - Archive of obsolete content
user agent switcher |the name you have chosen. you can verify the string got changed by looking under help | about. you can find the user agent strings of many gecko-based browsers here. if possible, also download the actual clients (netscape, aol, compuserve) for testing. review your results the following scenarios all relate to browser detection. for more solutions to common problems please continue reading this handbook. problem: site supports standards but does not look right try picking the internet explorer 6 user-agent string. if this works, set up your detection to serve ie 6 content to visitors with gecko in their user-agent strings. ie 6.x is actually more similar to gecko browsers than netscape 4.x is to gecko, due to increased support of w3c standards. problem: site certified on...
...doctype can completely alter a page's presentation. gecko, internet explorer for mac os and internet explorer 6 all use a technique called doctype sniffing to determine if a page is to be laid out in a fashion compatible with the older browsers or if it is to be laid out in a fashion compatible with the w3 standards. using the appropriate doctype in an html document allows a web page author to continue to support the older, less compliant browsers while also supporting the newer, more compliant browsers by specifiying special quirks mode layout via the doctype. as time progresses and the older browsers drop in market share, web page authors can transition to standards-based layout by using the appropriate doctype. (related article) while doctype sniffing is a useful means of continuing to supp...
-ms-content-zoom-snap-type - Archive of obsolete content
microsoft extension that specifies how zooming is affected by defined snap-points. initial valuenoneapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete syntax values none initial value. indicates that zooming is unaffected by any defined snap-points. after the contact is picked up, the content will continue to move with inertia. proximity indicates that the motion of the content after the contact is picked up may be adjusted if the content would normally stop "close enough" to a snap-point. this implies that it is possible for the content zoom factor to end up between snap-points. mandatory indicates that the motion of the content after the contact is picked up is always adjusted so th...
...one that is closest to where the content zoom factor would normally stop. formal syntax none | proximity | mandatory specifications not part of any specification. remarks this property has no effect on non-zoomable elements. see -ms-content-zooming for details on zoomable elements. when a user pans or scrolls and then lifts his or her contact (for instance, a finger), the content can continue to move with inertia. snap-points can change the animation that runs when the user lifts his or her finger so that you can adjust where the content will stop. by placing snap-points, you can make it easy for your users to manipulate your content and make it stop at convenient or key places. starting with windows 8.1, this property is also supported for touchpad interaction. this property requir...
E4X for templating - Archive of obsolete content
(typeof max !== 'number') { lev = h; h = arr; arr = max; max = min; min = 1; } } else { lev = arr; h = max; arr = min; max = number.positive_infinity; min = 1; } if (h.length === 1) { for (k in arr) { if (it < min) { ++it; continue; } if (it > max) { break; } ret+=h(arr[k], it, lev); // need to get it or lev via arguments[] since our length detection implies no explicit additional params; otherwise define with more than one param (see below) ++it; } } else { for (k in arr) { if (it < min) { ++it; ...
... if (it > max) { break; } ret+=h(arr[k], it, lev); // need to get it or lev via arguments[] since our length detection implies no explicit additional params; otherwise define with more than one param (see below) ++it; } } else { for (k in arr) { if (it < min) { ++it; continue; } if (it > max) { break; } ret+=h(k, arr[k], it, lev); ++it; } } return ret; } the following real case example iterates over an array of the lines in an e4x child element to produce an xmllist of multiple vbox's representing each line: <vbox> {foreach(e(someel.somechild[0]).split('\n'), function (line) ...
Index - Game development
now you can check the playcanvas engine article if you haven't seen it yet, go back to the building up a basic demo with playcanvas page, or go back a level higher to the main 3d games on the web page. 20 building up a basic demo with the playcanvas engine 3d, animation, beginner, canvas, games, playcanvas, tutorial, webgl, camera, engine, lighting, rendering now you can continue reading the playcanvas editor article, go back to the building up a basic demo with playcanvas page, or go back a level higher to the main 3d games on the web page. 21 building up a basic demo with three.js 3d, animation, beginner, canvas, games, tutorial, webgl, camera, lighting, rendering, three.js in this article we'll take you through the real basics of using three, inclu...
...ckily enough we can use the physics engine to check collisions not only between single objects (like the ball and the paddle), but also between an object and the group. 48 extra lives 2d, beginner, canvas, games, javascript, phaser, tutorial, lives we can make the game enjoyable for longer by adding lives. in this article we'll implement a lives system, so that the player can continue playing until they have lost three lives, not just one. 49 game over 2d, beginner, canvas, games, javascript, phaser, tutorial, game over to make the game more interesting we can introduce the ability to lose — if you don't hit the ball before it reaches the bottom edge of the screen it will be game over. 50 initialize the framework 2d, beginner, canvas, game...
Flexbox - Learn web development
s "each flex item will first be given 200px of the available space. after that, the rest of the available space will be shared out according to the proportion units." try refreshing and you'll see a difference in how the space is shared out. the real value of flexbox can be seen in its flexibility/responsiveness — if you resize the browser window, or add another <article> element, the layout continues to work just fine. flex: shorthand versus longhand flex is a shorthand property that can specify up to three different values: the unitless proportion value we discussed above. this can be specified individually using the flex-grow longhand property. a second unitless proportion value — flex-shrink — that comes into play when the flex items are overflowing their container. this specifi...
...e center of the main axis. the value we've used above, space-around, is useful — it distributes all the items evenly along the main axis, with a bit of space left at either end. there is another value, space-between, which is very similar to space-around except that it doesn't leave any space at either end. we'd like to encourage you to play with these values to see how they work before you continue. ordering flex items flexbox also has a feature for changing the layout order of flex items, without affecting the source order. this is another thing that is impossible to do with traditional layout methods. the code for this is simple: try adding the following css to your button bar example code: button:first-child { order: 1; } refresh, and you'll now see that the "smile" button has mov...
The web and web standards - Learn web development
e to the standards creation process, where the specs are written. because web technologies are created openly, in collaboration between many different companies, it means that no one company gets to control them, which is a really good thing. you wouldn't want a single company suddenly deciding to put the entire web behind a paywall, or releasing a new version of html that everyone has to buy to continue making web sites, or worse still, just deciding they aren't interested any more and just turning it off. this allows the web to remain a freely-available public resource. don't break the web another phrase you'll hear around open web standards is "don't break the web" — the idea is that any new web technology that is introduced should be backwards compatible with what went before it (i.e. ol...
...orse still, just deciding they aren't interested any more and just turning it off. this allows the web to remain a freely-available public resource. don't break the web another phrase you'll hear around open web standards is "don't break the web" — the idea is that any new web technology that is introduced should be backwards compatible with what went before it (i.e. old web sites will still continue to work), and forwards compatible (future technologies in turn will be compatible with what we currently have). as you go through the learning material presented here, you'll start to learn how this is made possible with some very clever design and implementation work. being a web developer is good the web industry is a very attractive market to enter if you are looking for a job. recent publis...
Making asynchronous programming easier with async and await - Learn web development
of needing to chain a .then() block on to the end of each promise-based method, you just need to add an await keyword before the method call, and then assign the result to a variable. the await keyword causes the javascript runtime to pause your code on this line, allowing other code to execute in the meantime, until the async function call has returned its result. once that's complete, your code continues to execute starting on the next line. for example: let response = await fetch('coffee.jpg'); the response returned by the fulfilled fetch() promise is assigned to the response variable when that response becomes available, and the parser pauses on this line until that occurs. once the response is available, the parser moves to the next line, which creates a blob out of it. this line also invok...
...de). the downsides of async/await async/await is really useful to know about, but there are a couple of downsides to consider. async/await makes your code look synchronous, and in a way it makes it behave more synchronously. the await keyword blocks execution of all the code that follows until the promise fulfills, exactly as it would with a synchronous operation. it does allow other tasks to continue to run in the meantime, but your own code is blocked. this means that your code could be slowed down by a significant number of awaited promises happening straight after one another. each await will wait for the previous one to finish, whereas actually what you want is for the promises to begin processing simultaneously, like they would do if we weren't using async/await. there is a pattern tha...
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
ly the modern version of setinterval() — it executes a specified block of code before the browser next repaints the display, allowing an animation to be run at a suitable frame rate regardless of the environment it is being run in. it was created in response to perceived problems with setinterval(), which for example doesn't run at a frame rate optimized for the device, sometimes drops frames, continues to run even if the tab is not the active tab or the animation is scrolled off the page, etc. (read more about this on creativejs.) note: you can find examples of using requestanimationframe() elsewhere in the course — see for example drawing graphics, and object building practice. the method takes as an argument a callback to be invoked before the repaint. this is the general pattern you'...
...: if (!starttime) { starttime = timestamp; } rotatecount = (timestamp - starttime) / 3; below the previous line inside draw(), add the following block — this checks to see if the value of rotatecount is above 359 (e.g. 360, a full circle). if so, it sets the value to its modulo of 360 (i.e. the remainder left over when the value is divided by 360) so the circle animation can continue uninterrupted, at a sensible, low value. note that this isn't strictly necessary, but it is easier to work with values of 0–359 degrees than values like "128000 degrees". if (rotatecount > 359) { rotatecount %= 360; } next, below the previous block add the following line to actually rotate the spinner: spinner.style.transform = `rotate(${rotatecount}deg)`; at the very bottom ins...
Client-side storage - Learn web development
// create a button and place it inside each listitem const deletebtn = document.createelement('button'); listitem.appendchild(deletebtn); deletebtn.textcontent = 'delete'; // set an event handler so that when the button is clicked, the deleteitem() // function is run deletebtn.onclick = deleteitem; // iterate to the next item in the cursor cursor.continue(); } else { // again, if list item is empty, display a 'no notes stored' message if(!list.firstchild) { const listitem = document.createelement('li'); listitem.textcontent = 'no notes stored.'; list.appendchild(listitem); } // if there are no more cursor items to iterate through, say so console.log('notes all displayed'); } }; } aga...
...or contains a record from the datastore (if(cursor){ ... }) — if so, we create a dom fragment, populate it with the data from the record, and insert it into the page (inside the <ul> element). we also include a delete button that, when clicked, will delete that note by running the deleteitem() function, which we will look at in the next section. at the end of the if block, we use the idbcursor.continue() method to advance the cursor to the next record in the datastore, and run the content of the if block again. if there is another record to iterate to, this causes it to be inserted into the page, and then continue() is run again, and so on. when there are no more records to iterate over, cursor will return undefined, and therefore the else block will run instead of the if block. this block che...
Understanding client-side JavaScript frameworks - Learn web development
it can bring us. then we'll see how to configure our project to work with typescript files. finally we will go over our app and see what modifications we have to make to fully take advantage of typescript features. 8. deployment and next steps in this final article we will look at how to deploy your application and get it online, and also share some of the resources that you should go on to, to continue your svelte learning journey. which frameworks did we choose? we are publishing our initial set of articles with guides focusing on four frameworks. three of them are very popular and well-established — react/reactdom, ember, and vue — whereas svelte is a comparative newcomer that shows a lot of promise and has gained a lot of recent popularity. there is a variety of reasons for this: ...
...very popular and well-established — react/reactdom, ember, and vue — whereas svelte is a comparative newcomer that shows a lot of promise and has gained a lot of recent popularity. there is a variety of reasons for this: they are popular choices that will be around for a while — like with any software tool, it is good to stick with actively-developed choices that are likely to not be discontinued next week, and which will be desirable additions to your skill set when looking for a job. they have strong communities and good documentation. it is very important to be able to get help with learning a complex subject, especially when you are just starting out. we don't have the resources to cover all modern frameworks. that list would be very difficult to keep up-to-date anyway, as new ones...
Introducing a complete toolchain - Learn web development
o minimize our svg file sizes during build. however, this project has only 4 svg images, which were manually minified using svgo before adding them to the project. a couple of prerequisites besides the tools we're going to install that contribute to our toolchain, we mentioned two web services in the above list of tools. let's take this opportunity to make sure we are set up with them before we continue. you will need to create accounts with each of github and netlify if you wish to complete the tutorial. as mentioned previously, github is a source code repository service that adds community features such as issue tracking, following project releases and much more. in the next chapter we will push to a github code repository, which will cause a cascade effect that (should) deploy all the soft...
... latest features of a language (e.g. javascript) or another language entirely (e.g. jsx or typescript) in our development process, and then transforms our code so that the production version still runs on a wide variety of browsers, modern and older. post development: tooling that comes into play after you are done with the body of development to ensure that your software makes it to the web and continues to run. in this case study we'll look at adding tests to your code, and deploying your app using netlify so it is available for all the web to see. let's start working on these, beginning with our development environment. creating a development environment this part of the toolchain is sometimes seen to be delaying the actual work, and it can be very easy to fall into a "rabbit hole" of tool...
Application cache implementation overview
tp cache. nsiapplicationcacheservice::chooseapplicationcache is given the url the channel is about to load. it synchronously returns an nsiapplicationcache object representing the most recent cache version from the most recent cache group containing the entry under the url or a matching namespace. if no nsiapplicationcache object has been found, there is no offline cache to load from and the load continues a usual way by loading from normal http cache, further steps are not executed. the channel remembers the nsiapplicationcache object. nsiapplicationcache is then queried a client id (= the manifest url + a unique time stamp). then, nsicacheservice is asked to open nsicachesession with store_offline policy and the given client id. entry is queried using that session. nshttpchannel::onofflinecachee...
...ked. when aentrystatus is a success code, entry has been found and we are loading it from the cache. loadedfromapplicationcache flag is now set true on the channel. when aentrystatus is a failure code, entry has not been found, but the url is falling under one of the network or fallback namespaces. when matching fallback namespace, the associated fallback entry for it is remembered. the load then continues from the network as a usual load, using http cache. when load of the resource fails fallback steps are performed (see “falling back on a resource load failure” chapter). associating the top level document with offline cache this happens between document load start and the first sub-resource download start and is not about associating nsiapplicationcache object with the channel, but with the ...
Creating a Language Pack
you only need to run this if the version number of firefox changes. windows: replace make with mozmake in the commands below! creating a langpack we will now merge the localized files from x-testing locale with the en-us files from the original source. every time you want to create a langpack, you need to be in the directory obj-firefox-build/browser/locales. it is likely that you will continue to generate language packs as your progress just to test your work. while in that directory, issue the following command: $ make merge-x-testing locale_mergedir=$(pwd)/mergedir x-testing: browser chrome browser aboutcerterror.dtd // add and localize this file ... // lots of notifications about missing entities ... x-testing: changed: 6 m...
...ke ident fx_revision 237dccbcb967 buildid 20091126033851 you can now go back to your source hg clone. $ cd ../../../mozilla-aurora and update the source code to this revision. $ hg update -r 237dccbcb967 3 files updated, 0 files merged, 0 files removed, 0 files unresolved the source code has been updated to the revision the binary was built from. let's go to the build directory again and continue the repacking. $ cd ../obj-firefox-build/browser/locales we will now merge the localized files from x-testing locale with the en-us files from the original source. issue the following command: $ make merge-x-testing locale_mergedir=$(pwd)/mergedir rm -f -rf mergedir macosx_deployment_target= compare-locales -m mergedir /users/your_id/mozilla/vc/mozilla-aurora/browser/locales/l10n.ini /users/y...
Debugging on Windows
by running the program in the debugger until you hit an assertion. you should see some assembly code. one assemly code instruction reads "int 3". check the memory address for that line. now open memory view. type/copy/drag the memory address of "int 3" into the memory view to get it to update on that part of the memory. change the value of the memory to "90", close the memory view and hit "f5" to continue. confused? see the screenshot below: vc++ 7.0? automatically handling assertions without a debugger attached when an assertion happens and there is not a debugger attached, a small helper application (windbgdlg.exe) is run. that application can automatically select a response to the "do you want to debug" dialog instead of prompting if you configure it, for more info, see windbgdlg.exe. de...
...specific libraries you are trying to debug. unfortunately, it's hard to know which symbols to download without having vs hang and seeing the "downloading symbols for <library>" status at the bottom left of the main window. problems post-mortem debugging on windows 7 sp1 x64? if you attempt to use ns_debugbreak etc to perform post-mortem debugging on a 64bit windows 7, but as soon as you try and continue debugging the program crashes with an access violation, you may be hitting a windows bug relating to avx support. for more details, including a work-around see this blog post or this social.msdn thread. (and just in-case those links die, the work-around is to execute bcdedit /set xsavedisable 1 from an elevated command-prompt to disable avx support.) got a tip? if you think you know a cool ...
How Mozilla's build system works
aders into place. libs is reserved for most of the work, like compiling c++ source files. tools is used to install tests and other support tools. when make is invoked, it starts at the export sub-tier of the first tier, and traverses all the directories in that tier. then, it does the same thing for the libs sub-tier and, subsequently, the tools sub-tier. it then moves on to the next tier and continues until no tiers remain. to view information about the tiers, you can execute the following special make targets: command effect make echo-tiers show the final list of tiers. make echo-dirs show the list of non-static source directories to iterate over, as determined by the tier list. make echo-variable-static_dirs show the list of static source di...
...build target is dirs. dirs is a list of subdirectories of the current directory to recursively build in. subdirectories are traversed after their parent directories. for example, you could have: dirs = \ public \ resources \ src \ $(null) this example demonstrates another concept called continuation lines. a backslash as the last character on a line allows the variable definition to be continued on the next line. the extra whitespace is compressed. the terminating $(null) is a method for consistency; it allows you to add and remove lines without worrying about whether the last line has an ending backslash or not. makefile examples standard makefile header installing headers using exports compiling interfaces using xpidlsrcs installing a javascript component building a component ...
Eclipse CDT Manual Setup
n more detail on how eclipse works. you can expect it to take an hour or so to work through these instructions if you're doing so for the first time. (this assumes that you already have a copy of the mozilla source, and that you have also built the source so that you have a pre-existing object directory. if that is not the case, then get your build going now so that it can be running while you continue with the instructions below. faq: wait, why does eclipse need an object directory?) code assistance out of the box, eclipse can provide some code assistance for the mozilla source, but it will be incomplete and often just plain broken. if you set up eclipse as detailed below, you will experience much better results. important background to help you make sense of the instructions that follow (...
...ot of your source tree, select an appropriate toolchain (e.g., "macosx gcc"), and click finish. the status bar at the bottom right of the window should now show that eclipse is "refreshing the workspace" (gathering a list of all the files in the source tree). click on the little green button beside this message to open the "progress" tab, and keep an eye on the "refreshing workspace" item as you continue with the steps below. (if an "indexing" item starts after the "refreshing the workspace" item has finished, click the little red box beside that item to cancel it, since we want to configure the project before the indexer runs.) initial project properties so that the indexer will run faster and give better results, and so that eclipse doesn't give results for irrelevant files, you should add so...
nss tech note1
ype macro sec_asn1_constructed to construct a fully valid tag, as defined by the asn.1 standard . decoder modifiers : these modifiers are also specified in the kind field of the template structure. all the values are in the 9 - 31 bit range. sec_asn1_optional: tells the decoder that this component is optional. if the component in the input data does not match this template, the decoder will continue processing the input data using the next available template. sec_asn1_explicit: tells the decoder that explicit tagging is being used. this is always a constructed type. it requires a subtemplate defining the types of the data within. sec_asn1_any: allows the decoder to match this template with any component type, regardless of the tag in the input data. if used in conjunction with sec_asn1...
...ways a constructed type. it requires a subtemplate defining the types of the data within. sec_asn1_any: allows the decoder to match this template with any component type, regardless of the tag in the input data. if used in conjunction with sec_asn1_optional as part of a sequence, this must be the last template in the template array. sec_asn1_inline: recurse into the specified subtemplate to continue processing. this 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...
Python binding for NSS
code with deprecation warnings enabled. depercated elements will persist for a least two releases before being removed from the api entirely. project history red hat utilizes both nss and python in many of it's projects, however it was not previously possible to call nss directly from python. to solve this problem red hat generously funded the initial development of python-nss as well as it's continued maintenance. red hat following it's open source philosophy has contributed the source to the mozilla security project. red hat welcomes all interested contributors who would like to contribute the the python-nss project as part of an open source community. the initial release of python-nss occurred in september 2008 with it's inclusion in the fedora distribution. the source code to python-nss wa...
... the following class methods were added: pk11slot.check_security_officer_passwd pk11slot.check_user_passwd pk11slot.change_passwd pk11slot.init_pin release 0.17.0 release date 2014-11-07 scm tag pynss_release_0_17_0 source download https://ftp.mozilla.org/pub/mozilla.org/secu...
NSS environment variables
are allowed to renegotiate without any restrictions. this setting was the default prior 3.12.5 and makes products vulnerable. [0|n|n]: ssl_renegotiate_never never allow renegotiation - that was the default for 3.12.5 release. [3|t|t]: ssl_renegotiate_transitional disallows unsafe renegotiation in server sockets only, but allows clients to continue to renegotiate with vulnerable servers. this value should only be used during the transition period when few servers have been upgraded. [2|r|r]: ssl_renegotiate_requires_xtn (default) only allows renegotiation if the peer's hello bears the tls renegotiation_info extension. this is the safe renegotiation. 3.12.5 modified in 3.12.6 nss_ssl_require_safe...
...e_gcc boolean (1 to enable) on systems where gcc is not the default compiler, this tells nss to build with gcc. before 3.0 nss_allow_sslkeylogfile boolean (1 to enable) enable nss support in optimized builds for logging ssl/tls key material to a logfile if the sslkeylogfile environment variable. as of nss 3.24 this is disabled by default. 3.24 nss_build_continue_on_error boolean (1 to enable) continue building nss source directories when a build error occurs. 3.12.4 nss_use_system_sqlite boolean (1 to enable) use the system installed sqlite library instead of the in-tree version. 3.12.6 nss_disable_ecc (deprecated) boolean (1 to disable) disable elliptic curve cryptography features. as of nss 3.1...
NSS tools : ssltab
med cert.0x, where x is the sequence number of the certificate. if the -s option is used with -h, two separate parts are printed for each record: the plain hex/ascii output, and the parsed ssl output. -x turn on hex/ascii printing of undecoded data inside parsed ssl records. used only with the -s option. this option uses the same output format as the -h option. -l prefix turn on looping; that is, continue to accept connections rather than stopping after the first connection is complete. -p port change the default rendezvous port (1924) to another port. the following are well-known port numbers: * http 80 * https 443 * smtp 25 * ftp 21 * imap 143 * imaps 993 (imap over ssl) * nntp 119 * nntps 563 (nntp over ssl) usage and examples you can use the ssl debugging tool to intercept any connection infor...
...crashes of the command shell window. to output a basic, printable interpretation of the data, use the -h option, or, if you are looking at an ssl connection, the -s option. you will notice that the page you retrieved looks incomplete in the browser. this is because, by default, the tool closes down after the first connection is complete, so the browser is not able to load images. to make the tool continue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. example 1 $ ssltap.exe -sx -p 444 interzone.mcom.com:443 > sx.txt output connected to interzone.mcom.com:443 -->; [ alloclen = 66 bytes [ssl2] clienthellov2 { version = {0x03, 0x00} cipher-specs-length = 39 (0x27) sid-length = 0 (0x00) challenge-leng...
NSS tools : ssltap
med cert.0x, where x is the sequence number of the certificate. if the -s option is used with -h, two separate parts are printed for each record: the plain hex/ascii output, and the parsed ssl output. -x turn on hex/ascii printing of undecoded data inside parsed ssl records. used only with the -s option. this option uses the same output format as the -h option. -l prefix turn on looping; that is, continue to accept connections rather than stopping after the first connection is complete. -p port change the default rendezvous port (1924) to another port. the following are well-known port numbers: * http 80 * https 443 * smtp 25 * ftp 21 * imap 143 * imaps 993 (imap over ssl) * nntp 119 * nntps 563 (nntp over ssl) usage and examples you can use the ssl debugging tool to intercept any connection infor...
...crashes of the command shell window. to output a basic, printable interpretation of the data, use the -h option, or, if you are looking at an ssl connection, the -s option. you will notice that the page you retrieved looks incomplete in the browser. this is because, by default, the tool closes down after the first connection is complete, so the browser is not able to load images. to make the tool continue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. example 1 $ ssltap.exe -sx -p 444 interzone.mcom.com:443 > sx.txt output connected to interzone.mcom.com:443 -->; [ alloclen = 66 bytes [ssl2] clienthellov2 { version = {0x03, 0x00} cipher-specs-length = 39 (0x27) sid-length = 0 (0x00) challenge-leng...
NSS Tools ssltap
named cert.0x, where x is the sequence number of the certificate. if the -s option is used with -h, two separate parts are printed for each record: the plain hex/ascii output, and the parsed ssl output. -x turn on hex/ascii printing of undecoded data inside parsed ssl records. used only with the -s option. this option uses the same output format as the -h option. -l turn on looping; that is, continue to accept connections rather than stopping after the first connection is complete. -p port change the default rendezvous port (1924) to another port. the following are well-known port numbers: http 80 https 443 smtp 25 ftp 21 imap 143 imaps 993 (imap over ssl) nntp 119 nntps 563 (nntp over ssl) examples you can use the ssl debugging tool to intercept any connection...
...rashes of the command shell window. to output a basic, printable interpretation of the data, use the -h option, or, if you are looking at an ssl connection, the -s option. you will notice that the page you retrieved looks incomplete in the browser. this is because, by default, the tool closes down after the first connection is complete, so the browser is not able to load images. to make the tool continue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. example 1 the s and x options in this example turn on ssl parsing and show undecoded values in hex/ascii format. the output is routed to a text file. command ssltap.exe -sx -p 444 interzone.mcom.com:443 > sx.txt output output con...
NSS tools : ssltap
Mozilla › Projects › NSS › tools › ssltap
tion is used with -h, two separate parts are printed for each record: the plain hex/ascii output, and the parsed ssl output. -x turn on hex/ascii printing of undecoded data inside parsed ssl records. used only with the -s option. this option uses the same output format as the -h option. -l prefix turn on looping; that is, continue to accept connections rather than stopping after the first connection is complete. -p port change the default rendezvous port (1924) to another port. the following are well-known port numbers: * http 80 * https 443 * smtp 25 * ftp 21 * imap 143 * imaps 993 (imap over ssl) * n...
...command shell window. to output a basic, printable interpretation of the data, use the -h option, or, if you are looking at an ssl connection, the -s option. you will notice that the page you retrieved looks incomplete in the browser. this is because, by default, the tool closes down after the first connection is complete, so the browser is not able to load images. to make the tool continue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. example 1 $ ssltap.exe -sx -p 444 interzone.mcom.com:443 > sx.txt output connected to interzone.mcom.com:443 -->; [ alloclen = 66 bytes [ssl2] clienthellov2 { version = {0x03, 0x00} cipher-specs-l...
JS_MapGCRoots
obsolete since jsapi 19this 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. perform some action for each object in a jsruntime's gc root set. syntax uint32 js_mapgcroots(jsruntime *rt, jsgcrootmapfun map, void *data); callback syntax #define js_map_gcroot_next 0 /* continue mapping entries */ #define js_map_gcroot_stop 1 /* stop mapping entries */ #define js_map_gcroot_remove 2 /* remove and free the current entry */ typedef int (*jsgcrootmapfun)(void *rp, const char *name, void *data); description call js_mapgcroots to map the gc's roots table using map(rp, name, data). the root is pointed at by rp; if the root is unnamed, name is null; data is suppl...
...char *name, void *data); description call js_mapgcroots to map the gc's roots table using map(rp, name, data). the root is pointed at by rp; if the root is unnamed, name is null; data is supplied from the third parameter to js_mapgcroots. the map function should return js_map_gcroot_remove to cause the currently enumerated root to be removed. to stop enumeration, return js_map_gcroot_stop. to continue mapping, return js_map_gcroot_next. these constants are flags; you can or them together. this function acquires and releases rt's gc lock around the mapping of the roots table, so the map function should run to completion in as few cycles as possible. the map function cannot call js_gc, js_maybegc, js_beginrequest, or any js api entry point that acquires locks, without double-tripping or deadloc...
Parser API
i.e., a statement consisting of a single expression. interface ifstatement <: statement { type: "ifstatement"; test: expression; consequent: statement; alternate: statement | null; } an if statement. interface labeledstatement <: statement { type: "labeledstatement"; label: identifier; body: statement; } a labeled statement, i.e., a statement prefixed by a break/continue label. interface breakstatement <: statement { type: "breakstatement"; label: identifier | null; } a break statement. interface continuestatement <: statement { type: "continuestatement"; label: identifier | null; } a continue statement. interface withstatement <: statement { type: "withstatement"; object: expression; body: statement; } a with statement. inte...
...n right: customexpression body: customstatement isforeach: boolean loc: sourcelocation returns: customstatement callback to produce a custom for-in statement node. the isforeach flag indicates whether the node is a for each statement. breakstatement(label[, loc]) label: customidentifier | null loc: sourcelocation returns: customstatement callback to produce a custom break statement node. continuestatement(label[, loc]) label: customidentifier | null loc: sourcelocation returns: customstatement callback to produce a custom continue statement node. withstatement(obj, body[, loc]) obj: customexpression body: customstatement loc: sourcelocation returns: customstatement callback to produce a custom with statement node. returnstatement(arg[, loc]) arg: customexpression | null loc: so...
Shell global objects
makefinalizeobserver is finalized. resetfinalizecount() reset the value returned by finalizecount(). gcpreservecode() preserve jit code during garbage collections. startgc([n [, 'shrinking']]) start an incremental gc and run a slice that processes about n objects. if shrinking is passesd as the optional second argument, perform a shrinking gc rather than a normal gc. gcslice([n]) start or continue an an incremental gc, running a slice that processes about n objects. abortgc() abort the current incremental gc. fullcompartmentchecks(true|false) if true, check for compartment mismatches before every gc. nondeterministicgetweakmapkeys(weakmap) return an array of the keys in the given weakmap. internalconst(name) query an internal constant for the engine. see internalconst source for th...
...ce a bailout out of ionmonkey (if running in ionmonkey). bailafter(number) start a counter to bail once after passing the given amount of possible bailout positions in ionmonkey. injit() returns true when called within (jit-)compiled code. when jit compilation is disabled this function returns an error string. this function returns false in all other cases. depending on truthiness, you should continue to wait for compilation to happen or stop execution. inion() returns true when called within ion. when ion is disabled or when compilation is abnormally slow to start, this function returns an error string. otherwise, this function returns false. this behaviour ensures that a falsy value means that we are not in ion, but expect a compilation to occur in the future. conversely, a truthy value me...
Web Replay
learn more web replay allows firefox content processes to record their behavior, replay it later, and rewind to earlier states. replaying processes preserve all the same js behavior, dom structures, graphical updates, and most other behaviors that occurred while recording. devtools' debugger and console can be used to inspect and control the replay. getting started to enable web replay (macos and firefox nightly only), go to devtools settings and select "enable webreplay". web replay's features can only be used in a tab that is recording or replaying. ...
...me point in execution, and the contents of the debug objects are only valid until the middleman notifies the child process that it can resume forward execution or must rewind to an earlier snapshot. when the child process pauses again (at a breakpoint, say) the debug objects must be reconstructed. there is an exception to this, for scripts and script source objects; debug objects for these will continue to hold the same referent after resuming or rewinding the replaying process. this is necessary for script breakpoints to work, and is implemented by ensuring that the ordering of creation of scripts and script sources is deterministic (mainly by disabling off thread parsing, which is one of the behavior changes during recording/replay). the user's interface to the devtools for a child process i...
IAccessibleText
are 0s. s_ok. ncharacters() returns total number of characters. [propget] hresult ncharacters( [out] long ncharacters ); parameters ncharacters missing description return value s_ok. newtext() returns any inserted text(). provided for use by the ::ia2_event_text_inserted and ::ia2_event_text_updated event handlers. this data is only guaranteed to be valid while the thread notifying the event continues. once the handler has returned, the validity of the data depends on how the server manages the life cycle of its objects. also, note that the server may have different life cycle management strategies for controls depending on whether or not a control manages its children. lists, trees, and tables can have a large number of children and thus it's possible that the child objects for those control...
...ndow coordinates. offset index of the character under the given point or -1 if the point is invalid or there is no character under the point. return value e_invalidarg if bad [in] passed, [out] value is 0. s_ok. oldtext() returns any removed text(). provided for use by the ia2_event_text_removed/updated event handlers. this data is only guaranteed to be valid while the thread notifying the event continues. once the handler has returned, the validity of the data depends on how the server manages the life cycle of its objects. also, note that the server may have different life cycle management strategies for controls depending on whether or not a control manages its children. lists, trees, and tables can have a large number of children and thus it's possible that the child objects for those control...
nsIChannelEventSink
nsichannel newchannel, in unsigned long flags, in nsiasyncverifyredirectcallback callback); void onchannelredirect(in nsichannel oldchannel, in nsichannel newchannel, in unsigned long flags); obsolete since gecko 2.0 constants constant value description redirect_temporary 1 << 0 this is a temporary redirect. new requests for this resource should continue to use the uri of the old channel. the new uri may be identical to the old one. redirect_permanent 1 << 1 this is a permanent redirect. new requests for this resource should use the uri of the new channel (this might be an http 301 reponse). if this flag is not set, this is a temporary redirect. the new uri may be identical to the old one. redirect_internal ...
...) called when a redirect occurs. this may happen due to an http 3xx status code. this method notifies the sink that a redirect is about to happen, but also to gives the sink the right to veto the redirect by throwing an exception or passing a failure code in the callback. note: vetoing the redirect simply means that newchannel will not be opened. it is important to understand that oldchannel will continue loading as if it received a response of http 200, which includes notifying observers and possibly display or process content attached to the http response. if the sink wants to prevent this loading it must explicitly deal with it, e.g. by calling oldchannel->cancel() there is a certain freedom in implementing this method: if the return-value indicates success, a callback on callback is required. ...
nsIMsgFilterCustomAction
*/ readonly attribute boolean isasync; /// does this action need the message body? readonly attribute boolean needsbody; }; ...
... in nsimsgcopyservicelistener copylistener, in nsmsgfiltertypetype filtertype, in nsimsgwindow msgwindow); /* does this action start an async action? if so, a copy listener must * be used to continue filter processing after the action. this only * applies to after-the-fact (manual) filters. call onstopcopy when done * using the copylistener to continue. */ readonly attribute boolean isasync; /// does this action need the message body? readonly attribute boolean needsbody; }; ...
nsIZipWriter
ire queue has been processed or an error occurs. the observer is notified when the first operation begins and when the last operation completes. any failures are passed to the observer. the zip writer will be busy until the queue is complete or an error halts processing of the queue early. in the event of an early failure, the remaining items stay in the queue; calling processqueue() again will continue where operations left off. void processqueue( in nsirequestobserver aobserver, in nsisupports acontext ); parameters aobserver the observer to receive notifications from the queue. acontext the context to pass to the observer. exceptions thrown ns_error_not_initialized no zip file is open. ns_error_in_progress the queue is already in progress. removeentry() removes an entr...
...s()) { var entry = direntries.getnext().queryinterface(ci.nsifile); //entry is instance of nsifile so here https://developer.mozilla.org/docs/xpcom_interface_reference/nsifile if (entry.path == xpi.path) { cu.reporterror('skipping entry - will not add this entry to the zip file - as this is the zip itself: "' + xpi.path + '" leafname:"' + xpi.leafname + '"'); continue; } if (entry.isdirectory()) { dirarr.push(entry); } var relpath = entry.path.replace(dirarr[0].path, ''); //need relative because we need to use this for telling addentryfile where in the zip it should create it, and because zip is a copy of the directory cu.reporterror('+' + relpath); //makes it relative to directory the parent dir (...
Storage
storage is a sqlite database api. it is available to trusted callers, meaning extensions and firefox components only. the api is currently "unfrozen", which means it is subject to change at any time; in fact, it has changed somewhat with each release of firefox since it was introduced, and will likely continue to do so for a while. note: storage is not the same as the dom:storage feature which can be used by web pages to store persistent data or the session store api (an xpcom storage utility for use by extensions). getting started this document covers the storage api and some peculiarities of sqlite. it does not cover sql or "regular" sqlite. you can find some very useful links in the see also section however. for storage api help, you can post to mozilla.dev.apps.platform on the news...
...y, it is important to make sure you reset your statement. you can accomplish this by calling mozistoragestatement.reset() on the statement. if you end up finalizing the statement (see mozistoragestatement.finalize()) you do not need to worry about calling mozistoragestatement.reset(). you should do this before you reuse the statement. warning: if you fail to reset a write statement, it will continue to hold a lock on the database preventing future writes or reads. additionally, if you fail to reset a read statement, it will prevent any future writes to the database. in javascript, the language makes it pretty easy to ensure that you always reset a statement. be aware that you should always reset even if an exception is thrown, so your code should look something like this: var statement = ...
Getting Started Guide
hat any function that creates or returns an interface pointer will have already addrefed it. the caller can then hold onto the reference indefinitely, calling release when it no longer needs it. when the last pointer to an interface is released, the interface (and consequently, typically the underlying object) will delete itself. as long as there is an outstanding addref against the interface, it continues to exist. if you forget to call release, the object will leak, i.e., the storage for that object will never be reclaimed. leaks are bad :-). a reference through which you will call addref and release is called an owning reference. it holds a stake in the underlying object. that object cannot go away until the owning reference has relinquished its claim. not all references need to be owning refe...
... ...
Migrating from Firebug - Firefox Developer Tools
the command line api in firebug provides some special functions for your convenience. the developer tools command line has some functions in common, but also has some other functions and misses others. console api to log things to the console from within the web page firebug makes a console api available within the page. the developer tools share the same api, so your console.* statements will continue to work. persist logs in firebug you can click the persist button within the toolbar to keep the logged messages between page navigations and reloads. in the devtools this option is called enable persistent logs and is available within the toolbox options panel. server logs firebug extensions like firephp allow to log server-side messages to the firebug console. this functionality is already ...
...urrently only allow to set script breakpoints. xhr, dom, cookie and error breakpoints are not supported yet (see bug 821610, bug 1004678, bug 895893 and bug 1165010). while there are no breakpoints for single javascript errors, there is a setting pause on exceptions within the debugger panel options. step through code once the script execution is stopped, you can step through the code using the continue (f8), step over (f10), step into (f11) and step out (shift+f11) options. they work the same in both tools. examine call stack when the script execution is paused, firebug displays the function call stack within its stack side panel. in there the functions are listed together with their call parameters. in the devtools the function call stack is shown within the call stack side panel. to see the...
msAudioCategory - Web APIs
value include a description of the property's value, including data type and what it represents. value description background capable? alert looping or longer running alert sounds: alarms ring tones ringing notification sounds that need to attenuate existing audio no backgroundcapablemedia for audio that needs to continue playing in the background. examples include the following local media playback scenarios: local playlist streaming radio streaming playlist music videos streaming audio/radio, youtube, netflix, etc. yes communications for streaming communication audio such as the following: voip real time chat or other type of phone calls ...
... no if msaudiodevicetype is not explicitly set, msaudiodevicetype will be set to communications. for hardware audio offload to be automatically applied, the audio category must be set to foregroundonlymedia or backgroundcapablemedia. hardware audio offload optimizes audio rendering which can improve functionality and battery life. example <audio msaudiocat...
IDBCursor - Web APIs
Web › API › IDBCursor
ns the cursor's current effective primary key. if the cursor is currently being iterated or has iterated outside its range, this is set to undefined. the cursor's primary key can be any data type. idbcursor.request read only returns the idbrequest that was used to obtain the cursor. methods idbcursor.advance() sets the number of times a cursor should move its position forward. idbcursor.continue() advances the cursor to the next position along its direction, to the item whose key matches the optional key parameter. idbcursor.continueprimarykey() sets the cursor to the given index key and primary key given as arguments. idbcursor.delete() returns an idbrequest object, and, in a separate thread, deletes the record at the cursor's position, without changing the cursor's position. th...
...db.transaction(['rushalbumlist'], "readonly"); var objectstore = transaction.objectstore('rushalbumlist'); objectstore.opencursor().onsuccess = function(event) { var cursor = event.target.result; if(cursor) { var listitem = document.createelement('li'); listitem.innerhtml = cursor.value.albumtitle + ', ' + cursor.value.year; list.appendchild(listitem); cursor.continue(); } else { console.log('entries all displayed.'); } }; } specifications specification status comment indexed database api 2.0the definition of 'cursor' in that specification. recommendation initial definition indexed database api draftthe definition of 'cursor' in that specification. recommendation added continueprimarykey() and supp...
IDBCursorSync - Web APIs
api represents a cursor for iterating over multiple records in a database. you can have only one instance of idbcursorsync representing a cursor, but you can have an unlimited number of cursors at the same time. operations are performed on the underlying index or object store. it enables an application to synchronously process all the records in the cursor's range. method overview bool continue (in optional any key); void remove () raises (idbdatabaseexception); attributes attribute type description count readonly unsigned long long the total number of objects that share the current key. direction readonly unsigned short the direction of traversal of the cursor. see constants for possible values. key readonly ...
... 1 this cursor does not include duplicates, and its direction is monotonically increasing in the order of keys. prev 2 this cursor includes duplicates, and its direction is monotonically decreasing in the order of keys. prev_no_duplicate 3 this cursor does not include duplicates, and its direction is monotonically decreasing in the order of keys. methods continue() advances the cursor to the next position along its direction, to the item whose key matches the optional key parameter. if no key is specified, advance to the immediate next position. returns false if the cursor has reached the end of its range; otherwise returns true. bool continue ( in optional any key ); parameters key the key to which to move the cursor's position. remove() del...
MediaRecorder.requestData() - Web APIs
taavailable event containing a blob object of the captured media as it was when the method was called. this can then be grabbed and manipulated as you wish. when the requestdata() method is invoked, the browser queues a task that runs the following steps: if mediarecorder.state is not "recording", raise a dom invalidstate error and terminate these steps. if mediarecorder.state is "recording", continue to the next step. raise a dataavailable event containing a blob of the currently captured data (the blob is available under the event's data attribute.) create a new blob and place subsequently captured data into it. syntax mediarecorder.requestdata() errors an invalidstate error is raised if the requestdata() method is called while the mediarecorder object’s mediarecorder.state is not "...
...ta() errors an invalidstate error is raised if the requestdata() method is called while the mediarecorder object’s mediarecorder.state is not "recording" — the media cannot be captured if recording is not occurring. example ... capturemedia.onclick = function() { mediarecorder.requestdata(); // makes snapshot available of data so far // ondataavailable fires, then capturing continues // in new blob } ... specifications specification status comment mediastream recordingthe definition of 'mediarecorder.requestdata()' in that specification. working draft initial definition ...
RTCPeerConnection.restartIce() - Web APIs
lication that it should perform negotiation using its signaling channel. if negotiation fails to complete—either due to rollback or because incoming offers are in the process of being negotiated—the rtcpeerconnection will remember that you requested ice restart. the next time the connection's signalingstate changes to stable, the connection will fire the negotiationneeded event. this process continues until an ice restart has been successfully completed. syntax rtcpeerconnection.restartice(); parameters none. return value undefined. usage notes after calling restartice(), the next offer created using createoffer() will initiate ice restart once sent to the remote peer over your signaling mechanism. restarting ice essentially resets ice so that it creates all new candidates using new c...
...lly completed. syntax rtcpeerconnection.restartice(); parameters none. return value undefined. usage notes after calling restartice(), the next offer created using createoffer() will initiate ice restart once sent to the remote peer over your signaling mechanism. restarting ice essentially resets ice so that it creates all new candidates using new credentials. existing media transmissions continue uninterrupted during this process. for details about how ice restart works, see ice restart in lifetime of a webrtc session and rfc 5245, section 9.1.1.1: ice specification. example this example creates a handler for the iceconnectionstatechange event that handles a transition to the failed state by restarting ice in order to try again. pc.addeventlistener("iceconnectionstatechange", event =>...
Touch events - Web APIs
this is done by looking at each touch's touch.identifier property. this property is a unique integer for each touch and remains consistent for each event duri...
...al tips this section provides additional tips on how to handle touch events in your web application. handling clicks since calling preventdefault() on a touchstart or the first touchmove event of a series prevents the corresponding mouse events from firing, it's common to call preventdefault() on touchmove rather than touchstart. that way, mouse events can still fire and things like links will continue to work. alternatively, some frameworks have taken to refiring touch events as mouse events for this same purpose. (this example is oversimplified and may result in strange behavior. it is only intended as a guide.) function ontouch(evt) { evt.preventdefault(); if (evt.touches.length > 1 || (evt.type == "touchend" && evt.touches.length > 0)) return; var newevt = document.createevent("...
USBEndpoint - Web APIs
their type and direction. let inendpoint = undefined; let outendpoint = undefined; for (const interface of device.configuration.interfaces) { // only support devices with out multiple alternate interfaces. const alternate = interface.alternates[0]; // identify the interface implementing the usb cdc class. ...
... only support devices with out multiple alternate interfaces. const alternate = interface.alternates[0]; // identify the interface implementing the usb cdc class. const usb_cdc_class = 10; if (alternate.interfaceclass != usb_cdc_class) { continue; } for (const endpoint of alternate.endpoints) { // identify the bulk transfer endpoints. if (endpoint.type != "bulk") { continue; } if (endpoint.direction == "in") { inendpoint = endpoint.endpointnumber; } else if (endpoint.direction == "out") { outendpoint = endpoint.endpointnumber; } } } specifications specification status comment webusbthe definition of 'usbendpoint' in that specification. draft initial definition. ...
Writing WebSocket servers - Web APIs
--------+ |f|r|r|r| opcode|m| payload len | extended payload length | |i|s|s|s| (4) |a| (7) | (16/64) | |n|v|v|v| |s| | (if payload len==126/127) | | |1|2|3| |k| | | +-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - + | extended payload length continued, if payload len == 127 | + - - - - - - - - - - - - - - - +-------------------------------+ | |masking-key, if mask set to 1 | +-------------------------------+-------------------------------+ | masking-key (continued) | payload data | +-------------------------------- - - - - - - - - - - - - - - - + : ...
...7 | + - - - - - - - - - - - - - - - +-------------------------------+ | |masking-key, if mask set to 1 | +-------------------------------+-------------------------------+ | masking-key (continued) | payload data | +-------------------------------- - - - - - - - - - - - - - - - + : payload data continued ... : + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + | payload data continued ... | +---------------------------------------------------------------+ the mask bit tells whether the message is encoded. messages from the client must be masked, so your server must expect this to be 1. (in fact, section 5.1 of the s...
Using XMLHttpRequest - Web APIs
this.contenttype === "multipart\/form-data" ? 3 : this.contenttype === "text\/plain" ? 2 : 1 : 0; this.receiver = otarget.action; this.status = 0; this.segments = []; var ffilter = this.technique === 2 ? plainescape : escape; for (var nitem = 0; nitem < otarget.elements.length; nitem++) { ofield = otarget.elements[nitem]; if (!ofield.hasattribute("name")) { continue; } sfieldtype = ofield.nodename.touppercase() === "input" ? ofield.getattribute("type").touppercase() : "text"; if (sfieldtype === "file" && ofield.files.length > 0) { if (this.technique === 3) { /* enctype is multipart/form-data */ for (nfile = 0; nfile < ofield.files.length; nfile++) { ofile = ofield.files[nfile]; osegmreq = new fi...
... ofield.getattribute("type").touppercase() : "text"; if (sfieldtype === "file") { for (nfile = 0; nfile < ofield.files.length; ssearch += "&" + escape(ofield.name) + "=" + escape(ofield.files[nfile++].name)); } else if ((sfieldtype !== "radio" && sfieldtype !== "checkbox") || ofield.checked)...
Architecture - Accessibility
ter until a non-embed is found. if the current character falls within a text substring, locate the line ending of that substring or the next embed, whichever comes first: get the current line start and end offsets. ...
... if the character at the offset is an embed, proceed to its corresponding accessible and recurse on the first character until a non-embed is found. otherwise, the offset marks the start of a new line. navigating to the next word follows a similar pattern. ...
Ordering Flex Items - CSS: Cascading Style Sheets
...
... browsers. this has now been fixed. you should always take the source order as the logical order of the document as all up-to-date user agents will be following the specification and doing so. in the live example below i have added a focus style in order that as you tab from link to link you can see which is highlighted. if you change the order using flex-direction you can see how the tab order continues to follow the order that the items are listed in the source. in the same way that changing the value of flex-direction does not change the order in which items are navigated to, changing this value does not change paint order. it is a visual reversal of the items only. the order property in addition to reversing the order in which flex items are visually displayed, you can target individual...
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
e</div> <div>four</div> <div>five</div> </div> default rules for auto-placement as you can see with the above example, if you create a grid all child items will lay themselves out one into each grid cell. the default flow is to arrange items by row. grid will lay an item out into each cell of row 1. if you have created additional rows using the grid-template-rows property then grid will continue placing items in these rows. if the grid does not have enough rows in the explicit grid to place all of the items new implicit rows will be created. sizing rows in the implicit grid the default for automatically created rows in the implicit grid is for them to be auto-sized. this means that they will contain the content added to them without causing an overflow. you can however control the siz...
.... <br>max is auto <br>so the row expands. </div> <div>five</div> </div> .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 10px; grid-auto-rows: minmax(100px, auto); } you can also pass in a track listing, this will repeat. the following track listing will create an initial implicit row track as 100 pixels and a second as 200px. this will continue for as long as content is added to the implicit grid. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div>one</div> <div>two</div> <div>...
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
o the end of the grid. @media (min-width: 500px) { .side { grid-column: col-start / span 3; grid-row: 3; } .ad { grid-column: col-start / span 3; grid-row: 4; } .content, .main-footer { grid-column: col-start 4 / span 9; } nav ul { display: flex; justify-content: space-between; } } finally we go to the three-column version of this layout. the header continues to span right across the grid, but now the navigation moves down to become the first sidebar, with the content and then the sidebar next to it. the footer now also spans across the full layout. @media (min-width: 700px) { .main-nav { grid-column: col-start / span 2; grid-row: 2 / 4; } .content { grid-column: col-start 3 / span 8; grid-row: 2 / 4; } .side { grid-col...
...g .wide { grid-column-end: span 2; } this technique of using auto-placement with some rules applied to certain items is very useful, and can help you to deal with content that is being output by a cms for example, where you have repeated items and can perhaps add a class to certain ones as they are rendered into the html. further exploration the best way to learn to use grid layout is to continue to build examples like the ones we have covered here. pick something that you normally build using your framework of choice, or using floats, and see if you can build it using grid. don’t forget to find examples that are impossible to build with current methods. that might mean taking inspiration from magazines or other non-web sources. grid layout opens up possibilities that we have not had be...
Adapting to the new two-value syntax of display - CSS: Cascading Style Sheets
xtend out from the boundaries) and our content lays out in normal flow, using block and inline layout, unless we change the value of display to use some other formatting context. creating a grid or flex container also creates a new formatting context (a grid or flex formatting context, respectively.) these also contain everything inside them. however, if you want to contain floats and margins but continue using block and inline layout, you can create a new flow root, and start over with block and inline layout. from that point downwards everything is contained inside the new flow root. the two-value syntax for display: flow-root being display: block flow-root therefore makes a lot of sense. you are creating a block formatting context, with a block-level box and children participating in normal fl...
...tion explains what to do if only the outer value of block or inline is used: "if a <display-outside> value is specified but <display-inside> is omitted, the element’s inner display type defaults to flow." this means that the behavior is exactly as it is in a single value world. if you specify display: block or display: inline, that changes the outer display value of the box but any children continue in normal flow. if only an inner value of flex, grid, or flow-root is specified then the specification explains that the outer value should be set to block: "if a <display-inside> value is specified but <display-outside> is omitted, the element’s outer display type defaults to block—except for ruby, which defaults to inline." finally, we have some legacy pre-composed inline-level values ...
Getting Started - Developer guides
n all of your pages or you will get a "permission denied" error when you call open(). a common pitfall is accessing your site by domain.tld, but attempting to call pages with www.domain.tld. if you really need to send a request to another domain, see http access control (cors). the optional third parameter sets whether the request is asynchronous. if true (the default), javascript execution will continue and the user can interact with the page while the server response has yet to arrive. this is the first a in ajax. the parameter to the send() method can be any data you want to send to the server if post-ing the request. form data should be sent in a format that the server can parse, like a query string: "name=value&anothername="+encodeuricomponent(myvar)+"&so=on" or other formats, like multi...
...r response when you sent the request, you provided the name of a javascript function to handle the response: httprequest.onreadystatechange = nameofthefunction; what should this function do? first, the function needs to check the request's state. if the state has the value of xmlhttprequest.done (corresponding to 4), that means that the full server response was received and it's ok for you to continue processing it. if (httprequest.readystate === xmlhttprequest.done) { // everything is good, the response was received. } else { // not ready yet. } the full list of the readystate values is documented at xmlhttprequest.readystate and is as follows: 0 (uninitialized) or (request not initialized) 1 (loading) or (server connection established) 2 (loaded) or (request received) 3 (int...
Proxy Auto-Configuration (PAC) file - HTTP
host:port the specified socks server (with the specified sock version) should be used if there are multiple semicolon-separated settings, the left-most setting will be used, until firefox fails to establish the connection to the proxy. in that case, the next value will be used, etc. the browser will automatically retry a previously unresponsive proxy after 30 minutes. ...
... examples proxy w3proxy.netscape.com:8080; proxy mozilla.netscape.com:8081 primary proxy is w3proxy:8080; if that goes down start using mozilla:8081 until the primary proxy comes up again. ...
HTTP response status codes - HTTP
Web › HTTP › Status
...
...ily. further changes in the uri might be made in the future. therefore, this same uri should be used by the client in future requests. 303 see other the server sent this response to direct the client to get the requested resource at another uri with a get request. 304 not modified this is used for caching purposes. it tells the client that the response has not been modified, so the client can continue to use the same cached version of the response. 305 use proxy defined in a previous version of the http specification to indicate that a requested response must be accessed by a proxy. it has been deprecated due to security concerns regarding in-band configuration of a proxy. 306 unused this response code is no longer used; it is just reserved. it was used in a previous version of the http/...
Statements and declarations - JavaScript
oup of keywords. statements and declarations by category for an alphabetical listing see the sidebar on the left. control flow block a block statement is used to group zero or more statements. the block is delimited by a pair of curly brackets. break terminates the current loop, switch, or label statement and transfers program control to the statement following the terminated statement. continue terminates execution of the statements in the current iteration of the current or labeled loop, and continues execution of the loop with the next iteration. empty an empty statement is used to provide no statement, although the javascript syntax would expect one. if...else executes a statement if a specified condition is true. if the condition is false, another statement can be executed. sw...
...lable, this statement has no effect. export used to export functions to make them available for imports in external modules, and other scripts. import used to import functions exported from an external module, another script. import.meta an object exposing context-specific metadata to a javascript module. label provides a statement with an identifier that you can refer to using a break or continue statement. with extends the scope chain for a statement. specifications specification ecmascript (ecma-262)the definition of 'ecmascript language: statements and declarations' in that specification. ...
Populating the page: how browsers work - Web Performance
ocument. the <html> element is the first tag and root node of the document tree. the tree reflects the relationships and hierarchies between different tags. tags nested within other tags are child nodes. the greater the number of dom nodes, the longer it takes to construct the dom tree. when the parser finds non-blocking resources, such as an image, the browser will request those resources and continue parsing. parsing can continue when a css file is encountered, but <script> tags—particularly those without an async or defer attribute—block rendering, and pause the parsing of html. though the browser's preload scanner hastens this process, excessive scripts can still be a significant bottleneck. preload scanner while the browser builds the dom tree, this process occupies the main thread. ...
.... layers do improve performance, but are expensive when it comes to memory management, so should not be overused as part of web performance optimization strategies. compositing when sections of the document are drawn in different layers, overlapping each other, compositing is necessary to ensure they are drawn to the screen in the right order and the content is rendered correctly. as the page continues to load assets, reflows can happen (recall our example image that arrived late). a reflow sparks a repaint and a re-composite. had we defined the size of our image, no reflow would have been necessary, and only the layer that needed to be repainted would be repainted, and composited if necessary. but we didn't include the image size! when the image is obtained from the server, the rendering pro...
Communicating using "port" - Archive of obsolete content
t scripts. to enable add-on scripts and content scripts to communicate with each other, each end of the conversation has access to a port object. to send messages from one side to the other, use port.emit() to receive messages sent from the other side, use port.on() messages are asynchronous: that is, the sender does not wait for a reply from the recipient but just emits the message and continues processing. here's a simple add-on that sends a message to a content script using port: var tabs = require("sdk/tabs"); var alertcontentscript = "self.port.on('alert', function(message) {" + " window.alert(message);" + "})"; tabs.on("ready", function(tab) { worker = tab.attach({ contentscript: alertcontentscript }); worker.port.emi...
Content Scripts - Archive of obsolete content
th the add-on to enable add-on scripts and content scripts to communicate with each other, each end of the conversation has access to a port object. to send messages from one side to the other, use port.emit() to receive messages sent from the other side, use port.on() messages are asynchronous: that is, the sender does not wait for a reply from the recipient but just emits the message and continues processing. here's a simple add-on that sends a message to a content script using port: // main.js var tabs = require("sdk/tabs"); var self = require("sdk/self"); tabs.on("ready", function(tab) { var worker = tab.attach({ contentscriptfile: self.data.url("content-script.js") }); worker.port.emit("alert", "message from the add-on"); }); tabs.open("http://www.mozilla.org"); // cont...
XUL Migration Guide - Archive of obsolete content
e the security and compatibility benefits of using the sdk. using the low-level apis in addition to the high-level apis, the sdk includes a number of low-level apis some of which, such xhr and window/utils, expose powerful browser capabilities. but note that unlike the supported apis, low-level apis do not come with a compatibility guarantee, so we do not expect code using them will necessarily continue to work as new versions of firefox are released. in this section we'll use low-level modules how to: modify the browser chrome using dynamic manipulation of the dom directly access the tabbrowser object modifying the browser chrome this example uses the action button api, which is only available from firefox 29 onwards. the window/utils module gives you direct access to chrome windows...
indexed-db - Archive of obsolete content
"], "readwrite"); var store = trans.objectstore("items"); var items = new array(); trans.oncomplete = function() { cb(items); } var keyrange = idbkeyrange.lowerbound(0); var cursorrequest = store.opencursor(keyrange); cursorrequest.onsuccess = function(e) { var result = e.target.result; if(!!result == false) return; items.push(result.value.name); result.continue(); }; cursorrequest.onerror = database.onerror; }; function listitems(itemlist) { console.log(itemlist); } open("1"); var add = require("sdk/ui/button/action").actionbutton({ id: "add", label: "add", icon: "./add.png", onclick: function() { additem(require("sdk/tabs").activetab.title); } }); var list = require("sdk/ui/button/action").actionbutton({ id: "list", label: ...
test/httpd - Archive of obsolete content
this module was removed in firefox 36, please use the addon-httpd npm module instead. an http server for the mozilla platform, which can be used in unit tests. usage the most basic usage is: var { startserverasync } = require("sdk/test/httpd"); var srv = startserverasync(port, basepath); require("sdk/system/unload").when(function cleanup() { srv.stop(function() { // you should continue execution from this point. }) }); this starts a server in background (assuming you're running this code in an application that has an event loop, such as firefox). the server listens at http://localhost:port/ and serves files from the specified directory. you can serve static content or use sjs scripts, as described in documentation on developer.mozilla.org. you can also use nshttpserver to start the se...
ui/sidebar - Archive of obsolete content
ill be hidden for the currently active window. this parameter is new in firefox 33. on(type, listener) registers an event listener with the sidebar. parameters type : string the type of event to listen for. listener : function the listener function that handles the event. once(type, listener) registers an event listener with the sidebar. the difference between on and once is that on will continue listening until it is removed, whereas once is removed automatically upon the first event it catches. parameters type : string the type of event to listen for. listener : function the listener function that handles the event. removelistener(type, listener) unregisters/removes an event listener from the sidebar. parameters type : string the type of event for which listener was registered...
util/deprecate - Archive of obsolete content
experimental functions to deprecate code. globals functions deprecatefunction(fun, msg) dump to the console the error message given in the second argument, prefixed with "deprecated:", and print the stacktrace; then execute the function passed as first argument and returns its value. it does not raise an exception, but just displays the error message and continues to execute the function. this function is mostly used to flag usage of deprecated functions, that are still available but which we intend to remove in a future release. parameters fun : function the function to execute after the error message msg : string the error message to display returns * : the returned value from fun deprecateusage(msg) dump to the console the error message given, prefixed with "deprecated:", and...
Modifying Web Pages Based on URL - Archive of obsolete content
"my-script.js"), // send the content script a message inside onattach onattach: function(worker) { worker.port.emit("replacepage", "page matches ruleset"); } }); the replacepage message isn't a built-in message: it's a message defined by the add-on in the port.emit() call. injecting css note that the feature described in this section is experimental at the moment. we'll most likely continue to support the feature, but api details may change. rather than injecting javascript into a page, you can inject css by setting the page-mod's contentstyle option. var pagemod = require("sdk/page-mod").pagemod({ include: "*", contentstyle: "body {" + " border: 5px solid green;" + "}" }); as with contentscript, there's a corresponding contentstylefile optio...
JavaScript Debugger Service - Archive of obsolete content
note that the jsdifilter only applies to jsdiexecutionhooks, which are breakpointhook, debughook, debuggerhook, interrupthook and throwhook. note that filters are matched in a first in, first compared fashion. the first filter to match determines whether or not the hook is called. we create a g...
Enhanced Extension Installation - Archive of obsolete content
cation from the hash of registered install locations. item type install.rdf install manifests should now specify a <em:type> property which tells the extension system what their type is. types are defined in nsiupdateservice.idl on the nsiupdateitem interface. the types at the time of writing include: 2 - extension 4 - theme 8 - locale for backward compatibility the extension system will continue to assume an item is an extension by default, and a theme if the item has a <em:internalname> property, but extension and theme authors should be good citizens and upgrade their install manifests to include the type. the type information supplied or inferred will be added to the extensions datasource. tracking item type we still track the item type at this stage by looking at containment. see ...
How to convert an overlay extension to restartless - Archive of obsolete content
more resource:// uris for files internal to your bundle unfortunately, resource mappings in your chrome.manifest were not usable in restartless add-ons until mozilla finally fixed this bug in firefox 38, which looked bad, but only because mozilla is still using resource:// uris internally and in examples. resource mappings for files in the mozilla distribution, such as services.jsm (above), will continue to work. in overlay extensions, you can place a resource mapping in the chrome.manifest for your add-on and load your own jsm from resource:// uris. it's a great way to modularize your code that's been available since firefox 3. you can use chrome:// uris with "components.utils.import()" just fine; in fact you've been able to since firefox 4. however, because it was implemented first for only fil...
Listening to events in Firefox extensions - Archive of obsolete content
unload 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 unload handler, use the new pagehide event. pageshow event this event works t...
Appendix: What you should know about open-source software licenses - Archive of obsolete content
tents, drm, internationally applied licenses, and other new challenges coming into focus. to respond to these challenges, the free software foundation has revised the gpl to version 3. draft 1 was first circulated in september 2006, and after four drafts, it was published in june 2007. linus torvalds, a developer behind the linux kernel, raised objections to gplv3 in the draft process, and linux continues to usegplv2. in any case, the choice of license is up to the copyright holder—the developer. it’s important to thoroughly understand the license you choose and make a choice that strikes a good balance in terms of utility to the creator and the user. references the open source definition http://www.opensource.org/docs/definition.html the freebsd copyright http://www.freebsd.org/copyrig...
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
o...
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
from a remote location becomes a security vulnerability when parsed with the eval function. basically, you are executing remote code with full chrome access; that is, introducing a remote code execution vulnerability. even if you trust the remote server; for example, because it is one you rent and administer yourself, there is a huge security risk, because of, but not limited to: you might discontinue your project or sell it, so that it is possible another person with malicious intentions takes over your domain. the server and/or domain name might be compromised. if using an unencrypted, insecure connection, a man-in-the-middle attacker might replace the json with attack code before it arrives at the user. use native json since firefox 3.5 you should use json. really, just use it! note: ...
Connecting to Remote Content - Archive of obsolete content
you to set the content type of the request and to pass the post data to the send() method as below. request.open("post", url, true); request.setrequestheader("content-type", "application/x-www-form-urlencoded"); request.send("data=hello&version=2"); the third parameter for the open method specifies whether the request should be handled asynchronously or not. in asynchronous mode code execution continues immediately after the send call. in synchronous mode the code and user interface are blocked while waiting for a response to come back. note: requests can take a long time to process and you don't want users to be stuck waiting while a request is obtained and processed. therefore, it is very important that xmlhttprequest calls are always done asynchronously. now let's look at the most common t...
Appendix E: DOM Building and Insertion (HTML & XUL) - Archive of obsolete content
nt var elemns = namespace(elemnameorarray); var elem = doc.createelementns(elemns.namespace || jsontodom.defaultnamespace, elemns.shortname); // set element's attributes and/or callback functions (eg. ...
XPCOM Objects - Archive of obsolete content
et of attributes and methods that an object implementing it should have. xpcom components can implement multiple interfaces, and they often do. let's look at the preference service as an example of this. we'll look at its documentation in a very old xul site called xul planet. all of its documentation was planned to be migrated to mdc, but it looks like it was never finished and xul planet was discontinued. their xpcom documentation is better in terms of seeing the relationships between components and interfaces, so we'll use that. another useful resource is this xpcom reference. this is generated from source, and it's kept relatively up to date. it shows the relationships between components and interfaces, but it's more of a source browser than a documentation reference. stepping into the time ...
Signing an XPI - Archive of obsolete content
rtificate, using the -p option to set a password for the new certificate c:\projects\codesigning\> signtool -g mytestcert -d . -p"password" using certificate directory: . warning: performing this operation while the browser is running could cause corruption of your security databases. if the browser is currently running, you should exit the browser before continuing this operation. enter "y" to continue, or anything else to abort: y enter certificate information. all fields are optional. acceptable characters are numbers, letters, spaces, and apostrophes. certificate common name: xpi test organization: tjworld organization unit: software state or province: nottingham country (must be exactly 2 characters): gb username: tj email address: certificates@lan.tjworld.net generated public/private ke...
Supporting search suggestions in search plugins - Archive of obsolete content
firefox supports search suggestions in opensearch plugins; as the user types in the search bar, firefox queries the url specified by the search plugin to fetch live search suggestions. once the list has been retrieved, it's displayed in a popup box that appears under the search bar, which lets the user select a suggested search term. if the user continues to type, a new set of suggestions is requested from the search engine, and the displayed list is refreshed. implementing suggestion support in the search plugin to support search suggestions, a search plugin needs to define an extra <url> element with its type attribute set to "application/x-suggestions+json". (this means that a suggestion-supporting engine plugin will have two <url> elements, the other one being the main text/html sea...
Using Dependent Libraries In Extension Components - Archive of obsolete content
sometimes need to depend on other shared libraries (for example, libraries provided by a third party). the firefox extension system does not provide automatic support for loading these dependent libraries, but it is possible to load these libraries explicitly using a component stub. the basic strategy of the stub is to dynamically load the dependent libraries, then load the component library and continue registration. sample code is below, and can be built by placing the two files in extensions/stub and configuring with --enable-extensions=stub extension file structure using the stub slightly changes how components are packaged in the extension directory structure. note that the "real" component is no longer in the components/ directory, it is in the libraries/ directory. extension-directory/inst...
List of Mozilla-Based Applications - Archive of obsolete content
aemo uses xulrunner moznet .net control embeddable gecko for .net applications wraps xulrunner for use in .net applications my internet browser localized browser uses gecko myna application server javascript application server for java uses mozilla rhino nextcms (fr) cms nightingale music player community run effort to continue songbird support for linux olpc web browser browser oneteam jabber client opendocument viewer viewer opengate's tools cd burner, file browser, and hardware diagnostic softwares opengate is the opensource side of the easyneuf project, “a free software computer, easy and preinstalled” open mashups development tool ...
MMgc - Archive of obsolete content
ce counting in deferred reference counting, a distinction is made between heap and stack references. stack references to objects tend to be very temporary in nature. stack frames come and go very quickly. so, performance can be gained by not performing reference counting on the stack references. heap references are different since they can persist for long periods of time. so, in a drc scheme, we continue to maintain reference counts in heap-based objects. so, reference counts are only maintained to heap-to-heap references. we basically ignore the stack and registers. they are considered stack memory. zero count table of course, when an object's reference count goes to zero, what happens? if the object was immediately destroyed, that could leave dangling pointers on the stack, since we didn't bump...
Chromeless - Archive of obsolete content
ers to create full blown desktop applications using only web technologies. chromeless apps have access to a collection of javascript apis that provide them with deep desktop integration. one of the core capabilities of the chromeless platform is the ability to safely embed untrusted web applications inside these applications. chromeless vs prism/webrunner prism (an ex-mozilla labs project, now discontinued but kept going independently of mozilla under the [now discontinued] webrunner name) was/is a way to make web pages superficially appear to be native applications. firefox users could choose to turn a web page into a "prism application" and have an icon added to their desktop to launch it without the firefox user interface surrounding the page. however, prism "applications", being web pages, wer...
Getting Started - Archive of obsolete content
ey theme). this is located in the file classic.jar found in the seamonkey 2 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. classic.jar locations 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 directo...
In-Depth - Archive of obsolete content
unch of -x-image-region-left type styles in chrome://navigator/skin/. open up navigator.css, again (if you closed it), and look for the #back-button section. it has a -moz-image-region style in there which you can change. if you look through the rest of this file, you'll also notice that there are regions for the different states of #back-button. change those to match your new image as well. just continue this process for everything that you wish to change and you'll have a new skin in no time. organizing images to organize all of your icons you can store them all in one image and then tell mozilla which portions to use. this is done using the -moz-image-region style. a bunch of 20px x 20px icons in a grid format above is the source image of some icons setup to use the -moz-image-region style. ea...
Creating a Skin for Firefox/Getting Started - Archive of obsolete content
firefox theme. this is located in the file classic.jar found in the firefox 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: ...
Drag and Drop - Archive of obsolete content
e called when the user starts dragging the element, which normally happens when the user holds down the mouse button and moves the mouse. the script in this handler should set up a drag session. ondragstart an alias for ondraggesture; this is the html 5 spec name for the event and may be used in html or xul; however, for backward compatibility with older versions of firefox, you may wish to continue using ondraggesture in xul. ondragover this event handler is called for an element when something is being dragged over top of it. if the object can be dropped on the element, the drag session should be notified. ondragenter called for an element when the mouse pointer first moves over the element while something is being dragged. this might be used to change the appearance of the element t...
Block and Line Layout Cheat Sheet - Archive of obsolete content
n() will crawl the line list to see if a block frame precedes the specified frame. if so, the top margin should be applied, and the flag set to cache the result. (if not, the top margin will be applied as a result of the generational margin collapsing logic in nsblockreflowcontext::computecollapsedtopmargin(). in this case, the flag won't be set, so subsequent calls to shouldapplytopmargin() will continue crawl the line list.) this flag is also set in the nsblockreflowstate constructor if brs_istopmarginroot is set; that is, if the frame being reflowed is a margin root by default. brs_computemaxelementsize this flag is set if reflow should recompute an element's maximum size. it is set in the nsblockreflowstate constructor if the "maxelementsize" member of the nshtmlreflowmetrics object has been...
Java in Firefox Extensions - Archive of obsolete content
from within a firefox extension, you can make use of liveconnect. liveconnect gives your extension's javascript code (linked from or contained in xul code) access to 2 objects: java and packages (note that per this thread, although the new documentation for the liveconnect reimplementation states that these globals will be deprecated (in the context of applets), "firefox and the java plug-in will continue to support the global java/packages keywords, in particular in the context of firefox extensions."). these 2 objects let you make use of the standard jdk classes, e.g., var ajavalist = new java.util.linkedlist(); if you want to load your own jars, then you can create your own java class loader. the following technique only works in javascript code linked from or contained in xul files. if you w...
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
e. you can use two ways to make mozilla behave like internet explorer and not change the color of the text when hovered over: first, you can change the css rule to be a:link:hover {color: green;}, which will only change the color if the element is a link (has an href attribute). alternatively, you can change the markup and close the opened <a /> before the start of the text -- the anchor will continue to work this way. quirks versus standards mode older legacy browsers, such as internet explorer 4, rendered with so-called quirks under certain conditions. while mozilla aims to be a standards-compliant browser, it has three modes that support older web pages created with these quirky behaviors. the page's content and delivery determine which mode mozilla will use. mozilla will indicate the re...
FAQ - Archive of obsolete content
Archive › Mozilla › Prism › FAQ
etc.). is prism a mozilla product? no, prism is not a mozilla product. it is one of the experiments being conducted by mozilla labs to bridge the divide in the user experience between web applications and desktop apps. prism is the codename for the project, and if the functionality provided by prism becomes a product or is integrated into other products (like firefox), then it won't necessarily continue to be called by this codename. is prism a platform? no, prism is not a platform. prism is built on top of the mozilla platform and its gecko rendering engine, just like mozilla firefox, so it provides the same capabilities to web applications that firefox provides, including support for html, javascript, css, and <canvas>. at the same time, we're also working to increase the capabilities of thos...
Remotely debugging Firefox for Metro - Archive of obsolete content
settings, use the default host (localhost) and port (6000), and press the "connect" button. if you are connecting to firefox for metro on a different computer or a different port, enter the appropriate hostname and port number and then press "connect." in the windows 8 (metro) browser next you'll see a dialog in firefox for metro asking you to confirm the connection. press the "ok" button to continue. tip: if the remote connection times out, flip to the desktop via the desktop tile and check if windows firewall has thrown up an incoming connection permissions prompt. on the desktop next, the desktop shows you a dialog that looks something like this: this is asking whether you want to debug web content running in a browser tab, or to debug the browser code itself. you'll see one entry...
Frequently Asked Questions - Archive of obsolete content
l stuff like xtf and jssh. tim is working on implementing <filter> and working on items that need to be done before turning on svg by default. after recently implementing gradients, scooter is working on fixing some issues that remain outstanding and fixing <switch>. jonathan is working on various bugs, especially those that need to be fixed before svg can be enabled in the official builds. david continues to create svg enabled nightlies and answer build related questions as he has done for some time. finally, occasional fixes are provided by other mozilla hackers. how can i get in contact with you? the best way to get in contact with us is to join the #svg channel on mozilla.org's irc server. this is where most of us hang out to discuss issues relating to the svg implementation. if you don't ha...
Table Layout Regression Tests - Archive of obsolete content
warning: the content of this article may be out of date. while the information on the layout debugger is still useful, the testing information is much less relevant now than it has been, as the "rtest" testing framework described here has been superseded by the reftest framework. it is unclear whether or how well rtest continues to work and whether it is still used or not. subject overview changes in layout, parser and content code can have unintended side effects, also known as regressions. it is good style to check for these unwanted regressions and fixing them before checkin rather than causing bugzilla avalanches. prerequisites in order to run these tests, you will need to have: make sure that your build is a debug build (in short you need ac_add_options --enable-debug in...
Cmdline tests - Archive of obsolete content
cmdline/readme document for more information. ...
The new nsString class implementation (1999) - Archive of obsolete content
ing we still offer an nsautostring that provides its own stack based buffer. this very useful class allows programmers to take advantage of the nsstring/nsstrimpl implementation, while eliminating heap based allocations. an additional improvement has been made to nsautostring that allows it to use an arbitrarily sized stack based buffer rather than its own internal buffer. this means that you can continue to use efficient (temporary) stack buffers for string storage with the bonus of storage pools that serve your specific need. (sounds complicated, but it's really easy). this class fully interoperates with nsstring and nsstrimpl. nscstring the new nscstring class shares the same api with nsstring, but uses a 1-byte ascii character storage model. this will allow programmers to use the nsstring api'...
URIs and URLs - Archive of obsolete content
s allow the scheme name to be present in a relative uri if it is the same as the base uri scheme. unfortunately, this can conflict with the correct parsing of non-hierarchical uri. for backwards compatibility, an implementation may work around such references by removing the scheme if it matches that of the base uri and the scheme is known to always use the "hier_part" syntax. the parser can then continue with the steps below for the remainder of the reference components. validating parsers should mark such a misformed relative reference as an error. the decision was made against backwards compatibility. this means that urls like "http:page.html" or "http:/directory/page.html" are interpreted as absolute urls and "corrected" by the parser. also the handling of query segments is different from...
Using gdb on wimpy computers - Archive of obsolete content
libraries. if you don't allow those libraries to be loaded then gdb will not be able to properly debug threads on linux. mozilla uses pthreads for its networking library so you need to be able to work in a threaded environment. the best way to do this is to set a breakpoint in main, let the program run until main and then turn off automatic library loading. from there you can allow the program to continue running. here's an example: [blizzard@gunhead mozilla]$ cd dist/bin/ [blizzard@gunhead bin]$ ./mozilla -g .//run-mozilla.sh -g ./mozilla-bin mozilla_five_home=/home/blizzard/src/mozilla/mozilla/dist/bin ld_library_path=/home/blizzard/src/mozilla/mozilla/dist/bin shlib_path=/home/blizzard/src/mozilla/mozilla/dist/bin libpath=/home/blizzard/src/mozilla/mozilla/dist/bin moz_...
Binding Attachment and Detachment - Archive of obsolete content
l in the set consists of the binding document's url and the binding's document-unique identifier. in the following example, a binding is referenced that will be attached to all html checkbox elements. input[type="checkbox"] { -moz-binding: url("http://www.mozilla.org/xbl/htmlbindings.xml#checkbox"); } bindings attached through css will only remain on the bound element as long as the element continues to match the style rule. if at any time a resolution of style on the element determines that a different binding should be attached, the old binding (and all bindings that it explicitly extends in its inheritance chain) will be detached. no bindings will be attached to elements that match the style rule, but are inside an element that has style display:none set. see bug 307098. whenever an ele...
Flexgroup - Archive of obsolete content
"flexgroup" is used to group flexible elements together and should be set to an integer. elements with a lower flexgroup are flexed first. when those elements have reached their maximum sizes, the elements with the next higher flexgroup are flexed. this process continues until there are no more elements remaining. the same process occurs when decreasing the size, except in the other direction. ...
Building accessible custom components in XUL - Archive of obsolete content
rrent); break; case key_right: spreadsheet_right(current); break; } } </code> second, the code to handle replacing the label with a textbox (to start editing) and the textbox with a label (to finish editing). note that when we recreate the label element after editing, we need to explicitly restore the role attribute of the label, so that assistive technologies will continue to treat it as a cell within the spreadsheet. <code> const xul_ns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; const x2_ns ="http://www.w3.org/tr/xhtml2" function start_edit(label) { var value = label.value; settimeout(function(){ var textbox = document.createelementns(xul_ns, "textbox"); label.parentnode.replacechild(textbox, label); textbox.value = value; text...
Index - Archive of obsolete content
Archive › Mozilla › XUL › Index
by the screen reader. 5 attribute (xul) xul attributes, xul reference no summary! 6 flexgroup "flexgroup" is used to group flexible elements together and should be set to an integer. elements with a lower flexgroup are flexed first. when those elements have reached their maximum sizes, the elements with the next higher flexgroup are flexed. this process continues until there are no more elements remaining. the same process occurs when decreasing the size, except in the other direction. 7 accelerated xul, xul attribute, xul reference no summary! 8 acceltext xul attributes, xul reference no summary! 9 accessible xul attributes, xul reference no summary! 10 accesskey reference, xu...
Menus - Archive of obsolete content
ng the nsimenuboxobject interface: activeitem = xulmenu.boxobject.queryinterface(components.interfaces.nsimenuboxobject).activechild; where xulmenu is the menu, button, or toolbarbutton object. you can set the active item thusly so: xulmenu.boxobject.queryinterface(components.interfaces.nsimenuboxobject).activechild = item; when the active item is set this way, keyboard navigation will now continue from this point. setting activechild to null will deactivate all items, and keyboard navigation will start from the top of the menu. it should be noted that setting the active item in this way will not affect the selected property or selected attribute of the previously and newly activated item. you must unset/set those explicity for each item affected, if you want them to be. for menulists, ...
PopupEvents - Archive of obsolete content
. <panel id="time-panel" onpopupshowing="this.lastchild.value = (new date()).tolocaleformat('%t')"> <label value="time:"/> <label id="time"/> </panel> <toolbarbutton label="show time" popup="time-panel"/> you can prevent a menu or popup from appearing by calling the preventdefault method of the event from within a popupshowing listener. the default operation of the popupshowing event is to continue showing the popup. the preventdefault method will stop this from happening and the popup will not be opened. <menu label="edit"> <menupopup onpopupshowing="if (gdisallowed) event.preventdefault();"> <menuitem label="undo"/> <menuitem label="redo"/> </menupopup> </menu> in this example, a global variable gdisallowed is checked and the preventdefault method is called. if you want to pr...
Bindings - Archive of obsolete content
d to a binding element, but the attributes are the same. this allows a match to occur even if the description is not specified. note that when bindings are used, the bindings and the action must be enclosed inside a rule element. the template builder examines bindings after the query has generated results. it has already determined, in this example, that three matches have been found. the builder continues by filling in the values for any bindings. they are evaluated in a similar though simpler manner than the triples. the value of the ?photo variable is known for each match, the datasource is examined for the description, and the value of the ?description variable is filled in. the effect is three matches, only one of which will display a description. the photos that don't have a description will...
RDF Modifications - Archive of obsolete content
te was different, the builder would come to the end of the statements and could just stop there. for instance, if the predicate of the triple being added was 'http://purl.org/dc/elements/1.1/date', the builder could ignore it since the template doesn't even care about the date field. similarly, if the triple didn't use a variable but a static value, this value would also need to match in order to continue processing. now that we know the statements could cause a change in the template, the second step is to fill in the variables for this statement for what could potentially be a new result. in this situation, it fills in the ?photo and ?description variables using the values from the newly added triple. (?photo = http://www.xulplanet.com/ndeakin/images/t/obelisk.jpg, ?description = 'one of the t...
RDF Query Syntax - Archive of obsolete content
set to the container, in this case, the vbox, and the ?start variable is set to the ref later, but that is a minor detail that doesn't make templates more understandable. for this discussion, assume that so far we have a single potential result as above. the content tag doesn't do anything else at this point, meaning it doesn't add anything else to the network of potential results, so processing continues on to the next statement, the triple, which looks like this: <triple subject="?start" predicate="http://www.xulplanet.com/rdf/relateditem" object="?relateditem"/> the triple statement is used to follow arcs or arrows in the rdf graph. the predicate attribute specifies the labels of the arrows to follow. in the triple used here, the predicate is 'http://www.xulplanet.com/rdf/rela...
Rule Compilation - Archive of obsolete content
builder.rebuild method) will recompile the query and rules and reapply the template again. this means that you can change the rules using dom methods, rebuild the template, and get different results. once the template builder has compiled the rules, query processing and content generation can begin. the template builder generates content lazily, that is, it processes as little as needed, and only continues when necessary. for instance, consider the example below: <vbox datasources="http://www.xulplanet.com/ds/sample.rdf" ref="http://www.xulplanet.com/rdf/a" hidden="true"> <template> ... </template> </vbox> the <vbox> is hidden as indicated by the 'hidden' attribute. since any content that would be generated wouldn't be displayed anyway, the template builder doesn't do anything, p...
Simple Example - Archive of obsolete content
e 'http://purl.org/dc/elements/1.1/title'. in the rdf, the 'palace' resource has a value 'palace from above', so it will be added to the data network, assigned to the ?title variable. note that this value is a literal rather than a resource. (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/palace.jpg, ?title = 'palace from above') the process continues in a similar manner for the other two results. in the end, the network will contain the following data: (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/palace.jpg, ?title = 'palace from above') (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/canal.jpg, ?title = 'canal') (?start = http://w...
Adding more elements - Archive of obsolete content
er style="width: 10px;"/> <textbox id="find-text" flex="1" style="min-width: 15em;"/> </groupbox> there are other cosmetic problems as well. we could also have the groupbox grow so that it extends vertically to the bottom of the box. also, we could modify some of the margins so that the elements are positioned better. we will see more examples of the box model and some of its features as we continue to add elements throughout the tutorial. find files example so far source view next, we will look at how to create stacks. « previousnext » ...
Broadcasters and Observers - Archive of obsolete content
"isoffline"/> the observes attribute has been placed on the button and its value has been set to the value of the id on the broadcaster to observe. here the button will observe the broadcaster which has the id isoffline, which is the one defined earlier. if the value of the label attribute on the broadcaster changes, the observers will update the values of their label attributes also. we could continue with additional elements. as many elements as you want can observe a single broadcaster. you can also have only one if you wanted to but that would accomplish very little since the main reason for using broadcasters is to have attributes forwarded to multiple places. you should only use broadcasters when you need multiple elements that observe an attribute. below, some additional observers are de...
Creating a Skin - Archive of obsolete content
ark blue in this case. finally, some minor changes to the spacing around the items, by setting margins: tabbox { margin: 4px; } toolbarbutton { margin-left: 3px; margin-right: 3px; } after those changes, the find files dialog now looks like the image. as you can see, some simple changes to the style rules has resulted in quite a different appearance to the find files dialog. we could continue by changing the menus, the grippies on the toolbar and the input and checkbox elements. creating a global skin the skin created above is simple and only applies to the find files dialog. some of the changes made to the skin could be placed in the global style sheets (those in the global directory of the skin) to be applied to all applications. for example, having different images for the check ...
Creating a Wizard - Archive of obsolete content
. these functions are called regardless of which page is currently displayed. to have different code called depending on which page you are on, use the onpagerewound or onpageadvanced attributes on a wizardpage element. they work in a similar way to the other functions except that you can use different code for each page. this allows you to validate the input entered on each page before the user continues. a third option is to use the onpagehide and onpageshow attributes on the wizardpage element. these methods will be called when the page is hidden or shown, regardless of which button was pressed (except when cancel is pressed -- you need to use onwizardcancel to check for this.) these three methods should provide enough flexibility to handle navigation as you need to. the following is a summa...
Creating an Installer - Archive of obsolete content
a web page from which the user can download the software to be installed. this page will contain an install trigger which is a small piece of script which launches the install. the user is presented with a dialog which indicates the package being installed. it is possible for the install trigger to launch multiple installers. in this case, they will be presented in a list. the user may choose to continue or cancel. if the user chooses to continue, the installer xpi file is downloaded. a progress bar is displayed to the user during this process. the file install.js is extracted from the install archive and executed. this script will call 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 mul...
Element Positioning - Archive of obsolete content
can also use the corresponding css properties, min-width, min-height, max-width and max-height. these properties are only useful for flexible elements. by setting a maximum height, for example, a stretchy button will only grow to a certain maximum height. you will still be able to resize the window beyond that point but the button will stop growing in size. the box the button is inside will also continue to grow, unless you set a maximum height on the box also. if two buttons are equally flexible, normally both will share the amount of extra space. if one button has a maximum width, the second will still continue to grow and take all of the remaining space. if a box has a maximum width or height, the children cannot grow larger than that maximum size. if a box has a minimum width or height, the...
Introduction - Archive of obsolete content
f a complete xulrunner application, but don't mind requiring a mozilla browser to be installed to be able to run the application. remote xul application you could also just place xul code on a web server and open it in firefox, as you would any other web page, however this is discouraged and was disabled in firefox 8. it is still possible to enable this for selected sites to let legacy apps to continue working, but for new remote applications you should use html to create your user interface instead; most of the features you used to have to use xul for are available in html5. the first three types all require an installation to be performed on the user's machine. however, these types of applications do not have security restrictions placed on them, so they may access local files and read and ...
Modifying a XUL Interface - Archive of obsolete content
) then assigns the label 'a new button' to the button using the setattribute() function. finally the appendchild() function of the particular box found by getelementbyid() is called to add the button to it. at this point, the button is attached to a visible box, so it becomes visible as well. the button with the label "add" can be pressed multiple times and it will continue to add new buttons, each of which will have the label "a new button", and will only be distinguishable by their place as children in the box element with the id "abox". the createelement() function will create the default type of element for the document. for xul documents, this generally means that a xul element will be created. for an html document, an html element will be created, so ...
More Event Handlers - Archive of obsolete content
pupshowing="event.preventdefault();"> <menuitem label="glass"/> <menuitem label="plastic"/> </menupopup> </button> alternatively, for attribute event listeners, you can just return false from the code. note that preventing the default action is not the same as stopping event propagation with the stoppropagation method. even if the default action has been prevented, the event will still continue to propagate. similarly, calling the stoppropagation method won't prevent the default action. you must call both methods to stop both from occuring. note that once propagation or the default action has been prevented, neither may be re-enabled again for that event. the following sections list some of the events that may be used. a full list is provided in the xulplanet event reference. mouse even...
Splitters - Archive of obsolete content
change size if you drag the splitter far enough to the right that frame 4 has reached its minimum size. this image shows the 4 panels with the splitter in a collapsed state. this image shows the 4 panels with the splitter resized to the right. notice how the middle two panels have not changed size. only panel 1 and panel 4 have changed size. you can just see part of the fourth panel. if you continue to drag the splitter to the right, the other two panels will shrink. you can use the style properties such as min-width, max-height on the iframes to specify minimum or maximum widths or heights in the box. if you do, the splitter will detect this and not allow the user to drag the splitter past the minimum and maximum sizes. for example, if you specified a minimum width of 30 pixels on panel 4 ...
Using nsIXULAppInfo - Archive of obsolete content
starting with mozilla/xulrunner 1.8, there now is a way to find out which application, application version, and gecko version your code is running on. this is useful, for example, for extensions that support several mozilla-based applications or several versions of a single application. this is not useful for scripts on webpages, which should continue using the navigator object when it's not possible to rely on feature-detection. nsixulappinfo interface to distinguish between different mozilla-based applications, use the frozen nsixulappinfo interface. the following sections provide a few examples of using nsixulappinfo from javascript. note that while firefox 1.5, thunderbird 1.5, and xulrunner 1.8-based applications support nsixulappinfo, older applications, such as firefox and thund...
Getting started with XULRunner - Archive of obsolete content
e, bare bones application shell. call it a xul “hello world” if you want. all of what you see below can be found in the xulrunner documentation here on mdn in much more detail. hint: skip ahead and download the sample application, you can experiment with it while following this tutorial. you can download the sample application from https://github.com/matthewkastor/xulrunner-examples. please continue reading to learn the "what", "why" and "how" parts of building a xulrunner application. on windows, i created the root in a new c:\program files\myapp folder, but you can create it wherever you like, using whatever os you like. the same application structure is used on windows, mac and linux. here is the subfolder structure: + myapp/ | +-+ chrome/ | | | +-+ content/ | | | | | +-- main.xul | | ...
Archived Mozilla and build documentation - Archive of obsolete content
can make use of liveconnect. liveconnect gives your extension's javascript code (linked from or contained in xul code) access to 2 objects: java and packages (note that per this thread, although the new documentation for the liveconnect reimplementation states that these globals will be deprecated (in the context of applets), "firefox and the java plug-in will continue to support the global java/packages keywords, in particular in the context of firefox extensions."). these 2 objects let you make use of the standard jdk classes, e.g., javascript crypto mozilla defines a special javascript object to allow web pages access to certain cryptographic-related services. these services are a balance between the functionality ...
Mozilla release FAQ - Archive of obsolete content
warning: the content of this article may be out of date. it was last updated in 2005. this document may be distributed and modified freely. no guarantee of factuality in this faq is made, and it is maintained by pat gunn, who is not affiliated with netscape. various other people have contributed to this faq. general questions about the mozilla project what is mozilla? mozilla is a project to continue netscape communicator as an open project. the project is maintained by employees of netscape (now a division of aol), red hat, some other companies, as well as contributors from the community. on what is mozilla based? the mozilla project started near the end of life of the 4.x line of netscape communicator. originally, the plan was just to re-stabilize the code and release 5.0, but it was decide...
2006-12-01 - Archive of obsolete content
modal window.open to support web 2.0 a plea to re-implement the option to show modal windows, using window.open(), from inside an untrusted script. this implementation was removed in 2002 to fight against popups. xml in firefox is a major problem a major debate surrounding the use of xml for customizing rss feeds. devs say this is the way its supposed to be, others say its a bug! the debate continues. discussion of support for modal windows within firefox 2.0 a lengthy post regarding the re-implementation of modal windows into firefox. basic feature that i think is a must in any web broswer a discussion revolving around the idea of having firefox automatically convert mistaken non-english characters to english so that web addresses will be completed. mozstorage documentation up a...
2006-12-01 - Archive of obsolete content
convert ooo .dic to .xpi convert ooo .dic to .xpi mozillatranslator and sourceforge.net about the best way to organize things creating a <locale>.jar file from the cvs structure discussion on how to package a <locale>.jar from the cvs structure without having to download the entire mozilla source. at the moment there is no simple way of doing this. from 50 to 100 locales discussion continues on finding a better tool for localization. feedback on l10n:ownership draft feedback on the l10n:ownership draft at mozilla wiki site detailed here continues. there's a question about the roles of peer in the team meetings none for this week. authors paul yanchun gu (gpaul) aditya nanda kuswanto(vipers101) ...
2006-10-13 - Archive of obsolete content
ode was frozen on oct. 10; the target release date for rc3 is october 17 new tinderbox and bonsai servers the build team would like help testing out the new tinderbox and bonsai servers. sunbird and lighting 0.3 sunbird and lighting 0.3 were released on october 11 discussions release process discussion discussion from last week regarding speeding up and automation of the release process continued. firefox feature brainstorming you can help suggest features for firefox 3 here meetings project meeting a project meeting was held on oct. 9. (meeting notes) bon echo status meeting a bon echo status meeting was held on oct. 10 (meeting notes) gecko 1.9/gran paradiso status meeting a gecko 1.9/gran paradiso status meeting was held on oct. 11 (notes) ...
NPAnyCallbackStruct - Archive of obsolete content
bedded 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 the plug-in is called, the browser has already opened the file and written postscript for other parts of the page. when the plug-in is done, it should leave the file open, as the browser can continue to write additional postscript data to the file. see also npp_print() npembedprint npsetwindowcallbackstruct npprintcallbackstruct ...
NPN_GetURL - Archive of obsolete content
pe is, use null. if the application cannot locate the url and retrieve the data, it does not create a stream for the instance. when the plug-in instance is part of a regular browser window, and it uses a _blank target with a mailto or news url, another blank window is opened along with the mail or news window. when the plug-in uses a _self target, no other instance is created; the plug-in usually continues to operate successfully in its own window. the safest target is _blank, even though this creates an extra blank the browser instance. the plug-in developer cannot influence the way that the browser handles npn_geturl(). it is typically asynchronous but this is not guaranteed. the plug-in could call npn_geturl() and receive data from the url right away, but more often the data arrives later. the ...
NPP_NewStream - Archive of obsolete content
ndomly accessed by the plug-in as needed, through calls to npn_requestread. if the stream is not seekable, placing the stream in np_seek mode causes the browser to save the entire stream to the disk cache. npn_requestread requests are only fulfilled when all data has been read and stored in the cache. as an optimization to extract the maximum benefit from existing network connections, the browser continues to read data sequentially out of the stream (as in mode np_normal) until the first npn_requestread call is made. note: in any mode other than np_seek, the application should call npp_destroystream once all data in the stream has been written to the plug-in. the plug-in can also request termination of the stream at any time by calling npn_destroystream. see also npn_newstream, npp_streamasf...
NPPrintCallbackStruct - Archive of obsolete content
ontains 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. at the time the plug-in is called, the browser has already opened the file and written postscript for other parts of the page. when the plug-in is done, it should leave the file open, so the browser can continue to write additional postscript data to the file. see also npp_print, npembedprint, npsetwindowcallbackstruct, npanycallbackstruct ...
Encryption and Decryption - Archive of obsolete content
he encryption and decryption. symmetric-key encryption also provides a degree of authentication, since information encrypted with one symmetric key cannot be decrypted with any other symmetric key. thus, as long as the symmetric key is kept secret by the two parties using it to encrypt communications, each party can be sure that it is communicating with the other as long as the decrypted messages continue to make sense. symmetric-key encryption is effective only if the symmetric key is kept secret by the two parties involved. if anyone else discovers the key, it affects both confidentiality and authentication. a person with an unauthorized symmetric key not only can decrypt messages sent with that key, but can encrypt new messages and send them as if they came from one of the two parties who were...
Introduction to Public-Key Cryptography - Archive of obsolete content
signed) across the network. the server uses the certificate and the evidence to authenticate the user's identity. (for a detailed discussion of the way this works, see "introduction to ssl.") at this point the server may optionally perform other authentication tasks, such as checking that the certificate presented by the client is stored in the user's entry in an ldap directory. the server then continues to evaluate whether the identified user is permitted to access the requested resource. this evaluation process can employ a variety of standard authorization mechanisms, potentially using additional information in an ldap directory, company databases, and so on. if the result of the evaluation is positive, the server allows the client to access the requested resource. as you can see by compari...
SSL and TLS - Archive of obsolete content
elliptic curve cryptography (ecc) govern the way the server and client determine the symmetric keys to use during an ssl session. the most common ssl cipher suites use rsa key exchange, while tls supports ecc cipher suites as well as rsa. note: longer rsa keys are required to provide security as computing capabilities increase. the recommended rsa key-length is 2048 bits. though many web servers continue to use 1024-bit keys, web servers should migrate to at least 2048 bits. for 64-bit machines, consider using stronger keys. all cas should use at least 2048-bit keys, and stronger keys (such as 3072 or 4096 bits) if possible. as pkis using rsa keys and certificates transition to other cryptographic systems like ecc, servers should continue to support rsa. supported cipher suites for rsa cipher ...
Using SSH to connect to CVS - Archive of obsolete content
o perform the steps in this section unless you have first verified that you can access cvs.mozilla.org from outside of the firewall. only proceed with these steps once you are certain you can access cvs.mozilla.org from the open internet. if you are behind a firewall with an http tunneling proxy, you can use a program called corkscrew, in combination with the proxycommand ssh config directive to continue to access the mozilla cvs server. this technique was taken from eric engstrom's site, but the instructions have been re-written specifically for mozilla. download, build, and install corkscrew by following the instructions in the install file in the corkscrew source distribution. corkscrew uses the standard "./configure; make install" technique common to many open source projects. make sure y...
Developing cross-browser and cross-platform pages - Archive of obsolete content
at the visiblity property itself exists. so, instead of needing to know which browsers and browser versions support a particular dom method (or dom attribute or dom feature), you can verify the support for that particular method in the visiting browser. with this approach, you ensure that all browsers -- including future releases and browsers whose useragent strings you do not know about -- will continue working with your code. more on object/feature support detection: a strategy that works: object/feature detecting by comp.lang.javascript newsgroup faq notes browser detection - no; object detection - yes by peter-paul koch also good http://developer.mozilla.org/docs...rowser_support but outdated in my opinion ...
-ms-content-zoom-snap-points - Archive of obsolete content
pinterval(0%, 100%); ... } .snappy2 { -ms-content-zoom-snap-points: snaplist(100%, 200%, 300%, 400%, 500%); ... } specifications not part of any specification. remarks this property has no effect on non-zoomable elements. see -ms-content-zooming for details on zoomable elements. when a user pans or scrolls and then lifts his or her contact (for instance, a finger), the content can continue to move with inertia. snap-points can change the animation that runs when the user lifts his or her finger so that you can adjust where the content will stop. by placing snap-points, you can make it easy for your users to manipulate your content and make it stop at convenient or key places. starting with windows 8.1, this property is also supported for touchpad interaction. this property requir...
New in JavaScript 1.2 - Archive of obsolete content
...
Server-Side JavaScript - Archive of obsolete content
segregated teams, disparate and inconsistent know-how, and plenty of server-side string manipulation gymnastics to generate html or ajax pages. the simplicity of using javascript on the server was part of netscape's original vision back in the day with netscape livewire. but back then, 350 mhz servers were the best you could buy, and mozilla was yet to emerge from the netscape organization to continue to advance the state of web technologies. today with computing cycles having increased more than 10-fold and mozilla's work on rhino (javascript interpreter in java) and spidermonkey (javascript interpreter in c) and javascript itself, we have very solid foundations for javascript to be extraordinarily useful and applicable on the server-side again -- with performance in the same range as popular...
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
in and decided to have some fun with with the redesign, which is why i rather like the final result. to share the joy, i herein present a look into just one piece of the redesign, and how i accomplished certain effects using simple html and some css. marking up the fish in the old fish cam page, there was a table that contained the pictures and descriptions of the fish. well, i couldn't letthat continue—fish are flexible, slippery things, and tables are very much not. so i decided to break up the content so that there is a self-contained bit of markup for each fish, and then get down to styling. here's what one of those bits looks like once all the css has been applied. in order to make the fish cam page as agile as the fish themselves, it was necessary to strip out all of the tables, font ...
XForms Custom Controls - Archive of obsolete content
will certainly not hurt. but even if you are only comfortable with a couple of these technologies, we hope that the possibilities outlined below will inspire you to learn more where you need to. implementation status the framework we use in the mozilla xforms processor is very much a "work in progress". please keep in mind that just about everything we mention here may change to some degree as we continue to work on it. work has just started in the w3c xforms working group to investigate the custom control issue, so eventually (hopefully?) there will be an "official" and common way to customize your form's user interface across all xforms processors. why do you need this you will probably find that your need for customization will fall into one of the following categories: custom presentation - x...
Web Standards - Archive of obsolete content
andards are carefully designed to deliver the greatest benefits to the greatest number of web users while ensuring the long-term viability of any document published on the web. designing and building with these standards simplifies and lowers the cost of production, while delivering sites that are accessible to more people and more types of internet devices. sites developed along these lines will continue to function correctly as traditional desktop browsers evolve, and as new internet devices come to market. [1] documentation migrate apps from internet explorer to mozilla ever have trouble getting your internet explorer-specific web applications to work with mozilla? this article covers common issues associated with migrating applications to the open source mozilla-...
Building up a basic demo with Babylon.js - Game development
t gray. creating a rendering loop to make the scene actually visible we have to render it. add these lines at the end of the <script> element, just before the closing </script>. var renderloop = function () { scene.render(); }; engine.runrenderloop(renderloop); we're using the engine's runrenderloop() method to execute the renderloop() function repeatedly on every frame — the loop will continue to render indefinitely until told to stop. creating a camera now the setup code is in place we need to think about implementing the standard scene components: camera, light and objects. let's start with the camera — add this line to your code below the scene creation and the line where we defined the clearcolor. var camera = new babylon.freecamera("camera", new babylon.vector3(0, 0, -10), sc...
Building up a basic demo with PlayCanvas editor - Game development
s editor. this can be a more pleasant working environment if you are not someone who likes to code. creating an account the playcanvas editor is free — all you have to do to begin with is register your account and login: when you first sign up, you are taken straight into the editor and given a simple starter tutorial involving editing a 3d rolling ball game. you can finish this before you continue our tutorial if you like. when you are ready to continue with our tutorial, go to your canvas homepage — for example mine is https://playcanvas.com/end3r. here's what the page looks like — you can create projects and manage them, change their settings etc. creating a new project start a brand new project by clicking on the new button: the resulting dialog box will show a few different op...
Building up a basic demo with the PlayCanvas engine - Game development
ch frame, with a little bit of adjustment to make it look cooler. try changing the value to see how it affects the animation. conclusion here's the final code listing, along with a viewable live example: you can also see it on github and fork the repository if you want to play with it yourself locally. now you know the basics of playcanvas engine; happy experimentation! summary now you can continue reading the playcanvas editor article, go back to the building up a basic demo with playcanvas page, or go back a level higher to the main 3d games on the web page. ...
GLSL Shaders - Game development
d lights will stay the same, but instead of the basic material we will set the cube's color and position using shaders. go to the cube.html file on github, copy all the javascript code from inside the second <script> element, and paste it into the third <script> element of the current example. save and load index.html in your browser — you should see a blue cube. the vertex shader code let's continue by writing a simple vertex shader — add the code below inside the body's first <script> tag: void main() { gl_position = projectionmatrix * modelviewmatrix * vec4(position.x+10.0, position.y, position.z+5.0, 1.0); } the resulting gl_position is calculated by multiplying the model-view and the projection matrices by each vector to get the final vertex position, in each case. note: you can ...
Desktop mouse and keyboard controls - Game development
key being pressed and move on: this.input.keyboard.ondowncallback = function() { if(this.statestatus == 'intro') { this.hideintro(); } }; this hides the intro and starts the actual game, without us having to set up another new key control just for this. pause and game over screens to make the game fully playable with keyboard it should be possible to go back to the main menu, continue playing, or restart the game from the pause and game over screens. it can be done exactly the same as before — by capturing key codes and performing actions. for example, by specifying phaser.keycode.backspace or phaser.keycode.delete you can hook up an action to fire when the delete/backspace button is pressed. summary ok, we've dealt with touch, keyboard and mouse controls. now let's move o...
WebRTC data channels - Game development
fferences between browsers. hopefully, of course, those differences will fade away in time. using the p2p library one library you can use is the p2p library. this library provides a simple api for creating peer connections and setting up streams and data channels. there's also a broker server component and a hosted broker you can use instead of having to set one up for yourself. note: we will continue to add content here soon; there are some organizational issues to sort out. original document information author(s): alan kligman source article: webrtc data channels for great multiplayer other contributors: robert nyman copyright information: alan kligman, 2013 ...
Build the brick field - Game development
learing of the canvas and drawing the ball. add the following just above the drawball() call: drawbricks(); compare your code at this point, the game has got a little more interesting again : exercise: try changing the number of bricks in a row or a column, or their positions. next steps so now we have bricks! but the ball isn't interacting with them at all — we'll change that as we continue to the seventh chapter: collision detection. « previousnext » ...
Create the Canvas and draw on it - Game development
sepath(); the code above prints a blue-stroked empty rectangle. thanks to the alpha channel in the rgba() function, the blue color is semi transparent. compare your code here's the full source code of the first lesson, running live in a jsfiddle: exercise: try changing the size and color of the given shapes. next steps now we've set up the basic html and learned a bit about canvas, lets continue to the second chapter and work out how to move the ball in our game. « previousnext » ...
Finishing up - Game development
our code that's all — the final version of the game is ready and set to go ! exercise: change the number of lives and the angle the ball bounces off the paddle. game over - for now! you've finished all the lessons - congratulations! by this point, you should now know the basics of canvas manipulation and the logic behind simple 2d games. now it's a good time to learn some frameworks and continue game development. you can check out this series' counterpart, 2d breakout game using phaser or the cyber orb built in phaser tutorial. you can also look through the games section on mdn for inspiration and more knowledge. you could also go back to this tutorial series' index page. have fun coding! « previous ...
Paddle and keyboard controls - Game development
ion, to actually print it on the screen. add the following line inside your draw() function, just below the line that calls drawball(): drawpaddle(); compare your code here's the working code for you to compare yours against: exercise: make the paddle move faster or slower, or change its size. next steps now we have something resembling a game. the only trouble now is that you can just continue hitting the ball with the paddle forever. this will all change in the fifth chapter, game over, when we start to add in an endgame state for our game. « previousnext » ...
Initialize the framework - Game development
we will use the same names to keep it clean. preload takes care of preloading the assets create is executed once when everything is loaded and ready update is executed on every frame. compare your code here's the full source code of the first lesson, running live in a jsfiddle: next steps now we've set up the basic html and learned a bit about phaser initialization, let's continue to the second lesson and learn about scaling. « previousnext » ...
Player paddle and controls - Game development
ge of the object. we can change that to have the anchor in the middle of the paddle's width and at the bottom of it's height, so it's easier to position it against the bottom edge. add the following line below the previous new one: paddle.anchor.set(0.5,1); the paddle is now positioned right where we want it to be. now, to make it collide with the ball we have to enable physics for the paddle. continue by adding the following new line, again at the bottom of the create() function: game.physics.enable(paddle, phaser.physics.arcade); now the magic can start to happen — the framework can take care of checking the collision detection on every frame. to enable collision detection between the paddle and ball, add the collide() method to the update() function as shown: function update() { ga...
Scaling - Game development
oundcolor property for this purpose, which we can set using css color definition syntax. add the following line below the other three you added earlier: game.stage.backgroundcolor = '#eee'; compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: next steps now we've set up the scaling for our game, let's continue to the third lesson and work out how to load the assets and print them on screen. « previousnext » ...
2D maze game with device orientation - Game development
edge and at the start of the top edge, so it can be easily horizontally centered on the screen without the need to know its width. when the start button is pressed, instead of jumping directly into the action the game will show the screen with the information on how to play the game. howto.js ball.howto = function(game) { }; ball.howto.prototype = { create: function() { this.buttoncontinue = this.add.button(0, 0, 'screen-howtoplay', this.startgame, this); }, startgame: function() { this.game.state.start('game'); } }; the howto state shows the gameplay instructions on the screen before starting the game. after clicking the screen the actual game is launched. game.js the game state from the game.js file is where all the magic happens. all the initialization is ...
Gecko FAQ - Gecko Redirect 1
7, "full html4/css1 compliance can't mean '100% bug free'. if it does, no-one will ever ship a fully compliant browser." because web pages can be arbitrarily long and complex and have arbitrarily deeply nested markup, it will always be possible to construct web pages that do not display in a given browser the way the specifications would recommend. so long as qa testing and test case development continues, there will always be known bugs at any given point in time in the open-source gecko codebase, and it follows that every commercial product that has ever shipped and ever will ship based on gecko will have known bugs at the time of its release. (the same principle of course applies to other browser engine development projects and products based upon them as well.) known bugs in the open-source ...
Ajax - MDN Web Docs Glossary: Definitions of Web-related terms
ajax, which initially stood for asynchronous javascript and xml, is a programming practice of building complex, dynamic webpages using a technology known as xmlhttprequest. ajax allows you to update parts of the dom of an html page instead without the need for a full page refresh. ajax also lets you work asynchronously, meaning your code continues to run while the targeted part of your web page is trying to reload (compared to synchronously, which blocks your code from running until that part of your page is done reloading). with interactive websites and modern web standards, ajax is gradually being replaced by functions within javascript frameworks and the official fetch api standard. ...
Asynchronous - MDN Web Docs Glossary: Definitions of Web-related terms
ssages may be sent without waiting for acknowledgement, with the understanding that if a problem occurs, the recipient will request corrections or otherwise handle the situation. for humans, e-mail is an asynchronous communication method; the sender sends an email and the recipient will read and reply to the message when it's convenient to do so, rather than doing so at once. and both sides can continue to send and receive messages whenever they wish, instead of having to schedule them around each other. when software communicates asynchronously, a program may make a request for information from another piece of software (such as a server), and continue to do other things while waiting for a reply. for example, the ajax (asynchronous javascript and xml) programming technique—now usually simp...
Call stack - MDN Web Docs Glossary: Definitions of Web-related terms
o the call stack list. call stack list: - greeting execute all lines of code inside the greeting() function. get to the sayhi() function invocation. add the sayhi() function to the call stack list. call stack list: - sayhi - greeting execute all lines of code inside the sayhi() function, until reaches its end. return execution to the line that invoked sayhi() and continue executing the rest of the greeting() function. delete the sayhi() function from our call stack list. call stack list: - greeting when everything inside the greeting() function has been executed, return to its invoking line to continue executing the rest of the js code. delete the greeting() function from the call stack list. call stack list: empty in summary, then, ...
Callback function - MDN Web Docs Glossary: Definitions of Web-related terms
ter function to complete some kind of routine or action. here is a quick example: function greeting(name) { alert('hello ' + name); } function processuserinput(callback) { var name = prompt('please enter your name.'); callback(name); } processuserinput(greeting); the above example is a synchronous callback, as it is executed immediately. note, however, that callbacks are often used to continue code execution after an asynchronous operation has completed — these are called asynchronous callbacks. a good example is the callback functions executed inside a .then() block chained onto the end of a promise after that promise fulfills or rejects. this structure is used in many modern web apis, such as fetch(). learn more general knowledge callback on wikipedia ...
HTML - MDN Web Docs Glossary: Definitions of Web-related terms
n 2.0 in 1995. in 1994 berners-lee founded the w3c to develop the web. in 1996, the w3c took over the html work and published the html 3.2 recommendation a year later. html 4.0 was released in 1999 and became an iso standard in 2000. at that time, the w3c nearly abandoned html in favor of xhtml, prompting the founding of an independent group called whatwg in 2004. thanks to whatwg, work on html5 continued: the two organizations released the first draft in 2008 and the final standard in 2014. concept and syntax an html document is a plaintext document structured with elements. elements are surrounded by matching opening and closing tags. each tag begins and ends with angle brackets (<>). there are a few empty or void tags that cannot enclose any text, for instance <img>. you can extend html tag...
Index - MDN Web Docs Glossary: Definitions of Web-related terms
(gnu lesser general public license) is a free software license published by the free software foundation. the lgpl provides a more permissive alternative for the strictly copyleft gpl. while any derivative work using a gpl-licensed program must be released under the same terms (free to use, share, study, and modify), the lgpl only requires the lgpl-licensed component of the derivative program to continue using the lgpl, not the whole program. lgpl is usually used to license shared components such as libraries (.dll, .so, .jar, etc.). 246 ltr (left to right) composing, glossary, localization ltr (left to right) is a locale property indicating that text is written from left to right. for example, the en-us locale (for us english) specifies left-to-right. 247 latency ...
LGPL - MDN Web Docs Glossary: Definitions of Web-related terms
(gnu lesser general public license) is a free software license published by the free software foundation. the lgpl provides a more permissive alternative for the strictly copyleft gpl. while any derivative work using a gpl-licensed program must be released under the same terms (free to use, share, study, and modify), the lgpl only requires the lgpl-licensed component of the derivative program to continue using the lgpl, not the whole program. lgpl is usually used to license shared components such as libraries (.dll, .so, .jar, etc.). learn more general knowledge gnu lgpl on wikipedia lgpl license text on gnu.org ...
Microsoft Internet Explorer - MDN Web Docs Glossary: Definitions of Web-related terms
with windows in 1995 as part of the package called "microsoft plus!". by around 2002, internet explorer had become the most used browser in the world, but has since lost ground to chrome, firefox, edge, and safari. ie has gone through many releases and currently stands at version 11.0.12, with desktop, mobile, and xbox console versions available. formerly available on mac and unix, microsoft discontinued those versions in 2003 and 2001 respectively. learn more general knowledge internet explorer on wikipedia history of internet explorer on wikipedia internet explorer versions on wikipedia learning about internet explorer http://windows.microsoft.com/en-us/internet-explorer/download-ie http://windows.microsoft.com/en-us/windows7/getting-started-with-internet-explorer-9 http://window...
Parse - MDN Web Docs Glossary: Definitions of Web-related terms
ng involves tokenization and tree construction. html tokens include start and end tags, as well as attribute names and values. if the document is well-formed, parsing it is straightforward and faster. the parser parses tokenized input into the document, building up the document tree. when the html parser finds non-blocking resources, such as an image, the browser will request those resources and continue parsing. parsing can continue when a css file is encountered, but <script> tags—particularly those without an async or defer attribute—blocks rendering, and pauses parsing of html. when the browser encounters css styles, it parses the text into the css object model (or cssom), a data structure it then uses for styling layouts and painting. the browser then creates a render tree from both the...
RTF - MDN Web Docs Glossary: Definitions of Web-related terms
rtf (rich text format) is a plain-text-based file format with support for formatting instructions (like bold or italic). three programmers in the microsoft word team created rtf in the 1980s, and microsoft continued to develop the format until 2008. however, many word-processing programs can still read and write rtf. learn more general knowledge rich text format on wikipedia technical reference final specification from microsoft ...
Loop - MDN Web Docs Glossary: Definitions of Web-related terms
//this loop will print numbers 0-9, will stop when condition is met (i = 10) for the above example, the syntax is as follows: statement 1 sets the variable for the loop (var i = 0). statement 2 sets the loop condition (i < 10). statement 3 increases the value of i (i++) each time the code block is run. while loop syntax: while (condition){ execute code block } the code block will continue to loop as long as the condition is true. example: var i = 0; while(i < 5){ console.log(i) i++ } //this loop will print number 0-4, will stop when condition becomes false (i >=5) for the above example, the syntax is as follows: the code block will continue to run as long as the variable (i) is less than 5. ...
Mobile accessibility - Learn web development
t are as large as their desktop counterparts, and they are more likely to be on slow network connections. therefore, it is wise to serve smaller images to narrow screen devices as appropriate. you can handle this using responsive image techniques. thinking about high resolutions. many mobile devices have high-resolution screens, and therefore need higher-resolution images so that the display can continue to look crisp and sharp. again, you can serve images as appropriate using responsive image techniques. in addition, many image requirements can be fulfilled using the svg vector images format, which is well-supported across browsers today. svg has a small file size and will stay sharp regardless of whatever size is being displayed (see adding vector graphics to the web for more details). note...
WAI-ARIA basics - Learn web development
it when necessary! note: also, try to make sure you test your site with a variety of real users — non-disabled people, people using screenreaders, people using keyboard navigation, etc. they will have better insights than you about how well it works. practical wai-aria implementations in the next section we'll look at the four areas in more detail, along with practical examples. before you continue, you should get a screenreader testing setup put in place, so you can test some of the examples as you go through. see our section on testing screenreaders for more information. signposts/landmarks wai-aria adds the role attribute to browsers, which allows you to add extra semantic value to elements on your site wherever they are needed. the first major area in which this is useful is providin...
Cascade and inheritance - Learn web development
with the fundamental mechanics of css. next up, we'll look at selectors in detail. if you didn't fully understand the cascade, specificity, and inheritance, then don't worry! this is definitely the most complicated thing we've covered so far in the course, and is something that even professional web developers sometimes find tricky. we'd advise that you return to this article a few times as you continue through the course, and keep thinking about it. refer back here if you start to come across strange issues with styles not applying as expected. it could be a specificity issue. overview: building blocks next in this module cascade and inheritance css selectors type, class, and id selectors attribute selectors pseudo-classes and pseudo-elements combinators the b...
Organizing your CSS - Learn web development
adding a lot of additional comments and whitespace for example, then a post-processing step could be to optimize the css by stripping out anything unnecessary in the production version. an example of a post-processor solution for doing this would be cssnano. wrapping up this is the final part of our learning css guide, and as you can see there are many ways in which your exploration of css can continue from this point. to learn more about layout in css, see the learn css layout section. you should also now have the skills to explore the rest of the mdn css material. you can look up properties and values, explore our css cookbook for patterns to use, and read more in some of the specific guides such as our guide to css grid layout. previous overview: building blocks in this module c...
Attribute selectors - Learn web development
h an uppercase a. the second selector uses the case-insensitive flag and so matches all of the list items. note: there is also a newer value s, which will force case-sensitive matching in contexts where matching is normally case-insensitive, however this is less well supported in browsers and isn't very useful in an html context. next steps now we are done with attribute selectors, you can continue on to the next article and read about pseudo-class and pseudo-element selectors. previous overview: building blocks next in this module cascade and inheritance css selectors type, class, and id selectors attribute selectors pseudo-classes and pseudo-elements combinators the box model backgrounds and borders handling different text directions overflowing conte...
Type, class, and ID selectors - Learn web development
on specificity, an id has high specificity and will overrule most other selectors. this can make them difficult to deal with. in most cases it is preferable to add a class to the element rather than use an id, however if using the id is the only way to target the element — perhaps because you do not have access to the markup and so cannot edit it — this will work. in the next article we'll continue exploring selectors by looking at attribute selectors. previous overview: building blocks next in this module cascade and inheritance css selectors type, class, and id selectors attribute selectors pseudo-classes and pseudo-elements combinators the box model backgrounds and borders handling different text directions overflowing content values and units sizi...
CSS selectors - Learn web development
f selectors combine other selectors in order to target elements within our documents. the following for example selects paragraphs that are direct children of <article> elements using the child combinator (>): article > p { } next steps you can take a look at the reference table of selectors below for direct links to the various types of selectors in this learn section or on mdn in general, or continue on to start your journey by finding out about type, class, and id selectors. previous overview: building blocks next reference table of selectors the below table gives you an overview of the selectors you have available to use, along with links to the pages in this guide which will show you how to use each type of selector. i have also included a link to the mdn page for each selector ...
Grids - Learn web development
ehaves. to define a grid we use the grid value of the display property. as with flexbox, this switches on grid layout, and all of the direct children of the container become grid items. add this to the css inside your file: .container { display: grid; } unlike flexbox, the items will not immediately look any different. declaring display: grid gives you a one column grid, so your items will continue to display one below the other as they do in normal flow. to see something that looks more grid-like, we will need to add some columns to the grid. let's add three 200-pixel columns here. you can use any length unit, or percentages to create these column tracks. .container { display: grid; grid-template-columns: 200px 200px 200px; } add the 2nd declaration to your css rule, then reload...
Beginner's guide to media queries - Learn web development
; grid-template-columns: 3fr 1fr; column-gap: 20px; } nav ul { display: flex; } nav li { flex: 1; } } this css gives us a two-column layout inside the article, of the article content and related information in the aside element. we have also used flexbox to put the navigation into a row. open step 2 in the browser, or view the source. lets continue to expand the width until we feel there is enough room for the sidebar to also form a new column. inside a media query we'll make the main element into a two column grid. we then need to remove the margin-bottom on the article in order that the two sidebars align with each other, and we'll add a border to the top of the footer. typically these small tweaks are the kind of thing you will do to mak...
Multiple-column layout - Learn web development
mus.</p> </div> something to take note of is that the rule does not take up any width of its own. it lies across the gap you created with column-gap. to make more space either side of the rule you will need to increase the column-gap size. spanning columns you can cause an element to span across all of the columns. in this case the content breaks when the spanning element is introduced and continues below creating a new set of column boxes. to cause an element to span all of the columns use the column-span property set to all. note that it isn't possible to cause an element to span some columns. the property can only have the value of none (which is the default) or all. spanning the columns body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 arial, helvetica...
Getting started with CSS - Learn web development
ng your code editor add the following to your css file: h1 { color: red; } save your html and css files and reload the page in a web browser. the level one heading at the top of the document should now be red. if that happens, congratulations — you have successfully applied some css to an html document. if that doesn't happen, carefully check that you've typed everything correctly. you can continue to work in styles.css locally, or you can use our interactive editor below to continue with this tutorial. the interactive editor acts as if the css in the first panel is linked to the html document, just as we have with our document above. styling html elements by making our heading red we have already demonstrated that we can target and style an html element. we do this by targeting an elemen...
Fundamental text and font styling - Learn web development
on web pages. what is involved in styling text in css? as you'll have already experienced in your work with html and css, text inside an element is laid out inside the element's content box. it starts at the top left of the content area (or the top right, in the case of rtl language content), and flows towards the end of the line. once it reaches the end, it goes down to the next line and continues, then the next line, until all the content has been placed in the box. text content effectively behaves like a series of inline elements, being laid out on lines adjacent to one another, and not creating line breaks until the end of the line is reached, or unless you force a line break manually using the <br> element. note: if the above paragraph leaves you feeling confused, then no matter —...
Styling lists - Learn web development
value the value attribute allows you to set your list items to specific numerical values. the following example: <ol> <li value="2">toast pita, leave to cool, then slice down the edge.</li> <li value="4">fry the halloumi in a shallow, non-stick pan, until browned on both sides.</li> <li value="6">wash and chop the salad.</li> <li value="8">fill ...
What text editors are available? - Learn web development
tware center, mintinstall, gnome software, &c.). you can often find a .deb or .rpm file for prepackaged software, but most of the time you'll have to use your distro's repository server or, in worst case scenario, compile your editor from source. take the time to carefully check the installation instructions on the text editor's website. when you install a new text editor, your os will probably continue to open text files with its default editor until you change the file association. these instructions will help you specify that your os should open files in your preferred editor when you double-click them: windows windows 8 windows 7 older systems mac os x linux ubuntu unity gnome kde next steps now that you have a good text editor, you could take some t...
How do you host your website on Google App Engine? - Learn web development
for your own site or app, you need to create a new project on google cloud platform. this requires having a google account. go to the app engine dashboard on the google cloud platform console and press the create button. if you've not created a project before, you'll need to select whether you want to receive email updates or not, agree to the terms of service, and then you should be able to continue. enter a name for the project, edit your project id and note it down. for this tutorial, the following values are used: project name: gae sample site 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 app...
Web forms — Working with user data - Learn web development
the way, we now look in more detail at the elements used to provide structure and meaning to the different parts of a form. the different form controls basic native form controls we start off this section by looking at the functionality of the the original html <input> types in detail, looking at what options are available to collect different types of data. the html5 input types here we continue our deep dive into the <input> element, looking at the additional input types provided when html5 was released, and the various ui controls and data collection enhancements they provide. additionally, we look at the <output> element. other form controls next we take a look at all the non-<input> form controls and associated tools, such as <select>, <textarea>, <meter>, and <progress>. form st...
Adding vector graphics to the Web - Learn web development
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. note: the images above are actually all pngs — with the left-hand star in each case representing a raster image, and the right-hand star representing a vector image. again, go to the vector-versus-raster.html demo f...
From object to iframe — other embedding technologies - Learn web development
hout any plugins, people would rather just go to your competitors' websites than install a plugin. give yourself a break from the extra accessibility headaches that come with flash and other plugins. stay clear of additional security hazards. adobe flash is notoriously insecure, even after countless patches. in 2015, alex stamos, then-chief security officer at facebook, requested that adobe discontinue flash. note: due to its inherent issues and the lack of support for flash, adobe announced that they would stop supporting it at the end of 2020. as of january 2020, most browsers block flash content by default, and by december 31st of 2020, all browsers will have completly removed all flash functionality. any existing flash content will be inaccessable after that date. so what should you d...
Responsive images - Learn web development
e if desired. by then, the original image would already have been loaded, and you would load the small image as well, which is even worse in responsive image terms. use modern image formats boldly there are several exciting new image formats (such as webp and jpeg-2000) that can maintain a low file size and high quality at the same time. however, browser support is spotty. <picture> lets us continue catering to older browsers. you can supply mime types inside type attributes so the browser can immediately reject unsupported file types: <picture> <source type="image/svg+xml" srcset="pyramid.svg"> <source type="image/webp" srcset="pyramid.webp"> <img src="pyramid.png" alt="regular pyramid built from four equilateral triangles"> </picture> do not use the media attribute, unless you a...
Introducing asynchronous JavaScript - Learn web development
here has been a problem with your fetch operation: ' + error.message); }); console.log ('all done!'); the browser will begin executing the code, see the first console.log() statement (starting) and execute it, and then create the image variable. it will then move to the next line and begin executing the fetch() block but, because fetch() executes asynchronously without blocking, code execution continues after the promise-related code, thereby reaching the final console.log() statement (all done!) and outputting it to the console. only once the fetch() block has completely finished running and delivering its result through the .then() blocks will we finally see the second console.log() message (it worked :)) appear. so the messages have appeared in a different order to what you might expect: ...
Asynchronous JavaScript - Learn web development
write your own. making asynchronous programming easier with async and await promises can be somewhat complex to set up and understand, and so modern browsers have implemented async functions and the await operator. the former allows standard functions to implicitly behave asynchronously with promises, whereas the latter can be used inside async functions to wait for promises before the function continues. this makes chaining promises simpler and easier to read. choosing the right approach to finish this module off, we'll consider the different coding techniques and features we've discussed throughout, looking at which ones you should use when, with recommendations and reminders of common pitfalls where appropriate. ...
Function return values - Learn web development
umber); } this could be written as follows: function random(number) { const result = math.floor(math.random() * number); return result; } but the first version is quicker to write, and more compact. we are returning the result of the calculation math.floor(math.random() * number) each time the function is called. this return value appears at the point the function was called, and the code continues. so when you execute the following: ctx.arc(random(width), random(height), random(50), 0, 2 * math.pi); if the three random() calls returned the values 500, 200, and 35, respectively, the line would actually be run as if it were this: ctx.arc(500, 200, 35, 0, 2 * math.pi); the function calls on the line are run first, and their return values substituted for the function calls, before the li...
Test your skills: Loops - Learn web development
...
JavaScript building blocks - Learn web development
you've seen this stuff already in the course, but only in passing — here we'll discuss it all explicitly. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites before starting this module, you should have some familiarity with the basics of html and css, and you should have also worked through our previous module, javascript first steps. ...
Drawing graphics - Learn web development
best one for our purposes here being window.requestanimationframe(). it takes one parameter — the name of the function you want to run for each frame. the next time the browser is ready to update the screen, your function will get called. if that function draws the new update to your animation, then calls requestanimationframe() again just before the end of the function, the animation loop will continue to run. the loop ends when you stop calling requestanimationframe() or if you call window.cancelanimationframe() after calling requestanimationframe() but before the frame is called. note: it's good practice to call cancelanimationframe() from your main code when you're done using the animation, to ensure that no updates are still waiting to be run. the browser works out complex details such ...
What is JavaScript? - Learn web development
browser's "domcontentloaded" event, which signifies that the html body is completely loaded and parsed. the javascript inside this block will not run until after that event is fired, therefore the error is avoided (you'll learn about events later in the course). in the external example, we use a more modern javascript feature to solve the problem, the defer attribute, which tells the browser to continue downloading the html content once the <script> tag element has been reached. <script src="script.js" defer></script> in this case both the script and the html will load simultaneously and the code will work. note: in the external case, we did not need to use the domcontentloaded event because the defer attribute solved the problem for us. we didn't use the defer solution for the internal java...
JavaScript — Dynamic client-side scripting - Learn web development
rst javascript module, we first answer some fundamental questions such as "what is javascript?", "what does it look like?", and "what can it do?", before moving on to taking you through your first practical experience of writing javascript. after that, we discuss some key javascript features in detail, such as variables, strings, numbers and arrays. javascript building blocks in this module, we continue our coverage of all javascript's key fundamental features, turning our attention to commonly-encountered types of code block such as conditional statements, loops, functions, and events. you've seen this stuff already in the course, but only in passing — here we'll discuss it all explicitly. introducing javascript objects in javascript, most things are objects, from core javascript features l...
Multimedia: Images - Learn web development
ts are assigned a higher loading priority than background images. secondly, with the adoption of priority hints, you can control the priority further by adding an importance attribute to your image tags. an example use case for priority hints on images are carousels where the first image is a higher priority than the subsequent images. rendering strategy as images are loaded asynchronously and continue to load after the first paint, if their dimensions aren't defined before load, they can cause reflows to the page content. for example, when text gets pushed down the page by images loading. for this reason, it's critical that you set width and height attributes so that the browser can reserve space for them in the layout. for any background images, it's important you set a background-color valu...
What is web performance? - Learn web development
strategy is to make your files as small as possible, reduce the number of http requests made as much as possible, and employ clever loading techniques (such as preload) to make files available sooner. making the site usable as soon as possible: this basically means loading your web site assets in a sensible order so that the user can start to actually use it really quickly. any other assets can continue to load in the background while the user gets on with primary tasks, and sometimes we only load assets when they are actually needed (this is called lazy loading). the measurement of how long it takes the site to get to a usable start after it has started loading is called time to interactive. smoothness and interactivity: does the application feel reliable and pleasurable to use? is the scrolli...
Properly configuring server MIME types - Learn web development
uthor actually intended the content to be processed and displayed in a way different from that implied by the reported mime type. some other web browsers, such as microsoft® internet explorer, try to allow for misconfigured web servers and applications by guessing what the correct mime type should be. this has sheltered many web administrators from their own errors, since internet explorer will continue to process content as expected even though the web server is misconfigured, e.g. displays an image which is reported to be plain text. serving content using the correct mime type can also be important for security reasons; it's possible for malicious content to affect the user's computer by pretending to be a safe type of document when it is in fact not. note: historically, firefox has loaded ...
Introduction to the server side - Learn web development
end different responses based on that information. this allows, for example, a site to know that a user has previously logged in and display links to their emails or order history, or perhaps save the state of a simple game so that the user can go to a site again and carry on where they left it. note: visit a newspaper site that has a subscription model and open a bunch of tabs (e.g. the age). continue to visit the site over a few hours/days. eventually, you will start to be redirected to pages explaining how to subscribe, and you will be unable to access articles. this information is an example of session information stored in cookies. notifications and communication servers can send general or user-specific notifications through the website itself or via email, sms, instant messaging, vide...
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
l rendering in our templates. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. a deeper understanding of modern javascript features (such as classes, modules, etc), will be extremely beneficial, as ember makes heavy use of them. objective: to continue our learning about components classes, start looking at conditional rendering, and wire up some of our footer functionality. connecting the behavior in the footer to get the footer working, we need to implement the following thre areas of functionality: a pending todo counter. filters for all, active, and completed todos. a button to clear the completed todos. because we ne...
Ember app structure and componentization - Learn web development
wn as skipped) is for connection to a backing glimmer component class, which we don't need for now, as they are for adding interactivity and state manipulation. by default, generate component generates template-only components, because in large applications, template-only components end up being the majority of the components. header-test.js is for writing automated tests to ensure that our app continues to work over time as we upgrade, add features, refactor, etc. testing is outside the scope of this tutorial, although generally testing should be implemented as you develop, rather than after, otherwise it tends to be forgotten about. if you're curious about testing, or why you would want to have automated tests, check out the official ember tutorial on testing. before we start adding any compo...
Framework main features - Learn web development
the previous chapter, routing is an important part of the web experience. to avoid a broken experience in sufficiently complex apps with lots of views, each of the frameworks covered in this module provides a library (or more than one library) that helps developers implement client-side routing in their applications. testing all applications benefit from test coverage that ensures your software continues to behave in the way that you'd expect, and web applications are no different. each framework's ecosystem provides tooling that facilitates the writing of tests. testing tools are not built into the frameworks themselves, but the command-line interface tools used to generate framework apps give you access to the appropriate testing tools. each framework has extensive tools in its ecosystem, wit...
Accessibility in React - Learn web development
run when either of those values (the number of current tasks, or the number of previous tasks) changes. now, when you delete a task in your browser, you will see our dotted focus outline appear around the heading above the list. finished! you've just finished building a react app from the ground up! congratulations! the skills you’ve learned here will be a great foundation to build on as you continue working with react. most of the time, you can be an effective contributor to a react project even if all you do is think carefully about components and their state and props. remember to always write the best html you can. useref() and useeffect() are somewhat advanced features, and you should be proud of yourself for using them! look out for opportunities to practice them more, because doing s...
TypeScript support in Svelte - Learn web development
which is developed and maintained by the svelte team. this extension offers type checking, inspecting, refactoring, intellisense, hover-information, auto-completion, and other features. this kind of developer assistance is another good reason to start using typescript in your projects. note: make sure you are using svelte for vs code and not the old "svelte" by james birtles, which has been discontinued. in case you have it installed, you should uninstall it and install the official svelte extension instead. anyway, assuming you are inside the vs code application, from the root of your project's folder, type code . (the trailing dot tells vs code to open the current folder) to open the code editor. vs code will tell you that there are recommended extensions to install. clicking install all...
Componentizing our Svelte app - Learn web development
opics: extracting functionality to a new component. passing information from child to parent using a handler received as a prop. passing information from child to parent using the bind directive. conditionally rendering blocks of markup using the if block. implementing the "props-up, events-down" communication pattern. creating and listening to custom events. in the next article we will continue componentizing our app and look at some advanced techniques for working with the dom. previous overview: client-side javascript frameworks next in this module introduction to client-side frameworks framework main features react getting started with react beginning our react todo list componentizing our react app react interactivity: events and state react interact...
Deployment and next steps - Learn web development
previous overview: client-side javascript frameworks in the previous article we learning about svelte's typescript support, and how to use it to make your application more robust. in this final article we will look at how to deploy your application and get it online, and also share some of the resources that you should go on to, to continue your svelte learning journey. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. you'll need a terminal with node + npm installed to compile and build your app. objective: learn how to prepare our svelte app for production, and what learning resources you should visit next. note that our applic...
Getting started with Vue - Learn web development
, press enter to proceed. next you’ll select a config for the linter / formatter. navigate to "eslint with error prevention only" and hit enter again. this will help us catch common errors, but not be overly opinionated. next you are asked to configure what kind of automated linting we want. select "lint on save". this will check for errors when we save a file inside the project. hit enter to continue. now, you will select how we want your config files to be managed. "in dedicated config files" will put your config settings for things like eslint into their own, dedicated files. the other option, "in package.json", will put all of your config settings into the app's package.json file. select "in dedicated config files" and push enter. finally, you are asked if you want to save this as a pres...
Vue resources - Learn web development
a combination of javascript objects that manage the app's data and an html-based template syntax that maps to the underlying dom structure. 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 codeb...
Client-side tooling overview - Learn web development
ameworks such as react, ember, and vue: frameworks provide a lot of functionality for free and allow you to use it via custom syntax built on top of vanilla javascript. in the background, the framework’s javascript code works hard to interpret this custom syntax and render it as a final web app. post development post-development tooling ensures that your software makes it to the web and continues to run. this includes the deployment processes, testing frameworks, auditing tools, and more. this stage of the development process is one that you want the least amount of active interaction with so that once it is configured, it runs mostly automatically, only popping up to say hello if something has gone wrong. testing tools these generally take the form of a tool that will automatically r...
What to do and what not to do in Bugzilla
s engine component unless you really know they are js engine bugs, and don't leave bugs in the js engine component if you know that the malfunction being described is a dom problem. bug flags mozilla drivers use flags to identify bugs blocking a release. you may only use the blocking? flag to nominate bugs for blocking status. the use of the blocking- flag and the blocking+ flag is prohibited. continued abuse will result in revocation of your bugzilla privileges. mass changes mass changes (changes to more than one bug simultaneously) are discouraged. don't do it! ...
Building SpiderMonkey with UBSan
der gdb with a breakpoint at the end of __ubsan::diag::~diag(). the stack trace should show a function such as __ubsan_handle_load_invalid_value or __ubsan_handle_type_mismatch being called by the buggy c++ code. (for automated testing outside of gdb, you can instead build with -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error, but then you lose ubsan's diagnostics and the ability to continue past errors.) known bugs. please file new bugs with e.g. [-fsanitize=float-cast-overflow] in the status whiteboard. ...
Chrome registration
deprecated; however, seamonkey versions before version 2 do not support the plaintext manifest format yet, so contents.rdf manifests are required for extensions that wish to maintain backwards compatibility with firefox 1.0 or the suite. gecko 1.9.2 note the contents.rdf manifest format is no longer supported at all starting with gecko 1.9.2; add-ons already installed using this format will continue to work but can no longer be installed. be sure to remove your add-on and reinstall it to ensure that it installs correctly after updating it to use a plaintext manifest. official references for toolkit api official references. do not add to this list without contacting benjamin smedberg. note that this page is included from the pages listed below. so: don't add breadcrumbs! structure of an ...
Creating reftest-based unit tests
age that uses simple markup to achieve the same visual effect. reftest will then compare them and verify whether they produce the same bitmap. this idea can seem odd when first encountered. automated testing usually compares output against an invariant, a "gold standard", that is determined to be correct. if one has software that multiplies numbers, one wants a regression test to show that 2 * 2 continues to be calculated to be 4, not something similar to but not quite exactly 4. but an operating system does change with time. it is not invariant. and a browser may change the visual effect produced by a tag while still being compliant with relevant standards. for example, the html 4.01 specification at the w3c specifies that text inside of a <blockquote> will be indented, but it does not specify t...
Debugging on Mac OS X
n already running app). the breakpoint runs some commands to # figure out the object directory path from the attached target and then # sources the .lldbinit from there. # # note: this scripts actions take a few seconds to complete, so the custom # formatters, commands etc. that are added may not be immediately available. # breakpoint set --name nsthread::processnextevent --thread-index 1 --auto-continue true --one-shot true breakpoint command add -s python # this script that we run does not work if we try to use the global 'lldb' # object, since it is out of date at the time that the script runs (for # example, `lldb.target.executable.fullpath` is empty). therefore we must # get the following objects from the 'frame' object. target = frame.getthread().getprocess().gettarget(...
Configuring Build Options
ed build time and reduce disk space considerably. developers should generally not use this option. localization mk_add_options moz_co_locales=isocode tbd. ac_add_options --enable-ui-locale=isocode tbd. ac_add_options --with-l10n-base=/path/to/base/dir tbd. other options mk_add_options autoclobber=1 if a clobber would be required before a build, this will cause mach to clobber and continue with the build instead of asking the user to manually clobber and exiting. ac_add_options --disable-crypto cryptography is enabled by default. in some countries, it may be illegal to use or export cryptographic software. you should become familiar with the cryptography laws in your country. on the 1.7 and aviary branches, cryptography was off by default. you need to specify --enable-crypto if ...
Old Thunderbird build
b or more is recommended. while you can build thunderbird on older hardware it can take quite a bit of time to compile on slower machines with less ram. good internet connection for the initial source download. build prerequisites depending on your operating system you will need to carry out a different process to prepare your machine. so firstly complete the instructions for your os and then continue following these build instructions. to build on windows, please read the prerequisites so you don't skip preparing the mapi headers needed to compile thunderbird. windows build prerequisites gnu/linux build prerequisites mac os x build prerequisites get the source note: on windows, you won't be able to build the thunderbird source code if it's under a directory with spaces in the path ...
Simple Instantbird build
older hardware it can take quite a bit of time to compile on slower machines, and having 8gb of ram is recommended (though you can probably still get away with 4gb). good internet connection for the initial source download. setup: depending on your operating system you will need to carry out a different process to prepare your machine. so firstly complete the instructions for your os and then continue following these build instructions. windows build prerequisites gnu/linux build prerequisites mac os x build prerequisites tip: after completing setup for your os, and before you get the source, you can opt to add the progressextension to your mercurial.ini (for windows) or .hgrc (for *nix / mac) file. this will provide status feedback during the lengthy clone / download process. see: conf...
Simple Thunderbird build
b or more is recommended. while you can build thunderbird on older hardware it can take quite a bit of time to compile on slower machines with less ram. good internet connection for the initial source download. build prerequisites depending on your operating system you will need to carry out a different process to prepare your machine. so firstly complete the instructions for your os and then continue following these build instructions. windows build prerequisites gnu/linux build prerequisites macos build prerequisites mapi headers on windows: check that the mapi header files from https://www.microsoft.com/en-us/download/details.aspx?id=12905 are installed because the mapi header files (except mapi.h) are not bundled with visual studio 2017 (windows sdk 10). you should copy 17 of the 1...
Inner and outer windows
moved forward and backward through, just like in the previous diagram. the <iframe> element offers the contentwindow property, which gives you the outer window window object containing the frame's document. the frame's contentdocument property, similarly, gives you the document object inside the frame. you can get the window containing the frame from the window.parent property. this hierarchy can continue on, if frames contain additional frames. ...
Using the Browser API
Mozilla › Gecko › Chrome › API › Browser API › Using
inally, we call blur() on the url bar to stop focusing it, so the keyboard moves off the screen, allowing us to get our full screen view back. there's another event listener added later on in the code that listens for the mozbrowserlocationchange event. when this fires, we set the value inside the url bar input to be equal to the event object detail property — this is so that the url displayed continues to match the website being shown when the user navigates back and forth through the history. browser.addeventlistener('mozbrowserlocationchange', function (e) { urlbar.value = e.detail; }); zooming in and out the browser content can be programmatically zoomed in and out using the htmliframeelement.zoom() method. this takes a single method — a zoom factor — which dictates the percentage ...
Embedding the editor
base all assume that there is only one <editor> tag per window. they all need to be able to deal with multiple editors. fixing this would require js changes of the following kind: standardize the way that clients get at the editorshell (or its replacement, post-embedding work) from the window. ensure that focus changes between editors update the window's notion of the "current" editor. if we continue to use window.editorshell, then this needs to be updated on focus changes. ensure that each editor is properly constructed on window setup, and torn down on window destruction. ensure that window close tests (e.g. calling window.trytoclose) appropriately consult each editor for state. insulating editor from the chrome composer needs to not know anything about the ui that is driving it. the p...
HTTP Cache
recheckafterwrite such openers are skipped until the output stream on the entry is closed, then oncacheentrycheck is re-invoked on them note: here is a potential for endless looping when recheck_after_write_finished is abused result == entry_needs_revalidation: state = revalidating, this prevents invocation of any callback until cacheentry::setvalid is called continue as in state entry_wanted (just bellow) result == entry_wanted: consumer reference ++ (dropped back when the consumer releases the entry) oncacheentryavailable is invoked on the opener with anew = false and the entry opener is removed from the fifo result == entry_not_wanted: oncacheentryavailable is invoked on the opener with null for the entr...
How to get a process dump with Windows Task Manager
you can use any official nightly build or released version of firefox from mozilla. you can find the latest trunk nightly builds under http://ftp.mozilla.org/pub/mozilla.o.../latest-trunk/. creating the dump file ensure that firefox is not already running. run firefox, reproduce the hang start firefox and perform whatever steps are necessary to cause firefox to hang. once the browser hangs, continue with the steps below. after the hang open windows task manager (ctrl+shift+esc). find firefox.exe among the list of processes. right-click firefox.exe and select "create dump file". task manager should indicate where the dump file was written to. see also how to get a stacktrace for a bug report [en-us] how to create a user-mode process dump file in windows vista and in windows 7 (msd...
How to get a stacktrace with WinDbg
have been triggered. if you are prompted for a command but don't see an error about a crash, go back to the debug menu and press go. once the browser crashes, you will see an error (such as "access violation") in the windbg command window. if firefox hangs and there is no command prompt available in the debugger, open the debug menu and choose break. once the browser has crashed or been stopped, continue with the steps below. after the crash or hang you need to capture the debug information to include in a bug comment or support request. enter these three commands, one at a time, to get the stacktrace, crash/hang analysis and log of loaded modules. (again, press enter after each command.) ~* kp !analyze -v -f lm after these steps are completed, find the file c:\temp\firefox-debug-(today's dat...
AddonInstall
isplay name of the signer. existingaddon addon the addon that this install will update. may be null if it isn't updating anything installed. this is guaranteed to be correct after downloading is complete but may be set earlier. addon addon the full addon that this install will install. only available after downloading is complete. methods install() starts or continues the install process. the process will continue in the background until it fails, completes, one of the registered installlisteners pauses it, or the process is canceled by a call to the cancel() method. void install( ) cancel() cancels the install process, it cannot be restarted after this. void cancel( ) addlistener() adds a new installlistener if the listener is not already registered to...
Following the Android Toasts Tutorial from a JNI Perspective
port java code to jni by reading the java and android documentation. toast description a toast provides simple feedback about an operation in a small popup. it only fills the amount of space required for the message, and the current activity remains visible and interactive. for example, navigating away from an email before you send it triggers a "draft saved" toast to let you know that you can continue editing later. toasts automatically disappear after a timeout. toasts do not have to be created with jni; they are exposed by the nativewindow feature on firefox for android, see toast documentation. java code let's start with the following java code, which invokes a toast and says "hello, firefox!". context context = getapplicationcontext(); charsequence text = "hello, firefox!"; int duratio...
Using JavaScript code modules
iables of simple types won't be shared across scopes. always put variables in a wrapper class and export the wrapper (such as bar in the above example). unloading code modules requires gecko 7.0(firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) components.utils.unload() allows you to unload a previously imported code module. once this method has been called, references to the module will continue to work but any subsequent import of the module will reload it and give a new reference. examples a template to download and edit is seen here on github - gists - _template-bootstrapjsm.xpi extending resource: urls prior to gecko 2.0, the most common way to load code modules was using resource: urls. the basic syntax of a resource url is as follows: resource://<alias>/<relative-path>/<fil...
Index
through performing some quality assurance testing on your work to make sure you're on the right track. 15 release phase localization you've made it! you've setup up your local and remote environments, you've selected your l10n tools and projects, done some localization and even some testing! now you're ready for the final phase: becoming an official l10n release. here, we'll continue to stay true to the original intent of this guide and only present you with the technical information you need to become an official release. we'll primarily focus on getting your release repository setup and the mercurial commands you'll need to know to use that repository. 16 translation phase localization, localization:tools congratulations on completing the initial setup!
Localizing with Mozilla Translator
s will remove obsolete strings and files from the internal database of mt, and will present you with a list of new and updated strings. if you are starting a new localization, all strings will be marked as new or updated.mt puts a fuzzy flag on each flag and saves it in its database. all this means is that the strings have yet to be translated. you can save your work in progress and reopen it to continue working by selecting view fuzzy from the edit menu. after translating those strings (if using the edit phrase dialog, you can get translation suggestions for strings having an original text equal to existing translations), you can run some automated tests to detect typical errors. after that, you export either the whole product or indvididual files. finally, you commit your changes outside of m...
Localization prerequisites
...
Release phase
we'll primarily focus on getting your release repository setup and the mercurial commands you'll need to know to use that repository. ...
Creating localizable web applications
ersona footer image") . "</a> &raquo;", $locale_conf->url('/demo_create_2'));?> <?printf("<a href=\"%s\">" . _("step 4: submit your persona!") . "</a> &raquo;", $locale_conf->url('/demo_create_4'));?> <div class="tut_left"><?printf("<b>&laquo; <a href=\"%s\">" . _("back to step 1") . "</a></b>", $locale_conf->url('/demo_create'));?></div> <div class="tut_right"><?printf("<b><a href=\"%s\">" . _("continue to step 3") . "</a> &raquo;</b>", $locale_conf->url('/demo_create_3'));?></div> using &laquo; and &raquo; should be ok here for rtl languages (they are flipped correctly if there are no latin characters next to them, which there aren't any), so let's leave it as it is. in general though, we should consider implementing such decorations as css images (background-image or ::after's/::before's cont...
Basics
, increment) { var inputelement = document.getelementbyid(inputid); var size = parseint(inputelement.size) + increment; if (size <= 0) size = 1 inputelement.size = size; } and there could be more... ...
MathML Demo: <mfrac> - fractions
this example. fraction lines should align vertically with the math axis. the same expression 1 2 - 1 2 + 1.23456 7890 in a display. inline fenced nested fractions [ ∥ sin ⁡ θ + 1 11 ∥ - x x 2 a 1 ] + [ 1.0 ] etc. the same expression [ ∥ sin ⁡ θ + 1 11 ∥ - x x 2 a 1 ] + [ 1.0 ] in a display. ...
A brief guide to Mozilla preferences
. if the application encounters any error during loading of a default pref file, the application will issue a warning that a configuration file has failed to load and then quit. this allows system administrators to know quickly if there is a configuration error in the installation. if the application encounters an error when loading user pref files, the application will issue a warning but will continue running. preferences saving usually when the user specifically commits a preference change via user interface such as the preferences dialog, the application saves the change by overwriting prefs.js . on application exit, all user-set preferences are saved to prefs.js . this also means that preferences initially set by user.js will also be saved to prefs.js. do not edit prefs.js directly. n...
Profile Manager
instance of firefox is already running, it will automatically add the -no-remote argument for you, regardless of whether this launch option was checked. locked profiles some profiles may be shown as locked in the main window. such profiles are currently being used by an instance of firefox. if you attempt to perform any operation on a locked profile, you'll get a warning; if you choose to continue despite the warning, you may encounter errors or corrupt a profile. it's strongly recommended to avoid operations on locked profiles. if you need to do something with a locked profile, close the instance of firefox which is using the profile first. backing up and restoring profiles profile manager offers two different mechanisms for backing up and restoring profiles. backup folder pro...
AsyncTestUtils extended framework
nction should yield false or return false when something asynchronous is going on. when the asynchronous operation is complete, something needs to call async_driver(). returning false tells the asynchronous driver that it should yield control up to the top-level. calling async_driver() lets it know to start up again. a function should yield true or return true when the asynchronous driver should continue executing without stopping. a function that does not return anything (or returns undefined) and is not a generator is treated like a function that returned true. most of the things you will want to do already have helper functions that take care of all of this, so all you need to do is pass their return values through. for example, you would do "yield async_move_messages(...);" and be done wit...
NSPR's Position On Abrupt Thread Termination
te corruption, then they must assume that the corruption, like the state, is shared, and their only resource is for the process to terminate. to make this solution work requires that a function that encounters an error be designed such that it first repairs its immediate state, and then reports that error to its caller. if the caller cannot deal with the failure, it must do the same. this process continues until the thread either recovers from the malady or returns from the root function. this is not all that difficult (though having done it a number of times to already existing code, i will admit it isn't much fun either). the implementation of either strategy within the nspr runtime is not difficult. that is not what this memo is about. this is about providing an api that coaxes people to do the...
I/O Functions
r berkeley sockets. differences include the following: the blocking socket functions in nspr take a timeout parameter. two new functions, pr_transmitfile and pr_acceptread, can exploit the new system calls of some operating systems for higher performance. ...
PLHashEnumerator
syntax #include <plhash.h> typedef printn (pr_callback *plhashenumerator)(plhashentry *he, printn index, void *arg); /* return value */ #define ht_enumerate_next 0 /* continue enumerating entries */ #define ht_enumerate_stop 1 /* stop enumerating entries */ #define ht_enumerate_remove 2 /* remove and free the current entry */ #define ht_enumerate_unhash 4 /* just unhash the current entry */ description plhashenumerator is a function type used in the enumerating a hash table. when all the table entries are enumerated, each entry is passed to a user-specified function of type plhashenumerator with the hash table entry, an integer index, and an arbitrary piece of user data as argument. remark the meaning of ht_enumerate_unhash is not clear. in the current implementation, ...
PRThreadState
nt of the process' critical resources. description a thread is a critical resource and must be managed. the lifetime of a thread extends from the time it is created to the time it returns from its root function. what happens when it returns from its root function depends on the thread state passed to pr_createthread when the thread was created. if a thread is created as a joinable thread, it continues to exist after returning from its root function until another thread joins it. the join process permits strict synchronization of thread termination and therefore promotes effective resource management. if a thread is created as an unjoinable (also called detached) thread, it terminates and cleans up after itself after returning from its root function. this results in some ambiguity after the t...
PR_ASSERT
nates execution when a given expression is false. syntax #include <prlog.h> void pr_assert ( expression ); parameters the macro has this parameter: expression any valid c language expression that evaluates to true or false. returns nothing description this macro evaluates the specified expression. when the result is zero (false) the application terminates; otherwise the application continues. the macro converts the expression to a string and passes it to pr_assert, using file and line parameters from the compile-time environment. this macro compiles to nothing if compile-time options are not specified to enable logging. ...
PR EnumerateAddrInfo
possible network addresses of a praddrinfo structure, acquired from pr_getaddrinfobyname. syntax #include <prnetdb.h> void *pr_enumerateaddrinfo( void *enumptr, const praddrinfo *addrinfo, pruint16 port, prnetaddr *result); parameters the function has the following parameters: enumptr the index pointer of the enumeration. to begin an enumeration, this argument is set to null. to continue an enumeration (thereby getting successive addresses from the praddrinfo structure), the value should be set to the function's last returned value. the enumeration is complete when a value of null is returned. addrinfo a pointer to a praddrinfo structure returned by pr_getaddrinfobyname. port the port number to be assigned as part of the prnetaddr structure. this parameter is not checked for ...
PR_EnumerateHostEnt
sible addresses of a prhostent structure, acquired from pr_gethostbyname or pr_gethostbyaddr. syntax #include <prnetdb.h> printn pr_enumeratehostent( printn enumindex, const prhostent *hostent, pruint16 port, prnetaddr *address); parameters the function has the following parameters: enumindex the index of the enumeration. to begin an enumeration, this argument is set to zero. to continue an enumeration (thereby getting successive addresses from the host entry structure), the value should be set to the function's last returned value. the enumeration is complete when a value of zero is returned. hostent a pointer to a prhostent structure obtained from pr_gethostbyname or pr_gethostbyaddr. port the port number to be assigned as part of the prnetaddr structure. this parameter is ...
PR_FindSymbol
the specified symbol in the specified library. if the lib parameter is null, all libraries known to the runtime and the main program are searched in an unspecified order. use this function to look up functions or data symbols in a shared library. getting a pointer to a symbol in a library does indicate that the library is available when the search was made. the runtime does nothing to ensure the continued validity of the symbol. if the library is unloaded, for instance, the results of any pr_findsymbol calls become invalid as well. ...
PR_PopIOLayer
ription pr_popiolayer pops the specified layer from the stack. if the object to be removed is found, pr_popiolayer returns a pointer to the removed object the object then becomes the responsibility of the caller. even if the identity indicates the top layer of the stack, the reference returned is not the file descriptor for the stack and that file descriptor remains valid. in other words, stack continues to point to the top of the stack after the function returns. ...
PR_PushIOLayer
or for a layer (possibly allocated using pr_createiolayerstub) may be pushed onto an existing stack of file descriptors at any time. the new layer is inserted into the stack just above the layer with the identity specified by id. even if the id parameter indicates the topmost layer of the stack, the value of the file descriptor describing the original stack will not change. in other words, stack continues to point to the top of the stack after the function returns. caution keeping the pointer to the stack even as layers are pushed onto the top of the stack is accomplished by swapping the contents of the file descriptor being pushed and the stack's current top layer file descriptor. the intent is that the pointer to the stack remain the stack's identity even if someone (perhaps covertly) has pu...
NSS CERTVerify Log
the log tells you what the problem was with the chain and what certificate in the chain failed. to create a log: #include "secport.h" #include "certt.h" certverifylog *log; arena = port_newarena(512); log = port_arenaznew(arena,log); log->arena = arena; you can then pass this log into your favorite cert verify function. on return: log->count is the number of entries. ...
JSS Provider Notes
e used by the jss jca provider in the current thread. when you call getinstance() on a jca class, the jss provider checks the current per-thread default token (by calling cryptomanager.getthreadtoken()) and instructs the new object to use that token for cryptographic operations. the per-thread default token setting is only consulted inside getinstance(). once a jca object has been created it will continue to use the same token, even if the application later changes the per-thread default token. whenever a new thread is created, its token is initialized to the default, the internal key storage token. thus, the thread token is not inherited from the parent thread. the following example shows how you can specify which token is used for various jca operations: // lookup pkcs #11 tokens crypt...
Mozilla-JSS JCA Provider notes
e used by the jss jca provider in the current thread. when you call getinstance() on a jca class, the jss provider checks the current per-thread default token (by calling cryptomanager.getthreadtoken()) and instructs the new object to use that token for cryptographic operations. the per-thread default token setting is only consulted inside getinstance(). once a jca object has been created it will continue to use the same token, even if the application later changes the per-thread default token. whenever a new thread is created, its token is initialized to the default, the internal key storage token. thus, the thread token is not inherited from the parent thread. the following example shows how you can specify which token is used for various jca operations: // lookup pkcs #11 tokens cryptomanager m...
JSS
Mozilla › Projects › NSS › JSS
s put in fips mode, jss ensures fips compliance by ensuring that all cryptographic operations are performed by the nss cryptographic module. jss offers a jce provider, "mozilla-jss" jca provider notes. jss, jss4.jar, is still built with jdk 1.4.2. while jdk 1.4.2 is eol'd and all new product development should be using the latest javase, legacy business products that must use jdk 1.4 or 1.5 can continue to add nss/jss security fixes/enhancements. jss is used by red hat and sun products that do crypto in java. jss is available under the mozilla public license, the gnu general public license, and the gnu lesser general public license. jss requires nspr and nss. java provides a jce provider called sunpkcs11 (see java pkcs#11 reference guide.) sunpkcs11 can be configured to use the nss module as t...
NSS 3.12.6 release notes
ssl_renegotiate_requires_xtn (default) only allows renegotiation if the peer's hello bears the tls renegotiation_info extension. this is the safe renegotiation. [3|t|t]: ssl_renegotiate_transitional disallows unsafe renegotiation in server sockets only, but allows clients to continue to renegotiate with vulnerable servers. this value should only be used during the transition period when few servers have been upgraded. nss_ssl_require_safe_negotiation values: 1: requiresafenegotiation = true unset: ...
NSS_3.12_release_notes.html
s_method cert_rev_m_test_using_this_method cert_rev_m_allow_network_fetching cert_rev_m_forbid_network_fetching cert_rev_m_allow_implicit_default_source cert_rev_m_ignore_implicit_default_source cert_rev_m_skip_test_on_missing_source cert_rev_m_require_info_on_missing_source cert_rev_m_ignore_missing_fresh_info cert_rev_m_fail_on_missing_fresh_info cert_rev_m_stop_testing_on_fresh_info cert_rev_m_continue_testing_on_fresh_info cert_rev_mi_test_each_method_separately cert_rev_mi_test_all_local_information_first cert_rev_mi_no_overall_info_requirement cert_rev_mi_require_some_fresh_info_available cert_policy_flag_no_mapping cert_policy_flag_explicit cert_policy_flag_no_any cert_enable_ldap_fetch cert_enable_http_fetch new macro in utilrename.h: smime_aes_cbc_128 the nssckbi pkcs #11 module's v...
NSS 3.14 release notes
port for application-defined certificate chain validation callback when using libpkix to better support per-application security policies, a new callback has been added for applications that use libpkix to verify certificates. applications may use this callback to inform libpkix whether or not candidate certificate chains meet application-specific security policies, allowing libpkix to continue discovering certificate paths until it can find a chain that satisfies the policies. the following types have been added in nss 3.14 certchainverifycallback (in certt.h) certchainverifycallbackfunc (in certt.h) cert_pi_chainverifycallback, a new option for certvalparamintype (in certt.h) a new error code: sec_error_application_callback_error (in secerr...
nss tech note8
that is the subject of bug 223242. ...
PKCS11 FAQ
Mozilla › Projects › NSS › PKCS11 › FAQ
in. nss uses installed random number generators if pkcs11_mech_random_flag is set in the installer script. for information on how to do this, see using the jar installation manager to install a pkcs #11 cryptographic module. can mozilla provide a list of all pkcs #11 functions that nss will use? your token should expect to implement all the pkcs #11 functions that make sense for your token. nss continues to evolve, and periodically enhances it's functionality by using a more complete list of pkcs #11 functions. you should have implementations for all the functions specified in the version of the pkcs #11 spec your token implements. if you do not actually do the operation specified by that function, you can return ckr_function_not_supported. will nss get the user's ca certificate via pkcs #11 an...
NSS PKCS11 Functions
ule into nss and connects it to the current nss trust infrastructure. once the the module has been successfully loaded, other nss calls will use it in the normal course of searching. modulespec specifies how the module should be loaded. more information about module spec is available at pkcs11_module_specs. nss parameters may be specified in module specs used by secmod_loadusermodule. module will continue to function in the nss infrastructure until unloaded with secmod_unloadusermodule. secmod_unloadusermodule unload a pkcs #11 module. syntax #include "secmod.h" extern secstatus secmod_unloadusermodule(secmodmodule *module); parameters this function has the following parameters: module is the module to be unloaded. returns the function returns one of these values: if successful, secsuccess. ...
FC_DecryptDigestUpdate
name fc_decryptdigestupdate - continue a multi-part decrypt and digest operation syntax ck_rv fc_decryptdigestupdate( ck_session_handle hsession, ck_byte_ptr pencryptedpart, ck_ulong ulencryptedpartlen, ck_byte_ptr ppart, ck_ulong_ptr pulpartlen ); parameters hsession [in] session handle. pencryptedpart [in] pointer to the encrypted data part. ulencryptedpartlen [in] length of encrypted data in bytes. ppart [in] pointer to the location which receives the recovered data part or null. pulpartlen [in] pointer to the length of the recovered part buffer. description fc_decryptdigestupdate continues a multi-part decrypt and digest operation. after calling both fc_decryptinit and fc_digestinit to set up the operations this function may be called multiple times. the operatio...
FC_DecryptVerifyUpdate
name fc_decryptverifyupdate - continue a multi-part decrypt and verify operation syntax ck_rv fc_decryptverifyupdate( ck_session_handle hsession, ck_byte_ptr pencrypteddata, ck_ulong ulencrypteddatalen, ck_byte_ptr pdata, ck_ulong_ptr puldatalen ); parameters hsession [in] session handle. pencrypteddata [in] pointer to the encrypted data part. ulencrypteddatalen [in] length of encrypted data in bytes. pdata [in] pointer to the location which receives the recovered data part or null. puldatalen [in] pointer to the length of the recovered part buffer. description fc_decryptverifyupdate continues a multi-part decryption and and signature verification operation. after calling both fc_decryptinit and fc_verifyinit to set up the operations this function may be called multi...
FC_DigestEncryptUpdate
name fc_digestencryptupdate - continue a multi-part digest and encryption operation syntax ck_rv fc_digestencryptupdate( ck_session_handle hsession, ck_byte_ptr ppart, ck_ulong ulpartlen, ck_byte_ptr pencryptedpart, ck_ulong_ptr pulencryptedpartlen ); parameters hsession [in] session handle. ppart [in] pointer to the data part. ulpartlen [in] length of data in bytes. pencryptedpart [in] pointer to the location which receives the digested and encrypted part or null. pulencryptedpartlen [in] pointer to the length of the encrypted part buffer. description fc_digestencryptupdate continues a multi-part digest and encryption operation. after calling both fc_digestinit and fc_encryptinit to set up the operations this function may be called multiple times. the operation is f...
FC_DigestKey
name fc_digestkey - add the digest of a key to a multi-part digest operation. syntax ck_rv fc_digestkey( ck_session_handle hsession, ck_object_handle hkey ); parameters hsession [in] session handle. hkey [in] handle of the key to be digested. description fc_digestkey continues a multi-part digest operation by digesting the value of a secret key. the digest for the entire message is returned by a call to fc_digestfinal. a user must log into the token (to assume the nss user role) before calling fc_digestkey. return value examples see also fc_digestinit, fc_digestfinal, nsc_digestkey ...
FC_DigestUpdate
name fc_digestupdate - process the next block of a multi-part digest operation. syntax ck_rv fc_digestupdate( ck_session_handle hsession, ck_byte_ptr ppart, ck_ulong uspartlen ); parameters hsession [in] session handle. ppart [in] pointer to the next block of data to be digested. uspartlen [in] length of data block in bytes. description fc_digestupdate starts or continues a multi-part digest operation. one or more blocks may be part of the message digest operation. the digest for the entire message is returned by a call to fc_digestfinal. a user may call fc_digestupdate without logging into the token (to assume the nss user role). return value examples see also fc_digestinit, fc_digestfinal, nsc_digestupdate ...
FC_SignEncryptUpdate
name fc_signencryptupdate - continue a multi-part signing and encryption operation syntax ck_rv fc_signencryptupdate( ck_session_handle hsession, ck_byte_ptr ppart, ck_ulong ulpartlen, ck_byte_ptr pencryptedpart, ck_ulong_ptr pulencryptedpartlen ); parameters hsession [in] session handle. ppart [in] pointer to the data part. ulpartlen [in] length of data in bytes. pencryptedpart [in] pointer to the location which receives the signed and encrypted data part or null. pulencryptedpartlen [in] pointer to the length of the encrypted part buffer. description fc_signencryptupdate continues a multi-part signature and encryption operation. after calling both fc_signinit and fc_encryptinit to set up the operations this function may be called multiple times. the operation is fi...
FC_SignUpdate
name fc_signupdate - process the next block of a multi-part signing operation. syntax ck_rv fc_signupdate( ck_session_handle hsession, ck_byte_ptr ppart, ck_ulong uspartlen ); parameters hsession [in] session handle. ppart [in] pointer to the next block of the data to be signed. uspartlen [in] length of data block in bytes. description fc_signupdate starts or continues a multi-part signature operation. one or more blocks may be part of the signature. the signature for the entire message is returned by a call to fc_signfinal. a user must log into the token (to assume the nss user role) before calling fc_signupdate. return value examples see also fc_signinit, fc_signfinal, nsc_signupdate ...
FC_VerifyUpdate
name fc_verifyupdate - process the next block of a multi-part verify operation. syntax ck_rv fc_verifyupdate( ck_session_handle hsession, ck_byte_ptr ppart, ck_ulong uspartlen ); parameters hsession [in] session handle. ppart [in] pointer to the next block of the data to be verified. uspartlen [in] length of data block in bytes. description fc_verifyupdate starts or continues a multi-part signature verification operation where the signature is an appendix to the data. one or more blocks may be part of the signature. the result for the entire message is returned by a call to fc_verifyfinal. a user must log into the token (to assume the nss user role) before calling fc_verifyupdate. return value examples see also fc_verifyfinal, nsc_verifyupdate ...
NSS_Initialize
simpler nss initialization functions suffices for your needs, call that instead. the flags parameter is a bitwise or of the following flags: nss_init_readonly - open the databases read only. nss_init_nocertdb - don't open the cert db and key db's, just initialize the volatile certdb. nss_init_nomoddb - don't open the security module db, just initialize the pkcs #11 module. nss_init_forceopen - continue to force initializations even if the databases cannot be opened. nss_init_norootinit - don't try to look for the root certs module automatically. nss_init_optimizespace - optimize for space instead of speed. use smaller tables and caches. nss_init_pk11threadsafe - only load pkcs#11 modules that are thread-safe, i.e., that support locking - either os locking or nss-provided locks . if a pkcs#11 mo...
NSS tools : crlutil
crlutil, is a command-line utility that can list, generate, modify, or delete crls within the nss security database file(s) and list, create, modify or delete certificates entries in a particular crl. the key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database(see certutil tool) and continues with certificates expiration or revocation. this document discusses certificate revocation list management. for information on security module database management, see using the security module database tool. for information on certificate and key database management, see using the certificate database tool. to run the certificate revocation list management tool, type the command crlutil ...
NSS tools : modutil
ncorp.by ref . liability ltd.(c)97 verisign, ou=verisign object signing ca - class 3 organization, ou="verisign, inc.", o=verisign trust network **issuer name**, ou=www.verisign.com/cps incorp.by ref. liability ltd.(c)97 verisign, ou=verisign object signing ca - class 3 organization, ou="verisign, inc.", o=verisign trust network ---------------------------------------------- do you wish to continue this installation? (y/n) y using installer script "installer_script" successfully parsed installation script current platform is linux:5.4.08:x86 using installation parameters for platform linux:5.4.08:x86 installed file crypto.so to /tmp/crypto.so installed file setup.sh to ./pk11inst.dir/setup.sh executing "./pk11inst.dir/setup.sh"... "./pk11inst.dir/setup.sh" executed successfully ins...
NSS Tools crlutil
agement tool is a command-line utility that can list, generate, modify, or delete crls within the nss security database file(s) and list, create, modify or delete certificates entries in a particular crl. the key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database(see certutil tool) and continues with certificates expiration or revocation. this document discusses certificate revocation list management. for information on security module database management, see using the security module database tool. for information on certificate and key database management, see using the certificate database tool. availability see the release notes for the platforms this tool is available on. ...
NSS tools : crlutil
Mozilla › Projects › NSS › tools › crlutil
command-line utility that can list, generate, modify, or delete crls within the nss security database file(s) and list, create, modify or delete certificates entries in a particular crl. the key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database(see certutil tool) and continues with certificates expiration or revocation. this document discusses certificate revocation list management. for information on security module database management, see using the security module database tool. for information on certificate and key database management, see using the certificate database tool. to run the certificate revocation list management tool, type the com...
NSS tools : modutil
Mozilla › Projects › NSS › tools › modutil
corp.by ref . liability ltd.(c)97 verisign, ou=verisign object signing ca - class 3 organization, ou="verisign, inc.", o=verisign trust network **issuer name**, ou=www.verisign.com/cps incorp.by ref. liability ltd.(c)97 verisign, ou=verisign object signing ca - class 3 organization, ou="verisign, inc.", o=verisign trust network ---------------------------------------------- do you wish to continue this installation? (y/n) y using installer script "installer_script" successfully parsed installation script current platform is linux:5.4.08:x86 using installation parameters for platform linux:5.4.08:x86 installed file crypto.so to /tmp/crypto.so installed file setup.sh to ./pk11inst.dir/setup.sh executing "./pk11inst.dir/setup.sh"... "./pk11inst.dir/setup.sh" executed successfully ins...
Rhino Debugger
nt 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 the keyboard execution will resume but control will return to the debugger at the next line in the current function or top-level script. step out to continue execution until the current function returns you may do any of the following: select the debug->step out menu item on the menu bar press the step out button on the toolbar press the f8 key on the keyboard execution will resume until the current function returns or a breakpoint is hit. go to resume execution of a script you may do any of the following: select the debug->go m...
Small Footprint
his functionality, but rhino will otherwise run correctly. class generation library if you do not include optimizer or javaadapter, nor do you use policysecuritycontroller then you do not need rhino library for class file generation and you can remove all the classes from in org.mozilla.classfile package. regular expressions the package org.mozilla.javascript.regexp can be removed. rhino will continue to run, although it will not be able to execute any regular expression matches. this change saves 47,984 bytes of class files. debug information debug information in rhino classes consumes about 25% of code size and if you can live without that, you can recompile rhino to remove it. smalljs.jar ant build script in rhino supports smalljar target that will generate smalljs.jar that does not inc...
Rhino history
navigator written entirely in java and so it needed an implementation of javascript written in java. when netscape stopped work on "javagator," as it was called, somehow rhino escaped the axe (rumor had it that the executives "forgot" it existed). for a time, a couple of major companies (including sun) licensed rhino for use in their products and paid netscape to do so, allowing work on rhino to continue. now rhino is part of mozilla's open-source repository. originally, rhino compiled all javascript code to java bytecodes in generated classfiles. this produced the best performance (often beating the c implementation of javascript when run on a jit), but suffered from two faults. first, compilation time was long since generating java bytecodes and loading the generated classes was a heavyweight ...
Rhino scopes and contexts
an traditional class-based inheritance. this is a large topic in itself, but for our purposes it gives us an easy way to share a set of read-only variables across multiple scopes. to do this we set an object's prototype. when accessing a property of an object in javascript, the object is first searched for a property with the given name. if none is found, the object's prototype is searched. this continues until either the object is found or the end of the prototype chain is reached. so to share information across multiple scopes, we first create the object we wish to share. typically this object will have been created with initstandardobjects and may also have additional objects specific to the embedding. then all we need to do is create a new object and call its setprototypemethod to set the pr...
GC Rooting Guide
virtual trace() method. the implementation should trace all the gc things contained in the object by calling js::traceedge. gc things on the heap js::heap<t> gc thing pointers on the heap must be wrapped in a js::heap<t>. the only exception to this is if they are added as roots with the js::persistentrooted class, but don't do this unless it's really necessary. js::heap<t> pointers must also continue to be traced in the normal way, which is covered below. js::heap<t> doesn't require a jscontext*, and can be constructed with or without an initial value parameter. like the other template classes, it functions as if it were the gc thing pointer itself. one consequence of having different rooting requirements for heap and stack data is that a single structure containing gc thing pointers canno...
Index
js_setarraylength sets the .length property of an object obj. length indicates the number of elements. js_setarraylength(cx, obj, n) is exactly the same as setting the length property of obj to n using js_setproperty. this is true even if obj is not an array object. 447 js_setbranchcallback jsapi reference, obsolete, spidermonkey if the callback returns js_true, the js engine continues to execute the script. 448 js_setcallreturnvalue2 jsapi reference, obsolete, spidermonkey calling js_setcallreturnvalue2 indicates to the runtime that the native will return a value of type reference. 449 js_setcheckobjectaccesscallback jsapi reference, spidermonkey set the runtime-wide check-object-access callback. this function is deprecated. in spider...
Garbage collection
ong pause for marking, the gc does a series of short pauses. the pauses can be set to be 10ms or less. there is always a possibility that a long pause will be required. if the allocation rate is high during incremental gc, the engine may run out of memory before finishing the incremental gc. if so, the engine must immediately restart a full, non-incremental gc in order to reclaim some memory and continue execution. incremental write barrier the problem that requires a write barrier incremental gc requires a write barrier for correctness. todo decent diagrams the basic problem is as follows (see dictionary for color terms). say object a is black and contains a pointer field. let object b be white. now let the incremental slice stop, so the mutator resumes. if the mutator stores b into a, so t...
Tracing JIT
in a hashtable of fragments to see if there is a fragment holding native code for that target pc. if it finds such a fragment, it transitions to executing mode. otherwise it transitions to recording mode. recording when the trace monitor enters recording mode, it constructs a new trace recorder, of type tracerecorder. it then passes control back to the spidermonkey interpreter. the interpreter continues interpreting bytecode, but with an important difference: each bytecode it interprets is also sent to the trace monitor and recorded in the monitor's trace recorder. recording mode is temporary -- ideally it only lasts as long as it takes to record a single iteration of a loop in the interpreter -- and can end in a number of ways. all transitions out of recording mode eventually involve returnin...
JS_ConstructObject
avoid using it. as of spidermonkey 1.8.8, js_constructobject and js_constructobjectwitharguments have been removed from the jsapi. the preferred alternative is to save a copy of the constructor function for the class, then to call it using js_new. a less-preferred short-term solution might be to use this reimplementation of the method, but note that this reimplementation is not guaranteed to continue working across spidermonkey releases. create a new object of the specified class, with the specified prototype and parent, then invokes a constructor function to initialize the new object. syntax jsobject * js_constructobject(jscontext *cx, jsclass *clasp, jsobject *proto, jsobject *parent); jsobject * js_constructobjectwitharguments(jscontext *cx, jsclass *clasp, jsobject *proto, js...
JS_SetBranchCallback
s, the javascript engine calls this callback only from within an active request on cx. the callback does not need to call js_beginrequest()). script jsscript the script that is running. this is guaranteed to be non-null, unless the jsoption_native_branch_callback option has been enabled for the context cx using js_setoptions(). if the callback returns js_true, the js engine continues to execute the script. if the callback raises an exception using js_setpendingexception() and returns js_false, then the javascript engine propagates the exception to the script that was executing at the time. if the callback returns js_false without raising an exception, then the javascript engine immediately stops running the script with an uncatchable error. the engine does not execute fina...
SpiderMonkey 1.8.8
re isn't actually new to spidermonkey 1.8.8 (nor is it even the case that the version number will be 1.8.8!). the mozilla javascript team is pleased to announce the release of spidermonkey 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 u...
SpiderMonkey 17
1.8.5 release notes, so lots of the information here isn't actually new to spidermonkey 17. the mozilla javascript team is pleased to announce the release of spidermonkey 17. you can download 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 u...
SpiderMonkey 24
the spidermonkey 17 release notes, so they're not necessarily complete or fully accurate. the mozilla javascript team is pleased to announce the release of spidermonkey 24. you 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 produc...
SpiderMonkey 31
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. ...
SpiderMonkey 38
it also contains new language and api features described in detail below. ...
SpiderMonkey 45
complete. the mozilla javascript team is pleased to announce the release of spidermonkey 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 ...
SpiderMonkey 52
mozilla javascript team is pleased to announce the release of 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 ...
TPS Tests
ey 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 process. a phase is defined by calling the phase function with the name of the phase and a list of actions to perform: phase('phase1', [ [bookmarks.add, bookmarks_initial], [passwords.add, passwords_initial], [history.add, history_initial], [sync, sync_wipe_server], ]); each action is an array, the first member of which is a function reference...
Handling Mozilla Security Bugs
nsitive" if it is warranted, given the nature and severity of the bug and the risk of potential exploits. other participants besides the permanent security bug group members described above, there are two other categories of people who may participate in security bug group activities and have access to otherwise-confidential security bug reports: a person who reports a security bug will have continued access to all bugzilla activities associated with that bug, even if the bug is marked "security-sensitive." any other persons may be given access to a particular security bug, by someone else (who does have access) adding them to the cc list for that bug. thus someone reporting a security bug essentially becomes a member of the overall group of people working to investigate and fix that parti...
A Web PKI x509 certificate primer
escribing the six extensions we considered critical for understanding. certificates can have other extensions not described on rfc 5280, but that is out of the scope of this document. extensions can be marked as critical or non-critical, conforming certificate verification libraries should stop processing verification when encountering a critical extension that they do not understand ( and should continue processing if the extension is marked as non-critical) mozila::pkix has this behavior. subject alternate name this extension defines what other names (such as dns names) are valid for this certificate. this allows for a certificate to be used for more than one fqdn, for example you can have a certificate that is valid for both a.example.com and b.example.com basic constraints this allows cert...
Gecko states
ned in nsiaccessiblestates. states list state_unavailable the object is unavailable, i.e. disabled. applied to: all roles. state_selected the object is selected, i.e. indicates this object is the child of an object that allows its children to be selected and that this child is one of those children that has been selected. applied to: role_menuitem, role_cell, role_outlineitem, xxx: continue events: event_state_change Сoncomitant state: state_selectable state_focused the object is focused applied to: events: concomitant state: state_focusable state_pressed the object is pressed. state_checked the object is checked state_mixed indicates that the state of a three-state check box or toolbar button is not determined. the check box is neither checked nor unchecked and is ...
Embedded Dialog API
tion's own. skins are very rich and capable; this scheme can probably be made to work for nearly all applications. many embeddors however choose to implement their own dialogs, and this is of course the only way to gain complete control and consistency. an embedding application may implement its own version of all dialogs in gecko. (note that at time of writing this may not be strictly true; work continues on this topic.) all overrideable dialogs are implemented by gecko as a component. a default (xul) implementation of each is provided as part of the gecko package. to replace these default dialogs with its own versions, an application must replace the component which implements them. and note that if an application chooses to replace one of gecko's default dialog components, that application must...
Retrieving part of the bookmarks tree
ve a complex query the root will be a nsinavhistoryqueryresultnode. before accessing the children of any result container, you must first open it, and then you can iterate the children. as long as the container is open, it will listen for notifications from the bookmarks system to keep itself up-to-date. when you're done, be sure to close the container to free up the resources. otherwise, it will continue to get observer notifications and update itself, slowing down the whole browser. var rootnode = result.root; rootnode.containeropen = true; // iterate over the immediate children of this folder and dump to console for (var i = 0; i < rootnode.childcount; i ++) { var node = rootnode.getchild(i); dump("child: " + node.title + "\n"); } // close a container after using it! rootnode.containerope...
XPCOM changes in Gecko 2.0
without having to restart the browser. electrolysis content processes can simply read the component registrations during startup. xpcnativewrapper changes you can't disable xpcnativewrappers from your manifest specifying xpcnativewrappers=no in your manifest (that is, xpcnativewrapper automation) is no longer supported. this was always intended to be a short-term workaround to allow extensions to continue to work while their authors updated their code to use xpcnativewrappers. if your add-on depends upon xbl bindings attached to content objects—for example, the ability to call functions or get and set properties created by the xbl binding—you will need to use the xpcnativewrapper property wrappedjsobject to access wrapped objects. if you need to be able to call functions or access properties d...
Finishing the Component
ire you to do the parsing yourself, you can compare the nsiuri objects with each other, as in the following section. this ensures that the urls are canonical before they are compared. checking the white list the weblock implementation of the shouldload method starts by extracting the scheme of the incoming nsiuri. if the scheme isn't "http", "https", or "ftp", it immediately returns true, which continues the loading process unblocked. these three are the only kinds of uri that weblock will try to block. when it has one, it walks the linked list and creates a new nsiuri object for each string url in the list. from each object, shouldload() extracts the host and compares it to the uri. if they match, the component allows the load to continue by returning true. if these two strings do not match, t...
Starting WebLock
s a list of elements between interfaces. it has two methods: hasmoreelements() and getnext(). [scriptable, uuid(d1899240-f9d2-11d2-bdd6-000064657374)] interface nsisimpleenumerator : nsisupports { /** * called to determine whether or not the enumerator has * any elements that can be returned via getnext(). this method * is generally used to determine whether or not to initiate or * continue iteration over the enumerator, though it can be * called without subsequent getnext() calls. does not affect * internal state of enumerator. * * @see getnext() * @return pr_true if there are remaining elements in the enumerator. * pr_false if there are no more elements in the enumerator. */ boolean hasmoreelements(); /** * called to retrieve the next element i...
Using XPCOM Utilities to Make Things Easier
reference to it, as in the following: someclass::get(nsisupports** aresult) { if (!aresult) return ns_error_null_pointer; nscomptr<nsisupports> value; object->method(getter_addrefs(value)); *aresult = value.get(); ns_if_addref(*aresult); return ns_ok; } the first thing that this method does is check to see that the caller passed a valid address. if not, it doesn't even try to continue. next, it calls another method on an object that is presumed to exist in this context. you can call a .get() method on the nscomptr and have it returned for use as a raw pointer. this raw pointer can then be assigned to a variable and have its reference updated by ns_if_addref. be very careful with the result of .get(), however. you should never call release on this result because it may result i...
Components.utils.reportError
by default. to show them, set the preference 'javascript.options.showinconsole' to true, or use nsconsoleservice instead to show a message. ...
Components.utils.unload
components.utils.unload was introduced in firefox 7 and is used to unload javascript code modules. this can be particularly handy with restartless (boostrapped) extensions, so that you can unload an old version of a code module when a new version of your add-on is installed. once this method has been called, references to the module will continue to work but any subsequent import of the module will reload it and give a new reference. if the javascript code module has not yet been imported then this method will do nothing. you should not unload modules that are part of the application (anything under resource://gre/ or resource:/// or resource://app/) as these may be in use by other extensions and the application. only unload modules you include as part of your extension. syntax components.utils.u...
Observer Notifications
: the data value for this notification is always 'shutdown-persist'. profile-before-change called just before the profile is lost. note: the data value for this notification is always 'shutdown-persist'. profile-before-change-qm called to shut down the quotamanager; this is separated from profile-before-change to allow everything inside profile-before-change to continue using it. profile-before-change-telemetry called to shut down telemetry, again separated to allow everything before this event to continue using it. xpcom-will-shutdown called just before xpcom-shutdown. observer must not spin event loop. xpcom-shutdown assortment of critical services stop operating. many things will not be available here. web-workers-...
nsDependentCString
class declaration nstdependentstring_chart stores a null-terminated, immutable sequence of characters. subclass of nststring that restricts string value to an immutable character sequence. this class does not own its data, so the creator of objects of this type must take care to ensure that a nstdependentstring continues to reference valid memory for the duration of its use. method overview constructors assertvalid rebind operator= get find rfind rfindchar findcharinset rfindcharinset compare equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendi...
nsDependentString
class declaration nstdependentstring_chart stores a null-terminated, immutable sequence of characters. subclass of nststring that restricts string value to an immutable character sequence. this class does not own its data, so the creator of objects of this type must take care to ensure that a nstdependentstring continues to reference valid memory for the duration of its use. method overview constructors assertvalid rebind operator= get find rfind rfindchar findcharinset rfindcharinset equalsignorecase tofloat tointeger mid left right setcharat stripchars stripwhitespace replacechar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appen...
IAccessibleTable
whether it is selected. isselected returns true if the specified cell is selected and false otherwise. return value e_invalidarg if bad [in] passed, [out] value is false. s_ok. modelchange() returns the type and extents describing how a table changed. provided for use by the ia2_event_table_model_changed event handler. this data is only guaranteed to be valid while the thread notifying the event continues. once the handler has returned, the validity of the data depends on how the server manages the life cycle of its objects. also, note that the server may have different life cycle management strategies for controls depending on whether or not a control manages its children. lists, trees, and tables can have a large number of children and thus it's possible that the child objects for those control...
IAccessibleTable2
is selected. isselected returns true if the specified row is selected completely and false otherwise. return value e_invalidarg if bad [in] passed, [out] value is false. s_ok. modelchange() returns the type and extents describing how a table changed. provided for use by the ia2_event_table_model_changed event handler. this data is only guaranteed to be valid while the thread notifying the event continues. once the handler has returned, the validity of the data depends on how the server manages the life cycle of its objects. also, note that the server may have different life cycle management strategies for controls depending on whether or not a control manages its children. lists, trees, and tables can have a large number of children and thus it's possible that the child objects for those control...
mozIStorageProgressHandler
y while an sqlite operation is ongoing. this allows you to monitor the progress and possibly display status information to the user. boolean onprogress( in mozistorageconnection aconnection ); parameters <tt>aconnection</tt> a mozistorageconnection connection indicating the connection for which the callback was invoked. return value return true to abort the request or false to allow it to continue. see also storage mozstorage introduction and how-to article mozistorageconnection database connection to a specific file or in-memory data storage mozistoragestatement create and execute sql statements on a sqlite database. mozistoragevaluearray wraps an array of sql values, such as a result row. mozistoragefunction create a new sqlite function. mozistorageaggregatefunction create a new sqli...
nsIChannel
is value is null, the channel implementation may use the notification callbacks from its load group. the channel may also query the notification callbacks from its load group if its notification callbacks do not supply the requested interface. interfaces commonly requested include: nsiprogresseventsink, nsiprompt, and nsiauthprompt / nsiauthprompt2. when the channel is done, it must not continue holding references to this object. note: a channel implementation should take care when "caching" an interface pointer queried from its notification callbacks. if the notification callbacks are changed, then a cached interface pointer may become invalid and may therefore need to be re-queried. originaluri nsiuri the original uri used to construct the channel. this is used ...
nsIDOMGeoGeolocation
an nsidomgeopositioncallback to be called when the current position is available. errorcallback an nsidomgeopositionerrorcallback that is called if an error occurs while retrieving the position; this parameter is optional. options an nsidomgeopositionoptions object specifying options; this parameter is optional. watchposition() similar to getcurrentposition(), except it continues to call the callback with updated position information periodically until clearwatch() is called. unsigned short watchposition( in nsidomgeopositioncallback successcallback, [optional] in nsidomgeopositionerrorcallback errorcallback, [optional] in nsidomgeopositionoptions options ); parameters successcallback an nsidomgeopositioncallback that is to be called whenever new position ...
nsINavHistoryResult
bserver aobserver); attributes attribute type description root nsinavhistorycontainerresultnode the root of the results. this container gives you access to all the results in the tree. note: keep in mind that you need to open containers for their results to be valid. when a result goes out of scope it will continue to observe changes till it is cycle collected. while the result waits to be collected it will stay in memory, and continue to update itself, potentially causing unwanted additional work. when you close the root node the result will stop observing changes, so it is good practice to close the root node when you are done with a result, since that will avoid unwanted performance hits. read only. ...
nsIPluginHost
creates a new plugin native window object. void newpluginnativewindow( out nspluginnativewindowptr apluginnativewindow ); parameters apluginnativewindow native code only!parsepostbuffertofixheaders this method parses post buffer to find out case insensitive "content-length" string and cr or lf some where after that, then it assumes there is http headers in the input buffer and continue to search for end of headers (crlfcrlf or lflf). it will *always malloc()* output buffer (caller is responsible to free it) if input buffer starts with lf, which comes from 4.x spec http://developer.netscape.com/docs/manuals/communicator/plugin/pgfn2.htm#1007754 "if no custom headers are required, simply add a blank line ('\n') to the beginning of the file or buffer.", it skips that '\n' and cons...
nsIRadioInterfaceLayer
ctivatedatacall( in domstring cid, in domstring reason ); parameters cid missing description reason missing description exceptions thrown missing exception missing description dial() functionality for making and managing phone calls. void dial( in domstring number ); parameters number missing description exceptions thrown missing exception missing description enumeratecalls() will continue calling callback.enumeratecallstate until the callback returns false. void enumeratecalls( in nsiriltelephonycallback callback ); parameters callback missing description exceptions thrown missing exception missing description getdatacalllist() void getdatacalllist(); parameters none. exceptions thrown missing exception missing description getnumberofmessagesfortext() returns the number ...
nsIRequest
etion. resume() resumes the current request. this may have the effect of re-opening any underlying transport and will resume the delivery of data to any open streams. void resume(); parameters none. suspend() suspends the current request. this may have the effect of closing any underlying transport (in order to free up resources), although any open streams remain logically opened and will continue delivering data when the transport is resumed. calling cancel() on a suspended request must not send any notifications (such as onstoprequest) until the request is resumed. note: some implementations are unable to immediately suspend, and may continue to deliver events already posted to an event queue. in general, callers should be capable of handling events even after suspending a request. vo...
nsISimpleEnumerator
ator. nsisupports getnext(); parameters none. return value ns_ok if the call succeeded in returning a non-null value through the out parameter. ns_error_failure if there are no more elements to enumerate. hasmoreelements() called to determine whether or not the enumerator has any elements that can be returned via getnext(). this method is generally used to determine whether or not to initiate or continue iteration over the enumerator, though it can be called without subsequent getnext() calls. does not affect internal state of enumerator. boolean hasmoreelements(); parameters none. return value pr_true if there are remaining elements in the enumerator. pr_false if there are no more elements in the enumerator. remarks this interface was frozen for gecko 0.9.6. see bug 154047 for details. from gec...
nsIStringEnumerator
s generally called within a loop to iterate over the strings in the enumerator. astring getnext(); parameters none. return value the next string in the enumerator. throws an exception if there are no more strings. hasmore() called to determine whether or not the enumerator has any strings that can be returned via getnext(). this method is generally used to determine whether or not to initiate or continue iteration over the enumerator, though it can be called without subsequent getnext() calls. does not affect internal state of enumerator. boolean hasmore(); parameters none. return value true if there are remaining strings in the enumerator. false if there are no more strings in the enumerator. ...
nsITextInputProcessor
inally, flush the pending composition on the focused editor if (!tip.flushpendingcomposition()) { return; // composition is not started } if there is no composition, flushpendingcomposition() starts composition with dispatching compositionstart event automatically. however, if the event is consumed by web content, it returns false. in this case, composition isn't created. so, js-ime shouldn't continue to compose the string. finally, when you commit the composition with the last composition string, just do this: tip.commitcomposition(); when you commit composition with specific string, specify commit string with its argument: tip.commitcompositionwith("foo-bar-buzz"); when you cancel composition, just do this: tip.cancelcomposition(); when you dispatch keydown event (and one or more key...
nsIThread
prthread the nspr thread object corresponding to the nsithread. read only. methods shutdown() shuts down the thread. this causes events to stop being dispatched to the thread, and causes any pending events to run to completion before the thread joins with the current thread (see pr_jointhread() for details). during the execution of this method call, events for the current thread may continue to be processed. warning: this method may not be called from the thread itself. instead, you must only call it from another thread (usually the thread that created it, or the main application thread). when this function returns, the thread will be shut down and will no longer be available to receive events. void shutdown() parameters none. exceptions thrown ns_error_unexpected shu...
nsIUTF8StringEnumerator
method is generally called within a loop to iterate over the strings in the enumerator. autf8string getnext(); parameters none. return value the next string in the enumerator. throws an exception if there are no more strings. hasmore() reports whether or not the enumerator has any strings that can be returned via getnext(). this method is generally used to determine whether or not to initiate or continue iteration over the enumerator, athough it can be called without subsequent getnext() calls. calling this method doesn't affect the internal state of the enumerator. boolean hasmore(); parameters none. return value true if there are remaining strings in the enumerator, otherwise false. ...
nsIUpdateCheckListener
toolkit/mozapps/update/nsiupdateservice.idlscriptable an interface describing an object that listens to the progress of an update check operation. this object is notified as the check continues, finishes and if it has an error. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void oncheckcomplete(in nsixmlhttprequest request, [array, size_is(updatecount)] in nsiupdate updates, in unsigned long updatecount); void onerror(in nsixmlhttprequest request, in nsiupdate update); void onprogress(in nsixmlhttprequest request, in unsigned long position, in unsigned long totalsize); methods oncheckcomplete() called when the update check is completed. void oncheckcomplete(...
Using nsIPasswordManager
is contains the actual password... var pass = e.getnext().queryinterface(components.interfaces.nsipassword); if (pass.host == querystring) { // found it! alert(pass.user); // the username alert(pass.password); // the password break; } } catch (ex) { // do something if decrypting the password failed--probably a continue } } note that the user will be prompted for their master password if they have chosen to set one to secure their passwords. removing a password passwordmanager.removeuser('host','username'); ...
Testing Mozilla code
asan nightly projectthe asan nightly project involves building a firefox nightly browser with the popular addresssanitizer tool and enhancing it with remote crash reporting capabilities for any errors detected.clang static analysisthis document is split in two parts. ...
The libmime module
d definitions next come the definitions of the methods we referred to in the class-init function. the way to access earlier methods (methods defined on the superclass) is to simply extract them from the superclass's object. but note that you cannot get at methods by indirecting through object->class->superclass: that will only work to one level, and will go into a loop if some subclass tries to continue on this method. the easiest way to do this is to make use of the mime_superclass macro that was defined at the top of the file, as shown below. the alternative to that involves typing the literal name of the direct superclass of the class defined in this file, which will be a maintenance headache if the class hierarchy changes. if you use the mime_superclass idiom, then a textual change is req...
Using the Mozilla symbol server
if you want to reload symbols, you can try: nosharedlibrary sharedlibrary lib on older gdb and mac os x there is a python script to download symbols from the mozilla symbol server for gdb, shark and other software that uses symbols. note that the symbol file for the xul library is very large and takes some time to download. this may make it appear as if the script has gotten stuck, but it will continue. symbol indices are named like so: symbols.mozilla.org/{lowercased:name}/{lowercased:name}-{version}-{platform}-{buildid}-symbols.txt. the platform is either 'darwin' (for mac) or 'linux'. the rest of values are based on the contents of the application.ini file under the [app] heading: for example, the thunderbird 3.1b2 release with name=thunderbird, version=3.1b2, buildid=20100430125415 would h...
Zombie compartments
..."). this trailing gunk can be misleading and you shouldn't pay too much attention to it. for example, if i open https://bugzilla.mozilla.org/show_bug.cgi?id=668871 in one tab, then compartment(https://bugzilla.mozilla.org/show_bug.cgi?id=668871) will show up in about:memory. if i then open https://bugzilla.mozilla.org/show_bug.cgi?id=700547 and close the first tab, the same compartment will continue to be used. so i'll end up with a compartment whose name doesn't match the only page open from that origin. this can be confusing at first, so be ready for it. when are compartments destroyed? compartments are destroyed when they are garbage collected. this happens some time after the last reference to them disappears. this means there can be a delay between a page being closed and its comp...
Add to iPhoto
the files we want to open in iphoto. in our case, we have only one file, but we still need an array. so we start by calling corefoundation.cfarraycreatemutable() to create a mutable array with room for one item, specifying the address of the standard callback routines exported by core foundation using the syntax corefoundation.kcftypearraycallbacks.address(). if creating the array succeeded, we continue by creating a new cfurl object from the pathname of the image file returned by the downloadimage() method. this is done by calling the core foundation routine cfurlcreatefromfilesystemrepresentation(). conveniently, we can simply pass in the javascript string, filepath, as the string and filepath.length as its length. the array is then built by using cfarrayappendvalue() to add the new cfurl to ...
Mozilla
y broken down by bugzilla component. data files are typically consumed by dashboards, like www.arewefissionyet.com. testing mozilla code testing your code is important! before you can even get your code committed into the source tree, you have to test it, and larger patches have to have automated tests. these articles will help you master (and continue to excel at) testing mozilla code. the mozilla platform the mozilla project encompasses several technologies that, together, comprise the mozilla platform. these links will direct you to documentation about each of these, as well as how to use the mozilla platform to build your own projects. the rust programming...
Plugin Roadmap for Firefox - Plugins
16 starting with firefox 47 in june 2016, all plugins other than adobe flash are click-to-activate. users choose which sites are allowed to activate each plugin. in addition, the 64-bit firefox for windows only supports the flash plugin. march 2017 starting with firefox 52 in march 2017, plugins other than adobe flash are no longer supported in firefox. firefox extended support release 52 will continue to support non-flash plugins until early 2018. august 2017 starting with firefox 55 in august 2017, users must choose which sites are allowed to activate the flash plugin. users will have the choice to remember the flash setting per-site. this change will be rolled out progressively during august and september 2017. in order to improve security and performance, mozilla will maintain a list o...
Accessibility Inspector - Firefox Developer Tools
ghtly different from the page inspector html pane picker, as shown below: when you "perform a pick", you see the accessibility object highlighted in the accessibility tree, and the picker is then deactivated. note, however, that if you hold the shift key down when "performing a pick", you can "preview" the accessibility object in the tree (and its properties in the right-hand pane), but then continue picking as many times as you like (the picker does not get cancelled) until you release the shift key. when the picker is activated, you can also deactivate it by pressing the picker button a second time, or pressing the esc key. typical use cases the accessibility inspector is very useful for spotting accessibility problems at a glance. for a start, you can investigate items that don't have a...
Set a breakpoint - Firefox Developer Tools
ting breakpoints by bringing up the context menu over a line number. there are a few options available here: add breakpoint: add a standard unconditional breakpoint at this line number (see below). add condition: add a condition and create a conditional breakpoint (see below). add log: add a log point, which logs a value to your console rather than pausing execution as a breakpoint does. continue to here: when stepping through code, this option tells the debugging to continue execution through to this point. unconditional breakpoints an unconditional breakpoint is one where the code will always 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 sou...
Debugger.Script - Firefox Developer Tools
fset in this script, reporting hits to the hit method ofhandler. ifoffset is not a valid offset in this script, throw an error. when execution reaches the given instruction, spidermonkey calls the hit method ofhandler, passing a debugger.frame instance representing the currently executing stack frame. the hit method’s return value should be a resumption value, determining how execution should continue. any number of breakpoints may be set at a single location; when control reaches that point, spidermonkey calls their handlers in an unspecified order. any number of breakpoints may use the samehandler object. breakpoint handler method calls are cross-compartment, intra-thread calls: the call takes place in the same thread that hit the breakpoint, and in the compartment containing the handl...
Tutorial: Set a breakpoint - Firefox Developer Tools
e now gone, the debugger instances will be garbage collected, since they can no longer have any visible effect on firefox’s behavior. the debugger api tries to interact with garbage collection as transparently as possible; for example, if both a debugger.object instance and its referent are not reachable, they will both be collected, even while the debugger instance to which the shadow belonged continues to exist. source metadata generated from file: js/src/doc/debugger/tutorial-breakpoint.md watermark: sha256:c8dd4bb69972b58e59fcbe6870499206463a5e330fda25f1214893595a1c01d0 changeset: ffa775dd5bd4 ...
Debugger-API - Firefox Developer Tools
, spidermonkey, provides a debugging interface named debugger which lets javascript code observe and manipulate the execution of other javascript code. both firefox’s built-in developer tools and the firebug add-on use debugger to implement their javascript debuggers. however, debugger is quite general, and can be used to implement other kinds of tools like tracers, coverage analysis, patch-and-continue, and so on. debugger has three essential qualities: it is a source level interface: it operates in terms of the javascript language, not machine language. it operates on javascript objects, stack frames, environments, and code, and presents a consistent interface regardless of whether the debuggee is interpreted, compiled, or optimized. if you have a strong command of the javascript langua...
Debugger.Object - Firefox Developer Tools
as if by a call to object.preventextensions. for all watchpoint handler methods: handler calls receive the handler object itself as the this value. theframe argument is the current stack frame, whose code is about to perform the operation on the object being reported. if the method returns undefined, then spidermonkey makes the announced change to the object, and continues execution normally. if the method returns an object: if the object has a superseded property whose value is a true value, then spidermonkey does not make the announced change. if the object has a resume property, its value is taken as a resumption value, indicating how execution should proceed. (however, return resumption values are not supported.) if a given method is...
Index - Firefox Developer Tools
, spidermonkey, provides a debugging interface named debugger which lets javascript code observe and manipulate the execution of other javascript code. both firefox’s built-in developer tools and the firebug add-on use debugger to implement their javascript debuggers. however, debugger is quite general, and can be used to implement other kinds of tools like tracers, coverage analysis, patch-and-continue, and so on. 18 debugger when called as a constructor, the debugger object creates a new debugger instance. 19 debugger.environment a debugger.environment instance represents a lexical environment, associating names with variables. each debugger.frame instance representing a debuggee frame has an associated environment object describing the variables in ...
CSS Flexbox Inspector: Examine Flexbox layouts - Firefox Developer Tools
when you select other elements from the inspector panel, so you can edit related css properties and see how the flex items are affected by your changes. the layout flex container section the css pane's layout view includes a collapsible "flex container" section. if you expand the section without selecting a flexbox container, it will only display the message, "select a flex container or item to continue". once you select an element whose display is defined as flex, the panel will include a number of options for viewing details about the flex container and flex items within it. 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 h...
Responsive Design Mode - Firefox Developer Tools
loads. now when you change such settings for the first time, you are given a warning message that tells you these reloads are no longer automatic, and informed about how you can make them automatic. for example: developer toolbox with rdm you can show or hide the developer tools toolbox independently of toggling responsive design mode itself: while responsive design mode is enabled, you can continue browsing as you normally would in the resized content area. device selection just above the viewport there is a label "no device selected"; click this to see a list of device names. select a device, and responsive design mode sets the following properties to match the selected device: screen size device pixel ratio (the ratio of device physical pixels to device-independent pixels) touch ev...
Animation.reverse() - Web APIs
Web › API › Animation › reverse
syntax animation.reverse(); parameters none. ...
Animation.updatePlaybackRate() - Web APIs
in such a case, setting the playbackrate on the animation directly may cause the animation's playback position to jump since its playback position on the main thread may have drifted from the playback position where it is currently running. ...
AudioBufferSourceNode.loop - Web APIs
's default value is false. syntax var loopingenabled = audiobuffersourcenode.loop; audiobuffersourcenode.loop = true | false; value a boolean which is true if looping is enabled; otherwise, the value is false. when looping is enabled, the sound begins playing at the time specified as the start point when start() is called. when the time specified by the loopend property is reached, playback continues at the time specified by loopstart example in this example, the audiocontext.decodeaudiodata function is used to decode an audio track and put it into an audiobuffersourcenode. buttons are provided to play and stop the audio playback, and a slider control is used to change the playbackrate property value on the fly. when the audio is played, it loops. you can run the full example live (or vi...
AudioBufferSourceNode.loopEnd - Web APIs
te, loopstart and loopend properties on the fly. when the audio is played to the end, it loops, but you can control how long the loops last by altering loopstart and loopend. for example, if you set their values to 20 and 25, respectively, then begin playback, the sound will play normally until it reaches the 25 second mark. then the current play position will loop back to the 20 second mark and continue playing until the 25 second mark, ad infinitum (or at least until stop() is called). for a full working example, see this code running live, or view the source. function getdata() { source = audioctx.createbuffersource(); request = new xmlhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata =...
AudioNode - Web APIs
Web › API › AudioNode
t the constructors; it will throw a "function expected" error when you use the constructors. brief history: the first version of the web audio spec only defined the factory methods. after a design review in october 2013, it was decided to add constructors because they have numerous benefits over factory methods. the constructors were added to the spec from august to october 2016. factory methods continue to be included in the spec and are not deprecated. properties audionode.context read only returns the associated baseaudiocontext, that is the object representing the processing graph the node is participating in. audionode.numberofinputs read only returns the number of inputs feeding the node. source nodes are defined as nodes having a numberofinputs property with a value of 0. a...
CacheStorage - Web APIs
hedresponse || ! cachedresponse.ok ) { return false; } return await cachedresponse.json(); } // delete any old caches to respect user's disk space. async function deleteoldcaches( currentcache ) { const keys = await caches.keys(); for ( const key of keys ) { const isourcache = 'myapp-' === key.substr( 0, 6 ); if ( currentcache === key || ! isourcache ) { continue; } caches.delete( key ); } } try { const data = await getdata(); console.log( { data } ); } catch ( error ) { console.error( { error } ); } specifications specification status comment service workersthe definition of 'cachestorage' in that specification. working draft initial definition. ...
CanvasRenderingContext2D.drawFocusIfNeeded() - Web APIs
yntax void ctx.drawfocusifneeded(element); void ctx.drawfocusifneeded(path, element); parameters element the element to check whether it is focused or not. path a path2d path to use. examples managing button focus this example draws two buttons on a canvas. the drawfocusifneeded() method is used to draw a focus ring when appropriate. ...
Console.timeEnd() - Web APIs
Web › API › Console › timeEnd
lling console.time(). see timers in the documentation for details and examples. note: this feature is available in web workers. syntax console.timeend(label); parameters label the name of the timer to stop. once stopped, the elapsed time is automatically displayed in the web console along with an indicator that the time has ended. ...
Console.timeLog() - Web APIs
Web › API › Console › timeLog
e. return if no label parameter included: default: 1042ms if an existing label is included: timer name: 1242ms exceptions if there is no running timer, timelog() returns the warning: timer “default” doesn’t exist. if a label parameter is included, but there is no corresponding timer: timer “timer name” doesn’t exist. examples console.time("answer time"); alert("click to continue"); console.timelog("answer time"); alert("do a bunch of other stuff..."); console.timeend("answer time"); the output from the example above shows the time taken by the user to dismiss the first alert box, followed by the time it took for the user to dismiss the second alert: notice that the timer's name is displayed when the timer value is logged using timelog() and again when it's stopped. ...
console - Web APIs
Web › API › Console
f a specific operation. to start one, call the console.time() method, giving it a name as the only parameter. to stop the timer, and to get the elapsed time in milliseconds, just call the console.timeend() method, again passing the timer's name as the parameter. up to 10,000 timers can run simultaneously on a given page. for example, given this code: console.time("answer time"); alert("click to continue"); console.timelog("answer time"); alert("do a bunch of other stuff..."); console.timeend("answer time"); will log the time needed by the user to dismiss the alert box, log the time to the console, wait for the user to dismiss the second alert, and then log the ending time to the console: notice that the timer's name is displayed both when the timer is started and when it's stopped. note: i...
CustomEvent - Web APIs
is being processed. event.explicitoriginaltarget read only the explicit original target of the event (mozilla-specific.) event.originaltarget read only the original target of the event, before any retargetings. (mozilla-specific.) event.returnvalue a historical property introduced by internet explorer and eventually adopted into the dom specification in order to ensure existing sites continue to work. ideally, you should try to use event.preventdefault() and event.defaultprevented instead, but you can use returnvalue if you choose to do so. event.srcelement a non-standard alias (from old versions of microsoft internet explorer) for event.target. some other browsers are starting to support it for web compatibility purposes. event.target read only a reference to the target to whi...
Document: drag event - Web APIs
interface dragevent event handler property ondrag examples see this code in a jsfiddle demo or interact with it below. ...
Document.requestStorageAccess() - Web APIs
nd rejects if access was denied. when the promise gets resolved, the resolve handler will run as if a user gesture is being processed, whether the promise was fulfilled or rejected: in the former case, code can then start to call apis that require user activation and things can move forward. in the latter case, code can run to inform the user of why the request failed and what they can do to continue (for example asking them to log in, if that is a requirement). examples document.requeststorageaccess().then( () => { console.log('access granted') }, () => { console.log('access denied') } ); specifications the api is currently only at the proposal stage — the standardization process has yet to begin. you can currently find specification details of the api at apple's introducing stora...
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
element, myp. myp.removechild(mytextnode); text node mytextnode (containing the word "world") still exists. the following code attaches mytextnode to the recently created <p> element, mynewptagnode. mynewptagnode.appendchild(mytextnode); the final state for the modified object tree looks like this: creating a table dynamically (back to sample1.html) for the rest of this article we will continue working with sample1.html. the following figure shows the table object tree structure for the table created in the sample. reviewing the html table structure creating element nodes and inserting them into the document tree the basic steps to create the table in sample1.html are: get the body object (first item of the document object). create all the elements. finally, append each child ...
Element: MSInertiaStart event - Web APIs
this event may not be fired if the scroll is sufficiently slow. it is a proprietary event specific to microsoft edge and internet explorer. ...
Element.localName - Web APIs
Web › API › Element › localName
usiness> note: in gecko 1.9.2 and earlier, the property returns the upper-cased version of the local name for html elements in html doms (as opposed to xhtml elements in xml doms). in later versions, in compliance with html5, the property returns in the case of the internal dom storage, which is lower case for both html elements in html doms and xhtml elements in xml doms. the tagname property continues to return in the upper case for html elements in html doms. specifications specification status comment domthe definition of 'element.localname' in that specification. living standard initial definition ...
Element.setPointerCapture() - Web APIs
are only generated when crossing the boundary of the capture target. this has the effect of suppressing these events on all other elements. overview of pointer capture pointer capture allows events for a particular pointer event (pointerevent) to be re-targeted to a particular element instead of the normal (or hit test) target at a pointer's location. this can be used to ensure that an element continues to receive pointer events even if the pointer device's contact moves off the element (such as by scrolling or panning). syntax targetelement.setpointercapture(pointerid); parameters pointerid the pointerid of a pointerevent object. return value this method returns undefined. exceptions exception explanation invalidpointerid pointerid does not match any of...
Event.preventDefault() - Web APIs
as noted below, calling preventdefault() for a non-cancelable event, such as one dispatched via eventtarget.dispatchevent(), without specifying cancelable: true has no effect. ...
Event.returnValue - Web APIs
Web › API › Event › returnValue
the value is false. the value returned by returnvalue is the opposite of the value returned by defaultprevented. usage notes returnvalue was introduced into the dom by internet explorer 6, and due to that browser's ubiquity became so commonly used that other browsers eventually implemented it as well. it has been adopted into the dom specification, primarily to ensure that existing web content continues to function going forward. new projects should generally avoid using returnvalue, although they may if they choose to do so. specifications specification status comment domthe definition of 'returnvalue' in that specification. living standard added for legacy compatibility. ...
Event - Web APIs
Web › API › Event
is being processed. event.explicitoriginaltarget read only the explicit original target of the event (mozilla-specific.) event.originaltarget read only the original target of the event, before any retargetings. (mozilla-specific.) event.returnvalue a historical property introduced by internet explorer and eventually adopted into the dom specification in order to ensure existing sites continue to work. ideally, you should try to use event.preventdefault() and event.defaultprevented instead, but you can use returnvalue if you choose to do so. event.srcelement a non-standard alias (from old versions of microsoft internet explorer) for event.target. some other browsers are starting to support it for web compatibility purposes. event.target read only a reference to the target to whi...
EventTarget.dispatchEvent() - Web APIs
ncaught exceptions. the event handlers run on a nested callstack; they block the caller until they complete, but exceptions do not propagate to the caller. notes unlike "native" events, which are fired by the dom and invoke event handlers asynchronously via the event loop, dispatchevent() invokes event handlers synchronously. all applicable event handlers will execute and return before the code continues on after the call to dispatchevent(). dispatchevent() is the last step of the create-init-dispatch process, which is used for dispatching events into the implementation's event model. the event can be created using event constructor. see also the event object reference. example see creating and triggering events. specifications specification status comment domth...
Using Fetch - Web APIs
onst re = /\n|\r|\r\n/gm; let startindex = 0; let result; for (;;) { let result = re.exec(chunk); if (!result) { if (readerdone) { break; } let remainder = chunk.substr(startindex); ({ value: chunk, done: readerdone } = await reader.read()); chunk = remainder + (chunk ? ...
Using files from web applications - Web APIs
g website and want to use html to display thumbnail previews of images before the user actually uploads them. you can establish your input element or drop zone as discussed previously and have them call a function such as the handlefiles() function below. function handlefiles(files) { for (let i = 0; i < files.length; i++) { const file = files[i]; if (!file.type.startswith('image/')){ continue } const img = document.createelement("img"); img.classlist.add("obj"); img.file = file; preview.appendchild(img); // assuming that "preview" is the div output where the content will be displayed. const reader = new filereader(); reader.onload = (function(aimg) { return function(e) { aimg.src = e.target.result; }; })(img); reader.readasdataurl(file); } } here our ...
FileError - Web APIs
Web › API › FileError
start chrome with the --allow-file-access-from-files flag. use the flag only for testing purposes. attribute attribute type description code unsigned short the most appropriate error code for the condition. see error codes for possible values. error codes note: do not rely on the numeric values of the constants, which might change as the specifications continue to change. use the constant names instead. constant value description encoding_err 5 the url is malformed. make sure that the url is complete and valid. invalid_modification_err 9 the modification requested is not allowed. for example, the app might be trying to move a directory into its own child or moving a file into its parent directory without cha...
FileException - Web APIs
fs.root.getfile('log.txt', {create: true, exclusive:true}0; } catch (e) { onerrror(e); } the sample code was borrowed from html5rocks attribute attribute type description code unsigned short the most appropriate error code for the condition. constants note: do not rely on the numeric values of the constants, which might change as the specifications continue to change. use the constant names instead. constant value description encoding_err 5 the url is malformed. make sure that the url is complete and valid. invalid_modification_err 9 the modification requested is not allowed. examples of invalid modifications include moving a directory into its own child or moving a file into its parent directory without...
Using microtasks in JavaScript with queueMicrotask() - Web APIs
events and other callbacks. second, if a microtask adds more microtasks to the queue by calling queuemicrotask(), those newly-added microtasks execute before the next task is run. that's because the event loop will keep calling microtasks until there are none left in the queue, even if more keep getting added. warning: since microtasks can themselves enqueue more microtasks, and the event loop continues processing microtasks until the queue is empty, there's a real risk of getting the event loop endlessly processing microtasks. be cautious with how you go about recursively adding microtasks. using microtasks before getting farther into this, it's important to note again that most developers won't use microtasks much, if at all. they're a highly specialized feature of modern browser-based jav...
Ajax navigation example - Web APIs
rview = new regexp("&" + sviewkey + "\\=[^&]*|&*$", "i"), rendqstmark = /\?$/, oloadingbox = document.createelement("div"), ocover = document.createelement("div"), oloadingimg = new image(), opageinfo = { title: null, url: location.href }, ohttpstatus = /* http://www.iana.org/assignments/http-status-codes/http-status-codes.xml */ { 100: "continue", 101: "switching protocols", 102: "processing", 200: "ok", 201: "created", 202: "accepted", 203: "non-authoritative information", 204: "no content", 205: "reset content", 206: "partial content", 207: "multi-status", 208: "already reported", 226: "im used...
IDBCursor.advance() - Web APIs
Web › API › IDBCursor › advance
cursor is currently being iterated or has iterated past its end. example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through the records in the object store. here we use cursor.advance(2) to jump 2 places forward each time, meaning that only every other result will be displayed. advance() works in a similar way to idbcursor.continue, except that it allows you to jump multiple records at a time, not just always go onto the next record. note that in each iteration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo. for a complete working example, see our idbcursor example (view example live.) function advanceresult() { list.innerhtml = ''; var transaction = db.transactio...
IDBCursor.delete() - Web APIs
Web › API › IDBCursor › delete
quest = cursor.delete(); request.onsuccess = function() { console.log('deleted that mediocre album from 1984. even power windows is better.'); }; } else { var listitem = document.createelement('li'); listitem.innerhtml = '<strong>' + cursor.value.albumtitle + '</strong>, ' + cursor.value.year; list.appendchild(listitem); } cursor.continue(); } else { console.log('entries displayed.'); } }; }; specifications specification status comment indexed database api 2.0the definition of 'delete()' in that specification. recommendation indexed database api draftthe definition of 'delete()' in that specification. recommendation browser compatibility the compatibility t...
IDBCursor.direction - Web APIs
recommendation indexed database api draftthe definition of 'direction' in that specification. recommendation browser compatibility th...
IDBCursor.key - Web APIs
Web › API › IDBCursor › key
recommendation indexed database api draftthe definition of 'key' in that specification. recommendation browser compatibility the compatibility table...
IDBCursor.primaryKey - Web APIs
recommendation indexed database api draftthe definition of 'primarykey' in that specification. recommendation browser compatibility the compa...
IDBCursor.request - Web APIs
Web › API › IDBCursor › request
recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute ...
IDBCursor.source - Web APIs
Web › API › IDBCursor › source
recommendation indexed database api draftthe definition of 'source' in that specification. recommendation browser compatibility the compatibility...
IDBCursor.update() - Web APIs
Web › API › IDBCursor › update
recommendation indexed database api draftthe definition of 'update()' in that specification. recommendation browser compatibility the compatibility...
IDBCursorWithValue.value - Web APIs
recommendation indexed database api draftthe definition of 'idbdatabase' in that specification. recommendation browser compatibility the compatibi...
IDBCursorWithValue - Web APIs
recommendation indexed database api draftthe definition of 'idbcursorwithvalue' in that specification. recommendation browser compatibilit...
IDBDatabaseException - Web APIs
can be encountered while performing database operations. attributes attribute type description code unsigned short the most appropriate error code for the condition. message domstring error message describing the exception raised. constants note: do not rely on the numeric values of the constants, which might change as the specifications continue to change. use the constant names instead. constant value description abort_err 8 a request was aborted, for example, through a call to idbtransaction.abort. constraint_err 4 a mutation operation in the transaction failed because a constraint was not satisfied. for example, an object, such as an object store or index, already exists and a request...
IDBIndex.count() - Web APIs
Web › API › IDBIndex › count
recommendation indexed database api draftthe definition of 'count()' in that specification. recommendation browser compatibility the compatibil...
IDBIndex.get() - Web APIs
Web › API › IDBIndex › get
recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please chec...
IDBIndex.getKey() - Web APIs
Web › API › IDBIndex › getKey
recommendation indexed database api draftthe definition of 'getkey()' in that specification. recommendation browser compatibility the compatibil...
IDBIndex.isAutoLocale - Web APIs
...
IDBIndex.keyPath - Web APIs
Web › API › IDBIndex › keyPath
recommendation indexed database api draftthe definition of 'keypath' in that specification. recommendation browser compatibility the compatibility...
IDBIndex.locale - Web APIs
Web › API › IDBIndex › locale
...
IDBIndex.multiEntry - Web APIs
recommendation indexed database api draftthe definition of 'multientry' in that specification. recommendation browser compatibility the compati...
IDBIndex.name - Web APIs
Web › API › IDBIndex › name
recommendation indexed database api draftthe definition of 'name' in that specification. recommendation browser compatibility the compatibility table...
IDBIndex.objectStore - Web APIs
recommendation indexed database api draftthe definition of 'objectstore' in that specification. recommendation browser compatibility the compa...
IDBIndex.openCursor() - Web APIs
recommendation indexed database api draftthe definition of 'opencursor()' in that specification. recommendation browser compatibility the co...
IDBIndex.openKeyCursor() - Web APIs
recommendation indexed database api draftthe definition of 'openkeycursor()' in that specification. recommendation browser compatibili...
IDBIndex.unique - Web APIs
Web › API › IDBIndex › unique
recommendation indexed database api draftthe definition of 'unique' in that specification. recommendation browser compatibility the compatibility t...
IDBIndex - Web APIs
Web › API › IDBIndex
recommendation indexed database api draftthe definition of 'idbindex' in that specification. recommendation browser compatibility the compatibilit...
IDBKeyRange.bound() - Web APIs
Web › API › IDBKeyRange › bound
recommendation indexed database api draftthe definition of 'bound()' in that specification. recommendation browser compatibility the c...
IDBKeyRange.lower - Web APIs
Web › API › IDBKeyRange › lower
recommendation indexed database api draftthe definition of 'lower' in that specification. recommendation browser compatibility the comp...
IDBKeyRange.lowerBound() - Web APIs
recommendation indexed database api draftthe definition of 'lowerbound()' in that specification. recommendation browser compatibil...
IDBKeyRange.lowerOpen - Web APIs
recommendation indexed database api draftthe definition of 'loweropen' in that specification. recommendation browser compatibility the...
IDBKeyRange.only() - Web APIs
Web › API › IDBKeyRange › only
recommendation indexed database api draftthe definition of 'only' in that specification. recommendation browser compatibility the compatibi...
IDBKeyRange.upper - Web APIs
Web › API › IDBKeyRange › upper
recommendation indexed database api draftthe definition of 'upper' in that specification. recommendation browser compatibility the comp...
IDBKeyRange.upperBound() - Web APIs
recommendation indexed database api draftthe definition of 'upperbound()' in that specification. recommendation browser compati...
IDBKeyRange.upperOpen - Web APIs
recommendation indexed database api draftthe definition of 'upperopen' in that specification. recommendation browser compatibility ...
IDBKeyRange - Web APIs
recommendation initial definition. indexed database api draftthe definition of 'idbkeyrange' in that specification. recommendation adds includes(). ...
IDBLocaleAwareKeyRange - Web APIs
...
IDBObjectStore.index() - Web APIs
recommendation indexed database api draftthe definition of 'index()' in that specification. recommendation browser compatibility the compatibility...
IDBObjectStore.openCursor() - Web APIs
recommendation indexed database api draftthe definition of 'opencursor()' in that specification. recommendation browser compatibility the compatibility table on this pa...
IDBObjectStore.openKeyCursor() - Web APIs
recommendation indexed database api draftthe definition of 'openkeycursor()' in that specification. recommendation ...
IIRFilterNode - Web APIs
filters can be automated. all even-ordered iir filters can be created using biquadfilternode. however, if you need to create an odd-ordered iir filter, you'll need to use iirfilternode. you may also find this interface useful if you don't need automation, or for other reasons. once the node has been created, you can't change its coefficients. iirfilternodes have a tail-time reference; they continue to output non-silent audio with zero input. as an iir filter, the non-zero input continues forever, but this can be limited after some finite time in practice, when the output has approached zero closely enough. the actual time that takes depends on the filter coefficients provided. constructor iirfilternode() creates a new instance of an iirfilternode object. properties this interface ha...
IdleDeadline.timeRemaining() - Web APIs
for example, if the callback finishes a task and has another one to begin, it can call timeremaining() to see if there's enough time to complete the next task. if there isn't, the callback can just return immediately, or look for other work to do with the remaining time. ...
Browser storage limits and eviction criteria - Web APIs
w.mozilla.org, and joe.blogs.mozilla.org can aggregately use a maximum of 20% of the global limit. firefox.com has a separate maximum of 20%. the two limits react differently to limits being reached: the group limit is also called the "hard limit": it doesn't trigger origin eviction. the global limit is a "soft limit" since there's a chance that some space will be freed and the operation can continue. note: the group limit can't be more than the global limit, despite the minimum group limit mentioned above. if you had a really low memory situation where the global limit was, say, 8 mb, then the group limit would also be 8 mb. note: if the group limit is exceeded, or if origin eviction couldn't free enough space, the browser will throw a quotaexceedederror. note: in chrome the soft an...
Checking when a deadline is due - Web APIs
st that inserts the item back into the database var requestupdate = objectstore.put(data); // when this new request succeeds, run the displaydata() function again to update the display requestupdate.onsuccess = function() { displaydata(); } if the checks all match, we then run the createnotification() function to provide a notification to the user. cursor.continue(); } } } the last line of the function moves the cursor on, which causes the above deadline checking mechanism to be run for the next task stored in the indexeddb. keep on checking! of course, it is no use to just run the above deadline checking function once! we want to keep constantly checking all the deadlines to see if any of them are being reached. to do this, we are simply using se...
Intersection Observer API - Web APIs
ion of the two blocks and the clipping mode (if any) specified by the overflow property. setting overflow to anything but visible causes clipping to occur. if one of the containing elements is the root of a nested browsing context (such as the document contained in an <iframe>, the intersection rectangle is clipped to the containing context's viewport, and recursion upward through the containers continues with the container's containing block. so if the top level of an <iframe> is reached, the intersection rectangle is clipped to the frame's viewport, then the frame's parent element is the next block recursed through toward the intersection root. when recursion upward reaches the intersection root, the resulting rectangle is mapped to the intersection root's coordinate space. the resulting rect...
MediaRecorder.ondataavailable - Web APIs
ecorder.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 captured since recording began or the last time a dataavailable event occurred is delivered; then a new blob is created and media capture continues into that blob. if a timeslice property was passed into the mediarecorder.start() method that started media capture, a dataavailable event is fired every timeslice milliseconds. that means that each blob will have a specific time duration (except the last blob, which might be shorter, since it would be whatever is left over since the last event). so if the method call looked like this — recor...
MediaRecorder.pause() - Web APIs
set mediarecorder.state to "paused". ...
MediaRecorder.resume() - Web APIs
the mediarecorder.resume() method (part of the mediarecorder api) is used to resume media recording when it has been previously paused. when the resume() method is invoked, the browser queues a task that runs the following steps: if mediarecorder.state is "inactive", raise a dom invalidstate error and terminate these steps. if mediarecorder.state is not "inactive", continue to the next step. set mediarecorder.state to "recording". continue gathering data into the current blob. raise a resume event. syntax mediarecorder.resume() errors an invalidstate error is raised if the resume() method is called while the mediarecorder object’s mediarecorder.state is "inactive" — the recording cannot be resumed if it is not already paused; if mediarecorder.state is already "recording", resume()...
MediaRecorder.stop() - Web APIs
set the mediarecorder.state to "inactive" and stop capturing media. ...
MediaRecorder - Web APIs
obitspersecond read only returns the audio encoding bit rate in use. this may differ from the bit rate specified in the constructor (if it was provided). methods mediarecorder.pause() pauses the recording of media. mediarecorder.requestdata() requests a blob containing the saved data received thus far (or since the last time requestdata() was called. after calling this method, recording continues, but in a new blob. mediarecorder.resume() resumes recording of media after having been paused. mediarecorder.start() begins recording media; this method can optionally be passed a timeslice argument with a value in milliseconds. if this is specified, the media will be captured in separate chunks of that duration, rather than the default behavior of recording the media in a single large chun...
MutationObserver.observe() - Web APIs
et, then the existing observers are left alone and the new one is added. observation follows nodes when disconnected mutation observers are intended to let you be able to watch the desired set of nodes over time, even if the direct connections between those nodes are severed. if you begin watching a subtree of nodes, and a portion of that subtree is detached and moved elsewhere in the dom, you continue to watch the detached segment of nodes, receiving the same callbacks as before the nodes were detached from the original subtree. in other words, until you've been notified that nodes are being split off from your monitored subtree, you'll get notifications of changes to that split-off subtree and its nodes. this prevents you from missing changes that occur after the connection is severed and be...
Node.localName - Web APIs
Web › API › Node › localName
usiness> note: in gecko 1.9.2 and earlier, the property returns the upper-cased version of the local name for html elements in html doms (as opposed to xhtml elements in xml doms). in later versions, in compliance with html5, the property returns in the case of the internal dom storage, which is lower case for both html elements in html doms and xhtml elements in xml doms. the tagname property continues to return in the upper case for html elements in html doms. for nodes of any type other than element_node and attribute_node localname is always null. specifications specification status comment document object model (dom) level 3 core specificationthe definition of 'node.localname' in that specification. obsolete document object model (dom) level ...
PaymentResponse.retry() - Web APIs
only when the user either cancels the payment request or the request is successful. see the example below for a thorough example, but the basic concept, in outline form, is: create a new paymentrequest (new paymentrequest()) display the payment request (paymentrequest.show() if show() resolves, the returned paymentresponse describes the requested payment and the options chosen by the user. continue by... validate the returned reponse; if there are any fields whose values are not acceptable, call the response's complete() method with a value of "fail" to indicate failure. if the response's data is valid and acceptable, call complete("success") to finalize the payment and proces it. if show() is rejected, the payment request failed, usually because either there's already one be...
Using Pointer Events - Web APIs
this is done by looking at each touch's pointerevent.pointerid property. this property is a unique integer for each pointer event, and remains consistent for each event during the duration of...
Pointer events - Web APIs
: the button property indicates a change in the state of the button. however, as in the case of touch, when multiple events occur with one event, all of them have the same value. pointer capture pointer capture allows events for a particular pointer event to be re-targeted to a particular element instead of the normal hit test at a pointer's location. this can be used to ensure that an element continues to receive pointer events even if the pointer device's contact moves off the element (for example by scrolling). the following example shows pointer capture being set on an element. <html> <script> function downhandler(ev) { let el = document.getelementbyid("target"); // element 'target' will receive/capture further events el.setpointercapture(ev.pointerid); } function init(...
RTCDataChannel.bufferedAmount - Web APIs
r agent may implement the process of actually sending data in any way it chooses; this may be done periodically during the event loop or truly asynchronously. as messages are actually sent, this value is reduced accordingly. closing the data channel doesn't reset this count, even though the user agent purges the queued messages. however, even after closing the channel, attempts to send messages continue to add to the bufferedamount value, even though the messages are neither sent nor buffered. whenever this value decreases to fall to or below the value specified in the bufferedamountlowthreshold property, the user agent fires the bufferedamountlow event. this event may be used, for example, to implement code which queues more messages to be sent whenever there's room to buffer them. syntax v...
RTCDataChannel.maxPacketLifeTime - Web APIs
the read-only rtcdatachannel property maxpacketlifetime returns the amount of time, in milliseconds, the browser is allowed to take to attempt to transmit a message, as set when the data channel was created, or null. this limits how long the browser can continue to attempt to transmit and retransmit the message before giving up. syntax var lifetime = adatachannel.maxpacketlifetime; value the number of milliseconds over which the browser may continue to attempt to transmit the message until it either succeeds or gives up. if not set when rtcpeerconnection.createdatachannel() was called to create the data channel, this value is null. example // tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition o...
RTCIceCandidatePairStats.nominated - Web APIs
pair should be used to configure the webrtc connection between the two peers. note: if more than one candidate pair are nominated at the same time, the one whose priority is higher will be selected for use. once a candidate pair has been nominated and the two peers have each reconfigured themselves to use the specified configuration, the ice negotiation process can potentially end (or it can continue, to allow the connection to adapt to changing conditions). specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatepairstats.nominated' in that specification. candidate recommendation initial specification. ...
RTCIceTransport.getSelectedCandidatePair() - Web APIs
on, it gathers and analyzes candidate configurations from each the two peers. as soon as it finds an acceptable matching pair of candidates, meeting the requirements for the connection, a selectedcandidatepairchange event is fired at the rtcicetransport. from that time forward, the best matching pair of candidates will always be available by calling getselectedcandidatepair(). as ice negotiation continues, any time a pair of candidates is discovered that is better than the currently-selected pair, the new pair is selected, replacing the previous pairing, and the selectedcandidatepairchange event is fired again. note: it's possible for one of the configurations in the selected candidate pair to remain unchanged when a new pairing is chosen. example in this example, an event handler for select...
RTCIceTransport.onselectedcandidatepairchange - Web APIs
connection. syntax rtcicetransport.onselectedcandidatepairchange = candidatepairhandler; value this propoerty should be set to reference an event handler function to be called by the ice agent when it discovers a new candidate pair that the rtcicetransport will be using for communication with the remote peer. this event will occur at least once, and may occur more than once if the ice agent continues to identify candidate pairs that will work better, more closely match the requested parameters, and so forth. the event handler can determine the current state by calling the transport's getselectedcandidatepair() method, which returns a rtcicecandidatepair whose rtcicecandidatepair.local and rtcicecandidatepair.global properties specify rtcicecandidate objects describing the local and remote c...
RTCOfferAnswerOptions.voiceActivityDetection - Web APIs
...
RTCPeerConnection.createAnswer() - Web APIs
terface 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 code and documentation, you may see a callback-based ...
RTCPeerConnection - Web APIs
terface 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. ...
RTCRtpStreamStats - Web APIs
lost packets, lost frames, and how heavily compressed the data is. fircount a count of the total number of full intra request (fir) packets received by the sender. this statistic is only available to the device which is receiving the stream and is only available for video tracks. a fir packet is sent by the receiving end of the stream when it falls behind or has lost packets and is unable to continue decoding the stream; the sending end of the stream receives the fir packet and responds by sending a full frame instead of a delta frame, thereby letting the receiver "catch up." the higher this number is, the more often a problem of this nature arose, which can be a sign of network congestion or an overburdened receiving device. nackcount the number of times the receiver notified the sender th...
Range.getBoundingClientRect() - Web APIs
s method is useful for determining the viewport coordinates of the cursor 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>. the bounding client rectangle contains everything selected in the range.</p> css #highlight { background: yellow; position: absolute; z-index: -1; } p { width: 200px; } javascript const range = document.createrange(); range.setstartbefore(document.getelementsbytagname('b').item(0), 0); range.setendafter(document.getelementsbytagname('b').item(1), 0); c...
ReadableStreamDefaultReader.read() - Web APIs
let re = /\r\n|\n|\r/gm; let startindex = 0; let result; for (;;) { let result = re.exec(chunk); if (!result) { if (readerdone) { break; } let remainder = chunk.substr(startindex); ({value: chunk, done: readerdone} = await reader.read()); chunk = remainder + (chunk ? ...
SVGSVGElement - Web APIs
all currently running animations that are defined within the svg document fragment corresponding to this <svg> element, causing the animation clock corresponding to this document fragment to stand still until it is unpaused. svgsvgelement.unpauseanimations() unsuspends (i.e., unpauses) currently running animations that are defined within the svg document fragment, causing the animation clock to continue from the time at which it was suspended. svgsvgelement.animationspaused() returns true if this svg document fragment is in a paused state. svgsvgelement.getcurrenttime() returns the current time in seconds relative to the start time for the current svg document fragment. if getcurrenttime() is called before the document timeline has begun (for example, by script running in a <script> element ...
ServiceWorkerGlobalScope.onpushsubscriptionchange - Web APIs
event of the serviceworkerglobalscope interface is fired to indicate a change in push subscription that was triggered outside the application's control, e.g. when browser refresh the push subscription. previously, it was defined as the event interface that is fired whenever a push subscription has been invalidated (or is about to become so). this offers an opportunity to resubscribe in order to continue receiving push messages, if desired. this might happen if, for example, the push service sets an expiration time a subscription. syntax serviceworkerglobalscope.onpushsubscriptionchange = function() { ... } self.addeventlistener('pushsubscriptionchange', function() { ... }) example self.addeventlistener('pushsubscriptionchange', function() { // do something, usually resubscribe to push and...
Storage Access API - Web APIs
as an example, federated logins often require access to authentication cookies stored in first-party storage, and will require the user to sign in on each site separately (or completely break) if those cookies are not available. in the case of breakage, site owners have often encouraged users to add their site as an exception or to disable the policy entirely. as a consequence, users who wish to continue to interact with embedded content are forced to greatly relax their blocking policy for resources loaded from all embedded origins and possibly across all websites. the storage access api is intended to solve this problem; embedded cross-origin content can request unrestricted access to its first-party storage on a site-by-site basis via the document.requeststorageaccess() method, and check whet...
TextEncoder - Web APIs
resarr[respos += 1] = (0x1e/*0b11110*/<<3) | (point>>>18); resarr[respos += 1] = (0x2/*0b10*/<<6) | ((point>>>12)&0x3f/*0b00111111*/); resarr[respos += 1] = (0x2/*0b10*/<<6) | ((point>>>6)&0x3f/*0b00111111*/); resarr[respos += 1] = (0x2/*0b10*/<<6) | (point&0x3f/*0b00111111*/); continue; } } else { resarr[respos += 1] = 0xef/*0b11101111*/; resarr[respos += 1] = 0xbf/*0b10111111*/; resarr[respos += 1] = 0xbd/*0b10111101*/; continue; } } if (point <= 0x007f) { resarr[respos += 1] = (0x0/*0b0*/<<7) | point; } else if (point <= 0x07ff) { ...
Vibration API - Web APIs
ke, and you may provide either an even or odd number of entries; it's worth noting that you don't have to provide a pause as your last entry since the vibration automatically stops at the end of each vibration period. canceling existing vibrations calling navigator.vibrate() with a value of 0, an empty array, or an array containing all zeros will cancel any currently ongoing vibration pattern. ...
Basic scissoring - Web APIs
when doing color blending for non-opaque elements in the scene). here we see another example of the distinction between fragments and pixels. scissoring is a distinct stage in the webgl/opengl graphics pipeline (it occurs after color clearing, but before color masking). before the actual pixels are updated, fragments must go through the scissor test. if the fragments pass the scissor test, they continue down the graphics pipeline, and the corresponding pixels are updated on the screen. if they fail the test, they are immediately discarded, no further processing occurs, and pixels are not updated. because only fragments within the specified rectangular area successfully pass the scissor test, only pixels inside that area are updated, and we get a rectangle on the screen. the scissoring stage of ...
Data in WebGL - Web APIs
Web › API › WebGL API › Data
0, 0.0, 0.0, 1.0 ), // black vec4( 1.0, 0.0, 0.0, 1.0 ), // red vec4( 1.0, 1.0, 0.0, 1.0 ), // yellow vec4( 0.0, 1.0, 0.0, 1.0 ), // green vec4( 0.0, 0.0, 0.0, 1.0 ), // black vec4( 1.0, 0.0, 0.0, 1.0 ), // red vec4( 1.0, 1.0, 0.0, 1.0 ), // yellow vec4( 0.0, 1.0, 0.0, 1.0 ), // green ]; var cbuffer = gl.createbuffer(); //continued //create buffer to store colors and reference it to "vcolor" which is in glsl gl.bindbuffer( gl.array_buffer, cbuffer ); gl.bufferdata( gl.array_buffer, flatten(vertexcolors), gl.static_draw ); var vcolor = gl.getattriblocation( program, "vcolor" ); gl.vertexattribpointer( vcolor, 4, gl.float, false, 0, 0 ); gl.enablevertexattribarray( vcolor ); //glsl attribute vec4 vc...
Getting started with WebGL - Web APIs
th="640" height="480"></canvas> </body> preparing the webgl context the main() function in our javascript code, is called when our script is loaded. its purpose is to set up the webgl context and start rendering content. // // start here // function main() { const canvas = document.queryselector("#glcanvas"); // initialize the gl context const gl = canvas.getcontext("webgl"); // only continue if webgl is available and working if (gl === null) { alert("unable to initialize webgl. your browser or machine may not support it."); return; } // set clear color to black, fully opaque gl.clearcolor(0.0, 0.0, 0.0, 1.0); // clear the color buffer with specified clear color gl.clear(gl.color_buffer_bit); } window.onload = main; the first thing we do here is obtain a refer...
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
uch, much more reliable. let's take a dive into the code to see how it works now. on receiving a description in the revised code, if the received message is an sdp description, we check to see if it arrived while we're attempting to transmit an offer. if the received message is an offer and the local peer is the impolite peer, and a collision is occurring, we ignore the offer because we want to continue to try to use the offer that's already in the process of being sent. that's the impolite peer in action. in any other case, we'll try instead to handle the incoming message. this begins by setting the remote description to the received description by passing it into setremotedescription(). this works regardless of whether we're handling an offer or an answer since rollback will be performed auto...
Lifetime of a WebRTC session - Web APIs
fetime of a webrtc session, network conditions change. one of the users might transition from a cellular to a wifi network, or the network might become congested, for example. when this happens, the ice agent may choose to perform ice restart. this is a process by which the network connection is renegotiated, exactly the same way the initial ice negotiation is performed, with one exception: media continues to flow across the original network connection until the new one is up and running. then media shifts to the new network connection and the old one is closed. note: different browsers support ice restart under different sets of conditions. not all browsers will perform ice restart due to network congestion, for example. if you need to change the configuration of the connection in some way (s...
Signaling and video calling - Web APIs
er's ice layer begins to send candidates, it enters into an exchange among the various points in the chain that looks like this: each side sends candidates to the other as it receives them from their local ice layer; there is no taking turns or batching of candidates. as soon as the two peers agree upon one candidate that they can both use to exchange the media, media begins to flow. each peer continues to send candidates until it runs out of options, even after the media has already begun to flow. this is done in hopes of identifying even better options than the one initially selected. if conditions change—for example the network connection deteriorates—one or both peers might suggest switching to a lower-bandwidth media resolution, or to an alternative codec. this triggers a new exchange...
WebSocket.bufferedAmount - Web APIs
the websocket.bufferedamount read-only property returns the number of bytes of data that have been queued using calls to send() but not yet transmitted to the network. this value resets to zero once all queued data has been sent. this value does not reset to zero when the connection is closed; if you keep calling send(), this will continue to climb. syntax var bufferedamount = awebsocket.bufferedamount; value an unsigned long. specifications specification status comment html living standardthe definition of 'websocket: bufferedamount' in that specification. living standard initial definition ...
Using bounded reference spaces - Web APIs
racking range (especially if doing so causes them to lose a game). the easiest solution is to just treat the each boundary segment as if it were an object to hit test against. as the user grows close to the boundary, you might warn them by displaying a message, flashing a warning indicator, playing an audio warning, or the like. and if the user actually collides with the boundary, don't let them continue past it. <<<--- example --->>> creating a bounded reference space before creating a project that relies on bounded reference spaces, it's important to keep in mind that not all xr devices are capable of creating them. by their very nature, bounded reference spaces have special hardware requirements, since they need to allow for the user to physically move around in space while their movements ...
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
ard movements was taken from an article on the filmmakeriq web site; namely, from this image which is found all over the web, however, and though we assume these are under a permissive license due to their frequent reuse, ownership is not certain. we hope that it's freely usable; if not, and you're the owner, please let us know and we'll find or produce new diagrams. or, if you're happy to let us continue to use the images, please let us know so we can credit you properly! cameras and relative movement when a classic live-action movie is filmed, the actors are on a set and move about the set as they perform, with one or more cameras watching their moves. the cameras may be fixed in place, but they may also be set up to move around as well, tracking the movement of the performers, dollying in and...
WebXR application life cycle - Web APIs
ut the objects located in the 3d world to render the frame using webgl. each time the callback is invoked, it should call requestanimationframe() again in order to let the browser know that the callback needs to be run again when it's time to render the next frame. when the time comes (such as when the user exits your app or navigates away from your site), end the xr session; otherwise, continue the loop until the user chooses to exit xr mode. to end the xr session yourself, call xrsession.end(). include a handler for the xrsession event end event to be informed when the session is ending, regardless of whether your code, the user, or the browser initiated the termination of the session. ...
Rendering and the WebXR frame animation callback - Web APIs
ct-first order for an alternative approach that renders each object twice back-to-back, once for each eye, before moving on to the next object that makes up the scene for that frame; that is, rendering in object-first order. sample renderer callback let's take a look at some real code that follows this basic pattern. since in the example above we gave this function the name mydrawframe(), we'll continue to use that here. let lastframetime = 0; function mydrawframe(currentframetime, frame) { let session = frame.session; let viewerpose; // schedule the next frame to be painted when the time comes. animationframerequestid = session.requestanimationframe(mydrawframe); // get an xrviewerpose representing the position and // orientation of the viewer. if successful, render the // fr...
Starting up and shutting down a WebXR session - Web APIs
is required } creating and starting the session a webxr session is represented by an xrsession object. to obtain an xrsession, you call your xrsystem's requestsession() method, which returns a promise that resolves with an xrsession if it's able to establish one successfully. fundamentally, that looks like this: xr.requestsession("immersive-vr").then((session) => { xrsession = session; /* continue to set up the session */ }); note the parameter passed into requestsession() in this code snippet: immersive-vr. this string specifies the type of webxr session you want to establish—in this case, a fully-immersive virtual reality experience. there are three options: immersive-vr a fully-immersive virtual reality session using a headset or similar device that fully replaces the world arou...
WebXR Device API - Web APIs
his guide describes how objects—including the user's body and its parts—are located in space, and how their movement and orientation relative to one another is monitored and managed over time. this article explains the relationship between spaces, poses, viewers, and views. rendering and the webxr frame animation callback starting with how you schedule frames to be rendered, this guide then continues to cover how to determine the placement of objects in the view and how to then render them into the webgl buffer used for each of the two eyes' views of the scene. viewpoints and viewers: simulating cameras in webxr webgl (and therefore webxr) doesn't really have a concept of a camera, which is the traditional concept used to represent a viewpoint in 3d graphics. in this article, we see how t...
Background audio processing using AudioWorklet - Web APIs
which you can influence the lifespan of your audio worklet processor is through the value returned by process(), which should be a boolean value indicating whether or not to override the user agent's decision-making as to whether or not your node is still in use. in general, the lifetime policy of any audio node is simple: if the node is still considered to be actively processing audio, it will continue to be used. in the case of an audioworkletnode, the node is considered to be active if its process() function returns true and the node is either generating content as a source for audio data, or is receiving data from one or more inputs. specifying a value of true as the result from your process() function in essence tells the web audio api that your processor needs to keep being called even if...
Window: popstate event - Web APIs
current history entry to one we'll refer to as new-entry. the current page's session history stack entry will be referred to as current-entry. if new-entry doesn't currently contain an existing document, fetch the content and create its document before continuing. this will eventually send events such as domcontentloaded and load to the window containing the document, but the steps below will continue to execute in the meantime. if current-entry's title wasn't set using one of the history api methods (pushstate() or replacestate(), set the entry's title to the string returned by its document.title attribute. if the browser has state information it wishes to store with the current-entry before navigating away from it, it then does so. the entry is now said to have "persisted user state." this...
Synchronous and asynchronous requests - Web APIs
us communications. in general, however, asynchronous requests should be preferred to synchronous requests for performance reasons. synchronous requests block the execution of code which causes "freezing" on the screen and an unresponsive user experience. asynchronous request if you use an asynchronous xmlhttprequest, you receive a callback when the data has been received. this lets the browser continue to work as normal while your request is being handled. example: send a file to the console log this is the simplest usage of asynchronous xmlhttprequest. var xhr = new xmlhttprequest(); xhr.open("get", "/bar/foo.txt", true); xhr.onload = function (e) { if (xhr.readystate === 4) { if (xhr.status === 200) { console.log(xhr.responsetext); } else { console.error(xhr.statustex...
XRInputSource.targetRayMode - Web APIs
input, this example looks for inputs whose targetraymode is tracked-pointer, indicating that the input is in fact intended to represent a targeting device rather than a gazing device, screen tap, or mouse click. for tracked pointers, a function myrendertargetrayasbeam() is called to render a beam from the input controller's virtual position outward in the direction it's pointing. the code should continue to perform tasks such as drawing controllers or any objects representative of the user's hands' positions in the virtual space, as well as any other input-related tasks. function updateinputsources(session, frame, refspace) { for (let source of session.getinputsources()) { let targetraypose = frame.getpose(inputsource.targetrayspace, refspace); if (targetraypose) { if (source.ta...
XRInputSource.targetRaySpace - Web APIs
input, this example looks for inputs whose targetraymode is tracked-pointer, indicating that the input is in fact intended to represent a targeting device rather than a gazing device, screen tap, or mouse click. for tracked pointers, a function myrendertargetrayasbeam() is called to render a beam from the input controller's virtual position outward in the direction it's pointing. the code should continue to perform tasks such as drawing controllers or any objects representative of the user's hands' positions in the virtual space, as well as any other input-related tasks. function updateinputsources(session, frame, refspace) { for (let source of session.getinputsources()) { let targetraypose = frame.getpose(inputsource.targetrayspace, refspace); if (targetraypose) { if (source.ta...
XRTargetRayMode - Web APIs
input, this example looks for inputs whose targetraymode is tracked-pointer, indicating that the input is in fact intended to represent a targeting device rather than a gazing device, screen tap, or mouse click. for tracked pointers, a function myrendertargetrayasbeam() is called to render a beam from the input controller's virtual position outward in the direction it's pointing. the code should continue to perform tasks such as drawing controllers or any objects representative of the user's hands' positions in the virtual space, as well as any other input-related tasks. function updateinputsources(session, frame, refspace) { for (let source of session.getinputsources()) { let targetraypose = frame.getpose(inputsource.targetrayspace, refspace); if (targetraypose) { if (source.ta...
ARIA Test Cases - Accessibility
- - orca - - - - grid see various grid and table examples on the example page for grid variants. basic grid -- single select grid in an application -- single select illinois grid example -- multi select expected at behavior: screen reader should read column and row headers as the grid is traversed with arrow keys (in forms mode). screen readers should continue to respect any special table reading modes while the user traverses the grid. for example, while in the grid in forms mode, the user should be able to configure the screen reader to read row headers only. jaws - virtual cursor - jaws treats a grid as if it were an html table. all table keys are active. header behavior is not yet defined. pc cursor - tbd. window-eyes ...
ARIA: feed role - Accessibility
<section role="feed" aria-busy="false"> ... ...
WAI-ARIA Roles - Accessibility
ologies with reading or browse modes to use the document mode to read the content contained within this element.aria: feed rolea feed is a dynamic scrollable list of articles in which articles are added to or removed from either end of the list as the user scrolls. a feed enables screen readers to use the browse mode reading cursor to both read and scroll through a stream of rich content that may continue scrolling infinitely by loading more content as the user reads.aria: figure rolethe aria figure role can be used to identify a figure inside page content where appropriate 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 landma...
Web applications and ARIA FAQ - Accessibility
duces a number of useful new semantic tags to html. a few of these tags overlap directly with roles available in aria, such as the new <progress> element. in cases where the browser supports an html5 tag that also exists in aria, there is usually no need to also add aria roles and states to the element. aria includes many roles, states, and properties that aren't available in html5, so these will continue to be useful to developers who use html5. for more information, steve faulkner has written a good overview of the relationship between html5 and aria. degrading gracefully from html5 to aria when delivering content to browsers that aren't html5-aware, you may want to consider gracefully degrading to the use of aria where necessary. so, using the example of a progress bar, you can degrade gracef...
Alerts - Accessibility
, 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, but allows for them continue modifying the form without losing focus (caused by the “onblur” handler in javascript's default ‘alert’ function). below is example javascript code which could be inserted above the closing “head” tag: <script type="application/javascript"> function removeoldalert() { var oldalert = document.getelementbyid("alert"); if (oldalert){ document.body.removechild(oldalert); ...
Cognitive accessibility - Accessibility
uptions, except situations involving altering a person to an emergency. this provides access to people with cognitive disabilities by enabling them to focus on the main purpose of the content. enable the user to postpone content updates by providing a way to request content updates rather than updating automatically. also, enable a way to make nonessential alerts optional. ensure that people can continue an activity without loss of data after re-authenticating an expired session, for example, saving the state of a questionnaire. make sure to save data in such a way that it can be modified after a user re-authenticates. before re-authenticating, encode the data as hidden or encrypted. providing warnings about inactivity that could result in data loss. when a timeout is used, tell people exactly h...
Accessibility documentation index - Accessibility
de to read the content contained within this element. 61 aria: feed role aria, aria role, reference, feed a feed is a dynamic scrollable list of articles in which articles are added to or removed from either end of the list as the user scrolls. a feed enables screen readers to use the browse mode reading cursor to both read and scroll through a stream of rich content that may continue scrolling infinitely by loading more content as the user reads. 62 aria: figure role aria, aria role, aria figure, accessibility, reference, rôle, figure the aria figure role can be used to identify a figure inside page content where appropriate semantics do not already exist. a figure is generally considered to be one or more images, code snippets, or other content that put...
Web accessibility for seizures and physical reactions - Accessibility
r rolling images. certain video games or tv broadcasts containing rapid flashes or alternating patterns of different colors. intense strobe lights like visual fire alarms. natural light, such as sunlight, especially when shimmering off water, flickering through trees or through the slats of venetian blinds. certain visual patterns, especially stripes of contrasting colors. that same article continues that many factors must combine to trigger the photosensitive reaction. of note is that it includes the wavelength of light as a possible factor; wavelengths in the red part of the spectrum seem to be especially problematic. in the article, "understanding wcag 2.0 three flashes or below threshold" notes generally that: “individuals who have photosensitive seizure disorders can have a seizure tr...
Operable - Accessibility
pass aaa conformance should have no time limits. 2.2.4 surpress interruptions (aaa) any interruptions such as alerts or interstitial adverts should have functionality available to suppress or postpone them, unless it is an emergency alert. 2.2.5 re-authenticating (aaa) if an authentication session expires during usage of a web app, the user can re-authenticate and continue their usage without losing any data. 2.2.6 timeouts (aaa) added in 2.1 if there is a timeout (caused by user inactivity) warn users at the start of a process so they will not be surprised that a timeout exists (or only allow the timeout to occur after 20 hours of inactivity. understanding timeouts note: also see the wcag description for guideline 2.2 enough ti...
Perceivable - Accessibility
tive of the markup. again, refer to html: a good basis for accessibility. 1.3.3 sensory characteristics (a) instructions for operating controls or understanding content do not rely on a single sense. this may prove inaccessible to people with a disability related to that sense, or a device that does not support that sense. so, for example: "click the round button to continue" the button should be clearly labelled so that it is obvious that it is the button you need to press. if there are multiple buttons, make sure they are all clearly labelled to distinguish their function. "listen to the audio instructions for guidance" this is obviously problematic—audio will be inaccessible to those with hearing impairments, whereas text can be read, but also s...
-webkit-overflow-scrolling - CSS: Cascading Style Sheets
the -webkit-overflow-scrolling css property controls whether or not touch devices use momentum-based scrolling for a given element. syntax values auto use "regular" scrolling, where the content immediately ceases to scroll when you remove your finger from the touchscreen. touch use momentum-based scrolling, where the content continues to scroll for a while after finishing the scroll gesture and removing your finger from the touchscreen. the speed and duration of the continued scrolling is proportional to how vigorous the scroll gesture was. also creates a new stacking context. formal definition initial valueautoapplies toscrolling boxesinheritedyescomputed valueas specifiedanimation typediscrete formal syntax auto | touch examples html <div class="scroll-touch"> <p> ...
:hover - CSS: Cascading Style Sheets
Web › CSS › :hover
at least equal specificity. to style links appropriately, put the :hover rule after the :link and :visited rules but before the :active one, as defined by the lvha-order: :link — :visited — :hover — :active. note: the :hover pseudo-class is problematic on touchscreens. depending on the browser, the :hover pseudo-class might never match, match only for a moment after touching an element, or continue to match even after the user has stopped touching and until the user touches another element. web developers should make sure that content is accessible on devices with limited or non-existent hovering capabilities. syntax :hover examples basic example html <a href="#">try hovering over this link.</a> css a { background-color: powderblue; transition: background-color .5s; } a:hover {...
system - CSS: Cascading Style Sheets
ter values only. alphabetic interprets the specified symbols as digits, to an alphabetic numbering system. if the characters "a" to "z" are specified as symbols in a counter style, with the alphabetic system, then the first 26 counter representations will be "a", "b" upto "z". until this point, the behavior is the same as that of the symbolic system, described above. however, after "z", it will continue as "aa", "ab", "ac"… the symbols descriptor must contain at least two symbols or the counter style is not valid. the first counter symbol provided in the symbols descriptor is interpreted as 1, the next as 2, and so on. this system is also defined strictly over positive counter values. numeric interprets the counter symbols as digits in a place-value numbering system. the numeric system is...
Block and inline layout in normal flow - CSS: Cascading Style Sheets
e default browser stylesheet adds spacing between the paragraphs by way of adding a margin to the top and bottom. if we set margins on the paragraph element to 0 then the borders will touch. by default block elements will consume all of the space in the inline direction, so our paragraphs spread out and get as big as they can inside their containing block. if we give them a width, they will continue to lay out one below the other - even if there would be space for them to be side by side. each will start against the start edge of the containing block, so the place at which sentences would begin in that writing mode. margin collapsing the spec explains that margins between block elements collapse. this means that if you have an element with a top margin immediately after an element with a...
Flow Layout and Overflow - CSS: Cascading Style Sheets
w situation occurs. understanding how overflow behaves is important in dealing with any element with a constrained size in css. this guide explains how overflow works when working with normal flow. what is overflow? giving an element a fixed height and width, then adding significant content to the box, creates a basic overflow example: the content goes into the box. once it fills the box, it continues to overflow in a visible way, displaying content outside the box, potentially displaying under 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 val...
Line-based placement with CSS Grid - CSS: Cascading Style Sheets
ontrol where these items sit on the grid. i would like the first item to start on the far left of the grid and span a single column track. it should also start on the first row line, at the top of the grid and span to the fourth row line. .box1 { grid-column-start: 1; grid-column-end: 2; grid-row-start: 1; grid-row-end: 4; } as you position some items, other items on the grid will continue to be laid out using the auto-placement rules. we will take a proper look at how these work in a later guide but you can see as you work that grid is laying out un-placed items into empty cells of the grid. addressing each item individually we can place all four items spanning row and column tracks. note that we can leave cells empty if we wish. one of the very nice things about grid layout is t...
Basic concepts of Logical Properties and Values - CSS: Cascading Style Sheets
e grid container has a width applied and i am using the align-self and justify-self properties to align the items. these properties are flow relative — justify-self: start aligns the item to the start on the inline dimension, align-self: start does the same on the block dimension. if i now change the writing mode of this component to vertical-rl using the writing-mode property, the alignment continues to work in the same way. the inline dimension is now running vertically and the block dimension horizontally. the grid doesn't look the same however, as the width assigned to the container is a horizontal measure, a measure tied to the physical and not the logical or flow relative running of the text. if instead of the width property we use the logical property inline-size, the component now ...
CSS Overflow - CSS: Cascading Style Sheets
is dealt with. 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. reference css properties overflow overflow-block overflow-inline overflow-x overflow-y text-overflow block-overflow line-clamp max-lines continue non-standard properties -webkit-line-clamp specifications specification status comment css overflow module level 3the definition of 'overflow' in that specification. working draft changed syntax to allow one or two keywords instead of only one css level 2 (revision 1)the definition of 'overflow' in that specification. recommend...
Browser compatibility and Scroll Snap - CSS: Cascading Style Sheets
in this initial example we have used the old specification alongside the current specification in order to make scroll snapping work in all browsers which support some form of scroll snapping. the example adds the scroll-snap-points-y and scroll-snap-destination properties, which are deprecated, to make scroll snapping work in firef...
Recipe: Media objects - CSS: Cascading Style Sheets
ut is in order that i can use fit-content() for the track sizing of the image. by using fit-content with a maximum size of 200 pixels, when we have a small image such as the icon, the track only gets as large as the size of that image — the max-content size. if the image is larger, the track stops growing at 200 pixels and as the image has a max-width of 100% applied, it scales down so that it continues to fit inside the column. by using grid-template-areas to achieve the layout, i can see the pattern in the css. i define my grid once we have a max-width of 500 pixels, so on smaller devices the media object stacks. an option for the pattern is to flip it to switch the image to the other side — this is done by adding the media-flip class, which defines a flipped grid template causing the lay...
animation-timing-function - CSS: Cascading Style Sheets
towards the middle of the animation, slowing back down at the end. linear equal to cubic-bezier(0.0, 0.0, 1.0, 1.0), animates at an even speed. ease-in equal to cubic-bezier(0.42, 0, 1.0, 1.0), starts off slowly, with the speed of the transition of the animating properting increasing until complete. ease-out equal to cubic-bezier(0, 0, 0.58, 1.0), starts quickly, slowing down the animation continues. • ease-in-out equal to cubic-bezier(0.42, 0, 0.58, 1.0), with the animating properties slowly transitioning, speeding up, and then slowing down again. cubic-bezier(p1, p2, p3, p4) an author defined cubic-bezier curve, where the p1 and p3 values must be in the range of 0 to 1. steps(n, <jumpterm>) displays an animation iteration along n stops along the transition, displaying each stop fo...
break-after - CSS: Cascading Style Sheets
es a column break right after the principal box. region break values avoid-region avoids any region break right after the principal box. region forces a region break right after the principal box. page break aliases for compatibility reasons, the legacy page-break-after property should be treated by browsers as an alias of break-after. this ensures that sites using page-break-after continue to work as designed. a subset of values should be aliased as follows: page-break-after break-after auto auto left left right right avoid avoid always page the always value of page-break-* was implemented by browsers as a page break, and not as a column break. therefore the aliasing is to page, rather than the alw...
break-before - CSS: Cascading Style Sheets
olumn break right before the principal box. region break values avoid-region avoids any region break right before the principal box. region forces a region break right before the principal box. page break aliases for compatibility reasons, the legacy page-break-before property should be treated by browsers as an alias of break-before. this ensures that sites using page-break-before continue to work as designed. a subset of values should be aliased as follows: page-break-before break-before auto auto left left right right avoid avoid always page the always value of page-break-* was implemented by browsers as a page break, and not as a column break. therefore the aliasing is to page, rather than the a...
break-inside - CSS: Cascading Style Sheets
incipal box. avoid-page avoids any page break within the principal box. avoid-column avoids any column break within the principal box. avoid-region avoids any region break within the principal box. page break aliases for compatibility reasons, the legacy page-break-inside property should be treated by browsers as an alias of break-inside. this ensures that sites using page-break-inside continue to work as designed. a subset of values should be aliased as follows: page-break-inside break-inside auto auto avoid avoid formal definition initial valueautoapplies toblock-level elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | avoid | avoid-page | avoid-column | avoid-region examples avoiding breaking i...
float - CSS: Cascading Style Sheets
Web › CSS › float
, it is taken out of the normal flow of the document (though still remaining part of it). it is shifted to the left, or right, until it touches the edge of its containing box, or another floated element. in this example, there are three colored squares. two are floated left, and one is floated right. note that the second "left" square is placed to the right of the first. additional squares would continue to stack to the right, until they filled the containing box, after which they would wrap to the next line. a floated element is at least as tall as it's tallest nested floated children. we gave the parent width: 100% and floated it to ensure it is tall enough to encompass it's floated children, and to make sure it takes up the width of the parent so we don't have to clear it's adjacent sibling. ...
linear-gradient() - CSS: Cascading Style Sheets
ing three gradients are equivalent: linear-gradient(red 0%, orange 10%, orange 30%, yellow 50%, yellow 70%, green 90%, green 100%); linear-gradient(red, orange 10% 30%, yellow 50% 70%, green 90%); linear-gradient(red 0%, orange 10% 30%, yellow 50% 70%, green 90% 100%); by default, if there is no color with a 0% stop, the first color declared will be at that point. similarly, the last color will continue to the 100% mark, or be at the 100% mark if no length has been declared on that last stop. examples gradient at a 45-degree angle body { width: 100vw; height: 100vh; } body { background: linear-gradient(45deg, red, blue); } gradient that starts at 60% of the gradient line body { width: 100vw; height: 100vh; } body { background: linear-gradient(135deg, orange 60%, cyan); ...
orphans - CSS: Cascading Style Sheets
Web › CSS › orphans
the orphans css property sets the minimum number of lines in a block container that must be shown at the bottom of a page, region, or column. /* <integer> values */ orphans: 2; orphans: 3; /* global values */ orphans: inherit; orphans: initial; orphans: unset; in typography, an orphan is the first line of a paragraph that appears alone at the bottom of a page. (the paragraph continues on a following page.) syntax values <integer> the minimum number of lines that can stay by themselves at the bottom of a fragment before a fragmentation break. the value must be positive. formal definition initial value2applies toblock container elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax <integer> examples setting a minimum orphan size of three lines html <d...
page-break-after - CSS: Cascading Style Sheets
acts like left. verso if pages progress left-to-right, then this acts like left. if pages progress right-to-left, then this acts like right. page break aliases the page-break-after property is now a legacy property, replaced by break-after. for compatibility reasons, page-break-after should be treated by browsers as an alias of break-after. this ensures that sites using page-break-after continue to work as designed. a subset of values should be aliased as follows: page-break-after break-after auto auto left left right right avoid avoid always page formal definition initial valueautoapplies toblock-level elements in the normal flow of the root element. user agents may also apply it to other elements like ...
page-break-before - CSS: Cascading Style Sheets
s like left. verso if pages progress left-to-right, then this acts like left. if pages progress right-to-left, then this acts like right. page break aliases the page-break-before property is now a legacy property, replaced by break-before. for compatibility reasons, page-break-before should be treated by browsers as an alias of break-before. this ensures that sites using page-break-before continue to work as designed. a subset of values should be aliased as follows: page-break-before break-before auto auto left left right right avoid avoid always page formal definition initial valueautoapplies toblock-level elements in the normal flow of the root element. user agents may also apply it to other elements lik...
page-break-inside - CSS: Cascading Style Sheets
syntax values auto initial value. automatic page breaks (neither forced nor forbidden). avoid avoid page breaks inside the element. page break aliases the page-break-inside property is now a legacy property, replaced by break-inside. for compatibility reasons, page-break-inside should be treated by browsers as an alias of break-inside. this ensures that sites using page-break-inside continue to work as designed. a subset of values should be aliased as follows: page-break-inside break-inside auto auto avoid avoid formal definition initial valueautoapplies toblock-level elements in the normal flow of the root element. user agents may also apply it to other elements like table-row elements.inheritednocomputed valueas specifiedanimation ty...
transition-timing-function - CSS: Cascading Style Sheets
n velocity towards the middle of the transition, slowing back down at the end. linear equal to cubic-bezier(0.0, 0.0, 1.0, 1.0), transitions at an even speed. ease-in equal to cubic-bezier(0.42, 0, 1.0, 1.0), starts off slowly, with the transition speed increasing until complete. ease-out equal to cubic-bezier(0, 0, 0.58, 1.0), starts transitioning quickly, slowing down the transition continues. • ease-in-out equal to cubic-bezier(0.42, 0, 0.58, 1.0), starts transitioning slowly, speeds up, and then slows down again. cubic-bezier(p1, p2, p3, p4) an author defined cubic-bezier curve, where the p1 and p3 values must be in the range of 0 to 1. steps( n, <jumpterm>) displays the transition along n stops along the transition, displaying each stop for equal lengths of time. for...
widows - CSS: Cascading Style Sheets
Web › CSS › widows
the widows css property sets the minimum number of lines in a block container that must be shown at the top of a page, region, or column. /* <integer> values */ widows: 2; widows: 3; /* global values */ widows: inherit; widows: initial; widows: unset; in typography, a widow is the last line of a paragraph that appears alone at the top of a page. (the paragraph is continued from a prior page.) syntax values <integer> the minimum number of lines that can stay by themselves at the top of a new fragment after a fragmentation break. the value must be positive. formal definition initial value2applies toblock container elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax <integer> examples controlling column widows html <div> <p>this is the first para...
Audio and Video Delivery - Developer guides
hat is unlikely to be a valid video. seeking through media media elements provide support for moving the current playback position to specific points in the media's content. this is done by setting the value of the currenttime property on the element; see htmlmediaelement for further details on the element's properties. simply set the value to the time, in seconds, at which you want playback to continue. you can use the element's seekable property to determine the ranges of the media that are currently available for seeking to. this returns a timeranges object listing the ranges of times that you can seek to. var mediaelement = document.queryselector('#mediaelementid'); mediaelement.seekable.start(0); // returns the starting time (in seconds) mediaelement.seekable.end(0); // returns the en...
DOM onevent handlers - Developer guides
le the event, one after another. you don't need to call them yourself, although you can do so in many cases to easily simulate an event taking place. for example, given a button object mybutton, you can do mybutton.onclick(myeventobject) to call the event handler directly. if the event handler doesn't access any data from the event object, you can leave out the event when calling onclick(). this continues until every handler has been called, unless one of the event handlers explicitly halts the processing of the event by calling stoppropagation() on the event object itself. non-element objects event handlers can also be set with properties on non-element objects that generate events, like window, document, xmlhttprequest, and others. for example, for the progress event on instances of xmlhttpre...
HTML5 Parser - Developer guides
Web › Guide › HTML › HTML5 › HTML5 Parser
<math> tag for non-mathml purposes, attempts to nest various common html elements as children of svg elements (without foreignobject) will immediately break out of svg or mathml context. this may make some typos have surprising effects. performance improvement with speculative parsing unrelated to the requirements of html5 specification, the gecko 2 parser uses speculative parsing, in which it continues parsing a document while scripts are being downloaded and executed. this results in improved performance compared to older parsers, because most of the time, gecko can complete these tasks in parallel. to best take advantage of speculative parsing, and help your pages to load as quickly as possible, ensure that when you call document.write(), you write a balanced sub-tree within that chunk of s...
Introduction to HTML5 - Developer guides
the html standard. it offers new features that provide not only rich media support but also enhance support for creating web applications that can interact with users, their local data, and servers more easily and effectively than was previously possible. some html5 features remain unsupported by some browsers. however, gecko, and by extension, firefox, 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...
Localizations and character encodings - Developer guides
loading a test page. (be sure to use a browser installation that has its settings left to the defaults when investigating!) for locales where firefox has more market share than internet explorer, it's probably best not to change the fallback encoding even if it doesn't follow the guidance given above. (for example, the fallback encoding for the polish, hungarian and czech locales should probably continue to be iso-8859-2 even though ie has a different fallback encoding.) when in doubt, use windows-1252 as the fallback encoding. specifying the heuristic detection mode the heuristic detection mode is specified by the preference intl.charset.detector in intl.properties. the setting must be left blank for all locales other than russian, ukrainian and japanese. do not under any circumstances specif...
<header> - HTML: Hypertext Markup Language
Web › HTML › Element › header
living standard html5the definition of '<header>' in that specification. recommendation ...
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
Web › HTML › Element › input
mismatch if the value is not a number. for the input types whose domain of possible values is periodic (that is, at the highest possible value, the values wrap back around to the beginning rather than ending), it's possible for the values of the max and min properties to be reversed, which indicates that the range of permitted values starts at min, wraps around to the lowest possible value, then continues on until max is reached. this is particularly useful for dates and times, such as when you want to allow the range to be from 8 pm to 8 am: <input type="time" min="20:00" max="08:00" name="overnight"> specific attributes and their values can lead to a specific error validitystate: validity object errors depend on the <input> attributes and their values: attribute relevent propert...
<li> - HTML: Hypertext Markup Language
Web › HTML › Element › li
io, separator, tab, treeitem dom interface htmllielement attributes this element includes the global attributes. value this integer attribute indicates the current ordinal value of the list item as defined by the <ol> element. the only allowed value for this attribute is a number, even if the list is displayed with roman numerals or letters. list items that follow this one continue numbering from the value set. the value attribute has no meaning for unordered lists (<ul>) or for menus (<menu>). note: this attribute was deprecated in html4, but reintroduced in html5. type this character attribute indicates the numbering type: a: lowercase letters a: uppercase letters i: lowercase roman numerals i: uppercase roman numerals 1: numbers this type overrides ...
<nextid>: The NeXT ID element (Obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › nextid
and presumably also writing paragraph material within these sections). the heading for each of the four sections would be assigned name values of "z0", "z1", "z2", and "z3". the first of these would produce an entry in the table of contents like this: <a name="z0" href="#z4">first section name</a> and the section header would be marked like this: <h2><a name="z4">first section name</a></h2>. this continues for the next three sections, z5, z6, and z7 (and table of contents entries named z1, z2, and z3), each automatically given anchors with these names. the user then saves and closes the document. next would then add, within the header of the html document, a special tag, <nextid n="z8">, to inform where to continue its naming convention. imagine the web author opens the document for further editin...
<script>: The Script element - HTML: Hypertext Markup Language
Web › HTML › Element › script
the document. language like the type attribute, this attribute identifies the scripting language in use. unlike the type attribute, however, this attribute’s possible values were never standardized. the type attribute should be used instead. notes scripts without async , defer or type="module" attributes, as well as inline scripts, are fetched and executed immediately, before the browser continues to parse the page. the script should be served with the text/javascript mime type, but browsers are lenient and only block them if the script is served with an image type (image/*); a video type (video/*); an audio (audio/*) type; or text/csv. if the script is blocked, an error is sent to the element, if not a load event is sent. examples basic usage these examples show how to import (an ext...
<select>: The HTML Select element - HTML: Hypertext Markup Language
Web › HTML › Element › select
represents the number of rows in the list that should be visible at one time. browsers are not required to present a select element as a scrolled list box. the default value is 0. note: according to the html5 specification, the default value for size should be 1; however, in practice, this has been found to break some web sites, and no other browser currently does that, so mozilla has opted to continue to return 0 for the time being with firefox. usage notes selecting multiple options on a desktop computer, there are a number of ways to select multiple options in a <select> element with a multiple attribute: mouse users can hold the ctrl, command, or shift keys (depending on what makes sense for your operating system) and then click multiple options to select/deselect them. warning: th...
Browser detection using the user agent - HTTP
uld always be available if the browser was chrome. the agent might be an older version of chrome, from before support was added, or (because the feature was experimental at the time) it could be a later version of chrome that removed it. most importantly, it assumed no other browsers would support the feature. support could have been added to other browsers at any time, but this code would have continued choosing the inferior path. problems like these can be avoided by testing for support of the feature itself instead: var islookbehindsupported = false; try { new regexp("(?<=)"); islookbehindsupported = true; } catch (err) { // if the agent doesn't support lookbehinds, the attempted // creation of a regexp object using that syntax throws and // islookbehindsupported re...
Connection management in HTTP/1.x - HTTP
the process to send successive requests, over the same persistent connection, without waiting for the answer. this avoids latency of the connection. theoretically, performance could also be improved if two http requests were to be packed into the same tcp message. the typical mss (maximum segment size), is big enough to contain several simple requests, although the demand in size of http requests continues to grow. not all types of http requests can be pipelined: only idempotent methods, that is get, head, put and delete, can be replayed safely: should a failure happen, the pipeline content can simply be repeated. today, every http/1.1-compliant proxy and server should support pipelining, though many have limitations in practice: a significant reason no modern browser activates this feature by d...
Using Feature Policy - HTTP
ult allowlist is '*' for each feature. preventing the use of the sub-optimal functionality requires explicitly specifying a policy that disables the features. for new content, you can start developing with a policy that disables all the features. this approach ensures that none of the functionality is introduced. when applying a policy to existing content, testing is likely required to verify it continues to work as expected. this is especially important for embedded or third-party content that you do not control. to turn on the enforcement of all the best practices, specify the policy as below. send the following the http header: feature-policy: layout-animations 'none'; unoptimized-images 'none'; oversized-images 'none'; sync-script 'none'; sync-xhr 'none'; unsized-media 'none'; using the <...
Accept-Encoding - HTTP
ity;q=0 or a *;q=0 without another explicitly set value for identity, the server must never send back a 406 not acceptable error. notes: an iana registry maintains a complete list of official content encodings. two others content encoding, bzip and bzip2, are sometimes used, though not standard. they implement the algorithm used by these two unix programs. note that the first one was discontinued due to patent licensing problems. header type request header forbidden header name yes syntax accept-encoding: gzip accept-encoding: compress accept-encoding: deflate accept-encoding: br accept-encoding: identity accept-encoding: * // multiple algorithms, weighted with the quality value syntax: accept-encoding: deflate, gzip;q=1.0, *;q=0.5 directives gzip ...
Accept-Patch - HTTP
dia type could reply with 415 unsupported media type and an accept-patch header referencing one or more supported media types. notes: an iana registry maintains a complete list of official content encodings. two others content encoding, bzip and bzip2, are sometimes used, though not standard. they implement the algorithm used by these two unix programs. note that the first one was discontinued due to patent licensing problems. header type response header forbidden header name yes syntax accept-patch: application/example, text/example accept-patch: text/example;charset=utf-8 accept-patch: application/merge-patch+json directives none examples accept-patch: application/example, text/example accept-patch: text/example;charset=utf-8 accept-patch: a...
Large-Allocation - HTTP
switch processes. a large-allocation header was ignored due to the document not being loaded out of process. firefox has moved to a multiprocess architecture, and this architecture is required in order to support the large-allocation header. some legacy addons can prevent firefox from using this new, faster, multiprocess architecture. if you have one of these addons installed, then we will continue to use the old single process architecuture for compatibility, and cannot handle the large-allocation header. this page would be loaded in a new process due to a large-allocation header, however large-allocation process creation is disabled on non-win32 platforms. firefox currently only supports the large-allocation header in our 32-bit windows builds, as memory fragmentation is not an issue in...
HTTP Index - HTTP
Web › HTTP › Index
http response status codes http, landing, overview, reference, status code, web http response status codes indicate whether a specific http request has been successfully completed. responses are grouped in five classes: informational responses (100–199),successful responses (200–299),redirects (300–399),client errors (400–499),and server errors (500–599). 218 100 continue http, informational, status code the http 100 continue informational status response code indicates that everything so far is ok and that the client should continue with the request or ignore it if it is already finished. 219 101 switching protocols http, http status code, informational, reference, websockets the http 101 switching protocols response code indicates ...
CONNECT - HTTP
Web › HTTP › Methods › CONNECT
munications with the requested resource. it can be used to open a tunnel. for example, the connect method can be used to access websites that use ssl (https). the client asks an http proxy server to tunnel the tcp connection to the desired destination. the server then proceeds to make the connection on behalf of the client. once the connection has been established by the server, the proxy server continues to proxy the tcp stream to and from the client. connect is a hop-by-hop method. request has body no successful response has body yes safe no idempotent no cacheable no allowed in html forms no syntax connect www.example.com:443 http/1.1 example some proxy servers might need authority to create a tunnel. see also...
408 Request Timeout - HTTP
Web › HTTP › Status › 408
pertext transfer protocol (http) 408 request timeout response status code means that the server would like to shut down this unused connection. it is sent on an idle connection by some servers, even without any previous request by the client. a server should send the "close" connection header field in the response, since 408 implies that the server has decided to close the connection rather than continue waiting. this response is used much more since some browsers, like chrome, firefox 27+, and ie9, use http pre-connection mechanisms to speed up surfing. note: some servers merely shut down the connection without sending this message. status 408 request timeout specifications specification title rfc 7231, section 6.5.7: 408 request timeout hypertext transfer protoco...
Concurrency model and the event loop - JavaScript
alled in order to handle the message. at some point during the event loop, the runtime starts handling the messages on the queue, starting with the oldest one. to do so, the message is removed from the queue and its corresponding function is called with the message as an input parameter. as always, calling a function creates a new stack frame for that function's use. the processing of functions continues until the stack is once again empty. then, the event loop will process the next message in the queue (if there is one). event loop the event loop got its name because of how it's usually implemented, which usually resembles: while (queue.waitformessage()) { queue.processnextmessage() } queue.waitformessage() waits synchronously for a message to arrive (if one is not already available and w...
Control flow and error handling - JavaScript
ments. if no default clause is found, the program resumes execution at the statement following the end of switch. (by convention, the default clause is written as the last clause, but it does not need to be so.) break statements the optional break statement associated with each case clause ensures that the program breaks out of switch once the matched statement is executed, and then continues execution at the statement following switch. if break is omitted, the program continues execution inside the switch statement (and will evaluate the next case, and so on). example in the following example, if fruittype evaluates to 'bananas', the program matches the value with case 'bananas' and executes the associated statement. when break is encountered, the program exits the switch and cont...
Details of the object model - JavaScript
es for object properties and you want to be able to change the default values at run time, you should set the properties in the constructor's prototype, not in the constructor function itself. determining instance relationships property lookup in javascript looks within an object's own properties and, if the property name is not found, it looks within the special object property __proto__. this continues recursively; the process is called "lookup in the prototype chain". the special property __proto__ is set when an object is constructed; it is set to the value of the constructor's prototype property. so the expression new foo() creates an object with __proto__ == foo.prototype. consequently, changes to the properties of foo.prototype alters the property lookup for all objects that were created...
Iterators and generators - JavaScript
in the sequence has already been consumed. if value is present alongside done, it is the iterator's return value. once created, an iterator object can be iterated explicitly by repeatedly calling next(). iterating over an iterator is said to consume the iterator, because it is generally only possible to do once. after a terminating value has been yielded additional calls to next() should simply continue to return {done: true}. the most common iterator in javascript is the array iterator, which simply returns each value in the associated array in sequence. while it is easy to imagine that all iterators could be expressed as arrays, this is not true. arrays must be allocated in their entirety, but iterators are consumed only as necessary. because of this, iterators can express sequences of unlim...
JavaScript Guide - JavaScript
n about this guide about javascript javascript and java ecmascript tools hello world grammar and types basic syntax & comments declarations variable scope variable hoisting data structures and types literals control flow and error handling if...else switch try/catch/throw error objects loops and iteration for while do...while break/continue for..in for..of functions defining functions calling functions function scope closures arguments & parameters arrow functions expressions and operators assignment & comparisons arithmetic operators bitwise & logical operators conditional (ternary) operator numbers and dates number literals number object math object date object text formatt...
Inheritance and the prototype chain - JavaScript
_prop); console.log(inst.bar_prop) support in all in-use-today browsers which are all non-microsoft browsers plus ie9 and up. allows the direct setting of __proto__ in a way that is one-time-only so that the browser can better optimize the object. also allows the creation of objects without a prototype via object.create(null). not supported in ie8 and below. however, as microsoft has discontinued extended support for systems running these old browsers, this should not be a concern for most applications. additionally, the slow object initialization can be a performance black hole if using the second argument because each object-descriptor property has its own separate descriptor object. when dealing with hundreds of thousands of object descriptors in the form of object, there can arise a ...
SyntaxError: unterminated string literal - JavaScript
string literal instead, use the + operator, a backslash, or template literals. the + operator variant looks like this: var longstring = 'this is a very long string which needs ' + 'to wrap across multiple lines because ' + 'otherwise my code is unreadable.'; or you can use the backslash character ("\") at the end of each line to indicate that the string will continue on the next line. make sure there is no space or any other character after the backslash (except for a line break), or as an indent; otherwise it will not work. that form looks like this: var longstring = 'this is a very long string which needs \ to wrap across multiple lines because \ otherwise my code is unreadable.'; another possibility is to use template literals, which are supported in ec...
Function.prototype.bind() - JavaScript
// true new yaxispoint(17, 42) instanceof point; // true note that you need not do anything special to create a bound function for use with new. the corollary is that you need not do anything special to create a bound function to be called plainly, even if you would rather require the bound function to only be called using new. // example can be run directly in your javascript console // ...continued from above // can still be called as a normal function // (although usually this is undesired) yaxispoint(13); `${emptyobj.x},${emptyobj.y}`; // > '0,13' if you wish to support the use of a bound function only using new, or only by calling it, the target function must enforce that restriction. creating shortcuts bind() is also helpful in cases where you want to create a shortcut to a fu...
Math.fround() - JavaScript
high precision. however, sometimes you may be working with 32-bit floating-point numbers, for example if you are reading values from a float32array. this can create confusion: checking a 64-bit float and a 32-bit float for equality may fail even though the numbers are seemingly identical. to solve this, math.fround() can be used to cast the 64-bit float to a 32-bit float. internally, javascript continues to treat the number as a 64-bit float, it just performs a "round to even" on the 23rd bit of the mantissa, and sets all following mantissa bits to 0. if the number is outside the range of a 32-bit float, infinity or -infinity is returned. because fround() is a static method of math, you always use it as math.fround(), rather than as a method of a math object you created (math is not a construct...
Object.prototype.constructor - JavaScript
child = object.assign(parentwithstatic) // notice that we assign it before we create(...) a prototype below child.prototype = object.create(parentwithstatic.prototype) ... or assign parent constructor identifier to a separate property on the child constructor function and access it via that property: ... child.parent...
Promise - JavaScript
tate. handlefulfilled(value) { /*...*/; return nextvalue; } handlerejection(reason) { /*...*/; throw nextreason; } handlerejection(reason) { /*...*/; return nextvalue; } the returned nextvalue can be another promise object, in which case the promise gets dynamically inserted into the chain. when a .then() lacks the appropriate function that return a promise object, processing simply continues to the next link of the chain. therefore, a chain can safely omit every handlerejection until the final .catch(). similarly, .catch() is really just a .then() without a slot for handlefulfilled. the promises of a chain are nested like russian dolls, but get popped like the top of a stack. the first promise in the chain is most deeply nested and is the first to pop. (promise d, (promise c, (pro...
RegExp.prototype.test() - JavaScript
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 property will continue to increase each time test() returns true. note: as long as test() returns true, lastindex will not reset—even when testing a different string! when test() returns false, the calling regex's lastindex property will reset to 0. the following example demonstrates this behaviour: const regex = /foo/g; // the "global" flag is set // regex.lastindex is at 0 regex.test('foo') // true // ...
String.prototype.charAt() - JavaScript
getting whole characters the following provides a means of ensuring that going through a string loop always provides a whole character, even if the string contains characters that are not in the basic multi-lingual plane. ...
String - JavaScript
are two ways you can do this. method 1 you can use the + operator to append multiple strings together, like this: let longstring = "this is a very long string which needs " + "to wrap across multiple lines because " + "otherwise my code is unreadable." method 2 you can use the backslash character (\) at the end of each line to indicate that the string will continue on the next line. make sure there is no space or any other character after the backslash (except for a line break), or as an indent; otherwise it will not work. that form looks like this: let longstring = "this is a very long string which needs \ to wrap across multiple lines because \ otherwise my code is unreadable." both of the above methods result in identical strings. constructor str...
Destructuring assignment - JavaScript
let obj = {self: '123'}; obj.__proto__.prot = '456'; const {self, prot} = obj; // self "123" // prot "456"(access to the prototype chain) specifications specification ecmascript (ecma-262)the definition of 'destructuring assignment' in that specification. ...
await - JavaScript
lue of the expression following the await operator is not a promise, it's converted to a resolved promise. an await can split execution flow, allowing the caller of the await's function to resume execution before the deferred continuation of the await's function. after the await defers the continuation of its function, if this is the first await executed by the function, immediate execution also continues by returning to the function's caller a pending promise for the completion of the await's function and resuming execution of that caller. examples awaiting a promise to be fulfilled if a promise is passed to an await expression, it waits for the promise to be fulfilled and returns the fulfilled value. function resolveafter2seconds(x) { return new promise(resolve => { settimeout(() => {...
async function - JavaScript
ession configured with the pending promise. progress through foo is then suspended and control is yielded back to the function that called foo. some time later, when the first promise has either been fulfilled or rejected, control moves back into foo. the result of the first promise fulfilment (if it was not rejected) is returned from the await expression. here 1 is assigned to result1. progress continues, and the second await expression is evaluated. again, progress through foo is suspended and control is yielded. some time later, when the second promise has either been fulfilled or rejected, control re-enters foo. the result of the second promise resolution is returned from the second await expression. here 2 is assigned to result2. control moves to the return expression (if any). the default ...
for...of - JavaScript
ryselectorall('article > p'); for (const paragraph of articleparagraphs) { paragraph.classlist.add('read'); } closing iterators in for...of loops, abrupt iteration termination can be caused by break, throw or return. in these cases, the iterator is closed. function* foo(){ yield 1; yield 2; yield 3; }; for (const o of foo()) { console.log(o); break; // closes iterator, execution continues outside of the loop } console.log('done'); iterating over generators you can also iterate over generators, i.e. functions generating an iterable object: function* fibonacci() { // a generator function let [prev, curr] = [0, 1]; while (true) { [prev, curr] = [curr, prev + curr]; yield curr; } } for (const n of fibonacci()) { console.log(n); // truncate the sequence at 1000 ...
while - JavaScript
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 while (condition) statement condition an expression evaluated before each pass through the loop. if this condition evaluates to true, statement is executed. when condition evaluates to false, execution continues with the statement after the while loop. statement an optional statement that is executed as long as the condition evaluates to true. to execute multiple statements within the loop, use a block statement ({ ... }) to group those statements. note: use the break statement to stop a loop before condition evaluates to true. examples using while the following while loop iterates as long as n...
Strict mode - JavaScript
on-error semantics. sometimes this fixes the immediate problem, but sometimes this creates worse problems in the future. strict mode treats these mistakes as errors so that they're discovered and promptly fixed. first, strict mode makes it impossible to accidentally create global variables. in normal javascript mistyping a variable in an assignment creates a new property on the global object and continues to "work" (although future failure is possible: likely, in modern javascript). assignments, which would accidentally create global variables, instead throw an error in strict mode: 'use strict'; // assuming no global variable mistypedvariable exists mistypevariable = 17; // this line throws a referenceerror due to the // misspelling of variable s...
JavaScript reference - JavaScript
...
JavaScript typed arrays - JavaScript
normal array: for (let i = 0; i < int32view.length; i++) { int32view[i] = i * 2; } this fills out the 4 entries in the array (4 entries at 4 bytes each makes 16 total bytes) with the values 0, 2, 4, and 6. multiple views on the same data things start to get really interesting when you consider that you can create multiple views onto the same data. for example, given the code above, we can continue like this: let int16view = new int16array(buffer); for (let i = 0; i < int16view.length; i++) { console.log('entry ' + i + ': ' + int16view[i]); } here we create a 16-bit integer view that shares the same buffer as the existing 32-bit view and we output all the values in the buffer as 16-bit integers. now we get the output 0, 0, 2, 0, 4, 0, 6, 0. you can go a step farther, though. consider...
JavaScript
learn javascript but have no previous experience of javascript or programming. the complete modules available there are as follows: javascript first steps answers some fundamental questions such as "what is javascript?", "what does it look like?", and "what can it do?", along with discussing key javascript features such as variables, strings, numbers, and arrays. javascript building blocks continues our coverage of javascript's key fundamental features, turning our attention to commonly-encountered types of code blocks such as conditional statements, loops, functions, and events. introducing javascript objects the object-oriented nature of javascript is important to understand if you want to go further with your knowledge of the language and write more efficient code, therefore we've prov...
Autoplay guide for media and Web Audio APIs - Web media technologies
o add the autoplay attribute to your <audio> or <video> element. this sets the autoplay property on the element to true, and when autoplay is true, the media will automatically begin to play as soon as possible after the following have occurred: the page is allowed to use autoplay functionality the element has been created during page load enough media has been received to begin playback and continue to play through to the end of the media without interruption, assuming there are no dramatic changes in network performance or bandwidth. example: the autoplay attribute an <audio> element using the autoplay attribute might look like this: <audio id="musicplayer" autoplay> <source src="/music/chapter1.mp4"> </audio> example 2: detecting autoplay failure if you rely on autoplay for anythi...
The "codecs" parameter in common media types - Web media technologies
also work, but are not recommended. iso base media file format syntax as part of a move toward a standardized and powerful format for the codecs parameter, webm is moving toward describing video content using a syntax based on that defined by the iso base media file format. this syntax is defined in vp codec iso media file format binding, in the section codecs parameter string. the audio codec continues to be indicated as either vorbis or opus. in this format, the codecs parameter's value begins with a four-character code identifying the codec being used in the container, which is then followed by a series of period (.) separated two-digit values. cccc.pp.ll.dd.cc[.cp[.tc[.mc[.ff]]]] the first five components are required; everything from cp (color primaries) onward is optional; you can stop...
Critical rendering path - Web Performance
e html - response headers and data. the browser then begins parsing the html, converting the received bytes to the dom tree. the browser initiates requests every time it finds links to external resources, be they stylesheets, scripts, or embedded image references. some requests are blocking, which means the parsing of the rest of the html is halted until the imported asset is handled. the browser continues to parse the html making requests and building the dom, until it gets to the end, at which point it constructs the css object model. with the dom and cssom complete, the browser builds the render tree, computing the styles for all the visible content. after the render tree is complete, layout occurs, defining the location and size of all the render tree elements. once complete, the page is rende...
<feComposite> - SVG: Scalable Vector Graphics
<use xlink:href="#red100" filter="url(#arithmeticflood)" /> <use xlink:href="#red50" filter="url(#arithmeticflood)" /> <text x="-25" y="275">arithmetic</text> </g> </g> <g transform="translate(0,325)" enable-background="new"> <desc>render the examples using the filters that do not obliterate the background, thus sometimes causing the background to continue to appear in some cases, and in other cases the background image blends into itself ("double-counting").</desc> <text x="15" y="75">opacity 1.0</text> <text x="15" y="115" font-size="27">(without feflood)</text> <text x="15" y="200">opacity 0.5</text> <text x="15" y="240" font-size="27">(without feflood)</text> <use xlink:href="#bluetriangles"/> ...
Gradients in SVG - SVG: Scalable Vector Graphics
er one i want to mention here is the spreadmethod attribute. this attribute controls what happens when the gradient reaches its end, but the object isn't filled yet. it can take on one of three values, "pad", "reflect", or "repeat". "pad" is what you have seen so far. when the gradient reaches its end, the final offset color is used to fill the rest of the object. "reflect" causes the gradient to continue on, but reflected in reverse, starting with the color offset at 100% and moving back to the offset at 0%, and then back up again. "repeat" also lets the gradient continue, but instead of going backwards, it just jumps back to the beginning and runs again. spreadmethod <?xml version="1.0" standalone="no"?> <svg width="220" height="220" version="1.1" xmlns="http://www.w3.org/2000/svg"> <defs> ...
Introduction - SVG: Scalable Vector Graphics
d yield graphics primitives for small devices with low capabilities. svg basic offers many features of full svg, but doesn't include the ones which are hard to implement or heavy to render (like animations). in 2008, svg tiny 1.2 became a w3c recommendation. there were plans for an svg print specification, which would add support for multiple pages and enhanced color management. this work was discontinued. « previousnext » ...
Tutorials
rst javascript module, we first answer some fundamental questions such as "what is javascript?", "what does it look like?", and "what can it do?", before moving on to taking you through your first practical experience of writing javascript. after that, we discuss some key javascript features in detail, such as variables, strings, numbers and arrays. javascript building blocks in this module, we continue our coverage of all javascript's key fundamental features, turning our attention to commonly-encountered types of code block such as conditional statements, loops, functions, and events. you've seen this stuff already in the course, but only in passing — here we'll discuss it all explicitly. getting started with javascript what is javascript and how can it help you? codecademy codecad...
<xsl:message> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › message
ssage (to the javascript console in ns) and optionally terminates execution of the stylesheet. it can be useful for debugging. syntax <xsl:message terminate="yes" | "no" > template </xsl:message> required attributes none. optional attributes terminate set to "yes", indicates that execution should be terminated. the default value is "no", in which case the message is output and execution continues. type instruction, appears within a template. defined xslt, section 13. gecko support supported. ...
An Overview - XSLT: Extensible Stylesheet Language Transformations
te nodes, comment nodes, processing instruction nodes, and namespace nodes. at the top of the tree is the root node. the root node does not correspond to any individual part of the xml document: it represents the document as whole. below the root node are its children, which can be elements, comments, processing instructions and so on. some of those children may also have children. and this can continue for several levels. there are certain constraints on which type of nodes can occur where: for example, text nodes can have no children. the result of the processor's action is also a tree. netscape uses this tree to render the contents in the browser window. xslt is a high-level declarative language. in essence, an xslt stylesheet is a set of rules, called templates, which declare that any ...