Search completed in 1.42 seconds.
mozbrowseractivitydone
the mozbrowseractivity
done event is fired when something inside the browser <iframe> triggers a web activity, and that web activity's message is consumed by the receiving app.
... note: for activities where the receiving app's activity definition in its manifest does not include returnvalue or returnvalue is false, no mozbrowseractivity
done event will be generated as of the landing of bug 1194525 in firefox os 2.5.
... examples var browser = document.queryselector("iframe"); browser.addeventlistener("mozbrowseractivity
done", function(event) { if(event.details.success) { console.log('activity completed successfully'); } else { console.log('activity not completed successfully'); } }); related events mozbrowserclose mozbrowsercontextmenu mozbrowsererror mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowser...
loadOneTab - Archive of obsolete content
« xul reference home loa
donetab( url, referreruri, charset, postdata, loadinbackground, allowthirdpartyfixup ) loa
donetab( url, { referreruri: ..., charset: ..., postdata: ..., inbackground: ..., allowthirdpartyfixup: ..., relatedtocurrent: ...
NSS Sample Code Sample1
rv = getprivatekey(&prvkey); if (rv == 0 && prvkey) goto
done; rv = 0; // these could be parameters to the init function rsaparams.keysizeinbits = 1024; rsaparams.pe = 65537; slot = pk11_getinternalkeyslot(); if (!slot) { rv = 1; goto
done; } prvkey = pk11_generatekeypair(slot, ckm_rsa_pkcs_key_pair_gen, &rsaparams, &pubkey, pr_true, pr_true, 0); if (!prvkey) { rv = 1; goto
done; } // set the nickname on the private key...
... s = pk11_setprivatekeynickname(prvkey, mservername); if (s != secsuccess) { rv = 1; goto
done; }
done: if (slot) pk11_freeslot(slot); if (pubkey) seckey_destroypublickey(pubkey); if (prvkey) seckey_destroyprivatekey(prvkey); return rv; } int server::generatekeys() { int rv = 0; seckeypublickey *pubkey = 0; pk11slotinfo *slot = 0; // choose a slot to use slot = pk11_getinternalkeyslot(); if (!slot) { rv = 1; goto
done; } // get our own public key to use for wrapping rv = getpublickey(&pubkey); if (rv) goto
done; // do the encryption (aes) key if (!mwrappedenckey) { pk11symkey *key = 0; // the key size is 128 bits (16 bytes) key = pk11_keygen(slot, ckm_aes_key_gen, 0, 128/8, 0); if (!key) { rv = 1; go...
...to aes_
done; } rv = wrapkey(key, pubkey, &mwrappedenckey); aes_
done: if (key) pk11_freesymkey(key); if (rv) goto
done; } // do the mac key if (!mwrappedmackey) { pk11symkey *key = 0; // the key size is 160 bits (20 bytes) key = pk11_keygen(slot, ckm_generic_secret_key_gen, 0, 160/8, 0); if (!key) { rv = 1; goto mac_
done; } rv = wrapkey(key, pubkey, &mwrappedmackey); mac_
done: if (key) pk11_freesymkey(key); }
done: if (slot) pk11_freeslot(slot); return rv; } int server::exportpublickey(secitem **pubkeydata) { int rv = 0; seckeypublickey *pubkey = 0; rv = getpublickey(&pubkey); if (rv) goto
done; *pubkeydata = seckey_encodedersubjectpublickeyinfo(pubkey); if (!*pubkeydata) { rv = 1; goto
done; }
done: if (pubkey) se...
...And 18 more matches
Index - Web APIs
when you're
done building your blob, call getblob() to retrieve a blob containing the data you sent into the blob builder.
...a good example at html5accessibility.com demonstrates how this can be
done: 529 optimizing canvas advanced, canvas, graphics, html, html5, tutorial this article provides suggestions for optimizing your use of the canvas element to ensure that your graphics perform well.
...enabling mouse capture on an element is
done by calling element.setcapture().
...And 16 more matches
Creating our first Vue component - Learn web development
inside this object, add two properties with the keys label and
done.
... now on to the
done prop.
...this means that when no
done prop is passed to a todoitem component, the
done prop will will have a value of false (bear in mind that this is not required — we only need default on non-required props).
...And 14 more matches
Xptcall Porting Status
status status platform contributors and <font color="red">?</font> possible contributors notes <font color="white">
done</font> win32 x86 john bandhauer <jband@netscape.com> win32 <font color="white">
done</font> linux x86 john bandhauer <jband@netscape.com> ulrich drepper <drepper@cygnus.com> unix <font color="white">
done</font> freebsd and netbsd x86 christoph toshok <toshok@hungry.com>, john bandhauer <jband@netscape.com> unix (same as linux 86 code) <font color="white">
done</font> bsd/os x86 bert dri...
...bert's details <font color="white">
done</font> mac ppc roger lawrence <rogerl@netscape.com>, patrick beard <beard@netscape.com> mac (passing tests and checked in) <font color="white">
done</font> solaris sparc roger lawrence <rogerl@netscape.com>, chris mcafee <mcafee@netscape.com> unix this is checked in and working.
... <font color="white">
done</font> solaris sparc v9 (64bit) stuart parmenter <pavlov@netscape.com>, chris seawood <cls@seawood.org> unix this is checked in and (pavlov claims!) working.
...And 14 more matches
Using readable streams - Web APIs
this is
done using the readablestream.getreader() method: // fetch the original image fetch('./tortoise.png') // retrieve its body as readablestream .then(response => response.body) .then(body => { const reader = body.getreader(); invoking this method creates a reader and locks it to the stream — no other reader may read this stream until this reader is released, e.g.
... return new readablestream({ start(controller) { return pump(); function pump() { return reader.read().then(({
done, value }) => { // when no more data needs to be consumed, close the stream if (
done) { controller.close(); return; } // enqueue the next data chunk into our target stream controller.enqueue(value); return pump(); }); } } }) }) .then(stream => new response(stream)) .then(response => response...
...in the pump() function seen above we first invoke read(), which returns a promise containing a results object — this has the results of our read in it, in the form {
done, value }: return reader.read().then(({
done, value }) => { the results can be one of three different types: if a chunk is available to read, the promise will be fulfilled with an object of the form { value: thechunk,
done: false }.
...And 10 more matches
Index
once the application is
done with a handle, it should be released, allowing nss to free the associated resources.
...the usual approach is to create a certificate signing request (csr) as soon as an application is
done with the creation step, which will have created a handle to the key pair, and which can be used for the necessary related operations, like producing a proof-of-ownership of the private key, which is usually required when submitting the public key with a csr to a ca.
...once a task is
done, regardless whether it completed or was aborted, the programmer simply needs to release the arena, and all individually allocated blocks will be released automatically.
...And 8 more matches
Iteration protocols - JavaScript
an object is an iterator when it implements a next() method with the following semantics: property value next() a zero-argument function that returns an object with at least the following two properties:
done (boolean) has the value false if the iterator was able to produce the next value in the sequence.
... (this is equivalent to not specifying the
done property altogether.) has the value true if the iterator has completed its sequence.
...can be omitted when
done is true.
...And 7 more matches
How to build custom form controls - Learn web development
creating new controls is not that easy, especially if you are creating something that has not been
done before, and therefore which nobody has the slightest idea of what the expected behaviors and interactions are.
... at least select has been
done before, so we know how it should behave!
... building event callbacks the groundwork is
done.
...And 6 more matches
Using Vue computed properties - Learn web development
while it might be tempting to do something like this: <h2>{{todoitems.filter(item => item.
done).length}} out of {{todoitems.length}} items completed</h2> it would be recalculated on every render.
... computed: { listsummary() { const numberfinisheditems = this.todoitems.filter(item =>item.
done).length return `${numberfinisheditems} out of ${this.todoitems.length} items completed` } } now we can add {{listsummary}} directly to our template; we'll add this inside an <h2> element, just above our <ul>.
... add the described <h2> and update the <ul> inside your app's template as follows: <h2 id="list-summary">{{listsummary}}</h2> <ul aria-labelledby="list-summary" class="stack-large"> <li v-for="item in todoitems" :key="item.id"> <to-do-item :label="item.label" :
done="item.
done" :id="item.id"></to-do-item> </li> </ul> you should now see the list summary in your app, and the total number of items update as you add more todo items!
...And 6 more matches
Vue conditional rendering: editing existing todos - Learn web development
<template> <div class="stack-small"> <div class="custom-checkbox"> <input type="checkbox" class="checkbox" :id="id" :checked="is
done" @change="$emit('checkbox-changed')" /> <label :for="id" class="checkbox-label">{{label}}</label> </div> <div class="btn-group"> <button type="button" class="btn" @click="toggletoitemeditform"> edit <span class="visually-hidden">{{label}}</span> </button> <button type="button" class="btn btn__danger" @click="deletetodo"> delete <span c...
... add isediting below your existing is
done data point: data() { return { is
done: this.
done, isediting: false }; } now add your methods inside a methods property, right below your data() property: methods: { deletetodo() { this.$emit('item-deleted'); }, toggletoitemeditform() { this.isediting = true; } } conditionally displaying components via v:if and v:else now we have an isediting flag that...
... update the <to-do-item></to-do-item> call inside the app.vue template to look like this: <to-do-item :label="item.label" :
done="item.
done" :id="item.id" @checkbox-changed="update
donestatus(item.id)" @item-deleted="deletetodo(item.id)" @item-edited="edittodo(item.id, $event)"> </to-do-item> and there you have it — you should now be able to edit and delete items from the list!
...And 6 more matches
Floats - Learn web development
donec luctus augue eget malesuada ultrices.
...
donec luctus augue eget malesuada ultrices.
...
donec luctus augue eget malesuada ultrices.
...And 5 more matches
Client-side storage - Learn web development
add the following to the bottom of your code: document.body.onload = namedisplaycheck; your example is finished — well
done!
...you don't want to hang the browser while you wait for the results, so database operations are asynchronous, meaning that instead of happening immediately, they will happen at some point in the future, and you get notified when they're
done.
...add the following code, below your previous handler: // setup the database tables if this has not already been
done request.onupgradeneeded = function(e) { // grab a reference to the opened database let db = e.target.result; // create an objectstore to store our notes in (basically like a single table) // including a auto-incrementing key let objectstore = db.createobjectstore('notes_os', { keypath: 'id', autoincrement:true }); // define what data items the objectstore will contain objectstore.
...And 5 more matches
Drawing graphics - Learn web development
you could use css, but the trouble then is that the sizing is
done after the canvas has rendered, and just like any other image (the rendered canvas is just an image), the image could become pixellated/distorted.
...this is
done using the htmlcanvaselement.getcontext() method, which for basic usage takes a single string as a parameter representing the type of context you want to retrieve.
... ok, our template is
done and it's time to move on.
...And 5 more matches
Rendering a list of Vue components - Learn web development
each to-do item will be represented by an object with a name and a
done property.
... export default { name: 'app', components: { todoitem }, data() { return { todoitems: [ { label: 'learn vue',
done: false }, { label: 'create a vue project with the cli',
done: true }, { label: 'have fun',
done: true }, { label: 'create a to-do list',
done: false } ] }; } }; now that we have a list of items, we can use the v-for directive to display them.
... your app.vue <script> element contents should now look like this: import todoitem from './components/todoitem.vue'; import uniqueid from 'lodash.uniqueid' export default { name: 'app', components: { todoitem }, data() { return { todoitems: [ { id: uniqueid('todo-'), label: 'learn vue',
done: false }, { id: uniqueid('todo-'), label: 'create a vue project with the cli',
done: true }, { id: uniqueid('todo-'), label: 'have fun',
done: true }, { id: uniqueid('todo-'), label: 'create a to-do list',
done: false } ] }; } }; now, add the v-for directive and key attribute to the <li> element in your app.vue template, like so: <ul> <li v-for="item...
...And 5 more matches
source-editor.jsm
canredo() determines whether or not there are changes that can be re
done.
... return value true if there are changes that can be re
done, otherwise false.
... canundo() determines whether or not there are changes that can be un
done.
...And 5 more matches
window.location - Web APIs
donec a mi magna, quis mattis dolor.
...
donec dignissim est in quam tempor consequat.
...
donec lacus risus, dignissim et fringilla et, egestas vel eros.
...And 5 more matches
Introducing asynchronous JavaScript - Learn web development
when the background code finishes running, it calls the callback function to let you know the work is
done, or to let you know that something of interest has happened.
...fetch('coffee.jpg').then((response) => { console.log('it worked :)') return response.blob(); }).then((myblob) => { let objecturl = url.createobjecturl(myblob); image = document.createelement('img'); image.src = objecturl; document.body.appendchild(image); }).catch((error) => { console.log('there 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.
...And 4 more matches
Adding a new todo form: Vue events, methods, and models - Learn web development
update your template as follows: <template> <form> <label for="new-todo-input"> what needs to be
done?
...s like this: components: { todoitem, todoform } finally for this section, render your todoform component inside your app by adding the <to-do-form /> element inside your app's <template>, like so: <template> <div id="app"> <h1>my to-do list</h1> <to-do-form></to-do-form> <ul> <li v-for="item in todoitems" :key="item.id"> <to-do-item :label="item.label" :
done="item.
done" :id="item.id"></to-do-item> </li> </ul> </div> </template> now when you view your running site, you should see the new form displayed.
... creating a method & binding it to an event with v-on to make a method available to the todoform component, we need to add it to the component object, and this is
done inside a methods property to our component, which goes in the same place as data(), props, etc.
...And 4 more matches
An overview of NSS Internals
once the application is
done with a handle, it should be released, allowing nss to free the associated resources.
...the usual approach is to create a certificate signing request (csr) as soon as an application is
done with the creation step, which will have created a handle to the key pair, and which can be used for the necessary related operations, like producing a proof-of-ownership of the private key, which is usually required when submitting the public key with a csr to a ca.
...once a task is
done, regardless whether it completed or was aborted, the programmer simply needs to release the arena, and all individually allocated blocks will be released automatically.
...And 4 more matches
Index
this is
done as follows: 225 mozivisitinfo no summary!
... 352 nsiautocompletelistener interfaces, interfaces:scriptable, needscontent called by the autocomplete session when the search is
done or over.
...once that has been
done, the reporter will be found by any client accessing the enumerator returned by nsimemoryreportermanager.enumeratereporters().
...And 4 more matches
WebIDL bindings
returning null as a string value can be
done using setdomstringtonull on the out param if it's an nsastring or calling setnull() on a domstring.
...returning null as a string value can be
done using setisvoid() on the out param.
...returning null as a string value can be
done using setisvoid() on the out param.
...And 4 more matches
Add to iPhoto
oes here } shutting down core foundation while the core foundation system framework itself doesn't need to be shut down, we do need to close the library we opened using the js-ctypes api; that's where the shutdown() method comes in: shutdown: function() { this.lib.close(); } select api declarations let's take a look at a few of the key apis we declare for core foundation, to see how it's
done.
... the first declaration to be
done here is to actually declare the cfstringref data type; this is an opaque pointer to a cfstring object.
...to do that, we first need to declare the cfarraycallbacks structure: this.cfarraycallbacks = new ctypes.structtype("cfarraycallbacks", [ {'version': cfindex}, {'retain': ctypes.voidptr_t}, {'release': ctypes.voidptr_t}, {'copydescription': ctypes.voidptr_t}, {'equal': ctypes.voidptr_t} ]); having
done this, we can then import the kcftypearraycallbacks structure.
...And 4 more matches
ReadableStreamDefaultReader.read() - Web APIs
the different possibilities are as follows: if a chunk is available, the promise will be fulfilled with an object of the form { value: thechunk,
done: false }.
... if the stream becomes closed, the promise will be fulfilled with an object of the form { value: undefined,
done: true }.
... function fetchstream() { const reader = stream.getreader(); let charsreceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processtext({
done, value }) { // result objects contain two properties: //
done - true if the stream has already given you all its data.
...And 4 more matches
Generator.prototype.next() - JavaScript
the next() method returns an object with two properties
done and value.
... return value an object with two properties:
done (boolean) has the value true if the iterator is past the end of the iterated sequence.
...this is equivalent of not specifying the
done property altogether.
...And 4 more matches
Index - Archive of obsolete content
this is
done, for example, by the about:addons page.
...further details on smaller tasks being
done are available at user:dria:todo page.
...the first parameter is the nsidomwindow you just retrieved, the second is the editor type you want to create, and the third is whether you want the window editable immediately or when the document is
done loading.
...And 3 more matches
How to Write and Land Nanojit Patches - Archive of obsolete content
for mozilla people it's probably best
done in your tracemonkey repo, for adobe people it's probably best
done in your tamarin-redux repo.
... but don't push that update, as that should only be
done by a member of that public repo.] once it passes testing, file the patch to bugzilla (file a bug under the "nanojit" component in the "core" product) and get a review.
... you might find it easier to just cut-and-paste links from the commit log.) you're
done, but watch the nanojit tinderbox for breakage.
...And 3 more matches
Grids - Learn web development
donec luctus augue eget malesuada ultrices.
...
donec luctus augue eget malesuada ultrices.
...
donec luctus augue eget malesuada ultrices.
...And 3 more matches
Bytecode Descriptions
isnoiter stack: val ⇒ val,
done test whether the value on top of the stack is magicvalue(js_no_iter_value) and push the boolean result.
...it should be an object of the form {value: returnvalue,
done: true}.
...for non-async generators, rval1 should be an object of the form {value: valuetoyield,
done: true}.
...And 3 more matches
Iterators and generators - JavaScript
done this is true if the last value in the sequence has already been consumed.
... if value is present alongside
done, it is the iterator's return value.
...after a terminating value has been yielded additional calls to next() should simply continue to return {
done: true}.
...And 3 more matches
function* - JavaScript
the next() method returns an object with a value property containing the yielded value and a
done property which indicates whether the generator has yielded its last value, as a boolean.
...the
done property of the object returned by it will be set to true).
... when a generator is finished, subsequent next() calls will not execute any of that generator's code, they will just return an object of this form: {value: undefined,
done: true}.
...And 3 more matches
Legacy layout methods - Learn web development
donec luctus augue eget malesuada ultrices.
...
donec luctus augue eget malesuada ultrices.
...this takes a bit of time with a calculator; to save you some effort, we've
done it for you below.
...And 2 more matches
Deployment and next steps - Learn web development
code along with us git clone the github repo (if you haven't already
done it) with: git clone https://github.com/opensas/mdn-svelte-tutorial.git then to get to the current app state, run cd mdn-svelte-tutorial/08-next-steps or directly download the folder's content: npx degit opensas/mdn-svelte-tutorial/08-next-steps remember to run npm install && npm run dev to start your app in development mode.
...do this by running the following commands: > git add public/index.html > git add .gitlab-ci.yml > git commit -m "added .gitlab-ci.yml file and fixed index.html absolute paths" > git push counting objects: 5,
done.
...compressing objects: 100% (5/5),
done.
...And 2 more matches
Introduction to cross browser testing - Learn web development
remember that you are not your users — just because your site works on your macbook pro or high-end galaxy nexus, doesn't mean it will work for all your users — there's a whole lot of testing to be
done!
...as long as the site owner is happy with this, then you have
done your job.
...no more new work
done on them) a long time before a new feature was even invented.
...And 2 more matches
Setting up your own test automation environment - Learn web development
so here we've
done the test as before, except that this time we've wrapped it inside a function, searchtest().
...the actual selection is
done by the findelement() method, which accepts as a parameter a selection method.
...this is
done using the quit() method.
...And 2 more matches
Introducing a complete toolchain - Learn web development
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.
...there might be important decorations or music that help with your mental state — these are all important to doing your best work possible, and they should also only need to be set up once, if
done properly.
... in the same way, setting up your development environment, if
done well, needs doing only once and should be reusable in many future projects.
...And 2 more matches
Debugging on Mac OS X
once
done, you should be able to open any file quickly by hitting cmd-shift-o and typing in the name of a file.) in the product menu, select scheme > new scheme and name your scheme (for example, "debug").
...().findbreakpointsbyname("nsthread::processnextevent", dummy_bp_list) dummy_bp_id = dummy_bp_list.getbreakpointatindex(0).getid() + 1 debugger.getdummytarget().breakpointdelete(dummy_bp_id) # "source" the mozilla project .lldbinit: os.chdir(target.executable.fullpath.split("/dist/")[0]) debugger.handlecommand("command source -s true " + os.path.join(os.getcwd(), ".lldbinit"))
done see debugging mozilla with lldb for more information.
...close the window when you're
done.
...And 2 more matches
NSS Sample Code sample3
* this code uses the simplest of the init functions, which does not * require a nss database to exist */ nss_nodb_init("."); /* get a slot to use for the crypto operations */ slot = pk11_getinternalkeyslot(); if (!slot) { cout << "getinternalkeyslot failed" << endl; status = 1; goto
done; } /* * part 1 - simple hashing */ cout << "part 1 -- simple hashing" << endl; /* initialize data */ memset(data, 0xbc, sizeof data); /* create a context for hashing (digesting) */ context = pk11_createdigestcontext(sec_oid_md5); if (!context) { cout << "createdigestcontext failed" << endl; goto
done; } s = pk11_digestbegin(context); if (s != secsuccess) { cout << "...
...digestbegin failed" << endl; goto
done; } s = pk11_digestop(context, data, sizeof data); if (s != secsuccess) { cout << "digestupdate failed" << endl; goto
done; } s = pk11_digestfinal(context, digest, &len, sizeof digest); if (s != secsuccess) { cout << "digestfinal failed" << endl; goto
done; } /* print digest */ printdigest(digest, len); pk11_destroycontext(context, pr_true); context = 0; /* * part 2 - hashing with included secret key */ cout << "part 2 -- hashing with included secret key" << endl; /* initialize data */ memset(data, 0xbc, sizeof data); /* create a key */ key = pk11_keygen(slot, ckm_generic_secret_key_gen, 0, 128, 0); if (!key) { cout << "create key failed" << endl; goto
done; } cout << (void *)key << endl; /* create paramete...
... /* note: params must be provided, but may be empty */ secitem noparams; noparams.type = sibuffer; noparams.data = 0; noparams.len = 0; /* create context using the same slot as the key */ // context = pk11_createdigestcontext(sec_oid_md5); context = pk11_createcontextbysymkey(ckm_md5, cka_digest, key, &noparams); if (!context) { cout << "createdigestcontext failed" << endl; goto
done; } s = pk11_digestbegin(context); if (s != secsuccess) { cout << "digestbegin failed" << endl; goto
done; } s = pk11_digestkey(context, key); if (s != secsuccess) { cout << "digestkey failed" << endl; goto
done; } s = pk11_digestop(context, data, sizeof data); if (s != secsuccess) { cout << "digestupdate failed" << endl; goto
done; } s = pk11_digestfinal(context, digest, &len, s...
...And 2 more matches
nsIFaviconService
no validity checking is
done.
...no validity checking is
done.
...however, any favicons not associated with a visited web page, bookmark, or "place:" uri will be expired when history cleanup is
done.
...And 2 more matches
nsIXULTemplateQueryProcessor
the initializeforbuilding(), compilequery() and addbinding() methods may not be called after generateresults() has been called until the builder indicates that the generated output is being removed by calling the
done() method.
... currently, the datasource supplied to the methods will always be an nsirdfdatasource or a dom node, and will always be the same one in between calls to initializeforbuilding() and
done().
... method overview void addbinding(in nsidomnode arulenode, in nsiatom avar, in nsiatom aref, in astring aexpr); print32 compareresults(in nsixultemplateresult aleft, in nsixultemplateresult aright, in nsiatom avar, in unsigned long asorthints); nsisupports compilequery(in nsixultemplatebuilder abuilder, in nsidomnode aquery, in nsiatom arefvariable, in nsiatom amembervariable); void
done(); nsisimpleenumerator generateresults(in nsisupports adatasource, in nsixultemplateresult aref, in nsisupports aquery); nsisupports getdatasource(in nsiarray adatasources, in nsidomnode arootnode, in boolean aistrusted, in nsixultemplatebuilder abuilder, out boolean ashoulddelaybuilding); void initializeforbuilding(in nsisupports adatasource, in nsixultemplatebuilder abuilder, in nsidomnode aroo...
...And 2 more matches
Intensive JavaScript - Firefox Developer Tools
the main thread code would look something like this: const iterations = 50; const multiplier = 1000000000; var worker = new worker("js/calculate.js"); function dopointlesscomputationsinworker() { function handleworkercompletion(message) { if (message.data.command == "
done") { pointlesscomputationsbutton.disabled = false; console.log(message.data.primes); worker.removeeventlistener("message", handleworkercompletion); } } worker.addeventlistener("message", handleworkercompletion, false); worker.postmessage({ "multiplier": multiplier, "iterations": iterations }); } the main difference here, compared with the original, is that ...
...we need to: create a worker send it a message when we are ready to calculate listen for a message called "
done", which indicates that the worker has finished.
... then we need a new file "calculate.js", that looks like this: self.addeventlistener("message", go); function go(message) { var iterations = message.data.iterations; var multiplier = message.data.multiplier; primes = calculateprimes(iterations, multiplier); self.postmessage({ "command":"
done", "primes": primes }); } function calculateprimes(iterations, multiplier) { var primes = []; for (var i = 0; i < iterations; i++) { var candidate = i * (multiplier * math.random()); var isprime = true; for (var c = 2; c <= math.sqrt(candidate); ++c) { if (candidate % c === 0) { // not prime isprime = false; break; } } if (isprime) { primes.push(candidate); } } return primes; } in the worker, we have to...
...And 2 more matches
Element.scrollHeight - Web APIs
donec vel mi in ligula hendrerit sagittis.
...
donec faucibus viverra fermentum.
...
donec varius dolor malesuada erat consequat congue.
...And 2 more matches
Using files from web applications - Web APIs
this selection can be
done by either using an html <input type="file"> element or by drag and drop.
...this is
done by adding listeners for the dragenter, dragover, and drop events.
...css can be used to establish any pretty borders or shadows and to specify the size of the image, so that doesn't need to be
done here.
...And 2 more matches
Timing element visibility with the Intersection Observer API - Web APIs
without the intersection observer api, this winds up being
done using intervals and timeouts for each individual ad, or other techniques that tend to slow the page down.
...for each observer, a list of targets that have
done so is compiled, and sent to the observer's callback as an array of intersectionobserverentry objects.
...this is
done whether the ad was running when this function was called or not; this causes the ad's timer to always be running when this function returns.
...And 2 more matches
Getting Started - Developer guides
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.
..., makerequest); function makerequest() { httprequest = new xmlhttprequest(); if (!httprequest) { alert('giving up :( cannot create an xmlhttp instance'); return false; } httprequest.onreadystatechange = alertcontents; httprequest.open('get', 'test.html'); httprequest.send(); } function alertcontents() { if (httprequest.readystate === xmlhttprequest.
done) { if (httprequest.status === 200) { alert(httprequest.responsetext); } else { alert('there was a problem with the request.'); } } } })(); </script> in this example: the user clicks the "make a request" button; the event handler calls the makerequest() function; the request is made and then (onreadystatechange) the execution is passed to alertcontent...
...And 2 more matches
Generator.prototype.throw() - JavaScript
the throw() method resumes the execution of a generator by throwing an error into it and returns an object with two properties
done and value.
... return value an object with two properties:
done (boolean) has the value true if the iterator is past the end of the iterated sequence.
...this is equivalent of not specifying the
done property altogether.
...And 2 more matches
yield - JavaScript
the yield keyword causes the call to the generator's next() method to return an iteratorresult object with two properties: value and
done.
... the value property is the result of evaluating the yield expression, and
done is false, indicating that the generator function has not fully completed.
...in this case, execution of the generator ends and an iteratorresult is returned to the caller in which the value is undefined and
done is true.
...And 2 more matches
Authoring MathML - MathML
this is a pure web-based solution: everything is
done by the browsers and no other programs must be installed or compiled.
... the conversion must be
done at each page load, may be slow and may conflict with the html parsing (e.g.
...for example, this will split the pages at the \section level: latexmlc --dest foo.html --splitat=section foo.tex server-side conversion pros: conversion is
done server-side and the mathml output can be cached, which is more efficient and cleaner than client-side conversion.
...And 2 more matches
Local Storage - Archive of obsolete content
a good argument can be
done for both, so it is up to you to choose what to do in this case.
... and then logging is
done with any of the following methods, depending on the kind of message being logged: this._logger.fatal("this is a fatal message."); this._logger.error("this is an error message."); this._logger.warn("this is a warning message."); this._logger.info("this is an info message."); this._logger.config("this is a config message."); this._logger.debug("this is a debug message."); this._logger.trace("this ...
...we normally add a comment that indicates that logging is not
done there for performance reasons.
...if you need a complex database this can be heavy in terms of time and code, but this will only happen once and this can be
done in a lazy or asynchronous way.
Setting Up a Development Environment - Archive of obsolete content
done!
...that is because make can tell that the file in the bin directory is up to date, and nothing needs to be
done.
...the signature verifies that you are the author of this extension, and it can only be
done if you have a valid certificate provided by a trusted certificate authority.
...ideally this should be handled by a single person, and only
done near the end of the release process.
Hacking wiki - Archive of obsolete content
it's
done by navigating to <tt>/config/index.php</tt> in your web browser.
...once you're
done with the configuration script, copy the <tt>config/localsettings.php</tt> file it created to the parent directory and navigate to the location you installed mediawiki to.
...for example: [snip] include("extensions/breadcrumbs.php"); include("extensions/titleoverride.php"); include("extensions/abbr.php"); include("extensions/object.php"); include("extensions/kbd.php"); ?> tbd installing/configuring rss and doxygen extensions - anything special needs to be
done?
...the following worked for me (from the <tt>www</tt> directory): /path/to/php -f ./maintenance/update-devmo.php
done you should have a working install of the mdc wiki now.
Multiple-column layout - Learn web development
donec luctus augue eget malesuada ultrices.
...
donec luctus augue eget malesuada ultrices.
...
donec luctus augue eget malesuada ultrices.
...
donec luctus augue eget malesuada ultrices.
Advanced form styling - Learn web development
previous overview: forms next in this article, we will see what can be
done with css to style the types of form control that are more difficult to style — the "bad" and "ugly" categories.
... objective: to understand what parts of forms are hard to style, and why; to learn what can be
done to customize them.
... what can be
done about the "ugly" elements?
... as you can see, we've
done fairly well at getting these to look uniform across modern browsers.
Document and website structure - Learn web development
donec a diam lectus.
...
donec et mollis dolor.
...nam tincidunt congue enim, ut porta lorem lacinia consectetur.</p> <h3>subsection</h3> <p>
donec ut librero sed accu vehicula ultricies a non tortor.
...
donec sed odio eros.</p> <h3>another subsection</h3> <p>
donec viverra mi quis quam pulvinar at malesuada arcu rhoncus.
Graceful asynchronous programming with Promises - Learn web development
we're able to chain multiple asynchronous actions to occur one after another this way because each .then() block returns a new promise that resolves when the .then() block is
done running.
...this can be
done like so — add the following lines below your first line of javascript.
... chaining the blocks together this is a very longhand way of writing this out; we've deliberately
done this to help you understand what is going on clearly.
...our code doesn't care when the fetch() operations are
done.
Styling Vue components with CSS - Learn web development
let's look at how this is
done.
...since vue templates are valid html, this is
done in the same way to how you might do it in plain html — by adding a class="" attribute to the element.
... update your todoform template so that it looks like this: <template> <form @submit.prevent="onsubmit"> <h2 class="label-wrapper"> <label for="new-todo-input" class="label__lg"> what needs to be
done?
... summary our work is
done on the styling of our sample app.
Handling common HTML and CSS problems - Learn web development
another solution is to add prefixes automatically during development, and this (and other things besides) can be
done using tools like autoprefixer and postcss.
...for example, you can use it with a task runner/build tool such as gulp or webpack to automatically add prefixes once development has been
done.
... note: historically web developers used to use css files called resets, which removed all the default browser styling applied to html, and then applied their own styles for everything over the top — this was
done to make styling on a project more consistent, and reduce possible cross browser issues, especially for things like layout.
... support for new layout features much of the layout work on the web today is
done using floats — this is because floats are well-supported (way back to ie4, albeit with a number of bugs that would also need to be investigated if you were to try to support ie that far back).
Extending a Protocol
and we generally want the parent to let a child know when some work is
done - and send some confirmation or result data back to the child.
...it's quite involved and, unfortunately, all steps need to be
done before we can successfully recompile.
...naturally, we want to remove that once we
done implementing.
...
done!
Application Translation with Mercurial
check what is available for translation find out on which branch localization is
done for your locale: read your localization team's page by clicking on the team with your language code (e.g.
...this can be
done in a text editor or word processor or any other tool in which you can attach different kind of states to the individual texts to translate.
...other localizers will likely have
done changes to the translation, either adding new texts, removing obsolete ones or improving the current texts.
...if you find that changes have to be
done, edit the real aboutprivatebrowsing.dtd file from the localization repository, save it and follow the steps from exporting the changes as patch (see above).
Localizing with Koala
when the comparison is
done, you should see a new line in "last used compares" section of koala's startpage.
... when you are
done with translating the cmd_enginemanager.label entity, save the file.
...this can be
done from koala.
...a good way of doing that is to ask yourself a question: "if i was a new person to this project and new nothing about the work already
done in this repository, would this message help me understand what changes were made in this revision?".
Release phase
you've setup up your local and remote environments, you've selected your l10n tools and projects,
done some localization and even some testing!
...here's how that's
done: run this command to see recent commits in your local clone: $ hg log -l 3 you should a list of the most recent commits, similar to this one: changeset: 0:7c543e8f3a6a tag: tip user: your name <email@example.com> date: mon nov 23 18:08:25 2009 +0100 summary: added search bar strings now run the hg outgoing command to compare the local repository on your machine...
...technical and sign-off reviews you've
done some localization work and your ready for it to be released.
...this is
done by generating a diff between the new release revision being considered and the previously approved release revision.
Web Replay
this is
done in code associated with the non-deterministic components, such as during gc or ion compilation, to help track down behaviors that should go unrecorded.
... restoring snapshots is also
done from the main thread.
... this is
done in the following ways: instead of creating or destroying threads on demand, while recording/replaying all threads which will be needed are created during process initialization.
... inspecting a replaying process access to js objects in the replaying process is currently only
done through the js debugger interface — debugger.object, debugger.frame.eval, and so forth.
nsITransactionListener
atransaction the transaction being re
done.
...atransaction the transaction being un
done.
...atransaction the transaction being re
done.
...atransaction the transaction being un
done.
Reference Manual
most of the work of being an owning reference can be
done in the constructor, destructor, and assignment operators of nscomptr.
...nscomptr only does exactly the work you would have
done, if you always remembered to do the right thing.
...this time is negligable, especially in the face of work
done by queryinterface, and the work that may be
done by release.
... in all other cases, nscomptr does only the work you would have
done by hand.
Using COM from js-ctypes
speech synthesis example let's start with following c++ code, which invokes microsoft speech api and says "hello, firefox!" with system default voice, then wait until the speaking
done.
...e; hresult (__stdcall *speak)(struct myispvoice*, lpcwstr pwcs, dword dwflags, ulong* pulstreamnumber); void* speakstream; void* getstatus; void* skip; void* setpriority; void* getpriority; void* setalertboundary; void* getalertboundary; void* setrate; void* getrate; void* setvolume; void* getvolume; void* waituntil
done; void* setsyncspeaktimeout; void* getsyncspeaktimeout; void* speakcompleteevent; void* isuisupported; void* displayui; /* end ispvoice */ }; int main(void) { if (succeeded(coinitialize(null))) { struct myispvoice* pvoice = null; hresult hr = cocreateinstance(&clsid_spvoice, null, clsctx_all, &iid_ispvoice, (voi...
... this example uses busy loop and thus firefox won't respond until the speaking is
done.
...s': ctypes.voidptr_t }, { 'skip': ctypes.voidptr_t }, { 'setpriority': ctypes.voidptr_t }, { 'getpriority': ctypes.voidptr_t }, { 'setalertboundary': ctypes.voidptr_t }, { 'getalertboundary': ctypes.voidptr_t }, { 'setrate': ctypes.voidptr_t }, { 'getrate': ctypes.voidptr_t }, { 'setvolume': ctypes.voidptr_t }, { 'getvolume': ctypes.voidptr_t }, { 'waituntil
done': ctypes.voidptr_t }, { 'setsyncspeaktimeout': ctypes.voidptr_t }, { 'getsyncspeaktimeout': ctypes.voidptr_t }, { 'speakcompleteevent': ctypes.voidptr_t }, { 'isuisupported': ctypes.voidptr_t }, { 'displayui': ctypes.voidptr_t } // end ispvoice ]); // functions // http://msdn.microsoft.com/en-us/library/windows/desktop/ms695279%28v=vs.85%29.aspx let coinitializeex = lib.d...
Using js-ctypes
after you're
done when you're finished using a library, you should close it by calling the library object's close() method: lib.close(); if you fail to close the library, it will be automatically closed when it is garbage collected.
... the last thing we do is call lib.close() to close the library when we're
done using it.
... after that, we simply set up our parameters by using makestr() to generate the two str255 strings we need, then call stdalert(), which produces the following alert window: the last thing we do is call carbon.close() to close the library when we're
done using it.
... const unichar *chars, * cfindex numchars * ); */ var cfstringcreatewithcharacters = libcf.declare('cfstringcreatewithcharacters', ctypes.default_abi, cfstringref, // return cfallocatorref, // alloc unichar.ptr, // *chars cfindex // numchars ); // helper functions function makecfstr(jsstr) { // js str is just a string // returns a cfstr that must be released with cfrelease when
done return cfstringcreatewithcharacters(null, jsstr, jsstr.length); } // main var mycfstrs = { head: makecfstr('core foundation says...'), body: makecfstr('we just called the equivalent of the "standardalert carbon function" for 64bit osx from javascript!') }; var rez = cfusernotificationdisplaynotice(0, kcfusernotificationcautionalertlevel, null, null, null, mycfstrs.head, mycfstrs.body, null);...
IDBRequest - Web APIs
each reading and writing operation on a database is
done using a request.
...each request has a readystate that is set to the 'pending' state; this changes to '
done' when the request is completed or fails.
... when the state is set to
done, every request returns a result and an error, and an event is fired on the request.
...the state changes to
done when the request completes successfully or when an error occurs.
Using IndexedDB - Web APIs
to learn how this is
done, see the section on using an index.
...transaction.oncomplete = function(event) { console.log("all
done!"); }; transaction.onerror = function(event) { // don't forget to handle errors!
...a float) const db_store_name = 'publications'; var db; // used to keep track of which view is displayed to avoid uselessly reloading it var current_view_pub_key; function opendb() { console.log("opendb ..."); var req = indexeddb.open(db_name, db_version); req.onsuccess = function (evt) { // equal to: db = req.result; db = this.result; console.log("opendb
done"); }; req.onerror = function (evt) { console.error("opendb:", evt.target.errorcode); }; req.onupgradeneeded = function (evt) { console.log("opendb.onupgradeneeded"); var store = evt.currenttarget.result.createobjectstore( db_store_name, { keypath: 'id', autoincrement: true }); store.createindex('biblioid', 'biblioid', { unique: true }); stor...
..."failure: " + msg : "failure"; $('#msg').html('<span class="action-failure">' + msg + '</span>'); } function resetactionstatus() { console.log("resetactionstatus ..."); $('#msg').empty(); console.log("resetactionstatus
done"); } function addeventlisteners() { console.log("addeventlisteners"); $('#register-form-reset').click(function(evt) { resetactionstatus(); }); $('#add-button').click(function(evt) { console.log("add ..."); var title = $('#pub-title').val(); var biblioid = $('#pub-biblioid').val(); if (!title || !biblioid) { displayactionfailure("require...
ReadableStreamDefaultReader.cancel() - Web APIs
when the stream is
done (if (
done)), we run reader.cancel() to cancel the stream, signalling that we don't need to use it any more.
... function fetchstream() { const reader = stream.getreader(); let charsreceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processtext({
done, value }) { // result objects contain two properties: //
done - true if the stream has already given you all its data.
...always undefined when
done is true.
... if (
done) { console.log("stream complete"); reader.cancel(); para.textcontent = result; return; } // value for fetch streams is a uint8array charsreceived += value.length; const chunk = value; let listitem = document.createelement('li'); listitem.textcontent = 'received ' + charsreceived + ' characters so far.
A basic 2D WebGL animation example - Web APIs
this can be
done easily enough by multiplying by a scaling factor that's based on the context's aspect ratio.
..., vertexnumcomponents, gl.float, false, 0, 0); gl.drawarrays(gl.triangles, 0, vertexcount); window.requestanimationframe(function(currenttime) { let deltaangle = ((currenttime - previoustime) / 1000.0) * degreespersecond; currentangle = (currentangle + deltaangle) % 360; previoustime = currenttime; animatescene(); }); } the first thing that needs to be
done in order to draw a frame of the animation is to clear the background to the desired color.
...this is
done using uniform2fv() (since this is a 2-value floating-point vector).
...that's
done here by calling requestanimationframe(), which asks that a callback function be executed the next time the browser is ready to update the screen.
WebGL best practices - Web APIs
getshader/programparameter(), getshader/programinfolog(), other gets on shaders/programs: flush + shader compile + round-trip, if not
done after shader compilation is complete.
...any calculation that can be
done on the vertices and then just interpolated among fragments (via varyings) is a performance boon.
... (the interpolation of varyings is very cheap, and is
done automatically for you through the fixed functionality rasterization phase of the graphics pipeline) for example, a simple animation of a textured surface can be achieved through a time-dependent transformation of texture coordinates.
...when you're
done with the contents of a framebuffer attachment, use invalidateframebuffer to discard the data, instead of leaving the driver to waste time storing the data for later use.
WebGL model view projection - Web APIs
the more operations that are
done on larger numbers, the more and more errors accumulate into the result.
... once that's been
done, we have the largest set of polygons which are entirely within the viewing frustum.
...in short, it combines dividing by w (as
done with the previous examples) with some ingenious manipulations based on similar triangles.
... model space → model matrix → world space the camera hasn't
done anything yet, and the points need to be moved again.
Taking still photos with WebRTC - Web APIs
video this will be a reference to the <video> element after the page is
done loading.
... canvas this will be a reference to the <canvas> element after the page is
done loading.
... photo this will be a reference to the <img> element after the page is
done loading.
...we'll get that after the page is
done loading.
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
keep in mind that most webgl and webxr programming is
done using third-party libraries which expand upon the basic functionality of webgl by adding routines that make it much easier to perform not only core matrix and other operations, but often also to simulate these standard cinematography techniques.
...there are differences between this and an optical zoom effect, but the result is generally close enough to get the job
done.
...this can be
done using the appropriate method in your matrix math library, such as the rotatex() method in glmatrix's mat4 class: mat4.rotatex(viewmatrix, viewmatrix, angle); positive values for angle will tilt the camera downward, while negative values of angle will tilt upward.
...in classic filmmaking, this is typically
done with the camera mounted on a track or on a moving vehicle.
Lighting a WebXR setting - Web APIs
this is
done using a technique known as lighting estimation.
...it can be
done, but is not as widely implemented.
...there are many ways this could be
done.
...this could be
done remotely, or it could be performed by an attacker who's located in the same room but wants to determine if the other person is also in the same room.
Rendering and the WebXR frame animation callback - Web APIs
this is
done by calling the xrsession method requestanimationframe().
...this is often (but not always)
done by drawing the image to a single screen and using lenses to transfer the correct half of that image to each eye.
...the first step is to obtain access to the framebuffer into which the webxr device wants the frame drawn; this is
done by getting the target webgl layer from the session's renderstate object's baselayer property, then getting the framebuffer from that xrwebgllayer object.
... optimizing by rendering in object-first order an advantage of webxr's approach of using a single webgl framebuffer to contain both the left and right eye's views in a single framebuffer makes it possible to substantially improve rendering performance by rearranging the order in which things are
done.
Window.pageYOffset - Web APIs
donec non laoreet massa.
...
donec pretium nisi et condimentum convallis.
...
donec imperdiet facilisis mi ut aliquam.
...once that's
done, the vertical scroll position is checked by looking at the value of pageyoffset in the frame's contentwindow.
XMLHttpRequest.readyState - Web APIs
4
done the operation is complete.
...
done the fetch operation is complete.
...instead of unsent, opened, headers_received, loading and
done, the names readystate_uninitialized (0), readystate_loading (1), readystate_loaded (2), readystate_interactive (3) and readystate_complete (4) are used.
... example var xhr = new xmlhttprequest(); console.log('unsent', xhr.readystate); // readystate will be 0 xhr.open('get', '/api', true); console.log('opened', xhr.readystate); // readystate will be 1 xhr.onprogress = function () { console.log('loading', xhr.readystate); // readystate will be 3 }; xhr.onload = function () { console.log('
done', xhr.readystate); // readystate will be 4 }; xhr.send(null); specifications specification status comment xmlhttprequest living standard whatwg living standard ...
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
this is so commonly
done, that no one even bothers to support the msaa caret, after all the hack is general solution works with pretty much all applications.
...this information may be in the form of extensions to msaa, like mozilla has
done with isimpledomnode (you can qi to it from iaccessible).
...again, if it's not
done exactly this way, some links will not be read.
...these platform-specific classes inherit from cross-platform classes, where the most of the implementation is
done.
Creating a cross-browser video player - Developer guides
this is
done by simply checking if a created <video> element supports the canplaytype() method, which any supported html5 <video> element should.
...deocontainer'); var video = document.getelementbyid('video'); var videocontrols = document.getelementbyid('video-controls'); as mentioned earlier, the browser's default controls now need to be disabled, and the custom controls need to be displayed: // hide the default controls video.controls = false; // display the user defined video controls videocontrols.style.display = 'block'; with that
done, a variable pointing to each of the buttons is now required: var playpause = document.getelementbyid('playpause'); var stop = document.getelementbyid('stop'); var mute = document.getelementbyid('mute'); var volinc = document.getelementbyid('volinc'); var voldec = document.getelementbyid('voldec'); var progress = document.getelementbyid('progress'); var progressbar = document.getelementbyid('prog...
...it also needs to have a maximum value set so that it can display its range correctly, and this can be
done via the max attribute, which needs to be set to the maximum playing time of the video.
...so something else needs to be
done.
Constraint validation - Developer guides
therefore, like with html4, you need to also validate input constraints on the server side, in a way that is consistent with what is
done on the client side.
... toolong constraint violation constraint validation process constraint validation is
done through the constraint validation api either on a single form element or at the form level, on the <form> element itself.
... the constraint validation is
done in the following ways: by a call to the checkvalidity() or reportvalidity() method of a form-associated dom interface, (htmlinputelement, htmlselectelement, htmlbuttonelement, htmloutputelement or htmltextareaelement), which evaluates the constraints only on this element, allowing a script to get this information.
...(this is typically
done by the user-agent when determining which of the css pseudo-classes, :valid or :invalid, applies.) in contrast, the reportvalidity() method reports any constraint failures to the user.
Introduction to HTML5 - Developer guides
declaring the character set with the <meta charset> the first thing
done on a page is usually indicating the character set that is used.
... in previous versions of html, it was
done using a very complex <meta> element.
...this was
done to tighten security and prevent some types of attacks.
...the web browsers' developers have
done everything for you!
HTTP Index - HTTP
browsers set adequate values for this header depending on the context where the request is
done: when fetching a css stylesheet a different value is set for the request than when fetching an image, video or a script.
...if the value sent is keep-alive, the connection is persistent and not closed, allowing for subsequent requests to the same server to be
done.
...such a request can be
done before deciding to download a large resource to save bandwidth, for example.
...designed with extensibility in mind, it has seen numerous additions over the years; this lead to its specification being scattered through numerous specification documents (in the midst of experimental aban
doned extensions).
yield* - JavaScript
the value of yield* expression itself is the value returned by that iterator when it's closed (i.e., when
done is true).
... function* g1() { yield 2; yield 3; yield 4; } function* g2() { yield 1; yield* g1(); yield 5; } const iterator = g2(); console.log(iterator.next()); // {value: 1,
done: false} console.log(iterator.next()); // {value: 2,
done: false} console.log(iterator.next()); // {value: 3,
done: false} console.log(iterator.next()); // {value: 4,
done: false} console.log(iterator.next()); // {value: 5,
done: false} console.log(iterator.next()); // {value: undefined,
done: true} other iterable objects besides generator objects, yield* can also yield other kinds of iterables (e.g., arrays, strings, or arguments objects).
... function* g3() { yield* [1, 2]; yield* '34'; yield* array.from(arguments); } const iterator = g3(5, 6); console.log(iterator.next()); // {value: 1,
done: false} console.log(iterator.next()); // {value: 2,
done: false} console.log(iterator.next()); // {value: "3",
done: false} console.log(iterator.next()); // {value: "4",
done: false} console.log(iterator.next()); // {value: 5,
done: false} console.log(iterator.next()); // {value: 6,
done: false} console.log(iterator.next()); // {value: undefined,
done: true} the value of yield* expression itself yield* is an expression, not a statement—so it evaluates to a value.
... function* g4() { yield* [1, 2, 3]; return 'foo'; } function* g5() { const g4returnvalue = yield* g4(); console.log(g4returnvalue) // 'foo' return g4returnvalue; } const iterator = g5(); console.log(iterator.next()); // {value: 1,
done: false} console.log(iterator.next()); // {value: 2,
done: false} console.log(iterator.next()); // {value: 3,
done: false}
done is false because g5 generator isn't finished, only g4 console.log(iterator.next()); // {value: 'foo',
done: true} specifications specification ecmascript (ecma-262)the definition of 'yield' in that specification.
Populating the page: how browsers work - Web Performance
dns lookups usually only need to be
done once per hostname for a page load.
... however, dns lookups must be
done for each unique hostname the requested page references.
...to ensure repainting can be
done even faster than the initial paint, the drawing to the screen is generally broken down into several layers.
... interactivity once the main thread is
done painting the page, you would think we would be "all set." that isn't necessarily the case.
Optimizing startup performance - Web Performance
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.
... any data processing that can be
done in parallel should be.
... porting issues once the initial loading is
done and the app's main code starts to run, it's possible your app may necessarily be single-threaded,especially if it's a port.
... the most important thing to do to try to help with the main code's 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.
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
often this is
done passing around strings.
...settimeout("alert('" + xhr.responsetext + "');", 100); // attacker manipulated responsetext to contain "attack!'); format_computer(); alert('
done" settimeout("alert('attack!'); format_computer(); alert('
done');", 100); as a general rule of thumb, just don't pass code around as strings and execute it by calling eval, settimeout and friends.
... try { myaddon.
doneaddtab(rv); } catch (ex) { /* might handle this */ } // return the original result return rv; }; })(); this is admittedly a bit more verbose, but at the same time it should be easier to understand.
XPCOM Objects - Archive of obsolete content
this is
done via the queryinterface method that is included in all xpcom components.
...this is
done for certain value types that are not valid as return values in idl, such as typed arrays.
... the add and delete calls to the category manager would have to be
done in the registerself and unregisterself methods: registerself : function(acompmgr, alocation, aloaderstr, atype) { let categorymanager = cc[@mozilla.org/categorymanager;1].getservice(ci.nsicategorymanager); acompmgr.queryinterface(ci.nsicomponentregistrar); acompmgr.registerfactorylocation( class_id, class_name, contract_id, alocation, aloaderstr, atype); categorymanager.addca...
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
(or firefox.cfg if for firefox...) file encoding if needed, the encoding can be
done with the perl script: moz-byteshift.pl available at http://www.alain.knaff.lu/howto/mozi...z-byteshift.pl.
... with (prefconfig) { // must be
done inside the prefconfig module // create some variables we might want to use later on...
...igure defaults from internal javascript file in ns executable // global prefs from netscape.cfg (this file) // executes ~/.netscape/preferences.js file // executes ~/.netscape/user.js // (somewhere in here liprefs.js is run, but i haven't yet figured out // what liprefs is for....) //========================================================================= with (prefconfig) { // must be
done inside the prefconfig module // create some variables we might want to use later on...
Bookmark Keywords - Archive of obsolete content
once that's
done, all it takes to go to the cnn home page would be to type <tt>cnn</tt> into the address bar.
... with that
done, all you have to do in the future is type <tt>bz</tt> followed by a space and the bug's number into mozilla's address bar, and the browser will jump right to the bug with that number.
...once that's been
done, making the keymark work is a simple matter of going into the bookmark manager and adding a keyword!
In-Depth - Archive of obsolete content
this is
done using the -moz-image-region style.
...adding an image to the right of a toolbar this tutorial is
done with mozilla 1.2 in mind.
...when it's all
done you should have something that looks like this: #navigation-toolbar > .toolbar-holder > .toolbar-primary-icon { background-image: url("chrome://navigator/skin/icons/dino.png"); } put the image in that directory, fire up mozilla, and take a look at your creation.
generateCRMFRequest() - Archive of obsolete content
crmfobject = crypto.generatecrmfrequest("requesteddn", "regtoken", "authenticator", "escrowauthoritycert", "crmf generation
done code", keysize1, "keyparams1", "keygenalg1", ..., keysizen, "keyparamsn", "keygenalgn"); this method will generate a sequence of crmf requests that has n requests.
... "crmf generation
done code" this parameter is javascript to execute when the crmf generation is complete.
...the javascript passed in as the "crmf generation
done code" parameter should look at the attribute request of the returned object to get the result of the crmf generation.
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
browser sniffing is usually
done through the useragent, such as: mozilla/5.0 (x11; u; linux i686; en-us; rv:1.5) gecko/20031016 while using the useragent to sniff the browser provides detailed information on the browser in use, code that handles useragents often can make mistakes when new browser versions arrive, thus requiring code changes.
...<div id="foo">loading...</div> <script> document.getelementbyid("foo").innerhtml = "
done."; </script> however, this is not guaranteed.
... to be sure that all elements exist, you should use the onload event handler on the <body> tag: <body onload="dofinish();"> <div id="foo">loading...</div> <script> function dofinish() { var element = document.getelementbyid("foo"); element.innerhtml = "
done."; } </script> ...
Frequently Asked Questions - Archive of obsolete content
this is
done by toggling a hidden user configuration preference (pref).
...tim is working on implementing <filter> and working on items that need to be
done before turning on svg by default.
...david continues to create svg enabled nightlies and answer build related questions as he has
done for some time.
Using gdb on wimpy computers - Archive of obsolete content
current language: auto; currently c (gdb) shar glib reading symbols from /usr/lib/libglib-1.2.so.0...
done.
...current language: auto; currently c (gdb) shar gtk reading symbols from /usr/lib/libgtk-1.2.so.0...
done.
... loaded symbols for /usr/lib/libgtk-1.2.so.0 reading symbols from /usr/lib/gtk/themes/engines/libthinice.so...
done.
Using XPInstall to Install Plugins - Archive of obsolete content
not all the work needs to be
done in javascript -- if you have a native installer (exe) that recognizes netscape gecko browsers, and you merely wish to wrap the exe installer in an xpi package for a streamlined delivery to the client, you can easily do so.
...this is
done via the created function, called function registerplid().
...this can be
done conditionally, since trigger scripts can also detect what software has already been installed to the user's machine via xpinstall.
Building accessible custom components in XUL - Archive of obsolete content
ue; settimeout(function(){ var textbox = document.createelementns(xul_ns, "textbox"); label.parentnode.replacechild(textbox, label); textbox.value = value; textbox.origvalue = value; textbox.flex = 1; textbox.focus(); textbox.select(); textbox.addeventlistener("blur", editable_cell_blur, true); textbox.addeventlistener("keypress", editable_cell_keypress, true); }, 0); } function
done_edit(textbox, keepvalue) { var value = textbox.value; var label = document.createelementns(xul_ns, "label"); label.setattributens(x2_ns, "role", "wairole:gridcell"); textbox.parentnode.replacechild(label, textbox); if (keepvalue) { label.value = value; } else { label.value = textbox.origvalue; } label.flex = 1; label.addeventlistener("keypress", cell_keypress...
..., true); return label; } function editable_cell_blur(e) { var textbox = e.target; settimeout(function() {
done_edit(textbox, true); }, 0); } function editable_cell_keypress(e) { var textbox = e.target; switch (e.keycode) { case key_enter: settimeout(function() { var label =
done_edit(textbox, true); label.focus(); }, 0); break; case key_escape: settimeout(function() { var label =
done_edit(textbox, false); label.focus(); }, 0); break; } } </code> with this new code, we can now navigate to a specific cell within the spreadsheet and press enter to edit the value.
...the
done_edit function recreates the original label element and sets the new value.
OpenClose - Archive of obsolete content
a menu may be closed by a script by setting the open property to false, the reverse of what would be
done to open the menu.
...if you need to perform uninitialization that would be
done during these events, this could be
done during an unload event.
...this can be
done by either placing alternate commands elsewhere in the user interface, or by providing a keyboard shortcut to open the menu.
Creating an Installer - Archive of obsolete content
here is an example: function
donefn ( name , result ){ alert("the package " + name + " was installed with a result of " + result); } var xpi = new object(); xpi["calendar"] = "calendar.xpi"; installtrigger.install(xpi,
donefn); first, we define a callback function
donefn() which will be called when the install is complete.
...the function
donefn() here just displays an alert box to the user.
... function
donefn ( name , result ){ if (result) alert("an error occured: " + result); } var xpi = new object(); xpi["find files"] = "findfile.xpi"; installtrigger.install(xpi,
donefn); the xpi archive note: if you want to create a new xulrunner application, extension, or theme, see bundles.
Document Object Model - Archive of obsolete content
sometimes, this is
done just to clarify the scope of the method you are referring to.
...if you haven't
done this, do that now, as shown below.
...in this case, the type conversion is
done for you so the property is more convenient.
More Wizards - Archive of obsolete content
for example, here are a set of wizard pages (the inner content has been omitted): <wizardpage pageid="type" next="font"> <wizardpage pageid="font" next="
done"> <wizardpage pageid="color" next="
done"> <wizardpage pageid="
done"> the wizard always starts at the first page, which in this case has the page id type.
... on the page with the page id font, we can see that the next page is
done, so that page will be displayed afterwards.
... the page with the page id
done has no next attribute, so this will be the last page.
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
although this design approach was aban
doned fairly quickly, the class name stuck, kind of like a barnacle.
... div.card {float: left; width: 45%; margin: 1em 2% 0 2%;} div.card img {float: left; border: 1px solid #339;} that
done, it was time to style the fish names.
...the cards are
done.
Implementation Status - Archive of obsolete content
278448; 338146; 4.2 initialization events supported 4.2.1 xforms-model-construct supported 4.2.2 xforms-model-construct-
done supported 4.2.3 xforms-ready supported 4.2.4 xforms-model-destruct supported 4.3.1 xforms-rebuild supported 4.3.2 xforms-recalculate supported 4.3.3 xforms-revalidate suppor...
... 4.4.15 xforms-select xforms-deselect supported 4.4.16 xforms-in-range supported 4.4.17 xforms-out-of-range supported 4.4.18 xforms-scroll-first xforms-scroll-last supported 4.4.19 xforms-submit-
done supported 4.5 error indications partial we don't support the xforms-version-exception event, yet 4.5.1 xforms-binding-exception supported 4.5.2 xforms-compute-exception supported 4.5.3 xforms-link-error partial no...
... 330557; 11.3 xforms-submit-serialize supported 11.4 xforms-submit-
done supported 11.5 xforms-submit-error supported 11.6.1 resource supported 11.7.1 method unsupported 11.8 header unsupported 11.8.1 name unsupported ...
Index - Game development
a testament to what can be
done with javascript, webgl, and related technologies.
...this can be
done using html — the phaser framework will generate the required <canvas> element.
...this can be
done using html and the <canvas> element.
Index - MDN Web Docs Glossary: Definitions of Web-related terms
sometimes, this task is also referred to as "assembling" or "build", which typically indiciates more than just compilation is
done, e.g.
... 122 dynamic programming language codingscripting, glossary a dynamic programming language is a programming language in which operations otherwise
done at compile-time can be
done at run-time.
...the transformation performed by one of the keys can only be un
done with the other key.
CSS and JavaScript accessibility best practices - Learn web development
sometimes you'll see a website where everything has been
done with javascript — the html has been generated by javascript, the css has been generated by javascript, etc.
...the firefox issue should be fixed soon — work is being
done to give firefox behaviour parity with other browsers (see bug 277178).
...this can be
done by tabbing over the image, because we've included tabindex="0" on it.
Accessible multimedia - Learn web development
multimedia and accessibility so far in this module we have looked at a variety of content and what needs to be
done to ensure its accessibility, ranging from simple text content to data tables, images, native controls such as form elements and buttons, and even more complex markup structures (with wai-aria attributes).
...if you pay a reputable company or ai service to do the transcription, you will probably get it
done rapidly and to a high quality.
... if you don't want to pay for it, you are likely to get it
done at a lower quality, and/or slowly.
Test your skills: Links - Learn web development
this is not strictly best practice, but we've
done it here so that the page doesn't open in the embedded <iframe>, getting rid of your example code in the process!
...this is not strictly best practice, but we've
done it here so that the pages don't open in the embedded <iframe>, getting rid of your example code in the process!
...this is not strictly best practice, but we've
done it here so that the pages don't open in the embedded <iframe>, getting rid of your example code in the process!
From object to iframe — other embedding technologies - Learn web development
note: in order to improve speed, it's a good idea to set the iframe's src attribute with javascript after the main content is
done with loading.
...this can prevent other websites from embedding your content in their web pages (which would enable clickjacking and a host of other attacks), which is exactly what the mdn developers have
done, as we saw earlier on.
...if you need interactivity, html and javascript can readily get the job
done for you with no need for java applets or outdated activex/bho technology.
Index - Learn web development
beginner, express, flask, learn, node, php, python, django, lamp, server-side, servers throughout most of the learning area, we tell you to just open your examples directly in a browser — this can be
done by double clicking the html file, dragging and dropping it into the browser window, or choosing file > open...
... 296 styling vue components with css beginner, css, frameworks, javascript, learn, styling, client-side, vue our work is
done on the styling of our sample app.
...however, they will give you good insight into what can and can't be
done, which will help you learn how to do things.
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
it is easier to create this example without using a date() object, like we've
done in our version, but less accurate — you can't guarantee that the callback will fire after exactly 1000ms.
...(you can see the source code, also.) clearing a requestanimationframe() call clearing a requestanimationframe() call can be
done by calling the corresponding cancelanimationframe() method.
... that's it—you're all
done!
Making decisions in your code — conditionals - Learn web development
if you help me by going and doing the shopping, i'll give you some extra allowance so you can afford that toy you wanted." in javascript, we could represent this like so: let shopping
done = false; if (shopping
done === true) { let childsallowance = 10; } else { let childsallowance = 5; } this code as shown always results in the shopping
done variable returning false, meaning disappointment for our poor child.
... it'd be up to us to provide a mechanism for the parent to set the shopping
done variable to true if the child did the shopping.
...cheese available for making cheese on toast.'); } else { console.log('no cheese on toast for you today.'); } and, returning to our previous example about the child doing a chore for their parent, you could write it like this: let shopping
done = false; if (shopping
done) { // don't need to explicitly specify '=== true' let childsallowance = 10; } else { let childsallowance = 5; } nesting if ...
Manipulating documents - Learn web development
this is usually
done by using the document object model (dom), a set of apis for controlling html and styling information that makes heavy use of the document object.
...this is
done with the htmlelement.style property, which contains inline styling information for each element in the document.
... at this point, we haven't really
done anything useful!
Basic math in JavaScript — numbers and operators - Learn web development
operator precedence in javascript is the same as is taught in math classes in school — multiply and divide are always
done first, then add and subtract (the calculation is always evaluated from left to right).
...this can be conveniently
done using the increment (++) and decrement (--) operators.
...we've actually provided a simple example showing how this is
done — check it out live, and look at the source code to see if you can spot the incrementors!
Inheritance in JavaScript - Learn web development
as a note, we could have simply
done this: function teacher(first, last, age, gender, interests, subject) { this.name = { first, last }; this.age = age; this.gender = gender; this.interests = interests; this.subject = subject; } but this is just redefining the properties anew, not inheriting them from person(), so it defeats the point of what we are trying to do.
...in this section we'll convert the person and teacher examples from prototypal inheritance to classes, to show you how it's
done.
...so for teacher, the this initialization is
done by the person constructor.
Ember app structure and componentization - Learn web development
to start with, delete the contents of application.hbs and replace them with the following: <section class="todoapp"> <h1>todos</h1> <input class="new-todo" aria-label="what needs to be
done?" placeholder="what needs to be
done?" autofocus > </section> note: aria-label provides a label for assistive technology to make use of — for example, for a screenreader to read out.
...update the application.hbs file again so its content looks like this: <section class="todoapp"> <h1>todos</h1> <input class="new-todo" aria-label="what needs to be
done?" placeholder="what needs to be
done?" autofocus > <section class="main"> <input id="mark-all-complete" class="toggle-all" type="checkbox"> <label for="mark-all-complete">mark all as complete</label> <ul class="todo-list"> <li> <div class="view"> <input aria-label="toggle the completion of this todo" class="toggle" ...
... the header.hbs file should be updated to contain the following: <input class="new-todo" aria-label="what needs to be
done?" placeholder="what needs to be
done?" autofocus > todo-list.hbs should be updated to contain this chunk of code: <section class="main"> <input id="mark-all-complete" class="toggle-all" type="checkbox"> <label for="mark-all-complete">mark all as complete</label> <ul class="todo-list"> <todo /> <todo /> </ul> </section> note: the only non-html in this new todo-l...
Componentizing our React app - Learn web development
once you’re
done, the todo component's <input /> element will read like this: <input id="todo-0" type="checkbox" defaultchecked={props.completed} /> and your browser should update to show only eat being checked: if you change each <todo /> component’s completed prop, your browser will check or uncheck the equivalent rendered checkboxes accordingly.
... your form.js file should read like this: import react from "react"; function form(props) { return ( <form> <h2 classname="label-wrapper"> <label htmlfor="new-todo-input" classname="label__lg"> what needs to be
done?
...when you’re
done, app.js will read like this: import react from "react"; import form from "./components/form"; import filterbutton from "./components/filterbutton"; import todo from "./components/todo"; function app(props) { const tasklist = props.tasks.map(task => ( <todo id={task.id} name={task.name} completed={task.completed} key={task.id} /> ) ); return ( ...
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
code along with us git clone the github repo (if you haven't already
done it) with: git clone https://github.com/opensas/mdn-svelte-tutorial.git then to get to the current app state, run cd mdn-svelte-tutorial/05-advanced-concepts or directly download the folder's content: npx degit opensas/mdn-svelte-tutorial/05-advanced-concepts remember to run npm install && npm run dev to start your app in development mode.
...eateeventdispatcher } from 'svelte' const dispatch = createeventdispatcher() let name = '' const addtodo = () => { dispatch('addtodo', name) name = '' } const oncancel = () => name = '' </script> <form on:submit|preventdefault={addtodo} on:keydown={e => e.key === 'escape' && oncancel()}> <h2 class="label-wrapper"> <label for="todo-0" class="label__lg">what needs to be
done?</label> </h2> <input bind:value={name} type="text" id="todo-0" autocomplete="off" class="input input__lg" /> <button type="submit" disabled={!name} class="btn btn__primary btn__lg">add</button> </form> here we are binding the <input> to the name variable with bind:value={name} and disabling the add button when it is empty (i.e.
...h('addtodo', name) name = '' nameel.focus() // give focus to the name input } const oncancel = () => { name = '' nameel.focus() // give focus to the name input } </script> <form on:submit|preventdefault={addtodo} on:keydown={e => e.key === 'escape' && oncancel()}> <h2 class="label-wrapper"> <label for="todo-0" class="label__lg">what needs to be
done?</label> </h2> <input bind:value={name} bind:this={nameel} type="text" id="todo-0" autocomplete="off" class="input input__lg" /> <button type="submit" disabled={!name} class="btn btn__primary btn__lg">add</button> </form> try the app out — type a new todo name in to the <input> field, press tab to give focus to the add button, and then hit enter or escape to see how the input recovers fo...
Command line crash course - Learn web development
omitting the leading slash like we’ve
done above makes the path relative to the your present working directory.
...this is
done by typing the man command, followed by the name of the command you want to look up, for example man ls.
...note that this delete is permanent and can’t be un
done via the recycle bin that you might have on your desktop user interface.
Adding a new CSS property
(which set the property is in is given in the specification, which says "inherited: yes" or "inherited: no" in the property's definition.) also note that some of the style structs intentionally contain only properties set/reset by a particular common shorthand property; this improves the effectiveness of some of the performance and memory optimizations
done with the rule tree, and thus we should avoid adding a property not reset by that shorthand to such a struct.
... if you've
done everything right, they should pass; if they don't, you need to fix something.
... then you should get review on the work you've
done so far and move on to implementing whatever the property does (which should be in a separate patch or patches).
Creating a Language Pack
configure step you need to prepare the build directory, which is
done with ./mach configure you only need to run this if the version number of firefox changes.
...
done unpacking let's check which revision the binary was built from.
... mv -f "../../dist/l10n-stage/firefox-3.6b5pre.x-testing.mac.dmg" "../../dist/firefox-3.6b5pre.x-testing.mac.dmg" repackaging
done now go to the dist directory to find your repackaged binary ready to be installed!
Multiple Firefox profiles
this action cannot be un
done.
... once you are all
done, click ok.
...once
done, each one should automatically start with the specified profile.
Overview of Mozilla embedding APIs
all heap access should be
done via the nsmemory service.
...as such, access to individual document frames is
done via the domwindow interfaces.
... manipulation of the entire document structure is
done via the various webbrowser interfaces.
Roll your own browser: An embedding how-to
like that isn't totally obvious, nonetheless it has to be
done.
... after the build is
done, you can change directory into mozilla/embedding/config, and do a make.
... other initialization must be
done to start up event queues and load some string bundles.
JavaScript-DOM Prototypes in Mozilla
this registration is
done with the nsscriptnamespacemanager, which is in charge of keeping track of what names are registered in the global namespace, and what kinds of names those names are (i.e.
... once the registration is
done, the nsdomclassinfo code uses the registry every time a named property is resolved on a global object (because of this, the nsscriptnamespacemanager needs to be pretty fast at looking things up in its registry; that's why it is a hash table).
...this is also
done only once per class, nsdomclassinfo::postcreate() checks if the prototype of the prototype of the wrapper jsobject (i.e.
Following the Android Toasts Tutorial from a JNI Perspective
the java code example above can be
done with privileged javascript from firefox for android with the following code: window.nativewindow.toast.show("hello, firefox!", "short"); converting java to jni.jsm the first step is to look at the java code and see all the different types, methods, constructors, and fields that are being used.
... boolean z byte b char c class/object lclass name in slash notation here; double d float f int i long j short s void v array of type [sig here method format (sig of type of each argument here)sig of the return type here declaring a class/object is
done in a special way.
...to load the class the following is
done: let toast = jni.loadclass(my_jenv, sig.toast.substr(1, sig.toast.length - 2), { // declares of constructors, static_methods, methods, fields, and static_fields go here }); the variable name of toast was used, but it does not matter, you can use whatever you want.
Sqlite.jsm
you don't need to worry about caching created statement instances, destroying them when you are
done, etc.
...this must be called on every opened connection or else application shutdown will fail due to waiting on the opened connection to close (gecko doesn't force close connections because it doesn't know that you are really
done with them).
... const conn = await sqlite.openconnection({path: "mydb.sqlite"}); const result = await conn.execute("select 1"); await conn.close(); alert("we are
done!"); this isn't a terrific example because it doesn't include error handling.
Localizing with Mercurial
to get write access to the l10n hg repositories on the mozilla server, there's a bit of paper work to be
done.
...write access to the hg repositories requires a ''voucher'', which, for the owner, will be
done based on the review by mozilla.
...you're
done!
What every Mozilla translator should know
we have the main repository called mozilla-central (or trunk) where the day to day developing work is
done.
...all the content of the trunk is copied to this new branch so that the developing work is
done in two (or more) parallel places: the generic trunk and the version oriented branch(es).
...once you have made some changes in mercurial, as soon as the next build is
done you can check the tinderbox and see if something was wrong.
DMD
on a build
done by the try server, follow these instructions instead.
...assuming you have
done a local build, the app identifier will be org.mozilla.fennec_$username ($username is your username on the host machine) and so we do this as shown below.
...the decision on whether to record is
done probabilistically, and larger blocks are more likely to have an allocation stack trace recorded.
Gecko Profiler FAQ
i think julian seward has
done some measurements on this, i think.
...i want to profile all threads, not just main plus a couple of others) we haven’t
done any measurements of how frequent sampling distorts measurement or operation.
...as soon as startup is
done, collect a profile.
NSS API Guidelines
these guidelines will familiarize you with some of the ways things can be
done in the nss code.
... errors, though not integers, are
done as external constants, instead of preprocessor definitions.
... search functions there are several different kinds of searches
done via the security library.
sslfnc.html
it can use multiple threads, and thereby make use of multiple processors, but this must all be
done from a single process.
... if a socket that is already connected gets imported into ssl after it has been connected (that is, after pr_accept or pr_connect has returned), then no implicit ssl handshake configuration as a client or server will have been
done by pr_connect or pr_accept on that socket.
...if ssl_resethandshake is not called to explicitly configure the socket handshake, a crash is likely to occur when the first i/o operation is
done on the socket after it is imported into ssl.
Hacking Tips
this can be
done with the reduce.py script in https://github.com/haytjes/tracelogger/tree/master/tools_v2.
...these tools will show the mir & lir steps
done by ionmonkey during the compilation.
...or if this is an intermittent, run it in a loop capturing an rr log for every one until it fails: n=1; while rr ...same.as.above...; do echo passed $n; n=$(( $n + 1 ));
done wait until it hits a failure.
Garbage collection
this allows compartments to be used for security checks: objects in the same compartment have the same access requirements, so no checks are needed, but checks may be
done when traversing cross-compartment wrappers.
... b will not be marked, because b is only reachable through a and we are all
done with a, because a is black.
...this is easily
done by simply marking new objects immediately upon allocation during an incremental gc, thus the name allocate-black.
Handling Mozilla Security Bugs
nomination is
done by the "voucher" sending e-mail to the security bug group private mailing list.
...the goals of this warning are: to inform mozilla users and testers of potential security risks in the versions they are using, and what can be
done to mitigate those risks.
...disclosure is
done by clearing the bug's "security-sensitive" flag, after which the bug will revert to being an ordinary bug.
Feed content access API
loading the feed and sending it to the parser is
done using code similar to this: fetch: function(feedurl) { var httprequest = null; function inforeceived() { var data = httprequest.responsetext; var ioservice = components.classes['@mozilla.org/network/io-service;1'] .getservice(components.interfaces.nsiioservice); var uri = ioservice.newuri(feedurl, null, null); if (dat...
...the actual processing of the parsed feed is
done by a method called handleresult() on the feedtestresultlistener object.
... + '</a></b><br>'); if (theentry.summary) { info = theentry.summary.text + "<p><hr><p>"; } else { info = theentry.content.text + "<p><hr><p>"; } doc.write("<blockquote>" + info); doc.write("</blockquote><p>"); } } } // close the document; we're
done!
Avoiding leaks in JavaScript XPCOM components
the most common way this is
done in javascript is on implementations of observer interfaces like nsiobserver in javascript.
...function function_array() { // once this function is
done running, this variable is still // accessible to the functions created here.
...the workaround is simple: we have a destroy method on browser that tabbrowser can call when it's
done with a browser.
Introduction to XPCOM for the DOM
this is
done using the "release" function, also defined in the nsisupports interface.
...in the first case, if we forget to addref the object, the object may delete itself before we are
done using the pointer, which would cause a crash when dereferencing it.
...this is a contract between the caller, who says "i don't add a reference to this object because you have already
done it", and the callee who says "i add a reference to this object, so don't do it!".
Observer Notifications
if your component requires access to the user profile, or any services which require access to the profile (preferences, bookmarks, and so on) then a common pattern is to register with the nsicategorymanager for the app-startup topic which can be
done in the component's registration code, and then in that notification register with the observer service for the profile-after-change notification.
... topic description download-manager-ui-
done called when the list of downloads in the download manager windows finishes updating.
... places-maintenance-finished sent when maintenance of the places database is complete; this is
done periodically in the background to keep the places database tidy.
imgIContainer
2 aheight, in imgicontainerobserver aobserver); obsolete since gecko 2.0 void lockimage(); void removeframe(in gfxiimageframe item); obsolete since gecko 1.9.2 void requestdecode(); void requestdiscard(); void requestrefresh([const] in timestamp atime); violates the xpcom interface guidelines void resetanimation(); void restoredata
done(); native code only!
...exceptions thrown missing exception missing description native code only!restoredata
done obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete.
...void restoredata
done(); parameters none.
nsIMacDockSupport
this can be
done like this: var docksupport = cc['@mozilla.org/widget/macdocksupport;1'].getservice(ci.nsimacdocksupport); console.log('docksupport:', docksupport); var win = services.wm.getmostrecentwindow('navigator:browser'); var macmenu = win.document.createelementns('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'menupopup'); macmenu.setattribute('id', 'mymacmenu'); var macmenuitem = win.d...
...notice the activateapplication(true), if this is not
done then firefox will not be activated.
...this can be
done by adding a event listenr for load of the hidden window.
nsITraceableChannel
holds chunks as they come, onstoprequest we join these junks to get the full source this.responsebody; // we'll set this to the this.responsestatuscode; this.deferred
done = { promise: null, resolve: null, reject: null }; this.deferred
done.promise = new promise(function(resolve, reject) { this.resolve = resolve; this.reject = reject; }.bind(this.deferred
done)); object.freeze(this.deferred
done); this.promise
done = this.deferred
done.promise; } tracinglistener.prototype = { ondataavailable: function(arequest, acontext, ainputstream, aoffset, acount) { ...
...offset, acount); }, onstartrequest: function(arequest, acontext) { this.originallistener.onstartrequest(arequest, acontext); }, onstoprequest: function(arequest, acontext, astatuscode) { this.responsebody = this.receivedchunks.join(""); delete this.receivedchunks; this.responsestatus = astatuscode; this.originallistener.onstoprequest(arequest, acontext, astatuscode); this.deferred
done.resolve(); }, queryinterface: function(aiid) { if (aiid.equals(ci.nsistreamlistener) || aiid.equals(ci.nsisupports)) { return this; } throw cr.ns_nointerface; } }; var httpresponseobserver = { observe: function(asubject, atopic, adata) { var newlistener = new tracinglistener(); asubject.queryinterface(ci.nsitraceablechannel); newlistener.originallistener = asubject.setnewliste...
...ner(newlistener); /////// end - do not edit newlistener.promise
done.then( function() { // no error happened console.log('yay response
done:', newlistener.responsebody); }, function(areason) { // promise was rejected, right now i didnt set up rejection, but i should listen to on abort or bade status code then reject maybe } ).catch( function(acatch) { console.error('something went wrong, a typo by dev probably:', acatch); } ); } }; services.obs.addobserver(httpresponseobserver, 'http-on-examine-response', false); // services.obs.removeobserver(httpresponseobserver, 'http-on-examine-response'); // call this when you dont want to listen anymore ...
xptcall FAQ
this is
done by providing a vtbl full of generic function stubs in xptcall.
... neither of these two facilities can be
done in a fully cross platform way.
... nor can they generally be
done fully in c or c++.
Working with data
to make a non-null terminated string this is how it is
done: var cstr_notnullterminated = ctypes.jschar.array()('rawr'.split('')); // this is the same as doing: `ctypes.jschar.array()(['r', 'a', 'w', 'r'])` console.log(cstr_notnullterminated); // outputs to browser console: `cdata { length: 4 }` console.log(cstr_notnullterminated.tostring()); // outputs to browser console: `"ctypes.char16_t.array(5)(["r", "a", "w", "r"])"` this method is just making an...
... for example, adding two 64-bit integers can be
done like this.
...once the math is
done, the two values are joined back together.
Streams - Plugins
it can have one of these values: npres_
done (most common): normal completion; all data was sent to the instance.
...the reason parameter represents the reason the stream was stopped, as follows: npres_
done (most common): the stream completed normally; the plug-in sent all data to the browser.
...*/ err = npn_destroystream(instance, stream, npres_
done); your plug-in can create another instance of itself by specifying its own mime type and a new target name in a call to npn_newstream.
Constraint validation API - Web APIs
this can be
done using the constraint validation api.
...therefore, you need to also validate input values on the server side, in a way that is consistent with what is
done on the client side.
... validation of constraints through the constraint validation api is
done either on a single form element or at the form level, on the <form> element itself.
Element.classList - Web APIs
{value: [nextindex, that[nextindex++]],
done: false} : {
done: true}; }}; }; if (!domtokenlistproto.values) domtokenlistproto.values = function(){ var nextindex = 0, that = this; return {next: function() { return nextindex<that.length ?
... {value: that[nextindex++],
done: false} : {
done: true}; }}; }; if (!domtokenlistproto.keys) domtokenlistproto.keys = function(){ var nextindex = 0, that = this; return {next: function() { return nextindex<that.length ?
... {value: nextindex++,
done: false} : {
done: true}; }}; }; })(window.domtokenlist.prototype, window.document.createelement("div").classlist); })(window); caveats the polyfill is limited in functionality.
FileReader.readyState - Web APIs
2
done the operation is complete.
...
done the read operation is complete.
... example var reader = new filereader(); console.log('empty', reader.readystate); // readystate will be 0 reader.readastext(blob); console.log('loading', reader.readystate); // readystate will be 1 reader.onloadend = function () { console.log('
done', reader.readystate); // readystate will be 2 }; value a number which is one of the three possible state constants define for the filereader api.
PaymentRequest.show() - Web APIs
note: in reality, despite the fact that the specification says this can't be
done, some browsers, including firefox, support multiple active payment requests at a time.
... processing the result and, if necessary, calling paymentresponse.retry() to retry a failed payment can all be
done either asynchronously or synchronously, depending on your needs.
... instead of immediately failing, you could choose to call retry() on the response object to ask the user agent to try to process the payment again; this should usually only be
done after the user has made any needed corrections to the order.
PerformanceNavigation - Web APIs
the legacy performancenavigation interface represents information about how the navigation to the current document was
done.
... performancenavigation.type read only an unsigned short which indicates how the navigation to this page was
done.
... performancenavigation.redirectcount read only an unsigned short representing the number of redirects
done before reaching the page.
Using Pointer Events - Web APIs
this is
done by looking at each touch's pointerevent.pointerid property.
...evt); var idx = ongoingtouchindexbyid(evt.pointerid); if (idx >= 0) { ctx.linewidth = 4; ctx.fillstyle = color; ctx.beginpath(); ctx.moveto(ongoingtouches[idx].pagex, ongoingtouches[idx].pagey); ctx.lineto(evt.clientx, evt.clienty); ctx.fillrect(evt.clientx - 4, evt.clienty - 4, 8, 8); // and a square at the end ongoingtouches.splice(idx, 1); // remove it; we're
done } else { log("can't figure out which touch to end"); } } this is very similar to the previous function; the only real differences are that we draw a small square to mark the end and that when we call array.splice(), we simply remove the old entry from the ongoing touch list, without adding in the updated information.
... function handlecancel(evt) { log("pointercancel: id = " + evt.pointerid); var idx = ongoingtouchindexbyid(evt.pointerid); ongoingtouches.splice(idx, 1); // remove it; we're
done } since the idea is to immediately abort the touch, we simply remove it from the ongoing touch list without drawing a final line segment.
ReadableStream.getReader() - Web APIs
function fetchstream() { const reader = stream.getreader(); let charsreceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processtext({
done, value }) { // result objects contain two properties: //
done - true if the stream has already given you all its data.
...always undefined when
done is true.
... if (
done) { console.log("stream complete"); para.textcontent = value; return; } // value for fetch streams is a uint8array charsreceived += value.length; const chunk = value; let listitem = document.createelement('li'); listitem.textcontent = 'received ' + charsreceived + ' characters so far.
ReadableStream.tee() - Web APIs
function teestream() { const teedoff = stream.tee(); fetchstream(teedoff[0], list2); fetchstream(teedoff[1], list3); } function fetchstream(stream, list) { const reader = stream.getreader(); let charsreceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processtext({
done, value }) { // result objects contain two properties: //
done - true if the stream has already given you all its data.
...always undefined when
done is true.
... if (
done) { console.log("stream complete"); return; } // value for fetch streams is a uint8array charsreceived += value.length; const chunk = value; let listitem = document.createelement('li'); listitem.textcontent = 'read ' + charsreceived + ' characters so far.
ReadableStreamDefaultReader.ReadableStreamDefaultReader() - Web APIs
function fetchstream() { const reader = stream.getreader(); let charsreceived = 0; // read() returns a promise that resolves // when a value has been received reader.read().then(function processtext({
done, value }) { // result objects contain two properties: //
done - true if the stream has already given you all its data.
...always undefined when
done is true.
... if (
done) { console.log("stream complete"); para.textcontent = result; return; } // value for fetch streams is a uint8array charsreceived += value.length; const chunk = value; let listitem = document.createelement('li'); listitem.textcontent = 'received ' + charsreceived + ' characters so far.
Using the Screen Capture API - Web APIs
this is
done for security reasons, as the content that cannot be seen by the user may contain data which they do not want to share.
...once that's
done, srcobject is set to null to make sure it's understood by anyone interested that there's no stream connected.
...this can be
done using the feature-policy http header or—if you're using the screen capture api in an <iframe>, the <iframe> element's allow attribute.
Using Service Workers - Web APIs
if you just passed in the url, and then tried to access the other items in the json separately when the for() loop is being iterated through later on, it wouldn’t work, as the promise wouldn’t resolve at the same time as the iterations are being
done (that is a synchronous process.) we actually resolve the promise with an array, as we want to make the loaded image blob available to the resolving function later on in the code, but also the image name, credits and alt text (see app.js lines 31-34).
...this is easily
done with the fetch event.
...the matching is
done via url and vary headers, just like with normal http requests.
Touch events - Web APIs
this is
done by looking at each touch's touch.identifier property.
...hes[i].identifier); if (idx >= 0) { ctx.linewidth = 4; ctx.fillstyle = color; ctx.beginpath(); ctx.moveto(ongoingtouches[idx].pagex, ongoingtouches[idx].pagey); ctx.lineto(touches[i].pagex, touches[i].pagey); ctx.fillrect(touches[i].pagex - 4, touches[i].pagey - 4, 8, 8); // and a square at the end ongoingtouches.splice(idx, 1); // remove it; we're
done } else { console.log("can't figure out which touch to end"); } } } this is very similar to the previous function; the only real differences are that we draw a small square to mark the end and that when we call array.splice(), we simply remove the old entry from the ongoing touch list, without adding in the updated information.
... function handlecancel(evt) { evt.preventdefault(); console.log("touchcancel."); var touches = evt.changedtouches; for (var i = 0; i < touches.length; i++) { var idx = ongoingtouchindexbyid(touches[i].identifier); ongoingtouches.splice(idx, 1); // remove it; we're
done } } since the idea is to immediately abort the touch, we simply remove it from the ongoing touch list without drawing a final line segment.
WebGLRenderingContext - Web APIs
this is also
done in other graphics {̣{glossary("api")}}, such as the canvas 2d rendering context.
...this is
done by assigning the width and height properties of the canvas to the values of the clientwidth and clientheight properties, respectively.
... in contrast, no such assignment is
done for the second canvas.
Signaling and video calling - Web APIs
this can be
done in a number of ways; what's demonstrated here is just one possible way to structure signaling messages.
...this is
done in hopes of identifying even better options than the one initially selected.
...in practice, this is rarely if ever necessary, since most of that work is
done for you by getusermedia().
Movement, orientation, and motion: A WebXR example - Web APIs
this is
done by the onxrbuttonclick() event handler.
...in either case, the label of the button is updated to indicate that a click will start a session, and then, if there is a pending request for an animation frame, we cancel it by calling cancelanimationframe once that's
done, the value of xrsession is changed to null to indicate that we're
done with the session.
... there are few limitations on what can be
done if you set yourself to it.
Starting up and shutting down a WebXR session - Web APIs
this is
done using the xrsession method updaterenderstate() to set the render state's baselayer to a newly-created xrwebgllayer encapsulating the webgl context.
... shutting down the session to cleanly shut down the webxr session when you're
done with it, you should call the session's end() method.
... if you have work that must be
done when the session ends, such as releasing resources and the like, you should do that work in your end event handler rather than in your main code body.
Background audio processing using AudioWorklet - Web APIs
it also handles creating the audio context if it hasn't already been
done.
...once that's
done, it instantiates and returns a new audioworkletnode.
...this is
done by adding the static getter parameterdescriptors to your class.
Using Web Workers - Web APIs
this is
done synchronously; importscripts() does not return until all the scripts have been loaded and executed.
...with a dedicated worker, but with a different constructor name (see index.html and index2.html) — each one has to spin up the worker using code like the following: var myworker = new sharedworker('worker.js'); one big difference is that with a shared worker you have to communicate via a port object — an explicit port is opened that the scripts can use to communicate with the worker (this is
done implicitly in the case of dedicated workers).
... audio worklet provide the ability for direct scripted audio processing to be
done in a worklet (a lightweight version of worker) context.
::before (:before) - CSS: Cascading Style Sheets
html <ul> <li>buy milk</li> <li>take the dog for a walk</li> <li>exercise</li> <li>write code</li> <li>play music</li> <li>relax</li> </ul> css li { list-style-type: none; position: relative; margin: 2px; padding: 0.5em 0.5em 0.5em 2em; background: lightgrey; font-family: sans-serif; } li.
done { background: #ccff99; } li.
done::before { content: ''; position: absolute; border-color: #009933; border-style: solid; border-width: 0 0.3em 0.25em 0; height: 1em; top: 1.3em; left: 0.6em; margin-top: -1em; transform: rotate(45deg); width: 0.5em; } javascript var list = document.queryselector('ul'); list.addeventlistener('click', function(ev) { if (ev.target.tagname ...
...=== 'li') { ev.target.classlist.toggle('
done'); } }, false); here is the above code example running live.
...go ahead and get some stuff
done.
Using CSS animations - CSS: Cascading Style Sheets
this does not configure the actual appearance of the animation, which is
done using the @keyframes at-rule as described in defining the animation sequence using keyframes below.
...this is
done by establishing two or more keyframes using the @keyframes at-rule.
... the output, when all is said and
done, looks something like this: started: elapsed time is 0 new loop started at time 3.01200008392334 new loop started at time 6.00600004196167 ended: elapsed time is 9.234000205993652 note that the times are very close to, but not exactly, those expected given the timing established when the animation was configured.
Variable fonts guide - CSS: Cascading Style Sheets
this is sometimes
done to reduce the overall file size in cases where the italics aren't needed or used.
... while this was originally
done to compensate for the ink and paper printing process (very thin lines at small sizes often didn’t print, giving the letterforms a broken appearance), it translates well to digital displays when compensating for screen quality and physical size rendering.
...the practice of designing different grades of a typeface was often
done in reaction to intended use and printing technique.
Adding captions and subtitles to HTML5 video - Developer guides
the creation of each list item and button is
done by the createmenuitem() function, which is defined as follows: var subtitlemenubuttons = []; var createmenuitem = function(id, lang, label) { var listitem = document.createelement('li'); var button = listitem.appendchild(document.createelement('button')); button.setattribute('id', id); button.classname = 'subtitles-button'; if (lang.length > 0) button.setattribute('lang', lang); ...
...this is
done by simply setting the required subtlte's mode attribute to showing, and setting the others to hidden.
...this can easily be
done by adding an .htaccess file to an appropriate directory that contains addtype text/vtt .vtt.
Content negotiation - HTTP
they failed to get traction and got aban
doned.
... with utf-8 now being well-supported, being the preferred way of encoding characters, and to guarantee better privacy through less configuration-based entropy, browsers omit the accept-charset header: internet explorer 8, safari 5, opera 11, firefox 10 and chrome 27 have aban
doned this header.
...sending of the headers must be
done on every request.
PI Parameters - XSLT: Extensible Stylesheet Language Transformations
<?xslt-param name="color" value="blue"?> <?xslt-param name="size" select="2"?> <?xml-stylesheet type="text/xsl" href="style.xsl"?> note that these pis have no effect when transformation is
done using the xsltprocessor object in javascript.
...no syntax checking is
done on the attribute, however if it is not a valid ncname it will never match any parameter in the stylesheet.
...no syntax checking is
done on the attribute.
lang/functional - Archive of obsolete content
let { defer } = require("sdk/lang/functional"); let fn = defer(function myevent (event, value) { console.log(event + " : " + value); }); fn("click", "#home"); console.log("
done"); // this will print '
done' before 'click : #home' since // we deferred the execution of the wrapped `myevent` // function, making it non-blocking and executing on the // next event loop parameters fn : function the function to be deferred.
... let { partial } = require("sdk/lang/functional"); let add = function add (x, y) { return x + y; } let ad
done = partial(add, 1); ad
done(5); // 6 ad
done(10); // 11 partial(add, ad
done(20))(2); // 23 parameters fn : function function on which partial application is to be performed.
test/utils - Archive of obsolete content
let { before, after } = require('sdk/test/utils'); let { search } = require('sdk/places/bookmarks'); exports.testcountbookmarks = function (assert,
done) { search().on('end', function (results) { assert.equal(results, 0, 'should be no bookmarks');
done(); }); }; before(exports, function (name, assert) { removeallbookmarks(); }); require('sdk/test').run(exports); both before and after may be asynchronous.
... to make them asynchronous, pass a third argument
done, which is a function to call when you have finished: let { before, after } = require('sdk/test/utils'); let { search } = require('sdk/places/bookmarks'); exports.testcountbookmarks = function (assert,
done) { search().on('end', function (results) { assert.equal(results, 0, 'should be no bookmarks');
done(); }); }; before(exports, function (name, assert,
done) { removeallbookmarksasync(function () {
done(); }); }); require('sdk/test').run(exports); globals functions before(exports, beforefn) runs beforefn before each test in the file.
console - Archive of obsolete content
try { dothing(); } catch (e) { console.exception(e); } function userexception(message) { this.message = message; this.name = "userexception"; } function dothing() { throw new userexception("thing could not be
done!"); } error: my-addon: an exception occurred.
... userexception: thing could not be
done!
Getting started (cfx) - Archive of obsolete content
once you've
done that, you'll be looking at a command prompt.
...for example: while true ; do cfx xpi ; wget --post-file=codesy.xpi http://localhost:8888/ ; sleep 5 ;
done note that the logging level defined for the console is different when you use this method, compared to the logging level used when an add-on is run using cfx run.
Extension Versioning, Update and Compatibility - Archive of obsolete content
the technical details of the signing mechanism are beyond the scope of this document however the basics are as follows: step 1 -
done once, before you publish your add-on the target: adding updatekey in install.rdf the add-on author creates a public/private rsa cryptographic key pair.
... step 2 -
done every time you change your "update.rdf" file the target: setting value to signature in update.rdf when the author creates the update rdf file a tool is used to sign it using the private part of the key.
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
setting the image for a toolbar button is
done with css: #xulschoolhello-hello-world-button { list-style-image: url("chrome://xulschoolhello/skin/hello-world.png"); } it's not really that simple to set the image for a toolbar button, because we need to consider the appearance of the button on different systems, and also consider the different button states, but we'll get into that further ahead.
...this is
done in the overlay as well.
Appendix F: Monitoring DOM changes - Archive of obsolete content
this is most easily
done by adding a :not clause to the css selector that attaches your binding.
... for instance, when using the selector div:not([foo-binding-
done]), you can detach your binding by running this.setattribute("foo-binding-
done", true) in your constructor.
Tabbed browser - Archive of obsolete content
var ohttp = asubject.queryinterface(components.interfaces.nsihttpchannel); //i used nsihttpchannel but i guess you can use nsichannel, im not sure why though var interfacerequestor = ohttp.notificationcallbacks.queryinterface(components.interfaces.nsiinterfacerequestor); //var domwindow = interfacerequestor.getinterface(components.interfaces.nsidomwindow); //not to be
done anymore because: https://developer.mozilla.org/docs/updating_extensions_for_firefox_3.5#getting_a_load_context_from_a_request //instead do the loadcontext stuff below var loadcontext; try { loadcontext = interfacerequestor.getinterface(components.interfaces.nsiloadcontext); } catch (ex) { try { loadcontext = a...
... not an error } } return; } } }; services.obs.addobserver(httprequestobserver, "http-on-modify-request", false); //this function gets the contentwindow and other good stuff from loadcontext of httpchannel function loadcontextgoodies(httpchannel) { //httpchannel must be the subject of http-on-modify-request qi'ed to nsihttpchannel as is
done on line 8 "httpchannel = subject.queryinterface(ci.nsihttpchannel);" //start loadcontext stuff var loadcontext; try { var interfacerequestor = httpchannel.notificationcallbacks.queryinterface(ci.nsiinterfacerequestor); //var domwindow = interfacerequestor.getinterface(components.interfaces.nsidomwindow); //not to be
done anymore because: https://developer.mozilla.org/d...
Firefox addons developer guide - Archive of obsolete content
there are a few things that could be
done to make this fit the site better, and for general cleaning up: tables should use the "standard-table" css class so they're styled the same as those on the rest of mdc.
... apostrophes are being
done using curly apostrophes instead of straight ones as is
done everywhere else in mdc.
Adding preferences to an extension - Archive of obsolete content
this is
done in two steps: first, we get the preferences service.
...your options.xul file would look like this: <?xml version="1.0" ?> <vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <setting pref="extensions.stockwatcher2.symbol" type="string" title="stock to watch" /> </vbox> adding the context menu adding the contextual menu is easy; all the work that needs doing is
done in the stockwatcher2.xul file.
Getting Started - Archive of obsolete content
once you've
done this, insert the information as above, and scroll down.
...more after i get
done with some tests repackaging jar now all you need to do is repackage a jar file with the following directory structure, using your favorite archive manager to create a zip archive: /chrome/my_theme.jar!/communicator/* /chrome/my_theme.jar!/editor/* /chrome/my_theme.jar!/global/* /chrome/my_theme.jar!/help/* /chrome/my_theme.jar!/messenger/* /chrome/my_theme.jar!/messenger-newsblog/* /chrome/my_the...
Download Manager preferences - Archive of obsolete content
browser.download.manager.closewhen
done a boolean value indicating whether or not the downloads window should close automatically when downloads are completed.
... browser.download.manager.scanwhen
done a boolean value that indicates whether or not to perform virus scans after downloads are complete.
Content states and the style system - Archive of obsolete content
to this end, when a <code>contentstateschanged</code> notification is dispatched for a content node the first thing that's
done is to is to check whether the content state change something could affect any styles.
... this is
done by walking the list of all css2.1 simple selectors in all style sheets applied to the page that have a state-dependent pseudo-class as part of the selector.
Document Loading - From Load Start to Finding a Handler - Archive of obsolete content
the basic idea is that dispatchcontent calls nsdocumentopeninfo::trycontentlistener on various content listeners; if that returns true, we have found the right listener and we are
done.
...if a converter is found, we hook that up as our stream listener and are
done -- we just need to pump data into it and let the downstream nsdocumentopeninfo handle the final dispatch.
Menu - Archive of obsolete content
if the menu remains open when getrecenttweets() receives data from the network and calls
done(), the "loading..." item is replaced with the tweets, one item per tweet: this example will not work on os x due to a platform bug in firefox.
...jetpack.menu.add({ label: "recent tweets", menu: new jetpack.menu({ beforeshow: function (menu) { menu.set("loading..."); getrecenttweets(function
done(tweets) menu.set(tweets)); } }) }); when the user selects some text on a page, the context menu normally displays a simple item that searches for it.
Monitoring downloads - Archive of obsolete content
that means all its work can be
done in its load event handler, which looks like this: onload: function() { // open the database this.dbfile = components.classes["@mozilla.org/file/directory_service;1"] .getservice(components.interfaces.nsiproperties) .get("profd", components.interfaces.nsifile); this.dbfile.append("downloadlogger.sqlite"); // get access to the storage service ...
... exercises for the reader there are some obvious things that could be
done to improve this extension.
New Skin Notes - Archive of obsolete content
--waldo 21:09, 25 aug 2005 (pdt) not going to change (yet or possibly ever) adding pipes between buttons in horizontal nav-bar (ie: my talk | preferences | my watchlist) (stricken part is
done).
...and when
done, verify that the designer did not break the page with a "normal" font setting, by using a default profile.
Reading textual data - Archive of obsolete content
this work was
done in bug 295047.
...nputstream); is.init(fis, charset, 1024, replacementchar); now you can read string from is: var str = {}; var numchars = is.readstring(4096, str); if (numchars != 0 /* eof */) var read_string = str.value; to read the entire stream and do something with the data: var str = {}; while (is.readstring(4096, str) != 0) { processdata(str.value); } don't forget to close the stream when you're
done with it (is.close()).
Same origin policy for XBL - Archive of obsolete content
checks performed once the originating principal is determined, checks are
done to make sure the load should be allowed.
...a call to checloaduriwithprincipal() is
done to make sure the principal is able to link to the given uri in the first place.
Space Manager High Level Design - Archive of obsolete content
this happens in the method nsblockreflowstate::recoverfloats and nsblockreflowstate::flowandplacefloat (formerly this was
done in nsblockframe::updatespacemanager).
...when
done with the child, restore the space managers coordinates by translating by the negative of the child block's origin.
Static Analysis for Windows Code under Linux - Archive of obsolete content
hg clone http://hg.mozilla.org/users/tglek_mo...-moz-plugin-mq .hg/patches # apply gty.diff and plugin.diff # if you have mq setup, do hg qpush -a (for file in `cat .hg/patches/series`; do cat .hg/patches/$file;
done) |patch -p1 cd ..
...the static check will be
done when compiling is going on.
The life of an HTML HTTP request - Archive of obsolete content
this is
done by the nscssframeconstructor, which creates frames for each content node according to the rules specified in the user agent stylesheet (ua.css) and the document specific style sheets.
...the initial reflow is
done by the nshtmlcontentsink::startlayout(), startlayout() calls presshell::initialreflow().
URIs and URLs - Archive of obsolete content
this is
done by ns_escapeurl which is now part of xpcom, but started as part of necko.
... noteable differences necko does not support certain deprecated forms of relative urls, based on the following part of rfc 2396: if the scheme component is defined, indicating that the reference starts with a scheme name, then the reference is interpreted as an absolute uri and we are
done.
MenuItems - Archive of obsolete content
in the example, this is
done by using the removeattribute method.
... for instance, you might want to change the label of an undo menuitem based on what would be un
done.
Multiple Queries - Archive of obsolete content
this and other automated sorting
done by the template builder is a fairly complicated process that will be discussed in more detail later.
...when using the extended query syntax, the manner in which the graph is navigated may be different for every query, so no optimization can be
done.
RDF Modifications - Archive of obsolete content
the template builder then rebuilds the template completely when
done.
...this is
done whether the query produced a new result, removed one, or the content was not affected, since a binding could have affected any existing results.
Sorting Results - Archive of obsolete content
for other elements or content trees, sorting is
done by placing the attributes on the root element.
... content sorting for content builders (templates that do not use flags="dont-build-content"), sorting is
done by placing the sort and sortdirection attributes on the root node of the template.
Adding Style Sheets - Archive of obsolete content
we have
done a similar thing with the global style sheet file (chrome://global/skin).
...this can be
done with the code below, allowing you to remove the import from the xul file: style import from xul: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> style import from css: @import url(chrome://global/skin/); the second syntax is preferred because it reduces the number of dependencies within the xul file itself.
Trees - Archive of obsolete content
instead, all drawing is
done by the tree body using data supplied by the view.
...making a tree flexible is quite commonly
done, as it is often the case that the data in the tree is the most significant information displayed, so it makes sense to make the tree grow to fit.
XML - Archive of obsolete content
an actual memo using the memoml to represent itself might look like this: <memo> <from>ian oeschger</from> <to>steve rudman</to> <body>i think the first draft of the guide is
done!</body> </memo> note how the memo element -- the root element in our brief definition, ordeclaration, above -- surrounds the other three elements.
... the heavy lifting is
done by the ingredients rather than the chef.
tabbrowser - Archive of obsolete content
nhistory, tabcontainer, tabs, visibletabs, webbrowserfind, webnavigation, webprogress methods addprogresslistener, addtab, addtabsprogresslistener,appendgroup, getbrowseratindex, getbrowserindexfordocument, getbrowserfordocument, getbrowserfortab, geticon, getnotificationbox, gettabforbrowser, gettabmodalpromptbox, goback, gobackgroup, goforward, goforwardgroup, gohome, gotoindex, loadgroup, loa
donetab, loadtabs, loaduri, loaduriwithflags, movetabto, pintab, reload, reloadalltabs, reloadtab, reloadwithflags, removealltabsbut, removecurrenttab, removeprogresslistener, removetab, removetabsprogresslistener,replacegroup, selecttabatindex, seticon, showonlythesetabs, stop, unpintab attributes autocompleteenabled type: boolean set to true to enable autocomplete of fields.
... loa
donetab( url, referreruri, charset, postdata, loadinbackground, allowthirdpartyfixup ) loa
donetab( url, { referreruri: ..., charset: ..., postdata: ..., inbackground: ..., allowthirdpartyfixup: ..., relatedtocurrent: ...
2006-10-06 - Archive of obsolete content
also invites people to help extension developers test for compatibility (link to a bunch of extension compatability bugs) discussions reining in the release process a discussion of what can be
done to speed up the release process.
...adam gutherie replied that cbeard's blog post from nov 2005 is as close to a roadmap as exists right now and agrees that needs to be
done about this.
2006-10-27 - Archive of obsolete content
visit http://www.getfirefox.com/ discussions firefox 3 feature prioritizing rudi gens pointed out that hundreds of edits have been
done to the firefox 3 feature brainstorming page.
... he suggests that some prioritizing be
done.
NPN_Write - Archive of obsolete content
example this example pushes a snippet of html over a newly created stream, then destroys the stream when it's
done.
...*/ err = npn_destroystream(instance, stream, npres_
done); see also npp_newstream() npp_destroystream() npp_read() npstream npp ...
Browser Feature Detection - Archive of obsolete content
ble cellspacing="0">'); for (i = 0; i < features.length; i++) { if (features[i].supported) document.write('<tr><td>' + features[i].name + '<\/td><td>' + features[i].supported + '<\/td><\/tr>'); else document.write('<tr><td>' + features[i].name + '<\/td><td style="background-color:red">' + features[i].supported + '<\/td><\/tr>'); } document.write('<\/table>'); } var ol
donerror = window.onerror; // suppress error messages...
...ll; document.write('<p><b> your browser ' + navigator.useragent + '<\/b><\/p>'); generatereport(document, 'domcore1', 'document'); generatereport(document, 'domcore2', 'document'); generatereport(document, 'domhtml', 'document'); generatereport(document.body.style, 'domcss1', 'document.body.style'); generatereport(document.body.style, 'domcss2', 'document.body.style'); window.onerror = ol
donerror; see also browser detection and cross browser support comparison of layout engines web specifications supported in opera 9 what's new in internet explorer 7 (script) original document information author(s): (unknown) last updated date: updated march 16, 2003 copyright information: copyright © 2001-2003 netscape.
Using JavaScript Generators in Firefox - Archive of obsolete content
function grabevent(event) { generator.send(event); } // when we're all
done we can close the generator, but that must happen outside // of the generator so we use a timeout.
...ult; if (db.version != "1.0") { db.setversion("1.0").onsuccess = grabevent; event = yield; var transaction = event.transaction; db.createobjectstore("stuff"); transaction.oncomplete = grabevent; yield; } db.transaction(["stuff"]).objectstore("stuff").get("foo").onsuccess = grabevent; event = yield; alert("got result: " + event.target.result); // we're all
done.
Reference - Archive of obsolete content
once that is
done, the various code samples should be updated to reflect current practices and code if they cannot be written in a "version-neutral" manner.
...i was wondering what should be
done about those examples, since they would no longer be valid with fx 1.5+ and family.
RDF in Mozilla FAQ - Archive of obsolete content
the following code illustrates its usage: // this is the object that will observe the rdf/xml load's progress var observer = { onbeginload: function(asink) {}, oninterrupt: function(asink) {}, onresume: function(asink) {}, onendload: function(asink) { asink.removexmlsinkobserver(this); alert("
done!"); }, onerror: function(asink, astatus, aerrormsg) { alert("error!
...this was
done to avoid multiple rebuilds when more than one datasource is added to the database.
Game monetization - Game development
paid games the first, most obvious choice that may come to your mind might be selling the games the way it is
done for huge aaa titles — with a fixed, up front price.
...most of the deals are
done through emails when talking to a dedicated person on the publisher side.
Desktop mouse and keyboard controls - Game development
note: the captain rogers: battle at andromeda is built with phaser and managing the controls is phaser-based, but it could also be
done in pure javascript.
...it can be
done exactly the same as before — by capturing key codes and performing actions.
Tiles and tilemaps overview - Game development
rendering static tilemaps is easy, and can be
done with a nested loop iterating over columns and rows.
... one simple technique consists of pre-rendering the map in a canvas on its own (when using the canvas api) or on a texture (when using webgl), so tiles don't need to be re-drawn every frame and rendering can be
done in just one blitting operation.
WAI-ARIA basics - Learn web development
once that is
done, we start up a setinterval() loop that loads a new random quote into the quote box every 10 seconds: let intervalid = window.setinterval(showquote, 10000); this works ok, but it is not good for accessibility — the content update is not detected by screenreaders, so their users would not know what is going on.
... </article> </div> note: the most striking change here is that we've removed the links that were originally present in the example, and just used the list items as the tabs — this was
done because it makes things less confusing for screenreader users (the links don't really take you anywhere; they just change the view), and it allows the setsize/position in set features to work better — when these were put on the links, the browser kept reporting "1 of 1" all the time, not "1 of 3", "2 of 3", etc.
Positioning - Learn web development
this is
done by setting positioning on one of the element's ancestors — to one of the elements it is nested inside (you can't position it relative to an element it is not nested inside).
...
donec luctus augue eget malesuada ultrices.
Styling links - Learn web development
done!
... note: you may have noticed that the list items in the html are all put on the same line as each other — this is
done because spaces/line breaks in between inline block elements create spaces on the page, just like the spaces in between words, and such spaces would break our horizontal navigation menu layout.
Sending forms through JavaScript - Learn web development
the different techniques you'll require are
done below.
...ta is simpler // start a new part in our body's request data += "--" + boundary + "\r\n"; // say it's form data, and name it data += 'content-disposition: form-data; name="' + text.name + '"\r\n'; // there's a blank line between the metadata and the data data += '\r\n'; // append the text data to our body's request data += text.value + "\r\n"; // once we are
done, "close" the body's request data += "--" + boundary + "--"; // define what happens on successful data submission xhr.addeventlistener( 'load', function( event ) { alert( 'yeah!
What’s in the head? Metadata in HTML - Learn web development
if
done correctly, when you save your html and refresh your browser you should be able to see that things have changed: the javascript has added an empty list to the page.
...this can be
done by adding the lang attribute to the opening html tag (as seen in the meta-example.html and shown below.) <html lang="en-us"> this is useful in many ways.
General asynchronous programming concepts - Learn web development
there's no sense sitting there waiting for something when you could let the other task chug along on another processor core and let you know when it's
done.
... this lets you get other work
done in the meantime, which is the basis of asynchronous programming.
Fetching data from the server - Learn web development
this can be
done with replace(), tolowercase(), and simple string concatenation.
... request.onload = function() { poemdisplay.textcontent = request.response; }; the above is all set up for the xhr request — it won't actually run until we tell it to, which is
done using the send() method.
Introduction to web APIs - Learn web development
of audio fed through it, and create another event handler that changes the value of the audio graph's gain (volume) whenever the slider value is changed: const gainnode = audioctx.creategain(); volumeslider.addeventlistener('input', function() { gainnode.gain.value = this.value; }); the final thing to do to get this to work is to connect the different nodes in the audio graph up, which is
done using the audionode.connect() method available on every node type: audiosource.connect(gainnode).connect(audioctx.destination); the audio starts in the source, which is then connected to the gain node so the audio's volume can be adjusted.
...this is
done because autoplaying audio is usually really annoying and we really shouldn't be subjecting our users to it.
Useful string methods - Learn web development
this can be
done using the indexof() method, which takes a single parameter — the substring you want to search for.
... this can be
done in another way, which is possibly even more effective.
Object building practice - Learn web development
this is generally
done recursively — which means that the function is calling itself every time it runs, so it runs over and over again.
...we could have
done something far more complex, like get the balls to bounce off each other realistically, but that would have been far more complex to implement.
Test your skills: Object basics - Learn web development
once you've
done this, you should then write a string to the variable bandinfo, which will contain a small biography detailing their name, nationality, years active, and style, and the title and release date of their first album.
... when you are
done, write your own object called cat2, which has the same structure, exactly the same greeting() method, but a different name, breed, and color.
Aprender y obtener ayuda - Learn web development
from the studies that neuroscientists have
done on brain activity, we have found out that you can't really engage in both ways of learning — or thinking — at once.
... if you are doing a university or college course to learn web development, then most of this planning is
done for you — lucky you!
React interactivity: Events and state - Learn web development
<input type="text" id="new-todo-input" classname="input input__lg" name="text" autocomplete="off" value={name} /> change "use hooks!" to an empty string once you're
done; this is what we want for our initial state.
... function form(props) { const [name, setname] = usestate(""); function handlechange(e) { setname(e.target.value); } function handlesubmit(e) { e.preventdefault(); props.addtask(name); setname(""); } return ( <form onsubmit={handlesubmit}> <h2 classname="label-wrapper"> <label htmlfor="new-todo-input" classname="label__lg"> what needs to be
done?
Beginning our React todo list - Learn web development
the jsx copy the following snippet to your clipboard, then paste it into app.js so that it replaces the existing app() function: function app(props) { return ( <div classname="todoapp stack-large"> <h1>todomatic</h1> <form> <h2 classname="label-wrapper"> <label htmlfor="new-todo-input" classname="label__lg"> what needs to be
done?
...each task is a list item (<li>), and has buttons to edit and delete it and a checkbox to check it off as
done.
Starting our Svelte Todo list app - Learn web development
code along with us git clone the github repo (if you haven't already
done it) with: git clone https://github.com/opensas/mdn-svelte-tutorial.git then to get to the current app state, run cd mdn-svelte-tutorial/02-starting-our-todo-app or directly download the folder's content: npx degit opensas/mdn-svelte-tutorial/02-starting-our-todo-app remember to run npm install && npm run dev to start your app in development mode.
...copy and paste the following into our todos.svelte component file, replacing the existing content: <!-- todos.svelte --> <div class="todoapp stack-large"> <!-- newtodo --> <form> <h2 class="label-wrapper"> <label for="todo-0" class="label__lg"> what needs to be
done?
Working with Svelte stores - Learn web development
code along with us git clone the github repo (if you haven't already
done it) with: git clone https://github.com/opensas/mdn-svelte-tutorial.git then to get to the current app state, run cd mdn-svelte-tutorial/06-stores or directly download the folder's content: npx degit opensas/mdn-svelte-tutorial/06-stores remember to run npm install && npm run dev to start your app in development mode.
...in the following example we create a counter store, which will only allow us to add one to the counter or reset its value: import { writable } from 'svelte/store'; function mystore() { const { subscribe, set, update } = writable(0); return { subscribe, ad
done: () => update(n => n + 1), reset: () => set(0) }; } if our to-do list app gets too complex, we could let our todos store handle every state modification.
Getting started with Vue - Learn web development
98% after emitting copyplugin
done compiled successfully in 18121ms app running at: - local: <http://localhost:8080/> - network: <http://192.168.1.9:8080/> note that the development build is not optimized.
... with a basic introduction out of the way, we'll now go further and build up our sample app, a basic todo list application that allows us to store a list of items, check them off when
done, and filter the list by all, complete, and incomplete todos.
Focus management with Vue refs - Learn web development
previous overview: client-side javascript frameworks next we are nearly
done with vue.
...for custom vue components, you can also use refs to directly access the internal structure of a child component, however this should be
done with caution as it can make code harder to reason about and understand.
Implementing feature detection - Learn web development
generally, such tests are
done via one of the following common patterns: summary of javascript feature detection techniques feature detection type explanation example if member in object check whether a certain method or property (typically an entry point into using the api or other feature you are detecting for) exists in its parent object.
... attach the modernizr library to the html using a <script> element, as we have
done in previous demos.
Handling common JavaScript problems - Learn web development
this is best
done using a minification tool like uglify (there's also an online version — see jscompress.com) when using apis, make sure you turn off the api features when they are not being used; some api calls can be really expensive on processing power.
...loadscript() looks like this: function loadscript(src,
done) { const js = document.createelement('script'); js.src = src; js.onload = function() {
done(); }; js.onerror = function() {
done(new error('failed to load script ' + src)); }; document.head.appendchild(js); } this function creates a new <script> element, then sets its src attribute to the path we specified as the first argument ('polyfills.js' when we called it in the code...
Package management basics - Learn web development
writing the code to include the package(s) in your application (this tends to be
done using javascript modules, another subject that is worth reading up on and understanding).
... installing parcel run the following command to install parcel locally: npm install parcel-bundler once that's
done all the things, we're now ready for some "modern client-side development" (which really means using build tools to make the developer experience a little easier).
Application cache implementation overview
after the manifest fetch is
done, nsofflinecacheupdate::loadcompleted() is called.
... nsofflinecacheupdate::loadcompleted() is called for each finished entry load, including the manifest and is the main place handling each update state as following: on checking state, a state the update is at after manifest parsing has been
done, loadcompleted checks whether the new hash, i.e.
Debugging a hang on OS X (Archived)
when it's
done parsing the data, click the "show text report" button; a new window will open with a couple of rows with stacktraces for all the threads in the sampled application.
... when it's
done parsing the data, you should now have a couple of rows with stacktraces for all the threads in the sampled application.
Makefiles - Best practices and suggestions
parallel make: add an explicit timestamp dependency (.
done) that make can synchronize threaded calls on to avoid a race condition.
... # transient directory for storing timestamps ts=.ts ##################################################### ## extra dep needed to synchronize parallel execution ##################################################### $(ts): $(ts)/.
done $(ts)/.
done: $(mkdir) -p $(dir $@) touch $@ # "clean" target garbage_dirs += $(ts) maintain clean targets - makefiles should be able to remove all content that is generated so "make clean" will return the sandbox/directory back to a clean state.
How Mozilla's build system works
since the dawn of mozilla, this has been
done with the make tool, consuming makefiles.
...make starts processing the makefile in the root directory and then recursively descends into child directories until it's
done.
Eclipse CDT
that
done, open the workspace preferences, select "c/c++ > debug > gdb", and set "gdb debugger" to the full path of your new gdb executable.
...when the indexing is
done, open the log using "window > show view > other > general > error log" and check the summary and look for exceptions.
Eclipse CDT Manual Setup
setup time some points in the rest of this document below are old and taken care of by the mach commands described above (although some of the project configuration is not
done automatically yet).
...that
done, select the "console" tab at the bottom of the main eclipse window and you should see the build console output flying by as eclipse processes it.
SVG Guidelines
this work doesn't need to be re
done when the image is displayed on someone else's computer.
... on the other hand, if the image is saved as an svg image then all this work needs to be
done each time the svg is displayed on someone else's computer.
Performance best practices for Firefox front-end engineers
you might want to consider using a worker if you need to do some computation that can be
done off of the main thread.
...this can be
done by using a settimeout or dispatching a runnable inside a requestanimationframe callback, for example: requestanimationframe(() => { settimeout(() => { // this code will be run asap after style and layout information have // been calculated and the paint has occurred.
Using the Browser API
searchform.addeventlistener('submit',function(e) { e.preventdefault(); browser.findall(searchbar.value, 'case-sensitive'); searchactive = true; prev.disabled = false; next.disabled = false; searchbar.blur(); }); with this all
done, you'll see your search results are highlighted; you can cycle through these using the htmliframeelement.findnext() method (specify forward and backward to go in either direction through the results), which is what our next two event listeners do: prev.addeventlistener('touchend',function() { browser.findnext("backward"); }); next.addeventlistener('touchend',function() { browser.findnext("f...
...if searchactive is true, meaning that a search has been
done, we want to disable the search as we hide the search options — we disable the buttons, make searchactive false, clear the entered search value, and run htmliframeelement.clearmatch(), which gets rid of any stored/highlighted search results from the browser.
Embedding the editor
(the current nseditorshell makes assumptions about the hosting xul document, which need to be broken.) composer embedded in a web page (<htmlarea>) ie 5 supports the <htmlarea> element; if mozilla is to support something similar, editor needs to be embeddable to the extent that this can be
done.
...some of these tasks can be
done concurrently.
Gecko SDK
once that's
done, you should perform the following command: ln -s /opt/local/lib/libintl.8.dylib /opt/local/lib/libintl.3.dylib this should fix the problem.
...this can be
done by downloading the source code for firefox and using the --with-libxul-sdk option to configure.
How Mozilla determines MIME Types
this is
done because the generic text/xml mime type does not work for xul files, and xhtml files get a different dom when interpreted as text/xml.
...handler/nsexternalhelperappservice.cpp) the file->mime type mapping works like this: on beos, the operating system is asked for the type of the file (not quite yet, bug 217723) on macos, the type and creator code will be used to lookup the type of the file from the os a hardcoded list of extensions is checked (containing currently 13 entries, nsexternalhelperappservice.cpp line 463 (this is
done for speed – it is faster to find data in the hardcoded list than asking the os or looking in preferences) if the extension is not listed there, it becomes interesting.
Implementing Download Resuming
the interface resuming is
done using the nsiresumablechannel interface.
...you may want to use nsisimplestreamlistener to simplify this task; to get progress notifications, you can implement nsiprogresseventsink and set an interface requester as the notificationcallbacks of the channel that gives out such an event sink (this needs to be
done before calling asyncopen).
Examples
now what if we want to run multiple promises and then return when all are
done?
... console.log(filescontent); }, function onfail() { console.error("failed to load all files"); } ); see also the ask.m.o topic: doing multiple promises in function in pareallel, how return when last
done?
PromiseWorker.jsm
both are
done by the post function described above.
... basepromiseworker.meta above code can also be
done with the meta object.
Bootstrapping a new locale
this is
done by cloning the en-us (united states english) files into your localization.
... this will familiarize you with our "hg" commands and will get us something that we can import easily when you are
done.
Localizing without a specialized tool
if you choose to localize mozilla with nothing more than a text editing application and not a specialized tool, this document (along with create a new localization) will enable you to learn just what needs to be
done.
... this will familiarize you with our "hg" commands and will get us something that we can import easily when you are
done.
Localization sign-off reviews
overview you've
done some localization work and are ready for it to be released.
...this is
done by generating a diff between the new release revision being considered and the previously approved release revision.
Investigating leaks using DMD heap scan mode
both kinds of preprocessing are
done by the dmd.py script, which can be invoked like this: $objdir/dist/bin/dmd.py --clamp-contents dmd-$pid.log.gz this can take a few minutes due to symbolification, but you only need to run it once on a log file.
... after that is
done, we can finally find out which objects (possibly) point to other objects, using the block_analyzer script: python $srcdir/memory/replace/dmd/block_analyzer.py dmd-$pid.log.gz $leakaddr this will look through every block of memory in the log, and give some basic information about any block of memory that (possibly) contains a pointer to that object.
Leak-hunting strategies and tips
once you've
done this, and it doesn't leak much, then try the action under trace-malloc or lsan or valgrind to find the leaks of smaller graphs of objects.
...this needs to be
done when running, since we do the address to symbol mapping at runtime.
Measuring performance using the PerfMeasurement.jsm code module
when you're
done benchmarking, you can read out each of the counters you asked for as properties: let report = "cpu cycles: " + monitor.cpu_cycles + "\n" + "cache refs: " + monitor.cache_references + "\n" + "cache misses: " + monitor.cache_misses + "\n"; monitor.reset(); alert(report); the reset() method clears all of the enabled counters, as you might expect.
... when you're
done with your measurements, just let the monitor object go out of scope.
Reporting a Performance Problem
visit https://profiler.firefox.com/ click on "enable profiler menu button" the profiler toolbar button will show up in the top right of the url bar as a small stopwatch icon you can right-click on the button and remove it from the toolbar when you're
done with it.
...recording can be
done by clicking on the toolbar icon to open its panel.
AsyncTestUtils extended framework
sometimes in your tests you need to wait for an operation to complete that does not occur synchronously (that is, it is not
done when the function call you made to initiate the operation returns control to you).
...for example, you would do "yield async_move_messages(...);" and be
done with it.
Introduction to NSPR
note: evaluation of the invariant expression is a conceptual requirement and is rarely
done in practice.
...since this testing involves the monitored data, it must be
done from within the monitor.
FIPS Mode - an explanation
it requires that all cryptography
done by us government personnel must be
done in "devices" that have been independently tested, and certified by nist, to meet the extensive requirements of that document.
... one device does all the operations that may be
done without needing to authenticate, and the other device stores the user's certificates and private keys and performs operations that use those private keys.
NSS Sample Code sample2
we use pk11_originunwrap * to indicate the key was unwrapped - which is what should be
done * normally anyway - using raw keys isn't a good idea */ symkey = pk11_importsymkey(slot, ciphermech, pk11_originunwrap, cka_encrypt, &keyitem, null); if (symkey == null) { fprintf(stderr, "failure to import key into nss (err %d)\n", pr_geterror()); goto out; } /* set up the pkcs11 encryption paramters.
...pkcs11 param (err %d)\n", pr_geterror()); goto out; } /* sample data we'll encrypt and decrypt */ strcpy(data, "encrypt me!"); fprintf(stderr, "clear data: %s\n", data); /* ========================= start section ============================= */ /* if using the the same key and iv over and over, stuff before this */ /* section and after this section needs to be
done only once */ /* encrypt data into buf1.
nss tech note4
pulling certificate extension information out of ssl certificates nss technical note: 4 note: this document contains code snippets that focus on essential aspects of the task and often do not illustrate all the cleanup that needs to be
done.
...rver, this will get you the client's cert handle if client auth is enabled certcertificate* cert = ssl_localcertificate(prfiledesc *fd); if ssl client, this will get you the client cert's handle, if client auth happened if ssl server, this will get you the server's cert handle don't forget to clean up the cert handle when you're
done with it void cert_destroycertificate(certcertificate *cert); some info is readily available cert->subjectname (char*) cert->issuername (char*) cert->emailaddr (char*) or char *cert_getcertificateemailaddress(certcertificate *cert); cert->keyusage (unsigned int) to break the issuer and subject names into component...
nss tech note5
note: this document contains code snippets that focus on essential aspects of the task and often do not illustrate all the cleanup that needs to be
done.
...when all
done with encrypt/decrypt ops, clean up</big> <big>pk11_freesymkey(symkey); secitem_freeitem(secparam, pr_true); pk11_freeslot(slot);</big> note: aes encryption, a fixed blocksize of 16 bytes is used.
NSS tools : ssltab
type = 14 (server_hello_
done) length = 0 (0x000000) } } ] --> [ sslrecord { 0: 16 03 00 00 44 |....d type = 22 (handshake) version = { 3,0 } length = 68 (0x44) handshake { 0: 10 00 00 40 |...@ type = 16 (client_key_exchange) length = 64 (0x000040) clientkeyexchange { message = {...} } } } ] --> [ sslrecord { 0: 14 03 00 00 01 |.....
...000046) serverhello { server_version = {3, 0} random = {...} session id = { length = 32 contents = {..} } cipher_suite = (0x0003) ssl3/rsa/rc4-40/md5 } type = 11 (certificate) length = 709 (0x0002c5) certificatechain { chainlength = 706 (0x02c2) certificate { size = 703 (0x02bf) data = { saved in file 'cert.001' } } } type = 12 (server_key_exchange) length = 202 (0x0000ca) type = 14 (server_hello_
done) length = 0 (0x000000) } } ] --> [ sslrecord { type = 22 (handshake) version = { 3,0 } length = 68 (0x44) handshake { type = 16 (client_key_exchange) length = 64 (0x000040) clientkeyexchange { message = {...} } } } ] --> [ sslrecord { type = 20 (change_cipher_spec) version = { 3,0 } length = 1 (0x1) } sslrecord { type = 22 (handshake) version = { 3,0 } length = 56 (0x38) > encrypted > } ] >-- [ s...
NSS tools : ssltap
type = 14 (server_hello_
done) length = 0 (0x000000) } } ] --> [ sslrecord { 0: 16 03 00 00 44 |....d type = 22 (handshake) version = { 3,0 } length = 68 (0x44) handshake { 0: 10 00 00 40 |...@ type = 16 (client_key_exchange) length = 64 (0x000040) clientkeyexchange { message = {...} } } } ] --> [ sslrecord { 0: 14 03 00 00 01 |.....
...000046) serverhello { server_version = {3, 0} random = {...} session id = { length = 32 contents = {..} } cipher_suite = (0x0003) ssl3/rsa/rc4-40/md5 } type = 11 (certificate) length = 709 (0x0002c5) certificatechain { chainlength = 706 (0x02c2) certificate { size = 703 (0x02bf) data = { saved in file 'cert.001' } } } type = 12 (server_key_exchange) length = 202 (0x0000ca) type = 14 (server_hello_
done) length = 0 (0x000000) } } ] --> [ sslrecord { type = 22 (handshake) version = { 3,0 } length = 68 (0x44) handshake { type = 16 (client_key_exchange) length = 64 (0x000040) clientkeyexchange { message = {...} } } } ] --> [ sslrecord { type = 20 (change_cipher_spec) version = { 3,0 } length = 1 (0x1) } sslrecord { type = 22 (handshake) version = { 3,0 } length = 56 (0x38) > encrypted > } ] >-- [ s...
sslerr.html
ssl_error_rx_malformed_certificate -12258 "ssl received a malformed certificate handshake message." ssl_error_rx_malformed_server_key_exch -12257 "ssl received a malformed server key exchange handshake message." ssl_error_rx_malformed_cert_request -12256 "ssl received a malformed certificate request handshake message." ssl_error_rx_malformed_hello_
done -12255 "ssl received a malformed server hello
done handshake message." ssl_error_rx_malformed_cert_verify -12254 "ssl received a malformed certificate verify handshake message." ssl_error_rx_malformed_client_key_exch -12253 "ssl received a malformed client key exchange handshake message." ssl_error_rx_malformed_finished -12252 "ssl received a ma...
...ror_rx_unexpected_certificate -12244 "ssl received an unexpected certificate handshake message." ssl_error_rx_unexpected_server_key_exch -12243 "ssl received an unexpected server key exchange handshake message." ssl_error_rx_unexpected_cert_request -12242 "ssl received an unexpected certificate request handshake message." ssl_error_rx_unexpected_hello_
done -12241 "ssl received an unexpected server hello
done handshake message." ssl_error_rx_unexpected_cert_verify -12240 "ssl received an unexpected certificate verify handshake message." ssl_error_rx_unexpected_client_key_exch -12239 "ssl received an unexpected client key exchange handshake message." ssl_error_rx_unexpected_finished -12238 "ssl rece...
NSS Tools ssltap
type = 14 (server_hello_
done) length = 0 (0x000000) }}]--> [sslrecord { 0: 16 03 00 00 44 |....d type = 22 (handshake) version = { 3,0 } length = 68 (0x44) handshake { 0: 10 00 00 40 |...@ type = 16 (client_key_exchange) length = 64 (0x000040) clientkeyexchange { message = {...} } }}]--> [sslreco...
... } type = 11 (certificate) length = 709 (0x0002c5) certificatechain { chainlength = 706 (0x02c2) certificate { size = 703 (0x02bf) data = { saved in file 'cert.001' } } } type = 12 (server_key_exchange) length = 202 (0x0000ca) type = 14 (server_hello_
done) length = 0 (0x000000) }}]--> [sslrecord { type = 22 (handshake) version = { 3,0 } length = 68 (0x44) handshake { type = 16 (client_key_exchange) length = 64 (0x000040) clientkeyexchange { message = {...} } }}]--> [sslrecord { type = 20 (change_cipher_spec) version = { 3,0 } length = 1 (0x1)}sslrecord { type ...
NSS tools : ssltap
type = 14 (server_hello_
done) length = 0 (0x000000) } } ] --> [ sslrecord { 0: 16 03 00 00 44 |....d type = 22 (handshake) version = { 3,0 } length = 68 (0x44) handshake { 0: 10 00 00 40 |...@ type = 16 (client_key_exchange) length = 64 (0x000040) clientkeyexchange { message = {...
...type = 11 (certificate) length = 709 (0x0002c5) certificatechain { chainlength = 706 (0x02c2) certificate { size = 703 (0x02bf) data = { saved in file 'cert.001' } } } type = 12 (server_key_exchange) length = 202 (0x0000ca) type = 14 (server_hello_
done) length = 0 (0x000000) } } ] --> [ sslrecord { type = 22 (handshake) version = { 3,0 } length = 68 (0x44) handshake { type = 16 (client_key_exchange) length = 64 (0x000040) clientkeyexchange { message = {...} } } } ] --> [ sslrecord { type = 20 (change_cipher_spec) version = { 3,...
Tutorial: Embedding Rhino
embedding rhino can be
done simply with good results.
... initializing standard objects the code scriptable scope = cx.initstandardobjects(); initializes the standard objects (object, function, etc.) this must be
done before scripts can be executed.
Rhino scopes and contexts
to associate the current thread with a context, simply call the enter method of context: context cx = context.enter(); once you are
done with execution, simply exit the context: context.exit(); these calls will work properly even if there is already a context associated with the current thread.
...then after a custom initialization is
done, one can seal the shared scope by callingscriptableobject.sealobject(): sealedsharedscope.sealobject(); note that currently one needs to explicitly seal any additional properties he adds to the sealed shared scope since although after calling sealedsharedscope.sealobject(); it would no be possible to set the additional properties to different values, one still would be able to alter the object...
GCIntegration - SpiderMonkey Redirect 1
gc/cc interaction <to be
done later.> incremental gc incremental gc divides gc marking into time slices.
...
done naively, this technique can lead to reachable object not being marked.
Statistics API
a little bit of gc work is
done in each slice.
...the slices array describes how long each slice took and what work was
done during the slice.
JSAPI User Guide
a minimal example each of the three key elements described in the previous section requires a few jsapi calls: the runtime: use js_newruntime to create it and js_destroyruntime to clean it up when you're
done.
... when your application is
done with spidermonkey altogether, use js_shutdown to free any remaining cached resources.
Thread Sanitizer
in our codebase, this is
done using the moz_tsan_blacklist macro on the function definition.
...still, blacklisting should be
done very carefully so we won't miss important bugs.
Mozinfo
throughout mozmill and other mozilla python code, checking the underlying platform is
done in many different ways.
...because information is not consolidated, checks are not
done consistently, nor is it defined what we are checking for.
Mozilla Projects
mozinfo throughout mozmill and other mozilla python code, checking the underlying platform is
done in many different ways.
...because information is not consolidated, checks are not
done consistently, nor is it defined what we are checking for.
Setting up an update server
don't forget to restore the backup when you are
done.
...this can be
done most reliably with an enterprise policy.
Animated PNG graphics
24 dispose_op byte type of frame area disposal to be
done after rendering this frame.
... valid values for dispose_op are: value constant description 0 apng_dispose_op_none no disposal is
done on this frame before rendering the next; the contents of the output buffer are left as is.
Querying Places
for this reason, it is best to close a container as soon as you are
done with it, since it will give better performance.
...uri, title, time, icon...) // see : https://developer.mozilla.org/en/nsinavhistoryresultnode dump(node.title+ "\n"); } // close container when
done // see : https://developer.mozilla.org/en/nsinavhistorycontainerresultnode cont.containeropen = false; see also places query uris displaying places information using views ...
Retrieving part of the bookmarks tree
get the query and options objects all querying is
done through the history service.
...when you're
done, be sure to close the container to free up the resources.
Using the Places history service
if you are just doing a few changes, it is probably better to not use a batch since incremental updates are not
done.
... be sure to call endupdatebatch when you are
done or the ui will be permanently broken.
How to build an XPCOM component in JavaScript
the compilation can be
done using the gecko sdk.
...note: it doesn't do the work of creating your interface definition file or the type library for you, so you still have to go through those steps above if they haven't been
done.
Mozilla internal string guide
iterators because mozilla strings are always a single buffer, iteration over the characters in the string is
done using raw pointers: /** * find whether there is a tab character in `data` */ bool hastab(const nsastring& data) { const char16_t* cur = data.beginreading(); const char16_t* end = data.endreading(); for (; cur < end; ++cur) { if (char16_t('\t') == *cur) return true; } return false; } note that `end` points to the character after the end of the string buffer.
... once you are
done writing, call finish().
Receiving startup notifications
the important thing to note is that now instead of registering with the category manager programmatically as was
done in the past, you add lines to your chrome.manifest to let the application handle it for you.
...receiving startup notifications prior to gecko 2.0 (firefox 4) to receive startup notifications, one needs to register with the "app-startup" category using nsicategorymanager; having
done so, the component will receive these startup notifications, including: xpcom-startup sent when xpcom finishes starting up.
HOWTO
put the following at the end of your script: // do async processing // from <https://developer.mozilla.org/en/xpconnect/xpcshell/howto> print("doing async work"); gscript
done = false; var gthreadmanager = cc["@mozilla.org/thread-manager;1"] .getservice(ci.nsithreadmanager); var mainthread = gthreadmanager.currentthread; while (!gscript
done) mainthread.processnextevent(true); while (mainthread.haspendingevents()) mainthread.processnextevent(true); 2.
...both success and error callbacks, put: gscript
done = true; if you forget some condition where your script should exit but you don't add this statement, your script will hang (busy wait).
mozIThirdPartyUtil
this is
done as follows: if achannel is an nsihttpchannel and has the 'forceallowthirdpartycookie' property set, then: if auri is null, return false.
...this is
done as follows: obtain the uri of the principal associated with awindow.
nsIChannelEventSink
this callback can be
done from within asynconchannelredirect() (effectively making the call synchronous) or at some point later (making the call asynchronous).
... if the return value indicates that an error occurred, in which case an exception is thrown, the redirect is vetoed and no callback must be
done.
nsIDragService
method overview void enddragsession( in prbool a
donedrag ) ; void dragmoved(in long ax, in long ay); native code only!
... void enddragsession( in prbool a
donedrag ); parameters a
donedrag if a
donedrag is true, the drag has finished, otherwise the drag has just left the window.
nsIFocusManager
if astartelement is specified, then movement is
done relative to astartelement.
... if astartelement is null, then movement is
done relative to the currently focused element.
nsIHTMLEditor
if aproperty is not set on the selection, nothing is
done.
... void setparagraphformat( in astring aparagraphformat ); parameters aparagraphformat "p", "h1" to "h6", "address", "pre", or "blockquote" updatebaseurl() set the baseurl for the document to the current url but only if the page doesn't have a <base> tag this should be
done after the document url has changed, such as after saving a file this is used as base for relativizing link and image urls.
nsIMsgCustomColumnHandler
return value the string value that sorting will be
done with.
... return value the long value that sorting will be
done with.
nsIMsgFolder
d notifyfolderevent(in nsiatom event); void listdescendents(in nsisupportsarray descendents); void shutdown(in boolean shutdownchildren); void setinvfeditsearchscope(in boolean asearchthisfolder, in boolean asetonsubfolders); void copydatatooutputstreamforappend(in nsiinputstream aistream, in long alength, in nsioutputstream outputstream); void copydata
done(); void setjunkscoreformessages(in nsisupportsarray amessages, in acstring ajunkscore); void applyretentionsettings(); boolean fetchmsgpreviewtext([array, size_is (anumkeys)] in nsmsgkey akeystofetch, in unsigned long anumkeys, in boolean alocalonly, in nsiurllistener aurllistener); void addkeywordstomessages(in nsisupportsarray amessages, in acstring akeywords...
...ownchildren); setinvfeditsearchscope() void setinvfeditsearchscope(in boolean asearchthisfolder, in boolean asetonsubfolders); copydatatooutputstreamforappend() void copydatatooutputstreamforappend(in nsiinputstream aistream, in long alength, in nsioutputstream outputstream); copydata
done() void copydata
done(); setjunkscoreformessages() void setjunkscoreformessages(in nsisupportsarray amessages, in acstring ajunkscore); applyretentionsettings() void applyretentionsettings(); fetchmsgpreviewtext() get the beginning of the message bodies for the passed in keys and store them in the msg hdr property "preview".
nsINavHistoryResult
the viewer provides notifications to the controller when view events occur; this is
done using the nsinavhistoryresultviewobserver interface.
...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.
nsITransaction
transient transactions cannot be un
done or re
done by the transaction manager.
...can only be called on a transaction that was previously un
done.
nsITransactionList
the list returned is addref'd so it is up to the caller to release the transaction when it is
done.
...the transaction returned is addref'd so it is up to the caller to release the transaction when it is
done.
nsITransactionManager
listeners are notified whenever a transaction is
done, un
done, or re
done.
...this mode allows an application to execute and group together several independent transactions so they can be un
done with a single call to undotransaction().
NS_CStringContainerInit
with ns_cstringcontainerinit, the coder is required to call ns_cstringcontainerfinish when
done with the nscstringcontainer object.
... // call this function to release any memory owned by |str| when
done.
NS_StringContainerInit
with ns_stringcontainerinit, the coder is required to call ns_stringcontainerfinish when
done with the nsstringcontainer object.
... // be sure to call this function to release any memory owned by |str| when
done.
Using nsIDirectoryService
in the past, this was
done using nsifilelocator.
...this is
done by passing a directory to ns_initxpcom or, for embedding, as the first parameter to ns_initembedding.
Xptcall Porting Guide
such a test ought to be written, but this has not yet been
done.
...getting these ports
done is very important.
Filelink Providers
once this is
done, the field is accessible from within the implementation via the preferences api using the key mail.cloud_files.accounts.account_key.username where account_key is the value passed into the implementations init function.
... this function is called automatically once the dom content is
done loading, and is passed a single parameter - the provider instance whose data is being displayed.
MailNews Filters
filter execution is
done by evaluating the search terms using the core mailnews/base/search code, and then applying the filter hits when the search terms match.
...we also coalesce moves to the same destination folder, so that we can do them in one url/command to the server, and we playback those moves when the header download is
done.
Mail composition back end
pizzarro <rhp@netscape.com> contents overview sending messages nsimsgsend sending listener interfaces nsimsgsendlistener nsimsgcopyservicelistener copy operations copy to sent folder drafts templates "send later" sending unsent messages sending unsent messages listener quoting sample programs overview i've
done considerable work in the past few weeks reorganizing the mail composition back end, so i thought it would be helpful to put together a small doc on the new interfaces and how one can use them.
...the determiniation of which folder is the "sent" folder for the user is
done by a call to getfolderswithflag() and the message store will control this user defined preference.
Virtualenv
using virtualenv once you have virtualenv installed, you can make virtual environments: > virtualenv tmp new python executable in tmp/bin/python installing setuptools............
done.
... installing pip...............
done.
Using Objective-C from js-ctypes
it uses the default system voice and waits until the speaking is
done.
... this example uses a busy loop, and thus, firefox won't respond until the speaking is
done.
Standard OS Libraries
although jni is
done completely through js-ctypes, a jsm was created to abstract away the js-ctypes so developers can focus on the jni aspect.
... therefore elaboration on this technique is not
done in the js-ctypes section but it is
done in the jni.jsm article.
Library
you need to call this once you're
done using the library.
...this would be
done like this: var objc = ctypes.open(ctypes.libraryname('objc')); objc.declare('_nsconcreteglobalblock', ctypes.voidptr_t); see also ...
ctypes
this is
done for compatibility's sake.
...this is
done for compatibility's sake.
AudioNode - Web APIs
the exact processing
done varies from one audionode to another but, in general, a node reads its inputs, does some audio-related processing, and generates new values for its outputs, or simply lets the audio pass through (for example in the analysernode, where the result of the processing is accessed separately).
...while the actual processing is
done internally by the browser and cannot be altered, you could write a wrapper around an audio node to provide custom properties and methods.
Background Tasks API - Web APIs
we'll use that to determine if we should update the scroll position to ensure that the log stays at the end when we're
done adding content to it.
... running tasks now that we've got the task management and display maintenance code
done, we can actually start setting up code to run tasks that get work
done.
Manipulating video using canvas - Web APIs
in the real world, you would probably schedule this to be
done based on knowledge of the video's frame rate.
... the resulting image looks like this: this is
done repeatedly as the video plays, so that frame after frame is processed and displayed with the chroma-key effect.
Basic usage of canvas - Web APIs
we'll see how this is
done in a dedicated chapter of this tutorial.
...nvas.getcontext) { var ctx = canvas.getcontext('2d'); } } </script> <style type="text/css"> canvas { border: 1px solid black; } </style> </head> <body onload="draw();"> <canvas id="tutorial" width="150" height="150"></canvas> </body> </html> the script includes a function called draw(), which is executed once the page finishes loading; this is
done by listening for the load event on the document.
Using images - Web APIs
this is
done simply by looping and placing the scaled images at different positions.
...scaling is probably best not
done if you've got some text in it which needs to remain legible.
ConstantSourceNode.offset - Web APIs
with the linkage above in place, that can be
done using this simple event handler: function handleclickevent(event) { volumeslidercontrol.value = constantsource.offset.value; } all this function has to do is fetch the current value of the slider control we're using to control the paired nodes' gains, then store that value into the constantsourcenode's offset parameter.
... that's
done by simply changing the contents of its audioparam.value property.
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
this article explores when difficulties can occur, and looks at what can be
done to mitigate resulting problems.
... spaces in between inline and inline-block elements let's move on to look at a few issues that can arise due to whitespace, and what can be
done about them.
Element: auxclick event - Web APIs
this can be
done by preventing the default behaviour of the mousedown or pointerdown event.
...instead, this can be
done by preventing the default behavior of the contextmenu event.
Using Fetch - Web APIs
async function* maketextfilelineiterator(fileurl) { const utf8decoder = new textdecoder('utf-8'); const response = await fetch(fileurl); const reader = response.body.getreader(); let { value: chunk,
done: reader
done } = await reader.read(); chunk = chunk ?
... utf8decoder.decode(chunk) : ''; const re = /\n|\r|\r\n/gm; let startindex = 0; let result; for (;;) { let result = re.exec(chunk); if (!result) { if (reader
done) { break; } let remainder = chunk.substr(startindex); ({ value: chunk,
done: reader
done } = await reader.read()); chunk = remainder + (chunk ?
FileReader - Web APIs
done 2 the entire read request has been completed.
...upon return, the readystate will be
done.
FileHandle API - Web APIs
such monitoring can be
done using the filerequest.onprogress event handler.
... secured write operation for performance reasons, write (and read) operations are
done in memory.
Using the Gamepad API - Web APIs
we have
done this below using window.setinterval(); once the object is available the gamepad info is outputted, the game loop is started, and the interval is cleared using window.clearinterval().
... after all this is
done, we use our requestanimationframe() to request the next animation frame, running gameloop() again.
Drag Operations - Web APIs
to make other html elements draggable, three things must be
done: set the draggable="true" on the element that you wish to make draggable.
...the dragleave event will always fire, even if the drag is cancelled, so you can always ensure that any insertion point cleanup can be
done during this event.
Intersection Observer API - Web APIs
it should operate as quickly as possible; if anything time-consuming needs to be
done, use window.requestidlecallback().
...* 100)) + "%"; box.queryselector(".topleft").innerhtml = visiblepct; box.queryselector(".topright").innerhtml = visiblepct; box.queryselector(".bottomleft").innerhtml = visiblepct; box.queryselector(".bottomright").innerhtml = visiblepct; }); } startup(); clipping and the intersection rectangle the browser computes the final intersection rectangle as follows; this is all
done for you, but it can be helpful to understand these steps in order to better grasp exactly when intersections will occur.
Notifications API - Web APIs
first, the user needs to grant the current origin permission to display system notifications, which is generally
done when the app or site initialises, using the notification.requestpermission() method.
... this should be
done in response to a user gesture, such as clicking a button, for example: btn.addeventlistener('click', function() { let promise = notification.requestpermission(); // wait for permission }) this is not only best practice — you should not be spamming users with notifications they didn't agree to — but going forward browsers will explicitly disallow notifications not triggered in response to a user gesture.
PannerNode - Web APIs
retrieval is
done by accessing, for example, pannernode.positionx.
... while setting the same property is
done with pannernode.positionx.value.
Using the Performance API - Web APIs
additionally, there must be a way to create a timestamp for a specific point in time; this is
done with the now() method.
... function calculate_time() { var starttime; var endtime; starttime = performance.now(); do_task(); endtime = performance.now(); return (endtime - starttime); } serializing the performance object json serialization of the performance object is
done via the tojson() method.
ProgressEvent() - Web APIs
lengthcomputable optional is a boolean flag indicating if the total work to be
done, and the amount of work already
done, by the underlying process is calculable.
...the ratio of work
done can be calculated with the property and progressevent.total.
ProgressEvent.initProgressEvent() - Web APIs
lengthcomputable is a boolean flag indicating if the total work to be
done, and the amount of work already
done, by the underlying process is calculable.
...the ratio of work
done can be calculated with the property and progressevent.total.
ProgressEvent - Web APIs
progressevent.lengthcomputable read only is a boolean flag indicating if the total work to be
done, and the amount of work already
done, by the underlying process is calculable.
...the ratio of work
done can be calculated with the property and progressevent.total.
RTCDataChannel.bufferedAmount - Web APIs
this only includes data buffered by the user agent itself; it doesn't include any framing overhead or buffering
done by the operating system or network hardware.
... the user 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.
RTCPeerConnection.setConfiguration() - Web APIs
two potential scenarios in which this might be
done: the rtcpeerconnection was instantiated without specifying any ice servers.
... example in this example, it has already been determined that ice restart is needed, and that negotiation needs to be
done using a different ice server.
RTCPeerConnection.setLocalDescription() - Web APIs
this deprecated form of the method returns instantaneously without waiting for the actual setting to be
done: in case of success, the successcallback will be called; in case of failure, the errorcallback will be called.
...we can then send the newly-created offer along to the other peer using the signaling server, which here is
done by calling a function called signalremotepeer().
RTCPeerConnection.setRemoteDescription() - Web APIs
this deprecated form of the method returns instantaneously without waiting for the actual setting to be
done: in case of success, the successcallback will be called; in case of failure, the errorcallback will be called.
...when our promise fulfillment handler is called, indicating that this has been
done, we create a stream, add it to the connection, then create an sdp answer and call setlocaldescription() to set that as the configuration at our end of the call before forwarding that answer to the caller.
RTCPeerConnection - Web APIs
movetrack() method tells the local end of the connection to stop sending media from the specified track, without actually removing the corresponding rtcrtpsender from the list of senders as reported by rtcpeerconnection.getsenders().restartice()the webrtc api's rtcpeerconnection interface offers the restartice() method to allow a web application to easily request that ice candidate gathering be re
done on both ends of the connection.setconfiguration() the rtcpeerconnection.setconfiguration() method sets the current configuration of the rtcpeerconnection based on the values included in the specified rtcconfiguration object.
... constant description "new" the peer connection was just created and hasn't
done any networking yet.
ReadableStream - Web APIs
fetch("https://www.example.org/").then((response) => { const reader = response.body.getreader(); const stream = new readablestream({ start(controller) { // the following function handles each data chunk function push() { // "
done" is a boolean and value a "uint8array" reader.read().then(({
done, value }) => { // is there no more data to read?
... if (
done) { // tell the browser that we have finished sending data controller.close(); return; } // get the data and send it to the browser via the controller controller.enqueue(value); push(); }); }; push(); } }); return new response(stream, { headers: { "content-type": "text/html" } }); }); specifications specification status comment streamsthe definition of 'readablestream' in that specification.
ReadableStreamBYOBReader.read() - Web APIs
the different possibilities are as follows: if a chunk is available, the promise will be fulfilled with an object of the form { value: thechunk,
done: false }.
... if the stream becomes closed, the promise will be fulfilled with an object of the form { value: undefined,
done: true }.
ReadableStreamDefaultReader - Web APIs
fetch("https://www.example.org/").then((response) => { const reader = response.body.getreader(); const stream = new readablestream({ start(controller) { // the following function handles each data chunk function push() { // "
done" is a boolean and value a "uint8array" return reader.read().then(({
done, value }) => { // is there no more data to read?
... if (
done) { // tell the browser that we have finished sending data controller.close(); return; } // get the data and send it to the browser via the controller controller.enqueue(value); push(); }); }; push(); } }); return new response(stream, { headers: { "content-type": "text/html" } }); }); specifications specification status comment streamsthe definition of 'readablestreamdefaultreader' in that specification.
Canvas size and WebGL - Web APIs
this is
done by assigning the width and height properties of the canvas to the values of the clientwidth and clientheight properties, respectively.
... in contrast, no such assignment is
done for the second canvas.
Color masking - Web APIs
but rendering is
done every second, using the timer.
...this means that graphics operations in webgl are
done in a certain order, where the output of each operation serves as the input of the next.
Lifetime of a WebRTC session - Web APIs
it’s so big that years ago, smart people saw how big it was, how fast it was growing, and the limitations of the 32-bit ip addressing system, and realized that something had to be
done before we ran out of addresses to use, so they started working on designing a new 64-bit addressing system.
...it'd be very high latency but it could be
done.
A simple RTCDataChannel sample - Web APIs
this is
done by calling remoteconnection.rtcpeerconnection.setremotedescription().
...once this is
done, our handlereceivemessage() method will be called each time data is received by the remote peer, and the handlereceivechannelstatuschange() method will be called any time the channel's connection state changes, so we can react when the channel is fully opened and when it's closed.
Using DTMF with WebRTC - Web APIs
note: this example is obviously somewhat contrived, since normally the two rtcpeerconnection objects would exist on different devices, and signaling would be
done over the network instead of it all being simply linked up inline as it is here.
...this is
done by stopping each stream on both the caller and the receiver by iterating over each rtcpeerconnection's track list (as returned by its gettracks() method) and calling each track's stop() method.
Fundamentals of WebXR - Web APIs
this is
done by specifying the appropriate session mode string for the kind of session you want to create.
...this is
done without digitally reproducing the world, as would be necessary with a full headset.
Web audio spatialization basics - Web APIs
this is
done by setting the different properties of the pannernode object instance in relation to that movement, to emulate spacialization.
...we rolled our own in this article to give you an idea of how it works, but you'll save a lot of time by taking advantage of work others have
done before you.
Window.open() - Web APIs
the window creation and the loading of the referenced resource are
done asynchronously.
...in any case, if your code is well
done, it should not interfere with the user's final choice but rather merely offer him more choices, more ways to open links and more power to the tool he's using (a browser).
WritableStream.WritableStream() - Web APIs
if this process is to be
done asynchronously, it can return a promise to signal success or failure.
... the defaultwriter.ready property returns a promise that resolves when the sink (the first property of the writablestream constructor) is
done writing data.
WritableStreamDefaultWriter.ready - Web APIs
the first uses ready to ensure that the writablestream is
done writing and thus able to receive data before sending a binary chunk.
... the second also checks whether the the writablestream is
done writing, but this time because the writing must be finished before the writer can be closed.
HTML in XMLHttpRequest - Web APIs
this test file is small and is not well-formed xml: <title>&&<</title> if the file is named detect.html, the following function can be used for detecting html parsing support: function detecthtmlinxhr(callback) { if (!window.xmlhttprequest) { window.settimeout(function() { callback(false); }, 0); return; } var
done = false; var xhr = new window.xmlhttprequest(); xhr.onreadystatechange = function() { if (this.readystate == 4 && !
done) {
done = true; callback(!!(this.responsexml && this.responsexml.title && this.responsexml.title == "&&<")); } } xhr.onabort = xhr.onerror = function() { if (!
done) {
done = true; callback(false); } } try { xhr.open("get", ...
..."detect.html"); xhr.responsetype = "document"; xhr.send(); } catch (e) { window.settimeout(function() { if (!
done) {
done = true; callback(false); } }, 0); } } the argument callback is a function that will be called asynchronously with true as the only argument if html parsing is supported and false as the only argument if html parsing is not supported.
XMLHttpRequest.responseText - Web APIs
you know the entire content has been received when the value of readystate becomes xmlhttprequest.
done (4), and status becomes 200 ("ok").
... example var xhr = new xmlhttprequest(); xhr.open('get', '/server', true); // if specified, responsetype must be empty string or "text" xhr.responsetype = 'text'; xhr.onload = function () { if (xhr.readystate === xhr.
done) { if (xhr.status === 200) { console.log(xhr.response); console.log(xhr.responsetext); } } }; xhr.send(null); specifications specification status comment xmlhttprequest living standard whatwg living standard ...
XRInputSource - Web APIs
usage notes actions and the target ray if the device provides an indication of the direction in which it is pointed, this is
done using a target ray.
...finally, once that is
done—or if the user aborts the action—a selectend event is sent to the session object.
XRReferenceSpace - Web APIs
*/ }); the other situation in which you may need to acquire a new reference space is if you need to move the origin to a new position; this is commonly
done, for example, when your project allows the user to move through the environment using input devices such as the keyboard, mouse, touchpad, or game controls that are not connected through the xr device.
...this is easily
done using the getoffsetreferencespace() method.
ARIA Test Cases - Accessibility
this must be
done in order to determine where to file a bug (browser or at).
... screen magnifiers should give indication (if this is not
done visually anyway).
Alerts - Accessibility
the form first, please read about the aria-required technique if you have not
done so, as this technique expands upon that.
... tbd: let's rethink this -- personally, i think setting focus might be good if
done without causing a keyboard trap.
Architecture - Accessibility
this is
done for backward compatibility with older msaa clients which didn't have access to a text interface.
...t object for that offset (see a above), then set the current offset to -1, and go to step 2 if ch == 0 then we must determine whether we're on a hard line break: if the current accessible's ia2 role is section, heading or paragraph then we are on a hard line break, so stop get the offset in the parent text for this object (see b above), and then repeat step (c)2 above
done (d) to get the next word or line: look one character ahead.
Mastering Wrapping of Flex Items - CSS: Cascading Style Sheets
flex line wrapping is re-
done after collapsing, however, so the cross-size of a flex container with multiple lines might or might not change.” - collapsed items this behaviour is useful if you want to target flex items using javascript to show and hide content for example.
... when dealing with multiple-line flex containers however you need to understand that the wrapping is re-
done after collapsing.
break-after - CSS: Cascading Style Sheets
to determine if a break must be
done, the following rules are applied: if any of the three concerned values is a forced break value (always, left, right, page, column, or region), it has precedence.
...
donec eu vulputate nibh.
break-before - CSS: Cascading Style Sheets
to determine if a break must be
done, the following rules are applied: if any of the three concerned values is a forced break value (always, left, right, page, column, or region), it has precedence.
...
donec eu vulputate nibh.
<length> - CSS: Cascading Style Sheets
this is
done by anchoring one of the units to a physical unit, and then defining the others relative to it.
... the anchor is
done differently for low-resolution devices, such as screens, versus high-resolution devices, such as printers.
text-emphasis-position - CSS: Cascading Style Sheets
in html, this can be
done with the following style rule: ruby { text-emphasis: none; } preferring emphasis marks over ruby some other editors prefer to hide ruby when they conflict with emphasis marks.
... in html, this can be
done with the following pattern: em { text-emphasis: dot; /* set text-emphasis for <em> elements */ } em rt { display: none; /* hide ruby inside <em> elements */ } specifications specification status comment css text decoration module level 3the definition of 'text-emphasis' in that specification.
HTML5 Parser - Developer guides
parsing is now
done in a separate thread from firefox’s main ui thread, improving overall browser responsiveness.
...if the call happened after the parser was
done, the inserted content replaced the document.
<dfn>: The Definition element - HTML: Hypertext Markup Language
this can be
done by using the <dfn> and <abbr> elements in tandem, like this: html <p>the <dfn><abbr title="hubble space telescope">hst</abbr></dfn> is among the most productive scientific instruments ever constructed.
... it has been in orbit for over 20 years, scanning the sky and returning data and photographs of unprecedented quality and detail.</p> <p>indeed, the <abbr title="hubble space telescope">hst</abbr> has arguably
done more to advance science than any device ever built.</p> note the <abbr> element nested inside the <dfn>.
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
as all input types except for input of type hidden are focusable, this attribute should not be used on form controls, because doing so would require the management of the focus order for all elements within the document with the risk of harming usability and accessibility if
done incorrectly.
... permitted values are: go,
done, next, search, and send.
<sup>: The Superscript element - HTML: Hypertext Markup Language
for example, to style the wordmark of a business or product which uses a raised baseline should be
done using css (most likely vertical-align) rather than <sup>.
... this would be
done using, for example, vertical-align: super or, to shift the baseline up 50%, vertical-align: 50%.
Data URLs - HTTP
echo -n hello|base64 # outputs to console: agvsbg8= echo -n hello>a.txt base64 a.txt # outputs to console: agvsbg8= base64 a.txt>b.txt # outputs to file b.txt: agvsbg8= encoding on microsoft windows encoding on windows can be
done through powershell or some dedicated tool.
... it can even be
done via bash base64 utility (see section encoding on a unix system) if wsl is activated.
HTTP conditional requests - HTTP
often this is
done using an etag with the md5 hash of the resource (or a derivative).
... besides the setting of the validators on the server side, this mechanism is transparent: all browsers manage a cache and send such conditional requests without any special work to be
done by web developers.
Index - HTTP
browsers set adequate values for this header depending on the context where the request is
done: when fetching a css stylesheet a different value is set for the request than when fetching an image, video or a script.
...if the value sent is keep-alive, the connection is persistent and not closed, allowing for subsequent requests to the same server to be
done.
SyntaxError: missing ) after condition - JavaScript
if (
done is true) { console.log("we are
done!"); } // syntaxerror: missing ) after condition instead you need to use a correct comparison operator.
... for example: if (
done === true) { console.log("we are
done!"); } ...
Array.from() - JavaScript
repeat, while k < len… or while iterator is
done (also steps a - h) while (k < len || isiterator) { var item = getitem(k); var kvalue = isiterator ?
... item.value : item; if (isiterator && item.
done) { return a; } else { if (mapfn) { a[k] = typeof t === 'undefined' ?
Array.prototype.values() - JavaScript
array.prototype.values === array.prototype[symbol.iterator] //true iteration using .next() var arr = ['a', 'b', 'c', 'd', 'e']; var iterator = arr.values(); iterator.next(); // object { value: "a",
done: false } iterator.next().value; // "b" iterator.next()["value"]; // "c" iterator.next(); // object { value: "d",
done: false } iterator.next(); // object { value: "e",
done: false } iterator.next(); // object { value: undefined,
done: true } iteraror.next().value; // undefined one-use: the array iterator object is one use or tempor...
...ary object example: var arr = ['a', 'b', 'c', 'd', 'e']; var iterator = arr.values(); for (let letter of iterator) { console.log(letter); } //"a" "b" "c" "d" "e" for (let letter of iterator) { console.log(letter); } // undefined reason: when next().
done=true or currentindex>length the for..of loop ends.
Generator.prototype.return() - JavaScript
function* gen() { yield 1; yield 2; yield 3; } const g = gen(); g.next(); // { value: 1,
done: false } g.return('foo'); // { value: "foo",
done: true } g.next(); // { value: undefined,
done: true } if return(value) is called on a generator that is already in "completed" state, the generator will remain in "completed" state.
... function* gen() { yield 1; yield 2; yield 3; } const g = gen(); g.next(); // { value: 1,
done: false } g.next(); // { value: 2,
done: false } g.next(); // { value: 3,
done: false } g.next(); // { value: undefined,
done: true } g.return(); // { value: undefined,
done: true } g.return(1); // { value: 1,
done: true } specifications specification ecmascript (ecma-262)the definition of 'generator.prototype.return' in that specification.
Intl.Collator.supportedLocalesOf() - JavaScript
examples using supportedlocalesof assuming a runtime that supports in
donesian and german but not balinese in collation, supportedlocalesof returns the in
donesian and german language tags unchanged, even though pinyin collation is not used with in
donesian and a specialized german for in
donesia is unlikely to be supported.
... note the specification of the "lookup" algorithm here — a "best fit" matcher might decide that in
donesian is an adequate match for balinese since most balinese speakers also understand in
donesian, and therefore return the balinese language tag as well.
Intl.DateTimeFormat.supportedLocalesOf() - JavaScript
examples using supportedlocalesof assuming a runtime that supports in
donesian and german but not balinese in date and time formatting, supportedlocalesof returns the in
donesian and german language tags unchanged, even though pinyin collation is neither relevant to date and time formatting nor used with in
donesian, and a specialized german for in
donesia is unlikely to be supported.
... note the specification of the "lookup" algorithm here — a "best fit" matcher might decide that in
donesian is an adequate match for balinese since most balinese speakers also understand in
donesian, and therefore return the balinese language tag as well.
Intl.DisplayNames.supportedLocalesOf() - JavaScript
examples using supportedlocalesof assuming a runtime that supports in
donesian and german but not balinese in date and time formatting, supportedlocalesof returns the in
donesian and german language tags unchanged, even though pinyin collation is neither relevant to date and time formatting nor used with in
donesian, and a specialized german for in
donesia is unlikely to be supported.
... note the specification of the "lookup" algorithm here — a "best fit" matcher might decide that in
donesian is an adequate match for balinese since most balinese speakers also understand in
donesian, and therefore return the balinese language tag as well.
Intl.ListFormat.supportedLocalesOf() - JavaScript
examples using supportedlocalesof assuming a runtime that supports in
donesian and german but not balinese in date and time formatting, supportedlocalesof returns the in
donesian and german language tags unchanged, even though pinyin collation is neither relevant to date and time formatting nor used with in
donesian, and a specialized german for in
donesia is unlikely to be supported.
... note the specification of the "lookup" algorithm here — a "best fit" matcher might decide that in
donesian is an adequate match for balinese since most balinese speakers also understand in
donesian, and therefore return the balinese language tag as well.
Intl.NumberFormat.supportedLocalesOf() - JavaScript
examples using supportedlocalesof assuming a runtime that supports in
donesian and german but not balinese in number formatting, supportedlocalesof returns the in
donesian and german language tags unchanged, even though pinyin collation is neither relevant to number formatting nor used with in
donesian, and a specialized german for in
donesia is unlikely to be supported.
... note the specification of the "lookup" algorithm here — a "best fit" matcher might decide that in
donesian is an adequate match for balinese since most balinese speakers also understand in
donesian, and therefore return the balinese language tag as well.
Intl.PluralRules.supportedLocalesOf() - JavaScript
examples using supportedlocalesof() assuming a runtime that supports in
donesian and german but not balinese in plural formatting, supportedlocalesof returns the in
donesian and german language tags unchanged, even though pinyin collation is neither relevant to plural formatting nor used with in
donesian, and a specialized german for in
donesia is unlikely to be supported.
... note the specification of the lookup algorithm here — a best fit matcher might decide that in
donesian is an adequate match for balinese since most balinese speakers also understand in
donesian, and therefore return the balinese language tag as well.
Intl.RelativeTimeFormat.supportedLocalesOf() - JavaScript
examples using supportedlocalesof assuming a runtime that supports in
donesian and german but not balinese in date and time formatting, supportedlocalesof returns the in
donesian and german language tags unchanged, even though pinyin collation is neither relevant to date and time formatting nor used with in
donesian, and a specialized german for in
donesia is unlikely to be supported.
... note the specification of the "lookup" algorithm here — a "best fit" matcher might decide that in
donesian is an adequate match for balinese since most balinese speakers also understand in
donesian, and therefore return the balinese language tag as well.
eval() - JavaScript
this can be
done with eval(): var obj = { a: 20, b: 30 }; var propname = getpropname(); // returns "a" or "b" eval( 'var result = obj.' + propname ); however, eval() is not necessary here.
..."a.b.c" eval( 'var result = obj.' + proppath ); avoiding eval() here could be
done by splitting the property path and looping through the different properties: function getdescendantprop(obj, desc) { var arr = desc.split('.'); while (arr.length) { obj = obj[arr.shift()]; } return obj; } var obj = {a: {b: {c: 0}}}; var proppath = getproppath(); // returns e.g.
Spread syntax (...) - JavaScript
without spread syntax, this is
done as: const arr1 = [0, 1, 2]; const arr2 = [3, 4, 5]; // append all items from arr2 onto arr1 arr1 = arr1.concat(arr2); with spread syntax this becomes: let arr1 = [0, 1, 2]; let arr2 = [3, 4, 5]; arr1 = [...arr1, ...arr2]; // arr1 is now [0, 1, 2, 3, 4, 5] // note: not to use const otherwise, it will give typeerror (invalid assignment) array.prototype.unshift() is often used to insert an ...
...without spread syntax, this is
done as: const arr1 = [0, 1, 2]; const arr2 = [3, 4, 5]; // prepend all items from arr2 onto arr1 array.prototype.unshift.apply(arr1, arr2) // arr1 is now [3, 4, 5, 0, 1, 2] with spread syntax, this becomes: let arr1 = [0, 1, 2]; let arr2 = [3, 4, 5]; arr1 = [...arr2, ...arr1]; // arr1 is now [3, 4, 5, 0, 1, 2] note: unlike unshift(), this creates a new arr1, and does not modify the original arr1 array in-place.
for await...of - JavaScript
examples iterating over async iterables you can also iterate over an object that explicitly implements async iterable protocol: const asynciterable = { [symbol.asynciterator]() { return { i: 0, next() { if (this.i < 3) { return promise.resolve({ value: this.i++,
done: false }); } return promise.resolve({
done: true }); } }; } }; (async function() { for await (let num of asynciterable) { console.log(num); } })(); // 0 // 1 // 2 iterating over async generators since the return values of async generators conform to the async iterable protocol, they can be looped using for await...of.
... async function* streamasynciterable(stream) { const reader = stream.getreader(); try { while (true) { const {
done, value } = await reader.read(); if (
done) { return; } yield value; } } finally { reader.releaselock(); } } // fetches data from url and calculates response size using the async generator.
for...of - JavaScript
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.
...} iterating over other iterable objects you can also iterate over an object that explicitly implements the iterable protocol: const iterable = { [symbol.iterator]() { return { i: 0, next() { if (this.i < 3) { return { value: this.i++,
done: false }; } return { value: undefined,
done: true }; } }; } }; for (const value of iterable) { console.log(value); } // 0 // 1 // 2 difference between for...of and for...in both for...in and for...of statements iterate over something.
Transitioning to strict mode - JavaScript
new runtime errors javascript used to silently fail in contexts where what was
done was an error.
...fortunately, this careful review can be
done gradually down the function granularity.
Codecs used by WebRTC - Web media technologies
this is
done by sending an a=imageattr sdp attribute to indicate the maximum resolution that is acceptable.
... that's
done for each transceiver on the rtcpeerconnection; once all of the transceivers have been updated, we call the onnegotiationneeded event handler, which will create a new offer, update the local description, send the offer along to the remote peer, and so on, thereby triggering the renegotiation of the connection.
Animation performance and frame rate - Web Performance
animation on the web can be
done via svg, javascript, including <canvas> and webgl, css animation, <video>, animated gifs and even animated pngs and other image types.
...animation can help make a site feel faster and responsive, but animations can also make a site feel slower and janky if not
done correctly.
Performance fundamentals - Web Performance
this is
done by avoiding intermediate surfaces where they would create overhead (such as per-application "back buffers" in many other operating systems), and by using special memory for graphics buffers that can be directly accessed by the compositor hardware.
...in many cases, you can actually use css transitions to get the job
done.
Example - SVG: Scalable Vector Graphics
this is
done completely in w3c standards–xhtml, svg, and javascript–no flash or any vendor-specific extensions.
... </p> <p> this is
done completely in w3c standards–xhtml, svg and javascript–no flash or any vendor specific extensions. currently, this will work in mozilla firefox version 1.5 and above.
Navigator.mozNotification - Archive of obsolete content
permissions when using notifications in an open web app, be sure to add the desktop-notification permission in your manifest file: "permissions": { "desktop-notification": {} } usage notes in firefox 22+, the instantiation of a new notification should be
done with the notification object by calling new notification(title, options).
page-mod - Archive of obsolete content
modifications already made to open documents by content scripts will not be un
done, but stylesheets added by contentstyle or contentstylefile, will be unregistered immediately.
net/xhr - Archive of obsolete content
this can probably be
done most securely by white-listing the protocols that can be used in the url passed to the open() method, and limiting them to http:, https:, and possibly a special scheme that can be used to access the add-on's packaged, read-only resources.
Bookmarks - Archive of obsolete content
initiating the bookmarks service as is the case with nearly all interfaces, before you can use the bookmarks service, you need to get access to it: var bmsvc = components.classes["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(components.interfaces.nsinavbookmarksservice); creating a bookmark folder creating a new bookmark folder is
done using the nsinavbookmarksservice.createfolder() method.
HTML to DOM - Archive of obsolete content
e; frame.webnavigation.allowsubframes = false; // listen for load frame.addeventlistener("load", function (event) { // the document of the html in the dom var doc = event.originaltarget; // skip blank page or frame if (doc.location.href == "about:blank" || doc.defaultview.frameelement) return; // do something with the dom of doc alert(doc.location.href); // when
done remove frame or set location "about:blank" settimeout(function (){ var frame = document.getelementbyid("sample-frame"); // remove frame // frame.destroy(); // if using browser element instead of iframe frame.parentnode.removechild(frame); // or set location "about:blank" // frame.contentdocument.location.href = "about:blank"; },10); }, true); } /...
Miscellaneous - Archive of obsolete content
and here's how it's
done postdata.queryinterface(ci.nsiseekablestream).seek(ci.nsiseekablestream.ns_seek_set, 0); var stream = cc["@mozilla.org/binaryinputstream;1"].createinstance(ci.nsibinaryinputstream); stream.setinputstream(postdata); var postbytes = stream.readbytearray(stream.available()); var poststr = string.fromcharcode.apply(null, postbytes); //do anything to your poststr alert(poststr); getting a string f...
Toolbar - Archive of obsolete content
this should only be
done on the first run of your add-on after installation so that if the user decides to remove your button, it doesn't show up again every time they start the application.
Displaying web content in an extension without security issues - Archive of obsolete content
this can be
done as well, by placing the event handler on the frame tag (meaning that it is outside the restricted document and can execute without restrictions): <iframe type="content" onclick="handleclick(event);"/> and the event handler would look like that: function handlebrowserclick(event) { // only react to left mouse clicks if (event.button != 0) return; // default action on link clicks is to ...
Extension Packaging - Archive of obsolete content
in the apache http server, this can be
done by adding the following directive to the configuration file or .htaccess: addtype application/x-xpinstall .xpi install extension files directly if you know the location of the application (if you are installing an extension as part of the application installer, for example), you can install the extension files directly to <appdir>/extensions/<extensionid>.
Promises - Archive of obsolete content
} } }); can be converted to a pure promise-based equivalent as such: request("login", { username: user, password: password }) .then(response => { if (response.messages) return publish({ username: user, messages: response.messages }); }) .then(null, (e) => { self.reporterror("publication failed", e); }); file io file io in add-ons should be
done via the os.file api, which provides a simple, but powerful, interface for reading, writing, and manipulating both text and binary files.
Search Extension Tutorial (Draft) - Archive of obsolete content
catch (e) {} } // observer called after our engine has been successfully added function searchobserver(engine, topic, data) { if (data != "engine-added") return; engine.queryinterface(ci.nsisearchengine); if (engine.name == engine_details.name) { // remove our observer now that we're
done with it.
JXON - Archive of obsolete content
s { script: "<script>alert(\"yes\")<\/script>" } dates are created as new date objects <root>2006-12-25</root> becomes new date(2006, 12 - 1, 25) attributes and comments are shown as comments (for testing purposes): <!--testing--><root><test version="1.0">123</test></root> becomes /* testing */ { test /* @version = "1.0" */ : 123} a bit of indentation is
done, to keep things legible note: our algorithms comply with the point 3 (but without month decrease).
Making a Mozilla installation modifiable - Archive of obsolete content
on unix-like operating systems with bash-like shells, you can run the following command within that directory to accomplish this task: for file in *.jar; do unzip $file;
done on operating systems with dos-like shells, the following command accomplishes this task: for %file in (*.jar); do unzip %file note that there are platform-specific files — en-mac.jar, en-unix.jar, and en-win.jar — in that directory.
Editor Embedding Guide - Archive of obsolete content
the first parameter is the nsidomwindow you just retrieved, the second is the editor type you want to create, and the third is whether you want the window editable immediately or when the document is
done loading.
Fast Graphics Performance With HTML - Archive of obsolete content
use <div style="overflow:scroll><div style="background:white"><p>this is some text</p><p>and some more</p></div></div> instead of <div style="overflow:scroll><p>this is some text</p><p>and some more</p></div> animating 'transform' and 'opacity' properties can be
done with the compositor which makes them efficient to animate ...
Modularization techniques - Archive of obsolete content
nsresult getfoo(ifoo **afoores) { if (afoores == null) { return ns_error_null_pointer; } *afoores = mfoo; ns_addref(*afoores); return ns_ok; } remember that this applies to the interfaces returned by queryinterface(), createinstance() and ns_newx(), and you must call release() on them when you are
done to avoid memory leaks.
Build - Archive of obsolete content
the contents of the file should look something like this : mk_add_options moz_co_project=xulrunner mk_add_options moz_objdir=@topsrcdir@/mozilla-obj ac_add_options --enable-application=xulrunner ac_add_options --disable-debug ac_add_options --enable-optimize ac_add_options --disable-tests ac_add_options --disable-javaxpcom build xulrunner : make -f client.mk build once the build is
done, there will be a directory called mozilla-obj.
Priority Content - Archive of obsolete content
started: scripting plugins: macromedia flash original: scripting plugins: macromedia flash wiki location: scripting plugins: macromedia flash migrators: dependant on (these parts need to be
done, put your name down) completed: soap in netscape gecko-based browsers original: soap in netscape gecko-based browsers wiki location: soap in gecko-based browsers migrators: doron rosenberg in progress: css support charts original: css support charts and archive.org mirror wiki location: css support charts migrators: serge k.
Space Manager Detailed Design - Archive of obsolete content
check if the occupied space rect (adjusted) is empty, if so, return an error (note: this could be
done earlier, or prevented by the caller) allocate a new bandrect instance with the rect and frame as constructor arguments, and insert it into the collection via insertbandrect insertbandrect: internal method to insert a band rect into the bandlist in the correct location.
XML in Mozilla - Archive of obsolete content
w3c recommendation p3p wsdl (no longer supported) w3c note web services xbl mozilla's xbl reference xul mozilla's xul reference roadmap next big tasks would include support for xpointer xpointer() scheme (bug 32832), xinclude (bug 201754), xml catalogs (bug 98413), xforms (bug 97806; work being
done on implementing this as an extension), validating parser (bug 196355) and xml schemas.
Install script template - Archive of obsolete content
errorcode="+myregstatus); return myregstatus; } } // ok were
done, let's write info about our plugin, path, productname, etc // write a subkey to mozillaplugins with our plid //var mysetstrrc = winreg.setvaluestring(plidpath, plidid, dllabsolutepath); mymozillapluginpath = plidpath+"\\"+plidid; // for instance.
A XUL Bestiary - Archive of obsolete content
it's cross-platform, and standards-based, and yet in some way, the event handlers written once in javascript and living in the xul interface are getting very serious things
done down in the application core.
How to implement a custom XUL query processor component - Archive of obsolete content
ces, arootnode, aistrusted, abuilder, ashoulddelaybuilding) { // todo: parse the adatasources variable // for now, ignore everything and let's just signal that we have data return this._data; }, initializeforbuilding: function(adatasource, abuilder, arootnode) { // perform any initialization that can be delayed until the content builder // is ready for us to start },
done: function() { // called when the builder is destroyed to clean up state }, compilequery: function(abuilder, aquery, arefvariable, amembervariable) { // outputs a query object.
Using nsIXULAppInfo - Archive of obsolete content
obtaining platform version information is
done like this: var appinfo = components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.interfaces.nsixulappinfo); var platformver = appinfo.platformversion; var platformbuildid = appinfo.platformbuildid; getting nsixulappinfo in xpcshell tests in firefox 21, a testing module was added that provides access to app info during the execution of xpcshell tests.
XUL accessibility tool - Archive of obsolete content
add the tool into the addons.mozilla.org review process go through the most useful/popular extensions with tool and fix a11y issues add checker to tinderbox so that bugs are caught at checkin time some or all of this work could be
done through grants, and a likely person to oversee the grant deliverables and milestones would be mark finkle.
How to enable locale switching in a XULRunner application - Archive of obsolete content
here is a code snippet showing how this is
done: the definition of the xul control: <listbox id="locale-listbox"> <!-- generated list items go in here --> </listbox> <button label="&switchlocale.button;" oncommand="changelocale()"/> the javascript code to populate the control: try { // query available and selected locales var chromeregservice = components.classes["@mozilla.org/chrome/chrome-registry;1"].getservice(); var xulchromereg ...
Opening a Link in the Default Browser - Archive of obsolete content
this can be
done using the nsiexternalprotocolservice interface: // first construct an nsiuri object using the ioservice var ioservice = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); var uritoopen = ioservice.newuri("http://www.example.com/", null, null); var extps = components.classes["@mozilla.org/uriloader/external-protocol-service;1"] .getservice(components.interfaces.nsiexternalprotocolservice); // now, open it!
XULRunner tips - Archive of obsolete content
pref("browser.download.usedownloaddir", true); pref("browser.download.folderlist", 0); pref("browser.download.manager.showalertoncomplete", true); pref("browser.download.manager.showalertinterval", 2000); pref("browser.download.manager.retention", 2); pref("browser.download.manager.showwhenstarting", true); pref("browser.download.manager.usewindow", true); pref("browser.download.manager.closewhen
done", true); pref("browser.download.manager.opendelay", 0); pref("browser.download.manager.focuswhenstarting", false); pref("browser.download.manager.flashcount", 2); // pref("alerts.slideincrement", 1); pref("alerts.slideincrementtime", 10); pref("alerts.totalopentime", 4000); pref("alerts.height", 50); if you are missing preferences that a dialog requires, you will get the following errors: comp...
2006-10-06 - Archive of obsolete content
summary: mozilla.dev.apps.firefox - september 30 - october 6, 2006 announcements vista compatibility lab mike schroepfer announced the current work being
done testing mozilla products with vista.
Monitoring plugins - Archive of obsolete content
3 parameters (subject, topic and data) as well as a register method that contains the following code: var observerservice = components.classes["@mozilla.org/observer-service;1"] .getservice (components.interfaces.nsiobserverservice); observerservice.addobserver(this, "experimental-notify-plugin-call", false); observing as discussed above, to specify what you want
done when a notification arrives your class must have an observe method, receiving 3 parameters (subject, topic and data).
Syndicating content with RSS - Archive of obsolete content
here's a simple example of it being
done: accept: application/rss+xml, text/html with real production software, though, it would look more like this: accept: application/rss+xml, application/xhtml+xml, text/html here's a more complete example: get / http/1.1 host: example.com accept: application/rss+xml, application/xhtml+xml, text/html when an http server (or server-side script) gets this, it should redirect the http client to...
Tamarin Tracing Build Documentation - Archive of obsolete content
performance tests automated in buildbot mac os x 10.4 x86 supported, acceptance and performance tests automated in buildbot linux - ubuntu 8.0.4 x86 supported, acceptance and performance tests automated in buildbot windows mobile (pocket pc 5.0) armv4t supported, acceptance and performance tests automated in buildbot raw image (no os) armv5 supported, acceptance and performance tests not
done linux (nokia n810) armv5 supported, acceptance and performance tests not
done current build status the current tamarin tracing build status can be found at tamarin tracing build status getting the tamarin source the tamarin tracing source resides in mercurial at tamarin tracing.
Theme changes in Firefox 2 - Archive of obsolete content
#application #feedbody #feedchangesubscribeoptions #feederror #feedheader #feedheader[firstrun="true"] #feedheader[firstrun="true"] #feedintrotext #feedheader[firstrun="true"] #feedsubscribeline #feedintrotext #feedsubscribe
donechangingoptions #feedsubscribehandletext #feedsubscribehandler #feedsubscribeline #feedsubscribeoptions #feedsubscribeoptionsgroup #feedsubscribeoptionsgrouptitle #feedtitlecontainer #feedtitleimage #feedtitlelink #readercontainer #readergroup #readers #readers > listitem .feedentrycontent .feedsubscribebutton .feedsubscribebutton .button-icon .feedsubscribelink .feedsubscribelin...
Scratchpad - Archive of obsolete content
once you've
done this, the environment menu has a browser option; once that's selected, your scope is the entire browser rather than just the page content, as you will see from examining some globals: window /* [object chromewindow] */ gbrowser /* [object xulelement] */ the scratchpad execution context is set to browser when a snippet file has // -sp-context: browser on the first line.
Building Mozilla XForms - Archive of obsolete content
getting started things to know first: the xforms extension has a dependency on the schema-validation extension, so you need to build both (that's
done automatically) mozilla switched from cvs to mercurial starting with firefox 3.5.
Styling Abbreviations and Acronyms - Archive of obsolete content
ive disabilities, or people who are deaf." the problem authors have discovered that any abbr or acronym that has a title attribute is rendered with a dotted underline, per the following rule in resource://gre-resources/html.css abbr[title], acronym[title] { text-decoration: dotted underline; } the solution if authors wish to remove the underline from abbr and acronym elements, this can be
done with the following rule: abbr[title], acronym[title] { text-decoration: none; } it may be better to lessen the visual weight of the border without actually removing it.
Web Standards - Archive of obsolete content
tools firebug extension web developer extension markup validation service (w3c) css validation service (w3c) examples mozilla 1.0 demos - showing off what can be
done with web standards.
Windows Media in Netscape - Archive of obsolete content
example 1: client-side detection scripts browser architecture supports: netscapeplugin windows media player installed: true windows media scriptable: false windows media version: pluginversion a complete source code listing showing how that detection was
done can be found here (devedge-temp).
Bounding volume collision detection with THREE.js - Game development
knot.position.set(-3, 2, 1); knot.rotation.x = -math.pi / 4; // update the bounding box so it stills wraps the knot knotboxhelper.update(); box3.setfromobject(knotboxhelper); performing collision tests is
done in the same way as explained in the above section — we use our box3 object in the same way as described above.
Building up a basic demo with the PlayCanvas engine - Game development
add the following lines: var cylindermaterial = new pc.phongmaterial(); cylindermaterial.diffuse.set(1, 0.58, 0); cylindermaterial.update(); cylinder.model.model.meshinstances[0].material = cylindermaterial; cone creating a cone and its material is
done in almost exacly the same way as we did for the cylinder.
WebVR — Virtual Reality for the Web - Game development
var i = 0; i < devices.length; ++i) { if (devices[i] instanceof positionsensorvrdevice && devices[i].hardwareunitid === ghmd.hardwareunitid) { gpositionsensor = devices[i]; break; } } } }); this code will loop through the available devices and assign proper sensors to the headsets — the first devices array contains the connected devices, and a check is
done to find the hmdvrdevice, and assign it to the ghmd variable — using this you can set up the scene, getting the eye parameters, setting the field of view, etc.
Mobile touch controls - Game development
note: the game captain rogers: battle at andromeda is built with phaser and managing the controls is phaser-based, but it could also be
done in pure javascript.
Buttons - Game development
adding the button to the game adding the new button to the game is
done by using the add.button method.
The score - Game development
this can be
done using the settext() method — add the two new lines seen below to the ballhitbrick() function: function ballhitbrick(ball, brick) { brick.kill(); score += 10; scoretext.settext('points: '+score); } that's it for now — reload your index.html and check that the score updates on every brick hit.
Ajax - MDN Web Docs Glossary: Definitions of Web-related terms
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).
CSRF - MDN Web Docs Glossary: Definitions of Web-related terms
this can be
done, for example, by including malicious parameters in a url behind a link that purports to go somewhere else: <img src="https://www.example.com/index.php?action=delete&id=123"> for users who have modification permissions on https://www.example.com, the <img> element executes action on https://www.example.com without their noticing, even if the element is not at https://www.example.com.
Screen reader - MDN Web Docs Glossary: Definitions of Web-related terms
just like keyboard navigation without voiceover, you can navigate through interactive elements using the tab key and the arrow keys: next interactive element: tab previous interactive element: shift + tab next radio button in a same named-group: right or down arrow previous radio button in a same named-group: left or up arrow navigating through the content of a page is
done with the tab key and a series of other keys along with control + option keys next heading: control + option + h next list: control + option + x next graphic: control + option + g next table: control + option + t down an html hierarchical order control + option + right arrow previous heading: shift + control + option + h previous list: shift + control + option + x previous graphic: shift...
Advanced styling effects - Learn web development
article { max-width: 500px; padding: 10px; background-color: red; background-image: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,0.25)); } .multiple { box-shadow: 1px 1px 1px black, 2px 2px 1px black, 3px 3px 1px red, 4px 4px 1px red, 5px 5px 1px black, 6px 6px 1px black; } now we get this result: we've
done something fun here by creating a raised box with multiple coloured layers, but you could use it in any way you want, for example to create a more realistic look with shadows based on multiple light sources.
Debugging CSS - Learn web development
you are much more likely to get help if you can show that you have
done the work of reducing the problem and identifying exactly where it happens, before asking for help.
Styling lists - Learn web development
in our finished example, we have styled the unordered list like so (on top of what you've already seen above): ul { padding-left: 2rem; list-style-type: none; } ul li { padding-left: 2rem; background-image: url(star.svg); background-position: 0 0; background-size: 1.6rem 1.6rem; background-repeat: no-repeat; } here we've
done the following: set the padding-left of the <ul> down from the default 40px to 20px, then set the same amount on the list items.
HTML forms in legacy browsers - Learn web development
should feature detect: css feature detection before styling a replaced form control widget, you can check to see if the browser supports the features you plan on using using @supports: @supports (appearance: none) { input[type="search"] { appearance: none; /* restyle the search input */ } theappearance property can be used to display an element using platform-native styling, or, as is
done with the value of none, remove default platform-native based styling.
How to structure a web form - Learn web development
let's consider this example: <p>required fields are followed by <abbr title="required">*</abbr>.</p> <!-- so this: --> <div> <label for="username">name:</label> <input id="username" type="text" name="username"> <label for="username"><abbr title="required" aria-label="required">*</abbr></label> </div> <!-- would be better
done like this: --> <div> <label for="username"> <span>name:</span> <input id="username" type="text" name="username"> <abbr title="required" aria-label="required">*</abbr> </label> </div> <!-- but this is probably best: --> <div> <label for="username">name: <abbr title="required" aria-label="required">*</abbr></label> <input id="username" type="text" name="username"> </div> the...
Your first form - Learn web development
this is
done by using the <button> element; add the following just above the closing </ul> tag: <li class="button"> <button type="submit">send your message</button> </li> the <button> element also accepts a type attribute — this accepts one of three values: submit, reset, or button.
Add a hitmap on top of an image - Learn web development
<map name="example-map-1"> <area shape="circle" coords="200,250,25" href="page-2.html" alt="circle example" /> <area shape="rect" coords="10, 5, 20, 15" href="page-3.html" alt="rectangle example" /> </map> step 3: make sure it works for everybody you aren’t
done until you test image maps rigorously on many browsers and devices.
Debugging HTML - Learn web development
debugging isn't scary when writing code of some kind, everything is usually fine, until that dreaded moment when an error occurs — you've
done something wrong, so your code doesn't work — either not at all, or not quite how you wanted it to.
HTML table basics - Learn web development
when
done correctly, even blind people can interpret tabular data in an html table — a successful html table should enhance the experience of sighted and visually impaired users alike.
Making asynchronous programming easier with async and await - Learn web development
both of them start off with a custom promise function that fakes an async process with a settimeout() call: function timeoutpromise(interval) { return new promise((resolve, reject) => { settimeout(function(){ resolve("
done"); }, interval); }); }; then each one includes a timetest() async function that awaits three timeoutpromise() calls: async function timetest() { ...
Introduction to events - Learn web development
data to be submitted to a specified page on the server for processing, and the browser to be redirected to a "success message" page of some kind (or the same page, if another is not specified.) the trouble comes when the user has not submitted the data correctly — as a developer, you want to prevent the submission to the server and give an error message saying what's wrong and what needs to be
done to put things right.
Client-Server Overview - Learn web development
using html templates makes it very easy to change the html structure, because this only needs to be
done in one place, in a single template, and not across potentially thousands of static pages.
Ember interactivity: Events, classes and state - Learn web development
add the new line shown below to your header.hbs file: <input class='new-todo' aria-label='what needs to be
done?' placeholder='what needs to be
done?' autofocus {{on 'keydown' this.onkeydown}} > this new attribute is inside double curly braces, which tells you it is part of ember's dynamic templating syntax.
Accessibility in React - Learn web development
you can't press tab to focus on an element with a tabindex of -1 the same way you could do with a <button> or <a> element (this can be
done using tabindex="0", but that's not really appropriate in this case).
Getting started with React - Learn web development
when you are
done, your code should look something like this: reactdom.render(<app subject="clarice" />, document.getelementbyid('root')); back in app.js, let's revisit the app function itself, which reads like this (with the return statement shortened for brevity): function app() { const subject = "react"; return ( // return statement ); } change the signature of the app function so that it accepts ...
React interactivity: Editing, filtering, conditional rendering - Learn web development
with all of that
done, your filter() function should read like this: function filterbutton(props) { return ( <button type="button" classname="btn toggle-btn" aria-pressed={props.ispressed} onclick={() => props.setfilter(props.name)} > <span classname="visually-hidden">show </span> <span>{props.name}</span> <span classname="visually-hidden"> tasks</span> </button...
TypeScript support in Svelte - Learn web development
code along with us git clone the github repo (if you haven't already
done it) with: git clone https://github.com/opensas/mdn-svelte-tutorial.git then to get to the current app state, run cd mdn-svelte-tutorial/07-typescript-support or directly download the folder's content: npx degit opensas/mdn-svelte-tutorial/07-typescript-support remember to run npm install && npm run dev to start your app in development mode.
Componentizing our Svelte app - Learn web development
code along with us git clone the github repo (if you haven't already
done it) with: git clone https://github.com/opensas/mdn-svelte-tutorial.git then to get to the current app state, run cd mdn-svelte-tutorial/04-componentizing-our-app or directly download the folder's content: npx degit opensas/mdn-svelte-tutorial/04-componentizing-our-app remember to run npm install && npm run dev to start your app in development mode.
Getting started with Svelte - Learn web development
the code so far git clone the github repo (if you haven't already
done it) with: git clone https://github.com/opensas/mdn-svelte-tutorial.git then to get to the current app state, run cd mdn-svelte-tutorial/01-getting-started or directly download the folder's content: npx degit opensas/mdn-svelte-tutorial/01-getting-started remember to run npm install && npm run dev to start your app in development mode.
Dynamic behavior in Svelte: working with variables and props - Learn web development
code along with us git clone the github repo (if you haven't already
done it) with: git clone https://github.com/opensas/mdn-svelte-tutorial.git then to get to the current app state, run cd mdn-svelte-tutorial/03-adding-dynamic-behavior or directly download the folder's content: npx degit opensas/mdn-svelte-tutorial/03-adding-dynamic-behavior remember to run npm install && npm run dev to start your app in development mode.
Git and GitHub - Learn web development
different team members will commonly want to create their own separate versions of the code (called branches in git), work on a new feature in that version, and then get it merged in a controlled manner (in github we use pull requests) with the master version when they are
done with it.
Chrome Worker Modules
r global value exports, as follows: /* file mymodule.js */ let secretkey = "this is a secret"; let publickey = "this is public"; exports.key = publickey; // secretkey is not exported // publickey is exported with name "key" alternatively, if you prefer that style, you may write // variable |module| is a special global introduced by require() module.exports = { key: publickey }; once this is
done, we may load the module and use the values that have been exported // assuming that mymodule.js is installed to resource://gre/modules/mymodule.js let module = require("resource://gre/modules/mymodule.js") foo(module.key); // module.key == "this is public"; // however, secretkey is not exported and cannot be used for the installation of resources, please see the documentation on moz.build (i...
Accessibility API cross-reference
the ipc mechanisms used by current generation api's are also not cross-platform, although communication for some cross-platform accessibility api of the future could be
done through sockets.
Mozilla accessibility architecture
on linux and unix, there probably needs to be more work
done on folding in with the new architecture (such as more use of the "wrap" classes).
Lightweight themes
submit your theme — if everything looks right, click the submit theme button and you're
done!
Creating reftest-based unit tests
it would be possible to try and wait for the initial rendering to be
done using a settimeout, but that would be unreliable, and just as bad, it can increase the time it takes to run a test many times over (which when you're running thousands of tests can really slow things down).
Creating Sandboxed HTTP Connections
nterfaces.nsichanneleventsink) || aiid.equals(components.interfaces.nsiprogresseventsink) || aiid.equals(components.interfaces.nsihttpeventsink) || aiid.equals(components.interfaces.nsistreamlistener)) return this; throw components.results.ns_nointerface; } }; quick note: storing the channel in a global (especially in an extension) isn't a good idea, but was
done to make the code easier to read.
Reviewer Checklist
[fennec: when writing tests that use paintedsurface, ensure the paintedsurface is closed when you're
done with it.] performance impact check for main-thread io [fennec: android may warn about this with strictmode].
Firefox and the "about" protocol
user enabled the crash reporter) about:credits lists all contributors to the firefox project about:debugging switches to the developer tools debugging page, which allows you to debug add-ons, tabs and service workers about:devtools summarizes the developer tools and provides links to documentation for each tool about:downloads displays all downloads
done within firefox about:home start page of firefox when opening a new window about:license displays licensing information about:logo firefox logo about:memory provides a way to display memory usage, save it as report and run the gc and cc about:mozilla special page showing a message from "the book of mozilla" about:networking di...
Browser API
the following new events can be listened for: mozbrowseractivity
done sent when something inside the browser <iframe> triggers a web activity, and that web activity's message is consumed by the receiving app.
Embedding Tips
how do i know when saving is
done, monitor progress etc.?
How to add a build-time test
standalone executables to add a test that is written in c or c++ and which is called as a standalone executable, a few things must be
done.
IPDL Tutorial
class ppluginparent { /* allocate a pplugininstanceparent when the first form of callplugininstanceconstructor is called */ virtual pplugininstanceparent* allocpplugininstance(const nscstring& type, const nstarray<nscstring>& args, int* rv) = 0; /* deallocate the pplugininstanceparent after pplugininstancedestructor is
done with it */ virtual bool deallocpplugininstance(pplugininstanceparent* actor) = 0; /* constructor message */ virtual callpplugininstanceconstructor(const nscstring& type, const nstarray<nscstring>& args, int* rv) { /* generated code */ } /* alternate form of constructor message: supply your own pplugininstanceparent* to bypass allocpplugininstance */ virtual bool callpplugininstancecon...
AsyncShutdown.jsm
// do whatever must be
done before the end of phase profilebeforechange return promise; }, function info() { let status = ...
CustomizableUI.jsm
aarea will be the area the item is dragged to, or undefined after the measurements have been
done and the node has been moved back to its 'regular' area.
Download
this can be
done using the removepartialdata() or the finalize() methods.
Downloads.jsm
observer notifications (for example, "dl-
done") and download listeners are replaced by views on the downloadlist object returned by the getlist() method.
Interfacing with the Add-on Repository
importing the repository code module before you can use the add-on repository api, you need to import the code module: components.utils.import("resource://gre/modules/addonrepository.jsm"); having
done this, you can then access the api through the resulting addonrepository object.
JNI.jsm
this is
done by calling .set for each element with the respective value in the avalsarray.
OS.File for the main thread
when you are
done with it, like in shutdown of restartless add-on, you should close the file so it becomes editable again.
Index
you've setup up your local and remote environments, you've selected your l10n tools and projects,
done some localization and even some testing!
Localizing extension metadata on addons.mozilla.org
here is a list of the codes: arabic (ar), catalan (ca), czech (cs), danish (da), german (de), greek (el), basque (eu), spanish (es-es), farsi (fa), finnish (fi), french (fr), gaeilge (ga-ie), hebrew (he), hungarian (hu), in
donesian (id), italian (it), japanese (ja), korean (ko), mongolian (mn), dutch (nl), polish (pl), brazilian portuguese (pt-br), european portuguese (pt-pt), romanian (ro), russian (ru), slovakian (sk), albanian (sq), swedish (sv-se), ukrainian (uk), vietnamese (vi), chinese (zh-cn) and taiwanese (zh-tw).
Localizing with Mozilla Translator
a bit of history on mt mt has been evolving from long ago, when l10n were
done always on shipped en-us jars and when mozilla suite had five l10n jars: ab-cd.jar, ab-win.jar, ab-mac.jar, ab-unix.jar, and cd.jar.
TimerFirings logging
(running on mac or linux is obviously necessary to learn the timer function's name.) this is
done by initializing it with initwithnamedfunccallback or initwithnameablefunccallback instead of initwithnamecallback.
TraceMalloc
(this can be
done by examining the unprocessed output of an xpcom_mem_refcnt_log, one of the nstracerefcnt logs.) you should use the --use-address argument to diffbloatdump.pl, and then the diff tree can be run through fix_linux_stack.py or fix_macosx_stack.py as needed.
Performance
profiling with zoom zoom is a profiler for linux
done by the people who made shark measuring performance using the perfmeasurement.jsm code module using perfmeasurement.jsm to measure performance data in your javascript code.
Emscripten
compile the c/c++ runtimes of other languages into javascript, and then run code in those other languages in an indirect way (this has been
done for python and lua)!
Midas editor module security preferences
only change these settings as needed to try the demo above and to test your own add-on or firefox-internal code, and be sure to restore the default settings when you're
done!
Midas
in addition to the built-in commands, advanced editing can be
done by manipulating the selection and range objects.
Anonymous Shared Memory
in the first protocol, the job of passing the inheritable shared memory is
done via helper-functions with pr_createprocess.
PR_AttachThread
in nspr release 19980529b and earlier, it is necessary for a native thread not created by nspr to call pr_attachthread before it calls any nspr functions, and call pr_detachthread when it is
done calling nspr functions.
PR_DetachThread
in nspr release 19980529b and earlier, it is necessary for a native thread not created by nspr to call pr_attachthread before it calls any nspr functions, and call pr_detachthread when it is
done calling nspr functions.
PR_Wait
this is usually
done by evaluating a boolean expression involving the monitored data.
JSS 4.4.0 Release Notes
jss 4.4.0 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/jss/releases/jss_4_4_0_rtm/src/ new in jss 4.40 new functionality new functions new macros notable changes in jss 4.40 picks up work
done downstream for fedora and rhel and used by various linux distributions with includes:.
NSS Key Log Format
distributors can re-enable it at compile time though (using the nss_allow_sslkeylogfile=1 make variable) which is
done for the official firefox binaries.
NSS Memory allocation
this can be
done outside the program entirely, or can be
done by the program itself, in the main() function.
NSS 3.21 release notes
nssutil_mkmodulespecex - take a shared library string, module name string, module parameters string, nss specific parameters string, and nss configuration parameter string and returns a module string which the caller must free when it is
done.
Release notes for recent versions of NSS
tes nss 3.15.5 release notes nss 3.15.4 release notes nss 3.15.3.1 release notes nss 3.15.3 release notes nss 3.15.2 release notes nss 3.15.1 release notes nss 3.15 release notes nss 3.14.5 release notes nss 3.14.4 release notes nss 3.14.3 release notes nss 3.14.2 release notes nss 3.14.1 release notes nss 3.14 release notes older release notes future releases release planning is
done on the mozilla wiki: nss:release versions.
nss tech note7
pk11_sign does not do the ber encoding of the hash (as is
done in sgn_ functions).
PKCS11 FAQ
questions about pins will a password change ever be
done on the token?
PKCS11 module installation
choose "browse..." to find the location of the pkcs #11 module on your local computer, and choose "ok" when
done.
Python binding for NSS
enhanced certifcate validation including ca certs can be
done via certificate.verify() or certificate.is_ca_cert().
Build instructions
this can be
done in sh or bash as follows: export path=/usr/libexec/binutils220:$path the following build instructions should work for all platforms (with some platform-specific changes as noted).
Installation guide
this is
done here: http://lxr.mozilla.org/security/sour...platlibs.mk#53 53 ifeq ($(os_arch), linux) 54 ifeq ($(use_64), 1) 55 extra_shared_libs += -wl,-rpath,'$$origin/../lib64:$$origin/../lib' 56 else 57 extra_shared_libs += -wl,-rpath,'$$origin/../lib' 58 endif 59 endif for example, if you install certutil in /foo/bar/nss/bin and the .so's in /foo/bar/nss/lib, then you only need to add /foo/bar/nss/bin t...
Sample manual installation
the nss build system does not include a target to install header files and shared libraries in the system directories, so this needs to be
done manually.
FC_Finalize
name fc_finalize - indicate that an application is
done with the pkcs #11 library.
NSS tools : certutil
this can be
done by specifying a ca certificate (-c) that is stored in the certificate database.
NSS tools : modutil
this can be
done by supplying all of the information through modutil directly or by running a jar file and install script.
gtstd.html
note that this step generates the server's private key, so it must be
done in the server's database directory.
NSS Tools modutil
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.
certutil
this can be
done by specifying a ca certificate (-c) that is stored in the certificate database.
NSS tools : modutil
this can be
done by supplying all of the information through modutil directly or by running a jar file and install script.
Necko Architecture
in fact, most of what the nsiioservice does can be
done independently of the nsiioservice, by hand.
Necko walkthrough
note: from what i can tell, there are some cases where the transaction is queued up to be written to the socket later if it's not writable now, or in the case of pipelining or spdy where it's
done in batches.
Rhino FAQ
for example, creating an array of seven ints can be
done with the code var intarray = java.lang.reflect.array.newinstance(java.lang.integer.type, 7); when i try to execute a script i get the exception required security context missing.
Rhino overview
introduction most people who have used javascript before have
done so by adding scripts to their html web pages.
Scripting Java
although this has the benefit of selecting a method that may be a better match for each call, it does have an impact on performance since more work is
done at each call.
Rhino serialization
writing an object to a file can be
done in a few lines of java code: fileoutputstream fos = new fileoutputstream(filename); scriptableoutputstream out = new scriptableoutputstream(fos, scope); out.writeobject(obj); out.close(); here filename is the file to write to, obj is the object or function to write, and scope is the top-level scope containing obj.
GC Rooting Guide
for regular js::nativeobjects, this is normally
done by storing them in slots, which are automatically traced by the gc.
Property cache
this is usually
done in order to bump the shape of one object without affecting other objects that happen to have the same properties.
Tracing JIT
it is correspondingly very simple: register allocation is
done immediately, step-by-step as code is being generated.
JSAPI Cookbook
// javascript var global = this; there is a function, js_getglobalforscopechain(cx), that makes a best guess, and sometimes that is the best that can be
done.
JS::Value
the solution is to tell spidermonkey that you're using the object, then tell it again when you're
done.
JSPRINCIPALS_HOLD
application code that stores a pointer to a jsprincipals object must call jsprincipals_hold(cx, principals) before storing it and jsprincipals_drop(cx, principals) when
done with it.
JS_GetGlobalObject
someone should document common use case "giving the global object a name", which can be
done with js_getglobalobject and js_setproperty see also mxr id search for js_getglobalobject js_getglobalforobject js_getglobalforscopechain js::currentglobalornull bug 868110 ...
JS_NewContext
the application must call js_destroycontext when it is
done using the context.
JS_NewObject
the jsclass may be used to override low-level object behavior, including such details as the physical memory layout of the object and how property lookups are
done.
JS_PushArguments
the application must call js_poparguments using the supplied markp stack pointer when
done with this stack frame, to free the memory and unroot the jsvals.
JS_SetGCCallback
the jsgc_begin callback can occur very early when something triggers garbage collection—before the javascript engine has even determined whether gc should actually be
done at the moment.
JS_SuspendRequest
if savedepth is nonzero and garbage collection is underway, js_resumerequest blocks until the garbage collector is
done.
JSAPI reference
ap added in spidermonkey 1.8 js_setgccallbackrt obsolete since jsapi 13 js_setfinalizecallback added in spidermonkey 17 obsolete since jsapi 32 js_markgcthing obsolete since jsapi 5 js_isabouttobefinalized obsolete since jsapi 35 js_clearnewbornroots obsolete since jsapi 5 the rest of these apis help protect objects from being destroyed by the garbage collector before the application is
done using them.
Running Automated JavaScript Tests
the next time it is run, it will run only the tests in the given filename, and then will write the list of tests that failed when it is
done.
Running Parsemark
a typical run can be
done like so: cd js/src/tests python parsemark.py /path/to/baseline/js /path/to/parse-tests-dir/ -q > /tmp/baseline.json python parsemark.py /path/to/current/js /path/to/parse-tests-dir/ -q > /tmp/current.json python compare_bench.py /tmp/current.json /tmp/baseline.json note: unfortunately the comparisons
done are very noisy and not reliable!
Setting up CDT to work on SpiderMonkey
step 3 - index all the code to let cdt know about the build, it has to invoke make itself (or, as is
done in the guide for the whole mozilla codebase on mdn, read a log of the build), which can be setup with these simple steps: open the project's properties by selecting its root and clicking "properties" in the "file" menu and select "c/c++ build".
TPS Tests
the sync_wipe_server argument causes tps to set the firstsync="wipeserver" pref before syncing, in case the sync account already contains data (this is typically unnecessary, and
done largely as an example).
Redis Tips
i'll show this in the node console, to illustrate how the optional parameters are
done.
Secure Development Guidelines
s constructor/destructor issues example class foo { private: char *ptr; public: foo() {} ~foo() { if (ptr) free(ptr); } }; constructor/destructor issues: prevention initialize the data members of an object in the constructor writing secure code: miscellaneous file i/o a lot can go wrong because a lot can be
done with file input and output filenames permissions file handles and descriptors file i/o: filename divided in directories, subdirectories, and the file itself ‘/’ is separator; in windows ‘\’ would work too int openfile(char *file) { handle fh; if (strstr(file, “\”)) return -1; fh = createfilea(file, ...); writefile(fh, data, si...
A Web PKI x509 certificate primer
the attributes of the certificates in the verification path have valid parameters for that verification (for example the validity period of all the certificates are valid for the time the verification is being
done) revocation checks are considered ok for that particular validation.
AT APIs Support
this is
done to ensure a common look and feel across all supported platforms, and to allow for different skins (appearances).
XForms Accessibility
currently we have verified that xforms accessibility is working on the windows platform, and linux testing has not yet been
done, although everything should work and is ready to be tested.
History Service Design
expiration expiration is an important part of data management for two reasons: privacy: expiring data based on user interaction is important, nothing must be left behind on a page removal database maintenance: having cleaner and smaller tables helps queries performances expiration is
done at certain moments, but in future will most likely be moved to async queries, to be executed on a separate thread.
Manipulating bookmarks using Places
initiating the bookmarks service as is the case with nearly all interfaces, before you can use the bookmarks service, you need to get access to it: var bmsvc = components.classes["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(components.interfaces.nsinavbookmarksservice); creating a bookmark folder creating a new bookmark folder is
done using the nsinavbookmarksservice.createfolder() method.
Places Developer Guide
id) { if (iid.equals(ci.nsinavbookmarkobserver) || iid.equals(ci.nsisupports)) { return this; } throw cr.ns_error_no_interface; }, }; // register the observer with the bookmarks service var bmsvc = cc["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(ci.nsinavbookmarksservice); bmsvc.addobserver(observer, false); // un-register the observer when
done.
Aggregating the In-Memory Datasource
there is some trickery involved on the delegate's part to ensure that reference counting is
done sanely, and that the reflexive, symmetric, and transitive properties of queryinterface() are preserved.
XPCOM glue
this is typically
done using gre_getgrepathwithproperties.
XPCOM array guide
to ensure that you get the right implementation and the conversion is
done in the right direction, make sure that you call the version of ns_newstringenumerator or ns_newutf8stringenumerator that corresponds to the array type, not the enumerator type.
XPCOM changes in Gecko 2.0
once that's
done, the extensions can then be loaded by simply reading their manifests, loading their components, and continuing the startup process, all without having to restart the browser.
Component Internals
after all components are registered, another notification is fired saying that xpcom is
done with the registration step.
Preface
by the end of the book, if we've
done our job, you will have learned how to build a component and you will know something about the framework for these components in gecko, which is xpcom.
Components.returnCode
if the javascript code needs to signal failure then that is
done by throwing an exception.
Monitoring HTTP activity
this is
done using the nsihttpactivitydistributor.addobserver() method in nsihttpactivitydistributor: var activitydistributor = components.classes["@mozilla.org/network/http-activity-distributor;1"] .getservice(components.interfaces.nsihttpactivitydistributor); activitydistributor.addobserver(httpobserver); observable activities there are two classes of observable activiti...
nsAutoRef
this is usually
done by providing a specialization of nsautoreftraits<t>.
nsCountedRef
this is usually
done by providing a specialization of nsautoreftraits<t>.
RefPtr
this is
done using the functions addref() and release(), which respectively modify a variable of type nsautorefcnt, which basically is a wrapper around a count of the number of references refering to the class.
XPCOM glue classes
this is
done using the functions addref() and release(), which respectively modify a variable of type nsautorefcnt, which basically is a wrapper around a count of the number of references refering to the class.nsstringclass declarationnsstring externalclass declarationnsstringcontainer (external)class declarationnssupportsweakreferenceinherit from this c++ class to add canonical support for nsisupportsweakref...
mozIAsyncFavicons
set to nsifaviconservice.favicon_load_non_private otherwise acallback optional once we're
done setting and/or fetching the favicon, we invoke this callback.
mozIVisitInfoCallback
if more than one operation is
done for a given visit, this method is only called once (for all changes at once).
nsIAppShellService
ome ); var webnav = services.appshell.createwindowlessbrowser(true); var docshell = webnav.queryinterface(ci.nsiinterfacerequestor).getinterface(ci.nsidocshell); var systemprincipal = cc["@mozilla.org/systemprincipal;1"].createinstance(ci.nsiprincipal); docshell.createaboutblankcontentviewer(systemprincipal); var contentwindow = docshell.contentviewer.domdocument.defaultview; // when you are
done with it, destroy it if (webnav.close) { webnav.close() }; // only available in firefox 46+, and is needed for good measure webnav = null; // in firefox <= 45 setting to null will cause it to get gc'ed which will destroy it registertoplevelwindow() add a window to the application's registry of windows.
nsIAutoCompleteListener
methods onautocomplete() called by the autocomplete session when the search is
done or over.
nsIChannel
when the channel is
done, it must not continue holding references to this object.
nsICharsetResolver
if this is
done, the caller of requestcharset is responsible for calling notifyresolvedcharset() and passing it the final resolved charset and the closure that requestcharset set.
nsICommandLine
removearguments() removes a range of arguments from the command line; this is typically
done once those arguments have been handled.
nsIConsoleService
note: to guard against stack overflows from listeners which could log messages (this could be
done inadvertently through listeners implemented in javascript), we do not call any listeners when another error is already being logged.
nsICookieConsent
last changed in gecko 1.9 (firefox 3) inherits from: nsisupports method overview void getconsent(); methods getconsent() gives a decision on what should be
done with a cookie, based on a site's p3p policy and the user's preferences.
nsICookiePermission
this is
done by leveraging the loadgroup of the channel to find the root content docshell, and the uri associated with its principal.
nsIDNSService
this is
done by disabling ipv6 on backup connections.
nsIDOMEvent
x00000200 keypress 0x00000400 dragdrop 0x00000800 focus 0x00001000 blur 0x00002000 select 0x00004000 change 0x00008000 reset 0x00010000 submit 0x00020000 scroll 0x00040000 load 0x00080000 unload 0x00100000 xfer_
done 0x00200000 abort 0x00400000 error 0x00800000 locate 0x01000000 move 0x02000000 resize 0x04000000 forward 0x08000000 help 0x10000000 back 0x20000000 text 0x40000000 alt_mask 0x00000001 control_mask 0x00000002 ...
nsIDownloadManagerUI
constants constant value description reason_user_interacted 0 when opening the download manager user interface, this value indicates that it's being
done at the user's request.
nsIFileInputStream
(the file will only be reopened if it is closed for some reason.) defer_open 1<<4 if this is set, the file will be opened (i.e., a call to pr_open()
done) only when we do an actual operation on the stream, or more specifically, when one of the following is called: seek() tell() available() read() readline() defer_open is useful if we use the stream on a background thread, so that the opening and possible stating of the file happens there as well.
nsIFilePicker
the passed in object's
done method will be called upon completion.
nsIHttpHeaderVisitor
this is
done by subscribing to the http-on-examine-response and http-on-examine-cached-response observers.
nsIHttpServer
if it doesn't * match the field-value production in rfc 2616 * @note * no syntax checking is
done of the given type, beyond ensuring that it is * a valid header field value.
nsIINIParserWriter
when you're
done and ready to write the ini file to disk, call the writefile() method.
nsIIOService
note: most url parsing is
done via nsiuri, and in fact the scheme can also be extracted from a url string via nsiuri.
Using nsILoginManager
orrespond to a login on http://www.example.com when the server sends a reply such as: http/1.0 401 authorization required server: apache/1.3.27 www-authenticate: basic realm="exampleco login" creating a local extension login var extlogininfo = new nslogininfo( 'chrome://firefoo', null, 'user registration', 'bob', '123secret', "", "" ); from a component creating a new info block is
done slightly differently: var nslogininfo = new constructor("@org/manager/ci.init"); var extlogininfo = new aformsubmiturl, ausername, ausernamefield, ...
nsILoginManagerStorage
the user interface allows this to be
done without getting each login first (which might require knowing the master password).
nsIMemoryReporter
once that has been
done, the reporter will be found by any client accessing the enumerator returned by nsimemoryreportermanager.enumeratereporters().
nsIMsgDatabase
the caller should free when
done using nsmemory.free().
nsIMsgMessageService
this is an async operation of course.note: you must pass in a url listener in order to figure out when the operation is
done.
nsIMsgSearchNotify
void onsearch
done(in nsresult status); /* * until we can encode searches with a uri, this will be an * out-of-bound way to connect a set of search terms to a datasource */ /* * called when a new search begins */ void onnewsearch(); }; ...
nsINavBookmarkObserver
during a batch the observer should do its best to reduce the work
done to handle notifications, since multiple changes are going to happen in a short timeframe.
nsINavBookmarksService
endupdatebatch() obsolete since gecko 1.9 (firefox 3) causes observers to be notified of an endupdatebatch when a batch is
done changing.
nsINavHistoryQuery
this was designed so that most queries can be
done in only one sql query.
nsIObserver
observer = new myobserver(); destruction - this should be fired once you're
done observing (for example a window's unload event).
nsISHEntry
this forgets its pointer, so free it when you're
done.
nsIScriptableIO
reopenonrewind: used in conjunction with the seek mode, the file will be reopened when a seek to the beginning of the file is
done.
nsITaskbarTabPreview
1.0 66 introduced gecko 1.9.2 inherits from: nsitaskbarpreview last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) tab preview support is disabled by default in gecko 1.9.2 creating an nsitaskbartabpreview for a window will automatically hide that window's nsitaskbarwindowpreview; this is
done by windows and cannot be prevented.
nsIURI
warning: because parsing the string is
done using the current uri's scheme, setting the spec to a uri with a different scheme will produce incorrect results.
nsIWebBrowserFindInFrames
once the search is
done, this will be set to be the last frame searched, whether or not a result was found.
nsIWebNavigationInfo
note: this is guaranteed not to change, so that boolean tests can be
done on the return value if istypesupported to detect whether a type is supported at all.
nsIXMLHttpRequest
for instance, as
done in example 2, the flag of load_anonymous is added, this strips all user data (cookies, tokens, etc).
nsIXULTemplateBuilder
the query processor's
done() method will be invoked during cleanup, followed by its initializeforbuilding() method when the content is to be regenerated.
Setting HTTP request headers
trapping other requests is
done with notifications, which are a lot like events or signals found in other languages and frameworks.
Performance
the page size can be set using the page_size pragma before any operations have been
done on the file.
XPCOM tasks
this is probably best
done with a c wrapper around an xpcom enumerator.
pyxpidl
generating c++ headers to generate c++ headers, use the header.py utility: sdkdir/sdk/bin/header.py --cachedir=<path> -o <outputfilename.h> <filename.idl> generating typelibs generating typelib files is
done using the typelib.py utility: sdkdir/sdk/bin/typelib.py --cachedir=<path> -o <outputfilename.xpt> <filename.idl> comparing pyxpidl to xpidl this table provides a mapping of old xpidl options to pyxpidl.
Xray vision
there are two main sorts of restrictions: first, the chrome code might expect to rely on the prototype's integrity, so the object's prototype is protected: the xray has the standard object or array prototype, without any modifications that content may have
done to that prototype.
Address Book examples
as of thunderbird 7.0, implementing your own address book type can be
done with either javascript or with a binary component.
Index
filter execution is
done by evaluating the search terms using the core mailnews/base/search code, and then applying the filter hits when the search terms match.
Mail event system
both of these could be
done by making atoms for each of these events and just firing it with notifyitemevent.
Mailnews and Mail code review requirements
(i have
done some mozmill orange fixing where the try server would not duplicate the orange failures of the trunk and so in order to get the enhanced logging, the changes need to go into the trunk.) the patch is authored by the module owner/a peer for the affected test.
Creating a Custom Column
most of the dirty tasks (displaying and sorting) are
done for you in the background - so that all that's left to you, the extension developer is to populate the code with your feature.
Finding the code for a feature
as an example, i received the following inquiry, and i decided to follow my usual path and document what i do: hello i would like to add colours and tags to specific emails...by using nsimsgtagservice, can this be
done?
Filter Incoming Mail
by example, setting it to lower case subject = subject.tolocalelowercase(); // then we rebuild a subject objet by rencoding the string // and assign it to the message headers and we're
done amsghdr.subject = mimeconvert.encodemimepartiistr_utf8(subject, false, "utf-8", 0, 72); } } }; function init() { var notificationservice = components.classes["@mozilla.org/messenger/msgnotificationservice;1"] .getservice(components.interfaces.nsimsgfoldernotificationservice); notificationservice.addlistener(newmaillistener, notificationservice.msgadded); } addeventlist...
Working with windows in chrome code
this can be
done using the following statement: var mainwindow = window.queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsiwebnavigation) .queryinterface(components.interfaces.nsidocshelltreeitem) .roottreeitem .queryinterface(components.interfaces.nsiinterfacerequestor) ...
Declaring and Using Callbacks
this can all be
done in a single line of code, like so: var callback = ctypes.functiontype(...).ptr(function(...) {...}); note: the use of .ptr() here isn't a method call; we're accessing a property that dynamically creates a callable object, and then invoking the result.
Declaring types
pointers declaring a pointer type as a pointer to a specific type is
done by passing as a parameter to the ctypes.pointertype() method a ctype object indicating the type to which the pointer should refer: const intptr = new ctypes.pointertype(ctypes.int); in this example, intptr is equivalent to this declaration in c: typedef int *intptr; you can similarly declare a pointer type as a pointer to any user-defined type, including structures: const userrecord = new ...
Memory Management
be sure to hold an explicit reference so that the referent object doesn't get into garbage collection, before you're
done using it.
Flash Activation: Browser Comparison - Plugins
this can be
done by calling a javascript function when the plugin is activated: function plugincreated() { // we don't need to see the plugin, so hide it by resizing var plugin = document.getelementbyid('myplugin'); plugin.height = 0; plugin.width = 0; plugin.callpluginmethod(); } the html, by default, specifies the flash object to be a size that makes it visible, like this: <!-- give the plugin an i...
Constants - Plugins
result codes constant value description npres_
done 0 (most common): completed normally; all data was sent to the instance.
Accessibility Inspector - Firefox Developer Tools
here we are mainly talking about exposing information to people with visual disabilities — this is
done via the accessibility apis available inside web browsers, which expose information on what roles the different elements on your page play (e.g., are they just text, or are they buttons, links, form elements, etc.?).
Debugging service workers - Firefox Developer Tools
registration is
done with a block of code along these lines, using the register() method: if('serviceworker' in navigator) { navigator.serviceworker .register('sw.js') .then(function() { console.log('service worker registered'); }); } if you get the path wrong, for example, you'll get an error in the web console giving you a hint as to what's wrong, which depends on what exactly is wrong wit...
Browser Console - Firefox Developer Tools
here is an example on how to clear the contents of the browser console: components.utils.import("resource://devtools/shared/loader.jsm"); var hudservice = devtools.require("devtools/client/webconsole/hudservice"); var hud = hudservice.getbrowserconsole(); hud.jsterm.clearoutput(true); if you would like to access the content document of the browser console this can be
done with the hudservice.
Debugger.Memory - Firefox Developer Tools
web developers need to know their pages’ actual memory consumption on real browsers, so it is correct for the tool to expose these behaviors, as long as it is
done in a way that helps developers make decisions about their own code.
DevTools API - Firefox Developer Tools
window.document.body.addeventlistener("click", this.handleclick); } mypanel.prototype = { open: function() { // any asynchronous operations should be
done here.
Rich output - Firefox Developer Tools
for example, by expanding the array in the above list, i get the following: console.log(todolist) (4) […] 0: object { status: "
done", description: "morning pages", datecreated: 1552404478137 } 1: object { status: "in progress", description: "refactor styles", datecreated: 1552404493169 } 2: object { status: "to do", description: "create feedback form", datecreated: 1552404512630 } 3: object { status: "to do", description: "normalize table", datecreated: 1552404533790 } length: 4 <prototype>: array [] debug...
AddressErrors - Web APIs
that's
done by removing all shipping options currently set on the request, then set up an object named shippingaddresserrors which contains a country property which is an error message describing why the stated country isn't being permitted as a value.
AnalyserNode.smoothingTimeConstant - Web APIs
if 0 is set, there is no averaging
done, whereas a value of 1 means "overlap the previous and current buffer quite a lot while computing the value", which essentially smoothes the changes across analysernode.getfloatfrequencydata/analysernode.getbytefrequencydata calls.
Animation.onfinish - Web APIs
hide(endingui); // when the credits are later faded in, // we re-add the pointer events when they're
done bringui.onfinish = function() { endingui.style.pointerevents = 'auto'; }; specifications specification status comment web animationsthe definition of 'animation.onfinish' in that specification.
BaseAudioContext.createBuffer() - Web APIs
note: createbuffer() used to be able to take compressed data and give back decoded samples, but this ability was removed from the spec, because all the decoding was
done on the main thread, therefore createbuffer() was blocking other code execution.
BlobBuilder - Web APIs
when you're
done building your blob, call getblob() to retrieve a blob containing the data you sent into the blob builder.
Body.body - Web APIs
const image = document.getelementbyid('target'); // fetch the original image fetch('./tortoise.png') // retrieve its body as readablestream .then(response => response.body) .then(body => { const reader = body.getreader(); return new readablestream({ start(controller) { return pump(); function pump() { return reader.read().then(({
done, value }) => { // when no more data needs to be consumed, close the stream if (
done) { controller.close(); return; } // enqueue the next data chunk into our target stream controller.enqueue(value); return pump(); }); } } }) }) .then(stream => new response(stream)) .then(response => response.bl...
BroadcastChannel.close() - Web APIs
syntax var str = channel.close(); example // connect to a channel var bc = new broadcastchannel('test_channel'); // more operations (like postmessage, …) // when
done, disconnect from the channel bc.close(); specifications specification status comment html living standardthe definition of 'broadcastchannel.close()' in that specification.
BroadcastChannel.name - Web APIs
syntax var str = channel.name; examples // connect to a channel var bc = new broadcastchannel('test_channel'); // more operations (like postmessage, …) // log the channel name to the console console.log(bc.name); // "test_channel" // when
done, disconnect from the channel bc.close(); specifications specification status comment html living standardthe definition of 'broadcastchannel.name' in that specification.
CSSStyleDeclaration.setProperty() - Web APIs
in each case, this is
done with the setproperty() method, for example boxpararule.style.setproperty('border', newborder); html <div class="controls"> <button class="border">border</button> <button class="bgcolor">background</button> <button class="color">text</button> </div> <div class="box"> <p>box</p> </div> css html { background: orange; font-family: sans-serif; height: 100%; } body { height: inheri...
Using the CSS Painting API - Web APIs
css.paintworklet.addmodule('nameofpaintworkletfile.js'); this can be
done using the paint worklet's addmodule() method in a <script> within the main html or in an external javascript file linked to from the document.
Cache.keys() - Web APIs
options optional an object whose properties control how matching is
done in the keys operation.
CanvasRenderingContext2D.resetTransform() - Web APIs
const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // draw a rotated rectangle ctx.rotate(45 * math.pi / 180); ctx.fillrect(60, 0, 100, 30); // reset transformation matrix to the identity matrix ctx.resettransform(); result continuing with a regular matrix whenever you're
done drawing transformed shapes, you should call resettransform() before rendering anything else.
A basic ray-caster - Web APIs
the code i ended up with is a regurgitated amalgam of the raycaster chapters from an old andré lamothetricks of the game programming gurus book (isbn: 0672305070), and a java raycaster i found online, filtered through my compulsion to rename everything so it makes sense to me, and all the tinkering that had to be
done to make things work well.
Clipboard.write() - Web APIs
example of copying canvas contents to the clipboard function copycanvascontentstoclipboard(canvas, on
done, onerror) { canvas.toblob(function (blob) { let data = [new clipboarditem({ [blob.type]: blob })]; navigator.clipboard.write(data).then(function () { on
done(); }, function (err) { onerror(err); }) }); } note: you can only pass in one clipboard item at a time.
CryptoKey - Web APIs
cryptokey.usages an array of strings, indicating what can be
done with the key.
DataTransfer.clearData() - Web APIs
; dropable.removeeventlistener('drop', drophandler); } } function dragoverhandler (event) { status.innerhtml = 'drop available'; event.preventdefault(); } function dragleavehandler (event) { status.innerhtml = 'drag in process (drop was available)'; event.preventdefault(); } function drophandler (event) { dropped = true; status.innerhtml = 'drop
done'; event.preventdefault(); // get data linked to event format « text » var _data = event.datatransfer.getdata('text/plain'); var element = document.getelementbyid(_data); // append drag source element to event's target element event.target.appendchild(element); // change css styles and displayed text element.style.csstext = 'border: 1px solid black;display: bl...
DedicatedWorkerGlobalScope.postMessage() - Web APIs
inside the handler a calculation is
done from which a result message is created; this is then sent back to the main thread using postmessage(workerresult); onmessage = function(e) { console.log('message received from main script'); var workerresult = 'result: ' + (e.data[0] * e.data[1]); console.log('posting message back to main script'); postmessage(workerresult); } in the main script, onmessage would have to be called on a w...
Document.fonts - Web APIs
examples doing operation after all fonts are loaded document.fonts.ready.then(function() { // any operation that needs to be
done only after all the fonts // have finished loading can go here.
Document.querySelector() - Web APIs
note: the matching is
done using depth-first pre-order traversal of the document's nodes starting with the first element in the document's markup and iterating through sequential nodes by order of the number of child nodes.
DocumentOrShadowRoot.activeElement - Web APIs
donec tincidunt, lorem a porttitor molestie, odio nibh iaculis libero, et accumsan nunc orci eu dui.</textarea> <textarea name="ta-example-two" id="ta-example-two" rows="7" cols="40">this is text area two.
Element.getClientRects() - Web APIs
the amount of scrolling that has been
done of the viewport area (or any other scrollable element) is taken into account when computing the rectangles.
FileEntrySync - Web APIs
this specification is more or less aban
doned as it didn't get significant traction among browser makers.
FileReader.readAsText() - Web APIs
when the read operation is complete, the readystate is changed to
done, the loadend event is triggered, and the result property contains the contents of the file as a text string.
FontFace.loaded - Web APIs
the loaded read-only property of the fontface interface returns a promise that resolves with the current fontface object when the font specified in the object's constructor is
done loading or rejects with a syntaxerror.
FontFace - Web APIs
fontface.loaded read only returns a promise that resolves with the current fontface object when the font specified in the object's constructor is
done loading or rejects with a syntaxerror.
FontFaceSet - Web APIs
fontfaceset.onloading
done an eventlistener called whenever an event of type loading
done is fired, indicating that a font face set has finished loading.
Fullscreen API - Web APIs
switching to full-screen mode is
done by calling element.requestfullscreen() on the <video> element.
GlobalEventHandlers.ontransitioncancel - Web APIs
let box = document.queryselector(".box"); box.ontransitionrun = function(event) { box.innerhtml = "zooming..."; } box.ontransitionend = function(event) { box.innerhtml = "
done!"; } box.onclick = function() { box.style.display = 'none'; timeout = window.settimeout(appear, 2000); function appear() { box.style.display = 'block'; } } box.ontransitioncancel = function(event) { console.log('transitioncancel fired after ' + event.elapsedtime + ' seconds.'); } result the resulting content looks like this: notice what happens when you hover your mouse curso...
GlobalEventHandlers.ontransitionend - Web APIs
let box = document.queryselector(".box"); box.ontransitionrun = function(event) { box.innerhtml = "zooming..."; } box.ontransitionend = function(event) { box.innerhtml = "
done!"; } result the resulting content looks like this: notice what happens when you hover your mouse cursor over the box, then move it away.
HTMLCanvasElement - Web APIs
the callback can get the context to draw to from the printstate object and must then call
done() on it when finished.
HTMLCollection - Web APIs
matching by name is only
done as a last resort, only in html, and only if the referenced element supports the name attribute.
HTMLImageElement.complete - Web APIs
syntax let
doneloading = htmlimageelement.complete; value a boolean value which is true if the image has completely loaded; otherwise, the value is false.
HTMLImageElement.sizes - Web APIs
er: 4em solid #880e4f; border-radius: 7em; padding: 1.5em; font: 16px "open sans", verdana, arial, helvetica, sans-serif; } article img { display: block; max-width: 100%; border: 1px solid #888; box-shadow: 0 0.5em 0.3em #888; margin-bottom: 1.25em; } javascript the javascript code handles the two buttons that let you toggle the third width option between 40em and 50em; this is
done by handling the click event, using the javascript string object method replace() to replace the relevant portion of the sizes string.
HTMLScriptElement - Web APIs
htmlscriptelement.referrerpolicy is a domstring that reflects the referrerpolicy html attribute indicating which referrer to use when fetching the script, and fetches
done by that script.
HTMLSourceElement - Web APIs
note: if the src property is updated (along with any siblings), the parent htmlmediaelement's load method should be called when
done, since <source> elements are not re-scanned automatically.
File drag and drop - Web APIs
the following code snippet shows how this is
done with a <div> element: <div id="drop_zone" ondrop="drophandler(event);"> <p>drag one or more files to this drop zone ...</p> </div> typically, an application will include a dragover event handler on the drop target element and that handler will turn off the browser's default drag behavior.
Recommended Drag Types - Web APIs
for example: event.datatransfer.setdata("text/plain", "this is text to drag"); dragging text in textboxes and selections on web pages is
done automatically by the browser, so you do not need to handle it yourself.
HTML Drag and Drop API - Web APIs
datatransfer objects include the drag event's state, such as the type of drag being
done (like copy or move), the drag's data (one or more items), and the mime type of each drag item.
History API - Web APIs
concepts and usage moving backward and forward through the user's history is
done using the back(), forward(), and go() methods.
IDBObjectStore.add() - Web APIs
adddata() { // create a new object ready to insert into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is
done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error.
IDBObjectStore.autoIncrement - Web APIs
adddata() { // create a new object ready to insert into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is
done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error.
IDBObjectStore.clear() - Web APIs
// this is used a lot below db = dbopenrequest.result; // clear all the data form the object store cleardata(); }; function cleardata() { // open a read/write db transaction, ready for clearing the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is
done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error: ' + transaction.error + '</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); // make a request to clear all the data...
IDBObjectStore.delete() - Web APIs
this is used a lot below db = dbopenrequest.result; // run the deletedata() function to delete a record from the database deletedata(); }; function deletedata() { // open a read/write db transaction, ready for deleting the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is
done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error: ' + transaction.error + '</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); // make a request to delete the specifi...
IDBObjectStore.get() - Web APIs
// this is used a lot below db = dbopenrequest.result; // run the getdata() function to get the data from the database getdata(); }; function getdata() { // open a read/write db transaction, ready for retrieving the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is
done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error: ' + transaction.error + '</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); // make a request to get a record by ke...
IDBObjectStore.indexNames - Web APIs
adddata() { // create a new object ready to insert into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is
done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error.
IDBObjectStore.keyPath - Web APIs
adddata() { // create a new object ready to insert into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is
done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error.
IDBObjectStore.name - Web APIs
adddata() { // create a new object ready to insert into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is
done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error.
IDBObjectStore.transaction - Web APIs
adddata() { // create a new object ready to insert into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is
done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error.
IDBObjectStore - Web APIs
created.</li>'; }; // create a new item to add in to the object store var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: 'december', year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is
done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; transaction.onerror = function(event) { note.innerhtml += '<li>transaction not opened due to error.
IdleDeadline.didTimeout - Web APIs
your callback will typically check the value of didtimeout if it needs to perform an action even if the browser is too busy to grant you the time; you should react by performing the needed task or, ideally, a minimal amount of work that can be
done to keep things moving along, then schedule a new callback to try again to get the rest of the work
done.
Checking when a deadline is due - Web APIs
this is
done by our checkdeadlines() function: function checkdeadlines() { var now = new date(); first we grab the current date and time by creating a blank date object.
IndexedDB API - Web APIs
synchronous and asynchronous operations performed using indexeddb are
done asynchronously, so as not to block applications.
IntersectionObserverEntry.boundingClientRect - Web APIs
this value is obtained using the same algorithm as element.getboundingclientrect(), so refer to that article for details on precisely what is
done to obtain this rectangle and what is and is not included within its bounds.
LargestContentfulPaint - Web APIs
this example also demonstrates how to include buffered entries (those that ocurred before observer() was called), which is
done by setting the buffered option to true.
MSGestureEvent - Web APIs
though the msgestureevent.initgestureevent() method is kept for backward compatibility, the creation of an msgestureevent object should be
done using the msgestureevent() constructor.
MediaTrackConstraints.autoGainControl - Web APIs
syntax var constraintsobject = { autogaincontrol: constraint }; constraintsobject.autogaincontrol = constraint; value if this value is a simple true or false, the user agent will attempt to obtain media with automatic gain control enabled or disabled as specified, if possible, but will not fail if this can't be
done.
MediaTrackConstraints.echoCancellation - Web APIs
syntax var constraintsobject = { echocancellation: constraint }; constraintsobject.echocancellation = constraint; value if this value is a simple true or false, the user agent will attempt to obtain media with echo cancellation enabled or disabled as specified, if possible, but will not fail if this can't be
done.
MediaTrackConstraints.noiseSuppression - Web APIs
syntax var constraintsobject = { noisesuppression: constraint }; constraintsobject.noisesuppression = constraint; value if this value is a simple true or false, the user agent will attempt to obtain media with noise suppression enabled or disabled as specified, if possible, but will not fail if this can't be
done.
MouseEvent - Web APIs
though the mouseevent.initmouseevent() method is kept for backward compatibility, creating of a mouseevent object should be
done using the mouseevent() constructor.
PaintWorklet.registerPaint - Web APIs
const color = colors[(x + y) % colors.length]; ctx.beginpath(); ctx.fillstyle = color; ctx.rect(x * size, y * size, size, size); ctx.fill(); } } } } // register our class under a specific name registerpaint('checkerboard', checkerboardpainter); the first step in using a paintworket is defining the paint worklet using the registerpaint() function, as
done above.
PaymentDetailsUpdate - Web APIs
this can be
done either by calling the paymentrequestupdateevent.updatewith() method or by using the paymentrequest.show() method's detailspromise parameter to provide a promise that returns a paymentdetailsupdate that updates the payment information before the user interface is even enabled for the first time.
PaymentRequest.abort() - Web APIs
parameters none examples the following example sets up a timeout to clear the payment request that might have been aban
doned or neglected.
PerformanceNavigation.type - Web APIs
the legacy performancenavigation.type read-only property returns an unsigned short containing a constant describing how the navigation to this page was
done.
PushManager.subscribe() - Web APIs
console.log(error); } ); }); responding to user gestures subscribe() calls should be
done in response to a user gesture, such as clicking a button, for example: btn.addeventlistener('click', function() { serviceworkerregistration.pushmanager.subscribe(options) .then(function(pushsubscription) { // handle subscription }); }) this is not only best practice — you should not be spamming users with notifications they didn't agree to — but going forward browsers will explici...
RTCDTMFSender: tonechange event - Web APIs
this can be
done using addeventlistener(): dtmfsender.addeventlistener("tonechange", ev => { let tone = ev.tone; if (tone === "") { tone = "<none>"; } document.getelementbyid("playingtone").innertext = tone; }, false); you can also just set the ontonechange event handler property directly: dtmfsender.ontonechange = function( ev ) { let tone = ev.tone; if (tone === "") { tone = "<...
RTCDataChannel: open event - Web APIs
dc.addeventlistener("open", ev => { messageinputbox.disabled = false; sendmessagebutton.disabled = false; disconnectbutton.disabled = false; connectbutton.disabled = true; messageinputbox.focus(); }, false); this can also be
done by directly setting the value of the channel's onopen event handler property.
RTCIceCandidatePairStats.state - Web APIs
each time a candidate pair is
done being checked, the next-highest priority candidate pair remaining on the check list moves from the waiting state to the in-progress state, and its check begins.
RTCIceTransport: selectedcandidatepairchange event - Web APIs
toelem = document.getelementbyid("local-protocol"); let remoteprotoelem = document.getelementbyid("remote-protocol"); icetransport.addeventlistener("selectedcandidatepairchange", ev => { let pair = icetransport.getselectedcandidatepair(); localprotoelem.innertext = pair.local.protocol.touppercase(); remoteprotoelem.innertext = pair.remote.protocol.touppercase(); }, false) this can also be
done by setting the onselectedcandidatepairchange event handler property directly.
RTCPeerConnection.addTrack() - Web APIs
this is
done by adding each track in the stream by iterating over the list returned by mediastream.gettracks() and passing them to addtrack() along with the stream which they're a component of.
RTCPeerConnection.restartIce() - Web APIs
the webrtc api's rtcpeerconnection interface offers the restartice() method to allow a web application to easily request that ice candidate gathering be re
done on both ends of the connection.
ReadableStream.cancel() - Web APIs
searchterm.tolowercase() : searchterm; var buffersize = math.max(tomatch.length - 1, contextbefore); var bytesreceived = 0; var buffer = ''; var matchfoundat = -1; return reader.read().then(function process(result) { if (result.
done) { console.log('failed to find match'); return; } bytesreceived += result.value.length; console.log(`received ${bytesreceived} bytes of data so far`); buffer += decoder.decode(result.value, {stream: true}); // already found match & just context-gathering?
SpeechSynthesis.onvoiceschanged - Web APIs
the onvoiceschanged property of the speechsynthesis interface represents an event handler that will run when the list of speechsynthesisvoice objects that would be returned by the speechsynthesis.getvoices() method has changed (when the voiceschanged event fires.) this may occur when speech synthesis is being
done on the server-side and the voices list is being determined asynchronously, or when client-side voices are installed/uninstalled while a speech synthesis application is running.
Using writable streams - Web APIs
after the chunks have all been written, we then perform the ready check once more, to check that the last chunk has finished being written and all the work is
done.
SubtleCrypto - Web APIs
the wrapped key matches the format specified in the given parameters, and wrapping is
done by the given wrapping key, using the specified algorithm.
Using Touch Events - Web APIs
// touchmove handler function process_touchmove(ev) { // set call preventdefault() ev.preventdefault(); } best practices here are some best practices to consider when using touch events: minimize the amount of work that is
done in the touch handlers.
TransformStream - Web APIs
async transform(chunk, controller) { chunk = await chunk switch (typeof chunk) { case 'object': // just say the stream is
done i guess if (chunk === null) controller.terminate() else if (arraybuffer.isview(chunk)) controller.enqueue(new uint8array(chunk.buffer, chunk.byteoffset, chunk.bytelength)) else if (array.isarray(chunk) && chunk.every(value => typeof value === 'number')) controller.enqueue(new uint8array(chunk)) else if ('function' === typeof chunk.valueof && chu...
Detect WebGL - Web APIs
this is also
done in other graphics {̣{glossary("api")}}, such as the canvas 2d rendering context.
WebGL by example - Web APIs
simple color animation a very basic color animation,
done by clearing the webgl drawing buffer with a different random color every second.
WebGL constants - Web APIs
it also provides a 4:1 compression, but differs to the dxt3 compression in how the alpha compression is
done.
Animating textures in WebGL - Web APIs
gl.texparameteri(gl.texture_2d, gl.texture_wrap_s, gl.clamp_to_edge); gl.texparameteri(gl.texture_2d, gl.texture_wrap_t, gl.clamp_to_edge); gl.texparameteri(gl.texture_2d, gl.texture_min_filter, gl.linear); return texture; } here's what the updatetexture() function looks like; this is where the real work is
done: function updatetexture(gl, texture, video) { const level = 0; const internalformat = gl.rgba; const srcformat = gl.rgba; const srctype = gl.unsigned_byte; gl.bindtexture(gl.texture_2d, texture); gl.teximage2d(gl.texture_2d, level, internalformat, srcformat, srctype, video); } you've seen this code before.
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
the old way in the past, if you encountered an ice error and needed to restart negotiation, you might have
done something like this: pc.onnegotiationneeded = async options => { await pc.setlocaldescription(await pc.createoffer(options)); signaler.send({ description: pc.localdescription }); }; pc.oniceconnectionstatechange = () => { if (pc.iceconnectionstate === "failed") { pc.onnegotiationneeded({ icerestart: true }); } }; this has a number of reliability issues and outright bugs (such as fa...
WebXR application life cycle - Web APIs
this is
done by calling navigator.xr.requestsession(), again specifying the string indicating the mode you want to enable: inline, immersive-vr, or immersive-ar.
Web Audio API - Web APIs
defining audio destinations once you are
done processing your audio, these interfaces define where to output it.
Web Workers API - Web APIs
audio workers provide the ability for direct scripted audio processing to be
done inside a web worker context.
Window.console - Web APIs
currently there are many implementation differences among browsers, but work is being
done to bring them together and make them more consistent with one another.
Window.controllers - Web APIs
however, the added controllers must be explicitly removed when the window is unloaded, as this is not
done automatically.
Worker - Web APIs
creating a worker is
done by calling the worker("path/to/worker/script") constructor.
WritableStream - Web APIs
the defaultwriter.ready property returns a promise that resolves when the sink (the first property of the writablestream constructor) is
done writing data.
Synchronous and asynchronous requests - Web APIs
this is
done by setting the value of the timeout property on the xmlhttprequest object, as shown in the code below: function loadfile(url, timeout, callback) { var args = array.prototype.slice.call(arguments, 3); var xhr = new xmlhttprequest(); xhr.ontimeout = function () { console.error("the request for " + url + " timed out."); }; xhr.onload = function() { if (xhr.readys...
XMLHttpRequest.getAllResponseHeaders() - Web APIs
(); // convert the header string into an array // of individual headers var arr = headers.trim().split(/[\r\n]+/); // create a map of header names to values var headermap = {}; arr.foreach(function (line) { var parts = line.split(': '); var header = parts.shift(); var value = parts.join(': '); headermap[header] = value; }); } } once this is
done, you can, for example: var contenttype = headermap["content-type"]; this obtains the value of the content-type header into the variable contenttype.
XMLHttpRequest.onreadystatechange - Web APIs
examples const xhr = new xmlhttprequest(), method = "get", url = "https://developer.mozilla.org/"; xhr.open(method, url, true); xhr.onreadystatechange = function () { // in local files, status is 0 upon success in mozilla firefox if(xhr.readystate === xmlhttprequest.
done) { var status = xhr.status; if (status === 0 || (status >= 200 && status < 400)) { // the request has been completed successfully console.log(xhr.responsetext); } else { // oh no!
XMLHttpRequest.response - Web APIs
it works by creating an xmlhttprequest object and creating a listener for readystatechange events such that that when readystate changes to
done (4), the response is obtained and passed into the callback function provided to load().
XMLHttpRequest.responseXML - Web APIs
example var xhr = new xmlhttprequest; xhr.open('get', '/server'); // if specified, responsetype must be empty string or "document" xhr.responsetype = 'document'; // force the response to be parsed as xml xhr.overridemimetype('text/xml'); xhr.onload = function () { if (xhr.readystate === xhr.
done && xhr.status === 200) { console.log(xhr.response, xhr.responsexml); } }; xhr.send(); specifications specification status comment xmlhttprequestthe definition of 'responsexml' in that specification.
XMLHttpRequest.status - Web APIs
example var xhr = new xmlhttprequest(); console.log('unsent: ', xhr.status); xhr.open('get', '/server'); console.log('opened: ', xhr.status); xhr.onprogress = function () { console.log('loading: ', xhr.status); }; xhr.onload = function () { console.log('
done: ', xhr.status); }; xhr.send(); /** * outputs the following: * * unsent: 0 * opened: 0 * loading: 200 *
done: 200 */ specifications specification status comment xmlhttprequest living standard whatwg living standard ...
XMLHttpRequest.statusText - Web APIs
example var xhr = new xmlhttprequest(); console.log('0 unsent', xhr.statustext); xhr.open('get', '/server', true); console.log('1 opened', xhr.statustext); xhr.onprogress = function () { console.log('3 loading', xhr.statustext); }; xhr.onload = function () { console.log('4
done', xhr.statustext); }; xhr.send(null); /** * outputs the following: * * 0 unsent * 1 opened * 3 loading ok * 4
done ok */ specifications specification status comment xmlhttprequest living standard whatwg living standard ...
XRPose.transform - Web APIs
it determines the targeted object by passing the event frame's pose into a function called findtargetusingray(), then dispatches the event differently depending on the user's handedness; this is
done by comparing the value of the xrinputsource property handedness to a value in the variable user.handedness.
XRTargetRayMode - Web APIs
targeting may be
done by looking at the target using a gaze-tracking system, pointing at the target with a hand controller, glove, or motion-tracking system, or by tapping or clicking on the target using a finger on a screen or with a mouse.
ARIA: dialog role - Accessibility
additionally, the following needs to be
done: the dialog must be properly labeled keyboard focus must be managed correctly the sections below describe how these two requirements can be met.
Operable - Accessibility
success criteria how to conform to the criteria practical resource 2.1.1 keyboard (a) all functionality should be accessible using keyboard controls, unless it cannot be
done using the keyboard (e.g.
-moz-context-properties - CSS: Cascading Style Sheets
for example: .img1 { width: 100px; height: 100px; -moz-context-properties: fill, stroke; fill: lime; stroke: purple; } now that you've
done this, the svg image can use the values of the fill and stroke properties, for example: <img class="img1" src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'> <rect width='100%' height='100%' stroke-width='30px' fill='context-fill red' stroke='context-stroke' fill-opacity='0.5'/></svg>"> here we've set the image src to a data uri con...
:target - CSS: Cascading Style Sheets
donec felis enim, placerat id eleifend eu, semper vel sem.</figcaption> </figure> </div> <div class="lightbox" id="example2"> <figure> <a href="#" class="close"></a> <figcaption>cras risus odio, pharetra nec ultricies et, mollis ac augue.
Using CSS transforms - CSS: Cascading Style Sheets
ground: rgba(196, 196, 0, 0.7); transform: rotatex(90deg) translatez(50px); } .bottom { background: rgba(196, 0, 196, 0.7); transform: rotatex(-90deg) translatez(50px); } /* make the layout a little nicer */ section { background-color: #eee; padding: 10px; font-family: sans-serif; text-align: left; display: grid; grid-template-columns: repeat(3, 1fr); } result once you have
done this, you can work on the element in the 3d space.
break-inside - CSS: Cascading Style Sheets
to determine if a break must be
done, the following rules are applied: if any of the three concerned values is a forced break value (always, left, right, page, column, or region), it has precedence.
image() - CSS: Cascading Style Sheets
while this can and should be
done by including a background-color on every background image, the css image() function allows adding allows only including background colors should an image fail to load, which means you can add a fall back color should a transparent png/gif/webp not load.
justify-content - CSS: Cascading Style Sheets
the alignment is
done after the lengths and auto margins are applied, meaning that, if in a flexbox layout there is at least one flexible element, with flex-grow different from 0, it will have no effect as there won't be any available space.
CSS: Cascading Style Sheets
previously development of various parts of css specification was
done synchronously, which allowed versioning of the latest recommendation.
Event reference
mozbrowseractivity
done firefox os browser api-specific sent when some activity has been completed (complete description tbd.) mozbrowserasyncscroll firefox os browser api-specific sent when the scroll position within a browser <iframe> changes.
Evolution of HTTP - HTTP
using http for secure transmissions the largest change that happened to http was
done as early as end of 1994.
Compression in HTTP - HTTP
end-to-end compression refers to a compression of the body of a message that is
done by the server and will last unchanged until it reaches the client.
Accept-Charset - HTTP
but for a better user experience, this is rarely
done and the accept-charset header is ignored.
Accept-Language - HTTP
but, for a better user experience, this is rarely
done and more common way is to ignore the accept-language header in this case.
Accept - HTTP
browsers set adequate values for this header depending on the context where the request is
done: when fetching a css stylesheet a different value is set for the request than when fetching an image, video or a script.
Connection - HTTP
if the value sent is keep-alive, the connection is persistent and not closed, allowing for subsequent requests to the same server to be
done.
Content-Disposition - HTTP
the filename is always optional and must not be used blindly by the application: path information should be stripped, and conversion to the server file system rules should be
done.
If-Match - HTTP
it can check if the modification of a resource that the user wants to upload will not override another change that has been
done since the original resource was fetched.
If-Unmodified-Since - HTTP
there are two common use cases: in conjunction with non-safe methods, like post, it can be used to implement an optimistic concurrency control, like
done by some wikis: editions are rejected if the stored document has been modified since the original has been retrieved.
Protocol upgrade mechanism - HTTP
keep in mind that if you're opening a new connection using the websocket api, or any library that does websockets, most or all of this is
done for you.
HTTP resources and specifications - HTTP
designed with extensibility in mind, it has seen numerous additions over the years; this lead to its specification being scattered through numerous specification documents (in the midst of experimental aban
doned extensions).
HTTP
http request methods the different operations that can be
done with http: get, post, and also less common requests like options, delete, or trace.
Using Promises - JavaScript
(...funcs) => x => funcs.reduce(applyasync, promise.resolve(x)); the composeasync() function will accept any number of functions as arguments, and will return a new function that accepts an initial value to be passed through the composition pipeline: const transformdata = composeasync(func1, func2, func3); const result3 = transformdata(data); in ecmascript 2017, sequential composition can be
done more simply with async/await: let result; for (const f of [func1, func2, func3]) { result = await f(result); } /* use last result (i.e.
Memory Management - JavaScript
this can be
done by reading or writing the value of a variable or an object property or even passing an argument to a function.
constructor - JavaScript
} description a constructor enables you to provide any custom initialization that must be
done before any other methods can be called on an instantiated object.
Array.prototype.slice() - JavaScript
function list() { return array.prototype.slice.call(arguments) } let list1 = list(1, 2, 3) // [1, 2, 3] binding can be
done with the call() method of function.prototype and it can also be reduced using [].slice.call(arguments) instead of array.prototype.slice.call.
BigInt.prototype.toLocaleString() - JavaScript
chinese decimal console.log(bigint.tolocalestring('zh-hans-cn-u-nu-hanidec')); // → 一二三,四五六,七八九,一二三,四五六,七八九 // when requesting a language that may not be supported, such as // balinese, include a fallback language, in this case in
donesian console.log(bigint.tolocalestring(['ban', 'id'])); // → 123.456.789.123.456.789 using options the results provided by tolocalestring can be customized using the options argument: var bigint = 123456789123456789n; // request a currency format console.log(bigint.tolocalestring('de-de', { style: 'currency', currency: 'eur' })); // → 123.456.789.123.456.789,00 € // the japanese yen do...
Date.prototype.toLocaleDateString() - JavaScript
onsole.log(date.tolocaledatestring('ar-eg')); // → "٢٠/١٢/٢٠١٢" // for japanese, applications may want to use the japanese calendar, // where 2012 was the year 24 of the heisei era console.log(date.tolocaledatestring('ja-jp-u-ca-japanese')); // → "24/12/20" // when requesting a language that may not be supported, such as // balinese, include a fallback language, in this case in
donesian console.log(date.tolocaledatestring(['ban', 'id'])); // → "20/12/2012" using options the results provided by tolocaledatestring() can be customized using the options argument: var date = new date(date.utc(2012, 11, 20, 3, 0, 0)); // request a weekday along with a long date var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; console.log(date.tolocaledatest...
Date.prototype.toLocaleString() - JavaScript
localestring('ar-eg')); // → "٢٠/١٢/٢٠١٢ ٥:٠٠:٠٠ ص" // for japanese, applications may want to use the japanese calendar, // where 2012 was the year 24 of the heisei era console.log(date.tolocalestring('ja-jp-u-ca-japanese')); // → "24/12/20 12:00:00" // when requesting a language that may not be supported, such as // balinese, include a fallback language (in this case, in
donesian) console.log(date.tolocalestring(['ban', 'id'])); // → "20/12/2012 11.00.00" using options the results provided by tolocalestring() can be customized using the options argument: let date = new date(date.utc(2012, 11, 20, 3, 0, 0)); // request a weekday along with a long date let options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; console.log(date.tolocalestr...
Date.prototype.toLocaleTimeString() - JavaScript
b')); // → "03:00:00" // korean uses 12-hour time with am/pm console.log(date.tolocaletimestring('ko-kr')); // → "오후 12:00:00" // arabic in most arabic speaking countries uses real arabic digits console.log(date.tolocaletimestring('ar-eg')); // → "٧:٠٠:٠٠ م" // when requesting a language that may not be supported, such as // balinese, include a fallback language, in this case in
donesian console.log(date.tolocaletimestring(['ban', 'id'])); // → "11.00.00" using options the results provided by tolocaletimestring() can be customized using the options argument: var date = new date(date.utc(2012, 11, 20, 3, 0, 0)); // an application may want to use utc and make that visible var options = { timezone: 'utc', timezonename: 'short' }; console.log(date.tolocaletimestring('en-us...
Intl.DateTimeFormat - JavaScript
meformat('ar-eg').format(date)); // → "١٩/١٢/٢٠١٢" // for japanese, applications may want to use the japanese calendar, // where 2012 was the year 24 of the heisei era console.log(new intl.datetimeformat('ja-jp-u-ca-japanese').format(date)); // → "24/12/19" // when requesting a language that may not be supported, such as // balinese, include a fallback language, in this case in
donesian console.log(new intl.datetimeformat(['ban', 'id']).format(date)); // → "19/12/2012" using options the date and time formats can be customized using the options argument: var date = new date(date.utc(2012, 11, 20, 3, 0, 0, 200)); // request a weekday along with a long date var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; console.log(new intl.datetimefor...
Intl.NumberFormat - JavaScript
chinese decimal console.log(new intl.numberformat('zh-hans-cn-u-nu-hanidec').format(number)); // → 一二三,四五六.七八九 // when requesting a language that may not be supported, such as // balinese, include a fallback language, in this case in
donesian console.log(new intl.numberformat(['ban', 'id']).format(number)); // → 123.456,789 using options the results can be customized using the options argument: var number = 123456.789; // request a currency format console.log(new intl.numberformat('de-de', { style: 'currency', currency: 'eur' }).format(number)); // → 123.456,79 € // the japanese yen doesn't use a minor unit console.log...
Map - JavaScript
note: as of es5, this can be bypassed by using object.create(null), but this is seldom
done.
Number.prototype.toLocaleString() - JavaScript
chinese decimal console.log(number.tolocalestring('zh-hans-cn-u-nu-hanidec')); // → 一二三,四五六.七八九 // when requesting a language that may not be supported, such as // balinese, include a fallback language, in this case in
donesian console.log(number.tolocalestring(['ban', 'id'])); // → 123.456,789 using options the results provided by tolocalestring can be customized using the options argument: var number = 123456.789; // request a currency format console.log(number.tolocalestring('de-de', { style: 'currency', currency: 'eur' })); // → 123.456,79 € // the japanese yen doesn't use a minor unit console.log(nu...
Promise.all() - JavaScript
w empty'); console.log(p); }); // logs // promise { <state>: "pending" } // the stack is now empty // promise { <state>: "rejected", <reason>: 44 } but, promise.all resolves synchronously if and only if the iterable passed is empty: var p = promise.all([]); // will be immediately resolved var p2 = promise.all([1337, "hi"]); // non-promise values will be ignored, but the evaluation will be
done asynchronously console.log(p); console.log(p2) settimeout(function() { console.log('the stack is now empty'); console.log(p2); }); // logs // promise { <state>: "fulfilled", <value>: array[0] } // promise { <state>: "pending" } // the stack is now empty // promise { <state>: "fulfilled", <value>: array[2] } promise.all fail-fast behaviour promise.all is rejected if any of the elements...
Promise.any() - JavaScript
const perr = new promise((resolve, reject) => { reject("always fails"); }); const pslow = new promise((resolve, reject) => { settimeout(resolve, 500, "
done eventually"); }); const pfast = new promise((resolve, reject) => { settimeout(resolve, 100, "
done quick"); }); promise.any([perr, pslow, pfast]).then((value) => { console.log(value); // pfast fulfils first }) // expected output: "
done quick" rejections with aggregateerror promise.any() rejects with an aggregateerror if no promise fulfils.
Promise - JavaScript
ermineparity,troublewithgetnumber) .then(promisegetword) .then((info) => { console.log("got: ",info.thenumber," , ", info.wordevenodd); return info; }) .catch((reason) => { if(reason === -999) { console.error("had previously handled error"); } else { console.error(`trouble with promisegetword(): ${reason}`); } }) .finally((info) => console.log("all
done")); advanced example <button id="btn">make a promise!</button> <div id="log"></div> this small example shows the mechanism of a promise.
RegExp.$1-$9 - JavaScript
regexp.$1 : '0'; number; // "24" please note that any operation involving the usage of other regular expressions between a re.test(str) call and the regexp.$n property, might have side effects, so that accessing these special properties should be
done instantly, otherwise the result might be unexpected.
undefined - JavaScript
the global scope is bound to the global object, so checking the existence of a variable in the global context can be
done by checking the existence of a property on the global object, using the in operator, for instance: if ('x' in window) { // these statements execute only if x is defined globally } void operator and undefined the void operator is a third alternative.
async function - JavaScript
examples async functions and execution order function resolveafter2seconds() { console.log("starting slow promise") return new promise(resolve => { settimeout(function() { resolve("slow") console.log("slow promise is
done") }, 2000) }) } function resolveafter1second() { console.log("starting fast promise") return new promise(resolve => { settimeout(function() { resolve("fast") console.log("fast promise is
done") }, 1000) }) } async function sequentialstart() { console.log('==sequential start==') // 1.
Web audio codec guide - Web media technologies
container support ogg, webm rtp / webrtc compatible yes licensing fully open and free of any licensing requirements choosing an audio codec typically, regardless of what codec you use, it will generally get the job
done, even if it's not the ideal choice, as long as you choose a codec not specifically designed for a totally different kind of source audio.
Web Performance
we cover them in this section: key performance guides animation performance and frame rateanimation on the web can be
done via svg, javascript, including <canvas> and webgl, css animation, <video>, animated gifs and even animated pngs and other image types.
Structural overview of progressive web apps - Progressive web apps (PWAs)
self.addeventlistener('install', function(e) { console.log('[service worker] install'); e.waituntil( caches.open(cachename).then(function(cache) { console.log('[service worker] caching all: app shell and content'); return cache.addall(contenttocache); }) ); }); with that
done, we implement the service worker's fetch event handler; its job is to return the contents of the specified file, either from the cache or by loading it over the network (caching it upon doing so): self.addeventlistener('fetch', function(e) { e.respondwith( caches.match(e.request).then(function(r) { console.log('[service worker] fetching resource: '+e.request.url); return r || f...
transform - SVG: Scalable Vector Graphics
example html,body,svg { height:100% } <svg viewbox="-12 -2 34 14" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="10" height="10" /> <!-- rotation is
done around the point 0,0 --> <rect x="0" y="0" width="10" height="10" fill="red" transform="rotate(100)" /> <!-- rotation is
done around the point 10,10 --> <rect x="0" y="0" width="10" height="10" fill="green" transform="rotate(100,10,10)" /> </svg> skewx the skewx(<a>) transform function specifies a skew transformation along the x axis by a degrees.