Search completed in 0.98 seconds.
87 results for "defer":
Your results are loading. Please wait...
Deferred
a deferred object is returned by the obsolete promise.defer() method to provide a new promise along with methods to change its state. starting from gecko 30, this object is obsolete and should not be used anymore. use the new promise() constructor instead (or use the above backwards/forwards compatible deferred function given below). ...
... a deferred object is returned by the obsolete promise.defer() method to provide a new promise along with methods to change its state. starting from gecko 30, this object is obsolete and should not be used anymore. use the new promise() constructor instead (or use the above backwards/forwards compatible deferred function given below). ...
... a deferred object is returned by the obsolete promise.defer() method to provide a new promise along with methods to change its state. starting from gecko 30, this object is obsolete and should not be used anymore. use the new promise() constructor instead (or use the above backwards/forwards compatible deferred function given below). ...
...And 16 more matches
DeferredTask.jsm
firefox 28 note interface was changed in firefox 28, and old methods were removed. the deferredtask.jsm javascript code module offers utility routines for a task that will run after a delay. multiple attempts to run the same task before the delay will be coalesced. to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://gre/modules/deferredtask.jsm"); use this, for instance, if you write data to a file and you expect that you may have to rewrite data very soon afterwards. ...
...tines for a task that will run after a delay. multiple attempts to run the same task before the delay will be coalesced. to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://gre/modules/deferredtask.jsm"); use this, for instance, if you write data to a file and you expect that you may have to rewrite data very soon afterwards. ...
...dtask.jsm"); use this, for instance, if you write data to a file and you expect that you may have to rewrite data very soon afterwards. with deferredtask, the task is delayed by a few milliseconds and, should a new change to the data occur during this period, only the final version of the data is actually written; a further grace delay is added to take into account other changes. the deferredtask constructor requires gecko 18.0(firefox 18.0 / thunderbird 18.0 / seamonkey 2.15) if you have a function call you want to defer for two seconds, you can do so using the deferredtask constructor, like this: var task = new deferredtask(myfunction, 2000); you can also pass a generator function as the first argument of constructor. method overview bool ispending();obsolete...
...And 6 more matches
Deferred
method overview void resolve([optional] avalue); void reject([optional] areason); properties attribute type description promise read only promise a newly created promise, initially in the pending state. methods resolve() fulfills the associated promise with the specified value, or propagates the state of an existing promise. if the associated promise has already been resolved, either to a value, a rejection, or another promise, this method does nothing. note: this function is exactly same as promise constructor's resolve argument, and can be called with any value of this. ...
core/promise - Archive of obsolete content
n result; }, function (reason) { // rejection handler called because `failasync` promise // was rejected with its reason propagated return reason; }); making promises everything above assumes you get a promise from somewhere else. this is the common case, but every once in a while, you will need to create a promise from scratch. add-on sdk's promise module provides an api for doing that. ...
...(reason) { // rejection handler called because `failasync` promise // was rejected with its reason propagated return reason; }); making promises everything above assumes you get a promise from somewhere else. this is the common case, but every once in a while, you will need to create a promise from scratch. add-on sdk's promise module provides an api for doing that. ...
... above assumes you get a promise from somewhere else. this is the common case, but every once in a while, you will need to create a promise from scratch. add-on sdk's promise module provides an api for doing that. defer module exports defer function, which is where all promises ultimately come from. ...
...And 11 more matches
Examples
re/modules/devtools/server/transport.js:279:11 makeinfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/devtoolsutils.js:84:7 */ intermediate of user defined promise function 1 components.utils.import("resource://gre/modules/promise.jsm"); // this function creates and returns a new promise. ...
.../server/transport.js:279:11 makeinfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/devtoolsutils.js:84:7 */ intermediate of user defined promise function 1 components.utils.import("resource://gre/modules/promise.jsm"); // this function creates and returns a new promise. ...
...omponents.utils.import("resource://gre/modules/promise.jsm"); // this function creates and returns a new promise. function promisevalueaftertimeout(avalue, atimeout) { let deferred = promise.defer(); try { // an asynchronous operation will trigger the resolution of the promise. // in this example, we don't have a callback that triggers a rejection. settimeout(function () { deferred.resolve('rawr my success value'); }, atimeout); } catch (ex) { // generally, functions returning promises propagate exceptions through // the returned promise, though they may also choose to fail early. deferred.reject(ex); } // we don't return the deferred to the caller, but only the contained // promise, so that the caller cannot accidentally change its state. retu...
...And 5 more matches
What is JavaScript? - Learn web development
ernal javascript this works great, but what if we wanted to put our javascript in an external file? let's explore this now. first, create a new file in the same directory as your sample html file. call it script.js — make sure it has that .js filename extension, as that's how it is recognized as javascript. ...
... is an event listener, which listens for the browser's "domcontentloaded" event, which signifies that the html body is completely loaded and parsed. the javascript inside this block will not run until after that event is fired, therefore the error is avoided (you'll learn about events later in the course). in the external example, we use a more modern javascript feature to solve the problem, the defer attribute, which tells the browser to continue downloading the html content once the <script> tag element has been reached. <script src="script.js" defer></script> in this case both the script and the html will load simultaneously and the code will work. note: in the external case, we did not need to use the domcontentloaded event because the defer attribute solved the problem for us. we didn...
... an old-fashioned solution to this problem used to be to put your script element right at the bottom of the body (e.g. ...
...And 4 more matches
Add to Home screen - Progressive web apps (PWAs)
atically on desktop apps, and the installation needs to be triggered by a user gesture: <button class="add-button">add to home screen</button> we then gave it some simple styling: .add-button { position: absolute; top: 1px; left: 1px; } javascript for handling the install at the bottom of our index.js file, we added some javascript to handle the installation. first of all, we declare a deferredprompt variable (which we'll explain later on), get a reference to our install button, and set it to display: none initially: let deferredprompt; const addbtn = document.queryselector('.add-button'); addbtn.style.display = 'none'; we hide the button initially because the pwa will not be available for install until it follows the a2hs criteria. when this happens, supporting browsers will fire ...
...install until it follows the a2hs criteria. when this happens, supporting browsers will fire a beforeinstallprompt event. we can then use a handler like the one below to handle the installation: window.addeventlistener('beforeinstallprompt', (e) => { // prevent chrome 67 and earlier from automatically showing the prompt e.preventdefault(); // stash the event so it can be triggered later. ...
...rlier from automatically showing the prompt e.preventdefault(); // stash the event so it can be triggered later. ...
...And 3 more matches
nsITraceableChannel
/binaryoutputstream;1', 'nsibinaryoutputstream', 'setoutputstream'); var storagestream = cc('@mozilla.org/storagestream;1', 'nsistoragestream', 'init'); function tracinglistener() { this.receivedchunks = []; // array for incoming data. ...
...ragestream = cc('@mozilla.org/storagestream;1', 'nsistoragestream', 'init'); function tracinglistener() { this.receivedchunks = []; // array for incoming data. ...
...s = []; // array for incoming data. ...
...And 2 more matches
<script>: The Script element - HTML: Hypertext Markup Language
Web › HTML › Element › script
om interface htmlscriptelement attributes this element includes the global attributes. asynchtml5 for classic scripts, if the async attribute is present, then the classic script will be fetched in parallel to parsing and evaluated as soon as it is available. for module scripts, if the async attribute is present then the scripts and all their dependencies will be executed in the defer queue, therefore they will get fetched in parallel to parsing and evaluated as soon as they are available. this attribute allows the elimination of parser-blocking javascript where the browser would have to load and evaluate scripts before continuing to parse. defer has a similar effect in this case. this is a boolean attribute: the presence of a boolean attribute on an element represents the...
...lity for notes on browser support. see also async scripts for asm.js. crossorigin normal script elements pass minimal information to the window.onerror for scripts which do not pass the standard cors checks. to allow error logging for sites which use a separate domain for static media, use this attribute. see cors settings attributes for a more descriptive explanation of its valid arguments. defer this boolean attribute is set to indicate to a browser that the script is meant to be executed after the document has been parsed, but before firing domcontentloaded. scripts with the defer attribute will prevent the domcontentloaded event from firing until the script has loaded and finished evaluating. this attribute must not be used if the src attribute is absent (i.e. for inline scrip...
...a browser that the script is meant to be executed after the document has been parsed, but before firing domcontentloaded. scripts with the defer attribute will prevent the domcontentloaded event from firing until the script has loaded and finished evaluating. this attribute must not be used if the src attribute is absent (i.e. for inline scripts), in this case it would have no effect. the defer attribute has no effect on module scripts — they defer by default. scripts with the defer attribute will execute in the order in which they appear in the document. this attribute allows the elimination of parser-blocking javascript where the browser would have to load and evaluate scripts before continuing to parse. async has a similar effect in this case. integrity this attribute con...
...And 2 more matches
lang/functional - Archive of obsolete content
times: method(times), add: method(add), number: 0 }; function times (target, x) { return target.number *= x; } function add (target, x) { return target.number += x; } console.log(mynumber.number); // 0 mynumber.add(10); // 10 mynumber.times(2); // 20 mynumber.add(3); // 23 parameters lambda : function the function to be wrapped and returned. returns function : the wrapped lambda. defer(fn) takes a function and returns a wrapped version of the function. calling the wrapped version will call the original function during the next event loop. this is similar to calling settimeout with no wait (i.e. settimeout(function () { ... }, 0)), except that the wrapped function may be reused and does not need to be repeated each time. this also enables you to use these functions as event lis...
...unction and returns a wrapped version of the function. calling the wrapped version will call the original function during the next event loop. this is similar to calling settimeout with no wait (i.e. settimeout(function () { ... }, 0)), except that the wrapped function may be reused and does not need to be repeated each time. this also enables you to use these functions as event listeners. ...
...on. calling the wrapped version will call the original function during the next event loop. this is similar to calling settimeout with no wait (i.e. settimeout(function () { ... }, 0)), except that the wrapped function may be reused and does not need to be repeated each time. this also enables you to use these functions as event listeners. ...
...cept that the wrapped function may be reused and does not need to be repeated each time. this also enables you to use these functions as event listeners. 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. returns function : the new, deferred function. remit() an alias for defer. invoke(callee, params, self) invokes callee, passing params as an argument and self as this. returns the value that is returned by callee. let...
MMgc - Archive of obsolete content
declared write barrier. it must be used on a pointer to a gcobject/gcfinalizedobject, when that pointer is a member variable of a class derived from gcobject/gcfinalizedobject/rcobject/rcfinalizedobject. class mymanagedclass : public mmgc::gcobject { // mymanagedclass is a gcobject, and // avmplus::hashtable is a gcobject, so use dwb dwb(avmplus::hashtable*) mytable; }; drc drc stands for deferred reference counted. it must be used on a pointer to a rcobject/rcfinalizedobject, when that pointer is a member variable of a c++ class in unmanaged memory. class myunmanagedclass { // myunmanagedclass is not a gcobject, and // avmplus::stringp is a rcobject, so use drc drc(stringp) mystring; }; drcwb drcwb stands for deferred reference counted, with write barrier. it must be used on a p...
...undreds of megabytes of ram real quick. with a conservative gc, the leaks tend to be random, such that they don't grow over time. the occasional random leak from a false positive can be ok. that doesn't mean we shouldn't worry about it at all, but often conservative gc suffices. it is possible that a future version of mmgc might do exact marking. this would be needed for a generational collector. deferred reference counting (drc) mmgc uses deferred reference counting (drc). drc is a scheme for getting more immediate reclamation of objects, while still achieving high performance and getting the other benefits of garbage collection. classic reference counting previous versions of the flash player, up to flash player 7, used reference counting to track object lifetimes. class object { public: ob...
... so, some kind of reference counting is still attractive to lower the amount of work the gc has to do, and to get more immediacy on memory reclamation. however, reference counting is also slow because the reference counts need to be constantly maintained. so, it's attractive to find some form of reference counting that doesn't require maintaining reference counts for every single reference. enter deferred reference counting in deferred reference counting, a distinction is made between heap and stack references. stack references to objects tend to be very temporary in nature. stack frames come and go very quickly. so, performance can be gained by not performing reference counting on the stack references. heap references are different since they can persist for long periods of time. so, in a drc ...
Promise.jsm
the promise.jsm javascript code module implements the promises/a+ proposal as known in april 2013. this module was used before dom promises were made globally available in gecko 29. its usage is not suggested for new code. if you just need a promise, consider using a dom promise instead. if you need a deferred, because you want to create a promise and manually resolve or reject it, consider using promiseutils.jsm instead. to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://gre/modules/promise.jsm"); note: a preliminary promise module is also available starting from gecko 17, though it didn't conform to the promises/a+ proposal until gecko 25: components.utils.import("resource://gre/modules/commonjs/promise/core.js"); ...
... in turn, is fulfilled or rejected depending on the state of the original promise and on the behavior of the callbacks. for example, unhandled exceptions in the callbacks cause the new promise to be rejected, even if the original promise is fulfilled. see the documentation of the then method for details. promises may also be created using the new promise() constructor. method overview deferred defer(); obsolete since gecko 30 promise resolve([optional] avalue); promise reject([optional] areason); methods defer() creates a new pending promise and provides methods to resolve or reject it. deferred defer(); obsolete since gecko 30 parameters none. return value a new object, containing the new promise in the promise property, and the methods to change it...
... resolve() creates a new promise fulfilled with the specified value, or propagates the state of an existing promise. ...
Tracing JIT
e function elsewhere in spidermonkey -- some helper function written in c -- and that native happens to re-enter the interpreter to interpret yet more bytecode, and furthermore if that bytecode itself contains a hot pc that has not yet been traced, the trace monitor may be asked to begin nested recording. this is the same as normal recording mode, except that the outermost recorder is placed on a deferred-abort stack. when the innermost recorder completes -- successfully or otherwise -- every recorder on the deferred abort stack is aborted. this process is called deep aborting the suspended recorders. executing when the monitor interprets a backward jump to a pc that it has a compiled trace of machine code for, the monitor enters executing mode. this mode is relatively simple compared to rec...
... the side exit and, depending on the exit condition, reconstructs a certain number of interpreter frames and flushes a certain set of writes back to the spidermonkey heap. frame reconstruction is necessary because a trace may inline a number of function calls, and may exit before those function calls return. write flushing is necessary because all writes to imported values in the native stack are deferred until trace-exit, as an optimization. if the side exit condition indicates that the trace exited successfully -- simply running out of native code or hitting a branch condition that no native code yet exists to handle -- the monitor will inspect the hit count for the trace-exiting pc. if that pc has itself grown hot, the monitor will immediately transition to recording mode starting with the ...
...terpreter handles all outcomes of such a condition dynamically. the term deep bail denotes a special case of bailing: when a trace calls a native spidermonkey c function that gets part-way through executing and then forces a trace-exit (possibly due to a nested c function depending on not-yet-flushed state in the trace). a deep bail is special only insofar as it requires flushing the full set of deferred writes in the trace if it occurs (and further, requires that all registers holding temporary trace operands have flushed to the native stack before execution). bailing from a regular guard involves executing precise per-guard write-flushing code, as the guard encodes a specific failed condition on a specific set of operands, and so the exit code can be much more fine-grained about and reconstr...
mozIStorageConnection
version of the database. this should not be used until the database is ready. the version will be reported as 0 if it is not set. transactioninprogress boolean returns true if there is a transaction in progress on the database. otherwise returns false. read only. constants transaction execution time constants. constant value description transaction_deferred 0 no database lock is obtained until the first statement is run. transaction_immediate 1 a reserved lock is obtained on the database. transaction_exclusive 2 an exclusive lock is obtained on the database. sqlite database page size constant constant value description default_page_size 32768 the default size for sqlite dat...
... acallback optional an optional callback handler to be executed when the connection is successfully closed. that object's mozistoragecompletioncallback.complete() routine will be called once the connection is closed. exceptions thrown ns_error_unexpected thrown if the method was called on a thread other than the one that opened the connection. begintransaction() starts a new transaction deferred transaction. this is the same as calling mozistorageconnection with mozistorageconnection.transaction_deferred. void begintransaction(); parameters none. begintransactionas() this method starts a new transaction of the given transaction type. see the sqlite documentation on transactions for more details. in javascript, managing transactions can be difficult when you are using the same ...
...method will manage the transactions for you, so you don't have to worry about them. note: the database engine does not support nested transactions, so attempting to start a transaction when one is already active will throw an exception. void begintransactionas( in print32 transactiontype ); parameters transactiontype one of the transaction constants (mozistorageconnection.transaction_deferred, mozistorageconnection.transaction_immediate, mozistorageconnection.transaction_exclusive) clone() clones a database connection, optionally making the new connection read only. note: if your connection is already read-only, you will get a read-only clone. note: due to a bug in sqlite, if you use the shared cache (by calling mozistorageservice.opendatabase()), the cloned connection's acces...
HTMLScriptElement - Web APIs
c is a domstring representing the url of an external script. it reflects the src attribute. htmlscriptelement.event is a domstring; an obsolete way of registering event handlers on elements in an html document. htmlscriptelement.charset is a domstring representing the character encoding of an external script. it reflects the charset attribute. htmlscriptelement.async htmlscriptelement.defer the async and defer attributes are boolean attributes that control how the script should be executed. the defer and async attributes must not be specified if the src attribute is absent. there are three possible execution modes: if the async attribute is present, then the script will be executed asynchronously as soon as it downloads. if the async attribute is absent but the defe...
...tion modes: if the async attribute is present, then the script will be executed asynchronously as soon as it downloads. if the async attribute is absent but the defer attribute is present, then the script is executed when the page has finished parsing. if neither attribute is present, then the script is fetched and executed immediately, blocking further parsing of the page. the defer attribute may be specified with the async attribute, so legacy browsers that only support defer (and not async) fall back to the defer behavior instead of the default blocking behavior. note: the exact processing details for these attributes are complex, involving many different aspects of html, and therefore are scattered throughout the specification. these algorithms describe the core ideas,...
...e by that script. methods no specific methods; inherits methods from its parent, htmlelement. examples dynamically importing scripts let's create a function that imports new scripts within a document creating a <script> node immediately before the <script> that hosts the following code (through document.currentscript). these scripts will be asynchronously executed. for more details, see the defer and async properties. function loaderror(oerror) { throw new urierror("the script " + oerror.target.src + " didn't load correctly."); } function prefixscript(url, onloadfunction) { var newscript = document.createelement("script"); newscript.onerror = loaderror; if (onloadfunction) { newscript.onload = onloadfunction; } document.currentscript.parentnode.insertbefore(newscript, document...
Populating the page: how browsers work - Web Performance
es between different tags. tags nested within other tags are child nodes. the greater the number of dom nodes, the longer it takes to construct the dom tree. when the parser finds non-blocking resources, such as an image, the browser will request those resources and continue parsing. parsing can continue when a css file is encountered, but <script> tags—particularly those without an async or defer attribute—block rendering, and pause the parsing of html. though the browser's preload scanner hastens this process, excessive scripts can still be a significant bottleneck. preload scanner while the browser builds the dom tree, this process occupies the main thread. as this happens, the preload scanner will parse through the content available and request high priority resources like css, jav...
...et" src="styles.css"/> <script src="myscript.js" async></script> <img src="myimage.jpg" alt="image description"/> <script src="anotherscript.js" async></script> in this example, while the main thread is parsing the html and css, the preload scanner will find the scripts and image, and start downloading them as well. to ensure the script doesn't block the process, add the async attribute, or the defer attribute if javascript parsing and execution order is not important. waiting to obtain css doesn't block html parsing or downloading, but it does block javascript, because javascript is often used to query css properties’ impact on elements. building the cssom the second step in the critical rendering path is processing css and building the cssom tree. the css object model is similar to the...
...ted would be repainted, and composited if necessary. but we didn't include the image size! when the image is obtained from the server, the rendering process goes back to the layout steps and restarts from there. interactivity once the main thread is done painting the page, you would think we would be "all set." that isn't necessarily the case. if the load includes javascript, that was correctly deferred, and only executed after the onload event fires, the main thread might be busy, and not available for scrolling, touch, and other interactions. time to interactive (tti) is the measurement of how long it took from that first request which led to the dns lookup and ssl connection to when the page is interactive -- interactive being the point in time after the first contentful paint when the pa...
Promises - Archive of obsolete content
ue the changes to be written to disk. unless the flush() method is called, no writes will happen until a full second has elapsed between save() calls. the variable addon_id must be defined to the id of the add-on the code is being used in. this code makes use of the add-on manager helper defined above, though it can be adapted to work without it. components.utils.import("resource://gre/modules/deferredsave.jsm"); /** * handles the asynchronous reading and writing of add-on-specific json * data files. * * @param {string} the basename of the file. * @param {object} a json-compatible object which will be used in place * of the file's data, if the file does not already exist. * @optional * * @return {promise<jsonstore>} */ function jsonstore(name, default_={}) { return t...
... this.data = json.parse( yield os.file.read(this.path, { encoding: "utf-8" })); } catch (e if e.becausenosuchfile) { this.data = json.parse(json.stringify(default_)); } // create a saver to write our json-stringified data to our // path, at 1000ms minimum intervals. this.saver = new deferredsave(this.path, () => json.stringify(this.data), 1000); return this; }.bind(this)); } /** * immediately save the data to disk. * * @return {promise} a promise which resolves when the file's contents * have been written. */ jsonstore.prototype.flush = function () { return this.saver.flush(); }; /** ...
What’s in the head? Metadata in HTML - Learn web development
ays go inside the head of your document. this takes two attributes, rel="stylesheet", which indicates that it is the document's stylesheet, and href, which contains the path to the stylesheet file: <link rel="stylesheet" href="my-css-file.css"> the <script> element should also go into the head, and should include a src attribute containing the path to the javascript you want to load, and defer, which basically instructs the browser to load the javascript at the same time as the page's html. this is useful as it makes sure that the html is all loaded before the javascript runs, so that you don't get errors resulting from javascript trying to access an html element that doesn't exist on the page yet. there are actually a number of ways to handle loading javascript on your page, but this ...
... that the html is all loaded before the javascript runs, so that you don't get errors resulting from javascript trying to access an html element that doesn't exist on the page yet. there are actually a number of ways to handle loading javascript on your page, but this is the most foolproof one to use for modern browsers (for others, read script loading strategies). <script src="my-js-file.js" defer></script> note: the <script> element may look like an empty element, but it's not, and so needs a closing tag. instead of pointing to an external script file, you can also choose to put your script inside the <script> element. active learning: applying css and javascript to a page to start this active learning, grab a copy of our meta-example.html, script.js and style.css files, a...
HTML parser threading
g to the event loop. if too much time has been spent, a runnable for calling runflushloop() again is dispatched and an early return made before all tree ops have been executed. (only the already executed ops are destructed and the rest are left in the queue.) the last op in the queue may be an op for attempting to execute a script that may block the parser (ops for attempting to execute async and defer scripts are normal tree ops and don't need to be the last op in a queue). the parts of the parser that drive the tokenizer/tree builder pairs guarantee to flush tree ops immediately if a script execution tree op is generated. (the tree builder makes the tokenizer return immediately when such an op is generated.) thus, a tree op that may cause the parser to block can only occur as the last op in a...
...if a script execution tree op is generated. (the tree builder makes the tokenizer return immediately when such an op is generated.) thus, a tree op that may cause the parser to block can only occur as the last op in a queue that runflushloop sees. preparing the parser thread for script execution when the parser thread sees that it has generated a tree op that attempts to execute a (non-async, non-defer) script, it starts speculating. it acquires mspeculationmutex and while holding it, it creates a new speculation and adds it to the queue of speculations, flushes the tree ops to the main thread, marks the nshtml5streamparser as being in a speculating state and sets the newly created speculation object as the tree op sink (instead of the tree op stage described earlier) of the tree builder. the s...
FileUtils.jsm
t is created, along with any parent directories that need to be created. note: if you want to use the full path to get to the directory you cannot use getdir. instead use the file constructor, so simply: var dir = new fileutils.file('c:\\blah\\blah'); if (dir.exists()) { //yes directory exists } openfileoutputstream() opens a file output stream for writing. the stream is opened with the defer_open nsifileoutputstream.behavior flag constant this means the file is not actually opened until the first time it's accessed. nsifileoutputstream openfileoutputstream( nsifile file, int modeflags ); parameters file the file to write to. modeflags optional file open flags (see constants above) return value returns nsifileoutputstream (the non-safe variant) to write to. openatomic...
....0, passing mode_append without mode_truncate will throw an exception. nsifileoutputstream opensafefileoutputstream( nsifile file, int modeflags ); parameters file the file to write to. modeflags optional file open flags (see constants above) return value returns nsifileoutputstream (the safe variant) to write to. remarks note: starting in gecko 6 the stream is opened with the defer_open nsifileoutputstream behavior flag constant; this means the file is not actually opened until the first time it's accessed. closesafefileoutputstream() closes a safe file output stream. void closesafefileoutputstream( nsifileoutputstream stream ); parameters stream the stream to close. see also nsifileoutputstream code snippets and examples ...
PromiseUtils.jsm
the promiseutils.jsm javascript code module offers some useful functions related to dom promise. to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://gre/modules/promiseutils.jsm"); method overview deferred defer(); methods defer() creates a new pending promise and provides methods to resolve or reject this promise. this method was previously implemented as promise.defer(), which is obsolete since gecko 30. ...
...eed to import the code module into your javascript scope: components.utils.import("resource://gre/modules/promiseutils.jsm"); method overview deferred defer(); methods defer() creates a new pending promise and provides methods to resolve or reject this promise. this method was previously implemented as promise.defer(), which is obsolete since gecko 30. and promiseutils.defer uses dom promise instead of promise.jsm's promise. deferred defer(); parameters none. return value a new object, containing the new promise in the promise property, and the methods to change its state in the resolve and reject properties. see the deferred documentation for details. ...
Sqlite.jsm
tained within it are committed as one unit. if the transaction fails, the database is rolled back to its state before the transaction started. this function receives the following arguments: func the function defining the transaction body. type the type of transaction to perform. this must be one of the transaction_* constants on the opened connection instance. valid values are transaction_deferred, transaction_immediate, transaction_exclusive. see the sqlite documentation for their meaning. the default is transaction_deferred. the passed function is a task.jsm compatible generator function. when called, the function receives as its argument the current connection instance. this generator function is expected to yield promises, likely those returned by calling executecached() and execu...
... mytable values (:parama, :paramb)", data); } }); transactions these examples demonstrate how transactions work. conn.executetransaction(async function simpletransaction() { await conn.execute("insert into mytable values (?, ?)", ["foo", "bar"]); await conn.execute("insert into mytable values (?, ?)", ["biz", "baz"]); }); the above will result in 2 insert statements being committed in a deferred transaction (assuming the inserts proceed without error, of course). let's do an example where we want to force a transaction rollback. conn.executetransaction(async function complextransaction() { await conn.execute("insert into mytable values (?, ?)", ["foo", "bar"]); let data = await conn.execute("select * from mytable"); if (data.length < 5) { throw new error("we don't have the...
nsIFileInputStream
when it is closed again. close_on_eof 1<<2 if this is set, the file will close automatically when the end of the file is reached. reopen_on_rewind 1<<3 if this is set, the file will be reopened whenever seek(0) occurs. if the file is already open and the seek occurs, it will happen naturally. ...
... note: using this flag results in the file not being opened during the call to init. ...
Index - Web APIs
Web › API › Index
property, reference, service workers, serviceworker the notification read-only property of the notificationevent interface returns the instance of the notification that was clicked to fire the event. the notification provides read-only access to many properties that were set at the instantiation time of the notification such as tag and data attributes that allow you to store information for defered use in the notificationclick event. 2792 notifications api landing, notifications, permission, system the notifications api allows web pages to control the display of system notifications to the end user. these are outside the top-level browsing context viewport, so therefore can be displayed even when the user has switched tabs or moved to a different app. the api is desig...
... webgl_depth_texture api, reference, webgl, webgl extension the webgl_depth_texture extension is part of the webgl api and defines 2d depth and depth-stencil textures. 4567 webgl_draw_buffers api, reference, webgl, webgl extension the webgl_draw_buffers extension is part of the webgl api and enables a fragment shader to write to several textures, which is useful for deferred shading, for example. 4568 webgl_draw_buffers.drawbufferswebgl() api, method, reference, webgl the webgl_draw_buffers.drawbufferswebgl() method is part of the webgl api and allows you to define the draw buffers to which all fragment colors are written. 4569 webgl_lose_context api, reference, webgl, webgl extension the webgl_lose_context extension is pa...
At-rules - CSS: Cascading Style Sheets
Web › CSS › At-rule
t will apply its content if the device meets the criteria of the condition defined using a media query. @supports — a conditional group rule that will apply its content if the browser meets the criteria of the given condition. @document — a conditional group rule that will apply its content if the document in which the style sheet is applied meets the criteria of the given condition. (deferred to level 4 of css spec) @page — describes the aspect of layout changes that will be applied when printing the document. @font-face — describes the aspect of an external font to be downloaded. @keyframes — describes the aspect of intermediate steps in a css animation sequence. @viewport — describes the aspects of the viewport for small screen devices. (currently at the wor...
...ements—either rulesets or nested at-rules. furthermore, they all convey a common semantic meaning—they all link some type of condition, which at any time evaluates to either true or false. if the condition evaluates to true, then all of the statements within the group will be applied. conditional group rules are defined in css conditionals level 3 and are: @media, @supports, @document. (deferred to level 4 of css spec) since each conditional group may also contain nested statements, there may be an unspecified amount of nesting. specifications specification status comment css conditional rules module level 3 candidate recommendation initial definition compatibility standardthe definition of 'css at-rules' in that specification. living sta...
HTML5 Parser - Developer guides
Web › Guide › HTML › HTML5 › HTML5 Parser
acy, as the content was inserted into a timing-dependent point in the source stream. if the call happened after the parser was done, the inserted content replaced the document. in ie, such calls are either ignored or imply a call to document.open(), replacing the document. ...
...scripts that serve racy code to firefox, perhaps while serving safe code to ie, will see a difference due to this change. ...
Preloading content with rel="preload" - HTML: Hypertext Markup Language
this example is trivial, as the browser probably discovers the <link rel="stylesheet"> and <script> elements in the same chunk of html as the preloads, but the benefits can be seen much more clearly the later resources are discovered and th...
...preload"; preloadlink.as = "script"; document.head.appendchild(preloadlink); this means that the browser will preload the myscript.js file, but not actually use it yet. to use it, you could do this: var preloadedscript = document.createelement("script"); preloadedscript.src = "myscript.js"; document.body.appendchild(preloadedscript); this is useful when you want to preload a script, but then defer execution until exactly when you need it. other resource preloading mechanisms other preloading features exist, but none are quite as fit for purpose as <link rel="preload">: <link rel="prefetch"> has been supported in browsers for a long time, but it is intended for prefetching resources that will be used in the next navigation/page load (e.g. when you go to the next page). this is fine, bu...
Critical rendering path - Web Performance
e more specific rule is more expensive because it has to traverse more nodes in the dom tree - but that extra expense is generally minimal. measure first. optimize as needed. specificity is likely not your low hanging fruit. when it comes to css, selector performance optimization, improvements will only be in microseconds. there are other ways to optimize css, such as minification, and separating defered css into non-blocking requests by using media queries. render tree the render tree captures both the content and the styles: the dom and cssom trees are combined into the render tree. to construct the render tree, the browser checks every node, starting from root of the dom tree, and determine which css rules are attached. the render tree only captures visible content. the head section (gene...
...e biggest bang for your optimization buck. remember to measure first. then you can determine whether it should be an optimization priority. optimizing for crp improve page load speed by prioritizing which resources get loaded, controlling the order in which they are loaded, and reducing the file sizes of those resources. performance tips include 1) minimizing the number of critical resources by deferring their download, marking them as async, or eliminating them altogether, 2) optimizing the number of requests required along with the file size of each request, and 3) optimizing the order in which critical resources are loaded by prioritizing the downloading critical assets, shorten the critical path length. ...
Lazy loading - Web Performance
enables sending the minimal code required to provide value upfront, improving page-load times. the rest can be loaded on demand. entry point splitting: separates code by entry point(s) in the app dynamic splitting: separates code where dynamic import() statements are used javascript script type module any script tag with type="module" is treated like a javascript module and is deferred by default. css by default, css is treated as a render blocking resource, so the browser won't render any processed content until the cssom is constructed. css must be thin, delivered as quickly as possible, and the usage media types and queries are advised to unblock rendering. <link href="style.css" rel="stylesheet" media="all"> <link href="portrait.css" rel="stylesheet" media="ori...
...t link images and iframes very often, webpages contain many images that contribute to data-usage and how fast a page can load. most of those images are off-screen (non-critical), requiring user interaction (an example being scroll) in order to view them. loading attribute the loading attribute on an <img> element (or the loading attribute on an <iframe>) can be used to instruct the browser to defer loading of images/iframes that are off-screen until the user scrolls near them. <img src="image.jpg" loading="lazy" alt="..." /> <iframe src="video-player.html" loading="lazy"></iframe> the load event fires when the eagerly-loaded content has all been loaded; at that time, it's entirely possible (or even likely) that there may be lazily-loaded images that are within the visual viewport that hav...
Progressive loading - Progressive web apps (PWAs)
as soon as possible — the longer they wait for the page to load, the bigger the chance they will leave before waiting for everything to finish. we should be able to show them at least the basic view of the page they want to see, with placeholders in the places more content will eventually be loaded. this could be achieved by progressive loading — also known as lazy loading. this is all about deferring loading of as many resources as possible (html, css, javascript), and only loading those immediately that are really needed for the very first experience. bundling versus splitting many visitors won't go through every single page of a website, yet the usual approach is to bundle every feature we have into one big file. a bundle.js file can be many megabytes, and a single style.css bundle ca...
...crucial and then manage other resources when needed. render-blocking resources bundling is a problem, because the browser has to load the html, css, and javascript before it can paint their rendered results onto the screen. during the few seconds between initial website access and completion of loading, the user sees a blank page, which is a bad experience. to fix that we can, for example, add defer to javascript files: <script src="app.js" defer></script> they will be downloaded and executed after the document itself has been parsed, so it won't block rendering the html structure. we can also split css files and add media types to them: <link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="print.css" media="print"> this will tell the browser to load them only when the ...
Appendix D: Loading Scripts - Archive of obsolete content
s are loaded from a cache, only read and compile time are reduced. the scripts still need to execute all of their initialization code and allocate and initialize all of their data structures each time the script is loaded. loading: script loaded via script tags run in partially loaded documents. problems can ensue if the script immediately attempts to access dom nodes. this is easily resolved by deferring the work to a dynamically added onload hander. (a standalone xul window can use an onload attribute.) example the following overlay will load the script “overlay.js” from the same directory as the overlay file into the window which it overlays. the script will be read with the utf-8 encoding, based on the encoding of the overlay, and will execute as javascript version 1.8, based on the...
Performance best practices in extensions - Archive of obsolete content
ll at once. while javascript modules can be extremely useful, and provide significant performance benefits, they should be used wisely. loading modules incurs a small cost, so breaking code up to an unnecessary degree can be counter-productive. code should be modularized to the extent that doing so increases clarity, and loading of large or expensive chunks of code fragments can be significantly deferred. defer everything that you can most extensions have a load event listener in the main overlay that runs their startup functions. do as little as possible here. the browser window is blocked while your add-on's load handler runs, so the more it does, the slower firefox will appear to the user. if there is anything that can be done even a fraction of a second later, you can use an nsitimer or...
Session store API - Archive of obsolete content
lace the contents of the function myextensionhandlerestore() with whatever you need to do when the tab is restored. in this example, nsiconsoleservice is used to display a message to the console. this event is sent just before a tab is restored. an event of type sstabrestored fires each time a tab has finished restoring. it's worth noting that this event is sent even if tab loading at startup is deferred until the user selects the tab. firefox 3 note in firefox 3 and later, if you need to detect when a tab is about to be closed so that you can update data associated with the tab before it is closed, you can watch for the "sstabclosing" event, which is sent to the tab. restoring without restarting firefox 3.6 note this section applies to firefox 3.6 and later. firefox 3.6 knows how to...
CSS3 - Archive of obsolete content
lue to the definition of <color>, <image>, and <position>. definition for the calc(), attr(), and toggle() functional notations. at risk: due to insufficient browser support, standardization of the calc(), attr(), and toggle() functional notations may be postponed to the next iteration of this module. several types definition, like <ident> and <custom-ident>, have been deferred to css values and units module level 4. css flexible box layout module candidate recommendation add a flexbox layout to the css display property and several new css properties to control it: flex, flex-align, flex-direction, flex-flow, flex-item-align, flex-line-pack, flex-order, flex-pack, and flex-wrap. css cascading and inheritance level 3 candidate ...
JavaScript Client API - Archive of obsolete content
lection, id); } foorecord.prototype = { __proto__: cryptowrapper.prototype, _logname: "record.foo", ttl: foo_ttl, // optional get bar() this.cleartext.bar, set bar(value) { this.cleartext.bar = value; }, get baz() this.cleartext.baz, set baz(value) { this.cleartext.baz = value; } }; to save all that typing for declaring the getters and setters, you can also use utils.defergetset: function foorecord(collection, id) { cryptowrapper.call(this, collection, id); } foorecord.prototype = { __proto__: cryptowrapper.prototype, _logname: "record.foo", ttl: foo_ttl // optional }; utils.defergetset(foorec, "cleartext", ["bar", "baz"]); the store object the store object (which extends store, as defined in services/sync/modules/engines.js) has the job of creating an...
jspage - Archive of obsolete content
(o,r); }q.push(o);}o=o[l];}return(p)?new elements(q,{ddup:false,cash:!r}):null;};var e={html:"innerhtml","class":"classname","for":"htmlfor",defaultvalue:"defaultvalue",text:(browser.engine.trident||(browser.engine.webkit&&browser.engine.version<420))?"innertext":"textcontent"}; var b=["compact","nowrap","ismap","declare","noshade","checked","disabled","readonly","multiple","selected","noresize","defer"];var k=["value","type","defaultvalue","accesskey","cellpadding","cellspacing","colspan","frameborder","maxlength","readonly","rowspan","tabindex","usemap"]; b=b.associate(b);hash.extend(e,b);hash.extend(e,k.associate(k.map(string.tolowercase)));var a={before:function(m,l){if(l.parentnode){l.parentnode.insertbefore(m,l); }},after:function(m,l){if(!l.parentnode){return;}var n=l.nextsibling;(n)?l.p...
getLastError - Archive of obsolete content
getlasterror returns the most recent nonzero error code. method of install object syntax int getlasterror (); parameters none. returns the most recent nonzero error code. for a list of possible values, see return codes. description use getlasterror method to obtain the most recent nonzero error code since initinstall or reseterror were called. this method allows you to defer checking for error codes each time you call addfile or adddirectory until the last addfile or adddirectory call. the getlasterror method does not return errors from methods that return objects, such as getfolder. example the following example calls getlasterror after a series of addfile calls: addfile("npplug", ...); addfile("/ms/shared/ctl3d.dll", ...); addfile("/nethelp/royalplug/royalhelp.html",...); err = getl...
Parse - MDN Web Docs Glossary: Definitions of Web-related terms
the document is well-formed, parsing it is straightforward and faster. the parser parses tokenized input into the document, building up the document tree. when the html parser finds non-blocking resources, such as an image, the browser will request those resources and continue parsing. parsing can continue when a css file is encountered, but <script> tags—particularly those without an async or defer attribute—blocks rendering, and pauses parsing of html. when the browser encounters css styles, it parses the text into the css object model (or cssom), a data structure it then uses for styling layouts and painting. the browser then creates a render tree from both these structures to be able to paint the content to the screen. javascript is also downloaded, parsed, and then execute. javascri...
Perceived performance - MDN Web Docs Glossary: Definitions of Web-related terms
uest is made, through the downloading, parsing and execution of all resources, and the final paint. while increased performance generally increases perceived performance, there are some techniques that can be used to increase perceived performance while marginally decreasing actual performance. there are front end optimization techniques that can improve perceived performance, such as adding the defer or async attribute to scripts, or placing scripts at the end of documents, and placing css in the head of documents. learn more perceived performance ...
Tips for authoring fast-loading HTML pages - Learn web development
be based on the consideration of modern browsers that support the relevant standards. this can include recent versions of firefox, internet explorer, google chrome, opera, and safari. note, however, that many of the tips listed in this article are common-sense techniques which apply to any user agent, and can be applied to any web page, regardless of browser-support requirements. use async and defer, if possible make the javascript scripts such that they are compatible with both the async and the defer attributes, and use async whenever possible, especially if you have multiple script tags. with that, the page can stop rendering while javascript is still loading. otherwise, the browser will not render anything that is after the script tags that do not have these attributes. note: even t...
Index - Learn web development
this looks in web browsers and javascript. you should understand these concepts before working through the other articles in the module. 53 graceful asynchronous programming with promises beginner, codingscripting, guide, javascript, learn, promises, async, asynchronous, catch, finally, then promises are a comparatively new feature of the javascript language that allow you to defer further actions until after a previous action has completed, or respond to its failure. 54 introducing asynchronous javascript beginner, codingscripting, guide, introducing, javascript, learn, promises, async, asynchronous, await, callbacks in this article we briefly recap the problems associated with synchronous javascript, and take a first look at some of the different asyn...
Graceful asynchronous programming with Promises - Learn web development
this is useful for setting up a sequence of async operations to work correctly. this article shows you how promises work, how you'll see them in use with web apis, and how to write your own. prerequisites: basic computer literacy, a reasonable understanding of javascript fundamentals. objective: to understand promises and how to use them. ...
Asynchronous JavaScript - Learn web development
ok at the traditional methods javascript has available for running code asychronously after a set time period has elapsed, or at a regular interval (e.g. a set number of times per second), talk about what they are useful for, and look at their inherent issues. handling async operations gracefully with promises promises are a comparatively new feature of the javascript language that allow you to defer further actions until after the previous action has completed, or respond to its failure. this is really useful for setting up a sequence of operations to work correctly. this article shows you how promises work, where you'll see them in use in webapis, and how to write your own. making asynchronous programming easier with async and await promises can be somewhat complex to set up and understan...
Client-side storage - Learn web development
following to the bottom of your code: document.body.onload = namedisplaycheck; your example is finished — well done! all that remains now is to save your code and test your html page in a browser. you can see our finished version running live here. note: there is another, slightly more complex example to explore at using the web storage api. note: in the line <script src="index.js" defer></script> of the source for our finished version, the defer attribute specifies that the contents of the <script> element will not execute until the page has finished loading. storing complex data — indexeddb the indexeddb api (sometimes abbreviated idb) is a complete database system available in the browser in which you can store complex related data, the types of which aren't limited to si...
HTML performance features - Learn web development
nt-side web technologies. objective: to learn about the impact of html elements and attributes on web performance optimization. elements & attributes impacting performance the <picture> element the <video> element the <source> element the <img> srcset attribute responsive images preloading content with rel="preload" - (https://w3c.github.io/preload/ ) async / defer attributes <iframe> <object> <script> rel attribute conclusion previous overview: performance next in this module the "why" of web performance what is web performance? how do users perceive performance? measuring performance multimedia: images multimedia: video javascript performance best practices. html performance features css performance features fonts and performan...
Web performance resources - Learn web development
ext (fout.) the simplist way to address this is by inlining css that is required for any content that is rendered above the fold, or what you see in the browser viewport before scrolling. these styles will improve perceived performance as the css does not require a file request. <style type="text/css"> // insert your css here </style> javascript avoid javascript blocking by using the async or defer attributes, or link javascript assets after the page's dom elements. javascript only block rendering for elements that appear after the script tag in the dom tree. web fonts eot and ttf formats are not compressed by default. apply compression such as gzip or brotli for these file types. use woff and woff2. these formats have compression built in. within @font-face use font-display: swap. by us...
Multimedia: video - Learn web development
and compression. if not, a free utility called ffmpeg can do it for you. this is the ffmpeg command string to remove audio: ffmpeg -i original.mp4 -an -c:v copy audiofreeversion.mp4 video preload the preload attribute has three available options: auto|metadata|none. the default setting is metadata. these settings control how much of a video file downloads with page load. you can save data by deferring download for less popular videos. setting preload="none" results in none of the video being downloaded until playback. it delays startup, but offers significant data savings for videos with a low probability of playback. offering more modest bandwidth savings, setting preload="metadata" may download up to 3% of the video on page load. this is a useful option for some small or moderately siz...
Deployment and next steps - Learn web development
erences to the javascript and css files in our public/index.html file relative. to do this, we just remove the leading slashes (/) from the /global.css, /build/bundle.css, and /build/bundle.js urls, like this: <title>svelte to-do list</title> <link rel='icon' type='image/png' href='favicon.png'> <link rel='stylesheet' href='global.css'> <link rel='stylesheet' href='build/bundle.css'> <script defer src='build/bundle.js'></script> do this now. now we just have to commit and push our changes to gitlab. 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. delta compression using up to 8 threads. compressing objects: 100% (5...
Getting started with Svelte - Learn web development
as you can see, bundle.js is the only javascript file referenced by index.html. there are no other libraries loaded into the web page. this is a much smalle...
Gecko Logging
a minimal c++ logging framework is provided for use in core gecko code. it is enabled for all builds, thread-safe, and the preferred alternative to nspr logging. some other mostly-useless information on logging can be found on the nspr logging page. logging framework declaring a log module lazylogmodule defers the creation the backing logmodule in a thread-safe manner and is the preferred method to declare a log module. multiple lazylogmodules with the same name can be declared, all will share the same backing logmodule. this makes it much simpler to share a log module across multiple translation units. lazyloglodule provides a conversion operator to logmodule* and is suitable for passing into the logging macros detailed below. note: log module names can only contain specific cha...
mach
nformation command modules are not imported into a reliable python package/module "namespace." therefore, you can't rely on the module name. all imports must be absolute, not relative. because mach command modules are loaded at mach start-up, it is important that they be lean and not have a high import cost. this means that you should avoid global import statements as much as possible. instead, defer your import until inside the @command decorated method. mach ships with a toolbox of mix-in classes to facilitate common actions. see python/mach/mach/mixin. if you find yourself reinventing the wheel or doing something you feel that many mach commands will want to do, please consider authoring a new mix-in class so your effort can be shared! ...
Addon
rm version. isplatformcompatible read only boolean true or false depending on whether the add-on is compatible with the current operating system. name read only string the name of the add-on. pendingoperations read only integer a bitfield holding all of the current operations that are waiting to be performed for this add-on. operations are generally deferred when a restart is necessary to accomplish them. permissions read only integer a bitfield holding all the the operations that can be performed on this add-on. operations my be restricted based on system policies (e.g., the system administrator may not allow certain add-ons to be uninstalled), add-on type (e.g., themes may not be disabled), or add-on state (e.g., an incompatible ...
XPCOMUtils.jsm
ace); generator iterstringenumerator(enumerator); attributes attribute type description categorymanager nsicategorymanager returns a reference to nsicategorymanager. methods definelazygetter() getter functions in javascript give you a way to define a property of an object, but not calculate the property's value until it is accessed. a getter defers the cost of calculating the value until the value is needed, and if it is never needed, you never pay the cost. a "lazy getter" provides an additional optimization: the value is calculated the first time the getter is called, and is then cached (or memoized), so subsequent accesses return the cached value without recalculating it. this means that you shouldn't use a lazy getter for a property ...
JavaScript code modules
okmarkhtmlutils.jsm provides utility functions for importing and exporting bookmarks from the old-school "bookmarks.html" style bookmark files. ctypes.jsm provides an interface that allows javascript code to call native libraries without requiring the development of an xpcom component. customizableui.jsm allows you to interact with customizable buttons and items in firefox's main window ui. deferredtask.jsm run a task after a delay. dict.jsm provides an api for key/value pair dictionaries. downloadlastdir.jsm supplies the path to the directory into which the last download occurred. downloads.jsm provides a single entry point to interact with the downloading capabilities of the platform. fileutils.jsm provides helpers for dealing with files. geometry.jsm provides routines for pe...
nsIClipboard
and notifies the clipboard owner. it empties the "logical" clipboard. it does not clear the native clipboard. void emptyclipboard( in long awhichclipboard ); parameters awhichclipboard specifies the clipboard to which this operation applies. forcedatatoclipboard() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) some platforms support deferred notification for putting data on the clipboard this method forces the data onto the clipboard in its various formats this may be used if the application going away. void forcedatatoclipboard( in long awhichclipboard ); parameters awhichclipboard specifies the clipboard to which this operation applies. getdata() this method retrieves data from the clipboard into a transferable. voi...
nsIExternalProtocolService
or a specific protocol is "exposed" as a visible feature of the current application. an exposed protocol handler is one that can be used in all contexts. a non-exposed protocol handler is one that can only be used internally by the application. for example, a non-exposed protocol would not be loaded by the application in response to a link click or a x-remote openurl command. instead, it would be deferred to the system's external protocol handler. boolean isexposedprotocol( in string aprotocolscheme ); parameters aprotocolscheme the scheme from a url: http, ftp, mailto, and so on. return value true if the protocol is exposed, false otherwise. loaduri() used to load a uri via an external application. might prompt the user for permission to load the external application. void loaduri( in n...
nsIFileOutputStream
k/base/public/nsifilestreams.idlscriptable this interface is an output stream that lets you stream to a file. inherits from: nsioutputstream last changed in gecko 1.7 method overview void init(in nsifile file, in long ioflags, in long perm, in long behaviorflags); constants behavior flag constants constant value description defer_open 1<<0 see the same constant in nsifileinputstream. the deferred open will be performed when one of the following is called: seek() tell() write() flush() 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. n...
nsIMsgIncomingServer
te. please look at mozilla/mailnews/base/ispdata/aol.rdf for usage example. displaystartuppage boolean dobiff boolean downloadmessagesatstartup boolean read only. downloadonbiff boolean downloadsettings nsimsgdownloadsettings emptytrashonexit boolean filterscope nsmsgsearchscopevalue read only. hostname acstring hostname of the server. incomingduplicateaction long isdeferredto boolean read only. issecure boolean issecureserver boolean read only. key acstring internal pref key - guaranteed to be unique across all servers. limitofflinemessagesize boolean localpath nsilocalfile localstoretype acstring the schema for the local mail store, such as "mailbox", "imap", or "news" used to construct uris. read only. loginatstartup boolean logonfallba...
nsISessionStartup
ce, which was suffering due to the need to parse and stringify the data. constants session type constants constant value description no_session 0 there's no data available from the previous session. recover_session 1 the last session crashed. it will either be restored or about:sessionrestore will be displayed. resume_session 2 the previous session should be restored at startup. defer_session 3 the previous session is viable but shouldn't be restored without explicit action (with the exception of app tabs, which are always restored in this case). methods dorestore() determines whether or not there is a session to restore. boolean dorestore(); parameters none. return value true if the session should be restored, otherwise false. ...
nsIXPConnect
cacheptr acache, in nsiidptr aiid, in boolean aallowwrapper, out jsval aval, out nsixpconnectjsobjectholder aholder); attributes attribute type description collectgarbageonmainthreadonly prbool obsolete since gecko 1.9 currentjsstack nsistackframe read only. currentnativecallcontext nsaxpcnativecallcontextptr read only. ...
Storage
out them. note: the database engine does not support nested transactions, so attempting to start a transaction when one is already active will throw an exception. transactions can be started with mozistorageconnection.begintransaction() or mozistorageconnection.begintransactionas(). the latter takes one of three constants to describe the type of transaction: mozistorageconnection.transaction_deferred mozistorageconnection.transaction_immediate mozistorageconnection.transaction_exclusive mozistorageconnection.begintransaction() is equivalent to calling mozistorageconnection.begintransactionas() and passing mozistorageconnection.transaction_deferred. in general, this is the method you want to use. once you start a transaction, you can either commit the changes by calling mozistorageconn...
Address book sync client design
the static information that is held on the client for address book sync operations is stored in a file called absync.dat which is located in the root directory of the users profile information. // // the client keeps a sync mapping table which holds the following: // // serverrecordid - unique i...
Document.write() - Web APIs
Web › API › Document › write
: document.write() and document.writeln do not work in xhtml documents (you'll get an "operation is not supported" [ns_error_dom_not_supported_err] error in the error console). this happens when opening a local file with the .xhtml file extension or for any document served with an application/xhtml+xml mime type. more information is available in the w3c xhtml faq. note: using document.write() in deferred or asynchronous scripts will be ignored and you'll get a message like "a call to document.write() from an asynchronously-loaded external script was ignored" in the error console. note: in edge only, calling document.write() more than once in an <iframe> causes the error "script70: permission denied". note: starting with version 55, chrome will not execute <script> elements injected via docum...
HTMLImageElement.loading - Web APIs
ccurring, you should explicitly specify the size of the image's presentation using the image element's width and height attributes. by establishing the intrinsic aspect ratio in this manner, you prevent elements from shifting around while the document loads, which can be disconcerting or offputting at best and can cause users to click the wrong thing at worst, depending on the exact timing of the deferred loads and reflows. example the addimagetolist() function shown below adds a photo thumbnail to a list of items, using lazy-loading to avoid loading the image from the network until it's actually needed. function addimagetolist(url) { const list = document.queryselector("div.photo-list"); let newitem = document.createelement("div"); newitem.classname = "photo-item"; let newimg = do...
Using microtasks in JavaScript with queueMicrotask() - Web APIs
op driving a web worker. this lets the given function run without the risk of interfering with another script's execution, yet also ensures that the microtask runs before the user agent has the opportunity to react to actions taken by the microtask. javascript promises and the mutation observer api both use the microtask queue to run their callbacks, but there are other times when the ability to defer work until the current event loop pass is wrapping up. in order to allow microtasks to be used by third-party libraries, frameworks, and polyfills, the queuemicrotask() method is exposed on the window and worker interfaces through the windoworworkerglobalscope mixin. tasks vs microtasks to properly discuss microtasks, it's first useful to know what a javascript task is and how microtasks differ...
NotificationEvent.notification - Web APIs
returns a notification object. ...
WEBGL_draw_buffers - Web APIs
webgl extensions are available using the webglrenderingcontext.getextension() method. for more information, see also using extensions in the webgl tutorial. availability: this extension is only available to webgl1 contexts. in webgl2, the functionality of this extension is available on the webgl2 context by default. in webgl 2, the constants are available without the "webgl" suffix and the new glsl built-ins require glsl #version 300 es. ...
WebGL best practices - Web APIs
ronous. // check program link status; if ok, use and draw with it. } this technique may not work in all applications, for example those which require programs to be immediately available for rendering. still, consider how variations may work. don't check shader compile status until linking fails there are very few errors that are guaranteed to cause shader compilation failure, but cannot be deferred to link time. the essl3 spec says this under "error handling": the implementation should report errors as early a possible but in any case must satisfy the following: all lexical, grammatical and semantic errors must have been detected following a call to gllinkprogram errors due to mismatch between the vertex and fragment shader (link errors) must have been detected following a call to ...
Using Web Workers - Web APIs
.js', 'bar.js'); /* imports two scripts */ importscripts('//example.com/hello.js'); /* you can import scripts from other origins */ the browser loads each listed script and executes it. any global objects from each script may then be used by the worker. if the script can't be loaded, network_error is thrown, and subsequent code will not be executed. previously executed code (including code deferred using window.settimeout()) will still be functional though. function declarations after the importscripts() method are also kept, since these are always evaluated before the rest of the code. note: scripts may be downloaded in any order, but will be executed in the order in which you pass the filenames into importscripts() . this is done synchronously; importscripts() does not return until al...
Window.open() - Web APIs
Web › API › Window › open
oosing new window from the file menu. the url parameter specifies the url to be fetched and loaded in the new window. if url is an empty string, then a new blank, empty window (url about:blank) is created with the default toolbars of the main window. note that remote urls won't load immediately. when window.open() returns, the window always contains about:blank. the actual fetching of the url is deferred and starts after the current script block finishes executing. the window creation and the loading of the referenced resource are done asynchronously. examples var windowobjectreference; var windowfeatures = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes"; function openrequestedpopup() { windowobjectreference = window.open("http://www.cnn.com/", "cnn_windowname", windowf...
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
onsole.log('after settimeout'); will write to the console: after settimeout foo has been called this is because even though settimeout was called with a delay of zero, it's placed on a queue and scheduled to run at the next opportunity; not immediately. currently-executing code must complete before functions on the queue are executed, thus the resulting execution order may not be as expected. deferral of timeouts during pageload starting in firefox 66, firefox will defer firing settimeout and setinterval timers while the current tab is loading. firing is deferred until the mainthread is deemed idle (similar to window.requestidlecallback()), or until the load event is fired. maximum delay value browsers including internet explorer, chrome, safari, and firefox store the delay as a 32-bit...
attr() - CSS: Cascading Style Sheets
Web › CSS › attr
kground[data-background] { background-color: attr(data-background color, red); } specifications specification status comment css values and units module level 4the definition of 'attr()' in that specification. editor's draft changed it to work like var(). property values involving attr() are valid at parse time, and the validation of the attribute value is deferred to computed value time. css values and units module level 3the definition of 'attr()' in that specification. candidate recommendation added two optional parameters; can be used on all properties; may return values other than <string>. these changes are experimental and may be dropped during the cr phase if browser support is too small. css level 2 (re...
element() - CSS: Cascading Style Sheets
Web › CSS › element
:400px; height:100px; background:-moz-element(#mybackground2);"> </div> <div style="overflow:hidden; height:0;"> <button id="mybackground2" type="button">evil button!</button> </div> specifications specification status comment css images module level 4the definition of 'using elements as images: the element() notation' in that specification. working draft deferred from css3 images. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsun...
HTML attribute reference - HTML: Hypertext Markup Language
lobal attribute lets you attach custom attributes to an html element. datetime <del>, <ins>, <time> indicates the date and time associated with the element. decoding <img> indicates the preferred method to decode the image. default <track> indicates that the track should be enabled unless the user's preferences indicate something different. defer <script> indicates that the script should be executed after the page has been parsed. dir global attribute defines the text direction. allowed values are ltr (left-to-right) or rtl (right-to-left) dirname <input>, <textarea> disabled <button>, <command>, <fieldset>, <input>, <keygen>, <optgroup>, <option>, <select>, <textarea> indicates whether ...
<iframe>: The Inline Frame element - HTML: Hypertext Markup Language
Web › HTML › Element › iframe
cide the priority of the resource. high the resource should be downloaded before other lower-priority page resources. low the resource should be downloaded after other higher-priority page resources. loading indicates how the browser should load the iframe: eager: load the iframe immediately, regardless if it is outside the visible viewport (this is the default value). lazy: defer loading of the iframe until it reaches a calculated distance from the viewport, as defined by the browser. name a targetable name for the embedded browsing context. this can be used in the target attribute of the <a>, <form>, or <base> elements; the formtarget attribute of the <input> or <button> elements; or the windowname parameter in the window.open() method. referrerpolicy indicates w...
<img>: The Image Embed element - HTML: Hypertext Markup Language
Web › HTML › Element › img
his attribute is allowed only if the <img> element is a descendant of an <a> element with a valid href attribute. this gives users without pointing devices a fallback destination. loading indicates how the browser should load the image: eager: loads the image immediately, regardless of whether or not the image is currently within the visible viewport (this is the default value). lazy: defers loading the image until it reaches a calculated distance from the viewport, as defined by the browser. the intent is to avoid the network and storage bandwidth needed to handle the image until it's reasonably certain that it will be needed. this generally improves the performance of the content in most typical use cases. note: loading is only deferred when javascript is enabled. this is an ant...
JavaScript modules - JavaScript
try to load the html file locally (i.e. with a file:// url), you'll run into cors errors due to javascript module security requirements. you need to do your testing through a server. also, note that you might get different behavior from sections of script defined inside modules as opposed to in standard scripts. this is because modules use strict mode automatically. there is no need to use the defer attribute (see <script> attributes) when loading a module script; modules are deferred automatically. modules are only executed once, even if they have been referenced in multiple <script> tags. last but not least, let's make this clear — module features are imported into the scope of a single script — they aren't available in the global scope. therefore, you will only be able to access imp...
getter - JavaScript
is.a + 1; } }); console.log(o.b) // runs the getter, which yields a + 1 (which is 1) using a computed property name const expr = 'foo'; const obj = { get [expr]() { return 'bar'; } }; console.log(obj.foo); // "bar" smart / self-overwriting / lazy getters getters give you a way to define a property of an object, but they do not calculate the property's value until it is accessed. a getter defers the cost of calculating the value until the value is needed. if it is never needed, you never pay the cost. an additional optimization technique to lazify or delay the calculation of a property value and cache it for later access are smart (or "memoized") getters. the value is calculated the first time the getter is called, and is then cached so subsequent accesses return the cached value witho...
Promise - JavaScript
lfilled or rejected when a corresponding handler is attached, the handler will be called, so there is no race condition between an asynchronous operation completing and its handlers being attached. as the promise.prototype.then() and promise.prototype.catch() methods return promises, they can be chained. not to be confused with: several other languages have mechanisms for lazy evaluation and deferring a computation, which they also call "promises", e.g. scheme. promises in javascript represent processes that are already happening, which can be chained with callback functions. if you are looking to lazily evaluate an expression, consider the arrow function with no arguments: f = () => expression to create the lazily-evaluated expression, and f() to evaluate. note: a promise is said to be...
await - JavaScript
fulfillment. when resumed, the value of the await expression is that of the fulfilled promise. if the promise is rejected, the await expression throws the rejected value. if the value of the expression following the await operator is not a promise, it's converted to a resolved promise. an await can split execution flow, allowing the caller of the await's function to resume execution before the deferred continuation of the await's function. after the await defers the continuation of its function, if this is the first await executed by the function, immediate execution also continues by returning to the function's caller a pending promise for the completion of the await's function and resuming execution of that caller. examples awaiting a promise to be fulfilled if a promise is passed to an...
Performance fundamentals - Web Performance
rame. it seems obvious, but to reach a user-perceived startup event more quickly, the main "trick" is run only the code on the critical path. shorten the critical path by simplifying the scene. the web platform is highly dynamic. javascript is a dynamically-typed language, and the web platform allows loading code, html, css, images, and other resources dynamically. these features can be used to defer work that's off the critical path by loading unnecessary content "lazily" some time after startup. another problem that can delay startup is idle time, caused by waiting for responses to requests (like database loads). to avoid this problem, applications should issue requests as early as possible in startup (this is called "front-loading"). then when the data is needed later, hopefully it's alre...
Navigation and resource timings - Web Performance
ding a dns lookup, tcp handshake, and ssl negotiation, before the user agent makes the actual request and the servers return the requested assets. the browser then parses the content received, builds the dom, cssom, accessibility, and render trees, eventually rendering the page. once the user agent stops parsing the document, the user agent sets the document readiness to interactive. if there are deferred scripts needing to be parsed, it will do so, then fire the domcontentloaded, after which the readiness is set to complete. the document can now handle post-load tasks, after which point the document is marked as completely loaded. let navigationtimings = performance.getentriesbytype('navigation'); the performance.getentriesbytype('navigation')a returns an array of performanceentry objects fo...
Optimizing startup performance - Web Performance
l out the "pure calculation" chunks of your startup process into workers, you'll wind up having to run most or all of your startup code on the main thread. however, even code like that can be made asynchronous, with a little work. getting asynchronous here are some suggestions for how to build your startup process to be as asynchronous as possible (whether it's a new app or a port): use the defer or async attribute on script tags needed by the web application. this allows html parsers to continue processing the document, instead of having to wait until the scripts have been downloaded and executed before continuing. if you need to decode asset files (for example, decoding jpeg files and turning them into raw texture data for later use by webgl), that's great to do in workers. when deali...
Web Performance
t of javascript you use in your applications, it can be difficult to know where to start. in this guide, we'll show you how to analyze your application's script bundles, so you know what you're using, as well how to detect if your app contains duplicated scripts between bundles. lazy loading it isn't always necessary to load all of a web applications assets on initial page load. lazy loading is deferring the loading of assets on a page, such as scripts, images, etc., on a page to a later point in time i.e when those assets are actually needed. lazy-loading javascript with dynamic imports when developers hear the term "lazy loading", they immediately think of below-the-fold imagery that loads when it scrolls into the viewport. but did you know you can lazy load javascript as well? in this gu...
Progressive web app structure - Progressive web apps (PWAs)
gressive web apps."> <meta name="author" content="end3r"> <meta name="theme-color" content="#b12a34"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta property="og:image" content="icons/icon-512.png"> <link rel="shortcut icon" href="favicon.ico"> <link rel="stylesheet" href="style.css"> <link rel="manifest" href="js13kpwa.webmanifest"> <script src="data/games.js" defer></script> <script src="app.js" defer></script> </head> <body> <header> <p><a class="logo" href="http://js13kgames.com"><img src="img/js13kgames.png" alt="js13kgames"></a></p> </header> <main> <h1>js13kgames a-frame entries</h1> <p class="description">list of games submitted to the <a href="http://js13kgames.com/aframe">a-frame category</a> in the <a href="http://2017.js13kgames.com">js13kgame...
Structural overview of progressive web apps - Progressive web apps (PWAs)
gressive web apps."> <meta name="author" content="end3r"> <meta name="theme-color" content="#b12a34"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta property="og:image" content="icons/icon-512.png"> <link rel="shortcut icon" href="favicon.ico"> <link rel="stylesheet" href="style.css"> <link rel="manifest" href="js13kpwa.webmanifest"> <script src="data/games.js" defer></script> <script src="app.js" defer></script> </head> <body> <header> <p><a class="logo" href="http://js13kgames.com"><img src="img/js13kgames.png" alt="js13kgames"></a></p> </header> <main> <h1>js13kgames a-frame entries</h1> <p class="description">list of games submitted to the <a href="http://js13kgames.com/aframe"> a-frame category</a> in the <a href="http://2017.js13kgames.com">j...
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
atus unknown auto value of width and height computes to 0 but 100% on <svg> not implemented coordinate systems, transformations and units change notes exception for bad values on svgmatrix.skewx() and svgmatrix.skewy() implementation status unknown bounding box for element with no position at (0, 0) implementation status unknown defer keyword removed from preserveaspectratio attribute removed (bug 1280425) added non-scaling-size, non-rotation and fixed-position keywords for vector-effect property not implemented yet (bug 1318208) vector-effect has no effect within 3d rendering context implementation status unknown consider clip and overflow on svg document referenced by <image> implementa...