Search completed in 1.27 seconds.
In depth: Microtasks and the JavaScript runtime environment - Web APIs
javascript
execution contexts note: the details here are generally not important to most javascript programmers.
... when a fragment of javascript code runs, it runs inside an
execution context.
... there are three types of code that create a new
execution context: the global context is the
execution context created to run the main body of your code; that is, any code that exists outside of a javascript function.
...And 18 more matches
Web Replay
debugger integration allows the js debugger to read the information it needs from a replaying process and control the process's
execution (resume/rewind).
... intra-thread non-deterministic behaviors are non-deterministic even in the absence of actions by other threads, and inter-thread non-deterministic behaviors are those affected by interleaving
execution with other threads, and which always behave the same given the same interleaving.
... to prevent this from having an effect on iteration order (and
execution behavior) in the table, the main table classes (for now plhashtable and pldhashtable) are instrumented so that they always iterate over elements in the order they were added when recording or replaying.
...And 16 more matches
Index - Web APIs
user-supplied code is run in the audioworkletglobalscope global
execution context in a separate web audio rendering thread along with other nodes, allowing for zero-latency audio processing.
... 203 audioworkletglobalscope api, audioworkletglobalscope, experimental, interface, reference, web audio api the audioworkletglobalscope interface of the web audio api represents a global
execution context for user-supplied code, which defines custom audioworkletprocessor-derived classes.
... 308 bluetoothdevice api, bluetooth, bluetoothdevice, experimental, interface, reference, web bluetooth api the bluetoothdevice interface of the web bluetooth api represents a bluetooth device inside a particular script
execution environment.
...And 14 more matches
DeferredTask.jsm
void cancel(); arm request the
execution of the task after the delay specified on construction.
...if the task is running, the delay will start when the current
execution finishes.
...multiple "arm" calls within the same tick of the event loop are guaranteed to result in a single
execution of the task.
...And 12 more matches
Using Breakpoints in Venkman - Archive of obsolete content
breakpoints are places in code where
execution is suspended.
... when you set a breakpoint in a debugging application such as venkman, you can take advantage of the suspension to examine variables, objects, and other featues of the
execution.
...hard breakpoints are the ones that actually stop program
execution.
...And 9 more matches
Index
the most typical operations that are relevant for fast program
execution are property accesses and function calls.
...the most commonplace operations that are relevant for fast program
execution are property accesses and function calls.
...in terms of function
execution, the object is treated as this.
...And 9 more matches
Debugger.Frame - Firefox Developer Tools
given a debugger.frame instance, you can find the script the frame is executing, walk the stack to older frames, find the lexical environment in which the
execution is taking place, and so on.
... live true if the frame this debugger.frame instance refers to is still on the stack; false if it has completed
execution or been popped in some other way.
...if it is a function, spidermonkey calls it when
execution in this frame makes a small amount of progress, passing no arguments and providing this debugger.frame instance as the thisvalue.
...And 7 more matches
Bytecode Descriptions
later, when resuming
execution, rval, gen and resumekind will receive the values passed in by jsop::resume.
... yield operands: (uint24_t resumeindex) stack: rval1, gen ⇒ rval2, gen, resumekind suspend
execution of the current generator or async generator, returning rval1.
...when resuming
execution, rval2, gen and resumekind receive the values passed in by jsop::resume.
...And 6 more matches
Storage
this api is only available for asynchronous
execution.
...once all the parameters are set up, a single call to mozistoragestatement.bindparameters() will ensure that the parameters are bound before
execution.
... you can then execute the statement asynchronously, and the statement will get each set of bindings bound to it before
execution asynchronously.
...And 5 more matches
Migrating from Firebug - Firefox Developer Tools
stop script
execution on dom mutation in firebug you can break on dom mutations, that means that when an element is changed, the script
execution is stopped at the related line within the javascript file, which caused the change.
...to stop the script
execution there, you need to set a breakpoint on the line with the modification within the debugger panel.
... step through code once the script
execution is stopped, you can step through the code using the continue (f8), step over (f10), step into (f11) and step out (shift+f11) options.
...And 5 more matches
Using microtasks in JavaScript with queueMicrotask() - Web APIs
a microtask is a short function which is executed after the function or program which created it exits and only if the javascript
execution stack is empty, but before returning control to the event loop being used by the user agent to drive the script's
execution environment.
...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.
... simply pass the javascript function to call while the context is handling microtasks into the queuemicrotask() method, which is exposed on the global context as defined by either the window or worker interface, depending on the current
execution context.
...And 5 more matches
yield - JavaScript
rv optional retrieves the optional value passed to the generator's next() method to resume its
execution.
... description the yield keyword pauses generator function
execution and the value of the expression following the yield keyword is returned to the generator's caller.
... once paused on a yield expression, the generator's code
execution remains paused until the generator's next() method is called.
...And 5 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
80 closure codingscripting, glossary the binding which defines the scope of
execution.
... 86 conditional beginner, codingscripting, glossary a condition is a set of rules that can interrupt normal code
execution or change it, depending on whether the condition is completed or not.
... 136 exception beginner, codingscripting, glossary an exception is a condition that interrupts normal code
execution.
...And 4 more matches
Rhino Debugger
the rhino javascript debugger can debug scripts running in multiple threads and provides facilities to set and clear breakpoints, control
execution, view variables, and evaluate arbitrary javascript code in the current scope of an executing script.
... controlling
execution the debugger provides the following facilities for you to control the
execution of scripts you are debugging: step into to single step entering any function calls, you may do any of the following: select the debug->step into menu item on the menu bar press the step into button on the toolbar press the f11 key on the keyboard
execution will resume.
... step over to single step to the next line in the current function, you may do any of the following: select the debug->step over menu item on the menu bar press the step over button on the toolbar press the f7 key on the keyboard
execution will resume but control will return to the debugger at the next line in the current function or top-level script.
...And 4 more matches
Shell global objects
savebytecode if true, and if the source is a cacheentryobject, the bytecode would be encoded and saved into the cache entry after the script
execution.
...if an error occurred, throw the appropriate exception; otherwise, return the module object timeout([seconds], [func]) get/set the limit in seconds for the
execution time for the current context.
... a negative value (default) means that the
execution time is unlimited.
...And 4 more matches
mozIStorageStatement
reset() resets the bound parameters and statement
execution state.
... note: javascript callers should always wrap their
execution in a try block, and have a reset statement in a finally block.
... void bindparameters( in mozistoragebindingparamsarray aparameters ); parameters aparameters the mozistoragebindingparamsarray object containing one or more mozistoragebindingparams objects with the parameters to be bound to the statement prior to
execution.
...And 4 more matches
Break on DOM mutation - Firefox Developer Tools
there are three choices: subtree modification
execution pauses if any of the elementʼs descendant nodes are modified.
... that means, the script
execution is stopped whenever a child node or descendant node deeper in the dom structure is added to or removed from the element the option is set on.
... attribute modification
execution pauses when any of the elementsʼ attributes are modified.
...And 4 more matches
Debugger - Firefox Developer Tools
most handler functions can return a resumption value indicating how the debuggee’s
execution should proceed.
... this handler method should return a resumption value specifying how the debuggee’s
execution should proceed.
... this handler method should return a resumption value specifying how the debuggee’s
execution should proceed.
...And 4 more matches
Sqlite.jsm
statement
execution these apis facilitate
execution of statements on the connection.
... the return value is a promise that is resolved when the statement has finished
execution.
... when a statement is executed via execute(), the underlying statement object is thrown away as soon as the statement finishes
execution.
...And 3 more matches
Introduction to NSPR
ollowed by intercap-style declarations, like this: print, prfiledesc function definitions begin with pr_ and are followed by intercap-style declarations, like this: pr_read, pr_jointhread preprocessor macros begin with the letters pr and are followed by all uppercase characters separated with the underscore character (_), like this: pr_bytes_per_short, pr_extern nspr threads nspr provides an
execution environment that promotes the use of lightweight threads.
... each thread is an
execution entity that is scheduled independently from other threads in the same process.
...a thread is created by an explicit client request and remains a valid, independent
execution entity until it returns from its root function or the process abnormally terminates.
...And 3 more matches
Set a breakpoint - Firefox Developer Tools
breakpoints in brief breakpoints are very useful when debugging javascript — you basically set a point in your code where you would like
execution of the code to pause.
... add log: add a log point, which logs a value to your console rather than pausing
execution as a breakpoint does.
... continue to here: when stepping through code, this option tells the debugging to continue
execution through to this point.
...And 3 more matches
Index - Firefox Developer Tools
17 debugger-api debugger, intermediate, intro, javascript, tools mozilla’s javascript engine, spidermonkey, provides a debugging interface named debugger which lets javascript code observe and manipulate the
execution of other javascript code.
...given a debugger.frame instance, you can find the script the frame is executing, walk the stack to older frames, find the lexical environment in which the
execution is taking place, and so on.
... 130 set watch expressions when debugging code, sometimes it's useful to watch expressions as
executions are paused.
...And 3 more matches
Loops and iteration - JavaScript
at the end of every
execution, the condition is checked.
... when the condition is false,
execution stops, and control passes to the statement following do...while.
...if the condition returns false,
execution stops, and control is passed to the statement following while.
...And 3 more matches
this - JavaScript
it can't be set by assignment during
execution, and it may be different each time the function is called.
... syntax this value a property of an
execution context (global, function or eval) that, in non–strict mode, is always a reference to an object and in strict mode can be any value.
... description global context in the global
execution context (outside of any function), this refers to the global object whether in strict mode or not.
...And 3 more matches
Index - Archive of obsolete content
114 test/harness test harness setup and
execution.
... 179 delayed
execution code snippets no summary!
... 230 displaying web content in an extension without security issues extensions, security, xmlhttprequest, xul one of the most common security issues with extensions is
execution of remote code in privileged context.
...And 2 more matches
How Mozilla's build system works
the
execution environment is strictly controlled, so moz.build files can only perform a limited set of operations.
... reference many of python's built-in or global functions (they are not made available to the
execution environment).
...these are how the
execution of a moz.build file tells the build system what to do.
...And 2 more matches
Tracing JIT
the recorder records the activity of the interpreter, using nanojit to build an efficient, native representation of the
execution called a fragment.
... it then imports the set of jsval values from the spidermonkey interpreter that the trace is known to read or write during its
execution.
... this set was determined during recording, and the imported values are stored locally within the native stack during
execution.
...And 2 more matches
Index
these are only valid inside the jsdi
executionhook which gave it to you.
... 212 mozistorageprogresshandler interfaces, storage, xpcom, xpcom api reference the mozistorageprogresshandler interface lets storage consumers receive callbacks during the
execution of sqlite requests.
...a non-blocking input stream, on the other hand, must not block the calling thread of
execution.
...And 2 more matches
mozIStorageConnection
constants transaction
execution time constants.
... in javascript, managing transactions can be difficult when you are using the same connection on different threads, or are using a combination of asynchronous and synchronous statement
execution.
...an asynchronous statement can only be used to dispatch asynchronous requests to the asynchronous
execution thread and cannot be used to take any synchronous actions on the database.
...And 2 more matches
nsIZipWriter
operations on the archive can be performed one by one, or queued for later
execution.
... aqueue if true, the operation is queued for later
execution.
... aqueue if true, the operation is queued for later
execution.
...And 2 more matches
Set a logpoint - Firefox Developer Tools
sometimes you want to view a value in your code but you don't want to pause
execution.
...logpoints print a message to the console panel instead of pausing code
execution.
... the logpoint is especially useful in cases where breaking the
execution breaks testing procedures, such as when you are debugging popup windows, or executing focus-related logic.
...And 2 more matches
Venkman Introduction - Archive of obsolete content
the interactive console also allows for
execution of arbitrary javascript code.
...these commands should be self explanatory, with the possible exception of stop, which causes the debugger to stop when the next line of javascript is executed, and the profile button, which can be used to measure
execution times for your scripts.
... stop button waiting for
execution also note that when you are currently executing javascript and click the stop button, the javascript stops immediately.
... when script
execution is interrupted by the debugger, the line of the file where the interruption occurred is automatically displayed in the source code view.
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
note: the specified amount of time (or the delay) is not the guaranteed time to
execution, but rather the minimum time to
execution.
... recursive settimeout() guarantees the same delay between the
executions.
... when your code has the potential to take longer to run than the time interval you’ve assigned, it’s better to use recursive settimeout() — this will keep the time interval constant between
executions regardless of how long the code takes to execute, and you won't get errors.
... immediate timeouts using 0 as the value for settimeout() schedules the
execution of the specified callback function as soon as possible but only after the main code thread has been run.
Logging
conditional compilation and
execution log types and variables logging functions and macros use example conditional compilation and
execution nspr's logging facility is conditionally compiled in and enabled for applications using it.
...
execution-time control of nspr's logging uses two environment variables.
...by default, no logging is enabled at
execution time.
... log types and variables two types supporting nspr logging are exposed in the api: prlogmoduleinfo prlogmodulelevel two environment variables control the behavior of logging at
execution time: nspr_log_modules nspr_log_file logging functions and macros the functions and macros for logging are: pr_newlogmodule pr_setlogfile pr_setlogbuffering pr_logprint pr_logflush pr_log_test pr_log pr_assert pr_assert pr_static_assert (new in nspr 4.6.6xxx this hasn't been released yet; the number is a logical guess) pr_not_reached use example the following sample code fragment demonstrates use of the logging and debugging aids.
JSAPI User Guide
however, in some cases we do not want scripts to be able to catch an error; we want script
execution to terminate right away.
... an object you create using a script only can be made available only during the lifetime of the script, or can be created to persist after the script completes
execution.
... ordinarily, once script
execution is complete, its objects are destroyed.
...to stop
execution of scripts that run too long, use js_setoperationcallback.
Set event listener breakpoints - Firefox Developer Tools
now when a keydown, keyup, keypress, or input event occurs,
execution will pause as soon as it enters the listener code.
... when
execution pauses, the source pane displays the highlighted line of the javascript code that is next to be executed, along with the surrounding code for context.
... in addition, you get a box overlaid on the viewport saying "paused on event breakpoint", with buttons to step over that line of code or resume
execution.
...use event breakpoints to stop
execution at the triggering event for the action that fails, then step through the code or watch the console to see what happens.
UI Tour - Firefox Developer Tools
in the screenshot below there are three breakpoints: line 82 has a normal breakpoint and
execution is paused here line 85 has a logpoint which logs the contents of tablerow to the console line 100 has a conditional breakpoint the third column shows more information about the breakpoints.
... toolbar at the top of the right-hand pane, there's a toolbar: the toolbar consists of: four buttons to control the debugger's movement through the script: play/pause (f8): pauses or resumes
execution of the script you're debugging.
...they will be evaluated when code
execution is paused: variable tooltip hover on a variable show a tooltip with its value inside: call stack when the debugger's paused, you'll see a call stack: each level of the call stack gets a line, with the name of the function and the filename and line number.
... right-clicking in the call stack pane opens a context menu with the following items: restart frame restarts
execution at the beginning of the current frame.
Debugger.Object - Firefox Developer Tools
promiseallocationsite if the referent is a promise, this is the javascript
execution stack captured at the time of the promise’s allocation.
... promiseresolutionsite if the referent is a promise, this is the javascript
execution stack captured at the time of the promise’s resolution.
... allocationsite if object allocation site tracking was enabled when this debugger.object’s referent was allocated, return the javascript
execution stack captured at the time of the allocation.
...(in the terms used by the ecmascript specification, the variableenvironment of the
execution context forcode is the referent, and thebindings appear in a new declarative environment, which is the eval code’s lexicalenvironment.) theoptions argument is as for debugger.frame.prototype.eval.
Debugger.Object - Firefox Developer Tools
(in the terms used by the ecmascript specification, the variableenvironment of the
execution context for the eval code is the referent.) theoptions argument is as for debugger.frame.prototype.eval.
...(in the terms used by the ecmascript specification, the variableenvironment of the
execution context for non-strict eval code is the referent, and thebindings appear in a new declarative environment, which is the eval code's lexicalenvironment.) theoptions argument is as for debugger.frame.prototype.eval.
... if the method returns undefined, then spidermonkey makes the announced change to the object, and continues
execution normally.
... if the object has a resume property, its value is taken as a resumption value, indicating how
execution should proceed.
Window - Web APIs
window.clearimmediate() cancels the repeated
execution set using setimmediate.
... windoworworkerglobalscope.clearinterval() cancels the repeated
execution set using windoworworkerglobalscope.setinterval().
... windoworworkerglobalscope.cleartimeout() cancels the delayed
execution set using windoworworkerglobalscope.settimeout().
...for example, if a script has an
execution error or an image can't be found or is invalid.
WindowOrWorkerGlobalScope.setInterval() - Web APIs
delayoptional the time, in milliseconds (thousandths of a second), the timer should delay in between
executions of the specified function or code.
... explanation code executed by setinterval() runs in a separate
execution context than the function from which it was called.
... ensure that
execution duration is shorter than interval frequency if there is a possibility that your logic could take longer to execute than the interval time, it is recommended that you recursively call a named function using settimeout().
...while this pattern does not guarantee
execution on a fixed interval, it does guarantee that the previous interval has completed before recursing.
Control flow and error handling - JavaScript
if no default clause is found, the program resumes
execution at the statement following the end of switch.
... (by convention, the default clause is written as the last clause, but it does not need to be so.) break statements the optional break statement associated with each case clause ensures that the program breaks out of switch once the matched statement is executed, and then continues
execution at the statement following switch.
... if break is omitted, the program continues
execution inside the switch statement (and will evaluate the next case, and so on).
...when break is encountered, the program exits the switch and continues
execution from the statement following switch.
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.lo...
...
execution gets here almost instantly const slow = await resolveafter2seconds() console.log(slow) // 2.
...
execution gets here almost instantly console.log(await slow) // 2.
...logs "slow", then after 1 more second, "fast" // wait above to finish settimeout(concurrentstart, 4000) // after 2 seconds, logs "slow" and then "fast" // wait again settimeout(concurrentpromise, 7000) // same as concurrentstart // wait again settimeout(parallel, 10000) // truly parallel: after 1 second, logs "fast", then after 1 more second, "slow" await and parallelism in sequentialstart,
execution suspends 2 seconds for the first await, and then another second for the second await.
frame/utils - Archive of obsolete content
execution of scripts may easily be enabled: let { open } = require('sdk/window/utils'); let { create } = require('sdk/frame/utils'); let window = open('data:text/html,top'); let frame = create(window.document, { uri: 'data:text/html,<script>console.log("running");</script>', allowjavascript: true }); } globals functions create(document, options) creates a xul browser element in a privileged docum...
... allowjavascript boolean whether to allow javascript
execution.
... allowplugins boolean whether to allow plugin
execution.
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.
... ms : number number of milliseconds to delay the
execution of fn.
... arguments : mixed additional arguments to pass to fn upon
execution once(fn) creates a version of the input function that can only be called one time.
Appendix D: Loading Scripts - Archive of obsolete content
// use the current content window as the
execution context.
...all variables named in the target script's exported_symbols global array will be copied into the current
execution context.
... safety: as workers have no access to objects which might cause a crash or deadlock when executed re-entrantly or by spinning the event loop, there are significant safety advantages over other methods of asynchronous
execution.
Setting Up a Development Environment - Archive of obsolete content
the venkman javascript debugger is a great way to trace
execution of your javascript code.
...you can set breakpoints, step in and out of methods, and even get profiling information from javascript
execution.
... you can inspect variables, keep track of watch expressions, and evaluate arbitrary js at any point in
execution.
Metro browser chrome tests - Archive of obsolete content
gtests make use of promises and tasks for managing
execution.
...setup(), teardown(), and run() each have individual exception handlers to prevent one method from interfering with the
execution of another.
...for more information on test
execution see the main test exectuon loop in head.js.
Settings - Archive of obsolete content
pause on exceptions when this option is enabled,
execution of the script will automatically pause whenever a javascript exception is thrown.
... ignore caught exceptions if this option is set (it is set by default) and "pause on exceptions" is set, then
execution will pause on an exception only if that exception is not caught.
...you don't generally want to pause
execution when an exception that is thrown is caught, since that generally indicates that your program is handling it properly.
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
runat=”client” – code contained in this block is restricted to
execution client-side, which is also what happens if no runat attribute is specified.
... runat=”server” – code contained in this block is restricted to
execution server-side.
...if you intend to allow the
execution of server-side javascript from the client-side, you can correct the code in listing 1 by doing one of three things.
Choosing the right approach - Learn web development
imeout() calls to run a function repeatedly in a similar fashion to setinterval(), using code like this: let i = 1; settimeout(function run() { console.log(i); i++; settimeout(run, 100); }, 100); there is a difference between recursive settimeout() and setinterval(): recursive settimeout() guarantees at least the specified amount of time (100ms in this example) will elapse between the
executions; the code will run and then wait 100 milliseconds before it runs again.
... when your code has the potential to take longer to run than the time interval you’ve assigned, it’s better to use recursive settimeout() — this will keep the time interval constant between
executions regardless of how long the code takes to execute, and you won't get errors.
... further information cooperative asynchronous javascript: timeouts and intervals, in particular settimeout() settimeout() reference setinterval() setinterval() is a method that allows you to run a function repeatedly with a set interval of time between each
execution.
Handling common JavaScript problems - Learn web development
the main feature of such tools is the ability to add breakpoints to code — these are points where the
execution of the code stops, and at that point you can examine the environment in its current state and see what is going on.
...now refresh the page (cmd/ctrl + r) — the browser will pause
execution of the code at line 51.
...each scope can be expanded to show the values of variables inside the scope when
execution of the code was stopped.
HTML parser threading
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.
...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.
...this might cause more script
execution tree ops to be generated and executed and document.write() to be called more times.
Threads
nspr provides an
execution environment that promotes the use of lightweight threads.
... each thread is an
execution entity that is scheduled independently from other threads in the same process.
...a thread is created by an explicit client request and remains a valid, independent
execution entity until it returns from its root function or the process abnormally terminates.
Rhino scopes and contexts
contexts the rhino context object is used to store thread-specific information about the
execution environment.
... 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.
...
execution of scripts requires a scope for top-level script variable storage as well as a place to find standard objects like function and object.
Hacking Tips
viewing the mirgraph of ion/odin compilations (from gdb) with gdb instrumentation, we can call iongraph program within gdb when the
execution is stopped.
... this instrumentation adds an iongraph command when provided with an instance of a mirgenerator*, will call iongraph, graphviz and your prefered png viewer to display the mir graph at the precise time of the
execution.
...// but if a different bit changes (either set or cleared), you may still stop //
execution if the $mask bit happened to already be set.
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.
...if one of the actions is a move, or a stop filter
execution action, we move on to the next header; otherwise, we move on to the next filter.
... in the case of pop3, filter
execution is synchronous.
The Firefox JavaScript Debugger - Firefox Developer Tools
open the debugger pretty-print a minified file search use a source map pause
execution you probably want to pause the
execution of your code, in order to see what is going on at various points.
... there are multiple ways to tell the debugger how and when to pause: set a breakpoint set a conditional breakpoint set an xhr breakpoint set event listener breakpoints break on exceptions use watchpoints for property reads and writes break on dom mutation disable breakpoints control
execution what can you do after
execution pauses?
... step through code black box a source debug worker threads debug eval sources look at values you probably want to see the value of variables or expressions, either during
execution or when it is paused.
Background Tasks API - Web APIs
because event handling and screen updates are two of the most obvious ways users notice performance issues, it's important for your code to be a good citizen of the web and help to prevent stalls in the
execution of the event loop.
... variable declarations let tasklist = []; let totaltaskcount = 0; let currenttasknumber = 0; let taskhandle = null; these variables are used to manage the list of tasks that are waiting to be performed, as well as status information about the task queue and its
execution: tasklist is an array of objects, each representing one task waiting to be run.
... enqueueing tasks first, we need a function that enqueues tasks for future
execution.
BluetoothRemoteGATTServer - Web APIs
boolean connected; promise<bluetoothremotegattserver> connect(); void disconnect(); promise<bluetoothremotegattservice> getprimaryservice(bluetoothserviceuuid service); promise<sequence<bluetoothremotegattservice>> getprimaryservices(optional bluetoothserviceuuid service); }; properties bluetoothremotegattserver.connectedread only a boolean value that returns true while this script
execution environment is connected to this.device.
... methods bluetoothremotegattserver.connect() causes the script
execution environment to connect to this.device.
... bluetoothremotegattserver.disconnect() causes the script
execution environment to disconnect from this.device.
DedicatedWorkerGlobalScope - Web APIs
windowtimers.clearinterval() cancels the repeated
execution set using windowtimers.setinterval().
... windowtimers.cleartimeout() cancels the repeated
execution set using windowtimers.settimeout().
... windowtimers.setinterval() schedules the
execution of a function every x milliseconds.
HTMLScriptElement - Web APIs
html <script> elements expose the htmlscriptelement interface, which provides special properties and methods for manipulating the behavior and
execution of <script> elements (beyond the inherited htmlelement interface).
... there are three possible
execution modes: if the async attribute is present, then the script will be executed asynchronously as soon as it downloads.
... htmlscriptelement.nomodule is a boolean that if true, stops the script's
execution in browsers that support es2015 modules — used to run fallback scripts in older browsers that do not support javascript modules.
SharedWorkerGlobalScope - Web APIs
windowtimers.clearinterval() cancels the repeated
execution set using windowtimers.setinterval().
... windowtimers.cleartimeout() cancels the repeated
execution set using windowtimers.settimeout().
... windowtimers.setinterval() schedules the
execution of a function every x milliseconds.
WindowOrWorkerGlobalScope - Web APIs
windoworworkerglobalscope.clearinterval() cancels the repeated
execution set using windoworworkerglobalscope.setinterval().
... windoworworkerglobalscope.cleartimeout() cancels the delayed
execution set using windoworworkerglobalscope.settimeout().
... windoworworkerglobalscope.queuemicrotask() enqueues a microtask—a short function to be executed after
execution of the javascript code completes and control isn't being returned to a javascript caller, but before handling callbacks and other tasks.
Grammar and types - JavaScript
(spaces, tabs, and newline characters are considered whitespace.) comments the syntax of comments is the same as in c++ and in many other languages: // a one line comment /* this is a longer, * multi-line comment */ /* you can't, however, /* nest comments */ syntaxerror */ comments behave like whitespace, and are discarded during script
execution.
...this syntax can be used to declare both local and global variables, depending on the
execution context.
...it also means that data types are automatically converted as-needed during script
execution.
await - JavaScript
description the await expression causes async function
execution to pause until a promise is settled (that is, fulfilled or rejected), and to resume
execution of the async function after fulfillment.
... 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.
return - JavaScript
the return statement ends function
execution and specifies a value to be returned to the function caller.
... description when a return statement is used in a function body, the
execution of the function is stopped.
... the following return statements all break the function
execution: return; return true; return false; return x; return x + y / 3; automatic semicolon insertion the return statement is affected by automatic semicolon insertion (asi).
switch - JavaScript
if no default clause is found, the program continues
execution at the statement following the end of switch.
... the optional break statement associated with each case label ensures that the program breaks out of switch once the matched statement is executed and continues
execution at the statement following switch.
... if break is omitted, the program continues
execution at the next statement in the switch statement.
Recommended Web Performance Timings: How long is too long? - Web Performance
this means that user interaction, painting, and script
execution are all on the same thread.
... if the thread is busy doing complex javascript
execution, the main thread will not be available to react to user input, such as pressing a button.
... for this reason, script
execution should be limited in scope, divided into chunks of code that can be executed in 50ms or less.
<xsl:message> - XSLT: Extensible Stylesheet Language Transformations
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:message> element outputs a message (to the javascript console in ns) and optionally terminates
execution of the stylesheet.
... optional attributes terminate set to "yes", indicates that
execution should be terminated.
... the default value is "no", in which case the message is output and
execution continues.
/loader - Archive of obsolete content
for example the sdk uses this feature during test
execution to create an identical environment with a different state to test how specific modules handle unloads.
...}) require() as already mentioned in loading modules it's common to start
execution by loading a main module.
JavaScript Debugger Service - Archive of obsolete content
k does not _always_ trigger when jsd.errorhook[onerror] returns false // it is not well-known why debughook sometimes fails to trigger jsd.debughook = { onexecute: function(frame, type, rv) { stacktrace = ""; for (var f = frame; f; f = f.callingframe) { stacktrace += f.script.filename + "@" + f.line + "@" + f.functionname + "\n"; } dump(stacktrace); return components.interfaces.jsdi
executionhook.return_continue; } }; filters jsd also allows the use of filters to track which scripts should trigger the hooks.
... note that the jsdifilter only applies to jsdi
executionhooks, which are breakpointhook, debughook, debuggerhook, interrupthook and throwhook.
Local Storage - Archive of obsolete content
any extension that is more complex than a hello world needs some way to log errors and trace
execution without having to fire up a debugger.
...during development you should use the "all" level, but for release versions it's usually better to move the level up to "warn", so that the log is compact and
execution is more efficient.
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
javascript
execution differences different browsers execute javascript differently.
...one concrete example is window.open, which opens a new window: <script> function doopenwindow(){ var mywindow = window.open("about:blank"); mywindow.location.href = "http://www.ibm.com"; } </script> the problem with the code is that window.open is asynchronous -- it does not block the javascript
execution until the window has finished loading.
Using XPInstall to Install Plugins - Archive of obsolete content
an example of calling the execute method from the install object on an executable that has a temporary life span (and is not needed after one
execution) is: // initialize the installation ....
...// by passing 'true' we are telling the install script to block // on the
execution of the installable, and do it synchronously // must call performinstall to make it all happen...
Learn XPI Installer Scripting by Example - Archive of obsolete content
space()) { err = add_dirs_and_files; register_files; if (err==success) { performinstall() }; else { cancelinstall() }; } as you can see in the code listing, the verification process at the top is on lines 1 to 18; the file addition process, here part of the main installation block, is on lines 24 to 41; the registration part of the main installation block is on lines 42-58; and the
execution at the end of the main block is on lines 59 to 71.
...recall that an install process takes the following general form: initinstall(); if (verify_space()) { err = add_dirs_and_files; register_files; if (err==success) { performinstall() }; else { cancelinstall() }; } in this arrangement, the actual
execution of the installation is checked against the errors returned from the addition of files to the installation, which may itself have been conditioned on some verification of version and necessary disk space.
NPN_PluginThreadAsyncCall - Archive of obsolete content
description causes asynchronous
execution of the specified function pointer on the "plug-in thread", passing in the specified user data pointer when it is called.
...plug-ins should perform appropriate synchronization with the code in their npp_destroy() routine to ensure correct
execution and avoid memory leaks.
Scratchpad - Archive of obsolete content
there are four
execution options available.
...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.
What are browser developer tools? - Learn web development
find out more find more out about the inspector in different browsers: firefox page inspector ie dom explorer chrome dom inspector (opera's inspector works the same as this) safari dom inspector and style explorer the javascript debugger the javascript debugger allows you to watch the value of variables and set breakpoints, places in your code that you want to pause
execution and identify the problems that prevent your code from executing properly.
... source code set breakpoints where you want to pause
execution.
Introducing asynchronous JavaScript - Learn web development
the nature of asynchronous code let's explore an example that further illustrates the nature of async code, showing what can happen when we are not fully aware of code
execution order and the problems of trying to treat asynchronous code like synchronous code.
... 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.
What is JavaScript? - Learn web development
when you load a web page in your browser, you are running your code (the html, css, and javascript) inside an
execution environment (the browser tab).
... browser security each browser tab has its own separate bucket for running code in (these buckets are called "
execution environments" in technical terms) — this means that in most cases the code in each tab is run completely separately, and the code in one tab cannot directly affect the code in another tab — or on another website.
Website security - Learn web development
the process of modifying user data so that it can't be used to run scripts or otherwise affect the
execution of server code is known as input sanitization.
...in this attack, a user is able to specify an "unintended" file for display or
execution in data passed to the server.
Error codes returned by Mozilla APIs
ns_error_file_
execution_failed (0x80520003) an attempt to launch or execute a file failed because the file is not executable.
... ns_error_xslt_parse_failure (0x80600001) ns_error_xslt_already_set (0x80600003) ns_error_xslt_
execution_failure (0x80600004) ns_error_xslt_bad_recursion (0x80600006) ns_error_xslt_bad_value (0x80600007) ns_error_xslt_nodeset_expected (0x80600008) ns_error_xslt_aborted (0x80600009) ns_error_xslt_network_error (0x8060000a) ns_error_xslt_wrong_mime_type (0x8060000b) ns_error_xslt_load_recursion (0x8060000c) ns_error_xslt_load_blocked_error (0x8060001b) ns_error_xslt...
Performance
abmm.addmessagelistener("my-addon:paragraph-count", callback); tabmm.loadframescript("data:,sendasyncmessage('my-addon:paragraph-count', {num: content.document.queryselectorall('p').length})", false) } function decoratebutton(button, count) { // do stuff with result } this executes the script only when it is needed and only in one tab and allows it to be garbage-collected immediately after
execution.
...not handling those properly can lead to duplicate or conflicting code
execution, especially when messages are sent.
NSPR's Position On Abrupt Thread Termination
in the situation where it was defined (unix), which has only a single thread of
execution, that is equivalent to terminating the process.
...the problem with abrupt termination is that it can happen at any time, to a thread that is coded correctly to handle both normal and exceptional situations, but will be unable to do so since it will be denied the opportunity to complete
execution.
NSPR LOG MODULES
special log module names are provided for controlling nspr's log service at
execution time.
... these controls should be set in the nspr_log_modules environment variable at
execution time to affect nspr's log service for your application.
PR_CWait
the thread waiting on the monitor resumes
execution when the monitor is notified (assuming the thread is the next in line to receive the notify) or when the interval specified in the timeout parameter has been exceeded.
... when the thread resumes
execution, it is the caller's responsibility to test the state of the monitored data to determine the appropriate action.
JIT Optimization Strategies
the most commonplace operations that are relevant for fast program
execution are property accesses and function calls.
...inlining a call site conceptually copies the body of the callee function and pastes it in place of the call site and avoids pushing a new
execution frame.
JS::Compile
this article covers features introduced in spidermonkey 17 compile a script for
execution.
... description js::compile compiles a script, srcbuf, chars, bytes, or file, for
execution.
JS::CompileOffThread
this article covers features introduced in spidermonkey 31 compile a script off thread for
execution.
... description js::compileoffthread compiles a script, chars for
execution.
JS_CallFunction
in terms of function
execution, the object is treated as this.
... rval is a pointer to a variable that will hold the function's return value, if any, on successful function
execution.
JS_CompileScript
compiles a script for
execution.
... description js_compilescript compiles a script, source, for
execution.
JS_CompileScriptForPrincipals
compile a security-enabled script for
execution.
... description js_compilescriptforprincipals compiles a security-enabled script, src, for
execution.
JS_SetBranchCallback
specifies a callback function that is automatically called when a script branches backward during
execution, when a function returns, and at the end of the script.
... description js_setbranchcallback specifies a callback function that is automatically called when a script branches backward during
execution, when a function returns, and at the end of the script.
JS_SetFunctionCallback
this lets you trace the
execution of code, and is particularly useful for javascript tracers and profilers since it works across all run modes (interpreter, method jit, trace jit).
...the callback must not modify the current state of
execution.
Redis Tips
*/ if(err) throw err; /** * if results === null, it means that a concurrent client * changed the key while we were processing it and thus * the
execution of the multi command was not performed.
... * * notice: failing an
execution of multi is not considered * an error.
jsdIStackFrame
these are only valid inside the jsdi
executionhook which gave it to you.
...
executioncontext jsdicontext executon context.
mozIStorageAsyncStatement
this differs from mozistoragestatement by only being usable for asynchronous
execution.
... (mozistoragestatement can be used for both synchronous and asynchronous purposes.) this specialization for asynchronous operation allows us to avoid needing to acquire synchronization primitives also used by the asynchronous
execution thread.
nsIDocShell
allowjavascript boolean whether to allow javascript
execution.
... allowplugins boolean whether to allow plugin
execution.
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.
... 102 detect opening folder thunderbird some actions require
execution every time you open a folder (for example, registering a custom column handler.
Set an XHR breakpoint - Firefox Developer Tools
an xhr (xmlhttprequest) breakpoint breaks code
execution when an xhr request is dispatched so that you can examine the current state of the program.
... note: if you enter a key word instead of a url, code
execution will pause on any call to a url that contains that keyword.
Debugger.Script - Firefox Developer Tools
when
execution reaches the given instruction, spidermonkey calls the hit method ofhandler, passing a debugger.frame instance representing the currently executing stack frame.
... the hit method’s return value should be a resumption value, determining how
execution should continue.
Debugger-API - Firefox Developer Tools
the debugger interface mozilla’s javascript engine, spidermonkey, provides a debugging interface named debugger which lets javascript code observe and manipulate the
execution of other javascript code.
...a debugger observes only
execution taking place in the scope of these global objects.
Intensive JavaScript - Firefox Developer Tools
then there are three solid blocks of orange, representing javascript
execution, one for each time we pressed the button.
...by switching to the flame chart view we can find out: this shows us the js call stack at this point in the
execution.
AudioWorkletGlobalScope - Web APIs
the audioworkletglobalscope interface of the web audio api represents a global
execution context for user-supplied code, which defines custom audioworkletprocessor-derived classes.
... as the global
execution context is shared across the current baseaudiocontext, it's possible to define any other variables and perform any actions allowed in worklets — apart from defining audioworkletprocessor-derived classes.
FeaturePolicy - Web APIs
the featurepolicy interface of the feature policy api represents the set of policies applied to the current
execution context.
...feature whose name appears on the list might not be allowed by the feature policy of the current
execution context and/or might not be accessible because of user's permissions.
WebGL best practices - Web APIs
flush when expecting results (like queries or rendering frame completion) flush tells the implementation to push all pending commands out for
execution, flushing them out of the queue, instead of waiting for more commands to enqueue before sending for
execution.
... use webgl.flush() when not using requestanimationframe when not using raf, (such as when using rpaf; see below) use webgl.flush() to encourage eager
execution of enqueued commands.
WindowOrWorkerGlobalScope.queueMicrotask() - Web APIs
the microtask is a short function which will run after the current task has completed its work and when there is no other code waiting to be run before control of the
execution context is returned to the browser's event loop.
... this lets your code run without interfering with any other, potentially higher priority, code that is pending, but before the browser regains control over the
execution context, potentially depending on work you need to complete.
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
explanation code executed by settimeout() is called from an
execution context separate from the function from which settimeout was called.
...currently-executing code must complete before functions on the queue are executed, thus the resulting
execution order may not be as expected.
WorkerGlobalScope - Web APIs
windoworworkerglobalscope.clearinterval() cancels the repeated
execution set using windoworworkerglobalscope.setinterval().
... windoworworkerglobalscope.cleartimeout() cancels the delayed
execution set using windoworworkerglobalscope.settimeout().
Synchronous and asynchronous requests - Web APIs
synchronous requests block the
execution of code which causes "freezing" on the screen and an unresponsive user experience.
... example: synchronous http request from a worker one of the few cases in which a synchronous request does not usually block
execution is the use of xmlhttprequest within a worker.
animation-fill-mode - CSS: Cascading Style Sheets
the animation-fill-mode css property sets how a css animation applies styles to its target before and after its
execution.
... forwards the target will retain the computed values set by the last keyframe encountered during
execution.
Getting Started - Developer guides
if true (the default), javascript
execution will continue and the user can interact with the page while the server response has yet to arrive.
....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 alertcontents(); alertcontents() checks if the response was received and ok, then alert()s the contents of the test.html file.
Clear-Site-Data - HTTP
"
executioncontexts" indicates that the server wishes to reload all browsing contexts for the origin of the response (location.reload).
...you can achieve that by adding the clear-site-data header when sending the page confirming that logging out from the site has been accomplished successfully (https://example.com/logout, for example): clear-site-data: "cache", "cookies", "storage", "
executioncontexts" clearing cookies if this header is delivered with the response at https://example.com/clear-cookies, all cookies on the same domain https://example.com and any subdomains (like https://stage.example.com, etc), will be cleared out.
CSP: script-src - HTTP
this includes not only urls loaded directly into <script> elements, but also things like inline script event handlers (onclick) and xslt stylesheets which can trigger script
execution.
... <script>var inline = 1;</script> unsafe eval expressions the 'unsafe-eval' source expression controls several script
execution methods that create code from strings.
Feature-Policy - HTTP
execution-while-not-rendered controls whether tasks should execute in frames while they're not being rendered (e.g.
...
execution-while-out-of-viewport controls whether tasks should execute in frames while they're outside of the visible viewport.
Index - HTTP
it applies restrictions to a page's actions including preventing popups, preventing the
execution of plugins and scripts, and enforcing a same-origin policy.
...this includes not only urls loaded directly into <script> elements, but also things like inline script event handlers (onclick) and xslt stylesheets which can trigger script
execution.
HTTP Index - HTTP
it applies restrictions to a page's actions including preventing popups, preventing the
execution of plugins and scripts, and enforcing a same-origin policy.
...this includes not only urls loaded directly into <script> elements, but also things like inline script event handlers (onclick) and xslt stylesheets which can trigger script
execution.
Functions - JavaScript
also, since the inner function has access to the scope of the outer function, the variables and functions defined in the outer function will live longer than the duration of the outer function
execution, if the inner function manages to survive beyond the life of the outer function.
... an arrow function does not have its own this; the this value of the enclosing
execution context is used.
Introduction - JavaScript
java is a class-based programming language designed for fast
execution and type safety.
... prevent code snippets executed in the console from interacting with one-another (e.g., having something created in one console
execution being used for a different console
execution).
Regular expressions - JavaScript
when you want to know whether a pattern is found in a string, use the test() or search() methods; for more information (but slower
execution) use the exec() or match() methods.
... results of regular expression
execution.
continue - JavaScript
the continue statement terminates
execution of the statements in the current iteration of the current or labeled loop, and continues
execution of the loop with the next iteration.
... description in contrast to the break statement, continue does not terminate the
execution of the loop entirely: instead, in a while loop, it jumps back to the condition.
page-mod - Archive of obsolete content
if multiple documents that match the page-mod's include pattern are loaded, then each document is loaded into its own
execution context with its own copy of the content scripts.
test/httpd - Archive of obsolete content
usage the most basic usage is: var { startserverasync } = require("sdk/test/httpd"); var srv = startserverasync(port, basepath); require("sdk/system/unload").when(function cleanup() { srv.stop(function() { // you should continue
execution from this point.
JavaScript timers - Archive of obsolete content
but there are some javascript native functions (timers) which allow us to delay the
execution of arbitrary instructions: settimeout() setinterval() setimmediate() requestanimationframe() the settimeout() function is commonly used if you wish to have your function called once after the specified delay.
Code snippets - Archive of obsolete content
d to display and process dialog boxes alerts and notifications modal and non-modal ways to notify users preferences code used to read, write, and modify preferences js xpcom code used to define and call xpcom components in javascript running applications code used to run other applications <canvas> related what wg canvas-related code signing a xpi how to sign an xpi with pki delayed
execution performing background operations.
Index of archived content - Archive of obsolete content
using third-party modules (jpm) bootstrapped extensions code snippets alerts and notifications autocomplete bookmarks boxes canvas code snippets cookies customizing the download progress bar delayed
execution dialogs and prompts downloading files drag & drop embedding svg examples and demos from articles file i/o finding window handles forms related code snippets html in xul for rich tooltips html to dom isdefaultnamespace js xpcom javascript debug...
Dehydra Function Reference - Archive of obsolete content
include example include("map.js") // includes map.js into toplevel var map = {} include("map.js", map) // includes map.js into the map object require({version:, strict:, werror:, gczeal:}) require is used to set runtime
execution flags.
Return Codes - Archive of obsolete content
execution_error -203 an error occurred executing the script no_install_script -204 installation script was not signed no_certificate -205 extracted file is not signed or the file (and, therefore, its certificate) could not be found.
Using nsIXULAppInfo - Archive of obsolete content
rm 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.
Multi-process plugin architecture - Archive of obsolete content
when plugins run in the same process as the browser, any leaks or crashes in the plugin will affect the entire browser: in order to make the browser user experience better, it is possible to separate plugin
execution from the process in which the browser normally executes.
Processing XML with E4X - Archive of obsolete content
variables and expressions can be used to create attribute values by simply wrapping them with braces ({}) and omitting quotation marks that would normally go around an attribute value, as the following example illustrates: var a = 2; var b = <foo bar={a}>"hi"</foo>; upon
execution the variable is evaluated and quotes are automatically added where appropriate.
Server-Side JavaScript - Archive of obsolete content
some, like aptana with the open source jaxer server actually embed the entire mozilla firefox browser engine (including spidermonkey) within a web server to enable server-side ajax and server-side dom access in addition to server-side
execution of javascript.
Implementation Status - Archive of obsolete content
10.13 reset supported 10.14 load partial no xforms-link-error generated if @src invalid 333782; 10.15 send supported 10.16 message partial output inside message doesn't work correctly 366886; 10.17 conditional
execution of xforms actions supported 10.18 iteration of xforms actions supported 11.
Buttons - Game development
n: startbutton = game.add.button(game.world.width*0.5, game.world.height*0.5, 'button', startgame, this, 1, 0, 2); startbutton.anchor.set(0.5); the button() method's parameters are as follows: the button's x and y coordinates the name of the graphic asset to be displayed for the button a callback function that will be executed when the button is pressed a reference to this to specify the
execution context the frames that will be used for the over, out and down events.
MDN Web Docs Glossary: Definitions of Web-related terms
x xforms xhr (xmlhttprequest) xhtml xinclude xlink xml xpath xquery xslt other 404 502 alpn at-rule attack byte-order mark character set client cryptosystem debug digital signature
execution flex-direction glsl interface library memory management routers self-executing anonymous function stylesheet vector image ...
Client-side form validation - Learn web development
function addevent(element, event, callback) { let previouseventcallback = element["on"+event]; element["on"+event] = function (e) { const output = callback(e); // a callback that returns `false` stops the callback chain // and interrupts the
execution of the event callback.
Sending forms through JavaScript - Learn web development
file.dom.addeventlistener( "change", function () { if( reader.readystate === filereader.loading ) { reader.abort(); } reader.readasbinarystring( file.dom.files[0] ); } ); // senddata is our main function function senddata() { // if there is a selected file, wait it is read // if there is not, delay the
execution of the function if( !file.binary && file.dom.files.length > 0 ) { settimeout( senddata, 10 ); return; } // to construct our multipart form data request, // we need an xmlhttprequest instance const xhr = new xmlhttprequest(); // we need a separator to define each part of the request const boundary = "blob"; // store our body request in a string.
Makefiles - Best practices and suggestions
# 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.
mach
an instance of the @commandprovider class is instantiated by the mach driver if a command in it is called for
execution.
Developer guide
taskcluster taskcluster is the task
execution framework that supports mozilla's continuous integration and release processes.
Experimental features in Firefox
nightly 72 no developer edition 72 no beta 72 no release 72 no preference name devtools.inspector.color-scheme-simulation.enabled
execution context selector this feature displays a button on the console's command line that lets you change the context in which the expression you enter will be executed.
Performance best practices for Firefox front-end engineers
if you can avoid querying for the size or position of things in javascript, that’s the safest option—especially because it’s always possible that something earlier in this tick of javascript
execution caused a style change in the dom without you knowing it.
Examples
when the callback finishes
execution, newpromise will be fulfilled with an undefined fulfillment value, because the callback does not return any value.
Promise
for example, if an exception occurs in one callback, it does not affect the
execution of subsequent callbacks.
PromiseWorker.jsm
by convention, the last argument may be an object options with some of the following fields: out
executionduration {number|null} a parameter to be filled with the duration of the off main thread
execution for this call.
XPCOMUtils.jsm
this will reference aobject during
execution of the function.
JS::PerfMeasurement
perfmeasurement* js::extractperfmeasurement(jsval wrapper) if you are the c++ side of an xpcom interface, and you want to benchmark only part of your
execution time but make the results available to javascript, you can declare a bare jsval argument in your .idl file and have javascript pass a perfmeasurement object that it created in that argument slot.
Profiling with the Firefox Profiler
note that long-running js function
execution may not actually be taking as long as you think because further down the call stack there may be something like painting happening.
AsyncTestUtils extended framework
thanks to javascript enhancements available on the mozilla platform, it is possible for a function to yield control in such a way that the function stops running at the line where you use a yield statement and resumes
execution on the next line when resumed.
PR_ASSERT
terminates
execution when a given expression is false.
PR_Assert
writes arguments to the log and terminates
execution.
PR_GetThreadPrivate
description pr_getthreadprivate may be called at any time during a thread's
execution.
PR_LOG_TEST
use it as an expression in a conditional
execution statement to control logging.
PR_QueueJob
queues a job to a thread pool for
execution.
PR_Wait
if the value of timeout is not pr_interval_no_timeout, pr_wait resumes
execution after the specified interval has expired.
NSPR API Reference
mbols from the main executable program process management and interprocess communication process management types and constants prprocess prprocessattr process management functions setting the attributes of a new process creating and managing processes multiwait receive system information and environment variables logging conditional compilation and
execution log types and variables prlogmoduleinfo prlogmodulelevel nspr_log_modules nspr_log_file logging functions and macros pr_newlogmodule pr_setlogfile pr_setlogbuffering pr_logprint pr_logflush pr_log_test pr_log pr_assert pr_assert pr_not_reached use example instrumentation counters named shared memory shared memory protocol named s...
NSS Memory allocation
at the end of
execution of a program, all the arenas in the free list will appear to have been leaked.
NSS 3.19.2.1 release notes
an attacker that successfully exploited these issues can overflow the heap and may be able to obtain remote code
execution.
NSS 3.19.2.3 release notes
an attacker could create a specially-crafted certificate which, when parsed by nss, would cause a crash or
execution of arbitrary code with the permissions of the user.
NSS 3.19.4 release notes
an attacker that successfully exploited these issues can overflow the heap and may be able to obtain remote code
execution.
NSS 3.20.1 release notes
an attacker that successfully exploited these issues can overflow the heap and may be able to obtain remote code
execution.
NSS 3.21.1 release notes
an attacker could create a specially-crafted certificate which, when parsed by nss, would cause a crash or
execution of arbitrary code with the permissions of the user.
NSS 3.22.2 release notes
an attacker could create a specially-crafted certificate which, when parsed by nss, would cause a crash or
execution of arbitrary code with the permissions of the user.
NSS 3.23 release notes
an attacker could create a specially-crafted certificate which, when parsed by nss, would cause a crash or
execution of arbitrary code with the permissions of the user.
Rhino Examples
multithreaded script
execution dynamicscopes.java is a program that creates a single global scope object and then shares it across multiple threads.
Bytecodes
bytecode listing all opcodes are annotated with a [-popcount, +pushcount] to represent the overall stack-effects their
execution.
Garbage collection
if so, the engine must immediately restart a full, non-incremental gc in order to reclaim some memory and continue
execution.
Property cache
when executing certain property-accessing bytecode instructions, the interpreter populates the cache to speed future
execution of the same instruction.
SpiderMonkey Internals
js api users should call js_gc or js_maybegc between script
executions or from the operation callback, as often as necessary.
JIT Optimization Outcomes
the most typical operations that are relevant for fast program
execution are property accesses and function calls.
JS::Call
in terms of function
execution, the object is treated as this.
JSErrorReport
description jserrorreport describes a single error that occurs in the
execution of script.
JSRuntime
it contains the global object and the
execution stack.
JS_CompileUTF8File
description js_compileutf8file compiles the text of script in an external file location for
execution by the js engine.
JS_CompileUTF8FileHandle
description js_compileutf8filehandle reads a script from a stdio file handle and compiles the script for
execution by the javascript engine.
JS_ExecuteRegExp
a pointer to the lastindex for the
execution, and received the updated lastindex.
JS_ExecuteScript
in ecmascript terms, the script is executed in a new
execution context, but that context is not initialized quite as described in any of the three cases in ecma 262-3 §10.2.
JS_ExecuteScriptVersion
in ecmascript terms, the script is executed in a new
execution context, but that context is not initialized quite as described in any of the three cases in ecma 262-3 §10.2.
JS_GetScopeChain
the ecmascript standard, ecma 262-3 §10, describes
execution contexts and scope chains.
JS_GetSecurityCallbacks
it allows the embedding to control certain aspects of js code
execution based on security settings of the global object the code is executed in.
JS_SetInterruptCallback
some common uses for an interrupt callback are: to run garbage collection periodically, by calling js_maybegc; to periodically take a break from script
execution to update the ui (though note that mozilla does not do this, by design); to enforce application limits on the amount of time a script may run.
JS_SetOperationCallback
some common uses for an operation callback are: to run garbage collection periodically, by calling js_maybegc; to periodically take a break from script
execution to update the ui (though note that mozilla does not do this, by design); to enforce application limits on the amount of time a script may run.
JS_SetOptions
the caller may not modify objects on the scope chain between compilation and
execution.
SpiderMonkey 1.8.5
bug 630209 also removed the need for js_newscriptobject, by modifying the script compilation interfaces to handle the creation and management of the object wrapper directly; similarly, the script
execution interfaces now accept a jsobject pointer than a pointer to jsscript.
SpiderMonkey 1.8.7
bug 630209 also removed the need for js_newscriptobject, by modifying the script compilation interfaces to handle the creation and management of the object wrapper directly; similarly, the script
execution interfaces now accept a jsobject pointer than a pointer to jsscript.
SavedFrame
it represents a javascript call stack at a past moment of
execution.
WebReplayRoadmap
comparing
executions (not yet implemented) comparing the behavior of a recording that exhibits a bug with a second recording that doesn't exhibit the bug should help with quickly locating the source of the problem.
Secure Development Guidelines
.st_uid != getuid) { bailout(“you don’t own the file”); } fd = open(file, o_rdwr); write(fd, argv[2], strlen(argv[2])); } file i/o: race conditions previous example contains a race condition the file may change between the call top stat() and open() this opens the possibility of writing arbitrary content to any file race conditions occur when two separate
execution flows share a resource and its access is not synchronized properly race condition types include file (previously covered) thread (two threads share a resource but don’t lock it) signal race conditions example char *ptr; void sighandler() { if (ptr) free(ptr); _exit(0); } int main() { signal(sigint, sighandler); ptr = malloc(1000); ...
Components.utils.Sandbox
passing a content window object, setting wantxrays:true (default) and using an extended principal provides a clean, isolated
execution environment in which javascript code that needs web apis (such as accessing the window's dom) can be executed without interference from untrusted content code.
Components.utils.reportError
examples usage in an exception handler: try { this.could.raise.an.exception; } catch(e) { components.utils.reporterror(e); // report the error and continue
execution } sending debugging messages to the error console: components.utils.reporterror("init() called"); ...
mozIStorageFunction
mozistorageprogresshandler monitor progress during the
execution of a statement.
mozIStorageProgressHandler
the mozistorageprogresshandler interface lets storage consumers receive callbacks during the
execution of sqlite requests.
mozIStorageStatementCallback
void handleresult( in mozistorageresultset aresultset ); parameters aresultset an mozistorageresultset object describing the available results from the statement's
execution.
nsIDOMWindowUtils
this slows down javascript
execution, but accumulates information about what code has executed that may be queried after a call to stoppccountprofiling().
nsIEventListenerInfo
this is the method you should use if you want to get access to the actual listener, but the debugger service must be already active, which significantly slows down script
execution.
nsIInputStream
a non-blocking input stream, on the other hand, must not block the calling thread of
execution.
nsIOutputStream
a non-blocking output stream, on the other hand, must not block the calling thread of
execution.
nsIRunnable
nsirunnable is generated from nsirunnable.idl here is the prototype of nsirunnable.idl /** * represents a task which can be dispatched to a thread for
execution.
nsISupports proxies
xpinstall installation scripts are sometimes very complex and can require long
execution time due to unzipping or native file system actions.
nsIThread
during the
execution of this method call, events for the current thread may continue to be processed.
nsMsgRuleActionType
g custom=-1; /* see nsmsgfilteraction */ const long none=0; /* uninitialized state */ const long movetofolder=1; const long changepriority=2; const long delete=3; const long markread=4; const long killthread=5; const long watchthread=6; const long markflagged=7; const long label=8; const long reply=9; const long forward=10; const long stop
execution=11; const long deletefrompop3server=12; const long leaveonpop3server=13; const long junkscore=14; const long fetchbodyfrompop3server=15; const long copytofolder=16; const long addtag=17; const long killsubthread=18; const long markunread=19; }; ...
Testing Mozilla code
it uses a compile-time instrumentation to check all reads and writes during the
execution.
Detect Opening Folder
some actions require
execution every time you open a folder (for example, registering a custom column handler.
Using the Mozilla symbol server
the debugger will not be able to show you the content of all variables and the
execution path can seem strange because of inlining, tail calls, and other compiler optimizations.
Debug worker threads - Firefox Developer Tools
you can set a breakpoint (or logpoint) on any active worker thread: when
execution is paused in a worker thread, the context of the debugger is updated to show the correct breakpoints, call stack, etc., just as you'd expect.
Step through code - Firefox Developer Tools
step in: advance to the next line in the function, unless on a function call, in which case enter the function being called step out: run to the end of the current function, in which case, the debugger will skip the return value from a function, returning
execution to the caller split console when paused, you can press the esc key to open and close the split console to gain more insight into errors and variables: pause on breakpoints overlay since firefox 70, when your code is paused on a breakpoint an overlay appears on the viewport of the tab you are debugging.
Debugger keyboard shortcuts - Firefox Developer Tools
close current file ctrl + w cmd + w ctrl + w search for a string in the current file ctrl + f cmd + f ctrl + f search for a string in all files ctrl + shift + f cmd + shift + f ctrl + shift + f find next in the current file ctrl + g cmd + g ctrl + g search for scripts by name ctrl + p cmd + p ctrl + p resume
execution when at a breakpoint f8 f8 1 f8 step over f10 f10 1 f10 step into f11 f11 1 f11 step out shift + f11 shift + f11 1 shift + f11 toggle breakpoint on the currently selected line ctrl + b cmd + b ctrl + b toggle conditional breakpoint on the currently selected line ctrl + shift + b cmd + shift + b ctrl...
Debugger.Memory - Firefox Developer Tools
accessor properties of the debugger.memory.prototype object ifdbg is a debugger instance, then <i>dbg</i>.memory is a debugger.memory instance, which inherits the following accessor properties from its prototype: trackingallocationsites a boolean value indicating whether this debugger.memory instance is capturing the javascript
execution stack when each object is allocated.
All keyboard shortcuts - Firefox Developer Tools
close current file ctrl + w cmd + w ctrl + w search for a string in the current file ctrl + f cmd + f ctrl + f search for a string in all files ctrl + shift + f cmd + shift + f ctrl + shift + f find next in the current file ctrl + g cmd + g ctrl + g search for scripts by name ctrl + p cmd + p ctrl + p resume
execution when at a breakpoint f8 f8 1 f8 step over f10 f10 1 f10 step into f11 f11 1 f11 step out shift + f11 shift + f11 1 shift + f11 toggle breakpoint on the currently selected line ctrl + b cmd + b ctrl + b toggle conditional breakpoint on the currently selected line ctrl + shift + b cmd + shift + b ctrl...
UI Tour - Firefox Developer Tools
the x-axis represents time, and the recorded operations are laid out as a waterfall, reflecting the serial nature of the browser's
execution.
Waterfall - Firefox Developer Tools
recorded operations, called markers, are shown as horizontal bars, laid out in a waterfall to reflect the serial nature of the browser's
execution.
AudioContext - Web APIs
an audio context controls both the creation of the nodes it contains and the
execution of the audio processing, or decoding.
AudioWorklet - Web APIs
the worklet's code is run in the audioworkletglobalscope global
execution context, using a separate web audio thread which is shared by the worklet and other audio nodes.
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.
BluetoothDevice - Web APIs
the bluetoothdevice interface of the web bluetooth api represents a bluetooth device inside a particular script
execution environment.
Element - Web APIs
for example, if a script has an
execution error or an image can't be found or is invalid.
Event.currentTarget - Web APIs
instead, you can either directly console.log(event.currenttarget) to be able to view it in the console or use the debugger statement, which will pause the
execution of your code thus showing you the value of event.currenttarget.
EventTarget.addEventListener() - Web APIs
eobject = {aproperty: 'data'}; mybutton.addeventlistener('click', function() { console.log(someobject.aproperty); // expected value: 'data' someobject.aproperty = 'data again'; // change the value }); window.setinterval(function() { if (someobject.aproperty === 'data again') { console.log('data again: true'); someobject.aproperty = 'data'; // reset value to wait for next event
execution } }, 5000); in this example, even though the scope in which both the event listener and the interval function are defined would have finished executing before the original value of someobject.aproperty would have changed, because someobject persists in memory (by reference) in both the event listener and interval function, both have access to the same data (i.e.
FeaturePolicy.features() - Web APIs
feature whose name appears on the list might not be allowed by the feature policy of the current
execution context and/or might not be accessible because of user's permissions.
Using the Gamepad API - Web APIs
in each
execution of the loop we check if one of four buttons is being pressed; if so, we update the values of the a and b movement variables appropriately, then update the left and top properties, changing their values to the current values of a and b respectively.
InstallTrigger - Web APIs
in either case, you must trigger the installation process by creating a web page script in which installtrigger methods download the specified xpi file and "trigger" the
execution of the install.js script at the top level of that xpi.
Long Tasks API - Web APIs
} }); // register observer for long task notifications observer.observe({entrytypes: ["longtask"]}); // long script
execution after this will result in queueing // and receiving "longtask" entries in the observer.
Node - Web APIs
if callback is provided, and it returns boolean false when called, the current recursion level is aborted, and the function resumes
execution at the last parent's level.
SVGElement - Web APIs
error fired when an svg element does not load properly or when an error occurs during script
execution.
ServiceWorkerGlobalScope.skipWaiting() - Web APIs
example while self.skipwaiting() can be called at any point during the service worker's
execution, it will only have an effect if there's a newly installed service worker that might otherwise remain in the waiting state.
Using Service Workers - Web APIs
if successful, the service worker is executed in a serviceworkerglobalscope; this is basically a special kind of worker context, running off the main script
execution thread, with no dom access.
Transferable - Web APIs
the transferable interface represents an object that can be transfered between different
execution contexts, like the main thread and web workers.
Fundamentals of WebXR - Web APIs
higher-powered solutions typically offload application
execution and graphics processing to an external device such as a desktop computer, and are either tethered to the computer using a cable or use a wireless network to receive the imagery to display to the user.
Inputs and input sources - Web APIs
tener("inputsourceschange", event => { inputsourcelist = event.session.inputsources; inputsourcelist.foreach(source => { switch(source) { case "left": lefthandsource = source; break; case "right": righthandsource = source; break; } }); }); the inputsourceschange event is also fired once when the session's creation callback first completes
execution, so you can use it to fetch the input source list as soon as it's available at startup time.
Rendering and the WebXR frame animation callback - Web APIs
because the
execution of your callback is not going to happen at precise 1/60th of a second intervals—and, indeed, could happen at other rates if the user's display has a different framer ate—you can't rely on the simple fact that your code is running to assume that it's been 1/60th of a second since the last frame.
Web Audio API - Web APIs
an audio context controls the creation of the nodes it contains and the
execution of the audio processing, or decoding.
Web Locks API - Web APIs
}); while a lock is held, requests for the same lock from this
execution context, or from other tabs/workers, will be queued.
Using Web Workers - Web APIs
content security policy workers are considered to have their own
execution context, distinct from the document that created them.
Web Workers API - Web APIs
web workers makes it possible to run a script operation in a background thread separate from the main
execution thread of a web application.
Window: error event - Web APIs
the error event is fired on a window object when a resource failed to load or couldn't be used — for example if a script has an
execution error.
Cross-Origin Resource Policy (CORP) - HTTP
these vulnerabilities allowed sensitive data disclosure due to a race condition which arose as part of speculative
execution functionality, designed to improve performance.
CSP: sandbox - HTTP
it applies restrictions to a page's actions including preventing popups, preventing the
execution of plugins and scripts, and enforcing a same-origin policy.
Array.prototype.reduceRight() - JavaScript
* * h(x) = f(g(x)) * * function
execution happens right to left * * https://en.wikipedia.org/wiki/function_composition */ const compose = (...args) => (value) => args.reduceright((acc, fn) => fn(acc), value) // increment passed number const inc = (n) => n + 1 // doubles the passed value const double = (n) => n * 2 // using composition function console.log(compose(double, inc)(2)); // 6 // using composition function console.log(co...
Array.prototype.push() - JavaScript
instead, we store the collection on the object itself and use call on array.prototype.push to trick the method into thinking we are dealing with an array—and it just works, thanks to the way javascript allows us to establish the
execution context in any way we want.
Date.prototype.getTime() - JavaScript
// since month is zero based, birthday will be january 10, 1995 var birthday = new date(1994, 12, 10); var copy = new date(); copy.settime(birthday.gettime()); measuring
execution time subtracting two subsequent gettime() calls on newly generated date objects, give the time span between these two calls.
FinalizationRegistry - JavaScript
it's likely that major implementations will call cleanup callbacks at some point during
execution, but those calls may be substantially after the related object was reclaimed.
JSON.parse() - JavaScript
if the reviver function returns undefined (or returns no value, for example, if
execution falls off the end of the function), the property is deleted from the object.
Object.defineProperties() - JavaScript
polyfill assuming a pristine
execution environment with all names and properties referring to their initial values, object.defineproperties is almost completely equivalent (note the comment in iscallable) to the following reimplementation in javascript: function defineproperties(obj, properties) { function converttodescriptor(desc) { function hasproperty(obj, prop) { return object.prototype.hasownproperty.call(obj, prop);...
Promise.prototype.then() - JavaScript
the value received and returned is: " + value); return value; }); // instantly logging the value of thenprom console.log(thenprom); // using settimeout we can postpone the
execution of a function to the moment the stack is empty settimeout(() => { console.log(thenprom); }); // logs, in order: // promise {[[promisestatus]]: "pending", [[promisevalue]]: undefined} // "this gets called after the end of the main stack.
RegExp - JavaScript
instance methods regexp.prototype.compile() (re-)compiles a regular expression during
execution of a script.
String.prototype.search() - JavaScript
(if you only want to know if it exists, use the similar test() method on the regexp prototype, which returns a boolean.) for more information (but slower
execution) use match() (similar to the regular expression exec() method).
Lexical grammar - JavaScript
however, in some cases, line terminators can influence the
execution of javascript code as there are a few places where they are forbidden.
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.
for - JavaScript
if the expression evaluates to false,
execution skips to the first expression following the for construct.
function* - JavaScript
calling the next() method with an argument will resume the generator function
execution, replacing the yield expression where an
execution was paused with the argument from next().
label - JavaScript
description you can use a label to identify a loop, and then use the break or continue statements to indicate whether a program should interrupt the loop or continue its
execution.
throw - JavaScript
execution of the current function will stop (the statements after throw won't be executed), and control will be passed to the first catch block in the call stack.
var - JavaScript
the scope of a variable declared with var is its current
execution context and closures thereof, which is either the enclosing function and functions declared within it, or, for variables declared outside any function, global.
while - JavaScript
when condition evaluates to false,
execution continues with the statement after the while loop.