Search completed in 0.99 seconds.
Streams - Plugins
the browser
calls the plug-in methods npp_newstream, npp_writeready, npp_write, and npp_destroystream to, respectively, create a stream, find out how much data the plug-in can handle, push data into the stream, and delete it.
... random-access mode: the plug-in
calls the npn_requestread method to "pull" stream data.
...in normal-mode streams, the browser
calls the plug-in to tell it when a stream is created and to push more data.
...And 25 more matches
PKCS11 Implement
this document supplements the information in pkcs #11: cryptographic token interface standard, version 2.0 with guidelines for implementors of cryptographic modules who want their products to work with mozilla client software: how nss
calls pkcs #11 functions.
...how nss
calls pkcs #11 functions this section is organized according to the categories used in pkcs #11: cryptographic token interface standard, version 2.0.
... general-purpose functions c_initialize the nss
calls c_initialize on startup or when it loads a new module.
...And 22 more matches
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
file location (not tested since 2012 ...) in thunderbird , firefox, the javascript preference file that
calls the centralized preference file is located in $install_dir_moz_app/defaults/pref, for example in thunderbird this would be repectively for windows/linux: c:\program files\mozilla thunderbird\defaults\pref /usr/lib/thunderbird/default/pref ( it used to be in /usr/lib/thunderbird-version#/default/pref as in /usr/lib/thunderbird-5/default/pref ) for the record/history purpose ...
... that pref
calls.js is now archive in omni.jar file located at the root of the mozilla apps installation, example of tb5: # jar -tvf /usr/lib/thunderbird/omni.jar | grep pref
calls.js 7499 sat nov 05 09:21:34 cet 2011 defaults/autoconfig/pref
calls.js traditionally (previous apps versions) is was in mozilla_home/default/autoconfig/pref
calls.js.
... the presence of pref("general.config.filename", "mozilla.cfg"); in any appropriate .js file (here we use autoconf.js dedicated file) enables the read and execution of pref
calls.js.
...And 19 more matches
Index
the most typical operations that are relevant for fast program execution are property accesses and function
calls.
...the most commonplace operations that are relevant for fast program execution are property accesses and function
calls.
... 28 js::call jsapi reference, reference, spidermonkey js::call
calls a specified function, fun, on an object, thisobj.
...And 17 more matches
sslfnc.html
ssl_cipherprefsetdefault enables or disables ssl2 or ssl3 cipher suites (subject to which cipher suites are permitted or disallowed by previous
calls to one or more of the ssl export policy functions).
...the values are the same as the values used to enable or disable a cipher suite via
calls to ssl_cipherprefsetdefault, and are defined in sslproto.h.
... initializing multi-processing with a shared ssl server cache to start a multi-processing application, the initial parent process
calls ssl_configmpserversidcache, and then creates child processes, by one of these methods: call fork and then exec (unix) call createprocess (win32) call pr_createprocess (both unix and win32) it is essential that the parent allow the child to inherit the file descriptors.
...And 11 more matches
Drawing and Event Handling - Plugins
for windowless plug-ins, the browser
calls the npp_setwindow method with an npwindow structure that represents a drawable.
... for windowed plug-ins, the browser
calls the npp_setwindow method with an npwindow structure that represents a window.
...the browser
calls npp_setwindow whenever the drawable changes.
...And 11 more matches
Debugger.Frame - Firefox Developer Tools
the “immediate caller” rule means that, when debuggee code
calls a non-debuggee function, it looks like a call to a primitive: you see a frame for the non-debuggee function that was accessible to the debuggee, but any further
calls that function makes are treated as internal details, and omitted from the stack trace.
... if the non-debuggee function eventually
calls back into debuggee code, then those frames are visible.
...even though the debuggee and debugger share the same javascript stack, frames pushed for spidermonkey’s
calls to handler methods to report events in the debuggee are never considered visible frames.) invocation functions and “debugger” frames aninvocation function is any function in this interface that allows the debugger to invoke code in the debuggee: debugger.object.prototype.call, debugger.frame.prototype.eval, and so on.
...And 10 more matches
Bytecode Descriptions
it just
calls tonumber(val).
...it
calls target[symbol.hasinstance](value) if the method exists.
...implements: import
calls.
...And 9 more matches
Web Replay
these behaviors mainly originate from system
calls (i/o and such).
... both of these involve inter-thread communication and
calls to non-deterministic apis, and the resulting non-determinism must be allowed within the replaying process.
... recording a recording content process differs from a normal content process in the following ways:
calls to certain functions are intercepted by hooking them (rewriting the machine code at their entry points to call a different function with the same signature), including the function used to dispatch mach messages.
...And 9 more matches
Index
29 components.stack xpcom:language bindings, xpconnect components.stack is a read only property of type nsistackframe (idl definition) that represents a snapshot of the current javascript
callstack.
...this method
calls through to that thusly: 47 components.utils.unload modules components.utils.unload was introduced in firefox 7 and is used to unload javascript code modules.
...an nscomptr always
calls release before letting go, whether the nscomptr is letting go so that it can point to a different object, or because the nscomptr is going out of scope.
...And 9 more matches
Index - Web APIs
this can be somewhat controlled by setting the audionode.channelinterpretation property to speakers or discrete: 160 audionode.connect() api, audio, audionode, media, method, reference, web audio api, connect if the destination is a node, connect() returns a reference to the destination audionode object, allowing you to chain multiple connect()
calls.
... 771 domtokenlist.foreach() dom, domtokenlist, iterable, method, reference, web, foreach the foreach() method of the domtokenlist interface
calls the callback given in parameter once for each value pair in the list, in insertion order.
... 2346 mediakeystatusmap.foreach() api, encryptedmediaextensions, mediakeystatusmap, method, reference, foreach() the foreach property of the mediakeystatusmap interface
calls callback once for each key-value pair in the status map, in insertion order.
...And 9 more matches
JSAPI User Guide
a minimal example each of the three key elements described in the previous section requires a few jsapi
calls: the runtime: use js_newruntime to create it and js_destroyruntime to clean it up when you're done.
...this may include jsapi
calls to create your // own custom js objects and run scripts.
... on failure, a jsnative
calls an error-reporting function, in this case js_reporterror, and returns false.
...And 8 more matches
Initialization and Destruction - Plugins
initialization: the browser
calls the plug-in api function np_initialize when the plug-in code is first loaded.
... instance creation: the browser
calls the plug-in api function npp_new when the instance is created.
... instance destruction: the plug-in instance is deleted when the user leaves the instance page or closes the instance window; the browser
calls the function npp_destroy to tell the plug-in that the instance is being deleted.
...And 8 more matches
Plug-in Basics - Plugins
how plug-ins work the life cycle of a plug-in, unlike that of an application, is completely controlled by the web page that
calls it.
... gecko
calls the plug-in api function np_initialize when the plug-in code is first loaded.
...the browser
calls them when the plug-in software is loaded and unloaded.
...And 8 more matches
Document Loading - From Load Start to Finding a Handler - Archive of obsolete content
the final goal is to find the correct stream listener to pump the data into when necko
calls ondataavailable (e.g., we may find the html parser as the stream listener to give the data to).
...nsdocumentopeninfo implements nsistreamlistener and proxies the nsistreamlistener
calls over to the "real" stream listener once one is chosen.
... api
calls to load a new uri.
...And 7 more matches
NPP_NewStream - Archive of obsolete content
stream supports random access through
calls to npn_requestread (for example, local files or http servers that support byte-range requests).
... np_normal (default): delivers stream data to the instance in a series of
calls to npp_writeready and npp_write.
... np_seek: stream data randomly accessible by the plug-in as needed, through
calls to npn_requestread.
...And 6 more matches
JIT Optimization Strategies
the most commonplace operations that are relevant for fast program execution are property accesses and function
calls.
...in particular, arguments cannot be returned from the function, or passed as an argument into
calls (except for the apply case above).
...in particular, arguments cannot be returned from the function, or passed as an argument into
calls (except for the apply example listed above).
...And 6 more matches
URLs - Plugins
if the target parameter is set to null, the application creates a new stream and delivers the data to the plug-in instance, through
calls to npp_newstream, npp_writeready and npp_write, and npp_destroystream.
...it returns immediately and only later handles the request and
calls npp_urlnotify.
...if a request completes successfully, and the target is non-null, the browser
calls npp_urlnotify after it has finished loading the url.
...And 6 more matches
Signaling and video calling - Web APIs
note: the onicecandidate event and createanswer() promise are both async
calls which are handled separately.
... ui to start a call the code which handles the "userlist" message
calls handleuserlistmsg().
...next, we set a handler for the click event on the list item, that clicking on a user name
calls our invite() method, which we'll look at in the next section.
...And 6 more matches
Understanding WebAssembly text format - WebAssembly
calling functions from other functions in the same module the call instruction
calls a single function, given its index or name.
...you can also see that the exported logit function
calls the imported function using the call instruction we introduced above.
... in javascript, the equivalent
calls to create such a table instance would look something like this: function() { // table section var tbl = new webassembly.table({initial:2, element:"funcref"}); // function sections: var f1 = ...
...And 6 more matches
Using the Editor from XUL - Archive of obsolete content
it does some getting of window.arguments (which is a way callers can pass parameters to new windows -- we use this to get the url to be loaded), then it
calls editorstartup(), where the real work happens.
...the nseditorshellmouselistener essentially
calls nseditorshell::handlemouseclickonelement to show property dialogs for items that you double-click on.
... nshtmleditor::editorkeypress() gets the character code from the key event, puts that into a string, and
calls nshtmleditor::typedtext(), which simply
calls nshtmleditor::inserttext().
...And 4 more matches
HTML parser threading
the tokenizer
calls into the tree builder which outputs nshtml5treeoperation objects (tree ops) into a queue.
...there's a timer that
calls timerflush() (which takes mtokenizermutex).
...executing tree ops when the executor flushing runnable fires on the main thread, it
calls nshtml5treeopexecutor::runflushloop().
...And 4 more matches
HTTP Cache
the response payload) to write to the cache entry, it must open the output stream on it before it
calls metadataready.
... other parallel consumers, if any, are blocked until the writer
calls setvalid on the cache entry.
... when the server responds positively (in case of an http server with a 206 response code) the writer (in this order) opens the output stream on the cache entry and
calls setvalid to unblock other pending openers.
...And 4 more matches
Profiling with the Firefox Profiler
black: these indicate synchronous ipc
calls.
...the change in stack height is useful to find patterns like long blocking
calls (long flatlines) or very tall spiky blocks (recursive
calls and js).
... a significant portion of time can be spent in idle, blocking
calls like waiting for events.
...And 4 more matches
Index - Archive of obsolete content
420 using dehydra as gcc compiles file, dehydra
calls functions in the user analysis script with information about the code being compiled.
...the final goal is to find the correct stream listener to pump the data into when necko
calls ondataavailable (e.g., we may find the html parser as the stream listener to give the data to).
...it explains the concept of dom documents, demonstrates a few simple examples of using dom
calls to perform basic manipulations on a document, and then demonstrates working with anonymous xbl content using mozilla-specific methods.
...And 3 more matches
Plug-in Development Overview - Gecko Plugin API Reference
to see your plug-in in action, simply display the html page that
calls it in the browser.
... to determine the mime types and file extensions that the plug-in handles, the browser loads each library and
calls into the np_getmimedescription entry point.
... the browser
calls these plug-in methods: npp_getvalue: query the plug-in for information.
...And 3 more matches
IME handling guide
then, it
calls contentcacheinparent::oneventneedingackhandled().
...then, tabchild
calls imestatemanager::oninstalledmenukeyboardlistener() in the remote process.
... forcibly committing composition when textcomposition::requesttocommit()
calls nsiwidget::notifyime(), it guarantees synchronous commit or canceling composition.
...And 3 more matches
Starting WebLock
this notification will occur during initialization of xpcom, where all xpcom services are guaranteed to be available during the
calls.
...this method * is generally used to determine whether or not to initiate or * continue iteration over the enumerator, though it can be * called without subsequent getnext()
calls.
...the interface callback looks like this: [scriptable, uuid(bbf8cab0-d43a-11d3-8cc2-00609792278c)] interface nsidirectoryserviceprovider: nsisupports { /** * getfile * * directory service
calls this when it gets the first request for * a prop or on every request if the prop is not persistent.
...And 3 more matches
nsITransactionListener
diddo() called after a nsitransactionmanager
calls the nsitransaction.dotransaction() method of a transaction.
... didredo() called after a nsitransactionmanager
calls the nsitransaction.redo() method of a transaction.
... didundo() called after a nsitransactionmanager
calls the nsitransaction.undo() method of a transaction.
...And 3 more matches
Plug-in Development Overview - Plugins
to see your plug-in in action, simply display the html page that
calls it in the browser.
... to determine the mime types and file extensions that the plug-in handles, the browser loads each library and
calls into the np_getmimedescription entry point.
... the browser
calls these plug-in methods: npp_getvalue: query the plug-in for information.
...And 3 more matches
Using microtasks in JavaScript with queueMicrotask() - Web APIs
batching operations you can also use microtasks to collect multiple requests from various sources into a single batch, avoiding the possible overhead involved with multiple
calls to handle the same kind of work.
...that means that any further
calls to sendmessage() made in the interim will push their messages onto the message queue, but because of the array length check before adding a microtask, no new microtask is enqueued.
...this call is bracketed by
calls to log(), a custom function that simply outputs text to the screen.
...And 3 more matches
WebGL best practices - Web APIs
the overhead for this is relatively low, but re-using vaos means fewer vertexattribpointer
calls too, so it's worth doing wherever it's easy.
... avoid blocking api
calls in production (e.g.
... batch draw
calls (prefer fewer-but-larger draw
calls) fewer, larger draw operations will generally improve performance.
...And 3 more matches
WebRTC connectivity - Web APIs
regardless of whether it's a new call, or reconfiguring an existing one, these are the basic steps which must occur to exchange the offer and answer, leaving out the ice layer for the moment: the caller captures local media via navigator.mediadevices.getusermedia() the caller creates rtcpeerconnection and called rtcpeerconnection.addtrack() (since addstream is deprecating) the caller
calls rtcpeerconnection.createoffer() to create an offer.
... the caller
calls rtcpeerconnection.setlocaldescription() to set that offer as the local description (that is, the description of the local end of the connection).
... the recipient receives the offer and
calls rtcpeerconnection.setremotedescription() to record it as the remote description (the description of the other end of the connection).
...And 3 more matches
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
myth: msaa is too slow reality: assistive technology vendors have found ways around most of the performance problems related to out-of-process com method
calls.
...in custom interfaces, create methods that hand back a lot of data in one call, rather than requiring a large number of
calls.
... fewer
calls are much better better because com marshaling is slow.
...And 3 more matches
console - Archive of obsolete content
at a given logging level, only
calls to the corresponding functions and functions with a higher severity will have any effect.
... for example, if the logging level is set to "info", then
calls to info(), log(), warn(), and error() will all result in output being written.
... but if the logging level is "warn" then only
calls to warn() and error() have any effect, and
calls to info() and log() are simply discarded.
...And 2 more matches
The life of an HTML HTTP request - Archive of obsolete content
[note: passes nswebshell.mobserver as nsistreamobserver and the webshell as nsicontentviewercontainer to the docloader.] (2) the document loader
calls ns_openuri with the url to begin transfering the requested file.
... (3) when data is starting to come from the webserver the nsichannel
calls the onstartrequest in the documenloader.
...this argument is always pr_false when the content sink
calls appendchild.
...And 2 more matches
Functions — reusable blocks of code - Learn web development
the above function for example
calls the random() function three times, which is defined by the following code: function random(number) { return math.floor(math.random()*number); } we needed this function because the browser's built-in math.random() function only generates a random decimal number between 0 and 1.
... function myfunction() { alert('hello'); } myfunction(); //
calls the function once anonymous functions you may see functions defined and invoked in slightly different ways.
...these work fine because even though the output()
calls are not in the same scope as x is defined in, x is a global variable so is available inside all code, everywhere.
...And 2 more matches
Necko walkthrough
there is an option to receive ondataavailable specifically on a non-main thread, but all other
calls happen on the main thread.
... dispatches the nsconnevent to the socket thread back to the context of nshttpchannel::continueconnect: nsinputstreampump->asyncread this pump
calls nsiasyncinputstream::asyncwait (the input for the response stream pipe created with the nshttptransaction, i.e.
...streamready nshttpconnection::onsocketwritable tries to write the request data from the current transaction (mtransaction) tells the transaction to now wait (`resumerecv) nshttpconnection::resumerecv nshttptransaction::readsegments readrequestsegment is passed to mrequeststream->readsegments - this function pointer is called and used to read the request bytes, which in turn
calls ...
...And 2 more matches
Using the Multiple Accounts API
news.mozilla.org +- netscape.public.mozilla.announce +- netscape.public.mozilla.mail-news relevant api
calls: nsimsgaccount.incomingserver nsimsgaccountmanager.allservers: a list of all servers held by all accounts.
... in the above example, the list of identities would be as follows: alec flett <alecf@mywork.com>) alec flett <alecf@myisp.com>) alec flett <alecfnospam@myisp.com>) relevant api
calls: nsimsgaccount.identities nsimsgaccountmanager.allservers: a list of all servers across all accounts storage the accounts are stored in the preferences.
...you can do this by referring to the same identity or server key in the preferences, or with clever
calls to the account manager.
...And 2 more matches
WebIDL bindings
implement a wrapobject override on mozilla::dom::myinterface that just
calls through to mozilla::dom::myinterface_binding::wrap.
... errorresult& rv); void dosomethingelse(myclass& aotherinstance, errorresult& rv); void dotheother(jscontext* cx, js::value asomething); void doyetanotherthing(bool aactuallydoit); static void staticoperation(const globalobject& aglobal, js::value asomething); } c++ reflections of webidl attributes a webidl attribute is turned into a pair of method
calls for the getter and setter on the underlying c++ object.
... in cases when the specification
calls for throwing a typeerror, you should use errorresult::throwtypeerror() instead of calling throw().
...And 2 more matches
Flame Chart - Firefox Developer Tools
underneath that, colored olive-green, are the
calls it's making to sort().
... underneath that, like the teeth of a comb, are all the
calls being made to each sorting algorithm.
...we can see that the purple markers underneath bubblesort() are the
calls to swap().
...And 2 more matches
Key Values - Web APIs
this is typically actually a button on the headset which is used to hang up
calls and play or pause media.
... vk_clear_favorite_3 "favoriterecall0" selects (re
calls) the program or content stored in the first favorites list slot.
... vk_recall_favorite_0 "favoriterecall1" selects (re
calls) the program or content stored in the second favorites list slot.
...And 2 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.
... console.log(a); console.log(b); } example 2: alternating two colors the following example
calls the flashtext() function once a second until the stop button is pressed.
... javascript 1.8.5 introduces the function.prototype.bind() method, which lets you specify the value that should be used as this for all
calls to a given function.
...And 2 more matches
HTML5 Parser - Developer guides
calls to innerhtml are a lot faster.
... calling document.write() during parsing prior to html5, gecko and webkit allowed
calls to document.write() during parsing to insert content into the source stream.
...in ie, such
calls are either ignored or imply a call to document.open(), replacing the document.
...And 2 more matches
JavaScript Daemons Management - Archive of obsolete content
mydaemon.setrate(milliseconds) sets the time lapse between
calls (in milliseconds).
... mydaemon.makesteps(howmany[, backwards[, force]])
calls synchronously the callback function howmany times.
... mydaemon.skipto(index[, force])
calls synchronously the callback function the number of times needed to reach the index position.
... mydaemon.skipfor(delta[, force])
calls synchronously the callback function howmany times in the same direction in which it was oriented.
Dehydra Function Reference - Archive of obsolete content
process_type(type) dehydra
calls this for each class, struct, enum, union, and typedef declaration.
... process_function(decl, body) dehydra
calls this for each function definition (declarations without bodies are not included), including both top-level functions, class member functions, and inline class member functions.
... decl is a variable type object representing the function being processed body is an array of {loc:, statements:array of variable types} representing an outline of the function stripped down to variables, function
calls and assignments.
...includes are guarded so a file is only included once and subsequent include
calls are ignored.
NPN_GetURLNotify - Archive of obsolete content
it returns immediately and only later handles the request and
calls npp_urlnotify().
... for requests that complete unsuccessfully, the browser
calls npp_urlnotify() as soon as possible.
... for requests that complete successfully: if the target is non-null, the browser
calls npp_urlnotify() after it has finished loading the url.
... if the target is null, the browser
calls npp_urlnotify() after closing the stream by calling npn_destroystream().
NPN_RequestRead - Archive of obsolete content
this initiates a read operation; the actual data is received through subsequent
calls to npp_writeready() and npp_write().
...the plug-in
calls npn_requestread() to request data from a seekable stream.
...these requests result in subsequent
calls to npp_writeready() and npp_write().
...if the plug-in requests multiple ranges (either through a list of npbyterange objects in a single call to npn_requestread(), or multiple
calls to npn_requestread()), the browser can write individual ranges in any order, and with any number of npp_writeready() and npp_write()
calls.
NPP_Write - Archive of obsolete content
if the return value is smaller than the size of the buffer, the browser sends the remaining data to the plug-in through subsequent
calls to npp_writeready and npp_write.
...description the browser
calls the npp_write function to deliver the data specified in a previous npp_writeready call to the plug-in.
...after a stream is created by a call to npp_newstream, the browser
calls npp_write either: if the plug-in requested a normal-mode stream, the data in the stream is delivered to the plug-in instance in a series of
calls to npp_writeready and npp_write.
... if the plug-in requested a seekable stream, the npn_requestread function requests reads of a specified byte range that results in a series of
calls to npp_writeready and npp_write.
NPStream - Archive of obsolete content
the browser cannot delete the object until after it
calls npp_destroystream or the plug-in
calls npn_destroystream.
...all api
calls that operate on the stream (such as npp_writeready and npp_write) use a pointer to this stream.
...streams produced by the plug-in: the browser creates the npstream object and returns it as an output parameter when the plug-in
calls npp_newstream.
... the plug-in must pass a pointer to the npstream to all api
calls that operate on the stream, such as npn_write and npn_destroystream.
Using workers in extensions - Archive of obsolete content
the worker the worker thread's job in this example is to issue the xmlhttprequest
calls that fetch the updated stock information.
...every 10 minutes, it
calls xmlhttprequest, and, when the results are received, sends an event back to the main thread with the received data.
...it starts by setting up an interval handler (in lines 26-28) that
calls refreshinformation() every 10 minutes.
... lines 17-20 change the definition of the worker's onmessage handler so that when the worker
calls back to the main thread, the main thread's value of this is correctly the main thread's object instead of the worker's.
Graceful asynchronous programming with Promises - Learn web development
that button's handler
calls getusermedia() in order to get access to the user's camera and microphone.
...it then
calls getusermedia(), asking for a stream that has both video and audio tracks, then once that's been obtained, sets up a video element to show the stream coming from the camera as a "self view," then takes each of the stream's tracks and adds them to the webrtc rtcpeerconnection representing a connection to another user.
...even if the handlecallbutton() function has already returned to the code that called it, when getusermedia() has finished working, it
calls the handler you provide.
... inside your <script> element, add the following line: let promise = fetch('coffee.jpg'); this
calls the fetch() method, passing it the url of the image to fetch from the network as a parameter.
IPDL Tutorial
the rpc qualifiers mean that if the parent
calls "callmecallyou()" on the child actor, then the child actor, while servicing this call, is allowed to call back into the parent actor's "callyou()" message.
... chrome to content
calls (for ipc tabs) must only use async semantics.
...nstructed and doesn't require an ipdl connection throughout its lifetime, or implements a refcounted protocol where the first form of constructor is not available, there is a second form of sendpfooconstructor which can be used: class examplechild { public: void dosomething() { amanagerchild->sendpexampleconstructor(this, ...); } }; internally, the first constructor form simply
calls pexample(parent|child)* actor = allocpexample(...); sendpexampleconstructor(actor, ...); return actor; with the same effect.
... apsubexampleparent->send__delete__(); will trigger the following ordered function
calls: psubexampleparent::actordestroy(deletion) /* deletion is an enumerated value indicating that the destruction was intentional */ pexampleparent::deallocpsubexample() psubexamplechild::recv__delete__() psubexamplechild::actordestroy(deletion) pexamplechild::deallocpsubexample() actordestroy is a generated function that allows code to run with the knowledge that actor deallocation is imminent...
Mozilla DOM Hacking Guide
the first one
calls the second one.
... to define the jsvals, init() simply
calls definestaticjsvals().
... to register the class names and class protos, init() simply
calls registerclassprotos and registerclassnames.
... on subsequent
calls to this function with the same aid passed in, mcachedclassinfo will still be there, and thus the creation of a new helper class will not be necessary.
PKCS11 FAQ
nss
calls c_getsessioninfo to get the login/logout state.
...however, these are not the services nss
calls to get to other pkcs #11 modules, which show up separately under cryptographic modules.
...when nss needs to do anything with a private key, it
calls the pcks #11 module that holds the key.
...is it safe to assume that nss never
calls c_createobject for those persistent objects?
NSS PKCS11 Functions
once the the module has been successfully loaded, other nss
calls will use it in the normal course of searching.
...until the secmod_closeuserdb function is called, the newly opened database will be visible to any nss
calls search for keys or certs.
...the pk11_findcertfromnickname function
calls the password callback function set with pk11_setpasswordfunc and passes it the pointer specified by the wincx parameter.
...the pk11_findkeybyanycert function
calls the password callback function set with pk11_setpasswordfunc and passes it the pointer specified by the wincx parameter.
Python binding for NSS
the design of python-nss follows these basic guiding principles: be a thin layer with almost a one-to-one mapping of nss/nspr
calls to python methods and functions.
... nss/nspr objects which have "get" and "set" api function
calls are exposed as python properties.
...sock.readline()
calls sock.recv() internally until a complete line is read or the socket is closed.
...tuple.str() in cpython only
calls repr() on each member.
sslintro.html
brings an ordinary nspr socket into the ssl library, returning a new nspr socket that can be used to make ssl
calls.
...for simple encrypted and authenticated communications, no further
calls to ssl functions are required.
...for an ssl socket that is configured before it is connected, ssl figures this out when the application
calls pr_connect or pr_accept.
... functions that can be used by both clients and servers during communication include the following: pr_send or pr_write pr_read or pr_recv pr_geterror pr_getpeername pr_sleep pr_malloc pr_free pr_poll pr_now pr_intervaltomilliseconds pr_millisecondstointerval pr_shutdown pr_close ssl_invalidatesession after establishing a connection, an application first
calls pr_send, pr_recv, pr_read, pr_write, or ssl_forcehandshake to initiate the handshake.
Scripting Java
for example, the following code actually
calls the file object's getname and isdirectory methods.
... as an example, consider the following java class that defines a number of overloaded methods and
calls them.
... } } 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 matches the argument.
... behind the scenes, rhino generates the bytecode for a new java class that implements runnable and forwards all
calls to its run method over to an associated javascript object.
Tracing JIT
the monitor then
calls into the native code stored in the fragment.
... the monitor then
calls into the native code of the trace, passing in a pointer to the state structure as the sole argument.
...frame reconstruction is necessary because a trace may inline a number of function
calls, and may exit before those function
calls return.
... the term deep bail denotes a special case of bailing: when a trace
calls a native spidermonkey c function that gets part-way through executing and then forces a trace-exit (possibly due to a nested c function depending on not-yet-flushed state in the trace).
JS_CallFunction
calls a specified js function.
... description js_callfunction
calls a specified function, fun, on an object, obj.
... js_callfunctionname
calls a function with specified name, name on an object obj.
... js_callfunctionvalue
calls a specified function, fval on an object obj.
JS_THREADSAFE
requests must be bracketed with
calls to js_beginrequest() and js_endrequest().
...in js_threadsafe builds, the javascript engine
calls this callback only from within an active request on cx.
...this means that any potentially long-running operation in a native must be bracketed with
calls to js_suspendrequest() and js_resumerequest().
...when one thread
calls js_gc or otherwise finds that garbage collection is necessary, it must wait for all other threads that are in requests to pause before garbage collection can occur.
Shell global objects
subsequent
calls without an argument then read from this buffer line by line.
... addpromisereactions(promise, onresolve, onreject)
calls the js::addpromisereactions jsapi function with the given arguments.
...such objects are allocated only by
calls to this function, never implicitly by the system, making them suitable for use in allocation tooling tests.
... getwaitforallpromise(densepromisesarray)
calls the getwaitforallpromise jsapi function and returns the result promise.
An Overview of XPCOM
when you implement the nsisupports class (and you'll see in the chapter using xpcom utilities to make things easier how macros can make this process much easier), you must make sure the class methods return a valid result when the client
calls queryinterface with the nsisupports iid.
...for example, if a factory creates an object that is supposed to be a singleton, then subsequent
calls to the factory for the object should return the same object.
... ns_addref
calls addref on an nsisupports object.
... ns_release
calls release on an nsisupports object.
Finishing the Component
when your component runs in a version of gecko in which this interface is updated, your method
calls will be routed through a different v-table than the one the component expected, most likely resulting in a crash.
...the component
calls the method testa and passes an integer, 10.
...an->addcategoryentry("content-policy", "weblock", weblock_contractid, pr_true, pr_true, &previous); if (previous) nsmemory::free(previous); return rv; } this code adds a new category entry under the topic "content-policy," and it
calls addcategoryentry in the same way we did in registering for notifications.
...when the component is loaded, gecko
calls the nsicontentpolicy implementation in weblock on every page load, and this prevents pages from displaying by returning the proper value when the load method is called.
nsIAppShell
calls to this function may be nested.
... when the number of
calls that pass pr_true is subtracted from the number of
calls that pass pr_false is greater than 0, performance is given precedence over preventing event starvation.
...
calls to suspendnative() and resumenative may be nested.
...
calls to suspendnative and resumenative() may be nested.
nsIContentSecurityPolicy
calls to this may trigger violation reports when queried, so this value should not be cached.
...
calls to this may trigger violation reports when queried, so this value should not be cached.
...
calls to this may trigger violation reports when queried, so this value should not be cached.
...
calls to this may trigger violation reports when queried, so this value should not be cached.
nsINavBookmarksService
calls can be nested, observers will only be notified when all batches begin/end.
... note: this does not restrict api
calls, only ui actions.
...
calls can be nested.
... note: this does not restrict api
calls, only ui actions.
nsIRadioInterfaceLayer
ozilla.org/telephony/system-worker-manager;1"] .getservice(components.interfaces.nsiinterfacerequestor) .createinstance(components.interfaces.nsiradiointerfacelayer); method overview void answercall(in unsigned long callindex); void deactivatedatacall(in domstring cid, in domstring reason); void dial(in domstring number); void enumerate
calls(in nsiriltelephonycallback callback); void getdatacalllist(); unsigned short getnumberofmessagesfortext(in domstring text); void hangup(in unsigned long callindex); void registercallback(in nsiriltelephonycallback callback); void registerdatacallcallback(in nsirildatacallback callback); void rejectcall(in unsigned long callindex); void sendsms(in domstring number, in domstring messa...
... in unsigned long callindex ); parameters callindex missing description exceptions thrown missing exception missing description deactivatedatacall() void deactivatedatacall( in domstring cid, in domstring reason ); parameters cid missing description reason missing description exceptions thrown missing exception missing description dial() functionality for making and managing phone
calls.
... void dial( in domstring number ); parameters number missing description exceptions thrown missing exception missing description enumerate
calls() will continue calling callback.enumerate
callstate until the callback returns false.
... void enumerate
calls( in nsiriltelephonycallback callback ); parameters callback missing description exceptions thrown missing exception missing description getdatacalllist() void getdatacalllist(); parameters none.
nsITransactionManager
dotransaction()
calls a transaction's nsitransaction.dotransaction() method, then pushes it on the undo stack.
... this method
calls the transaction's nsitransaction.addref() method.
...redotransaction() pops the topmost transaction on the redo stack,
calls it's nsitransaction.redotransaction() method, then pushes it on the undo stack.
... undotransaction() pops the topmost transaction on the undo stack,
calls it's nsitransaction.undotransaction() method, then pushes it on the redo stack.
Getting Started Guide
nsresult rv; nscomptr<nsifoo> foo(do_queryinterface(bar, &rv)); // or, if you don't care about the |nsresult| nscomptr<nsifoo> foo(do_queryinterface(bar)); nscomptr happily
calls addref and release implicitly.
...an nscomptr automatically
calls addref and release (only) on its own behalf.
...an nscomptr always
calls release before letting go, whether the nscomptr is letting go so that it can point to a different object, or because the nscomptr is going out of scope.
...nscomptr never
calls queryinterface implicitly, i.e., you must call it yourself, or explictly ask nscomptr to call it with do_queryinterface.
Scripting plugins - Plugins
the threading model for this api is such that all
calls through this api are synchronous and
calls from a plugin to methods in this api must come from the thread on which the plugin was initiated, and likewise all
calls to methods in this api by the browser are guaranteed to come from the same thread.
... future revisions to this api might provide a mechanism for proxying
calls from one thread to another to aid in using this api from other threads.
... security model the security model for making
calls through this api is much like the general same-origin security model enforced by the browser.
... in addition to this, a further extension to this api is being discussed that would give a plugin greater flexibility by letting the plugin control the origin of the calling code, so that the plugin can specify the origin of
calls that come from internally loaded code from other origins.
Version, UI, and Status Information - Plugins
to accomplish this, the plug-in
calls the npn_status method to display your message on the status line.
... the plug-in
calls the npn_useragent method to retrieve the contents of the user_agent field.
... the plug-in
calls the npn_version method to check for changes in major and minor plug-in api version numbers.
... this code declares variables to hold the version numbers and
calls npn_version to return the major and minor version numbers for the browser and the plug-in api.
Debugger - Firefox Developer Tools
uncaughtexceptionhook either null or a function that spidermonkey
calls when a call to a debug event handler, breakpoint handler, or similar function throws some exception, which we refer to asdebugger-exception here.
... exceptions thrown in the debugger are not propagated to debuggee code; instead, spidermonkey
calls this function, passingdebugger-exception as its sole argument and the debugger instance as the this value.
... when one of the events described below occurs in debuggee code, the engine pauses the debuggee and
calls the corresponding debugging handler on each debugger instance that is observing the debuggee.
... spidermonkey only
calls onenterframe to report visible, non-"debugger" frames.
Debugger.Object - Firefox Developer Tools
this handler method is only called when attributes of the property other than its value are being changed; if only the value is changing, spidermonkey
calls the handler's set method.
... spidermonkey only
calls this method on assignments to data properties that will succeed; assignments to un-writable data properties fail without notifying the debugger.
... for all watchpoint handler methods: handler
calls receive the handler object itself as the this value.
... watchpoint handler
calls are cross-compartment, intra-thread
calls: the call takes place in the same thread that changed the property, and inhandler's method's compartment (typically the same as the debugger's compartment).
Call Tree - Firefox Developer Tools
this is telling us that some samples were taken in sort() itself, rather than in the functions it
calls.
...these represent internal browser
calls.
...if we look at the code for sort(), it should be fairly obvious that the high platform data cost is coming from repeated
calls to console.log(): function sort(unsorted) { console.log(bubblesort(unsorted)); console.log(selectionsort(unsorted)); console.log(quicksort(unsorted)); } it would certainly be worthwhile considering more efficient ways of implementing this.
... using an inverted, aka bottom-up, call tree an inverted call tree reverses the order of all stacks, putting the leafmost function
calls at the top.
Web Console remoting - Firefox Developer Tools
you can only get cached messages for page errors and console api
calls.
...], "from": "conn0.console9" } each message in the array is of the same type as when we send typical page errors and console api
calls.
... console api messages the window.console api
calls send internal messages throughout gecko which allow us to do whatever we want for each call.
...this clears the console api
calls cache and should clear the page errors cache - see bug 717611.
File and Directory Entries API - Web APIs
if the result isn't null, then it's a dropped file or directory, and you can use file system
calls to work with it.
... fileerror represents an error which is generated by asynchronous file system
calls.
... synchronous api the synchronous api is should only be used in workers; these
calls block until they're finished executing, and simply return the results instead of using callbacks.
... fileexception represents an error which is generated by synchronous file system
calls.
In depth: Microtasks and the JavaScript runtime environment - Web APIs
when greetuser()
calls localgreeting(), another context is created to run that function.
... when greetuser()
calls localgreeting(), another context is created to run that function.
... when greetuser()
calls localgreeting(), another context is created to run that function.
...by using the contexts and the context stack in this manner, many of the fundamentals of how a program operates can be managed, including local and global variables, function
calls and returns, and so forth.
SVGSVGElement - Web APIs
calls to suspendredraw() and unsuspendredraw() should, but need not be, made in balanced pairs.
... to suspend redraw actions as a collection of svg dom changes occur, precede the changes to the svg dom with a method call similar to: const suspendhandleid = suspendredraw(maxwaitmilliseconds) and follow the changes with a method call similar to: unsuspendredraw(suspendhandleid) note that multiple suspendredraw()
calls can be used at once, and that each such method call is treated independently of the other suspendredraw() method
calls.
... svgsvgelement.unsuspendredrawall() cancels all currently active suspendredraw() method
calls.
... this method is most useful at the very end of a set of svg dom
calls to ensure that all pending suspendredraw() method
calls have been cancelled.
Using the Screen Capture API - Web APIs
async function startcapture() { logelem.innerhtml = ""; try { videoelem.srcobject = await navigator.mediadevices.getdisplaymedia(displaymediaoptions); dumpoptionsinfo(); } catch(err) { console.error("error: " + err); } } after clearing the contents of the log in order to get rid of any leftover text from the previous attempt to connect, startcapture()
calls getdisplaymedia(), passing into it the constraints object defined by displaymediaoptions.
... function stopcapture(evt) { let tracks = videoelem.srcobject.gettracks(); tracks.foreach(track => track.stop()); videoelem.srcobject = null; } dumping configuration information for informational purposes, the startcapture() method shown above
calls a method named dumpoptions(), which outputs the current track settings as well as the constraints that were placed upon the stream when it was created.
...click the start capture button to begin.</p> <p><button id="start">start capture</button> <button id="stop">stop capture</button></p> <video id="video" autoplay></video> <br> <strong>log:</strong> <br> <pre id="log"></pre> the key parts of the html are: a <button> labeled "start capture" which, when clicked,
calls the startcapture() function to request access to, and begin capturing, screen contents.
... a second button, "stop capture", which upon being clicked
calls stopcapture() to terminate capture of screen contents.
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
pressing the first button will set a timeout which
calls an alert dialog after two seconds and stores the timeout id for use by cleartimeout().
...settimeout.call(myarray, myarray.mymethod, 2.0*1000); // prints "zero,one,two" after 2 seconds settimeout.call(myarray, myarray.mymethod, 2.5*1000, 2); // prints "two" after 2.5 seconds note: javascript 1.8.5 introduced the function.prototype.bind() method to set the value of this for all
calls to a given function.
... timeouts throttled to ≥ 4ms in modern browsers, settimeout()/setinterval()
calls are throttled to a minimum of once every 4 ms when successive
calls are triggered due to callback nesting (where the nesting level is at least a certain depth), or after certain number of successive intervals.
...firefox) — on setinterval()
calls made from anywhere, or when a nested settimeout() is called where the nesting level is at least a certain depth.
Functions - JavaScript
for example, if you define the function square, you could call it as follows: square(5); the preceding statement
calls the function with an argument of 5.
...there are three ways for a function to refer to itself: the function's name arguments.callee an in-scope variable that refers to the function for example, consider the following function definition: var foo = function bar() { // statements go here } within the function body, the following are all equivalent: bar() arguments.callee() foo() a function that
calls itself is called a recursive function.
...for example, getting all the nodes of a tree structure (such as the dom) is easier via recursion: function walktree(node) { if (node == null) // return; // do something with node for (var i = 0; i < node.childnodes.length; i++) { walktree(node.childnodes[i]); } } compared to the function loop, each recursive call itself makes many recursive
calls here.
...are: var a = [ 'hydrogen', 'helium', 'lithium', 'beryllium' ]; var a2 = a.map(function(s) { return s.length; }); console.log(a2); // logs [8, 6, 7, 9] var a3 = a.map(s => s.length); console.log(a3); // logs [8, 6, 7, 9] no separate this until arrow functions, every new function defined its own this value (a new object in the case of a constructor, undefined in strict mode function
calls, the base object if the function is called as an "object method", etc.).
Optional chaining (?.) - JavaScript
when used with function
calls, it returns undefined if the given function does not exist.
...undefined : temp.second); optional chaining with function
calls you can use optional chaining when attempting to call a method which may not exist.
... using optional chaining with function
calls causes the expression to automatically return undefined instead of throwing an exception if the method isn't found: let result = someinterface.custommethod?.(); note: if there is a property with such a name and which is not a function, using ?.
...do something with the data } catch (err) { if (onerror) { // testing if onerror really exists onerror(err.message); } } } // using optional chaining with function
calls function dosomething(oncontent, onerror) { try { // ...
Spread syntax (...) - JavaScript
spread syntax (...) allows an iterable such as an array expression or string to be expanded in places where zero or more arguments (for function
calls) or elements (for array literals) are expected, or an object expression to be expanded in places where zero or more key-value pairs (for object literals) are expected.
... syntax for function
calls: myfunction(...iterableobj); for array literals or strings: [...iterableobj, '4', 'five', 6]; for object literals (new in ecmascript 2018): let objclone = { ...obj }; rest syntax (parameters) rest syntax looks exactly like spread syntax.
... examples spread in function
calls replace apply() it is common to use function.prototype.apply() in cases where you want to use the elements of an array as arguments to a function.
... spread syntax (other than in the case of spread properties) can be applied only to iterable objects: const obj = {'key1': 'value1'}; const array = [...obj]; // typeerror: obj is not iterable spread with many values when using spread syntax for function
calls, be aware of the possibility of exceeding the javascript engine's argument length limit.
Classes and Inheritance - Archive of obsolete content
constructor
calls differ from ordinary function
calls in that javascript automatically creates a new object and binds it to the keyword this for the duration of the call.
...constructors are just ordinary functions, however, so it is perfectly legal to perform ordinary function
calls on them.
...however, since the value of this is undefined for ordinary function
calls, we need to add some boilerplate code to convert them to constructor
calls: function shape(x, y) { if (!this) return new shape(x, y); this.x = x; this.y = y; } prototypes every object has an implicit property, known as its prototype.
ui/button/toggle - Archive of obsolete content
the checked property is not only updated directly by assignment, but is also updated when the user clicks the button (or when some code
calls button.click()).
... events click this event is emitted when a user clicks the button or your add-on
calls the button's click() method.
... change this event is emitted when a user clicks the button or your add-on
calls the button's click() method.
JavaScript timers - Archive of obsolete content
documentation settimeout()
calls a function or executes a code snippet after specified delay.
... setinterval()
calls a function or executes a code snippet repeatedly, with a fixed time delay between each call to that function.
... setimmediate()
calls a function immediately after the browser has completed other operations, such as events and display updates.
Block and Line Layout Cheat Sheet - Archive of obsolete content
in this case, the flag won't be set, so subsequent
calls to shouldapplytopmargin() will continue crawl the line list.) this flag is also set in the nsblockreflowstate constructor if brs_istopmarginroot is set; that is, if the frame being reflowed is a margin root by default.
...nsinlineframe::reflowframes creates a new perspandata when it
calls nslinelayout::beginspan: at this time, the nslinelayout object's mcurrentspan is switched to the new span.
...after reflowing the child inline frames, nsinlineframe::reflowframes
calls nslinelayout::endspan, which pops the perspandata and re-sets mcurrentspan.
Style System Overview - Archive of obsolete content
otherwise, we need to compute the struct, so nsrulenode::getstyledata
calls nsrulenode::get*data, which initializes the correct one of the data structs on the stack (the structs used by nscssdeclaration) style data computation get*data
calls nsrulenode::walkruletree, which walks from the style context's rule node towards the root rule node.
... style data computation after walkruletree stops walking up, it
calls nsrulenode::compute*data to turn the specified values into the mostly-computed style data in the style struct.
... presshell::reconstructstyledata
calls framemanager::computestylechangefor (reresolve) and then processes the frame-change list.
Binding Implementations - Archive of obsolete content
// myelement is a colorpickergrid myelement.colorpicker.setcolor(); //
calls the colorpicker method.
... myelement.setcolor(); //
calls the colorpickergrid method.
... myelement.basebinding.setcolor(); //
calls the colorpicker method.
Dynamically modifying XUL-based user interface - Archive of obsolete content
it explains the concept of dom documents, demonstrates a few simple examples of using dom
calls to perform basic manipulations on a document, and then demonstrates working with anonymous xbl content using mozilla-specific methods.
...if you have ever written a script that interacts with a xul (or html) document, you have already used dom
calls.
...you may also have used other
calls, such as element.setattribute(), or, if you wrote an extension, the addeventlistener() method.
textbox (Toolkit autocomplete) - Archive of obsolete content
onsearchcomplete() return type: no return value
calls the onsearchcomplete event handler.
... ontextentered() return type: event result
calls the ontextentered event handler.
... ontextreverted() return type: event result
calls the ontextreverted event handler.
NPN_MemAlloc - Archive of obsolete content
description the plug-in
calls npn_memalloc to allocate a specified amount of memory in the browser's memory space.
...since npn_memalloc automatically frees cached information if necessary to fulfill the request,
calls to npn_memalloc may succeed where direct
calls to newptr fail.
... existing
calls to npn_memflush have no effect.
NPN_SetValue - Archive of obsolete content
to specify an opaque mode, the plugin
calls npn_setvalue with nppvplugintransparentbool for the variable parameter and false for the value parameter.
...normally, when the browser navigates away from the page containing the plugin, all plugin instances get an npp_destroy call, and if there are no more instances of the plugin active, the plugin
calls its np_shutdown method and the plugin dll gets unloaded from memory.
...the plugin
calls npn_setvalue any time with nppvpluginkeeplibraryinmemory as variable parameter and value set to true.
NPWindow - Archive of obsolete content
the browser
calls npp_setvalue whenever the drawable changes.
...for windowed plug-ins, the browser
calls the npp_setwindow method with an npwindow structure that represents a drawable (a pointer to an npwindow allocated by the browser).
...for windowless plug-ins, the browser
calls the npp_setwindow method with an npwindow structure that represents a drawable.
NP_Initialize - Archive of obsolete content
description the browser
calls this function only once: when a plug-in is loaded, before the first instance is created.
... this is the first function that the browser
calls.
... after the last instance of a plug-in has been deleted, the browser
calls np_shutdown, where you can release allocated memory or resources.
LiveConnect Overview - Archive of obsolete content
a java object of any other class is converted to a javascript wrapper, which can be used to access methods and fields of the java object: converting this wrapper to a string
calls the tostring method on the original object.
... converting to a number
calls the doublevalue method, if possible, and fails otherwise.
... converting to a boolean in javascript 1.2 and earlier versions
calls the booleanvalue method, if possible, and fails otherwise.
Efficient animation for web games - Game development
to save battery life, it is best to only draw when there are things going on, so that would mean calling requestanimationframe (or your refresh function, which in turn
calls that) in response to events happening in your game.
...an easy way to do this is to declare your own refresh function that sets a flag when it
calls requestanimationframe.
... 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 ...
Call stack - MDN Web Docs Glossary: Definitions of Web-related terms
a call stack is a mechanism for an interpreter (like the javascript interpreter in a web browser) to keep track of its place in a script that
calls multiple functions — what function is currently being run and what functions are called from within that function, etc.
... when a script
calls a function, the interpreter adds it to the call stack and then starts carrying out the function.
... any functions that are called by that function are added to the call stack further up, and run where their
calls are reached.
Index - MDN Web Docs Glossary: Definitions of Web-related terms
62 call stack call stack, codingscripting, glossary, javascript a call stack is a mechanism for an interpreter (like the javascript interpreter in a web browser) to keep track of its place in a script that
calls multiple functions — what function is currently being run and what functions are called from within that function, etc.
...it's used for sending traditional telephone
calls over the internet, but is also used for webrtc data.
... 521 jquery glossary, jquery, javascript jquery is a javascript library that focuses on simplifying dom manipulation, ajax
calls, and event handling.
Function return values - Learn web development
our draw() function draws 100 random circles somewhere on an html <canvas>: function draw() { ctx.clearrect(0, 0, width, height); for (let i = 0; i < 100; i++) { ctx.beginpath(); ctx.fillstyle = 'rgba(255,0,0,0.5)'; ctx.arc(random(width), random(height), random(50), 0, 2 * math.pi); ctx.fill(); } } inside each loop iteration, three
calls are made to the random() function, to generate a random value for the current circle's x-coordinate, y-coordinate, and radius, respectively.
... 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 executed.
...the sentence
calls the squared(), cubed(), and factorial() functions to calculate the required values.
Ember interactivity: Events, classes and state - Learn web development
note: a decorator is basically a wrapper function, which wraps and
calls other functions or properties, providing additional functionality along the way.
...ember
calls these constructs services, and they live for the entire lifetime of the page (a page refresh will clear them; persisting the data for longer is beyond the scope of this tutorial).
...to put this in action, go to your todo-list.hbs component, and replace the static component
calls: <todo /> <todo /> with a dynamic #each block (which is basically syntactic sugar over the top of javascript's foreach()) that creates a <todo /> component for each todo available in the list of todos returned by the service’s all() getter: {{#each this.todos.all as |todo|}} <todo @todo={{todo}} /> {{/each}} another way to look at this: this — the rendering context / component insta...
Getting started with React - Learn web development
line 7
calls react’s reactdom.render() function with two arguments: the component we want to render, <app /> in this case.
...props are written inside component
calls, and use the same syntax as html attributes — prop="value".
... props are written just like attributes inside component
calls and are passed into components.
Handling common JavaScript problems - Learn web development
the right-hand panel shows useful details pertaining to the current environment — breakpoints,
callstack and currently active scopes.
...this is best done using a minification tool like uglify (there's also an online version — see jscompress.com) when using apis, make sure you turn off the api features when they are not being used; some api
calls can be really expensive on processing power.
...when tracking a device's location using repeated geolocation
calls, make sure you turn it off when the user stops using it.
Mozilla accessibility architecture
this tree traversal is accomplished via toolkit-specific
calls which end up as
calls into nsiaccessible methods getaccparent(), getaccnextsibling(), getaccprevioussibling(), getaccfirstchild(), getacclastchild(), getaccchildcount() and getchildat(childnum).
...when the msaa client
calls back for the accessible node using accessibleobjectfromevent(), windows asks our doc accessible for a child with that child id.
...nsaccessnode::init() when nsaccessibilityservice::getaccessible() gets a newly created accessible, it
calls nsiaccessnode::init() on the new object, which will add this to the cache for the doc accessible.
DeferredTask.jsm
multiple
calls don't introduce further delays.
...multiple "arm"
calls within the same tick of the event loop are guaranteed to result in a single execution of the task.
... a common use case occurs when a data structure should be saved into a file every time the data changes, using asynchronous
calls, and multiple changes to the data may happen within a short time: let savedeferredtask = new deferredtask(function* () { yield os.file.writeatomic(...); // any uncaught exception will be reported.
Refcount tracing and balancing
refcount tracing logs
calls to addref and release, preferably for a particular set of classes, including call-stacks in symbolic form (on platforms that support this).
... however, having an nscomptr log and using it in the creation of the balance tree allows addref and release
calls that we know are matched to be eliminated from the tree, so it makes it much easier to debug reference count leaks of objects that have a large amount of reference counting traffic.
...for example: env xpcom_mem_log_classes=nsdocshell xpcom_mem_refcnt_log=./refcounts.log ./mach run this will log the addref and release
calls only for instances of nsdocshell while running the browser using mach, to a file refcounts.log.
browser.dom.window.dump.file
browser.dom.window.dump.file redirects the ouput of window.dump()
calls to a file whose address is specified in this preference if browser.dom.window.dump.enabled is set to true.
... type:string default value:none exists by default: no application support: gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) status: active; last updated 2012-03-18 introduction: pushed to nightly on 2009-04-24 bugs: bug 489938 values the value holds the file system path for the file in which the content of the window.dump()
calls get written, e.g.
... the line breaks have to be in the argument of the dump function, else successive dump
calls will get logged into the same line.
I/O Functions
nspr converts the slashes in a pathname to the directory separator of the native os--for example, backslash (\) on windows and colon (:) on mac os--before passing it to the native system
calls.
... two new functions, pr_transmitfile and pr_acceptread, can exploit the new system
calls of some operating systems for higher performance.
...pollable events are implemented using a pipe or a pair of tcp sockets connected via the loopback address, therefore setting and/or waiting for pollable events are expensive operating system
calls.
PR_AttachThread
pr_init
calls pr_attachthread automatically for the primordial thread.
...a native thread not created by nspr is automatically attached the first time it
calls an nspr function, and automatically detached when it exits.
... in nspr release 19980529b and earlier, it is necessary for a native thread not created by nspr to call pr_attachthread before it
calls any nspr functions, and call pr_detachthread when it is done calling nspr functions.
An overview of NSS Internals
(note that it's important to look at the number 11, as there are other pkcs standards with different numbers that define quite different topics.) a software or hardware module conforming to the pkcs#11 standard implements an interface of c
calls, which allow querying the characteristics and offered services of the module.
...an application is able to modify the policy used at program runtime, by using function
calls to modify the set of enabled cipher suites.
...but if you don't care about modifying the default trust permanently (recorded on disk), you can use the no-database init
calls.
Index
(note that it's important to look at the number 11, as there are other pkcs standards with different numbers that define quite different topics.) a software or hardware module conforming to the pkcs#11 standard implements an interface of c
calls, which allow querying the characteristics and offered services of the module.
...an application is able to modify the policy used at program runtime, by using function
calls to modify the set of enabled cipher suites.
...but if you don't care about modifying the default trust permanently (recorded on disk), you can use the no-database init
calls.
NSS_3.12_release_notes.html
ls bug 327529: can't pass 0 as an unnamed null pointer argument to cert_createrdn bug 334683: extraneous semicolons cause empty declaration compiler warnings bug 335275: compile with the gcc flag -werror-implicit-function-declaration bug 354565: fipstest sha_test needs to detect sha tests that are incorrectly configured for bit oriented implementations bug 356595: on windows, rng_systeminfoforrng
calls getcurrentprocess, which returns the constant (handle)-1.
...bug 287061: crl number should be a big integer, not ulong bug 301213: combine internal libpkix function tests into a single statically linked program bug 324740: add generation of sia and aia extensions to certutil bug 339737: libpkix ocsp checking
calls cert_verifycert bug 358785: merge nss_libpkix_branch back to trunk bug 365966: infinite recursive call in vfy_verifydigestdirect bug 382078: pkix default http client returns error when try to get an ocsp response.
... shutdown failure bug 373367: verify ocsp response signature in libpkix without decoding and reencoding bug 390542: libpkix fails to validate a chain that consists only of one self issued, trusted cert bug 390728: pkix_pl_ocsprequest_create throws an error if it was not able to get aia location bug 397825: libpkix: ifdef code that uses user object types bug 397832: libpkix leaks memory if a macro
calls a function that returns an error bug 402727: functions responsible for creating an object leak if subsequent function code produces an error bug 402731: pkix_pl_pk11certstore_crlquery will crash if fails to acquire dp cache.
nss tech note2
only display the sequence of pkcs #11
calls.
...display the sequence of pkcs #11
calls, and the parameters given to them.
...the number of
calls to each pkcs #11 function will be counted, and the time spent in each function as well.
Rhino scopes and contexts
to associate the current thread with a context, simply call the enter method of context: context cx = context.enter(); once you are done with execution, simply exit the context: context.exit(); these
calls will work properly even if there is already a context associated with the current thread.
... we can now use newscope as a scope for
calls to evaluate scripts.
...
calls to functions in javascript use static scope, which means that variables are first looked up in the function and then, if not found there, in the lexically enclosing scope.
JIT Optimization Outcomes
the most typical operations that are relevant for fast program execution are property accesses and function
calls.
...opstub_arraylength icgetpropstub_unboxedread icgetpropstub_unboxedreadexpando icgetpropstub_unboxedarraylength icgetpropstub_typedarraylength icgetpropstub_domproxyshadowed icgetpropstub_domproxyunshadowed icgetpropstub_genericproxy icgetpropstub_argumentslength icsetpropstub_slot icsetpropstub_genericproxy icsetpropstub_domproxyshadowed icsetpropstub_domproxyunshadowed icsetpropstub_
callsetter icsetpropstub_addslot icsetpropstub_setunboxed icgetelemstub_readslot icgetelemstub_callgetter icgetelemstub_readunboxed icgetelemstub_dense icgetelemstub_densehole icgetelemstub_typedarray icgetelemstub_argselement icgetelemstub_argselementstrict icsetelemstub_dense icsetelemstub_typedarray icnamestub_readslot icnamestub_callgetter call inlining outcomes optimization outcome...
...s of attempts to inline function
calls.
JSAutoByteString
if jsautobytestring instance is initialized with jsautobytestring bytes(cx, str); style, it
calls js_encodestring(cx, str) to get the string to take ownership.
... examples use constructor arguments { jsstring *str = js::tostring(cx, strval); if (!str) return false; jsautobytestring bytes(cx, str); /*
calls js_encodestring internally */ if (!bytes) return false; /* ...do something with bytes...
...*/ } use method to encode string { js::rootedstring str(cx, js::tostring(cx, strval)); if (!str) return false; jsautobytestring bytes; if (!bytes.encodeutf8(cx, str)) /*
calls js_encodestringtoutf8 internally */ return false; /* ...do something with bytes...
JSObjectPrincipalsFinder
description the javascript engine
calls this callback to obtain principals for a jsprincipals.subsume check.
... for example, when a watchpoint triggers, the engine
calls the callback, passing the watchpoint handler, to ensure that watchpoint handlers are invoked only when the watcher is permitted to watch the currently executing script.
... another example: when the function constructor is called, the javascript engine
calls the object principals finder callback to obtain principals for the local scope object, to check that the caller has access to that object.
Component Internals
if there are new components, xpcom registers them: xpcom
calls autoregistration start.
... xpcom
calls autoregistration end.
... the shutdown process when the application is ready to shutdown xpcom, it
calls ns_shutdownxpcom.
Creating the Component Code
then xpcom
calls registerself, passing parameters that we'll examine here.
...xpcom then
calls the function nsgetmodule on the library.
... finally, it
calls the method getclassobject on the module.
nsISupports proxies
xpcom proxies were a technology which allowed code to make asynchronous or synchronous xpcom
calls to a different thread on arbitrary xpcom interfaces.
...for more information about alternatives, see making cross-thread
calls using runnables.
...
calls on object created with this flag will return immediately and you will lose all return information.
nsIWebProgressListener
for example, in the case of navigation within a single frame of a html frameset, a nsiwebprogresslistener instance attached to the nsiwebprogress of the frameset window will receive onstatechange()
calls with the state_is_network flag set to indicate the start and stop of said navigation.
...however, when a document request completes, two onstatechange()
calls with state_stop are generated.
... the document request is passed as arequest to both
calls.
xptcall FAQ
it is used to facilitate cross language and cross thread method
calls.
...xpconnect uses information from typelib files to reflect arbitrary xpcom interfaces into javascript and to make
calls from javascript to xpcom using xptc_invokebyindex.
...these stubs forward
calls to a shared function whose job it is to use the typelib information to extract the parameters from the platform specific calling convention to build an array of variants to hold the parameters and then call an inherited method which can then do whatever it wants with the call.
XPIDL
function the javascript implementation of this interface may be a function that is invoked on property
calls instead of an object with the given property scriptable this interface is usable by javascript classes.
...the
calls are more mangled in native contexts.
...this infallible getter contains code that
calls the fallible getter, asserts success, and returns the gotten value directly.
Xray vision
so when chrome code accesses content objects, it sees them with xray vision: // chrome code var transfer = gbrowser.contentwindow.confirm("transfer all my money?"); //
calls the native implementation note that using window.confirm() would be a terrible way to implement a security policy, and is only shown here to illustrate how xray vision works.
... to waive xray vision for an object you can use components.utils.waivexrays(object), or use the object's wrappedjsobject property: // chrome code var waivedwindow = components.utils.waivexrays(gbrowser.contentwindow); var transfer = waivedwindow.confirm("transfer all my money?"); //
calls the redefined implementation // chrome code var waivedwindow = gbrowser.contentwindow.wrappedjsobject; var transfer = waivedwindow.confirm("transfer all my money?"); //
calls the redefined implementation waivers are transitive: so if you waive xray vision for an object, then you automatically waive it for all the object's properties.
... to undo the waiver again, call components.utils.unwaivexrays(waivedobject): var unwaived = components.utils.unwaivexrays(waivedwindow); unwaived.confirm("transfer all my money?"); //
calls the native implementation xrays for dom objects the primary use of xray vision is for dom objects: that is, the objects that represent parts of the web page.
Memory - Plugins
since npn_memalloc automatically frees cached information if necessary to fulfill a request for memory,
calls to npn_memalloc may succeed where direct
calls to newptr fail.
...if npn_memalloc is called,
calls to npn_memflush have no effect.
... for example, suppose that the plug-in
calls newgworld, and that the call fails because of insufficient memory.
Debugger.Script - Firefox Developer Tools
when execution reaches the given instruction, spidermonkey
calls the hit method ofhandler, passing a debugger.frame instance representing the currently executing stack frame.
... any number of breakpoints may be set at a single location; when control reaches that point, spidermonkey
calls their handlers in an unspecified order.
... breakpoint handler method
calls are cross-compartment, intra-thread
calls: the call takes place in the same thread that hit the breakpoint, and in the compartment containing the handler function (typically the debugger’s compartment).
Document.requestStorageAccess() - Web APIs
grant the document access to cookies and other site storage and store that fact for the purposes of future
calls to document.hasstorageaccess() and requeststorageaccess().
...to make testing easier, we have added two preferences in about:config that control prompting upon requeststorageaccess()
calls: dom.storage_access.auto_grants can be set to false to disable the automatic granting of ephemeral storage access grants.
... all
calls to requeststorageaccess() by origins classified as trackers will trigger a prompt.
RTCConfiguration - Web APIs
this configuration option cannot be changed after it is first specified; once the certificates have been set, this property is ignored in future
calls to rtcpeerconnection.setconfiguration().
... using certificates when you wish to provide your own certificates for use by an rtcpeerconnection instead of having the rtcpeerconnection generate them automatically, you do so through
calls to rtcpeerconnection.generatecertificate().
...one obvious benefit to providing your own is identity key continuity—if you use the same certificate for subsequent
calls, the remote peer can tell you're the same caller.
RTCInboundRtpStreamStats - Web APIs
this id is stable across multiple
calls to getstats().
...this id is stable across multiple
calls to getstats().
...this id is stable across multiple
calls to getstats().
RTCRemoteOutboundRtpStreamStats.localId - Web APIs
networkteststart() this function simply
calls the rtcpeerconnection method getstats() to request an rtcstatsreport and store it in the variable startreport.
... let startreport; async function networkteststart(pc) { if (pc) { startreport = await pc.getstats(); } } given an rtcpeerconnection, pc, this
calls its getstats() method to obtain a statistics report object, which it stores in startreport for use once the end-of-test data has been collected by networkteststop().
...it takes as input the rtcpeerconnection being tested,
calls getstats() to get a new rtcstatsreport with current statistics, then computes the results it's looking for, outputting those results as appropriate to the user by appending appropriate html to the contents of the <div> element whose class is stats-box.
Web Authentication API - Web APIs
browser
calls authenticatormakecredential() on authenticator - internally, the browser will validate the parameters and fill in any defaults, which become the authenticatorresponse.clientdatajson.
... browser
calls authenticatorgetcredential() on authenticator - internally, the browser will validate the parameters and fill in any defaults, which become the authenticatorresponse.clientdatajson.
... examples for security reasons, web authentication
calls (create() and get()) are cancelled if the browser window loses focus while the call is pending.
Using Web Workers - Web APIs
() { reply('doalert', 3, 'seconds'); }, 3000); } } function reply() { if (arguments.length < 1) { throw new typeerror('reply - takes at least one argument'); return; } postmessage({ querymethodlistener: arguments[0], querymethodarguments: array.prototype.slice.call(arguments, 1) }); } /* this method is called when main page
calls queryworker's postmessage method directly*/ function defaultreply(message) { // do something } and the onmessage method is now trivial: onmessage = function(event) { if (event.data instanceof object && event.data.hasownproperty('querymethod') && event.data.hasownproperty('querymethodarguments')) { queryablefunctions[event.data.querymethod] .apply(sel...
...etc):
calls a worker's queryable function * postmessage(string or json data): see worker.prototype.postmessage() * terminate(): terminates the worker * addlistener(name, function): adds a listener * removelistener(name): removes a listener queryableworker instances properties: * defaultlistener: the default listener executed only when the worker
calls the postmes...
...ifference between two numbers: getdifference: function(nminuend, nsubtrahend) { reply('printstuff', nminuend - nsubtrahend); }, // example #2: wait three seconds waitsometime: function() { settimeout(function() { reply('doalert', 3, 'seconds'); }, 3000); } }; // system functions function defaultreply(message) { // your default public function executed only when main page
calls the queryableworker.postmessage() method directly // do something } function reply() { if (arguments.length < 1) { throw new typeerror('reply - not enough arguments'); return; } postmessage({ 'querymethodlistener': arguments[0], 'querymethodarguments': array.prototype.slice.call(arguments, 1) }); } onmessage = function(oevent) { if (oevent.data instanceof object && oevent.data.hasownpro...
WritableStream.WritableStream() - Web APIs
it then
calls a function called sendmessage(), passing the newly created stream and a string.
... inside this function it
calls the stream's getwriter() method, which returns an instance of writablestreamdefaultwriter.
...this is why the example
calls defaultwriter.ready twice (lines 9 and 22).
WritableStream - Web APIs
it then
calls a function called sendmessage(), passing the newly created stream and a string.
... inside this function it
calls the stream's getwriter() method, which returns an instance of writablestreamdefaultwriter.
...this is why the example
calls defaultwriter.ready twice (lines 9 and 22).
XRSystem: requestSession() - Web APIs
examples creating an immersive vr session the following example
calls requestsession() requesting an "immersive-vr" session.
...next, it
calls issessionsupported(), passing it the desired session option before enabling controls for entering xr.
...finally, the onbuttonclicked() method
calls requestsession() using the same session option passed to issessionsupported().
Grammar and types - JavaScript
enhanced object literals in es2015, object literals are extended to support setting the prototype at construction, shorthand for foo: foo assignments, defining methods, making super
calls, and computing property names with expressions.
... var obj = { // __proto__ __proto__: theprotoobj, // shorthand for ‘handler: handler’ handler, // methods tostring() { // super
calls return 'd ' + super.tostring(); }, // computed (dynamic) property names [ 'prop_' + (() => 42)() ]: 42 }; regexp literals a regex literal (which is defined in detail later) is a pattern enclosed between slashes.
...javascript automatically converts the string literal to a temporary string object,
calls the method, then discards the temporary string object.
InternalError: too much recursion - JavaScript
the javascript exception "too much recursion" or "maximum call stack size exceeded" occurs when there are too many function
calls, or a function is missing a base case.
... a function that
calls itself is called a recursive function.
...when there are too many function
calls, or a function is missing a base case, javascript will throw this error.
Error.prototype.stack - JavaScript
the stack string proceeds from the most recent
calls to earlier ones, leading back to the original global scope call.
...l:19 @file:///c:/example.html:21 firefox 13 and earlier would instead produce the following text: error("myerror")@:0 trace()@file:///c:/example.html:9 b(3,4,"\n\n",(void 0),[object object])@file:///c:/example.html:16 a("first call, firstarg")@file:///c:/example.html:19 @file:///c:/example.html:21 stack of eval'ed code starting with firefox 30, the error stack of code in function() and eval()
calls, now produces stacks with more detailed information about the line and column numbers inside these
calls.
... function
calls are indicated with "> function" and eval
calls with "> eval".
Function.prototype.bind() - JavaScript
when a bound function is called, it
calls internal method [[call]] on [[boundtargetfunction]], with following arguments call(boundthis, ...args).
...r() { this.petalcount = math.floor(math.random() * 12) + 1; } // declare bloom after a delay of 1 second latebloomer.prototype.bloom = function() { window.settimeout(this.declare.bind(this), 1000); }; latebloomer.prototype.declare = function() { console.log(`i am a beautiful flower with ${this.petalcount} petals!`); }; const flower = new latebloomer(); flower.bloom(); // after 1 second,
calls 'flower.declare()' bound functions used as constructors warning: this section demonstrates javascript capabilities and documents some edge cases of the bind() method.
...this means that additional apply()
calls can be eliminated: // same as "slice" in the previous example const unboundslice = array.prototype.slice; const slice = function.prototype.apply.bind(unboundslice); // ...
super - JavaScript
syntax super([arguments]); //
calls the parent constructor.
... // here, it
calls the parent class's constructor with lengths // provided for the rectangle's width and height super(length, length); // note: in derived classes, super() must be called before you // can use 'this'.
...in the second object, super
calls the first object's method.
Using the WebAssembly JavaScript API - WebAssembly
add the following to your script, below the first block: webassembly.instantiatestreaming(fetch('simple.wasm'), importobject) .then(obj => obj.instance.exports.exported_func()); the net result of this is that we call our exported webassembly function exported_func, which in turn
calls our imported javascript function imported_func, which logs the value provided inside the webassembly instance (42) to the console.
... starting soon in firefox, in addition to viewing webassembly as text, developers will be able to debug (place breakpoints, inspect the
callstack, single-step, etc.) webassembly using the text format.
... growing memory a memory instance can be grown by
calls to memory.prototype.grow(), where again the argument is specified in units of webassembly pages: memory.grow(1); if a maximum value was supplied upon creation of the memory instance, attempts to grow past this maximum will throw a webassembly.rangeerror exception.
Content Processes - Archive of obsolete content
when this function is called with a given event name, it
calls all the listeners currently associated with that event.
...we can then hook up a listener to be called when this message arrives at the other process, which in turn
calls the emit function on the other event emitter.
context-menu - Archive of obsolete content
onmessage function if the item is contained in the top-level context menu, this function will be called when the content script
calls self.postmessage.
... onmessage function if the menu is contained in the top-level context menu, this function will be called when the content script
calls self.postmessage.
/loader - Archive of obsolete content
secure each module in an isolated js sandbox and makes any capability imports explicit via
calls to the require() function.
... unload(loader, 'disable');
calls to this function will dispatch the unload observer notification that modules can listen to as described above.
lang/functional - Archive of obsolete content
repeated
calls to the modified function will have no effect, returning the value from the original call.
...this means that if the function's called many times in quick succession the function will only execute once, after the blizzard of
calls has finished.
remote/parent - Archive of obsolete content
listen to attach and detach events to hear as processes are started and stopped: const { processes } = require("sdk/remote/parent"); processes.on("attach", function(process) { console.log("new process is remote: " + process.isremote); }); methods forevery(callback)
calls the callback for every existing process and any new processes created in the future.
... const { frames } = require("sdk/remote/parent"); frames.on("attach", function(frame) { console.log("frame is attached: " + frame.frameelement); }); methods forevery(callback)
calls the callback for every existing frame and any new frames created in the future.
Unit Testing - Archive of obsolete content
now "index.js" imports the base64 module and
calls its two exported functions.
...jpm test will include a module called "test-mycode.js", but will exclude modules called "test_mycode.js" or "testmycode.js".)
calls each exported function whose name starts with "test", passing it an assert object as its only argument.
Bootstrapped extensions - Archive of obsolete content
this is done using a special script file that's included in the extension that contains functions the browser
calls to command the extension to install, uninstall, start up, and shut down.
... install your bootstrap script must include an install() function, which the application
calls before the first call to startup() after the extension is installed, upgraded, or downgraded.
Common Pitfalls - Archive of obsolete content
in that case you may not be able to use the i/o service because that service
calls the newuri method on the appropriate protocol handler, which may be your own handler.
... what not to do all other security checks (including
calls to checkloaduri and checkloaduristr) are incorrect, because they do not properly capture the originating principal.
Promises - Archive of obsolete content
unless the flush() method is called, no writes will happen until a full second has elapsed between save()
calls.
...the operation will commence after a full * second has passed without further
calls to this method.
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
an implementation can also use other transport technologies such as soap-based remote procedure
calls, xmlhttprequest interfaces, or dom 3 load.
...there are basically two steps in this process: data load: acquisition of information data acquisition can be implemented using javascript and remote procedure
calls using soap-based rpc mechanism or using interfaces like xmlhttprequest (currently offered in netscape 7 and internet explorer 6).
Notes on HTML Reflow - Archive of obsolete content
a frame that decides it needs a dirty reflow sets the ns_frame_is_dirty state bit on itself, and then
calls the reflowdirtychild method on its parent frame.
...if it decides to delegate, then it sets the ns_frame_is_dirty state bit on itself and recursively
calls reflowdirtychild.
Helper Apps (and a bit of Save As) - Archive of obsolete content
calls show() on the nsihelperapplauncherdialog, which asynchronously puts up the helper app dialog.
... helper app dialog this is our implementation of nsihelperapplauncherdialog it
calls back to the nsexternalapphandler to let it know what the user picked saving to disk if a user decides to "save to disk", we just move/copy the temporary file over to the chosen location once the download completes.
Space Manager High Level Design - Archive of obsolete content
getavailablespace is called on the blockreflowstate the blockreflowstate
calls getavailablespace on its blockbanddata instance (which was setup in the blockreflowstate's constructor based on the space manager passed in and computed content area).
... a non-dirty line is encountered by the block frame in reflowdirtylines block frame
calls its propagatefloatdamage method the space manager is checked to see if there is any float damage if there is, then the block frame asks the space manager if the line in question intersects the float damage if the line does intersect a damage interval, then the line is marked dirty if the line does not intersect a damage interval, it may still be marked dirty if: it was impacted by floats bef...
Install Wizards (aka: Stub Installers) - Archive of obsolete content
extract the xpinstall engine and feed it the downloaded software packages to install.) the stub installer code includes: the logic to display the install wizard widgets and dialogs the code that reads in the configuration file (config.ini) and dynamically installs from the net or from local xpi modules found next to the installer binary the code that processes user selections the code that
calls the xpinstall engine through xpistub the libxpnet code that is statically linked in the stub installers are written in code native to the platform using native widget toolkits including the windows api for windows, the mac toolbox for the mac, and gtk for the unix version.
...the stub installer
calls some glue code: xpistub which resides at: < http://lxr.mozilla.org/seamonkey/sou...pinstall/stub/> this "glue" code initialized xpcom and registers the xpinstall engine and requisite components to prepare for use by the stub installer.
Using XPInstall to Install Plugins - Archive of obsolete content
this section discusses what an ideal xpinstall package will do, as well as points out some of the javascript api
calls that you will make to accomplish these install tasks.
...once again, this step involves
calls to getfolder to locate a "well known" directory in which to install to as a secondary install location.
XPJS Components Proposal - Archive of obsolete content
this registration function that the js code
calls (e.g.
...any subsequent requests from the component manager that would result in nsgetfactory
calls into the module will force the xpjsmanager to load up a new instance of the .js file and start over.
RDF Modifications - Archive of obsolete content
when the rdf parser loads rdf/xml, it starts with a new empty datasource, and as the parser parses the input data, it
calls the datasource's assert function to add each found triple.
...when changing the datasource, the changes are surrounded by begin and end batch
calls.
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.
Multi-process plugin architecture - Archive of obsolete content
the
calls are transferred to the plugin process via the ipdl protocol language.
... in the plugin process, the shim layer serves as a plugin host, implementing the npn_ functions used by the plugin, and forwards the
calls to the plugin dll: multi-process plugins, also called out of process plugins or oopp first shipped in firefox 3.6.4 on windows and linux, and in firefox 4 on mac os x.
NPN_MemFlush - Archive of obsolete content
description the plug-in
calls npn_memflush() when it is not possible to call npn_memalloc(), for example, when calling system apis that indirectly allocate memory.
...on the mac, you can use this method to free memory before calling memory-intensive system
calls.
NPN_PluginThreadAsyncCall - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary thread safe way to request that the browser
calls a plug-in function on the browser or plugin thread (the thread on which the plug-in was initiated).
...the browser might not execute
calls successfully registered with this api call during plug-in termination.
NPN_PostURLNotify - Archive of obsolete content
npn_posturlnotify
calls npp_urlnotify upon successful or unsuccessful completion of the request.
... npn_posturlnotify is typically asynchronous: it returns immediately and only later handles the request and
calls npp_urlnotify.
NPP_SetWindow - Archive of obsolete content
description the browser
calls npp_setwindow after creating the instance to allow drawing to begin.
... subsequent
calls to npp_setwindow indicate changes in size or position; these
calls pass the same npwindow object each time, but with different values.
NP_Shutdown - Archive of obsolete content
syntax #include <npapi.h> void np_shutdown(void); windows #include <npapi.h> void winapi np_shutdown(void); description the browser
calls this function once after the last instance of your plug-in is destroyed, before unloading the plug-in library itself.
...the browser
calls np_shutdown only when the library is finally unloaded.
NPAPI plugin reference - Archive of obsolete content
npn_pluginthreadasynccall thread safe way to request that the browser
calls a plug-in function on the browser or plugin thread (the thread on which the plug-in was initiated).
...this initiates a read operation; the actual data is received through subsequent
calls to npp_writeready() and npp_write().
Using IO Timeout And Interrupt On NT - Archive of obsolete content
due to a limitation of the present implementation of nspr io on nt, programs must follow the following guideline: if a thread
calls an nspr io function on a file descriptor and the io function fails with <tt>pr_io_timeout_error</tt> or <tt>pr_pending_interrupt_error</tt>, the file descriptor must be closed before the thread exits.
...when a thread
calls an io function, the thread issues an overlapped io request using the overlapped buffer in its <tt>prthread</tt> structure.
Windows Media in Netscape - Archive of obsolete content
<param name="autostart" value="true" /> <param name="url" value="preludesteel.wma" /> </object> <script type="text/javascript"> if(!document.playerex2.versioninfo) { // control not installed -- the versioninfo property returns null // redirect users to http://www.microsoft.com/windows/windowsmedia/download/default.asp } else { //control was correctly created //proceed with scripting
calls, etc.
...as a prefix to player scripting
calls solves the namespacing difference between netscape 7.1 and ie.
Index - Learn web development
all user data should be sanitized before it is displayed, or used in sql queries and file system
calls.
...you can check if the unique ids are working by temporarily adding more <to-do-item></to-do-item>
calls into app.vue, and then checking their rendered output with your browser's devtools.
Making asynchronous programming easier with async and await - Learn web development
both of them start off with a custom promise function that fakes an async process with a settimeout() call: function timeoutpromise(interval) { return new promise((resolve, reject) => { settimeout(function(){ resolve("done"); }, interval); }); }; then each one includes a timetest() async function that awaits three timeoutpromise()
calls: async function timetest() { ...
... in the slow-async-await.html example, timetest() looks like this: async function timetest() { await timeoutpromise(3000); await timeoutpromise(3000); await timeoutpromise(3000); } here we simply await all three timeoutpromise()
calls directly, making each one alert for 3 seconds.
Choosing the right approach - Learn web development
universe!'); }, 2000) pitfalls you can use recursive settimeout()
calls to run a function repeatedly in a similar fashion to setinterval(), using code like this: let i = 1; settimeout(function run() { console.log(i); i++; settimeout(run, 100); }, 100); there is a difference between recursive settimeout() and setinterval(): recursive settimeout() guarantees at least the specified amount of time (100ms in this example) will elapse between the executions; th...
...th your fetch operation for resource "${url}": ` + e.message); }); } // call the fetchanddecode() method to fetch the images and the text, and store their promises in variables let coffee = fetchanddecode('coffee.jpg', 'blob'); let tea = fetchanddecode('tea.jpg', 'blob'); let description = fetchanddecode('description.txt', 'text'); // use promise.all() to run code only when all three function
calls have resolved promise.all([coffee, tea, description]).then(values => { console.log(values); // store each value returned from the promises in separate variables; create object urls from the blobs let objecturl1 = url.createobjecturl(values[0]); let objecturl2 = url.createobjecturl(values[1]); let desctext = values[2]; // display the images in <img> elements let image1 = document.cr...
Drawing graphics - Learn web development
if that function draws the new update to your animation, then
calls requestanimationframe() again just before the end of the function, the animation loop will continue to run.
...this effectively means that we are only updating the sprite on every 13th frame, or roughly about 5 frames a second (requestanimationframe()
calls us at up to 60 frames per second if possible).
Introduction to web APIs - Learn web development
with a framework, the control is inverted: the framework
calls the developer's code.
... in addition, some webapis request permission to be enabled from the user once
calls to them are made in your code.
Third-party APIs - Learn web development
.preventdefault(); // assemble the full url url = baseurl + '?api-key=' + key + '&page=' + pagenumber + '&q=' + searchterm.value + '&fq=document_type:("article")'; if(startdate.value !== '') { url += '&begin_date=' + startdate.value; }; if(enddate.value !== '') { url += '&end_date=' + enddate.value; }; } submitsearch() sets the page number back to 0 to begin with, then
calls fetchresults().
... this first
calls preventdefault() on the event object, to stop the form actually submitting (which would break the example).
Object-oriented JavaScript for beginners - Learn web development
you can now see that we have two new objects on the page, each of which is stored under a different namespace — when you access their properties and methods, you have to start
calls with person1 or person2; the functionality contained within is neatly packaged away so it won't clash with other functionality.
... let's look at the constructor
calls again: let person1 = new person('bob'); let person2 = new person('sarah'); in each case, the new keyword is used to tell the browser we want to create a new object instance, followed by the function name with its required parameters contained in parentheses, and the result is stored in a variable — very similar to how a standard function is called.
Website security - Learn web development
the solution is to sanitize user input before it might be used in system
calls.
...all user data should be sanitized before it is displayed, or used in sql queries and file system
calls.
Componentizing our React app - Learn web development
in app.js, add the following line near the top of the file to import todo: import todo from "./components/todo"; with this component imported, you can replace all of the <li> elements in app.js with <todo /> component
calls.
...next we'll look at how we can make different component
calls render unique content.
Introduction to automated testing - Learn web development
it has several clients available to allow you to make
calls to the api using your favourite environment, be it php, java, node.js, etc.
... it has several clients available to allow you to make
calls to the api using your favourite environment, be it php, java, node.js, etc.
Setting up your own test automation environment - Learn web development
there are other ways, but the best way to use selenium is via webdriver, a powerful api that builds on top of selenium and makes
calls to a browser to automate it, carrying out actions such as "open this web page", "move over this element on the page", "click this link", "see whether the link opens this url", etc.
...block near the bottom of the code to add rest api
calls (again, replace the your-user-name and your-access-key placeholders in the code with your actual user name and access key values): driver.sleep(2000).then(function() { driver.gettitle().then(function(title) { if(title === 'webdriver - google search') { console.log('test passed'); request({uri: "https://your-user-name:your-access-key@www.browserstack.com/automate/sessions/" + s...
Chrome Worker Modules
if you do, know that any call to module.exports will overwrite all
calls to `exports.foo = bar.
...the module loader supports cyclic
calls to require().
Application cache implementation overview
when the update is about to actually start, the scheduling service
calls nsofflinecacheupdate::begin() method, that switches the update to checking state (+invokes onchecking event) and starts fetch of the manifest file.
... the parallel load is implemented by asynchronous recursive
calls to processnexturi(), a method searching always a single entry that is scheduled to load.
A bird's-eye view of the Mozilla framework
suppose the client already has an nsirdfdatasource object representing a sub-graph of an rdf graph and
calls nsirdfdatasource.gettarget(resource, nc_link, true) to obtain an nsirdfnode representing a specific node in the graph, in this case a link to ahelp viewer document page.
... the xpcom component keeps track of all interface pointers currently held by its clients using an internal reference count it increments via client
calls to addref().
Testopia
all params should now be sent in a hash (struct, dict, hashmap or whatever your language of choice
calls key, value pairs).
... though all attempts have been made to provide continuing support for positional parameters, please be aware that some api
calls may fail until you make this change.
Debugging JavaScript
this shows any javascript errors in your app, as well as any logging
calls from the console api.
...in extensions you can print the
callstack using components.stack like this: function getstackdump() { var lines = []; for (var frame = components.stack; frame; frame = frame.caller) { lines.push(frame.filename + " (" + frame.linenumber + ")"); } return lines.join("\n"); } see also debugging mozilla with gdb setting up an extension development environment (particularly development preferences and development extensi...
Makefiles - Best practices and suggestions
all subsequent make
calls must become a nop unless sources or dependencies change or have been removed.
... parallel make: add an explicit timestamp dependency (.done) that make can synchronize threaded
calls on to avoid a race condition.
Performance
beam down information in advance to avoid synchronous
calls to the parent bad: // processscript.js function contentpolicy() { // ...
...since the code
calls to the parent process to check whether a specific request can be allowed it would slow down all page loads, as web pages generally issue dozens of requests.
mozbrowsershowmodalprompt
the mozbrowsershowmodalprompt event is fired when the content of a browser <iframe>
calls the window.alert(), window.confirm(), or window.prompt() methods.
...note that if the embedder
calls preventdefault() on this event, the iframe is blocked until unblock() is called.
IPDL Best Practices
reference counting protocol actors is tricky here is the easiest way to get it right the first time (lessons learned from the http channel and geolocation protocols): allocpprotocol
calls addref deallocpprotocol
calls release this ensures that the actor will not disappear from under ipdl, and that you won't get bizarre crashes at other times if ipdl deletes the protocol tree.
...when to run code here's a rundown on appropriate places to run certain kinds of code: manager::allocpprotocol - allocation manager::recvpprotocolconstructor - initialization, protocol deletion (the typeaheadfind protocol uses one-shot protocols like this) actor::recv__delete__ - cleanup, ipdl
calls still valid but ill-advised actor::actordestroy - non-ipdl cleanup manager::deallocpprotocol - deallocation one construct to avoid: class protocolparent { public: ~protocolparent() { send__delete__(this); } }; class protocolmanagerparent { public: pprotocolparent* allocpprotocol() { return new protocolparent(); } bool deallocpprotocol() { return...
PBackground
these actors can live in different processes due to ipdl, which automatically serializes
calls on one side and transmits them to the other.
...instead, it simply turns all of its operations into ipdl
calls on a set of pbackground-based actors and the processing, file i/o, etc, can be controlled from the pbackground thread regardless of where the dom
calls are being made.
Implementing QueryInterface
// ...but that won't matter when someone
calls me wrongly in a non-debug build.
...you won't be able to catch
calls to queryinterface on the aggregated objects, which may then return wrong interfaces.
CustomizableUI.jsm
calls to begin/endbatchupdate may be nested.
...if any of the endbatchupdate
calls pass aforcedirty=true, we will flush to the prefs file.
Promise
methods then()
calls one of the provided functions as soon as this promise is either fulfilled or rejected.
... promise catch( function onreject ); the following
calls are therefore identical: p.then(undefined, logerror); p.catch(logerror); debugging by design, the instant state and value of a promise cannot be inspected synchronously from code, without calling the then() method.
PromiseWorker.jsm
myworker.post('func', [buffer], null, [buffer]); this is simpler if the you know what to transfer at the
callsite.
... post
callsite doesn't have to know which object should be transferred.
Creating localizable web applications
good: function num_format($num, $decimals) { $locale_info = localeconv(); return number_format($num, $decimals, $locale_info['decimal_point'], $locale_info['thousands_sep']); } printf(_("%s mb"), num_format($size, 1)); wrap as few html tags as possible when wrapping the localizable content with the gettext function
calls, put all the code that irrelevant to localization outside the function call.
... don't nest gettext
calls snippet 1.
gettext
you can specify the function
calls to look for with the --keyword option.
... for example, --keyword=n___:1,2,4c tells xgettext to look for n___()
calls, and extract the first argument as the singular string, the second argument as the plural string and the fourth argument as the context (the third argument is reserved for the number in this example).
Investigating leaks using DMD heap scan mode
however, in that case it may be easier to use refcount logging, or rr with a conditional breakpoint set on
calls to release() for the leaking object, to see what object actually does the release that causes the leaked object to go away.
...fortunately, this method mostly just contains two
calls to new, one for scriptloadrequest and one for moduleloadrequest.
GPU performance
tools pix - can do timing of direct3d
calls.
...guides accurately profiling direct3d api
calls (direct3d 9)- suggests avoiding normal profilers like xperf and instead measuring the time to flush the command buffer.
Gecko Profiler FAQ
gecko profiler: if you need js
callstacks or gecko-specific instrumentation, or need to use any of its nifty ui features.
... [ehsan] that being said, we do see a lot of windows-specific issues that you will not find on other platforms, for example sometimes code
calls into a windows api that requires loading a dll the first time you call it that takes 10s of milliseconds to finish, etc.
TraceMalloc
tracemalloc captures stack traces of all malloc, calloc , realloc, and free
calls (this currently covers all operator new and delete
calls in mozilla, too).
...bloatblame accumulates allocation counts and ignores free
calls.
about:memory
explicit allocations this section contains a single tree, called "explicit", that measures all the memory allocated via explicit
calls to heap allocation functions (such as malloc and new) and to non-heap allocations functions (such as mmap and virtualalloc).
... this "explicit" value at the root of the tree represents all the memory allocated via explicit
calls to allocation functions.
Optimizing Applications For NSPR
the only exception to this rule is the <tt>select()</tt> and <tt>poll()</tt> system
calls on unix, both of which nspr has overridden to make sure they are aware of the nspr local threads.
...do not call blocking system
calls from the primordial thread.
PR_DetachThread
a native thread not created by nspr is automatically attached the first time it
calls an nspr function, and automatically detached when it exits.
... in nspr release 19980529b and earlier, it is necessary for a native thread not created by nspr to call pr_attachthread before it
calls any nspr functions, and call pr_detachthread when it is done calling nspr functions.
JSS FAQ
the nt fiber problem affects applications that call blocking system
calls from the primordial thread.
...it runs nss's cert authentication check, then
calls the callback regardless of whether the cert passed or failed.
JSS Provider Notes
first, it tries to copy the key material directly using nss
calls to pkcs #11.
... if that fails, it
calls getencoded() on the source key, and then tries to create a new key on the target token from the encoded bits.
Mozilla-JSS JCA Provider notes
first, it tries to copy the key material directly using nss
calls to pkcs #11.
... if that fails, it
calls getencoded() on the source key, and then tries to create a new key on the target token from the encoded bits.
FC_InitToken
the "reset password" button of the mozilla application suite and seamonkey (in preferences->privacy & security->master passwords)
calls fc_inittoken().
... the "-t" (token reset) command of certutil
calls fc_inittoken().
NSC_InitToken
the "reset password" button of the mozilla application suite and seamonkey (in preferences->privacy & security->master passwords)
calls nsc_inittoken().
... the "-t" (token reset) command of certutil
calls nsc_inittoken().
pkfnc.html
the pk11_findcertfromnickname function
calls the password callback function set with pk11_setpasswordfunc and passes it the pointer specified by the wincx parameter.
... the pk11_findkeybyanycert function
calls the password callback function set with pk11_setpasswordfunc and passes it the pointer specified by the wincx parameter.
Tutorial: Embedding Rhino
the null parameter tells initstandardobjects to create and return a scope object that we use in later
calls.
... public void jsfunction_resetcount() { count = 0; } the call c.resetcount() above
calls this method.
SpiderMonkey Internals: Thread Safety
all js code and most jsapi
calls run within a jscontext.
...the program must group jsapi
calls into "requests": js_setcontextthread(cx); js_beginrequest(cx); /* ...
JSFinalizeOp
the garbage collector
calls this callback for each object it collects.
...the garbage collector
calls the finalize hook of each jsobject it collects.
JSGetObjectOps
in contrast, all native and host objects have a jsobjectmap at obj->map, which may be shared among a number of objects, and which contains the jsobjectops *ops pointer used to dispatch object operations from api
calls.
...further extension to preserve api compatibility: if this function returns a pointer to jsxmlobjectops.base, not to jsobjectops, then the engine
calls extended hooks needed for e4x.
JSObjectOps.defaultValue
the javascript engine
calls the jsobjectops.defaultvalue and jsclass.convert callbacks to convert objects to primitive values.
...it
calls the javascript methods obj.valueof() and/or obj.tostring().
JS_BeginRequest
if any thread is in a requests, garbage collection can happen only when that thread
calls into the jsapi.
... it is safe to nest
calls to js_beginrequest so long as each call is balanced by a matching call to js_endrequest.
JS_DumpNamedRoots
it
calls the dump function once for each named root in the given runtime rt.
...when js_dumpnamedroots
calls it, it passes three arguments: argument type description name const char * the name of the named root.
JS_Enumerate
this
calls obj's jsclass.enumerate hook.
...but, for example, if an application
calls back into javascript while it is looping over the property ids in the jsidarray, the script could delete properties from obj.
JS_MaybeGC
in both cases, frequent
calls js_maybegc are safe and will not cause the application to spend a lot of time doing redundant garbage collection work.
...such applications can benefit from implementing their own custom-tuned maybe-gc function that conditionally
calls js_gc on the basis of some application-specific analysis, and using that instead of js_maybegc.
JS_SetGCCallback
description js_setgccallback sets a callback function which the garbage collector
calls at several points during garbage collection.
...if a thread that is not in an active request
calls js_gc while gc is already happening on another thread).
SpiderMonkey 1.8
in certain cases, the javascript engine no longer
calls jsclass.resolve callbacks repeatedly, as it did in previous versions.
... specifically, if a property lookup first
calls a resolve hook which does not define the property, then finds the property on a prototype, that result can be cached.
TPS Tests
// phase declarations var phases = { "phase1": "profile1", "phase2": "profile2", "phase3": "profile1" }; // asset list // the initial list of bookmarks to be added to the browser var bookmarks_initial = { "menu": [ { uri: "http://www.google.com", title "google.com", changes: { // these properties are ignored by
calls other than bookmarks.modify title: "google" } }, { folder: "foldera" }, { folder: "folderb" } ], "menu/foldera": [ { uri: "http://www.yahoo.com", title: "testing yahoo", changes: { location: "menu/folderb" } } ] }; // the state of bookmarks after the first 'modify' action has been performed // on them.
... comment out the goquitapplication()
calls in services/sync/tps/extensions/tps/modules/tps.jsm (remember to undo this later!).
Embedded Dialog API
responsibilities of mozilla/gecko component authors writing replaceable dialogs dialogs posed by the browser ("up
calls") any component which may be included in an embedded browser distribution and wishes to pose a dialog must group its ui (code which runs its dialogs) into a unique interface built just for that purpose.
...the print dialogs should be available soon.) dialogs posed by the embedding app ("down
calls") some components will not pose dialogs directly, but maintain a database of information an embedding app may wish to display as a dialog.
Fun With XBL and XPConnect
once the regular xul textfield widget is bound to this interface, it
calls the auto complete function of the object using regular javascript.
...the handler
calls the auto complete method we've exposed on the widget which in turn forwards the call to the xpcom object, passing in our implementation of nsiautocompletelistener.
XPCOM array guide
for example, this code
calls the same method on each member: void notifyobservers(const nscomarray<nsimyobserver>& observers) { // using [] doesn't leak!
... for example, this code
calls the same method on each member: void notifyobservers(const nstarray<observerclass*>& observers) { for (pruint32 i = observers.length(); i > 0 ; ) { --i; observers[i]->observe(); } } bounds-safe access to elements you can also access elements in an nstarray<t> using the safeelementat() method.
Building the WebLock UI
in this section, we are going to create the xul interface that
calls the javascript methods when the user interacts with it.
... weblockoverlay.xul the xul that defines the new icon is small: it's a little icon that
calls a javascript function to load the weblock.xul file we defined previously.
XPConnect wrappers
this wrapper is responsible for mapping
calls from javascript into c++.
...c++
calls are routed through xpcwrappedjs code into your javascript implementation.
Language bindings
onents.results is a read-only object whose properties are the names listed as the first parameters of the macros in js/xpconnect/src/xpc.msg (also at table of errors), with the value of each corresponding to that constant's value.components.returncodecomponents.stackcomponents.stack is a read only property of type nsistackframe (idl definition) that represents a snapshot of the current javascript
callstack.
...this method
calls through to that thusly:components.utils.unloadcomponents.utils.unload was introduced in firefox 7 and is used to unload javascript code modules.
nsIAuthModule
wrap() once a security context has been established through
calls to getnexttoken() it may be used to protect data exchanged between client and server.
...
calls to this method are used to protect items of data to be sent to the server.
nsIChannel
the stream listener's methods are called on the thread that
calls asyncopen and are not called until after asyncopen returns.
...once onstartrequest is called, all following method
calls on alistener will get the request that was passed to onstartrequest.
nsIEditorSpellCheck
note: this does not clear any suggestions left over from previous
calls to checkcurrentword(), so there may be suggestions, but they will be invalid.
...subsequent
calls iterate through all suggestions, allowing you to build a list.
nsIIOService
newchannel() obsolete since gecko 48 a shortcut method to avoid repeated
calls of newuri() and newchannelfromuri().
... newchannel2() a shortcut method to avoid repeated
calls of newuri() and newchannelfromuri().
nsIInputStream
this method causes subsequent
calls to read() and readsegments() to return 0 bytes read to indicate end-of-file.
... note: the close method may be called more than once, but subsequent
calls are ignored.
nsIJumpListBuilder
lists are built in real-time during the sequence of build
calls, make sure to check for errors on each individual step.
...exceptions thrown ns_error_not_available on all
calls if taskbar functionality is not supported by the operating system.
nsIThreadObserver
recursiondepth the number of
calls to nsithread.processnextevent() on the call stack in addition to the current call.
... recursiondepth the number of
calls to nsithread.processnextevent() on the call stack in addition to the current call.
nsIWindowsRegKey
key hkey this attribute exposes the native hkey and is available to provide c++ consumers with the flexibility of making other windows registry api
calls that are not exposed via this interface.
... note: in gecko 2.0, readstringvalue()
calls expandenvironmentstrings() on a reg_expand_sz type.
Weak reference
neither inheritance, nor templates, nor macros can help automatically forward all the method
calls to the real object.
...why these extra
calls: getweakreference and queryreferent?
Mail and RDF
information for this column is queried when the tree's rdf template
calls the folder datasource's gettarget() method.
...the folder datasource then translates these property changes into onassert() or onunassert()
calls to the observers.
Mail event system
the folder
calls notifyintpropertychanged on itself with the atom that represents "totalmessages": this->notifyintpropertychanged(ktotalmessagesatom, 4, 5);.
...for each global listener, it
calls onintpropertychanged: listener->onintpropertychanged(folder, ktotalmessagesatom, 4, 5); the folder datasource is a listener on all folders and receives this notification.
Working with windows in chrome code
its parameters are similar to window.open; in fact, window.open's implementation
calls nsiwindowwatcher's methods.
... note however, that the open() call returns before the window is fully loaded, so some
calls, like win.document.getelementbyid() will fail.
Using js-ctypes
line 6 declares msgbox() to be a method that
calls the windows function messageboxw.
... line 15
calls the msgbox() routine, which displays the alert.
Set a breakpoint - Firefox Developer Tools
the line number is highlighted in blue: in addition, if the line contains multiple function
calls, each one will be given a small blue arrow icon to the left of it.
... these are called column breakpoints, and allow you to set the breakpoint to happen exactly on any one of the function
calls in the line (or multiple
calls), by clicking on each relevant one.
Migrating from Firebug - Firefox Developer Tools
while firebug focuses on javascript performance and provides detailed information about javascript function
calls during the profiling session, the performance tool in the devtools offers a broad spectrum of information regarding a website's performance but doesn't go into detail regarding javascript function
calls.
...like in firebug it lists the total execution time of each function call under total time as well as the number of
calls under samples, the time spent within the function under self time and the related percentages in reference to the total execution time.
Intensive JavaScript - Firefox Developer Tools
the function
calls are interleaved with the pink blocks from the css animation, and each function is short enough that the browser can handle it without the overall frame rate dropping.
...compared with the original, each button-press is visible in the overview as two very short orange markers: the dopointlesscomputationsinworker() function that handles the click event and starts the worker's processing the handleworkercompletion() function that runs when the worker
calls "done".
Waterfall - Firefox Developer Tools
console the period between matching
calls to console.time() and console.timeend().
... adding markers with the console api two markers are directly controlled by console api
calls: "console" and "timestamp".
AudioNode.connect() - Web APIs
return value if the destination is a node, connect() returns a reference to the destination audionode object, allowing you to chain multiple connect()
calls.
... // connect the gain to the destination so we hear sound gain.connect(audioctx.destination); // start the oscillator that will produce audio oscillator.start(); // start the oscillator that will modify the gain value lfo.start(); audioparam notes it is possible to connect an audionode output to more than one audioparam, and more than one audionode output to a single audioparam, with multiple
calls to connect().
Using the Beacon API - Web APIs
the handler
calls sendbeacon() with the current url.
...//example.com/analytics"; // create the data to send var data = "state=" + event.type + "&location=" + location.href; // send the beacon var status = navigator.sendbeacon(url, data); // log the data and result console.log("sendbeacon: url = ", url, "; data = ", data, "; status = ", status); }; the following example creates a submit handler and when that event is fired, the handler
calls sendbeacon().
BlobBuilder - Web APIs
getblob() returns the blob object that has been constructed using the data passed through
calls to append().
... return value a blob object containing all of the data passed to any
calls to append() made since the blobbuilder was created.
Manipulating video using canvas - Web APIs
in response to the user beginning playback, this code fetches the width and height of the video, halving each (we will be halving the size of the video when we perform the chroma-keying effect), then
calls the timercallback() method to start watching the video and computing the visual effect.
... then it
calls the computeframe() method, which performs the chroma-keying effect on the current video frame.
Optimizing canvas - Web APIs
to avoid this, make sure to round all co-ordinates used in
calls to drawimage() using math.floor(), for example.
... var ctx = canvas.getcontext('2d', { alpha: false }); more tips batch canvas
calls together.
EventTarget.addEventListener() - Web APIs
specifying "this" using bind() the function.prototype.bind() method lets you specify the value that should be used as this for all
calls to a given function.
...event element.addeventlistener('click', this, false); element.addeventlistener('dblclick', this, false); // you can properly remove the listeners element.removeeventlistener('click', this, false); element.removeeventlistener('dblclick', this, false); } const s = new something(document.body); another way of handling the reference to this is to pass to the eventlistener a function that
calls the method of the object that contains the fields that need to be accessed: class someclass { constructor() { this.name = 'something good'; } register() { const that = this; window.addeventlistener('keydown', function(e) { that.somemethod(e); }); } somemethod(e) { console.log(this.name); switch(e.keycode) { case 5: // some code here...
EventTarget.removeEventListener() - Web APIs
for example, consider this call to addeventlistener(): element.addeventlistener("mousedown", handlemousedown, true); now consider each of these two
calls to removeeventlistener(): element.removeeventlistener("mousedown", handlemousedown, false); // fails element.removeeventlistener("mousedown", handlemousedown, true); // succeeds the first call fails because the value of usecapture doesn't match.
... now look at each of these
calls to removeeventlistener() in turn.
ExtendableEvent - Web APIs
if waituntil() is called outside of the extendableevent handler, the browser should throw an invalidstateerror; note also that multiple
calls will stack up, and the resulting promises will be added to the list of extend lifetime promises.
... examples this code snippet is from the service worker prefetch sample (see prefetch example live.) the code
calls extendableevent.waituntil() in serviceworkerglobalscope.oninstall, delaying treating the serviceworkerregistration.installing worker as installed until the passed promise resolves successfully.
FileSystemFileEntry.file() - Web APIs
example this example establishes a method, readfile(), reads a text file and
calls a specified callback function with the received text (in a string object) once the read is completed.
... function readfile(entry, successcallback, errorcallback) { entry.file(function(file) { let reader = new filereader(); reader.onload = function() { successcallback(reader.result); }; reader.onerror = function() { errorcallback(reader.error); } reader.readastext(file); }, errorcallback); } this function
calls file(), specifying as its success callback a method which proceeds to use a filereader to read the file as text.
Recording a media element - Web APIs
it works by using an arrow function which
calls window.settimeout(), specifying the promise's resolution handler as the timeout handler function.
... handling the stop button the last bit of code adds a handler for the click event on the stop button using addeventlistener(): stopbutton.addeventlistener("click", function() { stop(preview.srcobject); }, false); this simply
calls the stop() function we covered earlier.
Capabilities, constraints, and settings - Web APIs
rcobject = stream; if (audiotracks.length) { audiotrack = audiotracks[0]; } if (videotracks.length) { videotrack = videotracks[0]; } }).then(function() { return new promise(function(resolve) { videoelement.onloadedmetadata = resolve; }); }).then(function() { getcurrentsettings(); }).catch(handleerror); } there are several steps here: it
calls buildconstraints() to create the mediatrackconstraints objects for the two tracks from the code in the edit boxes.
... it
calls navigator.mediadevices.getusermedia(), passing in the constraints objects for the video and audio tracks.
Node - Web APIs
*/ removeallchildren(document.body) recurse through child nodes the following function recursively
calls a callback function for each node contained by a root node (including the root itself): function eachnode(rootnode, callback) { if (!callback) { const nodes = [] eachnode(rootnode, function(node) { nodes.push(node) }) return nodes } if (false === callback(rootnode)) { return false } if (rootnode.haschildnodes()) { const nodes = rootnode.childnodes for (let i = 0, l = n...
...odes.length; i < l; ++i) { if (false === eachnode(nodes[i], callback)) { return } } } } syntax eachnode(rootnode, callback) description recursively
calls a function for each descendant node of rootnode (including the root itself).
PaymentRequest: paymentmethodchange event - Web APIs
this code creates a new paymentrequest, adds a handler for the paymentmethodchange event by calling the request's addeventlistener(), then
calls show() to present the payment interface to the user.
... before the event handler returns, it
calls the event's paymentmethodchangeevent.updatewith.updatewith() method to integrate the changes into the request.
Using the Payment Request API - Web APIs
in both cases, the checkout button
calls paymentrequest.show().
...function oncheckoutbuttonclicked(lineitems) {
callservertoretrievecheckoutdetails(lineitems); } // the server has constructed the `checkout` object.
Using Service Workers - Web APIs
note: you can also chain promise
calls together, for example: mypromise().then(success, failure).then(success).catch(failure); note: you can find a lot more out about promises by reading jake archibald’s excellent javascript promises: there and back again.
...this returns a promise for a created cache; once resolved, we then call a function that
calls addall() on the created cache, which for its parameter takes an array of origin-relative urls to all the resources you want to cache.
SubtleCrypto - Web APIs
if you provide the same keying material to two separate
calls to derivekey(), you will get two cryptokey objects that have the same underlying value.
... if the key is sensitive you should use wrapkey(), which exports the key and then encrypts it using another key; the api
calls a "key-wrapping key".
Multi-touch interaction - Web APIs
it also
calls preventdefault() to keep the browser from applying further event handling (for example, mouse event emulation).
... ev.preventdefault(); // cache the touch points for later processing of 2-touch pinch/zoom if (ev.targettouches.length == 2) { for (var i=0; i < ev.targettouches.length; i++) { tpcache.push(ev.targettouches[i]); } } if (logevents) log("touchstart", ev, true); update_background(ev); } touch move handler the touchmove handler
calls preventdefault() for the same reason mentioned above, and invokes the pinch/zoom handler.
Compressed texture formats - Web APIs
if supported, it will return an extension object with constants for the added formats and the formats will also be returned by
calls to gl.getparameter(gl.compressed_texture_formats).
...ext.compressed_rgba_s3tc_dxt1_ext for the webgl_compressed_texture_s3tc extension.) these can then be used with compressedteximage[23]d or compressedtexsubimage[23]d instead of teximage2d
calls.
Using DTMF with WebRTC - Web APIs
initialization when the page loads, we do some basic setup: we fetch references to the dial button and the log output box elements, and we use addeventlistener() to add an event listener to the dial button so that clicking it
calls the connectanddial() function to begin the connection process.
...as previously mentioned, our example is simplified somewhat because we control both the caller and the receiver, so handlecallernegotiationneeded() is able to quickly construct the connection by chaining the required
calls together for both the caller and receiver, as shown below.
Movement, orientation, and motion: A WebXR example - Web APIs
pitching and yawing with the mouse we also have a mousedown event handler which checks to see if the right mouse button is down, and if so,
calls the rotateviewby() function, defined next, to calculate and store the new pitch (looking up and down) and yaw (looking left and right) values.
... the last few lines of code added for this example are four
calls to displaymatrix(), a function which displays the contents of a matrix for analysis by the user.
Rendering and the WebXR frame animation callback - Web APIs
hardare vertical refresh rate when the browser is ready to refresh the <canvas> within which your webxr content is displayed, it
calls your frame rendering callback, which uses the specified timestamp and any other relevant data, such as models and textures, as well as application state, to render the scene—as it should appear at the specified time—into the webgl backbuffer.
... for (let view of viewerpose.views) { let viewport = gllayer.getviewport(view); gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); mydrawsceneintoview(view, deltatime); } } } the mydrawframe() function grabs the xrsession from the xrframe object specified by the frame parameter, then
calls the session's requestanimationframe() method to immediately schedule the rendering of the next frame.
Window.requestAnimationFrame() - Web APIs
the window.requestanimationframe() method tells the browser that you wish to perform an animation and requests that the browser
calls a specified function to update an animation before the next repaint.
...requestanimationframe()
calls are paused in most browsers when running in background tabs or hidden <iframe>s in order to improve performance and battery life.
WritableStream.getWriter() - Web APIs
it then
calls a function called sendmessage(), passing the newly created stream and a string.
... inside this function it
calls the stream's getwriter() method, which returns an instance of writablestreamdefaultwriter.
WritableStreamDefaultWriter.close() - Web APIs
it then
calls a function called sendmessage(), passing the newly created stream and a string.
... inside this function it
calls the stream's getwriter() method, which returns an instance of writablestreamdefaultwriter.
WritableStreamDefaultWriter.write() - Web APIs
it then
calls a function called sendmessage(), passing the newly created stream and a string.
... inside this function it
calls the stream's getwriter() method, which returns an instance of writablestreamdefaultwriter.
WritableStreamDefaultWriter - Web APIs
it then
calls a function called sendmessage(), passing the newly created stream and a string.
... inside this function it
calls the stream's getwriter() method, which returns an instance of writablestreamdefaultwriter.
A re-introduction to JavaScript (JS tutorial) - JavaScript
it creates a brand new empty object, and then
calls the function specified, with this set to that new object.
...so the result of that function
calls is as follows: add5(6); // returns 11 add20(7); // returns 27 here's what's actually happening.
Concurrency model and the event loop - JavaScript
visual representation stack function
calls form a stack of frames.
...when bar
calls foo, a second frame is created and pushed on top of the first one containing foo's arguments and local variables.
Iterators and generators - JavaScript
after a terminating value has been yielded additional
calls to next() should simply continue to return {done: true}.
... if the exception is not caught from within the generator, it will propagate up through the call to throw(), and subsequent
calls to next() will result in the done property being true.
constructor - JavaScript
if your class is a base class, the default constructor is empty: constructor() {} if your class is a derived class, the default constructor
calls the parent constructor, passing along any arguments that were provided: constructor(...args) { super(...args); } that enables code like this to work: class validationerror extends error { printcustomermessage() { return `validation failed :-( (details: ${this.message})`; } } try { throw new validationerror("not a valid phone number"); } catch (error) { if (error instanceof va...
... class square extends polygon { constructor(length) { // here, it
calls the parent class' constructor with lengths // provided for the polygon's width and height super(length, length); // note: in derived classes, `super()` must be called before you // can use `this`.
Classes - JavaScript
class animal { speak() { return this; } static eat() { return this; } } let obj = new animal(); obj.speak(); // the animal object let speak = obj.speak; speak(); // undefined animal.eat() // class animal let eat = animal.eat; eat(); // undefined if we rewrite the above using traditional function-based syntax in non–strict mode, then this method
calls is automatically bound to the initial this value, which by default is the global object.
...the symbol.species symbol lets you do this: class myarray extends array { // overwrite species to the parent array constructor static get [symbol.species]() { return array; } } let a = new myarray(1,2,3); let mapped = a.map(x => x * x); console.log(mapped instanceof myarray); // false console.log(mapped instanceof array); // true super class
calls with super the super keyword is used to call corresponding methods of super class.
Date.prototype[@@toPrimitive] - JavaScript
if hint is "number", [@@toprimitive]() first tries to call valueof, and if that fails, it
calls tostring.
... javascript
calls the [@@toprimitive]() method to convert an object to a primitive value.
Function - JavaScript
instance methods function.prototype.apply(thisarg [, argsarray])
calls a function and sets its this to the provided thisarg.
... function.prototype.call(thisarg[, arg1, arg2, ...argn])
calls a function and sets its this to the provided value.
Object.prototype.valueOf() - JavaScript
description javascript
calls the valueof method to convert an object to a primitive value.
...the following code assigns a user-defined function to the object's valueof method: mynumbertype.prototype.valueof = function() { return customprimitivevalue; }; with the preceding code in place, any time an object of type mynumbertype is used in a context where it is to be represented as a primitive value, javascript automatically
calls the function defined in the preceding code.
Promise.prototype.catch() - JavaScript
it behaves the same as calling promise.prototype.then(undefined, onrejected) (in fact, calling obj.catch(onrejected) internally
calls obj.then(undefined, onrejected)).
... return value internally
calls promise.prototype.then on the object upon which it was called, passing the parameters undefined and the received onrejected handler.
Pipeline operator (|>) - JavaScript
this allows the creation of chained function
calls in a readable manner.
... examples chaining function
calls the pipeline operator can improve readability when chaining several functions.
new.target - JavaScript
in normal function
calls, new.target is undefined.
... examples new.target in function
calls in normal function
calls (as opposed to constructor function
calls), new.target is undefined.
Expressions and operators - JavaScript
super the super keyword
calls the parent constructor.
... ...obj spread syntax allows an expression to be expanded in places where multiple arguments (for function
calls) or multiple elements (for array literals) are expected.
Interacting with page scripts - Archive of obsolete content
note that the function's closure will be exported, too: // content-script.js var salutation = "hello, "; function greetme(user) { return salutation + user; } exportfunction(greetme, unsafewindow, {defineas: "greetme"}); finally, the "page.html" file adds a button and a page script that
calls the exported function when the user pushes the button: <html> <head> </head> <body> <input id="test" type="button" value="click me"/> <script> var test = document.getelementbyid("test"); test.addeventlistener("click", function() { alert(window.greetme("page script")); }, false); </script> </body> </html> exportfunction() works by structured cloning ...
panel - Archive of obsolete content
rmat=mobile", contentstyle: "body { border: 3px solid blue; }" }); mypanel.show(); var self = require("sdk/self"); var mypanel = require("sdk/panel").panel({ contenturl: "https://en.wikipedia.org/w/index.php?title=jetpack&useformat=mobile", contentstylefile: self.data.url("panel-style.css") }); mypanel.show(); private browsing if your add-on has not opted into private browsing, and it
calls panel.show() when the currently active window is a private window, then the panel will not be shown.
Storing annotations - Archive of obsolete content
the annotation is composed of the text the user entered and the "annotation anchor", which consists of the url, element id and element content: function handlenewannotation(annotationtext, anchor) { var newannotation = new annotation(annotationtext, anchor); simplestorage.storage.annotations.push(newannotation); } this function
calls a constructor for an annotation object, which we also need to supply: function annotation(annotationtext, anchor) { this.annotationtext = annotationtext; this.url = anchor[0]; this.ancestorid = anchor[1]; this.anchortext = anchor[2]; } now we need to link this code to the annotation editor, so that when the user presses the return key in the editor, we create and store the new annotatio...
Creating Event Targets - Archive of obsolete content
it duplicates the previous code, but with a few changes: import emit(), on(), once(), and off() from event/core replace listener functions with
calls to emit(), passing the appropriate event type export its own event api.
Logging - Archive of obsolete content
but note that by default,
calls to console.log() will not result in any output in the error console for any installed add-ons: this includes add-ons installed using the add-on builder or using tools like the extension auto-installer.
Bookmarks - Archive of obsolete content
var ios = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); var uri = ios.newuri("http://google.com/", null, null); var newbkmkid = bmsvc.insertbookmark(newfolderid, uri, bmsvc.default_index, ""); this example instantiates the nsiioservice and uses it to create an nsiuri referring to the google web site, then
calls nsinavbookmarksservice.insertbookmark() to create a new bookmark to google, placing it at the end of the bookmarks folder referenced by newbkmkid.
Sidebar - Archive of obsolete content
for example the code below
calls a function defined in the sidebar's context: var sidebarwindow = document.getelementbyid("sidebar").contentwindow; // verify that our sidebar is open at this moment: if (sidebarwindow.location.href == "chrome://yourextension/content/whatever.xul") { // call "yournotificationfunction" in the sidebar's context: sidebarwindow.yournotificationfunction(anyarguments); } testing which sideb...
StringView - Archive of obsolete content
examples alert((new stringview("hello world!")).valueof() === "hello world!"); // true javascript
calls the stringview.valueof() method to convert an object to a primitive value.
Code snippets - Archive of obsolete content
autocomplete code used to enable form autocomplete in a browser boxes tips and tricks when using boxes as containers tabbox removing and manipulating tabs in a tabbox windows-specific finding window handles (hwnd) (firefox) how to use windows api
calls to find various kinds of mozilla window handles.
Hiding browser chrome - Archive of obsolete content
var prevfunc = xulbrowserwindow.hidechromeforlocation; xulbrowserwindow.hidechromeforlocation = function(alocation) { return (/* your test goes here */) || prevfunc.apply(xulbrowserwindow, [alocation]); } this works by saving a reference to the current implementation of the hidechromeforlocation() method, then replacing it with a new method that
calls through to the previous implementation.
Adding Events and Commands - Archive of obsolete content
--> <menuitem id="xulschoolhello-hello-menu-item" label="&xulschoolhello.hello.label;" accesskey="&xulschoolhello.helloitem.accesskey;" command="xulschoolhello-hello-command" /> commands allow you to keep your javascript
calls in a single place, avoiding code repetition and possible bugs.
Adding windows and dialogs - Archive of obsolete content
it's ok to use this function if you're just debugging some problem and want to see if the program reaches a specific line of code, or to inspect the value of a variable, but your final extension should not have alert
calls anywhere.
Appendix D: Loading Scripts - Archive of obsolete content
this means that any and all javascript objects passed in our out of them are wrapped in inter-compartment proxy objects, which consume additional memory and add an extra layer of complexity to all property accesses and method
calls.
Appendix F: Monitoring DOM changes - Archive of obsolete content
for instance, if you need to know about attribute changes to a particular node, then you should replace its setattribute method with a function that
calls the original setattribute function as originalsetattribute.apply(this, arguments) before running your necessary event code.
XPCOM Objects - Archive of obsolete content
the add and delete
calls to the category manager would have to be done in the registerself and unregisterself methods: registerself : function(acompmgr, alocation, aloaderstr, atype) { let categorymanager = cc[@mozilla.org/categorymanager;1].getservice(ci.nsicategorymanager); acompmgr.queryinterface(ci.nsicomponentregistrar); acompmgr.registerfactorylocation( class_id, class_name, contract_id, alocatio...
Automated testing tips and tricks - Archive of obsolete content
ript 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 chromewindow.addeventlistener('domcontentloaded',callbackfunction,false); ...
Building Firefox with Rust code - Archive of obsolete content
if you have new rust libraries that code in libxul
calls directly, then you should add the appropriate extern crate lines in toolkit/library/rust/shared/lib.rs, and add those libraries (crates) as dependencies in toolkit/library/rust/cargo.toml.
JavaScript crypto - Archive of obsolete content
overview of the new cert issuing process user fills out enrollment form user action initiates script script
calls key generation method (generatecrmfrequest) signing and encryption keys are generated encryption private key is wrapped with public key of key recovery authority (kra) (passed in in the form of a certificate as part of the script, and checked against a pre-installed certificate copy in the local certificate database) the public keys, wrapped encryption private key, and text string from the scr...
Menu - Archive of obsolete content
if the menu remains open when getrecenttweets() receives data from the network and
calls done(), the "loading..." item is replaced with the tweets, one item per tweet: this example will not work on os x due to a platform bug in firefox.
UI - Archive of obsolete content
displaying jetpack content in a slide-out animated vertical column toolbar including entries and access elements into the toolbar panel a movable, expandable, and custom styled content element to display jetpack content tabs adding events and interacting with browser tabs and their contained documents statusbar low-level functions and basic
calls notifications a system for alerting users via provided ui mechanisms selection interacting with user-selected content window mitigates and eases interactions between different browser windows ...
Nanojit - Archive of obsolete content
once the instructions are in the lirbuffer, the application
calls nanojit::compile() to produce machine code, which is stored in a nanojit::fragment.
Plugin Architecture - Archive of obsolete content
sequence of events in content a content node for a plugin dom element gets created in bindtotree (usually) or another function, it
calls loadobject loadobject either notices directly that it is dealing with a plugin, or it starts a network request and notices this in onstartrequest when it realizes that, it tries to create a frame, if anotify is true and no frame exists yet if a frame exists now, it is asked to instantiate the plugin that was the normal case.
Tamarin Acceptance Test Template - Archive of obsolete content
* * ***** end license block ***** */ var section = "test"; // provide a document reference (ie, actionscript section) var version = "as3"; // version of ecmascript or actionscript var title = "test"; // provide ecma section title or a description var bugnumber = ""; starttest(); // leave this alone /** *
calls to addtestcase here.
getLastError - Archive of obsolete content
example the following example
calls getlasterror after a series of addfile
calls: addfile("npplug", ...); addfile("/ms/shared/ctl3d.dll", ...); addfile("/nethelp/royalplug/royalhelp.html",...); err = getlasterror(); ...
Install Object - Archive of obsolete content
the following two lines, for example, are equivalent: f = getfolder("program"); f = install.getfolder("program"); an installation script is composed of
calls to the install object, and generally takes the following form: initialize the installation call initinstall with the name of the installation and the necessary registry and version information.
Index - Archive of obsolete content
it explains the concept of dom documents, demonstrates a few simple examples of using dom
calls to perform basic manipulations on a document, and then demonstrates working with anonymous xbl content using mozilla-specific methods.
Things I've tried to do with XUL - Archive of obsolete content
instead, you must build up your own listitem full of listcells, and then add that listitem to the listbox, using generic dom
calls: var row = document.createelement('listitem'); // create and attach 1st cell var cell = document.createelement('listcell'); cell.setattribute('label', label ); cell.setattribute('value', value ); row.appendchild( cell ); // create and attach 2nd cell cell = document.createelement('listcell'); cell.setattribute('label', label2 ); cell.setattribute('value', value2 ); row.appendchild( cell ); // et...
Custom Tree Views - Archive of obsolete content
unction(){ return false; }, getlevel: function(row){ return 0; }, getimagesrc: function(row,col){ return null; }, getrowproperties: function(row,props){}, getcellproperties: function(row,col,props){}, getcolumnproperties: function(colid,col,props){} }; the functions in the example not described above do not need to perform any action, but they must be implemented as the tree
calls them to gather additional information.
XPCOM Examples - Archive of obsolete content
em) { var mediator = components.classes["@mozilla.org/rdf/datasource;1?name=window-mediator"].getservice(); mediator.queryinterface(components.interfaces.nsiwindowdatasource); var resource = elem.getattribute('id'); switchwindow = mediator.getwindowforresource(resource); if (switchwindow){ switchwindow.focus(); } } </script> a command handler was added to the menu element which
calls the function switchfocus() with a parameter of the element that was selected from the menu.
Using Remote XUL - Archive of obsolete content
we add an id attribute to the iframe element so we can reference it from our function, and we add an oncommand event listener to the menubar element that
calls the function every time the user clicks a button or selects a menu item.
2006-10-27 - Archive of obsolete content
discussions evalinsandbox and xmlhttprequest a discussion about writing something that
calls a function defined by the page that the user is currently on chrome files and last modified date ways to retrieve the last modified date of a chrome file that may be in a jar or on the file system.
NPFullPrint - Archive of obsolete content
if you want an embedded plug-in to simply render its area of the page, set pluginprinted to false and return immediately; the browser
calls npp_print again with the npembedprint substructure of npprint.
NPN_GetURL - Archive of obsolete content
if target is null, the application creates a new stream and delivers the data to the plug-in instance, through
calls to npp_newstream(), npp_writeready() and npp_write(), and npp_destroystream().
NPP_Destroy - Archive of obsolete content
the browser
calls this function when a plug-in instance is deleted, typically because the user has left the page containing the instance, closed the window, or quit the browser.
NPP_URLNotify - Archive of obsolete content
description the browser
calls npp_urlnotify() after the completion of a npn_geturlnotify() or npn_posturlnotify() request to inform the plug-in that the request was completed and supply a reason code for the completion.
Developing cross-browser and cross-platform pages - Archive of obsolete content
hideelement(id_attribute_value) { if (document.getelementbyid && document.getelementbyid(id_attribute_value) && document.getelementbyid(id_attribute_value).style ) { document.getelementbyid(id_attribute_value).style.visibility = "hidden"; }; } // example: // <button type="button" onclick="hideelement('d1');">hide div</button> // <div id="d1">some text</div> these repeated
calls to document.getelementbyid are not the most efficient way to check for the existence of particular objects or features in the browser's dom implementation, but they serve to illustrate clearly how object support detection works.
E4X for templating - Archive of obsolete content
nt = <></>; for each (var el in a) { el.@att = 'val'; content += el; } return content; }()}</bar>; giving: <bar> <b att="val"/> <c att="val"/> <d att="val"/> </bar> one may still wish to remove complex business logic and supply as variables to the e4x, but the above allows the shaping of resulting content to be made more clear (and sometimes design logic also
calls for extra processing).
ECMAScript 2015 support in Mozilla - Archive of obsolete content
ybuffer get arraybuffer[@@species] (firefox 48) dataview int8array uint8array uint8clampedarray int16array uint16array int32array uint32array float32array float64array get %typedarray%[@@species] (firefox 48) expressions and operators new.target (firefox 41) spread operator for arrays (firefox 16) use symbol.iterator property (firefox 36) spread operator for function
calls (firefox 27) use symbol.iterator property (firefox 36) const (js 1.5, firefox 1.0) (es2015 compliance bug 950547 implemented in firefox 51) let (js 1.7, firefox 2) (es2015 compliance bug 950547 implemented in firefox 51) destructuring assignment (js 1.7, firefox 2) (es2015 compliance bug 1055984) statements for...of (firefox 13) works in terms of .iterator() and .next() ...
LiveConnect - Archive of obsolete content
note: liveconnect blocked under some conditions liveconnect
calls from javascript to java api are blocked when the java control panel security slider is set to very high level, or when the slider is at the default high level and the jre has either expired or is below the security baseline.
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?
asm.js - Game development
asm.js has a very predictable perfomance rate because it is limited to an extremely restricted subset of javascript that provides only strictly-typed integers, floats, arithmetic, function
calls, and heap accesses.
Paddle and keyboard controls - Game development
add the following line inside your draw() function, just below the line that
calls drawball(): drawpaddle(); compare your code here's the working code for you to compare yours against: exercise: make the paddle move faster or slower, or change its size.
Extra lives - Game development
events you have probably noticed the add() and addonce() method
calls in the above two code blocks and wondered how they differ.
Function - MDN Web Docs Glossary: Definitions of Web-related terms
an outer function is a function containing a function (addsquares in this case): function addsquares(a,b) { function square(x) { return x * x; } return square(a) + square(b); }; //using ecmascript 2015 arrow notation const addsquares = (a,b) => { const square = x => x*x; return square(a) + square(b); }; a recursive function is a function that
calls itself.
WAI-ARIA basics - Learn web development
div class="errors" role="alert" aria-relevant="all"> <ul> </ul> </div> role="alert" automatically turns the element it is applied to into a live region, so changes to it are read out; it also semantically identifies it as an alert message (important time/context sensitive information), and represents a better, more accessible way of delivering an alert to a user (modal dialogs like alert()
calls have a number of accessibility problems; see popup windows by webaim).
Working with JSON - Learn web development
we are then passing that object to two function
calls — the first one fills the <header> with the correct data, while the second one creates an information card for each hero on the team, and inserts it into the <section>.
Object building practice - Learn web development
the first part of the script looks like so: const canvas = document.queryselector('canvas'); const ctx = canvas.getcontext('2d'); const width = canvas.width = window.innerwidth; const height = canvas.height = window.innerheight; this script gets a reference to the <canvas> element, then
calls the getcontext() method on it to give us a context on which we can start to draw.
Client-Server Overview - Learn web development
#best/views.py from django.shortcuts import render from .models import team def junior(request): list_teams = team.objects.filter(team_type__exact="junior") context = {'list': list_teams} return render(request, 'best/index.html', context) after the junior() function gets the list of junior teams, it
calls the render() function, passing the original httprequest, an html template, and a "context" object defining the information to be included in the template.
React interactivity: Events and state - Learn web development
change the console.log() to setname(), as shown below: function handlechange(e) { setname(e.target.value); } now we need to change our handlesubmit() function so that it
calls props.addtask with name as an argument — remember our callback prop?
Adding a new todo form: Vue events, methods, and models - Learn web development
o-'), label: 'create a vue project with the cli', done: true }, { id:uniqueid('todo-'), label: 'have fun', done: true }, { id:uniqueid('todo-'), label: 'create a to-do list', done: false } ] }; }, methods: { addtodo() { console.log('to-do added'); } } }; next, add an event listener for the todo-added event to the <to-do-form></to-do-form>, which
calls the addtodo() method when the event fires.
Gecko info for Windows accessibility vendors
t] */ bstr *url); // location of document hresult get_title (/* [out] */ bstr *title); // from the <title> hresult get_mimetype(/* [out] */ bstr *mimetype); // for example text/html or text/plain hresult get_doctype (/* [out] */ bstr *doctype); // from the <!doctype ..> hresult get_namespaceuriforid( // translate namespace id's from isimpledomnode /* [in] */ unsigned short namespaceid, //
calls into the actual namespace uri's /* [out] */ bstr *namespaceuri); hresult put_alternateviewmediatypes(/* [in] */ bstr * commaseparatedmediatypes); // for example "aural, braille" keyboard user interface and api fortunately, gecko uses the standard keyboard api's for each supported platform.
Multiprocess on Windows
as you should already know from the prerequisite reading, single threaded apartments receive remote procedure
calls (rpcs) from com, via the windows message queue.
Accessible Toolkit Checklist
, offscreen, focusable to avoid extra work, utilize implementing an msaa server mnemonics ability to define in xml for any widget with a text label (via attribute or a preceding char in label) automatically define mnemonics for all standard common dialogs (like yes/no confirmations and retry/exit error dialogs) support mnemonics in dialogs created via method
calls layout engine - drawing underline under correct letter events - making keystrokes do the right thing msaa support, via iaccessible's get_acckeyboardshortcut support for ms windows settings when high contrast checkbox is set (in accessibility control panel, spi_gethighcontrast), or when user selects a "native" skin option in your software, then get all look a...
Chrome registration
if you need to call functions or access properties defined by the content -- for example, if your add-on wants to add a button to the page that
calls a javascript function defined by the page.
Creating Sandboxed HTTP Connections
it is usually best to use a javascript wrapper that implements all the required methods and
calls the specified callback function when the connection has completed.
Debugging
debugging specific parts of the mozilla codebase debugging opengl if you're working on code that involves opengl
calls, and need to debug it, you can turn on a special opengl debugging mode.
How Mozilla's build system works
these data structures are then read by a build backend generator, which then converts them into files, function
calls, and so on.
Callgraph
the callgraph project uses gcc and treehydra to generate information about function and method
calls at compile time, and aggregates it into a sqlite database.
Interface Compatibility
using these interfaces, and using dynamic
calls to queryinterface, it has been possible to write binary xpcom components which were compatible with multiple versions of firefox.
mach
as you can see, the mach driver is a shim that
calls into the mach core.
Performance best practices for Firefox front-end engineers
it should be possible to write a test that gets the nsidomwindowutils for a browser window, records the number of styleflushes, then synchronously
calls the function that you want to test, and immediately after checks the styleflushes attribute again.
mozbrowseractivitydone
postresult and posterror
calls made on such an activity will be ignored and have no effect.
mozbrowserclose
the mozbrowserclose event is fired when the content of a browser <iframe>
calls the window.close() method.
mozbrowseropenwindow
the mozbrowseropenwindow event is fired when a new window is required — usually when the content of a browser <iframe> successfully
calls the window.open() method, or the user clicks on a link with an unknown target.
ChromeWorker
summary if you're developing privileged code, and would like to create a worker that can use js-ctypes to perform
calls to native code, you can do so by using chromeworker instead of the standard worker object.
Chrome-only API reference
it currently works in (privileged) chrome code on firefox desktop (version 47 and above).chromeworkerif you're developing privileged code, and would like to create a worker that can use js-ctypes to perform
calls to native code, you can do so by using chromeworker instead of the standard worker object.
MozBeforePaint
this computes the current position for the animating box and updates the box's position on screen, and, if the animation sequence is not yet complete,
calls window.requestanimationframe() to schedule the next animation frame to be drawn.
Overview of Mozilla embedding APIs
internally, this function tries to convert the nsisupports argument into an nsiinterfacerequestor and then
calls getinterface(...) to retrieve the requested interface.
AddonListener
these notifications come in the form of
calls to methods on the listener object.
UpdateListener
an updatelistener receives messages from an update check for a single add-on, though it is possible to pass the same updatelistener to as many
calls to findupdates() as you like.
AsyncShutdown.jsm
in this case, a crash report is produced, with information on all the shutdown blockers that have not been resolved, and all the additional debug information returned by
calls to info().
DownloadTarget
you can use this instead of using file system
calls to check for the existence of the file in order to reduce io overhead.
Interfacing with the Add-on Repository
for example: searchsucceeded: function(addons, addoncount, totalresults) { var num = math.floor(math.random() * addoncount); this.shownotification("would you like to try the " + addons[num].name + " addon?", "install", addons[num].install); }, this routine randomly selects one of the returned add-ons, then
calls the previously mentioned shownotification() routine, passing in as parameters a prompt including the name of the returned add-on, a label for the button to show in the notification ("install"), and the addoninstall object that can be used with the add-on manager api to install the add-on.
OSFile.jsm
i/o efficiency is all about minimizing the number of actual i/o
calls.
XPCOMUtils.jsm
notice that the queryinterface() method implemented by the component simply
calls the generateqi() method provided by the xpcomutils code module.
source-editor.jsm
all changes made to the text between the two
calls is considered to be a single edit for the purposes of undo operations.
Setting up the infrastructure
by default the script looks for gettext
calls in *thtml or *.php files, so you may need to adjust that to your code.
Mozilla Style System Documentation
the pres context forwards these
calls to its style set object (stylesetimpl, interface nsistyleset), which does the real work (and also maintains the lists of stylesheets and owns the rule tree).
BloatView
if they aren't, then you're not using the ns_impl_addref and ns_impl_release (or ns_impl_isupports which
calls them) for xpcom objects, or moz_count_ctor and moz_count_dtor for non-xpcom objects.
DMD
js_calloc()
calls replace_calloc().
Power profiling overview
common causes of wakeups include scheduled timers going off and blocked i/o system
calls receiving data.
TimerFirings logging
there are also timers for settimer or setinterval
calls in javascript code, as the following sample shows.
Preference reference
set it to true to enable it, or false to disable it.browser.dom.window.dump.filebrowser.dom.window.dump.file redirects the ouput of window.dump()
calls to a file whose address is specified in this preference if browser.dom.window.dump.enabled is set to true.
L20n Javascript API
in other words, the following two
calls: ctx.updatedata({ user: { name: "bob" } }); ctx.updatedata({ user: { gender: "masculine" } }); will make the internally-stored context data look like this: { "user" : { "name": "bob", "gender": "masculine" } } ctx.getsync(id: string, ctxdata: object?) retrieve a string value of an entity called id.
Leak And Bloat Tests
results printed on tinderbox output, these consist of: mail rlk reference count leaks mail lk total bytes malloc'ed and not free'd mail mh maximum heap size mail a allocations - number of
calls to malloc and friends.
McCoy
mozilla
calls mccoy a "simple system" which is a clear sign that something probably is not working, and indeed, is not.
NSPR Poll Method
new_flags = fd->methods->poll(fd, pr_poll_write, &out_flags); if you are interested in calling both pr_recv and pr_send on the same file descriptor, make two separate
calls to the poll method, one with pr_poll_read as in_flags and the other with pr_poll_write as in_flags, so that you know what events at the network transport layer pr_poll_read and pr_poll_write are mapped to, respectively.
Nonblocking IO In NSPR
the current implementation of <tt>pr_select()</tt> simply
calls <tt>pr_poll()</tt>, so it is sure to have worse performance.
NSPR LOG MODULES
to enable all log module
calls to pr_log, set the variable as follows: set nspr_log_modules=all:5 timestamp including timestamp results in a timestamp of the form "2015-01-15 21:24:26.049906 utc - " prefixing every logged line.
PRHostEnt
all addresses are passed in host order and returned in network order (suitable for use in system
calls).
PR_ConnectContinue
when pr_poll() returns, one
calls pr_connectcontinue() on the socket to determine whether the nonblocking connect has completed or is still in progress.
PR_CreatePipe
when the pipe is no longer needed, both ends should be closed with
calls to pr_close.
PR_FindSymbol
if the library is unloaded, for instance, the results of any pr_findsymbol
calls become invalid as well.
PR_Initialize
in addition to establishing the sequence of operations, pr_initialize implicitly
calls pr_cleanup on exiting the primordial function.
PR_NewTCPSocket
typically, the server binds its socket to a well-known port with pr_bind,
calls pr_listen to start listening for connection setup requests, and
calls pr_accept to accept a connection.
PR_OpenDir
description pr_opendir opens the directory specified by the pathname name and returns a pointer to a directory stream (a prdir object) that can be passed to subsequent pr_readdir
calls to get the directory entries (files and subdirectories) in the directory.
PR_OpenTCPSocket
typically, the server binds its socket to a well-known port with pr_bind,
calls pr_listen to start listening for connection setup requests, and
calls pr_accept to accept a connection.
PR_SetThreadPriority
it is preferable for a thread to specify itself in the thread parameter when it
calls pr_setthreadpriority.
PR_SetThreadPrivate
description if the thread already has non-null private data associated with it, and if the destructor function for the index is known (not null), nspr
calls the destructor function associated with the index before setting the new data value.
NSS FAQ
you can use nspr throughout your application or only in the portion that
calls into nss.
NSS_3.12.2_release_notes.html
rtchain as a parameter to sec_pkcs12addcertandkey bug 390527: get rid of pkixerrormsg variable in pkix_error bug 391560: libpkix does not consistently return pkix_validatenode tree that truly represent failure reasons bug 408260: certutil usage doesn't give enough information about trust arguments bug 412311: replace pr_interval_no_wait with pr_interval_no_timeout in client initialization
calls bug 423839: add multiple pkcs#11 token password command line option to nss tools.
NSS 3.12.6 release notes
the behavior of nss for renegotiation can be changed through api function
calls, or with the following environment variables: nss_ssl_enable_renegotiation values: [0|n|n]: ssl_renegotiate_never never allow renegotiation - that was the default for 3.12.5 release.
NSS 3.15 release notes
applications that use ssl_authcertificatehook to override the default handler should add appropriate
calls to ssl_peerstapledocspresponse and cert_cacheocspresponsefromsidechannel.
NSS 3.51 release notes
bug 1538980 - secu_readderfromfile
calls strstr on a string that isn't guaranteed to be null-terminated bug 1561337 - correct a warning for comparison of integers of different signs: 'int' and 'unsigned long' in security/nss/lib/freebl/ecl/ecp_25519.c:88 bug 1609751 - add test for mp_int clamping bug 1582169 - don't attempt to read the fips_enabled flag on the machine unless nss was built with fips enabled bug 1431940 - fix a null p...
NSS API Guidelines
in order to be fully thread safe, your code must understand the semantics of the service functions it
calls, and whether they are thread safe.
PKCS #11 Module Specs
parameter passing if the parameter is specified, the application/library will strip the value out, processing any outter quotes and escapes appropriately, and pass the parameter to the pkcs #11 library when it
calls c_initialize().
FC_DigestEncryptUpdate
the operation is finished by
calls to fc_digestfinal and fc_encryptfinal in that order.
NSS_Initialize
if a pkcs#11 module isn't thread-safe, don't serialize its
calls; just don't load it instead.
NSS Tools
eliminate use of getopt() and replace with nspr
calls to get command options (to eliminate platform dependencies with getopt()).
NSS_3.12.3_release_notes.html
bug 467298: sql db code uses local cache on local file system bug 468279: softoken crash importing email cert into newly upgraded db bug 468532: trusted ca trust flags not being honored in cert_verifycert bug 469583: coverity: uninitialized variable used in sec_pkcs5createalgorithmid bug 469944: when built with microsoft compilers bug 470351: crlutil build fails on windows because it
calls undeclared isatty bug 471539: stop honoring digital signatures in certificates and crls based on weak hashes bug 471665: nss reports incorrect sizes for (aes) symmetric keys bug 471715: add cert to nssckbi to override rogue md5-collision ca cert bug 472291: crash in libpkix object leak tests due to null pointer dereferencing in pkix_build.c:3218.
Multithreading in Necko
the default implementation does not spawn a worker thread, and instead simply
calls pr_getipnodebyname (essentially equivalent to gethostbyname).
Pork Tools
in this case all of the
callsites are modified to: a) getter_addrefs case: getter(getter_addrefs(foo)) -> foo = getter() b) all other cases: getter(&foo) -> foo = getter().get() ...
Rhino Debugger
controlling execution the debugger provides the following facilities for you to control the execution of scripts you are debugging: step into to single step entering any function
calls, you may do any of the following: select the debug->step into menu item on the menu bar press the step into button on the toolbar press the f11 key on the keyboard execution will resume.
Rhino Examples
primitivewrapfactory primitivewrapfactory.java is an example of a wrapfactory that can be used to control the wrapping behavior of the rhino engine on
calls to java methods.
Rhino optimization
note some language features (indirect
calls to eval, use of the arguments property of function objects) were previously not supported in higher optimization levels.
Rhino overview
setting this property to true requires that any
calls that compile or evaluate javascript must supply a security domain object of any object type that will be used to identify javascript code.
Performance Hints
calls to eval are slow because the script being executed must be compiled.
Creating JavaScript jstest reftests
multiple
calls to expectexitcode will tell the post-processing scripts that the test actually passed if any of the exit codes are found when the test terminates.
FOSS
flusspferd - (newer) c++ bindings libjspp - c++ template based library for extending & embedding spidermonkey; works with spidermonkey 1.8.5 and above, has lots of goodies spiderape - the oldest c++ bindings for spidermonkey trixul - (trixul cvs) - trixul xml-based gui toolkit embeds spidermonkey, using javascript to implement logic behind its gui, supporting
calls from javascript to c++ objects rust mozjs - rust bindings used by servo gnome gjs - javascript bindings to gnome (broadly, to any library using the gobject introspection mechanism) objective caml http://alain.frisch.fr/soft.html#spider - bindings to embed spidermonkey in ocaml applications perl http://jspl.msg.mx/ - bindings to cross-embed spidermonkey and perl.
64-bit Compatibility
builtins and
calls when passing arguments to lirwriter::inscall(), there are four types: argsize_f - floating point value argsize_i - 32-bit integer argsize_q - 64-bit integer argsize_p - 32-bit integer on 32-bit platforms, 64-bit integer on 64-bit platforms.
Property cache
occasionally, during garbage collection, all shape ids are regenerated (in order to recycle unused shape ids so that we don't run out; see
calls to js_regenerateshapeforgc.
SpiderMonkey Internals
js.cpp, jsshell.msg the "js shell", a simple interpreter program that uses the js api and more than a few internal interfaces (some of these internal interfaces could be replaced by jsapi.h
calls).
JS::Add*Root
all the js::add*root methods are idempotent: multiple
calls for the same address will add only one root.
JS::Call
description js::call
calls a specified function, fun, on an object, thisobj.
JS::CallArgs
js::value computethis(jscontext *cx) const returns the this value if this is an object, otherwise
calls js_computethis and returns it.
JS::Construct
description js::construct
calls a specified function as a constructor, fun.
JS::ToString
if v.isstring() is true, it
calls v.tostring().
JSClass
obsolete since jsapi 29 call jsnative this is called when a script
calls an object as though it were a function: obj().
JSDeletePropertyOp
in js_threadsafe builds, the javascript engine
calls this callback only from within an active request on cx.
JSFastNative
in js_threadsafe builds, the javascript engine
calls this callback only from within an active request on cx.
JSFunctionSpec
an application typically has an array of jsfunctionspec to define all the functions for an object and
calls js_definefunctions or js_initclass to create the functions and assign them to an object.
JSIteratorOp
description the javascript engine
calls the jsextendedclass.iteratorobject callback to create an iterator object for a given object.
JSMarkOp
jsclass hooks jsclass offers the following hook: the javascript engine
calls the jsclass.mark callback during the mark phase of garbage collection.
JSNative
in js_threadsafe builds, the javascript engine
calls this callback only from within an active request on cx.
JSObjectOps.newObjectMap
after a successful construction, some number of js_holdobjectmap and js_dropobjectmap
calls ensue.
JSPropertyOp
in js_threadsafe builds, the javascript engine
calls this callback only from within an active request on cx.
JSPropertySpec
tinyid int8 obsolete since jsapi 31 unique id number for the property to aid in resolving getproperty and setproperty method
calls.
JSRuntime
all javascript code and most jsapi
calls run within a jscontext.
JSXDRObjectOp
jsclass hooks jsclass offers the following hook: jsxdr
calls the jsclass.xdrobject callback to serialize and deserialize objects.
JS_AddExternalStringFinalizer
in a js_threadsafe build, this function must be invoked on the primordial thread only, at startup—or else the entire program must single-thread itself while loading a module that
calls this function.
JS_AddFinalizeCallback
description js_addfinalizecallback add a callback function which the garbage collector
calls at several points during garbage collection.
JS_Add*Root
all the js_add*root methods are idempotent: multiple
calls for the same address will add only one root.
JS_ContextIterator
on success, the value of *iterp is modified so that repeated
calls cycle through all the contexts in rt.
JS_ConvertArguments
in certain error cases, js_convertarguments
calls js_argv_callee(argv), which accesses memory outside the range [argv ..
JS_ConvertValue
js_convertvalue
calls other, type-specific conversion routines based on the type argument.
JS_DefineProperty
it differs from js_setproperty in that: it does not behave like ordinary property assignment in the javascript language; it allows the application to specify additional details (getter, setter, and attrs) governing the new property's behavior; it never
calls a setter; it can call the jsclass.addproperty callback when js_setproperty would not, because it can replace an existing property.
JS_EnterLocalRootScope
local root scopes do not cover objects that are the result of jsapi
calls like js_getproperty or js_callfunction.
JS_GetFunctionCallback
note: this method is only available if moz_trace_js
calls was defined at compile time using --enable-trace-js
calls.
JS_InitClass
this inconsistency can cause problems; for example, if the finalizer
calls js_getprivate(), expecting that the constructor called js_setprivate(), it may find that the private data is null.
JS_LeaveCompartment
any access to an object in a different compartment must be bracketed by
calls to js_entercompartment and js_leavecompartment.
JS_LookupProperty
(the javascript engine simply passes these flags through to the object when it
calls the object's jsclass.resolve callback, so objects of a custom jsclass may interpret these flags however they like.) if flags is 0, js_lookuppropertywithflags uses the default lookup rules, the ones used by js_lookupproperty.
JS_MakeStringImmutable
(when an application shares a string by storing it in a javascript object that another thread can read, the javascript engine automatically makes the string thread-safe.) after a successful call to js_makestringimmutable, subsequent
calls to js_getstringcharsz on the same string are guaranteed to succeed, and subsequent
calls to js_getstringchars on the same string are guaranteed to return a null-terminated string.
JS_NewRuntime
call js_newruntime before making any other api
calls except js_init.
JS_SaveFrameChain
before calling js_restoreframechain, cx's call stack must be balanced and all nested
calls to js_saveframechain must have had matching js_restoreframechain
calls.
JS_SetBranchCallback
in js_threadsafe builds, the javascript engine
calls this callback only from within an active request on cx.
JS_SetExtraGCRoots
callback description generic trace operation that
calls js_calltracer on additional traceable things.
JS_SetFunctionCallback
note: this method is only available if moz_trace_js
calls was defined at compile time using --enable-trace-js
calls.
JS_SetInterruptCallback
in js_threadsafe builds, the javascript engine
calls this callback only from within an active request on cx.
JS_SetOperationCallback
in js_threadsafe builds, the javascript engine
calls this callback only from within an active request on cx.
JS_ValueToNumber
for objects of standard classes, this is js_convertstub, which simply
calls v.valueof() if present.
JS_ValueToObject
if v is a native javascript object, this
calls the object's valueof method, if any.
JS_ValueToString
for standard classes, this is js_convertstub, which simply
calls v.valueof() if present.
SpiderMonkey 1.8.5
js_isconstructing, used to differentiate between
calls to native constructors with and without the new keyword, now takes a pointer to the native's vp, along with the native's context pointer, to figure out how the function was called.
SpiderMonkey 1.8.7
js_isconstructing, used to differentiate between
calls to native constructors with and without the new keyword, now takes a pointer to the native's vp, along with the native's context pointer, to figure out how the function was called.
SavedFrame
for example, if this frame’s children are
calls to handlers for a promise this frame created, this frame’s asynccause would be "promise".
Mozilla Projects
mozilla
calls mccoy a "simple system" which is a clear sign that something probably is not working, and indeed, is not.
History Service Design
these statements can be reused avoiding the overhead due to createstatement
calls, before closing the connection these statements need to be finalized though, since not doing that would cause leaking.
Manipulating bookmarks using Places
var ios = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); var uri = ios.newuri("http://google.com/", null, null); var newbkmkid = bmsvc.insertbookmark(newfolderid, uri, bmsvc.default_index, ""); this example instantiates the nsiioservice and uses it to create an nsiuri referring to the google web site, then
calls nsinavbookmarksservice.insertbookmark() to create a new bookmark to google, placing it at the end of the bookmarks folder referenced by newbkmkid.
extIApplication
getextensions(acallback)
calls acallback with the list of installed extensions.
Packaging WebLock
a chrome registry registerchrome(content, getfolder(cf,"weblock.xpi"),"weblock"); registerchrome(skin, getfolder(cf, "weblock.xpi"),"weblock"); // perform the installation if there are no errors if (err==success) performinstall(); else cancelinstall(err); the weblock trigger script the trigger script is the script placed on a web page that actually initiates an xpinstall installation and
calls the installation script that appears in the xpi.
Using XPCOM Components
actually, the getservice() method in the example here
calls through to the createinstance() method that is also available from the component object and caches the result, making it a singleton rather than a normal instance.
Mozilla internal string guide
beginwriting(iterator) endwriting(iterator) setcapacity() - inform the string about buffer size need before a sequence of
calls to append() or converting appends that convert between utf-16 and latin1 in either direction.
XPCOM Stream Guide
nsmultiplexinputstream @mozilla.org/io/multiplex-input-stream;1 nsimultiplexinputstream .appendstream(stream) .insertstream(stream, index) buffered read ahead in the underlying stream into a buffer, so that
calls to the underlying stream are minimized.
XPCOM guide
the problem would not exist with java's interfaces).making cross-thread
calls using runnablesin the mozilla platform, most activities such as layout, dom operations, content javascript, and chrome javascript run on the main thread.
Introduction to XPCOM for the DOM
indeed, if someone decides to change the name or the signature of the methods you use, you will have to change all the
calls to those methods throughout your code.
Components.classes
ci = components.interfaces; var os = cc["@mozilla.org/observer-service;1"] .getservice(ci.nsiobserverservice); a less known trick, useful when creating multiple instances of the same component, is to use the new operator on the class object: var clazz = components.classes["@mozilla.org/supports-array;1"]; var inst = new clazz(components.interfaces.nsisupportsarray); this implicitly
calls the createinstance() method for you.
Components.lastResult
this is because many 'components' properties and methods are themselves implemented using xpconnect and subsequent
calls to components.lastresult might reflect the result of 'implicit' xpconnect
calls rather than the result of the target call.
Components.stack
components.stack is a read only property of type nsistackframe (idl definition) that represents a snapshot of the current javascript
callstack.
Components.utils.evalInWindow
if the returned object contains a function,
calls to evalinwindow() will throw an error: // page-script.js function bar() { } var somelocalvariablecontainingafunction = {name: "selection1", foo : bar}; // add-on-script.js components.utils.evalinwindow("somelocalvariablecontainingafunction", contentwindow); // error, function can't be cloned ...
Components.utils
see js_setgczeal for details; this method
calls through to that with the specified value as the zeal value.
Components.utils.setGCZeal
this method
calls through to that thusly: js_setgczeal(<current context>, zeal, js_default_zeal_freq, false); syntax components.utils.setgczeal(zeal); where zeal is the zeal value you wish to use.
xpcshell
js> see also howto for common problems in writing xpcshell scripts, e.g., doing async network
calls or using js modules.
imgILoader
this must already be opened before this method is called, and there must have been no ondataavailable
calls for it yet.
imgIRequest
calling requestdecode on the imgirequest simply forwards along the request if the container already exists, or
calls it once it gets onstartcontainer if the container does not yet exist.
mozIRegistry
the primary change to this component is that we will modify it to utilize the new moziregistry interface versus the nsreg.h functions it
calls today.
mozIStorageStatementCallback
the mozistoragestatementcallback interface represents a callback handler that the storage api
calls with result, error, and completion notifications while handling asynchronous database queries.
nsIAbCard
if cached by the caller and supplied to this function, then performance will be improved over many
calls.
nsIAppStartup
if there are no windows open and no outstanding
calls to enterlastwindowclosingsurvivalarea() this method will exit immediately.
nsICacheSession
until the client
calls markvalid on its descriptor, other attempts to open the same cache entry will block.
nsICommandLineRunner
run() processes the command-line handlers in the proper order, and
calls nsicommandlinehandler.handle() on each.
nsICompositionStringSynthesizer
if appendclause() and/or setcaret() are not called properly, e.g., sum of alength of
calls of appendclause() is not same as composition string set by setstring(), this throws an exception.
nsIContentViewer
if the method returns true, all subsequent
calls will be ignored.
nsICycleCollectorListener
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) the order of
calls will be call to begin(); then for every node in the graph a call to noteobject() and
calls to noteedge() for every edge starting at that node; then a call to begindescriptions(); then for every black node in the cycle collector graph a call to either describerefcountedobject() or to describegcedobject(); and then a call to end().
nsIDBChangeListener
the calling function stores the value of astatus, changes the header ahdrtochange, then
calls onhdrpropertychanged again with aprechange false.
nsIDOMFileException
the nsidomfileexception interface represents exceptions that can be raised by
calls to the methods in the nsidomfile interface.
nsIDOMXULElement
click() unless the element is disabled, sends mouse events that simulate the effect of clicking the mouse on the element, then
calls the docommand() method.
nsIDebug2
this is normally zero in release builds, but does include
calls to nsidebug.assertion().
nsIDirectoryServiceProvider
method overview nsifile getfile(in string prop, out prbool persistent); methods getfile() the directory service
calls this method when it gets the first request for a prop or on every request if the prop is not persistent.
nsIDirectoryServiceProvider2
inherits from: nsidirectoryserviceprovider last changed in gecko 0.9.6 method overview nsisimpleenumerator getfiles(in string prop); methods getfiles() the directory service
calls this when it gets a request for a prop and the requested type is nsisimpleenumerator.
nsIDownloadManager
this
calls cancel(ns_binding_aborted) on the nsicancelable provided by the download.
nsIDownloadManagerUI
methods getattention()
calls attention to the download manager's user interface if it's already open.
nsIFaviconService
this might be done at any time on a timer, so you should not let the message loop run between
calls or your icon may get deleted.
nsILocaleService
calls to its getcategory method return the values originally passed to the locale definition's addcategory method.
nsILoginManager
note: this method is provided for use only by the formfillcontroller, which
calls it directly.
nsIMemoryReporter
deprecated since gecko 8.0 kind_nonheap 0 allocated directly by os
calls e.g.
nsINavHistoryService
calls can be nested, observers will only be notified when all batches begin/end.
nsIOutputStream
note: this method may be called more than once, but subsequent
calls are ignored.
nsIProgressEventSink
notifications will cease once the channel
calls its listener's onstoprequest method or once the channel is canceled (via nsirequest.cancel()).
nsISessionStore
1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) in versions of firefox prior to 3.5, the user preference browser.sessionstore.enabled must be true for these
calls to be successful.
nsISimpleEnumerator
this method is generally used to determine whether or not to initiate or continue iteration over the enumerator, though it can be called without subsequent getnext()
calls.
nsIStreamListener
aoffset number of bytes that were sent in previous ondataavailable()
calls for this request.
nsIStringEnumerator
this method is generally used to determine whether or not to initiate or continue iteration over the enumerator, though it can be called without subsequent getnext()
calls.
nsITaskbarWindowPreview
if the enablecustomdrawing attribute is true, the controller you implement will start receiving
calls to its nsitaskbarpreviewcontroller.drawpreview() and nsitaskbarpreviewcontroller.drawthumbnail() methods, as well as reads of its width, height, and thumbnailaccessratio attributes.
nsITextInputProcessor
if appendclausetopendingcomposition() and/or setcaretinpendingcomposition() are not called properly, e.g., sum of alength of
calls of appendclausetopendingcomposition() is not same as composition string set by setpendingcompositionstring(), this throws an exception.
nsIThreadEventFilter
(see nsithreadinternal.pusheventqueue()) warning: this method must not make any
calls on the thread object.
nsIThreadInternal
calls to pusheventqueue() may be nested, and must each be paired with a corresponding call to popeventqueue() to restore the original state of the thread.
nsITransaction
the transaction manager
calls this method to coalesce a new transaction with the transaction on the top of the undo stack.
nsIUTF8StringEnumerator
this method is generally used to determine whether or not to initiate or continue iteration over the enumerator, athough it can be called without subsequent getnext()
calls.
nsIWebSocketChannel
the socket listener's methods are called on the thread that
calls asyncopen() and are not called until after asyncopen() returns.
nsIXULTemplateQueryProcessor
currently, the datasource supplied to the methods will always be an nsirdfdatasource or a dom node, and will always be the same one in between
calls to initializeforbuilding() and done().
XPCOM Interface Reference by grouping
security this section contains apis for secure channel communications system this section contains application level interfaces including
calls to external support elements (such as device
calls).
Storage
table_name (value) values(:value)"); let params = stmt.newbindingparamsarray(); for (let i = 0; i < 10; i++) { let bp = params.newbindingparams(); bp.bindbyname("value", i); params.addparams(bp); } stmt.bindparameters(params); you can attach multiple sets of bindings to a statement by adding multiple mozistoragebindingparams objects to the array of parameter lists, adding each one through
calls to the mozistoragebindingparamsarray.addparams().
Troubleshooting XPCOM components registration
registration failure if the module is loading correctly but doesn't register its components, try adding
calls to components.utils.reporterror("debug me!"); in nsgetmodule() and other functions to try and find any errors.
Reference Manual
time [[more time-performance measurements are needed.]] in places where two or more subroutines
calls are required, i.e., of addref, release, and queryinterface, some nscomptr routines are factored, and hence, require additional time corresponding to invoking a subroutine.
Using nsIDirectoryService
once the service finds a location, if the provider says that the location is persistent, the service will cache that location so it is very quick on subsequent
calls.
Xptcall Porting Guide
the stubs forward
calls to a platform specific method that uses the interface information supplied by the overridden getinterfaceinfo to extract the parameters and build an array of platform independent nsxptcminivariant structs which are in turn passed on to the overridden callmethod.
XPCOM
it is used to facilitate cross language and cross thread method
calls.
Gloda examples
this requires two chained asynchronous
calls: //first take an email address and turn it into an identity object id_q = gloda.newquery(gloda.noun_identity); id_q.kind("email"); id_q.value("test@example.com"); id_coll = id_q.getcollection({ onitemsadded: function _onitemsadded(aitems, acollection) { }, onitemsmodified: function _onitemsmodified(aitems, acollection) { }, ...
Index
for new incoming messages, the protocol specific object that handles new messages
calls nsimsgfilterlist::applyfilterstohdr and passes itself in as nsimsgfilterhitnotify interface to handle filter hits.
MailNews Filters
for new incoming messages, the protocol specific object that handles new messages
calls nsimsgfilterlist::applyfilterstohdr and passes itself in as nsimsgfilterhitnotify interface to handle filter hits.
Using the Mozilla source server
now, when you click on a frame in the "
calls" window, windbg will prompt you about running cvs to download the associated source code.
Using the Mozilla symbol server
the debugger will not be able to show you the content of all variables and the execution path can seem strange because of inlining, tail
calls, and other compiler optimizations.
Using Objective-C from js-ctypes
while (objc_msgsend_bool(synth, isspeaking)) {} let release = sel_registername("release"); objc_msgsend(synth, release); objc_msgsend(text, release); lib.close(); creating objective-c blocks objective-c api
calls sometimes require you to pass in a block.
Working with data
line 4 declares the c function that accepts the array as an input, and the last line
calls that function.
ABI
you can also use this for various system
calls,including those on mac os x and linux.
ctypes
you also use this for all system
calls on mac os x and linux.
Flash Activation: Browser Comparison - Plugins
first, set your up your html with a callback that
calls the javascript function plugincreated(), like this: <object type="application/x-my-plugin" data="somedata.mytype" id="myplugin"> <param name="callback" value="plugincreated()"> </object> the plugincreated() function is then responsible for the setup of your script and any
calls back into the plugin that you need to make: function plugincreated() { document.getelementbyid('myplugin').callpl...
Browser Side Plug-in API - Plugins
npn_pluginthreadasynccall thread-safe way to request that the browser
calls a plug-in function on the browser or plug-in thread (the thread on which the plug-in was initiated).
Gecko Plugin API Reference - Plugins
npn_pluginthreadasynccall thread-safe way to request that the browser
calls a plug-in function on the browser or plug-in thread (the thread on which the plug-in was initiated).
Basic operations - Firefox Developer Tools
however, recording this information has a run-time cost, so you must ask the tool to record memory
calls before the memory is allocated, if you want to see memory call sites in the snapshot.
Console messages - Firefox Developer Tools
for example, code like this will cause an immediate, synchronous, reflow, when it
calls window.getcomputedstyle(thing).height: var thing = document.getelementbyid("the-thing"); thing.style.display = "inline-block"; var thingheight = window.getcomputedstyle(thing).height; because of this, it's a good idea to avoid interleaving write and read
calls to an element's styles when manipulating the dom, because every time you read back a style that has been invalidated by a previous write...
AnalyserNode.smoothingTimeConstant - Web APIs
if 0 is set, there is no averaging done, whereas a value of 1 means "overlap the previous and current buffer quite a lot while computing the value", which essentially smoothes the changes across analysernode.getfloatfrequencydata/analysernode.getbytefrequencydata
calls.
Animation.ready - Web APIs
you'll typically use a construct similar to this when using the ready promise: animation.ready.then(function() { // do whatever needs to be done when // the animation is ready to run }); example in the following example, the state of the animation will be running when the current ready promise is resolved because the animation does not leave the pending play state in between the
calls to pause and play and hence the current ready promise does not change.
AudioTrackList.getTrackById() - Web APIs
function disablecharacter(videoelem, charactername) { videoelem.audiotracks.gettrackbyid(charactername).enabled = false; } this short function gets the audiotracklist containing the video's audio tracks using htmlmediaelement.audiotracks, then
calls gettrackbyid() on it, specifying the character's name.
AudioTrackList.onaddtrack - Web APIs
example this snippet establishes a handler for the addtrack event that
calls a function, addtotracklist(), passing in the audiotrack object representing the newly-added track.
AudioWorkletGlobalScope - Web APIs
we should see the output of console.log
calls in the console: const audiocontext = new audiocontext() await audiocontext.audioworklet.addmodule('test-processor.js') const testnode = new audioworkletnode(audiocontext, 'test-processor') testnode.connect(audiocontext.destination) specifications specification status comment web audio apithe definition of 'audioworkletglobalscope' in that specification.
Background Tasks API - Web APIs
text: "this text is from task number " + (i+1).tostring() + " of " + n }; enqueuetask(logtaskhandler, taskdata); } } document.getelementbyid("startbutton").addeventlistener("click", decodetechnostuff, false); decodetechnostuff() starts by zeroing the values of totaltaskcount (the number of tasks added to the queue so far) and currenttasknumber (the task currently being run), and then
calls updatedisplay() to reset the display to its "nothing's happened yet" state.
Blob - Web APIs
it then
calls url.createobjecturl() to convert the blob into a url.
Cache.add() - Web APIs
the response status is not in the 200 range (i.e., not a successful response.) this occurs if the request does not return successfully, but also if the request is a cross-origin no-cors request (in which case the reported status is always 0.) examples this code block waits for an installevent to fire, then
calls waituntil() to handle the install process for the app.
Clipboard - Web APIs
calls to the methods of the clipboard object will not succeed if the user hasn't granted the needed permissions using the permissions api and the "clipboard-read" or "clipboard-write" permission as appropriate.
DOMTokenList.forEach() - Web APIs
the foreach() method of the domtokenlist interface
calls the callback given in parameter once for each value pair in the list, in insertion order.
Document.timeline - Web APIs
this timeline is unique to each document and persists for the lifetime of the document including
calls to document.open().
Document.write() - Web APIs
note: because document.write() writes to the document stream, calling document.write() on a closed (loaded) document automatically
calls document.open(), which will clear the document.
EXT_texture_filter_anisotropic - Web APIs
ext.texture_max_anisotropy_ext this is the pname argument to the gl.gettexparameter() and gl.texparameterf() / gl.texparameteri()
calls and sets the desired maximum anisotropy for a texture.
Element.getAttribute() - Web APIs
retrieving nonce values for security reasons, csp nonces from non-script sources, such as css selectors, and .getattribute("nonce")
calls are hidden.
Element: mouseup event - Web APIs
if isdrawing is true, the event handler
calls the drawline function to draw a line from the stored x and y values to the current location.
Event.preventDefault() - Web APIs
the event continues to propagate as usual, unless one of its event listeners
calls stoppropagation() or stopimmediatepropagation(), either of which terminates propagation at once.
ExtendableMessageEvent - Web APIs
examples in the below example a page gets a handle to the serviceworker object via serviceworkerregistration.active, and then
calls its postmessage() function.
FileSystemDirectoryEntry.createReader() - Web APIs
entries = []; let getentries = function() { dirreader.readentries(function(results) { if (results.length) { entries = entries.concat(toarray(results)); getentries(); } }, function(error) { /* handle error -- error is a fileerror object */ }); }; getentries(); return entries; } this works by creating an internal function, getentries(), which
calls itself recursively to get all the entries in the directory, concatenating each batch to the array.
FileSystemDirectoryEntry.getDirectory() - Web APIs
the success callback for this takes the resulting directory entry object and
calls getfile() to get a filesystemfileentry object representing the dictionary file; the success callback for this, in turn, creates a new filereader and uses it to load the contents of the file.
FileSystemDirectoryEntry.getFile() - Web APIs
the success callback for this takes the resulting directory entry object and
calls getfile() to get a filesystemfileentry object representing the dictionary file; the success callback for this, in turn, creates a new filereader and uses it to load the contents of the file.
FileSystemEntry.remove() - Web APIs
fileerror.security_err the entry couldn't be removed due to permissions or other access constraints, or because there are too many
calls being made on file resources.
msAudioCategory - Web APIs
yes communications for streaming communication audio such as the following: voip real time chat or other type of phone
calls should not be used in non-real-time or non-communication scenarios, such as audio and/or video playback, as playback startup latency is affected.
HTMLCanvasElement.getContext() - Web APIs
later
calls to this method on the same canvas element return the same drawing context instance as was returned the last time the method was invoked with the same contexttype argument.
HTMLMediaElement.play() - Web APIs
usage notes although the term "autoplay" is usually thought of as referring to pages that immediately begin playing media upon being loaded, web browsers' autoplay policies also apply to any script-initiated playback of media, including
calls to play().
File drag and drop - Web APIs
file[' + i + '].name = ' + ev.datatransfer.files[i].name); } } } prevent the browser's default drag behavior the following dragover event handler
calls preventdefault() to turn off the browser's default drag and drop handler.
HTML Drag and Drop API - Web APIs
tatransfer.dropeffect = "move"; } function drop_handler(ev) { ev.preventdefault(); // get the id of the target and add the moved element to the target's dom const data = ev.datatransfer.getdata("text/plain"); ev.target.appendchild(document.getelementbyid(data)); } </script> <p id="target" ondrop="drop_handler(event)" ondragover="dragover_handler(event)">drop zone</p> note that each handler
calls preventdefault() to prevent additional event processing for this event (such as touch events or pointer events).
InstallEvent - Web APIs
examples this code snippet is from the service worker prefetch sample (see prefetch running live.) the code
calls extendableevent.waituntil() in serviceworkerglobalscope.oninstall and delays treating the serviceworkerregistration.installing worker as installed until the passed promise resolves successfully.
Intersection Observer API - Web APIs
handling intersection changes when the browser detects that the target element (in our case, the one with the id "box") has been unveiled or obscured such that its visibility ratio crosses one of the thresholds in our list, it
calls our handler function, handleintersect(): function handleintersect(entries, observer) { entries.foreach((entry) => { if (entry.intersectionratio > prevratio) { entry.target.style.backgroundcolor = increasingcolor.replace("ratio", entry.intersectionratio); } else { entry.target.style.backgroundcolor = decreasingcolor.replace("ratio", entry.intersectionratio); } prevr...
LockManager.request() - Web APIs
the do_read() requests a lock in 'shared' mode meaning that multiple
calls may occur simultaneously across different event handlers, tabs, or workers.
MediaKeyStatusMap - Web APIs
mediakeystatusmap.foreach(callback[, argument]) read only
calls callback once for each key-value pair in the status map, in insertion order.
MediaStreamConstraints.audio - Web APIs
element.innerhtml += msg + "<br>"; } document.getelementbyid("startbutton").addeventlistener("click", function() { navigator.mediadevices.getusermedia({ audio: { samplesize: 8, echocancellation: true } }).then(stream => audioelement.srcobject = stream) .catch(err => log(err.name + ": " + err.message)); }, false); here we see an event handler for a click event which
calls getusermedia(), specifying a set of audio constraints requesting that echo cancellation be enabled and that, if possible, the sample rate be 8 bits per sample instead of the more common 16 bits (possibly as a bandwidth saving measure).
MediaStreamConstraints.video - Web APIs
+= msg + "<br>"; } document.getelementbyid("startbutton").addeventlistener("click", function() { navigator.mediadevices.getusermedia({ video: { width: 160, height: 120, framerate: 15 } }).then(stream => videoelement.srcobject = stream) .catch(err => log(err.name + ": " + err.message)); }, false); here we see an event handler for a click event which
calls getusermedia(), specifying a set of video constraints that indicate a preference for a video track whose dimensions are as close as possible to 160x120 pixels, and whose frame rate is as close to 15 frames per second as possible.
MediaStreamTrackEvent - Web APIs
the mediastreamtrackevent interface represents events which indicate that a mediastream has had tracks added to or removed from the stream through
calls to media stream api methods.
MediaTrackConstraints.deviceId - Web APIs
because of this, there's no use for the device id when calling mediastreamtrack.applyconstraints(), since there is only one possible value; however, you can record a deviceid and use it to ensure that you get the same source for multiple
calls to getusermedia().
MerchantValidationEvent.complete() - Web APIs
the event handler
calls a function, getvalidationdata(), which retrieves the data from the validation url, then passes that data (or a promise to deliver the data) into complete().
Navigator.getBattery() - Web APIs
syntax var batterypromise = navigator.getbattery(); return value a promise which, when resolved,
calls its fulfillment handler with a single parameter: a batterymanager object which you can use to get information about the battery's state.
msSaveBlob - Web APIs
notes when a site
calls this method, the behavior is the same as when windows internet explorer downloads a file with the following in the header, where x-download-options removes the file open button from the browser file download dialog: content-length: <blob.size> content-type: <blob.type> content-disposition: attachment;filename=<defaultname> x-download-options: noopen specifications not part of any specificatio...
msSaveOrOpenBlob - Web APIs
notes when a site
calls this method, the behavior is the same as when windows internet explorer downloads a file with the following in the header: content-length: <blob.size> content-type: <blob.type> content-disposition: attachment;filename=<defaultname> specifications not part of any specifications.
Notification.close() - Web APIs
at the end of the function, it also
calls close() inside a addeventlistener() function to remove the notification when the relevant content has been read on the webpage.
Using the Notifications API - Web APIs
<button id="enable">enable notifications</button> clicking this
calls the asknotificationpermission() function: function asknotificationpermission() { // function to actually ask the permissions function handlepermission(permission) { // whatever the user answers, we make sure chrome stores the information if(!('permission' in notification)) { notification.permission = permission; } // set the button to shown or hidden, depending on what...
PaymentRequest.show() - Web APIs
other reasons a securityerror may be thrown are at the discretion of the user agent, and may include situations such as too many
calls to show() being made in a short time or show() being called while payment requests are blocked by parental controls.
PaymentRequestUpdateEvent - Web APIs
methods in addition to methods inherited from the parent interface, event, paymentrequestupdateevent offers the following methods: paymentrequestupdateevent.updatewith() secure context if the event handler determines that information included in the payment request needs to be changed, or that new information needs to be added, it
calls updatewith() with the information that needs to be replaced or added.
Pointer Lock API - Web APIs
it also includes a check whether a requestanimationframe() call has previously been made, and if so,
calls it again as required, and
calls the canvasdraw() function that updates the canvas scene.
PushManager.subscribe() - Web APIs
console.log(error); } ); }); responding to user gestures subscribe()
calls should be done in response to a user gesture, such as clicking a button, for example: btn.addeventlistener('click', function() { serviceworkerregistration.pushmanager.subscribe(options) .then(function(pushsubscription) { // handle subscription }); }) this is not only best practice — you should not be spamming users with notifications they didn't agree to — but going forward browse...
RTCConfiguration.certificates - Web APIs
one obvious benefit to providing your own is identity key continuity—if you use the same certificate for subsequent
calls, the remote peer can tell you're the same caller.
RTCDataChannel: bufferedamountlow event - Web APIs
let pc = new rtcpeerconnection(); let dc = pc.createdatachannel("sendfile"); let source = /* source data object */ dc.bufferedamountlowthreshold = 65536; pc.addeventlistener("bufferedamountlow", ev => { if (source.position <= source.length) { dc.send(source.readfile(65536)); } }, false); after creating the rtcpeerconnection, this
calls rtcpeerconnection.createdatachannel() to create the data channel.
RTCDataChannel - Web APIs
stream read only the deprecated (and never part of the official specification) read-only rtcdatachannel property stream returns an id number (between 0 and 65,535) which uniquely identifies the rtcdatachannel.event handlersalso inherits event handlers from: eventtargetonbufferedamountlow the rtcdatachannel.onbufferedamountlow property is an eventhandler which specifies a function the browser
calls when the bufferedamountlow event is sent to the rtcdatachannel.
RTCDtlsTransport - Web APIs
description allocation of dtls transports rtcdtlstransport objects are created when an app
calls either setlocaldescription() or setremotedescription().
RTCIceCandidateStats - Web APIs
const isusablenetworktype = stats => { switch(stats.networktype) { case "ethernet": case "vpn": return true; case "bluetooth": case "cellular": case "wimax": case "unknown": default: return false; } } if (rtcstats && rtcstats.type === "local-candidate") { if (!isusablenetworktype(rtcstats)) { abortconnection(); return; } } this code
calls a function called abortconnection() if the rtcstats object represents information about a local candidate is which would be using a network connection other than ethernet or a vpn.
RTCIceTransport: statechange event - Web APIs
bubbles no cancelable no interface event event handler property rtcicetransport.onstatechange examples given an rtcpeerconnection, pc, the following code creates an event handler that
calls a function named handlefailure() if the ice transport enters a failure state.
RTCPeerConnection() - Web APIs
this configuration option cannot be changed after it is first specified; once the certificates have been set, this property is ignored in future
calls to rtcpeerconnection.setconfiguration().
RTCPeerConnection: addstream event - Web APIs
if (pc.addtrack !== undefined) { pc.ontrack = ev => { ev.streams.foreach(stream => doaddstream(stream)); } } else { pc.onaddstream = ev => { doaddstream(ev.stream); } } this
calls a function doaddstream() once for each stream being added to the rtcpeerconnection, regardless of whether the browser sends addstream or track.
RTCPeerConnection.createDataChannel() - Web APIs
negotiated optional by default (false), data channels are negotiated in-band, where one side
calls createdatachannel, and the other side listens to the rtcdatachannelevent event using the ondatachannel eventhandler .
RTCPeerConnection - Web APIs
constant description "new" the ice agent is gathering addresses or is waiting to be given remote candidates through
calls to rtcpeerconnection.addicecandidate() (or both).
RTCPeerConnectionIceErrorEvent.address - Web APIs
examples this example creates a handler for icecandidateerror events which creates human readable messages describing the local network interface for the connection as well as the ice server that was being used to try to open the connection, then
calls a function to display those as well as the event's errortext property's contents.
RTCRtpSender.getParameters() - Web APIs
examples this example gets the sender's current transaction id; the transaction id uniquely identifies the current set of parameters, to ensure that
calls to setparameters() are always handled in the correct order, avoiding inadvertently overwriting parameters with older parameters.
Request - Web APIs
note: the body functions can be run only once; subsequent
calls will resolve with empty strings/arraybuffers.
Response.clone() - Web APIs
when the fetch resolves successfully, we clone it, extract a blob from both responses using two body.blob
calls, create object urls out of the blobs using url.createobjecturl, and display them in two separate <img> elements.
RsaOaepParams - Web APIs
unless your application
calls for a label, you can just omit this argument and it will not affect the security of the encryption operation.
ServiceWorkerGlobalScope: message event - Web APIs
bubbles no cancelable no interface extendablemessageevent event handler property onmessage examples in the below example a page gets a handle to the serviceworker object via serviceworkerregistration.active, and then
calls its postmessage() function.
SourceBuffer.changeType() - Web APIs
the changetype() method of the sourcebuffer interface sets the mime type that future
calls to appendbuffer() should expect the new media data to conform to.
SourceBuffer - Web APIs
sourcebuffer.changetype() changes the mime type that future
calls to appendbuffer() will expect the new data to conform to.
TextDecoder.prototype.decode() - Web APIs
options optional is a textdecodeoptions dictionary with the property: stream a boolean flag indicating that additional data will follow in subsequent
calls to decode().
TextTrackList.onaddtrack - Web APIs
example this snippet establishes a handler for the addtrack event that
calls a function, addtotracklist(), passing in the videotrack object representing the newly-added track.
TouchEvent - Web APIs
the exception to this is chrome, starting with version 56 (desktop, chrome for android, and android webview), where the default value for the passive option for touchstart and touchmove is true and
calls to preventdefault() will have no effect.
Touch events - Web APIs
for (var i = 0; i < touches.length; i++) { console.log("touchstart:" + i + "..."); ongoingtouches.push(copytouch(touches[i])); var color = colorfortouch(touches[i]); ctx.beginpath(); ctx.arc(touches[i].pagex, touches[i].pagey, 4, 0, 2 * math.pi, false); // a circle at the start ctx.fillstyle = color; ctx.fill(); console.log("touchstart:" + i + "."); } } this
calls event.preventdefault() to keep the browser from continuing to process the touch event (this also prevents a mouse event from also being delivered).
VideoPlaybackQuality.corruptedVideoFrames - Web APIs
example this example determines the percentage of frames which have been corrupted, and if the value is greater than 5%,
calls a funciton called downgradevideo() that would be implemented to switch to a different video that might tax the network less.
VideoPlaybackQuality.creationTime - Web APIs
example this example
calls getvideoplaybackquality() to obtain a videoplaybackquality object, then determines what percentage of frames have been lost by either corruption or being dropped.
VideoTrackList.onaddtrack - Web APIs
example this snippet establishes a handler for the addtrack event that
calls a function, addtotracklist(), passing in the videotrack object representing the newly-added track.
WebGL2RenderingContext.readBuffer() - Web APIs
the webgl2renderingcontext.readbuffer() method of the webgl 2 api selects a color buffer as the source for pixels for subsequent
calls to copyteximage2d, copytexsubimage2d, copytexsubimage3d or readpixels.
Color masking - Web APIs
note that the
calls to colormask() only occur when the user clicks on one of the toggle buttons.
Creating 3D objects using WebGL - Web APIs
drawing the cube next we need to add code to our drawscene() function to draw using the cube's index buffer, adding new gl.bindbuffer() and gl.drawelements()
calls: // tell webgl which indices to use to index the vertices gl.bindbuffer(gl.element_array_buffer, buffers.indices); ...
Introduction to the Real-time Transport Protocol (RTP) - Web APIs
remote peer when the "sendrecv" offer is received by the remote peer, it
calls its holdended() method: async function holdended(offer, micstream) { try { await peerconnection.setremotedescription(offer); await audiotransceiver.sender.replacetrack(micstream.getaudiotracks()[0]); audiotransceiver.direction = "sendrecv"; await sendanswer(); } catch(err) { /* handle the error */ } } the steps taken inside the try block here are: the received offe...
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
ptions => { await pc.setlocaldescription(await pc.createoffer(options)); signaler.send({ description: pc.localdescription }); }; pc.oniceconnectionstatechange = () => { if (pc.iceconnectionstate === "failed") { pc.restartice(); } }; with this improved technique, instead of directly calling onnegotiationneeded with options to trigger ice restart, the failed ice connection state simply
calls restartice().
Taking still photos with WebRTC - Web APIs
handle clicks on the button to capture a still photo each time the user clicks the startbutton, we need to add an event listener to the button, to be called when the click event is issued: startbutton.addeventlistener('click', function(ev){ takepicture(); ev.preventdefault(); }, false); this method is simple enough: it just
calls our takepicture() function, defined below in the section capturing a frame from the stream, then
calls event.preventdefault() on the received event to prevent the click from being handled more than once.
WebRTC API - Web APIs
signaling and two-way video calling a tutorial and example which turns a websocket-based chat system created for a previous example and adds support for opening video
calls among participants.
WebSocket.bufferedAmount - Web APIs
the websocket.bufferedamount read-only property returns the number of bytes of data that have been queued using
calls to send() but not yet transmitted to the network.
Using bounded reference spaces - Web APIs
that means you need to change the code that
calls requestreferencespace() to ask for a bounded reference space, then if that fails fall back to your backup choice, like this: let xrsession = null; let xrreferencespace = null; let spacetype = null; function onsessionstarted(session) { xrsession = session; spacetype = "bounded-floor"; xrsession.requestreferencespace(spacetype) .then(onrefspacecreated) .catch(() => { spacetype = "l...
Inputs and input sources - Web APIs
it
calls a function applyexternalinputs() which we'll define momentarily; it takes the avatar object and uses its information to update the avatar's reference frame.
Example and tutorial: Simple synth keyboard - Web APIs
function notereleased(event) { let dataset = event.target.dataset; if (dataset && dataset["pressed"]) { osclist[dataset["octave"][dataset["note"]]].stop(); osclist[dataset["octave"][dataset["note"]]] = null; delete dataset["pressed"]; } } notereleased() uses the data-octave and data-note custom attributes to look up the key's oscillator, then
calls the oscillator's inherited stop() method to stop playing the note.
Window.closed - Web APIs
refreshing a previously opened popup in this example the function refreshpopupwindow()
calls the reload() method of the popup's location object to refresh its data.
Window: unhandledrejection event - Web APIs
you can prevent that from happening by adding a handler for unhandledrejection events that—in addition to any other tasks you wish to perform—
calls preventdefault() to cancel the event, preventing it from bubbling up to be handled by the runtime's logging code.
XRInputSourceArray.length - Web APIs
the first takes the user to an amazon.com search for vr controllers, and the second
calls a quitgame() function to start shutting the game program down.
XRInputSourceArray - Web APIs
in addition to these methods, you may use array notation to access items in the list by index for example, the snippet of code below
calls a function handleinput(), passing into it the first item in the input source list, if the list isn't empty.
XRPose.transform - Web APIs
if the source is a controller in the user's primary hand, a function is called on the targeted object called primaryaction(); otherwise, it
calls the targeted object's offhandaction() function.
XRSession.requestAnimationFrame() - Web APIs
questsession("inline").then((xrsession) => { xrsession.requestanimationframe((time, xrframe) => { let viewer = xrframe.getviewerpose(xrreferencespace) gl.bindframebuffer(xrwebgllayer.framebuffer) for (xrview of viewer.views) { let xrviewport = xrwebgllayer.getviewport(xrview) gl.viewport(xrviewport.x, xrviewport.y, xrviewport.width, xrviewport.height) // webgl draw
calls will now be rendered into the appropriate viewport.
XRSessionEvent.session - Web APIs
xrsession.addeventlistener("visibilitychange", e => { switch(e.session.visibilitystate) { case "hidden": myenablerendering(true); break; case "visible": case "visible-blurred": myenablerendering(false); break; } }); this
calls a function that reacts to the session's visibility state change.
XRSystem: devicechange event - Web APIs
if (navigator.xr) { navigator.xr.addeventlistener("devicechange", event => { navigator.xr.issessionsupported("immersive-vr") .then(immersiveok) => { if (immersiveok) { enablexrbutton.disabled = false; } else { enablexrbutton.disabled = true; } }); }); } when devicechange is received, the handler set up in this code
calls the xr method issessionsupported() to find out if there's a device available that can handle immersive vr presentations.
XRWebGLLayer - Web APIs
let gllayer = xrsession.renderstate.baselayer; gl.bindframebuffer(gl.framebuffer, gllayer.framebuffer); rendering every view in a frame each time the gpu is ready to render the scene to the xr device, the xr runtime
calls the function you specified when you called the xrsession method requestanimationframe() to ask to render the frame.
Architecture - Accessibility
not only can this save extra
calls, but it will always return the visual line of text when used with the gettext methods and line boundaries.
Event reference
rt 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 incoming resuming statechange voicechange sensor events compassneedscalibration devicemotion deviceorientation orientationchange smartcard events icccardlockerror iccinfochange smartcard-insert smartcard-remove stkcommand stksessionend cardstatechange sms and ussd events delivered received sent ussdreceiv...
Getting Started - Developer guides
est.html'); httprequest.send(); } function alertcontents() { if (httprequest.readystate === xmlhttprequest.done) { if (httprequest.status === 200) { alert(httprequest.responsetext); } else { alert('there was a problem with the request.'); } } } })(); </script> in this example: the user clicks the "make a request" button; the event handler
calls the makerequest() function; the request is made and then (onreadystatechange) the execution is passed to alertcontents(); alertcontents() checks if the response was received and ok, then alert()s the contents of the test.html file.
Video player styling basics - Developer guides
to ensure this, a new click handler needs to be defined for the play/pause button so that it too raises the play and pause events: playpause.addeventlistener('click', function(e) { if (video.paused || video.ended) video.play(); else video.pause(); }); volume the altervolume() function, called when the player's volume buttons are clicked, also changes — it now
calls a new function called checkvolume(): var checkvolume = function(dir) { if (dir) { var currentvolume = math.floor(video.volume * 10) / 10; if (dir === '+') { if (currentvolume < 1) video.volume += 0.1; } else if (dir === '-') { if (currentvolume > 0) video.volume -= 0.1; } // if the volume has been turned off, also set it as muted // ...
Constraint validation - Developer guides
here is the html part: <label for="fs">select a file smaller than 75 kb : </label> <input type="file" id="fs"> this displays: the javascript reads the file selected, uses the file.size() method to get its size, compares it to the (hard coded) limit, and
calls the constraint api to inform the browser if there is a violation: function checkfilesize() { var fs = document.getelementbyid("fs"); var files = fs.files; // if there is (at least) one file selected if (files.length > 0) { if (files[0].size > 75 * 1024) { // check the constraint fs.setcustomvalidity("the selected file must not be larger than 75 kb"); return; } ...
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
s are added to or removed from an <audio> element, you can use code like this: var elem = document.queryselector("audio"); elem.audiotracklist.onaddtrack = function(event) { trackeditor.addtrack(event.track); }; elem.audiotracklist.onremovetrack = function(event) { trackeditor.removetrack(event.track); }; this code watches for audio tracks to be added to and removed from the element, and
calls a hypothetical function on a track editor to register and remove the track from the editor's list of available tracks.
<video>: The Video Embed element - HTML: Hypertext Markup Language
ks are added to or removed from a <video> element, you can use code like this: var elem = document.queryselector("video"); elem.audiotracklist.onaddtrack = function(event) { trackeditor.addtrack(event.track); }; elem.audiotracklist.onremovetrack = function(event) { trackeditor.removetrack(event.track); }; this code watches for audio tracks to be added to and removed from the element, and
calls a hypothetical function on a track editor to register and remove the track from the editor's list of available tracks.
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 csp provides.
Feature-Policy: geolocation - HTTP
when this policy is enabled,
calls to getcurrentposition() and watchposition() will cause those functions' callbacks to be invoked with a positionerror code of permission_denied.
Feature-Policy - HTTP
when this policy is disabled,
calls to getcurrentposition() and watchposition() will cause those functions' callbacks to be invoked with a positionerror code of permission_denied.
Index - HTTP
when this policy is enabled,
calls to getcurrentposition() and watchposition() will cause those functions' callbacks to be invoked with a positionerror code of permission_denied.
Set-Cookie - HTTP
lax: the cookie is withheld on cross-site subrequests, such as
calls to load images or frames, but is sent when a user navigates to the url from an external site, such as by following a link.
HTTP Index - HTTP
when this policy is enabled,
calls to getcurrentposition() and watchposition() will cause those functions' callbacks to be invoked with a positionerror code of permission_denied.
Details of the object model - JavaScript
the constructor
calls the base method, passing as its arguments two of the arguments passed to the constructor ("doe, jane" and ["navigator", "javascript"]) and also the string "engineering".
Numbers and dates - JavaScript
then
calls to the gethours, getminutes, and getseconds methods assign the value of the current hour, minute, and second to hour, minute, and second.
Text formatting - JavaScript
const foo = new string('foo'); // creates a string object console.log(foo); // displays: [string: 'foo'] typeof foo; // returns 'object' you can call any of the methods of the string object on a string literal value—javascript automatically converts the string literal to a temporary string object,
calls the method, then discards the temporary string object.
Memory Management - JavaScript
object and contained values // (like object) allocates memory for the array and // contained values var a = [1, null, 'abra']; function f(a) { return a + 2; } // allocates a function (which is a callable object) // function expressions also allocate an object someelement.addeventlistener('click', function() { someelement.style.backgroundcolor = 'blue'; }, false); allocation via function
calls some function
calls result in object allocation.
extends - JavaScript
class square extends polygon { constructor(length) { // here, it
calls the parent class' constructor with lengths // provided for the polygon's width and height super(length, length); // note: in derived classes, super() must be called before you // can use 'this'.
The legacy Iterator protocol - JavaScript
difference between legacy and es2015 iterator protocols the value was returned directly as a return value of
calls to next, instead of the value property of a placeholder object iteration termination was expressed by throwing a stopiteration object.
Default parameters - JavaScript
function append(value, array = []) { array.push(value) return array } append(1) // [1] append(2) // [2], not [1, 2] this even applies to functions and variables: function
callsomething(thing = something()) { return thing } let numberoftimescalled = 0 function something() { numberoftimescalled += 1 return numberoftimescalled }
callsomething() // 1
callsomething() // 2 earlier parameters are available to later default parameters parameters defined earlier (to the left) are available to later default parameters: function greet(name, greeting, message = greeti...
getter - JavaScript
description sometimes it is desirable to allow access to a property that returns a dynamically computed value, or you may want to reflect the status of an internal variable without requiring the use of explicit method
calls.
Array.prototype.filter() - JavaScript
description filter()
calls a provided callback function once for each element in an array, and constructs a new array of all the values for which callback returns a value that coerces to true.
Array.isArray() - JavaScript
if (!array.isarray) { array.isarray = function(arg) { return object.prototype.tostring.call(arg) === '[object array]'; }; } examples using array.isarray // all following
calls return true array.isarray([]); array.isarray([1]); array.isarray(new array()); array.isarray(new array('a', 'b', 'c', 'd')); array.isarray(new array(3)); // little known fact: array.prototype itself is an array: array.isarray(array.prototype); // all following
calls return false array.isarray(); array.isarray({}); array.isarray(null); array.isarray(undefined); array.isarray(17); array.isarray('a...
Array.prototype.map() - JavaScript
description map
calls a provided callback function once for each element in an array, in order, and constructs a new array from the results.
Array.prototype.toString() - JavaScript
javascript
calls the tostring method automatically when an array is to be represented as a text value or when an array is referred to in a string concatenation.
Array - JavaScript
array.prototype.foreach()
calls a function for each element in the array.
Boolean.prototype.toString() - JavaScript
javascript
calls the tostring() method automatically when a boolean is to be represented as a text value or when a boolean is referred to in a string concatenation.
Date.prototype.getTime() - JavaScript
// since month is zero based, birthday will be january 10, 1995 var birthday = new date(1994, 12, 10); var copy = new date(); copy.settime(birthday.gettime()); measuring execution time subtracting two subsequent gettime()
calls on newly generated date objects, give the time span between these two
calls.
FinalizationRegistry - JavaScript
it's likely that major implementations will call cleanup callbacks at some point during execution, but those
calls may be substantially after the related object was reclaimed.
JSON.stringify() - JavaScript
json.stringify()
calls tojson with one parameter: if this object is a property value, the property name if it is in an array, the index in the array, as a string an empty string if json.stringify() was directly called on this object for example: var obj = { data: 'data', tojson (key) { if (key) return `now i am a nested object under key '${key}'`; else return thi...
Map - JavaScript
map.prototype.foreach(callbackfn[, thisarg])
calls callbackfn once for each key-value pair present in the map object, in insertion order.
Number.prototype.toFixed() - JavaScript
if the absolute value of numobj is greater or equal to 1e+21, this method simply
calls number.prototype.tostring() and returns a string in exponential notation.
Object.prototype.toString() - JavaScript
nction dogtostring() { const ret = 'dog ' + this.name + ' is a ' + this.sex + ' ' + this.color + ' ' + this.breed; return ret; } or, using es6 template strings: dog.prototype.tostring = function dogtostring() { return `dog ${this.name} is a ${this.sex} ${this.color} ${this.breed}`; } with the preceding code in place, any time thedog is used in a string context, javascript automatically
calls the dogtostring() function, which returns the following string: "dog gabby is a female chocolate lab" using tostring() to detect object class tostring() can be used with every object and (by default) allows you to get its class.
Promise() constructor - JavaScript
const myfirstpromise = new promise((resolve, reject) => { // do something asynchronous which eventually
calls either: // // resolve(somevalue) // fulfilled // or // reject("failure reason") // rejected }); making functions return a promise to provide a function with promise functionality, have it return a promise: function myasyncfunction(url) { return new promise((resolve, reject) => { const xhr = new xmlhttprequest() xhr.open("get", url) xhr.onload = () => resolve(...
Promise - JavaScript
the chain is composed of .then()
calls, and typically (but not necessarily) has a single .catch() at the end, optionally followed by .finally().
Proxy - JavaScript
handler functions are sometimes called traps, presumably because they trap
calls to the target object.
Reflect - JavaScript
static methods reflect.apply(target, thisargument, argumentslist)
calls a target function with arguments as specified by the argumentslist parameter.
RegExp.prototype[@@match]() - JavaScript
class myregexp extends regexp { [symbol.match](str) { let result = regexp.prototype[symbol.match].call(this, str); if (!result) return null; return { group(n) { return result[n]; } }; } } let re = new myregexp('([0-9]+)-([0-9]+)-([0-9]+)'); let str = '2016-01-02'; let result = str.match(re); // string.prototype.match
calls re[@@match].
RegExp.prototype[@@replace]() - JavaScript
var result = str; for (var i = 0; i < this.count; i++) { result = regexp.prototype[symbol.replace].call(this, result, replacement); } return result; } } var re = new myregexp('\\d', '', 3); var str = '01234567'; var newstr = str.replace(re, '#'); // string.prototype.replace
calls re[@@replace].
RegExp.prototype[@@search]() - JavaScript
class myregexp extends regexp { constructor(str) { super(str) this.pattern = str; } [symbol.search](str) { return str.indexof(this.pattern); } } var re = new myregexp('a+b'); var str = 'ab a+b'; var result = str.search(re); // string.prototype.search
calls re[@@search].
RegExp.prototype[@@split]() - JavaScript
class myregexp extends regexp { [symbol.split](str, limit) { let result = regexp.prototype[symbol.split].call(this, str, limit); return result.map(x => "(" + x + ")"); } } let re = new myregexp('-'); let str = '2016-01-02'; let result = str.split(re); // string.prototype.split
calls re[@@split].
RegExp.prototype.sticky - JavaScript
perhaps because of the bug, the es2015 specification specifically
calls out the fact that: when the y flag is used with a pattern, ^ always matches only at the beginning of the input, or (if multiline is true) at the beginning of a line.
Set - JavaScript
set.prototype.foreach(callbackfn[, thisarg])
calls callbackfn once for each value present in the set object, in insertion order.
String.prototype.matchAll() - JavaScript
examples regexp.exec() and matchall() prior to the addition of matchall to javascript, it was possible to use
calls to regexp.exec (and regexes with the /g flag) in a loop to obtain all the matches: const regexp = regexp('foo[a-z]*','g'); const str = 'table football, foosball'; let match; while ((match = regexp.exec(str)) !== null) { console.log(`found ${match[0]} start=${match.index} end=${regexp.lastindex}.`); // expected output: "found football start=6 end=14." // expected output: "found foosball st...
String.raw() - JavaScript
syntax string.raw(
callsite, ...substitutions) string.raw`templatestring` parameters
callsite well-formed template call site object, like { raw: ['foo', 'bar', 'baz'] }.
String - JavaScript
(the same is true of boolean and numbers.) string literals (denoted by double or single quotes) and strings returned from string
calls in a non-constructor context (that is, called without using the new keyword) are primitive strings.
TypedArray.prototype.filter() - JavaScript
description the filter() method
calls a provided callback function once for each element in a typed array, and constructs a new typed array of all the values for which callback returns a true value.
TypedArray.from() - JavaScript
hence, when working with proxy objects, it
calls handler.set to create new elements rather than handler.defineproperty().
TypedArray.prototype.map() - JavaScript
description the map() method
calls a provided callback function (mapfn) once for each element in a typed array, in order, and constructs a new typed array from the results.
TypedArray.of() - JavaScript
hence, when working with proxy objects, it
calls handler.set to create new elements rather than handler.defineproperty.
TypedArray.prototype.toString() - JavaScript
var numbers = new uint8array([2, 5, 8, 1, 4]) numbers.tostring(); // "2,5,8,1,4" javascript
calls the tostring method automatically when a typed array is to be represented as a text value or when an array is referred to in a string concatenation.
WeakRef - JavaScript
if the target of a weakref is also in a finalizationregistry, the weakref's target is cleared at the same time or before any cleanup callback associated with the registry is called; if your cleanup callback
calls deref on a weakref for the object, it will receive undefined.
instanceof - JavaScript
components.interfaces.nsifile)
calls obj.queryinterface(xpcominterface) and returns true if queryinterface succeeded.
typeof - JavaScript
n a string is still typeof string typeof (typeof 1) === 'string'; // typeof always returns a string typeof string(1) === 'string'; // string converts anything into a string, safer than tostring // booleans typeof true === 'boolean'; typeof false === 'boolean'; typeof boolean(1) === 'boolean'; // boolean() will convert values based on if they're truthy or falsy typeof !!(1) === 'boolean'; // two
calls of the !
yield* - JavaScript
examples delegating to another generator in following code, values yielded by g1() are returned from next()
calls just like those which are yielded by g2().
async function - JavaScript
however, the await
calls still run in series, which means the second await will wait for the first one to finish.
function* - JavaScript
when a generator is finished, subsequent next()
calls will not execute any of that generator's code, they will just return an object of this form: {value: undefined, done: true}.
import - JavaScript
ecmascript (ecma-262)the definition of 'import
calls' in that specification.
Trailing commas - JavaScript
function f(p) {} function f(p,) {} (p) => {}; (p,) => {}; the trailing comma also works with method definitions for classes or objects: class c { one(a,) {} two(a, b,) {} } var obj = { one(a,) {}, two(a, b,) {}, }; function
calls the following function invocation pairs are legal and equivalent to each other.
Performance fundamentals - Web Performance
use requestanimationframe() instead of setinterval()
calls to window.setinterval() run code at a presumed frame rate that may or may not be possible under current circumstances.
Populating the page: how browsers work - Web Performance
if you’ve ever heard of the 14kb rule for initial page load, tcp slow start is the reason why the initial response is 14kb, and why web performance optimization
calls for focusing optimizations with this initial 14kb response in mind.
Optimizing startup performance - Web Performance
the most important thing to do to try to help with the main code's startup process is to refactor the code into small pieces that can be done in chunks interspersed across multiple
calls to your app's main loop, so that the main thread gets to handle input and the like.
Compiling a New C/C++ Module to WebAssembly - WebAssembly
e the following code as hello3.c in a new directory: #include <stdio.h> #include <emscripten/emscripten.h> int main(int argc, char ** argv) { printf("hello world\n"); } #ifdef __cplusplus extern "c" { #endif void emscripten_keepalive myfunction(int argc, char ** argv) { printf("myfunction called\n"); } #ifdef __cplusplus } #endif by default, emscripten-generated code always just
calls the main() function, and other functions are eliminated as dead code.
Index - WebAssembly
10 understanding webassembly text format functions, javascript, s-expressions, webassembly,
calls, memory, shared address, table, text format, was, wasm this finishes our high-level tour of the major components of the webassembly text format and how they get reflected in the webassembly js api.
onunload - XUL
closing the window
calls this eventhandler on the prefwindow.