Search completed in 1.25 seconds.
830 results for "execute":
Your results are loading. Please wait...
JS_ExecuteScriptPart
js_executescriptpart has been removed in bug 555104.
... use js_executescript instead.
... executes a part of a compiled script.
...And 11 more matches
JS_ExecuteScript
execute a compiled script.
... syntax bool js_executescript(jscontext *cx, js::handlescript script, js::mutablehandlevalue rval); // added in spidermonkey 45 bool js_executescript(jscontext *cx, js::handlescript script); // added in spidermonkey 45 bool js_executescript(jscontext *cx, js::autoobjectvector &scopechain, js::handlescript script, js::mutablehandlevalue rval); // added in spidermonkey 36 bool js_executescript(jscontext *cx, js::autoobjectvector &scopechain, js::handlescript script); // added in spidermonkey 36 bool js_executescript(jscontext *cx, js::handleobject obj, js::handlescript script, js::mutablehandlevalue rval); // obsolete since jsapi 39 bool js_executescript(jscontext *cx, js::handleobject obj, js::handlescript script); // obso...
...lete since jsapi 39 bool js::cloneandexecutescript(jscontext *cx, js::handle<jsscript*> script); // added in spidermonkey 45 bool js::cloneandexecutescript(jscontext *cx, js::handle<jsobject*> obj, js::handle<jsscript*> script); // added in spidermonkey 31, obsoleted since jsapi 39 name type description cx jscontext * the context in which to execute the script.
...And 10 more matches
JS_ExecuteScriptVersion
this article covers features introduced in spidermonkey 1.8.5 execute a compiled script with specified version.
... syntax jsbool js_executescriptversion(jscontext *cx, jsobject *obj, jsobject *scriptobj, jsval *rval, jsversion version); name type description cx jscontext * the context in which to execute the script.
... obj jsobject * the scope in which to execute the script.
...And 7 more matches
execute - Archive of obsolete content
method of install object syntax int execute ( string xpisourcepath [, boolean blocking]); int execute ( string xpisourcepath, string args [, boolean blocking]); parameters the execute method has the following parameters: xpisourcepath the pathname of the file to extract and execute.
... description the execute method extracts the named file from the xpi file to a temporary file name.
... your code must call the performinstall method to actually execute the file.
...And 6 more matches
HTMLIFrameElement.executeScript()
the executescript() method of the htmliframeelement interface allows a specified script to be executed against a page loaded in the browser <iframe>.
... syntax var mydomrequest = instanceofhtmliframeelement.executescript(script, options); return value a domrequest object that returns an onsuccess handler if the script is successfully executed against the loaded content, or an onerror handler if not.
... parameters script the script to be executed.
...And 4 more matches
JS_ExecuteRegExp
execute a new regexp object to given input string.
... syntax bool js_executeregexp(jscontext *cx, js::handleobject obj, js::handleobject reobj, char16_t *chars, size_t length, size_t *indexp, bool test, js::mutablehandlevalue rval); bool js_executeregexpnostatics(jscontext *cx, js::handleobject reobj, char16_t *chars, size_t length, size_t *indexp, bool test, js::mutablehandlevalue rval); name type description cx jscontext * the context.
... description js_executeregexp and js_newregexpobjectnostatics execute the regexp object, reobj, to the specified input string, chars, from *indexp index.
...And 4 more matches
execute - Archive of obsolete content
execute queues the executing of a local file.
... method of file object syntax int execute ( filespecobject executablefile, [string aparameters] ); parameters the execute method has the following parameters: executablefile a filespecobject representing the local file already on disk to be executed.
...description the specified file is not actually executed until the performinstall method is called.
...example f = getfolder("program", "mytexteditor.exe"); err = file.execute(f, "myfile.txt"); // indicates that 'myfile.txt' will be // opened in the editor ...
Document.onafterscriptexecute - Web APIs
the document.onafterscriptexecute property references a function that fires when a static <script> element finishes executing its script.
... syntax document.onafterscriptexecute = funcref; funcref is a function reference, called when the event is fired.
... example function finished(e) { logmessage(`finished script with id: ${e.target.id}`); } document.addeventlistener('afterscriptexecute', finished, true); view live example specification html5 ...
Document.onbeforescriptexecute - Web APIs
syntax document.onbeforescriptexecute = funcref; funcref is a function reference, called when the event is fired.
... the event's target attribute is set to the script element that is about to be executed.
... example function starting(e) { logmessage("starting script with id: " + e.target.id); } document.addeventlistener("beforescriptexecute", starting, true); view live examples specification html5 ...
Element: afterscriptexecute event - Web APIs
the afterscriptexecute event is fired after a script has been executed.
Element: beforescriptexecute event - Web APIs
the beforescriptexecute event is fired when a script is about to be executed.
Index - Web APIs
WebAPIIndex
in addition, it can execute multiple instances of the range of elements.
...in addition, it can execute multiple instances of a set of elements.
... 182 audioscheduledsourcenode.onended api, audio, audiobuffersourcenode, audioscheduledsourcenode, constantsourcenode, event handler, media, oscillatornode, property, web audio api, onended the onended event handler for the audioscheduledsourcenode interface specifies an eventhandler to be executed when the ended event occurs on the node.
...And 35 more matches
Storage
create statements to execute on the connection - mozistoragestatement.
... execute the statement.
... statements this section demonstrates how you can execute sql statements on your database.
...And 22 more matches
Index - Archive of obsolete content
93 loader/sandbox create javascript sandboxes and execute scripts in them.
...the issue that is commonly overlooked here is that the rss feed could contain some malicious javascript code and it would then execute with the privileges of the extension — meaning that it would get full access to the browser (cookies, history etc) and to user’s files.
... 1711 checkboxstatechange event, events the checkboxstatechange event is executed when the state of a <checkbox> element has changed.
...And 20 more matches
Sqlite.jsm
executecached(sql, params, onrow) execute(sql, params, onrow) these similar functions are used to execute a single sql statement on the connection.
... these functions receive the following arguments: sql (required) string sql statement to execute.
... when a statement is executed via executecached(), the prepared statement object is cached inside the opened connection.
...And 18 more matches
Appendix D: Loading Scripts - Archive of obsolete content
because there are such a diverse array of add-ons, and because the needs of developers have grown organically over time, the gecko runtime provides a number of means to dynamically load and execute javascript files.
...these tags are generally inserted into xul overlay files or other xul documents, after which they are automatically loaded into the context of the xul window in question and executed immediately and synchronously.
...the scripts still need to execute all of their initialization code and allocate and initialize all of their data structures each time the script is loaded.
...And 17 more matches
Control flow and error handling - JavaScript
conditional statements a conditional statement is a set of commands that executes if a specified condition is true.
... if...else statement use the if statement to execute a statement if a logical condition is true.
... use the optional else clause to execute a statement if the condition is false.
...And 17 more matches
JSAPI User Guide
these programs can execute javascript code from c++ using the spidermonkey api.
... what spidermonkey does the javascript engine compiles and executes scripts containing javascript statements and functions.
... the engine handles memory allocation for the objects needed to execute scripts, and it cleans up—garbage collects—objects it no longer needs.
...And 16 more matches
mozIStorageConnection
tion); mozistorageasyncstatement createasyncstatement(in autf8string asqlstatement); void createfunction(in autf8string afunctionname, in long anumarguments, in mozistoragefunction afunction); mozistoragestatement createstatement(in autf8string asqlstatement); void createtable(in string atablename, in string atableschema); mozistoragependingstatement executeasync([array, size_is(anumstatements)] in mozistoragebasestatement astatements, in unsigned long anumstatements, [optional] in mozistoragestatementcallback acallback ); void executesimplesql(in autf8string asqlstatement); boolean indexexists(in autf8string aindexname); void preload(); obsolete since gecko 1.9 void removefunction(in autf8string afunctionname); ...
... void asyncclose( in mozistoragecompletioncallback acallback optional ); parameters acallback optional an optional callback handler to be executed when the connection is successfully closed.
...the best way to deal with this is to only execute your statements asynchronously using mozistorageconnection.executeasync().
...And 15 more matches
Loops and iteration - JavaScript
a for statement looks as follows: for ([initialexpression]; [conditionexpression]; [incrementexpression]) statement when a for loop executes, the following occurs: the initializing expression initialexpression, if any, is executed.
...if the value of conditionexpression is true, the loop statements execute.
...(if the condition expression is omitted entirely, the condition is assumed to be true.) the statement executes.
...And 13 more matches
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
introduction for a long time, the web platform has offered javascript programmers a number of functions that allow them to asynchronously execute code after a certain time interval has elapsed, and to repeatedly execute a block of code asynchronously until you tell it to stop.
... these functions are: settimeout() execute a specified block of code once after a specified time has elapsed.
... setinterval() execute a specified block of code repeatedly with a fixed time delay between each call.
...And 12 more matches
HTML parser threading
however, when tree ops are executed, every atom has to be tested for being a static atom (using isstaticatom()).
...only when the tree op executor executes a node creation tree op, the nsicontent* that points to the node gets written to the memory location pointed to by the nsicontent**.
...if too much time has been spent, a runnable for calling runflushloop() again is dispatched and an early return made before all tree ops have been executed.
...And 12 more matches
Index - Archive of obsolete content
ArchiveMozillaXULIndex
980 checkboxstatechange event, events the checkboxstatechange event is executed when the state of a <checkbox> element has changed.
... 981 dommenuitemactive the dommenuitemactive event is executed when a <menu> or a <menuitem> has been hovered or highlighted.
... 982 dommenuiteminactive the dommenuiteminactive event is executed when a <menu> or a <menuitem> in no longer hovered or highlighted.
...And 11 more matches
mozIStorageStatement
storage/public/mozistoragestatement.idlscriptable this interface lets you create and execute sql statements on a mozistorageconnection.
... void bindint32parameter(in unsigned long aparamindex, in long avalue); void bindint64parameter(in unsigned long aparamindex, in long long avalue); void bindnullparameter(in unsigned long aparamindex); void bindblobparameter(in unsigned long aparamindex, [array,const,size_is(avaluesize)] in octet avalue, in unsigned long avaluesize); mozistoragependingstatement executeasync(mozistoragestatementcallback acallback); boolean executestep(); boolean step(); void execute(); attributes attribute type description columncount unsigned long number of columns returned.
... moz_storage_statement_ready 1 the sql statement is ready to be executed.
...And 10 more matches
JS::Evaluate
this article covers features introduced in spidermonkey 17 compile and execute a script.
... obj js::handleobject the scope in which to execute the script.
... this parameter is documented in detail at js_executescript.
...And 9 more matches
WorkerLocation - Web APIs
the workerlocation interface defines the absolute location of the script executed by the worker.
... this interface is only visible from inside a javascript script executed in the context of a web worker.
... urlutilsreadonly.href read only is a stringifier that returns a domstring containing the whole url of the script executed in the worker.
...And 8 more matches
try...catch - JavaScript
[catch (exception_var_2) { catch_statements_2 }] [finally { finally_statements }] try_statements the statements to be executed.
... catch_statements_1, catch_statements_2 statements that are executed if an exception is thrown in the try-block.
... finally_statements statements that are executed after the try statement completes.
...And 8 more matches
lang/functional - Archive of obsolete content
wrap(fn, wrapper) returns the first function passed as an argument to the second, allowing you to adjust arguments, run code before and after, and conditionally execute the original function.
... wrapper : function the function that is called when the return function is executed, taking the wrapped fn as the first parameter.
... returns function : a function which, when called, executes wrapper with fn as the first parameter, and passes in any additional parameters to the wrapper function.
...And 7 more matches
Index
41 js::evaluate jsapi reference, reference, référence(2), spidermonkey js::evaluate compiles and executes a script in the specified scope, obj or scopechain.
... 261 js_evaluatescript jsapi reference, obsolete, spidermonkey js_evaluatescript compiles and executes a script in the specified scope, obj.
... 263 js_executeregexp jsapi reference, spidermonkey js_executeregexp and js_newregexpobjectnostatics execute the regexp object, reobj, to the specified input string, chars, from *indexp index.
...And 7 more matches
nsINavHistoryService
void markpageastyped(in nsiuri auri); boolean canadduri(in nsiuri auri); long long addvisit(in nsiuri auri, in prtime atime, in nsiuri areferringuri, in long atransitiontype, in boolean aisredirect, in long long asessionid); obsolete since gecko 22.0 nsinavhistoryquery getnewquery(); nsinavhistoryqueryoptions getnewqueryoptions(); nsinavhistoryresult executequery(in nsinavhistoryquery aquery, in nsinavhistoryqueryoptions options); nsinavhistoryresult executequeries([array,size_is(aquerycount)] in nsinavhistoryquery aqueries, in unsigned long aquerycount, in nsinavhistoryqueryoptions options); void querystringtoqueries(in autf8string aquerystring, [array, size_is(aresultcount)] out nsinavhistoryquery aqueries, out unsigned long aresu...
... getnewquery() this method returns a new query object that you can pass to executequery/ies methods.
... getnewqueryoptions() this method returns a new options object that you can pass to executequery/ies methods after setting the desired options.
...And 7 more matches
switch - JavaScript
the switch statement evaluates an expression, matching the expression's value to a case clause, and executes statements associated with that case, as well as statements in cases that follow the matching case.
... syntax switch (expression) { case value1: //statements executed when the //result of expression matches value1 [break;] case value2: //statements executed when the //result of expression matches value2 [break;] ...
... case valuen: //statements executed when the //result of expression matches valuen [break;] [default: //statements executed when none of //the values match the value of the expression [break;]] } expression an expression whose result is matched against each case clause.
...And 7 more matches
Statements and declarations - JavaScript
if...else executes a statement if a specified condition is true.
... if the condition is false, another statement can be executed.
... switch evaluates an expression, matching the expression's value to a case clause, and executes statements associated with that case.
...And 7 more matches
Scratchpad - Archive of obsolete content
unlike the web console, which is designed for interpreting a single line of code at a time, scratchpad lets you edit larger chunks of javascript code, then execute it in various ways depending on how you want to use the output.
...then choose the way you want the code to run using the buttons along the top, using the execute menu, or using the context menu.
... the code is executed in the scope of the currently selected tab.
...And 6 more matches
DeferredTask.jsm
the task will always be executed on a different tick of the event loop, even if the delay specified on construction is zero.
... void disarm(); finalize ensure that any pending task is executed from start to finish, while preventing any attempt to arm the timer again.
...the task cannot be re-entered while running, but can be executed again after a previous run finished.
...And 6 more matches
Places Developer Guide
bool getfolderreadonly(afolderid) accessing folder contents queries in places are executed through the main history service.
...var history = cc["@mozilla.org/browser/nav-history-service;1"] .getservice(ci.nsinavhistoryservice); var query = history.getnewquery(); query.setfolders([myfolderid], 1); var result = history.executequery(query, history.getnewqueryoptions()); // the root property of a query result is an object representing the folder you specified above.
...searching bookmarks queries are executed through the history service.
...And 6 more matches
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
the settimeout() method of the windoworworkerglobalscope mixin (and successor to window.settimeout()) sets a timer which executes a function or specified piece of code once the timer expires.
... syntax var timeoutid = scope.settimeout(function[, delay, arg1, arg2, ...]); var timeoutid = scope.settimeout(function[, delay]); var timeoutid = scope.settimeout(code[, delay]); parameters function a function to be executed after the timer expires.
... code an alternative syntax that allows you to include a string instead of a function, which is compiled and executed when the timer expires.
...And 6 more matches
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
it might be possible to execute any retrieved jsonp code in an unprivileged sandbox (which is complicated!), but if you have a choice, just avoid jsonp altogether!
...settimeout("alert('" + xhr.responsetext + "');", 100); // attacker manipulated responsetext to contain "attack!'); format_computer(); alert('done" settimeout("alert('attack!'); format_computer(); alert('done');", 100); as a general rule of thumb, just don't pass code around as strings and execute it by calling eval, settimeout and friends.
... gbrowser.addtab = function() { // execute some action before the original function call.
...And 5 more matches
Using Breakpoints in Venkman - Archive of obsolete content
the most common use of future breakpoints is to stop in a "top level" script (script that executes outside of any function), or script that executes during the onload event of a page.
...venkman will stop before the line executes.
...if you execute this code again after having set this breakpoint, venkman will stop at line 81.
...And 5 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
a compiler is a software to execute this task.
... 90 control flow codingscripting, glossary, javascript the control flow is the order in which the computer executes statements in a script.
...this code is executed by the victims and lets the attackers bypass access controls and impersonate users.
...And 5 more matches
Querying Places
executing a query places queries have several basic parts: the query object: nsinavhistoryquery, holds the search parameters the query options: nsinavhistoryqueryoptions, allows configuration of the search result the history service: nsinavhistoryservice, executes the query the first first step is to create the query and options, and fill them with the parameters you want.
...let options = placesutils.history.getnewqueryoptions(); // no query parameters will return everything let query = placesutils.history.getnewquery(); // execute the query let result = placesutils.history.executequery(query, options); result types nsinavhistoryqueryoptions has a resulttype property that allows configuration of the grouping and level of detail to be returned in the results.
...pandqueries attribute boolean includehidden attribute boolean showsessions attribute unsigned long maxresults const unsigned short query_type_history = 0 const unsigned short query_type_bookmarks = 1 const unsigned short query_type_unified = 2 (not yet implemented -- see bug 378798) attribute unsigned short querytype complex queries you can pass one or more nsinavhistoryquery objects to executequeries().
...And 5 more matches
mozIStorageAggregateFunction
note this callback is executed on the thread that the statement or trigger is executing on.
... if you use mozistorageconnection.executeasync() or, mozistoragestatement.executeasync() this callback will run on a different thread from the rest of your code.
... likewise, if you execute sql on a different thread, this callback will be executed on that thread.
...And 5 more matches
Using Web Workers - Web APIs
all you need to do is call the worker() constructor, specifying the uri of a script to execute in the worker thread (main.js): var myworker = new worker('worker.js'); sending messages to and from a dedicated worker the magic of workers happens via the postmessage() method and the onmessage event handler.
...ers to resources to import; all of the following examples are valid: importscripts(); /* imports nothing */ importscripts('foo.js'); /* imports just "foo.js" */ importscripts('foo.js', 'bar.js'); /* imports two scripts */ importscripts('//example.com/hello.js'); /* you can import scripts from other origins */ the browser loads each listed script and executes it.
...if the script can't be loaded, network_error is thrown, and subsequent code will not be executed.
...And 5 more matches
WindowOrWorkerGlobalScope.setInterval() - Web APIs
the setinterval() method, offered on the window and worker interfaces, repeatedly calls a function or executes a code snippet, with a fixed time delay between each call.
... syntax var intervalid = scope.setinterval(func, [delay, arg1, arg2, ...]); var intervalid = scope.setinterval(function[, delay]); var intervalid = scope.setinterval(code, [delay]); parameters func a function to be executed every delay milliseconds.
... code an optional syntax allows you to include a string instead of a function, which is compiled and executed every delay milliseconds.
...And 5 more matches
Introducing asynchronous JavaScript - Learn web development
let's look at a simple example (see it live here, and see the source): const btn = document.queryselector('button'); btn.addeventlistener('click', () => { alert('you clicked me!'); let pelem = document.createelement('p'); pelem.textcontent = 'this is a newly-added paragraph.'; document.body.appendchild(pelem); }); in this block, the lines are executed one after the other: we grab a reference to a <button> element that is already available in the dom.
... when we pass a callback function as an argument to another function, we are only passing the function's reference as an argument, i.e, the callback function is not executed immediately.
... promises avoid inversion of control, unlike old-style callbacks, which lose full control of how the function will be executed when passing a callback to a third-party library.
...And 4 more matches
Website security - Learn web development
if the target user clicks this "interesting link", the script will be executed when the search results are displayed.
... a persistent xss vulnerability occurs when the malicious script is stored on the website and then later redisplayed unmodified for other users to execute unwittingly.
...when the comments are displayed, the script is executed and can send to the attacker the information required to access the user's account.
...And 4 more matches
Rhino shell
invoking the shell java org.mozilla.javascript.tools.shell.main [options] script-filename-or-url [script-arguments] where options are: -e script-source executes script-source as a javascript script.
... -f script-filename-or-url reads script-filename-or-url content and execute it as a javascript script.
...if multiple arguments are given, each file is read in and executed in turn.
...And 4 more matches
JS_EvaluateScript
compile and execute a script.
... obj jsobject * the scope in which to execute the script.
... this parameter is documented in detail at js_executescript.
...And 4 more matches
JS_EvaluateScriptForPrincipals
compile and execute a security-enabled script.
... obj jsobject * the scope in which to execute the script.
... this parameter is documented in detail at js_executescript.
...And 4 more matches
if...else - JavaScript
the if statement executes a statement if a specified condition is truthy.
... if the condition is falsy, another statement can be executed.
... statement1 statement that is executed if condition is truthy.
...And 4 more matches
cfx - Archive of obsolete content
--binary-args=cmdargs pass extra arguments to the binary being executed (for example, firefox).
... --no-run with this option cfx will not execute the command, but will print out the command that it would have used to execute the command.
... --binary-args=cmdargs pass extra arguments to the binary being executed (for example, firefox).
...And 3 more matches
Monitoring downloads - Archive of obsolete content
dbconn.executesimplesql("create table items (source text, size integer," + " starttime integer, endtime integer," + " speed real, status integer)"); dbconn.close(); }, this is fairly simple stuff.
...the database file is opened, and an sqlite create table command is executed to create the table.
...r dbconn = this.storageservice.opendatabase(this.dbfile); statement = dbconn.createstatement("replace into items values " + "(?1, ?2, ?3, 0, 0.0, 0)"); statement.bindstringparameter(0, adownload.source.spec); statement.bindint64parameter(1, adownload.size); statement.bindint64parameter(2, adownload.starttime); statement.execute(); statement.reset(); dbconn.close(); break; // record the completion (whether failed or successful) of the download case components.interfaces.nsidownloadmanager.download_finished: case components.interfaces.nsidownloadmanager.download_failed: case components.interfaces.nsidownloadmanager.download_canceled: this.logtransfercompleted(adownload); ...
...And 3 more matches
Venkman Introduction - Archive of obsolete content
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.
... the continue button to the right of the stop button dismisses the stop mode and specifies that scripts should be executed normally, without pausing as each statement is executed.
...since the javascript engine automatically populates the loaded scripts list in the debugger with javascript it executes as the browser opens web pages, it's usually enough simply to browse the sites whose scripts you are interested in debugging.
...And 3 more matches
Elements - Archive of obsolete content
its contents are the script that is executed when the method is invoked.
... onget - the onget attribute's value is a script that executes when the value of the property is requested.
... onset - the onset attribute's value is a script that executes when the value of the property is being altered.
...And 3 more matches
2D maze game with device orientation - Game development
function that will be executed when someone clicks the button.
...in particular, take note of the update() function (executed at every frame), which updates things such as the ball position.
... wallcollision is executed when the ball hits the walls or other objects.
...And 3 more matches
How Mozilla's build system works
what essentially happens is the automatically produced config.status python script is executed as soon as configure has generated it.
...finished reading 1096 moz.build files into 1276 descriptors in 2.40s backend executed in 2.39s 2188 total backend files.
... to view information about the tiers, you can execute the following special make targets: command effect make echo-tiers show the final list of tiers.
...And 3 more matches
JavaScript OS.Constants
s_irwxu current user can read, write, execute the file.
... s_ixusr current user can execute the file.
... s_irwxg current group of the current user can read, write, execute the file.
...And 3 more matches
Rhino scopes and contexts
both are required to execute scripts, but they play different roles.
...you can even execute scripts on multiple threads simultaneously in the same scope.
...in general, variables are looked up by starting at the current variable object (which is different depending on what code is being executed in the program), traversing its prototype chain, and then traversing the parent chain.
...And 3 more matches
History Service Design
the system should be customizable enough to allow creation of custom, calendar and graphical views based on queries executed through a common api upon underlying data.
... actual tasks executed by this service include: database creation, maintenance and initialization: all services rely on a common shared database called places.sqlite.
...since places is actually not thread-safe and doing most of the work in the main-thread, adding visits (the most common action usually executed on user interaction) could end up locking the ui till the database i/o to save data is complete.
...And 3 more matches
XPCShell Reference
(setting this option disables the "interactive" mode) -f this option specifies a script file to execute.
...you can specify multiple js files to execute by using multiple -f arguments, and the scripts will be executed in the order encountered.
...if that file is found, it is executed before any other js files specified.
...And 3 more matches
mozIStorageFunction
note this callback is executed on the thread that the statement or trigger is executing on.
... if you use mozistorageconnection.executeasync() or, mozistoragestatement.executeasync() this callback will run on a different thread from the rest of your code.
... likewise, if you execute sql on a different thread, this callback will be executed on that thread.
...And 3 more matches
nsIDOMWindowUtils
this includes counts for how often and in what ways the script executed.
... this includes the text of the script and details about its internal representation in spidermonkey, and counts for how often and in what ways each operation in the script executed.
... void setresolution( in float axresolution, in float ayresolution ); parameters axresolution ayresolution startpccountprofiling() begins detailed profiling of all executed javascript code in the browser.
...And 3 more matches
nsITransaction
this attribute is checked by the transaction manager after the transaction's execute() method is called.
... methods dotransaction() executes the transaction.
...boolean merge( in nsitransaction atransaction ); parameters atransaction the previously executed transaction to merge.
...And 3 more matches
The JavaScript input interpreter - Firefox Developer Tools
for example, if you type: function foo() { and then enter, the console does not immediately execute the input, but behaves as if you had pressed shift+enter , so you can finish entering the function definition.
...to execute the snippet that is currently in the editing pane, click the run button or press ctrl+enter (or cmd+return on macos).
... execution context code that you have executed becomes part of the execution context, regardless of what editing mode you were in when you executed it.
...And 3 more matches
HTMLScriptElement - Web APIs
htmlscriptelement.async htmlscriptelement.defer the async and defer attributes are boolean attributes that control how the script should be executed.
... there are three possible execution modes: if the async attribute is present, then the script will be executed asynchronously as soon as it downloads.
... if the async attribute is absent but the defer attribute is present, then the script is executed when the page has finished parsing.
...And 3 more matches
In depth: Microtasks and the JavaScript runtime environment - Web APIs
greetuser() continues to execute where it left off.
... run, javascript, run to run javascript code, the runtime engine maintains a set of agents in which to execute javascript code.
... tasks vs microtasks a task is any javascript scheduled to be run by the standard mechanisms such as initially starting to execute a program, an event triggering a callback, and so forth.
...And 3 more matches
Intersection Observer API - Web APIs
the intersection observer api lets code register a callback function that is executed whenever an element they wish to monitor enters or exits another element (or the viewport), or when the amount by which the two intersect changes by a requested amount.
... threshold either a single number or an array of numbers which indicate at what percentage of the target's visibility the observer's callback should be executed.
... targeting an element to be observed once you have created the observer, you need to give it a target element to watch: let target = document.queryselector('#listitem'); observer.observe(target); // the callback we setup for the observer will be executed now for the first time // it waits until we assign a target to our observer (even if the target is currently not visible) whenever the target meets a threshold specified for the intersectionobserver, the callback is invoked.
...And 3 more matches
RTCPeerConnection - Web APIs
see signaling in lifetime of a webrtc session for more details about the signaling process.event handlersalso inherits event handlers from: eventtargetonaddstream the rtcpeerconnection.onaddstream event handler is a property containing the code to execute when the addstream event, of type mediastreamevent, is received by this rtcpeerconnection.
...this happens when the ice gathering state—that is, whether or not the ice agent is actively gathering candidates—changes.onidentityresult the rtcpeerconnection.onidentityresult event handler is a property containing the code to execute when the identityresult event, of type rtcidentityevent, is received by this rtcpeerconnection.
... such an event is sent when an identity assertion is generated, via getidentityassertion() or during the creation of an offer or an answer.onidpassertionerror the rtcpeerconnection.onidpassertionerror event handler is a property containing the code to execute whent the idpassertionerror event, of type rtcidentityerrorevent, is received by this rtcpeerconnection.
...And 3 more matches
JavaScript timers - Archive of obsolete content
a block of javascript code is generally executed synchronously.
...the setinterval() function is commonly used to set a delay for functions that are executed again and again, such as animations.
... the setimmediate() function can be used instead of the settimeout(fn, 0) method to execute heavy operations in ie.
...And 2 more matches
Promises - Archive of obsolete content
yield db.executetransaction(function* () { for (let node of nodes) // insert the node's data, using an automatically-cached, // pre-compiled statement, and parameter placeholders.
... yield db.executecached( "insert into nodes (id, owner, key, value) \ values (:id, :owner, :key, :value);", { params: { id: node.id, owner: node.owner.id, key: node.key, value: node.value }}); }); // perform a bulk update.
... yield db.execute( "update owners, nodes \ set owners.name = nodes.name \ where owners.id = nodes.owner and nodes.key = 'name';"); // process some results.
...And 2 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
javascript execution differences different browsers execute javascript differently.
... for example, the following code assumes that the div node already exists in the dom by the time the script block executes: ...
...therefore, you may execute the line after the window.open line before the new window has finished.
...And 2 more matches
Learn XPI Installer Scripting by Example - Archive of obsolete content
if you choose not to register the installed software or do the verifications at the front end of the installation, then at a minimum, the install scripts mustinitialize, add the files to be installed, and execute.
... verifying the target the first thing the installation script does when it's executed is to check that there is adequate disk space for the software to be installed, where the verifydiskspace function is called as a condition of the main installation block that starts at line 24).
... executing the installation once you have added all the files to the installation, the final step is to actually execute the installation.
...And 2 more matches
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
g a mysql database from rhino // import the java sql packages importpackage( java.sql ); // load the mysql driver java.lang.class.forname( "com.mysql.jdbc.driver" ); // create connection to the database var conn = drivermanager.getconnection( "jdbc:mysql://localhost/rhino", "urhino", "prhino" ); // create a statement handle var stmt = conn.createstatement(); // get a resultset var rs = stmt.executequery( "select * from employee" ); // get the metadata from the resultset var meta = rs.getmetadata(); // loop over the records, dump out column names and values while( rs.next() ) { for( var i = 1; i <= meta.getcolumncount(); i++ ) { print( meta.getcolumnname( i ) + ": " + rs.getobject( i ) + "\n" ); } print( "----------\n" ); } // cleanup rs.close(); stmt.close(); conn.close(); ...
...the sql statement is prepared, executed, and printed with the help of the metadata obtained from the resultset.
... listing 7 - manipulating the dom server-side <script runat="server"> window.onserverload = function() { document.getelementbyid( "out-logger" ).innerhtml = jaxer.file.read( "dump.txt" ); } </script> the code in listing 7 is executed server-side and takes advantage of the onserverload event which ensures that we have a complete dom before trying to access it.
...And 2 more matches
Desktop gamepad controls - Game development
first, we need an event listener to listen for the connection of the new device: window.addeventlistener("gamepadconnected", gamepadhandler); it's executed once, so we can create some variables we will need later on for storing the controller info and the pressed buttons: var controller = {}; var buttonspressed = []; function gamepadhandler(e) { controller = e.gamepad; output.innerhtml = "gamepad: " + controller.id; } the second line in the gamepadhandler function shows up on the screen when the device is connected: we can also show th...
... next, in the draw() function we do two things — execute the gamepadupdatehandler() function to get the current state of pressed buttons on every frame, and use the gamepadbuttonpressedhandler() function to check the buttons we are interested to see whether they are pressed, and do something if they are: function draw() { ctx.clearrect(0, 0, canvas.width, canvas.height); // ...
... after the gamepad is connected, the information about the controller is stored in the object: connect: function(event) { gamepadapi.controller = event.gamepad; gamepadapi.active = true; }, the disconnect function removes the information from the object: disconnect: function(event) { delete gamepadapi.controller; gamepadapi.active = false; }, the update() function is executed in the update loop of the game on every frame, so it contains the latest information on the pressed buttons: update: function() { gamepadapi.buttons.cache = []; for(var k=0; k<gamepadapi.buttons.status.length; k++) { gamepadapi.buttons.cache[k] = gamepadapi.buttons.status[k]; } gamepadapi.buttons.status = []; var c = gamepadapi.controller || {}; var pressed = []; if(c.buttons)...
...And 2 more matches
Call stack - MDN Web Docs Glossary: Definitions of Web-related terms
example function greeting() { // [1] some codes here sayhi(); // [2] some codes here } function sayhi() { return "hi!"; } // invoke the `greeting` function greeting(); // [3] some codes here the code above would be executed like this: ignore all functions, until it reaches the greeting() function invocation.
... call stack list: - greeting execute all lines of code inside the greeting() function.
... call stack list: - sayhi - greeting execute all lines of code inside the sayhi() function, until reaches its end.
...And 2 more matches
What is JavaScript? - Learn web development
note that the code in your web documents is generally loaded and executed in the order it appears on the page.
...the program is executed from a binary format, which was generated from the original program source code.
... scripts loaded using the async attribute (see below) will download the script without blocking rendering the page and will execute it as soon as the script finishes downloading.
...And 2 more matches
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
inside the onedit() function we set editing = true and immediately afterwards try to access the nameel variable and execute nameel.focus().
...the destroy property is what svelte will execute after removing the node from the dom.
... (node && typeof node.select === 'function' ) { // make sure node is defined and has a select() method const onfocus = event => node.select() // event handler node.addeventlistener('focus', onfocus) // when node gets focus call onfocus() return { destroy: () => node.removeeventlistener('focus', onfocus) // this will be executed when the node is removed from the dom } } } now we need to tell the <input> to use that function with the use:action directive: <input use:selectonfocus /> with this directive we are telling svelte to run this function, passing the dom node of the <input> as a parameter, as soon as the component is mounted on the dom.
...And 2 more matches
Working with Svelte stores - Learn web development
next we import the ondestroy() lifecycle function, which lets us execute a callback after the component has been unmounted.
...when the value of the store changes, the callback is executed.
... as soon as we execute $alert = ..., svelte will run alert.set(...).
...And 2 more matches
Setting up your own test automation environment - Learn web development
(function() { driver.gettitle().then(function(title) { if(title === 'webdriver - google search') { console.log('test passed'); } else { console.log('test failed'); } }); }); the sleep() method accepts a value that specifies the time to wait in milliseconds — the method returns a promise that resolves at the end of that time, at which point the code inside the then() executes.
...add this line to the bottom of your quick_test.js test now: driver.quit(); when you run it, you should now see the test execute and the browser instance shut down again after the test is complete.
... run the below command in your terminal to execute your test: node index.js the test will be sent to lambdatest, and the output of your test will be reflected on your lambdatest console.
...And 2 more matches
Displaying Places information using views
because of placestreeview's double duty, you can use it to bridge a query result and a tree element: var result = historyservice.executequery(query, opts); // your places query result var tree = document.getelementbyid("mytree"); // your tree element var showrootnodeintree = true; var view = new placestreeview(showrootnodeintree); // here's the bridge!
... getservice(components.interfaces.nsinavhistoryservice); var opts = histserv.getnewqueryoptions(); var query = histserv.getnewquery(); query.setfolders([bmserv.placesroot], 1); var result = histserv.executequery(query, opts); // here myview is your view, and myview.viewer is some object implementing nsinavhistoryresultobserver.
...a caller would pass in a result or a query, and you would execute the query and add your view as an observing client using addobserver().
...And 2 more matches
Performance
key points to keep in mind scripts registered during addon startup get executed during session restore.
... the more expensive they are to execute the longer it will take for the browser to become responsive after startup.
... frame scripts also get executed on non-restored tabs.
...And 2 more matches
Index
because public key encryption is more expensive (more calculations required) than symmetric encryption (where both parties use the same key), a key agreement protocol will be executed, where the public and private keys are used to proof and verify the exchanged initial information.
... "./pk11inst.dir/setup.sh" executed successfully installed module "example pkcs #11 module" into module database installation completed successfully adding module spec each module has information stored in the security database about its configuration and parameters.
... executable specifies that the file is to be executed during the course of the installation.
...And 2 more matches
Bytecode Descriptions
the spec requires that an objectliteral or arrayliteral creates a new object every time it's evaluated, so this instruction must not be used anywhere it might be executed more than once.
...there must not already be a generator object for the current frame (that is, this instruction must execute at most once per generator or async call).
...if no jsop::setrval instruction has been executed in this stack frame, this is undefined.
...And 2 more matches
JSAPI reference
luatescript obsolete since jsapi 36 js_evaluateucscript obsolete since jsapi 36 js_evaluatescriptforprincipals obsolete since jsapi 30 js_evaluateucscriptforprincipals obsolete since jsapi 30 js_evaluatescriptforprincipalsversion obsolete since jsapi 30 js_evaluateucscriptforprincipalsversion obsolete since jsapi 30 you can instead compile javascript code into a jsscript which you can then execute multiple times.
... class jsscript js::compile added in spidermonkey 17 js::compileoffthread added in spidermonkey 31 js::cancompileoffthread added in spidermonkey 31 js::finishoffthreadscript added in spidermonkey 31 js_compilescript js_compileucscript js_bufferiscompilableunit js_executescript js::cloneandexecutescript added in spidermonkey 31 js_decompilescript js_executescriptversion obsolete since jsapi 36 js_compileutf8file added in spidermonkey 11 obsolete since jsapi 19 js_compileutf8filehandle added in spidermonkey 11 obsolete since jsapi 19 js_compileutf8filehandleforprincipals added in spidermonkey 11 obsolete since jsapi 19 js_compilefile obsolete since jsapi 11 js_compilefilehandle obsolete since jsapi 11 js_compilefilehandleforprincipals obsolete since jsapi 11 js_compilescript...
...forprincipals obsolete since jsapi 28 js_compileucscriptforprincipals obsolete since jsapi 28 js_compilescriptforprincipalsversion obsolete since jsapi 19 js_compileucscriptforprincipalsversion obsolete since jsapi 19 js_getscriptobject obsolete since jsapi 8 js_newscriptobject obsolete since jsapi 8 js_executescriptpart obsolete since javascript 1.9.3 js_destroyscript obsolete since jsapi 8 you can also compile javascript code into a function: struct jsfunction js::compilefunction added in spidermonkey 17 js_decompilefunction js_decompilefunctionbody js_compilefunction obsolete since jsapi 36 js_compilefunctionforprincipals obsolete since jsapi 28 js_compileucfunction obsolete since jsapi 36 js_compileucfunctionforprincipals obsolete since jsapi 28 error handling struc...
...And 2 more matches
Using the Places history service
you can pass this to executequeries().
...you can pass this to executequeries().
... nsinavhistoryservice.executequery: runs a query with a single query object and options.
...And 2 more matches
Index
MozillaTechXPCOMIndex
205 mozistoragebindingparams interfaces, interfaces:scriptable, storage the mozistoragebindingparams interface is used to bind values to parameters prior to calling mozistoragestatement.executeasync().
... 206 mozistoragebindingparamsarray interfaces, interfaces:scriptable, storage the mozistoragebindingparamsarray interface is a container for mozistoragebindingparams objects, and is used to store sets of bound parameters that will be used by the mozistoragestatement.executeasync().
...you can then wrap that statement with a wrapper, which implements nsixpcscriptable and provides scriptable helpers letting you execute the statement as a function, access bind variables by name as properties, etc.
...And 2 more matches
Migrating from Firebug - Firefox Developer Tools
it shows log information associated with a web page and allows you to execute javascript expressions via its command line.
...both allow you to debug javascript code executed on a website.
...scripts executed via event handlers, eval(), new function(), etc.).
...And 2 more matches
Document - Web APIs
WebAPIDocument
event handlers document.onafterscriptexecute represents the event handling code for the afterscriptexecute event.
... document.onbeforescriptexecute represents the event handling code for the beforescriptexecute event.
... document.execcommand() on an editable document, executes a formating command.
...And 2 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.
... tasks get added to the task queue when: a new javascript program or subprogram is executed (such as from a console, or by running the code in a <script> element) directly.
...only tasks which were already in the task queue when the event loop pass began will be executed during the current iteration.
...And 2 more matches
<script>: The Script element - HTML: Hypertext Markup Language
WebHTMLElementscript
for module scripts, if the async attribute is present then the scripts and all their dependencies will be executed in the defer queue, therefore they will get fetched in parallel to parsing and evaluated as soon as they are available.
... defer this boolean attribute is set to indicate to a browser that the script is meant to be executed after the document has been parsed, but before firing domcontentloaded.
... scripts with the defer attribute will execute in the order in which they appear in the document.
...And 2 more matches
Map.prototype.forEach() - JavaScript
the foreach() method executes a provided function once per each key/value pair in the map object, in insertion order.
... syntax mymap.foreach(callback([value][,key][,map])[, thisarg]) parameters callback function to execute for each entry of mymap.
... description the foreach method executes the provided callback once for each key of the map which actually exist.
...And 2 more matches
Set.prototype.forEach() - JavaScript
the foreach() method executes a provided function once for each value in the set object, in insertion order.
... syntax myset.foreach(callback[, thisarg]) parameters callback function to execute for each element, taking three arguments: currentvalue, currentkey the current element being processed in the set.
... description the foreach() method executes the provided callback once for each value which actually exists in the set object.
...And 2 more matches
undefined - JavaScript
var x; if (x === undefined) { // these statements execute } else { // these statements do not execute } note: the strict equality operator (as opposed to the standard equality operator) must be used here, because x == undefined also checks whether x is null, while strict equality doesn't.
... typeof operator and undefined alternatively, typeof can be used: var x; if (typeof x === 'undefined') { // these statements execute } one reason to use typeof is that it does not throw an error if the variable has not been declared.
... // x has not been declared before if (typeof x === 'undefined') { // evaluates to true without errors // these statements execute } if (x === undefined) { // throws a referenceerror } however, there is another alternative.
...And 2 more matches
for - JavaScript
the for statement creates a loop that consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement (usually a block statement) to be executed in the loop.
...if this expression evaluates to true, statement is executed.
... statement a statement that is executed as long as the condition evaluates to true.
...And 2 more matches
function* - JavaScript
calling a generator function does not execute its body immediately; an iterator object for the function is returned instead.
... when the iterator's next() method is called, the generator function's body is executed until the first yield expression, which specifies the value to be returned from the iterator or, with yield*, delegates to another generator function.
... a return statement in a generator, when executed, will make the generator finish (i.e.
...And 2 more matches
Binding Attachment and Detachment - Archive of obsolete content
if the binding needs to execute any initialization code following its attachment to an element, it can do so using a <constructor> block inside <implementation> section.
... this block contains script that executes upon completion of the binding attachment.
... a binding can specify a <destructor> block within <implementation> section that executes prior to the binding detachment.
...therefore the <destructor> block of the derived binding will execute, and then the base binding's block will execute.
Using XPInstall to Install Plugins - Archive of obsolete content
from javascript, you can call xpinstall's execute method of the install object to execute the binary.
... you can also call the execute method of the file object if you wish to actually install the file you are executing, rather than have it deleted.
...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 ....
...) has already been called // using the install object's execute method to block on a native installer execute("setup.exe", "-s", true); // in the above sample, assume that running "setup -s" from the // command prompt runs the setup executable, and that "-s" is some // invocation parameter defined by the setup.exe file, perhaps to force // the installer to run silently.
XUL Events - Archive of obsolete content
xul event reference subpages broadcastthe broadcast event is executed when the attributes of the element (such as a broadcaster) being listened to are changed.
... the event handler should be placed on an observer.checkboxstatechangethe checkboxstatechange event is executed when the state of a <checkbox> element has changed.closethe close event is executed when a request has been made to close the window when the user presses the close button.commandthe command event is executed when an element is activated.commandupdatethe commandupdate event is executed when a command update occurs on a <commandset>.
... this event would be used to update the disabled status of its commands.dommenuitemactivethe dommenuitemactive event is executed when a <menu> or a <menuitem> has been hovered or highlighted.dommenuiteminactivethe dommenuiteminactive event is executed when a <menu> or a <menuitem> in no longer hovered or highlighted.popuphiddenthe popuphidden event is executed when a <menupopup>, <panel> or <tooltip> has become hidden.popuphidingthe popuphiding event is executed when a <menupopup>, <panel> or <tooltip> is about to be hidden.popupshowingthe popupshowing event is executed when a <menupopup>, <panel> or <tooltip> is about to become visible.
... the default action of the event can be prevented to prevent the popup to appear.popupshownthe popupshown event is executed when a <menupopup>, <panel> or <tooltip> has become visible.radiostatechangethe radiostatechange event is executed when the state of a <radio> element has changed.valuechangethe valuechange event is executed when the value of an element, <progress> for example, has changed.
Adding Properties to XBL-defined Elements - Archive of obsolete content
properties can also be used to hold a value but may have code execute when an attempt is made to retrieve or modify the value.
... methods are functions which may be executed.
...onget attribute and onset attribute you can use the onget and onset attributes to have code execute when the property is retrieved or modified.
...when the following line of script is executed: banana.size = orange.size; the onget script is called for the size property of the orange.
Updating Commands - Archive of obsolete content
then, it checks to see whether the command is enabled, and then executes the command using the docommand method of the controller.
...the code above is generic enough that it can be a function that takes a command as an argument and executes that command.
...if you include the script 'chrome://global/content/globaloverlay.js' in a xul file, you can call the godocommand method which executes the command passed as the argument.
...a command updater will listen for these situations and code can be executed which enables and disables commands as necessary.
textbox - Archive of obsolete content
prior to gecko 1.9 (firefox 3), the script code would execute in the context of the anonymous html <input> element inside the textbox binding.
... from gecko 1.9 to gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9), the script code would actually execute twice, once in the context of the anonymous html <input> element and once in the context of the <textbox> element itself.
...prior to gecko 1.9 (firefox 3), the script code would execute in the context of the anonymous html <input> element inside the textbox binding.
... from gecko 1.9 to gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9), the script code would actually execute twice, once in the context of the anonymous html <input> element and once in the context of the <textbox> element itself.
NPN_PluginThreadAsyncCall - Archive of obsolete content
the "plug-in thread" is the thread hosting the plug-in, which may be either the browser's main thread or the plug-in process if the plug-in is being executed out-of-process.
... it is the application's responsibility to perform any synchronization between the thread calling npn_pluginthreadasynccall() and the thread on which the call is eventually executed.
... in particular, the user must ensure that the function pointer remains callable and the user data is not deallocated until the browser executes the call.
...the browser might not execute calls successfully registered with this api call during plug-in termination.
Loop - MDN Web Docs Glossary: Definitions of Web-related terms
examples for loop syntax: for (statement 1; statement 2; statement 3){ execute code block } statement 1 is executed once before the code block is run.
... statement 2 defines the condition needed to execute the code block.
... statement 3 is executed every time the code block is run.
... while loop syntax: while (condition){ execute code block } the code block will continue to loop as long as the condition is true.
Getting started with Svelte - Learn web development
less code means less kb to download, parse, execute, and keep hanging around in memory.
...pt> export let name; function togglename() { if (name === 'world') { name = 'svelte' } else { name = 'world' } } </script> <main> <h1>hello {name}!</h1> <button on:click={togglename}>toggle name</button> <p>visit the <a href="https://svelte.dev/tutorial">svelte tutorial</a> to learn how to build svelte apps.</p> </main> whenever the button is clicked, svelte executes the togglename() function, which in turn updates the value of the name variable.
...this is executable code that needs to be parsed, executed, and kept in memory.
... after installing git, to clone the repository you should execute: git clone https://github.com/opensas/mdn-svelte-tutorial.git then at the beginning of each article, you can just cd into the corresponding folder and start the app in dev mode to see what its current state should be, like this: cd 02-starting-our-todo-app npm install npm run dev if you want lo learn more about git and github, we've compiled a list of links to useful guides — see git and gi...
Android-specific test suites
local unit tests are the fastest to develop and execute, but they can only test java code; there's no connection to the gecko rendering engine.
...for example, to disable org.mozilla.gecko.permissions.testsuccessrunnableisexecutedifpermissionsaregranted, add @ignore as follows: ...
... @runwith(testrunner.class) public class testpermissions { @ignore @test public void testsuccessrunnableisexecutedifpermissionsaregranted() { ...
...it is a fast process that can be run on unexecuted code, and test cases are not needed for the process to be completed.
PerfMeasurement.jsm
instructions uint64 the number of instructions executed.
... branch_instructions uint64 the number of branch instructions executed.
... instructions 0x00000002 measure the number of instructions executed.
... branch_instructions 0x00000010 measure the number of branch instructions executed.
Hacking Tips
the backtrace contains in the following order, the stack depth, the interpreter frame pointer (see js/src/vm/stack.h, stackframe class) or (nil) if compiled with ionmonkey, the file and line number of the call location and under parentheses, the jsscript pointer and the jsbytecode pointer (pc) executed.
...then you can display the instructions around pc with x/20i $pc, and execute instruction by instruction with stepi.
... using callgrind (js shell) as spidermonkey just-in-time compiler are rewriting the executed program, valgrind should be informed from the command line by adding --smc-check=all-non-file.
... $ cgexec -g 'cpuset,cpu,memory:/benchmarks/negate-mask' yes > /dev/null & $ cgexec -g 'cpuset,cpu,memory:/benchmarks/mask' ./js --available-memory=512 ./run.js how to debug oomtest() failures the oomtest() function executes a piece of code many times, simulating an oom failure at each successive allocation it makes.
Introduction to the JavaScript shell
-e script runs the specified script, which is a literal string containing the code to execute.
...if object is specified, the code is executed in that object, treating it as a sandbox.
...when the bytecode at the offset specified by pc in the function function is about to be executed, the expression is evaluated.
...for example, if you want to display a message when line 6 of a function, dosomething() is executed, you can enter the following: trap(dosomething, line2pc(dosomething, 6), "print('line 6!\n')"); note: when a trap is set, the corresponding bytecode in the program is replaced with a trap bytecode until you use untrap() to remove the trap.
SpiderMonkey 1.8.5
no compartment may execute js code or call into jsapi on two os threads at the same time.
...ion js_consumejsontext (removed in future releases, replaced with js_parsejson) js_decompilescriptobject js_deepfreezeobject js_definefunctionbyid js_defineownproperty js_definepropertybyid js_deletepropertybyid js_deletepropertybyid2 js_doubleisint32 js_encodestringtobuffer js_entercrosscompartmentcall js_evaluatescriptforprincipalsversion js_evaluateucscriptforprincipalsversion js_executeregexp js_executeregexpnostatics js_executescriptversion js_forget_string_flatness js_fileescapedstring js_finishjsonparse (removed in future releases, replaced with js_parsejson) js_flatstringequalsascii js_flattenstring js_flushcaches js_freezeobject js_getcompartmentprivate js_getemptystring js_getflatstringchars js_getgcparameter js_getgcparameterforthread js_getglobalforscopech...
...enterlocalrootscope js_leavelocalrootscope js_leavelocalrootscopewithresult js_forgetlocalroot js_newgrowablestring deleted apis js_addnamedroot – use js_add*root js_addnamedrootrt – use js_add*root js_addroot – use js_add*root js_clearnewbornroots – no longer needed js_clearoperationcallback js_clearregexproots js_decompilescript js_destroyscript js_enterlocalrootscope js_executescriptpart js_forgetlocalroot js_getfunctionname js_getoperationlimit js_getscriptobject js_getstringbytes js_getstringchars js_isassigning js_leavelocalrootscope js_leavelocalrootscopewithresult js_newdouble js_newdoublevalue js_newscriptobject js_newstring js_poparguments js_pusharguments js_pushargumentsva js_removeroot js_removerootrt js_sealobject js_setbranchcallback js_...
...are: js_compilescript js_compilescriptforprincipals js_compilescriptforprincipalsversion js_compileucscript js_compileucscriptforprincipals js_compileucscriptforprincipalsversion js_compilefile js_compilefilehandle js_compilefilehandleforprincipals js_compilefilehandleforprincipalsversion js_compilefunction js_compilefunctionforprincipals js_compileucfunctionforprincipalsversion js_executescript js_executescriptversion native functions jsnatives now use the "fast native" calling convention; see bug 581263.
Shell global objects
at may have these properties: isrunonce use the isrunonce compiler option (default: false) noscriptrval use the no-script-rval compiler option (default: false) filename filename for error messages and debug info linenumber starting line number for error messages and debug info columnnumber starting column number for error messages and debug info global global in which to execute the code newcontext if true, create and use a new cx (default: false) catchtermination if true, catch termination (failure without an exception value, as for slow scripts or out-of-memory) and return 'terminated' element if present with value v, convert v to an object o and mark the source as being attached to the dom element o.
... loadbytecode if true, and if the source is a cacheentryobject, the bytecode would be loaded and decoded from the cache entry instead of being parsed, then it would be executed as usual.
... nestedshell(shellargs...) execute the given code in a new js shell process, passing this nested shell the arguments passed to nestedshell.
... cloneandexecutescript(source, global) compile source in the current compartment, clone it into global's compartment, and run it there.
mozIJSSubScriptLoader
method overview jsval loadsubscript(in string url, in object targetobj optional, in string charset optional); jsval loadsubscriptwithoptions(in string url, in object options); methods loadsubscript() synchronously loads and executes the script from the specified url.
... the loaded script is executed with the principal associated with the target object.
... targetobj the object to use as the scope object for the script being executed.
... options an object that may include any of these parameters: property type description target object the object to use as the scope object for the script being executed.
mozIStorageStatementWrapper
you can then wrap that statement with a wrapper, which implements nsixpcscriptable and provides scriptable helpers letting you execute the statement as a function, access bind variables by name as properties, etc.
... last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) inherits from: nsisupports method overview void initialize(in mozistoragestatement astatement); void reset(); boolean step(); void execute(); attributes attribute type description statement mozistoragestatement the statement that is wrapped.
...execute() this method executes the wrapped statement.
... void execute(); parameters none.
nsITransactionListener
atransaction the transaction that was executed.
... didmerge() called after a nsitransactionmanager tries to merge a transaction, that was just executed, with the transaction at the top of the undo stack.
...atransaction the transaction being executed.
... return value willmerge() called before a nsitransactionmanager tries to merge a transaction, that was just executed, with the transaction at the top of the undo stack.
Browser Console - Firefox Developer Tools
similarly, you can execute javascript expressions using the browser console.
... but while the web console executes code in the page window scope, the browser console executes them in the scope of the browser's chrome window.
... nb: the browser console command line (to execute javascript expressions) is disabled by default.
... but while the web console executes code in the scope of the content window it's attached to, the browser console executes code in the scope of the chrome window of the browser.
Waterfall - Firefox Developer Tools
the following operations are recorded: name and description color detailed information dom event javascript code that's executed in response to a dom event.
... javascript functions executed in the page are labeled with the reason the function was called: script tag setinterval settimeout requestanimationframe promise callback promise init worker javascript uri event handler stack call stack, with links to functions.
...for a rate of 60 frames per second, that gives the browser 16.7 milliseconds to execute the complete flow.
... blocking javascript by default, a site's javascript is executed in the same thread that the browser uses for layout updates, repaints, dom events, and so on.
Background Tasks API - Web APIs
the cooperative scheduling of background tasks api (also referred to as the background tasks api or simply the requestidlecallback() api) provides the ability to queue tasks to be executed automatically by the user agent when it determines that there is free time to do so.
...there's no guarantee that every pass through the event loop (or even every screen update cycle) will include any idle callbacks being executed; if the event loop uses all available time, you're out of luck (again, unless you've used a timeout).
... for each task in the queue that we have time to execute, we do the following: we remove the task object from the queue.
... we increment currenttasknumber to track how many tasks we've executed.
Basic animations - Web APIs
that means we need a way to execute our drawing functions over a period of time.
... settimeout(function, delay) executes the function specified by function in delay milliseconds.
... if you don't want any user interaction you can use the setinterval() function which repeatedly executes the supplied code.
...by setting eventlisteners, we catch any user interaction and execute our animation functions.
Basic concepts - Web APIs
thus, you cannot execute commands or open cursors outside of a transaction.
...an origin is the domain, application layer protocol, and port of a url of the document where the script is being executed.
...the scopes of read-only transactions can overlap and execute at the same time.
...you can still start several transactions with the same scope at the same time, but they just queue up and execute one after another.
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.
... sync try { const value = myfunction(); console.log(value); } catch(err) { console.log(err); } async myfunction().then((value) => { console.log(value); }).catch((err) => { console.log(err); }); in the first example, we have to wait for myfunction() to run and return value before any more of the code can execute.
...t: let body = document.queryselector('body'); let myimage = new image(); imgload('mylittlevader.jpg').then((response) => { var imageurl = window.url.createobjecturl(response); myimage.src = imageurl; body.appendchild(myimage); }, (error) => { console.log(error); }); on to the end of the function call, we chain the promise then() method, which contains two functions — the first one is executed when the promise successfully resolves, and the second is called when the promise is rejected.
... when the promise resolves successfully, the code inside it executes.
Redirections in HTTP - HTTP
javascript redirections redirections in javascript are performed by setting a url string to the window.location property, loading the new page: window.location = "https://example.com/"; like html redirections, this can't work on all resources, and obviously, this will only work on clients that execute javascript.
... http redirects always execute first — they exist when there is not even a transmitted page.
... html redirects (<meta>) execute if there weren't any http redirects.
... javascript redirects execute last, and only if javascript is enabled.
Closures - JavaScript
what's different (and interesting) is that the displayname() inner function is returned from the outer function before being executed.
...the code is attached as a callback (a single function that is executed in response to the event).
... the shared lexical environment is created in the body of an anonymous function, which is executed as soon as it has been defined (also known as an iife).
...the value of item.help is determined when the onfocus callbacks are executed.
Functions - JavaScript
function map(f, a) { let result = []; // create a new array let i; // declare variable for (i = 0; i != a.length; i++) result[i] = f(a[i]); return result; } in the following code, the function receives a function defined by a function expression and executes it for every element of the array received as a second argument.
... calling functions defining a function does not execute it.
...the function executes its statements and returns the value 25.
...both execute the same code multiple times, and both require a condition (to avoid an infinite loop, or rather, infinite recursion in this case).
Grammar and types - JavaScript
this is called hashbang comment syntax, and is a special comment used to specify the path to a particular javascript engine that should execute the script.
...for example, the following code executes the function myfunction because the myarray element is undefined: var myarray = []; if (!myarray[0]) myfunction(); the undefined value converts to nan when used in numeric context.
...for example: // this will cause an error function f() {}; const f = 5; // this will cause an error too function f() { const g = 5; var g; //statements } however, the properties of objects assigned to constants are not protected, so the following statement is executed without problems.
... const my_object = {'key': 'value'}; my_object.key = 'othervalue'; also, the contents of an array are not protected, so the following statement is executed without problems.
Regular expressions - JavaScript
methods that use regular expressions method description exec() executes a search for a match in a string.
... replace() executes a search for a match in a string, and replaces the matched substring with a replacement substring.
... replaceall() executes a search for all matches in a string, and replaces the matched substrings with a replacement substring.
...updated at the time that the regular expression is created, not executed.
Array.prototype.reduce() - JavaScript
the reduce() method executes a reducer function (that you provide) on each element of the array, resulting in single output value.
... syntax arr.reduce(callback( accumulator, currentvalue, [, index[, array]] )[, initialvalue]) parameters callback a function to execute on each element in the array (except for the first, if no initialvalue is supplied).
... description the reduce() method executes the callback once for each assigned value present in the array, taking four arguments: accumulator currentvalue currentindex array the first time the callback is called, accumulator and currentvalue can be one of two values.
... note: if initialvalue is not provided, reduce() will execute the callback function starting at index 1, skipping the first index.
Array.prototype.forEach() - JavaScript
the foreach() method executes a provided function once for each array element.
... syntax arr.foreach(callback(currentvalue [, index [, array]])[, thisarg]) parameters callback function to execute on each element.
...(see this example, below.) foreach() executes the callback function once for each array element; unlike map() or reduce() it always returns the value undefined and is not chainable.
... the typical use case is to execute side effects at the end of a chain.
Object - JavaScript
object.prototype.__nosuchmethod__ allows a function to be defined that will be executed when an undefined object member is called as a method.
... instance methods object.prototype.__definegetter__() associates a function with a property that, when accessed, executes that function and returns its return value.
... object.prototype.__definesetter__() associates a function with a property that, when set, executes that function which modifies the property.
...for example, this (untested) code will pre-conditionally execute custom logic before the built-in logic or someone else's extension is executed.
TypedArray.prototype.forEach() - JavaScript
the foreach() method executes a provided function once per array element.
... description the foreach() method executes the provided callback once for each element present in the typed array in ascending order.
...however, it is executed for elements that are present and have the value undefined.
... foreach() executes the callback function once for each typed array element; unlike every() and some() it, always returns the value undefined.
do...while - JavaScript
the do...while statement creates a loop that executes a specified statement until the test condition evaluates to false.
... syntax do statement while (condition); statement a statement that is executed at least once and is re-executed each time the condition evaluates to true.
... to execute multiple statements within the loop, use a block statement ({ ...
...if condition evaluates to true, the statement is re-executed.
var - JavaScript
description var declarations, wherever they occur, are processed before any code is executed.
... 'use strict'; function foo() { var x = 1; function bar() { var y = 2; console.log(x); // 1 (function `bar` closes over `x`) console.log(y); // 2 (`y` is in scope) } bar(); console.log(x); // 1 (`x` is in scope) console.log(y); // referenceerror in strict mode, `y` is scoped to `bar` } foo(); variables declared using var are created before any code is executed in a process known as hoisting.
... var hoisting because variable declarations (and declarations in general) are processed before any code is executed, declaring a variable anywhere in the code is equivalent to declaring it at the top.
... console.log(bar); // undefined bar = 111; console.log(bar); // 111 } examples declaring and initializing two variables var a = 0, b = 0; assigning two variables with single string value var a = 'a'; var b = a; // ...is equivalent to: var a, b = a = 'a'; be mindful of the order: var x = y, y = 'a'; console.log(x + y); // undefineda here, x and y are declared before any code is executed, but the assignments occur later.
while - JavaScript
the while statement creates a loop that executes a specified statement as long as the test condition evaluates to true.
...if this condition evaluates to true, statement is executed.
... statement an optional statement that is executed as long as the condition evaluates to true.
... to execute multiple statements within the loop, use a block statement ({ ...
Populating the page: how browsers work - Web Performance
javascript is interpreted, compiled, parsed and executed.
...some browser engines take the abstract syntax tree and pass it into an interpreter, outputting bytecode which is executed on the main thread.
...if the load includes javascript, that was correctly deferred, and only executed after the onload event fires, the main thread might be busy, and not available for scrolling, touch, and other interactions.
... in this case the user would see the page super quickly, but wouldn't be able to scroll without jank until the script was downloaded, parsed and executed.
Types of attacks - Web security
this code is executed by the victims and lets the attackers bypass access controls and impersonate users.
... the malicious content often includes javascript, but sometimes html, flash, or any other code the browser can execute.
...the browser executes the code because it assumes the response is from a "trusted" server which the user has already interacted with.
... dom-based xss attacks the payload is executed as a result of modifying the dom environment (in the victim’s browser) used by the original client-side script.
page-mod - Archive of obsolete content
sometimes, though, we don't care about the url: we just want to execute a script on demand in the context of a particular tab.
...the scripts are executed immediately.
...once created a page-mod will execute the supplied content scripts, and load any supplied stylesheets, in the context of any documents matching the pattern specified by the include property.
panel - Archive of obsolete content
its content is specified as html and you can execute scripts in it, so the appearance and behavior of the panel is limited only by what you can do using html, css, and javascript.
...it should contain a single key named script whose value is a boolean that indicates whether or not to execute script in the content.
...it contains a single key named script whose value is a boolean that indicates whether or not to execute script in the content.
widget - Archive of obsolete content
it should contain a single key named script whose value is a boolean that indicates whether or not to execute script in the content.
...it contains a single key named script whose value is a boolean that indicates whether or not to execute script in the content.
...it contains a single key named script whose value is a boolean that indicates whether or not to execute script in the content.
loader/sandbox - Archive of obsolete content
experimental create javascript sandboxes and execute scripts in them.
... evaluate code module provides evaluate function that lets you execute code in the given sandbox: evaluate(scope, 'var a = 5;'); evaluate(scope, 'a + 2;'); //=> 7 more details about evaluated script may be passed via optional arguments that may improve exception reporting: // evaluate code as if it was loaded from 'http://foo.com/bar.js' and // start from 2nd line.
... code : string the code to execute.
util/deprecate - Archive of obsolete content
globals functions deprecatefunction(fun, msg) dump to the console the error message given in the second argument, prefixed with "deprecated:", and print the stacktrace; then execute the function passed as first argument and returns its value.
... it does not raise an exception, but just displays the error message and continues to execute the function.
... parameters fun : function the function to execute after the error message msg : string the error message to display returns * : the returned value from fun deprecateusage(msg) dump to the console the error message given, prefixed with "deprecated:", and print the stacktrace.
Creating annotations - Archive of obsolete content
save the file and execute cfx run again.
... we will supply the panel's content as an html file, and will also supply a content script to execute in the panel's context.
...ta.url('jquery-1.4.2.min.js'), data.url('selector.js')], onattach: function(worker) { worker.postmessage(annotatorison); selectors.push(worker); worker.port.on('show', function(data) { annotationeditor.annotationanchor = data; annotationeditor.show(); }); worker.on('detach', function () { detachworker(this, selectors); }); } }); execute cfx run again, activate the annotator, move your mouse over an element and click the element when it is highlighted.
JavaScript Debugger Service - Archive of obsolete content
in firefox versions prior to gecko 33 (firefox 33 / thunderbird 33 / seamonkey 2.30), the javascript debugger service (or simply jsd) used to be an xpcom component that allows the tracking of javascript while it was being executed in the browser.
... jsd.scripthook = { onscriptcreated: function(script) { // your function here }, onscriptdestroyed: function(script) { // your function here } }; jsd.errorhook = { onerror: function(message, filename, lineno, colno, flags, errnum, exc) { // your function here } }; // triggered when jsd.errorhook[onerror] returns false jsd.debughook = { onexecute: function(frame, type, rv) { // your function here } }; jsd.enumeratescripts({ // the enumeratescript method will be called once for every script jsd knows about enumeratescript: function(script) { // your function here } }); a simple stack trace here, we will show how to implement a simple javascript stack trace using the jsd.
...ught-exception"; if (flags & jsdierrorhook.report_strict) messagetype += "-strict"; dump(messagetype + "\n"); return false; // trigger debughook // return true; if you do not wish to trigger debughook } }; // note that debughook 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.jsdiexecutionhook.return_continue; } }; filters jsd also allows the use of filters to track which scripts should trigger the hooks.
Creating an Installer - Archive of obsolete content
the file install.js is extracted from the install archive and executed.
... when this section of script is executed, the file calendar.xpi will be installed.
... the installer xpi file is required to contain one file called install.js which is a javascript file which is executed during the installation.
Monitoring plugins - Archive of obsolete content
summary a new component of the plugin system is now available to measure how long it takes plugins (e.g., adobe flash) to execute their calls.
...because the component measures the wall clock time it takes for blocking plugin calls to execute, the value includes both cpu time, the wait time between allocation of cpu time to the process as well as any disk i/o time.
...n pluginobserver() { this.registered = false; this.register(); //takes care of registering this class with observer services as an observer for plugin runtime notifications } pluginwatcherobserver.prototype = { observe: function(subject, topic, data) { if (topic == "experimental-notify-plugin-call") //in case your class is registered to listen to other topics //this gets executed each time a runtime notification arrives // --your code goes here-- } }, //takes care of registering the observer services for the "experimental-notify-plugin-call" topic register: function() { if (this.registered == false) { //this check prevents double registration -- something you want to avoid!!
Browser Detection and Cross Browser Support - Archive of obsolete content
web authors were no longer limited to detecting browsers on their web servers, but could now execute scripts client side (in the browser itself) which could be used to distinguish browsers.
... --> <ul> <li><a href="choice1.html">choice1</a></li> <li><a href="choice2.html">choice2</a></li> </ul> </noscript> </body> </html> using script language to choose the browser where it will be executed the choice of scripting language is determined by the language attribute of the script tag.
...since other browsers do not support the language attribute vbscript or jscript you can use these languages when you wish certain scripts to only be executed by internet explorer 4 and above.
for each...in - Archive of obsolete content
for each distinct property, a specified statement is executed.
... statement a statement to execute for each property.
... to execute multiple statements within the loop, use a block statement ({ ...
Anatomy of a video game - Game development
modern javascript — as described in the next sections — thankfully makes it easy to develop an efficient, execute-once-per-frame main loop.
...that callback function will be executed at a suitable time before the next repaint.
...because this is common, window.requestanimationframe() always provides a domhighrestimestamp to callbacks as an argument when they are executed.
Implementing game control mechanisms - Game development
the first one is needed for preloading required assets, create() is executed once the state had started, and update() is executed on every frame.
...} it will be created once at the start of the game, and will execute this.clickenclave() action assigned to it when clicked, but you can also use the mouse's pointer value in the update() function to make an action: update: function() { // ...
...} this will be executed whenever the mouse button is pressed, and it will be checked against the input's isdown boolean variable on every frame of the game.
Control flow - MDN Web Docs Glossary: Definitions of Web-related terms
the control flow is the order in which the computer executes statements in a script.
...to do this, the script uses a conditional structure or if...else, so that different code executes depending on whether the form is complete or not: if (field==empty) { promptuser(); } else { submitform(); } a typical script in javascript or php (and the like) includes many control structures, including conditionals, loops and functions.
... parts of a script may also be set to execute when events occur.
Making asynchronous programming easier with async and await - Learn web development
in the meantime, other code that may be waiting for a chance to execute gets to do so.
...the await keyword causes the javascript runtime to pause your code on this line, allowing other code to execute in the meantime, until the async function call has returned its result.
... once that's complete, your code continues to execute starting on the next line.
Choosing the right approach - Learn web development
async callbacks lose full control of how the function will be executed when passed to a third-party library.
... with setinterval(), the interval we choose includes the time taken to execute the code we want to run in.
... 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.
Componentizing our Svelte app - Learn web development
the child component will execute the handler, passing the needed information as a parameter, and the handler will modify the parent's state.
...iv> <div class="btn-group"> <button type="button" class="btn" on:click={onedit}> edit<span class="visually-hidden"> {todo.name}</span> </button> <button type="button" class="btn btn__danger" on:click={onremove}> delete<span class="visually-hidden"> {todo.name}</span> </button> </div> {/if} </div> it is worth noting that: when the user presses the edit button we execute onedit(), which just sets the editing variable to true.
... when the user clicks on the checkbox we call the ontoggle() function, which executes update(), passing an object with the new completed value as a parameter.
Dynamic behavior in Svelte: working with variables and props - Learn web development
for example, if you specify on:click={removetodo(todo)}, it will execute removetodo(todo) and the result will be passed as a handler, which is not what we had in mind.
...in the following code they are assigned a value when the component is instantiated and the script is executed, but after that, their values are not modified: let totaltodos = todos.length let completedtodos = todos.filter(todo => todo.completed).length we could recalculate them after toggling and removing todos, but there's an easier way to do it.
...that means that the addtodo() function is executed, the element is added to the todos array, but svelte won't detect that the push method modified the array, so it won't refresh the tasks <ul>.
Midas
examples this example shows the basic structure described in the notes section : <html> <head> <title>simple edit box</title> </head> <body> <iframe id="midasform" src="about:blank" onload="this.contentdocument.designmode='on';" ></iframe> </body> </html> methods document.execcommand executes the given command.
... document.querycommandenabled determines whether the given command can be executed on the document in its current state.
... document.querycommandstate determines whether the given command has been executed on the current selection.
PR_Open
name value description pr_irwxu 0700 read, write, execute/search by owner.
... pr_ixusr 0100 execute/search permission, owner.
... pr_irwxg 0070 read, write, execute/search by group pr_irgrp 0040 read permission, group pr_iwgrp 0020 write permission, group pr_ixgrp 0010 execute/search permission, group pr_irwxo 0007 read, write, execute/search by others pr_iroth 0004 read permission, others pr_iwoth 0002 write permission, others pr_ixoth 0001 execute/search permission, others returns the function returns one of the following values: if the file is successfully opened, a pointer to a dynamically allocated prfiledesc for the newly opened file.
NSS tools : modutil
"./pk11inst.dir/setup.sh" executed successfully installed module "example pkcs #11 module" into module database installation completed successfully adding module spec each module has information stored in the security database about its configuration and parameters.
... executable specifies that the file is to be executed during the course of the installation.
... user read: 0400 user write: 0200 user execute: 0100 group read: 0040 group write: 0020 group execute: 0010 other read: 0004 other write: 0002 other execute: 0001 some platforms may not understand these permissions.
NSS Tools modutil
executable specifies that the file is to be executed during the course of the installation.
...this string is a bitwise or of the following constants: user read: 0400 user write: 0200 user execute: 0100 group read: 0040 group write: 0020 group execute: 0010 other read: 0004 other write: 0002 other execute: 0001 some platforms may not understand these permissions.
..."./pk11inst.dir/setup.exe" executed successfully installed module "cryptorific module" into module database installation completed successfully c:\modutil> changing the password on a token this example changes the password for a token on an existing module.
NSS tools : modutil
MozillaProjectsNSStoolsmodutil
"./pk11inst.dir/setup.sh" executed successfully installed module "example pkcs #11 module" into module database installation completed successfully adding module spec each module has information stored in the security database about its configuration and parameters.
... executable specifies that the file is to be executed during the course of the installation.
... user read: 0400 user write: 0200 user execute: 0100 group read: 0040 group write: 0020 group execute: 0010 other read: 0004 other write: 0002 other execute: 0001 some platforms may not understand these permissions.
Rhino Examples
controlling the javascript engine the runscript class runscript.java is a simple program that executes a script from the command line.
... the control class control.java is a program that executes a simple script and then manipulates the result.
... javascript shell shell.java is a program that executes javascript programs; it is a simplified version of the shell in the tools package.
SpiderMonkey 1.8.7
no compartment may execute js code or call into jsapi on two os threads at the same time.
...ion js_consumejsontext (removed in future releases, replaced with js_parsejson) js_decompilescriptobject js_deepfreezeobject js_definefunctionbyid js_defineownproperty js_definepropertybyid js_deletepropertybyid js_deletepropertybyid2 js_doubleisint32 js_encodestringtobuffer js_entercrosscompartmentcall js_evaluatescriptforprincipalsversion js_evaluateucscriptforprincipalsversion js_executeregexp js_executeregexpnostatics js_executescriptversion js_forget_string_flatness js_fileescapedstring js_finishjsonparse (removed in future releases, replaced with js_parsejson) js_flatstringequalsascii js_flattenstring js_flushcaches js_freezeobject js_getcompartmentprivate js_getemptystring js_getflatstringchars js_getgcparameter js_getgcparameterforthread js_getglobalforscopech...
...are: js_compilescript js_compilescriptforprincipals js_compilescriptforprincipalsversion js_compileucscript js_compileucscriptforprincipals js_compileucscriptforprincipalsversion js_compilefile js_compilefilehandle js_compilefilehandleforprincipals js_compilefilehandleforprincipalsversion js_compilefunction js_compilefunctionforprincipals js_compileucfunctionforprincipalsversion js_executescript js_executescriptversion native functions jsnatives now use the "fast native" calling convention; see bug 581263.
WebReplayRoadmap
in a non-recording tab this will update the console whenever the log point's location executes in the future.
... code path highlighting (not yet implemented) when paused in a frame, the code path taken through the frame (the lines/expressions executed) could be highlighted somehow, which would make it easier to see what happened in the frame.
... this restriction is in place to ensure that js executes the same way when replaying as it did while recording.
Redis Tips
they are executed sequentially as a single atomic operation.
...et("foo", 42) .set("bar", "ice cream") .set("baz", 6.28) .get("foo") .get("bar") .get("baz") .exec(function(err, resultlist) { console.log(json.stringify(resultlist, null, 2)); r.end(); // terminate the redis connection; node can quit }); when run, this prints: [ "ok", "ok", "ok", "42", "ice cream", "6.28" ] the result list includes one value per each command executed.
... note that if one of your commands crashes, the others still all execute!
Places Expiration
on shutdown most of the times the adaptive algorithm will ensure the database is clean before shutdown, so the only task executed on shutdown will be removal of session data (like session annotations).
... in some cases, like when a clear history is executed just before shutdown, a larger step is executed instead.
... on maintenance when places maintenance runs (about once a week, on daily idle), an orphans expiration step is executed, this ensures database cleanup.
nsIAppShell
dispatchnativeevent() obsolete since gecko 1.9 (firefox 3) after event dispatch execute app specific code.
... getnativeevent() obsolete since gecko 1.9 (firefox 3) after event dispatch execute app specific code.
...if called multiple times per task/event, all the runnables will be executed, in the order in which runinstablestate was called.
nsIBrowserSearchService
this is not an issue if your code is executed in reaction to a user interaction, as initialization is complete by then, but this is an issue if your code is executed during startup.
... if you need to write code that is executed during startup and makes use of nsibrowsersearchservice, you should make sure that this code is executed from the callback to init().
... if your code requires nsibrowsersearchservice and is executed during startup, you should make sure that this code is executed from the callback to init().
nsIFile
isexecutable() this method tests whether or not this nsifile corresponds to a file that may be executed.
... boolean isexecutable(); note: use nsiprocess to then execute/run this file.
... return value true if the nsifile may be executed by the user.
nsITransactionManager
a value of zero means the transaction manager will execute each transaction, then immediately release all references it has to the transaction without pushing it on the undo stack.
... beginbatch() turns on the transaction manager's batch mode, forcing all transactions executed by the transaction manager's dotransaction() method to be aggregated together until endbatch() is called.
... this mode allows an application to execute and group together several independent transactions so they can be undone with a single call to undotransaction().
Set a logpoint - Firefox Developer Tools
the result is logged in the console panel every time the line with the logpoint executes.
... when you want to know that a specific line in your code has executed, but you don’t want to break code execution, set a logpoint.
... if you need to execute additional logic related to the source code and you can’t change the source code itself, you can use a logpoint.
Debugger.Object - Firefox Developer Tools
executeinglobal(code, [options]) if the referent is a global object, evaluatecode in that global environment, and return a completion value describing how it completed.code is a string.
... executeinglobalwithbindings(code,bindings, [options]) like executeinglobal, but evaluatecode using the referent as the variable object, but with a lexical environment extended with bindings from the objectbindings.
... note that, like executeinglobal, any declarations it contains affect the referent global object, even ascode is evaluated in an environment extended according tobindings.
Console messages - Firefox Developer Tools
number of occurrences if a line that generates a warning or error is executed more than once, it is only logged once and this counter appears to indicate how many times it was encountered.
...by logging reflow events the web console can give you insight into when reflow events are being triggered, how long they take to execute and, if the reflows are synchronous reflows triggered from javascript, which code triggered them.
... each message is labeled "reflow" and shows the time taken to execute the reflow.
Using images - Web APIs
to do this, you can use the convenient image() constructor: var img = new image(); // create new img element img.src = 'myimage.png'; // set source path when this script gets executed, the image starts loading.
...so you need to be sure to use the load event so you don't try this before the image has loaded: var img = new image(); // create new img element img.addeventlistener('load', function() { // execute drawimage statements here }, false); img.src = 'myimage.png'; // set source path if you're only using one external image this can be a good approach, but once you need to track more than one we need to resort to something more clever.
...in this example, we're only using one image, so i use the image object's load event handler to execute the drawing statements.
EventTarget.addEventListener() - Web APIs
break; } } } const myobject = new someclass(); myobject.register(); getting data into and out of an event listener it may seem that event listeners are like islands, and that it is extremely difficult to pass them any data, much less to get any data back from them after they execute.
...simply because by the time the event listener would execute, the scope in which it was defined would have already finished executing.
...ence they too can have properties, and will be retained in memory even after they finish executing if assigned to a variable that persists in memory.) because object properties can be used to store data in memory as long as a variable referencing the object exists in memory, you can actually use them to get data into an event listener, and any changes to the data back out after an event handler executes.
Using the Geolocation API - Web APIs
when the position is determined, the defined callback function is executed.
... you can optionally provide a second callback function to be executed if an error occurs.
... navigator.geolocation.getcurrentposition((position) => { dosomething(position.coords.latitude, position.coords.longitude); }); the above example will cause the dosomething() function to execute when the location is obtained.
Working with the History API - Web APIs
example of pushstate() method suppose http://mozilla.org/foo.html executes the following javascript: let stateobj = { foo: "bar", } history.pushstate(stateobj, "page 2", "bar.html") this will cause the url bar to display http://mozilla.org/bar.html, but won't cause the browser to load bar.html or even check that bar.html exists.
... example of replacestate() method suppose http://mozilla.org/foo.html executes the following javascript: let stateobj = { foo: "bar" } history.pushstate(stateobj, "page 2", "bar.html") the explanation of these two lines above can be found at the above section example of pushstate() method section.
... next, suppose http://mozilla.org/bar.html executes the following javascript: history.replacestate(stateobj, "page 3", "bar2.html") this will cause the url bar to display http://mozilla.org/bar2.html, but won't cause the browser to load bar2.html or even check that bar2.html exists.
IDBOpenDBRequest: blocked event - Web APIs
the blocked handler is executed when an open connection to a database is blocking a versionchange transaction on the same database.
...}); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = (event) => { // let's try to open the same database with a higher revision version const req2 = indexeddb.open('todolist', 5); // in this case the onblocked handler will be executed req2.addeventlistener('blocked', () => { console.log('request was blocked'); }); }; using the onblocked property: // open the database const dbopenrequest = window.indexeddb.open('todolist', 4); dbopenrequest.onupgradeneeded = (event) => { const db = event.target.result; db.onerror = () => { console.log('error creating database'); }; // create an objectstore for this da...
...}); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = (event) => { // let's try to open the same database with a higher revision version const req2 = indexeddb.open('todolist', 5); // in this case the onblocked handler will be executed req2.onblocked = () => { console.log('request was blocked'); }; }; ...
Signaling and video calling - Web APIs
note: the important thing to note is this: the only thing your code is responsible for during ice negotiation is accepting outgoing candidates from the ice layer and sending them across the signaling connection to the other peer when your onicecandidate handler is executed, and receiving ice candidate messages from the signaling server (when the "new-ice-candidate" message is received) and delivering them to your ice layer by calling rtcpeerconnection.addicecandidate().
...when this succeeds, fulfilling the returned promise, our then handler is executed.
... hanging up when the user clicks the "hang up" button to end the call, the hangupcall() function is called: function hangupcall() { closevideocall(); sendtoserver({ name: myusername, target: targetusername, type: "hang-up" }); } hangupcall() executes closevideocall() to shut down and reset the connection and release resources.
Window - Web APIs
WebAPIWindow
window.setimmediate() executes a function after the browser has finished other heavy tasks window.setresizable() toggles a user's ability to resize a window.
... windoworworkerglobalscope.setinterval() schedules a function to execute every time a given number of milliseconds elapses.
... windoworworkerglobalscope.settimeout() schedules a function to execute in a given amount of time.
WindowOrWorkerGlobalScope.queueMicrotask() - Web APIs
the queuemicrotask() method, which is exposed on the window or worker interface, queues a microtask to be executed at a safe time prior to control returning to the browser's event loop.
... syntax scope.queuemicrotask(function); parameters function a function to be executed when the browser engine determines it is safe to call your code.
... enqueued microtasks are executed after all pending tasks have completed but before yielding control to the browser's event loop.
WindowOrWorkerGlobalScope - Web APIs
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.
... windoworworkerglobalscope.setinterval() schedules a function to execute every time a given number of milliseconds elapses.
... windoworworkerglobalscope.settimeout() schedules a function to execute in a given amount of time.
Event reference
svg events svgabort svgerror svgload svgresize svgscroll svgunload svgzoom database events abort blocked complete error success upgradeneeded versionchange script events afterscriptexecute beforescriptexecute menu events dommenuitemactive dommenuiteminactive window events close popup events popuphidden popuphiding popupshowing popupshown tab events visibilitychange battery events chargingchange chargingtimechange dischargingtimechange levelchange call events alerting busy callschanged cfstatechange connecting dialing disconnected disconnecting error held, holding inc...
... afterscriptexecute event mozilla specific a script has been executed.
... beforescriptexecute event mozilla specific a script is about to be executed.
HTML attribute reference - HTML: Hypertext Markup Language
async <script> executes the script asynchronously.
... code <applet> specifies the url of the applet's class file to be loaded and executed.
... defer <script> indicates that the script should be executed after the page has been parsed.
Content Security Policy (CSP) - HTTP
WebHTTPCSP
malicious scripts are executed by the victim's browser because the browser trusts the source of the content, even when it's not coming from where it seems to be coming from.
...a csp compatible browser will then only execute scripts loaded in source files received from those allowlisted domains, ignoring all other script (including inline scripts and event-handling html attributes).
... as an ultimate form of protection, sites that want to never allow scripts to be executed can opt to globally disallow script execution.
A re-introduction to JavaScript (JS tutorial) - JavaScript
the first is good for basic looping; the second for loops where you wish to ensure that the body of the loop is executed at least once: while (true) { // an infinite loop!
... for (var i = 0; i < 5; i++) { // will execute 5 times } javascript also contains two other prominent for loops: for...of for (let value of array) { // do something with value } and for...in: for (let property in object) { // do something with object property } the && and || operators use short-circuit logic, which means whether they will execute their second operand is dependent on the first.
...whenever javascript executes a function, a 'scope' object is created to hold the local variables created within that function.
Introduction - JavaScript
single-line input in the web console the web console shows you information about the currently loaded web page, and also includes a javascript interpreter that you can use to execute javascript expressions in the current page.
...of simplicity, it can be imagined that every time something is entered into the console, it is actually surrounded by console.log around eval, like so: function greetme(yourname) { alert("hello " + yourname) } console.log(eval('3 + 5')) multi-line input in the web console the single-line input mode of the web console is great for quick testing of javascript expressions, but although you can execute multiple lines, it's not very convenient for that.
... 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).
eval() - JavaScript
eval() is a dangerous function, which executes the code it's passed with the privileges of the caller.
...consider the following example where the property of the object to be accessed is not known until the code is executed.
...when the second statement is executed, eval() will cause these statements to be performed, and it will also evaluate the set of statements and return the value that is assigned to z.
empty - JavaScript
syntax ; description the empty statement is a semicolon (;) indicating that no statement will be executed, even if javascript syntax requires one.
... killtheuniverse() // so this always gets executed!!!
... if three is true, nothing will happen, four does not matter, and also the launchrocket() function in the else case will not be executed.
Making PWAs work offline with Service workers - Progressive web apps (PWAs)
security because they are so powerful, service workers can only be executed in secure contexts (meaning https).
...its contents reside in the sw.js file, and can be executed after the registration is successful.
... the service worker does not install until the code inside waituntil is executed.
Two Types of Scripts - Archive of obsolete content
on the web, javascript executes in the context of a web page, and has access to that page's dom content.
... this enables you to call functions like: window.alert("hello there"); in an add-on's main scripts you can't do that, because the add-on code does not execute in the context of a page, and the dom is therefore not available.
context-menu - Archive of obsolete content
to be "p" - for example, it won't be "p" if the user context-clicked a link inside a paragraph: var cm = require("sdk/context-menu"); cm.item({ label: "a paragraph", context: cm.selectorcontext("p"), contentscript: 'self.on("context", function (node) {' + ' console.log(node.nodename);' + ' return true;' + '});' }); the content script is executed for every page that a context menu is shown for.
... it will be executed the first time it is needed (i.e.
page-worker - Archive of obsolete content
page a page object loads the page specified by its contenturl option and executes any content scripts that have been supplied to it in the contentscript and contentscriptfile options.
...it contains a single key named script whose value is a boolean that indicates whether or not to execute script in the content.
request - Archive of obsolete content
optionally the user may specify a collection of headers and content to send alongside the request and a callback which will be executed once the request completes.
... once a request object has been created a get request can be executed by calling its get() method, a post request by calling its post() method, and so on.
console/traceback - Archive of obsolete content
lineno the line number is being executed at the stack frame.
... funcname the name of the function being executed at the stack frame, or null if the function is anonymous or the stack frame is being executed in a top-level script or module.
content/symbiont - Archive of obsolete content
allow object permissions for the content, with the following keys: script boolean whether or not to execute script in the content.
... allow permissions for the content, with a single boolean key called script which defaults to true and indicates whether or not to execute scripts in the content.
jpm - Archive of obsolete content
add the following line to the end of the file $home/.profile to add it to your path permanently (as the file .profile is executed every time a new terminal is opened): export path="$home/node_modules/.bin/:$path" installing jpm from git alternatively, you can also get the latest version of jpm using git: git clone https://github.com/mozilla-jetpack/jpm.git cd jpm npm install npm link after installing jpm after installation, at the command prompt, type: jpm you should see a screen summarizing the available jpm comm...
... using profiles by default, jpm run uses a new profile each time it is executed.
Storing annotations - Archive of obsolete content
data.url('widget/pencil-on.png') : data.url('widget/pencil-off.png'); }); widget.port.on('right-click', function() { console.log('show annotation list'); annotationlist.show(); }); this time execute cfx xpi to build the xpi for the add-on, and install it in firefox.
... try it: execute cfx run and open a new private window: you should no longer see the annotator's widget.
Getting Started (jpm) - Archive of obsolete content
loaded: var buttons = require('sdk/ui/button/action'); var tabs = require("sdk/tabs"); var button = buttons.actionbutton({ id: "mozilla-link", label: "visit mozilla", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, onclick: handleclick }); function handleclick(state) { tabs.open("https://developer.mozilla.org/"); } at the command prompt, execute jpm run again.
... to build an xpi, just execute the command jpm xpi from the add-on's directory: jpm xpi you should see a message like: jpm info successfully created xpi at /path/to/my-addon/@my-addon-0.0.1.xpi to test that this worked, try installing the xpi file in your own firefox installation.
Getting started (cfx) - Archive of obsolete content
loaded: var buttons = require('sdk/ui/button/action'); var tabs = require("sdk/tabs"); var button = buttons.actionbutton({ id: "mozilla-link", label: "visit mozilla", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, onclick: handleclick }); function handleclick(state) { tabs.open("https://developer.mozilla.org/"); } at the command prompt, execute cfx run again.
... to build an xpi, just execute the command cfx xpi from the add-on's directory: cfx xpi you should see a message like: exporting extension to my-addon.xpi.
On page load - Archive of obsolete content
this article is for xul/javascript developers who want to have custom code executed each time a new page is loaded in browser/mail.
... // you can use it to make your code executed on certain pages only.
StringView - Archive of obsolete content
thisobject optional the this object upon which will be executed the callback function.
...k (charcode, characteroffset, rawoffset /*, rawdataarray */) { this.appendchild(document.createtextnode("char #" + characteroffset + ", raw index: " + rawoffset + ", character: " + string.fromcharcode(charcode))); this.appendchild(document.createelement("br")); } (new stringview("\u4367\ud889\ude54\u4343\u5431")).foreachchar(mycallback, document.body); note: stringview.foreachchar() executes a complete cycle through all characters in the stringview between characteroffset and characteroffset + characterslength.
Displaying web content in an extension without security issues - Archive of obsolete content
the issue that is commonly overlooked here is that the rss feed could contain some malicious javascript code and it would then execute with the privileges of the extension — meaning that it would get full access to the browser (cookies, history etc) and to user’s files.
...this can be done as well, by placing the event handler on the frame tag (meaning that it is outside the restricted document and can execute without restrictions): <iframe type="content" onclick="handleclick(event);"/> and the event handler would look like that: function handlebrowserclick(event) { // only react to left mouse clicks if (event.button != 0) return; // default action on link clicks is to go to this link, cancel it event.preventdefault(); if (event.target instanceof htmlanchorelement && event.target.href)...
JavaScript Object Management - Archive of obsolete content
if you really need to do something like this anyway, one way to do it is to have a timeout execute the code after a delay: init : function(aevent) { let that = this; this._stringbundle = document.getelementbyid("xs-hw-string-bundle"); window.settimeout( function() { window.alert(that._stringbundle.getstring("xulschoolhello.greeting.label")); }, 0); } the settimeout function executes the function in the first parameter, after a delay in miliseconds specified by the secon...
...in this case we set the delay to 0, which means the function should be executed as soon as possible.
Tabbed browser - Archive of obsolete content
if your code is executed from a firefox browser.xul overlay (for example, it is a toolbar button or menu click handler), you can access the current window with the window pre-defined variable.
... however, if your code is executed from its own window (for example, a settings/options dialog), you can use nsiwindowmediator to get a browser's window.
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
the old netscape 4.x the file is encoded (byte-shift/rotary is 7), and the presence of the file (netscape.cfg) in the mozilla_home directory suffices for it to be read and executed.
...it must be encoded // with the "convert" function of the cck "file" menu // netscape's flow of preference configuration: // configure defaults from internal javascript file in ns executable // global prefs from netscape.cfg (this file) // executes ~/.netscape/preferences.js file // executes ~/.netscape/user.js // (somewhere in here liprefs.js is run, but i haven't yet figured out // what liprefs is for....) //========================================================================= with (prefconfig) { // must be done inside the prefconfig module // create some variables we might want to use later on...
Source Navigator - Archive of obsolete content
let me know if this is wrong..) it can generate a class hierarchy quite easily (unfortunately, not for classnames which are defined by macro.) installing source navigator in ubuntu execute the following line in a terminal window: sudo apt-get install sourcenav this should install source-navigator.
... one can check whether the installation is complete by executing: $ which snavigator /usr/bin/snavigator importing the source execute the following: snavigator.
Editor Embedding Guide - Archive of obsolete content
getcommandstate "state_enabled"(boolean) docommand no parameters cmd_undo undoes last executed command.
... cmd_redo redoes last executed command.
Helper Apps (and a bit of Save As) - Archive of obsolete content
launching a helper application this is delegated to the nspiexternalapplauncher (also implemented by the nsexternalhelperapphandler): windows: launch either directly via nsiprocess or via the ::shellexecute() method depending on where the mimeinfo came from.
... security considerations multiple checks for whether a file is executable (on windows) to keep from launching such files via ::shellexecute().
Table Layout Regression Tests - Archive of obsolete content
execute the baseline test shutdown the layoutdebugger execute mozilla -layoutdebug - p foo >selftest.txt execute the verify test make a note which tests have failed grep 'failed' selftest.txt (these are false positives, quite frequently they indicate reflow problems, pages showing differently when loaded from cache) make your changes to the source, recompile.
... execute mozilla -layoutdebug - p foo >outputfile.txt execute the verify test make a note which tests have failed grep 'failed' outputfile.txt check how many tests have failed and analyze your results: if the regression tests have failed at the same place as the previous diagnosed false positives => ignore try to figure out what the other regressions are: are they improving the picture or are they regressions?
Event Handlers - Archive of obsolete content
the handler contains script that is executed when an event flows to the object the handler is attached to and if that event matches all of the criteria specified by the handler.
...this attribute is a comma-separated list of modifier keys that must be down at the time the key or mouse event occurs in order for the handler to execute.
XPInstall API reference - Archive of obsolete content
objects install properties methods adddirectory addfile alert cancelinstall confirm deleteregisteredfile execute gestalt getcomponentfolder getfolder getlasterror getwinprofile getwinregistry initinstall loadresources logcomment patch performinstall refreshplugins registerchrome reseterror setpackagefolder installtrigger no properties methods comparevers...
...ion enabled getversion install installchrome startsoftwareupdate installversion properties methods compareto init tostring file no properties methods copy dircreate dirgetparent dirremove dirrename diskspaceavailable execute exists isdirectory isfile macalias moddate moddatechanged move remove rename size windowsgetshortname windowsregisterserver windowsshortcut winprofile no properties methods getstring writestring winreg no properties methods crea...
textbox.onblur - Archive of obsolete content
prior to gecko 1.9 (firefox 3), the script code would execute in the context of the anonymous html <input> element inside the textbox binding.
... from gecko 1.9 to gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9), the script code would actually execute twice, once in the context of the anonymous html <input> element and once in the context of the <textbox> element itself.
textbox.onfocus - Archive of obsolete content
prior to gecko 1.9 (firefox 3), the script code would execute in the context of the anonymous html <input> element inside the textbox binding.
... from gecko 1.9 to gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9), the script code would actually execute twice, once in the context of the anonymous html <input> element and once in the context of the <textbox> element itself.
MenuButtons - Archive of obsolete content
the 'menu' button the 'menu' type of button is used when pressing the button alone should just open the menu and not execute a command directly.
... this works similarly to the menu tag, and would be used to present a set of commands to execute.
Adding Event Handlers - Archive of obsolete content
using scripts to make the find files dialog functional, we need to add some scripts which will execute when the user interacts with the dialog.
...the value of the attribute should be some script that should be executed when the event occurs.
application/http-index-format specification - Archive of obsolete content
3 slots either 'r', 'w', 'x', or '-' representing, in order, read, write, or execute permissions.
...example "rw-" means read and write permission, but not execute.
Security Controls - Archive of obsolete content
operational controls: the security controls that are primarily implemented and executed by people (as opposed to systems).
... technical controls: the security controls that are primarily implemented and executed by the system through the system's hardware, software, or firmware.
GetObject - Archive of obsolete content
for example: var cadobject; cadobject = getobject("c:\\cad\\schema.cad"); when this code is executed, the application associated with the specified pathname is started, and the object in the specified file is activated.
... if an object has registered itself as a single-instance object, only one instance of the object is created, no matter how many times activexobject is executed.
Archived JavaScript Reference - Archive of obsolete content
for each distinct property, a specified statement is executed.function.aritynot part of any standard.function.prototype.isgenerator()the non-standard isgenerator() method used to determine whether or not a function is a generator.
...you can use the more general proxy object instead.object.prototype.__count__the __count__ property used to store the count of enumerable properties on the object, but it has been removed.object.prototype.__nosuchmethod__the __nosuchmethod__ property used to reference a function to be executed when a non-existent method is called on an object, but this function is no longer available.object.prototype.__parent__the __parent__ property used to point to an object's context, but it has been removed.object.prototype.eval()the object.eval() method used to evaluate a string of javascript code in the context of an object, however, this method has been removed.object.prototype.unwatch()the unw...
LiveConnect Overview - Archive of obsolete content
java successfully evaluates the javascript code, but the javascript code executes an unhandled throw statement.
...the catch block executes the jscodefailed method if the eval statement in the try block throws a jsexception; the othercodefailed method executes if the try block throws any other error.
ParallelArray - Archive of obsolete content
the higher-order functions available on parallelarray attempted to execute in parallel, though they may fall back to sequential execution if necessary.
... to ensure that your code executes in parallel, it is suggested that the functions should be limited to the parallelizable subset of js that firefox supports.
Properly Using CSS and JavaScript in XHTML Documents - Archive of obsolete content
mozilla 1.1+/opera 7 do not apply css or execute the javascript.
... netscape 7.0x/mozilla 1.0.x do not apply css but does execute the javascript.
Archived open Web documentation - Archive of obsolete content
the higher-order functions available on parallelarray attempted to execute in parallel, though they may fall back to sequential execution if necessary.
... to ensure that your code executes in parallel, it is suggested that the functions should be limited to the parallelizable subset of js that firefox supports.
GLSL Shaders - Game development
glsl is executed directly by the graphics pipeline.
...everything inside void main() will be executed by the vertex shader.
Desktop mouse and keyboard controls - Game development
that way, if you already implemented the buttons as shown in the mobile touch controls article, it will work out of the box on the desktop too: var buttonenclave = this.add.button(10, 10, 'logo-enclave', this.clickenclave, this); the button will be placed ten pixels from the top left corner of the screen, use the logo-enclave image, and will execute the clickenclave() function when clicked.
...the ondown() function is executed whenever the enter key is pressed — it will launch the clickstart() method, which starts a new game.
Mobile touch controls - Game development
input events instead of using the pointers directly it is also possible to listen for this.game.input events, like ondown, onup, ontap and onhold: this.game.input.ondown.add(itemtouched, this); function itemtouched(pointer) { // do something } the itemtouched() function will be executed when the ondown event is dispatched by touching the screen.
... implementation the easiest way to add an interactive object that will listen for user input is to create a button: var buttonenclave = this.add.button(10, 10, 'logo-enclave', this.clickenclave, this); this one is formed in the mainmenu state — it will be placed ten pixels from the top left corner of the screen, use the logo-enclave image, and execute the clickenclave() function when it is touched.
Implementing controls using the Gamepad API - Game development
update() is executed on every frame inside the game loop, to update the actual status of the gamepad object regularly: update: function() { // clear the buttons cache gamepadapi.buttonscache = []; // move the buttons status from the previous frame to the cache for(var k=0; k<gamepadapi.buttonsstatus.length; k++) { gamepadapi.buttonscache[k] = gamepadapi.buttonsstatus[k]; } // clear the buttons statu...
...the buttonpressed function is used in the update loop of the game like this: if(gamepadapi.turbo) { if(gamepadapi.buttonpressed('a','hold')) { this.turbo_fire(); } if(gamepadapi.buttonpressed('b')) { this.managepause(); } } if gamepadapi.turbo is true and the given buttons are pressed (or held), we execute the proper functions assigned to them.
Animations and tweens - Game development
applying the animation when the ball hits the paddle in the arcade.collide() method call that handles the collision between the ball and the paddle (the first line inside update(), see below) we can add an extra parameter that specifies a function to be executed every time the collision happens, in the same fashion as the ballhitbrick() function.
... we will also add the optional oncomplete event handler, which defines a function to be executed when the tween finishes.
Extra lives - Game development
the difference is that the add() method binds the given function and causes it to be executed every time the event occurs, while addonce() is useful when you want to have the bound function executed only once and then unbound so it is not executed again.
... in our case, on every outofbounds event the ballleavescreen will be executed, but when the ball leaves the screen we only want to remove the message from the screen once.
Boolean - MDN Web Docs Glossary: Definitions of Web-related terms
for example, in javascript, boolean conditionals are often used to decide which sections of code to execute (such as in if statements) or repeat (such as in for loops).
... /* javascript if statement */ if (boolean conditional) { // code to execute if the conditional is true } if (boolean conditional) { console.log("boolean conditional resolved to true"); } else { console.log("boolean conditional resolved to false"); } /* javascript for loop */ for (control variable; boolean conditional; counter) { // code to execute repeatedly if the conditional is true } for (var i=0; i < 4; i++) { console.log("i print only when the boolean conditional is true"); } the boolean value is named after english mathematician george boole, who pioneered the field of mathematical logic.
Callback function - MDN Web Docs Glossary: Definitions of Web-related terms
here is a quick example: function greeting(name) { alert('hello ' + name); } function processuserinput(callback) { var name = prompt('please enter your name.'); callback(name); } processuserinput(greeting); the above example is a synchronous callback, as it is executed immediately.
...a good example is the callback functions executed inside a .then() block chained onto the end of a promise after that promise fulfills or rejects.
Conditional - MDN Web Docs Glossary: Definitions of Web-related terms
an instruction or a set of instructions is executed if a specific condition is fulfilled.
... otherwise, another instruction is executed.
State machine - MDN Web Docs Glossary: Definitions of Web-related terms
a state is a description of the status of a system waiting to execute a transition.
... a transition is a set of actions to execute when a condition is fulfilled or an event received.
Speculative parsing - MDN Web Docs Glossary: Definitions of Web-related terms
traditionally in browsers the html parser ran on the main thread and was blocked after a </script> tag until the script has been retrieved from the network and executed.
...it parses ahead while scripts are being downloaded and executed.
What are browser developer tools? - Learn web development
the call stack section shows you what code was executed to get to the current line.
...it allows you to run lines of javascript against the page currently loaded in the browser, and reports the errors encountered as the browser tries to execute your code.
Use JavaScript within a webpage - Learn web development
if you want to execute a .js script from your webpage, just use <script> with an src attribute pointing to the script file, using its url: <script src="path/to/my/script.js"></script> writing javascript within html you may also add javascript code between <script> tags rather than providing an src attribute.
... <script> window.addeventlistener('load', function () { console.log('this function is executed once the page is fully loaded'); }); </script> that's convenient when you just need a small bit of javascript, but if you keep javascript in separate files you'll find it easier to focus on your work write self-sufficient html write structured javascript applications use scripting accessibly accessibility is a major issue in any software development.
Graceful asynchronous programming with Promises - Learn web development
there is no guarantee of exactly when the operation will complete and the result will be returned, but there is a guarantee that when the result is available, or the promise fails, the code you provide will be executed in order to do something else with a successful result, or to gracefully handle a failure case.
...there are certain steps that you have to take for your order to be successful, which doesn't really make sense to try to execute out of order, or in order but before each previous step has quite finished: you choose what toppings you want.
Looping code - Learn web development
if the square root is an integer, we skip past the if block entirely so the continue statement is not executed; instead, we concatenate the current i value plus a space on to the end of the paragraph content.
...in a do...while loop, the code inside the curly braces is always run once before the check is made to see if it should be executed again (in while and for, the check comes first, so the code might never be executed).
TypeScript support in Svelte - Learn web development
in this case, the script will execute whenever you change any file.
... (node && typeof node.select === 'function' ) { // make sure node is defined and has a select() method const onfocus = () => node.select() // event handler node.addeventlistener('focus', onfocus) // when node gets focus call onfocus() return { destroy: () => node.removeeventlistener('focus', onfocus) // this will be executed when the node is removed from the dom } } } now update todo.svelte and newtodo.svelte where we import the actions file.
Continuous Integration
talos is used to execute several suites for desktop firefox and firefox for android; these suites are denoted using lower-case letters, e.g., t(c d g1 o s tp).
... each test is executed multiple times to produce a number of data replicates.
Debugging on Windows
if you have followed the steps in building firefox for windows and have a local debug build, you can execute ./mach run --debug from the same command line.
... (and just in-case those links die, the work-around is to execute bcdedit /set xsavedisable 1 from an elevated command-prompt to disable avx support.) got a tip?
mach
mach figures out how to execute the tests for you!
...it's a python script that creates an instance of the mach core, registers commands with it, then tells the mach core to execute.
Message manager overview
this is the recommended way to load a script that executes just once per child process, which is something you might want to do if you are interacting with some global service (for example, adding listeners to observer notifications or registering components).
...since javascript modules are singletons they will only be executed once per process even when they are loaded in multiple frame scripts.
Getting Started with Chat
if #channel is not specified, the command is executed for the current channel.
...if a #channel is not specified, the command is executed for the current channel.
HTTP Cache
ccess to entries in that application cache; when the app cache is not specified, this storage will operate over all existing app caches the service also provides methods to clear the whole disk and memory cache content or purge any intermediate memory structures: clear – after it returns, all entries are no longer accessible through the cache apis; the method is fast to execute and non-blocking in any way; the actual erase happens in background purgefrommemory – removes (schedules to remove) any intermediate cache data held in memory for faster access (more about the intermediate cache below) nsiloadcontextinfo distinguishes the scope of the storage demanded to open.
...dispatching to a level with a lower number is executed sooner then dispatching to higher number layers; also any loop on lower levels yields to higher levels so that scheduled deletion of 1000 files will not block opening cache entries.
AsyncShutdown.jsm
// execute this code during profilebeforechange return promise; // profilebeforechange will not complete until promise // is resolved or rejected }); asyncshutdown.profilebeforechange.addblocker("module: trivial callback", function condition() { // ...
... // execute this code during profilebeforechange // no specific guarantee about completion of profilebeforechange }); if the promise returned by condition is not resolved/rejected within one minute, the process will crash to avoid blocking system shutdown, preventing the user from restarting firefox or burning through battery.
Download
launchwhensucceeded boolean if this property is true when the download finishes successfully, the target file will be opened or executed automatically.
... launch() opens or executes the target file after download has completed.
OS.File for the main thread
append if true, the file will be opened for appending, meaning the equivalent of .setposition(0, pos_end) is executed before each write.
...even though the function will be executed off the main-thread, it might still affect the overall performance of any running application.
OSFile.jsm
we are talking about several seconds to execute operations that look trivial, such as closing a file, or checking when it was last modified.
...from a worker thread in some cases, the main thread api for os.file is not appropriate as it would require too much message passing, or because the code that requires file i/o is already executed on a worker thread.
Promise
once you have a reference to a promise, you can call its then() method to execute an action when the value becomes available, or when an error occurs.
... note: when you call the then method multiple times on the same promise, the registered callbacks are always executed independently.
Task.jsm
if you specify the iterator returned by a generator function you called, the generator function is also executed as a task.
... let mypromise = getpromiseresolvedontimeoutwithvalue(1000, "value"); let result = yield mypromise; // this part is executed only after the promise above is resolved (after // one second, in this imaginary example).
Localizing with Koala
this will execute "hg add" on this file in the background.
... koala will execute "hg commit" in the background and will let you know that the files were successfully committed.
L20n Javascript API
alternatively, you can register callbacks to execute when the context is ready (or when globals change and translations need to be updated) with ctx.localize.
... after that, each time locale list is modified (retranslation case) the callback will be executed.
Rhino Debugger
running scripts you may select the file->run menu item on the menu bar to execute javascript scripts contained in files.
... this action will display a file-selection dialog box prompting you for the location of a script to execute.
Tutorial: Embedding Rhino
all it does it read a script from the command line, execute it, and print a result.
... initializing standard objects the code scriptable scope = cx.initstandardobjects(); initializes the standard objects (object, function, etc.) this must be done before scripts can be executed.
Rhino FAQ
for instance, to create an array of java.lang.string of length five, do var stringarray = java.lang.reflect.array.newinstance(java.lang.string, 5); then if you wish to assign the string "hi" to the first element, simply execute stringarray[0] = "hi".
...for example, creating an array of seven ints can be done with the code var intarray = java.lang.reflect.array.newinstance(java.lang.integer.type, 7); when i try to execute a script i get the exception required security context missing.
Rhino overview
rhino contains all the features of javascript 1.7 allows direct scripting of java a javascript shell for executing javascript scripts a javascript compiler to transform javascript source files into java class files a javascript debugger for scripts executed with rhino language the javascript language itself is standardized by standard ecma-262 ecmascript: a general purpose, cross-platform programming language.
...embeddings that trust the javascript code they execute may ignore the security features.
JS_CallFunction
obj js::handleobject the "current" object on which the function operates; the object specified here is "this" when the function executes.
... if the called function executes successfully, js_callfunction returns true.
JS_CompileScript
if the jsoption_compile_n_go option is set in cx, the resulting script must be executed in this scope, and at most once.
... mxr id search for js_compilescript mxr id search for js_compileucscript js::evaluate js::compileoffthread js::compilefunction js_executescript js_decompilescript bug 1143793 -- removed obj parameter ...
JS_SetBranchCallback
if the callback returns js_true, the js engine continues to execute the script.
...the engine does not execute finally blocks in this case; this is the same behavior as any native method or callback.
JS_SetFunctionCallback
fcb jsfunctioncallback the callback to execute when javascript functions are invoked and exited.
... scr const jsscript * the script being executed.
JS_SetOptions
mxr id search for jsoption_private_is_nsisupports jsoption_compile_n_go caller of js_compilescript et al promises to execute the compiled script once only, in the same scope object used for compilation.
... mxr id search for jsoption_jit jsoption_no_script_rval added in spidermonkey 1.8.1 by setting this option, the application promises to the compiler that a null rval out-param will be passed to each call to js_executescript.
Web Replay
step back when paused, the reverse step button in the debugger developer tool will step to the previous line executed and allow inspecting program state there.
... these spawn a number of threads which do not participate in the recording: any events they execute are live.
Secure Development Guidelines
s oriented toward c/c++ introduction: gaining control specifics about the underlying architecture, using x86 as an example 6 basic registers (eax, ebx, ecx, edx, edi, esi) 2 stack-related registers (esp, ebp) mark top and bottom of current stack frame status register (eflags) contains various state information instruction pointer (eip) points to register being executed; can’t be modified directly introduction: gaining control (2) eip is modified using call or jump instructions attacks usually rely on obtaining control over the eip otherwise the attacker can try to control memory pointed to by an existing function pointer a vulnerability is required to modify the eip or sensitive memory saved return addr or function pointer get altered introdu...
...examples: if it doesn’t have to be negative, store it in an unsigned int if the input doesn’t have to be > 512, cut it off there if the input should only be [a-za-z0-9], enforce it cross site scripting (xss) xss is a type of code injection attack typically occurs in web applications injection of arbitrary data into an html document from another site victim’s browser executes those html instructions could be used to steal user credentials think: webmail, online auction, cms, online banking...
Retrieving part of the bookmarks tree
configure the query to get a hierarchical bookmarks result, pass the folder id to setfolders in your query object: query.setfolders([toolbarfolder], 1); run the query the executequery and executequeries functions will return an nsinavhistoryresult object containing the results of your query: var result = historyservice.executequery(query, options); get the results when you are querying for exactly one folder grouped by folder with no fancy query parameters such as keywords or date ranges (as in this example), the root of the result will be an nsinavhistorycontainerresult...
...e); var options = historyservice.getnewqueryoptions(); var query = historyservice.getnewquery(); var bookmarksservice = components.classes["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(components.interfaces.nsinavbookmarksservice); var toolbarfolder = bookmarksservice.toolbarfolder; query.setfolders([toolbarfolder], 1); var result = historyservice.executequery(query, options); var rootnode = result.root; rootnode.containeropen = true; // iterate over the immediate children of this folder and dump to console for (var i = 0; i < rootnode.childcount; i ++) { var node = rootnode.getchild(i); dump("child: " + node.title + "\n"); } // close a container after using it!
Creating a Python XPCOM component
registering the interface in the "components" directory, execute : ../xpidl -m typelib -w -v -i /usr/share/idl/mozilla/ nsipysimple.idl on windows you must point to the idl directory as part of your mozilla build.
...just execute this file as a script with the interface name as a param.
xpcshell
(however, it might not be there if you have a non-debug version of firefox, mozilla, thunderbird, etc.) $ cd /opt/mozilla $ ./run-mozilla.sh ./xpcshell js> execute xpcshell from window the built xpcshell.exe can't be executed under the mozilla build shell(bash).
... it should be executed under the window command prompt source_directory/obj-xxxxx/dist/bin> xpcshell.exe using the latest version of javascript at present, xpcshell doesn't use the latest version of javascript, so newer language features, such as the let statement introduced in javascript 1.7, are not available.
Observer Notifications
topic subject data description chrome-document-global-created nsidomwindow null sent immediately after a chrome document window has been set up, but before any script code has been executed.
... content-document-global-created nsidomwindow origin sent immediately after a web content document window has been set up, but before any script code has been executed.
mozIStorageBindingParamsArray
the mozistoragebindingparamsarray interface is a container for mozistoragebindingparams objects, and is used to store sets of bound parameters that will be used by the mozistoragestatement.executeasync().
...the appended parameters will be used when mozistoragestatement.executeasync() is called.
nsICommandController
ents.classes["@mozilla.org/embedcomp/base-command-controller;1"] .createinstance(components.interfaces.nsicommandcontroller); method overview void docommandwithparams(in string command, in nsicommandparams acommandparams); void getcommandstatewithparams( in string command, in nsicommandparams acommandparams); methods docommandwithparams() executes the specified command with a set of parameters contained in an nsicommandparams object.
... void docommandwithparams( in string command, in nsicommandparams acommandparams ); parameters command the command to execute.
nsIController
inherits from: nsisupports last changed in gecko 1.7 method overview void docommand(in string command); boolean iscommandenabled(in string command); void onevent(in string eventname); boolean supportscommand(in string command); methods docommand() when this method is called, your implementation should execute the command with the specified name.
... void docommand( in string command ); parameters command the name of the command to execute.
nsIDOMSimpleGestureEvent
moztapgesture - generated when the user executes a two finger tap gesture on the input device.
...(xxx not implemented on mac) mozpresstapgesture - generated when the user executes a press and tap two finger gesture (first finger down, second finger down, second finger up, first finger up) on the input device.
nsISound
event_menu_execute 5 a menu item is executed.
... _moz_menucommand the system sound when a menu item is executed.
Performance
when you execute a sql statement in isolation, an implicit transaction is created around that statement.
...see the sqlite optimizer overview on the sqlite web site for information on how sqlite uses indices and executes statements.
WebIDL bindings
the return value is guaranteed to not depend on the state of the js heap or other js engine data structures, and is guaranteed to not change unless some function with [affects=everything] is executed.
...attributes/methods flagged in this way promise that they will keep returning the same value as long as nothing that has [affects=everything] executes.
Debugger.Frame - Firefox Developer Tools
script the script being executed in this frame (a debugger.script instance), or null on frames that do not represent calls to debuggee code.
... offset the offset of the bytecode instruction currently being executed in script, or undefined if the frame’s script property is null.
ANGLE_instanced_arrays.drawArraysInstancedANGLE() - Web APIs
in addition, it can execute multiple instances of the range of elements.
... primcount a glsizei specifying the number of instances of the range of elements to execute.
ANGLE_instanced_arrays.drawElementsInstancedANGLE() - Web APIs
in addition, it can execute multiple instances of a set of elements.
... primcount a glsizei specifying the number of instances of the set of elements to execute.
ANGLE_instanced_arrays - Web APIs
ext.drawarraysinstancedangle() behaves identically to gl.drawarrays() except that multiple instances of the range of elements are executed, and the instance advances for each iteration.
... ext.drawelementsinstancedangle() behaves identically to gl.drawelements() except that multiple instances of the set of elements are executed and the instance advances between each set.
CSSUnparsedValue.forEach() - Web APIs
the cssunparsedvalue.foreach() method executes a provided function once for each element of the cssunparsedvalue.
... syntax cssunparsedvalue.foreach(function callback(currentvalue[, index[, array]]) { // your iterator }[, thisarg]); parameters callback the function to execute for each element, taking three arguments: currentvalue the value of the current element being processed.
Document.execCommand() - Web APIs
parameters acommandname a domstring specifying the name of the command to execute.
... undo undoes the last executed command.
EXT_disjoint_timer_query - Web APIs
ext.beginqueryext() the timer starts when all commands prior to beginqueryext have been fully executed.
... ext.endqueryext() the timer stops when all commands prior to endqueryext have been fully executed.
Element.innerHTML - Web APIs
WebAPIElementinnerHTML
html5 specifies that a <script> tag inserted with innerhtml should not execute.
... however, there are ways to execute javascript without using <script> elements, so there is still a security risk whenever you use innerhtml to set strings over which you have no control.
Geolocation API - Web APIs
in both cases, the method call takes up to three arguments: a mandatory success callback: if the location retrieval is successful, the callback executes with a geolocationposition object as its only parameter, providing access to the location data.
... an optional error callback: if the location retrieval is unsuccessful, the callback executes with a geolocationpositionerror object as its only parameter, providing access information on what went wrong.
HTMLBodyElement - Web APIs
windoweventhandlers.onrejectionhandled an eventhandler representing the code executed when the rejectionhandled event is raised, indicating that a promise was rejected and the rejection has been handled.
... windoweventhandlers.onunhandledrejection an eventhandler representing the code executed when the unhandledrejection event is raised, indicating that a promise was rejected but the rejection was not handled.
History.replaceState() - Web APIs
examples suppose https://www.mozilla.org/foo.html executes the following javascript: const stateobj = { foo: 'bar' }; history.pushstate(stateobj, '', 'bar.html'); the explanation of these two lines above can be found in the example of pushstate() method section of the working with the history api article.
... then suppose https://www.mozilla.org/bar.html executes the following javascript: history.replacestate(stateobj, '', 'bar2.html'); this will cause the url bar to display https://www.mozilla.org/bar2.html, but won't cause the browser to load bar2.html or even check that bar2.html exists.
Using IndexedDB - Web APIs
the database transactions will be created in the unload event handler, but because they are asynchronous they will be aborted before they can execute.
...e) { console.log("displaypublist"); if (typeof store == 'undefined') store = getobjectstore(db_store_name, 'readonly'); var pub_msg = $('#pub-msg'); pub_msg.empty(); var pub_list = $('#pub-list'); pub_list.empty(); // resetting the iframe so that it doesn't display previous content newviewerframe(); var req; req = store.count(); // requests are executed in the order in which they were made against the // transaction, and their results are returned in the same order.
Timing element visibility with the Intersection Observer API - Web APIs
and the threshold is set to an array containing the values 0.0 and 0.75; this will cause our callback to execute whenever a targeted element becomes completely obscured or first starts to become unobscured (intersection ratio 0.0) or passes through 75% visible in either direction (intersection ratio 0.75).
...from now on, any time the ad becomes 100% obscured or even a single pixel becomes visible, or the ad passes through 75% visible in one way or another, the observer's callback is executed.
Key Values - Web APIs
historically, the escape character was used to signal the start of a special control sequence of characters called an "escape sequence." vk_escape (0x1b) kvk_escape (0x35) gdk_key_escape (0xff1b) qt::key_escape (0x01000000) keycode_escape (111) "execute" the execute key.
... vk_execute (0x2b) qt::key_execute (0x01020003) "find" the find key.
KeyboardLayoutMap.forEach() - Web APIs
the foreach() method of the keyboardlayoutmap interface executes a provided function once for each element of the map.
... syntax keyboardlayoutmap.foreach(function callback(currentvalue[, index[, array]]) { //your iterator }[, thisarg]); parameters callback the function to execute for each element, taking three arguments: currentvalue the value of the current element being processed.
Navigator.getUserMedia() - Web APIs
if permission is denied, no compatible input devices exist, or any other error condition occurs, the error callback is executed with a mediastreamerror object describing what went wrong.
... if the user instead doesn't make a choice at all, neither callback is executed.
Navigator.msLaunchUri() - Web APIs
successcallbackoptional a function matching the signature of mslaunchuricallback to be executed if the protocol handler is present.
... nohandlercallbackoptional a function matching mslaunchuricallback to be executed if the protocol handler is not present.
Web-based protocol handlers - Web APIs
the "%s" is replaced with the href of the link and a get is executed on the resultant url.
... when a browser executes this code, it should display a prompt to the user, asking permission to allow the web application to register as a handler for the protocol.
Node.removeChild() - Web APIs
WebAPINoderemoveChild
s in fact a child of element at the time of the call, but was removed by an event handler invoked in the course of trying to remove the element (e.g., blur.) errors thrown the method throws an exception in 2 different ways: if the child was in fact a child of element and so existing on the dom, but was removed the method throws the following exception: uncaught notfounderror: failed to execute 'removechild' on 'node': the node to be removed is not a child of this node.
... if the child doesn't exist on the dom of the page, the method throws the following exception: uncaught typeerror: failed to execute 'removechild' on 'node': parameter 1 is not of type 'node'.
PerformanceTiming - Web APIs
performancetiming.domcontentloadedeventstart read only right before the parser sent the domcontentloaded event, that is right after all the scripts that need to be executed right after parsing have been executed.
... performancetiming.domcontentloadedeventend read only right after all the scripts that need to be executed as soon as possible, in order or not, have been executed.
SharedWorker() - Web APIs
the sharedworker() constructor creates a sharedworker object that executes the script at the specified url.
... syntax var myworker = new sharedworker(aurl, name); var myworker = new sharedworker(aurl, options); parameters aurl a domstring representing the url of the script the worker will execute.
Using the Storage Access API - Web APIs
first of all, if the <iframe> is sandboxed, the embedding website needs to add the allow-storage-access-by-user-activation sandbox token to allow storage access requests to be successful, along with allow-scripts and allow-same-origin to allow it to call the api, and execute in an origin that can have cookies: <iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin"> ...
... </iframe> now on to the code executed inside the embedded document.
StylePropertyMapReadOnly.forEach() - Web APIs
the stylepropertymapreadonly.foreach() method executes a provided function once for each element of stylepropertymapreadonly.
... syntax stylepropertymapreadonly.foreach(function callback(currentvalue[, index[, array]]) { //your code }[, thisarg]); parameters callback the function to execute for each element, taking three arguments: currentvalue the value of the current element being processed.
TextRange - Web APIs
WebAPITextRange
textrange.execcommand() executes a command on the current document, the current selection, or the given scope.
... textrange.querycommandenabled() returns a boolean indicating whether the specified command can be executed successfully with the execcommand method in the current state of the given document.
WebGL2RenderingContext.drawArraysInstanced() - Web APIs
in addition, it can execute multiple instances of the range of elements.
... instancecount a glsizei specifying the number of instances of the range of elements to execute.
WebGL2RenderingContext.drawElementsInstanced() - Web APIs
in addition, it can execute multiple instances of a set of elements.
... instancecount a glsizei specifying the number of instances of the set of elements to execute.
WebGL2RenderingContext - Web APIs
in addition, it can execute multiple instances of the range of elements.
...in addition, it can execute multiple instances of a set of elements.
WebGLRenderingContext - Web APIs
webglrenderingcontext.flush() empties different buffer commands, causing all commands to be executed as quickly as possible.
...the webgl rendering context is an interface, through which you can set and query the state of the graphics machine, send data to the webgl, and execute draw commands.
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
pc.ontrack = ({track, streams}) => { track.onunmute = () => { if (remotevideo.srcobject) { return; } remotevideo.srcobject = streams[0]; }; }; when the track event occurs, this handler executes.
... since there isn't a single "roll back and use this offer instead", performing this change on the polite peer requires two steps, executed in the context of promise.all(), which is used to ensure that both statements execute completely before continuing to handle the received offer.
Spaces and reference spaces: Spatial tracking in WebXR - Web APIs
this means that most frequently, you'll be using poses within your frame rendering code, which is executed as a callback from the xrframe method requestanimationframe().
... for example, given an xrsession whose reference space is worldrefspace, the following line of code would request the first frame of animation to be scheduled: animationframerequestid = xrsession.requestanimationframe(mydrawframe); then, the mydrawframe() function—the callback executed when it's time to draw the frame—might be something like this: function mydrawframe(currentframetime, frame) { let session = frame.session; let viewerpose = frame.getviewerpose(viewerrefspace); animationframerequestid = session.requestanimationframe(mydrawframe); if (viewerpose) { /* ...
Worker() - Web APIs
WebAPIWorkerWorker
the worker() constructor creates a worker object that executes the script at the specified url.
... syntax var myworker = new worker(aurl, options); parameters aurl a usvstring representing the url of the script the worker will execute.
WorkerGlobalScope - Web APIs
windoworworkerglobalscope.setinterval() schedules a function to execute every time a given number of milliseconds elapses.
... windoworworkerglobalscope.settimeout() schedules a function to execute in a given amount of time.
XRInputSourceArray.forEach() - Web APIs
the xrinputsourcearray method foreach() executes the specified callback once for each input source in the array, starting at index 0 and progressing until the end of the list.
... syntax xrinputsourcearray.foreach(callback, thisarg); parameters callback a function to execute once for each entry in the array xrinputsourcearray.
XRReferenceSpace: reset event - Web APIs
in either case, the event is sent before any webxr animation frames which make use of the new origin are executed.
...the event is sent before any animation frame callbacks are executed to render the pending frame, to ensure that those callbacks have the updated coordinate system available.
XRSession.requestAnimationFrame() - Web APIs
the xrsession method requestanimationframe(), much like the window method of the same name, schedules a callback to be executed the next time the browser is ready to paint the session's virtual environment to the xr display.
... the specified callback is executed once before the next repaint; if you wish for it to be executed for the following repaint, you must call requestanimationframe() again.
Cubic Bezier Generator - CSS: Cascading Style Sheets
basic_scale_size = 5; // size of 0.1 tick on the rulers var scaling; //limitation: scaling is computed once: if canvas.height/canvas.width change it won't be recalculated var dragsm = 0; // drag state machine: 0 = nodrag, others = object being dragged function initcanvas() { // get the canvas element using the dom var canvas = document.getelementbyid('bezier'); // make sure we don't execute when canvas isn't supported if (canvas.getcontext) { // use getcontext to use the canvas for drawing var ctx = canvas.getcontext('2d'); scaling = math.min(canvas.height - rulers - margin, canvas.width - rulers - margin); canvas.onmousedown = mousedown; canvas.onmouseup = mouseup; } else { alert('you need safari or firefox 1.5+ to see this ...
...result + 0.5 : result; } function drawbeziercurve(x1, y1, x2, y2) { // get the canvas element using the dom var canvas = document.getelementbyid('bezier'); // make sure we don't execute when canvas isn't supported if (canvas.getcontext) { // use getcontext to use the canvas for drawing var ctx = canvas.getcontext('2d'); // clear canvas ctx.clearrect(0, 0, canvas.width, canvas.height); // draw the rulers ctx.beginpath(); ctx.strokestyle = "black"; // draw the y axis ctx.moveto(cx(0), cy(0)); ...
Overview of events and handlers - Developer guides
as a second example, much modern javascript integrated into web pages is wrapped into an event function call to ensure that the code is only executed when the html has been processed and is available for alteration or decoration.
... for example, code might be attached as: var funcinit = function(){ // user code goes here and can safely address all the html elements from the page // since the document has successfully been 'loaded' } document.addeventlistener('domcontentloaded', funcinit); so that this code will only be executed after the document object emits the 'domcontentloaded' event because the html has been parsed and javasript objects created representing each of the nodes of the html document.
Rich-Text Editing in Mozilla - Developer guides
getiframedocument("editorwindow").designmode = "on"; } function getiframedocument(aid){ // if contentdocument exists, w3c compliant (mozilla) if (document.getelementbyid(aid).contentdocument){ return document.getelementbyid(aid).contentdocument; } else { // ie return document.frames[aid].document; } } the example contains a doricheditcommand function that makes it easier to execute commands on the iframe's document and keeps the html code clean.
... the function executed the requested command using execcommand() and then sets focus back to the editable document, as clicking on a button will set focus on the button itself, which breaks the editing flow.
MIME types (IANA media types) - HTTP
discrete types the discrete types currently registered with the iana are: applicationlist at iana any kind of binary data that doesn't fall explicitly into one of the other types; either data that will be executed or interpreted in some way or binary data that requires a specific application or category of application to use.
...as it means unknown binary file, browsers usually don't execute it, or even ask if it should be executed.
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.
Expressions and operators - JavaScript
because theday is a date object, the statements in the if statement execute.
... var theday = new date(1995, 12, 17); if (theday instanceof date) { // statements to execute } operator precedence the precedence of operators determines the order they are applied when evaluating an expression.
Indexed collections - JavaScript
another way of iterating over an array: let colors = ['red', 'green', 'blue'] colors.foreach(function(color) { console.log(color) }) // red // green // blue alternatively, you can shorten the code for the foreach parameter with es2015 arrow functions: let colors = ['red', 'green', 'blue'] colors.foreach(color => console.log(color)) // red // green // blue the function passed to foreach is executed once for every item in the array, with the array item passed as the argument to the function.
... let a = ['a', 'b', 'c', 'd', 'a', 'b'] console.log(a.lastindexof('b')) // logs 5 // now try again, starting from before the last match console.log(a.lastindexof('b', 4)) // logs 1 console.log(a.lastindexof('z')) // logs -1 foreach(callback[, thisobject]) executes callback on every array item and returns undefined.
Iterators and generators - JavaScript
when called, generator functions do not initially execute their code.
...when a value is consumed by calling the generator's next method, the generator function executes until it encounters the yield keyword.
Using Promises - JavaScript
each callback is executed one after another, in the order in which they were inserted.
... chaining a common need is to execute two or more asynchronous operations back to back, where each subsequent operation starts when the previous operation succeeds, with the result from the previous step.
Inheritance and the prototype chain - JavaScript
when an inherited function is executed, the value of this points to the inheriting object, not to the prototype object where the function is an own property.
...// g.[[prototype]] is the value of graph.prototype when new graph() is executed.
Classes - JavaScript
strict mode the body of a class is executed in strict mode, i.e., code written here is subject to stricter syntax for increased performance, some otherwise silent errors will be thrown, and certain keywords are reserved for future versions of ecmascript.
...this behavior will be the same even if the "use strict" directive isn't present, because code within the class body's syntactic boundary is always executed in strict mode.
ReferenceError: assignment to undeclared variable "x" - JavaScript
declared variables are created before any code is executed.
... undeclared variables do not exist until the code assigning to them is executed.
Functions - JavaScript
for example: if (shoulddefinezero) { function zero() { // danger: compatibility risk console.log("this is zero."); } } es2015 says that if shoulddefinezero is false, then zero should never be defined, since the block never executes.
...historically, this was left unspecified, and some browsers would define zero whether the block executed or not.
Array.prototype.reduceRight() - JavaScript
syntax arr.reduceright(callback(accumulator, currentvalue[, index[, array]])[, initialvalue]) parameters callback function to execute on each value in the array, taking four arguments: accumulator the value previously returned in the last invocation of the callback, or initialvalue, if supplied.
... description reduceright executes the callback function once for each element present in the array, excluding holes in the array, receiving four arguments: the initial value (or value from the previous callback call), the value of the current element, the current index, and the array over which iteration is occurring.
Array.prototype.find() - JavaScript
syntax arr.find(callback(element[, index[, array]])[, thisarg]) parameters callback function to execute on each value in the array, taking 3 arguments: element the current element in the array.
... description the find method executes the callback function once for each index of the array until the callback returns a truthy value.
Array.prototype.findIndex() - JavaScript
syntax arr.findindex(callback( element[, index[, array]] )[, thisarg]) parameters callback a function to execute on each value in the array until the function returns true, indicating that the satisfying element was found.
... description the findindex() method executes the callback function once for every index in the array until it finds the one where callback returns a truthy value.
Boolean - JavaScript
for example, the condition in the following if statement evaluates to true: var x = new boolean(false); if (x) { // this code is executed } this behavior does not apply to boolean primitives.
... for example, the condition in the following if statement evaluates to false: var x = false; if (x) { // this code is not executed } do not use a boolean object to convert a non-boolean value to a boolean value.
Promise.all() - JavaScript
omise.all([1,2,3]); // this will be counted as if the iterable passed contains only the resolved promise with value "444", so it gets fulfilled var p2 = promise.all([1,2,3, promise.resolve(444)]); // this will be counted as if the iterable passed contains only the rejected promise with value "555", so it gets rejected var p3 = promise.all([1,2,3, promise.reject(555)]); // using settimeout we can execute code after the stack is empty settimeout(function() { console.log(p); console.log(p2); console.log(p3); }); // logs // promise { <state>: "fulfilled", <value>: array[3] } // promise { <state>: "fulfilled", <value>: array[4] } // promise { <state>: "rejected", <reason>: 555 } asynchronicity or synchronicity of promise.all this following example demonstrates the asynchronicity (or sy...
...nchronicity, if the iterable passed is empty) of promise.all: // we are passing as argument an array of promises that are already resolved, // to trigger promise.all as soon as possible var resolvedpromisesarray = [promise.resolve(33), promise.resolve(44)]; var p = promise.all(resolvedpromisesarray); // immediately logging the value of p console.log(p); // using settimeout we can execute code after the stack is empty settimeout(function() { console.log('the stack is now empty'); console.log(p); }); // logs, in order: // promise { <state>: "pending" } // the stack is now empty // promise { <state>: "fulfilled", <value>: array[2] } the same thing happens if promise.all rejects: var mixedpromisesarray = [promise.resolve(33), promise.reject(44)]; var p = promise.all(mixedpromisesarray)...
TypedArray.prototype.find() - JavaScript
syntax typedarray.find(callback[, thisarg]) parameters callback function to execute on each value in the typed array, taking three arguments: element the current element being processed in the typed array.
... description the find method executes the callback function once for each element present in the typed array until it finds one where callback returns a true value.
TypedArray.prototype.findIndex() - JavaScript
syntax typedarray.findindex(callback[, thisarg]) parameters callback function to execute on each value in the typed array, taking three arguments: element the current element being processed in the typed array.
... description the findindex method executes the callback function once for each element present in the typed array until it finds one where callback returns a true value.
TypedArray.prototype.reduce() - JavaScript
syntax typedarray.reduce(callback[, initialvalue]) parameters callback function to execute on each value in the typed array, taking four arguments: previousvalue the value previously returned in the last invocation of the callback, or initialvalue, if supplied (see below).
... description the reduce method executes the callback function once for each element present in the typed array, excluding holes in the typed array, receiving four arguments: the initial value (or value from the previous callback call), the value of the current element, the current index, and the typed array over which iteration is occurring.
TypedArray.prototype.reduceRight() - JavaScript
syntax typedarray.reduceright(callback[, initialvalue]) parameters callback function to execute on each value in the typed array, taking four arguments: previousvalue the value previously returned in the last invocation of the callback, or initialvalue, if supplied (see below).
... description the reduceright method executes the callback function once for each element present in the typed array, excluding holes in the typed array, receiving four arguments: the initial value (or value from the previous callback call), the value of the current element, the current index, and the typed array over which iteration is occurring.
Lexical grammar - JavaScript
they can also be used to disable code to prevent it from being executed; this can be a valuable debugging tool.
... the hashbang comment specifies the path to a specific javascript interpreter that you want to use to execute the script.
Conditional (ternary) operator - JavaScript
the conditional (ternary) operator is the only javascript operator that takes three operands: a condition followed by a question mark (?), then an expression to execute if the condition is truthy followed by a colon (:), and finally the expression to execute if the condition is falsy.
... expriffalse an expression which is executed if the condition is falsy (that is, has a value which can be converted to false).
Logical AND (&&) - JavaScript
see example: function a(){ console.log('called a'); return false; } function b(){ console.log('called b'); return true; } console.log( a() && b() ); // logs "called a" due to the function call, // then logs false (which is the resulting value of the operator) operator precedence the following expressions might seem equivalent, but they are not, because the && operator is executed before the || operator (see operator precedence).
... true || false && false // returns true, because && is executed first (true || false) && false // returns false, because operator precedence cannot apply examples using and the following code shows examples of the && (logical and) operator.
Logical OR (||) - JavaScript
see example: function a(){ console.log('called a'); return false; } function b(){ console.log('called b'); return true; } console.log( b() || a() ); // logs "called b" due to the function call, // then logs true (which is the resulting value of the operator) operator precedence the following expressions might seem equivalent, but they are not, because the && operator is executed before the || operator (see operator precedence).
... true || false && false // returns true, because && is executed first (true || false) && false // returns false, because operator precedence cannot apply examples using or the following code shows examples of the || (logical or) operator.
delete operator - JavaScript
var trees = ['redwood', 'bay', 'cedar', 'oak', 'maple']; delete trees[3]; if (3 in trees) { // this is not executed } if you want an array element to exist but have an undefined value, use the undefined value instead of the delete operator.
... in the following example, trees[3] is assigned the value undefined, but the array element still exists: var trees = ['redwood', 'bay', 'cedar', 'oak', 'maple']; trees[3] = undefined; if (3 in trees) { // this is executed } if instead, you want to remove an array element by changing the contents of the array, use the splice() method.
Navigation and resource timings - Web Performance
domcontentloadedeventstart right before the parser sent the domcontentloaded event, that is right after all the scripts that need to be executed right after parsing have been executed.
... domcontentloadedeventend right after all the scripts that need to be executed as soon as possible, in order or not, have been executed.
Optimizing startup performance - Web Performance
this allows html parsers to continue processing the document, instead of having to wait until the scripts have been downloaded and executed before continuing.
... emscripten provides an api to help with this refactoring; for example, you can use emscripten_push_main_loop_blocker() to establish a function to be executed before the main thread is allowed to continue.
Progressive loading - Progressive web apps (PWAs)
to fix that we can, for example, add defer to javascript files: <script src="app.js" defer></script> they will be downloaded and executed after the document itself has been parsed, so it won't block rendering the html structure.
... we won't do that because the app itself is dependent on javascript — without it, the list of games wouldn't even be loaded, and the service worker code wouldn't be executed.
Same-origin policy - Web security
rs http://store.company.com/dir/inner/another.html same origin only the path differs https://store.company.com/page.html failure different protocol http://store.company.com:81/dir/page.html failure different port (http:// is port 80 by default) http://news.company.com/dir/page.html failure different host inherited origins scripts executed from pages with an about:blank or javascript: url inherit the origin of the document containing that url, since these types of urls do not contain information about an origin server.
... for example, assume a script from the document at http://store.company.com/dir/other.html executes the following: document.domain = "company.com"; afterward, the page can pass the same-origin check with http://company.com/dir/page.html (assuming http://company.com/dir/page.html sets its document.domain to "company.com" to indicate that it wishes to allow that - see document.domain for more).
Understanding WebAssembly text format - WebAssembly
when a function is called, it starts with an empty stack which is gradually filled up and emptied as the body’s instructions are executed.
... next, we’ll load our binary into a typed array called addcode (as described in fetching webassembly bytecode), compile and instantiate it, and execute our add function in javascript (we can now find add() in the exports property of the instance): webassembly.instantiatestreaming(fetch('add.wasm')) .then(obj => { console.log(obj.instance.exports.add(1, 2)); // "3" }); note: you can find this example in github as add.html (see it live also).
Modules - Archive of obsolete content
the problem with breaking encapsulation like this is that malicious scripts can use it to get the loading script to execute arbitrary code, by overriding one of the methods on the built-in constructors.
Porting the Library Detector - Archive of obsolete content
unction(librarylist) { if (!worker.tab.libraries) { worker.tab.libraries = []; } librarylist.foreach(function(library) { if (worker.tab.libraries.indexof(library) == -1) { worker.tab.libraries.push(library); } }); if (worker.tab == tabs.activetab) { updatewidgetview(worker.tab); } }); } }); the content script is executed once for every window.onload event, so it will run multiple times when a single page containing multiple iframes is loaded.
hotkeys - Archive of obsolete content
if more than one hotkey is created for the same key combination, the listener is executed only on the last one created.
simple-storage - Archive of obsolete content
because jpm run by default uses a fresh profile each time it runs, simple storage won't work with add-ons executed using jpm run - that is, stored data will not persist from one run to the next.
core/promise - Archive of obsolete content
we are try-ing to execute readasync(): the error handler represents a catch for readasync(), while the value handler represents code that happens after the try/catch block.
event/core - Archive of obsolete content
emit(target, type, message, arguments) execute each of the listeners in order with the supplied arguments.
system/child_process - Archive of obsolete content
this module enables you to execute a child program in a new process.
test/utils - Archive of obsolete content
interval : number the frequency in milliseconds to execute predicate.
Low-Level APIs - Archive of obsolete content
loader/sandbox create javascript sandboxes and execute scripts in them.
cfx to jpm - Archive of obsolete content
entry point the add-on's entry point is the file that's executed when the add-on needs to initialize itself: for example, when firefox starts, or when the add-on's installed, enabled, or upgraded.
Adding a Button to the Toolbar - Archive of obsolete content
create a new directory, navigate to it, and execute jpm init, accepting all the defaults.
Displaying annotations - Archive of obsolete content
updating main.js finally, update main.js with the code to construct the annotation panel: var annotation = panels.panel({ width: 200, height: 180, contenturl: data.url('annotation/annotation.html'), contentscriptfile: [data.url('jquery-1.4.2.min.js'), data.url('annotation/annotation.js')], onshow: function() { this.postmessage(this.content); } }); execute cfx run one last time.
Listening for Load and Unload - Archive of obsolete content
exports.main() your add-on's main.js code is executed as soon as it is loaded.
Logging - Archive of obsolete content
the console.log() method prints an informational message: console.log("hello world"); try it out: create a new directory, and navigate to it execute jpm init, accepting all the defaults open "index.js" and add the line above execute jpm run firefox will start, and the following line will appear in the command window you used to execute jpm run: info: hello world!
Developing for Firefox Mobile - Archive of obsolete content
then execute jpm-mobile run with some extra options: jpm-mobile run --adb /path/to/adb in the command shell, you should see something like: launching mobile application with intent name org.mozilla.fennec pushing the addon to your device starting: intent { act=android.activity.main cmp=org.mozilla.fennec/.app (has extras) } --------- beginning of /dev/log/main --------- beginning of /dev/log/system could ...
Modifying the Page Hosted by a Tab - Archive of obsolete content
both scripts will be executed in the same context, so everything publicly defined in first.js will be accessible from second.js.
Unit Testing - Archive of obsolete content
at this point your add-on ought to look like this: /base64 /data icon-16.png package.json readme.md index.js base64.js /test test-base64.js now execute jpm --verbose test from the add-on's root directory.
Tutorials - Archive of obsolete content
modify web pages modify web pages based on url create filters for web pages based on their url: whenever a web page whose url matches the filter is loaded, execute a specified script in it.
Bootstrapped extensions - Archive of obsolete content
the script gets executed in a privileged sandbox, which is cached until the extension is shut down.
Dialogs and Prompts - Archive of obsolete content
be sure to use ondialog* attributes on dialog element instead of putting oncommand on the button with dlgtype, because button's oncommand is executed only when the button is pressed, and ondialog* handlers are executed for keyboard and other events too.
HTML to DOM - Archive of obsolete content
but, we still need to see how to execute the famous loaduri() method using our iframe: donkeybrowser.webnavigation.loaduri("http://developer.mozilla.org", components.interfaces.nsiwebnavigation, null, null, null); also, i recommend you take a look at the nsiwebnavigation interface.
Page Loading - Archive of obsolete content
page loading on page load how to execute code each time a new page is loaded in browser/mail progress listeners progress listeners allow extensions to be notified of events associated with documents loading in the browser and with tab switching events.
Progress Listeners - Archive of obsolete content
note that if you just want to execute your code each time a page loads, you can use an an easier method, onpageload().
Rosetta - Archive of obsolete content
now, all you need is to include rosetta.js and your compiler within your html page and you will be able to execute scripts written in c together with scripts written in ecmascript: example.html: html example <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>rosetta c example</title> <script type="text/javascript" src="rosetta.js"></script> <script type="text/javascript" src="rosetta_c.js"></script> <script type="text/x-csrc"> #include <stdio.h> int ...
Delayed Execution - Archive of obsolete content
queuing a task in the main event loop when a task needs to be only briefly delayed, such that it runs after the current call chain returns, it can be added directly to the main thread's event queue rather than scheduled as a timeout: function executesoon(func) { services.tm.mainthread.dispatch(func, ci.nsithread.dispatch_normal); } using nsitimers to schedule tasks in instances where settimeout() and setinterval() are unavailable, or insufficient, tasks can be scheduled with delays using nsitimer instances.
JavaScript Daemons Management - Archive of obsolete content
daemon instances properties mydaemon.owner the this object on which is executed the daemon (read/write).
Communication between HTML and your extension - Archive of obsolete content
// you can use it to make your code executed on certain pages only.
Enhanced Extension Installation - Archive of obsolete content
after the upgrade finalization routine executes, it unsets the tobeuninstalled flag and sets the tobeinstalled flag to trigger the item's files to be replaced from the staged xpi.
Inline options - Archive of obsolete content
tting pref="extensions.throbberrestored.showtxtontoolbar" title="show text on toolbar button" type="bool" oninputchanged="alert('new value is = ' + this.value); this.style.backgroundcolor='red';"> if labels on other toolbar buttons are visible (like by using add-on "classic theme restorer") then show label on throbber toolbar button </setting> note in order for the oninputchanged to execute, the setting must have a pref attribute, otherwise the oninputchanged will not trigger.
Listening to events in Firefox extensions - Archive of obsolete content
if the page contains scripts or other behaviors that fire during loading that you want to continue to execute every time the user navigates to the page, or if you want to know when a user has navigated to a cached page, use the new pageshow event.
Appendix: What you should know about open-source software licenses - Archive of obsolete content
range of uses restricted to author unrestricted book print, publish, revise read music record, perform, revise listen movie distribute, screen, revise watch software copy, distribute, modify execute licenses are a use permit in order to use (in the authorial sense) a copyrighted work, the user must either receive a use permit from the copyright holder, or must be assigned partial rights by the author.
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
figure 7: menu items with icons executing commands when selecting menu items much like dynamic html, event handlers are used to execute a command when a menu item is selected.
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
nsilocalfile.isexecutable() determines whether or not the file can be executed.
Connecting to Remote Content - Archive of obsolete content
since eval executes any code contained in the string, workarounds had to be devised in order to close security holes.
Setting Up a Development Environment - Archive of obsolete content
you can even change styles, attributes and execute javascript code in it, although that's not completely reliable.
The Essentials of an Extension - Archive of obsolete content
most of these files are opened as text files, with the exception of xul files, which are executed and displayed like you would normally see them on a window.
Performance best practices in extensions - Archive of obsolete content
consider using chrome workers you can use a chromeworker to execute long running tasks or do data processing.
Session store API - Archive of obsolete content
value associated with a tab at any time (whether the tab is in the process of being restored or not), using code similar to the following: var ss = components.classes["@mozilla.org/browser/sessionstore;1"] .getservice(components.interfaces.nsisessionstore); var currenttab = gbrowser.selectedtab; var retrieveddata = ss.gettabvalue(currenttab, "key-name-here"); after this code executes, the variable retrieveddata contains the value saved for the key "key-name-here".
Setting up an extension development environment - Archive of obsolete content
chromebug combines elements of a javascript debugger and dom (firefox, "kinda works for thunderbird") mozrepl explore and modify firefox and other mozilla apps while they run (firefox, thunderbird version is not working) executejs an enhanced javascript console (firefox version, thunderbird version is not working) xpcomviewer an xpcom inspector (firefox and thunderbird) javascript shells to test snippets of javascript (firefox and thunderbird) sqlite manager to manage the sqlite database (firefox and thunderbird) viewabout enables access to various about: dialogs from the view menu (firefox version, thunderbird versi...
Adding preferences to an extension - Archive of obsolete content
(yhoo)" oncommand="stockwatcher.watchstock('yhoo')"/> </menupopup> </popupset> each item in the menu has a label property, which specifies the text displayed in the menu, as well as an oncommand property, which indicates the javascript code to execute when the user selects that item.
Creating a dynamic status bar extension - Archive of obsolete content
ckwatcher/content/stockwatcher.js"/> <!-- firefox --> <statusbar id="status-bar"> <statusbarpanel id="stockwatcher" label="loading..." tooltiptext="current value" onclick="stockwatcher.refreshinformation()" /> </statusbar> </overlay> also, notice that the definition of the status bar panel now includes a new property, onclick, which references the javascript function that will be executed whenever the user clicks on the status bar panel.
MozBeforeResize - Archive of obsolete content
the mozbeforeresize event is executed before a browser window is resized.
Working with BFCache - Archive of obsolete content
freezing suspends timeouts and interval timers on the frozen window, so they won't execute.
Automated testing tips and tricks - Archive of obsolete content
in test scripts, <code>sleep 5 after the above command should ensure the profile is created before the next command in the test script is run how to enable dump in a new profile add user_pref("browser.dom.window.dump.enabled", true); to profiledir/user.js how to execute test code with chrome privileges using a chrome doc - see sbtests.xul in http://people.mozilla.com/~davel/scripts/ for an example firefox-bin -p sbtestprofile -chrome chrome://sbtests/content/ above code calls the quit function in quit.js to exit after test is finished how to detect content onload event from chrome use the domcontentloaded event c...
Enabling the behavior - retrieving tinderbox status - Archive of obsolete content
we use new to create a new instance of it, set the instance's onload property to updatetinderboxstatus(), the function we want to execute when the document finishes loading, call its open method with the type of http request we want to make and the url of the document to retrieve, and then call its send method to send the request.
Downloading Nightly or Trunk Builds - Archive of obsolete content
trunk builds are provided so that one can execute tests without going to the trouble of building the source.
Layout System Overview - Archive of obsolete content
the presentation shell owns and maintains a reflow queue where requests for reflow are held until it is time to perform a reflow, and then pulled out and executed.
Code snippets - Archive of obsolete content
all of the in this page must be executed in a chrome-privileged console.
JavaScript Client API - Archive of obsolete content
reason for this is, weave will iterate through the registerengines preference and try to instantiate each engine it has there before you the line mentioned above ever has a chance to execute.this means the constructor to your engine is not ready when weave tries to instantiate it.
generateCRMFRequest() - Archive of obsolete content
"crmf generation done code" this parameter is javascript to execute when the crmf generation is complete.
Content - Archive of obsolete content
execute callbacks when certain pages are opened siteboost allows a jetpack to empower a domain with extended abilities beyond those native to web pages ...
Selection - Archive of obsolete content
jetpack.import.future("selection");jetpack.selection.text = 'hello';jetpack.selection.html = '<b>hello</b>'; methods onselection(func function)this method allows you to execute an event function when a selection is made.
Selection - Archive of obsolete content
jetpack.import.future("selection"); jetpack.selection.text = 'hello'; jetpack.selection.html = '<b>hello</b>'; methods onselection(func function)this method allows you to execute an event function when a selection is made.
Selection - Archive of obsolete content
ArchiveMozillaJetpackdocsUISelection
jetpack.import.future("selection"); jetpack.selection.text = 'hello'; jetpack.selection.html = '<b>hello</b>'; methods onselection(func function)this method allows you to execute an event function when a selection is made.
Mozilla Application Framework in Detail - Archive of obsolete content
xpinstall makes it easy to write both simple installation scripts and complex installations that check versions, log installation data to the local system, execute other installers, and update the appropriate registry settings.
New Security Model for Web Services - Archive of obsolete content
the problem external untrusted scripts loaded behind a firewall are executed in a sandbox.
Bundles - Archive of obsolete content
after the .webapp file is executed the first time, these files will be unzipped and "cached" to a local directory structure.
Tamarin Acceptance Test Template - Archive of obsolete content
this executes the test cases and // displays results.
Tamarin build documentation - Archive of obsolete content
execute the following commands to build: $ cd tamarin-central/platform/unix $ make the resulting executable "shell" is built in the current directory.
Methods - Archive of obsolete content
execute queues a file for executing as part of the installation process.
Methods - Archive of obsolete content
execute extracts a file from the xpi file to a temporary location and schedules it for later execution.
A XUL Bestiary - Archive of obsolete content
to create an event handler, simple place the code you want executed within the appropriate event listener: <menuitem value="click me" onclick="alert('event handled.')" /> it follows from the description above that event handlers can be written for events that are fired somewhere below them in the hierarchy.
onbookmarkgroup - Archive of obsolete content
« xul reference home onbookmarkgroup not in firefox type: script code this code executes when the user chooses the "bookmark this group of tabs" command.
reserved - Archive of obsolete content
this means that, to execute these commands, key events won't be passed to content, and event listeners registered for them in content will not be executed.
CheckboxStateChange - Archive of obsolete content
the checkboxstatechange event is executed when the state of a <checkbox> element has changed.
DOMMenuItemActive - Archive of obsolete content
the dommenuitemactive event is executed when a <menu> or a <menuitem> has been hovered or highlighted.
DOMMenuItemInactive - Archive of obsolete content
the dommenuiteminactive event is executed when a <menu> or a <menuitem> in no longer hovered or highlighted.
RadioStateChange - Archive of obsolete content
the radiostatechange event is executed when the state of a <radio> element has changed.
ValueChange - Archive of obsolete content
the valuechange event is executed when the value of an element, <progress> for example, has changed.
broadcast - Archive of obsolete content
the broadcast event is executed when the attributes of the element (such as a broadcaster) being listened to are changed.
close - Archive of obsolete content
the close event is executed when a request has been made to close the window when the user presses the close button.
command - Archive of obsolete content
ArchiveMozillaXULEventscommand
the command event is executed when an element is activated.
commandupdate - Archive of obsolete content
the commandupdate event is executed when a command update occurs on a <commandset>.
popuphidden - Archive of obsolete content
the popuphidden event is executed when a <menupopup>, <panel> or <tooltip> has become hidden.
popuphiding - Archive of obsolete content
the popuphiding event is executed when a <menupopup>, <panel> or <tooltip> is about to be hidden.
popupshowing - Archive of obsolete content
the popupshowing event is executed when a <menupopup>, <panel> or <tooltip> is about to become visible.
popupshown - Archive of obsolete content
the popupshown event is executed when a <menupopup>, <panel> or <tooltip> has become visible.
Getting File Information - Archive of obsolete content
nsifile.isexecutable() - returns true if the file can be executed.
doCommand - Archive of obsolete content
« xul reference home docommand() return type: no return value executes the command event for the element.
openPopup - Archive of obsolete content
it affects menu item highlighting; that is, while a context menu is open, menus opened earlier do not highlight or execute their items.
MenuItems - Archive of obsolete content
from within a command listener, you can execute code which will change the state of the toolbar or status bar or whatever it is that need changing.
Menus - Archive of obsolete content
this is useful when you wish to have several elements performing the same action, for example a menuitem on a menubar, a context menu, and a toolbar button, because you can place the code to execute only once on the command and hook each element up to the command.
Using Recursive Templates - Archive of obsolete content
the same query is executed again but using the groups generated from the previous execution of the query.
The Joy of XUL - Archive of obsolete content
xpinstall xpinstall, mozilla's cross platform install facility, provides a standard way of packaging xul application components with an install script that mozilla can download and execute.
Creating toolbar buttons (Customize Toolbar Window) - Archive of obsolete content
set the command to be executed when the button is clicked in the oncommand attribute.
Adding Methods to XBL-defined Elements - Archive of obsolete content
the body element contains the script that is executed when the method is called.
Additional Install Features - Archive of obsolete content
functions also exist to move(), rename() and execute() files.
Commands - Archive of obsolete content
docommand (command) execute the command.
Creating Dialogs - Archive of obsolete content
the following values may be used, seperated by commas: accept - an ok button cancel - a cancel button help - a help button disclosure - a disclosure button, which is used for showing more information you can set code to execute when the buttons are pressed using the ondialogaccept, ondialogcancel, ondialoghelp and ondialogdisclosure attributes.
Focus and Selection - Archive of obsolete content
it takes three parameters, the event type, a function to execute when the event occurs and a boolean indicating whether to capture or not.
Using the Editor from XUL - Archive of obsolete content
that causes the editoronload() javascript function to get executed when the xul is done loading.
XUL Event Propagation - Archive of obsolete content
any element that is interested in the event -- any part of the interface, in other words, that needs to know about and respond to the user's click action on the button -- "handles" the event with an event handler, or chunk of code to be executed when the given event is "heard".
command - Archive of obsolete content
this means that, to execute these commands, key events won't be passed to content, and event listeners registered for them in content will not be executed.
menulist - Archive of obsolete content
the command event may be used to execute code when the menulist selection changes.
menupopup - Archive of obsolete content
it affects menu item highlighting; that is, while a context menu is open, menus opened earlier do not highlight or execute their items.
panel - Archive of obsolete content
ArchiveMozillaXULpanel
it affects menu item highlighting; that is, while a context menu is open, menus opened earlier do not highlight or execute their items.
preferences - Archive of obsolete content
also executes code specified in onchanged attribute of the element.
tabbrowser - Archive of obsolete content
onbookmarkgroup not in firefox type: script code this code executes when the user chooses the "bookmark this group of tabs" command.
tooltip - Archive of obsolete content
it affects menu item highlighting; that is, while a context menu is open, menus opened earlier do not highlight or execute their items.
Building XULRunner with Python - Archive of obsolete content
s moz_co_project=xulrunner ac_add_options --enable-application=xulrunner ac_add_options --enable-extensions=python,default ac_add_options --disable-javaxpcom ac_add_options --disable-activex ac_add_options --disable-activex-scripting ac_add_options --disable-tests ac_add_options --enable-optimize to check out all the required source code and build it the first time with no local client.mk file, execute cd /c/projects cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/client.mk cd mozilla make -f client.mk for subsequent updates from cvs followed by a build, use cd /c/projects/mozilla make -f client.mk which will also checkout client.mk itself for build only, without checkouts, use make -f client.mk build and see client.mk for other options.
Dialogs in XULRunner - Archive of obsolete content
ondialogaccept javascript to execute if the accept button is pressed; similar attributes exist for the other button types.
Getting started with XULRunner - Archive of obsolete content
windows from a windows command prompt opened to the myapp folder, we should be able to execute this: c:\path\to\xulrunner.exe application.ini of course, if you opted to install xulrunner then you could simply do ​%programfiles%\xulrunner.exe application.ini or on 64 bit systems ​%programfiles(x86)%\xulrunner.exe application.ini note: you can also install your application when you're finished debugging it.
XULRunner Hall of Fame - Archive of obsolete content
slimerjs slimerjs is a xulrunner application that can be launched with firefox, allowing to execute an external javascript script which can manipulate web content.
2006-10-20 - Archive of obsolete content
when the method is executed firefox crashes.
2006-10-06 - Archive of obsolete content
summary: mozilla.dev.builds - september 30th to october 6th 2006 tb mozilla_1_8_branch build problem on mac os x (10.4.7, universal build) ludwig hügelschäfer stated that he has been encountering an error when he executes a "make export" operation on thunderbird (part of the mozilla_1_8_branch) since september 15th.
2006-10-20 - Archive of obsolete content
nsis and my extension jan vávra is wondering how he could create a win32 installer of thunderbird that when executed, it would also install his extensions of choice.
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.
Plugins - Archive of obsolete content
firefox 3.6.4 introduced out-of-process plugins which execute in a separate process so that a crashing plugin does not crash the browser.
Confidentiality, Integrity, and Availability - Archive of obsolete content
if an attacker is not able to compromise the first two elements of information security (see above) they may try to execute attacks like denial of service that would bring down the server, making the website unavailable to legitimate users due to lack of availability.
Using workers in extensions - Archive of obsolete content
= new xmlhttprequest(); httprequest.open("get", fullurl, true); httprequest.onload = inforeceived; httprequest.send(null); } setinterval(function() { refreshinformation(); }, 10*60*1000); onmessage = function(event) { if (event.data) { symbol = event.data.touppercase(); } refreshinformation(); } when the worker thread is started, the main body of this code (in lines 26-35) is executed.
E4X for templating - Archive of obsolete content
inline functions as explained in the tutorial, it is possible to use anonymous functions inline (returning the desired content, including potentially xmllist's) in order to execute more than a single related statement, keeping this logic together with the resulting xml.
Generator comprehensions - Archive of obsolete content
generator comprehensions are syntactically almost identical to array comprehensions — they use parentheses instead of braces— but instead of building an array they create a generator that can execute lazily.
@if - Archive of obsolete content
the @if statement conditionally executes a group of statements, depending on the value of an expression.
New in JavaScript 1.2 - Archive of obsolete content
javascript versions netscape navigator 4.0 executes javascript language versions up to 1.2.
New in JavaScript 1.3 - Archive of obsolete content
javascript versions netscape communicator and navigator 4.06 and 4.5 executes javascript language versions up to 1.3.
New in JavaScript 1.8.1 - Archive of obsolete content
new features in javascript 1.8.1 object.getprototypeof() support for native json string.prototype.trim() string.prototype.trimleft() string.prototype.trimright() changed functionality in javascript 1.8.1 implicit setting of properties in object and array initializers no longer execute setters in javascript.
Object.prototype.__noSuchMethod__ - Archive of obsolete content
the __nosuchmethod__ property used to reference a function to be executed when a non-existent method is called on an object, but this function is no longer available.
Examples - Archive of obsolete content
</p> <dl> <dt>mozilla 1.1+/opera 7</dt> <dd>do not apply css or execute the javascript.</dd> <dt>netscape 7.0x/mozilla 1.0.x</dt> <dd>do not apply css but does execute the javascript.</dd> <dt>internet explorer 5.5+</dt> <dd>can not display the document.</dd> </dl> <p> <a href="http://validator.w3.org/check/referer"><img src="https://udn.realityripple.com/samples/8a/9e64asf935.png" alt="valid xhtml 1.0!" height="31" width="88" /></a> </p> </b...
StopIteration - Archive of obsolete content
function f() { yield 1; yield 2; throw stopiteration; yield 3; // this is not executed.
Reference - Archive of obsolete content
<script language="javascript1.2"> will execute the script in the latest js version rather than js 1.2.
Popup Window Controls - Archive of obsolete content
mozilla will attempt to suppress all calls to window.open() which occur in the following circumstances: global script which is executed as the document is loading script executed as part of a onload event handler script executed in settimeout() or setinterval() what popup windows are not suppressed?
bootstrap.js - Extensions
the script gets executed in a privileged sandbox, which is cached until the extension is shut down.
Index - Game development
glsl is executed directly by the graphics pipeline.
Building up a basic demo with Babylon.js - Game development
var renderloop = function () { scene.render(); }; engine.runrenderloop(renderloop); we're using the engine's runrenderloop() method to execute the renderloop() function repeatedly on every frame — the loop will continue to render indefinitely until told to stop.
Building up a basic demo with the PlayCanvas engine - Game development
there's a special update event that we can use for that — add the following code just below the previous additions: var timer = 0; app.on("update", function (deltatime) { timer += deltatime; // code executed on every frame }); the callback takes the deltatime as the parameter, so we have the relative time that has passed since the previous invocation of this update.
3D games on the Web - Game development
shaders use glsl, a special opengl shading language, with syntax similar to c, that is executed directly by the graphics pipeline.
Efficient animation for web games - Game development
when the callback is executed, you can unset that flag so that calls to that function will request a new frame again, like this: function redraw() { drawpending = false; // do drawing ...
Finishing up - Game development
ar interval = setinterval(draw, 10); with simply: draw(); and remove each instance of: clearinterval(interval); // needed for chrome to end game then, at the very bottom of the draw() function (just before the closing curly brace), add in the following line, which causes the draw() function to call itself over and over again: requestanimationframe(draw); the draw() function is now getting executed again and again within a requestanimationframe() loop, but instead of the fixed 10 milliseconds frame rate, we are giving control of the framerate back to the browser.
Move the ball - Game development
the draw() function will be executed within setinterval every 10 miliseconds: function draw() { // drawing code } setinterval(draw, 10); thanks to the infinite nature of setinterval the draw() function will be called every 10 milliseconds forever, or until we stop it.
Paddle and keyboard controls - Game development
add the following lines just above the setinterval() line at the bottom of your javascript: document.addeventlistener("keydown", keydownhandler, false); document.addeventlistener("keyup", keyuphandler, false); when the keydown event is fired on any of the keys on your keyboard (when they are pressed), the keydownhandler() function will be executed.
Buttons - Game development
add the following lines to the bottom of your create() function: 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.
Collision detection - Game development
the third, optional parameter is the function executed when a collision occurs — ballhitbrick().
Game over - Game development
add the following lines just below the previous new one: ball.checkworldbounds = true; ball.events.onoutofbounds.add(function(){ alert('game over!'); location.reload(); }, this); adding those lines will make the ball check the world (in our case canvas) bounds and execute the function bound to the onoutofbounds event.
Initialize the framework - Game development
preload takes care of preloading the assets create is executed once when everything is loaded and ready update is executed on every frame.
Move the ball - Game development
the code inside it is executed on every frame, so it's a perfect place to put the code that will update the ball's position on screen.
Visual-js game engine - Game development
add->new game object (form dialog for define type of new game object ) add->quick code (make your work faster - add usually code blocks) resources - explorer view for images and audios , you can drag or edit also need to execute node build_resources for creating resources object for engine.
CSRF - MDN Web Docs Glossary: Definitions of Web-related terms
this can be done, for example, by including malicious parameters in a url behind a link that purports to go somewhere else: <img src="https://www.example.com/index.php?action=delete&id=123"> for users who have modification permissions on https://www.example.com, the <img> element executes action on https://www.example.com without their noticing, even if the element is not at https://www.example.com.
Compile - MDN Web Docs Glossary: Definitions of Web-related terms
a compiler is a software to execute this task.
Cross-site scripting - MDN Web Docs Glossary: Definitions of Web-related terms
this code is executed by the victims and lets the attackers bypass access controls and impersonate users.
Engine - MDN Web Docs Glossary: Definitions of Web-related terms
the javascript engine is an interpreter that parses and executes a javascript program.
Fetch directive - MDN Web Docs Glossary: Definitions of Web-related terms
for instance, script-src allows developers to allow trusted sources of script to execute on a page, while font-src controls the sources of web fonts.
First input delay - MDN Web Docs Glossary: Definitions of Web-related terms
the time between when content is painted to the page and when all the functionality becomes responsive to human interaction often varies based on the the size and complexity of the javascript needing to be downloaded, parsed, and executed on the main thread, and on the device speed or lack thereof (think low end mobile devices).
Global scope - MDN Web Docs Glossary: Definitions of Web-related terms
in client-side javascript, the global scope is generally the web page inside which all the code is being executed.
Hoisting - MDN Web Docs Glossary: Definitions of Web-related terms
learn more technical example one of the advantages of javascript putting function declarations into memory before it executes any code segment is that it allows you to use a function before you declare it in your code.
IIFE - MDN Web Docs Glossary: Definitions of Web-related terms
examples the function becomes a function expression which is immediately executed.
Parse - MDN Web Docs Glossary: Definitions of Web-related terms
javascript is also downloaded, parsed, and then execute.
Primitive - MDN Web Docs Glossary: Definitions of Web-related terms
these copies, existing only inside the functions' scopes, are accessible via the identifiers we specified in the functions' definitions (num for addtwo, foo for addtwo_v2) then, the functions' statements are executed: in the first function, a local num variable had been created.
SISD - MDN Web Docs Glossary: Definitions of Web-related terms
in sisd architecture, a single processor executes a single instruction and operates on a single data point in memory.
Thread - MDN Web Docs Glossary: Definitions of Web-related terms
this allows slow, complex, or long-running tasks to be executed independently of the main thread, preserving the overall performance of the site or app—as well as that of the browser overall.
Truthy - MDN Web Docs Glossary: Definitions of Web-related terms
examples of truthy values in javascript (which will be coerced to true in boolean contexts, and thus execute the if block): if (true) if ({}) if ([]) if (42) if ("0") if ("false") if (new date()) if (-42) if (12n) if (3.14) if (-3.14) if (infinity) if (-infinity) specifications specification ecmascript (ecma-262)the definition of 'toboolean abstract operation' in that specification.
How to build custom form controls - Learn web development
the user is interacting with the content before the javascript has been fully downloaded, parsed, and executed.
Sending form data - Learn web development
when this code is executed, the output in the browser is hi mom.
Sending forms through JavaScript - Learn web development
if you control the front-end (the code that's executed in the browser) and the back-end (the code which is executed on the server), you can send json/xml and process them however you want.
JavaScript basics - Learn web development
it's possible to define a body of code as a function that executes when you call the function name in your code.
General asynchronous programming concepts - Learn web development
when a web app runs in a browser and it executes an intensive chunk of code without returning control to the browser, the browser can appear to be frozen.
Functions — reusable blocks of code - Learn web development
in fact, some of the code you are calling when you invoke (a fancy word for run, or execute) a built in browser function couldn't be written in javascript — many of these functions are calling parts of the background browser code, which is written largely in low-level system languages like c++, not web languages like javascript.
Function return values - Learn web development
so when you execute the following: ctx.arc(random(width), random(height), random(50), 0, 2 * math.pi); if the three random() calls returned the values 500, 200, and 35, respectively, the line would actually be run as if it were this: ctx.arc(500, 200, 35, 0, 2 * math.pi); the function calls on the line are run first, and their return values substituted for the function calls, before the line itself is then execu...
Making decisions in your code — conditionals - Learn web development
the following example executes the code inside only if both or statements return true, meaning that the overall and statement will return true: if ((x === 5 || y > 3 || z <= 10) && (loggedin || username === 'steve')) { // run the code } a common mistake when using the logical or operator in conditional statements is to try to state the variable whose value you are checking once, and then give a list of values it could be ...
Client-side storage - Learn web development
note: in the line <script src="index.js" defer></script> of the source for our finished version, the defer attribute specifies that the contents of the <script> element will not execute until the page has finished loading.
Solve common problems in your JavaScript code - Learn web development
making decisions in code how do you execute different blocks of code, depending on a variable's value or other condition?
What is web performance? - Learn web development
the download of additional assets linked to from the index file is generally sequential, based on source order, but this can be manipulated and should definitely be optimized, realizing that some resources block additional downloads until their content is parsed and executed.
Properly configuring server MIME types - Learn web development
an executable program should not be executed on the user's computer and at most should cause a dialog to appear asking the user if they wish to download the file.
Accessibility in React - Learn web development
change the import statement of todo.js again to add useeffect: import react, { useeffect, useref, usestate } from "react"; useeffect() takes a function as an argument; this function is executed after the component renders.
Deployment and next steps - Learn web development
there are no additional runtimes or dependencies to download, parse, execute, and keep running in memory.
Focus management with Vue refs - Learn web development
this method accepts a callback function, which then executes after the dom updates.
Application cache implementation overview
if no nsiapplicationcache object has been found, there is no offline cache to load from and the load continues a usual way by loading from normal http cache, further steps are not executed.
Browser chrome tests
since the test files are executed in the same scope as the browser window, conflicting variable names could cause trouble while running the tests.
Chrome registration
note: scripts (including those found in xbl) loaded from skin packages will not execute.
Command line options
execute the specified remote_command in an already running application process.
Debugging on Mac OS X
during the debugging session, each time that line is executed, the debugger will break there, and you will be able to debug it.
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.
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.
Limitations of frame scripts
since frame and process scripts often execute in remote content processes these scripts are subject to the same file access rules placed on remote content.
Message manager overview
this is the recommended way to load a script that executes just once per child process, which is something you might want to do if you are interacting with some global service (for example, adding listeners to observer notifications or registering a content policy).
Tracking Protection
for example, if your site includes a callback that runs when content from a tracking site is loaded, then the callback will not execute.
HTMLIFrameElement.findAll()
casesensitivity a string to declare whether you want the search to be case sensitive (case-sensitive) or insensitive (case-insensitive.) example the following function is taken from our browser api demo, and executes a search when a search form is submitted.
mozbrowsercaretstatechanged
commands an object that defines what commands can currently be executed in the browser <iframe>.
mozbrowserselectionstatechanged
commands an object that stores information about what commands can be executed on the current selection.
Browser API
htmliframeelement.executescript() allows a specified script to be executed against a page loaded in the browser <iframe>.
Gecko Keypress Event
i.e., ctrl+shift+'c' should not execute ctrl+'c' (bug 433192).
How to add a build-time test
writing a test is good, but it is even more helpful if that test gets executed.
How to get a stacktrace with WinDbg
a: if you see 'int 3' after either of those exceptions, you will need to execute the following commands in windbg.
JavaScript Tips
for instance the offline observer declared above is a javascript object that is registered with an xpcom object, so that the call back from xpcom executes the javascript method.
Add-on Manager
for example: components.utils.import("resource://gre/modules/addonmanager.jsm"); addonmanager.getalladdons(function(aaddons) { // here aaddons is an array of addon objects }); // this code will execute before the code inside the callback notifications about changes to installed add-ons are dispatched to any registered addonlisteners.
Interfacing with the Add-on Repository
handling failed requests the callback object must have a searchfailed() method; this gets called when a repository search fails to execute.
SVN for Localizers
go back to the root of your working directory and execute this command: svn revert * this is a really helpful command because it reverts all of your changes to your working directory's last updated state.
Mozilla DOM Hacking Guide
the body of the "if" clause is thus executed.
Gecko Profiler FAQ
it only knows what function was executed and what line this function starts at.
JS::PerfMeasurement
the current implementation can measure eleven different types of low-level hardware and software events: events that can be measured bitmask passed to constructor counter variable what it measures perfmeasurement::cpu_cycles .cpu_cycles raw cpu clock cycles ::instructions .instructions total instructions executed ::cache_references .cache_references total number of memory accesses ::cache_misses .cache_misses memory accesses that missed the cache ::branch_instructions .branch_instructions branch instructions executed ::branch_misses .branch_misses branch instructions that were not predicted correctly ::bus_cycles...
Measuring performance using the PerfMeasurement.jsm code module
for instance, let's measure instructions executed, cache references, and cache misses: let monitor = new perfmeasurement(perfmeasurement.cpu_cycles | perfmeasurement.cache_references | perfmeasurement.cache_misses); this creates a new perfmeasurement object, configured to record the specified event types.
Power profiling overview
c0 is the active/busy state, where instructions are being executed.
Profiling with Xperf
once the sdk installs, execute either wpt_x86.msi or wpt_x64.msi in the redist/windows performance toolkit folder of the sdk's install location (typically program files/microsoft sdks/windows/v7.1/redist/windows performance toolkit) to actually install the windows performance toolkit tools.
Profiling with the Firefox Profiler
a profile reporting that a large portion is spent in "unknown" code indicates that the area being executed doesn't have any sample labels.
perf
the -r 1 means <command> is executed once; higher values can be used to get variations.
javascript.options.strict
javascript warnings are generated when code is executed that doesn't cause a run-time error, but is non-standard, poorly written, or prone to cause logic errors.
Emscripten
emscripten generates fast code — its default output format is asm.js , a highly optimizable subset of javascript that can execute at close to native speed in many cases.
NSPR build instructions
on mac os x, they can be executed with the following: /bin/sh: $ cd pr/tests $ dyld_library_path=../../dist/lib ./accept pass $ $ # to run all the nspr tests...
Dynamic Library Linking
for example, link your executable program a.out without the +s option, then execute the following: chatr +s enable a.out on rhapsody, the environment variable is dyld_library_path.
PRCallOnceType
inprogress if not zero, the initialization process is currently being executed.
PR_CallOnce
while the first thread executes this function, other threads attempting the same initialization will be blocked until it has been completed.
PR_QueueJob
fn the function to be executed when the job is executed.
PR_QueueJob_Accept
fn the function to be executed when the job is executed.
PR_QueueJob_Connect
fn the function to be executed when the job is executed.
PR_QueueJob_Read
fn the function to be executed when the job is executed.
PR_QueueJob_Timer
fn the function to be executed when the job is executed.
PR_QueueJob_Write
fn the function to be executed when the job is executed.
Process Management and Interprocess Communication
the newly-created process executes its program from the beginning.
An overview of NSS Internals
because public key encryption is more expensive (more calculations required) than symmetric encryption (where both parties use the same key), a key agreement protocol will be executed, where the public and private keys are used to proof and verify the exchanged initial information.
NSS 3.24 release notes
new functionality nss softoken has been updated with the latest national institute of standards and technology (nist) guidance (as of 2015): software integrity checks and post functions are executed on shared library load.
NSS sources building testing
inside the directory you'll find text file output.log, which contains a detailed report of all tests being executed.
Python binding for NSS
this allows other python threads to execute during the time a nss/nspr function is progress in another thread.
Build instructions
(the free edition works, and other versions like visual studio 2008 and visual studio 2012 may also work.) use start-shell-msvc2010.bat from mozillabuild to get a bash shell with the path already configured, and execute these instructions from within that bash shell.
NSS tools : ssltab
the simplest way to use the debugging tool is to execute the following command from a command shell: $ ssltap www.netscape.com the program waits for an incoming connection on the default port 1924.
NSS tools : ssltap
the simplest way to use the debugging tool is to execute the following command from a command shell: $ ssltap www.netscape.com the program waits for an incoming connection on the default port 1924.
NSS Tools ssltap
the simplest way to use the debugging tool is to execute the following command from a command shell: ssltap www.netscape.com:80 the program waits for an incoming connection on the default port 1924.
NSS tools : ssltap
MozillaProjectsNSStoolsssltap
the simplest way to use the debugging tool is to execute the following command from a command shell: $ ssltap www.netscape.com the program waits for an incoming connection on the default port 1924.
Small Footprint
rhino will continue to run, although it will not be able to execute any regular expression matches.
Rhino JavaScript compiler
the resulting java class files can then be loaded and executed at another time, providing a convenient method for transferring javascript, and for avoiding translation cost.
Rhino optimization
so if a script is compiled with the context's optimizationlevel set to 1, it will be executed with those optimizations, regardless of the optimizationlevel of the context in which it is executed.
Performance Hints
calls to eval are slow because the script being executed must be compiled.
The JavaScript Runtime
contexts and threads every thread that executes javascript must have an associated context.
Scripting Java
blic string g(string s, int i) { return "g(string,int)"; } public string g(int i, string s) { return "g(int,string)"; } public static void main(string[] args) { overload o = new overload(); object[] a = new object[] { new integer(3), "hi", overload.class }; for (int i = 0; i != a.length; ++i) system.out.println(o.f(a[i])); } } when we compile and execute the program, it produces the output f(object) f(object) f(object) however, if we write a similar script var o = new packages.overload(); var a = [ 3, "hi", packages.overload ]; for (var i = 0; i != a.length; ++i) print(o.f(a[i])); and execute it, we get the output f(int) f(string) f(object) because rhino selects an overloaded method at runtime, it calls the more specific type that ma...
Bytecodes
within the engine, all bytecode execute within a stack frame -- even global (top-level) and eval code has a stack frame associated with it.
Property cache
when recording a getprop, the jit needs to know the result type before the interpreter executes the instruction.
Tracing JIT
the interpreter then re-executes the guarded condition, which will always succeed since the interpreter handles all outcomes of such a condition dynamically.
JIT Optimization Outcomes
the call site has not been observed to have ever been executed.
JS::Call
thisobj js::handleobject / js::handlevalue the "current" object on which the function operates; the object specified here is "this" when the function executes.
JS::CompileFunction
mxr id search for js::compilefunction js::evaluate js::compile js::compileoffthread js_executescript js_decompilescript bug 771705 ...
JSClass.flags
js_executescript and similar apis set the global object for the code they execute.
JSErrorReport
set linebuf to point at the buffer before your application executes a script.
JS_CompileScriptForPrincipals
see also mxr id search for js_compilescriptforprincipals mxr id search for js_compileucscriptforprincipals js::compile js_decompilescript js::evaluate js_executescript bug 938907 bug 805080 ...
JS_CompileUTF8File
mxr id search for js_compilefile js::compile js_decompilescript js::evaluate js_executescript bug 805080 ...
JS_CompileUTF8FileHandle
mxr id search for js_compileutf8filehandle js::compile js_decompilescript js::evaluate js_executescript bug 805080 ...
JS_DecompileScript
see also mxr id search for js_decompilescript js::compile js_compilescript js_decompilefunction js_destroyscript js::evaluate js_executescript bug 761723 ...
JS_GetGlobalObject
furthermore, some jsapi functions, such as js_executescript, allow the caller to specify a global object in which the script executes.
JS_GetScopeChain
if the context is currently executing a script, and not in any function, it's running in a scope that was passed to js_executescript or a similar function by the application.
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_InitStandardClasses
this means that scripts executed in cx will see the properties of obj as global variables.
JS_SetErrorReporter
example code with error handling omitted: class myrequest { public: void execute() { auto rt = js_newruntime(memlimit); js_setruntimeprivate(rt, this); js_seterrorreporter(rt, &myrequest::dispatcherror); // execute js } void onerror(const std::string& error) { // handle error } static void dispatcherror( jscontext* ctx, const char* message, jserrorreport* report) { auto rt ...
JS_SetGCCallback
the callback executes on the same thread that performed gc, after the gc lock has been released.
JS_SetNativeStackQuota
this function may only be called immediately after the runtime is initialized and before any code is executed and/or interrupts requested.
JS_SetScriptStackQuota
description set the quota on the number of bytes that stack-like data structures can use when the runtime compiles and executes scripts.
JSDBGAPI
ebug code js_evaluateinstackframe examining object properties typedef jspropertydesc jspd_enumerate jspd_readonly jspd_permanent jspd_alias jspd_argument jspd_variable jspd_exception jspd_error typedef jspropertydescarray js_propertyiterator js_getpropertydesc js_getpropertydescarray js_putpropertydescarray hooks js_setdebuggerhandler js_setsourcehandler js_setexecutehook js_setcallhook js_setobjecthook js_setthrowhook js_setdebugerrorhook js_setnewscripthook js_setdestroyscripthook js_getglobaldebughooks js_setcontextdebughooks memory usage js_getobjecttotalsize js_getfunctiontotalsize js_getscripttotalsize system objects js_issystemobject js_newsystemobject profiling these functions can be used to profile a spidermonkey application...
SpiderMonkey 38
ction (bug 1089026) js_compileucfunction (bug 1089026) js_convertarguments (bug 1125784) js_convertargumentsva (bug 1125784) js_convertstub (bug 1103152) js_defineownproperty (bug 1017323) js_deletepropertystub (bug 1103152) js_doubletoint32 (bug 1112774) js_doubletouint32 (bug 1112774) js_enumeratestub (bug 1103152) js_evaluatescript (bug 1100579) js_evaluateucscript (bug 1100579) js_executescriptversion (bug 1095660) js_getflatstringchars (bug 1037869) js_getfunctioncallback (bug 1103269) js_getinternedstringchars (bug 1037869) js_getinternedstringcharsandlength (bug 1037869) js_getstringcharsandlength (bug 1037869) js_getstringcharsz (bug 1037869) js_getstringcharszandlength (bug 1037869) js_gettypename (bug 1037718) js_isabouttobefinalized (bug 650161) js_lookupelement (...
TPS Tests
it clone github.com/mozilla/gecko-dev cd into the tps folder cd testing/tps create the environment i suggest the path to be outside of the mc source tree python create_venv.py --username=%email% --password=%password% %path% note: if you are updating the tps environment and want to keep your existing config (eg, the existing username and password), you should instead execute: python create_venv.py --keep-config %path% activate the environment source %path%/bin/activate run some tests note that the testfile is not a path, it should only be the filename from services/sync/tests/tps/ runtps --debug --testfile %test_file_name% --binary %firefox_binary_path% additionally, omitting a --testfile parameter will cause it to run all tps tests lis...
Thread Sanitizer
once you have adjusted everything, execute this script in the js/src/ subdirectory and pass a directory name as the first parameter.
Security and the jar protocol
a site that serves a file with that type is essentially promising that it has vetted the content and that it is in fact safe to download and execute.
Using the Places keywords API
each keyword can be associated with post data, in such a case a post action will be executed when the given url is selected from the awesomebar.
Avoiding leaks in JavaScript XPCOM components
however, a better fix is to move the filter function outside of the function, since the power of closures is not necessary in this case (and there's also no need to create a new function object for the filter each time this code is executed).
How to build an XPCOM component in JavaScript
execute this command to compile the typelib.
XPCOM changes in Gecko 2.0
in theory, this is invisible to the user, but it's a costly process, since every component needs to be loaded and executed, then unloaded, then reloaded again during the restart.
Building the WebLock UI
notice also that when it's clicked, the button executes a javascript function called addthissite(), which we've already defined in the weblock.js file in client code overview above.
Packaging WebLock
<!doctype html> <html> <title>weblock installation</title> <script> /* * trigger function that downloads the xpi so the * install.js file inside can be read and executed */ function installweblock() { weblock_xpi = {'weblock extension': 'weblock.xpi'}; installtrigger.install(weblock_xpi); } </script> <h1>install weblock</h1> <p><a href="#" onclick="installweblock();">install weblock</a></p> </html> distributing your component once you have the component packaged properly and the necessary installation and trigger scripts, you are ready to distribute y...
Starting WebLock
this callback allows the component to execute any one-time registration code it may need.
How to build a binary XPCOM component using Visual Studio
the command executes xpidl.exe twice, like this: {path_to_geckosdk}\bin\xpidl.exe -m header -i..\gecko-sdk\idl {your_idl_file} {path_to_geckosdk}\bin\xpidl.exe -m typelib -i..\gecko-sdk\idl {your_idl_file} the generated h file actually has a skeleton implementation (commented out).
Introduction to XPCOM for the DOM
let's say that you now want to execute a function declared on the nsifoo2 interface, also implemented by nsfoo.
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.evalInSandbox
for instance: var x = components.utils.evalinsandbox( "let x = 1;", sandbox, "1.8", // "latest" is recognized as a special case "http://foo.com/mycode.js", 25 ); the above will execute code using javascript 1.8.
Components.utils.schedulePreciseGC
using scheduleprecisegc() when you call components.utils.scheduleprecisegc(), you specify a callback that is executed in once the scheduled garbage collection has been completed: components.utils.scheduleprecisegc( function() { // this code is executed when the garbage collection has completed } ); since the garbage collection doesn't occur until some time in the future (unlike, for example, components.utils.forcegc(), which causes garbage collection immediately but isn't able to collect all javascript...
NS_InitXPCOM2
some of the possible errors are documented below: ns_error_not_initialized indicates that static globals were not yet initialized, which may happen if this method is called before xpcom's static initialization code executes.
NS_InitXPCOM3
some of the possible errors are documented below: ns_error_not_initialized indicates that static globals were not yet initialized, which may happen if this method is called before xpcom's static initialization code executes.
IAccessibleAction
other-licenses/ia2/accessibleaction.idlnot scriptable this interface gives access to actions that can be executed for accessible objects.
mozIStorageBindingParams
the mozistoragebindingparams interface is used to bind values to parameters prior to calling mozistoragestatement.executeasync().
mozIStorageProgressHandler
see also storage mozstorage introduction and how-to article mozistorageconnection database connection to a specific file or in-memory data storage mozistoragestatement create and execute sql statements on a sqlite database.
mozIStorageStatementRow
for example, say you create a statement like so: var statement = dbconn.createstatement("select id, name from table_name"); the object would have two properties, id and name, that can be used to get the value of the column after you have called mozistoragestatement.executestep() like so: while (statement.executestep()) { let id = statement.row.id; let name = statement.row.name; } see also storage mozistoragestatement ...
mozIStorageValueArray
see also storage introduction and how-to article mozistorageconnection database connection to a specific file or in-memory data storage mozistoragestatement create and execute sql statements on a sqlite database.
nsIDOMNSHTMLDocument
execcommand() boolean execcommand( in domstring commandid, in boolean doshowui, in domstring value ); parameters commandid the name of the command to execute.
nsIDocShell
canexecutescripts boolean whether this docshell can execute scripts based on its hierarchy.
nsIDownload
mimeinfo nsimimeinfo provides the targets relevant mime information, including its mime type, helper application, and whether or not the helper should be executed automatically once the download is complete.
nsINavHistoryQuery
to search for items that are tagged with any given tags instead of all, multiple queries may be passed to the nsinavhistoryservice method nsinavhistoryservice.executequeries().
nsIProcess
runw() executes the file this object was initialized with.
nsIProtocolHandler
uri_opening_executes_script 1<<13 uris for this protocol execute script when they are opened.
nsISupports proxies
} so, given an event queue to execute methods on, and either an nsisupports object that has been created or cid, and a flag, a new nsisupports proxy object will be returned to you.
nsIWebContentHandlerRegistrar
note: script must execute from same domain as uri or else it will throw permission error.
nsIWindowMediator
stener('tabselect', function () { domwindow.alert('tab was selected') }, false); } }, false); }, onclosewindow: function (awindow) {}, onwindowtitlechange: function (awindow, atitle) {} }; //to register services.wm.addlistener(windowlistener); //services.wm.removelistener(windowlistener); //once you want to remove this listener execute removelistener, currently its commented out so you can copy paste this code in scratchpad and see it work native code only!calculatezposition a window wants to be moved in z-order.
nsIXPConnect
void setreportalljsexceptions( in boolean reportalljsexceptions ); parameters reportalljsexceptions missing description exceptions thrown missing exception missing description setsafejscontextforcurrentthread() set fallback jscontext to use when xpconnect can't find an appropriate context to use to execute javascript.
nsIXULTemplateQueryProcessor
the query is expected to consist of either text or dom nodes that, when executed by a call to the generateresults() method, will allow the generation of a list of results.
Getting Started Guide
calling a member function if ( foo ) foo->dosomething(); in all of these cases, pretty much the exact same code is executed (case 2 is slightly different, but the intent is the same).
XUL Overlays
MozillaTechXULOverlays
attaching a script to an overlay to execute a script when an overlay is applied, use a <script> element: <script src="overlay.js"/> if you need to set the version of javascript, you can set the type attribute: <script type="application/x-javascript;version=1.8" src="overlay.js"/> ui reuse with overlays one of the biggest benefits of using overlays is that it allows you to reuse groups of elements that appear frequently in the ui.
MailNews fakeserver
server.start(port); // set up a nsimsgincomingserver locally localserver.someactionrequiringconnection(); server.performtest(); // nothing will be executed until the connection is closed // localserver.closecachedconnections() is generally a good way to do so server.resettest(); // set up second test server.performtest(); transaction = server.playtransaction(); // finished with tests server.stop(); } currently, fakeserver provides no means to keep a persistent connection past a test, requiring connections to be closed, possibly for...
MailNews Filters
the search is executed locally, not on the server, so that criteria like "in address book" still work.
Building a Thunderbird extension 6: Adding JavaScript
indow.setinterval( function() { startup(); }, 60000); //update date every minute function startup() { var mypanel = document.getelementbyid("my-panel"); var date = new date(); var day = date.getday(); var datestring = date.getfullyear() + "." + (date.getmonth()+1) + "." + date.getdate(); mypanel.label = "date: " + datestring; } the first part registers a new event listener that will be executed automatically when thunderbird loads.
Demo Addon
the last line of this example executes the gloda query.
Access Window
register a timer window.setinterval( function() { alert('foobar'); }, 60000); //execute the function once very minute if you periodically need to perform a certain action then you can use the setinterval function, it will then call this function every x milliseconds, in this case every 60000ms or one minute.
Use SQLite
adbconnection.createtable(name, this.dbschema.tables[name]); }, }; window.addeventlistener("load", function(e) { tbirdsqlite.onload(e); }, false); this is another practical sample on how to handle opendatabase and sql queries on the client side, using in-memory (blob) storage of 2mb: var db = opendatabase('mydb', '1.0', 'test db', 2 * 1024 * 1024); var msg; db.transaction(function (tx) { tx.executesql('create table if not exists logs (id unique, log)'); tx.executesql('insert into logs (id, log) values (1, "foobar")'); tx.executesql('insert into logs (id, log) values (2, "logmsg")'); msg = '<p>log message created and row inserted.</p>'; document.queryselector('#status').innerhtml = msg; }); db.transaction(function (tx) { tx.executesql('select * from logs', [], function (tx, resul...
Using the Mozilla source server
after the command executes, the source file will load in the window.
Add to iPhoto
responding when the "add image to iphoto" option is chosen when the user chooses to add the image to iphoto, the add() method is executed.
Mozilla
how to add a build-time test writing a test is good, but it is even more helpful if that test gets executed.
Scripting plugins - Plugins
this way such code can be executed with only the privileges of the origin of the code, and not the privileges of the plugin page's origin.
URLs - Plugins
javascript executes javascript code that follows the url.
Break on DOM mutation - Firefox Developer Tools
when you execute the code, the debugger will pause execution when the dom mutation occurs.
Use a source map - Firefox Developer Tools
the javascript sources executed by the browser are often transformed in some way from the original sources created by a developer.
Set an XHR breakpoint - Firefox Developer Tools
when your code breaks on an xhr request, the righthand pane will have two additional sections: call stack the list of functions that were executed in order ot get to the currently executing code.
Set event listener breakpoints - Firefox Developer Tools
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.
UI Tour - Firefox Developer Tools
note: if you click step over (f10) after changing the selected line in the source pane, the debugger executes until reaching the line following the newly-selected line (disregarding whatever line the debugger originally stopped at).
Debugger.Script - Firefox Developer Tools
count: the number of times the current opcode got executed.
Debugger - Firefox Developer Tools
ondebuggerstatement(frame) debuggee code has executed adebugger statement inframe.
Index - Firefox Developer Tools
131 step through code debugger, devtools, javascript, step through code when the debugger is stopped at a breakpoint, you can step through it using four buttons in the toolbar: 132 use a source map the javascript sources executed by the browser are often transformed in some way from the original sources created by a developer.
All keyboard shortcuts - Firefox Developer Tools
initiate reverse search through command history/step backwards through matching commands f9 ctrl + r f9 step forward through matching command history (after initiating reverse search) shift + f9 ctrl + s shift + f9 move to the beginning of the line home ctrl + a ctrl + a move to the end of the line end ctrl + e ctrl + e execute the current expression enter return enter add a new line, for entering multiline expressions shift + enter shift + return shift + enter autocomplete popup these shortcuts apply while the autocomplete popup is open: command windows macos linux choose the current autocomplete suggestion tab tab tab cancel the autocompl...
Network request list - Firefox Developer Tools
copy > copy as curl copies the network request to the clipboard as a curl command, so you can execute it from a command line.
Examine and edit HTML - Firefox Developer Tools
full text search the full text search will always be executed, independently of what you enter.
Animating CSS properties - Firefox Developer Tools
for a rate of 60 frames per second, that gives the browser 16.7 milliseconds to execute the complete flow.
Shader Editor - Firefox Developer Tools
javascript code running in the page then sends them for compilation using the webgl apis, and they're executed on the device's gpu when needed.
Web Console Helpers - Firefox Developer Tools
$_ stores the result of the last expression executed in the console's command line.
Web console keyboard shortcuts - Firefox Developer Tools
initiate reverse search through command history/step backwards through matching commands f9 ctrl + r f9 step forward through matching command history (after initiating reverse search) shift + f9 ctrl + s shift + f9 move to the beginning of the line home ctrl + a ctrl + a move to the end of the line end ctrl + e ctrl + e execute the current expression enter return enter add a new line, for entering multiline expressions shift + enter shift + return shift + enter autocomplete popup these shortcuts apply while the autocomplete popup is open: command windows macos linux choose the current autocomplete suggestion tab tab tab cancel the autocompl...
Animation.oncancel - Web APIs
syntax var cancelhandler = animation.oncancel; animation.oncancel = cancelhandler; value a function to be executed when the animation is cancelled, or null if there is no cancel event handler.
AudioScheduledSourceNode.onended - Web APIs
the onended event handler for the audioscheduledsourcenode interface specifies an eventhandler to be executed when the ended event occurs on the node.
AudioWorklet - Web APIs
the audioworklet interface of the web audio api is used to supply custom audio processing scripts that execute in a separate thread to provide very low latency audio processing.
BroadcastChannel.onmessage - Web APIs
the broadcastchannel.onmessage event handler is a property that specifies the function to execute when a message event, of type messageevent, is received by this broadcastchannel.
BroadcastChannel - Web APIs
event handlers broadcastchannel.onmessage an eventhandler property that specifies the function to execute when a message event is fired on this object.
CSSUnparsedValue - Web APIs
cssunparsedvalue.foreach() executes a provided function once for each element of the cssunparsedvalue object.
Basic usage of canvas - Web APIs
cument.getelementbyid('tutorial'); if (canvas.getcontext) { var ctx = canvas.getcontext('2d'); } } </script> <style type="text/css"> canvas { border: 1px solid black; } </style> </head> <body onload="draw();"> <canvas id="tutorial" width="150" height="150"></canvas> </body> </html> the script includes a function called draw(), which is executed once the page finishes loading; this is done by listening for the load event on the document.
Drawing shapes with canvas - Web APIs
before this method is executed, the moveto() method is automatically called with the parameters (x,y).
DOMTokenList.forEach() - Web APIs
syntax tokenlist.foreach(callback [, thisarg]); parameters callback function to execute for each element, eventually taking three arguments: currentvalue the current element being processed in the array.
DOMTokenList - Web APIs
domtokenlist.foreach(callback [, thisarg]) executes a provided callback function once per domtokenlist element.
Document.currentScript - Web APIs
syntax var curscriptelement = document.currentscript; example this example checks to see if the script is being executed asynchronously: if (document.currentscript.async) { console.log("executing asynchronously"); } else { console.log("executing synchronously"); } view live examples specifications specification status comment html living standardthe definition of 'document.currentscript' in that specification.
Document: scroll event - Web APIs
examples scroll event throttling since scroll events can fire at a high rate, the event handler shouldn't execute computationally expensive operations such as dom modifications.
Document.write() - Web APIs
WebAPIDocumentwrite
note: starting with version 55, chrome will not execute <script> elements injected via document.write() when specific conditions are met.
Document Object Model (DOM) - Web APIs
once an event is triggered, the event handlers get executed.
Element.classList - Web APIs
WebAPIElementclassList
ototype.trim = function(){ return this.replace(/^[\s]+|[\s]+$/g, ''); }; (function(window){"use strict"; // prevent global namespace pollution if(!window.domexception) (domexception = function(reason){this.message = reason}).prototype = new error; var wsre = /[\11\12\14\15\40]/, wsindex = 0, checkifvalidclasslistentry = function(o, v) { if (v === "") throw new domexception( "failed to execute '" + o + "' on 'domtokenlist': the token provided must not be empty." ); if((wsindex=v.search(wsre))!==-1) throw new domexception("failed to execute '"+o+"' on 'domtokenlist': " + "the token provided ('"+v[wsindex]+"') contains html space characters, which are not valid in tokens."); } // 2.
Element: mouseover event - Web APIs
html <ul id="test"> <li>item 1</li> <li>item 2</li> <li>item 3</li> </ul> javascript let test = document.getelementbyid("test"); // this handler will be executed only once when the cursor // moves over the unordered list test.addeventlistener("mouseenter", function( event ) { // highlight the mouseenter target event.target.style.color = "purple"; // reset the color after a short delay settimeout(function() { event.target.style.color = ""; }, 500); }, false); // this handler will be executed every time the cursor // is moved over a differe...
Element: scroll event - Web APIs
examples scroll event throttling since scroll events can fire at a high rate, the event handler shouldn't execute computationally expensive operations such as dom modifications.
Event - Web APIs
WebAPIEvent
many dom elements can be set up to accept (or "listen" for) these events, and execute code in response to process (or "handle") them.
EventTarget.dispatchEvent() - Web APIs
all applicable event handlers will execute and return before the code continues on after the call to dispatchevent().
FileReader.onabort - Web APIs
the filereader.onabort property contains an event handler executed when the abort event is fired, i.e.
FileReader.onload - Web APIs
WebAPIFileReaderonload
the filereader.onload property contains an event handler executed when the load event is fired, when content read with readasarraybuffer, readasbinarystring, readasdataurl or readastext is available.
FileRequest.onprogress - Web APIs
syntax instanceoffilerequest.onprogress = function; where instanceoffilerequest is a filerequest object and function is the javascript function to execute.
FileSystem - Web APIs
if that call is successful, it executes a callback handler, which receives as a parameter a filesystem object describing the file system.
FileSystemEntry.copyTo() - Web APIs
errorcallback optional an optional callback which is executed if an error occurs while copying the items.
FileSystemEntry.getMetadata() - Web APIs
errorcallback optional an optional callback which is executed if an error occurs while looking up the metadata.
FileSystemEntry.getParent() - Web APIs
errorcallback optional an optional callback which is executed if an error occurs.
FileSystemEntry.moveTo() - Web APIs
errorcallback optional an optional callback which is executed if an error occurs while moving the items.
Introduction to the File and Directory Entries API - Web APIs
nd directory entries api adheres to the same-origin policy the file and directory entries api does not let you create and rename executable files the file system is sandboxed you cannot run your app from file:// the file and directory entries api adheres to the same-origin policy an origin is the domain, application layer protocol, and port of a url of the document where the script is being executed.
HTMLAreaElement - Web APIs
htmlhyperlinkelementutils.tostring() returns a usvstring containing the whole url of the script executed in the worker.
HTMLElement.click() - Web APIs
WebAPIHTMLElementclick
syntax element.click() example simulate a mouse-click when moving the mouse pointer over a checkbox: html <form> <input type="checkbox" id="mycheck" onmouseover="myfunction()" onclick="alert('click event occured')"> </form> javascript // on mouse-over, execute myfunction function myfunction() { document.getelementbyid("mycheck").click(); } specification specification status comment html living standard living standard document object model (dom) level 2 html specification obsolete initial definition.
HTMLElement - Web APIs
htmlelement.nomodule is a boolean indicating whether an import script can be executed in user agents that support module scripts.
HTMLFormElement.action - Web APIs
the action of a form is the program that is executed on the server when the form is submitted.
HTMLImageElement.complete - Web APIs
while ideally this command wouldn't even be executed if the image hasn't fully loaded, for improved reliability you want to check to ensure this is the case.
HTMLMediaElement.play() - Web APIs
when this example is executed, it begins by collecting references to the <video> element as well as the <button> used to toggle playback on and off.
HashChangeEvent - Web APIs
if ( newhash != oldhash && typeof window.onhashchange === "function" ) { // execute the handler window.onhashchange({ type: "hashchange", oldurl: oldurl, newurl: newurl }); oldurl = newurl; oldhash = newhash; } }, 100); })(window); specifications specification status comment html living standardthe definition of 'hashchangeevent' in that specification.
Headers - Web APIs
WebAPIHeaders
headers.foreach() executes a provided function once for each array element.
IDBDatabase - Web APIs
thus, you cannot execute commands, access data, or open anything outside of a transaction.
IDBRequest.error - Web APIs
WebAPIIDBRequesterror
the list describes problems that could occur when the request is being executed, but you might also encounter other problems when the request is being made.
IDBRequest: error event - Web APIs
the error handler is executed when an error caused a request to fail.
IDBTransaction: complete event - Web APIs
the complete handler is executed when a transaction successfully completed.
IDBTransaction - Web APIs
} transactions are started when the transaction is created, not when the first request is placed; for example consider this: var trans1 = db.transaction("foo", "readwrite"); var trans2 = db.transaction("foo", "readwrite"); var objectstore2 = trans2.objectstore("foo") var objectstore1 = trans1.objectstore("foo") objectstore2.put("2", "key"); objectstore1.put("1", "key"); after the code is executed the object store should contain the value "2", since trans2 should run after trans1.
IdleDeadline - Web APIs
properties idledeadline.didtimeout read only a boolean whose value is true if the callback is being executed because the timeout specified when the idle callback was installed has expired.
IntersectionObserver.observe() - Web APIs
when the visibility of the specified element crosses over one of the observer's visibility thresholds (as listed in intersectionobserver.thresholds), the observer's callback is executed with an array of intersectionobserverentry objects representing the intersection changes which occurred.
IntersectionObserver - Web APIs
constructor intersectionobserver.intersectionobserver() creates a new intersectionobserver object which will execute a specified callback function when it detects that a target element's visibility has crossed one or more thresholds.
KeyboardLayoutMap - Web APIs
methods keyboardlayoutmap.foreach() read only executes a provided function once for each element of keyboardlayoutmap.
MediaKeyStatusMap.forEach() - Web APIs
syntax mediakeystatusmap.foreach(callback[, thisarg]) parameters callback function to execute for each element, taking three arguments: currentvalue the current element being processed in the array.
MediaSessionActionDetails.action - Web APIs
the action property is the only required property mediasessionactiondetails dictionary, specifying the type of media session action which the action handler callback is being executed for.
MediaSessionActionDetails - Web APIs
the media session api's mediasessionactiondetails dictionary is the type used by the sole input parameter into the callback which is executed when a media session action occurs.
MutationObserver - Web APIs
// select the node that will be observed for mutations const targetnode = document.getelementbyid('some-id'); // options for the observer (which mutations to observe) const config = { attributes: true, childlist: true, subtree: true }; // callback function to execute when mutations are observed const callback = function(mutationslist, observer) { // use traditional 'for loops' for ie 11 for(let mutation of mutationslist) { if (mutation.type === 'childlist') { console.log('a child node has been added or removed.'); } else if (mutation.type === 'attributes') { console.log('the ' + mutation.attributename + ...
Using Navigation Timing - Web APIs
for example, to measure the perceived loading time for a page: window.addeventlistener("load", function() { let now = new date().gettime(); let loadingtime = now - performance.timing.navigationstart; document.queryselector(".output").innertext = loadingtime + " ms"; }, false); this code, executed when the load event occurs, subtracts from the current time the time at which the navigation whose timing was recorded began (performance.timing.navigationstart), and outputs that information to the screen by inserting it into an element.
NodeList.prototype.forEach() - Web APIs
WebAPINodeListforEach
syntax somenodelist.foreach(callback[, thisarg]); parameters callback a function to execute on each element of somenodelist.
NodeList - Web APIs
WebAPINodeList
(in this case, the keys are numbers starting from 0 and the values are nodes.) nodelist.foreach() executes a provided function once per nodelist element, passing the element as an argument to the function.
Page Visibility API - Web APIs
once a timer's code has finished running, the duration of time it took to execute is subtracted from its window's timeout budget.
Pbkdf2Params - Web APIs
iterations a number representing the number of times the hash function will be executed in derivekey().
PerformanceTiming.domContentLoadedEventEnd - Web APIs
the legacy performancetiming.domcontentloadedeventend read-only property returns an unsigned long long representing the moment, in milliseconds since the unix epoch, right after all the scripts that need to be executed as soon as possible, in order or not, has been executed.
PerformanceTiming.domContentLoadedEventStart - Web APIs
the legacy performancetiming.domcontentloadedeventstart read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, right before the parser sent the domcontentloaded event, that is right after all the scripts that need to be executed right after parsing has been executed.
PromiseRejectionEvent.promise - Web APIs
examples this example listens for unhandled promises and, if the reason is an object with a code field containing the text "module not ready", it sets up an idle callback that will retry the task that failed to execute correctly.
RTCPeerConnection.onaddstream - Web APIs
the rtcpeerconnection.onaddstream event handler is a property containing the code to execute when the addstream event, of type mediastreamevent, is received by this rtcpeerconnection.
RTCPeerConnection.onidentityresult - Web APIs
the rtcpeerconnection.onidentityresult event handler is a property containing the code to execute when the identityresult event, of type rtcidentityevent, is received by this rtcpeerconnection.
RTCPeerConnection.onidpassertionerror - Web APIs
the rtcpeerconnection.onidpassertionerror event handler is a property containing the code to execute whent the idpassertionerror event, of type rtcidentityerrorevent, is received by this rtcpeerconnection.
RTCPeerConnection.onidpvalidationerror - Web APIs
the rtcpeerconnection.onidpvalidationerror event handler is a property containing the code to execute whent the idpvalidationerror event, of type rtcidentityerrorevent, is received by this rtcpeerconnection.
RTCPeerConnection.onpeeridentity - Web APIs
the rtcpeerconnection.onpeeridentity event handler is a property containing the code to execute whent the peeridentity event, of type event, is received by this rtcpeerconnection.
RTCPeerConnection.onremovestream - Web APIs
the rtcpeerconnection.onremovestream event handler is a property containing the code to execute when the removestream event, of type mediastreamevent, is received by this rtcpeerconnection.
Screen.availHeight - Web APIs
let palettewindow = window.open("panels.html", "panels", "left=0, top=0, width=200"); the panels window's html, in panels.html, has javascript code of its own, which is executed as soon as the window is created.
Using the Screen Capture API - Web APIs
using await, the following line of code does not get executed until after the promise returned by getdisplaymedia() resolves.
SharedWorker - Web APIs
constructors sharedworker() creates a shared web worker that executes the script at the specified url.
SourceBuffer.removeAsync() - Web APIs
return value a promise whose fulfillment handler is executed once the buffers in the specified time range have been removed from the sourcebuffer.
Storage Access API - Web APIs
the embedding website needs to add this to allow storage access requests to be successful, along with allow-scripts and allow-same-origin to allow it to call the api, and execute in an origin that can have cookies: <iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin"> ...
StylePropertyMapReadOnly - Web APIs
stylepropertymapreadonly.foreach() executes a provided function once for each element of stylepropertymapreadonly.
URLSearchParams.forEach() - Web APIs
syntax searchparams.foreach(callback); parameters callback a callback function that is executed against each parameter, with the param value provided as its parameter.
WebGLRenderingContext.flush() - Web APIs
the webglrenderingcontext.flush() method of the webgl api empties different buffer commands, causing all commands to be executed as quickly as possible.
WebGLRenderingContext.getError() - Web APIs
gl.out_of_memory not enough memory is left to execute the command.
WebGLRenderingContext.scissor() - Web APIs
// turn on scissor test gl.enable(gl.scissor_test); // set the scissor rectangle gl.scissor(x, y, width, height); // execute drawing commands in the scissor box (e.g.
A basic 2D WebGL animation example - Web APIs
that's done here by calling requestanimationframe(), which asks that a callback function be executed the next time the browser is ready to update the screen.
Basic scissoring - Web APIs
only when the webgl state has been satisfactorily tweaked, we execute the drawing command (in this case, clear()) that starts the processing of fragments down the graphics pipeline.
Color masking - Web APIs
it allows us to setup webgl in a single initialization phase, and then just execute drawing commands for each frame.
Detect WebGL - Web APIs
the webgl rendering context is an interface, through which you can set and query the state of the graphics machine, send data to the webgl, and execute draw commands.
Simple color animation - Web APIs
the timer and the timer handler function establish the animation loop, a set of drawing commands that are executed at a regular period (typically, every frame; in this case, once per second).
Getting started with WebGL - Web APIs
webgl programs consist of control code written in javascript and shader code (glsl) that is executed on a computer's graphics processing unit (gpu).
WebGL tutorial - Web APIs
webgl programs consist of control code written in javascript and special effects code (shader code) that is executed on a computer's graphics processing unit (gpu).
WebSocket.onerror - Web APIs
WebAPIWebSocketonerror
syntax websocket.onerror = eventhandler; value a function or eventhandler which is executed whenever an error event occurs on the websocket connection.
Using bounded reference spaces - Web APIs
(refspace) { xrsession.updaterenderstate({ baselayer: new xrwebgllayer(xrsession, gl) }); let startposition = vec3.fromvalues(0, 1.5, 0); const startorientation = vec3.fromvalues(0, 0, 1.0); xrreferencespace = xrreferencespace.getoffsetreferencespace( new xrrigidtransform(startposition, startorientation)); xrsession.requestanimationframe(ondrawframe); } in this code, executed after the reference space has been created, we create an xrrigidtransform representing the transform that will move the viewpoint upward by 1.5 meters.
WebXR permissions and security - Web APIs
specifically: if the requestsession() call isn't coming from within the handler executed in response to a user event, and is not being issued while launching a web application, the request is denied and false is delivered to the promise's fulfillment handler.
Starting up and shutting down a WebXR session - Web APIs
with the new reference space in hand and stored into the worlddata object for safe-keeping, we call the session's requestanimationframe() method to schedule a callback to be executed when it's time to render the next frame of animation for the webxr session.
Migrating from webkitAudioContext - Web APIs
the latter version of createbuffer() was potentially expensive, because it had to decode the audio buffer synchronously, and with the buffer being arbitrarily large, it could take a lot of time for this method to complete its work, and no other part of your web page's code could execute in the mean time.
Web Audio API - Web APIs
audioworklet the audioworklet interface is available through the audiocontext object's audioworklet, and lets you add modules to the audio worklet to be executed off the main thread.
Web Workers API - Web APIs
workerlocation defines the absolute location of the script executed by the worker.
Window.open() - Web APIs
WebAPIWindowopen
the purpose of the return false in the code is to cancel default action of the link: if the onclick event handler is executed, then there is no need to execute the default action of the link.
Window: popstate event - Web APIs
this will eventually send events such as domcontentloaded and load to the window containing the document, but the steps below will continue to execute in the meantime.
Window.requestAnimationFrame() - Web APIs
the callback function is passed one single argument, a domhighrestimestamp similar to the one returned by performance.now(), indicating the point in time when requestanimationframe() starts to execute callback functions.
Window.setImmediate() - Web APIs
this method can be used instead of the settimeout(fn, 0) method to execute heavy operations.
Window.stop() - Web APIs
WebAPIWindowstop
because of how scripts are executed, this method cannot interrupt its parent document's loading, but it will stop its images, new windows, and other still-loading objects.
WindowOrWorkerGlobalScope.origin - Web APIs
examples executed from inside a worker script, the following snippet will log the worker's global scope's origin to the console each time it receives a message onmessage = function() { console.log(self.origin); }; if the origin is not a scheme/host/port tuple (say you are trying to run it locally, i.e.
Worker - Web APIs
WebAPIWorker
constructors worker() creates a dedicated web worker that executes the script at the specified url.
Synchronous and asynchronous requests - Web APIs
ments, 2); xhr.onload = xhrsuccess; xhr.onerror = xhrerror; xhr.open("get", url, true); xhr.send(null); } usage: function showmessage(message) { console.log(message + this.responsetext); } loadfile("message.txt", showmessage, "new message!\n\n"); the signature of the utility function loadfile declares (i) a target url to read (via an http get request), (ii) a function to execute on successful completion of the xhr operation, and (iii) an arbitrary list of additional arguments that are passed through the xhr object (via the arguments property) to the success callback function.
XMLHttpRequest.onreadystatechange - Web APIs
syntax xmlhttprequest.onreadystatechange = callback; values callback is the function to be executed when the readystate changes.
XMLHttpRequestEventTarget.onabort - Web APIs
syntax xmlhttprequest.onabort = callback; values callback is the function to be executed when the transaction is aborted.
XMLHttpRequestEventTarget.onerror - Web APIs
syntax xmlhttprequest.onerror = callback; values callback is the function to be executed when the request fails.
XMLHttpRequestEventTarget.onload - Web APIs
syntax xmlhttprequest.onload = callback; values callback is the function to be executed when the request completes successfully.
XPathEvaluator.evaluate() - Web APIs
the evaluate() method of the xpathevaluator interface executes an xpath expression on the given node or document and returns an xpathresult.
XPathExpression.evaluate() - Web APIs
the evaluate() method of the xpathexpression interface executes an xpath expression on the given node or document and returns an xpathresult.
XRRigidTransform() - Web APIs
the drawframe() callback will be executed when the system is ready to draw the next frame.
XRSession.visibilityState - Web APIs
the possible values of visibilitystate are: hidden the virtual scene generated by the xrsession is not currently visible to the user, so its requestanimationframe() callbacks are not being executed until thevisibilitystate changes.
XRVisibilityState - Web APIs
values hidden the virtual scene generated by the xrsession is not currently visible to the user, so its requestanimationframe() callbacks are not being executed until thevisibilitystate changes.
ARIA live regions - Accessibility
<div id="clock" role="timer" aria-live="polite"></div> /* basic javascript to update the clock */ setinterval(function() { var now = new date(); document.getelementbyid('clock').innerhtml = "time: " + now.gethours() + ":" + ("0"+now.getminutes()).substr(-2); }, 60000); the first time the function executes, the entirety of the string that is added will be announced.
Using the link role - Accessibility
when this role is added to an element, tab can be used to change focus to the link, and enter used to execute the link.
ARIA: timer role - Accessibility
nction starttimer(timername) { // get the number of seconds let timer = document.getelementbyid(timername), seconds = parseint(timer.innertext); // remove a second // updated the content of timer timer.innertext = --seconds // if timer != 0, settimeout if (seconds) { settimeout( function() { starttimer(timername); }, 1000); } } the first time the function executes, the entirety of the string that is added will be announced.
CSS Animations tips and tricks - CSS: Cascading Style Sheets
our callback gets executed just before the next repaint of the document.
Using CSS animations - CSS: Cascading Style Sheets
p { animation-duration: 3s; animation-name: slidein; } @keyframes slidein { from { margin-left: 100%; width: 300%; } to { margin-left: 0%; width: 100%; } } in this example the style for the <p> element specifies that the animation should take 3 seconds to execute from start to finish, using the animation-duration property, and that the name of the @keyframes at-rule defining the keyframes for the animation sequence is named “slidein”.
Privacy and the :visited selector - CSS: Cascading Style Sheets
this process was quick to execute, and made it possible not only to determine where the user had been on the web, but could also be used to guess a lot of information about the user's identity.
HTML5 Parser - Developer guides
WebGuideHTMLHTML5HTML5 Parser
performance improvement with speculative parsing unrelated to the requirements of html5 specification, the gecko 2 parser uses speculative parsing, in which it continues parsing a document while scripts are being downloaded and executed.
HTML attribute: crossorigin - HTML: Hypertext Markup Language
example: crossorigin with the script element you can use the following <script> element to tell a browser to execute the https://example.com/example-framework.js script without sending user-credentials.
<applet>: The Embed Java Applet element - HTML: Hypertext Markup Language
WebHTMLElementapplet
code this attribute specifies the url of the applet's class file to be loaded and executed.
hidden - HTML: Hypertext Markup Language
hidden elements shouldn't be linked from non-hidden elements, and elements that are descendants of a hidden element are still active, which means that script elements can still execute and form elements can still submit.
Preloading content with rel="preload" - HTML: Hypertext Markup Language
scripting and preloads another nice thing about these preloads is that you can execute them with script.
Using the application cache - HTML: Hypertext Markup Language
as an example, you can use network entries to load and execute scripts and other code from the server instead of the cache: cache manifest network: /api the cache manifest section listed above ensures that requests to load resources contained in the http://www.example.com/api/ subtree always go to the network without attempting to access the cache.
Data URLs - HTTP
data:text/plain;base64,sgvsbg8sifdvcmxkiq== base64-encoded version of the above data:text/html,%3ch1%3ehello%2c%20world!%3c%2fh1%3e an html document with <h1>hello, world!</h1> data:text/html,<script>alert('hi');</script> an html document that executes a javascript alert.
Browser detection using the user agent - HTTP
it will cause a syntax error in // browsers that do not support look-behind expressions // because all browsers parse the entire script, including // sections of the code that are never executed.
Cross-Origin Resource Sharing (CORS) - HTTP
WebHTTPCORS
a web application executes a cross-origin http request when it requests a resource that has a different origin (domain, protocol, or port) from its own.
HTTP conditional requests - HTTP
principles http conditional requests are requests that are executed differently, depending on the value of specific headers.
Clear-Site-Data - HTTP
this includes storage mechanisms such as: localstorage (executes localstorage.clear), sessionstorage (executes sessionstorage.clear), indexeddb (for each database execute idbfactory.deletedatabase), service worker registrations (for each service worker registration, execute serviceworkerregistration.unregister), appcache, websql databases, filesystem api data, plugin data (flash via npp_clearsitedata).
CSP: script-src - HTTP
examples violation case given this csp header: content-security-policy: script-src https://example.com/ the following script is blocked and won't be loaded or executed: <script src="https://not-example.com/js/library.js"></script> note that inline event handlers are blocked as well: <button id="btn" onclick="dosomething()"> you should replace them with addeventlistener calls: document.getelementbyid("btn").addeventlistener('click', dosomething); unsafe inline script note: disallowing inline styles and inline scripts is one of the biggest security wins ...
HTTP headers - HTTP
WebHTTPHeaders
x-download-options the x-download-options http header indicates that the browser (internet explorer) should not display the option to "open" a file that has been downloaded from an application, to prevent phishing attacks as the file otherwise would gain access to execute in the context of the application.
An overview of HTTP - HTTP
WebHTTPOverview
scripts executed by the browser can fetch more resources in later phases and the browser updates the web page accordingly.
Proxy Auto-Configuration (PAC) file - HTTP
note the order of the above exceptions for efficiency: localhostordomainis() functions only get executed for urls that are in local domain, not for every url.
JavaScript data types and data structures - JavaScript
undefined [[set]] function object or undefined the function is called with an argument that contains the assigned value and is executed whenever a specified property is attempted to be changed.
Concurrency model and the event loop - JavaScript
calling settimeout with a delay of 0 (zero) milliseconds doesn't execute the callback function after the given interval.
Details of the object model - JavaScript
for example, you can add a specialty property to all employees with the following statement: employee.prototype.specialty = 'none'; as soon as javascript executes this statement, the mark object also has the specialty property with the value of "none".
JavaScript modules - JavaScript
modules are only executed once, even if they have been referenced in multiple <script> tags.
Working with objects - JavaScript
(note that you may need to wrap the object literal in parentheses if the object appears where a statement is expected, so as not to have the literal be confused with a block statement.) object initializers are expressions, and each object initializer results in a new object being created whenever the statement in which it appears is executed.
Memory Management - JavaScript
node.js node.js offers additional options and tools for configuring and debugging memory issues that may not be available for javascript executed within a browser environment.
Warning: -file- is being assigned a //# sourceMappingURL, but already has one - JavaScript
with source maps, the debugger can map the code being executed to the original source files.
SyntaxError: Using //@ to indicate sourceURL pragmas is deprecated. Use //# instead - JavaScript
with source maps, the debugger can map the code being executed to the original source files.
SyntaxError: missing ) after condition - JavaScript
the if statement executes a statement if a specified condition is truthy.
InternalError: too much recursion - JavaScript
both execute the same code multiple times, and both require a condition (to avoid an infinite loop, or rather, infinite recursion in this case).
Arrow function expressions - JavaScript
this.age = 0; setinterval(function growup() { // in non-strict mode, the growup() function defines `this` // as the global object (because it's where growup() is executed.), // which is different from the `this` // defined by the person() constructor.
setter - JavaScript
description in javascript, a setter can be used to execute a function whenever a specified property is attempted to be changed.
Array.prototype.every() - JavaScript
description the every method executes the provided callback function once for each element present in the array until it finds the one where callback returns a falsy value.
Array.from() - JavaScript
array.from() has an optional parameter mapfn, which allows you to execute a map() function on each element of the array being created.
Array.prototype.map() - JavaScript
each time callback executes, the returned value is added to new_array.
Array.prototype.some() - JavaScript
description the some() method executes the callback function once for each element present in the array until it finds the one where callback returns a truthy value (a value that becomes true when converted to a boolean).
Function() constructor - JavaScript
however, unlike eval, the function constructor creates functions which execute in the global scope only.
Function.prototype.bind() - JavaScript
[[call]] executes code associated with this object.
Function - JavaScript
however, unlike eval, the function constructor creates functions that execute in the global scope only.
Intl.Locale.prototype.maximize() - JavaScript
syntax locale.maximize() return value a locale instance whose basename property returns the result of the add likely subtags algorithm executed against locale.basename.
Intl.Locale.prototype.minimize() - JavaScript
syntax locale.minimize() return value a locale instance whose basename property returns the result of the remove likely subtags algorithm executed against locale.basename.
JSON - JavaScript
consider this example where json.parse() parses the string as json and eval executes the string as javascript: let code = '"\u2028\u2029"' json.parse(code) // evaluates to "\u2028\u2029" in all engines eval(code) // throws a syntaxerror in old engines other differences include allowing only double-quoted strings and having no provisions for undefined or comments.
Number.NEGATIVE_INFINITY - JavaScript
when the if statement executes, smallnumber has the value -infinity, so smallnumber is set to a more manageable value before continuing.
Number.POSITIVE_INFINITY - JavaScript
when the if statement executes, bignumber has the value infinity, so bignumber is set to a more manageable value before continuing.
Object.create() - JavaScript
note that such a different order may arise statically via disparate fixed codings such as here, but also dynamically via whatever the order any such property-adding code-branches actually get executed at runtime as depends on inputs and/or random-variables.
Promise() constructor - JavaScript
syntax new promise(executor) parameters executor a function to be executed by the constructor, during the process of constructing the promiseobj.
Promise.prototype.finally() - JavaScript
when the promise is settled, i.e either fulfilled or rejected, the specified callback function is executed.
Promise.race() - JavaScript
this following example demonstrates the asynchronicity of promise.race: // we are passing as argument an array of promises that are already resolved, // to trigger promise.race as soon as possible var resolvedpromisesarray = [promise.resolve(33), promise.resolve(44)]; var p = promise.race(resolvedpromisesarray); // immediately logging the value of p console.log(p); // using settimeout we can execute code after the stack is empty settimeout(function(){ console.log('the stack is now empty'); console.log(p); }); // logs, in order: // promise { <state>: "pending" } // the stack is now empty // promise { <state>: "fulfilled", <value>: 33 } an empty iterable causes the returned promise to be forever pending: var foreverpendingpromise = promise.race([]); console.log(foreverpendingpromise...
RegExp.prototype[@@search]() - JavaScript
the [@@search]() method executes a search for a match between a this regular expression and a string.
RegExp.prototype.exec() - JavaScript
the exec() method executes a search for a match in a specified string.
RegExp.prototype.test() - JavaScript
the test() method executes a search for a match between a regular expression and a specified string.
RegExp - JavaScript
regexp.prototype.exec() executes a search for a match in its string parameter.
String.prototype.search() - JavaScript
the search() method executes a search for a match between a regular expression and this string object.
TypedArray.prototype.every() - JavaScript
description the every method executes the provided callback function once for each element present in the typed array until it finds one where callback returns a falsy value (a value that becomes false when converted to a boolean).
TypedArray.from() - JavaScript
typedarray.from() has the optional parameter mapfn, which allows you to execute a map() function on each element of the typed array (or subclass object) that is being created.
TypedArray.prototype.some() - JavaScript
description the some method executes the callback function once for each element present in the typed array until it finds one where callback returns a true value.
WeakSet - JavaScript
weaksets are ideal for this purpose: // execute a callback on everything stored inside an object function execrecursively(fn, subject, _refs = null){ if(!_refs) _refs = new weakset(); // avoid infinite recursion if(_refs.has(subject)) return; fn(subject); if("object" === typeof subject){ _refs.add(subject); for(let key in subject) execrecursively(fn, subject[key], _refs); } } const foo = { foo: "foo", bar: { bar: "bar"...
Destructuring assignment - JavaScript
) expression needs to be preceded by a semicolon or it may be used to execute a function on the previous line.
Operator precedence - JavaScript
observe how multiplication has higher precedence than addition and executed first, even though addition is written first in the code.
await - JavaScript
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.
class expression - JavaScript
as with class statements, the body of a class expression is executed in strict mode.
Function expression - JavaScript
the function returns the square of its argument: var x = function(y) { return y * y; }; using a function as a callback more commonly it is used as a callback: button.addeventlistener('click', function(event) { console.log('button is clicked!') }) using an immediately executed function expression an anonymous function is created and called: (function() { console.log('code runs!') })(); specifications specification ecmascript (ecma-262)the definition of 'function definitions' in that specification.
new operator - JavaScript
when the code new foo(...) is executed, the following things happen: a new object is created, inheriting from foo.prototype.
this - JavaScript
it's not exactly dead because it gets executed, but it can be eliminated with no outside effects.) as a dom event handler when a function is used as an event handler, its this is set to the element on which the listener is placed (some browsers do not follow this convention for listeners added dynamically with methods other than addeventlistener()).
void operator - JavaScript
void function iife() { console.log("executed!"); }(); // output: "executed!" executing the above function without the void keyword will result in an uncaught syntaxerror.
async function - JavaScript
the first line of the body of function foo is executed synchronously, with the await expression configured with the pending promise.
class - JavaScript
syntax class name [extends othername] { // class body } description the class body of a class declaration is executed in strict mode.
const - JavaScript
my_object = {'other_key': 'value'}; // however, object keys are not protected, // so the following statement is executed without problem my_object.key = 'othervalue'; // use object.freeze() to make object immutable // the same applies to arrays const my_array = []; // it's possible to push items into the array my_array.push('a'); // ["a"] // however, assigning a new array to the variable throws an error // uncaught typeerror: assignment to constant variable.
continue - JavaScript
examples using continue with while the following example shows a while loop that has a continue statement that executes when the value of i is 3.
for await...of - JavaScript
it invokes a custom iteration hook with statements to be executed for the value of each distinct property of the object.
for...of - JavaScript
it invokes a custom iteration hook with statements to be executed for the value of each distinct property of the object.
label - JavaScript
foo: { console.log('face'); break foo; console.log('this will not be executed'); } console.log('swap'); // this will log: // "face" // "swap" labeled function declarations starting with ecmascript 2015, labeled function declarations are now standardized for non-strict code in the web compatibility annex of the specification.
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.
with - JavaScript
to execute multiple statements, use a block statement ({ ...
JavaScript shells - JavaScript
execute js - (no longer maintained) - firefox-extension which provides an enhanced javascript-console, where you can comfortably enter and execute arbitrary javascript-code and modify functions.
Animation performance and frame rate - Web Performance
for a rate of 60 frames per second, the browser has 16.7 milliseconds to execute scripts, recalculate styles and layout if needed, and repaint the area being updated.
Recommended Web Performance Timings: How long is too long? - Web Performance
for this reason, script execution should be limited in scope, divided into chunks of code that can be executed in 50ms or less.
Securing your site - Web security
code is executed by the victims and lets the attackers bypass access controls and impersonate users.
Subresource Integrity - Web security
if the script or stylesheet doesn’t match its associated integrity value, the browser must refuse to execute the script or apply the stylesheet, and must instead return a network error indicating that fetching of that script or stylesheet failed.
PI Parameters - XSLT: Extensible Stylesheet Language Transformations
if the select attribute fails to parse or execute, the pi is ignored (in particular, it does not fall back to the value attribute).
WebAssembly Concepts - WebAssembly
webassembly goals webassembly is being created as an open standard inside the w3c webassembly community group with the following goals: be fast, efficient, and portable — webassembly code can be executed at near-native speed across different platforms by taking advantage of common hardware capabilities.
Converting WebAssembly text format to wasm - WebAssembly
next, execute the wat2wasm program, passing it the path to the input file, followed by an -o parameter, followed by the path to the output file: wat2wasm simple.wat -o simple.wasm this will convert the wasm into a file called simple.wasm, which contains the .wasm assembly code.
onunload - XUL
« xul reference home onunload type: script code specifies a set of scripts to execute when the browser window is closed by the user.